agent-dag 1.35.30 → 1.35.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,77 @@
1
+ (function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.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 Hl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cd={exports:{}},ra={},Td={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 Pw;function tj(){if(Pw)return Le;Pw=1;var e=Symbol.for("react.element"),n=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"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),m=Symbol.iterator;function y(M){return M===null||typeof M!="object"?null:(M=m&&M[m]||M["@@iterator"],typeof M=="function"?M:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,_={};function S(M,G,K){this.props=M,this.context=G,this.refs=_,this.updater=K||w}S.prototype.isReactComponent={},S.prototype.setState=function(M,G){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,G,"setState")},S.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function b(){}b.prototype=S.prototype;function k(M,G,K){this.props=M,this.context=G,this.refs=_,this.updater=K||w}var E=k.prototype=new b;E.constructor=k,N(E,S.prototype),E.isPureReactComponent=!0;var T=Array.isArray,I=Object.prototype.hasOwnProperty,O={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function U(M,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)I.call(G,q)&&!A.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(M&&M.defaultProps)for(q in fe=M.defaultProps,fe)Q[q]===void 0&&(Q[q]=fe[q]);return{$$typeof:e,type:M,key:ne,ref:ae,props:Q,_owner:O.current}}function z(M,G){return{$$typeof:e,type:M.type,key:G,ref:M.ref,props:M.props,_owner:M._owner}}function P(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function D(M){var G={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(K){return G[K]})}var V=/\/+/g;function B(M,G){return typeof M=="object"&&M!==null&&M.key!=null?D(""+M.key):G.toString(36)}function C(M,G,K,q,Q){var ne=typeof M;(ne==="undefined"||ne==="boolean")&&(M=null);var ae=!1;if(M===null)ae=!0;else switch(ne){case"string":case"number":ae=!0;break;case"object":switch(M.$$typeof){case e:case n:ae=!0}}if(ae)return ae=M,Q=Q(ae),M=q===""?"."+B(ae,0):q,T(Q)?(K="",M!=null&&(K=M.replace(V,"$&/")+"/"),C(Q,G,K,"",function(ce){return ce})):Q!=null&&(P(Q)&&(Q=z(Q,K+(!Q.key||ae&&ae.key===Q.key?"":(""+Q.key).replace(V,"$&/")+"/")+M)),G.push(Q)),1;if(ae=0,q=q===""?".":q+":",T(M))for(var fe=0;fe<M.length;fe++){ne=M[fe];var te=q+B(ne,fe);ae+=C(ne,G,K,te,Q)}else if(te=y(M),typeof te=="function")for(M=te.call(M),fe=0;!(ne=M.next()).done;)ne=ne.value,te=q+B(ne,fe++),ae+=C(ne,G,K,te,Q);else if(ne==="object")throw G=String(M),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return ae}function $(M,G,K){if(M==null)return M;var q=[],Q=0;return C(M,q,"","",function(ne){return G.call(K,ne,Q++)}),q}function L(M){if(M._status===-1){var G=M._result;G=G(),G.then(function(K){(M._status===0||M._status===-1)&&(M._status=1,M._result=K)},function(K){(M._status===0||M._status===-1)&&(M._status=2,M._result=K)}),M._status===-1&&(M._status=0,M._result=G)}if(M._status===1)return M._result.default;throw M._result}var re={current:null},J={transition:null},W={ReactCurrentDispatcher:re,ReactCurrentBatchConfig:J,ReactCurrentOwner:O};function Z(){throw Error("act(...) is not supported in production builds of React.")}return Le.Children={map:$,forEach:function(M,G,K){$(M,function(){G.apply(this,arguments)},K)},count:function(M){var G=0;return $(M,function(){G++}),G},toArray:function(M){return $(M,function(G){return G})||[]},only:function(M){if(!P(M))throw Error("React.Children.only expected to receive a single React element child.");return M}},Le.Component=S,Le.Fragment=r,Le.Profiler=o,Le.PureComponent=k,Le.StrictMode=i,Le.Suspense=h,Le.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,Le.act=Z,Le.cloneElement=function(M,G,K){if(M==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+M+".");var q=N({},M.props),Q=M.key,ne=M.ref,ae=M._owner;if(G!=null){if(G.ref!==void 0&&(ne=G.ref,ae=O.current),G.key!==void 0&&(Q=""+G.key),M.type&&M.type.defaultProps)var fe=M.type.defaultProps;for(te in G)I.call(G,te)&&!A.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:M.type,key:Q,ref:ne,props:q,_owner:ae}},Le.createContext=function(M){return M={$$typeof:u,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},M.Provider={$$typeof:l,_context:M},M.Consumer=M},Le.createElement=U,Le.createFactory=function(M){var G=U.bind(null,M);return G.type=M,G},Le.createRef=function(){return{current:null}},Le.forwardRef=function(M){return{$$typeof:c,render:M}},Le.isValidElement=P,Le.lazy=function(M){return{$$typeof:d,_payload:{_status:-1,_result:M},_init:L}},Le.memo=function(M,G){return{$$typeof:p,type:M,compare:G===void 0?null:G}},Le.startTransition=function(M){var G=J.transition;J.transition={};try{M()}finally{J.transition=G}},Le.unstable_act=Z,Le.useCallback=function(M,G){return re.current.useCallback(M,G)},Le.useContext=function(M){return re.current.useContext(M)},Le.useDebugValue=function(){},Le.useDeferredValue=function(M){return re.current.useDeferredValue(M)},Le.useEffect=function(M,G){return re.current.useEffect(M,G)},Le.useId=function(){return re.current.useId()},Le.useImperativeHandle=function(M,G,K){return re.current.useImperativeHandle(M,G,K)},Le.useInsertionEffect=function(M,G){return re.current.useInsertionEffect(M,G)},Le.useLayoutEffect=function(M,G){return re.current.useLayoutEffect(M,G)},Le.useMemo=function(M,G){return re.current.useMemo(M,G)},Le.useReducer=function(M,G,K){return re.current.useReducer(M,G,K)},Le.useRef=function(M){return re.current.useRef(M)},Le.useState=function(M){return re.current.useState(M)},Le.useSyncExternalStore=function(M,G,K){return re.current.useSyncExternalStore(M,G,K)},Le.useTransition=function(){return re.current.useTransition()},Le.version="18.3.1",Le}var Lw;function Ca(){return Lw||(Lw=1,Td.exports=tj()),Td.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 qw;function nj(){if(qw)return ra;qw=1;var e=Ca(),n=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,h,p){var d,m={},y=null,w=null;p!==void 0&&(y=""+p),h.key!==void 0&&(y=""+h.key),h.ref!==void 0&&(w=h.ref);for(d in h)i.call(h,d)&&!l.hasOwnProperty(d)&&(m[d]=h[d]);if(c&&c.defaultProps)for(d in h=c.defaultProps,h)m[d]===void 0&&(m[d]=h[d]);return{$$typeof:n,type:c,key:y,ref:w,props:m,_owner:o.current}}return ra.Fragment=r,ra.jsx=u,ra.jsxs=u,ra}var $w;function rj(){return $w||($w=1,Cd.exports=nj()),Cd.exports}var g=rj(),Wl={},Rd={exports:{}},un={},jd={exports:{}},Ad={};/**
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 Dw;function sj(){return Dw||(Dw=1,(function(e){function n(J,W){var Z=J.length;J.push(W);e:for(;0<Z;){var M=Z-1>>>1,G=J[M];if(0<o(G,W))J[M]=W,J[Z]=G,Z=M;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 M=0,G=J.length,K=G>>>1;M<K;){var q=2*(M+1)-1,Q=J[q],ne=q+1,ae=J[ne];if(0>o(Q,Z))ne<G&&0>o(ae,Q)?(J[M]=ae,J[ne]=Z,M=ne):(J[M]=Q,J[q]=Z,M=q);else if(ne<G&&0>o(ae,Z))J[M]=ae,J[ne]=Z,M=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 h=[],p=[],d=1,m=null,y=3,w=!1,N=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,b=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 E(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,n(h,W);else break;W=r(p)}}function T(J){if(_=!1,E(J),!N)if(r(h)!==null)N=!0,L(I);else{var W=r(p);W!==null&&re(T,W.startTime-J)}}function I(J,W){N=!1,_&&(_=!1,b(U),U=-1),w=!0;var Z=y;try{for(E(W),m=r(h);m!==null&&(!(m.expirationTime>W)||J&&!D());){var M=m.callback;if(typeof M=="function"){m.callback=null,y=m.priorityLevel;var G=M(m.expirationTime<=W);W=e.unstable_now(),typeof G=="function"?m.callback=G:m===r(h)&&i(h),E(W)}else i(h);m=r(h)}if(m!==null)var K=!0;else{var q=r(p);q!==null&&re(T,q.startTime-W),K=!1}return K}finally{m=null,y=Z,w=!1}}var O=!1,A=null,U=-1,z=5,P=-1;function D(){return!(e.unstable_now()-P<z)}function V(){if(A!==null){var J=e.unstable_now();P=J;var W=!0;try{W=A(!0,J)}finally{W?B():(O=!1,A=null)}}else O=!1}var B;if(typeof k=="function")B=function(){k(V)};else if(typeof MessageChannel<"u"){var C=new MessageChannel,$=C.port2;C.port1.onmessage=V,B=function(){$.postMessage(null)}}else B=function(){S(V,0)};function L(J){A=J,O||(O=!0,B())}function re(J,W){U=S(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(){N||w||(N=!0,L(I))},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"):z=0<J?Math.floor(1e3/J):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return r(h)},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 M=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?M+Z:M):Z=M,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>M?(J.sortIndex=Z,n(p,J),r(h)===null&&J===r(p)&&(_?(b(U),U=-1):_=!0,re(T,Z-M))):(J.sortIndex=G,n(h,J),N||w||(N=!0,L(I))),J},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(J){var W=y;return function(){var Z=y;y=W;try{return J.apply(this,arguments)}finally{y=Z}}}})(Ad)),Ad}var Fw;function ij(){return Fw||(Fw=1,jd.exports=sj()),jd.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 zw;function oj(){if(zw)return un;zw=1;var e=Ca(),n=ij();function r(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,a=1;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+t+"; 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(t,s){u(t,s),u(t+"Capture",s)}function u(t,s){for(o[t]=s,t=0;t<s.length;t++)i.add(s[t])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},m={};function y(t){return h.call(m,t)?!0:h.call(d,t)?!1:p.test(t)?m[t]=!0:(d[t]=!0,!1)}function w(t,s,a,f){if(a!==null&&a.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return f?!1:a!==null?!a.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function N(t,s,a,f){if(s===null||typeof s>"u"||w(t,s,a,f))return!0;if(f)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 _(t,s,a,f,v,x,R){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=f,this.attributeNamespace=v,this.mustUseProperty=a,this.propertyName=t,this.type=s,this.sanitizeURL=x,this.removeEmptyString=R}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){S[t]=new _(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var s=t[0];S[s]=new _(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){S[t]=new _(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){S[t]=new _(t,2,!1,t,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(t){S[t]=new _(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){S[t]=new _(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){S[t]=new _(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){S[t]=new _(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){S[t]=new _(t,5,!1,t.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function k(t){return t[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(t){var s=t.replace(b,k);S[s]=new _(s,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var s=t.replace(b,k);S[s]=new _(s,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var s=t.replace(b,k);S[s]=new _(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){S[t]=new _(t,1,!1,t.toLowerCase(),null,!1,!1)}),S.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){S[t]=new _(t,1,!1,t.toLowerCase(),null,!0,!0)});function E(t,s,a,f){var v=S.hasOwnProperty(s)?S[s]:null;(v!==null?v.type!==0:f||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(N(s,a,v,f)&&(a=null),f||v===null?y(s)&&(a===null?t.removeAttribute(s):t.setAttribute(s,""+a)):v.mustUseProperty?t[v.propertyName]=a===null?v.type===3?!1:"":a:(s=v.attributeName,f=v.attributeNamespace,a===null?t.removeAttribute(s):(v=v.type,a=v===3||v===4&&a===!0?"":""+a,f?t.setAttributeNS(f,s,a):t.setAttribute(s,a))))}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),O=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),P=Symbol.for("react.provider"),D=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),re=Symbol.for("react.offscreen"),J=Symbol.iterator;function W(t){return t===null||typeof t!="object"?null:(t=J&&t[J]||t["@@iterator"],typeof t=="function"?t:null)}var Z=Object.assign,M;function G(t){if(M===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);M=s&&s[1]||""}return`
34
+ `+M+t}var K=!1;function q(t,s){if(!t||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 f=le}Reflect.construct(t,[],s)}else{try{s.call()}catch(le){f=le}t.call(s.prototype)}else{try{throw Error()}catch(le){f=le}t()}}catch(le){if(le&&f&&typeof le.stack=="string"){for(var v=le.stack.split(`
35
+ `),x=f.stack.split(`
36
+ `),R=v.length-1,F=x.length-1;1<=R&&0<=F&&v[R]!==x[F];)F--;for(;1<=R&&0<=F;R--,F--)if(v[R]!==x[F]){if(R!==1||F!==1)do if(R--,F--,0>F||v[R]!==x[F]){var X=`
37
+ `+v[R].replace(" at new "," at ");return t.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",t.displayName)),X}while(1<=R&&0<=F);break}}}finally{K=!1,Error.prepareStackTrace=a}return(t=t?t.displayName||t.name:"")?G(t):""}function Q(t){switch(t.tag){case 5:return G(t.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return t=q(t.type,!1),t;case 11:return t=q(t.type.render,!1),t;case 1:return t=q(t.type,!0),t;default:return""}}function ne(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case A:return"Fragment";case O:return"Portal";case z:return"Profiler";case U:return"StrictMode";case B:return"Suspense";case C:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case D:return(t.displayName||"Context")+".Consumer";case P:return(t._context.displayName||"Context")+".Provider";case V:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case $:return s=t.displayName||null,s!==null?s:ne(t.type)||"Memo";case L:s=t._payload,t=t._init;try{return ne(t(s))}catch{}}return null}function ae(t){var s=t.type;switch(t.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 t=s.render,t=t.displayName||t.name||"",s.displayName||(t!==""?"ForwardRef("+t+")":"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===U?"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(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function te(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ce(t){var s=te(t)?"checked":"value",a=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),f=""+t[s];if(!t.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var v=a.get,x=a.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return v.call(this)},set:function(R){f=""+R,x.call(this,R)}}),Object.defineProperty(t,s,{enumerable:a.enumerable}),{getValue:function(){return f},setValue:function(R){f=""+R},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function Ce(t){t._valueTracker||(t._valueTracker=ce(t))}function ve(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var a=s.getValue(),f="";return t&&(f=te(t)?t.checked?"true":"false":t.value),t=f,t!==a?(s.setValue(t),!0):!1}function je(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function ye(t,s){var a=s.checked;return Z({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??t._wrapperState.initialChecked})}function Ee(t,s){var a=s.defaultValue==null?"":s.defaultValue,f=s.checked!=null?s.checked:s.defaultChecked;a=fe(s.value!=null?s.value:a),t._wrapperState={initialChecked:f,initialValue:a,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Ye(t,s){s=s.checked,s!=null&&E(t,"checked",s,!1)}function we(t,s){Ye(t,s);var a=fe(s.value),f=s.type;if(a!=null)f==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+a):t.value!==""+a&&(t.value=""+a);else if(f==="submit"||f==="reset"){t.removeAttribute("value");return}s.hasOwnProperty("value")?Be(t,s.type,a):s.hasOwnProperty("defaultValue")&&Be(t,s.type,fe(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(t.defaultChecked=!!s.defaultChecked)}function _e(t,s,a){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var f=s.type;if(!(f!=="submit"&&f!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+t._wrapperState.initialValue,a||s===t.value||(t.value=s),t.defaultValue=s}a=t.name,a!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,a!==""&&(t.name=a)}function Be(t,s,a){(s!=="number"||je(t.ownerDocument)!==t)&&(a==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+a&&(t.defaultValue=""+a))}var it=Array.isArray;function ft(t,s,a,f){if(t=t.options,s){s={};for(var v=0;v<a.length;v++)s["$"+a[v]]=!0;for(a=0;a<t.length;a++)v=s.hasOwnProperty("$"+t[a].value),t[a].selected!==v&&(t[a].selected=v),v&&f&&(t[a].defaultSelected=!0)}else{for(a=""+fe(a),s=null,v=0;v<t.length;v++){if(t[v].value===a){t[v].selected=!0,f&&(t[v].defaultSelected=!0);return}s!==null||t[v].disabled||(s=t[v])}s!==null&&(s.selected=!0)}}function Ze(t,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return Z({},s,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function $e(t,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}t._wrapperState={initialValue:fe(a)}}function Je(t,s){var a=fe(s.value),f=fe(s.defaultValue);a!=null&&(a=""+a,a!==t.value&&(t.value=a),s.defaultValue==null&&t.defaultValue!==a&&(t.defaultValue=a)),f!=null&&(t.defaultValue=""+f)}function Xe(t){var s=t.textContent;s===t._wrapperState.initialValue&&s!==""&&s!==null&&(t.value=s)}function Ot(t){switch(t){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(t,s){return t==null||t==="http://www.w3.org/1999/xhtml"?Ot(s):t==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Qe,Pt=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,a,f,v){MSApp.execUnsafeLocalFunction(function(){return t(s,a,f,v)})}:t})(function(t,s){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=s;else{for(Qe=Qe||document.createElement("div"),Qe.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Qe.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;s.firstChild;)t.appendChild(s.firstChild)}});function zt(t,s){if(s){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=s;return}}t.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(t){bt.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),et[s]=et[t]})});function ht(t,s,a){return s==null||typeof s=="boolean"||s===""?"":a||typeof s!="number"||s===0||et.hasOwnProperty(t)&&et[t]?(""+s).trim():s+"px"}function vt(t,s){t=t.style;for(var a in s)if(s.hasOwnProperty(a)){var f=a.indexOf("--")===0,v=ht(a,s[a],f);a==="float"&&(a="cssFloat"),f?t.setProperty(a,v):t[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(t,s){if(s){if(hn[t]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,t));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(t,s){if(t.indexOf("-")===-1)return typeof s.is=="string";switch(t){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(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Sn=null,Bt=null,Fn=null;function pn(t){if(t=Bo(t)){if(typeof Sn!="function")throw Error(r(280));var s=t.stateNode;s&&(s=il(s),Sn(t.stateNode,t.type,s))}}function vr(t){Bt?Fn?Fn.push(t):Fn=[t]:Bt=t}function Hr(){if(Bt){var t=Bt,s=Fn;if(Fn=Bt=null,pn(t),s)for(t=0;t<s.length;t++)pn(s[t])}}function xi(t,s){return t(s)}function Wr(){}var ut=!1;function _i(t,s,a){if(ut)return t(s,a);ut=!0;try{return xi(t,s,a)}finally{ut=!1,(Bt!==null||Fn!==null)&&(Wr(),Hr())}}function mn(t,s){var a=t.stateNode;if(a===null)return null;var f=il(a);if(f===null)return null;a=f[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":(f=!f.disabled)||(t=t.type,f=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!f;break e;default:t=!1}if(t)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(t,s,a,f,v,x,R,F,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(t){kn=!0,Vr=t}};function sr(t,s,a,f,v,x,R,F,X){kn=!1,Vr=null,zn.apply(bi,arguments)}function Ms(t,s,a,f,v,x,R,F,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(t){var s=t,a=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(a=s.return),t=s.return;while(t)}return s.tag===3?a:null}function wr(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function Os(t){if(En(t)!==t)throw Error(r(188))}function Ps(t){var s=t.alternate;if(!s){if(s=En(t),s===null)throw Error(r(188));return s!==t?null:t}for(var a=t,f=s;;){var v=a.return;if(v===null)break;var x=v.alternate;if(x===null){if(f=v.return,f!==null){a=f;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===a)return Os(v),t;if(x===f)return Os(v),s;x=x.sibling}throw Error(r(188))}if(a.return!==f.return)a=v,f=x;else{for(var R=!1,F=v.child;F;){if(F===a){R=!0,a=v,f=x;break}if(F===f){R=!0,f=v,a=x;break}F=F.sibling}if(!R){for(F=x.child;F;){if(F===a){R=!0,a=x,f=v;break}if(F===f){R=!0,f=x,a=v;break}F=F.sibling}if(!R)throw Error(r(189))}}if(a.alternate!==f)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?t:s}function Tt(t){return t=Ps(t),t!==null?xr(t):null}function xr(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var s=xr(t);if(s!==null)return s;t=t.sibling}return null}var _r=n.unstable_scheduleCallback,Kt=n.unstable_cancelCallback,Kr=n.unstable_shouldYield,Si=n.unstable_requestPaint,nt=n.unstable_now,br=n.unstable_getCurrentPriorityLevel,Xr=n.unstable_ImmediatePriority,Ls=n.unstable_UserBlockingPriority,Qr=n.unstable_NormalPriority,Zr=n.unstable_LowPriority,qs=n.unstable_IdlePriority,ir=null,St=null;function $s(t){if(St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(ir,t,void 0,(t.current.flags&128)===128)}catch{}}var pt=Math.clz32?Math.clz32:Da,ko=Math.log,Eo=Math.LN2;function Da(t){return t>>>=0,t===0?32:31-(ko(t)/Eo|0)|0}var Sr=64,Jr=4194304;function gn(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ds(t,s){var a=t.pendingLanes;if(a===0)return 0;var f=0,v=t.suspendedLanes,x=t.pingedLanes,R=a&268435455;if(R!==0){var F=R&~v;F!==0?f=gn(F):(x&=R,x!==0&&(f=gn(x)))}else R=a&~v,R!==0?f=gn(R):x!==0&&(f=gn(x));if(f===0)return 0;if(s!==0&&s!==f&&(s&v)===0&&(v=f&-f,x=s&-s,v>=x||v===16&&(x&4194240)!==0))return s;if((f&4)!==0&&(f|=a&16),s=t.entangledLanes,s!==0)for(t=t.entanglements,s&=f;0<s;)a=31-pt(s),v=1<<a,f|=t[a],s&=~v;return f}function Fa(t,s){switch(t){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 za(t,s){for(var a=t.suspendedLanes,f=t.pingedLanes,v=t.expirationTimes,x=t.pendingLanes;0<x;){var R=31-pt(x),F=1<<R,X=v[R];X===-1?((F&a)===0||(F&f)!==0)&&(v[R]=Fa(F,s)):X<=s&&(t.expiredLanes|=F),x&=~F}}function No(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function ki(){var t=Sr;return Sr<<=1,(Sr&4194240)===0&&(Sr=64),t}function or(t){for(var s=[],a=0;31>a;a++)s.push(t);return s}function es(t,s,a){t.pendingLanes|=s,s!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,s=31-pt(s),t[s]=a}function nc(t,s){var a=t.pendingLanes&~s;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=s,t.mutableReadLanes&=s,t.entangledLanes&=s,s=t.entanglements;var f=t.eventTimes;for(t=t.expirationTimes;0<a;){var v=31-pt(a),x=1<<v;s[v]=0,f[v]=-1,t[v]=-1,a&=~x}}function Ei(t,s){var a=t.entangledLanes|=s;for(t=t.entanglements;a;){var f=31-pt(a),v=1<<f;v&s|t[f]&s&&(t[f]|=s),a&=~v}}var He=0;function Ba(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var Xt,Co,Ni,kr,ts,Fs=!1,Nn=[],Bn=null,vn=null,Un=null,zs=new Map,Bs=new Map,Hn=[],rc="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 Ua(t,s){switch(t){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(t,s,a,f,v,x){return t===null||t.nativeEvent!==x?(t={blockedOn:s,domEventName:a,eventSystemFlags:f,nativeEvent:x,targetContainers:[v]},s!==null&&(s=Bo(s),s!==null&&Co(s)),t):(t.eventSystemFlags|=f,s=t.targetContainers,v!==null&&s.indexOf(v)===-1&&s.push(v),t)}function ar(t,s,a,f,v){switch(s){case"focusin":return Bn=Er(Bn,t,s,a,f,v),!0;case"dragenter":return vn=Er(vn,t,s,a,f,v),!0;case"mouseover":return Un=Er(Un,t,s,a,f,v),!0;case"pointerover":var x=v.pointerId;return zs.set(x,Er(zs.get(x)||null,t,s,a,f,v)),!0;case"gotpointercapture":return x=v.pointerId,Bs.set(x,Er(Bs.get(x)||null,t,s,a,f,v)),!0}return!1}function Ci(t){var s=Xs(t.target);if(s!==null){var a=En(s);if(a!==null){if(s=a.tag,s===13){if(s=wr(a),s!==null){t.blockedOn=s,ts(t.priority,function(){Ni(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Us(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var a=ss(t.domEventName,t.eventSystemFlags,s[0],t.nativeEvent);if(a===null){a=t.nativeEvent;var f=new a.constructor(a.type,a);bn=f,a.target.dispatchEvent(f),bn=null}else return s=Bo(a),s!==null&&Co(s),t.blockedOn=a,!1;s.shift()}return!0}function Ha(t,s,a){Us(t)&&a.delete(s)}function sc(){Fs=!1,Bn!==null&&Us(Bn)&&(Bn=null),vn!==null&&Us(vn)&&(vn=null),Un!==null&&Us(Un)&&(Un=null),zs.forEach(Ha),Bs.forEach(Ha)}function ns(t,s){t.blockedOn===s&&(t.blockedOn=null,Fs||(Fs=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,sc)))}function rs(t){function s(v){return ns(v,t)}if(0<Nn.length){ns(Nn[0],t);for(var a=1;a<Nn.length;a++){var f=Nn[a];f.blockedOn===t&&(f.blockedOn=null)}}for(Bn!==null&&ns(Bn,t),vn!==null&&ns(vn,t),Un!==null&&ns(Un,t),zs.forEach(s),Bs.forEach(s),a=0;a<Hn.length;a++)f=Hn[a],f.blockedOn===t&&(f.blockedOn=null);for(;0<Hn.length&&(a=Hn[0],a.blockedOn===null);)Ci(a),a.blockedOn===null&&Hn.shift()}var Qt=T.ReactCurrentBatchConfig,Ti=!0;function Wa(t,s,a,f){var v=He,x=Qt.transition;Qt.transition=null;try{He=1,Nr(t,s,a,f)}finally{He=v,Qt.transition=x}}function ic(t,s,a,f){var v=He,x=Qt.transition;Qt.transition=null;try{He=4,Nr(t,s,a,f)}finally{He=v,Qt.transition=x}}function Nr(t,s,a,f){if(Ti){var v=ss(t,s,a,f);if(v===null)vc(t,s,f,Cn,a),Ua(t,f);else if(ar(v,t,s,a,f))f.stopPropagation();else if(Ua(t,f),s&4&&-1<rc.indexOf(t)){for(;v!==null;){var x=Bo(v);if(x!==null&&Xt(x),x=ss(t,s,a,f),x===null&&vc(t,s,f,Cn,a),x===v)break;v=x}v!==null&&f.stopPropagation()}else vc(t,s,f,null,a)}}var Cn=null;function ss(t,s,a,f){if(Cn=null,t=gr(f),t=Xs(t),t!==null)if(s=En(t),s===null)t=null;else if(a=s.tag,a===13){if(t=wr(s),t!==null)return t;t=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null);return Cn=t,null}function is(t){switch(t){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 qs:return 536870912;default:return 16}default:return 16}}var lr=null,Rt=null,os=null;function To(){if(os)return os;var t,s=Rt,a=s.length,f,v="value"in lr?lr.value:lr.textContent,x=v.length;for(t=0;t<a&&s[t]===v[t];t++);var R=a-t;for(f=1;f<=R&&s[a-f]===v[x-f];f++);return os=v.slice(t,1<f?1-f:void 0)}function Hs(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function Ws(){return!0}function Vs(){return!1}function qt(t){function s(a,f,v,x,R){this._reactName=a,this._targetInst=v,this.type=f,this.nativeEvent=x,this.target=R,this.currentTarget=null;for(var F in t)t.hasOwnProperty(F)&&(a=t[F],this[F]=a?a(x):x[F]);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(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},as=qt(Cr),ls=Z({},Cr,{view:0,detail:0}),Ro=qt(ls),Ri,Tr,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(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Gs&&(Gs&&t.type==="mousemove"?(Ri=t.screenX-Gs.screenX,Tr=t.screenY-Gs.screenY):Tr=Ri=0,Gs=t),Ri)},movementY:function(t){return"movementY"in t?t.movementY:Tr}}),jo=qt(tn),Va=Z({},tn,{dataTransfer:0}),oc=qt(Va),ac=Z({},ls,{relatedTarget:0}),ji=qt(ac),nn=Z({},Cr,{animationName:0,elapsedTime:0,pseudoElement:0}),Ga=qt(nn),Ya=Z({},Cr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Ka=qt(Ya),Xa=Z({},Cr,{data:0}),H=qt(Xa),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(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=de[t])?!!s[t]:!1}function Se(){return xe}var Pe=Z({},ls,{key:function(t){if(t.key){var s=Y[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=Hs(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?oe[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Se,charCode:function(t){return t.type==="keypress"?Hs(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Hs(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),De=qt(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=qt(Ge),Fe=Z({},ls,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Se}),Tn=qt(Fe),Ys=Z({},Cr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ao=qt(Ys),Ks=Z({},tn,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Io=qt(Ks),Qa=[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,Mo=c&&(!us||Zt&&8<Zt&&11>=Zt),Ty=" ",Ry=!1;function jy(t,s){switch(t){case"keyup":return Qa.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ay(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ai=!1;function ZT(t,s){switch(t){case"compositionend":return Ay(s);case"keypress":return s.which!==32?null:(Ry=!0,Ty);case"textInput":return t=s.data,t===Ty&&Ry?null:t;default:return null}}function JT(t,s){if(Ai)return t==="compositionend"||!us&&jy(t,s)?(t=To(),os=Rt=lr=null,Ai=!1,t):null;switch(t){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 Mo&&s.locale!=="ko"?null:s.data;default:return null}}var eR={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 Iy(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!eR[t.type]:s==="textarea"}function My(t,s,a,f){vr(f),s=nl(s,"onChange"),0<s.length&&(a=new as("onChange","change",null,a,f),t.push({event:a,listeners:s}))}var Oo=null,Po=null;function tR(t){Qy(t,0)}function Za(t){var s=Li(t);if(ve(s))return t}function nR(t,s){if(t==="change")return s}var Oy=!1;if(c){var lc;if(c){var uc="oninput"in document;if(!uc){var Py=document.createElement("div");Py.setAttribute("oninput","return;"),uc=typeof Py.oninput=="function"}lc=uc}else lc=!1;Oy=lc&&(!document.documentMode||9<document.documentMode)}function Ly(){Oo&&(Oo.detachEvent("onpropertychange",qy),Po=Oo=null)}function qy(t){if(t.propertyName==="value"&&Za(Po)){var s=[];My(s,Po,t,gr(t)),_i(tR,s)}}function rR(t,s,a){t==="focusin"?(Ly(),Oo=s,Po=a,Oo.attachEvent("onpropertychange",qy)):t==="focusout"&&Ly()}function sR(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Za(Po)}function iR(t,s){if(t==="click")return Za(s)}function oR(t,s){if(t==="input"||t==="change")return Za(s)}function aR(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var Wn=typeof Object.is=="function"?Object.is:aR;function Lo(t,s){if(Wn(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var a=Object.keys(t),f=Object.keys(s);if(a.length!==f.length)return!1;for(f=0;f<a.length;f++){var v=a[f];if(!h.call(s,v)||!Wn(t[v],s[v]))return!1}return!0}function $y(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Dy(t,s){var a=$y(t);t=0;for(var f;a;){if(a.nodeType===3){if(f=t+a.textContent.length,t<=s&&f>=s)return{node:a,offset:s-t};t=f}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=$y(a)}}function Fy(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Fy(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function zy(){for(var t=window,s=je();s instanceof t.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)t=s.contentWindow;else break;s=je(t.document)}return s}function cc(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}function lR(t){var s=zy(),a=t.focusedElem,f=t.selectionRange;if(s!==a&&a&&a.ownerDocument&&Fy(a.ownerDocument.documentElement,a)){if(f!==null&&cc(a)){if(s=f.start,t=f.end,t===void 0&&(t=s),"selectionStart"in a)a.selectionStart=s,a.selectionEnd=Math.min(t,a.value.length);else if(t=(s=a.ownerDocument||document)&&s.defaultView||window,t.getSelection){t=t.getSelection();var v=a.textContent.length,x=Math.min(f.start,v);f=f.end===void 0?x:Math.min(f.end,v),!t.extend&&x>f&&(v=f,f=x,x=v),v=Dy(a,x);var R=Dy(a,f);v&&R&&(t.rangeCount!==1||t.anchorNode!==v.node||t.anchorOffset!==v.offset||t.focusNode!==R.node||t.focusOffset!==R.offset)&&(s=s.createRange(),s.setStart(v.node,v.offset),t.removeAllRanges(),x>f?(t.addRange(s),t.extend(R.node,R.offset)):(s.setEnd(R.node,R.offset),t.addRange(s)))}}for(s=[],t=a;t=t.parentNode;)t.nodeType===1&&s.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<s.length;a++)t=s[a],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var uR=c&&"documentMode"in document&&11>=document.documentMode,Ii=null,dc=null,qo=null,fc=!1;function By(t,s,a){var f=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;fc||Ii==null||Ii!==je(f)||(f=Ii,"selectionStart"in f&&cc(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),qo&&Lo(qo,f)||(qo=f,f=nl(dc,"onSelect"),0<f.length&&(s=new as("onSelect","select",null,s,a),t.push({event:s,listeners:f}),s.target=Ii)))}function Ja(t,s){var a={};return a[t.toLowerCase()]=s.toLowerCase(),a["Webkit"+t]="webkit"+s,a["Moz"+t]="moz"+s,a}var Mi={animationend:Ja("Animation","AnimationEnd"),animationiteration:Ja("Animation","AnimationIteration"),animationstart:Ja("Animation","AnimationStart"),transitionend:Ja("Transition","TransitionEnd")},hc={},Uy={};c&&(Uy=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 el(t){if(hc[t])return hc[t];if(!Mi[t])return t;var s=Mi[t],a;for(a in s)if(s.hasOwnProperty(a)&&a in Uy)return hc[t]=s[a];return t}var Hy=el("animationend"),Wy=el("animationiteration"),Vy=el("animationstart"),Gy=el("transitionend"),Yy=new Map,Ky="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(t,s){Yy.set(t,s),l(s,[t])}for(var pc=0;pc<Ky.length;pc++){var mc=Ky[pc],cR=mc.toLowerCase(),dR=mc[0].toUpperCase()+mc.slice(1);cs(cR,"on"+dR)}cs(Hy,"onAnimationEnd"),cs(Wy,"onAnimationIteration"),cs(Vy,"onAnimationStart"),cs("dblclick","onDoubleClick"),cs("focusin","onFocus"),cs("focusout","onBlur"),cs(Gy,"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 $o="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(" "),fR=new Set("cancel close invalid load scroll toggle".split(" ").concat($o));function Xy(t,s,a){var f=t.type||"unknown-event";t.currentTarget=a,Ms(f,s,void 0,t),t.currentTarget=null}function Qy(t,s){s=(s&4)!==0;for(var a=0;a<t.length;a++){var f=t[a],v=f.event;f=f.listeners;e:{var x=void 0;if(s)for(var R=f.length-1;0<=R;R--){var F=f[R],X=F.instance,le=F.currentTarget;if(F=F.listener,X!==x&&v.isPropagationStopped())break e;Xy(v,F,le),x=X}else for(R=0;R<f.length;R++){if(F=f[R],X=F.instance,le=F.currentTarget,F=F.listener,X!==x&&v.isPropagationStopped())break e;Xy(v,F,le),x=X}}}if(Gr)throw t=Yr,Gr=!1,Yr=null,t}function rt(t,s){var a=s[Sc];a===void 0&&(a=s[Sc]=new Set);var f=t+"__bubble";a.has(f)||(Zy(s,t,2,!1),a.add(f))}function gc(t,s,a){var f=0;s&&(f|=4),Zy(a,t,f,s)}var tl="_reactListening"+Math.random().toString(36).slice(2);function Do(t){if(!t[tl]){t[tl]=!0,i.forEach(function(a){a!=="selectionchange"&&(fR.has(a)||gc(a,!1,t),gc(a,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[tl]||(s[tl]=!0,gc("selectionchange",!1,s))}}function Zy(t,s,a,f){switch(is(s)){case 1:var v=Wa;break;case 4:v=ic;break;default:v=Nr}a=v.bind(null,s,a,t),v=void 0,!Is||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(v=!0),f?v!==void 0?t.addEventListener(s,a,{capture:!0,passive:v}):t.addEventListener(s,a,!0):v!==void 0?t.addEventListener(s,a,{passive:v}):t.addEventListener(s,a,!1)}function vc(t,s,a,f,v){var x=f;if((s&1)===0&&(s&2)===0&&f!==null)e:for(;;){if(f===null)return;var R=f.tag;if(R===3||R===4){var F=f.stateNode.containerInfo;if(F===v||F.nodeType===8&&F.parentNode===v)break;if(R===4)for(R=f.return;R!==null;){var X=R.tag;if((X===3||X===4)&&(X=R.stateNode.containerInfo,X===v||X.nodeType===8&&X.parentNode===v))return;R=R.return}for(;F!==null;){if(R=Xs(F),R===null)return;if(X=R.tag,X===5||X===6){f=x=R;continue e}F=F.parentNode}}f=f.return}_i(function(){var le=x,pe=gr(a),me=[];e:{var he=Yy.get(t);if(he!==void 0){var be=as,Ne=t;switch(t){case"keypress":if(Hs(a)===0)break e;case"keydown":case"keyup":be=De;break;case"focusin":Ne="focus",be=ji;break;case"focusout":Ne="blur",be=ji;break;case"beforeblur":case"afterblur":be=ji;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=jo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":be=oc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":be=Tn;break;case Hy:case Wy:case Vy:be=Ga;break;case Gy:be=Ao;break;case"scroll":be=Ro;break;case"wheel":be=Io;break;case"copy":case"cut":case"paste":be=Ka;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":be=We}var Te=(s&4)!==0,yt=!Te&&t==="scroll",se=Te?he!==null?he+"Capture":null:he;Te=[];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&&Te.push(Fo(ee,ge,ie)))),yt)break;ee=ee.return}0<Te.length&&(he=new be(he,Ne,null,a,pe),me.push({event:he,listeners:Te}))}}if((s&7)===0){e:{if(he=t==="mouseover"||t==="pointerover",be=t==="mouseout"||t==="pointerout",he&&a!==bn&&(Ne=a.relatedTarget||a.fromElement)&&(Xs(Ne)||Ne[Rr]))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(Te=jo,ge="onMouseLeave",se="onMouseEnter",ee="mouse",(t==="pointerout"||t==="pointerover")&&(Te=We,ge="onPointerLeave",se="onPointerEnter",ee="pointer"),yt=be==null?he:Li(be),ie=Ne==null?he:Li(Ne),he=new Te(ge,ee+"leave",be,a,pe),he.target=yt,he.relatedTarget=ie,ge=null,Xs(pe)===le&&(Te=new Te(se,ee+"enter",Ne,a,pe),Te.target=ie,Te.relatedTarget=yt,ge=Te),yt=ge,be&&Ne)t:{for(Te=be,se=Ne,ee=0,ie=Te;ie;ie=Oi(ie))ee++;for(ie=0,ge=se;ge;ge=Oi(ge))ie++;for(;0<ee-ie;)Te=Oi(Te),ee--;for(;0<ie-ee;)se=Oi(se),ie--;for(;ee--;){if(Te===se||se!==null&&Te===se.alternate)break t;Te=Oi(Te),se=Oi(se)}Te=null}else Te=null;be!==null&&Jy(me,he,be,Te,!1),Ne!==null&&yt!==null&&Jy(me,yt,Ne,Te,!0)}}e:{if(he=le?Li(le):window,be=he.nodeName&&he.nodeName.toLowerCase(),be==="select"||be==="input"&&he.type==="file")var Re=nR;else if(Iy(he))if(Oy)Re=oR;else{Re=sR;var Ie=rR}else(be=he.nodeName)&&be.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(Re=iR);if(Re&&(Re=Re(t,le))){My(me,Re,a,pe);break e}Ie&&Ie(t,he,le),t==="focusout"&&(Ie=he._wrapperState)&&Ie.controlled&&he.type==="number"&&Be(he,"number",he.value)}switch(Ie=le?Li(le):window,t){case"focusin":(Iy(Ie)||Ie.contentEditable==="true")&&(Ii=Ie,dc=le,qo=null);break;case"focusout":qo=dc=Ii=null;break;case"mousedown":fc=!0;break;case"contextmenu":case"mouseup":case"dragend":fc=!1,By(me,a,pe);break;case"selectionchange":if(uR)break;case"keydown":case"keyup":By(me,a,pe)}var Me;if(us)e:{switch(t){case"compositionstart":var Oe="onCompositionStart";break e;case"compositionend":Oe="onCompositionEnd";break e;case"compositionupdate":Oe="onCompositionUpdate";break e}Oe=void 0}else Ai?jy(t,a)&&(Oe="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Oe="onCompositionStart");Oe&&(Mo&&a.locale!=="ko"&&(Ai||Oe!=="onCompositionStart"?Oe==="onCompositionEnd"&&Ai&&(Me=To()):(lr=pe,Rt="value"in lr?lr.value:lr.textContent,Ai=!0)),Ie=nl(le,Oe),0<Ie.length&&(Oe=new H(Oe,t,null,a,pe),me.push({event:Oe,listeners:Ie}),Me?Oe.data=Me:(Me=Ay(a),Me!==null&&(Oe.data=Me)))),(Me=wt?ZT(t,a):JT(t,a))&&(le=nl(le,"onBeforeInput"),0<le.length&&(pe=new H("onBeforeInput","beforeinput",null,a,pe),me.push({event:pe,listeners:le}),pe.data=Me))}Qy(me,s)})}function Fo(t,s,a){return{instance:t,listener:s,currentTarget:a}}function nl(t,s){for(var a=s+"Capture",f=[];t!==null;){var v=t,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=mn(t,a),x!=null&&f.unshift(Fo(t,x,v)),x=mn(t,s),x!=null&&f.push(Fo(t,x,v))),t=t.return}return f}function Oi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Jy(t,s,a,f,v){for(var x=s._reactName,R=[];a!==null&&a!==f;){var F=a,X=F.alternate,le=F.stateNode;if(X!==null&&X===f)break;F.tag===5&&le!==null&&(F=le,v?(X=mn(a,x),X!=null&&R.unshift(Fo(a,X,F))):v||(X=mn(a,x),X!=null&&R.push(Fo(a,X,F)))),a=a.return}R.length!==0&&t.push({event:s,listeners:R})}var hR=/\r\n?/g,pR=/\u0000|\uFFFD/g;function e0(t){return(typeof t=="string"?t:""+t).replace(hR,`
38
+ `).replace(pR,"")}function rl(t,s,a){if(s=e0(s),e0(t)!==s&&a)throw Error(r(425))}function sl(){}var yc=null,wc=null;function xc(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var _c=typeof setTimeout=="function"?setTimeout:void 0,mR=typeof clearTimeout=="function"?clearTimeout:void 0,t0=typeof Promise=="function"?Promise:void 0,gR=typeof queueMicrotask=="function"?queueMicrotask:typeof t0<"u"?function(t){return t0.resolve(null).then(t).catch(vR)}:_c;function vR(t){setTimeout(function(){throw t})}function bc(t,s){var a=s,f=0;do{var v=a.nextSibling;if(t.removeChild(a),v&&v.nodeType===8)if(a=v.data,a==="/$"){if(f===0){t.removeChild(v),rs(s);return}f--}else a!=="$"&&a!=="$?"&&a!=="$!"||f++;a=v}while(a);rs(s)}function ds(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return t}function n0(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return t;s--}else a==="/$"&&s++}t=t.previousSibling}return null}var Pi=Math.random().toString(36).slice(2),ur="__reactFiber$"+Pi,zo="__reactProps$"+Pi,Rr="__reactContainer$"+Pi,Sc="__reactEvents$"+Pi,yR="__reactListeners$"+Pi,wR="__reactHandles$"+Pi;function Xs(t){var s=t[ur];if(s)return s;for(var a=t.parentNode;a;){if(s=a[Rr]||a[ur]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(t=n0(t);t!==null;){if(a=t[ur])return a;t=n0(t)}return s}t=a,a=t.parentNode}return null}function Bo(t){return t=t[ur]||t[Rr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Li(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(r(33))}function il(t){return t[zo]||null}var kc=[],qi=-1;function fs(t){return{current:t}}function st(t){0>qi||(t.current=kc[qi],kc[qi]=null,qi--)}function tt(t,s){qi++,kc[qi]=t.current,t.current=s}var hs={},Ut=fs(hs),rn=fs(!1),Qs=hs;function $i(t,s){var a=t.type.contextTypes;if(!a)return hs;var f=t.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===s)return f.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in a)v[x]=s[x];return f&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=v),v}function sn(t){return t=t.childContextTypes,t!=null}function ol(){st(rn),st(Ut)}function r0(t,s,a){if(Ut.current!==hs)throw Error(r(168));tt(Ut,s),tt(rn,a)}function s0(t,s,a){var f=t.stateNode;if(s=s.childContextTypes,typeof f.getChildContext!="function")return a;f=f.getChildContext();for(var v in f)if(!(v in s))throw Error(r(108,ae(t)||"Unknown",v));return Z({},a,f)}function al(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||hs,Qs=Ut.current,tt(Ut,t),tt(rn,rn.current),!0}function i0(t,s,a){var f=t.stateNode;if(!f)throw Error(r(169));a?(t=s0(t,s,Qs),f.__reactInternalMemoizedMergedChildContext=t,st(rn),st(Ut),tt(Ut,t)):st(rn),tt(rn,a)}var jr=null,ll=!1,Ec=!1;function o0(t){jr===null?jr=[t]:jr.push(t)}function xR(t){ll=!0,o0(t)}function ps(){if(!Ec&&jr!==null){Ec=!0;var t=0,s=He;try{var a=jr;for(He=1;t<a.length;t++){var f=a[t];do f=f(!0);while(f!==null)}jr=null,ll=!1}catch(v){throw jr!==null&&(jr=jr.slice(t+1)),_r(Xr,ps),v}finally{He=s,Ec=!1}}return null}var Di=[],Fi=0,ul=null,cl=0,Rn=[],jn=0,Zs=null,Ar=1,Ir="";function Js(t,s){Di[Fi++]=cl,Di[Fi++]=ul,ul=t,cl=s}function a0(t,s,a){Rn[jn++]=Ar,Rn[jn++]=Ir,Rn[jn++]=Zs,Zs=t;var f=Ar;t=Ir;var v=32-pt(f)-1;f&=~(1<<v),a+=1;var x=32-pt(s)+v;if(30<x){var R=v-v%5;x=(f&(1<<R)-1).toString(32),f>>=R,v-=R,Ar=1<<32-pt(s)+v|a<<v|f,Ir=x+t}else Ar=1<<x|a<<v|f,Ir=t}function Nc(t){t.return!==null&&(Js(t,1),a0(t,1,0))}function Cc(t){for(;t===ul;)ul=Di[--Fi],Di[Fi]=null,cl=Di[--Fi],Di[Fi]=null;for(;t===Zs;)Zs=Rn[--jn],Rn[jn]=null,Ir=Rn[--jn],Rn[jn]=null,Ar=Rn[--jn],Rn[jn]=null}var yn=null,wn=null,ot=!1,Vn=null;function l0(t,s){var a=On(5,null,null,0);a.elementType="DELETED",a.stateNode=s,a.return=t,s=t.deletions,s===null?(t.deletions=[a],t.flags|=16):s.push(a)}function u0(t,s){switch(t.tag){case 5:var a=t.type;return s=s.nodeType!==1||a.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(t.stateNode=s,yn=t,wn=ds(s.firstChild),!0):!1;case 6:return s=t.pendingProps===""||s.nodeType!==3?null:s,s!==null?(t.stateNode=s,yn=t,wn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(a=Zs!==null?{id:Ar,overflow:Ir}:null,t.memoizedState={dehydrated:s,treeContext:a,retryLane:1073741824},a=On(18,null,null,0),a.stateNode=s,a.return=t,t.child=a,yn=t,wn=null,!0):!1;default:return!1}}function Tc(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Rc(t){if(ot){var s=wn;if(s){var a=s;if(!u0(t,s)){if(Tc(t))throw Error(r(418));s=ds(a.nextSibling);var f=yn;s&&u0(t,s)?l0(f,a):(t.flags=t.flags&-4097|2,ot=!1,yn=t)}}else{if(Tc(t))throw Error(r(418));t.flags=t.flags&-4097|2,ot=!1,yn=t}}}function c0(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;yn=t}function dl(t){if(t!==yn)return!1;if(!ot)return c0(t),ot=!0,!1;var s;if((s=t.tag!==3)&&!(s=t.tag!==5)&&(s=t.type,s=s!=="head"&&s!=="body"&&!xc(t.type,t.memoizedProps)),s&&(s=wn)){if(Tc(t))throw d0(),Error(r(418));for(;s;)l0(t,s),s=ds(s.nextSibling)}if(c0(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));e:{for(t=t.nextSibling,s=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"){if(s===0){wn=ds(t.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++}t=t.nextSibling}wn=null}}else wn=yn?ds(t.stateNode.nextSibling):null;return!0}function d0(){for(var t=wn;t;)t=ds(t.nextSibling)}function zi(){wn=yn=null,ot=!1}function jc(t){Vn===null?Vn=[t]:Vn.push(t)}var _R=T.ReactCurrentBatchConfig;function Uo(t,s,a){if(t=a.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(r(309));var f=a.stateNode}if(!f)throw Error(r(147,t));var v=f,x=""+t;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===x?s.ref:(s=function(R){var F=v.refs;R===null?delete F[x]:F[x]=R},s._stringRef=x,s)}if(typeof t!="string")throw Error(r(284));if(!a._owner)throw Error(r(290,t))}return t}function fl(t,s){throw t=Object.prototype.toString.call(s),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t))}function f0(t){var s=t._init;return s(t._payload)}function h0(t){function s(se,ee){if(t){var ie=se.deletions;ie===null?(se.deletions=[ee],se.flags|=16):ie.push(ee)}}function a(se,ee){if(!t)return null;for(;ee!==null;)s(se,ee),ee=ee.sibling;return null}function f(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,t?(ie=se.alternate,ie!==null?(ie=ie.index,ie<ee?(se.flags|=2,ee):ie):(se.flags|=2,ee)):(se.flags|=1048576,ee)}function R(se){return t&&se.alternate===null&&(se.flags|=2),se}function F(se,ee,ie,ge){return ee===null||ee.tag!==6?(ee=_d(ie,se.mode,ge),ee.return=se,ee):(ee=v(ee,ie),ee.return=se,ee)}function X(se,ee,ie,ge){var Re=ie.type;return Re===A?pe(se,ee,ie.props.children,ge,ie.key):ee!==null&&(ee.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===L&&f0(Re)===ee.type)?(ge=v(ee,ie.props),ge.ref=Uo(se,ee,ie),ge.return=se,ge):(ge=Ll(ie.type,ie.key,ie.props,null,se.mode,ge),ge.ref=Uo(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=bd(ie,se.mode,ge),ee.return=se,ee):(ee=v(ee,ie.children||[]),ee.return=se,ee)}function pe(se,ee,ie,ge,Re){return ee===null||ee.tag!==7?(ee=ai(ie,se.mode,ge,Re),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=_d(""+ee,se.mode,ie),ee.return=se,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case I:return ie=Ll(ee.type,ee.key,ee.props,null,se.mode,ie),ie.ref=Uo(se,null,ee),ie.return=se,ie;case O:return ee=bd(ee,se.mode,ie),ee.return=se,ee;case L: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;fl(se,ee)}return null}function he(se,ee,ie,ge){var Re=ee!==null?ee.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return Re!==null?null:F(se,ee,""+ie,ge);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:return ie.key===Re?X(se,ee,ie,ge):null;case O:return ie.key===Re?le(se,ee,ie,ge):null;case L:return Re=ie._init,he(se,ee,Re(ie._payload),ge)}if(it(ie)||W(ie))return Re!==null?null:pe(se,ee,ie,ge,null);fl(se,ie)}return null}function be(se,ee,ie,ge,Re){if(typeof ge=="string"&&ge!==""||typeof ge=="number")return se=se.get(ie)||null,F(ee,se,""+ge,Re);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case I:return se=se.get(ge.key===null?ie:ge.key)||null,X(ee,se,ge,Re);case O:return se=se.get(ge.key===null?ie:ge.key)||null,le(ee,se,ge,Re);case L:var Ie=ge._init;return be(se,ee,ie,Ie(ge._payload),Re)}if(it(ge)||W(ge))return se=se.get(ie)||null,pe(ee,se,ge,Re,null);fl(ee,ge)}return null}function Ne(se,ee,ie,ge){for(var Re=null,Ie=null,Me=ee,Oe=ee=0,It=null;Me!==null&&Oe<ie.length;Oe++){Me.index>Oe?(It=Me,Me=null):It=Me.sibling;var Ve=he(se,Me,ie[Oe],ge);if(Ve===null){Me===null&&(Me=It);break}t&&Me&&Ve.alternate===null&&s(se,Me),ee=x(Ve,ee,Oe),Ie===null?Re=Ve:Ie.sibling=Ve,Ie=Ve,Me=It}if(Oe===ie.length)return a(se,Me),ot&&Js(se,Oe),Re;if(Me===null){for(;Oe<ie.length;Oe++)Me=me(se,ie[Oe],ge),Me!==null&&(ee=x(Me,ee,Oe),Ie===null?Re=Me:Ie.sibling=Me,Ie=Me);return ot&&Js(se,Oe),Re}for(Me=f(se,Me);Oe<ie.length;Oe++)It=be(Me,se,Oe,ie[Oe],ge),It!==null&&(t&&It.alternate!==null&&Me.delete(It.key===null?Oe:It.key),ee=x(It,ee,Oe),Ie===null?Re=It:Ie.sibling=It,Ie=It);return t&&Me.forEach(function(Ss){return s(se,Ss)}),ot&&Js(se,Oe),Re}function Te(se,ee,ie,ge){var Re=W(ie);if(typeof Re!="function")throw Error(r(150));if(ie=Re.call(ie),ie==null)throw Error(r(151));for(var Ie=Re=null,Me=ee,Oe=ee=0,It=null,Ve=ie.next();Me!==null&&!Ve.done;Oe++,Ve=ie.next()){Me.index>Oe?(It=Me,Me=null):It=Me.sibling;var Ss=he(se,Me,Ve.value,ge);if(Ss===null){Me===null&&(Me=It);break}t&&Me&&Ss.alternate===null&&s(se,Me),ee=x(Ss,ee,Oe),Ie===null?Re=Ss:Ie.sibling=Ss,Ie=Ss,Me=It}if(Ve.done)return a(se,Me),ot&&Js(se,Oe),Re;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?Re=Ve:Ie.sibling=Ve,Ie=Ve);return ot&&Js(se,Oe),Re}for(Me=f(se,Me);!Ve.done;Oe++,Ve=ie.next())Ve=be(Me,se,Oe,Ve.value,ge),Ve!==null&&(t&&Ve.alternate!==null&&Me.delete(Ve.key===null?Oe:Ve.key),ee=x(Ve,ee,Oe),Ie===null?Re=Ve:Ie.sibling=Ve,Ie=Ve);return t&&Me.forEach(function(ej){return s(se,ej)}),ot&&Js(se,Oe),Re}function yt(se,ee,ie,ge){if(typeof ie=="object"&&ie!==null&&ie.type===A&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:e:{for(var Re=ie.key,Ie=ee;Ie!==null;){if(Ie.key===Re){if(Re=ie.type,Re===A){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===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===L&&f0(Re)===Ie.type){a(se,Ie.sibling),ee=v(Ie,ie.props),ee.ref=Uo(se,Ie,ie),ee.return=se,se=ee;break e}a(se,Ie);break}else s(se,Ie);Ie=Ie.sibling}ie.type===A?(ee=ai(ie.props.children,se.mode,ge,ie.key),ee.return=se,se=ee):(ge=Ll(ie.type,ie.key,ie.props,null,se.mode,ge),ge.ref=Uo(se,ee,ie),ge.return=se,se=ge)}return R(se);case O: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=bd(ie,se.mode,ge),ee.return=se,se=ee}return R(se);case L:return Ie=ie._init,yt(se,ee,Ie(ie._payload),ge)}if(it(ie))return Ne(se,ee,ie,ge);if(W(ie))return Te(se,ee,ie,ge);fl(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=_d(ie,se.mode,ge),ee.return=se,se=ee),R(se)):a(se,ee)}return yt}var Bi=h0(!0),p0=h0(!1),hl=fs(null),pl=null,Ui=null,Ac=null;function Ic(){Ac=Ui=pl=null}function Mc(t){var s=hl.current;st(hl),t._currentValue=s}function Oc(t,s,a){for(;t!==null;){var f=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,f!==null&&(f.childLanes|=s)):f!==null&&(f.childLanes&s)!==s&&(f.childLanes|=s),t===a)break;t=t.return}}function Hi(t,s){pl=t,Ac=Ui=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&s)!==0&&(on=!0),t.firstContext=null)}function An(t){var s=t._currentValue;if(Ac!==t)if(t={context:t,memoizedValue:s,next:null},Ui===null){if(pl===null)throw Error(r(308));Ui=t,pl.dependencies={lanes:0,firstContext:t}}else Ui=Ui.next=t;return s}var ei=null;function Pc(t){ei===null?ei=[t]:ei.push(t)}function m0(t,s,a,f){var v=s.interleaved;return v===null?(a.next=a,Pc(s)):(a.next=v.next,v.next=a),s.interleaved=a,Mr(t,f)}function Mr(t,s){t.lanes|=s;var a=t.alternate;for(a!==null&&(a.lanes|=s),a=t,t=t.return;t!==null;)t.childLanes|=s,a=t.alternate,a!==null&&(a.childLanes|=s),a=t,t=t.return;return a.tag===3?a.stateNode:null}var ms=!1;function Lc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function g0(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Or(t,s){return{eventTime:t,lane:s,tag:0,payload:null,callback:null,next:null}}function gs(t,s,a){var f=t.updateQueue;if(f===null)return null;if(f=f.shared,(Ue&2)!==0){var v=f.pending;return v===null?s.next=s:(s.next=v.next,v.next=s),f.pending=s,Mr(t,a)}return v=f.interleaved,v===null?(s.next=s,Pc(f)):(s.next=v.next,v.next=s),f.interleaved=s,Mr(t,a)}function ml(t,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194240)!==0)){var f=s.lanes;f&=t.pendingLanes,a|=f,s.lanes=a,Ei(t,a)}}function v0(t,s){var a=t.updateQueue,f=t.alternate;if(f!==null&&(f=f.updateQueue,a===f)){var v=null,x=null;if(a=a.firstBaseUpdate,a!==null){do{var R={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};x===null?v=x=R:x=x.next=R,a=a.next}while(a!==null);x===null?v=x=s:x=x.next=s}else v=x=s;a={baseState:f.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:f.shared,effects:f.effects},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=s:t.next=s,a.lastBaseUpdate=s}function gl(t,s,a,f){var v=t.updateQueue;ms=!1;var x=v.firstBaseUpdate,R=v.lastBaseUpdate,F=v.shared.pending;if(F!==null){v.shared.pending=null;var X=F,le=X.next;X.next=null,R===null?x=le:R.next=le,R=X;var pe=t.alternate;pe!==null&&(pe=pe.updateQueue,F=pe.lastBaseUpdate,F!==R&&(F===null?pe.firstBaseUpdate=le:F.next=le,pe.lastBaseUpdate=X))}if(x!==null){var me=v.baseState;R=0,pe=le=X=null,F=x;do{var he=F.lane,be=F.eventTime;if((f&he)===he){pe!==null&&(pe=pe.next={eventTime:be,lane:0,tag:F.tag,payload:F.payload,callback:F.callback,next:null});e:{var Ne=t,Te=F;switch(he=s,be=a,Te.tag){case 1:if(Ne=Te.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=Te.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}}F.callback!==null&&F.lane!==0&&(t.flags|=64,he=v.effects,he===null?v.effects=[F]:he.push(F))}else be={eventTime:be,lane:he,tag:F.tag,payload:F.payload,callback:F.callback,next:null},pe===null?(le=pe=be,X=me):pe=pe.next=be,R|=he;if(F=F.next,F===null){if(F=v.shared.pending,F===null)break;he=F,F=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 R|=v.lane,v=v.next;while(v!==s)}else x===null&&(v.shared.lanes=0);ri|=R,t.lanes=R,t.memoizedState=me}}function y0(t,s,a){if(t=s.effects,s.effects=null,t!==null)for(s=0;s<t.length;s++){var f=t[s],v=f.callback;if(v!==null){if(f.callback=null,f=a,typeof v!="function")throw Error(r(191,v));v.call(f)}}}var Ho={},cr=fs(Ho),Wo=fs(Ho),Vo=fs(Ho);function ti(t){if(t===Ho)throw Error(r(174));return t}function qc(t,s){switch(tt(Vo,s),tt(Wo,t),tt(cr,Ho),t=s.nodeType,t){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:lt(null,"");break;default:t=t===8?s.parentNode:s,s=t.namespaceURI||null,t=t.tagName,s=lt(s,t)}st(cr),tt(cr,s)}function Wi(){st(cr),st(Wo),st(Vo)}function w0(t){ti(Vo.current);var s=ti(cr.current),a=lt(s,t.type);s!==a&&(tt(Wo,t),tt(cr,a))}function $c(t){Wo.current===t&&(st(cr),st(Wo))}var ct=fs(0);function vl(t){for(var s=t;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===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Dc=[];function Fc(){for(var t=0;t<Dc.length;t++)Dc[t]._workInProgressVersionPrimary=null;Dc.length=0}var yl=T.ReactCurrentDispatcher,zc=T.ReactCurrentBatchConfig,ni=0,dt=null,kt=null,jt=null,wl=!1,Go=!1,Yo=0,bR=0;function Ht(){throw Error(r(321))}function Bc(t,s){if(s===null)return!1;for(var a=0;a<s.length&&a<t.length;a++)if(!Wn(t[a],s[a]))return!1;return!0}function Uc(t,s,a,f,v,x){if(ni=x,dt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,yl.current=t===null||t.memoizedState===null?NR:CR,t=a(f,v),Go){x=0;do{if(Go=!1,Yo=0,25<=x)throw Error(r(301));x+=1,jt=kt=null,s.updateQueue=null,yl.current=TR,t=a(f,v)}while(Go)}if(yl.current=bl,s=kt!==null&&kt.next!==null,ni=0,jt=kt=dt=null,wl=!1,s)throw Error(r(300));return t}function Hc(){var t=Yo!==0;return Yo=0,t}function dr(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jt===null?dt.memoizedState=jt=t:jt=jt.next=t,jt}function In(){if(kt===null){var t=dt.alternate;t=t!==null?t.memoizedState:null}else t=kt.next;var s=jt===null?dt.memoizedState:jt.next;if(s!==null)jt=s,kt=t;else{if(t===null)throw Error(r(310));kt=t,t={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},jt===null?dt.memoizedState=jt=t:jt=jt.next=t}return jt}function Ko(t,s){return typeof s=="function"?s(t):s}function Wc(t){var s=In(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=t;var f=kt,v=f.baseQueue,x=a.pending;if(x!==null){if(v!==null){var R=v.next;v.next=x.next,x.next=R}f.baseQueue=v=x,a.pending=null}if(v!==null){x=v.next,f=f.baseState;var F=R=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}),f=le.hasEagerState?le.eagerState:t(f,le.action);else{var me={lane:pe,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null};X===null?(F=X=me,R=f):X=X.next=me,dt.lanes|=pe,ri|=pe}le=le.next}while(le!==null&&le!==x);X===null?R=f:X.next=F,Wn(f,s.memoizedState)||(on=!0),s.memoizedState=f,s.baseState=R,s.baseQueue=X,a.lastRenderedState=f}if(t=a.interleaved,t!==null){v=t;do x=v.lane,dt.lanes|=x,ri|=x,v=v.next;while(v!==t)}else v===null&&(a.lanes=0);return[s.memoizedState,a.dispatch]}function Vc(t){var s=In(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=t;var f=a.dispatch,v=a.pending,x=s.memoizedState;if(v!==null){a.pending=null;var R=v=v.next;do x=t(x,R.action),R=R.next;while(R!==v);Wn(x,s.memoizedState)||(on=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),a.lastRenderedState=x}return[x,f]}function x0(){}function _0(t,s){var a=dt,f=In(),v=s(),x=!Wn(f.memoizedState,v);if(x&&(f.memoizedState=v,on=!0),f=f.queue,Gc(k0.bind(null,a,f,t),[t]),f.getSnapshot!==s||x||jt!==null&&jt.memoizedState.tag&1){if(a.flags|=2048,Xo(9,S0.bind(null,a,f,v,s),void 0,null),At===null)throw Error(r(349));(ni&30)!==0||b0(a,s,v)}return v}function b0(t,s,a){t.flags|=16384,t={getSnapshot:s,value:a},s=dt.updateQueue,s===null?(s={lastEffect:null,stores:null},dt.updateQueue=s,s.stores=[t]):(a=s.stores,a===null?s.stores=[t]:a.push(t))}function S0(t,s,a,f){s.value=a,s.getSnapshot=f,E0(s)&&N0(t)}function k0(t,s,a){return a(function(){E0(s)&&N0(t)})}function E0(t){var s=t.getSnapshot;t=t.value;try{var a=s();return!Wn(t,a)}catch{return!0}}function N0(t){var s=Mr(t,1);s!==null&&Xn(s,t,1,-1)}function C0(t){var s=dr();return typeof t=="function"&&(t=t()),s.memoizedState=s.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ko,lastRenderedState:t},s.queue=t,t=t.dispatch=ER.bind(null,dt,t),[s.memoizedState,t]}function Xo(t,s,a,f){return t={tag:t,create:s,destroy:a,deps:f,next:null},s=dt.updateQueue,s===null?(s={lastEffect:null,stores:null},dt.updateQueue=s,s.lastEffect=t.next=t):(a=s.lastEffect,a===null?s.lastEffect=t.next=t:(f=a.next,a.next=t,t.next=f,s.lastEffect=t)),t}function T0(){return In().memoizedState}function xl(t,s,a,f){var v=dr();dt.flags|=t,v.memoizedState=Xo(1|s,a,void 0,f===void 0?null:f)}function _l(t,s,a,f){var v=In();f=f===void 0?null:f;var x=void 0;if(kt!==null){var R=kt.memoizedState;if(x=R.destroy,f!==null&&Bc(f,R.deps)){v.memoizedState=Xo(s,a,x,f);return}}dt.flags|=t,v.memoizedState=Xo(1|s,a,x,f)}function R0(t,s){return xl(8390656,8,t,s)}function Gc(t,s){return _l(2048,8,t,s)}function j0(t,s){return _l(4,2,t,s)}function A0(t,s){return _l(4,4,t,s)}function I0(t,s){if(typeof s=="function")return t=t(),s(t),function(){s(null)};if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function M0(t,s,a){return a=a!=null?a.concat([t]):null,_l(4,4,I0.bind(null,s,t),a)}function Yc(){}function O0(t,s){var a=In();s=s===void 0?null:s;var f=a.memoizedState;return f!==null&&s!==null&&Bc(s,f[1])?f[0]:(a.memoizedState=[t,s],t)}function P0(t,s){var a=In();s=s===void 0?null:s;var f=a.memoizedState;return f!==null&&s!==null&&Bc(s,f[1])?f[0]:(t=t(),a.memoizedState=[t,s],t)}function L0(t,s,a){return(ni&21)===0?(t.baseState&&(t.baseState=!1,on=!0),t.memoizedState=a):(Wn(a,s)||(a=ki(),dt.lanes|=a,ri|=a,t.baseState=!0),s)}function SR(t,s){var a=He;He=a!==0&&4>a?a:4,t(!0);var f=zc.transition;zc.transition={};try{t(!1),s()}finally{He=a,zc.transition=f}}function q0(){return In().memoizedState}function kR(t,s,a){var f=xs(t);if(a={lane:f,action:a,hasEagerState:!1,eagerState:null,next:null},$0(t))D0(s,a);else if(a=m0(t,s,a,f),a!==null){var v=en();Xn(a,t,f,v),F0(a,s,f)}}function ER(t,s,a){var f=xs(t),v={lane:f,action:a,hasEagerState:!1,eagerState:null,next:null};if($0(t))D0(s,v);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var R=s.lastRenderedState,F=x(R,a);if(v.hasEagerState=!0,v.eagerState=F,Wn(F,R)){var X=s.interleaved;X===null?(v.next=v,Pc(s)):(v.next=X.next,X.next=v),s.interleaved=v;return}}catch{}finally{}a=m0(t,s,v,f),a!==null&&(v=en(),Xn(a,t,f,v),F0(a,s,f))}}function $0(t){var s=t.alternate;return t===dt||s!==null&&s===dt}function D0(t,s){Go=wl=!0;var a=t.pending;a===null?s.next=s:(s.next=a.next,a.next=s),t.pending=s}function F0(t,s,a){if((a&4194240)!==0){var f=s.lanes;f&=t.pendingLanes,a|=f,s.lanes=a,Ei(t,a)}}var bl={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},NR={readContext:An,useCallback:function(t,s){return dr().memoizedState=[t,s===void 0?null:s],t},useContext:An,useEffect:R0,useImperativeHandle:function(t,s,a){return a=a!=null?a.concat([t]):null,xl(4194308,4,I0.bind(null,s,t),a)},useLayoutEffect:function(t,s){return xl(4194308,4,t,s)},useInsertionEffect:function(t,s){return xl(4,2,t,s)},useMemo:function(t,s){var a=dr();return s=s===void 0?null:s,t=t(),a.memoizedState=[t,s],t},useReducer:function(t,s,a){var f=dr();return s=a!==void 0?a(s):s,f.memoizedState=f.baseState=s,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:s},f.queue=t,t=t.dispatch=kR.bind(null,dt,t),[f.memoizedState,t]},useRef:function(t){var s=dr();return t={current:t},s.memoizedState=t},useState:C0,useDebugValue:Yc,useDeferredValue:function(t){return dr().memoizedState=t},useTransition:function(){var t=C0(!1),s=t[0];return t=SR.bind(null,t[1]),dr().memoizedState=t,[s,t]},useMutableSource:function(){},useSyncExternalStore:function(t,s,a){var f=dt,v=dr();if(ot){if(a===void 0)throw Error(r(407));a=a()}else{if(a=s(),At===null)throw Error(r(349));(ni&30)!==0||b0(f,s,a)}v.memoizedState=a;var x={value:a,getSnapshot:s};return v.queue=x,R0(k0.bind(null,f,x,t),[t]),f.flags|=2048,Xo(9,S0.bind(null,f,x,a,s),void 0,null),a},useId:function(){var t=dr(),s=At.identifierPrefix;if(ot){var a=Ir,f=Ar;a=(f&~(1<<32-pt(f)-1)).toString(32)+a,s=":"+s+"R"+a,a=Yo++,0<a&&(s+="H"+a.toString(32)),s+=":"}else a=bR++,s=":"+s+"r"+a.toString(32)+":";return t.memoizedState=s},unstable_isNewReconciler:!1},CR={readContext:An,useCallback:O0,useContext:An,useEffect:Gc,useImperativeHandle:M0,useInsertionEffect:j0,useLayoutEffect:A0,useMemo:P0,useReducer:Wc,useRef:T0,useState:function(){return Wc(Ko)},useDebugValue:Yc,useDeferredValue:function(t){var s=In();return L0(s,kt.memoizedState,t)},useTransition:function(){var t=Wc(Ko)[0],s=In().memoizedState;return[t,s]},useMutableSource:x0,useSyncExternalStore:_0,useId:q0,unstable_isNewReconciler:!1},TR={readContext:An,useCallback:O0,useContext:An,useEffect:Gc,useImperativeHandle:M0,useInsertionEffect:j0,useLayoutEffect:A0,useMemo:P0,useReducer:Vc,useRef:T0,useState:function(){return Vc(Ko)},useDebugValue:Yc,useDeferredValue:function(t){var s=In();return kt===null?s.memoizedState=t:L0(s,kt.memoizedState,t)},useTransition:function(){var t=Vc(Ko)[0],s=In().memoizedState;return[t,s]},useMutableSource:x0,useSyncExternalStore:_0,useId:q0,unstable_isNewReconciler:!1};function Gn(t,s){if(t&&t.defaultProps){s=Z({},s),t=t.defaultProps;for(var a in t)s[a]===void 0&&(s[a]=t[a]);return s}return s}function Kc(t,s,a,f){s=t.memoizedState,a=a(f,s),a=a==null?s:Z({},s,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var Sl={isMounted:function(t){return(t=t._reactInternals)?En(t)===t:!1},enqueueSetState:function(t,s,a){t=t._reactInternals;var f=en(),v=xs(t),x=Or(f,v);x.payload=s,a!=null&&(x.callback=a),s=gs(t,x,v),s!==null&&(Xn(s,t,v,f),ml(s,t,v))},enqueueReplaceState:function(t,s,a){t=t._reactInternals;var f=en(),v=xs(t),x=Or(f,v);x.tag=1,x.payload=s,a!=null&&(x.callback=a),s=gs(t,x,v),s!==null&&(Xn(s,t,v,f),ml(s,t,v))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var a=en(),f=xs(t),v=Or(a,f);v.tag=2,s!=null&&(v.callback=s),s=gs(t,v,f),s!==null&&(Xn(s,t,f,a),ml(s,t,f))}};function z0(t,s,a,f,v,x,R){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(f,x,R):s.prototype&&s.prototype.isPureReactComponent?!Lo(a,f)||!Lo(v,x):!0}function B0(t,s,a){var f=!1,v=hs,x=s.contextType;return typeof x=="object"&&x!==null?x=An(x):(v=sn(s)?Qs:Ut.current,f=s.contextTypes,x=(f=f!=null)?$i(t,v):hs),s=new s(a,x),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Sl,t.stateNode=s,s._reactInternals=t,f&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=v,t.__reactInternalMemoizedMaskedChildContext=x),s}function U0(t,s,a,f){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,f),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,f),s.state!==t&&Sl.enqueueReplaceState(s,s.state,null)}function Xc(t,s,a,f){var v=t.stateNode;v.props=a,v.state=t.memoizedState,v.refs={},Lc(t);var x=s.contextType;typeof x=="object"&&x!==null?v.context=An(x):(x=sn(s)?Qs:Ut.current,v.context=$i(t,x)),v.state=t.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(Kc(t,s,x,a),v.state=t.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&&Sl.enqueueReplaceState(v,v.state,null),gl(t,a,v,f),v.state=t.memoizedState),typeof v.componentDidMount=="function"&&(t.flags|=4194308)}function Vi(t,s){try{var a="",f=s;do a+=Q(f),f=f.return;while(f);var v=a}catch(x){v=`
39
+ Error generating stack: `+x.message+`
40
+ `+x.stack}return{value:t,source:s,stack:v,digest:null}}function Qc(t,s,a){return{value:t,source:null,stack:a??null,digest:s??null}}function Zc(t,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var RR=typeof WeakMap=="function"?WeakMap:Map;function H0(t,s,a){a=Or(-1,a),a.tag=3,a.payload={element:null};var f=s.value;return a.callback=function(){jl||(jl=!0,hd=f),Zc(t,s)},a}function W0(t,s,a){a=Or(-1,a),a.tag=3;var f=t.type.getDerivedStateFromError;if(typeof f=="function"){var v=s.value;a.payload=function(){return f(v)},a.callback=function(){Zc(t,s)}}var x=t.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(a.callback=function(){Zc(t,s),typeof f!="function"&&(ys===null?ys=new Set([this]):ys.add(this));var R=s.stack;this.componentDidCatch(s.value,{componentStack:R!==null?R:""})}),a}function V0(t,s,a){var f=t.pingCache;if(f===null){f=t.pingCache=new RR;var v=new Set;f.set(s,v)}else v=f.get(s),v===void 0&&(v=new Set,f.set(s,v));v.has(a)||(v.add(a),t=UR.bind(null,t,s,a),s.then(t,t))}function G0(t){do{var s;if((s=t.tag===13)&&(s=t.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return t;t=t.return}while(t!==null);return null}function Y0(t,s,a,f,v){return(t.mode&1)===0?(t===s?t.flags|=65536:(t.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),t):(t.flags|=65536,t.lanes=v,t)}var jR=T.ReactCurrentOwner,on=!1;function Jt(t,s,a,f){s.child=t===null?p0(s,null,a,f):Bi(s,t.child,a,f)}function K0(t,s,a,f,v){a=a.render;var x=s.ref;return Hi(s,v),f=Uc(t,s,a,f,x,v),a=Hc(),t!==null&&!on?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~v,Pr(t,s,v)):(ot&&a&&Nc(s),s.flags|=1,Jt(t,s,f,v),s.child)}function X0(t,s,a,f,v){if(t===null){var x=a.type;return typeof x=="function"&&!xd(x)&&x.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(s.tag=15,s.type=x,Q0(t,s,x,f,v)):(t=Ll(a.type,null,f,s,s.mode,v),t.ref=s.ref,t.return=s,s.child=t)}if(x=t.child,(t.lanes&v)===0){var R=x.memoizedProps;if(a=a.compare,a=a!==null?a:Lo,a(R,f)&&t.ref===s.ref)return Pr(t,s,v)}return s.flags|=1,t=bs(x,f),t.ref=s.ref,t.return=s,s.child=t}function Q0(t,s,a,f,v){if(t!==null){var x=t.memoizedProps;if(Lo(x,f)&&t.ref===s.ref)if(on=!1,s.pendingProps=f=x,(t.lanes&v)!==0)(t.flags&131072)!==0&&(on=!0);else return s.lanes=t.lanes,Pr(t,s,v)}return Jc(t,s,a,f,v)}function Z0(t,s,a){var f=s.pendingProps,v=f.children,x=t!==null?t.memoizedState:null;if(f.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 t=x!==null?x.baseLanes|a:a,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:t,cachePool:null,transitions:null},s.updateQueue=null,tt(Yi,xn),xn|=t,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=x!==null?x.baseLanes:a,tt(Yi,xn),xn|=f}else x!==null?(f=x.baseLanes|a,s.memoizedState=null):f=a,tt(Yi,xn),xn|=f;return Jt(t,s,v,a),s.child}function J0(t,s){var a=s.ref;(t===null&&a!==null||t!==null&&t.ref!==a)&&(s.flags|=512,s.flags|=2097152)}function Jc(t,s,a,f,v){var x=sn(a)?Qs:Ut.current;return x=$i(s,x),Hi(s,v),a=Uc(t,s,a,f,x,v),f=Hc(),t!==null&&!on?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~v,Pr(t,s,v)):(ot&&f&&Nc(s),s.flags|=1,Jt(t,s,a,v),s.child)}function ew(t,s,a,f,v){if(sn(a)){var x=!0;al(s)}else x=!1;if(Hi(s,v),s.stateNode===null)El(t,s),B0(s,a,f),Xc(s,a,f,v),f=!0;else if(t===null){var R=s.stateNode,F=s.memoizedProps;R.props=F;var X=R.context,le=a.contextType;typeof le=="object"&&le!==null?le=An(le):(le=sn(a)?Qs:Ut.current,le=$i(s,le));var pe=a.getDerivedStateFromProps,me=typeof pe=="function"||typeof R.getSnapshotBeforeUpdate=="function";me||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(F!==f||X!==le)&&U0(s,R,f,le),ms=!1;var he=s.memoizedState;R.state=he,gl(s,f,R,v),X=s.memoizedState,F!==f||he!==X||rn.current||ms?(typeof pe=="function"&&(Kc(s,a,pe,f),X=s.memoizedState),(F=ms||z0(s,a,F,f,he,X,le))?(me||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(s.flags|=4194308)):(typeof R.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=f,s.memoizedState=X),R.props=f,R.state=X,R.context=le,f=F):(typeof R.componentDidMount=="function"&&(s.flags|=4194308),f=!1)}else{R=s.stateNode,g0(t,s),F=s.memoizedProps,le=s.type===s.elementType?F:Gn(s.type,F),R.props=le,me=s.pendingProps,he=R.context,X=a.contextType,typeof X=="object"&&X!==null?X=An(X):(X=sn(a)?Qs:Ut.current,X=$i(s,X));var be=a.getDerivedStateFromProps;(pe=typeof be=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(F!==me||he!==X)&&U0(s,R,f,X),ms=!1,he=s.memoizedState,R.state=he,gl(s,f,R,v);var Ne=s.memoizedState;F!==me||he!==Ne||rn.current||ms?(typeof be=="function"&&(Kc(s,a,be,f),Ne=s.memoizedState),(le=ms||z0(s,a,le,f,he,Ne,X)||!1)?(pe||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(f,Ne,X),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(f,Ne,X)),typeof R.componentDidUpdate=="function"&&(s.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof R.componentDidUpdate!="function"||F===t.memoizedProps&&he===t.memoizedState||(s.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||F===t.memoizedProps&&he===t.memoizedState||(s.flags|=1024),s.memoizedProps=f,s.memoizedState=Ne),R.props=f,R.state=Ne,R.context=X,f=le):(typeof R.componentDidUpdate!="function"||F===t.memoizedProps&&he===t.memoizedState||(s.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||F===t.memoizedProps&&he===t.memoizedState||(s.flags|=1024),f=!1)}return ed(t,s,a,f,x,v)}function ed(t,s,a,f,v,x){J0(t,s);var R=(s.flags&128)!==0;if(!f&&!R)return v&&i0(s,a,!1),Pr(t,s,x);f=s.stateNode,jR.current=s;var F=R&&typeof a.getDerivedStateFromError!="function"?null:f.render();return s.flags|=1,t!==null&&R?(s.child=Bi(s,t.child,null,x),s.child=Bi(s,null,F,x)):Jt(t,s,F,x),s.memoizedState=f.state,v&&i0(s,a,!0),s.child}function tw(t){var s=t.stateNode;s.pendingContext?r0(t,s.pendingContext,s.pendingContext!==s.context):s.context&&r0(t,s.context,!1),qc(t,s.containerInfo)}function nw(t,s,a,f,v){return zi(),jc(v),s.flags|=256,Jt(t,s,a,f),s.child}var td={dehydrated:null,treeContext:null,retryLane:0};function nd(t){return{baseLanes:t,cachePool:null,transitions:null}}function rw(t,s,a){var f=s.pendingProps,v=ct.current,x=!1,R=(s.flags&128)!==0,F;if((F=R)||(F=t!==null&&t.memoizedState===null?!1:(v&2)!==0),F?(x=!0,s.flags&=-129):(t===null||t.memoizedState!==null)&&(v|=1),tt(ct,v&1),t===null)return Rc(s),t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((s.mode&1)===0?s.lanes=1:t.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(R=f.children,t=f.fallback,x?(f=s.mode,x=s.child,R={mode:"hidden",children:R},(f&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=R):x=ql(R,f,0,null),t=ai(t,f,a,null),x.return=s,t.return=s,x.sibling=t,s.child=x,s.child.memoizedState=nd(a),s.memoizedState=td,t):rd(s,R));if(v=t.memoizedState,v!==null&&(F=v.dehydrated,F!==null))return AR(t,s,R,f,F,v,a);if(x){x=f.fallback,R=s.mode,v=t.child,F=v.sibling;var X={mode:"hidden",children:f.children};return(R&1)===0&&s.child!==v?(f=s.child,f.childLanes=0,f.pendingProps=X,s.deletions=null):(f=bs(v,X),f.subtreeFlags=v.subtreeFlags&14680064),F!==null?x=bs(F,x):(x=ai(x,R,a,null),x.flags|=2),x.return=s,f.return=s,f.sibling=x,s.child=f,f=x,x=s.child,R=t.child.memoizedState,R=R===null?nd(a):{baseLanes:R.baseLanes|a,cachePool:null,transitions:R.transitions},x.memoizedState=R,x.childLanes=t.childLanes&~a,s.memoizedState=td,f}return x=t.child,t=x.sibling,f=bs(x,{mode:"visible",children:f.children}),(s.mode&1)===0&&(f.lanes=a),f.return=s,f.sibling=null,t!==null&&(a=s.deletions,a===null?(s.deletions=[t],s.flags|=16):a.push(t)),s.child=f,s.memoizedState=null,f}function rd(t,s){return s=ql({mode:"visible",children:s},t.mode,0,null),s.return=t,t.child=s}function kl(t,s,a,f){return f!==null&&jc(f),Bi(s,t.child,null,a),t=rd(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function AR(t,s,a,f,v,x,R){if(a)return s.flags&256?(s.flags&=-257,f=Qc(Error(r(422))),kl(t,s,R,f)):s.memoizedState!==null?(s.child=t.child,s.flags|=128,null):(x=f.fallback,v=s.mode,f=ql({mode:"visible",children:f.children},v,0,null),x=ai(x,v,R,null),x.flags|=2,f.return=s,x.return=s,f.sibling=x,s.child=f,(s.mode&1)!==0&&Bi(s,t.child,null,R),s.child.memoizedState=nd(R),s.memoizedState=td,x);if((s.mode&1)===0)return kl(t,s,R,null);if(v.data==="$!"){if(f=v.nextSibling&&v.nextSibling.dataset,f)var F=f.dgst;return f=F,x=Error(r(419)),f=Qc(x,f,void 0),kl(t,s,R,f)}if(F=(R&t.childLanes)!==0,on||F){if(f=At,f!==null){switch(R&-R){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(f.suspendedLanes|R))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Mr(t,v),Xn(f,t,v,-1))}return wd(),f=Qc(Error(r(421))),kl(t,s,R,f)}return v.data==="$?"?(s.flags|=128,s.child=t.child,s=HR.bind(null,t),v._reactRetry=s,null):(t=x.treeContext,wn=ds(v.nextSibling),yn=s,ot=!0,Vn=null,t!==null&&(Rn[jn++]=Ar,Rn[jn++]=Ir,Rn[jn++]=Zs,Ar=t.id,Ir=t.overflow,Zs=s),s=rd(s,f.children),s.flags|=4096,s)}function sw(t,s,a){t.lanes|=s;var f=t.alternate;f!==null&&(f.lanes|=s),Oc(t.return,s,a)}function sd(t,s,a,f,v){var x=t.memoizedState;x===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:f,tail:a,tailMode:v}:(x.isBackwards=s,x.rendering=null,x.renderingStartTime=0,x.last=f,x.tail=a,x.tailMode=v)}function iw(t,s,a){var f=s.pendingProps,v=f.revealOrder,x=f.tail;if(Jt(t,s,f.children,a),f=ct.current,(f&2)!==0)f=f&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&sw(t,a,s);else if(t.tag===19)sw(t,a,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}f&=1}if(tt(ct,f),(s.mode&1)===0)s.memoizedState=null;else switch(v){case"forwards":for(a=s.child,v=null;a!==null;)t=a.alternate,t!==null&&vl(t)===null&&(v=a),a=a.sibling;a=v,a===null?(v=s.child,s.child=null):(v=a.sibling,a.sibling=null),sd(s,!1,v,a,x);break;case"backwards":for(a=null,v=s.child,s.child=null;v!==null;){if(t=v.alternate,t!==null&&vl(t)===null){s.child=v;break}t=v.sibling,v.sibling=a,a=v,v=t}sd(s,!0,a,null,x);break;case"together":sd(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function El(t,s){(s.mode&1)===0&&t!==null&&(t.alternate=null,s.alternate=null,s.flags|=2)}function Pr(t,s,a){if(t!==null&&(s.dependencies=t.dependencies),ri|=s.lanes,(a&s.childLanes)===0)return null;if(t!==null&&s.child!==t.child)throw Error(r(153));if(s.child!==null){for(t=s.child,a=bs(t,t.pendingProps),s.child=a,a.return=s;t.sibling!==null;)t=t.sibling,a=a.sibling=bs(t,t.pendingProps),a.return=s;a.sibling=null}return s.child}function IR(t,s,a){switch(s.tag){case 3:tw(s),zi();break;case 5:w0(s);break;case 1:sn(s.type)&&al(s);break;case 4:qc(s,s.stateNode.containerInfo);break;case 10:var f=s.type._context,v=s.memoizedProps.value;tt(hl,f._currentValue),f._currentValue=v;break;case 13:if(f=s.memoizedState,f!==null)return f.dehydrated!==null?(tt(ct,ct.current&1),s.flags|=128,null):(a&s.child.childLanes)!==0?rw(t,s,a):(tt(ct,ct.current&1),t=Pr(t,s,a),t!==null?t.sibling:null);tt(ct,ct.current&1);break;case 19:if(f=(a&s.childLanes)!==0,(t.flags&128)!==0){if(f)return iw(t,s,a);s.flags|=128}if(v=s.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),tt(ct,ct.current),f)break;return null;case 22:case 23:return s.lanes=0,Z0(t,s,a)}return Pr(t,s,a)}var ow,id,aw,lw;ow=function(t,s){for(var a=s.child;a!==null;){if(a.tag===5||a.tag===6)t.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}},id=function(){},aw=function(t,s,a,f){var v=t.memoizedProps;if(v!==f){t=s.stateNode,ti(cr.current);var x=null;switch(a){case"input":v=ye(t,v),f=ye(t,f),x=[];break;case"select":v=Z({},v,{value:void 0}),f=Z({},f,{value:void 0}),x=[];break;case"textarea":v=Ze(t,v),f=Ze(t,f),x=[];break;default:typeof v.onClick!="function"&&typeof f.onClick=="function"&&(t.onclick=sl)}Yt(a,f);var R;a=null;for(le in v)if(!f.hasOwnProperty(le)&&v.hasOwnProperty(le)&&v[le]!=null)if(le==="style"){var F=v[le];for(R in F)F.hasOwnProperty(R)&&(a||(a={}),a[R]="")}else le!=="dangerouslySetInnerHTML"&&le!=="children"&&le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&le!=="autoFocus"&&(o.hasOwnProperty(le)?x||(x=[]):(x=x||[]).push(le,null));for(le in f){var X=f[le];if(F=v!=null?v[le]:void 0,f.hasOwnProperty(le)&&X!==F&&(X!=null||F!=null))if(le==="style")if(F){for(R in F)!F.hasOwnProperty(R)||X&&X.hasOwnProperty(R)||(a||(a={}),a[R]="");for(R in X)X.hasOwnProperty(R)&&F[R]!==X[R]&&(a||(a={}),a[R]=X[R])}else a||(x||(x=[]),x.push(le,a)),a=X;else le==="dangerouslySetInnerHTML"?(X=X?X.__html:void 0,F=F?F.__html:void 0,X!=null&&F!==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",t),x||F===X||(x=[])):(x=x||[]).push(le,X))}a&&(x=x||[]).push("style",a);var le=x;(s.updateQueue=le)&&(s.flags|=4)}},lw=function(t,s,a,f){a!==f&&(s.flags|=4)};function Qo(t,s){if(!ot)switch(t.tailMode){case"hidden":s=t.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var f=null;a!==null;)a.alternate!==null&&(f=a),a=a.sibling;f===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:f.sibling=null}}function Wt(t){var s=t.alternate!==null&&t.alternate.child===t.child,a=0,f=0;if(s)for(var v=t.child;v!==null;)a|=v.lanes|v.childLanes,f|=v.subtreeFlags&14680064,f|=v.flags&14680064,v.return=t,v=v.sibling;else for(v=t.child;v!==null;)a|=v.lanes|v.childLanes,f|=v.subtreeFlags,f|=v.flags,v.return=t,v=v.sibling;return t.subtreeFlags|=f,t.childLanes=a,s}function MR(t,s,a){var f=s.pendingProps;switch(Cc(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)&&ol(),Wt(s),null;case 3:return f=s.stateNode,Wi(),st(rn),st(Ut),Fc(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(t===null||t.child===null)&&(dl(s)?s.flags|=4:t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Vn!==null&&(gd(Vn),Vn=null))),id(t,s),Wt(s),null;case 5:$c(s);var v=ti(Vo.current);if(a=s.type,t!==null&&s.stateNode!=null)aw(t,s,a,f,v),t.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!f){if(s.stateNode===null)throw Error(r(166));return Wt(s),null}if(t=ti(cr.current),dl(s)){f=s.stateNode,a=s.type;var x=s.memoizedProps;switch(f[ur]=s,f[zo]=x,t=(s.mode&1)!==0,a){case"dialog":rt("cancel",f),rt("close",f);break;case"iframe":case"object":case"embed":rt("load",f);break;case"video":case"audio":for(v=0;v<$o.length;v++)rt($o[v],f);break;case"source":rt("error",f);break;case"img":case"image":case"link":rt("error",f),rt("load",f);break;case"details":rt("toggle",f);break;case"input":Ee(f,x),rt("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!x.multiple},rt("invalid",f);break;case"textarea":$e(f,x),rt("invalid",f)}Yt(a,x),v=null;for(var R in x)if(x.hasOwnProperty(R)){var F=x[R];R==="children"?typeof F=="string"?f.textContent!==F&&(x.suppressHydrationWarning!==!0&&rl(f.textContent,F,t),v=["children",F]):typeof F=="number"&&f.textContent!==""+F&&(x.suppressHydrationWarning!==!0&&rl(f.textContent,F,t),v=["children",""+F]):o.hasOwnProperty(R)&&F!=null&&R==="onScroll"&&rt("scroll",f)}switch(a){case"input":Ce(f),_e(f,x,!0);break;case"textarea":Ce(f),Xe(f);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(f.onclick=sl)}f=v,s.updateQueue=f,f!==null&&(s.flags|=4)}else{R=v.nodeType===9?v:v.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Ot(a)),t==="http://www.w3.org/1999/xhtml"?a==="script"?(t=R.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof f.is=="string"?t=R.createElement(a,{is:f.is}):(t=R.createElement(a),a==="select"&&(R=t,f.multiple?R.multiple=!0:f.size&&(R.size=f.size))):t=R.createElementNS(t,a),t[ur]=s,t[zo]=f,ow(t,s,!1,!1),s.stateNode=t;e:{switch(R=Lt(a,f),a){case"dialog":rt("cancel",t),rt("close",t),v=f;break;case"iframe":case"object":case"embed":rt("load",t),v=f;break;case"video":case"audio":for(v=0;v<$o.length;v++)rt($o[v],t);v=f;break;case"source":rt("error",t),v=f;break;case"img":case"image":case"link":rt("error",t),rt("load",t),v=f;break;case"details":rt("toggle",t),v=f;break;case"input":Ee(t,f),v=ye(t,f),rt("invalid",t);break;case"option":v=f;break;case"select":t._wrapperState={wasMultiple:!!f.multiple},v=Z({},f,{value:void 0}),rt("invalid",t);break;case"textarea":$e(t,f),v=Ze(t,f),rt("invalid",t);break;default:v=f}Yt(a,v),F=v;for(x in F)if(F.hasOwnProperty(x)){var X=F[x];x==="style"?vt(t,X):x==="dangerouslySetInnerHTML"?(X=X?X.__html:void 0,X!=null&&Pt(t,X)):x==="children"?typeof X=="string"?(a!=="textarea"||X!=="")&&zt(t,X):typeof X=="number"&&zt(t,""+X):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?X!=null&&x==="onScroll"&&rt("scroll",t):X!=null&&E(t,x,X,R))}switch(a){case"input":Ce(t),_e(t,f,!1);break;case"textarea":Ce(t),Xe(t);break;case"option":f.value!=null&&t.setAttribute("value",""+fe(f.value));break;case"select":t.multiple=!!f.multiple,x=f.value,x!=null?ft(t,!!f.multiple,x,!1):f.defaultValue!=null&&ft(t,!!f.multiple,f.defaultValue,!0);break;default:typeof v.onClick=="function"&&(t.onclick=sl)}switch(a){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}}f&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Wt(s),null;case 6:if(t&&s.stateNode!=null)lw(t,s,t.memoizedProps,f);else{if(typeof f!="string"&&s.stateNode===null)throw Error(r(166));if(a=ti(Vo.current),ti(cr.current),dl(s)){if(f=s.stateNode,a=s.memoizedProps,f[ur]=s,(x=f.nodeValue!==a)&&(t=yn,t!==null))switch(t.tag){case 3:rl(f.nodeValue,a,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&rl(f.nodeValue,a,(t.mode&1)!==0)}x&&(s.flags|=4)}else f=(a.nodeType===9?a:a.ownerDocument).createTextNode(f),f[ur]=s,s.stateNode=f}return Wt(s),null;case 13:if(st(ct),f=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(ot&&wn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)d0(),zi(),s.flags|=98560,x=!1;else if(x=dl(s),f!==null&&f.dehydrated!==null){if(t===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&&(gd(Vn),Vn=null),x=!0;if(!x)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=a,s):(f=f!==null,f!==(t!==null&&t.memoizedState!==null)&&f&&(s.child.flags|=8192,(s.mode&1)!==0&&(t===null||(ct.current&1)!==0?Et===0&&(Et=3):wd())),s.updateQueue!==null&&(s.flags|=4),Wt(s),null);case 4:return Wi(),id(t,s),t===null&&Do(s.stateNode.containerInfo),Wt(s),null;case 10:return Mc(s.type._context),Wt(s),null;case 17:return sn(s.type)&&ol(),Wt(s),null;case 19:if(st(ct),x=s.memoizedState,x===null)return Wt(s),null;if(f=(s.flags&128)!==0,R=x.rendering,R===null)if(f)Qo(x,!1);else{if(Et!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(R=vl(t),R!==null){for(s.flags|=128,Qo(x,!1),f=R.updateQueue,f!==null&&(s.updateQueue=f,s.flags|=4),s.subtreeFlags=0,f=a,a=s.child;a!==null;)x=a,t=f,x.flags&=14680066,R=x.alternate,R===null?(x.childLanes=0,x.lanes=t,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=R.childLanes,x.lanes=R.lanes,x.child=R.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=R.memoizedProps,x.memoizedState=R.memoizedState,x.updateQueue=R.updateQueue,x.type=R.type,t=R.dependencies,x.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),a=a.sibling;return tt(ct,ct.current&1|2),s.child}t=t.sibling}x.tail!==null&&nt()>Ki&&(s.flags|=128,f=!0,Qo(x,!1),s.lanes=4194304)}else{if(!f)if(t=vl(R),t!==null){if(s.flags|=128,f=!0,a=t.updateQueue,a!==null&&(s.updateQueue=a,s.flags|=4),Qo(x,!0),x.tail===null&&x.tailMode==="hidden"&&!R.alternate&&!ot)return Wt(s),null}else 2*nt()-x.renderingStartTime>Ki&&a!==1073741824&&(s.flags|=128,f=!0,Qo(x,!1),s.lanes=4194304);x.isBackwards?(R.sibling=s.child,s.child=R):(a=x.last,a!==null?a.sibling=R:s.child=R,x.last=R)}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,f?a&1|2:a&1),s):(Wt(s),null);case 22:case 23:return yd(),f=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==f&&(s.flags|=8192),f&&(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 OR(t,s){switch(Cc(s),s.tag){case 1:return sn(s.type)&&ol(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return Wi(),st(rn),st(Ut),Fc(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return $c(s),null;case 13:if(st(ct),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(r(340));zi()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return st(ct),null;case 4:return Wi(),null;case 10:return Mc(s.type._context),null;case 22:case 23:return yd(),null;case 24:return null;default:return null}}var Nl=!1,Vt=!1,PR=typeof WeakSet=="function"?WeakSet:Set,ke=null;function Gi(t,s){var a=t.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(f){mt(t,s,f)}else a.current=null}function od(t,s,a){try{a()}catch(f){mt(t,s,f)}}var uw=!1;function LR(t,s){if(yc=Ti,t=zy(),cc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var f=a.getSelection&&a.getSelection();if(f&&f.rangeCount!==0){a=f.anchorNode;var v=f.anchorOffset,x=f.focusNode;f=f.focusOffset;try{a.nodeType,x.nodeType}catch{a=null;break e}var R=0,F=-1,X=-1,le=0,pe=0,me=t,he=null;t:for(;;){for(var be;me!==a||v!==0&&me.nodeType!==3||(F=R+v),me!==x||f!==0&&me.nodeType!==3||(X=R+f),me.nodeType===3&&(R+=me.nodeValue.length),(be=me.firstChild)!==null;)he=me,me=be;for(;;){if(me===t)break t;if(he===a&&++le===v&&(F=R),he===x&&++pe===f&&(X=R),(be=me.nextSibling)!==null)break;me=he,he=me.parentNode}me=be}a=F===-1||X===-1?null:{start:F,end:X}}else a=null}a=a||{start:0,end:0}}else a=null;for(wc={focusedElem:t,selectionRange:a},Ti=!1,ke=s;ke!==null;)if(s=ke,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,ke=t;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 Te=Ne.memoizedProps,yt=Ne.memoizedState,se=s.stateNode,ee=se.getSnapshotBeforeUpdate(s.elementType===s.type?Te:Gn(s.type,Te),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(t=s.sibling,t!==null){t.return=s.return,ke=t;break}ke=s.return}return Ne=uw,uw=!1,Ne}function Zo(t,s,a){var f=s.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&t)===t){var x=v.destroy;v.destroy=void 0,x!==void 0&&od(s,a,x)}v=v.next}while(v!==f)}}function Cl(t,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&t)===t){var f=a.create;a.destroy=f()}a=a.next}while(a!==s)}}function ad(t){var s=t.ref;if(s!==null){var a=t.stateNode;switch(t.tag){case 5:t=a;break;default:t=a}typeof s=="function"?s(t):s.current=t}}function cw(t){var s=t.alternate;s!==null&&(t.alternate=null,cw(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[ur],delete s[zo],delete s[Sc],delete s[yR],delete s[wR])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function dw(t){return t.tag===5||t.tag===3||t.tag===4}function fw(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||dw(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ld(t,s,a){var f=t.tag;if(f===5||f===6)t=t.stateNode,s?a.nodeType===8?a.parentNode.insertBefore(t,s):a.insertBefore(t,s):(a.nodeType===8?(s=a.parentNode,s.insertBefore(t,a)):(s=a,s.appendChild(t)),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=sl));else if(f!==4&&(t=t.child,t!==null))for(ld(t,s,a),t=t.sibling;t!==null;)ld(t,s,a),t=t.sibling}function ud(t,s,a){var f=t.tag;if(f===5||f===6)t=t.stateNode,s?a.insertBefore(t,s):a.appendChild(t);else if(f!==4&&(t=t.child,t!==null))for(ud(t,s,a),t=t.sibling;t!==null;)ud(t,s,a),t=t.sibling}var $t=null,Yn=!1;function vs(t,s,a){for(a=a.child;a!==null;)hw(t,s,a),a=a.sibling}function hw(t,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 f=$t,v=Yn;$t=null,vs(t,s,a),$t=f,Yn=v,$t!==null&&(Yn?(t=$t,a=a.stateNode,t.nodeType===8?t.parentNode.removeChild(a):t.removeChild(a)):$t.removeChild(a.stateNode));break;case 18:$t!==null&&(Yn?(t=$t,a=a.stateNode,t.nodeType===8?bc(t.parentNode,a):t.nodeType===1&&bc(t,a),rs(t)):bc($t,a.stateNode));break;case 4:f=$t,v=Yn,$t=a.stateNode.containerInfo,Yn=!0,vs(t,s,a),$t=f,Yn=v;break;case 0:case 11:case 14:case 15:if(!Vt&&(f=a.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){v=f=f.next;do{var x=v,R=x.destroy;x=x.tag,R!==void 0&&((x&2)!==0||(x&4)!==0)&&od(a,s,R),v=v.next}while(v!==f)}vs(t,s,a);break;case 1:if(!Vt&&(Gi(a,s),f=a.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=a.memoizedProps,f.state=a.memoizedState,f.componentWillUnmount()}catch(F){mt(a,s,F)}vs(t,s,a);break;case 21:vs(t,s,a);break;case 22:a.mode&1?(Vt=(f=Vt)||a.memoizedState!==null,vs(t,s,a),Vt=f):vs(t,s,a);break;default:vs(t,s,a)}}function pw(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var a=t.stateNode;a===null&&(a=t.stateNode=new PR),s.forEach(function(f){var v=WR.bind(null,t,f);a.has(f)||(a.add(f),f.then(v,v))})}}function Kn(t,s){var a=s.deletions;if(a!==null)for(var f=0;f<a.length;f++){var v=a[f];try{var x=t,R=s,F=R;e:for(;F!==null;){switch(F.tag){case 5:$t=F.stateNode,Yn=!1;break e;case 3:$t=F.stateNode.containerInfo,Yn=!0;break e;case 4:$t=F.stateNode.containerInfo,Yn=!0;break e}F=F.return}if($t===null)throw Error(r(160));hw(x,R,v),$t=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;)mw(s,t),s=s.sibling}function mw(t,s){var a=t.alternate,f=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Kn(s,t),fr(t),f&4){try{Zo(3,t,t.return),Cl(3,t)}catch(Te){mt(t,t.return,Te)}try{Zo(5,t,t.return)}catch(Te){mt(t,t.return,Te)}}break;case 1:Kn(s,t),fr(t),f&512&&a!==null&&Gi(a,a.return);break;case 5:if(Kn(s,t),fr(t),f&512&&a!==null&&Gi(a,a.return),t.flags&32){var v=t.stateNode;try{zt(v,"")}catch(Te){mt(t,t.return,Te)}}if(f&4&&(v=t.stateNode,v!=null)){var x=t.memoizedProps,R=a!==null?a.memoizedProps:x,F=t.type,X=t.updateQueue;if(t.updateQueue=null,X!==null)try{F==="input"&&x.type==="radio"&&x.name!=null&&Ye(v,x),Lt(F,R);var le=Lt(F,x);for(R=0;R<X.length;R+=2){var pe=X[R],me=X[R+1];pe==="style"?vt(v,me):pe==="dangerouslySetInnerHTML"?Pt(v,me):pe==="children"?zt(v,me):E(v,pe,me,le)}switch(F){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[zo]=x}catch(Te){mt(t,t.return,Te)}}break;case 6:if(Kn(s,t),fr(t),f&4){if(t.stateNode===null)throw Error(r(162));v=t.stateNode,x=t.memoizedProps;try{v.nodeValue=x}catch(Te){mt(t,t.return,Te)}}break;case 3:if(Kn(s,t),fr(t),f&4&&a!==null&&a.memoizedState.isDehydrated)try{rs(s.containerInfo)}catch(Te){mt(t,t.return,Te)}break;case 4:Kn(s,t),fr(t);break;case 13:Kn(s,t),fr(t),v=t.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(fd=nt())),f&4&&pw(t);break;case 22:if(pe=a!==null&&a.memoizedState!==null,t.mode&1?(Vt=(le=Vt)||pe,Kn(s,t),Vt=le):Kn(s,t),fr(t),f&8192){if(le=t.memoizedState!==null,(t.stateNode.isHidden=le)&&!pe&&(t.mode&1)!==0)for(ke=t,pe=t.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:Zo(4,he,he.return);break;case 1:Gi(he,he.return);var Ne=he.stateNode;if(typeof Ne.componentWillUnmount=="function"){f=he,a=he.return;try{s=f,Ne.props=s.memoizedProps,Ne.state=s.memoizedState,Ne.componentWillUnmount()}catch(Te){mt(f,a,Te)}}break;case 5:Gi(he,he.return);break;case 22:if(he.memoizedState!==null){yw(me);continue}}be!==null?(be.return=he,ke=be):yw(me)}pe=pe.sibling}e:for(pe=null,me=t;;){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"):(F=me.stateNode,X=me.memoizedProps.style,R=X!=null&&X.hasOwnProperty("display")?X.display:null,F.style.display=ht("display",R))}catch(Te){mt(t,t.return,Te)}}}else if(me.tag===6){if(pe===null)try{me.stateNode.nodeValue=le?"":me.memoizedProps}catch(Te){mt(t,t.return,Te)}}else if((me.tag!==22&&me.tag!==23||me.memoizedState===null||me===t)&&me.child!==null){me.child.return=me,me=me.child;continue}if(me===t)break e;for(;me.sibling===null;){if(me.return===null||me.return===t)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,t),fr(t),f&4&&pw(t);break;case 21:break;default:Kn(s,t),fr(t)}}function fr(t){var s=t.flags;if(s&2){try{e:{for(var a=t.return;a!==null;){if(dw(a)){var f=a;break e}a=a.return}throw Error(r(160))}switch(f.tag){case 5:var v=f.stateNode;f.flags&32&&(zt(v,""),f.flags&=-33);var x=fw(t);ud(t,x,v);break;case 3:case 4:var R=f.stateNode.containerInfo,F=fw(t);ld(t,F,R);break;default:throw Error(r(161))}}catch(X){mt(t,t.return,X)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function qR(t,s,a){ke=t,gw(t)}function gw(t,s,a){for(var f=(t.mode&1)!==0;ke!==null;){var v=ke,x=v.child;if(v.tag===22&&f){var R=v.memoizedState!==null||Nl;if(!R){var F=v.alternate,X=F!==null&&F.memoizedState!==null||Vt;F=Nl;var le=Vt;if(Nl=R,(Vt=X)&&!le)for(ke=v;ke!==null;)R=ke,X=R.child,R.tag===22&&R.memoizedState!==null?ww(v):X!==null?(X.return=R,ke=X):ww(v);for(;x!==null;)ke=x,gw(x),x=x.sibling;ke=v,Nl=F,Vt=le}vw(t)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,ke=x):vw(t)}}function vw(t){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||Cl(5,s);break;case 1:var f=s.stateNode;if(s.flags&4&&!Vt)if(a===null)f.componentDidMount();else{var v=s.elementType===s.type?a.memoizedProps:Gn(s.type,a.memoizedProps);f.componentDidUpdate(v,a.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var x=s.updateQueue;x!==null&&y0(s,x,f);break;case 3:var R=s.updateQueue;if(R!==null){if(a=null,s.child!==null)switch(s.child.tag){case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}y0(s,R,a)}break;case 5:var F=s.stateNode;if(a===null&&s.flags&4){a=F;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&&ad(s)}catch(he){mt(s,s.return,he)}}if(s===t){ke=null;break}if(a=s.sibling,a!==null){a.return=s.return,ke=a;break}ke=s.return}}function yw(t){for(;ke!==null;){var s=ke;if(s===t){ke=null;break}var a=s.sibling;if(a!==null){a.return=s.return,ke=a;break}ke=s.return}}function ww(t){for(;ke!==null;){var s=ke;try{switch(s.tag){case 0:case 11:case 15:var a=s.return;try{Cl(4,s)}catch(X){mt(s,a,X)}break;case 1:var f=s.stateNode;if(typeof f.componentDidMount=="function"){var v=s.return;try{f.componentDidMount()}catch(X){mt(s,v,X)}}var x=s.return;try{ad(s)}catch(X){mt(s,x,X)}break;case 5:var R=s.return;try{ad(s)}catch(X){mt(s,R,X)}}}catch(X){mt(s,s.return,X)}if(s===t){ke=null;break}var F=s.sibling;if(F!==null){F.return=s.return,ke=F;break}ke=s.return}}var $R=Math.ceil,Tl=T.ReactCurrentDispatcher,cd=T.ReactCurrentOwner,Mn=T.ReactCurrentBatchConfig,Ue=0,At=null,xt=null,Dt=0,xn=0,Yi=fs(0),Et=0,Jo=null,ri=0,Rl=0,dd=0,ea=null,an=null,fd=0,Ki=1/0,Lr=null,jl=!1,hd=null,ys=null,Al=!1,ws=null,Il=0,ta=0,pd=null,Ml=-1,Ol=0;function en(){return(Ue&6)!==0?nt():Ml!==-1?Ml:Ml=nt()}function xs(t){return(t.mode&1)===0?1:(Ue&2)!==0&&Dt!==0?Dt&-Dt:_R.transition!==null?(Ol===0&&(Ol=ki()),Ol):(t=He,t!==0||(t=window.event,t=t===void 0?16:is(t.type)),t)}function Xn(t,s,a,f){if(50<ta)throw ta=0,pd=null,Error(r(185));es(t,a,f),((Ue&2)===0||t!==At)&&(t===At&&((Ue&2)===0&&(Rl|=a),Et===4&&_s(t,Dt)),ln(t,f),a===1&&Ue===0&&(s.mode&1)===0&&(Ki=nt()+500,ll&&ps()))}function ln(t,s){var a=t.callbackNode;za(t,s);var f=Ds(t,t===At?Dt:0);if(f===0)a!==null&&Kt(a),t.callbackNode=null,t.callbackPriority=0;else if(s=f&-f,t.callbackPriority!==s){if(a!=null&&Kt(a),s===1)t.tag===0?xR(_w.bind(null,t)):o0(_w.bind(null,t)),gR(function(){(Ue&6)===0&&ps()}),a=null;else{switch(Ba(f)){case 1:a=Xr;break;case 4:a=Ls;break;case 16:a=Qr;break;case 536870912:a=qs;break;default:a=Qr}a=Rw(a,xw.bind(null,t))}t.callbackPriority=s,t.callbackNode=a}}function xw(t,s){if(Ml=-1,Ol=0,(Ue&6)!==0)throw Error(r(327));var a=t.callbackNode;if(Xi()&&t.callbackNode!==a)return null;var f=Ds(t,t===At?Dt:0);if(f===0)return null;if((f&30)!==0||(f&t.expiredLanes)!==0||s)s=Pl(t,f);else{s=f;var v=Ue;Ue|=2;var x=Sw();(At!==t||Dt!==s)&&(Lr=null,Ki=nt()+500,ii(t,s));do try{zR();break}catch(F){bw(t,F)}while(!0);Ic(),Tl.current=x,Ue=v,xt!==null?s=0:(At=null,Dt=0,s=Et)}if(s!==0){if(s===2&&(v=No(t),v!==0&&(f=v,s=md(t,v))),s===1)throw a=Jo,ii(t,0),_s(t,f),ln(t,nt()),a;if(s===6)_s(t,f);else{if(v=t.current.alternate,(f&30)===0&&!DR(v)&&(s=Pl(t,f),s===2&&(x=No(t),x!==0&&(f=x,s=md(t,x))),s===1))throw a=Jo,ii(t,0),_s(t,f),ln(t,nt()),a;switch(t.finishedWork=v,t.finishedLanes=f,s){case 0:case 1:throw Error(r(345));case 2:oi(t,an,Lr);break;case 3:if(_s(t,f),(f&130023424)===f&&(s=fd+500-nt(),10<s)){if(Ds(t,0)!==0)break;if(v=t.suspendedLanes,(v&f)!==f){en(),t.pingedLanes|=t.suspendedLanes&v;break}t.timeoutHandle=_c(oi.bind(null,t,an,Lr),s);break}oi(t,an,Lr);break;case 4:if(_s(t,f),(f&4194240)===f)break;for(s=t.eventTimes,v=-1;0<f;){var R=31-pt(f);x=1<<R,R=s[R],R>v&&(v=R),f&=~x}if(f=v,f=nt()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*$R(f/1960))-f,10<f){t.timeoutHandle=_c(oi.bind(null,t,an,Lr),f);break}oi(t,an,Lr);break;case 5:oi(t,an,Lr);break;default:throw Error(r(329))}}}return ln(t,nt()),t.callbackNode===a?xw.bind(null,t):null}function md(t,s){var a=ea;return t.current.memoizedState.isDehydrated&&(ii(t,s).flags|=256),t=Pl(t,s),t!==2&&(s=an,an=a,s!==null&&gd(s)),t}function gd(t){an===null?an=t:an.push.apply(an,t)}function DR(t){for(var s=t;;){if(s.flags&16384){var a=s.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var f=0;f<a.length;f++){var v=a[f],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===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function _s(t,s){for(s&=~dd,s&=~Rl,t.suspendedLanes|=s,t.pingedLanes&=~s,t=t.expirationTimes;0<s;){var a=31-pt(s),f=1<<a;t[a]=-1,s&=~f}}function _w(t){if((Ue&6)!==0)throw Error(r(327));Xi();var s=Ds(t,0);if((s&1)===0)return ln(t,nt()),null;var a=Pl(t,s);if(t.tag!==0&&a===2){var f=No(t);f!==0&&(s=f,a=md(t,f))}if(a===1)throw a=Jo,ii(t,0),_s(t,s),ln(t,nt()),a;if(a===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=s,oi(t,an,Lr),ln(t,nt()),null}function vd(t,s){var a=Ue;Ue|=1;try{return t(s)}finally{Ue=a,Ue===0&&(Ki=nt()+500,ll&&ps())}}function si(t){ws!==null&&ws.tag===0&&(Ue&6)===0&&Xi();var s=Ue;Ue|=1;var a=Mn.transition,f=He;try{if(Mn.transition=null,He=1,t)return t()}finally{He=f,Mn.transition=a,Ue=s,(Ue&6)===0&&ps()}}function yd(){xn=Yi.current,st(Yi)}function ii(t,s){t.finishedWork=null,t.finishedLanes=0;var a=t.timeoutHandle;if(a!==-1&&(t.timeoutHandle=-1,mR(a)),xt!==null)for(a=xt.return;a!==null;){var f=a;switch(Cc(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&ol();break;case 3:Wi(),st(rn),st(Ut),Fc();break;case 5:$c(f);break;case 4:Wi();break;case 13:st(ct);break;case 19:st(ct);break;case 10:Mc(f.type._context);break;case 22:case 23:yd()}a=a.return}if(At=t,xt=t=bs(t.current,null),Dt=xn=s,Et=0,Jo=null,dd=Rl=ri=0,an=ea=null,ei!==null){for(s=0;s<ei.length;s++)if(a=ei[s],f=a.interleaved,f!==null){a.interleaved=null;var v=f.next,x=a.pending;if(x!==null){var R=x.next;x.next=v,f.next=R}a.pending=f}ei=null}return t}function bw(t,s){do{var a=xt;try{if(Ic(),yl.current=bl,wl){for(var f=dt.memoizedState;f!==null;){var v=f.queue;v!==null&&(v.pending=null),f=f.next}wl=!1}if(ni=0,jt=kt=dt=null,Go=!1,Yo=0,cd.current=null,a===null||a.return===null){Et=1,Jo=s,xt=null;break}e:{var x=t,R=a.return,F=a,X=s;if(s=Dt,F.flags|=32768,X!==null&&typeof X=="object"&&typeof X.then=="function"){var le=X,pe=F,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=G0(R);if(be!==null){be.flags&=-257,Y0(be,R,F,x,s),be.mode&1&&V0(x,le,s),s=be,X=le;var Ne=s.updateQueue;if(Ne===null){var Te=new Set;Te.add(X),s.updateQueue=Te}else Ne.add(X);break e}else{if((s&1)===0){V0(x,le,s),wd();break e}X=Error(r(426))}}else if(ot&&F.mode&1){var yt=G0(R);if(yt!==null){(yt.flags&65536)===0&&(yt.flags|=256),Y0(yt,R,F,x,s),jc(Vi(X,F));break e}}x=X=Vi(X,F),Et!==4&&(Et=2),ea===null?ea=[x]:ea.push(x),x=R;do{switch(x.tag){case 3:x.flags|=65536,s&=-s,x.lanes|=s;var se=H0(x,X,s);v0(x,se);break e;case 1:F=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=W0(x,F,s);v0(x,ge);break e}}x=x.return}while(x!==null)}Ew(a)}catch(Re){s=Re,xt===a&&a!==null&&(xt=a=a.return);continue}break}while(!0)}function Sw(){var t=Tl.current;return Tl.current=bl,t===null?bl:t}function wd(){(Et===0||Et===3||Et===2)&&(Et=4),At===null||(ri&268435455)===0&&(Rl&268435455)===0||_s(At,Dt)}function Pl(t,s){var a=Ue;Ue|=2;var f=Sw();(At!==t||Dt!==s)&&(Lr=null,ii(t,s));do try{FR();break}catch(v){bw(t,v)}while(!0);if(Ic(),Ue=a,Tl.current=f,xt!==null)throw Error(r(261));return At=null,Dt=0,Et}function FR(){for(;xt!==null;)kw(xt)}function zR(){for(;xt!==null&&!Kr();)kw(xt)}function kw(t){var s=Tw(t.alternate,t,xn);t.memoizedProps=t.pendingProps,s===null?Ew(t):xt=s,cd.current=null}function Ew(t){var s=t;do{var a=s.alternate;if(t=s.return,(s.flags&32768)===0){if(a=MR(a,s,xn),a!==null){xt=a;return}}else{if(a=OR(a,s),a!==null){a.flags&=32767,xt=a;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Et=6,xt=null;return}}if(s=s.sibling,s!==null){xt=s;return}xt=s=t}while(s!==null);Et===0&&(Et=5)}function oi(t,s,a){var f=He,v=Mn.transition;try{Mn.transition=null,He=1,BR(t,s,a,f)}finally{Mn.transition=v,He=f}return null}function BR(t,s,a,f){do Xi();while(ws!==null);if((Ue&6)!==0)throw Error(r(327));a=t.finishedWork;var v=t.finishedLanes;if(a===null)return null;if(t.finishedWork=null,t.finishedLanes=0,a===t.current)throw Error(r(177));t.callbackNode=null,t.callbackPriority=0;var x=a.lanes|a.childLanes;if(nc(t,x),t===At&&(xt=At=null,Dt=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||Al||(Al=!0,Rw(Qr,function(){return Xi(),null})),x=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||x){x=Mn.transition,Mn.transition=null;var R=He;He=1;var F=Ue;Ue|=4,cd.current=null,LR(t,a),mw(a,t),lR(wc),Ti=!!yc,wc=yc=null,t.current=a,qR(a),Si(),Ue=F,He=R,Mn.transition=x}else t.current=a;if(Al&&(Al=!1,ws=t,Il=v),x=t.pendingLanes,x===0&&(ys=null),$s(a.stateNode),ln(t,nt()),s!==null)for(f=t.onRecoverableError,a=0;a<s.length;a++)v=s[a],f(v.value,{componentStack:v.stack,digest:v.digest});if(jl)throw jl=!1,t=hd,hd=null,t;return(Il&1)!==0&&t.tag!==0&&Xi(),x=t.pendingLanes,(x&1)!==0?t===pd?ta++:(ta=0,pd=t):ta=0,ps(),null}function Xi(){if(ws!==null){var t=Ba(Il),s=Mn.transition,a=He;try{if(Mn.transition=null,He=16>t?16:t,ws===null)var f=!1;else{if(t=ws,ws=null,Il=0,(Ue&6)!==0)throw Error(r(331));var v=Ue;for(Ue|=4,ke=t.current;ke!==null;){var x=ke,R=x.child;if((ke.flags&16)!==0){var F=x.deletions;if(F!==null){for(var X=0;X<F.length;X++){var le=F[X];for(ke=le;ke!==null;){var pe=ke;switch(pe.tag){case 0:case 11:case 15:Zo(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(cw(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 Te=Ne.child;if(Te!==null){Ne.child=null;do{var yt=Te.sibling;Te.sibling=null,Te=yt}while(Te!==null)}}ke=x}}if((x.subtreeFlags&2064)!==0&&R!==null)R.return=x,ke=R;else e:for(;ke!==null;){if(x=ke,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Zo(9,x,x.return)}var se=x.sibling;if(se!==null){se.return=x.return,ke=se;break e}ke=x.return}}var ee=t.current;for(ke=ee;ke!==null;){R=ke;var ie=R.child;if((R.subtreeFlags&2064)!==0&&ie!==null)ie.return=R,ke=ie;else e:for(R=ee;ke!==null;){if(F=ke,(F.flags&2048)!==0)try{switch(F.tag){case 0:case 11:case 15:Cl(9,F)}}catch(Re){mt(F,F.return,Re)}if(F===R){ke=null;break e}var ge=F.sibling;if(ge!==null){ge.return=F.return,ke=ge;break e}ke=F.return}}if(Ue=v,ps(),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(ir,t)}catch{}f=!0}return f}finally{He=a,Mn.transition=s}}return!1}function Nw(t,s,a){s=Vi(a,s),s=H0(t,s,1),t=gs(t,s,1),s=en(),t!==null&&(es(t,1,s),ln(t,s))}function mt(t,s,a){if(t.tag===3)Nw(t,t,a);else for(;s!==null;){if(s.tag===3){Nw(s,t,a);break}else if(s.tag===1){var f=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(ys===null||!ys.has(f))){t=Vi(a,t),t=W0(s,t,1),s=gs(s,t,1),t=en(),s!==null&&(es(s,1,t),ln(s,t));break}}s=s.return}}function UR(t,s,a){var f=t.pingCache;f!==null&&f.delete(s),s=en(),t.pingedLanes|=t.suspendedLanes&a,At===t&&(Dt&a)===a&&(Et===4||Et===3&&(Dt&130023424)===Dt&&500>nt()-fd?ii(t,0):dd|=a),ln(t,s)}function Cw(t,s){s===0&&((t.mode&1)===0?s=1:(s=Jr,Jr<<=1,(Jr&130023424)===0&&(Jr=4194304)));var a=en();t=Mr(t,s),t!==null&&(es(t,s,a),ln(t,a))}function HR(t){var s=t.memoizedState,a=0;s!==null&&(a=s.retryLane),Cw(t,a)}function WR(t,s){var a=0;switch(t.tag){case 13:var f=t.stateNode,v=t.memoizedState;v!==null&&(a=v.retryLane);break;case 19:f=t.stateNode;break;default:throw Error(r(314))}f!==null&&f.delete(s),Cw(t,a)}var Tw;Tw=function(t,s,a){if(t!==null)if(t.memoizedProps!==s.pendingProps||rn.current)on=!0;else{if((t.lanes&a)===0&&(s.flags&128)===0)return on=!1,IR(t,s,a);on=(t.flags&131072)!==0}else on=!1,ot&&(s.flags&1048576)!==0&&a0(s,cl,s.index);switch(s.lanes=0,s.tag){case 2:var f=s.type;El(t,s),t=s.pendingProps;var v=$i(s,Ut.current);Hi(s,a),v=Uc(null,s,f,t,v,a);var x=Hc();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(f)?(x=!0,al(s)):x=!1,s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Lc(s),v.updater=Sl,s.stateNode=v,v._reactInternals=s,Xc(s,f,t,a),s=ed(null,s,f,!0,x,a)):(s.tag=0,ot&&x&&Nc(s),Jt(null,s,v,a),s=s.child),s;case 16:f=s.elementType;e:{switch(El(t,s),t=s.pendingProps,v=f._init,f=v(f._payload),s.type=f,v=s.tag=GR(f),t=Gn(f,t),v){case 0:s=Jc(null,s,f,t,a);break e;case 1:s=ew(null,s,f,t,a);break e;case 11:s=K0(null,s,f,t,a);break e;case 14:s=X0(null,s,f,Gn(f.type,t),a);break e}throw Error(r(306,f,""))}return s;case 0:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Gn(f,v),Jc(t,s,f,v,a);case 1:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Gn(f,v),ew(t,s,f,v,a);case 3:e:{if(tw(s),t===null)throw Error(r(387));f=s.pendingProps,x=s.memoizedState,v=x.element,g0(t,s),gl(s,f,null,a);var R=s.memoizedState;if(f=R.element,x.isDehydrated)if(x={element:f,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){v=Vi(Error(r(423)),s),s=nw(t,s,f,a,v);break e}else if(f!==v){v=Vi(Error(r(424)),s),s=nw(t,s,f,a,v);break e}else for(wn=ds(s.stateNode.containerInfo.firstChild),yn=s,ot=!0,Vn=null,a=p0(s,null,f,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(zi(),f===v){s=Pr(t,s,a);break e}Jt(t,s,f,a)}s=s.child}return s;case 5:return w0(s),t===null&&Rc(s),f=s.type,v=s.pendingProps,x=t!==null?t.memoizedProps:null,R=v.children,xc(f,v)?R=null:x!==null&&xc(f,x)&&(s.flags|=32),J0(t,s),Jt(t,s,R,a),s.child;case 6:return t===null&&Rc(s),null;case 13:return rw(t,s,a);case 4:return qc(s,s.stateNode.containerInfo),f=s.pendingProps,t===null?s.child=Bi(s,null,f,a):Jt(t,s,f,a),s.child;case 11:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Gn(f,v),K0(t,s,f,v,a);case 7:return Jt(t,s,s.pendingProps,a),s.child;case 8:return Jt(t,s,s.pendingProps.children,a),s.child;case 12:return Jt(t,s,s.pendingProps.children,a),s.child;case 10:e:{if(f=s.type._context,v=s.pendingProps,x=s.memoizedProps,R=v.value,tt(hl,f._currentValue),f._currentValue=R,x!==null)if(Wn(x.value,R)){if(x.children===v.children&&!rn.current){s=Pr(t,s,a);break e}}else for(x=s.child,x!==null&&(x.return=s);x!==null;){var F=x.dependencies;if(F!==null){R=x.child;for(var X=F.firstContext;X!==null;){if(X.context===f){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),Oc(x.return,a,s),F.lanes|=a;break}X=X.next}}else if(x.tag===10)R=x.type===s.type?null:x.child;else if(x.tag===18){if(R=x.return,R===null)throw Error(r(341));R.lanes|=a,F=R.alternate,F!==null&&(F.lanes|=a),Oc(R,a,s),R=x.sibling}else R=x.child;if(R!==null)R.return=x;else for(R=x;R!==null;){if(R===s){R=null;break}if(x=R.sibling,x!==null){x.return=R.return,R=x;break}R=R.return}x=R}Jt(t,s,v.children,a),s=s.child}return s;case 9:return v=s.type,f=s.pendingProps.children,Hi(s,a),v=An(v),f=f(v),s.flags|=1,Jt(t,s,f,a),s.child;case 14:return f=s.type,v=Gn(f,s.pendingProps),v=Gn(f.type,v),X0(t,s,f,v,a);case 15:return Q0(t,s,s.type,s.pendingProps,a);case 17:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Gn(f,v),El(t,s),s.tag=1,sn(f)?(t=!0,al(s)):t=!1,Hi(s,a),B0(s,f,v),Xc(s,f,v,a),ed(null,s,f,!0,t,a);case 19:return iw(t,s,a);case 22:return Z0(t,s,a)}throw Error(r(156,s.tag))};function Rw(t,s){return _r(t,s)}function VR(t,s,a,f){this.tag=t,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=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function On(t,s,a,f){return new VR(t,s,a,f)}function xd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function GR(t){if(typeof t=="function")return xd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===V)return 11;if(t===$)return 14}return 2}function bs(t,s){var a=t.alternate;return a===null?(a=On(t.tag,s,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=s,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&14680064,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,s=t.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a}function Ll(t,s,a,f,v,x){var R=2;if(f=t,typeof t=="function")xd(t)&&(R=1);else if(typeof t=="string")R=5;else e:switch(t){case A:return ai(a.children,v,x,s);case U:R=8,v|=8;break;case z:return t=On(12,a,s,v|2),t.elementType=z,t.lanes=x,t;case B:return t=On(13,a,s,v),t.elementType=B,t.lanes=x,t;case C:return t=On(19,a,s,v),t.elementType=C,t.lanes=x,t;case re:return ql(a,v,x,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case P:R=10;break e;case D:R=9;break e;case V:R=11;break e;case $:R=14;break e;case L:R=16,f=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return s=On(R,a,s,v),s.elementType=t,s.type=f,s.lanes=x,s}function ai(t,s,a,f){return t=On(7,t,f,s),t.lanes=a,t}function ql(t,s,a,f){return t=On(22,t,f,s),t.elementType=re,t.lanes=a,t.stateNode={isHidden:!1},t}function _d(t,s,a){return t=On(6,t,null,s),t.lanes=a,t}function bd(t,s,a){return s=On(4,t.children!==null?t.children:[],t.key,s),s.lanes=a,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}function YR(t,s,a,f,v){this.tag=s,this.containerInfo=t,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=f,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Sd(t,s,a,f,v,x,R,F,X){return t=new YR(t,s,a,F,X),s===1?(s=1,x===!0&&(s|=8)):s=0,x=On(3,null,null,s),t.current=x,x.stateNode=t,x.memoizedState={element:f,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Lc(x),t}function KR(t,s,a){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:f==null?null:""+f,children:t,containerInfo:s,implementation:a}}function jw(t){if(!t)return hs;t=t._reactInternals;e:{if(En(t)!==t||t.tag!==1)throw Error(r(170));var s=t;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(t.tag===1){var a=t.type;if(sn(a))return s0(t,a,s)}return s}function Aw(t,s,a,f,v,x,R,F,X){return t=Sd(a,f,!0,t,v,x,R,F,X),t.context=jw(null),a=t.current,f=en(),v=xs(a),x=Or(f,v),x.callback=s??null,gs(a,x,v),t.current.lanes=v,es(t,v,f),ln(t,f),t}function $l(t,s,a,f){var v=s.current,x=en(),R=xs(v);return a=jw(a),s.context===null?s.context=a:s.pendingContext=a,s=Or(x,R),s.payload={element:t},f=f===void 0?null:f,f!==null&&(s.callback=f),t=gs(v,s,R),t!==null&&(Xn(t,v,R,x),ml(t,v,R)),R}function Dl(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Iw(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<s?a:s}}function kd(t,s){Iw(t,s),(t=t.alternate)&&Iw(t,s)}function XR(){return null}var Mw=typeof reportError=="function"?reportError:function(t){console.error(t)};function Ed(t){this._internalRoot=t}Fl.prototype.render=Ed.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(r(409));$l(t,s,null,null)},Fl.prototype.unmount=Ed.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;si(function(){$l(null,t,null,null)}),s[Rr]=null}};function Fl(t){this._internalRoot=t}Fl.prototype.unstable_scheduleHydration=function(t){if(t){var s=kr();t={blockedOn:null,target:t,priority:s};for(var a=0;a<Hn.length&&s!==0&&s<Hn[a].priority;a++);Hn.splice(a,0,t),a===0&&Ci(t)}};function Nd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function zl(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Ow(){}function QR(t,s,a,f,v){if(v){if(typeof f=="function"){var x=f;f=function(){var le=Dl(R);x.call(le)}}var R=Aw(s,f,t,0,null,!1,!1,"",Ow);return t._reactRootContainer=R,t[Rr]=R.current,Do(t.nodeType===8?t.parentNode:t),si(),R}for(;v=t.lastChild;)t.removeChild(v);if(typeof f=="function"){var F=f;f=function(){var le=Dl(X);F.call(le)}}var X=Sd(t,0,!1,null,null,!1,!1,"",Ow);return t._reactRootContainer=X,t[Rr]=X.current,Do(t.nodeType===8?t.parentNode:t),si(function(){$l(s,X,a,f)}),X}function Bl(t,s,a,f,v){var x=a._reactRootContainer;if(x){var R=x;if(typeof v=="function"){var F=v;v=function(){var X=Dl(R);F.call(X)}}$l(s,R,t,v)}else R=QR(a,s,t,v,f);return Dl(R)}Xt=function(t){switch(t.tag){case 3:var s=t.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 f=Mr(t,1);if(f!==null){var v=en();Xn(f,t,1,v)}}),kd(t,1)}},Co=function(t){if(t.tag===13){var s=Mr(t,134217728);if(s!==null){var a=en();Xn(s,t,134217728,a)}kd(t,134217728)}},Ni=function(t){if(t.tag===13){var s=xs(t),a=Mr(t,s);if(a!==null){var f=en();Xn(a,t,s,f)}kd(t,s)}},kr=function(){return He},ts=function(t,s){var a=He;try{return He=t,s()}finally{He=a}},Sn=function(t,s,a){switch(s){case"input":if(we(t,a),s=a.name,a.type==="radio"&&s!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<a.length;s++){var f=a[s];if(f!==t&&f.form===t.form){var v=il(f);if(!v)throw Error(r(90));ve(f),we(f,v)}}}break;case"textarea":Je(t,a);break;case"select":s=a.value,s!=null&&ft(t,!!a.multiple,s,!1)}},xi=vd,Wr=si;var ZR={usingClientEntryPoint:!1,Events:[Bo,Li,il,vr,Hr,vd]},na={findFiberByHostInstance:Xs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},JR={bundleType:na.bundleType,version:na.version,rendererPackageName:na.rendererPackageName,rendererConfig:na.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Tt(t),t===null?null:t.stateNode},findFiberByHostInstance:na.findFiberByHostInstance||XR,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 Ul=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ul.isDisabled&&Ul.supportsFiber)try{ir=Ul.inject(JR),St=Ul}catch{}}return un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ZR,un.createPortal=function(t,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Nd(s))throw Error(r(200));return KR(t,s,null,a)},un.createRoot=function(t,s){if(!Nd(t))throw Error(r(299));var a=!1,f="",v=Mw;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=Sd(t,1,!1,null,null,a,!1,f,v),t[Rr]=s.current,Do(t.nodeType===8?t.parentNode:t),new Ed(s)},un.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=Tt(s),t=t===null?null:t.stateNode,t},un.flushSync=function(t){return si(t)},un.hydrate=function(t,s,a){if(!zl(s))throw Error(r(200));return Bl(null,t,s,!0,a)},un.hydrateRoot=function(t,s,a){if(!Nd(t))throw Error(r(405));var f=a!=null&&a.hydratedSources||null,v=!1,x="",R=Mw;if(a!=null&&(a.unstable_strictMode===!0&&(v=!0),a.identifierPrefix!==void 0&&(x=a.identifierPrefix),a.onRecoverableError!==void 0&&(R=a.onRecoverableError)),s=Aw(s,null,t,1,a??null,v,!1,x,R),t[Rr]=s.current,Do(t),f)for(t=0;t<f.length;t++)a=f[t],v=a._getVersion,v=v(a._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[a,v]:s.mutableSourceEagerHydrationData.push(a,v);return new Fl(s)},un.render=function(t,s,a){if(!zl(s))throw Error(r(200));return Bl(null,t,s,!1,a)},un.unmountComponentAtNode=function(t){if(!zl(t))throw Error(r(40));return t._reactRootContainer?(si(function(){Bl(null,null,t,!1,function(){t._reactRootContainer=null,t[Rr]=null})}),!0):!1},un.unstable_batchedUpdates=vd,un.unstable_renderSubtreeIntoContainer=function(t,s,a,f){if(!zl(a))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return Bl(t,s,a,!1,f)},un.version="18.3.1-next-f1338f8080-20240426",un}var Bw;function VE(){if(Bw)return Rd.exports;Bw=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(n){console.error(n)}}return e(),Rd.exports=oj(),Rd.exports}var Uw;function aj(){if(Uw)return Wl;Uw=1;var e=VE();return Wl.createRoot=e.createRoot,Wl.hydrateRoot=e.hydrateRoot,Wl}var lj=aj(),j=Ca();const ue=Dv(j);function Ft(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let r=0,i;r<e.length;r++)(i=Ft(e[r]))!==""&&(n+=(n&&" ")+i);else for(let r in e)e[r]&&(n+=(n&&" ")+r);return n}var Id={exports:{}},Md={},Od={exports:{}},Pd={};/**
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 Hw;function uj(){if(Hw)return Pd;Hw=1;var e=Ca();function n(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var r=typeof Object.is=="function"?Object.is:n,i=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function c(m,y){var w=y(),N=i({inst:{value:w,getSnapshot:y}}),_=N[0].inst,S=N[1];return l(function(){_.value=w,_.getSnapshot=y,h(_)&&S({inst:_})},[m,w,y]),o(function(){return h(_)&&S({inst:_}),m(function(){h(_)&&S({inst:_})})},[m]),u(w),w}function h(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 Pd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Pd}var Ww;function cj(){return Ww||(Ww=1,Od.exports=uj()),Od.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 Vw;function dj(){if(Vw)return Md;Vw=1;var e=Ca(),n=cj();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=n.useSyncExternalStore,l=e.useRef,u=e.useEffect,c=e.useMemo,h=e.useDebugValue;return Md.useSyncExternalStoreWithSelector=function(p,d,m,y,w){var N=l(null);if(N.current===null){var _={hasValue:!1,value:null};N.current=_}else _=N.current;N=c(function(){function b(O){if(!k){if(k=!0,E=O,O=y(O),w!==void 0&&_.hasValue){var A=_.value;if(w(A,O))return T=A}return T=O}if(A=T,i(E,O))return A;var U=y(O);return w!==void 0&&w(A,U)?(E=O,A):(E=O,T=U)}var k=!1,E,T,I=m===void 0?null:m;return[function(){return b(d())},I===null?void 0:function(){return b(I())}]},[d,m,y,w]);var S=o(p,N[0],N[1]);return u(function(){_.hasValue=!0,_.value=S},[S]),h(S),S},Md}var Gw;function fj(){return Gw||(Gw=1,Id.exports=dj()),Id.exports}var hj=fj();const pj=Dv(hj),mj={},Yw=e=>{let n;const r=new Set,i=(d,m)=>{const y=typeof d=="function"?d(n):d;if(!Object.is(y,n)){const w=n;n=m??(typeof y!="object"||y===null)?y:Object.assign({},n,y),r.forEach(N=>N(n,w))}},o=()=>n,h={setState:i,getState:o,getInitialState:()=>p,subscribe:d=>(r.add(d),()=>r.delete(d)),destroy:()=>{(mj?"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=n=e(i,o,h);return h},gj=e=>e?Yw(e):Yw,{useDebugValue:vj}=ue,{useSyncExternalStoreWithSelector:yj}=pj,wj=e=>e;function GE(e,n=wj,r){const i=yj(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,r);return vj(i),i}const Kw=(e,n)=>{const r=gj(e),i=(o,l=n)=>GE(r,o,l);return Object.assign(i,r),i},xj=(e,n)=>e?Kw(e,n):Kw;function Nt(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[i,o]of e)if(!Object.is(o,n.get(i)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const i of e)if(!n.has(i))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(const i of r)if(!Object.prototype.hasOwnProperty.call(n,i)||!Object.is(e[i],n[i]))return!1;return!0}var _j={value:()=>{}};function ju(){for(var e=0,n=arguments.length,r={},i;e<n;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new uu(r)}function uu(e){this._=e}function bj(e,n){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&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}uu.prototype=ju.prototype={constructor:uu,on:function(e,n){var r=this._,i=bj(e+"",r),o,l=-1,u=i.length;if(arguments.length<2){for(;++l<u;)if((o=(e=i[l]).type)&&(o=Sj(r[o],e.name)))return o;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++l<u;)if(o=(e=i[l]).type)r[o]=Xw(r[o],e.name,n);else if(n==null)for(o in r)r[o]=Xw(r[o],e.name,null);return this},copy:function(){var e={},n=this._;for(var r in n)e[r]=n[r].slice();return new uu(e)},call:function(e,n){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(n,r)},apply:function(e,n,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(n,r)}};function Sj(e,n){for(var r=0,i=e.length,o;r<i;++r)if((o=e[r]).name===n)return o.value}function Xw(e,n,r){for(var i=0,o=e.length;i<o;++i)if(e[i].name===n){e[i]=_j,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:n,value:r}),e}var pv="http://www.w3.org/1999/xhtml";const Qw={svg:"http://www.w3.org/2000/svg",xhtml:pv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Au(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Qw.hasOwnProperty(n)?{space:Qw[n],local:e}:e}function kj(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===pv&&n.documentElement.namespaceURI===pv?n.createElement(e):n.createElementNS(r,e)}}function Ej(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function YE(e){var n=Au(e);return(n.local?Ej:kj)(n)}function Nj(){}function Fv(e){return e==null?Nj:function(){return this.querySelector(e)}}function Cj(e){typeof e!="function"&&(e=Fv(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=new Array(u),h,p,d=0;d<u;++d)(h=l[d])&&(p=e.call(h,h.__data__,d,l))&&("__data__"in h&&(p.__data__=h.__data__),c[d]=p);return new _n(i,this._parents)}function Tj(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Rj(){return[]}function KE(e){return e==null?Rj:function(){return this.querySelectorAll(e)}}function jj(e){return function(){return Tj(e.apply(this,arguments))}}function Aj(e){typeof e=="function"?e=jj(e):e=KE(e);for(var n=this._groups,r=n.length,i=[],o=[],l=0;l<r;++l)for(var u=n[l],c=u.length,h,p=0;p<c;++p)(h=u[p])&&(i.push(e.call(h,h.__data__,p,u)),o.push(h));return new _n(i,o)}function XE(e){return function(){return this.matches(e)}}function QE(e){return function(n){return n.matches(e)}}var Ij=Array.prototype.find;function Mj(e){return function(){return Ij.call(this.children,e)}}function Oj(){return this.firstElementChild}function Pj(e){return this.select(e==null?Oj:Mj(typeof e=="function"?e:QE(e)))}var Lj=Array.prototype.filter;function qj(){return Array.from(this.children)}function $j(e){return function(){return Lj.call(this.children,e)}}function Dj(e){return this.selectAll(e==null?qj:$j(typeof e=="function"?e:QE(e)))}function Fj(e){typeof e!="function"&&(e=XE(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=[],h,p=0;p<u;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&c.push(h);return new _n(i,this._parents)}function ZE(e){return new Array(e.length)}function zj(){return new _n(this._enter||this._groups.map(ZE),this._parents)}function mu(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}mu.prototype={constructor:mu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Bj(e){return function(){return e}}function Uj(e,n,r,i,o,l){for(var u=0,c,h=n.length,p=l.length;u<p;++u)(c=n[u])?(c.__data__=l[u],i[u]=c):r[u]=new mu(e,l[u]);for(;u<h;++u)(c=n[u])&&(o[u]=c)}function Hj(e,n,r,i,o,l,u){var c,h,p=new Map,d=n.length,m=l.length,y=new Array(d),w;for(c=0;c<d;++c)(h=n[c])&&(y[c]=w=u.call(h,h.__data__,c,n)+"",p.has(w)?o[c]=h:p.set(w,h));for(c=0;c<m;++c)w=u.call(e,l[c],c,l)+"",(h=p.get(w))?(i[c]=h,h.__data__=l[c],p.delete(w)):r[c]=new mu(e,l[c]);for(c=0;c<d;++c)(h=n[c])&&p.get(y[c])===h&&(o[c]=h)}function Wj(e){return e.__data__}function Vj(e,n){if(!arguments.length)return Array.from(this,Wj);var r=n?Hj:Uj,i=this._parents,o=this._groups;typeof e!="function"&&(e=Bj(e));for(var l=o.length,u=new Array(l),c=new Array(l),h=new Array(l),p=0;p<l;++p){var d=i[p],m=o[p],y=m.length,w=Gj(e.call(d,d&&d.__data__,p,i)),N=w.length,_=c[p]=new Array(N),S=u[p]=new Array(N),b=h[p]=new Array(y);r(d,m,_,S,b,w,n);for(var k=0,E=0,T,I;k<N;++k)if(T=_[k]){for(k>=E&&(E=k+1);!(I=S[E])&&++E<N;);T._next=I||null}}return u=new _n(u,i),u._enter=c,u._exit=h,u}function Gj(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Yj(){return new _n(this._exit||this._groups.map(ZE),this._parents)}function Kj(e,n,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+""),n!=null&&(o=n(o),o&&(o=o.selection())),r==null?l.remove():r(l),i&&o?i.merge(o).order():o}function Xj(e){for(var n=e.selection?e.selection():e,r=this._groups,i=n._groups,o=r.length,l=i.length,u=Math.min(o,l),c=new Array(o),h=0;h<u;++h)for(var p=r[h],d=i[h],m=p.length,y=c[h]=new Array(m),w,N=0;N<m;++N)(w=p[N]||d[N])&&(y[N]=w);for(;h<o;++h)c[h]=r[h];return new _n(c,this._parents)}function Qj(){for(var e=this._groups,n=-1,r=e.length;++n<r;)for(var i=e[n],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 Zj(e){e||(e=Jj);function n(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,h=o[l]=new Array(c),p,d=0;d<c;++d)(p=u[d])&&(h[d]=p);h.sort(n)}return new _n(o,this._parents).order()}function Jj(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function eA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function tA(){return Array.from(this)}function nA(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,l=i.length;o<l;++o){var u=i[o];if(u)return u}return null}function rA(){let e=0;for(const n of this)++e;return e}function sA(){return!this.node()}function iA(e){for(var n=this._groups,r=0,i=n.length;r<i;++r)for(var o=n[r],l=0,u=o.length,c;l<u;++l)(c=o[l])&&e.call(c,c.__data__,l,o);return this}function oA(e){return function(){this.removeAttribute(e)}}function aA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function lA(e,n){return function(){this.setAttribute(e,n)}}function uA(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function cA(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function dA(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function fA(e,n){var r=Au(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((n==null?r.local?aA:oA:typeof n=="function"?r.local?dA:cA:r.local?uA:lA)(r,n))}function JE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function hA(e){return function(){this.style.removeProperty(e)}}function pA(e,n,r){return function(){this.style.setProperty(e,n,r)}}function mA(e,n,r){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function gA(e,n,r){return arguments.length>1?this.each((n==null?hA:typeof n=="function"?mA:pA)(e,n,r??"")):co(this.node(),e)}function co(e,n){return e.style.getPropertyValue(n)||JE(e).getComputedStyle(e,null).getPropertyValue(n)}function vA(e){return function(){delete this[e]}}function yA(e,n){return function(){this[e]=n}}function wA(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function xA(e,n){return arguments.length>1?this.each((n==null?vA:typeof n=="function"?wA:yA)(e,n)):this.node()[e]}function eN(e){return e.trim().split(/^|\s+/)}function zv(e){return e.classList||new tN(e)}function tN(e){this._node=e,this._names=eN(e.getAttribute("class")||"")}tN.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function nN(e,n){for(var r=zv(e),i=-1,o=n.length;++i<o;)r.add(n[i])}function rN(e,n){for(var r=zv(e),i=-1,o=n.length;++i<o;)r.remove(n[i])}function _A(e){return function(){nN(this,e)}}function bA(e){return function(){rN(this,e)}}function SA(e,n){return function(){(n.apply(this,arguments)?nN:rN)(this,e)}}function kA(e,n){var r=eN(e+"");if(arguments.length<2){for(var i=zv(this.node()),o=-1,l=r.length;++o<l;)if(!i.contains(r[o]))return!1;return!0}return this.each((typeof n=="function"?SA:n?_A:bA)(r,n))}function EA(){this.textContent=""}function NA(e){return function(){this.textContent=e}}function CA(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function TA(e){return arguments.length?this.each(e==null?EA:(typeof e=="function"?CA:NA)(e)):this.node().textContent}function RA(){this.innerHTML=""}function jA(e){return function(){this.innerHTML=e}}function AA(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function IA(e){return arguments.length?this.each(e==null?RA:(typeof e=="function"?AA:jA)(e)):this.node().innerHTML}function MA(){this.nextSibling&&this.parentNode.appendChild(this)}function OA(){return this.each(MA)}function PA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function LA(){return this.each(PA)}function qA(e){var n=typeof e=="function"?e:YE(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function $A(){return null}function DA(e,n){var r=typeof e=="function"?e:YE(e),i=n==null?$A:typeof n=="function"?n:Fv(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function FA(){var e=this.parentNode;e&&e.removeChild(this)}function zA(){return this.each(FA)}function BA(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function UA(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function HA(e){return this.select(e?UA:BA)}function WA(e){return arguments.length?this.property("__data__",e):this.node().__data__}function VA(e){return function(n){e.call(this,n,this.__data__)}}function GA(e){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");return i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function YA(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,o=n.length,l;r<o;++r)l=n[r],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):n[++i]=l;++i?n.length=i:delete this.__on}}}function KA(e,n,r){return function(){var i=this.__on,o,l=VA(n);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=n;return}}this.addEventListener(e.type,l,r),o={type:e.type,name:e.name,value:n,listener:l,options:r},i?i.push(o):this.__on=[o]}}function XA(e,n,r){var i=GA(e+""),o,l=i.length,u;if(arguments.length<2){var c=this.node().__on;if(c){for(var h=0,p=c.length,d;h<p;++h)for(o=0,d=c[h];o<l;++o)if((u=i[o]).type===d.type&&u.name===d.name)return d.value}return}for(c=n?KA:YA,o=0;o<l;++o)this.each(c(i[o],n,r));return this}function sN(e,n,r){var i=JE(e),o=i.CustomEvent;typeof o=="function"?o=new o(n,r):(o=i.document.createEvent("Event"),r?(o.initEvent(n,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function QA(e,n){return function(){return sN(this,e,n)}}function ZA(e,n){return function(){return sN(this,e,n.apply(this,arguments))}}function JA(e,n){return this.each((typeof n=="function"?ZA:QA)(e,n))}function*e2(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,l=i.length,u;o<l;++o)(u=i[o])&&(yield u)}var iN=[null];function _n(e,n){this._groups=e,this._parents=n}function Ta(){return new _n([[document.documentElement]],iN)}function t2(){return this}_n.prototype=Ta.prototype={constructor:_n,select:Cj,selectAll:Aj,selectChild:Pj,selectChildren:Dj,filter:Fj,data:Vj,enter:zj,exit:Yj,join:Kj,merge:Xj,selection:t2,order:Qj,sort:Zj,call:eA,nodes:tA,node:nA,size:rA,empty:sA,each:iA,attr:fA,style:gA,property:xA,classed:kA,text:TA,html:IA,raise:OA,lower:LA,append:qA,insert:DA,remove:zA,clone:HA,datum:WA,on:XA,dispatch:JA,[Symbol.iterator]:e2};function Ln(e){return typeof e=="string"?new _n([[document.querySelector(e)]],[document.documentElement]):new _n([[e]],iN)}function n2(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Zn(e,n){if(e=n2(e),n===void 0&&(n=e.currentTarget),n){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}const r2={passive:!1},va={capture:!0,passive:!1};function Ld(e){e.stopImmediatePropagation()}function oo(e){e.preventDefault(),e.stopImmediatePropagation()}function oN(e){var n=e.document.documentElement,r=Ln(e).on("dragstart.drag",oo,va);"onselectstart"in n?r.on("selectstart.drag",oo,va):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function aN(e,n){var r=e.document.documentElement,i=Ln(e).on("dragstart.drag",null);n&&(i.on("click.drag",oo,va),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 Vl=e=>()=>e;function mv(e,{sourceEvent:n,subject:r,target:i,identifier:o,active:l,x:u,y:c,dx:h,dy:p,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,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:h,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:d}})}mv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function s2(e){return!e.ctrlKey&&!e.button}function i2(){return this.parentNode}function o2(e,n){return n??{x:e.x,y:e.y}}function a2(){return navigator.maxTouchPoints||"ontouchstart"in this}function l2(){var e=s2,n=i2,r=o2,i=a2,o={},l=ju("start","drag","end"),u=0,c,h,p,d,m=0;function y(T){T.on("mousedown.drag",w).filter(i).on("touchstart.drag",S).on("touchmove.drag",b,r2).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(T,I){if(!(d||!e.call(this,T,I))){var O=E(this,n.call(this,T,I),T,I,"mouse");O&&(Ln(T.view).on("mousemove.drag",N,va).on("mouseup.drag",_,va),oN(T.view),Ld(T),p=!1,c=T.clientX,h=T.clientY,O("start",T))}}function N(T){if(oo(T),!p){var I=T.clientX-c,O=T.clientY-h;p=I*I+O*O>m}o.mouse("drag",T)}function _(T){Ln(T.view).on("mousemove.drag mouseup.drag",null),aN(T.view,p),oo(T),o.mouse("end",T)}function S(T,I){if(e.call(this,T,I)){var O=T.changedTouches,A=n.call(this,T,I),U=O.length,z,P;for(z=0;z<U;++z)(P=E(this,A,T,I,O[z].identifier,O[z]))&&(Ld(T),P("start",T,O[z]))}}function b(T){var I=T.changedTouches,O=I.length,A,U;for(A=0;A<O;++A)(U=o[I[A].identifier])&&(oo(T),U("drag",T,I[A]))}function k(T){var I=T.changedTouches,O=I.length,A,U;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),A=0;A<O;++A)(U=o[I[A].identifier])&&(Ld(T),U("end",T,I[A]))}function E(T,I,O,A,U,z){var P=l.copy(),D=Zn(z||O,I),V,B,C;if((C=r.call(T,new mv("beforestart",{sourceEvent:O,target:y,identifier:U,active:u,x:D[0],y:D[1],dx:0,dy:0,dispatch:P}),A))!=null)return V=C.x-D[0]||0,B=C.y-D[1]||0,function $(L,re,J){var W=D,Z;switch(L){case"start":o[U]=$,Z=u++;break;case"end":delete o[U],--u;case"drag":D=Zn(J||re,I),Z=u;break}P.call(L,T,new mv(L,{sourceEvent:re,subject:C,target:y,identifier:U,active:Z,x:D[0]+V,y:D[1]+B,dx:D[0]-W[0],dy:D[1]-W[1],dispatch:P}),A)}}return y.filter=function(T){return arguments.length?(e=typeof T=="function"?T:Vl(!!T),y):e},y.container=function(T){return arguments.length?(n=typeof T=="function"?T:Vl(T),y):n},y.subject=function(T){return arguments.length?(r=typeof T=="function"?T:Vl(T),y):r},y.touchable=function(T){return arguments.length?(i=typeof T=="function"?T:Vl(!!T),y):i},y.on=function(){var T=l.on.apply(l,arguments);return T===l?y:T},y.clickDistance=function(T){return arguments.length?(m=(T=+T)*T,y):Math.sqrt(m)},y}function Bv(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function lN(e,n){var r=Object.create(e.prototype);for(var i in n)r[i]=n[i];return r}function Ra(){}var ya=.7,gu=1/ya,ao="\\s*([+-]?\\d+)\\s*",wa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",hr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",u2=/^#([0-9a-f]{3,8})$/,c2=new RegExp(`^rgb\\(${ao},${ao},${ao}\\)$`),d2=new RegExp(`^rgb\\(${hr},${hr},${hr}\\)$`),f2=new RegExp(`^rgba\\(${ao},${ao},${ao},${wa}\\)$`),h2=new RegExp(`^rgba\\(${hr},${hr},${hr},${wa}\\)$`),p2=new RegExp(`^hsl\\(${wa},${hr},${hr}\\)$`),m2=new RegExp(`^hsla\\(${wa},${hr},${hr},${wa}\\)$`),Zw={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};Bv(Ra,xa,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Jw,formatHex:Jw,formatHex8:g2,formatHsl:v2,formatRgb:ex,toString:ex});function Jw(){return this.rgb().formatHex()}function g2(){return this.rgb().formatHex8()}function v2(){return uN(this).formatHsl()}function ex(){return this.rgb().formatRgb()}function xa(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=u2.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?tx(n):r===3?new cn(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?Gl(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?Gl(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=c2.exec(e))?new cn(n[1],n[2],n[3],1):(n=d2.exec(e))?new cn(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=f2.exec(e))?Gl(n[1],n[2],n[3],n[4]):(n=h2.exec(e))?Gl(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=p2.exec(e))?sx(n[1],n[2]/100,n[3]/100,1):(n=m2.exec(e))?sx(n[1],n[2]/100,n[3]/100,n[4]):Zw.hasOwnProperty(e)?tx(Zw[e]):e==="transparent"?new cn(NaN,NaN,NaN,0):null}function tx(e){return new cn(e>>16&255,e>>8&255,e&255,1)}function Gl(e,n,r,i){return i<=0&&(e=n=r=NaN),new cn(e,n,r,i)}function y2(e){return e instanceof Ra||(e=xa(e)),e?(e=e.rgb(),new cn(e.r,e.g,e.b,e.opacity)):new cn}function gv(e,n,r,i){return arguments.length===1?y2(e):new cn(e,n,r,i??1)}function cn(e,n,r,i){this.r=+e,this.g=+n,this.b=+r,this.opacity=+i}Bv(cn,gv,lN(Ra,{brighter(e){return e=e==null?gu:Math.pow(gu,e),new cn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ya:Math.pow(ya,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),vu(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:nx,formatHex:nx,formatHex8:w2,formatRgb:rx,toString:rx}));function nx(){return`#${ci(this.r)}${ci(this.g)}${ci(this.b)}`}function w2(){return`#${ci(this.r)}${ci(this.g)}${ci(this.b)}${ci((isNaN(this.opacity)?1:this.opacity)*255)}`}function rx(){const e=vu(this.opacity);return`${e===1?"rgb(":"rgba("}${fi(this.r)}, ${fi(this.g)}, ${fi(this.b)}${e===1?")":`, ${e})`}`}function vu(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 sx(e,n,r,i){return i<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new Jn(e,n,r,i)}function uN(e){if(e instanceof Jn)return new Jn(e.h,e.s,e.l,e.opacity);if(e instanceof Ra||(e=xa(e)),!e)return new Jn;if(e instanceof Jn)return e;e=e.rgb();var n=e.r/255,r=e.g/255,i=e.b/255,o=Math.min(n,r,i),l=Math.max(n,r,i),u=NaN,c=l-o,h=(l+o)/2;return c?(n===l?u=(r-i)/c+(r<i)*6:r===l?u=(i-n)/c+2:u=(n-r)/c+4,c/=h<.5?l+o:2-l-o,u*=60):c=h>0&&h<1?0:u,new Jn(u,c,h,e.opacity)}function x2(e,n,r,i){return arguments.length===1?uN(e):new Jn(e,n,r,i??1)}function Jn(e,n,r,i){this.h=+e,this.s=+n,this.l=+r,this.opacity=+i}Bv(Jn,x2,lN(Ra,{brighter(e){return e=e==null?gu:Math.pow(gu,e),new Jn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ya:Math.pow(ya,e),new Jn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*n,o=2*r-i;return new cn(qd(e>=240?e-240:e+120,o,i),qd(e,o,i),qd(e<120?e+240:e-120,o,i),this.opacity)},clamp(){return new Jn(ix(this.h),Yl(this.s),Yl(this.l),vu(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=vu(this.opacity);return`${e===1?"hsl(":"hsla("}${ix(this.h)}, ${Yl(this.s)*100}%, ${Yl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ix(e){return e=(e||0)%360,e<0?e+360:e}function Yl(e){return Math.max(0,Math.min(1,e||0))}function qd(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const cN=e=>()=>e;function _2(e,n){return function(r){return e+r*n}}function b2(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(i){return Math.pow(e+i*n,r)}}function S2(e){return(e=+e)==1?dN:function(n,r){return r-n?b2(n,r,e):cN(isNaN(n)?r:n)}}function dN(e,n){var r=n-e;return r?_2(e,r):cN(isNaN(e)?n:e)}const ox=(function e(n){var r=S2(n);function i(o,l){var u=r((o=gv(o)).r,(l=gv(l)).r),c=r(o.g,l.g),h=r(o.b,l.b),p=dN(o.opacity,l.opacity);return function(d){return o.r=u(d),o.g=c(d),o.b=h(d),o.opacity=p(d),o+""}}return i.gamma=e,i})(1);function Es(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}var vv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$d=new RegExp(vv.source,"g");function k2(e){return function(){return e}}function E2(e){return function(n){return e(n)+""}}function N2(e,n){var r=vv.lastIndex=$d.lastIndex=0,i,o,l,u=-1,c=[],h=[];for(e=e+"",n=n+"";(i=vv.exec(e))&&(o=$d.exec(n));)(l=o.index)>r&&(l=n.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,h.push({i:u,x:Es(i,o)})),r=$d.lastIndex;return r<n.length&&(l=n.slice(r),c[u]?c[u]+=l:c[++u]=l),c.length<2?h[0]?E2(h[0].x):k2(n):(n=h.length,function(p){for(var d=0,m;d<n;++d)c[(m=h[d]).i]=m.x(p);return c.join("")})}var ax=180/Math.PI,yv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function fN(e,n,r,i,o,l){var u,c,h;return(u=Math.sqrt(e*e+n*n))&&(e/=u,n/=u),(h=e*r+n*i)&&(r-=e*h,i-=n*h),(c=Math.sqrt(r*r+i*i))&&(r/=c,i/=c,h/=c),e*i<n*r&&(e=-e,n=-n,h=-h,u=-u),{translateX:o,translateY:l,rotate:Math.atan2(n,e)*ax,skewX:Math.atan(h)*ax,scaleX:u,scaleY:c}}var Kl;function C2(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?yv:fN(n.a,n.b,n.c,n.d,n.e,n.f)}function T2(e){return e==null||(Kl||(Kl=document.createElementNS("http://www.w3.org/2000/svg","g")),Kl.setAttribute("transform",e),!(e=Kl.transform.baseVal.consolidate()))?yv:(e=e.matrix,fN(e.a,e.b,e.c,e.d,e.e,e.f))}function hN(e,n,r,i){function o(p){return p.length?p.pop()+" ":""}function l(p,d,m,y,w,N){if(p!==m||d!==y){var _=w.push("translate(",null,n,null,r);N.push({i:_-4,x:Es(p,m)},{i:_-2,x:Es(d,y)})}else(m||y)&&w.push("translate("+m+n+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 h(p,d,m,y,w,N){if(p!==m||d!==y){var _=w.push(o(w)+"scale(",null,",",null,")");N.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),h(p.scaleX,p.scaleY,d.scaleX,d.scaleY,m,y),p=d=null,function(w){for(var N=-1,_=y.length,S;++N<_;)m[(S=y[N]).i]=S.x(w);return m.join("")}}}var R2=hN(C2,"px, ","px)","deg)"),j2=hN(T2,", ",")",")"),A2=1e-12;function lx(e){return((e=Math.exp(e))+1/e)/2}function I2(e){return((e=Math.exp(e))-1/e)/2}function M2(e){return((e=Math.exp(2*e))-1)/(e+1)}const O2=(function e(n,r,i){function o(l,u){var c=l[0],h=l[1],p=l[2],d=u[0],m=u[1],y=u[2],w=d-c,N=m-h,_=w*w+N*N,S,b;if(_<A2)b=Math.log(y/p)/n,S=function(A){return[c+A*w,h+A*N,p*Math.exp(n*A*b)]};else{var k=Math.sqrt(_),E=(y*y-p*p+i*_)/(2*p*r*k),T=(y*y-p*p-i*_)/(2*y*r*k),I=Math.log(Math.sqrt(E*E+1)-E),O=Math.log(Math.sqrt(T*T+1)-T);b=(O-I)/n,S=function(A){var U=A*b,z=lx(I),P=p/(r*k)*(z*M2(n*U+I)-I2(I));return[c+P*w,h+P*N,p*z/lx(n*U+I)]}}return S.duration=b*1e3*n/Math.SQRT2,S}return o.rho=function(l){var u=Math.max(.001,+l),c=u*u,h=c*c;return e(u,c,h)},o})(Math.SQRT2,2,4);var fo=0,da=0,sa=0,pN=1e3,yu,fa,wu=0,pi=0,Iu=0,_a=typeof performance=="object"&&performance.now?performance:Date,mN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Uv(){return pi||(mN(P2),pi=_a.now()+Iu)}function P2(){pi=0}function xu(){this._call=this._time=this._next=null}xu.prototype=gN.prototype={constructor:xu,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Uv():+r)+(n==null?0:+n),!this._next&&fa!==this&&(fa?fa._next=this:yu=this,fa=this),this._call=e,this._time=r,wv()},stop:function(){this._call&&(this._call=null,this._time=1/0,wv())}};function gN(e,n,r){var i=new xu;return i.restart(e,n,r),i}function L2(){Uv(),++fo;for(var e=yu,n;e;)(n=pi-e._time)>=0&&e._call.call(void 0,n),e=e._next;--fo}function ux(){pi=(wu=_a.now())+Iu,fo=da=0;try{L2()}finally{fo=0,$2(),pi=0}}function q2(){var e=_a.now(),n=e-wu;n>pN&&(Iu-=n,wu=e)}function $2(){for(var e,n=yu,r,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:yu=r);fa=e,wv(i)}function wv(e){if(!fo){da&&(da=clearTimeout(da));var n=e-pi;n>24?(e<1/0&&(da=setTimeout(ux,e-_a.now()-Iu)),sa&&(sa=clearInterval(sa))):(sa||(wu=_a.now(),sa=setInterval(q2,pN)),fo=1,mN(ux))}}function cx(e,n,r){var i=new xu;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}var D2=ju("start","end","cancel","interrupt"),F2=[],vN=0,dx=1,xv=2,cu=3,fx=4,_v=5,du=6;function Mu(e,n,r,i,o,l){var u=e.__transition;if(!u)e.__transition={};else if(r in u)return;z2(e,r,{name:n,index:i,group:o,on:D2,tween:F2,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:vN})}function Hv(e,n){var r=nr(e,n);if(r.state>vN)throw new Error("too late; already scheduled");return r}function pr(e,n){var r=nr(e,n);if(r.state>cu)throw new Error("too late; already running");return r}function nr(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function z2(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=gN(l,0,r.time);function l(p){r.state=dx,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!==dx)return h();for(d in i)if(w=i[d],w.name===r.name){if(w.state===cu)return cx(u);w.state===fx?(w.state=du,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete i[d]):+d<n&&(w.state=du,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete i[d])}if(cx(function(){r.state===cu&&(r.state=fx,r.timer.restart(c,r.delay,r.time),c(p))}),r.state=xv,r.on.call("start",e,e.__data__,r.index,r.group),r.state===xv){for(r.state=cu,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(h),r.state=_v,1),m=-1,y=o.length;++m<y;)o[m].call(e,d);r.state===_v&&(r.on.call("end",e,e.__data__,r.index,r.group),h())}function h(){r.state=du,r.timer.stop(),delete i[n];for(var p in i)return;delete e.__transition}}function fu(e,n){var r=e.__transition,i,o,l=!0,u;if(r){n=n==null?null:n+"";for(u in r){if((i=r[u]).name!==n){l=!1;continue}o=i.state>xv&&i.state<_v,i.state=du,i.timer.stop(),i.on.call(o?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[u]}l&&delete e.__transition}}function B2(e){return this.each(function(){fu(this,e)})}function U2(e,n){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===n){i=i.slice(),i.splice(u,1);break}}o.tween=i}}function H2(e,n,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:n,value:r},h=0,p=o.length;h<p;++h)if(o[h].name===n){o[h]=c;break}h===p&&o.push(c)}l.tween=o}}function W2(e,n){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((n==null?U2:H2)(r,e,n))}function Wv(e,n,r){var i=e._id;return e.each(function(){var o=pr(this,i);(o.value||(o.value={}))[n]=r.apply(this,arguments)}),function(o){return nr(o,i).value[n]}}function yN(e,n){var r;return(typeof n=="number"?Es:n instanceof xa?ox:(r=xa(n))?(n=r,ox):N2)(e,n)}function V2(e){return function(){this.removeAttribute(e)}}function G2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Y2(e,n,r){var i,o=r+"",l;return function(){var u=this.getAttribute(e);return u===o?null:u===i?l:l=n(i=u,r)}}function K2(e,n,r){var i,o=r+"",l;return function(){var u=this.getAttributeNS(e.space,e.local);return u===o?null:u===i?l:l=n(i=u,r)}}function X2(e,n,r){var i,o,l;return function(){var u,c=r(this),h;return c==null?void this.removeAttribute(e):(u=this.getAttribute(e),h=c+"",u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c)))}}function Q2(e,n,r){var i,o,l;return function(){var u,c=r(this),h;return c==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),h=c+"",u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c)))}}function Z2(e,n){var r=Au(e),i=r==="transform"?j2:yN;return this.attrTween(e,typeof n=="function"?(r.local?Q2:X2)(r,i,Wv(this,"attr."+e,n)):n==null?(r.local?G2:V2)(r):(r.local?K2:Y2)(r,i,n))}function J2(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function eI(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function tI(e,n){var r,i;function o(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&eI(e,l)),r}return o._value=n,o}function nI(e,n){var r,i;function o(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&J2(e,l)),r}return o._value=n,o}function rI(e,n){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;var i=Au(e);return this.tween(r,(i.local?tI:nI)(i,n))}function sI(e,n){return function(){Hv(this,e).delay=+n.apply(this,arguments)}}function iI(e,n){return n=+n,function(){Hv(this,e).delay=n}}function oI(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?sI:iI)(n,e)):nr(this.node(),n).delay}function aI(e,n){return function(){pr(this,e).duration=+n.apply(this,arguments)}}function lI(e,n){return n=+n,function(){pr(this,e).duration=n}}function uI(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?aI:lI)(n,e)):nr(this.node(),n).duration}function cI(e,n){if(typeof n!="function")throw new Error;return function(){pr(this,e).ease=n}}function dI(e){var n=this._id;return arguments.length?this.each(cI(n,e)):nr(this.node(),n).ease}function fI(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;pr(this,e).ease=r}}function hI(e){if(typeof e!="function")throw new Error;return this.each(fI(this._id,e))}function pI(e){typeof e!="function"&&(e=XE(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=[],h,p=0;p<u;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&c.push(h);return new Fr(i,this._parents,this._name,this._id)}function mI(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,r=e._groups,i=n.length,o=r.length,l=Math.min(i,o),u=new Array(i),c=0;c<l;++c)for(var h=n[c],p=r[c],d=h.length,m=u[c]=new Array(d),y,w=0;w<d;++w)(y=h[w]||p[w])&&(m[w]=y);for(;c<i;++c)u[c]=n[c];return new Fr(u,this._parents,this._name,this._id)}function gI(e){return(e+"").trim().split(/^|\s+/).every(function(n){var r=n.indexOf(".");return r>=0&&(n=n.slice(0,r)),!n||n==="start"})}function vI(e,n,r){var i,o,l=gI(n)?Hv:pr;return function(){var u=l(this,e),c=u.on;c!==i&&(o=(i=c).copy()).on(n,r),u.on=o}}function yI(e,n){var r=this._id;return arguments.length<2?nr(this.node(),r).on.on(e):this.each(vI(r,e,n))}function wI(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function xI(){return this.on("end.remove",wI(this._id))}function _I(e){var n=this._name,r=this._id;typeof e!="function"&&(e=Fv(e));for(var i=this._groups,o=i.length,l=new Array(o),u=0;u<o;++u)for(var c=i[u],h=c.length,p=l[u]=new Array(h),d,m,y=0;y<h;++y)(d=c[y])&&(m=e.call(d,d.__data__,y,c))&&("__data__"in d&&(m.__data__=d.__data__),p[y]=m,Mu(p[y],n,r,y,p,nr(d,r)));return new Fr(l,this._parents,n,r)}function bI(e){var n=this._name,r=this._id;typeof e!="function"&&(e=KE(e));for(var i=this._groups,o=i.length,l=[],u=[],c=0;c<o;++c)for(var h=i[c],p=h.length,d,m=0;m<p;++m)if(d=h[m]){for(var y=e.call(d,d.__data__,m,h),w,N=nr(d,r),_=0,S=y.length;_<S;++_)(w=y[_])&&Mu(w,n,r,_,y,N);l.push(y),u.push(d)}return new Fr(l,u,n,r)}var SI=Ta.prototype.constructor;function kI(){return new SI(this._groups,this._parents)}function EI(e,n){var r,i,o;return function(){var l=co(this,e),u=(this.style.removeProperty(e),co(this,e));return l===u?null:l===r&&u===i?o:o=n(r=l,i=u)}}function wN(e){return function(){this.style.removeProperty(e)}}function NI(e,n,r){var i,o=r+"",l;return function(){var u=co(this,e);return u===o?null:u===i?l:l=n(i=u,r)}}function CI(e,n,r){var i,o,l;return function(){var u=co(this,e),c=r(this),h=c+"";return c==null&&(h=c=(this.style.removeProperty(e),co(this,e))),u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c))}}function TI(e,n){var r,i,o,l="style."+n,u="end."+l,c;return function(){var h=pr(this,e),p=h.on,d=h.value[l]==null?c||(c=wN(n)):void 0;(p!==r||o!==d)&&(i=(r=p).copy()).on(u,o=d),h.on=i}}function RI(e,n,r){var i=(e+="")=="transform"?R2:yN;return n==null?this.styleTween(e,EI(e,i)).on("end.style."+e,wN(e)):typeof n=="function"?this.styleTween(e,CI(e,i,Wv(this,"style."+e,n))).each(TI(this._id,e)):this.styleTween(e,NI(e,i,n),r).on("end.style."+e,null)}function jI(e,n,r){return function(i){this.style.setProperty(e,n.call(this,i),r)}}function AI(e,n,r){var i,o;function l(){var u=n.apply(this,arguments);return u!==o&&(i=(o=u)&&jI(e,u,r)),i}return l._value=n,l}function II(e,n,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,AI(e,n,r??""))}function MI(e){return function(){this.textContent=e}}function OI(e){return function(){var n=e(this);this.textContent=n??""}}function PI(e){return this.tween("text",typeof e=="function"?OI(Wv(this,"text",e)):MI(e==null?"":e+""))}function LI(e){return function(n){this.textContent=e.call(this,n)}}function qI(e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&LI(o)),n}return i._value=e,i}function $I(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,qI(e))}function DI(){for(var e=this._name,n=this._id,r=xN(),i=this._groups,o=i.length,l=0;l<o;++l)for(var u=i[l],c=u.length,h,p=0;p<c;++p)if(h=u[p]){var d=nr(h,n);Mu(h,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 FI(){var e,n,r=this,i=r._id,o=r.size();return new Promise(function(l,u){var c={value:u},h={value:function(){--o===0&&l()}};r.each(function(){var p=pr(this,i),d=p.on;d!==e&&(n=(e=d).copy(),n._.cancel.push(c),n._.interrupt.push(c),n._.end.push(h)),p.on=n}),o===0&&l()})}var zI=0;function Fr(e,n,r,i){this._groups=e,this._parents=n,this._name=r,this._id=i}function xN(){return++zI}var qr=Ta.prototype;Fr.prototype={constructor:Fr,select:_I,selectAll:bI,selectChild:qr.selectChild,selectChildren:qr.selectChildren,filter:pI,merge:mI,selection:kI,transition:DI,call:qr.call,nodes:qr.nodes,node:qr.node,size:qr.size,empty:qr.empty,each:qr.each,on:yI,attr:Z2,attrTween:rI,style:RI,styleTween:II,text:PI,textTween:$I,remove:xI,tween:W2,delay:oI,duration:uI,ease:dI,easeVarying:hI,end:FI,[Symbol.iterator]:qr[Symbol.iterator]};function BI(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var UI={time:null,delay:0,duration:250,ease:BI};function HI(e,n){for(var r;!(r=e.__transition)||!(r=r[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return r}function WI(e){var n,r;e instanceof Fr?(n=e._id,e=e._name):(n=xN(),(r=UI).time=Uv(),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,h,p=0;p<c;++p)(h=u[p])&&Mu(h,e,n,p,u,r||HI(h,n));return new Fr(i,this._parents,e,n)}Ta.prototype.interrupt=B2;Ta.prototype.transition=WI;const Xl=e=>()=>e;function VI(e,{sourceEvent:n,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function $r(e,n,r){this.k=e,this.x=n,this.y=r}$r.prototype={constructor:$r,scale:function(e){return e===1?this:new $r(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new $r(this.k,this.x+this.k*e,this.y+this.k*n)},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 $r(1,0,0);$r.prototype;function Dd(e){e.stopImmediatePropagation()}function ia(e){e.preventDefault(),e.stopImmediatePropagation()}function GI(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function YI(){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 hx(){return this.__zoom||Dr}function KI(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function XI(){return navigator.maxTouchPoints||"ontouchstart"in this}function QI(e,n,r){var i=e.invertX(n[0][0])-r[0][0],o=e.invertX(n[1][0])-r[1][0],l=e.invertY(n[0][1])-r[0][1],u=e.invertY(n[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 _N(){var e=GI,n=YI,r=QI,i=KI,o=XI,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,h=O2,p=ju("start","zoom","end"),d,m,y,w=500,N=150,_=0,S=10;function b(C){C.property("__zoom",hx).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",P).filter(o).on("touchstart.zoom",D).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(C,$,L,re){var J=C.selection?C.selection():C;J.property("__zoom",hx),C!==J?I(C,$,L,re):J.interrupt().each(function(){O(this,arguments).event(re).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},b.scaleBy=function(C,$,L,re){b.scaleTo(C,function(){var J=this.__zoom.k,W=typeof $=="function"?$.apply(this,arguments):$;return J*W},L,re)},b.scaleTo=function(C,$,L,re){b.transform(C,function(){var J=n.apply(this,arguments),W=this.__zoom,Z=L==null?T(J):typeof L=="function"?L.apply(this,arguments):L,M=W.invert(Z),G=typeof $=="function"?$.apply(this,arguments):$;return r(E(k(W,G),Z,M),J,u)},L,re)},b.translateBy=function(C,$,L,re){b.transform(C,function(){return r(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof L=="function"?L.apply(this,arguments):L),n.apply(this,arguments),u)},null,re)},b.translateTo=function(C,$,L,re,J){b.transform(C,function(){var W=n.apply(this,arguments),Z=this.__zoom,M=re==null?T(W):typeof re=="function"?re.apply(this,arguments):re;return r(Dr.translate(M[0],M[1]).scale(Z.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof L=="function"?-L.apply(this,arguments):-L),W,u)},re,J)};function k(C,$){return $=Math.max(l[0],Math.min(l[1],$)),$===C.k?C:new $r($,C.x,C.y)}function E(C,$,L){var re=$[0]-L[0]*C.k,J=$[1]-L[1]*C.k;return re===C.x&&J===C.y?C:new $r(C.k,re,J)}function T(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function I(C,$,L,re){C.on("start.zoom",function(){O(this,arguments).event(re).start()}).on("interrupt.zoom end.zoom",function(){O(this,arguments).event(re).end()}).tween("zoom",function(){var J=this,W=arguments,Z=O(J,W).event(re),M=n.apply(J,W),G=L==null?T(M):typeof L=="function"?L.apply(J,W):L,K=Math.max(M[1][0]-M[0][0],M[1][1]-M[0][1]),q=J.__zoom,Q=typeof $=="function"?$.apply(J,W):$,ne=h(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 $r(te,G[0]-fe[0]*te,G[1]-fe[1]*te)}Z.zoom(null,ae)}})}function O(C,$,L){return!L&&C.__zooming||new A(C,$)}function A(C,$){this.that=C,this.args=$,this.active=0,this.sourceEvent=null,this.extent=n.apply(C,$),this.taps=0}A.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,$){return this.mouse&&C!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var $=Ln(this.that).datum();p.call(C,this.that,new VI(C,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:p}),$)}};function U(C,...$){if(!e.apply(this,arguments))return;var L=O(this,$).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(L.wheel)(L.mouse[0][0]!==W[0]||L.mouse[0][1]!==W[1])&&(L.mouse[1]=re.invert(L.mouse[0]=W)),clearTimeout(L.wheel);else{if(re.k===J)return;L.mouse=[W,re.invert(W)],fu(this),L.start()}ia(C),L.wheel=setTimeout(Z,N),L.zoom("mouse",r(E(k(re,J),L.mouse[0],L.mouse[1]),L.extent,u));function Z(){L.wheel=null,L.end()}}function z(C,...$){if(y||!e.apply(this,arguments))return;var L=C.currentTarget,re=O(this,$,!0).event(C),J=Ln(C.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",K,!0),W=Zn(C,L),Z=C.clientX,M=C.clientY;oN(C.view),Dd(C),re.mouse=[W,this.__zoom.invert(W)],fu(this),re.start();function G(q){if(ia(q),!re.moved){var Q=q.clientX-Z,ne=q.clientY-M;re.moved=Q*Q+ne*ne>_}re.event(q).zoom("mouse",r(E(re.that.__zoom,re.mouse[0]=Zn(q,L),re.mouse[1]),re.extent,u))}function K(q){J.on("mousemove.zoom mouseup.zoom",null),aN(q.view,re.moved),ia(q),re.event(q).end()}}function P(C,...$){if(e.apply(this,arguments)){var L=this.__zoom,re=Zn(C.changedTouches?C.changedTouches[0]:C,this),J=L.invert(re),W=L.k*(C.shiftKey?.5:2),Z=r(E(k(L,W),re,J),n.apply(this,$),u);ia(C),c>0?Ln(this).transition().duration(c).call(I,Z,re,C):Ln(this).call(b.transform,Z,re,C)}}function D(C,...$){if(e.apply(this,arguments)){var L=C.touches,re=L.length,J=O(this,$,C.changedTouches.length===re).event(C),W,Z,M,G;for(Dd(C),Z=0;Z<re;++Z)M=L[Z],G=Zn(M,this),G=[G,this.__zoom.invert(G),M.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)),fu(this),J.start())}}function V(C,...$){if(this.__zooming){var L=O(this,$).event(C),re=C.changedTouches,J=re.length,W,Z,M,G;for(ia(C),W=0;W<J;++W)Z=re[W],M=Zn(Z,this),L.touch0&&L.touch0[2]===Z.identifier?L.touch0[0]=M:L.touch1&&L.touch1[2]===Z.identifier&&(L.touch1[0]=M);if(Z=L.that.__zoom,L.touch1){var K=L.touch0[0],q=L.touch0[1],Q=L.touch1[0],ne=L.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)),M=[(K[0]+Q[0])/2,(K[1]+Q[1])/2],G=[(q[0]+ne[0])/2,(q[1]+ne[1])/2]}else if(L.touch0)M=L.touch0[0],G=L.touch0[1];else return;L.zoom("touch",r(E(Z,M,G),L.extent,u))}}function B(C,...$){if(this.__zooming){var L=O(this,$).event(C),re=C.changedTouches,J=re.length,W,Z;for(Dd(C),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),W=0;W<J;++W)Z=re[W],L.touch0&&L.touch0[2]===Z.identifier?delete L.touch0:L.touch1&&L.touch1[2]===Z.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&(Z=Zn(Z,this),Math.hypot(m[0]-Z[0],m[1]-Z[1])<S)){var M=Ln(this).on("dblclick.zoom");M&&M.apply(this,arguments)}}}return b.wheelDelta=function(C){return arguments.length?(i=typeof C=="function"?C:Xl(+C),b):i},b.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Xl(!!C),b):e},b.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:Xl(!!C),b):o},b.extent=function(C){return arguments.length?(n=typeof C=="function"?C:Xl([[+C[0][0],+C[0][1]],[+C[1][0],+C[1][1]]]),b):n},b.scaleExtent=function(C){return arguments.length?(l[0]=+C[0],l[1]=+C[1],b):[l[0],l[1]]},b.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],b):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},b.constrain=function(C){return arguments.length?(r=C,b):r},b.duration=function(C){return arguments.length?(c=+C,b):c},b.interpolate=function(C){return arguments.length?(h=C,b):h},b.on=function(){var C=p.on.apply(p,arguments);return C===p?b:C},b.clickDistance=function(C){return arguments.length?(_=(C=+C)*C,b):Math.sqrt(_)},b.tapDistance=function(C){return arguments.length?(S=+C,b):S},b}var ZI=VE();const Ou=j.createContext(null),JI=Ou.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,n)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?n.targetHandle:n.sourceHandle}", edge id: ${n.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.`},bN=zr.error001();function Ke(e,n){const r=j.useContext(Ou);if(r===null)throw new Error(bN);return GE(r,e,n)}const Ct=()=>{const e=j.useContext(Ou);if(e===null)throw new Error(bN);return j.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},eM=e=>e.userSelectionActive?"none":"all";function Vv({position:e,children:n,className:r,style:i,...o}){const l=Ke(eM),u=`${e}`.split("-");return ue.createElement("div",{className:Ft(["react-flow__panel",r,...u]),style:{...i,pointerEvents:l},...o},n)}function tM({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.createElement(Vv,{position:n,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 nM=({x:e,y:n,label:r,labelStyle:i={},labelShowBg:o=!0,labelBgStyle:l={},labelBgPadding:u=[2,4],labelBgBorderRadius:c=2,children:h,className:p,...d})=>{const m=j.useRef(null),[y,w]=j.useState({x:0,y:0,width:0,height:0}),N=Ft(["react-flow__edge-textwrapper",p]);return j.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} ${n-y.height/2})`,className:N,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),h)};var rM=j.memo(nM);const Gv=e=>({width:e.offsetWidth,height:e.offsetHeight}),ho=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),Yv=(e={x:0,y:0},n)=>({x:ho(e.x,n[0][0],n[1][0]),y:ho(e.y,n[0][1],n[1][1])}),px=(e,n,r)=>e<n?ho(Math.abs(e-n),1,50)/50:e>r?-ho(Math.abs(e-r),1,50)/50:0,SN=(e,n)=>{const r=px(e.x,35,n.width-35)*20,i=px(e.y,35,n.height-35)*20;return[r,i]},kN=e=>{var n;return((n=e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},EN=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),ba=({x:e,y:n,width:r,height:i})=>({x:e,y:n,x2:e+r,y2:n+i}),NN=({x:e,y:n,x2:r,y2:i})=>({x:e,y:n,width:r-e,height:i-n}),mx=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),sM=(e,n)=>NN(EN(ba(e),ba(n))),bv=(e,n)=>{const r=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(r*i)},iM=e=>qn(e.width)&&qn(e.height)&&qn(e.x)&&qn(e.y),qn=e=>!isNaN(e)&&isFinite(e),gt=Symbol.for("internals"),CN=["Enter"," ","Escape"],oM=(e,n)=>{},aM=e=>"nativeEvent"in e;function Sv(e){var o,l;const n=aM(e)?e.nativeEvent:e,r=((l=(o=n.composedPath)==null?void 0:o.call(n))==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 TN=e=>"clientX"in e,Ts=(e,n)=>{var l,u;const r=TN(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-((n==null?void 0:n.left)??0),y:o-((n==null?void 0:n.top)??0)}},_u=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},ja=({id:e,path:n,labelX:r,labelY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w=20})=>ue.createElement(ue.Fragment,null,ue.createElement("path",{id:e,style:d,d:n,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&ue.createElement("path",{d:n,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),o&&qn(r)&&qn(i)?ue.createElement(rM,{x:r,y:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p}):null);ja.displayName="BaseEdge";function oa(e,n,r){return r===void 0?r:i=>{const o=n().edges.find(l=>l.id===e);o&&r(i,{...o})}}function RN({sourceX:e,sourceY:n,targetX:r,targetY:i}){const o=Math.abs(r-e)/2,l=r<e?r+o:r-o,u=Math.abs(i-n)/2,c=i<n?i+u:i-u;return[l,c,o,u]}function jN({sourceX:e,sourceY:n,targetX:r,targetY:i,sourceControlX:o,sourceControlY:l,targetControlX:u,targetControlY:c}){const h=e*.125+o*.375+u*.375+r*.125,p=n*.125+l*.375+c*.375+i*.125,d=Math.abs(h-e),m=Math.abs(p-n);return[h,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 Sa;(function(e){e.Partial="partial",e.Full="full"})(Sa||(Sa={}));var Cs;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Cs||(Cs={}));var bu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(bu||(bu={}));var Ae;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ae||(Ae={}));function gx({pos:e,x1:n,y1:r,x2:i,y2:o}){return e===Ae.Left||e===Ae.Right?[.5*(n+i),r]:[n,.5*(r+o)]}function AN({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top}){const[u,c]=gx({pos:r,x1:e,y1:n,x2:i,y2:o}),[h,p]=gx({pos:l,x1:i,y1:o,x2:e,y2:n}),[d,m,y,w]=jN({sourceX:e,sourceY:n,targetX:i,targetY:o,sourceControlX:u,sourceControlY:c,targetControlX:h,targetControlY:p});return[`M${e},${n} C${u},${c} ${h},${p} ${i},${o}`,d,m,y,w]}const Kv=j.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,sourcePosition:o=Ae.Bottom,targetPosition:l=Ae.Top,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})=>{const[S,b,k]=AN({sourceX:e,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:l});return ue.createElement(ja,{path:S,labelX:b,labelY:k,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})});Kv.displayName="SimpleBezierEdge";const vx={[Ae.Left]:{x:-1,y:0},[Ae.Right]:{x:1,y:0},[Ae.Top]:{x:0,y:-1},[Ae.Bottom]:{x:0,y:1}},lM=({source:e,sourcePosition:n=Ae.Bottom,target:r})=>n===Ae.Left||n===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},yx=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function uM({source:e,sourcePosition:n=Ae.Bottom,target:r,targetPosition:i=Ae.Top,center:o,offset:l}){const u=vx[n],c=vx[i],h={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=lM({source:h,sourcePosition:n,target:p}),m=d.x!==0?"x":"y",y=d[m];let w=[],N,_;const S={x:0,y:0},b={x:0,y:0},[k,E,T,I]=RN({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(u[m]*c[m]===-1){N=o.x??k,_=o.y??E;const A=[{x:N,y:h.y},{x:N,y:p.y}],U=[{x:h.x,y:_},{x:p.x,y:_}];u[m]===y?w=m==="x"?A:U:w=m==="x"?U:A}else{const A=[{x:h.x,y:p.y}],U=[{x:p.x,y:h.y}];if(m==="x"?w=u.x===y?U:A:w=u.y===y?A:U,n===i){const B=Math.abs(e[m]-r[m]);if(B<=l){const C=Math.min(l-1,l-B);u[m]===y?S[m]=(h[m]>e[m]?-1:1)*C:b[m]=(p[m]>r[m]?-1:1)*C}}if(n!==i){const B=m==="x"?"y":"x",C=u[m]===c[B],$=h[B]>p[B],L=h[B]<p[B];(u[m]===1&&(!C&&$||C&&L)||u[m]!==1&&(!C&&L||C&&$))&&(w=m==="x"?A:U)}const z={x:h.x+S.x,y:h.y+S.y},P={x:p.x+b.x,y:p.y+b.y},D=Math.max(Math.abs(z.x-w[0].x),Math.abs(P.x-w[0].x)),V=Math.max(Math.abs(z.y-w[0].y),Math.abs(P.y-w[0].y));D>=V?(N=(z.x+P.x)/2,_=w[0].y):(N=w[0].x,_=(z.y+P.y)/2)}return[[e,{x:h.x+S.x,y:h.y+S.y},...w,{x:p.x+b.x,y:p.y+b.y},r],N,_,T,I]}function cM(e,n,r,i){const o=Math.min(yx(e,n)/2,yx(n,r)/2,i),{x:l,y:u}=n;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,h=e.y<r.y?-1:1;return`L ${l},${u+o*h}Q ${l},${u} ${l+o*c},${u}`}function kv({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top,borderRadius:u=5,centerX:c,centerY:h,offset:p=20}){const[d,m,y,w,N]=uM({source:{x:e,y:n},sourcePosition:r,target:{x:i,y:o},targetPosition:l,center:{x:c,y:h},offset:p});return[d.reduce((S,b,k)=>{let E="";return k>0&&k<d.length-1?E=cM(d[k-1],b,d[k+1],u):E=`${k===0?"M":"L"}${b.x} ${b.y}`,S+=E,S},""),m,y,w,N]}const Pu=j.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,sourcePosition:m=Ae.Bottom,targetPosition:y=Ae.Top,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[b,k,E]=kv({sourceX:e,sourceY:n,sourcePosition:m,targetX:r,targetY:i,targetPosition:y,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return ue.createElement(ja,{path:b,labelX:k,labelY:E,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:w,markerStart:N,interactionWidth:S})});Pu.displayName="SmoothStepEdge";const Xv=j.memo(e=>{var n;return ue.createElement(Pu,{...e,pathOptions:j.useMemo(()=>{var r;return{borderRadius:0,offset:(r=e.pathOptions)==null?void 0:r.offset}},[(n=e.pathOptions)==null?void 0:n.offset])})});Xv.displayName="StepEdge";function dM({sourceX:e,sourceY:n,targetX:r,targetY:i}){const[o,l,u,c]=RN({sourceX:e,sourceY:n,targetX:r,targetY:i});return[`M ${e},${n}L ${r},${i}`,o,l,u,c]}const Qv=j.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[N,_,S]=dM({sourceX:e,sourceY:n,targetX:r,targetY:i});return ue.createElement(ja,{path:N,labelX:_,labelY:S,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w})});Qv.displayName="StraightEdge";function Ql(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function wx({pos:e,x1:n,y1:r,x2:i,y2:o,c:l}){switch(e){case Ae.Left:return[n-Ql(n-i,l),r];case Ae.Right:return[n+Ql(i-n,l),r];case Ae.Top:return[n,r-Ql(r-o,l)];case Ae.Bottom:return[n,r+Ql(o-r,l)]}}function IN({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top,curvature:u=.25}){const[c,h]=wx({pos:r,x1:e,y1:n,x2:i,y2:o,c:u}),[p,d]=wx({pos:l,x1:i,y1:o,x2:e,y2:n,c:u}),[m,y,w,N]=jN({sourceX:e,sourceY:n,targetX:i,targetY:o,sourceControlX:c,sourceControlY:h,targetControlX:p,targetControlY:d});return[`M${e},${n} C${c},${h} ${p},${d} ${i},${o}`,m,y,w,N]}const Su=j.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,sourcePosition:o=Ae.Bottom,targetPosition:l=Ae.Top,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[b,k,E]=IN({sourceX:e,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:l,curvature:_==null?void 0:_.curvature});return ue.createElement(ja,{path:b,labelX:k,labelY:E,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:S})});Su.displayName="BezierEdge";const Zv=j.createContext(null),fM=Zv.Provider;Zv.Consumer;const hM=()=>j.useContext(Zv),pM=e=>"id"in e&&"source"in e&&"target"in e,mM=({source:e,sourceHandle:n,target:r,targetHandle:i})=>`reactflow__edge-${e}${n||""}-${r}${i||""}`,Ev=(e,n)=>typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`,gM=(e,n)=>n.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)),vM=(e,n)=>{if(!e.source||!e.target)return n;let r;return pM(e)?r={...e}:r={...e,id:mM(e)},gM(r,n)?n:n.concat(r)},Nv=({x:e,y:n},[r,i,o],l,[u,c])=>{const h={x:(e-r)/o,y:(n-i)/o};return l?{x:u*Math.round(h.x/u),y:c*Math.round(h.y/c)}:h},MN=({x:e,y:n},[r,i,o])=>({x:e*o+r,y:n*o+i}),hi=(e,n=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*n[0],i=(e.height??0)*n[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}},Lu=(e,n=[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,n).positionAbsolute;return EN(i,ba({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 NN(r)},ON=(e,n,[r,i,o]=[0,0,1],l=!1,u=!1,c=[0,0])=>{const h={x:(n.x-r)/o,y:(n.y-i)/o,width:n.width/o,height:n.height/o},p=[];return e.forEach(d=>{const{width:m,height:y,selectable:w=!0,hidden:N=!1}=d;if(u&&!w||N)return!1;const{positionAbsolute:_}=hi(d,c),S={x:_.x,y:_.y,width:m||0,height:y||0},b=bv(h,S),k=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&b>0,T=(m||0)*(y||0);(k||E||b>=T||d.dragging)&&p.push(d)}),p},PN=(e,n)=>{const r=e.map(i=>i.id);return n.filter(i=>r.includes(i.source)||r.includes(i.target))},LN=(e,n,r,i,o,l=.1)=>{const u=n/(e.width*(1+l)),c=r/(e.height*(1+l)),h=Math.min(u,c),p=ho(h,i,o),d=e.x+e.width/2,m=e.y+e.height/2,y=n/2-d*p,w=r/2-m*p;return{x:y,y:w,zoom:p}},ui=(e,n=0)=>e.transition().duration(n);function xx(e,n,r,i){return(n[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 yM(e,n,r,i,o,l){const{x:u,y:c}=Ts(e),p=n.elementsFromPoint(u,c).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const _=Jv(void 0,p),S=p.getAttribute("data-handleid"),b=l({nodeId:N,id:S,type:_});if(b){const k=o.find(E=>E.nodeId===N&&E.type===_&&E.id===S);return{handle:{id:S,type:_,nodeId:N,x:(k==null?void 0:k.x)||r.x,y:(k==null?void 0:k.y)||r.y},validHandleResult:b}}}}let d=[],m=1/0;if(o.forEach(N=>{const _=Math.sqrt((N.x-r.x)**2+(N.y-r.y)**2);if(_<=i){const S=l(N);_<=m&&(_<m?d=[{handle:N,validHandleResult:S}]:_===m&&d.push({handle:N,validHandleResult:S}),m=_)}}),!d.length)return{handle:null,validHandleResult:qN()};if(d.length===1)return d[0];const y=d.some(({validHandleResult:N})=>N.isValid),w=d.some(({handle:N})=>N.type==="target");return d.find(({handle:N,validHandleResult:_})=>w?N.type==="target":y?_.isValid:!0)||d[0]}const wM={source:null,target:null,sourceHandle:null,targetHandle:null},qN=()=>({handleDomNode:null,isValid:!1,connection:wM,endHandle:null});function $N(e,n,r,i,o,l,u){const c=o==="target",h=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={...qN(),handleDomNode:h};if(h){const d=Jv(void 0,h),m=h.getAttribute("data-nodeid"),y=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),N=h.classList.contains("connectableend"),_={source:c?m:r,sourceHandle:c?y:i,target:c?r:m,targetHandle:c?i:y};p.connection=_,w&&N&&(n===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 xM({nodes:e,nodeId:n,handleId:r,handleType:i}){return e.reduce((o,l)=>{if(l[gt]){const{handleBounds:u}=l[gt];let c=[],h=[];u&&(c=xx(l,u,"source",`${n}-${r}-${i}`),h=xx(l,u,"target",`${n}-${r}-${i}`)),o.push(...c,...h)}return o},[])}function Jv(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function Fd(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function _M(e,n){let r=null;return n?r="valid":e&&!n&&(r="invalid"),r}function DN({event:e,handleId:n,nodeId:r,onConnect:i,isTarget:o,getState:l,setState:u,isValidConnection:c,edgeUpdaterType:h,onReconnectEnd:p}){const d=kN(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:_,panBy:S,getNodes:b,cancelConnection:k}=l();let E=0,T;const{x:I,y:O}=Ts(e),A=d==null?void 0:d.elementFromPoint(I,O),U=Jv(h,A),z=y==null?void 0:y.getBoundingClientRect();if(!z||!U)return;let P,D=Ts(e,z),V=!1,B=null,C=!1,$=null;const L=xM({nodes:b(),nodeId:r,handleId:n,handleType:U}),re=()=>{if(!w)return;const[Z,M]=SN(D,z);S({x:Z,y:M}),E=requestAnimationFrame(re)};u({connectionPosition:D,connectionStatus:null,connectionNodeId:r,connectionHandleId:n,connectionHandleType:U,connectionStartHandle:{nodeId:r,handleId:n,type:U},connectionEndHandle:null}),_==null||_(e,{nodeId:r,handleId:n,handleType:U});function J(Z){const{transform:M}=l();D=Ts(Z,z);const{handle:G,validHandleResult:K}=yM(Z,d,Nv(D,M,!1,[1,1]),N,L,q=>$N(q,m,r,n,o?"target":"source",c,d));if(T=G,V||(re(),V=!0),$=K.handleDomNode,B=K.connection,C=K.isValid,u({connectionPosition:T&&C?MN({x:T.x,y:T.y},M):D,connectionStatus:_M(!!T,C),connectionEndHandle:K.endHandle}),!T&&!C&&!$)return Fd(P);B.source!==B.target&&$&&(Fd(P),P=$,$.classList.add("connecting","react-flow__handle-connecting"),$.classList.toggle("valid",C),$.classList.toggle("react-flow__handle-valid",C))}function W(Z){var M,G;(T||$)&&B&&C&&(i==null||i(B)),(G=(M=l()).onConnectEnd)==null||G.call(M,Z),h&&(p==null||p(Z)),Fd(P),k(),cancelAnimationFrame(E),V=!1,C=!1,B=null,$=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 _x=()=>!0,bM=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),SM=(e,n,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)===n&&(o==null?void 0:o.type)===r||(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===n&&(l==null?void 0:l.type)===r,clickConnecting:(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.handleId)===n&&(u==null?void 0:u.type)===r}},FN=j.forwardRef(({type:e="source",position:n=Ae.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:o=!0,isConnectableEnd:l=!0,id:u,onConnect:c,children:h,className:p,onMouseDown:d,onTouchStart:m,...y},w)=>{var z,P;const N=u||null,_=e==="target",S=Ct(),b=hM(),{connectOnClick:k,noPanClassName:E}=Ke(bM,Nt),{connecting:T,clickConnecting:I}=Ke(SM(b,N,e),Nt);b||(P=(z=S.getState()).onError)==null||P.call(z,"010",zr.error010());const O=D=>{const{defaultEdgeOptions:V,onConnect:B,hasDefaultEdges:C}=S.getState(),$={...V,...D};if(C){const{edges:L,setEdges:re}=S.getState();re(vM($,L))}B==null||B($),c==null||c($)},A=D=>{if(!b)return;const V=TN(D);o&&(V&&D.button===0||!V)&&DN({event:D,handleId:N,nodeId:b,onConnect:O,isTarget:_,getState:S.getState,setState:S.setState,isValidConnection:r||S.getState().isValidConnection||_x}),V?d==null||d(D):m==null||m(D)},U=D=>{const{onClickConnectStart:V,onClickConnectEnd:B,connectionClickStartHandle:C,connectionMode:$,isValidConnection:L}=S.getState();if(!b||!C&&!o)return;if(!C){V==null||V(D,{nodeId:b,handleId:N,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:N}});return}const re=kN(D.target),J=r||L||_x,{connection:W,isValid:Z}=$N({nodeId:b,id:N,type:e},$,C.nodeId,C.handleId||null,C.type,J,re);Z&&O(W),B==null||B(D),S.setState({connectionClickStartHandle:null})};return ue.createElement("div",{"data-handleid":N,"data-nodeid":b,"data-handlepos":n,"data-id":`${b}-${N}-${e}`,className:Ft(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",E,p,{source:!_,target:_,connectable:i,connectablestart:o,connectableend:l,connecting:I,connectionindicator:i&&(o&&!T||l&&T)}]),onMouseDown:A,onTouchStart:A,onClick:k?U:void 0,ref:w,...y},h)});FN.displayName="Handle";var po=j.memo(FN);const zN=({data:e,isConnectable:n,targetPosition:r=Ae.Top,sourcePosition:i=Ae.Bottom})=>ue.createElement(ue.Fragment,null,ue.createElement(po,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label,ue.createElement(po,{type:"source",position:i,isConnectable:n}));zN.displayName="DefaultNode";var Cv=j.memo(zN);const BN=({data:e,isConnectable:n,sourcePosition:r=Ae.Bottom})=>ue.createElement(ue.Fragment,null,e==null?void 0:e.label,ue.createElement(po,{type:"source",position:r,isConnectable:n}));BN.displayName="InputNode";var UN=j.memo(BN);const HN=({data:e,isConnectable:n,targetPosition:r=Ae.Top})=>ue.createElement(ue.Fragment,null,ue.createElement(po,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label);HN.displayName="OutputNode";var WN=j.memo(HN);const ey=()=>null;ey.displayName="GroupNode";const kM=e=>({selectedNodes:e.getNodes().filter(n=>n.selected),selectedEdges:e.edges.filter(n=>n.selected).map(n=>({...n}))}),Zl=e=>e.id;function EM(e,n){return Nt(e.selectedNodes.map(Zl),n.selectedNodes.map(Zl))&&Nt(e.selectedEdges.map(Zl),n.selectedEdges.map(Zl))}const VN=j.memo(({onSelectionChange:e})=>{const n=Ct(),{selectedNodes:r,selectedEdges:i}=Ke(kM,EM);return j.useEffect(()=>{const o={nodes:r,edges:i};e==null||e(o),n.getState().onSelectionChange.forEach(l=>l(o))},[r,i,e]),null});VN.displayName="SelectionListener";const NM=e=>!!e.onSelectionChange;function CM({onSelectionChange:e}){const n=Ke(NM);return e||n?ue.createElement(VN,{onSelectionChange:e}):null}const TM=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,n){j.useEffect(()=>{typeof e<"u"&&n(e)},[e])}function qe(e,n,r){j.useEffect(()=>{typeof n<"u"&&r({[e]:n})},[n])}const RM=({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,onConnect:o,onConnectStart:l,onConnectEnd:u,onClickConnectStart:c,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:d,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:_,maxZoom:S,nodeExtent:b,onNodesChange:k,onEdgesChange:E,elementsSelectable:T,connectionMode:I,snapGrid:O,snapToGrid:A,translateExtent:U,connectOnClick:z,defaultEdgeOptions:P,fitView:D,fitViewOptions:V,onNodesDelete:B,onEdgesDelete:C,onNodeDrag:$,onNodeDragStart:L,onNodeDragStop:re,onSelectionDrag:J,onSelectionDragStart:W,onSelectionDragStop:Z,noPanClassName:M,nodeOrigin:G,rfId:K,autoPanOnConnect:q,autoPanOnNodeDrag:Q,onError:ne,connectionRadius:ae,isValidConnection:fe,nodeDragThreshold:te})=>{const{setNodes:ce,setEdges:Ce,setDefaultNodesAndEdges:ve,setMinZoom:je,setMaxZoom:ye,setTranslateExtent:Ee,setNodeExtent:Ye,reset:we}=Ke(TM,Nt),_e=Ct();return j.useEffect(()=>{const Be=i==null?void 0:i.map(it=>({...it,...P}));return ve(r,Be),()=>{we()}},[]),qe("defaultEdgeOptions",P,_e.setState),qe("connectionMode",I,_e.setState),qe("onConnect",o,_e.setState),qe("onConnectStart",l,_e.setState),qe("onConnectEnd",u,_e.setState),qe("onClickConnectStart",c,_e.setState),qe("onClickConnectEnd",h,_e.setState),qe("nodesDraggable",p,_e.setState),qe("nodesConnectable",d,_e.setState),qe("nodesFocusable",m,_e.setState),qe("edgesFocusable",y,_e.setState),qe("edgesUpdatable",w,_e.setState),qe("elementsSelectable",T,_e.setState),qe("elevateNodesOnSelect",N,_e.setState),qe("snapToGrid",A,_e.setState),qe("snapGrid",O,_e.setState),qe("onNodesChange",k,_e.setState),qe("onEdgesChange",E,_e.setState),qe("connectOnClick",z,_e.setState),qe("fitViewOnInit",D,_e.setState),qe("fitViewOnInitOptions",V,_e.setState),qe("onNodesDelete",B,_e.setState),qe("onEdgesDelete",C,_e.setState),qe("onNodeDrag",$,_e.setState),qe("onNodeDragStart",L,_e.setState),qe("onNodeDragStop",re,_e.setState),qe("onSelectionDrag",J,_e.setState),qe("onSelectionDragStart",W,_e.setState),qe("onSelectionDragStop",Z,_e.setState),qe("noPanClassName",M,_e.setState),qe("nodeOrigin",G,_e.setState),qe("rfId",K,_e.setState),qe("autoPanOnConnect",q,_e.setState),qe("autoPanOnNodeDrag",Q,_e.setState),qe("onError",ne,_e.setState),qe("connectionRadius",ae,_e.setState),qe("isValidConnection",fe,_e.setState),qe("nodeDragThreshold",te,_e.setState),Qi(e,ce),Qi(n,Ce),Qi(_,je),Qi(S,ye),Qi(U,Ee),Qi(b,Ye),null},bx={display:"none"},jM={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},GN="react-flow__node-desc",YN="react-flow__edge-desc",AM="react-flow__aria-live",IM=e=>e.ariaLiveMessage;function MM({rfId:e}){const n=Ke(IM);return ue.createElement("div",{id:`${AM}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:jM},n)}function OM({rfId:e,disableKeyboardA11y:n}){return ue.createElement(ue.Fragment,null,ue.createElement("div",{id:`${GN}-${e}`,style:bx},"Press enter or space to select a node.",!n&&"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:`${YN}-${e}`,style:bx},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!n&&ue.createElement(MM,{rfId:e}))}var ka=(e=null,n={actInsideInputWithModifier:!0})=>{const[r,i]=j.useState(!1),o=j.useRef(!1),l=j.useRef(new Set([])),[u,c]=j.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 j.useEffect(()=>{const h=typeof document<"u"?document:null,p=(n==null?void 0:n.target)||h;if(e!==null){const d=w=>{if(o.current=w.ctrlKey||w.metaKey||w.shiftKey,(!o.current||o.current&&!n.actInsideInputWithModifier)&&Sv(w))return!1;const _=kx(w.code,c);l.current.add(w[_]),Sx(u,l.current,!1)&&(w.preventDefault(),i(!0))},m=w=>{if((!o.current||o.current&&!n.actInsideInputWithModifier)&&Sv(w))return!1;const _=kx(w.code,c);Sx(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 Sx(e,n,r){return e.filter(i=>r||i.length===n.size).some(i=>i.every(o=>n.has(o)))}function kx(e,n){return n.includes(e)?"code":"key"}function KN(e,n,r,i){var c,h;const o=e.parentNode||e.parentId;if(!o)return r;const l=n.get(o),u=hi(l,i);return KN(l,n,{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)?((h=l[gt])==null?void 0:h.z)??0:r.z??0},i)}function XN(e,n,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:h}=KN(i,e,{...i.position,z:((l=i[gt])==null?void 0:l.z)??0},n);i.positionAbsolute={x:u,y:c},i[gt].z=h,r!=null&&r[i.id]&&(i[gt].isParent=!0)}})}function zd(e,n,r,i){const o=new Map,l={},u=i?1e3:0;return e.forEach(c=>{var w;const h=(qn(c.zIndex)?c.zIndex:0)+(c.selected?u:0),p=n.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:h}}),o.set(c.id,d)}),XN(o,r,l),o}function QN(e,n={}){const{getNodes:r,width:i,height:o,minZoom:l,maxZoom:u,d3Zoom:c,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:d,nodeOrigin:m}=e(),y=n.initial&&!p&&d;if(c&&h&&(y||!n.initial)){const N=r().filter(S=>{var k;const b=n.includeHiddenNodes?S.width&&S.height:!S.hidden;return(k=n.nodes)!=null&&k.length?b&&n.nodes.some(E=>E.id===S.id):b}),_=N.every(S=>S.width&&S.height);if(N.length>0&&_){const S=Lu(N,m),{x:b,y:k,zoom:E}=LN(S,i,o,n.minZoom??l,n.maxZoom??u,n.padding??.1),T=Dr.translate(b,k).scale(E);return typeof n.duration=="number"&&n.duration>0?c.transform(ui(h,n.duration),T):c.transform(h,T),!0}}return!1}function PM(e,n){return e.forEach(r=>{const i=n.get(r.id);i&&n.set(i.id,{...i,[gt]:i[gt],selected:r.selected})}),new Map(n)}function LM(e,n){return n.map(r=>{const i=e.find(o=>o.id===r.id);return i&&(r.selected=i.selected),r})}function Jl({changedNodes:e,changedEdges:n,get:r,set:i}){const{nodeInternals:o,edges:l,onNodesChange:u,onEdgesChange:c,hasDefaultNodes:h,hasDefaultEdges:p}=r();e!=null&&e.length&&(h&&i({nodeInternals:PM(e,o)}),u==null||u(e)),n!=null&&n.length&&(p&&i({edges:LM(n,l)}),c==null||c(n))}const Zi=()=>{},qM={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},$M=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),DM=()=>{const e=Ct(),{d3Zoom:n,d3Selection:r}=Ke($M,Nt);return j.useMemo(()=>r&&n?{zoomIn:o=>n.scaleBy(ui(r,o==null?void 0:o.duration),1.2),zoomOut:o=>n.scaleBy(ui(r,o==null?void 0:o.duration),1/1.2),zoomTo:(o,l)=>n.scaleTo(ui(r,l==null?void 0:l.duration),o),getZoom:()=>e.getState().transform[2],setViewport:(o,l)=>{const[u,c,h]=e.getState().transform,p=Dr.translate(o.x??u,o.y??c).scale(o.zoom??h);n.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=>QN(e.getState,o),setCenter:(o,l,u)=>{const{width:c,height:h,maxZoom:p}=e.getState(),d=typeof(u==null?void 0:u.zoom)<"u"?u.zoom:p,m=c/2-o*d,y=h/2-l*d,w=Dr.translate(m,y).scale(d);n.transform(ui(r,u==null?void 0:u.duration),w)},fitBounds:(o,l)=>{const{width:u,height:c,minZoom:h,maxZoom:p}=e.getState(),{x:d,y:m,zoom:y}=LN(o,u,c,h,p,(l==null?void 0:l.padding)??.1),w=Dr.translate(d,m).scale(y);n.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"),Nv(o,l,u,c)},screenToFlowPosition:o=>{const{transform:l,snapToGrid:u,snapGrid:c,domNode:h}=e.getState();if(!h)return o;const{x:p,y:d}=h.getBoundingClientRect(),m={x:o.x-p,y:o.y-d};return Nv(m,l,u,c)},flowToScreenPosition:o=>{const{transform:l,domNode:u}=e.getState();if(!u)return o;const{x:c,y:h}=u.getBoundingClientRect(),p=MN(o,l);return{x:p.x+c,y:p.y+h}},viewportInitialized:!0}:qM,[n,r])};function Aa(){const e=DM(),n=Ct(),r=j.useCallback(()=>n.getState().getNodes().map(_=>({..._})),[]),i=j.useCallback(_=>n.getState().nodeInternals.get(_),[]),o=j.useCallback(()=>{const{edges:_=[]}=n.getState();return _.map(S=>({...S}))},[]),l=j.useCallback(_=>{const{edges:S=[]}=n.getState();return S.find(b=>b.id===_)},[]),u=j.useCallback(_=>{const{getNodes:S,setNodes:b,hasDefaultNodes:k,onNodesChange:E}=n.getState(),T=S(),I=typeof _=="function"?_(T):_;if(k)b(I);else if(E){const O=I.length===0?T.map(A=>({type:"remove",id:A.id})):I.map(A=>({item:A,type:"reset"}));E(O)}},[]),c=j.useCallback(_=>{const{edges:S=[],setEdges:b,hasDefaultEdges:k,onEdgesChange:E}=n.getState(),T=typeof _=="function"?_(S):_;if(k)b(T);else if(E){const I=T.length===0?S.map(O=>({type:"remove",id:O.id})):T.map(O=>({item:O,type:"reset"}));E(I)}},[]),h=j.useCallback(_=>{const S=Array.isArray(_)?_:[_],{getNodes:b,setNodes:k,hasDefaultNodes:E,onNodesChange:T}=n.getState();if(E){const O=[...b(),...S];k(O)}else if(T){const I=S.map(O=>({item:O,type:"add"}));T(I)}},[]),p=j.useCallback(_=>{const S=Array.isArray(_)?_:[_],{edges:b=[],setEdges:k,hasDefaultEdges:E,onEdgesChange:T}=n.getState();if(E)k([...b,...S]);else if(T){const I=S.map(O=>({item:O,type:"add"}));T(I)}},[]),d=j.useCallback(()=>{const{getNodes:_,edges:S=[],transform:b}=n.getState(),[k,E,T]=b;return{nodes:_().map(I=>({...I})),edges:S.map(I=>({...I})),viewport:{x:k,y:E,zoom:T}}},[]),m=j.useCallback(({nodes:_,edges:S})=>{const{nodeInternals:b,getNodes:k,edges:E,hasDefaultNodes:T,hasDefaultEdges:I,onNodesDelete:O,onEdgesDelete:A,onNodesChange:U,onEdgesChange:z}=n.getState(),P=(_||[]).map($=>$.id),D=(S||[]).map($=>$.id),V=k().reduce(($,L)=>{const re=L.parentNode||L.parentId,J=!P.includes(L.id)&&re&&$.find(Z=>Z.id===re);return(typeof L.deletable=="boolean"?L.deletable:!0)&&(P.includes(L.id)||J)&&$.push(L),$},[]),B=E.filter($=>typeof $.deletable=="boolean"?$.deletable:!0),C=B.filter($=>D.includes($.id));if(V||C){const $=PN(V,B),L=[...C,...$],re=L.reduce((J,W)=>(J.includes(W.id)||J.push(W.id),J),[]);if((I||T)&&(I&&n.setState({edges:E.filter(J=>!re.includes(J.id))}),T&&(V.forEach(J=>{b.delete(J.id)}),n.setState({nodeInternals:new Map(b)}))),re.length>0&&(A==null||A(L),z&&z(re.map(J=>({id:J,type:"remove"})))),V.length>0&&(O==null||O(V),U)){const J=V.map(W=>({id:W.id,type:"remove"}));U(J)}}},[]),y=j.useCallback(_=>{const S=iM(_),b=S?null:n.getState().nodeInternals.get(_.id);return!S&&!b?[null,null,S]:[S?_:mx(b),b,S]},[]),w=j.useCallback((_,S=!0,b)=>{const[k,E,T]=y(_);return k?(b||n.getState().getNodes()).filter(I=>{if(!T&&(I.id===E.id||!I.positionAbsolute))return!1;const O=mx(I),A=bv(O,k);return S&&A>0||A>=k.width*k.height}):[]},[]),N=j.useCallback((_,S,b=!0)=>{const[k]=y(_);if(!k)return!1;const E=bv(k,S);return b&&E>0||E>=k.width*k.height},[]);return j.useMemo(()=>({...e,getNodes:r,getNode:i,getEdges:o,getEdge:l,setNodes:u,setEdges:c,addNodes:h,addEdges:p,toObject:d,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:N}),[e,r,i,o,l,u,c,h,p,d,m,w,N])}const FM={actInsideInputWithModifier:!1};var zM=({deleteKeyCode:e,multiSelectionKeyCode:n})=>{const r=Ct(),{deleteElements:i}=Aa(),o=ka(e,FM),l=ka(n);j.useEffect(()=>{if(o){const{edges:u,getNodes:c}=r.getState(),h=c().filter(d=>d.selected),p=u.filter(d=>d.selected);i({nodes:h,edges:p}),r.setState({nodesSelectionActive:!1})}},[o]),j.useEffect(()=>{r.setState({multiSelectionActive:l})},[l])};function BM(e){const n=Ct();j.useEffect(()=>{let r;const i=()=>{var l,u;if(!e.current)return;const o=Gv(e.current);(o.height===0||o.width===0)&&((u=(l=n.getState()).onError)==null||u.call(l,"004",zr.error004())),n.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 ty={position:"absolute",width:"100%",height:"100%",top:0,left:0},UM=(e,n)=>e.x!==n.x||e.y!==n.y||e.zoom!==n.k,eu=e=>({x:e.x,y:e.y,zoom:e.k}),Ji=(e,n)=>e.target.closest(`.${n}`),Ex=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),Nx=e=>{const n=e.ctrlKey&&_u()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n},HM=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),WM=({onMove:e,onMoveStart:n,onMoveEnd:r,onPaneContextMenu:i,zoomOnScroll:o=!0,zoomOnPinch:l=!0,panOnScroll:u=!1,panOnScrollSpeed:c=.5,panOnScrollMode:h=di.Free,zoomOnDoubleClick:p=!0,elementsSelectable:d,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:_,zoomActivationKeyCode:S,preventScrolling:b=!0,children:k,noWheelClassName:E,noPanClassName:T})=>{const I=j.useRef(),O=Ct(),A=j.useRef(!1),U=j.useRef(!1),z=j.useRef(null),P=j.useRef({x:0,y:0,zoom:0}),{d3Zoom:D,d3Selection:V,d3ZoomHandler:B,userSelectionActive:C}=Ke(HM,Nt),$=ka(S),L=j.useRef(0),re=j.useRef(!1),J=j.useRef();return BM(z),j.useEffect(()=>{if(z.current){const W=z.current.getBoundingClientRect(),Z=_N().scaleExtent([N,_]).translateExtent(w),M=Ln(z.current).call(Z),G=Dr.translate(y.x,y.y).scale(ho(y.zoom,N,_)),K=[[0,0],[W.width,W.height]],q=Z.constrain()(G,K,w);Z.transform(M,q),Z.wheelDelta(Nx),O.setState({d3Zoom:Z,d3Selection:M,d3ZoomHandler:M.on("wheel.zoom"),transform:[q.x,q.y,q.k],domNode:z.current.closest(".react-flow")})}},[]),j.useEffect(()=>{V&&D&&(u&&!$&&!C?V.on("wheel.zoom",W=>{if(Ji(W,E))return!1;W.preventDefault(),W.stopImmediatePropagation();const Z=V.property("__zoom").k||1;if(W.ctrlKey&&l){const fe=Zn(W),te=Nx(W),ce=Z*Math.pow(2,te);D.scaleTo(V,ce,fe,W);return}const M=W.deltaMode===1?20:1;let G=h===di.Vertical?0:W.deltaX*M,K=h===di.Horizontal?0:W.deltaY*M;!_u()&&W.shiftKey&&h!==di.Vertical&&(G=W.deltaY*M,K=0),D.translateBy(V,-(G/Z)*c,-(K/Z)*c,{internal:!0});const q=eu(V.property("__zoom")),{onViewportChangeStart:Q,onViewportChange:ne,onViewportChangeEnd:ae}=O.getState();clearTimeout(J.current),re.current||(re.current=!0,n==null||n(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 B<"u"&&V.on("wheel.zoom",function(W,Z){if(!b&&W.type==="wheel"&&!W.ctrlKey||Ji(W,E))return null;W.preventDefault(),B.call(this,W,Z)},{passive:!1}))},[C,u,h,V,D,B,$,l,b,E,n,e,r]),j.useEffect(()=>{D&&D.on("start",W=>{var G,K;if(!W.sourceEvent||W.sourceEvent.internal)return null;L.current=(G=W.sourceEvent)==null?void 0:G.button;const{onViewportChangeStart:Z}=O.getState(),M=eu(W.transform);A.current=!0,P.current=M,((K=W.sourceEvent)==null?void 0:K.type)==="mousedown"&&O.setState({paneDragging:!0}),Z==null||Z(M),n==null||n(W.sourceEvent,M)})},[D,n]),j.useEffect(()=>{D&&(C&&!A.current?D.on("zoom",null):C||D.on("zoom",W=>{var M;const{onViewportChange:Z}=O.getState();if(O.setState({transform:[W.transform.x,W.transform.y,W.transform.k]}),U.current=!!(i&&Ex(m,L.current??0)),(e||Z)&&!((M=W.sourceEvent)!=null&&M.internal)){const G=eu(W.transform);Z==null||Z(G),e==null||e(W.sourceEvent,G)}}))},[C,D,e,m,i]),j.useEffect(()=>{D&&D.on("end",W=>{if(!W.sourceEvent||W.sourceEvent.internal)return null;const{onViewportChangeEnd:Z}=O.getState();if(A.current=!1,O.setState({paneDragging:!1}),i&&Ex(m,L.current??0)&&!U.current&&i(W.sourceEvent),U.current=!1,(r||Z)&&UM(P.current,W.transform)){const M=eu(W.transform);P.current=M,clearTimeout(I.current),I.current=setTimeout(()=>{Z==null||Z(M),r==null||r(W.sourceEvent,M)},u?150:0)}})},[D,u,m,r,i]),j.useEffect(()=>{D&&D.filter(W=>{const Z=$||o,M=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,E)&&W.type==="wheel"||Ji(W,T)&&(W.type!=="wheel"||u&&W.type==="wheel"&&!$)||!l&&W.ctrlKey&&W.type==="wheel"||!Z&&!u&&!M&&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,D,o,l,u,p,m,d,$]),ue.createElement("div",{className:"react-flow__renderer",ref:z,style:ty},k)},VM=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function GM(){const{userSelectionActive:e,userSelectionRect:n}=Ke(VM,Nt);return e&&n?ue.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}function Cx(e,n){const r=n.parentNode||n.parentId,i=e.find(o=>o.id===r);if(i){const o=n.position.x+n.width-i.width,l=n.position.y+n.height-i.height;if(o>0||l>0||n.position.x<0||n.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),n.position.x<0){const u=Math.abs(n.position.x);i.position.x=i.position.x-u,i.style.width+=u,n.position.x=0}if(n.position.y<0){const u=Math.abs(n.position.y);i.position.y=i.position.y-u,i.style.height+=u,n.position.y=0}i.width=i.style.width,i.height=i.style.height}}}function YM(e,n){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 n.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&&Cx(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&&Cx(i,u);break}case"remove":return i}return i.push(u),i},r)}function KM(e,n){return YM(e,n)}const Ns=(e,n)=>({id:e,type:"select",selected:n});function ro(e,n){return e.reduce((r,i)=>{const o=n.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 Bd=(e,n)=>r=>{r.target===n.current&&(e==null||e(r))},XM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),ZN=j.memo(({isSelecting:e,selectionMode:n=Sa.Full,panOnDrag:r,onSelectionStart:i,onSelectionEnd:o,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:c,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:d,children:m})=>{const y=j.useRef(null),w=Ct(),N=j.useRef(0),_=j.useRef(0),S=j.useRef(),{userSelectionActive:b,elementsSelectable:k,dragging:E}=Ke(XM,Nt),T=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,_.current=0},I=B=>{l==null||l(B),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},O=B=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){B.preventDefault();return}u==null||u(B)},A=c?B=>c(B):void 0,U=B=>{const{resetSelectedElements:C,domNode:$}=w.getState();if(S.current=$==null?void 0:$.getBoundingClientRect(),!k||!e||B.button!==0||B.target!==y.current||!S.current)return;const{x:L,y:re}=Ts(B,S.current);C(),w.setState({userSelectionRect:{width:0,height:0,startX:L,startY:re,x:L,y:re}}),i==null||i(B)},z=B=>{const{userSelectionRect:C,nodeInternals:$,edges:L,transform:re,onNodesChange:J,onEdgesChange:W,nodeOrigin:Z,getNodes:M}=w.getState();if(!e||!S.current||!C)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=Ts(B,S.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=M(),ae=ON($,Q,re,n===Sa.Partial,!0,Z),fe=PN(ae,L).map(ce=>ce.id),te=ae.map(ce=>ce.id);if(N.current!==te.length){N.current=te.length;const ce=ro(ne,te);ce.length&&(J==null||J(ce))}if(_.current!==fe.length){_.current=fe.length;const ce=ro(L,fe);ce.length&&(W==null||W(ce))}w.setState({userSelectionRect:Q})},P=B=>{if(B.button!==0)return;const{userSelectionRect:C}=w.getState();!b&&C&&B.target===y.current&&(I==null||I(B)),w.setState({nodesSelectionActive:N.current>0}),T(),o==null||o(B)},D=B=>{b&&(w.setState({nodesSelectionActive:N.current>0}),o==null||o(B)),T()},V=k&&(e||b);return ue.createElement("div",{className:Ft(["react-flow__pane",{dragging:E,selection:e}]),onClick:V?void 0:Bd(I,y),onContextMenu:Bd(O,y),onWheel:Bd(A,y),onMouseEnter:V?void 0:h,onMouseDown:V?U:void 0,onMouseMove:V?z:p,onMouseUp:V?P:void 0,onMouseLeave:V?D:d,ref:y,style:ty},m,ue.createElement(GM,null))});ZN.displayName="Pane";function JN(e,n){const r=e.parentNode||e.parentId;if(!r)return!1;const i=n.get(r);return i?i.selected?!0:JN(i,n):!1}function Tx(e,n,r){let i=e;do{if(i!=null&&i.matches(n))return!0;if(i===r.current)return!1;i=i.parentElement}while(i);return!1}function QM(e,n,r,i){return Array.from(e.values()).filter(o=>(o.selected||o.id===i)&&(!o.parentNode||o.parentId||!JN(o,e))&&(o.draggable||n&&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 ZM(e,n){return!n||n==="parent"?n:[n[0],[n[1][0]-(e.width||0),n[1][1]-(e.height||0)]]}function eC(e,n,r,i,o=[0,0],l){const u=ZM(e,e.extent||i);let c=u;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const m=r.get(h),{x:y,y:w}=hi(m,o).positionAbsolute;c=m&&qn(y)&&qn(w)&&qn(m.width)&&qn(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&&h&&e.extent!=="parent"){const m=r.get(h),{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(h){const m=r.get(h);p=hi(m,o).positionAbsolute}const d=c&&c!=="parent"?Yv(n,c):n;return{position:{x:d.x-p.x,y:d.y-p.y},positionAbsolute:d}}function Ud({nodeId:e,dragItems:n,nodeInternals:r}){const i=n.map(o=>({...r.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[e?i.find(o=>o.id===e):i[0],i]}const Rx=(e,n,r,i)=>{const o=n.querySelectorAll(e);if(!o||!o.length)return null;const l=Array.from(o),u=n.getBoundingClientRect(),c={x:u.width*i[0],y:u.height*i[1]};return l.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-u.left-c.x)/r,y:(p.top-u.top-c.y)/r,...Gv(h)}})};function aa(e,n,r){return r===void 0?r:i=>{const o=n().nodeInternals.get(e);o&&r(i,{...o})}}function Tv({id:e,store:n,unselect:r=!1,nodeRef:i}){const{addSelectedNodes:o,unselectNodesAndEdges:l,multiSelectionActive:u,nodeInternals:c,onError:h}=n.getState(),p=c.get(e);if(!p){h==null||h("012",zr.error012(e));return}n.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 JM(){const e=Ct();return j.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,h={x:(u-i[0])/i[2],y:(c-i[1])/i[2]};return{xSnapped:l?o[0]*Math.round(h.x/o[0]):h.x,ySnapped:l?o[1]*Math.round(h.y/o[1]):h.y,...h}},[])}function Hd(e){return(n,r,i)=>e==null?void 0:e(n,i)}function tC({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:i,nodeId:o,isSelectable:l,selectNodesOnDrag:u}){const c=Ct(),[h,p]=j.useState(!1),d=j.useRef([]),m=j.useRef({x:null,y:null}),y=j.useRef(0),w=j.useRef(null),N=j.useRef({x:0,y:0}),_=j.useRef(null),S=j.useRef(!1),b=j.useRef(!1),k=j.useRef(!1),E=JM();return j.useEffect(()=>{if(e!=null&&e.current){const T=Ln(e.current),I=({x:U,y:z})=>{const{nodeInternals:P,onNodeDrag:D,onSelectionDrag:V,updateNodePositions:B,nodeExtent:C,snapGrid:$,snapToGrid:L,nodeOrigin:re,onError:J}=c.getState();m.current={x:U,y:z};let W=!1,Z={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&C){const G=Lu(d.current,re);Z=ba(G)}if(d.current=d.current.map(G=>{const K={x:U-G.distance.x,y:z-G.distance.y};L&&(K.x=$[0]*Math.round(K.x/$[0]),K.y=$[1]*Math.round(K.y/$[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=eC(G,K,P,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;B(d.current,!0,!0),p(!0);const M=o?D:Hd(V);if(M&&_.current){const[G,K]=Ud({nodeId:o,dragItems:d.current,nodeInternals:P});M(_.current,G,K)}},O=()=>{if(!w.current)return;const[U,z]=SN(N.current,w.current);if(U!==0||z!==0){const{transform:P,panBy:D}=c.getState();m.current.x=(m.current.x??0)-U/P[2],m.current.y=(m.current.y??0)-z/P[2],D({x:U,y:z})&&I(m.current)}y.current=requestAnimationFrame(O)},A=U=>{var re;const{nodeInternals:z,multiSelectionActive:P,nodesDraggable:D,unselectNodesAndEdges:V,onNodeDragStart:B,onSelectionDragStart:C}=c.getState();b.current=!0;const $=o?B:Hd(C);(!u||!l)&&!P&&o&&((re=z.get(o))!=null&&re.selected||V()),o&&l&&u&&Tv({id:o,store:c,nodeRef:e});const L=E(U);if(m.current=L,d.current=QM(z,D,L,o),$&&d.current){const[J,W]=Ud({nodeId:o,dragItems:d.current,nodeInternals:z});$(U.sourceEvent,J,W)}};if(n)T.on(".drag",null);else{const U=l2().on("start",z=>{const{domNode:P,nodeDragThreshold:D}=c.getState();D===0&&A(z),k.current=!1;const V=E(z);m.current=V,w.current=(P==null?void 0:P.getBoundingClientRect())||null,N.current=Ts(z.sourceEvent,w.current)}).on("drag",z=>{var B,C;const P=E(z),{autoPanOnNodeDrag:D,nodeDragThreshold:V}=c.getState();if(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1&&(k.current=!0),!k.current){if(!S.current&&b.current&&D&&(S.current=!0,O()),!b.current){const $=P.xSnapped-(((B=m==null?void 0:m.current)==null?void 0:B.x)??0),L=P.ySnapped-(((C=m==null?void 0:m.current)==null?void 0:C.y)??0);Math.sqrt($*$+L*L)>V&&A(z)}(m.current.x!==P.xSnapped||m.current.y!==P.ySnapped)&&d.current&&b.current&&(_.current=z.sourceEvent,N.current=Ts(z.sourceEvent,w.current),I(P))}}).on("end",z=>{if(!(!b.current||k.current)&&(p(!1),S.current=!1,b.current=!1,cancelAnimationFrame(y.current),d.current)){const{updateNodePositions:P,nodeInternals:D,onNodeDragStop:V,onSelectionDragStop:B}=c.getState(),C=o?V:Hd(B);if(P(d.current,!1,!1),C){const[$,L]=Ud({nodeId:o,dragItems:d.current,nodeInternals:D});C(z.sourceEvent,$,L)}}}).filter(z=>{const P=z.target;return!z.button&&(!r||!Tx(P,`.${r}`,e))&&(!i||Tx(P,i,e))});return T.call(U),()=>{T.on(".drag",null)}}}},[e,n,r,i,l,c,o,u,E]),h}function nC(){const e=Ct();return j.useCallback(r=>{const{nodeInternals:i,nodeExtent:o,updateNodePositions:l,getNodes:u,snapToGrid:c,snapGrid:h,onError:p,nodesDraggable:d}=e.getState(),m=u().filter(k=>k.selected&&(k.draggable||d&&typeof k.draggable>"u")),y=c?h[0]:5,w=c?h[1]:5,N=r.isShiftPressed?4:1,_=r.x*y*N,S=r.y*w*N,b=m.map(k=>{if(k.positionAbsolute){const E={x:k.positionAbsolute.x+_,y:k.positionAbsolute.y+S};c&&(E.x=h[0]*Math.round(E.x/h[0]),E.y=h[1]*Math.round(E.y/h[1]));const{positionAbsolute:T,position:I}=eC(k,E,i,o,void 0,p);k.position=I,k.positionAbsolute=T}return k});l(b,!0,!1)},[])}const lo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var la=e=>{const n=({id:r,type:i,data:o,xPos:l,yPos:u,xPosOrigin:c,yPosOrigin:h,selected:p,onClick:d,onMouseEnter:m,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:_,style:S,className:b,isDraggable:k,isSelectable:E,isConnectable:T,isFocusable:I,selectNodesOnDrag:O,sourcePosition:A,targetPosition:U,hidden:z,resizeObserver:P,dragHandle:D,zIndex:V,isParent:B,noDragClassName:C,noPanClassName:$,initialized:L,disableKeyboardA11y:re,ariaLabel:J,rfId:W,hasHandleBounds:Z})=>{const M=Ct(),G=j.useRef(null),K=j.useRef(null),q=j.useRef(A),Q=j.useRef(U),ne=j.useRef(i),ae=E||k||d||m||y||w,fe=nC(),te=aa(r,M.getState,m),ce=aa(r,M.getState,y),Ce=aa(r,M.getState,w),ve=aa(r,M.getState,N),je=aa(r,M.getState,_),ye=we=>{const{nodeDragThreshold:_e}=M.getState();if(E&&(!O||!k||_e>0)&&Tv({id:r,store:M,nodeRef:G}),d){const Be=M.getState().nodeInternals.get(r);Be&&d(we,{...Be})}},Ee=we=>{if(!Sv(we)&&!re)if(CN.includes(we.key)&&E){const _e=we.key==="Escape";Tv({id:r,store:M,unselect:_e,nodeRef:G})}else k&&p&&Object.prototype.hasOwnProperty.call(lo,we.key)&&(M.setState({ariaLiveMessage:`Moved selected node ${we.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~u}`}),fe({x:lo[we.key].x,y:lo[we.key].y,isShiftPressed:we.shiftKey}))};j.useEffect(()=>()=>{K.current&&(P==null||P.unobserve(K.current),K.current=null)},[]),j.useEffect(()=>{if(G.current&&!z){const we=G.current;(!L||!Z||K.current!==we)&&(K.current&&(P==null||P.unobserve(K.current)),P==null||P.observe(we),K.current=we)}},[z,L,Z]),j.useEffect(()=>{const we=ne.current!==i,_e=q.current!==A,Be=Q.current!==U;G.current&&(we||_e||Be)&&(we&&(ne.current=i),_e&&(q.current=A),Be&&(Q.current=U),M.getState().updateNodeDimensions([{id:r,nodeElement:G.current,forceUpdate:!0}]))},[r,i,A,U]);const Ye=tC({nodeRef:G,disabled:z||!k,noDragClassName:C,handleSelector:D,nodeId:r,isSelectable:E,selectNodesOnDrag:O});return z?null:ue.createElement("div",{className:Ft(["react-flow__node",`react-flow__node-${i}`,{[$]:k},b,{selected:p,selectable:E,parent:B,dragging:Ye}]),ref:G,style:{zIndex:V,transform:`translate(${c}px,${h}px)`,pointerEvents:ae?"all":"none",visibility:L?"visible":"hidden",...S},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:te,onMouseMove:ce,onMouseLeave:Ce,onContextMenu:ve,onClick:ye,onDoubleClick:je,onKeyDown:I?Ee:void 0,tabIndex:I?0:void 0,role:I?"button":void 0,"aria-describedby":re?void 0:`${GN}-${W}`,"aria-label":J},ue.createElement(fM,{value:r},ue.createElement(e,{id:r,data:o,type:i,xPos:l,yPos:u,selected:p,isConnectable:T,sourcePosition:A,targetPosition:U,dragging:Ye,dragHandle:D,zIndex:V})))};return n.displayName="NodeWrapper",j.memo(n)};const eO=e=>{const n=e.getNodes().filter(r=>r.selected);return{...Lu(n,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function tO({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const i=Ct(),{width:o,height:l,x:u,y:c,transformString:h,userSelectionActive:p}=Ke(eO,Nt),d=nC(),m=j.useRef(null);if(j.useEffect(()=>{var N;r||(N=m.current)==null||N.focus({preventScroll:!0})},[r]),tC({nodeRef:m}),p||!o||!l)return null;const y=e?N=>{const _=i.getState().getNodes().filter(S=>S.selected);e(N,_)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(lo,N.key)&&d({x:lo[N.key].x,y:lo[N.key].y,isShiftPressed:N.shiftKey})};return ue.createElement("div",{className:Ft(["react-flow__nodesselection","react-flow__container",n]),style:{transform:h}},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 nO=j.memo(tO);const rO=e=>e.nodesSelectionActive,rC=({children:e,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,deleteKeyCode:c,onMove:h,onMoveStart:p,onMoveEnd:d,selectionKeyCode:m,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:_,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:k,elementsSelectable:E,zoomOnScroll:T,zoomOnPinch:I,panOnScroll:O,panOnScrollSpeed:A,panOnScrollMode:U,zoomOnDoubleClick:z,panOnDrag:P,defaultViewport:D,translateExtent:V,minZoom:B,maxZoom:C,preventScrolling:$,onSelectionContextMenu:L,noWheelClassName:re,noPanClassName:J,disableKeyboardA11y:W})=>{const Z=Ke(rO),M=ka(m),G=ka(b),K=G||P,q=G||O,Q=M||y&&K!==!0;return zM({deleteKeyCode:c,multiSelectionKeyCode:S}),ue.createElement(WM,{onMove:h,onMoveStart:p,onMoveEnd:d,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:T,zoomOnPinch:I,panOnScroll:q,panOnScrollSpeed:A,panOnScrollMode:U,zoomOnDoubleClick:z,panOnDrag:!M&&K,defaultViewport:D,translateExtent:V,minZoom:B,maxZoom:C,zoomActivationKeyCode:k,preventScrolling:$,noWheelClassName:re,noPanClassName:J},ue.createElement(ZN,{onSelectionStart:N,onSelectionEnd:_,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:K,isSelecting:!!Q,selectionMode:w},e,Z&&ue.createElement(nO,{onSelectionContextMenu:L,noPanClassName:J,disableKeyboardA11y:W})))};rC.displayName="FlowRenderer";var sO=j.memo(rC);function iO(e){return Ke(j.useCallback(r=>e?ON(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function oO(e){const n={input:la(e.input||UN),default:la(e.default||Cv),output:la(e.output||WN),group:la(e.group||ey)},r={},i=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,l)=>(o[l]=la(e[l]||Cv),o),r);return{...n,...i}}const aO=({x:e,y:n,width:r,height:i,origin:o})=>!r||!i?{x:e,y:n}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:n}:{x:e-r*o[0],y:n-i*o[1]},lO=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),sC=e=>{const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:i,elementsSelectable:o,updateNodeDimensions:l,onError:u}=Ke(lO,Nt),c=iO(e.onlyRenderVisibleElements),h=j.useRef(),p=j.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 h.current=d,d},[]);return j.useEffect(()=>()=>{var d;(d=h==null?void 0:h.current)==null||d.disconnect()},[]),ue.createElement("div",{className:"react-flow__nodes",style:ty},c.map(d=>{var I,O,A;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||n&&typeof d.draggable>"u"),N=!!(d.selectable||o&&typeof d.selectable>"u"),_=!!(d.connectable||r&&typeof d.connectable>"u"),S=!!(d.focusable||i&&typeof d.focusable>"u"),b=e.nodeExtent?Yv(d.positionAbsolute,e.nodeExtent):d.positionAbsolute,k=(b==null?void 0:b.x)??0,E=(b==null?void 0:b.y)??0,T=aO({x:k,y:E,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:E,xPosOrigin:T.x,yPosOrigin:T.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:N,isConnectable:_,isFocusable:S,resizeObserver:p,dragHandle:d.dragHandle,zIndex:((I=d[gt])==null?void 0:I.z)??0,isParent:!!((O=d[gt])!=null&&O.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!d.width&&!!d.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:d.ariaLabel,hasHandleBounds:!!((A=d[gt])!=null&&A.handleBounds)})}))};sC.displayName="NodeRenderer";var uO=j.memo(sC);const cO=(e,n,r)=>r===Ae.Left?e-n:r===Ae.Right?e+n:e,dO=(e,n,r)=>r===Ae.Top?e-n:r===Ae.Bottom?e+n:e,jx="react-flow__edgeupdater",Ax=({position:e,centerX:n,centerY:r,radius:i=10,onMouseDown:o,onMouseEnter:l,onMouseOut:u,type:c})=>ue.createElement("circle",{onMouseDown:o,onMouseEnter:l,onMouseOut:u,className:Ft([jx,`${jx}-${c}`]),cx:cO(n,i,e),cy:dO(r,i,e),r:i,stroke:"transparent",fill:"transparent"}),fO=()=>!0;var eo=e=>{const n=({id:r,className:i,type:o,data:l,onClick:u,onEdgeDoubleClick:c,selected:h,animated:p,label:d,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,style:S,source:b,target:k,sourceX:E,sourceY:T,targetX:I,targetY:O,sourcePosition:A,targetPosition:U,elementsSelectable:z,hidden:P,sourceHandleId:D,targetHandleId:V,onContextMenu:B,onMouseEnter:C,onMouseMove:$,onMouseLeave:L,reconnectRadius:re,onReconnect:J,onReconnectStart:W,onReconnectEnd:Z,markerEnd:M,markerStart:G,rfId:K,ariaLabel:q,isFocusable:Q,isReconnectable:ne,pathOptions:ae,interactionWidth:fe,disableKeyboardA11y:te})=>{const ce=j.useRef(null),[Ce,ve]=j.useState(!1),[je,ye]=j.useState(!1),Ee=Ct(),Ye=j.useMemo(()=>`url('#${Ev(G,K)}')`,[G,K]),we=j.useMemo(()=>`url('#${Ev(M,K)}')`,[M,K]);if(P)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&&(z&&(Ee.setState({nodesSelectionActive:!1}),Yt.selected&&hn?(vt({nodes:[],edges:[Yt]}),(Lt=ce.current)==null||Lt.blur()):ht([r])),u&&u(et,Yt))},Be=oa(r,Ee.getState,c),it=oa(r,Ee.getState,B),ft=oa(r,Ee.getState,C),Ze=oa(r,Ee.getState,$),$e=oa(r,Ee.getState,L),Je=(et,bt)=>{if(et.button!==0)return;const{edges:ht,isValidConnection:vt}=Ee.getState(),hn=bt?k:b,Yt=(bt?V:D)||null,Lt=bt?"target":"source",bn=vt||fO,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)};DN({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=!z&&!u,zt=et=>{var bt;if(!te&&CN.includes(et.key)&&z){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:h,animated:p,inactive:Pt,updating:Ce}]),onClick:_e,onDoubleClick:Be,onContextMenu:it,onMouseEnter:ft,onMouseMove:Ze,onMouseLeave:$e,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 ${b} to ${k}`,"aria-describedby":Q?`${YN}-${K}`:void 0,ref:ce},!je&&ue.createElement(e,{id:r,source:b,target:k,selected:h,animated:p,label:d,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,data:l,style:S,sourceX:E,sourceY:T,targetX:I,targetY:O,sourcePosition:A,targetPosition:U,sourceHandleId:D,targetHandleId:V,markerStart:Ye,markerEnd:we,pathOptions:ae,interactionWidth:fe}),ne&&ue.createElement(ue.Fragment,null,(ne==="source"||ne===!0)&&ue.createElement(Ax,{position:A,centerX:E,centerY:T,radius:re,onMouseDown:Xe,onMouseEnter:lt,onMouseOut:Qe,type:"source"}),(ne==="target"||ne===!0)&&ue.createElement(Ax,{position:U,centerX:I,centerY:O,radius:re,onMouseDown:Ot,onMouseEnter:lt,onMouseOut:Qe,type:"target"})))};return n.displayName="EdgeWrapper",j.memo(n)};function hO(e){const n={default:eo(e.default||Su),straight:eo(e.bezier||Qv),step:eo(e.step||Xv),smoothstep:eo(e.step||Pu),simplebezier:eo(e.simplebezier||Kv)},r={},i=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,l)=>(o[l]=eo(e[l]||Su),o),r);return{...n,...i}}function Ix(e,n,r=null){const i=((r==null?void 0:r.x)||0)+n.x,o=((r==null?void 0:r.y)||0)+n.y,l=(r==null?void 0:r.width)||n.width,u=(r==null?void 0:r.height)||n.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 Mx(e,n){return e?e.length===1||!n?e[0]:n&&e.find(r=>r.id===n)||null:null}const pO=(e,n,r,i,o,l)=>{const u=Ix(r,e,n),c=Ix(l,i,o);return{sourceX:u.x,sourceY:u.y,targetX:c.x,targetY:c.y}};function mO({sourcePos:e,targetPos:n,sourceWidth:r,sourceHeight:i,targetWidth:o,targetHeight:l,width:u,height:c,transform:h}){const p={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+r,n.x+o),y2:Math.max(e.y+i,n.y+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const d=ba({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:u/h[2],height:c/h[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 Ox(e){var i,o,l,u,c;const n=((i=e==null?void 0:e[gt])==null?void 0:i.handleBounds)||null,r=n&&(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},n,!!r]}const gO=[{level:0,isMaxLevel:!0,edges:[]}];function vO(e,n,r=!1){let i=-1;const o=e.reduce((u,c)=>{var d,m;const h=qn(c.zIndex);let p=h?c.zIndex:0;if(r){const y=n.get(c.target),w=n.get(c.source),N=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=(h?c.zIndex:0)+(N?_: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 h=+u;return{edges:c,level:h,isMaxLevel:h===i}});return l.length===0?gO:l}function yO(e,n,r){const i=Ke(j.useCallback(o=>e?o.edges.filter(l=>{const u=n.get(l.source),c=n.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)&&mO({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,n]));return vO(i,n,r)}const wO=({color:e="none",strokeWidth:n=1})=>ue.createElement("polyline",{style:{stroke:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),xO=({color:e="none",strokeWidth:n=1})=>ue.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Px={[bu.Arrow]:wO,[bu.ArrowClosed]:xO};function _O(e){const n=Ct();return j.useMemo(()=>{var o,l;return Object.prototype.hasOwnProperty.call(Px,e)?Px[e]:((l=(o=n.getState()).onError)==null||l.call(o,"009",zr.error009(e)),null)},[e])}const bO=({id:e,type:n,color:r,width:i=12.5,height:o=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:c="auto-start-reverse"})=>{const h=_O(n);return h?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(h,{color:r,strokeWidth:u})):null},SO=({defaultColor:e,rfId:n})=>r=>{const i=[];return r.edges.reduce((o,l)=>([l.markerStart,l.markerEnd].forEach(u=>{if(u&&typeof u=="object"){const c=Ev(u,n);i.includes(c)||(o.push({id:c,color:u.color||e,...u}),i.push(c))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))},iC=({defaultColor:e,rfId:n})=>{const r=Ke(j.useCallback(SO({defaultColor:e,rfId:n}),[e,n]),(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(bO,{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})))};iC.displayName="MarkerDefinitions";var kO=j.memo(iC);const EO=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}),oC=({defaultMarkerColor:e,onlyRenderVisibleElements:n,elevateEdgesOnSelect:r,rfId:i,edgeTypes:o,noPanClassName:l,onEdgeContextMenu:u,onEdgeMouseEnter:c,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:d,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,children:S,disableKeyboardA11y:b})=>{const{edgesFocusable:k,edgesUpdatable:E,elementsSelectable:T,width:I,height:O,connectionMode:A,nodeInternals:U,onError:z}=Ke(EO,Nt),P=yO(n,U,r);return I?ue.createElement(ue.Fragment,null,P.map(({level:D,edges:V,isMaxLevel:B})=>ue.createElement("svg",{key:D,style:{zIndex:D},width:I,height:O,className:"react-flow__edges react-flow__container"},B&&ue.createElement(kO,{defaultColor:e,rfId:i}),ue.createElement("g",null,V.map(C=>{const[$,L,re]=Ox(U.get(C.source)),[J,W,Z]=Ox(U.get(C.target));if(!re||!Z)return null;let M=C.type||"default";o[M]||(z==null||z("011",zr.error011(M)),M="default");const G=o[M]||o.default,K=A===mi.Strict?W.target:(W.target??[]).concat(W.source??[]),q=Mx(L.source,C.sourceHandle),Q=Mx(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||E&&typeof te>"u");if(!q||!Q)return z==null||z("008",zr.error008(q,C)),null;const{sourceX:Ce,sourceY:ve,targetX:je,targetY:ye}=pO($,q,ne,J,Q,ae);return ue.createElement(G,{key:C.id,id:C.id,className:Ft([C.className,l]),type:M,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:je,targetY:ye,sourcePosition:ne,targetPosition:ae,elementsSelectable:T,onContextMenu:u,onMouseEnter:c,onMouseMove:h,onMouseLeave:p,onClick:d,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,rfId:i,ariaLabel:C.ariaLabel,isFocusable:fe,isReconnectable:ce,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth,disableKeyboardA11y:b})})))),S):null};oC.displayName="EdgeRenderer";var NO=j.memo(oC);const CO=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function TO({children:e}){const n=Ke(CO);return ue.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:n}},e)}function RO(e){const n=Aa(),r=j.useRef(!1);j.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const jO={[Ae.Left]:Ae.Right,[Ae.Right]:Ae.Left,[Ae.Top]:Ae.Bottom,[Ae.Bottom]:Ae.Top},aC=({nodeId:e,handleType:n,style:r,type:i=Cs.Bezier,CustomComponent:o,connectionStatus:l})=>{var O,A,U;const{fromNode:u,handleId:c,toX:h,toY:p,connectionMode:d}=Ke(j.useCallback(z=>({fromNode:z.nodeInternals.get(e),handleId:z.connectionHandleId,toX:(z.connectionPosition.x-z.transform[0])/z.transform[2],toY:(z.connectionPosition.y-z.transform[1])/z.transform[2],connectionMode:z.connectionMode}),[e]),Nt),m=(O=u==null?void 0:u[gt])==null?void 0:O.handleBounds;let y=m==null?void 0:m[n];if(d===mi.Loose&&(y=y||(m==null?void 0:m[n==="source"?"target":"source"])),!u||!y)return null;const w=c?y.find(z=>z.id===c):y[0],N=w?w.x+w.width/2:(u.width??0)/2,_=w?w.y+w.height/2:u.height??0,S=(((A=u.positionAbsolute)==null?void 0:A.x)??0)+N,b=(((U=u.positionAbsolute)==null?void 0:U.y)??0)+_,k=w==null?void 0:w.position,E=k?jO[k]:null;if(!k||!E)return null;if(o)return ue.createElement(o,{connectionLineType:i,connectionLineStyle:r,fromNode:u,fromHandle:w,fromX:S,fromY:b,toX:h,toY:p,fromPosition:k,toPosition:E,connectionStatus:l});let T="";const I={sourceX:S,sourceY:b,sourcePosition:k,targetX:h,targetY:p,targetPosition:E};return i===Cs.Bezier?[T]=IN(I):i===Cs.Step?[T]=kv({...I,borderRadius:0}):i===Cs.SmoothStep?[T]=kv(I):i===Cs.SimpleBezier?[T]=AN(I):T=`M${S},${b} ${h},${p}`,ue.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:r})};aC.displayName="ConnectionLine";const AO=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function IO({containerStyle:e,style:n,type:r,component:i}){const{nodeId:o,handleType:l,nodesConnectable:u,width:c,height:h,connectionStatus:p}=Ke(AO,Nt);return!(o&&l&&c&&u)?null:ue.createElement("svg",{style:e,width:c,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},ue.createElement("g",{className:Ft(["react-flow__connection",p])},ue.createElement(aC,{nodeId:o,handleType:l,style:n,type:r,CustomComponent:i,connectionStatus:p})))}function Lx(e,n){return j.useRef(null),Ct(),j.useMemo(()=>n(e),[e])}const lC=({nodeTypes:e,edgeTypes:n,onMove:r,onMoveStart:i,onMoveEnd:o,onInit:l,onNodeClick:u,onEdgeClick:c,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:d,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:_,onSelectionEnd:S,connectionLineType:b,connectionLineStyle:k,connectionLineComponent:E,connectionLineContainerStyle:T,selectionKeyCode:I,selectionOnDrag:O,selectionMode:A,multiSelectionKeyCode:U,panActivationKeyCode:z,zoomActivationKeyCode:P,deleteKeyCode:D,onlyRenderVisibleElements:V,elementsSelectable:B,selectNodesOnDrag:C,defaultViewport:$,translateExtent:L,minZoom:re,maxZoom:J,preventScrolling:W,defaultMarkerColor:Z,zoomOnScroll:M,zoomOnPinch:G,panOnScroll:K,panOnScrollSpeed:q,panOnScrollMode:Q,zoomOnDoubleClick:ne,panOnDrag:ae,onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneScroll:ve,onPaneContextMenu:je,onEdgeContextMenu:ye,onEdgeMouseEnter:Ee,onEdgeMouseMove:Ye,onEdgeMouseLeave:we,onReconnect:_e,onReconnectStart:Be,onReconnectEnd:it,reconnectRadius:ft,noDragClassName:Ze,noWheelClassName:$e,noPanClassName:Je,elevateEdgesOnSelect:Xe,disableKeyboardA11y:Ot,nodeOrigin:lt,nodeExtent:Qe,rfId:Pt})=>{const zt=Lx(e,oO),et=Lx(n,hO);return RO(l),ue.createElement(sO,{onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneContextMenu:je,onPaneScroll:ve,deleteKeyCode:D,selectionKeyCode:I,selectionOnDrag:O,selectionMode:A,onSelectionStart:_,onSelectionEnd:S,multiSelectionKeyCode:U,panActivationKeyCode:z,zoomActivationKeyCode:P,elementsSelectable:B,onMove:r,onMoveStart:i,onMoveEnd:o,zoomOnScroll:M,zoomOnPinch:G,zoomOnDoubleClick:ne,panOnScroll:K,panOnScrollSpeed:q,panOnScrollMode:Q,panOnDrag:ae,defaultViewport:$,translateExtent:L,minZoom:re,maxZoom:J,onSelectionContextMenu:N,preventScrolling:W,noDragClassName:Ze,noWheelClassName:$e,noPanClassName:Je,disableKeyboardA11y:Ot},ue.createElement(TO,null,ue.createElement(NO,{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(IO,{style:k,type:b,component:E,containerStyle:T})),ue.createElement("div",{className:"react-flow__edgelabel-renderer"}),ue.createElement(uO,{nodeTypes:zt,onNodeClick:u,onNodeDoubleClick:h,onNodeMouseEnter:d,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:C,onlyRenderVisibleElements:V,noPanClassName:Je,noDragClassName:Ze,disableKeyboardA11y:Ot,nodeOrigin:lt,nodeExtent:Qe,rfId:Pt})))};lC.displayName="GraphView";var MO=j.memo(lC);const Rv=[[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:Rv,nodeExtent:Rv,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:oM,isValidConnection:void 0},OO=()=>xj((e,n)=>({...ks,setNodes:r=>{const{nodeInternals:i,nodeOrigin:o,elevateNodesOnSelect:l}=n();e({nodeInternals:zd(r,i,o,l)})},getNodes:()=>Array.from(n().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:i={}}=n();e({edges:r.map(o=>({...i,...o}))})},setDefaultNodesAndEdges:(r,i)=>{const o=typeof r<"u",l=typeof i<"u",u=o?zd(r,new Map,n().nodeOrigin,n().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:h,nodeOrigin:p}=n(),d=h==null?void 0:h.querySelector(".react-flow__viewport");if(!d)return;const m=window.getComputedStyle(d),{m22:y}=new window.DOMMatrixReadOnly(m.transform),w=r.reduce((_,S)=>{const b=o.get(S.id);if(b!=null&&b.hidden)o.set(b.id,{...b,[gt]:{...b[gt],handleBounds:void 0}});else if(b){const k=Gv(S.nodeElement);!!(k.width&&k.height&&(b.width!==k.width||b.height!==k.height||S.forceUpdate))&&(o.set(b.id,{...b,[gt]:{...b[gt],handleBounds:{source:Rx(".source",S.nodeElement,y,p),target:Rx(".target",S.nodeElement,y,p)}},...k}),_.push({id:b.id,type:"dimensions",dimensions:k}))}return _},[]);XN(o,p);const N=u||l&&!u&&QN(n,{initial:!0,...c});e({nodeInternals:new Map(o),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(i==null||i(w))},updateNodePositions:(r,i=!0,o=!1)=>{const{triggerNodeChanges:l}=n(),u=r.map(c=>{const h={id:c.id,type:"position",dragging:o};return i&&(h.positionAbsolute=c.positionAbsolute,h.position=c.position),h});l(u)},triggerNodeChanges:r=>{const{onNodesChange:i,nodeInternals:o,hasDefaultNodes:l,nodeOrigin:u,getNodes:c,elevateNodesOnSelect:h}=n();if(r!=null&&r.length){if(l){const p=KM(r,c()),d=zd(p,o,u,h);e({nodeInternals:d})}i==null||i(r)}},addSelectedNodes:r=>{const{multiSelectionActive:i,edges:o,getNodes:l}=n();let u,c=null;i?u=r.map(h=>Ns(h,!0)):(u=ro(l(),r),c=ro(o,[])),Jl({changedNodes:u,changedEdges:c,get:n,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:i,edges:o,getNodes:l}=n();let u,c=null;i?u=r.map(h=>Ns(h,!0)):(u=ro(o,r),c=ro(l(),[])),Jl({changedNodes:c,changedEdges:u,get:n,set:e})},unselectNodesAndEdges:({nodes:r,edges:i}={})=>{const{edges:o,getNodes:l}=n(),u=r||l(),c=i||o,h=u.map(d=>(d.selected=!1,Ns(d.id,!1))),p=c.map(d=>Ns(d.id,!1));Jl({changedNodes:h,changedEdges:p,get:n,set:e})},setMinZoom:r=>{const{d3Zoom:i,maxZoom:o}=n();i==null||i.scaleExtent([r,o]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:i,minZoom:o}=n();i==null||i.scaleExtent([o,r]),e({maxZoom:r})},setTranslateExtent:r=>{var i;(i=n().d3Zoom)==null||i.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:i}=n(),l=i().filter(c=>c.selected).map(c=>Ns(c.id,!1)),u=r.filter(c=>c.selected).map(c=>Ns(c.id,!1));Jl({changedNodes:l,changedEdges:u,get:n,set:e})},setNodeExtent:r=>{const{nodeInternals:i}=n();i.forEach(o=>{o.positionAbsolute=Yv(o.position,r)}),e({nodeExtent:r,nodeInternals:new Map(i)})},panBy:r=>{const{transform:i,width:o,height:l,d3Zoom:u,d3Selection:c,translateExtent:h}=n();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,h);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),ny=({children:e})=>{const n=j.useRef(null);return n.current||(n.current=OO()),ue.createElement(JI,{value:n.current},e)};ny.displayName="ReactFlowProvider";const uC=({children:e})=>j.useContext(Ou)?ue.createElement(ue.Fragment,null,e):ue.createElement(ny,null,e);uC.displayName="ReactFlowWrapper";const PO={input:UN,default:Cv,output:WN,group:ey},LO={default:Su,straight:Qv,step:Xv,smoothstep:Pu,simplebezier:Kv},qO=[0,0],$O=[15,15],DO={x:0,y:0,zoom:1},FO={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},cC=j.forwardRef(({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,className:o,nodeTypes:l=PO,edgeTypes:u=LO,onNodeClick:c,onEdgeClick:h,onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:b,onNodeMouseEnter:k,onNodeMouseMove:E,onNodeMouseLeave:T,onNodeContextMenu:I,onNodeDoubleClick:O,onNodeDragStart:A,onNodeDrag:U,onNodeDragStop:z,onNodesDelete:P,onEdgesDelete:D,onSelectionChange:V,onSelectionDragStart:B,onSelectionDrag:C,onSelectionDragStop:$,onSelectionContextMenu:L,onSelectionStart:re,onSelectionEnd:J,connectionMode:W=mi.Strict,connectionLineType:Z=Cs.Bezier,connectionLineStyle:M,connectionLineComponent:G,connectionLineContainerStyle:K,deleteKeyCode:q="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:ne=!1,selectionMode:ae=Sa.Full,panActivationKeyCode:fe="Space",multiSelectionKeyCode:te=_u()?"Meta":"Control",zoomActivationKeyCode:ce=_u()?"Meta":"Control",snapToGrid:Ce=!1,snapGrid:ve=$O,onlyRenderVisibleElements:je=!1,selectNodesOnDrag:ye=!0,nodesDraggable:Ee,nodesConnectable:Ye,nodesFocusable:we,nodeOrigin:_e=qO,edgesFocusable:Be,edgesUpdatable:it,elementsSelectable:ft,defaultViewport:Ze=DO,minZoom:$e=.5,maxZoom:Je=2,translateExtent:Xe=Rv,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:qs,...ir},St)=>{const $s=Zr||"1";return ue.createElement("div",{...ir,style:{...Qr,...FO},ref:St,className:Ft(["react-flow",o]),"data-testid":"rf__wrapper",id:Zr},ue.createElement(uC,null,ue.createElement(MO,{onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onNodeClick:c,onEdgeClick:h,onNodeMouseEnter:k,onNodeMouseMove:E,onNodeMouseLeave:T,onNodeContextMenu:I,onNodeDoubleClick:O,nodeTypes:l,edgeTypes:u,connectionLineType:Z,connectionLineStyle:M,connectionLineComponent:G,connectionLineContainerStyle:K,selectionKeyCode:Q,selectionOnDrag:ne,selectionMode:ae,deleteKeyCode:q,multiSelectionKeyCode:te,panActivationKeyCode:fe,zoomActivationKeyCode:ce,onlyRenderVisibleElements:je,selectNodesOnDrag:ye,defaultViewport:Ze,translateExtent:Xe,minZoom:$e,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:L,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:$s,disableKeyboardA11y:Kr,nodeOrigin:_e,nodeExtent:lt}),ue.createElement(RM,{nodes:e,edges:n,defaultNodes:r,defaultEdges:i,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:b,nodesDraggable:Ee,nodesConnectable:Ye,nodesFocusable:we,edgesFocusable:Be,edgesUpdatable:it,elementsSelectable:ft,elevateNodesOnSelect:_r,minZoom:$e,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:P,onEdgesDelete:D,onNodeDragStart:A,onNodeDrag:U,onNodeDragStop:z,onSelectionDrag:C,onSelectionDragStart:B,onSelectionDragStop:$,noPanClassName:Ms,nodeOrigin:_e,rfId:$s,autoPanOnConnect:Si,autoPanOnNodeDrag:nt,onError:Ls,connectionRadius:br,isValidConnection:Xr,nodeDragThreshold:qs}),ue.createElement(CM,{onSelectionChange:V}),Fn,ue.createElement(tM,{proOptions:Tt,position:Ps}),ue.createElement(OM,{rfId:$s,disableKeyboardA11y:Kr})))});cC.displayName="ReactFlow";const zO=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function dC(){return Ke(zO,Nt)}const fC=({id:e,x:n,y:r,width:i,height:o,style:l,color:u,strokeColor:c,strokeWidth:h,className:p,borderRadius:d,shapeRendering:m,onClick:y,selected:w})=>{const{background:N,backgroundColor:_}=l||{},S=u||N||_;return ue.createElement("rect",{className:Ft(["react-flow__minimap-node",{selected:w},p]),x:n,y:r,rx:d,ry:d,width:i,height:o,fill:S,stroke:c,strokeWidth:h,shapeRendering:m,onClick:y?b=>y(b,e):void 0})};fC.displayName="MiniMapNode";var BO=j.memo(fC);const UO=e=>e.nodeOrigin,HO=e=>e.getNodes().filter(n=>!n.hidden&&n.width&&n.height),Wd=e=>e instanceof Function?e:()=>e;function WO({nodeStrokeColor:e="transparent",nodeColor:n="#e2e2e2",nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:o=2,nodeComponent:l=BO,onClick:u}){const c=Ke(HO,Nt),h=Ke(UO),p=Wd(n),d=Wd(e),m=Wd(r),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ue.createElement(ue.Fragment,null,c.map(w=>{const{x:N,y:_}=hi(w,h).positionAbsolute;return ue.createElement(l,{key:w.id,x:N,y:_,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:p(w),borderRadius:i,strokeColor:d(w),strokeWidth:o,shapeRendering:y,onClick:u,id:w.id})}))}var VO=j.memo(WO);const GO=200,YO=150,KO=e=>{const n=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:n.length>0?sM(Lu(n,e.nodeOrigin),r):r,rfId:e.rfId}},XO="react-flow__minimap-desc";function hC({style:e,className:n,nodeStrokeColor:r="transparent",nodeColor:i="#e2e2e2",nodeClassName:o="",nodeBorderRadius:l=5,nodeStrokeWidth:u=2,nodeComponent:c,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:d=1,position:m="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:_=!1,ariaLabel:S="React Flow mini map",inversePan:b=!1,zoomStep:k=10,offsetScale:E=5}){const T=Ct(),I=j.useRef(null),{boundingRect:O,viewBB:A,rfId:U}=Ke(KO,Nt),z=(e==null?void 0:e.width)??GO,P=(e==null?void 0:e.height)??YO,D=O.width/z,V=O.height/P,B=Math.max(D,V),C=B*z,$=B*P,L=E*B,re=O.x-(C-O.width)/2-L,J=O.y-($-O.height)/2-L,W=C+L*2,Z=$+L*2,M=`${XO}-${U}`,G=j.useRef(0);G.current=B,j.useEffect(()=>{if(I.current){const Q=Ln(I.current),ne=te=>{const{transform:ce,d3Selection:Ce,d3Zoom:ve}=T.getState();if(te.sourceEvent.type!=="wheel"||!Ce||!ve)return;const je=-te.sourceEvent.deltaY*(te.sourceEvent.deltaMode===1?.05:te.sourceEvent.deltaMode?1:.002)*k,ye=ce[2]*Math.pow(2,je);ve.scaleTo(Ce,ye)},ae=te=>{const{transform:ce,d3Selection:Ce,d3Zoom:ve,translateExtent:je,width:ye,height:Ee}=T.getState();if(te.sourceEvent.type!=="mousemove"||!Ce||!ve)return;const Ye=G.current*Math.max(1,ce[2])*(b?-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,je);ve.transform(Ce,it)},fe=_N().on("zoom",N?ae:null).on("zoom.wheel",_?ne:null);return Q.call(fe),()=>{Q.on("zoom",null)}}},[N,_,b,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=T.getState().nodeInternals.get(ne);w(Q,ae)}:void 0;return ue.createElement(Vv,{position:m,style:e,className:Ft(["react-flow__minimap",n]),"data-testid":"rf__minimap"},ue.createElement("svg",{width:z,height:P,viewBox:`${re} ${J} ${W} ${Z}`,role:"img","aria-labelledby":M,ref:I,onClick:K},S&&ue.createElement("title",{id:M},S),ue.createElement(VO,{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-L},${J-L}h${W+L*2}v${Z+L*2}h${-W-L*2}z
57
+ M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:d,pointerEvents:"none"})))}hC.displayName="MiniMap";var QO=j.memo(hC);function ZO(){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 JO(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ue.createElement("path",{d:"M0 0h32v4.2H0z"}))}function eP(){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 tP(){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 nP(){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 so=({children:e,className:n,...r})=>ue.createElement("button",{type:"button",className:Ft(["react-flow__controls-button",n]),...r},e);so.displayName="ControlButton";const rP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),pC=({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:o,onZoomIn:l,onZoomOut:u,onFitView:c,onInteractiveChange:h,className:p,children:d,position:m="bottom-left"})=>{const y=Ct(),[w,N]=j.useState(!1),{isInteractive:_,minZoomReached:S,maxZoomReached:b}=Ke(rP,Nt),{zoomIn:k,zoomOut:E,fitView:T}=Aa();if(j.useEffect(()=>{N(!0)},[]),!w)return null;const I=()=>{k(),l==null||l()},O=()=>{E(),u==null||u()},A=()=>{T(o),c==null||c()},U=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),h==null||h(!_)};return ue.createElement(Vv,{className:Ft(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},n&&ue.createElement(ue.Fragment,null,ue.createElement(so,{onClick:I,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},ue.createElement(ZO,null)),ue.createElement(so,{onClick:O,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},ue.createElement(JO,null))),r&&ue.createElement(so,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},ue.createElement(eP,null)),i&&ue.createElement(so,{className:"react-flow__controls-interactive",onClick:U,title:"toggle interactivity","aria-label":"toggle interactivity"},_?ue.createElement(nP,null):ue.createElement(tP,null)),d)};pC.displayName="Controls";var sP=j.memo(pC),er;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(er||(er={}));function iP({color:e,dimensions:n,lineWidth:r}){return ue.createElement("path",{stroke:e,strokeWidth:r,d:`M${n[0]/2} 0 V${n[1]} M0 ${n[1]/2} H${n[0]}`})}function oP({color:e,radius:n}){return ue.createElement("circle",{cx:n,cy:n,r:n,fill:e})}const aP={[er.Dots]:"#91919a",[er.Lines]:"#eee",[er.Cross]:"#e2e2e2"},lP={[er.Dots]:1,[er.Lines]:1,[er.Cross]:6},uP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function mC({id:e,variant:n=er.Dots,gap:r=20,size:i,lineWidth:o=1,offset:l=2,color:u,style:c,className:h}){const p=j.useRef(null),{transform:d,patternId:m}=Ke(uP,Nt),y=u||aP[n],w=i||lP[n],N=n===er.Dots,_=n===er.Cross,S=Array.isArray(r)?r:[r,r],b=[S[0]*d[2]||1,S[1]*d[2]||1],k=w*d[2],E=_?[k,k]:b,T=N?[k/l,k/l]:[E[0]/l,E[1]/l];return ue.createElement("svg",{className:Ft(["react-flow__background",h]),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]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},N?ue.createElement(oP,{color:y,radius:k/l}):ue.createElement(iP,{dimensions:E,color:y,lineWidth:o})),ue.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}mC.displayName="Background";var cP=j.memo(mC);function gC(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function vC(e){const n=e.cache_creation,r=n&&typeof n=="object"?n: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 yC(e,n=0){if(!e||typeof e!="object"||n>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),...vC(r)};for(const i of Object.values(r)){const o=yC(i,n+1);if(o)return o}return null}function dP(e,n){e.inputTokens+=n.inputTokens,e.outputTokens+=n.outputTokens,e.cacheReadTokens+=n.cacheReadTokens,e.cacheCreateTokens+=n.cacheCreateTokens,(n.cacheCreate1hTokens!==void 0||n.cacheCreate5mTokens!==void 0)&&(e.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(n.cacheCreate1hTokens??0),e.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(n.cacheCreate5mTokens??0))}const fP=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function wC(e,n=0){if(!e||typeof e!="object"||n>6)return null;const r=e;if(typeof r.model=="string"&&fP.test(r.model))return r.model;for(const i of Object.values(r)){const o=wC(i,n+1);if(o)return o}return null}function jv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0}}function Rs(e){if(!e)return;const n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n[n.length-1]}function qx(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Ia(e,n){return`${e}::${n}`}function ku(e){return e.agent_type??e.subagent_type??"subagent"}function ga(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function io(e,n,r,i){const o=n;let l=e.agents.get(o);return l||(l={id:o,sessionId:n,label:"session",kind:"root",state:"active",startedAt:r,lastEventAt:r,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:i,usage:gC()},e.agents.set(o,l),l)}function xC(e,n,r,i){const o=Ia(n,r),l=e.agents.get(o);if(!l)return null;!l.cwd&&i.cwd&&(l.cwd=i.cwd,l.cwdBasename=Rs(i.cwd));const u=ku(i);return u&&(l.label==="subagent"||!l.label)&&(l.label=u),l}function $x(e,n,r){const i=n.session_id??"unknown",o=ga(n);if(o){const h=xC(e,i,o,n);if(h)return h}const l=e.activeSubagentStack.get(i),u=l&&l.length>0?l[l.length-1]:null;if(u){const h=e.agents.get(Ia(i,u));if(h)return!h.cwd&&n.cwd&&(h.cwd=n.cwd,h.cwdBasename=Rs(n.cwd)),h}const c=io(e,i,r,!1);return c.synthetic&&(c.synthetic=!1,c.startedAt=r),!c.cwd&&n.cwd&&(c.cwd=n.cwd,c.cwdBasename=Rs(n.cwd)),c.label==="session"&&n.cwd&&(c.label=Rs(n.cwd)??"session"),c}function hP(e,n,r,i,o){const l=Ia(n,r),u=io(e,n,o,!0);let c=e.agents.get(l);if(c){!c.cwd&&i.cwd&&(c.cwd=i.cwd,c.cwdBasename=Rs(i.cwd));const h=ku(i);return h&&(c.label==="subagent"||!c.label)&&(c.label=h),c}return c={id:l,sessionId:n,label:ku(i),kind:"subagent",parentId:u.id,state:"active",startedAt:o,tools:[],prompts:[],cwd:i.cwd,cwdBasename:Rs(i.cwd),toolCount:0,childCount:0,usage:gC()},e.agents.set(l,c),u.childCount+=1,c}function pP(e,n,r){const i=e.activeSubagentStack.get(n)??[];i.includes(r)||(i.push(r),e.activeSubagentStack.set(n,i))}function mP(e,n,r){const i=e.activeSubagentStack.get(n);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(n)}}function tu(e,n=80){if(e==null)return"";if(typeof e=="string")return e.length>n?e.slice(0,n-1)+"…":e;try{const r=JSON.stringify(e);return r.length>n?r.slice(0,n-1)+"…":r}catch{return String(e)}}const Dx=200,gP=25;function vP(e,n){const r=n.tools;if(r.length>Dx){const i=r.splice(0,r.length-Dx);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-gP-1;i>=0;i--){const o=r[i];if(o.trimmed)break;o.input=void 0,o.response=void 0,o.trimmed=!0}}function yP(e,n,r){const i=e.toolIndex.get(r);if(i)return i;for(let o=n.tools.length-1;o>=0;o--)if(n.tools[o].id===r)return n.tools[o];return null}const Fx=2e3;function wP(e,n,r){for(let i=e.prompts.length-1;i>=0;i--){const o=e.prompts[i];if(o.at<n-Fx)return!1;if(o.text===r&&o.at<=n+Fx)return!0}return!1}function _C(e,n){for(const r of n.tools)e.toolIndex.get(r.id)===r&&e.toolIndex.delete(r.id),e.toolOwner.get(r.id)===n.id&&e.toolOwner.delete(r.id)}function xP(e,n,r,i){if(e.agents.size<=r)return!1;const o=[];for(const[u,c]of e.agents)c.state==="done"&&c.endedAt!=null&&n-c.endedAt>i&&o.push({id:u,endedAt:c.endedAt});if(o.length===0)return!1;o.sort((u,c)=>u.endedAt-c.endedAt);let l=0;for(const u of o){if(e.agents.size<=r)break;const c=e.agents.get(u.id);c&&_C(e,c),e.agents.delete(u.id),l++}return l>0}function _P(e,n,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},o.set(d.sessionId,m)),m.ids.push(p),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&&n-p.endedAt>i).sort((p,d)=>p.endedAt-d.endedAt);let c=[...o.values()].filter(p=>!p.live).length-r;if(c<=0)return!1;let h=!1;for(const p of l){if(c<=0)break;for(const d of p.ids){const m=e.agents.get(d);m&&_C(e,m),e.agents.delete(d)}c--,h=!0}return h}function bP(e,n,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 h=Math.max(c.startedAt,u??c.startedAt);c.endedAt==null&&n-h>r&&(c.endedAt=h,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 zx=90*6e4;function SP(e,n,r){let i=!1;for(const o of e.agents.values()){if(o.kind!=="root")continue;const l=o.lastEventAt??o.startedAt;if(!(n-l<=r)){o.waiting&&(o.waiting=null,i=!0),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 kP(e){return e==="permission_prompt"?"permission":e==="idle_prompt"?"idle":null}const EP=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved"]);function NP(e,n){let r=null;for(const i of e.toolIndex.values()){const o=i.agentId?e.agents.get(i.agentId):void 0;!o||o.sessionId!==n||(!r||i.startedAt>r.startedAt)&&(r=i)}return r==null?void 0:r.explicitSubagentId}function CP(e,n,r,i,o){const l=r==="permission"?NP(e,n):void 0;return l?{kind:r,message:i,since:o,subagentId:l}:{kind:r,message:i,since:o}}function TP(e,n,r){if(e.kind!=="permission")return!0;const i=ga(n);return i==null?!0:e.subagentId!=null&&Ia(r,i)===e.subagentId}function Bx(e,n){const r=n.epoch??null;if(r!==null&&r!==e.seqEpoch)e.seqEpoch=r,e.lastSeq=0;else if(n.seq<=e.lastSeq)return e;const i=n.payload??{},o=n.receivedAt,l=i.hook_event_name??"Unknown";if(l==="__clear")return{...jv(),lastSeq:n.seq,seqEpoch:e.seqEpoch};e.totalEvents+=1,e.lastSeq=n.seq;const u=i.session_id??"unknown";if(!EP.has(l)){const d=e.agents.get(u);d!=null&&d.waiting&&TP(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)),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??qx(),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 N=`${u}::${y}`,_=e.agents.get(N);_&&(_.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??qx(),w=(_,S)=>typeof d[_]=="number"?d[_]:S,N=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:N??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=vC(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 h=$x(e,i,o);h.provider||(h.provider=i.provider==="codex"?"codex":"claude");const p=wC(i);switch(p&&(h.model=p),l){case"SessionStart":{const d=io(e,u,o,!1);d.synthetic=!1,d.state="active",d.startedAt=d.startedAt||o,!d.cwd&&i.cwd&&(d.cwd=i.cwd,d.cwdBasename=Rs(i.cwd)),d.label==="session"&&i.cwd&&(d.label=Rs(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=io(e,u,o,!1);d.state="active",d.endedAt=void 0,d.exitAt=void 0;const m=$x(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&&!wP(m,o,y)&&(m.prompts.push({at:o,text:y}),m.firstPrompt||(m.firstPrompt=tu(y,120)));break}case"PreToolUse":{const d=i.tool_use_id?yP(e,h,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=tu(i.tool_input));break}const m=i.tool_use_id??`${h.id}:${h.toolCount}`,y=ga(i),w={id:m,name:i.tool_name??"?",input:i.tool_input,inputPreview:tu(i.tool_input),agentId:h.id,explicitSubagentId:y?Ia(u,y):void 0,startedAt:o};h.tools.push(w),h.toolCount+=1,h.state="active",e.toolIndex.set(m,w),e.toolOwner.set(m,h.id),vP(e,h);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 S=_.tools.find(b=>b.id===d);if(S){m=S,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=tu(i.tool_response):y&&(m.errorPreview=void 0);const w=yC(i.tool_response);w&&(m.usage=w),e.toolIndex.delete(d);const N=e.toolOwner.get(d)??m.agentId;if(e.toolOwner.delete(d),N&&w){const _=e.agents.get(N);_&&dP(_.usage,w)}break}case"SubagentStart":{const d=ga(i);if(!d)break;const m=hP(e,u,d,i,o);m.state="active",m.startedAt=m.startedAt||o,m.exitAt=void 0,m.endedAt=void 0;const y=ku(i);y&&(m.label=y),pP(e,u,d);break}case"SubagentStop":{const d=ga(i);if(!d)break;const m=xC(e,u,d,i);if(!m)break;m.state="done",m.endedAt=o,mP(e,u,d);break}case"Stop":case"SessionEnd":{const d=io(e,u,o,!1);d.state="done",d.endedAt=o,e.activeSubagentStack.delete(u);break}case"Notification":{const d=kP(i.notification_type);if(!d)break;const m=io(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)}:CP(e,u,d,y,o);break}}return e}function ry(e){let n=5381;for(let r=0;r<e.length;r++)n=(n<<5)+n^e.charCodeAt(r);return Math.abs(n)%360}const RP=Date.UTC(2026,8,1);function jP(e){return e<RP?{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}}const AP=[{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:jP},{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 IP(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function mo(e,n=Date.now()){if(!e)return null;for(const r of AP)if(r.match.test(e))return typeof r.rates=="function"?r.rates(n):r.rates;return null}function bC(e,n){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=n.cacheWrite1h??n.cacheWrite;return{tokens5m:l,tokens1h:r,usd5m:l*n.cacheWrite/1e6,usd1h:r*u/1e6}}function SC(e,n,r=Date.now()){if(!IP(n))return e.inputTokens;const i=mo(n,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,n,r=Date.now()){const i=mo(n,r);if(!i)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const o=SC(e,n,r)*i.input/1e6,l=e.outputTokens*i.output/1e6,u=e.cacheReadTokens*i.cacheRead/1e6,c=bC(e,i),h=c.usd5m+c.usd1h;return{input:o,output:l,cacheRead:u,cacheWrite:h,total:o+l+u+h}}const Ux=2e5,MP=1e6,OP=[/\[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],PP=[{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 LP(e){if(!e)return Ux;for(const n of OP)if(n.test(e))return MP;for(const n of PP)if(n.match.test(e))return n.window;return Ux}function kC(e,n){return typeof e=="number"&&e>0?e:LP(n)}const hu="not priced";function ze(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const n=(e*100).toFixed(e<.1?1:0);if(Number(n)<100)return`${n}¢`}return e<100?`$${e.toFixed(2)}`:e<1e4?`$${e.toFixed(0)}`:`$${(e/1e3).toFixed(1)}k`}function Eu(e,n){if(e<=0||n<10)return null;const r=e/n,i=r*60;return i>=.01?`${ze(i)}/min`:`${ze(r*3600)}/hr`}const qP=new Set(["untrusted","on-request","on-failure"]);function $P(e){return typeof e!="string"||!e?null:qP.has(e)?!0:e==="never"?!1:null}function DP(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const n=$P(e.approvalPolicy);return n===!1?null:{label:"approvals not visible",detail:`${n===!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 Hx(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function js(e){const n=e.replace(/^anthropic\./,"").replace(/[-_]\d{8}(?!\d)/,""),r=n.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(r){const o=Hx(r[1]),l=r[2].replace(/[-_]/g,".");return`${o} ${l}`}const i=n.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(i){const o=i[1].replace(/[-_]/g,"."),l=i[2].split(/[-_]/).filter(Boolean).map(Hx);return[`GPT-${o}`,...l].join(" ")}return e}function Mt(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 Nu(e,n,r){const i=(n??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 EC(e,n){if(e.endedAt==null)return n;const r=e.endedAt-e.startedAt;return r<1e3?`${r}ms`:`${(r/1e3).toFixed(2)}s`}const FP=1;function zP(){const e=[];let n=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:n++};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 Cu=zP();function BP(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function Wx(e){return String(e.tagName??"").toUpperCase()==="BODY"}function UP(e,n){return!e||!e.isConnected||Wx(e)?!1:n==null||Wx(n)}const Vx="a[href], button, input, select, textarea, [tabindex]";function HP(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function WP(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const n=String(e.overflow??"").toLowerCase();return n==="auto"||n==="scroll"}function VP({count:e,index:n,shiftKey:r}){return e<=0?{kind:"hold"}:n<0||n>=e?{kind:"focus",index:r?e-1:0}:!r&&n===e-1?{kind:"focus",index:0}:r&&n===0?{kind:"focus",index:e-1}:{kind:"allow"}}function NC(e){return e.ctrlKey||e.metaKey||e.altKey}const GP=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),YP=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),KP=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function CC(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function sy(e){if(!e)return!1;if(e.isContentEditable)return!0;const n=CC(e);return n==="TEXTAREA"?!0:n!=="INPUT"?!1:!GP.has(String(e.type??"text").toLowerCase())}function XP(e){if(!e)return!1;if(sy(e)||YP.has(CC(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>KP.has(r))}function TC(e){return e?Array.from(e.querySelectorAll("*")).filter(n=>{if(n.matches(Vx))return HP({disabled:n.disabled,tabIndex:n.tabIndex,rendered:n.getClientRects().length>0});const r=n.scrollHeight>n.clientHeight;return r&&WP({overflowing:r,overflow:getComputedStyle(n).overflowY,hasFocusable:n.querySelector(Vx)!=null})}):[]}function QP(e,n){const r=TC(e);if(!n||!e.contains(n)||r.includes(n))return r;const i=r.findIndex(o=>(n.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return i===-1?[...r,n]:[...r.slice(0,i),n,...r.slice(i)]}function yo(e,n={}){const{focusRef:r,layer:i}=n,o=j.useRef(null),l=j.useRef(e);l.current=e;const u=j.useRef(null);u.current===null&&(u.current=()=>l.current());const c=u.current;return j.useEffect(()=>Cu.push(c,i),[c,i]),j.useEffect(()=>{var p;const h=document.activeElement;return(p=(r==null?void 0:r.current)??TC(o.current)[0])==null||p.focus(),()=>{UP(h,document.activeElement)&&h.focus()}},[]),j.useEffect(()=>{const h=p=>{var _;if(p.key!=="Tab"||NC(p))return;const d=o.current;if(!d)return;const m=document.activeElement;if(!(m!=null&&d.contains(m))&&!Cu.isTop(c))return;const w=QP(d,m),N=VP({count:w.length,index:m?w.indexOf(m):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((_=w[N.index])==null||_.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[c]),o}function ZP(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 JP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const eL=60;function tL(e,n=eL){if(e.length<=n)return e;const r=e.slice(e.length-(n-1)),i=r.search(/[/\\]/);return"…"+(i===-1?r:r.slice(i))}function nL({agent:e,onClose:n}){var y;const r=j.useRef(null),i=yo(n,{focusRef:r}),o=e.context,l=e.usage,u=(o==null?void 0:o.currentContextTokens)??0,c=kC(e.contextWindow,e.model),h=Math.min(100,u/c*100),p=dn(l,e.model),d=l.inputTokens+l.cacheReadTokens+l.cacheCreateTokens,m=ZP(e.provider);return g.jsx("div",{className:"ctx-modal-backdrop",onClick:n,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:n,"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(h),children:g.jsx("div",{className:"ctx-window-fill",style:{width:`${h}%`}})}),g.jsxs("div",{className:"ctx-window-meta",children:[g.jsxs("span",{className:"ctx-window-pct",children:[h.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:ze(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:tL(w.path)}),g.jsx("span",{className:"ctx-md-size",children:JP(w.bytes)})]},w.path))})]})})}function Qn({label:e,val:n,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:n})]})}function rL({currentContextTokens:e,modelId:n,contextWindow:r,size:i=26,onClick:o,title:l}){const u=kC(r,n),c=Math.min(1,e/u),h=i/2-3,p=i/2,d=2*Math.PI*h,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:h,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),g.jsx("circle",{cx:p,cy:p,r:h,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 Gx(e,n){const r=mo(n);if(!r)return`model: ${n}
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,n),u=bC(e,r),c=u.tokens1h>0?[`cache w5m${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${ze(u.usd5m)}`,`cache w1h${i(u.tokens1h).padStart(14)} × ${o(r.cacheWrite1h??r.cacheWrite).padEnd(11)} = ${ze(u.usd1h)}`]:[`cache w ${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${ze(u.usd5m)}`],h=SC(e,n),p=h===e.inputTokens?"input":"uncached";return[`model: ${n}`,`${p.padEnd(9)}${i(h).padStart(14)} × ${o(r.input).padEnd(11)} = ${ze(l.input)}`,`output ${i(e.outputTokens).padStart(14)} × ${o(r.output).padEnd(11)} = ${ze(l.output)}`,`cache r ${i(e.cacheReadTokens).padStart(14)} × ${o(r.cacheRead).padEnd(11)} = ${ze(l.cacheRead)}`,...c,"─────────────────────────────────────────",`total = ${ze(l.total)}`].join(`
61
+ `)}function sL({data:e,selected:n}){var h;const r=e.now??Date.now(),i=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",n?"selected":""].filter(Boolean).join(" "),o=e.tools.filter(p=>!p.endedAt).length,l=ry(e.sessionId),u=((h=e.context)==null?void 0:h.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(po,{type:"target",position:Ae.Left,style:{background:"transparent",border:"none"}}),g.jsxs("div",{className:"head",children:[g.jsxs("div",{className:"title",children:[g.jsx(iL,{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(rL,{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:Nu(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:js(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(aL,{waiting:e.waiting,now:r}),(()=>{const p=DP(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(lL,{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:Mt(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{if(!mo(e.model))return e.usage.inputTokens+e.usage.outputTokens<=0?null:g.jsx("span",{className:"cost-unpriced",title:Gx(e.usage,e.model),children:hu});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"?Eu(d.total,m):null,w=Gx(e.usage,e.model)+(y?`
62
+ burn: ${y}`:"");return g.jsxs("span",{className:"cost-meta",title:w,children:[g.jsx("b",{children:ze(d.total)}),y&&g.jsx("span",{className:"cost-rate",children:y})]})})()]}),g.jsx(po,{type:"source",position:Ae.Right,style:{background:"transparent",border:"none"}})]})}function iy(e){return e==="active"?"live":e==="done"?"done":"err"}function iL({state:e}){return g.jsx("span",{className:`state-pill state-${e}`,children:iy(e)})}function qu(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function oL(e){return e.kind==="permission"?qu(e):"Your turn"}function aL({waiting:e,now:n}){const r=e.kind==="permission",i=qu(e);return g.jsxs("div",{className:r?"waiting-row permission":"waiting-row idle",title:`${i}
63
+ Blocked for ${Nu(e.since,void 0,n)} — 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:oL(e)}),g.jsx("b",{children:Nu(e.since,void 0,n)})]})}function lL({tools:e,now:n}){const l=new Array(24).fill(0);let u=0;for(const y of e){const w=n-y.startedAt;if(w<0||w>=6e4)continue;const N=23-Math.floor(w/2500);N>=0&&N<24&&(l[N]+=1,u+=1)}const c=Math.max(1,...l),h=132,p=14,d=h/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:h,height:p,viewBox:`0 0 ${h} ${p}`,"aria-hidden":!0,children:l.map((y,w)=>{const N=y===0?1.5:Math.max(1.5,y/c*p),_=w===23&&y>0,b=`tool-spark-bar${y>0?" active":""}${_?" latest":""}`;return g.jsx("rect",{x:w*d+.4,y:p-N,width:Math.max(.5,d-1),height:N,rx:.8,className:b},w)})}),g.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function Yx(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function uL({tool:e,onClose:n}){const r=yo(n),i=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return g.jsx("div",{className:"modal-backdrop",onClick:n,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:EC(e,"in-flight…")}),g.jsx("button",{className:"btn icon-btn",onClick:n,"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:Yx(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…)":Yx(e.response??e.errorPreview)})]})]})]})})}const nu=18,Kx=26,cL=12;function dL(e){return fL(e.nodeInternals.values())}function fL(e){const n=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,h=u+o.width,p=c+o.height,d=n.get(l.sessionId);d?(d.minX=Math.min(d.minX,u),d.minY=Math.min(d.minY,c),d.maxX=Math.max(d.maxX,h),d.maxY=Math.max(d.maxY,p),l.kind==="root"&&(d.label=Xx(l)??d.label)):n.set(l.sessionId,{minX:u,minY:c,maxX:h,maxY:p,label:Xx(l)??l.sessionId})}const r=new Map;for(const o of n.values())r.set(o.label,(r.get(o.label)??0)+1);const i=[];for(const[o,l]of n){const c=(r.get(l.label)??0)>1?`${l.label} · ${hL(o)}`:l.label;i.push({sessionId:o,label:c,x:l.minX-nu,y:l.minY-nu-Kx,w:l.maxX-l.minX+nu*2,h:l.maxY-l.minY+nu*2+Kx})}return i}function hL(e){const n=e.match(/[a-zA-Z0-9]{4}/);return n?n[0]:e.slice(0,4)}function Xx(e){if(e.kind==="root")return e.label}function pL(){const{x:e,y:n,zoom:r}=dC(),i=Aa(),o=Ke(dL,mL);if(o.length<=1)return null;const l=c=>{try{const h=i.getNodes().filter(p=>{const d=p.data;return(d==null?void 0:d.sessionId)===c});if(h.length===0)return;i.fitView({padding:.3,duration:500,nodes:h})}catch{}},u={transform:`translate(${e}px, ${n}px) scale(${r})`};return g.jsx("div",{className:"session-clusters",style:u,children:o.map(c=>{const h=ry(c.sessionId),p={position:"absolute",left:c.x,top:c.y,width:c.w,height:c.h,"--session-hue":h},d={position:"absolute",left:c.x+16,top:c.y-cL,transform:`scale(${Math.min(1,r)/(r||1)})`,transformOrigin:"left top","--session-hue":h};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 mL(e,n){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++){const i=e[r],o=n[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 gL({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 Ma={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"}},vL=Object.fromEntries(Object.entries(Ma).map(([e,n])=>[e,n.category])),yL=Object.fromEntries(Object.entries(Ma).map(([e,n])=>[e,n.emoji])),wL=Object.fromEntries(Object.entries(Ma).map(([e,n])=>[e,n.label])),xL=new Set(Object.keys(Ma)),_L=new Set(Object.entries(Ma).filter(([,e])=>e.shell).map(([e])=>e)),bL={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",ScheduleWakeup:"other",CronCreate:"other",CronList:"other",CronDelete:"other",Monitor:"other",PushNotification:"other",RemoteTrigger:"other",ToolSearch:"other",...vL};function RC(e){return e.startsWith("mcp__")?"mcp":bL[e]??"other"}const SL=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,kL=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function EL(e){if(typeof e!="string"||!e)return null;const n=SL.exec(e);if(n){const i=NL(n[2]);if(i.trim())return i}const r=kL.exec(e);return r?r[1]:null}function NL(e){return e.replace(/\\(["'`\\nrt])/g,(n,r)=>r==="n"?`
64
+ `:r==="r"?"\r":r==="t"?" ":r)}const jC=600,CL=4,TL=36,Av=16,RL=60,jL=6,Qx=220,Zx=96,AL=28,IL={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:"📡",...yL};function Jx(e){return e.startsWith("mcp__")?"🔌":IL[e]??"✨"}const ML={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 AC(e){if(!e)return null;let n=e.trim();if(!n)return null;const r=n.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(r)return AC(r[1]);for(;;){const l=n.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!l)break;n=n.slice(l[0].length)}n=n.replace(/^sudo(?:\s+-\S+)*\s+/,""),n=n.replace(/^(?:time|nohup|xargs)\s+/,"");const i=n.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 OL(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const n=e;if(typeof n.script=="string"){const r=EL(n.script);if(r)return r}if(typeof n.cmd=="string")return n.cmd;if(typeof n.command=="string")return n.command;if(Array.isArray(n.command)&&n.command.every(r=>typeof r=="string")){const r=n.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 n.script=="string"?n.script:null}const PL=new Set(["Bash","PowerShell",..._L]),LL=xL;function qL(e,n){return LL.has(e)||e.startsWith("mcp__")?Math.max(Zx,34+n.length*7.5):Zx}function $L(e,n){if(!PL.has(e))return null;const r=OL(n);if(!r)return null;const i=AC(r);return i?{emoji:ML[i]??"⚙️",label:i,category:"shell",detail:r}:null}const DL=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),e_={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:"🗄️"},t_={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 FL(e){const r=e.replace(/\\/g,"/").replace(/\/+$/,""),i=r.lastIndexOf("/");return i>=0?r.slice(i+1):r}function zL(e){const n=e.toLowerCase();if(t_[n])return t_[n];if(n.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(n))return"🧪";const r=n.lastIndexOf(".");if(r>0&&r<n.length-1){const i=n.slice(r+1);if(e_[i])return e_[i]}return"📄"}function BL(e,n){if(!n||typeof n!="object")return null;const r=n;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 UL(e,n){if(!DL.has(e))return null;const r=BL(e,n);if(!r)return null;const i=FL(r);return i?{emoji:e==="LS"?"📂":zL(i),label:i,category:"file",detail:r}:null}const IC={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 MC(e){if(!e.startsWith("mcp__"))return null;const n=e.slice(5),r=n.indexOf("__");return r<=0?{server:n,method:""}:{server:n.slice(0,r),method:n.slice(r+2)}}function HL(e){let n=5381;for(let r=0;r<e.length;r++)n=(n<<5)+n^e.charCodeAt(r);return Math.abs(n)%360}function WL(e,n){const r=MC(e);if(!r)return null;const{server:i,method:o}=r;if(!o)return null;const l=IC[i.toLowerCase()];return{emoji:(l==null?void 0:l.emoji)??"🔌",label:o,category:"mcp",detail:l?`${l.name} · ${o}`:`${i} · ${o}`}}function VL(e,n){return $L(e,n)??UL(e,n)??WL(e)}const GL=wL;function YL(e){const n=MC(e);if(n){const i=IC[n.server.toLowerCase()];return i?{emoji:i.emoji,label:i.name}:{emoji:"🔌",label:n.server,hue:HL(n.server)}}const r=GL[e];return r?{emoji:Jx(e),label:r}:{emoji:Jx(e),label:e}}function KL(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function XL(e,n,r){if(r==null)return 1;const i=n-r;return i<0?1:Math.max(0,1-i/jC)}function QL(e,n){const r=[],i=new Set;for(let o=e.length-1;o>=0&&r.length<n;o--){const l=e[o];i.has(l.id)||(i.add(l.id),r.push(l))}return r.reverse()}function ZL(e,n,r,i,o,l){const u=[];for(const c of e.values()){if(!n.has(c.id)||c.exitAt!=null&&l-c.exitAt>jC)continue;const h=i.get(c.id)??r.get(c.id);if(!h)continue;const p=QL(c.tools,CL);if(p.length===0)continue;const d=c.exitAt??null,m=o.get(c.id),y=Math.max((m==null?void 0:m.width)??Qx,Qx),w=(m==null?void 0:m.height)??130,N=h.x,_=h.y,S=N+y,b=_+w/2;p.forEach((k,E)=>{const T=E*TL,I=N+y+RL,O=_+jL+T,A=XL(k,l,d),U=k.inputPreview??"",z=KL(k),P=A<.999,D=YL(k.name);u.push({id:`${c.id}::${k.id}`,toolId:k.id,agentId:c.id,toolName:k.name,name:D.label,emoji:D.emoji,status:z,category:RC(k.name),mcpHue:D.hue,inputPreview:U,fade:A,fading:P,worldX:I,worldY:O,anchorX:S,anchorY:b,spawnDx:S-I,spawnDy:b-(O+Av)});const V=VL(k.name,k.input);if(V){const B=qL(k.name,D.label),C=I+B+AL,$=O,L=I+B,re=O+Av;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:z,category:V.category,inputPreview:V.detail??U,fade:A,fading:P,worldX:C,worldY:$,anchorX:L,anchorY:re,spawnDx:L-C,spawnDy:0})}})}return u}function JL({agents:e,visibleAgentIds:n,positions:r,pinned:i,measured:o,dimUnmatched:l,spotlight:u,hiddenCategories:c,now:h,onOpenTool:p}){const d=ZL(e,n,r,i,o,h),m=c&&c.size>0?d.filter(y=>!c.has(y.category)):d;return g.jsx(e3,{bursts:m,dimUnmatched:l,spotlight:u,onOpenTool:p})}function e3({bursts:e,dimUnmatched:n,spotlight:r,onOpenTool:i}){const{x:o,y:l,zoom:u}=dC();return g.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[g.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const h=c.anchorX*u+o,p=c.anchorY*u+l,d=(c.worldX+6)*u+o,m=(c.worldY+Av)*u+l,y=h+(d-h)*.55,w=n!=null&&!n.has(c.agentId),N=r!=null&&!r.has(c.agentId),_=c.fade*(w||N?.14:1);return g.jsx("path",{d:`M ${h} ${p} Q ${y} ${p}, ${d} ${m}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>{const h=c.worldX*u+o,p=c.worldY*u+l,d={left:`${h}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,N=c.mcpHue!=null?{"--mcp-hue":c.mcpHue}:{},_=n!=null&&!n.has(c.agentId),S=r!=null&&!r.has(c.agentId),b=_||S?" 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":""}${b}`,style:N,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 oy({cost:e,size:n="md"}){const r=e.total;if(r<=0)return null;const i=(l,u,c)=>{if(l<=0)return null;const h=l/r*100;return g.jsx("span",{className:`cb-seg ${u}`,style:{width:`${h}%`},title:`${c}: ${ze(l)} (${h.toFixed(0)}%)`},u)},o=n==="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 t3({state:e,sessionId:n,onClose:r}){const i=j.useMemo(()=>n3(e,n),[e,n]),o=j.useRef(null),l=yo(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:ze(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:js(u)},u))})]}),g.jsx("div",{className:"ss-hero-right",children:i.cost.total>0&&g.jsxs(g.Fragment,{children:[g.jsx(oy,{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:ze(i.cost.input)})]}),g.jsxs("span",{className:"ssl ssl-out",children:["output ",g.jsx("b",{children:ze(i.cost.output)})]}),g.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",g.jsx("b",{children:ze(i.cost.cacheRead)})]}),g.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",g.jsx("b",{children:ze(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:n,tone:r}){return g.jsxs("div",{className:`ss-stat${r?` tone-${r}`:""}`,children:[g.jsx("div",{className:"ss-stat-value",children:n}),g.jsx("div",{className:"ss-stat-label",children:e})]})}function n3(e,n){const r=e.agents.get(n);if(!r)return null;const i=[];for(const E of e.agents.values())E.sessionId===n&&i.push(E);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,h=0,p=0,d=0,m=0,y,w=1/0,N=0;for(const E of i){const T=dn(E.usage,E.model);o.input+=T.input,o.output+=T.output,o.cacheRead+=T.cacheRead,o.cacheWrite+=T.cacheWrite,o.total+=T.total,E.model&&l.add(E.model),E.kind==="subagent"&&m++,h+=E.prompts.length,!y&&E.prompts.length>0&&(y=E.prompts[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,c+=E.toolCount,w=Math.min(w,E.startedAt),N=Math.max(N,E.endedAt??Date.now());for(const I of E.tools)u.set(I.name,(u.get(I.name)??0)+1),I.ok===!1&&d++}const _=Math.max(0,N-w),S=Math.floor(_/1e3),b=S<60?`${S}s`:S<3600?`${Math.floor(S/60)}m ${String(S%60).padStart(2,"0")}s`:`${Math.floor(S/3600)}h ${Math.floor(S%3600/60)}m`,k=Array.from(u.entries()).sort((E,T)=>T[1]-E[1]).slice(0,5);return{sessionId:n,label:r.label||r.cwdBasename||"session",cwd:r.cwd,durationLabel:b,cost:o,modelChips:Array.from(l),agentCount:i.length,subagentCount:m,toolCount:c,promptCount:h,tokensSum:p,errCount:d,topTools:k,firstPrompt:y}}function ay(e){return(e==null?void 0:e.kind)==="permission"}function r3(e){const n=[];for(const r of e)r.kind==="root"&&ay(r.waiting)&&n.push({id:r.id,label:r.label,waiting:r.waiting});return n.sort((r,i)=>r.waiting.since-i.waiting.since)}function s3(e){const n=new Set;for(const r of e)r.state==="active"&&n.add(r.sessionId);return n.size}function n_(e){return e.waiting?ay(e.waiting)?0:1:e.state==="active"?2:3}function i3(e,n){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 h=c.endedAt??c.startedAt;h>u&&(u=h)}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=n_(i),u=n_(o);return l!==u?l-u:i.waiting&&o.waiting?i.waiting.since-o.waiting.since:o.lastActivity-i.lastActivity}),r}function r_(e,n,r){const i=(n??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 o3({state:e,now:n,selectedIds:r,onSelect:i,onClose:o}){const l=j.useMemo(()=>i3(e),[e,e.lastSeq,n]),u=l.filter(h=>h.state==="active").length,c=l.filter(h=>ay(h.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(h=>{const p=r.has(h.sessionId);return g.jsxs("button",{type:"button",className:`sl-row state-${h.state}${p?" selected":""}`,onClick:()=>i(h.sessionId),title:`Focus ${h.label}`,children:[g.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),g.jsx("span",{className:"vis-hidden",children:iy(h.state)}),g.jsxs("div",{className:"sl-row-body",children:[g.jsxs("div",{className:"sl-row-head",children:[g.jsx("span",{className:"sl-label",children:h.label}),h.modelId&&g.jsx("span",{className:"model-chip",title:h.modelId,children:js(h.modelId)})]}),g.jsxs("div",{className:"sl-row-meta",children:[g.jsxs("span",{title:"tool calls",children:[g.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&g.jsx("span",{className:"sl-cost",title:"total spend",children:g.jsx("b",{children:ze(h.cost)})}),h.waiting?g.jsxs("span",{className:"sl-waiting",title:`${qu(h.waiting)}
65
+ Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`,children:["waiting ",r_(h.waiting.since,void 0,n)]}):g.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:r_(h.startedAt,h.state==="active"?void 0:h.lastActivity,n)})]})]})]},h.sessionId)})]})]})}const Gt="ccdeck";function OC(e){const n=Math.max(0,e);return n<60?"just now":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function Iv(e){return OC(Math.floor(e/1e3))}function PC(e,n){const r=e-n;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 a3(e,n){return e.getFullYear()===n.getFullYear()&&e.getMonth()===n.getMonth()&&e.getDate()===n.getDate()}function l3(e,n,r){const i=new Date(e),o=Iv(n-e);return{label:a3(i,new Date(n))?o:`${o} · ${i.toLocaleDateString(r,{month:"short",day:"numeric"})}`,title:i.toLocaleString(r,{dateStyle:"medium",timeStyle:"medium"})}}function s_(e,n){if(!e)return null;const r=n-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 u3(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 Vd="__unknown__";function c3(e,n,r,i){const o=Math.max(0,n-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 h=100-e,p=l>0?e/l:0,d=p>0?h/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:n,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?PC(i,u):null,w=i&&o?c3(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:[n,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 d3=6e4;function f3(e){const[n,r]=j.useState(null),[i,o]=j.useState(!1),l=j.useRef(null),u=async(h=!1)=>{h&&o(!0);try{const d=await fetch(h?"/api/quota?refresh=1":"/api/quota");d.ok&&r(await d.json())}catch{}finally{h&&o(!1)}};return j.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),d3),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{quota:n,loading:i,refresh:()=>{e&&u(!0)}}}function h3(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 LC=6e4;function p3(e){const[n,r]=j.useState(null),[i,o]=j.useState(!1),l=j.useRef(null),u=async(h=!1)=>{h&&o(!0);try{const d=await fetch(h?"/api/codex-quota?refresh=1":"/api/codex-quota");d.ok&&r(await d.json())}catch{}finally{h&&o(!1)}};return j.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),LC),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{data:n,loading:i,refresh:()=>{e&&u(!0)}}}function m3(e){const[n,r]=j.useState(null),i=j.useRef(null),o=async()=>{try{const l=await fetch("/api/codex-usage");l.ok&&r(await l.json())}catch{}};return j.useEffect(()=>{if(e)return o(),i.current=window.setInterval(o,LC),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:n}}function g3({state:e,now:n,providers:r,onClose:i}){var V,B;const{quota:o,loading:l,refresh:u}=f3(r.claude),{data:c,loading:h,refresh:p}=p3(r.codex),{data:d}=m3(r.codex),[m,y]=j.useState(()=>Math.floor(Date.now()/1e3));j.useEffect(()=>{const C=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(C)},[]);const{byModel:w,totalCost:N,totalTokens:_,burnRate:S}=j.useMemo(()=>{const C=new Map,$={total:0,input:0,output:0,cacheRead:0,cacheWrite:0};let L=0,re=0,J=0,W=0;for(const q of e.agents.values()){const Q=q.model??Vd,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:mo(q.model)!=null}),$.total+=ne.total,$.input+=ne.input,$.output+=ne.output,$.cacheRead+=ne.cacheRead,$.cacheWrite+=ne.cacheWrite,L+=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 M=0,G=0;for(const q of e.agents.values()){if(q.state!=="active")continue;const Q=dn(q.usage,q.model);M+=Q.total,G=Math.max(G,((q.endedAt??n)-q.startedAt)/1e3)}const K=G>0?Eu(M,G):null;return{byModel:Z,totalCost:$,totalTokens:{in:L,out:re,cacheR:J,cacheC:W},burnRate:K}},[e,e.lastSeq,n]),b=j.useMemo(()=>{const C=[],$=L=>mo(L.model)==null?L.usage.inputTokens+L.usage.outputTokens:0;for(const L of e.agents.values()){if(L.kind!=="root")continue;let re=dn(L.usage,L.model).total,J=L.usage.inputTokens,W=L.usage.outputTokens,Z=$(L);for(const M of e.agents.values())M.sessionId!==L.sessionId||M.kind==="root"||(re+=dn(M.usage,M.model).total,J+=M.usage.inputTokens,W+=M.usage.outputTokens,Z+=$(M));C.push({sessionId:L.sessionId,label:L.label||L.cwdBasename||"session",state:L.state,cost:re,inputTokens:J,outputTokens:W,unpricedTokens:Z})}return C.sort((L,re)=>re.cost-L.cost||re.inputTokens+re.outputTokens-(L.inputTokens+L.outputTokens)).slice(0,12)},[e,e.lastSeq]),k=N.total>0,E=_.in+_.out,T=w.filter(C=>C.cost.total>0||C.inputTokens+C.outputTokens>0),I=b.filter(C=>C.cost>0||C.inputTokens+C.outputTokens>0),O=T.some(C=>!C.priced),A=l||h,U=s_(o==null?void 0:o.fetchedAt,m),z=s_(c==null?void 0:c.fetchedAt,m),P=()=>{u(),p()},D=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"}),S&&g.jsx("span",{className:"up-rate",children:S}),g.jsxs("div",{className:"up-header-right",children:[(r.claude||r.codex)&&g.jsx("button",{type:"button",className:"btn up-refresh-btn",onClick:P,disabled:A,"aria-label":D,title:D,children:A?"…":"↻"}),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",U&&!l&&g.jsx("span",{className:"up-section-age",title:u3(o==null?void 0:o.source),children:U})]}),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}),z&&!h&&g.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:z})]}),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)),(B=c.extraWindows)==null?void 0:B.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:h3(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: ${Mt(d.window5h.totalTokens)} tokens · ${d.window5h.sessionCount} session${d.window5h.sessionCount!==1?"s":""}`:""}`,children:[Mt(d.window7d.totalTokens)," tokens · ",d.window7d.sessionCount," session",d.window7d.sessionCount!==1?"s":""," (7d)"]})]}),E>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:ze(N.total)}),g.jsx("span",{className:"up-total-label",children:"total spend"})]}),g.jsx(oy,{cost:N})]}),g.jsxs("div",{className:"up-tokens-row",children:[g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"in"}),Mt(_.in)]}),g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"out"}),Mt(_.out)]}),_.cacheR>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache r"}),Mt(_.cacheR)]}),_.cacheC>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache c"}),Mt(_.cacheC)]})]}),T.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:T.map(C=>g.jsxs("tr",{children:[g.jsx("td",{className:"up-model-name",title:C.model===Vd?"no model reported yet":C.model,children:C.model===Vd?"unknown":js(C.model)}),g.jsx("td",{className:"up-num",children:Mt(C.inputTokens+C.outputTokens)}),C.priced?g.jsx("td",{className:"up-num up-cost-val",children:ze(C.cost.total)}):g.jsx("td",{className:"up-num up-unpriced",children:hu})]},C.model))})]})]}),I.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:I.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:iy(C.state)}),g.jsx("span",{className:"up-session-label",children:C.label}),g.jsx("span",{className:"up-session-tokens",children:Mt(C.inputTokens+C.outputTokens)}),C.cost>0?g.jsxs("span",{className:"up-session-cost",title:C.unpricedTokens>0?`${Mt(C.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[ze(C.cost),C.unpricedTokens>0?"+":""]}):g.jsx("span",{className:"up-session-cost up-unpriced",children:hu})]},C.sessionId))})]}),O&&g.jsxs("div",{className:"up-hint",children:["“",hu,"” 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 i_=18,v3=1100,no=(e,n)=>{const r=Math.sin(e*12.9898+n*78.233)*43758.5453;return r-Math.floor(r)},y3=Array.from({length:i_},(e,n)=>{const r=-72+144*n/(i_-1)+(no(n,1)-.5)*9,i=(r-90)*(Math.PI/180),o=(54+32*Math.cos(r*Math.PI/180))*(.74+no(n,2)*.52);return{dx:Math.cos(i)*o,dy:Math.sin(i)*o,rot:(n%2?1:-1)*(100+no(n,3)*260),delay:Math.round(no(n,4)*90),dur:760+Math.round(no(n,5)*260),scale:.8+no(n,6)*.45,hue:n%4,round:n%3===0}});function o_({anchor:e,lifetimeMs:n=v3}){var l;const[r,i]=j.useState(null),o=typeof window<"u"&&((l=window.matchMedia)==null?void 0:l.call(window,"(prefers-reduced-motion: reduce)").matches);return j.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 h=window.setTimeout(()=>i(null),n);return()=>window.clearTimeout(h)},[e,n,o]),o||!r?null:ZI.createPortal(g.jsx("div",{className:"confetti",style:{left:`${r.x}px`,top:`${r.y}px`},"aria-hidden":!0,children:y3.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 qC=new Set(["awaiting_url","awaiting_code","registering"]);function w3(e){return e!=null&&qC.has(e)}function $C(e){return e!=null&&e!=="done"&&!qC.has(e)}const x3="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",_3="the sign-in did not complete";function b3({state:e,serverError:n,localError:r}){const i=e==="idle";return{title:i?"Sign-in ended":"Sign-in failed",message:r||n||(i?x3:_3)}}const S3="done";function k3(){let e=!1;return{shouldAnnounce(n){return n!==S3?(e=!1,!1):e?!1:(e=!0,!0)}}}const a_={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"},l_={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"},E3=`claude-swap could not read the login keychain — start ${Gt} from a Terminal window rather than a background service`;function Mv(e,n){return(e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(go(e))?E3:e!=null&&e.reason&&l_[e.reason]?l_[e.reason]:(e==null?void 0:e.reason)||n}function go(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const u_={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"},N3="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 C3(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const T3="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",R3="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",j3=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),A3=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,I3=/[\\/]_npx[\\/]/i,M3=`the copy of ccusage ${Gt} installed for itself`;function O3(e){const n=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return n.length>240?`${n.slice(0,239)}…`:n}function P3(e,n){const r=L3(e,n),i=O3(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 ${ua(r)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${ua(r)}`;case"managed":return`${M3} failed to run: ${ua(r)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${ua(r)}`:`the ccusage this deck found on your PATH failed to run: ${ua(r)}`;default:return r}}const ua=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function L3(e,n){const r=go(e);if(j3(r)){if(I3.test(r))return R3;if(A3.test(r))return T3}return C3(r)?N3:e!=null&&e.reason&&u_[e.reason]?u_[e.reason]:(e==null?void 0:e.reason)||n}function pu(e,n){return e!=null&&e.detail?e.detail:e!=null&&e.error&&$C(e.state)?e.error:e!=null&&e.reason&&a_[e.reason]?a_[e.reason]:e!=null&&e.error?e.error:(e==null?void 0:e.reason)||n}const q3=1500;async function ru(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Ov=ue.forwardRef((e,n)=>g.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:n,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"})]}));Ov.displayName="SuccessMark";function $3({onClose:e,onChanged:n}){const[r,i]=j.useState("login"),[o,l]=j.useState(null),[u,c]=j.useState(""),[h,p]=j.useState(""),[d,m]=j.useState(!1),[y,w]=j.useState(null),[N,_]=j.useState(null),S=j.useRef(!1),b=j.useRef(null),k=j.useRef(null),E=j.useRef(null),T=j.useRef(null),I=j.useCallback(()=>{S.current&&ru({action:"login-cancel"}).catch(()=>{}),e()},[e]),O=yo(I,{focusRef:E}),A=j.useCallback(async()=>{m(!0),w(null),S.current=!0;const $=await ru({action:"login"}).catch(()=>null);if(m(!1),!($!=null&&$.ok)){w(pu($,"could not start the sign-in"));return}l($)},[]);j.useEffect(()=>{if(!w3(o==null?void 0:o.state))return;const $=window.setInterval(async()=>{try{const L=await fetch("/api/claude-accounts/login");L.ok&&l(await L.json())}catch{}},q3);return()=>window.clearInterval($)},[o]);const U=j.useRef(n);U.current=n;const z=j.useRef(k3());j.useEffect(()=>{var $;(o==null?void 0:o.state)==="awaiting_code"&&(($=b.current)==null||$.focus()),z.current.shouldAnnounce(o==null?void 0:o.state)&&U.current()},[o==null?void 0:o.state]),j.useEffect(()=>{var $;r==="paste"&&(($=k.current)==null||$.focus())},[r]);const P=j.useCallback(async()=>{var L;m(!0),w(null);const $=await ru({action:"login-code",code:u}).catch(()=>null);if(m(!1),!($!=null&&$.ok)){w(pu($,"the code was not accepted")),$!=null&&$.state&&l($),(L=b.current)==null||L.select();return}c(""),l($)},[u,o]),D=j.useCallback(async()=>{m(!0),w(null);const $=await ru({action:"import",blob:h}).catch(()=>null);if(m(!1),!($!=null&&$.ok)){w(pu($,"the import failed"));return}p(""),_({added:$.added===!0,num:$.num??null,email:$.email??null}),n()},[h,n]),V=(o==null?void 0:o.state)==="done"?o.account:null,B=$C(o==null?void 0:o.state)||!!(y&&S.current&&!d),C=b3({state:o==null?void 0:o.state,serverError:o==null?void 0:o.error,localError:y});return g.jsx("div",{className:"modal-backdrop",onClick:I,role:"presentation",children:g.jsxs("div",{ref:O,className:"modal aa-modal",onClick:$=>$.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:I,"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(Ov,{ref:T}),g.jsx(o_,{anchor:T}),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:b,type:"text",value:u,onChange:$=>c($.target.value),onKeyDown:$=>{$.key==="Enter"&&u.trim()&&!d&&P()},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:P,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."})]})]}):B?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:()=>{S.current=!1,l(null),w(null),A()},children:"Try again"})]}):d||S.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:E,className:"btn primary",onClick:A,disabled:d,children:"Open the sign-in page"})})]}):N?g.jsxs("div",{className:"aa-done",children:[g.jsx(Ov,{ref:T}),N.added&&g.jsx(o_,{anchor:T}),g.jsx("h4",{children:N.added?`Account ${N.num} imported`:"Already here"}),g.jsx("p",{className:"aa-note",children:N.added?g.jsxs(g.Fragment,{children:[N.email?g.jsx("strong",{children:N.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:h,onChange:$=>p($.target.value),onKeyDown:$=>{$.key==="Enter"&&h.trim()&&!d&&D()},placeholder:"ccdeck1:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),g.jsx("button",{type:"button",className:"btn primary",disabled:d||!h.trim(),onClick:D,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 D3(e,n){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===n?"here":r.has(o)?"swap":"free";return{slot:o,kind:l,label:l==="here"?`slot ${o}`:`slot ${o} · ${l}`}})}function F3(e,n,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!==n;return{menuFor:e.menuFor===n?i:o&&e.menuFor===i?n:e.menuFor,confirmRemove:null,shareFor:null,swapNote:o?{at:i,displaced:n}:null}}const z3=64;function B3(e,n){const r=e.trim();return{alias:r,commit:r!==(n??"").trim()}}const U3=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function c_(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function H3(e){const n=e.find(i=>!i.ok);if(!n)return null;const r=go(n.body);return{text:Mv(n.body,`the deck server answered ${n.status}`),...r?{raw:r}:{},reload:!0}}function d_(e,n){return n?e!=null&&e.reload&&e.text===n.text&&e.raw===n.raw?e:n:e!=null&&e.reload?null:e}const f_=15e3,W3=8e3,V3=1800,G3=3e4,Y3=[70,80,85,90,95];function h_(e,n){return OC(n-Math.floor(e/1e3))}function K3(e,n){if(!e)return"";const r=Math.floor(e/1e3)-n;return r<=0?" · due":r<60?` · next in ${r}s`:` · next in ${Math.round(r/60)}m`}function X3(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 Q3({lane:e,nowSec:n}){const r=Math.min(100,Math.max(0,e.pct)),i=r>=90?"var(--err)":r>=70?"var(--warn)":"var(--accent)",o=e.resetAt?PC(e.resetAt,n):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 Z3(e){var r;let n=!1;try{n=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{n=!1}if(n)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(),n=document.execCommand("copy"),i.remove()}catch{n=!1}return n}function J3(e,n){const r=Math.round(e/1e3)-n;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 eq({onClose:e}){var ne,ae,fe;const[n,r]=j.useState(null),[i,o]=j.useState(null),[l,u]=j.useState(null),[c,h]=j.useState(!1),[p,d]=j.useState(null),[m,y]=j.useState(null),[w,N]=j.useState(()=>Math.floor(Date.now()/1e3)),_=j.useRef(null),[S,b]=j.useState(null),[k,E]=j.useState(!1),[T,I]=j.useState(""),[O,A]=j.useState(null),[U,z]=j.useState(null),[P,D]=j.useState(null),[V,B]=j.useState(!1),[C,$]=j.useState(null),L=j.useCallback(async(te=!1)=>{te&&h(!0);const ce=new AbortController,Ce=window.setTimeout(()=>ce.abort(),G3);try{const[ve,je]=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()),je.ok&&o(await je.json());const ye=H3([await c_(ve),await c_(je)]);y(Ee=>d_(Ee,ye))}catch{y(ve=>d_(ve,U3))}finally{window.clearTimeout(Ce),te&&h(!1)}},[]),re=j.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:Mv(ve,"command failed"),raw:go(ve)}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]),J=j.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:pu(ve,"command failed")}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]);j.useEffect(()=>(L(!0),_.current=window.setInterval(()=>L(!1),f_),()=>{_.current!=null&&window.clearInterval(_.current)}),[L]),j.useEffect(()=>{const te=window.setInterval(()=>N(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=n==null?void 0:n.accounts)==null?void 0:ae.find(te=>te.active),M=Z!=null&&Z.lanes.length?Math.max(...Z.lanes.map(te=>te.pct)):null,G=M!=null&&M>=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:Mv(Ce,"the switch failed"),raw:go(Ce)}),await L(!0)}catch{y({text:"server unreachable"})}finally{d(null)}},q=async(te,ce)=>{const{commit:Ce,alias:ve}=B3(T,ce);if(Ce){const je=await J({action:"alias",account:te,alias:ve},`alias-${te}`);if(await L(!0),!(je!=null&&je.ok))return;I(ve)}A(te),window.setTimeout(()=>A(je=>je===te?null:je),V3)},Q=async(te,ce)=>{const Ce=await J({action:"move",account:te,slot:ce},`move-${te}`),ve=F3({menuFor:S,shareFor:(P==null?void 0:P.num)??null},te,Ce);if(await L(!0),ve){b(ve.menuFor),z(ve.confirmRemove),ve.shareFor==null&&(D(null),B(!1)),$(ve.swapNote);const je=ve.swapNote;je&&window.setTimeout(()=>$(ye=>ye===je?null:ye),W3)}};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:()=>E(!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:()=>L(!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:"×"})]})]}),n==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 ",f_/1e3," seconds."]}),g.jsx("button",{type:"button",className:"ap-fix",disabled:c,onClick:()=>L(!0),children:c?"trying…":"try again"})]}):g.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?g.jsxs(g.Fragment,{children:[(fe=n.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${S===te.num?" on":""}`,"aria-label":`Manage account ${te.num}`,"aria-expanded":S===te.num,"aria-controls":S===te.num?`ap-manage-${te.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{b(S===te.num?null:te.num),I(te.alias??""),z(null),D(null),B(!1),$(null),A(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(Q3,{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=X3(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:()=>E(!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(()=>L(!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 ",h_(te.fetchedAt,w),K3(te.nextAt,w)]}):g.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),S===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:T,onChange:ce=>I(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"&&q(te.num,te.alias)},maxLength:z3,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:O===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:D3((n.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()=>{B(!1);const ce=await J({action:"share",account:te.num},`share-${te.num}`);ce!=null&&ce.ok&&D({num:te.num,blob:ce.blob,expiresAt:ce.expiresAt})},children:"share"}),g.jsx("button",{type:"button",className:`ap-manage-btn danger${U===te.num?" armed":""}`,disabled:l!=null,title:U===te.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(U!==te.num){z(te.num),window.setTimeout(()=>z(ce=>ce===te.num?null:ce),4e3);return}z(null),J({action:"remove",account:te.num},`rm-${te.num}`).then(()=>{b(null),L(!0)})},children:U===te.num?"confirm":"remove"})]}),(C==null?void 0:C.at)===te.num&&(()=>{var ve;const ce=(ve=n.accounts)==null?void 0:ve.find(je=>je.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]})})(),(P==null?void 0:P.num)===te.num&&(()=>{const ce=J3(P.expiresAt,w),Ce=ce.tone==="gone";return g.jsxs("div",{className:`ap-share${Ce?" expired":""}`,children:[g.jsx("code",{className:"ap-share-blob",children:P.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){B(!1);const ve=await J({action:"share",account:te.num},`share-${te.num}`);ve!=null&&ve.ok&&D({num:te.num,blob:ve.blob,expiresAt:ve.expiresAt});return}await Z3(P.blob)&&(B(!0),window.setTimeout(()=>B(!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:[M!=null&&g.jsxs("span",{className:`ap-auto-now${G?" near":""}`,children:[Math.round(M),"%"]}),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(()=>L(!0)),children:Y3.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(()=>L(!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 ",h_(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:n.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."}),n.hint&&g.jsx("code",{className:"ap-cmd",children:n.hint}),g.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",g.jsx("strong",{children:"+"})," button above."]})]}):n.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",n.reason?` (${n.reason})`:"","."]})]})}),k&&g.jsx($3,{onClose:()=>E(!1),onChanged:()=>L(!0)})]})}const tq=3e4;function nq({bundle:e,running:n,lastTried:r}){return!n||e===n?!1:r!==n}function rq({bundle:e,running:n,pending:r,lastTried:i}){return n?nq({bundle:e,running:n,lastTried:i})?"reload":r==null||r&&r!==n?"wait":"confirm":"wait"}function sq(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function iq({asked:e,reported:n}){return n?n!==e:!1}function oq(e){const n=e.thresholdMs??tq;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>=n}}function aq({agentCount:e,onConfirm:n,onCancel:r}){const i=j.useRef(null),o=yo(r,{focusRef:i,layer:FP}),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:n,children:"Clear everything"})]})]})]})})}function lq(e,n){return e==="confirmation"?n.confirmOpen?"clear":"ignore":n.modalOpen||n.confirmOpen?"ignore":"confirm"}function uq(e){return e.slice().sort((n,r)=>n.y-r.y||n.x-r.x)}function cq(e,n,r){var u;if(e.length===0)return null;const i=uq(e),o=n?i.findIndex(c=>c.id===n):-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 dq=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function fq(e,n){return n==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:n,additive:e.shiftKey}:dq.has(e.key)?{kind:"node",nodeId:n}:{kind:"deck",nodeId:n}}const hq=new Set(["","BODY","HTML","#DOCUMENT"]);function pq(e){return!e||sy(e)?!1:!hq.has(String(e.tagName??"").toUpperCase())}function su(e,n){if(n.size!==0)for(const r of Array.from(e.keys()))n.has(r)||e.delete(r)}function mq(e){const n=new Set;for(const r of e)n.add(r.id),n.add(`group:${r.sessionId}`);return n}function DC(e,n,r){return!n.has(e)||r.has(e)}function gq(e,n,r,i){return!n.has(e)&&DC(e,r,i)}function vq(e,n,r){const i={x:0,y:0};return n.set(e,i),r.add(e),i}function yq(e,n,r,i){r.set(e,n),i.delete(e)}const wq=40,xq=120;function _q(e,n){let r=null,i=0,o=Number.NEGATIVE_INFINITY;const l=()=>{r=null,o=n.now(),e()},u=()=>{r!=null&&(n.clearTimeout(r),r=null)},c=(h,p,d)=>{if(r!=null){if(i<=h)return;u()}const m=Math.min(d,Math.max(0,h-p));i=h,r=n.setTimeout(l,m)};return{live(h=wq){const p=n.now(),d=Math.max(o+h,p);if(d<=p){u(),l();return}c(d,p,h)},replay(h=xq){u(),i=n.now()+h,r=n.setTimeout(l,h)},flush(){u(),l()},cancel(){u()}}}function bq(){let e=!1,n=[];return{get paused(){return e},get size(){return n.length},accept(r){return e?(n.push(r),!1):!0},setPaused(r){if(e=r,r||n.length===0)return[];const i=n;return n=[],i}}}const Sq="1",p_="agent-dag.schema",kq=["agent-dag.layout","agent-dag.viewport"];function FC(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function Eq(e,n=Sq){let r=null;try{r=e.getItem(p_)}catch{return[]}if(r===n)return[];const i=[];if(r!==null)for(const o of kq)try{e.getItem(o)!==null&&(e.removeItem(o),i.push(o))}catch{}try{e.setItem(p_,n)}catch{}return i}const zC="agent-dag.theme";function Nq(e){return e==="light"?"light":"dark"}function Cq(){return Nq(FC(zC))}function Tq({waiting:e,running:n}){return{title:e>0?`(${e}) ${Gt}`:Gt,icon:e>0?"waiting":n>0?"running":"idle"}}const Gd={waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Yd(e,n){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${n==="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"/>`+(n==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const Rq=Object.freeze({waiting:`data:image/svg+xml,${encodeURIComponent(Yd(Gd.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Yd(Gd.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Yd(Gd.idle,"idle"))}`}),jq="No sessions are waiting for you.";function Aq(e){if(e.length===0)return"";const[n,...r]=e;if(r.length===0)return`${n.label} is waiting for your permission.`;const i=`${r.length} more session${r.length===1?"":"s"}`;return`${n.label} and ${i} are waiting for your permission.`}function Iq(e,n){return n!==""?n:e===""?"":jq}function Mq(){let e=0;return{begin(){const n=++e;return()=>n===e},cancel(){e++}}}function Oq(e,n=new Date){return new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}function Pq(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 iu(e){const n=e.toLowerCase();return n.includes("opus")?"#c4b5fd":n.includes("sonnet")?"#7dd3fc":n.includes("haiku")?"#86efac":n.includes("gpt-5")||n.includes("gpt5")?"#fcd34d":n.includes("gpt")?"#fca5a5":n.includes("gemini")?"#a5b4fc":n.includes("codex")?"#fdba74":"#94a3b8"}const Lq=[7,14,30,90];function qq(e){const[n,r]=j.useState(null),[i,o]=j.useState(!1),l=j.useRef(Mq()).current,u=(c=!1)=>{const h=l.begin(),p=e;o(!0);const m=`/api/ccusage?since=${Oq(p)}${c?"&refresh=1":""}`;fetch(m).then(y=>y.json()).then(y=>{h()&&r({range:p,resp:y})}).catch(()=>{h()&&r({range:p,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{h()&&o(!1)})};return j.useEffect(()=>(u(!1),()=>l.cancel()),[e]),{landed:n,loading:i,reload:()=>u(!0)}}function $q({onClose:e}){var T,I,O;const[n,r]=j.useState(30),[i,o]=j.useState(null),{landed:l,loading:u,reload:c}=qq(n),h=j.useRef(null),p=yo(e,{focusRef:h}),d=Pq({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((T=l.resp.days)==null?void 0:T.length)??0}}),m=d.phase==="chart"?l.resp.days??[]:[],y=j.useMemo(()=>m.reduce((A,U)=>Math.max(A,U.totalCost),0),[m]),{totalCost:w,totalTok:N,inOut:_,cacheRead:S,modelCosts:b}=j.useMemo(()=>{let A=0,U=0,z=0,P=0;const D=new Map;for(const V of m){A+=V.totalCost,U+=V.totalTokens,z+=V.inputTokens+V.outputTokens,P+=V.cacheReadTokens;for(const B of V.modelBreakdowns)D.set(B.modelName,(D.get(B.modelName)??0)+B.cost)}return{totalCost:A,totalTok:U,inOut:z,cacheRead:P,modelCosts:D}},[m]),k=j.useMemo(()=>Array.from(b.entries()).sort((A,U)=>U[1]-A[1]),[b]),E=i?m.find(A=>A.period===i)??null:null;return g.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:g.jsxs("div",{ref:p,className:"uh-modal",onClick:A=>A.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:"via ccusage · local Claude / Codex logs"})]}),g.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:Lq.map(A=>g.jsxs("button",{type:"button","aria-pressed":n===A,className:`uh-range-btn${n===A?" on":""}`,onClick:()=>{r(A),o(null)},children:[A,"d"]},A))}),g.jsx("button",{className:"btn icon-btn uh-reload",onClick:c,disabled:u,title:"Re-run ccusage","aria-label":"Reload",children:u?"…":"↻"}),g.jsx("button",{ref:h,className:"uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),d.phase==="busy"?g.jsx("div",{className:"uh-status","aria-busy":"true",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}):d.phase==="error"?g.jsxs("div",{className:"uh-status uh-err",title:go(l.resp)||void 0,children:[P3(l.resp,"ccusage did not report usage"),g.jsx("div",{children:g.jsx("button",{className:"btn uh-retry",onClick:c,disabled:u,children:u?"trying…":"Try again"})})]}):d.phase==="empty"?g.jsx("div",{className:`uh-status${d.stale?" uh-stale":""}`,"aria-busy":d.stale||void 0,children:"no usage in this range"}):g.jsxs("div",{className:d.stale?"uh-stale":void 0,"aria-busy":d.stale||void 0,children:[g.jsxs("div",{className:"uh-totals",children:[g.jsx(ou,{label:"total cost",val:ze(w),accent:!0}),g.jsx(ou,{label:"tokens",val:Mt(N)}),g.jsx(ou,{label:"input+output",val:Mt(_)}),g.jsx(ou,{label:"cache reads",val:Mt(S)})]}),g.jsx("div",{className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:m.map(A=>{const U=y>0?A.totalCost/y*100:0,z=A.period===i,P=`${A.period}, ${ze(A.totalCost)}`;return g.jsxs("button",{className:`uh-bar-col${z?" sel":""}`,onClick:()=>o(z?null:A.period),"aria-pressed":z,"aria-label":P,title:`${A.period} · ${ze(A.totalCost)}`,style:{flexBasis:`${100/m.length}%`},children:[g.jsx("div",{className:"uh-bar",style:{height:`${Math.max(U,A.totalCost>0?2:0)}%`},children:A.modelBreakdowns.slice().sort((D,V)=>V.cost-D.cost).map(D=>{const V=A.totalCost>0?D.cost/A.totalCost*100:0;return g.jsx("div",{className:"uh-bar-seg",style:{height:`${V}%`,background:iu(D.modelName)}},D.modelName)})}),g.jsx("span",{className:"uh-bar-label",children:A.period.slice(5)})]},A.period)})}),g.jsx("div",{className:"uh-legend",children:k.map(([A,U])=>g.jsxs("span",{className:"uh-legend-item",title:A,children:[g.jsx("span",{className:"uh-legend-dot",style:{background:iu(A)}}),js(A)," ",g.jsx("span",{className:"uh-legend-cost",children:ze(U)})]},A))}),E&&g.jsxs("div",{className:"uh-detail",children:[g.jsxs("div",{className:"uh-detail-head",children:[g.jsx("span",{className:"uh-detail-date",children:E.period}),g.jsx("span",{className:"uh-detail-cost",children:ze(E.totalCost)}),(O=(I=E.metadata)==null?void 0:I.agents)!=null&&O.length?g.jsx("span",{className:"uh-detail-agents",children:E.metadata.agents.join(" · ")}):null]}),g.jsxs("div",{className:"uh-detail-mini",children:[g.jsx(au,{label:"input",val:Mt(E.inputTokens)}),g.jsx(au,{label:"output",val:Mt(E.outputTokens)}),g.jsx(au,{label:"cache write",val:Mt(E.cacheCreationTokens)}),g.jsx(au,{label:"cache read",val:Mt(E.cacheReadTokens)})]}),g.jsx("div",{className:"uh-detail-models",children:E.modelBreakdowns.slice().sort((A,U)=>U.cost-A.cost).map(A=>{const U=E.totalCost>0?A.cost/E.totalCost*100:0;return g.jsxs("div",{className:"uh-model-row",title:A.modelName,children:[g.jsxs("span",{className:"uh-model-name",children:[g.jsx("span",{className:"uh-legend-dot",style:{background:iu(A.modelName)}}),g.jsx("span",{className:"uh-model-label",children:js(A.modelName)})]}),g.jsx("span",{className:"uh-model-bar",children:g.jsx("span",{className:"uh-model-bar-fill",style:{width:`${U}%`,background:iu(A.modelName)}})}),g.jsx("span",{className:"uh-model-cost",children:ze(A.cost)})]},A.modelName)})})]})]})]})})}function ou({label:e,val:n,accent:r}){return g.jsxs("div",{className:"uh-stat",children:[g.jsx("span",{className:`uh-stat-val${r?" accent":""}`,children:n}),g.jsx("span",{className:"uh-stat-label",children:e})]})}function au({label:e,val:n}){return g.jsxs("div",{className:"uh-ministat",children:[g.jsx("span",{className:"uh-ministat-val",children:n}),g.jsx("span",{className:"uh-ministat-label",children:e})]})}function ly(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 Kd,m_;function Dq(){if(m_)return Kd;m_=1;function e(){this.__data__=[],this.size=0}return Kd=e,Kd}var Xd,g_;function wo(){if(g_)return Xd;g_=1;function e(n,r){return n===r||n!==n&&r!==r}return Xd=e,Xd}var Qd,v_;function $u(){if(v_)return Qd;v_=1;var e=wo();function n(r,i){for(var o=r.length;o--;)if(e(r[o][0],i))return o;return-1}return Qd=n,Qd}var Zd,y_;function Fq(){if(y_)return Zd;y_=1;var e=$u(),n=Array.prototype,r=n.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 Zd=i,Zd}var Jd,w_;function zq(){if(w_)return Jd;w_=1;var e=$u();function n(r){var i=this.__data__,o=e(i,r);return o<0?void 0:i[o][1]}return Jd=n,Jd}var ef,x_;function Bq(){if(x_)return ef;x_=1;var e=$u();function n(r){return e(this.__data__,r)>-1}return ef=n,ef}var tf,__;function Uq(){if(__)return tf;__=1;var e=$u();function n(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 tf=n,tf}var nf,b_;function Du(){if(b_)return nf;b_=1;var e=Dq(),n=Fq(),r=zq(),i=Bq(),o=Uq();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,nf=l,nf}var rf,S_;function Hq(){if(S_)return rf;S_=1;var e=Du();function n(){this.__data__=new e,this.size=0}return rf=n,rf}var sf,k_;function Wq(){if(k_)return sf;k_=1;function e(n){var r=this.__data__,i=r.delete(n);return this.size=r.size,i}return sf=e,sf}var of,E_;function Vq(){if(E_)return of;E_=1;function e(n){return this.__data__.get(n)}return of=e,of}var af,N_;function Gq(){if(N_)return af;N_=1;function e(n){return this.__data__.has(n)}return af=e,af}var lf,C_;function BC(){if(C_)return lf;C_=1;var e=typeof Hl=="object"&&Hl&&Hl.Object===Object&&Hl;return lf=e,lf}var uf,T_;function rr(){if(T_)return uf;T_=1;var e=BC(),n=typeof self=="object"&&self&&self.Object===Object&&self,r=e||n||Function("return this")();return uf=r,uf}var cf,R_;function xo(){if(R_)return cf;R_=1;var e=rr(),n=e.Symbol;return cf=n,cf}var df,j_;function Yq(){if(j_)return df;j_=1;var e=xo(),n=Object.prototype,r=n.hasOwnProperty,i=n.toString,o=e?e.toStringTag:void 0;function l(u){var c=r.call(u,o),h=u[o];try{u[o]=void 0;var p=!0}catch{}var d=i.call(u);return p&&(c?u[o]=h:delete u[o]),d}return df=l,df}var ff,A_;function Kq(){if(A_)return ff;A_=1;var e=Object.prototype,n=e.toString;function r(i){return n.call(i)}return ff=r,ff}var hf,I_;function gi(){if(I_)return hf;I_=1;var e=xo(),n=Yq(),r=Kq(),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)?n(c):r(c)}return hf=u,hf}var pf,M_;function $n(){if(M_)return pf;M_=1;function e(n){var r=typeof n;return n!=null&&(r=="object"||r=="function")}return pf=e,pf}var mf,O_;function Oa(){if(O_)return mf;O_=1;var e=gi(),n=$n(),r="[object AsyncFunction]",i="[object Function]",o="[object GeneratorFunction]",l="[object Proxy]";function u(c){if(!n(c))return!1;var h=e(c);return h==i||h==o||h==r||h==l}return mf=u,mf}var gf,P_;function Xq(){if(P_)return gf;P_=1;var e=rr(),n=e["__core-js_shared__"];return gf=n,gf}var vf,L_;function Qq(){if(L_)return vf;L_=1;var e=Xq(),n=(function(){var i=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function r(i){return!!n&&n in i}return vf=r,vf}var yf,q_;function UC(){if(q_)return yf;q_=1;var e=Function.prototype,n=e.toString;function r(i){if(i!=null){try{return n.call(i)}catch{}try{return i+""}catch{}}return""}return yf=r,yf}var wf,$_;function Zq(){if($_)return wf;$_=1;var e=Oa(),n=Qq(),r=$n(),i=UC(),o=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,h=u.toString,p=c.hasOwnProperty,d=RegExp("^"+h.call(p).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!r(y)||n(y))return!1;var w=e(y)?d:l;return w.test(i(y))}return wf=m,wf}var xf,D_;function Jq(){if(D_)return xf;D_=1;function e(n,r){return n==null?void 0:n[r]}return xf=e,xf}var _f,F_;function vi(){if(F_)return _f;F_=1;var e=Zq(),n=Jq();function r(i,o){var l=n(i,o);return e(l)?l:void 0}return _f=r,_f}var bf,z_;function uy(){if(z_)return bf;z_=1;var e=vi(),n=rr(),r=e(n,"Map");return bf=r,bf}var Sf,B_;function Fu(){if(B_)return Sf;B_=1;var e=vi(),n=e(Object,"create");return Sf=n,Sf}var kf,U_;function e$(){if(U_)return kf;U_=1;var e=Fu();function n(){this.__data__=e?e(null):{},this.size=0}return kf=n,kf}var Ef,H_;function t$(){if(H_)return Ef;H_=1;function e(n){var r=this.has(n)&&delete this.__data__[n];return this.size-=r?1:0,r}return Ef=e,Ef}var Nf,W_;function n$(){if(W_)return Nf;W_=1;var e=Fu(),n="__lodash_hash_undefined__",r=Object.prototype,i=r.hasOwnProperty;function o(l){var u=this.__data__;if(e){var c=u[l];return c===n?void 0:c}return i.call(u,l)?u[l]:void 0}return Nf=o,Nf}var Cf,V_;function r$(){if(V_)return Cf;V_=1;var e=Fu(),n=Object.prototype,r=n.hasOwnProperty;function i(o){var l=this.__data__;return e?l[o]!==void 0:r.call(l,o)}return Cf=i,Cf}var Tf,G_;function s$(){if(G_)return Tf;G_=1;var e=Fu(),n="__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?n:o,this}return Tf=r,Tf}var Rf,Y_;function i$(){if(Y_)return Rf;Y_=1;var e=e$(),n=t$(),r=n$(),i=r$(),o=s$();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Rf=l,Rf}var jf,K_;function o$(){if(K_)return jf;K_=1;var e=i$(),n=Du(),r=uy();function i(){this.size=0,this.__data__={hash:new e,map:new(r||n),string:new e}}return jf=i,jf}var Af,X_;function a$(){if(X_)return Af;X_=1;function e(n){var r=typeof n;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?n!=="__proto__":n===null}return Af=e,Af}var If,Q_;function zu(){if(Q_)return If;Q_=1;var e=a$();function n(r,i){var o=r.__data__;return e(i)?o[typeof i=="string"?"string":"hash"]:o.map}return If=n,If}var Mf,Z_;function l$(){if(Z_)return Mf;Z_=1;var e=zu();function n(r){var i=e(this,r).delete(r);return this.size-=i?1:0,i}return Mf=n,Mf}var Of,J_;function u$(){if(J_)return Of;J_=1;var e=zu();function n(r){return e(this,r).get(r)}return Of=n,Of}var Pf,e1;function c$(){if(e1)return Pf;e1=1;var e=zu();function n(r){return e(this,r).has(r)}return Pf=n,Pf}var Lf,t1;function d$(){if(t1)return Lf;t1=1;var e=zu();function n(r,i){var o=e(this,r),l=o.size;return o.set(r,i),this.size+=o.size==l?0:1,this}return Lf=n,Lf}var qf,n1;function cy(){if(n1)return qf;n1=1;var e=o$(),n=l$(),r=u$(),i=c$(),o=d$();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,qf=l,qf}var $f,r1;function f$(){if(r1)return $f;r1=1;var e=Du(),n=uy(),r=cy(),i=200;function o(l,u){var c=this.__data__;if(c instanceof e){var h=c.__data__;if(!n||h.length<i-1)return h.push([l,u]),this.size=++c.size,this;c=this.__data__=new r(h)}return c.set(l,u),this.size=c.size,this}return $f=o,$f}var Df,s1;function Bu(){if(s1)return Df;s1=1;var e=Du(),n=Hq(),r=Wq(),i=Vq(),o=Gq(),l=f$();function u(c){var h=this.__data__=new e(c);this.size=h.size}return u.prototype.clear=n,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=l,Df=u,Df}var Ff,i1;function dy(){if(i1)return Ff;i1=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o&&r(n[i],i,n)!==!1;);return n}return Ff=e,Ff}var zf,o1;function HC(){if(o1)return zf;o1=1;var e=vi(),n=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return zf=n,zf}var Bf,a1;function Uu(){if(a1)return Bf;a1=1;var e=HC();function n(r,i,o){i=="__proto__"&&e?e(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[i]=o}return Bf=n,Bf}var Uf,l1;function Hu(){if(l1)return Uf;l1=1;var e=Uu(),n=wo(),r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c){var h=l[u];(!(i.call(l,u)&&n(h,c))||c===void 0&&!(u in l))&&e(l,u,c)}return Uf=o,Uf}var Hf,u1;function Pa(){if(u1)return Hf;u1=1;var e=Hu(),n=Uu();function r(i,o,l,u){var c=!l;l||(l={});for(var h=-1,p=o.length;++h<p;){var d=o[h],m=u?u(l[d],i[d],d,l,i):void 0;m===void 0&&(m=i[d]),c?n(l,d,m):e(l,d,m)}return l}return Hf=r,Hf}var Wf,c1;function h$(){if(c1)return Wf;c1=1;function e(n,r){for(var i=-1,o=Array(n);++i<n;)o[i]=r(i);return o}return Wf=e,Wf}var Vf,d1;function mr(){if(d1)return Vf;d1=1;function e(n){return n!=null&&typeof n=="object"}return Vf=e,Vf}var Gf,f1;function p$(){if(f1)return Gf;f1=1;var e=gi(),n=mr(),r="[object Arguments]";function i(o){return n(o)&&e(o)==r}return Gf=i,Gf}var Yf,h1;function La(){if(h1)return Yf;h1=1;var e=p$(),n=mr(),r=Object.prototype,i=r.hasOwnProperty,o=r.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(u){return n(u)&&i.call(u,"callee")&&!o.call(u,"callee")};return Yf=l,Yf}var Kf,p1;function _t(){if(p1)return Kf;p1=1;var e=Array.isArray;return Kf=e,Kf}var ha={exports:{}},Xf,m1;function m$(){if(m1)return Xf;m1=1;function e(){return!1}return Xf=e,Xf}ha.exports;var g1;function _o(){return g1||(g1=1,(function(e,n){var r=rr(),i=m$(),o=n&&!n.nodeType&&n,l=o&&!0&&e&&!e.nodeType&&e,u=l&&l.exports===o,c=u?r.Buffer:void 0,h=c?c.isBuffer:void 0,p=h||i;e.exports=p})(ha,ha.exports)),ha.exports}var Qf,v1;function Wu(){if(v1)return Qf;v1=1;var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function r(i,o){var l=typeof i;return o=o??e,!!o&&(l=="number"||l!="symbol"&&n.test(i))&&i>-1&&i%1==0&&i<o}return Qf=r,Qf}var Zf,y1;function fy(){if(y1)return Zf;y1=1;var e=9007199254740991;function n(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Zf=n,Zf}var Jf,w1;function g$(){if(w1)return Jf;w1=1;var e=gi(),n=fy(),r=mr(),i="[object Arguments]",o="[object Array]",l="[object Boolean]",u="[object Date]",c="[object Error]",h="[object Function]",p="[object Map]",d="[object Number]",m="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",_="[object WeakMap]",S="[object ArrayBuffer]",b="[object DataView]",k="[object Float32Array]",E="[object Float64Array]",T="[object Int8Array]",I="[object Int16Array]",O="[object Int32Array]",A="[object Uint8Array]",U="[object Uint8ClampedArray]",z="[object Uint16Array]",P="[object Uint32Array]",D={};D[k]=D[E]=D[T]=D[I]=D[O]=D[A]=D[U]=D[z]=D[P]=!0,D[i]=D[o]=D[S]=D[l]=D[b]=D[u]=D[c]=D[h]=D[p]=D[d]=D[m]=D[y]=D[w]=D[N]=D[_]=!1;function V(B){return r(B)&&n(B.length)&&!!D[e(B)]}return Jf=V,Jf}var eh,x1;function Vu(){if(x1)return eh;x1=1;function e(n){return function(r){return n(r)}}return eh=e,eh}var pa={exports:{}};pa.exports;var _1;function hy(){return _1||(_1=1,(function(e,n){var r=BC(),i=n&&!n.nodeType&&n,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l&&r.process,c=(function(){try{var h=o&&o.require&&o.require("util").types;return h||u&&u.binding&&u.binding("util")}catch{}})();e.exports=c})(pa,pa.exports)),pa.exports}var th,b1;function qa(){if(b1)return th;b1=1;var e=g$(),n=Vu(),r=hy(),i=r&&r.isTypedArray,o=i?n(i):e;return th=o,th}var nh,S1;function WC(){if(S1)return nh;S1=1;var e=h$(),n=La(),r=_t(),i=_o(),o=Wu(),l=qa(),u=Object.prototype,c=u.hasOwnProperty;function h(p,d){var m=r(p),y=!m&&n(p),w=!m&&!y&&i(p),N=!m&&!y&&!w&&l(p),_=m||y||w||N,S=_?e(p.length,String):[],b=S.length;for(var k in p)(d||c.call(p,k))&&!(_&&(k=="length"||w&&(k=="offset"||k=="parent")||N&&(k=="buffer"||k=="byteLength"||k=="byteOffset")||o(k,b)))&&S.push(k);return S}return nh=h,nh}var rh,k1;function Gu(){if(k1)return rh;k1=1;var e=Object.prototype;function n(r){var i=r&&r.constructor,o=typeof i=="function"&&i.prototype||e;return r===o}return rh=n,rh}var sh,E1;function VC(){if(E1)return sh;E1=1;function e(n,r){return function(i){return n(r(i))}}return sh=e,sh}var ih,N1;function v$(){if(N1)return ih;N1=1;var e=VC(),n=e(Object.keys,Object);return ih=n,ih}var oh,C1;function py(){if(C1)return oh;C1=1;var e=Gu(),n=v$(),r=Object.prototype,i=r.hasOwnProperty;function o(l){if(!e(l))return n(l);var u=[];for(var c in Object(l))i.call(l,c)&&c!="constructor"&&u.push(c);return u}return oh=o,oh}var ah,T1;function Br(){if(T1)return ah;T1=1;var e=Oa(),n=fy();function r(i){return i!=null&&n(i.length)&&!e(i)}return ah=r,ah}var lh,R1;function As(){if(R1)return lh;R1=1;var e=WC(),n=py(),r=Br();function i(o){return r(o)?e(o):n(o)}return lh=i,lh}var uh,j1;function y$(){if(j1)return uh;j1=1;var e=Pa(),n=As();function r(i,o){return i&&e(o,n(o),i)}return uh=r,uh}var ch,A1;function w$(){if(A1)return ch;A1=1;function e(n){var r=[];if(n!=null)for(var i in Object(n))r.push(i);return r}return ch=e,ch}var dh,I1;function x$(){if(I1)return dh;I1=1;var e=$n(),n=Gu(),r=w$(),i=Object.prototype,o=i.hasOwnProperty;function l(u){if(!e(u))return r(u);var c=n(u),h=[];for(var p in u)p=="constructor"&&(c||!o.call(u,p))||h.push(p);return h}return dh=l,dh}var fh,M1;function yi(){if(M1)return fh;M1=1;var e=WC(),n=x$(),r=Br();function i(o){return r(o)?e(o,!0):n(o)}return fh=i,fh}var hh,O1;function _$(){if(O1)return hh;O1=1;var e=Pa(),n=yi();function r(i,o){return i&&e(o,n(o),i)}return hh=r,hh}var ma={exports:{}};ma.exports;var P1;function GC(){return P1||(P1=1,(function(e,n){var r=rr(),i=n&&!n.nodeType&&n,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 h(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=h})(ma,ma.exports)),ma.exports}var ph,L1;function YC(){if(L1)return ph;L1=1;function e(n,r){var i=-1,o=n.length;for(r||(r=Array(o));++i<o;)r[i]=n[i];return r}return ph=e,ph}var mh,q1;function KC(){if(q1)return mh;q1=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=0,u=[];++i<o;){var c=n[i];r(c,i,n)&&(u[l++]=c)}return u}return mh=e,mh}var gh,$1;function XC(){if($1)return gh;$1=1;function e(){return[]}return gh=e,gh}var vh,D1;function my(){if(D1)return vh;D1=1;var e=KC(),n=XC(),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)}))}:n;return vh=l,vh}var yh,F1;function b$(){if(F1)return yh;F1=1;var e=Pa(),n=my();function r(i,o){return e(i,n(i),o)}return yh=r,yh}var wh,z1;function gy(){if(z1)return wh;z1=1;function e(n,r){for(var i=-1,o=r.length,l=n.length;++i<o;)n[l+i]=r[i];return n}return wh=e,wh}var xh,B1;function Yu(){if(B1)return xh;B1=1;var e=VC(),n=e(Object.getPrototypeOf,Object);return xh=n,xh}var _h,U1;function QC(){if(U1)return _h;U1=1;var e=gy(),n=Yu(),r=my(),i=XC(),o=Object.getOwnPropertySymbols,l=o?function(u){for(var c=[];u;)e(c,r(u)),u=n(u);return c}:i;return _h=l,_h}var bh,H1;function S$(){if(H1)return bh;H1=1;var e=Pa(),n=QC();function r(i,o){return e(i,n(i),o)}return bh=r,bh}var Sh,W1;function ZC(){if(W1)return Sh;W1=1;var e=gy(),n=_t();function r(i,o,l){var u=o(i);return n(i)?u:e(u,l(i))}return Sh=r,Sh}var kh,V1;function JC(){if(V1)return kh;V1=1;var e=ZC(),n=my(),r=As();function i(o){return e(o,r,n)}return kh=i,kh}var Eh,G1;function k$(){if(G1)return Eh;G1=1;var e=ZC(),n=QC(),r=yi();function i(o){return e(o,r,n)}return Eh=i,Eh}var Nh,Y1;function E$(){if(Y1)return Nh;Y1=1;var e=vi(),n=rr(),r=e(n,"DataView");return Nh=r,Nh}var Ch,K1;function N$(){if(K1)return Ch;K1=1;var e=vi(),n=rr(),r=e(n,"Promise");return Ch=r,Ch}var Th,X1;function eT(){if(X1)return Th;X1=1;var e=vi(),n=rr(),r=e(n,"Set");return Th=r,Th}var Rh,Q1;function C$(){if(Q1)return Rh;Q1=1;var e=vi(),n=rr(),r=e(n,"WeakMap");return Rh=r,Rh}var jh,Z1;function bo(){if(Z1)return jh;Z1=1;var e=E$(),n=uy(),r=N$(),i=eT(),o=C$(),l=gi(),u=UC(),c="[object Map]",h="[object Object]",p="[object Promise]",d="[object Set]",m="[object WeakMap]",y="[object DataView]",w=u(e),N=u(n),_=u(r),S=u(i),b=u(o),k=l;return(e&&k(new e(new ArrayBuffer(1)))!=y||n&&k(new n)!=c||r&&k(r.resolve())!=p||i&&k(new i)!=d||o&&k(new o)!=m)&&(k=function(E){var T=l(E),I=T==h?E.constructor:void 0,O=I?u(I):"";if(O)switch(O){case w:return y;case N:return c;case _:return p;case S:return d;case b:return m}return T}),jh=k,jh}var Ah,J1;function T$(){if(J1)return Ah;J1=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i){var o=i.length,l=new i.constructor(o);return o&&typeof i[0]=="string"&&n.call(i,"index")&&(l.index=i.index,l.input=i.input),l}return Ah=r,Ah}var Ih,eb;function tT(){if(eb)return Ih;eb=1;var e=rr(),n=e.Uint8Array;return Ih=n,Ih}var Mh,tb;function vy(){if(tb)return Mh;tb=1;var e=tT();function n(r){var i=new r.constructor(r.byteLength);return new e(i).set(new e(r)),i}return Mh=n,Mh}var Oh,nb;function R$(){if(nb)return Oh;nb=1;var e=vy();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return Oh=n,Oh}var Ph,rb;function j$(){if(rb)return Ph;rb=1;var e=/\w*$/;function n(r){var i=new r.constructor(r.source,e.exec(r));return i.lastIndex=r.lastIndex,i}return Ph=n,Ph}var Lh,sb;function A$(){if(sb)return Lh;sb=1;var e=xo(),n=e?e.prototype:void 0,r=n?n.valueOf:void 0;function i(o){return r?Object(r.call(o)):{}}return Lh=i,Lh}var qh,ib;function nT(){if(ib)return qh;ib=1;var e=vy();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return qh=n,qh}var $h,ob;function I$(){if(ob)return $h;ob=1;var e=vy(),n=R$(),r=j$(),i=A$(),o=nT(),l="[object Boolean]",u="[object Date]",c="[object Map]",h="[object Number]",p="[object RegExp]",d="[object Set]",m="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",S="[object Float64Array]",b="[object Int8Array]",k="[object Int16Array]",E="[object Int32Array]",T="[object Uint8Array]",I="[object Uint8ClampedArray]",O="[object Uint16Array]",A="[object Uint32Array]";function U(z,P,D){var V=z.constructor;switch(P){case w:return e(z);case l:case u:return new V(+z);case N:return n(z,D);case _:case S:case b:case k:case E:case T:case I:case O:case A:return o(z,D);case c:return new V;case h:case m:return new V(z);case p:return r(z);case d:return new V;case y:return i(z)}}return $h=U,$h}var Dh,ab;function rT(){if(ab)return Dh;ab=1;var e=$n(),n=Object.create,r=(function(){function i(){}return function(o){if(!e(o))return{};if(n)return n(o);i.prototype=o;var l=new i;return i.prototype=void 0,l}})();return Dh=r,Dh}var Fh,lb;function sT(){if(lb)return Fh;lb=1;var e=rT(),n=Yu(),r=Gu();function i(o){return typeof o.constructor=="function"&&!r(o)?e(n(o)):{}}return Fh=i,Fh}var zh,ub;function M$(){if(ub)return zh;ub=1;var e=bo(),n=mr(),r="[object Map]";function i(o){return n(o)&&e(o)==r}return zh=i,zh}var Bh,cb;function O$(){if(cb)return Bh;cb=1;var e=M$(),n=Vu(),r=hy(),i=r&&r.isMap,o=i?n(i):e;return Bh=o,Bh}var Uh,db;function P$(){if(db)return Uh;db=1;var e=bo(),n=mr(),r="[object Set]";function i(o){return n(o)&&e(o)==r}return Uh=i,Uh}var Hh,fb;function L$(){if(fb)return Hh;fb=1;var e=P$(),n=Vu(),r=hy(),i=r&&r.isSet,o=i?n(i):e;return Hh=o,Hh}var Wh,hb;function iT(){if(hb)return Wh;hb=1;var e=Bu(),n=dy(),r=Hu(),i=y$(),o=_$(),l=GC(),u=YC(),c=b$(),h=S$(),p=JC(),d=k$(),m=bo(),y=T$(),w=I$(),N=sT(),_=_t(),S=_o(),b=O$(),k=$n(),E=L$(),T=As(),I=yi(),O=1,A=2,U=4,z="[object Arguments]",P="[object Array]",D="[object Boolean]",V="[object Date]",B="[object Error]",C="[object Function]",$="[object GeneratorFunction]",L="[object Map]",re="[object Number]",J="[object Object]",W="[object RegExp]",Z="[object Set]",M="[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]",je="[object Uint16Array]",ye="[object Uint32Array]",Ee={};Ee[z]=Ee[P]=Ee[q]=Ee[Q]=Ee[D]=Ee[V]=Ee[ne]=Ee[ae]=Ee[fe]=Ee[te]=Ee[ce]=Ee[L]=Ee[re]=Ee[J]=Ee[W]=Ee[Z]=Ee[M]=Ee[G]=Ee[Ce]=Ee[ve]=Ee[je]=Ee[ye]=!0,Ee[B]=Ee[C]=Ee[K]=!1;function Ye(we,_e,Be,it,ft,Ze){var $e,Je=_e&O,Xe=_e&A,Ot=_e&U;if(Be&&($e=ft?Be(we,it,ft,Ze):Be(we)),$e!==void 0)return $e;if(!k(we))return we;var lt=_(we);if(lt){if($e=y(we),!Je)return u(we,$e)}else{var Qe=m(we),Pt=Qe==C||Qe==$;if(S(we))return l(we,Je);if(Qe==J||Qe==z||Pt&&!ft){if($e=Xe||Pt?{}:N(we),!Je)return Xe?h(we,o($e,we)):c(we,i($e,we))}else{if(!Ee[Qe])return ft?we:{};$e=w(we,Qe,Je)}}Ze||(Ze=new e);var zt=Ze.get(we);if(zt)return zt;Ze.set(we,$e),E(we)?we.forEach(function(ht){$e.add(Ye(ht,_e,Be,ht,we,Ze))}):b(we)&&we.forEach(function(ht,vt){$e.set(vt,Ye(ht,_e,Be,vt,we,Ze))});var et=Ot?Xe?d:p:Xe?I:T,bt=lt?void 0:et(we);return n(bt||we,function(ht,vt){bt&&(vt=ht,ht=we[vt]),r($e,vt,Ye(ht,_e,Be,vt,we,Ze))}),$e}return Wh=Ye,Wh}var Vh,pb;function q$(){if(pb)return Vh;pb=1;var e=iT(),n=4;function r(i){return e(i,n)}return Vh=r,Vh}var Gh,mb;function yy(){if(mb)return Gh;mb=1;function e(n){return function(){return n}}return Gh=e,Gh}var Yh,gb;function $$(){if(gb)return Yh;gb=1;function e(n){return function(r,i,o){for(var l=-1,u=Object(r),c=o(r),h=c.length;h--;){var p=c[n?h:++l];if(i(u[p],p,u)===!1)break}return r}}return Yh=e,Yh}var Kh,vb;function wy(){if(vb)return Kh;vb=1;var e=$$(),n=e();return Kh=n,Kh}var Xh,yb;function xy(){if(yb)return Xh;yb=1;var e=wy(),n=As();function r(i,o){return i&&e(i,o,n)}return Xh=r,Xh}var Qh,wb;function D$(){if(wb)return Qh;wb=1;var e=Br();function n(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,h=Object(o);(i?c--:++c<u)&&l(h[c],c,h)!==!1;);return o}}return Qh=n,Qh}var Zh,xb;function Ku(){if(xb)return Zh;xb=1;var e=xy(),n=D$(),r=n(e);return Zh=r,Zh}var Jh,_b;function wi(){if(_b)return Jh;_b=1;function e(n){return n}return Jh=e,Jh}var ep,bb;function oT(){if(bb)return ep;bb=1;var e=wi();function n(r){return typeof r=="function"?r:e}return ep=n,ep}var tp,Sb;function aT(){if(Sb)return tp;Sb=1;var e=dy(),n=Ku(),r=oT(),i=_t();function o(l,u){var c=i(l)?e:n;return c(l,r(u))}return tp=o,tp}var np,kb;function lT(){return kb||(kb=1,np=aT()),np}var rp,Eb;function F$(){if(Eb)return rp;Eb=1;var e=Ku();function n(r,i){var o=[];return e(r,function(l,u,c){i(l,u,c)&&o.push(l)}),o}return rp=n,rp}var sp,Nb;function z$(){if(Nb)return sp;Nb=1;var e="__lodash_hash_undefined__";function n(r){return this.__data__.set(r,e),this}return sp=n,sp}var ip,Cb;function B$(){if(Cb)return ip;Cb=1;function e(n){return this.__data__.has(n)}return ip=e,ip}var op,Tb;function uT(){if(Tb)return op;Tb=1;var e=cy(),n=z$(),r=B$();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=n,i.prototype.has=r,op=i,op}var ap,Rb;function U$(){if(Rb)return ap;Rb=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o;)if(r(n[i],i,n))return!0;return!1}return ap=e,ap}var lp,jb;function cT(){if(jb)return lp;jb=1;function e(n,r){return n.has(r)}return lp=e,lp}var up,Ab;function dT(){if(Ab)return up;Ab=1;var e=uT(),n=U$(),r=cT(),i=1,o=2;function l(u,c,h,p,d,m){var y=h&i,w=u.length,N=c.length;if(w!=N&&!(y&&N>w))return!1;var _=m.get(u),S=m.get(c);if(_&&S)return _==c&&S==u;var b=-1,k=!0,E=h&o?new e:void 0;for(m.set(u,c),m.set(c,u);++b<w;){var T=u[b],I=c[b];if(p)var O=y?p(I,T,b,c,u,m):p(T,I,b,u,c,m);if(O!==void 0){if(O)continue;k=!1;break}if(E){if(!n(c,function(A,U){if(!r(E,U)&&(T===A||d(T,A,h,p,m)))return E.push(U)})){k=!1;break}}else if(!(T===I||d(T,I,h,p,m))){k=!1;break}}return m.delete(u),m.delete(c),k}return up=l,up}var cp,Ib;function H$(){if(Ib)return cp;Ib=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o,l){i[++r]=[l,o]}),i}return cp=e,cp}var dp,Mb;function _y(){if(Mb)return dp;Mb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o){i[++r]=o}),i}return dp=e,dp}var fp,Ob;function W$(){if(Ob)return fp;Ob=1;var e=xo(),n=tT(),r=wo(),i=dT(),o=H$(),l=_y(),u=1,c=2,h="[object Boolean]",p="[object Date]",d="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",_="[object String]",S="[object Symbol]",b="[object ArrayBuffer]",k="[object DataView]",E=e?e.prototype:void 0,T=E?E.valueOf:void 0;function I(O,A,U,z,P,D,V){switch(U){case k:if(O.byteLength!=A.byteLength||O.byteOffset!=A.byteOffset)return!1;O=O.buffer,A=A.buffer;case b:return!(O.byteLength!=A.byteLength||!D(new n(O),new n(A)));case h:case p:case y:return r(+O,+A);case d:return O.name==A.name&&O.message==A.message;case w:case _:return O==A+"";case m:var B=o;case N:var C=z&u;if(B||(B=l),O.size!=A.size&&!C)return!1;var $=V.get(O);if($)return $==A;z|=c,V.set(O,A);var L=i(B(O),B(A),z,P,D,V);return V.delete(O),L;case S:if(T)return T.call(O)==T.call(A)}return!1}return fp=I,fp}var hp,Pb;function V$(){if(Pb)return hp;Pb=1;var e=JC(),n=1,r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c,h,p,d){var m=c&n,y=e(l),w=y.length,N=e(u),_=N.length;if(w!=_&&!m)return!1;for(var S=w;S--;){var b=y[S];if(!(m?b in u:i.call(u,b)))return!1}var k=d.get(l),E=d.get(u);if(k&&E)return k==u&&E==l;var T=!0;d.set(l,u),d.set(u,l);for(var I=m;++S<w;){b=y[S];var O=l[b],A=u[b];if(h)var U=m?h(A,O,b,u,l,d):h(O,A,b,l,u,d);if(!(U===void 0?O===A||p(O,A,c,h,d):U)){T=!1;break}I||(I=b=="constructor")}if(T&&!I){var z=l.constructor,P=u.constructor;z!=P&&"constructor"in l&&"constructor"in u&&!(typeof z=="function"&&z instanceof z&&typeof P=="function"&&P instanceof P)&&(T=!1)}return d.delete(l),d.delete(u),T}return hp=o,hp}var pp,Lb;function G$(){if(Lb)return pp;Lb=1;var e=Bu(),n=dT(),r=W$(),i=V$(),o=bo(),l=_t(),u=_o(),c=qa(),h=1,p="[object Arguments]",d="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(_,S,b,k,E,T){var I=l(_),O=l(S),A=I?d:o(_),U=O?d:o(S);A=A==p?m:A,U=U==p?m:U;var z=A==m,P=U==m,D=A==U;if(D&&u(_)){if(!u(S))return!1;I=!0,z=!1}if(D&&!z)return T||(T=new e),I||c(_)?n(_,S,b,k,E,T):r(_,S,A,b,k,E,T);if(!(b&h)){var V=z&&w.call(_,"__wrapped__"),B=P&&w.call(S,"__wrapped__");if(V||B){var C=V?_.value():_,$=B?S.value():S;return T||(T=new e),E(C,$,b,k,T)}}return D?(T||(T=new e),i(_,S,b,k,E,T)):!1}return pp=N,pp}var mp,qb;function fT(){if(qb)return mp;qb=1;var e=G$(),n=mr();function r(i,o,l,u,c){return i===o?!0:i==null||o==null||!n(i)&&!n(o)?i!==i&&o!==o:e(i,o,l,u,r,c)}return mp=r,mp}var gp,$b;function Y$(){if($b)return gp;$b=1;var e=Bu(),n=fT(),r=1,i=2;function o(l,u,c,h){var p=c.length,d=p,m=!h;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],N=l[w],_=y[1];if(m&&y[2]){if(N===void 0&&!(w in l))return!1}else{var S=new e;if(h)var b=h(N,_,w,l,u,S);if(!(b===void 0?n(_,N,r|i,h,S):b))return!1}}return!0}return gp=o,gp}var vp,Db;function hT(){if(Db)return vp;Db=1;var e=$n();function n(r){return r===r&&!e(r)}return vp=n,vp}var yp,Fb;function K$(){if(Fb)return yp;Fb=1;var e=hT(),n=As();function r(i){for(var o=n(i),l=o.length;l--;){var u=o[l],c=i[u];o[l]=[u,c,e(c)]}return o}return yp=r,yp}var wp,zb;function pT(){if(zb)return wp;zb=1;function e(n,r){return function(i){return i==null?!1:i[n]===r&&(r!==void 0||n in Object(i))}}return wp=e,wp}var xp,Bb;function X$(){if(Bb)return xp;Bb=1;var e=Y$(),n=K$(),r=pT();function i(o){var l=n(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 xp=i,xp}var _p,Ub;function So(){if(Ub)return _p;Ub=1;var e=gi(),n=mr(),r="[object Symbol]";function i(o){return typeof o=="symbol"||n(o)&&e(o)==r}return _p=i,_p}var bp,Hb;function by(){if(Hb)return bp;Hb=1;var e=_t(),n=So(),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||n(l)?!0:i.test(l)||!r.test(l)||u!=null&&l in Object(u)}return bp=o,bp}var Sp,Wb;function Q$(){if(Wb)return Sp;Wb=1;var e=cy(),n="Expected a function";function r(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new TypeError(n);var l=function(){var u=arguments,c=o?o.apply(this,u):u[0],h=l.cache;if(h.has(c))return h.get(c);var p=i.apply(this,u);return l.cache=h.set(c,p)||h,p};return l.cache=new(r.Cache||e),l}return r.Cache=e,Sp=r,Sp}var kp,Vb;function Z$(){if(Vb)return kp;Vb=1;var e=Q$(),n=500;function r(i){var o=e(i,function(u){return l.size===n&&l.clear(),u}),l=o.cache;return o}return kp=r,kp}var Ep,Gb;function J$(){if(Gb)return Ep;Gb=1;var e=Z$(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,i=e(function(o){var l=[];return o.charCodeAt(0)===46&&l.push(""),o.replace(n,function(u,c,h,p){l.push(h?p.replace(r,"$1"):c||u)}),l});return Ep=i,Ep}var Np,Yb;function Xu(){if(Yb)return Np;Yb=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=Array(o);++i<o;)l[i]=r(n[i],i,n);return l}return Np=e,Np}var Cp,Kb;function eD(){if(Kb)return Cp;Kb=1;var e=xo(),n=Xu(),r=_t(),i=So(),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 n(c,u)+"";if(i(c))return l?l.call(c):"";var h=c+"";return h=="0"&&1/c==-1/0?"-0":h}return Cp=u,Cp}var Tp,Xb;function mT(){if(Xb)return Tp;Xb=1;var e=eD();function n(r){return r==null?"":e(r)}return Tp=n,Tp}var Rp,Qb;function Qu(){if(Qb)return Rp;Qb=1;var e=_t(),n=by(),r=J$(),i=mT();function o(l,u){return e(l)?l:n(l,u)?[l]:r(i(l))}return Rp=o,Rp}var jp,Zb;function $a(){if(Zb)return jp;Zb=1;var e=So();function n(r){if(typeof r=="string"||e(r))return r;var i=r+"";return i=="0"&&1/r==-1/0?"-0":i}return jp=n,jp}var Ap,Jb;function Zu(){if(Jb)return Ap;Jb=1;var e=Qu(),n=$a();function r(i,o){o=e(o,i);for(var l=0,u=o.length;i!=null&&l<u;)i=i[n(o[l++])];return l&&l==u?i:void 0}return Ap=r,Ap}var Ip,eS;function tD(){if(eS)return Ip;eS=1;var e=Zu();function n(r,i,o){var l=r==null?void 0:e(r,i);return l===void 0?o:l}return Ip=n,Ip}var Mp,tS;function nD(){if(tS)return Mp;tS=1;function e(n,r){return n!=null&&r in Object(n)}return Mp=e,Mp}var Op,nS;function gT(){if(nS)return Op;nS=1;var e=Qu(),n=La(),r=_t(),i=Wu(),o=fy(),l=$a();function u(c,h,p){h=e(h,c);for(var d=-1,m=h.length,y=!1;++d<m;){var w=l(h[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)||n(c)))}return Op=u,Op}var Pp,rS;function vT(){if(rS)return Pp;rS=1;var e=nD(),n=gT();function r(i,o){return i!=null&&n(i,o,e)}return Pp=r,Pp}var Lp,sS;function rD(){if(sS)return Lp;sS=1;var e=fT(),n=tD(),r=vT(),i=by(),o=hT(),l=pT(),u=$a(),c=1,h=2;function p(d,m){return i(d)&&o(m)?l(u(d),m):function(y){var w=n(y,d);return w===void 0&&w===m?r(y,d):e(m,w,c|h)}}return Lp=p,Lp}var qp,iS;function yT(){if(iS)return qp;iS=1;function e(n){return function(r){return r==null?void 0:r[n]}}return qp=e,qp}var $p,oS;function sD(){if(oS)return $p;oS=1;var e=Zu();function n(r){return function(i){return e(i,r)}}return $p=n,$p}var Dp,aS;function iD(){if(aS)return Dp;aS=1;var e=yT(),n=sD(),r=by(),i=$a();function o(l){return r(l)?e(i(l)):n(l)}return Dp=o,Dp}var Fp,lS;function Ur(){if(lS)return Fp;lS=1;var e=X$(),n=rD(),r=wi(),i=_t(),o=iD();function l(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?i(u)?n(u[0],u[1]):e(u):o(u)}return Fp=l,Fp}var zp,uS;function wT(){if(uS)return zp;uS=1;var e=KC(),n=F$(),r=Ur(),i=_t();function o(l,u){var c=i(l)?e:n;return c(l,r(u,3))}return zp=o,zp}var Bp,cS;function oD(){if(cS)return Bp;cS=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i,o){return i!=null&&n.call(i,o)}return Bp=r,Bp}var Up,dS;function xT(){if(dS)return Up;dS=1;var e=oD(),n=gT();function r(i,o){return i!=null&&n(i,o,e)}return Up=r,Up}var Hp,fS;function aD(){if(fS)return Hp;fS=1;var e=py(),n=bo(),r=La(),i=_t(),o=Br(),l=_o(),u=Gu(),c=qa(),h="[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 N=n(w);if(N==h||N==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(m.call(w,_))return!1;return!0}return Hp=y,Hp}var Wp,hS;function _T(){if(hS)return Wp;hS=1;function e(n){return n===void 0}return Wp=e,Wp}var Vp,pS;function bT(){if(pS)return Vp;pS=1;var e=Ku(),n=Br();function r(i,o){var l=-1,u=n(i)?Array(i.length):[];return e(i,function(c,h,p){u[++l]=o(c,h,p)}),u}return Vp=r,Vp}var Gp,mS;function ST(){if(mS)return Gp;mS=1;var e=Xu(),n=Ur(),r=bT(),i=_t();function o(l,u){var c=i(l)?e:r;return c(l,n(u,3))}return Gp=o,Gp}var Yp,gS;function lD(){if(gS)return Yp;gS=1;function e(n,r,i,o){var l=-1,u=n==null?0:n.length;for(o&&u&&(i=n[++l]);++l<u;)i=r(i,n[l],l,n);return i}return Yp=e,Yp}var Kp,vS;function uD(){if(vS)return Kp;vS=1;function e(n,r,i,o,l){return l(n,function(u,c,h){i=o?(o=!1,u):r(i,u,c,h)}),i}return Kp=e,Kp}var Xp,yS;function kT(){if(yS)return Xp;yS=1;var e=lD(),n=Ku(),r=Ur(),i=uD(),o=_t();function l(u,c,h){var p=o(u)?e:i,d=arguments.length<3;return p(u,r(c,4),h,d,n)}return Xp=l,Xp}var Qp,wS;function cD(){if(wS)return Qp;wS=1;var e=gi(),n=_t(),r=mr(),i="[object String]";function o(l){return typeof l=="string"||!n(l)&&r(l)&&e(l)==i}return Qp=o,Qp}var Zp,xS;function dD(){if(xS)return Zp;xS=1;var e=yT(),n=e("length");return Zp=n,Zp}var Jp,_S;function fD(){if(_S)return Jp;_S=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+l+"]");function h(p){return c.test(p)}return Jp=h,Jp}var em,bS;function hD(){if(bS)return em;bS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="["+e+"]",c="["+o+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+h+")",d="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",_="["+l+"]?",S="(?:"+w+"(?:"+[d,m,y].join("|")+")"+_+N+")*",b=_+N+S,k="(?:"+[d+c+"?",c,m,y,u].join("|")+")",E=RegExp(h+"(?="+h+")|"+k+b,"g");function T(I){for(var O=E.lastIndex=0;E.test(I);)++O;return O}return em=T,em}var tm,SS;function pD(){if(SS)return tm;SS=1;var e=dD(),n=fD(),r=hD();function i(o){return n(o)?r(o):e(o)}return tm=i,tm}var nm,kS;function mD(){if(kS)return nm;kS=1;var e=py(),n=bo(),r=Br(),i=cD(),o=pD(),l="[object Map]",u="[object Set]";function c(h){if(h==null)return 0;if(r(h))return i(h)?o(h):h.length;var p=n(h);return p==l||p==u?h.size:e(h).length}return nm=c,nm}var rm,ES;function gD(){if(ES)return rm;ES=1;var e=dy(),n=rT(),r=xy(),i=Ur(),o=Yu(),l=_t(),u=_o(),c=Oa(),h=$n(),p=qa();function d(m,y,w){var N=l(m),_=N||u(m)||p(m);if(y=i(y,4),w==null){var S=m&&m.constructor;_?w=N?new S:[]:h(m)?w=c(S)?n(o(m)):{}:w={}}return(_?e:r)(m,function(b,k,E){return y(w,b,k,E)}),w}return rm=d,rm}var sm,NS;function vD(){if(NS)return sm;NS=1;var e=xo(),n=La(),r=_t(),i=e?e.isConcatSpreadable:void 0;function o(l){return r(l)||n(l)||!!(i&&l&&l[i])}return sm=o,sm}var im,CS;function Sy(){if(CS)return im;CS=1;var e=gy(),n=vD();function r(i,o,l,u,c){var h=-1,p=i.length;for(l||(l=n),c||(c=[]);++h<p;){var d=i[h];o>0&&l(d)?o>1?r(d,o-1,l,u,c):e(c,d):u||(c[c.length]=d)}return c}return im=r,im}var om,TS;function yD(){if(TS)return om;TS=1;function e(n,r,i){switch(i.length){case 0:return n.call(r);case 1:return n.call(r,i[0]);case 2:return n.call(r,i[0],i[1]);case 3:return n.call(r,i[0],i[1],i[2])}return n.apply(r,i)}return om=e,om}var am,RS;function ET(){if(RS)return am;RS=1;var e=yD(),n=Math.max;function r(i,o,l){return o=n(o===void 0?i.length-1:o,0),function(){for(var u=arguments,c=-1,h=n(u.length-o,0),p=Array(h);++c<h;)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 am=r,am}var lm,jS;function wD(){if(jS)return lm;jS=1;var e=yy(),n=HC(),r=wi(),i=n?function(o,l){return n(o,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:r;return lm=i,lm}var um,AS;function xD(){if(AS)return um;AS=1;var e=800,n=16,r=Date.now;function i(o){var l=0,u=0;return function(){var c=r(),h=n-(c-u);if(u=c,h>0){if(++l>=e)return arguments[0]}else l=0;return o.apply(void 0,arguments)}}return um=i,um}var cm,IS;function NT(){if(IS)return cm;IS=1;var e=wD(),n=xD(),r=n(e);return cm=r,cm}var dm,MS;function Ju(){if(MS)return dm;MS=1;var e=wi(),n=ET(),r=NT();function i(o,l){return r(n(o,l,e),o+"")}return dm=i,dm}var fm,OS;function CT(){if(OS)return fm;OS=1;function e(n,r,i,o){for(var l=n.length,u=i+(o?1:-1);o?u--:++u<l;)if(r(n[u],u,n))return u;return-1}return fm=e,fm}var hm,PS;function _D(){if(PS)return hm;PS=1;function e(n){return n!==n}return hm=e,hm}var pm,LS;function bD(){if(LS)return pm;LS=1;function e(n,r,i){for(var o=i-1,l=n.length;++o<l;)if(n[o]===r)return o;return-1}return pm=e,pm}var mm,qS;function SD(){if(qS)return mm;qS=1;var e=CT(),n=_D(),r=bD();function i(o,l,u){return l===l?r(o,l,u):e(o,n,u)}return mm=i,mm}var gm,$S;function kD(){if($S)return gm;$S=1;var e=SD();function n(r,i){var o=r==null?0:r.length;return!!o&&e(r,i,0)>-1}return gm=n,gm}var vm,DS;function ED(){if(DS)return vm;DS=1;function e(n,r,i){for(var o=-1,l=n==null?0:n.length;++o<l;)if(i(r,n[o]))return!0;return!1}return vm=e,vm}var ym,FS;function ND(){if(FS)return ym;FS=1;function e(){}return ym=e,ym}var wm,zS;function CD(){if(zS)return wm;zS=1;var e=eT(),n=ND(),r=_y(),i=1/0,o=e&&1/r(new e([,-0]))[1]==i?function(l){return new e(l)}:n;return wm=o,wm}var xm,BS;function TD(){if(BS)return xm;BS=1;var e=uT(),n=kD(),r=ED(),i=cT(),o=CD(),l=_y(),u=200;function c(h,p,d){var m=-1,y=n,w=h.length,N=!0,_=[],S=_;if(d)N=!1,y=r;else if(w>=u){var b=p?null:o(h);if(b)return l(b);N=!1,y=i,S=new e}else S=p?[]:_;e:for(;++m<w;){var k=h[m],E=p?p(k):k;if(k=d||k!==0?k:0,N&&E===E){for(var T=S.length;T--;)if(S[T]===E)continue e;p&&S.push(E),_.push(k)}else y(S,E,d)||(S!==_&&S.push(E),_.push(k))}return _}return xm=c,xm}var _m,US;function TT(){if(US)return _m;US=1;var e=Br(),n=mr();function r(i){return n(i)&&e(i)}return _m=r,_m}var bm,HS;function RD(){if(HS)return bm;HS=1;var e=Sy(),n=Ju(),r=TD(),i=TT(),o=n(function(l){return r(e(l,1,i,!0))});return bm=o,bm}var Sm,WS;function jD(){if(WS)return Sm;WS=1;var e=Xu();function n(r,i){return e(i,function(o){return r[o]})}return Sm=n,Sm}var km,VS;function RT(){if(VS)return km;VS=1;var e=jD(),n=As();function r(i){return i==null?[]:e(i,n(i))}return km=r,km}var Em,GS;function Dn(){if(GS)return Em;GS=1;var e;if(typeof ly=="function")try{e={clone:q$(),constant:yy(),each:lT(),filter:wT(),has:xT(),isArray:_t(),isEmpty:aD(),isFunction:Oa(),isUndefined:_T(),keys:As(),map:ST(),reduce:kT(),size:mD(),transform:gD(),union:RD(),values:RT()}}catch{}return e||(e=window._),Em=e,Em}var Nm,YS;function ky(){if(YS)return Nm;YS=1;var e=Dn();Nm=o;var n="\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(N){y.length>1?w.setNode(N,m):w.setNode(N)}),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(_,S){d(S)&&m.setNode(S,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var w={};function N(_){var S=y.parent(_);return S===void 0||m.hasNode(S)?(w[_]=S,S):S in w?w[S]:N(S)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,N(_))}),m},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(N,_){return w.length>1?y.setEdge(N,_,m):y.setEdge(N,_),_}),this},o.prototype.setEdge=function(){var d,m,y,w,N=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,m=_.w,y=_.name,arguments.length===2&&(w=arguments[1],N=!0)):(d=_,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),d=""+d,m=""+m,e.isUndefined(y)||(y=""+y);var S=c(this._isDirected,d,m,y);if(e.has(this._edgeLabels,S))return N&&(this._edgeLabels[S]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(m),this._edgeLabels[S]=N?w:this._defaultEdgeLabelFn(d,m,y);var b=h(this._isDirected,d,m,y);return d=b.v,m=b.w,Object.freeze(b),this._edgeObjs[S]=b,l(this._preds[m],d),l(this._sucs[d],m),this._in[m][S]=b,this._out[d][S]=b,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),N=this._edgeObjs[w];return N&&(d=N.v,m=N.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(N){return N.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(N){return N.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 N=""+m,_=""+y;if(!d&&N>_){var S=N;N=_,_=S}return N+i+_+i+(e.isUndefined(w)?n:w)}function h(d,m,y,w){var N=""+m,_=""+y;if(!d&&N>_){var S=N;N=_,_=S}var b={v:N,w:_};return w&&(b.name=w),b}function p(d,m){return c(d,m.v,m.w,m.name)}return Nm}var Cm,KS;function AD(){return KS||(KS=1,Cm="2.1.8"),Cm}var Tm,XS;function ID(){return XS||(XS=1,Tm={Graph:ky(),version:AD()}),Tm}var Rm,QS;function MD(){if(QS)return Rm;QS=1;var e=Dn(),n=ky();Rm={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 h=u.node(c),p=u.parent(c),d={v:c};return e.isUndefined(h)||(d.value=h),e.isUndefined(p)||(d.parent=p),d})}function o(u){return e.map(u.edges(),function(c){var h=u.edge(c),p={v:c.v,w:c.w};return e.isUndefined(c.name)||(p.name=c.name),e.isUndefined(h)||(p.value=h),p})}function l(u){var c=new n(u.options).setGraph(u.value);return e.each(u.nodes,function(h){c.setNode(h.v,h.value),h.parent&&c.setParent(h.v,h.parent)}),e.each(u.edges,function(h){c.setEdge({v:h.v,w:h.w,name:h.name},h.value)}),c}return Rm}var jm,ZS;function OD(){if(ZS)return jm;ZS=1;var e=Dn();jm=n;function n(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 jm}var Am,JS;function jT(){if(JS)return Am;JS=1;var e=Dn();Am=n;function n(){this._arr=[],this._keyIndices={}}return n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map(function(r){return r.key})},n.prototype.has=function(r){return e.has(this._keyIndices,r)},n.prototype.priority=function(r){var i=this._keyIndices[r];if(i!==void 0)return this._arr[i].priority},n.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},n.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},n.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},n.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)},n.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)))},n.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},n.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},Am}var Im,ek;function AT(){if(ek)return Im;ek=1;var e=Dn(),n=jT();Im=i;var r=e.constant(1);function i(l,u,c,h){return o(l,String(u),c||r,h||function(p){return l.outEdges(p)})}function o(l,u,c,h){var p={},d=new n,m,y,w=function(N){var _=N.v!==m?N.v:N.w,S=p[_],b=c(N),k=y.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+b);k<S.distance&&(S.distance=k,S.predecessor=m,d.decrease(_,k))};for(l.nodes().forEach(function(N){var _=N===u?0:Number.POSITIVE_INFINITY;p[N]={distance:_},d.add(N,_)});d.size()>0&&(m=d.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)h(m).forEach(w);return p}return Im}var Mm,tk;function PD(){if(tk)return Mm;tk=1;var e=AT(),n=Dn();Mm=r;function r(i,o,l){return n.transform(i.nodes(),function(u,c){u[c]=e(i,c,o,l)},{})}return Mm}var Om,nk;function IT(){if(nk)return Om;nk=1;var e=Dn();Om=n;function n(r){var i=0,o=[],l={},u=[];function c(h){var p=l[h]={onStack:!0,lowlink:i,index:i++};if(o.push(h),r.successors(h).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(h!==m);u.push(d)}}return r.nodes().forEach(function(h){e.has(l,h)||c(h)}),u}return Om}var Pm,rk;function LD(){if(rk)return Pm;rk=1;var e=Dn(),n=IT();Pm=r;function r(i){return e.filter(n(i),function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}return Pm}var Lm,sk;function qD(){if(sk)return Lm;sk=1;var e=Dn();Lm=r;var n=e.constant(1);function r(o,l,u){return i(o,l||n,u||function(c){return o.outEdges(c)})}function i(o,l,u){var c={},h=o.nodes();return h.forEach(function(p){c[p]={},c[p][p]={distance:0},h.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}})}),h.forEach(function(p){var d=c[p];h.forEach(function(m){var y=c[m];h.forEach(function(w){var N=y[p],_=d[w],S=y[w],b=N.distance+_.distance;b<S.distance&&(S.distance=b,S.predecessor=_.predecessor)})})}),c}return Lm}var qm,ik;function MT(){if(ik)return qm;ik=1;var e=Dn();qm=n,n.CycleException=r;function n(i){var o={},l={},u=[];function c(h){if(e.has(l,h))throw new r;e.has(o,h)||(l[h]=!0,o[h]=!0,e.each(i.predecessors(h),c),delete l[h],u.push(h))}if(e.each(i.sinks(),c),e.size(o)!==i.nodeCount())throw new r;return u}function r(){}return r.prototype=new Error,qm}var $m,ok;function $D(){if(ok)return $m;ok=1;var e=MT();$m=n;function n(r){try{e(r)}catch(i){if(i instanceof e.CycleException)return!1;throw i}return!0}return $m}var Dm,ak;function OT(){if(ak)return Dm;ak=1;var e=Dn();Dm=n;function n(i,o,l){e.isArray(o)||(o=[o]);var u=(i.isDirected()?i.successors:i.neighbors).bind(i),c=[],h={};return e.each(o,function(p){if(!i.hasNode(p))throw new Error("Graph does not have node: "+p);r(i,p,l==="post",h,u,c)}),c}function r(i,o,l,u,c,h){e.has(u,o)||(u[o]=!0,l||h.push(o),e.each(c(o),function(p){r(i,p,l,u,c,h)}),l&&h.push(o))}return Dm}var Fm,lk;function DD(){if(lk)return Fm;lk=1;var e=OT();Fm=n;function n(r,i){return e(r,i,"post")}return Fm}var zm,uk;function FD(){if(uk)return zm;uk=1;var e=OT();zm=n;function n(r,i){return e(r,i,"pre")}return zm}var Bm,ck;function zD(){if(ck)return Bm;ck=1;var e=Dn(),n=ky(),r=jT();Bm=i;function i(o,l){var u=new n,c={},h=new r,p;function d(y){var w=y.v===p?y.w:y.v,N=h.priority(w);if(N!==void 0){var _=l(y);_<N&&(c[w]=p,h.decrease(w,_))}}if(o.nodeCount()===0)return u;e.each(o.nodes(),function(y){h.add(y,Number.POSITIVE_INFINITY),u.setNode(y)}),h.decrease(o.nodes()[0],0);for(var m=!1;h.size()>0;){if(p=h.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 Bm}var Um,dk;function BD(){return dk||(dk=1,Um={components:OD(),dijkstra:AT(),dijkstraAll:PD(),findCycles:LD(),floydWarshall:qD(),isAcyclic:$D(),postorder:DD(),preorder:FD(),prim:zD(),tarjan:IT(),topsort:MT()}),Um}var Hm,fk;function UD(){if(fk)return Hm;fk=1;var e=ID();return Hm={Graph:e.Graph,json:MD(),alg:BD(),version:e.version},Hm}var Wm,hk;function tr(){if(hk)return Wm;hk=1;var e;if(typeof ly=="function")try{e=UD()}catch{}return e||(e=window.graphlib),Wm=e,Wm}var Vm,pk;function HD(){if(pk)return Vm;pk=1;var e=iT(),n=1,r=4;function i(o){return e(o,n|r)}return Vm=i,Vm}var Gm,mk;function ec(){if(mk)return Gm;mk=1;var e=wo(),n=Br(),r=Wu(),i=$n();function o(l,u,c){if(!i(c))return!1;var h=typeof u;return(h=="number"?n(c)&&r(u,c.length):h=="string"&&u in c)?e(c[u],l):!1}return Gm=o,Gm}var Ym,gk;function WD(){if(gk)return Ym;gk=1;var e=Ju(),n=wo(),r=ec(),i=yi(),o=Object.prototype,l=o.hasOwnProperty,u=e(function(c,h){c=Object(c);var p=-1,d=h.length,m=d>2?h[2]:void 0;for(m&&r(h[0],h[1],m)&&(d=1);++p<d;)for(var y=h[p],w=i(y),N=-1,_=w.length;++N<_;){var S=w[N],b=c[S];(b===void 0||n(b,o[S])&&!l.call(c,S))&&(c[S]=y[S])}return c});return Ym=u,Ym}var Km,vk;function VD(){if(vk)return Km;vk=1;var e=Ur(),n=Br(),r=As();function i(o){return function(l,u,c){var h=Object(l);if(!n(l)){var p=e(u,3);l=r(l),u=function(m){return p(h[m],m,h)}}var d=o(l,u,c);return d>-1?h[p?l[d]:d]:void 0}}return Km=i,Km}var Xm,yk;function GD(){if(yk)return Xm;yk=1;var e=/\s/;function n(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return Xm=n,Xm}var Qm,wk;function YD(){if(wk)return Qm;wk=1;var e=GD(),n=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(n,"")}return Qm=r,Qm}var Zm,xk;function KD(){if(xk)return Zm;xk=1;var e=YD(),n=$n(),r=So(),i=NaN,o=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;function h(p){if(typeof p=="number")return p;if(r(p))return i;if(n(p)){var d=typeof p.valueOf=="function"?p.valueOf():p;p=n(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 Zm=h,Zm}var Jm,_k;function PT(){if(_k)return Jm;_k=1;var e=KD(),n=1/0,r=17976931348623157e292;function i(o){if(!o)return o===0?o:0;if(o=e(o),o===n||o===-n){var l=o<0?-1:1;return l*r}return o===o?o:0}return Jm=i,Jm}var eg,bk;function XD(){if(bk)return eg;bk=1;var e=PT();function n(r){var i=e(r),o=i%1;return i===i?o?i-o:i:0}return eg=n,eg}var tg,Sk;function QD(){if(Sk)return tg;Sk=1;var e=CT(),n=Ur(),r=XD(),i=Math.max;function o(l,u,c){var h=l==null?0:l.length;if(!h)return-1;var p=c==null?0:r(c);return p<0&&(p=i(h+p,0)),e(l,n(u,3),p)}return tg=o,tg}var ng,kk;function ZD(){if(kk)return ng;kk=1;var e=VD(),n=QD(),r=e(n);return ng=r,ng}var rg,Ek;function LT(){if(Ek)return rg;Ek=1;var e=Sy();function n(r){var i=r==null?0:r.length;return i?e(r,1):[]}return rg=n,rg}var sg,Nk;function JD(){if(Nk)return sg;Nk=1;var e=wy(),n=oT(),r=yi();function i(o,l){return o==null?o:e(o,n(l),r)}return sg=i,sg}var ig,Ck;function e4(){if(Ck)return ig;Ck=1;function e(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}return ig=e,ig}var og,Tk;function t4(){if(Tk)return og;Tk=1;var e=Uu(),n=xy(),r=Ur();function i(o,l){var u={};return l=r(l,3),n(o,function(c,h,p){e(u,h,l(c,h,p))}),u}return og=i,og}var ag,Rk;function Ey(){if(Rk)return ag;Rk=1;var e=So();function n(r,i,o){for(var l=-1,u=r.length;++l<u;){var c=r[l],h=i(c);if(h!=null&&(p===void 0?h===h&&!e(h):o(h,p)))var p=h,d=c}return d}return ag=n,ag}var lg,jk;function n4(){if(jk)return lg;jk=1;function e(n,r){return n>r}return lg=e,lg}var ug,Ak;function r4(){if(Ak)return ug;Ak=1;var e=Ey(),n=n4(),r=wi();function i(o){return o&&o.length?e(o,r,n):void 0}return ug=i,ug}var cg,Ik;function qT(){if(Ik)return cg;Ik=1;var e=Uu(),n=wo();function r(i,o,l){(l!==void 0&&!n(i[o],l)||l===void 0&&!(o in i))&&e(i,o,l)}return cg=r,cg}var dg,Mk;function s4(){if(Mk)return dg;Mk=1;var e=gi(),n=Yu(),r=mr(),i="[object Object]",o=Function.prototype,l=Object.prototype,u=o.toString,c=l.hasOwnProperty,h=u.call(Object);function p(d){if(!r(d)||e(d)!=i)return!1;var m=n(d);if(m===null)return!0;var y=c.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&u.call(y)==h}return dg=p,dg}var fg,Ok;function $T(){if(Ok)return fg;Ok=1;function e(n,r){if(!(r==="constructor"&&typeof n[r]=="function")&&r!="__proto__")return n[r]}return fg=e,fg}var hg,Pk;function i4(){if(Pk)return hg;Pk=1;var e=Pa(),n=yi();function r(i){return e(i,n(i))}return hg=r,hg}var pg,Lk;function o4(){if(Lk)return pg;Lk=1;var e=qT(),n=GC(),r=nT(),i=YC(),o=sT(),l=La(),u=_t(),c=TT(),h=_o(),p=Oa(),d=$n(),m=s4(),y=qa(),w=$T(),N=i4();function _(S,b,k,E,T,I,O){var A=w(S,k),U=w(b,k),z=O.get(U);if(z){e(S,k,z);return}var P=I?I(A,U,k+"",S,b,O):void 0,D=P===void 0;if(D){var V=u(U),B=!V&&h(U),C=!V&&!B&&y(U);P=U,V||B||C?u(A)?P=A:c(A)?P=i(A):B?(D=!1,P=n(U,!0)):C?(D=!1,P=r(U,!0)):P=[]:m(U)||l(U)?(P=A,l(A)?P=N(A):(!d(A)||p(A))&&(P=o(U))):D=!1}D&&(O.set(U,P),T(P,U,E,I,O),O.delete(U)),e(S,k,P)}return pg=_,pg}var mg,qk;function a4(){if(qk)return mg;qk=1;var e=Bu(),n=qT(),r=wy(),i=o4(),o=$n(),l=yi(),u=$T();function c(h,p,d,m,y){h!==p&&r(p,function(w,N){if(y||(y=new e),o(w))i(h,p,N,d,c,m,y);else{var _=m?m(u(h,N),w,N+"",h,p,y):void 0;_===void 0&&(_=w),n(h,N,_)}},l)}return mg=c,mg}var gg,$k;function l4(){if($k)return gg;$k=1;var e=Ju(),n=ec();function r(i){return e(function(o,l){var u=-1,c=l.length,h=c>1?l[c-1]:void 0,p=c>2?l[2]:void 0;for(h=i.length>3&&typeof h=="function"?(c--,h):void 0,p&&n(l[0],l[1],p)&&(h=c<3?void 0:h,c=1),o=Object(o);++u<c;){var d=l[u];d&&i(o,d,u,h)}return o})}return gg=r,gg}var vg,Dk;function u4(){if(Dk)return vg;Dk=1;var e=a4(),n=l4(),r=n(function(i,o,l){e(i,o,l)});return vg=r,vg}var yg,Fk;function DT(){if(Fk)return yg;Fk=1;function e(n,r){return n<r}return yg=e,yg}var wg,zk;function c4(){if(zk)return wg;zk=1;var e=Ey(),n=DT(),r=wi();function i(o){return o&&o.length?e(o,r,n):void 0}return wg=i,wg}var xg,Bk;function d4(){if(Bk)return xg;Bk=1;var e=Ey(),n=Ur(),r=DT();function i(o,l){return o&&o.length?e(o,n(l,2),r):void 0}return xg=i,xg}var _g,Uk;function f4(){if(Uk)return _g;Uk=1;var e=rr(),n=function(){return e.Date.now()};return _g=n,_g}var bg,Hk;function h4(){if(Hk)return bg;Hk=1;var e=Hu(),n=Qu(),r=Wu(),i=$n(),o=$a();function l(u,c,h,p){if(!i(u))return u;c=n(c,u);for(var d=-1,m=c.length,y=m-1,w=u;w!=null&&++d<m;){var N=o(c[d]),_=h;if(N==="__proto__"||N==="constructor"||N==="prototype")return u;if(d!=y){var S=w[N];_=p?p(S,N,w):void 0,_===void 0&&(_=i(S)?S:r(c[d+1])?[]:{})}e(w,N,_),w=w[N]}return u}return bg=l,bg}var Sg,Wk;function p4(){if(Wk)return Sg;Wk=1;var e=Zu(),n=h4(),r=Qu();function i(o,l,u){for(var c=-1,h=l.length,p={};++c<h;){var d=l[c],m=e(o,d);u(m,d)&&n(p,r(d,o),m)}return p}return Sg=i,Sg}var kg,Vk;function m4(){if(Vk)return kg;Vk=1;var e=p4(),n=vT();function r(i,o){return e(i,o,function(l,u){return n(i,u)})}return kg=r,kg}var Eg,Gk;function g4(){if(Gk)return Eg;Gk=1;var e=LT(),n=ET(),r=NT();function i(o){return r(n(o,void 0,e),o+"")}return Eg=i,Eg}var Ng,Yk;function v4(){if(Yk)return Ng;Yk=1;var e=m4(),n=g4(),r=n(function(i,o){return i==null?{}:e(i,o)});return Ng=r,Ng}var Cg,Kk;function y4(){if(Kk)return Cg;Kk=1;var e=Math.ceil,n=Math.max;function r(i,o,l,u){for(var c=-1,h=n(e((o-i)/(l||1)),0),p=Array(h);h--;)p[u?h:++c]=i,i+=l;return p}return Cg=r,Cg}var Tg,Xk;function w4(){if(Xk)return Tg;Xk=1;var e=y4(),n=ec(),r=PT();function i(o){return function(l,u,c){return c&&typeof c!="number"&&n(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 Tg=i,Tg}var Rg,Qk;function x4(){if(Qk)return Rg;Qk=1;var e=w4(),n=e();return Rg=n,Rg}var jg,Zk;function _4(){if(Zk)return jg;Zk=1;function e(n,r){var i=n.length;for(n.sort(r);i--;)n[i]=n[i].value;return n}return jg=e,jg}var Ag,Jk;function b4(){if(Jk)return Ag;Jk=1;var e=So();function n(r,i){if(r!==i){var o=r!==void 0,l=r===null,u=r===r,c=e(r),h=i!==void 0,p=i===null,d=i===i,m=e(i);if(!p&&!m&&!c&&r>i||c&&h&&d&&!p&&!m||l&&h&&d||!o&&d||!u)return 1;if(!l&&!c&&!m&&r<i||m&&o&&u&&!l&&!c||p&&o&&u||!h&&u||!d)return-1}return 0}return Ag=n,Ag}var Ig,eE;function S4(){if(eE)return Ig;eE=1;var e=b4();function n(r,i,o){for(var l=-1,u=r.criteria,c=i.criteria,h=u.length,p=o.length;++l<h;){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 Ig=n,Ig}var Mg,tE;function k4(){if(tE)return Mg;tE=1;var e=Xu(),n=Zu(),r=Ur(),i=bT(),o=_4(),l=Vu(),u=S4(),c=wi(),h=_t();function p(d,m,y){m.length?m=e(m,function(_){return h(_)?function(S){return n(S,_.length===1?_[0]:_)}:_}):m=[c];var w=-1;m=e(m,l(r));var N=i(d,function(_,S,b){var k=e(m,function(E){return E(_)});return{criteria:k,index:++w,value:_}});return o(N,function(_,S){return u(_,S,y)})}return Mg=p,Mg}var Og,nE;function E4(){if(nE)return Og;nE=1;var e=Sy(),n=k4(),r=Ju(),i=ec(),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]]),n(l,e(u,1),[])});return Og=o,Og}var Pg,rE;function N4(){if(rE)return Pg;rE=1;var e=mT(),n=0;function r(i){var o=++n;return e(i)+o}return Pg=r,Pg}var Lg,sE;function C4(){if(sE)return Lg;sE=1;function e(n,r,i){for(var o=-1,l=n.length,u=r.length,c={};++o<l;){var h=o<u?r[o]:void 0;i(c,n[o],h)}return c}return Lg=e,Lg}var qg,iE;function T4(){if(iE)return qg;iE=1;var e=Hu(),n=C4();function r(i,o){return n(i||[],o||[],e)}return qg=r,qg}var $g,oE;function at(){if(oE)return $g;oE=1;var e;if(typeof ly=="function")try{e={cloneDeep:HD(),constant:yy(),defaults:WD(),each:lT(),filter:wT(),find:ZD(),flatten:LT(),forEach:aT(),forIn:JD(),has:xT(),isUndefined:_T(),last:e4(),map:ST(),mapValues:t4(),max:r4(),merge:u4(),min:c4(),minBy:d4(),now:f4(),pick:v4(),range:x4(),reduce:kT(),sortBy:E4(),uniqueId:N4(),values:RT(),zipObject:T4()}}catch{}return e||(e=window._),$g=e,$g}var Dg,aE;function R4(){if(aE)return Dg;aE=1,Dg=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 n(o),o},e.prototype.enqueue=function(i){var o=this._sentinel;i._prev&&i._next&&n(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 n(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 Dg}var Fg,lE;function j4(){if(lE)return Fg;lE=1;var e=at(),n=tr().Graph,r=R4();Fg=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],N=d[0],_;p.nodeCount();){for(;_=N.dequeue();)u(p,d,m,_);for(;_=w.dequeue();)u(p,d,m,_);if(p.nodeCount()){for(var S=d.length-2;S>0;--S)if(_=d[S].dequeue(),_){y=y.concat(u(p,d,m,_,!0));break}}}return y}function u(p,d,m,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var S=p.edge(_),b=p.node(_.v);w&&N.push({v:_.v,w:_.w}),b.out-=S,h(d,m,b)}),e.forEach(p.outEdges(y.v),function(_){var S=p.edge(_),b=_.w,k=p.node(b);k.in-=S,h(d,m,k)}),p.removeNode(y.v),N}function c(p,d){var m=new n,y=0,w=0;e.forEach(p.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var b=m.edge(S.v,S.w)||0,k=d(S),E=b+k;m.setEdge(S.v,S.w,E),w=Math.max(w,m.node(S.v).out+=k),y=Math.max(y,m.node(S.w).in+=k)});var N=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(m.nodes(),function(S){h(N,_,m.node(S))}),{graph:m,buckets:N,zeroIdx:_}}function h(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 Fg}var zg,uE;function A4(){if(uE)return zg;uE=1;var e=at(),n=j4();zg={run:r,undo:o};function r(l){var u=l.graph().acyclicer==="greedy"?n(l,c(l)):i(l);e.forEach(u,function(h){var p=l.edge(h);l.removeEdge(h),p.forwardName=h.name,p.reversed=!0,l.setEdge(h.w,h.v,p,e.uniqueId("rev"))});function c(h){return function(p){return h.edge(p).weight}}}function i(l){var u=[],c={},h={};function p(d){e.has(h,d)||(h[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 h=c.forwardName;delete c.reversed,delete c.forwardName,l.setEdge(u.w,u.v,c,h)}})}return zg}var Bg,cE;function fn(){if(cE)return Bg;cE=1;var e=at(),n=tr().Graph;Bg={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:l,predecessorWeights:u,intersectRect:c,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:m,maxRank:y,partition:w,time:N,notime:_};function r(S,b,k,E){var T;do T=e.uniqueId(E);while(S.hasNode(T));return k.dummy=b,S.setNode(T,k),T}function i(S){var b=new n().setGraph(S.graph());return e.forEach(S.nodes(),function(k){b.setNode(k,S.node(k))}),e.forEach(S.edges(),function(k){var E=b.edge(k.v,k.w)||{weight:0,minlen:1},T=S.edge(k);b.setEdge(k.v,k.w,{weight:E.weight+T.weight,minlen:Math.max(E.minlen,T.minlen)})}),b}function o(S){var b=new n({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(k){S.children(k).length||b.setNode(k,S.node(k))}),e.forEach(S.edges(),function(k){b.setEdge(k,S.edge(k))}),b}function l(S){var b=e.map(S.nodes(),function(k){var E={};return e.forEach(S.outEdges(k),function(T){E[T.w]=(E[T.w]||0)+S.edge(T).weight}),E});return e.zipObject(S.nodes(),b)}function u(S){var b=e.map(S.nodes(),function(k){var E={};return e.forEach(S.inEdges(k),function(T){E[T.v]=(E[T.v]||0)+S.edge(T).weight}),E});return e.zipObject(S.nodes(),b)}function c(S,b){var k=S.x,E=S.y,T=b.x-k,I=b.y-E,O=S.width/2,A=S.height/2;if(!T&&!I)throw new Error("Not possible to find intersection inside of the rectangle");var U,z;return Math.abs(I)*O>Math.abs(T)*A?(I<0&&(A=-A),U=A*T/I,z=A):(T<0&&(O=-O),U=O,z=O*I/T),{x:k+U,y:E+z}}function h(S){var b=e.map(e.range(y(S)+1),function(){return[]});return e.forEach(S.nodes(),function(k){var E=S.node(k),T=E.rank;e.isUndefined(T)||(b[T][E.order]=k)}),b}function p(S){var b=e.min(e.map(S.nodes(),function(k){return S.node(k).rank}));e.forEach(S.nodes(),function(k){var E=S.node(k);e.has(E,"rank")&&(E.rank-=b)})}function d(S){var b=e.min(e.map(S.nodes(),function(I){return S.node(I).rank})),k=[];e.forEach(S.nodes(),function(I){var O=S.node(I).rank-b;k[O]||(k[O]=[]),k[O].push(I)});var E=0,T=S.graph().nodeRankFactor;e.forEach(k,function(I,O){e.isUndefined(I)&&O%T!==0?--E:E&&e.forEach(I,function(A){S.node(A).rank+=E})})}function m(S,b,k,E){var T={width:0,height:0};return arguments.length>=4&&(T.rank=k,T.order=E),r(S,"border",T,b)}function y(S){return e.max(e.map(S.nodes(),function(b){var k=S.node(b).rank;if(!e.isUndefined(k))return k}))}function w(S,b){var k={lhs:[],rhs:[]};return e.forEach(S,function(E){b(E)?k.lhs.push(E):k.rhs.push(E)}),k}function N(S,b){var k=e.now();try{return b()}finally{console.log(S+" time: "+(e.now()-k)+"ms")}}function _(S,b){return b()}return Bg}var Ug,dE;function I4(){if(dE)return Ug;dE=1;var e=at(),n=fn();Ug={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,h=l.node(c).rank,p=u.w,d=l.node(p).rank,m=u.name,y=l.edge(u),w=y.labelRank;if(d!==h+1){l.removeEdge(u);var N,_,S;for(S=0,++h;h<d;++S,++h)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:u,rank:h},N=n.addDummyNode(l,"edge",_,"_d"),h===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),l.setEdge(c,N,{weight:y.weight},m),S===0&&l.graph().dummyChains.push(N),c=N;l.setEdge(c,p,{weight:y.weight},m)}}function o(l){e.forEach(l.graph().dummyChains,function(u){var c=l.node(u),h=c.edgeLabel,p;for(l.setEdge(c.edgeObj,h);c.dummy;)p=l.successors(u)[0],l.removeNode(u),h.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(h.x=c.x,h.y=c.y,h.width=c.width,h.height=c.height),u=p,c=l.node(u)})}return Ug}var Hg,fE;function Tu(){if(fE)return Hg;fE=1;var e=at();Hg={longestPath:n,slack:r};function n(i){var o={};function l(u){var c=i.node(u);if(e.has(o,u))return c.rank;o[u]=!0;var h=e.min(e.map(i.outEdges(u),function(p){return l(p.w)-i.edge(p).minlen}));return(h===Number.POSITIVE_INFINITY||h===void 0||h===null)&&(h=0),c.rank=h}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 Hg}var Wg,hE;function FT(){if(hE)return Wg;hE=1;var e=at(),n=tr().Graph,r=Tu().slack;Wg=i;function i(c){var h=new n({directed:!1}),p=c.nodes()[0],d=c.nodeCount();h.setNode(p,{});for(var m,y;o(h,c)<d;)m=l(h,c),y=h.hasNode(m.v)?r(c,m):-r(c,m),u(h,c,y);return h}function o(c,h){function p(d){e.forEach(h.nodeEdges(d),function(m){var y=m.v,w=d===y?m.w:y;!c.hasNode(w)&&!r(h,m)&&(c.setNode(w,{}),c.setEdge(d,w,{}),p(w))})}return e.forEach(c.nodes(),p),c.nodeCount()}function l(c,h){return e.minBy(h.edges(),function(p){if(c.hasNode(p.v)!==c.hasNode(p.w))return r(h,p)})}function u(c,h,p){e.forEach(c.nodes(),function(d){h.node(d).rank+=p})}return Wg}var Vg,pE;function M4(){if(pE)return Vg;pE=1;var e=at(),n=FT(),r=Tu().slack,i=Tu().longestPath,o=tr().alg.preorder,l=tr().alg.postorder,u=fn().simplify;Vg=c,c.initLowLimValues=m,c.initCutValues=h,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=N,c.exchangeEdges=_;function c(E){E=u(E),i(E);var T=n(E);m(T),h(T,E);for(var I,O;I=w(T);)O=N(T,E,I),_(T,E,I,O)}function h(E,T){var I=l(E,E.nodes());I=I.slice(0,I.length-1),e.forEach(I,function(O){p(E,T,O)})}function p(E,T,I){var O=E.node(I),A=O.parent;E.edge(I,A).cutvalue=d(E,T,I)}function d(E,T,I){var O=E.node(I),A=O.parent,U=!0,z=T.edge(I,A),P=0;return z||(U=!1,z=T.edge(A,I)),P=z.weight,e.forEach(T.nodeEdges(I),function(D){var V=D.v===I,B=V?D.w:D.v;if(B!==A){var C=V===U,$=T.edge(D).weight;if(P+=C?$:-$,b(E,I,B)){var L=E.edge(I,B).cutvalue;P+=C?-L:L}}}),P}function m(E,T){arguments.length<2&&(T=E.nodes()[0]),y(E,{},1,T)}function y(E,T,I,O,A){var U=I,z=E.node(O);return T[O]=!0,e.forEach(E.neighbors(O),function(P){e.has(T,P)||(I=y(E,T,I,P,O))}),z.low=U,z.lim=I++,A?z.parent=A:delete z.parent,I}function w(E){return e.find(E.edges(),function(T){return E.edge(T).cutvalue<0})}function N(E,T,I){var O=I.v,A=I.w;T.hasEdge(O,A)||(O=I.w,A=I.v);var U=E.node(O),z=E.node(A),P=U,D=!1;U.lim>z.lim&&(P=z,D=!0);var V=e.filter(T.edges(),function(B){return D===k(E,E.node(B.v),P)&&D!==k(E,E.node(B.w),P)});return e.minBy(V,function(B){return r(T,B)})}function _(E,T,I,O){var A=I.v,U=I.w;E.removeEdge(A,U),E.setEdge(O.v,O.w,{}),m(E),h(E,T),S(E,T)}function S(E,T){var I=e.find(E.nodes(),function(A){return!T.node(A).parent}),O=o(E,I);O=O.slice(1),e.forEach(O,function(A){var U=E.node(A).parent,z=T.edge(A,U),P=!1;z||(z=T.edge(U,A),P=!0),T.node(A).rank=T.node(U).rank+(P?z.minlen:-z.minlen)})}function b(E,T,I){return E.hasEdge(T,I)}function k(E,T,I){return I.low<=T.lim&&T.lim<=I.lim}return Vg}var Gg,mE;function O4(){if(mE)return Gg;mE=1;var e=Tu(),n=e.longestPath,r=FT(),i=M4();Gg=o;function o(h){switch(h.graph().ranker){case"network-simplex":c(h);break;case"tight-tree":u(h);break;case"longest-path":l(h);break;default:c(h)}}var l=n;function u(h){n(h),r(h)}function c(h){i(h)}return Gg}var Yg,gE;function P4(){if(gE)return Yg;gE=1;var e=at();Yg=n;function n(o){var l=i(o);e.forEach(o.graph().dummyChains,function(u){for(var c=o.node(u),h=c.edgeObj,p=r(o,l,h.v,h.w),d=p.path,m=p.lca,y=0,w=d[y],N=!0;u!==h.w;){if(c=o.node(u),N){for(;(w=d[y])!==m&&o.node(w).maxRank<c.rank;)y++;w===m&&(N=!1)}if(!N){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 h=[],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),h.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:h.concat(p.reverse()),lca:w}}function i(o){var l={},u=0;function c(h){var p=u;e.forEach(o.children(h),c),l[h]={low:p,lim:u++}}return e.forEach(o.children(),c),l}return Yg}var Kg,vE;function L4(){if(vE)return Kg;vE=1;var e=at(),n=fn();Kg={run:r,cleanup:u};function r(c){var h=n.addDummyNode(c,"root",{},"_root"),p=o(c),d=e.max(e.values(p))-1,m=2*d+1;c.graph().nestingRoot=h,e.forEach(c.edges(),function(w){c.edge(w).minlen*=m});var y=l(c)+1;e.forEach(c.children(),function(w){i(c,h,m,y,d,p,w)}),c.graph().nodeRankFactor=m}function i(c,h,p,d,m,y,w){var N=c.children(w);if(!N.length){w!==h&&c.setEdge(h,w,{weight:0,minlen:p});return}var _=n.addBorderNode(c,"_bt"),S=n.addBorderNode(c,"_bb"),b=c.node(w);c.setParent(_,w),b.borderTop=_,c.setParent(S,w),b.borderBottom=S,e.forEach(N,function(k){i(c,h,p,d,m,y,k);var E=c.node(k),T=E.borderTop?E.borderTop:k,I=E.borderBottom?E.borderBottom:k,O=E.borderTop?d:2*d,A=T!==I?1:m-y[w]+1;c.setEdge(_,T,{weight:O,minlen:A,nestingEdge:!0}),c.setEdge(I,S,{weight:O,minlen:A,nestingEdge:!0})}),c.parent(w)||c.setEdge(h,_,{weight:0,minlen:m+y[w]})}function o(c){var h={};function p(d,m){var y=c.children(d);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),h[d]=m}return e.forEach(c.children(),function(d){p(d,1)}),h}function l(c){return e.reduce(c.edges(),function(h,p){return h+c.edge(p).weight},0)}function u(c){var h=c.graph();c.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(c.edges(),function(p){var d=c.edge(p);d.nestingEdge&&c.removeEdge(p)})}return Kg}var Xg,yE;function q4(){if(yE)return Xg;yE=1;var e=at(),n=fn();Xg=r;function r(o){function l(u){var c=o.children(u),h=o.node(u);if(c.length&&e.forEach(c,l),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,d=h.maxRank+1;p<d;++p)i(o,"borderLeft","_bl",u,h,p),i(o,"borderRight","_br",u,h,p)}}e.forEach(o.children(),l)}function i(o,l,u,c,h,p){var d={width:0,height:0,rank:p,borderType:l},m=h[l][p-1],y=n.addDummyNode(o,"border",d,u);h[l][p]=y,o.setParent(y,c),m&&o.setEdge(m,y,{weight:1})}return Xg}var Qg,wE;function $4(){if(wE)return Qg;wE=1;var e=at();Qg={adjust:n,undo:r};function n(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){h(p.node(d))}),e.forEach(p.edges(),function(d){var m=p.edge(d);e.forEach(m.points,h),e.has(m,"x")&&h(m)})}function h(p){var d=p.x;p.x=p.y,p.y=d}return Qg}var Zg,xE;function D4(){if(xE)return Zg;xE=1;var e=at();Zg=n;function n(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 h=e.sortBy(o,function(p){return r.node(p).rank});return e.forEach(h,c),u}return Zg}var Jg,_E;function F4(){if(_E)return Jg;_E=1;var e=at();Jg=n;function n(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),h=1;h<l.length;)h<<=1;var p=2*h-1;h-=1;var d=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(c.forEach(function(y){var w=y.pos+h;d[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=d[w+1]),w=w-1>>1,d[w]+=y.weight;m+=y.weight*N})),m}return Jg}var ev,bE;function z4(){if(bE)return ev;bE=1;var e=at();ev=n;function n(r,i){return e.map(i,function(o){var l=r.inEdges(o);if(l.length){var u=e.reduce(l,function(c,h){var p=r.edge(h),d=r.node(h.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 ev}var tv,SE;function B4(){if(SE)return tv;SE=1;var e=at();tv=n;function n(o,l){var u={};e.forEach(o,function(h,p){var d=u[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:p};e.isUndefined(h.barycenter)||(d.barycenter=h.barycenter,d.weight=h.weight)}),e.forEach(l.edges(),function(h){var p=u[h.v],d=u[h.w];!e.isUndefined(p)&&!e.isUndefined(d)&&(d.indegree++,p.out.push(u[h.w]))});var c=e.filter(u,function(h){return!h.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 h=o.pop();l.push(h),e.forEach(h.in.reverse(),u(h)),e.forEach(h.out,c(h))}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 tv}var nv,kE;function U4(){if(kE)return nv;kE=1;var e=at(),n=fn();nv=r;function r(l,u){var c=n.partition(l,function(_){return e.has(_,"barycenter")}),h=c.lhs,p=e.sortBy(c.rhs,function(_){return-_.i}),d=[],m=0,y=0,w=0;h.sort(o(!!u)),w=i(d,p,w),e.forEach(h,function(_){w+=_.vs.length,d.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,w=i(d,p,w)});var N={vs:e.flatten(d,!0)};return y&&(N.barycenter=m/y,N.weight=y),N}function i(l,u,c){for(var h;u.length&&(h=e.last(u)).i<=c;)u.pop(),l.push(h.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 nv}var rv,EE;function H4(){if(EE)return rv;EE=1;var e=at(),n=z4(),r=B4(),i=U4();rv=o;function o(c,h,p,d){var m=c.children(h),y=c.node(h),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,_={};w&&(m=e.filter(m,function(I){return I!==w&&I!==N}));var S=n(c,m);e.forEach(S,function(I){if(c.children(I.v).length){var O=o(c,I.v,p,d);_[I.v]=O,e.has(O,"barycenter")&&u(I,O)}});var b=r(S,p);l(b,_);var k=i(b,d);if(w&&(k.vs=e.flatten([w,k.vs,N],!0),c.predecessors(w).length)){var E=c.node(c.predecessors(w)[0]),T=c.node(c.predecessors(N)[0]);e.has(k,"barycenter")||(k.barycenter=0,k.weight=0),k.barycenter=(k.barycenter*k.weight+E.order+T.order)/(k.weight+2),k.weight+=2}return k}function l(c,h){e.forEach(c,function(p){p.vs=e.flatten(p.vs.map(function(d){return h[d]?h[d].vs:d}),!0)})}function u(c,h){e.isUndefined(c.barycenter)?(c.barycenter=h.barycenter,c.weight=h.weight):(c.barycenter=(c.barycenter*c.weight+h.barycenter*h.weight)/(c.weight+h.weight),c.weight+=h.weight)}return rv}var sv,NE;function W4(){if(NE)return sv;NE=1;var e=at(),n=tr().Graph;sv=r;function r(o,l,u){var c=i(o),h=new n({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)&&(h.setNode(p),h.setParent(p,m||c),e.forEach(o[u](p),function(y){var w=y.v===p?y.w:y.v,N=h.edge(w,p),_=e.isUndefined(N)?0:N.weight;h.setEdge(w,p,{weight:o.edge(y).weight+_})}),e.has(d,"minRank")&&h.setNode(p,{borderLeft:d.borderLeft[l],borderRight:d.borderRight[l]}))}),h}function i(o){for(var l;o.hasNode(l=e.uniqueId("_root")););return l}return sv}var iv,CE;function V4(){if(CE)return iv;CE=1;var e=at();iv=n;function n(r,i,o){var l={},u;e.forEach(o,function(c){for(var h=r.parent(c),p,d;h;){if(p=r.parent(h),p?(d=l[p],l[p]=h):(d=u,u=h),d&&d!==h){i.setEdge(d,h);return}h=p}})}return iv}var ov,TE;function G4(){if(TE)return ov;TE=1;var e=at(),n=D4(),r=F4(),i=H4(),o=W4(),l=V4(),u=tr().Graph,c=fn();ov=h;function h(y){var w=c.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),S=n(y);m(y,S);for(var b=Number.POSITIVE_INFINITY,k,E=0,T=0;T<4;++E,++T){d(E%2?N:_,E%4>=2),S=c.buildLayerMatrix(y);var I=r(y,S);I<b&&(T=0,k=e.cloneDeep(S),b=I)}m(y,k)}function p(y,w,N){return e.map(w,function(_){return o(y,_,N)})}function d(y,w){var N=new u;e.forEach(y,function(_){var S=_.graph().root,b=i(_,S,N,w);e.forEach(b.vs,function(k,E){_.node(k).order=E}),l(_,N,b.vs)})}function m(y,w){e.forEach(w,function(N){e.forEach(N,function(_,S){y.node(_).order=S})})}return ov}var av,RE;function Y4(){if(RE)return av;RE=1;var e=at(),n=tr().Graph,r=fn();av={positionX:N,findType1Conflicts:i,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function i(b,k){var E={};function T(I,O){var A=0,U=0,z=I.length,P=e.last(O);return e.forEach(O,function(D,V){var B=l(b,D),C=B?b.node(B).order:z;(B||D===P)&&(e.forEach(O.slice(U,V+1),function($){e.forEach(b.predecessors($),function(L){var re=b.node(L),J=re.order;(J<A||C<J)&&!(re.dummy&&b.node($).dummy)&&u(E,L,$)})}),U=V+1,A=C)}),O}return e.reduce(k,T),E}function o(b,k){var E={};function T(O,A,U,z,P){var D;e.forEach(e.range(A,U),function(V){D=O[V],b.node(D).dummy&&e.forEach(b.predecessors(D),function(B){var C=b.node(B);C.dummy&&(C.order<z||C.order>P)&&u(E,B,D)})})}function I(O,A){var U=-1,z,P=0;return e.forEach(A,function(D,V){if(b.node(D).dummy==="border"){var B=b.predecessors(D);B.length&&(z=b.node(B[0]).order,T(A,P,V,U,z),P=V,U=z)}T(A,P,A.length,z,O.length)}),A}return e.reduce(k,I),E}function l(b,k){if(b.node(k).dummy)return e.find(b.predecessors(k),function(E){return b.node(E).dummy})}function u(b,k,E){if(k>E){var T=k;k=E,E=T}var I=b[k];I||(b[k]=I={}),I[E]=!0}function c(b,k,E){if(k>E){var T=k;k=E,E=T}return e.has(b[k],E)}function h(b,k,E,T){var I={},O={},A={};return e.forEach(k,function(U){e.forEach(U,function(z,P){I[z]=z,O[z]=z,A[z]=P})}),e.forEach(k,function(U){var z=-1;e.forEach(U,function(P){var D=T(P);if(D.length){D=e.sortBy(D,function(L){return A[L]});for(var V=(D.length-1)/2,B=Math.floor(V),C=Math.ceil(V);B<=C;++B){var $=D[B];O[P]===P&&z<A[$]&&!c(E,P,$)&&(O[$]=P,O[P]=I[P]=I[$],z=A[$])}}})}),{root:I,align:O}}function p(b,k,E,T,I){var O={},A=d(b,k,E,I),U=I?"borderLeft":"borderRight";function z(V,B){for(var C=A.nodes(),$=C.pop(),L={};$;)L[$]?V($):(L[$]=!0,C.push($),C=C.concat(B($))),$=C.pop()}function P(V){O[V]=A.inEdges(V).reduce(function(B,C){return Math.max(B,O[C.v]+A.edge(C))},0)}function D(V){var B=A.outEdges(V).reduce(function($,L){return Math.min($,O[L.w]-A.edge(L))},Number.POSITIVE_INFINITY),C=b.node(V);B!==Number.POSITIVE_INFINITY&&C.borderType!==U&&(O[V]=Math.max(O[V],B))}return z(P,A.predecessors.bind(A)),z(D,A.successors.bind(A)),e.forEach(T,function(V){O[V]=O[E[V]]}),O}function d(b,k,E,T){var I=new n,O=b.graph(),A=_(O.nodesep,O.edgesep,T);return e.forEach(k,function(U){var z;e.forEach(U,function(P){var D=E[P];if(I.setNode(D),z){var V=E[z],B=I.edge(V,D);I.setEdge(V,D,Math.max(A(b,P,z),B||0))}z=P})}),I}function m(b,k){return e.minBy(e.values(k),function(E){var T=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;return e.forIn(E,function(O,A){var U=S(b,A)/2;T=Math.max(O+U,T),I=Math.min(O-U,I)}),T-I})}function y(b,k){var E=e.values(k),T=e.min(E),I=e.max(E);e.forEach(["u","d"],function(O){e.forEach(["l","r"],function(A){var U=O+A,z=b[U],P;if(z!==k){var D=e.values(z);P=A==="l"?T-e.min(D):I-e.max(D),P&&(b[U]=e.mapValues(z,function(V){return V+P}))}})})}function w(b,k){return e.mapValues(b.ul,function(E,T){if(k)return b[k.toLowerCase()][T];var I=e.sortBy(e.map(b,T));return(I[1]+I[2])/2})}function N(b){var k=r.buildLayerMatrix(b),E=e.merge(i(b,k),o(b,k)),T={},I;e.forEach(["u","d"],function(A){I=A==="u"?k:e.values(k).reverse(),e.forEach(["l","r"],function(U){U==="r"&&(I=e.map(I,function(V){return e.values(V).reverse()}));var z=(A==="u"?b.predecessors:b.successors).bind(b),P=h(b,I,E,z),D=p(b,I,P.root,P.align,U==="r");U==="r"&&(D=e.mapValues(D,function(V){return-V})),T[A+U]=D})});var O=m(b,T);return y(T,O),w(T,b.graph().align)}function _(b,k,E){return function(T,I,O){var A=T.node(I),U=T.node(O),z=0,P;if(z+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":P=-A.width/2;break;case"r":P=A.width/2;break}if(P&&(z+=E?P:-P),P=0,z+=(A.dummy?k:b)/2,z+=(U.dummy?k:b)/2,z+=U.width/2,e.has(U,"labelpos"))switch(U.labelpos.toLowerCase()){case"l":P=U.width/2;break;case"r":P=-U.width/2;break}return P&&(z+=E?P:-P),P=0,z}}function S(b,k){return b.node(k).width}return av}var lv,jE;function K4(){if(jE)return lv;jE=1;var e=at(),n=fn(),r=Y4().positionX;lv=i;function i(l){l=n.asNonCompoundGraph(l),o(l),e.forEach(r(l),function(u,c){l.node(c).x=u})}function o(l){var u=n.buildLayerMatrix(l),c=l.graph().ranksep,h=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=h+d/2}),h+=d+c})}return lv}var uv,AE;function X4(){if(AE)return uv;AE=1;var e=at(),n=A4(),r=I4(),i=O4(),o=fn().normalizeRanks,l=P4(),u=fn().removeEmptyRanks,c=L4(),h=q4(),p=$4(),d=G4(),m=K4(),y=fn(),w=tr().Graph;uv=N;function N(q,Q){var ne=Q&&Q.debugTiming?y.time:y.notime;ne("layout",function(){var ae=ne(" buildLayoutGraph",function(){return z(q)});ne(" runLayout",function(){_(ae,ne)}),ne(" updateInputGraph",function(){S(q,ae)})})}function _(q,Q){Q(" makeSpaceForEdgeLabels",function(){P(q)}),Q(" removeSelfEdges",function(){W(q)}),Q(" acyclic",function(){n.run(q)}),Q(" nestingGraph.run",function(){c.run(q)}),Q(" rank",function(){i(y.asNonCompoundGraph(q))}),Q(" injectEdgeLabelProxies",function(){D(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(){B(q)}),Q(" normalize.run",function(){r.run(q)}),Q(" parentDummyChains",function(){l(q)}),Q(" addBorderSegments",function(){h(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(){M(q)}),Q(" removeBorderNodes",function(){J(q)}),Q(" normalize.undo",function(){r.undo(q)}),Q(" fixupEdgeLabelCoords",function(){L(q)}),Q(" undoCoordinateSystem",function(){p.undo(q)}),Q(" translateGraph",function(){C(q)}),Q(" assignNodeIntersects",function(){$(q)}),Q(" reversePoints",function(){re(q)}),Q(" acyclic.undo",function(){n.undo(q)})}function S(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 b=["nodesep","edgesep","ranksep","marginx","marginy"],k={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],T=["width","height"],I={width:0,height:0},O=["minlen","weight","width","height","labeloffset"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},U=["labelpos"];function z(q){var Q=new w({multigraph:!0,compound:!0}),ne=K(q.graph());return Q.setGraph(e.merge({},k,G(ne,b),e.pick(ne,E))),e.forEach(q.nodes(),function(ae){var fe=K(q.node(ae));Q.setNode(ae,e.defaults(G(fe,T),I)),Q.setParent(ae,q.parent(ae))}),e.forEach(q.edges(),function(ae){var fe=K(q.edge(ae));Q.setEdge(ae,e.merge({},A,G(fe,O),e.pick(fe,U)))}),Q}function P(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 D(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 B(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(je){var ye=je.x,Ee=je.y,Ye=je.width,we=je.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(je){ve(q.node(je))}),e.forEach(q.edges(),function(je){var ye=q.edge(je);e.has(ye,"x")&&ve(ye)}),Q-=ce,ae-=Ce,e.forEach(q.nodes(),function(je){var ye=q.node(je);ye.x-=Q,ye.y-=ae}),e.forEach(q.edges(),function(je){var ye=q.edge(je);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 $(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 L(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 M(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 uv}var cv,IE;function Q4(){if(IE)return cv;IE=1;var e=at(),n=fn(),r=tr().Graph;cv={debugOrdering:i};function i(o){var l=n.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,h){var p="layer"+h;u.setNode(p,{rank:"same"}),e.reduce(c,function(d,m){return u.setEdge(d,m,{style:"invis"}),m})}),u}return cv}var dv,ME;function Z4(){return ME||(ME=1,dv="0.8.5"),dv}var fv,OE;function J4(){return OE||(OE=1,fv={graphlib:tr(),layout:X4(),debug:Q4(),util:{time:fn().time,notime:fn().notime},version:Z4()}),fv}var e5=J4();const PE=Dv(e5),vo=240,Ru=130,uo=74,tc=72,LE=uo+tc;function t5(e,n){var i;let r=vo;for(const o of e)r=Math.max(r,((i=n.get(o.id))==null?void 0:i.width)??vo);return r}const zT=420,n5=2;function Ea(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function r5(e,n){return((n==null?void 0:n.get(e))??0)>0?zT:0}function s5(e,n){const r=(n==null?void 0:n.get(e))??0;return r>0?6+r*36:0}function Na(e,n,r){const i=n.get(e);return{w:((i==null?void 0:i.width)??vo)+r5(e,r),h:Math.max((i==null?void 0:i.height)??Ru,s5(e,r))}}function i5(e){return[...e.keys()].sort().map(n=>`${n}:${e.get(n)}`).join("|")}function o5(e,n,r,i,o,l){const u=new PE.graphlib.Graph;u.setDefaultEdgeLabel(()=>({})),u.setGraph({rankdir:r,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const c=e.filter(b=>!o.has(b)),h=new Set(c);for(const b of c){const{w:k,h:E}=Na(b,i,l);u.setNode(b,{width:k,height:E})}for(const b of n)h.has(b.source)&&h.has(b.target)&&u.setEdge(b.source,b.target);PE.layout(u);const p=new Map;let d=1/0,m=1/0,y=-1/0,w=-1/0;for(const b of c){const k=u.node(b);if(!k)continue;const E=i.get(b),T=(E==null?void 0:E.width)??vo,I=(E==null?void 0:E.height)??Ru,O=Na(b,i,l),A=k.x-O.w/2,U=k.y-O.h/2;p.set(b,{x:A,y:U}),A<d&&(d=A),U<m&&(m=U),A+T>y&&(y=A+T),U+I>w&&(w=U+I)}if(Number.isFinite(d)&&Number.isFinite(m))for(const[b,k]of p)p.set(b,{x:k.x-d,y:k.y-m});const N=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-m:0;let S=null;for(const b of e){const k=o.get(b);if(!k)continue;const E=i.get(b),T=(E==null?void 0:E.width)??vo,I=(E==null?void 0:E.height)??Ru;S=S===null?{minX:k.x,minY:k.y,maxX:k.x+T,maxY:k.y+I}:{minX:Math.min(S.minX,k.x),minY:Math.min(S.minY,k.y),maxX:Math.max(S.maxX,k.x+T),maxY:Math.max(S.maxY,k.y+I)}}return{positions:p,width:N,height:_,pinnedBox:S}}function a5(e,n,r={}){const i=r.direction??"LR",o=r.pinned??new Map,l=r.measured??new Map,u=r.lanes,c=new Map;for(const b of e){const k=Ea(b),E=c.get(k);E?E.push(b.id):c.set(k,[b.id])}const p=Array.from(c.keys()).sort().map(b=>({sid:b,...o5(c.get(b),n,i,l,o,u)})),d=t5(e,l),m=r.availableHeight&&r.availableHeight>0?r.availableHeight:Number.POSITIVE_INFINITY,y=b=>{const k=[[]];let E=0;for(const T of p)k.length<b&&E>0&&E+T.height>m&&(k.push([]),E=0),k[k.length-1].push(T),E+=T.height+LE;return k},w=b=>b.reduce((k,E)=>Math.max(k,E.width),0)+zT;let N=y(r.availableWidth?n5:1);N.length>1&&N.reduce((k,E)=>k+w(E),0)+d*(N.length-1)>(r.availableWidth??0)&&(N=y(1));const _=new Map;let S=0;for(const b of N){const k=w(b);let E=0;for(const{positions:T,height:I,pinnedBox:O}of b){for(const[U,z]of T)_.set(U,{x:z.x+S,y:z.y+E});let A=E+I;O&&O.maxY>A&&O.minX<S+k&&S<O.maxX&&(A=O.maxY),E=A+LE}S+=k+d}return e.map(b=>{const k=o.get(b.id);if(k)return{...b,position:k};const E=_.get(b.id);return E?{...b,position:E}:b})}function l5(e,n,r,i,o){const u=uo+tc,c=60,h=w=>Na(w,i,o),p=new Map(e.map(w=>[w.id,Ea(w)])),d=[],m=e.map(w=>({id:w.id,pos:r.get(w.id)??n.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of m){const{w:_,h:S}=h(w),b=p.get(w)??"_default";if(r.has(w)){d.push({x:N.x,y:N.y,w:_,h:S,sid:b});continue}let k=N.y;for(let E=0;E<d.length+1;E++){const T=d.find(I=>{const O=I.sid===b?24:c,A=I.sid===b?24:u;return N.x<I.x+I.w+O&&I.x<N.x+_+O&&k<I.y+I.h+A&&I.y<k+S+A});if(!T)break;k=T.y+T.h+(T.sid===b?24:u)}k!==N.y&&(n.set(w,{x:N.x,y:k}),y.push(w)),d.push({x:N.x,y:k,w:_,h:S,sid:b})}return y}function u5(e,n,r,i,o,l){const u=_=>Na(_,i,l),c=_=>r.get(_)??n.get(_),h=new Map;for(const _ of e){if(!c(_.id))continue;const S=Ea(_),b=h.get(S);b?b.push(_):h.set(S,[_])}const p=new Set;for(const[_,S]of h)S.every(b=>o.has(b.id)&&!r.has(b.id))&&p.add(_);const d=new Map,m=[];for(const _ of e){const S=c(_.id);if(!S)continue;const{w:b,h:k}=u(_.id),E=Ea(_);p.has(E)?(d.get(E)??d.set(E,[]).get(E)).push(_):m.push({x:S.x,y:S.y,w:b,h:k})}if(d.size===0)return[];const y=uo+tc,w=(_,S,b,k)=>m.some(E=>_<E.x+E.w+uo&&E.x<_+b+uo&&S<E.y+E.h+y&&E.y<S+k+y),N=[];for(const _ of[...d.keys()].sort()){const S=d.get(_);let b=1/0,k=1/0,E=-1/0,T=-1/0;for(const D of S){const V=c(D.id),{w:B,h:C}=u(D.id);b=Math.min(b,V.x),k=Math.min(k,V.y),E=Math.max(E,V.x+B),T=Math.max(T,V.y+C)}const I=E-b,O=T-k,A=[...new Set(m.map(D=>Math.round(D.x)))].sort((D,V)=>D-V),U=A.length?A:[b],z=[0,...m.map(D=>D.y+D.h+y)].sort((D,V)=>D-V);let P=null;e:for(const D of U)for(const V of z){if(V>=k)break;if(!w(D,V,I,O)){P={x:D,y:V};break e}}if(P){const D=P.x-b,V=P.y-k;for(const B of S){const C=c(B.id);n.set(B.id,{x:C.x+D,y:C.y+V})}N.push(_)}for(const D of S){const V=c(D.id),{w:B,h:C}=u(D.id);m.push({x:V.x,y:V.y,w:B,h:C})}}return N}function c5(e,n,r,i,o,l=!1,u){const p=uo+tc+1,d=8,m=1.75,y=200,w=.7,N=.01,_=P=>Na(P,i,u),S=P=>r.get(P)??n.get(P),b=new Map;for(const P of e){if(!S(P.id))continue;const D=Ea(P),V=b.get(D);V?V.push(P):b.set(D,[P])}const k=[],E=new Set,T=new Set,I=o.size===0;for(const P of[...b.keys()].sort()){const D=b.get(P);let V=1/0,B=1/0,C=-1/0,$=-1/0,L=!1;for(const Z of D){const M=S(Z.id),{w:G,h:K}=_(Z.id);V=Math.min(V,M.x),B=Math.min(B,M.y),C=Math.max(C,M.x+G),$=Math.max($,M.y+K),r.has(Z.id)&&(L=!0)}const re=C-V,J=$-B;T.add(P);const W=o.get(P);W&&(re>W.w+d||J>W.h+d)&&E.add(P),o.set(P,{w:re,h:J}),k.push({sid:P,members:D.map(Z=>Z.id),x:V,y:B,w:re,h:J,anchored:L,mass:1})}for(const P of[...o.keys()])T.has(P)||o.delete(P);if(l||I)return[];let O=!1;for(let P=0;P<k.length&&!O;P++)for(let D=P+1;D<k.length;D++){const V=k[P],B=k[D];if(!(V.anchored&&B.anchored)&&Math.abs(V.x+V.w/2-(B.x+B.w/2))<(V.w+B.w)/2+61&&Math.abs(V.y+V.h/2-(B.y+B.h/2))<(V.h+B.h)/2+p){O=!0;break}}if(E.size===0&&!O)return[];if(E.size>0)for(const P of k)E.has(P.sid)&&(P.mass=8);else for(const P of k)P.mass=Math.max(1,P.w*P.h/(vo*Ru));const A=new Map(k.map(P=>[P.sid,P.x])),U=new Map(k.map(P=>[P.sid,P.y]));for(let P=0;P<y;P++){const D=new Map,V=new Map;let B=0;for(let C=0;C<k.length;C++)for(let $=C+1;$<k.length;$++){const L=k[C],re=k[$];if(L.anchored&&re.anchored)continue;const J=L.x+L.w/2,W=L.y+L.h/2,Z=re.x+re.w/2,M=re.y+re.h/2,G=(L.w+re.w)/2+61-Math.abs(J-Z),K=(L.h+re.h)/2+p-Math.abs(W-M);if(G<=0||K<=0)continue;const q=($e,Je)=>!$e.anchored&&!(Je<0&&$e.x<=0),Q=($e,Je)=>!$e.anchored&&!(Je<0&&$e.y<=0),ne=($e,Je,Xe)=>{const Ot=$e===Je,lt=Ot?L.sid<re.sid?-1:1:Math.sign($e-Je);return Xe(L,lt)||Xe(re,-lt)?lt:Ot&&(Xe(L,-lt)||Xe(re,lt))?-lt:0},ae=ne(J,Z,q),fe=ne(W,M,Q),te=ae!==0,ce=fe!==0;if(!te&&!ce)continue;const Ce=te&&(!ce||G*m<K),[ve,je,ye,Ee]=Ce?[ae,G,D,q]:[fe,K,V,Q],Ye=Ee(L,ve),we=Ee(re,-ve),_e=L.mass,Be=re.mass,it=Ye?we?Be/(_e+Be):1:0,ft=we?Ye?_e/(_e+Be):1:0,Ze=je*w;ye.set(L.sid,(ye.get(L.sid)??0)+ve*Ze*it),ye.set(re.sid,(ye.get(re.sid)??0)-ve*Ze*ft),B+=Ze}for(const C of k)C.anchored||(C.x=Math.max(0,C.x+(D.get(C.sid)??0)),C.y=Math.max(0,C.y+(V.get(C.sid)??0)));if(B<N)break}const z=[];for(const P of k){const D=P.x-A.get(P.sid),V=P.y-U.get(P.sid);if(!(Math.abs(D)<1&&Math.abs(V)<1)){for(const B of P.members){if(r.has(B))continue;const C=n.get(B);C&&n.set(B,{x:C.x+D,y:C.y+V})}z.push(P.sid)}}return z}const d5=600;function Pv(e,n){return!(e.exitAt!=null&&n-e.exitAt>d5||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function f5(e,n){const r=new Set;for(const i of e.agents.values())Pv(i,n)&&r.add(i.id);return r}function h5(e,n,r=0){return e.right+r>n.left&&e.left-r<n.right&&e.bottom+r>n.top&&e.top-r<n.bottom}function p5(e,n,r=0){if(!e)return!1;for(const i of n)if(h5(e,i,r))return!0;return!1}const BT="sessionGroup";function m5(e,n){var i;if(e.type===BT)return"transparent";const r=(i=e.data)==null?void 0:i.state;return n(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const g5="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1).";function v5(e){if(e.checkDisabled)return g5;if(e.checking)return"Asking npm for the newest release…";const n=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`${n}${r} · re-checked periodically · click to check npm now`}function y5(e){const n=`Version v${e.running}`;return e.checkDisabled?`${n}, update checks are off`:e.checking?`${n}, checking npm for a newer release`:`${n}, check npm for a newer release`}function w5(e){const n=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}, ${n} — ${e.open?"hide":"show"} the notice`}function x5(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 n=e.trim();return n===""?{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:n,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const Lv={kind:"assumed",claude:!0,codex:!0};function _5(e){if(!e||typeof e!="object")return Lv;const n=e.providers;if(!n||typeof n!="object")return Lv;const r=n;return{kind:"reported",claude:r.claude!==!1,codex:r.codex!==!1}}function b5(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}function S5(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 k5(e){const n=b5(e);return n?`Distinct sessions — ${n}`:"Distinct sessions"}function E5(e){const n=S5(e);return n?`Total events received — ${n}`:"Total events received"}function N5(e){const n=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[n,r]}function C5(e,n){const r=n.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?`
67
+
68
+ 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=n.clash>0?`
69
+
70
+ ${n.clash} sound hook${n.clash>1?"s":""} of your own in settings.json also run${n.clash>1?"":"s"} here.`:"",l=n.parked>0?`
71
+
72
+ ${n.parked} of your own sound hook${n.parked>1?"s were":" was"} set aside so this switch actually controls the sound. Nothing was deleted — shift-click to put ${n.parked>1?"them":"it"} back.`:"";return r+i+o+l}function UT(e){const n=Math.max(0,Math.floor(e));return`${n} event${n===1?"":"s"}`}function T5(e){return e.connected?e.paused?{tone:"paused",label:"paused",title:e.held>0?`Connected — ${UT(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 R5(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:`${UT(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 HT(e,n){return e!==""&&n>0}function j5(e,n,r){return e===""?{active:!1,matched:n,total:r,count:null,empty:!1,message:null,dim:!1}:{active:!0,matched:n,total:r,count:`${n} of ${r}`,empty:n===0,message:n===0?`No agents match “${e}”`:null,dim:HT(e,n)}}const A5="Search agents, tools, model…";function WT(e,n){var i,o,l,u;if(!n)return!0;const r=n.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)||js(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 ca(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const I5={agent:sL,sessionGroup:gL},VT="react-flow__node";function qE(e){var n,r;return!!e&&((r=(n=e.classList)==null?void 0:n.contains)==null?void 0:r.call(n,VT))===!0}function M5(e){try{const n=document.querySelector(`.${VT}[data-id="${CSS.escape(e)}"]`);n==null||n.focus({preventScroll:!0})}catch{}}const O5=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),P5=420,lu=18,L5=200,q5=5*6e4,$5=6,D5=2*6e4,Ny="agent-dag.layout",Cy="agent-dag.viewport",GT="agent-dag.summariesDismissed",YT="agent-dag.sessionListOpen",KT="agent-dag.detailOpen",XT="agent-dag.usagePanelOpen",$E="agent-dag.accountsPanelOpen",DE="agent-dag.versionNoticeDismissed",FE="agent-dag.oldNameNoticeDismissed",F5=15*6e4,zE={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:"},BE="agent-dag.autoRestart",UE="agent-dag.bundleReloadedFor";function z5(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(YT)==="1"}catch{return!1}}function B5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(YT,e?"1":"0")}catch{}}function U5(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(KT)==="1"}catch{return!1}}function H5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(KT,e?"1":"0")}catch{}}function W5(){const e=FC(XT);return e===null?!0:e==="1"}function V5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(XT,e?"1":"0")}catch{}}function G5(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(GT);if(!e)return new Set;const n=JSON.parse(e);return new Set(Array.isArray(n)?n.filter(r=>typeof r=="string"):[])}catch{return new Set}}function HE(e){if(!(typeof window>"u"))try{const n=Array.from(e),r=n.length>200?n.slice(-200):n;window.localStorage.setItem(GT,JSON.stringify(r))}catch{}}function Y5(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const n=window.localStorage.getItem(Ny);if(!n)return e;const r=JSON.parse(n);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 hv(e,n){if(!(typeof window>"u"))try{const r={};for(const[i,o]of e)r[i]=o;for(const[i,o]of n)r[i]=o;window.localStorage.setItem(Ny,JSON.stringify({v:2,positions:r,pins:Array.from(n.keys())}))}catch{}}function K5(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Cy);if(!e)return null;const n=JSON.parse(e);return typeof(n==null?void 0:n.x)!="number"||typeof(n==null?void 0:n.y)!="number"||typeof(n==null?void 0:n.zoom)!="number"?null:n}catch{return null}}function X5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Cy,JSON.stringify(e))}catch{}}function WE(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Ny)}catch{}try{window.localStorage.removeItem(Cy)}catch{}}}function Q5(e,n){const r=e.agents.get(n);if(!r)return;const i=[];for(const d of e.agents.values())d.sessionId===n&&i.push(d);const o={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:n,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),h=document.createElement("a"),p=(r.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=c,h.download=`${Gt}-${p}-${n.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const qv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},$v={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},QT=RC;function Z5(e,n){if(!n)return null;const r=new Set([n]);let i=n;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 J5(e,n,r,i,o,l,u,c,h,p,d,m,y,w,N,_,S,b,k){const E=[],T=[],I=new Set;if(l)for(const B of e.agents.values())b.has(B.id)&&WT(B,l)&&I.add(B.id);const O=HT(l,I.size);for(const B of e.agents.values()){if(!b.has(B.id))continue;const C=O&&!I.has(B.id),$=B.exitAt!=null,L=S!=null&&!S.has(B.id),re=[C?"rf-dim":"",$?"rf-exiting":"",L?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,J=u.get(B.id);if(E.push({id:B.id,type:"agent",position:{x:0,y:0},data:{...B,now:n,onOpenContext:k},className:re,...J?{width:J.width,height:J.height}:null}),B.parentId&&b.has(B.parentId)){const W=ry(B.sessionId),Z=l&&!I.has(B.id)&&!I.has(B.parentId),M=$,G=_.size>0&&(_.has(B.id)||_.has(B.parentId)),K=S!=null&&!S.has(B.id)&&!S.has(B.parentId),q=B.state==="active"?2:1.5,Q=G?q+1.5:q,ne=Z||M?.2:K?.12:1,ae=["sess-edge",B.state==="active"?"sess-live":"sess-idle",M?"rf-edge-exiting":"",G?"rf-edge-selected":""].filter(Boolean).join(" ");T.push({id:`e:${B.parentId}->${B.id}`,source:B.parentId,target:B.id,animated:(B.state==="active"||G)&&!Z&&!M,type:"smoothstep",style:{"--session-hue":W,strokeWidth:Q,opacity:ne,transition:"var(--edge-transition)"},className:ae})}}const A=new Map;for(const B of e.agents.values())B.tools.length>0&&A.set(B.id,Math.min(4,B.tools.length));const U=`${w}#lanes:${i5(A)}`,z=E.filter(B=>gq(B.id,o,m,y));if(z.length>0||U!==N.current){if(z.length>0){const B=a5(E,T,{direction:"LR",pinned:o,measured:u,availableWidth:r,availableHeight:i,lanes:A});for(const C of B)DC(C.id,m,y)&&yq(C.id,C.position,m,y);u5(E,m,o,u,new Set(z.map(C=>C.id)),A)}l5(E,m,o,u,A),N.current=U}const P=c5(E,m,o,u,c,!p||d,A);P.length>0&&h(P),su(m,e.agents),su(y,e.agents),su(o,e.agents),su(u,mq(e.agents.values()));const D=[];let V=!1;for(const B of E){let C=o.get(B.id)??m.get(B.id);C||(C=vq(B.id,m,y),V=!0),D.push({...B,position:C})}return V&&(N.current=""),{nodes:D,edges:T}}function eF(){return g.jsx(ny,{children:g.jsx(tF,{})})}function tF(){var Ga,Ya,Ka,Xa;const e=Aa(),n=j.useRef(jv()),[,r]=j.useState(0),i=j.useCallback(()=>r(H=>H+1),[]),[o,l]=j.useState(()=>new Set),[u,c]=j.useState(null),[h,p]=j.useState(null),d=j.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=j.useCallback(()=>{l(new Set),c(null)},[]),[y,w]=j.useState(null),[N,_]=j.useState(null),S=j.useCallback(H=>_(H),[]),[b,k]=j.useState(!1),E=j.useRef(G5()),[T,I]=j.useState(z5);j.useEffect(()=>{B5(T)},[T]);const[O,A]=j.useState(U5);j.useEffect(()=>{H5(O)},[O]);const[U,z]=j.useState(W5);j.useEffect(()=>{V5(U)},[U]);const[P,D]=j.useState(()=>{try{const H=window.localStorage.getItem($E);return H===null?!0:H==="1"}catch{return!0}});j.useEffect(()=>{try{window.localStorage.setItem($E,P?"1":"0")}catch{}},[P]);const[V,B]=j.useState(null),[C,$]=j.useState(!1),[L,re]=j.useState(0),[J,W]=j.useState(0);j.useEffect(()=>{fetch("/api/sound-hook").then(H=>H.ok?H.json():null).then(H=>{H!=null&&H.ok&&(B(H.enabled===!0),re((H.foreign??[]).filter(Y=>Y.worksHere).length),W(typeof H.parked=="number"?H.parked:0))}).catch(()=>{})},[]);const Z=j.useCallback(async()=>{$(!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&&B(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{$(!1)}},[V]),[M,G]=j.useState(!1),[K,q]=j.useState(null),[Q,ne]=j.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(DE)??""}catch{return""}}),[ae,fe]=j.useState(!1),te=j.useRef(0),[ce,Ce]=j.useState(!1),ve=j.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)})},[]),je=j.useCallback(()=>{ve(Date.now()-te.current>=F5)},[ve]);j.useEffect(()=>{ve();const H=window.setInterval(je,5*6e4),Y=()=>{document.visibilityState==="visible"&&je()};return document.addEventListener("visibilitychange",Y),()=>{window.clearInterval(H),document.removeEventListener("visibilitychange",Y)}},[ve,je]),j.useEffect(()=>{M&&ve()},[M,ve]);const ye=(K==null?void 0:K.notice)??null,[Ee,Ye]=j.useState(null),[we,_e]=j.useState(Lv);j.useEffect(()=>{let H=!1;return fetch("/api/health").then(Y=>Y.ok?Y.json():null).then(Y=>{H||(_e(_5(Y)),!(!Y||typeof Y.workspace!="string")&&Ye(Y.workspace))}).catch(()=>{}),()=>{H=!0}},[M]);const Be=j.useRef(we);Be.current=we;const it=ye?`${ye.kind}:${ye.to}`:"",ft=ye!=null&&Q!==it,Ze=j.useCallback(()=>{if(!ye)return;const H=Q===it?"":it;ne(H);try{window.localStorage.setItem(DE,H)}catch{}},[ye,it,Q]),[$e,Je]=j.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(FE)??""}catch{return""}}),Xe=K!=null&&K.invokedAs&&K.invokedAs!==Gt?K.invokedAs:null,Ot=Xe!=null&&$e!==Xe,lt=j.useCallback(()=>{if(Xe){Je(Xe);try{window.localStorage.setItem(FE,Xe)}catch{}}},[Xe]),Qe=((Ga=K==null?void 0:K.upgrade)==null?void 0:Ga.state)??"idle",Pt=sq(K==null?void 0:K.upgrade),zt=j.useCallback(async()=>{try{await fetch("/api/upgrade",{method:"POST"})}catch{}ve()},[ve]);j.useEffect(()=>{if(Qe!=="running")return;const H=window.setInterval(ve,3e3);return()=>window.clearInterval(H)},[Qe,ve]);const et=j.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=j.useCallback(()=>{I(H=>(H||D(!1),!H))},[]),ht=j.useCallback(()=>{D(H=>(H||I(!1),!H))},[]),[vt,hn]=j.useState(!1),[Yt,Lt]=j.useState(0),bn=j.useRef(null),[gr,Sn]=j.useState(!1),Bt=j.useRef(null),[Fn,pn]=j.useState(0),vr=j.useRef(bq()),[Hr,xi]=j.useState(!1),Wr=j.useCallback(()=>{const H=vr.current,Y=H.setPaused(!H.paused);for(const oe of Y)n.current=Bx(n.current,oe);xi(H.paused)},[]),[ut,_i]=j.useState(Date.now()),[mn,Is]=j.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(BE)!=="0"}catch{return!0}}),yr=j.useCallback(()=>{Is(H=>{const Y=!H;try{window.localStorage.setItem(BE,Y?"1":"0")}catch{}return Y})},[]),[zn,kn]=j.useState(!1),[Vr,Gr]=j.useState("restart"),[Yr,bi]=j.useState(null),sr=j.useRef(!1),Ms=j.useRef(null),En=j.useRef(0),wr=j.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=j.useRef(null);j.useEffect(()=>{let H=!1;for(const oe of n.current.agents.values())if(oe.state==="active"){H=!0;break}const Y=oq({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]),j.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(UE)}catch{return}const de=rq({bundle:"1.35.31",running:H,pending:Y,lastTried:oe});if(de==="reload"){try{window.sessionStorage.setItem(UE,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]),j.useEffect(()=>{if(zn&&iq({asked:Ms.current,reported:Pt})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}sr.current=!1,kn(!1)}},[zn,Pt]);const Ps=j.useRef(Y5()).current;j.useRef(!1);const Tt=j.useRef(new Map(Ps.positions.filter(([H])=>Ps.pins.includes(H)))),xr=j.useRef(null),_r=j.useState(()=>K5())[0],[Kt,Kr]=j.useState(""),[Si,nt]=j.useState(()=>new Set),[br,Xr]=j.useState(Cq),[Ls,Qr]=j.useState(!1),Zr=j.useRef(null);j.useEffect(()=>{document.documentElement.dataset.theme=br;try{window.localStorage.setItem(zC,br)}catch{}},[br]),j.useEffect(()=>{if(!_r)return;const H=window.setTimeout(()=>{try{e.setViewport(_r,{duration:0})}catch{}},60);return()=>window.clearTimeout(H)},[e,_r]);const qs=j.useRef(!0);j.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",()=>{qs.current=!1,Y.flush()}),H.addEventListener("hook",oe=>{try{const de=JSON.parse(oe.data);if(!vr.current.accept(de))return;n.current=Bx(n.current,de),de.replay===!0||qs.current||Date.now()-de.receivedAt>3e4?Y.replay():Y.live()}catch{}}),()=>{H.close(),Y.cancel()}},[i]),j.useEffect(()=>{const H=setInterval(()=>{const Y=Date.now();_i(Y);let oe=bP(n.current,Y,zx);SP(n.current,Y,zx)&&(oe=!0),xP(n.current,Y,L5,q5)&&(oe=!0),_P(n.current,Y,$5,D5)&&(oe=!0),oe&&i()},250);return()=>clearInterval(H)},[i]);const ir=j.useRef(null),St=j.useRef(0),$s=420,pt=j.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 De=Se.getBoundingClientRect(),Ge=e.getViewport();if(!Number.isFinite(Ge.zoom)||Ge.zoom<=0)return;const We=wt=>(wt-De.left-Ge.x)/Ge.zoom,Fe=wt=>(wt-De.top-Ge.y)/Ge.zoom,Tn=Pe.map(wt=>wt.getBoundingClientRect()),Ys=Math.min(...Tn.map(wt=>We(wt.left))),Ao=Math.max(...Tn.map(wt=>We(wt.right))),Ks=Math.min(...Tn.map(wt=>Fe(wt.top))),Io=Math.max(...Tn.map(wt=>Fe(wt.bottom))),Qa=Ao-Ys,us=Io-Ks;if(!(Qa>0&&us>0))return;const Zt=Math.max(.2,Math.min(1,(De.width-160)/(Qa+$s)*.86,(De.height-160)/us*.86));e.setViewport({x:80-Ys*Zt,y:Math.max(80,(De.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,(De.height-us*Zt)/2)-Ks*Zt,zoom:Zt},Mo=e.getViewport();(Math.abs(Mo.zoom-Zt)>.01||Math.abs(Mo.x-wt.x)>2)&&e.setViewport(wt,{duration:0})}catch{}},H+60)}catch{}},[e]),ko=j.useRef(""),Eo=j.useRef(null),Da=j.useRef(0),Sr=j.useCallback(()=>{Da.current=Date.now()},[]),Jr="agent-dag.autoFitDisabled",gn=j.useRef((()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Jr)==="1"}catch{return!1}})()),[Ds,Fa]=j.useState(gn.current),za=j.useCallback(()=>{if(!gn.current){gn.current=!0,Fa(!0);try{window.localStorage.setItem(Jr,"1")}catch{}}},[]),No=j.useCallback(()=>{gn.current=!1,Fa(!1);try{window.localStorage.removeItem(Jr)}catch{}pt(400)},[e,pt]);j.useEffect(()=>{const H=setInterval(()=>{if(gn.current||Date.now()-Da.current<800)return;const Y=n.current,oe=Date.now(),de=[];for(const We of Y.agents.values())Pv(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 De=!1,Ge=!1;for(const{id:We}of de){const Fe=or.current.get(We),Tn=Tt.current.get(We)??Xt.current.get(We);if(!Fe||!Tn)continue;Ge=!0;const Ys=Tn.x*xe.zoom+xe.x,Ao=Tn.y*xe.zoom+xe.y,Ks=(Tn.x+Fe.width)*xe.zoom+xe.x,Io=(Tn.y+Fe.height)*xe.zoom+xe.y;if(Ks>0&&Ys<Se&&Io>0&&Ao<Pe){De=!0;break}}Ge&&!De&&pt(600)},1500);return()=>clearInterval(H)},[e]);const ki=j.useRef(!1),or=j.useRef(new Map),es=j.useRef(0),nc=j.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(nc),[He,Ba]=j.useState(0);j.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 De=Se.offsetWidth,Ge=Se.offsetHeight;if(!De||!Ge)continue;const We=de.get(Pe);(!We||Math.abs(We.width-De)>4||Math.abs(We.height-Ge)>4)&&(de.set(Pe,{width:De,height:Ge}),xe=!0)}xe&&Ba(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=j.useRef(new Map(Ps.positions)),Co=j.useRef(new Set),Ni=j.useRef(""),kr=j.useMemo(()=>{const H=[];for(const Y of n.current.agents.values())Pv(Y,ut)&&H.push(Y.id+(Y.parentId?`>${Y.parentId}`:""));return H.sort(),`${H.join("|")}#sv${Ei}.${He}`},[n.current,n.current.lastSeq,ut,Ei,He]),ts=j.useRef(null);j.useEffect(()=>(ts.current!=null&&window.clearTimeout(ts.current),ts.current=window.setTimeout(()=>{hv(Xt.current,Tt.current)},1500),()=>{ts.current!=null&&window.clearTimeout(ts.current)}),[kr]),j.useEffect(()=>{if(ko.current===kr)return;const H=ko.current;if(ko.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=j.useMemo(()=>{if(o.size===0)return null;const H=new Set;for(const Y of o){const oe=Z5(n.current,Y);if(oe)for(const de of oe)H.add(de)}return H.size>0?H:null},[n.current,n.current.lastSeq,o]),Nn=j.useMemo(()=>f5(n.current,ut),[n.current,n.current.lastSeq,ut]),Bn=j.useRef(null),[vn,Un]=j.useState({w:0,h:0});j.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=j.useCallback(H=>{var oe,de;const Y=H.target;!(Y!=null&&Y.closest)||Y.closest(O5)!==H.currentTarget||(H.preventDefault(),(de=(oe=document.activeElement)==null?void 0:oe.blur)==null||de.call(oe))},[]),Bs=j.useRef(new Map),[Hn,rc]=j.useState(!1);j.useEffect(()=>{const H=window.setTimeout(()=>rc(!0),2500);return()=>window.clearTimeout(H)},[]);const[Ua,Er]=j.useState(!1),ar=j.useRef(null),[Ci,Us]=j.useState(!1),Ha=j.useCallback(()=>{ar.current&&(window.clearTimeout(ar.current),ar.current=null),Er(!1)},[]),sc=j.useCallback(H=>{H.length!==0&&queueMicrotask(()=>{Er(!0),ar.current&&window.clearTimeout(ar.current),ar.current=window.setTimeout(()=>Er(!1),P5+80)})},[]);j.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:Ti}=j.useMemo(()=>J5(n.current,ut,ns,rs,Tt.current,Kt,or.current,Bs.current,sc,Hn,Ci,Xt.current,Co.current,kr,Ni,o,Fs,Nn,S),[n.current,n.current.lastSeq,ut,ns,rs,Hn,Ci,Kt,kr,o,Fs,Nn,S,Yt]),Wa=j.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,De=oe.position.y,Ge=Pe+xe,We=De+Se,Fe=H.get(de.sessionId);Fe?(Fe.minX=Math.min(Fe.minX,Pe),Fe.minY=Math.min(Fe.minY,De),Fe.maxX=Math.max(Fe.maxX,Ge),Fe.maxY=Math.max(Fe.maxY,We)):H.set(de.sessionId,{minX:Pe,minY:De,maxX:Ge,maxY:We})}const Y=[];for(const[oe,de]of H){const xe=de.maxX-de.minX+lu*2,Se=de.maxY-de.minY+lu*2;Y.push({id:`group:${oe}`,type:BT,position:{x:de.minX-lu,y:de.minY-lu},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]),ic=j.useMemo(()=>{const H=[...Wa,...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})},[Wa,Qt,Fn]),Nr=j.useMemo(()=>{if(!Kt)return null;const H=new Set;for(const Y of n.current.agents.values())Nn.has(Y.id)&&WT(Y,Kt)&&H.add(Y.id);return H},[n.current,n.current.lastSeq,Kt,Nn]),Cn=j.useMemo(()=>j5(Kt,(Nr==null?void 0:Nr.size)??0,Nn.size),[Kt,Nr,Nn]),ss=j.useMemo(()=>{const H=new Set;for(const Y of n.current.agents.values())for(const oe of Y.tools)H.add(QT(oe.name));return Object.keys(qv).filter(Y=>H.has(Y))},[n.current,n.current.lastSeq]);j.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=p5(de,xe,8);Sn(Pe=>Pe===Se?Pe:Se)}H=window.setTimeout(Y,300)};return Y(),()=>window.clearTimeout(H)},[ss.length]);const is=j.useMemo(()=>{const H=new Map;for(const oe of n.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},[n.current,n.current.lastSeq]),lr=j.useCallback(H=>{nt(Y=>{const oe=new Set(Y);return oe.has(H)?oe.delete(H):oe.add(H),oe})},[]),Rt=u?n.current.agents.get(u):null,os=h?Array.from(n.current.agents.values()).flatMap(H=>H.tools).find(H=>H.id===h)??null:null,To=j.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}n.current=jv(),Tt.current.clear(),or.current.clear(),Xt.current.clear(),Ni.current="",WE(),m(),i()},[i,m]),Hs=j.useRef(b);Hs.current=b;const Ws=j.useRef(!1);Ws.current=os!=null||vt||N!=null||y!=null;const Vs=j.useCallback(H=>{const Y=lq(H,{confirmOpen:Hs.current,modalOpen:Ws.current});Y==="confirm"?k(!0):Y==="clear"&&(k(!1),To())},[To]),qt=j.useCallback(()=>{Tt.current.clear(),Xt.current.clear(),Ni.current="",WE(),i(),window.setTimeout(()=>pt(500),80)},[i,e,pt]),Cr=j.useCallback(()=>pt(500),[pt]),as=j.useRef(Qt);as.current=Qt;const ls=j.useRef(u);ls.current=u;const Ro=j.useCallback(H=>{const Y=as.current,oe=cq(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=qE(document.activeElement);d(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}St.current=Date.now(),xe&&M5(de.id)},30)},[d,e]),Ri=j.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]);j.useEffect(()=>{const H=Y=>{var De,Ge,We;const oe=Y.target,de={tagName:oe==null?void 0:oe.tagName,isContentEditable:oe==null?void 0:oe.isContentEditable,role:(De=oe==null?void 0:oe.getAttribute)==null?void 0:De.call(oe,"role"),type:oe==null?void 0:oe.type};if(Y.key==="Escape"){const Fe=BP({overlayOpen:Cu.depth()>0,typing:sy(de)});Fe==="dismiss"?Cu.dismissTop():Fe==="blur"?oe==null||oe.blur():(pq(de)&&(oe==null||oe.blur()),m());return}if(NC(Y))return;const xe=qE(oe)?(Ge=oe==null?void 0:oe.getAttribute)==null?void 0:Ge.call(oe,"data-id"):null,Se=xe&&as.current.some(Fe=>Fe.id===xe)?xe:null,Pe=fq(Y,Se);if(Pe.kind==="activate"){Y.preventDefault(),d(Pe.nodeId,Pe.additive);return}if(Pe.kind!=="node"&&!(Pe.nodeId==null&&XP(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")&&qt(),(Y.key==="f"||Y.key==="F")&&Cr(),(Y.key==="l"||Y.key==="L")&&bt(),(Y.key==="h"||Y.key==="H")&&hn(Fe=>!Fe),(Y.key==="u"||Y.key==="U")&&z(Fe=>!Fe),(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(Fe=>Fe==="dark"?"light":"dark")}};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[Vs,qt,Cr,m,d,Ro,Wr]);const Tr=n.current.agents.size,Gs=new Set(Array.from(n.current.agents.values()).map(H=>H.sessionId)).size,tn=j.useMemo(()=>r3(n.current.agents.values()),[n.current,n.current.lastSeq]),jo=j.useMemo(()=>s3(n.current.agents.values()),[n.current,n.current.lastSeq]),Va=j.useRef(null);j.useEffect(()=>{const H=Tq({waiting:tn.length,running:jo}),Y=Va.current;if(Va.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=Rq[H.icon])}},[tn.length,jo]);const[oc,ac]=j.useState(""),ji=Aq(tn);j.useEffect(()=>{ac(H=>Iq(H,ji))},[ji]);const nn=j.useMemo(()=>{let H=0,Y=0,oe=0,de=0,xe=0,Se=0,Pe=0,De=0,Ge=0;for(const We of n.current.agents.values()){H+=We.usage.inputTokens,Y+=We.usage.outputTokens,oe+=We.usage.cacheReadTokens,de+=We.usage.cacheCreateTokens;const Fe=dn(We.usage,We.model);xe+=Fe.total,Se+=Fe.input,Pe+=Fe.output,De+=Fe.cacheRead,Ge+=Fe.cacheWrite}return{inT:H,outT:Y,cacheR:oe,cacheC:de,sum:H+Y,cost:{total:xe,input:Se,output:Pe,cacheRead:De,cacheWrite:Ge}}},[n.current,n.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.31",latest:K==null?void 0:K.latest,latestPending:K==null?void 0:K.latestPending,checkedAgo:K!=null&&K.checkedAt?Iv(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":y5(H),title:v5(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"?Eu(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:[ze(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:A5,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=T5({connected:M,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:k5(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:Tr}),g.jsx("span",{className:"lbl",children:"agents"})]}),g.jsxs("span",{className:"stat",title:E5(we),children:[g.jsx("span",{className:"count",children:n.current.totalEvents}),g.jsx("span",{className:"lbl",children:"events"})]}),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:Mt(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:
73
+ ${is.map(H=>` ${H.server}: ${H.count} call${H.count===1?"":"s"}`).join(`
74
+ `)}`,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 n.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?Eu(H,Y):null,de=`input ${ze(nn.cost.input)} + output ${ze(nn.cost.output)} + cache r ${ze(nn.cost.cacheRead)} + cache w ${ze(nn.cost.cacheWrite)}${oe?`
75
+ active burn: ${oe}`:""}`;return g.jsxs("span",{className:"stat",title:de,children:[g.jsx("span",{className:"count",children:ze(nn.cost.total)}),g.jsxs("span",{className:"lbl",children:["cost",oe?` · ${oe}`:""]})]})})()]}),g.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:oc}),tn.length>0&&g.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>Ri(tn[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
76
+ ${tn.map(H=>` ${H.label}: ${qu(H.waiting)} (${Iv(ut-H.waiting.since)})`).join(`
77
+ `)}`,"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=R5({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:()=>z(H=>!H),title:`${U?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":U,"aria-controls":U?"usage-panel":void 0,children:"$"}),we.claude&&V!==null&&g.jsx("button",{className:"btn icon-btn",onClick:H=>{if(H.shiftKey&&J>0){$(!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&&(B(Y.enabled===!0),W(Y.parked??0))}).catch(()=>{}).finally(()=>$(!1));return}Z()},disabled:C,title:C5(we,{on:V,clash:L,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:`${P?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":P,"aria-controls":P?"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:`${T?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":T,"aria-controls":T?"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:qt,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&&!M?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 ${((Ya=K==null?void 0:K.upgrade)==null?void 0:Ya.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:((Ka=K==null?void 0:K.upgrade)==null?void 0:Ka.error)??"",children:[(K==null?void 0:K.upgradeMode)==="npx"?"update failed":"install failed",": ",((Xa=K==null?void 0:K.upgrade)==null?void 0:Xa.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:":zE.npx}):K!=null&&K.upgradeBlocked?g.jsx("span",{className:"ver-sub",children:zE[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,U&&g.jsx(g3,{state:n.current,now:ut,providers:we,onClose:()=>z(!1)}),P&&we.claude&&g.jsx(eq,{onClose:()=>D(!1)}),T&&g.jsx(o3,{state:n.current,now:ut,selectedIds:o,onSelect:Ri,onClose:()=>I(!1)}),g.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${Ua?" bubbling":""}${Ci?" dragging-any":""}`,ref:Bn,onMouseDownCapture:zs,children:[Tr===0&&g.jsx(nF,{live:M,everConnected:Ls,providers:we}),Cn.empty&&Tr>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"} ${$v[H]} tools`,children:[g.jsx("span",{className:"cat-emoji",children:qv[H]}),g.jsx("span",{className:"cat-name",children:$v[H]})]},H)})}),g.jsxs(cC,{nodes:ic,edges:Ti,nodeTypes:I5,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||za()},onMove:(H,Y)=>{Sr(),Eo.current&&window.clearTimeout(Eo.current),Eo.current=window.setTimeout(()=>X5(Y),250)},onNodeDragStart:(H,Y)=>{var oe;if(Ha(),ki.current=!0,Bt.current=new Map,Us(!0),Sr(),za(),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[De,Ge]of de.members){const We={x:Ge.x+xe,y:Ge.y+Se};Tt.current.set(De,We),Xt.current.set(De,We)}const Pe=Bt.current;if(Pe){for(const[De,Ge]of de.members)Pe.set(De,{x:Ge.x+xe,y:Ge.y+Se});Pe.set(Y.id,{x:Y.position.x,y:Y.position.y})}pn(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}),(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 De={x:Pe.x+de,y:Pe.y+xe};Tt.current.set(Se,De),Xt.current.set(Se,De)}}xr.current=null,hv(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}),hv(Xt.current,Tt.current)},children:[g.jsx(cP,{gap:28,size:1,color:ca("--grid-line")}),g.jsx(pL,{}),g.jsx(JL,{agents:n.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(sP,{showInteractive:!1,children:g.jsx(so,{onClick:No,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(QO,{zoomable:!0,pannable:!0,nodeColor:H=>m5(H,ca),nodeStrokeWidth:2,maskColor:ca("--minimap-mask"),style:{background:ca("--panel"),border:`1px solid ${ca("--line")}`,borderRadius:8}})]})]}),O?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:()=>A(!1),children:"×"}),Rt?g.jsx(iF,{agent:Rt,now:ut,onOpenTool:p,onShowSummary:H=>{E.current.has(H)&&(E.current.delete(H),HE(E.current)),w(H)},onExportSession:H=>Q5(n.current,H)}):g.jsx(sF,{count:Tr,workspace:Ee})]}):g.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>A(!0),children:"‹"}),os&&g.jsx(uL,{tool:os,onClose:()=>p(null)}),vt&&g.jsx($q,{onClose:()=>hn(!1)}),N&&(()=>{const H=n.current.agents.get(N);return H?g.jsx(nL,{agent:H,onClose:()=>_(null)}):null})(),y&&g.jsx(t3,{state:n.current,sessionId:y,onClose:()=>{E.current.add(y),HE(E.current),w(null)}}),b&&g.jsx(aq,{agentCount:Tr,onConfirm:()=>Vs("confirmation"),onCancel:()=>k(!1)})]})}function nF({live:e,everConnected:n,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:n?"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."]})]}):rF(r)]})}function rF(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."]}),N5(e).map(n=>g.jsx("p",{className:"hint-row",children:n.spans.map((r,i)=>r.code?g.jsx("code",{children:r.text},i):g.jsx("span",{children:r.text},i))},n.provider))]})}function sF({count:e,workspace:n}){const r=x5(n);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 iF({agent:e,now:n,onOpenTool:r,onShowSummary:i,onExportSession:o}){const l=Nu(e.startedAt,e.endedAt,n),u=dn(e.usage,e.model),c=u.total>0,h=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const w of e.tools){const N=QT(w.name);p.set(N,(p.get(N)??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,N)=>N[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:js(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:ze(u.total)}),g.jsx("span",{className:"hero-cost-label",children:"spend"})]}),g.jsx(oy,{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,N])=>g.jsxs("span",{className:`cat-chip cat-${w}`,title:`${N} ${$v[w]} call${N===1?"":"s"}`,children:[g.jsx("span",{className:"cat-emoji",children:qv[w]}),g.jsx("span",{className:"cat-count",children:N})]},w))})]})]}),h>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,N)=>{const _=l3(w.at,n);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})]},N)})})]}),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(aF,{t:w,onClick:()=>r(w.id)},w.id))})]})]})}const oF={inflight:"in-flight",done:"done",err:"error"};function aF({t:e,onClick:n}){const r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",i=EC(e,"…");return g.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:n,children:[g.jsxs("span",{className:"name",children:[g.jsx("span",{className:`status-dot ${r}`,"aria-hidden":!0}),g.jsx("span",{className:"vis-hidden",children:oF[r]}),e.name]}),g.jsx("span",{style:{color:"var(--muted)"},children:i})]})}try{Eq(window.localStorage)}catch{}const lF=lj.createRoot(document.getElementById("root"));lF.render(g.jsx(eF,{}));