ccdeck 3.23.4 → 3.24.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,296 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const c of i.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var Hu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jf={exports:{}},Ll={},ep={exports:{}},ot={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var pk;function _I(){if(pk)return ot;pk=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.iterator;function y(O){return O===null||typeof O!="object"?null:(O=m&&O[m]||O["@@iterator"],typeof O=="function"?O:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,_={};function S(O,K,de){this.props=O,this.context=K,this.refs=_,this.updater=de||w}S.prototype.isReactComponent={},S.prototype.setState=function(O,K){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,K,"setState")},S.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function b(){}b.prototype=S.prototype;function j(O,K,de){this.props=O,this.context=K,this.refs=_,this.updater=de||w}var E=j.prototype=new b;E.constructor=j,N(E,S.prototype),E.isPureReactComponent=!0;var C=Array.isArray,T=Object.prototype.hasOwnProperty,R={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function D(O,K,de){var G,J={},U=null,ne=null;if(K!=null)for(G in K.ref!==void 0&&(ne=K.ref),K.key!==void 0&&(U=""+K.key),K)T.call(K,G)&&!$.hasOwnProperty(G)&&(J[G]=K[G]);var ae=arguments.length-2;if(ae===1)J.children=de;else if(1<ae){for(var pe=Array(ae),ge=0;ge<ae;ge++)pe[ge]=arguments[ge+2];J.children=pe}if(O&&O.defaultProps)for(G in ae=O.defaultProps,ae)J[G]===void 0&&(J[G]=ae[G]);return{$$typeof:e,type:O,key:U,ref:ne,props:J,_owner:R.current}}function W(O,K){return{$$typeof:e,type:O.type,key:K,ref:O.ref,props:O.props,_owner:O._owner}}function L(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function V(O){var K={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(de){return K[de]})}var Q=/\/+/g;function ee(O,K){return typeof O=="object"&&O!==null&&O.key!=null?V(""+O.key):K.toString(36)}function M(O,K,de,G,J){var U=typeof O;(U==="undefined"||U==="boolean")&&(O=null);var ne=!1;if(O===null)ne=!0;else switch(U){case"string":case"number":ne=!0;break;case"object":switch(O.$$typeof){case e:case t:ne=!0}}if(ne)return ne=O,J=J(ne),O=G===""?"."+ee(ne,0):G,C(J)?(de="",O!=null&&(de=O.replace(Q,"$&/")+"/"),M(J,K,de,"",function(ge){return ge})):J!=null&&(L(J)&&(J=W(J,de+(!J.key||ne&&ne.key===J.key?"":(""+J.key).replace(Q,"$&/")+"/")+O)),K.push(J)),1;if(ne=0,G=G===""?".":G+":",C(O))for(var ae=0;ae<O.length;ae++){U=O[ae];var pe=G+ee(U,ae);ne+=M(U,K,de,pe,J)}else if(pe=y(O),typeof pe=="function")for(O=pe.call(O),ae=0;!(U=O.next()).done;)U=U.value,pe=G+ee(U,ae++),ne+=M(U,K,de,pe,J);else if(U==="object")throw K=String(O),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.");return ne}function X(O,K,de){if(O==null)return O;var G=[],J=0;return M(O,G,"","",function(U){return K.call(de,U,J++)}),G}function H(O){if(O._status===-1){var K=O._result;K=K(),K.then(function(de){(O._status===0||O._status===-1)&&(O._status=1,O._result=de)},function(de){(O._status===0||O._status===-1)&&(O._status=2,O._result=de)}),O._status===-1&&(O._status=0,O._result=K)}if(O._status===1)return O._result.default;throw O._result}var I={current:null},B={transition:null},P={ReactCurrentDispatcher:I,ReactCurrentBatchConfig:B,ReactCurrentOwner:R};function z(){throw Error("act(...) is not supported in production builds of React.")}return ot.Children={map:X,forEach:function(O,K,de){X(O,function(){K.apply(this,arguments)},de)},count:function(O){var K=0;return X(O,function(){K++}),K},toArray:function(O){return X(O,function(K){return K})||[]},only:function(O){if(!L(O))throw Error("React.Children.only expected to receive a single React element child.");return O}},ot.Component=S,ot.Fragment=n,ot.Profiler=a,ot.PureComponent=j,ot.StrictMode=r,ot.Suspense=f,ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=P,ot.act=z,ot.cloneElement=function(O,K,de){if(O==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+O+".");var G=N({},O.props),J=O.key,U=O.ref,ne=O._owner;if(K!=null){if(K.ref!==void 0&&(U=K.ref,ne=R.current),K.key!==void 0&&(J=""+K.key),O.type&&O.type.defaultProps)var ae=O.type.defaultProps;for(pe in K)T.call(K,pe)&&!$.hasOwnProperty(pe)&&(G[pe]=K[pe]===void 0&&ae!==void 0?ae[pe]:K[pe])}var pe=arguments.length-2;if(pe===1)G.children=de;else if(1<pe){ae=Array(pe);for(var ge=0;ge<pe;ge++)ae[ge]=arguments[ge+2];G.children=ae}return{$$typeof:e,type:O.type,key:J,ref:U,props:G,_owner:ne}},ot.createContext=function(O){return O={$$typeof:c,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},O.Provider={$$typeof:i,_context:O},O.Consumer=O},ot.createElement=D,ot.createFactory=function(O){var K=D.bind(null,O);return K.type=O,K},ot.createRef=function(){return{current:null}},ot.forwardRef=function(O){return{$$typeof:u,render:O}},ot.isValidElement=L,ot.lazy=function(O){return{$$typeof:h,_payload:{_status:-1,_result:O},_init:H}},ot.memo=function(O,K){return{$$typeof:p,type:O,compare:K===void 0?null:K}},ot.startTransition=function(O){var K=B.transition;B.transition={};try{O()}finally{B.transition=K}},ot.unstable_act=z,ot.useCallback=function(O,K){return I.current.useCallback(O,K)},ot.useContext=function(O){return I.current.useContext(O)},ot.useDebugValue=function(){},ot.useDeferredValue=function(O){return I.current.useDeferredValue(O)},ot.useEffect=function(O,K){return I.current.useEffect(O,K)},ot.useId=function(){return I.current.useId()},ot.useImperativeHandle=function(O,K,de){return I.current.useImperativeHandle(O,K,de)},ot.useInsertionEffect=function(O,K){return I.current.useInsertionEffect(O,K)},ot.useLayoutEffect=function(O,K){return I.current.useLayoutEffect(O,K)},ot.useMemo=function(O,K){return I.current.useMemo(O,K)},ot.useReducer=function(O,K,de){return I.current.useReducer(O,K,de)},ot.useRef=function(O){return I.current.useRef(O)},ot.useState=function(O){return I.current.useState(O)},ot.useSyncExternalStore=function(O,K,de){return I.current.useSyncExternalStore(O,K,de)},ot.useTransition=function(){return I.current.useTransition()},ot.version="18.3.1",ot}var mk;function gc(){return mk||(mk=1,ep.exports=_I()),ep.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 gk;function NI(){if(gk)return Ll;gk=1;var e=gc(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(u,f,p){var h,m={},y=null,w=null;p!==void 0&&(y=""+p),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(w=f.ref);for(h in f)r.call(f,h)&&!i.hasOwnProperty(h)&&(m[h]=f[h]);if(u&&u.defaultProps)for(h in f=u.defaultProps,f)m[h]===void 0&&(m[h]=f[h]);return{$$typeof:t,type:u,key:y,ref:w,props:m,_owner:a.current}}return Ll.Fragment=n,Ll.jsx=c,Ll.jsxs=c,Ll}var yk;function SI(){return yk||(yk=1,Jf.exports=NI()),Jf.exports}var l=SI(),Gu={},tp={exports:{}},Dn={},np={exports:{}},rp={};/**
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 wk;function jI(){return wk||(wk=1,(function(e){function t(B,P){var z=B.length;B.push(P);e:for(;0<z;){var O=z-1>>>1,K=B[O];if(0<a(K,P))B[O]=P,B[z]=K,z=O;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var P=B[0],z=B.pop();if(z!==P){B[0]=z;e:for(var O=0,K=B.length,de=K>>>1;O<de;){var G=2*(O+1)-1,J=B[G],U=G+1,ne=B[U];if(0>a(J,z))U<K&&0>a(ne,J)?(B[O]=ne,B[U]=z,O=U):(B[O]=J,B[G]=z,O=G);else if(U<K&&0>a(ne,z))B[O]=ne,B[U]=z,O=U;else break e}}return P}function a(B,P){var z=B.sortIndex-P.sortIndex;return z!==0?z:B.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var f=[],p=[],h=1,m=null,y=3,w=!1,N=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(B){for(var P=n(p);P!==null;){if(P.callback===null)r(p);else if(P.startTime<=B)r(p),P.sortIndex=P.expirationTime,t(f,P);else break;P=n(p)}}function C(B){if(_=!1,E(B),!N)if(n(f)!==null)N=!0,H(T);else{var P=n(p);P!==null&&I(C,P.startTime-B)}}function T(B,P){N=!1,_&&(_=!1,b(D),D=-1),w=!0;var z=y;try{for(E(P),m=n(f);m!==null&&(!(m.expirationTime>P)||B&&!V());){var O=m.callback;if(typeof O=="function"){m.callback=null,y=m.priorityLevel;var K=O(m.expirationTime<=P);P=e.unstable_now(),typeof K=="function"?m.callback=K:m===n(f)&&r(f),E(P)}else r(f);m=n(f)}if(m!==null)var de=!0;else{var G=n(p);G!==null&&I(C,G.startTime-P),de=!1}return de}finally{m=null,y=z,w=!1}}var R=!1,$=null,D=-1,W=5,L=-1;function V(){return!(e.unstable_now()-L<W)}function Q(){if($!==null){var B=e.unstable_now();L=B;var P=!0;try{P=$(!0,B)}finally{P?ee():(R=!1,$=null)}}else R=!1}var ee;if(typeof j=="function")ee=function(){j(Q)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,X=M.port2;M.port1.onmessage=Q,ee=function(){X.postMessage(null)}}else ee=function(){S(Q,0)};function H(B){$=B,R||(R=!0,ee())}function I(B,P){D=S(function(){B(e.unstable_now())},P)}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(B){B.callback=null},e.unstable_continueExecution=function(){N||w||(N=!0,H(T))},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(B){switch(y){case 1:case 2:case 3:var P=3;break;default:P=y}var z=y;y=P;try{return B()}finally{y=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(B,P){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var z=y;y=B;try{return P()}finally{y=z}},e.unstable_scheduleCallback=function(B,P,z){var O=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?O+z:O):z=O,B){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=z+K,B={id:h++,callback:P,priorityLevel:B,startTime:z,expirationTime:K,sortIndex:-1},z>O?(B.sortIndex=z,t(p,B),n(f)===null&&B===n(p)&&(_?(b(D),D=-1):_=!0,I(C,z-O))):(B.sortIndex=K,t(f,B),N||w||(N=!0,H(T))),B},e.unstable_shouldYield=V,e.unstable_wrapCallback=function(B){var P=y;return function(){var z=y;y=P;try{return B.apply(this,arguments)}finally{y=z}}}})(rp)),rp}var vk;function EI(){return vk||(vk=1,np.exports=jI()),np.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 xk;function CI(){if(xk)return Dn;xk=1;var e=gc(),t=EI();function n(s){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+s,d=1;d<arguments.length;d++)o+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+s+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,a={};function i(s,o){c(s,o),c(s+"Capture",o)}function c(s,o){for(a[s]=o,s=0;s<o.length;s++)r.add(o[s])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},m={};function y(s){return f.call(m,s)?!0:f.call(h,s)?!1:p.test(s)?m[s]=!0:(h[s]=!0,!1)}function w(s,o,d,g){if(d!==null&&d.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return g?!1:d!==null?!d.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function N(s,o,d,g){if(o===null||typeof o>"u"||w(s,o,d,g))return!0;if(g)return!1;if(d!==null)switch(d.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function _(s,o,d,g,v,k,A){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=g,this.attributeNamespace=v,this.mustUseProperty=d,this.propertyName=s,this.type=o,this.sanitizeURL=k,this.removeEmptyString=A}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){S[s]=new _(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var o=s[0];S[o]=new _(o,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){S[s]=new _(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){S[s]=new _(s,2,!1,s,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(s){S[s]=new _(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){S[s]=new _(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){S[s]=new _(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){S[s]=new _(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){S[s]=new _(s,5,!1,s.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function j(s){return s[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(s){var o=s.replace(b,j);S[o]=new _(o,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var o=s.replace(b,j);S[o]=new _(o,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var o=s.replace(b,j);S[o]=new _(o,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){S[s]=new _(s,1,!1,s.toLowerCase(),null,!1,!1)}),S.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){S[s]=new _(s,1,!1,s.toLowerCase(),null,!0,!0)});function E(s,o,d,g){var v=S.hasOwnProperty(o)?S[o]:null;(v!==null?v.type!==0:g||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,d,v,g)&&(d=null),g||v===null?y(o)&&(d===null?s.removeAttribute(o):s.setAttribute(o,""+d)):v.mustUseProperty?s[v.propertyName]=d===null?v.type===3?!1:"":d:(o=v.attributeName,g=v.attributeNamespace,d===null?s.removeAttribute(o):(v=v.type,d=v===3||v===4&&d===!0?"":""+d,g?s.setAttributeNS(g,o,d):s.setAttribute(o,d))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),R=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),W=Symbol.for("react.profiler"),L=Symbol.for("react.provider"),V=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),B=Symbol.iterator;function P(s){return s===null||typeof s!="object"?null:(s=B&&s[B]||s["@@iterator"],typeof s=="function"?s:null)}var z=Object.assign,O;function K(s){if(O===void 0)try{throw Error()}catch(d){var o=d.stack.trim().match(/\n( *(at )?)/);O=o&&o[1]||""}return`
34
+ `+O+s}var de=!1;function G(s,o){if(!s||de)return"";de=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(fe){var g=fe}Reflect.construct(s,[],o)}else{try{o.call()}catch(fe){g=fe}s.call(o.prototype)}else{try{throw Error()}catch(fe){g=fe}s()}}catch(fe){if(fe&&g&&typeof fe.stack=="string"){for(var v=fe.stack.split(`
35
+ `),k=g.stack.split(`
36
+ `),A=v.length-1,Y=k.length-1;1<=A&&0<=Y&&v[A]!==k[Y];)Y--;for(;1<=A&&0<=Y;A--,Y--)if(v[A]!==k[Y]){if(A!==1||Y!==1)do if(A--,Y--,0>Y||v[A]!==k[Y]){var te=`
37
+ `+v[A].replace(" at new "," at ");return s.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",s.displayName)),te}while(1<=A&&0<=Y);break}}}finally{de=!1,Error.prepareStackTrace=d}return(s=s?s.displayName||s.name:"")?K(s):""}function J(s){switch(s.tag){case 5:return K(s.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("SuspenseList");case 0:case 2:case 15:return s=G(s.type,!1),s;case 11:return s=G(s.type.render,!1),s;case 1:return s=G(s.type,!0),s;default:return""}}function U(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case $:return"Fragment";case R:return"Portal";case W:return"Profiler";case D:return"StrictMode";case ee:return"Suspense";case M:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case V:return(s.displayName||"Context")+".Consumer";case L:return(s._context.displayName||"Context")+".Provider";case Q:var o=s.render;return s=s.displayName,s||(s=o.displayName||o.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case X:return o=s.displayName||null,o!==null?o:U(s.type)||"Memo";case H:o=s._payload,s=s._init;try{return U(s(o))}catch{}}return null}function ne(s){var o=s.type;switch(s.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 s=o.render,s=s.displayName||s.name||"",o.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return U(o);case 8:return o===D?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function ae(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function pe(s){var o=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function ge(s){var o=pe(s)?"checked":"value",d=Object.getOwnPropertyDescriptor(s.constructor.prototype,o),g=""+s[o];if(!s.hasOwnProperty(o)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,k=d.set;return Object.defineProperty(s,o,{configurable:!0,get:function(){return v.call(this)},set:function(A){g=""+A,k.call(this,A)}}),Object.defineProperty(s,o,{enumerable:d.enumerable}),{getValue:function(){return g},setValue:function(A){g=""+A},stopTracking:function(){s._valueTracker=null,delete s[o]}}}}function Se(s){s._valueTracker||(s._valueTracker=ge(s))}function Oe(s){if(!s)return!1;var o=s._valueTracker;if(!o)return!0;var d=o.getValue(),g="";return s&&(g=pe(s)?s.checked?"true":"false":s.value),s=g,s!==d?(o.setValue(s),!0):!1}function We(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function Pe(s,o){var d=o.checked;return z({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??s._wrapperState.initialChecked})}function Te(s,o){var d=o.defaultValue==null?"":o.defaultValue,g=o.checked!=null?o.checked:o.defaultChecked;d=ae(o.value!=null?o.value:d),s._wrapperState={initialChecked:g,initialValue:d,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function et(s,o){o=o.checked,o!=null&&E(s,"checked",o,!1)}function je(s,o){et(s,o);var d=ae(o.value),g=o.type;if(d!=null)g==="number"?(d===0&&s.value===""||s.value!=d)&&(s.value=""+d):s.value!==""+d&&(s.value=""+d);else if(g==="submit"||g==="reset"){s.removeAttribute("value");return}o.hasOwnProperty("value")?Ye(s,o.type,d):o.hasOwnProperty("defaultValue")&&Ye(s,o.type,ae(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(s.defaultChecked=!!o.defaultChecked)}function _e(s,o,d){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var g=o.type;if(!(g!=="submit"&&g!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+s._wrapperState.initialValue,d||o===s.value||(s.value=o),s.defaultValue=o}d=s.name,d!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,d!==""&&(s.name=d)}function Ye(s,o,d){(o!=="number"||We(s.ownerDocument)!==s)&&(d==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+d&&(s.defaultValue=""+d))}var dt=Array.isArray;function Qe(s,o,d,g){if(s=s.options,o){o={};for(var v=0;v<d.length;v++)o["$"+d[v]]=!0;for(d=0;d<s.length;d++)v=o.hasOwnProperty("$"+s[d].value),s[d].selected!==v&&(s[d].selected=v),v&&g&&(s[d].defaultSelected=!0)}else{for(d=""+ae(d),o=null,v=0;v<s.length;v++){if(s[v].value===d){s[v].selected=!0,g&&(s[v].defaultSelected=!0);return}o!==null||s[v].disabled||(o=s[v])}o!==null&&(o.selected=!0)}}function ue(s,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return z({},o,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function be(s,o){var d=o.value;if(d==null){if(d=o.children,o=o.defaultValue,d!=null){if(o!=null)throw Error(n(92));if(dt(d)){if(1<d.length)throw Error(n(93));d=d[0]}o=d}o==null&&(o=""),d=o}s._wrapperState={initialValue:ae(d)}}function Re(s,o){var d=ae(o.value),g=ae(o.defaultValue);d!=null&&(d=""+d,d!==s.value&&(s.value=d),o.defaultValue==null&&s.defaultValue!==d&&(s.defaultValue=d)),g!=null&&(s.defaultValue=""+g)}function Xe(s){var o=s.textContent;o===s._wrapperState.initialValue&&o!==""&&o!==null&&(s.value=o)}function $e(s){switch(s){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ct(s,o){return s==null||s==="http://www.w3.org/1999/xhtml"?$e(o):s==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var ye,Ee=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,d,g,v){MSApp.execUnsafeLocalFunction(function(){return s(o,d,g,v)})}:s})(function(s,o){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=o;else{for(ye=ye||document.createElement("div"),ye.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=ye.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;o.firstChild;)s.appendChild(o.firstChild)}});function ie(s,o){if(o){var d=s.firstChild;if(d&&d===s.lastChild&&d.nodeType===3){d.nodeValue=o;return}}s.textContent=o}var Je={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},rt=["Webkit","ms","Moz","O"];Object.keys(Je).forEach(function(s){rt.forEach(function(o){o=o+s.charAt(0).toUpperCase()+s.substring(1),Je[o]=Je[s]})});function lt(s,o,d){return o==null||typeof o=="boolean"||o===""?"":d||typeof o!="number"||o===0||Je.hasOwnProperty(s)&&Je[s]?(""+o).trim():o+"px"}function tt(s,o){s=s.style;for(var d in o)if(o.hasOwnProperty(d)){var g=d.indexOf("--")===0,v=lt(d,o[d],g);d==="float"&&(d="cssFloat"),g?s.setProperty(d,v):s[d]=v}}var nt=z({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(s,o){if(o){if(nt[s]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,s));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 yt(s,o){if(s.indexOf("-")===-1)return typeof o.is=="string";switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wt=null;function Et(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Xt=null,he=null,ut=null;function st(s){if(s=kl(s)){if(typeof Xt!="function")throw Error(n(280));var o=s.stateNode;o&&(o=ou(o),Xt(s.stateNode,s.type,o))}}function kn(s){he?ut?ut.push(s):ut=[s]:he=s}function pn(){if(he){var s=he,o=ut;if(ut=he=null,st(s),o)for(s=0;s<o.length;s++)st(o[s])}}function Cn(s,o){return s(o)}function Lt(){}var Bn=!1;function nn(s,o,d){if(Bn)return s(o,d);Bn=!0;try{return Cn(s,o,d)}finally{Bn=!1,(he!==null||ut!==null)&&(Lt(),pn())}}function At(s,o){var d=s.stateNode;if(d===null)return null;var g=ou(d);if(g===null)return null;d=g[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(s=s.type,g=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!g;break e;default:s=!1}if(s)return null;if(d&&typeof d!="function")throw Error(n(231,o,typeof d));return d}var Qn=!1;if(u)try{var rn={};Object.defineProperty(rn,"passive",{get:function(){Qn=!0}}),window.addEventListener("test",rn,rn),window.removeEventListener("test",rn,rn)}catch{Qn=!1}function Br(s,o,d,g,v,k,A,Y,te){var fe=Array.prototype.slice.call(arguments,3);try{o.apply(d,fe)}catch(ve){this.onError(ve)}}var _n=!1,wr=null,vr=!1,zr=null,Us={onError:function(s){_n=!0,wr=s}};function Nn(s,o,d,g,v,k,A,Y,te){_n=!1,wr=null,Br.apply(Us,arguments)}function ms(s,o,d,g,v,k,A,Y,te){if(Nn.apply(this,arguments),_n){if(_n){var fe=wr;_n=!1,wr=null}else throw Error(n(198));vr||(vr=!0,zr=fe)}}function Z(s){var o=s,d=s;if(s.alternate)for(;o.return;)o=o.return;else{s=o;do o=s,(o.flags&4098)!==0&&(d=o.return),s=o.return;while(s)}return o.tag===3?d:null}function Ce(s){if(s.tag===13){var o=s.memoizedState;if(o===null&&(s=s.alternate,s!==null&&(o=s.memoizedState)),o!==null)return o.dehydrated}return null}function Fe(s){if(Z(s)!==s)throw Error(n(188))}function Me(s){var o=s.alternate;if(!o){if(o=Z(s),o===null)throw Error(n(188));return o!==s?null:s}for(var d=s,g=o;;){var v=d.return;if(v===null)break;var k=v.alternate;if(k===null){if(g=v.return,g!==null){d=g;continue}break}if(v.child===k.child){for(k=v.child;k;){if(k===d)return Fe(v),s;if(k===g)return Fe(v),o;k=k.sibling}throw Error(n(188))}if(d.return!==g.return)d=v,g=k;else{for(var A=!1,Y=v.child;Y;){if(Y===d){A=!0,d=v,g=k;break}if(Y===g){A=!0,g=v,d=k;break}Y=Y.sibling}if(!A){for(Y=k.child;Y;){if(Y===d){A=!0,d=k,g=v;break}if(Y===g){A=!0,g=k,d=v;break}Y=Y.sibling}if(!A)throw Error(n(189))}}if(d.alternate!==g)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?s:o}function ze(s){return s=Me(s),s!==null?ht(s):null}function ht(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var o=ht(s);if(o!==null)return o;s=s.sibling}return null}var Rt=t.unstable_scheduleCallback,Mt=t.unstable_cancelCallback,xr=t.unstable_shouldYield,xt=t.unstable_requestPaint,bt=t.unstable_now,gs=t.unstable_getCurrentPriorityLevel,Ws=t.unstable_ImmediatePriority,jo=t.unstable_UserBlockingPriority,ys=t.unstable_NormalPriority,Eo=t.unstable_LowPriority,Hs=t.unstable_IdlePriority,ws=null,Tn=null;function Ur(s){if(Tn&&typeof Tn.onCommitFiberRoot=="function")try{Tn.onCommitFiberRoot(ws,s,void 0,(s.current.flags&128)===128)}catch{}}var An=Math.clz32?Math.clz32:Rc,Co=Math.log,Ac=Math.LN2;function Rc(s){return s>>>=0,s===0?32:31-(Co(s)/Ac|0)|0}var Wr=64,To=4194304;function Gs(s){switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function Ra(s,o){var d=s.pendingLanes;if(d===0)return 0;var g=0,v=s.suspendedLanes,k=s.pingedLanes,A=d&268435455;if(A!==0){var Y=A&~v;Y!==0?g=Gs(Y):(k&=A,k!==0&&(g=Gs(k)))}else A=d&~v,A!==0?g=Gs(A):k!==0&&(g=Gs(k));if(g===0)return 0;if(o!==0&&o!==g&&(o&v)===0&&(v=g&-g,k=o&-o,v>=k||v===16&&(k&4194240)!==0))return o;if((g&4)!==0&&(g|=d&16),o=s.entangledLanes,o!==0)for(s=s.entanglements,o&=g;0<o;)d=31-An(o),v=1<<d,g|=s[d],o&=~v;return g}function Ph(s,o){switch(s){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 Mc(s,o){for(var d=s.suspendedLanes,g=s.pingedLanes,v=s.expirationTimes,k=s.pendingLanes;0<k;){var A=31-An(k),Y=1<<A,te=v[A];te===-1?((Y&d)===0||(Y&g)!==0)&&(v[A]=Ph(Y,o)):te<=o&&(s.expiredLanes|=Y),k&=~Y}}function vs(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function Ic(){var s=Wr;return Wr<<=1,(Wr&4194240)===0&&(Wr=64),s}function Ao(s){for(var o=[],d=0;31>d;d++)o.push(s);return o}function sn(s,o,d){s.pendingLanes|=o,o!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,o=31-An(o),s[o]=d}function Ro(s,o){var d=s.pendingLanes&~o;s.pendingLanes=o,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=o,s.mutableReadLanes&=o,s.entangledLanes&=o,o=s.entanglements;var g=s.eventTimes;for(s=s.expirationTimes;0<d;){var v=31-An(d),k=1<<v;o[v]=0,g[v]=-1,s[v]=-1,d&=~k}}function Ki(s,o){var d=s.entangledLanes|=o;for(s=s.entanglements;d;){var g=31-An(d),v=1<<g;v&o|s[g]&o&&(s[g]|=o),d&=~v}}var ft=0;function Ft(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var $c,Jn,Ma,Yi,Oc,er=!1,xs=[],Hr=null,Gr=null,br=null,Vs=new Map,tr=new Map,kr=[],Pc="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Ia(s,o){switch(s){case"focusin":case"focusout":Hr=null;break;case"dragenter":case"dragleave":Gr=null;break;case"mouseover":case"mouseout":br=null;break;case"pointerover":case"pointerout":Vs.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":tr.delete(o.pointerId)}}function bs(s,o,d,g,v,k){return s===null||s.nativeEvent!==k?(s={blockedOn:o,domEventName:d,eventSystemFlags:g,nativeEvent:k,targetContainers:[v]},o!==null&&(o=kl(o),o!==null&&Jn(o)),s):(s.eventSystemFlags|=g,o=s.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),s)}function Lc(s,o,d,g,v){switch(o){case"focusin":return Hr=bs(Hr,s,o,d,g,v),!0;case"dragenter":return Gr=bs(Gr,s,o,d,g,v),!0;case"mouseover":return br=bs(br,s,o,d,g,v),!0;case"pointerover":var k=v.pointerId;return Vs.set(k,bs(Vs.get(k)||null,s,o,d,g,v)),!0;case"gotpointercapture":return k=v.pointerId,tr.set(k,bs(tr.get(k)||null,s,o,d,g,v)),!0}return!1}function Xi(s){var o=Ka(s.target);if(o!==null){var d=Z(o);if(d!==null){if(o=d.tag,o===13){if(o=Ce(d),o!==null){s.blockedOn=o,Oc(s.priority,function(){Ma(d)});return}}else if(o===3&&d.stateNode.current.memoizedState.isDehydrated){s.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}s.blockedOn=null}function $a(s){if(s.blockedOn!==null)return!1;for(var o=s.targetContainers;0<o.length;){var d=$o(s.domEventName,s.eventSystemFlags,o[0],s.nativeEvent);if(d===null){d=s.nativeEvent;var g=new d.constructor(d.type,d);wt=g,d.target.dispatchEvent(g),wt=null}else return o=kl(d),o!==null&&Jn(o),s.blockedOn=d,!1;o.shift()}return!0}function Zi(s,o,d){$a(s)&&d.delete(o)}function Zt(){er=!1,Hr!==null&&$a(Hr)&&(Hr=null),Gr!==null&&$a(Gr)&&(Gr=null),br!==null&&$a(br)&&(br=null),Vs.forEach(Zi),tr.forEach(Zi)}function Vr(s,o){s.blockedOn===o&&(s.blockedOn=null,er||(er=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Zt)))}function Kr(s){function o(v){return Vr(v,s)}if(0<xs.length){Vr(xs[0],s);for(var d=1;d<xs.length;d++){var g=xs[d];g.blockedOn===s&&(g.blockedOn=null)}}for(Hr!==null&&Vr(Hr,s),Gr!==null&&Vr(Gr,s),br!==null&&Vr(br,s),Vs.forEach(o),tr.forEach(o),d=0;d<kr.length;d++)g=kr[d],g.blockedOn===s&&(g.blockedOn=null);for(;0<kr.length&&(d=kr[0],d.blockedOn===null);)Xi(d),d.blockedOn===null&&kr.shift()}var Yr=C.ReactCurrentBatchConfig,Mo=!0;function Ks(s,o,d,g){var v=ft,k=Yr.transition;Yr.transition=null;try{ft=1,Xr(s,o,d,g)}finally{ft=v,Yr.transition=k}}function Dc(s,o,d,g){var v=ft,k=Yr.transition;Yr.transition=null;try{ft=4,Xr(s,o,d,g)}finally{ft=v,Yr.transition=k}}function Xr(s,o,d,g){if(Mo){var v=$o(s,o,d,g);if(v===null)F(s,o,g,Io,d),Ia(s,g);else if(Lc(v,s,o,d,g))g.stopPropagation();else if(Ia(s,g),o&4&&-1<Pc.indexOf(s)){for(;v!==null;){var k=kl(v);if(k!==null&&$c(k),k=$o(s,o,d,g),k===null&&F(s,o,g,Io,d),k===v)break;v=k}v!==null&&g.stopPropagation()}else F(s,o,g,null,d)}}var Io=null;function $o(s,o,d,g){if(Io=null,s=Et(g),s=Ka(s),s!==null)if(o=Z(s),o===null)s=null;else if(d=o.tag,d===13){if(s=Ce(o),s!==null)return s;s=null}else if(d===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;s=null}else o!==s&&(s=null);return Io=s,null}function qc(s){switch(s){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(gs()){case Ws:return 1;case jo:return 4;case ys:case Eo:return 16;case Hs:return 536870912;default:return 16}default:return 16}}var _r=null,Qi=null,nr=null;function Ys(){if(nr)return nr;var s,o=Qi,d=o.length,g,v="value"in _r?_r.value:_r.textContent,k=v.length;for(s=0;s<d&&o[s]===v[s];s++);var A=d-s;for(g=1;g<=A&&o[d-g]===v[k-g];g++);return nr=v.slice(s,1<g?1-g:void 0)}function Oa(s){var o=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&o===13&&(s=13)):s=o,s===10&&(s=13),32<=s||s===13?s:0}function Zr(){return!0}function Ji(){return!1}function an(s){function o(d,g,v,k,A){this._reactName=d,this._targetInst=v,this.type=g,this.nativeEvent=k,this.target=A,this.currentTarget=null;for(var Y in s)s.hasOwnProperty(Y)&&(d=s[Y],this[Y]=d?d(k):k[Y]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?Zr:Ji,this.isPropagationStopped=Ji,this}return z(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Zr)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Zr)},persist:function(){},isPersistent:Zr}),o}var mn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},el=an(mn),Qt=z({},mn,{view:0,detail:0}),tl=an(Qt),Pa,Oo,Qr,Xs=z({},Qt,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:il,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Qr&&(Qr&&s.type==="mousemove"?(Pa=s.screenX-Qr.screenX,Oo=s.screenY-Qr.screenY):Oo=Pa=0,Qr=s),Pa)},movementY:function(s){return"movementY"in s?s.movementY:Oo}}),nl=an(Xs),rl=z({},Xs,{dataTransfer:0}),Fc=an(rl),Lh=z({},Qt,{relatedTarget:0}),Nr=an(Lh),sl=z({},mn,{animationName:0,elapsedTime:0,pseudoElement:0}),Bc=an(sl),al=z({},mn,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),zc=an(al),ol=z({},mn,{data:0}),Jr=an(ol),Uc={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Dh={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"},Wc={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Hc(s){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(s):(s=Wc[s])?!!o[s]:!1}function il(){return Hc}var on=z({},Qt,{key:function(s){if(s.key){var o=Uc[s.key]||s.key;if(o!=="Unidentified")return o}return s.type==="keypress"?(s=Oa(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Dh[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:il,charCode:function(s){return s.type==="keypress"?Oa(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Oa(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Gc=an(on),Po=z({},Xs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ks=an(Po),La=z({},Qt,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:il}),ll=an(La),cl=z({},mn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Lo=an(cl),Da=z({},Xs,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),Vc=an(Da),qh=[9,13,27,32],ul=u&&"CompositionEvent"in window,es=null;u&&"documentMode"in document&&(es=document.documentMode);var Fh=u&&"TextEvent"in window&&!es,Kc=u&&(!ul||es&&8<es&&11>=es),Do=" ",Sr=!1;function Zs(s,o){switch(s){case"keyup":return qh.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dl(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Qs=!1;function Bh(s,o){switch(s){case"compositionend":return dl(o);case"keypress":return o.which!==32?null:(Sr=!0,Do);case"textInput":return s=o.data,s===Do&&Sr?null:s;default:return null}}function Yc(s,o){if(Qs)return s==="compositionend"||!ul&&Zs(s,o)?(s=Ys(),nr=Qi=_r=null,Qs=!1,s):null;switch(s){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 Kc&&o.locale!=="ko"?null:o.data;default:return null}}var zh={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 Xc(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o==="input"?!!zh[s.type]:o==="textarea"}function ln(s,o,d,g){kn(g),o=se(o,"onChange"),0<o.length&&(d=new el("onChange","change",null,d,g),s.push({event:d,listeners:o}))}var qa=null,Fa=null;function Uh(s){nu(s,0)}function _s(s){var o=Jo(s);if(Oe(o))return s}function qo(s,o){if(s==="change")return o}var Zc=!1;if(u){var zn;if(u){var Fo="oninput"in document;if(!Fo){var Qc=document.createElement("div");Qc.setAttribute("oninput","return;"),Fo=typeof Qc.oninput=="function"}zn=Fo}else zn=!1;Zc=zn&&(!document.documentMode||9<document.documentMode)}function hl(){qa&&(qa.detachEvent("onpropertychange",fl),Fa=qa=null)}function fl(s){if(s.propertyName==="value"&&_s(Fa)){var o=[];ln(o,Fa,s,Et(s)),nn(Uh,o)}}function Wh(s,o,d){s==="focusin"?(hl(),qa=o,Fa=d,qa.attachEvent("onpropertychange",fl)):s==="focusout"&&hl()}function Bo(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return _s(Fa)}function Hh(s,o){if(s==="click")return _s(o)}function pl(s,o){if(s==="input"||s==="change")return _s(o)}function Jc(s,o){return s===o&&(s!==0||1/s===1/o)||s!==s&&o!==o}var Rn=typeof Object.is=="function"?Object.is:Jc;function Js(s,o){if(Rn(s,o))return!0;if(typeof s!="object"||s===null||typeof o!="object"||o===null)return!1;var d=Object.keys(s),g=Object.keys(o);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var v=d[g];if(!f.call(o,v)||!Rn(s[v],o[v]))return!1}return!0}function zo(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Ba(s,o){var d=zo(s);s=0;for(var g;d;){if(d.nodeType===3){if(g=s+d.textContent.length,s<=o&&g>=o)return{node:d,offset:o-s};s=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=zo(d)}}function Uo(s,o){return s&&o?s===o?!0:s&&s.nodeType===3?!1:o&&o.nodeType===3?Uo(s,o.parentNode):"contains"in s?s.contains(o):s.compareDocumentPosition?!!(s.compareDocumentPosition(o)&16):!1:!1}function ml(){for(var s=window,o=We();o instanceof s.HTMLIFrameElement;){try{var d=typeof o.contentWindow.location.href=="string"}catch{d=!1}if(d)s=o.contentWindow;else break;o=We(s.document)}return o}function ea(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o&&(o==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||o==="textarea"||s.contentEditable==="true")}function gl(s){var o=ml(),d=s.focusedElem,g=s.selectionRange;if(o!==d&&d&&d.ownerDocument&&Uo(d.ownerDocument.documentElement,d)){if(g!==null&&ea(d)){if(o=g.start,s=g.end,s===void 0&&(s=o),"selectionStart"in d)d.selectionStart=o,d.selectionEnd=Math.min(s,d.value.length);else if(s=(o=d.ownerDocument||document)&&o.defaultView||window,s.getSelection){s=s.getSelection();var v=d.textContent.length,k=Math.min(g.start,v);g=g.end===void 0?k:Math.min(g.end,v),!s.extend&&k>g&&(v=g,g=k,k=v),v=Ba(d,k);var A=Ba(d,g);v&&A&&(s.rangeCount!==1||s.anchorNode!==v.node||s.anchorOffset!==v.offset||s.focusNode!==A.node||s.focusOffset!==A.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),s.removeAllRanges(),k>g?(s.addRange(o),s.extend(A.node,A.offset)):(o.setEnd(A.node,A.offset),s.addRange(o)))}}for(o=[],s=d;s=s.parentNode;)s.nodeType===1&&o.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<o.length;d++)s=o[d],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var Wo=u&&"documentMode"in document&&11>=document.documentMode,ts=null,ns=null,ta=null,Ho=!1;function Wt(s,o,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Ho||ts==null||ts!==We(g)||(g=ts,"selectionStart"in g&&ea(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),ta&&Js(ta,g)||(ta=g,g=se(ns,"onSelect"),0<g.length&&(o=new el("onSelect","select",null,o,d),s.push({event:o,listeners:g}),o.target=ts)))}function za(s,o){var d={};return d[s.toLowerCase()]=o.toLowerCase(),d["Webkit"+s]="webkit"+o,d["Moz"+s]="moz"+o,d}var Ns={animationend:za("Animation","AnimationEnd"),animationiteration:za("Animation","AnimationIteration"),animationstart:za("Animation","AnimationStart"),transitionend:za("Transition","TransitionEnd")},yl={},eu={};u&&(eu=document.createElement("div").style,"AnimationEvent"in window||(delete Ns.animationend.animation,delete Ns.animationiteration.animation,delete Ns.animationstart.animation),"TransitionEvent"in window||delete Ns.transitionend.transition);function Ua(s){if(yl[s])return yl[s];if(!Ns[s])return s;var o=Ns[s],d;for(d in o)if(o.hasOwnProperty(d)&&d in eu)return yl[s]=o[d];return s}var Wa=Ua("animationend"),tu=Ua("animationiteration"),rs=Ua("animationstart"),Go=Ua("transitionend"),Ha=new Map,Vo="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 ss(s,o){Ha.set(s,o),i(o,[s])}for(var Ko=0;Ko<Vo.length;Ko++){var Yo=Vo[Ko],Gh=Yo.toLowerCase(),Vh=Yo[0].toUpperCase()+Yo.slice(1);ss(Gh,"on"+Vh)}ss(Wa,"onAnimationEnd"),ss(tu,"onAnimationIteration"),ss(rs,"onAnimationStart"),ss("dblclick","onDoubleClick"),ss("focusin","onFocus"),ss("focusout","onBlur"),ss(Go,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var na="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(" "),Ga=new Set("cancel close invalid load scroll toggle".split(" ").concat(na));function Xo(s,o,d){var g=s.type||"unknown-event";s.currentTarget=d,ms(g,o,void 0,s),s.currentTarget=null}function nu(s,o){o=(o&4)!==0;for(var d=0;d<s.length;d++){var g=s[d],v=g.event;g=g.listeners;e:{var k=void 0;if(o)for(var A=g.length-1;0<=A;A--){var Y=g[A],te=Y.instance,fe=Y.currentTarget;if(Y=Y.listener,te!==k&&v.isPropagationStopped())break e;Xo(v,Y,fe),k=te}else for(A=0;A<g.length;A++){if(Y=g[A],te=Y.instance,fe=Y.currentTarget,Y=Y.listener,te!==k&&v.isPropagationStopped())break e;Xo(v,Y,fe),k=te}}}if(vr)throw s=zr,vr=!1,zr=null,s}function kt(s,o){var d=o[Kh];d===void 0&&(d=o[Kh]=new Set);var g=s+"__bubble";d.has(g)||(wl(o,s,2,!1),d.add(g))}function Zo(s,o,d){var g=0;o&&(g|=4),wl(d,s,g,o)}var Va="_reactListening"+Math.random().toString(36).slice(2);function ra(s){if(!s[Va]){s[Va]=!0,r.forEach(function(d){d!=="selectionchange"&&(Ga.has(d)||Zo(d,!1,s),Zo(d,!0,s))});var o=s.nodeType===9?s:s.ownerDocument;o===null||o[Va]||(o[Va]=!0,Zo("selectionchange",!1,o))}}function wl(s,o,d,g){switch(qc(o)){case 1:var v=Ks;break;case 4:v=Dc;break;default:v=Xr}d=v.bind(null,o,d,s),v=void 0,!Qn||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),g?v!==void 0?s.addEventListener(o,d,{capture:!0,passive:v}):s.addEventListener(o,d,!0):v!==void 0?s.addEventListener(o,d,{passive:v}):s.addEventListener(o,d,!1)}function F(s,o,d,g,v){var k=g;if((o&1)===0&&(o&2)===0&&g!==null)e:for(;;){if(g===null)return;var A=g.tag;if(A===3||A===4){var Y=g.stateNode.containerInfo;if(Y===v||Y.nodeType===8&&Y.parentNode===v)break;if(A===4)for(A=g.return;A!==null;){var te=A.tag;if((te===3||te===4)&&(te=A.stateNode.containerInfo,te===v||te.nodeType===8&&te.parentNode===v))return;A=A.return}for(;Y!==null;){if(A=Ka(Y),A===null)return;if(te=A.tag,te===5||te===6){g=k=A;continue e}Y=Y.parentNode}}g=g.return}nn(function(){var fe=k,ve=Et(d),xe=[];e:{var we=Ha.get(s);if(we!==void 0){var Ie=el,De=s;switch(s){case"keypress":if(Oa(d)===0)break e;case"keydown":case"keyup":Ie=Gc;break;case"focusin":De="focus",Ie=Nr;break;case"focusout":De="blur",Ie=Nr;break;case"beforeblur":case"afterblur":Ie=Nr;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ie=nl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ie=Fc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ie=ll;break;case Wa:case tu:case rs:Ie=Bc;break;case Go:Ie=Lo;break;case"scroll":Ie=tl;break;case"wheel":Ie=Vc;break;case"copy":case"cut":case"paste":Ie=zc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ie=ks}var qe=(o&4)!==0,qt=!qe&&s==="scroll",le=qe?we!==null?we+"Capture":null:we;qe=[];for(var re=fe,ce;re!==null;){ce=re;var Ne=ce.stateNode;if(ce.tag===5&&Ne!==null&&(ce=Ne,le!==null&&(Ne=At(re,le),Ne!=null&&qe.push(q(re,Ne,ce)))),qt)break;re=re.return}0<qe.length&&(we=new Ie(we,De,null,d,ve),xe.push({event:we,listeners:qe}))}}if((o&7)===0){e:{if(we=s==="mouseover"||s==="pointerover",Ie=s==="mouseout"||s==="pointerout",we&&d!==wt&&(De=d.relatedTarget||d.fromElement)&&(Ka(De)||De[Es]))break e;if((Ie||we)&&(we=ve.window===ve?ve:(we=ve.ownerDocument)?we.defaultView||we.parentWindow:window,Ie?(De=d.relatedTarget||d.toElement,Ie=fe,De=De?Ka(De):null,De!==null&&(qt=Z(De),De!==qt||De.tag!==5&&De.tag!==6)&&(De=null)):(Ie=null,De=fe),Ie!==De)){if(qe=nl,Ne="onMouseLeave",le="onMouseEnter",re="mouse",(s==="pointerout"||s==="pointerover")&&(qe=ks,Ne="onPointerLeave",le="onPointerEnter",re="pointer"),qt=Ie==null?we:Jo(Ie),ce=De==null?we:Jo(De),we=new qe(Ne,re+"leave",Ie,d,ve),we.target=qt,we.relatedTarget=ce,Ne=null,Ka(ve)===fe&&(qe=new qe(le,re+"enter",De,d,ve),qe.target=ce,qe.relatedTarget=qt,Ne=qe),qt=Ne,Ie&&De)t:{for(qe=Ie,le=De,re=0,ce=qe;ce;ce=oe(ce))re++;for(ce=0,Ne=le;Ne;Ne=oe(Ne))ce++;for(;0<re-ce;)qe=oe(qe),re--;for(;0<ce-re;)le=oe(le),ce--;for(;re--;){if(qe===le||le!==null&&qe===le.alternate)break t;qe=oe(qe),le=oe(le)}qe=null}else qe=null;Ie!==null&&Ae(xe,we,Ie,qe,!1),De!==null&&qt!==null&&Ae(xe,qt,De,qe,!0)}}e:{if(we=fe?Jo(fe):window,Ie=we.nodeName&&we.nodeName.toLowerCase(),Ie==="select"||Ie==="input"&&we.type==="file")var Be=qo;else if(Xc(we))if(Zc)Be=pl;else{Be=Bo;var Ge=Wh}else(Ie=we.nodeName)&&Ie.toLowerCase()==="input"&&(we.type==="checkbox"||we.type==="radio")&&(Be=Hh);if(Be&&(Be=Be(s,fe))){ln(xe,Be,d,ve);break e}Ge&&Ge(s,we,fe),s==="focusout"&&(Ge=we._wrapperState)&&Ge.controlled&&we.type==="number"&&Ye(we,"number",we.value)}switch(Ge=fe?Jo(fe):window,s){case"focusin":(Xc(Ge)||Ge.contentEditable==="true")&&(ts=Ge,ns=fe,ta=null);break;case"focusout":ta=ns=ts=null;break;case"mousedown":Ho=!0;break;case"contextmenu":case"mouseup":case"dragend":Ho=!1,Wt(xe,d,ve);break;case"selectionchange":if(Wo)break;case"keydown":case"keyup":Wt(xe,d,ve)}var Ve;if(ul)e:{switch(s){case"compositionstart":var Ze="onCompositionStart";break e;case"compositionend":Ze="onCompositionEnd";break e;case"compositionupdate":Ze="onCompositionUpdate";break e}Ze=void 0}else Qs?Zs(s,d)&&(Ze="onCompositionEnd"):s==="keydown"&&d.keyCode===229&&(Ze="onCompositionStart");Ze&&(Kc&&d.locale!=="ko"&&(Qs||Ze!=="onCompositionStart"?Ze==="onCompositionEnd"&&Qs&&(Ve=Ys()):(_r=ve,Qi="value"in _r?_r.value:_r.textContent,Qs=!0)),Ge=se(fe,Ze),0<Ge.length&&(Ze=new Jr(Ze,s,null,d,ve),xe.push({event:Ze,listeners:Ge}),Ve?Ze.data=Ve:(Ve=dl(d),Ve!==null&&(Ze.data=Ve)))),(Ve=Fh?Bh(s,d):Yc(s,d))&&(fe=se(fe,"onBeforeInput"),0<fe.length&&(ve=new Jr("onBeforeInput","beforeinput",null,d,ve),xe.push({event:ve,listeners:fe}),ve.data=Ve))}nu(xe,o)})}function q(s,o,d){return{instance:s,listener:o,currentTarget:d}}function se(s,o){for(var d=o+"Capture",g=[];s!==null;){var v=s,k=v.stateNode;v.tag===5&&k!==null&&(v=k,k=At(s,d),k!=null&&g.unshift(q(s,k,v)),k=At(s,o),k!=null&&g.push(q(s,k,v))),s=s.return}return g}function oe(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function Ae(s,o,d,g,v){for(var k=o._reactName,A=[];d!==null&&d!==g;){var Y=d,te=Y.alternate,fe=Y.stateNode;if(te!==null&&te===g)break;Y.tag===5&&fe!==null&&(Y=fe,v?(te=At(d,k),te!=null&&A.unshift(q(d,te,Y))):v||(te=At(d,k),te!=null&&A.push(q(d,te,Y)))),d=d.return}A.length!==0&&s.push({event:o,listeners:A})}var ke=/\r\n?/g,He=/\u0000|\uFFFD/g;function at(s){return(typeof s=="string"?s:""+s).replace(ke,`
38
+ `).replace(He,"")}function vt(s,o,d){if(o=at(o),at(s)!==o&&d)throw Error(n(425))}function Ke(){}var gn=null,sa=null;function Qo(s,o){return s==="textarea"||s==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var vl=typeof setTimeout=="function"?setTimeout:void 0,ru=typeof clearTimeout=="function"?clearTimeout:void 0,su=typeof Promise=="function"?Promise:void 0,au=typeof queueMicrotask=="function"?queueMicrotask:typeof su<"u"?function(s){return su.resolve(null).then(s).catch(xl)}:vl;function xl(s){setTimeout(function(){throw s})}function Ss(s,o){var d=o,g=0;do{var v=d.nextSibling;if(s.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"){if(g===0){s.removeChild(v),Kr(o);return}g--}else d!=="$"&&d!=="$?"&&d!=="$!"||g++;d=v}while(d);Kr(o)}function Mn(s){for(;s!=null;s=s.nextSibling){var o=s.nodeType;if(o===1||o===3)break;if(o===8){if(o=s.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return s}function Dt(s){s=s.previousSibling;for(var o=0;s;){if(s.nodeType===8){var d=s.data;if(d==="$"||d==="$!"||d==="$?"){if(o===0)return s;o--}else d==="/$"&&o++}s=s.previousSibling}return null}var js=Math.random().toString(36).slice(2),as="__reactFiber$"+js,bl="__reactProps$"+js,Es="__reactContainer$"+js,Kh="__reactEvents$"+js,FM="__reactListeners$"+js,BM="__reactHandles$"+js;function Ka(s){var o=s[as];if(o)return o;for(var d=s.parentNode;d;){if(o=d[Es]||d[as]){if(d=o.alternate,o.child!==null||d!==null&&d.child!==null)for(s=Dt(s);s!==null;){if(d=s[as])return d;s=Dt(s)}return o}s=d,d=s.parentNode}return null}function kl(s){return s=s[as]||s[Es],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function Jo(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function ou(s){return s[bl]||null}var Yh=[],ei=-1;function aa(s){return{current:s}}function jt(s){0>ei||(s.current=Yh[ei],Yh[ei]=null,ei--)}function Nt(s,o){ei++,Yh[ei]=s.current,s.current=o}var oa={},yn=aa(oa),In=aa(!1),Ya=oa;function ti(s,o){var d=s.type.contextTypes;if(!d)return oa;var g=s.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===o)return g.__reactInternalMemoizedMaskedChildContext;var v={},k;for(k in d)v[k]=o[k];return g&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=o,s.__reactInternalMemoizedMaskedChildContext=v),v}function $n(s){return s=s.childContextTypes,s!=null}function iu(){jt(In),jt(yn)}function P0(s,o,d){if(yn.current!==oa)throw Error(n(168));Nt(yn,o),Nt(In,d)}function L0(s,o,d){var g=s.stateNode;if(o=o.childContextTypes,typeof g.getChildContext!="function")return d;g=g.getChildContext();for(var v in g)if(!(v in o))throw Error(n(108,ne(s)||"Unknown",v));return z({},d,g)}function lu(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||oa,Ya=yn.current,Nt(yn,s),Nt(In,In.current),!0}function D0(s,o,d){var g=s.stateNode;if(!g)throw Error(n(169));d?(s=L0(s,o,Ya),g.__reactInternalMemoizedMergedChildContext=s,jt(In),jt(yn),Nt(yn,s)):jt(In),Nt(In,d)}var Cs=null,cu=!1,Xh=!1;function q0(s){Cs===null?Cs=[s]:Cs.push(s)}function zM(s){cu=!0,q0(s)}function ia(){if(!Xh&&Cs!==null){Xh=!0;var s=0,o=ft;try{var d=Cs;for(ft=1;s<d.length;s++){var g=d[s];do g=g(!0);while(g!==null)}Cs=null,cu=!1}catch(v){throw Cs!==null&&(Cs=Cs.slice(s+1)),Rt(Ws,ia),v}finally{ft=o,Xh=!1}}return null}var ni=[],ri=0,uu=null,du=0,rr=[],sr=0,Xa=null,Ts=1,As="";function Za(s,o){ni[ri++]=du,ni[ri++]=uu,uu=s,du=o}function F0(s,o,d){rr[sr++]=Ts,rr[sr++]=As,rr[sr++]=Xa,Xa=s;var g=Ts;s=As;var v=32-An(g)-1;g&=~(1<<v),d+=1;var k=32-An(o)+v;if(30<k){var A=v-v%5;k=(g&(1<<A)-1).toString(32),g>>=A,v-=A,Ts=1<<32-An(o)+v|d<<v|g,As=k+s}else Ts=1<<k|d<<v|g,As=s}function Zh(s){s.return!==null&&(Za(s,1),F0(s,1,0))}function Qh(s){for(;s===uu;)uu=ni[--ri],ni[ri]=null,du=ni[--ri],ni[ri]=null;for(;s===Xa;)Xa=rr[--sr],rr[sr]=null,As=rr[--sr],rr[sr]=null,Ts=rr[--sr],rr[sr]=null}var Un=null,Wn=null,Ct=!1,jr=null;function B0(s,o){var d=lr(5,null,null,0);d.elementType="DELETED",d.stateNode=o,d.return=s,o=s.deletions,o===null?(s.deletions=[d],s.flags|=16):o.push(d)}function z0(s,o){switch(s.tag){case 5:var d=s.type;return o=o.nodeType!==1||d.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(s.stateNode=o,Un=s,Wn=Mn(o.firstChild),!0):!1;case 6:return o=s.pendingProps===""||o.nodeType!==3?null:o,o!==null?(s.stateNode=o,Un=s,Wn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(d=Xa!==null?{id:Ts,overflow:As}:null,s.memoizedState={dehydrated:o,treeContext:d,retryLane:1073741824},d=lr(18,null,null,0),d.stateNode=o,d.return=s,s.child=d,Un=s,Wn=null,!0):!1;default:return!1}}function Jh(s){return(s.mode&1)!==0&&(s.flags&128)===0}function ef(s){if(Ct){var o=Wn;if(o){var d=o;if(!z0(s,o)){if(Jh(s))throw Error(n(418));o=Mn(d.nextSibling);var g=Un;o&&z0(s,o)?B0(g,d):(s.flags=s.flags&-4097|2,Ct=!1,Un=s)}}else{if(Jh(s))throw Error(n(418));s.flags=s.flags&-4097|2,Ct=!1,Un=s}}}function U0(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Un=s}function hu(s){if(s!==Un)return!1;if(!Ct)return U0(s),Ct=!0,!1;var o;if((o=s.tag!==3)&&!(o=s.tag!==5)&&(o=s.type,o=o!=="head"&&o!=="body"&&!Qo(s.type,s.memoizedProps)),o&&(o=Wn)){if(Jh(s))throw W0(),Error(n(418));for(;o;)B0(s,o),o=Mn(o.nextSibling)}if(U0(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));e:{for(s=s.nextSibling,o=0;s;){if(s.nodeType===8){var d=s.data;if(d==="/$"){if(o===0){Wn=Mn(s.nextSibling);break e}o--}else d!=="$"&&d!=="$!"&&d!=="$?"||o++}s=s.nextSibling}Wn=null}}else Wn=Un?Mn(s.stateNode.nextSibling):null;return!0}function W0(){for(var s=Wn;s;)s=Mn(s.nextSibling)}function si(){Wn=Un=null,Ct=!1}function tf(s){jr===null?jr=[s]:jr.push(s)}var UM=C.ReactCurrentBatchConfig;function _l(s,o,d){if(s=d.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var g=d.stateNode}if(!g)throw Error(n(147,s));var v=g,k=""+s;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===k?o.ref:(o=function(A){var Y=v.refs;A===null?delete Y[k]:Y[k]=A},o._stringRef=k,o)}if(typeof s!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,s))}return s}function fu(s,o){throw s=Object.prototype.toString.call(o),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":s))}function H0(s){var o=s._init;return o(s._payload)}function G0(s){function o(le,re){if(s){var ce=le.deletions;ce===null?(le.deletions=[re],le.flags|=16):ce.push(re)}}function d(le,re){if(!s)return null;for(;re!==null;)o(le,re),re=re.sibling;return null}function g(le,re){for(le=new Map;re!==null;)re.key!==null?le.set(re.key,re):le.set(re.index,re),re=re.sibling;return le}function v(le,re){return le=ma(le,re),le.index=0,le.sibling=null,le}function k(le,re,ce){return le.index=ce,s?(ce=le.alternate,ce!==null?(ce=ce.index,ce<re?(le.flags|=2,re):ce):(le.flags|=2,re)):(le.flags|=1048576,re)}function A(le){return s&&le.alternate===null&&(le.flags|=2),le}function Y(le,re,ce,Ne){return re===null||re.tag!==6?(re=Vf(ce,le.mode,Ne),re.return=le,re):(re=v(re,ce),re.return=le,re)}function te(le,re,ce,Ne){var Be=ce.type;return Be===$?ve(le,re,ce.props.children,Ne,ce.key):re!==null&&(re.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===H&&H0(Be)===re.type)?(Ne=v(re,ce.props),Ne.ref=_l(le,re,ce),Ne.return=le,Ne):(Ne=Lu(ce.type,ce.key,ce.props,null,le.mode,Ne),Ne.ref=_l(le,re,ce),Ne.return=le,Ne)}function fe(le,re,ce,Ne){return re===null||re.tag!==4||re.stateNode.containerInfo!==ce.containerInfo||re.stateNode.implementation!==ce.implementation?(re=Kf(ce,le.mode,Ne),re.return=le,re):(re=v(re,ce.children||[]),re.return=le,re)}function ve(le,re,ce,Ne,Be){return re===null||re.tag!==7?(re=ao(ce,le.mode,Ne,Be),re.return=le,re):(re=v(re,ce),re.return=le,re)}function xe(le,re,ce){if(typeof re=="string"&&re!==""||typeof re=="number")return re=Vf(""+re,le.mode,ce),re.return=le,re;if(typeof re=="object"&&re!==null){switch(re.$$typeof){case T:return ce=Lu(re.type,re.key,re.props,null,le.mode,ce),ce.ref=_l(le,null,re),ce.return=le,ce;case R:return re=Kf(re,le.mode,ce),re.return=le,re;case H:var Ne=re._init;return xe(le,Ne(re._payload),ce)}if(dt(re)||P(re))return re=ao(re,le.mode,ce,null),re.return=le,re;fu(le,re)}return null}function we(le,re,ce,Ne){var Be=re!==null?re.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return Be!==null?null:Y(le,re,""+ce,Ne);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case T:return ce.key===Be?te(le,re,ce,Ne):null;case R:return ce.key===Be?fe(le,re,ce,Ne):null;case H:return Be=ce._init,we(le,re,Be(ce._payload),Ne)}if(dt(ce)||P(ce))return Be!==null?null:ve(le,re,ce,Ne,null);fu(le,ce)}return null}function Ie(le,re,ce,Ne,Be){if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number")return le=le.get(ce)||null,Y(re,le,""+Ne,Be);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case T:return le=le.get(Ne.key===null?ce:Ne.key)||null,te(re,le,Ne,Be);case R:return le=le.get(Ne.key===null?ce:Ne.key)||null,fe(re,le,Ne,Be);case H:var Ge=Ne._init;return Ie(le,re,ce,Ge(Ne._payload),Be)}if(dt(Ne)||P(Ne))return le=le.get(ce)||null,ve(re,le,Ne,Be,null);fu(re,Ne)}return null}function De(le,re,ce,Ne){for(var Be=null,Ge=null,Ve=re,Ze=re=0,tn=null;Ve!==null&&Ze<ce.length;Ze++){Ve.index>Ze?(tn=Ve,Ve=null):tn=Ve.sibling;var mt=we(le,Ve,ce[Ze],Ne);if(mt===null){Ve===null&&(Ve=tn);break}s&&Ve&&mt.alternate===null&&o(le,Ve),re=k(mt,re,Ze),Ge===null?Be=mt:Ge.sibling=mt,Ge=mt,Ve=tn}if(Ze===ce.length)return d(le,Ve),Ct&&Za(le,Ze),Be;if(Ve===null){for(;Ze<ce.length;Ze++)Ve=xe(le,ce[Ze],Ne),Ve!==null&&(re=k(Ve,re,Ze),Ge===null?Be=Ve:Ge.sibling=Ve,Ge=Ve);return Ct&&Za(le,Ze),Be}for(Ve=g(le,Ve);Ze<ce.length;Ze++)tn=Ie(Ve,le,Ze,ce[Ze],Ne),tn!==null&&(s&&tn.alternate!==null&&Ve.delete(tn.key===null?Ze:tn.key),re=k(tn,re,Ze),Ge===null?Be=tn:Ge.sibling=tn,Ge=tn);return s&&Ve.forEach(function(ga){return o(le,ga)}),Ct&&Za(le,Ze),Be}function qe(le,re,ce,Ne){var Be=P(ce);if(typeof Be!="function")throw Error(n(150));if(ce=Be.call(ce),ce==null)throw Error(n(151));for(var Ge=Be=null,Ve=re,Ze=re=0,tn=null,mt=ce.next();Ve!==null&&!mt.done;Ze++,mt=ce.next()){Ve.index>Ze?(tn=Ve,Ve=null):tn=Ve.sibling;var ga=we(le,Ve,mt.value,Ne);if(ga===null){Ve===null&&(Ve=tn);break}s&&Ve&&ga.alternate===null&&o(le,Ve),re=k(ga,re,Ze),Ge===null?Be=ga:Ge.sibling=ga,Ge=ga,Ve=tn}if(mt.done)return d(le,Ve),Ct&&Za(le,Ze),Be;if(Ve===null){for(;!mt.done;Ze++,mt=ce.next())mt=xe(le,mt.value,Ne),mt!==null&&(re=k(mt,re,Ze),Ge===null?Be=mt:Ge.sibling=mt,Ge=mt);return Ct&&Za(le,Ze),Be}for(Ve=g(le,Ve);!mt.done;Ze++,mt=ce.next())mt=Ie(Ve,le,Ze,mt.value,Ne),mt!==null&&(s&&mt.alternate!==null&&Ve.delete(mt.key===null?Ze:mt.key),re=k(mt,re,Ze),Ge===null?Be=mt:Ge.sibling=mt,Ge=mt);return s&&Ve.forEach(function(kI){return o(le,kI)}),Ct&&Za(le,Ze),Be}function qt(le,re,ce,Ne){if(typeof ce=="object"&&ce!==null&&ce.type===$&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case T:e:{for(var Be=ce.key,Ge=re;Ge!==null;){if(Ge.key===Be){if(Be=ce.type,Be===$){if(Ge.tag===7){d(le,Ge.sibling),re=v(Ge,ce.props.children),re.return=le,le=re;break e}}else if(Ge.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===H&&H0(Be)===Ge.type){d(le,Ge.sibling),re=v(Ge,ce.props),re.ref=_l(le,Ge,ce),re.return=le,le=re;break e}d(le,Ge);break}else o(le,Ge);Ge=Ge.sibling}ce.type===$?(re=ao(ce.props.children,le.mode,Ne,ce.key),re.return=le,le=re):(Ne=Lu(ce.type,ce.key,ce.props,null,le.mode,Ne),Ne.ref=_l(le,re,ce),Ne.return=le,le=Ne)}return A(le);case R:e:{for(Ge=ce.key;re!==null;){if(re.key===Ge)if(re.tag===4&&re.stateNode.containerInfo===ce.containerInfo&&re.stateNode.implementation===ce.implementation){d(le,re.sibling),re=v(re,ce.children||[]),re.return=le,le=re;break e}else{d(le,re);break}else o(le,re);re=re.sibling}re=Kf(ce,le.mode,Ne),re.return=le,le=re}return A(le);case H:return Ge=ce._init,qt(le,re,Ge(ce._payload),Ne)}if(dt(ce))return De(le,re,ce,Ne);if(P(ce))return qe(le,re,ce,Ne);fu(le,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,re!==null&&re.tag===6?(d(le,re.sibling),re=v(re,ce),re.return=le,le=re):(d(le,re),re=Vf(ce,le.mode,Ne),re.return=le,le=re),A(le)):d(le,re)}return qt}var ai=G0(!0),V0=G0(!1),pu=aa(null),mu=null,oi=null,nf=null;function rf(){nf=oi=mu=null}function sf(s){var o=pu.current;jt(pu),s._currentValue=o}function af(s,o,d){for(;s!==null;){var g=s.alternate;if((s.childLanes&o)!==o?(s.childLanes|=o,g!==null&&(g.childLanes|=o)):g!==null&&(g.childLanes&o)!==o&&(g.childLanes|=o),s===d)break;s=s.return}}function ii(s,o){mu=s,nf=oi=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&o)!==0&&(On=!0),s.firstContext=null)}function ar(s){var o=s._currentValue;if(nf!==s)if(s={context:s,memoizedValue:o,next:null},oi===null){if(mu===null)throw Error(n(308));oi=s,mu.dependencies={lanes:0,firstContext:s}}else oi=oi.next=s;return o}var Qa=null;function of(s){Qa===null?Qa=[s]:Qa.push(s)}function K0(s,o,d,g){var v=o.interleaved;return v===null?(d.next=d,of(o)):(d.next=v.next,v.next=d),o.interleaved=d,Rs(s,g)}function Rs(s,o){s.lanes|=o;var d=s.alternate;for(d!==null&&(d.lanes|=o),d=s,s=s.return;s!==null;)s.childLanes|=o,d=s.alternate,d!==null&&(d.childLanes|=o),d=s,s=s.return;return d.tag===3?d.stateNode:null}var la=!1;function lf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Y0(s,o){s=s.updateQueue,o.updateQueue===s&&(o.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function Ms(s,o){return{eventTime:s,lane:o,tag:0,payload:null,callback:null,next:null}}function ca(s,o,d){var g=s.updateQueue;if(g===null)return null;if(g=g.shared,(pt&2)!==0){var v=g.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),g.pending=o,Rs(s,d)}return v=g.interleaved,v===null?(o.next=o,of(g)):(o.next=v.next,v.next=o),g.interleaved=o,Rs(s,d)}function gu(s,o,d){if(o=o.updateQueue,o!==null&&(o=o.shared,(d&4194240)!==0)){var g=o.lanes;g&=s.pendingLanes,d|=g,o.lanes=d,Ki(s,d)}}function X0(s,o){var d=s.updateQueue,g=s.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var v=null,k=null;if(d=d.firstBaseUpdate,d!==null){do{var A={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};k===null?v=k=A:k=k.next=A,d=d.next}while(d!==null);k===null?v=k=o:k=k.next=o}else v=k=o;d={baseState:g.baseState,firstBaseUpdate:v,lastBaseUpdate:k,shared:g.shared,effects:g.effects},s.updateQueue=d;return}s=d.lastBaseUpdate,s===null?d.firstBaseUpdate=o:s.next=o,d.lastBaseUpdate=o}function yu(s,o,d,g){var v=s.updateQueue;la=!1;var k=v.firstBaseUpdate,A=v.lastBaseUpdate,Y=v.shared.pending;if(Y!==null){v.shared.pending=null;var te=Y,fe=te.next;te.next=null,A===null?k=fe:A.next=fe,A=te;var ve=s.alternate;ve!==null&&(ve=ve.updateQueue,Y=ve.lastBaseUpdate,Y!==A&&(Y===null?ve.firstBaseUpdate=fe:Y.next=fe,ve.lastBaseUpdate=te))}if(k!==null){var xe=v.baseState;A=0,ve=fe=te=null,Y=k;do{var we=Y.lane,Ie=Y.eventTime;if((g&we)===we){ve!==null&&(ve=ve.next={eventTime:Ie,lane:0,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null});e:{var De=s,qe=Y;switch(we=o,Ie=d,qe.tag){case 1:if(De=qe.payload,typeof De=="function"){xe=De.call(Ie,xe,we);break e}xe=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=qe.payload,we=typeof De=="function"?De.call(Ie,xe,we):De,we==null)break e;xe=z({},xe,we);break e;case 2:la=!0}}Y.callback!==null&&Y.lane!==0&&(s.flags|=64,we=v.effects,we===null?v.effects=[Y]:we.push(Y))}else Ie={eventTime:Ie,lane:we,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},ve===null?(fe=ve=Ie,te=xe):ve=ve.next=Ie,A|=we;if(Y=Y.next,Y===null){if(Y=v.shared.pending,Y===null)break;we=Y,Y=we.next,we.next=null,v.lastBaseUpdate=we,v.shared.pending=null}}while(!0);if(ve===null&&(te=xe),v.baseState=te,v.firstBaseUpdate=fe,v.lastBaseUpdate=ve,o=v.shared.interleaved,o!==null){v=o;do A|=v.lane,v=v.next;while(v!==o)}else k===null&&(v.shared.lanes=0);to|=A,s.lanes=A,s.memoizedState=xe}}function Z0(s,o,d){if(s=o.effects,o.effects=null,s!==null)for(o=0;o<s.length;o++){var g=s[o],v=g.callback;if(v!==null){if(g.callback=null,g=d,typeof v!="function")throw Error(n(191,v));v.call(g)}}}var Nl={},os=aa(Nl),Sl=aa(Nl),jl=aa(Nl);function Ja(s){if(s===Nl)throw Error(n(174));return s}function cf(s,o){switch(Nt(jl,o),Nt(Sl,s),Nt(os,Nl),s=o.nodeType,s){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:ct(null,"");break;default:s=s===8?o.parentNode:o,o=s.namespaceURI||null,s=s.tagName,o=ct(o,s)}jt(os),Nt(os,o)}function li(){jt(os),jt(Sl),jt(jl)}function Q0(s){Ja(jl.current);var o=Ja(os.current),d=ct(o,s.type);o!==d&&(Nt(Sl,s),Nt(os,d))}function uf(s){Sl.current===s&&(jt(os),jt(Sl))}var It=aa(0);function wu(s){for(var o=s;o!==null;){if(o.tag===13){var d=o.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var df=[];function hf(){for(var s=0;s<df.length;s++)df[s]._workInProgressVersionPrimary=null;df.length=0}var vu=C.ReactCurrentDispatcher,ff=C.ReactCurrentBatchConfig,eo=0,$t=null,Ht=null,Jt=null,xu=!1,El=!1,Cl=0,WM=0;function wn(){throw Error(n(321))}function pf(s,o){if(o===null)return!1;for(var d=0;d<o.length&&d<s.length;d++)if(!Rn(s[d],o[d]))return!1;return!0}function mf(s,o,d,g,v,k){if(eo=k,$t=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,vu.current=s===null||s.memoizedState===null?KM:YM,s=d(g,v),El){k=0;do{if(El=!1,Cl=0,25<=k)throw Error(n(301));k+=1,Jt=Ht=null,o.updateQueue=null,vu.current=XM,s=d(g,v)}while(El)}if(vu.current=_u,o=Ht!==null&&Ht.next!==null,eo=0,Jt=Ht=$t=null,xu=!1,o)throw Error(n(300));return s}function gf(){var s=Cl!==0;return Cl=0,s}function is(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jt===null?$t.memoizedState=Jt=s:Jt=Jt.next=s,Jt}function or(){if(Ht===null){var s=$t.alternate;s=s!==null?s.memoizedState:null}else s=Ht.next;var o=Jt===null?$t.memoizedState:Jt.next;if(o!==null)Jt=o,Ht=s;else{if(s===null)throw Error(n(310));Ht=s,s={memoizedState:Ht.memoizedState,baseState:Ht.baseState,baseQueue:Ht.baseQueue,queue:Ht.queue,next:null},Jt===null?$t.memoizedState=Jt=s:Jt=Jt.next=s}return Jt}function Tl(s,o){return typeof o=="function"?o(s):o}function yf(s){var o=or(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=s;var g=Ht,v=g.baseQueue,k=d.pending;if(k!==null){if(v!==null){var A=v.next;v.next=k.next,k.next=A}g.baseQueue=v=k,d.pending=null}if(v!==null){k=v.next,g=g.baseState;var Y=A=null,te=null,fe=k;do{var ve=fe.lane;if((eo&ve)===ve)te!==null&&(te=te.next={lane:0,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null}),g=fe.hasEagerState?fe.eagerState:s(g,fe.action);else{var xe={lane:ve,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null};te===null?(Y=te=xe,A=g):te=te.next=xe,$t.lanes|=ve,to|=ve}fe=fe.next}while(fe!==null&&fe!==k);te===null?A=g:te.next=Y,Rn(g,o.memoizedState)||(On=!0),o.memoizedState=g,o.baseState=A,o.baseQueue=te,d.lastRenderedState=g}if(s=d.interleaved,s!==null){v=s;do k=v.lane,$t.lanes|=k,to|=k,v=v.next;while(v!==s)}else v===null&&(d.lanes=0);return[o.memoizedState,d.dispatch]}function wf(s){var o=or(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=s;var g=d.dispatch,v=d.pending,k=o.memoizedState;if(v!==null){d.pending=null;var A=v=v.next;do k=s(k,A.action),A=A.next;while(A!==v);Rn(k,o.memoizedState)||(On=!0),o.memoizedState=k,o.baseQueue===null&&(o.baseState=k),d.lastRenderedState=k}return[k,g]}function J0(){}function eb(s,o){var d=$t,g=or(),v=o(),k=!Rn(g.memoizedState,v);if(k&&(g.memoizedState=v,On=!0),g=g.queue,vf(rb.bind(null,d,g,s),[s]),g.getSnapshot!==o||k||Jt!==null&&Jt.memoizedState.tag&1){if(d.flags|=2048,Al(9,nb.bind(null,d,g,v,o),void 0,null),en===null)throw Error(n(349));(eo&30)!==0||tb(d,o,v)}return v}function tb(s,o,d){s.flags|=16384,s={getSnapshot:o,value:d},o=$t.updateQueue,o===null?(o={lastEffect:null,stores:null},$t.updateQueue=o,o.stores=[s]):(d=o.stores,d===null?o.stores=[s]:d.push(s))}function nb(s,o,d,g){o.value=d,o.getSnapshot=g,sb(o)&&ab(s)}function rb(s,o,d){return d(function(){sb(o)&&ab(s)})}function sb(s){var o=s.getSnapshot;s=s.value;try{var d=o();return!Rn(s,d)}catch{return!0}}function ab(s){var o=Rs(s,1);o!==null&&Ar(o,s,1,-1)}function ob(s){var o=is();return typeof s=="function"&&(s=s()),o.memoizedState=o.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Tl,lastRenderedState:s},o.queue=s,s=s.dispatch=VM.bind(null,$t,s),[o.memoizedState,s]}function Al(s,o,d,g){return s={tag:s,create:o,destroy:d,deps:g,next:null},o=$t.updateQueue,o===null?(o={lastEffect:null,stores:null},$t.updateQueue=o,o.lastEffect=s.next=s):(d=o.lastEffect,d===null?o.lastEffect=s.next=s:(g=d.next,d.next=s,s.next=g,o.lastEffect=s)),s}function ib(){return or().memoizedState}function bu(s,o,d,g){var v=is();$t.flags|=s,v.memoizedState=Al(1|o,d,void 0,g===void 0?null:g)}function ku(s,o,d,g){var v=or();g=g===void 0?null:g;var k=void 0;if(Ht!==null){var A=Ht.memoizedState;if(k=A.destroy,g!==null&&pf(g,A.deps)){v.memoizedState=Al(o,d,k,g);return}}$t.flags|=s,v.memoizedState=Al(1|o,d,k,g)}function lb(s,o){return bu(8390656,8,s,o)}function vf(s,o){return ku(2048,8,s,o)}function cb(s,o){return ku(4,2,s,o)}function ub(s,o){return ku(4,4,s,o)}function db(s,o){if(typeof o=="function")return s=s(),o(s),function(){o(null)};if(o!=null)return s=s(),o.current=s,function(){o.current=null}}function hb(s,o,d){return d=d!=null?d.concat([s]):null,ku(4,4,db.bind(null,o,s),d)}function xf(){}function fb(s,o){var d=or();o=o===void 0?null:o;var g=d.memoizedState;return g!==null&&o!==null&&pf(o,g[1])?g[0]:(d.memoizedState=[s,o],s)}function pb(s,o){var d=or();o=o===void 0?null:o;var g=d.memoizedState;return g!==null&&o!==null&&pf(o,g[1])?g[0]:(s=s(),d.memoizedState=[s,o],s)}function mb(s,o,d){return(eo&21)===0?(s.baseState&&(s.baseState=!1,On=!0),s.memoizedState=d):(Rn(d,o)||(d=Ic(),$t.lanes|=d,to|=d,s.baseState=!0),o)}function HM(s,o){var d=ft;ft=d!==0&&4>d?d:4,s(!0);var g=ff.transition;ff.transition={};try{s(!1),o()}finally{ft=d,ff.transition=g}}function gb(){return or().memoizedState}function GM(s,o,d){var g=fa(s);if(d={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null},yb(s))wb(o,d);else if(d=K0(s,o,d,g),d!==null){var v=jn();Ar(d,s,g,v),vb(d,o,g)}}function VM(s,o,d){var g=fa(s),v={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null};if(yb(s))wb(o,v);else{var k=s.alternate;if(s.lanes===0&&(k===null||k.lanes===0)&&(k=o.lastRenderedReducer,k!==null))try{var A=o.lastRenderedState,Y=k(A,d);if(v.hasEagerState=!0,v.eagerState=Y,Rn(Y,A)){var te=o.interleaved;te===null?(v.next=v,of(o)):(v.next=te.next,te.next=v),o.interleaved=v;return}}catch{}finally{}d=K0(s,o,v,g),d!==null&&(v=jn(),Ar(d,s,g,v),vb(d,o,g))}}function yb(s){var o=s.alternate;return s===$t||o!==null&&o===$t}function wb(s,o){El=xu=!0;var d=s.pending;d===null?o.next=o:(o.next=d.next,d.next=o),s.pending=o}function vb(s,o,d){if((d&4194240)!==0){var g=o.lanes;g&=s.pendingLanes,d|=g,o.lanes=d,Ki(s,d)}}var _u={readContext:ar,useCallback:wn,useContext:wn,useEffect:wn,useImperativeHandle:wn,useInsertionEffect:wn,useLayoutEffect:wn,useMemo:wn,useReducer:wn,useRef:wn,useState:wn,useDebugValue:wn,useDeferredValue:wn,useTransition:wn,useMutableSource:wn,useSyncExternalStore:wn,useId:wn,unstable_isNewReconciler:!1},KM={readContext:ar,useCallback:function(s,o){return is().memoizedState=[s,o===void 0?null:o],s},useContext:ar,useEffect:lb,useImperativeHandle:function(s,o,d){return d=d!=null?d.concat([s]):null,bu(4194308,4,db.bind(null,o,s),d)},useLayoutEffect:function(s,o){return bu(4194308,4,s,o)},useInsertionEffect:function(s,o){return bu(4,2,s,o)},useMemo:function(s,o){var d=is();return o=o===void 0?null:o,s=s(),d.memoizedState=[s,o],s},useReducer:function(s,o,d){var g=is();return o=d!==void 0?d(o):o,g.memoizedState=g.baseState=o,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:o},g.queue=s,s=s.dispatch=GM.bind(null,$t,s),[g.memoizedState,s]},useRef:function(s){var o=is();return s={current:s},o.memoizedState=s},useState:ob,useDebugValue:xf,useDeferredValue:function(s){return is().memoizedState=s},useTransition:function(){var s=ob(!1),o=s[0];return s=HM.bind(null,s[1]),is().memoizedState=s,[o,s]},useMutableSource:function(){},useSyncExternalStore:function(s,o,d){var g=$t,v=is();if(Ct){if(d===void 0)throw Error(n(407));d=d()}else{if(d=o(),en===null)throw Error(n(349));(eo&30)!==0||tb(g,o,d)}v.memoizedState=d;var k={value:d,getSnapshot:o};return v.queue=k,lb(rb.bind(null,g,k,s),[s]),g.flags|=2048,Al(9,nb.bind(null,g,k,d,o),void 0,null),d},useId:function(){var s=is(),o=en.identifierPrefix;if(Ct){var d=As,g=Ts;d=(g&~(1<<32-An(g)-1)).toString(32)+d,o=":"+o+"R"+d,d=Cl++,0<d&&(o+="H"+d.toString(32)),o+=":"}else d=WM++,o=":"+o+"r"+d.toString(32)+":";return s.memoizedState=o},unstable_isNewReconciler:!1},YM={readContext:ar,useCallback:fb,useContext:ar,useEffect:vf,useImperativeHandle:hb,useInsertionEffect:cb,useLayoutEffect:ub,useMemo:pb,useReducer:yf,useRef:ib,useState:function(){return yf(Tl)},useDebugValue:xf,useDeferredValue:function(s){var o=or();return mb(o,Ht.memoizedState,s)},useTransition:function(){var s=yf(Tl)[0],o=or().memoizedState;return[s,o]},useMutableSource:J0,useSyncExternalStore:eb,useId:gb,unstable_isNewReconciler:!1},XM={readContext:ar,useCallback:fb,useContext:ar,useEffect:vf,useImperativeHandle:hb,useInsertionEffect:cb,useLayoutEffect:ub,useMemo:pb,useReducer:wf,useRef:ib,useState:function(){return wf(Tl)},useDebugValue:xf,useDeferredValue:function(s){var o=or();return Ht===null?o.memoizedState=s:mb(o,Ht.memoizedState,s)},useTransition:function(){var s=wf(Tl)[0],o=or().memoizedState;return[s,o]},useMutableSource:J0,useSyncExternalStore:eb,useId:gb,unstable_isNewReconciler:!1};function Er(s,o){if(s&&s.defaultProps){o=z({},o),s=s.defaultProps;for(var d in s)o[d]===void 0&&(o[d]=s[d]);return o}return o}function bf(s,o,d,g){o=s.memoizedState,d=d(g,o),d=d==null?o:z({},o,d),s.memoizedState=d,s.lanes===0&&(s.updateQueue.baseState=d)}var Nu={isMounted:function(s){return(s=s._reactInternals)?Z(s)===s:!1},enqueueSetState:function(s,o,d){s=s._reactInternals;var g=jn(),v=fa(s),k=Ms(g,v);k.payload=o,d!=null&&(k.callback=d),o=ca(s,k,v),o!==null&&(Ar(o,s,v,g),gu(o,s,v))},enqueueReplaceState:function(s,o,d){s=s._reactInternals;var g=jn(),v=fa(s),k=Ms(g,v);k.tag=1,k.payload=o,d!=null&&(k.callback=d),o=ca(s,k,v),o!==null&&(Ar(o,s,v,g),gu(o,s,v))},enqueueForceUpdate:function(s,o){s=s._reactInternals;var d=jn(),g=fa(s),v=Ms(d,g);v.tag=2,o!=null&&(v.callback=o),o=ca(s,v,g),o!==null&&(Ar(o,s,g,d),gu(o,s,g))}};function xb(s,o,d,g,v,k,A){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(g,k,A):o.prototype&&o.prototype.isPureReactComponent?!Js(d,g)||!Js(v,k):!0}function bb(s,o,d){var g=!1,v=oa,k=o.contextType;return typeof k=="object"&&k!==null?k=ar(k):(v=$n(o)?Ya:yn.current,g=o.contextTypes,k=(g=g!=null)?ti(s,v):oa),o=new o(d,k),s.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Nu,s.stateNode=o,o._reactInternals=s,g&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=v,s.__reactInternalMemoizedMaskedChildContext=k),o}function kb(s,o,d,g){s=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(d,g),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(d,g),o.state!==s&&Nu.enqueueReplaceState(o,o.state,null)}function kf(s,o,d,g){var v=s.stateNode;v.props=d,v.state=s.memoizedState,v.refs={},lf(s);var k=o.contextType;typeof k=="object"&&k!==null?v.context=ar(k):(k=$n(o)?Ya:yn.current,v.context=ti(s,k)),v.state=s.memoizedState,k=o.getDerivedStateFromProps,typeof k=="function"&&(bf(s,o,k,d),v.state=s.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&&Nu.enqueueReplaceState(v,v.state,null),yu(s,d,v,g),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308)}function ci(s,o){try{var d="",g=o;do d+=J(g),g=g.return;while(g);var v=d}catch(k){v=`
39
+ Error generating stack: `+k.message+`
40
+ `+k.stack}return{value:s,source:o,stack:v,digest:null}}function _f(s,o,d){return{value:s,source:null,stack:d??null,digest:o??null}}function Nf(s,o){try{console.error(o.value)}catch(d){setTimeout(function(){throw d})}}var ZM=typeof WeakMap=="function"?WeakMap:Map;function _b(s,o,d){d=Ms(-1,d),d.tag=3,d.payload={element:null};var g=o.value;return d.callback=function(){Ru||(Ru=!0,qf=g),Nf(s,o)},d}function Nb(s,o,d){d=Ms(-1,d),d.tag=3;var g=s.type.getDerivedStateFromError;if(typeof g=="function"){var v=o.value;d.payload=function(){return g(v)},d.callback=function(){Nf(s,o)}}var k=s.stateNode;return k!==null&&typeof k.componentDidCatch=="function"&&(d.callback=function(){Nf(s,o),typeof g!="function"&&(da===null?da=new Set([this]):da.add(this));var A=o.stack;this.componentDidCatch(o.value,{componentStack:A!==null?A:""})}),d}function Sb(s,o,d){var g=s.pingCache;if(g===null){g=s.pingCache=new ZM;var v=new Set;g.set(o,v)}else v=g.get(o),v===void 0&&(v=new Set,g.set(o,v));v.has(d)||(v.add(d),s=dI.bind(null,s,o,d),o.then(s,s))}function jb(s){do{var o;if((o=s.tag===13)&&(o=s.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return s;s=s.return}while(s!==null);return null}function Eb(s,o,d,g,v){return(s.mode&1)===0?(s===o?s.flags|=65536:(s.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(o=Ms(-1,1),o.tag=2,ca(d,o,1))),d.lanes|=1),s):(s.flags|=65536,s.lanes=v,s)}var QM=C.ReactCurrentOwner,On=!1;function Sn(s,o,d,g){o.child=s===null?V0(o,null,d,g):ai(o,s.child,d,g)}function Cb(s,o,d,g,v){d=d.render;var k=o.ref;return ii(o,v),g=mf(s,o,d,g,k,v),d=gf(),s!==null&&!On?(o.updateQueue=s.updateQueue,o.flags&=-2053,s.lanes&=~v,Is(s,o,v)):(Ct&&d&&Zh(o),o.flags|=1,Sn(s,o,g,v),o.child)}function Tb(s,o,d,g,v){if(s===null){var k=d.type;return typeof k=="function"&&!Gf(k)&&k.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(o.tag=15,o.type=k,Ab(s,o,k,g,v)):(s=Lu(d.type,null,g,o,o.mode,v),s.ref=o.ref,s.return=o,o.child=s)}if(k=s.child,(s.lanes&v)===0){var A=k.memoizedProps;if(d=d.compare,d=d!==null?d:Js,d(A,g)&&s.ref===o.ref)return Is(s,o,v)}return o.flags|=1,s=ma(k,g),s.ref=o.ref,s.return=o,o.child=s}function Ab(s,o,d,g,v){if(s!==null){var k=s.memoizedProps;if(Js(k,g)&&s.ref===o.ref)if(On=!1,o.pendingProps=g=k,(s.lanes&v)!==0)(s.flags&131072)!==0&&(On=!0);else return o.lanes=s.lanes,Is(s,o,v)}return Sf(s,o,d,g,v)}function Rb(s,o,d){var g=o.pendingProps,v=g.children,k=s!==null?s.memoizedState:null;if(g.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},Nt(di,Hn),Hn|=d;else{if((d&1073741824)===0)return s=k!==null?k.baseLanes|d:d,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:s,cachePool:null,transitions:null},o.updateQueue=null,Nt(di,Hn),Hn|=s,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=k!==null?k.baseLanes:d,Nt(di,Hn),Hn|=g}else k!==null?(g=k.baseLanes|d,o.memoizedState=null):g=d,Nt(di,Hn),Hn|=g;return Sn(s,o,v,d),o.child}function Mb(s,o){var d=o.ref;(s===null&&d!==null||s!==null&&s.ref!==d)&&(o.flags|=512,o.flags|=2097152)}function Sf(s,o,d,g,v){var k=$n(d)?Ya:yn.current;return k=ti(o,k),ii(o,v),d=mf(s,o,d,g,k,v),g=gf(),s!==null&&!On?(o.updateQueue=s.updateQueue,o.flags&=-2053,s.lanes&=~v,Is(s,o,v)):(Ct&&g&&Zh(o),o.flags|=1,Sn(s,o,d,v),o.child)}function Ib(s,o,d,g,v){if($n(d)){var k=!0;lu(o)}else k=!1;if(ii(o,v),o.stateNode===null)ju(s,o),bb(o,d,g),kf(o,d,g,v),g=!0;else if(s===null){var A=o.stateNode,Y=o.memoizedProps;A.props=Y;var te=A.context,fe=d.contextType;typeof fe=="object"&&fe!==null?fe=ar(fe):(fe=$n(d)?Ya:yn.current,fe=ti(o,fe));var ve=d.getDerivedStateFromProps,xe=typeof ve=="function"||typeof A.getSnapshotBeforeUpdate=="function";xe||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(Y!==g||te!==fe)&&kb(o,A,g,fe),la=!1;var we=o.memoizedState;A.state=we,yu(o,g,A,v),te=o.memoizedState,Y!==g||we!==te||In.current||la?(typeof ve=="function"&&(bf(o,d,ve,g),te=o.memoizedState),(Y=la||xb(o,d,Y,g,we,te,fe))?(xe||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount()),typeof A.componentDidMount=="function"&&(o.flags|=4194308)):(typeof A.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=g,o.memoizedState=te),A.props=g,A.state=te,A.context=fe,g=Y):(typeof A.componentDidMount=="function"&&(o.flags|=4194308),g=!1)}else{A=o.stateNode,Y0(s,o),Y=o.memoizedProps,fe=o.type===o.elementType?Y:Er(o.type,Y),A.props=fe,xe=o.pendingProps,we=A.context,te=d.contextType,typeof te=="object"&&te!==null?te=ar(te):(te=$n(d)?Ya:yn.current,te=ti(o,te));var Ie=d.getDerivedStateFromProps;(ve=typeof Ie=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(Y!==xe||we!==te)&&kb(o,A,g,te),la=!1,we=o.memoizedState,A.state=we,yu(o,g,A,v);var De=o.memoizedState;Y!==xe||we!==De||In.current||la?(typeof Ie=="function"&&(bf(o,d,Ie,g),De=o.memoizedState),(fe=la||xb(o,d,fe,g,we,De,te)||!1)?(ve||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(g,De,te),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(g,De,te)),typeof A.componentDidUpdate=="function"&&(o.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof A.componentDidUpdate!="function"||Y===s.memoizedProps&&we===s.memoizedState||(o.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||Y===s.memoizedProps&&we===s.memoizedState||(o.flags|=1024),o.memoizedProps=g,o.memoizedState=De),A.props=g,A.state=De,A.context=te,g=fe):(typeof A.componentDidUpdate!="function"||Y===s.memoizedProps&&we===s.memoizedState||(o.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||Y===s.memoizedProps&&we===s.memoizedState||(o.flags|=1024),g=!1)}return jf(s,o,d,g,k,v)}function jf(s,o,d,g,v,k){Mb(s,o);var A=(o.flags&128)!==0;if(!g&&!A)return v&&D0(o,d,!1),Is(s,o,k);g=o.stateNode,QM.current=o;var Y=A&&typeof d.getDerivedStateFromError!="function"?null:g.render();return o.flags|=1,s!==null&&A?(o.child=ai(o,s.child,null,k),o.child=ai(o,null,Y,k)):Sn(s,o,Y,k),o.memoizedState=g.state,v&&D0(o,d,!0),o.child}function $b(s){var o=s.stateNode;o.pendingContext?P0(s,o.pendingContext,o.pendingContext!==o.context):o.context&&P0(s,o.context,!1),cf(s,o.containerInfo)}function Ob(s,o,d,g,v){return si(),tf(v),o.flags|=256,Sn(s,o,d,g),o.child}var Ef={dehydrated:null,treeContext:null,retryLane:0};function Cf(s){return{baseLanes:s,cachePool:null,transitions:null}}function Pb(s,o,d){var g=o.pendingProps,v=It.current,k=!1,A=(o.flags&128)!==0,Y;if((Y=A)||(Y=s!==null&&s.memoizedState===null?!1:(v&2)!==0),Y?(k=!0,o.flags&=-129):(s===null||s.memoizedState!==null)&&(v|=1),Nt(It,v&1),s===null)return ef(o),s=o.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((o.mode&1)===0?o.lanes=1:s.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(A=g.children,s=g.fallback,k?(g=o.mode,k=o.child,A={mode:"hidden",children:A},(g&1)===0&&k!==null?(k.childLanes=0,k.pendingProps=A):k=Du(A,g,0,null),s=ao(s,g,d,null),k.return=o,s.return=o,k.sibling=s,o.child=k,o.child.memoizedState=Cf(d),o.memoizedState=Ef,s):Tf(o,A));if(v=s.memoizedState,v!==null&&(Y=v.dehydrated,Y!==null))return JM(s,o,A,g,Y,v,d);if(k){k=g.fallback,A=o.mode,v=s.child,Y=v.sibling;var te={mode:"hidden",children:g.children};return(A&1)===0&&o.child!==v?(g=o.child,g.childLanes=0,g.pendingProps=te,o.deletions=null):(g=ma(v,te),g.subtreeFlags=v.subtreeFlags&14680064),Y!==null?k=ma(Y,k):(k=ao(k,A,d,null),k.flags|=2),k.return=o,g.return=o,g.sibling=k,o.child=g,g=k,k=o.child,A=s.child.memoizedState,A=A===null?Cf(d):{baseLanes:A.baseLanes|d,cachePool:null,transitions:A.transitions},k.memoizedState=A,k.childLanes=s.childLanes&~d,o.memoizedState=Ef,g}return k=s.child,s=k.sibling,g=ma(k,{mode:"visible",children:g.children}),(o.mode&1)===0&&(g.lanes=d),g.return=o,g.sibling=null,s!==null&&(d=o.deletions,d===null?(o.deletions=[s],o.flags|=16):d.push(s)),o.child=g,o.memoizedState=null,g}function Tf(s,o){return o=Du({mode:"visible",children:o},s.mode,0,null),o.return=s,s.child=o}function Su(s,o,d,g){return g!==null&&tf(g),ai(o,s.child,null,d),s=Tf(o,o.pendingProps.children),s.flags|=2,o.memoizedState=null,s}function JM(s,o,d,g,v,k,A){if(d)return o.flags&256?(o.flags&=-257,g=_f(Error(n(422))),Su(s,o,A,g)):o.memoizedState!==null?(o.child=s.child,o.flags|=128,null):(k=g.fallback,v=o.mode,g=Du({mode:"visible",children:g.children},v,0,null),k=ao(k,v,A,null),k.flags|=2,g.return=o,k.return=o,g.sibling=k,o.child=g,(o.mode&1)!==0&&ai(o,s.child,null,A),o.child.memoizedState=Cf(A),o.memoizedState=Ef,k);if((o.mode&1)===0)return Su(s,o,A,null);if(v.data==="$!"){if(g=v.nextSibling&&v.nextSibling.dataset,g)var Y=g.dgst;return g=Y,k=Error(n(419)),g=_f(k,g,void 0),Su(s,o,A,g)}if(Y=(A&s.childLanes)!==0,On||Y){if(g=en,g!==null){switch(A&-A){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(g.suspendedLanes|A))!==0?0:v,v!==0&&v!==k.retryLane&&(k.retryLane=v,Rs(s,v),Ar(g,s,v,-1))}return Hf(),g=_f(Error(n(421))),Su(s,o,A,g)}return v.data==="$?"?(o.flags|=128,o.child=s.child,o=hI.bind(null,s),v._reactRetry=o,null):(s=k.treeContext,Wn=Mn(v.nextSibling),Un=o,Ct=!0,jr=null,s!==null&&(rr[sr++]=Ts,rr[sr++]=As,rr[sr++]=Xa,Ts=s.id,As=s.overflow,Xa=o),o=Tf(o,g.children),o.flags|=4096,o)}function Lb(s,o,d){s.lanes|=o;var g=s.alternate;g!==null&&(g.lanes|=o),af(s.return,o,d)}function Af(s,o,d,g,v){var k=s.memoizedState;k===null?s.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:v}:(k.isBackwards=o,k.rendering=null,k.renderingStartTime=0,k.last=g,k.tail=d,k.tailMode=v)}function Db(s,o,d){var g=o.pendingProps,v=g.revealOrder,k=g.tail;if(Sn(s,o,g.children,d),g=It.current,(g&2)!==0)g=g&1|2,o.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=o.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Lb(s,d,o);else if(s.tag===19)Lb(s,d,o);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===o)break e;for(;s.sibling===null;){if(s.return===null||s.return===o)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}g&=1}if(Nt(It,g),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(d=o.child,v=null;d!==null;)s=d.alternate,s!==null&&wu(s)===null&&(v=d),d=d.sibling;d=v,d===null?(v=o.child,o.child=null):(v=d.sibling,d.sibling=null),Af(o,!1,v,d,k);break;case"backwards":for(d=null,v=o.child,o.child=null;v!==null;){if(s=v.alternate,s!==null&&wu(s)===null){o.child=v;break}s=v.sibling,v.sibling=d,d=v,v=s}Af(o,!0,d,null,k);break;case"together":Af(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function ju(s,o){(o.mode&1)===0&&s!==null&&(s.alternate=null,o.alternate=null,o.flags|=2)}function Is(s,o,d){if(s!==null&&(o.dependencies=s.dependencies),to|=o.lanes,(d&o.childLanes)===0)return null;if(s!==null&&o.child!==s.child)throw Error(n(153));if(o.child!==null){for(s=o.child,d=ma(s,s.pendingProps),o.child=d,d.return=o;s.sibling!==null;)s=s.sibling,d=d.sibling=ma(s,s.pendingProps),d.return=o;d.sibling=null}return o.child}function eI(s,o,d){switch(o.tag){case 3:$b(o),si();break;case 5:Q0(o);break;case 1:$n(o.type)&&lu(o);break;case 4:cf(o,o.stateNode.containerInfo);break;case 10:var g=o.type._context,v=o.memoizedProps.value;Nt(pu,g._currentValue),g._currentValue=v;break;case 13:if(g=o.memoizedState,g!==null)return g.dehydrated!==null?(Nt(It,It.current&1),o.flags|=128,null):(d&o.child.childLanes)!==0?Pb(s,o,d):(Nt(It,It.current&1),s=Is(s,o,d),s!==null?s.sibling:null);Nt(It,It.current&1);break;case 19:if(g=(d&o.childLanes)!==0,(s.flags&128)!==0){if(g)return Db(s,o,d);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),Nt(It,It.current),g)break;return null;case 22:case 23:return o.lanes=0,Rb(s,o,d)}return Is(s,o,d)}var qb,Rf,Fb,Bb;qb=function(s,o){for(var d=o.child;d!==null;){if(d.tag===5||d.tag===6)s.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===o)break;for(;d.sibling===null;){if(d.return===null||d.return===o)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},Rf=function(){},Fb=function(s,o,d,g){var v=s.memoizedProps;if(v!==g){s=o.stateNode,Ja(os.current);var k=null;switch(d){case"input":v=Pe(s,v),g=Pe(s,g),k=[];break;case"select":v=z({},v,{value:void 0}),g=z({},g,{value:void 0}),k=[];break;case"textarea":v=ue(s,v),g=ue(s,g),k=[];break;default:typeof v.onClick!="function"&&typeof g.onClick=="function"&&(s.onclick=Ke)}St(d,g);var A;d=null;for(fe in v)if(!g.hasOwnProperty(fe)&&v.hasOwnProperty(fe)&&v[fe]!=null)if(fe==="style"){var Y=v[fe];for(A in Y)Y.hasOwnProperty(A)&&(d||(d={}),d[A]="")}else fe!=="dangerouslySetInnerHTML"&&fe!=="children"&&fe!=="suppressContentEditableWarning"&&fe!=="suppressHydrationWarning"&&fe!=="autoFocus"&&(a.hasOwnProperty(fe)?k||(k=[]):(k=k||[]).push(fe,null));for(fe in g){var te=g[fe];if(Y=v!=null?v[fe]:void 0,g.hasOwnProperty(fe)&&te!==Y&&(te!=null||Y!=null))if(fe==="style")if(Y){for(A in Y)!Y.hasOwnProperty(A)||te&&te.hasOwnProperty(A)||(d||(d={}),d[A]="");for(A in te)te.hasOwnProperty(A)&&Y[A]!==te[A]&&(d||(d={}),d[A]=te[A])}else d||(k||(k=[]),k.push(fe,d)),d=te;else fe==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,Y=Y?Y.__html:void 0,te!=null&&Y!==te&&(k=k||[]).push(fe,te)):fe==="children"?typeof te!="string"&&typeof te!="number"||(k=k||[]).push(fe,""+te):fe!=="suppressContentEditableWarning"&&fe!=="suppressHydrationWarning"&&(a.hasOwnProperty(fe)?(te!=null&&fe==="onScroll"&&kt("scroll",s),k||Y===te||(k=[])):(k=k||[]).push(fe,te))}d&&(k=k||[]).push("style",d);var fe=k;(o.updateQueue=fe)&&(o.flags|=4)}},Bb=function(s,o,d,g){d!==g&&(o.flags|=4)};function Rl(s,o){if(!Ct)switch(s.tailMode){case"hidden":o=s.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?s.tail=null:d.sibling=null;break;case"collapsed":d=s.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?o||s.tail===null?s.tail=null:s.tail.sibling=null:g.sibling=null}}function vn(s){var o=s.alternate!==null&&s.alternate.child===s.child,d=0,g=0;if(o)for(var v=s.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags&14680064,g|=v.flags&14680064,v.return=s,v=v.sibling;else for(v=s.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags,g|=v.flags,v.return=s,v=v.sibling;return s.subtreeFlags|=g,s.childLanes=d,o}function tI(s,o,d){var g=o.pendingProps;switch(Qh(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vn(o),null;case 1:return $n(o.type)&&iu(),vn(o),null;case 3:return g=o.stateNode,li(),jt(In),jt(yn),hf(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(s===null||s.child===null)&&(hu(o)?o.flags|=4:s===null||s.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,jr!==null&&(zf(jr),jr=null))),Rf(s,o),vn(o),null;case 5:uf(o);var v=Ja(jl.current);if(d=o.type,s!==null&&o.stateNode!=null)Fb(s,o,d,g,v),s.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!g){if(o.stateNode===null)throw Error(n(166));return vn(o),null}if(s=Ja(os.current),hu(o)){g=o.stateNode,d=o.type;var k=o.memoizedProps;switch(g[as]=o,g[bl]=k,s=(o.mode&1)!==0,d){case"dialog":kt("cancel",g),kt("close",g);break;case"iframe":case"object":case"embed":kt("load",g);break;case"video":case"audio":for(v=0;v<na.length;v++)kt(na[v],g);break;case"source":kt("error",g);break;case"img":case"image":case"link":kt("error",g),kt("load",g);break;case"details":kt("toggle",g);break;case"input":Te(g,k),kt("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!k.multiple},kt("invalid",g);break;case"textarea":be(g,k),kt("invalid",g)}St(d,k),v=null;for(var A in k)if(k.hasOwnProperty(A)){var Y=k[A];A==="children"?typeof Y=="string"?g.textContent!==Y&&(k.suppressHydrationWarning!==!0&&vt(g.textContent,Y,s),v=["children",Y]):typeof Y=="number"&&g.textContent!==""+Y&&(k.suppressHydrationWarning!==!0&&vt(g.textContent,Y,s),v=["children",""+Y]):a.hasOwnProperty(A)&&Y!=null&&A==="onScroll"&&kt("scroll",g)}switch(d){case"input":Se(g),_e(g,k,!0);break;case"textarea":Se(g),Xe(g);break;case"select":case"option":break;default:typeof k.onClick=="function"&&(g.onclick=Ke)}g=v,o.updateQueue=g,g!==null&&(o.flags|=4)}else{A=v.nodeType===9?v:v.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=$e(d)),s==="http://www.w3.org/1999/xhtml"?d==="script"?(s=A.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof g.is=="string"?s=A.createElement(d,{is:g.is}):(s=A.createElement(d),d==="select"&&(A=s,g.multiple?A.multiple=!0:g.size&&(A.size=g.size))):s=A.createElementNS(s,d),s[as]=o,s[bl]=g,qb(s,o,!1,!1),o.stateNode=s;e:{switch(A=yt(d,g),d){case"dialog":kt("cancel",s),kt("close",s),v=g;break;case"iframe":case"object":case"embed":kt("load",s),v=g;break;case"video":case"audio":for(v=0;v<na.length;v++)kt(na[v],s);v=g;break;case"source":kt("error",s),v=g;break;case"img":case"image":case"link":kt("error",s),kt("load",s),v=g;break;case"details":kt("toggle",s),v=g;break;case"input":Te(s,g),v=Pe(s,g),kt("invalid",s);break;case"option":v=g;break;case"select":s._wrapperState={wasMultiple:!!g.multiple},v=z({},g,{value:void 0}),kt("invalid",s);break;case"textarea":be(s,g),v=ue(s,g),kt("invalid",s);break;default:v=g}St(d,v),Y=v;for(k in Y)if(Y.hasOwnProperty(k)){var te=Y[k];k==="style"?tt(s,te):k==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&Ee(s,te)):k==="children"?typeof te=="string"?(d!=="textarea"||te!=="")&&ie(s,te):typeof te=="number"&&ie(s,""+te):k!=="suppressContentEditableWarning"&&k!=="suppressHydrationWarning"&&k!=="autoFocus"&&(a.hasOwnProperty(k)?te!=null&&k==="onScroll"&&kt("scroll",s):te!=null&&E(s,k,te,A))}switch(d){case"input":Se(s),_e(s,g,!1);break;case"textarea":Se(s),Xe(s);break;case"option":g.value!=null&&s.setAttribute("value",""+ae(g.value));break;case"select":s.multiple=!!g.multiple,k=g.value,k!=null?Qe(s,!!g.multiple,k,!1):g.defaultValue!=null&&Qe(s,!!g.multiple,g.defaultValue,!0);break;default:typeof v.onClick=="function"&&(s.onclick=Ke)}switch(d){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return vn(o),null;case 6:if(s&&o.stateNode!=null)Bb(s,o,s.memoizedProps,g);else{if(typeof g!="string"&&o.stateNode===null)throw Error(n(166));if(d=Ja(jl.current),Ja(os.current),hu(o)){if(g=o.stateNode,d=o.memoizedProps,g[as]=o,(k=g.nodeValue!==d)&&(s=Un,s!==null))switch(s.tag){case 3:vt(g.nodeValue,d,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&vt(g.nodeValue,d,(s.mode&1)!==0)}k&&(o.flags|=4)}else g=(d.nodeType===9?d:d.ownerDocument).createTextNode(g),g[as]=o,o.stateNode=g}return vn(o),null;case 13:if(jt(It),g=o.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(Ct&&Wn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)W0(),si(),o.flags|=98560,k=!1;else if(k=hu(o),g!==null&&g.dehydrated!==null){if(s===null){if(!k)throw Error(n(318));if(k=o.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(n(317));k[as]=o}else si(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;vn(o),k=!1}else jr!==null&&(zf(jr),jr=null),k=!0;if(!k)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=d,o):(g=g!==null,g!==(s!==null&&s.memoizedState!==null)&&g&&(o.child.flags|=8192,(o.mode&1)!==0&&(s===null||(It.current&1)!==0?Gt===0&&(Gt=3):Hf())),o.updateQueue!==null&&(o.flags|=4),vn(o),null);case 4:return li(),Rf(s,o),s===null&&ra(o.stateNode.containerInfo),vn(o),null;case 10:return sf(o.type._context),vn(o),null;case 17:return $n(o.type)&&iu(),vn(o),null;case 19:if(jt(It),k=o.memoizedState,k===null)return vn(o),null;if(g=(o.flags&128)!==0,A=k.rendering,A===null)if(g)Rl(k,!1);else{if(Gt!==0||s!==null&&(s.flags&128)!==0)for(s=o.child;s!==null;){if(A=wu(s),A!==null){for(o.flags|=128,Rl(k,!1),g=A.updateQueue,g!==null&&(o.updateQueue=g,o.flags|=4),o.subtreeFlags=0,g=d,d=o.child;d!==null;)k=d,s=g,k.flags&=14680066,A=k.alternate,A===null?(k.childLanes=0,k.lanes=s,k.child=null,k.subtreeFlags=0,k.memoizedProps=null,k.memoizedState=null,k.updateQueue=null,k.dependencies=null,k.stateNode=null):(k.childLanes=A.childLanes,k.lanes=A.lanes,k.child=A.child,k.subtreeFlags=0,k.deletions=null,k.memoizedProps=A.memoizedProps,k.memoizedState=A.memoizedState,k.updateQueue=A.updateQueue,k.type=A.type,s=A.dependencies,k.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),d=d.sibling;return Nt(It,It.current&1|2),o.child}s=s.sibling}k.tail!==null&&bt()>hi&&(o.flags|=128,g=!0,Rl(k,!1),o.lanes=4194304)}else{if(!g)if(s=wu(A),s!==null){if(o.flags|=128,g=!0,d=s.updateQueue,d!==null&&(o.updateQueue=d,o.flags|=4),Rl(k,!0),k.tail===null&&k.tailMode==="hidden"&&!A.alternate&&!Ct)return vn(o),null}else 2*bt()-k.renderingStartTime>hi&&d!==1073741824&&(o.flags|=128,g=!0,Rl(k,!1),o.lanes=4194304);k.isBackwards?(A.sibling=o.child,o.child=A):(d=k.last,d!==null?d.sibling=A:o.child=A,k.last=A)}return k.tail!==null?(o=k.tail,k.rendering=o,k.tail=o.sibling,k.renderingStartTime=bt(),o.sibling=null,d=It.current,Nt(It,g?d&1|2:d&1),o):(vn(o),null);case 22:case 23:return Wf(),g=o.memoizedState!==null,s!==null&&s.memoizedState!==null!==g&&(o.flags|=8192),g&&(o.mode&1)!==0?(Hn&1073741824)!==0&&(vn(o),o.subtreeFlags&6&&(o.flags|=8192)):vn(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function nI(s,o){switch(Qh(o),o.tag){case 1:return $n(o.type)&&iu(),s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 3:return li(),jt(In),jt(yn),hf(),s=o.flags,(s&65536)!==0&&(s&128)===0?(o.flags=s&-65537|128,o):null;case 5:return uf(o),null;case 13:if(jt(It),s=o.memoizedState,s!==null&&s.dehydrated!==null){if(o.alternate===null)throw Error(n(340));si()}return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 19:return jt(It),null;case 4:return li(),null;case 10:return sf(o.type._context),null;case 22:case 23:return Wf(),null;case 24:return null;default:return null}}var Eu=!1,xn=!1,rI=typeof WeakSet=="function"?WeakSet:Set,Le=null;function ui(s,o){var d=s.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(g){Ot(s,o,g)}else d.current=null}function Mf(s,o,d){try{d()}catch(g){Ot(s,o,g)}}var zb=!1;function sI(s,o){if(gn=Mo,s=ml(),ea(s)){if("selectionStart"in s)var d={start:s.selectionStart,end:s.selectionEnd};else e:{d=(d=s.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var v=g.anchorOffset,k=g.focusNode;g=g.focusOffset;try{d.nodeType,k.nodeType}catch{d=null;break e}var A=0,Y=-1,te=-1,fe=0,ve=0,xe=s,we=null;t:for(;;){for(var Ie;xe!==d||v!==0&&xe.nodeType!==3||(Y=A+v),xe!==k||g!==0&&xe.nodeType!==3||(te=A+g),xe.nodeType===3&&(A+=xe.nodeValue.length),(Ie=xe.firstChild)!==null;)we=xe,xe=Ie;for(;;){if(xe===s)break t;if(we===d&&++fe===v&&(Y=A),we===k&&++ve===g&&(te=A),(Ie=xe.nextSibling)!==null)break;xe=we,we=xe.parentNode}xe=Ie}d=Y===-1||te===-1?null:{start:Y,end:te}}else d=null}d=d||{start:0,end:0}}else d=null;for(sa={focusedElem:s,selectionRange:d},Mo=!1,Le=o;Le!==null;)if(o=Le,s=o.child,(o.subtreeFlags&1028)!==0&&s!==null)s.return=o,Le=s;else for(;Le!==null;){o=Le;try{var De=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(De!==null){var qe=De.memoizedProps,qt=De.memoizedState,le=o.stateNode,re=le.getSnapshotBeforeUpdate(o.elementType===o.type?qe:Er(o.type,qe),qt);le.__reactInternalSnapshotBeforeUpdate=re}break;case 3:var ce=o.stateNode.containerInfo;ce.nodeType===1?ce.textContent="":ce.nodeType===9&&ce.documentElement&&ce.removeChild(ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ne){Ot(o,o.return,Ne)}if(s=o.sibling,s!==null){s.return=o.return,Le=s;break}Le=o.return}return De=zb,zb=!1,De}function Ml(s,o,d){var g=o.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var v=g=g.next;do{if((v.tag&s)===s){var k=v.destroy;v.destroy=void 0,k!==void 0&&Mf(o,d,k)}v=v.next}while(v!==g)}}function Cu(s,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var d=o=o.next;do{if((d.tag&s)===s){var g=d.create;d.destroy=g()}d=d.next}while(d!==o)}}function If(s){var o=s.ref;if(o!==null){var d=s.stateNode;switch(s.tag){case 5:s=d;break;default:s=d}typeof o=="function"?o(s):o.current=s}}function Ub(s){var o=s.alternate;o!==null&&(s.alternate=null,Ub(o)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(o=s.stateNode,o!==null&&(delete o[as],delete o[bl],delete o[Kh],delete o[FM],delete o[BM])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function Wb(s){return s.tag===5||s.tag===3||s.tag===4}function Hb(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Wb(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function $f(s,o,d){var g=s.tag;if(g===5||g===6)s=s.stateNode,o?d.nodeType===8?d.parentNode.insertBefore(s,o):d.insertBefore(s,o):(d.nodeType===8?(o=d.parentNode,o.insertBefore(s,d)):(o=d,o.appendChild(s)),d=d._reactRootContainer,d!=null||o.onclick!==null||(o.onclick=Ke));else if(g!==4&&(s=s.child,s!==null))for($f(s,o,d),s=s.sibling;s!==null;)$f(s,o,d),s=s.sibling}function Of(s,o,d){var g=s.tag;if(g===5||g===6)s=s.stateNode,o?d.insertBefore(s,o):d.appendChild(s);else if(g!==4&&(s=s.child,s!==null))for(Of(s,o,d),s=s.sibling;s!==null;)Of(s,o,d),s=s.sibling}var cn=null,Cr=!1;function ua(s,o,d){for(d=d.child;d!==null;)Gb(s,o,d),d=d.sibling}function Gb(s,o,d){if(Tn&&typeof Tn.onCommitFiberUnmount=="function")try{Tn.onCommitFiberUnmount(ws,d)}catch{}switch(d.tag){case 5:xn||ui(d,o);case 6:var g=cn,v=Cr;cn=null,ua(s,o,d),cn=g,Cr=v,cn!==null&&(Cr?(s=cn,d=d.stateNode,s.nodeType===8?s.parentNode.removeChild(d):s.removeChild(d)):cn.removeChild(d.stateNode));break;case 18:cn!==null&&(Cr?(s=cn,d=d.stateNode,s.nodeType===8?Ss(s.parentNode,d):s.nodeType===1&&Ss(s,d),Kr(s)):Ss(cn,d.stateNode));break;case 4:g=cn,v=Cr,cn=d.stateNode.containerInfo,Cr=!0,ua(s,o,d),cn=g,Cr=v;break;case 0:case 11:case 14:case 15:if(!xn&&(g=d.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){v=g=g.next;do{var k=v,A=k.destroy;k=k.tag,A!==void 0&&((k&2)!==0||(k&4)!==0)&&Mf(d,o,A),v=v.next}while(v!==g)}ua(s,o,d);break;case 1:if(!xn&&(ui(d,o),g=d.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=d.memoizedProps,g.state=d.memoizedState,g.componentWillUnmount()}catch(Y){Ot(d,o,Y)}ua(s,o,d);break;case 21:ua(s,o,d);break;case 22:d.mode&1?(xn=(g=xn)||d.memoizedState!==null,ua(s,o,d),xn=g):ua(s,o,d);break;default:ua(s,o,d)}}function Vb(s){var o=s.updateQueue;if(o!==null){s.updateQueue=null;var d=s.stateNode;d===null&&(d=s.stateNode=new rI),o.forEach(function(g){var v=fI.bind(null,s,g);d.has(g)||(d.add(g),g.then(v,v))})}}function Tr(s,o){var d=o.deletions;if(d!==null)for(var g=0;g<d.length;g++){var v=d[g];try{var k=s,A=o,Y=A;e:for(;Y!==null;){switch(Y.tag){case 5:cn=Y.stateNode,Cr=!1;break e;case 3:cn=Y.stateNode.containerInfo,Cr=!0;break e;case 4:cn=Y.stateNode.containerInfo,Cr=!0;break e}Y=Y.return}if(cn===null)throw Error(n(160));Gb(k,A,v),cn=null,Cr=!1;var te=v.alternate;te!==null&&(te.return=null),v.return=null}catch(fe){Ot(v,o,fe)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Kb(o,s),o=o.sibling}function Kb(s,o){var d=s.alternate,g=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(Tr(o,s),ls(s),g&4){try{Ml(3,s,s.return),Cu(3,s)}catch(qe){Ot(s,s.return,qe)}try{Ml(5,s,s.return)}catch(qe){Ot(s,s.return,qe)}}break;case 1:Tr(o,s),ls(s),g&512&&d!==null&&ui(d,d.return);break;case 5:if(Tr(o,s),ls(s),g&512&&d!==null&&ui(d,d.return),s.flags&32){var v=s.stateNode;try{ie(v,"")}catch(qe){Ot(s,s.return,qe)}}if(g&4&&(v=s.stateNode,v!=null)){var k=s.memoizedProps,A=d!==null?d.memoizedProps:k,Y=s.type,te=s.updateQueue;if(s.updateQueue=null,te!==null)try{Y==="input"&&k.type==="radio"&&k.name!=null&&et(v,k),yt(Y,A);var fe=yt(Y,k);for(A=0;A<te.length;A+=2){var ve=te[A],xe=te[A+1];ve==="style"?tt(v,xe):ve==="dangerouslySetInnerHTML"?Ee(v,xe):ve==="children"?ie(v,xe):E(v,ve,xe,fe)}switch(Y){case"input":je(v,k);break;case"textarea":Re(v,k);break;case"select":var we=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!k.multiple;var Ie=k.value;Ie!=null?Qe(v,!!k.multiple,Ie,!1):we!==!!k.multiple&&(k.defaultValue!=null?Qe(v,!!k.multiple,k.defaultValue,!0):Qe(v,!!k.multiple,k.multiple?[]:"",!1))}v[bl]=k}catch(qe){Ot(s,s.return,qe)}}break;case 6:if(Tr(o,s),ls(s),g&4){if(s.stateNode===null)throw Error(n(162));v=s.stateNode,k=s.memoizedProps;try{v.nodeValue=k}catch(qe){Ot(s,s.return,qe)}}break;case 3:if(Tr(o,s),ls(s),g&4&&d!==null&&d.memoizedState.isDehydrated)try{Kr(o.containerInfo)}catch(qe){Ot(s,s.return,qe)}break;case 4:Tr(o,s),ls(s);break;case 13:Tr(o,s),ls(s),v=s.child,v.flags&8192&&(k=v.memoizedState!==null,v.stateNode.isHidden=k,!k||v.alternate!==null&&v.alternate.memoizedState!==null||(Df=bt())),g&4&&Vb(s);break;case 22:if(ve=d!==null&&d.memoizedState!==null,s.mode&1?(xn=(fe=xn)||ve,Tr(o,s),xn=fe):Tr(o,s),ls(s),g&8192){if(fe=s.memoizedState!==null,(s.stateNode.isHidden=fe)&&!ve&&(s.mode&1)!==0)for(Le=s,ve=s.child;ve!==null;){for(xe=Le=ve;Le!==null;){switch(we=Le,Ie=we.child,we.tag){case 0:case 11:case 14:case 15:Ml(4,we,we.return);break;case 1:ui(we,we.return);var De=we.stateNode;if(typeof De.componentWillUnmount=="function"){g=we,d=we.return;try{o=g,De.props=o.memoizedProps,De.state=o.memoizedState,De.componentWillUnmount()}catch(qe){Ot(g,d,qe)}}break;case 5:ui(we,we.return);break;case 22:if(we.memoizedState!==null){Zb(xe);continue}}Ie!==null?(Ie.return=we,Le=Ie):Zb(xe)}ve=ve.sibling}e:for(ve=null,xe=s;;){if(xe.tag===5){if(ve===null){ve=xe;try{v=xe.stateNode,fe?(k=v.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none"):(Y=xe.stateNode,te=xe.memoizedProps.style,A=te!=null&&te.hasOwnProperty("display")?te.display:null,Y.style.display=lt("display",A))}catch(qe){Ot(s,s.return,qe)}}}else if(xe.tag===6){if(ve===null)try{xe.stateNode.nodeValue=fe?"":xe.memoizedProps}catch(qe){Ot(s,s.return,qe)}}else if((xe.tag!==22&&xe.tag!==23||xe.memoizedState===null||xe===s)&&xe.child!==null){xe.child.return=xe,xe=xe.child;continue}if(xe===s)break e;for(;xe.sibling===null;){if(xe.return===null||xe.return===s)break e;ve===xe&&(ve=null),xe=xe.return}ve===xe&&(ve=null),xe.sibling.return=xe.return,xe=xe.sibling}}break;case 19:Tr(o,s),ls(s),g&4&&Vb(s);break;case 21:break;default:Tr(o,s),ls(s)}}function ls(s){var o=s.flags;if(o&2){try{e:{for(var d=s.return;d!==null;){if(Wb(d)){var g=d;break e}d=d.return}throw Error(n(160))}switch(g.tag){case 5:var v=g.stateNode;g.flags&32&&(ie(v,""),g.flags&=-33);var k=Hb(s);Of(s,k,v);break;case 3:case 4:var A=g.stateNode.containerInfo,Y=Hb(s);$f(s,Y,A);break;default:throw Error(n(161))}}catch(te){Ot(s,s.return,te)}s.flags&=-3}o&4096&&(s.flags&=-4097)}function aI(s,o,d){Le=s,Yb(s)}function Yb(s,o,d){for(var g=(s.mode&1)!==0;Le!==null;){var v=Le,k=v.child;if(v.tag===22&&g){var A=v.memoizedState!==null||Eu;if(!A){var Y=v.alternate,te=Y!==null&&Y.memoizedState!==null||xn;Y=Eu;var fe=xn;if(Eu=A,(xn=te)&&!fe)for(Le=v;Le!==null;)A=Le,te=A.child,A.tag===22&&A.memoizedState!==null?Qb(v):te!==null?(te.return=A,Le=te):Qb(v);for(;k!==null;)Le=k,Yb(k),k=k.sibling;Le=v,Eu=Y,xn=fe}Xb(s)}else(v.subtreeFlags&8772)!==0&&k!==null?(k.return=v,Le=k):Xb(s)}}function Xb(s){for(;Le!==null;){var o=Le;if((o.flags&8772)!==0){var d=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:xn||Cu(5,o);break;case 1:var g=o.stateNode;if(o.flags&4&&!xn)if(d===null)g.componentDidMount();else{var v=o.elementType===o.type?d.memoizedProps:Er(o.type,d.memoizedProps);g.componentDidUpdate(v,d.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var k=o.updateQueue;k!==null&&Z0(o,k,g);break;case 3:var A=o.updateQueue;if(A!==null){if(d=null,o.child!==null)switch(o.child.tag){case 5:d=o.child.stateNode;break;case 1:d=o.child.stateNode}Z0(o,A,d)}break;case 5:var Y=o.stateNode;if(d===null&&o.flags&4){d=Y;var te=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":te.autoFocus&&d.focus();break;case"img":te.src&&(d.src=te.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var fe=o.alternate;if(fe!==null){var ve=fe.memoizedState;if(ve!==null){var xe=ve.dehydrated;xe!==null&&Kr(xe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}xn||o.flags&512&&If(o)}catch(we){Ot(o,o.return,we)}}if(o===s){Le=null;break}if(d=o.sibling,d!==null){d.return=o.return,Le=d;break}Le=o.return}}function Zb(s){for(;Le!==null;){var o=Le;if(o===s){Le=null;break}var d=o.sibling;if(d!==null){d.return=o.return,Le=d;break}Le=o.return}}function Qb(s){for(;Le!==null;){var o=Le;try{switch(o.tag){case 0:case 11:case 15:var d=o.return;try{Cu(4,o)}catch(te){Ot(o,d,te)}break;case 1:var g=o.stateNode;if(typeof g.componentDidMount=="function"){var v=o.return;try{g.componentDidMount()}catch(te){Ot(o,v,te)}}var k=o.return;try{If(o)}catch(te){Ot(o,k,te)}break;case 5:var A=o.return;try{If(o)}catch(te){Ot(o,A,te)}}}catch(te){Ot(o,o.return,te)}if(o===s){Le=null;break}var Y=o.sibling;if(Y!==null){Y.return=o.return,Le=Y;break}Le=o.return}}var oI=Math.ceil,Tu=C.ReactCurrentDispatcher,Pf=C.ReactCurrentOwner,ir=C.ReactCurrentBatchConfig,pt=0,en=null,Bt=null,un=0,Hn=0,di=aa(0),Gt=0,Il=null,to=0,Au=0,Lf=0,$l=null,Pn=null,Df=0,hi=1/0,$s=null,Ru=!1,qf=null,da=null,Mu=!1,ha=null,Iu=0,Ol=0,Ff=null,$u=-1,Ou=0;function jn(){return(pt&6)!==0?bt():$u!==-1?$u:$u=bt()}function fa(s){return(s.mode&1)===0?1:(pt&2)!==0&&un!==0?un&-un:UM.transition!==null?(Ou===0&&(Ou=Ic()),Ou):(s=ft,s!==0||(s=window.event,s=s===void 0?16:qc(s.type)),s)}function Ar(s,o,d,g){if(50<Ol)throw Ol=0,Ff=null,Error(n(185));sn(s,d,g),((pt&2)===0||s!==en)&&(s===en&&((pt&2)===0&&(Au|=d),Gt===4&&pa(s,un)),Ln(s,g),d===1&&pt===0&&(o.mode&1)===0&&(hi=bt()+500,cu&&ia()))}function Ln(s,o){var d=s.callbackNode;Mc(s,o);var g=Ra(s,s===en?un:0);if(g===0)d!==null&&Mt(d),s.callbackNode=null,s.callbackPriority=0;else if(o=g&-g,s.callbackPriority!==o){if(d!=null&&Mt(d),o===1)s.tag===0?zM(ek.bind(null,s)):q0(ek.bind(null,s)),au(function(){(pt&6)===0&&ia()}),d=null;else{switch(Ft(g)){case 1:d=Ws;break;case 4:d=jo;break;case 16:d=ys;break;case 536870912:d=Hs;break;default:d=ys}d=lk(d,Jb.bind(null,s))}s.callbackPriority=o,s.callbackNode=d}}function Jb(s,o){if($u=-1,Ou=0,(pt&6)!==0)throw Error(n(327));var d=s.callbackNode;if(fi()&&s.callbackNode!==d)return null;var g=Ra(s,s===en?un:0);if(g===0)return null;if((g&30)!==0||(g&s.expiredLanes)!==0||o)o=Pu(s,g);else{o=g;var v=pt;pt|=2;var k=nk();(en!==s||un!==o)&&($s=null,hi=bt()+500,ro(s,o));do try{cI();break}catch(Y){tk(s,Y)}while(!0);rf(),Tu.current=k,pt=v,Bt!==null?o=0:(en=null,un=0,o=Gt)}if(o!==0){if(o===2&&(v=vs(s),v!==0&&(g=v,o=Bf(s,v))),o===1)throw d=Il,ro(s,0),pa(s,g),Ln(s,bt()),d;if(o===6)pa(s,g);else{if(v=s.current.alternate,(g&30)===0&&!iI(v)&&(o=Pu(s,g),o===2&&(k=vs(s),k!==0&&(g=k,o=Bf(s,k))),o===1))throw d=Il,ro(s,0),pa(s,g),Ln(s,bt()),d;switch(s.finishedWork=v,s.finishedLanes=g,o){case 0:case 1:throw Error(n(345));case 2:so(s,Pn,$s);break;case 3:if(pa(s,g),(g&130023424)===g&&(o=Df+500-bt(),10<o)){if(Ra(s,0)!==0)break;if(v=s.suspendedLanes,(v&g)!==g){jn(),s.pingedLanes|=s.suspendedLanes&v;break}s.timeoutHandle=vl(so.bind(null,s,Pn,$s),o);break}so(s,Pn,$s);break;case 4:if(pa(s,g),(g&4194240)===g)break;for(o=s.eventTimes,v=-1;0<g;){var A=31-An(g);k=1<<A,A=o[A],A>v&&(v=A),g&=~k}if(g=v,g=bt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*oI(g/1960))-g,10<g){s.timeoutHandle=vl(so.bind(null,s,Pn,$s),g);break}so(s,Pn,$s);break;case 5:so(s,Pn,$s);break;default:throw Error(n(329))}}}return Ln(s,bt()),s.callbackNode===d?Jb.bind(null,s):null}function Bf(s,o){var d=$l;return s.current.memoizedState.isDehydrated&&(ro(s,o).flags|=256),s=Pu(s,o),s!==2&&(o=Pn,Pn=d,o!==null&&zf(o)),s}function zf(s){Pn===null?Pn=s:Pn.push.apply(Pn,s)}function iI(s){for(var o=s;;){if(o.flags&16384){var d=o.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var g=0;g<d.length;g++){var v=d[g],k=v.getSnapshot;v=v.value;try{if(!Rn(k(),v))return!1}catch{return!1}}}if(d=o.child,o.subtreeFlags&16384&&d!==null)d.return=o,o=d;else{if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function pa(s,o){for(o&=~Lf,o&=~Au,s.suspendedLanes|=o,s.pingedLanes&=~o,s=s.expirationTimes;0<o;){var d=31-An(o),g=1<<d;s[d]=-1,o&=~g}}function ek(s){if((pt&6)!==0)throw Error(n(327));fi();var o=Ra(s,0);if((o&1)===0)return Ln(s,bt()),null;var d=Pu(s,o);if(s.tag!==0&&d===2){var g=vs(s);g!==0&&(o=g,d=Bf(s,g))}if(d===1)throw d=Il,ro(s,0),pa(s,o),Ln(s,bt()),d;if(d===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=o,so(s,Pn,$s),Ln(s,bt()),null}function Uf(s,o){var d=pt;pt|=1;try{return s(o)}finally{pt=d,pt===0&&(hi=bt()+500,cu&&ia())}}function no(s){ha!==null&&ha.tag===0&&(pt&6)===0&&fi();var o=pt;pt|=1;var d=ir.transition,g=ft;try{if(ir.transition=null,ft=1,s)return s()}finally{ft=g,ir.transition=d,pt=o,(pt&6)===0&&ia()}}function Wf(){Hn=di.current,jt(di)}function ro(s,o){s.finishedWork=null,s.finishedLanes=0;var d=s.timeoutHandle;if(d!==-1&&(s.timeoutHandle=-1,ru(d)),Bt!==null)for(d=Bt.return;d!==null;){var g=d;switch(Qh(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&iu();break;case 3:li(),jt(In),jt(yn),hf();break;case 5:uf(g);break;case 4:li();break;case 13:jt(It);break;case 19:jt(It);break;case 10:sf(g.type._context);break;case 22:case 23:Wf()}d=d.return}if(en=s,Bt=s=ma(s.current,null),un=Hn=o,Gt=0,Il=null,Lf=Au=to=0,Pn=$l=null,Qa!==null){for(o=0;o<Qa.length;o++)if(d=Qa[o],g=d.interleaved,g!==null){d.interleaved=null;var v=g.next,k=d.pending;if(k!==null){var A=k.next;k.next=v,g.next=A}d.pending=g}Qa=null}return s}function tk(s,o){do{var d=Bt;try{if(rf(),vu.current=_u,xu){for(var g=$t.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}xu=!1}if(eo=0,Jt=Ht=$t=null,El=!1,Cl=0,Pf.current=null,d===null||d.return===null){Gt=1,Il=o,Bt=null;break}e:{var k=s,A=d.return,Y=d,te=o;if(o=un,Y.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var fe=te,ve=Y,xe=ve.tag;if((ve.mode&1)===0&&(xe===0||xe===11||xe===15)){var we=ve.alternate;we?(ve.updateQueue=we.updateQueue,ve.memoizedState=we.memoizedState,ve.lanes=we.lanes):(ve.updateQueue=null,ve.memoizedState=null)}var Ie=jb(A);if(Ie!==null){Ie.flags&=-257,Eb(Ie,A,Y,k,o),Ie.mode&1&&Sb(k,fe,o),o=Ie,te=fe;var De=o.updateQueue;if(De===null){var qe=new Set;qe.add(te),o.updateQueue=qe}else De.add(te);break e}else{if((o&1)===0){Sb(k,fe,o),Hf();break e}te=Error(n(426))}}else if(Ct&&Y.mode&1){var qt=jb(A);if(qt!==null){(qt.flags&65536)===0&&(qt.flags|=256),Eb(qt,A,Y,k,o),tf(ci(te,Y));break e}}k=te=ci(te,Y),Gt!==4&&(Gt=2),$l===null?$l=[k]:$l.push(k),k=A;do{switch(k.tag){case 3:k.flags|=65536,o&=-o,k.lanes|=o;var le=_b(k,te,o);X0(k,le);break e;case 1:Y=te;var re=k.type,ce=k.stateNode;if((k.flags&128)===0&&(typeof re.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(da===null||!da.has(ce)))){k.flags|=65536,o&=-o,k.lanes|=o;var Ne=Nb(k,Y,o);X0(k,Ne);break e}}k=k.return}while(k!==null)}sk(d)}catch(Be){o=Be,Bt===d&&d!==null&&(Bt=d=d.return);continue}break}while(!0)}function nk(){var s=Tu.current;return Tu.current=_u,s===null?_u:s}function Hf(){(Gt===0||Gt===3||Gt===2)&&(Gt=4),en===null||(to&268435455)===0&&(Au&268435455)===0||pa(en,un)}function Pu(s,o){var d=pt;pt|=2;var g=nk();(en!==s||un!==o)&&($s=null,ro(s,o));do try{lI();break}catch(v){tk(s,v)}while(!0);if(rf(),pt=d,Tu.current=g,Bt!==null)throw Error(n(261));return en=null,un=0,Gt}function lI(){for(;Bt!==null;)rk(Bt)}function cI(){for(;Bt!==null&&!xr();)rk(Bt)}function rk(s){var o=ik(s.alternate,s,Hn);s.memoizedProps=s.pendingProps,o===null?sk(s):Bt=o,Pf.current=null}function sk(s){var o=s;do{var d=o.alternate;if(s=o.return,(o.flags&32768)===0){if(d=tI(d,o,Hn),d!==null){Bt=d;return}}else{if(d=nI(d,o),d!==null){d.flags&=32767,Bt=d;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{Gt=6,Bt=null;return}}if(o=o.sibling,o!==null){Bt=o;return}Bt=o=s}while(o!==null);Gt===0&&(Gt=5)}function so(s,o,d){var g=ft,v=ir.transition;try{ir.transition=null,ft=1,uI(s,o,d,g)}finally{ir.transition=v,ft=g}return null}function uI(s,o,d,g){do fi();while(ha!==null);if((pt&6)!==0)throw Error(n(327));d=s.finishedWork;var v=s.finishedLanes;if(d===null)return null;if(s.finishedWork=null,s.finishedLanes=0,d===s.current)throw Error(n(177));s.callbackNode=null,s.callbackPriority=0;var k=d.lanes|d.childLanes;if(Ro(s,k),s===en&&(Bt=en=null,un=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Mu||(Mu=!0,lk(ys,function(){return fi(),null})),k=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||k){k=ir.transition,ir.transition=null;var A=ft;ft=1;var Y=pt;pt|=4,Pf.current=null,sI(s,d),Kb(d,s),gl(sa),Mo=!!gn,sa=gn=null,s.current=d,aI(d),xt(),pt=Y,ft=A,ir.transition=k}else s.current=d;if(Mu&&(Mu=!1,ha=s,Iu=v),k=s.pendingLanes,k===0&&(da=null),Ur(d.stateNode),Ln(s,bt()),o!==null)for(g=s.onRecoverableError,d=0;d<o.length;d++)v=o[d],g(v.value,{componentStack:v.stack,digest:v.digest});if(Ru)throw Ru=!1,s=qf,qf=null,s;return(Iu&1)!==0&&s.tag!==0&&fi(),k=s.pendingLanes,(k&1)!==0?s===Ff?Ol++:(Ol=0,Ff=s):Ol=0,ia(),null}function fi(){if(ha!==null){var s=Ft(Iu),o=ir.transition,d=ft;try{if(ir.transition=null,ft=16>s?16:s,ha===null)var g=!1;else{if(s=ha,ha=null,Iu=0,(pt&6)!==0)throw Error(n(331));var v=pt;for(pt|=4,Le=s.current;Le!==null;){var k=Le,A=k.child;if((Le.flags&16)!==0){var Y=k.deletions;if(Y!==null){for(var te=0;te<Y.length;te++){var fe=Y[te];for(Le=fe;Le!==null;){var ve=Le;switch(ve.tag){case 0:case 11:case 15:Ml(8,ve,k)}var xe=ve.child;if(xe!==null)xe.return=ve,Le=xe;else for(;Le!==null;){ve=Le;var we=ve.sibling,Ie=ve.return;if(Ub(ve),ve===fe){Le=null;break}if(we!==null){we.return=Ie,Le=we;break}Le=Ie}}}var De=k.alternate;if(De!==null){var qe=De.child;if(qe!==null){De.child=null;do{var qt=qe.sibling;qe.sibling=null,qe=qt}while(qe!==null)}}Le=k}}if((k.subtreeFlags&2064)!==0&&A!==null)A.return=k,Le=A;else e:for(;Le!==null;){if(k=Le,(k.flags&2048)!==0)switch(k.tag){case 0:case 11:case 15:Ml(9,k,k.return)}var le=k.sibling;if(le!==null){le.return=k.return,Le=le;break e}Le=k.return}}var re=s.current;for(Le=re;Le!==null;){A=Le;var ce=A.child;if((A.subtreeFlags&2064)!==0&&ce!==null)ce.return=A,Le=ce;else e:for(A=re;Le!==null;){if(Y=Le,(Y.flags&2048)!==0)try{switch(Y.tag){case 0:case 11:case 15:Cu(9,Y)}}catch(Be){Ot(Y,Y.return,Be)}if(Y===A){Le=null;break e}var Ne=Y.sibling;if(Ne!==null){Ne.return=Y.return,Le=Ne;break e}Le=Y.return}}if(pt=v,ia(),Tn&&typeof Tn.onPostCommitFiberRoot=="function")try{Tn.onPostCommitFiberRoot(ws,s)}catch{}g=!0}return g}finally{ft=d,ir.transition=o}}return!1}function ak(s,o,d){o=ci(d,o),o=_b(s,o,1),s=ca(s,o,1),o=jn(),s!==null&&(sn(s,1,o),Ln(s,o))}function Ot(s,o,d){if(s.tag===3)ak(s,s,d);else for(;o!==null;){if(o.tag===3){ak(o,s,d);break}else if(o.tag===1){var g=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(da===null||!da.has(g))){s=ci(d,s),s=Nb(o,s,1),o=ca(o,s,1),s=jn(),o!==null&&(sn(o,1,s),Ln(o,s));break}}o=o.return}}function dI(s,o,d){var g=s.pingCache;g!==null&&g.delete(o),o=jn(),s.pingedLanes|=s.suspendedLanes&d,en===s&&(un&d)===d&&(Gt===4||Gt===3&&(un&130023424)===un&&500>bt()-Df?ro(s,0):Lf|=d),Ln(s,o)}function ok(s,o){o===0&&((s.mode&1)===0?o=1:(o=To,To<<=1,(To&130023424)===0&&(To=4194304)));var d=jn();s=Rs(s,o),s!==null&&(sn(s,o,d),Ln(s,d))}function hI(s){var o=s.memoizedState,d=0;o!==null&&(d=o.retryLane),ok(s,d)}function fI(s,o){var d=0;switch(s.tag){case 13:var g=s.stateNode,v=s.memoizedState;v!==null&&(d=v.retryLane);break;case 19:g=s.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(o),ok(s,d)}var ik;ik=function(s,o,d){if(s!==null)if(s.memoizedProps!==o.pendingProps||In.current)On=!0;else{if((s.lanes&d)===0&&(o.flags&128)===0)return On=!1,eI(s,o,d);On=(s.flags&131072)!==0}else On=!1,Ct&&(o.flags&1048576)!==0&&F0(o,du,o.index);switch(o.lanes=0,o.tag){case 2:var g=o.type;ju(s,o),s=o.pendingProps;var v=ti(o,yn.current);ii(o,d),v=mf(null,o,g,s,v,d);var k=gf();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,$n(g)?(k=!0,lu(o)):k=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,lf(o),v.updater=Nu,o.stateNode=v,v._reactInternals=o,kf(o,g,s,d),o=jf(null,o,g,!0,k,d)):(o.tag=0,Ct&&k&&Zh(o),Sn(null,o,v,d),o=o.child),o;case 16:g=o.elementType;e:{switch(ju(s,o),s=o.pendingProps,v=g._init,g=v(g._payload),o.type=g,v=o.tag=mI(g),s=Er(g,s),v){case 0:o=Sf(null,o,g,s,d);break e;case 1:o=Ib(null,o,g,s,d);break e;case 11:o=Cb(null,o,g,s,d);break e;case 14:o=Tb(null,o,g,Er(g.type,s),d);break e}throw Error(n(306,g,""))}return o;case 0:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:Er(g,v),Sf(s,o,g,v,d);case 1:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:Er(g,v),Ib(s,o,g,v,d);case 3:e:{if($b(o),s===null)throw Error(n(387));g=o.pendingProps,k=o.memoizedState,v=k.element,Y0(s,o),yu(o,g,null,d);var A=o.memoizedState;if(g=A.element,k.isDehydrated)if(k={element:g,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},o.updateQueue.baseState=k,o.memoizedState=k,o.flags&256){v=ci(Error(n(423)),o),o=Ob(s,o,g,d,v);break e}else if(g!==v){v=ci(Error(n(424)),o),o=Ob(s,o,g,d,v);break e}else for(Wn=Mn(o.stateNode.containerInfo.firstChild),Un=o,Ct=!0,jr=null,d=V0(o,null,g,d),o.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(si(),g===v){o=Is(s,o,d);break e}Sn(s,o,g,d)}o=o.child}return o;case 5:return Q0(o),s===null&&ef(o),g=o.type,v=o.pendingProps,k=s!==null?s.memoizedProps:null,A=v.children,Qo(g,v)?A=null:k!==null&&Qo(g,k)&&(o.flags|=32),Mb(s,o),Sn(s,o,A,d),o.child;case 6:return s===null&&ef(o),null;case 13:return Pb(s,o,d);case 4:return cf(o,o.stateNode.containerInfo),g=o.pendingProps,s===null?o.child=ai(o,null,g,d):Sn(s,o,g,d),o.child;case 11:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:Er(g,v),Cb(s,o,g,v,d);case 7:return Sn(s,o,o.pendingProps,d),o.child;case 8:return Sn(s,o,o.pendingProps.children,d),o.child;case 12:return Sn(s,o,o.pendingProps.children,d),o.child;case 10:e:{if(g=o.type._context,v=o.pendingProps,k=o.memoizedProps,A=v.value,Nt(pu,g._currentValue),g._currentValue=A,k!==null)if(Rn(k.value,A)){if(k.children===v.children&&!In.current){o=Is(s,o,d);break e}}else for(k=o.child,k!==null&&(k.return=o);k!==null;){var Y=k.dependencies;if(Y!==null){A=k.child;for(var te=Y.firstContext;te!==null;){if(te.context===g){if(k.tag===1){te=Ms(-1,d&-d),te.tag=2;var fe=k.updateQueue;if(fe!==null){fe=fe.shared;var ve=fe.pending;ve===null?te.next=te:(te.next=ve.next,ve.next=te),fe.pending=te}}k.lanes|=d,te=k.alternate,te!==null&&(te.lanes|=d),af(k.return,d,o),Y.lanes|=d;break}te=te.next}}else if(k.tag===10)A=k.type===o.type?null:k.child;else if(k.tag===18){if(A=k.return,A===null)throw Error(n(341));A.lanes|=d,Y=A.alternate,Y!==null&&(Y.lanes|=d),af(A,d,o),A=k.sibling}else A=k.child;if(A!==null)A.return=k;else for(A=k;A!==null;){if(A===o){A=null;break}if(k=A.sibling,k!==null){k.return=A.return,A=k;break}A=A.return}k=A}Sn(s,o,v.children,d),o=o.child}return o;case 9:return v=o.type,g=o.pendingProps.children,ii(o,d),v=ar(v),g=g(v),o.flags|=1,Sn(s,o,g,d),o.child;case 14:return g=o.type,v=Er(g,o.pendingProps),v=Er(g.type,v),Tb(s,o,g,v,d);case 15:return Ab(s,o,o.type,o.pendingProps,d);case 17:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:Er(g,v),ju(s,o),o.tag=1,$n(g)?(s=!0,lu(o)):s=!1,ii(o,d),bb(o,g,v),kf(o,g,v,d),jf(null,o,g,!0,s,d);case 19:return Db(s,o,d);case 22:return Rb(s,o,d)}throw Error(n(156,o.tag))};function lk(s,o){return Rt(s,o)}function pI(s,o,d,g){this.tag=s,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function lr(s,o,d,g){return new pI(s,o,d,g)}function Gf(s){return s=s.prototype,!(!s||!s.isReactComponent)}function mI(s){if(typeof s=="function")return Gf(s)?1:0;if(s!=null){if(s=s.$$typeof,s===Q)return 11;if(s===X)return 14}return 2}function ma(s,o){var d=s.alternate;return d===null?(d=lr(s.tag,o,s.key,s.mode),d.elementType=s.elementType,d.type=s.type,d.stateNode=s.stateNode,d.alternate=s,s.alternate=d):(d.pendingProps=o,d.type=s.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=s.flags&14680064,d.childLanes=s.childLanes,d.lanes=s.lanes,d.child=s.child,d.memoizedProps=s.memoizedProps,d.memoizedState=s.memoizedState,d.updateQueue=s.updateQueue,o=s.dependencies,d.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},d.sibling=s.sibling,d.index=s.index,d.ref=s.ref,d}function Lu(s,o,d,g,v,k){var A=2;if(g=s,typeof s=="function")Gf(s)&&(A=1);else if(typeof s=="string")A=5;else e:switch(s){case $:return ao(d.children,v,k,o);case D:A=8,v|=8;break;case W:return s=lr(12,d,o,v|2),s.elementType=W,s.lanes=k,s;case ee:return s=lr(13,d,o,v),s.elementType=ee,s.lanes=k,s;case M:return s=lr(19,d,o,v),s.elementType=M,s.lanes=k,s;case I:return Du(d,v,k,o);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case L:A=10;break e;case V:A=9;break e;case Q:A=11;break e;case X:A=14;break e;case H:A=16,g=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return o=lr(A,d,o,v),o.elementType=s,o.type=g,o.lanes=k,o}function ao(s,o,d,g){return s=lr(7,s,g,o),s.lanes=d,s}function Du(s,o,d,g){return s=lr(22,s,g,o),s.elementType=I,s.lanes=d,s.stateNode={isHidden:!1},s}function Vf(s,o,d){return s=lr(6,s,null,o),s.lanes=d,s}function Kf(s,o,d){return o=lr(4,s.children!==null?s.children:[],s.key,o),o.lanes=d,o.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},o}function gI(s,o,d,g,v){this.tag=o,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ao(0),this.expirationTimes=Ao(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ao(0),this.identifierPrefix=g,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Yf(s,o,d,g,v,k,A,Y,te){return s=new gI(s,o,d,Y,te),o===1?(o=1,k===!0&&(o|=8)):o=0,k=lr(3,null,null,o),s.current=k,k.stateNode=s,k.memoizedState={element:g,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},lf(k),s}function yI(s,o,d){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:g==null?null:""+g,children:s,containerInfo:o,implementation:d}}function ck(s){if(!s)return oa;s=s._reactInternals;e:{if(Z(s)!==s||s.tag!==1)throw Error(n(170));var o=s;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if($n(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(s.tag===1){var d=s.type;if($n(d))return L0(s,d,o)}return o}function uk(s,o,d,g,v,k,A,Y,te){return s=Yf(d,g,!0,s,v,k,A,Y,te),s.context=ck(null),d=s.current,g=jn(),v=fa(d),k=Ms(g,v),k.callback=o??null,ca(d,k,v),s.current.lanes=v,sn(s,v,g),Ln(s,g),s}function qu(s,o,d,g){var v=o.current,k=jn(),A=fa(v);return d=ck(d),o.context===null?o.context=d:o.pendingContext=d,o=Ms(k,A),o.payload={element:s},g=g===void 0?null:g,g!==null&&(o.callback=g),s=ca(v,o,A),s!==null&&(Ar(s,v,A,k),gu(s,v,A)),A}function Fu(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return s.child.stateNode;default:return s.child.stateNode}}function dk(s,o){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var d=s.retryLane;s.retryLane=d!==0&&d<o?d:o}}function Xf(s,o){dk(s,o),(s=s.alternate)&&dk(s,o)}function wI(){return null}var hk=typeof reportError=="function"?reportError:function(s){console.error(s)};function Zf(s){this._internalRoot=s}Bu.prototype.render=Zf.prototype.render=function(s){var o=this._internalRoot;if(o===null)throw Error(n(409));qu(s,o,null,null)},Bu.prototype.unmount=Zf.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var o=s.containerInfo;no(function(){qu(null,s,null,null)}),o[Es]=null}};function Bu(s){this._internalRoot=s}Bu.prototype.unstable_scheduleHydration=function(s){if(s){var o=Yi();s={blockedOn:null,target:s,priority:o};for(var d=0;d<kr.length&&o!==0&&o<kr[d].priority;d++);kr.splice(d,0,s),d===0&&Xi(s)}};function Qf(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function zu(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function fk(){}function vI(s,o,d,g,v){if(v){if(typeof g=="function"){var k=g;g=function(){var fe=Fu(A);k.call(fe)}}var A=uk(o,g,s,0,null,!1,!1,"",fk);return s._reactRootContainer=A,s[Es]=A.current,ra(s.nodeType===8?s.parentNode:s),no(),A}for(;v=s.lastChild;)s.removeChild(v);if(typeof g=="function"){var Y=g;g=function(){var fe=Fu(te);Y.call(fe)}}var te=Yf(s,0,!1,null,null,!1,!1,"",fk);return s._reactRootContainer=te,s[Es]=te.current,ra(s.nodeType===8?s.parentNode:s),no(function(){qu(o,te,d,g)}),te}function Uu(s,o,d,g,v){var k=d._reactRootContainer;if(k){var A=k;if(typeof v=="function"){var Y=v;v=function(){var te=Fu(A);Y.call(te)}}qu(o,A,s,v)}else A=vI(d,o,s,v,g);return Fu(A)}$c=function(s){switch(s.tag){case 3:var o=s.stateNode;if(o.current.memoizedState.isDehydrated){var d=Gs(o.pendingLanes);d!==0&&(Ki(o,d|1),Ln(o,bt()),(pt&6)===0&&(hi=bt()+500,ia()))}break;case 13:no(function(){var g=Rs(s,1);if(g!==null){var v=jn();Ar(g,s,1,v)}}),Xf(s,1)}},Jn=function(s){if(s.tag===13){var o=Rs(s,134217728);if(o!==null){var d=jn();Ar(o,s,134217728,d)}Xf(s,134217728)}},Ma=function(s){if(s.tag===13){var o=fa(s),d=Rs(s,o);if(d!==null){var g=jn();Ar(d,s,o,g)}Xf(s,o)}},Yi=function(){return ft},Oc=function(s,o){var d=ft;try{return ft=s,o()}finally{ft=d}},Xt=function(s,o,d){switch(o){case"input":if(je(s,d),o=d.name,d.type==="radio"&&o!=null){for(d=s;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<d.length;o++){var g=d[o];if(g!==s&&g.form===s.form){var v=ou(g);if(!v)throw Error(n(90));Oe(g),je(g,v)}}}break;case"textarea":Re(s,d);break;case"select":o=d.value,o!=null&&Qe(s,!!d.multiple,o,!1)}},Cn=Uf,Lt=no;var xI={usingClientEntryPoint:!1,Events:[kl,Jo,ou,kn,pn,Uf]},Pl={findFiberByHostInstance:Ka,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},bI={bundleType:Pl.bundleType,version:Pl.version,rendererPackageName:Pl.rendererPackageName,rendererConfig:Pl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=ze(s),s===null?null:s.stateNode},findFiberByHostInstance:Pl.findFiberByHostInstance||wI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wu.isDisabled&&Wu.supportsFiber)try{ws=Wu.inject(bI),Tn=Wu}catch{}}return Dn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xI,Dn.createPortal=function(s,o){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Qf(o))throw Error(n(200));return yI(s,o,null,d)},Dn.createRoot=function(s,o){if(!Qf(s))throw Error(n(299));var d=!1,g="",v=hk;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(g=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=Yf(s,1,!1,null,null,d,!1,g,v),s[Es]=o.current,ra(s.nodeType===8?s.parentNode:s),new Zf(o)},Dn.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var o=s._reactInternals;if(o===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=ze(o),s=s===null?null:s.stateNode,s},Dn.flushSync=function(s){return no(s)},Dn.hydrate=function(s,o,d){if(!zu(o))throw Error(n(200));return Uu(null,s,o,!0,d)},Dn.hydrateRoot=function(s,o,d){if(!Qf(s))throw Error(n(405));var g=d!=null&&d.hydratedSources||null,v=!1,k="",A=hk;if(d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(k=d.identifierPrefix),d.onRecoverableError!==void 0&&(A=d.onRecoverableError)),o=uk(o,null,s,1,d??null,v,!1,k,A),s[Es]=o.current,ra(s),g)for(s=0;s<g.length;s++)d=g[s],v=d._getVersion,v=v(d._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[d,v]:o.mutableSourceEagerHydrationData.push(d,v);return new Bu(o)},Dn.render=function(s,o,d){if(!zu(o))throw Error(n(200));return Uu(null,s,o,!1,d)},Dn.unmountComponentAtNode=function(s){if(!zu(s))throw Error(n(40));return s._reactRootContainer?(no(function(){Uu(null,null,s,!1,function(){s._reactRootContainer=null,s[Es]=null})}),!0):!1},Dn.unstable_batchedUpdates=Uf,Dn.unstable_renderSubtreeIntoContainer=function(s,o,d,g){if(!zu(d))throw Error(n(200));if(s==null||s._reactInternals===void 0)throw Error(n(38));return Uu(s,o,d,!1,g)},Dn.version="18.3.1-next-f1338f8080-20240426",Dn}var bk;function DT(){if(bk)return tp.exports;bk=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(),tp.exports=CI(),tp.exports}var kk;function TI(){if(kk)return Gu;kk=1;var e=DT();return Gu.createRoot=e.createRoot,Gu.hydrateRoot=e.hydrateRoot,Gu}var AI=TI();const RI="modulepreload",MI=function(e){return"/"+e},_k={},qT=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let c=function(p){return Promise.all(p.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(p=>{if(p=MI(p),p in _k)return;_k[p]=!0;const h=p.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":RI,h||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),document.head.appendChild(y),h)return new Promise((w,N)=>{y.addEventListener("load",w),y.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${p}`)))})}))}function i(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return a.then(c=>{for(const u of c||[])u.status==="rejected"&&i(u.reason);return t().catch(i)})};var x=gc();const me=Mx(x);function hn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=hn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var sp={exports:{}},ap={},op={exports:{}},ip={};/**
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 Nk;function II(){if(Nk)return ip;Nk=1;var e=gc();function t(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,i=e.useLayoutEffect,c=e.useDebugValue;function u(m,y){var w=y(),N=r({inst:{value:w,getSnapshot:y}}),_=N[0].inst,S=N[1];return i(function(){_.value=w,_.getSnapshot=y,f(_)&&S({inst:_})},[m,w,y]),a(function(){return f(_)&&S({inst:_}),m(function(){f(_)&&S({inst:_})})},[m]),c(w),w}function f(m){var y=m.getSnapshot;m=m.value;try{var w=y();return!n(m,w)}catch{return!0}}function p(m,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return ip.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,ip}var Sk;function $I(){return Sk||(Sk=1,op.exports=II()),op.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 jk;function OI(){if(jk)return ap;jk=1;var e=gc(),t=$I();function n(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,i=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return ap.useSyncExternalStoreWithSelector=function(p,h,m,y,w){var N=i(null);if(N.current===null){var _={hasValue:!1,value:null};N.current=_}else _=N.current;N=u(function(){function b(R){if(!j){if(j=!0,E=R,R=y(R),w!==void 0&&_.hasValue){var $=_.value;if(w($,R))return C=$}return C=R}if($=C,r(E,R))return $;var D=y(R);return w!==void 0&&w($,D)?(E=R,$):(E=R,C=D)}var j=!1,E,C,T=m===void 0?null:m;return[function(){return b(h())},T===null?void 0:function(){return b(T())}]},[h,m,y,w]);var S=a(p,N[0],N[1]);return c(function(){_.hasValue=!0,_.value=S},[S]),f(S),S},ap}var Ek;function PI(){return Ek||(Ek=1,sp.exports=OI()),sp.exports}var LI=PI();const DI=Mx(LI),qI={},Ck=e=>{let t;const n=new Set,r=(h,m)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const w=t;t=m??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(N=>N(t,w))}},a=()=>t,f={setState:r,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(qI?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(r,a,f);return f},FI=e=>e?Ck(e):Ck,{useDebugValue:BI}=me,{useSyncExternalStoreWithSelector:zI}=DI,UI=e=>e;function FT(e,t=UI,n){const r=zI(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return BI(r),r}const Tk=(e,t)=>{const n=FI(e),r=(a,i=t)=>FT(n,a,i);return Object.assign(r,n),r},WI=(e,t)=>e?Tk(e,t):Tk;function Yt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var HI={value:()=>{}};function nh(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new vd(n)}function vd(e){this._=e}function GI(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",a=n.indexOf(".");if(a>=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}vd.prototype=nh.prototype={constructor:vd,on:function(e,t){var n=this._,r=GI(e+"",n),a,i=-1,c=r.length;if(arguments.length<2){for(;++i<c;)if((a=(e=r[i]).type)&&(a=VI(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<c;)if(a=(e=r[i]).type)n[a]=Ak(n[a],e.name,t);else if(t==null)for(a in n)n[a]=Ak(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new vd(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),r=0,a,i;r<a;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,a=i.length;r<a;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,i=r.length;a<i;++a)r[a].value.apply(t,n)}};function VI(e,t){for(var n=0,r=e.length,a;n<r;++n)if((a=e[n]).name===t)return a.value}function Ak(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=HI,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Jv="http://www.w3.org/1999/xhtml";const Rk={svg:"http://www.w3.org/2000/svg",xhtml:Jv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function rh(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rk.hasOwnProperty(t)?{space:Rk[t],local:e}:e}function KI(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Jv&&t.documentElement.namespaceURI===Jv?t.createElement(e):t.createElementNS(n,e)}}function YI(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function BT(e){var t=rh(e);return(t.local?YI:KI)(t)}function XI(){}function Ix(e){return e==null?XI:function(){return this.querySelector(e)}}function ZI(e){typeof e!="function"&&(e=Ix(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i=t[a],c=i.length,u=r[a]=new Array(c),f,p,h=0;h<c;++h)(f=i[h])&&(p=e.call(f,f.__data__,h,i))&&("__data__"in f&&(p.__data__=f.__data__),u[h]=p);return new Xn(r,this._parents)}function QI(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function JI(){return[]}function zT(e){return e==null?JI:function(){return this.querySelectorAll(e)}}function e$(e){return function(){return QI(e.apply(this,arguments))}}function t$(e){typeof e=="function"?e=e$(e):e=zT(e);for(var t=this._groups,n=t.length,r=[],a=[],i=0;i<n;++i)for(var c=t[i],u=c.length,f,p=0;p<u;++p)(f=c[p])&&(r.push(e.call(f,f.__data__,p,c)),a.push(f));return new Xn(r,a)}function UT(e){return function(){return this.matches(e)}}function WT(e){return function(t){return t.matches(e)}}var n$=Array.prototype.find;function r$(e){return function(){return n$.call(this.children,e)}}function s$(){return this.firstElementChild}function a$(e){return this.select(e==null?s$:r$(typeof e=="function"?e:WT(e)))}var o$=Array.prototype.filter;function i$(){return Array.from(this.children)}function l$(e){return function(){return o$.call(this.children,e)}}function c$(e){return this.selectAll(e==null?i$:l$(typeof e=="function"?e:WT(e)))}function u$(e){typeof e!="function"&&(e=UT(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i=t[a],c=i.length,u=r[a]=[],f,p=0;p<c;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&u.push(f);return new Xn(r,this._parents)}function HT(e){return new Array(e.length)}function d$(){return new Xn(this._enter||this._groups.map(HT),this._parents)}function Rd(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Rd.prototype={constructor:Rd,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 h$(e){return function(){return e}}function f$(e,t,n,r,a,i){for(var c=0,u,f=t.length,p=i.length;c<p;++c)(u=t[c])?(u.__data__=i[c],r[c]=u):n[c]=new Rd(e,i[c]);for(;c<f;++c)(u=t[c])&&(a[c]=u)}function p$(e,t,n,r,a,i,c){var u,f,p=new Map,h=t.length,m=i.length,y=new Array(h),w;for(u=0;u<h;++u)(f=t[u])&&(y[u]=w=c.call(f,f.__data__,u,t)+"",p.has(w)?a[u]=f:p.set(w,f));for(u=0;u<m;++u)w=c.call(e,i[u],u,i)+"",(f=p.get(w))?(r[u]=f,f.__data__=i[u],p.delete(w)):n[u]=new Rd(e,i[u]);for(u=0;u<h;++u)(f=t[u])&&p.get(y[u])===f&&(a[u]=f)}function m$(e){return e.__data__}function g$(e,t){if(!arguments.length)return Array.from(this,m$);var n=t?p$:f$,r=this._parents,a=this._groups;typeof e!="function"&&(e=h$(e));for(var i=a.length,c=new Array(i),u=new Array(i),f=new Array(i),p=0;p<i;++p){var h=r[p],m=a[p],y=m.length,w=y$(e.call(h,h&&h.__data__,p,r)),N=w.length,_=u[p]=new Array(N),S=c[p]=new Array(N),b=f[p]=new Array(y);n(h,m,_,S,b,w,t);for(var j=0,E=0,C,T;j<N;++j)if(C=_[j]){for(j>=E&&(E=j+1);!(T=S[E])&&++E<N;);C._next=T||null}}return c=new Xn(c,r),c._enter=u,c._exit=f,c}function y$(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function w$(){return new Xn(this._exit||this._groups.map(HT),this._parents)}function v$(e,t,n){var r=this.enter(),a=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?i.remove():n(i),r&&a?r.merge(a).order():a}function x$(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,a=n.length,i=r.length,c=Math.min(a,i),u=new Array(a),f=0;f<c;++f)for(var p=n[f],h=r[f],m=p.length,y=u[f]=new Array(m),w,N=0;N<m;++N)(w=p[N]||h[N])&&(y[N]=w);for(;f<a;++f)u[f]=n[f];return new Xn(u,this._parents)}function b$(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],a=r.length-1,i=r[a],c;--a>=0;)(c=r[a])&&(i&&c.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(c,i),i=c);return this}function k$(e){e||(e=_$);function t(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var n=this._groups,r=n.length,a=new Array(r),i=0;i<r;++i){for(var c=n[i],u=c.length,f=a[i]=new Array(u),p,h=0;h<u;++h)(p=c[h])&&(f[h]=p);f.sort(t)}return new Xn(a,this._parents).order()}function _$(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function N$(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function S$(){return Array.from(this)}function j$(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,i=r.length;a<i;++a){var c=r[a];if(c)return c}return null}function E$(){let e=0;for(const t of this)++e;return e}function C$(){return!this.node()}function T$(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var a=t[n],i=0,c=a.length,u;i<c;++i)(u=a[i])&&e.call(u,u.__data__,i,a);return this}function A$(e){return function(){this.removeAttribute(e)}}function R$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function M$(e,t){return function(){this.setAttribute(e,t)}}function I$(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function $$(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function O$(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 P$(e,t){var n=rh(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?R$:A$:typeof t=="function"?n.local?O$:$$:n.local?I$:M$)(n,t))}function GT(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function L$(e){return function(){this.style.removeProperty(e)}}function D$(e,t,n){return function(){this.style.setProperty(e,t,n)}}function q$(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function F$(e,t,n){return arguments.length>1?this.each((t==null?L$:typeof t=="function"?q$:D$)(e,t,n??"")):Mi(this.node(),e)}function Mi(e,t){return e.style.getPropertyValue(t)||GT(e).getComputedStyle(e,null).getPropertyValue(t)}function B$(e){return function(){delete this[e]}}function z$(e,t){return function(){this[e]=t}}function U$(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function W$(e,t){return arguments.length>1?this.each((t==null?B$:typeof t=="function"?U$:z$)(e,t)):this.node()[e]}function VT(e){return e.trim().split(/^|\s+/)}function $x(e){return e.classList||new KT(e)}function KT(e){this._node=e,this._names=VT(e.getAttribute("class")||"")}KT.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 YT(e,t){for(var n=$x(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function XT(e,t){for(var n=$x(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function H$(e){return function(){YT(this,e)}}function G$(e){return function(){XT(this,e)}}function V$(e,t){return function(){(t.apply(this,arguments)?YT:XT)(this,e)}}function K$(e,t){var n=VT(e+"");if(arguments.length<2){for(var r=$x(this.node()),a=-1,i=n.length;++a<i;)if(!r.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?V$:t?H$:G$)(n,t))}function Y$(){this.textContent=""}function X$(e){return function(){this.textContent=e}}function Z$(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Q$(e){return arguments.length?this.each(e==null?Y$:(typeof e=="function"?Z$:X$)(e)):this.node().textContent}function J$(){this.innerHTML=""}function eO(e){return function(){this.innerHTML=e}}function tO(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function nO(e){return arguments.length?this.each(e==null?J$:(typeof e=="function"?tO:eO)(e)):this.node().innerHTML}function rO(){this.nextSibling&&this.parentNode.appendChild(this)}function sO(){return this.each(rO)}function aO(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function oO(){return this.each(aO)}function iO(e){var t=typeof e=="function"?e:BT(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function lO(){return null}function cO(e,t){var n=typeof e=="function"?e:BT(e),r=t==null?lO:typeof t=="function"?t:Ix(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function uO(){var e=this.parentNode;e&&e.removeChild(this)}function dO(){return this.each(uO)}function hO(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function fO(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pO(e){return this.select(e?fO:hO)}function mO(e){return arguments.length?this.property("__data__",e):this.node().__data__}function gO(e){return function(t){e.call(this,t,this.__data__)}}function yO(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function wO(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,i;n<a;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function vO(e,t,n){return function(){var r=this.__on,a,i=gO(t);if(r){for(var c=0,u=r.length;c<u;++c)if((a=r[c]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=n),a.value=t;return}}this.addEventListener(e.type,i,n),a={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(a):this.__on=[a]}}function xO(e,t,n){var r=yO(e+""),a,i=r.length,c;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,p=u.length,h;f<p;++f)for(a=0,h=u[f];a<i;++a)if((c=r[a]).type===h.type&&c.name===h.name)return h.value}return}for(u=t?vO:wO,a=0;a<i;++a)this.each(u(r[a],t,n));return this}function ZT(e,t,n){var r=GT(e),a=r.CustomEvent;typeof a=="function"?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function bO(e,t){return function(){return ZT(this,e,t)}}function kO(e,t){return function(){return ZT(this,e,t.apply(this,arguments))}}function _O(e,t){return this.each((typeof t=="function"?kO:bO)(e,t))}function*NO(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,i=r.length,c;a<i;++a)(c=r[a])&&(yield c)}var QT=[null];function Xn(e,t){this._groups=e,this._parents=t}function yc(){return new Xn([[document.documentElement]],QT)}function SO(){return this}Xn.prototype=yc.prototype={constructor:Xn,select:ZI,selectAll:t$,selectChild:a$,selectChildren:c$,filter:u$,data:g$,enter:d$,exit:w$,join:v$,merge:x$,selection:SO,order:b$,sort:k$,call:N$,nodes:S$,node:j$,size:E$,empty:C$,each:T$,attr:P$,style:F$,property:W$,classed:K$,text:Q$,html:nO,raise:sO,lower:oO,append:iO,insert:cO,remove:dO,clone:pO,datum:mO,on:xO,dispatch:_O,[Symbol.iterator]:NO};function dr(e){return typeof e=="string"?new Xn([[document.querySelector(e)]],[document.documentElement]):new Xn([[e]],QT)}function jO(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Mr(e,t){if(e=jO(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const EO={passive:!1},nc={capture:!0,passive:!1};function lp(e){e.stopImmediatePropagation()}function Ei(e){e.preventDefault(),e.stopImmediatePropagation()}function JT(e){var t=e.document.documentElement,n=dr(e).on("dragstart.drag",Ei,nc);"onselectstart"in t?n.on("selectstart.drag",Ei,nc):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function e2(e,t){var n=e.document.documentElement,r=dr(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ei,nc),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Vu=e=>()=>e;function ex(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:i,x:c,y:u,dx:f,dy:p,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:h}})}ex.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function CO(e){return!e.ctrlKey&&!e.button}function TO(){return this.parentNode}function AO(e,t){return t??{x:e.x,y:e.y}}function RO(){return navigator.maxTouchPoints||"ontouchstart"in this}function MO(){var e=CO,t=TO,n=AO,r=RO,a={},i=nh("start","drag","end"),c=0,u,f,p,h,m=0;function y(C){C.on("mousedown.drag",w).filter(r).on("touchstart.drag",S).on("touchmove.drag",b,EO).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,T){if(!(h||!e.call(this,C,T))){var R=E(this,t.call(this,C,T),C,T,"mouse");R&&(dr(C.view).on("mousemove.drag",N,nc).on("mouseup.drag",_,nc),JT(C.view),lp(C),p=!1,u=C.clientX,f=C.clientY,R("start",C))}}function N(C){if(Ei(C),!p){var T=C.clientX-u,R=C.clientY-f;p=T*T+R*R>m}a.mouse("drag",C)}function _(C){dr(C.view).on("mousemove.drag mouseup.drag",null),e2(C.view,p),Ei(C),a.mouse("end",C)}function S(C,T){if(e.call(this,C,T)){var R=C.changedTouches,$=t.call(this,C,T),D=R.length,W,L;for(W=0;W<D;++W)(L=E(this,$,C,T,R[W].identifier,R[W]))&&(lp(C),L("start",C,R[W]))}}function b(C){var T=C.changedTouches,R=T.length,$,D;for($=0;$<R;++$)(D=a[T[$].identifier])&&(Ei(C),D("drag",C,T[$]))}function j(C){var T=C.changedTouches,R=T.length,$,D;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),$=0;$<R;++$)(D=a[T[$].identifier])&&(lp(C),D("end",C,T[$]))}function E(C,T,R,$,D,W){var L=i.copy(),V=Mr(W||R,T),Q,ee,M;if((M=n.call(C,new ex("beforestart",{sourceEvent:R,target:y,identifier:D,active:c,x:V[0],y:V[1],dx:0,dy:0,dispatch:L}),$))!=null)return Q=M.x-V[0]||0,ee=M.y-V[1]||0,function X(H,I,B){var P=V,z;switch(H){case"start":a[D]=X,z=c++;break;case"end":delete a[D],--c;case"drag":V=Mr(B||I,T),z=c;break}L.call(H,C,new ex(H,{sourceEvent:I,subject:M,target:y,identifier:D,active:z,x:V[0]+Q,y:V[1]+ee,dx:V[0]-P[0],dy:V[1]-P[1],dispatch:L}),$)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Vu(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:Vu(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:Vu(C),y):n},y.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:Vu(!!C),y):r},y.on=function(){var C=i.on.apply(i,arguments);return C===i?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function Ox(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function t2(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function wc(){}var rc=.7,Md=1/rc,Ci="\\s*([+-]?\\d+)\\s*",sc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",us="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",IO=/^#([0-9a-f]{3,8})$/,$O=new RegExp(`^rgb\\(${Ci},${Ci},${Ci}\\)$`),OO=new RegExp(`^rgb\\(${us},${us},${us}\\)$`),PO=new RegExp(`^rgba\\(${Ci},${Ci},${Ci},${sc}\\)$`),LO=new RegExp(`^rgba\\(${us},${us},${us},${sc}\\)$`),DO=new RegExp(`^hsl\\(${sc},${us},${us}\\)$`),qO=new RegExp(`^hsla\\(${sc},${us},${us},${sc}\\)$`),Mk={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};Ox(wc,ac,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ik,formatHex:Ik,formatHex8:FO,formatHsl:BO,formatRgb:$k,toString:$k});function Ik(){return this.rgb().formatHex()}function FO(){return this.rgb().formatHex8()}function BO(){return n2(this).formatHsl()}function $k(){return this.rgb().formatRgb()}function ac(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=IO.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Ok(t):n===3?new qn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ku(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ku(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=$O.exec(e))?new qn(t[1],t[2],t[3],1):(t=OO.exec(e))?new qn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=PO.exec(e))?Ku(t[1],t[2],t[3],t[4]):(t=LO.exec(e))?Ku(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=DO.exec(e))?Dk(t[1],t[2]/100,t[3]/100,1):(t=qO.exec(e))?Dk(t[1],t[2]/100,t[3]/100,t[4]):Mk.hasOwnProperty(e)?Ok(Mk[e]):e==="transparent"?new qn(NaN,NaN,NaN,0):null}function Ok(e){return new qn(e>>16&255,e>>8&255,e&255,1)}function Ku(e,t,n,r){return r<=0&&(e=t=n=NaN),new qn(e,t,n,r)}function zO(e){return e instanceof wc||(e=ac(e)),e?(e=e.rgb(),new qn(e.r,e.g,e.b,e.opacity)):new qn}function tx(e,t,n,r){return arguments.length===1?zO(e):new qn(e,t,n,r??1)}function qn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ox(qn,tx,t2(wc,{brighter(e){return e=e==null?Md:Math.pow(Md,e),new qn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?rc:Math.pow(rc,e),new qn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new qn(uo(this.r),uo(this.g),uo(this.b),Id(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:Pk,formatHex:Pk,formatHex8:UO,formatRgb:Lk,toString:Lk}));function Pk(){return`#${lo(this.r)}${lo(this.g)}${lo(this.b)}`}function UO(){return`#${lo(this.r)}${lo(this.g)}${lo(this.b)}${lo((isNaN(this.opacity)?1:this.opacity)*255)}`}function Lk(){const e=Id(this.opacity);return`${e===1?"rgb(":"rgba("}${uo(this.r)}, ${uo(this.g)}, ${uo(this.b)}${e===1?")":`, ${e})`}`}function Id(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function uo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function lo(e){return e=uo(e),(e<16?"0":"")+e.toString(16)}function Dk(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new $r(e,t,n,r)}function n2(e){if(e instanceof $r)return new $r(e.h,e.s,e.l,e.opacity);if(e instanceof wc||(e=ac(e)),!e)return new $r;if(e instanceof $r)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),c=NaN,u=i-a,f=(i+a)/2;return u?(t===i?c=(n-r)/u+(n<r)*6:n===i?c=(r-t)/u+2:c=(t-n)/u+4,u/=f<.5?i+a:2-i-a,c*=60):u=f>0&&f<1?0:c,new $r(c,u,f,e.opacity)}function WO(e,t,n,r){return arguments.length===1?n2(e):new $r(e,t,n,r??1)}function $r(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ox($r,WO,t2(wc,{brighter(e){return e=e==null?Md:Math.pow(Md,e),new $r(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?rc:Math.pow(rc,e),new $r(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new qn(cp(e>=240?e-240:e+120,a,r),cp(e,a,r),cp(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new $r(qk(this.h),Yu(this.s),Yu(this.l),Id(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=Id(this.opacity);return`${e===1?"hsl(":"hsla("}${qk(this.h)}, ${Yu(this.s)*100}%, ${Yu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function qk(e){return e=(e||0)%360,e<0?e+360:e}function Yu(e){return Math.max(0,Math.min(1,e||0))}function cp(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 r2=e=>()=>e;function HO(e,t){return function(n){return e+n*t}}function GO(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function VO(e){return(e=+e)==1?s2:function(t,n){return n-t?GO(t,n,e):r2(isNaN(t)?n:t)}}function s2(e,t){var n=t-e;return n?HO(e,n):r2(isNaN(e)?t:e)}const Fk=(function e(t){var n=VO(t);function r(a,i){var c=n((a=tx(a)).r,(i=tx(i)).r),u=n(a.g,i.g),f=n(a.b,i.b),p=s2(a.opacity,i.opacity);return function(h){return a.r=c(h),a.g=u(h),a.b=f(h),a.opacity=p(h),a+""}}return r.gamma=e,r})(1);function xa(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var nx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,up=new RegExp(nx.source,"g");function KO(e){return function(){return e}}function YO(e){return function(t){return e(t)+""}}function XO(e,t){var n=nx.lastIndex=up.lastIndex=0,r,a,i,c=-1,u=[],f=[];for(e=e+"",t=t+"";(r=nx.exec(e))&&(a=up.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),u[c]?u[c]+=i:u[++c]=i),(r=r[0])===(a=a[0])?u[c]?u[c]+=a:u[++c]=a:(u[++c]=null,f.push({i:c,x:xa(r,a)})),n=up.lastIndex;return n<t.length&&(i=t.slice(n),u[c]?u[c]+=i:u[++c]=i),u.length<2?f[0]?YO(f[0].x):KO(t):(t=f.length,function(p){for(var h=0,m;h<t;++h)u[(m=f[h]).i]=m.x(p);return u.join("")})}var Bk=180/Math.PI,rx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function a2(e,t,n,r,a,i){var c,u,f;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(f=e*n+t*r)&&(n-=e*f,r-=t*f),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,f/=u),e*r<t*n&&(e=-e,t=-t,f=-f,c=-c),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*Bk,skewX:Math.atan(f)*Bk,scaleX:c,scaleY:u}}var Xu;function ZO(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?rx:a2(t.a,t.b,t.c,t.d,t.e,t.f)}function QO(e){return e==null||(Xu||(Xu=document.createElementNS("http://www.w3.org/2000/svg","g")),Xu.setAttribute("transform",e),!(e=Xu.transform.baseVal.consolidate()))?rx:(e=e.matrix,a2(e.a,e.b,e.c,e.d,e.e,e.f))}function o2(e,t,n,r){function a(p){return p.length?p.pop()+" ":""}function i(p,h,m,y,w,N){if(p!==m||h!==y){var _=w.push("translate(",null,t,null,n);N.push({i:_-4,x:xa(p,m)},{i:_-2,x:xa(h,y)})}else(m||y)&&w.push("translate("+m+t+y+n)}function c(p,h,m,y){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),y.push({i:m.push(a(m)+"rotate(",null,r)-2,x:xa(p,h)})):h&&m.push(a(m)+"rotate("+h+r)}function u(p,h,m,y){p!==h?y.push({i:m.push(a(m)+"skewX(",null,r)-2,x:xa(p,h)}):h&&m.push(a(m)+"skewX("+h+r)}function f(p,h,m,y,w,N){if(p!==m||h!==y){var _=w.push(a(w)+"scale(",null,",",null,")");N.push({i:_-4,x:xa(p,m)},{i:_-2,x:xa(h,y)})}else(m!==1||y!==1)&&w.push(a(w)+"scale("+m+","+y+")")}return function(p,h){var m=[],y=[];return p=e(p),h=e(h),i(p.translateX,p.translateY,h.translateX,h.translateY,m,y),c(p.rotate,h.rotate,m,y),u(p.skewX,h.skewX,m,y),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,m,y),p=h=null,function(w){for(var N=-1,_=y.length,S;++N<_;)m[(S=y[N]).i]=S.x(w);return m.join("")}}}var JO=o2(ZO,"px, ","px)","deg)"),e3=o2(QO,", ",")",")"),t3=1e-12;function zk(e){return((e=Math.exp(e))+1/e)/2}function n3(e){return((e=Math.exp(e))-1/e)/2}function r3(e){return((e=Math.exp(2*e))-1)/(e+1)}const s3=(function e(t,n,r){function a(i,c){var u=i[0],f=i[1],p=i[2],h=c[0],m=c[1],y=c[2],w=h-u,N=m-f,_=w*w+N*N,S,b;if(_<t3)b=Math.log(y/p)/t,S=function($){return[u+$*w,f+$*N,p*Math.exp(t*$*b)]};else{var j=Math.sqrt(_),E=(y*y-p*p+r*_)/(2*p*n*j),C=(y*y-p*p-r*_)/(2*y*n*j),T=Math.log(Math.sqrt(E*E+1)-E),R=Math.log(Math.sqrt(C*C+1)-C);b=(R-T)/t,S=function($){var D=$*b,W=zk(T),L=p/(n*j)*(W*r3(t*D+T)-n3(T));return[u+L*w,f+L*N,p*W/zk(t*D+T)]}}return S.duration=b*1e3*t/Math.SQRT2,S}return a.rho=function(i){var c=Math.max(.001,+i),u=c*c,f=u*u;return e(c,u,f)},a})(Math.SQRT2,2,4);var Ii=0,Vl=0,Dl=0,i2=1e3,$d,Kl,Od=0,fo=0,sh=0,oc=typeof performance=="object"&&performance.now?performance:Date,l2=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Px(){return fo||(l2(a3),fo=oc.now()+sh)}function a3(){fo=0}function Pd(){this._call=this._time=this._next=null}Pd.prototype=c2.prototype={constructor:Pd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Px():+n)+(t==null?0:+t),!this._next&&Kl!==this&&(Kl?Kl._next=this:$d=this,Kl=this),this._call=e,this._time=n,sx()},stop:function(){this._call&&(this._call=null,this._time=1/0,sx())}};function c2(e,t,n){var r=new Pd;return r.restart(e,t,n),r}function o3(){Px(),++Ii;for(var e=$d,t;e;)(t=fo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ii}function Uk(){fo=(Od=oc.now())+sh,Ii=Vl=0;try{o3()}finally{Ii=0,l3(),fo=0}}function i3(){var e=oc.now(),t=e-Od;t>i2&&(sh-=t,Od=e)}function l3(){for(var e,t=$d,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:$d=n);Kl=e,sx(r)}function sx(e){if(!Ii){Vl&&(Vl=clearTimeout(Vl));var t=e-fo;t>24?(e<1/0&&(Vl=setTimeout(Uk,e-oc.now()-sh)),Dl&&(Dl=clearInterval(Dl))):(Dl||(Od=oc.now(),Dl=setInterval(i3,i2)),Ii=1,l2(Uk))}}function Wk(e,t,n){var r=new Pd;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var c3=nh("start","end","cancel","interrupt"),u3=[],u2=0,Hk=1,ax=2,xd=3,Gk=4,ox=5,bd=6;function ah(e,t,n,r,a,i){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;d3(e,n,{name:t,index:r,group:a,on:c3,tween:u3,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:u2})}function Lx(e,t){var n=qr(e,t);if(n.state>u2)throw new Error("too late; already scheduled");return n}function fs(e,t){var n=qr(e,t);if(n.state>xd)throw new Error("too late; already running");return n}function qr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function d3(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=c2(i,0,n.time);function i(p){n.state=Hk,n.timer.restart(c,n.delay,n.time),n.delay<=p&&c(p-n.delay)}function c(p){var h,m,y,w;if(n.state!==Hk)return f();for(h in r)if(w=r[h],w.name===n.name){if(w.state===xd)return Wk(c);w.state===Gk?(w.state=bd,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete r[h]):+h<t&&(w.state=bd,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete r[h])}if(Wk(function(){n.state===xd&&(n.state=Gk,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=ax,n.on.call("start",e,e.__data__,n.index,n.group),n.state===ax){for(n.state=xd,a=new Array(y=n.tween.length),h=0,m=-1;h<y;++h)(w=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(a[++m]=w);a.length=m+1}}function u(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=ox,1),m=-1,y=a.length;++m<y;)a[m].call(e,h);n.state===ox&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=bd,n.timer.stop(),delete r[t];for(var p in r)return;delete e.__transition}}function kd(e,t){var n=e.__transition,r,a,i=!0,c;if(n){t=t==null?null:t+"";for(c in n){if((r=n[c]).name!==t){i=!1;continue}a=r.state>ax&&r.state<ox,r.state=bd,r.timer.stop(),r.on.call(a?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[c]}i&&delete e.__transition}}function h3(e){return this.each(function(){kd(this,e)})}function f3(e,t){var n,r;return function(){var a=fs(this,e),i=a.tween;if(i!==n){r=n=i;for(var c=0,u=r.length;c<u;++c)if(r[c].name===t){r=r.slice(),r.splice(c,1);break}}a.tween=r}}function p3(e,t,n){var r,a;if(typeof n!="function")throw new Error;return function(){var i=fs(this,e),c=i.tween;if(c!==r){a=(r=c).slice();for(var u={name:t,value:n},f=0,p=a.length;f<p;++f)if(a[f].name===t){a[f]=u;break}f===p&&a.push(u)}i.tween=a}}function m3(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=qr(this.node(),n).tween,a=0,i=r.length,c;a<i;++a)if((c=r[a]).name===e)return c.value;return null}return this.each((t==null?f3:p3)(n,e,t))}function Dx(e,t,n){var r=e._id;return e.each(function(){var a=fs(this,r);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return qr(a,r).value[t]}}function d2(e,t){var n;return(typeof t=="number"?xa:t instanceof ac?Fk:(n=ac(t))?(t=n,Fk):XO)(e,t)}function g3(e){return function(){this.removeAttribute(e)}}function y3(e){return function(){this.removeAttributeNS(e.space,e.local)}}function w3(e,t,n){var r,a=n+"",i;return function(){var c=this.getAttribute(e);return c===a?null:c===r?i:i=t(r=c,n)}}function v3(e,t,n){var r,a=n+"",i;return function(){var c=this.getAttributeNS(e.space,e.local);return c===a?null:c===r?i:i=t(r=c,n)}}function x3(e,t,n){var r,a,i;return function(){var c,u=n(this),f;return u==null?void this.removeAttribute(e):(c=this.getAttribute(e),f=u+"",c===f?null:c===r&&f===a?i:(a=f,i=t(r=c,u)))}}function b3(e,t,n){var r,a,i;return function(){var c,u=n(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),f=u+"",c===f?null:c===r&&f===a?i:(a=f,i=t(r=c,u)))}}function k3(e,t){var n=rh(e),r=n==="transform"?e3:d2;return this.attrTween(e,typeof t=="function"?(n.local?b3:x3)(n,r,Dx(this,"attr."+e,t)):t==null?(n.local?y3:g3)(n):(n.local?v3:w3)(n,r,t))}function _3(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function N3(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function S3(e,t){var n,r;function a(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&N3(e,i)),n}return a._value=t,a}function j3(e,t){var n,r;function a(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&_3(e,i)),n}return a._value=t,a}function E3(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=rh(e);return this.tween(n,(r.local?S3:j3)(r,t))}function C3(e,t){return function(){Lx(this,e).delay=+t.apply(this,arguments)}}function T3(e,t){return t=+t,function(){Lx(this,e).delay=t}}function A3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?C3:T3)(t,e)):qr(this.node(),t).delay}function R3(e,t){return function(){fs(this,e).duration=+t.apply(this,arguments)}}function M3(e,t){return t=+t,function(){fs(this,e).duration=t}}function I3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?R3:M3)(t,e)):qr(this.node(),t).duration}function $3(e,t){if(typeof t!="function")throw new Error;return function(){fs(this,e).ease=t}}function O3(e){var t=this._id;return arguments.length?this.each($3(t,e)):qr(this.node(),t).ease}function P3(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;fs(this,e).ease=n}}function L3(e){if(typeof e!="function")throw new Error;return this.each(P3(this._id,e))}function D3(e){typeof e!="function"&&(e=UT(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i=t[a],c=i.length,u=r[a]=[],f,p=0;p<c;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&u.push(f);return new qs(r,this._parents,this._name,this._id)}function q3(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,a=n.length,i=Math.min(r,a),c=new Array(r),u=0;u<i;++u)for(var f=t[u],p=n[u],h=f.length,m=c[u]=new Array(h),y,w=0;w<h;++w)(y=f[w]||p[w])&&(m[w]=y);for(;u<r;++u)c[u]=t[u];return new qs(c,this._parents,this._name,this._id)}function F3(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 B3(e,t,n){var r,a,i=F3(t)?Lx:fs;return function(){var c=i(this,e),u=c.on;u!==r&&(a=(r=u).copy()).on(t,n),c.on=a}}function z3(e,t){var n=this._id;return arguments.length<2?qr(this.node(),n).on.on(e):this.each(B3(n,e,t))}function U3(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function W3(){return this.on("end.remove",U3(this._id))}function H3(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ix(e));for(var r=this._groups,a=r.length,i=new Array(a),c=0;c<a;++c)for(var u=r[c],f=u.length,p=i[c]=new Array(f),h,m,y=0;y<f;++y)(h=u[y])&&(m=e.call(h,h.__data__,y,u))&&("__data__"in h&&(m.__data__=h.__data__),p[y]=m,ah(p[y],t,n,y,p,qr(h,n)));return new qs(i,this._parents,t,n)}function G3(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zT(e));for(var r=this._groups,a=r.length,i=[],c=[],u=0;u<a;++u)for(var f=r[u],p=f.length,h,m=0;m<p;++m)if(h=f[m]){for(var y=e.call(h,h.__data__,m,f),w,N=qr(h,n),_=0,S=y.length;_<S;++_)(w=y[_])&&ah(w,t,n,_,y,N);i.push(y),c.push(h)}return new qs(i,c,t,n)}var V3=yc.prototype.constructor;function K3(){return new V3(this._groups,this._parents)}function Y3(e,t){var n,r,a;return function(){var i=Mi(this,e),c=(this.style.removeProperty(e),Mi(this,e));return i===c?null:i===n&&c===r?a:a=t(n=i,r=c)}}function h2(e){return function(){this.style.removeProperty(e)}}function X3(e,t,n){var r,a=n+"",i;return function(){var c=Mi(this,e);return c===a?null:c===r?i:i=t(r=c,n)}}function Z3(e,t,n){var r,a,i;return function(){var c=Mi(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),Mi(this,e))),c===f?null:c===r&&f===a?i:(a=f,i=t(r=c,u))}}function Q3(e,t){var n,r,a,i="style."+t,c="end."+i,u;return function(){var f=fs(this,e),p=f.on,h=f.value[i]==null?u||(u=h2(t)):void 0;(p!==n||a!==h)&&(r=(n=p).copy()).on(c,a=h),f.on=r}}function J3(e,t,n){var r=(e+="")=="transform"?JO:d2;return t==null?this.styleTween(e,Y3(e,r)).on("end.style."+e,h2(e)):typeof t=="function"?this.styleTween(e,Z3(e,r,Dx(this,"style."+e,t))).each(Q3(this._id,e)):this.styleTween(e,X3(e,r,t),n).on("end.style."+e,null)}function eP(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function tP(e,t,n){var r,a;function i(){var c=t.apply(this,arguments);return c!==a&&(r=(a=c)&&eP(e,c,n)),r}return i._value=t,i}function nP(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,tP(e,t,n??""))}function rP(e){return function(){this.textContent=e}}function sP(e){return function(){var t=e(this);this.textContent=t??""}}function aP(e){return this.tween("text",typeof e=="function"?sP(Dx(this,"text",e)):rP(e==null?"":e+""))}function oP(e){return function(t){this.textContent=e.call(this,t)}}function iP(e){var t,n;function r(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&oP(a)),t}return r._value=e,r}function lP(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,iP(e))}function cP(){for(var e=this._name,t=this._id,n=f2(),r=this._groups,a=r.length,i=0;i<a;++i)for(var c=r[i],u=c.length,f,p=0;p<u;++p)if(f=c[p]){var h=qr(f,t);ah(f,e,n,p,c,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new qs(r,this._parents,e,n)}function uP(){var e,t,n=this,r=n._id,a=n.size();return new Promise(function(i,c){var u={value:c},f={value:function(){--a===0&&i()}};n.each(function(){var p=fs(this,r),h=p.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),p.on=t}),a===0&&i()})}var dP=0;function qs(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function f2(){return++dP}var Os=yc.prototype;qs.prototype={constructor:qs,select:H3,selectAll:G3,selectChild:Os.selectChild,selectChildren:Os.selectChildren,filter:D3,merge:q3,selection:K3,transition:cP,call:Os.call,nodes:Os.nodes,node:Os.node,size:Os.size,empty:Os.empty,each:Os.each,on:z3,attr:k3,attrTween:E3,style:J3,styleTween:nP,text:aP,textTween:lP,remove:W3,tween:m3,delay:A3,duration:I3,ease:O3,easeVarying:L3,end:uP,[Symbol.iterator]:Os[Symbol.iterator]};function hP(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var fP={time:null,delay:0,duration:250,ease:hP};function pP(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 mP(e){var t,n;e instanceof qs?(t=e._id,e=e._name):(t=f2(),(n=fP).time=Px(),e=e==null?null:e+"");for(var r=this._groups,a=r.length,i=0;i<a;++i)for(var c=r[i],u=c.length,f,p=0;p<u;++p)(f=c[p])&&ah(f,e,t,p,c,n||pP(f,t));return new qs(r,this._parents,e,t)}yc.prototype.interrupt=h3;yc.prototype.transition=mP;const Zu=e=>()=>e;function gP(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:a}})}function Ps(e,t,n){this.k=e,this.x=t,this.y=n}Ps.prototype={constructor:Ps,scale:function(e){return e===1?this:new Ps(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ps(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ds=new Ps(1,0,0);Ps.prototype;function dp(e){e.stopImmediatePropagation()}function ql(e){e.preventDefault(),e.stopImmediatePropagation()}function yP(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function wP(){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 Vk(){return this.__zoom||Ds}function vP(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function xP(){return navigator.maxTouchPoints||"ontouchstart"in this}function bP(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),c>i?(i+c)/2:Math.min(0,i)||Math.max(0,c))}function p2(){var e=yP,t=wP,n=bP,r=vP,a=xP,i=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=s3,p=nh("start","zoom","end"),h,m,y,w=500,N=150,_=0,S=10;function b(M){M.property("__zoom",Vk).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",W).on("dblclick.zoom",L).filter(a).on("touchstart.zoom",V).on("touchmove.zoom",Q).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(M,X,H,I){var B=M.selection?M.selection():M;B.property("__zoom",Vk),M!==B?T(M,X,H,I):B.interrupt().each(function(){R(this,arguments).event(I).start().zoom(null,typeof X=="function"?X.apply(this,arguments):X).end()})},b.scaleBy=function(M,X,H,I){b.scaleTo(M,function(){var B=this.__zoom.k,P=typeof X=="function"?X.apply(this,arguments):X;return B*P},H,I)},b.scaleTo=function(M,X,H,I){b.transform(M,function(){var B=t.apply(this,arguments),P=this.__zoom,z=H==null?C(B):typeof H=="function"?H.apply(this,arguments):H,O=P.invert(z),K=typeof X=="function"?X.apply(this,arguments):X;return n(E(j(P,K),z,O),B,c)},H,I)},b.translateBy=function(M,X,H,I){b.transform(M,function(){return n(this.__zoom.translate(typeof X=="function"?X.apply(this,arguments):X,typeof H=="function"?H.apply(this,arguments):H),t.apply(this,arguments),c)},null,I)},b.translateTo=function(M,X,H,I,B){b.transform(M,function(){var P=t.apply(this,arguments),z=this.__zoom,O=I==null?C(P):typeof I=="function"?I.apply(this,arguments):I;return n(Ds.translate(O[0],O[1]).scale(z.k).translate(typeof X=="function"?-X.apply(this,arguments):-X,typeof H=="function"?-H.apply(this,arguments):-H),P,c)},I,B)};function j(M,X){return X=Math.max(i[0],Math.min(i[1],X)),X===M.k?M:new Ps(X,M.x,M.y)}function E(M,X,H){var I=X[0]-H[0]*M.k,B=X[1]-H[1]*M.k;return I===M.x&&B===M.y?M:new Ps(M.k,I,B)}function C(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function T(M,X,H,I){M.on("start.zoom",function(){R(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(I).end()}).tween("zoom",function(){var B=this,P=arguments,z=R(B,P).event(I),O=t.apply(B,P),K=H==null?C(O):typeof H=="function"?H.apply(B,P):H,de=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),G=B.__zoom,J=typeof X=="function"?X.apply(B,P):X,U=f(G.invert(K).concat(de/G.k),J.invert(K).concat(de/J.k));return function(ne){if(ne===1)ne=J;else{var ae=U(ne),pe=de/ae[2];ne=new Ps(pe,K[0]-ae[0]*pe,K[1]-ae[1]*pe)}z.zoom(null,ne)}})}function R(M,X,H){return!H&&M.__zooming||new $(M,X)}function $(M,X){this.that=M,this.args=X,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,X),this.taps=0}$.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,X){return this.mouse&&M!=="mouse"&&(this.mouse[1]=X.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=X.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=X.invert(this.touch1[0])),this.that.__zoom=X,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var X=dr(this.that).datum();p.call(M,this.that,new gP(M,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:p}),X)}};function D(M,...X){if(!e.apply(this,arguments))return;var H=R(this,X).event(M),I=this.__zoom,B=Math.max(i[0],Math.min(i[1],I.k*Math.pow(2,r.apply(this,arguments)))),P=Mr(M);if(H.wheel)(H.mouse[0][0]!==P[0]||H.mouse[0][1]!==P[1])&&(H.mouse[1]=I.invert(H.mouse[0]=P)),clearTimeout(H.wheel);else{if(I.k===B)return;H.mouse=[P,I.invert(P)],kd(this),H.start()}ql(M),H.wheel=setTimeout(z,N),H.zoom("mouse",n(E(j(I,B),H.mouse[0],H.mouse[1]),H.extent,c));function z(){H.wheel=null,H.end()}}function W(M,...X){if(y||!e.apply(this,arguments))return;var H=M.currentTarget,I=R(this,X,!0).event(M),B=dr(M.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",de,!0),P=Mr(M,H),z=M.clientX,O=M.clientY;JT(M.view),dp(M),I.mouse=[P,this.__zoom.invert(P)],kd(this),I.start();function K(G){if(ql(G),!I.moved){var J=G.clientX-z,U=G.clientY-O;I.moved=J*J+U*U>_}I.event(G).zoom("mouse",n(E(I.that.__zoom,I.mouse[0]=Mr(G,H),I.mouse[1]),I.extent,c))}function de(G){B.on("mousemove.zoom mouseup.zoom",null),e2(G.view,I.moved),ql(G),I.event(G).end()}}function L(M,...X){if(e.apply(this,arguments)){var H=this.__zoom,I=Mr(M.changedTouches?M.changedTouches[0]:M,this),B=H.invert(I),P=H.k*(M.shiftKey?.5:2),z=n(E(j(H,P),I,B),t.apply(this,X),c);ql(M),u>0?dr(this).transition().duration(u).call(T,z,I,M):dr(this).call(b.transform,z,I,M)}}function V(M,...X){if(e.apply(this,arguments)){var H=M.touches,I=H.length,B=R(this,X,M.changedTouches.length===I).event(M),P,z,O,K;for(dp(M),z=0;z<I;++z)O=H[z],K=Mr(O,this),K=[K,this.__zoom.invert(K),O.identifier],B.touch0?!B.touch1&&B.touch0[2]!==K[2]&&(B.touch1=K,B.taps=0):(B.touch0=K,P=!0,B.taps=1+!!h);h&&(h=clearTimeout(h)),P&&(B.taps<2&&(m=K[0],h=setTimeout(function(){h=null},w)),kd(this),B.start())}}function Q(M,...X){if(this.__zooming){var H=R(this,X).event(M),I=M.changedTouches,B=I.length,P,z,O,K;for(ql(M),P=0;P<B;++P)z=I[P],O=Mr(z,this),H.touch0&&H.touch0[2]===z.identifier?H.touch0[0]=O:H.touch1&&H.touch1[2]===z.identifier&&(H.touch1[0]=O);if(z=H.that.__zoom,H.touch1){var de=H.touch0[0],G=H.touch0[1],J=H.touch1[0],U=H.touch1[1],ne=(ne=J[0]-de[0])*ne+(ne=J[1]-de[1])*ne,ae=(ae=U[0]-G[0])*ae+(ae=U[1]-G[1])*ae;z=j(z,Math.sqrt(ne/ae)),O=[(de[0]+J[0])/2,(de[1]+J[1])/2],K=[(G[0]+U[0])/2,(G[1]+U[1])/2]}else if(H.touch0)O=H.touch0[0],K=H.touch0[1];else return;H.zoom("touch",n(E(z,O,K),H.extent,c))}}function ee(M,...X){if(this.__zooming){var H=R(this,X).event(M),I=M.changedTouches,B=I.length,P,z;for(dp(M),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),P=0;P<B;++P)z=I[P],H.touch0&&H.touch0[2]===z.identifier?delete H.touch0:H.touch1&&H.touch1[2]===z.identifier&&delete H.touch1;if(H.touch1&&!H.touch0&&(H.touch0=H.touch1,delete H.touch1),H.touch0)H.touch0[1]=this.__zoom.invert(H.touch0[0]);else if(H.end(),H.taps===2&&(z=Mr(z,this),Math.hypot(m[0]-z[0],m[1]-z[1])<S)){var O=dr(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return b.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:Zu(+M),b):r},b.filter=function(M){return arguments.length?(e=typeof M=="function"?M:Zu(!!M),b):e},b.touchable=function(M){return arguments.length?(a=typeof M=="function"?M:Zu(!!M),b):a},b.extent=function(M){return arguments.length?(t=typeof M=="function"?M:Zu([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),b):t},b.scaleExtent=function(M){return arguments.length?(i[0]=+M[0],i[1]=+M[1],b):[i[0],i[1]]},b.translateExtent=function(M){return arguments.length?(c[0][0]=+M[0][0],c[1][0]=+M[1][0],c[0][1]=+M[0][1],c[1][1]=+M[1][1],b):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},b.constrain=function(M){return arguments.length?(n=M,b):n},b.duration=function(M){return arguments.length?(u=+M,b):u},b.interpolate=function(M){return arguments.length?(f=M,b):f},b.on=function(){var M=p.on.apply(p,arguments);return M===p?b:M},b.clickDistance=function(M){return arguments.length?(_=(M=+M)*M,b):Math.sqrt(_)},b.tapDistance=function(M){return arguments.length?(S=+M,b):S},b}var pr=DT();const oh=x.createContext(null),kP=oh.Provider,Fs={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.`},m2=Fs.error001();function gt(e,t){const n=x.useContext(oh);if(n===null)throw new Error(m2);return FT(n,e,t)}const zt=()=>{const e=x.useContext(oh);if(e===null)throw new Error(m2);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},_P=e=>e.userSelectionActive?"none":"all";function qx({position:e,children:t,className:n,style:r,...a}){const i=gt(_P),c=`${e}`.split("-");return me.createElement("div",{className:hn(["react-flow__panel",n,...c]),style:{...r,pointerEvents:i},...a},t)}function NP({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:me.createElement(qx,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},me.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const SP=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:a=!0,labelBgStyle:i={},labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:f,className:p,...h})=>{const m=x.useRef(null),[y,w]=x.useState({x:0,y:0,width:0,height:0}),N=hn(["react-flow__edge-textwrapper",p]);return x.useEffect(()=>{if(m.current){const _=m.current.getBBox();w({x:_.x,y:_.y,width:_.width,height:_.height})}},[n]),typeof n>"u"||!n?null:me.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...h},a&&me.createElement("rect",{width:y.width+2*c[0],x:-c[0],y:-c[1],height:y.height+2*c[1],className:"react-flow__edge-textbg",style:i,rx:u,ry:u}),me.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:r},n),f)};var jP=x.memo(SP);const Fx=e=>({width:e.offsetWidth,height:e.offsetHeight}),$i=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Bx=(e={x:0,y:0},t)=>({x:$i(e.x,t[0][0],t[1][0]),y:$i(e.y,t[0][1],t[1][1])}),Kk=(e,t,n)=>e<t?$i(Math.abs(e-t),1,50)/50:e>n?-$i(Math.abs(e-n),1,50)/50:0,g2=(e,t)=>{const n=Kk(e.x,35,t.width-35)*20,r=Kk(e.y,35,t.height-35)*20;return[n,r]},y2=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},w2=(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)}),ic=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),v2=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Yk=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),EP=(e,t)=>v2(w2(ic(e),ic(t))),ix=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},CP=e=>hr(e.width)&&hr(e.height)&&hr(e.x)&&hr(e.y),hr=e=>!isNaN(e)&&isFinite(e),Pt=Symbol.for("internals"),x2=["Enter"," ","Escape"],TP=(e,t)=>{},AP=e=>"nativeEvent"in e;function lx(e){var a,i;const t=AP(e)?e.nativeEvent:e,n=((i=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const b2=e=>"clientX"in e,ja=(e,t)=>{var i,c;const n=b2(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,a=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},Ld=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},vc=({id:e,path:t,labelX:n,labelY:r,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w=20})=>me.createElement(me.Fragment,null,me.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&me.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),a&&hr(n)&&hr(r)?me.createElement(jP,{x:n,y:r,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);vc.displayName="BaseEdge";function Fl(e,t,n){return n===void 0?n:r=>{const a=t().edges.find(i=>i.id===e);a&&n(r,{...a})}}function k2({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,i=n<e?n+a:n-a,c=Math.abs(r-t)/2,u=r<t?r+c:r-c;return[i,u,a,c]}function _2({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:i,targetControlX:c,targetControlY:u}){const f=e*.125+a*.375+c*.375+n*.125,p=t*.125+i*.375+u*.375+r*.125,h=Math.abs(f-e),m=Math.abs(p-t);return[f,p,h,m]}var po;(function(e){e.Strict="strict",e.Loose="loose"})(po||(po={}));var co;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(co||(co={}));var lc;(function(e){e.Partial="partial",e.Full="full"})(lc||(lc={}));var ka;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ka||(ka={}));var Dd;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Dd||(Dd={}));var Ue;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ue||(Ue={}));function Xk({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===Ue.Left||e===Ue.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function N2({sourceX:e,sourceY:t,sourcePosition:n=Ue.Bottom,targetX:r,targetY:a,targetPosition:i=Ue.Top}){const[c,u]=Xk({pos:n,x1:e,y1:t,x2:r,y2:a}),[f,p]=Xk({pos:i,x1:r,y1:a,x2:e,y2:t}),[h,m,y,w]=_2({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${c},${u} ${f},${p} ${r},${a}`,h,m,y,w]}const zx=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a=Ue.Bottom,targetPosition:i=Ue.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})=>{const[S,b,j]=N2({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:i});return me.createElement(vc,{path:S,labelX:b,labelY:j,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})});zx.displayName="SimpleBezierEdge";const Zk={[Ue.Left]:{x:-1,y:0},[Ue.Right]:{x:1,y:0},[Ue.Top]:{x:0,y:-1},[Ue.Bottom]:{x:0,y:1}},RP=({source:e,sourcePosition:t=Ue.Bottom,target:n})=>t===Ue.Left||t===Ue.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},Qk=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function MP({source:e,sourcePosition:t=Ue.Bottom,target:n,targetPosition:r=Ue.Top,center:a,offset:i}){const c=Zk[t],u=Zk[r],f={x:e.x+c.x*i,y:e.y+c.y*i},p={x:n.x+u.x*i,y:n.y+u.y*i},h=RP({source:f,sourcePosition:t,target:p}),m=h.x!==0?"x":"y",y=h[m];let w=[],N,_;const S={x:0,y:0},b={x:0,y:0},[j,E,C,T]=k2({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[m]*u[m]===-1){N=a.x??j,_=a.y??E;const $=[{x:N,y:f.y},{x:N,y:p.y}],D=[{x:f.x,y:_},{x:p.x,y:_}];c[m]===y?w=m==="x"?$:D:w=m==="x"?D:$}else{const $=[{x:f.x,y:p.y}],D=[{x:p.x,y:f.y}];if(m==="x"?w=c.x===y?D:$:w=c.y===y?$:D,t===r){const ee=Math.abs(e[m]-n[m]);if(ee<=i){const M=Math.min(i-1,i-ee);c[m]===y?S[m]=(f[m]>e[m]?-1:1)*M:b[m]=(p[m]>n[m]?-1:1)*M}}if(t!==r){const ee=m==="x"?"y":"x",M=c[m]===u[ee],X=f[ee]>p[ee],H=f[ee]<p[ee];(c[m]===1&&(!M&&X||M&&H)||c[m]!==1&&(!M&&H||M&&X))&&(w=m==="x"?$:D)}const W={x:f.x+S.x,y:f.y+S.y},L={x:p.x+b.x,y:p.y+b.y},V=Math.max(Math.abs(W.x-w[0].x),Math.abs(L.x-w[0].x)),Q=Math.max(Math.abs(W.y-w[0].y),Math.abs(L.y-w[0].y));V>=Q?(N=(W.x+L.x)/2,_=w[0].y):(N=w[0].x,_=(W.y+L.y)/2)}return[[e,{x:f.x+S.x,y:f.y+S.y},...w,{x:p.x+b.x,y:p.y+b.y},n],N,_,C,T]}function IP(e,t,n,r){const a=Math.min(Qk(e,t)/2,Qk(t,n)/2,r),{x:i,y:c}=t;if(e.x===i&&i===n.x||e.y===c&&c===n.y)return`L${i} ${c}`;if(e.y===c){const p=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${i+a*p},${c}Q ${i},${c} ${i},${c+a*h}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${i},${c+a*f}Q ${i},${c} ${i+a*u},${c}`}function cx({sourceX:e,sourceY:t,sourcePosition:n=Ue.Bottom,targetX:r,targetY:a,targetPosition:i=Ue.Top,borderRadius:c=5,centerX:u,centerY:f,offset:p=20}){const[h,m,y,w,N]=MP({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:a},targetPosition:i,center:{x:u,y:f},offset:p});return[h.reduce((S,b,j)=>{let E="";return j>0&&j<h.length-1?E=IP(h[j-1],b,h[j+1],c):E=`${j===0?"M":"L"}${b.x} ${b.y}`,S+=E,S},""),m,y,w,N]}const ih=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:m=Ue.Bottom,targetPosition:y=Ue.Top,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[b,j,E]=cx({sourceX:e,sourceY:t,sourcePosition:m,targetX:n,targetY:r,targetPosition:y,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return me.createElement(vc,{path:b,labelX:j,labelY:E,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:N,interactionWidth:S})});ih.displayName="SmoothStepEdge";const Ux=x.memo(e=>{var t;return me.createElement(ih,{...e,pathOptions:x.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Ux.displayName="StepEdge";function $P({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,i,c,u]=k2({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,i,c,u]}const Wx=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[N,_,S]=$P({sourceX:e,sourceY:t,targetX:n,targetY:r});return me.createElement(vc,{path:N,labelX:_,labelY:S,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})});Wx.displayName="StraightEdge";function Qu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Jk({pos:e,x1:t,y1:n,x2:r,y2:a,c:i}){switch(e){case Ue.Left:return[t-Qu(t-r,i),n];case Ue.Right:return[t+Qu(r-t,i),n];case Ue.Top:return[t,n-Qu(n-a,i)];case Ue.Bottom:return[t,n+Qu(a-n,i)]}}function Hx({sourceX:e,sourceY:t,sourcePosition:n=Ue.Bottom,targetX:r,targetY:a,targetPosition:i=Ue.Top,curvature:c=.25}){const[u,f]=Jk({pos:n,x1:e,y1:t,x2:r,y2:a,c}),[p,h]=Jk({pos:i,x1:r,y1:a,x2:e,y2:t,c}),[m,y,w,N]=_2({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:u,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${u},${f} ${p},${h} ${r},${a}`,m,y,w,N]}const qd=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a=Ue.Bottom,targetPosition:i=Ue.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[b,j,E]=Hx({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:i,curvature:_==null?void 0:_.curvature});return me.createElement(vc,{path:b,labelX:j,labelY:E,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:S})});qd.displayName="BezierEdge";const Gx=x.createContext(null),OP=Gx.Provider;Gx.Consumer;const PP=()=>x.useContext(Gx),LP=e=>"id"in e&&"source"in e&&"target"in e,DP=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,ux=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,qP=(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)),FP=(e,t)=>{if(!e.source||!e.target)return t;let n;return LP(e)?n={...e}:n={...e,id:DP(e)},qP(n,t)?t:t.concat(n)},dx=({x:e,y:t},[n,r,a],i,[c,u])=>{const f={x:(e-n)/a,y:(t-r)/a};return i?{x:c*Math.round(f.x/c),y:u*Math.round(f.y/u)}:f},S2=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r}),ho=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],a={x:e.position.x-n,y:e.position.y-r};return{...a,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:a}},lh=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const{x:i,y:c}=ho(a,t).positionAbsolute;return w2(r,ic({x:i,y:c,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return v2(n)},j2=(e,t,[n,r,a]=[0,0,1],i=!1,c=!1,u=[0,0])=>{const f={x:(t.x-n)/a,y:(t.y-r)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(h=>{const{width:m,height:y,selectable:w=!0,hidden:N=!1}=h;if(c&&!w||N)return!1;const{positionAbsolute:_}=ho(h,u),S={x:_.x,y:_.y,width:m||0,height:y||0},b=ix(f,S),j=typeof m>"u"||typeof y>"u"||m===null||y===null,E=i&&b>0,C=(m||0)*(y||0);(j||E||b>=C||h.dragging)&&p.push(h)}),p},E2=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},C2=(e,t,n,r,a,i=.1)=>{const c=t/(e.width*(1+i)),u=n/(e.height*(1+i)),f=Math.min(c,u),p=$i(f,r,a),h=e.x+e.width/2,m=e.y+e.height/2,y=t/2-h*p,w=n/2-m*p;return{x:y,y:w,zoom:p}},io=(e,t=0)=>e.transition().duration(t);function e1(e,t,n,r){return(t[n]||[]).reduce((a,i)=>{var c,u;return`${e.id}-${i.id}-${n}`!==r&&a.push({id:i.id||null,type:n,nodeId:e.id,x:(((c=e.positionAbsolute)==null?void 0:c.x)??0)+i.x+i.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+i.y+i.height/2}),a},[])}function BP(e,t,n,r,a,i){const{x:c,y:u}=ja(e),p=t.elementsFromPoint(c,u).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const _=Vx(void 0,p),S=p.getAttribute("data-handleid"),b=i({nodeId:N,id:S,type:_});if(b){const j=a.find(E=>E.nodeId===N&&E.type===_&&E.id===S);return{handle:{id:S,type:_,nodeId:N,x:(j==null?void 0:j.x)||n.x,y:(j==null?void 0:j.y)||n.y},validHandleResult:b}}}}let h=[],m=1/0;if(a.forEach(N=>{const _=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(_<=r){const S=i(N);_<=m&&(_<m?h=[{handle:N,validHandleResult:S}]:_===m&&h.push({handle:N,validHandleResult:S}),m=_)}}),!h.length)return{handle:null,validHandleResult:T2()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:N})=>N.isValid),w=h.some(({handle:N})=>N.type==="target");return h.find(({handle:N,validHandleResult:_})=>w?N.type==="target":y?_.isValid:!0)||h[0]}const zP={source:null,target:null,sourceHandle:null,targetHandle:null},T2=()=>({handleDomNode:null,isValid:!1,connection:zP,endHandle:null});function A2(e,t,n,r,a,i,c){const u=a==="target",f=c.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...T2(),handleDomNode:f};if(f){const h=Vx(void 0,f),m=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),N=f.classList.contains("connectableend"),_={source:u?m:n,sourceHandle:u?y:r,target:u?n:m,targetHandle:u?r:y};p.connection=_,w&&N&&(t===po.Strict?u&&h==="source"||!u&&h==="target":m!==n||y!==r)&&(p.endHandle={nodeId:m,handleId:y,type:h},p.isValid=i(_))}return p}function UP({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((a,i)=>{if(i[Pt]){const{handleBounds:c}=i[Pt];let u=[],f=[];c&&(u=e1(i,c,"source",`${t}-${n}-${r}`),f=e1(i,c,"target",`${t}-${n}-${r}`)),a.push(...u,...f)}return a},[])}function Vx(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function hp(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function WP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function R2({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:a,getState:i,setState:c,isValidConnection:u,edgeUpdaterType:f,onReconnectEnd:p}){const h=y2(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:_,panBy:S,getNodes:b,cancelConnection:j}=i();let E=0,C;const{x:T,y:R}=ja(e),$=h==null?void 0:h.elementFromPoint(T,R),D=Vx(f,$),W=y==null?void 0:y.getBoundingClientRect();if(!W||!D)return;let L,V=ja(e,W),Q=!1,ee=null,M=!1,X=null;const H=UP({nodes:b(),nodeId:n,handleId:t,handleType:D}),I=()=>{if(!w)return;const[z,O]=g2(V,W);S({x:z,y:O}),E=requestAnimationFrame(I)};c({connectionPosition:V,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:D,connectionStartHandle:{nodeId:n,handleId:t,type:D},connectionEndHandle:null}),_==null||_(e,{nodeId:n,handleId:t,handleType:D});function B(z){const{transform:O}=i();V=ja(z,W);const{handle:K,validHandleResult:de}=BP(z,h,dx(V,O,!1,[1,1]),N,H,G=>A2(G,m,n,t,a?"target":"source",u,h));if(C=K,Q||(I(),Q=!0),X=de.handleDomNode,ee=de.connection,M=de.isValid,c({connectionPosition:C&&M?S2({x:C.x,y:C.y},O):V,connectionStatus:WP(!!C,M),connectionEndHandle:de.endHandle}),!C&&!M&&!X)return hp(L);ee.source!==ee.target&&X&&(hp(L),L=X,X.classList.add("connecting","react-flow__handle-connecting"),X.classList.toggle("valid",M),X.classList.toggle("react-flow__handle-valid",M))}function P(z){var O,K;(C||X)&&ee&&M&&(r==null||r(ee)),(K=(O=i()).onConnectEnd)==null||K.call(O,z),f&&(p==null||p(z)),hp(L),j(),cancelAnimationFrame(E),Q=!1,M=!1,ee=null,X=null,h.removeEventListener("mousemove",B),h.removeEventListener("mouseup",P),h.removeEventListener("touchmove",B),h.removeEventListener("touchend",P)}h.addEventListener("mousemove",B),h.addEventListener("mouseup",P),h.addEventListener("touchmove",B),h.addEventListener("touchend",P)}const t1=()=>!0,HP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),GP=(e,t,n)=>r=>{const{connectionStartHandle:a,connectionEndHandle:i,connectionClickStartHandle:c}=r;return{connecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.handleId)===t&&(c==null?void 0:c.type)===n}},M2=x.forwardRef(({type:e="source",position:t=Ue.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:c,onConnect:u,children:f,className:p,onMouseDown:h,onTouchStart:m,...y},w)=>{var W,L;const N=c||null,_=e==="target",S=zt(),b=PP(),{connectOnClick:j,noPanClassName:E}=gt(HP,Yt),{connecting:C,clickConnecting:T}=gt(GP(b,N,e),Yt);b||(L=(W=S.getState()).onError)==null||L.call(W,"010",Fs.error010());const R=V=>{const{defaultEdgeOptions:Q,onConnect:ee,hasDefaultEdges:M}=S.getState(),X={...Q,...V};if(M){const{edges:H,setEdges:I}=S.getState();I(FP(X,H))}ee==null||ee(X),u==null||u(X)},$=V=>{if(!b)return;const Q=b2(V);a&&(Q&&V.button===0||!Q)&&R2({event:V,handleId:N,nodeId:b,onConnect:R,isTarget:_,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||t1}),Q?h==null||h(V):m==null||m(V)},D=V=>{const{onClickConnectStart:Q,onClickConnectEnd:ee,connectionClickStartHandle:M,connectionMode:X,isValidConnection:H}=S.getState();if(!b||!M&&!a)return;if(!M){Q==null||Q(V,{nodeId:b,handleId:N,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:N}});return}const I=y2(V.target),B=n||H||t1,{connection:P,isValid:z}=A2({nodeId:b,id:N,type:e},X,M.nodeId,M.handleId||null,M.type,B,I);z&&R(P),ee==null||ee(V),S.setState({connectionClickStartHandle:null})};return me.createElement("div",{"data-handleid":N,"data-nodeid":b,"data-handlepos":t,"data-id":`${b}-${N}-${e}`,className:hn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,p,{source:!_,target:_,connectable:r,connectablestart:a,connectableend:i,connecting:T,connectionindicator:r&&(a&&!C||i&&C)}]),onMouseDown:$,onTouchStart:$,onClick:j?D:void 0,ref:w,...y},f)});M2.displayName="Handle";var mo=x.memo(M2);const I2=({data:e,isConnectable:t,targetPosition:n=Ue.Top,sourcePosition:r=Ue.Bottom})=>me.createElement(me.Fragment,null,me.createElement(mo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,me.createElement(mo,{type:"source",position:r,isConnectable:t}));I2.displayName="DefaultNode";var hx=x.memo(I2);const $2=({data:e,isConnectable:t,sourcePosition:n=Ue.Bottom})=>me.createElement(me.Fragment,null,e==null?void 0:e.label,me.createElement(mo,{type:"source",position:n,isConnectable:t}));$2.displayName="InputNode";var O2=x.memo($2);const P2=({data:e,isConnectable:t,targetPosition:n=Ue.Top})=>me.createElement(me.Fragment,null,me.createElement(mo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);P2.displayName="OutputNode";var L2=x.memo(P2);const Kx=()=>null;Kx.displayName="GroupNode";const VP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Ju=e=>e.id;function KP(e,t){return Yt(e.selectedNodes.map(Ju),t.selectedNodes.map(Ju))&&Yt(e.selectedEdges.map(Ju),t.selectedEdges.map(Ju))}const D2=x.memo(({onSelectionChange:e})=>{const t=zt(),{selectedNodes:n,selectedEdges:r}=gt(VP,KP);return x.useEffect(()=>{const a={nodes:n,edges:r};e==null||e(a),t.getState().onSelectionChange.forEach(i=>i(a))},[n,r,e]),null});D2.displayName="SelectionListener";const YP=e=>!!e.onSelectionChange;function XP({onSelectionChange:e}){const t=gt(YP);return e||t?me.createElement(D2,{onSelectionChange:e}):null}const ZP=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 pi(e,t){x.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function it(e,t,n){x.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const QP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:a,onConnectStart:i,onConnectEnd:c,onClickConnectStart:u,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:_,maxZoom:S,nodeExtent:b,onNodesChange:j,onEdgesChange:E,elementsSelectable:C,connectionMode:T,snapGrid:R,snapToGrid:$,translateExtent:D,connectOnClick:W,defaultEdgeOptions:L,fitView:V,fitViewOptions:Q,onNodesDelete:ee,onEdgesDelete:M,onNodeDrag:X,onNodeDragStart:H,onNodeDragStop:I,onSelectionDrag:B,onSelectionDragStart:P,onSelectionDragStop:z,noPanClassName:O,nodeOrigin:K,rfId:de,autoPanOnConnect:G,autoPanOnNodeDrag:J,onError:U,connectionRadius:ne,isValidConnection:ae,nodeDragThreshold:pe})=>{const{setNodes:ge,setEdges:Se,setDefaultNodesAndEdges:Oe,setMinZoom:We,setMaxZoom:Pe,setTranslateExtent:Te,setNodeExtent:et,reset:je}=gt(ZP,Yt),_e=zt();return x.useEffect(()=>{const Ye=r==null?void 0:r.map(dt=>({...dt,...L}));return Oe(n,Ye),()=>{je()}},[]),it("defaultEdgeOptions",L,_e.setState),it("connectionMode",T,_e.setState),it("onConnect",a,_e.setState),it("onConnectStart",i,_e.setState),it("onConnectEnd",c,_e.setState),it("onClickConnectStart",u,_e.setState),it("onClickConnectEnd",f,_e.setState),it("nodesDraggable",p,_e.setState),it("nodesConnectable",h,_e.setState),it("nodesFocusable",m,_e.setState),it("edgesFocusable",y,_e.setState),it("edgesUpdatable",w,_e.setState),it("elementsSelectable",C,_e.setState),it("elevateNodesOnSelect",N,_e.setState),it("snapToGrid",$,_e.setState),it("snapGrid",R,_e.setState),it("onNodesChange",j,_e.setState),it("onEdgesChange",E,_e.setState),it("connectOnClick",W,_e.setState),it("fitViewOnInit",V,_e.setState),it("fitViewOnInitOptions",Q,_e.setState),it("onNodesDelete",ee,_e.setState),it("onEdgesDelete",M,_e.setState),it("onNodeDrag",X,_e.setState),it("onNodeDragStart",H,_e.setState),it("onNodeDragStop",I,_e.setState),it("onSelectionDrag",B,_e.setState),it("onSelectionDragStart",P,_e.setState),it("onSelectionDragStop",z,_e.setState),it("noPanClassName",O,_e.setState),it("nodeOrigin",K,_e.setState),it("rfId",de,_e.setState),it("autoPanOnConnect",G,_e.setState),it("autoPanOnNodeDrag",J,_e.setState),it("onError",U,_e.setState),it("connectionRadius",ne,_e.setState),it("isValidConnection",ae,_e.setState),it("nodeDragThreshold",pe,_e.setState),pi(e,ge),pi(t,Se),pi(_,We),pi(S,Pe),pi(D,Te),pi(b,et),null},n1={display:"none"},JP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},q2="react-flow__node-desc",F2="react-flow__edge-desc",eL="react-flow__aria-live",tL=e=>e.ariaLiveMessage;function nL({rfId:e}){const t=gt(tL);return me.createElement("div",{id:`${eL}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:JP},t)}function rL({rfId:e,disableKeyboardA11y:t}){return me.createElement(me.Fragment,null,me.createElement("div",{id:`${q2}-${e}`,style:n1},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),me.createElement("div",{id:`${F2}-${e}`,style:n1},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&me.createElement(nL,{rfId:e}))}var cc=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=x.useState(!1),a=x.useRef(!1),i=x.useRef(new Set([])),[c,u]=x.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),h=p.reduce((m,y)=>m.concat(...y),[]);return[p,h]}return[[],[]]},[e]);return x.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const h=w=>{if(a.current=w.ctrlKey||w.metaKey||w.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&lx(w))return!1;const _=s1(w.code,u);i.current.add(w[_]),r1(c,i.current,!1)&&(w.preventDefault(),r(!0))},m=w=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&lx(w))return!1;const _=s1(w.code,u);r1(c,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(w[_]),w.key==="Meta"&&i.current.clear(),a.current=!1},y=()=>{i.current.clear(),r(!1)};return p==null||p.addEventListener("keydown",h),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,r]),n};function r1(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function s1(e,t){return t.includes(e)?"code":"key"}function B2(e,t,n,r){var u,f;const a=e.parentNode||e.parentId;if(!a)return n;const i=t.get(a),c=ho(i,r);return B2(i,t,{x:(n.x??0)+c.x,y:(n.y??0)+c.y,z:(((u=i[Pt])==null?void 0:u.z)??0)>(n.z??0)?((f=i[Pt])==null?void 0:f.z)??0:n.z??0},r)}function z2(e,t,n){e.forEach(r=>{var i;const a=r.parentNode||r.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||n!=null&&n[r.id]){const{x:c,y:u,z:f}=B2(r,e,{...r.position,z:((i=r[Pt])==null?void 0:i.z)??0},t);r.positionAbsolute={x:c,y:u},r[Pt].z=f,n!=null&&n[r.id]&&(r[Pt].isParent=!0)}})}function fp(e,t,n,r){const a=new Map,i={},c=r?1e3:0;return e.forEach(u=>{var w;const f=(hr(u.zIndex)?u.zIndex:0)+(u.selected?c:0),p=t.get(u.id),h={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},m=u.parentNode||u.parentId;m&&(i[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(h,Pt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[Pt])==null?void 0:w.handleBounds,z:f}}),a.set(u.id,h)}),z2(a,n,i),a}function U2(e,t={}){const{getNodes:n,width:r,height:a,minZoom:i,maxZoom:c,d3Zoom:u,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:m}=e(),y=t.initial&&!p&&h;if(u&&f&&(y||!t.initial)){const N=n().filter(S=>{var j;const b=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return(j=t.nodes)!=null&&j.length?b&&t.nodes.some(E=>E.id===S.id):b}),_=N.every(S=>S.width&&S.height);if(N.length>0&&_){const S=lh(N,m),{x:b,y:j,zoom:E}=C2(S,r,a,t.minZoom??i,t.maxZoom??c,t.padding??.1),C=Ds.translate(b,j).scale(E);return typeof t.duration=="number"&&t.duration>0?u.transform(io(f,t.duration),C):u.transform(f,C),!0}}return!1}function sL(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Pt]:r[Pt],selected:n.selected})}),new Map(t)}function aL(e,t){return t.map(n=>{const r=e.find(a=>a.id===n.id);return r&&(n.selected=r.selected),n})}function ed({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:a,edges:i,onNodesChange:c,onEdgesChange:u,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&r({nodeInternals:sL(e,a)}),c==null||c(e)),t!=null&&t.length&&(p&&r({edges:aL(t,i)}),u==null||u(t))}const mi=()=>{},oL={zoomIn:mi,zoomOut:mi,zoomTo:mi,getZoom:()=>1,setViewport:mi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:mi,fitBounds:mi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},iL=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),lL=()=>{const e=zt(),{d3Zoom:t,d3Selection:n}=gt(iL,Yt);return x.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(io(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(io(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,i)=>t.scaleTo(io(n,i==null?void 0:i.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,i)=>{const[c,u,f]=e.getState().transform,p=Ds.translate(a.x??c,a.y??u).scale(a.zoom??f);t.transform(io(n,i==null?void 0:i.duration),p)},getViewport:()=>{const[a,i,c]=e.getState().transform;return{x:a,y:i,zoom:c}},fitView:a=>U2(e.getState,a),setCenter:(a,i,c)=>{const{width:u,height:f,maxZoom:p}=e.getState(),h=typeof(c==null?void 0:c.zoom)<"u"?c.zoom:p,m=u/2-a*h,y=f/2-i*h,w=Ds.translate(m,y).scale(h);t.transform(io(n,c==null?void 0:c.duration),w)},fitBounds:(a,i)=>{const{width:c,height:u,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:m,zoom:y}=C2(a,c,u,f,p,(i==null?void 0:i.padding)??.1),w=Ds.translate(h,m).scale(y);t.transform(io(n,i==null?void 0:i.duration),w)},project:a=>{const{transform:i,snapToGrid:c,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),dx(a,i,c,u)},screenToFlowPosition:a=>{const{transform:i,snapToGrid:c,snapGrid:u,domNode:f}=e.getState();if(!f)return a;const{x:p,y:h}=f.getBoundingClientRect(),m={x:a.x-p,y:a.y-h};return dx(m,i,c,u)},flowToScreenPosition:a=>{const{transform:i,domNode:c}=e.getState();if(!c)return a;const{x:u,y:f}=c.getBoundingClientRect(),p=S2(a,i);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:oL,[t,n])};function xc(){const e=lL(),t=zt(),n=x.useCallback(()=>t.getState().getNodes().map(_=>({..._})),[]),r=x.useCallback(_=>t.getState().nodeInternals.get(_),[]),a=x.useCallback(()=>{const{edges:_=[]}=t.getState();return _.map(S=>({...S}))},[]),i=x.useCallback(_=>{const{edges:S=[]}=t.getState();return S.find(b=>b.id===_)},[]),c=x.useCallback(_=>{const{getNodes:S,setNodes:b,hasDefaultNodes:j,onNodesChange:E}=t.getState(),C=S(),T=typeof _=="function"?_(C):_;if(j)b(T);else if(E){const R=T.length===0?C.map($=>({type:"remove",id:$.id})):T.map($=>({item:$,type:"reset"}));E(R)}},[]),u=x.useCallback(_=>{const{edges:S=[],setEdges:b,hasDefaultEdges:j,onEdgesChange:E}=t.getState(),C=typeof _=="function"?_(S):_;if(j)b(C);else if(E){const T=C.length===0?S.map(R=>({type:"remove",id:R.id})):C.map(R=>({item:R,type:"reset"}));E(T)}},[]),f=x.useCallback(_=>{const S=Array.isArray(_)?_:[_],{getNodes:b,setNodes:j,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const R=[...b(),...S];j(R)}else if(C){const T=S.map(R=>({item:R,type:"add"}));C(T)}},[]),p=x.useCallback(_=>{const S=Array.isArray(_)?_:[_],{edges:b=[],setEdges:j,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)j([...b,...S]);else if(C){const T=S.map(R=>({item:R,type:"add"}));C(T)}},[]),h=x.useCallback(()=>{const{getNodes:_,edges:S=[],transform:b}=t.getState(),[j,E,C]=b;return{nodes:_().map(T=>({...T})),edges:S.map(T=>({...T})),viewport:{x:j,y:E,zoom:C}}},[]),m=x.useCallback(({nodes:_,edges:S})=>{const{nodeInternals:b,getNodes:j,edges:E,hasDefaultNodes:C,hasDefaultEdges:T,onNodesDelete:R,onEdgesDelete:$,onNodesChange:D,onEdgesChange:W}=t.getState(),L=(_||[]).map(X=>X.id),V=(S||[]).map(X=>X.id),Q=j().reduce((X,H)=>{const I=H.parentNode||H.parentId,B=!L.includes(H.id)&&I&&X.find(z=>z.id===I);return(typeof H.deletable=="boolean"?H.deletable:!0)&&(L.includes(H.id)||B)&&X.push(H),X},[]),ee=E.filter(X=>typeof X.deletable=="boolean"?X.deletable:!0),M=ee.filter(X=>V.includes(X.id));if(Q||M){const X=E2(Q,ee),H=[...M,...X],I=H.reduce((B,P)=>(B.includes(P.id)||B.push(P.id),B),[]);if((T||C)&&(T&&t.setState({edges:E.filter(B=>!I.includes(B.id))}),C&&(Q.forEach(B=>{b.delete(B.id)}),t.setState({nodeInternals:new Map(b)}))),I.length>0&&($==null||$(H),W&&W(I.map(B=>({id:B,type:"remove"})))),Q.length>0&&(R==null||R(Q),D)){const B=Q.map(P=>({id:P.id,type:"remove"}));D(B)}}},[]),y=x.useCallback(_=>{const S=CP(_),b=S?null:t.getState().nodeInternals.get(_.id);return!S&&!b?[null,null,S]:[S?_:Yk(b),b,S]},[]),w=x.useCallback((_,S=!0,b)=>{const[j,E,C]=y(_);return j?(b||t.getState().getNodes()).filter(T=>{if(!C&&(T.id===E.id||!T.positionAbsolute))return!1;const R=Yk(T),$=ix(R,j);return S&&$>0||$>=j.width*j.height}):[]},[]),N=x.useCallback((_,S,b=!0)=>{const[j]=y(_);if(!j)return!1;const E=ix(j,S);return b&&E>0||E>=j.width*j.height},[]);return x.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:a,getEdge:i,setNodes:c,setEdges:u,addNodes:f,addEdges:p,toObject:h,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:N}),[e,n,r,a,i,c,u,f,p,h,m,w,N])}const cL={actInsideInputWithModifier:!1};var uL=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=zt(),{deleteElements:r}=xc(),a=cc(e,cL),i=cc(t);x.useEffect(()=>{if(a){const{edges:c,getNodes:u}=n.getState(),f=u().filter(h=>h.selected),p=c.filter(h=>h.selected);r({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),x.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function dL(e){const t=zt();x.useEffect(()=>{let n;const r=()=>{var i,c;if(!e.current)return;const a=Fx(e.current);(a.height===0||a.width===0)&&((c=(i=t.getState()).onError)==null||c.call(i,"004",Fs.error004())),t.setState({width:a.width||500,height:a.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const Yx={position:"absolute",width:"100%",height:"100%",top:0,left:0},hL=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,td=e=>({x:e.x,y:e.y,zoom:e.k}),gi=(e,t)=>e.target.closest(`.${t}`),a1=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),o1=e=>{const t=e.ctrlKey&&Ld()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},fL=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),pL=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:a=!0,zoomOnPinch:i=!0,panOnScroll:c=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=co.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:_,zoomActivationKeyCode:S,preventScrolling:b=!0,children:j,noWheelClassName:E,noPanClassName:C})=>{const T=x.useRef(),R=zt(),$=x.useRef(!1),D=x.useRef(!1),W=x.useRef(null),L=x.useRef({x:0,y:0,zoom:0}),{d3Zoom:V,d3Selection:Q,d3ZoomHandler:ee,userSelectionActive:M}=gt(fL,Yt),X=cc(S),H=x.useRef(0),I=x.useRef(!1),B=x.useRef();return dL(W),x.useEffect(()=>{if(W.current){const P=W.current.getBoundingClientRect(),z=p2().scaleExtent([N,_]).translateExtent(w),O=dr(W.current).call(z),K=Ds.translate(y.x,y.y).scale($i(y.zoom,N,_)),de=[[0,0],[P.width,P.height]],G=z.constrain()(K,de,w);z.transform(O,G),z.wheelDelta(o1),R.setState({d3Zoom:z,d3Selection:O,d3ZoomHandler:O.on("wheel.zoom"),transform:[G.x,G.y,G.k],domNode:W.current.closest(".react-flow")})}},[]),x.useEffect(()=>{Q&&V&&(c&&!X&&!M?Q.on("wheel.zoom",P=>{if(gi(P,E))return!1;P.preventDefault(),P.stopImmediatePropagation();const z=Q.property("__zoom").k||1;if(P.ctrlKey&&i){const ae=Mr(P),pe=o1(P),ge=z*Math.pow(2,pe);V.scaleTo(Q,ge,ae,P);return}const O=P.deltaMode===1?20:1;let K=f===co.Vertical?0:P.deltaX*O,de=f===co.Horizontal?0:P.deltaY*O;!Ld()&&P.shiftKey&&f!==co.Vertical&&(K=P.deltaY*O,de=0),V.translateBy(Q,-(K/z)*u,-(de/z)*u,{internal:!0});const G=td(Q.property("__zoom")),{onViewportChangeStart:J,onViewportChange:U,onViewportChangeEnd:ne}=R.getState();clearTimeout(B.current),I.current||(I.current=!0,t==null||t(P,G),J==null||J(G)),I.current&&(e==null||e(P,G),U==null||U(G),B.current=setTimeout(()=>{n==null||n(P,G),ne==null||ne(G),I.current=!1},150))},{passive:!1}):typeof ee<"u"&&Q.on("wheel.zoom",function(P,z){if(!b&&P.type==="wheel"&&!P.ctrlKey||gi(P,E))return null;P.preventDefault(),ee.call(this,P,z)},{passive:!1}))},[M,c,f,Q,V,ee,X,i,b,E,t,e,n]),x.useEffect(()=>{V&&V.on("start",P=>{var K,de;if(!P.sourceEvent||P.sourceEvent.internal)return null;H.current=(K=P.sourceEvent)==null?void 0:K.button;const{onViewportChangeStart:z}=R.getState(),O=td(P.transform);$.current=!0,L.current=O,((de=P.sourceEvent)==null?void 0:de.type)==="mousedown"&&R.setState({paneDragging:!0}),z==null||z(O),t==null||t(P.sourceEvent,O)})},[V,t]),x.useEffect(()=>{V&&(M&&!$.current?V.on("zoom",null):M||V.on("zoom",P=>{var O;const{onViewportChange:z}=R.getState();if(R.setState({transform:[P.transform.x,P.transform.y,P.transform.k]}),D.current=!!(r&&a1(m,H.current??0)),(e||z)&&!((O=P.sourceEvent)!=null&&O.internal)){const K=td(P.transform);z==null||z(K),e==null||e(P.sourceEvent,K)}}))},[M,V,e,m,r]),x.useEffect(()=>{V&&V.on("end",P=>{if(!P.sourceEvent||P.sourceEvent.internal)return null;const{onViewportChangeEnd:z}=R.getState();if($.current=!1,R.setState({paneDragging:!1}),r&&a1(m,H.current??0)&&!D.current&&r(P.sourceEvent),D.current=!1,(n||z)&&hL(L.current,P.transform)){const O=td(P.transform);L.current=O,clearTimeout(T.current),T.current=setTimeout(()=>{z==null||z(O),n==null||n(P.sourceEvent,O)},c?150:0)}})},[V,c,m,n,r]),x.useEffect(()=>{V&&V.filter(P=>{const z=X||a,O=i&&P.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&P.button===1&&P.type==="mousedown"&&(gi(P,"react-flow__node")||gi(P,"react-flow__edge")))return!0;if(!m&&!z&&!c&&!p&&!i||M||!p&&P.type==="dblclick"||gi(P,E)&&P.type==="wheel"||gi(P,C)&&(P.type!=="wheel"||c&&P.type==="wheel"&&!X)||!i&&P.ctrlKey&&P.type==="wheel"||!z&&!c&&!O&&P.type==="wheel"||!m&&(P.type==="mousedown"||P.type==="touchstart")||Array.isArray(m)&&!m.includes(P.button)&&P.type==="mousedown")return!1;const K=Array.isArray(m)&&m.includes(P.button)||!P.button||P.button<=1;return(!P.ctrlKey||P.type==="wheel")&&K})},[M,V,a,i,c,p,m,h,X]),me.createElement("div",{className:"react-flow__renderer",ref:W,style:Yx},j)},mL=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function gL(){const{userSelectionActive:e,userSelectionRect:t}=gt(mL,Yt);return e&&t?me.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function i1(e,t){const n=t.parentNode||t.parentId,r=e.find(a=>a.id===n);if(r){const a=t.position.x+t.width-r.width,i=t.position.y+t.height-r.height;if(a>0||i>0||t.position.x<0||t.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,a>0&&(r.style.width+=a),i>0&&(r.style.height+=i),t.position.x<0){const c=Math.abs(t.position.x);r.position.x=r.position.x-c,r.style.width+=c,t.position.x=0}if(t.position.y<0){const c=Math.abs(t.position.y);r.position.y=r.position.y-c,r.style.height+=c,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function yL(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,a)=>{const i=e.filter(u=>u.id===a.id);if(i.length===0)return r.push(a),r;const c={...a};for(const u of i)if(u)switch(u.type){case"select":{c.selected=u.selected;break}case"position":{typeof u.position<"u"&&(c.position=u.position),typeof u.positionAbsolute<"u"&&(c.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(c.dragging=u.dragging),c.expandParent&&i1(r,c);break}case"dimensions":{typeof u.dimensions<"u"&&(c.width=u.dimensions.width,c.height=u.dimensions.height),typeof u.updateStyle<"u"&&(c.style={...c.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(c.resizing=u.resizing),c.expandParent&&i1(r,c);break}case"remove":return r}return r.push(c),r},n)}function wL(e,t){return yL(e,t)}const ba=(e,t)=>({id:e,type:"select",selected:t});function _i(e,t){return e.reduce((n,r)=>{const a=t.includes(r.id);return!r.selected&&a?(r.selected=!0,n.push(ba(r.id,!0))):r.selected&&!a&&(r.selected=!1,n.push(ba(r.id,!1))),n},[])}const pp=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},vL=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),W2=x.memo(({isSelecting:e,selectionMode:t=lc.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:a,onPaneClick:i,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:m})=>{const y=x.useRef(null),w=zt(),N=x.useRef(0),_=x.useRef(0),S=x.useRef(),{userSelectionActive:b,elementsSelectable:j,dragging:E}=gt(vL,Yt),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,_.current=0},T=ee=>{i==null||i(ee),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},R=ee=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){ee.preventDefault();return}c==null||c(ee)},$=u?ee=>u(ee):void 0,D=ee=>{const{resetSelectedElements:M,domNode:X}=w.getState();if(S.current=X==null?void 0:X.getBoundingClientRect(),!j||!e||ee.button!==0||ee.target!==y.current||!S.current)return;const{x:H,y:I}=ja(ee,S.current);M(),w.setState({userSelectionRect:{width:0,height:0,startX:H,startY:I,x:H,y:I}}),r==null||r(ee)},W=ee=>{const{userSelectionRect:M,nodeInternals:X,edges:H,transform:I,onNodesChange:B,onEdgesChange:P,nodeOrigin:z,getNodes:O}=w.getState();if(!e||!S.current||!M)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const K=ja(ee,S.current),de=M.startX??0,G=M.startY??0,J={...M,x:K.x<de?K.x:de,y:K.y<G?K.y:G,width:Math.abs(K.x-de),height:Math.abs(K.y-G)},U=O(),ne=j2(X,J,I,t===lc.Partial,!0,z),ae=E2(ne,H).map(ge=>ge.id),pe=ne.map(ge=>ge.id);if(N.current!==pe.length){N.current=pe.length;const ge=_i(U,pe);ge.length&&(B==null||B(ge))}if(_.current!==ae.length){_.current=ae.length;const ge=_i(H,ae);ge.length&&(P==null||P(ge))}w.setState({userSelectionRect:J})},L=ee=>{if(ee.button!==0)return;const{userSelectionRect:M}=w.getState();!b&&M&&ee.target===y.current&&(T==null||T(ee)),w.setState({nodesSelectionActive:N.current>0}),C(),a==null||a(ee)},V=ee=>{b&&(w.setState({nodesSelectionActive:N.current>0}),a==null||a(ee)),C()},Q=j&&(e||b);return me.createElement("div",{className:hn(["react-flow__pane",{dragging:E,selection:e}]),onClick:Q?void 0:pp(T,y),onContextMenu:pp(R,y),onWheel:pp($,y),onMouseEnter:Q?void 0:f,onMouseDown:Q?D:void 0,onMouseMove:Q?W:p,onMouseUp:Q?L:void 0,onMouseLeave:Q?V:h,ref:y,style:Yx},m,me.createElement(gL,null))});W2.displayName="Pane";function H2(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return r?r.selected?!0:H2(r,t):!1}function l1(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function xL(e,t,n,r){return Array.from(e.values()).filter(a=>(a.selected||a.id===r)&&(!a.parentNode||a.parentId||!H2(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var i,c;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=a.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((c=a.positionAbsolute)==null?void 0:c.y)??0)},delta:{x:0,y:0},extent:a.extent,parentNode:a.parentNode||a.parentId,parentId:a.parentNode||a.parentId,width:a.width,height:a.height,expandParent:a.expandParent}})}function bL(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function G2(e,t,n,r,a=[0,0],i){const c=bL(e,e.extent||r);let u=c;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const m=n.get(f),{x:y,y:w}=ho(m,a).positionAbsolute;u=m&&hr(y)&&hr(w)&&hr(m.width)&&hr(m.height)?[[y+e.width*a[0],w+e.height*a[1]],[y+m.width-e.width+e.width*a[0],w+m.height-e.height+e.height*a[1]]]:u}else i==null||i("005",Fs.error005()),u=c;else if(e.extent&&f&&e.extent!=="parent"){const m=n.get(f),{x:y,y:w}=ho(m,a).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(f){const m=n.get(f);p=ho(m,a).positionAbsolute}const h=u&&u!=="parent"?Bx(t,u):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function mp({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(a=>({...n.get(a.id),position:a.position,positionAbsolute:a.positionAbsolute}));return[e?r.find(a=>a.id===e):r[0],r]}const c1=(e,t,n,r)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const i=Array.from(a),c=t.getBoundingClientRect(),u={x:c.width*r[0],y:c.height*r[1]};return i.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-c.left-u.x)/n,y:(p.top-c.top-u.y)/n,...Fx(f)}})};function Bl(e,t,n){return n===void 0?n:r=>{const a=t().nodeInternals.get(e);a&&n(r,{...a})}}function fx({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:a,unselectNodesAndEdges:i,multiSelectionActive:c,nodeInternals:u,onError:f}=t.getState(),p=u.get(e);if(!p){f==null||f("012",Fs.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&c)&&(i({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=r==null?void 0:r.current)==null?void 0:h.blur()})):a([e])}function kL(){const e=zt();return x.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:a,snapToGrid:i}=e.getState(),c=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,f={x:(c-r[0])/r[2],y:(u-r[1])/r[2]};return{xSnapped:i?a[0]*Math.round(f.x/a[0]):f.x,ySnapped:i?a[1]*Math.round(f.y/a[1]):f.y,...f}},[])}function gp(e){return(t,n,r)=>e==null?void 0:e(t,r)}function V2({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:i,selectNodesOnDrag:c}){const u=zt(),[f,p]=x.useState(!1),h=x.useRef([]),m=x.useRef({x:null,y:null}),y=x.useRef(0),w=x.useRef(null),N=x.useRef({x:0,y:0}),_=x.useRef(null),S=x.useRef(!1),b=x.useRef(!1),j=x.useRef(!1),E=kL();return x.useEffect(()=>{if(e!=null&&e.current){const C=dr(e.current),T=({x:D,y:W})=>{const{nodeInternals:L,onNodeDrag:V,onSelectionDrag:Q,updateNodePositions:ee,nodeExtent:M,snapGrid:X,snapToGrid:H,nodeOrigin:I,onError:B}=u.getState();m.current={x:D,y:W};let P=!1,z={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&M){const K=lh(h.current,I);z=ic(K)}if(h.current=h.current.map(K=>{const de={x:D-K.distance.x,y:W-K.distance.y};H&&(de.x=X[0]*Math.round(de.x/X[0]),de.y=X[1]*Math.round(de.y/X[1]));const G=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];h.current.length>1&&M&&!K.extent&&(G[0][0]=K.positionAbsolute.x-z.x+M[0][0],G[1][0]=K.positionAbsolute.x+(K.width??0)-z.x2+M[1][0],G[0][1]=K.positionAbsolute.y-z.y+M[0][1],G[1][1]=K.positionAbsolute.y+(K.height??0)-z.y2+M[1][1]);const J=G2(K,de,L,G,I,B);return P=P||K.position.x!==J.position.x||K.position.y!==J.position.y,K.position=J.position,K.positionAbsolute=J.positionAbsolute,K}),!P)return;ee(h.current,!0,!0),p(!0);const O=a?V:gp(Q);if(O&&_.current){const[K,de]=mp({nodeId:a,dragItems:h.current,nodeInternals:L});O(_.current,K,de)}},R=()=>{if(!w.current)return;const[D,W]=g2(N.current,w.current);if(D!==0||W!==0){const{transform:L,panBy:V}=u.getState();m.current.x=(m.current.x??0)-D/L[2],m.current.y=(m.current.y??0)-W/L[2],V({x:D,y:W})&&T(m.current)}y.current=requestAnimationFrame(R)},$=D=>{var I;const{nodeInternals:W,multiSelectionActive:L,nodesDraggable:V,unselectNodesAndEdges:Q,onNodeDragStart:ee,onSelectionDragStart:M}=u.getState();b.current=!0;const X=a?ee:gp(M);(!c||!i)&&!L&&a&&((I=W.get(a))!=null&&I.selected||Q()),a&&i&&c&&fx({id:a,store:u,nodeRef:e});const H=E(D);if(m.current=H,h.current=xL(W,V,H,a),X&&h.current){const[B,P]=mp({nodeId:a,dragItems:h.current,nodeInternals:W});X(D.sourceEvent,B,P)}};if(t)C.on(".drag",null);else{const D=MO().on("start",W=>{const{domNode:L,nodeDragThreshold:V}=u.getState();V===0&&$(W),j.current=!1;const Q=E(W);m.current=Q,w.current=(L==null?void 0:L.getBoundingClientRect())||null,N.current=ja(W.sourceEvent,w.current)}).on("drag",W=>{var ee,M;const L=E(W),{autoPanOnNodeDrag:V,nodeDragThreshold:Q}=u.getState();if(W.sourceEvent.type==="touchmove"&&W.sourceEvent.touches.length>1&&(j.current=!0),!j.current){if(!S.current&&b.current&&V&&(S.current=!0,R()),!b.current){const X=L.xSnapped-(((ee=m==null?void 0:m.current)==null?void 0:ee.x)??0),H=L.ySnapped-(((M=m==null?void 0:m.current)==null?void 0:M.y)??0);Math.sqrt(X*X+H*H)>Q&&$(W)}(m.current.x!==L.xSnapped||m.current.y!==L.ySnapped)&&h.current&&b.current&&(_.current=W.sourceEvent,N.current=ja(W.sourceEvent,w.current),T(L))}}).on("end",W=>{if(!(!b.current||j.current)&&(p(!1),S.current=!1,b.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:L,nodeInternals:V,onNodeDragStop:Q,onSelectionDragStop:ee}=u.getState(),M=a?Q:gp(ee);if(L(h.current,!1,!1),M){const[X,H]=mp({nodeId:a,dragItems:h.current,nodeInternals:V});M(W.sourceEvent,X,H)}}}).filter(W=>{const L=W.target;return!W.button&&(!n||!l1(L,`.${n}`,e))&&(!r||l1(L,r,e))});return C.call(D),()=>{C.on(".drag",null)}}}},[e,t,n,r,i,u,a,c,E]),f}function K2(){const e=zt();return x.useCallback(n=>{const{nodeInternals:r,nodeExtent:a,updateNodePositions:i,getNodes:c,snapToGrid:u,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),m=c().filter(j=>j.selected&&(j.draggable||h&&typeof j.draggable>"u")),y=u?f[0]:5,w=u?f[1]:5,N=n.isShiftPressed?4:1,_=n.x*y*N,S=n.y*w*N,b=m.map(j=>{if(j.positionAbsolute){const E={x:j.positionAbsolute.x+_,y:j.positionAbsolute.y+S};u&&(E.x=f[0]*Math.round(E.x/f[0]),E.y=f[1]*Math.round(E.y/f[1]));const{positionAbsolute:C,position:T}=G2(j,E,r,a,void 0,p);j.position=T,j.positionAbsolute=C}return j});i(b,!0,!1)},[])}const Ti={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var zl=e=>{const t=({id:n,type:r,data:a,xPos:i,yPos:c,xPosOrigin:u,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:m,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:_,style:S,className:b,isDraggable:j,isSelectable:E,isConnectable:C,isFocusable:T,selectNodesOnDrag:R,sourcePosition:$,targetPosition:D,hidden:W,resizeObserver:L,dragHandle:V,zIndex:Q,isParent:ee,noDragClassName:M,noPanClassName:X,initialized:H,disableKeyboardA11y:I,ariaLabel:B,rfId:P,hasHandleBounds:z})=>{const O=zt(),K=x.useRef(null),de=x.useRef(null),G=x.useRef($),J=x.useRef(D),U=x.useRef(r),ne=E||j||h||m||y||w,ae=K2(),pe=Bl(n,O.getState,m),ge=Bl(n,O.getState,y),Se=Bl(n,O.getState,w),Oe=Bl(n,O.getState,N),We=Bl(n,O.getState,_),Pe=je=>{const{nodeDragThreshold:_e}=O.getState();if(E&&(!R||!j||_e>0)&&fx({id:n,store:O,nodeRef:K}),h){const Ye=O.getState().nodeInternals.get(n);Ye&&h(je,{...Ye})}},Te=je=>{if(!lx(je)&&!I)if(x2.includes(je.key)&&E){const _e=je.key==="Escape";fx({id:n,store:O,unselect:_e,nodeRef:K})}else j&&p&&Object.prototype.hasOwnProperty.call(Ti,je.key)&&(O.setState({ariaLiveMessage:`Moved selected node ${je.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~c}`}),ae({x:Ti[je.key].x,y:Ti[je.key].y,isShiftPressed:je.shiftKey}))};x.useEffect(()=>()=>{de.current&&(L==null||L.unobserve(de.current),de.current=null)},[]),x.useEffect(()=>{if(K.current&&!W){const je=K.current;(!H||!z||de.current!==je)&&(de.current&&(L==null||L.unobserve(de.current)),L==null||L.observe(je),de.current=je)}},[W,H,z]),x.useEffect(()=>{const je=U.current!==r,_e=G.current!==$,Ye=J.current!==D;K.current&&(je||_e||Ye)&&(je&&(U.current=r),_e&&(G.current=$),Ye&&(J.current=D),O.getState().updateNodeDimensions([{id:n,nodeElement:K.current,forceUpdate:!0}]))},[n,r,$,D]);const et=V2({nodeRef:K,disabled:W||!j,noDragClassName:M,handleSelector:V,nodeId:n,isSelectable:E,selectNodesOnDrag:R});return W?null:me.createElement("div",{className:hn(["react-flow__node",`react-flow__node-${r}`,{[X]:j},b,{selected:p,selectable:E,parent:ee,dragging:et}]),ref:K,style:{zIndex:Q,transform:`translate(${u}px,${f}px)`,pointerEvents:ne?"all":"none",visibility:H?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:pe,onMouseMove:ge,onMouseLeave:Se,onContextMenu:Oe,onClick:Pe,onDoubleClick:We,onKeyDown:T?Te:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":I?void 0:`${q2}-${P}`,"aria-label":B},me.createElement(OP,{value:n},me.createElement(e,{id:n,data:a,type:r,xPos:i,yPos:c,selected:p,isConnectable:C,sourcePosition:$,targetPosition:D,dragging:et,dragHandle:V,zIndex:Q})))};return t.displayName="NodeWrapper",x.memo(t)};const _L=e=>{const t=e.getNodes().filter(n=>n.selected);return{...lh(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function NL({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=zt(),{width:a,height:i,x:c,y:u,transformString:f,userSelectionActive:p}=gt(_L,Yt),h=K2(),m=x.useRef(null);if(x.useEffect(()=>{var N;n||(N=m.current)==null||N.focus({preventScroll:!0})},[n]),V2({nodeRef:m}),p||!a||!i)return null;const y=e?N=>{const _=r.getState().getNodes().filter(S=>S.selected);e(N,_)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(Ti,N.key)&&h({x:Ti[N.key].x,y:Ti[N.key].y,isShiftPressed:N.shiftKey})};return me.createElement("div",{className:hn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},me.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:a,height:i,top:u,left:c}}))}var SL=x.memo(NL);const jL=e=>e.nodesSelectionActive,Y2=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:c,deleteKeyCode:u,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:_,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:j,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:$,panOnScrollMode:D,zoomOnDoubleClick:W,panOnDrag:L,defaultViewport:V,translateExtent:Q,minZoom:ee,maxZoom:M,preventScrolling:X,onSelectionContextMenu:H,noWheelClassName:I,noPanClassName:B,disableKeyboardA11y:P})=>{const z=gt(jL),O=cc(m),K=cc(b),de=K||L,G=K||R,J=O||y&&de!==!0;return uL({deleteKeyCode:u,multiSelectionKeyCode:S}),me.createElement(pL,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:G,panOnScrollSpeed:$,panOnScrollMode:D,zoomOnDoubleClick:W,panOnDrag:!O&&de,defaultViewport:V,translateExtent:Q,minZoom:ee,maxZoom:M,zoomActivationKeyCode:j,preventScrolling:X,noWheelClassName:I,noPanClassName:B},me.createElement(W2,{onSelectionStart:N,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:c,panOnDrag:de,isSelecting:!!J,selectionMode:w},e,z&&me.createElement(SL,{onSelectionContextMenu:H,noPanClassName:B,disableKeyboardA11y:P})))};Y2.displayName="FlowRenderer";var EL=x.memo(Y2);function CL(e){return gt(x.useCallback(n=>e?j2(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function TL(e){const t={input:zl(e.input||O2),default:zl(e.default||hx),output:zl(e.output||L2),group:zl(e.group||Kx)},n={},r=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,i)=>(a[i]=zl(e[i]||hx),a),n);return{...t,...r}}const AL=({x:e,y:t,width:n,height:r,origin:a})=>!n||!r?{x:e,y:t}:a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:e,y:t}:{x:e-n*a[0],y:t-r*a[1]},RL=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),X2=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:a,updateNodeDimensions:i,onError:c}=gt(RL,Yt),u=CL(e.onlyRenderVisibleElements),f=x.useRef(),p=x.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(m=>{const y=m.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));i(y)});return f.current=h,h},[]);return x.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),me.createElement("div",{className:"react-flow__nodes",style:Yx},u.map(h=>{var T,R,$;let m=h.type||"default";e.nodeTypes[m]||(c==null||c("003",Fs.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),N=!!(h.selectable||a&&typeof h.selectable>"u"),_=!!(h.connectable||n&&typeof h.connectable>"u"),S=!!(h.focusable||r&&typeof h.focusable>"u"),b=e.nodeExtent?Bx(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,j=(b==null?void 0:b.x)??0,E=(b==null?void 0:b.y)??0,C=AL({x:j,y:E,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return me.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||Ue.Bottom,targetPosition:h.targetPosition||Ue.Top,hidden:h.hidden,xPos:j,yPos:E,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!h.selected,isDraggable:w,isSelectable:N,isConnectable:_,isFocusable:S,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((T=h[Pt])==null?void 0:T.z)??0,isParent:!!((R=h[Pt])!=null&&R.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!(($=h[Pt])!=null&&$.handleBounds)})}))};X2.displayName="NodeRenderer";var ML=x.memo(X2);const IL=(e,t,n)=>n===Ue.Left?e-t:n===Ue.Right?e+t:e,$L=(e,t,n)=>n===Ue.Top?e-t:n===Ue.Bottom?e+t:e,u1="react-flow__edgeupdater",d1=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:i,onMouseOut:c,type:u})=>me.createElement("circle",{onMouseDown:a,onMouseEnter:i,onMouseOut:c,className:hn([u1,`${u1}-${u}`]),cx:IL(t,r,e),cy:$L(n,r,e),r,stroke:"transparent",fill:"transparent"}),OL=()=>!0;var yi=e=>{const t=({id:n,className:r,type:a,data:i,onClick:c,onEdgeDoubleClick:u,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,style:S,source:b,target:j,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:$,targetPosition:D,elementsSelectable:W,hidden:L,sourceHandleId:V,targetHandleId:Q,onContextMenu:ee,onMouseEnter:M,onMouseMove:X,onMouseLeave:H,reconnectRadius:I,onReconnect:B,onReconnectStart:P,onReconnectEnd:z,markerEnd:O,markerStart:K,rfId:de,ariaLabel:G,isFocusable:J,isReconnectable:U,pathOptions:ne,interactionWidth:ae,disableKeyboardA11y:pe})=>{const ge=x.useRef(null),[Se,Oe]=x.useState(!1),[We,Pe]=x.useState(!1),Te=zt(),et=x.useMemo(()=>`url('#${ux(K,de)}')`,[K,de]),je=x.useMemo(()=>`url('#${ux(O,de)}')`,[O,de]);if(L)return null;const _e=Je=>{var yt;const{edges:rt,addSelectedEdges:lt,unselectNodesAndEdges:tt,multiSelectionActive:nt}=Te.getState(),St=rt.find(wt=>wt.id===n);St&&(W&&(Te.setState({nodesSelectionActive:!1}),St.selected&&nt?(tt({nodes:[],edges:[St]}),(yt=ge.current)==null||yt.blur()):lt([n])),c&&c(Je,St))},Ye=Fl(n,Te.getState,u),dt=Fl(n,Te.getState,ee),Qe=Fl(n,Te.getState,M),ue=Fl(n,Te.getState,X),be=Fl(n,Te.getState,H),Re=(Je,rt)=>{if(Je.button!==0)return;const{edges:lt,isValidConnection:tt}=Te.getState(),nt=rt?j:b,St=(rt?Q:V)||null,yt=rt?"target":"source",wt=tt||OL,Et=rt,Xt=lt.find(st=>st.id===n);Pe(!0),P==null||P(Je,Xt,yt);const he=st=>{Pe(!1),z==null||z(st,Xt,yt)};R2({event:Je,handleId:St,nodeId:nt,onConnect:st=>B==null?void 0:B(Xt,st),isTarget:Et,getState:Te.getState,setState:Te.setState,isValidConnection:wt,edgeUpdaterType:yt,onReconnectEnd:he})},Xe=Je=>Re(Je,!0),$e=Je=>Re(Je,!1),ct=()=>Oe(!0),ye=()=>Oe(!1),Ee=!W&&!c,ie=Je=>{var rt;if(!pe&&x2.includes(Je.key)&&W){const{unselectNodesAndEdges:lt,addSelectedEdges:tt,edges:nt}=Te.getState();Je.key==="Escape"?((rt=ge.current)==null||rt.blur(),lt({edges:[nt.find(yt=>yt.id===n)]})):tt([n])}};return me.createElement("g",{className:hn(["react-flow__edge",`react-flow__edge-${a}`,r,{selected:f,animated:p,inactive:Ee,updating:Se}]),onClick:_e,onDoubleClick:Ye,onContextMenu:dt,onMouseEnter:Qe,onMouseMove:ue,onMouseLeave:be,onKeyDown:J?ie:void 0,tabIndex:J?0:void 0,role:J?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":G===null?void 0:G||`Edge from ${b} to ${j}`,"aria-describedby":J?`${F2}-${de}`:void 0,ref:ge},!We&&me.createElement(e,{id:n,source:b,target:j,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,data:i,style:S,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:$,targetPosition:D,sourceHandleId:V,targetHandleId:Q,markerStart:et,markerEnd:je,pathOptions:ne,interactionWidth:ae}),U&&me.createElement(me.Fragment,null,(U==="source"||U===!0)&&me.createElement(d1,{position:$,centerX:E,centerY:C,radius:I,onMouseDown:Xe,onMouseEnter:ct,onMouseOut:ye,type:"source"}),(U==="target"||U===!0)&&me.createElement(d1,{position:D,centerX:T,centerY:R,radius:I,onMouseDown:$e,onMouseEnter:ct,onMouseOut:ye,type:"target"})))};return t.displayName="EdgeWrapper",x.memo(t)};function PL(e){const t={default:yi(e.default||qd),straight:yi(e.bezier||Wx),step:yi(e.step||Ux),smoothstep:yi(e.step||ih),simplebezier:yi(e.simplebezier||zx)},n={},r=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,i)=>(a[i]=yi(e[i]||qd),a),n);return{...t,...r}}function h1(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,a=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,c=(n==null?void 0:n.height)||t.height;switch(e){case Ue.Top:return{x:r+i/2,y:a};case Ue.Right:return{x:r+i,y:a+c/2};case Ue.Bottom:return{x:r+i/2,y:a+c};case Ue.Left:return{x:r,y:a+c/2}}}function f1(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const LL=(e,t,n,r,a,i)=>{const c=h1(n,e,t),u=h1(i,r,a);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y}};function DL({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:a,targetHeight:i,width:c,height:u,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+r,t.y+i)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=ic({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:c/f[2],height:u/f[2]}),m=Math.max(0,Math.min(h.x2,p.x2)-Math.max(h.x,p.x)),y=Math.max(0,Math.min(h.y2,p.y2)-Math.max(h.y,p.y));return Math.ceil(m*y)>0}function p1(e){var r,a,i,c,u;const t=((r=e==null?void 0:e[Pt])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.x)||0,y:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const qL=[{level:0,isMaxLevel:!0,edges:[]}];function FL(e,t,n=!1){let r=-1;const a=e.reduce((c,u)=>{var h,m;const f=hr(u.zIndex);let p=f?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),_=Math.max(((h=w==null?void 0:w[Pt])==null?void 0:h.z)||0,((m=y==null?void 0:y[Pt])==null?void 0:m.z)||0,1e3);p=(f?u.zIndex:0)+(N?_:0)}return c[p]?c[p].push(u):c[p]=[u],r=p>r?p:r,c},{}),i=Object.entries(a).map(([c,u])=>{const f=+c;return{edges:u,level:f,isMaxLevel:f===r}});return i.length===0?qL:i}function BL(e,t,n){const r=gt(x.useCallback(a=>e?a.edges.filter(i=>{const c=t.get(i.source),u=t.get(i.target);return(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&DL({sourcePos:c.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:c.width,sourceHeight:c.height,targetWidth:u.width,targetHeight:u.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return FL(r,t,n)}const zL=({color:e="none",strokeWidth:t=1})=>me.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),UL=({color:e="none",strokeWidth:t=1})=>me.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),m1={[Dd.Arrow]:zL,[Dd.ArrowClosed]:UL};function WL(e){const t=zt();return x.useMemo(()=>{var a,i;return Object.prototype.hasOwnProperty.call(m1,e)?m1[e]:((i=(a=t.getState()).onError)==null||i.call(a,"009",Fs.error009(e)),null)},[e])}const HL=({id:e,type:t,color:n,width:r=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const f=WL(t);return f?me.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:u,refX:"0",refY:"0"},me.createElement(f,{color:n,strokeWidth:c})):null},GL=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((a,i)=>([i.markerStart,i.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const u=ux(c,t);r.includes(u)||(a.push({id:u,color:c.color||e,...c}),r.push(u))}}),a),[]).sort((a,i)=>a.id.localeCompare(i.id))},Z2=({defaultColor:e,rfId:t})=>{const n=gt(x.useCallback(GL({defaultColor:e,rfId:t}),[e,t]),(r,a)=>!(r.length!==a.length||r.some((i,c)=>i.id!==a[c].id)));return me.createElement("defs",null,n.map(r=>me.createElement(HL,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};Z2.displayName="MarkerDefinitions";var VL=x.memo(Z2);const KL=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}),Q2=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:a,noPanClassName:i,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,children:S,disableKeyboardA11y:b})=>{const{edgesFocusable:j,edgesUpdatable:E,elementsSelectable:C,width:T,height:R,connectionMode:$,nodeInternals:D,onError:W}=gt(KL,Yt),L=BL(t,D,n);return T?me.createElement(me.Fragment,null,L.map(({level:V,edges:Q,isMaxLevel:ee})=>me.createElement("svg",{key:V,style:{zIndex:V},width:T,height:R,className:"react-flow__edges react-flow__container"},ee&&me.createElement(VL,{defaultColor:e,rfId:r}),me.createElement("g",null,Q.map(M=>{const[X,H,I]=p1(D.get(M.source)),[B,P,z]=p1(D.get(M.target));if(!I||!z)return null;let O=M.type||"default";a[O]||(W==null||W("011",Fs.error011(O)),O="default");const K=a[O]||a.default,de=$===po.Strict?P.target:(P.target??[]).concat(P.source??[]),G=f1(H.source,M.sourceHandle),J=f1(de,M.targetHandle),U=(G==null?void 0:G.position)||Ue.Bottom,ne=(J==null?void 0:J.position)||Ue.Top,ae=!!(M.focusable||j&&typeof M.focusable>"u"),pe=M.reconnectable||M.updatable,ge=typeof y<"u"&&(pe||E&&typeof pe>"u");if(!G||!J)return W==null||W("008",Fs.error008(G,M)),null;const{sourceX:Se,sourceY:Oe,targetX:We,targetY:Pe}=LL(X,G,U,B,J,ne);return me.createElement(K,{key:M.id,id:M.id,className:hn([M.className,i]),type:O,data:M.data,selected:!!M.selected,animated:!!M.animated,hidden:!!M.hidden,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,style:M.style,source:M.source,target:M.target,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerEnd:M.markerEnd,markerStart:M.markerStart,sourceX:Se,sourceY:Oe,targetX:We,targetY:Pe,sourcePosition:U,targetPosition:ne,elementsSelectable:C,onContextMenu:c,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,rfId:r,ariaLabel:M.ariaLabel,isFocusable:ae,isReconnectable:ge,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth,disableKeyboardA11y:b})})))),S):null};Q2.displayName="EdgeRenderer";var YL=x.memo(Q2);const XL=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function ZL({children:e}){const t=gt(XL);return me.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function QL(e){const t=xc(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const JL={[Ue.Left]:Ue.Right,[Ue.Right]:Ue.Left,[Ue.Top]:Ue.Bottom,[Ue.Bottom]:Ue.Top},J2=({nodeId:e,handleType:t,style:n,type:r=ka.Bezier,CustomComponent:a,connectionStatus:i})=>{var R,$,D;const{fromNode:c,handleId:u,toX:f,toY:p,connectionMode:h}=gt(x.useCallback(W=>({fromNode:W.nodeInternals.get(e),handleId:W.connectionHandleId,toX:(W.connectionPosition.x-W.transform[0])/W.transform[2],toY:(W.connectionPosition.y-W.transform[1])/W.transform[2],connectionMode:W.connectionMode}),[e]),Yt),m=(R=c==null?void 0:c[Pt])==null?void 0:R.handleBounds;let y=m==null?void 0:m[t];if(h===po.Loose&&(y=y||(m==null?void 0:m[t==="source"?"target":"source"])),!c||!y)return null;const w=u?y.find(W=>W.id===u):y[0],N=w?w.x+w.width/2:(c.width??0)/2,_=w?w.y+w.height/2:c.height??0,S=((($=c.positionAbsolute)==null?void 0:$.x)??0)+N,b=(((D=c.positionAbsolute)==null?void 0:D.y)??0)+_,j=w==null?void 0:w.position,E=j?JL[j]:null;if(!j||!E)return null;if(a)return me.createElement(a,{connectionLineType:r,connectionLineStyle:n,fromNode:c,fromHandle:w,fromX:S,fromY:b,toX:f,toY:p,fromPosition:j,toPosition:E,connectionStatus:i});let C="";const T={sourceX:S,sourceY:b,sourcePosition:j,targetX:f,targetY:p,targetPosition:E};return r===ka.Bezier?[C]=Hx(T):r===ka.Step?[C]=cx({...T,borderRadius:0}):r===ka.SmoothStep?[C]=cx(T):r===ka.SimpleBezier?[C]=N2(T):C=`M${S},${b} ${f},${p}`,me.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};J2.displayName="ConnectionLine";const e4=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function t4({containerStyle:e,style:t,type:n,component:r}){const{nodeId:a,handleType:i,nodesConnectable:c,width:u,height:f,connectionStatus:p}=gt(e4,Yt);return!(a&&i&&u&&c)?null:me.createElement("svg",{style:e,width:u,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},me.createElement("g",{className:hn(["react-flow__connection",p])},me.createElement(J2,{nodeId:a,handleType:i,style:t,type:n,CustomComponent:r,connectionStatus:p})))}function g1(e,t){return x.useRef(null),zt(),x.useMemo(()=>t(e),[e])}const eA=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:a,onInit:i,onNodeClick:c,onEdgeClick:u,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:_,onSelectionEnd:S,connectionLineType:b,connectionLineStyle:j,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:T,selectionOnDrag:R,selectionMode:$,multiSelectionKeyCode:D,panActivationKeyCode:W,zoomActivationKeyCode:L,deleteKeyCode:V,onlyRenderVisibleElements:Q,elementsSelectable:ee,selectNodesOnDrag:M,defaultViewport:X,translateExtent:H,minZoom:I,maxZoom:B,preventScrolling:P,defaultMarkerColor:z,zoomOnScroll:O,zoomOnPinch:K,panOnScroll:de,panOnScrollSpeed:G,panOnScrollMode:J,zoomOnDoubleClick:U,panOnDrag:ne,onPaneClick:ae,onPaneMouseEnter:pe,onPaneMouseMove:ge,onPaneMouseLeave:Se,onPaneScroll:Oe,onPaneContextMenu:We,onEdgeContextMenu:Pe,onEdgeMouseEnter:Te,onEdgeMouseMove:et,onEdgeMouseLeave:je,onReconnect:_e,onReconnectStart:Ye,onReconnectEnd:dt,reconnectRadius:Qe,noDragClassName:ue,noWheelClassName:be,noPanClassName:Re,elevateEdgesOnSelect:Xe,disableKeyboardA11y:$e,nodeOrigin:ct,nodeExtent:ye,rfId:Ee})=>{const ie=g1(e,TL),Je=g1(t,PL);return QL(i),me.createElement(EL,{onPaneClick:ae,onPaneMouseEnter:pe,onPaneMouseMove:ge,onPaneMouseLeave:Se,onPaneContextMenu:We,onPaneScroll:Oe,deleteKeyCode:V,selectionKeyCode:T,selectionOnDrag:R,selectionMode:$,onSelectionStart:_,onSelectionEnd:S,multiSelectionKeyCode:D,panActivationKeyCode:W,zoomActivationKeyCode:L,elementsSelectable:ee,onMove:n,onMoveStart:r,onMoveEnd:a,zoomOnScroll:O,zoomOnPinch:K,zoomOnDoubleClick:U,panOnScroll:de,panOnScrollSpeed:G,panOnScrollMode:J,panOnDrag:ne,defaultViewport:X,translateExtent:H,minZoom:I,maxZoom:B,onSelectionContextMenu:N,preventScrolling:P,noDragClassName:ue,noWheelClassName:be,noPanClassName:Re,disableKeyboardA11y:$e},me.createElement(ZL,null,me.createElement(YL,{edgeTypes:Je,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:Q,onEdgeContextMenu:Pe,onEdgeMouseEnter:Te,onEdgeMouseMove:et,onEdgeMouseLeave:je,onReconnect:_e,onReconnectStart:Ye,onReconnectEnd:dt,reconnectRadius:Qe,defaultMarkerColor:z,noPanClassName:Re,elevateEdgesOnSelect:!!Xe,disableKeyboardA11y:$e,rfId:Ee},me.createElement(t4,{style:j,type:b,component:E,containerStyle:C})),me.createElement("div",{className:"react-flow__edgelabel-renderer"}),me.createElement(ML,{nodeTypes:ie,onNodeClick:c,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:M,onlyRenderVisibleElements:Q,noPanClassName:Re,noDragClassName:ue,disableKeyboardA11y:$e,nodeOrigin:ct,nodeExtent:ye,rfId:Ee})))};eA.displayName="GraphView";var n4=x.memo(eA);const px=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ya={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:px,nodeExtent:px,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:po.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:TP,isValidConnection:void 0},r4=()=>WI((e,t)=>({...ya,setNodes:n=>{const{nodeInternals:r,nodeOrigin:a,elevateNodesOnSelect:i}=t();e({nodeInternals:fp(n,r,a,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(a=>({...r,...a}))})},setDefaultNodesAndEdges:(n,r)=>{const a=typeof n<"u",i=typeof r<"u",c=a?fp(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:c,edges:i?r:[],hasDefaultNodes:a,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:a,fitViewOnInit:i,fitViewOnInitDone:c,fitViewOnInitOptions:u,domNode:f,nodeOrigin:p}=t(),h=f==null?void 0:f.querySelector(".react-flow__viewport");if(!h)return;const m=window.getComputedStyle(h),{m22:y}=new window.DOMMatrixReadOnly(m.transform),w=n.reduce((_,S)=>{const b=a.get(S.id);if(b!=null&&b.hidden)a.set(b.id,{...b,[Pt]:{...b[Pt],handleBounds:void 0}});else if(b){const j=Fx(S.nodeElement);!!(j.width&&j.height&&(b.width!==j.width||b.height!==j.height||S.forceUpdate))&&(a.set(b.id,{...b,[Pt]:{...b[Pt],handleBounds:{source:c1(".source",S.nodeElement,y,p),target:c1(".target",S.nodeElement,y,p)}},...j}),_.push({id:b.id,type:"dimensions",dimensions:j}))}return _},[]);z2(a,p);const N=c||i&&!c&&U2(t,{initial:!0,...u});e({nodeInternals:new Map(a),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(r==null||r(w))},updateNodePositions:(n,r=!0,a=!1)=>{const{triggerNodeChanges:i}=t(),c=n.map(u=>{const f={id:u.id,type:"position",dragging:a};return r&&(f.positionAbsolute=u.positionAbsolute,f.position=u.position),f});i(c)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:a,hasDefaultNodes:i,nodeOrigin:c,getNodes:u,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(i){const p=wL(n,u()),h=fp(p,a,c,f);e({nodeInternals:h})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:a,getNodes:i}=t();let c,u=null;r?c=n.map(f=>ba(f,!0)):(c=_i(i(),n),u=_i(a,[])),ed({changedNodes:c,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:a,getNodes:i}=t();let c,u=null;r?c=n.map(f=>ba(f,!0)):(c=_i(a,n),u=_i(i(),[])),ed({changedNodes:u,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:a,getNodes:i}=t(),c=n||i(),u=r||a,f=c.map(h=>(h.selected=!1,ba(h.id,!1))),p=u.map(h=>ba(h.id,!1));ed({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:a}=t();r==null||r.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:a}=t();r==null||r.scaleExtent([a,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),i=r().filter(u=>u.selected).map(u=>ba(u.id,!1)),c=n.filter(u=>u.selected).map(u=>ba(u.id,!1));ed({changedNodes:i,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(a=>{a.positionAbsolute=Bx(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:a,height:i,d3Zoom:c,d3Selection:u,translateExtent:f}=t();if(!c||!u||!n.x&&!n.y)return!1;const p=Ds.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),h=[[0,0],[a,i]],m=c==null?void 0:c.constrain()(p,h,f);return c.transform(u,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>e({connectionNodeId:ya.connectionNodeId,connectionHandleId:ya.connectionHandleId,connectionHandleType:ya.connectionHandleType,connectionStatus:ya.connectionStatus,connectionStartHandle:ya.connectionStartHandle,connectionEndHandle:ya.connectionEndHandle}),reset:()=>e({...ya})}),Object.is),Xx=({children:e})=>{const t=x.useRef(null);return t.current||(t.current=r4()),me.createElement(kP,{value:t.current},e)};Xx.displayName="ReactFlowProvider";const tA=({children:e})=>x.useContext(oh)?me.createElement(me.Fragment,null,e):me.createElement(Xx,null,e);tA.displayName="ReactFlowWrapper";const s4={input:O2,default:hx,output:L2,group:Kx},a4={default:qd,straight:Wx,step:Ux,smoothstep:ih,simplebezier:zx},o4=[0,0],i4=[15,15],l4={x:0,y:0,zoom:1},c4={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},nA=x.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:i=s4,edgeTypes:c=a4,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:b,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,onNodeDragStart:$,onNodeDrag:D,onNodeDragStop:W,onNodesDelete:L,onEdgesDelete:V,onSelectionChange:Q,onSelectionDragStart:ee,onSelectionDrag:M,onSelectionDragStop:X,onSelectionContextMenu:H,onSelectionStart:I,onSelectionEnd:B,connectionMode:P=po.Strict,connectionLineType:z=ka.Bezier,connectionLineStyle:O,connectionLineComponent:K,connectionLineContainerStyle:de,deleteKeyCode:G="Backspace",selectionKeyCode:J="Shift",selectionOnDrag:U=!1,selectionMode:ne=lc.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:pe=Ld()?"Meta":"Control",zoomActivationKeyCode:ge=Ld()?"Meta":"Control",snapToGrid:Se=!1,snapGrid:Oe=i4,onlyRenderVisibleElements:We=!1,selectNodesOnDrag:Pe=!0,nodesDraggable:Te,nodesConnectable:et,nodesFocusable:je,nodeOrigin:_e=o4,edgesFocusable:Ye,edgesUpdatable:dt,elementsSelectable:Qe,defaultViewport:ue=l4,minZoom:be=.5,maxZoom:Re=2,translateExtent:Xe=px,preventScrolling:$e=!0,nodeExtent:ct,defaultMarkerColor:ye="#b1b1b7",zoomOnScroll:Ee=!0,zoomOnPinch:ie=!0,panOnScroll:Je=!1,panOnScrollSpeed:rt=.5,panOnScrollMode:lt=co.Free,zoomOnDoubleClick:tt=!0,panOnDrag:nt=!0,onPaneClick:St,onPaneMouseEnter:yt,onPaneMouseMove:wt,onPaneMouseLeave:Et,onPaneScroll:Xt,onPaneContextMenu:he,children:ut,onEdgeContextMenu:st,onEdgeDoubleClick:kn,onEdgeMouseEnter:pn,onEdgeMouseMove:Cn,onEdgeMouseLeave:Lt,onEdgeUpdate:Bn,onEdgeUpdateStart:nn,onEdgeUpdateEnd:At,onReconnect:Qn,onReconnectStart:rn,onReconnectEnd:Br,reconnectRadius:_n=10,edgeUpdaterRadius:wr=10,onNodesChange:vr,onEdgesChange:zr,noDragClassName:Us="nodrag",noWheelClassName:Nn="nowheel",noPanClassName:ms="nopan",fitView:Z=!1,fitViewOptions:Ce,connectOnClick:Fe=!0,attributionPosition:Me,proOptions:ze,defaultEdgeOptions:ht,elevateNodesOnSelect:Rt=!0,elevateEdgesOnSelect:Mt=!1,disableKeyboardA11y:xr=!1,autoPanOnConnect:xt=!0,autoPanOnNodeDrag:bt=!0,connectionRadius:gs=20,isValidConnection:Ws,onError:jo,style:ys,id:Eo,nodeDragThreshold:Hs,...ws},Tn)=>{const Ur=Eo||"1";return me.createElement("div",{...ws,style:{...ys,...c4},ref:Tn,className:hn(["react-flow",a]),"data-testid":"rf__wrapper",id:Eo},me.createElement(tA,null,me.createElement(n4,{onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,nodeTypes:i,edgeTypes:c,connectionLineType:z,connectionLineStyle:O,connectionLineComponent:K,connectionLineContainerStyle:de,selectionKeyCode:J,selectionOnDrag:U,selectionMode:ne,deleteKeyCode:G,multiSelectionKeyCode:pe,panActivationKeyCode:ae,zoomActivationKeyCode:ge,onlyRenderVisibleElements:We,selectNodesOnDrag:Pe,defaultViewport:ue,translateExtent:Xe,minZoom:be,maxZoom:Re,preventScrolling:$e,zoomOnScroll:Ee,zoomOnPinch:ie,zoomOnDoubleClick:tt,panOnScroll:Je,panOnScrollSpeed:rt,panOnScrollMode:lt,panOnDrag:nt,onPaneClick:St,onPaneMouseEnter:yt,onPaneMouseMove:wt,onPaneMouseLeave:Et,onPaneScroll:Xt,onPaneContextMenu:he,onSelectionContextMenu:H,onSelectionStart:I,onSelectionEnd:B,onEdgeContextMenu:st,onEdgeDoubleClick:kn,onEdgeMouseEnter:pn,onEdgeMouseMove:Cn,onEdgeMouseLeave:Lt,onReconnect:Qn??Bn,onReconnectStart:rn??nn,onReconnectEnd:Br??At,reconnectRadius:_n??wr,defaultMarkerColor:ye,noDragClassName:Us,noWheelClassName:Nn,noPanClassName:ms,elevateEdgesOnSelect:Mt,rfId:Ur,disableKeyboardA11y:xr,nodeOrigin:_e,nodeExtent:ct}),me.createElement(QP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:b,nodesDraggable:Te,nodesConnectable:et,nodesFocusable:je,edgesFocusable:Ye,edgesUpdatable:dt,elementsSelectable:Qe,elevateNodesOnSelect:Rt,minZoom:be,maxZoom:Re,nodeExtent:ct,onNodesChange:vr,onEdgesChange:zr,snapToGrid:Se,snapGrid:Oe,connectionMode:P,translateExtent:Xe,connectOnClick:Fe,defaultEdgeOptions:ht,fitView:Z,fitViewOptions:Ce,onNodesDelete:L,onEdgesDelete:V,onNodeDragStart:$,onNodeDrag:D,onNodeDragStop:W,onSelectionDrag:M,onSelectionDragStart:ee,onSelectionDragStop:X,noPanClassName:ms,nodeOrigin:_e,rfId:Ur,autoPanOnConnect:xt,autoPanOnNodeDrag:bt,onError:jo,connectionRadius:gs,isValidConnection:Ws,nodeDragThreshold:Hs}),me.createElement(XP,{onSelectionChange:Q}),ut,me.createElement(NP,{proOptions:ze,position:Me}),me.createElement(rL,{rfId:Ur,disableKeyboardA11y:xr})))});nA.displayName="ReactFlow";const u4=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function rA(){return gt(u4,Yt)}const sA=({id:e,x:t,y:n,width:r,height:a,style:i,color:c,strokeColor:u,strokeWidth:f,className:p,borderRadius:h,shapeRendering:m,onClick:y,selected:w})=>{const{background:N,backgroundColor:_}=i||{},S=c||N||_;return me.createElement("rect",{className:hn(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:h,ry:h,width:r,height:a,fill:S,stroke:u,strokeWidth:f,shapeRendering:m,onClick:y?b=>y(b,e):void 0})};sA.displayName="MiniMapNode";var d4=x.memo(sA);const h4=e=>e.nodeOrigin,f4=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),yp=e=>e instanceof Function?e:()=>e;function p4({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a=2,nodeComponent:i=d4,onClick:c}){const u=gt(f4,Yt),f=gt(h4),p=yp(t),h=yp(e),m=yp(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return me.createElement(me.Fragment,null,u.map(w=>{const{x:N,y:_}=ho(w,f).positionAbsolute;return me.createElement(i,{key:w.id,x:N,y:_,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:p(w),borderRadius:r,strokeColor:h(w),strokeWidth:a,shapeRendering:y,onClick:c,id:w.id})}))}var m4=x.memo(p4);const g4=200,y4=150,w4=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?EP(lh(t,e.nodeOrigin),n):n,rfId:e.rfId}},v4="react-flow__minimap-desc";function aA({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:a="",nodeBorderRadius:i=5,nodeStrokeWidth:c=2,nodeComponent:u,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:_=!1,ariaLabel:S="React Flow mini map",inversePan:b=!1,zoomStep:j=10,offsetScale:E=5}){const C=zt(),T=x.useRef(null),{boundingRect:R,viewBB:$,rfId:D}=gt(w4,Yt),W=(e==null?void 0:e.width)??g4,L=(e==null?void 0:e.height)??y4,V=R.width/W,Q=R.height/L,ee=Math.max(V,Q),M=ee*W,X=ee*L,H=E*ee,I=R.x-(M-R.width)/2-H,B=R.y-(X-R.height)/2-H,P=M+H*2,z=X+H*2,O=`${v4}-${D}`,K=x.useRef(0);K.current=ee,x.useEffect(()=>{if(T.current){const J=dr(T.current),U=pe=>{const{transform:ge,d3Selection:Se,d3Zoom:Oe}=C.getState();if(pe.sourceEvent.type!=="wheel"||!Se||!Oe)return;const We=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*j,Pe=ge[2]*Math.pow(2,We);Oe.scaleTo(Se,Pe)},ne=pe=>{const{transform:ge,d3Selection:Se,d3Zoom:Oe,translateExtent:We,width:Pe,height:Te}=C.getState();if(pe.sourceEvent.type!=="mousemove"||!Se||!Oe)return;const et=K.current*Math.max(1,ge[2])*(b?-1:1),je={x:ge[0]-pe.sourceEvent.movementX*et,y:ge[1]-pe.sourceEvent.movementY*et},_e=[[0,0],[Pe,Te]],Ye=Ds.translate(je.x,je.y).scale(ge[2]),dt=Oe.constrain()(Ye,_e,We);Oe.transform(Se,dt)},ae=p2().on("zoom",N?ne:null).on("zoom.wheel",_?U:null);return J.call(ae),()=>{J.on("zoom",null)}}},[N,_,b,j]);const de=y?J=>{const U=Mr(J);y(J,{x:U[0],y:U[1]})}:void 0,G=w?(J,U)=>{const ne=C.getState().nodeInternals.get(U);w(J,ne)}:void 0;return me.createElement(qx,{position:m,style:e,className:hn(["react-flow__minimap",t]),"data-testid":"rf__minimap"},me.createElement("svg",{width:W,height:L,viewBox:`${I} ${B} ${P} ${z}`,role:"img","aria-labelledby":O,ref:T,onClick:de},S&&me.createElement("title",{id:O},S),me.createElement(m4,{onClick:G,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),me.createElement("path",{className:"react-flow__minimap-mask",d:`M${I-H},${B-H}h${P+H*2}v${z+H*2}h${-P-H*2}z
57
+ M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}aA.displayName="MiniMap";var x4=x.memo(aA);function b4(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},me.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function k4(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},me.createElement("path",{d:"M0 0h32v4.2H0z"}))}function _4(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},me.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function N4(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},me.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function S4(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},me.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const ur=({children:e,className:t,...n})=>me.createElement("button",{type:"button",className:hn(["react-flow__controls-button",t]),...n},e);ur.displayName="ControlButton";const j4=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),oA=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:i,onZoomOut:c,onFitView:u,onInteractiveChange:f,className:p,children:h,position:m="bottom-left"})=>{const y=zt(),[w,N]=x.useState(!1),{isInteractive:_,minZoomReached:S,maxZoomReached:b}=gt(j4,Yt),{zoomIn:j,zoomOut:E,fitView:C}=xc();if(x.useEffect(()=>{N(!0)},[]),!w)return null;const T=()=>{j(),i==null||i()},R=()=>{E(),c==null||c()},$=()=>{C(a),u==null||u()},D=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),f==null||f(!_)};return me.createElement(qx,{className:hn(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},t&&me.createElement(me.Fragment,null,me.createElement(ur,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},me.createElement(b4,null)),me.createElement(ur,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},me.createElement(k4,null))),n&&me.createElement(ur,{className:"react-flow__controls-fitview",onClick:$,title:"fit view","aria-label":"fit view"},me.createElement(_4,null)),r&&me.createElement(ur,{className:"react-flow__controls-interactive",onClick:D,title:"toggle interactivity","aria-label":"toggle interactivity"},_?me.createElement(S4,null):me.createElement(N4,null)),h)};oA.displayName="Controls";var E4=x.memo(oA),Pr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Pr||(Pr={}));function C4({color:e,dimensions:t,lineWidth:n}){return me.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function T4({color:e,radius:t}){return me.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const A4={[Pr.Dots]:"#91919a",[Pr.Lines]:"#eee",[Pr.Cross]:"#e2e2e2"},R4={[Pr.Dots]:1,[Pr.Lines]:1,[Pr.Cross]:6},M4=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function iA({id:e,variant:t=Pr.Dots,gap:n=20,size:r,lineWidth:a=1,offset:i=2,color:c,style:u,className:f}){const p=x.useRef(null),{transform:h,patternId:m}=gt(M4,Yt),y=c||A4[t],w=r||R4[t],N=t===Pr.Dots,_=t===Pr.Cross,S=Array.isArray(n)?n:[n,n],b=[S[0]*h[2]||1,S[1]*h[2]||1],j=w*h[2],E=_?[j,j]:b,C=N?[j/i,j/i]:[E[0]/i,E[1]/i];return me.createElement("svg",{className:hn(["react-flow__background",f]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},me.createElement("pattern",{id:m+e,x:h[0]%b[0],y:h[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?me.createElement(T4,{color:y,radius:j/i}):me.createElement(C4,{dimensions:E,color:y,lineWidth:a})),me.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}iA.displayName="Background";var I4=x.memo(iA);const $4=["us-gov","global","apac","us","eu","jp","au"],O4=new RegExp(`^(?:(?:${$4.join("|")})\\.)?anthropic\\.`,"i");function bc(e){return e.replace(O4,"")}const P4=["command","cmd","file_path","path","url","pattern","notebook_path"],y1=120,wp=e=>e.length>y1?`${e.slice(0,y1-1)}…`:e;function L4(e){if(typeof e=="string")return e.trim()?wp(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of P4){const r=t[n];if(typeof r=="string"&&r.trim())return wp(r.trim());if(Array.isArray(r)&&r.length>0&&r.every(a=>typeof a=="string")){const a=r.join(" ").trim();if(a)return wp(a)}}return null}const D4=/^\s*<task-notification>([\s\S]*?)<\/task-notification>/;function w1(e,t){var n;return((n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`).exec(e))==null?void 0:n[1].trim())||void 0}const v1={completed:"background task finished",failed:"background task failed",killed:"background task stopped"};function Zx(e){const t=D4.exec(e);if(!t)return null;const n=w1(t[1],"status");return{label:(n&&Object.hasOwn(v1,n)?v1[n]:void 0)??"background task update",detail:w1(t[1],"summary")}}function lA(e){return e.filter(t=>!Zx(t.text))}const q4=/[0-9a-f]{16,}/i,F4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function cA(e){return q4.test(e)||F4.test(e)}function B4(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);for(let n=t.length-1;n>=0;n--)if(!cA(t[n]))return t[n];return t[t.length-1]}function uA(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function Qx(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,r=n.ephemeral_1h_input_tokens,a=n.ephemeral_5m_input_tokens;return typeof r!="number"&&typeof a!="number"?{}:{cacheCreate1hTokens:Number(r??0),cacheCreate5mTokens:Number(a??0)}}function z4(e){const t=Qx(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 U4(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,r]of Object.entries(e))!n||!r||typeof r!="object"||(t[n]=z4(r));return Object.keys(t).length?t:void 0}function dA(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),...Qx(n)};for(const r of Object.values(n)){const a=dA(r,t+1);if(a)return a}return null}const W4=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i,H4=new Set(["tool_input","tool_response"]);function hA(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&W4.test(bc(n.model)))return n.model;for(const[r,a]of Object.entries(n)){if(H4.has(r))continue;const i=hA(a,t+1);if(i)return i}return null}function mx(){return{agents:new Map,toolIndex:new Map,activeSubagentStack:new Map,subagentTombstones:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Ea(e){return B4(e)}function x1(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Oi(e,t){return`${e}::${t}`}function Ca(e,t){return`${e}\0${t}`}function Fd(e){const t=e.agent_type??e.subagent_type;return t&&!cA(t)?t:"subagent"}function Jl(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Ni(e,t,n,r){const a=t;let i=e.agents.get(a);return i||(i={id:a,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:r,usage:uA()},e.agents.set(a,i),i)}function fA(e,t,n,r){const a=Oi(t,n),i=e.agents.get(a);if(!i)return null;!i.cwd&&r.cwd&&(i.cwd=r.cwd,i.cwdBasename=Ea(r.cwd));const c=Fd(r);return c&&(i.label==="subagent"||!i.label)&&(i.label=c),i}function G4(e,t,n){const r=t.session_id??"unknown",a=Jl(t);if(a){const f=fA(e,r,a,t);if(f)return f}const i=e.activeSubagentStack.get(r),c=i&&i.length>0?i[i.length-1]:null;if(c){const f=e.agents.get(Oi(r,c));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=Ea(t.cwd)),f}const u=Ni(e,r,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=Ea(t.cwd)),u.label==="session"&&t.cwd&&(u.label=Ea(t.cwd)??"session"),u}function V4(e,t,n,r,a){const i=Oi(t,n),c=Ni(e,t,a,!0);let u=e.agents.get(i);if(u){!u.cwd&&r.cwd&&(u.cwd=r.cwd,u.cwdBasename=Ea(r.cwd));const f=Fd(r);return f&&(u.label==="subagent"||!u.label)&&(u.label=f),u}return u={id:i,sessionId:t,label:Fd(r),kind:"subagent",parentId:c.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:r.cwd,cwdBasename:Ea(r.cwd),toolCount:0,childCount:0,usage:uA()},e.agents.set(i,u),c.childCount+=1,u}function K4(e,t,n){const r=e.activeSubagentStack.get(t)??[];r.includes(n)||(r.push(n),e.activeSubagentStack.set(t,r))}function b1(e,t,n){const r=e.activeSubagentStack.get(t);if(r){for(let a=r.length-1;a>=0;a--)if(r[a]===n){r.splice(a,1);break}r.length===0&&e.activeSubagentStack.delete(t)}}function nd(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 k1=200;function Y4(e,t){for(const n of e.values()){const r=n.tools.find(a=>a.id===t);if(r)return r}return null}const X4=25;function Z4(e,t){const n=t.tools;if(n.length>k1){const r=n.splice(0,n.length-k1);for(const a of r){const i=Ca(t.sessionId,a.id);e.toolIndex.get(i)===a&&e.toolIndex.delete(i)}}for(let r=n.length-X4-1;r>=0;r--){const a=n[r];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function Q4(e,t,n){const r=e.toolIndex.get(Ca(t.sessionId,n));if(r)return r;for(let a=t.tools.length-1;a>=0;a--)if(t.tools[a].id===n)return t.tools[a];return null}const _1=2e3;function J4(e,t,n){for(let r=e.prompts.length-1;r>=0;r--){const a=e.prompts[r];if(a.at<t-_1)return!1;if(a.text===n&&a.at<=t+_1)return!0}return!1}const rd=2e3;function e5(e){let t=e.startedAt;for(const n of e.prompts)n.at>t&&(t=n.at);return t}function pA(e,t){for(const n of t.tools){const r=Ca(t.sessionId,n.id);e.toolIndex.get(r)===n&&e.toolIndex.delete(r)}}function kc(e,t){return t&&(e.revision+=1),t}function t5(e,t,n,r,a){if(e.agents.size<=n)return!1;const i=m=>m.state==="done"&&m.endedAt!=null&&t-m.endedAt>r,c=[],u=new Map;for(const[m,y]of e.agents){if(y.parentId!=null){const w=u.get(y.parentId);w?w.push(m):u.set(y.parentId,[m])}i(y)&&c.push({id:m,endedAt:y.endedAt})}if(c.length===0)return!1;c.sort((m,y)=>m.endedAt-y.endedAt);let f=0;const p=new Set,h=m=>{const y=e.agents.get(m);y&&(pA(e,y),e.agents.delete(m),p.add(y.sessionId),f++)};for(const m of c){if(e.agents.size<=n)break;if(!e.agents.has(m.id))continue;const y=(u.get(m.id)??[]).map(w=>e.agents.get(w)).filter(w=>w!=null);if(!y.some(w=>!i(w))){for(const w of y)h(w.id);h(m.id)}}if(a&&p.size>0){const m=new Set;for(const y of e.agents.values())m.add(y.sessionId);for(const y of p)m.has(y)||a(y)}return kc(e,f>0)}function n5(e,t,n,r,a){const i=new Map;for(const[h,m]of e.agents){let y=i.get(m.sessionId);y||(y={ids:[],endedAt:0,live:!1,closed:!1},i.set(m.sessionId,y)),y.ids.push(h),m.kind==="root"&&m.closedAt!=null&&(y.closed=!0),m.state==="done"&&m.endedAt!=null?y.endedAt=Math.max(y.endedAt,m.endedAt):y.live=!0}const c=[...i].filter(([,h])=>!h.live&&h.endedAt>0&&t-h.endedAt>r).sort(([,h],[,m])=>h.closed===m.closed?h.endedAt-m.endedAt:h.closed?-1:1);let f=[...i.values()].filter(h=>!h.live).length-n;if(f<=0)return!1;let p=!1;for(const[h,m]of c){if(f<=0)break;for(const y of m.ids){const w=e.agents.get(y);w&&pA(e,w),e.agents.delete(y)}a==null||a(h),f--,p=!0}return kc(e,p)}function r5(e,t){const n=t==null?void 0:t.payload,r=n==null?void 0:n.hook_event_name;if(r!=="PostToolUse"&&r!=="PostToolUseFailure")return!1;const a=n==null?void 0:n.tool_use_id;return typeof a!="string"||a.length===0?!1:e.toolIndex.has(Ca((n==null?void 0:n.session_id)??"unknown",a))}function s5(e){let t=!1;for(const n of e.agents.values())for(const r of n.tools)r.endedAt!=null||r.outcomeGap||(r.outcomeGap=!0,t=!0);return kc(e,t)}function a5(e,t,n){let r=!1;for(const a of e.agents.values()){if(a.provider==="codex")continue;const i=e.agents.get(a.sessionId),c=(i==null?void 0:i.lastEventAt)??(i==null?void 0:i.startedAt);for(const u of a.tools){const f=Math.max(u.startedAt,c??u.startedAt);u.endedAt==null&&t-f>n&&(u.endedAt=f,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(Ca(a.sessionId,u.id)),r=!0)}}return kc(e,r)}const N1=90*6e4;function o5(e,t,n){let r=!1;for(const a of e.agents.values()){if(a.kind!=="root")continue;const i=a.lastEventAt??a.startedAt;if(!(t-i<=n)){a.waiting&&(a.waiting=null,r=!0),a.closedAt==null&&(a.closedAt=i),a.state==="active"&&(a.state="done",a.endedAt=i,a.reaped=!0,r=!0);for(const c of e.agents.values())c.sessionId!==a.sessionId||c.kind==="root"||c.state!=="active"||(c.state="done",c.endedAt=i,r=!0);e.activeSubagentStack.delete(a.sessionId)}}return kc(e,r)}function i5(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const l5=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed","SessionRecapped"]);function c5(e,t){let n=null;for(const r of e.toolIndex.values()){const a=r.agentId?e.agents.get(r.agentId):void 0;!a||a.sessionId!==t||(!n||r.startedAt>n.startedAt)&&(n=r)}return n}const u5=3e4;function d5(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>u5)&&!(e.startedAt>t))return{name:e.name,preview:L4(e.input)??""}}function h5(e,t,n,r,a){if(n!=="permission")return{kind:n,message:r,since:a};const i=c5(e,t),c={kind:n,message:r,since:a};i!=null&&i.explicitSubagentId&&(c.subagentId=i.explicitSubagentId);const u=d5(i,a);return u&&(c.tool=u),c}function f5(e,t,n){if(e.kind==="idle")return!0;const r=Jl(t);return r==null?!0:e.subagentId!=null&&Oi(n,r)===e.subagentId}function S1(e,t){const n=t.epoch??null;if(n!==null&&n!==e.seqEpoch)e.seqEpoch=n,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const r=t.payload??{},a=t.receivedAt,i=r.hook_event_name??"Unknown";if(i==="__clear")return{...mx(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const c=r.session_id??"unknown";if(!l5.has(i)){const h=e.agents.get(c);h!=null&&h.waiting&&f5(h.waiting,r,c)&&(h.waiting=null)}const u=e.agents.get(c);if(u&&a>(u.lastEventAt??0)&&(u.lastEventAt=a,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof r.model_context_window=="number"&&r.model_context_window>0){const h=e.agents.get(c);h&&(h.contextWindow=r.model_context_window)}if(typeof r.approval_policy=="string"&&r.approval_policy){const h=e.agents.get(c);h&&(h.approvalPolicy=r.approval_policy)}if(typeof r.context_tokens=="number"&&r.context_tokens>=0){const h=e.agents.get(c);h&&(h.context={...h.context??x1(),currentContextTokens:r.context_tokens})}if(i==="ModelObserved"){const h=typeof r.model=="string"?r.model:null;if(h){const y=e.agents.get(c);y&&(y.model=h)}const m=r.subagentModels;if(m&&typeof m=="object")for(const[y,w]of Object.entries(m)){if(typeof w!="string")continue;const N=`${c}::${y}`,_=e.agents.get(N);_&&(_.model=w)}return e}if(i==="ContextObserved"){const h=r.context??null;if(h){const m=e.agents.get(c);if(m){const y=m.context??x1(),w=(_,S)=>typeof h[_]=="number"?h[_]:S,N=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;m.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:N??y.memoryFiles}}}return e}if(i==="SessionNamed"){const h=e.agents.get(c);if(h){const m=typeof r.sessionName=="string"?r.sessionName.trim():"",y=typeof r.sessionTitle=="string"?r.sessionTitle.trim():"";m&&(h.sessionName=m),y&&(h.sessionTitle=y);const w=h.sessionName??"";h.sessionTitle&&w&&h.sessionTitle.toLowerCase()===w.toLowerCase()&&(h.sessionTitle=void 0)}return e}if(i==="SessionRecapped"){const h=e.agents.get(c);if(h){const m=r.recap;m===null?h.recap=void 0:m&&typeof m.text=="string"&&m.text.trim()&&Number.isFinite(m.at)&&(h.recap={text:m.text.trim(),at:m.at})}return e}if(i==="OutputObserved"){const h=r.kind==="thinking"||r.kind==="text"||r.kind==="tool_use"?r.kind:null,m=typeof r.at=="number"&&Number.isFinite(r.at)?r.at:a;if(!h)return e;const y=e.agents.get(c);if(!y||y.lastOutputAt!=null&&m<=y.lastOutputAt)return e;if(y.lastOutputAt=m,h!=="tool_use"){const w=(y.outputs??[]).filter(N=>m-N<p5);w.push(m),y.outputs=w.length>j1?w.slice(-j1):w}return e.revision+=1,e}if(i==="UsageObserved"){const h=r.usage??null;if(h){const m=e.agents.get(c);if(m){m.usage.inputTokens=Number(h.input_tokens??0),m.usage.outputTokens=Number(h.output_tokens??0),m.usage.cacheReadTokens=Number(h.cache_read_input_tokens??h.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(h.cache_creation_input_tokens??h.cache_write_input_tokens??0);const y=Qx(h);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof h.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(h.reasoning_output_tokens)),m.usageByModel=U4(r.usageByModel)}}return e}const f=G4(e,r,a);f.provider||(f.provider=r.provider==="codex"?"codex":"claude");const p=hA(r);switch(p&&(f.model=p),i){case"SessionStart":{const h=Ni(e,c,a,!1);h.synthetic=!1,h.state="active",h.closedAt=void 0,h.endedAt=void 0,h.startedAt=Math.min(h.startedAt??a,a),!h.cwd&&r.cwd&&(h.cwd=r.cwd,h.cwdBasename=Ea(r.cwd)),h.label==="session"&&r.cwd&&(h.label=Ea(r.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===c&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<a&&(y.exitAt=a);const h=Ni(e,c,a,!1);h.state="active",h.endedAt=void 0,h.closedAt=void 0,h.exitAt=void 0;const m=(typeof r.prompt=="string"?r.prompt:typeof r.message=="string"?r.message:"")??"";m&&!J4(h,a,m)&&(h.prompts.push({at:a,text:m}),!h.firstPrompt&&!Zx(m)&&(h.firstPrompt=nd(m,120)));break}case"PreToolUse":{const h=r.tool_use_id?Q4(e,f,r.tool_use_id):null;if(h){r.tool_name&&h.name==="?"&&(h.name=r.tool_name),h.endedAt==null&&!h.trimmed&&r.tool_input!==void 0&&(h.input=r.tool_input,h.inputPreview=nd(r.tool_input));break}const m=r.tool_use_id??`${f.id}:${f.toolCount}`,y=Jl(r),w={id:m,name:r.tool_name??"?",input:r.tool_input,inputPreview:nd(r.tool_input),agentId:f.id,explicitSubagentId:y?Oi(c,y):void 0,startedAt:a};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(Ca(f.sessionId,m),w),Z4(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=r.tool_use_id;if(!h)break;const m=Ca(c,h);let y=e.toolIndex.get(m),w=!1;if(!y)for(const _ of e.agents.values()){if(_.sessionId!==c)continue;const S=_.tools.find(b=>b.id===h);if(S){y=S,w=!0;break}}if(!y||y.outcomeApplied)break;y.outcomeApplied=!0,y.outcomeGap=void 0,y.endedAt=a,y.ok=i==="PostToolUse",y.trimmed||(y.response=r.tool_response),i==="PostToolUseFailure"?y.errorPreview=nd(r.tool_response):w&&(y.errorPreview=void 0);const N=dA(r.tool_response);N&&(y.usage=N),e.toolIndex.delete(m);break}case"SubagentStart":{const h=Jl(r);if(!h)break;const m=V4(e,c,h,r,a),y=Fd(r);y&&(m.label=y);const w=e.subagentTombstones.get(m.id);w!=null&&e.subagentTombstones.delete(m.id);const N=m.endedAt!=null&&a-m.endedAt<=rd,_=w!=null&&a-w<=rd;if(N||_){const S=_?w:m.endedAt;m.state="done",m.endedAt=S,m.startedAt=Math.min(m.startedAt,S),b1(e,c,h);break}m.state="active",m.startedAt=m.startedAt||a,m.exitAt=void 0,m.endedAt=void 0,K4(e,c,h);break}case"SubagentStop":{const h=Jl(r);if(!h)break;const m=fA(e,c,h,r);if(!m){for(const[y,w]of e.subagentTombstones)a-w>rd&&e.subagentTombstones.delete(y);e.subagentTombstones.set(Oi(c,h),a);break}m.state="done",m.endedAt=Math.min(m.endedAt??a,a),b1(e,c,h);break}case"Stop":case"SessionEnd":{const h=Ni(e,c,a,!1),m=e5(h);if(a<m)break;const y=h.lastTurnEndAt;if(y!=null&&m>y&&a<=y+rd)break;h.state="done",h.endedAt=a,h.lastTurnEndAt=a;for(const w of h.provider==="codex"?[]:e.agents.values())if(w.sessionId===c)for(const N of w.tools)N.endedAt==null&&N.explicitSubagentId==null&&(N.endedAt=a,N.ok=!1,N.errorPreview=N.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"the turn ended before this call returned",e.toolIndex.delete(Ca(w.sessionId,N.id)));i==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(c);break}case"Notification":{const h=i5(r.notification_type);if(!h)break;const m=Ni(e,c,a,!1),y=typeof r.message=="string"?r.message:"",w=m.waiting;m.waiting=w&&w.kind===h&&w.message===y?{...w,since:Math.min(w.since,a)}:h5(e,c,h,y,a);break}}return e}const p5=6e4,j1=64;function Bd(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 m5={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},g5=[{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:m5},{match:/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]opus[-_]4(?:[-_.]1)?\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}},{match:/^claude[-_]sonnet[-_]4[-_.](?:5|6)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]sonnet[-_]4\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]haiku[-_]4[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}},{match:/^claude[-_]haiku[-_]3[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:.8,output:4,cacheRead:.08,cacheWrite:1,cacheWrite1h:1.6}},{match:/^gpt[-_]6[-_]astra\b(?![-_][A-Za-z])/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5}},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,rates:{input:12.5,output:75,cacheRead:1.25,cacheWrite:15.625}},{match:/^gpt[-_]5[-_.]6[-_]luna/i,rates:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25}},{match:/^gpt[-_]5[-_.]6[-_]terra/i,rates:{input:2,output:12,cacheRead:.2,cacheWrite:2.5}},{match:/^gpt[-_]5[-_.]6(?:[-_]sol)?\b(?![-_][A-Za-z])/i,rates:{input:4,output:20,cacheRead:.4,cacheWrite:5}},{match:/^gpt[-_]5[-_.]5[-_]pro/i,rates:{input:30,output:180,cacheRead:30,cacheWrite:0}},{match:/^gpt[-_]5[-_.]5\b(?![-_][A-Za-z])/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]pro/i,rates:{input:30,output:180,cacheRead:3,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]mini/i,rates:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]nano/i,rates:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4\b/i,rates:{input:2.5,output:15,cacheRead:.25,cacheWrite:0}},{match:/^gpt[-_]5[-_.]3[-_]codex/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2[-_]pro/i,rates:{input:21,output:168,cacheRead:21,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2\b/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1[-_]codex[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1(?!\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^gpt[-_]5[-_]pro\b/i,rates:{input:15,output:120,cacheRead:15,cacheWrite:0}},{match:/^gpt[-_]5[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_]nano/i,rates:{input:.05,output:.4,cacheRead:.005,cacheWrite:0}},{match:/^gpt[-_]5(?![-_.]\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^codex[-_]mini/i,rates:{input:1.5,output:6,cacheRead:.375,cacheWrite:0}},{match:/^o1[-_]pro/i,rates:{input:150,output:600,cacheRead:150,cacheWrite:0}},{match:/^o1[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o1\b/i,rates:{input:15,output:60,cacheRead:7.5,cacheWrite:0}},{match:/^o3[-_]deep[-_]research/i,rates:{input:10,output:40,cacheRead:2.5,cacheWrite:0}},{match:/^o3[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o3[-_]pro/i,rates:{input:20,output:80,cacheRead:20,cacheWrite:0}},{match:/^o4[-_]mini[-_]deep[-_]research/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}},{match:/^o4[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0}},{match:/^o3\b/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}}];function y5(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function zi(e,t=Date.now()){if(!e)return null;const n=bc(e);for(const r of g5)if(r.match.test(n))return typeof r.rates=="function"?r.rates(t):r.rates;return null}function mA(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),r=Math.max(0,e.cacheCreate5mTokens??0),a=Math.max(0,e.cacheCreateTokens-n-r),i=r+a,c=t.cacheWrite1h??t.cacheWrite;return{tokens5m:i,tokens1h:n,usd5m:i*t.cacheWrite/1e6,usd1h:n*c/1e6}}function gA(e,t,n=Date.now()){if(!y5(t))return e.inputTokens;const r=zi(t,n),a=((r==null?void 0:r.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-a)}function Jx(e,t,n=Date.now()){const r=zi(t,n);if(!r)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=gA(e,t,n)*r.input/1e6,i=e.outputTokens*r.output/1e6,c=e.cacheReadTokens*r.cacheRead/1e6,u=mA(e,r),f=u.usd5m+u.usd1h;return{input:a,output:i,cacheRead:c,cacheWrite:f,total:a+i+c+f}}const E1=2e5,w5=1e6,v5=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],x5=[{match:/^gpt[-_]6[-_]astra/i,window:105e4},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,window:4e5},{match:/^gpt[-_]5[-_.]6/i,window:105e4},{match:/^gpt[-_]5[-_.]5/i,window:105e4},{match:/^gpt[-_]5[-_.]4[-_](?:mini|nano)/i,window:4e5},{match:/^gpt[-_]5[-_.]4/i,window:105e4},{match:/^gpt[-_]5[-_.]3[-_]codex[-_]spark/i,window:128e3},{match:/^gpt[-_]5[-_.]3[-_]codex/i,window:4e5},{match:/^gpt[-_]5[-_.]2/i,window:4e5},{match:/^gpt[-_]5/i,window:4e5},{match:/^codex[-_]mini/i,window:2e5},{match:/^o\d/i,window:2e5}];function b5(e){if(!e)return E1;const t=bc(e);for(const n of v5)if(n.test(t))return w5;for(const n of x5)if(n.match.test(t))return n.window;return E1}function yA(e,t){return typeof e=="number"&&e>0?e:b5(t)}const ki="not priced";function _t(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 e0(e,t){if(e<=0||t<10)return null;const n=e/t,r=n*60;return r>=.01?`${_t(r)}/min`:`${_t(n*3600)}/hr`}function k5(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 _5(e,t){let n=0,r=0,a=0,i=0,c=0,u=0;for(const m of t)n+=m.inputTokens,r+=m.outputTokens,a+=m.cacheReadTokens,i+=m.cacheCreateTokens,c+=m.cacheCreate1hTokens??0,u+=m.cacheCreate5mTokens??0;const f=(m,y)=>Math.max(0,m-y),p={inputTokens:f(e.inputTokens,n),outputTokens:f(e.outputTokens,r),cacheReadTokens:f(e.cacheReadTokens,a),cacheCreateTokens:f(e.cacheCreateTokens,i)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=f(e.cacheCreate1hTokens??0,c),p.cacheCreate5mTokens=f(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function _c(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const r=n.map(i=>({model:i,usage:t[i]})),a=_5(e.usage,r.map(i=>i.usage));if(a){const i=r.findIndex(c=>c.model===e.model);i>=0?r[i]={model:r[i].model,usage:k5(r[i].usage,a)}:r.push({model:e.model,usage:a})}return r}function Zn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const r of _c(e)){const a=Jx(r.usage,r.model,t);n.input+=a.input,n.output+=a.output,n.cacheRead+=a.cacheRead,n.cacheWrite+=a.cacheWrite,n.total+=a.total}return n}function zd(e,t=Date.now()){let n=0;for(const r of _c(e))zi(r.model,t)==null&&(n+=r.usage.inputTokens+r.usage.outputTokens);return n}function wA(e){const t=[];for(const n of _c(e)){if(!n.model||t.includes(n.model))continue;const r=n.usage;r.inputTokens+r.outputTokens+r.cacheReadTokens+r.cacheCreateTokens<=0||t.push(n.model)}return t}function vA(e){return wA(e).filter(t=>t!==e.model)}const N5=new Set(["untrusted","on-request","on-failure"]);function S5(e){return typeof e!="string"||!e?null:N5.has(e)?!0:e==="never"?!1:null}function j5(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=S5(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 C1(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function go(e){const t=bc(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=C1(n[1]),i=n[2].replace(/[-_]/g,".");return`${a} ${i}`}const r=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(r){const a=r[1].replace(/[-_]/g,"."),i=r[2].split(/[-_]/).filter(Boolean).map(C1);return[`GPT-${a}`,...i].join(" ")}return e}function ch(e){const t=bc(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function xo(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function vp(e){const t=[];for(const n of e)n.kind==="root"&&xo(n.waiting)&&t.push({id:n.id,label:n.label,waiting:n.waiting});return t.sort((n,r)=>n.waiting.since-r.waiting.since)}function E5(e,t){if(e.length===0)return null;const n=e.findIndex(r=>r.id===t);return e[(n+1)%e.length]}function C5(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function uh(e,t){return`${e}@${t.since}`}function xA(e,t){if(!e.tool)return null;const{name:n,preview:r}=e.tool,a=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return r?a?r:`${n} · ${r}`:a?null:n}function T5(e){const t=e.message||"Needs your permission",n=xA(e,t);return n?`${t}
60
+ Likely on: ${n}`:t}function A5(e,t,n,r=!0){if(!r)return[];if(n)return[];const a=[];for(const i of e){if(!xo(i.waiting))continue;const c=uh(i.id,i.waiting);t.has(c)||a.push({key:c,title:i.label,body:T5(i.waiting),sessionId:i.id})}return a}function R5(e,t,n){const r=new Set;for(const i of e)r.add(uh(i.id,i.waiting));const a=new Set;for(const i of n)r.has(i)&&a.add(i);for(const i of t)a.add(i.key);return a}function xp(e){return new Set(e.map(t=>uh(t.id,t.waiting)))}function M5(e,t){return e!==t}function I5(e,t){return!e&&t!=null}function $5(e,t){return e!==null&&t!=null}function bn(e){const t=Math.round(e);return t<1e3?`${t}`:t<1e6?`${(t/1e3).toFixed(1)}k`:t<1e9?`${(t/1e6).toFixed(2)}M`:`${(t/1e9).toFixed(2)}B`}function Ud(e,t,n){const r=(t??n)-e;if(r<1e3)return`${Math.max(0,r)}ms`;const a=Math.floor(r/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60),c=a%60;return`${i}m ${String(c).padStart(2,"0")}s`}function bA(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 kA(e,t){const n=typeof e=="string"?e.trim():"",r=typeof t=="string"?t.trim():"";return{face:n||r||void 0,tooltip:r||n||void 0}}const O5=1;function P5(){const e=[];let t=0;function n(){let r;for(const a of e)(!r||a.layer>r.layer||a.layer===r.layer&&a.seq>r.seq)&&(r=a);return r}return{push(r,a=0){const i={dismiss:r,layer:a,seq:t++};return e.push(i),()=>{const c=e.indexOf(i);c!==-1&&e.splice(c,1)}},dismissTop(){const r=n();return r?(r.dismiss(),!0):!1},isTop(r){const a=n();return a!=null&&a.dismiss===r},depth(){return e.length}}}const Wd=P5();function L5(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function T1(e){return String(e.tagName??"").toUpperCase()==="BODY"}function D5(e,t){return!e||!e.isConnected||T1(e)?!1:t==null||T1(t)}const A1="a[href], button, input, select, textarea, [tabindex]";function q5(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function F5(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function B5({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 dh(e){return e.ctrlKey||e.metaKey||e.altKey}const z5=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),U5=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),W5=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function t0(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function H5(e){return t0(e)==="BUTTON"?!0:(typeof e.role=="string"?e.role.trim().toLowerCase():"").split(/\s+/).includes("button")}function n0(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=t0(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!z5.has(String(e.type??"text").toLowerCase())}function G5(e,t){if(!e)return!1;if(n0(e))return!0;if(t!=null&&t.length===1&&t!==" "&&e.pointerFocused&&H5(e))return!1;if(U5.has(t0(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>W5.has(r))}function V5({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function _A(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(A1))return q5({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&F5({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(A1)!=null})}):[]}function K5(e,t){const n=_A(e);if(!t||!e.contains(t)||n.includes(t))return n;const r=n.findIndex(a=>(t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return r===-1?[...n,t]:[...n.slice(0,r),t,...n.slice(r)]}function fn(e,t={}){const{focusRef:n,layer:r}=t,a=x.useRef(null),i=x.useRef(e);i.current=e;const c=x.useRef(null);c.current===null&&(c.current=()=>i.current());const u=c.current;return x.useEffect(()=>Wd.push(u,r),[u,r]),x.useEffect(()=>{var p;const f=document.activeElement;return(p=(n==null?void 0:n.current)??_A(a.current)[0])==null||p.focus(),()=>{D5(f,document.activeElement)&&f.focus()}},[]),x.useEffect(()=>{const f=p=>{var _;if(p.key!=="Tab"||dh(p))return;const h=a.current;if(!h)return;const m=document.activeElement;if(!(m!=null&&h.contains(m))&&!Wd.isTop(u))return;const w=K5(h,m),N=B5({count:w.length,index:m?w.indexOf(m):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((_=w[N.index])==null||_.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[u]),a}function Y5(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 cr(e){return e.toLocaleString()}function X5(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const Z5=60;function Q5(e,t=Z5){if(e.length<=t)return e;const n=e.slice(e.length-(t-1)),r=n.search(/[/\\]/);return"…"+(r===-1?n:n.slice(r))}function J5({agent:e,onClose:t}){var y;const n=x.useRef(null),r=fn(t,{focusRef:n}),a=e.context,i=e.usage,c=(a==null?void 0:a.currentContextTokens)??0,u=yA(e.contextWindow,e.model),f=Math.min(100,c/u*100),p=Zn(e),h=e.provider==="codex"?i.inputTokens+i.outputTokens:i.inputTokens+i.outputTokens+i.cacheReadTokens+i.cacheCreateTokens,m=Y5(e.provider);return l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:r,className:"modal ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[l.jsxs("header",{className:"ctx-modal-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),l.jsx("div",{className:"ctx-modal-sub",children:m.subtitle})]}),l.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),l.jsxs("section",{className:"ctx-window-row",children:[l.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:l.jsx("div",{className:"ctx-window-fill",style:{transform:`scaleX(${Math.min(100,Math.max(0,f))/100})`}})}),l.jsxs("div",{className:"ctx-window-meta",children:[l.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),l.jsxs("span",{children:[cr(c)," / ",cr(u)," tok (",m.windowScope,")"]})]})]}),l.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),l.jsxs("div",{className:"ctx-grid",children:[l.jsx(Rr,{label:"input tokens",val:cr(i.inputTokens)}),l.jsx(Rr,{label:"output tokens",val:cr(i.outputTokens)}),l.jsx(Rr,{label:"cache reads",val:cr(i.cacheReadTokens)}),l.jsx(Rr,{label:"cache writes",val:cr(i.cacheCreateTokens)}),l.jsx(Rr,{label:"cumulative total",val:cr(h)}),l.jsx(Rr,{label:"estimated cost",val:_t(p.total),accent:!0})]}),l.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),m.compositionCounted?l.jsxs("div",{className:"ctx-grid",children:[l.jsx(Rr,{label:"user messages",val:cr((a==null?void 0:a.msgsUser)??0)}),l.jsx(Rr,{label:"assistant messages",val:cr((a==null?void 0:a.msgsAssistant)??0)}),l.jsx(Rr,{label:"tool uses",val:cr((a==null?void 0:a.toolUses)??0)}),l.jsx(Rr,{label:"tool results",val:cr((a==null?void 0:a.toolResults)??0)}),l.jsx(Rr,{label:"system-reminders",val:cr((a==null?void 0:a.systemReminders)??0)})]}):l.jsx("div",{className:"ctx-empty",children:m.compositionUncounted}),l.jsx("h3",{className:"ctx-section-title",children:m.memoryHeading}),(((y=a==null?void 0:a.memoryFiles)==null?void 0:y.length)??0)===0?l.jsx("div",{className:"ctx-empty",children:m.memoryEmpty}):l.jsx("ul",{className:"ctx-md-list",children:a.memoryFiles.map(w=>l.jsxs("li",{children:[l.jsx("span",{className:"ctx-md-path",title:w.path,children:Q5(w.path)}),l.jsx("span",{className:"ctx-md-size",children:X5(w.bytes)})]},w.path))})]})})}function Rr({label:e,val:t,accent:n}){return l.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[l.jsx("span",{className:"ctx-row-label",children:e}),l.jsx("span",{className:"ctx-row-val",children:t})]})}function e6({currentContextTokens:e,modelId:t,contextWindow:n,size:r=26,onClick:a}){const i=yA(n,t),c=Math.min(1,e/i),u=r/2-3,f=r/2,p=2*Math.PI*u,h=p*c,m=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return l.jsx("button",{type:"button",className:"ctx-donut",onClick:a,title:`context: ${e.toLocaleString()} / ${i.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":`Context ${Math.round(c*100)}% of ${i.toLocaleString()} tokens — show breakdown`,children:l.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,children:[l.jsx("circle",{cx:f,cy:f,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),l.jsx("circle",{cx:f,cy:f,r:u,stroke:m,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${p-h}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),l.jsx("text",{x:f,y:f+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}const R1=new Map;function NA(e){let t=R1.get(e);return t||(t={now:Date.now(),listeners:new Set,timer:null},R1.set(e,t)),t}function t6(e,t){const n=NA(e);return n.listeners.add(t),n.timer===null&&(n.now=Date.now(),n.timer=setInterval(()=>{n.now=Date.now();for(const r of n.listeners)r()},e)),()=>{n.listeners.delete(t),n.listeners.size===0&&n.timer!==null&&(clearInterval(n.timer),n.timer=null)}}function n6(e){return NA(e).now}const M1=new Map,I1=new Map;function hh(e=1e3){let t=M1.get(e);t||(t=r=>t6(e,r),M1.set(e,t));let n=I1.get(e);return n||(n=()=>n6(e),I1.set(e,n)),x.useSyncExternalStore(t,n,n)}function fh(e){const t=e.recap;if(e.kind!=="root"||!t||e.state==="active"||e.closedAt!=null)return null;for(const n of e.prompts)if(n.at>t.at)return null;return t}const r6="1",$1="agent-dag.schema",s6=["agent-dag.layout","agent-dag.viewport"];function bo(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function a6(e,t=r6){let n=null;try{n=e.getItem($1)}catch{return[]}if(n===t)return[];const r=[];if(n!==null)for(const a of s6)try{e.getItem(a)!==null&&(e.removeItem(a),r.push(a))}catch{}try{e.setItem($1,t)}catch{}return r}const SA="agent-dag.recapsDismissed",O1=200;function o6(){const e=bo(SA);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}let Pi=new Set(o6());const gx=new Set;let jA=0;function EA(e){return gx.add(e),()=>{gx.delete(e)}}function CA(e){if(Pi=e,jA++,typeof window<"u")try{const t=Array.from(e);window.localStorage.setItem(SA,JSON.stringify(t.length>O1?t.slice(-O1):t))}catch{}for(const t of gx)t()}function TA(e,t){return`${e}@${t}`}function i6(e){return Pi.has(e)}function l6(e){if(Pi.has(e))return;const t=new Set(Pi);t.add(e),CA(t)}function c6(e){const t=new Set(Pi);t.delete(e)||t.add(e),CA(t)}function u6(e){return x.useSyncExternalStore(EA,()=>e!=null&&Pi.has(e),()=>!1)}function r0(e){return`recap:${e}`}function d6(e){return e.startsWith("recap:")}function h6(){return x.useSyncExternalStore(EA,()=>jA,()=>0)}function P1(e,t){const n=zi(t);if(!n)return`model: ${t}
61
+ no published rate in this build — the tokens are counted, the dollars are not`;const r=h=>h.toLocaleString(),a=h=>`$${h}/MTok`,i=Jx(e,t),c=mA(e,n),u=c.tokens1h>0?[`cache w5m${r(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${_t(c.usd5m)}`,`cache w1h${r(c.tokens1h).padStart(14)} × ${a(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${_t(c.usd1h)}`]:[`cache w ${r(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${_t(c.usd5m)}`],f=gA(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${r(f).padStart(14)} × ${a(n.input).padEnd(11)} = ${_t(i.input)}`,`output ${r(e.outputTokens).padStart(14)} × ${a(n.output).padEnd(11)} = ${_t(i.output)}`,`cache r ${r(e.cacheReadTokens).padStart(14)} × ${a(n.cacheRead).padEnd(11)} = ${_t(i.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${_t(i.total)}`].join(`
62
+ `)}function L1(e){const t=_c(e);return t.length<=1?P1(e.usage,e.model):[...t.map(n=>P1(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${_t(Zn(e).total)}`].join(`
63
+ `)}function f6({data:e,selected:t}){var S,b;const n=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),r=e.tools.filter(j=>!j.endedAt).length,a=e.tools.filter(j=>j.ok===!1).length,i=Bd(e.sessionId),c=((S=e.context)==null?void 0:S.currentContextTokens)??0,u=e.kind==="root"&&c>0,f=e.sessionTitle?e.cwd?`${e.cwd}
64
+ ${e.sessionTitle}`:e.sessionTitle:e.cwd,p=vA(e),h=p.length>0?`${e.model}
65
+ spend on this card also covers:
66
+ ${p.join(`
67
+ `)}`:e.model,m=kA(e.sessionName,e.sessionTitle),y=fh(e),w=y?TA(e.sessionId,y.at):null,N=u6(w),_=y!=null&&!N;return l.jsxs("div",{className:n,style:{"--session-hue":i},children:[l.jsx("span",{className:"accent-stripe"}),l.jsx(mo,{type:"target",position:Ue.Left,style:{background:"transparent",border:"none"}}),l.jsxs("div",{className:"head",children:[l.jsxs("div",{className:"title",children:[l.jsx(g6,{state:e.state}),l.jsx("span",{className:"label",title:f,children:e.label}),e.synthetic&&l.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"}),y&&w&&l.jsx("button",{type:"button",className:"glyph-btn recap-pin","aria-label":"Claude Code's recap","aria-expanded":_,title:_?"Hide the recap":"Show Claude Code's recap",onClick:j=>{j.stopPropagation(),c6(w)},children:l.jsx(s0,{})})]}),l.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&l.jsx(e6,{currentContextTokens:c,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),l.jsxs("div",{className:"time",title:e.synthetic?`The deck joined this session after it began, so it has run at least this long — first seen ${new Date(e.startedAt).toLocaleTimeString()}`:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:[e.synthetic?"≥ ":"",l.jsx(m6,{start:e.startedAt,end:e.endedAt})]})]})]}),l.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&l.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?l.jsxs("span",{className:"model-chip","data-family":ch(e.model),title:h,children:[go(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?l.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&m.face&&l.jsx("div",{className:"session-name",title:m.tooltip,children:m.face}),e.waiting&&l.jsx(x6,{waiting:e.waiting}),(()=>{const j=j5(e);return j?l.jsxs("div",{className:"approval-blind-row",title:j.detail,children:[l.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),l.jsx("span",{className:"approval-blind-said",children:j.label})]}):null})(),(e.tools.length>0||(((b=e.outputs)==null?void 0:b.length)??0)>0)&&l.jsx(b6,{tools:e.tools,outputs:e.outputs}),l.jsxs("div",{className:"meta",children:[l.jsxs("span",{children:[l.jsx("b",{children:e.toolCount})," tools"]}),a>0&&l.jsxs("span",{className:"failed-meta",title:`${a} tool ${a===1?"call":"calls"} returned an error`,children:[l.jsx("b",{children:a})," err"]}),r>0&&l.jsxs("span",{className:"inflight-meta",children:[l.jsx("b",{children:r})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&l.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:[l.jsx("b",{children:bn(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const j=zi(e.model),E=Zn(e),C=zd(e);if(!j&&E.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:l.jsx("span",{className:"cost-unpriced",title:L1(e),children:ki});if(E.total<=0)return null;const T=Math.max(0,((e.endedAt??Date.now())-e.startedAt)/1e3),R=e.state==="active"&&!e.synthetic?e0(E.total,T):null,$=L1(e)+(R?`
68
+ burn: ${R}`:"");return l.jsx("span",{className:"cost-meta",title:$,children:l.jsxs("b",{children:[_t(E.total),C>0?"+":""]})})})()]}),l.jsx(mo,{type:"source",position:Ue.Right,style:{background:"transparent",border:"none"}})]})}const p6=x.memo(f6);function m6({start:e,end:t}){const n=hh(1e3);return l.jsx(l.Fragment,{children:Ud(e,t,n)})}function uc(e){return e==="active"?"live":e==="done"?"done":"err"}function g6({state:e}){return l.jsx("span",{className:`state-pill state-${e}`,children:uc(e)})}function Li(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function y6(e,t=Date.now()){const n=e.tools.filter(a=>a.ok===!1).length,r=Zn(e,t).total;return[e.label,e.kind==="root"?"session":"subagent",uc(e.state),xo(e.waiting)?Li(e.waiting):null,e.model?go(e.model):null,`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,n>0?`${n} failed`:null,r>0?`${_t(r)}${zd(e,t)>0?"+":""}`:null].filter(Boolean).join(", ")}function w6(e,t){const n=xA(e,t);return n?`Likely on: ${n}`:null}function v6(e){return e.kind==="idle"?"Your turn":Li(e)}function x6({waiting:e}){const t=hh(1e3),n=xo(e),r=Li(e);return l.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${r}
69
+ Blocked for ${Ud(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?l.jsx("span",{className:"ap-pulse","aria-hidden":!0}):l.jsx("span",{className:"waiting-dot","aria-hidden":!0}),l.jsx("span",{className:"waiting-said",children:v6(e)}),l.jsx("b",{children:Ud(e.since,void 0,t)})]})}function s0(){return l.jsxs("svg",{className:"recap-glyph",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true",focusable:"false",children:[l.jsx("path",{d:"M3.3 3.3l5.4 5.4M8.7 3.3l-5.4 5.4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",fill:"none"}),l.jsx("circle",{cx:"6",cy:"1.2",r:"1.05",fill:"currentColor"}),l.jsx("circle",{cx:"6",cy:"10.8",r:"1.05",fill:"currentColor"}),l.jsx("circle",{cx:"1.2",cy:"6",r:"1.05",fill:"currentColor"}),l.jsx("circle",{cx:"10.8",cy:"6",r:"1.05",fill:"currentColor"})]})}function b6({tools:e,outputs:t}){const n=hh(1e3),r=6e4,a=24,i=r/a,c=new Array(a).fill(0);let u=0;const f=E=>{const C=n-E;if(C<0||C>=r)return;const T=a-1-Math.floor(C/i);T>=0&&T<a&&(c[T]+=1,u+=1)};for(const E of e)f(E.startedAt);for(const E of t??[])f(E);const p=2,h=Math.max(0,...c),m=132,y=14,w=m/a,N=h/(i/1e3),_=e.filter(E=>n-E.startedAt>=0&&n-E.startedAt<r).length,S=u-_,b=[_>0?`${_} tool ${_===1?"call":"calls"}`:"",S>0?`${S} ${S===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),j=u===0?"nothing in the last 60s":`${b.join(" · ")} in last 60s · peak ${N.toFixed(1)}/s`;return l.jsxs("div",{className:"tool-spark-row",title:j,children:[l.jsx("svg",{className:"tool-spark",width:m,height:y,viewBox:`0 0 ${m} ${y}`,"aria-hidden":!0,children:c.map((E,C)=>{const T=E===0?1.5:Math.max(1.5,Math.min(1,E/p)*y),R=C===a-1&&E>0,D=`tool-spark-bar${E>0?" active":""}${R?" latest":""}`;return l.jsx("rect",{x:C*w+.4,y:y-T,width:Math.max(.5,w-1),height:T,rx:.8,className:D},R?`landed:${E}`:C)})}),l.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function k6(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function bp(e){return e!=="gone"}function kp(e,t){const[n,r]=x.useState(()=>e?"here":"gone"),a=x.useRef(null);return x.useEffect(()=>{r(i=>k6(e,i))},[e]),x.useEffect(()=>{if(n==="leaving")return a.current=window.setTimeout(()=>r("gone"),t),()=>{a.current!=null&&window.clearTimeout(a.current)}},[n,t]),x.useEffect(()=>{n==="entering"&&r("here")},[n]),n}async function ph(e,t=500){var r;if(!e)return!1;let n=!1;try{n=await Promise.race([((r=navigator.clipboard)==null?void 0:r.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(a=>window.setTimeout(()=>a(!1),t))])}catch{n=!1}if(n)return!0;try{const a=document.createElement("textarea");a.value=e,a.setAttribute("readonly",""),a.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(a),a.select(),n=document.execCommand("copy"),a.remove()}catch{n=!1}return n}const _6=60,N6=6e3,ds=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),Gn=e=>typeof e=="string"?e:null;function yo(e,t=""){if(e==null)return"(none)";if(typeof e=="string")return e;if(typeof e!="object")return String(e);const n=Array.isArray(e),r=n?e.map((i,c)=>[String(c),i]):Object.entries(e);if(r.length===0)return n?"[]":"{}";const a=[];for(const[i,c]of r){const u=n?`${t}-`:`${t}${i}:`;if(typeof c=="string"&&c.includes(`
70
+ `)){a.push(u);for(const f of c.split(`
71
+ `))a.push(`${t} ${f}`)}else if(c!==null&&typeof c=="object"){const f=yo(c,`${t} `);f==="[]"||f==="{}"?a.push(`${u} ${f}`):a.push(u,f)}else a.push(`${u} ${c===void 0?"(none)":String(c)}`)}return a.join(`
72
+ `)}function S6(e){return e.lines??e.text.split(`
73
+ `).map(t=>({text:t}))}function j6(e,t){if(t)return{shown:e,cut:!1};const n=[];let r=0;for(const a of e){if(n.length===_6)return{shown:n,cut:!0};const i=N6-r;if(a.text.length>i)return n.push({...a,text:`${a.text.slice(0,Math.max(i,0))}…`}),{shown:n,cut:!0};n.push(a),r+=a.text.length+1}return{shown:n,cut:!1}}const En=(e,t,n=!1)=>({...e?{label:e}:{},text:t,...n?{err:!0}:{}}),Vn=(e,t)=>({label:e,text:t,inline:!0}),AA=(e,t)=>({label:e,text:t.map(n=>n.text).join(`
74
+ `),lines:t});function E6(e,t){return[...e.split(`
75
+ `).map(n=>({text:`- ${n}`,tone:"del"})),...t.split(`
76
+ `).map(n=>({text:`+ ${n}`,tone:"add"}))]}function C6(e){if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const n of e){if(!ds(n)||!Array.isArray(n.lines))return null;t.push({text:`@@ -${n.oldStart},${n.oldLines} +${n.newStart},${n.newLines} @@`,tone:"ctx"});for(const r of n.lines){const a=String(r);t.push(a.startsWith("+")?{text:a,tone:"add"}:a.startsWith("-")?{text:a,tone:"del"}:{text:a})}}return t}function D1(e){if(typeof e=="string")return[En(void 0,e)];if(!ds(e))return[En(void 0,yo(e))];const t=[],n=Gn(e.type);n==="create"&&t.push(Vn("result","created the file"));const r=C6(e.structuredPatch);return r&&t.push(AA("applied",r)),e.userModified===!0&&t.push(Vn("note","the user changed it before it was applied")),t.length?t:[Vn("result",n==="update"?"updated the file":"done")]}function T6(e){const t=typeof e.offset=="number"?e.offset:null,n=typeof e.limit=="number"?e.limit:null;if(t==null&&n==null)return null;const r=t??1;return n!=null?`${r}–${r+n-1}`:`from ${r}`}function A6(e){if(typeof e=="string")return[En(void 0,e)];const t=ds(e)&&ds(e.file)?e.file:null,n=Gn(t==null?void 0:t.content);if(t&&n!=null){const a=[],i=Number(t.numLines),c=Number(t.totalLines),u=Number(t.startLine);return Number.isFinite(i)&&Number.isFinite(c)&&c>0&&a.push(Vn("lines",i>=c?`all ${c}`:Number.isFinite(u)?`${u}–${u+i-1} of ${c}`:`${i} of ${c}`)),a.push(En("content",n)),a}const r=ds(e)?Gn(e.type):null;return r&&r!=="text"?[Vn("result",`${/^[aeiou]/i.test(r)?"an":"a"} ${r} file`)]:[En(void 0,yo(e))]}function R6(e){if(typeof e=="string")return[En("output",e)];if(!ds(e))return[En(void 0,yo(e))];const t=Gn(e.stdout),n=Gn(e.stderr);if(t==null&&n==null)return[En(void 0,yo(e))];const r=[];return t&&r.push(En("output",t.replace(/\n$/,""))),n&&r.push(En("errors",n.replace(/\n$/,""),!0)),e.interrupted===!0&&r.push(Vn("note","interrupted before it finished")),r.length?r:[Vn("output","none")]}function M6(e,t,n){const r=ds(t)?t:null;if(r&&(e==="Edit"||e==="MultiEdit")){const a=Gn(r.file_path),i=(e==="MultiEdit"?Array.isArray(r.edits)?r.edits:[]:[r]).filter(ds).filter(c=>Gn(c.old_string)!=null&&Gn(c.new_string)!=null);if(a&&i.length){const c=[Vn("file",a)];return i.forEach((u,f)=>{const p=u.replace_all===!0?", every occurrence":"";c.push(AA(i.length>1?`change ${f+1}${p}`:`change${p}`,E6(u.old_string,u.new_string)))}),{input:c,response:D1(n)}}}if(r&&e==="Write"){const a=Gn(r.file_path),i=Gn(r.content);if(a&&i!=null)return{input:[Vn("file",a),En("content",i)],response:D1(n)}}if(r&&e==="Read"){const a=Gn(r.file_path);if(a){const i=T6(r);return{input:i?[Vn("file",a),Vn("lines",i)]:[Vn("file",a)],response:A6(n)}}}if(r&&e==="Bash"){const a=Gn(r.command);if(a!=null){const i=Gn(r.description);return{input:i?[En("command",a),Vn("why",i)]:[En("command",a)],response:R6(n)}}}return{input:[En(void 0,yo(t))],response:[En(void 0,yo(n))]}}function q1(e,t,n){if(n==null)return"";if(typeof n=="string")return n;if(ds(n)){if(e==="Bash"&&t==="input"&&typeof n.command=="string")return n.command;if(e==="Bash"&&t==="response"&&(typeof n.stdout=="string"||typeof n.stderr=="string"))return[n.stdout,n.stderr].filter(r=>typeof r=="string"&&r!=="").join(`
77
+ `);if(e==="Read"&&t==="response"&&ds(n.file)&&typeof n.file.content=="string")return n.file.content}try{return JSON.stringify(n,null,2)??String(n)}catch{return String(n)}}function I6({tool:e,onClose:t}){const n=fn(t),r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",a=e.input??e.inputPreview,i=e.response??e.errorPreview,c=M6(e.name,a,i);return l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:n,className:"modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{className:`status-dot ${r}`,"aria-hidden":!0}),l.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),l.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),l.jsxs("div",{className:"modal-actions",children:[l.jsx("span",{className:"modal-dur",children:bA(e,"in-flight…")}),l.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),l.jsxs("section",{className:"modal-body",children:[e.trimmed&&l.jsx("div",{className:"modal-section",children:l.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),l.jsxs("div",{className:"modal-section",children:[l.jsxs("div",{className:"tm-head",children:[l.jsx("h4",{children:"Input"}),l.jsx(B1,{text:q1(e.name,"input",a),what:"input"})]}),c.input.map((u,f)=>l.jsx(F1,{block:u},f))]}),l.jsxs("div",{className:"modal-section",children:[l.jsxs("div",{className:"tm-head",children:[l.jsxs("h4",{children:["Response ",r==="err"&&l.jsx("span",{className:"err-tag",children:"error"})]}),e.endedAt!=null&&l.jsx(B1,{text:q1(e.name,"response",i),what:"response"})]}),e.endedAt==null?l.jsx("pre",{children:"(waiting…)"}):c.response.map((u,f)=>l.jsx(F1,{block:u},f))]})]})]})})}const $6={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function F1({block:e}){const[t,n]=x.useState(!1);if(e.inline)return l.jsxs("p",{className:"tm-inline",children:[e.label&&l.jsx("span",{className:"tm-label",children:e.label}),l.jsx("code",{children:e.text})]});const{shown:r,cut:a}=j6(S6(e),t);return l.jsxs("div",{className:"tm-block",children:[e.label&&l.jsx("span",{className:"tm-label",children:e.label}),l.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?r.map((i,c)=>l.jsxs("span",{className:i.tone?$6[i.tone]:void 0,children:[i.text,c<r.length-1?`
78
+ `:""]},c)):r.map(i=>i.text).join(`
79
+ `)}),a&&l.jsx("button",{type:"button",className:"btn tm-more",onClick:()=>n(!0),children:"show all"})]})}function B1({text:e,what:t}){const[n,r]=x.useState(!1),a=x.useRef(!0);return x.useEffect(()=>()=>{a.current=!1},[]),l.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n?`The ${t} was copied`:`Copy the ${t}`,onClick:()=>void ph(e).then(i=>{!i||!a.current||(r(!0),window.setTimeout(()=>{a.current&&r(!1)},1600))}),children:n?"copied":"copy"})}const sd=18,z1=26,O6=12,P6=240;function L6(e,t){return(e+P6)*(t||1)}function D6(e){return q6(e.nodeInternals.values())}function q6(e){const t=new Map;for(const a of e){if(a.type!=="agent"&&a.type!=="recapNote")continue;const i=a.data;if(!(i!=null&&i.sessionId)||i.exitAt!=null||a.width==null||a.height==null)continue;const c=a.position.x,u=a.position.y,f=c+a.width,p=u+a.height,h=t.get(i.sessionId);h?(h.minX=Math.min(h.minX,c),h.minY=Math.min(h.minY,u),h.maxX=Math.max(h.maxX,f),h.maxY=Math.max(h.maxY,p),i.kind==="root"&&(h.label=H1(i)??h.label),i.kind==="root"&&(h.name=G1(i))):t.set(i.sessionId,{minX:c,minY:u,maxX:f,maxY:p,label:H1(i)??i.sessionId,name:G1(i)})}const n=new Map;for(const a of t.values())n.set(a.label,(n.get(a.label)??0)+1);const r=[];for(const[a,i]of t){const c=(n.get(i.label)??0)>1;r.push({sessionId:a,...z6(i.label,i.name,a,c),x:i.minX-sd,y:i.minY-sd-z1,w:i.maxX-i.minX+sd*2,h:i.maxY-i.minY+sd*2+z1})}return r}const yx=" · ",F6=32,B6=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function U1(e){return B6.test(e)?2:1}function W1(e,t=F6){const n=[...e];let r=0;for(const c of n)r+=U1(c);if(r<=t)return e;const a=[];let i=0;for(const c of n){const u=U1(c);if(i+u>t-1)break;a.push(c),i+=u}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function z6(e,t,n,r){const a=(t==null?void 0:t.trim())??"",i=r?U6(n):void 0,c=[e,a||void 0,i].filter(Boolean);return{label:W1(e),name:a?W1(a):void 0,shortId:i,fullLabel:c.join(yx)}}function U6(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function H1(e){if(e.kind==="root")return e.label}function G1(e){if(e.kind==="root")return kA(e.sessionName,e.sessionTitle).face}function W6({onFit:e}){const{x:t,y:n,zoom:r}=rA(),a=xc(),i=gt(D6,H6);if(i.length<=1)return null;const c=f=>{try{const p=a.getNodes().filter(h=>{const m=h.data;return(m==null?void 0:m.sessionId)===f});if(p.length===0)return;a.fitView({padding:.3,duration:500,nodes:p}),e==null||e()}catch{}},u={transform:`translate(${t}px, ${n}px) scale(${r})`};return l.jsx("div",{className:"session-clusters",style:u,children:i.map(f=>{const p=Bd(f.sessionId),h={position:"absolute",left:0,top:0,transform:`translate(${f.x}px, ${f.y}px)`,width:f.w,height:f.h,"--session-hue":p},m={position:"absolute",left:f.x+16,top:f.y-O6/(r||1),transform:`scale(${1/(r||1)})`,transformOrigin:"left top",maxWidth:L6(f.w,r),"--session-hue":p};return l.jsxs(me.Fragment,{children:[l.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),l.jsxs("button",{type:"button",className:"cluster-label",style:m,title:`Fit view to ${f.fullLabel}
80
+ drag the wrapper to move the whole session`,onClick:()=>c(f.sessionId),children:[f.label,f.name?l.jsx("span",{className:"cluster-label-name",children:yx+f.name}):null,f.shortId?l.jsx("span",{className:"cluster-label-id",children:yx+f.shortId}):null]})]},f.sessionId)})})}function H6(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const r=e[n],a=t[n];if(r.sessionId!==a.sessionId||r.label!==a.label||r.name!==a.name||r.shortId!==a.shortId||r.fullLabel!==a.fullLabel||r.x!==a.x||r.y!==a.y||r.w!==a.w||r.h!==a.h)return!1}return!0}function G6({data:e}){return l.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}function RA(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 _d(e){return RA(Math.floor(e/1e3))}function MA(e,t){const n=e-t;if(n<=0)return null;const r=Math.floor(n/86400),a=Math.floor(n%86400/3600),i=Math.floor(n%3600/60);return r>0?`${r}d ${a}h`:a>0?`${a}h ${i}m`:`${i}m`}function V6(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function wx(e,t,n){const r=new Date(e),a=_d(t-e);return{label:V6(r,new Date(t))?a:`${a} · ${r.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:r.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function K6({data:e}){const t=hh(3e4),n=wx(e.recap.at,t);return l.jsxs("div",{className:"recap-note",role:"note","aria-label":"Claude Code's recap",style:{"--session-hue":e.hue},children:[l.jsxs("div",{className:"recap-note-head",children:[l.jsxs("span",{className:"recap-note-mark",children:[l.jsx(s0,{}),"recap"]}),l.jsx("span",{className:"recap-note-age",title:n.title,children:n.label}),l.jsx("button",{type:"button",className:"glyph-btn recap-note-close","aria-label":"Hide the recap",title:"Hide — the ※ on the card brings it back",onClick:r=>{r.stopPropagation(),l6(e.noteKey)},children:"×"})]}),l.jsx("p",{className:"recap-note-text",children:e.recap.text}),l.jsx(mo,{type:"source",position:Ue.Right,style:{background:"transparent",border:"none"}})]})}function Y6({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a,targetPosition:i,style:c}){const[u]=Hx({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:i,curvature:.35});return l.jsxs("g",{className:"recap-tie",style:c,children:[l.jsx("path",{className:"recap-tie-thread",d:u}),l.jsx("path",{className:"recap-tie-beads",d:u}),l.jsx("circle",{className:"recap-tie-end",cx:e,cy:t,r:3.5}),l.jsx("circle",{className:"recap-tie-end",cx:n,cy:r,r:3.5})]})}const Nc={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"}},X6=Object.fromEntries(Object.entries(Nc).map(([e,t])=>[e,t.category])),Z6=Object.fromEntries(Object.entries(Nc).map(([e,t])=>[e,t.emoji])),Q6=Object.fromEntries(Object.entries(Nc).map(([e,t])=>[e,t.label])),J6=new Set(Object.keys(Nc)),eD=new Set(Object.entries(Nc).filter(([,e])=>e.shell).map(([e])=>e)),V1={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",...X6};function IA(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(V1,e)?V1[e]:"other"}const tD=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,nD=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function rD(e){if(typeof e!="string"||!e)return null;const t=tD.exec(e);if(t){const r=sD(t[2]);if(r.trim())return r}const n=nD.exec(e);return n?n[1]:null}function sD(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
81
+ `:n==="r"?"\r":n==="t"?" ":n)}const $A=600,aD=4,oD=36,vx=16,iD=60,lD=6,K1=220,Y1=96,cD=28,X1={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:"📡",...Z6};function Z1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(X1,e)?X1[e]:"✨"}const Q1={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 OA(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 OA(n[1]);for(;;){const i=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!i)break;t=t.slice(i[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const r=t.match(/^([^\s|;&<>(]+)/);if(!r)return null;let a=r[1];return/^[A-Za-z0-9_][\w.+-]*$/.test(a.replace(/^.*[/\\]/,""))?(a=a.replace(/^.*[/\\]/,""),a=a.replace(/\.(exe|cmd|bat|ps1)$/i,""),a||null):null}function uD(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=rD(t.script);if(n)return n}if(typeof t.cmd=="string")return t.cmd;if(typeof t.command=="string")return t.command;if(Array.isArray(t.command)&&t.command.every(n=>typeof n=="string")){const n=t.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(n[0]??"")){const r=n.findIndex(a=>/^(-Command|-c)$/i.test(a));if(r>=0&&r+1<n.length)return n[r+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const dD=new Set(["Bash","PowerShell",...eD]),hD=J6;function fD(e,t){return hD.has(e)||e.startsWith("mcp__")?Math.max(Y1,34+t.length*7.5):Y1}function pD(e,t){if(!dD.has(e))return null;const n=uD(t);if(!n)return null;const r=OA(n);return r?{emoji:Object.hasOwn(Q1,r)?Q1[r]:"⚙️",label:r,category:"shell",detail:n}:null}const mD=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),J1={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:"🗄️"},e_={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 gD(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),r=n.lastIndexOf("/");return r>=0?n.slice(r+1):n}function yD(e){const t=e.toLowerCase();if(Object.hasOwn(e_,t))return e_[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const n=t.lastIndexOf(".");if(n>0&&n<t.length-1){const r=t.slice(n+1);if(Object.hasOwn(J1,r))return J1[r]}return"📄"}function wD(e,t){if(!t||typeof t!="object")return null;const n=t;if(e==="apply_patch"&&typeof n.patch=="string"){const r=n.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return r?r[1].trim():null}return typeof n.file_path=="string"?n.file_path:typeof n.notebook_path=="string"?n.notebook_path:typeof n.path=="string"?n.path:e==="Glob"&&typeof n.pattern=="string"?n.pattern:null}function vD(e,t){if(!mD.has(e))return null;const n=wD(e,t);if(!n)return null;const r=gD(n);return r?{emoji:e==="LS"?"📂":yD(r),label:r,category:"file",detail:n}:null}const t_={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 a0(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 xD(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 PA(e){const t=e.toLowerCase();return Object.hasOwn(t_,t)?t_[t]:void 0}function bD(e,t){const n=a0(e);if(!n)return null;const{server:r,method:a}=n;if(!a)return null;const i=PA(r);return{emoji:(i==null?void 0:i.emoji)??"🔌",label:a,category:"mcp",detail:i?`${i.name} · ${a}`:`${r} · ${a}`}}function kD(e,t){return pD(e,t)??vD(e,t)??bD(e)}const n_=Q6,r_=18;function _D(e){const t=[...e];return t.length<=r_?e:t.slice(0,r_-1).join("")+"…"}function LA(e){const t=a0(e);if(t){const r=PA(t.server);return r?{emoji:r.emoji,label:r.name}:{emoji:"🔌",label:_D(t.server),hue:xD(t.server)}}const n=Object.hasOwn(n_,e)?n_[e]:"";return n?{emoji:Z1(e),label:n}:{emoji:Z1(e),label:e}}function ND(e){let t=null,n="";for(const r of e){const a=a0(r);if(a){if(!a.server)return null;if(t===null)t=a.server,n=r;else if(a.server!==t)return null}}return t===null?null:LA(n)}function SD(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function jD(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/$A)}function ED(e,t){const n=[],r=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const i=e[a];r.has(i.id)||(r.add(i.id),n.push(i))}return n.reverse()}function CD(e,t,n,r,a,i){const c=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&i-u.exitAt>$A)continue;const f=r.get(u.id)??n.get(u.id);if(!f)continue;const p=ED(u.tools,aD);if(p.length===0)continue;const h=u.exitAt??null,m=a.get(u.id),y=Math.max((m==null?void 0:m.width)??K1,K1),w=(m==null?void 0:m.height)??130,N=f.x,_=f.y,S=N+y,b=_+w/2;p.forEach((j,E)=>{const C=E*oD,T=N+y+iD,R=_+lD+C,$=jD(i,h),D=j.inputPreview??"",W=SD(j),L=$<.999,V=LA(j.name);c.push({id:`${u.id}::${j.id}`,toolId:j.id,agentId:u.id,toolName:j.name,name:V.label,emoji:V.emoji,status:W,category:IA(j.name),mcpHue:V.hue,inputPreview:D,fade:$,fading:L,worldX:T,worldY:R,anchorX:S,anchorY:b,spawnDx:S-T,spawnDy:b-(R+vx)});const Q=kD(j.name,j.input);if(Q){const ee=fD(j.name,V.label),M=T+ee+cD,X=R,H=T+ee,I=R+vx;c.push({id:`sub:${u.id}::${j.id}`,toolId:j.id,agentId:u.id,toolName:j.name,name:Q.label,emoji:Q.emoji,isSub:!0,status:W,category:Q.category,inputPreview:Q.detail??D,fade:$,fading:L,worldX:M,worldY:X,anchorX:H,anchorY:I,spawnDx:H-M,spawnDy:0})}})}return c}function TD({agents:e,visibleAgentIds:t,positions:n,pinned:r,measured:a,spotlight:i,hiddenCategories:c,now:u,onOpenTool:f}){const p=CD(e,t,n,r,a,u),h=c&&c.size>0?p.filter(m=>!c.has(m.category)):p;return l.jsx(AD,{bursts:h,spotlight:i,onOpenTool:f})}function AD({bursts:e,spotlight:t,onOpenTool:n}){const{x:r,y:a,zoom:i}=rA();return l.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[l.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const u=c.anchorX*i+r,f=c.anchorY*i+a,p=(c.worldX+6)*i+r,h=(c.worldY+vx)*i+a,m=Math.max(1,p-u),y=Math.min(1,Math.abs(h-f)/m),w=u+m*(.55-.22*y),N=t!=null&&!t.has(c.agentId),_=c.fade*(N?.14:1);return l.jsx("path",{d:`M ${u} ${f} Q ${w} ${f}, ${p} ${h}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>l.jsx(MD,{b:c,x:r,y:a,zoom:i,dim:t!=null&&!t.has(c.agentId),onOpenTool:n},c.id))]})}function RD(e,t){const n=e.b,r=t.b;return e.x===t.x&&e.y===t.y&&e.zoom===t.zoom&&e.dim===t.dim&&e.onOpenTool===t.onOpenTool&&n.id===r.id&&n.toolId===r.toolId&&n.worldX===r.worldX&&n.worldY===r.worldY&&n.spawnDx===r.spawnDx&&n.spawnDy===r.spawnDy&&n.status===r.status&&n.fading===r.fading&&n.category===r.category&&n.mcpHue===r.mcpHue&&n.isSub===r.isSub&&n.emoji===r.emoji&&n.name===r.name&&n.toolName===r.toolName&&n.inputPreview===r.inputPreview}const MD=x.memo(function({b:t,x:n,y:r,zoom:a,dim:i,onOpenTool:c}){const u=t.worldX*a+n,f=t.worldY*a+r,p={left:`${u}px`,top:`${f}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${t.spawnDx}px`,"--spawn-dy":`${t.spawnDy}px`},h=t.isSub?`${t.toolName} · ${t.name}`:t.toolName,m=t.inputPreview?`${h} · ${t.inputPreview}`:h,y=c!=null,w=t.mcpHue!=null?{"--mcp-hue":t.mcpHue}:{},N=i?" dim":"";return l.jsx("div",{className:"tool-burst-wrap",style:p,children:l.jsxs("div",{className:`tool-burst cat-${t.category}${t.mcpHue!=null?" mcp-hue":""} status-${t.status}${t.fading?" fading":""}${y?" clickable":""}${t.isSub?" sub":""}${N}`,style:w,title:m,onClick:y?()=>c(t.toolId):void 0,children:[l.jsx("span",{className:"tb-emoji",children:t.emoji}),l.jsx("span",{className:"tb-name",children:t.name}),t.status==="inflight"&&l.jsx("span",{className:"tb-spin"}),t.status==="done"&&l.jsx("span",{className:"tb-mark done",children:"✓"}),t.status==="err"&&l.jsx("span",{className:"tb-mark err",children:"×"})]})})},RD);function ID(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,r=0,a=0,i=0;for(const c of e){const u=Zn(c);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=c.usage.inputTokens,r+=c.usage.outputTokens,a+=c.usage.cacheReadTokens,i+=c.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:r,cacheReadTokens:a,cacheCreateTokens:i,sum:n+r}}const $D="spend on this board",OD="on this board",s_=`Everything on the board right now, and only that.
82
+ 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.
83
+ Press H for the totals ccusage reads off the logs on disk, which do not forget.`,DA="session spend";function o0({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const r=(i,c,u)=>{if(i<=0)return null;const f=i/n*100;return l.jsx("span",{className:`cb-seg ${c}`,style:{width:`${f}%`},title:`${u}: ${_t(i)} (${f.toFixed(0)}%)`},c)},a=t==="lg";return l.jsxs("div",{className:a?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function PD({state:e,sessionId:t,onClose:n}){const r=x.useMemo(()=>LD(e,t),[e,t]),a=x.useRef(null),i=fn(n,{focusRef:a});return r?l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:i,className:"modal session-summary",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[l.jsxs("div",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),l.jsx("span",{id:"ss-title",className:"modal-tool-name",title:r.cwd??r.sessionId,children:r.label}),l.jsxs("span",{className:"modal-tool-id",children:["· ",r.sessionId.slice(0,8)]})]}),l.jsxs("div",{className:"modal-actions",children:[l.jsx("span",{className:"modal-dur",title:"Total wall time",children:r.durationLabel}),l.jsx("button",{type:"button",ref:a,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),l.jsxs("div",{className:"modal-body",children:[l.jsxs("section",{className:"ss-hero",children:[l.jsxs("div",{className:"ss-hero-left",children:[l.jsx("div",{className:"ss-cost-label",children:DA}),l.jsx("div",{className:"ss-cost",children:_t(r.cost.total)}),r.modelChips.length>0&&l.jsx("div",{className:"ss-models",children:r.modelChips.map(c=>l.jsx("span",{className:"model-chip","data-family":ch(c),title:c,children:go(c)},c))})]}),l.jsx("div",{className:"ss-hero-right",children:r.cost.total>0&&l.jsxs(l.Fragment,{children:[l.jsx(o0,{cost:r.cost,size:"lg"}),l.jsxs("div",{className:"ss-cost-legend",children:[l.jsxs("span",{className:"ssl ssl-in",children:["input ",l.jsx("b",{children:_t(r.cost.input)})]}),l.jsxs("span",{className:"ssl ssl-out",children:["output ",l.jsx("b",{children:_t(r.cost.output)})]}),l.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",l.jsx("b",{children:_t(r.cost.cacheRead)})]}),l.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",l.jsx("b",{children:_t(r.cost.cacheWrite)})]})]})]})})]}),l.jsxs("section",{className:"ss-stats",children:[l.jsx(wi,{label:"agents",value:r.agentCount}),l.jsx(wi,{label:"subagents",value:r.subagentCount}),l.jsx(wi,{label:"tool calls",value:r.toolCount}),l.jsx(wi,{label:"prompts",value:r.promptCount}),l.jsx(wi,{label:"tokens",value:r.tokensSum.toLocaleString()}),r.errCount>0&&l.jsx(wi,{label:"errors",value:r.errCount,tone:"err"})]}),r.topTools.length>0&&l.jsxs("section",{className:"modal-section",children:[l.jsx("h4",{children:"Most-used tools"}),l.jsx("div",{className:"ss-top-tools",children:r.topTools.map(([c,u])=>l.jsxs("div",{className:"ss-tt",children:[l.jsx("span",{className:"ss-tt-name",children:c}),l.jsx("span",{className:"ss-tt-bar",children:l.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/r.topTools[0][1]*100}%`}})}),l.jsx("span",{className:"ss-tt-count",children:u})]},c))})]}),r.firstPrompt&&l.jsxs("section",{className:"modal-section",children:[l.jsx("h4",{children:"Opening prompt"}),l.jsx("div",{className:"ss-prompt",children:r.firstPrompt})]})]})]})}):null}function wi({label:e,value:t,tone:n}){return l.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[l.jsx("div",{className:"ss-stat-value",children:t}),l.jsx("div",{className:"ss-stat-label",children:e})]})}function LD(e,t){const n=e.agents.get(t);if(!n)return null;const r=[];for(const E of e.agents.values())E.sessionId===t&&r.push(E);if(r.length===0)return null;const a={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},i=new Set,c=new Map;let u=0,f=0,p=0,h=0,m=0,y,w=1/0,N=0;for(const E of r){const C=Zn(E);a.input+=C.input,a.output+=C.output,a.cacheRead+=C.cacheRead,a.cacheWrite+=C.cacheWrite,a.total+=C.total;for(const R of wA(E))i.add(R);E.model&&i.add(E.model),E.kind==="subagent"&&m++;const T=lA(E.prompts);f+=T.length,!y&&T.length>0&&(y=T[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,u+=E.toolCount,w=Math.min(w,E.startedAt),N=Math.max(N,E.endedAt??Date.now());for(const R of E.tools)c.set(R.name,(c.get(R.name)??0)+1),R.ok===!1&&h++}const _=Math.max(0,N-w),S=Math.floor(_/1e3),b=S<60?`${S}s`:S<3600?`${Math.floor(S/60)}m ${String(S%60).padStart(2,"0")}s`:`${Math.floor(S/3600)}h ${Math.floor(S%3600/60)}m`,j=Array.from(c.entries()).sort((E,C)=>C[1]-E[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:b,cost:a,modelChips:Array.from(i),agentCount:r.length,subagentCount:m,toolCount:u,promptCount:f,tokensSum:p,errCount:h,topTools:j,firstPrompt:y}}function a_(e){return e.waiting?xo(e.waiting)?0:1:e.state==="active"?2:3}function DD(e,t){const n=[];for(const r of e.agents.values()){if(r.kind!=="root")continue;let a=r.toolCount,i=Zn(r).total,c=r.endedAt??r.startedAt;for(const u of e.agents.values()){if(u.sessionId!==r.sessionId||u.kind==="root")continue;a+=u.toolCount,i+=Zn(u).total;const f=u.endedAt??u.startedAt;f>c&&(c=f)}n.push({sessionId:r.sessionId,label:r.label||r.cwdBasename||"session",cwdBasename:r.cwdBasename,state:r.state,waiting:r.waiting,recap:fh(r),modelId:r.model,toolCount:a,cost:i,startedAt:r.startedAt,lastActivity:c})}return n.sort((r,a)=>{const i=a_(r),c=a_(a);return i!==c?i-c:r.waiting&&a.waiting?r.waiting.since-a.waiting.since:a.lastActivity-r.lastActivity}),n}function o_(e,t,n){const r=(t??n)-e;if(r<1e3)return"<1s";const a=Math.floor(r/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60);return i<60?`${i}m`:`${Math.floor(i/60)}h ${i%60}m`}function qD({state:e,now:t,selectedIds:n,onSelect:r,onClose:a}){const i=x.useMemo(()=>DD(e),[e,e.revision,t]),c=i.filter(f=>f.state==="active").length,u=i.filter(f=>xo(f.waiting)).length;return l.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[l.jsxs("div",{className:"sl-header",children:[l.jsxs("h2",{children:["Sessions ",l.jsx("span",{className:"sl-count",children:i.length})]}),u>0&&l.jsxs("span",{className:"sl-waiting-count",children:[u," waiting"]}),c>0&&l.jsxs("span",{className:"sl-live-count",children:[c," live"]}),l.jsx("button",{className:"glyph-btn sl-close",onClick:a,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),l.jsxs("div",{className:"sl-rows",children:[i.length===0&&l.jsx("div",{className:"sl-empty",children:"No sessions yet."}),i.map(f=>{const p=n.has(f.sessionId);return l.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,onClick:()=>r(f.sessionId),title:`Focus ${f.label}`,children:[l.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:uc(f.state)}),l.jsxs("div",{className:"sl-row-body",children:[l.jsxs("div",{className:"sl-row-head",children:[l.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&l.jsx("span",{className:"model-chip","data-family":ch(f.modelId),title:f.modelId,children:go(f.modelId)})]}),l.jsxs("div",{className:"sl-row-meta",children:[l.jsxs("span",{title:"tool calls",children:[l.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&l.jsx("span",{className:"sl-cost",title:DA,children:l.jsx("b",{children:_t(f.cost)})}),f.waiting?l.jsxs("span",{className:"sl-waiting",title:[Li(f.waiting),w6(f.waiting,Li(f.waiting)),`Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`].filter(Boolean).join(`
84
+ `),children:["waiting ",o_(f.waiting.since,void 0,t),f.waiting.tool&&l.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):l.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:o_(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]}),f.recap&&l.jsxs("span",{className:"sl-recap",title:f.recap.text,children:[l.jsx(s0,{}),f.recap.text]})]})]},f.sessionId)})]})]})}const FD=e=>1-Math.pow(1-e,5),qA=420;function BD(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e===t)return!1;const n=Math.abs(t-e);if(n<1)return!1;const r=Math.max(Math.abs(e),Math.abs(t));return r===0||n/r>=.005}function zD(e,t,n,r=qA){return n>=r?t:n<=0?e:e+(t-e)*FD(n/r)}function UD(e,t,n,r={}){const a=r.now??(()=>performance.now()),i=r.raf??(w=>requestAnimationFrame(w)),c=r.cancel??(w=>cancelAnimationFrame(w)),u=r.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=r.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||f()||!BD(e,t))return n(t),()=>{};const p=a();let h=0,m=!0;const y=()=>{if(!m)return;const w=a()-p;n(zD(e,t,w)),w<qA&&(h=i(y))};return h=i(y),()=>{m=!1,h&&c(h)}}const xx={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function _p(e,t){const n=new Map;for(const r of e){if(r.kind!=="root"||!r.sessionId)continue;const a=Zn(r,t);n.set(r.sessionId,{cost:a.total,inputTokens:r.usage.inputTokens,outputTokens:r.usage.outputTokens,cacheReadTokens:r.usage.cacheReadTokens,cacheCreateTokens:r.usage.cacheCreateTokens})}return n}function WD(e,t){if(!e)return xx;const n={...xx};for(const[r,a]of t){const i=e.get(r);if(!i)continue;const c={cost:a.cost-i.cost,inputTokens:a.inputTokens-i.inputTokens,outputTokens:a.outputTokens-i.outputTokens,cacheReadTokens:a.cacheReadTokens-i.cacheReadTokens,cacheCreateTokens:a.cacheCreateTokens-i.cacheCreateTokens};c.cost<0||c.inputTokens<0||c.outputTokens<0||c.cost===0&&c.inputTokens===0&&c.outputTokens===0&&c.cacheReadTokens===0&&c.cacheCreateTokens===0||(n.cost+=c.cost,n.inputTokens+=Math.max(0,c.inputTokens),n.outputTokens+=Math.max(0,c.outputTokens),n.cacheReadTokens+=Math.max(0,c.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,c.cacheCreateTokens),n.sessions+=1)}return n}function FA(e,t,n){const r=GD*Math.max(1,n/zA);let a=0;for(const[i,c]of t){const u=e.get(i);if(u===void 0)continue;const f=c.cost-u.cost;f>0&&f<=r&&(a+=f)}return a}const i_={samples:[],last:new Map,watched:0},BA=10*6e4,HD=6e4,zA=5e3,GD=20;function VD(e,t,n){const r=e.samples[e.samples.length-1];if(r&&t-r.t<zA)return e;const a=e.watched+FA(e.last,n,r?t-r.t:0),i=e.samples.filter(c=>t-c.t<=BA);return i.push({t,watched:a}),{samples:i,last:n,watched:a}}function KD(e,t,n){const r=e.samples[0];if(!r)return null;const a=t-r.t;if(a<HD)return null;const i=e.samples[e.samples.length-1].t,c=e.watched+FA(e.last,n,t-i)-r.watched;return c>0?{spent:c,spanSec:a/1e3,spanMin:Math.min(BA/6e4,Math.ceil(a/6e4))}:null}function l_(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const mh=[{key:"today",label:"today",noun:"today",hint:"Since midnight, on this machine's clock."},{key:"month",label:"month",noun:"this month",hint:"Since the 1st of this calendar month — not the last 30 days."},{key:"all",label:"all",noun:"all time",hint:"Every transcript on disk, back to 2020."}];function YD(e,t,n=mh.length){return n<=0?null:e==="ArrowRight"||e==="ArrowDown"?(t+1)%n:e==="ArrowLeft"||e==="ArrowUp"?(t-1+n)%n:e==="Home"?0:e==="End"?n-1:null}function XD(e,t=new Date){return e==="today"?l_(1,t):e==="month"?l_(t.getDate(),t):"20200101"}const Kn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Nd=e=>typeof e=="string"?e:"";function UA(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const r of t){const a=Array.isArray(r==null?void 0:r.modelBreakdowns)?r.modelBreakdowns:[];for(const i of a){const c=Nd(i==null?void 0:i.modelName);if(!c)continue;let u=n.get(c);u||(u={model:c,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(c,u)),u.cost+=Kn(i==null?void 0:i.cost),u.inputTokens+=Kn(i==null?void 0:i.inputTokens),u.outputTokens+=Kn(i==null?void 0:i.outputTokens),u.cacheReadTokens+=Kn(i==null?void 0:i.cacheReadTokens),u.cacheCreateTokens+=Kn(i==null?void 0:i.cacheCreationTokens)}}return[...n.values()].sort((r,a)=>a.cost-r.cost||a.tokens-r.tokens)}const ZD=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function QD(e){var t;return((t=ZD.exec(e))==null?void 0:t[0])??e}function JD(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],r=[];for(const a of n){const i=Nd(a==null?void 0:a.period);if(!i)continue;const c=QD(i),u=a==null?void 0:a.metadata,f=typeof(u==null?void 0:u.lastActivity)=="string"?Date.parse(u.lastActivity):NaN;r.push({sessionId:c,label:t.get(c)??null,agent:Nd(a==null?void 0:a.agent)||"claude",cost:Kn(a==null?void 0:a.totalCost),tokens:Kn(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(Nd).filter(Boolean):[],lastActivityMs:Number.isFinite(f)?f:null})}return r.sort((a,i)=>i.cost-a.cost||i.tokens-a.tokens)}function WA(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=Kn(t.cacheReadTokens),p=Kn(t.cacheCreationTokens),h=Kn(t.inputTokens),m=Kn(t.outputTokens);return{cost:Kn(t.totalCost),inputTokens:h,outputTokens:m,cacheReadTokens:f,cacheCreateTokens:p,tokens:Kn(t.totalTokens)||h+m+f+p}}const n=UA(e),r=f=>n.reduce((p,h)=>p+f(h),0),a=r(f=>f.inputTokens),i=r(f=>f.outputTokens),c=r(f=>f.cacheReadTokens),u=r(f=>f.cacheCreateTokens);return{cost:r(f=>f.cost),inputTokens:a,outputTokens:i,cacheReadTokens:c,cacheCreateTokens:u,tokens:a+i+c+u}}function eq(e,t){return{data:(e==null?void 0:e.data)??null,shown:(e==null?void 0:e.period)??null,stale:e!=null&&e.period!==t,baseline:(e==null?void 0:e.baseline)??null}}function c_(e,t){var n;return((n=mh.find(r=>r.key===(e??t)))==null?void 0:n.noun)??"today"}function tq(e,t,n){const r=e!=null,a=WA(e);return{fromRange:r,cost:r?a.cost+n.cost:t.cost.total,inputTokens:r?a.inputTokens+n.inputTokens:t.inputTokens,outputTokens:r?a.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:r?a.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:r?a.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:r?a.cost>0:t.cost.total>0,tokenSum:r?a.tokens:t.sum,showCostBar:!r}}const Kt="ccdeck";function Ta(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function gh(e){return e==null}const bx="self";function _a(e,t=!1){const n=Ta(e?bx:null,bx);return{disabled:t||n.disabled,"aria-busy":n.busy}}function Ls(e){return gh(e?bx:null)}function nq(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function u_(e){return e==null||e==="BODY"||e==="HTML"}const HA="agent-dag.usagePeriod";function rq(){const e=bo(HA);return mh.some(t=>t.key===e)?e:"today"}function sq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(HA,e)}catch{}}const GA="agent-dag.usageSessionsOpen";function aq(){return bo(GA)==="1"}function oq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(GA,e?"1":"0")}catch{}}function d_(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 iq(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 Np="__unknown__";function lq(e,t,n,r){const a=Math.max(0,t-r),i=Math.max(0,n-a);if(i<120)return null;const c=Math.min(100,i/n*100),u=e-c;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:c,isDeficit:!1};if(u>0){const f=100-e,p=i>0?e/i:0,h=p>0?f/p:1/0,m={label:`${Math.round(u)}% over pace`,color:"var(--warn)",expectedPct:c,isDeficit:!0};if(h<a&&h<86400){const y=Math.floor(h/3600),w=Math.floor(h%3600/60);m.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return m}return{label:`${Math.round(-u)}% under pace`,color:"var(--ok)",expectedPct:c,isDeficit:!1}}function wa({pct:e,label:t,reset:n,resetAt:r,windowSec:a,limitReached:i,nowSec:c}){const u=Math.min(100,Math.max(0,e)),p=i||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",h=u===0?"< 1%":`${u}%`,m=u===0?2:u,y=r?MA(r,c):null,w=r&&a?lq(u,r,a,c):null,[N,_]=x.useState(!1),S=x.useId();return l.jsxs("div",{className:"qb-row",children:[l.jsxs("div",{className:"qb-meta",children:[l.jsxs("span",{className:"qb-label",children:[t,i&&l.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),l.jsx("span",{className:"qb-pct",style:{color:p},children:h})]}),l.jsxs("div",{className:"qb-track",children:[l.jsx("div",{className:"qb-fill",style:{transform:`scaleX(${m/100})`,background:p,opacity:u===0?.4:1}}),w&&l.jsx("div",{className:"qb-pace-rail",style:{transform:`translateX(${w.expectedPct}%)`},children:l.jsx("div",{"aria-hidden":!0,className:"qb-pace-marker",style:{background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})})]}),l.jsxs("div",{className:"qb-reset-row",children:[y?l.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?l.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&l.jsxs("button",{type:"button",className:"qb-pace",style:{color:w.color},"aria-expanded":N,"aria-controls":N?S:void 0,onClick:()=>_(b=>!b),children:[l.jsx("i",{className:"qb-pace-key","aria-hidden":!0,style:{background:w.isDeficit?"var(--err)":"var(--ok)"}}),w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label]})]}),N&&w&&l.jsxs("div",{id:S,className:"qb-why",children:["To last until reset, stay near ",Math.round(w.expectedPct),"% by now."]})]})}const cq=6e4,uq=2e4;function dq(e){const[t,n]=x.useState(null),[r,a]=x.useState(!1),i=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!Ls(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/quota?refresh=1":"/api/quota",{signal:AbortSignal.timeout(uq)});m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),cq),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{quota:t,loading:r,refresh:()=>{e&&u(!0)}}}function hq(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 fq(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 VA=6e4,h_=6e4;function pq(e){const[t,n]=x.useState(null),[r,a]=x.useState(!1),i=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!Ls(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),VA),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t,loading:r,refresh:()=>{e&&u(!0)}}}function mq(e){const[t,n]=x.useState(null),r=x.useRef(null),a=async()=>{try{const i=await fetch("/api/codex-usage");i.ok&&n(await i.json())}catch{}};return x.useEffect(()=>{if(e)return a(),r.current=window.setInterval(a,VA),()=>{r.current!=null&&window.clearInterval(r.current)}},[e]),{data:t}}function gq(e,t,n){const[r,a]=x.useState(null),[i,c]=x.useState(!1),[u,f]=x.useState(0),p=x.useRef(0);x.useEffect(()=>{const m=()=>document.visibilityState==="visible",y=()=>{m()&&f(_=>_+1)},w=window.setInterval(y,h_),N=()=>{m()&&Date.now()-p.current>=h_&&f(_=>_+1)};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",N)}},[]);const h=x.useRef(t);return x.useEffect(()=>{let m=!0;const y=t!==h.current;h.current=t;const w=e,N=XD(w);return c(!0),fetch(`/api/ccusage?since=${N}${y?"&refresh=1":""}`).then(_=>_.ok?_.json():null).then(_=>{!m||!(_!=null&&_.ok)||(p.current=Date.now(),a({period:w,data:_,baseline:n()}))}).catch(()=>{}).finally(()=>{m&&c(!1)}),()=>{m=!1}},[e,t,u]),{...eq(r,e),loading:i}}function Ul(e){const[t,n]=x.useState(e),r=x.useRef(e),a=x.useRef(!0);return x.useEffect(()=>{r.current=t},[t]),x.useEffect(()=>{if(a.current){a.current=!1,r.current=e,n(e);return}return UD(r.current,e,c=>{r.current=c,n(c)})},[e]),t}function yq({state:e,now:t,providers:n,leaving:r,onClose:a,liveSince:i=null}){var $e,ct;const{quota:c,loading:u,refresh:f}=dq(n.claude),{data:p,loading:h,refresh:m}=pq(n.codex),{data:y}=mq(n.codex),[w,N]=x.useState(()=>Math.floor(Date.now()/1e3));x.useEffect(()=>{const ye=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ye)},[]);const _=x.useRef(i_),S=x.useRef(null),{byModel:b,totalCost:j,totalTokens:E,burnRate:C}=x.useMemo(()=>{const ye=new Map;for(const tt of e.agents.values())for(const nt of _c(tt)){const St=nt.model??Np,yt=Jx(nt.usage,nt.model),wt=ye.get(St);wt?(wt.inputTokens+=nt.usage.inputTokens,wt.outputTokens+=nt.usage.outputTokens,wt.cacheReadTokens+=nt.usage.cacheReadTokens,wt.cacheCreateTokens+=nt.usage.cacheCreateTokens,wt.cost.total+=yt.total,wt.cost.input+=yt.input,wt.cost.output+=yt.output,wt.cost.cacheRead+=yt.cacheRead,wt.cost.cacheWrite+=yt.cacheWrite,wt.agentCount++):ye.set(St,{model:St,inputTokens:nt.usage.inputTokens,outputTokens:nt.usage.outputTokens,cacheReadTokens:nt.usage.cacheReadTokens,cacheCreateTokens:nt.usage.cacheCreateTokens,cost:{...yt},agentCount:1,priced:zi(nt.model)!=null})}const Ee=Array.from(ye.values()).sort((tt,nt)=>nt.cost.total-tt.cost.total||nt.inputTokens+nt.outputTokens-(tt.inputTokens+tt.outputTokens)),ie=ID(e.agents.values());S.current!==i&&(S.current=i,_.current=i_);const Je=_p(e.agents.values(),t);i!=null&&(_.current=VD(_.current,t,Je));const rt=i==null?null:KD(_.current,t,Je),lt=rt?{label:e0(rt.spent,rt.spanSec),spanMin:rt.spanMin}:null;return{byModel:Ee,totalCost:ie.cost,totalTokens:ie,burnRate:lt}},[e,e.revision,t,i]),T=x.useMemo(()=>{const ye=[];for(const Ee of e.agents.values()){if(Ee.kind!=="root")continue;let ie=Zn(Ee).total,Je=Ee.usage.inputTokens,rt=Ee.usage.outputTokens,lt=zd(Ee);for(const tt of e.agents.values())tt.sessionId!==Ee.sessionId||tt.kind==="root"||(ie+=Zn(tt).total,Je+=tt.usage.inputTokens,rt+=tt.usage.outputTokens,lt+=zd(tt));ye.push({sessionId:Ee.sessionId,label:Ee.label||Ee.cwdBasename||"session",state:Ee.state,cost:ie,inputTokens:Je,outputTokens:rt,unpricedTokens:lt})}return ye.sort((Ee,ie)=>ie.cost-Ee.cost||ie.inputTokens+ie.outputTokens-(Ee.inputTokens+Ee.outputTokens)).slice(0,12)},[e,e.revision]),[R,$]=x.useState(rq);x.useEffect(()=>{sq(R)},[R]);const[D,W]=x.useState(aq);x.useEffect(()=>{oq(D)},[D]);const L=x.useRef([]),[V,Q]=x.useState(0),ee=x.useRef(()=>new Map);ee.current=()=>_p(e.agents.values(),t);const M=x.useCallback(()=>ee.current(),[]),{data:X,shown:H,stale:I,loading:B,baseline:P}=gq(R,V,M),z=X!=null,O=B&&I,K=x.useMemo(()=>{const ye=new Map;for(const Ee of e.agents.values()){if(Ee.kind!=="root"||!Ee.sessionId)continue;const ie=Ee.label||Ee.cwdBasename;ie&&ye.set(Ee.sessionId,ie)}return ye},[e,e.revision]),de=x.useMemo(()=>{const ye=new Map;for(const Ee of e.agents.values())Ee.kind!=="root"||!Ee.sessionId||ye.set(Ee.sessionId,Ee.state);return ye},[e,e.revision]),G=x.useMemo(()=>z?UA(X):[],[X,z]),J=x.useMemo(()=>{if(!z)return[];const ye=JD(X,K).slice(0,12),Ee=new Map;for(const ie of ye)ie.label&&Ee.set(ie.label,(Ee.get(ie.label)??0)+1);return ye.map(ie=>ie.label&&(Ee.get(ie.label)??0)>1?{...ie,label:`${ie.label} ${ie.sessionId.slice(0,4)}`}:ie)},[X,z,K]),U=x.useMemo(()=>WA(X),[X]),ne=c_(H,R),ae=I?" up-stale":"",pe=x.useMemo(()=>z?WD(P,_p(e.agents.values(),t)):xx,[e,e.revision,P,z,t]),ge=tq(X,{...E,cost:j},pe),Se=ge.hasCost,Oe=ge.tokenSum,We=Ul(ge.cost),Pe=Ul(ge.inputTokens),Te=Ul(ge.outputTokens),et=Ul(ge.cacheReadTokens),je=Ul(ge.cacheCreateTokens),_e=b.filter(ye=>ye.cost.total>0||ye.inputTokens+ye.outputTokens>0),Ye=T.filter(ye=>ye.cost>0||ye.inputTokens+ye.outputTokens>0),dt=z?G.some(ye=>ye.cost<=0&&ye.tokens>0):_e.some(ye=>!ye.priced),Qe=u||h,ue=d_(c==null?void 0:c.fetchedAt,w),be=d_(p==null?void 0:p.fetchedAt,w),Re=()=>{f(),m(),Q(ye=>ye+1)},Xe=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return l.jsxs("aside",{className:`usage-panel${r?" leaving":""}`,id:"usage-panel","aria-label":"Usage",children:[l.jsxs("div",{className:"up-header",children:[l.jsx("h2",{children:"Usage"}),C&&l.jsxs("span",{className:"up-rate",title:`Spend on this board over the last ${C.spanMin} min`,children:[C.label,l.jsxs("span",{className:"up-rate-span",children:[" · ",C.spanMin," min"]})]}),l.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&l.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:Re,..._a(Qe),"aria-label":Xe,title:Xe,children:Qe?"…":"↻"}),l.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:a,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&l.jsxs("section",{className:"up-section up-quota-section",children:[l.jsxs("h3",{className:"up-section-title",children:["Claude quota",ue&&!u&&l.jsx("span",{className:"up-section-age",title:iq(c==null?void 0:c.source),children:ue})]}),c!=null&&c.ok?l.jsxs("div",{className:"up-quota-bars",children:[c.session5hPct!=null&&l.jsx(wa,{label:"5-hour window",pct:c.session5hPct,reset:c.session5hReset,resetAt:c.session5hResetAt,windowSec:c.session5hWindowSec,nowSec:w}),c.week7dPct!=null&&l.jsx(wa,{label:"7-day window",pct:c.week7dPct,reset:c.week7dReset,resetAt:c.week7dResetAt,windowSec:c.week7dWindowSec,nowSec:w}),c.weekSonnetPct!=null&&l.jsx(wa,{label:"Sonnet (7d)",pct:c.weekSonnetPct,nowSec:w}),c.weekOpusPct!=null&&l.jsx(wa,{label:"Opus (7d)",pct:c.weekOpusPct,nowSec:w}),c.extraEnabled&&c.extraUsedCredits!=null&&c.extraMonthlyLimit?l.jsx(wa,{label:`Extra credits (month${c.extraCurrency?`, ${c.extraCurrency}`:""})`,pct:Math.min(100,Math.round(c.extraUsedCredits/c.extraMonthlyLimit*100)),nowSec:w}):c.extraEnabled&&l.jsx("div",{className:"up-quota-sub up-credits",children:"extra usage credits: on"})]}):(c==null?void 0:c.ok)===!1?l.jsxs("div",{className:"up-quota-na",children:[l.jsx("span",{children:c.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),l.jsx("span",{className:"up-quota-hint",children:hq(c.reason)})]}):l.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&l.jsxs("section",{className:"up-section up-quota-section",children:[l.jsxs("h3",{className:"up-section-title",children:["Codex quota",(p==null?void 0:p.ok)&&p.planLabel&&l.jsx("span",{className:"up-plan-badge",children:p.planLabel}),be&&!h&&l.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:be})]}),p!=null&&p.ok?l.jsxs("div",{className:"up-quota-bars",children:[($e=p.windows)==null?void 0:$e.map(ye=>l.jsx(wa,{label:ye.label,pct:ye.pct,reset:ye.reset??void 0,resetAt:ye.resetAt??void 0,windowSec:ye.windowSec??void 0,limitReached:p.limitReached&&ye.pct>=100,nowSec:w},ye.id)),(ct=p.extraWindows)==null?void 0:ct.map(ye=>l.jsx(wa,{label:ye.label,pct:ye.pct,reset:ye.reset??void 0,resetAt:ye.resetAt??void 0,windowSec:ye.windowSec??void 0,nowSec:w},ye.id)),p.creditLimit&&l.jsx(wa,{label:`spend cap · $${Math.round(p.creditLimit.used)} of $${Math.round(p.creditLimit.limit)}`,pct:p.creditLimit.usedPct,reset:p.creditLimit.reset??void 0,resetAt:p.creditLimit.resetAt??void 0,limitReached:p.spendControlReached,nowSec:w}),p.creditsBalance&&!p.creditsUnlimited&&l.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",p.creditsBalance,p.overageReached&&" · overage limit reached"]}),p.creditsUnlimited&&l.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),p.resetCredits&&p.resetCredits.availableCount>0&&l.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Kt} only reports them`,children:[p.resetCredits.availableCount," rate-limit reset",p.resetCredits.availableCount!==1?"s":""," available",p.resetCredits.nextExpiryAt&&` · expires ${new Date(p.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),p.promo&&l.jsx("div",{className:"up-quota-sub",children:p.promo}),p.partial&&l.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(p==null?void 0:p.ok)===!1?l.jsxs("div",{className:"up-quota-na",children:[l.jsx("span",{children:"Quota unavailable."}),l.jsx("span",{className:"up-quota-hint",children:fq(p.reason)})]}):l.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(y==null?void 0:y.ok)&&y.window7d&&y.window7d.sessionCount>0&&l.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${y.window5h?`
85
+ last 5h: ${bn(y.window5h.totalTokens)} tokens · ${y.window5h.sessionCount} session${y.window5h.sessionCount!==1?"s":""}`:""}`,children:[bn(y.window7d.totalTokens)," tokens · ",y.window7d.sessionCount," session",y.window7d.sessionCount!==1?"s":""," (7d)"]})]}),z&&l.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":O||void 0,onKeyDown:ye=>{var Je;const Ee=L.current.indexOf(ye.target);if(Ee<0)return;const ie=YD(ye.key,Ee);ie!==null&&(ye.preventDefault(),(Je=L.current[ie])==null||Je.focus())},children:mh.map((ye,Ee)=>l.jsx("button",{type:"button",ref:ie=>{L.current[Ee]=ie},tabIndex:R===ye.key?0:-1,"aria-pressed":R===ye.key,"data-pending":R===ye.key&&O?"":void 0,title:R===ye.key&&O?`Reading ${ye.noun} from the transcripts on this machine…`:ye.hint,className:"uh-range-btn",onClick:()=>$(ye.key),children:ye.label},ye.key))}),z&&l.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:O?`Reading ${c_(R,R)}…`:""}),Oe>0?l.jsxs(l.Fragment,{children:[Se&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`up-total${ae}`,title:z?void 0:s_,children:[l.jsx("span",{className:"up-total-value",children:_t(We)}),l.jsx("span",{className:"up-total-label",children:z?ne:$D})]}),ge.showCostBar&&l.jsx(o0,{cost:j})]}),l.jsxs("div",{className:`up-tokens-row${ae}`,title:z?void 0:s_,children:[l.jsxs("span",{className:"up-tok",children:[l.jsx("span",{className:"up-k",children:"in"}),bn(Pe)]}),l.jsxs("span",{className:"up-tok",children:[l.jsx("span",{className:"up-k",children:"out"}),bn(Te)]}),ge.cacheReadTokens>0&&l.jsxs("span",{className:"up-tok",children:[l.jsx("span",{className:"up-k",children:"cache r"}),bn(et)]}),ge.cacheCreateTokens>0&&l.jsxs("span",{className:"up-tok",children:[l.jsx("span",{className:"up-k",children:"cache c"}),bn(je)]}),!Se&&l.jsx("span",{className:"up-tok up-scope",children:OD})]}),(z?G.length:_e.length)>0&&l.jsxs("section",{className:`up-section${ae}`,children:[l.jsx("h3",{className:"up-section-title",children:"By model"}),l.jsxs("table",{className:"up-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Model"}),l.jsx("th",{children:"Tokens"}),l.jsx("th",{children:"Cost"})]})}),l.jsx("tbody",{children:z?G.map(ye=>l.jsxs("tr",{children:[l.jsx("td",{className:"up-model-name",title:ye.model,children:go(ye.model)}),l.jsx("td",{className:"up-num",children:bn(ye.tokens)}),ye.cost>0?l.jsx("td",{className:"up-num up-cost-val",children:_t(ye.cost)}):l.jsx("td",{className:"up-num up-unpriced",children:ki})]},ye.model)):_e.map(ye=>l.jsxs("tr",{children:[l.jsx("td",{className:"up-model-name",title:ye.model===Np?"no model reported yet":ye.model,children:ye.model===Np?"unknown":go(ye.model)}),l.jsx("td",{className:"up-num",children:bn(ye.inputTokens+ye.outputTokens)}),ye.priced?l.jsx("td",{className:"up-num up-cost-val",children:_t(ye.cost.total)}):l.jsx("td",{className:"up-num up-unpriced",children:ki})]},ye.model))})]})]}),z&&J.length===0&&U.tokens>0&&l.jsxs("section",{className:"up-section",children:[l.jsx("h3",{className:"up-section-title",children:"By session"}),l.jsxs("div",{className:"up-hint",children:["No session is dated ",ne," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(z?J.length:Ye.length)>0&&(()=>{const ye=z?J.length:Ye.length;return l.jsxs("section",{className:`up-section${ae}`,children:[l.jsx("h3",{className:"up-section-title",children:l.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":D,"aria-controls":"up-sessions",title:D?"Hide the per-session breakdown":`Show the per-session breakdown — ${ye} session${ye===1?"":"s"}`,onClick:()=>W(Ee=>!Ee),children:["By session",z&&l.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${ne}, each showing what that session has cost since it started.
86
+ 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 ",ne]}),l.jsx("svg",{className:"up-chev",width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),l.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!D,children:[z&&J.map(Ee=>{const ie=de.get(Ee.sessionId);return l.jsxs("div",{className:"up-session-row",children:[ie?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:`sl-dot state-${ie}`,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:uc(ie)})]}):l.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),l.jsx("span",{className:`up-session-label${Ee.label?"":" up-session-id"}`,title:Ee.label?`${Ee.label}
87
+ ${Ee.sessionId}`:Ee.sessionId,children:Ee.label??Ee.sessionId.slice(0,8)}),l.jsx("span",{className:"up-session-tokens",children:bn(Ee.tokens)}),Ee.cost>0?l.jsx("span",{className:"up-session-cost",title:Ee.models.join(", ")||void 0,children:_t(Ee.cost)}):l.jsx("span",{className:"up-session-cost up-unpriced",children:ki})]},Ee.sessionId)}),!z&&Ye.map(Ee=>l.jsxs("div",{className:"up-session-row",children:[l.jsx("span",{className:`sl-dot state-${Ee.state}`,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:uc(Ee.state)}),l.jsx("span",{className:"up-session-label",children:Ee.label}),l.jsx("span",{className:"up-session-tokens",children:bn(Ee.inputTokens+Ee.outputTokens)}),Ee.cost>0?l.jsxs("span",{className:"up-session-cost",title:Ee.unpricedTokens>0?`${bn(Ee.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[_t(Ee.cost),Ee.unpricedTokens>0?"+":""]}):l.jsx("span",{className:"up-session-cost up-unpriced",children:ki})]},Ee.sessionId))]})]})})(),dt&&l.jsxs("div",{className:"up-hint",children:["“",ki,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):l.jsx("div",{className:"up-empty",children:z?l.jsxs(l.Fragment,{children:["No usage ",ne,".",l.jsx("br",{}),"Try a longer period."]}):l.jsxs(l.Fragment,{children:["No usage data yet.",l.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const dn={l:30,r:6,t:6,b:2},va={l:0,r:0,t:2,b:1},yh=104,wq=64;function Or(e,t=100,n=yh,r=dn){const a=n-r.t-r.b;return r.t+a*(1-Math.max(0,Math.min(t,e))/t)}function KA(e,t,n,r=100,a=yh,i=dn){if(!e.length)return"";const c=e[e.length-1].t-e[0].t,u=h=>{const m=t-i.l-i.r;return i.l+(c>0?m*(h-e[0].t)/c:m/2)};let f="",p=null;for(const h of e){const m=p&&h.t-p.t<=n*2?"L":"M";f+=`${m}${u(h.t).toFixed(1)} ${Or(h.v,r,a,i).toFixed(1)}`,p=h}return f}function YA(e,t,n,r=100,a=yh,i=dn){if(e.length<2)return"";const c=a-i.b,u=e[e.length-1].t-e[0].t,f=t-i.l-i.r,p=w=>i.l+(u>0?f*(w-e[0].t)/u:f/2);let h="",m=[];const y=()=>{if(m.length>=2){let w=`M${p(m[0].t).toFixed(1)} ${c}`;for(const N of m)w+=`L${p(N.t).toFixed(1)} ${Or(N.v,r,a,i).toFixed(1)}`;h+=`${w}L${p(m[m.length-1].t).toFixed(1)} ${c}Z`}m=[]};for(const w of e)m.length&&w.t-m[m.length-1].t>n*2&&y(),m.push(w);return y(),h}function vq(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 XA(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function xq(e,t,n=r=>ec(r)){const r=e.filter(c=>c.v>0);if(!e.length)return null;if(!r.length)return"never held back";const a=r.length*(t/6e4),i=r[r.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(i.t)}`}function ec(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function i0(e,t){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<1)return"less than a minute";if(n<60)return`${n} minute${n===1?"":"s"}`;const r=Math.floor(n/60),a=n%60;return a?`${r}h ${a}m`:`${r}h`}function bq({group:e,title:t,onClose:n}){const r=fn(n),[a,i]=x.useState(null);x.useEffect(()=>{let p=!0;const h=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const w=await y.json();p&&(w!=null&&w.ok)&&i(w)}catch{}};h();const m=window.setInterval(h,2e4);return()=>{p=!1,window.clearInterval(m)}},[e]);const c=(a==null?void 0:a.series)??[],[u,f]=x.useMemo(()=>{let p=1/0,h=0;for(const m of c)m.points.length&&(p=Math.min(p,m.points[0].t),h=Math.max(h,m.points[m.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(a==null?void 0:a.sinceMs)??0):(a==null?void 0:a.sinceMs)??0,h]},[c,a==null?void 0:a.sinceMs]);return pr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:r,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[l.jsxs("div",{className:"modal-head",children:[l.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&u>0&&l.jsxs("span",{className:"hist-since",children:["since ",ec(u)," · ",i0(u,f||Date.now())]}),l.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),l.jsx("div",{className:"hist-body",children:a==null?l.jsx("p",{className:"hist-empty",children:"Reading…"}):c.length===0?l.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):c.map(p=>l.jsx(kq,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function kq({series:e,stepMs:t}){const n=x.useRef(null),[r,a]=x.useState(560),[i,c]=x.useState(null);x.useEffect(()=>{const $=n.current;if(!$||typeof ResizeObserver>"u")return;const D=new ResizeObserver(([W])=>a(Math.max(160,W.contentRect.width)));return D.observe($),()=>D.disconnect()},[]);const{points:u,unit:f,warnAt:p,critAt:h,label:m,top:y,restsAtZero:w}=e,N=w?wq:yh,{now:_,peak:S}=vq(u),b=f==="C"?"°C":f,j=m==="Throttling"?xq(u,t):null,E=i!=null?u[i]:null,C=u.length>1?u[u.length-1].t-u[0].t:0,T=$=>{const D=r-dn.l-dn.r;return dn.l+(C>0?D*($-u[0].t)/C:D/2)},R=$=>{if(u.length<2)return;const D=$.currentTarget.getBoundingClientRect(),W=($.clientX-D.left-dn.l)/Math.max(1,D.width-dn.l-dn.r),L=u[0].t+C*Math.max(0,Math.min(1,W));let V=0;for(let Q=1;Q<u.length;Q++)Math.abs(u[Q].t-L)<Math.abs(u[V].t-L)&&(V=Q);c(V)};return l.jsxs("section",{className:"hist-series","aria-label":`${m} history`,children:[l.jsxs("div",{className:"hist-head",children:[l.jsx("span",{className:"hist-label",children:m}),l.jsxs("span",{className:"hist-stats",children:[_!=null&&l.jsxs(l.Fragment,{children:[l.jsx("b",{children:_}),l.jsxs("span",{children:[b," now"]})]}),S!=null&&l.jsxs(l.Fragment,{children:[l.jsx("b",{className:XA(S,p,h),children:S}),l.jsxs("span",{children:[b," peak"]})]})]})]}),l.jsx("div",{className:"hist-plot",ref:n,children:l.jsxs("svg",{className:"hist-chart",width:"100%",height:N,viewBox:`0 0 ${r} ${N}`,preserveAspectRatio:"none",role:"img","aria-label":_==null?`${m}: nothing measured yet`:`${m}: ${_}${b} now, peak ${S}${b}, over ${i0(u[0].t,u[u.length-1].t)}`,onPointerMove:R,onPointerLeave:()=>c(null),children:[[["warn",p],["hot",h]].map(([$,D])=>D==null||D>y?null:l.jsxs("g",{children:[l.jsx("line",{className:`hist-rule ${$}`,x1:dn.l,x2:r-dn.r,y1:Or(D,y,N),y2:Or(D,y,N)}),l.jsx("text",{className:`hist-rule-tag ${$}`,x:2,y:Or(D,y,N)+3,children:D})]},$)),l.jsx("line",{className:"hist-floor",x1:dn.l,x2:r-dn.r,y1:N-dn.b,y2:N-dn.b}),l.jsx("path",{className:"hist-area",d:YA(u,r,t,y,N)}),l.jsx("path",{className:"hist-line",d:KA(u,r,t,y,N)}),u.length===1&&l.jsx("circle",{className:"hist-dot",cx:T(u[0].t),cy:Or(u[0].v,y,N),r:3}),E&&l.jsxs("g",{children:[l.jsx("line",{className:"hist-cross",x1:T(E.t),x2:T(E.t),y1:dn.t,y2:N-dn.b}),l.jsx("circle",{className:"hist-dot",cx:T(E.t),cy:Or(E.v,y,N),r:3})]})]})}),l.jsx("div",{className:"hist-axis",children:E?l.jsxs("span",{className:"hist-at",children:[ec(E.t)," — ",l.jsx("b",{children:E.v}),b]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{children:u.length?ec(u[0].t):""}),l.jsx("span",{children:u.length?ec(u[u.length-1].t):""})]})}),j&&l.jsx("div",{className:"hist-note",children:j})]})}const _q="thermal:Throttling";function Nq(e){var n,r,a,i;const t={};e.cpu!=null&&(t["cpu:all"]=e.cpu),(n=e.perCore)!=null&&n.length&&(t["cpu:busiest"]=Math.max(...e.perCore)),e.memory&&(t["mem:physical"]=e.memory.usedPct),e.swap&&e.swap.total>0&&(t["mem:swap"]=Math.round(e.swap.used/e.swap.total*1e3)/10),(r=e.loadavg)!=null&&r.length&&(t["load:1m"]=e.loadavg[0]);for(const c of((a=e.thermal)==null?void 0:a.celsius)??[])t[`thermal:${c.label}`]=c.celsius;return(i=e.thermal)!=null&&i.throttle&&(t[_q]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function Sd(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function ad(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:Sd(e,t)}const f_=["cores","memory","load","thermal"],oo=116,cs=24,Sq=60,jq=6e4;function Eq(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function Cq(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function Tq(e,t=Sq){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function Aq({sys:e}){const[t,n]=x.useState({});x.useEffect(()=>{let c=!0;const u=async()=>{const p=await Promise.all(f_.map(async h=>{try{const m=await fetch(`/api/system/history?group=${h}`);return m.ok?[h,await m.json()]:[h,null]}catch{return[h,null]}}));c&&n(h=>{const m={...h};for(const[y,w]of p)w!=null&&w.ok&&(m[y]=w);return m})};u();const f=setInterval(()=>void u(),jq);return()=>{c=!1,clearInterval(f)}},[]);const r=x.useMemo(()=>Nq(e),[e]),a=x.useMemo(()=>f_.flatMap(c=>{const u=t[c];return u?u.series.filter(Eq).map(f=>({series:Tq(f),stepMs:u.stepMs})):[]}),[t]),i=x.useMemo(()=>{let c=1/0,u=-1/0;for(const{series:f}of a){const p=f.points;p.length&&(c=Math.min(c,p[0].t),u=Math.max(u,p[p.length-1].t))}return Number.isFinite(c)?i0(c,u):"less than a minute"},[a]);return Object.keys(r).length?l.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${i}`,children:a.map(({series:c,stepMs:u})=>l.jsx(Rq,{series:c,stepMs:u,now:r[c.key],span:i},c.key))}):null}function Rq({series:e,stepMs:t,now:n,span:r}){var w;const{points:a,top:i,unit:c,warnAt:u,critAt:f}=e,p=Cq(e),h=n??((w=a[a.length-1])==null?void 0:w.v),m=h==null?"":XA(h,u,f),y=Math.max(...a.map(N=>N.v));return l.jsxs("div",{className:`pl-cell${m?` ${m}`:""}`,title:[`${p} · peak ${Sd(y,c)} over the last ${r}`,u!=null?`over ${ad(u,c)} is uncomfortable`:"",f!=null?`over ${ad(f,c)} the machine acts`:""].filter(Boolean).join(" · "),children:[l.jsxs("div",{className:"pl-cell-head",children:[l.jsx("span",{className:"pl-cell-label",children:p}),l.jsx("span",{className:"pl-cell-now",children:h==null?"—":Sd(h,c)})]}),l.jsxs("svg",{className:"pl-spark",width:oo,height:cs,viewBox:`0 0 ${oo} ${cs}`,preserveAspectRatio:"none","aria-hidden":!0,children:[l.jsx("line",{className:"pl-spark-floor",x1:0,x2:oo,y1:cs-va.b,y2:cs-va.b}),l.jsx("path",{className:"pl-spark-area",d:YA(a,oo,t,i,cs,va)}),u!=null&&l.jsx("line",{className:"pl-rule warn",x1:0,x2:oo,y1:Or(u,i,cs,va),y2:Or(u,i,cs,va)}),f!=null&&l.jsx("line",{className:"pl-rule hot",x1:0,x2:oo,y1:Or(f,i,cs,va),y2:Or(f,i,cs,va)}),l.jsx("path",{className:"pl-spark-line",d:KA(a,oo,t,i,cs,va)})]}),l.jsxs("span",{className:"vis-hidden",children:["peak ",Sd(y,c)," over the last ",r,u!=null&&`, uncomfortable over ${ad(u,c)}`,f!=null&&`, the machine acts over ${ad(f,c)}`]})]})}const Mq={key:"cpu",dir:"desc"};function Iq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function $q(e,t){const n=t.dir==="asc"?1:-1,r=i=>t.key==="cpu"?i.cpu:t.key==="mem"?i.mem:t.key==="rss"?i.rssBytes:t.key==="threads"?i.threads:i.uptimeSec,a=(i,c)=>{if(t.key==="name")return n*i.name.localeCompare(c.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=i.user??"",h=c.user??"";return!p||!h?p===h?0:p?-1:1:n*p.localeCompare(h,void 0,{sensitivity:"base"})}const u=r(i),f=r(c);return u==null||f==null?u==null?f==null?0:1:-1:n*(u-f)};return[...e].sort((i,c)=>a(i,c)||(c.cpu??-1)-(i.cpu??-1)||c.mem-i.mem||i.pid-c.pid)}function Oq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const Pq=4e3;function Lq(){const[e,t]=x.useState(null);return x.useEffect(()=>{let n=!0;const r=async()=>{if(document.visibilityState!=="hidden")try{const i=await fetch("/api/system/processes?detail=1");if(!i.ok)return;const c=await i.json();n&&(c!=null&&c.ok)&&t({procs:c.procs??[],total:c.total??0})}catch{}};r();const a=window.setInterval(r,Pq);return()=>{n=!1,window.clearInterval(a)}},[]),e}function Dq(e){if(e==null||!Number.isFinite(e)||e<0)return"—";if(e<1024)return`${Math.round(e)} B`;const t=["KB","MB","GB","TB"];let n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n>=100?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function qq(e){return e==null||!Number.isFinite(e)||e<0?"—":e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function Fq({sys:e,onClose:t}){const n=fn(t),[r,a]=x.useState(Mq),i=Lq(),c=i?$q(i.procs,r):null;return pr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:n,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[l.jsxs("div",{className:"modal-head",children:[l.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),i&&l.jsxs("span",{className:"pl-count",children:[c.length," of ",i.total," running"]}),l.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),l.jsxs("div",{className:"pl-split",children:[l.jsx("div",{className:"pl-body",children:c==null?l.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):c.length===0?l.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):l.jsxs("table",{className:"sd-procs pl-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx(vi,{col:"cpu",label:"cpu",sort:r,onSort:a}),l.jsx(vi,{col:"rss",label:"memory",note:"Resident set size, which is what ps and Task Manager report; macOS Activity Monitor shows a different figure.",sort:r,onSort:a}),l.jsx(vi,{col:"threads",label:"threads",sort:r,onSort:a}),l.jsx(vi,{col:"uptime",label:"up",sort:r,onSort:a}),l.jsx(vi,{col:"user",label:"user",sort:r,onSort:a}),l.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),l.jsx(vi,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:r,onSort:a})]})}),l.jsx("tbody",{children:c.map(u=>l.jsxs("tr",{children:[l.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),l.jsx("td",{className:"sd-num sd-dim",title:`${u.mem.toFixed(1)}% of installed memory`,children:Dq(u.rssBytes)}),l.jsx("td",{className:"sd-num sd-dim",children:u.threads??"—"}),l.jsx("td",{className:"sd-num sd-dim",children:qq(u.uptimeSec)}),l.jsx("td",{className:"sd-dim pl-user",children:u.user??"—"}),l.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),l.jsxs("td",{className:"pl-name",children:[u.name,u.cmd&&l.jsxs("span",{className:"pl-cmd",title:u.cmd,children:[" ",u.cmd]})]})]},u.pid))})]})}),l.jsx(Aq,{sys:e})]})]})}),document.body)}function vi({col:e,label:t,note:n,sort:r,onSort:a}){const i=Oq(r,e);return l.jsx("th",{scope:"col","aria-sort":i,children:l.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
88
+
89
+ ${n}`:`Sort by ${t}`,onClick:()=>a(Iq(r,e)),children:[t,l.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}const Bq=3e3;function zq(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function Uq(e,t,n=Date.now()){const r=Math.max(0,Math.min(100,100-e));return{pct:r,value:`${r}%`,tone:r===0?"calm":r>=30?"hot":"warn",note:r>0?`CPU held to ${e}% of full speed to cool down`:t?`at full speed · held to ${100-t.peak}% ${Wq(t.lastMs,n)}`:"running at full speed, and never held back"}}function Wq(e,t=Date.now()){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<2)return"just now";if(n<60)return`${n} minutes ago`;const r=Math.floor(n/60);return r===1?"an hour ago":`${r} hours ago`}function Wl(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 Hq(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${r}m`:`${r}m`}function Gq(){const[e,t]=x.useState(null),n=x.useRef(null);return x.useEffect(()=>{let r=!0;const a=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();r&&(p!=null&&p.ok)&&t(p)}catch{}},i=()=>{n.current==null&&(a(),n.current=window.setInterval(a,Bq))},c=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){c();return}i(),a()};return i(),document.addEventListener("visibilitychange",u),()=>{r=!1,c(),document.removeEventListener("visibilitychange",u)}},[]),e}function p_({usageOpen:e,leaving:t,sub:n,onClose:r,children:a}){return l.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-labelledby":"sd-title",children:[l.jsxs("div",{className:"sd-head",children:[l.jsx("h2",{className:"sd-title",id:"sd-title",children:"This machine"}),n&&l.jsx("span",{className:"sd-sub",children:n}),l.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:r,"aria-label":"Close",title:"Close",children:"×"})]}),a]})}function Vq({usageOpen:e,leaving:t,onClose:n}){const r=Gq();if(!r||r.cpu==null||!r.memory)return l.jsx(p_,{usageOpen:e,leaving:t,onClose:n,children:l.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:a,swap:i,perCore:c,loadavg:u,cores:f,uptimeSec:p,platform:h,thermal:m}=r,y=a?a.total-a.available:0,w=h==="win32"?"Commit":"Swap",N=i&&i.total>0?i.used/i.total*100:0;return l.jsxs(p_,{usageOpen:e,leaving:t,sub:`up ${Hq(p)} · ${f} cores`,onClose:n,children:[c&&c.length>0&&l.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:l.jsx(jd,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:l.jsx("div",{className:"sd-cores",children:c.map((_,S)=>l.jsx("span",{className:"sd-core",title:`core ${S+1}: ${_}%`,children:l.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,_)/100})`}})},S))})})}),l.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:l.jsxs(jd,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&l.jsx(Hd,{label:"Physical",value:l.jsxs(l.Fragment,{children:[l.jsx("b",{children:Wl(y)})," of ",Wl(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${Wl(a.available)} available`}),i&&i.total>0&&l.jsx(Hd,{label:w,value:l.jsxs(l.Fragment,{children:[l.jsx("b",{children:Wl(i.used)})," of ",Wl(i.total)]}),pct:N,tone:N>=90?"warn":"calm",note:N>=50?"paging to disk":void 0})]})}),u&&l.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:l.jsxs(jd,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[l.jsx("div",{className:"sd-load",children:u.map((_,S)=>l.jsxs("span",{className:`sd-load-item${_>f?" over":""}`,children:[l.jsx("b",{children:_.toFixed(2)}),l.jsx("span",{children:["1m","5m","15m"][S]})]},S))}),l.jsx("div",{className:"sd-note",children:u[0]>f?`${(u[0]/f).toFixed(1)}× more work queued than cores to run it`:`within ${f} cores`})]})}),l.jsx(Kq,{thermal:m}),l.jsx(Yq,{sys:r})]})}function jd({group:e,title:t,action:n,label:r,children:a}){const[i,c]=x.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:"sd-open",onClick:()=>c(!0),title:n,"aria-label":n,children:[l.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[r," ",l.jsx("i",{className:"sd-row-more",children:"›"})]}),a]}),i&&l.jsx(bq,{group:e,title:t,onClose:()=>c(!1)})]})}function Kq({thermal:e}){if(!e)return null;const t=e.throttle?Uq(e.throttle.speedLimit,e.heldBack):null;return l.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:l.jsxs(jd,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>l.jsx(Hd,{label:n.label,value:l.jsxs(l.Fragment,{children:[l.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:zq(n.celsius,n.warnAt,n.critAt)},n.label)),t&&l.jsx(Hd,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function Yq({sys:e}){const[t,n]=x.useState(!1);return l.jsxs("div",{className:"sd-section sd-door-section",children:[l.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:l.jsxs("span",{className:"sd-door-plate",children:[l.jsxs("span",{className:"sd-door-name",children:["Busiest processes",l.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),l.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&l.jsx(Fq,{sys:e,onClose:()=>n(!1)})]})}function Hd({label:e,value:t,pct:n,tone:r="calm",note:a}){return l.jsxs("div",{className:"sd-row",children:[l.jsxs("div",{className:"sd-row-head",children:[l.jsx("span",{className:"sd-row-label",children:e}),l.jsx("span",{className:"sd-row-val",children:t})]}),l.jsx("span",{className:"sd-track",children:l.jsx("span",{className:`sd-fill${r==="calm"?"":` ${r}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),a&&l.jsx("div",{className:"sd-note",children:a})]})}const m_=18,Xq=1100,xi=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},Zq=Array.from({length:m_},(e,t)=>{const n=-72+144*t/(m_-1)+(xi(t,1)-.5)*9,r=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+xi(t,2)*.52);return{dx:Math.cos(r)*a,dy:Math.sin(r)*a,rot:(t%2?1:-1)*(100+xi(t,3)*260),delay:Math.round(xi(t,4)*90),dur:760+Math.round(xi(t,5)*260),scale:.8+xi(t,6)*.45,hue:t%4,round:t%3===0}});function g_({anchor:e}){var a;const[t,n]=x.useState(null),r=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return x.useEffect(()=>{if(r)return;const i=e.current;if(!i)return;const c=i.getBoundingClientRect();n({x:c.left+c.width/2,y:c.top+c.height/2});const u=window.setTimeout(()=>n(null),Xq);return()=>window.clearTimeout(u)},[e,r]),r||!t?null:pr.createPortal(l.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:Zq.map((i,c)=>l.jsx("span",{className:`confetti-bit${i.round?" round":""}`,"data-hue":i.hue,style:{"--dx":`${i.dx.toFixed(1)}px`,"--dy":`${i.dy.toFixed(1)}px`,"--rot":`${i.rot}deg`,"--s":i.scale.toFixed(2),animationDelay:`${i.delay}ms`,animationDuration:`${i.dur}ms, ${i.dur}ms`}},c))}),document.body)}const ZA=new Set(["awaiting_url","awaiting_code","registering"]);function Qq(e){return e!=null&&ZA.has(e)}function QA(e){return e!=null&&e!=="done"&&!ZA.has(e)}const Jq="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",eF="the sign-in did not complete";function tF({state:e,serverError:t,localError:n}){const r=e==="idle";return{title:r?"Sign-in ended":"Sign-in failed",message:n||t||(r?Jq:eF)}}function nF({restored:e,activeAccount:t}){if(e!==!1)return null;const n=(t==null?void 0:t.email)||((t==null?void 0:t.num)!=null?`account ${t.num}`:null);return n?`This machine is now signed in as ${n} — the account you were using could not be put back. Switch back from the accounts panel.`:"The account you were using could not be put back — check which account this machine is signed in as from the accounts panel."}const rF="done";function sF(){let e=!1;return{shouldAnnounce(t){return t!==rF?(e=!1,!1):e?!1:(e=!0,!0)}}}function l0(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const aF={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 ${Kt}`,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"},oF={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"},iF=`claude-swap could not read the login keychain — start ${Kt} from a Terminal window rather than a background service`,JA={401:"this deck did not accept the page as its own, so nothing was changed",403:"this deck refused a change from this address — open it on the address the deck prints, not through a proxy"};function kx(e,t,n){const r=n==null?null:JA[n];if(r)return r;if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(dc(e)))return iF;const a=l0(oF,e==null?void 0:e.reason);return a||(e==null?void 0:e.reason)||t}function dc(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const lF={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"},cF="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 uF(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const dF="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",hF="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",fF=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),pF=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,mF=/[\\/]_npx[\\/]/i,gF=`the copy of ccusage ${Kt} installed for itself`;function yF(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function IG(e,t){const n=wF(e,t),r=yF(e);switch(e==null?void 0:e.stage){case"npx":return r?`ccusage failed on both of its paths. The managed install failed first — ${r} — and the deck then fell back to npx, where ${Hl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${Hl(n)}`;case"managed":return`${gF} failed to run: ${Hl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${Hl(n)}`:`the ccusage this deck found on your PATH failed to run: ${Hl(n)}`;default:return n}}const Hl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function wF(e,t){const n=dc(e);if(fF(n)){if(mF.test(n))return hF;if(pF.test(n))return dF}if(uF(n))return cF;const r=l0(lF,e==null?void 0:e.reason);return r||(e==null?void 0:e.reason)||t}function Si(e,t,n){const r=n==null?null:JA[n];if(r)return r;if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&QA(e.state))return e.error;const a=l0(aF,e==null?void 0:e.reason);return a||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function vF(e,t,n){if(n<=0||dh(e))return{kind:"pass"};const r=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:r===-1?0:(r+1)%n};case"ArrowLeft":return{kind:"select",index:r===-1?n-1:(r-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function eR(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 xF(e){const t=new Map;for(const n of e){const r=(n.email??"").trim().toLowerCase();r&&t.set(r,(t.get(r)??0)+1)}return e.map(n=>{const r=(n.email??"").trim(),a=n.alias||r||`account ${n.num}`,i=[];return n.alias&&r&&i.push(r),r&&(t.get(r.toLowerCase())??0)>1&&i.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:i.length?i.join(" · "):null}})}function bF(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 kF(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 _F(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(h=>h.state===p).length,r=[],a=n("imported");a&&r.push(`${a} of ${t} imported`);const i=n("healed");i&&r.push(`${i} had a dead token replaced`);const c=n("updated");c&&r.push(`${c} updated`);const u=n("present");u&&r.push(`${u} already here`);const f=n("failed");return f&&r.push(`${f} did not arrive`),`${r.join(", ")}.`}const NF=1500,od=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],y_="aa-panel",w_=e=>`aa-tab-${e}`;async function Gl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const _x=me.forwardRef((e,t)=>l.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[l.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),l.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));_x.displayName="SuccessMark";function SF({onClose:e,onChanged:t}){const[n,r]=x.useState("login"),[a,i]=x.useState(null),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(!1),[y,w]=x.useState(null),[N,_]=x.useState(null),[S,b]=x.useState(null),[j,E]=x.useState(null),C=x.useRef(""),T=x.useRef(!1),R=x.useRef(!1),$=x.useRef(null),D=x.useRef(null),W=x.useRef(null),L=x.useRef(null),V=x.useRef([]),Q=x.useRef(!1),ee=x.useCallback(()=>{T.current&&Gl({action:"login-cancel"}).catch(()=>{}),e()},[e]),M=fn(ee,{focusRef:W}),X=x.useCallback(async()=>{if(!Ls(R.current))return;R.current=!0,m(!0),w(null),T.current=!0;const U=await Gl({action:"login"}).catch(()=>null);if(R.current=!1,m(!1),!(U!=null&&U.ok)){w(Si(U,"could not start the sign-in"));return}i(U)},[]);x.useEffect(()=>{if(!Qq(a==null?void 0:a.state))return;const U=window.setInterval(async()=>{try{const ne=await fetch("/api/claude-accounts/login");ne.ok&&i(await ne.json())}catch{}},NF);return()=>window.clearInterval(U)},[a]);const H=x.useRef(t);H.current=t;const I=x.useState(sF)[0];x.useEffect(()=>{var U;(a==null?void 0:a.state)==="awaiting_code"&&((U=$.current)==null||U.focus()),I.shouldAnnounce(a==null?void 0:a.state)&&H.current()},[a==null?void 0:a.state,I]),x.useEffect(()=>{var U;n==="paste"&&!Q.current&&((U=D.current)==null||U.focus()),Q.current=!1},[n]);const B=x.useCallback(U=>{var ae;const ne=vF(U,od.findIndex(pe=>pe.id===n),od.length);ne.kind!=="pass"&&(U.preventDefault(),Q.current=!0,r(od[ne.index].id),(ae=V.current[ne.index])==null||ae.focus())},[n]),P=x.useCallback(async()=>{var ne;if(!Ls(R.current))return;R.current=!0,m(!0),w(null);const U=await Gl({action:"login-code",code:c}).catch(()=>null);if(R.current=!1,m(!1),!(U!=null&&U.ok)){w(Si(U,"the code was not accepted")),U!=null&&U.state&&i(U),(ne=$.current)==null||ne.select();return}u(""),i(U)},[c,a]),z=x.useCallback(async()=>{if(!Ls(R.current))return;R.current=!0,m(!0),w(null);const U=await Gl({action:"import",blob:f}).catch(()=>null);if(R.current=!1,m(!1),!(U!=null&&U.ok)){w(Si(U,"the import failed"));return}C.current=f,p(""),E(null),_(U.results??[]),t()},[f,t]),O=x.useCallback(async U=>{const ne=`${U.email}|${U.org??""}`;if(!Ls(R.current)||!C.current)return;R.current=!0,m(!0),b(ne),E(null);const ae=await Gl({action:"import",blob:C.current,force:!0,only:{email:U.email,org:U.org??""}}).catch(()=>null);if(R.current=!1,m(!1),b(null),!(ae!=null&&ae.ok)){E({key:ne,text:Si(ae,"that account could not be updated")});return}const pe=(ae.results??[])[0];pe&&_(ge=>ge&&ge.map(Se=>`${Se.email}|${Se.org??""}`===ne?pe:Se)),t()},[t]),K=(a==null?void 0:a.state)==="done"?a.account:null,de=nF({restored:a==null?void 0:a.restored,activeAccount:a==null?void 0:a.activeAccount}),G=QA(a==null?void 0:a.state)||!!(y&&T.current&&!h),J=tF({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return pr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:ee,role:"presentation",children:l.jsxs("div",{ref:M,className:"modal aa-modal",onClick:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:B,children:od.map((U,ne)=>l.jsx("button",{type:"button",role:"tab",id:w_(U.id),ref:ae=>{V.current[ne]=ae},"aria-selected":n===U.id,"aria-controls":y_,tabIndex:n===U.id?0:-1,className:`aa-tab${n===U.id?" on":""}`,onClick:()=>{Q.current=!1,r(U.id)},children:U.label},U.id))})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:ee,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsx("section",{className:"modal-body aa-body",id:y_,role:"tabpanel","aria-labelledby":w_(n),children:n==="login"?K?l.jsxs("div",{className:"aa-done",children:[l.jsx(_x,{ref:L}),l.jsx(g_,{anchor:L}),l.jsx("h4",{children:K.added?`Account ${K.num} added`:"Credentials refreshed"}),l.jsxs("p",{className:"aa-note",children:[l.jsx("strong",{children:K.email}),K.added?de?" is in the rotation.":" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),de?l.jsx("p",{className:"aa-note aa-warn",role:"status",children:de}):null,l.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(a==null?void 0:a.state)==="awaiting_code"||(a==null?void 0:a.state)==="registering"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:"1 · Approve in the browser"}),l.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),l.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),l.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."}),l.jsxs("div",{className:"aa-field",children:[l.jsx("input",{ref:$,type:"text",value:c,onChange:U=>u(U.target.value),onKeyDown:U=>{U.key==="Enter"&&c.trim()&&!h&&P()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),l.jsx("button",{type:"button",className:"btn primary",..._a(h,!c.trim()||a.state==="registering"),onClick:P,children:a.state==="registering"?"registering…":"Continue"})]}),(y||a.error)&&l.jsx("p",{className:"aa-err",children:y??a.error}),l.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."})]})]}):G?l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:J.title}),l.jsx("p",{className:"aa-err",children:J.message}),l.jsx("button",{type:"button",className:"btn",onClick:()=>{T.current=!1,i(null),w(null),X()},children:"Try again"})]}):h||T.current?l.jsx("div",{className:"aa-step",children:l.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):l.jsxs("div",{className:"aa-step aa-primer",children:[l.jsx("h4",{children:"Sign in to Anthropic"}),l.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."}),l.jsx("div",{className:"aa-actions",children:l.jsx("button",{type:"button",ref:W,className:"btn primary",onClick:X,children:"Open the sign-in page"})})]}):N?(()=>{const U=N.filter(ne=>ne.state==="imported").length;return l.jsxs("div",{className:"aa-done",children:[l.jsx(_x,{ref:L}),U>0&&l.jsx(g_,{anchor:L}),l.jsx("h4",{children:_F(N)}),N.length>0&&l.jsx("ul",{className:"aa-results",children:N.map(ne=>{const ae=`${ne.email}|${ne.org??""}`;return l.jsxs("li",{className:`aa-result ${ne.state}`,children:[l.jsx("span",{className:"aa-result-who",children:ne.email||(ne.num?`slot ${ne.num}`:"an account")}),l.jsx("span",{className:"aa-result-what",children:kF(ne.state)}),ne.state==="present"&&l.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":S===ae,title:`Overwrite the stored login for ${ne.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>O(ne),children:S===ae?"updating…":"update anyway"}),(j==null?void 0:j.key)===ae&&l.jsx("span",{className:"aa-result-err",children:j.text})]},ae)})}),l.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",l.jsx("strong",{children:" update anyway"}),"."]}),l.jsxs("div",{className:"aa-actions",children:[l.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),l.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",E(null),_(null)},children:"Import another"})]})]})})():l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:"Paste an account shared from another deck"}),l.jsxs("div",{className:"aa-field",children:[l.jsx("input",{ref:D,type:"text",value:f,onChange:U=>p(U.target.value),onKeyDown:U=>{U.key==="Enter"&&f.trim()&&!h&&z()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),l.jsx("button",{type:"button",className:"btn primary",..._a(h,!f.trim()),onClick:z,children:h?"importing…":"Import"})]}),y&&l.jsx("p",{className:"aa-err",children:y}),l.jsxs("p",{className:"aa-note",children:["Use ",l.jsx("strong",{children:"share"})," on one account in the other deck, or ",l.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})}),document.body)}function jF(e,t,n){if(n<=0||dh(e))return{kind:"pass"};const r=t>=0&&t<n?t:-1;switch(e.key){case"ArrowDown":return{kind:"focus",index:r===-1?0:(r+1)%n};case"ArrowUp":return{kind:"focus",index:r===-1?n-1:(r-1+n)%n};case"Home":return{kind:"focus",index:0};case"End":return{kind:"focus",index:n-1};default:return{kind:"pass"}}}const Na=4,Ir=8;function tR(e,t,n){const r=n.width-Ir-(e.right+Na),a=e.left-Na-Ir,i=t.width<=r||r>=a?"right":"left",c=i==="right"?e.right+Na:e.left-Na-t.width,u=n.height-Ir*2,f=t.height<=u,p=f?t.height:Math.max(0,u);return{top:Math.max(Ir,Math.min(e.top,n.height-Ir-p)),left:Math.max(Ir,c),side:i,maxHeight:f?null:p}}function EF(e,t,n){const r=n.height-Ir-(e.bottom+Na),a=e.top-Na-Ir,i=t.height<=r||r>=a?"below":"above",c=i==="below"?r:a,u=t.height<=c,f=u?t.height:Math.max(0,c),p=i==="below"?e.bottom+Na:e.top-Na-f,h=Math.max(Ir,Math.min(e.right-t.width,n.width-Ir-t.width));return{top:Math.max(Ir,p),left:h,side:i,maxHeight:u?null:f}}const nR='[role="menuitem"]';function v_(e){return e?Array.from(e.querySelectorAll(nR)).filter(t=>!t.disabled):[]}function x_({anchorId:e,boundaryId:t,id:n,className:r,role:a,labelledBy:i,start:c="first",onClose:u,children:f}){const p=x.useRef(u);p.current=u;const h=fn(()=>{var _;(_=document.getElementById(e))==null||_.focus(),p.current()}),m=x.useCallback(()=>{var C;const _=h.current;if(!_)return;const S=document.getElementById(e);if(!S){p.current();return}const b=S.getBoundingClientRect(),j=t?(C=document.getElementById(t))==null?void 0:C.getBoundingClientRect():null;if(j&&(b.bottom<=j.top||b.top>=j.bottom)){_.contains(document.activeElement)&&S.focus({preventScroll:!0}),p.current();return}_.style.maxHeight="";const E=EF(b,{width:_.offsetWidth,height:_.offsetHeight},{width:window.innerWidth,height:window.innerHeight});_.style.top=`${E.top}px`,_.style.left=`${E.left}px`,_.style.maxHeight=E.maxHeight==null?"":`${E.maxHeight}px`,_.dataset.side=E.side},[e,t,h]);x.useLayoutEffect(()=>{m()}),x.useEffect(()=>{const _=S=>{var b;(b=h.current)!=null&&b.contains(S.target)||m()};return window.addEventListener("scroll",_,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",m)}},[m,h]),x.useEffect(()=>{const _=S=>{var j,E;const b=S.target;!b||(j=h.current)!=null&&j.contains(b)||(E=document.getElementById(e))!=null&&E.contains(b)||p.current()};return window.addEventListener("pointerdown",_,!0),()=>window.removeEventListener("pointerdown",_,!0)},[e,h]),x.useEffect(()=>{var S;if(a!=="menu")return;const _=v_(h.current);(S=c==="last"?_[_.length-1]:_[0])==null||S.focus()},[]);const y=_=>{var S;if(a==="menu"&&_.key==="Tab"){_.stopPropagation(),(S=document.getElementById(e))==null||S.focus(),_.shiftKey&&_.preventDefault(),p.current();return}if(a==="menu"){const b=v_(h.current),j=jF(_,b.indexOf(document.activeElement),b.length);j.kind==="focus"&&(_.preventDefault(),b[j.index].focus())}_.key.length===1&&_.stopPropagation()},w=_=>{_.target.closest("button, input, select, textarea, code")||_.preventDefault()},N=_=>{if(a!=="menu"||_.pointerType==="touch")return;const S=_.target.closest(nR);S&&!S.disabled&&document.activeElement!==S&&S.focus({preventScroll:!0})};return pr.createPortal(l.jsx("div",{ref:h,id:n,className:`anchored-popover${r?` ${r}`:""}`,role:a,"aria-labelledby":i,onKeyDown:y,onMouseDown:w,onPointerMove:N,children:f}),document.body)}const CF=6;function TF(e,t){const n=e.filter(u=>u.ready);if(t.armed&&e.length>0&&n.length===0)return{text:"Auto-switch has nowhere to go",tone:"bad",free:null};const r=n.length===e.length?`${e.length} ready`:n.length===0?e.length===1?"not ready":`none of ${e.length} ready`:`${n.length} of ${e.length} ready`,a=n.length?"ok":"idle",i=t.strained&&!t.armed?AF(n):null,c=[r];return i!=null&&c.push(`${i}% free`),c.push(t.armed?`auto ${t.threshold??"on"}${t.threshold?"%":""}`:"auto off"),{text:c.join(" · "),tone:a,free:i}}function AF(e){const t=e.map(n=>n.headroom).filter(n=>typeof n=="number");return t.length?Math.max(...t):null}function RF(e){const t=[...e].sort((a,i)=>{if(a.ready!==i.ready)return a.ready?-1:1;if(!a.ready)return a.name.localeCompare(i.name);const c=a.headroom,u=i.headroom;return c==null&&u==null?a.name.localeCompare(i.name):c==null?1:u==null?-1:u-c}),n=t.slice(0,CF),r=t.length-n.length;return{title:e.some(a=>a.ready)?"Where you could switch":"Nothing to switch to",shown:n,rest:r>0?`and ${r} more`:null}}function rR({title:e,steps:t,finish:n,aside:r,onClose:a}){const i=x.useRef(null),c=fn(a,{focusRef:i}),[u,f]=x.useState(0),p=u===t.length-1,h=t[u],m=N=>f(Math.max(0,Math.min(t.length-1,N))),y=N=>{N.key!=="ArrowRight"&&N.key!=="ArrowLeft"||(N.preventDefault(),N.stopPropagation(),m(N.key==="ArrowRight"?u+1:u-1))},w=()=>{if(!p){m(u+1);return}n?n.act():a()};return pr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:l.jsxs("div",{ref:c,className:"modal guide",onClick:N=>N.stopPropagation(),onKeyDown:y,role:"dialog","aria-modal":"true","aria-labelledby":"guide-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{id:"guide-title",className:"modal-tool-name",children:e}),l.jsxs("span",{className:"modal-tool-id",children:[u+1," / ",t.length]})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsx("div",{className:"guide-stage",children:h.art},u),l.jsx("p",{className:"guide-line","aria-live":"polite",children:h.line}),l.jsx("p",{className:"guide-tip",children:h.tip??""}),l.jsxs("div",{className:"guide-foot",children:[l.jsx("div",{className:"guide-dots",children:t.map((N,_)=>l.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${_+1} of ${t.length}`,"aria-current":_===u?"step":void 0,onClick:()=>m(_)},_))}),p&&r&&l.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:r.act,children:r.label}),u>0&&l.jsx("button",{type:"button",className:"btn",onClick:()=>m(u-1),children:"Back"}),l.jsx("button",{ref:i,type:"button",className:"btn primary",onClick:w,children:p?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const Nx={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function mr({children:e}){return l.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function fr({x:e,y:t=34,w:n=176,h:r=132,label:a}){return l.jsxs(l.Fragment,{children:[a&&l.jsx("text",{x:e+2,y:t-9,className:"ga-cap",children:a}),l.jsx("rect",{x:e,y:t,width:n,height:r,rx:10,className:"ga-screen"})]})}function Lr({x:e,y:t,email:n,state:r,tone:a,bars:i}){return l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:e+3,cy:t-4,r:3,className:Nx[a]}),l.jsx("text",{x:e+12,y:t,className:"ga-t ga-mono",children:n}),l.jsx("text",{x:e+12,y:t+16,className:`ga-s ${Nx[a]}`,children:r}),i==null?void 0:i.map((c,u)=>l.jsxs("g",{children:[l.jsx("text",{x:e,y:t+40+u*18,className:"ga-s",children:u?"7d":"5h"}),l.jsx("rect",{x:e+22,y:t+35+u*18,width:96,height:4,rx:2,className:"ga-track"}),l.jsx("rect",{x:e+22,y:t+35+u*18,width:96*c/100,height:4,rx:2,className:"ga-accent"}),l.jsxs("text",{x:e+148,y:t+40+u*18,className:"ga-s ga-accent",textAnchor:"end",children:[c,"%"]})]},u))]})}function sR({x:e,y:t,on:n}){return l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:30,height:18,rx:9,className:n?"ga-switch-on":"ga-switch"}),l.jsx("circle",{cx:n?e+21:e+9,cy:t+9,r:6,className:n?"ga-knob-on":"ga-knob"})]})}function id({x:e,y:t,name:n,here:r=!0}){return l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:e+3,cy:t-4,r:3,className:r?"ga-ok":"ga-dim"}),l.jsx("text",{x:e+12,y:t,className:r?"ga-t":"ga-s",children:n})]})}function b_({x:e,y:t,on:n}){return n?l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:12,height:12,rx:3,className:"ga-accent"}),l.jsx("path",{d:`M${e+3} ${t+6.2}l2.3 2.3 4-4.6`,className:"ga-tick"})]}):l.jsx("rect",{x:e+.5,y:t+.5,width:11,height:11,rx:3,className:"ga-box"})}function k_({x:e,y:t,d:n}){return l.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function c0({x:e,y:t}){return l.jsx("path",{d:`M${e} ${t}l0 13 3.4-3 2.4 5.2 2-.9-2.4-5.1 4.6-.2z`,className:"ga-pointer"})}function u0(){return l.jsxs(l.Fragment,{children:[l.jsx("circle",{r:9,className:"ga-key-bed"}),l.jsxs("g",{transform:"translate(-6 -6) scale(0.857)",className:"ga-key",children:[l.jsx("circle",{cx:4.6,cy:7,r:2.6}),l.jsx("path",{d:"M7.2 7h5.2M10.6 7v2.2M12.4 7v1.6"})]})]})}function ji({x:e,y:t,w:n,title:r,sub:a,tone:i}){return l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:n,height:40,rx:8,className:"ga-screen"}),l.jsx("rect",{x:e+6,y:t+10,width:3,height:20,rx:1.5,className:Nx[i]}),l.jsx("text",{x:e+16,y:t+17,className:"ga-t ga-strong",children:r}),l.jsx("text",{x:e+16,y:t+31,className:"ga-s",children:a})]})}function Ai({x:e,y:t,label:n,live:r}){return l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:46,height:20,rx:10,className:r?"ga-chip-live":"ga-chip"}),l.jsx("text",{x:e+23,y:t+14,className:"ga-s ga-mono",textAnchor:"middle",children:n})]})}function Gd({x:e,y:t}){return l.jsxs(l.Fragment,{children:[l.jsx("text",{x:e,y:t,className:"ga-cap",children:"LOCAL NETWORK"}),l.jsx(sR,{x:e+118,y:t-13,on:!0})]})}function MF(){return l.jsxs(mr,{children:[l.jsx("rect",{x:14,y:14,width:206,height:172,rx:10,className:"ga-screen"}),l.jsx("text",{x:28,y:38,className:"ga-t ga-strong",children:"Sessions"}),l.jsx("text",{x:206,y:38,className:"ga-s ga-warn",textAnchor:"end",children:"1 waiting"}),l.jsx("rect",{x:20,y:50,width:194,height:42,rx:6,className:"ga-bed-warn"}),l.jsx("circle",{cx:33,cy:64,r:7,className:"ga-ring-warn ga-ping"}),l.jsx("circle",{cx:33,cy:64,r:3.5,className:"ga-warn"}),l.jsx("text",{x:44,y:68,className:"ga-t",children:"api-server"}),l.jsx("text",{x:44,y:83,className:"ga-s ga-warn",children:"waiting 6m · Bash"}),l.jsx("circle",{cx:33,cy:108,r:3.5,className:"ga-flight"}),l.jsx("text",{x:44,y:112,className:"ga-t",children:"docs-site"}),l.jsx("text",{x:44,y:127,className:"ga-s",children:"running · 12 tools"}),l.jsx("circle",{cx:33,cy:150,r:3.5,className:"ga-ok"}),l.jsx("text",{x:44,y:154,className:"ga-t",children:"billing"}),l.jsx("text",{x:44,y:169,className:"ga-s",children:"done · $0.84"}),l.jsx("path",{d:"M216 71C234 71 230 100 244 100",className:"ga-arc"}),l.jsx("path",{d:"M239 96l5 4-5 4",className:"ga-arrow"}),l.jsx("rect",{x:248,y:44,width:178,height:112,rx:10,className:"ga-screen"}),l.jsx("text",{x:262,y:64,className:"ga-cap",children:"API-SERVER"}),l.jsx("line",{x1:248,y1:74,x2:426,y2:74,className:"ga-line"}),l.jsx("text",{x:262,y:96,className:"ga-s ga-mono",children:"Bash(npm test)"}),l.jsx("text",{x:262,y:116,className:"ga-t ga-mono ga-warn",children:"Allow this command?"}),l.jsx("text",{x:262,y:136,className:"ga-s ga-mono",children:"> 1. Yes 2. No"})]})}function IF(){return l.jsxs(mr,{children:[l.jsx("path",{d:"M136 100C166 100 166 38 196 38",className:"ga-edge ga-flow"}),l.jsx("path",{d:"M136 100H196",className:"ga-edge ga-flow"}),l.jsx("path",{d:"M136 100C166 100 166 162 196 162",className:"ga-edge-done"}),l.jsx("path",{d:"M308 38H326M308 100H326",className:"ga-edge"}),l.jsx(ji,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),l.jsx(ji,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),l.jsx(ji,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),l.jsx(ji,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),l.jsx(Ai,{x:326,y:28,label:"Read"}),l.jsx(Ai,{x:380,y:28,label:"Grep",live:!0}),l.jsx(Ai,{x:326,y:90,label:"Bash",live:!0})]})}function __({x:e,y:t,label:n,pct:r,note:a}){return l.jsxs(l.Fragment,{children:[l.jsx("text",{x:e,y:t,className:"ga-s",children:n}),l.jsxs("text",{x:e+194,y:t,className:"ga-s ga-accent",textAnchor:"end",children:[r,"%"]}),l.jsx("rect",{x:e,y:t+7,width:194,height:5,rx:2.5,className:"ga-track"}),l.jsx("rect",{x:e,y:t+7,width:194*r/100,height:5,rx:2.5,className:"ga-accent"}),l.jsx("text",{x:e,y:t+26,className:"ga-s",children:a})]})}function $F(){return l.jsxs(mr,{children:[l.jsx("rect",{x:14,y:30,width:172,height:140,rx:10,className:"ga-screen"}),l.jsx("text",{x:30,y:56,className:"ga-cap",children:"THIS SESSION"}),l.jsx("text",{x:30,y:98,className:"ga-big",children:"$3.66"}),l.jsx("text",{x:30,y:122,className:"ga-s",children:"Opus 5 · 1.2M tokens"}),l.jsx("text",{x:30,y:150,className:"ga-s",children:"$21.40 today"}),l.jsx("rect",{x:200,y:30,width:226,height:140,rx:10,className:"ga-screen"}),l.jsx("text",{x:216,y:56,className:"ga-cap",children:"CLAUDE QUOTA"}),l.jsx(__,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),l.jsx(__,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function OF(){return l.jsxs(mr,{children:[l.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),l.jsx(ji,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),l.jsx(c0,{x:156,y:106}),l.jsx("path",{d:"M170 92C186 92 184 60 200 60",className:"ga-arc"}),l.jsx("path",{d:"M195 56l5 4-5 4",className:"ga-arrow"}),l.jsx(fr,{x:200,y:22,w:226,h:160}),l.jsx("text",{x:214,y:46,className:"ga-t ga-strong",children:"tests"}),l.jsx("text",{x:412,y:46,className:"ga-s",textAnchor:"end",children:"Sonnet 5 · 38s"}),l.jsx("line",{x1:200,y1:56,x2:426,y2:56,className:"ga-line"}),l.jsx("text",{x:214,y:76,className:"ga-cap",children:"PROMPT"}),l.jsx("text",{x:214,y:92,className:"ga-t",children:"Run the suite and fix what fails"}),l.jsx("text",{x:214,y:116,className:"ga-cap",children:"TOOLS · 6"}),l.jsx(Ai,{x:214,y:122,label:"Read"}),l.jsx(Ai,{x:266,y:122,label:"Edit"}),l.jsx(Ai,{x:318,y:122,label:"Bash",live:!0}),l.jsx("text",{x:214,y:164,className:"ga-cap",children:"TOKENS"}),l.jsx("text",{x:214,y:178,className:"ga-s ga-mono",children:"41k in · 2.1k out · $0.12"})]})}function PF(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return l.jsxs(mr,{children:[l.jsx(fr,{x:14,y:20,w:412,h:160}),l.jsx("text",{x:28,y:44,className:"ga-t ga-strong",children:"This machine"}),l.jsx("text",{x:412,y:44,className:"ga-s",textAnchor:"end",children:"12 cores · up 10d"}),l.jsx("line",{x1:14,y1:56,x2:426,y2:56,className:"ga-line"}),l.jsx("text",{x:28,y:76,className:"ga-cap",children:"CORES"}),e.map((t,n)=>l.jsxs("g",{children:[l.jsx("rect",{x:28+n*15,y:82,width:10,height:30,rx:2,className:"ga-track"}),l.jsx("rect",{x:28+n*15,y:112-t,width:10,height:t,rx:2,className:"ga-accent"})]},n)),l.jsx("text",{x:28,y:136,className:"ga-cap",children:"MEMORY"}),l.jsx("rect",{x:28,y:143,width:178,height:5,rx:2.5,className:"ga-track"}),l.jsx("rect",{x:28,y:143,width:105,height:5,rx:2.5,className:"ga-accent"}),l.jsx("text",{x:28,y:165,className:"ga-s",children:"18.9 GB of 32.0 GB"}),l.jsx("text",{x:240,y:76,className:"ga-cap",children:"THERMAL"}),l.jsx("text",{x:240,y:100,className:"ga-big",children:"66 °C"}),l.jsx("text",{x:240,y:118,className:"ga-s ga-ok",children:"running at full speed"}),l.jsx("text",{x:240,y:142,className:"ga-cap",children:"BUSIEST PROCESSES"}),l.jsx("text",{x:240,y:160,className:"ga-s ga-mono",children:"node · claude"}),l.jsx("text",{x:412,y:160,className:"ga-s ga-mono",textAnchor:"end",children:"38%"}),l.jsx("text",{x:240,y:176,className:"ga-s ga-mono",children:"esbuild"}),l.jsx("text",{x:412,y:176,className:"ga-s ga-mono",textAnchor:"end",children:"21%"})]})}function LF(){return l.jsxs(mr,{children:[l.jsx("rect",{x:14,y:40,width:188,height:120,rx:10,className:"ga-screen"}),l.jsx("text",{x:28,y:60,className:"ga-cap",children:"~/MY-PROJECT"}),l.jsx("line",{x1:14,y1:70,x2:202,y2:70,className:"ga-line"}),l.jsxs("text",{x:28,y:100,className:"ga-t ga-mono",children:[l.jsx("tspan",{className:"ga-accent",children:"$"})," claude"]}),l.jsx("rect",{x:86,y:90,width:7,height:13,className:"ga-caret ga-blink"}),l.jsx("text",{x:28,y:130,className:"ga-s ga-mono",children:"or: codex"}),l.jsx("path",{d:"M210 100H238",className:"ga-arc"}),l.jsx("path",{d:"M233 95l6 5-6 5",className:"ga-arrow"}),l.jsx("rect",{x:250,y:40,width:176,height:120,rx:10,className:"ga-canvas"}),l.jsx("g",{className:"ga-pop",children:l.jsx(ji,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function DF(){return l.jsxs(mr,{children:[l.jsx(fr,{x:14,y:16,w:232,h:170}),l.jsx("text",{x:28,y:40,className:"ga-t ga-strong",children:"Claude accounts"}),l.jsx(k_,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),l.jsx(k_,{x:220,y:33,d:"M3.3 10.7L10.7 3.3M5.2 3.3h5.5v5.5"}),l.jsx("line",{x1:14,y1:52,x2:246,y2:52,className:"ga-line"}),l.jsx(Lr,{x:28,y:74,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),l.jsx("rect",{x:190,y:62,width:44,height:18,rx:9,className:"ga-accent"}),l.jsx("text",{x:212,y:74,className:"ga-s ga-on-accent",textAnchor:"middle",children:"active"}),l.jsx("line",{x1:14,y1:140,x2:246,y2:140,className:"ga-line"}),l.jsx(Lr,{x:28,y:160,email:"personal@me.dev",state:"signed in",tone:"ok"}),l.jsx("rect",{x:188,y:148,width:46,height:18,rx:9,className:"ga-chip"}),l.jsx("text",{x:211,y:160,className:"ga-s",textAnchor:"middle",children:"switch"}),l.jsx(c0,{x:221,y:161}),l.jsx("path",{d:"M250 40C270 40 262 78 282 78",className:"ga-arc"}),l.jsx("path",{d:"M277 74l5 4-5 4",className:"ga-arrow"}),l.jsx(fr,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),l.jsx("g",{className:"ga-pop",children:l.jsx(Lr,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function qF(){return l.jsxs(mr,{children:[l.jsx(fr,{x:14,label:"THIS MACHINE"}),l.jsx(Gd,{x:28,y:60}),l.jsx("g",{className:"ga-swap-out",children:l.jsx(Lr,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),l.jsx("g",{className:"ga-swap-in",children:l.jsx(Lr,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),l.jsx(fr,{x:250,label:"ANOTHER MACHINE"}),l.jsx(Gd,{x:264,y:60}),l.jsx(Lr,{x:264,y:98,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),l.jsx("path",{d:"M246 120C234 80 206 80 194 120",className:"ga-arc"}),l.jsx("g",{className:"ga-travel ga-travel-low",transform:"translate(220 90)",children:l.jsx(u0,{})})]})}const FF=[{art:l.jsx(MF,{}),line:"Sessions waiting on you top the session list, longest wait first.",tip:"A tone and a system notification when one stops to ask. The speaker in the topbar."},{art:l.jsx(IF,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:l.jsx(OF,{}),line:"Click any node: its prompt, every tool call, tokens and timing."},{art:l.jsx($F,{}),line:"What each session costs, and how much quota is left."},{art:l.jsx(PF,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:l.jsx(DF,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:l.jsx(qF,{}),line:"Your machines repair each other's expired logins over the local network.",tip:"Open it from the row at the foot of the Claude accounts panel."},{art:l.jsx(LF,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function BF(){return l.jsxs(mr,{children:[l.jsx(fr,{x:14,label:"THIS MACHINE"}),l.jsx(Lr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"}),l.jsx("rect",{x:40,y:94,width:86,height:20,rx:10,className:"ga-pill-warn"}),l.jsx("text",{x:83,y:108,className:"ga-s ga-warn",textAnchor:"middle",children:"sign in again"}),l.jsx("line",{x1:198,y1:100,x2:242,y2:100,className:"ga-off"}),l.jsx(fr,{x:250,label:"ANOTHER MACHINE"}),l.jsx(Lr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function zF(){return l.jsxs(mr,{children:[l.jsx(fr,{x:14,label:"THIS MACHINE"}),l.jsx(Gd,{x:28,y:60}),l.jsx(id,{x:28,y:92,name:"Ana's MacBook"}),l.jsx(id,{x:28,y:114,name:"Dorin's PC"}),l.jsx(fr,{x:250,label:"ANOTHER MACHINE"}),l.jsx(Gd,{x:264,y:60}),l.jsx(id,{x:264,y:92,name:"Your MacBook"}),l.jsx(id,{x:264,y:114,name:"Dorin's PC"}),l.jsx("line",{x1:196,y1:100,x2:244,y2:100,className:"ga-arc"}),l.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping"}),l.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping ga-ping-2"}),l.jsx("circle",{cx:220,cy:100,r:3,className:"ga-accent"})]})}function UF(){return l.jsxs(mr,{children:[l.jsx("rect",{x:90,y:18,width:260,height:164,rx:10,className:"ga-screen"}),l.jsx("text",{x:106,y:42,className:"ga-t ga-strong",children:"This deck on the network"}),l.jsx("line",{x1:90,y1:54,x2:350,y2:54,className:"ga-line"}),l.jsx("text",{x:106,y:76,className:"ga-cap",children:"SHARE THESE ACCOUNTS"}),l.jsx(b_,{x:106,y:88,on:!0}),l.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),l.jsx(b_,{x:106,y:112}),l.jsx("text",{x:126,y:122,className:"ga-s ga-mono",children:"personal@me.dev"}),l.jsx("text",{x:106,y:150,className:"ga-cap",children:"PAIRING"}),l.jsx("text",{x:106,y:168,className:"ga-s",children:"Say yes to every deck that asks"}),l.jsx(sR,{x:304,y:157,on:!0}),l.jsx(c0,{x:115,y:97})]})}function WF(){return l.jsxs(mr,{children:[l.jsx(fr,{x:14,label:"THIS MACHINE"}),l.jsx("g",{className:"ga-swap-out",children:l.jsx(Lr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),l.jsx("g",{className:"ga-swap-in",children:l.jsx(Lr,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),l.jsx(fr,{x:250,label:"ANOTHER MACHINE"}),l.jsx(Lr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),l.jsx("path",{d:"M246 96C234 56 206 56 194 96",className:"ga-arc"}),l.jsx("g",{className:"ga-travel",transform:"translate(220 66)",children:l.jsx(u0,{})})]})}const HF=[{art:l.jsx(BF,{}),line:"A login can expire on one machine while it still works on another."},{art:l.jsx(zF,{}),line:"Both decks are on. They find each other and ask to pair.",tip:"Not showing up? The + in the section reaches a machine by address or invite."},{art:l.jsx(UF,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:l.jsx(WF,{}),line:"An expired login is copied from a paired machine within a minute."}];function GF(){return l.jsxs("svg",{className:"guide-art",viewBox:"0 0 232 60","aria-hidden":!0,focusable:"false",children:[l.jsx("rect",{x:1,y:14,width:78,height:42,rx:7,className:"ga-screen"}),l.jsx("circle",{cx:13,cy:29,r:3,className:"ga-warn"}),l.jsx("rect",{x:21,y:27,width:46,height:4,rx:2,className:"ga-track"}),l.jsx("rect",{x:13,y:39,width:40,height:3,rx:1.5,className:"ga-track"}),l.jsx("rect",{x:153,y:14,width:78,height:42,rx:7,className:"ga-screen"}),l.jsx("circle",{cx:165,cy:29,r:3,className:"ga-ok"}),l.jsx("rect",{x:173,y:27,width:46,height:4,rx:2,className:"ga-track"}),l.jsx("rect",{x:165,y:39,width:40,height:3,rx:1.5,className:"ga-accent"}),l.jsx("path",{d:"M150 36C138 6 94 6 82 36",className:"ga-arc"}),l.jsx("g",{transform:"translate(116 13)",children:l.jsx(u0,{})})]})}const VF={panel:"Nothing here is stuck: whoever pastes an invite is the one dialling out. Ask them for one and paste it behind the + above, where an address can be typed too.",dialog:"Nothing here is stuck: whoever pastes an invite is the one dialling out. Ask them for one and paste it below, or type their address."},KF=1600;function aR({reach:e,where:t}){const[n,r]=x.useState(!1),a=x.useRef(!0);x.useEffect(()=>()=>{a.current=!1},[]);const i=(e==null?void 0:e.steps)??[],c=x.useCallback(async()=>{await ph(i.join(`
90
+ `))&&a.current&&(r(!0),window.setTimeout(()=>{a.current&&r(!1)},KF))},[i]);if(!(e!=null&&e.blocked))return null;const u=e.shell==="sh";return l.jsxs("div",{className:"ap-lan-reach",children:[l.jsx("p",{className:"lan-warn",children:e.text}),l.jsx("p",{className:"lan-note",children:VF[t]}),i.length>0&&l.jsxs("details",{className:"ap-lan-reach-fix",children:[l.jsx("summary",{children:"or let them find this deck on their own"}),l.jsxs("p",{className:"lan-note",children:[u?l.jsx(l.Fragment,{children:"Run this in a terminal on this machine, then restart the deck."}):l.jsxs(l.Fragment,{children:["Run this in PowerShell ",l.jsx("strong",{children:"as Administrator"}),", then restart the deck."]}),e.category==="Public"&&l.jsx(l.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."}),e.unsure&&l.jsxs(l.Fragment,{children:[" ",e.unsure]})]}),l.jsx("pre",{className:"ap-lan-cmd",children:l.jsx("code",{children:i.join(`
91
+ `)})}),l.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>void c(),title:u?"Copy these lines, then paste them into a terminal":"Copy these lines, then paste them into an elevated PowerShell",children:n?"copied":"copy command"})]})]})}async function Sp(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const YF={not_an_invite:"That is not an invite — paste the whole line they sent you.",expired:"That invite has run out. Ask them for a fresh one.",not_running:"This deck is not on the network yet. Turn Local network on, then try again."},XF={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function N_(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||Vt(n,t)}function ZF({status:e,manual:t,onClose:n,onChanged:r}){const a=x.useRef(null),i=fn(n,{focusRef:a}),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(null),[y,w]=x.useState(null),[N,_]=x.useState(null),[S,b]=x.useState(null),[j,E]=x.useState(()=>Date.now());x.useEffect(()=>{const I=window.setInterval(()=>E(Date.now()),1e3);return()=>window.clearInterval(I)},[]);const C=x.useRef(!0);x.useEffect(()=>()=>{C.current=!1},[]);const T=x.useRef(null),R=x.useCallback(I=>gh(T.current)?(T.current=I,_(I),!0):!1,[]),$=x.useCallback(()=>{T.current=null,C.current&&_(null)},[]),D=I=>{const B=Ta(N,I);return{disabled:B.disabled,"aria-busy":B.busy}},W=I=>(h==null?void 0:h.field)===I?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},L=I=>m(B=>B&&B.field===I?null:B),V=x.useCallback(async()=>{const I=h8(c);if(!I){m({text:QF(c),field:"addr"});return}const B=`${I.addr}:${I.port}`,P=e.peers.find(z=>z.addr===I.addr&&z.port===I.port&&z.paired);if(P){m({text:`Already paired with ${P.name} at that address.`,field:"addr"});return}if(t.includes(B)){m({text:"This deck already calls that address.",field:"addr"});return}if(R("add"))try{const z=await Sp("/api/prefs",{lan:{manual:[...t,B]}});if(!C.current)return;z!=null&&z.ok?(m(null),u(""),r(),n()):m({text:Vt("add that address",z),field:"addr"})}catch{C.current&&m({text:Vt("add that address",null),field:"addr"})}finally{$()}},[c,t,e.peers,r,n,R,$]),Q=x.useCallback(async I=>{if(!R(`invite:${I}`))return;const B=I==="make"?"make an invite":"cancel that invite";try{const P=await Sp("/api/lan/invite",{action:I});if(!C.current)return;P!=null&&P.ok?(m(null),w(null),r()):m({text:N_(XF,P,B)})}catch{C.current&&m({text:Vt(B,null)})}finally{$()}},[r,R,$]),ee=x.useCallback(async()=>{const I=f.trim();if(!(!I||!R("join"))){b(null);try{const B=await Sp("/api/lan/invite",{action:"join",token:I});if(!C.current)return;B!=null&&B.ok?(p(""),m(null),r(),n()):(B==null?void 0:B.reason)==="unreachable"&&Array.isArray(B.tried)&&B.tried.length?(b(B.tried),m(null)):(b(null),m({text:N_(YF,B,"use that invite"),field:"join"}))}catch{C.current&&m({text:Vt("use that invite",null),field:"join"})}finally{$()}}},[f,r,n,R,$]),M=x.useCallback(async(I,B)=>{try{await navigator.clipboard.writeText(I),w(B),window.setTimeout(()=>{C.current&&w(P=>P===B?null:P)},1600)}catch{m({text:"Could not copy it — select the text and copy it by hand."})}},[]),X=e.invite&&e.invite.expiresAt>j?e.invite:null,H=e.port!=null?(e.addrs??[]).map(I=>`${I}:${e.port}`):[];return pr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:i,className:"modal lan-add",onClick:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[h&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:h.text}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),l.jsx(aR,{reach:e.reach,where:"dialog"}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"By address"}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("input",{ref:a,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:c,placeholder:"192.168.1.5:54340",spellCheck:!1,...W("addr"),onChange:I=>{u(I.target.value),L("addr")},onKeyDown:I=>{I.key==="Enter"&&V()}}),c.trim()!==""&&l.jsx("button",{type:"button",className:"ap-manage-btn",...D("add"),onClick:()=>void V(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),l.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."}),e.port!=null&&H.length>0&&l.jsxs("p",{className:"lan-note",children:["They type this deck’s own address into the same field on theirs:"," ",H.map((I,B)=>l.jsxs("span",{children:[B>0&&" or ",l.jsx("code",{className:"ap-lan-code",children:I})]},I)),l.jsx("button",{type:"button",className:"ap-lan-word lan-copy",...D("copy:mine"),onClick:()=>void M(H.join(" "),"mine"),title:"Copy this deck's address, to send to whoever is adding it",children:y==="mine"?"copied":"copy"})]})]}),l.jsxs("div",{className:"modal-section",children:[l.jsxs("h3",{className:"lan-h",children:["With an invite",!X&&l.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...D("invite:make"),onClick:()=>void Q("make"),title:"One piece of text you send them. They paste it, and the two decks pair — nobody has to press anything here.",children:N==="invite:make"?"making…":"make one to send"})]}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:f,placeholder:"paste one you were sent",spellCheck:!1,...W("join"),onChange:I=>{p(I.target.value),b(null),L("join")},onKeyDown:I=>{I.key==="Enter"&&ee()}}),f.trim()!==""&&l.jsx("button",{type:"button",className:"ap-manage-btn",...D("join"),onClick:()=>void ee(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:N==="join"?"joining…":"join"})]}),l.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),S&&l.jsxs("div",{className:"ap-lan-tried",children:[l.jsx("span",{className:"lan-note",children:"Nothing answered at any address in that invite. Check that deck is running with its Local network switch on."}),S.map(I=>l.jsxs("span",{className:"ap-lan-tried-row",children:[l.jsx("code",{className:"ap-lan-code",children:I.addr}),l.jsx("span",{className:"ap-lan-bad",children:I.why})]},I.addr))]}),X&&l.jsxs("div",{className:"ap-lan-invite",children:[l.jsxs("div",{className:"ap-lan-invite-head",children:[l.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),l.jsxs("span",{className:"ap-lan-invite-left",children:[p8(X.expiresAt,j)," left"]})]}),l.jsx("code",{className:"ap-lan-token",children:X.token}),l.jsxs("div",{className:"ap-lan-acts",children:[l.jsx("button",{type:"button",className:"ap-manage-btn",...D("copy:invite"),onClick:()=>void M(X.token,"invite"),title:"Copy it, and send it however you already talk to them",children:y==="invite"?"copied":"copy"}),l.jsx("button",{type:"button",className:"ap-manage-btn",...D("invite:withdraw"),onClick:()=>void Q("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),l.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})}),document.body)}function QF(e){const t=(e??"").trim();if(t==="")return"Type an address and a port, like 192.168.1.5:54340.";if(!t.startsWith("[")&&(t.match(/:/g)??[]).length>1)return"Too many colons to split. Use that deck's IPv4 address or its name, like 192.168.1.5:54340.";if(!t.includes(":"))return`Add the port too, like ${t}:54340.`;const n=t.slice(t.lastIndexOf(":")+1).trim();return n===""?"That is missing its port — try 192.168.1.5:54340.":/^\d+$/.test(n)?`A port runs from 1 to 65535, and this one is ${n}.`:`A port is a number, and this one is "${n}".`}const JF=1e3;function e8(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),r=hs(e,t);return`${n} · ${r==="now"?"just now":r}`}function S_(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}function t8(){return l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M9.6 2.4l2 2L5 11l-2.6.6L3 9z"}),l.jsx("path",{d:"M8.4 3.6l2 2"})]})}function j_(){return l.jsxs("svg",{className:"lan-machine",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"2.5",y:"3",width:"11",height:"7.5",rx:"1.2"}),l.jsx("path",{d:"M1 13h14"})]})}function ld({dir:e,gate:t=!1}){const n=t?12:8;return l.jsx("svg",{className:"lan-chev","data-dir":e,"data-gate":t||void 0,width:n,height:"8",viewBox:`0 0 ${n} 8`,fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:e==="out"?"M2.8 1L6 4 2.8 7":t?"M1 1v6M9.6 1L6.4 4l3.2 3":"M5.2 1L2 4l3.2 3"})})}const n8={works:"works here",expired:"expired here",missing:"not on this deck"},r8={works:"works there",broken:"broken there",unknown:"not offered by that deck"};function s8(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${n8[e.here]}, ${r8[e.there]}, ${t}${e.usedThere?", in use there":""}.`}function a8({row:e,source:t,status:n,accounts:r,now:a,busy:i,onClose:c,onRename:u,onCheck:f,onVerb:p,onSettings:h,twins:m=[],onUnpair:y}){var St,yt,wt,Et,Xt;const w=x.useRef(null),N=fn(c,{focusRef:w}),[_,S]=x.useState(null),[b,j]=x.useState(null),[E,C]=x.useState(!1),T=x.useRef(0),[R,$]=x.useState(null),[D,W]=x.useState(!1),[L,V]=x.useState(0),Q=x.useRef(null),ee=x.useRef(!0);x.useEffect(()=>()=>{ee.current=!1},[]);const M=_!=null;x.useEffect(()=>{var he;M&&((he=Q.current)==null||he.select())},[M]),x.useEffect(()=>{if(!E)return;const he=window.setTimeout(()=>C(!1),4e3);return()=>window.clearTimeout(he)},[E]),x.useEffect(()=>{if(!R)return;const he=window.setTimeout(()=>$(null),4e3);return()=>window.clearTimeout(he)},[R]);const X=he=>{const ut=Ta(i,he);return{disabled:ut.disabled,"aria-busy":ut.busy}},H=async he=>{const ut=await he();return ee.current&&j(ut),ut==null},{peer:I,stranger:B}=t,P=e.kind==="paired",z=e.self??e.name,O=e.kind!=="dialling",K=e.kind==="dialling"?null:e.fp,de=I?I.addr?`${I.addr}:${I.port}`:"":B?B.port?`${B.addr}:${B.port}`:B.addr:e.addr,G=(I==null?void 0:I.about)??null,J=((St=n.about)==null?void 0:St.version)??null,U=async he=>{const ut=he.trim()===z?"":he;await H(()=>u(ut))&&S(null)},ne=async()=>{if(K)try{if(await navigator.clipboard.writeText(K),!ee.current)return;W(!0),window.setTimeout(()=>{ee.current&&W(!1)},1600)}catch{ee.current&&j("Could not copy it — select the fingerprint and copy it by hand.")}},ae=P?I!=null&&I.waiting?I.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":I!=null&&I.offers?"not said — it runs an older version":"not reached yet":"shown once paired",pe=S_(n.about),ge=S_(G),Se=G!=null&&G.version&&J?k8(G.version,J):null,Oe=I?oR(I.last,a):null,We=I&&((yt=I.last)!=null&&yt.error)?d8({error:I.last.error,host:I.addr,port:I.port},[...n.strangers??[],...n.pending??[],...(n.peers??[]).filter(he=>!he.manual&&he.addr).map(he=>({fp:he.fp,name:he.name,addr:he.addr,port:he.port,at:he.lastSeen??0}))],a):null,Pe=(wt=I==null?void 0:I.last)!=null&&wt.error&&Oe&&Oe.text!==I.last.error?I.last.error:null,Te=((Et=I==null?void 0:I.last)==null?void 0:Et.done)??[],et=!!Oe&&!!Pe&&!e.quiet&&e.state.startsWith(Oe.text),je=P||e.kind==="dialling",_e=I?I.waiting?null:I.manual?"added by address":"on this network":e.kind==="nearby"?"heard on this network":"asked this deck to pair",Ye=e.tone==="bad"?"bad":P?e.here?"up":"down":"loose",dt=i===`check:${e.fp}`,Qe=(I==null?void 0:I.offers)??null,ue=Ye==="up"?(Qe==null?void 0:Qe.current)??null:null,be=ue&&"key"in ue?ue.key:null,Re=!!ue&&"hidden"in ue,Xe=!!ue&&"other"in ue,$e=P?N8((Qe==null?void 0:Qe.accounts)??null,r,n.shared??[],be):[],ct=$e.filter(he=>he.in==null&&he.out==="cut"),ye=$e.some(he=>he.in!=null),Ee=$e.some(he=>he.out!=null),ie=new Map(Te.map(he=>[he.email,he])),Je=Te.filter(he=>!$e.some(ut=>ut.email===he.email)),rt=P?Qe?Qe.accounts.length===0?"That deck offers nothing. Nobody there has chosen a login to share.":null:I!=null&&I.waiting?"What that deck offers is not known yet. A deck that calls in says so each time it calls — one on an older version never does.":(Xt=I==null?void 0:I.last)!=null&&Xt.error?"What that deck offers is not known — the last attempt to ask it did not get through.":"Nobody has asked that deck what it offers yet. The next round asks it.":null,lt=Qe&&(I!=null&&I.last)&&I.last.at-Qe.at>JF?hs(Qe.at,a):null,tt=[];P&&(I!=null&&I.pairedAt)?tt.push({label:"Paired",value:e8(I.pairedAt,a),tone:"meta"}):e.kind==="declined"&&B&&tt.push({label:"Paired",value:`no · you said no ${h0(B.at,a)}`,tone:"meta"}),tt.push({label:"Fingerprint",value:K?l.jsxs("span",{className:"lan-fp",children:[l.jsx("code",{className:"ap-lan-code",children:K}),l.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void ne(),"aria-label":D?"Fingerprint copied":"Copy the fingerprint",children:D?"copied":"copy"})]}):"not known — nothing has answered there",tone:K?void 0:"quiet"});const nt=m.length?[{row:e,peer:I??null},...m]:[];return pr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:l.jsxs("div",{ref:N,className:"modal lan-peer","data-tone":e.tone,onClick:he=>he.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-peer-title","aria-describedby":"lan-peer-sub",children:[l.jsxs("header",{className:"modal-head lan-peer-head",children:[l.jsx("i",{className:e.here?"ap-pulse":"ap-dot","aria-hidden":!0}),l.jsxs("div",{className:"lan-peer-id",children:[M?l.jsxs("form",{className:"lan-peer-edit",onSubmit:he=>{he.preventDefault(),U(_??"")},children:[l.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),l.jsx("input",{ref:Q,className:"ap-manage-input lan-peer-input",value:_??"",maxLength:48,placeholder:z,"aria-label":"Name for this deck, shown on this deck only",onChange:he=>S(he.target.value)}),l.jsx("button",{type:"submit",className:"ap-manage-btn",...X(`alias:${e.fp}`),children:"save"}),l.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>S(null),children:"cancel"})]}):l.jsxs("span",{className:"lan-peer-title",children:[l.jsx("span",{id:"lan-peer-title",className:"lan-peer-name",children:e.name}),O&&l.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",onClick:()=>{j(null),S(e.name)},"aria-label":`Rename ${e.name} on this deck`,title:"Give it a name of your own. Only this deck sees it.",children:l.jsx(t8,{})})]}),l.jsxs("p",{id:"lan-peer-sub",className:"lan-peer-sub",children:[e.self&&l.jsxs(l.Fragment,{children:["calls itself ",l.jsx("span",{className:"lan-peer-self",children:e.self}),M&&l.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...X(`alias:${e.fp}`),onClick:()=>void U(""),children:"use this name"}),l.jsx("span",{className:"vis-hidden",children:". "}),!e.quiet&&l.jsx("span",{"aria-hidden":!0,children:" · "})]}),l.jsx("span",{className:e.quiet?"vis-hidden":"lan-peer-state",children:e.state})]})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{ref:w,type:"button",className:"glyph-btn",onClick:c,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body lan-peer-body",children:[b&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",children:b}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>j(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),l.jsxs("div",{className:"lan-map","data-link":Ye,"data-asking":dt||void 0,"data-bus":$e.length>0||void 0,children:[l.jsxs("div",{className:"lan-ends",children:[l.jsxs("p",{className:"lan-end",children:[l.jsx("span",{className:"lan-end-name",children:"This deck"}),pe&&l.jsx("span",{className:"lan-end-runs",children:pe}),P&&n.shareActive===!1&&l.jsx("span",{className:"lan-end-note",children:"current account hidden"})]}),l.jsxs("p",{className:"lan-end","data-side":"there",children:[l.jsx("span",{className:"lan-end-name",children:e.name}),e.kind!=="dialling"&&l.jsxs("span",{className:"lan-end-runs",children:[ge??(G?"not said":ae),Se?` · ${Se<0?"older":"newer"}`:null]}),Re&&l.jsx("span",{className:"lan-end-note",children:"current account hidden"}),Xe&&l.jsx("span",{className:"lan-end-note",children:"on another account"})]})]}),l.jsxs("div",{className:"lan-link",children:[l.jsx(j_,{}),l.jsxs("span",{className:"lan-span",children:[l.jsxs("span",{className:"lan-wire","aria-hidden":!0,children:[l.jsx("i",{className:"lan-glint","data-dir":"out"}),l.jsx("i",{className:"lan-glint","data-dir":"in"})]}),l.jsx("span",{className:"lan-link-label",children:de?l.jsx("code",{className:"ap-lan-code",children:de}):"none here — it calls this deck"})]}),l.jsx(j_,{}),(de&&_e||je)&&l.jsxs("p",{className:"lan-link-sub",children:[de&&_e,de&&_e&&je&&" · ",je&&(Oe?et?l.jsx("code",{className:"ap-lan-code",children:Pe}):l.jsx("span",{className:"lan-round","data-tone":Oe.tone,children:Oe.text.replace(/ · now$/," · just now")}):"not asked yet"),je&&Pe&&!et&&l.jsx("code",{className:"lan-fact-raw",children:Pe})]}),Je.length>0&&l.jsx("ul",{className:"lan-done",children:Je.map(he=>l.jsxs("li",{"data-ok":he.ok,children:[he.email," ",l.jsx("span",{className:"lan-done-what",children:he.ok?"arrived":"did not arrive"})]},`${he.email}:${he.action}`))}),We&&l.jsx("p",{className:"lan-note lan-link-note",children:We}),(I==null?void 0:I.waiting)&&l.jsx("p",{className:"lan-note lan-link-note",children:e.hint})]}),$e.length>0&&l.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${e.name}`,children:$e.map((he,ut)=>{const st=ie.get(he.email),kn=he.out==="live"||he.in!=null&&he.in!=="cut";return l.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":he.tone,"data-draw":he.in&&he.out?"both":he.in?"in":"out","data-used-there":he.usedThere||void 0,style:{"--i":ut},children:[l.jsx("i",{className:"lan-pip","data-end":"here","data-state":he.here,"aria-hidden":!0}),l.jsxs("span",{className:"lan-track",children:[l.jsxs("span",{className:"lan-wire","data-flow":kn?"live":"cut","aria-hidden":!0,children:[(he.in==="live"||he.in==="wait")&&l.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":he.in}),he.out==="live"&&l.jsx("i",{className:"lan-glint","data-dir":"out"})]}),he.in&&he.in!=="cut"&&l.jsx(ld,{dir:"in",gate:he.in==="blocked"}),he.out==="live"&&l.jsx(ld,{dir:"out"}),l.jsx("span",{className:"lan-lane-email",children:he.email})]}),l.jsx("i",{className:"lan-pip","data-end":"there","data-state":he.there,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:s8(he)}),(he.caption||st)&&l.jsxs("span",{className:"lan-lane-note",children:[he.caption,he.caption&&st&&" · ",st&&l.jsx("span",{className:"lan-lane-done","data-ok":st.ok,children:st.ok?"arrived last round":"did not arrive last round"})]})]},he.key)})},L),P&&l.jsxs(l.Fragment,{children:[ct.length>0&&l.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",ct.length===1?ct[0].email:"the expired ones"," until you sign in again here."]}),rt&&l.jsx("p",{className:"lan-empty",children:rt}),lt&&l.jsxs("p",{className:"lan-stale",children:["As of ",lt==="now"?"just now":lt,", when it last answered."]}),l.jsxs("div",{className:"lan-legend",children:[ye&&l.jsxs("span",{className:"lan-key",children:[l.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:l.jsx(ld,{dir:"in"})}),"from ",e.name]}),Ee?l.jsxs("span",{className:"lan-key",children:[l.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:l.jsx(ld,{dir:"out"})}),"from this deck, to every paired deck"]}):l.jsx("span",{className:"lan-key",children:"This deck offers nothing yet."}),l.jsx("button",{type:"button",className:"ap-lan-word lan-legend-act",onClick:h,"aria-label":"Change what this deck offers",children:"change"})]})]})]}),l.jsx("dl",{className:"lan-facts",children:tt.map(he=>l.jsxs("div",{className:"lan-fact","data-tone":he.tone,children:[l.jsx("dt",{children:he.label}),l.jsx("dd",{children:he.value})]},he.label))}),nt.length>1&&l.jsxs("div",{className:"modal-section",children:[l.jsxs("h3",{className:"lan-h",children:[nt.length," decks on this machine"]}),l.jsx("ul",{className:"lan-twins",role:"list",children:nt.map((he,ut)=>{var Bn,nn,At,Qn;const st=(Bn=he.peer)!=null&&Bn.addr?`${he.peer.addr}:${he.peer.port}`:he.row.addr,kn=st||he.row.fp,pn=(nn=he.peer)!=null&&nn.pairedAt?hs(he.peer.pairedAt,a):null,Cn=[(Qn=(At=he.peer)==null?void 0:At.about)!=null&&Qn.version?`runs ${he.peer.about.version}`:null,pn?`paired ${pn==="now"?"just now":pn}`:null,he.row.state].filter(Boolean).join(" · "),Lt=he.row.fp;return l.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":he.row.tone,children:[l.jsx("i",{className:he.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),st?l.jsx("code",{className:"ap-lan-code lan-twin-at",children:st}):l.jsx("span",{className:"lan-twin-at lan-twin-none",children:"no address here"}),l.jsx("code",{className:"ap-lan-code lan-twin-fp",children:Lt}),ut>0&&y&&l.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${R===Lt?" armed":""}`,...X(`unpair:${Lt}`),onKeyDown:rn=>{rn.repeat&&rn.preventDefault()},onClick:()=>{if(R!==Lt){$(Lt),T.current=Date.now();return}Date.now()-T.current<Vd||($(null),H(()=>y(Lt)))},"aria-label":R===Lt?`Confirm unpairing ${kn}`:`Unpair ${kn}`,title:R===Lt?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this one of the machine's decks",children:i===`unpair:${Lt}`?"unpairing…":R===Lt?"confirm":"unpair"}),l.jsx("span",{className:"lan-twin-meta",children:ut===0?`${Cn} · shown above`:Cn})]},Lt)})})]})]}),l.jsxs("footer",{className:"lan-peer-foot",children:[e.kind==="asks"&&l.jsx("p",{className:"lan-foot-note",children:"This deck is now asking to pair. Answer it from the panel behind this."}),P&&!(I!=null&&I.waiting)&&l.jsx("button",{type:"button",className:"btn",...X(`check:${e.fp}`),onClick:()=>void H(f).then(he=>{he&&ee.current&&V(ut=>ut+1)}),title:"Ask this deck now instead of waiting for the next round",children:i===`check:${e.fp}`?"Checking…":"Check now"}),e.kind==="paired"&&l.jsx("button",{type:"button",className:`btn danger lan-peer-verb${E?" armed":""}`,...X(`unpair:${e.fp}`),onKeyDown:he=>{he.repeat&&he.preventDefault()},onClick:()=>{if(!E){C(!0),T.current=Date.now();return}Date.now()-T.current<Vd||(C(!1),H(p))},"aria-label":E?`Confirm unpairing ${e.name}`:`Unpair ${e.name}`,title:E?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:i===`unpair:${e.fp}`?"Unpairing…":E?"Confirm unpair":"Unpair"}),e.kind==="nearby"&&l.jsx("button",{type:"button",className:"btn primary lan-peer-verb",...X(`accept:${e.fp}`),onClick:()=>void H(p),title:"Send it a request. Somebody at that machine has to accept it before anything is shared.",children:i===`accept:${e.fp}`?"Asking…":"Ask to pair"}),e.kind==="dialling"&&l.jsx("button",{type:"button",className:"btn lan-peer-verb",...X(`drop:${e.fp}`),onClick:()=>void H(p),title:"Stop trying this address. Nothing was ever paired here.",children:i===`drop:${e.fp}`?"Stopping…":"Stop dialling"}),e.kind==="declined"&&l.jsx("button",{type:"button",className:"btn lan-peer-verb",...X(`allow:${e.fp}`),onClick:()=>void H(p),title:"Take the no back. That deck is still trying, so its request comes round again on its own.",children:i===`allow:${e.fp}`?"Allowing…":"Let it ask again"})]})]})}),document.body)}function o8({status:e,accounts:t,onClose:n,onChanged:r}){const a=fn(n),[i,c]=x.useState(null),[u,f]=x.useState(null),[p,h]=x.useState(!1),[m,y]=x.useState(null),w=x.useRef(null),N=D=>{const W=Ta(m,D);return{disabled:W.disabled,"aria-busy":W.busy}},_=x.useRef(null),S=x.useRef(!0);x.useEffect(()=>()=>{S.current=!1},[]),x.useEffect(()=>{_.current&&f8(_.current,e.shared??[])&&(_.current=null)},[e.shared]);const b=x.useCallback(async(D,W,L="write")=>{w.current=L,y(L);try{const Q=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:D})})).json().catch(()=>null);return S.current?(Q!=null&&Q.ok?f(null):f(Vt(W,Q)),r(),(Q==null?void 0:Q.ok)===!0):!1}catch{return S.current&&f(Vt(W,null)),!1}finally{w.current=null,S.current&&y(null)}},[r]),j=x.useCallback(async()=>{if(i!=null&&i!==(e.name??"")){if(!await b({name:i},"save the name","name"))return;S.current&&c(null)}n()},[i,e.name,b,n]),E=async()=>{if(!e.fp)return;const D=await ph(e.fp);if(S.current){if(!D){f("Could not copy it — select the fingerprint and copy it by hand.");return}h(!0),window.setTimeout(()=>{S.current&&h(!1)},1600)}},C=new Set(_.current??e.shared??[]),T=e.autoAsk!==!1,R=e.autoAccept!==!1,$=e.shareActive!==!1;return pr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:a,className:"modal lan-modal",onClick:D=>D.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[u&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",children:u}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"Name"}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("span",{className:"ap-lan-label",children:"appear as"}),l.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:i??e.name??"",placeholder:"this machine",onChange:D=>c(D.target.value),onKeyDown:D=>{D.key!=="Enter"||i==null||(b({name:i},"save the name","name"),c(null))}}),i!=null&&i!==(e.name??"")&&l.jsx("button",{type:"button",className:"ap-manage-btn",...N("name"),onClick:()=>{b({name:i},"save the name","name"),c(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),e.fp?l.jsxs("span",{className:"lan-fp",children:[l.jsx("code",{className:"ap-lan-code",children:e.fp}),l.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void E(),"aria-label":p?"Fingerprint copied":"Copy this deck's fingerprint",children:p?"copied":"copy"})]}):l.jsx("span",{className:"ap-lan-label",children:"not known yet"})]})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"Share these accounts"}),l.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&l.jsx("span",{className:"ap-lan-empty",children:"No Claude accounts on this deck yet — add one with + at the top of this panel."}),t.map(D=>l.jsxs("label",{className:"ap-lan-pick",title:D.alive?"Offer this account to the decks you have paired with, so one whose copy has died can heal from yours. Unticking stops it being offered from now on; it does not take back a copy somebody already has.":"This deck cannot use this login, so it has nothing to offer — a deck that can will heal it",children:[l.jsx("input",{type:"checkbox",checked:C.has(D.key),onChange:W=>{const L=new Set(_.current??e.shared??[]);W.target.checked?L.add(D.key):L.delete(D.key),_.current=[...L],b({shared:[...L]},W.target.checked?"share that account":"stop sharing that account")}}),l.jsx("span",{className:"ap-lan-pick-name",children:D.email}),!D.alive&&l.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},D.key))]}),t.length>0&&l.jsxs("div",{className:"lan-switch",children:[l.jsx("span",{className:"lan-switch-what",children:"Show paired decks which of these this deck is using"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":$,"aria-label":"Show paired decks which of these this deck is using",...N("current"),onClick:()=>void b({shareActive:!$},$?"stop showing which account this deck is using":"show which account this deck is using","current"),title:$?"Stop telling paired decks which account this one is on. They read “current account hidden” instead.":"Tell paired decks which of the ticked accounts this one is on. An unticked account is never named.",children:l.jsx("span",{className:"switch-knob"})})]})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"Pairing"}),l.jsxs("div",{className:"lan-switches",children:[l.jsxs("div",{className:"lan-switch",children:[l.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":T,"aria-label":"Ask every deck this one finds",...N("ask"),onClick:()=>void b({autoAsk:!T},T?"stop asking automatically":"ask every deck this one finds","ask"),title:T?"Stop sending requests on their own. You press ask on the row instead.":"Send a pairing request to every deck heard on this network. Somebody over there still has to say yes.",children:l.jsx("span",{className:"switch-knob"})})]}),l.jsxs("div",{className:"lan-switch",children:[l.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":R,"aria-label":"Say yes to every deck that asks","data-tone":"warn",...N("accept"),onKeyDown:D=>{D.repeat&&D.preventDefault()},onClick:()=>void b({autoAccept:!R},R?"stop accepting automatically":"accept every deck that asks","accept"),title:R?"Stop saying yes for you. A deck that asks waits in the panel again.":"Say yes for you. Every deck on this network that asks is paired without anybody being asked here.",children:l.jsx("span",{className:"switch-knob"})})]})]})]})]}),l.jsxs("footer",{className:"lan-setup-foot",children:[l.jsx("span",{className:"lan-foot-note",children:"Changes are saved as you make them."}),l.jsx("button",{type:"button",className:"btn primary",...N("name"),onClick:()=>void j(),children:"Done"})]})]})}),document.body)}function hs(e,t){if(e==null)return"not seen";const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"now";const r=Math.round(n/60);if(r<60)return`${r}m ago`;const a=Math.round(r/60);return a<48?`${a}h ago`:`${Math.round(a/24)}d ago`}const d0={"waiting for the other deck to accept this one":{text:"waiting for them to say yes",tone:"idle"},"that deck said no":{text:"it said no",tone:"bad"}},i8={ECONNREFUSED:"not listening",EHOSTUNREACH:"no route to it",ENETUNREACH:"no network here",ETIMEDOUT:"no answer",ECONNRESET:"it hung up",EHOSTDOWN:"it is down",ENOTFOUND:"name not found",EACCES:"blocked here",EPIPE:"it hung up"};function l8(e){var r;const t=c8[e];if(t)return t;const n=(r=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:r[1];return n&&i8[n]||e}const c8={"handshake timed out":"no answer","peer closed the connection":"it hung up","peer went quiet":"it stopped mid-sentence","bad reply":"it answered with nonsense","no manifest":"it would not say what it has","bad challenge":"it answered as somebody else","a different deck is answering at that address":"a different deck is at that address","that deck could not prove its own key":"it could not prove who it is","the other deck refused this one's proof":"it would not take this deck's word","the other deck refused this handshake":"it turned this deck away","that deck has this one pinned under a different key":"it knows this deck by another key"};function oR(e,t){if(!e)return null;if(e.error)return d0[e.error]??{text:l8(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${hs(e.at,t)}`,tone:"idle"};const r=n.filter(i=>i.ok),a=r.length===1?"login":"logins";return r.length===n.length?{text:`${r.length} ${a} arrived · ${hs(e.at,t)}`,tone:"ok"}:{text:`${r.length} of ${n.length} logins arrived · ${hs(e.at,t)}`,tone:"bad"}}const u8=9e4;function d8({error:e,host:t,port:n},r,a,i=45317){if(e!=="handshake timed out")return null;const c=(t??"").trim();if(!c)return null;const u=r.filter(p=>p.addr===c&&p.port&&p.at>0&&a-p.at<u8);if(!u.length)return null;const f=[...new Set(u.map(p=>p.port))];if(n!=null&&!f.includes(n)){const p=f.length===1?`port ${f[0]}`:`ports ${f.join(" and ")}`;return`A deck at ${c} is announcing itself on ${p}, not on ${n}. This deck already hears it and dials it there, so this typed row has nothing to reach.`}return`That machine is running the deck — its beacon arrives here every half minute — and what this deck sends back never gets there. That is a firewall on ${c}, not a network fault. Whoever uses it can allow two ports: UDP ${i} and TCP ${n??f[0]}.`}const Sx=5e3,iR=6e4,Vd=400;function h8(e){const t=(e??"").trim(),n=t.lastIndexOf(":");if(n<=0||n===t.length-1)return null;const r=t.slice(0,n).trim(),a=Number(t.slice(n+1).trim());return!r||!Number.isInteger(a)||a<1||a>65535||r.includes(":")&&!(r.startsWith("[")&&r.endsWith("]"))?null:{addr:r,port:a}}function Vt(e,t){return t==null?`Could not ${e} — the deck did not answer.`:t.reason?`Could not ${e} — the deck refused it (${t.reason}).`:`Could not ${e}.`}function f8(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function p8(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function lR(e,t){var n,r;return(n=e.last)!=null&&n.error&&!d0[e.last.error]?!1:!!((r=e.last)!=null&&r.at&&t-e.last.at<Kd||e.lastSeen!=null&&t-e.lastSeen<Kd)}const Kd=95e3,cR=160,m8=6,uR=140;function g8(e,t){const n=[],r=[];for(const a of e??[])(lR(a,t)?n:r).push(a);return{online:n,offline:r}}function y8(e,t){if(!e)return{text:"checking…",tone:"idle"};if(!e.enabled)return{text:"",tone:"idle"};if(e.stalled)return{text:`could not start — ${e.stalled}`,tone:"bad"};if(!e.running)return{text:"starting…",tone:"wait"};const n=(e.pending??[]).length;if(n)return{text:n===1?"1 deck is waiting for your answer":`${n} decks are waiting for your answer`,tone:"wait"};const r=(e.peers??[]).filter(w=>w.paired!==!1||w.met);if(!r.length)return{text:"no deck paired yet",tone:"idle"};const a=r.filter(w=>w.waiting),i=r.filter(w=>!w.waiting),c=a.filter(w=>{var N;return!((N=w.last)!=null&&N.error)&&w.lastSeen!=null&&t-w.lastSeen<Kd}),{online:u,offline:f}=g8(i,t),p=[...f,...a.filter(w=>!c.includes(w))],h=u.length+c.length,m=u.filter(w=>{var N;return((N=w.last)==null?void 0:N.error)==="waiting for the other deck to accept this one"});if(h&&m.length===h)return{text:h===1?"1 deck found · waiting for them to accept":`${h} decks found · waiting for them to accept`,tone:"wait"};if(!h)return{text:p.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${p.length} decks`,tone:"bad"};const y=h===1?"1 deck ready":`${h} decks ready`;return{text:p.length?`${y} · ${p.length} away`:y,tone:"ok"}}function w8(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const r=hs(e,t);return r==="now"?"checked just now":`checked ${r}`}function h0(e,t){const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"just now";const r=Math.round(n/60);return r<60?`${r}m ago`:`${Math.round(r/60)}h ago`}function v8(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<Kd;return{text:n?"online · one-way, it calls in":`one-way · last online ${hs(e,t)}`,here:n}}function E_(e,t,n){return t?"online":e.lastSeen!=null?`last online ${hs(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function x8(e,t){var y,w,N,_,S;if(!e)return[];const n=[],r=new Set,a=(b,j)=>b.name.localeCompare(j.name,void 0,{numeric:!0}),i=e.aliases??{},c=(b,j)=>{const E=b?i[b]:void 0;return E&&E!==j?{name:E,self:j}:{name:j}};for(const b of e.pending??[]){if(!(b!=null&&b.fp)||r.has(b.fp))continue;r.add(b.fp);const j=c(b.fp,b.name||b.fp);n.push({fp:b.fp,name:j.name,...j.self?{self:j.self}:{},addr:b.addr??"",kind:"asks",state:`wants to pair · ${h0(b.at,t)}`,tone:"wait",here:!0,hint:`${j.name} at ${b.addr} is waiting for an answer.`})}const u=[],f=[];for(const b of e.peers??[]){const j=b.peerFp??b.fp;if(!j||r.has(j))continue;r.add(j);const E=oR(b.last,t),C=lR(b,t),T=b.addr?`${b.addr}:${b.port}`:"";if(!b.paired&&b.manual&&!b.met){f.push({fp:T,name:T||b.name||j,addr:b.addr??"",kind:"dialling",state:E?E.text.replace(/ · .*$/,""):"trying…",tone:E?E.tone:"idle",here:!1,hint:(y=b.last)!=null&&y.error?`Nothing has answered at ${T} yet — ${b.last.error}.`:`Dialling ${T} until something answers.`});continue}const R=b.waiting?v8(b.lastSeen,t):null,$=R?R.here:C,D=!R&&E?$?`online · ${E.text.replace(/ · .*$/,"")}`:`${E.text.replace(/ · .*$/,"")} · ${E_(b,$,t)}`:R?R.text:E_(b,$,t),W=(w=b.last)!=null&&w.error?d0[b.last.error]:null,L=!R&&$&&!((N=b.last)!=null&&N.error)&&!(((_=b.last)==null?void 0:_.done)??[]).length,V=b.manual&&!b.met?{name:T}:c(j,b.name||j);u.push({fp:j,name:V.name,...V.self?{self:V.self}:{},addr:b.addr??"",kind:"paired",state:D,quiet:L,tone:W?W.tone==="bad"?"bad":"wait":E?E.tone:$?"ok":"idle",here:R?R.here:C,hint:R?`${V.name} calls this deck, and this deck has no address to call back on — so it can repair its logins from here, and this deck cannot repair from it. ${b.lastSeen==null?"It has not called since this deck started.":`It last called ${hs(b.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${V.name}${T?` at ${T}`:""}${(S=b.last)!=null&&S.error?` — ${b.last.error}`:""}`})}n.push(...b8(u).sort(a),...f.sort(a));const p=[];for(const b of e.strangers??[]){if(!(b!=null&&b.fp)||r.has(b.fp))continue;r.add(b.fp);const j=c(b.fp,b.name||b.fp);p.push({fp:b.fp,name:j.name,...j.self?{self:j.self}:{},addr:b.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:`${j.name} at ${b.addr} is on this network and nothing is shared with it.`})}n.push(...p.sort(a));const h=[];for(const b of e.declined??[]){if(!(b!=null&&b.fp)||r.has(b.fp))continue;r.add(b.fp);const j=c(b.fp,b.name||b.fp);h.push({fp:b.fp,name:j.name,...j.self?{self:j.self}:{},addr:b.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${j.name} asked and was turned away. It is not asking any more.`})}n.push(...h.sort(a));const m=new Map;for(const b of n)m.set(b.name,(m.get(b.name)??0)+1);for(const b of n)(m.get(b.name)??0)<2||!b.addr||(b.state=b.quiet||!b.state?b.addr:`${b.addr} · ${b.state}`,b.quiet=!1);return n}function b8(e){const t=new Map;for(const r of e){const a=t.get(r.name);a?a.push(r):t.set(r.name,[r])}const n=[];for(const r of t.values()){const a=[...new Set(r.filter(i=>i.addr).map(i=>i.addr))];if(a.length>1){for(const i of a)n.push(C_(r.filter(c=>c.addr===i)));n.push(...r.filter(i=>!i.addr))}else n.push(C_(r))}return n}function C_(e){const[t,...n]=[...e].sort((r,a)=>Number(a.here)-Number(r.here)||+!!a.addr-+!!r.addr);return n.length?{...t,twins:n}:t}function T_(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function A_(e,t){if(!e)return{};switch(t.kind){case"paired":return{peer:(e.peers??[]).find(n=>(n.peerFp??n.fp)===t.fp)??null};case"dialling":return{peer:(e.peers??[]).find(n=>n.manual&&!n.met&&`${n.addr}:${n.port}`===t.fp)??null};case"nearby":return{stranger:(e.strangers??[]).find(n=>n.fp===t.fp)??null};case"declined":return{stranger:(e.declined??[]).find(n=>n.fp===t.fp)??null};case"asks":return{stranger:(e.pending??[]).find(n=>n.fp===t.fp)??null}}}function k8(e,t){const n=/^(\d+)\.(\d+)\.(\d+)/.exec(e??""),r=/^(\d+)\.(\d+)\.(\d+)/.exec(t??"");if(!n||!r)return null;for(let a=1;a<=3;a++){const i=Number(n[a])-Number(r[a]);if(i)return Math.sign(i)}return 0}function _8(e,t,n){const r=t?t.alive?"works here":"expired here":"not on this deck";if(!e.alive){const a=t&&!t.alive?"neither copy works — sign in again here":null;return{there:"broken there",here:r,note:a,tone:a?"bad":"idle"}}return t?t.alive?{there:"works there",here:r,note:null,tone:"ok"}:n?{there:"works there",here:r,note:"repairs next round",tone:"wait"}:{there:"works there",here:r,note:"share it to repair",tone:"bad"}:{there:"works there",here:r,note:"arrives next round",tone:"wait"}}function N8(e,t,n,r=null){const a=new Map(t.map(f=>[f.key,f])),i=new Set(n),c=[],u=new Set;for(const f of e??[]){if(u.has(f.key))continue;u.add(f.key);const p=a.get(f.key)??null,h=i.has(f.key),m=_8(f,p,h),y=p?p.alive?"works":"expired":"missing",w=!f.alive&&p&&!p.alive?m.note:[y==="works"?null:m.here,f.alive?null:m.there,m.note].filter(Boolean).join(" · ")||null;c.push({key:f.key,email:f.email,here:y,there:f.alive?"works":"broken",in:f.alive?m.tone==="wait"?"wait":m.tone==="bad"?"blocked":"live":"cut",out:h&&p?p.alive?"live":"cut":null,caption:w,tone:m.tone,usedThere:r===f.key})}for(const f of n){const p=a.get(f);!p||u.has(f)||(u.add(f),c.push({key:f,email:p.email,here:p.alive?"works":"expired",there:"unknown",in:null,out:p.alive?"live":"cut",caption:p.alive?null:"expired here",tone:p.alive?"ok":"bad",usedThere:!1}))}return c}async function bi(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function S8({anchorId:e,id:t,rows:n,onHold:r,onLet:a}){const i=x.useRef(null),c=n.filter(y=>y.kind==="paired"),u=c.filter(y=>y.here),f=u.slice(0,m8),p=c.length-u.length,h=u.length>f.length?`and ${u.length-f.length} more`:p>0?`${p} not on right now`:null,m=x.useCallback(()=>{const y=i.current,w=document.getElementById(e);if(!y||!w)return;const N=tR(w.getBoundingClientRect(),{width:y.offsetWidth,height:y.offsetHeight},{width:window.innerWidth,height:window.innerHeight});y.style.top=`${N.top}px`,y.style.left=`${N.left}px`,y.style.maxHeight=N.maxHeight==null?"":`${N.maxHeight}px`,y.dataset.side=N.side},[e]);return x.useLayoutEffect(()=>{m()}),x.useEffect(()=>(window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}),[m]),pr.createPortal(l.jsxs("div",{ref:i,id:t,className:"ap-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:a,children:[l.jsx("p",{className:"ap-peek-title",children:u.length?"On the network now":"Nobody on the network"}),f.length>0&&l.jsx("div",{className:"ap-peek-list",children:f.map(y=>l.jsxs("span",{className:"ap-peek-who",children:[l.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),l.jsx("span",{children:y.name})]},`${y.kind}:${y.fp}`))}),h&&l.jsx("p",{className:"ap-peek-rest",children:h})]}),document.body)}function j8(e,t){var i;if(!e)return{text:"checking…",tone:"idle",live:!1};if(!e.enabled)return{text:"Off",tone:"idle",live:!1};if(e.stalled)return{text:"could not start",tone:"bad",live:!1};if(!e.running)return{text:"starting…",tone:"wait",live:!1};const n=t.filter(c=>c.kind==="asks").length;if(n)return{text:n===1?"1 deck wants to pair":`${n} decks want to pair`,tone:"wait",live:!1};if((i=e.reach)!=null&&i.blocked)return{text:"nothing can get in",tone:"bad",live:!1};const r=t.filter(c=>c.kind==="paired");if(!r.length)return{text:"On · none paired yet",tone:"idle",live:!1};const a=r.filter(c=>c.here).length;return a?a===r.length?{text:`${a} online`,tone:"ok",live:!0}:{text:`${a} of ${r.length} online`,tone:"ok",live:!0}:{text:`none of ${r.length} online`,tone:"idle",live:!1}}function E8({accounts:e,onChanged:t,view:n,onOpen:r,onBack:a,closeButton:i}){const[c,u]=x.useState(null),[f,p]=x.useState([]),[h,m]=x.useState(null),[y,w]=x.useState(!1),[N,_]=x.useState(null),S=x.useRef(0),[b,j]=x.useState(!1),[E,C]=x.useState(!1),[T,R]=x.useState(!1),$=x.useRef(0);x.useEffect(()=>()=>window.clearTimeout($.current),[]);const[D,W]=x.useState(!1),[L,V]=x.useState(null),Q=x.useRef(null),ee=x.useCallback(ue=>gh(Q.current)?(Q.current=ue,m(ue),!0):!1,[]),M=x.useCallback(()=>{Q.current=null,B.current&&m(null)},[]),X=ue=>{const be=Ta(h,ue);return{disabled:be.disabled,"aria-busy":be.busy}},[H,I]=x.useState(()=>Date.now()),B=x.useRef(!0),P=x.useRef(Sx),z=x.useCallback(async()=>{var ue,be;try{const[Re,Xe]=await Promise.all([fetch("/api/lan").then($e=>$e.json()),fetch("/api/prefs").then($e=>$e.json())]);if(!B.current)return;Re!=null&&Re.ok&&u(Re),Xe!=null&&Xe.ok&&p(Array.isArray((be=(ue=Xe.prefs)==null?void 0:ue.lan)==null?void 0:be.manual)?Xe.prefs.lan.manual:[]),P.current=(Re==null?void 0:Re.enabled)===!0?Sx:iR}catch{}},[]);x.useEffect(()=>{B.current=!0;let ue=0;const be=async()=>{I(Date.now()),await z(),B.current&&(ue=window.setTimeout(be,P.current))};return be(),()=>{B.current=!1,window.clearTimeout(ue)}},[z]);const O=x.useCallback(async()=>{const ue=(c==null?void 0:c.enabled)===!0;if(ee("switch"))try{const be=await bi("/api/prefs",{lan:{enabled:!ue}});if(!B.current)return;be!=null&&be.ok?(V(null),ue||w(!0)):V(Vt(ue?"turn this off":"turn this on",be)),await z()}catch{B.current&&V(Vt(ue?"turn this off":"turn this on",null))}finally{M()}},[c==null?void 0:c.enabled,z,ee,M]),K=x.useCallback(async(ue,be,Re)=>{if(!ee(`${ue}:${be}`))return null;let Xe=null;try{const $e=await bi("/api/lan/peer",{action:ue,fp:be});if(!B.current)return null;$e!=null&&$e.ok?(u($e),V(null)):(Xe=Vt(Re,$e),V(Xe)),await z()}catch{Xe=Vt(Re,null),B.current&&V(Xe)}finally{M()}return Xe},[z,ee,M]),de=x.useCallback(async ue=>{if(!ee(`drop:${ue}`))return null;let be=null;try{const Re=await bi("/api/prefs",{lan:{manual:f.filter(Xe=>Xe!==ue)}});if(!B.current)return null;Re!=null&&Re.ok?(V(null),t()):(be=Vt("stop dialling that address",Re),V(be)),await z()}catch{be=Vt("stop dialling that address",null),B.current&&V(be)}finally{M()}return be},[f,z,t,ee,M]),[G,J]=x.useState(null),U=x.useCallback(async(ue,be)=>{if(!ee(`alias:${ue}`))return"Something else is still being saved. Try again in a moment.";try{const Re=await bi("/api/lan/peer",{action:"alias",fp:ue,name:be});return B.current?Re!=null&&Re.ok?(u(Re),null):Vt("rename that deck",Re):null}catch{return Vt("rename that deck",null)}finally{M()}},[ee,M]),ne=x.useCallback(async ue=>{if(!ee(`check:${ue}`))return null;try{const be=await bi("/api/lan/sync",{fp:ue});return B.current?be!=null&&be.ok?(u(be),t(),null):(be==null?void 0:be.reason)==="no_address"?"There is no address here to call it on. It calls this deck, and it is up to date each time it does.":Vt("check that deck",be):null}catch{return Vt("check that deck",null)}finally{M()}},[ee,M,t]),ae=x.useCallback(async()=>{if(ee("check"))try{const ue=await bi("/api/lan/sync",{});if(!B.current)return;ue!=null&&ue.ok?(u(ue),V(null)):V(Vt("check the other decks",ue)),t()}catch{B.current&&V(Vt("check the other decks",null))}finally{M()}},[ee,M,t]),pe=(c==null?void 0:c.enabled)===!0,ge=x8(c,H),Se=G?ge.find(ue=>{var be;return ue.fp===G||((be=ue.twins)==null?void 0:be.some(Re=>Re.fp===G))})??null:null;x.useEffect(()=>{G&&c&&!Se&&J(null)},[G,c,Se]);const Oe=ge.filter(ue=>ue.kind==="asks"),We=ge.filter(ue=>ue.kind!=="asks"),Pe=We.filter(ue=>ue.here),Te=We.filter(ue=>!ue.here),et=Te.filter(ue=>ue.tone==="bad").length,je=D||Pe.length===0,_e=y8(c,H),Ye=We.filter(ue=>ue.kind==="paired").length,dt=j8(c,ge),Qe=l.jsxs(l.Fragment,{children:[b&&c&&l.jsx(ZF,{status:c,manual:f,onClose:()=>j(!1),onChanged:()=>{z(),t()}}),E&&l.jsx(rR,{title:"How Local network works",steps:HF,finish:pe?void 0:{label:"Turn it on",act:()=>{C(!1),O()}},onClose:()=>C(!1)}),y&&c&&l.jsx(o8,{status:{...c,manualRows:f},accounts:e,manual:f,onClose:()=>w(!1),onChanged:()=>{z(),t()}}),Se&&c&&l.jsx(a8,{row:Se,source:A_(c,Se),status:c,accounts:e,now:H,busy:h,onClose:()=>J(null),onRename:ue=>U(Se.fp,ue),onCheck:()=>ne(Se.fp),onVerb:()=>{switch(Se.kind){case"paired":return K("unpair",Se.fp,"unpair that deck");case"nearby":return K("accept",Se.fp,"reach that deck");case"declined":return K("allow",Se.fp,"let that deck ask again");case"dialling":return de(Se.fp);default:return Promise.resolve(null)}},onSettings:()=>{J(null),w(!0)},twins:(Se.twins??[]).map(ue=>({row:ue,peer:A_(c,ue).peer??null})),onUnpair:ue=>K("unpair",ue,"unpair that deck")})]});if(!n){const ue=$e=>{window.clearTimeout($.current),$.current=window.setTimeout(()=>R(!0),$e)},be=()=>{window.clearTimeout($.current),$.current=window.setTimeout(()=>R(!1),uR)},Re=()=>window.clearTimeout($.current),Xe=()=>{window.clearTimeout($.current),R(!1)};return l.jsxs("div",{className:"ap-foot",children:[l.jsxs("button",{type:"button",id:"ap-lan-entry",className:"ap-nav",onClick:()=>{Xe(),r()},"aria-describedby":T?"ap-lan-peek":void 0,onPointerEnter:$e=>{$e.pointerType==="mouse"&&ue(cR)},onPointerLeave:be,onFocus:$e=>{$e.target.matches(":focus-visible")&&ue(0)},onBlur:be,children:[l.jsxs("svg",{className:"ap-nav-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"1.8",y:"2.3",width:"10.4",height:"7.2",rx:"1.2"}),l.jsx("path",{d:"M5 11.9h4M7 9.5v2.4"})]}),l.jsxs("span",{className:"ap-nav-text",children:[l.jsx("span",{className:"ap-nav-name",children:"Local network"}),l.jsxs("span",{className:"ap-nav-state","data-tone":dt.tone,children:[dt.live&&l.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),dt.text]})]}),l.jsx("svg",{className:"ap-nav-chev",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),T&&l.jsx(S8,{anchorId:"ap-lan-entry",id:"ap-lan-peek",rows:ge,onHold:Re,onLet:be}),l.jsx("p",{className:"vis-hidden",role:"status",children:_e.tone==="ok"?"":_e.text}),Qe]})}return l.jsxs("div",{className:"ap-lan-view",children:[l.jsxs("div",{className:"ap-header",children:[l.jsx("button",{type:"button",id:"ap-lan-back",className:"glyph-btn ap-back",onClick:a,"aria-label":"Back to Claude accounts",title:"Back to Claude accounts",children:l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M8.4 3.4 4.8 7l3.6 3.6"})})}),l.jsx("h2",{id:"ap-lan-title",children:"Local network"}),l.jsxs("div",{className:"ap-header-right",children:[pe&&l.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>j(!0),"aria-label":"Add a deck",title:"Reach a deck that has not turned up on its own — by address, or with an invite",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M6.1 7.9a2.6 2.6 0 0 0 3.7 0l1.9-1.9a2.6 2.6 0 0 0-3.7-3.7l-.9.9"}),l.jsx("path",{d:"M7.9 6.1a2.6 2.6 0 0 0-3.7 0L2.3 8a2.6 2.6 0 0 0 3.7 3.7l.9-.9"})]})}),pe&&Ye>0&&l.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...X("check"),onClick:()=>void ae(),"aria-label":h==="check"?"Checking every paired deck":"Check every paired deck now",title:"Ask every paired deck now for anything this deck's expired logins need, instead of waiting for the next round",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("circle",{cx:"7",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),l.jsx("path",{d:"M4.6 4.6a3.4 3.4 0 0 0 0 4.8M9.4 4.6a3.4 3.4 0 0 1 0 4.8"}),l.jsx("path",{d:"M2.6 2.6a6.2 6.2 0 0 0 0 8.8M11.4 2.6a6.2 6.2 0 0 1 0 8.8"})]})}),pe&&l.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...X("setup"),onClick:()=>w(!0),"aria-label":"This deck's name and shared logins",title:"This deck's name on the network, and which of its logins it offers",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),l.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),l.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),i]})]}),l.jsx("div",{className:"ap-scroll",id:"ap-lan-scroll",children:l.jsxs("div",{className:"ap-lan",children:[l.jsxs("div",{className:"ap-policy",children:[l.jsx("h3",{className:"ap-auto-title",children:"Sync with paired decks"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":pe,"aria-label":"Sync with paired decks",...X("switch"),onClick:()=>void O(),title:pe?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins",children:l.jsx("span",{className:"switch-knob"})})]}),pe&&l.jsx(aR,{reach:c==null?void 0:c.reach,where:"panel"}),!pe&&l.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>C(!0),title:"Four pictures: what this does, and what to do on each machine",children:[l.jsx(GF,{}),l.jsx("span",{className:"ap-lan-intro-text",children:"Paired machines repair each other's expired logins."}),l.jsx("span",{className:"ap-lan-intro-go",children:"See how it works"})]}),l.jsx("p",{className:`ap-lan-status ${_e.tone}`,role:"status",children:_e.tone==="ok"?"":_e.text}),L&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",children:L}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>V(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),pe&&l.jsxs(l.Fragment,{children:[Oe.length>0&&l.jsx("div",{className:"ap-lan-asks",role:"alert",children:Oe.map(ue=>l.jsxs("div",{className:"ap-lan-ask",children:[l.jsxs("span",{className:"ap-lan-ask-what",children:[l.jsx("strong",{className:"ap-lan-peer-name",children:ue.name})," at ",l.jsx("code",{className:"ap-lan-code",children:ue.addr})," wants to pair"]}),l.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",l.jsx("code",{className:"ap-lan-code",children:ue.fp})]}),l.jsxs("span",{className:"ap-lan-ask-acts",children:[l.jsx("button",{type:"button",className:"ap-manage-btn",...X(`accept:${ue.fp}`),onClick:()=>void K("accept",ue.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${ue.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),l.jsx("button",{type:"button",className:"ap-manage-btn",...X(`dismiss:${ue.fp}`),onClick:()=>void K("dismiss",ue.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},ue.fp))}),(je?[...Pe,...Te]:Pe).length>0&&l.jsx("ul",{className:"ap-lan-here",children:(je?[...Pe,...Te]:Pe).map((ue,be)=>l.jsxs("li",{className:"ap-lan-who","data-tone":ue.tone,children:[l.jsx("i",{className:ue.here?"ap-pulse":"ap-dot","aria-hidden":!0}),l.jsx("span",{className:"ap-lan-who-name","aria-hidden":!0,children:ue.name}),l.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${be}`,onClick:()=>J(ue.fp),children:l.jsxs("span",{className:"vis-hidden",children:[ue.name,", details"]})}),l.jsx("span",{id:`lan-who-state-${be}`,className:ue.quiet?"vis-hidden":"ap-lan-who-when",children:ue.state}),ue.kind==="nearby"&&l.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...X(`accept:${ue.fp}`),onClick:()=>void K("accept",ue.fp,"reach that deck"),"aria-label":`Ask ${ue.name} to pair`,title:`Send ${ue.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${ue.fp}.`,children:"ask"}),ue.kind==="paired"&&l.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${N===ue.fp?" armed":""}`,...X(`unpair:${ue.fp}`),onClick:()=>{if(N!==ue.fp){_(ue.fp),S.current=Date.now(),window.setTimeout(()=>_(Re=>Re===ue.fp?null:Re),4e3);return}Date.now()-S.current<Vd||(_(null),K("unpair",ue.fp,"unpair that deck"))},"aria-label":N===ue.fp?`Confirm unpairing ${ue.name}`:`Unpair ${ue.name}`,title:N===ue.fp?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:N===ue.fp?"confirm":"unpair"}),ue.kind==="dialling"&&l.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...X(`drop:${ue.fp}`),onClick:()=>void de(ue.fp),"aria-label":`Stop dialling ${ue.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),ue.kind==="declined"&&l.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...X(`allow:${ue.fp}`),onClick:()=>void K("allow",ue.fp,"let that deck ask again"),"aria-label":`Let ${ue.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${ue.kind}:${ue.fp}`))}),(Pe.length>0&&Te.length>0||pe&&Ye>0)&&l.jsxs("div",{className:"ap-lan-tail",children:[Pe.length>0&&Te.length>0&&l.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":D,onClick:()=>W(ue=>!ue),title:D?"Show only the decks that are on":`Show the ${Te.length} deck${Te.length===1?"":"s"} that are not responding right now`,children:[l.jsx("span",{className:`ap-lan-chev${D?" open":""}`,"aria-hidden":!0,children:"›"}),D?"fewer":`${Te.length} more`,!D&&et>0&&l.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",et," not responding"]})]}),pe&&Ye>0&&l.jsx("span",{className:"ap-lan-checked",children:w8(c==null?void 0:c.checkedAt,H,h==="check")})]}),We.length===0&&Oe.length===0&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"ap-lan-fine",children:"No other deck yet. Decks on one network usually find each other on their own; when that has not happened, the link at the top of this view reaches one by address or by invite."}),l.jsx("button",{type:"button",className:"ap-lan-word ap-lan-how",onClick:()=>C(!0),children:"How it works"})]})]})]})}),Qe]})}function C8({anchorId:e,id:t,peers:n,onHold:r,onLet:a}){const i=x.useRef(null),{title:c,shown:u,rest:f}=RF(n),p=x.useCallback(()=>{const h=i.current,m=document.getElementById(e);if(!h||!m)return;const y=tR(m.getBoundingClientRect(),{width:h.offsetWidth,height:h.offsetHeight},{width:window.innerWidth,height:window.innerHeight});h.style.top=`${y.top}px`,h.style.left=`${y.left}px`,h.style.maxHeight=y.maxHeight==null?"":`${y.maxHeight}px`,h.dataset.side=y.side},[e]);return x.useLayoutEffect(()=>{p()}),x.useEffect(()=>(window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}),[p]),pr.createPortal(l.jsxs("div",{ref:i,id:t,className:"ap-peek ap-fold-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:a,children:[l.jsx("p",{className:"ap-peek-title",children:c}),l.jsx("div",{className:"ap-peek-list",children:u.map(h=>l.jsxs("span",{className:"ap-peek-who ap-fold-who",children:[l.jsx("span",{className:"ap-fold-name",children:h.name}),l.jsx("span",{className:"ap-fold-state","data-tone":h.ready?"ok":h.warn?"warn":"idle",children:h.ready?h.headroom==null?"not read yet":`${h.headroom}% free`:h.why})]},h.key))}),f&&l.jsx("p",{className:"ap-peek-rest",children:f})]}),document.body)}function T8({peers:e,strained:t,armed:n,threshold:r,open:a,onToggle:i}){const[c,u]=x.useState(!1),f=x.useRef(0);x.useEffect(()=>()=>window.clearTimeout(f.current),[]),x.useEffect(()=>{a&&(window.clearTimeout(f.current),u(!1))},[a]);const p=N=>{a||(window.clearTimeout(f.current),f.current=window.setTimeout(()=>u(!0),N))},h=()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>u(!1),uR)},m=()=>window.clearTimeout(f.current),y=()=>{window.clearTimeout(f.current),u(!1)},w=TF(e,{strained:t&&!a,armed:n,threshold:r});return l.jsxs("div",{className:"ap-rest",children:[l.jsxs("button",{type:"button",id:"ap-rest-entry",className:"ap-nav","aria-expanded":a,"aria-controls":a?"ap-rest-panel":void 0,"aria-describedby":c?"ap-rest-peek":void 0,onClick:()=>{y(),i()},onPointerEnter:N=>{N.pointerType==="mouse"&&p(cR)},onPointerLeave:h,onFocus:N=>{N.target.matches(":focus-visible")&&p(0)},onBlur:h,children:[l.jsxs("span",{className:"ap-nav-text",children:[l.jsx("span",{className:"ap-nav-name",children:"Other accounts"}),l.jsx("span",{className:"ap-nav-state","data-tone":w.tone,children:w.text})]}),l.jsx("svg",{className:"ap-nav-chev",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),c&&l.jsx(C8,{anchorId:"ap-rest-entry",id:"ap-rest-peek",peers:e,onHold:m,onLet:h})]})}async function A8(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const R8=1800;function M8({accounts:e,onClose:t,copyText:n}){const[r,a]=x.useState([]),[i,c]=x.useState(null),[u,f]=x.useState(!1),[p,h]=x.useState(null),[m,y]=x.useState(!1),[w,N]=x.useState(()=>Math.floor(Date.now()/1e3)),_=x.useRef(null),S=x.useRef(!1),b=fn(t,{focusRef:_});x.useEffect(()=>{if(!i)return;N(Math.floor(Date.now()/1e3));const L=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(L)},[i]);const j=xF(e),E=e.filter(L=>!r.includes(L.num)).map(L=>L.num),C=E.length===e.length,T=L=>a(V=>V.includes(L)?V.filter(Q=>Q!==L):[...V,L]),R=x.useCallback(async()=>{if(!Ls(S.current)||!E.length)return;S.current=!0,f(!0),h(null),y(!1);const L=await A8({action:"share",accounts:E}).catch(()=>null);if(S.current=!1,f(!1),!(L!=null&&L.ok)){h(Si(L,"the share could not be made"));return}c({blob:L.blob,expiresAt:L.expiresAt,shared:L.shared??[],failed:L.failed??[]})},[e,E]),$=i?eR(i.expiresAt,w):null,D=($==null?void 0:$.tone)==="gone",W=(i==null?void 0:i.shared.length)??0;return pr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:b,className:"modal sa-modal",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("h3",{children:"Share accounts"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsx("section",{className:"modal-body sa-body",children:i?l.jsxs("div",{className:"sa-step",children:[l.jsx("h4",{children:D?"This share has expired":W===1?"1 account, ready to paste":`${W} accounts, ready to paste`}),l.jsx("code",{className:`ap-share-blob${D?" sa-dead":""}`,children:i.blob}),l.jsxs("div",{className:"ap-share-foot",children:[l.jsx("button",{type:"button",className:"ap-manage-btn",ref:_,onClick:async()=>{if(D){c(null),R();return}await n(i.blob)&&(y(!0),window.setTimeout(()=>y(!1),R8))},children:D?"make a new share":m?"copied":`copy ${W===1?"the share":"all "+W}`}),l.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:[l.jsx("span",{className:"ap-share-warn",children:W===1?"this is the password":`this is ${W} passwords`})," · ",l.jsx("span",{className:`ap-share-expiry ${$==null?void 0:$.tone}`,children:$==null?void 0:$.text})]})]}),i.failed.length>0&&l.jsxs("div",{className:"sa-failed",role:"alert",children:[l.jsx("p",{className:"sa-failed-head",children:i.failed.length===1?"One account is not in this bundle:":`${i.failed.length} accounts are not in this bundle:`}),l.jsx("ul",{className:"sa-list",children:i.failed.map(L=>{var Q;const V=!!(L.email&&((Q=L.detail)!=null&&Q.includes(L.email)));return l.jsxs("li",{children:[!V&&l.jsx("span",{className:"sa-who",children:L.email||`account ${L.num}`}),l.jsx("span",{className:"sa-why",children:L.detail||"could not be exported"})]},`${L.num}-${L.email}`)})})]}),l.jsx("p",{className:"sa-note",children:D?l.jsx(l.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):l.jsxs(l.Fragment,{children:["Paste it into the other deck with ",l.jsx("strong",{children:"+"})," → ",l.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),l.jsxs("div",{className:"sa-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>{c(null),y(!1)},children:"Pick again"}),l.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?l.jsxs("div",{className:"sa-step",children:[l.jsx("h4",{children:"Nothing to share"}),l.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",l.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),l.jsx("div",{className:"sa-actions",children:l.jsx("button",{type:"button",className:"btn primary",ref:_,onClick:t,children:"Close"})})]}):l.jsxs("div",{className:"sa-step",children:[l.jsxs("h4",{children:["Which accounts go to the other ",Kt,"?"]}),l.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:bF(E.length)}),l.jsx("ul",{className:"sa-list sa-pick",children:j.map(L=>l.jsx("li",{children:l.jsxs("label",{className:"sa-row",children:[l.jsx("input",{type:"checkbox",checked:E.includes(L.num),onChange:()=>T(L.num)}),l.jsx("span",{className:"sa-who",children:L.label}),L.sub&&l.jsx("span",{className:"sa-sub",children:L.sub})]})},L.num))}),p&&l.jsx("p",{className:"aa-err",children:p}),l.jsxs("div",{className:"sa-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map(L=>L.num):[]),children:C?"Clear all":"Select all"}),l.jsx("button",{type:"button",className:"btn primary",ref:_,..._a(u,!E.length),onClick:R,children:u?"making the share…":E.length===0?"Share":E.length===1?"Share 1 account":`Share ${E.length} accounts`})]})]})})]})}),document.body)}function I8(e,t){const n=new Set(e),r=e.length?Math.max(...e):0;return[...new Set([...e,r+1])].sort((a,i)=>a-i).map(a=>{const i=a===t?"here":n.has(a)?"swap":"free";return{slot:a,kind:i,label:i==="here"?`slot ${a}`:`slot ${a} · ${i}`}})}function $8(e,t,n){if(!(n!=null&&n.ok))return null;const r=Number.isInteger(n.to)?n.to:null;if(r==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const a=n.swapped===!0&&r!==t;return{menuFor:e.menuFor===t?r:a&&e.menuFor===r?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:a?{at:r,displaced:t}:null}}function O8(e,t,n){return t!=null&&e.some(r=>r.slot===t)?t:n}function P8(e,t,n){var a;const r=((a=e.find(i=>i.slot===t))==null?void 0:a.kind)??"here";return r==="swap"?{label:"swap",done:"swapped",sends:!0,swaps:!0,title:`Send this account to slot ${t}. That slot is taken, so the two accounts trade places and the one standing there moves to slot ${n}.`}:r==="free"?{label:"move",done:"moved",sends:!0,swaps:!1,title:`Send this account to slot ${t}. That slot is empty, so no other account moves.`}:{label:"move",done:"here",sends:!1,swaps:!1,title:`This account already holds slot ${n}.`}}function L8(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 R_(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function D8(e){const t=e.filter(u=>!R_(u)),n=e.filter(u=>R_(u)),r=t.length?t:n,a=t.length?n:[],i=r.reduce((u,f)=>u&&u.pct>=f.pct?u:f,null);let c=null;for(const u of a)i&&u.pct<=i.pct||(!c||u.pct>c.pct)&&(c=u);return{shown:r,rest:a,fuller:c,peak:c??i}}const q8="\0";function Yd(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}${q8}${n}`}function F8(e,t){const n=Yd(t);return e.includes(n)?e.filter(r=>r!==n):[...e,n]}function B8(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Yd)),r=e.filter(a=>n.has(a));return r.length===e.length?e:r}const z8=64;function U8(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const W8=Object.freeze({text:"couldn't reach the deck server",reload:!0}),H8=Object.freeze({text:"still waiting on the deck server — claude-swap can be slow to answer",reload:!0});async function M_(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function G8(e){const t=e.find(r=>!r.ok);if(!t)return null;const n=dc(t.body);return{text:kx(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function I_(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 $_=15e3,V8=8e3,K8=1800,Y8=3e4,jp=[70,80,85,90,95];function Ep(e,t){return RA(t-Math.floor(e/1e3))}function X8(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 Yl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Z8(e,t){const n="The deck can still see this account — its live usage is being read — but claude-swap's own stored copy of the login was rejected, so these numbers stopped updating.";if((e==null?void 0:e.state)==="running")return{text:"resuming…",hint:`${n} The deck is re-capturing it from the login you already have. No sign-in, no switch.`};if((e==null?void 0:e.state)==="failed"){const r=Math.max(1,Math.ceil((e.retryAt/1e3-t)/60)),a=e.reason?`Re-capturing it from the login you already have did not work (${e.reason}).`:"The deck re-captured it from the login you already have, and claude-swap still cannot read it.";return{text:"numbers paused",hint:`${n} ${a} It tries again in ${r}m. No sign-in, no switch.`}}return{text:"numbers paused",hint:n}}function Q8(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 J8(e){switch(e){case"no_credentials":return{text:"no stored login",hint:"claude-swap holds no credentials for this account, so there is nothing to read its usage with and nothing to switch to. A paired deck that has them sends them on its own; signing in as this account puts them there by hand.",fix:"sign in"};case"relogin_required":return{text:"login expired",hint:"claude-swap's stored login for this account was rejected and cannot be refreshed. Signing in again replaces it — the account keeps its slot, its alias and its history.",fix:"sign in again"};case"keychain_unavailable":return{text:"keychain unreadable",hint:"This is about the deck, not the account: claude-swap could not open your keychain, so it cannot read any account's stored login. A deck started from a background session cannot reach the keychain at all — start it from a terminal, or let it start at login, and this clears."};case"token_expired":return{text:"token expired",hint:"The access token ran out and the refresh was deferred. The next collection retries."};case"foreign_credential":return{text:"wrong credential",hint:"The live credential belongs to a different account. Switching to this one repairs it."};case null:case void 0:return null;default:return{text:e,hint:`claude-swap reported "${e}" for this account.`}}}function cd(e,t){if(e.staleCopy){const n=Z8(e.repair??null,t);return{text:Yl(n.text),hint:n.hint,fix:null,tone:"quiet",blocksSwitch:!1}}if(e.stopped){const n=J8(e.collector??null);if(!n)return{text:"Not collecting",hint:"claude-swap has collected nothing for this account in over half a day and has not said why. A paired deck holding a working copy of this account will replace it on its own. To do it by hand, sign in as this account from + Add.",fix:null,tone:"quiet",blocksSwitch:!1};const r=e.collector==="no_credentials"||e.collector==="relogin_required";return{text:Yl(n.text),hint:n.hint,fix:n.fix?Yl(n.fix):null,tone:r||e.collector==="keychain_unavailable"?"warn":"quiet",blocksSwitch:r}}if(e.error){const n=Q8(e.error);return{text:Yl(n.text),hint:n.hint,fix:n.fixable?"Sign in again":null,tone:n.fixable?"warn":"quiet",blocksSwitch:n.fixable}}return null}function Cp(){return l.jsxs("svg",{className:"ap-warn-glyph",width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M7 1.9 12.9 12H1.1Z"}),l.jsx("path",{d:"M7 5.6v2.9"}),l.jsx("path",{d:"M7 10.3v.05"})]})}function eB(e){return e>=90?"hi":e>=70?"mid":void 0}function tB(e){const t=Number(e);return[...Number.isFinite(t)&&t>0&&!jp.includes(t)?[...jp,t]:jp].sort((r,a)=>r-a)}function nB({lane:e,nowSec:t,frozen:n}){const r=Math.min(100,Math.max(0,e.pct)),a=n?"var(--muted)":r>=90?"var(--err)":r>=70?"var(--warn)":"var(--accent)",i=e.resetAt&&!n?MA(e.resetAt,t):null;return l.jsxs("div",{className:"ap-lane",children:[l.jsx("span",{className:"ap-lane-label",title:e.label,children:e.label}),l.jsx("div",{className:"ap-lane-track",children:l.jsx("div",{className:"ap-lane-fill",style:{width:`${r===0?1.5:r}%`,background:a,opacity:r===0||n?.4:1}})}),l.jsxs("span",{className:"ap-lane-pct",style:{color:a},children:[r,"%"]}),l.jsx("span",{className:"ap-lane-reset",title:i?`${e.label} resets in ${i}`:void 0,children:i&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"vis-hidden",children:"resets in "}),i]})})]})}async function O_(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(r=>window.setTimeout(()=>r(!1),500))])}catch{t=!1}if(t)return!0;try{const r=document.createElement("textarea");r.value=e,r.setAttribute("readonly",""),r.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(r),r.select(),t=document.execCommand("copy"),r.remove()}catch{t=!1}return t}function rB({onClose:e,leaving:t}){var Us,Nn,ms;const[n,r]=x.useState(null),[a,i]=x.useState(null),[c,u]=x.useState(null),[f,p]=x.useState(!1),[h,m]=x.useState(null),[y,w]=x.useState(null),[N,_]=x.useState("accounts"),[S,b]=x.useState(!1),[j,E]=x.useState(null),C=x.useRef(j);C.current=j;const[T,R]=x.useState(()=>Math.floor(Date.now()/1e3)),$=x.useRef(null),[D,W]=x.useState(null),L=(D==null?void 0:D.num)??null,V=x.useRef(D);V.current=D;const[Q,ee]=x.useState(null),[M,X]=x.useState(!1),[H,I]=x.useState(""),[B,P]=x.useState(null),z=x.useRef(0),[O,K]=x.useState(null),[de,G]=x.useState(!1),[J,U]=x.useState(!1),[ne,ae]=x.useState(null),[pe,ge]=x.useState(null),[Se,Oe]=x.useState(null),[We,Pe]=x.useState(!1),Te=x.useRef(null),et=x.useRef(null),[je,_e]=x.useState([]),[Ye,dt]=x.useState(!1),Qe=x.useRef(null),ue=x.useCallback(Z=>gh(Qe.current)?(Qe.current=Z,u(Z),!0):!1,[]),be=x.useCallback(()=>{Qe.current=null,u(null)},[]),Re=(Z,Ce=!1)=>{const Fe=Ta(c,Z);return{disabled:Fe.disabled,"aria-busy":Fe.busy||Ce}},Xe=x.useCallback(Z=>{window.requestAnimationFrame(()=>{var Ce;if(u_(((Ce=document.activeElement)==null?void 0:Ce.tagName)??null))for(const Fe of nq(Z)){const Me=document.querySelector(Fe);if(Me){Me.focus();return}}})},[]),$e=x.useCallback(async(Z=!1)=>{Z&&p(!0);const Ce=new AbortController,Fe=window.setTimeout(()=>Ce.abort(),Y8);try{const[Me,ze]=await Promise.all([fetch(`/api/claude-accounts${Z?"?refresh=1":""}`,{signal:Ce.signal}),fetch("/api/cswap-auto",{signal:Ce.signal})]);if(Me.ok){const Rt=await Me.json();r(Rt),_e(Mt=>B8(Mt,Rt.accounts))}ze.ok&&i(await ze.json());const ht=G8([await M_(Me),await M_(ze)]);m(Rt=>I_(Rt,ht))}catch{m(Me=>I_(Me,Ce.signal.aborted?H8:W8))}finally{window.clearTimeout(Fe),Z&&p(!1)}},[]),ct=x.useCallback(async(Z,Ce,Fe="panel")=>{if(!ue(Ce))return null;const Me=Fe==="menu"?ee:m;Me(null);try{const ze=await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Z)}),ht=await ze.json().catch(()=>null);return ht!=null&&ht.ok||Me({text:kx(ht,"command failed",ze.status),raw:dc(ht)}),ht}catch{return Me({text:"server unreachable"}),null}finally{be()}},[ue,be]),ye=x.useCallback(async(Z,Ce)=>{if(!ue(Ce))return null;m(null),ee(null);try{const Fe=await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Z)}),Me=await Fe.json().catch(()=>null);return Me!=null&&Me.ok||ee({text:Si(Me,"command failed",Fe.status)}),Me}catch{return ee({text:"server unreachable"}),null}finally{be()}},[ue,be]);x.useEffect(()=>($e(!0),$.current=window.setInterval(()=>$e(!1),$_),()=>{$.current!=null&&window.clearInterval($.current)}),[$e]),x.useEffect(()=>{const Z=window.setInterval(()=>R(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(Z)},[]);const Ee=((Us=a==null?void 0:a.settings["autoswitch.threshold"])==null?void 0:Us.value)??"90",ie=Se??Ee,Je=L8(ie,Ee),rt=(Nn=n==null?void 0:n.accounts)==null?void 0:Nn.find(Z=>Z.active),lt=rt?cd(rt,T):null,tt=(n==null?void 0:n.accounts)??[],nt=rt?tt.filter(Z=>!Z.active):[],St=nt.length?tt.filter(Z=>Z.active):tt,yt=nt.map(Z=>{const Ce=cd(Z,T);return{key:Yd(Z),name:Z.alias??Z.email??`account ${Z.num}`,ready:!Z.disabled&&!(Ce!=null&&Ce.blocksSwitch),why:Z.disabled?"held out":Ce!=null&&Ce.blocksSwitch?Ce.text:null,warn:(Ce==null?void 0:Ce.tone)==="warn",headroom:Z.headroom}}),wt=Number(Ee),Et=(rt==null?void 0:rt.headroom)!=null&&Number.isFinite(wt)&&100-rt.headroom>=wt,Xt=(a==null?void 0:a.ok)===!0&&(a.enabled||a.external),he=Z=>Ye&&nt.some(Ce=>Ce.num===Z)?"ap-rest-list":"ap-scroll",ut=async(Z,Ce)=>{if(ue(`switch-${Z}`)){m(null),w(null);try{const Me=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:Z})})).json().catch(()=>null);Me!=null&&Me.ok?w({num:Z,name:Ce}):m({text:kx(Me,"the switch failed"),raw:dc(Me),row:Z}),await $e(!0)}catch{m({text:"server unreachable",row:Z})}finally{be(),Xe(Z)}}},st=x.useCallback(()=>{W(null),ee(null),P(null),K(null),U(!1)},[]),kn=(Z,Ce="first")=>{st(),E(null),ge(null),W({num:Z,view:"menu",start:Ce})},pn=(Z,Ce)=>{st(),E(Fe=>(Fe==null?void 0:Fe.anchor)===Ce?null:{num:Z,anchor:Ce})},Cn=x.useCallback((Z=!1)=>{var Fe;const Ce=C.current;Z&&Ce&&((Fe=document.getElementById(Ce.anchor))==null||Fe.focus()),E(null)},[]),Lt=()=>{st(),E(null),_("lan")},Bn=x.useRef(N);x.useEffect(()=>{Bn.current!==N&&(Bn.current=N,window.requestAnimationFrame(()=>{var Z;(Z=document.getElementById(N==="lan"?"ap-lan-back":"ap-lan-entry"))==null||Z.focus()}))},[N]),x.useEffect(()=>{n!=null&&n.ok&&b(!0)},[n==null?void 0:n.ok]);const nn=x.useCallback(Z=>{var Me,ze;const Ce=V.current;if(!Ce||Z!=null&&Ce.num!==Z)return;const Fe=document.getElementById(`ap-menu-${Ce.num}`);(Fe!=null&&Fe.contains(document.activeElement)||u_(((Me=document.activeElement)==null?void 0:Me.tagName)??null))&&((ze=document.getElementById(`ap-more-${Ce.num}`))==null||ze.focus()),st()},[st]);x.useEffect(()=>{t&&(st(),E(null))},[t,st]),x.useEffect(()=>{D&&(n!=null&&n.accounts)&&!n.accounts.some(Z=>Z.num===D.num)&&st(),j&&(n!=null&&n.accounts)&&!n.accounts.some(Z=>Z.num===j.num)&&E(null)},[n,D,j,st]);const At=async Z=>{var Fe;U(!1);const Ce=await ye({action:"share",account:Z},`share-${Z}`);!(Ce!=null&&Ce.ok)||((Fe=V.current)==null?void 0:Fe.num)!==Z||(K({num:Z,blob:Ce.blob,expiresAt:Ce.expiresAt}),W({num:Z,view:"share"}))},Qn=async(Z,Ce)=>{const{commit:Fe,alias:Me}=U8(H,Ce);if(Fe){const ze=await ye({action:"alias",account:Z,alias:Me},`alias-${Z}`);if(await $e(!0),!(ze!=null&&ze.ok))return}nn(Z)},rn=async(Z,Ce)=>{var ze,ht;const Fe=await ye({action:"move",account:Z,slot:Ce},`move-${Z}`),Me=$8({menuFor:((ze=V.current)==null?void 0:ze.num)??null,shareFor:(O==null?void 0:O.num)??null},Z,Fe);if(await $e(!0),Me){((ht=V.current)==null?void 0:ht.num)===Z&&st(),P(Me.confirmRemove),Me.shareFor==null&&(K(null),U(!1)),ae(Me.swapNote);const Rt=Me.swapNote;Rt&&window.setTimeout(()=>ae(Mt=>Mt===Rt?null:Mt),V8),ge(null),Xe(Me.menuFor)}return Fe},Br=async(Z,Ce,Fe)=>{if(!Fe.sends){nn(Z);return}await rn(Z,Ce)},_n=async(Z,Ce)=>{if(Ce.sends){const Fe=await ct({action:"setting",key:"autoswitch.threshold",value:Z},"threshold");if(await $e(!0),!(Fe!=null&&Fe.ok))return;Oe(null)}Pe(!0),window.setTimeout(()=>{var Fe;document.activeElement===et.current&&((Fe=Te.current)==null||Fe.focus()),Pe(!1)},K8)},wr=l.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:l.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})}),vr=Z=>{const{shown:Ce,fuller:Fe}=D8(Z.lanes),Me=cd(Z,T),ze=Z.active||je.includes(Yd(Z)),ht=Z.alias??Z.email??`account ${Z.num}`,Rt=Z.stale||(Me==null?void 0:Me.blocksSwitch)===!0,Mt=Fe?[...Ce,Fe]:Ce,xr=Z.fetchedAt?Ep(Z.fetchedAt,T):null;return l.jsxs("li",{className:`ap-account${Z.active?" active":""}`,"aria-current":Z.active?"true":void 0,"data-open":ze?"":void 0,"data-frozen":Rt?"":void 0,children:[!Z.active&&l.jsx("button",{type:"button",className:"ap-row-open",id:`ap-row-${Z.num}`,"aria-expanded":ze,"aria-controls":ze?`ap-detail-${Z.num}`:void 0,"aria-describedby":!ze&&!(Me!=null&&Me.blocksSwitch)?`ap-quota-${Z.num}`:void 0,onClick:()=>_e(xt=>F8(xt,Z)),children:l.jsxs("span",{className:"vis-hidden",children:[ht,", ",ze?"hide details":"details"]})}),l.jsxs("div",{className:"ap-account-head",children:[Z.active?l.jsx("span",{className:"ap-live",title:`Active account · slot ${Z.num}`,children:l.jsxs("span",{className:"vis-hidden",children:["Active account, slot ",Z.num,":"]})}):l.jsx("span",{className:"ap-num",children:Z.num}),Z.alias&&l.jsx("span",{className:"ap-alias",title:Z.alias,children:Z.alias}),l.jsx("span",{className:"ap-email",title:Z.email??void 0,children:Z.email}),Z.disabled&&l.jsx("span",{className:"ap-held",children:"held out"}),!Z.active&&!Z.disabled&&!(Me!=null&&Me.blocksSwitch)&&l.jsx("button",{type:"button",className:"ap-switch",...Re(`switch-${Z.num}`),onClick:()=>ut(Z.num,ht),"aria-label":`Switch to ${ht}`,title:`Switch to ${Z.alias??Z.email}`,children:c===`switch-${Z.num}`?"…":"Switch"}),l.jsx("button",{type:"button",id:`ap-more-${Z.num}`,className:"ap-more","aria-label":`More actions for ${Z.email??Z.alias??`account ${Z.num}`}`,"aria-haspopup":"menu","aria-expanded":L===Z.num,"aria-controls":L===Z.num?`ap-menu-${Z.num}`:void 0,title:"More actions",onClick:()=>L===Z.num?nn():kn(Z.num),onKeyDown:xt=>{xt.key!=="ArrowDown"&&xt.key!=="ArrowUp"||(xt.preventDefault(),kn(Z.num,xt.key==="ArrowUp"?"last":"first"))},children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":!0,children:[l.jsx("circle",{cx:"2.8",cy:"7",r:"1.15"}),l.jsx("circle",{cx:"7",cy:"7",r:"1.15"}),l.jsx("circle",{cx:"11.2",cy:"7",r:"1.15"})]})})]}),(h==null?void 0:h.row)===Z.num&&l.jsxs("div",{className:"ap-failure ap-row-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),Z.active&&(y==null?void 0:y.num)===Z.num&&l.jsx("p",{className:"ap-switched",children:"Now active. New sessions start on it; ones already running pick it up on their next message, up to about 30 seconds later on macOS."}),(ne==null?void 0:ne.at)===Z.num&&(()=>{const xt=tt.find(gs=>gs.num===ne.displaced),bt=(xt==null?void 0:xt.alias)??(xt==null?void 0:xt.email)??"the account that was there";return l.jsxs("p",{className:"ap-note ap-swap-note",title:`Slot ${ne.at} was taken, so the two accounts traded places: ${bt} now holds slot ${ne.displaced}.`,children:["swapped with slot ",ne.displaced]})})(),Me&&l.jsxs("div",{className:"ap-issue-line",children:[l.jsxs("button",{type:"button",id:`ap-issue-${Z.num}`,className:"ap-issue","data-tone":Me.tone,"aria-haspopup":"dialog","aria-expanded":(j==null?void 0:j.anchor)===`ap-issue-${Z.num}`,"aria-controls":(j==null?void 0:j.anchor)===`ap-issue-${Z.num}`?"ap-issue-pop":void 0,onClick:()=>pn(Z.num,`ap-issue-${Z.num}`),children:[Me.tone==="warn"&&l.jsx(Cp,{}),l.jsx("span",{className:"ap-issue-text",children:Me.text})]}),!ze&&l.jsx("span",{className:"ap-issue-age",title:"When claude-swap last read this account's usage",children:xr??"never collected"})]}),!ze&&!(Me!=null&&Me.blocksSwitch)&&l.jsxs("p",{className:"ap-quota",id:`ap-quota-${Z.num}`,children:[Mt.length?Mt.map(xt=>l.jsxs("span",{className:"ap-q",children:[l.jsx("span",{className:"ap-q-label",children:xt.label})," ",l.jsxs("span",{className:"ap-q-pct","data-level":Rt?void 0:eB(xt.pct),children:[Math.round(xt.pct),"%"]})]},xt.id)):l.jsx("span",{className:"ap-q-label",children:"no usage recorded yet"}),Z.stale&&!Me&&l.jsx("span",{className:"ap-q-age","data-never":xr?void 0:"",title:"When claude-swap last read this account's usage",children:xr??"never collected"})]}),ze&&l.jsxs("div",{className:"ap-detail",id:`ap-detail-${Z.num}`,children:[l.jsx("div",{className:"ap-lanes",children:Z.lanes.length?Z.lanes.map(xt=>l.jsx(nB,{lane:xt,nowSec:T,frozen:Rt},xt.id)):l.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),l.jsx("div",{className:"ap-meta",children:Z.fetchedAt?l.jsxs("span",{className:`ap-age${Z.stale&&!Me?" 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 ",Ep(Z.fetchedAt,T),Me!=null&&Me.blocksSwitch?"":X8(Z.nextAt,T)]}):l.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})})]})]},Z.num)},zr=n!=null&&n.ok&&(a!=null&&a.ok)?l.jsxs("div",{className:"ap-policy-block",children:[l.jsxs("div",{className:"ap-policy",children:[l.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),l.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:l.jsx("select",{ref:Te,"aria-label":"Switch threshold",value:ie,...Re("threshold"),onChange:Z=>Oe(Z.target.value),children:tB(Ee).map(Z=>l.jsxs("option",{value:Z,children:[Z,"%"]},Z))})}),(Je.sends||We)&&l.jsx("button",{ref:et,type:"button",className:"ap-manage-btn",...Re("threshold"),title:Je.title,onClick:()=>_n(ie,Je),children:We&&!Je.sends?Je.done:Je.label}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":a.enabled,"aria-label":"Auto-switch",...Re("enable"),onClick:()=>ct({action:"enable",enabled:!a.enabled},"enable").then(()=>$e(!0)),title:a.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:l.jsx("span",{className:"switch-knob"})})]}),a.external&&l.jsxs("p",{className:"ap-auto-note",children:[l.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",l.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",a.enabled?" — this toggle takes over when you stop it.":"."]})]}):null;return l.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",children:[N==="accounts"&&l.jsxs("div",{className:"ap-header",children:[l.jsx("h2",{children:"Claude accounts"}),l.jsxs("div",{className:"ap-header-right",children:[l.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>X(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:l.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),(((ms=n==null?void 0:n.accounts)==null?void 0:ms.length)??0)>0&&l.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>G(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${Kt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),l.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),l.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>$e(!0),...Re("reload",f),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),l.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),wr]})]}),N==="accounts"&&l.jsx("div",{className:"ap-scroll",id:"ap-scroll",children:n==null?h?l.jsxs("div",{className:"ap-empty",role:"alert",children:[l.jsx("span",{title:h.raw||void 0,children:h.text}),l.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",$_/1e3," seconds."]}),l.jsx("button",{type:"button",className:"ap-fix",disabled:f,onClick:()=>$e(!0),children:f?"trying…":"try again"})]}):l.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?l.jsxs(l.Fragment,{children:[rt&&(lt==null?void 0:lt.tone)==="warn"&&l.jsxs("div",{className:"ap-notice",children:[l.jsxs("button",{type:"button",id:"ap-notice",className:"ap-issue","data-tone":"warn","aria-haspopup":"dialog","aria-expanded":(j==null?void 0:j.anchor)==="ap-notice","aria-controls":(j==null?void 0:j.anchor)==="ap-notice"?"ap-issue-pop":void 0,onClick:()=>pn(rt.num,"ap-notice"),children:[l.jsx(Cp,{}),l.jsx("span",{className:"ap-issue-text",children:"Current account needs attention"})]}),lt.fix&&l.jsx("button",{type:"button",className:"ap-notice-fix",onClick:()=>X(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"Sign in"})]}),l.jsx("ul",{className:"ap-list",children:St.map(vr)}),nt.length>0&&l.jsx(T8,{peers:yt,strained:Et,armed:Xt,threshold:a!=null&&a.ok?Ee:null,open:Ye,onToggle:()=>dt(Z=>!Z)}),nt.length>0&&Ye&&l.jsxs("div",{className:"ap-rest-panel",id:"ap-rest-panel",children:[l.jsx("ul",{className:"ap-list ap-others",id:"ap-rest-list",children:nt.map(vr)}),zr]}),nt.length===0&&zr,h&&h.row==null&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),D&&(()=>{var Me;const Z=(Me=n.accounts)==null?void 0:Me.find(ze=>ze.num===D.num);if(!Z)return null;const Ce=`ap-pop-title-${Z.num}`,Fe=Q&&l.jsx("p",{className:"ap-pop-error",role:"alert",title:Q.raw||void 0,children:Q.text});return l.jsxs(x_,{anchorId:`ap-more-${Z.num}`,boundaryId:he(Z.num),id:`ap-menu-${Z.num}`,className:"ap-pop",role:D.view==="menu"?"menu":"dialog",labelledBy:D.view==="menu"?`ap-more-${Z.num}`:Ce,start:D.start,onClose:st,children:[D.view==="menu"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{I(Z.alias??""),ee(null),W({num:Z.num,view:"rename"})},children:"Rename"}),l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{ge(null),ee(null),W({num:Z.num,view:"move"})},children:"Move to slot…"}),l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...Re(`share-${Z.num}`),title:`Copy this account to another ${Kt}. 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:()=>At(Z.num),children:c===`share-${Z.num}`?"Sharing…":"Share"}),(((a==null?void 0:a.enabled)||(a==null?void 0:a.external))&&!Z.active||Z.disabled)&&l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...Re(`rot-${Z.num}`),title:Z.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",onClick:()=>ct({action:"account",account:Z.num,enabled:Z.disabled},`rot-${Z.num}`,"menu").then(ze=>{$e(!0),ze!=null&&ze.ok&&nn(Z.num)}),children:Z.disabled?"Put back in rotation":"Hold out of rotation"}),l.jsx("div",{role:"separator",className:"ap-menu-sep"}),l.jsx("button",{type:"button",role:"menuitem",className:`ap-menu-item danger${B===Z.num?" armed":""}`,...Re(`rm-${Z.num}`),"aria-label":B===Z.num?"Confirm remove":void 0,title:B===Z.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(B!==Z.num){P(Z.num),z.current=Date.now(),window.setTimeout(()=>P(ze=>ze===Z.num?null:ze),4e3);return}Date.now()-z.current<Vd||(P(null),ye({action:"remove",account:Z.num},`rm-${Z.num}`).then(ze=>{var ht;$e(!0),ze!=null&&ze.ok&&(((ht=V.current)==null?void 0:ht.num)===Z.num&&st(),Xe(null))}))},children:c===`rm-${Z.num}`?"Removing…":B===Z.num?"Confirm":"Remove"}),Fe]}),D.view==="rename"&&l.jsxs("form",{className:"ap-pop-form",onSubmit:ze=>{ze.preventDefault(),Qn(Z.num,Z.alias)},children:[l.jsx("label",{className:"ap-pop-title",id:Ce,htmlFor:`ap-alias-${Z.num}`,children:"Rename account"}),l.jsx("input",{id:`ap-alias-${Z.num}`,className:"ap-manage-input",type:"text",value:H,onChange:ze=>I(ze.target.value),maxLength:z8,placeholder:"e.g. work",spellCheck:!1,autoComplete:"off",autoFocus:!0,onFocus:ze=>ze.currentTarget.select()}),Fe,l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>nn(),children:"Cancel"}),l.jsx("button",{type:"submit",className:"btn primary",...Re(`alias-${Z.num}`),title:"A short name to show instead of the email",children:c===`alias-${Z.num}`?"…":"Save"})]})]}),D.view==="move"&&(()=>{const ze=I8((n.accounts??[]).map(Mt=>Mt.num),Z.num),ht=O8(ze,pe,Z.num),Rt=P8(ze,ht,Z.num);return l.jsxs("div",{className:"ap-pop-form",children:[l.jsx("label",{className:"ap-pop-title",id:Ce,htmlFor:`ap-slot-${Z.num}`,children:"Move to slot"}),l.jsx("span",{className:"ap-field",children:l.jsx("select",{id:`ap-slot-${Z.num}`,value:String(ht),...Re(`move-${Z.num}`),onChange:Mt=>ge(Number(Mt.target.value)),autoFocus:!0,children:ze.map(Mt=>l.jsx("option",{value:Mt.slot,children:Mt.label},Mt.slot))})}),Fe,l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>nn(),children:"Cancel"}),l.jsx("button",{type:"button",className:"btn primary",...Re(`move-${Z.num}`),title:Rt.title,onClick:()=>Br(Z.num,ht,Rt),children:c===`move-${Z.num}`?"…":Yl(Rt.label)})]})]})})(),D.view==="share"&&(O==null?void 0:O.num)===Z.num&&(()=>{const ze=eR(O.expiresAt,T),ht=ze.tone==="gone";return l.jsxs("div",{className:`ap-pop-form ap-share${ht?" expired":""}`,children:[l.jsx("p",{className:"ap-pop-title",id:Ce,children:"Share account"}),l.jsx("code",{className:"ap-share-blob",children:O.blob}),l.jsxs("p",{className:"ap-pop-note",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[l.jsx("span",{className:"ap-share-warn",children:"This is the password"})," · ",l.jsx("span",{className:`ap-share-expiry ${ze.tone}`,children:ze.text})]}),Fe,l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>nn(),children:"Done"}),l.jsx("button",{type:"button",className:"btn primary",...Re(`share-${Z.num}`),autoFocus:!0,onClick:async()=>{if(ht){await At(Z.num);return}await O_(O.blob)&&(U(!0),window.setTimeout(()=>U(!1),1800))},children:ht?"Make a new share":J?"Copied":"Copy"})]})]})})()]})})(),j&&(()=>{var Fe;const Z=(Fe=n.accounts)==null?void 0:Fe.find(Me=>Me.num===j.num),Ce=Z?cd(Z,T):null;return!Z||!Ce?null:l.jsx(x_,{anchorId:j.anchor,boundaryId:j.anchor==="ap-notice"?"ap-scroll":he(Z.num),id:"ap-issue-pop",className:"ap-pop ap-issue-pop",role:"dialog",labelledBy:"ap-issue-title",onClose:()=>Cn(),children:l.jsxs("div",{className:"ap-pop-form",children:[l.jsxs("p",{className:"ap-pop-title ap-issue-title",id:"ap-issue-title","data-tone":Ce.tone,children:[Ce.tone==="warn"&&l.jsx(Cp,{}),Ce.text]}),l.jsx("p",{className:"ap-pop-note ap-issue-hint",children:Ce.hint}),l.jsxs("p",{className:"ap-pop-note ap-issue-when",children:[l.jsx("span",{className:"ap-issue-who",children:Z.alias??Z.email??`account ${Z.num}`})," · ",Z.fetchedAt?`last collected ${Ep(Z.fetchedAt,T)}`:"never collected"]}),l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>Cn(!0),children:"Done"}),Ce.fix&&l.jsx("button",{type:"button",className:"btn primary",onClick:()=>{Cn(!0),X(!0)},title:"Open the sign-in dialog. Signing in as this account puts its login back in this slot — it keeps its slot, its alias and its history.",children:Ce.fix})]})]})})})()]}):l.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"claude-swap isn't installed."}),l.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),n.hint&&l.jsx("code",{className:"ap-cmd",children:n.hint}),l.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",l.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"No accounts added yet."}),l.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",l.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"Couldn't read the account store."}),l.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})})}),l.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:y?`Now active: ${y.name}`:""}),S&&l.jsx(E8,{accounts:((n==null?void 0:n.accounts)??[]).map(Z=>({key:`${String(Z.email??"").trim().toLowerCase()}@@${Z.orgUuid??""}`,email:Z.email??"",alive:Z.alive===!0})),onChanged:()=>$e(!0),view:N==="lan",onOpen:Lt,onBack:()=>_("accounts"),closeButton:wr}),M&&l.jsx(SF,{onClose:()=>X(!1),onChanged:()=>$e(!0)}),de&&l.jsx(M8,{accounts:((n==null?void 0:n.accounts)??[]).map(Z=>({num:Z.num,email:Z.email,alias:Z.alias,org:Z.org})),onClose:()=>G(!1),copyText:O_})]})}const sB=3e4;function aB({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function oB({bundle:e,running:t,pending:n,lastTried:r}){return t?aB({bundle:e,running:t,lastTried:r})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function iB(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function lB({asked:e,reported:t}){return t?t!==e:!1}function dR(e){const t=e.thresholdMs??sB;return!e.enabled||e.kind!=="restart"||!e.canRestart||!e.noticeOpen||!e.visible||e.busy?null:e.idleSince==null||e.now<e.idleSince?t:Math.max(0,t-(e.now-e.idleSince))}function cB(e){const t=Math.max(0,Math.ceil(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function uB(e,t){return e?t==null?"auto when idle":`auto in ${cB(t)}`:"auto-restart off"}function P_(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function dB(e){return e<=0?{label:"Restart now",clause:"nothing is running"}:{label:"Restart anyway",clause:`${e===1?"1 agent is running":`${e} agents are running`} — their events during the restart are lost`}}function hB(e){const t=dR(e);return t==null?{idleSince:null,restart:!1,remainingMs:null}:e.idleSince==null||e.now<e.idleSince?{idleSince:e.now,restart:!1,remainingMs:t}:{idleSince:e.idleSince,restart:t===0,remainingMs:t}}function fB(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function pB(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 mB(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function gB(e,t){const n=mB(e),r=(...c)=>[n?`${n} on the canvas`:null,...c,"layout, pins and selection"].filter(u=>u!==null),a="This cannot be undone.";if(!t)return{goes:r("the event log on disk — the file a restarted deck replays to rebuild what you see, and the file every deck on this machine shares unless one was told otherwise"),stays:[],final:a,confirm:"Clear everything"};if(!t.path)return{goes:r(),stays:[],final:`This deck keeps no event log, so nothing on disk changes — and nothing can bring the canvas back. ${a}`,confirm:"Clear everything"};if(!t.mine){const c=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,u=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{goes:r(),stays:[`the event log — ${c}${u}`,"restart this deck and the log replays back onto it"],final:null,confirm:"Clear this canvas"}}if(t.decks<=1)return{goes:r("this deck's event log — the file a restarted deck replays to rebuild what you see"),stays:[],final:a,confirm:"Clear everything"};const i=t.decks-1;return{goes:r(`the event log ${i===1?"1 other running deck shares":`${i} other running decks share`} with this one — every session recorded in it, not just the ones drawn here`),stays:[i===1?"what that deck shows, until it restarts — then it is gone there too":"what those decks show, until they restart — then it is gone there too"],final:a,confirm:"Clear everything"}}function yB({agentCount:e,onConfirm:t,onCancel:n}){const r=x.useRef(null),a=fn(n,{focusRef:r,layer:O5}),[i,c]=x.useState(null);x.useEffect(()=>{let m=!1;return fetch("/api/clear").then(y=>y.ok?y.json():null).then(y=>{m||c(pB(y))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:f,final:p,confirm:h}=gB(e,i);return l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{className:"status-dot err","aria-hidden":!0}),l.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsxs("dl",{className:"cc-plan",children:[l.jsx("dt",{children:"Goes"}),l.jsx("dd",{children:u.map(m=>l.jsx("span",{children:m},m))}),l.jsx("dt",{children:"Stays"}),l.jsx("dd",{children:f.length>0?f.map(m=>l.jsx("span",{children:m},m)):l.jsx("span",{children:"nothing"})})]}),p&&l.jsx("p",{className:"cc-final",children:p}),l.jsxs("div",{className:"cc-actions",children:[l.jsx("button",{type:"button",ref:r,className:"btn",onClick:n,children:"Cancel"}),l.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const wB="Press Esc first if a key does nothing.",vB=[{title:"Canvas",rows:[{cap:"Space",action:"pause or resume the stream",binds:[" "]},{cap:"J",action:"next agent",binds:["j","J"]},{cap:"K",action:"previous agent",binds:["k","K"]},{cap:"W",action:"the session waiting on you — oldest first, again for the next",binds:["w","W"]},{cap:"F",action:"fit every agent on screen",binds:["f","F"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"U",action:"usage panel",binds:["u","U"]},{cap:"L",action:"session list",binds:["l","L"]},{cap:"D",action:"detail panel",binds:["d","D"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"S",action:"this machine — cores, memory, temperature",binds:["s","S"]},{cap:"B",action:"Browser Watch",binds:["b","B"]},{cap:"V",action:"the sound menu — volume, tones, notifications",binds:["v","V"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function xB({onClose:e,onTour:t}){const n=fn(e);return l.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:l.jsxs("div",{ref:n,className:"modal key-help",onClick:r=>r.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[t&&l.jsxs("div",{className:"guide-door",children:[l.jsx("span",{children:"Eight pictures of what the deck shows."}),l.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),l.jsx("div",{className:"shortcuts",children:vB.map(r=>l.jsxs(x.Fragment,{children:[l.jsx("h3",{className:"kh-group",children:r.title}),r.rows.map(a=>l.jsxs("div",{className:"sc",children:[l.jsx("kbd",{children:a.cap}),l.jsx("span",{children:a.action})]},`${r.title}:${a.cap}:${a.action}`))]},r.title))}),l.jsx("p",{className:"kh-foot",children:wB})]})]})})}const bB=["done","needs-input"],kB=[{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}]}],_B=[{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}]}],f0={done:kB,"needs-input":_B},Di="two";function Xd(e,t){const n=f0[e];return n.find(r=>r.id===t)??n.find(r=>r.id===Di)??n[0]}function hR(e,t){return f0[e].some(r=>r.id===t)?t:Di}Xd("done",Di).notes,Xd("needs-input",Di).notes;const L_=.04,NB=.24,Ed=0,Zd=100,jx=5,hc=50;function fc(e){if(!Number.isFinite(e))return hc;const t=Math.round(e/jx)*jx;return Math.min(Zd,Math.max(Ed,t))}function SB(e){if(e==null)return hc;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?fc(Number(t)):hc}function jB(e){const t=fc(e),n=L_+(NB-L_)*(t/Zd);return Math.round(n*1e4)/1e4}function EB(e,t){const n=t.trim,r=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(jB(e)*r*1e4)/1e4}const CB=160,TB="agent-dag.soundLevel.done",AB="agent-dag.soundLevel.needs-input",RB="agent-dag.soundFigure.done",MB="agent-dag.soundFigure.needs-input",fR={done:TB,"needs-input":AB},pR={done:RB,"needs-input":MB},Ex={done:{level:hc,figure:Di},"needs-input":{level:hc,figure:Di}};function IB(e){const t=n=>({level:SB(e(fR[n])),figure:hR(n,e(pR[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const D_={Stop:"done",Notification:"needs-input"};function $B(e,t){var r;if(t)return null;const n=(r=e==null?void 0:e.payload)==null?void 0:r.hook_event_name;return typeof n!="string"?null:Object.hasOwn(D_,n)?D_[n]:null}function OB(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,r=!1;const a=()=>e.enabled()?r&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",i=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,a())};function c(){var f;if(!(!t||r))try{n=n??new t,(f=n.resume)==null||f.call(n).then(i,()=>{}),r=!0,i()}catch{}}function u(f,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((N=e.prefs)==null?void 0:N.call(e))??Ex)[f]??Ex[f],m=Xd(f,h.figure),y=EB(h.level,m),w=n.currentTime;for(const _ of m.notes){const S=n.createOscillator(),b=n.createGain();S.type=m.type??"sine",S.frequency.value=_.hz;const j=w+_.at,E=j+_.ms/1e3;b.gain.setValueAtTime(1e-4,j),b.gain.exponentialRampToValueAtTime(y,j+.012),b.gain.exponentialRampToValueAtTime(1e-4,E),S.connect(b).connect(n.destination),S.start(j),S.stop(E+.02)}return!0}return{unlock:c,play:u,state:a,get context(){return n}}}const PB="Notify me when a session needs my attention.",LB="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",q_="Get notified when you're away from this tab.";function DB(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:q_};case"default":return{status:null,ask:!0,ok:!1,note:q_};case"denied":return{status:"Blocked",ask:!1,ok:!1,note:"Your browser is blocking them; only its own site settings can undo that. You'll still be told once this tab is closed."};default:return{status:"Unavailable",ask:!1,ok:!1,note:"This browser cannot show them. You'll still be told once this tab is closed."}}}const F_={done:"Turn finished","needs-input":"Claude is asking"},qB={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function FB({onClose:e,soundOn:t,onToggleSound:n,prefs:r,onLevel:a,onFigure:i,onPreview:c,openerRef:u,notifyOn:f,onToggleNotify:p,notifyVetoed:h,notifyPermission:m,onAskNotify:y}){const w=DB(m),N=f&&!h,_=fn(e),S=x.useRef(e);return S.current=e,x.useEffect(()=>{const b=j=>{var C,T;const E=j.target;E&&((C=_.current)!=null&&C.contains(E)||(T=u.current)!=null&&T.contains(E)||S.current())};return window.addEventListener("pointerdown",b,!0),()=>window.removeEventListener("pointerdown",b,!0)},[_,u]),l.jsxs("div",{ref:_,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[l.jsxs("div",{className:"sm-switches",children:[l.jsxs("label",{className:"sm-switch",children:[l.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),l.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-labelledby":"sm-sound-label",className:"switch",onClick:n,title:"A tone when a turn finishes, and when Claude asks for something",children:l.jsx("span",{className:"switch-knob"})})]}),l.jsxs("div",{className:"sm-setting",children:[l.jsxs("label",{className:"sm-switch",children:[l.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),l.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-labelledby":"sm-notify-label",className:"switch",onClick:p,title:"A system notification when a session blocks on you",children:l.jsx("span",{className:"switch-knob"})})]}),l.jsx("p",{className:"sm-note",children:h?LB:PB})]})]}),N&&l.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[l.jsxs("div",{className:"sm-channel-head",children:[l.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),w.ask?l.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:y,children:"Enable"}):l.jsxs("span",{className:"sm-channel-state","data-ok":w.ok||void 0,children:[w.ok&&l.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),w.status]})]}),l.jsx("p",{className:"sm-note",children:w.note})]}),!t&&l.jsx("span",{id:"sm-preview-note",className:"vis-hidden",children:"Plays even when Sounds is off, so you can set a tone before turning sounds back on."}),l.jsx("div",{className:"sm-tones",children:bB.map(b=>{const j=r[b],E=`sm-level-${b}`,C=`sm-figure-${b}`;return l.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${b}`,children:[l.jsxs("div",{className:"sm-tone-head",children:[l.jsx("h3",{className:"sm-tone-name",id:`sm-name-${b}`,children:F_[b]}),l.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(b),"aria-label":`Hear the ${F_[b].toLowerCase()} tone`,title:t?"Play this tone now, at what it is set to":"Plays even when Sounds is off","aria-describedby":t?void 0:"sm-preview-note",children:[l.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),l.jsxs("div",{className:"sm-row",children:[l.jsx("label",{htmlFor:E,children:"Volume"}),l.jsx("input",{id:E,type:"range",min:Ed,max:Zd,step:jx,value:j.level,onChange:T=>a(b,Number(T.target.value)),style:{"--sm-level":`${(j.level-Ed)/(Zd-Ed)*100}%`}}),l.jsxs("span",{className:"sm-read",children:[j.level,"%"]})]}),l.jsxs("div",{className:"sm-row",children:[l.jsx("label",{htmlFor:C,children:"Tone"}),l.jsx("select",{id:C,className:"sm-select",value:j.figure,onChange:T=>i(b,T.target.value),children:f0[b].map(T=>l.jsx("option",{value:T.id,children:T.label},T.id))})]}),l.jsx("p",{className:"sm-note",children:qB[b]})]},b)})}),l.jsxs("p",{className:"sm-foot",children:[l.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const Cx="https://www.youtube-nocookie.com";function BB(e,t){const n=new URLSearchParams({channel:e,enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${Cx}/embed/live_stream?${n.toString()}`}function ud(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function zB(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const UB=[1,3],WB=[0,2],HB=[2,5,100,101,150];function GB(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const{event:n,info:r}=t;if(n==="onReady")return{kind:"ready"};if(n==="onError"){const a=typeof r=="number"?r:Number(r==null?void 0:r.errorCode);return Number.isFinite(a)?{kind:"error",code:a}:null}if(n==="onStateChange"||n==="infoDelivery"){const a=typeof r=="number"?r:r==null?void 0:r.playerState;return typeof a!="number"||!Number.isFinite(a)?null:UB.includes(a)?{kind:"playing",playing:!0}:WB.includes(a)?{kind:"playing",playing:!1}:null}return null}const VB=100,KB=18,YB=260;function XB(e){const t=e.reduce((n,r)=>Math.max(n,r.at*1e3+r.ms),0);return Math.round(t)+YB}const mR=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],ZB=18,QB=mR.length,B_=new Set(["a","c","p"]);function Cd(e=mR){const t=[];return e.forEach((n,r)=>{let a=0;for(;a<n.length;){const i=n[a];if(i==="."){a+=1;continue}let c=1;for(;a+c<n.length&&n[a+c]===i;)c+=1;t.push({x:a,y:r,w:c,cell:i}),a+=c}}),t}const qi=148,z_=6e3,JB=16e3,gR=46,Sa=34;function ez(e,t,n=qi){let r=-Math.round(t()*n);if(Math.abs(r-e)<Sa){const a=e-Sa>=-n?-Sa:Sa;r=Math.max(-n,Math.min(0,Math.round(e+a)))}return{to:r,ms:Math.round(Math.abs(r-e)*gR)}}function tz(e){return Math.round(z_+e()*(JB-z_))}const U_=[{kind:"stroll",weight:36},{kind:"tidy",weight:17},{kind:"kick",weight:17},{kind:"sit",weight:12},{kind:"watch",weight:16},{kind:"leave",weight:7}];function nz(e){const t=U_.reduce((r,a)=>r+a.weight,0);let n=e()*t;for(const r of U_)if(n-=r.weight,n<0)return r.kind;return"stroll"}const rz=720,sz=260,az=620,oz=220,iz=520,W_=7e3,lz=15e3,H_=6e3,cz=14e3;function dd(e,t,n=qi){let r=-Math.round(t()*n);if(Math.abs(r-e)<Sa){const a=e-Sa>=-n?-Sa:Sa;r=Math.max(-n,Math.min(0,Math.round(e+a)))}return r}const Yn=(e,t)=>Math.round(Math.abs(t-e)*gR),hd=0;function uz(e,t){const n=r=>({kind:"litter",at:t,...r});return[{x:t,prop:n({}),act:"walk",ms:Yn(e,t)},{x:t,prop:n({}),act:"stoop",ms:rz},{x:hd,prop:n({held:!0}),act:"carry",ms:Yn(t,hd)},{x:hd,prop:n({held:!0}),act:"windup",ms:sz},{x:hd,prop:n({held:!0,leaving:!0}),act:"toss",ms:az}]}function dz(e,t){const n=(r={})=>({kind:"ball",at:t,...r});return[{x:t,prop:n(),act:"walk",ms:Yn(e,t)},{x:t,prop:n(),act:"windup",ms:oz},{x:t,prop:n({leaving:!0}),act:"kick",ms:iz}]}function hz(e,t,n){return[{x:t,prop:null,act:"walk",ms:Yn(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(H_+n()*(cz-H_))}]}function fz(e,t,n){const r=()=>({kind:"scope",at:t,held:!0});return[{x:t,prop:null,act:"walk",ms:Yn(e,t)},{x:t,prop:r(),act:"watch",ms:Math.round(W_+n()*(lz-W_))}]}function pz(e,t,n){return e.act==="watch"?"left":e.x===t?n:e.x>t?"right":"left"}const mz=1500,gz=e=>Math.round(1e3*Math.sqrt(2*e/mz)),yz=115,wz=e=>Math.round(e/yz*1e3),vz=620,xz=200,bz=760;function kz(e,t,n){const a=-(t.ledgeSpan??qi),i=gz(t.ledgeH),c=wz(t.ledgeH),u=-Math.round(n()*t.floorSpan),f=-Math.round(n()*t.floorSpan);return[{x:a,act:"walk",prop:null,ms:Yn(e,a)},{x:a,act:"peer",prop:null,ms:vz},{x:a,act:"fall",prop:null,ms:i,place:"floor"},{x:a,act:"land",prop:null,ms:xz,place:"floor"},{x:u,act:"walk",prop:null,ms:Yn(a,u),place:"floor"},{x:f,act:"walk",prop:null,ms:Yn(u,f),place:"floor"},{x:a,act:"walk",prop:null,ms:Yn(f,a),place:"floor"},{x:a,act:"lasso",prop:null,ms:bz,place:"floor"},{x:a,act:"climb",prop:null,ms:c}]}function _z(e,t,n){const r=(n==null?void 0:n.ledgeSpan)??qi;switch(nz(t)){case"tidy":return uz(e,dd(e,t,r));case"kick":return dz(e,dd(e,t,r));case"sit":return hz(e,dd(e,t,r),t);case"watch":return fz(e,dd(e,t,r),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return kz(e,n,t)}}const i=ez(e,t,r);return[{x:i.to,prop:null,act:"walk",ms:i.ms}]}const Nz=[".xx.","xxxx",".xx."],Sz=[".xx.","xxxx","xxxx",".xx."],jz=["..xxx","xxxxx","..xxx"],G_={litter:Nz,ball:Sz,scope:jz},yR=["bob","sway","groove"],V_=9e3,Ez=16e3,wR=1e3,Cz=.08;function Tz(e,t){const n=yR.filter(i=>i!==e),r=n[Math.min(n.length-1,Math.floor(t()*n.length))],a=(t()*2-1)*Cz;return{dance:r,beatMs:Math.round(wR*(1+a))}}function Az(e){return Math.round(V_+e()*(Ez-V_))}const Rz=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],Mz=3,Iz=-1,K_=11,Y_=9,X_=132,$z=260,Oz=200;function Pz(e,t,n){const r=(h,m=Yn(e,h))=>({x:h,prop:null,act:"walk",ms:m,place:"floor"});if(!n||n.height<=0)return[r(t)];const a=Math.min(e,t);if(Math.max(e,t)<=n.left||a>=n.right)return[r(t)];const c=t>e,u=c?n.left:n.right,f=c?n.right:n.left,p={place:"floor",riser:n.height,prop:null};return[r(u,Yn(e,u)),{...p,x:u,act:"mount",ms:$z},{...p,x:f,act:"walk",ms:Yn(u,f)},{x:f,prop:null,act:"dismount",ms:Oz,place:"floor"},{x:t,prop:null,act:"walk",ms:Yn(f,t),place:"floor"}]}function Z_(e,t){var r;const n=((r=e[0])==null?void 0:r.length)??0;return l.jsx("svg",{viewBox:`0 0 ${n} ${e.length}`,shapeRendering:"crispEdges","aria-hidden":!0,children:Cd(e).map(a=>l.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1},`${t}${a.y}-${a.x}`))})}const Tp={e:"fm-eye",s:"fm-shade",p:"fm-pad"},Lz=x.forwardRef(function({fetchImpl:t},n){const[r,a]=x.useState(null),[i,c]=x.useState(!1),[u,f]=x.useState(!1),[p,h]=x.useState(!1),[m,y]=x.useState(0),[w,N]=x.useState(0),[_,S]=x.useState(null),[b,j]=x.useState(null),[E,C]=x.useState("ledge"),[T,R]=x.useState("left"),[$,D]=x.useState(0),W=x.useRef(null),[L,V]=x.useState(null),[Q,ee]=x.useState(wR),M=x.useRef(null),X=x.useRef(null),H=x.useCallback(P=>{var z,O;(O=(z=M.current)==null?void 0:z.contentWindow)==null||O.postMessage(P,Cx)},[]);if(x.useEffect(()=>{let P=!0;return(t??fetch)("/api/claude-fm").then(O=>O.ok?O.json():null).then(O=>{P&&(O!=null&&O.live)&&(O!=null&&O.channel)&&a({live:!0,channel:O.channel})}).catch(()=>{}),()=>{P=!1}},[t]),x.useEffect(()=>{if(!u)return;const P=z=>{if(z.origin!==Cx)return;const O=GB(z.data);if(O){if(O.kind==="ready"){H(ud("playVideo"));return}if(O.kind==="playing"){h(O.playing);return}HB.includes(O.code)&&(f(!1),h(!1),c(!0))}};return window.addEventListener("message",P),()=>window.removeEventListener("message",P)},[u,H]),x.useEffect(()=>()=>{X.current&&clearTimeout(X.current)},[]),x.useEffect(()=>{var ne;if(!r||i||(ne=window.matchMedia)!=null&&ne.call(window,"(prefers-reduced-motion: reduce)").matches)return;let P=null,z=0;y(ae=>z=ae);const O=ae=>{const[pe,...ge]=ae;if(!pe){S(null),j(null),U();return}N(pe.ms),S(pe.act),j(pe.prop),C(pe.place??"ledge"),R(Oe=>pz(pe,z,Oe)),D(pe.riser??0);const Se=J(pe);y(Se),z=Se,P=setTimeout(()=>O(ge),pe.ms)},K=()=>{const ae=W.current,pe=ae==null?void 0:ae.querySelector(".fm-sprite"),ge=ae==null?void 0:ae.parentElement;if(!ae||!pe||!ge)return null;const Se=ae.getBoundingClientRect(),Oe=ge.getBoundingClientRect(),We=Oe.right-Se.right,Pe=Oe.width-We*2-pe.offsetWidth;return Pe>0?Pe:null},de=()=>{const ae=W.current,pe=ae==null?void 0:ae.querySelector(".fm-walker"),ge=K();if(!ae||!pe||ge==null)return;const Se=ae.getBoundingClientRect().bottom-pe.getBoundingClientRect().bottom;if(Se>0)return{ledgeH:Se,floorSpan:ge}},G=()=>{const ae=W.current,pe=document.querySelector(".autofit-chip");if(!ae||!pe)return null;const ge=ae.getBoundingClientRect(),Se=pe.getBoundingClientRect();return Se.width<=0||Se.height<=0?null:{left:Se.left-ge.right,right:Se.right-ge.right,height:Se.height}},J=ae=>{const pe=(ae.place??"ledge")==="floor"?K()??qi:qi;return Math.max(-pe,Math.min(0,ae.x))},U=()=>{P=setTimeout(()=>{const ae=_z(z,Math.random,de()),pe=ae.some(Oe=>Oe.place==="floor")?G():null;let ge=z;const Se=ae.flatMap(Oe=>{const We=ge;return ge=Oe.x,Oe.place==="floor"&&Oe.act==="walk"?Pz(We,Oe.x,pe):[Oe]});O(Se)},tz(Math.random))};return U(),()=>{P&&clearTimeout(P),C("ledge"),S(null),j(null),D(0)}},[r,i]),x.useEffect(()=>{var O;if(!p){V(null);return}if((O=window.matchMedia)!=null&&O.call(window,"(prefers-reduced-motion: reduce)").matches)return;let P=null;const z=K=>{const de=Tz(K,Math.random);V(de.dance),ee(de.beatMs),P=setTimeout(()=>z(de.dance),Az(Math.random))};return z(null),()=>{P&&clearTimeout(P)}},[p]),x.useImperativeHandle(n,()=>({duck(P){p&&(X.current&&clearTimeout(X.current),H(ud("setVolume",[KB])),X.current=setTimeout(()=>{H(ud("setVolume",[VB])),X.current=null},P))}}),[p,H]),!r||i)return null;const I=Cd().filter(P=>!B_.has(P.cell)),B=()=>{if(!u){f(!0),h(!0);return}const P=!p;h(P),H(ud(P?"playVideo":"pauseVideo"))};return l.jsxs("div",{ref:W,className:"fm","data-place":E,style:{"--fm-beat":`${Q}ms`},children:[b&&!b.held&&l.jsx("div",{className:"fm-prop","data-prop":b.kind,"data-leaving":b.leaving?"":void 0,style:{"--fm-prop-x":`${b.at}px`,"--fm-roll-to":T==="right"?`${X_}px`:`${-X_}px`},children:Z_(G_[b.kind],"p")}),(_==="lasso"||_==="climb")&&l.jsx("div",{className:"fm-rope","data-act":_,style:{"--fm-rope-x":`${m}px`}}),l.jsxs("div",{className:"fm-walker","data-act":_??void 0,"data-place":E,"data-facing":T,style:{"--fm-x":`${m}px`,"--fm-walk-ms":`${w}ms`,"--fm-riser":`${$}px`},children:[(b==null?void 0:b.held)&&l.jsx("div",{className:"fm-held","data-toss":b.leaving?"":void 0,children:Z_(G_[b.kind],"h")}),l.jsx("button",{type:"button",className:"fm-sprite","data-playing":p?"":void 0,"data-dance":p?L??yR[0]:void 0,"aria-pressed":p,onClick:B,title:p?"Stop Claude FM":"Play Claude FM — streams from YouTube","aria-label":p?"Stop Claude FM":"Play Claude FM",children:l.jsxs("svg",{viewBox:`0 0 ${ZB} ${QB}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[l.jsx("g",{className:"fm-gear",children:l.jsx("g",{className:"fm-gear-motion",children:Cd().filter(P=>B_.has(P.cell)).map(P=>l.jsx("rect",{x:P.x,y:P.y,width:P.w,height:1,className:Tp[P.cell]},`g${P.y}-${P.x}`))})}),l.jsx("g",{className:"fm-body",children:I.filter(P=>P.y<K_).map(P=>l.jsx("rect",{x:P.x,y:P.y,width:P.w,height:1,className:Tp[P.cell]},`b${P.y}-${P.x}`))}),l.jsx("g",{className:"fm-hat",children:Cd(Rz).map(P=>l.jsx("rect",{x:Mz+P.x,y:Iz+P.y,width:P.w,height:1,className:P.cell==="k"?"fm-hatband":void 0},`h${P.y}-${P.x}`))}),["left","right"].map(P=>l.jsx("g",{className:"fm-leg","data-side":P,children:I.filter(z=>z.y>=K_).filter(z=>P==="left"?z.x<Y_:z.x>=Y_).map(z=>l.jsx("rect",{x:z.x,y:z.y,width:z.w,height:1,className:Tp[z.cell]},`${P}${z.y}-${z.x}`))},P))]})})]}),u&&r.channel&&l.jsx("iframe",{ref:M,className:"fm-frame",title:"Claude FM",src:BB(r.channel,window.location.origin),onLoad:()=>H(zB()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})]})}),Dz=15e3;function qz(e){return e.visibilityState==="visible"&&e.hasFocus()}function Fz(e,t){return t||e===!0}function Bz(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}const zz={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all.","","A release that genuinely has nothing to say is spelled TWICE: no key here,",'and its version written into "//nothing-to-say" below. One spelling on its',"own is ambiguous — a missing key reads the same whether it was a decision","or a forgotten step, and five releases in a row were once forgotten. The list","is what tells the two apart, and release-notes-current-version.test.ts fails","the release whose version is in neither place. Any key opening with // is a","note to the author and never a release."],"//nothing-to-say":["3.23.1","3.23.2","3.23.3","3.23.4"],"3.24.0":[{title:"🎧 Claude FM plays from the minimap",body:"A small character stands on the minimap's top edge. Press it and the Claude channel's live stream plays; press it again and it stops. It only turns up when the channel is actually broadcasting, so a deck with no network never shows it at all."},{title:"🤠 And it gets on with its day",body:"It walks that edge, tidies up what it finds, kicks a ball along it, sits with its legs over the side, and watches the board through a scope. Now and then it drops onto the canvas and ropes its way back up. Headphones on while the music plays, a hat when it does not."}],"3.23.5":[{title:"🧭 The accounts panel opens on the account you are on",body:"Its windows, its resets and how old the numbers are — whole, at the top of the column. Every other account stands behind one row that says how many of them a switch could actually reach; press it to see them, or rest on it to be shown their names and how much room each has left."},{title:"⚙️ Auto-switch moved in there with them",body:"It is behind that same row now, after the accounts it switches between, rather than at the foot of the panel. The row says `auto 90%` or `auto off` so you can tell what the policy is doing without opening it — and says so in amber when it is armed with nowhere left to go."}],"3.23.0":[{title:"🧭 The accounts column leads with accounts",body:`The live account is the open row: its windows as bars, when each one resets, and how old the numbers are. Every other account rests on the two figures a switch is decided by, and opens with a click when you want the rest.
92
+
93
+ A problem stays on the row — an expired login, one that was never stored, a keychain the deck cannot open — with the reason and the sign-in one press away. Auto-switch is one row now: its threshold and its switch. Local network moved out of the column into a view of its own, reached from a row at the foot that says how many of the paired machines are on right now, and shows which ones when you hover it.`},{title:"💬 A resting session shows Claude Code's recap beside its card",body:"When a session stops, Claude Code's own recap of what it did is drawn beside the card — so a board you come back to says what happened without opening anything."},{title:"🪟 The chrome went quiet",body:`The topbar is borderless, one set of corners runs through the app, the canvas ground is flat, and the minimap, the zoom controls, the type filter and the Machine and Usage panels read as tooling rather than as cards.
94
+
95
+ The canvas also says when auto-fit is off, with one press to bring new sessions back into view.`},{title:"🔍 A tool call's detail reads as the call",body:"A tool call's arguments are shown as the call rather than as escaped JSON, and can be copied."},{title:"🔐 Saying yes to every deck that asks takes two presses",body:"The switch that accepts every pairing request arms first and says what it hands over, so one stray click cannot put this machine's logins on another deck."},{title:"🖐️ Targets, themes and contrast",body:"The panel's smallest controls reach the 24px target floor, and grow further under a finger. A first run follows the system's light or dark setting instead of picking one. Status dots, meters and switch knobs survive a Windows Contrast theme."}],"3.22.15":[{title:"🖱️ Clicking a card opens its details",body:"Selecting an agent is inspecting it: a click, `j`/`k`, a session picked from the list and Enter on a focused card all open the detail panel — prompt, every tool call, tokens, timing. It used to open only with `D`, so anybody who closed it with its × and never found the key did not get it back. The × still closes it until the next selection, and `D` still toggles it.\n\n`D` with nothing selected now picks a card first — the session that has waited longest, or the one `j` would land on — instead of flipping a switch with nothing on screen to show for it."},{title:"⌨️ The keyboard and screen readers reach the whole deck",body:`Shortcuts keep working after a mouse click on a button. A click left focus on the button it pressed, and the key handler leaves a focused control its own keys, so every single-key shortcut was dead until you pressed Esc — with nothing on screen to say so.
96
+
97
+ Tab follows the page now — topbar, the accounts column, the canvas, usage, machine — instead of zig-zagging left and right across it, and a canvas card reached by Tab draws the focus ring. A screen reader hears each card by name, with its kind, state, model and cost, rather than every word on it run together; the machine panel has a heading its region is named by; and the theme button is named for the theme it switches to.
98
+
99
+ With **Reduce motion** set, the camera no longer flies across the canvas to a card.`},{title:"💵 The money figures say what they measure",body:"The usage header's **$/min** is spend over a trailing window, and says which span it measured: `$3.54/min · 2 min`. It used to divide the live agents' cost by how long the longest of them had been running, so one deck read $2.39/min in a tab left open and $19.49/min in a tab opened minutes later.\n\nA quota bar's pace says **over pace** or **under pace**. It said `ahead`, which is how plain English says winning, on the very line meant to warn you that you are burning the window faster than it lasts.\n\nA card's clock reads `≥ 53m 52s` for a session this page joined after it had started, instead of presenting the part it saw as the whole of it — and that card's per-minute burn is left out rather than divided by the short clock."},{title:"↔️ Narrow windows keep every topbar control on screen",body:`At 400px six of the topbar's buttons sat past the right edge and the page scrolled sideways. The readouts give way first now and the controls stay; below 640px the side panels span the window instead of leaving the canvas a sliver; and the category filter wraps inside the canvas rather than being clipped by it.
100
+
101
+ Zoomed out, a card's name and a cluster's label stay readable instead of shrinking to about four pixels — which is the view a board of any size actually sits at.`},{title:"🔑 A paired deck's dialog says which account that machine is on",body:`The lane of the account the other machine is working on takes the accent and a slow ring on that machine's end. An account is named only if that deck shares it: on one it does not share, the dialog reads "on another account" and never which. A new switch under **SHARE THESE ACCOUNTS**, on by default, turns the telling off, and paired decks then read "current account hidden".
102
+
103
+ **This deck on the network** prints this deck's own fingerprint again. A pairing request asks you to match it against the one on the other machine's screen, and no screen here was showing it — so the one check a person can make against a rogue deck could not be made, on the step that hands over logins.`},{title:"💬 The deck's messages send you somewhere worth going",body:'An empty canvas no longer ends with "Make sure ccdeck is running" while the page is plainly connected to it. The capture hints under that line, one per CLI, are the real reasons a canvas stays empty, and they stay. With the stream down the screen says whether this page lost a deck that was there or never found one, in those words, rather than naming the `/events` route nobody who typed `npx ccdeck` has seen.\n\nAnd a slow `claude-swap` now reads as a slow answer — "still waiting on the deck server" — instead of "couldn\'t reach the deck server", which sent people off to restart a server that was fine.'}],"3.22.10":[{title:"🖱️ Icon buttons are easier to hit",body:"Icon buttons react when the pointer is near them — no need to hit the icon exactly."},{title:"🧩 Sessions spread across the canvas",body:"Sessions now spread across the canvas in columns instead of one tall column, and new sessions and subagents land in the free space beside them. Nothing is placed under the Machine or Usage panels. Press R once to rearrange a board you already have."}],"3.21.0":[{title:"🖼️ The deck explains itself in pictures",body:"🎬 First run opens an eight-picture tour instead of the changelog — who is waiting on you, the tree, a node's inside, cost and quota, this machine, accounts, local network, how to start. `Take the tour` on an empty canvas brings it back.\n\n📡 **Local network** has a guide: a card while it is off, `How it works` under an empty list, four pictures ending on `Turn it on`. A machine's row opens its own dialog — address, version and system, the logins it offers, and a name of your own for it. Setup ends on Done.\n\n🔄 The deck updates itself when nobody is looking: no tab focused, no agent mid-turn, thirty seconds quiet. The banner's `auto when idle` switch governs it.\n\n🔑 An account whose numbers were paused resumes on its own, and the panel is titled **Claude accounts** — a Codex login is not in it."}],"3.20.0":[{title:"🟢 The deck keeps running after you close the terminal",body:"`ccdeck` prints the same boot report and gives you the prompt back. The deck stays up, and starts again when you log in.\n\n🛑 **`ccdeck --stop` is the off switch now** — Ctrl+C only cancels a start that is still printing. `--status` says what is running, `--logs` shows what the deck wrote while you were away, and `--foreground` holds the terminal the way every version before this one did.\n\n🔁 Typing `ccdeck` beside a deck that is already up opens **that deck's tab** instead of building a second one. `ccdeck --stop --all` clears any older deck still running from before this version. An `npx` run cannot start at login — `npx ccdeck --install` puts it on your PATH and sets that up.\n\n🔑 An account that will not collect now says which of three things is wrong: **no stored login**, a **login that expired**, or a **keychain the deck cannot open** — with the fix beside it. One with no stored login is filled over the local network by a paired deck that has it.\n\n📡 And decks find each other again on a machine with a VPN up: the beacon was going to an address that never left the machine, so this deck could hear colleagues and none of them could hear it."}],"3.19.0":[{title:"🟢 Local network: fixes and improvements",body:`The list of decks is quiet now. A deck that is **on**, with nothing to repair, is a name and a green mark — no sentence under it. Every healthy row used to carry the same words, so the one row worth reading looked like all the others. A failure, a login that arrived, a machine that is away, still say so, and they are now the only rows with anything written on them.
104
+
105
+ \`unpair\` arrives when you point at a row rather than sitting on every one of them, two machines that share a name show their addresses, and the ↻ turns while a round is out.
106
+
107
+ **Add a deck** is two ways in — by address, or with an invite — with \`make one to send\` beside the invite heading instead of under the paste field, where it read as that field's button. A refused address now says which mistake it was, and an invite that will not work says whether it ran out, was not an invite, or reached nothing.
108
+
109
+ Switching **Local network** on opens your name and shared logins, every time, so nothing goes on the network without you having just seen what goes with it.`}],"3.18.3":[{title:"🟢 The list shows what is on, and folds the rest",body:'A machine that is off, or nearby and unpaired, or one you said no to, is context rather than an answer to "who can I use right now" — so the decks that are **on** lead the list and everything else is one line: `2 more`. Nothing worrying is hidden by it: a deck that cannot be reached is counted in that line, in the warning colour, so the fold says whether it is worth opening.\n\nThe round moved to a **↻ beside the switch**, where the accounts header has kept the same act since it was written, and the line under the state now says when it last ran — `checked 2m ago`, or `not checked yet`. A list that refreshes itself and a list that has stopped used to look identical, and pressing the button to find out was the only way to tell.'}],"3.18.1":[{title:"🔁 A deck stops asking to pair over and over",body:"Several decks on one computer share a config directory, so they start with one key. Each read the others' beacons as somebody wearing its name, took a fresh key, and wrote it to the file the others read — a loop that never settles. Every new key is a **new deck** to everyone else on the network, so one machine sent a fresh pairing request every few seconds and accepting one accomplished nothing: the deck that asked no longer existed by the time the answer arrived.\n\nDecks on one computer now recognise each other as the same machine and leave the key alone. The clash still worth healing — a `~/.claude` copied to a second machine — is unchanged.\n\nThis also collapses the rows: a computer that has run the deck a few times appeared several times on everybody else's panel and is one row now. **Both machines need this version** for that to take effect on the other one's screen.\n\nA deck that answered is no longer counted as unreachable, the list refreshes itself in seconds while somebody is deciding rather than at the next minute, and a failed round says what happened — `not listening`, `no route to it` — with the address and the raw error on the hover."}],"3.18.0":[{title:"🟢 A deck that is switched off no longer reads as on",body:"A paired deck this one has no address for was drawn **live** on the strength of being paired — a machine closed an hour ago still sat under `1 deck ready`. Every row now leads with whether that machine is actually there, and when it last was: `online · 1 login arrived`, `no answer · last online 20m ago`, `never reached`. The mark beside the name is a traffic light — green for a deck that answered, amber for one that cannot be reached, grey for one nothing has heard from.\n\n**+ add a deck** opens a dialog now instead of unfolding inside the panel. An address, an invite and the firewall note never fitted a 288px column, and unfolded they turned a list of machines into a form."}],"3.17.0":[{title:"🔔 Pairing is two presses",body:`When another deck asks to pair, the question now arrives **over the deck** rather than in a row three sections down a panel: its name, its address, the fingerprint to compare, **Accept** or **Decline**. Escape means later — the request stays in the panel until you answer it.
110
+
111
+ The rest is one list. Every deck you are paired with, every deck on the network, and every one you turned away, each a row with its state under the name and one verb at the end — and a deck that cannot be reached now reads differently from one that is fine. Saying no also reaches the other machine now, instead of leaving it waiting forever; you can take it back.
112
+
113
+ The dialog behind **setup** is down to the two things it is really about: what this deck is called, and which logins it offers.`}],"3.15.0":[{title:"🔗 Decks on one network heal each other's dead logins",body:`A login dies on the machine that has not used it while the same account keeps working on the machine that has. The fix was a blob copied out of one deck and pasted into another. Now: **Accounts ▸ Local network**, the same passphrase on each deck — it offers you six words — and they find each other and repair themselves.
114
+
115
+ A deck only **adds** an account it does not have, or **replaces one it has proven dead** — proven by Anthropic refusing the token, not guessed. A credential that works is never touched. The passphrase is the only gate; a stranger on the same wifi sees that a deck exists and nothing else.`},{title:"⚠️ What sharing a login actually means",body:`**A login you share is a live one, and it cannot be taken back.** Turning the switch off stops what has not happened yet; a credential that has left your machine is gone, and the only real revocation is signing in again at Anthropic — which ends the session everywhere at once.
116
+
117
+ Sharing a Claude account may also be against Anthropic's terms. Your call; the deck says it once and does not nag.`}],"3.14.0":[{title:"📊 The machine comes back beside the list that covers it",body:`**Busiest processes** opens over the machine panel and hides the very readings that sent you looking. They are back beside the list — cores, memory, swap, queued work, temperature — with up to an hour behind each: a column down the side on a wide screen, a band under the table on a narrow one.
118
+
119
+ Each is drawn against the line it is measured to — memory and swap at 90%, load at your core count, the GPU at 75° and again at 90° — so swap sitting *on* its line is something you see rather than work out. The processor readings get no line on purpose: a CPU at 90% is your machine doing what you asked for. Throttling appears only once your machine has actually been held back, and the band says how much history it really has rather than claiming an hour it has not had.`},{title:"📋 The process dialog's footnote moved onto the columns it was about",body:"A band ran along the bottom of **Busiest processes** saying three things. Two were worth keeping and are now on the header of the column they describe — hover `memory` to read what that number measures, `process` to read that the command-line redaction is a filter rather than a promise.\n\nThe third said the list is the busiest by processor and memory, refreshed every four seconds. The heading, the count beside it and the moving numbers were already saying that."},{title:"📝 These notes render what they were written in",body:`Every note in this dialog is written in Markdown — **bold** for the sentence that carries the change, backticks for a flag or a path — and the dialog printed the string raw. So the first window you see after an upgrade has been showing you \`**this**\`, backticks and all, since the feature shipped: 25 of 52 notes, 52 bold spans, 54 code spans.
120
+
121
+ What you are reading is the first version that does not.
122
+
123
+ No Markdown library came along for it. Counted in the file: bold 52, code 54, links 0, headings 0, lists 0 — and the smallest library that reads all of Markdown is 40KB on a bundle the deck fetches while you wait for it to start.`},{title:"⎋ Esc leaves the machine panel where it is",body:"The × on **This machine** read `Close (Esc)`, so Escape put the panel away. Escape belongs to the canvas — it deselects and hands the keyboard back — and pressing it while you are reading your instruments should not close them.\n\nThe panel now closes the two ways it opens: its ×, and the meter in the topbar. The × says `Close`, and names no key it does not answer."},{title:"🖥 The machine moved out of the topbar and into a button",body:"The small CPU sparkline and memory bar in the topbar are gone. A chip glyph in the icon row beside `$` and the accounts silhouette opens the same **This machine** panel — cores, memory, swap, load, temperature, busiest processes — and the bar stops moving in the corner of your eye.\n\nIt also stops asking. The deck read your machine every three seconds for the life of every tab to feed that meter; it now reads only while the panel is open, and the history behind the readings is kept by the deck itself, so a panel opened an hour from now still has the hour behind it."},{title:"🔎 The panel's eight process rows became one way in",body:"The machine panel drew eight processes in a 280px box: three columns, names cut off mid-word, and a `ps` run every four seconds to keep them moving. **Busiest processes** is a single row you press now, and the dialog behind it is what it always was — every candidate the deck sees, its memory in bytes, threads, user, pid, and the command line that tells you which `node` this one is.\n\nWith that dialog closed, the deck reads no process list at all."},{title:"⏱ The restart banner says whether the press is safe, and shows the fuse",body:"The button read `Restart now` whether the machine was idle or five agents were mid-turn — and the events fired while the server is down are lost for good. It reads **`Restart anyway`** now when something is running, with the count beside it, and `Restart now` with *nothing is running* when the machine is quiet.\n\nThe automatic restart said only `auto when idle`, while a 30-second clock ran where nobody could see it. It counts — **`auto in 18s`** — which is also how you stop it, since the switch is the label. The amber dot pulses only while that clock runs.\n\nThe switch also says `auto-restart off` in words rather than in a colour, both its label and the button are readable in the light theme now, and a tab you are not looking at no longer restarts the deck under the tab you are."}],"3.13.0":[{title:"📊 Usage history stops jumping out from under you",body:`Pressing **H** put \`running ccusage…\` in a box 186px tall. Two to four seconds later the chart, the totals and the legend arrived and the box became 429px — and because the dialog is centred, that growth moved the whole thing **121px upward**, under the cursor that had just pressed something.
124
+
125
+ The chart's place is now reserved from the first frame: the 168px the chart is tall plus the 16px it keeps for its day labels, both taken from the chart's own rule so the placeholder and the thing it holds room for cannot drift apart. The jump goes from 243px to 156px. It deliberately stops there — the totals and the legend are content, the legend's height depends on how many models ran, and reserving those would have meant drawing four plausible empty cards for a reading that had not arrived.
126
+
127
+ What is drawn in the reserved space is **the chart's baseline and nothing else**: one line, in the same colour, at the height the columns will land on. Not a skeleton of grey bars — a skeleton stands in for content, an axis is furniture, and furniture is honest before the data exists. The light on it travels rather than fills, because the deck knows a subprocess is running and does not know how far through your transcripts it has got.
128
+
129
+ Then the days rise out of that line, **oldest first**. The stagger is divided rather than fixed — 200ms of spread whether the range is 7 days or 90 — so the longest range is not also the slowest to appear.
130
+
131
+ With reduced motion both loops and both entrances are off. The reserved space is layout, not animation, and stays outside that rule: asking for less movement gets you the same dialog that does not jump.`},{title:"⏳ The period mark says it is being read",body:"The first read of **today**, **month** or **all** takes two to three seconds — it walks the transcripts on this machine, and the cost is the walk, not the size of the range you asked for. Until now the panel said nothing for the whole of it, so pressing `month` looked like pressing nothing, and the honest response was to press it again.\n\nThe mark under the period now pulses while that read is in flight, and it **pulses rather than fills**: nothing measures how far through the transcripts ccusage has got, so a bar that filled would be inventing a number. Hovering the pending period says which one is being read, and screen readers are told the same thing through a live region rather than being left with a silent button."}],"3.12.0":[{title:"🔍 Busiest processes tells you which one",body:"The list could say what was eating the machine and not **which** of nine identical `Google Chrome Helper` rows was the headless Chrome you left running. It now shows the arguments after the name — `--type=renderer` beside one, `serve admin-portal --port 44440` beside a node — and four columns it did not have: **memory in MB and GB** instead of a percentage, **threads**, **how long it has been up**, and **user**. Every column sorts; press its heading.\n\n**Command lines have anything secret-shaped removed before they leave your machine** — the value of any flag whose name says token, password, key or secret, the password in a URL, and the shapes that identify themselves. It is a filter and not a guarantee: a secret that looks like an ordinary word looks like an ordinary word. The reading happens only while this modal is open, so a deck whose process list you never open never reads a command line at all.\n\n**Memory is resident set size** — what `ps` and Windows Task Manager report. On macOS this is *not* the number Activity Monitor shows in its Memory column; that one is the physical footprint, and on the machine this was built on the two disagree by up to fourteen times on the same process. No unprivileged command reports the footprint quickly, so the deck shows the figure that means the same thing on all three platforms and says which one it is.\n\n**There is no Ports column**, and the reason is the same kind of honesty: Mach ports do not exist on Linux, are not what Windows calls a handle, and on macOS the only way to count them takes four seconds — against a list that refreshes every four."},{title:"🔢 A token count that stays a whole number",body:"Switching the Usage panel from **month** to **today** counted down smoothly and then, for a fraction of a second, showed something like `in 594.3268260610639` where a token count belongs.\n\nThe count was never wrong; the printing was. The figures animate between two readings, so the formatter is handed a fraction on most of its frames — every size above a thousand was already rounded and the one below it was not."}],"3.11.0":[{title:"🗂 The session list waits to be asked for",body:`**BY SESSION in the Usage panel now starts collapsed.** It is the one block in that panel with no ceiling — every other section is two or three rows, or a model table bounded by the models that exist — and it was the reason the panel scrolled at all. Shut, the whole panel is one screen: quota, period, money, models. Press the heading to open it, and it stays open; ccdeck remembers your answer from then on.
132
+
133
+ The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
134
+
135
+ **Scrollbars are also gone until you point at the thing that scrolls.** Nothing moves when they appear — the track keeps its width in both states, so no text shifts under the pointer as it arrives.`},{title:"📊 today · month · all, as tabs that remember",body:"**The Usage panel's period switcher is a full-width row of tabs** rather than a pill floating over the column, with a thin cyan mark under the word it belongs to. It governs the figures beneath it, so it now looks like it does.\n\n**Your chosen period survives a reload.** It was the one preference in that panel that did not.\n\n**It costs one Tab stop instead of three.** Tab into the strip, then move with ←/→ or Home/End, and press Enter to choose. Arrowing past a period no longer starts reading it — moving and choosing are separate now, which matters on `all`.\n\nAnd **`month` says which month.** Hover it: this is the calendar month, from the 1st — not the last 30 days. `today` and `all` say what they cover too."},{title:"🔔 Sounds and Notifications are two switches, and Browser notifications is a channel",body:`**The sound menu has been rebuilt.** Sounds and Notifications are real switches now instead of words that read like status. Under them, **Browser notifications** is named as what it is — one of the two ways ccdeck can reach you — rather than sitting there as a third setting that seemed to contradict the one above it.
136
+
137
+ There are two notifiers and they never both fire: the page raises one when the deck is open but hidden, and the server raises one when no page is open at all. Only the first needs a browser permission, which is why the permission belongs to a channel and not to the feature. **Turning Notifications on now asks the browser on that same press** — no second control to hunt for.
138
+
139
+ \`M\` mutes and unmutes sounds from anywhere. **Hear it** plays the tone even when Sounds is off, so you can pick one before turning them back on.`},{title:"🧹 No agent, no empty panel",body:`**The detail panel no longer appears when nothing is selected.** It used to sit there empty, and a tab on the edge of the canvas existed to bring it back after you closed it — both are gone. Select an agent and the panel is there; press **D** to toggle it yourself.
140
+
141
+ The canvas is that much wider whenever you are not reading one agent.`}],"3.10.0":[{title:"🔌 Who else can drive your browser, and where to see it",body:"**Browser Watch has a Remote control section.** The Claude in Chrome extension holds a connection open to Anthropic's relay, and that connection is registered against your **account**, not against this machine — so any Claude Code session signed in to the same account, running anywhere, can enumerate and drive this browser, and nothing prompts you on the machine being driven.\n\nThe panel now says whether that is the case here, and what the extension is actually allowed to do in each profile — enabled or switched off, every site or only the ones it was granted, and which of the powerful APIs it holds. That last part is not what `chrome://extensions` shows you: the per-site list there is enforced by the extension, on itself, while the grant underneath stays exactly as wide as it was.\n\nIf you want it closed, the section hands you the one command that closes it — as text, to paste in your own terminal. **ccdeck never runs it and never asks for your password**, and it never will: no part of this deck elevates, and a dashboard that could raise a password box on request would be a gift to anything else running on the machine. If the block is already in place, the section offers the command that takes it back out. And if something else in your hosts file already points that name somewhere, it says so and leaves the line alone — ccdeck only removes the line ccdeck wrote.\n\nAll of this is two file reads and no network call. It was written some releases ago and, until now, was not connected to any screen.\n\n**Also:** the README said `share` produces a `ccdeck1:` blob. It produces `ccdeck2:` — `ccdeck1:` has been read-only legacy for a while."}],"3.9.0":[{title:"🎛️ Five switches that were not where the thing they control is",body:'**The session list has a button again.** It lost one a while back and only the `L` key was left — and `L` is written down in one place, a shortcuts sheet behind a small `?` in the corner of the canvas. If you use a mouse there was no way to open the list at all. The `☰` is back at the left of the top bar.\n\n**The Notifications switch now tells you whether the browser will actually show one.** It said `on` while this browser had never been asked for permission, which is not the same thing. It now says so on that row and offers the ask right there. Before, the only place to grant it was a button that appears solely while a session is stuck waiting — so on a machine where that rarely happens you could not switch notifications on at all.\n\n**Started with `--workspace` or `--scope` and seeing nothing?** The empty screen used to tell everyone to "run `claude` or `codex` in any folder", which is the one thing that cannot work for you. It now names the folder the deck is actually watching.\n\n**Browser Watch says when a setting did not save.** Flipping the switch and having it fail showed a red line reading "Could not read" — about reading history, not about your press — and ten seconds later the panel wiped it and looked perfectly healthy with the setting unchanged. A failed save now says so, in its own words, and stays until you dismiss it. The "nobody browsing for" menu also follows the stored value again: change it in a second tab and this one never caught up.\n\n**The deck no longer restarts itself when nothing on screen offers to stop it.** Thirty seconds after the last agent went quiet, with a new version on disk, the server would exit, come back and reload the page. The `auto when idle` switch that controls that lives inside the update banner — so if you had closed the banner with its `×`, it happened with no visible setting anywhere. Closing the banner now also stands down the restart; clicking the version chip brings back both together.'}],"3.8.9":[{title:"🖥️ Four things that only went wrong on somebody else's operating system",body:"**Ubuntu:** the deck knew where Chromium and Brave keep their profiles when installed as a snap or a flatpak — which on a default Ubuntu is the only place Chromium is — but not what those programs are called. So it reported them as not running while they were, and refused to quit them. Both now work.\n\n**Windows:** the deck asked the system whether it could write to the folder an update installs into, and Windows always answers yes for a folder whatever the permissions say. It offered you an update that then died inside npm with a permission error. It now finds out by trying, and declines up front with the command to run yourself — which is what every other platform already got.\n\n**Linux:** if `XDG_DATA_HOME` was set to something starting with `~`, as it is from a systemd unit or a Dockerfile, the deck and claude-swap looked in two different places for your accounts. The panel said you had none while `cswap list` showed them all.\n\n**Plain terminals:** six messages used a typographic dash the old Windows console and the Linux text console cannot draw, so a box appeared mid-sentence — including in the line that explains why no events are arriving. They use the plain form on those terminals now, like everything else already did."}],"3.8.8":[{title:"📉 A false 99% on the memory chart, and three other quiet failures",body:`**The machine meter no longer invents a reading.** When the deck could not measure memory — a subprocess that would not start under load, or one that took too long — it substituted a number that means something else, and on a Mac that reads as about 99% used. The meter went red for half a minute, and because the chart keeps the highest value in each minute, that false peak stayed on it for a full day. A poll that cannot measure now keeps the last reading and records nothing: a gap in the chart is honest.
142
+
143
+ **A failed ccusage repair no longer disables the repair.** If the deck found a half-installed copy it removes it and starts again. On Windows that removal can fail for a few seconds because the program it just ran still has the folder open — and the deck then treated the attempt as spent and never tried again for the rest of the session, leaving the panel permanently unable to read your usage. It now only counts a repair that happened.
144
+
145
+ **Changing the auto-switch interval takes effect even during startup.** Set it in the first seconds after launch and the timer kept the old value for the life of the process, while the panel showed the new one.
146
+
147
+ **Codex sessions with very large histories no longer cost hundreds of megabytes to read.** The deck read the whole file to find four values that live at its two ends — measured at 185 MB of memory and 95ms of frozen interface for one 44 MB session. It now reads only the ends.`}],"3.8.7":[{title:"🧠 Four things in the panel that behaved wrongly",body:`**Today's figure no longer overshoots.** Once a minute, when a fresh reading landed, the headline briefly counted past the true number and back down — it was measuring the last minute of spend from a starting point one moment out of date. The reading and its starting point are now recorded together, so there is no moment where they can disagree.
148
+
149
+ **Browser Watch marks findings read when you close it, not when you open it.** It was clearing the badge immediately, and stamping every new finding as read the moment it arrived — so anything that turned up while you were reading was never badged at all. It was also writing to storage four times a second the whole time the panel was open.
150
+
151
+ **A hidden tool category can always be brought back.** Hide one, leave the deck running, and once the canvas had turned over the row of chips disappeared while the filter stayed on — no bubbles, and nothing to press. Only reloading fixed it. The chips now stay for as long as anything is hidden.
152
+
153
+ **Clicking a session's name no longer switches auto-fit off.** The deck was reading its own camera move as you grabbing the canvas, and remembered it across restarts, with nothing said.`}],"3.8.6":[{title:"🗂️ Two decks can no longer both claim the same log",body:"When several decks share one events log they elect a single writer for it, so nothing is recorded twice. That election compared the path as typed — so two decks reaching the SAME file by different spellings each thought they were alone, both wrote every event, and each believed the log was theirs to clear.\n\nDifferent spellings are ordinary, not exotic: a shortened Windows home directory, a mapped or substituted drive, a junction, or on macOS `/tmp` against `/private/tmp`. The visible symptoms were duplicated tool calls after a restart, and Clear wiping history belonging to another deck.\n\nThe path is now canonicalised the same way the watched folder already was. It works on a first run too, before the log file exists."}],"3.8.5":[{title:"⛔ Cancelling a sign-in no longer adds the account anyway",body:`Press Escape while adding a Claude account and the deck killed the sign-in — and then, sometimes, registered the account regardless, switched to it, and told you it had worked.
154
+
155
+ The deck asks the tools it runs whether they finished cleanly. A program that is well behaved about being cancelled tidies up and exits with a success code, and the deck was reading that as "it finished" rather than "I stopped it". \`claude auth login\` is exactly that kind of program.
156
+
157
+ A cancelled run now reports as cancelled. Everything that was not cancelled is unaffected.`}],"3.8.4":[{title:"🧷 Your own hooks can no longer be eaten by two decks starting together",body:'If you keep hooks of your own in `settings.json`, the deck parks them while it installs and puts them back afterwards. Two decks starting at the same moment could interleave inside that, and the loser wrote a version of the file computed before the restore — so your hook was gone from `settings.json` and gone from the park, which was its only other copy.\n\nThere was already a check for this, and it had a hole: if the last-moment re-read of the file failed, it read that as "nothing changed" and wrote anyway. A failed read is the one moment that check was most needed, because the usual reason a file cannot be read for a few milliseconds is that something else has just written it.\n\n`ccdeck --uninstall` had no such check at all and could overwrite a deck that was starting, then exit 0 saying it had succeeded. It has one now, and when it declines it says so and tells you to run it again rather than reporting that there was nothing to remove.'}],"3.8.3":[{title:"🪟 Windows: two settings files that could refuse to save",body:`On Windows a file cannot be moved into place while anything else has it open, and Defender and the search indexer open a file the instant it is written. The deck has had a retry for that for a long time, and two files written in the last few days were not using it: the notifications preference, and Browser Watch's episode archive.
158
+
159
+ When it bit, the notifications switch silently did not stick, and Browser Watch answered an error and showed an empty panel. Both now retry the way everything else in the deck already did.
160
+
161
+ Nothing changes on macOS or Linux, where the operating system never refused the move in the first place — which is why this got past a green test suite on both.`}],"3.8.2":[{title:"⌨️ A closed-behind-your-back dialog no longer kills every keyboard shortcut",body:`Open the context ring on a session's card and leave it open. The session finishes, and a couple of minutes later the canvas evicts it — or you press Clear. The dialog vanished, and from that moment every shortcut in the deck stopped working: Space, C, R, F, L, H, U, A, J, K, T, M, and the trash button too. Only reloading the page brought them back.
162
+
163
+ The deck was still counting the dialog as open, because it remembered which session you had opened it for rather than whether anything was on screen. It now closes the dialog when its session leaves the board, which is what should have happened in the first place. The end-of-session recap had the same problem and is fixed with it.`}],"3.8.1":[{title:"🔒 Security: update if the deck runs on a Mac",body:"A local process able to reach the deck's port — no token, no browser, no tab — could get a string of its choosing compiled as AppleScript when the deck raised a desktop notification with no page open. On macOS that is code running as you.\n\nThe strings were already passed as arguments rather than pasted into the script, which is normally the whole defence. It is not enough for `osascript`: its option parser reads any argument starting with a dash as an option, so a name beginning with `-e` was taken as more script instead of as text. Every place the deck hands `osascript` or `notify-send` something from outside now carries an explicit end-of-options marker, so nothing from outside can be read as an instruction again.\n\nNothing to change on your side beyond updating. If you would rather keep the deck off the desktop entirely, the Notifications switch in the sound menu does that, and `AGENTS_DECK_NO_NOTIFY=1` does it at launch — but the fix is the thing to have."}],"3.8.0":[{title:"🔕 Notifications now have an off switch",body:`3.7.0 gave you a "notify me" button and no way back. Turning them off meant digging into your browser's site settings — which no page can do for you — and that still left the other notifier, the one the deck raises when no page is open at all. Silencing that one meant quitting the deck and starting it again with \`AGENTS_DECK_NO_NOTIFY=1\` in front. The person who wanted quiet was the one doing the work.
164
+
165
+ There is a **Notifications** switch in the sound menu now, beside the one for sound — that menu is already "how loudly does this deck interrupt me". One switch governs both notifiers, it takes effect immediately without a restart, and it is remembered across restarts.
166
+
167
+ It is kept by the deck rather than by your browser, because the second notifier runs when no page exists and a setting living in a page could never reach it. \`AGENTS_DECK_NO_NOTIFY=1\` still wins over the switch — a machine told at launch to stay off the desktop stays off it — and when that is the case the menu says so instead of showing an "on" that will not happen.`}],"3.7.1":[{title:"🔔 The notifications now fire on the thing that actually stops your agent",body:`3.7.0 could tell you a session was waiting — but only when Claude Code asked permission to run a tool. If you work with permissions bypassed, that never happens, and the whole feature was silent for you. Measured on one real log: 1683 events, every one of them in bypassPermissions, and a single permission prompt in the entire history.
168
+
169
+ What fires constantly on that setup is the other kind: the agent asking you a question and stopping for the answer. The deck was throwing those away — no amber chip, no row in the sidebar, no notification, and no "notify me" button, because the button only appears while something is actually blocked.
170
+
171
+ Now they count. The card carries the question itself rather than a generic "Your turn" — "paycore needs your input: merge both branches to main, or just one?" — and so does the notification, on the desktop, whether the tab is behind something or not open at all.
172
+
173
+ An idle prompt still stays quiet: a turn that ended is not a session that is stuck, and a channel that cries wolf is one you switch off.`}],"3.7.0":[{title:"🔔 The deck can reach you when you are not looking at it",body:`The deck's whole point is telling you which agent is waiting on you, and until now it could only say so on screen — the amber chip, the tab title, the favicon. Every one of those is drawn inside a page, so the one moment it matters, when you have walked away and four agents have gone quiet, the deck was silent.
174
+
175
+ Now it reaches the desktop, two ways that never overlap. With the deck open behind something, the page raises the notification itself: a "notify me" button appears in the top bar the first time a session blocks, and the browser asks you — nothing is requested before there is something to notify you about. With no page open at all, the server raises it, because it can see that nobody is connected and therefore that no other surface is saying anything.
176
+
177
+ One notification per session, replaced rather than stacked if a second deck raises it too. Clicking it brings the tab forward. \`AGENTS_DECK_NO_NOTIFY=1\` turns the desktop side off entirely, and if you refuse the browser prompt the deck says so plainly instead of leaving you thinking you switched something on — after a refusal only your browser's site settings can undo it, which no page is allowed to touch.`},{title:"🧩 A blocked session now says what it is asking for",body:'"Waiting on you" told you to go and look. The session row and the card now carry the tool the prompt is most likely about, and the tooltip carries the one line of its input that a person actually reads — `rm -rf node_modules` rather than `{"command":"rm -rf node_modules"}`.\n\nIt is a guess and it is worded as one: the deck sees the tool calls, not the permission dialog, so it says "likely on". The deck still cannot allow, deny or answer anything for your agent, and it never will.'},{title:"🧮 Today's figure was counting some sessions twice",body:`The panel reads your usage from ccusage once a minute and fills the gap in between from what the deck is watching. The filling-in was wrong: any session that reached the canvas after the reading had landed was added in full, and since the canvas is still loading when the first reading arrives, that was most of them.
178
+
179
+ Measured on a deck four seconds old: ccusage said $450 for today and the panel said $1,006. The table underneath it said $450 the whole time, which is the disagreement to trust.
180
+
181
+ The deck now adds only work it has actually watched happen. A session that starts while you are looking shows up at the next reading instead of instantly — up to a minute — which is how the panel behaved before the live figure existed at all. Everything already on screen keeps moving as it did.`}],"3.6.0":[{title:"✂️ The two figures at the end of the top bar are gone",body:`The bar used to end with a token count and a dollar figure. Both were sums over what is on the canvas at that moment, and the canvas drops finished sessions a couple of minutes after they end — so both numbers fell on their own, with nothing on screen to explain the fall. They carried the word "board" and a three-line tooltip for exactly that reason.
182
+
183
+ The usage panel answers the same question without the apology: it reads the logs on disk, it covers sessions this deck never watched, and it does not forget. Press U for the panel, or H for the full history.
184
+
185
+ What is left in the bar is what is true right now — whether the stream is alive, and what your machine is doing.`}],"3.5.0":[{title:"⚡ The figures move when the work happens",body:`Reading your usage off the logs is not free — measured here, one reading is 7.8 seconds of CPU, because ccusage walks every transcript on the machine whatever period you asked for. Once a minute is affordable; once every ten seconds would be three quarters of a core, permanently, for numbers that move slowly.
186
+
187
+ 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.
188
+
189
+ 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.
190
+
191
+ 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.
192
+
193
+ 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.
194
+
195
+ 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.
196
+
197
+ 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.
198
+
199
+ 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.
200
+
201
+ 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.
202
+
203
+ 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.
204
+
205
+ 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.
206
+
207
+ 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.
208
+
209
+ 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.
210
+
211
+ 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.
212
+
213
+ 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.
214
+
215
+ 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.
216
+
217
+ 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.
218
+
219
+ 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.
220
+
221
+ 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.
222
+
223
+ 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.
224
+
225
+ 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.
226
+
227
+ 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.
228
+
229
+ 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.
230
+
231
+ 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.
232
+
233
+ 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".
234
+
235
+ 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.
236
+
237
+ 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.
238
+
239
+ 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.
240
+
241
+ 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.
242
+
243
+ 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.
244
+
245
+ 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.
246
+
247
+ 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.
248
+
249
+ 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.
250
+
251
+ 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.
252
+
253
+ 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.
254
+
255
+ 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.
256
+
257
+ 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.
258
+
259
+ 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.
260
+
261
+ 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.
262
+
263
+ 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.
264
+
265
+ 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.
266
+
267
+ 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.
268
+
269
+ Click the version at the top of the deck to read it again whenever you like.`}],"1.45.0":[{title:"🔕 The deck no longer puts anything in your settings.json",body:"It used to add a hook there so Claude Code would play a sound when a turn ended. That entry is removed the first time you start this version, and any sound hook you wrote yourself is put back exactly where you had it. Nothing else in that file is touched. The deck makes the sound itself now — which is also why you finally hear one when a Codex turn ends, not just a Claude one."}],"3.16.0":[{title:"🤝 Pair two decks with one piece of text",body:`**Accounts ▸ Local network ▸ setup… ▸ make an invite.** Send the text however you already talk to them; they paste it and the two decks are paired. Nobody presses accept, and neither of you has to know which of your addresses the other can reach — the invite carries them all and their deck tries each one.
270
+
271
+ Decks on the same router still find each other on their own and appear under **on this network right now**. An invite is for the case that does not work: another subnet, a VPN, a firewall.
272
+
273
+ The invite lasts 10 minutes and is used once. Anyone who gets hold of the text can pair with your deck until it runs out, so send it the way you would send anything else you would not want forwarded.`},{title:"⚠️ Both machines have to be on this version",body:`The two decks no longer speak the old protocol, and there is no fallback: a 3.15 deck and a 3.16 deck cannot see each other at all. Update both.
274
+
275
+ The group passphrase is gone. If you had one set, that pairing is not carried over — make an invite and pair again. It was replaced because a passphrase that differs by one character produced a closed socket and no other symptom on either machine, and a secret is the one thing a panel must never print, so neither person could check theirs against the other's.`}],"3.22.1":[{title:"🖥️ A first run now opens This machine too",body:`Accounts and usage already opened themselves the first time you ran the deck; the machine panel did not, and now does. It is the panel that answers "is this box coping" — cores, memory, load, temperature — and somebody meeting the deck for the first time cannot ask for a panel they do not know is there.
276
+
277
+ It only does this when you have never said otherwise. Close it once and it stays closed, on that browser, for good — the same rule the other two panels have always followed. Nothing reopens it behind you.
278
+
279
+ While it is open it polls this machine once every few seconds, and it stops the moment you close it or switch tabs.`}],"3.22.4":[{title:"📈 A card stops looking idle while it is thinking",body:`The activity chart on each card counted tool calls and nothing else, so the time an agent spends reading, reasoning and writing drew as a flat line — measured on this machine, 16.5% of all working time, more than the time spent inside the tools themselves. A session that was busy looked exactly like one that had died, and the only way to tell them apart was to wait and see whether anything ever appeared.
280
+
281
+ It marks that work now. A chart with bars in it means the agent is doing something, whether or not it has called a tool in the last minute; a flat chart means it genuinely is not. Hover it for the split — how many tool calls and how many blocks of thinking and writing landed in the last 60 seconds.
282
+
283
+ Nothing was added to the card and nothing new is polled. The deck already reads each session's transcript for its token counts; this reads the same file for what the model has finished writing, and a session that is quiet costs one file check per second and a half.`}]},p0="agent-dag.releaseNotesSeen";function Q_(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Fi(e,t){const n=Q_(e),r=Q_(t);for(let a=0;a<Math.max(n.length,r.length);a++){const i=(n[a]??0)-(r[a]??0);if(i!==0)return i<0?-1:1}return 0}function Bi(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function Uz(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 Wz(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,r]of Object.entries(e)){if(!Bi(n)||!Array.isArray(r))continue;const a=r.filter(Uz);a.length&&t.push({version:n,notes:a})}return t.sort((n,r)=>Fi(r.version,n.version))}const J_=Wz(zz);function vR(e,t,n){return e.filter(r=>Fi(r.version,n)<=0&&(t===null||Fi(r.version,t)>0))}function Hz(e,t){return e.filter(n=>Fi(n.version,t)===0)}function Gz(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 Vz({since:e,running:t,entries:n,firstRun:r}){if(!n.length)return"Nothing in this build has anything to report yet. Most releases do not, which is the point.";if(e!==null){const c=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${c} changed something you would notice. Clicking the version in the topbar brings this back.`}if(r&&Bi(t))return`The deck has not run in this browser before, so this is what v${t} — the release you have — changed. Earlier releases are not repeated here; clicking the version in the topbar brings all of them back.`;const a=n[0].version;if(!Bi(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const i=Fi(a,t);return i<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:i>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const Kz=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function Yz(e){const t=Kz.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function eN(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function Xz(e){if(!e)return null;let t=null;try{t=e.getItem(p0)}catch{return null}return Bi(t)?t:null}function Zz(e){if(!e)return!1;try{return e.getItem(p0),!0}catch{return!1}}function Qz(e,t){if(!e)return!1;try{return e.setItem(p0,t),!0}catch{return!1}}const xR="agent-dag.tourSeen";function Jz(e){if(!e)return!1;try{return e.getItem(xR)==="1"}catch{return!1}}function eU(e){if(!e)return!1;try{return e.setItem(xR,"1"),!0}catch{return!1}}function tU({tourSeen:e,decision:t}){if(t.reason==="no-version"||t.reason==="cannot-remember")return{tour:!1,notes:"none"};if(t.reason==="welcome"||t.reason==="first-run")return{tour:!e,notes:"none"};const n=t.show.length>0;return e?{tour:!1,notes:n?"now":"none"}:{tour:!0,notes:n?"after":"none"}}function nU({stored:e,running:t,notes:n,remembers:r=!0}){if(!Bi(t))return{show:[],record:null,reason:"no-version"};if(!Bi(e)){if(!r)return{show:[],record:t,reason:"cannot-remember"};const c=Hz(n,t);return c.length?{show:c,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=Fi(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const i=vR(n,e,t);return i.length?{show:i,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function rU(e,t){if(/\s|^$/.test(e[t+2]??""))return-1;let n=t+2;for(;n<e.length;){if(e[n]==="`"){const r=e.indexOf("`",n+1);if(r<0)break;n=r+1;continue}if(e.startsWith("**",n)&&!/\s/.test(e[n-1]??" "))return n;n++}return-1}function bR(e,t=!0){const n=[];let r="";const a=()=>{r&&(n.push({kind:"text",text:r}),r="")};let i=0;for(;i<e.length;){if(e[i]==="`"){const c=e.indexOf("`",i+1);if(c>i+1){a(),n.push({kind:"code",text:e.slice(i+1,c)}),i=c+1;continue}}else if(t&&e.startsWith("**",i)){const c=rU(e,i);if(c>0){a(),n.push({kind:"bold",kids:bR(e.slice(i+2,c),!1)}),i=c+2;continue}}r+=e[i],i+=1}return a(),n}function sU({entries:e,since:t,running:n,firstRun:r,onClose:a,onTour:i}){const c=fn(a),u=Gz(e);return l.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:l.jsxs("div",{ref:c,className:"modal release-notes",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),u&&l.jsx("span",{className:"modal-tool-id",children:u})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsx("p",{className:"modal-note",children:Vz({since:t,running:n,firstRun:r,entries:e})}),i&&l.jsxs("div",{className:"guide-door",children:[l.jsx("span",{children:"Eight pictures of what the deck shows."}),l.jsx("button",{type:"button",className:"btn",onClick:i,children:"Take the tour"})]}),e.map(f=>l.jsxs("section",{className:"modal-section",children:[l.jsxs("h3",{className:"rn-version",children:["v",f.version]}),l.jsx("ul",{className:"rn-notes",children:f.notes.map((p,h)=>{const{icon:m,rest:y}=Yz(p.title);return l.jsxs("li",{className:"rn-note",children:[l.jsxs("p",{className:"rn-note-title",children:[m&&l.jsx("span",{className:"rn-note-icon",children:m}),y]}),l.jsx("p",{className:"rn-note-body",children:kR(bR(p.body))})]},h)})})]},f.version))]})]})})}function kR(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?l.jsx("code",{className:"rn-code",children:t.text},n):l.jsx("strong",{className:"rn-strong",children:kR(t.kids)},n))}function aU(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function oU(e,t,n){var c;if(e.length===0)return null;const r=aU(e),a=t?r.findIndex(u=>u.id===t):-1,i=a===-1?n===1?0:r.length-1:(a+n+r.length)%r.length;return((c=r[i])==null?void 0:c.id)??null}const iU=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function lU(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:iU.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const cU=new Set(["","BODY","HTML","#DOCUMENT"]);function uU(e){return!e||n0(e)?!1:!cU.has(String(e.tagName??"").toUpperCase())}function fd(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function dU(e,t){let n=!1;for(const a of e)if(!t.has(a)){n=!0;break}if(!n)return e;const r=new Set;for(const a of e)t.has(a)&&r.add(a);return r}function hU(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`),n.kind==="root"&&t.add(r0(n.id));return t}function fU(e){const t=new Set;for(const n of e)t.add(n.id),n.kind==="root"&&t.add(r0(n.id));return t}function pU(e,t){if(!t||!e.agents.get(t))return null;const r=new Set([t]);let a=t;for(;a;){const c=e.agents.get(a);if(!(c!=null&&c.parentId)||r.has(c.parentId))break;r.add(c.parentId),a=c.parentId}let i=!0;for(;i;){i=!1;for(const c of e.agents.values())c.parentId&&r.has(c.parentId)&&!r.has(c.id)&&(r.add(c.id),i=!0)}return r}function mU(e,t){const n=new Set;for(const r of t){const a=pU(e,r);if(a)for(const i of a)n.add(i)}return n.size>0?n:null}function Td(e,t,n){return!t.has(e)||n.has(e)}function gU(e,t,n,r){return!t.has(e)&&Td(e,n,r)}function yU(e,t,n){const r={x:0,y:0};return t.set(e,r),n.add(e),r}function tN(e,t,n,r){n.set(e,t),r.delete(e)}const wU=40,vU=120;function xU(e,t){let n=null,r=0,a=Number.NEGATIVE_INFINITY;const i=()=>{n=null,a=t.now(),e()},c=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(f,p,h)=>{if(n!=null){if(r<=f)return;c()}const m=Math.min(h,Math.max(0,f-p));r=f,n=t.setTimeout(i,m)};return{live(f=wU){const p=t.now(),h=Math.max(a+f,p);if(h<=p){c(),i();return}u(h,p,f)},replay(f=vU){c(),r=t.now()+f,n=t.setTimeout(i,f)},flush(){c(),i()},cancel(){c()}}}const bU=1e3;function kU(e={}){const t=Math.max(1,Math.floor(e.limit??bU)),n=e.protect;let r=!1,a=[],i=new Set,c=0,u=0,f=null;return{get paused(){return r},get size(){return a.length},get dropped(){return c},get overflowed(){return c>0},get through(){return u},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,m=(p==null?void 0:p.epoch)??null,y=m!==null&&m!==f;y&&(f=m,u=0);const w=h!==null&&!y&&h<=u;if(h!==null&&h>u&&(u=h),!r)return!0;if(w)return!1;if(a.push(p),n!=null&&n(p)&&i.add(p),a.length>t){let N=0;if(i.size<a.length)for(;i.has(a[N]);)N++;const[_]=a.splice(N,1);i.delete(_),c++}return!1},setPaused(p){if(r=p,p)return[];const h=a;return a=[],i=new Set,c=0,h}}}const _R="agent-dag.theme";function _U(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function NU(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function SU(){return _U(bo(_R),NU())}const jU=6,EU="ccdeck-tabs";function CU(e){return e>=jU}function TU(e,t,n){const r=a=>{const i=a.data;(i==null?void 0:i.kind)==="who"&&i.from!==t&&e.postMessage({kind:"here",from:t,to:i.from,streaming:n()})};return e.addEventListener("message",r),{ask(a,i=(c,u)=>setTimeout(c,u)){return new Promise(c=>{const u=new Set,f=p=>{const h=p.data;(h==null?void 0:h.kind)==="here"&&h.to===t&&h.streaming&&u.add(h.from)};e.addEventListener("message",f),e.postMessage({kind:"who",from:t}),i(()=>{e.removeEventListener("message",f),c(u.size)},a)})},leave(){var a;e.removeEventListener("message",r),(a=e.close)==null||a.call(e)}}}function AU({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Kt}`:Kt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const pd={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function md(e,t){const a=c=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${c}/>`;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${t==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:t==="offline"?a(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):a("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const RU=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(md(pd.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(md(pd.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(md(pd.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(md(pd.idle,"idle"))}`}),MU="No sessions are waiting for you.";function IU(e){if(e.length===0)return"";const[t,...n]=e;if(n.length===0)return`${t.label} is waiting for your permission.`;const r=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${r} are waiting for your permission.`}function $U(e,t){return t!==""?t:e===""?"":MU}const nN="agent-dag.browserWatch.seenMs";function OU(e,t){return e.filter(n=>n.startMs>t)}function PU(e,t){const n=(e??[]).filter(a=>a&&typeof a.fp=="string"&&!t.has(a.fp));if(!n.length)return{request:null,waiting:0};const r=[...n].sort((a,i)=>(a.at??0)-(i.at??0));return{request:r[0],waiting:r.length-1}}function LU({request:e,waiting:t,busy:n,now:r,onAccept:a,onDecline:i,onLater:c}){const u=x.useRef(null),f=fn(c,{focusRef:u}),p=Ta(n,"accept"),h=Ta(n,"dismiss");return l.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:l.jsxs("div",{ref:f,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("i",{className:"ap-pulse","aria-hidden":!0}),l.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:c,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsxs("p",{className:"lan-ask-who",children:[l.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",l.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",h0(e.at,r)]}),l.jsx("p",{className:"modal-note",children:"Paired decks repair each other's expired logins. Accept only if you know this machine — what it shares is an account, not a screen."}),l.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",l.jsx("code",{className:"ap-lan-code",children:e.fp})," — that machine shows its own under This deck on the network; the two should match."]}),t>0&&l.jsx("p",{className:"lan-ask-more",children:t===1?"One more deck is waiting behind this one.":`${t} more decks are waiting behind this one.`}),l.jsxs("div",{className:"lan-ask-acts",children:[l.jsx("button",{type:"button",ref:u,className:"btn",disabled:h.disabled,"aria-busy":h.busy,onClick:i,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),l.jsx("button",{type:"button",className:"btn primary",disabled:p.disabled,"aria-busy":p.busy,onClick:a,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function m0(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 Ap,rN;function DU(){if(rN)return Ap;rN=1;function e(){this.__data__=[],this.size=0}return Ap=e,Ap}var Rp,sN;function Ui(){if(sN)return Rp;sN=1;function e(t,n){return t===n||t!==t&&n!==n}return Rp=e,Rp}var Mp,aN;function wh(){if(aN)return Mp;aN=1;var e=Ui();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return Mp=t,Mp}var Ip,oN;function qU(){if(oN)return Ip;oN=1;var e=wh(),t=Array.prototype,n=t.splice;function r(a){var i=this.__data__,c=e(i,a);if(c<0)return!1;var u=i.length-1;return c==u?i.pop():n.call(i,c,1),--this.size,!0}return Ip=r,Ip}var $p,iN;function FU(){if(iN)return $p;iN=1;var e=wh();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return $p=t,$p}var Op,lN;function BU(){if(lN)return Op;lN=1;var e=wh();function t(n){return e(this.__data__,n)>-1}return Op=t,Op}var Pp,cN;function zU(){if(cN)return Pp;cN=1;var e=wh();function t(n,r){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,r])):a[i][1]=r,this}return Pp=t,Pp}var Lp,uN;function vh(){if(uN)return Lp;uN=1;var e=DU(),t=qU(),n=FU(),r=BU(),a=zU();function i(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,Lp=i,Lp}var Dp,dN;function UU(){if(dN)return Dp;dN=1;var e=vh();function t(){this.__data__=new e,this.size=0}return Dp=t,Dp}var qp,hN;function WU(){if(hN)return qp;hN=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return qp=e,qp}var Fp,fN;function HU(){if(fN)return Fp;fN=1;function e(t){return this.__data__.get(t)}return Fp=e,Fp}var Bp,pN;function GU(){if(pN)return Bp;pN=1;function e(t){return this.__data__.has(t)}return Bp=e,Bp}var zp,mN;function NR(){if(mN)return zp;mN=1;var e=typeof Hu=="object"&&Hu&&Hu.Object===Object&&Hu;return zp=e,zp}var Up,gN;function Fr(){if(gN)return Up;gN=1;var e=NR(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Up=n,Up}var Wp,yN;function Wi(){if(yN)return Wp;yN=1;var e=Fr(),t=e.Symbol;return Wp=t,Wp}var Hp,wN;function VU(){if(wN)return Hp;wN=1;var e=Wi(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function i(c){var u=n.call(c,a),f=c[a];try{c[a]=void 0;var p=!0}catch{}var h=r.call(c);return p&&(u?c[a]=f:delete c[a]),h}return Hp=i,Hp}var Gp,vN;function KU(){if(vN)return Gp;vN=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Gp=n,Gp}var Vp,xN;function ko(){if(xN)return Vp;xN=1;var e=Wi(),t=VU(),n=KU(),r="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function c(u){return u==null?u===void 0?a:r:i&&i in Object(u)?t(u):n(u)}return Vp=c,Vp}var Kp,bN;function gr(){if(bN)return Kp;bN=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Kp=e,Kp}var Yp,kN;function Sc(){if(kN)return Yp;kN=1;var e=ko(),t=gr(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function c(u){if(!t(u))return!1;var f=e(u);return f==r||f==a||f==n||f==i}return Yp=c,Yp}var Xp,_N;function YU(){if(_N)return Xp;_N=1;var e=Fr(),t=e["__core-js_shared__"];return Xp=t,Xp}var Zp,NN;function XU(){if(NN)return Zp;NN=1;var e=YU(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return Zp=n,Zp}var Qp,SN;function SR(){if(SN)return Qp;SN=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return Qp=n,Qp}var Jp,jN;function ZU(){if(jN)return Jp;jN=1;var e=Sc(),t=XU(),n=gr(),r=SR(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,f=c.toString,p=u.hasOwnProperty,h=RegExp("^"+f.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!n(y)||t(y))return!1;var w=e(y)?h:i;return w.test(r(y))}return Jp=m,Jp}var em,EN;function QU(){if(EN)return em;EN=1;function e(t,n){return t==null?void 0:t[n]}return em=e,em}var tm,CN;function _o(){if(CN)return tm;CN=1;var e=ZU(),t=QU();function n(r,a){var i=t(r,a);return e(i)?i:void 0}return tm=n,tm}var nm,TN;function g0(){if(TN)return nm;TN=1;var e=_o(),t=Fr(),n=e(t,"Map");return nm=n,nm}var rm,AN;function xh(){if(AN)return rm;AN=1;var e=_o(),t=e(Object,"create");return rm=t,rm}var sm,RN;function JU(){if(RN)return sm;RN=1;var e=xh();function t(){this.__data__=e?e(null):{},this.size=0}return sm=t,sm}var am,MN;function eW(){if(MN)return am;MN=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return am=e,am}var om,IN;function tW(){if(IN)return om;IN=1;var e=xh(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(i){var c=this.__data__;if(e){var u=c[i];return u===t?void 0:u}return r.call(c,i)?c[i]:void 0}return om=a,om}var im,$N;function nW(){if($N)return im;$N=1;var e=xh(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return im=r,im}var lm,ON;function rW(){if(ON)return lm;ON=1;var e=xh(),t="__lodash_hash_undefined__";function n(r,a){var i=this.__data__;return this.size+=this.has(r)?0:1,i[r]=e&&a===void 0?t:a,this}return lm=n,lm}var cm,PN;function sW(){if(PN)return cm;PN=1;var e=JU(),t=eW(),n=tW(),r=nW(),a=rW();function i(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,cm=i,cm}var um,LN;function aW(){if(LN)return um;LN=1;var e=sW(),t=vh(),n=g0();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return um=r,um}var dm,DN;function oW(){if(DN)return dm;DN=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return dm=e,dm}var hm,qN;function bh(){if(qN)return hm;qN=1;var e=oW();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return hm=t,hm}var fm,FN;function iW(){if(FN)return fm;FN=1;var e=bh();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return fm=t,fm}var pm,BN;function lW(){if(BN)return pm;BN=1;var e=bh();function t(n){return e(this,n).get(n)}return pm=t,pm}var mm,zN;function cW(){if(zN)return mm;zN=1;var e=bh();function t(n){return e(this,n).has(n)}return mm=t,mm}var gm,UN;function uW(){if(UN)return gm;UN=1;var e=bh();function t(n,r){var a=e(this,n),i=a.size;return a.set(n,r),this.size+=a.size==i?0:1,this}return gm=t,gm}var ym,WN;function y0(){if(WN)return ym;WN=1;var e=aW(),t=iW(),n=lW(),r=cW(),a=uW();function i(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,ym=i,ym}var wm,HN;function dW(){if(HN)return wm;HN=1;var e=vh(),t=g0(),n=y0(),r=200;function a(i,c){var u=this.__data__;if(u instanceof e){var f=u.__data__;if(!t||f.length<r-1)return f.push([i,c]),this.size=++u.size,this;u=this.__data__=new n(f)}return u.set(i,c),this.size=u.size,this}return wm=a,wm}var vm,GN;function kh(){if(GN)return vm;GN=1;var e=vh(),t=UU(),n=WU(),r=HU(),a=GU(),i=dW();function c(u){var f=this.__data__=new e(u);this.size=f.size}return c.prototype.clear=t,c.prototype.delete=n,c.prototype.get=r,c.prototype.has=a,c.prototype.set=i,vm=c,vm}var xm,VN;function w0(){if(VN)return xm;VN=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a&&n(t[r],r,t)!==!1;);return t}return xm=e,xm}var bm,KN;function jR(){if(KN)return bm;KN=1;var e=_o(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return bm=t,bm}var km,YN;function _h(){if(YN)return km;YN=1;var e=jR();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return km=t,km}var _m,XN;function Nh(){if(XN)return _m;XN=1;var e=_h(),t=Ui(),n=Object.prototype,r=n.hasOwnProperty;function a(i,c,u){var f=i[c];(!(r.call(i,c)&&t(f,u))||u===void 0&&!(c in i))&&e(i,c,u)}return _m=a,_m}var Nm,ZN;function jc(){if(ZN)return Nm;ZN=1;var e=Nh(),t=_h();function n(r,a,i,c){var u=!i;i||(i={});for(var f=-1,p=a.length;++f<p;){var h=a[f],m=c?c(i[h],r[h],h,i,r):void 0;m===void 0&&(m=r[h]),u?t(i,h,m):e(i,h,m)}return i}return Nm=n,Nm}var Sm,QN;function hW(){if(QN)return Sm;QN=1;function e(t,n){for(var r=-1,a=Array(t);++r<t;)a[r]=n(r);return a}return Sm=e,Sm}var jm,JN;function ps(){if(JN)return jm;JN=1;function e(t){return t!=null&&typeof t=="object"}return jm=e,jm}var Em,eS;function fW(){if(eS)return Em;eS=1;var e=ko(),t=ps(),n="[object Arguments]";function r(a){return t(a)&&e(a)==n}return Em=r,Em}var Cm,tS;function Ec(){if(tS)return Cm;tS=1;var e=fW(),t=ps(),n=Object.prototype,r=n.hasOwnProperty,a=n.propertyIsEnumerable,i=e((function(){return arguments})())?e:function(c){return t(c)&&r.call(c,"callee")&&!a.call(c,"callee")};return Cm=i,Cm}var Tm,nS;function Ut(){if(nS)return Tm;nS=1;var e=Array.isArray;return Tm=e,Tm}var Xl={exports:{}},Am,rS;function pW(){if(rS)return Am;rS=1;function e(){return!1}return Am=e,Am}Xl.exports;var sS;function Hi(){return sS||(sS=1,(function(e,t){var n=Fr(),r=pW(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,c=i&&i.exports===a,u=c?n.Buffer:void 0,f=u?u.isBuffer:void 0,p=f||r;e.exports=p})(Xl,Xl.exports)),Xl.exports}var Rm,aS;function Sh(){if(aS)return Rm;aS=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,a){var i=typeof r;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<a}return Rm=n,Rm}var Mm,oS;function v0(){if(oS)return Mm;oS=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Mm=t,Mm}var Im,iS;function mW(){if(iS)return Im;iS=1;var e=ko(),t=v0(),n=ps(),r="[object Arguments]",a="[object Array]",i="[object Boolean]",c="[object Date]",u="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",m="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",_="[object WeakMap]",S="[object ArrayBuffer]",b="[object DataView]",j="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",$="[object Uint8Array]",D="[object Uint8ClampedArray]",W="[object Uint16Array]",L="[object Uint32Array]",V={};V[j]=V[E]=V[C]=V[T]=V[R]=V[$]=V[D]=V[W]=V[L]=!0,V[r]=V[a]=V[S]=V[i]=V[b]=V[c]=V[u]=V[f]=V[p]=V[h]=V[m]=V[y]=V[w]=V[N]=V[_]=!1;function Q(ee){return n(ee)&&t(ee.length)&&!!V[e(ee)]}return Im=Q,Im}var $m,lS;function jh(){if(lS)return $m;lS=1;function e(t){return function(n){return t(n)}}return $m=e,$m}var Zl={exports:{}};Zl.exports;var cS;function x0(){return cS||(cS=1,(function(e,t){var n=NR(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===r,c=i&&n.process,u=(function(){try{var f=a&&a.require&&a.require("util").types;return f||c&&c.binding&&c.binding("util")}catch{}})();e.exports=u})(Zl,Zl.exports)),Zl.exports}var Om,uS;function Cc(){if(uS)return Om;uS=1;var e=mW(),t=jh(),n=x0(),r=n&&n.isTypedArray,a=r?t(r):e;return Om=a,Om}var Pm,dS;function ER(){if(dS)return Pm;dS=1;var e=hW(),t=Ec(),n=Ut(),r=Hi(),a=Sh(),i=Cc(),c=Object.prototype,u=c.hasOwnProperty;function f(p,h){var m=n(p),y=!m&&t(p),w=!m&&!y&&r(p),N=!m&&!y&&!w&&i(p),_=m||y||w||N,S=_?e(p.length,String):[],b=S.length;for(var j in p)(h||u.call(p,j))&&!(_&&(j=="length"||w&&(j=="offset"||j=="parent")||N&&(j=="buffer"||j=="byteLength"||j=="byteOffset")||a(j,b)))&&S.push(j);return S}return Pm=f,Pm}var Lm,hS;function Eh(){if(hS)return Lm;hS=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return Lm=t,Lm}var Dm,fS;function CR(){if(fS)return Dm;fS=1;function e(t,n){return function(r){return t(n(r))}}return Dm=e,Dm}var qm,pS;function gW(){if(pS)return qm;pS=1;var e=CR(),t=e(Object.keys,Object);return qm=t,qm}var Fm,mS;function b0(){if(mS)return Fm;mS=1;var e=Eh(),t=gW(),n=Object.prototype,r=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var c=[];for(var u in Object(i))r.call(i,u)&&u!="constructor"&&c.push(u);return c}return Fm=a,Fm}var Bm,gS;function Bs(){if(gS)return Bm;gS=1;var e=Sc(),t=v0();function n(r){return r!=null&&t(r.length)&&!e(r)}return Bm=n,Bm}var zm,yS;function Aa(){if(yS)return zm;yS=1;var e=ER(),t=b0(),n=Bs();function r(a){return n(a)?e(a):t(a)}return zm=r,zm}var Um,wS;function yW(){if(wS)return Um;wS=1;var e=jc(),t=Aa();function n(r,a){return r&&e(a,t(a),r)}return Um=n,Um}var Wm,vS;function wW(){if(vS)return Wm;vS=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return Wm=e,Wm}var Hm,xS;function vW(){if(xS)return Hm;xS=1;var e=gr(),t=Eh(),n=wW(),r=Object.prototype,a=r.hasOwnProperty;function i(c){if(!e(c))return n(c);var u=t(c),f=[];for(var p in c)p=="constructor"&&(u||!a.call(c,p))||f.push(p);return f}return Hm=i,Hm}var Gm,bS;function No(){if(bS)return Gm;bS=1;var e=ER(),t=vW(),n=Bs();function r(a){return n(a)?e(a,!0):t(a)}return Gm=r,Gm}var Vm,kS;function xW(){if(kS)return Vm;kS=1;var e=jc(),t=No();function n(r,a){return r&&e(a,t(a),r)}return Vm=n,Vm}var Ql={exports:{}};Ql.exports;var _S;function TR(){return _S||(_S=1,(function(e,t){var n=Fr(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===r,c=i?n.Buffer:void 0,u=c?c.allocUnsafe:void 0;function f(p,h){if(h)return p.slice();var m=p.length,y=u?u(m):new p.constructor(m);return p.copy(y),y}e.exports=f})(Ql,Ql.exports)),Ql.exports}var Km,NS;function AR(){if(NS)return Km;NS=1;function e(t,n){var r=-1,a=t.length;for(n||(n=Array(a));++r<a;)n[r]=t[r];return n}return Km=e,Km}var Ym,SS;function RR(){if(SS)return Ym;SS=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,i=0,c=[];++r<a;){var u=t[r];n(u,r,t)&&(c[i++]=u)}return c}return Ym=e,Ym}var Xm,jS;function MR(){if(jS)return Xm;jS=1;function e(){return[]}return Xm=e,Xm}var Zm,ES;function k0(){if(ES)return Zm;ES=1;var e=RR(),t=MR(),n=Object.prototype,r=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(c){return c==null?[]:(c=Object(c),e(a(c),function(u){return r.call(c,u)}))}:t;return Zm=i,Zm}var Qm,CS;function bW(){if(CS)return Qm;CS=1;var e=jc(),t=k0();function n(r,a){return e(r,t(r),a)}return Qm=n,Qm}var Jm,TS;function _0(){if(TS)return Jm;TS=1;function e(t,n){for(var r=-1,a=n.length,i=t.length;++r<a;)t[i+r]=n[r];return t}return Jm=e,Jm}var eg,AS;function Ch(){if(AS)return eg;AS=1;var e=CR(),t=e(Object.getPrototypeOf,Object);return eg=t,eg}var tg,RS;function IR(){if(RS)return tg;RS=1;var e=_0(),t=Ch(),n=k0(),r=MR(),a=Object.getOwnPropertySymbols,i=a?function(c){for(var u=[];c;)e(u,n(c)),c=t(c);return u}:r;return tg=i,tg}var ng,MS;function kW(){if(MS)return ng;MS=1;var e=jc(),t=IR();function n(r,a){return e(r,t(r),a)}return ng=n,ng}var rg,IS;function $R(){if(IS)return rg;IS=1;var e=_0(),t=Ut();function n(r,a,i){var c=a(r);return t(r)?c:e(c,i(r))}return rg=n,rg}var sg,$S;function OR(){if($S)return sg;$S=1;var e=$R(),t=k0(),n=Aa();function r(a){return e(a,n,t)}return sg=r,sg}var ag,OS;function _W(){if(OS)return ag;OS=1;var e=$R(),t=IR(),n=No();function r(a){return e(a,n,t)}return ag=r,ag}var og,PS;function NW(){if(PS)return og;PS=1;var e=_o(),t=Fr(),n=e(t,"DataView");return og=n,og}var ig,LS;function SW(){if(LS)return ig;LS=1;var e=_o(),t=Fr(),n=e(t,"Promise");return ig=n,ig}var lg,DS;function PR(){if(DS)return lg;DS=1;var e=_o(),t=Fr(),n=e(t,"Set");return lg=n,lg}var cg,qS;function jW(){if(qS)return cg;qS=1;var e=_o(),t=Fr(),n=e(t,"WeakMap");return cg=n,cg}var ug,FS;function Gi(){if(FS)return ug;FS=1;var e=NW(),t=g0(),n=SW(),r=PR(),a=jW(),i=ko(),c=SR(),u="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",m="[object WeakMap]",y="[object DataView]",w=c(e),N=c(t),_=c(n),S=c(r),b=c(a),j=i;return(e&&j(new e(new ArrayBuffer(1)))!=y||t&&j(new t)!=u||n&&j(n.resolve())!=p||r&&j(new r)!=h||a&&j(new a)!=m)&&(j=function(E){var C=i(E),T=C==f?E.constructor:void 0,R=T?c(T):"";if(R)switch(R){case w:return y;case N:return u;case _:return p;case S:return h;case b:return m}return C}),ug=j,ug}var dg,BS;function EW(){if(BS)return dg;BS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var a=r.length,i=new r.constructor(a);return a&&typeof r[0]=="string"&&t.call(r,"index")&&(i.index=r.index,i.input=r.input),i}return dg=n,dg}var hg,zS;function LR(){if(zS)return hg;zS=1;var e=Fr(),t=e.Uint8Array;return hg=t,hg}var fg,US;function N0(){if(US)return fg;US=1;var e=LR();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return fg=t,fg}var pg,WS;function CW(){if(WS)return pg;WS=1;var e=N0();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return pg=t,pg}var mg,HS;function TW(){if(HS)return mg;HS=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return mg=t,mg}var gg,GS;function AW(){if(GS)return gg;GS=1;var e=Wi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(a){return n?Object(n.call(a)):{}}return gg=r,gg}var yg,VS;function DR(){if(VS)return yg;VS=1;var e=N0();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return yg=t,yg}var wg,KS;function RW(){if(KS)return wg;KS=1;var e=N0(),t=CW(),n=TW(),r=AW(),a=DR(),i="[object Boolean]",c="[object Date]",u="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",m="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",S="[object Float64Array]",b="[object Int8Array]",j="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",$="[object Uint32Array]";function D(W,L,V){var Q=W.constructor;switch(L){case w:return e(W);case i:case c:return new Q(+W);case N:return t(W,V);case _:case S:case b:case j:case E:case C:case T:case R:case $:return a(W,V);case u:return new Q;case f:case m:return new Q(W);case p:return n(W);case h:return new Q;case y:return r(W)}}return wg=D,wg}var vg,YS;function qR(){if(YS)return vg;YS=1;var e=gr(),t=Object.create,n=(function(){function r(){}return function(a){if(!e(a))return{};if(t)return t(a);r.prototype=a;var i=new r;return r.prototype=void 0,i}})();return vg=n,vg}var xg,XS;function FR(){if(XS)return xg;XS=1;var e=qR(),t=Ch(),n=Eh();function r(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return xg=r,xg}var bg,ZS;function MW(){if(ZS)return bg;ZS=1;var e=Gi(),t=ps(),n="[object Map]";function r(a){return t(a)&&e(a)==n}return bg=r,bg}var kg,QS;function IW(){if(QS)return kg;QS=1;var e=MW(),t=jh(),n=x0(),r=n&&n.isMap,a=r?t(r):e;return kg=a,kg}var _g,JS;function $W(){if(JS)return _g;JS=1;var e=Gi(),t=ps(),n="[object Set]";function r(a){return t(a)&&e(a)==n}return _g=r,_g}var Ng,ej;function OW(){if(ej)return Ng;ej=1;var e=$W(),t=jh(),n=x0(),r=n&&n.isSet,a=r?t(r):e;return Ng=a,Ng}var Sg,tj;function BR(){if(tj)return Sg;tj=1;var e=kh(),t=w0(),n=Nh(),r=yW(),a=xW(),i=TR(),c=AR(),u=bW(),f=kW(),p=OR(),h=_W(),m=Gi(),y=EW(),w=RW(),N=FR(),_=Ut(),S=Hi(),b=IW(),j=gr(),E=OW(),C=Aa(),T=No(),R=1,$=2,D=4,W="[object Arguments]",L="[object Array]",V="[object Boolean]",Q="[object Date]",ee="[object Error]",M="[object Function]",X="[object GeneratorFunction]",H="[object Map]",I="[object Number]",B="[object Object]",P="[object RegExp]",z="[object Set]",O="[object String]",K="[object Symbol]",de="[object WeakMap]",G="[object ArrayBuffer]",J="[object DataView]",U="[object Float32Array]",ne="[object Float64Array]",ae="[object Int8Array]",pe="[object Int16Array]",ge="[object Int32Array]",Se="[object Uint8Array]",Oe="[object Uint8ClampedArray]",We="[object Uint16Array]",Pe="[object Uint32Array]",Te={};Te[W]=Te[L]=Te[G]=Te[J]=Te[V]=Te[Q]=Te[U]=Te[ne]=Te[ae]=Te[pe]=Te[ge]=Te[H]=Te[I]=Te[B]=Te[P]=Te[z]=Te[O]=Te[K]=Te[Se]=Te[Oe]=Te[We]=Te[Pe]=!0,Te[ee]=Te[M]=Te[de]=!1;function et(je,_e,Ye,dt,Qe,ue){var be,Re=_e&R,Xe=_e&$,$e=_e&D;if(Ye&&(be=Qe?Ye(je,dt,Qe,ue):Ye(je)),be!==void 0)return be;if(!j(je))return je;var ct=_(je);if(ct){if(be=y(je),!Re)return c(je,be)}else{var ye=m(je),Ee=ye==M||ye==X;if(S(je))return i(je,Re);if(ye==B||ye==W||Ee&&!Qe){if(be=Xe||Ee?{}:N(je),!Re)return Xe?f(je,a(be,je)):u(je,r(be,je))}else{if(!Te[ye])return Qe?je:{};be=w(je,ye,Re)}}ue||(ue=new e);var ie=ue.get(je);if(ie)return ie;ue.set(je,be),E(je)?je.forEach(function(lt){be.add(et(lt,_e,Ye,lt,je,ue))}):b(je)&&je.forEach(function(lt,tt){be.set(tt,et(lt,_e,Ye,tt,je,ue))});var Je=$e?Xe?h:p:Xe?T:C,rt=ct?void 0:Je(je);return t(rt||je,function(lt,tt){rt&&(tt=lt,lt=je[tt]),n(be,tt,et(lt,_e,Ye,tt,je,ue))}),be}return Sg=et,Sg}var jg,nj;function PW(){if(nj)return jg;nj=1;var e=BR(),t=4;function n(r){return e(r,t)}return jg=n,jg}var Eg,rj;function S0(){if(rj)return Eg;rj=1;function e(t){return function(){return t}}return Eg=e,Eg}var Cg,sj;function LW(){if(sj)return Cg;sj=1;function e(t){return function(n,r,a){for(var i=-1,c=Object(n),u=a(n),f=u.length;f--;){var p=u[t?f:++i];if(r(c[p],p,c)===!1)break}return n}}return Cg=e,Cg}var Tg,aj;function j0(){if(aj)return Tg;aj=1;var e=LW(),t=e();return Tg=t,Tg}var Ag,oj;function E0(){if(oj)return Ag;oj=1;var e=j0(),t=Aa();function n(r,a){return r&&e(r,a,t)}return Ag=n,Ag}var Rg,ij;function DW(){if(ij)return Rg;ij=1;var e=Bs();function t(n,r){return function(a,i){if(a==null)return a;if(!e(a))return n(a,i);for(var c=a.length,u=r?c:-1,f=Object(a);(r?u--:++u<c)&&i(f[u],u,f)!==!1;);return a}}return Rg=t,Rg}var Mg,lj;function Th(){if(lj)return Mg;lj=1;var e=E0(),t=DW(),n=t(e);return Mg=n,Mg}var Ig,cj;function So(){if(cj)return Ig;cj=1;function e(t){return t}return Ig=e,Ig}var $g,uj;function zR(){if(uj)return $g;uj=1;var e=So();function t(n){return typeof n=="function"?n:e}return $g=t,$g}var Og,dj;function UR(){if(dj)return Og;dj=1;var e=w0(),t=Th(),n=zR(),r=Ut();function a(i,c){var u=r(i)?e:t;return u(i,n(c))}return Og=a,Og}var Pg,hj;function WR(){return hj||(hj=1,Pg=UR()),Pg}var Lg,fj;function qW(){if(fj)return Lg;fj=1;var e=Th();function t(n,r){var a=[];return e(n,function(i,c,u){r(i,c,u)&&a.push(i)}),a}return Lg=t,Lg}var Dg,pj;function FW(){if(pj)return Dg;pj=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Dg=t,Dg}var qg,mj;function BW(){if(mj)return qg;mj=1;function e(t){return this.__data__.has(t)}return qg=e,qg}var Fg,gj;function HR(){if(gj)return Fg;gj=1;var e=y0(),t=FW(),n=BW();function r(a){var i=-1,c=a==null?0:a.length;for(this.__data__=new e;++i<c;)this.add(a[i])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,Fg=r,Fg}var Bg,yj;function zW(){if(yj)return Bg;yj=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a;)if(n(t[r],r,t))return!0;return!1}return Bg=e,Bg}var zg,wj;function GR(){if(wj)return zg;wj=1;function e(t,n){return t.has(n)}return zg=e,zg}var Ug,vj;function VR(){if(vj)return Ug;vj=1;var e=HR(),t=zW(),n=GR(),r=1,a=2;function i(c,u,f,p,h,m){var y=f&r,w=c.length,N=u.length;if(w!=N&&!(y&&N>w))return!1;var _=m.get(c),S=m.get(u);if(_&&S)return _==u&&S==c;var b=-1,j=!0,E=f&a?new e:void 0;for(m.set(c,u),m.set(u,c);++b<w;){var C=c[b],T=u[b];if(p)var R=y?p(T,C,b,u,c,m):p(C,T,b,c,u,m);if(R!==void 0){if(R)continue;j=!1;break}if(E){if(!t(u,function($,D){if(!n(E,D)&&(C===$||h(C,$,f,p,m)))return E.push(D)})){j=!1;break}}else if(!(C===T||h(C,T,f,p,m))){j=!1;break}}return m.delete(c),m.delete(u),j}return Ug=i,Ug}var Wg,xj;function UW(){if(xj)return Wg;xj=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a,i){r[++n]=[i,a]}),r}return Wg=e,Wg}var Hg,bj;function C0(){if(bj)return Hg;bj=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a){r[++n]=a}),r}return Hg=e,Hg}var Gg,kj;function WW(){if(kj)return Gg;kj=1;var e=Wi(),t=LR(),n=Ui(),r=VR(),a=UW(),i=C0(),c=1,u=2,f="[object Boolean]",p="[object Date]",h="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",_="[object String]",S="[object Symbol]",b="[object ArrayBuffer]",j="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function T(R,$,D,W,L,V,Q){switch(D){case j:if(R.byteLength!=$.byteLength||R.byteOffset!=$.byteOffset)return!1;R=R.buffer,$=$.buffer;case b:return!(R.byteLength!=$.byteLength||!V(new t(R),new t($)));case f:case p:case y:return n(+R,+$);case h:return R.name==$.name&&R.message==$.message;case w:case _:return R==$+"";case m:var ee=a;case N:var M=W&c;if(ee||(ee=i),R.size!=$.size&&!M)return!1;var X=Q.get(R);if(X)return X==$;W|=u,Q.set(R,$);var H=r(ee(R),ee($),W,L,V,Q);return Q.delete(R),H;case S:if(C)return C.call(R)==C.call($)}return!1}return Gg=T,Gg}var Vg,_j;function HW(){if(_j)return Vg;_j=1;var e=OR(),t=1,n=Object.prototype,r=n.hasOwnProperty;function a(i,c,u,f,p,h){var m=u&t,y=e(i),w=y.length,N=e(c),_=N.length;if(w!=_&&!m)return!1;for(var S=w;S--;){var b=y[S];if(!(m?b in c:r.call(c,b)))return!1}var j=h.get(i),E=h.get(c);if(j&&E)return j==c&&E==i;var C=!0;h.set(i,c),h.set(c,i);for(var T=m;++S<w;){b=y[S];var R=i[b],$=c[b];if(f)var D=m?f($,R,b,c,i,h):f(R,$,b,i,c,h);if(!(D===void 0?R===$||p(R,$,u,f,h):D)){C=!1;break}T||(T=b=="constructor")}if(C&&!T){var W=i.constructor,L=c.constructor;W!=L&&"constructor"in i&&"constructor"in c&&!(typeof W=="function"&&W instanceof W&&typeof L=="function"&&L instanceof L)&&(C=!1)}return h.delete(i),h.delete(c),C}return Vg=a,Vg}var Kg,Nj;function GW(){if(Nj)return Kg;Nj=1;var e=kh(),t=VR(),n=WW(),r=HW(),a=Gi(),i=Ut(),c=Hi(),u=Cc(),f=1,p="[object Arguments]",h="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(_,S,b,j,E,C){var T=i(_),R=i(S),$=T?h:a(_),D=R?h:a(S);$=$==p?m:$,D=D==p?m:D;var W=$==m,L=D==m,V=$==D;if(V&&c(_)){if(!c(S))return!1;T=!0,W=!1}if(V&&!W)return C||(C=new e),T||u(_)?t(_,S,b,j,E,C):n(_,S,$,b,j,E,C);if(!(b&f)){var Q=W&&w.call(_,"__wrapped__"),ee=L&&w.call(S,"__wrapped__");if(Q||ee){var M=Q?_.value():_,X=ee?S.value():S;return C||(C=new e),E(M,X,b,j,C)}}return V?(C||(C=new e),r(_,S,b,j,E,C)):!1}return Kg=N,Kg}var Yg,Sj;function KR(){if(Sj)return Yg;Sj=1;var e=GW(),t=ps();function n(r,a,i,c,u){return r===a?!0:r==null||a==null||!t(r)&&!t(a)?r!==r&&a!==a:e(r,a,i,c,n,u)}return Yg=n,Yg}var Xg,jj;function VW(){if(jj)return Xg;jj=1;var e=kh(),t=KR(),n=1,r=2;function a(i,c,u,f){var p=u.length,h=p,m=!f;if(i==null)return!h;for(i=Object(i);p--;){var y=u[p];if(m&&y[2]?y[1]!==i[y[0]]:!(y[0]in i))return!1}for(;++p<h;){y=u[p];var w=y[0],N=i[w],_=y[1];if(m&&y[2]){if(N===void 0&&!(w in i))return!1}else{var S=new e;if(f)var b=f(N,_,w,i,c,S);if(!(b===void 0?t(_,N,n|r,f,S):b))return!1}}return!0}return Xg=a,Xg}var Zg,Ej;function YR(){if(Ej)return Zg;Ej=1;var e=gr();function t(n){return n===n&&!e(n)}return Zg=t,Zg}var Qg,Cj;function KW(){if(Cj)return Qg;Cj=1;var e=YR(),t=Aa();function n(r){for(var a=t(r),i=a.length;i--;){var c=a[i],u=r[c];a[i]=[c,u,e(u)]}return a}return Qg=n,Qg}var Jg,Tj;function XR(){if(Tj)return Jg;Tj=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return Jg=e,Jg}var ey,Aj;function YW(){if(Aj)return ey;Aj=1;var e=VW(),t=KW(),n=XR();function r(a){var i=t(a);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(c){return c===a||e(c,a,i)}}return ey=r,ey}var ty,Rj;function Vi(){if(Rj)return ty;Rj=1;var e=ko(),t=ps(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return ty=r,ty}var ny,Mj;function T0(){if(Mj)return ny;Mj=1;var e=Ut(),t=Vi(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(i,c){if(e(i))return!1;var u=typeof i;return u=="number"||u=="symbol"||u=="boolean"||i==null||t(i)?!0:r.test(i)||!n.test(i)||c!=null&&i in Object(c)}return ny=a,ny}var ry,Ij;function XW(){if(Ij)return ry;Ij=1;var e=y0(),t="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var c=arguments,u=a?a.apply(this,c):c[0],f=i.cache;if(f.has(u))return f.get(u);var p=r.apply(this,c);return i.cache=f.set(u,p)||f,p};return i.cache=new(n.Cache||e),i}return n.Cache=e,ry=n,ry}var sy,$j;function ZW(){if($j)return sy;$j=1;var e=XW(),t=500;function n(r){var a=e(r,function(c){return i.size===t&&i.clear(),c}),i=a.cache;return a}return sy=n,sy}var ay,Oj;function QW(){if(Oj)return ay;Oj=1;var e=ZW(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(c,u,f,p){i.push(f?p.replace(n,"$1"):u||c)}),i});return ay=r,ay}var oy,Pj;function Ah(){if(Pj)return oy;Pj=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,i=Array(a);++r<a;)i[r]=n(t[r],r,t);return i}return oy=e,oy}var iy,Lj;function JW(){if(Lj)return iy;Lj=1;var e=Wi(),t=Ah(),n=Ut(),r=Vi(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function c(u){if(typeof u=="string")return u;if(n(u))return t(u,c)+"";if(r(u))return i?i.call(u):"";var f=u+"";return f=="0"&&1/u==-1/0?"-0":f}return iy=c,iy}var ly,Dj;function ZR(){if(Dj)return ly;Dj=1;var e=JW();function t(n){return n==null?"":e(n)}return ly=t,ly}var cy,qj;function Rh(){if(qj)return cy;qj=1;var e=Ut(),t=T0(),n=QW(),r=ZR();function a(i,c){return e(i)?i:t(i,c)?[i]:n(r(i))}return cy=a,cy}var uy,Fj;function Tc(){if(Fj)return uy;Fj=1;var e=Vi();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return uy=t,uy}var dy,Bj;function Mh(){if(Bj)return dy;Bj=1;var e=Rh(),t=Tc();function n(r,a){a=e(a,r);for(var i=0,c=a.length;r!=null&&i<c;)r=r[t(a[i++])];return i&&i==c?r:void 0}return dy=n,dy}var hy,zj;function eH(){if(zj)return hy;zj=1;var e=Mh();function t(n,r,a){var i=n==null?void 0:e(n,r);return i===void 0?a:i}return hy=t,hy}var fy,Uj;function tH(){if(Uj)return fy;Uj=1;function e(t,n){return t!=null&&n in Object(t)}return fy=e,fy}var py,Wj;function QR(){if(Wj)return py;Wj=1;var e=Rh(),t=Ec(),n=Ut(),r=Sh(),a=v0(),i=Tc();function c(u,f,p){f=e(f,u);for(var h=-1,m=f.length,y=!1;++h<m;){var w=i(f[h]);if(!(y=u!=null&&p(u,w)))break;u=u[w]}return y||++h!=m?y:(m=u==null?0:u.length,!!m&&a(m)&&r(w,m)&&(n(u)||t(u)))}return py=c,py}var my,Hj;function JR(){if(Hj)return my;Hj=1;var e=tH(),t=QR();function n(r,a){return r!=null&&t(r,a,e)}return my=n,my}var gy,Gj;function nH(){if(Gj)return gy;Gj=1;var e=KR(),t=eH(),n=JR(),r=T0(),a=YR(),i=XR(),c=Tc(),u=1,f=2;function p(h,m){return r(h)&&a(m)?i(c(h),m):function(y){var w=t(y,h);return w===void 0&&w===m?n(y,h):e(m,w,u|f)}}return gy=p,gy}var yy,Vj;function eM(){if(Vj)return yy;Vj=1;function e(t){return function(n){return n==null?void 0:n[t]}}return yy=e,yy}var wy,Kj;function rH(){if(Kj)return wy;Kj=1;var e=Mh();function t(n){return function(r){return e(r,n)}}return wy=t,wy}var vy,Yj;function sH(){if(Yj)return vy;Yj=1;var e=eM(),t=rH(),n=T0(),r=Tc();function a(i){return n(i)?e(r(i)):t(i)}return vy=a,vy}var xy,Xj;function zs(){if(Xj)return xy;Xj=1;var e=YW(),t=nH(),n=So(),r=Ut(),a=sH();function i(c){return typeof c=="function"?c:c==null?n:typeof c=="object"?r(c)?t(c[0],c[1]):e(c):a(c)}return xy=i,xy}var by,Zj;function tM(){if(Zj)return by;Zj=1;var e=RR(),t=qW(),n=zs(),r=Ut();function a(i,c){var u=r(i)?e:t;return u(i,n(c,3))}return by=a,by}var ky,Qj;function aH(){if(Qj)return ky;Qj=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,a){return r!=null&&t.call(r,a)}return ky=n,ky}var _y,Jj;function nM(){if(Jj)return _y;Jj=1;var e=aH(),t=QR();function n(r,a){return r!=null&&t(r,a,e)}return _y=n,_y}var Ny,eE;function oH(){if(eE)return Ny;eE=1;var e=b0(),t=Gi(),n=Ec(),r=Ut(),a=Bs(),i=Hi(),c=Eh(),u=Cc(),f="[object Map]",p="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function y(w){if(w==null)return!0;if(a(w)&&(r(w)||typeof w=="string"||typeof w.splice=="function"||i(w)||u(w)||n(w)))return!w.length;var N=t(w);if(N==f||N==p)return!w.size;if(c(w))return!e(w).length;for(var _ in w)if(m.call(w,_))return!1;return!0}return Ny=y,Ny}var Sy,tE;function rM(){if(tE)return Sy;tE=1;function e(t){return t===void 0}return Sy=e,Sy}var jy,nE;function sM(){if(nE)return jy;nE=1;var e=Th(),t=Bs();function n(r,a){var i=-1,c=t(r)?Array(r.length):[];return e(r,function(u,f,p){c[++i]=a(u,f,p)}),c}return jy=n,jy}var Ey,rE;function aM(){if(rE)return Ey;rE=1;var e=Ah(),t=zs(),n=sM(),r=Ut();function a(i,c){var u=r(i)?e:n;return u(i,t(c,3))}return Ey=a,Ey}var Cy,sE;function iH(){if(sE)return Cy;sE=1;function e(t,n,r,a){var i=-1,c=t==null?0:t.length;for(a&&c&&(r=t[++i]);++i<c;)r=n(r,t[i],i,t);return r}return Cy=e,Cy}var Ty,aE;function lH(){if(aE)return Ty;aE=1;function e(t,n,r,a,i){return i(t,function(c,u,f){r=a?(a=!1,c):n(r,c,u,f)}),r}return Ty=e,Ty}var Ay,oE;function oM(){if(oE)return Ay;oE=1;var e=iH(),t=Th(),n=zs(),r=lH(),a=Ut();function i(c,u,f){var p=a(c)?e:r,h=arguments.length<3;return p(c,n(u,4),f,h,t)}return Ay=i,Ay}var Ry,iE;function cH(){if(iE)return Ry;iE=1;var e=ko(),t=Ut(),n=ps(),r="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==r}return Ry=a,Ry}var My,lE;function uH(){if(lE)return My;lE=1;var e=eM(),t=e("length");return My=t,My}var Iy,cE;function dH(){if(cE)return Iy;cE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,i="\\ufe0e\\ufe0f",c="\\u200d",u=RegExp("["+c+e+a+i+"]");function f(p){return u.test(p)}return Iy=f,Iy}var $y,uE;function hH(){if(uE)return $y;uE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,i="\\ufe0e\\ufe0f",c="["+e+"]",u="["+a+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+f+")",h="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",_="["+i+"]?",S="(?:"+w+"(?:"+[h,m,y].join("|")+")"+_+N+")*",b=_+N+S,j="(?:"+[h+u+"?",u,m,y,c].join("|")+")",E=RegExp(f+"(?="+f+")|"+j+b,"g");function C(T){for(var R=E.lastIndex=0;E.test(T);)++R;return R}return $y=C,$y}var Oy,dE;function fH(){if(dE)return Oy;dE=1;var e=uH(),t=dH(),n=hH();function r(a){return t(a)?n(a):e(a)}return Oy=r,Oy}var Py,hE;function pH(){if(hE)return Py;hE=1;var e=b0(),t=Gi(),n=Bs(),r=cH(),a=fH(),i="[object Map]",c="[object Set]";function u(f){if(f==null)return 0;if(n(f))return r(f)?a(f):f.length;var p=t(f);return p==i||p==c?f.size:e(f).length}return Py=u,Py}var Ly,fE;function mH(){if(fE)return Ly;fE=1;var e=w0(),t=qR(),n=E0(),r=zs(),a=Ch(),i=Ut(),c=Hi(),u=Sc(),f=gr(),p=Cc();function h(m,y,w){var N=i(m),_=N||c(m)||p(m);if(y=r(y,4),w==null){var S=m&&m.constructor;_?w=N?new S:[]:f(m)?w=u(S)?t(a(m)):{}:w={}}return(_?e:n)(m,function(b,j,E){return y(w,b,j,E)}),w}return Ly=h,Ly}var Dy,pE;function gH(){if(pE)return Dy;pE=1;var e=Wi(),t=Ec(),n=Ut(),r=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(r&&i&&i[r])}return Dy=a,Dy}var qy,mE;function A0(){if(mE)return qy;mE=1;var e=_0(),t=gH();function n(r,a,i,c,u){var f=-1,p=r.length;for(i||(i=t),u||(u=[]);++f<p;){var h=r[f];a>0&&i(h)?a>1?n(h,a-1,i,c,u):e(u,h):c||(u[u.length]=h)}return u}return qy=n,qy}var Fy,gE;function yH(){if(gE)return Fy;gE=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return Fy=e,Fy}var By,yE;function iM(){if(yE)return By;yE=1;var e=yH(),t=Math.max;function n(r,a,i){return a=t(a===void 0?r.length-1:a,0),function(){for(var c=arguments,u=-1,f=t(c.length-a,0),p=Array(f);++u<f;)p[u]=c[a+u];u=-1;for(var h=Array(a+1);++u<a;)h[u]=c[u];return h[a]=i(p),e(r,this,h)}}return By=n,By}var zy,wE;function wH(){if(wE)return zy;wE=1;var e=S0(),t=jR(),n=So(),r=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return zy=r,zy}var Uy,vE;function vH(){if(vE)return Uy;vE=1;var e=800,t=16,n=Date.now;function r(a){var i=0,c=0;return function(){var u=n(),f=t-(u-c);if(c=u,f>0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return Uy=r,Uy}var Wy,xE;function lM(){if(xE)return Wy;xE=1;var e=wH(),t=vH(),n=t(e);return Wy=n,Wy}var Hy,bE;function Ih(){if(bE)return Hy;bE=1;var e=So(),t=iM(),n=lM();function r(a,i){return n(t(a,i,e),a+"")}return Hy=r,Hy}var Gy,kE;function cM(){if(kE)return Gy;kE=1;function e(t,n,r,a){for(var i=t.length,c=r+(a?1:-1);a?c--:++c<i;)if(n(t[c],c,t))return c;return-1}return Gy=e,Gy}var Vy,_E;function xH(){if(_E)return Vy;_E=1;function e(t){return t!==t}return Vy=e,Vy}var Ky,NE;function bH(){if(NE)return Ky;NE=1;function e(t,n,r){for(var a=r-1,i=t.length;++a<i;)if(t[a]===n)return a;return-1}return Ky=e,Ky}var Yy,SE;function kH(){if(SE)return Yy;SE=1;var e=cM(),t=xH(),n=bH();function r(a,i,c){return i===i?n(a,i,c):e(a,t,c)}return Yy=r,Yy}var Xy,jE;function _H(){if(jE)return Xy;jE=1;var e=kH();function t(n,r){var a=n==null?0:n.length;return!!a&&e(n,r,0)>-1}return Xy=t,Xy}var Zy,EE;function NH(){if(EE)return Zy;EE=1;function e(t,n,r){for(var a=-1,i=t==null?0:t.length;++a<i;)if(r(n,t[a]))return!0;return!1}return Zy=e,Zy}var Qy,CE;function SH(){if(CE)return Qy;CE=1;function e(){}return Qy=e,Qy}var Jy,TE;function jH(){if(TE)return Jy;TE=1;var e=PR(),t=SH(),n=C0(),r=1/0,a=e&&1/n(new e([,-0]))[1]==r?function(i){return new e(i)}:t;return Jy=a,Jy}var ew,AE;function EH(){if(AE)return ew;AE=1;var e=HR(),t=_H(),n=NH(),r=GR(),a=jH(),i=C0(),c=200;function u(f,p,h){var m=-1,y=t,w=f.length,N=!0,_=[],S=_;if(h)N=!1,y=n;else if(w>=c){var b=p?null:a(f);if(b)return i(b);N=!1,y=r,S=new e}else S=p?[]:_;e:for(;++m<w;){var j=f[m],E=p?p(j):j;if(j=h||j!==0?j:0,N&&E===E){for(var C=S.length;C--;)if(S[C]===E)continue e;p&&S.push(E),_.push(j)}else y(S,E,h)||(S!==_&&S.push(E),_.push(j))}return _}return ew=u,ew}var tw,RE;function uM(){if(RE)return tw;RE=1;var e=Bs(),t=ps();function n(r){return t(r)&&e(r)}return tw=n,tw}var nw,ME;function CH(){if(ME)return nw;ME=1;var e=A0(),t=Ih(),n=EH(),r=uM(),a=t(function(i){return n(e(i,1,r,!0))});return nw=a,nw}var rw,IE;function TH(){if(IE)return rw;IE=1;var e=Ah();function t(n,r){return e(r,function(a){return n[a]})}return rw=t,rw}var sw,$E;function dM(){if($E)return sw;$E=1;var e=TH(),t=Aa();function n(r){return r==null?[]:e(r,t(r))}return sw=n,sw}var aw,OE;function yr(){if(OE)return aw;OE=1;var e;if(typeof m0=="function")try{e={clone:PW(),constant:S0(),each:WR(),filter:tM(),has:nM(),isArray:Ut(),isEmpty:oH(),isFunction:Sc(),isUndefined:rM(),keys:Aa(),map:aM(),reduce:oM(),size:pH(),transform:mH(),union:CH(),values:dM()}}catch{}return e||(e=window._),aw=e,aw}var ow,PE;function R0(){if(PE)return ow;PE=1;var e=yr();ow=a;var t="\0",n="\0",r="";function a(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(h){return this._label=h,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._in[m])})},a.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._out[m])})},a.prototype.setNodes=function(h,m){var y=arguments,w=this;return e.each(h,function(N){y.length>1?w.setNode(N,m):w.setNode(N)}),this},a.prototype.setNode=function(h,m){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=m),this):(this._nodes[h]=arguments.length>1?m:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},a.prototype.node=function(h){return this._nodes[h]},a.prototype.hasNode=function(h){return e.has(this._nodes,h)},a.prototype.removeNode=function(h){var m=this;if(e.has(this._nodes,h)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(w){m.setParent(w)}),delete this._children[h]),e.each(e.keys(this._in[h]),y),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),y),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},a.prototype.setParent=function(h,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=n;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},a.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},a.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==n)return m}},a.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var m=this._children[h];if(m)return e.keys(m)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},a.prototype.predecessors=function(h){var m=this._preds[h];if(m)return e.keys(m)},a.prototype.successors=function(h){var m=this._sucs[h];if(m)return e.keys(m)},a.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return e.union(m,this.successors(h))},a.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},a.prototype.filterNodes=function(h){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,S){h(S)&&m.setNode(S,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var w={};function N(_){var S=y.parent(_);return S===void 0||m.hasNode(S)?(w[_]=S,S):S in w?w[S]:N(S)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,N(_))}),m},a.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(h,m){var y=this,w=arguments;return e.reduce(h,function(N,_){return w.length>1?y.setEdge(N,_,m):y.setEdge(N,_),_}),this},a.prototype.setEdge=function(){var h,m,y,w,N=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(h=_.v,m=_.w,y=_.name,arguments.length===2&&(w=arguments[1],N=!0)):(h=_,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),h=""+h,m=""+m,e.isUndefined(y)||(y=""+y);var S=u(this._isDirected,h,m,y);if(e.has(this._edgeLabels,S))return N&&(this._edgeLabels[S]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[S]=N?w:this._defaultEdgeLabelFn(h,m,y);var b=f(this._isDirected,h,m,y);return h=b.v,m=b.w,Object.freeze(b),this._edgeObjs[S]=b,i(this._preds[m],h),i(this._sucs[h],m),this._in[m][S]=b,this._out[h][S]=b,this._edgeCount++,this},a.prototype.edge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return this._edgeLabels[w]},a.prototype.hasEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return e.has(this._edgeLabels,w)},a.prototype.removeEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y),N=this._edgeObjs[w];return N&&(h=N.v,m=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],c(this._preds[m],h),c(this._sucs[h],m),delete this._in[m][w],delete this._out[h][w],this._edgeCount--),this},a.prototype.inEdges=function(h,m){var y=this._in[h];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.v===m}):w}},a.prototype.outEdges=function(h,m){var y=this._out[h];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.w===m}):w}},a.prototype.nodeEdges=function(h,m){var y=this.inEdges(h,m);if(y)return y.concat(this.outEdges(h,m))};function i(h,m){h[m]?h[m]++:h[m]=1}function c(h,m){--h[m]||delete h[m]}function u(h,m,y,w){var N=""+m,_=""+y;if(!h&&N>_){var S=N;N=_,_=S}return N+r+_+r+(e.isUndefined(w)?t:w)}function f(h,m,y,w){var N=""+m,_=""+y;if(!h&&N>_){var S=N;N=_,_=S}var b={v:N,w:_};return w&&(b.name=w),b}function p(h,m){return u(h,m.v,m.w,m.name)}return ow}var iw,LE;function AH(){return LE||(LE=1,iw="2.1.8"),iw}var lw,DE;function RH(){return DE||(DE=1,lw={Graph:R0(),version:AH()}),lw}var cw,qE;function MH(){if(qE)return cw;qE=1;var e=yr(),t=R0();cw={write:n,read:i};function n(c){var u={options:{directed:c.isDirected(),multigraph:c.isMultigraph(),compound:c.isCompound()},nodes:r(c),edges:a(c)};return e.isUndefined(c.graph())||(u.value=e.clone(c.graph())),u}function r(c){return e.map(c.nodes(),function(u){var f=c.node(u),p=c.parent(u),h={v:u};return e.isUndefined(f)||(h.value=f),e.isUndefined(p)||(h.parent=p),h})}function a(c){return e.map(c.edges(),function(u){var f=c.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(f)||(p.value=f),p})}function i(c){var u=new t(c.options).setGraph(c.value);return e.each(c.nodes,function(f){u.setNode(f.v,f.value),f.parent&&u.setParent(f.v,f.parent)}),e.each(c.edges,function(f){u.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),u}return cw}var uw,FE;function IH(){if(FE)return uw;FE=1;var e=yr();uw=t;function t(n){var r={},a=[],i;function c(u){e.has(r,u)||(r[u]=!0,i.push(u),e.each(n.successors(u),c),e.each(n.predecessors(u),c))}return e.each(n.nodes(),function(u){i=[],c(u),i.length&&a.push(i)}),a}return uw}var dw,BE;function hM(){if(BE)return dw;BE=1;var e=yr();dw=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,r){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var i=this._arr,c=i.length;return a[n]=c,i.push({key:n,priority:r}),this._decrease(c),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,r){var a=this._keyIndices[n];if(r>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+r);this._arr[a].priority=r,this._decrease(a)},t.prototype._heapify=function(n){var r=this._arr,a=2*n,i=a+1,c=n;a<r.length&&(c=r[a].priority<r[c].priority?a:c,i<r.length&&(c=r[i].priority<r[c].priority?i:c),c!==n&&(this._swap(n,c),this._heapify(c)))},t.prototype._decrease=function(n){for(var r=this._arr,a=r[n].priority,i;n!==0&&(i=n>>1,!(r[i].priority<a));)this._swap(n,i),n=i},t.prototype._swap=function(n,r){var a=this._arr,i=this._keyIndices,c=a[n],u=a[r];a[n]=u,a[r]=c,i[u.key]=n,i[c.key]=r},dw}var hw,zE;function fM(){if(zE)return hw;zE=1;var e=yr(),t=hM();hw=r;var n=e.constant(1);function r(i,c,u,f){return a(i,String(c),u||n,f||function(p){return i.outEdges(p)})}function a(i,c,u,f){var p={},h=new t,m,y,w=function(N){var _=N.v!==m?N.v:N.w,S=p[_],b=u(N),j=y.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+b);j<S.distance&&(S.distance=j,S.predecessor=m,h.decrease(_,j))};for(i.nodes().forEach(function(N){var _=N===c?0:Number.POSITIVE_INFINITY;p[N]={distance:_},h.add(N,_)});h.size()>0&&(m=h.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(w);return p}return hw}var fw,UE;function $H(){if(UE)return fw;UE=1;var e=fM(),t=yr();fw=n;function n(r,a,i){return t.transform(r.nodes(),function(c,u){c[u]=e(r,u,a,i)},{})}return fw}var pw,WE;function pM(){if(WE)return pw;WE=1;var e=yr();pw=t;function t(n){var r=0,a=[],i={},c=[];function u(f){var p=i[f]={onStack:!0,lowlink:r,index:r++};if(a.push(f),n.successors(f).forEach(function(y){e.has(i,y)?i[y].onStack&&(p.lowlink=Math.min(p.lowlink,i[y].index)):(u(y),p.lowlink=Math.min(p.lowlink,i[y].lowlink))}),p.lowlink===p.index){var h=[],m;do m=a.pop(),i[m].onStack=!1,h.push(m);while(f!==m);c.push(h)}}return n.nodes().forEach(function(f){e.has(i,f)||u(f)}),c}return pw}var mw,HE;function OH(){if(HE)return mw;HE=1;var e=yr(),t=pM();mw=n;function n(r){return e.filter(t(r),function(a){return a.length>1||a.length===1&&r.hasEdge(a[0],a[0])})}return mw}var gw,GE;function PH(){if(GE)return gw;GE=1;var e=yr();gw=n;var t=e.constant(1);function n(a,i,c){return r(a,i||t,c||function(u){return a.outEdges(u)})}function r(a,i,c){var u={},f=a.nodes();return f.forEach(function(p){u[p]={},u[p][p]={distance:0},f.forEach(function(h){p!==h&&(u[p][h]={distance:Number.POSITIVE_INFINITY})}),c(p).forEach(function(h){var m=h.v===p?h.w:h.v,y=i(h);u[p][m]={distance:y,predecessor:p}})}),f.forEach(function(p){var h=u[p];f.forEach(function(m){var y=u[m];f.forEach(function(w){var N=y[p],_=h[w],S=y[w],b=N.distance+_.distance;b<S.distance&&(S.distance=b,S.predecessor=_.predecessor)})})}),u}return gw}var yw,VE;function mM(){if(VE)return yw;VE=1;var e=yr();yw=t,t.CycleException=n;function t(r){var a={},i={},c=[];function u(f){if(e.has(i,f))throw new n;e.has(a,f)||(i[f]=!0,a[f]=!0,e.each(r.predecessors(f),u),delete i[f],c.push(f))}if(e.each(r.sinks(),u),e.size(a)!==r.nodeCount())throw new n;return c}function n(){}return n.prototype=new Error,yw}var ww,KE;function LH(){if(KE)return ww;KE=1;var e=mM();ww=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return ww}var vw,YE;function gM(){if(YE)return vw;YE=1;var e=yr();vw=t;function t(r,a,i){e.isArray(a)||(a=[a]);var c=(r.isDirected()?r.successors:r.neighbors).bind(r),u=[],f={};return e.each(a,function(p){if(!r.hasNode(p))throw new Error("Graph does not have node: "+p);n(r,p,i==="post",f,c,u)}),u}function n(r,a,i,c,u,f){e.has(c,a)||(c[a]=!0,i||f.push(a),e.each(u(a),function(p){n(r,p,i,c,u,f)}),i&&f.push(a))}return vw}var xw,XE;function DH(){if(XE)return xw;XE=1;var e=gM();xw=t;function t(n,r){return e(n,r,"post")}return xw}var bw,ZE;function qH(){if(ZE)return bw;ZE=1;var e=gM();bw=t;function t(n,r){return e(n,r,"pre")}return bw}var kw,QE;function FH(){if(QE)return kw;QE=1;var e=yr(),t=R0(),n=hM();kw=r;function r(a,i){var c=new t,u={},f=new n,p;function h(y){var w=y.v===p?y.w:y.v,N=f.priority(w);if(N!==void 0){var _=i(y);_<N&&(u[w]=p,f.decrease(w,_))}}if(a.nodeCount()===0)return c;e.each(a.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),c.setNode(y)}),f.decrease(a.nodes()[0],0);for(var m=!1;f.size()>0;){if(p=f.removeMin(),e.has(u,p))c.setEdge(p,u[p]);else{if(m)throw new Error("Input graph is not connected: "+a);m=!0}a.nodeEdges(p).forEach(h)}return c}return kw}var _w,JE;function BH(){return JE||(JE=1,_w={components:IH(),dijkstra:fM(),dijkstraAll:$H(),findCycles:OH(),floydWarshall:PH(),isAcyclic:LH(),postorder:DH(),preorder:qH(),prim:FH(),tarjan:pM(),topsort:mM()}),_w}var Nw,eC;function zH(){if(eC)return Nw;eC=1;var e=RH();return Nw={Graph:e.Graph,json:MH(),alg:BH(),version:e.version},Nw}var Sw,tC;function Dr(){if(tC)return Sw;tC=1;var e;if(typeof m0=="function")try{e=zH()}catch{}return e||(e=window.graphlib),Sw=e,Sw}var jw,nC;function UH(){if(nC)return jw;nC=1;var e=BR(),t=1,n=4;function r(a){return e(a,t|n)}return jw=r,jw}var Ew,rC;function $h(){if(rC)return Ew;rC=1;var e=Ui(),t=Bs(),n=Sh(),r=gr();function a(i,c,u){if(!r(u))return!1;var f=typeof c;return(f=="number"?t(u)&&n(c,u.length):f=="string"&&c in u)?e(u[c],i):!1}return Ew=a,Ew}var Cw,sC;function WH(){if(sC)return Cw;sC=1;var e=Ih(),t=Ui(),n=$h(),r=No(),a=Object.prototype,i=a.hasOwnProperty,c=e(function(u,f){u=Object(u);var p=-1,h=f.length,m=h>2?f[2]:void 0;for(m&&n(f[0],f[1],m)&&(h=1);++p<h;)for(var y=f[p],w=r(y),N=-1,_=w.length;++N<_;){var S=w[N],b=u[S];(b===void 0||t(b,a[S])&&!i.call(u,S))&&(u[S]=y[S])}return u});return Cw=c,Cw}var Tw,aC;function HH(){if(aC)return Tw;aC=1;var e=zs(),t=Bs(),n=Aa();function r(a){return function(i,c,u){var f=Object(i);if(!t(i)){var p=e(c,3);i=n(i),c=function(m){return p(f[m],m,f)}}var h=a(i,c,u);return h>-1?f[p?i[h]:h]:void 0}}return Tw=r,Tw}var Aw,oC;function GH(){if(oC)return Aw;oC=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Aw=t,Aw}var Rw,iC;function VH(){if(iC)return Rw;iC=1;var e=GH(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Rw=n,Rw}var Mw,lC;function KH(){if(lC)return Mw;lC=1;var e=VH(),t=gr(),n=Vi(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;function f(p){if(typeof p=="number")return p;if(n(p))return r;if(t(p)){var h=typeof p.valueOf=="function"?p.valueOf():p;p=t(h)?h+"":h}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=i.test(p);return m||c.test(p)?u(p.slice(2),m?2:8):a.test(p)?r:+p}return Mw=f,Mw}var Iw,cC;function yM(){if(cC)return Iw;cC=1;var e=KH(),t=1/0,n=17976931348623157e292;function r(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*n}return a===a?a:0}return Iw=r,Iw}var $w,uC;function YH(){if(uC)return $w;uC=1;var e=yM();function t(n){var r=e(n),a=r%1;return r===r?a?r-a:r:0}return $w=t,$w}var Ow,dC;function XH(){if(dC)return Ow;dC=1;var e=cM(),t=zs(),n=YH(),r=Math.max;function a(i,c,u){var f=i==null?0:i.length;if(!f)return-1;var p=u==null?0:n(u);return p<0&&(p=r(f+p,0)),e(i,t(c,3),p)}return Ow=a,Ow}var Pw,hC;function ZH(){if(hC)return Pw;hC=1;var e=HH(),t=XH(),n=e(t);return Pw=n,Pw}var Lw,fC;function wM(){if(fC)return Lw;fC=1;var e=A0();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return Lw=t,Lw}var Dw,pC;function QH(){if(pC)return Dw;pC=1;var e=j0(),t=zR(),n=No();function r(a,i){return a==null?a:e(a,t(i),n)}return Dw=r,Dw}var qw,mC;function JH(){if(mC)return qw;mC=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return qw=e,qw}var Fw,gC;function e7(){if(gC)return Fw;gC=1;var e=_h(),t=E0(),n=zs();function r(a,i){var c={};return i=n(i,3),t(a,function(u,f,p){e(c,f,i(u,f,p))}),c}return Fw=r,Fw}var Bw,yC;function M0(){if(yC)return Bw;yC=1;var e=Vi();function t(n,r,a){for(var i=-1,c=n.length;++i<c;){var u=n[i],f=r(u);if(f!=null&&(p===void 0?f===f&&!e(f):a(f,p)))var p=f,h=u}return h}return Bw=t,Bw}var zw,wC;function t7(){if(wC)return zw;wC=1;function e(t,n){return t>n}return zw=e,zw}var Uw,vC;function n7(){if(vC)return Uw;vC=1;var e=M0(),t=t7(),n=So();function r(a){return a&&a.length?e(a,n,t):void 0}return Uw=r,Uw}var Ww,xC;function vM(){if(xC)return Ww;xC=1;var e=_h(),t=Ui();function n(r,a,i){(i!==void 0&&!t(r[a],i)||i===void 0&&!(a in r))&&e(r,a,i)}return Ww=n,Ww}var Hw,bC;function r7(){if(bC)return Hw;bC=1;var e=ko(),t=Ch(),n=ps(),r="[object Object]",a=Function.prototype,i=Object.prototype,c=a.toString,u=i.hasOwnProperty,f=c.call(Object);function p(h){if(!n(h)||e(h)!=r)return!1;var m=t(h);if(m===null)return!0;var y=u.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&c.call(y)==f}return Hw=p,Hw}var Gw,kC;function xM(){if(kC)return Gw;kC=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Gw=e,Gw}var Vw,_C;function s7(){if(_C)return Vw;_C=1;var e=jc(),t=No();function n(r){return e(r,t(r))}return Vw=n,Vw}var Kw,NC;function a7(){if(NC)return Kw;NC=1;var e=vM(),t=TR(),n=DR(),r=AR(),a=FR(),i=Ec(),c=Ut(),u=uM(),f=Hi(),p=Sc(),h=gr(),m=r7(),y=Cc(),w=xM(),N=s7();function _(S,b,j,E,C,T,R){var $=w(S,j),D=w(b,j),W=R.get(D);if(W){e(S,j,W);return}var L=T?T($,D,j+"",S,b,R):void 0,V=L===void 0;if(V){var Q=c(D),ee=!Q&&f(D),M=!Q&&!ee&&y(D);L=D,Q||ee||M?c($)?L=$:u($)?L=r($):ee?(V=!1,L=t(D,!0)):M?(V=!1,L=n(D,!0)):L=[]:m(D)||i(D)?(L=$,i($)?L=N($):(!h($)||p($))&&(L=a(D))):V=!1}V&&(R.set(D,L),C(L,D,E,T,R),R.delete(D)),e(S,j,L)}return Kw=_,Kw}var Yw,SC;function o7(){if(SC)return Yw;SC=1;var e=kh(),t=vM(),n=j0(),r=a7(),a=gr(),i=No(),c=xM();function u(f,p,h,m,y){f!==p&&n(p,function(w,N){if(y||(y=new e),a(w))r(f,p,N,h,u,m,y);else{var _=m?m(c(f,N),w,N+"",f,p,y):void 0;_===void 0&&(_=w),t(f,N,_)}},i)}return Yw=u,Yw}var Xw,jC;function i7(){if(jC)return Xw;jC=1;var e=Ih(),t=$h();function n(r){return e(function(a,i){var c=-1,u=i.length,f=u>1?i[u-1]:void 0,p=u>2?i[2]:void 0;for(f=r.length>3&&typeof f=="function"?(u--,f):void 0,p&&t(i[0],i[1],p)&&(f=u<3?void 0:f,u=1),a=Object(a);++c<u;){var h=i[c];h&&r(a,h,c,f)}return a})}return Xw=n,Xw}var Zw,EC;function l7(){if(EC)return Zw;EC=1;var e=o7(),t=i7(),n=t(function(r,a,i){e(r,a,i)});return Zw=n,Zw}var Qw,CC;function bM(){if(CC)return Qw;CC=1;function e(t,n){return t<n}return Qw=e,Qw}var Jw,TC;function c7(){if(TC)return Jw;TC=1;var e=M0(),t=bM(),n=So();function r(a){return a&&a.length?e(a,n,t):void 0}return Jw=r,Jw}var ev,AC;function u7(){if(AC)return ev;AC=1;var e=M0(),t=zs(),n=bM();function r(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return ev=r,ev}var tv,RC;function d7(){if(RC)return tv;RC=1;var e=Fr(),t=function(){return e.Date.now()};return tv=t,tv}var nv,MC;function h7(){if(MC)return nv;MC=1;var e=Nh(),t=Rh(),n=Sh(),r=gr(),a=Tc();function i(c,u,f,p){if(!r(c))return c;u=t(u,c);for(var h=-1,m=u.length,y=m-1,w=c;w!=null&&++h<m;){var N=a(u[h]),_=f;if(N==="__proto__"||N==="constructor"||N==="prototype")return c;if(h!=y){var S=w[N];_=p?p(S,N,w):void 0,_===void 0&&(_=r(S)?S:n(u[h+1])?[]:{})}e(w,N,_),w=w[N]}return c}return nv=i,nv}var rv,IC;function f7(){if(IC)return rv;IC=1;var e=Mh(),t=h7(),n=Rh();function r(a,i,c){for(var u=-1,f=i.length,p={};++u<f;){var h=i[u],m=e(a,h);c(m,h)&&t(p,n(h,a),m)}return p}return rv=r,rv}var sv,$C;function p7(){if($C)return sv;$C=1;var e=f7(),t=JR();function n(r,a){return e(r,a,function(i,c){return t(r,c)})}return sv=n,sv}var av,OC;function m7(){if(OC)return av;OC=1;var e=wM(),t=iM(),n=lM();function r(a){return n(t(a,void 0,e),a+"")}return av=r,av}var ov,PC;function g7(){if(PC)return ov;PC=1;var e=p7(),t=m7(),n=t(function(r,a){return r==null?{}:e(r,a)});return ov=n,ov}var iv,LC;function y7(){if(LC)return iv;LC=1;var e=Math.ceil,t=Math.max;function n(r,a,i,c){for(var u=-1,f=t(e((a-r)/(i||1)),0),p=Array(f);f--;)p[c?f:++u]=r,r+=i;return p}return iv=n,iv}var lv,DC;function w7(){if(DC)return lv;DC=1;var e=y7(),t=$h(),n=yM();function r(a){return function(i,c,u){return u&&typeof u!="number"&&t(i,c,u)&&(c=u=void 0),i=n(i),c===void 0?(c=i,i=0):c=n(c),u=u===void 0?i<c?1:-1:n(u),e(i,c,u,a)}}return lv=r,lv}var cv,qC;function v7(){if(qC)return cv;qC=1;var e=w7(),t=e();return cv=t,cv}var uv,FC;function x7(){if(FC)return uv;FC=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return uv=e,uv}var dv,BC;function b7(){if(BC)return dv;BC=1;var e=Vi();function t(n,r){if(n!==r){var a=n!==void 0,i=n===null,c=n===n,u=e(n),f=r!==void 0,p=r===null,h=r===r,m=e(r);if(!p&&!m&&!u&&n>r||u&&f&&h&&!p&&!m||i&&f&&h||!a&&h||!c)return 1;if(!i&&!u&&!m&&n<r||m&&a&&c&&!i&&!u||p&&a&&c||!f&&c||!h)return-1}return 0}return dv=t,dv}var hv,zC;function k7(){if(zC)return hv;zC=1;var e=b7();function t(n,r,a){for(var i=-1,c=n.criteria,u=r.criteria,f=c.length,p=a.length;++i<f;){var h=e(c[i],u[i]);if(h){if(i>=p)return h;var m=a[i];return h*(m=="desc"?-1:1)}}return n.index-r.index}return hv=t,hv}var fv,UC;function _7(){if(UC)return fv;UC=1;var e=Ah(),t=Mh(),n=zs(),r=sM(),a=x7(),i=jh(),c=k7(),u=So(),f=Ut();function p(h,m,y){m.length?m=e(m,function(_){return f(_)?function(S){return t(S,_.length===1?_[0]:_)}:_}):m=[u];var w=-1;m=e(m,i(n));var N=r(h,function(_,S,b){var j=e(m,function(E){return E(_)});return{criteria:j,index:++w,value:_}});return a(N,function(_,S){return c(_,S,y)})}return fv=p,fv}var pv,WC;function N7(){if(WC)return pv;WC=1;var e=A0(),t=_7(),n=Ih(),r=$h(),a=n(function(i,c){if(i==null)return[];var u=c.length;return u>1&&r(i,c[0],c[1])?c=[]:u>2&&r(c[0],c[1],c[2])&&(c=[c[0]]),t(i,e(c,1),[])});return pv=a,pv}var mv,HC;function S7(){if(HC)return mv;HC=1;var e=ZR(),t=0;function n(r){var a=++t;return e(r)+a}return mv=n,mv}var gv,GC;function j7(){if(GC)return gv;GC=1;function e(t,n,r){for(var a=-1,i=t.length,c=n.length,u={};++a<i;){var f=a<c?n[a]:void 0;r(u,t[a],f)}return u}return gv=e,gv}var yv,VC;function E7(){if(VC)return yv;VC=1;var e=Nh(),t=j7();function n(r,a){return t(r||[],a||[],e)}return yv=n,yv}var wv,KC;function Tt(){if(KC)return wv;KC=1;var e;if(typeof m0=="function")try{e={cloneDeep:UH(),constant:S0(),defaults:WH(),each:WR(),filter:tM(),find:ZH(),flatten:wM(),forEach:UR(),forIn:QH(),has:nM(),isUndefined:rM(),last:JH(),map:aM(),mapValues:e7(),max:n7(),merge:l7(),min:c7(),minBy:u7(),now:d7(),pick:g7(),range:v7(),reduce:oM(),sortBy:N7(),uniqueId:S7(),values:dM(),zipObject:E7()}}catch{}return e||(e=window._),wv=e,wv}var vv,YC;function C7(){if(YC)return vv;YC=1,vv=e;function e(){var r={};r._next=r._prev=r,this._sentinel=r}e.prototype.dequeue=function(){var r=this._sentinel,a=r._prev;if(a!==r)return t(a),a},e.prototype.enqueue=function(r){var a=this._sentinel;r._prev&&r._next&&t(r),r._next=a._next,a._next._prev=r,a._next=r,r._prev=a},e.prototype.toString=function(){for(var r=[],a=this._sentinel,i=a._prev;i!==a;)r.push(JSON.stringify(i,n)),i=i._prev;return"["+r.join(", ")+"]"};function t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,a){if(r!=="_next"&&r!=="_prev")return a}return vv}var xv,XC;function T7(){if(XC)return xv;XC=1;var e=Tt(),t=Dr().Graph,n=C7();xv=a;var r=e.constant(1);function a(p,h){if(p.nodeCount()<=1)return[];var m=u(p,h||r),y=i(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function i(p,h,m){for(var y=[],w=h[h.length-1],N=h[0],_;p.nodeCount();){for(;_=N.dequeue();)c(p,h,m,_);for(;_=w.dequeue();)c(p,h,m,_);if(p.nodeCount()){for(var S=h.length-2;S>0;--S)if(_=h[S].dequeue(),_){y=y.concat(c(p,h,m,_,!0));break}}}return y}function c(p,h,m,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var S=p.edge(_),b=p.node(_.v);w&&N.push({v:_.v,w:_.w}),b.out-=S,f(h,m,b)}),e.forEach(p.outEdges(y.v),function(_){var S=p.edge(_),b=_.w,j=p.node(b);j.in-=S,f(h,m,j)}),p.removeNode(y.v),N}function u(p,h){var m=new t,y=0,w=0;e.forEach(p.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var b=m.edge(S.v,S.w)||0,j=h(S),E=b+j;m.setEdge(S.v,S.w,E),w=Math.max(w,m.node(S.v).out+=j),y=Math.max(y,m.node(S.w).in+=j)});var N=e.range(w+y+3).map(function(){return new n}),_=y+1;return e.forEach(m.nodes(),function(S){f(N,_,m.node(S))}),{graph:m,buckets:N,zeroIdx:_}}function f(p,h,m){m.out?m.in?p[m.out-m.in+h].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return xv}var bv,ZC;function A7(){if(ZC)return bv;ZC=1;var e=Tt(),t=T7();bv={run:n,undo:a};function n(i){var c=i.graph().acyclicer==="greedy"?t(i,u(i)):r(i);e.forEach(c,function(f){var p=i.edge(f);i.removeEdge(f),p.forwardName=f.name,p.reversed=!0,i.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function u(f){return function(p){return f.edge(p).weight}}}function r(i){var c=[],u={},f={};function p(h){e.has(f,h)||(f[h]=!0,u[h]=!0,e.forEach(i.outEdges(h),function(m){e.has(u,m.w)?c.push(m):p(m.w)}),delete u[h])}return e.forEach(i.nodes(),p),c}function a(i){e.forEach(i.edges(),function(c){var u=i.edge(c);if(u.reversed){i.removeEdge(c);var f=u.forwardName;delete u.reversed,delete u.forwardName,i.setEdge(c.w,c.v,u,f)}})}return bv}var kv,QC;function Fn(){if(QC)return kv;QC=1;var e=Tt(),t=Dr().Graph;kv={addDummyNode:n,simplify:r,asNonCompoundGraph:a,successorWeights:i,predecessorWeights:c,intersectRect:u,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:m,maxRank:y,partition:w,time:N,notime:_};function n(S,b,j,E){var C;do C=e.uniqueId(E);while(S.hasNode(C));return j.dummy=b,S.setNode(C,j),C}function r(S){var b=new t().setGraph(S.graph());return e.forEach(S.nodes(),function(j){b.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){var E=b.edge(j.v,j.w)||{weight:0,minlen:1},C=S.edge(j);b.setEdge(j.v,j.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),b}function a(S){var b=new t({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(j){S.children(j).length||b.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){b.setEdge(j,S.edge(j))}),b}function i(S){var b=e.map(S.nodes(),function(j){var E={};return e.forEach(S.outEdges(j),function(C){E[C.w]=(E[C.w]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),b)}function c(S){var b=e.map(S.nodes(),function(j){var E={};return e.forEach(S.inEdges(j),function(C){E[C.v]=(E[C.v]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),b)}function u(S,b){var j=S.x,E=S.y,C=b.x-j,T=b.y-E,R=S.width/2,$=S.height/2;if(!C&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var D,W;return Math.abs(T)*R>Math.abs(C)*$?(T<0&&($=-$),D=$*C/T,W=$):(C<0&&(R=-R),D=R,W=R*T/C),{x:j+D,y:E+W}}function f(S){var b=e.map(e.range(y(S)+1),function(){return[]});return e.forEach(S.nodes(),function(j){var E=S.node(j),C=E.rank;e.isUndefined(C)||(b[C][E.order]=j)}),b}function p(S){var b=e.min(e.map(S.nodes(),function(j){return S.node(j).rank}));e.forEach(S.nodes(),function(j){var E=S.node(j);e.has(E,"rank")&&(E.rank-=b)})}function h(S){var b=e.min(e.map(S.nodes(),function(T){return S.node(T).rank})),j=[];e.forEach(S.nodes(),function(T){var R=S.node(T).rank-b;j[R]||(j[R]=[]),j[R].push(T)});var E=0,C=S.graph().nodeRankFactor;e.forEach(j,function(T,R){e.isUndefined(T)&&R%C!==0?--E:E&&e.forEach(T,function($){S.node($).rank+=E})})}function m(S,b,j,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=j,C.order=E),n(S,"border",C,b)}function y(S){return e.max(e.map(S.nodes(),function(b){var j=S.node(b).rank;if(!e.isUndefined(j))return j}))}function w(S,b){var j={lhs:[],rhs:[]};return e.forEach(S,function(E){b(E)?j.lhs.push(E):j.rhs.push(E)}),j}function N(S,b){var j=e.now();try{return b()}finally{console.log(S+" time: "+(e.now()-j)+"ms")}}function _(S,b){return b()}return kv}var _v,JC;function R7(){if(JC)return _v;JC=1;var e=Tt(),t=Fn();_v={run:n,undo:a};function n(i){i.graph().dummyChains=[],e.forEach(i.edges(),function(c){r(i,c)})}function r(i,c){var u=c.v,f=i.node(u).rank,p=c.w,h=i.node(p).rank,m=c.name,y=i.edge(c),w=y.labelRank;if(h!==f+1){i.removeEdge(c);var N,_,S;for(S=0,++f;f<h;++S,++f)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:c,rank:f},N=t.addDummyNode(i,"edge",_,"_d"),f===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),i.setEdge(u,N,{weight:y.weight},m),S===0&&i.graph().dummyChains.push(N),u=N;i.setEdge(u,p,{weight:y.weight},m)}}function a(i){e.forEach(i.graph().dummyChains,function(c){var u=i.node(c),f=u.edgeLabel,p;for(i.setEdge(u.edgeObj,f);u.dummy;)p=i.successors(c)[0],i.removeNode(c),f.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(f.x=u.x,f.y=u.y,f.width=u.width,f.height=u.height),c=p,u=i.node(c)})}return _v}var Nv,eT;function Qd(){if(eT)return Nv;eT=1;var e=Tt();Nv={longestPath:t,slack:n};function t(r){var a={};function i(c){var u=r.node(c);if(e.has(a,c))return u.rank;a[c]=!0;var f=e.min(e.map(r.outEdges(c),function(p){return i(p.w)-r.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),u.rank=f}e.forEach(r.sources(),i)}function n(r,a){return r.node(a.w).rank-r.node(a.v).rank-r.edge(a).minlen}return Nv}var Sv,tT;function kM(){if(tT)return Sv;tT=1;var e=Tt(),t=Dr().Graph,n=Qd().slack;Sv=r;function r(u){var f=new t({directed:!1}),p=u.nodes()[0],h=u.nodeCount();f.setNode(p,{});for(var m,y;a(f,u)<h;)m=i(f,u),y=f.hasNode(m.v)?n(u,m):-n(u,m),c(f,u,y);return f}function a(u,f){function p(h){e.forEach(f.nodeEdges(h),function(m){var y=m.v,w=h===y?m.w:y;!u.hasNode(w)&&!n(f,m)&&(u.setNode(w,{}),u.setEdge(h,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function i(u,f){return e.minBy(f.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(f,p)})}function c(u,f,p){e.forEach(u.nodes(),function(h){f.node(h).rank+=p})}return Sv}var jv,nT;function M7(){if(nT)return jv;nT=1;var e=Tt(),t=kM(),n=Qd().slack,r=Qd().longestPath,a=Dr().alg.preorder,i=Dr().alg.postorder,c=Fn().simplify;jv=u,u.initLowLimValues=m,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=w,u.enterEdge=N,u.exchangeEdges=_;function u(E){E=c(E),r(E);var C=t(E);m(C),f(C,E);for(var T,R;T=w(C);)R=N(C,E,T),_(C,E,T,R)}function f(E,C){var T=i(E,E.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(R){p(E,C,R)})}function p(E,C,T){var R=E.node(T),$=R.parent;E.edge(T,$).cutvalue=h(E,C,T)}function h(E,C,T){var R=E.node(T),$=R.parent,D=!0,W=C.edge(T,$),L=0;return W||(D=!1,W=C.edge($,T)),L=W.weight,e.forEach(C.nodeEdges(T),function(V){var Q=V.v===T,ee=Q?V.w:V.v;if(ee!==$){var M=Q===D,X=C.edge(V).weight;if(L+=M?X:-X,b(E,T,ee)){var H=E.edge(T,ee).cutvalue;L+=M?-H:H}}}),L}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,T,R,$){var D=T,W=E.node(R);return C[R]=!0,e.forEach(E.neighbors(R),function(L){e.has(C,L)||(T=y(E,C,T,L,R))}),W.low=D,W.lim=T++,$?W.parent=$:delete W.parent,T}function w(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function N(E,C,T){var R=T.v,$=T.w;C.hasEdge(R,$)||(R=T.w,$=T.v);var D=E.node(R),W=E.node($),L=D,V=!1;D.lim>W.lim&&(L=W,V=!0);var Q=e.filter(C.edges(),function(ee){return V===j(E,E.node(ee.v),L)&&V!==j(E,E.node(ee.w),L)});return e.minBy(Q,function(ee){return n(C,ee)})}function _(E,C,T,R){var $=T.v,D=T.w;E.removeEdge($,D),E.setEdge(R.v,R.w,{}),m(E),f(E,C),S(E,C)}function S(E,C){var T=e.find(E.nodes(),function($){return!C.node($).parent}),R=a(E,T);R=R.slice(1),e.forEach(R,function($){var D=E.node($).parent,W=C.edge($,D),L=!1;W||(W=C.edge(D,$),L=!0),C.node($).rank=C.node(D).rank+(L?W.minlen:-W.minlen)})}function b(E,C,T){return E.hasEdge(C,T)}function j(E,C,T){return T.low<=C.lim&&C.lim<=T.lim}return jv}var Ev,rT;function I7(){if(rT)return Ev;rT=1;var e=Qd(),t=e.longestPath,n=kM(),r=M7();Ev=a;function a(f){switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":c(f);break;case"longest-path":i(f);break;default:u(f)}}var i=t;function c(f){t(f),n(f)}function u(f){r(f)}return Ev}var Cv,sT;function $7(){if(sT)return Cv;sT=1;var e=Tt();Cv=t;function t(a){var i=r(a);e.forEach(a.graph().dummyChains,function(c){for(var u=a.node(c),f=u.edgeObj,p=n(a,i,f.v,f.w),h=p.path,m=p.lca,y=0,w=h[y],N=!0;c!==f.w;){if(u=a.node(c),N){for(;(w=h[y])!==m&&a.node(w).maxRank<u.rank;)y++;w===m&&(N=!1)}if(!N){for(;y<h.length-1&&a.node(w=h[y+1]).minRank<=u.rank;)y++;w=h[y]}a.setParent(c,w),c=a.successors(c)[0]}})}function n(a,i,c,u){var f=[],p=[],h=Math.min(i[c].low,i[u].low),m=Math.max(i[c].lim,i[u].lim),y,w;y=c;do y=a.parent(y),f.push(y);while(y&&(i[y].low>h||m>i[y].lim));for(w=y,y=u;(y=a.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function r(a){var i={},c=0;function u(f){var p=c;e.forEach(a.children(f),u),i[f]={low:p,lim:c++}}return e.forEach(a.children(),u),i}return Cv}var Tv,aT;function O7(){if(aT)return Tv;aT=1;var e=Tt(),t=Fn();Tv={run:n,cleanup:c};function n(u){var f=t.addDummyNode(u,"root",{},"_root"),p=a(u),h=e.max(e.values(p))-1,m=2*h+1;u.graph().nestingRoot=f,e.forEach(u.edges(),function(w){u.edge(w).minlen*=m});var y=i(u)+1;e.forEach(u.children(),function(w){r(u,f,m,y,h,p,w)}),u.graph().nodeRankFactor=m}function r(u,f,p,h,m,y,w){var N=u.children(w);if(!N.length){w!==f&&u.setEdge(f,w,{weight:0,minlen:p});return}var _=t.addBorderNode(u,"_bt"),S=t.addBorderNode(u,"_bb"),b=u.node(w);u.setParent(_,w),b.borderTop=_,u.setParent(S,w),b.borderBottom=S,e.forEach(N,function(j){r(u,f,p,h,m,y,j);var E=u.node(j),C=E.borderTop?E.borderTop:j,T=E.borderBottom?E.borderBottom:j,R=E.borderTop?h:2*h,$=C!==T?1:m-y[w]+1;u.setEdge(_,C,{weight:R,minlen:$,nestingEdge:!0}),u.setEdge(T,S,{weight:R,minlen:$,nestingEdge:!0})}),u.parent(w)||u.setEdge(f,_,{weight:0,minlen:m+y[w]})}function a(u){var f={};function p(h,m){var y=u.children(h);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),f[h]=m}return e.forEach(u.children(),function(h){p(h,1)}),f}function i(u){return e.reduce(u.edges(),function(f,p){return f+u.edge(p).weight},0)}function c(u){var f=u.graph();u.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(u.edges(),function(p){var h=u.edge(p);h.nestingEdge&&u.removeEdge(p)})}return Tv}var Av,oT;function P7(){if(oT)return Av;oT=1;var e=Tt(),t=Fn();Av=n;function n(a){function i(c){var u=a.children(c),f=a.node(c);if(u.length&&e.forEach(u,i),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,h=f.maxRank+1;p<h;++p)r(a,"borderLeft","_bl",c,f,p),r(a,"borderRight","_br",c,f,p)}}e.forEach(a.children(),i)}function r(a,i,c,u,f,p){var h={width:0,height:0,rank:p,borderType:i},m=f[i][p-1],y=t.addDummyNode(a,"border",h,c);f[i][p]=y,a.setParent(y,u),m&&a.setEdge(m,y,{weight:1})}return Av}var Rv,iT;function L7(){if(iT)return Rv;iT=1;var e=Tt();Rv={adjust:t,undo:n};function t(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&r(p)}function n(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&i(p),(h==="lr"||h==="rl")&&(u(p),r(p))}function r(p){e.forEach(p.nodes(),function(h){a(p.node(h))}),e.forEach(p.edges(),function(h){a(p.edge(h))})}function a(p){var h=p.width;p.width=p.height,p.height=h}function i(p){e.forEach(p.nodes(),function(h){c(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,c),e.has(m,"y")&&c(m)})}function c(p){p.y=-p.y}function u(p){e.forEach(p.nodes(),function(h){f(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,f),e.has(m,"x")&&f(m)})}function f(p){var h=p.x;p.x=p.y,p.y=h}return Rv}var Mv,lT;function D7(){if(lT)return Mv;lT=1;var e=Tt();Mv=t;function t(n){var r={},a=e.filter(n.nodes(),function(p){return!n.children(p).length}),i=e.max(e.map(a,function(p){return n.node(p).rank})),c=e.map(e.range(i+1),function(){return[]});function u(p){if(!e.has(r,p)){r[p]=!0;var h=n.node(p);c[h.rank].push(p),e.forEach(n.successors(p),u)}}var f=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(f,u),c}return Mv}var Iv,cT;function q7(){if(cT)return Iv;cT=1;var e=Tt();Iv=t;function t(r,a){for(var i=0,c=1;c<a.length;++c)i+=n(r,a[c-1],a[c]);return i}function n(r,a,i){for(var c=e.zipObject(i,e.map(i,function(y,w){return w})),u=e.flatten(e.map(a,function(y){return e.sortBy(e.map(r.outEdges(y),function(w){return{pos:c[w.w],weight:r.edge(w).weight}}),"pos")}),!0),f=1;f<i.length;)f<<=1;var p=2*f-1;f-=1;var h=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(u.forEach(function(y){var w=y.pos+f;h[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=h[w+1]),w=w-1>>1,h[w]+=y.weight;m+=y.weight*N})),m}return Iv}var $v,uT;function F7(){if(uT)return $v;uT=1;var e=Tt();$v=t;function t(n,r){return e.map(r,function(a){var i=n.inEdges(a);if(i.length){var c=e.reduce(i,function(u,f){var p=n.edge(f),h=n.node(f.v);return{sum:u.sum+p.weight*h.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}return $v}var Ov,dT;function B7(){if(dT)return Ov;dT=1;var e=Tt();Ov=t;function t(a,i){var c={};e.forEach(a,function(f,p){var h=c[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(h.barycenter=f.barycenter,h.weight=f.weight)}),e.forEach(i.edges(),function(f){var p=c[f.v],h=c[f.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(c[f.w]))});var u=e.filter(c,function(f){return!f.indegree});return n(u)}function n(a){var i=[];function c(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&r(p,h)}}function u(p){return function(h){h.in.push(p),--h.indegree===0&&a.push(h)}}for(;a.length;){var f=a.pop();i.push(f),e.forEach(f.in.reverse(),c(f)),e.forEach(f.out,u(f))}return e.map(e.filter(i,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function r(a,i){var c=0,u=0;a.weight&&(c+=a.barycenter*a.weight,u+=a.weight),i.weight&&(c+=i.barycenter*i.weight,u+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=c/u,a.weight=u,a.i=Math.min(i.i,a.i),i.merged=!0}return Ov}var Pv,hT;function z7(){if(hT)return Pv;hT=1;var e=Tt(),t=Fn();Pv=n;function n(i,c){var u=t.partition(i,function(_){return e.has(_,"barycenter")}),f=u.lhs,p=e.sortBy(u.rhs,function(_){return-_.i}),h=[],m=0,y=0,w=0;f.sort(a(!!c)),w=r(h,p,w),e.forEach(f,function(_){w+=_.vs.length,h.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,w=r(h,p,w)});var N={vs:e.flatten(h,!0)};return y&&(N.barycenter=m/y,N.weight=y),N}function r(i,c,u){for(var f;c.length&&(f=e.last(c)).i<=u;)c.pop(),i.push(f.vs),u++;return u}function a(i){return function(c,u){return c.barycenter<u.barycenter?-1:c.barycenter>u.barycenter?1:i?u.i-c.i:c.i-u.i}}return Pv}var Lv,fT;function U7(){if(fT)return Lv;fT=1;var e=Tt(),t=F7(),n=B7(),r=z7();Lv=a;function a(u,f,p,h){var m=u.children(f),y=u.node(f),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,_={};w&&(m=e.filter(m,function(T){return T!==w&&T!==N}));var S=t(u,m);e.forEach(S,function(T){if(u.children(T.v).length){var R=a(u,T.v,p,h);_[T.v]=R,e.has(R,"barycenter")&&c(T,R)}});var b=n(S,p);i(b,_);var j=r(b,h);if(w&&(j.vs=e.flatten([w,j.vs,N],!0),u.predecessors(w).length)){var E=u.node(u.predecessors(w)[0]),C=u.node(u.predecessors(N)[0]);e.has(j,"barycenter")||(j.barycenter=0,j.weight=0),j.barycenter=(j.barycenter*j.weight+E.order+C.order)/(j.weight+2),j.weight+=2}return j}function i(u,f){e.forEach(u,function(p){p.vs=e.flatten(p.vs.map(function(h){return f[h]?f[h].vs:h}),!0)})}function c(u,f){e.isUndefined(u.barycenter)?(u.barycenter=f.barycenter,u.weight=f.weight):(u.barycenter=(u.barycenter*u.weight+f.barycenter*f.weight)/(u.weight+f.weight),u.weight+=f.weight)}return Lv}var Dv,pT;function W7(){if(pT)return Dv;pT=1;var e=Tt(),t=Dr().Graph;Dv=n;function n(a,i,c){var u=r(a),f=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var h=a.node(p),m=a.parent(p);(h.rank===i||h.minRank<=i&&i<=h.maxRank)&&(f.setNode(p),f.setParent(p,m||u),e.forEach(a[c](p),function(y){var w=y.v===p?y.w:y.v,N=f.edge(w,p),_=e.isUndefined(N)?0:N.weight;f.setEdge(w,p,{weight:a.edge(y).weight+_})}),e.has(h,"minRank")&&f.setNode(p,{borderLeft:h.borderLeft[i],borderRight:h.borderRight[i]}))}),f}function r(a){for(var i;a.hasNode(i=e.uniqueId("_root")););return i}return Dv}var qv,mT;function H7(){if(mT)return qv;mT=1;var e=Tt();qv=t;function t(n,r,a){var i={},c;e.forEach(a,function(u){for(var f=n.parent(u),p,h;f;){if(p=n.parent(f),p?(h=i[p],i[p]=f):(h=c,c=f),h&&h!==f){r.setEdge(h,f);return}f=p}})}return qv}var Fv,gT;function G7(){if(gT)return Fv;gT=1;var e=Tt(),t=D7(),n=q7(),r=U7(),a=W7(),i=H7(),c=Dr().Graph,u=Fn();Fv=f;function f(y){var w=u.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),S=t(y);m(y,S);for(var b=Number.POSITIVE_INFINITY,j,E=0,C=0;C<4;++E,++C){h(E%2?N:_,E%4>=2),S=u.buildLayerMatrix(y);var T=n(y,S);T<b&&(C=0,j=e.cloneDeep(S),b=T)}m(y,j)}function p(y,w,N){return e.map(w,function(_){return a(y,_,N)})}function h(y,w){var N=new c;e.forEach(y,function(_){var S=_.graph().root,b=r(_,S,N,w);e.forEach(b.vs,function(j,E){_.node(j).order=E}),i(_,N,b.vs)})}function m(y,w){e.forEach(w,function(N){e.forEach(N,function(_,S){y.node(_).order=S})})}return Fv}var Bv,yT;function V7(){if(yT)return Bv;yT=1;var e=Tt(),t=Dr().Graph,n=Fn();Bv={positionX:N,findType1Conflicts:r,findType2Conflicts:a,addConflict:c,hasConflict:u,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function r(b,j){var E={};function C(T,R){var $=0,D=0,W=T.length,L=e.last(R);return e.forEach(R,function(V,Q){var ee=i(b,V),M=ee?b.node(ee).order:W;(ee||V===L)&&(e.forEach(R.slice(D,Q+1),function(X){e.forEach(b.predecessors(X),function(H){var I=b.node(H),B=I.order;(B<$||M<B)&&!(I.dummy&&b.node(X).dummy)&&c(E,H,X)})}),D=Q+1,$=M)}),R}return e.reduce(j,C),E}function a(b,j){var E={};function C(R,$,D,W,L){var V;e.forEach(e.range($,D),function(Q){V=R[Q],b.node(V).dummy&&e.forEach(b.predecessors(V),function(ee){var M=b.node(ee);M.dummy&&(M.order<W||M.order>L)&&c(E,ee,V)})})}function T(R,$){var D=-1,W,L=0;return e.forEach($,function(V,Q){if(b.node(V).dummy==="border"){var ee=b.predecessors(V);ee.length&&(W=b.node(ee[0]).order,C($,L,Q,D,W),L=Q,D=W)}C($,L,$.length,W,R.length)}),$}return e.reduce(j,T),E}function i(b,j){if(b.node(j).dummy)return e.find(b.predecessors(j),function(E){return b.node(E).dummy})}function c(b,j,E){if(j>E){var C=j;j=E,E=C}var T=b[j];T||(b[j]=T={}),T[E]=!0}function u(b,j,E){if(j>E){var C=j;j=E,E=C}return e.has(b[j],E)}function f(b,j,E,C){var T={},R={},$={};return e.forEach(j,function(D){e.forEach(D,function(W,L){T[W]=W,R[W]=W,$[W]=L})}),e.forEach(j,function(D){var W=-1;e.forEach(D,function(L){var V=C(L);if(V.length){V=e.sortBy(V,function(H){return $[H]});for(var Q=(V.length-1)/2,ee=Math.floor(Q),M=Math.ceil(Q);ee<=M;++ee){var X=V[ee];R[L]===L&&W<$[X]&&!u(E,L,X)&&(R[X]=L,R[L]=T[L]=T[X],W=$[X])}}})}),{root:T,align:R}}function p(b,j,E,C,T){var R={},$=h(b,j,E,T),D=T?"borderLeft":"borderRight";function W(Q,ee){for(var M=$.nodes(),X=M.pop(),H={};X;)H[X]?Q(X):(H[X]=!0,M.push(X),M=M.concat(ee(X))),X=M.pop()}function L(Q){R[Q]=$.inEdges(Q).reduce(function(ee,M){return Math.max(ee,R[M.v]+$.edge(M))},0)}function V(Q){var ee=$.outEdges(Q).reduce(function(X,H){return Math.min(X,R[H.w]-$.edge(H))},Number.POSITIVE_INFINITY),M=b.node(Q);ee!==Number.POSITIVE_INFINITY&&M.borderType!==D&&(R[Q]=Math.max(R[Q],ee))}return W(L,$.predecessors.bind($)),W(V,$.successors.bind($)),e.forEach(C,function(Q){R[Q]=R[E[Q]]}),R}function h(b,j,E,C){var T=new t,R=b.graph(),$=_(R.nodesep,R.edgesep,C);return e.forEach(j,function(D){var W;e.forEach(D,function(L){var V=E[L];if(T.setNode(V),W){var Q=E[W],ee=T.edge(Q,V);T.setEdge(Q,V,Math.max($(b,L,W),ee||0))}W=L})}),T}function m(b,j){return e.minBy(e.values(j),function(E){var C=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(E,function(R,$){var D=S(b,$)/2;C=Math.max(R+D,C),T=Math.min(R-D,T)}),C-T})}function y(b,j){var E=e.values(j),C=e.min(E),T=e.max(E);e.forEach(["u","d"],function(R){e.forEach(["l","r"],function($){var D=R+$,W=b[D],L;if(W!==j){var V=e.values(W);L=$==="l"?C-e.min(V):T-e.max(V),L&&(b[D]=e.mapValues(W,function(Q){return Q+L}))}})})}function w(b,j){return e.mapValues(b.ul,function(E,C){if(j)return b[j.toLowerCase()][C];var T=e.sortBy(e.map(b,C));return(T[1]+T[2])/2})}function N(b){var j=n.buildLayerMatrix(b),E=e.merge(r(b,j),a(b,j)),C={},T;e.forEach(["u","d"],function($){T=$==="u"?j:e.values(j).reverse(),e.forEach(["l","r"],function(D){D==="r"&&(T=e.map(T,function(Q){return e.values(Q).reverse()}));var W=($==="u"?b.predecessors:b.successors).bind(b),L=f(b,T,E,W),V=p(b,T,L.root,L.align,D==="r");D==="r"&&(V=e.mapValues(V,function(Q){return-Q})),C[$+D]=V})});var R=m(b,C);return y(C,R),w(C,b.graph().align)}function _(b,j,E){return function(C,T,R){var $=C.node(T),D=C.node(R),W=0,L;if(W+=$.width/2,e.has($,"labelpos"))switch($.labelpos.toLowerCase()){case"l":L=-$.width/2;break;case"r":L=$.width/2;break}if(L&&(W+=E?L:-L),L=0,W+=($.dummy?j:b)/2,W+=(D.dummy?j:b)/2,W+=D.width/2,e.has(D,"labelpos"))switch(D.labelpos.toLowerCase()){case"l":L=D.width/2;break;case"r":L=-D.width/2;break}return L&&(W+=E?L:-L),L=0,W}}function S(b,j){return b.node(j).width}return Bv}var zv,wT;function K7(){if(wT)return zv;wT=1;var e=Tt(),t=Fn(),n=V7().positionX;zv=r;function r(i){i=t.asNonCompoundGraph(i),a(i),e.forEach(n(i),function(c,u){i.node(u).x=c})}function a(i){var c=t.buildLayerMatrix(i),u=i.graph().ranksep,f=0;e.forEach(c,function(p){var h=e.max(e.map(p,function(m){return i.node(m).height}));e.forEach(p,function(m){i.node(m).y=f+h/2}),f+=h+u})}return zv}var Uv,vT;function Y7(){if(vT)return Uv;vT=1;var e=Tt(),t=A7(),n=R7(),r=I7(),a=Fn().normalizeRanks,i=$7(),c=Fn().removeEmptyRanks,u=O7(),f=P7(),p=L7(),h=G7(),m=K7(),y=Fn(),w=Dr().Graph;Uv=N;function N(G,J){var U=J&&J.debugTiming?y.time:y.notime;U("layout",function(){var ne=U(" buildLayoutGraph",function(){return W(G)});U(" runLayout",function(){_(ne,U)}),U(" updateInputGraph",function(){S(G,ne)})})}function _(G,J){J(" makeSpaceForEdgeLabels",function(){L(G)}),J(" removeSelfEdges",function(){P(G)}),J(" acyclic",function(){t.run(G)}),J(" nestingGraph.run",function(){u.run(G)}),J(" rank",function(){r(y.asNonCompoundGraph(G))}),J(" injectEdgeLabelProxies",function(){V(G)}),J(" removeEmptyRanks",function(){c(G)}),J(" nestingGraph.cleanup",function(){u.cleanup(G)}),J(" normalizeRanks",function(){a(G)}),J(" assignRankMinMax",function(){Q(G)}),J(" removeEdgeLabelProxies",function(){ee(G)}),J(" normalize.run",function(){n.run(G)}),J(" parentDummyChains",function(){i(G)}),J(" addBorderSegments",function(){f(G)}),J(" order",function(){h(G)}),J(" insertSelfEdges",function(){z(G)}),J(" adjustCoordinateSystem",function(){p.adjust(G)}),J(" position",function(){m(G)}),J(" positionSelfEdges",function(){O(G)}),J(" removeBorderNodes",function(){B(G)}),J(" normalize.undo",function(){n.undo(G)}),J(" fixupEdgeLabelCoords",function(){H(G)}),J(" undoCoordinateSystem",function(){p.undo(G)}),J(" translateGraph",function(){M(G)}),J(" assignNodeIntersects",function(){X(G)}),J(" reversePoints",function(){I(G)}),J(" acyclic.undo",function(){t.undo(G)})}function S(G,J){e.forEach(G.nodes(),function(U){var ne=G.node(U),ae=J.node(U);ne&&(ne.x=ae.x,ne.y=ae.y,J.children(U).length&&(ne.width=ae.width,ne.height=ae.height))}),e.forEach(G.edges(),function(U){var ne=G.edge(U),ae=J.edge(U);ne.points=ae.points,e.has(ae,"x")&&(ne.x=ae.x,ne.y=ae.y)}),G.graph().width=J.graph().width,G.graph().height=J.graph().height}var b=["nodesep","edgesep","ranksep","marginx","marginy"],j={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],T={width:0,height:0},R=["minlen","weight","width","height","labeloffset"],$={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},D=["labelpos"];function W(G){var J=new w({multigraph:!0,compound:!0}),U=de(G.graph());return J.setGraph(e.merge({},j,K(U,b),e.pick(U,E))),e.forEach(G.nodes(),function(ne){var ae=de(G.node(ne));J.setNode(ne,e.defaults(K(ae,C),T)),J.setParent(ne,G.parent(ne))}),e.forEach(G.edges(),function(ne){var ae=de(G.edge(ne));J.setEdge(ne,e.merge({},$,K(ae,R),e.pick(ae,D)))}),J}function L(G){var J=G.graph();J.ranksep/=2,e.forEach(G.edges(),function(U){var ne=G.edge(U);ne.minlen*=2,ne.labelpos.toLowerCase()!=="c"&&(J.rankdir==="TB"||J.rankdir==="BT"?ne.width+=ne.labeloffset:ne.height+=ne.labeloffset)})}function V(G){e.forEach(G.edges(),function(J){var U=G.edge(J);if(U.width&&U.height){var ne=G.node(J.v),ae=G.node(J.w),pe={rank:(ae.rank-ne.rank)/2+ne.rank,e:J};y.addDummyNode(G,"edge-proxy",pe,"_ep")}})}function Q(G){var J=0;e.forEach(G.nodes(),function(U){var ne=G.node(U);ne.borderTop&&(ne.minRank=G.node(ne.borderTop).rank,ne.maxRank=G.node(ne.borderBottom).rank,J=e.max(J,ne.maxRank))}),G.graph().maxRank=J}function ee(G){e.forEach(G.nodes(),function(J){var U=G.node(J);U.dummy==="edge-proxy"&&(G.edge(U.e).labelRank=U.rank,G.removeNode(J))})}function M(G){var J=Number.POSITIVE_INFINITY,U=0,ne=Number.POSITIVE_INFINITY,ae=0,pe=G.graph(),ge=pe.marginx||0,Se=pe.marginy||0;function Oe(We){var Pe=We.x,Te=We.y,et=We.width,je=We.height;J=Math.min(J,Pe-et/2),U=Math.max(U,Pe+et/2),ne=Math.min(ne,Te-je/2),ae=Math.max(ae,Te+je/2)}e.forEach(G.nodes(),function(We){Oe(G.node(We))}),e.forEach(G.edges(),function(We){var Pe=G.edge(We);e.has(Pe,"x")&&Oe(Pe)}),J-=ge,ne-=Se,e.forEach(G.nodes(),function(We){var Pe=G.node(We);Pe.x-=J,Pe.y-=ne}),e.forEach(G.edges(),function(We){var Pe=G.edge(We);e.forEach(Pe.points,function(Te){Te.x-=J,Te.y-=ne}),e.has(Pe,"x")&&(Pe.x-=J),e.has(Pe,"y")&&(Pe.y-=ne)}),pe.width=U-J+ge,pe.height=ae-ne+Se}function X(G){e.forEach(G.edges(),function(J){var U=G.edge(J),ne=G.node(J.v),ae=G.node(J.w),pe,ge;U.points?(pe=U.points[0],ge=U.points[U.points.length-1]):(U.points=[],pe=ae,ge=ne),U.points.unshift(y.intersectRect(ne,pe)),U.points.push(y.intersectRect(ae,ge))})}function H(G){e.forEach(G.edges(),function(J){var U=G.edge(J);if(e.has(U,"x"))switch((U.labelpos==="l"||U.labelpos==="r")&&(U.width-=U.labeloffset),U.labelpos){case"l":U.x-=U.width/2+U.labeloffset;break;case"r":U.x+=U.width/2+U.labeloffset;break}})}function I(G){e.forEach(G.edges(),function(J){var U=G.edge(J);U.reversed&&U.points.reverse()})}function B(G){e.forEach(G.nodes(),function(J){if(G.children(J).length){var U=G.node(J),ne=G.node(U.borderTop),ae=G.node(U.borderBottom),pe=G.node(e.last(U.borderLeft)),ge=G.node(e.last(U.borderRight));U.width=Math.abs(ge.x-pe.x),U.height=Math.abs(ae.y-ne.y),U.x=pe.x+U.width/2,U.y=ne.y+U.height/2}}),e.forEach(G.nodes(),function(J){G.node(J).dummy==="border"&&G.removeNode(J)})}function P(G){e.forEach(G.edges(),function(J){if(J.v===J.w){var U=G.node(J.v);U.selfEdges||(U.selfEdges=[]),U.selfEdges.push({e:J,label:G.edge(J)}),G.removeEdge(J)}})}function z(G){var J=y.buildLayerMatrix(G);e.forEach(J,function(U){var ne=0;e.forEach(U,function(ae,pe){var ge=G.node(ae);ge.order=pe+ne,e.forEach(ge.selfEdges,function(Se){y.addDummyNode(G,"selfedge",{width:Se.label.width,height:Se.label.height,rank:ge.rank,order:pe+ ++ne,e:Se.e,label:Se.label},"_se")}),delete ge.selfEdges})})}function O(G){e.forEach(G.nodes(),function(J){var U=G.node(J);if(U.dummy==="selfedge"){var ne=G.node(U.e.v),ae=ne.x+ne.width/2,pe=ne.y,ge=U.x-ae,Se=ne.height/2;G.setEdge(U.e,U.label),G.removeNode(J),U.label.points=[{x:ae+2*ge/3,y:pe-Se},{x:ae+5*ge/6,y:pe-Se},{x:ae+ge,y:pe},{x:ae+5*ge/6,y:pe+Se},{x:ae+2*ge/3,y:pe+Se}],U.label.x=U.x,U.label.y=U.y}})}function K(G,J){return e.mapValues(e.pick(G,J),Number)}function de(G){var J={};return e.forEach(G,function(U,ne){J[ne.toLowerCase()]=U}),J}return Uv}var Wv,xT;function X7(){if(xT)return Wv;xT=1;var e=Tt(),t=Fn(),n=Dr().Graph;Wv={debugOrdering:r};function r(a){var i=t.buildLayerMatrix(a),c=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(u){c.setNode(u,{label:u}),c.setParent(u,"layer"+a.node(u).rank)}),e.forEach(a.edges(),function(u){c.setEdge(u.v,u.w,{},u.name)}),e.forEach(i,function(u,f){var p="layer"+f;c.setNode(p,{rank:"same"}),e.reduce(u,function(h,m){return c.setEdge(h,m,{style:"invis"}),m})}),c}return Wv}var Hv,bT;function Z7(){return bT||(bT=1,Hv="0.8.5"),Hv}var Gv,kT;function Q7(){return kT||(kT=1,Gv={graphlib:Dr(),layout:Y7(),debug:X7(),util:{time:Fn().time,notime:Fn().notime},version:Z7()}),Gv}var J7=Q7();const _T=Mx(J7),wo=240,pc=130,Ri=74,Oh=72,tc=Ri+Oh;function _M(e,t){var r;let n=wo;for(const a of e)n=Math.max(n,((r=t.get(a.id))==null?void 0:r.width)??wo);return n}const Jd=420,NM=1;function e9(e,t,n,r){return Math.min(NM,n/Math.max(1,e),r/Math.max(1,t))}function vo(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function t9(e,t){return((t==null?void 0:t.get(e))??0)>0?Jd:0}function n9(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function mc(e,t,n){const r=t.get(e);return{w:((r==null?void 0:r.width)??wo)+t9(e,n),h:Math.max((r==null?void 0:r.height)??pc,n9(e,n))}}function r9(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function s9(e,t,n,r,a,i){const c=new _T.graphlib.Graph;c.setDefaultEdgeLabel(()=>({})),c.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(b=>!a.has(b)),f=new Set(u);for(const b of u){const{w:j,h:E}=mc(b,r,i);c.setNode(b,{width:j,height:E})}for(const b of t)f.has(b.source)&&f.has(b.target)&&c.setEdge(b.source,b.target);_T.layout(c);const p=new Map;let h=1/0,m=1/0,y=-1/0,w=-1/0;for(const b of u){const j=c.node(b);if(!j)continue;const E=r.get(b),C=(E==null?void 0:E.width)??wo,T=(E==null?void 0:E.height)??pc,R=mc(b,r,i),$=j.x-R.w/2,D=j.y-R.h/2;p.set(b,{x:$,y:D}),$<h&&(h=$),D<m&&(m=D),$+C>y&&(y=$+C),D+T>w&&(w=D+T)}if(Number.isFinite(h)&&Number.isFinite(m))for(const[b,j]of p)p.set(b,{x:j.x-h,y:j.y-m});const N=Number.isFinite(y)?y-h:0,_=Number.isFinite(w)?w-m:0;let S=null;for(const b of e){const j=a.get(b);if(!j)continue;const E=r.get(b),C=(E==null?void 0:E.width)??wo,T=(E==null?void 0:E.height)??pc;S=S===null?{minX:j.x,minY:j.y,maxX:j.x+C,maxY:j.y+T}:{minX:Math.min(S.minX,j.x),minY:Math.min(S.minY,j.y),maxX:Math.max(S.maxX,j.x+C),maxY:Math.max(S.maxY,j.y+T)}}return{positions:p,width:N,height:_,pinnedBox:S}}function SM(e,t,n){const r=n.direction??"LR",a=n.pinned??new Map,i=n.measured??new Map,c=n.lanes,u=new Map;for(const h of e){const m=vo(h),y=u.get(m);y?y.push(h.id):u.set(m,[h.id])}return{laid:Array.from(u.keys()).sort().map(h=>({sid:h,...s9(u.get(h),t,r,i,a,c)})),gap:_M(e,i)}}const jM=e=>e.reduce((t,n)=>Math.max(t,n.width),0)+Jd,a9=e=>e.reduce((t,n)=>t+n.height,0)+tc*Math.max(0,e.length-1);function Tx(e,t,n,r){const a=f=>{const p=[[]];let h=0;for(const m of e)h>0&&h+m.height>f&&(p.push([]),h=0),p[p.length-1].push(m),h+=m.height+tc;return p},i=[];for(let f=0;f<e.length;f++){let p=-tc;for(let h=f;h<e.length;h++)i.push(p+=e[h].height+tc)}i.sort((f,p)=>f-p);const c=f=>{let p=0,h=i.length-1;for(;p<h;){const m=p+h>>1;a(i[m]).length<=f?h=m:p=m+1}return a(i[p])};let u=[e];if(n>0&&r>0){const f=h=>e9(h.reduce((m,y)=>m+jM(y),0)+t*(h.length-1),Math.max(...h.map(a9)),n,r);let p=f(u);for(let h=2;h<=e.length;h++){const m=c(h),y=f(m);y>p+1e-9&&(p=y,u=m)}}return u}function o9(e,t,n,r,a){if(!(r.width>0&&r.height>0&&a.width>0&&a.height>0))return!1;const{laid:i,gap:c}=SM(e,t,n);return i.length<2?!1:Tx(i,c,r.width,r.height).length!==Tx(i,c,a.width,a.height).length}function i9(e,t,n={}){const r=n.pinned??new Map,{laid:a,gap:i}=SM(e,t,n),c=Tx(a,i,n.availableWidth??0,n.availableHeight??0),u=new Map;let f=0;for(const p of c){const h=jM(p);let m=0;for(const{positions:y,height:w,pinnedBox:N}of p){for(const[S,b]of y)u.set(S,{x:b.x+f,y:b.y+m});let _=m+w;N&&N.maxY>_&&N.minX<f+h&&f<N.maxX&&(_=N.maxY),m=_+tc}f+=h+i}return e.map(p=>{const h=r.get(p.id);if(h)return{...p,position:h};const m=u.get(p.id);return m?{...p,position:m}:p})}function l9(e,t,n,r,a){const c=Ri+Oh,u=60,f=w=>mc(w,r,a),p=new Map(e.map(w=>[w.id,vo(w)])),h=[],m=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,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 m){const{w:_,h:S}=f(w),b=p.get(w)??"_default";if(n.has(w)){h.push({x:N.x,y:N.y,w:_,h:S,sid:b});continue}let j=N.y;for(let E=0;E<h.length+1;E++){const C=h.find(T=>{const R=T.sid===b?24:u,$=T.sid===b?24:c;return N.x<T.x+T.w+R&&T.x<N.x+_+R&&j<T.y+T.h+$&&T.y<j+S+$});if(!C)break;j=C.y+C.h+(C.sid===b?24:c)}j!==N.y&&(t.set(w,{x:N.x,y:j}),y.push(w)),h.push({x:N.x,y:j,w:_,h:S,sid:b})}return y}function c9(e,t,n,r,a,i,c){const u=E=>mc(E,r,i),f=E=>n.get(E)??t.get(E),p=E=>{const C=r.get(E);return{cw:(C==null?void 0:C.width)??wo,ch:(C==null?void 0:C.height)??pc}},h=c!=null&&c.width>0&&c.height>0,m=new Map;for(const E of e){if(!f(E.id))continue;const C=vo(E),T=m.get(C);T?T.push(E):m.set(C,[E])}const y=new Set;for(const[E,C]of m)C.every(T=>a.has(T.id)&&!n.has(T.id))&&y.add(E);const w=new Map,N=[];for(const E of e){const C=f(E.id);if(!C)continue;const{w:T,h:R}=u(E.id),$=vo(E);y.has($)?(w.get($)??w.set($,[]).get($)).push(E):N.push({x:C.x,y:C.y,w:T,h:R,...p(E.id)})}if(w.size===0||h&&N.length===0)return[];const _=Ri+Oh,S=(E,C,T,R)=>N.some($=>E<$.x+$.w+Ri&&$.x<E+T+Ri&&C<$.y+$.h+_&&$.y<C+R+_),b=_M(e,r),j=[];for(const E of[...w.keys()].sort()){const C=w.get(E);let T=1/0,R=1/0,$=-1/0,D=-1/0,W=-1/0,L=-1/0;for(const I of C){const B=f(I.id),{w:P,h:z}=u(I.id),{cw:O,ch:K}=p(I.id);T=Math.min(T,B.x),R=Math.min(R,B.y),$=Math.max($,B.x+P),D=Math.max(D,B.y+z),W=Math.max(W,B.x+O),L=Math.max(L,B.y+K)}const V=$-T,Q=D-R,ee=[...new Set(N.map(I=>Math.round(I.x)))].sort((I,B)=>I-B),M=ee.length?ee:[T],X=[0,...N.map(I=>I.y+I.h+_)].sort((I,B)=>I-B);let H=null;if(h){let I=1/0,B=1/0,P=-1/0,z=-1/0;for(const U of N)I=Math.min(I,U.x),B=Math.min(B,U.y),P=Math.max(P,U.x+U.cw),z=Math.max(z,U.y+U.ch);const O=(U,ne)=>{const ae=c.width/(Math.max(P,U+W-T)-Math.min(I,U)+Jd),pe=c.height/(Math.max(z,ne+L-R)-Math.min(B,ne));return[Math.min(NM,ae,pe),Math.min(ae,pe),Math.max(ae,pe)]},K=(U,ne)=>{for(let ae=0;ae<U.length;ae++){if(U[ae]>ne[ae]+1e-9)return!0;if(U[ae]<ne[ae]-1e-9)return!1}return!1},de=Math.round(P+Jd+b),G=[...new Set([...X,B])].sort((U,ne)=>U-ne);let J=null;for(const U of[...M,de])for(const ne of G){if(S(U,ne,V,Q))continue;const ae=O(U,ne);(J===null||K(ae,J))&&(J=ae,H={x:U,y:ne})}H&&H.x===T&&H.y===R&&(H=null)}else e:for(const I of M)for(const B of X){if(B>=R)break;if(!S(I,B,V,Q)){H={x:I,y:B};break e}}if(H){const I=H.x-T,B=H.y-R;for(const P of C){const z=f(P.id);t.set(P.id,{x:z.x+I,y:z.y+B})}j.push(E)}for(const I of C){const B=f(I.id),{w:P,h:z}=u(I.id);N.push({x:B.x,y:B.y,w:P,h:z,...p(I.id)})}}return j}function u9(e,t,n){const r=new Map;for(const a of e){if(t.has(a.id)||!n(a.id))continue;const i=vo(a);(r.get(i)??r.set(i,[]).get(i)).push(a)}if(r.size===0)return e;for(const a of r.values())a.sort((i,c)=>i.id.localeCompare(c.id));return e.map(a=>{var p;if(t.has(a.id)||n(a.id))return a;const i=r.get(vo(a));if(!i)return a;const c=(p=a.data)==null?void 0:p.parentId,u=i.find(h=>h.id===c)??i[0],f=n(u.id);return{...a,position:{x:a.position.x+f.x-u.position.x,y:a.position.y+f.y-u.position.y}}})}function d9(e,t,n,r,a,i=!1,c){const p=Ri+Oh+1,h=8,m=1.75,y=200,w=.7,N=.01,_=L=>mc(L,r,c),S=L=>n.get(L)??t.get(L),b=new Map;for(const L of e){if(!S(L.id))continue;const V=vo(L),Q=b.get(V);Q?Q.push(L):b.set(V,[L])}const j=[],E=new Set,C=new Set,T=a.size===0;for(const L of[...b.keys()].sort()){const V=b.get(L);let Q=1/0,ee=1/0,M=-1/0,X=-1/0,H=!1;for(const z of V){const O=S(z.id),{w:K,h:de}=_(z.id);Q=Math.min(Q,O.x),ee=Math.min(ee,O.y),M=Math.max(M,O.x+K),X=Math.max(X,O.y+de),n.has(z.id)&&(H=!0)}const I=M-Q,B=X-ee;C.add(L);const P=a.get(L);P&&(I>P.w+h||B>P.h+h)&&E.add(L),a.set(L,{w:I,h:B}),j.push({sid:L,members:V.map(z=>z.id),x:Q,y:ee,w:I,h:B,anchored:H,mass:1})}for(const L of[...a.keys()])C.has(L)||a.delete(L);if(i||T)return[];let R=!1;for(let L=0;L<j.length&&!R;L++)for(let V=L+1;V<j.length;V++){const Q=j[L],ee=j[V];if(!(Q.anchored&&ee.anchored)&&Math.abs(Q.x+Q.w/2-(ee.x+ee.w/2))<(Q.w+ee.w)/2+61&&Math.abs(Q.y+Q.h/2-(ee.y+ee.h/2))<(Q.h+ee.h)/2+p){R=!0;break}}if(E.size===0&&!R)return[];if(E.size>0)for(const L of j)E.has(L.sid)&&(L.mass=8);else for(const L of j)L.mass=Math.max(1,L.w*L.h/(wo*pc));const $=new Map(j.map(L=>[L.sid,L.x])),D=new Map(j.map(L=>[L.sid,L.y]));for(let L=0;L<y;L++){const V=new Map,Q=new Map;let ee=0;for(let M=0;M<j.length;M++)for(let X=M+1;X<j.length;X++){const H=j[M],I=j[X];if(H.anchored&&I.anchored)continue;const B=H.x+H.w/2,P=H.y+H.h/2,z=I.x+I.w/2,O=I.y+I.h/2,K=(H.w+I.w)/2+61-Math.abs(B-z),de=(H.h+I.h)/2+p-Math.abs(P-O);if(K<=0||de<=0)continue;const G=(be,Re)=>!be.anchored&&!(Re<0&&be.x<=0),J=(be,Re)=>!be.anchored&&!(Re<0&&be.y<=0),U=(be,Re,Xe)=>{const $e=be===Re,ct=$e?H.sid<I.sid?-1:1:Math.sign(be-Re);return Xe(H,ct)||Xe(I,-ct)?ct:$e&&(Xe(H,-ct)||Xe(I,ct))?-ct:0},ne=U(B,z,G),ae=U(P,O,J),pe=ne!==0,ge=ae!==0;if(!pe&&!ge)continue;const Se=pe&&(!ge||K*m<de),[Oe,We,Pe,Te]=Se?[ne,K,V,G]:[ae,de,Q,J],et=Te(H,Oe),je=Te(I,-Oe),_e=H.mass,Ye=I.mass,dt=et?je?Ye/(_e+Ye):1:0,Qe=je?et?_e/(_e+Ye):1:0,ue=We*w;Pe.set(H.sid,(Pe.get(H.sid)??0)+Oe*ue*dt),Pe.set(I.sid,(Pe.get(I.sid)??0)-Oe*ue*Qe),ee+=ue}for(const M of j)M.anchored||(M.x=Math.max(0,M.x+(V.get(M.sid)??0)),M.y=Math.max(0,M.y+(Q.get(M.sid)??0)));if(ee<N)break}const W=[];for(const L of j){const V=L.x-$.get(L.sid),Q=L.y-D.get(L.sid);if(!(Math.abs(V)<1&&Math.abs(Q)<1)){for(const ee of L.members){if(n.has(ee))continue;const M=t.get(ee);M&&t.set(ee,{x:M.x+V,y:M.y+Q})}W.push(L.sid)}}return W}const h9=600;function Ax(e,t){return!(e.exitAt!=null&&t-e.exitAt>h9||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function f9(e,t){const n=new Set;for(const r of e.agents.values())Ax(r,t)&&n.add(r.id);return n}function p9(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 m9(e,t,n=0){if(!e)return!1;for(const r of t)if(p9(e,r,n))return!0;return!1}const EM="sessionGroup";function g9(e,t){var r,a;if(e.type===EM)return"transparent";if(xo((r=e.data)==null?void 0:r.waiting))return t("--warn");if(e.type==="recapNote")return t("--muted");const n=(a=e.data)==null?void 0:a.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const CM=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function NT(e){const t={};for(const n of CM)t[n]=e(n);return t}function y9(e){return t=>e[t]??""}function w9(e,t){return CM.every(n=>e[n]===t[n])}function v9(e){const t=new Set(e.pins),n=new Map,r=new Map;for(const[a,i]of e.positions)n.set(a,i),t.has(a)&&r.set(a,i);return{positions:n,pinned:r}}const TM=.2,AM=1.6;function x9(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const{x:n,y:r,zoom:a}=t;return typeof n!="number"||typeof r!="number"||typeof a!="number"||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(a)||a<TM||a>AM?null:{x:n,y:r,zoom:a}}const b9=1200,k9=1e3;function ST(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<b9?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<k9}function Ad({durationMs:e,documentHidden:t,reducedMotion:n=_9()}){return t||n?!1:Number.isFinite(e)&&e>0}function _9(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Vv(e){const t=typeof document<"u"&&document.hidden;return Ad({durationMs:e,documentHidden:t})?e:0}function N9(e,t,n){const r=e.x*t.zoom+t.x,a=e.y*t.zoom+t.y,i=(e.x+e.width)*t.zoom+t.x,c=(e.y+e.height)*t.zoom+t.y;return i>0&&r<n.width&&c>0&&a<n.height}function S9({pane:e,viewport:t,boxes:n}){if(!e||!(e.width>0)||!(e.height>0)||!Number.isFinite(t.zoom)||t.zoom<=0||!Number.isFinite(t.x)||!Number.isFinite(t.y))return!1;let r=!1;for(const a of n)if(r=!0,N9(a,t,e))return!1;return r}const j9="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Kv="click for what's new";function E9(e){if(e.checkDisabled)return`${j9} · ${Kv}`;if(e.checking)return`Asking npm for the newest release… · ${Kv}`;const t=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",n=e.checkFailedAgo?` · could not reach npm ${e.checkFailedAgo}`:e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${Kv}, and to check npm now`}function C9(e){const t=`Version v${e.running}, show what's new`;return e.checkDisabled?`${t} — update checks are off`:e.checking?`${t} — checking npm for a newer release`:e.checkFailedAgo?`${t} — npm could not be reached ${e.checkFailedAgo}, check again`:`${t} and check npm for a newer release`}function T9(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 A9(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 Rx={kind:"assumed",claude:!0,codex:!0};function R9(e){if(!e||typeof e!="object")return Rx;const t=e.providers;if(!t||typeof t!="object")return Rx;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function M9(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const jT={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function I9(e){const t=e.toLowerCase();return Object.hasOwn(jT,t)?jT[t]:t?t[0].toUpperCase()+t.slice(1):""}function $9(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function $G(e,t=[]){const n=t.length?$9(t.map(I9)):M9(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function O9(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 P9(e,t){const n=t.prefs??Ex,r=fc(n.done.level),a=fc(n["needs-input"].level),i=r===a?`${r}%`:`${r}% and ${a}%`,c=t.on?`Sound: on at ${i} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",u=e.codex?`
284
+
285
+ Both CLIs get the finish tone. The second tone — Claude is waiting for you — has no Codex equivalent to fire on, so it only ever plays for Claude Code.`:"",f=t.on&&t.locked?`
286
+
287
+ Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return c+u+f+`
288
+
289
+ Click to set the volume and the sound of each tone, and to hear either one.`}function eh(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const ET=99;function L9(e){const t=Math.max(0,Math.floor(e));return t>ET?`${ET}+`:String(t)}const D9="Pause the canvas";function q9(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 — ${eh(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)":`${eh(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function F9(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 RM="paused · full",B9=(e,t)=>t>0?RM:e>0?`paused · ${L9(e)}`:"paused";function z9(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:B9(e.held,t),widest:RM,title:t>0?`Connected — the pause is full at ${eh(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${eh(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",resting:!0,label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",resting:!1,label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}const U9=x.lazy(()=>qT(()=>import("./UsageHistoryModal-CbBjBbZV.js"),[])),W9=x.lazy(()=>qT(()=>import("./BrowserWatchModal-CN2fFFCe.js"),[]));function CT(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const H9={agent:p6,sessionGroup:G6,recapNote:K6},G9={recapTie:Y6},V9=300,TT=130,K9=160,MM="react-flow__node";function AT(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,MM))===!0}const Yv=80,Xv=.86;function RT(e){if(!e)return 0;const t=e.getBoundingClientRect();let n=t.right;for(const r of document.querySelectorAll(".sysdetail:not(.leaving), .usage-panel:not(.leaving)")){const a=r.getBoundingClientRect();a.width>0&&a.left>t.left&&(n=Math.min(n,a.left))}return Math.max(0,t.right-n)}function Y9(e){try{const t=document.querySelector(`.${MM}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const X9=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),Z9=420;function Q9(e){return e<.35?"far":e<.55?"mid":"full"}const gd=18,J9=200,eG=5*6e4,tG=6,nG=2*6e4,MT=400,I0="agent-dag.layout",$0="agent-dag.layoutFrame",O0="agent-dag.viewport",IM="agent-dag.sessionListOpen",$M="agent-dag.detailOpen",OM="agent-dag.usagePanelOpen",PM="agent-dag.systemPanelOpen",IT="agent-dag.accountsPanelOpen",Zv="agent-dag.versionNoticeDismissed",$T="agent-dag.oldNameNoticeDismissed",rG=15*6e4,Qv={git_checkout:"this deck runs from a git checkout — pull instead:",npx:"npx runs from a cache that cannot be upgraded in place — run:",not_writable:"the install directory is not writable by this user — run:",opted_out:"installs are off (AGENTS_DECK_NO_INSTALL=1) — run:",retired_name:"this install came from a name that is no longer published — run:"},yd="agent-dag.autoRestart",OT="agent-dag.bundleReloadedFor";function sG(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(IM)==="1"}catch{return!1}}function aG(e){if(!(typeof window>"u"))try{window.localStorage.setItem(IM,e?"1":"0")}catch{}}function oG(){if(typeof window>"u")return!1;try{return window.localStorage.getItem($M)==="1"}catch{return!1}}function iG(e){if(!(typeof window>"u"))try{window.localStorage.setItem($M,e?"1":"0")}catch{}}function lG(){const e=bo(OM);return e===null?!0:e==="1"}function cG(e){if(!(typeof window>"u"))try{window.localStorage.setItem(OM,e?"1":"0")}catch{}}function uG(){const e=bo(PM);return e===null?!0:e==="1"}function dG(e){if(!(typeof window>"u"))try{window.localStorage.setItem(PM,e?"1":"0")}catch{}}function hG(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(I0);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const a=Object.entries(n).filter(([,i])=>i&&typeof i.x=="number"&&typeof i.y=="number");return{positions:a,pins:a.map(([i])=>i)}}return{positions:Object.entries(n.positions??{}).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function wd(e,t){if(!(typeof window>"u"))try{const n={};for(const[r,a]of e)n[r]=a;for(const[r,a]of t)n[r]=a;window.localStorage.setItem(I0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function fG(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem($0);if(!e)return null;const t=JSON.parse(e);return!(typeof(t==null?void 0:t.width)=="number"&&typeof(t==null?void 0:t.height)=="number")||!(t.width>0&&t.height>0)?null:{width:t.width,height:t.height}}catch{return null}}function pG(e){if(!(typeof window>"u"))try{window.localStorage.setItem($0,JSON.stringify(e))}catch{}}function mG(){if(typeof window>"u")return null;try{return x9(window.localStorage.getItem(O0))}catch{return null}}function gG(e){if(!(typeof window>"u"))try{window.localStorage.setItem(O0,JSON.stringify(e))}catch{}}function PT(){if(!(typeof window>"u")){try{window.localStorage.removeItem(I0)}catch{}try{window.localStorage.removeItem(O0)}catch{}try{window.localStorage.removeItem($0)}catch{}}}function yG(e,t){const n=e.agents.get(t);if(!n)return;const r=[];for(const h of e.agents.values())h.sessionId===t&&r.push(h);const a={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:r.map(h=>({id:h.id,kind:h.kind,label:h.label,parentId:h.parentId,state:h.state,startedAt:h.startedAt,endedAt:h.endedAt,model:h.model,cwd:h.cwd,usage:h.usage,prompts:h.prompts,tools:h.tools.map(m=>({id:m.id,name:m.name,inputPreview:m.inputPreview,startedAt:m.startedAt,endedAt:m.endedAt,ok:m.ok,errorPreview:m.errorPreview,usage:m.usage}))}))},i=JSON.stringify(a,null,2),c=new Blob([i],{type:"application/json"}),u=URL.createObjectURL(c),f=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=u,f.download=`${Kt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const LM={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},wG={file:"M3.4 1.8h4.5l2.7 2.7v7.7H3.4z M7.9 1.8v2.7h2.7",shell:"M2.4 3.8 5.6 7l-3.2 3.2 M7.4 10.6h4.2",web:"M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 1 0 7 1.8z M1.8 7h10.4 M7 1.8c-1.5 1.4-2.3 3.1-2.3 5.2s.8 3.8 2.3 5.2c1.5-1.4 2.3-3.1 2.3-5.2S8.5 3.2 7 1.8z",agent:"M3.3 4.8h7.4a1.2 1.2 0 0 1 1.2 1.2v4.8a1.2 1.2 0 0 1-1.2 1.2H3.3a1.2 1.2 0 0 1-1.2-1.2V6a1.2 1.2 0 0 1 1.2-1.2z M7 4.8V2.4 M5.3 8.2h.01 M8.7 8.2h.01",task:"M2.2 4l1.2 1.2 2-2.2 M7.4 4.2h4.4 M2.2 9.4l1.2 1.2 2-2.2 M7.4 9.6h4.4",plan:"M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 1 0 7 1.8z M9 5 8 8 5 9l1-3z",mcp:"M5 1.8v2.6 M9 1.8v2.6 M3.6 4.4h6.8v2.2a3.4 3.4 0 0 1-6.8 0z M7 10v2.2",other:"M3.5 7h.01 M7 7h.01 M10.5 7h.01"};function vG({cat:e}){return l.jsx("svg",{className:"cat-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:wG[e]})})}const th={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},DM=IA,LT=new WeakMap;function xG(e,t){let n=LT.get(e);(!n||n.revision!==e.revision||n.open!==t)&&(n={revision:e.revision,open:t,byId:new Map},LT.set(e,n));const{byId:r}=n;return a=>{let i=r.get(a.id);return i||(i={...a,onOpenContext:t},r.set(a.id,i)),i}}function qM(e){const t=new Map;for(const n of e.agents.values())n.tools.length>0&&t.set(n.id,Math.min(4,n.tools.length));return t}function bG(e,t,n,r,a,i,c,u,f,p,h,m,y,w,N,_,S,b){var ee,M,X,H;const j=[],E=[],C=xG(e,b);for(const I of e.agents.values()){if(!S.has(I.id))continue;const B=I.exitAt!=null,P=_!=null&&!_.has(I.id),z=[B?"rf-exiting":"",P?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,O=i.get(I.id);if(j.push({id:I.id,type:"agent",position:{x:0,y:0},data:C(I),className:z,ariaLabel:y6(I,t),...O?{width:O.width,height:O.height}:null}),I.parentId&&S.has(I.parentId)){const G=Bd(I.sessionId),J=B,U=N.size>0&&(N.has(I.id)||N.has(I.parentId)),ne=_!=null&&!_.has(I.id)&&!_.has(I.parentId),ae=I.state==="active"?2:1.5,pe=U?ae+1.5:ae,ge=J?.2:ne?.12:1,Se=["sess-edge",I.state==="active"?"sess-live":"sess-idle",J?"rf-edge-exiting":"",U?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${I.parentId}->${I.id}`,source:I.parentId,target:I.id,animated:(I.state==="active"||U)&&!J,type:"smoothstep",style:{"--session-hue":G,strokeWidth:pe,opacity:ge,transition:"var(--edge-transition)"},className:Se})}const K=I.kind==="root"?fh(I):null,de=K?TA(I.sessionId,K.at):null;if(K&&de&&!i6(de)){const G=r0(I.id),J=Bd(I.sessionId),U=i.get(G);j.push({id:G,type:"recapNote",position:{x:0,y:0},data:{sessionId:I.sessionId,parentId:I.id,recap:K,noteKey:de,hue:J},className:P?"rf-spotlit-out":void 0,selectable:!1,focusable:!1,ariaLabel:`Claude Code's recap for ${I.label}`,...U?{width:U.width,height:U.height}:null}),E.push({id:`e:recap:${I.id}`,source:G,target:I.id,type:"recapTie",className:"recap-edge",focusable:!1,style:{"--session-hue":J}})}}const T=qM(e),R=`${y}#lanes:${r9(T)}`,$=new Set(j.filter(I=>I.type==="recapNote").map(I=>I.id));for(const I of Array.from(h.keys()))d6(I)&&!$.has(I)&&!a.has(I)&&(h.delete(I),m.delete(I));const D=j.filter(I=>gU(I.id,a,h,m));if(D.length>0||R!==w.current){if(D.length>0){const I=u9(i9(j,E,{direction:"LR",pinned:a,measured:i,availableWidth:n,availableHeight:r,lanes:T}),a,B=>Td(B,h,m)?void 0:h.get(B));for(const B of I)Td(B.id,h,m)&&tN(B.id,B.position,h,m);c9(j,h,a,i,new Set(D.filter(B=>B.type!=="recapNote").map(B=>B.id)),T,{width:n,height:r});for(const B of D){if(B.type!=="recapNote")continue;const P=(ee=B.data)==null?void 0:ee.parentId;if(!P)continue;const z=a.get(P)??(Td(P,h,m)?void 0:h.get(P));if(!z)continue;const O=((M=i.get(B.id))==null?void 0:M.width)??V9,K=((X=i.get(B.id))==null?void 0:X.height)??TT,de=((H=i.get(P))==null?void 0:H.height)??TT;tN(B.id,{x:z.x-K9-O,y:z.y+(de-K)/2},h,m)}}l9(j,h,a,i,T),w.current=R}const W=d9(j,h,a,i,c,!f||p,T);W.length>0&&u(W);const L=fU(e.agents.values());fd(h,L),fd(m,L),fd(a,L),fd(i,hU(e.agents.values()));const V=[];let Q=!1;for(const I of j){let B=a.get(I.id)??h.get(I.id);B||(B=yU(I.id,h,m),Q=!0),V.push({...I,position:B})}return Q&&(w.current=""),{nodes:V,edges:E}}function kG(){return l.jsx(Xx,{children:l.jsx(SG,{})})}const _G=e=>e.transform[2]>=e.maxZoom,NG=e=>e.transform[2]<=e.minZoom;function SG(){var Zo,Va,ra,wl;const e=xc(),t=gt(_G),n=gt(NG),r=zt(),a=x.useState(mx)[0],i=x.useRef(a),[,c]=x.useState(0),u=x.useCallback(()=>c(F=>F+1),[]),[f,p]=x.useState(oG);x.useEffect(()=>{iG(f)},[f]);const[h,m]=x.useState(()=>new Set),[y,w]=x.useState(null),[N,_]=x.useState(null),S=x.useCallback((F,q)=>{m(se=>{if(!q)return new Set([F]);const oe=new Set(se);return oe.has(F)?oe.delete(F):oe.add(F),oe}),w(se=>q&&se===F?se:F),q||p(!0)},[]),b=x.useCallback(()=>{m(new Set),w(null)},[]),[j,E]=x.useState(null),[C,T]=x.useState(null),R=x.useCallback(F=>T(F),[]),[$,D]=x.useState(!1),[W,L]=x.useState(!1),[V,Q]=x.useState(!1),ee=x.useRef(null),[M,X]=x.useState(sG);x.useEffect(()=>{aG(M)},[M]);const[H,I]=x.useState(lG);x.useEffect(()=>{cG(H)},[H]);const[B,P]=x.useState(uG);x.useEffect(()=>{dG(B)},[B]);const z=x.useRef(!1),[O,K]=x.useState(()=>{const F=(()=>{try{const q=window.localStorage.getItem(IT);return q===null?!0:q==="1"}catch{return!0}})();return F&&M?(z.current=!0,!1):F});x.useEffect(()=>{if(!(!O&&z.current))try{window.localStorage.setItem(IT,O?"1":"0")}catch{}},[O]),x.useEffect(()=>{!M&&z.current&&(z.current=!1,K(!0))},[M]);const de=kp(O,200),G=kp(H,130),J=kp(B,130),[U,ne]=x.useState(null);x.useEffect(()=>{let F=null;try{F=localStorage.getItem("agent-dag.sound")}catch{}ne(F===null?!0:F==="on")},[]);const ae=x.useCallback(()=>{ne(F=>{var se;const q=F!==!0;try{localStorage.setItem("agent-dag.sound",q?"on":"off")}catch{}return q&&((se=be.current)==null||se.unlock()),q})},[]),pe=x.useCallback(F=>{ae()},[ae]),ge=x.useRef(pe);ge.current=pe;const Se=x.useRef(U);Se.current=U;const[Oe,We]=x.useState(()=>IB(bo)),Pe=x.useRef(Oe);Pe.current=Oe;const Te=x.useRef(null),et=x.useCallback(F=>{var se,oe;const q=Xd(F,(se=Pe.current[F])==null?void 0:se.figure);(oe=Te.current)==null||oe.duck(XB(q.notes))},[]),je=x.useRef(null),_e=x.useCallback((F,q=!1)=>{var se,oe;if((se=be.current)==null||se.unlock(),je.current!==null&&clearTimeout(je.current),je.current=null,!q){(oe=be.current)!=null&&oe.play(F,!0)&&et(F);return}je.current=setTimeout(()=>{var Ae;je.current=null,(Ae=be.current)!=null&&Ae.play(F,!0)&&et(F)},CB)},[et]),Ye=x.useCallback((F,q)=>{We(se=>{const oe={level:fc(q.level??se[F].level),figure:hR(F,q.figure??se[F].figure)};try{localStorage.setItem(fR[F],String(oe.level)),localStorage.setItem(pR[F],oe.figure)}catch{}return{...se,[F]:oe}}),_e(F,!0)},[_e]);x.useEffect(()=>()=>{je.current!==null&&clearTimeout(je.current)},[]);const[dt,Qe]=x.useState(!1),ue=x.useRef(null),be=x.useRef(null),[Re,Xe]=x.useState("locked");x.useEffect(()=>{const F=OB({enabled:()=>Se.current===!0,prefs:()=>Pe.current,onState:Xe});be.current=F,Xe(F.state());const q=()=>F.unlock();return window.addEventListener("pointerdown",q,{once:!0,capture:!0}),window.addEventListener("keydown",q,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",q,{capture:!0}),window.removeEventListener("keydown",q,{capture:!0})}},[]);const[$e,ct]=x.useState(!1),[ye,Ee]=x.useState(!1),[ie,Je]=x.useState(null),[rt,lt]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Zv)??""}catch{return""}}),[tt,nt]=x.useState(!1),St=x.useRef(0),[yt,wt]=x.useState(!1),Et=x.useCallback((F=!1)=>(F&&(St.current=Date.now(),wt(!0)),fetch(F?"/api/version?refresh=1":"/api/version").then(q=>q.ok?q.json():null).then(q=>{q&&Je(q)}).catch(()=>{}).finally(()=>{F&&wt(!1)})),[]),Xt=x.useCallback(()=>{Et(Date.now()-St.current>=rG)},[Et]);x.useEffect(()=>{Et();const F=window.setInterval(Xt,5*6e4),q=()=>{document.visibilityState==="visible"&&Xt()};return document.addEventListener("visibilitychange",q),()=>{window.clearInterval(F),document.removeEventListener("visibilitychange",q)}},[Et,Xt]),x.useEffect(()=>{$e&&Et()},[$e,Et]),x.useEffect(()=>{const F=Bz();let q=null;const se=He=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:F,looking:He}),keepalive:!0}).catch(()=>{})},oe=()=>{const He=qz(document);Fz(q,He)&&se(He),q=He},Ae=()=>{q&&se(!1),q=!1};oe();const ke=window.setInterval(oe,Dz);return window.addEventListener("focus",oe),window.addEventListener("blur",oe),document.addEventListener("visibilitychange",oe),window.addEventListener("pagehide",Ae),()=>{window.clearInterval(ke),window.removeEventListener("focus",oe),window.removeEventListener("blur",oe),document.removeEventListener("visibilitychange",oe),window.removeEventListener("pagehide",Ae),Ae()}},[]);const he=(ie==null?void 0:ie.notice)??null,[ut,st]=x.useState(null),kn=x.useRef(!1);x.useEffect(()=>{if(kn.current)return;const F=eN(),q=Xz(F),se=nU({stored:q,running:(ie==null?void 0:ie.running)??null,notes:J_,remembers:Zz(F)});if(se.reason==="no-version")return;kn.current=!0,se.record&&Qz(F,se.record);const oe=tU({tourSeen:Jz(F),decision:se}),Ae=se.show.length?{entries:se.show,since:q,firstRun:!1}:null;oe.tour&&Q(!0),oe.notes==="now"?st(Ae):oe.notes==="after"&&(ee.current=Ae)},[ie==null?void 0:ie.running]);const pn=(ie==null?void 0:ie.running)??"3.24.0",Cn=x.useMemo(()=>vR(J_,null,pn),[pn]),Lt=x.useCallback(()=>{st({entries:Cn,since:null,firstRun:!1})},[Cn]),[Bn,nn]=x.useState(null),[At,Qn]=x.useState(Rx);x.useEffect(()=>{let F=!1;return fetch("/api/health").then(q=>q.ok?q.json():null).then(q=>{F||(Qn(R9(q)),!(!q||typeof q.workspace!="string")&&nn(q.workspace))}).catch(()=>{}),()=>{F=!0}},[$e]);const rn=x.useRef(At);rn.current=At;const Br=he?`${he.kind}:${he.to}`:"",_n=he!=null&&rt!==Br,wr=x.useCallback(()=>{lt("");try{window.localStorage.setItem(Zv,"")}catch{}},[]),vr=x.useCallback(()=>{if(he){lt(Br);try{window.localStorage.setItem(Zv,Br)}catch{}}},[he,Br]),[zr,Us]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem($T)??""}catch{return""}}),Nn=ie!=null&&ie.invokedAs&&ie.invokedAs!==Kt?ie.invokedAs:null,ms=Nn!=null&&zr!==Nn,Z=x.useCallback(()=>{if(Nn){Us(Nn);try{window.localStorage.setItem($T,Nn)}catch{}}},[Nn]),Ce=((Zo=ie==null?void 0:ie.upgrade)==null?void 0:Zo.state)??"idle",Fe=iB(ie==null?void 0:ie.upgrade),Me=x.useRef(!1),ze=x.useCallback(async()=>{if(Ls(Me.current||Ce==="running")){Me.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Et(),Me.current=!1}},[Ce,Et]);x.useEffect(()=>{if(Ce!=="running")return;const F=window.setInterval(Et,3e3);return()=>window.clearInterval(F)},[Ce,Et]);const ht=x.useCallback(async()=>{const F=ie==null?void 0:ie.command;!F||!await ph(F)||(nt(!0),window.setTimeout(()=>nt(!1),1600))},[ie==null?void 0:ie.command]),Rt=x.useCallback(()=>{X(F=>(F||K(q=>(q&&(z.current=!0),!1)),!F))},[]),Mt=x.useCallback(()=>{z.current=!1,K(F=>(F||X(!1),!F))},[]),[xr,xt]=x.useState(!1),[bt,gs]=x.useState(!1),[Ws,jo]=x.useState(()=>{try{return Number(localStorage.getItem(nN))||0}catch{return 0}}),[ys,Eo]=x.useState([]),[Hs,ws]=x.useState(!1);x.useEffect(()=>{let F=!0;const q=()=>{fetch("/api/browser-watch?live=0").then(oe=>oe.ok?oe.json():null).then(oe=>{var Ae;!F||!(oe!=null&&oe.ok)||(Eo(oe.episodes??[]),ws(((Ae=oe.settings)==null?void 0:Ae.enabled)===!0))}).catch(()=>{})};q();const se=setInterval(q,5*6e4);return()=>{F=!1,clearInterval(se)}},[]);const[Tn,Ur]=x.useState([]),An=x.useRef(new Set),[Co,Ac]=x.useState(null);x.useEffect(()=>{let F=!0,q=0;const se=()=>{fetch("/api/lan").then(oe=>oe.ok?oe.json():null).then(oe=>F?(oe!=null&&oe.ok&&Ur(T_(Array.isArray(oe.pending)?oe.pending:[],oe.aliases)),oe):null).catch(()=>null).then(oe=>{F&&(q=window.setTimeout(se,(oe==null?void 0:oe.enabled)===!0?Sx:iR))})};return se(),()=>{F=!1,window.clearTimeout(q)}},[]);const Rc=x.useCallback(async(F,q)=>{if(!Co){Ac(F);try{const oe=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:F,fp:q})})).json().catch(()=>null);oe&&Array.isArray(oe.pending)?Ur(T_(oe.pending,oe.aliases)):Ur(Ae=>Ae.filter(ke=>ke.fp!==q))}catch{}finally{Ac(null)}}},[Co]),Wr=x.useMemo(()=>OU(ys,Ws).length,[ys,Ws]),[To,Gs]=x.useState(0),Ra=x.useRef(null),[Ph,Mc]=x.useState(!1),vs=x.useRef(null),[Ic,Ao]=x.useState(0),sn=x.useState(()=>kU({protect:F=>r5(i.current,F)}))[0],[Ro,Ki]=x.useState(!1),ft=x.useCallback(()=>{const F=sn.paused&&sn.dropped>0,q=sn.setPaused(!sn.paused);F&&s5(i.current);for(const se of q)i.current=S1(i.current,se);Ki(sn.paused)},[sn]),[Ft,$c]=x.useState(Date.now()),[Jn,Ma]=x.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(yd)!=="0"}catch{return!0}}),Yi=x.useRef(!1),Oc=x.useCallback(()=>{const F=!Jn;Yi.current=!0;try{window.localStorage.removeItem(yd)}catch{}Ma(F),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:F})}).then(q=>q.ok?q.json():null).then(q=>{var se;q!=null&&q.ok&&Ma(((se=q.prefs)==null?void 0:se.autoUpdate)!==!1)}).catch(()=>{})},[Jn]),[er,xs]=x.useState(!1),[Hr,Gr]=x.useState("restart"),[br,Vs]=x.useState(null),tr=x.useRef(!1),kr=x.useRef(null),Pc=x.useRef(0),Ia=x.useCallback(async F=>{if(!Ls(tr.current))return;const q=(F==null?void 0:F.upgrade)===!0;tr.current=!0,kr.current=Fe;const se=++Pc.current;Gr(q?"npx":"restart"),xs(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(he==null?void 0:he.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:q})})}catch{}window.setTimeout(()=>{if(Pc.current===se&&tr.current){tr.current=!1,xs(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},q?18e4:3e4)},[he==null?void 0:he.to,Fe]),bs=x.useRef(null);x.useEffect(()=>{const F=P_(i.current.agents.values())>0,q=hB({enabled:Jn,kind:he==null?void 0:he.kind,canRestart:(ie==null?void 0:ie.canRestart)===!0,noticeOpen:_n,visible:document.visibilityState==="visible",busy:F,idleSince:bs.current,now:Ft});bs.current=q.idleSince,q.restart&&Ia()},[Jn,he==null?void 0:he.kind,ie==null?void 0:ie.canRestart,_n,Ft,Ia]);const Lc=P_(i.current.agents.values()),Xi=dB(Lc),$a=dR({enabled:Jn,kind:he==null?void 0:he.kind,canRestart:(ie==null?void 0:ie.canRestart)===!0,noticeOpen:_n,visible:document.visibilityState==="visible",busy:Lc>0,idleSince:bs.current,now:Ft});x.useEffect(()=>{const F=ie==null?void 0:ie.running;let q=null,se=null;try{q=window.sessionStorage.getItem("agent-dag.restartPending"),se=window.sessionStorage.getItem(OT)}catch{return}const oe=oB({bundle:"3.24.0",running:F,pending:q,lastTried:se});if(oe==="reload"){try{window.sessionStorage.setItem(OT,F??"")}catch{return}window.location.reload();return}if(oe!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}tr.current=!1,xs(!1),Vs(F??null);const Ae=window.setTimeout(()=>Vs(null),6e3);return()=>window.clearTimeout(Ae)},[ie==null?void 0:ie.running]),x.useEffect(()=>{if(er&&lB({asked:kr.current,reported:Fe})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}tr.current=!1,xs(!1)}},[er,Fe]);const Zi=x.useState(()=>v9(hG()))[0],Zt=x.useRef(Zi.pinned),Vr=x.useRef(null),Kr=x.useState(()=>mG())[0],[Yr,Mo]=x.useState(()=>new Set),[Ks,Dc]=x.useState(SU),[Xr,Io]=x.useState(()=>NT(CT)),$o=x.useMemo(()=>y9(Xr),[Xr]),qc=x.useCallback(F=>g9(F,$o),[$o]),[_r,Qi]=x.useState(!1);x.useEffect(()=>{document.documentElement.dataset.theme=Ks;try{window.localStorage.setItem(_R,Ks)}catch{}Io(F=>{const q=NT(CT);return w9(F,q)?F:q})},[Ks]);const nr=x.useCallback((F,q)=>{if(Ad({durationMs:q,documentHidden:document.hidden})){e.setViewport(F,{duration:q});return}const{d3Zoom:se,d3Selection:oe}=r.getState(),Ae=oe==null?void 0:oe.property("__zoom");if(se&&oe&&Ae&&Ae.k>0&&F.zoom>0){se.transform(oe,Ae.scale(F.zoom/Ae.k).translate((F.x-Ae.x)/F.zoom,(F.y-Ae.y)/F.zoom));return}e.setViewport(F,{duration:0})},[e,r]),Ys=x.useRef(null);x.useEffect(()=>{if(!Kr)return;const F=window.setTimeout(()=>{try{nr(Kr,0)}catch{}mn.current=Date.now()},60);return()=>window.clearTimeout(F)},[nr,Kr]);const Oa=x.useRef(!0),[Zr,Ji]=x.useState(null);x.useEffect(()=>{const F=new EventSource("/events"),q=xU(u,{now:()=>Date.now(),setTimeout:(ke,He)=>window.setTimeout(ke,He),clearTimeout:ke=>window.clearTimeout(ke)});let se=!1;const oe=typeof BroadcastChannel=="function"?TU(new BroadcastChannel(EU),Math.random().toString(36).slice(2),()=>se):null,Ae=window.setInterval(()=>{se||!oe||oe.ask(600).then(ke=>{se||Ee(CU(ke))})},3e3);return F.addEventListener("open",()=>{ct(!0),Qi(!0)}),F.addEventListener("error",()=>{ct(!1),Ji(null)}),F.addEventListener("open",()=>{se=!0,Ee(!1)}),F.addEventListener("error",()=>{se=!1}),F.addEventListener("replay-end",()=>{Oa.current=!1,q.flush(),Ji(Date.now())}),F.addEventListener("hook",ke=>{var He;try{const at=JSON.parse(ke.data);if(!sn.accept(at))return;i.current=S1(i.current,at);const vt=at.replay===!0||Oa.current||Date.now()-at.receivedAt>3e4;vt?q.replay():q.live();const Ke=$B(at,vt);Ke&&((He=be.current)!=null&&He.play(Ke))&&et(Ke)}catch{}}),()=>{F.close(),q.cancel(),window.clearInterval(Ae),oe==null||oe.leave()}},[u]),x.useEffect(()=>{const F=setInterval(()=>{const q=Date.now();$c(q);let se=a5(i.current,q,N1);o5(i.current,q,N1)&&(se=!0);const oe=[],Ae=ke=>{oe.push(ke)};t5(i.current,q,J9,eG,Ae)&&(se=!0),n5(i.current,q,tG,nG,Ae)&&(se=!0),oe.length>0&&fetch("/api/forget",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:oe})}).catch(()=>{}),m(ke=>dU(ke,i.current.agents)),w(ke=>ke!=null&&!i.current.agents.has(ke)?null:ke),T(ke=>ke!=null&&!i.current.agents.has(ke)?null:ke),E(ke=>ke!=null&&!i.current.agents.has(ke)?null:ke),se&&u()},250);return()=>clearInterval(F)},[u]);const an=x.useRef(null),mn=x.useRef(0),el=420,Qt=x.useCallback((F=500)=>{const q=Yv,se=1,oe=.2,Ae=Xv;try{const ke=document.querySelector(".canvas-wrap"),He=Array.from(document.querySelectorAll(".react-flow__node")).filter(Dt=>Dt.offsetWidth>0);if(!ke||He.length===0)return;const at=ke.getBoundingClientRect(),vt=e.getViewport();if(!Number.isFinite(vt.zoom)||vt.zoom<=0)return;const Ke=Dt=>(Dt-at.left-vt.x)/vt.zoom,gn=Dt=>(Dt-at.top-vt.y)/vt.zoom,sa=He.map(Dt=>Dt.getBoundingClientRect()),Qo=Math.min(...sa.map(Dt=>Ke(Dt.left))),vl=Math.max(...sa.map(Dt=>Ke(Dt.right))),ru=Math.min(...sa.map(Dt=>gn(Dt.top))),su=Math.max(...sa.map(Dt=>gn(Dt.bottom))),au=vl-Qo,xl=su-ru;if(!(au>0&&xl>0))return;const Ss=Math.max(oe,Math.min(se,(at.width-RT(ke)-q*2)/(au+el)*Ae,(at.height-q*2)/xl*Ae)),Mn={x:q-Qo*Ss,y:Math.max(q,(at.height-xl*Ss)/2)-ru*Ss,zoom:Ss};nr(Mn,F),mn.current=Date.now(),Ys.current=Ad({durationMs:F,documentHidden:document.hidden})?{target:Mn,until:Date.now()+F+60}:null,window.setTimeout(()=>{var Dt;try{((Dt=Ys.current)==null?void 0:Dt.target)===Mn&&(Ys.current=null);const js=e.getViewport();(Math.abs(js.zoom-Ss)>.01||Math.abs(js.x-Mn.x)>2)&&nr(Mn,0)}catch{}},F+60)}catch{}},[e,nr]);x.useEffect(()=>{const F=()=>{if(!document.hidden)return;const q=Ys.current;if(Ys.current=null,!(!q||Date.now()>q.until)){try{nr(q.target,0)}catch{}mn.current=Date.now()}};return document.addEventListener("visibilitychange",F),()=>document.removeEventListener("visibilitychange",F)},[nr]);const tl=x.useRef(""),Pa=x.useRef(null),Oo=x.useRef(0),Qr=x.useCallback(()=>{Oo.current=Date.now()},[]),Xs=x.useRef(null),nl=x.useRef(0),rl=x.useCallback(()=>{nl.current=Date.now()},[]),Fc=x.useCallback(F=>({hasSourceEvent:!!F,at:Date.now(),lastDeckFitAt:mn.current,lastCanvasInputAt:nl.current}),[]),Lh="agent-dag.autoFitDisabled",Nr=x.useRef(!1),[sl,Bc]=x.useState(!1);x.useEffect(()=>{try{window.localStorage.removeItem(Lh)}catch{}},[]);const al=x.useCallback(()=>{Nr.current||(Nr.current=!0,Bc(!0))},[]),zc=x.useCallback(()=>{Nr.current=!1,Bc(!1),Qt(400)},[e,Qt]);x.useEffect(()=>{const F=setInterval(()=>{if(Nr.current||Date.now()-Oo.current<800)return;const q=i.current,se=Date.now(),oe=[];for(const ke of q.agents.values())Ax(ke,se)&&oe.push({id:ke.id});if(oe.length===0)return;const Ae=[];for(const{id:ke}of oe){const He=Jr.current.get(ke),at=Zt.current.get(ke)??on.current.get(ke);!He||!at||Ae.push({x:at.x,y:at.y,width:He.width,height:He.height})}S9({pane:Xs.current,viewport:e.getViewport(),boxes:Ae})&&Qt(600)},1500);return()=>clearInterval(F)},[e]);const ol=x.useRef(!1),Jr=x.useRef(new Map),Uc=x.useRef(0),Dh=x.useCallback(F=>{const q=Jr.current;let se=!1;for(const oe of F.nodeInternals.values()){const Ae=oe.width,ke=oe.height;if(Ae==null||ke==null)continue;const He=q.get(oe.id);He?(Math.abs(He.height-ke)>4||Math.abs(He.width-Ae)>4)&&(q.set(oe.id,{width:Ae,height:ke}),se=!0):(q.set(oe.id,{width:Ae,height:ke}),se=!0)}return se&&(Uc.current+=1),Uc.current},[]),Wc=gt(Dh),[Hc,il]=x.useState(0);x.useEffect(()=>{let F=0;const q=()=>{const oe=Jr.current;let Ae=!1;for(const ke of document.querySelectorAll(".react-flow__node[data-id]")){const He=ke.getAttribute("data-id");if(!He)continue;const at=ke.offsetWidth,vt=ke.offsetHeight;if(!at||!vt)continue;const Ke=oe.get(He);(!Ke||Math.abs(Ke.width-at)>4||Math.abs(Ke.height-vt)>4)&&(oe.set(He,{width:at,height:vt}),Ae=!0)}Ae&&il(ke=>ke+1)};if(ol.current)return;let se=0;return document.visibilityState==="hidden"?se=window.setTimeout(q,32):F=requestAnimationFrame(q),()=>{cancelAnimationFrame(F),window.clearTimeout(se)}});const on=x.useRef(Zi.positions),Gc=x.useRef(new Set),Po=x.useRef(""),ks=x.useMemo(()=>{const F=[];for(const q of i.current.agents.values())Ax(q,Ft)&&F.push(q.id+(q.parentId?`>${q.parentId}`:""));return F.sort(),`${F.join("|")}#sv${Wc}.${Hc}`},[i.current,i.current.revision,Ft,Wc,Hc]),La=x.useRef(null);x.useEffect(()=>(La.current!=null&&window.clearTimeout(La.current),La.current=window.setTimeout(()=>{wd(on.current,Zt.current)},1500),()=>{La.current!=null&&window.clearTimeout(La.current)}),[ks]),x.useEffect(()=>{if(tl.current===ks)return;const F=tl.current;if(tl.current=ks,!F||Nr.current)return;Date.now()-mn.current>1200&&Qt(400),an.current&&window.clearTimeout(an.current),an.current=window.setTimeout(()=>{Nr.current||Qt(500)},280)},[ks,e,Qt]);const ll=x.useMemo(()=>mU(i.current,h),[i.current,i.current.revision,h]),cl=x.useMemo(()=>f9(i.current,Ft),[i.current,i.current.revision,Ft]),Lo=x.useRef(null),[Da,Vc]=x.useState({w:0,h:0});x.useEffect(()=>{const F=Lo.current;if(!F||typeof ResizeObserver>"u")return;const q=new ResizeObserver(se=>{var Ae;const oe=(Ae=se[0])==null?void 0:Ae.contentRect;oe&&(Xs.current={width:oe.width,height:oe.height},Vc(ke=>Math.abs(ke.w-oe.width)>40||Math.abs(ke.h-oe.height)>40?{w:oe.width,h:oe.height}:ke))});return q.observe(F),Xs.current={width:F.clientWidth,height:F.clientHeight},Vc({w:F.clientWidth,h:F.clientHeight}),()=>q.disconnect()},[]);const qh=x.useCallback(F=>{var se,oe;const q=F.target;!(q!=null&&q.closest)||q.closest(X9)!==F.currentTarget||(F.preventDefault(),(oe=(se=document.activeElement)==null?void 0:se.blur)==null||oe.call(se))},[]),ul=x.useRef(new Map),[es,Fh]=x.useState(!1);x.useEffect(()=>{const F=window.setTimeout(()=>Fh(!0),2500);return()=>window.clearTimeout(F)},[]);const[Kc,Do]=x.useState(!1),Sr=x.useRef(null),[Zs,dl]=x.useState(!1),[Qs,Bh]=x.useState("full"),Yc=x.useRef("full"),zh=x.useCallback(()=>{Sr.current&&(window.clearTimeout(Sr.current),Sr.current=null),Do(!1)},[]),Xc=x.useCallback(F=>{F.length!==0&&queueMicrotask(()=>{Do(!0),Sr.current&&window.clearTimeout(Sr.current),Sr.current=window.setTimeout(()=>Do(!1),Z9+80)})},[]);x.useEffect(()=>()=>{Sr.current&&window.clearTimeout(Sr.current)},[]);const ln=y?i.current.agents.get(y):null,qa=f&&ln!=null,[Fa,Uh]=x.useState(0);x.useEffect(()=>{const F=RT(Lo.current);Uh(q=>Math.abs(q-F)>40?F:q)},[J,G,H,qa,Da.w]);const _s=Da.w>0?Math.max(0,(Da.w-Fa-Yv*2)*Xv):0,qo=Da.h>0?Math.max(0,(Da.h-Yv*2)*Xv):0,Zc=h6(),{nodes:zn,edges:Fo}=x.useMemo(()=>bG(i.current,Ft,_s,qo,Zt.current,Jr.current,ul.current,Xc,es,Zs,on.current,Gc.current,ks,Po,h,ll,cl,R),[i.current,i.current.revision,Ft,_s,qo,es,Zs,ks,h,ll,cl,R,To,Zc]),Qc=x.useState(fG)[0],hl=x.useRef(Qc);x.useEffect(()=>{if(!es||Zs)return;const F={width:_s,height:qo};if(!(F.width>0&&F.height>0))return;const q=hl.current;if(hl.current=F,pG(F),!q||q.width===F.width&&q.height===F.height)return;const se={direction:"LR",pinned:Zt.current,measured:Jr.current,lanes:qM(i.current)};if(o9(zn,Fo,se,q,F)){for(const oe of Array.from(on.current.keys()))Zt.current.has(oe)||on.current.delete(oe);Gc.current.clear(),Po.current="",u(),window.setTimeout(()=>{wd(on.current,Zt.current),!Nr.current&&Qt(500)},80)}},[_s,qo,es,Zs,u,Qt]);const fl=x.useMemo(()=>{const F=new Map;for(const se of zn){const oe=se.data;if(!(oe!=null&&oe.sessionId)||oe.exitAt!=null)continue;const Ae=se.width,ke=se.height;if(Ae==null||ke==null)continue;const He=se.position.x,at=se.position.y,vt=He+Ae,Ke=at+ke,gn=F.get(oe.sessionId);gn?(gn.minX=Math.min(gn.minX,He),gn.minY=Math.min(gn.minY,at),gn.maxX=Math.max(gn.maxX,vt),gn.maxY=Math.max(gn.maxY,Ke)):F.set(oe.sessionId,{minX:He,minY:at,maxX:vt,maxY:Ke})}const q=[];for(const[se,oe]of F){const Ae=oe.maxX-oe.minX+gd*2,ke=oe.maxY-oe.minY+gd*2;q.push({id:`group:${se}`,type:EM,position:{x:oe.minX-gd,y:oe.minY-gd},data:{sessionId:se,w:Ae,h:ke},width:Ae,height:ke,style:{width:Ae,height:ke},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return q},[zn]),Wh=x.useMemo(()=>{const F=[...fl,...zn],q=vs.current;return!q||q.size===0?F:F.map(se=>{const oe=q.get(se.id);return oe?{...se,position:oe}:se})},[fl,zn,Ic]),Bo=x.useMemo(()=>{const F=new Set;for(const q of i.current.agents.values())for(const se of q.tools)F.add(DM(se.name));return Object.keys(LM).filter(q=>F.has(q))},[i.current,i.current.revision]);x.useEffect(()=>{if(Bo.length<=1){Mc(!1);return}let F=0;const q=()=>{const se=Ra.current;if(se&&!document.hidden){const oe=se.getBoundingClientRect(),Ae=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(He=>He.getBoundingClientRect()),ke=m9(oe,Ae,8);Mc(He=>He===ke?He:ke)}F=window.setTimeout(q,300)};return q(),()=>window.clearTimeout(F)},[Bo.length]);const Hh=x.useCallback(F=>{Mo(q=>{const se=new Set(q);return se.has(F)?se.delete(F):se.add(F),se})},[]),pl=N?Y4(i.current.agents,N):null,Jc=x.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}i.current=mx(),Zt.current.clear(),Jr.current.clear(),on.current.clear(),Po.current="",PT(),b(),u()},[u,b]),Rn=x.useRef($);Rn.current=$;const Js=x.useRef(W);Js.current=W;const zo=x.useRef(!1);zo.current=pl!=null||xr||C!=null||V||j!=null||bt||W||ut!=null;const Ba=x.useCallback(F=>{const q=fB(F,{confirmOpen:Rn.current,modalOpen:zo.current});q==="confirm"?D(!0):q==="clear"&&(D(!1),Jc())},[Jc]),Uo=x.useCallback(()=>{Zt.current.clear(),on.current.clear(),Po.current="",PT(),u(),window.setTimeout(()=>Qt(500),80)},[u,e,Qt]),ml=x.useCallback(()=>Qt(500),[Qt]),ea=x.useRef(zn);ea.current=zn;const gl=x.useRef(y);gl.current=y;const Wo=x.useCallback(F=>{const q=ea.current.filter(ke=>ke.type==="agent"),se=oU(q.map(ke=>({id:ke.id,x:ke.position.x,y:ke.position.y})),gl.current,F),oe=se?q.find(ke=>ke.id===se):void 0;if(!oe)return;const Ae=AT(document.activeElement);S(oe.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:Vv(350),nodes:[oe]})}catch{}mn.current=Date.now(),Ae&&Y9(oe.id)},30)},[S,e]),ts=x.useRef(null),ns=x.useCallback(F=>{S(F,!1),window.setTimeout(()=>{try{const q=ea.current.find(se=>se.id===F);q&&e.fitView({padding:.3,duration:Vv(500),nodes:[q]}),mn.current=Date.now()}catch{}},60)},[S,e]),ta=x.useRef(null);x.useEffect(()=>{let F=-1/0;const q=()=>{F=performance.now()},se=oe=>{ta.current=performance.now()-F<250?oe.target:null};return window.addEventListener("pointerdown",q,!0),window.addEventListener("focusin",se,!0),()=>{window.removeEventListener("pointerdown",q,!0),window.removeEventListener("focusin",se,!0)}},[]),x.useEffect(()=>{const F=q=>{var at,vt;const se=q.target,oe={tagName:se==null?void 0:se.tagName,isContentEditable:se==null?void 0:se.isContentEditable,role:(at=se==null?void 0:se.getAttribute)==null?void 0:at.call(se,"role"),type:se==null?void 0:se.type,pointerFocused:se!=null&&se===ta.current};if(q.key==="Escape"){const Ke=L5({overlayOpen:Wd.depth()>0,typing:n0(oe)});Ke==="dismiss"?Wd.dismissTop():Ke==="blur"?se==null||se.blur():(uU(oe)&&(se==null||se.blur()),b());return}if(dh(q))return;const Ae=AT(se)?(vt=se==null?void 0:se.getAttribute)==null?void 0:vt.call(se,"data-id"):null,ke=Ae&&ea.current.some(Ke=>Ke.id===Ae)?Ae:null,He=lU(q,ke);if(He.kind==="activate"){q.preventDefault(),S(He.nodeId,He.additive);return}if(He.kind!=="node"&&!(He.nodeId==null&&G5(oe,q.key))&&!V5({key:q.key,modalOpen:zo.current,sheetOpen:Js.current})){if(q.key===" "&&(q.preventDefault(),ft()),(q.key==="c"||q.key==="C")&&Ba("shortcut"),(q.key==="r"||q.key==="R")&&Uo(),(q.key==="f"||q.key==="F")&&ml(),(q.key==="l"||q.key==="L")&&Rt(),q.key==="d"||q.key==="D")if(gl.current)p(Ke=>!Ke);else{const Ke=vp(i.current.agents.values());Ke.length>0?ns(Ke[0].id):Wo(1)}if((q.key==="h"||q.key==="H")&&xt(Ke=>!Ke),(q.key==="u"||q.key==="U")&&I(Ke=>!Ke),(q.key==="a"||q.key==="A")&&rn.current.claude&&Mt(),(q.key==="j"||q.key==="J")&&Wo(1),(q.key==="k"||q.key==="K")&&Wo(-1),q.key==="w"||q.key==="W"){const Ke=E5(vp(i.current.agents.values()),ts.current);Ke&&(ts.current=Ke.id,ns(Ke.id))}(q.key==="t"||q.key==="T")&&Dc(Ke=>Ke==="dark"?"light":"dark"),(q.key==="m"||q.key==="M")&&rn.current.claude&&Se.current!==null&&ge.current(q.shiftKey),(q.key==="s"||q.key==="S")&&P(Ke=>!Ke),(q.key==="b"||q.key==="B")&&gs(Ke=>!Ke),(q.key==="v"||q.key==="V")&&rn.current.claude&&Se.current!==null&&Qe(Ke=>!Ke),q.key==="?"&&L(Ke=>!Ke)}};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[Ba,Uo,ml,b,S,Wo,ns,ft]);const Ho=i.current.agents.size,Wt=x.useMemo(()=>vp(i.current.agents.values()),[i.current,i.current.revision]),za=x.useMemo(()=>C5(i.current.agents.values()),[i.current,i.current.revision]),Ns=x.useRef(null);x.useEffect(()=>{const F=AU({waiting:Wt.length,running:za,connected:$e}),q=Ns.current;if(Ns.current=F,(q==null?void 0:q.title)!==F.title&&(document.title=F.title),(q==null?void 0:q.icon)!==F.icon){const se=document.querySelector('link[rel="icon"]');se&&(se.href=RU[F.icon])}},[Wt.length,za,$e]);const[yl,eu]=x.useState(""),Ua=IU(Wt);x.useEffect(()=>{eu(F=>$U(F,Ua))},[Ua]);const[Wa,tu]=x.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[rs,Go]=x.useState(null),[Ha,Vo]=x.useState(!1),[ss,Ko]=x.useState(!1);x.useEffect(()=>{let F=!0;return fetch("/api/prefs").then(q=>q.ok?q.json():null).then(q=>{var se,oe,Ae;if(!(!F||!(q!=null&&q.ok))){if(!Yi.current){let ke=!1;try{ke=window.localStorage.getItem(yd)==="0",window.localStorage.removeItem(yd)}catch{}ke&&((se=q.prefs)==null?void 0:se.autoUpdate)!==!1?(Ma(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):Ma(((oe=q.prefs)==null?void 0:oe.autoUpdate)!==!1)}Vo(((Ae=q.prefs)==null?void 0:Ae.notifications)===!0),Ko(q.notificationsVetoed===!0)}}).catch(()=>{}),()=>{F=!1}},[]);const Yo=x.useRef(()=>{}),Gh=x.useCallback(()=>{const F=!Ha;Vo(F),F&&typeof Notification<"u"&&Notification.permission==="default"&&Yo.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:F})}).then(q=>q.ok?q.json():null).then(q=>{var se;q!=null&&q.ok&&(Vo(((se=q.prefs)==null?void 0:se.notifications)===!0),Ko(q.notificationsVetoed===!0))}).catch(()=>{})},[Ha]),Vh=typeof Notification<"u";x.useEffect(()=>{if(!rs)return;const q=setTimeout(()=>Go(null),rs==="blocked"?8e3:4e3);return()=>clearTimeout(q)},[rs]);const na=x.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(F=>{const q=F;tu(q),q==="granted"?Go("on"):q==="denied"&&Go("blocked")})},[]);Yo.current=na;const Ga=x.useRef(new Set),Xo=x.useRef(null),nu=Wt.map(F=>uh(F.id,F.waiting)).join("|");x.useEffect(()=>{M5(Xo.current,Wa)&&(Xo.current=Wa,Ga.current=xp(Wt))},[Wa]);const kt=x.useRef(!1);return x.useEffect(()=>{I5(kt.current,Zr)&&(kt.current=!0,Ga.current=xp(Wt))},[Zr]),x.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!$5(Xo.current,Zr))return;const F=typeof document>"u"||!document.hidden,q=A5(Wt,Ga.current,F,Ha);for(const se of q)try{const oe=new Notification(se.title,{body:se.body,tag:se.key});oe.onclick=()=>{window.focus(),ns(se.sessionId),oe.close()}}catch{}Ga.current=F?xp(Wt):R5(Wt,q,Ga.current)},[nu,Zr]),l.jsxs("div",{className:"app",children:[l.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),l.jsxs("header",{className:"topbar",children:[l.jsxs("div",{className:"readout",children:[l.jsxs("div",{className:"brand",children:[l.jsx("span",{className:"logo"}),l.jsx("h1",{children:Kt}),he?l.jsxs("button",{type:"button",className:"v stale",onClick:()=>{Lt(),wr()},"aria-haspopup":"dialog","aria-label":T9({...he,open:_n}),title:he.kind==="restart"?`Running v${he.from}; v${he.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${he.from}; v${he.to} is on npm · click for what's new`,children:["v",he.from,l.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const F={running:pn,latest:ie==null?void 0:ie.latest,latestPending:ie==null?void 0:ie.latestPending,checkedAgo:ie!=null&&ie.checkedAt?_d(Ft-ie.checkedAt):null,checkFailedAgo:ie!=null&&ie.checkFailedAt&&ie.checkFailedAt>(ie.checkedAt??0)?_d(Ft-ie.checkFailedAt):null,checkDisabled:ie==null?void 0:ie.checkDisabled,checking:yt};return l.jsxs("button",{type:"button",className:yt?"v checking":"v",onClick:()=>{Lt(),Et(!0)},"aria-busy":yt||void 0,"aria-haspopup":"dialog","aria-label":C9(F),title:E9(F),children:["v",F.running]})})()]}),l.jsx("span",{className:"status",children:(()=>{const F=z9({connected:$e,paused:Ro,held:sn.size,dropped:sn.dropped});return F.resting?null:l.jsx("span",{className:`pill ${F.tone}`,title:F.title,children:l.jsxs("span",{className:"pill-box",children:[l.jsx("span",{className:"pill-widest","aria-hidden":!0,children:F.widest}),l.jsx("span",{className:"pill-label",children:F.label})]})})})()}),l.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:yl}),Wt.length>0&&l.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>{ts.current=Wt[0].id,ns(Wt[0].id)},title:`Blocked waiting for you — click, or press W, to go to the one that has been stuck longest:
290
+ ${Wt.map(F=>` ${F.label}: ${Li(F.waiting)} (${_d(Ft-F.waiting.since)})`).join(`
291
+ `)}`,"aria-label":`${Wt.length} session${Wt.length===1?"":"s"} waiting for you`,children:[l.jsx("span",{className:"ap-pulse","aria-hidden":!0}),l.jsx("b",{children:Wt.length})," ",l.jsx("span",{className:"ws-word",children:"waiting"})]}),rs&&l.jsx("span",{className:rs==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:rs==="on"?"The deck will raise a system notification when a session blocks on you and this tab is in the background":"Notifications are blocked for this page. Only your browser can undo that — its site settings for this address",children:rs==="on"?"notifications on":"notifications blocked"})]}),ln&&(()=>{const F=Zn(ln),q=Math.max(0,((ln.endedAt??Ft)-ln.startedAt)/1e3),se=ln.state==="active"?e0(F.total,q):null,oe=h.size-1;return l.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${ln.label}`,onClick:()=>{try{const Ae=zn.find(ke=>ke.id===ln.id);Ae&&e.fitView({padding:.35,duration:Vv(500),nodes:[Ae]}),mn.current=Date.now()}catch{}},children:[l.jsx("span",{className:`state-pill state-${ln.state}`,children:ln.state==="active"?"live":ln.state}),l.jsx("span",{className:"selected-label",children:ln.label}),F.total>0&&l.jsxs("span",{className:"selected-cost",children:[_t(F.total),se?l.jsxs("span",{className:"selected-rate",children:[" · ",se]}):null]}),oe>0&&l.jsxs("span",{className:"selected-extra",children:["+",oe]}),l.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:Ae=>{Ae.stopPropagation(),b()},children:"×"})]})})(),l.jsxs("div",{className:"actions",children:[l.jsxs("div",{className:"action-run",children:[l.jsxs("button",{className:"btn icon-btn",onClick:Rt,title:`${M?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":M,"aria-controls":M?"session-list":void 0,children:[l.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:[l.jsx("path",{d:"M5.4 3.6h6.6M5.4 7h6.6M5.4 10.4h6.6"}),l.jsx("path",{d:"M2.2 3.6h.2M2.2 7h.2M2.2 10.4h.2"})]}),l.jsx("span",{className:"tb-word",children:"Session list"})]}),l.jsxs("button",{className:"btn icon-btn",onClick:()=>I(F=>!F),title:`${H?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":H,"aria-controls":H?"usage-panel":void 0,children:[l.jsxs("svg",{className:"tb-glyph-narrow",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M9.4 4.5C9 3.6 8.1 3.1 7 3.1c-1.4 0-2.4.8-2.4 1.9 0 1.2 1.2 1.6 2.4 2s2.4.8 2.4 2c0 1.1-1 1.9-2.4 1.9-1.1 0-2-.5-2.4-1.4"}),l.jsx("path",{d:"M7 1.6v1.5M7 10.9v1.5"})]}),l.jsx("span",{className:"tb-word",children:"Usage"})]}),l.jsxs("button",{className:"btn icon-btn",onClick:()=>xt(F=>!F),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:[l.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:[l.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),l.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),l.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]}),l.jsx("span",{className:"tb-word",children:"History"})]})]}),l.jsxs("div",{className:"action-run",children:[At.claude&&l.jsxs("button",{className:"btn icon-btn",onClick:Mt,title:`${O?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":O,"aria-controls":O?"accounts-panel":void 0,children:[l.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:[l.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),l.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]}),l.jsx("span",{className:"tb-word",children:"Accounts"})]}),l.jsxs("button",{className:"btn icon-btn",onClick:()=>P(F=>!F),title:`${B?"Hide":"Show"} this machine — cores, memory, temperature (S)`,"aria-label":"Toggle machine detail","aria-expanded":B,"aria-controls":B?"system-panel":void 0,children:[l.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:[l.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),l.jsx("path",{d:"M5.8 1.4v2.2M8.2 1.4v2.2M5.8 10.4v2.2M8.2 10.4v2.2M1.4 5.8h2.2M1.4 8.2h2.2M10.4 5.8h2.2M10.4 8.2h2.2"})]}),l.jsx("span",{className:"tb-word",children:"Machine"})]}),l.jsxs("button",{className:"btn icon-btn bw-btn",onClick:()=>gs(F=>!F),title:Hs?"Browser watch — watching; the deck is keeping its own copy (B)":"Browser watch — not watching; reading the browser's history live (B)","aria-label":`Browser watch, ${Hs?"watching":"not watching"}`+(Wr>0?`, ${Wr} unread`:""),"aria-haspopup":"dialog",children:[l.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:[l.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"}),Hs||Wr>0?l.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):l.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),l.jsx("span",{className:"tb-word",children:"Browser watch"}),Wr>0&&l.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Wr})]})]}),l.jsxs("div",{className:"action-run action-run-utility",children:[At.claude&&U!==null&&l.jsxs("div",{className:"sound-slot",children:[l.jsxs("button",{ref:ue,className:"btn icon-btn",onClick:()=>Qe(F=>!F),..._a(!1),title:P9(At,{on:U===!0,locked:Re==="locked",prefs:Oe}),"aria-label":`Sound settings, ${U?"on":"off"}`,"aria-haspopup":"dialog","aria-expanded":dt,"aria-controls":dt?"sound-menu":void 0,children:[l.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:[l.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),U?l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),l.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M10 5.6l2.6 2.8"}),l.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]}),l.jsx("span",{className:"tb-word",children:"Sound"})]}),dt&&l.jsx(FB,{onClose:()=>Qe(!1),soundOn:U===!0,onToggleSound:ae,prefs:Oe,onLevel:(F,q)=>Ye(F,{level:q}),onFigure:(F,q)=>Ye(F,{figure:q}),onPreview:F=>_e(F),notifyOn:Ha,onToggleNotify:Gh,notifyVetoed:ss,notifyPermission:Vh?Wa:"unsupported",onAskNotify:na,openerRef:ue})]}),l.jsx("button",{className:"btn icon-btn",onClick:()=>Dc(F=>F==="dark"?"light":"dark"),title:`Switch to ${Ks==="dark"?"light":"dark"} mode (T)`,"aria-label":`Switch to ${Ks==="dark"?"light":"dark"} mode`,children:Ks==="dark"?l.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:[l.jsx("circle",{cx:"7",cy:"7",r:"2.5"}),l.jsx("path",{d:"M7 1.5v1.2M7 11.3v1.2M1.5 7h1.2M11.3 7h1.2M3.1 3.1l.85.85M10.05 10.05l.85.85M3.1 10.9l.85-.85M10.05 3.95l.85-.85"})]}):l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M11.8 8.4A5 5 0 1 1 5.6 2.2a4 4 0 0 0 6.2 6.2Z"})})})]})]})]}),br?l.jsxs("div",{className:"ver-banner done",role:"status",children:[l.jsx("span",{className:"ver-dot"}),l.jsxs("strong",{children:["Restarted — now running v",br,"."]}),l.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):_r&&!$e?l.jsxs("div",{className:"conn-banner",role:"alert",children:[l.jsx("span",{className:"conn-dot"}),er?Hr==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Kt}…`:(()=>{const F=F9({connected:$e,paused:Ro});return l.jsxs(l.Fragment,{children:[`Lost connection to the ${Kt} server. Reconnecting…`,F&&l.jsx("span",{className:"conn-sub",children:F})]})})()]}):_n&&he?l.jsxs("div",{className:`ver-banner ${he.kind}`,role:"status",children:[l.jsx("span",{className:`ver-dot${$a==null?"":" armed"}`}),he.kind==="restart"?l.jsxs(l.Fragment,{children:[l.jsxs("strong",{children:["v",he.to," is installed — this deck still runs v",he.from,"."]}),ie!=null&&ie.canRestart?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"ver-act",onClick:()=>Ia(),..._a(er),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
292
+
293
+ 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:er?"restarting…":Xi.label}),!er&&l.jsx("span",{className:"ver-sub",children:Xi.clause}),l.jsxs("label",{className:"ver-auto",children:[l.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":Jn,onClick:Oc,"aria-label":"Auto-restart when idle",title:Jn?"Updates on its own. While you are here it restarts once nothing has been running for 30 seconds; while you are away it also installs the new version first. Click to require a click instead.":"Only updates when you click. Click to let it update itself when idle or while you are away.",children:l.jsx("span",{className:"switch-knob"})}),l.jsx("span",{"aria-hidden":!0,children:uB(Jn,$a)})]})]}):l.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."})]}):l.jsxs(l.Fragment,{children:[l.jsxs("strong",{children:[Kt," v",he.to," is out — you are on v",he.from,"."]}),(ie==null?void 0:ie.upgradeMode)==="install"&&Ce!=="failed"&&l.jsx("button",{type:"button",className:"ver-act",onClick:ze,..._a(Ce==="running",Ce==="done"),title:`Runs ${((Va=ie==null?void 0:ie.upgrade)==null?void 0:Va.command)??(ie==null?void 0:ie.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Ce==="running"?"installing…":Ce==="done"?"installed":"Update now"}),(ie==null?void 0:ie.upgradeMode)==="npx"&&(ie==null?void 0:ie.canRestart)&&l.jsx("button",{type:"button",className:"ver-act",onClick:()=>Ia({upgrade:!0}),..._a(er),title:`Runs ${ie==null?void 0:ie.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:er?"fetching…":Ce==="failed"?"Retry update":"Update & restart"}),Ce==="failed"?l.jsxs("span",{className:"ver-sub fail",title:((ra=ie==null?void 0:ie.upgrade)==null?void 0:ra.error)??"",children:[(ie==null?void 0:ie.upgradeMode)==="npx"?"update failed":"install failed",": ",((wl=ie==null?void 0:ie.upgrade)==null?void 0:wl.error)??"unknown error"," — run it yourself:"]}):(ie==null?void 0:ie.upgradeMode)==="npx"?l.jsx("span",{className:"ver-sub",children:ie!=null&&ie.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Qv.npx}):ie!=null&&ie.upgradeBlocked?l.jsx("span",{className:"ver-sub",children:Object.hasOwn(Qv,ie.upgradeBlocked)?Qv[ie.upgradeBlocked]:"cannot install from here"}):null,l.jsxs("button",{type:"button",className:"ver-cmd",onClick:ht,title:"Copy to clipboard",children:[l.jsx("code",{children:ie==null?void 0:ie.command}),l.jsx("span",{className:"ver-cmd-hint",children:tt?"copied":"copy"})]})]}),l.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:vr,children:"×"})]}):ms&&Nn?l.jsxs("div",{className:"ver-banner",role:"status",children:[l.jsx("span",{className:"ver-dot"}),l.jsxs("strong",{children:[Nn," still works — the deck is called ",Kt," now."]}),ie!=null&&ie.renameFix?l.jsx("span",{className:"ver-sub",children:ie.renameFix}):null,l.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Z,children:"×"})]}):null,bp(de)&&At.claude&&l.jsx(rB,{leaving:de==="leaving",onClose:()=>K(!1)}),M&&l.jsx(qD,{state:i.current,now:Ft,selectedIds:h,onSelect:ns,onClose:()=>X(!1)}),l.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${Kc?" bubbling":""}${Zs?" dragging-any":""}`,"data-detail":Qs,ref:Lo,onMouseDownCapture:qh,onPointerDownCapture:rl,onPointerUpCapture:rl,onWheelCapture:rl,children:[Ho===0&&(!$e&&ye?l.jsx(jG,{}):l.jsx(EG,{live:$e,everConnected:_r,providers:At,workspace:Bn,onTour:()=>Q(!0)})),(Bo.length>1||Yr.size>0)&&l.jsx("div",{ref:Ra,className:`cat-filter-bar${Ph?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Bo.map(F=>{const q=Yr.has(F);return l.jsxs("button",{type:"button",className:`cat-filter${q?" off":""}`,onClick:()=>Hh(F),"aria-pressed":!q,title:`${q?"Show":"Hide"} ${th[F]} tools`,children:[l.jsx(vG,{cat:F}),l.jsx("span",{className:"cat-name",children:th[F]})]},F)})}),l.jsxs(nA,{nodes:Wh,edges:Fo,nodeTypes:H9,edgesFocusable:!1,edgeTypes:G9,fitView:!Kr,fitViewOptions:{padding:.25,duration:Ad({durationMs:MT,documentHidden:document.hidden})?MT:0},minZoom:TM,maxZoom:AM,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:(F,q)=>{if(q.type==="sessionGroup"){b();return}if(q.type==="recapNote"){S(q.data.parentId,F.shiftKey);return}S(q.id,F.shiftKey)},onPaneClick:()=>b(),onMoveStart:F=>{ST(Fc(F))&&al()},onMove:(F,q)=>{var oe;Qr(),ST(Fc(F))&&al();const se=Q9(q.zoom);se!==Yc.current&&(Yc.current=se,Bh(se)),(oe=Lo.current)==null||oe.style.setProperty("--zoom",String(q.zoom)),Pa.current&&window.clearTimeout(Pa.current),Pa.current=window.setTimeout(()=>gG(q),250)},onNodeDragStart:(F,q)=>{var se;if(zh(),ol.current=!0,vs.current=new Map,dl(!0),Qr(),al(),q.type==="sessionGroup"){const oe=(se=q.data)==null?void 0:se.sessionId,Ae=new Map;if(oe)for(const ke of zn){const He=ke.data;(He==null?void 0:He.sessionId)===oe&&Ae.set(ke.id,{x:ke.position.x,y:ke.position.y})}Vr.current={start:{x:q.position.x,y:q.position.y},members:Ae};return}Zt.current.set(q.id,{x:q.position.x,y:q.position.y})},onNodeDrag:(F,q)=>{var se;if(Qr(),q.type==="sessionGroup"){const oe=Vr.current;if(!oe)return;const Ae=q.position.x-oe.start.x,ke=q.position.y-oe.start.y;for(const[at,vt]of oe.members){const Ke={x:vt.x+Ae,y:vt.y+ke};Zt.current.set(at,Ke),on.current.set(at,Ke)}const He=vs.current;if(He){for(const[at,vt]of oe.members)He.set(at,{x:vt.x+Ae,y:vt.y+ke});He.set(q.id,{x:q.position.x,y:q.position.y})}Ao(at=>at+1);return}Zt.current.set(q.id,{x:q.position.x,y:q.position.y}),on.current.set(q.id,{x:q.position.x,y:q.position.y}),(se=vs.current)==null||se.set(q.id,{x:q.position.x,y:q.position.y}),Ao(oe=>oe+1)},onNodeDragStop:(F,q)=>{if(Qr(),ol.current=!1,vs.current=null,dl(!1),Gs(se=>se+1),q.type==="sessionGroup"){const se=Vr.current;if(se){const oe=q.position.x-se.start.x,Ae=q.position.y-se.start.y;for(const[ke,He]of se.members){const at={x:He.x+oe,y:He.y+Ae};Zt.current.set(ke,at),on.current.set(ke,at)}}Vr.current=null,wd(on.current,Zt.current),Gs(oe=>oe+1);return}Zt.current.set(q.id,{x:q.position.x,y:q.position.y}),on.current.set(q.id,{x:q.position.x,y:q.position.y}),wd(on.current,Zt.current)},children:[l.jsx(I4,{gap:28,size:1,color:Xr["--grid-line"]}),l.jsx(W6,{onFit:()=>{mn.current=Date.now()}}),l.jsx(TD,{agents:i.current.agents,visibleAgentIds:cl,positions:on.current,pinned:Zt.current,measured:Jr.current,spotlight:ll,hiddenCategories:Yr,now:Ft,onOpenTool:_}),sl&&l.jsxs("div",{className:"autofit-chip",children:[l.jsx("span",{className:"autofit-state",title:"New sessions are not brought into view while you are moving it yourself",children:"Auto-fit off"}),l.jsx("button",{type:"button",className:"autofit-resume",onClick:zc,title:"Bring new sessions into view again","aria-label":"Resume auto-fit",children:"Resume"})]}),l.jsxs(E4,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[l.jsx(ur,{onClick:()=>e.zoomIn(),title:"Zoom in","aria-label":"Zoom in",disabled:t,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:l.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),l.jsx(ur,{onClick:()=>e.zoomOut(),title:"Zoom out","aria-label":"Zoom out",disabled:n,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:l.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),l.jsx(ur,{onClick:zc,title:sl?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view","data-nudge":sl?"":void 0,children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),l.jsx(ur,{"data-group-start":"",onClick:ft,title:q9({paused:Ro,held:sn.size,dropped:sn.dropped}),"aria-label":D9,"aria-pressed":Ro,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:l.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),l.jsx(ur,{onClick:Uo,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),l.jsx(ur,{"data-group-start":"","data-danger":"",onClick:()=>Ba("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),l.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"}),l.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"}),l.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),l.jsx(ur,{"data-group-start":"",onClick:()=>L(F=>!F),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.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"}),l.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),l.jsx(x4,{zoomable:!0,pannable:!0,nodeColor:qc,nodeStrokeWidth:2,maskColor:Xr["--minimap-mask"],maskStrokeColor:Xr["--line"]}),l.jsx(Lz,{ref:Te})]})]}),bp(G)&&l.jsx(yq,{state:i.current,now:Ft,providers:At,liveSince:Zr,leaving:G==="leaving",onClose:()=>I(!1)}),bp(J)&&l.jsx(Vq,{usageOpen:H,leaving:J==="leaving",onClose:()=>P(!1)}),f&&ln?l.jsxs("aside",{className:"detail","aria-label":"Detail",children:[l.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>p(!1),children:"×"}),l.jsx(TG,{agent:ln,now:Ft,onOpenTool:_,onShowSummary:E,onExportSession:F=>yG(i.current,F)})]}):null,pl&&l.jsx(I6,{tool:pl,onClose:()=>_(null)}),xr&&l.jsx(x.Suspense,{fallback:null,children:l.jsx(U9,{providers:At,onClose:()=>xt(!1)})}),bt&&l.jsx(x.Suspense,{fallback:null,children:l.jsx(W9,{onClose:()=>gs(!1),onSeen:F=>{jo(F);try{localStorage.setItem(nN,String(F))}catch{}},onWatching:ws,palette:Xr})}),C&&(()=>{const F=i.current.agents.get(C);return F?l.jsx(J5,{agent:F,onClose:()=>T(null)}):null})(),j&&l.jsx(PD,{state:i.current,sessionId:j,onClose:()=>E(null)}),ut&&l.jsx(sU,{entries:ut.entries,since:ut.since,firstRun:ut.firstRun,running:pn,onClose:()=>st(null),onTour:()=>{st(null),Q(!0)}}),(()=>{const{request:F,waiting:q}=PU(Tn,An.current);return F?l.jsx(LU,{request:F,waiting:q,busy:Co,now:Date.now(),onAccept:()=>void Rc("accept",F.fp),onDecline:()=>void Rc("dismiss",F.fp),onLater:()=>{Co||(An.current.add(F.fp),Ur(se=>[...se]))}}):null})(),W&&l.jsx(xB,{onClose:()=>L(!1),onTour:()=>{L(!1),Q(!0)}}),V&&l.jsx(rR,{title:"What the deck shows you",steps:FF,onClose:()=>{Q(!1),eU(eN());const F=ee.current;ee.current=null,F&&st(F)}}),$&&l.jsx(yB,{agentCount:Ho,onConfirm:()=>Ba("confirmation"),onCancel:()=>D(!1)})]})}function jG(){return l.jsxs("div",{className:"empty-hero",children:[l.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[l.jsx("div",{className:"core"}),l.jsxs("div",{className:"orbit r1",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r2",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r3",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]})]}),l.jsxs("h2",{children:["Too many ",Kt," tabs are open"]}),l.jsxs("p",{children:["This browser keeps at most six live connections to one address, and other ",l.jsx("code",{children:Kt})," tabs are holding them. Close one and this tab connects on its own."]})]})}function EG({live:e,everConnected:t,providers:n,workspace:r,onTour:a}){const i=!e;return l.jsxs("div",{className:"empty-hero",children:[l.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[l.jsx("div",{className:"core"}),l.jsxs("div",{className:"orbit r1",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r2",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r3",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]})]}),i?l.jsxs(l.Fragment,{children:[l.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),l.jsxs("p",{children:[t?"This page lost its connection to ":"This page cannot reach ",l.jsx("code",{children:Kt}),". Check that it is still running in your terminal — the page picks up again on its own."]})]}):CG(n,r),!i&&l.jsx("button",{type:"button",className:"btn empty-tour",onClick:a,children:"Take the tour"})]})}function CG(e,t){const n=A9(t);return l.jsxs(l.Fragment,{children:[l.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?l.jsxs("p",{children:[n.lead," ",l.jsx("code",{children:n.workspace}),n.tail]}):l.jsxs("p",{children:["Run ",l.jsx("code",{children:"claude"})," or ",l.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."]}),O9(e).map(r=>l.jsx("p",{className:"hint-row",children:r.spans.map((a,i)=>a.code?l.jsx("code",{children:a.text},i):l.jsx("span",{children:a.text},i))},r.provider))]})}function TG({agent:e,now:t,onOpenTool:n,onShowSummary:r,onExportSession:a}){const i=`${e.synthetic?"≥ ":""}${Ud(e.startedAt,e.endedAt,t)}`,c=Zn(e),u=c.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const _=DM(N.name);p.set(_,(p.get(_)??0)+1)}const h=e.tools.filter(N=>N.ok===!1).length,m=e.tools.filter(N=>!N.endedAt).length,y=Array.from(p.entries()).sort((N,_)=>_[1]-N[1]),w=p.has("mcp")?ND(e.tools.map(N=>N.name)):null;return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:"detail-hero",children:[l.jsxs("div",{className:"hero-line",children:[l.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),l.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),l.jsxs("div",{className:"hero-meta",children:[l.jsx("span",{className:"hero-meta-item",children:e.kind==="root"?"session":"subagent"}),l.jsx("span",{className:"hero-sep",children:"·"}),l.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:i}),e.model&&(()=>{const N=vA(e);return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"hero-sep",children:"·"}),l.jsxs("span",{className:"model-chip","data-family":ch(e.model),title:N.length>0?`${e.model}
294
+ spend on this panel also covers:
295
+ ${N.join(`
296
+ `)}`:e.model,children:[go(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),u&&l.jsxs("div",{className:"hero-cost",children:[l.jsxs("div",{className:"hero-cost-headline",children:[l.jsx("span",{className:"hero-cost-value",children:_t(c.total)}),l.jsx("span",{className:"hero-cost-label",children:"spend"})]}),l.jsx(o0,{cost:c})]}),l.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&r&&l.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>r(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),a&&l.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>a(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),(()=>{const N=fh(e);if(!N)return null;const _=wx(N.at,t);return l.jsxs("section",{className:"detail-section",children:[l.jsxs("h3",{children:["Recap ",l.jsx("span",{className:"section-count",title:_.title,children:_.label})]}),l.jsx("p",{className:"detail-recap",children:N.text})]})})(),e.tools.length>0&&l.jsxs("section",{className:"detail-section",children:[l.jsx("h3",{children:"Activity"}),l.jsxs("div",{className:"activity-row",children:[l.jsxs("div",{className:"activity-counters",children:[l.jsxs("span",{className:"ac-item",children:[l.jsx("b",{children:e.toolCount})," calls"]}),m>0&&l.jsxs("span",{className:"ac-item ac-live",children:[l.jsx("b",{children:m})," live"]}),h>0&&l.jsxs("span",{className:"ac-item ac-err",children:[l.jsx("b",{children:h})," err"]})]}),l.jsx("div",{className:"cat-strip",children:y.map(([N,_])=>{const S=N==="mcp"?w:null,b=S==null?void 0:S.hue,j=`${_} ${th[N]} call${_===1?"":"s"}`;return l.jsxs("span",{className:`cat-chip cat-${N}${b!=null?" mcp-hue":""}`,style:b!=null?{"--mcp-hue":b}:void 0,title:S?`${j}, all to ${S.label}`:j,children:[l.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:LM[N]}),l.jsx("span",{className:"cat-name",children:th[N]}),l.jsx("span",{className:"cat-count",children:_}),S&&l.jsx("span",{className:"cat-server",children:S.label})]},N)})})]})]}),f>0&&l.jsxs("section",{className:"detail-section",children:[l.jsx("h3",{children:"Tokens"}),l.jsxs("div",{className:"tokens-grid",children:[l.jsxs("div",{children:[l.jsx("span",{className:"k",children:"in"}),l.jsx("b",{title:e.usage.inputTokens.toLocaleString(),children:bn(e.usage.inputTokens)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"k",children:"out"}),l.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:bn(e.usage.outputTokens)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"k",children:"cache r"}),l.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:bn(e.usage.cacheReadTokens)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"k",children:"cache c"}),l.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:bn(e.usage.cacheCreateTokens)})]})]})]}),l.jsxs("section",{className:"detail-section",children:[l.jsx("h3",{children:"Identity"}),l.jsxs("div",{children:[e.cwd&&l.jsxs("div",{className:"row",children:[l.jsx("span",{className:"k",children:"cwd"}),l.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),l.jsxs("div",{className:"row",children:[l.jsx("span",{className:"k",children:"session"}),l.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&l.jsxs("div",{className:"row",children:[l.jsx("span",{className:"k",children:"parent"}),l.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&l.jsxs("section",{className:"detail-section",children:[l.jsxs("h3",{children:["Prompts ",l.jsx("span",{className:"section-count",children:lA(e.prompts).length})]}),l.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((N,_)=>{const S=wx(N.at,t),b=Zx(N.text);return b?l.jsxs("details",{className:"prompt-entry prompt-injected",children:[l.jsxs("summary",{children:[l.jsx("span",{className:"prompt-time",title:S.title,children:S.label}),l.jsx("span",{className:"prompt-injected-label",children:b.label})]}),b.detail&&l.jsx("div",{className:"prompt-injected-detail",children:b.detail})]},_):l.jsxs("div",{className:"prompt-entry",children:[l.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),l.jsx("div",{className:"prompt-text",children:N.text})]},_)})})]}),l.jsxs("section",{className:"detail-section",children:[l.jsxs("h3",{children:["Tool calls ",l.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&l.jsx("div",{className:"empty",children:"No tool calls yet."}),l.jsx("div",{children:e.tools.slice().reverse().map(N=>l.jsx(RG,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const AG={inflight:"in-flight",done:"done",err:"error"};function RG({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",r=bA(e,"…");return l.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[l.jsxs("span",{className:"name",children:[l.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:AG[n]}),e.name]}),l.jsx("span",{style:{color:"var(--muted)"},children:r})]})}try{a6(window.localStorage)}catch{}const MG=AI.createRoot(document.getElementById("root"));MG.render(l.jsx(kG,{}));export{nN as S,I9 as a,$G as b,dc as c,bn as d,IG as e,_t as f,go as g,Ls as h,ph as i,l as j,OU as k,l_ as p,x as r,_a as s,fn as u};