agent-dag 1.35.40 → 1.35.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/index-Cek9RbkJ.js +78 -0
- package/dist/web/assets/index-lLi5vZlE.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/src/server/index.mjs +6 -0
- package/src/server/system-metrics.mjs +230 -0
- package/dist/web/assets/index-B9aJiIdI.css +0 -1
- package/dist/web/assets/index-DRGdm9Mn.js +0 -77
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function r(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(o){if(o.ep)return;o.ep=!0;const l=r(o);fetch(o.href,l)}})();var Vl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Hv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rd={exports:{}},sa={},Ad={exports:{}},Le={};/**
|
|
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 Bw;function pR(){if(Bw)return Le;Bw=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),m=Symbol.iterator;function y(I){return I===null||typeof I!="object"?null:(I=m&&I[m]||I["@@iterator"],typeof I=="function"?I:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,_={};function b(I,G,K){this.props=I,this.context=G,this.refs=_,this.updater=K||w}b.prototype.isReactComponent={},b.prototype.setState=function(I,G){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,G,"setState")},b.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function S(){}S.prototype=b.prototype;function k(I,G,K){this.props=I,this.context=G,this.refs=_,this.updater=K||w}var N=k.prototype=new S;N.constructor=k,E(N,b.prototype),N.isPureReactComponent=!0;var j=Array.isArray,A=Object.prototype.hasOwnProperty,M={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function P(I,G,K){var q,Q={},ne=null,ae=null;if(G!=null)for(q in G.ref!==void 0&&(ae=G.ref),G.key!==void 0&&(ne=""+G.key),G)A.call(G,q)&&!O.hasOwnProperty(q)&&(Q[q]=G[q]);var fe=arguments.length-2;if(fe===1)Q.children=K;else if(1<fe){for(var te=Array(fe),ce=0;ce<fe;ce++)te[ce]=arguments[ce+2];Q.children=te}if(I&&I.defaultProps)for(q in fe=I.defaultProps,fe)Q[q]===void 0&&(Q[q]=fe[q]);return{$$typeof:e,type:I,key:ne,ref:ae,props:Q,_owner:M.current}}function D(I,G){return{$$typeof:e,type:I.type,key:G,ref:I.ref,props:I.props,_owner:I._owner}}function L(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function U(I){var G={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(K){return G[K]})}var V=/\/+/g;function z(I,G){return typeof I=="object"&&I!==null&&I.key!=null?U(""+I.key):G.toString(36)}function C(I,G,K,q,Q){var ne=typeof I;(ne==="undefined"||ne==="boolean")&&(I=null);var ae=!1;if(I===null)ae=!0;else switch(ne){case"string":case"number":ae=!0;break;case"object":switch(I.$$typeof){case e:case t:ae=!0}}if(ae)return ae=I,Q=Q(ae),I=q===""?"."+z(ae,0):q,j(Q)?(K="",I!=null&&(K=I.replace(V,"$&/")+"/"),C(Q,G,K,"",function(ce){return ce})):Q!=null&&(L(Q)&&(Q=D(Q,K+(!Q.key||ae&&ae.key===Q.key?"":(""+Q.key).replace(V,"$&/")+"/")+I)),G.push(Q)),1;if(ae=0,q=q===""?".":q+":",j(I))for(var fe=0;fe<I.length;fe++){ne=I[fe];var te=q+z(ne,fe);ae+=C(ne,G,K,te,Q)}else if(te=y(I),typeof te=="function")for(I=te.call(I),fe=0;!(ne=I.next()).done;)ne=ne.value,te=q+z(ne,fe++),ae+=C(ne,G,K,te,Q);else if(ne==="object")throw G=String(I),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return ae}function F(I,G,K){if(I==null)return I;var q=[],Q=0;return C(I,q,"","",function(ne){return G.call(K,ne,Q++)}),q}function $(I){if(I._status===-1){var G=I._result;G=G(),G.then(function(K){(I._status===0||I._status===-1)&&(I._status=1,I._result=K)},function(K){(I._status===0||I._status===-1)&&(I._status=2,I._result=K)}),I._status===-1&&(I._status=0,I._result=G)}if(I._status===1)return I._result.default;throw I._result}var re={current:null},J={transition:null},W={ReactCurrentDispatcher:re,ReactCurrentBatchConfig:J,ReactCurrentOwner:M};function Z(){throw Error("act(...) is not supported in production builds of React.")}return Le.Children={map:F,forEach:function(I,G,K){F(I,function(){G.apply(this,arguments)},K)},count:function(I){var G=0;return F(I,function(){G++}),G},toArray:function(I){return F(I,function(G){return G})||[]},only:function(I){if(!L(I))throw Error("React.Children.only expected to receive a single React element child.");return I}},Le.Component=b,Le.Fragment=r,Le.Profiler=o,Le.PureComponent=k,Le.StrictMode=i,Le.Suspense=f,Le.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,Le.act=Z,Le.cloneElement=function(I,G,K){if(I==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+I+".");var q=E({},I.props),Q=I.key,ne=I.ref,ae=I._owner;if(G!=null){if(G.ref!==void 0&&(ne=G.ref,ae=M.current),G.key!==void 0&&(Q=""+G.key),I.type&&I.type.defaultProps)var fe=I.type.defaultProps;for(te in G)A.call(G,te)&&!O.hasOwnProperty(te)&&(q[te]=G[te]===void 0&&fe!==void 0?fe[te]:G[te])}var te=arguments.length-2;if(te===1)q.children=K;else if(1<te){fe=Array(te);for(var ce=0;ce<te;ce++)fe[ce]=arguments[ce+2];q.children=fe}return{$$typeof:e,type:I.type,key:Q,ref:ne,props:q,_owner:ae}},Le.createContext=function(I){return I={$$typeof:u,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},I.Provider={$$typeof:l,_context:I},I.Consumer=I},Le.createElement=P,Le.createFactory=function(I){var G=P.bind(null,I);return G.type=I,G},Le.createRef=function(){return{current:null}},Le.forwardRef=function(I){return{$$typeof:c,render:I}},Le.isValidElement=L,Le.lazy=function(I){return{$$typeof:d,_payload:{_status:-1,_result:I},_init:$}},Le.memo=function(I,G){return{$$typeof:p,type:I,compare:G===void 0?null:G}},Le.startTransition=function(I){var G=J.transition;J.transition={};try{I()}finally{J.transition=G}},Le.unstable_act=Z,Le.useCallback=function(I,G){return re.current.useCallback(I,G)},Le.useContext=function(I){return re.current.useContext(I)},Le.useDebugValue=function(){},Le.useDeferredValue=function(I){return re.current.useDeferredValue(I)},Le.useEffect=function(I,G){return re.current.useEffect(I,G)},Le.useId=function(){return re.current.useId()},Le.useImperativeHandle=function(I,G,K){return re.current.useImperativeHandle(I,G,K)},Le.useInsertionEffect=function(I,G){return re.current.useInsertionEffect(I,G)},Le.useLayoutEffect=function(I,G){return re.current.useLayoutEffect(I,G)},Le.useMemo=function(I,G){return re.current.useMemo(I,G)},Le.useReducer=function(I,G,K){return re.current.useReducer(I,G,K)},Le.useRef=function(I){return re.current.useRef(I)},Le.useState=function(I){return re.current.useState(I)},Le.useSyncExternalStore=function(I,G,K){return re.current.useSyncExternalStore(I,G,K)},Le.useTransition=function(){return re.current.useTransition()},Le.version="18.3.1",Le}var Uw;function Ta(){return Uw||(Uw=1,Ad.exports=pR()),Ad.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 Hw;function mR(){if(Hw)return sa;Hw=1;var e=Ta(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(c,f,p){var d,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(d in f)i.call(f,d)&&!l.hasOwnProperty(d)&&(m[d]=f[d]);if(c&&c.defaultProps)for(d in f=c.defaultProps,f)m[d]===void 0&&(m[d]=f[d]);return{$$typeof:t,type:c,key:y,ref:w,props:m,_owner:o.current}}return sa.Fragment=r,sa.jsx=u,sa.jsxs=u,sa}var Ww;function gR(){return Ww||(Ww=1,Rd.exports=mR()),Rd.exports}var g=gR(),Gl={},Id={exports:{}},un={},Md={exports:{}},Od={};/**
|
|
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 Vw;function vR(){return Vw||(Vw=1,(function(e){function t(J,W){var Z=J.length;J.push(W);e:for(;0<Z;){var I=Z-1>>>1,G=J[I];if(0<o(G,W))J[I]=W,J[Z]=G,Z=I;else break e}}function r(J){return J.length===0?null:J[0]}function i(J){if(J.length===0)return null;var W=J[0],Z=J.pop();if(Z!==W){J[0]=Z;e:for(var I=0,G=J.length,K=G>>>1;I<K;){var q=2*(I+1)-1,Q=J[q],ne=q+1,ae=J[ne];if(0>o(Q,Z))ne<G&&0>o(ae,Q)?(J[I]=ae,J[ne]=Z,I=ne):(J[I]=Q,J[q]=Z,I=q);else if(ne<G&&0>o(ae,Z))J[I]=ae,J[ne]=Z,I=ne;else break e}}return W}function o(J,W){var Z=J.sortIndex-W.sortIndex;return Z!==0?Z:J.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();e.unstable_now=function(){return u.now()-c}}var f=[],p=[],d=1,m=null,y=3,w=!1,E=!1,_=!1,b=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(J){for(var W=r(p);W!==null;){if(W.callback===null)i(p);else if(W.startTime<=J)i(p),W.sortIndex=W.expirationTime,t(f,W);else break;W=r(p)}}function j(J){if(_=!1,N(J),!E)if(r(f)!==null)E=!0,$(A);else{var W=r(p);W!==null&&re(j,W.startTime-J)}}function A(J,W){E=!1,_&&(_=!1,S(P),P=-1),w=!0;var Z=y;try{for(N(W),m=r(f);m!==null&&(!(m.expirationTime>W)||J&&!U());){var I=m.callback;if(typeof I=="function"){m.callback=null,y=m.priorityLevel;var G=I(m.expirationTime<=W);W=e.unstable_now(),typeof G=="function"?m.callback=G:m===r(f)&&i(f),N(W)}else i(f);m=r(f)}if(m!==null)var K=!0;else{var q=r(p);q!==null&&re(j,q.startTime-W),K=!1}return K}finally{m=null,y=Z,w=!1}}var M=!1,O=null,P=-1,D=5,L=-1;function U(){return!(e.unstable_now()-L<D)}function V(){if(O!==null){var J=e.unstable_now();L=J;var W=!0;try{W=O(!0,J)}finally{W?z():(M=!1,O=null)}}else M=!1}var z;if(typeof k=="function")z=function(){k(V)};else if(typeof MessageChannel<"u"){var C=new MessageChannel,F=C.port2;C.port1.onmessage=V,z=function(){F.postMessage(null)}}else z=function(){b(V,0)};function $(J){O=J,M||(M=!0,z())}function re(J,W){P=b(function(){J(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(J){J.callback=null},e.unstable_continueExecution=function(){E||w||(E=!0,$(A))},e.unstable_forceFrameRate=function(J){0>J||125<J?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<J?Math.floor(1e3/J):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return r(f)},e.unstable_next=function(J){switch(y){case 1:case 2:case 3:var W=3;break;default:W=y}var Z=y;y=W;try{return J()}finally{y=Z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(J,W){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var Z=y;y=J;try{return W()}finally{y=Z}},e.unstable_scheduleCallback=function(J,W,Z){var I=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?I+Z:I):Z=I,J){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=Z+G,J={id:d++,callback:W,priorityLevel:J,startTime:Z,expirationTime:G,sortIndex:-1},Z>I?(J.sortIndex=Z,t(p,J),r(f)===null&&J===r(p)&&(_?(S(P),P=-1):_=!0,re(j,Z-I))):(J.sortIndex=G,t(f,J),E||w||(E=!0,$(A))),J},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(J){var W=y;return function(){var Z=y;y=W;try{return J.apply(this,arguments)}finally{y=Z}}}})(Od)),Od}var Gw;function yR(){return Gw||(Gw=1,Md.exports=vR()),Md.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 Yw;function wR(){if(Yw)return un;Yw=1;var e=Ta(),t=yR();function r(n){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+n,a=1;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+n+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,o={};function l(n,s){u(n,s),u(n+"Capture",s)}function u(n,s){for(o[n]=s,n=0;n<s.length;n++)i.add(s[n])}var c=!(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]*$/,d={},m={};function y(n){return f.call(m,n)?!0:f.call(d,n)?!1:p.test(n)?m[n]=!0:(d[n]=!0,!1)}function w(n,s,a,h){if(a!==null&&a.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return h?!1:a!==null?!a.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function E(n,s,a,h){if(s===null||typeof s>"u"||w(n,s,a,h))return!0;if(h)return!1;if(a!==null)switch(a.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function _(n,s,a,h,v,x,T){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=h,this.attributeNamespace=v,this.mustUseProperty=a,this.propertyName=n,this.type=s,this.sanitizeURL=x,this.removeEmptyString=T}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){b[n]=new _(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var s=n[0];b[s]=new _(s,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){b[n]=new _(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){b[n]=new _(n,2,!1,n,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(n){b[n]=new _(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){b[n]=new _(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){b[n]=new _(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){b[n]=new _(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){b[n]=new _(n,5,!1,n.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function k(n){return n[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(n){var s=n.replace(S,k);b[s]=new _(s,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var s=n.replace(S,k);b[s]=new _(s,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var s=n.replace(S,k);b[s]=new _(s,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){b[n]=new _(n,1,!1,n.toLowerCase(),null,!1,!1)}),b.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){b[n]=new _(n,1,!1,n.toLowerCase(),null,!0,!0)});function N(n,s,a,h){var v=b.hasOwnProperty(s)?b[s]:null;(v!==null?v.type!==0:h||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(E(s,a,v,h)&&(a=null),h||v===null?y(s)&&(a===null?n.removeAttribute(s):n.setAttribute(s,""+a)):v.mustUseProperty?n[v.propertyName]=a===null?v.type===3?!1:"":a:(s=v.attributeName,h=v.attributeNamespace,a===null?n.removeAttribute(s):(v=v.type,a=v===3||v===4&&a===!0?"":""+a,h?n.setAttributeNS(h,s,a):n.setAttribute(s,a))))}var j=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,A=Symbol.for("react.element"),M=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),L=Symbol.for("react.provider"),U=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),re=Symbol.for("react.offscreen"),J=Symbol.iterator;function W(n){return n===null||typeof n!="object"?null:(n=J&&n[J]||n["@@iterator"],typeof n=="function"?n:null)}var Z=Object.assign,I;function G(n){if(I===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);I=s&&s[1]||""}return`
|
|
34
|
+
`+I+n}var K=!1;function q(n,s){if(!n||K)return"";K=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(le){var h=le}Reflect.construct(n,[],s)}else{try{s.call()}catch(le){h=le}n.call(s.prototype)}else{try{throw Error()}catch(le){h=le}n()}}catch(le){if(le&&h&&typeof le.stack=="string"){for(var v=le.stack.split(`
|
|
35
|
+
`),x=h.stack.split(`
|
|
36
|
+
`),T=v.length-1,B=x.length-1;1<=T&&0<=B&&v[T]!==x[B];)B--;for(;1<=T&&0<=B;T--,B--)if(v[T]!==x[B]){if(T!==1||B!==1)do if(T--,B--,0>B||v[T]!==x[B]){var X=`
|
|
37
|
+
`+v[T].replace(" at new "," at ");return n.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",n.displayName)),X}while(1<=T&&0<=B);break}}}finally{K=!1,Error.prepareStackTrace=a}return(n=n?n.displayName||n.name:"")?G(n):""}function Q(n){switch(n.tag){case 5:return G(n.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return n=q(n.type,!1),n;case 11:return n=q(n.type.render,!1),n;case 1:return n=q(n.type,!0),n;default:return""}}function ne(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case O:return"Fragment";case M:return"Portal";case D:return"Profiler";case P:return"StrictMode";case z:return"Suspense";case C:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case U:return(n.displayName||"Context")+".Consumer";case L:return(n._context.displayName||"Context")+".Provider";case V:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case F:return s=n.displayName||null,s!==null?s:ne(n.type)||"Memo";case $:s=n._payload,n=n._init;try{return ne(n(s))}catch{}}return null}function ae(n){var s=n.type;switch(n.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=s.render,n=n.displayName||n.name||"",s.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ne(s);case 8:return s===P?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function fe(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function te(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ce(n){var s=te(n)?"checked":"value",a=Object.getOwnPropertyDescriptor(n.constructor.prototype,s),h=""+n[s];if(!n.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var v=a.get,x=a.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return v.call(this)},set:function(T){h=""+T,x.call(this,T)}}),Object.defineProperty(n,s,{enumerable:a.enumerable}),{getValue:function(){return h},setValue:function(T){h=""+T},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function Ce(n){n._valueTracker||(n._valueTracker=ce(n))}function ve(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var a=s.getValue(),h="";return n&&(h=te(n)?n.checked?"true":"false":n.value),n=h,n!==a?(s.setValue(n),!0):!1}function Re(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function ye(n,s){var a=s.checked;return Z({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??n._wrapperState.initialChecked})}function Ee(n,s){var a=s.defaultValue==null?"":s.defaultValue,h=s.checked!=null?s.checked:s.defaultChecked;a=fe(s.value!=null?s.value:a),n._wrapperState={initialChecked:h,initialValue:a,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Ye(n,s){s=s.checked,s!=null&&N(n,"checked",s,!1)}function we(n,s){Ye(n,s);var a=fe(s.value),h=s.type;if(a!=null)h==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+a):n.value!==""+a&&(n.value=""+a);else if(h==="submit"||h==="reset"){n.removeAttribute("value");return}s.hasOwnProperty("value")?Be(n,s.type,a):s.hasOwnProperty("defaultValue")&&Be(n,s.type,fe(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(n.defaultChecked=!!s.defaultChecked)}function _e(n,s,a){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var h=s.type;if(!(h!=="submit"&&h!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+n._wrapperState.initialValue,a||s===n.value||(n.value=s),n.defaultValue=s}a=n.name,a!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,a!==""&&(n.name=a)}function Be(n,s,a){(s!=="number"||Re(n.ownerDocument)!==n)&&(a==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+a&&(n.defaultValue=""+a))}var it=Array.isArray;function ft(n,s,a,h){if(n=n.options,s){s={};for(var v=0;v<a.length;v++)s["$"+a[v]]=!0;for(a=0;a<n.length;a++)v=s.hasOwnProperty("$"+n[a].value),n[a].selected!==v&&(n[a].selected=v),v&&h&&(n[a].defaultSelected=!0)}else{for(a=""+fe(a),s=null,v=0;v<n.length;v++){if(n[v].value===a){n[v].selected=!0,h&&(n[v].defaultSelected=!0);return}s!==null||n[v].disabled||(s=n[v])}s!==null&&(s.selected=!0)}}function Ze(n,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return Z({},s,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function De(n,s){var a=s.value;if(a==null){if(a=s.children,s=s.defaultValue,a!=null){if(s!=null)throw Error(r(92));if(it(a)){if(1<a.length)throw Error(r(93));a=a[0]}s=a}s==null&&(s=""),a=s}n._wrapperState={initialValue:fe(a)}}function Je(n,s){var a=fe(s.value),h=fe(s.defaultValue);a!=null&&(a=""+a,a!==n.value&&(n.value=a),s.defaultValue==null&&n.defaultValue!==a&&(n.defaultValue=a)),h!=null&&(n.defaultValue=""+h)}function Xe(n){var s=n.textContent;s===n._wrapperState.initialValue&&s!==""&&s!==null&&(n.value=s)}function Ot(n){switch(n){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 lt(n,s){return n==null||n==="http://www.w3.org/1999/xhtml"?Ot(s):n==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var Qe,Pt=(function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,a,h,v){MSApp.execUnsafeLocalFunction(function(){return n(s,a,h,v)})}:n})(function(n,s){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=s;else{for(Qe=Qe||document.createElement("div"),Qe.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Qe.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;s.firstChild;)n.appendChild(s.firstChild)}});function zt(n,s){if(s){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=s;return}}n.textContent=s}var et={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},bt=["Webkit","ms","Moz","O"];Object.keys(et).forEach(function(n){bt.forEach(function(s){s=s+n.charAt(0).toUpperCase()+n.substring(1),et[s]=et[n]})});function ht(n,s,a){return s==null||typeof s=="boolean"||s===""?"":a||typeof s!="number"||s===0||et.hasOwnProperty(n)&&et[n]?(""+s).trim():s+"px"}function vt(n,s){n=n.style;for(var a in s)if(s.hasOwnProperty(a)){var h=a.indexOf("--")===0,v=ht(a,s[a],h);a==="float"&&(a="cssFloat"),h?n.setProperty(a,v):n[a]=v}}var hn=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 Yt(n,s){if(s){if(hn[n]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,n));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function Lt(n,s){if(n.indexOf("-")===-1)return typeof s.is=="string";switch(n){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 bn=null;function gr(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Sn=null,Bt=null,Fn=null;function pn(n){if(n=Uo(n)){if(typeof Sn!="function")throw Error(r(280));var s=n.stateNode;s&&(s=al(s),Sn(n.stateNode,n.type,s))}}function vr(n){Bt?Fn?Fn.push(n):Fn=[n]:Bt=n}function Hr(){if(Bt){var n=Bt,s=Fn;if(Fn=Bt=null,pn(n),s)for(n=0;n<s.length;n++)pn(s[n])}}function xi(n,s){return n(s)}function Wr(){}var ut=!1;function _i(n,s,a){if(ut)return n(s,a);ut=!0;try{return xi(n,s,a)}finally{ut=!1,(Bt!==null||Fn!==null)&&(Wr(),Hr())}}function mn(n,s){var a=n.stateNode;if(a===null)return null;var h=al(a);if(h===null)return null;a=h[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(n=n.type,h=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!h;break e;default:n=!1}if(n)return null;if(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var Is=!1;if(c)try{var yr={};Object.defineProperty(yr,"passive",{get:function(){Is=!0}}),window.addEventListener("test",yr,yr),window.removeEventListener("test",yr,yr)}catch{Is=!1}function zn(n,s,a,h,v,x,T,B,X){var le=Array.prototype.slice.call(arguments,3);try{s.apply(a,le)}catch(pe){this.onError(pe)}}var kn=!1,Vr=null,Gr=!1,Yr=null,bi={onError:function(n){kn=!0,Vr=n}};function sr(n,s,a,h,v,x,T,B,X){kn=!1,Vr=null,zn.apply(bi,arguments)}function Ms(n,s,a,h,v,x,T,B,X){if(sr.apply(this,arguments),kn){if(kn){var le=Vr;kn=!1,Vr=null}else throw Error(r(198));Gr||(Gr=!0,Yr=le)}}function En(n){var s=n,a=n;if(n.alternate)for(;s.return;)s=s.return;else{n=s;do s=n,(s.flags&4098)!==0&&(a=s.return),n=s.return;while(n)}return s.tag===3?a:null}function wr(n){if(n.tag===13){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function Os(n){if(En(n)!==n)throw Error(r(188))}function Ps(n){var s=n.alternate;if(!s){if(s=En(n),s===null)throw Error(r(188));return s!==n?null:n}for(var a=n,h=s;;){var v=a.return;if(v===null)break;var x=v.alternate;if(x===null){if(h=v.return,h!==null){a=h;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===a)return Os(v),n;if(x===h)return Os(v),s;x=x.sibling}throw Error(r(188))}if(a.return!==h.return)a=v,h=x;else{for(var T=!1,B=v.child;B;){if(B===a){T=!0,a=v,h=x;break}if(B===h){T=!0,h=v,a=x;break}B=B.sibling}if(!T){for(B=x.child;B;){if(B===a){T=!0,a=x,h=v;break}if(B===h){T=!0,h=x,a=v;break}B=B.sibling}if(!T)throw Error(r(189))}}if(a.alternate!==h)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?n:s}function Tt(n){return n=Ps(n),n!==null?xr(n):null}function xr(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var s=xr(n);if(s!==null)return s;n=n.sibling}return null}var _r=t.unstable_scheduleCallback,Kt=t.unstable_cancelCallback,Kr=t.unstable_shouldYield,Si=t.unstable_requestPaint,nt=t.unstable_now,br=t.unstable_getCurrentPriorityLevel,Xr=t.unstable_ImmediatePriority,Ls=t.unstable_UserBlockingPriority,Qr=t.unstable_NormalPriority,Zr=t.unstable_LowPriority,$s=t.unstable_IdlePriority,ir=null,St=null;function qs(n){if(St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(ir,n,void 0,(n.current.flags&128)===128)}catch{}}var pt=Math.clz32?Math.clz32:za,Eo=Math.log,No=Math.LN2;function za(n){return n>>>=0,n===0?32:31-(Eo(n)/No|0)|0}var Sr=64,Jr=4194304;function gn(n){switch(n&-n){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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Ds(n,s){var a=n.pendingLanes;if(a===0)return 0;var h=0,v=n.suspendedLanes,x=n.pingedLanes,T=a&268435455;if(T!==0){var B=T&~v;B!==0?h=gn(B):(x&=T,x!==0&&(h=gn(x)))}else T=a&~v,T!==0?h=gn(T):x!==0&&(h=gn(x));if(h===0)return 0;if(s!==0&&s!==h&&(s&v)===0&&(v=h&-h,x=s&-s,v>=x||v===16&&(x&4194240)!==0))return s;if((h&4)!==0&&(h|=a&16),s=n.entangledLanes,s!==0)for(n=n.entanglements,s&=h;0<s;)a=31-pt(s),v=1<<a,h|=n[a],s&=~v;return h}function Ba(n,s){switch(n){case 1:case 2:case 4:return s+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 s+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 Ua(n,s){for(var a=n.suspendedLanes,h=n.pingedLanes,v=n.expirationTimes,x=n.pendingLanes;0<x;){var T=31-pt(x),B=1<<T,X=v[T];X===-1?((B&a)===0||(B&h)!==0)&&(v[T]=Ba(B,s)):X<=s&&(n.expiredLanes|=B),x&=~B}}function Co(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function ki(){var n=Sr;return Sr<<=1,(Sr&4194240)===0&&(Sr=64),n}function or(n){for(var s=[],a=0;31>a;a++)s.push(n);return s}function es(n,s,a){n.pendingLanes|=s,s!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,s=31-pt(s),n[s]=a}function ic(n,s){var a=n.pendingLanes&~s;n.pendingLanes=s,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=s,n.mutableReadLanes&=s,n.entangledLanes&=s,s=n.entanglements;var h=n.eventTimes;for(n=n.expirationTimes;0<a;){var v=31-pt(a),x=1<<v;s[v]=0,h[v]=-1,n[v]=-1,a&=~x}}function Ei(n,s){var a=n.entangledLanes|=s;for(n=n.entanglements;a;){var h=31-pt(a),v=1<<h;v&s|n[h]&s&&(n[h]|=s),a&=~v}}var He=0;function Ha(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var Xt,jo,Ni,kr,ts,Fs=!1,Nn=[],Bn=null,vn=null,Un=null,zs=new Map,Bs=new Map,Hn=[],oc="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 Wa(n,s){switch(n){case"focusin":case"focusout":Bn=null;break;case"dragenter":case"dragleave":vn=null;break;case"mouseover":case"mouseout":Un=null;break;case"pointerover":case"pointerout":zs.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bs.delete(s.pointerId)}}function Er(n,s,a,h,v,x){return n===null||n.nativeEvent!==x?(n={blockedOn:s,domEventName:a,eventSystemFlags:h,nativeEvent:x,targetContainers:[v]},s!==null&&(s=Uo(s),s!==null&&jo(s)),n):(n.eventSystemFlags|=h,s=n.targetContainers,v!==null&&s.indexOf(v)===-1&&s.push(v),n)}function ar(n,s,a,h,v){switch(s){case"focusin":return Bn=Er(Bn,n,s,a,h,v),!0;case"dragenter":return vn=Er(vn,n,s,a,h,v),!0;case"mouseover":return Un=Er(Un,n,s,a,h,v),!0;case"pointerover":var x=v.pointerId;return zs.set(x,Er(zs.get(x)||null,n,s,a,h,v)),!0;case"gotpointercapture":return x=v.pointerId,Bs.set(x,Er(Bs.get(x)||null,n,s,a,h,v)),!0}return!1}function Ci(n){var s=Xs(n.target);if(s!==null){var a=En(s);if(a!==null){if(s=a.tag,s===13){if(s=wr(a),s!==null){n.blockedOn=s,ts(n.priority,function(){Ni(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){n.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Us(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var a=ss(n.domEventName,n.eventSystemFlags,s[0],n.nativeEvent);if(a===null){a=n.nativeEvent;var h=new a.constructor(a.type,a);bn=h,a.target.dispatchEvent(h),bn=null}else return s=Uo(a),s!==null&&jo(s),n.blockedOn=a,!1;s.shift()}return!0}function Va(n,s,a){Us(n)&&a.delete(s)}function ac(){Fs=!1,Bn!==null&&Us(Bn)&&(Bn=null),vn!==null&&Us(vn)&&(vn=null),Un!==null&&Us(Un)&&(Un=null),zs.forEach(Va),Bs.forEach(Va)}function ns(n,s){n.blockedOn===s&&(n.blockedOn=null,Fs||(Fs=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,ac)))}function rs(n){function s(v){return ns(v,n)}if(0<Nn.length){ns(Nn[0],n);for(var a=1;a<Nn.length;a++){var h=Nn[a];h.blockedOn===n&&(h.blockedOn=null)}}for(Bn!==null&&ns(Bn,n),vn!==null&&ns(vn,n),Un!==null&&ns(Un,n),zs.forEach(s),Bs.forEach(s),a=0;a<Hn.length;a++)h=Hn[a],h.blockedOn===n&&(h.blockedOn=null);for(;0<Hn.length&&(a=Hn[0],a.blockedOn===null);)Ci(a),a.blockedOn===null&&Hn.shift()}var Qt=j.ReactCurrentBatchConfig,ji=!0;function Ga(n,s,a,h){var v=He,x=Qt.transition;Qt.transition=null;try{He=1,Nr(n,s,a,h)}finally{He=v,Qt.transition=x}}function lc(n,s,a,h){var v=He,x=Qt.transition;Qt.transition=null;try{He=4,Nr(n,s,a,h)}finally{He=v,Qt.transition=x}}function Nr(n,s,a,h){if(ji){var v=ss(n,s,a,h);if(v===null)xc(n,s,h,Cn,a),Wa(n,h);else if(ar(v,n,s,a,h))h.stopPropagation();else if(Wa(n,h),s&4&&-1<oc.indexOf(n)){for(;v!==null;){var x=Uo(v);if(x!==null&&Xt(x),x=ss(n,s,a,h),x===null&&xc(n,s,h,Cn,a),x===v)break;v=x}v!==null&&h.stopPropagation()}else xc(n,s,h,null,a)}}var Cn=null;function ss(n,s,a,h){if(Cn=null,n=gr(h),n=Xs(n),n!==null)if(s=En(n),s===null)n=null;else if(a=s.tag,a===13){if(n=wr(s),n!==null)return n;n=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null);return Cn=n,null}function is(n){switch(n){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(br()){case Xr:return 1;case Ls:return 4;case Qr:case Zr:return 16;case $s:return 536870912;default:return 16}default:return 16}}var lr=null,Rt=null,os=null;function To(){if(os)return os;var n,s=Rt,a=s.length,h,v="value"in lr?lr.value:lr.textContent,x=v.length;for(n=0;n<a&&s[n]===v[n];n++);var T=a-n;for(h=1;h<=T&&s[a-h]===v[x-h];h++);return os=v.slice(n,1<h?1-h:void 0)}function Hs(n){var s=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&s===13&&(n=13)):n=s,n===10&&(n=13),32<=n||n===13?n:0}function Ws(){return!0}function Vs(){return!1}function $t(n){function s(a,h,v,x,T){this._reactName=a,this._targetInst=v,this.type=h,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var B in n)n.hasOwnProperty(B)&&(a=n[B],this[B]=a?a(x):x[B]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ws:Vs,this.isPropagationStopped=Vs,this}return Z(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Ws)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ws)},persist:function(){},isPersistent:Ws}),s}var Cr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},as=$t(Cr),ls=Z({},Cr,{view:0,detail:0}),Ro=$t(ls),Ti,jr,Gs,tn=Z({},ls,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Se,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Gs&&(Gs&&n.type==="mousemove"?(Ti=n.screenX-Gs.screenX,jr=n.screenY-Gs.screenY):jr=Ti=0,Gs=n),Ti)},movementY:function(n){return"movementY"in n?n.movementY:jr}}),Ao=$t(tn),Ya=Z({},tn,{dataTransfer:0}),uc=$t(Ya),cc=Z({},ls,{relatedTarget:0}),Ri=$t(cc),nn=Z({},Cr,{animationName:0,elapsedTime:0,pseudoElement:0}),Ka=$t(nn),Xa=Z({},Cr,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Qa=$t(Xa),Za=Z({},Cr,{data:0}),H=$t(Za),Y={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},oe={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"},de={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xe(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=de[n])?!!s[n]:!1}function Se(){return xe}var Pe=Z({},ls,{key:function(n){if(n.key){var s=Y[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=Hs(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?oe[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Se,charCode:function(n){return n.type==="keypress"?Hs(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Hs(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Fe=$t(Pe),Ge=Z({},tn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),We=$t(Ge),ze=Z({},ls,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Se}),jn=$t(ze),Ys=Z({},Cr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Io=$t(Ys),Ks=Z({},tn,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Mo=$t(Ks),Ja=[9,13,27,32],us=c&&"CompositionEvent"in window,Zt=null;c&&"documentMode"in document&&(Zt=document.documentMode);var wt=c&&"TextEvent"in window&&!Zt,Oo=c&&(!us||Zt&&8<Zt&&11>=Zt),Py=" ",Ly=!1;function $y(n,s){switch(n){case"keyup":return Ja.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ai=!1;function dT(n,s){switch(n){case"compositionend":return qy(s);case"keypress":return s.which!==32?null:(Ly=!0,Py);case"textInput":return n=s.data,n===Py&&Ly?null:n;default:return null}}function fT(n,s){if(Ai)return n==="compositionend"||!us&&$y(n,s)?(n=To(),os=Rt=lr=null,Ai=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Oo&&s.locale!=="ko"?null:s.data;default:return null}}var hT={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 Dy(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!hT[n.type]:s==="textarea"}function Fy(n,s,a,h){vr(h),s=sl(s,"onChange"),0<s.length&&(a=new as("onChange","change",null,a,h),n.push({event:a,listeners:s}))}var Po=null,Lo=null;function pT(n){s0(n,0)}function el(n){var s=Li(n);if(ve(s))return n}function mT(n,s){if(n==="change")return s}var zy=!1;if(c){var dc;if(c){var fc="oninput"in document;if(!fc){var By=document.createElement("div");By.setAttribute("oninput","return;"),fc=typeof By.oninput=="function"}dc=fc}else dc=!1;zy=dc&&(!document.documentMode||9<document.documentMode)}function Uy(){Po&&(Po.detachEvent("onpropertychange",Hy),Lo=Po=null)}function Hy(n){if(n.propertyName==="value"&&el(Lo)){var s=[];Fy(s,Lo,n,gr(n)),_i(pT,s)}}function gT(n,s,a){n==="focusin"?(Uy(),Po=s,Lo=a,Po.attachEvent("onpropertychange",Hy)):n==="focusout"&&Uy()}function vT(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return el(Lo)}function yT(n,s){if(n==="click")return el(s)}function wT(n,s){if(n==="input"||n==="change")return el(s)}function xT(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var Wn=typeof Object.is=="function"?Object.is:xT;function $o(n,s){if(Wn(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var a=Object.keys(n),h=Object.keys(s);if(a.length!==h.length)return!1;for(h=0;h<a.length;h++){var v=a[h];if(!f.call(s,v)||!Wn(n[v],s[v]))return!1}return!0}function Wy(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Vy(n,s){var a=Wy(n);n=0;for(var h;a;){if(a.nodeType===3){if(h=n+a.textContent.length,n<=s&&h>=s)return{node:a,offset:s-n};n=h}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Wy(a)}}function Gy(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?Gy(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function Yy(){for(var n=window,s=Re();s instanceof n.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)n=s.contentWindow;else break;s=Re(n.document)}return s}function hc(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}function _T(n){var s=Yy(),a=n.focusedElem,h=n.selectionRange;if(s!==a&&a&&a.ownerDocument&&Gy(a.ownerDocument.documentElement,a)){if(h!==null&&hc(a)){if(s=h.start,n=h.end,n===void 0&&(n=s),"selectionStart"in a)a.selectionStart=s,a.selectionEnd=Math.min(n,a.value.length);else if(n=(s=a.ownerDocument||document)&&s.defaultView||window,n.getSelection){n=n.getSelection();var v=a.textContent.length,x=Math.min(h.start,v);h=h.end===void 0?x:Math.min(h.end,v),!n.extend&&x>h&&(v=h,h=x,x=v),v=Vy(a,x);var T=Vy(a,h);v&&T&&(n.rangeCount!==1||n.anchorNode!==v.node||n.anchorOffset!==v.offset||n.focusNode!==T.node||n.focusOffset!==T.offset)&&(s=s.createRange(),s.setStart(v.node,v.offset),n.removeAllRanges(),x>h?(n.addRange(s),n.extend(T.node,T.offset)):(s.setEnd(T.node,T.offset),n.addRange(s)))}}for(s=[],n=a;n=n.parentNode;)n.nodeType===1&&s.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<s.length;a++)n=s[a],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var bT=c&&"documentMode"in document&&11>=document.documentMode,Ii=null,pc=null,qo=null,mc=!1;function Ky(n,s,a){var h=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;mc||Ii==null||Ii!==Re(h)||(h=Ii,"selectionStart"in h&&hc(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),qo&&$o(qo,h)||(qo=h,h=sl(pc,"onSelect"),0<h.length&&(s=new as("onSelect","select",null,s,a),n.push({event:s,listeners:h}),s.target=Ii)))}function tl(n,s){var a={};return a[n.toLowerCase()]=s.toLowerCase(),a["Webkit"+n]="webkit"+s,a["Moz"+n]="moz"+s,a}var Mi={animationend:tl("Animation","AnimationEnd"),animationiteration:tl("Animation","AnimationIteration"),animationstart:tl("Animation","AnimationStart"),transitionend:tl("Transition","TransitionEnd")},gc={},Xy={};c&&(Xy=document.createElement("div").style,"AnimationEvent"in window||(delete Mi.animationend.animation,delete Mi.animationiteration.animation,delete Mi.animationstart.animation),"TransitionEvent"in window||delete Mi.transitionend.transition);function nl(n){if(gc[n])return gc[n];if(!Mi[n])return n;var s=Mi[n],a;for(a in s)if(s.hasOwnProperty(a)&&a in Xy)return gc[n]=s[a];return n}var Qy=nl("animationend"),Zy=nl("animationiteration"),Jy=nl("animationstart"),e0=nl("transitionend"),t0=new Map,n0="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 cs(n,s){t0.set(n,s),l(s,[n])}for(var vc=0;vc<n0.length;vc++){var yc=n0[vc],ST=yc.toLowerCase(),kT=yc[0].toUpperCase()+yc.slice(1);cs(ST,"on"+kT)}cs(Qy,"onAnimationEnd"),cs(Zy,"onAnimationIteration"),cs(Jy,"onAnimationStart"),cs("dblclick","onDoubleClick"),cs("focusin","onFocus"),cs("focusout","onBlur"),cs(e0,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Do="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(" "),ET=new Set("cancel close invalid load scroll toggle".split(" ").concat(Do));function r0(n,s,a){var h=n.type||"unknown-event";n.currentTarget=a,Ms(h,s,void 0,n),n.currentTarget=null}function s0(n,s){s=(s&4)!==0;for(var a=0;a<n.length;a++){var h=n[a],v=h.event;h=h.listeners;e:{var x=void 0;if(s)for(var T=h.length-1;0<=T;T--){var B=h[T],X=B.instance,le=B.currentTarget;if(B=B.listener,X!==x&&v.isPropagationStopped())break e;r0(v,B,le),x=X}else for(T=0;T<h.length;T++){if(B=h[T],X=B.instance,le=B.currentTarget,B=B.listener,X!==x&&v.isPropagationStopped())break e;r0(v,B,le),x=X}}}if(Gr)throw n=Yr,Gr=!1,Yr=null,n}function rt(n,s){var a=s[Nc];a===void 0&&(a=s[Nc]=new Set);var h=n+"__bubble";a.has(h)||(i0(s,n,2,!1),a.add(h))}function wc(n,s,a){var h=0;s&&(h|=4),i0(a,n,h,s)}var rl="_reactListening"+Math.random().toString(36).slice(2);function Fo(n){if(!n[rl]){n[rl]=!0,i.forEach(function(a){a!=="selectionchange"&&(ET.has(a)||wc(a,!1,n),wc(a,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[rl]||(s[rl]=!0,wc("selectionchange",!1,s))}}function i0(n,s,a,h){switch(is(s)){case 1:var v=Ga;break;case 4:v=lc;break;default:v=Nr}a=v.bind(null,s,a,n),v=void 0,!Is||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(v=!0),h?v!==void 0?n.addEventListener(s,a,{capture:!0,passive:v}):n.addEventListener(s,a,!0):v!==void 0?n.addEventListener(s,a,{passive:v}):n.addEventListener(s,a,!1)}function xc(n,s,a,h,v){var x=h;if((s&1)===0&&(s&2)===0&&h!==null)e:for(;;){if(h===null)return;var T=h.tag;if(T===3||T===4){var B=h.stateNode.containerInfo;if(B===v||B.nodeType===8&&B.parentNode===v)break;if(T===4)for(T=h.return;T!==null;){var X=T.tag;if((X===3||X===4)&&(X=T.stateNode.containerInfo,X===v||X.nodeType===8&&X.parentNode===v))return;T=T.return}for(;B!==null;){if(T=Xs(B),T===null)return;if(X=T.tag,X===5||X===6){h=x=T;continue e}B=B.parentNode}}h=h.return}_i(function(){var le=x,pe=gr(a),me=[];e:{var he=t0.get(n);if(he!==void 0){var be=as,Ne=n;switch(n){case"keypress":if(Hs(a)===0)break e;case"keydown":case"keyup":be=Fe;break;case"focusin":Ne="focus",be=Ri;break;case"focusout":Ne="blur",be=Ri;break;case"beforeblur":case"afterblur":be=Ri;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":be=Ao;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":be=uc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":be=jn;break;case Qy:case Zy:case Jy:be=Ka;break;case e0:be=Io;break;case"scroll":be=Ro;break;case"wheel":be=Mo;break;case"copy":case"cut":case"paste":be=Qa;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":be=We}var je=(s&4)!==0,yt=!je&&n==="scroll",se=je?he!==null?he+"Capture":null:he;je=[];for(var ee=le,ie;ee!==null;){ie=ee;var ge=ie.stateNode;if(ie.tag===5&&ge!==null&&(ie=ge,se!==null&&(ge=mn(ee,se),ge!=null&&je.push(zo(ee,ge,ie)))),yt)break;ee=ee.return}0<je.length&&(he=new be(he,Ne,null,a,pe),me.push({event:he,listeners:je}))}}if((s&7)===0){e:{if(he=n==="mouseover"||n==="pointerover",be=n==="mouseout"||n==="pointerout",he&&a!==bn&&(Ne=a.relatedTarget||a.fromElement)&&(Xs(Ne)||Ne[Tr]))break e;if((be||he)&&(he=pe.window===pe?pe:(he=pe.ownerDocument)?he.defaultView||he.parentWindow:window,be?(Ne=a.relatedTarget||a.toElement,be=le,Ne=Ne?Xs(Ne):null,Ne!==null&&(yt=En(Ne),Ne!==yt||Ne.tag!==5&&Ne.tag!==6)&&(Ne=null)):(be=null,Ne=le),be!==Ne)){if(je=Ao,ge="onMouseLeave",se="onMouseEnter",ee="mouse",(n==="pointerout"||n==="pointerover")&&(je=We,ge="onPointerLeave",se="onPointerEnter",ee="pointer"),yt=be==null?he:Li(be),ie=Ne==null?he:Li(Ne),he=new je(ge,ee+"leave",be,a,pe),he.target=yt,he.relatedTarget=ie,ge=null,Xs(pe)===le&&(je=new je(se,ee+"enter",Ne,a,pe),je.target=ie,je.relatedTarget=yt,ge=je),yt=ge,be&&Ne)t:{for(je=be,se=Ne,ee=0,ie=je;ie;ie=Oi(ie))ee++;for(ie=0,ge=se;ge;ge=Oi(ge))ie++;for(;0<ee-ie;)je=Oi(je),ee--;for(;0<ie-ee;)se=Oi(se),ie--;for(;ee--;){if(je===se||se!==null&&je===se.alternate)break t;je=Oi(je),se=Oi(se)}je=null}else je=null;be!==null&&o0(me,he,be,je,!1),Ne!==null&&yt!==null&&o0(me,yt,Ne,je,!0)}}e:{if(he=le?Li(le):window,be=he.nodeName&&he.nodeName.toLowerCase(),be==="select"||be==="input"&&he.type==="file")var Te=mT;else if(Dy(he))if(zy)Te=wT;else{Te=vT;var Ie=gT}else(be=he.nodeName)&&be.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(Te=yT);if(Te&&(Te=Te(n,le))){Fy(me,Te,a,pe);break e}Ie&&Ie(n,he,le),n==="focusout"&&(Ie=he._wrapperState)&&Ie.controlled&&he.type==="number"&&Be(he,"number",he.value)}switch(Ie=le?Li(le):window,n){case"focusin":(Dy(Ie)||Ie.contentEditable==="true")&&(Ii=Ie,pc=le,qo=null);break;case"focusout":qo=pc=Ii=null;break;case"mousedown":mc=!0;break;case"contextmenu":case"mouseup":case"dragend":mc=!1,Ky(me,a,pe);break;case"selectionchange":if(bT)break;case"keydown":case"keyup":Ky(me,a,pe)}var Me;if(us)e:{switch(n){case"compositionstart":var Oe="onCompositionStart";break e;case"compositionend":Oe="onCompositionEnd";break e;case"compositionupdate":Oe="onCompositionUpdate";break e}Oe=void 0}else Ai?$y(n,a)&&(Oe="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(Oe="onCompositionStart");Oe&&(Oo&&a.locale!=="ko"&&(Ai||Oe!=="onCompositionStart"?Oe==="onCompositionEnd"&&Ai&&(Me=To()):(lr=pe,Rt="value"in lr?lr.value:lr.textContent,Ai=!0)),Ie=sl(le,Oe),0<Ie.length&&(Oe=new H(Oe,n,null,a,pe),me.push({event:Oe,listeners:Ie}),Me?Oe.data=Me:(Me=qy(a),Me!==null&&(Oe.data=Me)))),(Me=wt?dT(n,a):fT(n,a))&&(le=sl(le,"onBeforeInput"),0<le.length&&(pe=new H("onBeforeInput","beforeinput",null,a,pe),me.push({event:pe,listeners:le}),pe.data=Me))}s0(me,s)})}function zo(n,s,a){return{instance:n,listener:s,currentTarget:a}}function sl(n,s){for(var a=s+"Capture",h=[];n!==null;){var v=n,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=mn(n,a),x!=null&&h.unshift(zo(n,x,v)),x=mn(n,s),x!=null&&h.push(zo(n,x,v))),n=n.return}return h}function Oi(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function o0(n,s,a,h,v){for(var x=s._reactName,T=[];a!==null&&a!==h;){var B=a,X=B.alternate,le=B.stateNode;if(X!==null&&X===h)break;B.tag===5&&le!==null&&(B=le,v?(X=mn(a,x),X!=null&&T.unshift(zo(a,X,B))):v||(X=mn(a,x),X!=null&&T.push(zo(a,X,B)))),a=a.return}T.length!==0&&n.push({event:s,listeners:T})}var NT=/\r\n?/g,CT=/\u0000|\uFFFD/g;function a0(n){return(typeof n=="string"?n:""+n).replace(NT,`
|
|
38
|
+
`).replace(CT,"")}function il(n,s,a){if(s=a0(s),a0(n)!==s&&a)throw Error(r(425))}function ol(){}var _c=null,bc=null;function Sc(n,s){return n==="textarea"||n==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var kc=typeof setTimeout=="function"?setTimeout:void 0,jT=typeof clearTimeout=="function"?clearTimeout:void 0,l0=typeof Promise=="function"?Promise:void 0,TT=typeof queueMicrotask=="function"?queueMicrotask:typeof l0<"u"?function(n){return l0.resolve(null).then(n).catch(RT)}:kc;function RT(n){setTimeout(function(){throw n})}function Ec(n,s){var a=s,h=0;do{var v=a.nextSibling;if(n.removeChild(a),v&&v.nodeType===8)if(a=v.data,a==="/$"){if(h===0){n.removeChild(v),rs(s);return}h--}else a!=="$"&&a!=="$?"&&a!=="$!"||h++;a=v}while(a);rs(s)}function ds(n){for(;n!=null;n=n.nextSibling){var s=n.nodeType;if(s===1||s===3)break;if(s===8){if(s=n.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return n}function u0(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var a=n.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return n;s--}else a==="/$"&&s++}n=n.previousSibling}return null}var Pi=Math.random().toString(36).slice(2),ur="__reactFiber$"+Pi,Bo="__reactProps$"+Pi,Tr="__reactContainer$"+Pi,Nc="__reactEvents$"+Pi,AT="__reactListeners$"+Pi,IT="__reactHandles$"+Pi;function Xs(n){var s=n[ur];if(s)return s;for(var a=n.parentNode;a;){if(s=a[Tr]||a[ur]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(n=u0(n);n!==null;){if(a=n[ur])return a;n=u0(n)}return s}n=a,a=n.parentNode}return null}function Uo(n){return n=n[ur]||n[Tr],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Li(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(r(33))}function al(n){return n[Bo]||null}var Cc=[],$i=-1;function fs(n){return{current:n}}function st(n){0>$i||(n.current=Cc[$i],Cc[$i]=null,$i--)}function tt(n,s){$i++,Cc[$i]=n.current,n.current=s}var hs={},Ut=fs(hs),rn=fs(!1),Qs=hs;function qi(n,s){var a=n.type.contextTypes;if(!a)return hs;var h=n.stateNode;if(h&&h.__reactInternalMemoizedUnmaskedChildContext===s)return h.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in a)v[x]=s[x];return h&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=s,n.__reactInternalMemoizedMaskedChildContext=v),v}function sn(n){return n=n.childContextTypes,n!=null}function ll(){st(rn),st(Ut)}function c0(n,s,a){if(Ut.current!==hs)throw Error(r(168));tt(Ut,s),tt(rn,a)}function d0(n,s,a){var h=n.stateNode;if(s=s.childContextTypes,typeof h.getChildContext!="function")return a;h=h.getChildContext();for(var v in h)if(!(v in s))throw Error(r(108,ae(n)||"Unknown",v));return Z({},a,h)}function ul(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||hs,Qs=Ut.current,tt(Ut,n),tt(rn,rn.current),!0}function f0(n,s,a){var h=n.stateNode;if(!h)throw Error(r(169));a?(n=d0(n,s,Qs),h.__reactInternalMemoizedMergedChildContext=n,st(rn),st(Ut),tt(Ut,n)):st(rn),tt(rn,a)}var Rr=null,cl=!1,jc=!1;function h0(n){Rr===null?Rr=[n]:Rr.push(n)}function MT(n){cl=!0,h0(n)}function ps(){if(!jc&&Rr!==null){jc=!0;var n=0,s=He;try{var a=Rr;for(He=1;n<a.length;n++){var h=a[n];do h=h(!0);while(h!==null)}Rr=null,cl=!1}catch(v){throw Rr!==null&&(Rr=Rr.slice(n+1)),_r(Xr,ps),v}finally{He=s,jc=!1}}return null}var Di=[],Fi=0,dl=null,fl=0,Tn=[],Rn=0,Zs=null,Ar=1,Ir="";function Js(n,s){Di[Fi++]=fl,Di[Fi++]=dl,dl=n,fl=s}function p0(n,s,a){Tn[Rn++]=Ar,Tn[Rn++]=Ir,Tn[Rn++]=Zs,Zs=n;var h=Ar;n=Ir;var v=32-pt(h)-1;h&=~(1<<v),a+=1;var x=32-pt(s)+v;if(30<x){var T=v-v%5;x=(h&(1<<T)-1).toString(32),h>>=T,v-=T,Ar=1<<32-pt(s)+v|a<<v|h,Ir=x+n}else Ar=1<<x|a<<v|h,Ir=n}function Tc(n){n.return!==null&&(Js(n,1),p0(n,1,0))}function Rc(n){for(;n===dl;)dl=Di[--Fi],Di[Fi]=null,fl=Di[--Fi],Di[Fi]=null;for(;n===Zs;)Zs=Tn[--Rn],Tn[Rn]=null,Ir=Tn[--Rn],Tn[Rn]=null,Ar=Tn[--Rn],Tn[Rn]=null}var yn=null,wn=null,ot=!1,Vn=null;function m0(n,s){var a=On(5,null,null,0);a.elementType="DELETED",a.stateNode=s,a.return=n,s=n.deletions,s===null?(n.deletions=[a],n.flags|=16):s.push(a)}function g0(n,s){switch(n.tag){case 5:var a=n.type;return s=s.nodeType!==1||a.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(n.stateNode=s,yn=n,wn=ds(s.firstChild),!0):!1;case 6:return s=n.pendingProps===""||s.nodeType!==3?null:s,s!==null?(n.stateNode=s,yn=n,wn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(a=Zs!==null?{id:Ar,overflow:Ir}:null,n.memoizedState={dehydrated:s,treeContext:a,retryLane:1073741824},a=On(18,null,null,0),a.stateNode=s,a.return=n,n.child=a,yn=n,wn=null,!0):!1;default:return!1}}function Ac(n){return(n.mode&1)!==0&&(n.flags&128)===0}function Ic(n){if(ot){var s=wn;if(s){var a=s;if(!g0(n,s)){if(Ac(n))throw Error(r(418));s=ds(a.nextSibling);var h=yn;s&&g0(n,s)?m0(h,a):(n.flags=n.flags&-4097|2,ot=!1,yn=n)}}else{if(Ac(n))throw Error(r(418));n.flags=n.flags&-4097|2,ot=!1,yn=n}}}function v0(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;yn=n}function hl(n){if(n!==yn)return!1;if(!ot)return v0(n),ot=!0,!1;var s;if((s=n.tag!==3)&&!(s=n.tag!==5)&&(s=n.type,s=s!=="head"&&s!=="body"&&!Sc(n.type,n.memoizedProps)),s&&(s=wn)){if(Ac(n))throw y0(),Error(r(418));for(;s;)m0(n,s),s=ds(s.nextSibling)}if(v0(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));e:{for(n=n.nextSibling,s=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"){if(s===0){wn=ds(n.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++}n=n.nextSibling}wn=null}}else wn=yn?ds(n.stateNode.nextSibling):null;return!0}function y0(){for(var n=wn;n;)n=ds(n.nextSibling)}function zi(){wn=yn=null,ot=!1}function Mc(n){Vn===null?Vn=[n]:Vn.push(n)}var OT=j.ReactCurrentBatchConfig;function Ho(n,s,a){if(n=a.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(r(309));var h=a.stateNode}if(!h)throw Error(r(147,n));var v=h,x=""+n;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===x?s.ref:(s=function(T){var B=v.refs;T===null?delete B[x]:B[x]=T},s._stringRef=x,s)}if(typeof n!="string")throw Error(r(284));if(!a._owner)throw Error(r(290,n))}return n}function pl(n,s){throw n=Object.prototype.toString.call(s),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n))}function w0(n){var s=n._init;return s(n._payload)}function x0(n){function s(se,ee){if(n){var ie=se.deletions;ie===null?(se.deletions=[ee],se.flags|=16):ie.push(ee)}}function a(se,ee){if(!n)return null;for(;ee!==null;)s(se,ee),ee=ee.sibling;return null}function h(se,ee){for(se=new Map;ee!==null;)ee.key!==null?se.set(ee.key,ee):se.set(ee.index,ee),ee=ee.sibling;return se}function v(se,ee){return se=bs(se,ee),se.index=0,se.sibling=null,se}function x(se,ee,ie){return se.index=ie,n?(ie=se.alternate,ie!==null?(ie=ie.index,ie<ee?(se.flags|=2,ee):ie):(se.flags|=2,ee)):(se.flags|=1048576,ee)}function T(se){return n&&se.alternate===null&&(se.flags|=2),se}function B(se,ee,ie,ge){return ee===null||ee.tag!==6?(ee=kd(ie,se.mode,ge),ee.return=se,ee):(ee=v(ee,ie),ee.return=se,ee)}function X(se,ee,ie,ge){var Te=ie.type;return Te===O?pe(se,ee,ie.props.children,ge,ie.key):ee!==null&&(ee.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===$&&w0(Te)===ee.type)?(ge=v(ee,ie.props),ge.ref=Ho(se,ee,ie),ge.return=se,ge):(ge=ql(ie.type,ie.key,ie.props,null,se.mode,ge),ge.ref=Ho(se,ee,ie),ge.return=se,ge)}function le(se,ee,ie,ge){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ie.containerInfo||ee.stateNode.implementation!==ie.implementation?(ee=Ed(ie,se.mode,ge),ee.return=se,ee):(ee=v(ee,ie.children||[]),ee.return=se,ee)}function pe(se,ee,ie,ge,Te){return ee===null||ee.tag!==7?(ee=ai(ie,se.mode,ge,Te),ee.return=se,ee):(ee=v(ee,ie),ee.return=se,ee)}function me(se,ee,ie){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=kd(""+ee,se.mode,ie),ee.return=se,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case A:return ie=ql(ee.type,ee.key,ee.props,null,se.mode,ie),ie.ref=Ho(se,null,ee),ie.return=se,ie;case M:return ee=Ed(ee,se.mode,ie),ee.return=se,ee;case $:var ge=ee._init;return me(se,ge(ee._payload),ie)}if(it(ee)||W(ee))return ee=ai(ee,se.mode,ie,null),ee.return=se,ee;pl(se,ee)}return null}function he(se,ee,ie,ge){var Te=ee!==null?ee.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return Te!==null?null:B(se,ee,""+ie,ge);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case A:return ie.key===Te?X(se,ee,ie,ge):null;case M:return ie.key===Te?le(se,ee,ie,ge):null;case $:return Te=ie._init,he(se,ee,Te(ie._payload),ge)}if(it(ie)||W(ie))return Te!==null?null:pe(se,ee,ie,ge,null);pl(se,ie)}return null}function be(se,ee,ie,ge,Te){if(typeof ge=="string"&&ge!==""||typeof ge=="number")return se=se.get(ie)||null,B(ee,se,""+ge,Te);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case A:return se=se.get(ge.key===null?ie:ge.key)||null,X(ee,se,ge,Te);case M:return se=se.get(ge.key===null?ie:ge.key)||null,le(ee,se,ge,Te);case $:var Ie=ge._init;return be(se,ee,ie,Ie(ge._payload),Te)}if(it(ge)||W(ge))return se=se.get(ie)||null,pe(ee,se,ge,Te,null);pl(ee,ge)}return null}function Ne(se,ee,ie,ge){for(var Te=null,Ie=null,Me=ee,Oe=ee=0,Mt=null;Me!==null&&Oe<ie.length;Oe++){Me.index>Oe?(Mt=Me,Me=null):Mt=Me.sibling;var Ve=he(se,Me,ie[Oe],ge);if(Ve===null){Me===null&&(Me=Mt);break}n&&Me&&Ve.alternate===null&&s(se,Me),ee=x(Ve,ee,Oe),Ie===null?Te=Ve:Ie.sibling=Ve,Ie=Ve,Me=Mt}if(Oe===ie.length)return a(se,Me),ot&&Js(se,Oe),Te;if(Me===null){for(;Oe<ie.length;Oe++)Me=me(se,ie[Oe],ge),Me!==null&&(ee=x(Me,ee,Oe),Ie===null?Te=Me:Ie.sibling=Me,Ie=Me);return ot&&Js(se,Oe),Te}for(Me=h(se,Me);Oe<ie.length;Oe++)Mt=be(Me,se,Oe,ie[Oe],ge),Mt!==null&&(n&&Mt.alternate!==null&&Me.delete(Mt.key===null?Oe:Mt.key),ee=x(Mt,ee,Oe),Ie===null?Te=Mt:Ie.sibling=Mt,Ie=Mt);return n&&Me.forEach(function(Ss){return s(se,Ss)}),ot&&Js(se,Oe),Te}function je(se,ee,ie,ge){var Te=W(ie);if(typeof Te!="function")throw Error(r(150));if(ie=Te.call(ie),ie==null)throw Error(r(151));for(var Ie=Te=null,Me=ee,Oe=ee=0,Mt=null,Ve=ie.next();Me!==null&&!Ve.done;Oe++,Ve=ie.next()){Me.index>Oe?(Mt=Me,Me=null):Mt=Me.sibling;var Ss=he(se,Me,Ve.value,ge);if(Ss===null){Me===null&&(Me=Mt);break}n&&Me&&Ss.alternate===null&&s(se,Me),ee=x(Ss,ee,Oe),Ie===null?Te=Ss:Ie.sibling=Ss,Ie=Ss,Me=Mt}if(Ve.done)return a(se,Me),ot&&Js(se,Oe),Te;if(Me===null){for(;!Ve.done;Oe++,Ve=ie.next())Ve=me(se,Ve.value,ge),Ve!==null&&(ee=x(Ve,ee,Oe),Ie===null?Te=Ve:Ie.sibling=Ve,Ie=Ve);return ot&&Js(se,Oe),Te}for(Me=h(se,Me);!Ve.done;Oe++,Ve=ie.next())Ve=be(Me,se,Oe,Ve.value,ge),Ve!==null&&(n&&Ve.alternate!==null&&Me.delete(Ve.key===null?Oe:Ve.key),ee=x(Ve,ee,Oe),Ie===null?Te=Ve:Ie.sibling=Ve,Ie=Ve);return n&&Me.forEach(function(hR){return s(se,hR)}),ot&&Js(se,Oe),Te}function yt(se,ee,ie,ge){if(typeof ie=="object"&&ie!==null&&ie.type===O&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case A:e:{for(var Te=ie.key,Ie=ee;Ie!==null;){if(Ie.key===Te){if(Te=ie.type,Te===O){if(Ie.tag===7){a(se,Ie.sibling),ee=v(Ie,ie.props.children),ee.return=se,se=ee;break e}}else if(Ie.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===$&&w0(Te)===Ie.type){a(se,Ie.sibling),ee=v(Ie,ie.props),ee.ref=Ho(se,Ie,ie),ee.return=se,se=ee;break e}a(se,Ie);break}else s(se,Ie);Ie=Ie.sibling}ie.type===O?(ee=ai(ie.props.children,se.mode,ge,ie.key),ee.return=se,se=ee):(ge=ql(ie.type,ie.key,ie.props,null,se.mode,ge),ge.ref=Ho(se,ee,ie),ge.return=se,se=ge)}return T(se);case M:e:{for(Ie=ie.key;ee!==null;){if(ee.key===Ie)if(ee.tag===4&&ee.stateNode.containerInfo===ie.containerInfo&&ee.stateNode.implementation===ie.implementation){a(se,ee.sibling),ee=v(ee,ie.children||[]),ee.return=se,se=ee;break e}else{a(se,ee);break}else s(se,ee);ee=ee.sibling}ee=Ed(ie,se.mode,ge),ee.return=se,se=ee}return T(se);case $:return Ie=ie._init,yt(se,ee,Ie(ie._payload),ge)}if(it(ie))return Ne(se,ee,ie,ge);if(W(ie))return je(se,ee,ie,ge);pl(se,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,ee!==null&&ee.tag===6?(a(se,ee.sibling),ee=v(ee,ie),ee.return=se,se=ee):(a(se,ee),ee=kd(ie,se.mode,ge),ee.return=se,se=ee),T(se)):a(se,ee)}return yt}var Bi=x0(!0),_0=x0(!1),ml=fs(null),gl=null,Ui=null,Oc=null;function Pc(){Oc=Ui=gl=null}function Lc(n){var s=ml.current;st(ml),n._currentValue=s}function $c(n,s,a){for(;n!==null;){var h=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,h!==null&&(h.childLanes|=s)):h!==null&&(h.childLanes&s)!==s&&(h.childLanes|=s),n===a)break;n=n.return}}function Hi(n,s){gl=n,Oc=Ui=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&s)!==0&&(on=!0),n.firstContext=null)}function An(n){var s=n._currentValue;if(Oc!==n)if(n={context:n,memoizedValue:s,next:null},Ui===null){if(gl===null)throw Error(r(308));Ui=n,gl.dependencies={lanes:0,firstContext:n}}else Ui=Ui.next=n;return s}var ei=null;function qc(n){ei===null?ei=[n]:ei.push(n)}function b0(n,s,a,h){var v=s.interleaved;return v===null?(a.next=a,qc(s)):(a.next=v.next,v.next=a),s.interleaved=a,Mr(n,h)}function Mr(n,s){n.lanes|=s;var a=n.alternate;for(a!==null&&(a.lanes|=s),a=n,n=n.return;n!==null;)n.childLanes|=s,a=n.alternate,a!==null&&(a.childLanes|=s),a=n,n=n.return;return a.tag===3?a.stateNode:null}var ms=!1;function Dc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function S0(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Or(n,s){return{eventTime:n,lane:s,tag:0,payload:null,callback:null,next:null}}function gs(n,s,a){var h=n.updateQueue;if(h===null)return null;if(h=h.shared,(Ue&2)!==0){var v=h.pending;return v===null?s.next=s:(s.next=v.next,v.next=s),h.pending=s,Mr(n,a)}return v=h.interleaved,v===null?(s.next=s,qc(h)):(s.next=v.next,v.next=s),h.interleaved=s,Mr(n,a)}function vl(n,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194240)!==0)){var h=s.lanes;h&=n.pendingLanes,a|=h,s.lanes=a,Ei(n,a)}}function k0(n,s){var a=n.updateQueue,h=n.alternate;if(h!==null&&(h=h.updateQueue,a===h)){var v=null,x=null;if(a=a.firstBaseUpdate,a!==null){do{var T={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};x===null?v=x=T:x=x.next=T,a=a.next}while(a!==null);x===null?v=x=s:x=x.next=s}else v=x=s;a={baseState:h.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:h.shared,effects:h.effects},n.updateQueue=a;return}n=a.lastBaseUpdate,n===null?a.firstBaseUpdate=s:n.next=s,a.lastBaseUpdate=s}function yl(n,s,a,h){var v=n.updateQueue;ms=!1;var x=v.firstBaseUpdate,T=v.lastBaseUpdate,B=v.shared.pending;if(B!==null){v.shared.pending=null;var X=B,le=X.next;X.next=null,T===null?x=le:T.next=le,T=X;var pe=n.alternate;pe!==null&&(pe=pe.updateQueue,B=pe.lastBaseUpdate,B!==T&&(B===null?pe.firstBaseUpdate=le:B.next=le,pe.lastBaseUpdate=X))}if(x!==null){var me=v.baseState;T=0,pe=le=X=null,B=x;do{var he=B.lane,be=B.eventTime;if((h&he)===he){pe!==null&&(pe=pe.next={eventTime:be,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var Ne=n,je=B;switch(he=s,be=a,je.tag){case 1:if(Ne=je.payload,typeof Ne=="function"){me=Ne.call(be,me,he);break e}me=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=je.payload,he=typeof Ne=="function"?Ne.call(be,me,he):Ne,he==null)break e;me=Z({},me,he);break e;case 2:ms=!0}}B.callback!==null&&B.lane!==0&&(n.flags|=64,he=v.effects,he===null?v.effects=[B]:he.push(B))}else be={eventTime:be,lane:he,tag:B.tag,payload:B.payload,callback:B.callback,next:null},pe===null?(le=pe=be,X=me):pe=pe.next=be,T|=he;if(B=B.next,B===null){if(B=v.shared.pending,B===null)break;he=B,B=he.next,he.next=null,v.lastBaseUpdate=he,v.shared.pending=null}}while(!0);if(pe===null&&(X=me),v.baseState=X,v.firstBaseUpdate=le,v.lastBaseUpdate=pe,s=v.shared.interleaved,s!==null){v=s;do T|=v.lane,v=v.next;while(v!==s)}else x===null&&(v.shared.lanes=0);ri|=T,n.lanes=T,n.memoizedState=me}}function E0(n,s,a){if(n=s.effects,s.effects=null,n!==null)for(s=0;s<n.length;s++){var h=n[s],v=h.callback;if(v!==null){if(h.callback=null,h=a,typeof v!="function")throw Error(r(191,v));v.call(h)}}}var Wo={},cr=fs(Wo),Vo=fs(Wo),Go=fs(Wo);function ti(n){if(n===Wo)throw Error(r(174));return n}function Fc(n,s){switch(tt(Go,s),tt(Vo,n),tt(cr,Wo),n=s.nodeType,n){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:lt(null,"");break;default:n=n===8?s.parentNode:s,s=n.namespaceURI||null,n=n.tagName,s=lt(s,n)}st(cr),tt(cr,s)}function Wi(){st(cr),st(Vo),st(Go)}function N0(n){ti(Go.current);var s=ti(cr.current),a=lt(s,n.type);s!==a&&(tt(Vo,n),tt(cr,a))}function zc(n){Vo.current===n&&(st(cr),st(Vo))}var ct=fs(0);function wl(n){for(var s=n;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Bc=[];function Uc(){for(var n=0;n<Bc.length;n++)Bc[n]._workInProgressVersionPrimary=null;Bc.length=0}var xl=j.ReactCurrentDispatcher,Hc=j.ReactCurrentBatchConfig,ni=0,dt=null,kt=null,At=null,_l=!1,Yo=!1,Ko=0,PT=0;function Ht(){throw Error(r(321))}function Wc(n,s){if(s===null)return!1;for(var a=0;a<s.length&&a<n.length;a++)if(!Wn(n[a],s[a]))return!1;return!0}function Vc(n,s,a,h,v,x){if(ni=x,dt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,xl.current=n===null||n.memoizedState===null?DT:FT,n=a(h,v),Yo){x=0;do{if(Yo=!1,Ko=0,25<=x)throw Error(r(301));x+=1,At=kt=null,s.updateQueue=null,xl.current=zT,n=a(h,v)}while(Yo)}if(xl.current=kl,s=kt!==null&&kt.next!==null,ni=0,At=kt=dt=null,_l=!1,s)throw Error(r(300));return n}function Gc(){var n=Ko!==0;return Ko=0,n}function dr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return At===null?dt.memoizedState=At=n:At=At.next=n,At}function In(){if(kt===null){var n=dt.alternate;n=n!==null?n.memoizedState:null}else n=kt.next;var s=At===null?dt.memoizedState:At.next;if(s!==null)At=s,kt=n;else{if(n===null)throw Error(r(310));kt=n,n={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},At===null?dt.memoizedState=At=n:At=At.next=n}return At}function Xo(n,s){return typeof s=="function"?s(n):s}function Yc(n){var s=In(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=n;var h=kt,v=h.baseQueue,x=a.pending;if(x!==null){if(v!==null){var T=v.next;v.next=x.next,x.next=T}h.baseQueue=v=x,a.pending=null}if(v!==null){x=v.next,h=h.baseState;var B=T=null,X=null,le=x;do{var pe=le.lane;if((ni&pe)===pe)X!==null&&(X=X.next={lane:0,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),h=le.hasEagerState?le.eagerState:n(h,le.action);else{var me={lane:pe,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null};X===null?(B=X=me,T=h):X=X.next=me,dt.lanes|=pe,ri|=pe}le=le.next}while(le!==null&&le!==x);X===null?T=h:X.next=B,Wn(h,s.memoizedState)||(on=!0),s.memoizedState=h,s.baseState=T,s.baseQueue=X,a.lastRenderedState=h}if(n=a.interleaved,n!==null){v=n;do x=v.lane,dt.lanes|=x,ri|=x,v=v.next;while(v!==n)}else v===null&&(a.lanes=0);return[s.memoizedState,a.dispatch]}function Kc(n){var s=In(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=n;var h=a.dispatch,v=a.pending,x=s.memoizedState;if(v!==null){a.pending=null;var T=v=v.next;do x=n(x,T.action),T=T.next;while(T!==v);Wn(x,s.memoizedState)||(on=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),a.lastRenderedState=x}return[x,h]}function C0(){}function j0(n,s){var a=dt,h=In(),v=s(),x=!Wn(h.memoizedState,v);if(x&&(h.memoizedState=v,on=!0),h=h.queue,Xc(A0.bind(null,a,h,n),[n]),h.getSnapshot!==s||x||At!==null&&At.memoizedState.tag&1){if(a.flags|=2048,Qo(9,R0.bind(null,a,h,v,s),void 0,null),It===null)throw Error(r(349));(ni&30)!==0||T0(a,s,v)}return v}function T0(n,s,a){n.flags|=16384,n={getSnapshot:s,value:a},s=dt.updateQueue,s===null?(s={lastEffect:null,stores:null},dt.updateQueue=s,s.stores=[n]):(a=s.stores,a===null?s.stores=[n]:a.push(n))}function R0(n,s,a,h){s.value=a,s.getSnapshot=h,I0(s)&&M0(n)}function A0(n,s,a){return a(function(){I0(s)&&M0(n)})}function I0(n){var s=n.getSnapshot;n=n.value;try{var a=s();return!Wn(n,a)}catch{return!0}}function M0(n){var s=Mr(n,1);s!==null&&Xn(s,n,1,-1)}function O0(n){var s=dr();return typeof n=="function"&&(n=n()),s.memoizedState=s.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:n},s.queue=n,n=n.dispatch=qT.bind(null,dt,n),[s.memoizedState,n]}function Qo(n,s,a,h){return n={tag:n,create:s,destroy:a,deps:h,next:null},s=dt.updateQueue,s===null?(s={lastEffect:null,stores:null},dt.updateQueue=s,s.lastEffect=n.next=n):(a=s.lastEffect,a===null?s.lastEffect=n.next=n:(h=a.next,a.next=n,n.next=h,s.lastEffect=n)),n}function P0(){return In().memoizedState}function bl(n,s,a,h){var v=dr();dt.flags|=n,v.memoizedState=Qo(1|s,a,void 0,h===void 0?null:h)}function Sl(n,s,a,h){var v=In();h=h===void 0?null:h;var x=void 0;if(kt!==null){var T=kt.memoizedState;if(x=T.destroy,h!==null&&Wc(h,T.deps)){v.memoizedState=Qo(s,a,x,h);return}}dt.flags|=n,v.memoizedState=Qo(1|s,a,x,h)}function L0(n,s){return bl(8390656,8,n,s)}function Xc(n,s){return Sl(2048,8,n,s)}function $0(n,s){return Sl(4,2,n,s)}function q0(n,s){return Sl(4,4,n,s)}function D0(n,s){if(typeof s=="function")return n=n(),s(n),function(){s(null)};if(s!=null)return n=n(),s.current=n,function(){s.current=null}}function F0(n,s,a){return a=a!=null?a.concat([n]):null,Sl(4,4,D0.bind(null,s,n),a)}function Qc(){}function z0(n,s){var a=In();s=s===void 0?null:s;var h=a.memoizedState;return h!==null&&s!==null&&Wc(s,h[1])?h[0]:(a.memoizedState=[n,s],n)}function B0(n,s){var a=In();s=s===void 0?null:s;var h=a.memoizedState;return h!==null&&s!==null&&Wc(s,h[1])?h[0]:(n=n(),a.memoizedState=[n,s],n)}function U0(n,s,a){return(ni&21)===0?(n.baseState&&(n.baseState=!1,on=!0),n.memoizedState=a):(Wn(a,s)||(a=ki(),dt.lanes|=a,ri|=a,n.baseState=!0),s)}function LT(n,s){var a=He;He=a!==0&&4>a?a:4,n(!0);var h=Hc.transition;Hc.transition={};try{n(!1),s()}finally{He=a,Hc.transition=h}}function H0(){return In().memoizedState}function $T(n,s,a){var h=xs(n);if(a={lane:h,action:a,hasEagerState:!1,eagerState:null,next:null},W0(n))V0(s,a);else if(a=b0(n,s,a,h),a!==null){var v=en();Xn(a,n,h,v),G0(a,s,h)}}function qT(n,s,a){var h=xs(n),v={lane:h,action:a,hasEagerState:!1,eagerState:null,next:null};if(W0(n))V0(s,v);else{var x=n.alternate;if(n.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var T=s.lastRenderedState,B=x(T,a);if(v.hasEagerState=!0,v.eagerState=B,Wn(B,T)){var X=s.interleaved;X===null?(v.next=v,qc(s)):(v.next=X.next,X.next=v),s.interleaved=v;return}}catch{}finally{}a=b0(n,s,v,h),a!==null&&(v=en(),Xn(a,n,h,v),G0(a,s,h))}}function W0(n){var s=n.alternate;return n===dt||s!==null&&s===dt}function V0(n,s){Yo=_l=!0;var a=n.pending;a===null?s.next=s:(s.next=a.next,a.next=s),n.pending=s}function G0(n,s,a){if((a&4194240)!==0){var h=s.lanes;h&=n.pendingLanes,a|=h,s.lanes=a,Ei(n,a)}}var kl={readContext:An,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useInsertionEffect:Ht,useLayoutEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useMutableSource:Ht,useSyncExternalStore:Ht,useId:Ht,unstable_isNewReconciler:!1},DT={readContext:An,useCallback:function(n,s){return dr().memoizedState=[n,s===void 0?null:s],n},useContext:An,useEffect:L0,useImperativeHandle:function(n,s,a){return a=a!=null?a.concat([n]):null,bl(4194308,4,D0.bind(null,s,n),a)},useLayoutEffect:function(n,s){return bl(4194308,4,n,s)},useInsertionEffect:function(n,s){return bl(4,2,n,s)},useMemo:function(n,s){var a=dr();return s=s===void 0?null:s,n=n(),a.memoizedState=[n,s],n},useReducer:function(n,s,a){var h=dr();return s=a!==void 0?a(s):s,h.memoizedState=h.baseState=s,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:s},h.queue=n,n=n.dispatch=$T.bind(null,dt,n),[h.memoizedState,n]},useRef:function(n){var s=dr();return n={current:n},s.memoizedState=n},useState:O0,useDebugValue:Qc,useDeferredValue:function(n){return dr().memoizedState=n},useTransition:function(){var n=O0(!1),s=n[0];return n=LT.bind(null,n[1]),dr().memoizedState=n,[s,n]},useMutableSource:function(){},useSyncExternalStore:function(n,s,a){var h=dt,v=dr();if(ot){if(a===void 0)throw Error(r(407));a=a()}else{if(a=s(),It===null)throw Error(r(349));(ni&30)!==0||T0(h,s,a)}v.memoizedState=a;var x={value:a,getSnapshot:s};return v.queue=x,L0(A0.bind(null,h,x,n),[n]),h.flags|=2048,Qo(9,R0.bind(null,h,x,a,s),void 0,null),a},useId:function(){var n=dr(),s=It.identifierPrefix;if(ot){var a=Ir,h=Ar;a=(h&~(1<<32-pt(h)-1)).toString(32)+a,s=":"+s+"R"+a,a=Ko++,0<a&&(s+="H"+a.toString(32)),s+=":"}else a=PT++,s=":"+s+"r"+a.toString(32)+":";return n.memoizedState=s},unstable_isNewReconciler:!1},FT={readContext:An,useCallback:z0,useContext:An,useEffect:Xc,useImperativeHandle:F0,useInsertionEffect:$0,useLayoutEffect:q0,useMemo:B0,useReducer:Yc,useRef:P0,useState:function(){return Yc(Xo)},useDebugValue:Qc,useDeferredValue:function(n){var s=In();return U0(s,kt.memoizedState,n)},useTransition:function(){var n=Yc(Xo)[0],s=In().memoizedState;return[n,s]},useMutableSource:C0,useSyncExternalStore:j0,useId:H0,unstable_isNewReconciler:!1},zT={readContext:An,useCallback:z0,useContext:An,useEffect:Xc,useImperativeHandle:F0,useInsertionEffect:$0,useLayoutEffect:q0,useMemo:B0,useReducer:Kc,useRef:P0,useState:function(){return Kc(Xo)},useDebugValue:Qc,useDeferredValue:function(n){var s=In();return kt===null?s.memoizedState=n:U0(s,kt.memoizedState,n)},useTransition:function(){var n=Kc(Xo)[0],s=In().memoizedState;return[n,s]},useMutableSource:C0,useSyncExternalStore:j0,useId:H0,unstable_isNewReconciler:!1};function Gn(n,s){if(n&&n.defaultProps){s=Z({},s),n=n.defaultProps;for(var a in n)s[a]===void 0&&(s[a]=n[a]);return s}return s}function Zc(n,s,a,h){s=n.memoizedState,a=a(h,s),a=a==null?s:Z({},s,a),n.memoizedState=a,n.lanes===0&&(n.updateQueue.baseState=a)}var El={isMounted:function(n){return(n=n._reactInternals)?En(n)===n:!1},enqueueSetState:function(n,s,a){n=n._reactInternals;var h=en(),v=xs(n),x=Or(h,v);x.payload=s,a!=null&&(x.callback=a),s=gs(n,x,v),s!==null&&(Xn(s,n,v,h),vl(s,n,v))},enqueueReplaceState:function(n,s,a){n=n._reactInternals;var h=en(),v=xs(n),x=Or(h,v);x.tag=1,x.payload=s,a!=null&&(x.callback=a),s=gs(n,x,v),s!==null&&(Xn(s,n,v,h),vl(s,n,v))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var a=en(),h=xs(n),v=Or(a,h);v.tag=2,s!=null&&(v.callback=s),s=gs(n,v,h),s!==null&&(Xn(s,n,h,a),vl(s,n,h))}};function Y0(n,s,a,h,v,x,T){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(h,x,T):s.prototype&&s.prototype.isPureReactComponent?!$o(a,h)||!$o(v,x):!0}function K0(n,s,a){var h=!1,v=hs,x=s.contextType;return typeof x=="object"&&x!==null?x=An(x):(v=sn(s)?Qs:Ut.current,h=s.contextTypes,x=(h=h!=null)?qi(n,v):hs),s=new s(a,x),n.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=El,n.stateNode=s,s._reactInternals=n,h&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=v,n.__reactInternalMemoizedMaskedChildContext=x),s}function X0(n,s,a,h){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,h),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,h),s.state!==n&&El.enqueueReplaceState(s,s.state,null)}function Jc(n,s,a,h){var v=n.stateNode;v.props=a,v.state=n.memoizedState,v.refs={},Dc(n);var x=s.contextType;typeof x=="object"&&x!==null?v.context=An(x):(x=sn(s)?Qs:Ut.current,v.context=qi(n,x)),v.state=n.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(Zc(n,s,x,a),v.state=n.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(s=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),s!==v.state&&El.enqueueReplaceState(v,v.state,null),yl(n,a,v,h),v.state=n.memoizedState),typeof v.componentDidMount=="function"&&(n.flags|=4194308)}function Vi(n,s){try{var a="",h=s;do a+=Q(h),h=h.return;while(h);var v=a}catch(x){v=`
|
|
39
|
+
Error generating stack: `+x.message+`
|
|
40
|
+
`+x.stack}return{value:n,source:s,stack:v,digest:null}}function ed(n,s,a){return{value:n,source:null,stack:a??null,digest:s??null}}function td(n,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var BT=typeof WeakMap=="function"?WeakMap:Map;function Q0(n,s,a){a=Or(-1,a),a.tag=3,a.payload={element:null};var h=s.value;return a.callback=function(){Il||(Il=!0,gd=h),td(n,s)},a}function Z0(n,s,a){a=Or(-1,a),a.tag=3;var h=n.type.getDerivedStateFromError;if(typeof h=="function"){var v=s.value;a.payload=function(){return h(v)},a.callback=function(){td(n,s)}}var x=n.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(a.callback=function(){td(n,s),typeof h!="function"&&(ys===null?ys=new Set([this]):ys.add(this));var T=s.stack;this.componentDidCatch(s.value,{componentStack:T!==null?T:""})}),a}function J0(n,s,a){var h=n.pingCache;if(h===null){h=n.pingCache=new BT;var v=new Set;h.set(s,v)}else v=h.get(s),v===void 0&&(v=new Set,h.set(s,v));v.has(a)||(v.add(a),n=nR.bind(null,n,s,a),s.then(n,n))}function ew(n){do{var s;if((s=n.tag===13)&&(s=n.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return n;n=n.return}while(n!==null);return null}function tw(n,s,a,h,v){return(n.mode&1)===0?(n===s?n.flags|=65536:(n.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(s=Or(-1,1),s.tag=2,gs(a,s,1))),a.lanes|=1),n):(n.flags|=65536,n.lanes=v,n)}var UT=j.ReactCurrentOwner,on=!1;function Jt(n,s,a,h){s.child=n===null?_0(s,null,a,h):Bi(s,n.child,a,h)}function nw(n,s,a,h,v){a=a.render;var x=s.ref;return Hi(s,v),h=Vc(n,s,a,h,x,v),a=Gc(),n!==null&&!on?(s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~v,Pr(n,s,v)):(ot&&a&&Tc(s),s.flags|=1,Jt(n,s,h,v),s.child)}function rw(n,s,a,h,v){if(n===null){var x=a.type;return typeof x=="function"&&!Sd(x)&&x.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(s.tag=15,s.type=x,sw(n,s,x,h,v)):(n=ql(a.type,null,h,s,s.mode,v),n.ref=s.ref,n.return=s,s.child=n)}if(x=n.child,(n.lanes&v)===0){var T=x.memoizedProps;if(a=a.compare,a=a!==null?a:$o,a(T,h)&&n.ref===s.ref)return Pr(n,s,v)}return s.flags|=1,n=bs(x,h),n.ref=s.ref,n.return=s,s.child=n}function sw(n,s,a,h,v){if(n!==null){var x=n.memoizedProps;if($o(x,h)&&n.ref===s.ref)if(on=!1,s.pendingProps=h=x,(n.lanes&v)!==0)(n.flags&131072)!==0&&(on=!0);else return s.lanes=n.lanes,Pr(n,s,v)}return nd(n,s,a,h,v)}function iw(n,s,a){var h=s.pendingProps,v=h.children,x=n!==null?n.memoizedState:null;if(h.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},tt(Yi,xn),xn|=a;else{if((a&1073741824)===0)return n=x!==null?x.baseLanes|a:a,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:n,cachePool:null,transitions:null},s.updateQueue=null,tt(Yi,xn),xn|=n,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},h=x!==null?x.baseLanes:a,tt(Yi,xn),xn|=h}else x!==null?(h=x.baseLanes|a,s.memoizedState=null):h=a,tt(Yi,xn),xn|=h;return Jt(n,s,v,a),s.child}function ow(n,s){var a=s.ref;(n===null&&a!==null||n!==null&&n.ref!==a)&&(s.flags|=512,s.flags|=2097152)}function nd(n,s,a,h,v){var x=sn(a)?Qs:Ut.current;return x=qi(s,x),Hi(s,v),a=Vc(n,s,a,h,x,v),h=Gc(),n!==null&&!on?(s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~v,Pr(n,s,v)):(ot&&h&&Tc(s),s.flags|=1,Jt(n,s,a,v),s.child)}function aw(n,s,a,h,v){if(sn(a)){var x=!0;ul(s)}else x=!1;if(Hi(s,v),s.stateNode===null)Cl(n,s),K0(s,a,h),Jc(s,a,h,v),h=!0;else if(n===null){var T=s.stateNode,B=s.memoizedProps;T.props=B;var X=T.context,le=a.contextType;typeof le=="object"&&le!==null?le=An(le):(le=sn(a)?Qs:Ut.current,le=qi(s,le));var pe=a.getDerivedStateFromProps,me=typeof pe=="function"||typeof T.getSnapshotBeforeUpdate=="function";me||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(B!==h||X!==le)&&X0(s,T,h,le),ms=!1;var he=s.memoizedState;T.state=he,yl(s,h,T,v),X=s.memoizedState,B!==h||he!==X||rn.current||ms?(typeof pe=="function"&&(Zc(s,a,pe,h),X=s.memoizedState),(B=ms||Y0(s,a,B,h,he,X,le))?(me||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(s.flags|=4194308)):(typeof T.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=h,s.memoizedState=X),T.props=h,T.state=X,T.context=le,h=B):(typeof T.componentDidMount=="function"&&(s.flags|=4194308),h=!1)}else{T=s.stateNode,S0(n,s),B=s.memoizedProps,le=s.type===s.elementType?B:Gn(s.type,B),T.props=le,me=s.pendingProps,he=T.context,X=a.contextType,typeof X=="object"&&X!==null?X=An(X):(X=sn(a)?Qs:Ut.current,X=qi(s,X));var be=a.getDerivedStateFromProps;(pe=typeof be=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(B!==me||he!==X)&&X0(s,T,h,X),ms=!1,he=s.memoizedState,T.state=he,yl(s,h,T,v);var Ne=s.memoizedState;B!==me||he!==Ne||rn.current||ms?(typeof be=="function"&&(Zc(s,a,be,h),Ne=s.memoizedState),(le=ms||Y0(s,a,le,h,he,Ne,X)||!1)?(pe||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(h,Ne,X),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(h,Ne,X)),typeof T.componentDidUpdate=="function"&&(s.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof T.componentDidUpdate!="function"||B===n.memoizedProps&&he===n.memoizedState||(s.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||B===n.memoizedProps&&he===n.memoizedState||(s.flags|=1024),s.memoizedProps=h,s.memoizedState=Ne),T.props=h,T.state=Ne,T.context=X,h=le):(typeof T.componentDidUpdate!="function"||B===n.memoizedProps&&he===n.memoizedState||(s.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||B===n.memoizedProps&&he===n.memoizedState||(s.flags|=1024),h=!1)}return rd(n,s,a,h,x,v)}function rd(n,s,a,h,v,x){ow(n,s);var T=(s.flags&128)!==0;if(!h&&!T)return v&&f0(s,a,!1),Pr(n,s,x);h=s.stateNode,UT.current=s;var B=T&&typeof a.getDerivedStateFromError!="function"?null:h.render();return s.flags|=1,n!==null&&T?(s.child=Bi(s,n.child,null,x),s.child=Bi(s,null,B,x)):Jt(n,s,B,x),s.memoizedState=h.state,v&&f0(s,a,!0),s.child}function lw(n){var s=n.stateNode;s.pendingContext?c0(n,s.pendingContext,s.pendingContext!==s.context):s.context&&c0(n,s.context,!1),Fc(n,s.containerInfo)}function uw(n,s,a,h,v){return zi(),Mc(v),s.flags|=256,Jt(n,s,a,h),s.child}var sd={dehydrated:null,treeContext:null,retryLane:0};function id(n){return{baseLanes:n,cachePool:null,transitions:null}}function cw(n,s,a){var h=s.pendingProps,v=ct.current,x=!1,T=(s.flags&128)!==0,B;if((B=T)||(B=n!==null&&n.memoizedState===null?!1:(v&2)!==0),B?(x=!0,s.flags&=-129):(n===null||n.memoizedState!==null)&&(v|=1),tt(ct,v&1),n===null)return Ic(s),n=s.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?((s.mode&1)===0?s.lanes=1:n.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(T=h.children,n=h.fallback,x?(h=s.mode,x=s.child,T={mode:"hidden",children:T},(h&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=T):x=Dl(T,h,0,null),n=ai(n,h,a,null),x.return=s,n.return=s,x.sibling=n,s.child=x,s.child.memoizedState=id(a),s.memoizedState=sd,n):od(s,T));if(v=n.memoizedState,v!==null&&(B=v.dehydrated,B!==null))return HT(n,s,T,h,B,v,a);if(x){x=h.fallback,T=s.mode,v=n.child,B=v.sibling;var X={mode:"hidden",children:h.children};return(T&1)===0&&s.child!==v?(h=s.child,h.childLanes=0,h.pendingProps=X,s.deletions=null):(h=bs(v,X),h.subtreeFlags=v.subtreeFlags&14680064),B!==null?x=bs(B,x):(x=ai(x,T,a,null),x.flags|=2),x.return=s,h.return=s,h.sibling=x,s.child=h,h=x,x=s.child,T=n.child.memoizedState,T=T===null?id(a):{baseLanes:T.baseLanes|a,cachePool:null,transitions:T.transitions},x.memoizedState=T,x.childLanes=n.childLanes&~a,s.memoizedState=sd,h}return x=n.child,n=x.sibling,h=bs(x,{mode:"visible",children:h.children}),(s.mode&1)===0&&(h.lanes=a),h.return=s,h.sibling=null,n!==null&&(a=s.deletions,a===null?(s.deletions=[n],s.flags|=16):a.push(n)),s.child=h,s.memoizedState=null,h}function od(n,s){return s=Dl({mode:"visible",children:s},n.mode,0,null),s.return=n,n.child=s}function Nl(n,s,a,h){return h!==null&&Mc(h),Bi(s,n.child,null,a),n=od(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function HT(n,s,a,h,v,x,T){if(a)return s.flags&256?(s.flags&=-257,h=ed(Error(r(422))),Nl(n,s,T,h)):s.memoizedState!==null?(s.child=n.child,s.flags|=128,null):(x=h.fallback,v=s.mode,h=Dl({mode:"visible",children:h.children},v,0,null),x=ai(x,v,T,null),x.flags|=2,h.return=s,x.return=s,h.sibling=x,s.child=h,(s.mode&1)!==0&&Bi(s,n.child,null,T),s.child.memoizedState=id(T),s.memoizedState=sd,x);if((s.mode&1)===0)return Nl(n,s,T,null);if(v.data==="$!"){if(h=v.nextSibling&&v.nextSibling.dataset,h)var B=h.dgst;return h=B,x=Error(r(419)),h=ed(x,h,void 0),Nl(n,s,T,h)}if(B=(T&n.childLanes)!==0,on||B){if(h=It,h!==null){switch(T&-T){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&(h.suspendedLanes|T))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Mr(n,v),Xn(h,n,v,-1))}return bd(),h=ed(Error(r(421))),Nl(n,s,T,h)}return v.data==="$?"?(s.flags|=128,s.child=n.child,s=rR.bind(null,n),v._reactRetry=s,null):(n=x.treeContext,wn=ds(v.nextSibling),yn=s,ot=!0,Vn=null,n!==null&&(Tn[Rn++]=Ar,Tn[Rn++]=Ir,Tn[Rn++]=Zs,Ar=n.id,Ir=n.overflow,Zs=s),s=od(s,h.children),s.flags|=4096,s)}function dw(n,s,a){n.lanes|=s;var h=n.alternate;h!==null&&(h.lanes|=s),$c(n.return,s,a)}function ad(n,s,a,h,v){var x=n.memoizedState;x===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:h,tail:a,tailMode:v}:(x.isBackwards=s,x.rendering=null,x.renderingStartTime=0,x.last=h,x.tail=a,x.tailMode=v)}function fw(n,s,a){var h=s.pendingProps,v=h.revealOrder,x=h.tail;if(Jt(n,s,h.children,a),h=ct.current,(h&2)!==0)h=h&1|2,s.flags|=128;else{if(n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&dw(n,a,s);else if(n.tag===19)dw(n,a,s);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}h&=1}if(tt(ct,h),(s.mode&1)===0)s.memoizedState=null;else switch(v){case"forwards":for(a=s.child,v=null;a!==null;)n=a.alternate,n!==null&&wl(n)===null&&(v=a),a=a.sibling;a=v,a===null?(v=s.child,s.child=null):(v=a.sibling,a.sibling=null),ad(s,!1,v,a,x);break;case"backwards":for(a=null,v=s.child,s.child=null;v!==null;){if(n=v.alternate,n!==null&&wl(n)===null){s.child=v;break}n=v.sibling,v.sibling=a,a=v,v=n}ad(s,!0,a,null,x);break;case"together":ad(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Cl(n,s){(s.mode&1)===0&&n!==null&&(n.alternate=null,s.alternate=null,s.flags|=2)}function Pr(n,s,a){if(n!==null&&(s.dependencies=n.dependencies),ri|=s.lanes,(a&s.childLanes)===0)return null;if(n!==null&&s.child!==n.child)throw Error(r(153));if(s.child!==null){for(n=s.child,a=bs(n,n.pendingProps),s.child=a,a.return=s;n.sibling!==null;)n=n.sibling,a=a.sibling=bs(n,n.pendingProps),a.return=s;a.sibling=null}return s.child}function WT(n,s,a){switch(s.tag){case 3:lw(s),zi();break;case 5:N0(s);break;case 1:sn(s.type)&&ul(s);break;case 4:Fc(s,s.stateNode.containerInfo);break;case 10:var h=s.type._context,v=s.memoizedProps.value;tt(ml,h._currentValue),h._currentValue=v;break;case 13:if(h=s.memoizedState,h!==null)return h.dehydrated!==null?(tt(ct,ct.current&1),s.flags|=128,null):(a&s.child.childLanes)!==0?cw(n,s,a):(tt(ct,ct.current&1),n=Pr(n,s,a),n!==null?n.sibling:null);tt(ct,ct.current&1);break;case 19:if(h=(a&s.childLanes)!==0,(n.flags&128)!==0){if(h)return fw(n,s,a);s.flags|=128}if(v=s.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),tt(ct,ct.current),h)break;return null;case 22:case 23:return s.lanes=0,iw(n,s,a)}return Pr(n,s,a)}var hw,ld,pw,mw;hw=function(n,s){for(var a=s.child;a!==null;){if(a.tag===5||a.tag===6)n.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},ld=function(){},pw=function(n,s,a,h){var v=n.memoizedProps;if(v!==h){n=s.stateNode,ti(cr.current);var x=null;switch(a){case"input":v=ye(n,v),h=ye(n,h),x=[];break;case"select":v=Z({},v,{value:void 0}),h=Z({},h,{value:void 0}),x=[];break;case"textarea":v=Ze(n,v),h=Ze(n,h),x=[];break;default:typeof v.onClick!="function"&&typeof h.onClick=="function"&&(n.onclick=ol)}Yt(a,h);var T;a=null;for(le in v)if(!h.hasOwnProperty(le)&&v.hasOwnProperty(le)&&v[le]!=null)if(le==="style"){var B=v[le];for(T in B)B.hasOwnProperty(T)&&(a||(a={}),a[T]="")}else le!=="dangerouslySetInnerHTML"&&le!=="children"&&le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&le!=="autoFocus"&&(o.hasOwnProperty(le)?x||(x=[]):(x=x||[]).push(le,null));for(le in h){var X=h[le];if(B=v!=null?v[le]:void 0,h.hasOwnProperty(le)&&X!==B&&(X!=null||B!=null))if(le==="style")if(B){for(T in B)!B.hasOwnProperty(T)||X&&X.hasOwnProperty(T)||(a||(a={}),a[T]="");for(T in X)X.hasOwnProperty(T)&&B[T]!==X[T]&&(a||(a={}),a[T]=X[T])}else a||(x||(x=[]),x.push(le,a)),a=X;else le==="dangerouslySetInnerHTML"?(X=X?X.__html:void 0,B=B?B.__html:void 0,X!=null&&B!==X&&(x=x||[]).push(le,X)):le==="children"?typeof X!="string"&&typeof X!="number"||(x=x||[]).push(le,""+X):le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&(o.hasOwnProperty(le)?(X!=null&&le==="onScroll"&&rt("scroll",n),x||B===X||(x=[])):(x=x||[]).push(le,X))}a&&(x=x||[]).push("style",a);var le=x;(s.updateQueue=le)&&(s.flags|=4)}},mw=function(n,s,a,h){a!==h&&(s.flags|=4)};function Zo(n,s){if(!ot)switch(n.tailMode){case"hidden":s=n.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?n.tail=null:a.sibling=null;break;case"collapsed":a=n.tail;for(var h=null;a!==null;)a.alternate!==null&&(h=a),a=a.sibling;h===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:h.sibling=null}}function Wt(n){var s=n.alternate!==null&&n.alternate.child===n.child,a=0,h=0;if(s)for(var v=n.child;v!==null;)a|=v.lanes|v.childLanes,h|=v.subtreeFlags&14680064,h|=v.flags&14680064,v.return=n,v=v.sibling;else for(v=n.child;v!==null;)a|=v.lanes|v.childLanes,h|=v.subtreeFlags,h|=v.flags,v.return=n,v=v.sibling;return n.subtreeFlags|=h,n.childLanes=a,s}function VT(n,s,a){var h=s.pendingProps;switch(Rc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(s),null;case 1:return sn(s.type)&&ll(),Wt(s),null;case 3:return h=s.stateNode,Wi(),st(rn),st(Ut),Uc(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(n===null||n.child===null)&&(hl(s)?s.flags|=4:n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Vn!==null&&(wd(Vn),Vn=null))),ld(n,s),Wt(s),null;case 5:zc(s);var v=ti(Go.current);if(a=s.type,n!==null&&s.stateNode!=null)pw(n,s,a,h,v),n.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!h){if(s.stateNode===null)throw Error(r(166));return Wt(s),null}if(n=ti(cr.current),hl(s)){h=s.stateNode,a=s.type;var x=s.memoizedProps;switch(h[ur]=s,h[Bo]=x,n=(s.mode&1)!==0,a){case"dialog":rt("cancel",h),rt("close",h);break;case"iframe":case"object":case"embed":rt("load",h);break;case"video":case"audio":for(v=0;v<Do.length;v++)rt(Do[v],h);break;case"source":rt("error",h);break;case"img":case"image":case"link":rt("error",h),rt("load",h);break;case"details":rt("toggle",h);break;case"input":Ee(h,x),rt("invalid",h);break;case"select":h._wrapperState={wasMultiple:!!x.multiple},rt("invalid",h);break;case"textarea":De(h,x),rt("invalid",h)}Yt(a,x),v=null;for(var T in x)if(x.hasOwnProperty(T)){var B=x[T];T==="children"?typeof B=="string"?h.textContent!==B&&(x.suppressHydrationWarning!==!0&&il(h.textContent,B,n),v=["children",B]):typeof B=="number"&&h.textContent!==""+B&&(x.suppressHydrationWarning!==!0&&il(h.textContent,B,n),v=["children",""+B]):o.hasOwnProperty(T)&&B!=null&&T==="onScroll"&&rt("scroll",h)}switch(a){case"input":Ce(h),_e(h,x,!0);break;case"textarea":Ce(h),Xe(h);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(h.onclick=ol)}h=v,s.updateQueue=h,h!==null&&(s.flags|=4)}else{T=v.nodeType===9?v:v.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=Ot(a)),n==="http://www.w3.org/1999/xhtml"?a==="script"?(n=T.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof h.is=="string"?n=T.createElement(a,{is:h.is}):(n=T.createElement(a),a==="select"&&(T=n,h.multiple?T.multiple=!0:h.size&&(T.size=h.size))):n=T.createElementNS(n,a),n[ur]=s,n[Bo]=h,hw(n,s,!1,!1),s.stateNode=n;e:{switch(T=Lt(a,h),a){case"dialog":rt("cancel",n),rt("close",n),v=h;break;case"iframe":case"object":case"embed":rt("load",n),v=h;break;case"video":case"audio":for(v=0;v<Do.length;v++)rt(Do[v],n);v=h;break;case"source":rt("error",n),v=h;break;case"img":case"image":case"link":rt("error",n),rt("load",n),v=h;break;case"details":rt("toggle",n),v=h;break;case"input":Ee(n,h),v=ye(n,h),rt("invalid",n);break;case"option":v=h;break;case"select":n._wrapperState={wasMultiple:!!h.multiple},v=Z({},h,{value:void 0}),rt("invalid",n);break;case"textarea":De(n,h),v=Ze(n,h),rt("invalid",n);break;default:v=h}Yt(a,v),B=v;for(x in B)if(B.hasOwnProperty(x)){var X=B[x];x==="style"?vt(n,X):x==="dangerouslySetInnerHTML"?(X=X?X.__html:void 0,X!=null&&Pt(n,X)):x==="children"?typeof X=="string"?(a!=="textarea"||X!=="")&&zt(n,X):typeof X=="number"&&zt(n,""+X):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?X!=null&&x==="onScroll"&&rt("scroll",n):X!=null&&N(n,x,X,T))}switch(a){case"input":Ce(n),_e(n,h,!1);break;case"textarea":Ce(n),Xe(n);break;case"option":h.value!=null&&n.setAttribute("value",""+fe(h.value));break;case"select":n.multiple=!!h.multiple,x=h.value,x!=null?ft(n,!!h.multiple,x,!1):h.defaultValue!=null&&ft(n,!!h.multiple,h.defaultValue,!0);break;default:typeof v.onClick=="function"&&(n.onclick=ol)}switch(a){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}}h&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Wt(s),null;case 6:if(n&&s.stateNode!=null)mw(n,s,n.memoizedProps,h);else{if(typeof h!="string"&&s.stateNode===null)throw Error(r(166));if(a=ti(Go.current),ti(cr.current),hl(s)){if(h=s.stateNode,a=s.memoizedProps,h[ur]=s,(x=h.nodeValue!==a)&&(n=yn,n!==null))switch(n.tag){case 3:il(h.nodeValue,a,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&il(h.nodeValue,a,(n.mode&1)!==0)}x&&(s.flags|=4)}else h=(a.nodeType===9?a:a.ownerDocument).createTextNode(h),h[ur]=s,s.stateNode=h}return Wt(s),null;case 13:if(st(ct),h=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(ot&&wn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)y0(),zi(),s.flags|=98560,x=!1;else if(x=hl(s),h!==null&&h.dehydrated!==null){if(n===null){if(!x)throw Error(r(318));if(x=s.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[ur]=s}else zi(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Wt(s),x=!1}else Vn!==null&&(wd(Vn),Vn=null),x=!0;if(!x)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=a,s):(h=h!==null,h!==(n!==null&&n.memoizedState!==null)&&h&&(s.child.flags|=8192,(s.mode&1)!==0&&(n===null||(ct.current&1)!==0?Et===0&&(Et=3):bd())),s.updateQueue!==null&&(s.flags|=4),Wt(s),null);case 4:return Wi(),ld(n,s),n===null&&Fo(s.stateNode.containerInfo),Wt(s),null;case 10:return Lc(s.type._context),Wt(s),null;case 17:return sn(s.type)&&ll(),Wt(s),null;case 19:if(st(ct),x=s.memoizedState,x===null)return Wt(s),null;if(h=(s.flags&128)!==0,T=x.rendering,T===null)if(h)Zo(x,!1);else{if(Et!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(T=wl(n),T!==null){for(s.flags|=128,Zo(x,!1),h=T.updateQueue,h!==null&&(s.updateQueue=h,s.flags|=4),s.subtreeFlags=0,h=a,a=s.child;a!==null;)x=a,n=h,x.flags&=14680066,T=x.alternate,T===null?(x.childLanes=0,x.lanes=n,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=T.childLanes,x.lanes=T.lanes,x.child=T.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=T.memoizedProps,x.memoizedState=T.memoizedState,x.updateQueue=T.updateQueue,x.type=T.type,n=T.dependencies,x.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),a=a.sibling;return tt(ct,ct.current&1|2),s.child}n=n.sibling}x.tail!==null&&nt()>Ki&&(s.flags|=128,h=!0,Zo(x,!1),s.lanes=4194304)}else{if(!h)if(n=wl(T),n!==null){if(s.flags|=128,h=!0,a=n.updateQueue,a!==null&&(s.updateQueue=a,s.flags|=4),Zo(x,!0),x.tail===null&&x.tailMode==="hidden"&&!T.alternate&&!ot)return Wt(s),null}else 2*nt()-x.renderingStartTime>Ki&&a!==1073741824&&(s.flags|=128,h=!0,Zo(x,!1),s.lanes=4194304);x.isBackwards?(T.sibling=s.child,s.child=T):(a=x.last,a!==null?a.sibling=T:s.child=T,x.last=T)}return x.tail!==null?(s=x.tail,x.rendering=s,x.tail=s.sibling,x.renderingStartTime=nt(),s.sibling=null,a=ct.current,tt(ct,h?a&1|2:a&1),s):(Wt(s),null);case 22:case 23:return _d(),h=s.memoizedState!==null,n!==null&&n.memoizedState!==null!==h&&(s.flags|=8192),h&&(s.mode&1)!==0?(xn&1073741824)!==0&&(Wt(s),s.subtreeFlags&6&&(s.flags|=8192)):Wt(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function GT(n,s){switch(Rc(s),s.tag){case 1:return sn(s.type)&&ll(),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return Wi(),st(rn),st(Ut),Uc(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 5:return zc(s),null;case 13:if(st(ct),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(r(340));zi()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return st(ct),null;case 4:return Wi(),null;case 10:return Lc(s.type._context),null;case 22:case 23:return _d(),null;case 24:return null;default:return null}}var jl=!1,Vt=!1,YT=typeof WeakSet=="function"?WeakSet:Set,ke=null;function Gi(n,s){var a=n.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(h){mt(n,s,h)}else a.current=null}function ud(n,s,a){try{a()}catch(h){mt(n,s,h)}}var gw=!1;function KT(n,s){if(_c=ji,n=Yy(),hc(n)){if("selectionStart"in n)var a={start:n.selectionStart,end:n.selectionEnd};else e:{a=(a=n.ownerDocument)&&a.defaultView||window;var h=a.getSelection&&a.getSelection();if(h&&h.rangeCount!==0){a=h.anchorNode;var v=h.anchorOffset,x=h.focusNode;h=h.focusOffset;try{a.nodeType,x.nodeType}catch{a=null;break e}var T=0,B=-1,X=-1,le=0,pe=0,me=n,he=null;t:for(;;){for(var be;me!==a||v!==0&&me.nodeType!==3||(B=T+v),me!==x||h!==0&&me.nodeType!==3||(X=T+h),me.nodeType===3&&(T+=me.nodeValue.length),(be=me.firstChild)!==null;)he=me,me=be;for(;;){if(me===n)break t;if(he===a&&++le===v&&(B=T),he===x&&++pe===h&&(X=T),(be=me.nextSibling)!==null)break;me=he,he=me.parentNode}me=be}a=B===-1||X===-1?null:{start:B,end:X}}else a=null}a=a||{start:0,end:0}}else a=null;for(bc={focusedElem:n,selectionRange:a},ji=!1,ke=s;ke!==null;)if(s=ke,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,ke=n;else for(;ke!==null;){s=ke;try{var Ne=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Ne!==null){var je=Ne.memoizedProps,yt=Ne.memoizedState,se=s.stateNode,ee=se.getSnapshotBeforeUpdate(s.elementType===s.type?je:Gn(s.type,je),yt);se.__reactInternalSnapshotBeforeUpdate=ee}break;case 3:var ie=s.stateNode.containerInfo;ie.nodeType===1?ie.textContent="":ie.nodeType===9&&ie.documentElement&&ie.removeChild(ie.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ge){mt(s,s.return,ge)}if(n=s.sibling,n!==null){n.return=s.return,ke=n;break}ke=s.return}return Ne=gw,gw=!1,Ne}function Jo(n,s,a){var h=s.updateQueue;if(h=h!==null?h.lastEffect:null,h!==null){var v=h=h.next;do{if((v.tag&n)===n){var x=v.destroy;v.destroy=void 0,x!==void 0&&ud(s,a,x)}v=v.next}while(v!==h)}}function Tl(n,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&n)===n){var h=a.create;a.destroy=h()}a=a.next}while(a!==s)}}function cd(n){var s=n.ref;if(s!==null){var a=n.stateNode;switch(n.tag){case 5:n=a;break;default:n=a}typeof s=="function"?s(n):s.current=n}}function vw(n){var s=n.alternate;s!==null&&(n.alternate=null,vw(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&(delete s[ur],delete s[Bo],delete s[Nc],delete s[AT],delete s[IT])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function yw(n){return n.tag===5||n.tag===3||n.tag===4}function ww(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||yw(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function dd(n,s,a){var h=n.tag;if(h===5||h===6)n=n.stateNode,s?a.nodeType===8?a.parentNode.insertBefore(n,s):a.insertBefore(n,s):(a.nodeType===8?(s=a.parentNode,s.insertBefore(n,a)):(s=a,s.appendChild(n)),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=ol));else if(h!==4&&(n=n.child,n!==null))for(dd(n,s,a),n=n.sibling;n!==null;)dd(n,s,a),n=n.sibling}function fd(n,s,a){var h=n.tag;if(h===5||h===6)n=n.stateNode,s?a.insertBefore(n,s):a.appendChild(n);else if(h!==4&&(n=n.child,n!==null))for(fd(n,s,a),n=n.sibling;n!==null;)fd(n,s,a),n=n.sibling}var qt=null,Yn=!1;function vs(n,s,a){for(a=a.child;a!==null;)xw(n,s,a),a=a.sibling}function xw(n,s,a){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(ir,a)}catch{}switch(a.tag){case 5:Vt||Gi(a,s);case 6:var h=qt,v=Yn;qt=null,vs(n,s,a),qt=h,Yn=v,qt!==null&&(Yn?(n=qt,a=a.stateNode,n.nodeType===8?n.parentNode.removeChild(a):n.removeChild(a)):qt.removeChild(a.stateNode));break;case 18:qt!==null&&(Yn?(n=qt,a=a.stateNode,n.nodeType===8?Ec(n.parentNode,a):n.nodeType===1&&Ec(n,a),rs(n)):Ec(qt,a.stateNode));break;case 4:h=qt,v=Yn,qt=a.stateNode.containerInfo,Yn=!0,vs(n,s,a),qt=h,Yn=v;break;case 0:case 11:case 14:case 15:if(!Vt&&(h=a.updateQueue,h!==null&&(h=h.lastEffect,h!==null))){v=h=h.next;do{var x=v,T=x.destroy;x=x.tag,T!==void 0&&((x&2)!==0||(x&4)!==0)&&ud(a,s,T),v=v.next}while(v!==h)}vs(n,s,a);break;case 1:if(!Vt&&(Gi(a,s),h=a.stateNode,typeof h.componentWillUnmount=="function"))try{h.props=a.memoizedProps,h.state=a.memoizedState,h.componentWillUnmount()}catch(B){mt(a,s,B)}vs(n,s,a);break;case 21:vs(n,s,a);break;case 22:a.mode&1?(Vt=(h=Vt)||a.memoizedState!==null,vs(n,s,a),Vt=h):vs(n,s,a);break;default:vs(n,s,a)}}function _w(n){var s=n.updateQueue;if(s!==null){n.updateQueue=null;var a=n.stateNode;a===null&&(a=n.stateNode=new YT),s.forEach(function(h){var v=sR.bind(null,n,h);a.has(h)||(a.add(h),h.then(v,v))})}}function Kn(n,s){var a=s.deletions;if(a!==null)for(var h=0;h<a.length;h++){var v=a[h];try{var x=n,T=s,B=T;e:for(;B!==null;){switch(B.tag){case 5:qt=B.stateNode,Yn=!1;break e;case 3:qt=B.stateNode.containerInfo,Yn=!0;break e;case 4:qt=B.stateNode.containerInfo,Yn=!0;break e}B=B.return}if(qt===null)throw Error(r(160));xw(x,T,v),qt=null,Yn=!1;var X=v.alternate;X!==null&&(X.return=null),v.return=null}catch(le){mt(v,s,le)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)bw(s,n),s=s.sibling}function bw(n,s){var a=n.alternate,h=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Kn(s,n),fr(n),h&4){try{Jo(3,n,n.return),Tl(3,n)}catch(je){mt(n,n.return,je)}try{Jo(5,n,n.return)}catch(je){mt(n,n.return,je)}}break;case 1:Kn(s,n),fr(n),h&512&&a!==null&&Gi(a,a.return);break;case 5:if(Kn(s,n),fr(n),h&512&&a!==null&&Gi(a,a.return),n.flags&32){var v=n.stateNode;try{zt(v,"")}catch(je){mt(n,n.return,je)}}if(h&4&&(v=n.stateNode,v!=null)){var x=n.memoizedProps,T=a!==null?a.memoizedProps:x,B=n.type,X=n.updateQueue;if(n.updateQueue=null,X!==null)try{B==="input"&&x.type==="radio"&&x.name!=null&&Ye(v,x),Lt(B,T);var le=Lt(B,x);for(T=0;T<X.length;T+=2){var pe=X[T],me=X[T+1];pe==="style"?vt(v,me):pe==="dangerouslySetInnerHTML"?Pt(v,me):pe==="children"?zt(v,me):N(v,pe,me,le)}switch(B){case"input":we(v,x);break;case"textarea":Je(v,x);break;case"select":var he=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var be=x.value;be!=null?ft(v,!!x.multiple,be,!1):he!==!!x.multiple&&(x.defaultValue!=null?ft(v,!!x.multiple,x.defaultValue,!0):ft(v,!!x.multiple,x.multiple?[]:"",!1))}v[Bo]=x}catch(je){mt(n,n.return,je)}}break;case 6:if(Kn(s,n),fr(n),h&4){if(n.stateNode===null)throw Error(r(162));v=n.stateNode,x=n.memoizedProps;try{v.nodeValue=x}catch(je){mt(n,n.return,je)}}break;case 3:if(Kn(s,n),fr(n),h&4&&a!==null&&a.memoizedState.isDehydrated)try{rs(s.containerInfo)}catch(je){mt(n,n.return,je)}break;case 4:Kn(s,n),fr(n);break;case 13:Kn(s,n),fr(n),v=n.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(md=nt())),h&4&&_w(n);break;case 22:if(pe=a!==null&&a.memoizedState!==null,n.mode&1?(Vt=(le=Vt)||pe,Kn(s,n),Vt=le):Kn(s,n),fr(n),h&8192){if(le=n.memoizedState!==null,(n.stateNode.isHidden=le)&&!pe&&(n.mode&1)!==0)for(ke=n,pe=n.child;pe!==null;){for(me=ke=pe;ke!==null;){switch(he=ke,be=he.child,he.tag){case 0:case 11:case 14:case 15:Jo(4,he,he.return);break;case 1:Gi(he,he.return);var Ne=he.stateNode;if(typeof Ne.componentWillUnmount=="function"){h=he,a=he.return;try{s=h,Ne.props=s.memoizedProps,Ne.state=s.memoizedState,Ne.componentWillUnmount()}catch(je){mt(h,a,je)}}break;case 5:Gi(he,he.return);break;case 22:if(he.memoizedState!==null){Ew(me);continue}}be!==null?(be.return=he,ke=be):Ew(me)}pe=pe.sibling}e:for(pe=null,me=n;;){if(me.tag===5){if(pe===null){pe=me;try{v=me.stateNode,le?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(B=me.stateNode,X=me.memoizedProps.style,T=X!=null&&X.hasOwnProperty("display")?X.display:null,B.style.display=ht("display",T))}catch(je){mt(n,n.return,je)}}}else if(me.tag===6){if(pe===null)try{me.stateNode.nodeValue=le?"":me.memoizedProps}catch(je){mt(n,n.return,je)}}else if((me.tag!==22&&me.tag!==23||me.memoizedState===null||me===n)&&me.child!==null){me.child.return=me,me=me.child;continue}if(me===n)break e;for(;me.sibling===null;){if(me.return===null||me.return===n)break e;pe===me&&(pe=null),me=me.return}pe===me&&(pe=null),me.sibling.return=me.return,me=me.sibling}}break;case 19:Kn(s,n),fr(n),h&4&&_w(n);break;case 21:break;default:Kn(s,n),fr(n)}}function fr(n){var s=n.flags;if(s&2){try{e:{for(var a=n.return;a!==null;){if(yw(a)){var h=a;break e}a=a.return}throw Error(r(160))}switch(h.tag){case 5:var v=h.stateNode;h.flags&32&&(zt(v,""),h.flags&=-33);var x=ww(n);fd(n,x,v);break;case 3:case 4:var T=h.stateNode.containerInfo,B=ww(n);dd(n,B,T);break;default:throw Error(r(161))}}catch(X){mt(n,n.return,X)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function XT(n,s,a){ke=n,Sw(n)}function Sw(n,s,a){for(var h=(n.mode&1)!==0;ke!==null;){var v=ke,x=v.child;if(v.tag===22&&h){var T=v.memoizedState!==null||jl;if(!T){var B=v.alternate,X=B!==null&&B.memoizedState!==null||Vt;B=jl;var le=Vt;if(jl=T,(Vt=X)&&!le)for(ke=v;ke!==null;)T=ke,X=T.child,T.tag===22&&T.memoizedState!==null?Nw(v):X!==null?(X.return=T,ke=X):Nw(v);for(;x!==null;)ke=x,Sw(x),x=x.sibling;ke=v,jl=B,Vt=le}kw(n)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,ke=x):kw(n)}}function kw(n){for(;ke!==null;){var s=ke;if((s.flags&8772)!==0){var a=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Vt||Tl(5,s);break;case 1:var h=s.stateNode;if(s.flags&4&&!Vt)if(a===null)h.componentDidMount();else{var v=s.elementType===s.type?a.memoizedProps:Gn(s.type,a.memoizedProps);h.componentDidUpdate(v,a.memoizedState,h.__reactInternalSnapshotBeforeUpdate)}var x=s.updateQueue;x!==null&&E0(s,x,h);break;case 3:var T=s.updateQueue;if(T!==null){if(a=null,s.child!==null)switch(s.child.tag){case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}E0(s,T,a)}break;case 5:var B=s.stateNode;if(a===null&&s.flags&4){a=B;var X=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":X.autoFocus&&a.focus();break;case"img":X.src&&(a.src=X.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var le=s.alternate;if(le!==null){var pe=le.memoizedState;if(pe!==null){var me=pe.dehydrated;me!==null&&rs(me)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Vt||s.flags&512&&cd(s)}catch(he){mt(s,s.return,he)}}if(s===n){ke=null;break}if(a=s.sibling,a!==null){a.return=s.return,ke=a;break}ke=s.return}}function Ew(n){for(;ke!==null;){var s=ke;if(s===n){ke=null;break}var a=s.sibling;if(a!==null){a.return=s.return,ke=a;break}ke=s.return}}function Nw(n){for(;ke!==null;){var s=ke;try{switch(s.tag){case 0:case 11:case 15:var a=s.return;try{Tl(4,s)}catch(X){mt(s,a,X)}break;case 1:var h=s.stateNode;if(typeof h.componentDidMount=="function"){var v=s.return;try{h.componentDidMount()}catch(X){mt(s,v,X)}}var x=s.return;try{cd(s)}catch(X){mt(s,x,X)}break;case 5:var T=s.return;try{cd(s)}catch(X){mt(s,T,X)}}}catch(X){mt(s,s.return,X)}if(s===n){ke=null;break}var B=s.sibling;if(B!==null){B.return=s.return,ke=B;break}ke=s.return}}var QT=Math.ceil,Rl=j.ReactCurrentDispatcher,hd=j.ReactCurrentOwner,Mn=j.ReactCurrentBatchConfig,Ue=0,It=null,xt=null,Dt=0,xn=0,Yi=fs(0),Et=0,ea=null,ri=0,Al=0,pd=0,ta=null,an=null,md=0,Ki=1/0,Lr=null,Il=!1,gd=null,ys=null,Ml=!1,ws=null,Ol=0,na=0,vd=null,Pl=-1,Ll=0;function en(){return(Ue&6)!==0?nt():Pl!==-1?Pl:Pl=nt()}function xs(n){return(n.mode&1)===0?1:(Ue&2)!==0&&Dt!==0?Dt&-Dt:OT.transition!==null?(Ll===0&&(Ll=ki()),Ll):(n=He,n!==0||(n=window.event,n=n===void 0?16:is(n.type)),n)}function Xn(n,s,a,h){if(50<na)throw na=0,vd=null,Error(r(185));es(n,a,h),((Ue&2)===0||n!==It)&&(n===It&&((Ue&2)===0&&(Al|=a),Et===4&&_s(n,Dt)),ln(n,h),a===1&&Ue===0&&(s.mode&1)===0&&(Ki=nt()+500,cl&&ps()))}function ln(n,s){var a=n.callbackNode;Ua(n,s);var h=Ds(n,n===It?Dt:0);if(h===0)a!==null&&Kt(a),n.callbackNode=null,n.callbackPriority=0;else if(s=h&-h,n.callbackPriority!==s){if(a!=null&&Kt(a),s===1)n.tag===0?MT(jw.bind(null,n)):h0(jw.bind(null,n)),TT(function(){(Ue&6)===0&&ps()}),a=null;else{switch(Ha(h)){case 1:a=Xr;break;case 4:a=Ls;break;case 16:a=Qr;break;case 536870912:a=$s;break;default:a=Qr}a=Lw(a,Cw.bind(null,n))}n.callbackPriority=s,n.callbackNode=a}}function Cw(n,s){if(Pl=-1,Ll=0,(Ue&6)!==0)throw Error(r(327));var a=n.callbackNode;if(Xi()&&n.callbackNode!==a)return null;var h=Ds(n,n===It?Dt:0);if(h===0)return null;if((h&30)!==0||(h&n.expiredLanes)!==0||s)s=$l(n,h);else{s=h;var v=Ue;Ue|=2;var x=Rw();(It!==n||Dt!==s)&&(Lr=null,Ki=nt()+500,ii(n,s));do try{eR();break}catch(B){Tw(n,B)}while(!0);Pc(),Rl.current=x,Ue=v,xt!==null?s=0:(It=null,Dt=0,s=Et)}if(s!==0){if(s===2&&(v=Co(n),v!==0&&(h=v,s=yd(n,v))),s===1)throw a=ea,ii(n,0),_s(n,h),ln(n,nt()),a;if(s===6)_s(n,h);else{if(v=n.current.alternate,(h&30)===0&&!ZT(v)&&(s=$l(n,h),s===2&&(x=Co(n),x!==0&&(h=x,s=yd(n,x))),s===1))throw a=ea,ii(n,0),_s(n,h),ln(n,nt()),a;switch(n.finishedWork=v,n.finishedLanes=h,s){case 0:case 1:throw Error(r(345));case 2:oi(n,an,Lr);break;case 3:if(_s(n,h),(h&130023424)===h&&(s=md+500-nt(),10<s)){if(Ds(n,0)!==0)break;if(v=n.suspendedLanes,(v&h)!==h){en(),n.pingedLanes|=n.suspendedLanes&v;break}n.timeoutHandle=kc(oi.bind(null,n,an,Lr),s);break}oi(n,an,Lr);break;case 4:if(_s(n,h),(h&4194240)===h)break;for(s=n.eventTimes,v=-1;0<h;){var T=31-pt(h);x=1<<T,T=s[T],T>v&&(v=T),h&=~x}if(h=v,h=nt()-h,h=(120>h?120:480>h?480:1080>h?1080:1920>h?1920:3e3>h?3e3:4320>h?4320:1960*QT(h/1960))-h,10<h){n.timeoutHandle=kc(oi.bind(null,n,an,Lr),h);break}oi(n,an,Lr);break;case 5:oi(n,an,Lr);break;default:throw Error(r(329))}}}return ln(n,nt()),n.callbackNode===a?Cw.bind(null,n):null}function yd(n,s){var a=ta;return n.current.memoizedState.isDehydrated&&(ii(n,s).flags|=256),n=$l(n,s),n!==2&&(s=an,an=a,s!==null&&wd(s)),n}function wd(n){an===null?an=n:an.push.apply(an,n)}function ZT(n){for(var s=n;;){if(s.flags&16384){var a=s.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var h=0;h<a.length;h++){var v=a[h],x=v.getSnapshot;v=v.value;try{if(!Wn(x(),v))return!1}catch{return!1}}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function _s(n,s){for(s&=~pd,s&=~Al,n.suspendedLanes|=s,n.pingedLanes&=~s,n=n.expirationTimes;0<s;){var a=31-pt(s),h=1<<a;n[a]=-1,s&=~h}}function jw(n){if((Ue&6)!==0)throw Error(r(327));Xi();var s=Ds(n,0);if((s&1)===0)return ln(n,nt()),null;var a=$l(n,s);if(n.tag!==0&&a===2){var h=Co(n);h!==0&&(s=h,a=yd(n,h))}if(a===1)throw a=ea,ii(n,0),_s(n,s),ln(n,nt()),a;if(a===6)throw Error(r(345));return n.finishedWork=n.current.alternate,n.finishedLanes=s,oi(n,an,Lr),ln(n,nt()),null}function xd(n,s){var a=Ue;Ue|=1;try{return n(s)}finally{Ue=a,Ue===0&&(Ki=nt()+500,cl&&ps())}}function si(n){ws!==null&&ws.tag===0&&(Ue&6)===0&&Xi();var s=Ue;Ue|=1;var a=Mn.transition,h=He;try{if(Mn.transition=null,He=1,n)return n()}finally{He=h,Mn.transition=a,Ue=s,(Ue&6)===0&&ps()}}function _d(){xn=Yi.current,st(Yi)}function ii(n,s){n.finishedWork=null,n.finishedLanes=0;var a=n.timeoutHandle;if(a!==-1&&(n.timeoutHandle=-1,jT(a)),xt!==null)for(a=xt.return;a!==null;){var h=a;switch(Rc(h),h.tag){case 1:h=h.type.childContextTypes,h!=null&&ll();break;case 3:Wi(),st(rn),st(Ut),Uc();break;case 5:zc(h);break;case 4:Wi();break;case 13:st(ct);break;case 19:st(ct);break;case 10:Lc(h.type._context);break;case 22:case 23:_d()}a=a.return}if(It=n,xt=n=bs(n.current,null),Dt=xn=s,Et=0,ea=null,pd=Al=ri=0,an=ta=null,ei!==null){for(s=0;s<ei.length;s++)if(a=ei[s],h=a.interleaved,h!==null){a.interleaved=null;var v=h.next,x=a.pending;if(x!==null){var T=x.next;x.next=v,h.next=T}a.pending=h}ei=null}return n}function Tw(n,s){do{var a=xt;try{if(Pc(),xl.current=kl,_l){for(var h=dt.memoizedState;h!==null;){var v=h.queue;v!==null&&(v.pending=null),h=h.next}_l=!1}if(ni=0,At=kt=dt=null,Yo=!1,Ko=0,hd.current=null,a===null||a.return===null){Et=1,ea=s,xt=null;break}e:{var x=n,T=a.return,B=a,X=s;if(s=Dt,B.flags|=32768,X!==null&&typeof X=="object"&&typeof X.then=="function"){var le=X,pe=B,me=pe.tag;if((pe.mode&1)===0&&(me===0||me===11||me===15)){var he=pe.alternate;he?(pe.updateQueue=he.updateQueue,pe.memoizedState=he.memoizedState,pe.lanes=he.lanes):(pe.updateQueue=null,pe.memoizedState=null)}var be=ew(T);if(be!==null){be.flags&=-257,tw(be,T,B,x,s),be.mode&1&&J0(x,le,s),s=be,X=le;var Ne=s.updateQueue;if(Ne===null){var je=new Set;je.add(X),s.updateQueue=je}else Ne.add(X);break e}else{if((s&1)===0){J0(x,le,s),bd();break e}X=Error(r(426))}}else if(ot&&B.mode&1){var yt=ew(T);if(yt!==null){(yt.flags&65536)===0&&(yt.flags|=256),tw(yt,T,B,x,s),Mc(Vi(X,B));break e}}x=X=Vi(X,B),Et!==4&&(Et=2),ta===null?ta=[x]:ta.push(x),x=T;do{switch(x.tag){case 3:x.flags|=65536,s&=-s,x.lanes|=s;var se=Q0(x,X,s);k0(x,se);break e;case 1:B=X;var ee=x.type,ie=x.stateNode;if((x.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(ys===null||!ys.has(ie)))){x.flags|=65536,s&=-s,x.lanes|=s;var ge=Z0(x,B,s);k0(x,ge);break e}}x=x.return}while(x!==null)}Iw(a)}catch(Te){s=Te,xt===a&&a!==null&&(xt=a=a.return);continue}break}while(!0)}function Rw(){var n=Rl.current;return Rl.current=kl,n===null?kl:n}function bd(){(Et===0||Et===3||Et===2)&&(Et=4),It===null||(ri&268435455)===0&&(Al&268435455)===0||_s(It,Dt)}function $l(n,s){var a=Ue;Ue|=2;var h=Rw();(It!==n||Dt!==s)&&(Lr=null,ii(n,s));do try{JT();break}catch(v){Tw(n,v)}while(!0);if(Pc(),Ue=a,Rl.current=h,xt!==null)throw Error(r(261));return It=null,Dt=0,Et}function JT(){for(;xt!==null;)Aw(xt)}function eR(){for(;xt!==null&&!Kr();)Aw(xt)}function Aw(n){var s=Pw(n.alternate,n,xn);n.memoizedProps=n.pendingProps,s===null?Iw(n):xt=s,hd.current=null}function Iw(n){var s=n;do{var a=s.alternate;if(n=s.return,(s.flags&32768)===0){if(a=VT(a,s,xn),a!==null){xt=a;return}}else{if(a=GT(a,s),a!==null){a.flags&=32767,xt=a;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{Et=6,xt=null;return}}if(s=s.sibling,s!==null){xt=s;return}xt=s=n}while(s!==null);Et===0&&(Et=5)}function oi(n,s,a){var h=He,v=Mn.transition;try{Mn.transition=null,He=1,tR(n,s,a,h)}finally{Mn.transition=v,He=h}return null}function tR(n,s,a,h){do Xi();while(ws!==null);if((Ue&6)!==0)throw Error(r(327));a=n.finishedWork;var v=n.finishedLanes;if(a===null)return null;if(n.finishedWork=null,n.finishedLanes=0,a===n.current)throw Error(r(177));n.callbackNode=null,n.callbackPriority=0;var x=a.lanes|a.childLanes;if(ic(n,x),n===It&&(xt=It=null,Dt=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||Ml||(Ml=!0,Lw(Qr,function(){return Xi(),null})),x=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||x){x=Mn.transition,Mn.transition=null;var T=He;He=1;var B=Ue;Ue|=4,hd.current=null,KT(n,a),bw(a,n),_T(bc),ji=!!_c,bc=_c=null,n.current=a,XT(a),Si(),Ue=B,He=T,Mn.transition=x}else n.current=a;if(Ml&&(Ml=!1,ws=n,Ol=v),x=n.pendingLanes,x===0&&(ys=null),qs(a.stateNode),ln(n,nt()),s!==null)for(h=n.onRecoverableError,a=0;a<s.length;a++)v=s[a],h(v.value,{componentStack:v.stack,digest:v.digest});if(Il)throw Il=!1,n=gd,gd=null,n;return(Ol&1)!==0&&n.tag!==0&&Xi(),x=n.pendingLanes,(x&1)!==0?n===vd?na++:(na=0,vd=n):na=0,ps(),null}function Xi(){if(ws!==null){var n=Ha(Ol),s=Mn.transition,a=He;try{if(Mn.transition=null,He=16>n?16:n,ws===null)var h=!1;else{if(n=ws,ws=null,Ol=0,(Ue&6)!==0)throw Error(r(331));var v=Ue;for(Ue|=4,ke=n.current;ke!==null;){var x=ke,T=x.child;if((ke.flags&16)!==0){var B=x.deletions;if(B!==null){for(var X=0;X<B.length;X++){var le=B[X];for(ke=le;ke!==null;){var pe=ke;switch(pe.tag){case 0:case 11:case 15:Jo(8,pe,x)}var me=pe.child;if(me!==null)me.return=pe,ke=me;else for(;ke!==null;){pe=ke;var he=pe.sibling,be=pe.return;if(vw(pe),pe===le){ke=null;break}if(he!==null){he.return=be,ke=he;break}ke=be}}}var Ne=x.alternate;if(Ne!==null){var je=Ne.child;if(je!==null){Ne.child=null;do{var yt=je.sibling;je.sibling=null,je=yt}while(je!==null)}}ke=x}}if((x.subtreeFlags&2064)!==0&&T!==null)T.return=x,ke=T;else e:for(;ke!==null;){if(x=ke,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Jo(9,x,x.return)}var se=x.sibling;if(se!==null){se.return=x.return,ke=se;break e}ke=x.return}}var ee=n.current;for(ke=ee;ke!==null;){T=ke;var ie=T.child;if((T.subtreeFlags&2064)!==0&&ie!==null)ie.return=T,ke=ie;else e:for(T=ee;ke!==null;){if(B=ke,(B.flags&2048)!==0)try{switch(B.tag){case 0:case 11:case 15:Tl(9,B)}}catch(Te){mt(B,B.return,Te)}if(B===T){ke=null;break e}var ge=B.sibling;if(ge!==null){ge.return=B.return,ke=ge;break e}ke=B.return}}if(Ue=v,ps(),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(ir,n)}catch{}h=!0}return h}finally{He=a,Mn.transition=s}}return!1}function Mw(n,s,a){s=Vi(a,s),s=Q0(n,s,1),n=gs(n,s,1),s=en(),n!==null&&(es(n,1,s),ln(n,s))}function mt(n,s,a){if(n.tag===3)Mw(n,n,a);else for(;s!==null;){if(s.tag===3){Mw(s,n,a);break}else if(s.tag===1){var h=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(ys===null||!ys.has(h))){n=Vi(a,n),n=Z0(s,n,1),s=gs(s,n,1),n=en(),s!==null&&(es(s,1,n),ln(s,n));break}}s=s.return}}function nR(n,s,a){var h=n.pingCache;h!==null&&h.delete(s),s=en(),n.pingedLanes|=n.suspendedLanes&a,It===n&&(Dt&a)===a&&(Et===4||Et===3&&(Dt&130023424)===Dt&&500>nt()-md?ii(n,0):pd|=a),ln(n,s)}function Ow(n,s){s===0&&((n.mode&1)===0?s=1:(s=Jr,Jr<<=1,(Jr&130023424)===0&&(Jr=4194304)));var a=en();n=Mr(n,s),n!==null&&(es(n,s,a),ln(n,a))}function rR(n){var s=n.memoizedState,a=0;s!==null&&(a=s.retryLane),Ow(n,a)}function sR(n,s){var a=0;switch(n.tag){case 13:var h=n.stateNode,v=n.memoizedState;v!==null&&(a=v.retryLane);break;case 19:h=n.stateNode;break;default:throw Error(r(314))}h!==null&&h.delete(s),Ow(n,a)}var Pw;Pw=function(n,s,a){if(n!==null)if(n.memoizedProps!==s.pendingProps||rn.current)on=!0;else{if((n.lanes&a)===0&&(s.flags&128)===0)return on=!1,WT(n,s,a);on=(n.flags&131072)!==0}else on=!1,ot&&(s.flags&1048576)!==0&&p0(s,fl,s.index);switch(s.lanes=0,s.tag){case 2:var h=s.type;Cl(n,s),n=s.pendingProps;var v=qi(s,Ut.current);Hi(s,a),v=Vc(null,s,h,n,v,a);var x=Gc();return s.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,sn(h)?(x=!0,ul(s)):x=!1,s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Dc(s),v.updater=El,s.stateNode=v,v._reactInternals=s,Jc(s,h,n,a),s=rd(null,s,h,!0,x,a)):(s.tag=0,ot&&x&&Tc(s),Jt(null,s,v,a),s=s.child),s;case 16:h=s.elementType;e:{switch(Cl(n,s),n=s.pendingProps,v=h._init,h=v(h._payload),s.type=h,v=s.tag=oR(h),n=Gn(h,n),v){case 0:s=nd(null,s,h,n,a);break e;case 1:s=aw(null,s,h,n,a);break e;case 11:s=nw(null,s,h,n,a);break e;case 14:s=rw(null,s,h,Gn(h.type,n),a);break e}throw Error(r(306,h,""))}return s;case 0:return h=s.type,v=s.pendingProps,v=s.elementType===h?v:Gn(h,v),nd(n,s,h,v,a);case 1:return h=s.type,v=s.pendingProps,v=s.elementType===h?v:Gn(h,v),aw(n,s,h,v,a);case 3:e:{if(lw(s),n===null)throw Error(r(387));h=s.pendingProps,x=s.memoizedState,v=x.element,S0(n,s),yl(s,h,null,a);var T=s.memoizedState;if(h=T.element,x.isDehydrated)if(x={element:h,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){v=Vi(Error(r(423)),s),s=uw(n,s,h,a,v);break e}else if(h!==v){v=Vi(Error(r(424)),s),s=uw(n,s,h,a,v);break e}else for(wn=ds(s.stateNode.containerInfo.firstChild),yn=s,ot=!0,Vn=null,a=_0(s,null,h,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(zi(),h===v){s=Pr(n,s,a);break e}Jt(n,s,h,a)}s=s.child}return s;case 5:return N0(s),n===null&&Ic(s),h=s.type,v=s.pendingProps,x=n!==null?n.memoizedProps:null,T=v.children,Sc(h,v)?T=null:x!==null&&Sc(h,x)&&(s.flags|=32),ow(n,s),Jt(n,s,T,a),s.child;case 6:return n===null&&Ic(s),null;case 13:return cw(n,s,a);case 4:return Fc(s,s.stateNode.containerInfo),h=s.pendingProps,n===null?s.child=Bi(s,null,h,a):Jt(n,s,h,a),s.child;case 11:return h=s.type,v=s.pendingProps,v=s.elementType===h?v:Gn(h,v),nw(n,s,h,v,a);case 7:return Jt(n,s,s.pendingProps,a),s.child;case 8:return Jt(n,s,s.pendingProps.children,a),s.child;case 12:return Jt(n,s,s.pendingProps.children,a),s.child;case 10:e:{if(h=s.type._context,v=s.pendingProps,x=s.memoizedProps,T=v.value,tt(ml,h._currentValue),h._currentValue=T,x!==null)if(Wn(x.value,T)){if(x.children===v.children&&!rn.current){s=Pr(n,s,a);break e}}else for(x=s.child,x!==null&&(x.return=s);x!==null;){var B=x.dependencies;if(B!==null){T=x.child;for(var X=B.firstContext;X!==null;){if(X.context===h){if(x.tag===1){X=Or(-1,a&-a),X.tag=2;var le=x.updateQueue;if(le!==null){le=le.shared;var pe=le.pending;pe===null?X.next=X:(X.next=pe.next,pe.next=X),le.pending=X}}x.lanes|=a,X=x.alternate,X!==null&&(X.lanes|=a),$c(x.return,a,s),B.lanes|=a;break}X=X.next}}else if(x.tag===10)T=x.type===s.type?null:x.child;else if(x.tag===18){if(T=x.return,T===null)throw Error(r(341));T.lanes|=a,B=T.alternate,B!==null&&(B.lanes|=a),$c(T,a,s),T=x.sibling}else T=x.child;if(T!==null)T.return=x;else for(T=x;T!==null;){if(T===s){T=null;break}if(x=T.sibling,x!==null){x.return=T.return,T=x;break}T=T.return}x=T}Jt(n,s,v.children,a),s=s.child}return s;case 9:return v=s.type,h=s.pendingProps.children,Hi(s,a),v=An(v),h=h(v),s.flags|=1,Jt(n,s,h,a),s.child;case 14:return h=s.type,v=Gn(h,s.pendingProps),v=Gn(h.type,v),rw(n,s,h,v,a);case 15:return sw(n,s,s.type,s.pendingProps,a);case 17:return h=s.type,v=s.pendingProps,v=s.elementType===h?v:Gn(h,v),Cl(n,s),s.tag=1,sn(h)?(n=!0,ul(s)):n=!1,Hi(s,a),K0(s,h,v),Jc(s,h,v,a),rd(null,s,h,!0,n,a);case 19:return fw(n,s,a);case 22:return iw(n,s,a)}throw Error(r(156,s.tag))};function Lw(n,s){return _r(n,s)}function iR(n,s,a,h){this.tag=n,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function On(n,s,a,h){return new iR(n,s,a,h)}function Sd(n){return n=n.prototype,!(!n||!n.isReactComponent)}function oR(n){if(typeof n=="function")return Sd(n)?1:0;if(n!=null){if(n=n.$$typeof,n===V)return 11;if(n===F)return 14}return 2}function bs(n,s){var a=n.alternate;return a===null?(a=On(n.tag,s,n.key,n.mode),a.elementType=n.elementType,a.type=n.type,a.stateNode=n.stateNode,a.alternate=n,n.alternate=a):(a.pendingProps=s,a.type=n.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=n.flags&14680064,a.childLanes=n.childLanes,a.lanes=n.lanes,a.child=n.child,a.memoizedProps=n.memoizedProps,a.memoizedState=n.memoizedState,a.updateQueue=n.updateQueue,s=n.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=n.sibling,a.index=n.index,a.ref=n.ref,a}function ql(n,s,a,h,v,x){var T=2;if(h=n,typeof n=="function")Sd(n)&&(T=1);else if(typeof n=="string")T=5;else e:switch(n){case O:return ai(a.children,v,x,s);case P:T=8,v|=8;break;case D:return n=On(12,a,s,v|2),n.elementType=D,n.lanes=x,n;case z:return n=On(13,a,s,v),n.elementType=z,n.lanes=x,n;case C:return n=On(19,a,s,v),n.elementType=C,n.lanes=x,n;case re:return Dl(a,v,x,s);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case L:T=10;break e;case U:T=9;break e;case V:T=11;break e;case F:T=14;break e;case $:T=16,h=null;break e}throw Error(r(130,n==null?n:typeof n,""))}return s=On(T,a,s,v),s.elementType=n,s.type=h,s.lanes=x,s}function ai(n,s,a,h){return n=On(7,n,h,s),n.lanes=a,n}function Dl(n,s,a,h){return n=On(22,n,h,s),n.elementType=re,n.lanes=a,n.stateNode={isHidden:!1},n}function kd(n,s,a){return n=On(6,n,null,s),n.lanes=a,n}function Ed(n,s,a){return s=On(4,n.children!==null?n.children:[],n.key,s),s.lanes=a,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}function aR(n,s,a,h,v){this.tag=s,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=or(0),this.expirationTimes=or(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=or(0),this.identifierPrefix=h,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Nd(n,s,a,h,v,x,T,B,X){return n=new aR(n,s,a,B,X),s===1?(s=1,x===!0&&(s|=8)):s=0,x=On(3,null,null,s),n.current=x,x.stateNode=n,x.memoizedState={element:h,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Dc(x),n}function lR(n,s,a){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:M,key:h==null?null:""+h,children:n,containerInfo:s,implementation:a}}function $w(n){if(!n)return hs;n=n._reactInternals;e:{if(En(n)!==n||n.tag!==1)throw Error(r(170));var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(sn(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(n.tag===1){var a=n.type;if(sn(a))return d0(n,a,s)}return s}function qw(n,s,a,h,v,x,T,B,X){return n=Nd(a,h,!0,n,v,x,T,B,X),n.context=$w(null),a=n.current,h=en(),v=xs(a),x=Or(h,v),x.callback=s??null,gs(a,x,v),n.current.lanes=v,es(n,v,h),ln(n,h),n}function Fl(n,s,a,h){var v=s.current,x=en(),T=xs(v);return a=$w(a),s.context===null?s.context=a:s.pendingContext=a,s=Or(x,T),s.payload={element:n},h=h===void 0?null:h,h!==null&&(s.callback=h),n=gs(v,s,T),n!==null&&(Xn(n,v,T,x),vl(n,v,T)),T}function zl(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function Dw(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var a=n.retryLane;n.retryLane=a!==0&&a<s?a:s}}function Cd(n,s){Dw(n,s),(n=n.alternate)&&Dw(n,s)}function uR(){return null}var Fw=typeof reportError=="function"?reportError:function(n){console.error(n)};function jd(n){this._internalRoot=n}Bl.prototype.render=jd.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(r(409));Fl(n,s,null,null)},Bl.prototype.unmount=jd.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;si(function(){Fl(null,n,null,null)}),s[Tr]=null}};function Bl(n){this._internalRoot=n}Bl.prototype.unstable_scheduleHydration=function(n){if(n){var s=kr();n={blockedOn:null,target:n,priority:s};for(var a=0;a<Hn.length&&s!==0&&s<Hn[a].priority;a++);Hn.splice(a,0,n),a===0&&Ci(n)}};function Td(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function Ul(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function zw(){}function cR(n,s,a,h,v){if(v){if(typeof h=="function"){var x=h;h=function(){var le=zl(T);x.call(le)}}var T=qw(s,h,n,0,null,!1,!1,"",zw);return n._reactRootContainer=T,n[Tr]=T.current,Fo(n.nodeType===8?n.parentNode:n),si(),T}for(;v=n.lastChild;)n.removeChild(v);if(typeof h=="function"){var B=h;h=function(){var le=zl(X);B.call(le)}}var X=Nd(n,0,!1,null,null,!1,!1,"",zw);return n._reactRootContainer=X,n[Tr]=X.current,Fo(n.nodeType===8?n.parentNode:n),si(function(){Fl(s,X,a,h)}),X}function Hl(n,s,a,h,v){var x=a._reactRootContainer;if(x){var T=x;if(typeof v=="function"){var B=v;v=function(){var X=zl(T);B.call(X)}}Fl(s,T,n,v)}else T=cR(a,s,n,v,h);return zl(T)}Xt=function(n){switch(n.tag){case 3:var s=n.stateNode;if(s.current.memoizedState.isDehydrated){var a=gn(s.pendingLanes);a!==0&&(Ei(s,a|1),ln(s,nt()),(Ue&6)===0&&(Ki=nt()+500,ps()))}break;case 13:si(function(){var h=Mr(n,1);if(h!==null){var v=en();Xn(h,n,1,v)}}),Cd(n,1)}},jo=function(n){if(n.tag===13){var s=Mr(n,134217728);if(s!==null){var a=en();Xn(s,n,134217728,a)}Cd(n,134217728)}},Ni=function(n){if(n.tag===13){var s=xs(n),a=Mr(n,s);if(a!==null){var h=en();Xn(a,n,s,h)}Cd(n,s)}},kr=function(){return He},ts=function(n,s){var a=He;try{return He=n,s()}finally{He=a}},Sn=function(n,s,a){switch(s){case"input":if(we(n,a),s=a.name,a.type==="radio"&&s!=null){for(a=n;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<a.length;s++){var h=a[s];if(h!==n&&h.form===n.form){var v=al(h);if(!v)throw Error(r(90));ve(h),we(h,v)}}}break;case"textarea":Je(n,a);break;case"select":s=a.value,s!=null&&ft(n,!!a.multiple,s,!1)}},xi=xd,Wr=si;var dR={usingClientEntryPoint:!1,Events:[Uo,Li,al,vr,Hr,xd]},ra={findFiberByHostInstance:Xs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},fR={bundleType:ra.bundleType,version:ra.version,rendererPackageName:ra.rendererPackageName,rendererConfig:ra.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:j.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=Tt(n),n===null?null:n.stateNode},findFiberByHostInstance:ra.findFiberByHostInstance||uR,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 Wl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wl.isDisabled&&Wl.supportsFiber)try{ir=Wl.inject(fR),St=Wl}catch{}}return un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=dR,un.createPortal=function(n,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Td(s))throw Error(r(200));return lR(n,s,null,a)},un.createRoot=function(n,s){if(!Td(n))throw Error(r(299));var a=!1,h="",v=Fw;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(h=s.identifierPrefix),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=Nd(n,1,!1,null,null,a,!1,h,v),n[Tr]=s.current,Fo(n.nodeType===8?n.parentNode:n),new jd(s)},un.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var s=n._reactInternals;if(s===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=Tt(s),n=n===null?null:n.stateNode,n},un.flushSync=function(n){return si(n)},un.hydrate=function(n,s,a){if(!Ul(s))throw Error(r(200));return Hl(null,n,s,!0,a)},un.hydrateRoot=function(n,s,a){if(!Td(n))throw Error(r(405));var h=a!=null&&a.hydratedSources||null,v=!1,x="",T=Fw;if(a!=null&&(a.unstable_strictMode===!0&&(v=!0),a.identifierPrefix!==void 0&&(x=a.identifierPrefix),a.onRecoverableError!==void 0&&(T=a.onRecoverableError)),s=qw(s,null,n,1,a??null,v,!1,x,T),n[Tr]=s.current,Fo(n),h)for(n=0;n<h.length;n++)a=h[n],v=a._getVersion,v=v(a._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[a,v]:s.mutableSourceEagerHydrationData.push(a,v);return new Bl(s)},un.render=function(n,s,a){if(!Ul(s))throw Error(r(200));return Hl(null,n,s,!1,a)},un.unmountComponentAtNode=function(n){if(!Ul(n))throw Error(r(40));return n._reactRootContainer?(si(function(){Hl(null,null,n,!1,function(){n._reactRootContainer=null,n[Tr]=null})}),!0):!1},un.unstable_batchedUpdates=xd,un.unstable_renderSubtreeIntoContainer=function(n,s,a,h){if(!Ul(a))throw Error(r(200));if(n==null||n._reactInternals===void 0)throw Error(r(38));return Hl(n,s,a,!1,h)},un.version="18.3.1-next-f1338f8080-20240426",un}var Kw;function rN(){if(Kw)return Id.exports;Kw=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(),Id.exports=wR(),Id.exports}var Xw;function xR(){if(Xw)return Gl;Xw=1;var e=rN();return Gl.createRoot=e.createRoot,Gl.hydrateRoot=e.hydrateRoot,Gl}var _R=xR(),R=Ta();const ue=Hv(R);function Ft(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,i;r<e.length;r++)(i=Ft(e[r]))!==""&&(t+=(t&&" ")+i);else for(let r in e)e[r]&&(t+=(t&&" ")+r);return t}var Pd={exports:{}},Ld={},$d={exports:{}},qd={};/**
|
|
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 Qw;function bR(){if(Qw)return qd;Qw=1;var e=Ta();function t(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var r=typeof Object.is=="function"?Object.is:t,i=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function c(m,y){var w=y(),E=i({inst:{value:w,getSnapshot:y}}),_=E[0].inst,b=E[1];return l(function(){_.value=w,_.getSnapshot=y,f(_)&&b({inst:_})},[m,w,y]),o(function(){return f(_)&&b({inst:_}),m(function(){f(_)&&b({inst:_})})},[m]),u(w),w}function f(m){var y=m.getSnapshot;m=m.value;try{var w=y();return!r(m,w)}catch{return!0}}function p(m,y){return y()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:c;return qd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,qd}var Zw;function SR(){return Zw||(Zw=1,$d.exports=bR()),$d.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 Jw;function kR(){if(Jw)return Ld;Jw=1;var e=Ta(),t=SR();function r(p,d){return p===d&&(p!==0||1/p===1/d)||p!==p&&d!==d}var i=typeof Object.is=="function"?Object.is:r,o=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,c=e.useMemo,f=e.useDebugValue;return Ld.useSyncExternalStoreWithSelector=function(p,d,m,y,w){var E=l(null);if(E.current===null){var _={hasValue:!1,value:null};E.current=_}else _=E.current;E=c(function(){function S(M){if(!k){if(k=!0,N=M,M=y(M),w!==void 0&&_.hasValue){var O=_.value;if(w(O,M))return j=O}return j=M}if(O=j,i(N,M))return O;var P=y(M);return w!==void 0&&w(O,P)?(N=M,O):(N=M,j=P)}var k=!1,N,j,A=m===void 0?null:m;return[function(){return S(d())},A===null?void 0:function(){return S(A())}]},[d,m,y,w]);var b=o(p,E[0],E[1]);return u(function(){_.hasValue=!0,_.value=b},[b]),f(b),b},Ld}var ex;function ER(){return ex||(ex=1,Pd.exports=kR()),Pd.exports}var NR=ER();const CR=Hv(NR),jR={},tx=e=>{let t;const r=new Set,i=(d,m)=>{const y=typeof d=="function"?d(t):d;if(!Object.is(y,t)){const w=t;t=m??(typeof y!="object"||y===null)?y:Object.assign({},t,y),r.forEach(E=>E(t,w))}},o=()=>t,f={setState:i,getState:o,getInitialState:()=>p,subscribe:d=>(r.add(d),()=>r.delete(d)),destroy:()=>{(jR?"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."),r.clear()}},p=t=e(i,o,f);return f},TR=e=>e?tx(e):tx,{useDebugValue:RR}=ue,{useSyncExternalStoreWithSelector:AR}=CR,IR=e=>e;function sN(e,t=IR,r){const i=AR(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return RR(i),i}const nx=(e,t)=>{const r=TR(e),i=(o,l=t)=>sN(r,o,l);return Object.assign(i,r),i},MR=(e,t)=>e?nx(e,t):nx;function Ct(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[i,o]of e)if(!Object.is(o,t.get(i)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const i of r)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}var OR={value:()=>{}};function Iu(){for(var e=0,t=arguments.length,r={},i;e<t;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new du(r)}function du(e){this._=e}function PR(e,t){return e.trim().split(/^|\s+/).map(function(r){var i="",o=r.indexOf(".");if(o>=0&&(i=r.slice(o+1),r=r.slice(0,o)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}du.prototype=Iu.prototype={constructor:du,on:function(e,t){var r=this._,i=PR(e+"",r),o,l=-1,u=i.length;if(arguments.length<2){for(;++l<u;)if((o=(e=i[l]).type)&&(o=LR(r[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<u;)if(o=(e=i[l]).type)r[o]=rx(r[o],e.name,t);else if(t==null)for(o in r)r[o]=rx(r[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new du(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var r=new Array(o),i=0,o,l;i<o;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,o=l.length;i<o;++i)l[i].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],o=0,l=i.length;o<l;++o)i[o].value.apply(t,r)}};function LR(e,t){for(var r=0,i=e.length,o;r<i;++r)if((o=e[r]).name===t)return o.value}function rx(e,t,r){for(var i=0,o=e.length;i<o;++i)if(e[i].name===t){e[i]=OR,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:t,value:r}),e}var wv="http://www.w3.org/1999/xhtml";const sx={svg:"http://www.w3.org/2000/svg",xhtml:wv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Mu(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),sx.hasOwnProperty(t)?{space:sx[t],local:e}:e}function $R(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===wv&&t.documentElement.namespaceURI===wv?t.createElement(e):t.createElementNS(r,e)}}function qR(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function iN(e){var t=Mu(e);return(t.local?qR:$R)(t)}function DR(){}function Wv(e){return e==null?DR:function(){return this.querySelector(e)}}function FR(e){typeof e!="function"&&(e=Wv(e));for(var t=this._groups,r=t.length,i=new Array(r),o=0;o<r;++o)for(var l=t[o],u=l.length,c=i[o]=new Array(u),f,p,d=0;d<u;++d)(f=l[d])&&(p=e.call(f,f.__data__,d,l))&&("__data__"in f&&(p.__data__=f.__data__),c[d]=p);return new _n(i,this._parents)}function zR(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function BR(){return[]}function oN(e){return e==null?BR:function(){return this.querySelectorAll(e)}}function UR(e){return function(){return zR(e.apply(this,arguments))}}function HR(e){typeof e=="function"?e=UR(e):e=oN(e);for(var t=this._groups,r=t.length,i=[],o=[],l=0;l<r;++l)for(var u=t[l],c=u.length,f,p=0;p<c;++p)(f=u[p])&&(i.push(e.call(f,f.__data__,p,u)),o.push(f));return new _n(i,o)}function aN(e){return function(){return this.matches(e)}}function lN(e){return function(t){return t.matches(e)}}var WR=Array.prototype.find;function VR(e){return function(){return WR.call(this.children,e)}}function GR(){return this.firstElementChild}function YR(e){return this.select(e==null?GR:VR(typeof e=="function"?e:lN(e)))}var KR=Array.prototype.filter;function XR(){return Array.from(this.children)}function QR(e){return function(){return KR.call(this.children,e)}}function ZR(e){return this.selectAll(e==null?XR:QR(typeof e=="function"?e:lN(e)))}function JR(e){typeof e!="function"&&(e=aN(e));for(var t=this._groups,r=t.length,i=new Array(r),o=0;o<r;++o)for(var l=t[o],u=l.length,c=i[o]=[],f,p=0;p<u;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&c.push(f);return new _n(i,this._parents)}function uN(e){return new Array(e.length)}function eA(){return new _n(this._enter||this._groups.map(uN),this._parents)}function vu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}vu.prototype={constructor:vu,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 tA(e){return function(){return e}}function nA(e,t,r,i,o,l){for(var u=0,c,f=t.length,p=l.length;u<p;++u)(c=t[u])?(c.__data__=l[u],i[u]=c):r[u]=new vu(e,l[u]);for(;u<f;++u)(c=t[u])&&(o[u]=c)}function rA(e,t,r,i,o,l,u){var c,f,p=new Map,d=t.length,m=l.length,y=new Array(d),w;for(c=0;c<d;++c)(f=t[c])&&(y[c]=w=u.call(f,f.__data__,c,t)+"",p.has(w)?o[c]=f:p.set(w,f));for(c=0;c<m;++c)w=u.call(e,l[c],c,l)+"",(f=p.get(w))?(i[c]=f,f.__data__=l[c],p.delete(w)):r[c]=new vu(e,l[c]);for(c=0;c<d;++c)(f=t[c])&&p.get(y[c])===f&&(o[c]=f)}function sA(e){return e.__data__}function iA(e,t){if(!arguments.length)return Array.from(this,sA);var r=t?rA:nA,i=this._parents,o=this._groups;typeof e!="function"&&(e=tA(e));for(var l=o.length,u=new Array(l),c=new Array(l),f=new Array(l),p=0;p<l;++p){var d=i[p],m=o[p],y=m.length,w=oA(e.call(d,d&&d.__data__,p,i)),E=w.length,_=c[p]=new Array(E),b=u[p]=new Array(E),S=f[p]=new Array(y);r(d,m,_,b,S,w,t);for(var k=0,N=0,j,A;k<E;++k)if(j=_[k]){for(k>=N&&(N=k+1);!(A=b[N])&&++N<E;);j._next=A||null}}return u=new _n(u,i),u._enter=c,u._exit=f,u}function oA(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function aA(){return new _n(this._exit||this._groups.map(uN),this._parents)}function lA(e,t,r){var i=this.enter(),o=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),r==null?l.remove():r(l),i&&o?i.merge(o).order():o}function uA(e){for(var t=e.selection?e.selection():e,r=this._groups,i=t._groups,o=r.length,l=i.length,u=Math.min(o,l),c=new Array(o),f=0;f<u;++f)for(var p=r[f],d=i[f],m=p.length,y=c[f]=new Array(m),w,E=0;E<m;++E)(w=p[E]||d[E])&&(y[E]=w);for(;f<o;++f)c[f]=r[f];return new _n(c,this._parents)}function cA(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var i=e[t],o=i.length-1,l=i[o],u;--o>=0;)(u=i[o])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function dA(e){e||(e=fA);function t(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var r=this._groups,i=r.length,o=new Array(i),l=0;l<i;++l){for(var u=r[l],c=u.length,f=o[l]=new Array(c),p,d=0;d<c;++d)(p=u[d])&&(f[d]=p);f.sort(t)}return new _n(o,this._parents).order()}function fA(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function hA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pA(){return Array.from(this)}function mA(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var i=e[t],o=0,l=i.length;o<l;++o){var u=i[o];if(u)return u}return null}function gA(){let e=0;for(const t of this)++e;return e}function vA(){return!this.node()}function yA(e){for(var t=this._groups,r=0,i=t.length;r<i;++r)for(var o=t[r],l=0,u=o.length,c;l<u;++l)(c=o[l])&&e.call(c,c.__data__,l,o);return this}function wA(e){return function(){this.removeAttribute(e)}}function xA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _A(e,t){return function(){this.setAttribute(e,t)}}function bA(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function SA(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function kA(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function EA(e,t){var r=Mu(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((t==null?r.local?xA:wA:typeof t=="function"?r.local?kA:SA:r.local?bA:_A)(r,t))}function cN(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function NA(e){return function(){this.style.removeProperty(e)}}function CA(e,t,r){return function(){this.style.setProperty(e,t,r)}}function jA(e,t,r){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function TA(e,t,r){return arguments.length>1?this.each((t==null?NA:typeof t=="function"?jA:CA)(e,t,r??"")):fo(this.node(),e)}function fo(e,t){return e.style.getPropertyValue(t)||cN(e).getComputedStyle(e,null).getPropertyValue(t)}function RA(e){return function(){delete this[e]}}function AA(e,t){return function(){this[e]=t}}function IA(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function MA(e,t){return arguments.length>1?this.each((t==null?RA:typeof t=="function"?IA:AA)(e,t)):this.node()[e]}function dN(e){return e.trim().split(/^|\s+/)}function Vv(e){return e.classList||new fN(e)}function fN(e){this._node=e,this._names=dN(e.getAttribute("class")||"")}fN.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 hN(e,t){for(var r=Vv(e),i=-1,o=t.length;++i<o;)r.add(t[i])}function pN(e,t){for(var r=Vv(e),i=-1,o=t.length;++i<o;)r.remove(t[i])}function OA(e){return function(){hN(this,e)}}function PA(e){return function(){pN(this,e)}}function LA(e,t){return function(){(t.apply(this,arguments)?hN:pN)(this,e)}}function $A(e,t){var r=dN(e+"");if(arguments.length<2){for(var i=Vv(this.node()),o=-1,l=r.length;++o<l;)if(!i.contains(r[o]))return!1;return!0}return this.each((typeof t=="function"?LA:t?OA:PA)(r,t))}function qA(){this.textContent=""}function DA(e){return function(){this.textContent=e}}function FA(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function zA(e){return arguments.length?this.each(e==null?qA:(typeof e=="function"?FA:DA)(e)):this.node().textContent}function BA(){this.innerHTML=""}function UA(e){return function(){this.innerHTML=e}}function HA(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function WA(e){return arguments.length?this.each(e==null?BA:(typeof e=="function"?HA:UA)(e)):this.node().innerHTML}function VA(){this.nextSibling&&this.parentNode.appendChild(this)}function GA(){return this.each(VA)}function YA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function KA(){return this.each(YA)}function XA(e){var t=typeof e=="function"?e:iN(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function QA(){return null}function ZA(e,t){var r=typeof e=="function"?e:iN(e),i=t==null?QA:typeof t=="function"?t:Wv(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function JA(){var e=this.parentNode;e&&e.removeChild(this)}function e2(){return this.each(JA)}function t2(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function n2(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function r2(e){return this.select(e?n2:t2)}function s2(e){return arguments.length?this.property("__data__",e):this.node().__data__}function i2(e){return function(t){e.call(this,t,this.__data__)}}function o2(e){return e.trim().split(/^|\s+/).map(function(t){var r="",i=t.indexOf(".");return i>=0&&(r=t.slice(i+1),t=t.slice(0,i)),{type:t,name:r}})}function a2(e){return function(){var t=this.__on;if(t){for(var r=0,i=-1,o=t.length,l;r<o;++r)l=t[r],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++i]=l;++i?t.length=i:delete this.__on}}}function l2(e,t,r){return function(){var i=this.__on,o,l=i2(t);if(i){for(var u=0,c=i.length;u<c;++u)if((o=i[u]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=l,o.options=r),o.value=t;return}}this.addEventListener(e.type,l,r),o={type:e.type,name:e.name,value:t,listener:l,options:r},i?i.push(o):this.__on=[o]}}function u2(e,t,r){var i=o2(e+""),o,l=i.length,u;if(arguments.length<2){var c=this.node().__on;if(c){for(var f=0,p=c.length,d;f<p;++f)for(o=0,d=c[f];o<l;++o)if((u=i[o]).type===d.type&&u.name===d.name)return d.value}return}for(c=t?l2:a2,o=0;o<l;++o)this.each(c(i[o],t,r));return this}function mN(e,t,r){var i=cN(e),o=i.CustomEvent;typeof o=="function"?o=new o(t,r):(o=i.document.createEvent("Event"),r?(o.initEvent(t,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function c2(e,t){return function(){return mN(this,e,t)}}function d2(e,t){return function(){return mN(this,e,t.apply(this,arguments))}}function f2(e,t){return this.each((typeof t=="function"?d2:c2)(e,t))}function*h2(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var i=e[t],o=0,l=i.length,u;o<l;++o)(u=i[o])&&(yield u)}var gN=[null];function _n(e,t){this._groups=e,this._parents=t}function Ra(){return new _n([[document.documentElement]],gN)}function p2(){return this}_n.prototype=Ra.prototype={constructor:_n,select:FR,selectAll:HR,selectChild:YR,selectChildren:ZR,filter:JR,data:iA,enter:eA,exit:aA,join:lA,merge:uA,selection:p2,order:cA,sort:dA,call:hA,nodes:pA,node:mA,size:gA,empty:vA,each:yA,attr:EA,style:TA,property:MA,classed:$A,text:zA,html:WA,raise:GA,lower:KA,append:XA,insert:ZA,remove:e2,clone:r2,datum:s2,on:u2,dispatch:f2,[Symbol.iterator]:h2};function Ln(e){return typeof e=="string"?new _n([[document.querySelector(e)]],[document.documentElement]):new _n([[e]],gN)}function m2(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Zn(e,t){if(e=m2(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const g2={passive:!1},wa={capture:!0,passive:!1};function Dd(e){e.stopImmediatePropagation()}function ao(e){e.preventDefault(),e.stopImmediatePropagation()}function vN(e){var t=e.document.documentElement,r=Ln(e).on("dragstart.drag",ao,wa);"onselectstart"in t?r.on("selectstart.drag",ao,wa):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function yN(e,t){var r=e.document.documentElement,i=Ln(e).on("dragstart.drag",null);t&&(i.on("click.drag",ao,wa),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in r?i.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const Yl=e=>()=>e;function xv(e,{sourceEvent:t,subject:r,target:i,identifier:o,active:l,x:u,y:c,dx:f,dy:p,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:d}})}xv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function v2(e){return!e.ctrlKey&&!e.button}function y2(){return this.parentNode}function w2(e,t){return t??{x:e.x,y:e.y}}function x2(){return navigator.maxTouchPoints||"ontouchstart"in this}function _2(){var e=v2,t=y2,r=w2,i=x2,o={},l=Iu("start","drag","end"),u=0,c,f,p,d,m=0;function y(j){j.on("mousedown.drag",w).filter(i).on("touchstart.drag",b).on("touchmove.drag",S,g2).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(j,A){if(!(d||!e.call(this,j,A))){var M=N(this,t.call(this,j,A),j,A,"mouse");M&&(Ln(j.view).on("mousemove.drag",E,wa).on("mouseup.drag",_,wa),vN(j.view),Dd(j),p=!1,c=j.clientX,f=j.clientY,M("start",j))}}function E(j){if(ao(j),!p){var A=j.clientX-c,M=j.clientY-f;p=A*A+M*M>m}o.mouse("drag",j)}function _(j){Ln(j.view).on("mousemove.drag mouseup.drag",null),yN(j.view,p),ao(j),o.mouse("end",j)}function b(j,A){if(e.call(this,j,A)){var M=j.changedTouches,O=t.call(this,j,A),P=M.length,D,L;for(D=0;D<P;++D)(L=N(this,O,j,A,M[D].identifier,M[D]))&&(Dd(j),L("start",j,M[D]))}}function S(j){var A=j.changedTouches,M=A.length,O,P;for(O=0;O<M;++O)(P=o[A[O].identifier])&&(ao(j),P("drag",j,A[O]))}function k(j){var A=j.changedTouches,M=A.length,O,P;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),O=0;O<M;++O)(P=o[A[O].identifier])&&(Dd(j),P("end",j,A[O]))}function N(j,A,M,O,P,D){var L=l.copy(),U=Zn(D||M,A),V,z,C;if((C=r.call(j,new xv("beforestart",{sourceEvent:M,target:y,identifier:P,active:u,x:U[0],y:U[1],dx:0,dy:0,dispatch:L}),O))!=null)return V=C.x-U[0]||0,z=C.y-U[1]||0,function F($,re,J){var W=U,Z;switch($){case"start":o[P]=F,Z=u++;break;case"end":delete o[P],--u;case"drag":U=Zn(J||re,A),Z=u;break}L.call($,j,new xv($,{sourceEvent:re,subject:C,target:y,identifier:P,active:Z,x:U[0]+V,y:U[1]+z,dx:U[0]-W[0],dy:U[1]-W[1],dispatch:L}),O)}}return y.filter=function(j){return arguments.length?(e=typeof j=="function"?j:Yl(!!j),y):e},y.container=function(j){return arguments.length?(t=typeof j=="function"?j:Yl(j),y):t},y.subject=function(j){return arguments.length?(r=typeof j=="function"?j:Yl(j),y):r},y.touchable=function(j){return arguments.length?(i=typeof j=="function"?j:Yl(!!j),y):i},y.on=function(){var j=l.on.apply(l,arguments);return j===l?y:j},y.clickDistance=function(j){return arguments.length?(m=(j=+j)*j,y):Math.sqrt(m)},y}function Gv(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function wN(e,t){var r=Object.create(e.prototype);for(var i in t)r[i]=t[i];return r}function Aa(){}var xa=.7,yu=1/xa,lo="\\s*([+-]?\\d+)\\s*",_a="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",hr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",b2=/^#([0-9a-f]{3,8})$/,S2=new RegExp(`^rgb\\(${lo},${lo},${lo}\\)$`),k2=new RegExp(`^rgb\\(${hr},${hr},${hr}\\)$`),E2=new RegExp(`^rgba\\(${lo},${lo},${lo},${_a}\\)$`),N2=new RegExp(`^rgba\\(${hr},${hr},${hr},${_a}\\)$`),C2=new RegExp(`^hsl\\(${_a},${hr},${hr}\\)$`),j2=new RegExp(`^hsla\\(${_a},${hr},${hr},${_a}\\)$`),ix={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};Gv(Aa,ba,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ox,formatHex:ox,formatHex8:T2,formatHsl:R2,formatRgb:ax,toString:ax});function ox(){return this.rgb().formatHex()}function T2(){return this.rgb().formatHex8()}function R2(){return xN(this).formatHsl()}function ax(){return this.rgb().formatRgb()}function ba(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=b2.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?lx(t):r===3?new cn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Kl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Kl(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=S2.exec(e))?new cn(t[1],t[2],t[3],1):(t=k2.exec(e))?new cn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=E2.exec(e))?Kl(t[1],t[2],t[3],t[4]):(t=N2.exec(e))?Kl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=C2.exec(e))?dx(t[1],t[2]/100,t[3]/100,1):(t=j2.exec(e))?dx(t[1],t[2]/100,t[3]/100,t[4]):ix.hasOwnProperty(e)?lx(ix[e]):e==="transparent"?new cn(NaN,NaN,NaN,0):null}function lx(e){return new cn(e>>16&255,e>>8&255,e&255,1)}function Kl(e,t,r,i){return i<=0&&(e=t=r=NaN),new cn(e,t,r,i)}function A2(e){return e instanceof Aa||(e=ba(e)),e?(e=e.rgb(),new cn(e.r,e.g,e.b,e.opacity)):new cn}function _v(e,t,r,i){return arguments.length===1?A2(e):new cn(e,t,r,i??1)}function cn(e,t,r,i){this.r=+e,this.g=+t,this.b=+r,this.opacity=+i}Gv(cn,_v,wN(Aa,{brighter(e){return e=e==null?yu:Math.pow(yu,e),new cn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?xa:Math.pow(xa,e),new cn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new cn(fi(this.r),fi(this.g),fi(this.b),wu(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:ux,formatHex:ux,formatHex8:I2,formatRgb:cx,toString:cx}));function ux(){return`#${ci(this.r)}${ci(this.g)}${ci(this.b)}`}function I2(){return`#${ci(this.r)}${ci(this.g)}${ci(this.b)}${ci((isNaN(this.opacity)?1:this.opacity)*255)}`}function cx(){const e=wu(this.opacity);return`${e===1?"rgb(":"rgba("}${fi(this.r)}, ${fi(this.g)}, ${fi(this.b)}${e===1?")":`, ${e})`}`}function wu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function fi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ci(e){return e=fi(e),(e<16?"0":"")+e.toString(16)}function dx(e,t,r,i){return i<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Jn(e,t,r,i)}function xN(e){if(e instanceof Jn)return new Jn(e.h,e.s,e.l,e.opacity);if(e instanceof Aa||(e=ba(e)),!e)return new Jn;if(e instanceof Jn)return e;e=e.rgb();var t=e.r/255,r=e.g/255,i=e.b/255,o=Math.min(t,r,i),l=Math.max(t,r,i),u=NaN,c=l-o,f=(l+o)/2;return c?(t===l?u=(r-i)/c+(r<i)*6:r===l?u=(i-t)/c+2:u=(t-r)/c+4,c/=f<.5?l+o:2-l-o,u*=60):c=f>0&&f<1?0:u,new Jn(u,c,f,e.opacity)}function M2(e,t,r,i){return arguments.length===1?xN(e):new Jn(e,t,r,i??1)}function Jn(e,t,r,i){this.h=+e,this.s=+t,this.l=+r,this.opacity=+i}Gv(Jn,M2,wN(Aa,{brighter(e){return e=e==null?yu:Math.pow(yu,e),new Jn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?xa:Math.pow(xa,e),new Jn(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,r=this.l,i=r+(r<.5?r:1-r)*t,o=2*r-i;return new cn(Fd(e>=240?e-240:e+120,o,i),Fd(e,o,i),Fd(e<120?e+240:e-120,o,i),this.opacity)},clamp(){return new Jn(fx(this.h),Xl(this.s),Xl(this.l),wu(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=wu(this.opacity);return`${e===1?"hsl(":"hsla("}${fx(this.h)}, ${Xl(this.s)*100}%, ${Xl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function fx(e){return e=(e||0)%360,e<0?e+360:e}function Xl(e){return Math.max(0,Math.min(1,e||0))}function Fd(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const _N=e=>()=>e;function O2(e,t){return function(r){return e+r*t}}function P2(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(i){return Math.pow(e+i*t,r)}}function L2(e){return(e=+e)==1?bN:function(t,r){return r-t?P2(t,r,e):_N(isNaN(t)?r:t)}}function bN(e,t){var r=t-e;return r?O2(e,r):_N(isNaN(e)?t:e)}const hx=(function e(t){var r=L2(t);function i(o,l){var u=r((o=_v(o)).r,(l=_v(l)).r),c=r(o.g,l.g),f=r(o.b,l.b),p=bN(o.opacity,l.opacity);return function(d){return o.r=u(d),o.g=c(d),o.b=f(d),o.opacity=p(d),o+""}}return i.gamma=e,i})(1);function Es(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var bv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zd=new RegExp(bv.source,"g");function $2(e){return function(){return e}}function q2(e){return function(t){return e(t)+""}}function D2(e,t){var r=bv.lastIndex=zd.lastIndex=0,i,o,l,u=-1,c=[],f=[];for(e=e+"",t=t+"";(i=bv.exec(e))&&(o=zd.exec(t));)(l=o.index)>r&&(l=t.slice(r,l),c[u]?c[u]+=l:c[++u]=l),(i=i[0])===(o=o[0])?c[u]?c[u]+=o:c[++u]=o:(c[++u]=null,f.push({i:u,x:Es(i,o)})),r=zd.lastIndex;return r<t.length&&(l=t.slice(r),c[u]?c[u]+=l:c[++u]=l),c.length<2?f[0]?q2(f[0].x):$2(t):(t=f.length,function(p){for(var d=0,m;d<t;++d)c[(m=f[d]).i]=m.x(p);return c.join("")})}var px=180/Math.PI,Sv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function SN(e,t,r,i,o,l){var u,c,f;return(u=Math.sqrt(e*e+t*t))&&(e/=u,t/=u),(f=e*r+t*i)&&(r-=e*f,i-=t*f),(c=Math.sqrt(r*r+i*i))&&(r/=c,i/=c,f/=c),e*i<t*r&&(e=-e,t=-t,f=-f,u=-u),{translateX:o,translateY:l,rotate:Math.atan2(t,e)*px,skewX:Math.atan(f)*px,scaleX:u,scaleY:c}}var Ql;function F2(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Sv:SN(t.a,t.b,t.c,t.d,t.e,t.f)}function z2(e){return e==null||(Ql||(Ql=document.createElementNS("http://www.w3.org/2000/svg","g")),Ql.setAttribute("transform",e),!(e=Ql.transform.baseVal.consolidate()))?Sv:(e=e.matrix,SN(e.a,e.b,e.c,e.d,e.e,e.f))}function kN(e,t,r,i){function o(p){return p.length?p.pop()+" ":""}function l(p,d,m,y,w,E){if(p!==m||d!==y){var _=w.push("translate(",null,t,null,r);E.push({i:_-4,x:Es(p,m)},{i:_-2,x:Es(d,y)})}else(m||y)&&w.push("translate("+m+t+y+r)}function u(p,d,m,y){p!==d?(p-d>180?d+=360:d-p>180&&(p+=360),y.push({i:m.push(o(m)+"rotate(",null,i)-2,x:Es(p,d)})):d&&m.push(o(m)+"rotate("+d+i)}function c(p,d,m,y){p!==d?y.push({i:m.push(o(m)+"skewX(",null,i)-2,x:Es(p,d)}):d&&m.push(o(m)+"skewX("+d+i)}function f(p,d,m,y,w,E){if(p!==m||d!==y){var _=w.push(o(w)+"scale(",null,",",null,")");E.push({i:_-4,x:Es(p,m)},{i:_-2,x:Es(d,y)})}else(m!==1||y!==1)&&w.push(o(w)+"scale("+m+","+y+")")}return function(p,d){var m=[],y=[];return p=e(p),d=e(d),l(p.translateX,p.translateY,d.translateX,d.translateY,m,y),u(p.rotate,d.rotate,m,y),c(p.skewX,d.skewX,m,y),f(p.scaleX,p.scaleY,d.scaleX,d.scaleY,m,y),p=d=null,function(w){for(var E=-1,_=y.length,b;++E<_;)m[(b=y[E]).i]=b.x(w);return m.join("")}}}var B2=kN(F2,"px, ","px)","deg)"),U2=kN(z2,", ",")",")"),H2=1e-12;function mx(e){return((e=Math.exp(e))+1/e)/2}function W2(e){return((e=Math.exp(e))-1/e)/2}function V2(e){return((e=Math.exp(2*e))-1)/(e+1)}const G2=(function e(t,r,i){function o(l,u){var c=l[0],f=l[1],p=l[2],d=u[0],m=u[1],y=u[2],w=d-c,E=m-f,_=w*w+E*E,b,S;if(_<H2)S=Math.log(y/p)/t,b=function(O){return[c+O*w,f+O*E,p*Math.exp(t*O*S)]};else{var k=Math.sqrt(_),N=(y*y-p*p+i*_)/(2*p*r*k),j=(y*y-p*p-i*_)/(2*y*r*k),A=Math.log(Math.sqrt(N*N+1)-N),M=Math.log(Math.sqrt(j*j+1)-j);S=(M-A)/t,b=function(O){var P=O*S,D=mx(A),L=p/(r*k)*(D*V2(t*P+A)-W2(A));return[c+L*w,f+L*E,p*D/mx(t*P+A)]}}return b.duration=S*1e3*t/Math.SQRT2,b}return o.rho=function(l){var u=Math.max(.001,+l),c=u*u,f=c*c;return e(u,c,f)},o})(Math.SQRT2,2,4);var ho=0,ha=0,ia=0,EN=1e3,xu,pa,_u=0,pi=0,Ou=0,Sa=typeof performance=="object"&&performance.now?performance:Date,NN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Yv(){return pi||(NN(Y2),pi=Sa.now()+Ou)}function Y2(){pi=0}function bu(){this._call=this._time=this._next=null}bu.prototype=CN.prototype={constructor:bu,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Yv():+r)+(t==null?0:+t),!this._next&&pa!==this&&(pa?pa._next=this:xu=this,pa=this),this._call=e,this._time=r,kv()},stop:function(){this._call&&(this._call=null,this._time=1/0,kv())}};function CN(e,t,r){var i=new bu;return i.restart(e,t,r),i}function K2(){Yv(),++ho;for(var e=xu,t;e;)(t=pi-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ho}function gx(){pi=(_u=Sa.now())+Ou,ho=ha=0;try{K2()}finally{ho=0,Q2(),pi=0}}function X2(){var e=Sa.now(),t=e-_u;t>EN&&(Ou-=t,_u=e)}function Q2(){for(var e,t=xu,r,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:xu=r);pa=e,kv(i)}function kv(e){if(!ho){ha&&(ha=clearTimeout(ha));var t=e-pi;t>24?(e<1/0&&(ha=setTimeout(gx,e-Sa.now()-Ou)),ia&&(ia=clearInterval(ia))):(ia||(_u=Sa.now(),ia=setInterval(X2,EN)),ho=1,NN(gx))}}function vx(e,t,r){var i=new bu;return t=t==null?0:+t,i.restart(o=>{i.stop(),e(o+t)},t,r),i}var Z2=Iu("start","end","cancel","interrupt"),J2=[],jN=0,yx=1,Ev=2,fu=3,wx=4,Nv=5,hu=6;function Pu(e,t,r,i,o,l){var u=e.__transition;if(!u)e.__transition={};else if(r in u)return;eI(e,r,{name:t,index:i,group:o,on:Z2,tween:J2,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:jN})}function Kv(e,t){var r=nr(e,t);if(r.state>jN)throw new Error("too late; already scheduled");return r}function pr(e,t){var r=nr(e,t);if(r.state>fu)throw new Error("too late; already running");return r}function nr(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function eI(e,t,r){var i=e.__transition,o;i[t]=r,r.timer=CN(l,0,r.time);function l(p){r.state=yx,r.timer.restart(u,r.delay,r.time),r.delay<=p&&u(p-r.delay)}function u(p){var d,m,y,w;if(r.state!==yx)return f();for(d in i)if(w=i[d],w.name===r.name){if(w.state===fu)return vx(u);w.state===wx?(w.state=hu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete i[d]):+d<t&&(w.state=hu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete i[d])}if(vx(function(){r.state===fu&&(r.state=wx,r.timer.restart(c,r.delay,r.time),c(p))}),r.state=Ev,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Ev){for(r.state=fu,o=new Array(y=r.tween.length),d=0,m=-1;d<y;++d)(w=r.tween[d].value.call(e,e.__data__,r.index,r.group))&&(o[++m]=w);o.length=m+1}}function c(p){for(var d=p<r.duration?r.ease.call(null,p/r.duration):(r.timer.restart(f),r.state=Nv,1),m=-1,y=o.length;++m<y;)o[m].call(e,d);r.state===Nv&&(r.on.call("end",e,e.__data__,r.index,r.group),f())}function f(){r.state=hu,r.timer.stop(),delete i[t];for(var p in i)return;delete e.__transition}}function pu(e,t){var r=e.__transition,i,o,l=!0,u;if(r){t=t==null?null:t+"";for(u in r){if((i=r[u]).name!==t){l=!1;continue}o=i.state>Ev&&i.state<Nv,i.state=hu,i.timer.stop(),i.on.call(o?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[u]}l&&delete e.__transition}}function tI(e){return this.each(function(){pu(this,e)})}function nI(e,t){var r,i;return function(){var o=pr(this,e),l=o.tween;if(l!==r){i=r=l;for(var u=0,c=i.length;u<c;++u)if(i[u].name===t){i=i.slice(),i.splice(u,1);break}}o.tween=i}}function rI(e,t,r){var i,o;if(typeof r!="function")throw new Error;return function(){var l=pr(this,e),u=l.tween;if(u!==i){o=(i=u).slice();for(var c={name:t,value:r},f=0,p=o.length;f<p;++f)if(o[f].name===t){o[f]=c;break}f===p&&o.push(c)}l.tween=o}}function sI(e,t){var r=this._id;if(e+="",arguments.length<2){for(var i=nr(this.node(),r).tween,o=0,l=i.length,u;o<l;++o)if((u=i[o]).name===e)return u.value;return null}return this.each((t==null?nI:rI)(r,e,t))}function Xv(e,t,r){var i=e._id;return e.each(function(){var o=pr(this,i);(o.value||(o.value={}))[t]=r.apply(this,arguments)}),function(o){return nr(o,i).value[t]}}function TN(e,t){var r;return(typeof t=="number"?Es:t instanceof ba?hx:(r=ba(t))?(t=r,hx):D2)(e,t)}function iI(e){return function(){this.removeAttribute(e)}}function oI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function aI(e,t,r){var i,o=r+"",l;return function(){var u=this.getAttribute(e);return u===o?null:u===i?l:l=t(i=u,r)}}function lI(e,t,r){var i,o=r+"",l;return function(){var u=this.getAttributeNS(e.space,e.local);return u===o?null:u===i?l:l=t(i=u,r)}}function uI(e,t,r){var i,o,l;return function(){var u,c=r(this),f;return c==null?void this.removeAttribute(e):(u=this.getAttribute(e),f=c+"",u===f?null:u===i&&f===o?l:(o=f,l=t(i=u,c)))}}function cI(e,t,r){var i,o,l;return function(){var u,c=r(this),f;return c==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),f=c+"",u===f?null:u===i&&f===o?l:(o=f,l=t(i=u,c)))}}function dI(e,t){var r=Mu(e),i=r==="transform"?U2:TN;return this.attrTween(e,typeof t=="function"?(r.local?cI:uI)(r,i,Xv(this,"attr."+e,t)):t==null?(r.local?oI:iI)(r):(r.local?lI:aI)(r,i,t))}function fI(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function hI(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function pI(e,t){var r,i;function o(){var l=t.apply(this,arguments);return l!==i&&(r=(i=l)&&hI(e,l)),r}return o._value=t,o}function mI(e,t){var r,i;function o(){var l=t.apply(this,arguments);return l!==i&&(r=(i=l)&&fI(e,l)),r}return o._value=t,o}function gI(e,t){var r="attr."+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;var i=Mu(e);return this.tween(r,(i.local?pI:mI)(i,t))}function vI(e,t){return function(){Kv(this,e).delay=+t.apply(this,arguments)}}function yI(e,t){return t=+t,function(){Kv(this,e).delay=t}}function wI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vI:yI)(t,e)):nr(this.node(),t).delay}function xI(e,t){return function(){pr(this,e).duration=+t.apply(this,arguments)}}function _I(e,t){return t=+t,function(){pr(this,e).duration=t}}function bI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?xI:_I)(t,e)):nr(this.node(),t).duration}function SI(e,t){if(typeof t!="function")throw new Error;return function(){pr(this,e).ease=t}}function kI(e){var t=this._id;return arguments.length?this.each(SI(t,e)):nr(this.node(),t).ease}function EI(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;pr(this,e).ease=r}}function NI(e){if(typeof e!="function")throw new Error;return this.each(EI(this._id,e))}function CI(e){typeof e!="function"&&(e=aN(e));for(var t=this._groups,r=t.length,i=new Array(r),o=0;o<r;++o)for(var l=t[o],u=l.length,c=i[o]=[],f,p=0;p<u;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&c.push(f);return new Fr(i,this._parents,this._name,this._id)}function jI(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,i=t.length,o=r.length,l=Math.min(i,o),u=new Array(i),c=0;c<l;++c)for(var f=t[c],p=r[c],d=f.length,m=u[c]=new Array(d),y,w=0;w<d;++w)(y=f[w]||p[w])&&(m[w]=y);for(;c<i;++c)u[c]=t[c];return new Fr(u,this._parents,this._name,this._id)}function TI(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function RI(e,t,r){var i,o,l=TI(t)?Kv:pr;return function(){var u=l(this,e),c=u.on;c!==i&&(o=(i=c).copy()).on(t,r),u.on=o}}function AI(e,t){var r=this._id;return arguments.length<2?nr(this.node(),r).on.on(e):this.each(RI(r,e,t))}function II(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function MI(){return this.on("end.remove",II(this._id))}function OI(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Wv(e));for(var i=this._groups,o=i.length,l=new Array(o),u=0;u<o;++u)for(var c=i[u],f=c.length,p=l[u]=new Array(f),d,m,y=0;y<f;++y)(d=c[y])&&(m=e.call(d,d.__data__,y,c))&&("__data__"in d&&(m.__data__=d.__data__),p[y]=m,Pu(p[y],t,r,y,p,nr(d,r)));return new Fr(l,this._parents,t,r)}function PI(e){var t=this._name,r=this._id;typeof e!="function"&&(e=oN(e));for(var i=this._groups,o=i.length,l=[],u=[],c=0;c<o;++c)for(var f=i[c],p=f.length,d,m=0;m<p;++m)if(d=f[m]){for(var y=e.call(d,d.__data__,m,f),w,E=nr(d,r),_=0,b=y.length;_<b;++_)(w=y[_])&&Pu(w,t,r,_,y,E);l.push(y),u.push(d)}return new Fr(l,u,t,r)}var LI=Ra.prototype.constructor;function $I(){return new LI(this._groups,this._parents)}function qI(e,t){var r,i,o;return function(){var l=fo(this,e),u=(this.style.removeProperty(e),fo(this,e));return l===u?null:l===r&&u===i?o:o=t(r=l,i=u)}}function RN(e){return function(){this.style.removeProperty(e)}}function DI(e,t,r){var i,o=r+"",l;return function(){var u=fo(this,e);return u===o?null:u===i?l:l=t(i=u,r)}}function FI(e,t,r){var i,o,l;return function(){var u=fo(this,e),c=r(this),f=c+"";return c==null&&(f=c=(this.style.removeProperty(e),fo(this,e))),u===f?null:u===i&&f===o?l:(o=f,l=t(i=u,c))}}function zI(e,t){var r,i,o,l="style."+t,u="end."+l,c;return function(){var f=pr(this,e),p=f.on,d=f.value[l]==null?c||(c=RN(t)):void 0;(p!==r||o!==d)&&(i=(r=p).copy()).on(u,o=d),f.on=i}}function BI(e,t,r){var i=(e+="")=="transform"?B2:TN;return t==null?this.styleTween(e,qI(e,i)).on("end.style."+e,RN(e)):typeof t=="function"?this.styleTween(e,FI(e,i,Xv(this,"style."+e,t))).each(zI(this._id,e)):this.styleTween(e,DI(e,i,t),r).on("end.style."+e,null)}function UI(e,t,r){return function(i){this.style.setProperty(e,t.call(this,i),r)}}function HI(e,t,r){var i,o;function l(){var u=t.apply(this,arguments);return u!==o&&(i=(o=u)&&UI(e,u,r)),i}return l._value=t,l}function WI(e,t,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,HI(e,t,r??""))}function VI(e){return function(){this.textContent=e}}function GI(e){return function(){var t=e(this);this.textContent=t??""}}function YI(e){return this.tween("text",typeof e=="function"?GI(Xv(this,"text",e)):VI(e==null?"":e+""))}function KI(e){return function(t){this.textContent=e.call(this,t)}}function XI(e){var t,r;function i(){var o=e.apply(this,arguments);return o!==r&&(t=(r=o)&&KI(o)),t}return i._value=e,i}function QI(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,XI(e))}function ZI(){for(var e=this._name,t=this._id,r=AN(),i=this._groups,o=i.length,l=0;l<o;++l)for(var u=i[l],c=u.length,f,p=0;p<c;++p)if(f=u[p]){var d=nr(f,t);Pu(f,e,r,p,u,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Fr(i,this._parents,e,r)}function JI(){var e,t,r=this,i=r._id,o=r.size();return new Promise(function(l,u){var c={value:u},f={value:function(){--o===0&&l()}};r.each(function(){var p=pr(this,i),d=p.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(f)),p.on=t}),o===0&&l()})}var eM=0;function Fr(e,t,r,i){this._groups=e,this._parents=t,this._name=r,this._id=i}function AN(){return++eM}var $r=Ra.prototype;Fr.prototype={constructor:Fr,select:OI,selectAll:PI,selectChild:$r.selectChild,selectChildren:$r.selectChildren,filter:CI,merge:jI,selection:$I,transition:ZI,call:$r.call,nodes:$r.nodes,node:$r.node,size:$r.size,empty:$r.empty,each:$r.each,on:AI,attr:dI,attrTween:gI,style:BI,styleTween:WI,text:YI,textTween:QI,remove:MI,tween:sI,delay:wI,duration:bI,ease:kI,easeVarying:NI,end:JI,[Symbol.iterator]:$r[Symbol.iterator]};function tM(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var nM={time:null,delay:0,duration:250,ease:tM};function rM(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function sM(e){var t,r;e instanceof Fr?(t=e._id,e=e._name):(t=AN(),(r=nM).time=Yv(),e=e==null?null:e+"");for(var i=this._groups,o=i.length,l=0;l<o;++l)for(var u=i[l],c=u.length,f,p=0;p<c;++p)(f=u[p])&&Pu(f,e,t,p,u,r||rM(f,t));return new Fr(i,this._parents,e,t)}Ra.prototype.interrupt=tI;Ra.prototype.transition=sM;const Zl=e=>()=>e;function iM(e,{sourceEvent:t,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function qr(e,t,r){this.k=e,this.x=t,this.y=r}qr.prototype={constructor:qr,scale:function(e){return e===1?this:new qr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new qr(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 Dr=new qr(1,0,0);qr.prototype;function Bd(e){e.stopImmediatePropagation()}function oa(e){e.preventDefault(),e.stopImmediatePropagation()}function oM(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function aM(){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 xx(){return this.__zoom||Dr}function lM(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function uM(){return navigator.maxTouchPoints||"ontouchstart"in this}function cM(e,t,r){var i=e.invertX(t[0][0])-r[0][0],o=e.invertX(t[1][0])-r[1][0],l=e.invertY(t[0][1])-r[0][1],u=e.invertY(t[1][1])-r[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function IN(){var e=oM,t=aM,r=cM,i=lM,o=uM,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,f=G2,p=Iu("start","zoom","end"),d,m,y,w=500,E=150,_=0,b=10;function S(C){C.property("__zoom",xx).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",L).filter(o).on("touchstart.zoom",U).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(C,F,$,re){var J=C.selection?C.selection():C;J.property("__zoom",xx),C!==J?A(C,F,$,re):J.interrupt().each(function(){M(this,arguments).event(re).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},S.scaleBy=function(C,F,$,re){S.scaleTo(C,function(){var J=this.__zoom.k,W=typeof F=="function"?F.apply(this,arguments):F;return J*W},$,re)},S.scaleTo=function(C,F,$,re){S.transform(C,function(){var J=t.apply(this,arguments),W=this.__zoom,Z=$==null?j(J):typeof $=="function"?$.apply(this,arguments):$,I=W.invert(Z),G=typeof F=="function"?F.apply(this,arguments):F;return r(N(k(W,G),Z,I),J,u)},$,re)},S.translateBy=function(C,F,$,re){S.transform(C,function(){return r(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof $=="function"?$.apply(this,arguments):$),t.apply(this,arguments),u)},null,re)},S.translateTo=function(C,F,$,re,J){S.transform(C,function(){var W=t.apply(this,arguments),Z=this.__zoom,I=re==null?j(W):typeof re=="function"?re.apply(this,arguments):re;return r(Dr.translate(I[0],I[1]).scale(Z.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof $=="function"?-$.apply(this,arguments):-$),W,u)},re,J)};function k(C,F){return F=Math.max(l[0],Math.min(l[1],F)),F===C.k?C:new qr(F,C.x,C.y)}function N(C,F,$){var re=F[0]-$[0]*C.k,J=F[1]-$[1]*C.k;return re===C.x&&J===C.y?C:new qr(C.k,re,J)}function j(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function A(C,F,$,re){C.on("start.zoom",function(){M(this,arguments).event(re).start()}).on("interrupt.zoom end.zoom",function(){M(this,arguments).event(re).end()}).tween("zoom",function(){var J=this,W=arguments,Z=M(J,W).event(re),I=t.apply(J,W),G=$==null?j(I):typeof $=="function"?$.apply(J,W):$,K=Math.max(I[1][0]-I[0][0],I[1][1]-I[0][1]),q=J.__zoom,Q=typeof F=="function"?F.apply(J,W):F,ne=f(q.invert(G).concat(K/q.k),Q.invert(G).concat(K/Q.k));return function(ae){if(ae===1)ae=Q;else{var fe=ne(ae),te=K/fe[2];ae=new qr(te,G[0]-fe[0]*te,G[1]-fe[1]*te)}Z.zoom(null,ae)}})}function M(C,F,$){return!$&&C.__zooming||new O(C,F)}function O(C,F){this.that=C,this.args=F,this.active=0,this.sourceEvent=null,this.extent=t.apply(C,F),this.taps=0}O.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,F){return this.mouse&&C!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var F=Ln(this.that).datum();p.call(C,this.that,new iM(C,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:p}),F)}};function P(C,...F){if(!e.apply(this,arguments))return;var $=M(this,F).event(C),re=this.__zoom,J=Math.max(l[0],Math.min(l[1],re.k*Math.pow(2,i.apply(this,arguments)))),W=Zn(C);if($.wheel)($.mouse[0][0]!==W[0]||$.mouse[0][1]!==W[1])&&($.mouse[1]=re.invert($.mouse[0]=W)),clearTimeout($.wheel);else{if(re.k===J)return;$.mouse=[W,re.invert(W)],pu(this),$.start()}oa(C),$.wheel=setTimeout(Z,E),$.zoom("mouse",r(N(k(re,J),$.mouse[0],$.mouse[1]),$.extent,u));function Z(){$.wheel=null,$.end()}}function D(C,...F){if(y||!e.apply(this,arguments))return;var $=C.currentTarget,re=M(this,F,!0).event(C),J=Ln(C.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",K,!0),W=Zn(C,$),Z=C.clientX,I=C.clientY;vN(C.view),Bd(C),re.mouse=[W,this.__zoom.invert(W)],pu(this),re.start();function G(q){if(oa(q),!re.moved){var Q=q.clientX-Z,ne=q.clientY-I;re.moved=Q*Q+ne*ne>_}re.event(q).zoom("mouse",r(N(re.that.__zoom,re.mouse[0]=Zn(q,$),re.mouse[1]),re.extent,u))}function K(q){J.on("mousemove.zoom mouseup.zoom",null),yN(q.view,re.moved),oa(q),re.event(q).end()}}function L(C,...F){if(e.apply(this,arguments)){var $=this.__zoom,re=Zn(C.changedTouches?C.changedTouches[0]:C,this),J=$.invert(re),W=$.k*(C.shiftKey?.5:2),Z=r(N(k($,W),re,J),t.apply(this,F),u);oa(C),c>0?Ln(this).transition().duration(c).call(A,Z,re,C):Ln(this).call(S.transform,Z,re,C)}}function U(C,...F){if(e.apply(this,arguments)){var $=C.touches,re=$.length,J=M(this,F,C.changedTouches.length===re).event(C),W,Z,I,G;for(Bd(C),Z=0;Z<re;++Z)I=$[Z],G=Zn(I,this),G=[G,this.__zoom.invert(G),I.identifier],J.touch0?!J.touch1&&J.touch0[2]!==G[2]&&(J.touch1=G,J.taps=0):(J.touch0=G,W=!0,J.taps=1+!!d);d&&(d=clearTimeout(d)),W&&(J.taps<2&&(m=G[0],d=setTimeout(function(){d=null},w)),pu(this),J.start())}}function V(C,...F){if(this.__zooming){var $=M(this,F).event(C),re=C.changedTouches,J=re.length,W,Z,I,G;for(oa(C),W=0;W<J;++W)Z=re[W],I=Zn(Z,this),$.touch0&&$.touch0[2]===Z.identifier?$.touch0[0]=I:$.touch1&&$.touch1[2]===Z.identifier&&($.touch1[0]=I);if(Z=$.that.__zoom,$.touch1){var K=$.touch0[0],q=$.touch0[1],Q=$.touch1[0],ne=$.touch1[1],ae=(ae=Q[0]-K[0])*ae+(ae=Q[1]-K[1])*ae,fe=(fe=ne[0]-q[0])*fe+(fe=ne[1]-q[1])*fe;Z=k(Z,Math.sqrt(ae/fe)),I=[(K[0]+Q[0])/2,(K[1]+Q[1])/2],G=[(q[0]+ne[0])/2,(q[1]+ne[1])/2]}else if($.touch0)I=$.touch0[0],G=$.touch0[1];else return;$.zoom("touch",r(N(Z,I,G),$.extent,u))}}function z(C,...F){if(this.__zooming){var $=M(this,F).event(C),re=C.changedTouches,J=re.length,W,Z;for(Bd(C),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),W=0;W<J;++W)Z=re[W],$.touch0&&$.touch0[2]===Z.identifier?delete $.touch0:$.touch1&&$.touch1[2]===Z.identifier&&delete $.touch1;if($.touch1&&!$.touch0&&($.touch0=$.touch1,delete $.touch1),$.touch0)$.touch0[1]=this.__zoom.invert($.touch0[0]);else if($.end(),$.taps===2&&(Z=Zn(Z,this),Math.hypot(m[0]-Z[0],m[1]-Z[1])<b)){var I=Ln(this).on("dblclick.zoom");I&&I.apply(this,arguments)}}}return S.wheelDelta=function(C){return arguments.length?(i=typeof C=="function"?C:Zl(+C),S):i},S.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Zl(!!C),S):e},S.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:Zl(!!C),S):o},S.extent=function(C){return arguments.length?(t=typeof C=="function"?C:Zl([[+C[0][0],+C[0][1]],[+C[1][0],+C[1][1]]]),S):t},S.scaleExtent=function(C){return arguments.length?(l[0]=+C[0],l[1]=+C[1],S):[l[0],l[1]]},S.translateExtent=function(C){return arguments.length?(u[0][0]=+C[0][0],u[1][0]=+C[1][0],u[0][1]=+C[0][1],u[1][1]=+C[1][1],S):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},S.constrain=function(C){return arguments.length?(r=C,S):r},S.duration=function(C){return arguments.length?(c=+C,S):c},S.interpolate=function(C){return arguments.length?(f=C,S):f},S.on=function(){var C=p.on.apply(p,arguments);return C===p?S:C},S.clickDistance=function(C){return arguments.length?(_=(C=+C)*C,S):Math.sqrt(_)},S.tapDistance=function(C){return arguments.length?(b=+C,S):b},S}var dM=rN();const Lu=R.createContext(null),fM=Lu.Provider,zr={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},MN=zr.error001();function Ke(e,t){const r=R.useContext(Lu);if(r===null)throw new Error(MN);return sN(r,e,t)}const jt=()=>{const e=R.useContext(Lu);if(e===null)throw new Error(MN);return R.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},hM=e=>e.userSelectionActive?"none":"all";function Qv({position:e,children:t,className:r,style:i,...o}){const l=Ke(hM),u=`${e}`.split("-");return ue.createElement("div",{className:Ft(["react-flow__panel",r,...u]),style:{...i,pointerEvents:l},...o},t)}function pM({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.createElement(Qv,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},ue.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const mM=({x:e,y:t,label:r,labelStyle:i={},labelShowBg:o=!0,labelBgStyle:l={},labelBgPadding:u=[2,4],labelBgBorderRadius:c=2,children:f,className:p,...d})=>{const m=R.useRef(null),[y,w]=R.useState({x:0,y:0,width:0,height:0}),E=Ft(["react-flow__edge-textwrapper",p]);return R.useEffect(()=>{if(m.current){const _=m.current.getBBox();w({x:_.x,y:_.y,width:_.width,height:_.height})}},[r]),typeof r>"u"||!r?null:ue.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:E,visibility:y.width?"visible":"hidden",...d},o&&ue.createElement("rect",{width:y.width+2*u[0],x:-u[0],y:-u[1],height:y.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:c,ry:c}),ue.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:i},r),f)};var gM=R.memo(mM);const Zv=e=>({width:e.offsetWidth,height:e.offsetHeight}),po=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),Jv=(e={x:0,y:0},t)=>({x:po(e.x,t[0][0],t[1][0]),y:po(e.y,t[0][1],t[1][1])}),_x=(e,t,r)=>e<t?po(Math.abs(e-t),1,50)/50:e>r?-po(Math.abs(e-r),1,50)/50:0,ON=(e,t)=>{const r=_x(e.x,35,t.width-35)*20,i=_x(e.y,35,t.height-35)*20;return[r,i]},PN=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},LN=(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)}),ka=({x:e,y:t,width:r,height:i})=>({x:e,y:t,x2:e+r,y2:t+i}),$N=({x:e,y:t,x2:r,y2:i})=>({x:e,y:t,width:r-e,height:i-t}),bx=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),vM=(e,t)=>$N(LN(ka(e),ka(t))),Cv=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*i)},yM=e=>$n(e.width)&&$n(e.height)&&$n(e.x)&&$n(e.y),$n=e=>!isNaN(e)&&isFinite(e),gt=Symbol.for("internals"),qN=["Enter"," ","Escape"],wM=(e,t)=>{},xM=e=>"nativeEvent"in e;function jv(e){var o,l;const t=xM(e)?e.nativeEvent:e,r=((l=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:l[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(r==null?void 0:r.nodeName)||(r==null?void 0:r.hasAttribute("contenteditable"))||!!(r!=null&&r.closest(".nokey"))}const DN=e=>"clientX"in e,js=(e,t)=>{var l,u;const r=DN(e),i=r?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,o=r?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:i-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},Su=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Ia=({id:e,path:t,labelX:r,labelY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w=20})=>ue.createElement(ue.Fragment,null,ue.createElement("path",{id:e,style:d,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&ue.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),o&&$n(r)&&$n(i)?ue.createElement(gM,{x:r,y:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p}):null);Ia.displayName="BaseEdge";function aa(e,t,r){return r===void 0?r:i=>{const o=t().edges.find(l=>l.id===e);o&&r(i,{...o})}}function FN({sourceX:e,sourceY:t,targetX:r,targetY:i}){const o=Math.abs(r-e)/2,l=r<e?r+o:r-o,u=Math.abs(i-t)/2,c=i<t?i+u:i-u;return[l,c,o,u]}function zN({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:l,targetControlX:u,targetControlY:c}){const f=e*.125+o*.375+u*.375+r*.125,p=t*.125+l*.375+c*.375+i*.125,d=Math.abs(f-e),m=Math.abs(p-t);return[f,p,d,m]}var mi;(function(e){e.Strict="strict",e.Loose="loose"})(mi||(mi={}));var di;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(di||(di={}));var Ea;(function(e){e.Partial="partial",e.Full="full"})(Ea||(Ea={}));var Cs;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Cs||(Cs={}));var ku;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ku||(ku={}));var Ae;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ae||(Ae={}));function Sx({pos:e,x1:t,y1:r,x2:i,y2:o}){return e===Ae.Left||e===Ae.Right?[.5*(t+i),r]:[t,.5*(r+o)]}function BN({sourceX:e,sourceY:t,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top}){const[u,c]=Sx({pos:r,x1:e,y1:t,x2:i,y2:o}),[f,p]=Sx({pos:l,x1:i,y1:o,x2:e,y2:t}),[d,m,y,w]=zN({sourceX:e,sourceY:t,targetX:i,targetY:o,sourceControlX:u,sourceControlY:c,targetControlX:f,targetControlY:p});return[`M${e},${t} C${u},${c} ${f},${p} ${i},${o}`,d,m,y,w]}const ey=R.memo(({sourceX:e,sourceY:t,targetX:r,targetY:i,sourcePosition:o=Ae.Bottom,targetPosition:l=Ae.Top,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:E,interactionWidth:_})=>{const[b,S,k]=BN({sourceX:e,sourceY:t,sourcePosition:o,targetX:r,targetY:i,targetPosition:l});return ue.createElement(Ia,{path:b,labelX:S,labelY:k,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:E,interactionWidth:_})});ey.displayName="SimpleBezierEdge";const kx={[Ae.Left]:{x:-1,y:0},[Ae.Right]:{x:1,y:0},[Ae.Top]:{x:0,y:-1},[Ae.Bottom]:{x:0,y:1}},_M=({source:e,sourcePosition:t=Ae.Bottom,target:r})=>t===Ae.Left||t===Ae.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},Ex=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function bM({source:e,sourcePosition:t=Ae.Bottom,target:r,targetPosition:i=Ae.Top,center:o,offset:l}){const u=kx[t],c=kx[i],f={x:e.x+u.x*l,y:e.y+u.y*l},p={x:r.x+c.x*l,y:r.y+c.y*l},d=_M({source:f,sourcePosition:t,target:p}),m=d.x!==0?"x":"y",y=d[m];let w=[],E,_;const b={x:0,y:0},S={x:0,y:0},[k,N,j,A]=FN({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(u[m]*c[m]===-1){E=o.x??k,_=o.y??N;const O=[{x:E,y:f.y},{x:E,y:p.y}],P=[{x:f.x,y:_},{x:p.x,y:_}];u[m]===y?w=m==="x"?O:P:w=m==="x"?P:O}else{const O=[{x:f.x,y:p.y}],P=[{x:p.x,y:f.y}];if(m==="x"?w=u.x===y?P:O:w=u.y===y?O:P,t===i){const z=Math.abs(e[m]-r[m]);if(z<=l){const C=Math.min(l-1,l-z);u[m]===y?b[m]=(f[m]>e[m]?-1:1)*C:S[m]=(p[m]>r[m]?-1:1)*C}}if(t!==i){const z=m==="x"?"y":"x",C=u[m]===c[z],F=f[z]>p[z],$=f[z]<p[z];(u[m]===1&&(!C&&F||C&&$)||u[m]!==1&&(!C&&$||C&&F))&&(w=m==="x"?O:P)}const D={x:f.x+b.x,y:f.y+b.y},L={x:p.x+S.x,y:p.y+S.y},U=Math.max(Math.abs(D.x-w[0].x),Math.abs(L.x-w[0].x)),V=Math.max(Math.abs(D.y-w[0].y),Math.abs(L.y-w[0].y));U>=V?(E=(D.x+L.x)/2,_=w[0].y):(E=w[0].x,_=(D.y+L.y)/2)}return[[e,{x:f.x+b.x,y:f.y+b.y},...w,{x:p.x+S.x,y:p.y+S.y},r],E,_,j,A]}function SM(e,t,r,i){const o=Math.min(Ex(e,t)/2,Ex(t,r)/2,i),{x:l,y:u}=t;if(e.x===l&&l===r.x||e.y===u&&u===r.y)return`L${l} ${u}`;if(e.y===u){const p=e.x<r.x?-1:1,d=e.y<r.y?1:-1;return`L ${l+o*p},${u}Q ${l},${u} ${l},${u+o*d}`}const c=e.x<r.x?1:-1,f=e.y<r.y?-1:1;return`L ${l},${u+o*f}Q ${l},${u} ${l+o*c},${u}`}function Tv({sourceX:e,sourceY:t,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top,borderRadius:u=5,centerX:c,centerY:f,offset:p=20}){const[d,m,y,w,E]=bM({source:{x:e,y:t},sourcePosition:r,target:{x:i,y:o},targetPosition:l,center:{x:c,y:f},offset:p});return[d.reduce((b,S,k)=>{let N="";return k>0&&k<d.length-1?N=SM(d[k-1],S,d[k+1],u):N=`${k===0?"M":"L"}${S.x} ${S.y}`,b+=N,b},""),m,y,w,E]}const $u=R.memo(({sourceX:e,sourceY:t,targetX:r,targetY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,sourcePosition:m=Ae.Bottom,targetPosition:y=Ae.Top,markerEnd:w,markerStart:E,pathOptions:_,interactionWidth:b})=>{const[S,k,N]=Tv({sourceX:e,sourceY:t,sourcePosition:m,targetX:r,targetY:i,targetPosition:y,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return ue.createElement(Ia,{path:S,labelX:k,labelY:N,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,markerEnd:w,markerStart:E,interactionWidth:b})});$u.displayName="SmoothStepEdge";const ty=R.memo(e=>{var t;return ue.createElement($u,{...e,pathOptions:R.useMemo(()=>{var r;return{borderRadius:0,offset:(r=e.pathOptions)==null?void 0:r.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});ty.displayName="StepEdge";function kM({sourceX:e,sourceY:t,targetX:r,targetY:i}){const[o,l,u,c]=FN({sourceX:e,sourceY:t,targetX:r,targetY:i});return[`M ${e},${t}L ${r},${i}`,o,l,u,c]}const ny=R.memo(({sourceX:e,sourceY:t,targetX:r,targetY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[E,_,b]=kM({sourceX:e,sourceY:t,targetX:r,targetY:i});return ue.createElement(Ia,{path:E,labelX:_,labelY:b,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w})});ny.displayName="StraightEdge";function Jl(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Nx({pos:e,x1:t,y1:r,x2:i,y2:o,c:l}){switch(e){case Ae.Left:return[t-Jl(t-i,l),r];case Ae.Right:return[t+Jl(i-t,l),r];case Ae.Top:return[t,r-Jl(r-o,l)];case Ae.Bottom:return[t,r+Jl(o-r,l)]}}function UN({sourceX:e,sourceY:t,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top,curvature:u=.25}){const[c,f]=Nx({pos:r,x1:e,y1:t,x2:i,y2:o,c:u}),[p,d]=Nx({pos:l,x1:i,y1:o,x2:e,y2:t,c:u}),[m,y,w,E]=zN({sourceX:e,sourceY:t,targetX:i,targetY:o,sourceControlX:c,sourceControlY:f,targetControlX:p,targetControlY:d});return[`M${e},${t} C${c},${f} ${p},${d} ${i},${o}`,m,y,w,E]}const Eu=R.memo(({sourceX:e,sourceY:t,targetX:r,targetY:i,sourcePosition:o=Ae.Bottom,targetPosition:l=Ae.Top,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:E,pathOptions:_,interactionWidth:b})=>{const[S,k,N]=UN({sourceX:e,sourceY:t,sourcePosition:o,targetX:r,targetY:i,targetPosition:l,curvature:_==null?void 0:_.curvature});return ue.createElement(Ia,{path:S,labelX:k,labelY:N,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:E,interactionWidth:b})});Eu.displayName="BezierEdge";const ry=R.createContext(null),EM=ry.Provider;ry.Consumer;const NM=()=>R.useContext(ry),CM=e=>"id"in e&&"source"in e&&"target"in e,jM=({source:e,sourceHandle:t,target:r,targetHandle:i})=>`reactflow__edge-${e}${t||""}-${r}${i||""}`,Rv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`,TM=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),RM=(e,t)=>{if(!e.source||!e.target)return t;let r;return CM(e)?r={...e}:r={...e,id:jM(e)},TM(r,t)?t:t.concat(r)},Av=({x:e,y:t},[r,i,o],l,[u,c])=>{const f={x:(e-r)/o,y:(t-i)/o};return l?{x:u*Math.round(f.x/u),y:c*Math.round(f.y/c)}:f},HN=({x:e,y:t},[r,i,o])=>({x:e*o+r,y:t*o+i}),hi=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*t[0],i=(e.height??0)*t[1],o={x:e.position.x-r,y:e.position.y-i};return{...o,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-r,y:e.positionAbsolute.y-i}:o}},qu=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((i,o)=>{const{x:l,y:u}=hi(o,t).positionAbsolute;return LN(i,ka({x:l,y:u,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return $N(r)},WN=(e,t,[r,i,o]=[0,0,1],l=!1,u=!1,c=[0,0])=>{const f={x:(t.x-r)/o,y:(t.y-i)/o,width:t.width/o,height:t.height/o},p=[];return e.forEach(d=>{const{width:m,height:y,selectable:w=!0,hidden:E=!1}=d;if(u&&!w||E)return!1;const{positionAbsolute:_}=hi(d,c),b={x:_.x,y:_.y,width:m||0,height:y||0},S=Cv(f,b),k=typeof m>"u"||typeof y>"u"||m===null||y===null,N=l&&S>0,j=(m||0)*(y||0);(k||N||S>=j||d.dragging)&&p.push(d)}),p},VN=(e,t)=>{const r=e.map(i=>i.id);return t.filter(i=>r.includes(i.source)||r.includes(i.target))},GN=(e,t,r,i,o,l=.1)=>{const u=t/(e.width*(1+l)),c=r/(e.height*(1+l)),f=Math.min(u,c),p=po(f,i,o),d=e.x+e.width/2,m=e.y+e.height/2,y=t/2-d*p,w=r/2-m*p;return{x:y,y:w,zoom:p}},ui=(e,t=0)=>e.transition().duration(t);function Cx(e,t,r,i){return(t[r]||[]).reduce((o,l)=>{var u,c;return`${e.id}-${l.id}-${r}`!==i&&o.push({id:l.id||null,type:r,nodeId:e.id,x:(((u=e.positionAbsolute)==null?void 0:u.x)??0)+l.x+l.width/2,y:(((c=e.positionAbsolute)==null?void 0:c.y)??0)+l.y+l.height/2}),o},[])}function AM(e,t,r,i,o,l){const{x:u,y:c}=js(e),p=t.elementsFromPoint(u,c).find(E=>E.classList.contains("react-flow__handle"));if(p){const E=p.getAttribute("data-nodeid");if(E){const _=sy(void 0,p),b=p.getAttribute("data-handleid"),S=l({nodeId:E,id:b,type:_});if(S){const k=o.find(N=>N.nodeId===E&&N.type===_&&N.id===b);return{handle:{id:b,type:_,nodeId:E,x:(k==null?void 0:k.x)||r.x,y:(k==null?void 0:k.y)||r.y},validHandleResult:S}}}}let d=[],m=1/0;if(o.forEach(E=>{const _=Math.sqrt((E.x-r.x)**2+(E.y-r.y)**2);if(_<=i){const b=l(E);_<=m&&(_<m?d=[{handle:E,validHandleResult:b}]:_===m&&d.push({handle:E,validHandleResult:b}),m=_)}}),!d.length)return{handle:null,validHandleResult:YN()};if(d.length===1)return d[0];const y=d.some(({validHandleResult:E})=>E.isValid),w=d.some(({handle:E})=>E.type==="target");return d.find(({handle:E,validHandleResult:_})=>w?E.type==="target":y?_.isValid:!0)||d[0]}const IM={source:null,target:null,sourceHandle:null,targetHandle:null},YN=()=>({handleDomNode:null,isValid:!1,connection:IM,endHandle:null});function KN(e,t,r,i,o,l,u){const c=o==="target",f=u.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={...YN(),handleDomNode:f};if(f){const d=sy(void 0,f),m=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),E=f.classList.contains("connectableend"),_={source:c?m:r,sourceHandle:c?y:i,target:c?r:m,targetHandle:c?i:y};p.connection=_,w&&E&&(t===mi.Strict?c&&d==="source"||!c&&d==="target":m!==r||y!==i)&&(p.endHandle={nodeId:m,handleId:y,type:d},p.isValid=l(_))}return p}function MM({nodes:e,nodeId:t,handleId:r,handleType:i}){return e.reduce((o,l)=>{if(l[gt]){const{handleBounds:u}=l[gt];let c=[],f=[];u&&(c=Cx(l,u,"source",`${t}-${r}-${i}`),f=Cx(l,u,"target",`${t}-${r}-${i}`)),o.push(...c,...f)}return o},[])}function sy(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ud(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function OM(e,t){let r=null;return t?r="valid":e&&!t&&(r="invalid"),r}function XN({event:e,handleId:t,nodeId:r,onConnect:i,isTarget:o,getState:l,setState:u,isValidConnection:c,edgeUpdaterType:f,onReconnectEnd:p}){const d=PN(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:E,onConnectStart:_,panBy:b,getNodes:S,cancelConnection:k}=l();let N=0,j;const{x:A,y:M}=js(e),O=d==null?void 0:d.elementFromPoint(A,M),P=sy(f,O),D=y==null?void 0:y.getBoundingClientRect();if(!D||!P)return;let L,U=js(e,D),V=!1,z=null,C=!1,F=null;const $=MM({nodes:S(),nodeId:r,handleId:t,handleType:P}),re=()=>{if(!w)return;const[Z,I]=ON(U,D);b({x:Z,y:I}),N=requestAnimationFrame(re)};u({connectionPosition:U,connectionStatus:null,connectionNodeId:r,connectionHandleId:t,connectionHandleType:P,connectionStartHandle:{nodeId:r,handleId:t,type:P},connectionEndHandle:null}),_==null||_(e,{nodeId:r,handleId:t,handleType:P});function J(Z){const{transform:I}=l();U=js(Z,D);const{handle:G,validHandleResult:K}=AM(Z,d,Av(U,I,!1,[1,1]),E,$,q=>KN(q,m,r,t,o?"target":"source",c,d));if(j=G,V||(re(),V=!0),F=K.handleDomNode,z=K.connection,C=K.isValid,u({connectionPosition:j&&C?HN({x:j.x,y:j.y},I):U,connectionStatus:OM(!!j,C),connectionEndHandle:K.endHandle}),!j&&!C&&!F)return Ud(L);z.source!==z.target&&F&&(Ud(L),L=F,F.classList.add("connecting","react-flow__handle-connecting"),F.classList.toggle("valid",C),F.classList.toggle("react-flow__handle-valid",C))}function W(Z){var I,G;(j||F)&&z&&C&&(i==null||i(z)),(G=(I=l()).onConnectEnd)==null||G.call(I,Z),f&&(p==null||p(Z)),Ud(L),k(),cancelAnimationFrame(N),V=!1,C=!1,z=null,F=null,d.removeEventListener("mousemove",J),d.removeEventListener("mouseup",W),d.removeEventListener("touchmove",J),d.removeEventListener("touchend",W)}d.addEventListener("mousemove",J),d.addEventListener("mouseup",W),d.addEventListener("touchmove",J),d.addEventListener("touchend",W)}const jx=()=>!0,PM=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),LM=(e,t,r)=>i=>{const{connectionStartHandle:o,connectionEndHandle:l,connectionClickStartHandle:u}=i;return{connecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===r||(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===r,clickConnecting:(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.handleId)===t&&(u==null?void 0:u.type)===r}},QN=R.forwardRef(({type:e="source",position:t=Ae.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:o=!0,isConnectableEnd:l=!0,id:u,onConnect:c,children:f,className:p,onMouseDown:d,onTouchStart:m,...y},w)=>{var D,L;const E=u||null,_=e==="target",b=jt(),S=NM(),{connectOnClick:k,noPanClassName:N}=Ke(PM,Ct),{connecting:j,clickConnecting:A}=Ke(LM(S,E,e),Ct);S||(L=(D=b.getState()).onError)==null||L.call(D,"010",zr.error010());const M=U=>{const{defaultEdgeOptions:V,onConnect:z,hasDefaultEdges:C}=b.getState(),F={...V,...U};if(C){const{edges:$,setEdges:re}=b.getState();re(RM(F,$))}z==null||z(F),c==null||c(F)},O=U=>{if(!S)return;const V=DN(U);o&&(V&&U.button===0||!V)&&XN({event:U,handleId:E,nodeId:S,onConnect:M,isTarget:_,getState:b.getState,setState:b.setState,isValidConnection:r||b.getState().isValidConnection||jx}),V?d==null||d(U):m==null||m(U)},P=U=>{const{onClickConnectStart:V,onClickConnectEnd:z,connectionClickStartHandle:C,connectionMode:F,isValidConnection:$}=b.getState();if(!S||!C&&!o)return;if(!C){V==null||V(U,{nodeId:S,handleId:E,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:S,type:e,handleId:E}});return}const re=PN(U.target),J=r||$||jx,{connection:W,isValid:Z}=KN({nodeId:S,id:E,type:e},F,C.nodeId,C.handleId||null,C.type,J,re);Z&&M(W),z==null||z(U),b.setState({connectionClickStartHandle:null})};return ue.createElement("div",{"data-handleid":E,"data-nodeid":S,"data-handlepos":t,"data-id":`${S}-${E}-${e}`,className:Ft(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",N,p,{source:!_,target:_,connectable:i,connectablestart:o,connectableend:l,connecting:A,connectionindicator:i&&(o&&!j||l&&j)}]),onMouseDown:O,onTouchStart:O,onClick:k?P:void 0,ref:w,...y},f)});QN.displayName="Handle";var mo=R.memo(QN);const ZN=({data:e,isConnectable:t,targetPosition:r=Ae.Top,sourcePosition:i=Ae.Bottom})=>ue.createElement(ue.Fragment,null,ue.createElement(mo,{type:"target",position:r,isConnectable:t}),e==null?void 0:e.label,ue.createElement(mo,{type:"source",position:i,isConnectable:t}));ZN.displayName="DefaultNode";var Iv=R.memo(ZN);const JN=({data:e,isConnectable:t,sourcePosition:r=Ae.Bottom})=>ue.createElement(ue.Fragment,null,e==null?void 0:e.label,ue.createElement(mo,{type:"source",position:r,isConnectable:t}));JN.displayName="InputNode";var eC=R.memo(JN);const tC=({data:e,isConnectable:t,targetPosition:r=Ae.Top})=>ue.createElement(ue.Fragment,null,ue.createElement(mo,{type:"target",position:r,isConnectable:t}),e==null?void 0:e.label);tC.displayName="OutputNode";var nC=R.memo(tC);const iy=()=>null;iy.displayName="GroupNode";const $M=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),eu=e=>e.id;function qM(e,t){return Ct(e.selectedNodes.map(eu),t.selectedNodes.map(eu))&&Ct(e.selectedEdges.map(eu),t.selectedEdges.map(eu))}const rC=R.memo(({onSelectionChange:e})=>{const t=jt(),{selectedNodes:r,selectedEdges:i}=Ke($M,qM);return R.useEffect(()=>{const o={nodes:r,edges:i};e==null||e(o),t.getState().onSelectionChange.forEach(l=>l(o))},[r,i,e]),null});rC.displayName="SelectionListener";const DM=e=>!!e.onSelectionChange;function FM({onSelectionChange:e}){const t=Ke(DM);return e||t?ue.createElement(rC,{onSelectionChange:e}):null}const zM=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 Qi(e,t){R.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function $e(e,t,r){R.useEffect(()=>{typeof t<"u"&&r({[e]:t})},[t])}const BM=({nodes:e,edges:t,defaultNodes:r,defaultEdges:i,onConnect:o,onConnectStart:l,onConnectEnd:u,onClickConnectStart:c,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:d,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:E,minZoom:_,maxZoom:b,nodeExtent:S,onNodesChange:k,onEdgesChange:N,elementsSelectable:j,connectionMode:A,snapGrid:M,snapToGrid:O,translateExtent:P,connectOnClick:D,defaultEdgeOptions:L,fitView:U,fitViewOptions:V,onNodesDelete:z,onEdgesDelete:C,onNodeDrag:F,onNodeDragStart:$,onNodeDragStop:re,onSelectionDrag:J,onSelectionDragStart:W,onSelectionDragStop:Z,noPanClassName:I,nodeOrigin:G,rfId:K,autoPanOnConnect:q,autoPanOnNodeDrag:Q,onError:ne,connectionRadius:ae,isValidConnection:fe,nodeDragThreshold:te})=>{const{setNodes:ce,setEdges:Ce,setDefaultNodesAndEdges:ve,setMinZoom:Re,setMaxZoom:ye,setTranslateExtent:Ee,setNodeExtent:Ye,reset:we}=Ke(zM,Ct),_e=jt();return R.useEffect(()=>{const Be=i==null?void 0:i.map(it=>({...it,...L}));return ve(r,Be),()=>{we()}},[]),$e("defaultEdgeOptions",L,_e.setState),$e("connectionMode",A,_e.setState),$e("onConnect",o,_e.setState),$e("onConnectStart",l,_e.setState),$e("onConnectEnd",u,_e.setState),$e("onClickConnectStart",c,_e.setState),$e("onClickConnectEnd",f,_e.setState),$e("nodesDraggable",p,_e.setState),$e("nodesConnectable",d,_e.setState),$e("nodesFocusable",m,_e.setState),$e("edgesFocusable",y,_e.setState),$e("edgesUpdatable",w,_e.setState),$e("elementsSelectable",j,_e.setState),$e("elevateNodesOnSelect",E,_e.setState),$e("snapToGrid",O,_e.setState),$e("snapGrid",M,_e.setState),$e("onNodesChange",k,_e.setState),$e("onEdgesChange",N,_e.setState),$e("connectOnClick",D,_e.setState),$e("fitViewOnInit",U,_e.setState),$e("fitViewOnInitOptions",V,_e.setState),$e("onNodesDelete",z,_e.setState),$e("onEdgesDelete",C,_e.setState),$e("onNodeDrag",F,_e.setState),$e("onNodeDragStart",$,_e.setState),$e("onNodeDragStop",re,_e.setState),$e("onSelectionDrag",J,_e.setState),$e("onSelectionDragStart",W,_e.setState),$e("onSelectionDragStop",Z,_e.setState),$e("noPanClassName",I,_e.setState),$e("nodeOrigin",G,_e.setState),$e("rfId",K,_e.setState),$e("autoPanOnConnect",q,_e.setState),$e("autoPanOnNodeDrag",Q,_e.setState),$e("onError",ne,_e.setState),$e("connectionRadius",ae,_e.setState),$e("isValidConnection",fe,_e.setState),$e("nodeDragThreshold",te,_e.setState),Qi(e,ce),Qi(t,Ce),Qi(_,Re),Qi(b,ye),Qi(P,Ee),Qi(S,Ye),null},Tx={display:"none"},UM={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},sC="react-flow__node-desc",iC="react-flow__edge-desc",HM="react-flow__aria-live",WM=e=>e.ariaLiveMessage;function VM({rfId:e}){const t=Ke(WM);return ue.createElement("div",{id:`${HM}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:UM},t)}function GM({rfId:e,disableKeyboardA11y:t}){return ue.createElement(ue.Fragment,null,ue.createElement("div",{id:`${sC}-${e}`,style:Tx},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),ue.createElement("div",{id:`${iC}-${e}`,style:Tx},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&ue.createElement(VM,{rfId:e}))}var Na=(e=null,t={actInsideInputWithModifier:!0})=>{const[r,i]=R.useState(!1),o=R.useRef(!1),l=R.useRef(new Set([])),[u,c]=R.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),d=p.reduce((m,y)=>m.concat(...y),[]);return[p,d]}return[[],[]]},[e]);return R.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const d=w=>{if(o.current=w.ctrlKey||w.metaKey||w.shiftKey,(!o.current||o.current&&!t.actInsideInputWithModifier)&&jv(w))return!1;const _=Ax(w.code,c);l.current.add(w[_]),Rx(u,l.current,!1)&&(w.preventDefault(),i(!0))},m=w=>{if((!o.current||o.current&&!t.actInsideInputWithModifier)&&jv(w))return!1;const _=Ax(w.code,c);Rx(u,l.current,!0)?(i(!1),l.current.clear()):l.current.delete(w[_]),w.key==="Meta"&&l.current.clear(),o.current=!1},y=()=>{l.current.clear(),i(!1)};return p==null||p.addEventListener("keydown",d),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",d),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,i]),r};function Rx(e,t,r){return e.filter(i=>r||i.length===t.size).some(i=>i.every(o=>t.has(o)))}function Ax(e,t){return t.includes(e)?"code":"key"}function oC(e,t,r,i){var c,f;const o=e.parentNode||e.parentId;if(!o)return r;const l=t.get(o),u=hi(l,i);return oC(l,t,{x:(r.x??0)+u.x,y:(r.y??0)+u.y,z:(((c=l[gt])==null?void 0:c.z)??0)>(r.z??0)?((f=l[gt])==null?void 0:f.z)??0:r.z??0},i)}function aC(e,t,r){e.forEach(i=>{var l;const o=i.parentNode||i.parentId;if(o&&!e.has(o))throw new Error(`Parent node ${o} not found`);if(o||r!=null&&r[i.id]){const{x:u,y:c,z:f}=oC(i,e,{...i.position,z:((l=i[gt])==null?void 0:l.z)??0},t);i.positionAbsolute={x:u,y:c},i[gt].z=f,r!=null&&r[i.id]&&(i[gt].isParent=!0)}})}function Hd(e,t,r,i){const o=new Map,l={},u=i?1e3:0;return e.forEach(c=>{var w;const f=($n(c.zIndex)?c.zIndex:0)+(c.selected?u:0),p=t.get(c.id),d={...c,positionAbsolute:{x:c.position.x,y:c.position.y}},m=c.parentNode||c.parentId;m&&(l[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==c.type;Object.defineProperty(d,gt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[gt])==null?void 0:w.handleBounds,z:f}}),o.set(c.id,d)}),aC(o,r,l),o}function lC(e,t={}){const{getNodes:r,width:i,height:o,minZoom:l,maxZoom:u,d3Zoom:c,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:d,nodeOrigin:m}=e(),y=t.initial&&!p&&d;if(c&&f&&(y||!t.initial)){const E=r().filter(b=>{var k;const S=t.includeHiddenNodes?b.width&&b.height:!b.hidden;return(k=t.nodes)!=null&&k.length?S&&t.nodes.some(N=>N.id===b.id):S}),_=E.every(b=>b.width&&b.height);if(E.length>0&&_){const b=qu(E,m),{x:S,y:k,zoom:N}=GN(b,i,o,t.minZoom??l,t.maxZoom??u,t.padding??.1),j=Dr.translate(S,k).scale(N);return typeof t.duration=="number"&&t.duration>0?c.transform(ui(f,t.duration),j):c.transform(f,j),!0}}return!1}function YM(e,t){return e.forEach(r=>{const i=t.get(r.id);i&&t.set(i.id,{...i,[gt]:i[gt],selected:r.selected})}),new Map(t)}function KM(e,t){return t.map(r=>{const i=e.find(o=>o.id===r.id);return i&&(r.selected=i.selected),r})}function tu({changedNodes:e,changedEdges:t,get:r,set:i}){const{nodeInternals:o,edges:l,onNodesChange:u,onEdgesChange:c,hasDefaultNodes:f,hasDefaultEdges:p}=r();e!=null&&e.length&&(f&&i({nodeInternals:YM(e,o)}),u==null||u(e)),t!=null&&t.length&&(p&&i({edges:KM(t,l)}),c==null||c(t))}const Zi=()=>{},XM={zoomIn:Zi,zoomOut:Zi,zoomTo:Zi,getZoom:()=>1,setViewport:Zi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Zi,fitBounds:Zi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},QM=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),ZM=()=>{const e=jt(),{d3Zoom:t,d3Selection:r}=Ke(QM,Ct);return R.useMemo(()=>r&&t?{zoomIn:o=>t.scaleBy(ui(r,o==null?void 0:o.duration),1.2),zoomOut:o=>t.scaleBy(ui(r,o==null?void 0:o.duration),1/1.2),zoomTo:(o,l)=>t.scaleTo(ui(r,l==null?void 0:l.duration),o),getZoom:()=>e.getState().transform[2],setViewport:(o,l)=>{const[u,c,f]=e.getState().transform,p=Dr.translate(o.x??u,o.y??c).scale(o.zoom??f);t.transform(ui(r,l==null?void 0:l.duration),p)},getViewport:()=>{const[o,l,u]=e.getState().transform;return{x:o,y:l,zoom:u}},fitView:o=>lC(e.getState,o),setCenter:(o,l,u)=>{const{width:c,height:f,maxZoom:p}=e.getState(),d=typeof(u==null?void 0:u.zoom)<"u"?u.zoom:p,m=c/2-o*d,y=f/2-l*d,w=Dr.translate(m,y).scale(d);t.transform(ui(r,u==null?void 0:u.duration),w)},fitBounds:(o,l)=>{const{width:u,height:c,minZoom:f,maxZoom:p}=e.getState(),{x:d,y:m,zoom:y}=GN(o,u,c,f,p,(l==null?void 0:l.padding)??.1),w=Dr.translate(d,m).scale(y);t.transform(ui(r,l==null?void 0:l.duration),w)},project:o=>{const{transform:l,snapToGrid:u,snapGrid:c}=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"),Av(o,l,u,c)},screenToFlowPosition:o=>{const{transform:l,snapToGrid:u,snapGrid:c,domNode:f}=e.getState();if(!f)return o;const{x:p,y:d}=f.getBoundingClientRect(),m={x:o.x-p,y:o.y-d};return Av(m,l,u,c)},flowToScreenPosition:o=>{const{transform:l,domNode:u}=e.getState();if(!u)return o;const{x:c,y:f}=u.getBoundingClientRect(),p=HN(o,l);return{x:p.x+c,y:p.y+f}},viewportInitialized:!0}:XM,[t,r])};function Ma(){const e=ZM(),t=jt(),r=R.useCallback(()=>t.getState().getNodes().map(_=>({..._})),[]),i=R.useCallback(_=>t.getState().nodeInternals.get(_),[]),o=R.useCallback(()=>{const{edges:_=[]}=t.getState();return _.map(b=>({...b}))},[]),l=R.useCallback(_=>{const{edges:b=[]}=t.getState();return b.find(S=>S.id===_)},[]),u=R.useCallback(_=>{const{getNodes:b,setNodes:S,hasDefaultNodes:k,onNodesChange:N}=t.getState(),j=b(),A=typeof _=="function"?_(j):_;if(k)S(A);else if(N){const M=A.length===0?j.map(O=>({type:"remove",id:O.id})):A.map(O=>({item:O,type:"reset"}));N(M)}},[]),c=R.useCallback(_=>{const{edges:b=[],setEdges:S,hasDefaultEdges:k,onEdgesChange:N}=t.getState(),j=typeof _=="function"?_(b):_;if(k)S(j);else if(N){const A=j.length===0?b.map(M=>({type:"remove",id:M.id})):j.map(M=>({item:M,type:"reset"}));N(A)}},[]),f=R.useCallback(_=>{const b=Array.isArray(_)?_:[_],{getNodes:S,setNodes:k,hasDefaultNodes:N,onNodesChange:j}=t.getState();if(N){const M=[...S(),...b];k(M)}else if(j){const A=b.map(M=>({item:M,type:"add"}));j(A)}},[]),p=R.useCallback(_=>{const b=Array.isArray(_)?_:[_],{edges:S=[],setEdges:k,hasDefaultEdges:N,onEdgesChange:j}=t.getState();if(N)k([...S,...b]);else if(j){const A=b.map(M=>({item:M,type:"add"}));j(A)}},[]),d=R.useCallback(()=>{const{getNodes:_,edges:b=[],transform:S}=t.getState(),[k,N,j]=S;return{nodes:_().map(A=>({...A})),edges:b.map(A=>({...A})),viewport:{x:k,y:N,zoom:j}}},[]),m=R.useCallback(({nodes:_,edges:b})=>{const{nodeInternals:S,getNodes:k,edges:N,hasDefaultNodes:j,hasDefaultEdges:A,onNodesDelete:M,onEdgesDelete:O,onNodesChange:P,onEdgesChange:D}=t.getState(),L=(_||[]).map(F=>F.id),U=(b||[]).map(F=>F.id),V=k().reduce((F,$)=>{const re=$.parentNode||$.parentId,J=!L.includes($.id)&&re&&F.find(Z=>Z.id===re);return(typeof $.deletable=="boolean"?$.deletable:!0)&&(L.includes($.id)||J)&&F.push($),F},[]),z=N.filter(F=>typeof F.deletable=="boolean"?F.deletable:!0),C=z.filter(F=>U.includes(F.id));if(V||C){const F=VN(V,z),$=[...C,...F],re=$.reduce((J,W)=>(J.includes(W.id)||J.push(W.id),J),[]);if((A||j)&&(A&&t.setState({edges:N.filter(J=>!re.includes(J.id))}),j&&(V.forEach(J=>{S.delete(J.id)}),t.setState({nodeInternals:new Map(S)}))),re.length>0&&(O==null||O($),D&&D(re.map(J=>({id:J,type:"remove"})))),V.length>0&&(M==null||M(V),P)){const J=V.map(W=>({id:W.id,type:"remove"}));P(J)}}},[]),y=R.useCallback(_=>{const b=yM(_),S=b?null:t.getState().nodeInternals.get(_.id);return!b&&!S?[null,null,b]:[b?_:bx(S),S,b]},[]),w=R.useCallback((_,b=!0,S)=>{const[k,N,j]=y(_);return k?(S||t.getState().getNodes()).filter(A=>{if(!j&&(A.id===N.id||!A.positionAbsolute))return!1;const M=bx(A),O=Cv(M,k);return b&&O>0||O>=k.width*k.height}):[]},[]),E=R.useCallback((_,b,S=!0)=>{const[k]=y(_);if(!k)return!1;const N=Cv(k,b);return S&&N>0||N>=k.width*k.height},[]);return R.useMemo(()=>({...e,getNodes:r,getNode:i,getEdges:o,getEdge:l,setNodes:u,setEdges:c,addNodes:f,addEdges:p,toObject:d,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:E}),[e,r,i,o,l,u,c,f,p,d,m,w,E])}const JM={actInsideInputWithModifier:!1};var eO=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const r=jt(),{deleteElements:i}=Ma(),o=Na(e,JM),l=Na(t);R.useEffect(()=>{if(o){const{edges:u,getNodes:c}=r.getState(),f=c().filter(d=>d.selected),p=u.filter(d=>d.selected);i({nodes:f,edges:p}),r.setState({nodesSelectionActive:!1})}},[o]),R.useEffect(()=>{r.setState({multiSelectionActive:l})},[l])};function tO(e){const t=jt();R.useEffect(()=>{let r;const i=()=>{var l,u;if(!e.current)return;const o=Zv(e.current);(o.height===0||o.width===0)&&((u=(l=t.getState()).onError)==null||u.call(l,"004",zr.error004())),t.setState({width:o.width||500,height:o.height||500})};return i(),window.addEventListener("resize",i),e.current&&(r=new ResizeObserver(()=>i()),r.observe(e.current)),()=>{window.removeEventListener("resize",i),r&&e.current&&r.unobserve(e.current)}},[])}const oy={position:"absolute",width:"100%",height:"100%",top:0,left:0},nO=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,nu=e=>({x:e.x,y:e.y,zoom:e.k}),Ji=(e,t)=>e.target.closest(`.${t}`),Ix=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Mx=e=>{const t=e.ctrlKey&&Su()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},rO=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),sO=({onMove:e,onMoveStart:t,onMoveEnd:r,onPaneContextMenu:i,zoomOnScroll:o=!0,zoomOnPinch:l=!0,panOnScroll:u=!1,panOnScrollSpeed:c=.5,panOnScrollMode:f=di.Free,zoomOnDoubleClick:p=!0,elementsSelectable:d,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:E,maxZoom:_,zoomActivationKeyCode:b,preventScrolling:S=!0,children:k,noWheelClassName:N,noPanClassName:j})=>{const A=R.useRef(),M=jt(),O=R.useRef(!1),P=R.useRef(!1),D=R.useRef(null),L=R.useRef({x:0,y:0,zoom:0}),{d3Zoom:U,d3Selection:V,d3ZoomHandler:z,userSelectionActive:C}=Ke(rO,Ct),F=Na(b),$=R.useRef(0),re=R.useRef(!1),J=R.useRef();return tO(D),R.useEffect(()=>{if(D.current){const W=D.current.getBoundingClientRect(),Z=IN().scaleExtent([E,_]).translateExtent(w),I=Ln(D.current).call(Z),G=Dr.translate(y.x,y.y).scale(po(y.zoom,E,_)),K=[[0,0],[W.width,W.height]],q=Z.constrain()(G,K,w);Z.transform(I,q),Z.wheelDelta(Mx),M.setState({d3Zoom:Z,d3Selection:I,d3ZoomHandler:I.on("wheel.zoom"),transform:[q.x,q.y,q.k],domNode:D.current.closest(".react-flow")})}},[]),R.useEffect(()=>{V&&U&&(u&&!F&&!C?V.on("wheel.zoom",W=>{if(Ji(W,N))return!1;W.preventDefault(),W.stopImmediatePropagation();const Z=V.property("__zoom").k||1;if(W.ctrlKey&&l){const fe=Zn(W),te=Mx(W),ce=Z*Math.pow(2,te);U.scaleTo(V,ce,fe,W);return}const I=W.deltaMode===1?20:1;let G=f===di.Vertical?0:W.deltaX*I,K=f===di.Horizontal?0:W.deltaY*I;!Su()&&W.shiftKey&&f!==di.Vertical&&(G=W.deltaY*I,K=0),U.translateBy(V,-(G/Z)*c,-(K/Z)*c,{internal:!0});const q=nu(V.property("__zoom")),{onViewportChangeStart:Q,onViewportChange:ne,onViewportChangeEnd:ae}=M.getState();clearTimeout(J.current),re.current||(re.current=!0,t==null||t(W,q),Q==null||Q(q)),re.current&&(e==null||e(W,q),ne==null||ne(q),J.current=setTimeout(()=>{r==null||r(W,q),ae==null||ae(q),re.current=!1},150))},{passive:!1}):typeof z<"u"&&V.on("wheel.zoom",function(W,Z){if(!S&&W.type==="wheel"&&!W.ctrlKey||Ji(W,N))return null;W.preventDefault(),z.call(this,W,Z)},{passive:!1}))},[C,u,f,V,U,z,F,l,S,N,t,e,r]),R.useEffect(()=>{U&&U.on("start",W=>{var G,K;if(!W.sourceEvent||W.sourceEvent.internal)return null;$.current=(G=W.sourceEvent)==null?void 0:G.button;const{onViewportChangeStart:Z}=M.getState(),I=nu(W.transform);O.current=!0,L.current=I,((K=W.sourceEvent)==null?void 0:K.type)==="mousedown"&&M.setState({paneDragging:!0}),Z==null||Z(I),t==null||t(W.sourceEvent,I)})},[U,t]),R.useEffect(()=>{U&&(C&&!O.current?U.on("zoom",null):C||U.on("zoom",W=>{var I;const{onViewportChange:Z}=M.getState();if(M.setState({transform:[W.transform.x,W.transform.y,W.transform.k]}),P.current=!!(i&&Ix(m,$.current??0)),(e||Z)&&!((I=W.sourceEvent)!=null&&I.internal)){const G=nu(W.transform);Z==null||Z(G),e==null||e(W.sourceEvent,G)}}))},[C,U,e,m,i]),R.useEffect(()=>{U&&U.on("end",W=>{if(!W.sourceEvent||W.sourceEvent.internal)return null;const{onViewportChangeEnd:Z}=M.getState();if(O.current=!1,M.setState({paneDragging:!1}),i&&Ix(m,$.current??0)&&!P.current&&i(W.sourceEvent),P.current=!1,(r||Z)&&nO(L.current,W.transform)){const I=nu(W.transform);L.current=I,clearTimeout(A.current),A.current=setTimeout(()=>{Z==null||Z(I),r==null||r(W.sourceEvent,I)},u?150:0)}})},[U,u,m,r,i]),R.useEffect(()=>{U&&U.filter(W=>{const Z=F||o,I=l&&W.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&W.button===1&&W.type==="mousedown"&&(Ji(W,"react-flow__node")||Ji(W,"react-flow__edge")))return!0;if(!m&&!Z&&!u&&!p&&!l||C||!p&&W.type==="dblclick"||Ji(W,N)&&W.type==="wheel"||Ji(W,j)&&(W.type!=="wheel"||u&&W.type==="wheel"&&!F)||!l&&W.ctrlKey&&W.type==="wheel"||!Z&&!u&&!I&&W.type==="wheel"||!m&&(W.type==="mousedown"||W.type==="touchstart")||Array.isArray(m)&&!m.includes(W.button)&&W.type==="mousedown")return!1;const G=Array.isArray(m)&&m.includes(W.button)||!W.button||W.button<=1;return(!W.ctrlKey||W.type==="wheel")&&G})},[C,U,o,l,u,p,m,d,F]),ue.createElement("div",{className:"react-flow__renderer",ref:D,style:oy},k)},iO=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function oO(){const{userSelectionActive:e,userSelectionRect:t}=Ke(iO,Ct);return e&&t?ue.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Ox(e,t){const r=t.parentNode||t.parentId,i=e.find(o=>o.id===r);if(i){const o=t.position.x+t.width-i.width,l=t.position.y+t.height-i.height;if(o>0||l>0||t.position.x<0||t.position.y<0){if(i.style={...i.style},i.style.width=i.style.width??i.width,i.style.height=i.style.height??i.height,o>0&&(i.style.width+=o),l>0&&(i.style.height+=l),t.position.x<0){const u=Math.abs(t.position.x);i.position.x=i.position.x-u,i.style.width+=u,t.position.x=0}if(t.position.y<0){const u=Math.abs(t.position.y);i.position.y=i.position.y-u,i.style.height+=u,t.position.y=0}i.width=i.style.width,i.height=i.style.height}}}function aO(e,t){if(e.some(i=>i.type==="reset"))return e.filter(i=>i.type==="reset").map(i=>i.item);const r=e.filter(i=>i.type==="add").map(i=>i.item);return t.reduce((i,o)=>{const l=e.filter(c=>c.id===o.id);if(l.length===0)return i.push(o),i;const u={...o};for(const c of l)if(c)switch(c.type){case"select":{u.selected=c.selected;break}case"position":{typeof c.position<"u"&&(u.position=c.position),typeof c.positionAbsolute<"u"&&(u.positionAbsolute=c.positionAbsolute),typeof c.dragging<"u"&&(u.dragging=c.dragging),u.expandParent&&Ox(i,u);break}case"dimensions":{typeof c.dimensions<"u"&&(u.width=c.dimensions.width,u.height=c.dimensions.height),typeof c.updateStyle<"u"&&(u.style={...u.style||{},...c.dimensions}),typeof c.resizing=="boolean"&&(u.resizing=c.resizing),u.expandParent&&Ox(i,u);break}case"remove":return i}return i.push(u),i},r)}function lO(e,t){return aO(e,t)}const Ns=(e,t)=>({id:e,type:"select",selected:t});function so(e,t){return e.reduce((r,i)=>{const o=t.includes(i.id);return!i.selected&&o?(i.selected=!0,r.push(Ns(i.id,!0))):i.selected&&!o&&(i.selected=!1,r.push(Ns(i.id,!1))),r},[])}const Wd=(e,t)=>r=>{r.target===t.current&&(e==null||e(r))},uO=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),uC=R.memo(({isSelecting:e,selectionMode:t=Ea.Full,panOnDrag:r,onSelectionStart:i,onSelectionEnd:o,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:c,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:d,children:m})=>{const y=R.useRef(null),w=jt(),E=R.useRef(0),_=R.useRef(0),b=R.useRef(),{userSelectionActive:S,elementsSelectable:k,dragging:N}=Ke(uO,Ct),j=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),E.current=0,_.current=0},A=z=>{l==null||l(z),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},M=z=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){z.preventDefault();return}u==null||u(z)},O=c?z=>c(z):void 0,P=z=>{const{resetSelectedElements:C,domNode:F}=w.getState();if(b.current=F==null?void 0:F.getBoundingClientRect(),!k||!e||z.button!==0||z.target!==y.current||!b.current)return;const{x:$,y:re}=js(z,b.current);C(),w.setState({userSelectionRect:{width:0,height:0,startX:$,startY:re,x:$,y:re}}),i==null||i(z)},D=z=>{const{userSelectionRect:C,nodeInternals:F,edges:$,transform:re,onNodesChange:J,onEdgesChange:W,nodeOrigin:Z,getNodes:I}=w.getState();if(!e||!b.current||!C)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=js(z,b.current),K=C.startX??0,q=C.startY??0,Q={...C,x:G.x<K?G.x:K,y:G.y<q?G.y:q,width:Math.abs(G.x-K),height:Math.abs(G.y-q)},ne=I(),ae=WN(F,Q,re,t===Ea.Partial,!0,Z),fe=VN(ae,$).map(ce=>ce.id),te=ae.map(ce=>ce.id);if(E.current!==te.length){E.current=te.length;const ce=so(ne,te);ce.length&&(J==null||J(ce))}if(_.current!==fe.length){_.current=fe.length;const ce=so($,fe);ce.length&&(W==null||W(ce))}w.setState({userSelectionRect:Q})},L=z=>{if(z.button!==0)return;const{userSelectionRect:C}=w.getState();!S&&C&&z.target===y.current&&(A==null||A(z)),w.setState({nodesSelectionActive:E.current>0}),j(),o==null||o(z)},U=z=>{S&&(w.setState({nodesSelectionActive:E.current>0}),o==null||o(z)),j()},V=k&&(e||S);return ue.createElement("div",{className:Ft(["react-flow__pane",{dragging:N,selection:e}]),onClick:V?void 0:Wd(A,y),onContextMenu:Wd(M,y),onWheel:Wd(O,y),onMouseEnter:V?void 0:f,onMouseDown:V?P:void 0,onMouseMove:V?D:p,onMouseUp:V?L:void 0,onMouseLeave:V?U:d,ref:y,style:oy},m,ue.createElement(oO,null))});uC.displayName="Pane";function cC(e,t){const r=e.parentNode||e.parentId;if(!r)return!1;const i=t.get(r);return i?i.selected?!0:cC(i,t):!1}function Px(e,t,r){let i=e;do{if(i!=null&&i.matches(t))return!0;if(i===r.current)return!1;i=i.parentElement}while(i);return!1}function cO(e,t,r,i){return Array.from(e.values()).filter(o=>(o.selected||o.id===i)&&(!o.parentNode||o.parentId||!cC(o,e))&&(o.draggable||t&&typeof o.draggable>"u")).map(o=>{var l,u;return{id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:r.x-(((l=o.positionAbsolute)==null?void 0:l.x)??0),y:r.y-(((u=o.positionAbsolute)==null?void 0:u.y)??0)},delta:{x:0,y:0},extent:o.extent,parentNode:o.parentNode||o.parentId,parentId:o.parentNode||o.parentId,width:o.width,height:o.height,expandParent:o.expandParent}})}function dO(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function dC(e,t,r,i,o=[0,0],l){const u=dO(e,e.extent||i);let c=u;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const m=r.get(f),{x:y,y:w}=hi(m,o).positionAbsolute;c=m&&$n(y)&&$n(w)&&$n(m.width)&&$n(m.height)?[[y+e.width*o[0],w+e.height*o[1]],[y+m.width-e.width+e.width*o[0],w+m.height-e.height+e.height*o[1]]]:c}else l==null||l("005",zr.error005()),c=u;else if(e.extent&&f&&e.extent!=="parent"){const m=r.get(f),{x:y,y:w}=hi(m,o).positionAbsolute;c=[[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=r.get(f);p=hi(m,o).positionAbsolute}const d=c&&c!=="parent"?Jv(t,c):t;return{position:{x:d.x-p.x,y:d.y-p.y},positionAbsolute:d}}function Vd({nodeId:e,dragItems:t,nodeInternals:r}){const i=t.map(o=>({...r.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[e?i.find(o=>o.id===e):i[0],i]}const Lx=(e,t,r,i)=>{const o=t.querySelectorAll(e);if(!o||!o.length)return null;const l=Array.from(o),u=t.getBoundingClientRect(),c={x:u.width*i[0],y:u.height*i[1]};return l.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-u.left-c.x)/r,y:(p.top-u.top-c.y)/r,...Zv(f)}})};function la(e,t,r){return r===void 0?r:i=>{const o=t().nodeInternals.get(e);o&&r(i,{...o})}}function Mv({id:e,store:t,unselect:r=!1,nodeRef:i}){const{addSelectedNodes:o,unselectNodesAndEdges:l,multiSelectionActive:u,nodeInternals:c,onError:f}=t.getState(),p=c.get(e);if(!p){f==null||f("012",zr.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(r||p.selected&&u)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):o([e])}function fO(){const e=jt();return R.useCallback(({sourceEvent:r})=>{const{transform:i,snapGrid:o,snapToGrid:l}=e.getState(),u=r.touches?r.touches[0].clientX:r.clientX,c=r.touches?r.touches[0].clientY:r.clientY,f={x:(u-i[0])/i[2],y:(c-i[1])/i[2]};return{xSnapped:l?o[0]*Math.round(f.x/o[0]):f.x,ySnapped:l?o[1]*Math.round(f.y/o[1]):f.y,...f}},[])}function Gd(e){return(t,r,i)=>e==null?void 0:e(t,i)}function fC({nodeRef:e,disabled:t=!1,noDragClassName:r,handleSelector:i,nodeId:o,isSelectable:l,selectNodesOnDrag:u}){const c=jt(),[f,p]=R.useState(!1),d=R.useRef([]),m=R.useRef({x:null,y:null}),y=R.useRef(0),w=R.useRef(null),E=R.useRef({x:0,y:0}),_=R.useRef(null),b=R.useRef(!1),S=R.useRef(!1),k=R.useRef(!1),N=fO();return R.useEffect(()=>{if(e!=null&&e.current){const j=Ln(e.current),A=({x:P,y:D})=>{const{nodeInternals:L,onNodeDrag:U,onSelectionDrag:V,updateNodePositions:z,nodeExtent:C,snapGrid:F,snapToGrid:$,nodeOrigin:re,onError:J}=c.getState();m.current={x:P,y:D};let W=!1,Z={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&C){const G=qu(d.current,re);Z=ka(G)}if(d.current=d.current.map(G=>{const K={x:P-G.distance.x,y:D-G.distance.y};$&&(K.x=F[0]*Math.round(K.x/F[0]),K.y=F[1]*Math.round(K.y/F[1]));const q=[[C[0][0],C[0][1]],[C[1][0],C[1][1]]];d.current.length>1&&C&&!G.extent&&(q[0][0]=G.positionAbsolute.x-Z.x+C[0][0],q[1][0]=G.positionAbsolute.x+(G.width??0)-Z.x2+C[1][0],q[0][1]=G.positionAbsolute.y-Z.y+C[0][1],q[1][1]=G.positionAbsolute.y+(G.height??0)-Z.y2+C[1][1]);const Q=dC(G,K,L,q,re,J);return W=W||G.position.x!==Q.position.x||G.position.y!==Q.position.y,G.position=Q.position,G.positionAbsolute=Q.positionAbsolute,G}),!W)return;z(d.current,!0,!0),p(!0);const I=o?U:Gd(V);if(I&&_.current){const[G,K]=Vd({nodeId:o,dragItems:d.current,nodeInternals:L});I(_.current,G,K)}},M=()=>{if(!w.current)return;const[P,D]=ON(E.current,w.current);if(P!==0||D!==0){const{transform:L,panBy:U}=c.getState();m.current.x=(m.current.x??0)-P/L[2],m.current.y=(m.current.y??0)-D/L[2],U({x:P,y:D})&&A(m.current)}y.current=requestAnimationFrame(M)},O=P=>{var re;const{nodeInternals:D,multiSelectionActive:L,nodesDraggable:U,unselectNodesAndEdges:V,onNodeDragStart:z,onSelectionDragStart:C}=c.getState();S.current=!0;const F=o?z:Gd(C);(!u||!l)&&!L&&o&&((re=D.get(o))!=null&&re.selected||V()),o&&l&&u&&Mv({id:o,store:c,nodeRef:e});const $=N(P);if(m.current=$,d.current=cO(D,U,$,o),F&&d.current){const[J,W]=Vd({nodeId:o,dragItems:d.current,nodeInternals:D});F(P.sourceEvent,J,W)}};if(t)j.on(".drag",null);else{const P=_2().on("start",D=>{const{domNode:L,nodeDragThreshold:U}=c.getState();U===0&&O(D),k.current=!1;const V=N(D);m.current=V,w.current=(L==null?void 0:L.getBoundingClientRect())||null,E.current=js(D.sourceEvent,w.current)}).on("drag",D=>{var z,C;const L=N(D),{autoPanOnNodeDrag:U,nodeDragThreshold:V}=c.getState();if(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1&&(k.current=!0),!k.current){if(!b.current&&S.current&&U&&(b.current=!0,M()),!S.current){const F=L.xSnapped-(((z=m==null?void 0:m.current)==null?void 0:z.x)??0),$=L.ySnapped-(((C=m==null?void 0:m.current)==null?void 0:C.y)??0);Math.sqrt(F*F+$*$)>V&&O(D)}(m.current.x!==L.xSnapped||m.current.y!==L.ySnapped)&&d.current&&S.current&&(_.current=D.sourceEvent,E.current=js(D.sourceEvent,w.current),A(L))}}).on("end",D=>{if(!(!S.current||k.current)&&(p(!1),b.current=!1,S.current=!1,cancelAnimationFrame(y.current),d.current)){const{updateNodePositions:L,nodeInternals:U,onNodeDragStop:V,onSelectionDragStop:z}=c.getState(),C=o?V:Gd(z);if(L(d.current,!1,!1),C){const[F,$]=Vd({nodeId:o,dragItems:d.current,nodeInternals:U});C(D.sourceEvent,F,$)}}}).filter(D=>{const L=D.target;return!D.button&&(!r||!Px(L,`.${r}`,e))&&(!i||Px(L,i,e))});return j.call(P),()=>{j.on(".drag",null)}}}},[e,t,r,i,l,c,o,u,N]),f}function hC(){const e=jt();return R.useCallback(r=>{const{nodeInternals:i,nodeExtent:o,updateNodePositions:l,getNodes:u,snapToGrid:c,snapGrid:f,onError:p,nodesDraggable:d}=e.getState(),m=u().filter(k=>k.selected&&(k.draggable||d&&typeof k.draggable>"u")),y=c?f[0]:5,w=c?f[1]:5,E=r.isShiftPressed?4:1,_=r.x*y*E,b=r.y*w*E,S=m.map(k=>{if(k.positionAbsolute){const N={x:k.positionAbsolute.x+_,y:k.positionAbsolute.y+b};c&&(N.x=f[0]*Math.round(N.x/f[0]),N.y=f[1]*Math.round(N.y/f[1]));const{positionAbsolute:j,position:A}=dC(k,N,i,o,void 0,p);k.position=A,k.positionAbsolute=j}return k});l(S,!0,!1)},[])}const uo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ua=e=>{const t=({id:r,type:i,data:o,xPos:l,yPos:u,xPosOrigin:c,yPosOrigin:f,selected:p,onClick:d,onMouseEnter:m,onMouseMove:y,onMouseLeave:w,onContextMenu:E,onDoubleClick:_,style:b,className:S,isDraggable:k,isSelectable:N,isConnectable:j,isFocusable:A,selectNodesOnDrag:M,sourcePosition:O,targetPosition:P,hidden:D,resizeObserver:L,dragHandle:U,zIndex:V,isParent:z,noDragClassName:C,noPanClassName:F,initialized:$,disableKeyboardA11y:re,ariaLabel:J,rfId:W,hasHandleBounds:Z})=>{const I=jt(),G=R.useRef(null),K=R.useRef(null),q=R.useRef(O),Q=R.useRef(P),ne=R.useRef(i),ae=N||k||d||m||y||w,fe=hC(),te=la(r,I.getState,m),ce=la(r,I.getState,y),Ce=la(r,I.getState,w),ve=la(r,I.getState,E),Re=la(r,I.getState,_),ye=we=>{const{nodeDragThreshold:_e}=I.getState();if(N&&(!M||!k||_e>0)&&Mv({id:r,store:I,nodeRef:G}),d){const Be=I.getState().nodeInternals.get(r);Be&&d(we,{...Be})}},Ee=we=>{if(!jv(we)&&!re)if(qN.includes(we.key)&&N){const _e=we.key==="Escape";Mv({id:r,store:I,unselect:_e,nodeRef:G})}else k&&p&&Object.prototype.hasOwnProperty.call(uo,we.key)&&(I.setState({ariaLiveMessage:`Moved selected node ${we.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~u}`}),fe({x:uo[we.key].x,y:uo[we.key].y,isShiftPressed:we.shiftKey}))};R.useEffect(()=>()=>{K.current&&(L==null||L.unobserve(K.current),K.current=null)},[]),R.useEffect(()=>{if(G.current&&!D){const we=G.current;(!$||!Z||K.current!==we)&&(K.current&&(L==null||L.unobserve(K.current)),L==null||L.observe(we),K.current=we)}},[D,$,Z]),R.useEffect(()=>{const we=ne.current!==i,_e=q.current!==O,Be=Q.current!==P;G.current&&(we||_e||Be)&&(we&&(ne.current=i),_e&&(q.current=O),Be&&(Q.current=P),I.getState().updateNodeDimensions([{id:r,nodeElement:G.current,forceUpdate:!0}]))},[r,i,O,P]);const Ye=fC({nodeRef:G,disabled:D||!k,noDragClassName:C,handleSelector:U,nodeId:r,isSelectable:N,selectNodesOnDrag:M});return D?null:ue.createElement("div",{className:Ft(["react-flow__node",`react-flow__node-${i}`,{[F]:k},S,{selected:p,selectable:N,parent:z,dragging:Ye}]),ref:G,style:{zIndex:V,transform:`translate(${c}px,${f}px)`,pointerEvents:ae?"all":"none",visibility:$?"visible":"hidden",...b},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:te,onMouseMove:ce,onMouseLeave:Ce,onContextMenu:ve,onClick:ye,onDoubleClick:Re,onKeyDown:A?Ee:void 0,tabIndex:A?0:void 0,role:A?"button":void 0,"aria-describedby":re?void 0:`${sC}-${W}`,"aria-label":J},ue.createElement(EM,{value:r},ue.createElement(e,{id:r,data:o,type:i,xPos:l,yPos:u,selected:p,isConnectable:j,sourcePosition:O,targetPosition:P,dragging:Ye,dragHandle:U,zIndex:V})))};return t.displayName="NodeWrapper",R.memo(t)};const hO=e=>{const t=e.getNodes().filter(r=>r.selected);return{...qu(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function pO({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:r}){const i=jt(),{width:o,height:l,x:u,y:c,transformString:f,userSelectionActive:p}=Ke(hO,Ct),d=hC(),m=R.useRef(null);if(R.useEffect(()=>{var E;r||(E=m.current)==null||E.focus({preventScroll:!0})},[r]),fC({nodeRef:m}),p||!o||!l)return null;const y=e?E=>{const _=i.getState().getNodes().filter(b=>b.selected);e(E,_)}:void 0,w=E=>{Object.prototype.hasOwnProperty.call(uo,E.key)&&d({x:uo[E.key].x,y:uo[E.key].y,isShiftPressed:E.shiftKey})};return ue.createElement("div",{className:Ft(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},ue.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:r?void 0:-1,onKeyDown:r?void 0:w,style:{width:o,height:l,top:c,left:u}}))}var mO=R.memo(pO);const gO=e=>e.nodesSelectionActive,pC=({children:e,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,deleteKeyCode:c,onMove:f,onMoveStart:p,onMoveEnd:d,selectionKeyCode:m,selectionOnDrag:y,selectionMode:w,onSelectionStart:E,onSelectionEnd:_,multiSelectionKeyCode:b,panActivationKeyCode:S,zoomActivationKeyCode:k,elementsSelectable:N,zoomOnScroll:j,zoomOnPinch:A,panOnScroll:M,panOnScrollSpeed:O,panOnScrollMode:P,zoomOnDoubleClick:D,panOnDrag:L,defaultViewport:U,translateExtent:V,minZoom:z,maxZoom:C,preventScrolling:F,onSelectionContextMenu:$,noWheelClassName:re,noPanClassName:J,disableKeyboardA11y:W})=>{const Z=Ke(gO),I=Na(m),G=Na(S),K=G||L,q=G||M,Q=I||y&&K!==!0;return eO({deleteKeyCode:c,multiSelectionKeyCode:b}),ue.createElement(sO,{onMove:f,onMoveStart:p,onMoveEnd:d,onPaneContextMenu:l,elementsSelectable:N,zoomOnScroll:j,zoomOnPinch:A,panOnScroll:q,panOnScrollSpeed:O,panOnScrollMode:P,zoomOnDoubleClick:D,panOnDrag:!I&&K,defaultViewport:U,translateExtent:V,minZoom:z,maxZoom:C,zoomActivationKeyCode:k,preventScrolling:F,noWheelClassName:re,noPanClassName:J},ue.createElement(uC,{onSelectionStart:E,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:K,isSelecting:!!Q,selectionMode:w},e,Z&&ue.createElement(mO,{onSelectionContextMenu:$,noPanClassName:J,disableKeyboardA11y:W})))};pC.displayName="FlowRenderer";var vO=R.memo(pC);function yO(e){return Ke(R.useCallback(r=>e?WN(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function wO(e){const t={input:ua(e.input||eC),default:ua(e.default||Iv),output:ua(e.output||nC),group:ua(e.group||iy)},r={},i=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,l)=>(o[l]=ua(e[l]||Iv),o),r);return{...t,...i}}const xO=({x:e,y:t,width:r,height:i,origin:o})=>!r||!i?{x:e,y:t}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:t}:{x:e-r*o[0],y:t-i*o[1]},_O=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),mC=e=>{const{nodesDraggable:t,nodesConnectable:r,nodesFocusable:i,elementsSelectable:o,updateNodeDimensions:l,onError:u}=Ke(_O,Ct),c=yO(e.onlyRenderVisibleElements),f=R.useRef(),p=R.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const d=new ResizeObserver(m=>{const y=m.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));l(y)});return f.current=d,d},[]);return R.useEffect(()=>()=>{var d;(d=f==null?void 0:f.current)==null||d.disconnect()},[]),ue.createElement("div",{className:"react-flow__nodes",style:oy},c.map(d=>{var A,M,O;let m=d.type||"default";e.nodeTypes[m]||(u==null||u("003",zr.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,w=!!(d.draggable||t&&typeof d.draggable>"u"),E=!!(d.selectable||o&&typeof d.selectable>"u"),_=!!(d.connectable||r&&typeof d.connectable>"u"),b=!!(d.focusable||i&&typeof d.focusable>"u"),S=e.nodeExtent?Jv(d.positionAbsolute,e.nodeExtent):d.positionAbsolute,k=(S==null?void 0:S.x)??0,N=(S==null?void 0:S.y)??0,j=xO({x:k,y:N,width:d.width??0,height:d.height??0,origin:e.nodeOrigin});return ue.createElement(y,{key:d.id,id:d.id,className:d.className,style:d.style,type:m,data:d.data,sourcePosition:d.sourcePosition||Ae.Bottom,targetPosition:d.targetPosition||Ae.Top,hidden:d.hidden,xPos:k,yPos:N,xPosOrigin:j.x,yPosOrigin:j.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!d.selected,isDraggable:w,isSelectable:E,isConnectable:_,isFocusable:b,resizeObserver:p,dragHandle:d.dragHandle,zIndex:((A=d[gt])==null?void 0:A.z)??0,isParent:!!((M=d[gt])!=null&&M.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!d.width&&!!d.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:d.ariaLabel,hasHandleBounds:!!((O=d[gt])!=null&&O.handleBounds)})}))};mC.displayName="NodeRenderer";var bO=R.memo(mC);const SO=(e,t,r)=>r===Ae.Left?e-t:r===Ae.Right?e+t:e,kO=(e,t,r)=>r===Ae.Top?e-t:r===Ae.Bottom?e+t:e,$x="react-flow__edgeupdater",qx=({position:e,centerX:t,centerY:r,radius:i=10,onMouseDown:o,onMouseEnter:l,onMouseOut:u,type:c})=>ue.createElement("circle",{onMouseDown:o,onMouseEnter:l,onMouseOut:u,className:Ft([$x,`${$x}-${c}`]),cx:SO(t,i,e),cy:kO(r,i,e),r:i,stroke:"transparent",fill:"transparent"}),EO=()=>!0;var eo=e=>{const t=({id:r,className:i,type:o,data:l,onClick:u,onEdgeDoubleClick:c,selected:f,animated:p,label:d,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:E,labelBgBorderRadius:_,style:b,source:S,target:k,sourceX:N,sourceY:j,targetX:A,targetY:M,sourcePosition:O,targetPosition:P,elementsSelectable:D,hidden:L,sourceHandleId:U,targetHandleId:V,onContextMenu:z,onMouseEnter:C,onMouseMove:F,onMouseLeave:$,reconnectRadius:re,onReconnect:J,onReconnectStart:W,onReconnectEnd:Z,markerEnd:I,markerStart:G,rfId:K,ariaLabel:q,isFocusable:Q,isReconnectable:ne,pathOptions:ae,interactionWidth:fe,disableKeyboardA11y:te})=>{const ce=R.useRef(null),[Ce,ve]=R.useState(!1),[Re,ye]=R.useState(!1),Ee=jt(),Ye=R.useMemo(()=>`url('#${Rv(G,K)}')`,[G,K]),we=R.useMemo(()=>`url('#${Rv(I,K)}')`,[I,K]);if(L)return null;const _e=et=>{var Lt;const{edges:bt,addSelectedEdges:ht,unselectNodesAndEdges:vt,multiSelectionActive:hn}=Ee.getState(),Yt=bt.find(bn=>bn.id===r);Yt&&(D&&(Ee.setState({nodesSelectionActive:!1}),Yt.selected&&hn?(vt({nodes:[],edges:[Yt]}),(Lt=ce.current)==null||Lt.blur()):ht([r])),u&&u(et,Yt))},Be=aa(r,Ee.getState,c),it=aa(r,Ee.getState,z),ft=aa(r,Ee.getState,C),Ze=aa(r,Ee.getState,F),De=aa(r,Ee.getState,$),Je=(et,bt)=>{if(et.button!==0)return;const{edges:ht,isValidConnection:vt}=Ee.getState(),hn=bt?k:S,Yt=(bt?V:U)||null,Lt=bt?"target":"source",bn=vt||EO,gr=bt,Sn=ht.find(pn=>pn.id===r);ye(!0),W==null||W(et,Sn,Lt);const Bt=pn=>{ye(!1),Z==null||Z(pn,Sn,Lt)};XN({event:et,handleId:Yt,nodeId:hn,onConnect:pn=>J==null?void 0:J(Sn,pn),isTarget:gr,getState:Ee.getState,setState:Ee.setState,isValidConnection:bn,edgeUpdaterType:Lt,onReconnectEnd:Bt})},Xe=et=>Je(et,!0),Ot=et=>Je(et,!1),lt=()=>ve(!0),Qe=()=>ve(!1),Pt=!D&&!u,zt=et=>{var bt;if(!te&&qN.includes(et.key)&&D){const{unselectNodesAndEdges:ht,addSelectedEdges:vt,edges:hn}=Ee.getState();et.key==="Escape"?((bt=ce.current)==null||bt.blur(),ht({edges:[hn.find(Lt=>Lt.id===r)]})):vt([r])}};return ue.createElement("g",{className:Ft(["react-flow__edge",`react-flow__edge-${o}`,i,{selected:f,animated:p,inactive:Pt,updating:Ce}]),onClick:_e,onDoubleClick:Be,onContextMenu:it,onMouseEnter:ft,onMouseMove:Ze,onMouseLeave:De,onKeyDown:Q?zt:void 0,tabIndex:Q?0:void 0,role:Q?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":q===null?void 0:q||`Edge from ${S} to ${k}`,"aria-describedby":Q?`${iC}-${K}`:void 0,ref:ce},!Re&&ue.createElement(e,{id:r,source:S,target:k,selected:f,animated:p,label:d,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:E,labelBgBorderRadius:_,data:l,style:b,sourceX:N,sourceY:j,targetX:A,targetY:M,sourcePosition:O,targetPosition:P,sourceHandleId:U,targetHandleId:V,markerStart:Ye,markerEnd:we,pathOptions:ae,interactionWidth:fe}),ne&&ue.createElement(ue.Fragment,null,(ne==="source"||ne===!0)&&ue.createElement(qx,{position:O,centerX:N,centerY:j,radius:re,onMouseDown:Xe,onMouseEnter:lt,onMouseOut:Qe,type:"source"}),(ne==="target"||ne===!0)&&ue.createElement(qx,{position:P,centerX:A,centerY:M,radius:re,onMouseDown:Ot,onMouseEnter:lt,onMouseOut:Qe,type:"target"})))};return t.displayName="EdgeWrapper",R.memo(t)};function NO(e){const t={default:eo(e.default||Eu),straight:eo(e.bezier||ny),step:eo(e.step||ty),smoothstep:eo(e.step||$u),simplebezier:eo(e.simplebezier||ey)},r={},i=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,l)=>(o[l]=eo(e[l]||Eu),o),r);return{...t,...i}}function Dx(e,t,r=null){const i=((r==null?void 0:r.x)||0)+t.x,o=((r==null?void 0:r.y)||0)+t.y,l=(r==null?void 0:r.width)||t.width,u=(r==null?void 0:r.height)||t.height;switch(e){case Ae.Top:return{x:i+l/2,y:o};case Ae.Right:return{x:i+l,y:o+u/2};case Ae.Bottom:return{x:i+l/2,y:o+u};case Ae.Left:return{x:i,y:o+u/2}}}function Fx(e,t){return e?e.length===1||!t?e[0]:t&&e.find(r=>r.id===t)||null:null}const CO=(e,t,r,i,o,l)=>{const u=Dx(r,e,t),c=Dx(l,i,o);return{sourceX:u.x,sourceY:u.y,targetX:c.x,targetY:c.y}};function jO({sourcePos:e,targetPos:t,sourceWidth:r,sourceHeight:i,targetWidth:o,targetHeight:l,width:u,height:c,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+r,t.x+o),y2:Math.max(e.y+i,t.y+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const d=ka({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:u/f[2],height:c/f[2]}),m=Math.max(0,Math.min(d.x2,p.x2)-Math.max(d.x,p.x)),y=Math.max(0,Math.min(d.y2,p.y2)-Math.max(d.y,p.y));return Math.ceil(m*y)>0}function zx(e){var i,o,l,u,c;const t=((i=e==null?void 0:e[gt])==null?void 0:i.handleBounds)||null,r=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.x)<"u"&&typeof((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)<"u";return[{x:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.x)||0,y:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!r]}const TO=[{level:0,isMaxLevel:!0,edges:[]}];function RO(e,t,r=!1){let i=-1;const o=e.reduce((u,c)=>{var d,m;const f=$n(c.zIndex);let p=f?c.zIndex:0;if(r){const y=t.get(c.target),w=t.get(c.source),E=c.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),_=Math.max(((d=w==null?void 0:w[gt])==null?void 0:d.z)||0,((m=y==null?void 0:y[gt])==null?void 0:m.z)||0,1e3);p=(f?c.zIndex:0)+(E?_:0)}return u[p]?u[p].push(c):u[p]=[c],i=p>i?p:i,u},{}),l=Object.entries(o).map(([u,c])=>{const f=+u;return{edges:c,level:f,isMaxLevel:f===i}});return l.length===0?TO:l}function AO(e,t,r){const i=Ke(R.useCallback(o=>e?o.edges.filter(l=>{const u=t.get(l.source),c=t.get(l.target);return(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&jO({sourcePos:u.positionAbsolute||{x:0,y:0},targetPos:c.positionAbsolute||{x:0,y:0},sourceWidth:u.width,sourceHeight:u.height,targetWidth:c.width,targetHeight:c.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[e,t]));return RO(i,t,r)}const IO=({color:e="none",strokeWidth:t=1})=>ue.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),MO=({color:e="none",strokeWidth:t=1})=>ue.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Bx={[ku.Arrow]:IO,[ku.ArrowClosed]:MO};function OO(e){const t=jt();return R.useMemo(()=>{var o,l;return Object.prototype.hasOwnProperty.call(Bx,e)?Bx[e]:((l=(o=t.getState()).onError)==null||l.call(o,"009",zr.error009(e)),null)},[e])}const PO=({id:e,type:t,color:r,width:i=12.5,height:o=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:c="auto-start-reverse"})=>{const f=OO(t);return f?ue.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:c,refX:"0",refY:"0"},ue.createElement(f,{color:r,strokeWidth:u})):null},LO=({defaultColor:e,rfId:t})=>r=>{const i=[];return r.edges.reduce((o,l)=>([l.markerStart,l.markerEnd].forEach(u=>{if(u&&typeof u=="object"){const c=Rv(u,t);i.includes(c)||(o.push({id:c,color:u.color||e,...u}),i.push(c))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))},gC=({defaultColor:e,rfId:t})=>{const r=Ke(R.useCallback(LO({defaultColor:e,rfId:t}),[e,t]),(i,o)=>!(i.length!==o.length||i.some((l,u)=>l.id!==o[u].id)));return ue.createElement("defs",null,r.map(i=>ue.createElement(PO,{id:i.id,key:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient})))};gC.displayName="MarkerDefinitions";var $O=R.memo(gC);const qO=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}),vC=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:r,rfId:i,edgeTypes:o,noPanClassName:l,onEdgeContextMenu:u,onEdgeMouseEnter:c,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:d,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:E,reconnectRadius:_,children:b,disableKeyboardA11y:S})=>{const{edgesFocusable:k,edgesUpdatable:N,elementsSelectable:j,width:A,height:M,connectionMode:O,nodeInternals:P,onError:D}=Ke(qO,Ct),L=AO(t,P,r);return A?ue.createElement(ue.Fragment,null,L.map(({level:U,edges:V,isMaxLevel:z})=>ue.createElement("svg",{key:U,style:{zIndex:U},width:A,height:M,className:"react-flow__edges react-flow__container"},z&&ue.createElement($O,{defaultColor:e,rfId:i}),ue.createElement("g",null,V.map(C=>{const[F,$,re]=zx(P.get(C.source)),[J,W,Z]=zx(P.get(C.target));if(!re||!Z)return null;let I=C.type||"default";o[I]||(D==null||D("011",zr.error011(I)),I="default");const G=o[I]||o.default,K=O===mi.Strict?W.target:(W.target??[]).concat(W.source??[]),q=Fx($.source,C.sourceHandle),Q=Fx(K,C.targetHandle),ne=(q==null?void 0:q.position)||Ae.Bottom,ae=(Q==null?void 0:Q.position)||Ae.Top,fe=!!(C.focusable||k&&typeof C.focusable>"u"),te=C.reconnectable||C.updatable,ce=typeof y<"u"&&(te||N&&typeof te>"u");if(!q||!Q)return D==null||D("008",zr.error008(q,C)),null;const{sourceX:Ce,sourceY:ve,targetX:Re,targetY:ye}=CO(F,q,ne,J,Q,ae);return ue.createElement(G,{key:C.id,id:C.id,className:Ft([C.className,l]),type:I,data:C.data,selected:!!C.selected,animated:!!C.animated,hidden:!!C.hidden,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,style:C.style,source:C.source,target:C.target,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerEnd:C.markerEnd,markerStart:C.markerStart,sourceX:Ce,sourceY:ve,targetX:Re,targetY:ye,sourcePosition:ne,targetPosition:ae,elementsSelectable:j,onContextMenu:u,onMouseEnter:c,onMouseMove:f,onMouseLeave:p,onClick:d,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:E,reconnectRadius:_,rfId:i,ariaLabel:C.ariaLabel,isFocusable:fe,isReconnectable:ce,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth,disableKeyboardA11y:S})})))),b):null};vC.displayName="EdgeRenderer";var DO=R.memo(vC);const FO=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function zO({children:e}){const t=Ke(FO);return ue.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function BO(e){const t=Ma(),r=R.useRef(!1);R.useEffect(()=>{!r.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),r.current=!0)},[e,t.viewportInitialized])}const UO={[Ae.Left]:Ae.Right,[Ae.Right]:Ae.Left,[Ae.Top]:Ae.Bottom,[Ae.Bottom]:Ae.Top},yC=({nodeId:e,handleType:t,style:r,type:i=Cs.Bezier,CustomComponent:o,connectionStatus:l})=>{var M,O,P;const{fromNode:u,handleId:c,toX:f,toY:p,connectionMode:d}=Ke(R.useCallback(D=>({fromNode:D.nodeInternals.get(e),handleId:D.connectionHandleId,toX:(D.connectionPosition.x-D.transform[0])/D.transform[2],toY:(D.connectionPosition.y-D.transform[1])/D.transform[2],connectionMode:D.connectionMode}),[e]),Ct),m=(M=u==null?void 0:u[gt])==null?void 0:M.handleBounds;let y=m==null?void 0:m[t];if(d===mi.Loose&&(y=y||(m==null?void 0:m[t==="source"?"target":"source"])),!u||!y)return null;const w=c?y.find(D=>D.id===c):y[0],E=w?w.x+w.width/2:(u.width??0)/2,_=w?w.y+w.height/2:u.height??0,b=(((O=u.positionAbsolute)==null?void 0:O.x)??0)+E,S=(((P=u.positionAbsolute)==null?void 0:P.y)??0)+_,k=w==null?void 0:w.position,N=k?UO[k]:null;if(!k||!N)return null;if(o)return ue.createElement(o,{connectionLineType:i,connectionLineStyle:r,fromNode:u,fromHandle:w,fromX:b,fromY:S,toX:f,toY:p,fromPosition:k,toPosition:N,connectionStatus:l});let j="";const A={sourceX:b,sourceY:S,sourcePosition:k,targetX:f,targetY:p,targetPosition:N};return i===Cs.Bezier?[j]=UN(A):i===Cs.Step?[j]=Tv({...A,borderRadius:0}):i===Cs.SmoothStep?[j]=Tv(A):i===Cs.SimpleBezier?[j]=BN(A):j=`M${b},${S} ${f},${p}`,ue.createElement("path",{d:j,fill:"none",className:"react-flow__connection-path",style:r})};yC.displayName="ConnectionLine";const HO=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function WO({containerStyle:e,style:t,type:r,component:i}){const{nodeId:o,handleType:l,nodesConnectable:u,width:c,height:f,connectionStatus:p}=Ke(HO,Ct);return!(o&&l&&c&&u)?null:ue.createElement("svg",{style:e,width:c,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},ue.createElement("g",{className:Ft(["react-flow__connection",p])},ue.createElement(yC,{nodeId:o,handleType:l,style:t,type:r,CustomComponent:i,connectionStatus:p})))}function Ux(e,t){return R.useRef(null),jt(),R.useMemo(()=>t(e),[e])}const wC=({nodeTypes:e,edgeTypes:t,onMove:r,onMoveStart:i,onMoveEnd:o,onInit:l,onNodeClick:u,onEdgeClick:c,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:d,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:E,onSelectionStart:_,onSelectionEnd:b,connectionLineType:S,connectionLineStyle:k,connectionLineComponent:N,connectionLineContainerStyle:j,selectionKeyCode:A,selectionOnDrag:M,selectionMode:O,multiSelectionKeyCode:P,panActivationKeyCode:D,zoomActivationKeyCode:L,deleteKeyCode:U,onlyRenderVisibleElements:V,elementsSelectable:z,selectNodesOnDrag:C,defaultViewport:F,translateExtent:$,minZoom:re,maxZoom:J,preventScrolling:W,defaultMarkerColor:Z,zoomOnScroll:I,zoomOnPinch:G,panOnScroll:K,panOnScrollSpeed:q,panOnScrollMode:Q,zoomOnDoubleClick:ne,panOnDrag:ae,onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneScroll:ve,onPaneContextMenu:Re,onEdgeContextMenu:ye,onEdgeMouseEnter:Ee,onEdgeMouseMove:Ye,onEdgeMouseLeave:we,onReconnect:_e,onReconnectStart:Be,onReconnectEnd:it,reconnectRadius:ft,noDragClassName:Ze,noWheelClassName:De,noPanClassName:Je,elevateEdgesOnSelect:Xe,disableKeyboardA11y:Ot,nodeOrigin:lt,nodeExtent:Qe,rfId:Pt})=>{const zt=Ux(e,wO),et=Ux(t,NO);return BO(l),ue.createElement(vO,{onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneContextMenu:Re,onPaneScroll:ve,deleteKeyCode:U,selectionKeyCode:A,selectionOnDrag:M,selectionMode:O,onSelectionStart:_,onSelectionEnd:b,multiSelectionKeyCode:P,panActivationKeyCode:D,zoomActivationKeyCode:L,elementsSelectable:z,onMove:r,onMoveStart:i,onMoveEnd:o,zoomOnScroll:I,zoomOnPinch:G,zoomOnDoubleClick:ne,panOnScroll:K,panOnScrollSpeed:q,panOnScrollMode:Q,panOnDrag:ae,defaultViewport:F,translateExtent:$,minZoom:re,maxZoom:J,onSelectionContextMenu:E,preventScrolling:W,noDragClassName:Ze,noWheelClassName:De,noPanClassName:Je,disableKeyboardA11y:Ot},ue.createElement(zO,null,ue.createElement(DO,{edgeTypes:et,onEdgeClick:c,onEdgeDoubleClick:p,onlyRenderVisibleElements:V,onEdgeContextMenu:ye,onEdgeMouseEnter:Ee,onEdgeMouseMove:Ye,onEdgeMouseLeave:we,onReconnect:_e,onReconnectStart:Be,onReconnectEnd:it,reconnectRadius:ft,defaultMarkerColor:Z,noPanClassName:Je,elevateEdgesOnSelect:!!Xe,disableKeyboardA11y:Ot,rfId:Pt},ue.createElement(WO,{style:k,type:S,component:N,containerStyle:j})),ue.createElement("div",{className:"react-flow__edgelabel-renderer"}),ue.createElement(bO,{nodeTypes:zt,onNodeClick:u,onNodeDoubleClick:f,onNodeMouseEnter:d,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:C,onlyRenderVisibleElements:V,noPanClassName:Je,noDragClassName:Ze,disableKeyboardA11y:Ot,nodeOrigin:lt,nodeExtent:Qe,rfId:Pt})))};wC.displayName="GraphView";var VO=R.memo(wC);const Ov=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ks={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:Ov,nodeExtent:Ov,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:mi.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:wM,isValidConnection:void 0},GO=()=>MR((e,t)=>({...ks,setNodes:r=>{const{nodeInternals:i,nodeOrigin:o,elevateNodesOnSelect:l}=t();e({nodeInternals:Hd(r,i,o,l)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:i={}}=t();e({edges:r.map(o=>({...i,...o}))})},setDefaultNodesAndEdges:(r,i)=>{const o=typeof r<"u",l=typeof i<"u",u=o?Hd(r,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:u,edges:l?i:[],hasDefaultNodes:o,hasDefaultEdges:l})},updateNodeDimensions:r=>{const{onNodesChange:i,nodeInternals:o,fitViewOnInit:l,fitViewOnInitDone:u,fitViewOnInitOptions:c,domNode:f,nodeOrigin:p}=t(),d=f==null?void 0:f.querySelector(".react-flow__viewport");if(!d)return;const m=window.getComputedStyle(d),{m22:y}=new window.DOMMatrixReadOnly(m.transform),w=r.reduce((_,b)=>{const S=o.get(b.id);if(S!=null&&S.hidden)o.set(S.id,{...S,[gt]:{...S[gt],handleBounds:void 0}});else if(S){const k=Zv(b.nodeElement);!!(k.width&&k.height&&(S.width!==k.width||S.height!==k.height||b.forceUpdate))&&(o.set(S.id,{...S,[gt]:{...S[gt],handleBounds:{source:Lx(".source",b.nodeElement,y,p),target:Lx(".target",b.nodeElement,y,p)}},...k}),_.push({id:S.id,type:"dimensions",dimensions:k}))}return _},[]);aC(o,p);const E=u||l&&!u&&lC(t,{initial:!0,...c});e({nodeInternals:new Map(o),fitViewOnInitDone:E}),(w==null?void 0:w.length)>0&&(i==null||i(w))},updateNodePositions:(r,i=!0,o=!1)=>{const{triggerNodeChanges:l}=t(),u=r.map(c=>{const f={id:c.id,type:"position",dragging:o};return i&&(f.positionAbsolute=c.positionAbsolute,f.position=c.position),f});l(u)},triggerNodeChanges:r=>{const{onNodesChange:i,nodeInternals:o,hasDefaultNodes:l,nodeOrigin:u,getNodes:c,elevateNodesOnSelect:f}=t();if(r!=null&&r.length){if(l){const p=lO(r,c()),d=Hd(p,o,u,f);e({nodeInternals:d})}i==null||i(r)}},addSelectedNodes:r=>{const{multiSelectionActive:i,edges:o,getNodes:l}=t();let u,c=null;i?u=r.map(f=>Ns(f,!0)):(u=so(l(),r),c=so(o,[])),tu({changedNodes:u,changedEdges:c,get:t,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:i,edges:o,getNodes:l}=t();let u,c=null;i?u=r.map(f=>Ns(f,!0)):(u=so(o,r),c=so(l(),[])),tu({changedNodes:c,changedEdges:u,get:t,set:e})},unselectNodesAndEdges:({nodes:r,edges:i}={})=>{const{edges:o,getNodes:l}=t(),u=r||l(),c=i||o,f=u.map(d=>(d.selected=!1,Ns(d.id,!1))),p=c.map(d=>Ns(d.id,!1));tu({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:r=>{const{d3Zoom:i,maxZoom:o}=t();i==null||i.scaleExtent([r,o]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:i,minZoom:o}=t();i==null||i.scaleExtent([o,r]),e({maxZoom:r})},setTranslateExtent:r=>{var i;(i=t().d3Zoom)==null||i.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:i}=t(),l=i().filter(c=>c.selected).map(c=>Ns(c.id,!1)),u=r.filter(c=>c.selected).map(c=>Ns(c.id,!1));tu({changedNodes:l,changedEdges:u,get:t,set:e})},setNodeExtent:r=>{const{nodeInternals:i}=t();i.forEach(o=>{o.positionAbsolute=Jv(o.position,r)}),e({nodeExtent:r,nodeInternals:new Map(i)})},panBy:r=>{const{transform:i,width:o,height:l,d3Zoom:u,d3Selection:c,translateExtent:f}=t();if(!u||!c||!r.x&&!r.y)return!1;const p=Dr.translate(i[0]+r.x,i[1]+r.y).scale(i[2]),d=[[0,0],[o,l]],m=u==null?void 0:u.constrain()(p,d,f);return u.transform(c,m),i[0]!==m.x||i[1]!==m.y||i[2]!==m.k},cancelConnection:()=>e({connectionNodeId:ks.connectionNodeId,connectionHandleId:ks.connectionHandleId,connectionHandleType:ks.connectionHandleType,connectionStatus:ks.connectionStatus,connectionStartHandle:ks.connectionStartHandle,connectionEndHandle:ks.connectionEndHandle}),reset:()=>e({...ks})}),Object.is),ay=({children:e})=>{const t=R.useRef(null);return t.current||(t.current=GO()),ue.createElement(fM,{value:t.current},e)};ay.displayName="ReactFlowProvider";const xC=({children:e})=>R.useContext(Lu)?ue.createElement(ue.Fragment,null,e):ue.createElement(ay,null,e);xC.displayName="ReactFlowWrapper";const YO={input:eC,default:Iv,output:nC,group:iy},KO={default:Eu,straight:ny,step:ty,smoothstep:$u,simplebezier:ey},XO=[0,0],QO=[15,15],ZO={x:0,y:0,zoom:1},JO={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},_C=R.forwardRef(({nodes:e,edges:t,defaultNodes:r,defaultEdges:i,className:o,nodeTypes:l=YO,edgeTypes:u=KO,onNodeClick:c,onEdgeClick:f,onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:E,onConnectEnd:_,onClickConnectStart:b,onClickConnectEnd:S,onNodeMouseEnter:k,onNodeMouseMove:N,onNodeMouseLeave:j,onNodeContextMenu:A,onNodeDoubleClick:M,onNodeDragStart:O,onNodeDrag:P,onNodeDragStop:D,onNodesDelete:L,onEdgesDelete:U,onSelectionChange:V,onSelectionDragStart:z,onSelectionDrag:C,onSelectionDragStop:F,onSelectionContextMenu:$,onSelectionStart:re,onSelectionEnd:J,connectionMode:W=mi.Strict,connectionLineType:Z=Cs.Bezier,connectionLineStyle:I,connectionLineComponent:G,connectionLineContainerStyle:K,deleteKeyCode:q="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:ne=!1,selectionMode:ae=Ea.Full,panActivationKeyCode:fe="Space",multiSelectionKeyCode:te=Su()?"Meta":"Control",zoomActivationKeyCode:ce=Su()?"Meta":"Control",snapToGrid:Ce=!1,snapGrid:ve=QO,onlyRenderVisibleElements:Re=!1,selectNodesOnDrag:ye=!0,nodesDraggable:Ee,nodesConnectable:Ye,nodesFocusable:we,nodeOrigin:_e=XO,edgesFocusable:Be,edgesUpdatable:it,elementsSelectable:ft,defaultViewport:Ze=ZO,minZoom:De=.5,maxZoom:Je=2,translateExtent:Xe=Ov,preventScrolling:Ot=!0,nodeExtent:lt,defaultMarkerColor:Qe="#b1b1b7",zoomOnScroll:Pt=!0,zoomOnPinch:zt=!0,panOnScroll:et=!1,panOnScrollSpeed:bt=.5,panOnScrollMode:ht=di.Free,zoomOnDoubleClick:vt=!0,panOnDrag:hn=!0,onPaneClick:Yt,onPaneMouseEnter:Lt,onPaneMouseMove:bn,onPaneMouseLeave:gr,onPaneScroll:Sn,onPaneContextMenu:Bt,children:Fn,onEdgeContextMenu:pn,onEdgeDoubleClick:vr,onEdgeMouseEnter:Hr,onEdgeMouseMove:xi,onEdgeMouseLeave:Wr,onEdgeUpdate:ut,onEdgeUpdateStart:_i,onEdgeUpdateEnd:mn,onReconnect:Is,onReconnectStart:yr,onReconnectEnd:zn,reconnectRadius:kn=10,edgeUpdaterRadius:Vr=10,onNodesChange:Gr,onEdgesChange:Yr,noDragClassName:bi="nodrag",noWheelClassName:sr="nowheel",noPanClassName:Ms="nopan",fitView:En=!1,fitViewOptions:wr,connectOnClick:Os=!0,attributionPosition:Ps,proOptions:Tt,defaultEdgeOptions:xr,elevateNodesOnSelect:_r=!0,elevateEdgesOnSelect:Kt=!1,disableKeyboardA11y:Kr=!1,autoPanOnConnect:Si=!0,autoPanOnNodeDrag:nt=!0,connectionRadius:br=20,isValidConnection:Xr,onError:Ls,style:Qr,id:Zr,nodeDragThreshold:$s,...ir},St)=>{const qs=Zr||"1";return ue.createElement("div",{...ir,style:{...Qr,...JO},ref:St,className:Ft(["react-flow",o]),"data-testid":"rf__wrapper",id:Zr},ue.createElement(xC,null,ue.createElement(VO,{onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onNodeClick:c,onEdgeClick:f,onNodeMouseEnter:k,onNodeMouseMove:N,onNodeMouseLeave:j,onNodeContextMenu:A,onNodeDoubleClick:M,nodeTypes:l,edgeTypes:u,connectionLineType:Z,connectionLineStyle:I,connectionLineComponent:G,connectionLineContainerStyle:K,selectionKeyCode:Q,selectionOnDrag:ne,selectionMode:ae,deleteKeyCode:q,multiSelectionKeyCode:te,panActivationKeyCode:fe,zoomActivationKeyCode:ce,onlyRenderVisibleElements:Re,selectNodesOnDrag:ye,defaultViewport:Ze,translateExtent:Xe,minZoom:De,maxZoom:Je,preventScrolling:Ot,zoomOnScroll:Pt,zoomOnPinch:zt,zoomOnDoubleClick:vt,panOnScroll:et,panOnScrollSpeed:bt,panOnScrollMode:ht,panOnDrag:hn,onPaneClick:Yt,onPaneMouseEnter:Lt,onPaneMouseMove:bn,onPaneMouseLeave:gr,onPaneScroll:Sn,onPaneContextMenu:Bt,onSelectionContextMenu:$,onSelectionStart:re,onSelectionEnd:J,onEdgeContextMenu:pn,onEdgeDoubleClick:vr,onEdgeMouseEnter:Hr,onEdgeMouseMove:xi,onEdgeMouseLeave:Wr,onReconnect:Is??ut,onReconnectStart:yr??_i,onReconnectEnd:zn??mn,reconnectRadius:kn??Vr,defaultMarkerColor:Qe,noDragClassName:bi,noWheelClassName:sr,noPanClassName:Ms,elevateEdgesOnSelect:Kt,rfId:qs,disableKeyboardA11y:Kr,nodeOrigin:_e,nodeExtent:lt}),ue.createElement(BM,{nodes:e,edges:t,defaultNodes:r,defaultEdges:i,onConnect:w,onConnectStart:E,onConnectEnd:_,onClickConnectStart:b,onClickConnectEnd:S,nodesDraggable:Ee,nodesConnectable:Ye,nodesFocusable:we,edgesFocusable:Be,edgesUpdatable:it,elementsSelectable:ft,elevateNodesOnSelect:_r,minZoom:De,maxZoom:Je,nodeExtent:lt,onNodesChange:Gr,onEdgesChange:Yr,snapToGrid:Ce,snapGrid:ve,connectionMode:W,translateExtent:Xe,connectOnClick:Os,defaultEdgeOptions:xr,fitView:En,fitViewOptions:wr,onNodesDelete:L,onEdgesDelete:U,onNodeDragStart:O,onNodeDrag:P,onNodeDragStop:D,onSelectionDrag:C,onSelectionDragStart:z,onSelectionDragStop:F,noPanClassName:Ms,nodeOrigin:_e,rfId:qs,autoPanOnConnect:Si,autoPanOnNodeDrag:nt,onError:Ls,connectionRadius:br,isValidConnection:Xr,nodeDragThreshold:$s}),ue.createElement(FM,{onSelectionChange:V}),Fn,ue.createElement(pM,{proOptions:Tt,position:Ps}),ue.createElement(GM,{rfId:qs,disableKeyboardA11y:Kr})))});_C.displayName="ReactFlow";const eP=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function bC(){return Ke(eP,Ct)}const SC=({id:e,x:t,y:r,width:i,height:o,style:l,color:u,strokeColor:c,strokeWidth:f,className:p,borderRadius:d,shapeRendering:m,onClick:y,selected:w})=>{const{background:E,backgroundColor:_}=l||{},b=u||E||_;return ue.createElement("rect",{className:Ft(["react-flow__minimap-node",{selected:w},p]),x:t,y:r,rx:d,ry:d,width:i,height:o,fill:b,stroke:c,strokeWidth:f,shapeRendering:m,onClick:y?S=>y(S,e):void 0})};SC.displayName="MiniMapNode";var tP=R.memo(SC);const nP=e=>e.nodeOrigin,rP=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Yd=e=>e instanceof Function?e:()=>e;function sP({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:o=2,nodeComponent:l=tP,onClick:u}){const c=Ke(rP,Ct),f=Ke(nP),p=Yd(t),d=Yd(e),m=Yd(r),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ue.createElement(ue.Fragment,null,c.map(w=>{const{x:E,y:_}=hi(w,f).positionAbsolute;return ue.createElement(l,{key:w.id,x:E,y:_,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:p(w),borderRadius:i,strokeColor:d(w),strokeWidth:o,shapeRendering:y,onClick:u,id:w.id})}))}var iP=R.memo(sP);const oP=200,aP=150,lP=e=>{const t=e.getNodes(),r={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:r,boundingRect:t.length>0?vM(qu(t,e.nodeOrigin),r):r,rfId:e.rfId}},uP="react-flow__minimap-desc";function kC({style:e,className:t,nodeStrokeColor:r="transparent",nodeColor:i="#e2e2e2",nodeClassName:o="",nodeBorderRadius:l=5,nodeStrokeWidth:u=2,nodeComponent:c,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:d=1,position:m="bottom-right",onClick:y,onNodeClick:w,pannable:E=!1,zoomable:_=!1,ariaLabel:b="React Flow mini map",inversePan:S=!1,zoomStep:k=10,offsetScale:N=5}){const j=jt(),A=R.useRef(null),{boundingRect:M,viewBB:O,rfId:P}=Ke(lP,Ct),D=(e==null?void 0:e.width)??oP,L=(e==null?void 0:e.height)??aP,U=M.width/D,V=M.height/L,z=Math.max(U,V),C=z*D,F=z*L,$=N*z,re=M.x-(C-M.width)/2-$,J=M.y-(F-M.height)/2-$,W=C+$*2,Z=F+$*2,I=`${uP}-${P}`,G=R.useRef(0);G.current=z,R.useEffect(()=>{if(A.current){const Q=Ln(A.current),ne=te=>{const{transform:ce,d3Selection:Ce,d3Zoom:ve}=j.getState();if(te.sourceEvent.type!=="wheel"||!Ce||!ve)return;const Re=-te.sourceEvent.deltaY*(te.sourceEvent.deltaMode===1?.05:te.sourceEvent.deltaMode?1:.002)*k,ye=ce[2]*Math.pow(2,Re);ve.scaleTo(Ce,ye)},ae=te=>{const{transform:ce,d3Selection:Ce,d3Zoom:ve,translateExtent:Re,width:ye,height:Ee}=j.getState();if(te.sourceEvent.type!=="mousemove"||!Ce||!ve)return;const Ye=G.current*Math.max(1,ce[2])*(S?-1:1),we={x:ce[0]-te.sourceEvent.movementX*Ye,y:ce[1]-te.sourceEvent.movementY*Ye},_e=[[0,0],[ye,Ee]],Be=Dr.translate(we.x,we.y).scale(ce[2]),it=ve.constrain()(Be,_e,Re);ve.transform(Ce,it)},fe=IN().on("zoom",E?ae:null).on("zoom.wheel",_?ne:null);return Q.call(fe),()=>{Q.on("zoom",null)}}},[E,_,S,k]);const K=y?Q=>{const ne=Zn(Q);y(Q,{x:ne[0],y:ne[1]})}:void 0,q=w?(Q,ne)=>{const ae=j.getState().nodeInternals.get(ne);w(Q,ae)}:void 0;return ue.createElement(Qv,{position:m,style:e,className:Ft(["react-flow__minimap",t]),"data-testid":"rf__minimap"},ue.createElement("svg",{width:D,height:L,viewBox:`${re} ${J} ${W} ${Z}`,role:"img","aria-labelledby":I,ref:A,onClick:K},b&&ue.createElement("title",{id:I},b),ue.createElement(iP,{onClick:q,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:l,nodeClassName:o,nodeStrokeWidth:u,nodeComponent:c}),ue.createElement("path",{className:"react-flow__minimap-mask",d:`M${re-$},${J-$}h${W+$*2}v${Z+$*2}h${-W-$*2}z
|
|
57
|
+
M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:d,pointerEvents:"none"})))}kC.displayName="MiniMap";var cP=R.memo(kC);function dP(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ue.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function fP(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ue.createElement("path",{d:"M0 0h32v4.2H0z"}))}function hP(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ue.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function pP(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function mP(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const io=({children:e,className:t,...r})=>ue.createElement("button",{type:"button",className:Ft(["react-flow__controls-button",t]),...r},e);io.displayName="ControlButton";const gP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),EC=({style:e,showZoom:t=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:o,onZoomIn:l,onZoomOut:u,onFitView:c,onInteractiveChange:f,className:p,children:d,position:m="bottom-left"})=>{const y=jt(),[w,E]=R.useState(!1),{isInteractive:_,minZoomReached:b,maxZoomReached:S}=Ke(gP,Ct),{zoomIn:k,zoomOut:N,fitView:j}=Ma();if(R.useEffect(()=>{E(!0)},[]),!w)return null;const A=()=>{k(),l==null||l()},M=()=>{N(),u==null||u()},O=()=>{j(o),c==null||c()},P=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),f==null||f(!_)};return ue.createElement(Qv,{className:Ft(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},t&&ue.createElement(ue.Fragment,null,ue.createElement(io,{onClick:A,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:S},ue.createElement(dP,null)),ue.createElement(io,{onClick:M,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:b},ue.createElement(fP,null))),r&&ue.createElement(io,{className:"react-flow__controls-fitview",onClick:O,title:"fit view","aria-label":"fit view"},ue.createElement(hP,null)),i&&ue.createElement(io,{className:"react-flow__controls-interactive",onClick:P,title:"toggle interactivity","aria-label":"toggle interactivity"},_?ue.createElement(mP,null):ue.createElement(pP,null)),d)};EC.displayName="Controls";var vP=R.memo(EC),er;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(er||(er={}));function yP({color:e,dimensions:t,lineWidth:r}){return ue.createElement("path",{stroke:e,strokeWidth:r,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function wP({color:e,radius:t}){return ue.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const xP={[er.Dots]:"#91919a",[er.Lines]:"#eee",[er.Cross]:"#e2e2e2"},_P={[er.Dots]:1,[er.Lines]:1,[er.Cross]:6},bP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function NC({id:e,variant:t=er.Dots,gap:r=20,size:i,lineWidth:o=1,offset:l=2,color:u,style:c,className:f}){const p=R.useRef(null),{transform:d,patternId:m}=Ke(bP,Ct),y=u||xP[t],w=i||_P[t],E=t===er.Dots,_=t===er.Cross,b=Array.isArray(r)?r:[r,r],S=[b[0]*d[2]||1,b[1]*d[2]||1],k=w*d[2],N=_?[k,k]:S,j=E?[k/l,k/l]:[N[0]/l,N[1]/l];return ue.createElement("svg",{className:Ft(["react-flow__background",f]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},ue.createElement("pattern",{id:m+e,x:d[0]%S[0],y:d[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`},E?ue.createElement(wP,{color:y,radius:k/l}):ue.createElement(yP,{dimensions:N,color:y,lineWidth:o})),ue.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}NC.displayName="Background";var SP=R.memo(NC);const kP=["us-gov","global","apac","us","eu","jp","au"],EP=new RegExp(`^(?:(?:${kP.join("|")})\\.)?anthropic\\.`,"i");function Du(e){return e.replace(EP,"")}function CC(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function jC(e){const t=e.cache_creation,r=t&&typeof t=="object"?t:e,i=r.ephemeral_1h_input_tokens,o=r.ephemeral_5m_input_tokens;return typeof i!="number"&&typeof o!="number"?{}:{cacheCreate1hTokens:Number(i??0),cacheCreate5mTokens:Number(o??0)}}function TC(e,t=0){if(!e||typeof e!="object"||t>6)return null;const r=e;if(typeof r.input_tokens=="number"||typeof r.output_tokens=="number"||typeof r.cache_read_input_tokens=="number"||typeof r.cache_creation_input_tokens=="number")return{inputTokens:Number(r.input_tokens??0),outputTokens:Number(r.output_tokens??0),cacheReadTokens:Number(r.cache_read_input_tokens??0),cacheCreateTokens:Number(r.cache_creation_input_tokens??0),...jC(r)};for(const i of Object.values(r)){const o=TC(i,t+1);if(o)return o}return null}function NP(e,t){e.inputTokens+=t.inputTokens,e.outputTokens+=t.outputTokens,e.cacheReadTokens+=t.cacheReadTokens,e.cacheCreateTokens+=t.cacheCreateTokens,(t.cacheCreate1hTokens!==void 0||t.cacheCreate5mTokens!==void 0)&&(e.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(t.cacheCreate1hTokens??0),e.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(t.cacheCreate5mTokens??0))}const CP=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function RC(e,t=0){if(!e||typeof e!="object"||t>6)return null;const r=e;if(typeof r.model=="string"&&CP.test(Du(r.model)))return r.model;for(const i of Object.values(r)){const o=RC(i,t+1);if(o)return o}return null}function Pv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0}}function Ts(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Hx(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Oa(e,t){return`${e}::${t}`}function Nu(e){return e.agent_type??e.subagent_type??"subagent"}function ya(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function oo(e,t,r,i){const o=t;let l=e.agents.get(o);return l||(l={id:o,sessionId:t,label:"session",kind:"root",state:"active",startedAt:r,lastEventAt:r,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:i,usage:CC()},e.agents.set(o,l),l)}function AC(e,t,r,i){const o=Oa(t,r),l=e.agents.get(o);if(!l)return null;!l.cwd&&i.cwd&&(l.cwd=i.cwd,l.cwdBasename=Ts(i.cwd));const u=Nu(i);return u&&(l.label==="subagent"||!l.label)&&(l.label=u),l}function Wx(e,t,r){const i=t.session_id??"unknown",o=ya(t);if(o){const f=AC(e,i,o,t);if(f)return f}const l=e.activeSubagentStack.get(i),u=l&&l.length>0?l[l.length-1]:null;if(u){const f=e.agents.get(Oa(i,u));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=Ts(t.cwd)),f}const c=oo(e,i,r,!1);return c.synthetic&&(c.synthetic=!1,c.startedAt=r),!c.cwd&&t.cwd&&(c.cwd=t.cwd,c.cwdBasename=Ts(t.cwd)),c.label==="session"&&t.cwd&&(c.label=Ts(t.cwd)??"session"),c}function jP(e,t,r,i,o){const l=Oa(t,r),u=oo(e,t,o,!0);let c=e.agents.get(l);if(c){!c.cwd&&i.cwd&&(c.cwd=i.cwd,c.cwdBasename=Ts(i.cwd));const f=Nu(i);return f&&(c.label==="subagent"||!c.label)&&(c.label=f),c}return c={id:l,sessionId:t,label:Nu(i),kind:"subagent",parentId:u.id,state:"active",startedAt:o,tools:[],prompts:[],cwd:i.cwd,cwdBasename:Ts(i.cwd),toolCount:0,childCount:0,usage:CC()},e.agents.set(l,c),u.childCount+=1,c}function TP(e,t,r){const i=e.activeSubagentStack.get(t)??[];i.includes(r)||(i.push(r),e.activeSubagentStack.set(t,i))}function RP(e,t,r){const i=e.activeSubagentStack.get(t);if(i){for(let o=i.length-1;o>=0;o--)if(i[o]===r){i.splice(o,1);break}i.length===0&&e.activeSubagentStack.delete(t)}}function ru(e,t=80){if(e==null)return"";if(typeof e=="string")return e.length>t?e.slice(0,t-1)+"…":e;try{const r=JSON.stringify(e);return r.length>t?r.slice(0,t-1)+"…":r}catch{return String(e)}}const Vx=200,AP=25;function IP(e,t){const r=t.tools;if(r.length>Vx){const i=r.splice(0,r.length-Vx);for(const o of i)e.toolIndex.get(o.id)===o&&(e.toolIndex.delete(o.id),e.toolOwner.delete(o.id))}for(let i=r.length-AP-1;i>=0;i--){const o=r[i];if(o.trimmed)break;o.input=void 0,o.response=void 0,o.trimmed=!0}}function MP(e,t,r){const i=e.toolIndex.get(r);if(i)return i;for(let o=t.tools.length-1;o>=0;o--)if(t.tools[o].id===r)return t.tools[o];return null}const Gx=2e3;function OP(e,t,r){for(let i=e.prompts.length-1;i>=0;i--){const o=e.prompts[i];if(o.at<t-Gx)return!1;if(o.text===r&&o.at<=t+Gx)return!0}return!1}function IC(e,t){for(const r of t.tools)e.toolIndex.get(r.id)===r&&e.toolIndex.delete(r.id),e.toolOwner.get(r.id)===t.id&&e.toolOwner.delete(r.id)}function PP(e,t,r,i){if(e.agents.size<=r)return!1;const o=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>i,l=[],u=new Map;for(const[p,d]of e.agents){if(d.parentId!=null){const m=u.get(d.parentId);m?m.push(p):u.set(d.parentId,[p])}o(d)&&l.push({id:p,endedAt:d.endedAt})}if(l.length===0)return!1;l.sort((p,d)=>p.endedAt-d.endedAt);let c=0;const f=p=>{const d=e.agents.get(p);d&&(IC(e,d),e.agents.delete(p),c++)};for(const p of l){if(e.agents.size<=r)break;if(!e.agents.has(p.id))continue;const d=(u.get(p.id)??[]).map(m=>e.agents.get(m)).filter(m=>m!=null);if(!d.some(m=>!o(m))){for(const m of d)f(m.id);f(p.id)}}return c>0}function LP(e,t,r,i){const o=new Map;for(const[p,d]of e.agents){let m=o.get(d.sessionId);m||(m={ids:[],endedAt:0,live:!1,closed:!1},o.set(d.sessionId,m)),m.ids.push(p),d.kind==="root"&&d.closedAt!=null&&(m.closed=!0),d.state==="done"&&d.endedAt!=null?m.endedAt=Math.max(m.endedAt,d.endedAt):m.live=!0}const l=[...o.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>i).sort((p,d)=>p.closed===d.closed?p.endedAt-d.endedAt:p.closed?-1:1);let c=[...o.values()].filter(p=>!p.live).length-r;if(c<=0)return!1;let f=!1;for(const p of l){if(c<=0)break;for(const d of p.ids){const m=e.agents.get(d);m&&IC(e,m),e.agents.delete(d)}c--,f=!0}return f}function $P(e,t,r){let i=!1;for(const o of e.agents.values()){if(o.provider==="codex")continue;const l=e.agents.get(o.sessionId),u=(l==null?void 0:l.lastEventAt)??(l==null?void 0:l.startedAt);for(const c of o.tools){const f=Math.max(c.startedAt,u??c.startedAt);c.endedAt==null&&t-f>r&&(c.endedAt=f,c.ok=!1,c.errorPreview="session ended before this call returned",e.toolIndex.delete(c.id),e.toolOwner.delete(c.id),i=!0)}}return i}const Yx=90*6e4;function qP(e,t,r){let i=!1;for(const o of e.agents.values()){if(o.kind!=="root")continue;const l=o.lastEventAt??o.startedAt;if(!(t-l<=r)){o.waiting&&(o.waiting=null,i=!0),o.closedAt==null&&(o.closedAt=l),o.state==="active"&&(o.state="done",o.endedAt=l,o.reaped=!0,i=!0);for(const u of e.agents.values())u.sessionId!==o.sessionId||u.kind==="root"||u.state!=="active"||(u.state="done",u.endedAt=l,i=!0);e.activeSubagentStack.delete(o.sessionId)}}return i}function DP(e){return e==="permission_prompt"?"permission":e==="idle_prompt"?"idle":null}const FP=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved"]);function zP(e,t){let r=null;for(const i of e.toolIndex.values()){const o=i.agentId?e.agents.get(i.agentId):void 0;!o||o.sessionId!==t||(!r||i.startedAt>r.startedAt)&&(r=i)}return r==null?void 0:r.explicitSubagentId}function BP(e,t,r,i,o){const l=r==="permission"?zP(e,t):void 0;return l?{kind:r,message:i,since:o,subagentId:l}:{kind:r,message:i,since:o}}function UP(e,t,r){if(e.kind!=="permission")return!0;const i=ya(t);return i==null?!0:e.subagentId!=null&&Oa(r,i)===e.subagentId}function Kx(e,t){const r=t.epoch??null;if(r!==null&&r!==e.seqEpoch)e.seqEpoch=r,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const i=t.payload??{},o=t.receivedAt,l=i.hook_event_name??"Unknown";if(l==="__clear")return{...Pv(),lastSeq:t.seq,seqEpoch:e.seqEpoch};e.totalEvents+=1,e.lastSeq=t.seq;const u=i.session_id??"unknown";if(!FP.has(l)){const d=e.agents.get(u);d!=null&&d.waiting&&UP(d.waiting,i,u)&&(d.waiting=null)}const c=e.agents.get(u);if(c&&o>(c.lastEventAt??0)&&(c.lastEventAt=o,c.reaped&&(c.reaped=!1,c.state="active",c.endedAt=void 0,c.closedAt=void 0)),typeof i.model_context_window=="number"&&i.model_context_window>0){const d=e.agents.get(u);d&&(d.contextWindow=i.model_context_window)}if(typeof i.approval_policy=="string"&&i.approval_policy){const d=e.agents.get(u);d&&(d.approvalPolicy=i.approval_policy)}if(typeof i.context_tokens=="number"&&i.context_tokens>=0){const d=e.agents.get(u);d&&(d.context={...d.context??Hx(),currentContextTokens:i.context_tokens})}if(l==="ModelObserved"){const d=typeof i.model=="string"?i.model:null;if(d){const y=e.agents.get(u);y&&(y.model=d)}const m=i.subagentModels;if(m&&typeof m=="object")for(const[y,w]of Object.entries(m)){if(typeof w!="string")continue;const E=`${u}::${y}`,_=e.agents.get(E);_&&(_.model=w)}return e}if(l==="ContextObserved"){const d=i.context??null;if(d){const m=e.agents.get(u);if(m){const y=m.context??Hx(),w=(_,b)=>typeof d[_]=="number"?d[_]:b,E=Array.isArray(d.memoryFiles)?d.memoryFiles:Array.isArray(d.claudeMdFiles)?d.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:E??y.memoryFiles}}}return e}if(l==="UsageObserved"){const d=i.usage??null;if(d){const m=e.agents.get(u);if(m){m.usage.inputTokens=Number(d.input_tokens??0),m.usage.outputTokens=Number(d.output_tokens??0),m.usage.cacheReadTokens=Number(d.cache_read_input_tokens??d.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(d.cache_creation_input_tokens??d.cache_write_input_tokens??0);const y=jC(d);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof d.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(d.reasoning_output_tokens))}}return e}const f=Wx(e,i,o);f.provider||(f.provider=i.provider==="codex"?"codex":"claude");const p=RC(i);switch(p&&(f.model=p),l){case"SessionStart":{const d=oo(e,u,o,!1);d.synthetic=!1,d.state="active",d.closedAt=void 0,d.startedAt=d.startedAt||o,!d.cwd&&i.cwd&&(d.cwd=i.cwd,d.cwdBasename=Ts(i.cwd)),d.label==="session"&&i.cwd&&(d.label=Ts(i.cwd)??"session");break}case"UserPromptSubmit":{for(const w of e.agents.values())w.sessionId===u&&w.kind==="subagent"&&w.state==="done"&&w.exitAt==null&&w.endedAt!=null&&w.endedAt<o&&(w.exitAt=o);const d=oo(e,u,o,!1);d.state="active",d.endedAt=void 0,d.closedAt=void 0,d.exitAt=void 0;const m=Wx(e,i,o);m.state="active",m.exitAt=void 0,m.endedAt=void 0;const y=(typeof i.prompt=="string"?i.prompt:typeof i.message=="string"?i.message:"")??"";y&&!OP(m,o,y)&&(m.prompts.push({at:o,text:y}),m.firstPrompt||(m.firstPrompt=ru(y,120)));break}case"PreToolUse":{const d=i.tool_use_id?MP(e,f,i.tool_use_id):null;if(d){i.tool_name&&d.name==="?"&&(d.name=i.tool_name),d.endedAt==null&&!d.trimmed&&i.tool_input!==void 0&&(d.input=i.tool_input,d.inputPreview=ru(i.tool_input));break}const m=i.tool_use_id??`${f.id}:${f.toolCount}`,y=ya(i),w={id:m,name:i.tool_name??"?",input:i.tool_input,inputPreview:ru(i.tool_input),agentId:f.id,explicitSubagentId:y?Oa(u,y):void 0,startedAt:o};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(m,w),e.toolOwner.set(m,f.id),IP(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const d=i.tool_use_id;if(!d)break;let m=e.toolIndex.get(d),y=!1;if(!m)for(const _ of e.agents.values()){const b=_.tools.find(S=>S.id===d);if(b){m=b,y=!0;break}}if(!m||m.outcomeApplied)break;m.outcomeApplied=!0,m.endedAt=o,m.ok=l==="PostToolUse",m.trimmed||(m.response=i.tool_response),l==="PostToolUseFailure"?m.errorPreview=ru(i.tool_response):y&&(m.errorPreview=void 0);const w=TC(i.tool_response);w&&(m.usage=w),e.toolIndex.delete(d);const E=e.toolOwner.get(d)??m.agentId;if(e.toolOwner.delete(d),E&&w){const _=e.agents.get(E);_&&NP(_.usage,w)}break}case"SubagentStart":{const d=ya(i);if(!d)break;const m=jP(e,u,d,i,o);m.state="active",m.startedAt=m.startedAt||o,m.exitAt=void 0,m.endedAt=void 0;const y=Nu(i);y&&(m.label=y),TP(e,u,d);break}case"SubagentStop":{const d=ya(i);if(!d)break;const m=AC(e,u,d,i);if(!m)break;m.state="done",m.endedAt=o,RP(e,u,d);break}case"Stop":case"SessionEnd":{const d=oo(e,u,o,!1);d.state="done",d.endedAt=o,l==="SessionEnd"&&(d.closedAt=o),e.activeSubagentStack.delete(u);break}case"Notification":{const d=DP(i.notification_type);if(!d)break;const m=oo(e,u,o,!1),y=typeof i.message=="string"?i.message:"",w=m.waiting;m.waiting=w&&w.kind===d&&w.message===y?{...w,since:Math.min(w.since,o)}:BP(e,u,d,y,o);break}}return e}function ly(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t^e.charCodeAt(r);return Math.abs(t)%360}const HP=Date.UTC(2026,8,1);function WP(e){return e<HP?{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}}const VP=[{match:/^claude[-_](fable|mythos)[-_]5\b/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_]opus[-_]5\b/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]sonnet[-_]5\b/i,rates:WP},{match:/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]opus[-_]4(?:[-_.]1)?\b/i,rates:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}},{match:/^claude[-_]sonnet[-_]4[-_.](?:5|6)\b/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]sonnet[-_]4\b/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]haiku[-_]4[-_.]5\b/i,rates:{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}},{match:/^claude[-_]haiku[-_]3[-_.]5\b/i,rates:{input:.8,output:4,cacheRead:.08,cacheWrite:1,cacheWrite1h:1.6}},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,rates:{input:12.5,output:75,cacheRead:1.25,cacheWrite:0}},{match:/^gpt[-_]5[-_.]6[-_]luna/i,rates:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25}},{match:/^gpt[-_]5[-_.]6[-_]terra/i,rates:{input:2,output:12,cacheRead:.2,cacheWrite:2.5}},{match:/^gpt[-_]5[-_.]6(?:[-_]sol)?\b/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:6.25}},{match:/^gpt[-_]5[-_.]5[-_]pro/i,rates:{input:30,output:180,cacheRead:30,cacheWrite:0}},{match:/^gpt[-_]5[-_.]5\b/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]pro/i,rates:{input:30,output:180,cacheRead:3,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]mini/i,rates:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]nano/i,rates:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4\b/i,rates:{input:2.5,output:15,cacheRead:.25,cacheWrite:0}},{match:/^gpt[-_]5[-_.]3[-_]codex/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2[-_]pro/i,rates:{input:21,output:168,cacheRead:21,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2\b/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1[-_]codex[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1(?!\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^gpt[-_]5[-_]pro\b/i,rates:{input:15,output:120,cacheRead:15,cacheWrite:0}},{match:/^gpt[-_]5[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_]nano/i,rates:{input:.05,output:.4,cacheRead:.005,cacheWrite:0}},{match:/^gpt[-_]5(?![-_.]\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^codex[-_]mini/i,rates:{input:1.5,output:6,cacheRead:.375,cacheWrite:0}},{match:/^o1[-_]pro/i,rates:{input:150,output:600,cacheRead:150,cacheWrite:0}},{match:/^o1\b/i,rates:{input:15,output:60,cacheRead:7.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/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 GP(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function go(e,t=Date.now()){if(!e)return null;const r=Du(e);for(const i of VP)if(i.match.test(r))return typeof i.rates=="function"?i.rates(t):i.rates;return null}function MC(e,t){const r=Math.max(0,e.cacheCreate1hTokens??0),i=Math.max(0,e.cacheCreate5mTokens??0),o=Math.max(0,e.cacheCreateTokens-r-i),l=i+o,u=t.cacheWrite1h??t.cacheWrite;return{tokens5m:l,tokens1h:r,usd5m:l*t.cacheWrite/1e6,usd1h:r*u/1e6}}function OC(e,t,r=Date.now()){if(!GP(t))return e.inputTokens;const i=go(t,r),o=((i==null?void 0:i.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-o)}function dn(e,t,r=Date.now()){const i=go(t,r);if(!i)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const o=OC(e,t,r)*i.input/1e6,l=e.outputTokens*i.output/1e6,u=e.cacheReadTokens*i.cacheRead/1e6,c=MC(e,i),f=c.usd5m+c.usd1h;return{input:o,output:l,cacheRead:u,cacheWrite:f,total:o+l+u+f}}const Xx=2e5,YP=1e6,KP=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],XP=[{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 QP(e){if(!e)return Xx;const t=Du(e);for(const r of KP)if(r.test(t))return YP;for(const r of XP)if(r.match.test(t))return r.window;return Xx}function PC(e,t){return typeof e=="number"&&e>0?e:QP(t)}const mu="not priced";function qe(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 Cu(e,t){if(e<=0||t<10)return null;const r=e/t,i=r*60;return i>=.01?`${qe(i)}/min`:`${qe(r*3600)}/hr`}const ZP=new Set(["untrusted","on-request","on-failure"]);function JP(e){return typeof e!="string"||!e?null:ZP.has(e)?!0:e==="never"?!1:null}function eL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=JP(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 Qx(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Rs(e){const t=Du(e).replace(/[-_]\d{8}(?!\d)/,""),r=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(r){const o=Qx(r[1]),l=r[2].replace(/[-_]/g,".");return`${o} ${l}`}const i=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(i){const o=i[1].replace(/[-_]/g,"."),l=i[2].split(/[-_]/).filter(Boolean).map(Qx);return[`GPT-${o}`,...l].join(" ")}return e}function Nt(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:e<1e9?`${(e/1e6).toFixed(2)}M`:`${(e/1e9).toFixed(2)}B`}function ju(e,t,r){const i=(t??r)-e;if(i<1e3)return`${Math.max(0,i)}ms`;const o=Math.floor(i/1e3);if(o<60)return`${o}s`;const l=Math.floor(o/60),u=o%60;return`${l}m ${String(u).padStart(2,"0")}s`}function LC(e,t){if(e.endedAt==null)return t;const r=e.endedAt-e.startedAt;return r<1e3?`${r}ms`:`${(r/1e3).toFixed(2)}s`}const tL=1;function nL(){const e=[];let t=0;function r(){let i;for(const o of e)(!i||o.layer>i.layer||o.layer===i.layer&&o.seq>i.seq)&&(i=o);return i}return{push(i,o=0){const l={dismiss:i,layer:o,seq:t++};return e.push(l),()=>{const u=e.indexOf(l);u!==-1&&e.splice(u,1)}},dismissTop(){const i=r();return i?(i.dismiss(),!0):!1},isTop(i){const o=r();return o!=null&&o.dismiss===i},depth(){return e.length}}}const Tu=nL();function rL(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function Zx(e){return String(e.tagName??"").toUpperCase()==="BODY"}function sL(e,t){return!e||!e.isConnected||Zx(e)?!1:t==null||Zx(t)}const Jx="a[href], button, input, select, textarea, [tabindex]";function iL(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function oL(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function aL({count:e,index:t,shiftKey:r}){return e<=0?{kind:"hold"}:t<0||t>=e?{kind:"focus",index:r?e-1:0}:!r&&t===e-1?{kind:"focus",index:0}:r&&t===0?{kind:"focus",index:e-1}:{kind:"allow"}}function $C(e){return e.ctrlKey||e.metaKey||e.altKey}const lL=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),uL=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),cL=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function qC(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function uy(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=qC(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!lL.has(String(e.type??"text").toLowerCase())}function dL(e){if(!e)return!1;if(uy(e)||uL.has(qC(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(r=>cL.has(r))}function DC(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(Jx))return iL({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const r=t.scrollHeight>t.clientHeight;return r&&oL({overflowing:r,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(Jx)!=null})}):[]}function fL(e,t){const r=DC(e);if(!t||!e.contains(t)||r.includes(t))return r;const i=r.findIndex(o=>(t.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return i===-1?[...r,t]:[...r.slice(0,i),t,...r.slice(i)]}function wo(e,t={}){const{focusRef:r,layer:i}=t,o=R.useRef(null),l=R.useRef(e);l.current=e;const u=R.useRef(null);u.current===null&&(u.current=()=>l.current());const c=u.current;return R.useEffect(()=>Tu.push(c,i),[c,i]),R.useEffect(()=>{var p;const f=document.activeElement;return(p=(r==null?void 0:r.current)??DC(o.current)[0])==null||p.focus(),()=>{sL(f,document.activeElement)&&f.focus()}},[]),R.useEffect(()=>{const f=p=>{var _;if(p.key!=="Tab"||$C(p))return;const d=o.current;if(!d)return;const m=document.activeElement;if(!(m!=null&&d.contains(m))&&!Tu.isTop(c))return;const w=fL(d,m),E=aL({count:w.length,index:m?w.indexOf(m):-1,shiftKey:p.shiftKey});E.kind!=="allow"&&(p.preventDefault(),E.kind==="focus"&&((_=w[E.index])==null||_.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[c]),o}function hL(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 Pn(e){return e.toLocaleString()}function pL(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const mL=60;function gL(e,t=mL){if(e.length<=t)return e;const r=e.slice(e.length-(t-1)),i=r.search(/[/\\]/);return"…"+(i===-1?r:r.slice(i))}function vL({agent:e,onClose:t}){var y;const r=R.useRef(null),i=wo(t,{focusRef:r}),o=e.context,l=e.usage,u=(o==null?void 0:o.currentContextTokens)??0,c=PC(e.contextWindow,e.model),f=Math.min(100,u/c*100),p=dn(l,e.model),d=l.inputTokens+l.cacheReadTokens+l.cacheCreateTokens,m=hL(e.provider);return g.jsx("div",{className:"ctx-modal-backdrop",onClick:t,role:"presentation",children:g.jsxs("div",{ref:i,className:"ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[g.jsxs("header",{className:"ctx-modal-head",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),g.jsx("div",{className:"ctx-modal-sub",children:m.subtitle})]}),g.jsx("button",{type:"button",ref:r,className:"ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),g.jsxs("section",{className:"ctx-window-row",children:[g.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:g.jsx("div",{className:"ctx-window-fill",style:{width:`${f}%`}})}),g.jsxs("div",{className:"ctx-window-meta",children:[g.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),g.jsxs("span",{children:[Pn(u)," / ",Pn(c)," tok (",m.windowScope,")"]})]})]}),g.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),g.jsxs("div",{className:"ctx-grid",children:[g.jsx(Qn,{label:"input tokens",val:Pn(l.inputTokens)}),g.jsx(Qn,{label:"output tokens",val:Pn(l.outputTokens)}),g.jsx(Qn,{label:"cache reads",val:Pn(l.cacheReadTokens)}),g.jsx(Qn,{label:"cache writes",val:Pn(l.cacheCreateTokens)}),g.jsx(Qn,{label:"cumulative total",val:Pn(d)}),g.jsx(Qn,{label:"estimated cost",val:qe(p.total),accent:!0})]}),g.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),m.compositionCounted?g.jsxs("div",{className:"ctx-grid",children:[g.jsx(Qn,{label:"user messages",val:Pn((o==null?void 0:o.msgsUser)??0)}),g.jsx(Qn,{label:"assistant messages",val:Pn((o==null?void 0:o.msgsAssistant)??0)}),g.jsx(Qn,{label:"tool uses",val:Pn((o==null?void 0:o.toolUses)??0)}),g.jsx(Qn,{label:"tool results",val:Pn((o==null?void 0:o.toolResults)??0)}),g.jsx(Qn,{label:"system-reminders",val:Pn((o==null?void 0:o.systemReminders)??0)})]}):g.jsx("div",{className:"ctx-empty",children:m.compositionUncounted}),g.jsx("h3",{className:"ctx-section-title",children:m.memoryHeading}),(((y=o==null?void 0:o.memoryFiles)==null?void 0:y.length)??0)===0?g.jsx("div",{className:"ctx-empty",children:m.memoryEmpty}):g.jsx("ul",{className:"ctx-md-list",children:o.memoryFiles.map(w=>g.jsxs("li",{children:[g.jsx("span",{className:"ctx-md-path",title:w.path,children:gL(w.path)}),g.jsx("span",{className:"ctx-md-size",children:pL(w.bytes)})]},w.path))})]})})}function Qn({label:e,val:t,accent:r}){return g.jsxs("div",{className:`ctx-row${r?" accent":""}`,children:[g.jsx("span",{className:"ctx-row-label",children:e}),g.jsx("span",{className:"ctx-row-val",children:t})]})}function yL({currentContextTokens:e,modelId:t,contextWindow:r,size:i=26,onClick:o,title:l}){const u=PC(r,t),c=Math.min(1,e/u),f=i/2-3,p=i/2,d=2*Math.PI*f,m=d*c,y=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return g.jsx("button",{type:"button",className:"ctx-donut",onClick:o,title:l??`context: ${e.toLocaleString()} / ${u.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:g.jsxs("svg",{width:i,height:i,viewBox:`0 0 ${i} ${i}`,children:[g.jsx("circle",{cx:p,cy:p,r:f,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),g.jsx("circle",{cx:p,cy:p,r:f,stroke:y,strokeWidth:"2.5",fill:"none",strokeDasharray:`${m} ${d-m}`,strokeDashoffset:d/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),g.jsx("text",{x:p,y:p+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}function e_(e,t){const r=go(t);if(!r)return`model: ${t}
|
|
60
|
+
no published rate in this build — the tokens are counted, the dollars are not`;const i=d=>d.toLocaleString(),o=d=>`$${d}/MTok`,l=dn(e,t),u=MC(e,r),c=u.tokens1h>0?[`cache w5m${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${qe(u.usd5m)}`,`cache w1h${i(u.tokens1h).padStart(14)} × ${o(r.cacheWrite1h??r.cacheWrite).padEnd(11)} = ${qe(u.usd1h)}`]:[`cache w ${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${qe(u.usd5m)}`],f=OC(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${i(f).padStart(14)} × ${o(r.input).padEnd(11)} = ${qe(l.input)}`,`output ${i(e.outputTokens).padStart(14)} × ${o(r.output).padEnd(11)} = ${qe(l.output)}`,`cache r ${i(e.cacheReadTokens).padStart(14)} × ${o(r.cacheRead).padEnd(11)} = ${qe(l.cacheRead)}`,...c,"─────────────────────────────────────────",`total = ${qe(l.total)}`].join(`
|
|
61
|
+
`)}function wL({data:e,selected:t}){var f;const r=e.now??Date.now(),i=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),o=e.tools.filter(p=>!p.endedAt).length,l=ly(e.sessionId),u=((f=e.context)==null?void 0:f.currentContextTokens)??0,c=e.kind==="root"&&u>0;return g.jsxs("div",{className:i,style:{"--session-hue":l},children:[g.jsx("span",{className:"accent-stripe"}),g.jsx(mo,{type:"target",position:Ae.Left,style:{background:"transparent",border:"none"}}),g.jsxs("div",{className:"head",children:[g.jsxs("div",{className:"title",children:[g.jsx(xL,{state:e.state}),g.jsx("span",{className:"label",title:e.cwd,children:e.label}),e.synthetic&&g.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),g.jsxs("div",{className:"head-right",children:[c&&e.onOpenContext&&g.jsx(yL,{currentContextTokens:u,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),g.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:ju(e.startedAt,e.endedAt,r)})]})]}),g.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&g.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?g.jsx("span",{className:"model-chip",title:e.model,children:Rs(e.model)}):e.provider==="codex"?g.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.waiting&&g.jsx(bL,{waiting:e.waiting,now:r}),(()=>{const p=eL(e);return p?g.jsxs("div",{className:"approval-blind-row",title:p.detail,children:[g.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),g.jsx("span",{className:"approval-blind-said",children:p.label})]}):null})(),e.tools.length>0&&g.jsx(SL,{tools:e.tools,now:r}),g.jsxs("div",{className:"meta",children:[g.jsxs("span",{children:[g.jsx("b",{children:e.toolCount})," tools"]}),o>0&&g.jsxs("span",{className:"inflight-meta",children:[g.jsx("b",{children:o})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&g.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:[g.jsx("b",{children:Nt(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{if(!go(e.model))return e.usage.inputTokens+e.usage.outputTokens<=0?null:g.jsx("span",{className:"cost-unpriced",title:e_(e.usage,e.model),children:mu});const d=dn(e.usage,e.model);if(d.total<=0)return null;const m=Math.max(0,((e.endedAt??r)-e.startedAt)/1e3),y=e.state==="active"?Cu(d.total,m):null,w=e_(e.usage,e.model)+(y?`
|
|
62
|
+
burn: ${y}`:"");return g.jsxs("span",{className:"cost-meta",title:w,children:[g.jsx("b",{children:qe(d.total)}),y&&g.jsx("span",{className:"cost-rate",children:y})]})})()]}),g.jsx(mo,{type:"source",position:Ae.Right,style:{background:"transparent",border:"none"}})]})}function cy(e){return e==="active"?"live":e==="done"?"done":"err"}function xL({state:e}){return g.jsx("span",{className:`state-pill state-${e}`,children:cy(e)})}function Fu(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function _L(e){return e.kind==="permission"?Fu(e):"Your turn"}function bL({waiting:e,now:t}){const r=e.kind==="permission",i=Fu(e);return g.jsxs("div",{className:r?"waiting-row permission":"waiting-row idle",title:`${i}
|
|
63
|
+
Blocked for ${ju(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[r?g.jsx("span",{className:"ap-pulse","aria-hidden":!0}):g.jsx("span",{className:"waiting-dot","aria-hidden":!0}),g.jsx("span",{className:"waiting-said",children:_L(e)}),g.jsx("b",{children:ju(e.since,void 0,t)})]})}function SL({tools:e,now:t}){const l=new Array(24).fill(0);let u=0;for(const y of e){const w=t-y.startedAt;if(w<0||w>=6e4)continue;const E=23-Math.floor(w/2500);E>=0&&E<24&&(l[E]+=1,u+=1)}const c=Math.max(1,...l),f=132,p=14,d=f/24,m=c/(2500/1e3);return g.jsxs("div",{className:"tool-spark-row",title:`${u} tool calls in last 60s · peak ${m.toFixed(1)}/s`,children:[g.jsx("svg",{className:"tool-spark",width:f,height:p,viewBox:`0 0 ${f} ${p}`,"aria-hidden":!0,children:l.map((y,w)=>{const E=y===0?1.5:Math.max(1.5,y/c*p),_=w===23&&y>0,S=`tool-spark-bar${y>0?" active":""}${_?" latest":""}`;return g.jsx("rect",{x:w*d+.4,y:p-E,width:Math.max(.5,d-1),height:E,rx:.8,className:S},w)})}),g.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function t_(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function kL({tool:e,onClose:t}){const r=wo(t),i=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return g.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:g.jsxs("div",{ref:r,className:"modal",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[g.jsxs("header",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:`status-dot ${i}`,"aria-hidden":!0}),g.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),g.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),g.jsxs("div",{className:"modal-actions",children:[g.jsx("span",{className:"modal-dur",children:LC(e,"in-flight…")}),g.jsx("button",{className:"btn icon-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),g.jsxs("section",{className:"modal-body",children:[e.trimmed&&g.jsx("div",{className:"modal-section",children:g.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),g.jsxs("div",{className:"modal-section",children:[g.jsx("h4",{children:"Input"}),g.jsx("pre",{children:t_(e.input??e.inputPreview)})]}),g.jsxs("div",{className:"modal-section",children:[g.jsxs("h4",{children:["Response ",i==="err"&&g.jsx("span",{className:"err-tag",children:"error"})]}),g.jsx("pre",{children:e.endedAt==null?"(waiting…)":t_(e.response??e.errorPreview)})]})]})]})})}const su=18,n_=26,EL=12;function NL(e){return CL(e.nodeInternals.values())}function CL(e){const t=new Map;for(const o of e){if(o.type!=="agent")continue;const l=o.data;if(!(l!=null&&l.sessionId)||l.exitAt!=null||o.width==null||o.height==null)continue;const u=o.position.x,c=o.position.y,f=u+o.width,p=c+o.height,d=t.get(l.sessionId);d?(d.minX=Math.min(d.minX,u),d.minY=Math.min(d.minY,c),d.maxX=Math.max(d.maxX,f),d.maxY=Math.max(d.maxY,p),l.kind==="root"&&(d.label=r_(l)??d.label)):t.set(l.sessionId,{minX:u,minY:c,maxX:f,maxY:p,label:r_(l)??l.sessionId})}const r=new Map;for(const o of t.values())r.set(o.label,(r.get(o.label)??0)+1);const i=[];for(const[o,l]of t){const c=(r.get(l.label)??0)>1?`${l.label} · ${jL(o)}`:l.label;i.push({sessionId:o,label:c,x:l.minX-su,y:l.minY-su-n_,w:l.maxX-l.minX+su*2,h:l.maxY-l.minY+su*2+n_})}return i}function jL(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function r_(e){if(e.kind==="root")return e.label}function TL(){const{x:e,y:t,zoom:r}=bC(),i=Ma(),o=Ke(NL,RL);if(o.length<=1)return null;const l=c=>{try{const f=i.getNodes().filter(p=>{const d=p.data;return(d==null?void 0:d.sessionId)===c});if(f.length===0)return;i.fitView({padding:.3,duration:500,nodes:f})}catch{}},u={transform:`translate(${e}px, ${t}px) scale(${r})`};return g.jsx("div",{className:"session-clusters",style:u,children:o.map(c=>{const f=ly(c.sessionId),p={position:"absolute",left:c.x,top:c.y,width:c.w,height:c.h,"--session-hue":f},d={position:"absolute",left:c.x+16,top:c.y-EL,transform:`scale(${Math.min(1,r)/(r||1)})`,transformOrigin:"left top","--session-hue":f};return g.jsxs(ue.Fragment,{children:[g.jsx("div",{className:"cluster-card",style:p,"aria-hidden":!0}),g.jsx("button",{type:"button",className:"cluster-label",style:d,title:`Fit view to ${c.label} · drag the wrapper to move the whole session`,onClick:()=>l(c.sessionId),children:c.label})]},c.sessionId)})})}function RL(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const i=e[r],o=t[r];if(i.sessionId!==o.sessionId||i.label!==o.label||i.x!==o.x||i.y!==o.y||i.w!==o.w||i.h!==o.h)return!1}return!0}function AL({data:e}){return g.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const Pa={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"}},IL=Object.fromEntries(Object.entries(Pa).map(([e,t])=>[e,t.category])),ML=Object.fromEntries(Object.entries(Pa).map(([e,t])=>[e,t.emoji])),OL=Object.fromEntries(Object.entries(Pa).map(([e,t])=>[e,t.label])),PL=new Set(Object.keys(Pa)),LL=new Set(Object.entries(Pa).filter(([,e])=>e.shell).map(([e])=>e)),s_={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",...IL};function FC(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(s_,e)?s_[e]:"other"}const $L=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,qL=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function DL(e){if(typeof e!="string"||!e)return null;const t=$L.exec(e);if(t){const i=FL(t[2]);if(i.trim())return i}const r=qL.exec(e);return r?r[1]:null}function FL(e){return e.replace(/\\(["'`\\nrt])/g,(t,r)=>r==="n"?`
|
|
64
|
+
`:r==="r"?"\r":r==="t"?" ":r)}const zC=600,zL=4,BL=36,Lv=16,UL=60,HL=6,i_=220,o_=96,WL=28,a_={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:"📡",...ML};function l_(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(a_,e)?a_[e]:"✨"}const u_={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 BC(e){if(!e)return null;let t=e.trim();if(!t)return null;const r=t.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(r)return BC(r[1]);for(;;){const l=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!l)break;t=t.slice(l[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const i=t.match(/^([^\s|;&<>(]+)/);if(!i)return null;let o=i[1];return o=o.replace(/^.*[/\\]/,""),o=o.replace(/\.(exe|cmd|bat|ps1)$/i,""),o||null}function VL(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const r=DL(t.script);if(r)return r}if(typeof t.cmd=="string")return t.cmd;if(typeof t.command=="string")return t.command;if(Array.isArray(t.command)&&t.command.every(r=>typeof r=="string")){const r=t.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(r[0]??"")){const i=r.findIndex(o=>/^(-Command|-c)$/i.test(o));if(i>=0&&i+1<r.length)return r[i+1]}return r.join(" ")}return typeof t.script=="string"?t.script:null}const GL=new Set(["Bash","PowerShell",...LL]),YL=PL;function KL(e,t){return YL.has(e)||e.startsWith("mcp__")?Math.max(o_,34+t.length*7.5):o_}function XL(e,t){if(!GL.has(e))return null;const r=VL(t);if(!r)return null;const i=BC(r);return i?{emoji:Object.hasOwn(u_,i)?u_[i]:"⚙️",label:i,category:"shell",detail:r}:null}const QL=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),c_={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:"🗄️"},d_={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 ZL(e){const r=e.replace(/\\/g,"/").replace(/\/+$/,""),i=r.lastIndexOf("/");return i>=0?r.slice(i+1):r}function JL(e){const t=e.toLowerCase();if(Object.hasOwn(d_,t))return d_[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const r=t.lastIndexOf(".");if(r>0&&r<t.length-1){const i=t.slice(r+1);if(Object.hasOwn(c_,i))return c_[i]}return"📄"}function e3(e,t){if(!t||typeof t!="object")return null;const r=t;if(e==="apply_patch"&&typeof r.patch=="string"){const i=r.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return i?i[1].trim():null}return typeof r.file_path=="string"?r.file_path:typeof r.notebook_path=="string"?r.notebook_path:typeof r.path=="string"?r.path:e==="Glob"&&typeof r.pattern=="string"?r.pattern:null}function t3(e,t){if(!QL.has(e))return null;const r=e3(e,t);if(!r)return null;const i=ZL(r);return i?{emoji:e==="LS"?"📂":JL(i),label:i,category:"file",detail:r}:null}const f_={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 UC(e){if(!e.startsWith("mcp__"))return null;const t=e.slice(5),r=t.indexOf("__");return r<=0?{server:t,method:""}:{server:t.slice(0,r),method:t.slice(r+2)}}function n3(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t^e.charCodeAt(r);return Math.abs(t)%360}function HC(e){const t=e.toLowerCase();return Object.hasOwn(f_,t)?f_[t]:void 0}function r3(e,t){const r=UC(e);if(!r)return null;const{server:i,method:o}=r;if(!o)return null;const l=HC(i);return{emoji:(l==null?void 0:l.emoji)??"🔌",label:o,category:"mcp",detail:l?`${l.name} · ${o}`:`${i} · ${o}`}}function s3(e,t){return XL(e,t)??t3(e,t)??r3(e)}const h_=OL;function i3(e){const t=UC(e);if(t){const i=HC(t.server);return i?{emoji:i.emoji,label:i.name}:{emoji:"🔌",label:t.server,hue:n3(t.server)}}const r=Object.hasOwn(h_,e)?h_[e]:"";return r?{emoji:l_(e),label:r}:{emoji:l_(e),label:e}}function o3(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function a3(e,t,r){if(r==null)return 1;const i=t-r;return i<0?1:Math.max(0,1-i/zC)}function l3(e,t){const r=[],i=new Set;for(let o=e.length-1;o>=0&&r.length<t;o--){const l=e[o];i.has(l.id)||(i.add(l.id),r.push(l))}return r.reverse()}function u3(e,t,r,i,o,l){const u=[];for(const c of e.values()){if(!t.has(c.id)||c.exitAt!=null&&l-c.exitAt>zC)continue;const f=i.get(c.id)??r.get(c.id);if(!f)continue;const p=l3(c.tools,zL);if(p.length===0)continue;const d=c.exitAt??null,m=o.get(c.id),y=Math.max((m==null?void 0:m.width)??i_,i_),w=(m==null?void 0:m.height)??130,E=f.x,_=f.y,b=E+y,S=_+w/2;p.forEach((k,N)=>{const j=N*BL,A=E+y+UL,M=_+HL+j,O=a3(k,l,d),P=k.inputPreview??"",D=o3(k),L=O<.999,U=i3(k.name);u.push({id:`${c.id}::${k.id}`,toolId:k.id,agentId:c.id,toolName:k.name,name:U.label,emoji:U.emoji,status:D,category:FC(k.name),mcpHue:U.hue,inputPreview:P,fade:O,fading:L,worldX:A,worldY:M,anchorX:b,anchorY:S,spawnDx:b-A,spawnDy:S-(M+Lv)});const V=s3(k.name,k.input);if(V){const z=KL(k.name,U.label),C=A+z+WL,F=M,$=A+z,re=M+Lv;u.push({id:`sub:${c.id}::${k.id}`,toolId:k.id,agentId:c.id,toolName:k.name,name:V.label,emoji:V.emoji,isSub:!0,status:D,category:V.category,inputPreview:V.detail??P,fade:O,fading:L,worldX:C,worldY:F,anchorX:$,anchorY:re,spawnDx:$-C,spawnDy:0})}})}return u}function c3({agents:e,visibleAgentIds:t,positions:r,pinned:i,measured:o,dimUnmatched:l,spotlight:u,hiddenCategories:c,now:f,onOpenTool:p}){const d=u3(e,t,r,i,o,f),m=c&&c.size>0?d.filter(y=>!c.has(y.category)):d;return g.jsx(d3,{bursts:m,dimUnmatched:l,spotlight:u,onOpenTool:p})}function d3({bursts:e,dimUnmatched:t,spotlight:r,onOpenTool:i}){const{x:o,y:l,zoom:u}=bC();return g.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[g.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const f=c.anchorX*u+o,p=c.anchorY*u+l,d=(c.worldX+6)*u+o,m=(c.worldY+Lv)*u+l,y=f+(d-f)*.55,w=t!=null&&!t.has(c.agentId),E=r!=null&&!r.has(c.agentId),_=c.fade*(w||E?.14:1);return g.jsx("path",{d:`M ${f} ${p} Q ${y} ${p}, ${d} ${m}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>{const f=c.worldX*u+o,p=c.worldY*u+l,d={left:`${f}px`,top:`${p}px`,transform:`scale(${u})`,transformOrigin:"left top","--spawn-dx":`${c.spawnDx}px`,"--spawn-dy":`${c.spawnDy}px`},m=c.isSub?`${c.toolName} · ${c.name}`:c.toolName,y=c.inputPreview?`${m} · ${c.inputPreview}`:m,w=i!=null,E=c.mcpHue!=null?{"--mcp-hue":c.mcpHue}:{},_=t!=null&&!t.has(c.agentId),b=r!=null&&!r.has(c.agentId),S=_||b?" dim":"";return g.jsx("div",{className:"tool-burst-wrap",style:d,children:g.jsxs("div",{className:`tool-burst cat-${c.category}${c.mcpHue!=null?" mcp-hue":""} status-${c.status}${c.fading?" fading":""}${w?" clickable":""}${c.isSub?" sub":""}${S}`,style:E,title:y,onClick:w?()=>i(c.toolId):void 0,children:[g.jsx("span",{className:"tb-emoji",children:c.emoji}),g.jsx("span",{className:"tb-name",children:c.name}),c.status==="inflight"&&g.jsx("span",{className:"tb-spin"}),c.status==="done"&&g.jsx("span",{className:"tb-mark done",children:"✓"}),c.status==="err"&&g.jsx("span",{className:"tb-mark err",children:"×"})]})},c.id)})]})}function dy({cost:e,size:t="md"}){const r=e.total;if(r<=0)return null;const i=(l,u,c)=>{if(l<=0)return null;const f=l/r*100;return g.jsx("span",{className:`cb-seg ${u}`,style:{width:`${f}%`},title:`${c}: ${qe(l)} (${f.toFixed(0)}%)`},u)},o=t==="lg";return g.jsxs("div",{className:o?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[i(e.input,"cb-input","input"),i(e.output,"cb-output","output"),i(e.cacheRead,"cb-cache-r","cache read"),i(e.cacheWrite,"cb-cache-w","cache write")]})}function f3({state:e,sessionId:t,onClose:r}){const i=R.useMemo(()=>h3(e,t),[e,t]),o=R.useRef(null),l=wo(r,{focusRef:o});return i?g.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:g.jsxs("div",{ref:l,className:"modal session-summary",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[g.jsxs("div",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),g.jsx("span",{id:"ss-title",className:"modal-tool-name",title:i.cwd??i.sessionId,children:i.label}),g.jsxs("span",{className:"modal-tool-id",children:["· ",i.sessionId.slice(0,8)]})]}),g.jsxs("div",{className:"modal-actions",children:[g.jsx("span",{className:"modal-dur",title:"Total wall time",children:i.durationLabel}),g.jsx("button",{type:"button",ref:o,className:"btn",onClick:r,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),g.jsxs("div",{className:"modal-body",children:[g.jsxs("section",{className:"ss-hero",children:[g.jsxs("div",{className:"ss-hero-left",children:[g.jsx("div",{className:"ss-cost-label",children:"total spend"}),g.jsx("div",{className:"ss-cost",children:qe(i.cost.total)}),i.modelChips.length>0&&g.jsx("div",{className:"ss-models",children:i.modelChips.map(u=>g.jsx("span",{className:"model-chip",title:u,children:Rs(u)},u))})]}),g.jsx("div",{className:"ss-hero-right",children:i.cost.total>0&&g.jsxs(g.Fragment,{children:[g.jsx(dy,{cost:i.cost,size:"lg"}),g.jsxs("div",{className:"ss-cost-legend",children:[g.jsxs("span",{className:"ssl ssl-in",children:["input ",g.jsx("b",{children:qe(i.cost.input)})]}),g.jsxs("span",{className:"ssl ssl-out",children:["output ",g.jsx("b",{children:qe(i.cost.output)})]}),g.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",g.jsx("b",{children:qe(i.cost.cacheRead)})]}),g.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",g.jsx("b",{children:qe(i.cost.cacheWrite)})]})]})]})})]}),g.jsxs("section",{className:"ss-stats",children:[g.jsx(to,{label:"agents",value:i.agentCount}),g.jsx(to,{label:"subagents",value:i.subagentCount}),g.jsx(to,{label:"tool calls",value:i.toolCount}),g.jsx(to,{label:"prompts",value:i.promptCount}),g.jsx(to,{label:"tokens",value:i.tokensSum.toLocaleString()}),i.errCount>0&&g.jsx(to,{label:"errors",value:i.errCount,tone:"err"})]}),i.topTools.length>0&&g.jsxs("section",{className:"modal-section",children:[g.jsx("h4",{children:"Most-used tools"}),g.jsx("div",{className:"ss-top-tools",children:i.topTools.map(([u,c])=>g.jsxs("div",{className:"ss-tt",children:[g.jsx("span",{className:"ss-tt-name",children:u}),g.jsx("span",{className:"ss-tt-bar",children:g.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${c/i.topTools[0][1]*100}%`}})}),g.jsx("span",{className:"ss-tt-count",children:c})]},u))})]}),i.firstPrompt&&g.jsxs("section",{className:"modal-section",children:[g.jsx("h4",{children:"Opening prompt"}),g.jsx("div",{className:"ss-prompt",children:i.firstPrompt})]})]})]})}):null}function to({label:e,value:t,tone:r}){return g.jsxs("div",{className:`ss-stat${r?` tone-${r}`:""}`,children:[g.jsx("div",{className:"ss-stat-value",children:t}),g.jsx("div",{className:"ss-stat-label",children:e})]})}function h3(e,t){const r=e.agents.get(t);if(!r)return null;const i=[];for(const N of e.agents.values())N.sessionId===t&&i.push(N);if(i.length===0)return null;const o={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},l=new Set,u=new Map;let c=0,f=0,p=0,d=0,m=0,y,w=1/0,E=0;for(const N of i){const j=dn(N.usage,N.model);o.input+=j.input,o.output+=j.output,o.cacheRead+=j.cacheRead,o.cacheWrite+=j.cacheWrite,o.total+=j.total,N.model&&l.add(N.model),N.kind==="subagent"&&m++,f+=N.prompts.length,!y&&N.prompts.length>0&&(y=N.prompts[0].text),p+=N.usage.inputTokens+N.usage.outputTokens,c+=N.toolCount,w=Math.min(w,N.startedAt),E=Math.max(E,N.endedAt??Date.now());for(const A of N.tools)u.set(A.name,(u.get(A.name)??0)+1),A.ok===!1&&d++}const _=Math.max(0,E-w),b=Math.floor(_/1e3),S=b<60?`${b}s`:b<3600?`${Math.floor(b/60)}m ${String(b%60).padStart(2,"0")}s`:`${Math.floor(b/3600)}h ${Math.floor(b%3600/60)}m`,k=Array.from(u.entries()).sort((N,j)=>j[1]-N[1]).slice(0,5);return{sessionId:t,label:r.label||r.cwdBasename||"session",cwd:r.cwd,durationLabel:S,cost:o,modelChips:Array.from(l),agentCount:i.length,subagentCount:m,toolCount:c,promptCount:f,tokensSum:p,errCount:d,topTools:k,firstPrompt:y}}function fy(e){return(e==null?void 0:e.kind)==="permission"}function p3(e){const t=[];for(const r of e)r.kind==="root"&&fy(r.waiting)&&t.push({id:r.id,label:r.label,waiting:r.waiting});return t.sort((r,i)=>r.waiting.since-i.waiting.since)}function m3(e){const t=new Set;for(const r of e)r.state==="active"&&t.add(r.sessionId);return t.size}function p_(e){return e.waiting?fy(e.waiting)?0:1:e.state==="active"?2:3}function g3(e,t){const r=[];for(const i of e.agents.values()){if(i.kind!=="root")continue;let o=i.toolCount,l=dn(i.usage,i.model).total,u=i.endedAt??i.startedAt;for(const c of e.agents.values()){if(c.sessionId!==i.sessionId||c.kind==="root")continue;o+=c.toolCount,l+=dn(c.usage,c.model).total;const f=c.endedAt??c.startedAt;f>u&&(u=f)}r.push({sessionId:i.sessionId,label:i.label||i.cwdBasename||"session",cwdBasename:i.cwdBasename,state:i.state,waiting:i.waiting,modelId:i.model,toolCount:o,cost:l,startedAt:i.startedAt,lastActivity:u})}return r.sort((i,o)=>{const l=p_(i),u=p_(o);return l!==u?l-u:i.waiting&&o.waiting?i.waiting.since-o.waiting.since:o.lastActivity-i.lastActivity}),r}function m_(e,t,r){const i=(t??r)-e;if(i<1e3)return"<1s";const o=Math.floor(i/1e3);if(o<60)return`${o}s`;const l=Math.floor(o/60);return l<60?`${l}m`:`${Math.floor(l/60)}h ${l%60}m`}function v3({state:e,now:t,selectedIds:r,onSelect:i,onClose:o}){const l=R.useMemo(()=>g3(e),[e,e.lastSeq,t]),u=l.filter(f=>f.state==="active").length,c=l.filter(f=>fy(f.waiting)).length;return g.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[g.jsxs("div",{className:"sl-header",children:[g.jsxs("h2",{children:["Sessions ",g.jsx("span",{className:"sl-count",children:l.length})]}),c>0&&g.jsxs("span",{className:"sl-waiting-count",children:[c," waiting"]}),u>0&&g.jsxs("span",{className:"sl-live-count",children:[u," live"]}),g.jsx("button",{className:"btn icon-btn sl-close",onClick:o,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),g.jsxs("div",{className:"sl-rows",children:[l.length===0&&g.jsx("div",{className:"sl-empty",children:"No sessions yet."}),l.map(f=>{const p=r.has(f.sessionId);return g.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,onClick:()=>i(f.sessionId),title:`Focus ${f.label}`,children:[g.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),g.jsx("span",{className:"vis-hidden",children:cy(f.state)}),g.jsxs("div",{className:"sl-row-body",children:[g.jsxs("div",{className:"sl-row-head",children:[g.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&g.jsx("span",{className:"model-chip",title:f.modelId,children:Rs(f.modelId)})]}),g.jsxs("div",{className:"sl-row-meta",children:[g.jsxs("span",{title:"tool calls",children:[g.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&g.jsx("span",{className:"sl-cost",title:"total spend",children:g.jsx("b",{children:qe(f.cost)})}),f.waiting?g.jsxs("span",{className:"sl-waiting",title:`${Fu(f.waiting)}
|
|
65
|
+
Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`,children:["waiting ",m_(f.waiting.since,void 0,t)]}):g.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:m_(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]})]})]},f.sessionId)})]})]})}const Gt="ccdeck";function WC(e){const t=Math.max(0,e);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function $v(e){return WC(Math.floor(e/1e3))}function VC(e,t){const r=e-t;if(r<=0)return null;const i=Math.floor(r/86400),o=Math.floor(r%86400/3600),l=Math.floor(r%3600/60);return i>0?`${i}d ${o}h`:o>0?`${o}h ${l}m`:`${l}m`}function y3(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function w3(e,t,r){const i=new Date(e),o=$v(t-e);return{label:y3(i,new Date(t))?o:`${o} · ${i.toLocaleDateString(r,{month:"short",day:"numeric"})}`,title:i.toLocaleString(r,{dateStyle:"medium",timeStyle:"medium"})}}function g_(e,t){if(!e)return null;const r=t-Math.floor(e/1e3);return r<10?"just now":r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}function x3(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 Kd="__unknown__";function _3(e,t,r,i){const o=Math.max(0,t-i),l=Math.max(0,r-o);if(l<120)return null;const u=Math.min(100,l/r*100),c=e-u;if(Math.abs(c)<3)return{label:"on pace",color:"var(--ok)",expectedPct:u,isDeficit:!1};if(c>0){const f=100-e,p=l>0?e/l:0,d=p>0?f/p:1/0,m={label:`${Math.round(c)}% ahead`,color:"var(--warn)",expectedPct:u,isDeficit:!0};if(d<o&&d<86400){const y=Math.floor(d/3600),w=Math.floor(d%3600/60);m.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return m}return{label:`${Math.round(-c)}% reserve`,color:"var(--ok)",expectedPct:u,isDeficit:!1}}function li({pct:e,label:t,reset:r,resetAt:i,windowSec:o,limitReached:l,nowSec:u}){const c=Math.min(100,Math.max(0,e)),p=l||c>=90?"var(--err)":c>=70?"var(--warn)":"var(--accent)",d=c===0?"< 1%":`${c}%`,m=c===0?2:c,y=i?VC(i,u):null,w=i&&o?_3(c,i,o,u):null;return g.jsxs("div",{className:"qb-row",children:[g.jsxs("div",{className:"qb-meta",children:[g.jsxs("span",{className:"qb-label",children:[t,l&&g.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),g.jsx("span",{className:"qb-pct",style:{color:p},children:d})]}),g.jsxs("div",{className:"qb-track",children:[g.jsx("div",{className:"qb-fill",style:{width:`${m}%`,background:p,opacity:c===0?.4:1}}),w&&g.jsx("div",{className:"qb-pace-marker",style:{left:`${w.expectedPct}%`,background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})]}),g.jsxs("div",{className:"qb-reset-row",children:[y?g.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):r?g.jsxs("span",{className:"qb-reset",children:["resets ",r]}):null,w&&g.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const b3=6e4;function S3(e){const[t,r]=R.useState(null),[i,o]=R.useState(!1),l=R.useRef(null),u=async(f=!1)=>{f&&o(!0);try{const d=await fetch(f?"/api/quota?refresh=1":"/api/quota");d.ok&&r(await d.json())}catch{}finally{f&&o(!1)}};return R.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),b3),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{quota:t,loading:i,refresh:()=>{e&&u(!0)}}}function k3(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 GC=6e4;function E3(e){const[t,r]=R.useState(null),[i,o]=R.useState(!1),l=R.useRef(null),u=async(f=!1)=>{f&&o(!0);try{const d=await fetch(f?"/api/codex-quota?refresh=1":"/api/codex-quota");d.ok&&r(await d.json())}catch{}finally{f&&o(!1)}};return R.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),GC),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{data:t,loading:i,refresh:()=>{e&&u(!0)}}}function N3(e){const[t,r]=R.useState(null),i=R.useRef(null),o=async()=>{try{const l=await fetch("/api/codex-usage");l.ok&&r(await l.json())}catch{}};return R.useEffect(()=>{if(e)return o(),i.current=window.setInterval(o,GC),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t}}function C3({state:e,now:t,providers:r,onClose:i}){var V,z;const{quota:o,loading:l,refresh:u}=S3(r.claude),{data:c,loading:f,refresh:p}=E3(r.codex),{data:d}=N3(r.codex),[m,y]=R.useState(()=>Math.floor(Date.now()/1e3));R.useEffect(()=>{const C=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(C)},[]);const{byModel:w,totalCost:E,totalTokens:_,burnRate:b}=R.useMemo(()=>{const C=new Map,F={total:0,input:0,output:0,cacheRead:0,cacheWrite:0};let $=0,re=0,J=0,W=0;for(const q of e.agents.values()){const Q=q.model??Kd,ne=dn(q.usage,q.model),ae=C.get(Q);ae?(ae.inputTokens+=q.usage.inputTokens,ae.outputTokens+=q.usage.outputTokens,ae.cacheReadTokens+=q.usage.cacheReadTokens,ae.cacheCreateTokens+=q.usage.cacheCreateTokens,ae.cost.total+=ne.total,ae.cost.input+=ne.input,ae.cost.output+=ne.output,ae.cost.cacheRead+=ne.cacheRead,ae.cost.cacheWrite+=ne.cacheWrite,ae.agentCount++):C.set(Q,{model:Q,inputTokens:q.usage.inputTokens,outputTokens:q.usage.outputTokens,cacheReadTokens:q.usage.cacheReadTokens,cacheCreateTokens:q.usage.cacheCreateTokens,cost:{...ne},agentCount:1,priced:go(q.model)!=null}),F.total+=ne.total,F.input+=ne.input,F.output+=ne.output,F.cacheRead+=ne.cacheRead,F.cacheWrite+=ne.cacheWrite,$+=q.usage.inputTokens,re+=q.usage.outputTokens,J+=q.usage.cacheReadTokens,W+=q.usage.cacheCreateTokens}const Z=Array.from(C.values()).sort((q,Q)=>Q.cost.total-q.cost.total||Q.inputTokens+Q.outputTokens-(q.inputTokens+q.outputTokens));let I=0,G=0;for(const q of e.agents.values()){if(q.state!=="active")continue;const Q=dn(q.usage,q.model);I+=Q.total,G=Math.max(G,((q.endedAt??t)-q.startedAt)/1e3)}const K=G>0?Cu(I,G):null;return{byModel:Z,totalCost:F,totalTokens:{in:$,out:re,cacheR:J,cacheC:W},burnRate:K}},[e,e.lastSeq,t]),S=R.useMemo(()=>{const C=[],F=$=>go($.model)==null?$.usage.inputTokens+$.usage.outputTokens:0;for(const $ of e.agents.values()){if($.kind!=="root")continue;let re=dn($.usage,$.model).total,J=$.usage.inputTokens,W=$.usage.outputTokens,Z=F($);for(const I of e.agents.values())I.sessionId!==$.sessionId||I.kind==="root"||(re+=dn(I.usage,I.model).total,J+=I.usage.inputTokens,W+=I.usage.outputTokens,Z+=F(I));C.push({sessionId:$.sessionId,label:$.label||$.cwdBasename||"session",state:$.state,cost:re,inputTokens:J,outputTokens:W,unpricedTokens:Z})}return C.sort(($,re)=>re.cost-$.cost||re.inputTokens+re.outputTokens-($.inputTokens+$.outputTokens)).slice(0,12)},[e,e.lastSeq]),k=E.total>0,N=_.in+_.out,j=w.filter(C=>C.cost.total>0||C.inputTokens+C.outputTokens>0),A=S.filter(C=>C.cost>0||C.inputTokens+C.outputTokens>0),M=j.some(C=>!C.priced),O=l||f,P=g_(o==null?void 0:o.fetchedAt,m),D=g_(c==null?void 0:c.fetchedAt,m),L=()=>{u(),p()},U=r.claude&&r.codex?"Refresh Claude + Codex quota":r.codex?"Refresh Codex quota":"Refresh Claude quota";return g.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[g.jsxs("div",{className:"up-header",children:[g.jsx("h2",{children:"Usage"}),b&&g.jsx("span",{className:"up-rate",children:b}),g.jsxs("div",{className:"up-header-right",children:[(r.claude||r.codex)&&g.jsx("button",{type:"button",className:"btn up-refresh-btn",onClick:L,disabled:O,"aria-label":U,title:U,children:O?"…":"↻"}),g.jsx("button",{type:"button",className:"btn icon-btn up-close",onClick:i,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),r.claude&&g.jsxs("section",{className:"up-section up-quota-section",children:[g.jsxs("h3",{className:"up-section-title",children:["Claude quota",P&&!l&&g.jsx("span",{className:"up-section-age",title:x3(o==null?void 0:o.source),children:P})]}),o!=null&&o.ok?g.jsxs("div",{className:"up-quota-bars",children:[o.session5hPct!=null&&g.jsx(li,{label:"5-hour window",pct:o.session5hPct,reset:o.session5hReset,resetAt:o.session5hResetAt,windowSec:o.session5hWindowSec,nowSec:m}),o.week7dPct!=null&&g.jsx(li,{label:"7-day window",pct:o.week7dPct,reset:o.week7dReset,resetAt:o.week7dResetAt,windowSec:o.week7dWindowSec,nowSec:m}),o.weekSonnetPct!=null&&g.jsx(li,{label:"Sonnet (7d)",pct:o.weekSonnetPct,nowSec:m}),o.weekOpusPct!=null&&g.jsx(li,{label:"Opus (7d)",pct:o.weekOpusPct,nowSec:m})]}):(o==null?void 0:o.ok)===!1?g.jsxs("div",{className:"up-quota-na",children:[g.jsx("span",{children:"Quota unavailable."}),g.jsxs("span",{className:"up-quota-hint",children:["Run ",g.jsx("code",{children:"/usage"})," in a claude session, then click ↻"]})]}):g.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),r.codex&&g.jsxs("section",{className:"up-section up-quota-section",children:[g.jsxs("h3",{className:"up-section-title",children:["Codex quota",(c==null?void 0:c.ok)&&c.planLabel&&g.jsx("span",{className:"up-plan-badge",children:c.planLabel}),D&&!f&&g.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:D})]}),c!=null&&c.ok?g.jsxs("div",{className:"up-quota-bars",children:[(V=c.windows)==null?void 0:V.map(C=>g.jsx(li,{label:C.label,pct:C.pct,reset:C.reset??void 0,resetAt:C.resetAt??void 0,windowSec:C.windowSec??void 0,limitReached:c.limitReached&&C.pct>=100,nowSec:m},C.id)),(z=c.extraWindows)==null?void 0:z.map(C=>g.jsx(li,{label:C.label,pct:C.pct,reset:C.reset??void 0,resetAt:C.resetAt??void 0,windowSec:C.windowSec??void 0,nowSec:m},C.id)),c.creditLimit&&g.jsx(li,{label:`spend cap · $${Math.round(c.creditLimit.used)} of $${Math.round(c.creditLimit.limit)}`,pct:c.creditLimit.usedPct,reset:c.creditLimit.reset??void 0,resetAt:c.creditLimit.resetAt??void 0,limitReached:c.spendControlReached,nowSec:m}),c.creditsBalance&&!c.creditsUnlimited&&g.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",c.creditsBalance,c.overageReached&&" · overage limit reached"]}),c.creditsUnlimited&&g.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),c.resetCredits&&c.resetCredits.availableCount>0&&g.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Gt} only reports them`,children:[c.resetCredits.availableCount," rate-limit reset",c.resetCredits.availableCount!==1?"s":""," available",c.resetCredits.nextExpiryAt&&` · expires ${new Date(c.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),c.promo&&g.jsx("div",{className:"up-quota-sub",children:c.promo}),c.partial&&g.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(c==null?void 0:c.ok)===!1?g.jsxs("div",{className:"up-quota-na",children:[g.jsx("span",{children:"Quota unavailable."}),g.jsx("span",{className:"up-quota-hint",children:k3(c.reason)})]}):g.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(d==null?void 0:d.ok)&&d.window7d&&d.window7d.sessionCount>0&&g.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${d.window5h?`
|
|
66
|
+
last 5h: ${Nt(d.window5h.totalTokens)} tokens · ${d.window5h.sessionCount} session${d.window5h.sessionCount!==1?"s":""}`:""}`,children:[Nt(d.window7d.totalTokens)," tokens · ",d.window7d.sessionCount," session",d.window7d.sessionCount!==1?"s":""," (7d)"]})]}),N>0?g.jsxs(g.Fragment,{children:[k&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"up-total",children:[g.jsx("span",{className:"up-total-value",children:qe(E.total)}),g.jsx("span",{className:"up-total-label",children:"total spend"})]}),g.jsx(dy,{cost:E})]}),g.jsxs("div",{className:"up-tokens-row",children:[g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"in"}),Nt(_.in)]}),g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"out"}),Nt(_.out)]}),_.cacheR>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache r"}),Nt(_.cacheR)]}),_.cacheC>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache c"}),Nt(_.cacheC)]})]}),j.length>0&&g.jsxs("section",{className:"up-section",children:[g.jsx("h3",{className:"up-section-title",children:"By model"}),g.jsxs("table",{className:"up-table",children:[g.jsx("thead",{children:g.jsxs("tr",{children:[g.jsx("th",{children:"Model"}),g.jsx("th",{children:"Tokens"}),g.jsx("th",{children:"Cost"})]})}),g.jsx("tbody",{children:j.map(C=>g.jsxs("tr",{children:[g.jsx("td",{className:"up-model-name",title:C.model===Kd?"no model reported yet":C.model,children:C.model===Kd?"unknown":Rs(C.model)}),g.jsx("td",{className:"up-num",children:Nt(C.inputTokens+C.outputTokens)}),C.priced?g.jsx("td",{className:"up-num up-cost-val",children:qe(C.cost.total)}):g.jsx("td",{className:"up-num up-unpriced",children:mu})]},C.model))})]})]}),A.length>0&&g.jsxs("section",{className:"up-section",children:[g.jsx("h3",{className:"up-section-title",children:"By session"}),g.jsx("div",{className:"up-sessions",children:A.map(C=>g.jsxs("div",{className:"up-session-row",children:[g.jsx("span",{className:`sl-dot state-${C.state}`,"aria-hidden":!0}),g.jsx("span",{className:"vis-hidden",children:cy(C.state)}),g.jsx("span",{className:"up-session-label",children:C.label}),g.jsx("span",{className:"up-session-tokens",children:Nt(C.inputTokens+C.outputTokens)}),C.cost>0?g.jsxs("span",{className:"up-session-cost",title:C.unpricedTokens>0?`${Nt(C.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[qe(C.cost),C.unpricedTokens>0?"+":""]}):g.jsx("span",{className:"up-session-cost up-unpriced",children:mu})]},C.sessionId))})]}),M&&g.jsxs("div",{className:"up-hint",children:["“",mu,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):g.jsxs("div",{className:"up-empty",children:["No usage data yet.",g.jsx("br",{}),"Start a Claude Code or Codex session."]})]})}const j3=3e3,Xd=20,ca=36,no=8;function v_(e){return`${(e/1024**3).toFixed(1)} GB`}function T3(){const[e,t]=R.useState(null),r=R.useRef(null);return R.useEffect(()=>{let i=!0;const o=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();i&&(p!=null&&p.ok)&&t(p)}catch{}},l=()=>{r.current==null&&(o(),r.current=window.setInterval(o,j3))},u=()=>{r.current!=null&&(window.clearInterval(r.current),r.current=null)},c=()=>{if(document.visibilityState==="hidden"){u();return}l(),o()};return l(),document.addEventListener("visibilitychange",c),()=>{i=!1,u(),document.removeEventListener("visibilitychange",c)}},[]),e}function R3(){const e=T3();if(!e||e.cpu==null||!e.memory)return g.jsx("span",{className:"sysmeter idle",title:"Sampling this machine…",children:g.jsx("span",{className:"sm-box","aria-hidden":!0,children:g.jsxs("span",{className:"sm-graphic",children:[g.jsx("svg",{className:"sm-spark",width:ca,height:no,viewBox:`0 0 ${ca} ${no}`}),g.jsx("span",{className:"sm-ram"})]})})});const{cpu:t,cpuHistory:r,cores:i,memory:o,loadavg:l}=e,u=o.usedPct>=90,c=r.slice(-Xd),f=Xd-c.length,p=ca/Xd,d=[`CPU ${t.toFixed(0)}% of ${i} cores`,l?`load ${l[0]} · ${l[1]} · ${l[2]} (1m · 5m · 15m)`:null,`Memory ${o.usedPct.toFixed(0)}% used · ${v_(o.available)} available of ${v_(o.total)}`,"","This machine, not this session."].filter(m=>m!==null).join(`
|
|
67
|
+
`);return g.jsxs("span",{className:"sysmeter",title:d,children:[g.jsxs("span",{className:"sm-box","aria-hidden":!0,children:[g.jsxs("span",{className:"sm-graphic",children:[g.jsx("svg",{className:"sm-spark",width:ca,height:no,viewBox:`0 0 ${ca} ${no}`,children:c.map((m,y)=>{const w=f+y,E=Math.max(1,m/100*no),_=.32+.68*((y+1)/c.length);return g.jsx("rect",{x:w*p,y:no-E,width:Math.max(.8,p-.7),height:E,rx:.5,fill:"var(--accent)",opacity:_},w)})}),g.jsx("span",{className:"sm-ram",children:g.jsx("span",{className:`sm-ram-fill${u?" warn":""}`,style:{transform:`scaleX(${Math.max(2,o.usedPct)/100})`}})})]}),g.jsxs("span",{className:"sm-read",children:[g.jsx("b",{children:t.toFixed(0)}),g.jsx("i",{children:"·"}),g.jsx("b",{children:o.usedPct.toFixed(0)})]})]}),g.jsxs("span",{className:"sm-sr",children:["CPU ",t.toFixed(0)," percent, memory ",o.usedPct.toFixed(0)," percent used"]})]})}const y_=18,A3=1100,ro=(e,t)=>{const r=Math.sin(e*12.9898+t*78.233)*43758.5453;return r-Math.floor(r)},I3=Array.from({length:y_},(e,t)=>{const r=-72+144*t/(y_-1)+(ro(t,1)-.5)*9,i=(r-90)*(Math.PI/180),o=(54+32*Math.cos(r*Math.PI/180))*(.74+ro(t,2)*.52);return{dx:Math.cos(i)*o,dy:Math.sin(i)*o,rot:(t%2?1:-1)*(100+ro(t,3)*260),delay:Math.round(ro(t,4)*90),dur:760+Math.round(ro(t,5)*260),scale:.8+ro(t,6)*.45,hue:t%4,round:t%3===0}});function w_({anchor:e,lifetimeMs:t=A3}){var l;const[r,i]=R.useState(null),o=typeof window<"u"&&((l=window.matchMedia)==null?void 0:l.call(window,"(prefers-reduced-motion: reduce)").matches);return R.useEffect(()=>{if(o)return;const u=e.current;if(!u)return;const c=u.getBoundingClientRect();i({x:c.left+c.width/2,y:c.top+c.height/2});const f=window.setTimeout(()=>i(null),t);return()=>window.clearTimeout(f)},[e,t,o]),o||!r?null:dM.createPortal(g.jsx("div",{className:"confetti",style:{left:`${r.x}px`,top:`${r.y}px`},"aria-hidden":!0,children:I3.map((u,c)=>g.jsx("span",{className:`confetti-bit${u.round?" round":""}`,"data-hue":u.hue,style:{"--dx":`${u.dx.toFixed(1)}px`,"--dy":`${u.dy.toFixed(1)}px`,"--rot":`${u.rot}deg`,"--s":u.scale.toFixed(2),animationDelay:`${u.delay}ms`,animationDuration:`${u.dur}ms, ${u.dur}ms`}},c))}),document.body)}const YC=new Set(["awaiting_url","awaiting_code","registering"]);function M3(e){return e!=null&&YC.has(e)}function KC(e){return e!=null&&e!=="done"&&!YC.has(e)}const O3="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",P3="the sign-in did not complete";function L3({state:e,serverError:t,localError:r}){const i=e==="idle";return{title:i?"Sign-in ended":"Sign-in failed",message:r||t||(i?O3:P3)}}const $3="done";function q3(){let e=!1;return{shouldAnnounce(t){return t!==$3?(e=!1,!1):e?!1:(e=!0,!0)}}}function hy(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const D3={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 ccdeck1:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${Gt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters"},F3={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"},z3=`claude-swap could not read the login keychain — start ${Gt} from a Terminal window rather than a background service`;function qv(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(vo(e)))return z3;const r=hy(F3,e==null?void 0:e.reason);return r||(e==null?void 0:e.reason)||t}function vo(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const B3={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"},U3="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 H3(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const W3="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",V3="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",G3=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),Y3=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,K3=/[\\/]_npx[\\/]/i,X3=`the copy of ccusage ${Gt} installed for itself`;function Q3(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function Z3(e,t){const r=J3(e,t),i=Q3(e);switch(e==null?void 0:e.stage){case"npx":return i?`ccusage failed on both of its paths. The managed install failed first — ${i} — and the deck then fell back to npx, where ${da(r)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${da(r)}`;case"managed":return`${X3} failed to run: ${da(r)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${da(r)}`:`the ccusage this deck found on your PATH failed to run: ${da(r)}`;default:return r}}const da=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function J3(e,t){const r=vo(e);if(G3(r)){if(K3.test(r))return V3;if(Y3.test(r))return W3}if(H3(r))return U3;const i=hy(B3,e==null?void 0:e.reason);return i||(e==null?void 0:e.reason)||t}function gu(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&KC(e.state))return e.error;const r=hy(D3,e==null?void 0:e.reason);return r||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}const e$=1500;async function iu(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Dv=ue.forwardRef((e,t)=>g.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[g.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),g.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));Dv.displayName="SuccessMark";function t$({onClose:e,onChanged:t}){const[r,i]=R.useState("login"),[o,l]=R.useState(null),[u,c]=R.useState(""),[f,p]=R.useState(""),[d,m]=R.useState(!1),[y,w]=R.useState(null),[E,_]=R.useState(null),b=R.useRef(!1),S=R.useRef(null),k=R.useRef(null),N=R.useRef(null),j=R.useRef(null),A=R.useCallback(()=>{b.current&&iu({action:"login-cancel"}).catch(()=>{}),e()},[e]),M=wo(A,{focusRef:N}),O=R.useCallback(async()=>{m(!0),w(null),b.current=!0;const F=await iu({action:"login"}).catch(()=>null);if(m(!1),!(F!=null&&F.ok)){w(gu(F,"could not start the sign-in"));return}l(F)},[]);R.useEffect(()=>{if(!M3(o==null?void 0:o.state))return;const F=window.setInterval(async()=>{try{const $=await fetch("/api/claude-accounts/login");$.ok&&l(await $.json())}catch{}},e$);return()=>window.clearInterval(F)},[o]);const P=R.useRef(t);P.current=t;const D=R.useRef(q3());R.useEffect(()=>{var F;(o==null?void 0:o.state)==="awaiting_code"&&((F=S.current)==null||F.focus()),D.current.shouldAnnounce(o==null?void 0:o.state)&&P.current()},[o==null?void 0:o.state]),R.useEffect(()=>{var F;r==="paste"&&((F=k.current)==null||F.focus())},[r]);const L=R.useCallback(async()=>{var $;m(!0),w(null);const F=await iu({action:"login-code",code:u}).catch(()=>null);if(m(!1),!(F!=null&&F.ok)){w(gu(F,"the code was not accepted")),F!=null&&F.state&&l(F),($=S.current)==null||$.select();return}c(""),l(F)},[u,o]),U=R.useCallback(async()=>{m(!0),w(null);const F=await iu({action:"import",blob:f}).catch(()=>null);if(m(!1),!(F!=null&&F.ok)){w(gu(F,"the import failed"));return}p(""),_({added:F.added===!0,num:F.num??null,email:F.email??null}),t()},[f,t]),V=(o==null?void 0:o.state)==="done"?o.account:null,z=KC(o==null?void 0:o.state)||!!(y&&b.current&&!d),C=L3({state:o==null?void 0:o.state,serverError:o==null?void 0:o.error,localError:y});return g.jsx("div",{className:"modal-backdrop",onClick:A,role:"presentation",children:g.jsxs("div",{ref:M,className:"modal aa-modal",onClick:F=>F.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[g.jsxs("header",{className:"modal-head",children:[g.jsx("div",{className:"modal-title",children:g.jsxs("span",{className:"aa-tabs",role:"tablist",children:[g.jsx("button",{type:"button",role:"tab","aria-selected":r==="login",className:`aa-tab${r==="login"?" on":""}`,onClick:()=>i("login"),children:"Sign in"}),g.jsx("button",{type:"button",role:"tab","aria-selected":r==="paste",className:`aa-tab${r==="paste"?" on":""}`,onClick:()=>i("paste"),children:"Paste a share"})]})}),g.jsx("div",{className:"modal-actions",children:g.jsx("button",{type:"button",className:"btn icon-btn",onClick:A,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),g.jsx("section",{className:"modal-body aa-body",children:r==="login"?V?g.jsxs("div",{className:"aa-done",children:[g.jsx(Dv,{ref:j}),g.jsx(w_,{anchor:j}),g.jsx("h4",{children:V.added?`Account ${V.num} added`:"Credentials refreshed"}),g.jsxs("p",{className:"aa-note",children:[g.jsx("strong",{children:V.email}),V.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),g.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(o==null?void 0:o.state)==="awaiting_code"||(o==null?void 0:o.state)==="registering"?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"1 · Approve in the browser"}),g.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),g.jsx("a",{className:"aa-link",href:o.url??"#",target:"_blank",rel:"noreferrer noopener",children:o.url})]}),g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"2 · Paste the code it gives you"}),g.jsxs("div",{className:"aa-field",children:[g.jsx("input",{ref:S,type:"text",value:u,onChange:F=>c(F.target.value),onKeyDown:F=>{F.key==="Enter"&&u.trim()&&!d&&L()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:o.state==="registering"}),g.jsx("button",{type:"button",className:"btn primary",disabled:d||!u.trim()||o.state==="registering",onClick:L,children:o.state==="registering"?"registering…":"Continue"})]}),(y||o.error)&&g.jsx("p",{className:"aa-err",children:y??o.error}),g.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):z?g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:C.title}),g.jsx("p",{className:"aa-err",children:C.message}),g.jsx("button",{type:"button",className:"btn",onClick:()=>{b.current=!1,l(null),w(null),O()},children:"Try again"})]}):d||b.current?g.jsx("div",{className:"aa-step",children:g.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):g.jsxs("div",{className:"aa-step aa-primer",children:[g.jsx("h4",{children:"Sign in to Anthropic"}),g.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in, then asks for the code it shows you. claude-swap records the account when it completes, and the account you are using now stays active."}),g.jsx("div",{className:"aa-actions",children:g.jsx("button",{type:"button",ref:N,className:"btn primary",onClick:O,disabled:d,children:"Open the sign-in page"})})]}):E?g.jsxs("div",{className:"aa-done",children:[g.jsx(Dv,{ref:j}),E.added&&g.jsx(w_,{anchor:j}),g.jsx("h4",{children:E.added?`Account ${E.num} imported`:"Already here"}),g.jsx("p",{className:"aa-note",children:E.added?g.jsxs(g.Fragment,{children:[E.email?g.jsx("strong",{children:E.email}):"That account"," is in the rotation now. Nothing changed on the deck you copied it from."]}):"This deck already holds that account, so nothing changed."}),g.jsxs("div",{className:"aa-actions",children:[g.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),g.jsx("button",{type:"button",className:"btn",onClick:()=>_(null),children:"Import another"})]})]}):g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"Paste an account shared from another deck"}),g.jsxs("div",{className:"aa-field",children:[g.jsx("input",{ref:k,type:"text",value:f,onChange:F=>p(F.target.value),onKeyDown:F=>{F.key==="Enter"&&f.trim()&&!d&&U()},placeholder:"ccdeck1:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),g.jsx("button",{type:"button",className:"btn primary",disabled:d||!f.trim(),onClick:U,children:d?"importing…":"Import"})]}),y&&g.jsx("p",{className:"aa-err",children:y}),g.jsxs("p",{className:"aa-note",children:["Use ",g.jsx("strong",{children:"share"})," on an account in the other deck. A share carries a live login and expires ten minutes after it is made."]})]})})]})})}function n$(e,t){const r=new Set(e),i=e.length?Math.max(...e):0;return[...new Set([...e,i+1])].sort((o,l)=>o-l).map(o=>{const l=o===t?"here":r.has(o)?"swap":"free";return{slot:o,kind:l,label:l==="here"?`slot ${o}`:`slot ${o} · ${l}`}})}function r$(e,t,r){if(!(r!=null&&r.ok))return null;const i=Number.isInteger(r.to)?r.to:null;if(i==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const o=r.swapped===!0&&i!==t;return{menuFor:e.menuFor===t?i:o&&e.menuFor===i?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:o?{at:i,displaced:t}:null}}const s$=64;function i$(e,t){const r=e.trim();return{alias:r,commit:r!==(t??"").trim()}}const o$=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function x_(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function a$(e){const t=e.find(i=>!i.ok);if(!t)return null;const r=vo(t.body);return{text:qv(t.body,`the deck server answered ${t.status}`),...r?{raw:r}:{},reload:!0}}function __(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 b_=15e3,l$=8e3,u$=1800,c$=3e4,d$=[70,80,85,90,95];function S_(e,t){return WC(t-Math.floor(e/1e3))}function f$(e,t){if(!e)return"";const r=Math.floor(e/1e3)-t;return r<=0?" · due":r<60?` · next in ${r}s`:` · next in ${Math.round(r/60)}m`}function h$(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 p$({lane:e,nowSec:t}){const r=Math.min(100,Math.max(0,e.pct)),i=r>=90?"var(--err)":r>=70?"var(--warn)":"var(--accent)",o=e.resetAt?VC(e.resetAt,t):null;return g.jsxs("div",{className:"ap-lane",children:[g.jsx("span",{className:"ap-lane-label",children:e.label}),g.jsx("div",{className:"ap-lane-track",children:g.jsx("div",{className:"ap-lane-fill",style:{width:`${r===0?1.5:r}%`,background:i,opacity:r===0?.4:1}})}),g.jsxs("span",{className:"ap-lane-pct",style:{color:i},children:[r,"%"]}),g.jsx("span",{className:"ap-lane-reset",children:o?`resets ${o}`:""})]})}async function m$(e){var r;let t=!1;try{t=await Promise.race([((r=navigator.clipboard)==null?void 0:r.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(i=>window.setTimeout(()=>i(!1),500))])}catch{t=!1}if(t)return!0;try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(i),i.select(),t=document.execCommand("copy"),i.remove()}catch{t=!1}return t}function g$(e,t){const r=Math.round(e/1e3)-t;return r<=0?{text:"expired",tone:"gone"}:r<60?{text:`expires in ${r}s`,tone:"soon"}:{text:`expires in ${Math.round(r/60)}m`,tone:"ok"}}function v$({onClose:e}){var ne,ae,fe;const[t,r]=R.useState(null),[i,o]=R.useState(null),[l,u]=R.useState(null),[c,f]=R.useState(!1),[p,d]=R.useState(null),[m,y]=R.useState(null),[w,E]=R.useState(()=>Math.floor(Date.now()/1e3)),_=R.useRef(null),[b,S]=R.useState(null),[k,N]=R.useState(!1),[j,A]=R.useState(""),[M,O]=R.useState(null),[P,D]=R.useState(null),[L,U]=R.useState(null),[V,z]=R.useState(!1),[C,F]=R.useState(null),$=R.useCallback(async(te=!1)=>{te&&f(!0);const ce=new AbortController,Ce=window.setTimeout(()=>ce.abort(),c$);try{const[ve,Re]=await Promise.all([fetch(`/api/claude-accounts${te?"?refresh=1":""}`,{signal:ce.signal}),fetch("/api/cswap-auto",{signal:ce.signal})]);ve.ok&&r(await ve.json()),Re.ok&&o(await Re.json());const ye=a$([await x_(ve),await x_(Re)]);y(Ee=>__(Ee,ye))}catch{y(ve=>__(ve,o$))}finally{window.clearTimeout(Ce),te&&f(!1)}},[]),re=R.useCallback(async(te,ce)=>{u(ce),y(null);try{const ve=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return ve!=null&&ve.ok||y({text:qv(ve,"command failed"),raw:vo(ve)}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]),J=R.useCallback(async(te,ce)=>{u(ce),y(null);try{const ve=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return ve!=null&&ve.ok||y({text:gu(ve,"command failed")}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]);R.useEffect(()=>($(!0),_.current=window.setInterval(()=>$(!1),b_),()=>{_.current!=null&&window.clearInterval(_.current)}),[$]),R.useEffect(()=>{const te=window.setInterval(()=>E(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(te)},[]);const W=((ne=i==null?void 0:i.settings["autoswitch.threshold"])==null?void 0:ne.value)??"90",Z=(ae=t==null?void 0:t.accounts)==null?void 0:ae.find(te=>te.active),I=Z!=null&&Z.lanes.length?Math.max(...Z.lanes.map(te=>te.pct)):null,G=I!=null&&I>=Number(W)-15,K=async te=>{d(te),y(null);try{const Ce=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:te})})).json().catch(()=>null);Ce!=null&&Ce.ok||y({text:qv(Ce,"the switch failed"),raw:vo(Ce)}),await $(!0)}catch{y({text:"server unreachable"})}finally{d(null)}},q=async(te,ce)=>{const{commit:Ce,alias:ve}=i$(j,ce);if(Ce){const Re=await J({action:"alias",account:te,alias:ve},`alias-${te}`);if(await $(!0),!(Re!=null&&Re.ok))return;A(ve)}O(te),window.setTimeout(()=>O(Re=>Re===te?null:Re),u$)},Q=async(te,ce)=>{const Ce=await J({action:"move",account:te,slot:ce},`move-${te}`),ve=r$({menuFor:b,shareFor:(L==null?void 0:L.num)??null},te,Ce);if(await $(!0),ve){S(ve.menuFor),D(ve.confirmRemove),ve.shareFor==null&&(U(null),z(!1)),F(ve.swapNote);const Re=ve.swapNote;Re&&window.setTimeout(()=>F(ye=>ye===Re?null:ye),l$)}};return g.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[g.jsxs("div",{className:"ap-header",children:[g.jsx("h2",{children:"Accounts"}),g.jsxs("div",{className:"ap-header-right",children:[g.jsx("button",{type:"button",className:"btn ap-add",onClick:()=>N(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),g.jsx("button",{type:"button",className:"btn ap-refresh",onClick:()=>$(!0),disabled:c,"aria-label":"Reload accounts",title:"Reload from claude-swap",children:c?"…":"↻"}),g.jsx("button",{type:"button",className:"btn icon-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),t==null?m?g.jsxs("div",{className:"ap-empty",role:"alert",children:[g.jsx("span",{title:m.raw||void 0,children:m.text}),g.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",b_/1e3," seconds."]}),g.jsx("button",{type:"button",className:"ap-fix",disabled:c,onClick:()=>$(!0),children:c?"trying…":"try again"})]}):g.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?g.jsxs(g.Fragment,{children:[(fe=t.accounts)==null?void 0:fe.map(te=>g.jsxs("div",{className:`ap-account${te.active?" active":""}${te.disabled?" disabled":""}`,children:[g.jsxs("div",{className:"ap-account-head",children:[g.jsx("span",{className:"ap-num",children:te.num}),te.alias&&g.jsx("span",{className:"ap-alias",title:te.alias,children:te.alias}),g.jsx("span",{className:"ap-email",title:te.org??void 0,children:te.email}),g.jsx("button",{type:"button",className:`ap-more${b===te.num?" on":""}`,"aria-label":`Manage account ${te.num}`,"aria-expanded":b===te.num,"aria-controls":b===te.num?`ap-manage-${te.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{S(b===te.num?null:te.num),A(te.alias??""),D(null),U(null),z(!1),F(null),O(null)},children:"⋯"}),te.active?g.jsx("span",{className:"ap-badge-active",children:"● active"}):g.jsx("button",{type:"button",className:"btn ap-switch",disabled:p!=null||te.disabled,onClick:()=>K(te.num),title:te.disabled?"Held out of rotation":`Switch to ${te.alias??te.email}`,children:p===te.num?"…":"switch"})]}),te.lanes.length>0?te.lanes.map(ce=>g.jsx(p$,{lane:ce,nowSec:w},ce.id)):g.jsx("div",{className:"ap-hint",children:"No usage recorded yet."}),g.jsxs("div",{className:"ap-meta",children:[te.error&&(()=>{const ce=h$(te.error);return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"ap-err",title:ce.hint,children:ce.text}),ce.fixable&&g.jsx("button",{type:"button",className:"ap-fix",onClick:()=>N(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),((i==null?void 0:i.enabled)||(i==null?void 0:i.external))&&!te.active&&g.jsx("button",{type:"button",className:"ap-rotate",disabled:l!=null,onClick:()=>re({action:"account",account:te.num,enabled:te.disabled},`rot-${te.num}`).then(()=>$(!0)),title:te.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:te.disabled?"held out":"in rotation"}),te.fetchedAt?g.jsxs("span",{className:`ap-age${te.stale?" ap-stale":""}`,title:"When claude-swap last read this account's usage, and when it plans to read it again. It sets that interval itself — 3 minutes at the fastest, wider while an account is recovering from a rate limit — and every surface, including `cswap watch`, follows the same plan.",children:["collected ",S_(te.fetchedAt,w),f$(te.nextAt,w)]}):g.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),b===te.num&&g.jsxs("div",{className:"ap-manage",id:`ap-manage-${te.num}`,role:"group","aria-label":`Manage account ${te.num}`,children:[g.jsxs("div",{className:"ap-manage-name",children:[g.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${te.num}`,children:"Alias"}),g.jsx("input",{id:`ap-alias-${te.num}`,className:"ap-manage-input",type:"text",value:j,onChange:ce=>A(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"&&q(te.num,te.alias)},maxLength:s$,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,onClick:()=>q(te.num,te.alias),title:"A short name to show instead of the email",children:M===te.num?"saved":"save"})]}),g.jsxs("div",{className:"ap-manage-acts",children:[g.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${te.num}`,children:"Slot"}),g.jsx("span",{className:"ap-field",children:g.jsx("select",{id:`ap-slot-${te.num}`,value:String(te.num),disabled:l!=null,onChange:ce=>Q(te.num,Number(ce.target.value)),children:n$((t.accounts??[]).map(ce=>ce.num),te.num).map(ce=>g.jsx("option",{value:ce.slot,children:ce.label},ce.slot))})}),g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,title:`Copy this account to another ${Gt}. Anyone who has the text can use the account — treat it as the password. The other deck stops accepting it after 10 minutes; that does not make an escaped copy safe.`,onClick:async()=>{z(!1);const ce=await J({action:"share",account:te.num},`share-${te.num}`);ce!=null&&ce.ok&&U({num:te.num,blob:ce.blob,expiresAt:ce.expiresAt})},children:"share"}),g.jsx("button",{type:"button",className:`ap-manage-btn danger${P===te.num?" armed":""}`,disabled:l!=null,title:P===te.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(P!==te.num){D(te.num),window.setTimeout(()=>D(ce=>ce===te.num?null:ce),4e3);return}D(null),J({action:"remove",account:te.num},`rm-${te.num}`).then(()=>{S(null),$(!0)})},children:P===te.num?"confirm":"remove"})]}),(C==null?void 0:C.at)===te.num&&(()=>{var ve;const ce=(ve=t.accounts)==null?void 0:ve.find(Re=>Re.num===C.displaced),Ce=(ce==null?void 0:ce.alias)??(ce==null?void 0:ce.email)??"the account that was there";return g.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${C.at} was taken, so the two accounts traded places: ${Ce} now holds slot ${C.displaced}.`,children:["swapped with slot ",C.displaced]})})(),(L==null?void 0:L.num)===te.num&&(()=>{const ce=g$(L.expiresAt,w),Ce=ce.tone==="gone";return g.jsxs("div",{className:`ap-share${Ce?" expired":""}`,children:[g.jsx("code",{className:"ap-share-blob",children:L.blob}),g.jsxs("div",{className:"ap-share-foot",children:[g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,onClick:async()=>{if(Ce){z(!1);const ve=await J({action:"share",account:te.num},`share-${te.num}`);ve!=null&&ve.ok&&U({num:te.num,blob:ve.blob,expiresAt:ve.expiresAt});return}await m$(L.blob)&&(z(!0),window.setTimeout(()=>z(!1),1800))},children:Ce?"make a new share":V?"copied":"copy"}),g.jsxs("span",{className:"ap-manage-hint",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[g.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",g.jsx("span",{className:`ap-share-expiry ${ce.tone}`,children:ce.text})]})]})]})})()]})]},te.num)),(i==null?void 0:i.ok)&&g.jsxs("div",{className:"ap-auto",children:[g.jsxs("div",{className:"ap-auto-head",children:[g.jsx("span",{className:"ap-auto-title",children:"Auto-switch"}),g.jsxs("span",{className:"ap-auto-ctl",children:[I!=null&&g.jsxs("span",{className:`ap-auto-now${G?" near":""}`,children:[Math.round(I),"%"]}),g.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:g.jsx("select",{"aria-label":"Switch threshold",value:W,disabled:l!=null,onChange:te=>re({action:"setting",key:"autoswitch.threshold",value:te.target.value},"threshold").then(()=>$(!0)),children:d$.map(te=>g.jsxs("option",{value:te,children:[te,"%"]},te))})}),g.jsxs("button",{type:"button",className:`ap-auto-state${i.enabled?" live":""}`,role:"switch","aria-checked":i.enabled,disabled:l!=null,onClick:()=>re({action:"enable",enabled:!i.enabled},"enable").then(()=>$(!0)),title:i.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[g.jsx("i",{className:i.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),i.enabled?"on":"off"]})]})]}),i.external&&g.jsxs("p",{className:"ap-auto-note",children:[g.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",g.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",i.enabled?" — this toggle takes over when you stop it.":"."]}),i.lastTick&&g.jsx("div",{className:"ap-auto-foot",children:g.jsxs("span",{className:"ap-auto-result",children:["checked ",S_(i.lastTick.at,w)]})})]}),m&&g.jsxs("div",{className:"ap-failure",role:"alert",children:[g.jsx("span",{className:"ap-failure-text",title:m.raw||void 0,children:m.text}),g.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>y(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),g.jsx("p",{className:"ap-footnote",title:"Anthropic's usage endpoint allows roughly 28–30 requests per hour per account, shared by every tool on this machine — polling it from here would rate-limit your account. So the deck never fetches: it asks claude-swap to collect while this panel is open, at most once every three minutes, and claude-swap decides whether that touches the network at all.",children:"Collected by claude-swap while this panel is open."})]}):g.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"claude-swap isn't installed."}),g.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),t.hint&&g.jsx("code",{className:"ap-cmd",children:t.hint}),g.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",g.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"No accounts added yet."}),g.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",g.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"Couldn't read the account store."}),g.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),k&&g.jsx(t$,{onClose:()=>N(!1),onChanged:()=>$(!0)})]})}const y$=3e4;function w$({bundle:e,running:t,lastTried:r}){return!t||e===t?!1:r!==t}function x$({bundle:e,running:t,pending:r,lastTried:i}){return t?w$({bundle:e,running:t,lastTried:i})?"reload":r==null||r&&r!==t?"wait":"confirm":"wait"}function _$(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function b$({asked:e,reported:t}){return t?t!==e:!1}function S$(e){const t=e.thresholdMs??y$;return!e.enabled||e.kind!=="restart"||!e.canRestart?{idleSince:null,restart:!1}:e.busy?{idleSince:null,restart:!1}:e.idleSince==null?{idleSince:e.now,restart:!1}:e.now<e.idleSince?{idleSince:e.now,restart:!1}:{idleSince:e.idleSince,restart:e.now-e.idleSince>=t}}function k$({agentCount:e,onConfirm:t,onCancel:r}){const i=R.useRef(null),o=wo(r,{focusRef:i,layer:tL}),l=e===0?"This deletes the server's event log":`This removes ${e===1?"the one agent":`all ${e} agents`} on the canvas and deletes the server's event log`;return g.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:g.jsxs("div",{ref:o,className:"modal clear-confirm",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[g.jsxs("header",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:"status-dot err","aria-hidden":!0}),g.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),g.jsx("div",{className:"modal-actions",children:g.jsx("button",{type:"button",className:"btn icon-btn",onClick:r,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),g.jsxs("section",{className:"modal-body",children:[g.jsxs("p",{className:"modal-note",children:[l," — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone."]}),g.jsxs("div",{className:"cc-actions",children:[g.jsx("button",{type:"button",ref:i,className:"btn",onClick:r,children:"Cancel"}),g.jsx("button",{type:"button",className:"btn danger",onClick:t,children:"Clear everything"})]})]})]})})}function E$(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function N$(e){return e.slice().sort((t,r)=>t.y-r.y||t.x-r.x)}function C$(e,t,r){var u;if(e.length===0)return null;const i=N$(e),o=t?i.findIndex(c=>c.id===t):-1,l=o===-1?r===1?0:i.length-1:(o+r+i.length)%i.length;return((u=i[l])==null?void 0:u.id)??null}const j$=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function T$(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:j$.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const R$=new Set(["","BODY","HTML","#DOCUMENT"]);function A$(e){return!e||uy(e)?!1:!R$.has(String(e.tagName??"").toUpperCase())}function ou(e,t){if(t.size!==0)for(const r of Array.from(e.keys()))t.has(r)||e.delete(r)}function I$(e){const t=new Set;for(const r of e)t.add(r.id),t.add(`group:${r.sessionId}`);return t}function XC(e,t,r){return!t.has(e)||r.has(e)}function M$(e,t,r,i){return!t.has(e)&&XC(e,r,i)}function O$(e,t,r){const i={x:0,y:0};return t.set(e,i),r.add(e),i}function P$(e,t,r,i){r.set(e,t),i.delete(e)}const L$=40,$$=120;function q$(e,t){let r=null,i=0,o=Number.NEGATIVE_INFINITY;const l=()=>{r=null,o=t.now(),e()},u=()=>{r!=null&&(t.clearTimeout(r),r=null)},c=(f,p,d)=>{if(r!=null){if(i<=f)return;u()}const m=Math.min(d,Math.max(0,f-p));i=f,r=t.setTimeout(l,m)};return{live(f=L$){const p=t.now(),d=Math.max(o+f,p);if(d<=p){u(),l();return}c(d,p,f)},replay(f=$$){u(),i=t.now()+f,r=t.setTimeout(l,f)},flush(){u(),l()},cancel(){u()}}}function D$(){let e=!1,t=[];return{get paused(){return e},get size(){return t.length},accept(r){return e?(t.push(r),!1):!0},setPaused(r){if(e=r,r||t.length===0)return[];const i=t;return t=[],i}}}const F$="1",k_="agent-dag.schema",z$=["agent-dag.layout","agent-dag.viewport"];function QC(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function B$(e,t=F$){let r=null;try{r=e.getItem(k_)}catch{return[]}if(r===t)return[];const i=[];if(r!==null)for(const o of z$)try{e.getItem(o)!==null&&(e.removeItem(o),i.push(o))}catch{}try{e.setItem(k_,t)}catch{}return i}const ZC="agent-dag.theme";function U$(e){return e==="light"?"light":"dark"}function H$(){return U$(QC(ZC))}function W$({waiting:e,running:t}){return{title:e>0?`(${e}) ${Gt}`:Gt,icon:e>0?"waiting":t>0?"running":"idle"}}const Qd={waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Zd(e,t){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}"/>`:`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"/>`+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const V$=Object.freeze({waiting:`data:image/svg+xml,${encodeURIComponent(Zd(Qd.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Zd(Qd.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Zd(Qd.idle,"idle"))}`}),G$="No sessions are waiting for you.";function Y$(e){if(e.length===0)return"";const[t,...r]=e;if(r.length===0)return`${t.label} is waiting for your permission.`;const i=`${r.length} more session${r.length===1?"":"s"}`;return`${t.label} and ${i} are waiting for your permission.`}function K$(e,t){return t!==""?t:e===""?"":G$}function X$(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function Q$(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}function Z$(e){return!e.answer||e.answer.range!==e.want?{phase:"busy",stale:!1}:e.answer.ok?{phase:e.answer.days>0?"chart":"empty",stale:e.loading}:{phase:"error",stale:e.loading}}function JC(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const E_={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function py(e){const t=e.toLowerCase();return Object.hasOwn(E_,t)?E_[t]:t?t[0].toUpperCase()+t.slice(1):""}function J$(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function eq(e,t=[]){const r=t.length?J$(t.map(py)):JC(e);return r?`via ccusage · local ${r} logs`:"via ccusage · local agent logs"}function tq(e){return e.claude&&e.codex?"Claude Code hooks and Codex rollout files":e.claude?"Claude Code hooks":e.codex?"Codex rollout files":null}function nq(e){const t=JC(e);return t?`Distinct sessions — ${t}`:"Distinct sessions"}function rq(e){const t=tq(e);return t?`Total events received — ${t}`:"Total events received"}function sq(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:"."}]},r=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,r]}function iq(e,t){const r=t.on?"Sound on turn finish: on — click to remove the hook":"Sound on turn finish: off — click to add a Stop hook",i=e.codex?`
|
|
68
|
+
|
|
69
|
+
Claude Code turns only. The sound is a Stop hook Claude Code runs itself when a turn ends; the deck installs nothing for Codex and reads its rollout files after the fact, so Codex turns finish in silence.`:"",o=t.clash>0?`
|
|
70
|
+
|
|
71
|
+
${t.clash} sound hook${t.clash>1?"s":""} of your own in settings.json also run${t.clash>1?"":"s"} here.`:"",l=t.parked>0?`
|
|
72
|
+
|
|
73
|
+
${t.parked} of your own sound hook${t.parked>1?"s were":" was"} set aside so this switch actually controls the sound. Nothing was deleted — shift-click to put ${t.parked>1?"them":"it"} back.`:"";return r+i+o+l}function ej(e){const t=new Map;for(const r of e)for(const i of r.agents??[]){if(!i||typeof i.agent!="string"||i.agent==="")continue;const o=t.get(i.agent)??{id:i.agent,cost:0,tokens:0};o.cost+=Number.isFinite(i.totalCost)?i.totalCost:0,o.tokens+=Number.isFinite(i.totalTokens)?i.totalTokens:0,t.set(i.agent,o)}return[...t.values()].sort((r,i)=>i.cost-r.cost||r.id.localeCompare(i.id))}function oq(e){const t=ej([{agents:e}]);return t.length<2?null:t.map(r=>`${py(r.id)} ${qe(r.cost)}`).join(" · ")}function N_(e){switch(e.toLowerCase()){case"claude":return"#c4b5fd";case"codex":return"#fdba74";case"gemini":return"#a5b4fc";case"copilot":return"#86efac";default:return"#94a3b8"}}function aq(e,t){if(!(t>0)||!(e>0))return"0%";const r=e/t*100;return r<.1?"<0.1%":`${r.toFixed(1)}%`}function au(e){const t=e.toLowerCase();return t.includes("opus")?"#c4b5fd":t.includes("sonnet")?"#7dd3fc":t.includes("haiku")?"#86efac":t.includes("gpt-5")||t.includes("gpt5")?"#fcd34d":t.includes("gpt")?"#fca5a5":t.includes("gemini")?"#a5b4fc":t.includes("codex")?"#fdba74":"#94a3b8"}const lq=[7,14,30,90];function uq(e){const[t,r]=R.useState(null),[i,o]=R.useState(!1),l=R.useRef(X$()).current,u=(c=!1)=>{const f=l.begin(),p=e;o(!0);const m=`/api/ccusage?since=${Q$(p)}${c?"&refresh=1":""}`;fetch(m).then(y=>y.json()).then(y=>{f()&&r({range:p,resp:y})}).catch(()=>{f()&&r({range:p,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{f()&&o(!1)})};return R.useEffect(()=>(u(!1),()=>l.cancel()),[e]),{landed:t,loading:i,reload:()=>u(!0)}}function cq({onClose:e,providers:t}){var O;const[r,i]=R.useState(30),[o,l]=R.useState(null),{landed:u,loading:c,reload:f}=uq(r),p=R.useRef(null),d=wo(e,{focusRef:p}),m=Z$({loading:c,want:r,answer:u&&{range:u.range,ok:u.resp.ok===!0,days:((O=u.resp.days)==null?void 0:O.length)??0}}),y=m.phase==="chart"?u.resp.days??[]:[],w=R.useMemo(()=>y.reduce((P,D)=>Math.max(P,D.totalCost),0),[y]),{totalCost:E,totalTok:_,inOut:b,cacheRead:S,modelCosts:k}=R.useMemo(()=>{let P=0,D=0,L=0,U=0;const V=new Map;for(const z of y){P+=z.totalCost,D+=z.totalTokens,L+=z.inputTokens+z.outputTokens,U+=z.cacheReadTokens;for(const C of z.modelBreakdowns)V.set(C.modelName,(V.get(C.modelName)??0)+C.cost)}return{totalCost:P,totalTok:D,inOut:L,cacheRead:U,modelCosts:V}},[y]),N=R.useMemo(()=>Array.from(k.entries()).sort((P,D)=>D[1]-P[1]),[k]),j=R.useMemo(()=>ej(y),[y]),A=j.length>1,M=o?y.find(P=>P.period===o)??null:null;return g.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:g.jsxs("div",{ref:d,className:"uh-modal",onClick:P=>P.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[g.jsxs("header",{className:"uh-head",children:[g.jsxs("div",{className:"uh-titlewrap",children:[g.jsx("div",{className:"uh-title",children:"Usage history"}),g.jsx("div",{className:"uh-sub",children:eq(t,j.map(P=>P.id))})]}),g.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:lq.map(P=>g.jsxs("button",{type:"button","aria-pressed":r===P,className:`uh-range-btn${r===P?" on":""}`,onClick:()=>{i(P),l(null)},children:[P,"d"]},P))}),g.jsx("button",{className:"btn icon-btn uh-reload",onClick:f,disabled:c,title:"Re-run ccusage","aria-label":"Reload",children:c?"…":"↻"}),g.jsx("button",{ref:p,className:"uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),m.phase==="busy"?g.jsx("div",{className:"uh-status","aria-busy":"true",children:u?"running ccusage…":"running ccusage… (first run downloads the package)"}):m.phase==="error"?g.jsxs("div",{className:"uh-status uh-err",title:vo(u.resp)||void 0,children:[Z3(u.resp,"ccusage did not report usage"),g.jsx("div",{children:g.jsx("button",{className:"btn uh-retry",onClick:f,disabled:c,children:c?"trying…":"Try again"})})]}):m.phase==="empty"?g.jsx("div",{className:`uh-status${m.stale?" uh-stale":""}`,"aria-busy":m.stale||void 0,children:"no usage in this range"}):g.jsxs("div",{className:m.stale?"uh-stale":void 0,"aria-busy":m.stale||void 0,children:[g.jsxs("div",{className:"uh-totals",children:[g.jsx(lu,{label:"total cost",val:qe(E),accent:!0}),g.jsx(lu,{label:"tokens",val:Nt(_)}),g.jsx(lu,{label:"input+output",val:Nt(b)}),g.jsx(lu,{label:"cache reads",val:Nt(S)})]}),A&&g.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[g.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:j.map(P=>g.jsx("span",{className:"uh-agent-seg",style:{width:`${E>0?P.cost/E*100:0}%`,background:N_(P.id)}},P.id))}),g.jsx("div",{className:"uh-agent-keys",children:j.map(P=>g.jsxs("span",{className:"uh-agent-key",title:`${P.id} · ${Nt(P.tokens)} tokens`,children:[g.jsx("span",{className:"uh-legend-dot",style:{background:N_(P.id)}}),py(P.id),g.jsx("span",{className:"uh-agent-cost",children:qe(P.cost)}),g.jsx("span",{className:"uh-agent-share",children:aq(P.cost,E)})]},P.id))})]}),g.jsx("div",{className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map(P=>{const D=w>0?P.totalCost/w*100:0,L=P.period===o,U=`${P.period}, ${qe(P.totalCost)}`;return g.jsxs("button",{className:`uh-bar-col${L?" sel":""}`,onClick:()=>l(L?null:P.period),"aria-pressed":L,"aria-label":U,title:`${P.period} · ${qe(P.totalCost)}`,style:{flexBasis:`${100/y.length}%`},children:[g.jsx("div",{className:"uh-bar",style:{height:`${Math.max(D,P.totalCost>0?2:0)}%`},children:P.modelBreakdowns.slice().sort((V,z)=>z.cost-V.cost).map(V=>{const z=P.totalCost>0?V.cost/P.totalCost*100:0;return g.jsx("div",{className:"uh-bar-seg",style:{height:`${z}%`,background:au(V.modelName)}},V.modelName)})}),g.jsx("span",{className:"uh-bar-label",children:P.period.slice(5)})]},P.period)})}),g.jsx("div",{className:"uh-legend",children:N.map(([P,D])=>g.jsxs("span",{className:"uh-legend-item",title:P,children:[g.jsx("span",{className:"uh-legend-dot",style:{background:au(P)}}),Rs(P)," ",g.jsx("span",{className:"uh-legend-cost",children:qe(D)})]},P))}),M&&g.jsxs("div",{className:"uh-detail",children:[g.jsxs("div",{className:"uh-detail-head",children:[g.jsx("span",{className:"uh-detail-date",children:M.period}),g.jsx("span",{className:"uh-detail-cost",children:qe(M.totalCost)}),(()=>{var L,U;const D=oq(M.agents)??((U=(L=M.metadata)==null?void 0:L.agents)!=null&&U.length?M.metadata.agents.join(" · "):null);return D?g.jsx("span",{className:"uh-detail-agents",title:D,children:D}):null})()]}),g.jsxs("div",{className:"uh-detail-mini",children:[g.jsx(uu,{label:"input",val:Nt(M.inputTokens)}),g.jsx(uu,{label:"output",val:Nt(M.outputTokens)}),g.jsx(uu,{label:"cache write",val:Nt(M.cacheCreationTokens)}),g.jsx(uu,{label:"cache read",val:Nt(M.cacheReadTokens)})]}),g.jsx("div",{className:"uh-detail-models",children:M.modelBreakdowns.slice().sort((P,D)=>D.cost-P.cost).map(P=>{const D=M.totalCost>0?P.cost/M.totalCost*100:0;return g.jsxs("div",{className:"uh-model-row",title:P.modelName,children:[g.jsxs("span",{className:"uh-model-name",children:[g.jsx("span",{className:"uh-legend-dot",style:{background:au(P.modelName)}}),g.jsx("span",{className:"uh-model-label",children:Rs(P.modelName)})]}),g.jsx("span",{className:"uh-model-bar",children:g.jsx("span",{className:"uh-model-bar-fill",style:{width:`${D}%`,background:au(P.modelName)}})}),g.jsx("span",{className:"uh-model-cost",children:qe(P.cost)})]},P.modelName)})})]})]})]})})}function lu({label:e,val:t,accent:r}){return g.jsxs("div",{className:"uh-stat",children:[g.jsx("span",{className:`uh-stat-val${r?" accent":""}`,children:t}),g.jsx("span",{className:"uh-stat-label",children:e})]})}function uu({label:e,val:t}){return g.jsxs("div",{className:"uh-ministat",children:[g.jsx("span",{className:"uh-ministat-val",children:t}),g.jsx("span",{className:"uh-ministat-label",children:e})]})}function my(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 Jd,C_;function dq(){if(C_)return Jd;C_=1;function e(){this.__data__=[],this.size=0}return Jd=e,Jd}var ef,j_;function xo(){if(j_)return ef;j_=1;function e(t,r){return t===r||t!==t&&r!==r}return ef=e,ef}var tf,T_;function zu(){if(T_)return tf;T_=1;var e=xo();function t(r,i){for(var o=r.length;o--;)if(e(r[o][0],i))return o;return-1}return tf=t,tf}var nf,R_;function fq(){if(R_)return nf;R_=1;var e=zu(),t=Array.prototype,r=t.splice;function i(o){var l=this.__data__,u=e(l,o);if(u<0)return!1;var c=l.length-1;return u==c?l.pop():r.call(l,u,1),--this.size,!0}return nf=i,nf}var rf,A_;function hq(){if(A_)return rf;A_=1;var e=zu();function t(r){var i=this.__data__,o=e(i,r);return o<0?void 0:i[o][1]}return rf=t,rf}var sf,I_;function pq(){if(I_)return sf;I_=1;var e=zu();function t(r){return e(this.__data__,r)>-1}return sf=t,sf}var of,M_;function mq(){if(M_)return of;M_=1;var e=zu();function t(r,i){var o=this.__data__,l=e(o,r);return l<0?(++this.size,o.push([r,i])):o[l][1]=i,this}return of=t,of}var af,O_;function Bu(){if(O_)return af;O_=1;var e=dq(),t=fq(),r=hq(),i=pq(),o=mq();function l(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,af=l,af}var lf,P_;function gq(){if(P_)return lf;P_=1;var e=Bu();function t(){this.__data__=new e,this.size=0}return lf=t,lf}var uf,L_;function vq(){if(L_)return uf;L_=1;function e(t){var r=this.__data__,i=r.delete(t);return this.size=r.size,i}return uf=e,uf}var cf,$_;function yq(){if($_)return cf;$_=1;function e(t){return this.__data__.get(t)}return cf=e,cf}var df,q_;function wq(){if(q_)return df;q_=1;function e(t){return this.__data__.has(t)}return df=e,df}var ff,D_;function tj(){if(D_)return ff;D_=1;var e=typeof Vl=="object"&&Vl&&Vl.Object===Object&&Vl;return ff=e,ff}var hf,F_;function rr(){if(F_)return hf;F_=1;var e=tj(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return hf=r,hf}var pf,z_;function _o(){if(z_)return pf;z_=1;var e=rr(),t=e.Symbol;return pf=t,pf}var mf,B_;function xq(){if(B_)return mf;B_=1;var e=_o(),t=Object.prototype,r=t.hasOwnProperty,i=t.toString,o=e?e.toStringTag:void 0;function l(u){var c=r.call(u,o),f=u[o];try{u[o]=void 0;var p=!0}catch{}var d=i.call(u);return p&&(c?u[o]=f:delete u[o]),d}return mf=l,mf}var gf,U_;function _q(){if(U_)return gf;U_=1;var e=Object.prototype,t=e.toString;function r(i){return t.call(i)}return gf=r,gf}var vf,H_;function gi(){if(H_)return vf;H_=1;var e=_o(),t=xq(),r=_q(),i="[object Null]",o="[object Undefined]",l=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?o:i:l&&l in Object(c)?t(c):r(c)}return vf=u,vf}var yf,W_;function qn(){if(W_)return yf;W_=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return yf=e,yf}var wf,V_;function La(){if(V_)return wf;V_=1;var e=gi(),t=qn(),r="[object AsyncFunction]",i="[object Function]",o="[object GeneratorFunction]",l="[object Proxy]";function u(c){if(!t(c))return!1;var f=e(c);return f==i||f==o||f==r||f==l}return wf=u,wf}var xf,G_;function bq(){if(G_)return xf;G_=1;var e=rr(),t=e["__core-js_shared__"];return xf=t,xf}var _f,Y_;function Sq(){if(Y_)return _f;Y_=1;var e=bq(),t=(function(){var i=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function r(i){return!!t&&t in i}return _f=r,_f}var bf,K_;function nj(){if(K_)return bf;K_=1;var e=Function.prototype,t=e.toString;function r(i){if(i!=null){try{return t.call(i)}catch{}try{return i+""}catch{}}return""}return bf=r,bf}var Sf,X_;function kq(){if(X_)return Sf;X_=1;var e=La(),t=Sq(),r=qn(),i=nj(),o=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,f=u.toString,p=c.hasOwnProperty,d=RegExp("^"+f.call(p).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!r(y)||t(y))return!1;var w=e(y)?d:l;return w.test(i(y))}return Sf=m,Sf}var kf,Q_;function Eq(){if(Q_)return kf;Q_=1;function e(t,r){return t==null?void 0:t[r]}return kf=e,kf}var Ef,Z_;function vi(){if(Z_)return Ef;Z_=1;var e=kq(),t=Eq();function r(i,o){var l=t(i,o);return e(l)?l:void 0}return Ef=r,Ef}var Nf,J_;function gy(){if(J_)return Nf;J_=1;var e=vi(),t=rr(),r=e(t,"Map");return Nf=r,Nf}var Cf,e1;function Uu(){if(e1)return Cf;e1=1;var e=vi(),t=e(Object,"create");return Cf=t,Cf}var jf,t1;function Nq(){if(t1)return jf;t1=1;var e=Uu();function t(){this.__data__=e?e(null):{},this.size=0}return jf=t,jf}var Tf,n1;function Cq(){if(n1)return Tf;n1=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Tf=e,Tf}var Rf,r1;function jq(){if(r1)return Rf;r1=1;var e=Uu(),t="__lodash_hash_undefined__",r=Object.prototype,i=r.hasOwnProperty;function o(l){var u=this.__data__;if(e){var c=u[l];return c===t?void 0:c}return i.call(u,l)?u[l]:void 0}return Rf=o,Rf}var Af,s1;function Tq(){if(s1)return Af;s1=1;var e=Uu(),t=Object.prototype,r=t.hasOwnProperty;function i(o){var l=this.__data__;return e?l[o]!==void 0:r.call(l,o)}return Af=i,Af}var If,i1;function Rq(){if(i1)return If;i1=1;var e=Uu(),t="__lodash_hash_undefined__";function r(i,o){var l=this.__data__;return this.size+=this.has(i)?0:1,l[i]=e&&o===void 0?t:o,this}return If=r,If}var Mf,o1;function Aq(){if(o1)return Mf;o1=1;var e=Nq(),t=Cq(),r=jq(),i=Tq(),o=Rq();function l(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Mf=l,Mf}var Of,a1;function Iq(){if(a1)return Of;a1=1;var e=Aq(),t=Bu(),r=gy();function i(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Of=i,Of}var Pf,l1;function Mq(){if(l1)return Pf;l1=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Pf=e,Pf}var Lf,u1;function Hu(){if(u1)return Lf;u1=1;var e=Mq();function t(r,i){var o=r.__data__;return e(i)?o[typeof i=="string"?"string":"hash"]:o.map}return Lf=t,Lf}var $f,c1;function Oq(){if(c1)return $f;c1=1;var e=Hu();function t(r){var i=e(this,r).delete(r);return this.size-=i?1:0,i}return $f=t,$f}var qf,d1;function Pq(){if(d1)return qf;d1=1;var e=Hu();function t(r){return e(this,r).get(r)}return qf=t,qf}var Df,f1;function Lq(){if(f1)return Df;f1=1;var e=Hu();function t(r){return e(this,r).has(r)}return Df=t,Df}var Ff,h1;function $q(){if(h1)return Ff;h1=1;var e=Hu();function t(r,i){var o=e(this,r),l=o.size;return o.set(r,i),this.size+=o.size==l?0:1,this}return Ff=t,Ff}var zf,p1;function vy(){if(p1)return zf;p1=1;var e=Iq(),t=Oq(),r=Pq(),i=Lq(),o=$q();function l(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,zf=l,zf}var Bf,m1;function qq(){if(m1)return Bf;m1=1;var e=Bu(),t=gy(),r=vy(),i=200;function o(l,u){var c=this.__data__;if(c instanceof e){var f=c.__data__;if(!t||f.length<i-1)return f.push([l,u]),this.size=++c.size,this;c=this.__data__=new r(f)}return c.set(l,u),this.size=c.size,this}return Bf=o,Bf}var Uf,g1;function Wu(){if(g1)return Uf;g1=1;var e=Bu(),t=gq(),r=vq(),i=yq(),o=wq(),l=qq();function u(c){var f=this.__data__=new e(c);this.size=f.size}return u.prototype.clear=t,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=l,Uf=u,Uf}var Hf,v1;function yy(){if(v1)return Hf;v1=1;function e(t,r){for(var i=-1,o=t==null?0:t.length;++i<o&&r(t[i],i,t)!==!1;);return t}return Hf=e,Hf}var Wf,y1;function rj(){if(y1)return Wf;y1=1;var e=vi(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Wf=t,Wf}var Vf,w1;function Vu(){if(w1)return Vf;w1=1;var e=rj();function t(r,i,o){i=="__proto__"&&e?e(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[i]=o}return Vf=t,Vf}var Gf,x1;function Gu(){if(x1)return Gf;x1=1;var e=Vu(),t=xo(),r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c){var f=l[u];(!(i.call(l,u)&&t(f,c))||c===void 0&&!(u in l))&&e(l,u,c)}return Gf=o,Gf}var Yf,_1;function $a(){if(_1)return Yf;_1=1;var e=Gu(),t=Vu();function r(i,o,l,u){var c=!l;l||(l={});for(var f=-1,p=o.length;++f<p;){var d=o[f],m=u?u(l[d],i[d],d,l,i):void 0;m===void 0&&(m=i[d]),c?t(l,d,m):e(l,d,m)}return l}return Yf=r,Yf}var Kf,b1;function Dq(){if(b1)return Kf;b1=1;function e(t,r){for(var i=-1,o=Array(t);++i<t;)o[i]=r(i);return o}return Kf=e,Kf}var Xf,S1;function mr(){if(S1)return Xf;S1=1;function e(t){return t!=null&&typeof t=="object"}return Xf=e,Xf}var Qf,k1;function Fq(){if(k1)return Qf;k1=1;var e=gi(),t=mr(),r="[object Arguments]";function i(o){return t(o)&&e(o)==r}return Qf=i,Qf}var Zf,E1;function qa(){if(E1)return Zf;E1=1;var e=Fq(),t=mr(),r=Object.prototype,i=r.hasOwnProperty,o=r.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(u){return t(u)&&i.call(u,"callee")&&!o.call(u,"callee")};return Zf=l,Zf}var Jf,N1;function _t(){if(N1)return Jf;N1=1;var e=Array.isArray;return Jf=e,Jf}var ma={exports:{}},eh,C1;function zq(){if(C1)return eh;C1=1;function e(){return!1}return eh=e,eh}ma.exports;var j1;function bo(){return j1||(j1=1,(function(e,t){var r=rr(),i=zq(),o=t&&!t.nodeType&&t,l=o&&!0&&e&&!e.nodeType&&e,u=l&&l.exports===o,c=u?r.Buffer:void 0,f=c?c.isBuffer:void 0,p=f||i;e.exports=p})(ma,ma.exports)),ma.exports}var th,T1;function Yu(){if(T1)return th;T1=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(i,o){var l=typeof i;return o=o??e,!!o&&(l=="number"||l!="symbol"&&t.test(i))&&i>-1&&i%1==0&&i<o}return th=r,th}var nh,R1;function wy(){if(R1)return nh;R1=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return nh=t,nh}var rh,A1;function Bq(){if(A1)return rh;A1=1;var e=gi(),t=wy(),r=mr(),i="[object Arguments]",o="[object Array]",l="[object Boolean]",u="[object Date]",c="[object Error]",f="[object Function]",p="[object Map]",d="[object Number]",m="[object Object]",y="[object RegExp]",w="[object Set]",E="[object String]",_="[object WeakMap]",b="[object ArrayBuffer]",S="[object DataView]",k="[object Float32Array]",N="[object Float64Array]",j="[object Int8Array]",A="[object Int16Array]",M="[object Int32Array]",O="[object Uint8Array]",P="[object Uint8ClampedArray]",D="[object Uint16Array]",L="[object Uint32Array]",U={};U[k]=U[N]=U[j]=U[A]=U[M]=U[O]=U[P]=U[D]=U[L]=!0,U[i]=U[o]=U[b]=U[l]=U[S]=U[u]=U[c]=U[f]=U[p]=U[d]=U[m]=U[y]=U[w]=U[E]=U[_]=!1;function V(z){return r(z)&&t(z.length)&&!!U[e(z)]}return rh=V,rh}var sh,I1;function Ku(){if(I1)return sh;I1=1;function e(t){return function(r){return t(r)}}return sh=e,sh}var ga={exports:{}};ga.exports;var M1;function xy(){return M1||(M1=1,(function(e,t){var r=tj(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l&&r.process,c=(function(){try{var f=o&&o.require&&o.require("util").types;return f||u&&u.binding&&u.binding("util")}catch{}})();e.exports=c})(ga,ga.exports)),ga.exports}var ih,O1;function Da(){if(O1)return ih;O1=1;var e=Bq(),t=Ku(),r=xy(),i=r&&r.isTypedArray,o=i?t(i):e;return ih=o,ih}var oh,P1;function sj(){if(P1)return oh;P1=1;var e=Dq(),t=qa(),r=_t(),i=bo(),o=Yu(),l=Da(),u=Object.prototype,c=u.hasOwnProperty;function f(p,d){var m=r(p),y=!m&&t(p),w=!m&&!y&&i(p),E=!m&&!y&&!w&&l(p),_=m||y||w||E,b=_?e(p.length,String):[],S=b.length;for(var k in p)(d||c.call(p,k))&&!(_&&(k=="length"||w&&(k=="offset"||k=="parent")||E&&(k=="buffer"||k=="byteLength"||k=="byteOffset")||o(k,S)))&&b.push(k);return b}return oh=f,oh}var ah,L1;function Xu(){if(L1)return ah;L1=1;var e=Object.prototype;function t(r){var i=r&&r.constructor,o=typeof i=="function"&&i.prototype||e;return r===o}return ah=t,ah}var lh,$1;function ij(){if($1)return lh;$1=1;function e(t,r){return function(i){return t(r(i))}}return lh=e,lh}var uh,q1;function Uq(){if(q1)return uh;q1=1;var e=ij(),t=e(Object.keys,Object);return uh=t,uh}var ch,D1;function _y(){if(D1)return ch;D1=1;var e=Xu(),t=Uq(),r=Object.prototype,i=r.hasOwnProperty;function o(l){if(!e(l))return t(l);var u=[];for(var c in Object(l))i.call(l,c)&&c!="constructor"&&u.push(c);return u}return ch=o,ch}var dh,F1;function Br(){if(F1)return dh;F1=1;var e=La(),t=wy();function r(i){return i!=null&&t(i.length)&&!e(i)}return dh=r,dh}var fh,z1;function As(){if(z1)return fh;z1=1;var e=sj(),t=_y(),r=Br();function i(o){return r(o)?e(o):t(o)}return fh=i,fh}var hh,B1;function Hq(){if(B1)return hh;B1=1;var e=$a(),t=As();function r(i,o){return i&&e(o,t(o),i)}return hh=r,hh}var ph,U1;function Wq(){if(U1)return ph;U1=1;function e(t){var r=[];if(t!=null)for(var i in Object(t))r.push(i);return r}return ph=e,ph}var mh,H1;function Vq(){if(H1)return mh;H1=1;var e=qn(),t=Xu(),r=Wq(),i=Object.prototype,o=i.hasOwnProperty;function l(u){if(!e(u))return r(u);var c=t(u),f=[];for(var p in u)p=="constructor"&&(c||!o.call(u,p))||f.push(p);return f}return mh=l,mh}var gh,W1;function yi(){if(W1)return gh;W1=1;var e=sj(),t=Vq(),r=Br();function i(o){return r(o)?e(o,!0):t(o)}return gh=i,gh}var vh,V1;function Gq(){if(V1)return vh;V1=1;var e=$a(),t=yi();function r(i,o){return i&&e(o,t(o),i)}return vh=r,vh}var va={exports:{}};va.exports;var G1;function oj(){return G1||(G1=1,(function(e,t){var r=rr(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l?r.Buffer:void 0,c=u?u.allocUnsafe:void 0;function f(p,d){if(d)return p.slice();var m=p.length,y=c?c(m):new p.constructor(m);return p.copy(y),y}e.exports=f})(va,va.exports)),va.exports}var yh,Y1;function aj(){if(Y1)return yh;Y1=1;function e(t,r){var i=-1,o=t.length;for(r||(r=Array(o));++i<o;)r[i]=t[i];return r}return yh=e,yh}var wh,K1;function lj(){if(K1)return wh;K1=1;function e(t,r){for(var i=-1,o=t==null?0:t.length,l=0,u=[];++i<o;){var c=t[i];r(c,i,t)&&(u[l++]=c)}return u}return wh=e,wh}var xh,X1;function uj(){if(X1)return xh;X1=1;function e(){return[]}return xh=e,xh}var _h,Q1;function by(){if(Q1)return _h;Q1=1;var e=lj(),t=uj(),r=Object.prototype,i=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,l=o?function(u){return u==null?[]:(u=Object(u),e(o(u),function(c){return i.call(u,c)}))}:t;return _h=l,_h}var bh,Z1;function Yq(){if(Z1)return bh;Z1=1;var e=$a(),t=by();function r(i,o){return e(i,t(i),o)}return bh=r,bh}var Sh,J1;function Sy(){if(J1)return Sh;J1=1;function e(t,r){for(var i=-1,o=r.length,l=t.length;++i<o;)t[l+i]=r[i];return t}return Sh=e,Sh}var kh,eb;function Qu(){if(eb)return kh;eb=1;var e=ij(),t=e(Object.getPrototypeOf,Object);return kh=t,kh}var Eh,tb;function cj(){if(tb)return Eh;tb=1;var e=Sy(),t=Qu(),r=by(),i=uj(),o=Object.getOwnPropertySymbols,l=o?function(u){for(var c=[];u;)e(c,r(u)),u=t(u);return c}:i;return Eh=l,Eh}var Nh,nb;function Kq(){if(nb)return Nh;nb=1;var e=$a(),t=cj();function r(i,o){return e(i,t(i),o)}return Nh=r,Nh}var Ch,rb;function dj(){if(rb)return Ch;rb=1;var e=Sy(),t=_t();function r(i,o,l){var u=o(i);return t(i)?u:e(u,l(i))}return Ch=r,Ch}var jh,sb;function fj(){if(sb)return jh;sb=1;var e=dj(),t=by(),r=As();function i(o){return e(o,r,t)}return jh=i,jh}var Th,ib;function Xq(){if(ib)return Th;ib=1;var e=dj(),t=cj(),r=yi();function i(o){return e(o,r,t)}return Th=i,Th}var Rh,ob;function Qq(){if(ob)return Rh;ob=1;var e=vi(),t=rr(),r=e(t,"DataView");return Rh=r,Rh}var Ah,ab;function Zq(){if(ab)return Ah;ab=1;var e=vi(),t=rr(),r=e(t,"Promise");return Ah=r,Ah}var Ih,lb;function hj(){if(lb)return Ih;lb=1;var e=vi(),t=rr(),r=e(t,"Set");return Ih=r,Ih}var Mh,ub;function Jq(){if(ub)return Mh;ub=1;var e=vi(),t=rr(),r=e(t,"WeakMap");return Mh=r,Mh}var Oh,cb;function So(){if(cb)return Oh;cb=1;var e=Qq(),t=gy(),r=Zq(),i=hj(),o=Jq(),l=gi(),u=nj(),c="[object Map]",f="[object Object]",p="[object Promise]",d="[object Set]",m="[object WeakMap]",y="[object DataView]",w=u(e),E=u(t),_=u(r),b=u(i),S=u(o),k=l;return(e&&k(new e(new ArrayBuffer(1)))!=y||t&&k(new t)!=c||r&&k(r.resolve())!=p||i&&k(new i)!=d||o&&k(new o)!=m)&&(k=function(N){var j=l(N),A=j==f?N.constructor:void 0,M=A?u(A):"";if(M)switch(M){case w:return y;case E:return c;case _:return p;case b:return d;case S:return m}return j}),Oh=k,Oh}var Ph,db;function eD(){if(db)return Ph;db=1;var e=Object.prototype,t=e.hasOwnProperty;function r(i){var o=i.length,l=new i.constructor(o);return o&&typeof i[0]=="string"&&t.call(i,"index")&&(l.index=i.index,l.input=i.input),l}return Ph=r,Ph}var Lh,fb;function pj(){if(fb)return Lh;fb=1;var e=rr(),t=e.Uint8Array;return Lh=t,Lh}var $h,hb;function ky(){if(hb)return $h;hb=1;var e=pj();function t(r){var i=new r.constructor(r.byteLength);return new e(i).set(new e(r)),i}return $h=t,$h}var qh,pb;function tD(){if(pb)return qh;pb=1;var e=ky();function t(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return qh=t,qh}var Dh,mb;function nD(){if(mb)return Dh;mb=1;var e=/\w*$/;function t(r){var i=new r.constructor(r.source,e.exec(r));return i.lastIndex=r.lastIndex,i}return Dh=t,Dh}var Fh,gb;function rD(){if(gb)return Fh;gb=1;var e=_o(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function i(o){return r?Object(r.call(o)):{}}return Fh=i,Fh}var zh,vb;function mj(){if(vb)return zh;vb=1;var e=ky();function t(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return zh=t,zh}var Bh,yb;function sD(){if(yb)return Bh;yb=1;var e=ky(),t=tD(),r=nD(),i=rD(),o=mj(),l="[object Boolean]",u="[object Date]",c="[object Map]",f="[object Number]",p="[object RegExp]",d="[object Set]",m="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",E="[object DataView]",_="[object Float32Array]",b="[object Float64Array]",S="[object Int8Array]",k="[object Int16Array]",N="[object Int32Array]",j="[object Uint8Array]",A="[object Uint8ClampedArray]",M="[object Uint16Array]",O="[object Uint32Array]";function P(D,L,U){var V=D.constructor;switch(L){case w:return e(D);case l:case u:return new V(+D);case E:return t(D,U);case _:case b:case S:case k:case N:case j:case A:case M:case O:return o(D,U);case c:return new V;case f:case m:return new V(D);case p:return r(D);case d:return new V;case y:return i(D)}}return Bh=P,Bh}var Uh,wb;function gj(){if(wb)return Uh;wb=1;var e=qn(),t=Object.create,r=(function(){function i(){}return function(o){if(!e(o))return{};if(t)return t(o);i.prototype=o;var l=new i;return i.prototype=void 0,l}})();return Uh=r,Uh}var Hh,xb;function vj(){if(xb)return Hh;xb=1;var e=gj(),t=Qu(),r=Xu();function i(o){return typeof o.constructor=="function"&&!r(o)?e(t(o)):{}}return Hh=i,Hh}var Wh,_b;function iD(){if(_b)return Wh;_b=1;var e=So(),t=mr(),r="[object Map]";function i(o){return t(o)&&e(o)==r}return Wh=i,Wh}var Vh,bb;function oD(){if(bb)return Vh;bb=1;var e=iD(),t=Ku(),r=xy(),i=r&&r.isMap,o=i?t(i):e;return Vh=o,Vh}var Gh,Sb;function aD(){if(Sb)return Gh;Sb=1;var e=So(),t=mr(),r="[object Set]";function i(o){return t(o)&&e(o)==r}return Gh=i,Gh}var Yh,kb;function lD(){if(kb)return Yh;kb=1;var e=aD(),t=Ku(),r=xy(),i=r&&r.isSet,o=i?t(i):e;return Yh=o,Yh}var Kh,Eb;function yj(){if(Eb)return Kh;Eb=1;var e=Wu(),t=yy(),r=Gu(),i=Hq(),o=Gq(),l=oj(),u=aj(),c=Yq(),f=Kq(),p=fj(),d=Xq(),m=So(),y=eD(),w=sD(),E=vj(),_=_t(),b=bo(),S=oD(),k=qn(),N=lD(),j=As(),A=yi(),M=1,O=2,P=4,D="[object Arguments]",L="[object Array]",U="[object Boolean]",V="[object Date]",z="[object Error]",C="[object Function]",F="[object GeneratorFunction]",$="[object Map]",re="[object Number]",J="[object Object]",W="[object RegExp]",Z="[object Set]",I="[object String]",G="[object Symbol]",K="[object WeakMap]",q="[object ArrayBuffer]",Q="[object DataView]",ne="[object Float32Array]",ae="[object Float64Array]",fe="[object Int8Array]",te="[object Int16Array]",ce="[object Int32Array]",Ce="[object Uint8Array]",ve="[object Uint8ClampedArray]",Re="[object Uint16Array]",ye="[object Uint32Array]",Ee={};Ee[D]=Ee[L]=Ee[q]=Ee[Q]=Ee[U]=Ee[V]=Ee[ne]=Ee[ae]=Ee[fe]=Ee[te]=Ee[ce]=Ee[$]=Ee[re]=Ee[J]=Ee[W]=Ee[Z]=Ee[I]=Ee[G]=Ee[Ce]=Ee[ve]=Ee[Re]=Ee[ye]=!0,Ee[z]=Ee[C]=Ee[K]=!1;function Ye(we,_e,Be,it,ft,Ze){var De,Je=_e&M,Xe=_e&O,Ot=_e&P;if(Be&&(De=ft?Be(we,it,ft,Ze):Be(we)),De!==void 0)return De;if(!k(we))return we;var lt=_(we);if(lt){if(De=y(we),!Je)return u(we,De)}else{var Qe=m(we),Pt=Qe==C||Qe==F;if(b(we))return l(we,Je);if(Qe==J||Qe==D||Pt&&!ft){if(De=Xe||Pt?{}:E(we),!Je)return Xe?f(we,o(De,we)):c(we,i(De,we))}else{if(!Ee[Qe])return ft?we:{};De=w(we,Qe,Je)}}Ze||(Ze=new e);var zt=Ze.get(we);if(zt)return zt;Ze.set(we,De),N(we)?we.forEach(function(ht){De.add(Ye(ht,_e,Be,ht,we,Ze))}):S(we)&&we.forEach(function(ht,vt){De.set(vt,Ye(ht,_e,Be,vt,we,Ze))});var et=Ot?Xe?d:p:Xe?A:j,bt=lt?void 0:et(we);return t(bt||we,function(ht,vt){bt&&(vt=ht,ht=we[vt]),r(De,vt,Ye(ht,_e,Be,vt,we,Ze))}),De}return Kh=Ye,Kh}var Xh,Nb;function uD(){if(Nb)return Xh;Nb=1;var e=yj(),t=4;function r(i){return e(i,t)}return Xh=r,Xh}var Qh,Cb;function Ey(){if(Cb)return Qh;Cb=1;function e(t){return function(){return t}}return Qh=e,Qh}var Zh,jb;function cD(){if(jb)return Zh;jb=1;function e(t){return function(r,i,o){for(var l=-1,u=Object(r),c=o(r),f=c.length;f--;){var p=c[t?f:++l];if(i(u[p],p,u)===!1)break}return r}}return Zh=e,Zh}var Jh,Tb;function Ny(){if(Tb)return Jh;Tb=1;var e=cD(),t=e();return Jh=t,Jh}var ep,Rb;function Cy(){if(Rb)return ep;Rb=1;var e=Ny(),t=As();function r(i,o){return i&&e(i,o,t)}return ep=r,ep}var tp,Ab;function dD(){if(Ab)return tp;Ab=1;var e=Br();function t(r,i){return function(o,l){if(o==null)return o;if(!e(o))return r(o,l);for(var u=o.length,c=i?u:-1,f=Object(o);(i?c--:++c<u)&&l(f[c],c,f)!==!1;);return o}}return tp=t,tp}var np,Ib;function Zu(){if(Ib)return np;Ib=1;var e=Cy(),t=dD(),r=t(e);return np=r,np}var rp,Mb;function wi(){if(Mb)return rp;Mb=1;function e(t){return t}return rp=e,rp}var sp,Ob;function wj(){if(Ob)return sp;Ob=1;var e=wi();function t(r){return typeof r=="function"?r:e}return sp=t,sp}var ip,Pb;function xj(){if(Pb)return ip;Pb=1;var e=yy(),t=Zu(),r=wj(),i=_t();function o(l,u){var c=i(l)?e:t;return c(l,r(u))}return ip=o,ip}var op,Lb;function _j(){return Lb||(Lb=1,op=xj()),op}var ap,$b;function fD(){if($b)return ap;$b=1;var e=Zu();function t(r,i){var o=[];return e(r,function(l,u,c){i(l,u,c)&&o.push(l)}),o}return ap=t,ap}var lp,qb;function hD(){if(qb)return lp;qb=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return lp=t,lp}var up,Db;function pD(){if(Db)return up;Db=1;function e(t){return this.__data__.has(t)}return up=e,up}var cp,Fb;function bj(){if(Fb)return cp;Fb=1;var e=vy(),t=hD(),r=pD();function i(o){var l=-1,u=o==null?0:o.length;for(this.__data__=new e;++l<u;)this.add(o[l])}return i.prototype.add=i.prototype.push=t,i.prototype.has=r,cp=i,cp}var dp,zb;function mD(){if(zb)return dp;zb=1;function e(t,r){for(var i=-1,o=t==null?0:t.length;++i<o;)if(r(t[i],i,t))return!0;return!1}return dp=e,dp}var fp,Bb;function Sj(){if(Bb)return fp;Bb=1;function e(t,r){return t.has(r)}return fp=e,fp}var hp,Ub;function kj(){if(Ub)return hp;Ub=1;var e=bj(),t=mD(),r=Sj(),i=1,o=2;function l(u,c,f,p,d,m){var y=f&i,w=u.length,E=c.length;if(w!=E&&!(y&&E>w))return!1;var _=m.get(u),b=m.get(c);if(_&&b)return _==c&&b==u;var S=-1,k=!0,N=f&o?new e:void 0;for(m.set(u,c),m.set(c,u);++S<w;){var j=u[S],A=c[S];if(p)var M=y?p(A,j,S,c,u,m):p(j,A,S,u,c,m);if(M!==void 0){if(M)continue;k=!1;break}if(N){if(!t(c,function(O,P){if(!r(N,P)&&(j===O||d(j,O,f,p,m)))return N.push(P)})){k=!1;break}}else if(!(j===A||d(j,A,f,p,m))){k=!1;break}}return m.delete(u),m.delete(c),k}return hp=l,hp}var pp,Hb;function gD(){if(Hb)return pp;Hb=1;function e(t){var r=-1,i=Array(t.size);return t.forEach(function(o,l){i[++r]=[l,o]}),i}return pp=e,pp}var mp,Wb;function jy(){if(Wb)return mp;Wb=1;function e(t){var r=-1,i=Array(t.size);return t.forEach(function(o){i[++r]=o}),i}return mp=e,mp}var gp,Vb;function vD(){if(Vb)return gp;Vb=1;var e=_o(),t=pj(),r=xo(),i=kj(),o=gD(),l=jy(),u=1,c=2,f="[object Boolean]",p="[object Date]",d="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",E="[object Set]",_="[object String]",b="[object Symbol]",S="[object ArrayBuffer]",k="[object DataView]",N=e?e.prototype:void 0,j=N?N.valueOf:void 0;function A(M,O,P,D,L,U,V){switch(P){case k:if(M.byteLength!=O.byteLength||M.byteOffset!=O.byteOffset)return!1;M=M.buffer,O=O.buffer;case S:return!(M.byteLength!=O.byteLength||!U(new t(M),new t(O)));case f:case p:case y:return r(+M,+O);case d:return M.name==O.name&&M.message==O.message;case w:case _:return M==O+"";case m:var z=o;case E:var C=D&u;if(z||(z=l),M.size!=O.size&&!C)return!1;var F=V.get(M);if(F)return F==O;D|=c,V.set(M,O);var $=i(z(M),z(O),D,L,U,V);return V.delete(M),$;case b:if(j)return j.call(M)==j.call(O)}return!1}return gp=A,gp}var vp,Gb;function yD(){if(Gb)return vp;Gb=1;var e=fj(),t=1,r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c,f,p,d){var m=c&t,y=e(l),w=y.length,E=e(u),_=E.length;if(w!=_&&!m)return!1;for(var b=w;b--;){var S=y[b];if(!(m?S in u:i.call(u,S)))return!1}var k=d.get(l),N=d.get(u);if(k&&N)return k==u&&N==l;var j=!0;d.set(l,u),d.set(u,l);for(var A=m;++b<w;){S=y[b];var M=l[S],O=u[S];if(f)var P=m?f(O,M,S,u,l,d):f(M,O,S,l,u,d);if(!(P===void 0?M===O||p(M,O,c,f,d):P)){j=!1;break}A||(A=S=="constructor")}if(j&&!A){var D=l.constructor,L=u.constructor;D!=L&&"constructor"in l&&"constructor"in u&&!(typeof D=="function"&&D instanceof D&&typeof L=="function"&&L instanceof L)&&(j=!1)}return d.delete(l),d.delete(u),j}return vp=o,vp}var yp,Yb;function wD(){if(Yb)return yp;Yb=1;var e=Wu(),t=kj(),r=vD(),i=yD(),o=So(),l=_t(),u=bo(),c=Da(),f=1,p="[object Arguments]",d="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function E(_,b,S,k,N,j){var A=l(_),M=l(b),O=A?d:o(_),P=M?d:o(b);O=O==p?m:O,P=P==p?m:P;var D=O==m,L=P==m,U=O==P;if(U&&u(_)){if(!u(b))return!1;A=!0,D=!1}if(U&&!D)return j||(j=new e),A||c(_)?t(_,b,S,k,N,j):r(_,b,O,S,k,N,j);if(!(S&f)){var V=D&&w.call(_,"__wrapped__"),z=L&&w.call(b,"__wrapped__");if(V||z){var C=V?_.value():_,F=z?b.value():b;return j||(j=new e),N(C,F,S,k,j)}}return U?(j||(j=new e),i(_,b,S,k,N,j)):!1}return yp=E,yp}var wp,Kb;function Ej(){if(Kb)return wp;Kb=1;var e=wD(),t=mr();function r(i,o,l,u,c){return i===o?!0:i==null||o==null||!t(i)&&!t(o)?i!==i&&o!==o:e(i,o,l,u,r,c)}return wp=r,wp}var xp,Xb;function xD(){if(Xb)return xp;Xb=1;var e=Wu(),t=Ej(),r=1,i=2;function o(l,u,c,f){var p=c.length,d=p,m=!f;if(l==null)return!d;for(l=Object(l);p--;){var y=c[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<d;){y=c[p];var w=y[0],E=l[w],_=y[1];if(m&&y[2]){if(E===void 0&&!(w in l))return!1}else{var b=new e;if(f)var S=f(E,_,w,l,u,b);if(!(S===void 0?t(_,E,r|i,f,b):S))return!1}}return!0}return xp=o,xp}var _p,Qb;function Nj(){if(Qb)return _p;Qb=1;var e=qn();function t(r){return r===r&&!e(r)}return _p=t,_p}var bp,Zb;function _D(){if(Zb)return bp;Zb=1;var e=Nj(),t=As();function r(i){for(var o=t(i),l=o.length;l--;){var u=o[l],c=i[u];o[l]=[u,c,e(c)]}return o}return bp=r,bp}var Sp,Jb;function Cj(){if(Jb)return Sp;Jb=1;function e(t,r){return function(i){return i==null?!1:i[t]===r&&(r!==void 0||t in Object(i))}}return Sp=e,Sp}var kp,eS;function bD(){if(eS)return kp;eS=1;var e=xD(),t=_D(),r=Cj();function i(o){var l=t(o);return l.length==1&&l[0][2]?r(l[0][0],l[0][1]):function(u){return u===o||e(u,o,l)}}return kp=i,kp}var Ep,tS;function ko(){if(tS)return Ep;tS=1;var e=gi(),t=mr(),r="[object Symbol]";function i(o){return typeof o=="symbol"||t(o)&&e(o)==r}return Ep=i,Ep}var Np,nS;function Ty(){if(nS)return Np;nS=1;var e=_t(),t=ko(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;function o(l,u){if(e(l))return!1;var c=typeof l;return c=="number"||c=="symbol"||c=="boolean"||l==null||t(l)?!0:i.test(l)||!r.test(l)||u!=null&&l in Object(u)}return Np=o,Np}var Cp,rS;function SD(){if(rS)return Cp;rS=1;var e=vy(),t="Expected a function";function r(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new TypeError(t);var l=function(){var u=arguments,c=o?o.apply(this,u):u[0],f=l.cache;if(f.has(c))return f.get(c);var p=i.apply(this,u);return l.cache=f.set(c,p)||f,p};return l.cache=new(r.Cache||e),l}return r.Cache=e,Cp=r,Cp}var jp,sS;function kD(){if(sS)return jp;sS=1;var e=SD(),t=500;function r(i){var o=e(i,function(u){return l.size===t&&l.clear(),u}),l=o.cache;return o}return jp=r,jp}var Tp,iS;function ED(){if(iS)return Tp;iS=1;var e=kD(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,i=e(function(o){var l=[];return o.charCodeAt(0)===46&&l.push(""),o.replace(t,function(u,c,f,p){l.push(f?p.replace(r,"$1"):c||u)}),l});return Tp=i,Tp}var Rp,oS;function Ju(){if(oS)return Rp;oS=1;function e(t,r){for(var i=-1,o=t==null?0:t.length,l=Array(o);++i<o;)l[i]=r(t[i],i,t);return l}return Rp=e,Rp}var Ap,aS;function ND(){if(aS)return Ap;aS=1;var e=_o(),t=Ju(),r=_t(),i=ko(),o=e?e.prototype:void 0,l=o?o.toString:void 0;function u(c){if(typeof c=="string")return c;if(r(c))return t(c,u)+"";if(i(c))return l?l.call(c):"";var f=c+"";return f=="0"&&1/c==-1/0?"-0":f}return Ap=u,Ap}var Ip,lS;function jj(){if(lS)return Ip;lS=1;var e=ND();function t(r){return r==null?"":e(r)}return Ip=t,Ip}var Mp,uS;function ec(){if(uS)return Mp;uS=1;var e=_t(),t=Ty(),r=ED(),i=jj();function o(l,u){return e(l)?l:t(l,u)?[l]:r(i(l))}return Mp=o,Mp}var Op,cS;function Fa(){if(cS)return Op;cS=1;var e=ko();function t(r){if(typeof r=="string"||e(r))return r;var i=r+"";return i=="0"&&1/r==-1/0?"-0":i}return Op=t,Op}var Pp,dS;function tc(){if(dS)return Pp;dS=1;var e=ec(),t=Fa();function r(i,o){o=e(o,i);for(var l=0,u=o.length;i!=null&&l<u;)i=i[t(o[l++])];return l&&l==u?i:void 0}return Pp=r,Pp}var Lp,fS;function CD(){if(fS)return Lp;fS=1;var e=tc();function t(r,i,o){var l=r==null?void 0:e(r,i);return l===void 0?o:l}return Lp=t,Lp}var $p,hS;function jD(){if(hS)return $p;hS=1;function e(t,r){return t!=null&&r in Object(t)}return $p=e,$p}var qp,pS;function Tj(){if(pS)return qp;pS=1;var e=ec(),t=qa(),r=_t(),i=Yu(),o=wy(),l=Fa();function u(c,f,p){f=e(f,c);for(var d=-1,m=f.length,y=!1;++d<m;){var w=l(f[d]);if(!(y=c!=null&&p(c,w)))break;c=c[w]}return y||++d!=m?y:(m=c==null?0:c.length,!!m&&o(m)&&i(w,m)&&(r(c)||t(c)))}return qp=u,qp}var Dp,mS;function Rj(){if(mS)return Dp;mS=1;var e=jD(),t=Tj();function r(i,o){return i!=null&&t(i,o,e)}return Dp=r,Dp}var Fp,gS;function TD(){if(gS)return Fp;gS=1;var e=Ej(),t=CD(),r=Rj(),i=Ty(),o=Nj(),l=Cj(),u=Fa(),c=1,f=2;function p(d,m){return i(d)&&o(m)?l(u(d),m):function(y){var w=t(y,d);return w===void 0&&w===m?r(y,d):e(m,w,c|f)}}return Fp=p,Fp}var zp,vS;function Aj(){if(vS)return zp;vS=1;function e(t){return function(r){return r==null?void 0:r[t]}}return zp=e,zp}var Bp,yS;function RD(){if(yS)return Bp;yS=1;var e=tc();function t(r){return function(i){return e(i,r)}}return Bp=t,Bp}var Up,wS;function AD(){if(wS)return Up;wS=1;var e=Aj(),t=RD(),r=Ty(),i=Fa();function o(l){return r(l)?e(i(l)):t(l)}return Up=o,Up}var Hp,xS;function Ur(){if(xS)return Hp;xS=1;var e=bD(),t=TD(),r=wi(),i=_t(),o=AD();function l(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?i(u)?t(u[0],u[1]):e(u):o(u)}return Hp=l,Hp}var Wp,_S;function Ij(){if(_S)return Wp;_S=1;var e=lj(),t=fD(),r=Ur(),i=_t();function o(l,u){var c=i(l)?e:t;return c(l,r(u,3))}return Wp=o,Wp}var Vp,bS;function ID(){if(bS)return Vp;bS=1;var e=Object.prototype,t=e.hasOwnProperty;function r(i,o){return i!=null&&t.call(i,o)}return Vp=r,Vp}var Gp,SS;function Mj(){if(SS)return Gp;SS=1;var e=ID(),t=Tj();function r(i,o){return i!=null&&t(i,o,e)}return Gp=r,Gp}var Yp,kS;function MD(){if(kS)return Yp;kS=1;var e=_y(),t=So(),r=qa(),i=_t(),o=Br(),l=bo(),u=Xu(),c=Da(),f="[object Map]",p="[object Set]",d=Object.prototype,m=d.hasOwnProperty;function y(w){if(w==null)return!0;if(o(w)&&(i(w)||typeof w=="string"||typeof w.splice=="function"||l(w)||c(w)||r(w)))return!w.length;var E=t(w);if(E==f||E==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(m.call(w,_))return!1;return!0}return Yp=y,Yp}var Kp,ES;function Oj(){if(ES)return Kp;ES=1;function e(t){return t===void 0}return Kp=e,Kp}var Xp,NS;function Pj(){if(NS)return Xp;NS=1;var e=Zu(),t=Br();function r(i,o){var l=-1,u=t(i)?Array(i.length):[];return e(i,function(c,f,p){u[++l]=o(c,f,p)}),u}return Xp=r,Xp}var Qp,CS;function Lj(){if(CS)return Qp;CS=1;var e=Ju(),t=Ur(),r=Pj(),i=_t();function o(l,u){var c=i(l)?e:r;return c(l,t(u,3))}return Qp=o,Qp}var Zp,jS;function OD(){if(jS)return Zp;jS=1;function e(t,r,i,o){var l=-1,u=t==null?0:t.length;for(o&&u&&(i=t[++l]);++l<u;)i=r(i,t[l],l,t);return i}return Zp=e,Zp}var Jp,TS;function PD(){if(TS)return Jp;TS=1;function e(t,r,i,o,l){return l(t,function(u,c,f){i=o?(o=!1,u):r(i,u,c,f)}),i}return Jp=e,Jp}var em,RS;function $j(){if(RS)return em;RS=1;var e=OD(),t=Zu(),r=Ur(),i=PD(),o=_t();function l(u,c,f){var p=o(u)?e:i,d=arguments.length<3;return p(u,r(c,4),f,d,t)}return em=l,em}var tm,AS;function LD(){if(AS)return tm;AS=1;var e=gi(),t=_t(),r=mr(),i="[object String]";function o(l){return typeof l=="string"||!t(l)&&r(l)&&e(l)==i}return tm=o,tm}var nm,IS;function $D(){if(IS)return nm;IS=1;var e=Aj(),t=e("length");return nm=t,nm}var rm,MS;function qD(){if(MS)return rm;MS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=t+r+i,l="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+l+"]");function f(p){return c.test(p)}return rm=f,rm}var sm,OS;function DD(){if(OS)return sm;OS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=t+r+i,l="\\ufe0e\\ufe0f",u="["+e+"]",c="["+o+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+f+")",d="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",E=p+"?",_="["+l+"]?",b="(?:"+w+"(?:"+[d,m,y].join("|")+")"+_+E+")*",S=_+E+b,k="(?:"+[d+c+"?",c,m,y,u].join("|")+")",N=RegExp(f+"(?="+f+")|"+k+S,"g");function j(A){for(var M=N.lastIndex=0;N.test(A);)++M;return M}return sm=j,sm}var im,PS;function FD(){if(PS)return im;PS=1;var e=$D(),t=qD(),r=DD();function i(o){return t(o)?r(o):e(o)}return im=i,im}var om,LS;function zD(){if(LS)return om;LS=1;var e=_y(),t=So(),r=Br(),i=LD(),o=FD(),l="[object Map]",u="[object Set]";function c(f){if(f==null)return 0;if(r(f))return i(f)?o(f):f.length;var p=t(f);return p==l||p==u?f.size:e(f).length}return om=c,om}var am,$S;function BD(){if($S)return am;$S=1;var e=yy(),t=gj(),r=Cy(),i=Ur(),o=Qu(),l=_t(),u=bo(),c=La(),f=qn(),p=Da();function d(m,y,w){var E=l(m),_=E||u(m)||p(m);if(y=i(y,4),w==null){var b=m&&m.constructor;_?w=E?new b:[]:f(m)?w=c(b)?t(o(m)):{}:w={}}return(_?e:r)(m,function(S,k,N){return y(w,S,k,N)}),w}return am=d,am}var lm,qS;function UD(){if(qS)return lm;qS=1;var e=_o(),t=qa(),r=_t(),i=e?e.isConcatSpreadable:void 0;function o(l){return r(l)||t(l)||!!(i&&l&&l[i])}return lm=o,lm}var um,DS;function Ry(){if(DS)return um;DS=1;var e=Sy(),t=UD();function r(i,o,l,u,c){var f=-1,p=i.length;for(l||(l=t),c||(c=[]);++f<p;){var d=i[f];o>0&&l(d)?o>1?r(d,o-1,l,u,c):e(c,d):u||(c[c.length]=d)}return c}return um=r,um}var cm,FS;function HD(){if(FS)return cm;FS=1;function e(t,r,i){switch(i.length){case 0:return t.call(r);case 1:return t.call(r,i[0]);case 2:return t.call(r,i[0],i[1]);case 3:return t.call(r,i[0],i[1],i[2])}return t.apply(r,i)}return cm=e,cm}var dm,zS;function qj(){if(zS)return dm;zS=1;var e=HD(),t=Math.max;function r(i,o,l){return o=t(o===void 0?i.length-1:o,0),function(){for(var u=arguments,c=-1,f=t(u.length-o,0),p=Array(f);++c<f;)p[c]=u[o+c];c=-1;for(var d=Array(o+1);++c<o;)d[c]=u[c];return d[o]=l(p),e(i,this,d)}}return dm=r,dm}var fm,BS;function WD(){if(BS)return fm;BS=1;var e=Ey(),t=rj(),r=wi(),i=t?function(o,l){return t(o,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:r;return fm=i,fm}var hm,US;function VD(){if(US)return hm;US=1;var e=800,t=16,r=Date.now;function i(o){var l=0,u=0;return function(){var c=r(),f=t-(c-u);if(u=c,f>0){if(++l>=e)return arguments[0]}else l=0;return o.apply(void 0,arguments)}}return hm=i,hm}var pm,HS;function Dj(){if(HS)return pm;HS=1;var e=WD(),t=VD(),r=t(e);return pm=r,pm}var mm,WS;function nc(){if(WS)return mm;WS=1;var e=wi(),t=qj(),r=Dj();function i(o,l){return r(t(o,l,e),o+"")}return mm=i,mm}var gm,VS;function Fj(){if(VS)return gm;VS=1;function e(t,r,i,o){for(var l=t.length,u=i+(o?1:-1);o?u--:++u<l;)if(r(t[u],u,t))return u;return-1}return gm=e,gm}var vm,GS;function GD(){if(GS)return vm;GS=1;function e(t){return t!==t}return vm=e,vm}var ym,YS;function YD(){if(YS)return ym;YS=1;function e(t,r,i){for(var o=i-1,l=t.length;++o<l;)if(t[o]===r)return o;return-1}return ym=e,ym}var wm,KS;function KD(){if(KS)return wm;KS=1;var e=Fj(),t=GD(),r=YD();function i(o,l,u){return l===l?r(o,l,u):e(o,t,u)}return wm=i,wm}var xm,XS;function XD(){if(XS)return xm;XS=1;var e=KD();function t(r,i){var o=r==null?0:r.length;return!!o&&e(r,i,0)>-1}return xm=t,xm}var _m,QS;function QD(){if(QS)return _m;QS=1;function e(t,r,i){for(var o=-1,l=t==null?0:t.length;++o<l;)if(i(r,t[o]))return!0;return!1}return _m=e,_m}var bm,ZS;function ZD(){if(ZS)return bm;ZS=1;function e(){}return bm=e,bm}var Sm,JS;function JD(){if(JS)return Sm;JS=1;var e=hj(),t=ZD(),r=jy(),i=1/0,o=e&&1/r(new e([,-0]))[1]==i?function(l){return new e(l)}:t;return Sm=o,Sm}var km,ek;function e4(){if(ek)return km;ek=1;var e=bj(),t=XD(),r=QD(),i=Sj(),o=JD(),l=jy(),u=200;function c(f,p,d){var m=-1,y=t,w=f.length,E=!0,_=[],b=_;if(d)E=!1,y=r;else if(w>=u){var S=p?null:o(f);if(S)return l(S);E=!1,y=i,b=new e}else b=p?[]:_;e:for(;++m<w;){var k=f[m],N=p?p(k):k;if(k=d||k!==0?k:0,E&&N===N){for(var j=b.length;j--;)if(b[j]===N)continue e;p&&b.push(N),_.push(k)}else y(b,N,d)||(b!==_&&b.push(N),_.push(k))}return _}return km=c,km}var Em,tk;function zj(){if(tk)return Em;tk=1;var e=Br(),t=mr();function r(i){return t(i)&&e(i)}return Em=r,Em}var Nm,nk;function t4(){if(nk)return Nm;nk=1;var e=Ry(),t=nc(),r=e4(),i=zj(),o=t(function(l){return r(e(l,1,i,!0))});return Nm=o,Nm}var Cm,rk;function n4(){if(rk)return Cm;rk=1;var e=Ju();function t(r,i){return e(i,function(o){return r[o]})}return Cm=t,Cm}var jm,sk;function Bj(){if(sk)return jm;sk=1;var e=n4(),t=As();function r(i){return i==null?[]:e(i,t(i))}return jm=r,jm}var Tm,ik;function Dn(){if(ik)return Tm;ik=1;var e;if(typeof my=="function")try{e={clone:uD(),constant:Ey(),each:_j(),filter:Ij(),has:Mj(),isArray:_t(),isEmpty:MD(),isFunction:La(),isUndefined:Oj(),keys:As(),map:Lj(),reduce:$j(),size:zD(),transform:BD(),union:t4(),values:Bj()}}catch{}return e||(e=window._),Tm=e,Tm}var Rm,ok;function Ay(){if(ok)return Rm;ok=1;var e=Dn();Rm=o;var t="\0",r="\0",i="";function o(d){this._isDirected=e.has(d,"directed")?d.directed:!0,this._isMultigraph=e.has(d,"multigraph")?d.multigraph:!1,this._isCompound=e.has(d,"compound")?d.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[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(d){return this._label=d,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultNodeLabelFn=d,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var d=this;return e.filter(this.nodes(),function(m){return e.isEmpty(d._in[m])})},o.prototype.sinks=function(){var d=this;return e.filter(this.nodes(),function(m){return e.isEmpty(d._out[m])})},o.prototype.setNodes=function(d,m){var y=arguments,w=this;return e.each(d,function(E){y.length>1?w.setNode(E,m):w.setNode(E)}),this},o.prototype.setNode=function(d,m){return e.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=m),this):(this._nodes[d]=arguments.length>1?m:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=r,this._children[d]={},this._children[r][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)},o.prototype.node=function(d){return this._nodes[d]},o.prototype.hasNode=function(d){return e.has(this._nodes,d)},o.prototype.removeNode=function(d){var m=this;if(e.has(this._nodes,d)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(w){m.setParent(w)}),delete this._children[d]),e.each(e.keys(this._in[d]),y),delete this._in[d],delete this._preds[d],e.each(e.keys(this._out[d]),y),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this},o.prototype.setParent=function(d,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=r;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===d)throw new Error("Setting "+m+" as parent of "+d+" would create a cycle");this.setNode(m)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=m,this._children[m][d]=!0,this},o.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},o.prototype.parent=function(d){if(this._isCompound){var m=this._parent[d];if(m!==r)return m}},o.prototype.children=function(d){if(e.isUndefined(d)&&(d=r),this._isCompound){var m=this._children[d];if(m)return e.keys(m)}else{if(d===r)return this.nodes();if(this.hasNode(d))return[]}},o.prototype.predecessors=function(d){var m=this._preds[d];if(m)return e.keys(m)},o.prototype.successors=function(d){var m=this._sucs[d];if(m)return e.keys(m)},o.prototype.neighbors=function(d){var m=this.predecessors(d);if(m)return e.union(m,this.successors(d))},o.prototype.isLeaf=function(d){var m;return this.isDirected()?m=this.successors(d):m=this.neighbors(d),m.length===0},o.prototype.filterNodes=function(d){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(_,b){d(b)&&m.setNode(b,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var w={};function E(_){var b=y.parent(_);return b===void 0||m.hasNode(b)?(w[_]=b,b):b in w?w[b]:E(b)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,E(_))}),m},o.prototype.setDefaultEdgeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultEdgeLabelFn=d,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(d,m){var y=this,w=arguments;return e.reduce(d,function(E,_){return w.length>1?y.setEdge(E,_,m):y.setEdge(E,_),_}),this},o.prototype.setEdge=function(){var d,m,y,w,E=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,m=_.w,y=_.name,arguments.length===2&&(w=arguments[1],E=!0)):(d=_,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],E=!0)),d=""+d,m=""+m,e.isUndefined(y)||(y=""+y);var b=c(this._isDirected,d,m,y);if(e.has(this._edgeLabels,b))return E&&(this._edgeLabels[b]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(m),this._edgeLabels[b]=E?w:this._defaultEdgeLabelFn(d,m,y);var S=f(this._isDirected,d,m,y);return d=S.v,m=S.w,Object.freeze(S),this._edgeObjs[b]=S,l(this._preds[m],d),l(this._sucs[d],m),this._in[m][b]=S,this._out[d][b]=S,this._edgeCount++,this},o.prototype.edge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return this._edgeLabels[w]},o.prototype.hasEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return e.has(this._edgeLabels,w)},o.prototype.removeEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y),E=this._edgeObjs[w];return E&&(d=E.v,m=E.w,delete this._edgeLabels[w],delete this._edgeObjs[w],u(this._preds[m],d),u(this._sucs[d],m),delete this._in[m][w],delete this._out[d][w],this._edgeCount--),this},o.prototype.inEdges=function(d,m){var y=this._in[d];if(y){var w=e.values(y);return m?e.filter(w,function(E){return E.v===m}):w}},o.prototype.outEdges=function(d,m){var y=this._out[d];if(y){var w=e.values(y);return m?e.filter(w,function(E){return E.w===m}):w}},o.prototype.nodeEdges=function(d,m){var y=this.inEdges(d,m);if(y)return y.concat(this.outEdges(d,m))};function l(d,m){d[m]?d[m]++:d[m]=1}function u(d,m){--d[m]||delete d[m]}function c(d,m,y,w){var E=""+m,_=""+y;if(!d&&E>_){var b=E;E=_,_=b}return E+i+_+i+(e.isUndefined(w)?t:w)}function f(d,m,y,w){var E=""+m,_=""+y;if(!d&&E>_){var b=E;E=_,_=b}var S={v:E,w:_};return w&&(S.name=w),S}function p(d,m){return c(d,m.v,m.w,m.name)}return Rm}var Am,ak;function r4(){return ak||(ak=1,Am="2.1.8"),Am}var Im,lk;function s4(){return lk||(lk=1,Im={Graph:Ay(),version:r4()}),Im}var Mm,uk;function i4(){if(uk)return Mm;uk=1;var e=Dn(),t=Ay();Mm={write:r,read:l};function r(u){var c={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:i(u),edges:o(u)};return e.isUndefined(u.graph())||(c.value=e.clone(u.graph())),c}function i(u){return e.map(u.nodes(),function(c){var f=u.node(c),p=u.parent(c),d={v:c};return e.isUndefined(f)||(d.value=f),e.isUndefined(p)||(d.parent=p),d})}function o(u){return e.map(u.edges(),function(c){var f=u.edge(c),p={v:c.v,w:c.w};return e.isUndefined(c.name)||(p.name=c.name),e.isUndefined(f)||(p.value=f),p})}function l(u){var c=new t(u.options).setGraph(u.value);return e.each(u.nodes,function(f){c.setNode(f.v,f.value),f.parent&&c.setParent(f.v,f.parent)}),e.each(u.edges,function(f){c.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),c}return Mm}var Om,ck;function o4(){if(ck)return Om;ck=1;var e=Dn();Om=t;function t(r){var i={},o=[],l;function u(c){e.has(i,c)||(i[c]=!0,l.push(c),e.each(r.successors(c),u),e.each(r.predecessors(c),u))}return e.each(r.nodes(),function(c){l=[],u(c),l.length&&o.push(l)}),o}return Om}var Pm,dk;function Uj(){if(dk)return Pm;dk=1;var e=Dn();Pm=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(r){return r.key})},t.prototype.has=function(r){return e.has(this._keyIndices,r)},t.prototype.priority=function(r){var i=this._keyIndices[r];if(i!==void 0)return this._arr[i].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,i){var o=this._keyIndices;if(r=String(r),!e.has(o,r)){var l=this._arr,u=l.length;return o[r]=u,l.push({key:r,priority:i}),this._decrease(u),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},t.prototype.decrease=function(r,i){var o=this._keyIndices[r];if(i>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[o].priority+" New: "+i);this._arr[o].priority=i,this._decrease(o)},t.prototype._heapify=function(r){var i=this._arr,o=2*r,l=o+1,u=r;o<i.length&&(u=i[o].priority<i[u].priority?o:u,l<i.length&&(u=i[l].priority<i[u].priority?l:u),u!==r&&(this._swap(r,u),this._heapify(u)))},t.prototype._decrease=function(r){for(var i=this._arr,o=i[r].priority,l;r!==0&&(l=r>>1,!(i[l].priority<o));)this._swap(r,l),r=l},t.prototype._swap=function(r,i){var o=this._arr,l=this._keyIndices,u=o[r],c=o[i];o[r]=c,o[i]=u,l[c.key]=r,l[u.key]=i},Pm}var Lm,fk;function Hj(){if(fk)return Lm;fk=1;var e=Dn(),t=Uj();Lm=i;var r=e.constant(1);function i(l,u,c,f){return o(l,String(u),c||r,f||function(p){return l.outEdges(p)})}function o(l,u,c,f){var p={},d=new t,m,y,w=function(E){var _=E.v!==m?E.v:E.w,b=p[_],S=c(E),k=y.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+E+" Weight: "+S);k<b.distance&&(b.distance=k,b.predecessor=m,d.decrease(_,k))};for(l.nodes().forEach(function(E){var _=E===u?0:Number.POSITIVE_INFINITY;p[E]={distance:_},d.add(E,_)});d.size()>0&&(m=d.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(w);return p}return Lm}var $m,hk;function a4(){if(hk)return $m;hk=1;var e=Hj(),t=Dn();$m=r;function r(i,o,l){return t.transform(i.nodes(),function(u,c){u[c]=e(i,c,o,l)},{})}return $m}var qm,pk;function Wj(){if(pk)return qm;pk=1;var e=Dn();qm=t;function t(r){var i=0,o=[],l={},u=[];function c(f){var p=l[f]={onStack:!0,lowlink:i,index:i++};if(o.push(f),r.successors(f).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(c(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var d=[],m;do m=o.pop(),l[m].onStack=!1,d.push(m);while(f!==m);u.push(d)}}return r.nodes().forEach(function(f){e.has(l,f)||c(f)}),u}return qm}var Dm,mk;function l4(){if(mk)return Dm;mk=1;var e=Dn(),t=Wj();Dm=r;function r(i){return e.filter(t(i),function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}return Dm}var Fm,gk;function u4(){if(gk)return Fm;gk=1;var e=Dn();Fm=r;var t=e.constant(1);function r(o,l,u){return i(o,l||t,u||function(c){return o.outEdges(c)})}function i(o,l,u){var c={},f=o.nodes();return f.forEach(function(p){c[p]={},c[p][p]={distance:0},f.forEach(function(d){p!==d&&(c[p][d]={distance:Number.POSITIVE_INFINITY})}),u(p).forEach(function(d){var m=d.v===p?d.w:d.v,y=l(d);c[p][m]={distance:y,predecessor:p}})}),f.forEach(function(p){var d=c[p];f.forEach(function(m){var y=c[m];f.forEach(function(w){var E=y[p],_=d[w],b=y[w],S=E.distance+_.distance;S<b.distance&&(b.distance=S,b.predecessor=_.predecessor)})})}),c}return Fm}var zm,vk;function Vj(){if(vk)return zm;vk=1;var e=Dn();zm=t,t.CycleException=r;function t(i){var o={},l={},u=[];function c(f){if(e.has(l,f))throw new r;e.has(o,f)||(l[f]=!0,o[f]=!0,e.each(i.predecessors(f),c),delete l[f],u.push(f))}if(e.each(i.sinks(),c),e.size(o)!==i.nodeCount())throw new r;return u}function r(){}return r.prototype=new Error,zm}var Bm,yk;function c4(){if(yk)return Bm;yk=1;var e=Vj();Bm=t;function t(r){try{e(r)}catch(i){if(i instanceof e.CycleException)return!1;throw i}return!0}return Bm}var Um,wk;function Gj(){if(wk)return Um;wk=1;var e=Dn();Um=t;function t(i,o,l){e.isArray(o)||(o=[o]);var u=(i.isDirected()?i.successors:i.neighbors).bind(i),c=[],f={};return e.each(o,function(p){if(!i.hasNode(p))throw new Error("Graph does not have node: "+p);r(i,p,l==="post",f,u,c)}),c}function r(i,o,l,u,c,f){e.has(u,o)||(u[o]=!0,l||f.push(o),e.each(c(o),function(p){r(i,p,l,u,c,f)}),l&&f.push(o))}return Um}var Hm,xk;function d4(){if(xk)return Hm;xk=1;var e=Gj();Hm=t;function t(r,i){return e(r,i,"post")}return Hm}var Wm,_k;function f4(){if(_k)return Wm;_k=1;var e=Gj();Wm=t;function t(r,i){return e(r,i,"pre")}return Wm}var Vm,bk;function h4(){if(bk)return Vm;bk=1;var e=Dn(),t=Ay(),r=Uj();Vm=i;function i(o,l){var u=new t,c={},f=new r,p;function d(y){var w=y.v===p?y.w:y.v,E=f.priority(w);if(E!==void 0){var _=l(y);_<E&&(c[w]=p,f.decrease(w,_))}}if(o.nodeCount()===0)return u;e.each(o.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),u.setNode(y)}),f.decrease(o.nodes()[0],0);for(var m=!1;f.size()>0;){if(p=f.removeMin(),e.has(c,p))u.setEdge(p,c[p]);else{if(m)throw new Error("Input graph is not connected: "+o);m=!0}o.nodeEdges(p).forEach(d)}return u}return Vm}var Gm,Sk;function p4(){return Sk||(Sk=1,Gm={components:o4(),dijkstra:Hj(),dijkstraAll:a4(),findCycles:l4(),floydWarshall:u4(),isAcyclic:c4(),postorder:d4(),preorder:f4(),prim:h4(),tarjan:Wj(),topsort:Vj()}),Gm}var Ym,kk;function m4(){if(kk)return Ym;kk=1;var e=s4();return Ym={Graph:e.Graph,json:i4(),alg:p4(),version:e.version},Ym}var Km,Ek;function tr(){if(Ek)return Km;Ek=1;var e;if(typeof my=="function")try{e=m4()}catch{}return e||(e=window.graphlib),Km=e,Km}var Xm,Nk;function g4(){if(Nk)return Xm;Nk=1;var e=yj(),t=1,r=4;function i(o){return e(o,t|r)}return Xm=i,Xm}var Qm,Ck;function rc(){if(Ck)return Qm;Ck=1;var e=xo(),t=Br(),r=Yu(),i=qn();function o(l,u,c){if(!i(c))return!1;var f=typeof u;return(f=="number"?t(c)&&r(u,c.length):f=="string"&&u in c)?e(c[u],l):!1}return Qm=o,Qm}var Zm,jk;function v4(){if(jk)return Zm;jk=1;var e=nc(),t=xo(),r=rc(),i=yi(),o=Object.prototype,l=o.hasOwnProperty,u=e(function(c,f){c=Object(c);var p=-1,d=f.length,m=d>2?f[2]:void 0;for(m&&r(f[0],f[1],m)&&(d=1);++p<d;)for(var y=f[p],w=i(y),E=-1,_=w.length;++E<_;){var b=w[E],S=c[b];(S===void 0||t(S,o[b])&&!l.call(c,b))&&(c[b]=y[b])}return c});return Zm=u,Zm}var Jm,Tk;function y4(){if(Tk)return Jm;Tk=1;var e=Ur(),t=Br(),r=As();function i(o){return function(l,u,c){var f=Object(l);if(!t(l)){var p=e(u,3);l=r(l),u=function(m){return p(f[m],m,f)}}var d=o(l,u,c);return d>-1?f[p?l[d]:d]:void 0}}return Jm=i,Jm}var eg,Rk;function w4(){if(Rk)return eg;Rk=1;var e=/\s/;function t(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return eg=t,eg}var tg,Ak;function x4(){if(Ak)return tg;Ak=1;var e=w4(),t=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(t,"")}return tg=r,tg}var ng,Ik;function _4(){if(Ik)return ng;Ik=1;var e=x4(),t=qn(),r=ko(),i=NaN,o=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;function f(p){if(typeof p=="number")return p;if(r(p))return i;if(t(p)){var d=typeof p.valueOf=="function"?p.valueOf():p;p=t(d)?d+"":d}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=l.test(p);return m||u.test(p)?c(p.slice(2),m?2:8):o.test(p)?i:+p}return ng=f,ng}var rg,Mk;function Yj(){if(Mk)return rg;Mk=1;var e=_4(),t=1/0,r=17976931348623157e292;function i(o){if(!o)return o===0?o:0;if(o=e(o),o===t||o===-t){var l=o<0?-1:1;return l*r}return o===o?o:0}return rg=i,rg}var sg,Ok;function b4(){if(Ok)return sg;Ok=1;var e=Yj();function t(r){var i=e(r),o=i%1;return i===i?o?i-o:i:0}return sg=t,sg}var ig,Pk;function S4(){if(Pk)return ig;Pk=1;var e=Fj(),t=Ur(),r=b4(),i=Math.max;function o(l,u,c){var f=l==null?0:l.length;if(!f)return-1;var p=c==null?0:r(c);return p<0&&(p=i(f+p,0)),e(l,t(u,3),p)}return ig=o,ig}var og,Lk;function k4(){if(Lk)return og;Lk=1;var e=y4(),t=S4(),r=e(t);return og=r,og}var ag,$k;function Kj(){if($k)return ag;$k=1;var e=Ry();function t(r){var i=r==null?0:r.length;return i?e(r,1):[]}return ag=t,ag}var lg,qk;function E4(){if(qk)return lg;qk=1;var e=Ny(),t=wj(),r=yi();function i(o,l){return o==null?o:e(o,t(l),r)}return lg=i,lg}var ug,Dk;function N4(){if(Dk)return ug;Dk=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return ug=e,ug}var cg,Fk;function C4(){if(Fk)return cg;Fk=1;var e=Vu(),t=Cy(),r=Ur();function i(o,l){var u={};return l=r(l,3),t(o,function(c,f,p){e(u,f,l(c,f,p))}),u}return cg=i,cg}var dg,zk;function Iy(){if(zk)return dg;zk=1;var e=ko();function t(r,i,o){for(var l=-1,u=r.length;++l<u;){var c=r[l],f=i(c);if(f!=null&&(p===void 0?f===f&&!e(f):o(f,p)))var p=f,d=c}return d}return dg=t,dg}var fg,Bk;function j4(){if(Bk)return fg;Bk=1;function e(t,r){return t>r}return fg=e,fg}var hg,Uk;function T4(){if(Uk)return hg;Uk=1;var e=Iy(),t=j4(),r=wi();function i(o){return o&&o.length?e(o,r,t):void 0}return hg=i,hg}var pg,Hk;function Xj(){if(Hk)return pg;Hk=1;var e=Vu(),t=xo();function r(i,o,l){(l!==void 0&&!t(i[o],l)||l===void 0&&!(o in i))&&e(i,o,l)}return pg=r,pg}var mg,Wk;function R4(){if(Wk)return mg;Wk=1;var e=gi(),t=Qu(),r=mr(),i="[object Object]",o=Function.prototype,l=Object.prototype,u=o.toString,c=l.hasOwnProperty,f=u.call(Object);function p(d){if(!r(d)||e(d)!=i)return!1;var m=t(d);if(m===null)return!0;var y=c.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&u.call(y)==f}return mg=p,mg}var gg,Vk;function Qj(){if(Vk)return gg;Vk=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return gg=e,gg}var vg,Gk;function A4(){if(Gk)return vg;Gk=1;var e=$a(),t=yi();function r(i){return e(i,t(i))}return vg=r,vg}var yg,Yk;function I4(){if(Yk)return yg;Yk=1;var e=Xj(),t=oj(),r=mj(),i=aj(),o=vj(),l=qa(),u=_t(),c=zj(),f=bo(),p=La(),d=qn(),m=R4(),y=Da(),w=Qj(),E=A4();function _(b,S,k,N,j,A,M){var O=w(b,k),P=w(S,k),D=M.get(P);if(D){e(b,k,D);return}var L=A?A(O,P,k+"",b,S,M):void 0,U=L===void 0;if(U){var V=u(P),z=!V&&f(P),C=!V&&!z&&y(P);L=P,V||z||C?u(O)?L=O:c(O)?L=i(O):z?(U=!1,L=t(P,!0)):C?(U=!1,L=r(P,!0)):L=[]:m(P)||l(P)?(L=O,l(O)?L=E(O):(!d(O)||p(O))&&(L=o(P))):U=!1}U&&(M.set(P,L),j(L,P,N,A,M),M.delete(P)),e(b,k,L)}return yg=_,yg}var wg,Kk;function M4(){if(Kk)return wg;Kk=1;var e=Wu(),t=Xj(),r=Ny(),i=I4(),o=qn(),l=yi(),u=Qj();function c(f,p,d,m,y){f!==p&&r(p,function(w,E){if(y||(y=new e),o(w))i(f,p,E,d,c,m,y);else{var _=m?m(u(f,E),w,E+"",f,p,y):void 0;_===void 0&&(_=w),t(f,E,_)}},l)}return wg=c,wg}var xg,Xk;function O4(){if(Xk)return xg;Xk=1;var e=nc(),t=rc();function r(i){return e(function(o,l){var u=-1,c=l.length,f=c>1?l[c-1]:void 0,p=c>2?l[2]:void 0;for(f=i.length>3&&typeof f=="function"?(c--,f):void 0,p&&t(l[0],l[1],p)&&(f=c<3?void 0:f,c=1),o=Object(o);++u<c;){var d=l[u];d&&i(o,d,u,f)}return o})}return xg=r,xg}var _g,Qk;function P4(){if(Qk)return _g;Qk=1;var e=M4(),t=O4(),r=t(function(i,o,l){e(i,o,l)});return _g=r,_g}var bg,Zk;function Zj(){if(Zk)return bg;Zk=1;function e(t,r){return t<r}return bg=e,bg}var Sg,Jk;function L4(){if(Jk)return Sg;Jk=1;var e=Iy(),t=Zj(),r=wi();function i(o){return o&&o.length?e(o,r,t):void 0}return Sg=i,Sg}var kg,eE;function $4(){if(eE)return kg;eE=1;var e=Iy(),t=Ur(),r=Zj();function i(o,l){return o&&o.length?e(o,t(l,2),r):void 0}return kg=i,kg}var Eg,tE;function q4(){if(tE)return Eg;tE=1;var e=rr(),t=function(){return e.Date.now()};return Eg=t,Eg}var Ng,nE;function D4(){if(nE)return Ng;nE=1;var e=Gu(),t=ec(),r=Yu(),i=qn(),o=Fa();function l(u,c,f,p){if(!i(u))return u;c=t(c,u);for(var d=-1,m=c.length,y=m-1,w=u;w!=null&&++d<m;){var E=o(c[d]),_=f;if(E==="__proto__"||E==="constructor"||E==="prototype")return u;if(d!=y){var b=w[E];_=p?p(b,E,w):void 0,_===void 0&&(_=i(b)?b:r(c[d+1])?[]:{})}e(w,E,_),w=w[E]}return u}return Ng=l,Ng}var Cg,rE;function F4(){if(rE)return Cg;rE=1;var e=tc(),t=D4(),r=ec();function i(o,l,u){for(var c=-1,f=l.length,p={};++c<f;){var d=l[c],m=e(o,d);u(m,d)&&t(p,r(d,o),m)}return p}return Cg=i,Cg}var jg,sE;function z4(){if(sE)return jg;sE=1;var e=F4(),t=Rj();function r(i,o){return e(i,o,function(l,u){return t(i,u)})}return jg=r,jg}var Tg,iE;function B4(){if(iE)return Tg;iE=1;var e=Kj(),t=qj(),r=Dj();function i(o){return r(t(o,void 0,e),o+"")}return Tg=i,Tg}var Rg,oE;function U4(){if(oE)return Rg;oE=1;var e=z4(),t=B4(),r=t(function(i,o){return i==null?{}:e(i,o)});return Rg=r,Rg}var Ag,aE;function H4(){if(aE)return Ag;aE=1;var e=Math.ceil,t=Math.max;function r(i,o,l,u){for(var c=-1,f=t(e((o-i)/(l||1)),0),p=Array(f);f--;)p[u?f:++c]=i,i+=l;return p}return Ag=r,Ag}var Ig,lE;function W4(){if(lE)return Ig;lE=1;var e=H4(),t=rc(),r=Yj();function i(o){return function(l,u,c){return c&&typeof c!="number"&&t(l,u,c)&&(u=c=void 0),l=r(l),u===void 0?(u=l,l=0):u=r(u),c=c===void 0?l<u?1:-1:r(c),e(l,u,c,o)}}return Ig=i,Ig}var Mg,uE;function V4(){if(uE)return Mg;uE=1;var e=W4(),t=e();return Mg=t,Mg}var Og,cE;function G4(){if(cE)return Og;cE=1;function e(t,r){var i=t.length;for(t.sort(r);i--;)t[i]=t[i].value;return t}return Og=e,Og}var Pg,dE;function Y4(){if(dE)return Pg;dE=1;var e=ko();function t(r,i){if(r!==i){var o=r!==void 0,l=r===null,u=r===r,c=e(r),f=i!==void 0,p=i===null,d=i===i,m=e(i);if(!p&&!m&&!c&&r>i||c&&f&&d&&!p&&!m||l&&f&&d||!o&&d||!u)return 1;if(!l&&!c&&!m&&r<i||m&&o&&u&&!l&&!c||p&&o&&u||!f&&u||!d)return-1}return 0}return Pg=t,Pg}var Lg,fE;function K4(){if(fE)return Lg;fE=1;var e=Y4();function t(r,i,o){for(var l=-1,u=r.criteria,c=i.criteria,f=u.length,p=o.length;++l<f;){var d=e(u[l],c[l]);if(d){if(l>=p)return d;var m=o[l];return d*(m=="desc"?-1:1)}}return r.index-i.index}return Lg=t,Lg}var $g,hE;function X4(){if(hE)return $g;hE=1;var e=Ju(),t=tc(),r=Ur(),i=Pj(),o=G4(),l=Ku(),u=K4(),c=wi(),f=_t();function p(d,m,y){m.length?m=e(m,function(_){return f(_)?function(b){return t(b,_.length===1?_[0]:_)}:_}):m=[c];var w=-1;m=e(m,l(r));var E=i(d,function(_,b,S){var k=e(m,function(N){return N(_)});return{criteria:k,index:++w,value:_}});return o(E,function(_,b){return u(_,b,y)})}return $g=p,$g}var qg,pE;function Q4(){if(pE)return qg;pE=1;var e=Ry(),t=X4(),r=nc(),i=rc(),o=r(function(l,u){if(l==null)return[];var c=u.length;return c>1&&i(l,u[0],u[1])?u=[]:c>2&&i(u[0],u[1],u[2])&&(u=[u[0]]),t(l,e(u,1),[])});return qg=o,qg}var Dg,mE;function Z4(){if(mE)return Dg;mE=1;var e=jj(),t=0;function r(i){var o=++t;return e(i)+o}return Dg=r,Dg}var Fg,gE;function J4(){if(gE)return Fg;gE=1;function e(t,r,i){for(var o=-1,l=t.length,u=r.length,c={};++o<l;){var f=o<u?r[o]:void 0;i(c,t[o],f)}return c}return Fg=e,Fg}var zg,vE;function e5(){if(vE)return zg;vE=1;var e=Gu(),t=J4();function r(i,o){return t(i||[],o||[],e)}return zg=r,zg}var Bg,yE;function at(){if(yE)return Bg;yE=1;var e;if(typeof my=="function")try{e={cloneDeep:g4(),constant:Ey(),defaults:v4(),each:_j(),filter:Ij(),find:k4(),flatten:Kj(),forEach:xj(),forIn:E4(),has:Mj(),isUndefined:Oj(),last:N4(),map:Lj(),mapValues:C4(),max:T4(),merge:P4(),min:L4(),minBy:$4(),now:q4(),pick:U4(),range:V4(),reduce:$j(),sortBy:Q4(),uniqueId:Z4(),values:Bj(),zipObject:e5()}}catch{}return e||(e=window._),Bg=e,Bg}var Ug,wE;function t5(){if(wE)return Ug;wE=1,Ug=e;function e(){var i={};i._next=i._prev=i,this._sentinel=i}e.prototype.dequeue=function(){var i=this._sentinel,o=i._prev;if(o!==i)return t(o),o},e.prototype.enqueue=function(i){var o=this._sentinel;i._prev&&i._next&&t(i),i._next=o._next,o._next._prev=i,o._next=i,i._prev=o},e.prototype.toString=function(){for(var i=[],o=this._sentinel,l=o._prev;l!==o;)i.push(JSON.stringify(l,r)),l=l._prev;return"["+i.join(", ")+"]"};function t(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function r(i,o){if(i!=="_next"&&i!=="_prev")return o}return Ug}var Hg,xE;function n5(){if(xE)return Hg;xE=1;var e=at(),t=tr().Graph,r=t5();Hg=o;var i=e.constant(1);function o(p,d){if(p.nodeCount()<=1)return[];var m=c(p,d||i),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function l(p,d,m){for(var y=[],w=d[d.length-1],E=d[0],_;p.nodeCount();){for(;_=E.dequeue();)u(p,d,m,_);for(;_=w.dequeue();)u(p,d,m,_);if(p.nodeCount()){for(var b=d.length-2;b>0;--b)if(_=d[b].dequeue(),_){y=y.concat(u(p,d,m,_,!0));break}}}return y}function u(p,d,m,y,w){var E=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var b=p.edge(_),S=p.node(_.v);w&&E.push({v:_.v,w:_.w}),S.out-=b,f(d,m,S)}),e.forEach(p.outEdges(y.v),function(_){var b=p.edge(_),S=_.w,k=p.node(S);k.in-=b,f(d,m,k)}),p.removeNode(y.v),E}function c(p,d){var m=new t,y=0,w=0;e.forEach(p.nodes(),function(b){m.setNode(b,{v:b,in:0,out:0})}),e.forEach(p.edges(),function(b){var S=m.edge(b.v,b.w)||0,k=d(b),N=S+k;m.setEdge(b.v,b.w,N),w=Math.max(w,m.node(b.v).out+=k),y=Math.max(y,m.node(b.w).in+=k)});var E=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(m.nodes(),function(b){f(E,_,m.node(b))}),{graph:m,buckets:E,zeroIdx:_}}function f(p,d,m){m.out?m.in?p[m.out-m.in+d].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return Hg}var Wg,_E;function r5(){if(_E)return Wg;_E=1;var e=at(),t=n5();Wg={run:r,undo:o};function r(l){var u=l.graph().acyclicer==="greedy"?t(l,c(l)):i(l);e.forEach(u,function(f){var p=l.edge(f);l.removeEdge(f),p.forwardName=f.name,p.reversed=!0,l.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function c(f){return function(p){return f.edge(p).weight}}}function i(l){var u=[],c={},f={};function p(d){e.has(f,d)||(f[d]=!0,c[d]=!0,e.forEach(l.outEdges(d),function(m){e.has(c,m.w)?u.push(m):p(m.w)}),delete c[d])}return e.forEach(l.nodes(),p),u}function o(l){e.forEach(l.edges(),function(u){var c=l.edge(u);if(c.reversed){l.removeEdge(u);var f=c.forwardName;delete c.reversed,delete c.forwardName,l.setEdge(u.w,u.v,c,f)}})}return Wg}var Vg,bE;function fn(){if(bE)return Vg;bE=1;var e=at(),t=tr().Graph;Vg={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:l,predecessorWeights:u,intersectRect:c,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:m,maxRank:y,partition:w,time:E,notime:_};function r(b,S,k,N){var j;do j=e.uniqueId(N);while(b.hasNode(j));return k.dummy=S,b.setNode(j,k),j}function i(b){var S=new t().setGraph(b.graph());return e.forEach(b.nodes(),function(k){S.setNode(k,b.node(k))}),e.forEach(b.edges(),function(k){var N=S.edge(k.v,k.w)||{weight:0,minlen:1},j=b.edge(k);S.setEdge(k.v,k.w,{weight:N.weight+j.weight,minlen:Math.max(N.minlen,j.minlen)})}),S}function o(b){var S=new t({multigraph:b.isMultigraph()}).setGraph(b.graph());return e.forEach(b.nodes(),function(k){b.children(k).length||S.setNode(k,b.node(k))}),e.forEach(b.edges(),function(k){S.setEdge(k,b.edge(k))}),S}function l(b){var S=e.map(b.nodes(),function(k){var N={};return e.forEach(b.outEdges(k),function(j){N[j.w]=(N[j.w]||0)+b.edge(j).weight}),N});return e.zipObject(b.nodes(),S)}function u(b){var S=e.map(b.nodes(),function(k){var N={};return e.forEach(b.inEdges(k),function(j){N[j.v]=(N[j.v]||0)+b.edge(j).weight}),N});return e.zipObject(b.nodes(),S)}function c(b,S){var k=b.x,N=b.y,j=S.x-k,A=S.y-N,M=b.width/2,O=b.height/2;if(!j&&!A)throw new Error("Not possible to find intersection inside of the rectangle");var P,D;return Math.abs(A)*M>Math.abs(j)*O?(A<0&&(O=-O),P=O*j/A,D=O):(j<0&&(M=-M),P=M,D=M*A/j),{x:k+P,y:N+D}}function f(b){var S=e.map(e.range(y(b)+1),function(){return[]});return e.forEach(b.nodes(),function(k){var N=b.node(k),j=N.rank;e.isUndefined(j)||(S[j][N.order]=k)}),S}function p(b){var S=e.min(e.map(b.nodes(),function(k){return b.node(k).rank}));e.forEach(b.nodes(),function(k){var N=b.node(k);e.has(N,"rank")&&(N.rank-=S)})}function d(b){var S=e.min(e.map(b.nodes(),function(A){return b.node(A).rank})),k=[];e.forEach(b.nodes(),function(A){var M=b.node(A).rank-S;k[M]||(k[M]=[]),k[M].push(A)});var N=0,j=b.graph().nodeRankFactor;e.forEach(k,function(A,M){e.isUndefined(A)&&M%j!==0?--N:N&&e.forEach(A,function(O){b.node(O).rank+=N})})}function m(b,S,k,N){var j={width:0,height:0};return arguments.length>=4&&(j.rank=k,j.order=N),r(b,"border",j,S)}function y(b){return e.max(e.map(b.nodes(),function(S){var k=b.node(S).rank;if(!e.isUndefined(k))return k}))}function w(b,S){var k={lhs:[],rhs:[]};return e.forEach(b,function(N){S(N)?k.lhs.push(N):k.rhs.push(N)}),k}function E(b,S){var k=e.now();try{return S()}finally{console.log(b+" time: "+(e.now()-k)+"ms")}}function _(b,S){return S()}return Vg}var Gg,SE;function s5(){if(SE)return Gg;SE=1;var e=at(),t=fn();Gg={run:r,undo:o};function r(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(u){i(l,u)})}function i(l,u){var c=u.v,f=l.node(c).rank,p=u.w,d=l.node(p).rank,m=u.name,y=l.edge(u),w=y.labelRank;if(d!==f+1){l.removeEdge(u);var E,_,b;for(b=0,++f;f<d;++b,++f)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:u,rank:f},E=t.addDummyNode(l,"edge",_,"_d"),f===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),l.setEdge(c,E,{weight:y.weight},m),b===0&&l.graph().dummyChains.push(E),c=E;l.setEdge(c,p,{weight:y.weight},m)}}function o(l){e.forEach(l.graph().dummyChains,function(u){var c=l.node(u),f=c.edgeLabel,p;for(l.setEdge(c.edgeObj,f);c.dummy;)p=l.successors(u)[0],l.removeNode(u),f.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(f.x=c.x,f.y=c.y,f.width=c.width,f.height=c.height),u=p,c=l.node(u)})}return Gg}var Yg,kE;function Ru(){if(kE)return Yg;kE=1;var e=at();Yg={longestPath:t,slack:r};function t(i){var o={};function l(u){var c=i.node(u);if(e.has(o,u))return c.rank;o[u]=!0;var f=e.min(e.map(i.outEdges(u),function(p){return l(p.w)-i.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),c.rank=f}e.forEach(i.sources(),l)}function r(i,o){return i.node(o.w).rank-i.node(o.v).rank-i.edge(o).minlen}return Yg}var Kg,EE;function Jj(){if(EE)return Kg;EE=1;var e=at(),t=tr().Graph,r=Ru().slack;Kg=i;function i(c){var f=new t({directed:!1}),p=c.nodes()[0],d=c.nodeCount();f.setNode(p,{});for(var m,y;o(f,c)<d;)m=l(f,c),y=f.hasNode(m.v)?r(c,m):-r(c,m),u(f,c,y);return f}function o(c,f){function p(d){e.forEach(f.nodeEdges(d),function(m){var y=m.v,w=d===y?m.w:y;!c.hasNode(w)&&!r(f,m)&&(c.setNode(w,{}),c.setEdge(d,w,{}),p(w))})}return e.forEach(c.nodes(),p),c.nodeCount()}function l(c,f){return e.minBy(f.edges(),function(p){if(c.hasNode(p.v)!==c.hasNode(p.w))return r(f,p)})}function u(c,f,p){e.forEach(c.nodes(),function(d){f.node(d).rank+=p})}return Kg}var Xg,NE;function i5(){if(NE)return Xg;NE=1;var e=at(),t=Jj(),r=Ru().slack,i=Ru().longestPath,o=tr().alg.preorder,l=tr().alg.postorder,u=fn().simplify;Xg=c,c.initLowLimValues=m,c.initCutValues=f,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=E,c.exchangeEdges=_;function c(N){N=u(N),i(N);var j=t(N);m(j),f(j,N);for(var A,M;A=w(j);)M=E(j,N,A),_(j,N,A,M)}function f(N,j){var A=l(N,N.nodes());A=A.slice(0,A.length-1),e.forEach(A,function(M){p(N,j,M)})}function p(N,j,A){var M=N.node(A),O=M.parent;N.edge(A,O).cutvalue=d(N,j,A)}function d(N,j,A){var M=N.node(A),O=M.parent,P=!0,D=j.edge(A,O),L=0;return D||(P=!1,D=j.edge(O,A)),L=D.weight,e.forEach(j.nodeEdges(A),function(U){var V=U.v===A,z=V?U.w:U.v;if(z!==O){var C=V===P,F=j.edge(U).weight;if(L+=C?F:-F,S(N,A,z)){var $=N.edge(A,z).cutvalue;L+=C?-$:$}}}),L}function m(N,j){arguments.length<2&&(j=N.nodes()[0]),y(N,{},1,j)}function y(N,j,A,M,O){var P=A,D=N.node(M);return j[M]=!0,e.forEach(N.neighbors(M),function(L){e.has(j,L)||(A=y(N,j,A,L,M))}),D.low=P,D.lim=A++,O?D.parent=O:delete D.parent,A}function w(N){return e.find(N.edges(),function(j){return N.edge(j).cutvalue<0})}function E(N,j,A){var M=A.v,O=A.w;j.hasEdge(M,O)||(M=A.w,O=A.v);var P=N.node(M),D=N.node(O),L=P,U=!1;P.lim>D.lim&&(L=D,U=!0);var V=e.filter(j.edges(),function(z){return U===k(N,N.node(z.v),L)&&U!==k(N,N.node(z.w),L)});return e.minBy(V,function(z){return r(j,z)})}function _(N,j,A,M){var O=A.v,P=A.w;N.removeEdge(O,P),N.setEdge(M.v,M.w,{}),m(N),f(N,j),b(N,j)}function b(N,j){var A=e.find(N.nodes(),function(O){return!j.node(O).parent}),M=o(N,A);M=M.slice(1),e.forEach(M,function(O){var P=N.node(O).parent,D=j.edge(O,P),L=!1;D||(D=j.edge(P,O),L=!0),j.node(O).rank=j.node(P).rank+(L?D.minlen:-D.minlen)})}function S(N,j,A){return N.hasEdge(j,A)}function k(N,j,A){return A.low<=j.lim&&j.lim<=A.lim}return Xg}var Qg,CE;function o5(){if(CE)return Qg;CE=1;var e=Ru(),t=e.longestPath,r=Jj(),i=i5();Qg=o;function o(f){switch(f.graph().ranker){case"network-simplex":c(f);break;case"tight-tree":u(f);break;case"longest-path":l(f);break;default:c(f)}}var l=t;function u(f){t(f),r(f)}function c(f){i(f)}return Qg}var Zg,jE;function a5(){if(jE)return Zg;jE=1;var e=at();Zg=t;function t(o){var l=i(o);e.forEach(o.graph().dummyChains,function(u){for(var c=o.node(u),f=c.edgeObj,p=r(o,l,f.v,f.w),d=p.path,m=p.lca,y=0,w=d[y],E=!0;u!==f.w;){if(c=o.node(u),E){for(;(w=d[y])!==m&&o.node(w).maxRank<c.rank;)y++;w===m&&(E=!1)}if(!E){for(;y<d.length-1&&o.node(w=d[y+1]).minRank<=c.rank;)y++;w=d[y]}o.setParent(u,w),u=o.successors(u)[0]}})}function r(o,l,u,c){var f=[],p=[],d=Math.min(l[u].low,l[c].low),m=Math.max(l[u].lim,l[c].lim),y,w;y=u;do y=o.parent(y),f.push(y);while(y&&(l[y].low>d||m>l[y].lim));for(w=y,y=c;(y=o.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function i(o){var l={},u=0;function c(f){var p=u;e.forEach(o.children(f),c),l[f]={low:p,lim:u++}}return e.forEach(o.children(),c),l}return Zg}var Jg,TE;function l5(){if(TE)return Jg;TE=1;var e=at(),t=fn();Jg={run:r,cleanup:u};function r(c){var f=t.addDummyNode(c,"root",{},"_root"),p=o(c),d=e.max(e.values(p))-1,m=2*d+1;c.graph().nestingRoot=f,e.forEach(c.edges(),function(w){c.edge(w).minlen*=m});var y=l(c)+1;e.forEach(c.children(),function(w){i(c,f,m,y,d,p,w)}),c.graph().nodeRankFactor=m}function i(c,f,p,d,m,y,w){var E=c.children(w);if(!E.length){w!==f&&c.setEdge(f,w,{weight:0,minlen:p});return}var _=t.addBorderNode(c,"_bt"),b=t.addBorderNode(c,"_bb"),S=c.node(w);c.setParent(_,w),S.borderTop=_,c.setParent(b,w),S.borderBottom=b,e.forEach(E,function(k){i(c,f,p,d,m,y,k);var N=c.node(k),j=N.borderTop?N.borderTop:k,A=N.borderBottom?N.borderBottom:k,M=N.borderTop?d:2*d,O=j!==A?1:m-y[w]+1;c.setEdge(_,j,{weight:M,minlen:O,nestingEdge:!0}),c.setEdge(A,b,{weight:M,minlen:O,nestingEdge:!0})}),c.parent(w)||c.setEdge(f,_,{weight:0,minlen:m+y[w]})}function o(c){var f={};function p(d,m){var y=c.children(d);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),f[d]=m}return e.forEach(c.children(),function(d){p(d,1)}),f}function l(c){return e.reduce(c.edges(),function(f,p){return f+c.edge(p).weight},0)}function u(c){var f=c.graph();c.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(c.edges(),function(p){var d=c.edge(p);d.nestingEdge&&c.removeEdge(p)})}return Jg}var ev,RE;function u5(){if(RE)return ev;RE=1;var e=at(),t=fn();ev=r;function r(o){function l(u){var c=o.children(u),f=o.node(u);if(c.length&&e.forEach(c,l),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,d=f.maxRank+1;p<d;++p)i(o,"borderLeft","_bl",u,f,p),i(o,"borderRight","_br",u,f,p)}}e.forEach(o.children(),l)}function i(o,l,u,c,f,p){var d={width:0,height:0,rank:p,borderType:l},m=f[l][p-1],y=t.addDummyNode(o,"border",d,u);f[l][p]=y,o.setParent(y,c),m&&o.setEdge(m,y,{weight:1})}return ev}var tv,AE;function c5(){if(AE)return tv;AE=1;var e=at();tv={adjust:t,undo:r};function t(p){var d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(p)}function r(p){var d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&l(p),(d==="lr"||d==="rl")&&(c(p),i(p))}function i(p){e.forEach(p.nodes(),function(d){o(p.node(d))}),e.forEach(p.edges(),function(d){o(p.edge(d))})}function o(p){var d=p.width;p.width=p.height,p.height=d}function l(p){e.forEach(p.nodes(),function(d){u(p.node(d))}),e.forEach(p.edges(),function(d){var m=p.edge(d);e.forEach(m.points,u),e.has(m,"y")&&u(m)})}function u(p){p.y=-p.y}function c(p){e.forEach(p.nodes(),function(d){f(p.node(d))}),e.forEach(p.edges(),function(d){var m=p.edge(d);e.forEach(m.points,f),e.has(m,"x")&&f(m)})}function f(p){var d=p.x;p.x=p.y,p.y=d}return tv}var nv,IE;function d5(){if(IE)return nv;IE=1;var e=at();nv=t;function t(r){var i={},o=e.filter(r.nodes(),function(p){return!r.children(p).length}),l=e.max(e.map(o,function(p){return r.node(p).rank})),u=e.map(e.range(l+1),function(){return[]});function c(p){if(!e.has(i,p)){i[p]=!0;var d=r.node(p);u[d.rank].push(p),e.forEach(r.successors(p),c)}}var f=e.sortBy(o,function(p){return r.node(p).rank});return e.forEach(f,c),u}return nv}var rv,ME;function f5(){if(ME)return rv;ME=1;var e=at();rv=t;function t(i,o){for(var l=0,u=1;u<o.length;++u)l+=r(i,o[u-1],o[u]);return l}function r(i,o,l){for(var u=e.zipObject(l,e.map(l,function(y,w){return w})),c=e.flatten(e.map(o,function(y){return e.sortBy(e.map(i.outEdges(y),function(w){return{pos:u[w.w],weight:i.edge(w).weight}}),"pos")}),!0),f=1;f<l.length;)f<<=1;var p=2*f-1;f-=1;var d=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(c.forEach(function(y){var w=y.pos+f;d[w]+=y.weight;for(var E=0;w>0;)w%2&&(E+=d[w+1]),w=w-1>>1,d[w]+=y.weight;m+=y.weight*E})),m}return rv}var sv,OE;function h5(){if(OE)return sv;OE=1;var e=at();sv=t;function t(r,i){return e.map(i,function(o){var l=r.inEdges(o);if(l.length){var u=e.reduce(l,function(c,f){var p=r.edge(f),d=r.node(f.v);return{sum:c.sum+p.weight*d.order,weight:c.weight+p.weight}},{sum:0,weight:0});return{v:o,barycenter:u.sum/u.weight,weight:u.weight}}else return{v:o}})}return sv}var iv,PE;function p5(){if(PE)return iv;PE=1;var e=at();iv=t;function t(o,l){var u={};e.forEach(o,function(f,p){var d=u[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(d.barycenter=f.barycenter,d.weight=f.weight)}),e.forEach(l.edges(),function(f){var p=u[f.v],d=u[f.w];!e.isUndefined(p)&&!e.isUndefined(d)&&(d.indegree++,p.out.push(u[f.w]))});var c=e.filter(u,function(f){return!f.indegree});return r(c)}function r(o){var l=[];function u(p){return function(d){d.merged||(e.isUndefined(d.barycenter)||e.isUndefined(p.barycenter)||d.barycenter>=p.barycenter)&&i(p,d)}}function c(p){return function(d){d.in.push(p),--d.indegree===0&&o.push(d)}}for(;o.length;){var f=o.pop();l.push(f),e.forEach(f.in.reverse(),u(f)),e.forEach(f.out,c(f))}return e.map(e.filter(l,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function i(o,l){var u=0,c=0;o.weight&&(u+=o.barycenter*o.weight,c+=o.weight),l.weight&&(u+=l.barycenter*l.weight,c+=l.weight),o.vs=l.vs.concat(o.vs),o.barycenter=u/c,o.weight=c,o.i=Math.min(l.i,o.i),l.merged=!0}return iv}var ov,LE;function m5(){if(LE)return ov;LE=1;var e=at(),t=fn();ov=r;function r(l,u){var c=t.partition(l,function(_){return e.has(_,"barycenter")}),f=c.lhs,p=e.sortBy(c.rhs,function(_){return-_.i}),d=[],m=0,y=0,w=0;f.sort(o(!!u)),w=i(d,p,w),e.forEach(f,function(_){w+=_.vs.length,d.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,w=i(d,p,w)});var E={vs:e.flatten(d,!0)};return y&&(E.barycenter=m/y,E.weight=y),E}function i(l,u,c){for(var f;u.length&&(f=e.last(u)).i<=c;)u.pop(),l.push(f.vs),c++;return c}function o(l){return function(u,c){return u.barycenter<c.barycenter?-1:u.barycenter>c.barycenter?1:l?c.i-u.i:u.i-c.i}}return ov}var av,$E;function g5(){if($E)return av;$E=1;var e=at(),t=h5(),r=p5(),i=m5();av=o;function o(c,f,p,d){var m=c.children(f),y=c.node(f),w=y?y.borderLeft:void 0,E=y?y.borderRight:void 0,_={};w&&(m=e.filter(m,function(A){return A!==w&&A!==E}));var b=t(c,m);e.forEach(b,function(A){if(c.children(A.v).length){var M=o(c,A.v,p,d);_[A.v]=M,e.has(M,"barycenter")&&u(A,M)}});var S=r(b,p);l(S,_);var k=i(S,d);if(w&&(k.vs=e.flatten([w,k.vs,E],!0),c.predecessors(w).length)){var N=c.node(c.predecessors(w)[0]),j=c.node(c.predecessors(E)[0]);e.has(k,"barycenter")||(k.barycenter=0,k.weight=0),k.barycenter=(k.barycenter*k.weight+N.order+j.order)/(k.weight+2),k.weight+=2}return k}function l(c,f){e.forEach(c,function(p){p.vs=e.flatten(p.vs.map(function(d){return f[d]?f[d].vs:d}),!0)})}function u(c,f){e.isUndefined(c.barycenter)?(c.barycenter=f.barycenter,c.weight=f.weight):(c.barycenter=(c.barycenter*c.weight+f.barycenter*f.weight)/(c.weight+f.weight),c.weight+=f.weight)}return av}var lv,qE;function v5(){if(qE)return lv;qE=1;var e=at(),t=tr().Graph;lv=r;function r(o,l,u){var c=i(o),f=new t({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(p){return o.node(p)});return e.forEach(o.nodes(),function(p){var d=o.node(p),m=o.parent(p);(d.rank===l||d.minRank<=l&&l<=d.maxRank)&&(f.setNode(p),f.setParent(p,m||c),e.forEach(o[u](p),function(y){var w=y.v===p?y.w:y.v,E=f.edge(w,p),_=e.isUndefined(E)?0:E.weight;f.setEdge(w,p,{weight:o.edge(y).weight+_})}),e.has(d,"minRank")&&f.setNode(p,{borderLeft:d.borderLeft[l],borderRight:d.borderRight[l]}))}),f}function i(o){for(var l;o.hasNode(l=e.uniqueId("_root")););return l}return lv}var uv,DE;function y5(){if(DE)return uv;DE=1;var e=at();uv=t;function t(r,i,o){var l={},u;e.forEach(o,function(c){for(var f=r.parent(c),p,d;f;){if(p=r.parent(f),p?(d=l[p],l[p]=f):(d=u,u=f),d&&d!==f){i.setEdge(d,f);return}f=p}})}return uv}var cv,FE;function w5(){if(FE)return cv;FE=1;var e=at(),t=d5(),r=f5(),i=g5(),o=v5(),l=y5(),u=tr().Graph,c=fn();cv=f;function f(y){var w=c.maxRank(y),E=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),b=t(y);m(y,b);for(var S=Number.POSITIVE_INFINITY,k,N=0,j=0;j<4;++N,++j){d(N%2?E:_,N%4>=2),b=c.buildLayerMatrix(y);var A=r(y,b);A<S&&(j=0,k=e.cloneDeep(b),S=A)}m(y,k)}function p(y,w,E){return e.map(w,function(_){return o(y,_,E)})}function d(y,w){var E=new u;e.forEach(y,function(_){var b=_.graph().root,S=i(_,b,E,w);e.forEach(S.vs,function(k,N){_.node(k).order=N}),l(_,E,S.vs)})}function m(y,w){e.forEach(w,function(E){e.forEach(E,function(_,b){y.node(_).order=b})})}return cv}var dv,zE;function x5(){if(zE)return dv;zE=1;var e=at(),t=tr().Graph,r=fn();dv={positionX:E,findType1Conflicts:i,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function i(S,k){var N={};function j(A,M){var O=0,P=0,D=A.length,L=e.last(M);return e.forEach(M,function(U,V){var z=l(S,U),C=z?S.node(z).order:D;(z||U===L)&&(e.forEach(M.slice(P,V+1),function(F){e.forEach(S.predecessors(F),function($){var re=S.node($),J=re.order;(J<O||C<J)&&!(re.dummy&&S.node(F).dummy)&&u(N,$,F)})}),P=V+1,O=C)}),M}return e.reduce(k,j),N}function o(S,k){var N={};function j(M,O,P,D,L){var U;e.forEach(e.range(O,P),function(V){U=M[V],S.node(U).dummy&&e.forEach(S.predecessors(U),function(z){var C=S.node(z);C.dummy&&(C.order<D||C.order>L)&&u(N,z,U)})})}function A(M,O){var P=-1,D,L=0;return e.forEach(O,function(U,V){if(S.node(U).dummy==="border"){var z=S.predecessors(U);z.length&&(D=S.node(z[0]).order,j(O,L,V,P,D),L=V,P=D)}j(O,L,O.length,D,M.length)}),O}return e.reduce(k,A),N}function l(S,k){if(S.node(k).dummy)return e.find(S.predecessors(k),function(N){return S.node(N).dummy})}function u(S,k,N){if(k>N){var j=k;k=N,N=j}var A=S[k];A||(S[k]=A={}),A[N]=!0}function c(S,k,N){if(k>N){var j=k;k=N,N=j}return e.has(S[k],N)}function f(S,k,N,j){var A={},M={},O={};return e.forEach(k,function(P){e.forEach(P,function(D,L){A[D]=D,M[D]=D,O[D]=L})}),e.forEach(k,function(P){var D=-1;e.forEach(P,function(L){var U=j(L);if(U.length){U=e.sortBy(U,function($){return O[$]});for(var V=(U.length-1)/2,z=Math.floor(V),C=Math.ceil(V);z<=C;++z){var F=U[z];M[L]===L&&D<O[F]&&!c(N,L,F)&&(M[F]=L,M[L]=A[L]=A[F],D=O[F])}}})}),{root:A,align:M}}function p(S,k,N,j,A){var M={},O=d(S,k,N,A),P=A?"borderLeft":"borderRight";function D(V,z){for(var C=O.nodes(),F=C.pop(),$={};F;)$[F]?V(F):($[F]=!0,C.push(F),C=C.concat(z(F))),F=C.pop()}function L(V){M[V]=O.inEdges(V).reduce(function(z,C){return Math.max(z,M[C.v]+O.edge(C))},0)}function U(V){var z=O.outEdges(V).reduce(function(F,$){return Math.min(F,M[$.w]-O.edge($))},Number.POSITIVE_INFINITY),C=S.node(V);z!==Number.POSITIVE_INFINITY&&C.borderType!==P&&(M[V]=Math.max(M[V],z))}return D(L,O.predecessors.bind(O)),D(U,O.successors.bind(O)),e.forEach(j,function(V){M[V]=M[N[V]]}),M}function d(S,k,N,j){var A=new t,M=S.graph(),O=_(M.nodesep,M.edgesep,j);return e.forEach(k,function(P){var D;e.forEach(P,function(L){var U=N[L];if(A.setNode(U),D){var V=N[D],z=A.edge(V,U);A.setEdge(V,U,Math.max(O(S,L,D),z||0))}D=L})}),A}function m(S,k){return e.minBy(e.values(k),function(N){var j=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY;return e.forIn(N,function(M,O){var P=b(S,O)/2;j=Math.max(M+P,j),A=Math.min(M-P,A)}),j-A})}function y(S,k){var N=e.values(k),j=e.min(N),A=e.max(N);e.forEach(["u","d"],function(M){e.forEach(["l","r"],function(O){var P=M+O,D=S[P],L;if(D!==k){var U=e.values(D);L=O==="l"?j-e.min(U):A-e.max(U),L&&(S[P]=e.mapValues(D,function(V){return V+L}))}})})}function w(S,k){return e.mapValues(S.ul,function(N,j){if(k)return S[k.toLowerCase()][j];var A=e.sortBy(e.map(S,j));return(A[1]+A[2])/2})}function E(S){var k=r.buildLayerMatrix(S),N=e.merge(i(S,k),o(S,k)),j={},A;e.forEach(["u","d"],function(O){A=O==="u"?k:e.values(k).reverse(),e.forEach(["l","r"],function(P){P==="r"&&(A=e.map(A,function(V){return e.values(V).reverse()}));var D=(O==="u"?S.predecessors:S.successors).bind(S),L=f(S,A,N,D),U=p(S,A,L.root,L.align,P==="r");P==="r"&&(U=e.mapValues(U,function(V){return-V})),j[O+P]=U})});var M=m(S,j);return y(j,M),w(j,S.graph().align)}function _(S,k,N){return function(j,A,M){var O=j.node(A),P=j.node(M),D=0,L;if(D+=O.width/2,e.has(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":L=-O.width/2;break;case"r":L=O.width/2;break}if(L&&(D+=N?L:-L),L=0,D+=(O.dummy?k:S)/2,D+=(P.dummy?k:S)/2,D+=P.width/2,e.has(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":L=P.width/2;break;case"r":L=-P.width/2;break}return L&&(D+=N?L:-L),L=0,D}}function b(S,k){return S.node(k).width}return dv}var fv,BE;function _5(){if(BE)return fv;BE=1;var e=at(),t=fn(),r=x5().positionX;fv=i;function i(l){l=t.asNonCompoundGraph(l),o(l),e.forEach(r(l),function(u,c){l.node(c).x=u})}function o(l){var u=t.buildLayerMatrix(l),c=l.graph().ranksep,f=0;e.forEach(u,function(p){var d=e.max(e.map(p,function(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=f+d/2}),f+=d+c})}return fv}var hv,UE;function b5(){if(UE)return hv;UE=1;var e=at(),t=r5(),r=s5(),i=o5(),o=fn().normalizeRanks,l=a5(),u=fn().removeEmptyRanks,c=l5(),f=u5(),p=c5(),d=w5(),m=_5(),y=fn(),w=tr().Graph;hv=E;function E(q,Q){var ne=Q&&Q.debugTiming?y.time:y.notime;ne("layout",function(){var ae=ne(" buildLayoutGraph",function(){return D(q)});ne(" runLayout",function(){_(ae,ne)}),ne(" updateInputGraph",function(){b(q,ae)})})}function _(q,Q){Q(" makeSpaceForEdgeLabels",function(){L(q)}),Q(" removeSelfEdges",function(){W(q)}),Q(" acyclic",function(){t.run(q)}),Q(" nestingGraph.run",function(){c.run(q)}),Q(" rank",function(){i(y.asNonCompoundGraph(q))}),Q(" injectEdgeLabelProxies",function(){U(q)}),Q(" removeEmptyRanks",function(){u(q)}),Q(" nestingGraph.cleanup",function(){c.cleanup(q)}),Q(" normalizeRanks",function(){o(q)}),Q(" assignRankMinMax",function(){V(q)}),Q(" removeEdgeLabelProxies",function(){z(q)}),Q(" normalize.run",function(){r.run(q)}),Q(" parentDummyChains",function(){l(q)}),Q(" addBorderSegments",function(){f(q)}),Q(" order",function(){d(q)}),Q(" insertSelfEdges",function(){Z(q)}),Q(" adjustCoordinateSystem",function(){p.adjust(q)}),Q(" position",function(){m(q)}),Q(" positionSelfEdges",function(){I(q)}),Q(" removeBorderNodes",function(){J(q)}),Q(" normalize.undo",function(){r.undo(q)}),Q(" fixupEdgeLabelCoords",function(){$(q)}),Q(" undoCoordinateSystem",function(){p.undo(q)}),Q(" translateGraph",function(){C(q)}),Q(" assignNodeIntersects",function(){F(q)}),Q(" reversePoints",function(){re(q)}),Q(" acyclic.undo",function(){t.undo(q)})}function b(q,Q){e.forEach(q.nodes(),function(ne){var ae=q.node(ne),fe=Q.node(ne);ae&&(ae.x=fe.x,ae.y=fe.y,Q.children(ne).length&&(ae.width=fe.width,ae.height=fe.height))}),e.forEach(q.edges(),function(ne){var ae=q.edge(ne),fe=Q.edge(ne);ae.points=fe.points,e.has(fe,"x")&&(ae.x=fe.x,ae.y=fe.y)}),q.graph().width=Q.graph().width,q.graph().height=Q.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],k={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},N=["acyclicer","ranker","rankdir","align"],j=["width","height"],A={width:0,height:0},M=["minlen","weight","width","height","labeloffset"],O={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},P=["labelpos"];function D(q){var Q=new w({multigraph:!0,compound:!0}),ne=K(q.graph());return Q.setGraph(e.merge({},k,G(ne,S),e.pick(ne,N))),e.forEach(q.nodes(),function(ae){var fe=K(q.node(ae));Q.setNode(ae,e.defaults(G(fe,j),A)),Q.setParent(ae,q.parent(ae))}),e.forEach(q.edges(),function(ae){var fe=K(q.edge(ae));Q.setEdge(ae,e.merge({},O,G(fe,M),e.pick(fe,P)))}),Q}function L(q){var Q=q.graph();Q.ranksep/=2,e.forEach(q.edges(),function(ne){var ae=q.edge(ne);ae.minlen*=2,ae.labelpos.toLowerCase()!=="c"&&(Q.rankdir==="TB"||Q.rankdir==="BT"?ae.width+=ae.labeloffset:ae.height+=ae.labeloffset)})}function U(q){e.forEach(q.edges(),function(Q){var ne=q.edge(Q);if(ne.width&&ne.height){var ae=q.node(Q.v),fe=q.node(Q.w),te={rank:(fe.rank-ae.rank)/2+ae.rank,e:Q};y.addDummyNode(q,"edge-proxy",te,"_ep")}})}function V(q){var Q=0;e.forEach(q.nodes(),function(ne){var ae=q.node(ne);ae.borderTop&&(ae.minRank=q.node(ae.borderTop).rank,ae.maxRank=q.node(ae.borderBottom).rank,Q=e.max(Q,ae.maxRank))}),q.graph().maxRank=Q}function z(q){e.forEach(q.nodes(),function(Q){var ne=q.node(Q);ne.dummy==="edge-proxy"&&(q.edge(ne.e).labelRank=ne.rank,q.removeNode(Q))})}function C(q){var Q=Number.POSITIVE_INFINITY,ne=0,ae=Number.POSITIVE_INFINITY,fe=0,te=q.graph(),ce=te.marginx||0,Ce=te.marginy||0;function ve(Re){var ye=Re.x,Ee=Re.y,Ye=Re.width,we=Re.height;Q=Math.min(Q,ye-Ye/2),ne=Math.max(ne,ye+Ye/2),ae=Math.min(ae,Ee-we/2),fe=Math.max(fe,Ee+we/2)}e.forEach(q.nodes(),function(Re){ve(q.node(Re))}),e.forEach(q.edges(),function(Re){var ye=q.edge(Re);e.has(ye,"x")&&ve(ye)}),Q-=ce,ae-=Ce,e.forEach(q.nodes(),function(Re){var ye=q.node(Re);ye.x-=Q,ye.y-=ae}),e.forEach(q.edges(),function(Re){var ye=q.edge(Re);e.forEach(ye.points,function(Ee){Ee.x-=Q,Ee.y-=ae}),e.has(ye,"x")&&(ye.x-=Q),e.has(ye,"y")&&(ye.y-=ae)}),te.width=ne-Q+ce,te.height=fe-ae+Ce}function F(q){e.forEach(q.edges(),function(Q){var ne=q.edge(Q),ae=q.node(Q.v),fe=q.node(Q.w),te,ce;ne.points?(te=ne.points[0],ce=ne.points[ne.points.length-1]):(ne.points=[],te=fe,ce=ae),ne.points.unshift(y.intersectRect(ae,te)),ne.points.push(y.intersectRect(fe,ce))})}function $(q){e.forEach(q.edges(),function(Q){var ne=q.edge(Q);if(e.has(ne,"x"))switch((ne.labelpos==="l"||ne.labelpos==="r")&&(ne.width-=ne.labeloffset),ne.labelpos){case"l":ne.x-=ne.width/2+ne.labeloffset;break;case"r":ne.x+=ne.width/2+ne.labeloffset;break}})}function re(q){e.forEach(q.edges(),function(Q){var ne=q.edge(Q);ne.reversed&&ne.points.reverse()})}function J(q){e.forEach(q.nodes(),function(Q){if(q.children(Q).length){var ne=q.node(Q),ae=q.node(ne.borderTop),fe=q.node(ne.borderBottom),te=q.node(e.last(ne.borderLeft)),ce=q.node(e.last(ne.borderRight));ne.width=Math.abs(ce.x-te.x),ne.height=Math.abs(fe.y-ae.y),ne.x=te.x+ne.width/2,ne.y=ae.y+ne.height/2}}),e.forEach(q.nodes(),function(Q){q.node(Q).dummy==="border"&&q.removeNode(Q)})}function W(q){e.forEach(q.edges(),function(Q){if(Q.v===Q.w){var ne=q.node(Q.v);ne.selfEdges||(ne.selfEdges=[]),ne.selfEdges.push({e:Q,label:q.edge(Q)}),q.removeEdge(Q)}})}function Z(q){var Q=y.buildLayerMatrix(q);e.forEach(Q,function(ne){var ae=0;e.forEach(ne,function(fe,te){var ce=q.node(fe);ce.order=te+ae,e.forEach(ce.selfEdges,function(Ce){y.addDummyNode(q,"selfedge",{width:Ce.label.width,height:Ce.label.height,rank:ce.rank,order:te+ ++ae,e:Ce.e,label:Ce.label},"_se")}),delete ce.selfEdges})})}function I(q){e.forEach(q.nodes(),function(Q){var ne=q.node(Q);if(ne.dummy==="selfedge"){var ae=q.node(ne.e.v),fe=ae.x+ae.width/2,te=ae.y,ce=ne.x-fe,Ce=ae.height/2;q.setEdge(ne.e,ne.label),q.removeNode(Q),ne.label.points=[{x:fe+2*ce/3,y:te-Ce},{x:fe+5*ce/6,y:te-Ce},{x:fe+ce,y:te},{x:fe+5*ce/6,y:te+Ce},{x:fe+2*ce/3,y:te+Ce}],ne.label.x=ne.x,ne.label.y=ne.y}})}function G(q,Q){return e.mapValues(e.pick(q,Q),Number)}function K(q){var Q={};return e.forEach(q,function(ne,ae){Q[ae.toLowerCase()]=ne}),Q}return hv}var pv,HE;function S5(){if(HE)return pv;HE=1;var e=at(),t=fn(),r=tr().Graph;pv={debugOrdering:i};function i(o){var l=t.buildLayerMatrix(o),u=new r({compound:!0,multigraph:!0}).setGraph({});return e.forEach(o.nodes(),function(c){u.setNode(c,{label:c}),u.setParent(c,"layer"+o.node(c).rank)}),e.forEach(o.edges(),function(c){u.setEdge(c.v,c.w,{},c.name)}),e.forEach(l,function(c,f){var p="layer"+f;u.setNode(p,{rank:"same"}),e.reduce(c,function(d,m){return u.setEdge(d,m,{style:"invis"}),m})}),u}return pv}var mv,WE;function k5(){return WE||(WE=1,mv="0.8.5"),mv}var gv,VE;function E5(){return VE||(VE=1,gv={graphlib:tr(),layout:b5(),debug:S5(),util:{time:fn().time,notime:fn().notime},version:k5()}),gv}var N5=E5();const GE=Hv(N5),yo=240,Au=130,co=74,sc=72,YE=co+sc;function C5(e,t){var i;let r=yo;for(const o of e)r=Math.max(r,((i=t.get(o.id))==null?void 0:i.width)??yo);return r}const eT=420,j5=2;function Ca(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function T5(e,t){return((t==null?void 0:t.get(e))??0)>0?eT:0}function R5(e,t){const r=(t==null?void 0:t.get(e))??0;return r>0?6+r*36:0}function ja(e,t,r){const i=t.get(e);return{w:((i==null?void 0:i.width)??yo)+T5(e,r),h:Math.max((i==null?void 0:i.height)??Au,R5(e,r))}}function A5(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function I5(e,t,r,i,o,l){const u=new GE.graphlib.Graph;u.setDefaultEdgeLabel(()=>({})),u.setGraph({rankdir:r,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const c=e.filter(S=>!o.has(S)),f=new Set(c);for(const S of c){const{w:k,h:N}=ja(S,i,l);u.setNode(S,{width:k,height:N})}for(const S of t)f.has(S.source)&&f.has(S.target)&&u.setEdge(S.source,S.target);GE.layout(u);const p=new Map;let d=1/0,m=1/0,y=-1/0,w=-1/0;for(const S of c){const k=u.node(S);if(!k)continue;const N=i.get(S),j=(N==null?void 0:N.width)??yo,A=(N==null?void 0:N.height)??Au,M=ja(S,i,l),O=k.x-M.w/2,P=k.y-M.h/2;p.set(S,{x:O,y:P}),O<d&&(d=O),P<m&&(m=P),O+j>y&&(y=O+j),P+A>w&&(w=P+A)}if(Number.isFinite(d)&&Number.isFinite(m))for(const[S,k]of p)p.set(S,{x:k.x-d,y:k.y-m});const E=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-m:0;let b=null;for(const S of e){const k=o.get(S);if(!k)continue;const N=i.get(S),j=(N==null?void 0:N.width)??yo,A=(N==null?void 0:N.height)??Au;b=b===null?{minX:k.x,minY:k.y,maxX:k.x+j,maxY:k.y+A}:{minX:Math.min(b.minX,k.x),minY:Math.min(b.minY,k.y),maxX:Math.max(b.maxX,k.x+j),maxY:Math.max(b.maxY,k.y+A)}}return{positions:p,width:E,height:_,pinnedBox:b}}function M5(e,t,r={}){const i=r.direction??"LR",o=r.pinned??new Map,l=r.measured??new Map,u=r.lanes,c=new Map;for(const S of e){const k=Ca(S),N=c.get(k);N?N.push(S.id):c.set(k,[S.id])}const p=Array.from(c.keys()).sort().map(S=>({sid:S,...I5(c.get(S),t,i,l,o,u)})),d=C5(e,l),m=r.availableHeight&&r.availableHeight>0?r.availableHeight:Number.POSITIVE_INFINITY,y=S=>{const k=[[]];let N=0;for(const j of p)k.length<S&&N>0&&N+j.height>m&&(k.push([]),N=0),k[k.length-1].push(j),N+=j.height+YE;return k},w=S=>S.reduce((k,N)=>Math.max(k,N.width),0)+eT;let E=y(r.availableWidth?j5:1);E.length>1&&E.reduce((k,N)=>k+w(N),0)+d*(E.length-1)>(r.availableWidth??0)&&(E=y(1));const _=new Map;let b=0;for(const S of E){const k=w(S);let N=0;for(const{positions:j,height:A,pinnedBox:M}of S){for(const[P,D]of j)_.set(P,{x:D.x+b,y:D.y+N});let O=N+A;M&&M.maxY>O&&M.minX<b+k&&b<M.maxX&&(O=M.maxY),N=O+YE}b+=k+d}return e.map(S=>{const k=o.get(S.id);if(k)return{...S,position:k};const N=_.get(S.id);return N?{...S,position:N}:S})}function O5(e,t,r,i,o){const u=co+sc,c=60,f=w=>ja(w,i,o),p=new Map(e.map(w=>[w.id,Ca(w)])),d=[],m=e.map(w=>({id:w.id,pos:r.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,E)=>w.pos.y-E.pos.y||w.pos.x-E.pos.x||w.id.localeCompare(E.id)),y=[];for(const{id:w,pos:E}of m){const{w:_,h:b}=f(w),S=p.get(w)??"_default";if(r.has(w)){d.push({x:E.x,y:E.y,w:_,h:b,sid:S});continue}let k=E.y;for(let N=0;N<d.length+1;N++){const j=d.find(A=>{const M=A.sid===S?24:c,O=A.sid===S?24:u;return E.x<A.x+A.w+M&&A.x<E.x+_+M&&k<A.y+A.h+O&&A.y<k+b+O});if(!j)break;k=j.y+j.h+(j.sid===S?24:u)}k!==E.y&&(t.set(w,{x:E.x,y:k}),y.push(w)),d.push({x:E.x,y:k,w:_,h:b,sid:S})}return y}function P5(e,t,r,i,o,l){const u=_=>ja(_,i,l),c=_=>r.get(_)??t.get(_),f=new Map;for(const _ of e){if(!c(_.id))continue;const b=Ca(_),S=f.get(b);S?S.push(_):f.set(b,[_])}const p=new Set;for(const[_,b]of f)b.every(S=>o.has(S.id)&&!r.has(S.id))&&p.add(_);const d=new Map,m=[];for(const _ of e){const b=c(_.id);if(!b)continue;const{w:S,h:k}=u(_.id),N=Ca(_);p.has(N)?(d.get(N)??d.set(N,[]).get(N)).push(_):m.push({x:b.x,y:b.y,w:S,h:k})}if(d.size===0)return[];const y=co+sc,w=(_,b,S,k)=>m.some(N=>_<N.x+N.w+co&&N.x<_+S+co&&b<N.y+N.h+y&&N.y<b+k+y),E=[];for(const _ of[...d.keys()].sort()){const b=d.get(_);let S=1/0,k=1/0,N=-1/0,j=-1/0;for(const U of b){const V=c(U.id),{w:z,h:C}=u(U.id);S=Math.min(S,V.x),k=Math.min(k,V.y),N=Math.max(N,V.x+z),j=Math.max(j,V.y+C)}const A=N-S,M=j-k,O=[...new Set(m.map(U=>Math.round(U.x)))].sort((U,V)=>U-V),P=O.length?O:[S],D=[0,...m.map(U=>U.y+U.h+y)].sort((U,V)=>U-V);let L=null;e:for(const U of P)for(const V of D){if(V>=k)break;if(!w(U,V,A,M)){L={x:U,y:V};break e}}if(L){const U=L.x-S,V=L.y-k;for(const z of b){const C=c(z.id);t.set(z.id,{x:C.x+U,y:C.y+V})}E.push(_)}for(const U of b){const V=c(U.id),{w:z,h:C}=u(U.id);m.push({x:V.x,y:V.y,w:z,h:C})}}return E}function L5(e,t,r,i,o,l=!1,u){const p=co+sc+1,d=8,m=1.75,y=200,w=.7,E=.01,_=L=>ja(L,i,u),b=L=>r.get(L)??t.get(L),S=new Map;for(const L of e){if(!b(L.id))continue;const U=Ca(L),V=S.get(U);V?V.push(L):S.set(U,[L])}const k=[],N=new Set,j=new Set,A=o.size===0;for(const L of[...S.keys()].sort()){const U=S.get(L);let V=1/0,z=1/0,C=-1/0,F=-1/0,$=!1;for(const Z of U){const I=b(Z.id),{w:G,h:K}=_(Z.id);V=Math.min(V,I.x),z=Math.min(z,I.y),C=Math.max(C,I.x+G),F=Math.max(F,I.y+K),r.has(Z.id)&&($=!0)}const re=C-V,J=F-z;j.add(L);const W=o.get(L);W&&(re>W.w+d||J>W.h+d)&&N.add(L),o.set(L,{w:re,h:J}),k.push({sid:L,members:U.map(Z=>Z.id),x:V,y:z,w:re,h:J,anchored:$,mass:1})}for(const L of[...o.keys()])j.has(L)||o.delete(L);if(l||A)return[];let M=!1;for(let L=0;L<k.length&&!M;L++)for(let U=L+1;U<k.length;U++){const V=k[L],z=k[U];if(!(V.anchored&&z.anchored)&&Math.abs(V.x+V.w/2-(z.x+z.w/2))<(V.w+z.w)/2+61&&Math.abs(V.y+V.h/2-(z.y+z.h/2))<(V.h+z.h)/2+p){M=!0;break}}if(N.size===0&&!M)return[];if(N.size>0)for(const L of k)N.has(L.sid)&&(L.mass=8);else for(const L of k)L.mass=Math.max(1,L.w*L.h/(yo*Au));const O=new Map(k.map(L=>[L.sid,L.x])),P=new Map(k.map(L=>[L.sid,L.y]));for(let L=0;L<y;L++){const U=new Map,V=new Map;let z=0;for(let C=0;C<k.length;C++)for(let F=C+1;F<k.length;F++){const $=k[C],re=k[F];if($.anchored&&re.anchored)continue;const J=$.x+$.w/2,W=$.y+$.h/2,Z=re.x+re.w/2,I=re.y+re.h/2,G=($.w+re.w)/2+61-Math.abs(J-Z),K=($.h+re.h)/2+p-Math.abs(W-I);if(G<=0||K<=0)continue;const q=(De,Je)=>!De.anchored&&!(Je<0&&De.x<=0),Q=(De,Je)=>!De.anchored&&!(Je<0&&De.y<=0),ne=(De,Je,Xe)=>{const Ot=De===Je,lt=Ot?$.sid<re.sid?-1:1:Math.sign(De-Je);return Xe($,lt)||Xe(re,-lt)?lt:Ot&&(Xe($,-lt)||Xe(re,lt))?-lt:0},ae=ne(J,Z,q),fe=ne(W,I,Q),te=ae!==0,ce=fe!==0;if(!te&&!ce)continue;const Ce=te&&(!ce||G*m<K),[ve,Re,ye,Ee]=Ce?[ae,G,U,q]:[fe,K,V,Q],Ye=Ee($,ve),we=Ee(re,-ve),_e=$.mass,Be=re.mass,it=Ye?we?Be/(_e+Be):1:0,ft=we?Ye?_e/(_e+Be):1:0,Ze=Re*w;ye.set($.sid,(ye.get($.sid)??0)+ve*Ze*it),ye.set(re.sid,(ye.get(re.sid)??0)-ve*Ze*ft),z+=Ze}for(const C of k)C.anchored||(C.x=Math.max(0,C.x+(U.get(C.sid)??0)),C.y=Math.max(0,C.y+(V.get(C.sid)??0)));if(z<E)break}const D=[];for(const L of k){const U=L.x-O.get(L.sid),V=L.y-P.get(L.sid);if(!(Math.abs(U)<1&&Math.abs(V)<1)){for(const z of L.members){if(r.has(z))continue;const C=t.get(z);C&&t.set(z,{x:C.x+U,y:C.y+V})}D.push(L.sid)}}return D}const $5=600;function Fv(e,t){return!(e.exitAt!=null&&t-e.exitAt>$5||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function q5(e,t){const r=new Set;for(const i of e.agents.values())Fv(i,t)&&r.add(i.id);return r}function D5(e,t,r=0){return e.right+r>t.left&&e.left-r<t.right&&e.bottom+r>t.top&&e.top-r<t.bottom}function F5(e,t,r=0){if(!e)return!1;for(const i of t)if(D5(e,i,r))return!0;return!1}const tT="sessionGroup";function z5(e,t){var i;if(e.type===tT)return"transparent";const r=(i=e.data)==null?void 0:i.state;return t(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const B5="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1).";function U5(e){if(e.checkDisabled)return B5;if(e.checking)return"Asking npm for the newest release…";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",r=e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${r} · re-checked periodically · click to check npm now`}function H5(e){const t=`Version v${e.running}`;return e.checkDisabled?`${t}, update checks are off`:e.checking?`${t}, checking npm for a newer release`:`${t}, check npm for a newer release`}function W5(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`;return`Version v${e.from}, ${t} — ${e.open?"hide":"show"} the notice`}function V5(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 zv={kind:"assumed",claude:!0,codex:!0};function G5(e){if(!e||typeof e!="object")return zv;const t=e.providers;if(!t||typeof t!="object")return zv;const r=t;return{kind:"reported",claude:r.claude!==!1,codex:r.codex!==!1}}function nT(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}function Y5(e){return e.connected?e.paused?{tone:"paused",label:"paused",title:e.held>0?`Connected — ${nT(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",label:"live",title:"Receiving events"}:{tone:"dead",label:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function K5(e){return e.paused?e.held<=0?{label:"Resume",title:"Nothing has arrived since you paused. Resume to follow the canvas again (Space)"}:{label:`Resume · ${e.held} held`,title:`${nT(e.held)} arrived while paused and will be applied in order when you resume (Space)`}:{label:"Pause",title:"Pause live updates — events keep arriving and are applied when you resume (Space)"}}function rT(e,t){return e!==""&&t>0}function X5(e,t,r){return e===""?{active:!1,matched:t,total:r,count:null,empty:!1,message:null,dim:!1}:{active:!0,matched:t,total:r,count:`${t} of ${r}`,empty:t===0,message:t===0?`No agents match “${e}”`:null,dim:rT(e,t)}}const Q5="Search agents, tools, model…";function sT(e,t){var i,o,l,u;if(!t)return!0;const r=t.toLowerCase();if(e.label.toLowerCase().includes(r)||(i=e.cwd)!=null&&i.toLowerCase().includes(r)||(o=e.cwdBasename)!=null&&o.toLowerCase().includes(r)||e.sessionId.toLowerCase().includes(r)||(l=e.firstPrompt)!=null&&l.toLowerCase().includes(r)||e.model&&(e.model.toLowerCase().includes(r)||Rs(e.model).toLowerCase().includes(r))||(u=e.provider)!=null&&u.toLowerCase().startsWith(r))return!0;for(const c of e.tools)if(c.name.toLowerCase().includes(r))return!0;return!1}function fa(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const Z5={agent:wL,sessionGroup:AL},iT="react-flow__node";function KE(e){var t,r;return!!e&&((r=(t=e.classList)==null?void 0:t.contains)==null?void 0:r.call(t,iT))===!0}function J5(e){try{const t=document.querySelector(`.${iT}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const eF=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),tF=420,cu=18,nF=200,rF=5*6e4,sF=6,iF=2*6e4,My="agent-dag.layout",Oy="agent-dag.viewport",oT="agent-dag.summariesDismissed",aT="agent-dag.sessionListOpen",lT="agent-dag.detailOpen",uT="agent-dag.usagePanelOpen",XE="agent-dag.accountsPanelOpen",QE="agent-dag.versionNoticeDismissed",ZE="agent-dag.oldNameNoticeDismissed",oF=15*6e4,vv={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:"},JE="agent-dag.autoRestart",eN="agent-dag.bundleReloadedFor";function aF(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(aT)==="1"}catch{return!1}}function lF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(aT,e?"1":"0")}catch{}}function uF(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(lT)==="1"}catch{return!1}}function cF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(lT,e?"1":"0")}catch{}}function dF(){const e=QC(uT);return e===null?!0:e==="1"}function fF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(uT,e?"1":"0")}catch{}}function hF(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(oT);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(r=>typeof r=="string"):[])}catch{return new Set}}function tN(e){if(!(typeof window>"u"))try{const t=Array.from(e),r=t.length>200?t.slice(-200):t;window.localStorage.setItem(oT,JSON.stringify(r))}catch{}}function pF(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(My);if(!t)return e;const r=JSON.parse(t);if(!("v"in r)){const o=Object.entries(r).filter(([,l])=>l&&typeof l.x=="number"&&typeof l.y=="number");return{positions:o,pins:o.map(([l])=>l)}}return{positions:Object.entries(r.positions??{}).filter(([,o])=>o&&typeof o.x=="number"&&typeof o.y=="number"),pins:Array.isArray(r.pins)?r.pins:[]}}catch{return e}}function yv(e,t){if(!(typeof window>"u"))try{const r={};for(const[i,o]of e)r[i]=o;for(const[i,o]of t)r[i]=o;window.localStorage.setItem(My,JSON.stringify({v:2,positions:r,pins:Array.from(t.keys())}))}catch{}}function mF(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Oy);if(!e)return null;const t=JSON.parse(e);return typeof(t==null?void 0:t.x)!="number"||typeof(t==null?void 0:t.y)!="number"||typeof(t==null?void 0:t.zoom)!="number"?null:t}catch{return null}}function gF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Oy,JSON.stringify(e))}catch{}}function nN(){if(!(typeof window>"u")){try{window.localStorage.removeItem(My)}catch{}try{window.localStorage.removeItem(Oy)}catch{}}}function vF(e,t){const r=e.agents.get(t);if(!r)return;const i=[];for(const d of e.agents.values())d.sessionId===t&&i.push(d);const o={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:i.map(d=>({id:d.id,kind:d.kind,label:d.label,parentId:d.parentId,state:d.state,startedAt:d.startedAt,endedAt:d.endedAt,model:d.model,cwd:d.cwd,usage:d.usage,prompts:d.prompts,tools:d.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}))}))},l=JSON.stringify(o,null,2),u=new Blob([l],{type:"application/json"}),c=URL.createObjectURL(u),f=document.createElement("a"),p=(r.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=c,f.download=`${Gt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const Bv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Uv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},cT=FC;function yF(e,t){if(!t)return null;const r=new Set([t]);let i=t;for(;i;){const l=e.agents.get(i);if(!(l!=null&&l.parentId)||r.has(l.parentId))break;r.add(l.parentId),i=l.parentId}let o=!0;for(;o;){o=!1;for(const l of e.agents.values())l.parentId&&r.has(l.parentId)&&!r.has(l.id)&&(r.add(l.id),o=!0)}return r}function wF(e,t,r,i,o,l,u,c,f,p,d,m,y,w,E,_,b,S,k){const N=[],j=[],A=new Set;if(l)for(const z of e.agents.values())S.has(z.id)&&sT(z,l)&&A.add(z.id);const M=rT(l,A.size);for(const z of e.agents.values()){if(!S.has(z.id))continue;const C=M&&!A.has(z.id),F=z.exitAt!=null,$=b!=null&&!b.has(z.id),re=[C?"rf-dim":"",F?"rf-exiting":"",$?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,J=u.get(z.id);if(N.push({id:z.id,type:"agent",position:{x:0,y:0},data:{...z,now:t,onOpenContext:k},className:re,...J?{width:J.width,height:J.height}:null}),z.parentId&&S.has(z.parentId)){const W=ly(z.sessionId),Z=l&&!A.has(z.id)&&!A.has(z.parentId),I=F,G=_.size>0&&(_.has(z.id)||_.has(z.parentId)),K=b!=null&&!b.has(z.id)&&!b.has(z.parentId),q=z.state==="active"?2:1.5,Q=G?q+1.5:q,ne=Z||I?.2:K?.12:1,ae=["sess-edge",z.state==="active"?"sess-live":"sess-idle",I?"rf-edge-exiting":"",G?"rf-edge-selected":""].filter(Boolean).join(" ");j.push({id:`e:${z.parentId}->${z.id}`,source:z.parentId,target:z.id,animated:(z.state==="active"||G)&&!Z&&!I,type:"smoothstep",style:{"--session-hue":W,strokeWidth:Q,opacity:ne,transition:"var(--edge-transition)"},className:ae})}}const O=new Map;for(const z of e.agents.values())z.tools.length>0&&O.set(z.id,Math.min(4,z.tools.length));const P=`${w}#lanes:${A5(O)}`,D=N.filter(z=>M$(z.id,o,m,y));if(D.length>0||P!==E.current){if(D.length>0){const z=M5(N,j,{direction:"LR",pinned:o,measured:u,availableWidth:r,availableHeight:i,lanes:O});for(const C of z)XC(C.id,m,y)&&P$(C.id,C.position,m,y);P5(N,m,o,u,new Set(D.map(C=>C.id)),O)}O5(N,m,o,u,O),E.current=P}const L=L5(N,m,o,u,c,!p||d,O);L.length>0&&f(L),ou(m,e.agents),ou(y,e.agents),ou(o,e.agents),ou(u,I$(e.agents.values()));const U=[];let V=!1;for(const z of N){let C=o.get(z.id)??m.get(z.id);C||(C=O$(z.id,m,y),V=!0),U.push({...z,position:C})}return V&&(E.current=""),{nodes:U,edges:j}}function xF(){return g.jsx(ay,{children:g.jsx(_F,{})})}function _F(){var Ka,Xa,Qa,Za;const e=Ma(),t=R.useRef(Pv()),[,r]=R.useState(0),i=R.useCallback(()=>r(H=>H+1),[]),[o,l]=R.useState(()=>new Set),[u,c]=R.useState(null),[f,p]=R.useState(null),d=R.useCallback((H,Y)=>{l(oe=>{if(!Y)return new Set([H]);const de=new Set(oe);return de.has(H)?de.delete(H):de.add(H),de}),c(oe=>Y&&oe===H?oe:H)},[]),m=R.useCallback(()=>{l(new Set),c(null)},[]),[y,w]=R.useState(null),[E,_]=R.useState(null),b=R.useCallback(H=>_(H),[]),[S,k]=R.useState(!1),N=R.useRef(hF()),[j,A]=R.useState(aF);R.useEffect(()=>{lF(j)},[j]);const[M,O]=R.useState(uF);R.useEffect(()=>{cF(M)},[M]);const[P,D]=R.useState(dF);R.useEffect(()=>{fF(P)},[P]);const[L,U]=R.useState(()=>{try{const H=window.localStorage.getItem(XE);return H===null?!0:H==="1"}catch{return!0}});R.useEffect(()=>{try{window.localStorage.setItem(XE,L?"1":"0")}catch{}},[L]);const[V,z]=R.useState(null),[C,F]=R.useState(!1),[$,re]=R.useState(0),[J,W]=R.useState(0);R.useEffect(()=>{fetch("/api/sound-hook").then(H=>H.ok?H.json():null).then(H=>{H!=null&&H.ok&&(z(H.enabled===!0),re((H.foreign??[]).filter(Y=>Y.worksHere).length),W(typeof H.parked=="number"?H.parked:0))}).catch(()=>{})},[]);const Z=R.useCallback(async()=>{F(!0);try{const Y=await(await fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!V})})).json().catch(()=>null);Y!=null&&Y.ok&&z(Y.enabled===!0),fetch("/api/sound-hook").then(oe=>oe.ok?oe.json():null).then(oe=>{oe!=null&&oe.ok&&(re((oe.foreign??[]).filter(de=>de.worksHere).length),W(typeof oe.parked=="number"?oe.parked:0))}).catch(()=>{})}catch{}finally{F(!1)}},[V]),[I,G]=R.useState(!1),[K,q]=R.useState(null),[Q,ne]=R.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(QE)??""}catch{return""}}),[ae,fe]=R.useState(!1),te=R.useRef(0),[ce,Ce]=R.useState(!1),ve=R.useCallback((H=!1)=>{H&&(te.current=Date.now(),Ce(!0)),fetch(H?"/api/version?refresh=1":"/api/version").then(Y=>Y.ok?Y.json():null).then(Y=>{Y&&q(Y)}).catch(()=>{}).finally(()=>{H&&Ce(!1)})},[]),Re=R.useCallback(()=>{ve(Date.now()-te.current>=oF)},[ve]);R.useEffect(()=>{ve();const H=window.setInterval(Re,5*6e4),Y=()=>{document.visibilityState==="visible"&&Re()};return document.addEventListener("visibilitychange",Y),()=>{window.clearInterval(H),document.removeEventListener("visibilitychange",Y)}},[ve,Re]),R.useEffect(()=>{I&&ve()},[I,ve]);const ye=(K==null?void 0:K.notice)??null,[Ee,Ye]=R.useState(null),[we,_e]=R.useState(zv);R.useEffect(()=>{let H=!1;return fetch("/api/health").then(Y=>Y.ok?Y.json():null).then(Y=>{H||(_e(G5(Y)),!(!Y||typeof Y.workspace!="string")&&Ye(Y.workspace))}).catch(()=>{}),()=>{H=!0}},[I]);const Be=R.useRef(we);Be.current=we;const it=ye?`${ye.kind}:${ye.to}`:"",ft=ye!=null&&Q!==it,Ze=R.useCallback(()=>{if(!ye)return;const H=Q===it?"":it;ne(H);try{window.localStorage.setItem(QE,H)}catch{}},[ye,it,Q]),[De,Je]=R.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(ZE)??""}catch{return""}}),Xe=K!=null&&K.invokedAs&&K.invokedAs!==Gt?K.invokedAs:null,Ot=Xe!=null&&De!==Xe,lt=R.useCallback(()=>{if(Xe){Je(Xe);try{window.localStorage.setItem(ZE,Xe)}catch{}}},[Xe]),Qe=((Ka=K==null?void 0:K.upgrade)==null?void 0:Ka.state)??"idle",Pt=_$(K==null?void 0:K.upgrade),zt=R.useCallback(async()=>{try{await fetch("/api/upgrade",{method:"POST"})}catch{}ve()},[ve]);R.useEffect(()=>{if(Qe!=="running")return;const H=window.setInterval(ve,3e3);return()=>window.clearInterval(H)},[Qe,ve]);const et=R.useCallback(async()=>{var oe;const H=K==null?void 0:K.command;if(!H)return;let Y=!1;try{Y=await Promise.race([((oe=navigator.clipboard)==null?void 0:oe.writeText(H).then(()=>!0))??Promise.resolve(!1),new Promise(de=>window.setTimeout(()=>de(!1),500))])}catch{Y=!1}if(!Y)try{const de=document.createElement("textarea");de.value=H,de.setAttribute("readonly",""),de.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(de),de.select(),Y=document.execCommand("copy"),de.remove()}catch{Y=!1}Y&&(fe(!0),window.setTimeout(()=>fe(!1),1600))},[K==null?void 0:K.command]),bt=R.useCallback(()=>{A(H=>(H||U(!1),!H))},[]),ht=R.useCallback(()=>{U(H=>(H||A(!1),!H))},[]),[vt,hn]=R.useState(!1),[Yt,Lt]=R.useState(0),bn=R.useRef(null),[gr,Sn]=R.useState(!1),Bt=R.useRef(null),[Fn,pn]=R.useState(0),vr=R.useRef(D$()),[Hr,xi]=R.useState(!1),Wr=R.useCallback(()=>{const H=vr.current,Y=H.setPaused(!H.paused);for(const oe of Y)t.current=Kx(t.current,oe);xi(H.paused)},[]),[ut,_i]=R.useState(Date.now()),[mn,Is]=R.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(JE)!=="0"}catch{return!0}}),yr=R.useCallback(()=>{Is(H=>{const Y=!H;try{window.localStorage.setItem(JE,Y?"1":"0")}catch{}return Y})},[]),[zn,kn]=R.useState(!1),[Vr,Gr]=R.useState("restart"),[Yr,bi]=R.useState(null),sr=R.useRef(!1),Ms=R.useRef(null),En=R.useRef(0),wr=R.useCallback(async H=>{if(sr.current)return;const Y=(H==null?void 0:H.upgrade)===!0;sr.current=!0,Ms.current=Pt;const oe=++En.current;Gr(Y?"npx":"restart"),kn(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(ye==null?void 0:ye.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:Y})})}catch{}window.setTimeout(()=>{if(En.current===oe&&sr.current){sr.current=!1,kn(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},Y?18e4:3e4)},[ye==null?void 0:ye.to,Pt]),Os=R.useRef(null);R.useEffect(()=>{let H=!1;for(const oe of t.current.agents.values())if(oe.state==="active"){H=!0;break}const Y=S$({enabled:mn,kind:ye==null?void 0:ye.kind,canRestart:(K==null?void 0:K.canRestart)===!0,busy:H,idleSince:Os.current,now:ut});Os.current=Y.idleSince,Y.restart&&wr()},[mn,ye==null?void 0:ye.kind,K==null?void 0:K.canRestart,ut,wr]),R.useEffect(()=>{const H=K==null?void 0:K.running;let Y=null,oe=null;try{Y=window.sessionStorage.getItem("agent-dag.restartPending"),oe=window.sessionStorage.getItem(eN)}catch{return}const de=x$({bundle:"1.35.41",running:H,pending:Y,lastTried:oe});if(de==="reload"){try{window.sessionStorage.setItem(eN,H??"")}catch{return}window.location.reload();return}if(de!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}sr.current=!1,kn(!1),bi(H??null);const xe=window.setTimeout(()=>bi(null),6e3);return()=>window.clearTimeout(xe)},[K==null?void 0:K.running]),R.useEffect(()=>{if(zn&&b$({asked:Ms.current,reported:Pt})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}sr.current=!1,kn(!1)}},[zn,Pt]);const Ps=R.useRef(pF()).current;R.useRef(!1);const Tt=R.useRef(new Map(Ps.positions.filter(([H])=>Ps.pins.includes(H)))),xr=R.useRef(null),_r=R.useState(()=>mF())[0],[Kt,Kr]=R.useState(""),[Si,nt]=R.useState(()=>new Set),[br,Xr]=R.useState(H$),[Ls,Qr]=R.useState(!1),Zr=R.useRef(null);R.useEffect(()=>{document.documentElement.dataset.theme=br;try{window.localStorage.setItem(ZC,br)}catch{}},[br]),R.useEffect(()=>{if(!_r)return;const H=window.setTimeout(()=>{try{e.setViewport(_r,{duration:0})}catch{}},60);return()=>window.clearTimeout(H)},[e,_r]);const $s=R.useRef(!0);R.useEffect(()=>{const H=new EventSource("/events"),Y=q$(i,{now:()=>Date.now(),setTimeout:(oe,de)=>window.setTimeout(oe,de),clearTimeout:oe=>window.clearTimeout(oe)});return H.addEventListener("open",()=>{G(!0),Qr(!0)}),H.addEventListener("error",()=>G(!1)),H.addEventListener("replay-end",()=>{$s.current=!1,Y.flush()}),H.addEventListener("hook",oe=>{try{const de=JSON.parse(oe.data);if(!vr.current.accept(de))return;t.current=Kx(t.current,de),de.replay===!0||$s.current||Date.now()-de.receivedAt>3e4?Y.replay():Y.live()}catch{}}),()=>{H.close(),Y.cancel()}},[i]),R.useEffect(()=>{const H=setInterval(()=>{const Y=Date.now();_i(Y);let oe=$P(t.current,Y,Yx);qP(t.current,Y,Yx)&&(oe=!0),PP(t.current,Y,nF,rF)&&(oe=!0),LP(t.current,Y,sF,iF)&&(oe=!0),oe&&i()},250);return()=>clearInterval(H)},[i]);const ir=R.useRef(null),St=R.useRef(0),qs=420,pt=R.useCallback((H=500)=>{try{const Se=document.querySelector(".canvas-wrap"),Pe=Array.from(document.querySelectorAll(".react-flow__node")).filter(wt=>wt.offsetWidth>0);if(!Se||Pe.length===0)return;const Fe=Se.getBoundingClientRect(),Ge=e.getViewport();if(!Number.isFinite(Ge.zoom)||Ge.zoom<=0)return;const We=wt=>(wt-Fe.left-Ge.x)/Ge.zoom,ze=wt=>(wt-Fe.top-Ge.y)/Ge.zoom,jn=Pe.map(wt=>wt.getBoundingClientRect()),Ys=Math.min(...jn.map(wt=>We(wt.left))),Io=Math.max(...jn.map(wt=>We(wt.right))),Ks=Math.min(...jn.map(wt=>ze(wt.top))),Mo=Math.max(...jn.map(wt=>ze(wt.bottom))),Ja=Io-Ys,us=Mo-Ks;if(!(Ja>0&&us>0))return;const Zt=Math.max(.2,Math.min(1,(Fe.width-160)/(Ja+qs)*.86,(Fe.height-160)/us*.86));e.setViewport({x:80-Ys*Zt,y:Math.max(80,(Fe.height-us*Zt)/2)-Ks*Zt,zoom:Zt},{duration:H}),St.current=Date.now(),window.setTimeout(()=>{try{const wt={x:80-Ys*Zt,y:Math.max(80,(Fe.height-us*Zt)/2)-Ks*Zt,zoom:Zt},Oo=e.getViewport();(Math.abs(Oo.zoom-Zt)>.01||Math.abs(Oo.x-wt.x)>2)&&e.setViewport(wt,{duration:0})}catch{}},H+60)}catch{}},[e]),Eo=R.useRef(""),No=R.useRef(null),za=R.useRef(0),Sr=R.useCallback(()=>{za.current=Date.now()},[]),Jr="agent-dag.autoFitDisabled",gn=R.useRef((()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Jr)==="1"}catch{return!1}})()),[Ds,Ba]=R.useState(gn.current),Ua=R.useCallback(()=>{if(!gn.current){gn.current=!0,Ba(!0);try{window.localStorage.setItem(Jr,"1")}catch{}}},[]),Co=R.useCallback(()=>{gn.current=!1,Ba(!1);try{window.localStorage.removeItem(Jr)}catch{}pt(400)},[e,pt]);R.useEffect(()=>{const H=setInterval(()=>{if(gn.current||Date.now()-za.current<800)return;const Y=t.current,oe=Date.now(),de=[];for(const We of Y.agents.values())Fv(We,oe)&&de.push({id:We.id});if(de.length===0)return;const xe=e.getViewport(),Se=window.innerWidth-360,Pe=window.innerHeight-52;let Fe=!1,Ge=!1;for(const{id:We}of de){const ze=or.current.get(We),jn=Tt.current.get(We)??Xt.current.get(We);if(!ze||!jn)continue;Ge=!0;const Ys=jn.x*xe.zoom+xe.x,Io=jn.y*xe.zoom+xe.y,Ks=(jn.x+ze.width)*xe.zoom+xe.x,Mo=(jn.y+ze.height)*xe.zoom+xe.y;if(Ks>0&&Ys<Se&&Mo>0&&Io<Pe){Fe=!0;break}}Ge&&!Fe&&pt(600)},1500);return()=>clearInterval(H)},[e]);const ki=R.useRef(!1),or=R.useRef(new Map),es=R.useRef(0),ic=R.useCallback(H=>{const Y=or.current;let oe=!1;for(const de of H.nodeInternals.values()){const xe=de.width,Se=de.height;if(xe==null||Se==null)continue;const Pe=Y.get(de.id);Pe?(Math.abs(Pe.height-Se)>4||Math.abs(Pe.width-xe)>4)&&(Y.set(de.id,{width:xe,height:Se}),oe=!0):(Y.set(de.id,{width:xe,height:Se}),oe=!0)}return oe&&(es.current+=1),es.current},[]),Ei=Ke(ic),[He,Ha]=R.useState(0);R.useEffect(()=>{let H=0;const Y=()=>{const de=or.current;let xe=!1;for(const Se of document.querySelectorAll(".react-flow__node[data-id]")){const Pe=Se.getAttribute("data-id");if(!Pe)continue;const Fe=Se.offsetWidth,Ge=Se.offsetHeight;if(!Fe||!Ge)continue;const We=de.get(Pe);(!We||Math.abs(We.width-Fe)>4||Math.abs(We.height-Ge)>4)&&(de.set(Pe,{width:Fe,height:Ge}),xe=!0)}xe&&Ha(Se=>Se+1)};if(ki.current)return;let oe=0;return document.visibilityState==="hidden"?oe=window.setTimeout(Y,32):H=requestAnimationFrame(Y),()=>{cancelAnimationFrame(H),window.clearTimeout(oe)}});const Xt=R.useRef(new Map(Ps.positions)),jo=R.useRef(new Set),Ni=R.useRef(""),kr=R.useMemo(()=>{const H=[];for(const Y of t.current.agents.values())Fv(Y,ut)&&H.push(Y.id+(Y.parentId?`>${Y.parentId}`:""));return H.sort(),`${H.join("|")}#sv${Ei}.${He}`},[t.current,t.current.lastSeq,ut,Ei,He]),ts=R.useRef(null);R.useEffect(()=>(ts.current!=null&&window.clearTimeout(ts.current),ts.current=window.setTimeout(()=>{yv(Xt.current,Tt.current)},1500),()=>{ts.current!=null&&window.clearTimeout(ts.current)}),[kr]),R.useEffect(()=>{if(Eo.current===kr)return;const H=Eo.current;if(Eo.current=kr,!H||gn.current)return;Date.now()-St.current>1200&&pt(400),ir.current&&window.clearTimeout(ir.current),ir.current=window.setTimeout(()=>{gn.current||pt(500)},280)},[kr,e,pt]);const Fs=R.useMemo(()=>{if(o.size===0)return null;const H=new Set;for(const Y of o){const oe=yF(t.current,Y);if(oe)for(const de of oe)H.add(de)}return H.size>0?H:null},[t.current,t.current.lastSeq,o]),Nn=R.useMemo(()=>q5(t.current,ut),[t.current,t.current.lastSeq,ut]),Bn=R.useRef(null),[vn,Un]=R.useState({w:0,h:0});R.useEffect(()=>{const H=Bn.current;if(!H||typeof ResizeObserver>"u")return;const Y=new ResizeObserver(oe=>{var xe;const de=(xe=oe[0])==null?void 0:xe.contentRect;de&&Un(Se=>Math.abs(Se.w-de.width)>40||Math.abs(Se.h-de.height)>40?{w:de.width,h:de.height}:Se)});return Y.observe(H),Un({w:H.clientWidth,h:H.clientHeight}),()=>Y.disconnect()},[]);const zs=R.useCallback(H=>{var oe,de;const Y=H.target;!(Y!=null&&Y.closest)||Y.closest(eF)!==H.currentTarget||(H.preventDefault(),(de=(oe=document.activeElement)==null?void 0:oe.blur)==null||de.call(oe))},[]),Bs=R.useRef(new Map),[Hn,oc]=R.useState(!1);R.useEffect(()=>{const H=window.setTimeout(()=>oc(!0),2500);return()=>window.clearTimeout(H)},[]);const[Wa,Er]=R.useState(!1),ar=R.useRef(null),[Ci,Us]=R.useState(!1),Va=R.useCallback(()=>{ar.current&&(window.clearTimeout(ar.current),ar.current=null),Er(!1)},[]),ac=R.useCallback(H=>{H.length!==0&&queueMicrotask(()=>{Er(!0),ar.current&&window.clearTimeout(ar.current),ar.current=window.setTimeout(()=>Er(!1),tF+80)})},[]);R.useEffect(()=>()=>{ar.current&&window.clearTimeout(ar.current)},[]);const ns=vn.w>0?vn.w*.92:0,rs=vn.h>0?vn.h:0,{nodes:Qt,edges:ji}=R.useMemo(()=>wF(t.current,ut,ns,rs,Tt.current,Kt,or.current,Bs.current,ac,Hn,Ci,Xt.current,jo.current,kr,Ni,o,Fs,Nn,b),[t.current,t.current.lastSeq,ut,ns,rs,Hn,Ci,Kt,kr,o,Fs,Nn,b,Yt]),Ga=R.useMemo(()=>{const H=new Map;for(const oe of Qt){const de=oe.data;if(!(de!=null&&de.sessionId)||de.exitAt!=null)continue;const xe=oe.width,Se=oe.height;if(xe==null||Se==null)continue;const Pe=oe.position.x,Fe=oe.position.y,Ge=Pe+xe,We=Fe+Se,ze=H.get(de.sessionId);ze?(ze.minX=Math.min(ze.minX,Pe),ze.minY=Math.min(ze.minY,Fe),ze.maxX=Math.max(ze.maxX,Ge),ze.maxY=Math.max(ze.maxY,We)):H.set(de.sessionId,{minX:Pe,minY:Fe,maxX:Ge,maxY:We})}const Y=[];for(const[oe,de]of H){const xe=de.maxX-de.minX+cu*2,Se=de.maxY-de.minY+cu*2;Y.push({id:`group:${oe}`,type:tT,position:{x:de.minX-cu,y:de.minY-cu},data:{sessionId:oe,w:xe,h:Se},width:xe,height:Se,style:{width:xe,height:Se},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return Y},[Qt,ut]),lc=R.useMemo(()=>{const H=[...Ga,...Qt],Y=Bt.current;return!Y||Y.size===0?H:H.map(oe=>{const de=Y.get(oe.id);return de?{...oe,position:de}:oe})},[Ga,Qt,Fn]),Nr=R.useMemo(()=>{if(!Kt)return null;const H=new Set;for(const Y of t.current.agents.values())Nn.has(Y.id)&&sT(Y,Kt)&&H.add(Y.id);return H},[t.current,t.current.lastSeq,Kt,Nn]),Cn=R.useMemo(()=>X5(Kt,(Nr==null?void 0:Nr.size)??0,Nn.size),[Kt,Nr,Nn]),ss=R.useMemo(()=>{const H=new Set;for(const Y of t.current.agents.values())for(const oe of Y.tools)H.add(cT(oe.name));return Object.keys(Bv).filter(Y=>H.has(Y))},[t.current,t.current.lastSeq]);R.useEffect(()=>{if(ss.length<=1){Sn(!1);return}let H=0;const Y=()=>{const oe=bn.current;if(oe&&!document.hidden){const de=oe.getBoundingClientRect(),xe=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Pe=>Pe.getBoundingClientRect()),Se=F5(de,xe,8);Sn(Pe=>Pe===Se?Pe:Se)}H=window.setTimeout(Y,300)};return Y(),()=>window.clearTimeout(H)},[ss.length]);const is=R.useMemo(()=>{const H=new Map;for(const oe of t.current.agents.values())for(const de of oe.tools){if(!de.name.startsWith("mcp__"))continue;const xe=de.name.slice(5),Se=xe.indexOf("__"),Pe=Se>0?xe.slice(0,Se):xe;H.set(Pe,(H.get(Pe)??0)+1)}const Y=[];for(const[oe,de]of H){let xe=5381;for(let Se=0;Se<oe.length;Se++)xe=(xe<<5)+xe^oe.charCodeAt(Se);Y.push({server:oe,count:de,hue:Math.abs(xe)%360})}return Y.sort((oe,de)=>de.count-oe.count),Y},[t.current,t.current.lastSeq]),lr=R.useCallback(H=>{nt(Y=>{const oe=new Set(Y);return oe.has(H)?oe.delete(H):oe.add(H),oe})},[]),Rt=u?t.current.agents.get(u):null,os=f?Array.from(t.current.agents.values()).flatMap(H=>H.tools).find(H=>H.id===f)??null:null,To=R.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}t.current=Pv(),Tt.current.clear(),or.current.clear(),Xt.current.clear(),Ni.current="",nN(),m(),i()},[i,m]),Hs=R.useRef(S);Hs.current=S;const Ws=R.useRef(!1);Ws.current=os!=null||vt||E!=null||y!=null;const Vs=R.useCallback(H=>{const Y=E$(H,{confirmOpen:Hs.current,modalOpen:Ws.current});Y==="confirm"?k(!0):Y==="clear"&&(k(!1),To())},[To]),$t=R.useCallback(()=>{Tt.current.clear(),Xt.current.clear(),Ni.current="",nN(),i(),window.setTimeout(()=>pt(500),80)},[i,e,pt]),Cr=R.useCallback(()=>pt(500),[pt]),as=R.useRef(Qt);as.current=Qt;const ls=R.useRef(u);ls.current=u;const Ro=R.useCallback(H=>{const Y=as.current,oe=C$(Y.map(Se=>({id:Se.id,x:Se.position.x,y:Se.position.y})),ls.current,H),de=oe?Y.find(Se=>Se.id===oe):void 0;if(!de)return;const xe=KE(document.activeElement);d(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}St.current=Date.now(),xe&&J5(de.id)},30)},[d,e]),Ti=R.useCallback(H=>{d(H,!1),window.setTimeout(()=>{try{const Y=as.current.find(oe=>oe.id===H);Y&&e.fitView({padding:.3,duration:500,nodes:[Y]}),St.current=Date.now()}catch{}},60)},[d,e]);R.useEffect(()=>{const H=Y=>{var Fe,Ge,We;const oe=Y.target,de={tagName:oe==null?void 0:oe.tagName,isContentEditable:oe==null?void 0:oe.isContentEditable,role:(Fe=oe==null?void 0:oe.getAttribute)==null?void 0:Fe.call(oe,"role"),type:oe==null?void 0:oe.type};if(Y.key==="Escape"){const ze=rL({overlayOpen:Tu.depth()>0,typing:uy(de)});ze==="dismiss"?Tu.dismissTop():ze==="blur"?oe==null||oe.blur():(A$(de)&&(oe==null||oe.blur()),m());return}if($C(Y))return;const xe=KE(oe)?(Ge=oe==null?void 0:oe.getAttribute)==null?void 0:Ge.call(oe,"data-id"):null,Se=xe&&as.current.some(ze=>ze.id===xe)?xe:null,Pe=T$(Y,Se);if(Pe.kind==="activate"){Y.preventDefault(),d(Pe.nodeId,Pe.additive);return}if(Pe.kind!=="node"&&!(Pe.nodeId==null&&dL(de))){if(Y.key==="/"){Y.preventDefault(),(We=Zr.current)==null||We.focus();return}Y.key===" "&&(Y.preventDefault(),Wr()),(Y.key==="c"||Y.key==="C")&&Vs("shortcut"),(Y.key==="r"||Y.key==="R")&&$t(),(Y.key==="f"||Y.key==="F")&&Cr(),(Y.key==="l"||Y.key==="L")&&bt(),(Y.key==="h"||Y.key==="H")&&hn(ze=>!ze),(Y.key==="u"||Y.key==="U")&&D(ze=>!ze),(Y.key==="a"||Y.key==="A")&&Be.current.claude&&ht(),(Y.key==="j"||Y.key==="J")&&Ro(1),(Y.key==="k"||Y.key==="K")&&Ro(-1),(Y.key==="t"||Y.key==="T")&&Xr(ze=>ze==="dark"?"light":"dark")}};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[Vs,$t,Cr,m,d,Ro,Wr]);const jr=t.current.agents.size,Gs=new Set(Array.from(t.current.agents.values()).map(H=>H.sessionId)).size,tn=R.useMemo(()=>p3(t.current.agents.values()),[t.current,t.current.lastSeq]),Ao=R.useMemo(()=>m3(t.current.agents.values()),[t.current,t.current.lastSeq]),Ya=R.useRef(null);R.useEffect(()=>{const H=W$({waiting:tn.length,running:Ao}),Y=Ya.current;if(Ya.current=H,(Y==null?void 0:Y.title)!==H.title&&(document.title=H.title),(Y==null?void 0:Y.icon)!==H.icon){const oe=document.querySelector('link[rel="icon"]');oe&&(oe.href=V$[H.icon])}},[tn.length,Ao]);const[uc,cc]=R.useState(""),Ri=Y$(tn);R.useEffect(()=>{cc(H=>K$(H,Ri))},[Ri]);const nn=R.useMemo(()=>{let H=0,Y=0,oe=0,de=0,xe=0,Se=0,Pe=0,Fe=0,Ge=0;for(const We of t.current.agents.values()){H+=We.usage.inputTokens,Y+=We.usage.outputTokens,oe+=We.usage.cacheReadTokens,de+=We.usage.cacheCreateTokens;const ze=dn(We.usage,We.model);xe+=ze.total,Se+=ze.input,Pe+=ze.output,Fe+=ze.cacheRead,Ge+=ze.cacheWrite}return{inT:H,outT:Y,cacheR:oe,cacheC:de,sum:H+Y,cost:{total:xe,input:Se,output:Pe,cacheRead:Fe,cacheWrite:Ge}}},[t.current,t.current.lastSeq]);return g.jsxs("div",{className:"app",children:[g.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),g.jsxs("header",{className:"topbar",children:[g.jsxs("div",{className:"brand",children:[g.jsx("span",{className:"logo"}),g.jsx("h1",{children:Gt}),ye?g.jsxs("button",{type:"button",className:"v stale",onClick:Ze,"aria-label":W5({...ye,open:ft}),title:ye.kind==="restart"?`Running v${ye.from}; v${ye.to} is installed on disk. Restart to pick it up.`:`Running v${ye.from}; v${ye.to} is on npm.`,children:["v",ye.from,g.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const H={running:(K==null?void 0:K.running)??"1.35.41",latest:K==null?void 0:K.latest,latestPending:K==null?void 0:K.latestPending,checkedAgo:K!=null&&K.checkedAt?$v(ut-K.checkedAt):null,checkDisabled:K==null?void 0:K.checkDisabled,checking:ce};return g.jsxs("button",{type:"button",className:ce?"v checking":"v",onClick:()=>ve(!0),"aria-busy":ce||void 0,"aria-label":H5(H),title:U5(H),children:["v",H.running]})})()]}),Rt&&(()=>{const H=dn(Rt.usage,Rt.model),Y=Math.max(0,((Rt.endedAt??ut)-Rt.startedAt)/1e3),oe=Rt.state==="active"?Cu(H.total,Y):null,de=o.size-1;return g.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${Rt.label}`,onClick:()=>{try{const xe=Qt.find(Se=>Se.id===Rt.id);xe&&e.fitView({padding:.35,duration:500,nodes:[xe]}),St.current=Date.now()}catch{}},children:[g.jsx("span",{className:`state-pill state-${Rt.state}`,children:Rt.state==="active"?"live":Rt.state}),g.jsx("span",{className:"selected-label",children:Rt.label}),H.total>0&&g.jsxs("span",{className:"selected-cost",children:[qe(H.total),oe?g.jsxs("span",{className:"selected-rate",children:[" · ",oe]}):null]}),de>0&&g.jsxs("span",{className:"selected-extra",children:["+",de]}),g.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:xe=>{xe.stopPropagation(),m()},children:"×"})]})})(),g.jsxs("div",{className:"actions",children:[g.jsxs("div",{className:"search",children:[g.jsx("span",{className:"search-icon","aria-hidden":!0,children:"⌕"}),g.jsx("input",{ref:Zr,type:"text",placeholder:Q5,value:Kt,onChange:H=>Kr(H.target.value),spellCheck:!1,"aria-label":"Filter the graph"}),Kt?g.jsx("button",{className:"search-clear","aria-label":"Clear search",onClick:()=>Kr(""),children:"×"}):g.jsx("kbd",{className:"search-kbd","aria-hidden":!0,children:"/"}),Cn.count&&g.jsx("span",{className:`search-count${Cn.empty?" none":""}`,"aria-live":"polite",title:`${Cn.count} agents on the canvas match “${Kt}”`,children:Cn.count})]}),g.jsxs("span",{className:"status",children:[(()=>{const H=Y5({connected:I,paused:Hr,held:vr.current.size});return g.jsx("span",{className:`pill ${H.tone}`,title:H.title,children:H.label})})(),g.jsxs("span",{className:"stat",title:nq(we),children:[g.jsx("span",{className:"count",children:Gs}),g.jsx("span",{className:"lbl",children:"sessions"})]}),g.jsxs("span",{className:"stat",title:"Total agents (root + subagents)",children:[g.jsx("span",{className:"count",children:jr}),g.jsx("span",{className:"lbl",children:"agents"})]}),g.jsxs("span",{className:"stat",title:rq(we),children:[g.jsx("span",{className:"count",children:t.current.totalEvents}),g.jsx("span",{className:"lbl",children:"events"})]}),g.jsx(R3,{}),nn.sum>0&&g.jsxs("span",{className:"stat",title:`in:${nn.inT.toLocaleString()} out:${nn.outT.toLocaleString()} cache-r:${nn.cacheR.toLocaleString()} cache-c:${nn.cacheC.toLocaleString()}`,children:[g.jsx("span",{className:"count",children:Nt(nn.sum)}),g.jsx("span",{className:"lbl",children:"tokens"})]}),is.length>0&&g.jsxs("span",{className:"stat mcp-legend",title:`MCP servers seen this session:
|
|
74
|
+
${is.map(H=>` ${H.server}: ${H.count} call${H.count===1?"":"s"}`).join(`
|
|
75
|
+
`)}`,children:[is.slice(0,6).map(H=>g.jsx("span",{className:"mcp-dot",style:{"--mcp-hue":H.hue}},H.server)),is.length>6&&g.jsxs("span",{className:"mcp-more",children:["+",is.length-6]}),g.jsx("span",{className:"lbl",children:"mcp"})]}),nn.cost.total>0&&(()=>{let H=0,Y=0;for(const xe of t.current.agents.values()){if(xe.state!=="active")continue;const Se=dn(xe.usage,xe.model);H+=Se.total,Y=Math.max(Y,((xe.endedAt??ut)-xe.startedAt)/1e3)}const oe=Y>0?Cu(H,Y):null,de=`input ${qe(nn.cost.input)} + output ${qe(nn.cost.output)} + cache r ${qe(nn.cost.cacheRead)} + cache w ${qe(nn.cost.cacheWrite)}${oe?`
|
|
76
|
+
active burn: ${oe}`:""}`;return g.jsxs("span",{className:"stat",title:de,children:[g.jsx("span",{className:"count",children:qe(nn.cost.total)}),g.jsxs("span",{className:"lbl",children:["cost",oe?` · ${oe}`:""]})]})})()]}),g.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:uc}),tn.length>0&&g.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>Ti(tn[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
77
|
+
${tn.map(H=>` ${H.label}: ${Fu(H.waiting)} (${$v(ut-H.waiting.since)})`).join(`
|
|
78
|
+
`)}`,"aria-label":`${tn.length} session${tn.length===1?"":"s"} waiting for you`,children:[g.jsx("span",{className:"ap-pulse","aria-hidden":!0}),g.jsx("b",{children:tn.length})," waiting"]}),(()=>{const H=K5({paused:Hr,held:vr.current.size});return g.jsx("button",{className:`btn ${Hr?"warn":""}`,onClick:Wr,title:H.title,children:H.label})})(),g.jsx("button",{className:"btn icon-btn",onClick:()=>D(H=>!H),title:`${P?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":P,"aria-controls":P?"usage-panel":void 0,children:"$"}),we.claude&&V!==null&&g.jsx("button",{className:"btn icon-btn",onClick:H=>{if(H.shiftKey&&J>0){F(!0),fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restore"})}).then(()=>fetch("/api/sound-hook")).then(Y=>Y.ok?Y.json():null).then(Y=>{Y!=null&&Y.ok&&(z(Y.enabled===!0),W(Y.parked??0))}).catch(()=>{}).finally(()=>F(!1));return}Z()},disabled:C,title:iq(we,{on:V,clash:$,parked:J}),"aria-label":"Toggle Claude Code finish sound","aria-pressed":V,children:g.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:[g.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),V?g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),g.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M10 5.6l2.6 2.8"}),g.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),we.claude&&g.jsx("button",{className:"btn icon-btn",onClick:ht,title:`${L?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":L,"aria-controls":L?"accounts-panel":void 0,children:g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[g.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),g.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),g.jsx("button",{className:"btn icon-btn",onClick:bt,title:`${j?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":j,"aria-controls":j?"session-list":void 0,children:"☰"}),g.jsx("button",{className:"btn icon-btn",onClick:()=>hn(H=>!H),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[g.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),g.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),g.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),g.jsx("button",{className:"btn",onClick:$t,title:"Auto-arrange — clear pins (R)",children:"Re-layout"}),g.jsx("button",{className:"btn",onClick:()=>Vs("button"),title:"Clear the canvas and the server's event log — asks first (C)",children:"Clear"}),g.jsx("button",{className:"btn icon-btn",onClick:()=>Xr(H=>H==="dark"?"light":"dark"),title:`Switch to ${br==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:br==="dark"?"☀":"☾"})]})]}),Yr?g.jsxs("div",{className:"ver-banner done",role:"status",children:[g.jsx("span",{className:"ver-dot"}),g.jsxs("strong",{children:["Restarted — now running v",Yr,"."]}),g.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Ls&&!I?g.jsxs("div",{className:"conn-banner",role:"alert",children:[g.jsx("span",{className:"conn-dot"}),zn?Vr==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Gt}…`:`Lost connection to the ${Gt} server. Reconnecting…`]}):ft&&ye?g.jsxs("div",{className:`ver-banner ${ye.kind}`,role:"status",children:[g.jsx("span",{className:"ver-dot"}),ye.kind==="restart"?g.jsxs(g.Fragment,{children:[g.jsxs("strong",{children:["v",ye.to," is installed — this deck still runs v",ye.from,"."]}),K!=null&&K.canRestart?g.jsxs(g.Fragment,{children:[g.jsx("button",{type:"button",className:"ver-act",onClick:()=>wr(),disabled:zn,title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:zn?"restarting…":"Restart now"}),g.jsxs("button",{type:"button",className:`ver-auto${mn?" on":""}`,role:"switch","aria-checked":mn,onClick:yr,title:mn?"Restarts on its own once nothing has been running for 30 seconds. Click to require a click instead.":"Only restarts when you click. Click to let it restart itself while idle.",children:[g.jsx("i",{"aria-hidden":!0}),"auto when idle"]})]}):g.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."})]}):g.jsxs(g.Fragment,{children:[g.jsxs("strong",{children:[Gt," v",ye.to," is out — you are on v",ye.from,"."]}),(K==null?void 0:K.upgradeMode)==="install"&&Qe!=="failed"&&g.jsx("button",{type:"button",className:"ver-act",onClick:zt,disabled:Qe==="running"||Qe==="done",title:`Runs ${((Xa=K==null?void 0:K.upgrade)==null?void 0:Xa.command)??(K==null?void 0:K.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Qe==="running"?"installing…":Qe==="done"?"installed":"Update now"}),(K==null?void 0:K.upgradeMode)==="npx"&&(K==null?void 0:K.canRestart)&&g.jsx("button",{type:"button",className:"ver-act",onClick:()=>wr({upgrade:!0}),disabled:zn,title:`Runs ${K==null?void 0:K.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:zn?"fetching…":Qe==="failed"?"Retry update":"Update & restart"}),Qe==="failed"?g.jsxs("span",{className:"ver-sub fail",title:((Qa=K==null?void 0:K.upgrade)==null?void 0:Qa.error)??"",children:[(K==null?void 0:K.upgradeMode)==="npx"?"update failed":"install failed",": ",((Za=K==null?void 0:K.upgrade)==null?void 0:Za.error)??"unknown error"," — run it yourself:"]}):(K==null?void 0:K.upgradeMode)==="npx"?g.jsx("span",{className:"ver-sub",children:K!=null&&K.canRestart?"npx cannot upgrade in place, so the deck re-runs:":vv.npx}):K!=null&&K.upgradeBlocked?g.jsx("span",{className:"ver-sub",children:Object.hasOwn(vv,K.upgradeBlocked)?vv[K.upgradeBlocked]:"cannot install from here"}):null,g.jsxs("button",{type:"button",className:"ver-cmd",onClick:et,title:"Copy to clipboard",children:[g.jsx("code",{children:K==null?void 0:K.command}),g.jsx("span",{className:"ver-cmd-hint",children:ae?"copied":"copy"})]})]}),g.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Ze,children:"×"})]}):Ot&&Xe?g.jsxs("div",{className:"ver-banner",role:"status",children:[g.jsx("span",{className:"ver-dot"}),g.jsxs("strong",{children:[Xe," still works — the deck is called ",Gt," now."]}),K!=null&&K.renameFix?g.jsx("span",{className:"ver-sub",children:K.renameFix}):null,g.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:lt,children:"×"})]}):null,P&&g.jsx(C3,{state:t.current,now:ut,providers:we,onClose:()=>D(!1)}),L&&we.claude&&g.jsx(v$,{onClose:()=>U(!1)}),j&&g.jsx(v3,{state:t.current,now:ut,selectedIds:o,onSelect:Ti,onClose:()=>A(!1)}),g.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${Wa?" bubbling":""}${Ci?" dragging-any":""}`,ref:Bn,onMouseDownCapture:zs,children:[jr===0&&g.jsx(bF,{live:I,everConnected:Ls,providers:we}),Cn.empty&&jr>0&&g.jsxs("div",{className:"search-empty",role:"status",children:[g.jsx("span",{className:"search-empty-text",children:Cn.message}),g.jsx("button",{type:"button",className:"btn",onClick:()=>{var H;Kr(""),(H=Zr.current)==null||H.focus()},children:"Clear search"})]}),ss.length>1&&g.jsx("div",{ref:bn,className:`cat-filter-bar${gr?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:ss.map(H=>{const Y=Si.has(H);return g.jsxs("button",{type:"button",className:`cat-filter${Y?" off":""}`,onClick:()=>lr(H),"aria-pressed":!Y,title:`${Y?"Show":"Hide"} ${Uv[H]} tools`,children:[g.jsx("span",{className:"cat-emoji",children:Bv[H]}),g.jsx("span",{className:"cat-name",children:Uv[H]})]},H)})}),g.jsxs(_C,{nodes:lc,edges:ji,nodeTypes:Z5,fitView:!_r,fitViewOptions:{padding:.25,duration:400},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(H,Y)=>{if(Y.type==="sessionGroup"){m();return}d(Y.id,H.shiftKey)},onPaneClick:()=>m(),onMoveStart:()=>{Date.now()-St.current<1200||Ua()},onMove:(H,Y)=>{Sr(),No.current&&window.clearTimeout(No.current),No.current=window.setTimeout(()=>gF(Y),250)},onNodeDragStart:(H,Y)=>{var oe;if(Va(),ki.current=!0,Bt.current=new Map,Us(!0),Sr(),Ua(),Y.type==="sessionGroup"){const de=(oe=Y.data)==null?void 0:oe.sessionId,xe=new Map;if(de)for(const Se of Qt){const Pe=Se.data;(Pe==null?void 0:Pe.sessionId)===de&&xe.set(Se.id,{x:Se.position.x,y:Se.position.y})}xr.current={start:{x:Y.position.x,y:Y.position.y},members:xe};return}Tt.current.set(Y.id,{x:Y.position.x,y:Y.position.y})},onNodeDrag:(H,Y)=>{var oe;if(Sr(),Y.type==="sessionGroup"){const de=xr.current;if(!de)return;const xe=Y.position.x-de.start.x,Se=Y.position.y-de.start.y;for(const[Fe,Ge]of de.members){const We={x:Ge.x+xe,y:Ge.y+Se};Tt.current.set(Fe,We),Xt.current.set(Fe,We)}const Pe=Bt.current;if(Pe){for(const[Fe,Ge]of de.members)Pe.set(Fe,{x:Ge.x+xe,y:Ge.y+Se});Pe.set(Y.id,{x:Y.position.x,y:Y.position.y})}pn(Fe=>Fe+1);return}Tt.current.set(Y.id,{x:Y.position.x,y:Y.position.y}),Xt.current.set(Y.id,{x:Y.position.x,y:Y.position.y}),(oe=Bt.current)==null||oe.set(Y.id,{x:Y.position.x,y:Y.position.y}),pn(de=>de+1)},onNodeDragStop:(H,Y)=>{if(Sr(),ki.current=!1,Bt.current=null,Us(!1),Lt(oe=>oe+1),Y.type==="sessionGroup"){const oe=xr.current;if(oe){const de=Y.position.x-oe.start.x,xe=Y.position.y-oe.start.y;for(const[Se,Pe]of oe.members){const Fe={x:Pe.x+de,y:Pe.y+xe};Tt.current.set(Se,Fe),Xt.current.set(Se,Fe)}}xr.current=null,yv(Xt.current,Tt.current),Lt(de=>de+1);return}Tt.current.set(Y.id,{x:Y.position.x,y:Y.position.y}),Xt.current.set(Y.id,{x:Y.position.x,y:Y.position.y}),yv(Xt.current,Tt.current)},children:[g.jsx(SP,{gap:28,size:1,color:fa("--grid-line")}),g.jsx(TL,{}),g.jsx(c3,{agents:t.current.agents,visibleAgentIds:Nn,positions:Xt.current,pinned:Tt.current,measured:or.current,dimUnmatched:Cn.dim?Nr:null,spotlight:Fs,hiddenCategories:Si,now:ut,onOpenTool:p}),g.jsx(vP,{showInteractive:!1,children:g.jsx(io,{onClick:Co,title:Ds?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Ds?{color:"var(--accent)"}:void 0,children:g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[g.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),g.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})})}),g.jsx(cP,{zoomable:!0,pannable:!0,nodeColor:H=>z5(H,fa),nodeStrokeWidth:2,maskColor:fa("--minimap-mask"),style:{background:fa("--panel"),border:`1px solid ${fa("--line")}`,borderRadius:8}})]})]}),M?g.jsxs("aside",{className:"detail","aria-label":"Detail",children:[g.jsx("button",{type:"button",className:"detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>O(!1),children:"×"}),Rt?g.jsx(EF,{agent:Rt,now:ut,onOpenTool:p,onShowSummary:H=>{N.current.has(H)&&(N.current.delete(H),tN(N.current)),w(H)},onExportSession:H=>vF(t.current,H)}):g.jsx(kF,{count:jr,workspace:Ee})]}):g.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>O(!0),children:"‹"}),os&&g.jsx(kL,{tool:os,onClose:()=>p(null)}),vt&&g.jsx(cq,{providers:we,onClose:()=>hn(!1)}),E&&(()=>{const H=t.current.agents.get(E);return H?g.jsx(vL,{agent:H,onClose:()=>_(null)}):null})(),y&&g.jsx(f3,{state:t.current,sessionId:y,onClose:()=>{N.current.add(y),tN(N.current),w(null)}}),S&&g.jsx(k$,{agentCount:jr,onConfirm:()=>Vs("confirmation"),onCancel:()=>k(!1)})]})}function bF({live:e,everConnected:t,providers:r}){const i=!e;return g.jsxs("div",{className:"empty-hero",children:[g.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[g.jsx("div",{className:"core"}),g.jsxs("div",{className:"orbit r1",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]}),g.jsxs("div",{className:"orbit r2",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]}),g.jsxs("div",{className:"orbit r3",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]})]}),i?g.jsxs(g.Fragment,{children:[g.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),g.jsxs("p",{children:["The browser cannot reach ",g.jsx("code",{children:"/events"}),". Check that",g.jsx("code",{children:Gt})," is still running in your terminal, then this page will resume automatically."]})]}):SF(r)]})}function SF(e){return g.jsxs(g.Fragment,{children:[g.jsx("h2",{children:"Waiting for Claude Code or Codex"}),g.jsxs("p",{children:["Run ",g.jsx("code",{children:"claude"})," or ",g.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."]}),g.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",g.jsx("code",{children:Gt})," is running."]}),sq(e).map(t=>g.jsx("p",{className:"hint-row",children:t.spans.map((r,i)=>r.code?g.jsx("code",{children:r.text},i):g.jsx("span",{children:r.text},i))},t.provider))]})}function kF({count:e,workspace:t}){const r=V5(t);return g.jsxs(g.Fragment,{children:[g.jsx("h2",{children:"Detail"}),e===0?g.jsxs("div",{className:"hint",children:[r.lead,r.workspace!==null&&g.jsxs(g.Fragment,{children:[" ",g.jsx("code",{children:r.workspace}),r.tail]})]}):g.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),g.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),g.jsxs("div",{className:"shortcuts",children:[g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"drag"}),g.jsx("span",{children:"move a node"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"tab"}),g.jsx("span",{children:"reach the cards"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"enter"}),g.jsx("span",{children:"select the focused card"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"/"}),g.jsx("span",{children:"focus search"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"space"}),g.jsx("span",{children:"pause / resume"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"J"}),g.jsx("span",{children:"next agent"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"K"}),g.jsx("span",{children:"previous agent"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"R"}),g.jsx("span",{children:"re-arrange"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"F"}),g.jsx("span",{children:"fit view"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"L"}),g.jsx("span",{children:"session list"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"H"}),g.jsx("span",{children:"usage history"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"U"}),g.jsx("span",{children:"usage panel"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"C"}),g.jsx("span",{children:"clear canvas"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"T"}),g.jsx("span",{children:"toggle theme"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"Esc"}),g.jsx("span",{children:"deselect, release focus"})]})]})]})}function EF({agent:e,now:t,onOpenTool:r,onShowSummary:i,onExportSession:o}){const l=ju(e.startedAt,e.endedAt,t),u=dn(e.usage,e.model),c=u.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const w of e.tools){const E=cT(w.name);p.set(E,(p.get(E)??0)+1)}const d=e.tools.filter(w=>w.ok===!1).length,m=e.tools.filter(w=>!w.endedAt).length,y=Array.from(p.entries()).sort((w,E)=>E[1]-w[1]);return g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"detail-hero",children:[g.jsxs("div",{className:"hero-line",children:[g.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),g.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),g.jsxs("div",{className:"hero-meta",children:[g.jsx("span",{className:"hero-meta-item",children:e.kind}),g.jsx("span",{className:"hero-sep",children:"·"}),g.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:l}),e.model&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"hero-sep",children:"·"}),g.jsx("span",{className:"model-chip",title:e.model,children:Rs(e.model)})]})]}),c&&g.jsxs("div",{className:"hero-cost",children:[g.jsxs("div",{className:"hero-cost-headline",children:[g.jsx("span",{className:"hero-cost-value",children:qe(u.total)}),g.jsx("span",{className:"hero-cost-label",children:"spend"})]}),g.jsx(dy,{cost:u})]}),g.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&i&&g.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>i(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),o&&g.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>o(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Activity"}),g.jsxs("div",{className:"activity-row",children:[g.jsxs("div",{className:"activity-counters",children:[g.jsxs("span",{className:"ac-item",children:[g.jsx("b",{children:e.toolCount})," calls"]}),m>0&&g.jsxs("span",{className:"ac-item ac-live",children:[g.jsx("b",{children:m})," live"]}),d>0&&g.jsxs("span",{className:"ac-item ac-err",children:[g.jsx("b",{children:d})," err"]})]}),g.jsx("div",{className:"cat-strip",children:y.map(([w,E])=>g.jsxs("span",{className:`cat-chip cat-${w}`,title:`${E} ${Uv[w]} call${E===1?"":"s"}`,children:[g.jsx("span",{className:"cat-emoji",children:Bv[w]}),g.jsx("span",{className:"cat-count",children:E})]},w))})]})]}),f>0&&g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Tokens"}),g.jsxs("div",{className:"tokens-grid",children:[g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"in"}),g.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"out"}),g.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"cache r"}),g.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"cache c"}),g.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Identity"}),g.jsxs("div",{children:[e.cwd&&g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"cwd"}),g.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"session"}),g.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"parent"}),g.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&g.jsxs("section",{className:"detail-section",children:[g.jsxs("h3",{children:["Prompts ",g.jsx("span",{className:"section-count",children:e.prompts.length})]}),g.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((w,E)=>{const _=w3(w.at,t);return g.jsxs("div",{className:"prompt-entry",children:[g.jsx("div",{className:"prompt-time",title:_.title,children:_.label}),g.jsx("div",{className:"prompt-text",children:w.text})]},E)})})]}),g.jsxs("section",{className:"detail-section",children:[g.jsxs("h3",{children:["Tool calls ",g.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&g.jsx("div",{className:"empty",children:"No tool calls yet."}),g.jsx("div",{children:e.tools.slice().reverse().map(w=>g.jsx(CF,{t:w,onClick:()=>r(w.id)},w.id))})]})]})}const NF={inflight:"in-flight",done:"done",err:"error"};function CF({t:e,onClick:t}){const r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",i=LC(e,"…");return g.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[g.jsxs("span",{className:"name",children:[g.jsx("span",{className:`status-dot ${r}`,"aria-hidden":!0}),g.jsx("span",{className:"vis-hidden",children:NF[r]}),e.name]}),g.jsx("span",{style:{color:"var(--muted)"},children:i})]})}try{B$(window.localStorage)}catch{}const jF=_R.createRoot(document.getElementById("root"));jF.render(g.jsx(xF,{}));
|