agent-dag 1.26.0 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/index-CYhfb55F.js +66 -0
- package/dist/web/assets/{index-uyBGpPqo.css → index-D7vVMR5F.css} +1 -1
- package/dist/web/index.html +2 -2
- package/hook/hook.js +7 -0
- package/package.json +1 -1
- package/src/server/claude-accounts.mjs +8 -19
- package/src/server/cswap-auto.mjs +22 -21
- package/src/server/cswap-install.mjs +5 -17
- package/src/server/exec.mjs +79 -0
- package/src/server/index.mjs +2 -1
- package/src/server/quota.mjs +6 -1
- package/src/server/sound-hook.mjs +61 -1
- package/dist/web/assets/index-CufegSZ-.js +0 -64
|
@@ -0,0 +1,66 @@
|
|
|
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"]'))s(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const l of u.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function i(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(o){if(o.ep)return;o.ep=!0;const u=i(o);fetch(o.href,u)}})();var Fa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ng(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wc={exports:{}},io={},xc={exports:{}},Oe={};/**
|
|
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 L0;function FR(){if(L0)return Oe;L0=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.iterator;function v(M){return M===null||typeof M!="object"?null:(M=m&&M[m]||M["@@iterator"],typeof M=="function"?M:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,_={};function S(M,B,ae){this.props=M,this.context=B,this.refs=_,this.updater=ae||x}S.prototype.isReactComponent={},S.prototype.setState=function(M,B){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,B,"setState")},S.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function b(){}b.prototype=S.prototype;function N(M,B,ae){this.props=M,this.context=B,this.refs=_,this.updater=ae||x}var E=N.prototype=new b;E.constructor=N,C(E,S.prototype),E.isPureReactComponent=!0;var k=Array.isArray,j=Object.prototype.hasOwnProperty,I={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function D(M,B,ae){var z,W={},ee=null,se=null;if(B!=null)for(z in B.ref!==void 0&&(se=B.ref),B.key!==void 0&&(ee=""+B.key),B)j.call(B,z)&&!P.hasOwnProperty(z)&&(W[z]=B[z]);var ce=arguments.length-2;if(ce===1)W.children=ae;else if(1<ce){for(var pe=Array(ce),me=0;me<ce;me++)pe[me]=arguments[me+2];W.children=pe}if(M&&M.defaultProps)for(z in ce=M.defaultProps,ce)W[z]===void 0&&(W[z]=ce[z]);return{$$typeof:e,type:M,key:ee,ref:se,props:W,_owner:I.current}}function A(M,B){return{$$typeof:e,type:M.type,key:B,ref:M.ref,props:M.props,_owner:M._owner}}function F(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function q(M){var B={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(ae){return B[ae]})}var Q=/\/+/g;function K(M,B){return typeof M=="object"&&M!==null&&M.key!=null?q(""+M.key):B.toString(36)}function T(M,B,ae,z,W){var ee=typeof M;(ee==="undefined"||ee==="boolean")&&(M=null);var se=!1;if(M===null)se=!0;else switch(ee){case"string":case"number":se=!0;break;case"object":switch(M.$$typeof){case e:case n:se=!0}}if(se)return se=M,W=W(se),M=z===""?"."+K(se,0):z,k(W)?(ae="",M!=null&&(ae=M.replace(Q,"$&/")+"/"),T(W,B,ae,"",function(me){return me})):W!=null&&(F(W)&&(W=A(W,ae+(!W.key||se&&se.key===W.key?"":(""+W.key).replace(Q,"$&/")+"/")+M)),B.push(W)),1;if(se=0,z=z===""?".":z+":",k(M))for(var ce=0;ce<M.length;ce++){ee=M[ce];var pe=z+K(ee,ce);se+=T(ee,B,ae,pe,W)}else if(pe=v(M),typeof pe=="function")for(M=pe.call(M),ce=0;!(ee=M.next()).done;)ee=ee.value,pe=z+K(ee,ce++),se+=T(ee,B,ae,pe,W);else if(ee==="object")throw B=String(M),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.");return se}function Y(M,B,ae){if(M==null)return M;var z=[],W=0;return T(M,z,"","",function(ee){return B.call(ae,ee,W++)}),z}function H(M){if(M._status===-1){var B=M._result;B=B(),B.then(function(ae){(M._status===0||M._status===-1)&&(M._status=1,M._result=ae)},function(ae){(M._status===0||M._status===-1)&&(M._status=2,M._result=ae)}),M._status===-1&&(M._status=0,M._result=B)}if(M._status===1)return M._result.default;throw M._result}var re={current:null},X={transition:null},$={ReactCurrentDispatcher:re,ReactCurrentBatchConfig:X,ReactCurrentOwner:I};function G(){throw Error("act(...) is not supported in production builds of React.")}return Oe.Children={map:Y,forEach:function(M,B,ae){Y(M,function(){B.apply(this,arguments)},ae)},count:function(M){var B=0;return Y(M,function(){B++}),B},toArray:function(M){return Y(M,function(B){return B})||[]},only:function(M){if(!F(M))throw Error("React.Children.only expected to receive a single React element child.");return M}},Oe.Component=S,Oe.Fragment=i,Oe.Profiler=o,Oe.PureComponent=N,Oe.StrictMode=s,Oe.Suspense=d,Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$,Oe.act=G,Oe.cloneElement=function(M,B,ae){if(M==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+M+".");var z=C({},M.props),W=M.key,ee=M.ref,se=M._owner;if(B!=null){if(B.ref!==void 0&&(ee=B.ref,se=I.current),B.key!==void 0&&(W=""+B.key),M.type&&M.type.defaultProps)var ce=M.type.defaultProps;for(pe in B)j.call(B,pe)&&!P.hasOwnProperty(pe)&&(z[pe]=B[pe]===void 0&&ce!==void 0?ce[pe]:B[pe])}var pe=arguments.length-2;if(pe===1)z.children=ae;else if(1<pe){ce=Array(pe);for(var me=0;me<pe;me++)ce[me]=arguments[me+2];z.children=ce}return{$$typeof:e,type:M.type,key:W,ref:ee,props:z,_owner:se}},Oe.createContext=function(M){return M={$$typeof:l,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},M.Provider={$$typeof:u,_context:M},M.Consumer=M},Oe.createElement=D,Oe.createFactory=function(M){var B=D.bind(null,M);return B.type=M,B},Oe.createRef=function(){return{current:null}},Oe.forwardRef=function(M){return{$$typeof:c,render:M}},Oe.isValidElement=F,Oe.lazy=function(M){return{$$typeof:p,_payload:{_status:-1,_result:M},_init:H}},Oe.memo=function(M,B){return{$$typeof:h,type:M,compare:B===void 0?null:B}},Oe.startTransition=function(M){var B=X.transition;X.transition={};try{M()}finally{X.transition=B}},Oe.unstable_act=G,Oe.useCallback=function(M,B){return re.current.useCallback(M,B)},Oe.useContext=function(M){return re.current.useContext(M)},Oe.useDebugValue=function(){},Oe.useDeferredValue=function(M){return re.current.useDeferredValue(M)},Oe.useEffect=function(M,B){return re.current.useEffect(M,B)},Oe.useId=function(){return re.current.useId()},Oe.useImperativeHandle=function(M,B,ae){return re.current.useImperativeHandle(M,B,ae)},Oe.useInsertionEffect=function(M,B){return re.current.useInsertionEffect(M,B)},Oe.useLayoutEffect=function(M,B){return re.current.useLayoutEffect(M,B)},Oe.useMemo=function(M,B){return re.current.useMemo(M,B)},Oe.useReducer=function(M,B,ae){return re.current.useReducer(M,B,ae)},Oe.useRef=function(M){return re.current.useRef(M)},Oe.useState=function(M){return re.current.useState(M)},Oe.useSyncExternalStore=function(M,B,ae){return re.current.useSyncExternalStore(M,B,ae)},Oe.useTransition=function(){return re.current.useTransition()},Oe.version="18.3.1",Oe}var $0;function Ro(){return $0||($0=1,xc.exports=FR()),xc.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 D0;function zR(){if(D0)return io;D0=1;var e=Ro(),n=Symbol.for("react.element"),i=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function l(c,d,h){var p,m={},v=null,x=null;h!==void 0&&(v=""+h),d.key!==void 0&&(v=""+d.key),d.ref!==void 0&&(x=d.ref);for(p in d)s.call(d,p)&&!u.hasOwnProperty(p)&&(m[p]=d[p]);if(c&&c.defaultProps)for(p in d=c.defaultProps,d)m[p]===void 0&&(m[p]=d[p]);return{$$typeof:n,type:c,key:v,ref:x,props:m,_owner:o.current}}return io.Fragment=i,io.jsx=l,io.jsxs=l,io}var F0;function BR(){return F0||(F0=1,wc.exports=zR()),wc.exports}var y=BR(),za={},_c={exports:{}},Jt={},Sc={exports:{}},bc={};/**
|
|
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 z0;function UR(){return z0||(z0=1,(function(e){function n(X,$){var G=X.length;X.push($);e:for(;0<G;){var M=G-1>>>1,B=X[M];if(0<o(B,$))X[M]=$,X[G]=B,G=M;else break e}}function i(X){return X.length===0?null:X[0]}function s(X){if(X.length===0)return null;var $=X[0],G=X.pop();if(G!==$){X[0]=G;e:for(var M=0,B=X.length,ae=B>>>1;M<ae;){var z=2*(M+1)-1,W=X[z],ee=z+1,se=X[ee];if(0>o(W,G))ee<B&&0>o(se,W)?(X[M]=se,X[ee]=G,M=ee):(X[M]=W,X[z]=G,M=z);else if(ee<B&&0>o(se,G))X[M]=se,X[ee]=G,M=ee;else break e}}return $}function o(X,$){var G=X.sortIndex-$.sortIndex;return G!==0?G:X.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var d=[],h=[],p=1,m=null,v=3,x=!1,C=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,N=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(X){for(var $=i(h);$!==null;){if($.callback===null)s(h);else if($.startTime<=X)s(h),$.sortIndex=$.expirationTime,n(d,$);else break;$=i(h)}}function k(X){if(_=!1,E(X),!C)if(i(d)!==null)C=!0,H(j);else{var $=i(h);$!==null&&re(k,$.startTime-X)}}function j(X,$){C=!1,_&&(_=!1,b(D),D=-1),x=!0;var G=v;try{for(E($),m=i(d);m!==null&&(!(m.expirationTime>$)||X&&!q());){var M=m.callback;if(typeof M=="function"){m.callback=null,v=m.priorityLevel;var B=M(m.expirationTime<=$);$=e.unstable_now(),typeof B=="function"?m.callback=B:m===i(d)&&s(d),E($)}else s(d);m=i(d)}if(m!==null)var ae=!0;else{var z=i(h);z!==null&&re(k,z.startTime-$),ae=!1}return ae}finally{m=null,v=G,x=!1}}var I=!1,P=null,D=-1,A=5,F=-1;function q(){return!(e.unstable_now()-F<A)}function Q(){if(P!==null){var X=e.unstable_now();F=X;var $=!0;try{$=P(!0,X)}finally{$?K():(I=!1,P=null)}}else I=!1}var K;if(typeof N=="function")K=function(){N(Q)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,Y=T.port2;T.port1.onmessage=Q,K=function(){Y.postMessage(null)}}else K=function(){S(Q,0)};function H(X){P=X,I||(I=!0,K())}function re(X,$){D=S(function(){X(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(X){X.callback=null},e.unstable_continueExecution=function(){C||x||(C=!0,H(j))},e.unstable_forceFrameRate=function(X){0>X||125<X?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<X?Math.floor(1e3/X):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return i(d)},e.unstable_next=function(X){switch(v){case 1:case 2:case 3:var $=3;break;default:$=v}var G=v;v=$;try{return X()}finally{v=G}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(X,$){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var G=v;v=X;try{return $()}finally{v=G}},e.unstable_scheduleCallback=function(X,$,G){var M=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?M+G:M):G=M,X){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=G+B,X={id:p++,callback:$,priorityLevel:X,startTime:G,expirationTime:B,sortIndex:-1},G>M?(X.sortIndex=G,n(h,X),i(d)===null&&X===i(h)&&(_?(b(D),D=-1):_=!0,re(k,G-M))):(X.sortIndex=B,n(d,X),C||x||(C=!0,H(j))),X},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(X){var $=v;return function(){var G=v;v=$;try{return X.apply(this,arguments)}finally{v=G}}}})(bc)),bc}var B0;function HR(){return B0||(B0=1,Sc.exports=UR()),Sc.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 U0;function VR(){if(U0)return Jt;U0=1;var e=Ro(),n=HR();function i(t){for(var r="https://reactjs.org/docs/error-decoder.html?invariant="+t,a=1;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,o={};function u(t,r){l(t,r),l(t+"Capture",r)}function l(t,r){for(o[t]=r,t=0;t<r.length;t++)s.add(r[t])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,h=/^[: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]*$/,p={},m={};function v(t){return d.call(m,t)?!0:d.call(p,t)?!1:h.test(t)?m[t]=!0:(p[t]=!0,!1)}function x(t,r,a,f){if(a!==null&&a.type===0)return!1;switch(typeof r){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 C(t,r,a,f){if(r===null||typeof r>"u"||x(t,r,a,f))return!0;if(f)return!1;if(a!==null)switch(a.type){case 3:return!r;case 4:return r===!1;case 5:return isNaN(r);case 6:return isNaN(r)||1>r}return!1}function _(t,r,a,f,g,w,R){this.acceptsBooleans=r===2||r===3||r===4,this.attributeName=f,this.attributeNamespace=g,this.mustUseProperty=a,this.propertyName=t,this.type=r,this.sanitizeURL=w,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 r=t[0];S[r]=new _(r,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 N(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 r=t.replace(b,N);S[r]=new _(r,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var r=t.replace(b,N);S[r]=new _(r,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var r=t.replace(b,N);S[r]=new _(r,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,r,a,f){var g=S.hasOwnProperty(r)?S[r]:null;(g!==null?g.type!==0:f||!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(C(r,a,g,f)&&(a=null),f||g===null?v(r)&&(a===null?t.removeAttribute(r):t.setAttribute(r,""+a)):g.mustUseProperty?t[g.propertyName]=a===null?g.type===3?!1:"":a:(r=g.attributeName,f=g.attributeNamespace,a===null?t.removeAttribute(r):(g=g.type,a=g===3||g===4&&a===!0?"":""+a,f?t.setAttributeNS(f,r,a):t.setAttribute(r,a))))}var k=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,j=Symbol.for("react.element"),I=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),q=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),re=Symbol.for("react.offscreen"),X=Symbol.iterator;function $(t){return t===null||typeof t!="object"?null:(t=X&&t[X]||t["@@iterator"],typeof t=="function"?t:null)}var G=Object.assign,M;function B(t){if(M===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);M=r&&r[1]||""}return`
|
|
34
|
+
`+M+t}var ae=!1;function z(t,r){if(!t||ae)return"";ae=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(r)if(r=function(){throw Error()},Object.defineProperty(r.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(r,[])}catch(ie){var f=ie}Reflect.construct(t,[],r)}else{try{r.call()}catch(ie){f=ie}t.call(r.prototype)}else{try{throw Error()}catch(ie){f=ie}t()}}catch(ie){if(ie&&f&&typeof ie.stack=="string"){for(var g=ie.stack.split(`
|
|
35
|
+
`),w=f.stack.split(`
|
|
36
|
+
`),R=g.length-1,L=w.length-1;1<=R&&0<=L&&g[R]!==w[L];)L--;for(;1<=R&&0<=L;R--,L--)if(g[R]!==w[L]){if(R!==1||L!==1)do if(R--,L--,0>L||g[R]!==w[L]){var U=`
|
|
37
|
+
`+g[R].replace(" at new "," at ");return t.displayName&&U.includes("<anonymous>")&&(U=U.replace("<anonymous>",t.displayName)),U}while(1<=R&&0<=L);break}}}finally{ae=!1,Error.prepareStackTrace=a}return(t=t?t.displayName||t.name:"")?B(t):""}function W(t){switch(t.tag){case 5:return B(t.type);case 16:return B("Lazy");case 13:return B("Suspense");case 19:return B("SuspenseList");case 0:case 2:case 15:return t=z(t.type,!1),t;case 11:return t=z(t.type.render,!1),t;case 1:return t=z(t.type,!0),t;default:return""}}function ee(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 P:return"Fragment";case I:return"Portal";case A:return"Profiler";case D:return"StrictMode";case K:return"Suspense";case T:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case q:return(t.displayName||"Context")+".Consumer";case F:return(t._context.displayName||"Context")+".Provider";case Q:var r=t.render;return t=t.displayName,t||(t=r.displayName||r.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Y:return r=t.displayName||null,r!==null?r:ee(t.type)||"Memo";case H:r=t._payload,t=t._init;try{return ee(t(r))}catch{}}return null}function se(t){var r=t.type;switch(t.tag){case 24:return"Cache";case 9:return(r.displayName||"Context")+".Consumer";case 10:return(r._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=r.render,t=t.displayName||t.name||"",r.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return r;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ee(r);case 8:return r===D?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r}return null}function ce(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function pe(t){var r=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function me(t){var r=pe(t)?"checked":"value",a=Object.getOwnPropertyDescriptor(t.constructor.prototype,r),f=""+t[r];if(!t.hasOwnProperty(r)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var g=a.get,w=a.set;return Object.defineProperty(t,r,{configurable:!0,get:function(){return g.call(this)},set:function(R){f=""+R,w.call(this,R)}}),Object.defineProperty(t,r,{enumerable:a.enumerable}),{getValue:function(){return f},setValue:function(R){f=""+R},stopTracking:function(){t._valueTracker=null,delete t[r]}}}}function Pe(t){t._valueTracker||(t._valueTracker=me(t))}function ze(t){if(!t)return!1;var r=t._valueTracker;if(!r)return!0;var a=r.getValue(),f="";return t&&(f=pe(t)?t.checked?"true":"false":t.value),t=f,t!==a?(r.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 Me(t,r){var a=r.checked;return G({},r,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??t._wrapperState.initialChecked})}function ke(t,r){var a=r.defaultValue==null?"":r.defaultValue,f=r.checked!=null?r.checked:r.defaultChecked;a=ce(r.value!=null?r.value:a),t._wrapperState={initialChecked:f,initialValue:a,controlled:r.type==="checkbox"||r.type==="radio"?r.checked!=null:r.value!=null}}function De(t,r){r=r.checked,r!=null&&E(t,"checked",r,!1)}function xe(t,r){De(t,r);var a=ce(r.value),f=r.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}r.hasOwnProperty("value")?He(t,r.type,a):r.hasOwnProperty("defaultValue")&&He(t,r.type,ce(r.defaultValue)),r.checked==null&&r.defaultChecked!=null&&(t.defaultChecked=!!r.defaultChecked)}function _e(t,r,a){if(r.hasOwnProperty("value")||r.hasOwnProperty("defaultValue")){var f=r.type;if(!(f!=="submit"&&f!=="reset"||r.value!==void 0&&r.value!==null))return;r=""+t._wrapperState.initialValue,a||r===t.value||(t.value=r),t.defaultValue=r}a=t.name,a!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,a!==""&&(t.name=a)}function He(t,r,a){(r!=="number"||je(t.ownerDocument)!==t)&&(a==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+a&&(t.defaultValue=""+a))}var st=Array.isArray;function vt(t,r,a,f){if(t=t.options,r){r={};for(var g=0;g<a.length;g++)r["$"+a[g]]=!0;for(a=0;a<t.length;a++)g=r.hasOwnProperty("$"+t[a].value),t[a].selected!==g&&(t[a].selected=g),g&&f&&(t[a].defaultSelected=!0)}else{for(a=""+ce(a),r=null,g=0;g<t.length;g++){if(t[g].value===a){t[g].selected=!0,f&&(t[g].defaultSelected=!0);return}r!==null||t[g].disabled||(r=t[g])}r!==null&&(r.selected=!0)}}function lt(t,r){if(r.dangerouslySetInnerHTML!=null)throw Error(i(91));return G({},r,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Ke(t,r){var a=r.value;if(a==null){if(a=r.children,r=r.defaultValue,a!=null){if(r!=null)throw Error(i(92));if(st(a)){if(1<a.length)throw Error(i(93));a=a[0]}r=a}r==null&&(r=""),a=r}t._wrapperState={initialValue:ce(a)}}function yt(t,r){var a=ce(r.value),f=ce(r.defaultValue);a!=null&&(a=""+a,a!==t.value&&(t.value=a),r.defaultValue==null&&t.defaultValue!==a&&(t.defaultValue=a)),f!=null&&(t.defaultValue=""+f)}function At(t){var r=t.textContent;r===t._wrapperState.initialValue&&r!==""&&r!==null&&(t.value=r)}function Xe(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 Ct(t,r){return t==null||t==="http://www.w3.org/1999/xhtml"?Xe(r):t==="http://www.w3.org/2000/svg"&&r==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Ze,Wt=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(r,a,f,g){MSApp.execUnsafeLocalFunction(function(){return t(r,a,f,g)})}:t})(function(t,r){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=r;else{for(Ze=Ze||document.createElement("div"),Ze.innerHTML="<svg>"+r.valueOf().toString()+"</svg>",r=Ze.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;r.firstChild;)t.appendChild(r.firstChild)}});function Je(t,r){if(r){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=r;return}}t.textContent=r}var Ve={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},wt=["Webkit","ms","Moz","O"];Object.keys(Ve).forEach(function(t){wt.forEach(function(r){r=r+t.charAt(0).toUpperCase()+t.substring(1),Ve[r]=Ve[t]})});function ct(t,r,a){return r==null||typeof r=="boolean"||r===""?"":a||typeof r!="number"||r===0||Ve.hasOwnProperty(t)&&Ve[t]?(""+r).trim():r+"px"}function ot(t,r){t=t.style;for(var a in r)if(r.hasOwnProperty(a)){var f=a.indexOf("--")===0,g=ct(a,r[a],f);a==="float"&&(a="cssFloat"),f?t.setProperty(a,g):t[a]=g}}var rn=G({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 ht(t,r){if(r){if(rn[t]&&(r.children!=null||r.dangerouslySetInnerHTML!=null))throw Error(i(137,t));if(r.dangerouslySetInnerHTML!=null){if(r.children!=null)throw Error(i(60));if(typeof r.dangerouslySetInnerHTML!="object"||!("__html"in r.dangerouslySetInnerHTML))throw Error(i(61))}if(r.style!=null&&typeof r.style!="object")throw Error(i(62))}}function It(t,r){if(t.indexOf("-")===-1)return typeof r.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 dn=null;function Vn(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Cn=null,Mt=null,hn=null;function pn(t){if(t=Us(t)){if(typeof Cn!="function")throw Error(i(280));var r=t.stateNode;r&&(r=ta(r),Cn(t.stateNode,t.type,r))}}function Xr(t){Mt?hn?hn.push(t):hn=[t]:Mt=t}function Qr(){if(Mt){var t=Mt,r=hn;if(hn=Mt=null,pn(t),r)for(t=0;t<r.length;t++)pn(r[t])}}function Ai(t,r){return t(r)}function Pt(){}var Jn=!1;function Rn(t,r,a){if(Jn)return t(r,a);Jn=!0;try{return Ai(t,r,a)}finally{Jn=!1,(Mt!==null||hn!==null)&&(Pt(),Qr())}}function sn(t,r){var a=t.stateNode;if(a===null)return null;var f=ta(a);if(f===null)return null;a=f[r];e:switch(r){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(i(231,r,typeof a));return a}var er=!1;if(c)try{var Tn={};Object.defineProperty(Tn,"passive",{get:function(){er=!0}}),window.addEventListener("test",Tn,Tn),window.removeEventListener("test",Tn,Tn)}catch{er=!1}function Ii(t,r,a,f,g,w,R,L,U){var ie=Array.prototype.slice.call(arguments,3);try{r.apply(a,ie)}catch(le){this.onError(le)}}var mn=!1,tr=null,nr=!1,xr=null,Gt={onError:function(t){mn=!0,tr=t}};function Es(t,r,a,f,g,w,R,L,U){mn=!1,tr=null,Ii.apply(Gt,arguments)}function Zr(t,r,a,f,g,w,R,L,U){if(Es.apply(this,arguments),mn){if(mn){var ie=tr;mn=!1,tr=null}else throw Error(i(198));nr||(nr=!0,xr=ie)}}function jn(t){var r=t,a=t;if(t.alternate)for(;r.return;)r=r.return;else{t=r;do r=t,(r.flags&4098)!==0&&(a=r.return),t=r.return;while(t)}return r.tag===3?a:null}function Mi(t){if(t.tag===13){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function Jr(t){if(jn(t)!==t)throw Error(i(188))}function rr(t){var r=t.alternate;if(!r){if(r=jn(t),r===null)throw Error(i(188));return r!==t?null:t}for(var a=t,f=r;;){var g=a.return;if(g===null)break;var w=g.alternate;if(w===null){if(f=g.return,f!==null){a=f;continue}break}if(g.child===w.child){for(w=g.child;w;){if(w===a)return Jr(g),t;if(w===f)return Jr(g),r;w=w.sibling}throw Error(i(188))}if(a.return!==f.return)a=g,f=w;else{for(var R=!1,L=g.child;L;){if(L===a){R=!0,a=g,f=w;break}if(L===f){R=!0,f=g,a=w;break}L=L.sibling}if(!R){for(L=w.child;L;){if(L===a){R=!0,a=w,f=g;break}if(L===f){R=!0,f=w,a=g;break}L=L.sibling}if(!R)throw Error(i(189))}}if(a.alternate!==f)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?t:r}function Pi(t){return t=rr(t),t!==null?St(t):null}function St(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var r=St(t);if(r!==null)return r;t=t.sibling}return null}var ei=n.unstable_scheduleCallback,_r=n.unstable_cancelCallback,Sr=n.unstable_shouldYield,Oi=n.unstable_requestPaint,Ge=n.unstable_now,ti=n.unstable_getCurrentPriorityLevel,ni=n.unstable_ImmediatePriority,Ot=n.unstable_UserBlockingPriority,Z=n.unstable_NormalPriority,ne=n.unstable_LowPriority,fe=n.unstable_IdlePriority,ge=null,ve=null;function ye(t){if(ve&&typeof ve.onCommitFiberRoot=="function")try{ve.onCommitFiberRoot(ge,t,void 0,(t.current.flags&128)===128)}catch{}}var Ae=Math.clz32?Math.clz32:mt,We=Math.log,pt=Math.LN2;function mt(t){return t>>>=0,t===0?32:31-(We(t)/pt|0)|0}var Ye=64,Ut=4194304;function An(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 br(t,r){var a=t.pendingLanes;if(a===0)return 0;var f=0,g=t.suspendedLanes,w=t.pingedLanes,R=a&268435455;if(R!==0){var L=R&~g;L!==0?f=An(L):(w&=R,w!==0&&(f=An(w)))}else R=a&~g,R!==0?f=An(R):w!==0&&(f=An(w));if(f===0)return 0;if(r!==0&&r!==f&&(r&g)===0&&(g=f&-f,w=r&-r,g>=w||g===16&&(w&4194240)!==0))return r;if((f&4)!==0&&(f|=a&16),r=t.entangledLanes,r!==0)for(t=t.entanglements,r&=f;0<r;)a=31-Ae(r),g=1<<a,f|=t[a],r&=~g;return f}function ri(t,r){switch(t){case 1:case 2:case 4:return r+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 r+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 Ns(t,r){for(var a=t.suspendedLanes,f=t.pingedLanes,g=t.expirationTimes,w=t.pendingLanes;0<w;){var R=31-Ae(w),L=1<<R,U=g[R];U===-1?((L&a)===0||(L&f)!==0)&&(g[R]=ri(L,r)):U<=r&&(t.expiredLanes|=L),w&=~L}}function qi(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function ii(){var t=Ye;return Ye<<=1,(Ye&4194240)===0&&(Ye=64),t}function on(t){for(var r=[],a=0;31>a;a++)r.push(t);return r}function nt(t,r,a){t.pendingLanes|=r,r!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,r=31-Ae(r),t[r]=a}function Do(t,r){var a=t.pendingLanes&~r;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=r,t.mutableReadLanes&=r,t.entangledLanes&=r,r=t.entanglements;var f=t.eventTimes;for(t=t.expirationTimes;0<a;){var g=31-Ae(a),w=1<<g;r[g]=0,f[g]=-1,t[g]=-1,a&=~w}}function Bu(t,r){var a=t.entangledLanes|=r;for(t=t.entanglements;a;){var f=31-Ae(a),g=1<<f;g&r|t[f]&r&&(t[f]|=r),a&=~g}}var Be=0;function mv(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var gv,Uu,vv,yv,wv,Hu=!1,Fo=[],kr=null,Er=null,Nr=null,Cs=new Map,Rs=new Map,Cr=[],uC="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 xv(t,r){switch(t){case"focusin":case"focusout":kr=null;break;case"dragenter":case"dragleave":Er=null;break;case"mouseover":case"mouseout":Nr=null;break;case"pointerover":case"pointerout":Cs.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Rs.delete(r.pointerId)}}function Ts(t,r,a,f,g,w){return t===null||t.nativeEvent!==w?(t={blockedOn:r,domEventName:a,eventSystemFlags:f,nativeEvent:w,targetContainers:[g]},r!==null&&(r=Us(r),r!==null&&Uu(r)),t):(t.eventSystemFlags|=f,r=t.targetContainers,g!==null&&r.indexOf(g)===-1&&r.push(g),t)}function lC(t,r,a,f,g){switch(r){case"focusin":return kr=Ts(kr,t,r,a,f,g),!0;case"dragenter":return Er=Ts(Er,t,r,a,f,g),!0;case"mouseover":return Nr=Ts(Nr,t,r,a,f,g),!0;case"pointerover":var w=g.pointerId;return Cs.set(w,Ts(Cs.get(w)||null,t,r,a,f,g)),!0;case"gotpointercapture":return w=g.pointerId,Rs.set(w,Ts(Rs.get(w)||null,t,r,a,f,g)),!0}return!1}function _v(t){var r=si(t.target);if(r!==null){var a=jn(r);if(a!==null){if(r=a.tag,r===13){if(r=Mi(a),r!==null){t.blockedOn=r,wv(t.priority,function(){vv(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function zo(t){if(t.blockedOn!==null)return!1;for(var r=t.targetContainers;0<r.length;){var a=Wu(t.domEventName,t.eventSystemFlags,r[0],t.nativeEvent);if(a===null){a=t.nativeEvent;var f=new a.constructor(a.type,a);dn=f,a.target.dispatchEvent(f),dn=null}else return r=Us(a),r!==null&&Uu(r),t.blockedOn=a,!1;r.shift()}return!0}function Sv(t,r,a){zo(t)&&a.delete(r)}function cC(){Hu=!1,kr!==null&&zo(kr)&&(kr=null),Er!==null&&zo(Er)&&(Er=null),Nr!==null&&zo(Nr)&&(Nr=null),Cs.forEach(Sv),Rs.forEach(Sv)}function js(t,r){t.blockedOn===r&&(t.blockedOn=null,Hu||(Hu=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,cC)))}function As(t){function r(g){return js(g,t)}if(0<Fo.length){js(Fo[0],t);for(var a=1;a<Fo.length;a++){var f=Fo[a];f.blockedOn===t&&(f.blockedOn=null)}}for(kr!==null&&js(kr,t),Er!==null&&js(Er,t),Nr!==null&&js(Nr,t),Cs.forEach(r),Rs.forEach(r),a=0;a<Cr.length;a++)f=Cr[a],f.blockedOn===t&&(f.blockedOn=null);for(;0<Cr.length&&(a=Cr[0],a.blockedOn===null);)_v(a),a.blockedOn===null&&Cr.shift()}var Li=k.ReactCurrentBatchConfig,Bo=!0;function fC(t,r,a,f){var g=Be,w=Li.transition;Li.transition=null;try{Be=1,Vu(t,r,a,f)}finally{Be=g,Li.transition=w}}function dC(t,r,a,f){var g=Be,w=Li.transition;Li.transition=null;try{Be=4,Vu(t,r,a,f)}finally{Be=g,Li.transition=w}}function Vu(t,r,a,f){if(Bo){var g=Wu(t,r,a,f);if(g===null)ll(t,r,f,Uo,a),xv(t,f);else if(lC(g,t,r,a,f))f.stopPropagation();else if(xv(t,f),r&4&&-1<uC.indexOf(t)){for(;g!==null;){var w=Us(g);if(w!==null&&gv(w),w=Wu(t,r,a,f),w===null&&ll(t,r,f,Uo,a),w===g)break;g=w}g!==null&&f.stopPropagation()}else ll(t,r,f,null,a)}}var Uo=null;function Wu(t,r,a,f){if(Uo=null,t=Vn(f),t=si(t),t!==null)if(r=jn(t),r===null)t=null;else if(a=r.tag,a===13){if(t=Mi(r),t!==null)return t;t=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;t=null}else r!==t&&(t=null);return Uo=t,null}function bv(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(ti()){case ni:return 1;case Ot:return 4;case Z:case ne:return 16;case fe:return 536870912;default:return 16}default:return 16}}var Rr=null,Gu=null,Ho=null;function kv(){if(Ho)return Ho;var t,r=Gu,a=r.length,f,g="value"in Rr?Rr.value:Rr.textContent,w=g.length;for(t=0;t<a&&r[t]===g[t];t++);var R=a-t;for(f=1;f<=R&&r[a-f]===g[w-f];f++);return Ho=g.slice(t,1<f?1-f:void 0)}function Vo(t){var r=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&r===13&&(t=13)):t=r,t===10&&(t=13),32<=t||t===13?t:0}function Wo(){return!0}function Ev(){return!1}function an(t){function r(a,f,g,w,R){this._reactName=a,this._targetInst=g,this.type=f,this.nativeEvent=w,this.target=R,this.currentTarget=null;for(var L in t)t.hasOwnProperty(L)&&(a=t[L],this[L]=a?a(w):w[L]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?Wo:Ev,this.isPropagationStopped=Ev,this}return G(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Wo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Wo)},persist:function(){},isPersistent:Wo}),r}var $i={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yu=an($i),Is=G({},$i,{view:0,detail:0}),hC=an(Is),Ku,Xu,Ms,Go=G({},Is,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zu,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!==Ms&&(Ms&&t.type==="mousemove"?(Ku=t.screenX-Ms.screenX,Xu=t.screenY-Ms.screenY):Xu=Ku=0,Ms=t),Ku)},movementY:function(t){return"movementY"in t?t.movementY:Xu}}),Nv=an(Go),pC=G({},Go,{dataTransfer:0}),mC=an(pC),gC=G({},Is,{relatedTarget:0}),Qu=an(gC),vC=G({},$i,{animationName:0,elapsedTime:0,pseudoElement:0}),yC=an(vC),wC=G({},$i,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),xC=an(wC),_C=G({},$i,{data:0}),Cv=an(_C),SC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},bC={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"},kC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function EC(t){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(t):(t=kC[t])?!!r[t]:!1}function Zu(){return EC}var NC=G({},Is,{key:function(t){if(t.key){var r=SC[t.key]||t.key;if(r!=="Unidentified")return r}return t.type==="keypress"?(t=Vo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?bC[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zu,charCode:function(t){return t.type==="keypress"?Vo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Vo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),CC=an(NC),RC=G({},Go,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Rv=an(RC),TC=G({},Is,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zu}),jC=an(TC),AC=G({},$i,{propertyName:0,elapsedTime:0,pseudoElement:0}),IC=an(AC),MC=G({},Go,{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}),PC=an(MC),OC=[9,13,27,32],Ju=c&&"CompositionEvent"in window,Ps=null;c&&"documentMode"in document&&(Ps=document.documentMode);var qC=c&&"TextEvent"in window&&!Ps,Tv=c&&(!Ju||Ps&&8<Ps&&11>=Ps),jv=" ",Av=!1;function Iv(t,r){switch(t){case"keyup":return OC.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mv(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Di=!1;function LC(t,r){switch(t){case"compositionend":return Mv(r);case"keypress":return r.which!==32?null:(Av=!0,jv);case"textInput":return t=r.data,t===jv&&Av?null:t;default:return null}}function $C(t,r){if(Di)return t==="compositionend"||!Ju&&Iv(t,r)?(t=kv(),Ho=Gu=Rr=null,Di=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Tv&&r.locale!=="ko"?null:r.data;default:return null}}var DC={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 Pv(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r==="input"?!!DC[t.type]:r==="textarea"}function Ov(t,r,a,f){Xr(f),r=Zo(r,"onChange"),0<r.length&&(a=new Yu("onChange","change",null,a,f),t.push({event:a,listeners:r}))}var Os=null,qs=null;function FC(t){Jv(t,0)}function Yo(t){var r=Hi(t);if(ze(r))return t}function zC(t,r){if(t==="change")return r}var qv=!1;if(c){var el;if(c){var tl="oninput"in document;if(!tl){var Lv=document.createElement("div");Lv.setAttribute("oninput","return;"),tl=typeof Lv.oninput=="function"}el=tl}else el=!1;qv=el&&(!document.documentMode||9<document.documentMode)}function $v(){Os&&(Os.detachEvent("onpropertychange",Dv),qs=Os=null)}function Dv(t){if(t.propertyName==="value"&&Yo(qs)){var r=[];Ov(r,qs,t,Vn(t)),Rn(FC,r)}}function BC(t,r,a){t==="focusin"?($v(),Os=r,qs=a,Os.attachEvent("onpropertychange",Dv)):t==="focusout"&&$v()}function UC(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Yo(qs)}function HC(t,r){if(t==="click")return Yo(r)}function VC(t,r){if(t==="input"||t==="change")return Yo(r)}function WC(t,r){return t===r&&(t!==0||1/t===1/r)||t!==t&&r!==r}var In=typeof Object.is=="function"?Object.is:WC;function Ls(t,r){if(In(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;var a=Object.keys(t),f=Object.keys(r);if(a.length!==f.length)return!1;for(f=0;f<a.length;f++){var g=a[f];if(!d.call(r,g)||!In(t[g],r[g]))return!1}return!0}function Fv(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function zv(t,r){var a=Fv(t);t=0;for(var f;a;){if(a.nodeType===3){if(f=t+a.textContent.length,t<=r&&f>=r)return{node:a,offset:r-t};t=f}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Fv(a)}}function Bv(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?Bv(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function Uv(){for(var t=window,r=je();r instanceof t.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)t=r.contentWindow;else break;r=je(t.document)}return r}function nl(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r&&(r==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||r==="textarea"||t.contentEditable==="true")}function GC(t){var r=Uv(),a=t.focusedElem,f=t.selectionRange;if(r!==a&&a&&a.ownerDocument&&Bv(a.ownerDocument.documentElement,a)){if(f!==null&&nl(a)){if(r=f.start,t=f.end,t===void 0&&(t=r),"selectionStart"in a)a.selectionStart=r,a.selectionEnd=Math.min(t,a.value.length);else if(t=(r=a.ownerDocument||document)&&r.defaultView||window,t.getSelection){t=t.getSelection();var g=a.textContent.length,w=Math.min(f.start,g);f=f.end===void 0?w:Math.min(f.end,g),!t.extend&&w>f&&(g=f,f=w,w=g),g=zv(a,w);var R=zv(a,f);g&&R&&(t.rangeCount!==1||t.anchorNode!==g.node||t.anchorOffset!==g.offset||t.focusNode!==R.node||t.focusOffset!==R.offset)&&(r=r.createRange(),r.setStart(g.node,g.offset),t.removeAllRanges(),w>f?(t.addRange(r),t.extend(R.node,R.offset)):(r.setEnd(R.node,R.offset),t.addRange(r)))}}for(r=[],t=a;t=t.parentNode;)t.nodeType===1&&r.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<r.length;a++)t=r[a],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var YC=c&&"documentMode"in document&&11>=document.documentMode,Fi=null,rl=null,$s=null,il=!1;function Hv(t,r,a){var f=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;il||Fi==null||Fi!==je(f)||(f=Fi,"selectionStart"in f&&nl(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}),$s&&Ls($s,f)||($s=f,f=Zo(rl,"onSelect"),0<f.length&&(r=new Yu("onSelect","select",null,r,a),t.push({event:r,listeners:f}),r.target=Fi)))}function Ko(t,r){var a={};return a[t.toLowerCase()]=r.toLowerCase(),a["Webkit"+t]="webkit"+r,a["Moz"+t]="moz"+r,a}var zi={animationend:Ko("Animation","AnimationEnd"),animationiteration:Ko("Animation","AnimationIteration"),animationstart:Ko("Animation","AnimationStart"),transitionend:Ko("Transition","TransitionEnd")},sl={},Vv={};c&&(Vv=document.createElement("div").style,"AnimationEvent"in window||(delete zi.animationend.animation,delete zi.animationiteration.animation,delete zi.animationstart.animation),"TransitionEvent"in window||delete zi.transitionend.transition);function Xo(t){if(sl[t])return sl[t];if(!zi[t])return t;var r=zi[t],a;for(a in r)if(r.hasOwnProperty(a)&&a in Vv)return sl[t]=r[a];return t}var Wv=Xo("animationend"),Gv=Xo("animationiteration"),Yv=Xo("animationstart"),Kv=Xo("transitionend"),Xv=new Map,Qv="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 Tr(t,r){Xv.set(t,r),u(r,[t])}for(var ol=0;ol<Qv.length;ol++){var al=Qv[ol],KC=al.toLowerCase(),XC=al[0].toUpperCase()+al.slice(1);Tr(KC,"on"+XC)}Tr(Wv,"onAnimationEnd"),Tr(Gv,"onAnimationIteration"),Tr(Yv,"onAnimationStart"),Tr("dblclick","onDoubleClick"),Tr("focusin","onFocus"),Tr("focusout","onBlur"),Tr(Kv,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),u("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),u("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),u("onBeforeInput",["compositionend","keypress","textInput","paste"]),u("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ds="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(" "),QC=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ds));function Zv(t,r,a){var f=t.type||"unknown-event";t.currentTarget=a,Zr(f,r,void 0,t),t.currentTarget=null}function Jv(t,r){r=(r&4)!==0;for(var a=0;a<t.length;a++){var f=t[a],g=f.event;f=f.listeners;e:{var w=void 0;if(r)for(var R=f.length-1;0<=R;R--){var L=f[R],U=L.instance,ie=L.currentTarget;if(L=L.listener,U!==w&&g.isPropagationStopped())break e;Zv(g,L,ie),w=U}else for(R=0;R<f.length;R++){if(L=f[R],U=L.instance,ie=L.currentTarget,L=L.listener,U!==w&&g.isPropagationStopped())break e;Zv(g,L,ie),w=U}}}if(nr)throw t=xr,nr=!1,xr=null,t}function et(t,r){var a=r[ml];a===void 0&&(a=r[ml]=new Set);var f=t+"__bubble";a.has(f)||(ey(r,t,2,!1),a.add(f))}function ul(t,r,a){var f=0;r&&(f|=4),ey(a,t,f,r)}var Qo="_reactListening"+Math.random().toString(36).slice(2);function Fs(t){if(!t[Qo]){t[Qo]=!0,s.forEach(function(a){a!=="selectionchange"&&(QC.has(a)||ul(a,!1,t),ul(a,!0,t))});var r=t.nodeType===9?t:t.ownerDocument;r===null||r[Qo]||(r[Qo]=!0,ul("selectionchange",!1,r))}}function ey(t,r,a,f){switch(bv(r)){case 1:var g=fC;break;case 4:g=dC;break;default:g=Vu}a=g.bind(null,r,a,t),g=void 0,!er||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(g=!0),f?g!==void 0?t.addEventListener(r,a,{capture:!0,passive:g}):t.addEventListener(r,a,!0):g!==void 0?t.addEventListener(r,a,{passive:g}):t.addEventListener(r,a,!1)}function ll(t,r,a,f,g){var w=f;if((r&1)===0&&(r&2)===0&&f!==null)e:for(;;){if(f===null)return;var R=f.tag;if(R===3||R===4){var L=f.stateNode.containerInfo;if(L===g||L.nodeType===8&&L.parentNode===g)break;if(R===4)for(R=f.return;R!==null;){var U=R.tag;if((U===3||U===4)&&(U=R.stateNode.containerInfo,U===g||U.nodeType===8&&U.parentNode===g))return;R=R.return}for(;L!==null;){if(R=si(L),R===null)return;if(U=R.tag,U===5||U===6){f=w=R;continue e}L=L.parentNode}}f=f.return}Rn(function(){var ie=w,le=Vn(a),de=[];e:{var ue=Xv.get(t);if(ue!==void 0){var we=Yu,be=t;switch(t){case"keypress":if(Vo(a)===0)break e;case"keydown":case"keyup":we=CC;break;case"focusin":be="focus",we=Qu;break;case"focusout":be="blur",we=Qu;break;case"beforeblur":case"afterblur":we=Qu;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":we=Nv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":we=mC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":we=jC;break;case Wv:case Gv:case Yv:we=yC;break;case Kv:we=IC;break;case"scroll":we=hC;break;case"wheel":we=PC;break;case"copy":case"cut":case"paste":we=xC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":we=Rv}var Ee=(r&4)!==0,gt=!Ee&&t==="scroll",J=Ee?ue!==null?ue+"Capture":null:ue;Ee=[];for(var V=ie,te;V!==null;){te=V;var he=te.stateNode;if(te.tag===5&&he!==null&&(te=he,J!==null&&(he=sn(V,J),he!=null&&Ee.push(zs(V,he,te)))),gt)break;V=V.return}0<Ee.length&&(ue=new we(ue,be,null,a,le),de.push({event:ue,listeners:Ee}))}}if((r&7)===0){e:{if(ue=t==="mouseover"||t==="pointerover",we=t==="mouseout"||t==="pointerout",ue&&a!==dn&&(be=a.relatedTarget||a.fromElement)&&(si(be)||be[ir]))break e;if((we||ue)&&(ue=le.window===le?le:(ue=le.ownerDocument)?ue.defaultView||ue.parentWindow:window,we?(be=a.relatedTarget||a.toElement,we=ie,be=be?si(be):null,be!==null&&(gt=jn(be),be!==gt||be.tag!==5&&be.tag!==6)&&(be=null)):(we=null,be=ie),we!==be)){if(Ee=Nv,he="onMouseLeave",J="onMouseEnter",V="mouse",(t==="pointerout"||t==="pointerover")&&(Ee=Rv,he="onPointerLeave",J="onPointerEnter",V="pointer"),gt=we==null?ue:Hi(we),te=be==null?ue:Hi(be),ue=new Ee(he,V+"leave",we,a,le),ue.target=gt,ue.relatedTarget=te,he=null,si(le)===ie&&(Ee=new Ee(J,V+"enter",be,a,le),Ee.target=te,Ee.relatedTarget=gt,he=Ee),gt=he,we&&be)t:{for(Ee=we,J=be,V=0,te=Ee;te;te=Bi(te))V++;for(te=0,he=J;he;he=Bi(he))te++;for(;0<V-te;)Ee=Bi(Ee),V--;for(;0<te-V;)J=Bi(J),te--;for(;V--;){if(Ee===J||J!==null&&Ee===J.alternate)break t;Ee=Bi(Ee),J=Bi(J)}Ee=null}else Ee=null;we!==null&&ty(de,ue,we,Ee,!1),be!==null&>!==null&&ty(de,gt,be,Ee,!0)}}e:{if(ue=ie?Hi(ie):window,we=ue.nodeName&&ue.nodeName.toLowerCase(),we==="select"||we==="input"&&ue.type==="file")var Ne=zC;else if(Pv(ue))if(qv)Ne=VC;else{Ne=UC;var Re=BC}else(we=ue.nodeName)&&we.toLowerCase()==="input"&&(ue.type==="checkbox"||ue.type==="radio")&&(Ne=HC);if(Ne&&(Ne=Ne(t,ie))){Ov(de,Ne,a,le);break e}Re&&Re(t,ue,ie),t==="focusout"&&(Re=ue._wrapperState)&&Re.controlled&&ue.type==="number"&&He(ue,"number",ue.value)}switch(Re=ie?Hi(ie):window,t){case"focusin":(Pv(Re)||Re.contentEditable==="true")&&(Fi=Re,rl=ie,$s=null);break;case"focusout":$s=rl=Fi=null;break;case"mousedown":il=!0;break;case"contextmenu":case"mouseup":case"dragend":il=!1,Hv(de,a,le);break;case"selectionchange":if(YC)break;case"keydown":case"keyup":Hv(de,a,le)}var Te;if(Ju)e:{switch(t){case"compositionstart":var Ie="onCompositionStart";break e;case"compositionend":Ie="onCompositionEnd";break e;case"compositionupdate":Ie="onCompositionUpdate";break e}Ie=void 0}else Di?Iv(t,a)&&(Ie="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Ie="onCompositionStart");Ie&&(Tv&&a.locale!=="ko"&&(Di||Ie!=="onCompositionStart"?Ie==="onCompositionEnd"&&Di&&(Te=kv()):(Rr=le,Gu="value"in Rr?Rr.value:Rr.textContent,Di=!0)),Re=Zo(ie,Ie),0<Re.length&&(Ie=new Cv(Ie,t,null,a,le),de.push({event:Ie,listeners:Re}),Te?Ie.data=Te:(Te=Mv(a),Te!==null&&(Ie.data=Te)))),(Te=qC?LC(t,a):$C(t,a))&&(ie=Zo(ie,"onBeforeInput"),0<ie.length&&(le=new Cv("onBeforeInput","beforeinput",null,a,le),de.push({event:le,listeners:ie}),le.data=Te))}Jv(de,r)})}function zs(t,r,a){return{instance:t,listener:r,currentTarget:a}}function Zo(t,r){for(var a=r+"Capture",f=[];t!==null;){var g=t,w=g.stateNode;g.tag===5&&w!==null&&(g=w,w=sn(t,a),w!=null&&f.unshift(zs(t,w,g)),w=sn(t,r),w!=null&&f.push(zs(t,w,g))),t=t.return}return f}function Bi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function ty(t,r,a,f,g){for(var w=r._reactName,R=[];a!==null&&a!==f;){var L=a,U=L.alternate,ie=L.stateNode;if(U!==null&&U===f)break;L.tag===5&&ie!==null&&(L=ie,g?(U=sn(a,w),U!=null&&R.unshift(zs(a,U,L))):g||(U=sn(a,w),U!=null&&R.push(zs(a,U,L)))),a=a.return}R.length!==0&&t.push({event:r,listeners:R})}var ZC=/\r\n?/g,JC=/\u0000|\uFFFD/g;function ny(t){return(typeof t=="string"?t:""+t).replace(ZC,`
|
|
38
|
+
`).replace(JC,"")}function Jo(t,r,a){if(r=ny(r),ny(t)!==r&&a)throw Error(i(425))}function ea(){}var cl=null,fl=null;function dl(t,r){return t==="textarea"||t==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var hl=typeof setTimeout=="function"?setTimeout:void 0,eR=typeof clearTimeout=="function"?clearTimeout:void 0,ry=typeof Promise=="function"?Promise:void 0,tR=typeof queueMicrotask=="function"?queueMicrotask:typeof ry<"u"?function(t){return ry.resolve(null).then(t).catch(nR)}:hl;function nR(t){setTimeout(function(){throw t})}function pl(t,r){var a=r,f=0;do{var g=a.nextSibling;if(t.removeChild(a),g&&g.nodeType===8)if(a=g.data,a==="/$"){if(f===0){t.removeChild(g),As(r);return}f--}else a!=="$"&&a!=="$?"&&a!=="$!"||f++;a=g}while(a);As(r)}function jr(t){for(;t!=null;t=t.nextSibling){var r=t.nodeType;if(r===1||r===3)break;if(r===8){if(r=t.data,r==="$"||r==="$!"||r==="$?")break;if(r==="/$")return null}}return t}function iy(t){t=t.previousSibling;for(var r=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"){if(r===0)return t;r--}else a==="/$"&&r++}t=t.previousSibling}return null}var Ui=Math.random().toString(36).slice(2),Wn="__reactFiber$"+Ui,Bs="__reactProps$"+Ui,ir="__reactContainer$"+Ui,ml="__reactEvents$"+Ui,rR="__reactListeners$"+Ui,iR="__reactHandles$"+Ui;function si(t){var r=t[Wn];if(r)return r;for(var a=t.parentNode;a;){if(r=a[ir]||a[Wn]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(t=iy(t);t!==null;){if(a=t[Wn])return a;t=iy(t)}return r}t=a,a=t.parentNode}return null}function Us(t){return t=t[Wn]||t[ir],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Hi(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(i(33))}function ta(t){return t[Bs]||null}var gl=[],Vi=-1;function Ar(t){return{current:t}}function tt(t){0>Vi||(t.current=gl[Vi],gl[Vi]=null,Vi--)}function Qe(t,r){Vi++,gl[Vi]=t.current,t.current=r}var Ir={},Dt=Ar(Ir),Yt=Ar(!1),oi=Ir;function Wi(t,r){var a=t.type.contextTypes;if(!a)return Ir;var f=t.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===r)return f.__reactInternalMemoizedMaskedChildContext;var g={},w;for(w in a)g[w]=r[w];return f&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=g),g}function Kt(t){return t=t.childContextTypes,t!=null}function na(){tt(Yt),tt(Dt)}function sy(t,r,a){if(Dt.current!==Ir)throw Error(i(168));Qe(Dt,r),Qe(Yt,a)}function oy(t,r,a){var f=t.stateNode;if(r=r.childContextTypes,typeof f.getChildContext!="function")return a;f=f.getChildContext();for(var g in f)if(!(g in r))throw Error(i(108,se(t)||"Unknown",g));return G({},a,f)}function ra(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Ir,oi=Dt.current,Qe(Dt,t),Qe(Yt,Yt.current),!0}function ay(t,r,a){var f=t.stateNode;if(!f)throw Error(i(169));a?(t=oy(t,r,oi),f.__reactInternalMemoizedMergedChildContext=t,tt(Yt),tt(Dt),Qe(Dt,t)):tt(Yt),Qe(Yt,a)}var sr=null,ia=!1,vl=!1;function uy(t){sr===null?sr=[t]:sr.push(t)}function sR(t){ia=!0,uy(t)}function Mr(){if(!vl&&sr!==null){vl=!0;var t=0,r=Be;try{var a=sr;for(Be=1;t<a.length;t++){var f=a[t];do f=f(!0);while(f!==null)}sr=null,ia=!1}catch(g){throw sr!==null&&(sr=sr.slice(t+1)),ei(ni,Mr),g}finally{Be=r,vl=!1}}return null}var Gi=[],Yi=0,sa=null,oa=0,gn=[],vn=0,ai=null,or=1,ar="";function ui(t,r){Gi[Yi++]=oa,Gi[Yi++]=sa,sa=t,oa=r}function ly(t,r,a){gn[vn++]=or,gn[vn++]=ar,gn[vn++]=ai,ai=t;var f=or;t=ar;var g=32-Ae(f)-1;f&=~(1<<g),a+=1;var w=32-Ae(r)+g;if(30<w){var R=g-g%5;w=(f&(1<<R)-1).toString(32),f>>=R,g-=R,or=1<<32-Ae(r)+g|a<<g|f,ar=w+t}else or=1<<w|a<<g|f,ar=t}function yl(t){t.return!==null&&(ui(t,1),ly(t,1,0))}function wl(t){for(;t===sa;)sa=Gi[--Yi],Gi[Yi]=null,oa=Gi[--Yi],Gi[Yi]=null;for(;t===ai;)ai=gn[--vn],gn[vn]=null,ar=gn[--vn],gn[vn]=null,or=gn[--vn],gn[vn]=null}var un=null,ln=null,rt=!1,Mn=null;function cy(t,r){var a=_n(5,null,null,0);a.elementType="DELETED",a.stateNode=r,a.return=t,r=t.deletions,r===null?(t.deletions=[a],t.flags|=16):r.push(a)}function fy(t,r){switch(t.tag){case 5:var a=t.type;return r=r.nodeType!==1||a.toLowerCase()!==r.nodeName.toLowerCase()?null:r,r!==null?(t.stateNode=r,un=t,ln=jr(r.firstChild),!0):!1;case 6:return r=t.pendingProps===""||r.nodeType!==3?null:r,r!==null?(t.stateNode=r,un=t,ln=null,!0):!1;case 13:return r=r.nodeType!==8?null:r,r!==null?(a=ai!==null?{id:or,overflow:ar}:null,t.memoizedState={dehydrated:r,treeContext:a,retryLane:1073741824},a=_n(18,null,null,0),a.stateNode=r,a.return=t,t.child=a,un=t,ln=null,!0):!1;default:return!1}}function xl(t){return(t.mode&1)!==0&&(t.flags&128)===0}function _l(t){if(rt){var r=ln;if(r){var a=r;if(!fy(t,r)){if(xl(t))throw Error(i(418));r=jr(a.nextSibling);var f=un;r&&fy(t,r)?cy(f,a):(t.flags=t.flags&-4097|2,rt=!1,un=t)}}else{if(xl(t))throw Error(i(418));t.flags=t.flags&-4097|2,rt=!1,un=t}}}function dy(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;un=t}function aa(t){if(t!==un)return!1;if(!rt)return dy(t),rt=!0,!1;var r;if((r=t.tag!==3)&&!(r=t.tag!==5)&&(r=t.type,r=r!=="head"&&r!=="body"&&!dl(t.type,t.memoizedProps)),r&&(r=ln)){if(xl(t))throw hy(),Error(i(418));for(;r;)cy(t,r),r=jr(r.nextSibling)}if(dy(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));e:{for(t=t.nextSibling,r=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"){if(r===0){ln=jr(t.nextSibling);break e}r--}else a!=="$"&&a!=="$!"&&a!=="$?"||r++}t=t.nextSibling}ln=null}}else ln=un?jr(t.stateNode.nextSibling):null;return!0}function hy(){for(var t=ln;t;)t=jr(t.nextSibling)}function Ki(){ln=un=null,rt=!1}function Sl(t){Mn===null?Mn=[t]:Mn.push(t)}var oR=k.ReactCurrentBatchConfig;function Hs(t,r,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(i(309));var f=a.stateNode}if(!f)throw Error(i(147,t));var g=f,w=""+t;return r!==null&&r.ref!==null&&typeof r.ref=="function"&&r.ref._stringRef===w?r.ref:(r=function(R){var L=g.refs;R===null?delete L[w]:L[w]=R},r._stringRef=w,r)}if(typeof t!="string")throw Error(i(284));if(!a._owner)throw Error(i(290,t))}return t}function ua(t,r){throw t=Object.prototype.toString.call(r),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":t))}function py(t){var r=t._init;return r(t._payload)}function my(t){function r(J,V){if(t){var te=J.deletions;te===null?(J.deletions=[V],J.flags|=16):te.push(V)}}function a(J,V){if(!t)return null;for(;V!==null;)r(J,V),V=V.sibling;return null}function f(J,V){for(J=new Map;V!==null;)V.key!==null?J.set(V.key,V):J.set(V.index,V),V=V.sibling;return J}function g(J,V){return J=zr(J,V),J.index=0,J.sibling=null,J}function w(J,V,te){return J.index=te,t?(te=J.alternate,te!==null?(te=te.index,te<V?(J.flags|=2,V):te):(J.flags|=2,V)):(J.flags|=1048576,V)}function R(J){return t&&J.alternate===null&&(J.flags|=2),J}function L(J,V,te,he){return V===null||V.tag!==6?(V=hc(te,J.mode,he),V.return=J,V):(V=g(V,te),V.return=J,V)}function U(J,V,te,he){var Ne=te.type;return Ne===P?le(J,V,te.props.children,he,te.key):V!==null&&(V.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===H&&py(Ne)===V.type)?(he=g(V,te.props),he.ref=Hs(J,V,te),he.return=J,he):(he=Ia(te.type,te.key,te.props,null,J.mode,he),he.ref=Hs(J,V,te),he.return=J,he)}function ie(J,V,te,he){return V===null||V.tag!==4||V.stateNode.containerInfo!==te.containerInfo||V.stateNode.implementation!==te.implementation?(V=pc(te,J.mode,he),V.return=J,V):(V=g(V,te.children||[]),V.return=J,V)}function le(J,V,te,he,Ne){return V===null||V.tag!==7?(V=gi(te,J.mode,he,Ne),V.return=J,V):(V=g(V,te),V.return=J,V)}function de(J,V,te){if(typeof V=="string"&&V!==""||typeof V=="number")return V=hc(""+V,J.mode,te),V.return=J,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case j:return te=Ia(V.type,V.key,V.props,null,J.mode,te),te.ref=Hs(J,null,V),te.return=J,te;case I:return V=pc(V,J.mode,te),V.return=J,V;case H:var he=V._init;return de(J,he(V._payload),te)}if(st(V)||$(V))return V=gi(V,J.mode,te,null),V.return=J,V;ua(J,V)}return null}function ue(J,V,te,he){var Ne=V!==null?V.key:null;if(typeof te=="string"&&te!==""||typeof te=="number")return Ne!==null?null:L(J,V,""+te,he);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case j:return te.key===Ne?U(J,V,te,he):null;case I:return te.key===Ne?ie(J,V,te,he):null;case H:return Ne=te._init,ue(J,V,Ne(te._payload),he)}if(st(te)||$(te))return Ne!==null?null:le(J,V,te,he,null);ua(J,te)}return null}function we(J,V,te,he,Ne){if(typeof he=="string"&&he!==""||typeof he=="number")return J=J.get(te)||null,L(V,J,""+he,Ne);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case j:return J=J.get(he.key===null?te:he.key)||null,U(V,J,he,Ne);case I:return J=J.get(he.key===null?te:he.key)||null,ie(V,J,he,Ne);case H:var Re=he._init;return we(J,V,te,Re(he._payload),Ne)}if(st(he)||$(he))return J=J.get(te)||null,le(V,J,he,Ne,null);ua(V,he)}return null}function be(J,V,te,he){for(var Ne=null,Re=null,Te=V,Ie=V=0,jt=null;Te!==null&&Ie<te.length;Ie++){Te.index>Ie?(jt=Te,Te=null):jt=Te.sibling;var Fe=ue(J,Te,te[Ie],he);if(Fe===null){Te===null&&(Te=jt);break}t&&Te&&Fe.alternate===null&&r(J,Te),V=w(Fe,V,Ie),Re===null?Ne=Fe:Re.sibling=Fe,Re=Fe,Te=jt}if(Ie===te.length)return a(J,Te),rt&&ui(J,Ie),Ne;if(Te===null){for(;Ie<te.length;Ie++)Te=de(J,te[Ie],he),Te!==null&&(V=w(Te,V,Ie),Re===null?Ne=Te:Re.sibling=Te,Re=Te);return rt&&ui(J,Ie),Ne}for(Te=f(J,Te);Ie<te.length;Ie++)jt=we(Te,J,Ie,te[Ie],he),jt!==null&&(t&&jt.alternate!==null&&Te.delete(jt.key===null?Ie:jt.key),V=w(jt,V,Ie),Re===null?Ne=jt:Re.sibling=jt,Re=jt);return t&&Te.forEach(function(Br){return r(J,Br)}),rt&&ui(J,Ie),Ne}function Ee(J,V,te,he){var Ne=$(te);if(typeof Ne!="function")throw Error(i(150));if(te=Ne.call(te),te==null)throw Error(i(151));for(var Re=Ne=null,Te=V,Ie=V=0,jt=null,Fe=te.next();Te!==null&&!Fe.done;Ie++,Fe=te.next()){Te.index>Ie?(jt=Te,Te=null):jt=Te.sibling;var Br=ue(J,Te,Fe.value,he);if(Br===null){Te===null&&(Te=jt);break}t&&Te&&Br.alternate===null&&r(J,Te),V=w(Br,V,Ie),Re===null?Ne=Br:Re.sibling=Br,Re=Br,Te=jt}if(Fe.done)return a(J,Te),rt&&ui(J,Ie),Ne;if(Te===null){for(;!Fe.done;Ie++,Fe=te.next())Fe=de(J,Fe.value,he),Fe!==null&&(V=w(Fe,V,Ie),Re===null?Ne=Fe:Re.sibling=Fe,Re=Fe);return rt&&ui(J,Ie),Ne}for(Te=f(J,Te);!Fe.done;Ie++,Fe=te.next())Fe=we(Te,J,Ie,Fe.value,he),Fe!==null&&(t&&Fe.alternate!==null&&Te.delete(Fe.key===null?Ie:Fe.key),V=w(Fe,V,Ie),Re===null?Ne=Fe:Re.sibling=Fe,Re=Fe);return t&&Te.forEach(function(DR){return r(J,DR)}),rt&&ui(J,Ie),Ne}function gt(J,V,te,he){if(typeof te=="object"&&te!==null&&te.type===P&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case j:e:{for(var Ne=te.key,Re=V;Re!==null;){if(Re.key===Ne){if(Ne=te.type,Ne===P){if(Re.tag===7){a(J,Re.sibling),V=g(Re,te.props.children),V.return=J,J=V;break e}}else if(Re.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===H&&py(Ne)===Re.type){a(J,Re.sibling),V=g(Re,te.props),V.ref=Hs(J,Re,te),V.return=J,J=V;break e}a(J,Re);break}else r(J,Re);Re=Re.sibling}te.type===P?(V=gi(te.props.children,J.mode,he,te.key),V.return=J,J=V):(he=Ia(te.type,te.key,te.props,null,J.mode,he),he.ref=Hs(J,V,te),he.return=J,J=he)}return R(J);case I:e:{for(Re=te.key;V!==null;){if(V.key===Re)if(V.tag===4&&V.stateNode.containerInfo===te.containerInfo&&V.stateNode.implementation===te.implementation){a(J,V.sibling),V=g(V,te.children||[]),V.return=J,J=V;break e}else{a(J,V);break}else r(J,V);V=V.sibling}V=pc(te,J.mode,he),V.return=J,J=V}return R(J);case H:return Re=te._init,gt(J,V,Re(te._payload),he)}if(st(te))return be(J,V,te,he);if($(te))return Ee(J,V,te,he);ua(J,te)}return typeof te=="string"&&te!==""||typeof te=="number"?(te=""+te,V!==null&&V.tag===6?(a(J,V.sibling),V=g(V,te),V.return=J,J=V):(a(J,V),V=hc(te,J.mode,he),V.return=J,J=V),R(J)):a(J,V)}return gt}var Xi=my(!0),gy=my(!1),la=Ar(null),ca=null,Qi=null,bl=null;function kl(){bl=Qi=ca=null}function El(t){var r=la.current;tt(la),t._currentValue=r}function Nl(t,r,a){for(;t!==null;){var f=t.alternate;if((t.childLanes&r)!==r?(t.childLanes|=r,f!==null&&(f.childLanes|=r)):f!==null&&(f.childLanes&r)!==r&&(f.childLanes|=r),t===a)break;t=t.return}}function Zi(t,r){ca=t,bl=Qi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&r)!==0&&(Xt=!0),t.firstContext=null)}function yn(t){var r=t._currentValue;if(bl!==t)if(t={context:t,memoizedValue:r,next:null},Qi===null){if(ca===null)throw Error(i(308));Qi=t,ca.dependencies={lanes:0,firstContext:t}}else Qi=Qi.next=t;return r}var li=null;function Cl(t){li===null?li=[t]:li.push(t)}function vy(t,r,a,f){var g=r.interleaved;return g===null?(a.next=a,Cl(r)):(a.next=g.next,g.next=a),r.interleaved=a,ur(t,f)}function ur(t,r){t.lanes|=r;var a=t.alternate;for(a!==null&&(a.lanes|=r),a=t,t=t.return;t!==null;)t.childLanes|=r,a=t.alternate,a!==null&&(a.childLanes|=r),a=t,t=t.return;return a.tag===3?a.stateNode:null}var Pr=!1;function Rl(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function yy(t,r){t=t.updateQueue,r.updateQueue===t&&(r.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function lr(t,r){return{eventTime:t,lane:r,tag:0,payload:null,callback:null,next:null}}function Or(t,r,a){var f=t.updateQueue;if(f===null)return null;if(f=f.shared,(Le&2)!==0){var g=f.pending;return g===null?r.next=r:(r.next=g.next,g.next=r),f.pending=r,ur(t,a)}return g=f.interleaved,g===null?(r.next=r,Cl(f)):(r.next=g.next,g.next=r),f.interleaved=r,ur(t,a)}function fa(t,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194240)!==0)){var f=r.lanes;f&=t.pendingLanes,a|=f,r.lanes=a,Bu(t,a)}}function wy(t,r){var a=t.updateQueue,f=t.alternate;if(f!==null&&(f=f.updateQueue,a===f)){var g=null,w=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};w===null?g=w=R:w=w.next=R,a=a.next}while(a!==null);w===null?g=w=r:w=w.next=r}else g=w=r;a={baseState:f.baseState,firstBaseUpdate:g,lastBaseUpdate:w,shared:f.shared,effects:f.effects},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=r:t.next=r,a.lastBaseUpdate=r}function da(t,r,a,f){var g=t.updateQueue;Pr=!1;var w=g.firstBaseUpdate,R=g.lastBaseUpdate,L=g.shared.pending;if(L!==null){g.shared.pending=null;var U=L,ie=U.next;U.next=null,R===null?w=ie:R.next=ie,R=U;var le=t.alternate;le!==null&&(le=le.updateQueue,L=le.lastBaseUpdate,L!==R&&(L===null?le.firstBaseUpdate=ie:L.next=ie,le.lastBaseUpdate=U))}if(w!==null){var de=g.baseState;R=0,le=ie=U=null,L=w;do{var ue=L.lane,we=L.eventTime;if((f&ue)===ue){le!==null&&(le=le.next={eventTime:we,lane:0,tag:L.tag,payload:L.payload,callback:L.callback,next:null});e:{var be=t,Ee=L;switch(ue=r,we=a,Ee.tag){case 1:if(be=Ee.payload,typeof be=="function"){de=be.call(we,de,ue);break e}de=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ee.payload,ue=typeof be=="function"?be.call(we,de,ue):be,ue==null)break e;de=G({},de,ue);break e;case 2:Pr=!0}}L.callback!==null&&L.lane!==0&&(t.flags|=64,ue=g.effects,ue===null?g.effects=[L]:ue.push(L))}else we={eventTime:we,lane:ue,tag:L.tag,payload:L.payload,callback:L.callback,next:null},le===null?(ie=le=we,U=de):le=le.next=we,R|=ue;if(L=L.next,L===null){if(L=g.shared.pending,L===null)break;ue=L,L=ue.next,ue.next=null,g.lastBaseUpdate=ue,g.shared.pending=null}}while(!0);if(le===null&&(U=de),g.baseState=U,g.firstBaseUpdate=ie,g.lastBaseUpdate=le,r=g.shared.interleaved,r!==null){g=r;do R|=g.lane,g=g.next;while(g!==r)}else w===null&&(g.shared.lanes=0);di|=R,t.lanes=R,t.memoizedState=de}}function xy(t,r,a){if(t=r.effects,r.effects=null,t!==null)for(r=0;r<t.length;r++){var f=t[r],g=f.callback;if(g!==null){if(f.callback=null,f=a,typeof g!="function")throw Error(i(191,g));g.call(f)}}}var Vs={},Gn=Ar(Vs),Ws=Ar(Vs),Gs=Ar(Vs);function ci(t){if(t===Vs)throw Error(i(174));return t}function Tl(t,r){switch(Qe(Gs,r),Qe(Ws,t),Qe(Gn,Vs),t=r.nodeType,t){case 9:case 11:r=(r=r.documentElement)?r.namespaceURI:Ct(null,"");break;default:t=t===8?r.parentNode:r,r=t.namespaceURI||null,t=t.tagName,r=Ct(r,t)}tt(Gn),Qe(Gn,r)}function Ji(){tt(Gn),tt(Ws),tt(Gs)}function _y(t){ci(Gs.current);var r=ci(Gn.current),a=Ct(r,t.type);r!==a&&(Qe(Ws,t),Qe(Gn,a))}function jl(t){Ws.current===t&&(tt(Gn),tt(Ws))}var at=Ar(0);function ha(t){for(var r=t;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return r}else if(r.tag===19&&r.memoizedProps.revealOrder!==void 0){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Al=[];function Il(){for(var t=0;t<Al.length;t++)Al[t]._workInProgressVersionPrimary=null;Al.length=0}var pa=k.ReactCurrentDispatcher,Ml=k.ReactCurrentBatchConfig,fi=0,ut=null,bt=null,Rt=null,ma=!1,Ys=!1,Ks=0,aR=0;function Ft(){throw Error(i(321))}function Pl(t,r){if(r===null)return!1;for(var a=0;a<r.length&&a<t.length;a++)if(!In(t[a],r[a]))return!1;return!0}function Ol(t,r,a,f,g,w){if(fi=w,ut=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,pa.current=t===null||t.memoizedState===null?fR:dR,t=a(f,g),Ys){w=0;do{if(Ys=!1,Ks=0,25<=w)throw Error(i(301));w+=1,Rt=bt=null,r.updateQueue=null,pa.current=hR,t=a(f,g)}while(Ys)}if(pa.current=ya,r=bt!==null&&bt.next!==null,fi=0,Rt=bt=ut=null,ma=!1,r)throw Error(i(300));return t}function ql(){var t=Ks!==0;return Ks=0,t}function Yn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?ut.memoizedState=Rt=t:Rt=Rt.next=t,Rt}function wn(){if(bt===null){var t=ut.alternate;t=t!==null?t.memoizedState:null}else t=bt.next;var r=Rt===null?ut.memoizedState:Rt.next;if(r!==null)Rt=r,bt=t;else{if(t===null)throw Error(i(310));bt=t,t={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},Rt===null?ut.memoizedState=Rt=t:Rt=Rt.next=t}return Rt}function Xs(t,r){return typeof r=="function"?r(t):r}function Ll(t){var r=wn(),a=r.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=t;var f=bt,g=f.baseQueue,w=a.pending;if(w!==null){if(g!==null){var R=g.next;g.next=w.next,w.next=R}f.baseQueue=g=w,a.pending=null}if(g!==null){w=g.next,f=f.baseState;var L=R=null,U=null,ie=w;do{var le=ie.lane;if((fi&le)===le)U!==null&&(U=U.next={lane:0,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),f=ie.hasEagerState?ie.eagerState:t(f,ie.action);else{var de={lane:le,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null};U===null?(L=U=de,R=f):U=U.next=de,ut.lanes|=le,di|=le}ie=ie.next}while(ie!==null&&ie!==w);U===null?R=f:U.next=L,In(f,r.memoizedState)||(Xt=!0),r.memoizedState=f,r.baseState=R,r.baseQueue=U,a.lastRenderedState=f}if(t=a.interleaved,t!==null){g=t;do w=g.lane,ut.lanes|=w,di|=w,g=g.next;while(g!==t)}else g===null&&(a.lanes=0);return[r.memoizedState,a.dispatch]}function $l(t){var r=wn(),a=r.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=t;var f=a.dispatch,g=a.pending,w=r.memoizedState;if(g!==null){a.pending=null;var R=g=g.next;do w=t(w,R.action),R=R.next;while(R!==g);In(w,r.memoizedState)||(Xt=!0),r.memoizedState=w,r.baseQueue===null&&(r.baseState=w),a.lastRenderedState=w}return[w,f]}function Sy(){}function by(t,r){var a=ut,f=wn(),g=r(),w=!In(f.memoizedState,g);if(w&&(f.memoizedState=g,Xt=!0),f=f.queue,Dl(Ny.bind(null,a,f,t),[t]),f.getSnapshot!==r||w||Rt!==null&&Rt.memoizedState.tag&1){if(a.flags|=2048,Qs(9,Ey.bind(null,a,f,g,r),void 0,null),Tt===null)throw Error(i(349));(fi&30)!==0||ky(a,r,g)}return g}function ky(t,r,a){t.flags|=16384,t={getSnapshot:r,value:a},r=ut.updateQueue,r===null?(r={lastEffect:null,stores:null},ut.updateQueue=r,r.stores=[t]):(a=r.stores,a===null?r.stores=[t]:a.push(t))}function Ey(t,r,a,f){r.value=a,r.getSnapshot=f,Cy(r)&&Ry(t)}function Ny(t,r,a){return a(function(){Cy(r)&&Ry(t)})}function Cy(t){var r=t.getSnapshot;t=t.value;try{var a=r();return!In(t,a)}catch{return!0}}function Ry(t){var r=ur(t,1);r!==null&&Ln(r,t,1,-1)}function Ty(t){var r=Yn();return typeof t=="function"&&(t=t()),r.memoizedState=r.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xs,lastRenderedState:t},r.queue=t,t=t.dispatch=cR.bind(null,ut,t),[r.memoizedState,t]}function Qs(t,r,a,f){return t={tag:t,create:r,destroy:a,deps:f,next:null},r=ut.updateQueue,r===null?(r={lastEffect:null,stores:null},ut.updateQueue=r,r.lastEffect=t.next=t):(a=r.lastEffect,a===null?r.lastEffect=t.next=t:(f=a.next,a.next=t,t.next=f,r.lastEffect=t)),t}function jy(){return wn().memoizedState}function ga(t,r,a,f){var g=Yn();ut.flags|=t,g.memoizedState=Qs(1|r,a,void 0,f===void 0?null:f)}function va(t,r,a,f){var g=wn();f=f===void 0?null:f;var w=void 0;if(bt!==null){var R=bt.memoizedState;if(w=R.destroy,f!==null&&Pl(f,R.deps)){g.memoizedState=Qs(r,a,w,f);return}}ut.flags|=t,g.memoizedState=Qs(1|r,a,w,f)}function Ay(t,r){return ga(8390656,8,t,r)}function Dl(t,r){return va(2048,8,t,r)}function Iy(t,r){return va(4,2,t,r)}function My(t,r){return va(4,4,t,r)}function Py(t,r){if(typeof r=="function")return t=t(),r(t),function(){r(null)};if(r!=null)return t=t(),r.current=t,function(){r.current=null}}function Oy(t,r,a){return a=a!=null?a.concat([t]):null,va(4,4,Py.bind(null,r,t),a)}function Fl(){}function qy(t,r){var a=wn();r=r===void 0?null:r;var f=a.memoizedState;return f!==null&&r!==null&&Pl(r,f[1])?f[0]:(a.memoizedState=[t,r],t)}function Ly(t,r){var a=wn();r=r===void 0?null:r;var f=a.memoizedState;return f!==null&&r!==null&&Pl(r,f[1])?f[0]:(t=t(),a.memoizedState=[t,r],t)}function $y(t,r,a){return(fi&21)===0?(t.baseState&&(t.baseState=!1,Xt=!0),t.memoizedState=a):(In(a,r)||(a=ii(),ut.lanes|=a,di|=a,t.baseState=!0),r)}function uR(t,r){var a=Be;Be=a!==0&&4>a?a:4,t(!0);var f=Ml.transition;Ml.transition={};try{t(!1),r()}finally{Be=a,Ml.transition=f}}function Dy(){return wn().memoizedState}function lR(t,r,a){var f=Dr(t);if(a={lane:f,action:a,hasEagerState:!1,eagerState:null,next:null},Fy(t))zy(r,a);else if(a=vy(t,r,a,f),a!==null){var g=Vt();Ln(a,t,f,g),By(a,r,f)}}function cR(t,r,a){var f=Dr(t),g={lane:f,action:a,hasEagerState:!1,eagerState:null,next:null};if(Fy(t))zy(r,g);else{var w=t.alternate;if(t.lanes===0&&(w===null||w.lanes===0)&&(w=r.lastRenderedReducer,w!==null))try{var R=r.lastRenderedState,L=w(R,a);if(g.hasEagerState=!0,g.eagerState=L,In(L,R)){var U=r.interleaved;U===null?(g.next=g,Cl(r)):(g.next=U.next,U.next=g),r.interleaved=g;return}}catch{}finally{}a=vy(t,r,g,f),a!==null&&(g=Vt(),Ln(a,t,f,g),By(a,r,f))}}function Fy(t){var r=t.alternate;return t===ut||r!==null&&r===ut}function zy(t,r){Ys=ma=!0;var a=t.pending;a===null?r.next=r:(r.next=a.next,a.next=r),t.pending=r}function By(t,r,a){if((a&4194240)!==0){var f=r.lanes;f&=t.pendingLanes,a|=f,r.lanes=a,Bu(t,a)}}var ya={readContext:yn,useCallback:Ft,useContext:Ft,useEffect:Ft,useImperativeHandle:Ft,useInsertionEffect:Ft,useLayoutEffect:Ft,useMemo:Ft,useReducer:Ft,useRef:Ft,useState:Ft,useDebugValue:Ft,useDeferredValue:Ft,useTransition:Ft,useMutableSource:Ft,useSyncExternalStore:Ft,useId:Ft,unstable_isNewReconciler:!1},fR={readContext:yn,useCallback:function(t,r){return Yn().memoizedState=[t,r===void 0?null:r],t},useContext:yn,useEffect:Ay,useImperativeHandle:function(t,r,a){return a=a!=null?a.concat([t]):null,ga(4194308,4,Py.bind(null,r,t),a)},useLayoutEffect:function(t,r){return ga(4194308,4,t,r)},useInsertionEffect:function(t,r){return ga(4,2,t,r)},useMemo:function(t,r){var a=Yn();return r=r===void 0?null:r,t=t(),a.memoizedState=[t,r],t},useReducer:function(t,r,a){var f=Yn();return r=a!==void 0?a(r):r,f.memoizedState=f.baseState=r,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:r},f.queue=t,t=t.dispatch=lR.bind(null,ut,t),[f.memoizedState,t]},useRef:function(t){var r=Yn();return t={current:t},r.memoizedState=t},useState:Ty,useDebugValue:Fl,useDeferredValue:function(t){return Yn().memoizedState=t},useTransition:function(){var t=Ty(!1),r=t[0];return t=uR.bind(null,t[1]),Yn().memoizedState=t,[r,t]},useMutableSource:function(){},useSyncExternalStore:function(t,r,a){var f=ut,g=Yn();if(rt){if(a===void 0)throw Error(i(407));a=a()}else{if(a=r(),Tt===null)throw Error(i(349));(fi&30)!==0||ky(f,r,a)}g.memoizedState=a;var w={value:a,getSnapshot:r};return g.queue=w,Ay(Ny.bind(null,f,w,t),[t]),f.flags|=2048,Qs(9,Ey.bind(null,f,w,a,r),void 0,null),a},useId:function(){var t=Yn(),r=Tt.identifierPrefix;if(rt){var a=ar,f=or;a=(f&~(1<<32-Ae(f)-1)).toString(32)+a,r=":"+r+"R"+a,a=Ks++,0<a&&(r+="H"+a.toString(32)),r+=":"}else a=aR++,r=":"+r+"r"+a.toString(32)+":";return t.memoizedState=r},unstable_isNewReconciler:!1},dR={readContext:yn,useCallback:qy,useContext:yn,useEffect:Dl,useImperativeHandle:Oy,useInsertionEffect:Iy,useLayoutEffect:My,useMemo:Ly,useReducer:Ll,useRef:jy,useState:function(){return Ll(Xs)},useDebugValue:Fl,useDeferredValue:function(t){var r=wn();return $y(r,bt.memoizedState,t)},useTransition:function(){var t=Ll(Xs)[0],r=wn().memoizedState;return[t,r]},useMutableSource:Sy,useSyncExternalStore:by,useId:Dy,unstable_isNewReconciler:!1},hR={readContext:yn,useCallback:qy,useContext:yn,useEffect:Dl,useImperativeHandle:Oy,useInsertionEffect:Iy,useLayoutEffect:My,useMemo:Ly,useReducer:$l,useRef:jy,useState:function(){return $l(Xs)},useDebugValue:Fl,useDeferredValue:function(t){var r=wn();return bt===null?r.memoizedState=t:$y(r,bt.memoizedState,t)},useTransition:function(){var t=$l(Xs)[0],r=wn().memoizedState;return[t,r]},useMutableSource:Sy,useSyncExternalStore:by,useId:Dy,unstable_isNewReconciler:!1};function Pn(t,r){if(t&&t.defaultProps){r=G({},r),t=t.defaultProps;for(var a in t)r[a]===void 0&&(r[a]=t[a]);return r}return r}function zl(t,r,a,f){r=t.memoizedState,a=a(f,r),a=a==null?r:G({},r,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var wa={isMounted:function(t){return(t=t._reactInternals)?jn(t)===t:!1},enqueueSetState:function(t,r,a){t=t._reactInternals;var f=Vt(),g=Dr(t),w=lr(f,g);w.payload=r,a!=null&&(w.callback=a),r=Or(t,w,g),r!==null&&(Ln(r,t,g,f),fa(r,t,g))},enqueueReplaceState:function(t,r,a){t=t._reactInternals;var f=Vt(),g=Dr(t),w=lr(f,g);w.tag=1,w.payload=r,a!=null&&(w.callback=a),r=Or(t,w,g),r!==null&&(Ln(r,t,g,f),fa(r,t,g))},enqueueForceUpdate:function(t,r){t=t._reactInternals;var a=Vt(),f=Dr(t),g=lr(a,f);g.tag=2,r!=null&&(g.callback=r),r=Or(t,g,f),r!==null&&(Ln(r,t,f,a),fa(r,t,f))}};function Uy(t,r,a,f,g,w,R){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(f,w,R):r.prototype&&r.prototype.isPureReactComponent?!Ls(a,f)||!Ls(g,w):!0}function Hy(t,r,a){var f=!1,g=Ir,w=r.contextType;return typeof w=="object"&&w!==null?w=yn(w):(g=Kt(r)?oi:Dt.current,f=r.contextTypes,w=(f=f!=null)?Wi(t,g):Ir),r=new r(a,w),t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=wa,t.stateNode=r,r._reactInternals=t,f&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=g,t.__reactInternalMemoizedMaskedChildContext=w),r}function Vy(t,r,a,f){t=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,f),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,f),r.state!==t&&wa.enqueueReplaceState(r,r.state,null)}function Bl(t,r,a,f){var g=t.stateNode;g.props=a,g.state=t.memoizedState,g.refs={},Rl(t);var w=r.contextType;typeof w=="object"&&w!==null?g.context=yn(w):(w=Kt(r)?oi:Dt.current,g.context=Wi(t,w)),g.state=t.memoizedState,w=r.getDerivedStateFromProps,typeof w=="function"&&(zl(t,r,w,a),g.state=t.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(r=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),r!==g.state&&wa.enqueueReplaceState(g,g.state,null),da(t,a,g,f),g.state=t.memoizedState),typeof g.componentDidMount=="function"&&(t.flags|=4194308)}function es(t,r){try{var a="",f=r;do a+=W(f),f=f.return;while(f);var g=a}catch(w){g=`
|
|
39
|
+
Error generating stack: `+w.message+`
|
|
40
|
+
`+w.stack}return{value:t,source:r,stack:g,digest:null}}function Ul(t,r,a){return{value:t,source:null,stack:a??null,digest:r??null}}function Hl(t,r){try{console.error(r.value)}catch(a){setTimeout(function(){throw a})}}var pR=typeof WeakMap=="function"?WeakMap:Map;function Wy(t,r,a){a=lr(-1,a),a.tag=3,a.payload={element:null};var f=r.value;return a.callback=function(){Na||(Na=!0,sc=f),Hl(t,r)},a}function Gy(t,r,a){a=lr(-1,a),a.tag=3;var f=t.type.getDerivedStateFromError;if(typeof f=="function"){var g=r.value;a.payload=function(){return f(g)},a.callback=function(){Hl(t,r)}}var w=t.stateNode;return w!==null&&typeof w.componentDidCatch=="function"&&(a.callback=function(){Hl(t,r),typeof f!="function"&&(Lr===null?Lr=new Set([this]):Lr.add(this));var R=r.stack;this.componentDidCatch(r.value,{componentStack:R!==null?R:""})}),a}function Yy(t,r,a){var f=t.pingCache;if(f===null){f=t.pingCache=new pR;var g=new Set;f.set(r,g)}else g=f.get(r),g===void 0&&(g=new Set,f.set(r,g));g.has(a)||(g.add(a),t=RR.bind(null,t,r,a),r.then(t,t))}function Ky(t){do{var r;if((r=t.tag===13)&&(r=t.memoizedState,r=r!==null?r.dehydrated!==null:!0),r)return t;t=t.return}while(t!==null);return null}function Xy(t,r,a,f,g){return(t.mode&1)===0?(t===r?t.flags|=65536:(t.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(r=lr(-1,1),r.tag=2,Or(a,r,1))),a.lanes|=1),t):(t.flags|=65536,t.lanes=g,t)}var mR=k.ReactCurrentOwner,Xt=!1;function Ht(t,r,a,f){r.child=t===null?gy(r,null,a,f):Xi(r,t.child,a,f)}function Qy(t,r,a,f,g){a=a.render;var w=r.ref;return Zi(r,g),f=Ol(t,r,a,f,w,g),a=ql(),t!==null&&!Xt?(r.updateQueue=t.updateQueue,r.flags&=-2053,t.lanes&=~g,cr(t,r,g)):(rt&&a&&yl(r),r.flags|=1,Ht(t,r,f,g),r.child)}function Zy(t,r,a,f,g){if(t===null){var w=a.type;return typeof w=="function"&&!dc(w)&&w.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(r.tag=15,r.type=w,Jy(t,r,w,f,g)):(t=Ia(a.type,null,f,r,r.mode,g),t.ref=r.ref,t.return=r,r.child=t)}if(w=t.child,(t.lanes&g)===0){var R=w.memoizedProps;if(a=a.compare,a=a!==null?a:Ls,a(R,f)&&t.ref===r.ref)return cr(t,r,g)}return r.flags|=1,t=zr(w,f),t.ref=r.ref,t.return=r,r.child=t}function Jy(t,r,a,f,g){if(t!==null){var w=t.memoizedProps;if(Ls(w,f)&&t.ref===r.ref)if(Xt=!1,r.pendingProps=f=w,(t.lanes&g)!==0)(t.flags&131072)!==0&&(Xt=!0);else return r.lanes=t.lanes,cr(t,r,g)}return Vl(t,r,a,f,g)}function e0(t,r,a){var f=r.pendingProps,g=f.children,w=t!==null?t.memoizedState:null;if(f.mode==="hidden")if((r.mode&1)===0)r.memoizedState={baseLanes:0,cachePool:null,transitions:null},Qe(ns,cn),cn|=a;else{if((a&1073741824)===0)return t=w!==null?w.baseLanes|a:a,r.lanes=r.childLanes=1073741824,r.memoizedState={baseLanes:t,cachePool:null,transitions:null},r.updateQueue=null,Qe(ns,cn),cn|=t,null;r.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=w!==null?w.baseLanes:a,Qe(ns,cn),cn|=f}else w!==null?(f=w.baseLanes|a,r.memoizedState=null):f=a,Qe(ns,cn),cn|=f;return Ht(t,r,g,a),r.child}function t0(t,r){var a=r.ref;(t===null&&a!==null||t!==null&&t.ref!==a)&&(r.flags|=512,r.flags|=2097152)}function Vl(t,r,a,f,g){var w=Kt(a)?oi:Dt.current;return w=Wi(r,w),Zi(r,g),a=Ol(t,r,a,f,w,g),f=ql(),t!==null&&!Xt?(r.updateQueue=t.updateQueue,r.flags&=-2053,t.lanes&=~g,cr(t,r,g)):(rt&&f&&yl(r),r.flags|=1,Ht(t,r,a,g),r.child)}function n0(t,r,a,f,g){if(Kt(a)){var w=!0;ra(r)}else w=!1;if(Zi(r,g),r.stateNode===null)_a(t,r),Hy(r,a,f),Bl(r,a,f,g),f=!0;else if(t===null){var R=r.stateNode,L=r.memoizedProps;R.props=L;var U=R.context,ie=a.contextType;typeof ie=="object"&&ie!==null?ie=yn(ie):(ie=Kt(a)?oi:Dt.current,ie=Wi(r,ie));var le=a.getDerivedStateFromProps,de=typeof le=="function"||typeof R.getSnapshotBeforeUpdate=="function";de||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(L!==f||U!==ie)&&Vy(r,R,f,ie),Pr=!1;var ue=r.memoizedState;R.state=ue,da(r,f,R,g),U=r.memoizedState,L!==f||ue!==U||Yt.current||Pr?(typeof le=="function"&&(zl(r,a,le,f),U=r.memoizedState),(L=Pr||Uy(r,a,L,f,ue,U,ie))?(de||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"&&(r.flags|=4194308)):(typeof R.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=f,r.memoizedState=U),R.props=f,R.state=U,R.context=ie,f=L):(typeof R.componentDidMount=="function"&&(r.flags|=4194308),f=!1)}else{R=r.stateNode,yy(t,r),L=r.memoizedProps,ie=r.type===r.elementType?L:Pn(r.type,L),R.props=ie,de=r.pendingProps,ue=R.context,U=a.contextType,typeof U=="object"&&U!==null?U=yn(U):(U=Kt(a)?oi:Dt.current,U=Wi(r,U));var we=a.getDerivedStateFromProps;(le=typeof we=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(L!==de||ue!==U)&&Vy(r,R,f,U),Pr=!1,ue=r.memoizedState,R.state=ue,da(r,f,R,g);var be=r.memoizedState;L!==de||ue!==be||Yt.current||Pr?(typeof we=="function"&&(zl(r,a,we,f),be=r.memoizedState),(ie=Pr||Uy(r,a,ie,f,ue,be,U)||!1)?(le||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(f,be,U),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(f,be,U)),typeof R.componentDidUpdate=="function"&&(r.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof R.componentDidUpdate!="function"||L===t.memoizedProps&&ue===t.memoizedState||(r.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||L===t.memoizedProps&&ue===t.memoizedState||(r.flags|=1024),r.memoizedProps=f,r.memoizedState=be),R.props=f,R.state=be,R.context=U,f=ie):(typeof R.componentDidUpdate!="function"||L===t.memoizedProps&&ue===t.memoizedState||(r.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||L===t.memoizedProps&&ue===t.memoizedState||(r.flags|=1024),f=!1)}return Wl(t,r,a,f,w,g)}function Wl(t,r,a,f,g,w){t0(t,r);var R=(r.flags&128)!==0;if(!f&&!R)return g&&ay(r,a,!1),cr(t,r,w);f=r.stateNode,mR.current=r;var L=R&&typeof a.getDerivedStateFromError!="function"?null:f.render();return r.flags|=1,t!==null&&R?(r.child=Xi(r,t.child,null,w),r.child=Xi(r,null,L,w)):Ht(t,r,L,w),r.memoizedState=f.state,g&&ay(r,a,!0),r.child}function r0(t){var r=t.stateNode;r.pendingContext?sy(t,r.pendingContext,r.pendingContext!==r.context):r.context&&sy(t,r.context,!1),Tl(t,r.containerInfo)}function i0(t,r,a,f,g){return Ki(),Sl(g),r.flags|=256,Ht(t,r,a,f),r.child}var Gl={dehydrated:null,treeContext:null,retryLane:0};function Yl(t){return{baseLanes:t,cachePool:null,transitions:null}}function s0(t,r,a){var f=r.pendingProps,g=at.current,w=!1,R=(r.flags&128)!==0,L;if((L=R)||(L=t!==null&&t.memoizedState===null?!1:(g&2)!==0),L?(w=!0,r.flags&=-129):(t===null||t.memoizedState!==null)&&(g|=1),Qe(at,g&1),t===null)return _l(r),t=r.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((r.mode&1)===0?r.lanes=1:t.data==="$!"?r.lanes=8:r.lanes=1073741824,null):(R=f.children,t=f.fallback,w?(f=r.mode,w=r.child,R={mode:"hidden",children:R},(f&1)===0&&w!==null?(w.childLanes=0,w.pendingProps=R):w=Ma(R,f,0,null),t=gi(t,f,a,null),w.return=r,t.return=r,w.sibling=t,r.child=w,r.child.memoizedState=Yl(a),r.memoizedState=Gl,t):Kl(r,R));if(g=t.memoizedState,g!==null&&(L=g.dehydrated,L!==null))return gR(t,r,R,f,L,g,a);if(w){w=f.fallback,R=r.mode,g=t.child,L=g.sibling;var U={mode:"hidden",children:f.children};return(R&1)===0&&r.child!==g?(f=r.child,f.childLanes=0,f.pendingProps=U,r.deletions=null):(f=zr(g,U),f.subtreeFlags=g.subtreeFlags&14680064),L!==null?w=zr(L,w):(w=gi(w,R,a,null),w.flags|=2),w.return=r,f.return=r,f.sibling=w,r.child=f,f=w,w=r.child,R=t.child.memoizedState,R=R===null?Yl(a):{baseLanes:R.baseLanes|a,cachePool:null,transitions:R.transitions},w.memoizedState=R,w.childLanes=t.childLanes&~a,r.memoizedState=Gl,f}return w=t.child,t=w.sibling,f=zr(w,{mode:"visible",children:f.children}),(r.mode&1)===0&&(f.lanes=a),f.return=r,f.sibling=null,t!==null&&(a=r.deletions,a===null?(r.deletions=[t],r.flags|=16):a.push(t)),r.child=f,r.memoizedState=null,f}function Kl(t,r){return r=Ma({mode:"visible",children:r},t.mode,0,null),r.return=t,t.child=r}function xa(t,r,a,f){return f!==null&&Sl(f),Xi(r,t.child,null,a),t=Kl(r,r.pendingProps.children),t.flags|=2,r.memoizedState=null,t}function gR(t,r,a,f,g,w,R){if(a)return r.flags&256?(r.flags&=-257,f=Ul(Error(i(422))),xa(t,r,R,f)):r.memoizedState!==null?(r.child=t.child,r.flags|=128,null):(w=f.fallback,g=r.mode,f=Ma({mode:"visible",children:f.children},g,0,null),w=gi(w,g,R,null),w.flags|=2,f.return=r,w.return=r,f.sibling=w,r.child=f,(r.mode&1)!==0&&Xi(r,t.child,null,R),r.child.memoizedState=Yl(R),r.memoizedState=Gl,w);if((r.mode&1)===0)return xa(t,r,R,null);if(g.data==="$!"){if(f=g.nextSibling&&g.nextSibling.dataset,f)var L=f.dgst;return f=L,w=Error(i(419)),f=Ul(w,f,void 0),xa(t,r,R,f)}if(L=(R&t.childLanes)!==0,Xt||L){if(f=Tt,f!==null){switch(R&-R){case 4:g=2;break;case 16:g=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:g=32;break;case 536870912:g=268435456;break;default:g=0}g=(g&(f.suspendedLanes|R))!==0?0:g,g!==0&&g!==w.retryLane&&(w.retryLane=g,ur(t,g),Ln(f,t,g,-1))}return fc(),f=Ul(Error(i(421))),xa(t,r,R,f)}return g.data==="$?"?(r.flags|=128,r.child=t.child,r=TR.bind(null,t),g._reactRetry=r,null):(t=w.treeContext,ln=jr(g.nextSibling),un=r,rt=!0,Mn=null,t!==null&&(gn[vn++]=or,gn[vn++]=ar,gn[vn++]=ai,or=t.id,ar=t.overflow,ai=r),r=Kl(r,f.children),r.flags|=4096,r)}function o0(t,r,a){t.lanes|=r;var f=t.alternate;f!==null&&(f.lanes|=r),Nl(t.return,r,a)}function Xl(t,r,a,f,g){var w=t.memoizedState;w===null?t.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:f,tail:a,tailMode:g}:(w.isBackwards=r,w.rendering=null,w.renderingStartTime=0,w.last=f,w.tail=a,w.tailMode=g)}function a0(t,r,a){var f=r.pendingProps,g=f.revealOrder,w=f.tail;if(Ht(t,r,f.children,a),f=at.current,(f&2)!==0)f=f&1|2,r.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=r.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&o0(t,a,r);else if(t.tag===19)o0(t,a,r);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===r)break e;for(;t.sibling===null;){if(t.return===null||t.return===r)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}f&=1}if(Qe(at,f),(r.mode&1)===0)r.memoizedState=null;else switch(g){case"forwards":for(a=r.child,g=null;a!==null;)t=a.alternate,t!==null&&ha(t)===null&&(g=a),a=a.sibling;a=g,a===null?(g=r.child,r.child=null):(g=a.sibling,a.sibling=null),Xl(r,!1,g,a,w);break;case"backwards":for(a=null,g=r.child,r.child=null;g!==null;){if(t=g.alternate,t!==null&&ha(t)===null){r.child=g;break}t=g.sibling,g.sibling=a,a=g,g=t}Xl(r,!0,a,null,w);break;case"together":Xl(r,!1,null,null,void 0);break;default:r.memoizedState=null}return r.child}function _a(t,r){(r.mode&1)===0&&t!==null&&(t.alternate=null,r.alternate=null,r.flags|=2)}function cr(t,r,a){if(t!==null&&(r.dependencies=t.dependencies),di|=r.lanes,(a&r.childLanes)===0)return null;if(t!==null&&r.child!==t.child)throw Error(i(153));if(r.child!==null){for(t=r.child,a=zr(t,t.pendingProps),r.child=a,a.return=r;t.sibling!==null;)t=t.sibling,a=a.sibling=zr(t,t.pendingProps),a.return=r;a.sibling=null}return r.child}function vR(t,r,a){switch(r.tag){case 3:r0(r),Ki();break;case 5:_y(r);break;case 1:Kt(r.type)&&ra(r);break;case 4:Tl(r,r.stateNode.containerInfo);break;case 10:var f=r.type._context,g=r.memoizedProps.value;Qe(la,f._currentValue),f._currentValue=g;break;case 13:if(f=r.memoizedState,f!==null)return f.dehydrated!==null?(Qe(at,at.current&1),r.flags|=128,null):(a&r.child.childLanes)!==0?s0(t,r,a):(Qe(at,at.current&1),t=cr(t,r,a),t!==null?t.sibling:null);Qe(at,at.current&1);break;case 19:if(f=(a&r.childLanes)!==0,(t.flags&128)!==0){if(f)return a0(t,r,a);r.flags|=128}if(g=r.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),Qe(at,at.current),f)break;return null;case 22:case 23:return r.lanes=0,e0(t,r,a)}return cr(t,r,a)}var u0,Ql,l0,c0;u0=function(t,r){for(var a=r.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===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},Ql=function(){},l0=function(t,r,a,f){var g=t.memoizedProps;if(g!==f){t=r.stateNode,ci(Gn.current);var w=null;switch(a){case"input":g=Me(t,g),f=Me(t,f),w=[];break;case"select":g=G({},g,{value:void 0}),f=G({},f,{value:void 0}),w=[];break;case"textarea":g=lt(t,g),f=lt(t,f),w=[];break;default:typeof g.onClick!="function"&&typeof f.onClick=="function"&&(t.onclick=ea)}ht(a,f);var R;a=null;for(ie in g)if(!f.hasOwnProperty(ie)&&g.hasOwnProperty(ie)&&g[ie]!=null)if(ie==="style"){var L=g[ie];for(R in L)L.hasOwnProperty(R)&&(a||(a={}),a[R]="")}else ie!=="dangerouslySetInnerHTML"&&ie!=="children"&&ie!=="suppressContentEditableWarning"&&ie!=="suppressHydrationWarning"&&ie!=="autoFocus"&&(o.hasOwnProperty(ie)?w||(w=[]):(w=w||[]).push(ie,null));for(ie in f){var U=f[ie];if(L=g!=null?g[ie]:void 0,f.hasOwnProperty(ie)&&U!==L&&(U!=null||L!=null))if(ie==="style")if(L){for(R in L)!L.hasOwnProperty(R)||U&&U.hasOwnProperty(R)||(a||(a={}),a[R]="");for(R in U)U.hasOwnProperty(R)&&L[R]!==U[R]&&(a||(a={}),a[R]=U[R])}else a||(w||(w=[]),w.push(ie,a)),a=U;else ie==="dangerouslySetInnerHTML"?(U=U?U.__html:void 0,L=L?L.__html:void 0,U!=null&&L!==U&&(w=w||[]).push(ie,U)):ie==="children"?typeof U!="string"&&typeof U!="number"||(w=w||[]).push(ie,""+U):ie!=="suppressContentEditableWarning"&&ie!=="suppressHydrationWarning"&&(o.hasOwnProperty(ie)?(U!=null&&ie==="onScroll"&&et("scroll",t),w||L===U||(w=[])):(w=w||[]).push(ie,U))}a&&(w=w||[]).push("style",a);var ie=w;(r.updateQueue=ie)&&(r.flags|=4)}},c0=function(t,r,a,f){a!==f&&(r.flags|=4)};function Zs(t,r){if(!rt)switch(t.tailMode){case"hidden":r=t.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.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?r||t.tail===null?t.tail=null:t.tail.sibling=null:f.sibling=null}}function zt(t){var r=t.alternate!==null&&t.alternate.child===t.child,a=0,f=0;if(r)for(var g=t.child;g!==null;)a|=g.lanes|g.childLanes,f|=g.subtreeFlags&14680064,f|=g.flags&14680064,g.return=t,g=g.sibling;else for(g=t.child;g!==null;)a|=g.lanes|g.childLanes,f|=g.subtreeFlags,f|=g.flags,g.return=t,g=g.sibling;return t.subtreeFlags|=f,t.childLanes=a,r}function yR(t,r,a){var f=r.pendingProps;switch(wl(r),r.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zt(r),null;case 1:return Kt(r.type)&&na(),zt(r),null;case 3:return f=r.stateNode,Ji(),tt(Yt),tt(Dt),Il(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(t===null||t.child===null)&&(aa(r)?r.flags|=4:t===null||t.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Mn!==null&&(uc(Mn),Mn=null))),Ql(t,r),zt(r),null;case 5:jl(r);var g=ci(Gs.current);if(a=r.type,t!==null&&r.stateNode!=null)l0(t,r,a,f,g),t.ref!==r.ref&&(r.flags|=512,r.flags|=2097152);else{if(!f){if(r.stateNode===null)throw Error(i(166));return zt(r),null}if(t=ci(Gn.current),aa(r)){f=r.stateNode,a=r.type;var w=r.memoizedProps;switch(f[Wn]=r,f[Bs]=w,t=(r.mode&1)!==0,a){case"dialog":et("cancel",f),et("close",f);break;case"iframe":case"object":case"embed":et("load",f);break;case"video":case"audio":for(g=0;g<Ds.length;g++)et(Ds[g],f);break;case"source":et("error",f);break;case"img":case"image":case"link":et("error",f),et("load",f);break;case"details":et("toggle",f);break;case"input":ke(f,w),et("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!w.multiple},et("invalid",f);break;case"textarea":Ke(f,w),et("invalid",f)}ht(a,w),g=null;for(var R in w)if(w.hasOwnProperty(R)){var L=w[R];R==="children"?typeof L=="string"?f.textContent!==L&&(w.suppressHydrationWarning!==!0&&Jo(f.textContent,L,t),g=["children",L]):typeof L=="number"&&f.textContent!==""+L&&(w.suppressHydrationWarning!==!0&&Jo(f.textContent,L,t),g=["children",""+L]):o.hasOwnProperty(R)&&L!=null&&R==="onScroll"&&et("scroll",f)}switch(a){case"input":Pe(f),_e(f,w,!0);break;case"textarea":Pe(f),At(f);break;case"select":case"option":break;default:typeof w.onClick=="function"&&(f.onclick=ea)}f=g,r.updateQueue=f,f!==null&&(r.flags|=4)}else{R=g.nodeType===9?g:g.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Xe(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[Wn]=r,t[Bs]=f,u0(t,r,!1,!1),r.stateNode=t;e:{switch(R=It(a,f),a){case"dialog":et("cancel",t),et("close",t),g=f;break;case"iframe":case"object":case"embed":et("load",t),g=f;break;case"video":case"audio":for(g=0;g<Ds.length;g++)et(Ds[g],t);g=f;break;case"source":et("error",t),g=f;break;case"img":case"image":case"link":et("error",t),et("load",t),g=f;break;case"details":et("toggle",t),g=f;break;case"input":ke(t,f),g=Me(t,f),et("invalid",t);break;case"option":g=f;break;case"select":t._wrapperState={wasMultiple:!!f.multiple},g=G({},f,{value:void 0}),et("invalid",t);break;case"textarea":Ke(t,f),g=lt(t,f),et("invalid",t);break;default:g=f}ht(a,g),L=g;for(w in L)if(L.hasOwnProperty(w)){var U=L[w];w==="style"?ot(t,U):w==="dangerouslySetInnerHTML"?(U=U?U.__html:void 0,U!=null&&Wt(t,U)):w==="children"?typeof U=="string"?(a!=="textarea"||U!=="")&&Je(t,U):typeof U=="number"&&Je(t,""+U):w!=="suppressContentEditableWarning"&&w!=="suppressHydrationWarning"&&w!=="autoFocus"&&(o.hasOwnProperty(w)?U!=null&&w==="onScroll"&&et("scroll",t):U!=null&&E(t,w,U,R))}switch(a){case"input":Pe(t),_e(t,f,!1);break;case"textarea":Pe(t),At(t);break;case"option":f.value!=null&&t.setAttribute("value",""+ce(f.value));break;case"select":t.multiple=!!f.multiple,w=f.value,w!=null?vt(t,!!f.multiple,w,!1):f.defaultValue!=null&&vt(t,!!f.multiple,f.defaultValue,!0);break;default:typeof g.onClick=="function"&&(t.onclick=ea)}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&&(r.flags|=4)}r.ref!==null&&(r.flags|=512,r.flags|=2097152)}return zt(r),null;case 6:if(t&&r.stateNode!=null)c0(t,r,t.memoizedProps,f);else{if(typeof f!="string"&&r.stateNode===null)throw Error(i(166));if(a=ci(Gs.current),ci(Gn.current),aa(r)){if(f=r.stateNode,a=r.memoizedProps,f[Wn]=r,(w=f.nodeValue!==a)&&(t=un,t!==null))switch(t.tag){case 3:Jo(f.nodeValue,a,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Jo(f.nodeValue,a,(t.mode&1)!==0)}w&&(r.flags|=4)}else f=(a.nodeType===9?a:a.ownerDocument).createTextNode(f),f[Wn]=r,r.stateNode=f}return zt(r),null;case 13:if(tt(at),f=r.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(rt&&ln!==null&&(r.mode&1)!==0&&(r.flags&128)===0)hy(),Ki(),r.flags|=98560,w=!1;else if(w=aa(r),f!==null&&f.dehydrated!==null){if(t===null){if(!w)throw Error(i(318));if(w=r.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(i(317));w[Wn]=r}else Ki(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;zt(r),w=!1}else Mn!==null&&(uc(Mn),Mn=null),w=!0;if(!w)return r.flags&65536?r:null}return(r.flags&128)!==0?(r.lanes=a,r):(f=f!==null,f!==(t!==null&&t.memoizedState!==null)&&f&&(r.child.flags|=8192,(r.mode&1)!==0&&(t===null||(at.current&1)!==0?kt===0&&(kt=3):fc())),r.updateQueue!==null&&(r.flags|=4),zt(r),null);case 4:return Ji(),Ql(t,r),t===null&&Fs(r.stateNode.containerInfo),zt(r),null;case 10:return El(r.type._context),zt(r),null;case 17:return Kt(r.type)&&na(),zt(r),null;case 19:if(tt(at),w=r.memoizedState,w===null)return zt(r),null;if(f=(r.flags&128)!==0,R=w.rendering,R===null)if(f)Zs(w,!1);else{if(kt!==0||t!==null&&(t.flags&128)!==0)for(t=r.child;t!==null;){if(R=ha(t),R!==null){for(r.flags|=128,Zs(w,!1),f=R.updateQueue,f!==null&&(r.updateQueue=f,r.flags|=4),r.subtreeFlags=0,f=a,a=r.child;a!==null;)w=a,t=f,w.flags&=14680066,R=w.alternate,R===null?(w.childLanes=0,w.lanes=t,w.child=null,w.subtreeFlags=0,w.memoizedProps=null,w.memoizedState=null,w.updateQueue=null,w.dependencies=null,w.stateNode=null):(w.childLanes=R.childLanes,w.lanes=R.lanes,w.child=R.child,w.subtreeFlags=0,w.deletions=null,w.memoizedProps=R.memoizedProps,w.memoizedState=R.memoizedState,w.updateQueue=R.updateQueue,w.type=R.type,t=R.dependencies,w.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),a=a.sibling;return Qe(at,at.current&1|2),r.child}t=t.sibling}w.tail!==null&&Ge()>rs&&(r.flags|=128,f=!0,Zs(w,!1),r.lanes=4194304)}else{if(!f)if(t=ha(R),t!==null){if(r.flags|=128,f=!0,a=t.updateQueue,a!==null&&(r.updateQueue=a,r.flags|=4),Zs(w,!0),w.tail===null&&w.tailMode==="hidden"&&!R.alternate&&!rt)return zt(r),null}else 2*Ge()-w.renderingStartTime>rs&&a!==1073741824&&(r.flags|=128,f=!0,Zs(w,!1),r.lanes=4194304);w.isBackwards?(R.sibling=r.child,r.child=R):(a=w.last,a!==null?a.sibling=R:r.child=R,w.last=R)}return w.tail!==null?(r=w.tail,w.rendering=r,w.tail=r.sibling,w.renderingStartTime=Ge(),r.sibling=null,a=at.current,Qe(at,f?a&1|2:a&1),r):(zt(r),null);case 22:case 23:return cc(),f=r.memoizedState!==null,t!==null&&t.memoizedState!==null!==f&&(r.flags|=8192),f&&(r.mode&1)!==0?(cn&1073741824)!==0&&(zt(r),r.subtreeFlags&6&&(r.flags|=8192)):zt(r),null;case 24:return null;case 25:return null}throw Error(i(156,r.tag))}function wR(t,r){switch(wl(r),r.tag){case 1:return Kt(r.type)&&na(),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return Ji(),tt(Yt),tt(Dt),Il(),t=r.flags,(t&65536)!==0&&(t&128)===0?(r.flags=t&-65537|128,r):null;case 5:return jl(r),null;case 13:if(tt(at),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Ki()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return tt(at),null;case 4:return Ji(),null;case 10:return El(r.type._context),null;case 22:case 23:return cc(),null;case 24:return null;default:return null}}var Sa=!1,Bt=!1,xR=typeof WeakSet=="function"?WeakSet:Set,Se=null;function ts(t,r){var a=t.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(f){ft(t,r,f)}else a.current=null}function Zl(t,r,a){try{a()}catch(f){ft(t,r,f)}}var f0=!1;function _R(t,r){if(cl=Bo,t=Uv(),nl(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 g=f.anchorOffset,w=f.focusNode;f=f.focusOffset;try{a.nodeType,w.nodeType}catch{a=null;break e}var R=0,L=-1,U=-1,ie=0,le=0,de=t,ue=null;t:for(;;){for(var we;de!==a||g!==0&&de.nodeType!==3||(L=R+g),de!==w||f!==0&&de.nodeType!==3||(U=R+f),de.nodeType===3&&(R+=de.nodeValue.length),(we=de.firstChild)!==null;)ue=de,de=we;for(;;){if(de===t)break t;if(ue===a&&++ie===g&&(L=R),ue===w&&++le===f&&(U=R),(we=de.nextSibling)!==null)break;de=ue,ue=de.parentNode}de=we}a=L===-1||U===-1?null:{start:L,end:U}}else a=null}a=a||{start:0,end:0}}else a=null;for(fl={focusedElem:t,selectionRange:a},Bo=!1,Se=r;Se!==null;)if(r=Se,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,Se=t;else for(;Se!==null;){r=Se;try{var be=r.alternate;if((r.flags&1024)!==0)switch(r.tag){case 0:case 11:case 15:break;case 1:if(be!==null){var Ee=be.memoizedProps,gt=be.memoizedState,J=r.stateNode,V=J.getSnapshotBeforeUpdate(r.elementType===r.type?Ee:Pn(r.type,Ee),gt);J.__reactInternalSnapshotBeforeUpdate=V}break;case 3:var te=r.stateNode.containerInfo;te.nodeType===1?te.textContent="":te.nodeType===9&&te.documentElement&&te.removeChild(te.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(he){ft(r,r.return,he)}if(t=r.sibling,t!==null){t.return=r.return,Se=t;break}Se=r.return}return be=f0,f0=!1,be}function Js(t,r,a){var f=r.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var g=f=f.next;do{if((g.tag&t)===t){var w=g.destroy;g.destroy=void 0,w!==void 0&&Zl(r,a,w)}g=g.next}while(g!==f)}}function ba(t,r){if(r=r.updateQueue,r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&t)===t){var f=a.create;a.destroy=f()}a=a.next}while(a!==r)}}function Jl(t){var r=t.ref;if(r!==null){var a=t.stateNode;switch(t.tag){case 5:t=a;break;default:t=a}typeof r=="function"?r(t):r.current=t}}function d0(t){var r=t.alternate;r!==null&&(t.alternate=null,d0(r)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(r=t.stateNode,r!==null&&(delete r[Wn],delete r[Bs],delete r[ml],delete r[rR],delete r[iR])),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 h0(t){return t.tag===5||t.tag===3||t.tag===4}function p0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||h0(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 ec(t,r,a){var f=t.tag;if(f===5||f===6)t=t.stateNode,r?a.nodeType===8?a.parentNode.insertBefore(t,r):a.insertBefore(t,r):(a.nodeType===8?(r=a.parentNode,r.insertBefore(t,a)):(r=a,r.appendChild(t)),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=ea));else if(f!==4&&(t=t.child,t!==null))for(ec(t,r,a),t=t.sibling;t!==null;)ec(t,r,a),t=t.sibling}function tc(t,r,a){var f=t.tag;if(f===5||f===6)t=t.stateNode,r?a.insertBefore(t,r):a.appendChild(t);else if(f!==4&&(t=t.child,t!==null))for(tc(t,r,a),t=t.sibling;t!==null;)tc(t,r,a),t=t.sibling}var qt=null,On=!1;function qr(t,r,a){for(a=a.child;a!==null;)m0(t,r,a),a=a.sibling}function m0(t,r,a){if(ve&&typeof ve.onCommitFiberUnmount=="function")try{ve.onCommitFiberUnmount(ge,a)}catch{}switch(a.tag){case 5:Bt||ts(a,r);case 6:var f=qt,g=On;qt=null,qr(t,r,a),qt=f,On=g,qt!==null&&(On?(t=qt,a=a.stateNode,t.nodeType===8?t.parentNode.removeChild(a):t.removeChild(a)):qt.removeChild(a.stateNode));break;case 18:qt!==null&&(On?(t=qt,a=a.stateNode,t.nodeType===8?pl(t.parentNode,a):t.nodeType===1&&pl(t,a),As(t)):pl(qt,a.stateNode));break;case 4:f=qt,g=On,qt=a.stateNode.containerInfo,On=!0,qr(t,r,a),qt=f,On=g;break;case 0:case 11:case 14:case 15:if(!Bt&&(f=a.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){g=f=f.next;do{var w=g,R=w.destroy;w=w.tag,R!==void 0&&((w&2)!==0||(w&4)!==0)&&Zl(a,r,R),g=g.next}while(g!==f)}qr(t,r,a);break;case 1:if(!Bt&&(ts(a,r),f=a.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=a.memoizedProps,f.state=a.memoizedState,f.componentWillUnmount()}catch(L){ft(a,r,L)}qr(t,r,a);break;case 21:qr(t,r,a);break;case 22:a.mode&1?(Bt=(f=Bt)||a.memoizedState!==null,qr(t,r,a),Bt=f):qr(t,r,a);break;default:qr(t,r,a)}}function g0(t){var r=t.updateQueue;if(r!==null){t.updateQueue=null;var a=t.stateNode;a===null&&(a=t.stateNode=new xR),r.forEach(function(f){var g=jR.bind(null,t,f);a.has(f)||(a.add(f),f.then(g,g))})}}function qn(t,r){var a=r.deletions;if(a!==null)for(var f=0;f<a.length;f++){var g=a[f];try{var w=t,R=r,L=R;e:for(;L!==null;){switch(L.tag){case 5:qt=L.stateNode,On=!1;break e;case 3:qt=L.stateNode.containerInfo,On=!0;break e;case 4:qt=L.stateNode.containerInfo,On=!0;break e}L=L.return}if(qt===null)throw Error(i(160));m0(w,R,g),qt=null,On=!1;var U=g.alternate;U!==null&&(U.return=null),g.return=null}catch(ie){ft(g,r,ie)}}if(r.subtreeFlags&12854)for(r=r.child;r!==null;)v0(r,t),r=r.sibling}function v0(t,r){var a=t.alternate,f=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(qn(r,t),Kn(t),f&4){try{Js(3,t,t.return),ba(3,t)}catch(Ee){ft(t,t.return,Ee)}try{Js(5,t,t.return)}catch(Ee){ft(t,t.return,Ee)}}break;case 1:qn(r,t),Kn(t),f&512&&a!==null&&ts(a,a.return);break;case 5:if(qn(r,t),Kn(t),f&512&&a!==null&&ts(a,a.return),t.flags&32){var g=t.stateNode;try{Je(g,"")}catch(Ee){ft(t,t.return,Ee)}}if(f&4&&(g=t.stateNode,g!=null)){var w=t.memoizedProps,R=a!==null?a.memoizedProps:w,L=t.type,U=t.updateQueue;if(t.updateQueue=null,U!==null)try{L==="input"&&w.type==="radio"&&w.name!=null&&De(g,w),It(L,R);var ie=It(L,w);for(R=0;R<U.length;R+=2){var le=U[R],de=U[R+1];le==="style"?ot(g,de):le==="dangerouslySetInnerHTML"?Wt(g,de):le==="children"?Je(g,de):E(g,le,de,ie)}switch(L){case"input":xe(g,w);break;case"textarea":yt(g,w);break;case"select":var ue=g._wrapperState.wasMultiple;g._wrapperState.wasMultiple=!!w.multiple;var we=w.value;we!=null?vt(g,!!w.multiple,we,!1):ue!==!!w.multiple&&(w.defaultValue!=null?vt(g,!!w.multiple,w.defaultValue,!0):vt(g,!!w.multiple,w.multiple?[]:"",!1))}g[Bs]=w}catch(Ee){ft(t,t.return,Ee)}}break;case 6:if(qn(r,t),Kn(t),f&4){if(t.stateNode===null)throw Error(i(162));g=t.stateNode,w=t.memoizedProps;try{g.nodeValue=w}catch(Ee){ft(t,t.return,Ee)}}break;case 3:if(qn(r,t),Kn(t),f&4&&a!==null&&a.memoizedState.isDehydrated)try{As(r.containerInfo)}catch(Ee){ft(t,t.return,Ee)}break;case 4:qn(r,t),Kn(t);break;case 13:qn(r,t),Kn(t),g=t.child,g.flags&8192&&(w=g.memoizedState!==null,g.stateNode.isHidden=w,!w||g.alternate!==null&&g.alternate.memoizedState!==null||(ic=Ge())),f&4&&g0(t);break;case 22:if(le=a!==null&&a.memoizedState!==null,t.mode&1?(Bt=(ie=Bt)||le,qn(r,t),Bt=ie):qn(r,t),Kn(t),f&8192){if(ie=t.memoizedState!==null,(t.stateNode.isHidden=ie)&&!le&&(t.mode&1)!==0)for(Se=t,le=t.child;le!==null;){for(de=Se=le;Se!==null;){switch(ue=Se,we=ue.child,ue.tag){case 0:case 11:case 14:case 15:Js(4,ue,ue.return);break;case 1:ts(ue,ue.return);var be=ue.stateNode;if(typeof be.componentWillUnmount=="function"){f=ue,a=ue.return;try{r=f,be.props=r.memoizedProps,be.state=r.memoizedState,be.componentWillUnmount()}catch(Ee){ft(f,a,Ee)}}break;case 5:ts(ue,ue.return);break;case 22:if(ue.memoizedState!==null){x0(de);continue}}we!==null?(we.return=ue,Se=we):x0(de)}le=le.sibling}e:for(le=null,de=t;;){if(de.tag===5){if(le===null){le=de;try{g=de.stateNode,ie?(w=g.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none"):(L=de.stateNode,U=de.memoizedProps.style,R=U!=null&&U.hasOwnProperty("display")?U.display:null,L.style.display=ct("display",R))}catch(Ee){ft(t,t.return,Ee)}}}else if(de.tag===6){if(le===null)try{de.stateNode.nodeValue=ie?"":de.memoizedProps}catch(Ee){ft(t,t.return,Ee)}}else if((de.tag!==22&&de.tag!==23||de.memoizedState===null||de===t)&&de.child!==null){de.child.return=de,de=de.child;continue}if(de===t)break e;for(;de.sibling===null;){if(de.return===null||de.return===t)break e;le===de&&(le=null),de=de.return}le===de&&(le=null),de.sibling.return=de.return,de=de.sibling}}break;case 19:qn(r,t),Kn(t),f&4&&g0(t);break;case 21:break;default:qn(r,t),Kn(t)}}function Kn(t){var r=t.flags;if(r&2){try{e:{for(var a=t.return;a!==null;){if(h0(a)){var f=a;break e}a=a.return}throw Error(i(160))}switch(f.tag){case 5:var g=f.stateNode;f.flags&32&&(Je(g,""),f.flags&=-33);var w=p0(t);tc(t,w,g);break;case 3:case 4:var R=f.stateNode.containerInfo,L=p0(t);ec(t,L,R);break;default:throw Error(i(161))}}catch(U){ft(t,t.return,U)}t.flags&=-3}r&4096&&(t.flags&=-4097)}function SR(t,r,a){Se=t,y0(t)}function y0(t,r,a){for(var f=(t.mode&1)!==0;Se!==null;){var g=Se,w=g.child;if(g.tag===22&&f){var R=g.memoizedState!==null||Sa;if(!R){var L=g.alternate,U=L!==null&&L.memoizedState!==null||Bt;L=Sa;var ie=Bt;if(Sa=R,(Bt=U)&&!ie)for(Se=g;Se!==null;)R=Se,U=R.child,R.tag===22&&R.memoizedState!==null?_0(g):U!==null?(U.return=R,Se=U):_0(g);for(;w!==null;)Se=w,y0(w),w=w.sibling;Se=g,Sa=L,Bt=ie}w0(t)}else(g.subtreeFlags&8772)!==0&&w!==null?(w.return=g,Se=w):w0(t)}}function w0(t){for(;Se!==null;){var r=Se;if((r.flags&8772)!==0){var a=r.alternate;try{if((r.flags&8772)!==0)switch(r.tag){case 0:case 11:case 15:Bt||ba(5,r);break;case 1:var f=r.stateNode;if(r.flags&4&&!Bt)if(a===null)f.componentDidMount();else{var g=r.elementType===r.type?a.memoizedProps:Pn(r.type,a.memoizedProps);f.componentDidUpdate(g,a.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var w=r.updateQueue;w!==null&&xy(r,w,f);break;case 3:var R=r.updateQueue;if(R!==null){if(a=null,r.child!==null)switch(r.child.tag){case 5:a=r.child.stateNode;break;case 1:a=r.child.stateNode}xy(r,R,a)}break;case 5:var L=r.stateNode;if(a===null&&r.flags&4){a=L;var U=r.memoizedProps;switch(r.type){case"button":case"input":case"select":case"textarea":U.autoFocus&&a.focus();break;case"img":U.src&&(a.src=U.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(r.memoizedState===null){var ie=r.alternate;if(ie!==null){var le=ie.memoizedState;if(le!==null){var de=le.dehydrated;de!==null&&As(de)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(i(163))}Bt||r.flags&512&&Jl(r)}catch(ue){ft(r,r.return,ue)}}if(r===t){Se=null;break}if(a=r.sibling,a!==null){a.return=r.return,Se=a;break}Se=r.return}}function x0(t){for(;Se!==null;){var r=Se;if(r===t){Se=null;break}var a=r.sibling;if(a!==null){a.return=r.return,Se=a;break}Se=r.return}}function _0(t){for(;Se!==null;){var r=Se;try{switch(r.tag){case 0:case 11:case 15:var a=r.return;try{ba(4,r)}catch(U){ft(r,a,U)}break;case 1:var f=r.stateNode;if(typeof f.componentDidMount=="function"){var g=r.return;try{f.componentDidMount()}catch(U){ft(r,g,U)}}var w=r.return;try{Jl(r)}catch(U){ft(r,w,U)}break;case 5:var R=r.return;try{Jl(r)}catch(U){ft(r,R,U)}}}catch(U){ft(r,r.return,U)}if(r===t){Se=null;break}var L=r.sibling;if(L!==null){L.return=r.return,Se=L;break}Se=r.return}}var bR=Math.ceil,ka=k.ReactCurrentDispatcher,nc=k.ReactCurrentOwner,xn=k.ReactCurrentBatchConfig,Le=0,Tt=null,xt=null,Lt=0,cn=0,ns=Ar(0),kt=0,eo=null,di=0,Ea=0,rc=0,to=null,Qt=null,ic=0,rs=1/0,fr=null,Na=!1,sc=null,Lr=null,Ca=!1,$r=null,Ra=0,no=0,oc=null,Ta=-1,ja=0;function Vt(){return(Le&6)!==0?Ge():Ta!==-1?Ta:Ta=Ge()}function Dr(t){return(t.mode&1)===0?1:(Le&2)!==0&&Lt!==0?Lt&-Lt:oR.transition!==null?(ja===0&&(ja=ii()),ja):(t=Be,t!==0||(t=window.event,t=t===void 0?16:bv(t.type)),t)}function Ln(t,r,a,f){if(50<no)throw no=0,oc=null,Error(i(185));nt(t,a,f),((Le&2)===0||t!==Tt)&&(t===Tt&&((Le&2)===0&&(Ea|=a),kt===4&&Fr(t,Lt)),Zt(t,f),a===1&&Le===0&&(r.mode&1)===0&&(rs=Ge()+500,ia&&Mr()))}function Zt(t,r){var a=t.callbackNode;Ns(t,r);var f=br(t,t===Tt?Lt:0);if(f===0)a!==null&&_r(a),t.callbackNode=null,t.callbackPriority=0;else if(r=f&-f,t.callbackPriority!==r){if(a!=null&&_r(a),r===1)t.tag===0?sR(b0.bind(null,t)):uy(b0.bind(null,t)),tR(function(){(Le&6)===0&&Mr()}),a=null;else{switch(mv(f)){case 1:a=ni;break;case 4:a=Ot;break;case 16:a=Z;break;case 536870912:a=fe;break;default:a=Z}a=A0(a,S0.bind(null,t))}t.callbackPriority=r,t.callbackNode=a}}function S0(t,r){if(Ta=-1,ja=0,(Le&6)!==0)throw Error(i(327));var a=t.callbackNode;if(is()&&t.callbackNode!==a)return null;var f=br(t,t===Tt?Lt:0);if(f===0)return null;if((f&30)!==0||(f&t.expiredLanes)!==0||r)r=Aa(t,f);else{r=f;var g=Le;Le|=2;var w=E0();(Tt!==t||Lt!==r)&&(fr=null,rs=Ge()+500,pi(t,r));do try{NR();break}catch(L){k0(t,L)}while(!0);kl(),ka.current=w,Le=g,xt!==null?r=0:(Tt=null,Lt=0,r=kt)}if(r!==0){if(r===2&&(g=qi(t),g!==0&&(f=g,r=ac(t,g))),r===1)throw a=eo,pi(t,0),Fr(t,f),Zt(t,Ge()),a;if(r===6)Fr(t,f);else{if(g=t.current.alternate,(f&30)===0&&!kR(g)&&(r=Aa(t,f),r===2&&(w=qi(t),w!==0&&(f=w,r=ac(t,w))),r===1))throw a=eo,pi(t,0),Fr(t,f),Zt(t,Ge()),a;switch(t.finishedWork=g,t.finishedLanes=f,r){case 0:case 1:throw Error(i(345));case 2:mi(t,Qt,fr);break;case 3:if(Fr(t,f),(f&130023424)===f&&(r=ic+500-Ge(),10<r)){if(br(t,0)!==0)break;if(g=t.suspendedLanes,(g&f)!==f){Vt(),t.pingedLanes|=t.suspendedLanes&g;break}t.timeoutHandle=hl(mi.bind(null,t,Qt,fr),r);break}mi(t,Qt,fr);break;case 4:if(Fr(t,f),(f&4194240)===f)break;for(r=t.eventTimes,g=-1;0<f;){var R=31-Ae(f);w=1<<R,R=r[R],R>g&&(g=R),f&=~w}if(f=g,f=Ge()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*bR(f/1960))-f,10<f){t.timeoutHandle=hl(mi.bind(null,t,Qt,fr),f);break}mi(t,Qt,fr);break;case 5:mi(t,Qt,fr);break;default:throw Error(i(329))}}}return Zt(t,Ge()),t.callbackNode===a?S0.bind(null,t):null}function ac(t,r){var a=to;return t.current.memoizedState.isDehydrated&&(pi(t,r).flags|=256),t=Aa(t,r),t!==2&&(r=Qt,Qt=a,r!==null&&uc(r)),t}function uc(t){Qt===null?Qt=t:Qt.push.apply(Qt,t)}function kR(t){for(var r=t;;){if(r.flags&16384){var a=r.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var f=0;f<a.length;f++){var g=a[f],w=g.getSnapshot;g=g.value;try{if(!In(w(),g))return!1}catch{return!1}}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Fr(t,r){for(r&=~rc,r&=~Ea,t.suspendedLanes|=r,t.pingedLanes&=~r,t=t.expirationTimes;0<r;){var a=31-Ae(r),f=1<<a;t[a]=-1,r&=~f}}function b0(t){if((Le&6)!==0)throw Error(i(327));is();var r=br(t,0);if((r&1)===0)return Zt(t,Ge()),null;var a=Aa(t,r);if(t.tag!==0&&a===2){var f=qi(t);f!==0&&(r=f,a=ac(t,f))}if(a===1)throw a=eo,pi(t,0),Fr(t,r),Zt(t,Ge()),a;if(a===6)throw Error(i(345));return t.finishedWork=t.current.alternate,t.finishedLanes=r,mi(t,Qt,fr),Zt(t,Ge()),null}function lc(t,r){var a=Le;Le|=1;try{return t(r)}finally{Le=a,Le===0&&(rs=Ge()+500,ia&&Mr())}}function hi(t){$r!==null&&$r.tag===0&&(Le&6)===0&&is();var r=Le;Le|=1;var a=xn.transition,f=Be;try{if(xn.transition=null,Be=1,t)return t()}finally{Be=f,xn.transition=a,Le=r,(Le&6)===0&&Mr()}}function cc(){cn=ns.current,tt(ns)}function pi(t,r){t.finishedWork=null,t.finishedLanes=0;var a=t.timeoutHandle;if(a!==-1&&(t.timeoutHandle=-1,eR(a)),xt!==null)for(a=xt.return;a!==null;){var f=a;switch(wl(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&na();break;case 3:Ji(),tt(Yt),tt(Dt),Il();break;case 5:jl(f);break;case 4:Ji();break;case 13:tt(at);break;case 19:tt(at);break;case 10:El(f.type._context);break;case 22:case 23:cc()}a=a.return}if(Tt=t,xt=t=zr(t.current,null),Lt=cn=r,kt=0,eo=null,rc=Ea=di=0,Qt=to=null,li!==null){for(r=0;r<li.length;r++)if(a=li[r],f=a.interleaved,f!==null){a.interleaved=null;var g=f.next,w=a.pending;if(w!==null){var R=w.next;w.next=g,f.next=R}a.pending=f}li=null}return t}function k0(t,r){do{var a=xt;try{if(kl(),pa.current=ya,ma){for(var f=ut.memoizedState;f!==null;){var g=f.queue;g!==null&&(g.pending=null),f=f.next}ma=!1}if(fi=0,Rt=bt=ut=null,Ys=!1,Ks=0,nc.current=null,a===null||a.return===null){kt=1,eo=r,xt=null;break}e:{var w=t,R=a.return,L=a,U=r;if(r=Lt,L.flags|=32768,U!==null&&typeof U=="object"&&typeof U.then=="function"){var ie=U,le=L,de=le.tag;if((le.mode&1)===0&&(de===0||de===11||de===15)){var ue=le.alternate;ue?(le.updateQueue=ue.updateQueue,le.memoizedState=ue.memoizedState,le.lanes=ue.lanes):(le.updateQueue=null,le.memoizedState=null)}var we=Ky(R);if(we!==null){we.flags&=-257,Xy(we,R,L,w,r),we.mode&1&&Yy(w,ie,r),r=we,U=ie;var be=r.updateQueue;if(be===null){var Ee=new Set;Ee.add(U),r.updateQueue=Ee}else be.add(U);break e}else{if((r&1)===0){Yy(w,ie,r),fc();break e}U=Error(i(426))}}else if(rt&&L.mode&1){var gt=Ky(R);if(gt!==null){(gt.flags&65536)===0&&(gt.flags|=256),Xy(gt,R,L,w,r),Sl(es(U,L));break e}}w=U=es(U,L),kt!==4&&(kt=2),to===null?to=[w]:to.push(w),w=R;do{switch(w.tag){case 3:w.flags|=65536,r&=-r,w.lanes|=r;var J=Wy(w,U,r);wy(w,J);break e;case 1:L=U;var V=w.type,te=w.stateNode;if((w.flags&128)===0&&(typeof V.getDerivedStateFromError=="function"||te!==null&&typeof te.componentDidCatch=="function"&&(Lr===null||!Lr.has(te)))){w.flags|=65536,r&=-r,w.lanes|=r;var he=Gy(w,L,r);wy(w,he);break e}}w=w.return}while(w!==null)}C0(a)}catch(Ne){r=Ne,xt===a&&a!==null&&(xt=a=a.return);continue}break}while(!0)}function E0(){var t=ka.current;return ka.current=ya,t===null?ya:t}function fc(){(kt===0||kt===3||kt===2)&&(kt=4),Tt===null||(di&268435455)===0&&(Ea&268435455)===0||Fr(Tt,Lt)}function Aa(t,r){var a=Le;Le|=2;var f=E0();(Tt!==t||Lt!==r)&&(fr=null,pi(t,r));do try{ER();break}catch(g){k0(t,g)}while(!0);if(kl(),Le=a,ka.current=f,xt!==null)throw Error(i(261));return Tt=null,Lt=0,kt}function ER(){for(;xt!==null;)N0(xt)}function NR(){for(;xt!==null&&!Sr();)N0(xt)}function N0(t){var r=j0(t.alternate,t,cn);t.memoizedProps=t.pendingProps,r===null?C0(t):xt=r,nc.current=null}function C0(t){var r=t;do{var a=r.alternate;if(t=r.return,(r.flags&32768)===0){if(a=yR(a,r,cn),a!==null){xt=a;return}}else{if(a=wR(a,r),a!==null){a.flags&=32767,xt=a;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{kt=6,xt=null;return}}if(r=r.sibling,r!==null){xt=r;return}xt=r=t}while(r!==null);kt===0&&(kt=5)}function mi(t,r,a){var f=Be,g=xn.transition;try{xn.transition=null,Be=1,CR(t,r,a,f)}finally{xn.transition=g,Be=f}return null}function CR(t,r,a,f){do is();while($r!==null);if((Le&6)!==0)throw Error(i(327));a=t.finishedWork;var g=t.finishedLanes;if(a===null)return null;if(t.finishedWork=null,t.finishedLanes=0,a===t.current)throw Error(i(177));t.callbackNode=null,t.callbackPriority=0;var w=a.lanes|a.childLanes;if(Do(t,w),t===Tt&&(xt=Tt=null,Lt=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||Ca||(Ca=!0,A0(Z,function(){return is(),null})),w=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||w){w=xn.transition,xn.transition=null;var R=Be;Be=1;var L=Le;Le|=4,nc.current=null,_R(t,a),v0(a,t),GC(fl),Bo=!!cl,fl=cl=null,t.current=a,SR(a),Oi(),Le=L,Be=R,xn.transition=w}else t.current=a;if(Ca&&(Ca=!1,$r=t,Ra=g),w=t.pendingLanes,w===0&&(Lr=null),ye(a.stateNode),Zt(t,Ge()),r!==null)for(f=t.onRecoverableError,a=0;a<r.length;a++)g=r[a],f(g.value,{componentStack:g.stack,digest:g.digest});if(Na)throw Na=!1,t=sc,sc=null,t;return(Ra&1)!==0&&t.tag!==0&&is(),w=t.pendingLanes,(w&1)!==0?t===oc?no++:(no=0,oc=t):no=0,Mr(),null}function is(){if($r!==null){var t=mv(Ra),r=xn.transition,a=Be;try{if(xn.transition=null,Be=16>t?16:t,$r===null)var f=!1;else{if(t=$r,$r=null,Ra=0,(Le&6)!==0)throw Error(i(331));var g=Le;for(Le|=4,Se=t.current;Se!==null;){var w=Se,R=w.child;if((Se.flags&16)!==0){var L=w.deletions;if(L!==null){for(var U=0;U<L.length;U++){var ie=L[U];for(Se=ie;Se!==null;){var le=Se;switch(le.tag){case 0:case 11:case 15:Js(8,le,w)}var de=le.child;if(de!==null)de.return=le,Se=de;else for(;Se!==null;){le=Se;var ue=le.sibling,we=le.return;if(d0(le),le===ie){Se=null;break}if(ue!==null){ue.return=we,Se=ue;break}Se=we}}}var be=w.alternate;if(be!==null){var Ee=be.child;if(Ee!==null){be.child=null;do{var gt=Ee.sibling;Ee.sibling=null,Ee=gt}while(Ee!==null)}}Se=w}}if((w.subtreeFlags&2064)!==0&&R!==null)R.return=w,Se=R;else e:for(;Se!==null;){if(w=Se,(w.flags&2048)!==0)switch(w.tag){case 0:case 11:case 15:Js(9,w,w.return)}var J=w.sibling;if(J!==null){J.return=w.return,Se=J;break e}Se=w.return}}var V=t.current;for(Se=V;Se!==null;){R=Se;var te=R.child;if((R.subtreeFlags&2064)!==0&&te!==null)te.return=R,Se=te;else e:for(R=V;Se!==null;){if(L=Se,(L.flags&2048)!==0)try{switch(L.tag){case 0:case 11:case 15:ba(9,L)}}catch(Ne){ft(L,L.return,Ne)}if(L===R){Se=null;break e}var he=L.sibling;if(he!==null){he.return=L.return,Se=he;break e}Se=L.return}}if(Le=g,Mr(),ve&&typeof ve.onPostCommitFiberRoot=="function")try{ve.onPostCommitFiberRoot(ge,t)}catch{}f=!0}return f}finally{Be=a,xn.transition=r}}return!1}function R0(t,r,a){r=es(a,r),r=Wy(t,r,1),t=Or(t,r,1),r=Vt(),t!==null&&(nt(t,1,r),Zt(t,r))}function ft(t,r,a){if(t.tag===3)R0(t,t,a);else for(;r!==null;){if(r.tag===3){R0(r,t,a);break}else if(r.tag===1){var f=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Lr===null||!Lr.has(f))){t=es(a,t),t=Gy(r,t,1),r=Or(r,t,1),t=Vt(),r!==null&&(nt(r,1,t),Zt(r,t));break}}r=r.return}}function RR(t,r,a){var f=t.pingCache;f!==null&&f.delete(r),r=Vt(),t.pingedLanes|=t.suspendedLanes&a,Tt===t&&(Lt&a)===a&&(kt===4||kt===3&&(Lt&130023424)===Lt&&500>Ge()-ic?pi(t,0):rc|=a),Zt(t,r)}function T0(t,r){r===0&&((t.mode&1)===0?r=1:(r=Ut,Ut<<=1,(Ut&130023424)===0&&(Ut=4194304)));var a=Vt();t=ur(t,r),t!==null&&(nt(t,r,a),Zt(t,a))}function TR(t){var r=t.memoizedState,a=0;r!==null&&(a=r.retryLane),T0(t,a)}function jR(t,r){var a=0;switch(t.tag){case 13:var f=t.stateNode,g=t.memoizedState;g!==null&&(a=g.retryLane);break;case 19:f=t.stateNode;break;default:throw Error(i(314))}f!==null&&f.delete(r),T0(t,a)}var j0;j0=function(t,r,a){if(t!==null)if(t.memoizedProps!==r.pendingProps||Yt.current)Xt=!0;else{if((t.lanes&a)===0&&(r.flags&128)===0)return Xt=!1,vR(t,r,a);Xt=(t.flags&131072)!==0}else Xt=!1,rt&&(r.flags&1048576)!==0&&ly(r,oa,r.index);switch(r.lanes=0,r.tag){case 2:var f=r.type;_a(t,r),t=r.pendingProps;var g=Wi(r,Dt.current);Zi(r,a),g=Ol(null,r,f,t,g,a);var w=ql();return r.flags|=1,typeof g=="object"&&g!==null&&typeof g.render=="function"&&g.$$typeof===void 0?(r.tag=1,r.memoizedState=null,r.updateQueue=null,Kt(f)?(w=!0,ra(r)):w=!1,r.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,Rl(r),g.updater=wa,r.stateNode=g,g._reactInternals=r,Bl(r,f,t,a),r=Wl(null,r,f,!0,w,a)):(r.tag=0,rt&&w&&yl(r),Ht(null,r,g,a),r=r.child),r;case 16:f=r.elementType;e:{switch(_a(t,r),t=r.pendingProps,g=f._init,f=g(f._payload),r.type=f,g=r.tag=IR(f),t=Pn(f,t),g){case 0:r=Vl(null,r,f,t,a);break e;case 1:r=n0(null,r,f,t,a);break e;case 11:r=Qy(null,r,f,t,a);break e;case 14:r=Zy(null,r,f,Pn(f.type,t),a);break e}throw Error(i(306,f,""))}return r;case 0:return f=r.type,g=r.pendingProps,g=r.elementType===f?g:Pn(f,g),Vl(t,r,f,g,a);case 1:return f=r.type,g=r.pendingProps,g=r.elementType===f?g:Pn(f,g),n0(t,r,f,g,a);case 3:e:{if(r0(r),t===null)throw Error(i(387));f=r.pendingProps,w=r.memoizedState,g=w.element,yy(t,r),da(r,f,null,a);var R=r.memoizedState;if(f=R.element,w.isDehydrated)if(w={element:f,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},r.updateQueue.baseState=w,r.memoizedState=w,r.flags&256){g=es(Error(i(423)),r),r=i0(t,r,f,a,g);break e}else if(f!==g){g=es(Error(i(424)),r),r=i0(t,r,f,a,g);break e}else for(ln=jr(r.stateNode.containerInfo.firstChild),un=r,rt=!0,Mn=null,a=gy(r,null,f,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Ki(),f===g){r=cr(t,r,a);break e}Ht(t,r,f,a)}r=r.child}return r;case 5:return _y(r),t===null&&_l(r),f=r.type,g=r.pendingProps,w=t!==null?t.memoizedProps:null,R=g.children,dl(f,g)?R=null:w!==null&&dl(f,w)&&(r.flags|=32),t0(t,r),Ht(t,r,R,a),r.child;case 6:return t===null&&_l(r),null;case 13:return s0(t,r,a);case 4:return Tl(r,r.stateNode.containerInfo),f=r.pendingProps,t===null?r.child=Xi(r,null,f,a):Ht(t,r,f,a),r.child;case 11:return f=r.type,g=r.pendingProps,g=r.elementType===f?g:Pn(f,g),Qy(t,r,f,g,a);case 7:return Ht(t,r,r.pendingProps,a),r.child;case 8:return Ht(t,r,r.pendingProps.children,a),r.child;case 12:return Ht(t,r,r.pendingProps.children,a),r.child;case 10:e:{if(f=r.type._context,g=r.pendingProps,w=r.memoizedProps,R=g.value,Qe(la,f._currentValue),f._currentValue=R,w!==null)if(In(w.value,R)){if(w.children===g.children&&!Yt.current){r=cr(t,r,a);break e}}else for(w=r.child,w!==null&&(w.return=r);w!==null;){var L=w.dependencies;if(L!==null){R=w.child;for(var U=L.firstContext;U!==null;){if(U.context===f){if(w.tag===1){U=lr(-1,a&-a),U.tag=2;var ie=w.updateQueue;if(ie!==null){ie=ie.shared;var le=ie.pending;le===null?U.next=U:(U.next=le.next,le.next=U),ie.pending=U}}w.lanes|=a,U=w.alternate,U!==null&&(U.lanes|=a),Nl(w.return,a,r),L.lanes|=a;break}U=U.next}}else if(w.tag===10)R=w.type===r.type?null:w.child;else if(w.tag===18){if(R=w.return,R===null)throw Error(i(341));R.lanes|=a,L=R.alternate,L!==null&&(L.lanes|=a),Nl(R,a,r),R=w.sibling}else R=w.child;if(R!==null)R.return=w;else for(R=w;R!==null;){if(R===r){R=null;break}if(w=R.sibling,w!==null){w.return=R.return,R=w;break}R=R.return}w=R}Ht(t,r,g.children,a),r=r.child}return r;case 9:return g=r.type,f=r.pendingProps.children,Zi(r,a),g=yn(g),f=f(g),r.flags|=1,Ht(t,r,f,a),r.child;case 14:return f=r.type,g=Pn(f,r.pendingProps),g=Pn(f.type,g),Zy(t,r,f,g,a);case 15:return Jy(t,r,r.type,r.pendingProps,a);case 17:return f=r.type,g=r.pendingProps,g=r.elementType===f?g:Pn(f,g),_a(t,r),r.tag=1,Kt(f)?(t=!0,ra(r)):t=!1,Zi(r,a),Hy(r,f,g),Bl(r,f,g,a),Wl(null,r,f,!0,t,a);case 19:return a0(t,r,a);case 22:return e0(t,r,a)}throw Error(i(156,r.tag))};function A0(t,r){return ei(t,r)}function AR(t,r,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=r,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 _n(t,r,a,f){return new AR(t,r,a,f)}function dc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function IR(t){if(typeof t=="function")return dc(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Q)return 11;if(t===Y)return 14}return 2}function zr(t,r){var a=t.alternate;return a===null?(a=_n(t.tag,r,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=r,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,r=t.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a}function Ia(t,r,a,f,g,w){var R=2;if(f=t,typeof t=="function")dc(t)&&(R=1);else if(typeof t=="string")R=5;else e:switch(t){case P:return gi(a.children,g,w,r);case D:R=8,g|=8;break;case A:return t=_n(12,a,r,g|2),t.elementType=A,t.lanes=w,t;case K:return t=_n(13,a,r,g),t.elementType=K,t.lanes=w,t;case T:return t=_n(19,a,r,g),t.elementType=T,t.lanes=w,t;case re:return Ma(a,g,w,r);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case F:R=10;break e;case q:R=9;break e;case Q:R=11;break e;case Y:R=14;break e;case H:R=16,f=null;break e}throw Error(i(130,t==null?t:typeof t,""))}return r=_n(R,a,r,g),r.elementType=t,r.type=f,r.lanes=w,r}function gi(t,r,a,f){return t=_n(7,t,f,r),t.lanes=a,t}function Ma(t,r,a,f){return t=_n(22,t,f,r),t.elementType=re,t.lanes=a,t.stateNode={isHidden:!1},t}function hc(t,r,a){return t=_n(6,t,null,r),t.lanes=a,t}function pc(t,r,a){return r=_n(4,t.children!==null?t.children:[],t.key,r),r.lanes=a,r.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},r}function MR(t,r,a,f,g){this.tag=r,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=on(0),this.expirationTimes=on(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=on(0),this.identifierPrefix=f,this.onRecoverableError=g,this.mutableSourceEagerHydrationData=null}function mc(t,r,a,f,g,w,R,L,U){return t=new MR(t,r,a,L,U),r===1?(r=1,w===!0&&(r|=8)):r=0,w=_n(3,null,null,r),t.current=w,w.stateNode=t,w.memoizedState={element:f,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Rl(w),t}function PR(t,r,a){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:I,key:f==null?null:""+f,children:t,containerInfo:r,implementation:a}}function I0(t){if(!t)return Ir;t=t._reactInternals;e:{if(jn(t)!==t||t.tag!==1)throw Error(i(170));var r=t;do{switch(r.tag){case 3:r=r.stateNode.context;break e;case 1:if(Kt(r.type)){r=r.stateNode.__reactInternalMemoizedMergedChildContext;break e}}r=r.return}while(r!==null);throw Error(i(171))}if(t.tag===1){var a=t.type;if(Kt(a))return oy(t,a,r)}return r}function M0(t,r,a,f,g,w,R,L,U){return t=mc(a,f,!0,t,g,w,R,L,U),t.context=I0(null),a=t.current,f=Vt(),g=Dr(a),w=lr(f,g),w.callback=r??null,Or(a,w,g),t.current.lanes=g,nt(t,g,f),Zt(t,f),t}function Pa(t,r,a,f){var g=r.current,w=Vt(),R=Dr(g);return a=I0(a),r.context===null?r.context=a:r.pendingContext=a,r=lr(w,R),r.payload={element:t},f=f===void 0?null:f,f!==null&&(r.callback=f),t=Or(g,r,R),t!==null&&(Ln(t,g,R,w),fa(t,g,R)),R}function Oa(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 P0(t,r){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<r?a:r}}function gc(t,r){P0(t,r),(t=t.alternate)&&P0(t,r)}function OR(){return null}var O0=typeof reportError=="function"?reportError:function(t){console.error(t)};function vc(t){this._internalRoot=t}qa.prototype.render=vc.prototype.render=function(t){var r=this._internalRoot;if(r===null)throw Error(i(409));Pa(t,r,null,null)},qa.prototype.unmount=vc.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var r=t.containerInfo;hi(function(){Pa(null,t,null,null)}),r[ir]=null}};function qa(t){this._internalRoot=t}qa.prototype.unstable_scheduleHydration=function(t){if(t){var r=yv();t={blockedOn:null,target:t,priority:r};for(var a=0;a<Cr.length&&r!==0&&r<Cr[a].priority;a++);Cr.splice(a,0,t),a===0&&_v(t)}};function yc(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function La(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function q0(){}function qR(t,r,a,f,g){if(g){if(typeof f=="function"){var w=f;f=function(){var ie=Oa(R);w.call(ie)}}var R=M0(r,f,t,0,null,!1,!1,"",q0);return t._reactRootContainer=R,t[ir]=R.current,Fs(t.nodeType===8?t.parentNode:t),hi(),R}for(;g=t.lastChild;)t.removeChild(g);if(typeof f=="function"){var L=f;f=function(){var ie=Oa(U);L.call(ie)}}var U=mc(t,0,!1,null,null,!1,!1,"",q0);return t._reactRootContainer=U,t[ir]=U.current,Fs(t.nodeType===8?t.parentNode:t),hi(function(){Pa(r,U,a,f)}),U}function $a(t,r,a,f,g){var w=a._reactRootContainer;if(w){var R=w;if(typeof g=="function"){var L=g;g=function(){var U=Oa(R);L.call(U)}}Pa(r,R,t,g)}else R=qR(a,r,t,g,f);return Oa(R)}gv=function(t){switch(t.tag){case 3:var r=t.stateNode;if(r.current.memoizedState.isDehydrated){var a=An(r.pendingLanes);a!==0&&(Bu(r,a|1),Zt(r,Ge()),(Le&6)===0&&(rs=Ge()+500,Mr()))}break;case 13:hi(function(){var f=ur(t,1);if(f!==null){var g=Vt();Ln(f,t,1,g)}}),gc(t,1)}},Uu=function(t){if(t.tag===13){var r=ur(t,134217728);if(r!==null){var a=Vt();Ln(r,t,134217728,a)}gc(t,134217728)}},vv=function(t){if(t.tag===13){var r=Dr(t),a=ur(t,r);if(a!==null){var f=Vt();Ln(a,t,r,f)}gc(t,r)}},yv=function(){return Be},wv=function(t,r){var a=Be;try{return Be=t,r()}finally{Be=a}},Cn=function(t,r,a){switch(r){case"input":if(xe(t,a),r=a.name,a.type==="radio"&&r!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+r)+'][type="radio"]'),r=0;r<a.length;r++){var f=a[r];if(f!==t&&f.form===t.form){var g=ta(f);if(!g)throw Error(i(90));ze(f),xe(f,g)}}}break;case"textarea":yt(t,a);break;case"select":r=a.value,r!=null&&vt(t,!!a.multiple,r,!1)}},Ai=lc,Pt=hi;var LR={usingClientEntryPoint:!1,Events:[Us,Hi,ta,Xr,Qr,lc]},ro={findFiberByHostInstance:si,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$R={bundleType:ro.bundleType,version:ro.version,rendererPackageName:ro.rendererPackageName,rendererConfig:ro.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:k.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Pi(t),t===null?null:t.stateNode},findFiberByHostInstance:ro.findFiberByHostInstance||OR,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 Da=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Da.isDisabled&&Da.supportsFiber)try{ge=Da.inject($R),ve=Da}catch{}}return Jt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=LR,Jt.createPortal=function(t,r){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!yc(r))throw Error(i(200));return PR(t,r,null,a)},Jt.createRoot=function(t,r){if(!yc(t))throw Error(i(299));var a=!1,f="",g=O0;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(f=r.identifierPrefix),r.onRecoverableError!==void 0&&(g=r.onRecoverableError)),r=mc(t,1,!1,null,null,a,!1,f,g),t[ir]=r.current,Fs(t.nodeType===8?t.parentNode:t),new vc(r)},Jt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var r=t._reactInternals;if(r===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=Pi(r),t=t===null?null:t.stateNode,t},Jt.flushSync=function(t){return hi(t)},Jt.hydrate=function(t,r,a){if(!La(r))throw Error(i(200));return $a(null,t,r,!0,a)},Jt.hydrateRoot=function(t,r,a){if(!yc(t))throw Error(i(405));var f=a!=null&&a.hydratedSources||null,g=!1,w="",R=O0;if(a!=null&&(a.unstable_strictMode===!0&&(g=!0),a.identifierPrefix!==void 0&&(w=a.identifierPrefix),a.onRecoverableError!==void 0&&(R=a.onRecoverableError)),r=M0(r,null,t,1,a??null,g,!1,w,R),t[ir]=r.current,Fs(t),f)for(t=0;t<f.length;t++)a=f[t],g=a._getVersion,g=g(a._source),r.mutableSourceEagerHydrationData==null?r.mutableSourceEagerHydrationData=[a,g]:r.mutableSourceEagerHydrationData.push(a,g);return new qa(r)},Jt.render=function(t,r,a){if(!La(r))throw Error(i(200));return $a(null,t,r,!1,a)},Jt.unmountComponentAtNode=function(t){if(!La(t))throw Error(i(40));return t._reactRootContainer?(hi(function(){$a(null,null,t,!1,function(){t._reactRootContainer=null,t[ir]=null})}),!0):!1},Jt.unstable_batchedUpdates=lc,Jt.unstable_renderSubtreeIntoContainer=function(t,r,a,f){if(!La(a))throw Error(i(200));if(t==null||t._reactInternals===void 0)throw Error(i(38));return $a(t,r,a,!1,f)},Jt.version="18.3.1-next-f1338f8080-20240426",Jt}var H0;function bk(){if(H0)return _c.exports;H0=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(),_c.exports=VR(),_c.exports}var V0;function WR(){if(V0)return za;V0=1;var e=bk();return za.createRoot=e.createRoot,za.hydrateRoot=e.hydrateRoot,za}var GR=WR(),O=Ro();const oe=Ng(O);function $t(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let i=0,s;i<e.length;i++)(s=$t(e[i]))!==""&&(n+=(n&&" ")+s);else for(let i in e)e[i]&&(n+=(n&&" ")+i);return n}var kc={exports:{}},Ec={},Nc={exports:{}},Cc={};/**
|
|
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 W0;function YR(){if(W0)return Cc;W0=1;var e=Ro();function n(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var i=typeof Object.is=="function"?Object.is:n,s=e.useState,o=e.useEffect,u=e.useLayoutEffect,l=e.useDebugValue;function c(m,v){var x=v(),C=s({inst:{value:x,getSnapshot:v}}),_=C[0].inst,S=C[1];return u(function(){_.value=x,_.getSnapshot=v,d(_)&&S({inst:_})},[m,x,v]),o(function(){return d(_)&&S({inst:_}),m(function(){d(_)&&S({inst:_})})},[m]),l(x),x}function d(m){var v=m.getSnapshot;m=m.value;try{var x=v();return!i(m,x)}catch{return!0}}function h(m,v){return v()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Cc.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Cc}var G0;function KR(){return G0||(G0=1,Nc.exports=YR()),Nc.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 Y0;function XR(){if(Y0)return Ec;Y0=1;var e=Ro(),n=KR();function i(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var s=typeof Object.is=="function"?Object.is:i,o=n.useSyncExternalStore,u=e.useRef,l=e.useEffect,c=e.useMemo,d=e.useDebugValue;return Ec.useSyncExternalStoreWithSelector=function(h,p,m,v,x){var C=u(null);if(C.current===null){var _={hasValue:!1,value:null};C.current=_}else _=C.current;C=c(function(){function b(I){if(!N){if(N=!0,E=I,I=v(I),x!==void 0&&_.hasValue){var P=_.value;if(x(P,I))return k=P}return k=I}if(P=k,s(E,I))return P;var D=v(I);return x!==void 0&&x(P,D)?(E=I,P):(E=I,k=D)}var N=!1,E,k,j=m===void 0?null:m;return[function(){return b(p())},j===null?void 0:function(){return b(j())}]},[p,m,v,x]);var S=o(h,C[0],C[1]);return l(function(){_.hasValue=!0,_.value=S},[S]),d(S),S},Ec}var K0;function QR(){return K0||(K0=1,kc.exports=XR()),kc.exports}var ZR=QR();const JR=Ng(ZR),eT={},X0=e=>{let n;const i=new Set,s=(p,m)=>{const v=typeof p=="function"?p(n):p;if(!Object.is(v,n)){const x=n;n=m??(typeof v!="object"||v===null)?v:Object.assign({},n,v),i.forEach(C=>C(n,x))}},o=()=>n,d={setState:s,getState:o,getInitialState:()=>h,subscribe:p=>(i.add(p),()=>i.delete(p)),destroy:()=>{(eT?"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."),i.clear()}},h=n=e(s,o,d);return d},tT=e=>e?X0(e):X0,{useDebugValue:nT}=oe,{useSyncExternalStoreWithSelector:rT}=JR,iT=e=>e;function kk(e,n=iT,i){const s=rT(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,i);return nT(s),s}const Q0=(e,n)=>{const i=tT(e),s=(o,u=n)=>kk(i,o,u);return Object.assign(s,i),s},sT=(e,n)=>e?Q0(e,n):Q0;function Et(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[s,o]of e)if(!Object.is(o,n.get(s)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const s of e)if(!n.has(s))return!1;return!0}const i=Object.keys(e);if(i.length!==Object.keys(n).length)return!1;for(const s of i)if(!Object.prototype.hasOwnProperty.call(n,s)||!Object.is(e[s],n[s]))return!1;return!0}var oT={value:()=>{}};function yu(){for(var e=0,n=arguments.length,i={},s;e<n;++e){if(!(s=arguments[e]+"")||s in i||/[\s.]/.test(s))throw new Error("illegal type: "+s);i[s]=[]}return new nu(i)}function nu(e){this._=e}function aT(e,n){return e.trim().split(/^|\s+/).map(function(i){var s="",o=i.indexOf(".");if(o>=0&&(s=i.slice(o+1),i=i.slice(0,o)),i&&!n.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:s}})}nu.prototype=yu.prototype={constructor:nu,on:function(e,n){var i=this._,s=aT(e+"",i),o,u=-1,l=s.length;if(arguments.length<2){for(;++u<l;)if((o=(e=s[u]).type)&&(o=uT(i[o],e.name)))return o;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++u<l;)if(o=(e=s[u]).type)i[o]=Z0(i[o],e.name,n);else if(n==null)for(o in i)i[o]=Z0(i[o],e.name,null);return this},copy:function(){var e={},n=this._;for(var i in n)e[i]=n[i].slice();return new nu(e)},call:function(e,n){if((o=arguments.length-2)>0)for(var i=new Array(o),s=0,o,u;s<o;++s)i[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(u=this._[e],s=0,o=u.length;s<o;++s)u[s].value.apply(n,i)},apply:function(e,n,i){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],o=0,u=s.length;o<u;++o)s[o].value.apply(n,i)}};function uT(e,n){for(var i=0,s=e.length,o;i<s;++i)if((o=e[i]).name===n)return o.value}function Z0(e,n,i){for(var s=0,o=e.length;s<o;++s)if(e[s].name===n){e[s]=oT,e=e.slice(0,s).concat(e.slice(s+1));break}return i!=null&&e.push({name:n,value:i}),e}var ig="http://www.w3.org/1999/xhtml";const J0={svg:"http://www.w3.org/2000/svg",xhtml:ig,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function wu(e){var n=e+="",i=n.indexOf(":");return i>=0&&(n=e.slice(0,i))!=="xmlns"&&(e=e.slice(i+1)),J0.hasOwnProperty(n)?{space:J0[n],local:e}:e}function lT(e){return function(){var n=this.ownerDocument,i=this.namespaceURI;return i===ig&&n.documentElement.namespaceURI===ig?n.createElement(e):n.createElementNS(i,e)}}function cT(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ek(e){var n=wu(e);return(n.local?cT:lT)(n)}function fT(){}function Cg(e){return e==null?fT:function(){return this.querySelector(e)}}function dT(e){typeof e!="function"&&(e=Cg(e));for(var n=this._groups,i=n.length,s=new Array(i),o=0;o<i;++o)for(var u=n[o],l=u.length,c=s[o]=new Array(l),d,h,p=0;p<l;++p)(d=u[p])&&(h=e.call(d,d.__data__,p,u))&&("__data__"in d&&(h.__data__=d.__data__),c[p]=h);return new fn(s,this._parents)}function hT(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function pT(){return[]}function Nk(e){return e==null?pT:function(){return this.querySelectorAll(e)}}function mT(e){return function(){return hT(e.apply(this,arguments))}}function gT(e){typeof e=="function"?e=mT(e):e=Nk(e);for(var n=this._groups,i=n.length,s=[],o=[],u=0;u<i;++u)for(var l=n[u],c=l.length,d,h=0;h<c;++h)(d=l[h])&&(s.push(e.call(d,d.__data__,h,l)),o.push(d));return new fn(s,o)}function Ck(e){return function(){return this.matches(e)}}function Rk(e){return function(n){return n.matches(e)}}var vT=Array.prototype.find;function yT(e){return function(){return vT.call(this.children,e)}}function wT(){return this.firstElementChild}function xT(e){return this.select(e==null?wT:yT(typeof e=="function"?e:Rk(e)))}var _T=Array.prototype.filter;function ST(){return Array.from(this.children)}function bT(e){return function(){return _T.call(this.children,e)}}function kT(e){return this.selectAll(e==null?ST:bT(typeof e=="function"?e:Rk(e)))}function ET(e){typeof e!="function"&&(e=Ck(e));for(var n=this._groups,i=n.length,s=new Array(i),o=0;o<i;++o)for(var u=n[o],l=u.length,c=s[o]=[],d,h=0;h<l;++h)(d=u[h])&&e.call(d,d.__data__,h,u)&&c.push(d);return new fn(s,this._parents)}function Tk(e){return new Array(e.length)}function NT(){return new fn(this._enter||this._groups.map(Tk),this._parents)}function ou(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}ou.prototype={constructor:ou,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 CT(e){return function(){return e}}function RT(e,n,i,s,o,u){for(var l=0,c,d=n.length,h=u.length;l<h;++l)(c=n[l])?(c.__data__=u[l],s[l]=c):i[l]=new ou(e,u[l]);for(;l<d;++l)(c=n[l])&&(o[l]=c)}function TT(e,n,i,s,o,u,l){var c,d,h=new Map,p=n.length,m=u.length,v=new Array(p),x;for(c=0;c<p;++c)(d=n[c])&&(v[c]=x=l.call(d,d.__data__,c,n)+"",h.has(x)?o[c]=d:h.set(x,d));for(c=0;c<m;++c)x=l.call(e,u[c],c,u)+"",(d=h.get(x))?(s[c]=d,d.__data__=u[c],h.delete(x)):i[c]=new ou(e,u[c]);for(c=0;c<p;++c)(d=n[c])&&h.get(v[c])===d&&(o[c]=d)}function jT(e){return e.__data__}function AT(e,n){if(!arguments.length)return Array.from(this,jT);var i=n?TT:RT,s=this._parents,o=this._groups;typeof e!="function"&&(e=CT(e));for(var u=o.length,l=new Array(u),c=new Array(u),d=new Array(u),h=0;h<u;++h){var p=s[h],m=o[h],v=m.length,x=IT(e.call(p,p&&p.__data__,h,s)),C=x.length,_=c[h]=new Array(C),S=l[h]=new Array(C),b=d[h]=new Array(v);i(p,m,_,S,b,x,n);for(var N=0,E=0,k,j;N<C;++N)if(k=_[N]){for(N>=E&&(E=N+1);!(j=S[E])&&++E<C;);k._next=j||null}}return l=new fn(l,s),l._enter=c,l._exit=d,l}function IT(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function MT(){return new fn(this._exit||this._groups.map(Tk),this._parents)}function PT(e,n,i){var s=this.enter(),o=this,u=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),n!=null&&(o=n(o),o&&(o=o.selection())),i==null?u.remove():i(u),s&&o?s.merge(o).order():o}function OT(e){for(var n=e.selection?e.selection():e,i=this._groups,s=n._groups,o=i.length,u=s.length,l=Math.min(o,u),c=new Array(o),d=0;d<l;++d)for(var h=i[d],p=s[d],m=h.length,v=c[d]=new Array(m),x,C=0;C<m;++C)(x=h[C]||p[C])&&(v[C]=x);for(;d<o;++d)c[d]=i[d];return new fn(c,this._parents)}function qT(){for(var e=this._groups,n=-1,i=e.length;++n<i;)for(var s=e[n],o=s.length-1,u=s[o],l;--o>=0;)(l=s[o])&&(u&&l.compareDocumentPosition(u)^4&&u.parentNode.insertBefore(l,u),u=l);return this}function LT(e){e||(e=$T);function n(m,v){return m&&v?e(m.__data__,v.__data__):!m-!v}for(var i=this._groups,s=i.length,o=new Array(s),u=0;u<s;++u){for(var l=i[u],c=l.length,d=o[u]=new Array(c),h,p=0;p<c;++p)(h=l[p])&&(d[p]=h);d.sort(n)}return new fn(o,this._parents).order()}function $T(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function DT(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function FT(){return Array.from(this)}function zT(){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var s=e[n],o=0,u=s.length;o<u;++o){var l=s[o];if(l)return l}return null}function BT(){let e=0;for(const n of this)++e;return e}function UT(){return!this.node()}function HT(e){for(var n=this._groups,i=0,s=n.length;i<s;++i)for(var o=n[i],u=0,l=o.length,c;u<l;++u)(c=o[u])&&e.call(c,c.__data__,u,o);return this}function VT(e){return function(){this.removeAttribute(e)}}function WT(e){return function(){this.removeAttributeNS(e.space,e.local)}}function GT(e,n){return function(){this.setAttribute(e,n)}}function YT(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function KT(e,n){return function(){var i=n.apply(this,arguments);i==null?this.removeAttribute(e):this.setAttribute(e,i)}}function XT(e,n){return function(){var i=n.apply(this,arguments);i==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,i)}}function QT(e,n){var i=wu(e);if(arguments.length<2){var s=this.node();return i.local?s.getAttributeNS(i.space,i.local):s.getAttribute(i)}return this.each((n==null?i.local?WT:VT:typeof n=="function"?i.local?XT:KT:i.local?YT:GT)(i,n))}function jk(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ZT(e){return function(){this.style.removeProperty(e)}}function JT(e,n,i){return function(){this.style.setProperty(e,n,i)}}function e2(e,n,i){return function(){var s=n.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,i)}}function t2(e,n,i){return arguments.length>1?this.each((n==null?ZT:typeof n=="function"?e2:JT)(e,n,i??"")):gs(this.node(),e)}function gs(e,n){return e.style.getPropertyValue(n)||jk(e).getComputedStyle(e,null).getPropertyValue(n)}function n2(e){return function(){delete this[e]}}function r2(e,n){return function(){this[e]=n}}function i2(e,n){return function(){var i=n.apply(this,arguments);i==null?delete this[e]:this[e]=i}}function s2(e,n){return arguments.length>1?this.each((n==null?n2:typeof n=="function"?i2:r2)(e,n)):this.node()[e]}function Ak(e){return e.trim().split(/^|\s+/)}function Rg(e){return e.classList||new Ik(e)}function Ik(e){this._node=e,this._names=Ak(e.getAttribute("class")||"")}Ik.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 Mk(e,n){for(var i=Rg(e),s=-1,o=n.length;++s<o;)i.add(n[s])}function Pk(e,n){for(var i=Rg(e),s=-1,o=n.length;++s<o;)i.remove(n[s])}function o2(e){return function(){Mk(this,e)}}function a2(e){return function(){Pk(this,e)}}function u2(e,n){return function(){(n.apply(this,arguments)?Mk:Pk)(this,e)}}function l2(e,n){var i=Ak(e+"");if(arguments.length<2){for(var s=Rg(this.node()),o=-1,u=i.length;++o<u;)if(!s.contains(i[o]))return!1;return!0}return this.each((typeof n=="function"?u2:n?o2:a2)(i,n))}function c2(){this.textContent=""}function f2(e){return function(){this.textContent=e}}function d2(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function h2(e){return arguments.length?this.each(e==null?c2:(typeof e=="function"?d2:f2)(e)):this.node().textContent}function p2(){this.innerHTML=""}function m2(e){return function(){this.innerHTML=e}}function g2(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function v2(e){return arguments.length?this.each(e==null?p2:(typeof e=="function"?g2:m2)(e)):this.node().innerHTML}function y2(){this.nextSibling&&this.parentNode.appendChild(this)}function w2(){return this.each(y2)}function x2(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function _2(){return this.each(x2)}function S2(e){var n=typeof e=="function"?e:Ek(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function b2(){return null}function k2(e,n){var i=typeof e=="function"?e:Ek(e),s=n==null?b2:typeof n=="function"?n:Cg(n);return this.select(function(){return this.insertBefore(i.apply(this,arguments),s.apply(this,arguments)||null)})}function E2(){var e=this.parentNode;e&&e.removeChild(this)}function N2(){return this.each(E2)}function C2(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function R2(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function T2(e){return this.select(e?R2:C2)}function j2(e){return arguments.length?this.property("__data__",e):this.node().__data__}function A2(e){return function(n){e.call(this,n,this.__data__)}}function I2(e){return e.trim().split(/^|\s+/).map(function(n){var i="",s=n.indexOf(".");return s>=0&&(i=n.slice(s+1),n=n.slice(0,s)),{type:n,name:i}})}function M2(e){return function(){var n=this.__on;if(n){for(var i=0,s=-1,o=n.length,u;i<o;++i)u=n[i],(!e.type||u.type===e.type)&&u.name===e.name?this.removeEventListener(u.type,u.listener,u.options):n[++s]=u;++s?n.length=s:delete this.__on}}}function P2(e,n,i){return function(){var s=this.__on,o,u=A2(n);if(s){for(var l=0,c=s.length;l<c;++l)if((o=s[l]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=u,o.options=i),o.value=n;return}}this.addEventListener(e.type,u,i),o={type:e.type,name:e.name,value:n,listener:u,options:i},s?s.push(o):this.__on=[o]}}function O2(e,n,i){var s=I2(e+""),o,u=s.length,l;if(arguments.length<2){var c=this.node().__on;if(c){for(var d=0,h=c.length,p;d<h;++d)for(o=0,p=c[d];o<u;++o)if((l=s[o]).type===p.type&&l.name===p.name)return p.value}return}for(c=n?P2:M2,o=0;o<u;++o)this.each(c(s[o],n,i));return this}function Ok(e,n,i){var s=jk(e),o=s.CustomEvent;typeof o=="function"?o=new o(n,i):(o=s.document.createEvent("Event"),i?(o.initEvent(n,i.bubbles,i.cancelable),o.detail=i.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function q2(e,n){return function(){return Ok(this,e,n)}}function L2(e,n){return function(){return Ok(this,e,n.apply(this,arguments))}}function $2(e,n){return this.each((typeof n=="function"?L2:q2)(e,n))}function*D2(){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var s=e[n],o=0,u=s.length,l;o<u;++o)(l=s[o])&&(yield l)}var qk=[null];function fn(e,n){this._groups=e,this._parents=n}function To(){return new fn([[document.documentElement]],qk)}function F2(){return this}fn.prototype=To.prototype={constructor:fn,select:dT,selectAll:gT,selectChild:xT,selectChildren:kT,filter:ET,data:AT,enter:NT,exit:MT,join:PT,merge:OT,selection:F2,order:qT,sort:LT,call:DT,nodes:FT,node:zT,size:BT,empty:UT,each:HT,attr:QT,style:t2,property:s2,classed:l2,text:h2,html:v2,raise:w2,lower:_2,append:S2,insert:k2,remove:N2,clone:T2,datum:j2,on:O2,dispatch:$2,[Symbol.iterator]:D2};function bn(e){return typeof e=="string"?new fn([[document.querySelector(e)]],[document.documentElement]):new fn([[e]],qk)}function z2(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Dn(e,n){if(e=z2(e),n===void 0&&(n=e.currentTarget),n){var i=n.ownerSVGElement||n;if(i.createSVGPoint){var s=i.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(n.getScreenCTM().inverse()),[s.x,s.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 B2={passive:!1},xo={capture:!0,passive:!1};function Rc(e){e.stopImmediatePropagation()}function ds(e){e.preventDefault(),e.stopImmediatePropagation()}function Lk(e){var n=e.document.documentElement,i=bn(e).on("dragstart.drag",ds,xo);"onselectstart"in n?i.on("selectstart.drag",ds,xo):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function $k(e,n){var i=e.document.documentElement,s=bn(e).on("dragstart.drag",null);n&&(s.on("click.drag",ds,xo),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in i?s.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}const Ba=e=>()=>e;function sg(e,{sourceEvent:n,subject:i,target:s,identifier:o,active:u,x:l,y:c,dx:d,dy:h,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:u,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:p}})}sg.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function U2(e){return!e.ctrlKey&&!e.button}function H2(){return this.parentNode}function V2(e,n){return n??{x:e.x,y:e.y}}function W2(){return navigator.maxTouchPoints||"ontouchstart"in this}function G2(){var e=U2,n=H2,i=V2,s=W2,o={},u=yu("start","drag","end"),l=0,c,d,h,p,m=0;function v(k){k.on("mousedown.drag",x).filter(s).on("touchstart.drag",S).on("touchmove.drag",b,B2).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(k,j){if(!(p||!e.call(this,k,j))){var I=E(this,n.call(this,k,j),k,j,"mouse");I&&(bn(k.view).on("mousemove.drag",C,xo).on("mouseup.drag",_,xo),Lk(k.view),Rc(k),h=!1,c=k.clientX,d=k.clientY,I("start",k))}}function C(k){if(ds(k),!h){var j=k.clientX-c,I=k.clientY-d;h=j*j+I*I>m}o.mouse("drag",k)}function _(k){bn(k.view).on("mousemove.drag mouseup.drag",null),$k(k.view,h),ds(k),o.mouse("end",k)}function S(k,j){if(e.call(this,k,j)){var I=k.changedTouches,P=n.call(this,k,j),D=I.length,A,F;for(A=0;A<D;++A)(F=E(this,P,k,j,I[A].identifier,I[A]))&&(Rc(k),F("start",k,I[A]))}}function b(k){var j=k.changedTouches,I=j.length,P,D;for(P=0;P<I;++P)(D=o[j[P].identifier])&&(ds(k),D("drag",k,j[P]))}function N(k){var j=k.changedTouches,I=j.length,P,D;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),P=0;P<I;++P)(D=o[j[P].identifier])&&(Rc(k),D("end",k,j[P]))}function E(k,j,I,P,D,A){var F=u.copy(),q=Dn(A||I,j),Q,K,T;if((T=i.call(k,new sg("beforestart",{sourceEvent:I,target:v,identifier:D,active:l,x:q[0],y:q[1],dx:0,dy:0,dispatch:F}),P))!=null)return Q=T.x-q[0]||0,K=T.y-q[1]||0,function Y(H,re,X){var $=q,G;switch(H){case"start":o[D]=Y,G=l++;break;case"end":delete o[D],--l;case"drag":q=Dn(X||re,j),G=l;break}F.call(H,k,new sg(H,{sourceEvent:re,subject:T,target:v,identifier:D,active:G,x:q[0]+Q,y:q[1]+K,dx:q[0]-$[0],dy:q[1]-$[1],dispatch:F}),P)}}return v.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Ba(!!k),v):e},v.container=function(k){return arguments.length?(n=typeof k=="function"?k:Ba(k),v):n},v.subject=function(k){return arguments.length?(i=typeof k=="function"?k:Ba(k),v):i},v.touchable=function(k){return arguments.length?(s=typeof k=="function"?k:Ba(!!k),v):s},v.on=function(){var k=u.on.apply(u,arguments);return k===u?v:k},v.clickDistance=function(k){return arguments.length?(m=(k=+k)*k,v):Math.sqrt(m)},v}function Tg(e,n,i){e.prototype=n.prototype=i,i.constructor=e}function Dk(e,n){var i=Object.create(e.prototype);for(var s in n)i[s]=n[s];return i}function jo(){}var _o=.7,au=1/_o,hs="\\s*([+-]?\\d+)\\s*",So="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Xn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Y2=/^#([0-9a-f]{3,8})$/,K2=new RegExp(`^rgb\\(${hs},${hs},${hs}\\)$`),X2=new RegExp(`^rgb\\(${Xn},${Xn},${Xn}\\)$`),Q2=new RegExp(`^rgba\\(${hs},${hs},${hs},${So}\\)$`),Z2=new RegExp(`^rgba\\(${Xn},${Xn},${Xn},${So}\\)$`),J2=new RegExp(`^hsl\\(${So},${Xn},${Xn}\\)$`),ej=new RegExp(`^hsla\\(${So},${Xn},${Xn},${So}\\)$`),ew={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};Tg(jo,bo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:tw,formatHex:tw,formatHex8:tj,formatHsl:nj,formatRgb:nw,toString:nw});function tw(){return this.rgb().formatHex()}function tj(){return this.rgb().formatHex8()}function nj(){return Fk(this).formatHsl()}function nw(){return this.rgb().formatRgb()}function bo(e){var n,i;return e=(e+"").trim().toLowerCase(),(n=Y2.exec(e))?(i=n[1].length,n=parseInt(n[1],16),i===6?rw(n):i===3?new en(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):i===8?Ua(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):i===4?Ua(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=K2.exec(e))?new en(n[1],n[2],n[3],1):(n=X2.exec(e))?new en(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=Q2.exec(e))?Ua(n[1],n[2],n[3],n[4]):(n=Z2.exec(e))?Ua(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=J2.exec(e))?ow(n[1],n[2]/100,n[3]/100,1):(n=ej.exec(e))?ow(n[1],n[2]/100,n[3]/100,n[4]):ew.hasOwnProperty(e)?rw(ew[e]):e==="transparent"?new en(NaN,NaN,NaN,0):null}function rw(e){return new en(e>>16&255,e>>8&255,e&255,1)}function Ua(e,n,i,s){return s<=0&&(e=n=i=NaN),new en(e,n,i,s)}function rj(e){return e instanceof jo||(e=bo(e)),e?(e=e.rgb(),new en(e.r,e.g,e.b,e.opacity)):new en}function og(e,n,i,s){return arguments.length===1?rj(e):new en(e,n,i,s??1)}function en(e,n,i,s){this.r=+e,this.g=+n,this.b=+i,this.opacity=+s}Tg(en,og,Dk(jo,{brighter(e){return e=e==null?au:Math.pow(au,e),new en(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?_o:Math.pow(_o,e),new en(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new en(bi(this.r),bi(this.g),bi(this.b),uu(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:iw,formatHex:iw,formatHex8:ij,formatRgb:sw,toString:sw}));function iw(){return`#${_i(this.r)}${_i(this.g)}${_i(this.b)}`}function ij(){return`#${_i(this.r)}${_i(this.g)}${_i(this.b)}${_i((isNaN(this.opacity)?1:this.opacity)*255)}`}function sw(){const e=uu(this.opacity);return`${e===1?"rgb(":"rgba("}${bi(this.r)}, ${bi(this.g)}, ${bi(this.b)}${e===1?")":`, ${e})`}`}function uu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function bi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _i(e){return e=bi(e),(e<16?"0":"")+e.toString(16)}function ow(e,n,i,s){return s<=0?e=n=i=NaN:i<=0||i>=1?e=n=NaN:n<=0&&(e=NaN),new Fn(e,n,i,s)}function Fk(e){if(e instanceof Fn)return new Fn(e.h,e.s,e.l,e.opacity);if(e instanceof jo||(e=bo(e)),!e)return new Fn;if(e instanceof Fn)return e;e=e.rgb();var n=e.r/255,i=e.g/255,s=e.b/255,o=Math.min(n,i,s),u=Math.max(n,i,s),l=NaN,c=u-o,d=(u+o)/2;return c?(n===u?l=(i-s)/c+(i<s)*6:i===u?l=(s-n)/c+2:l=(n-i)/c+4,c/=d<.5?u+o:2-u-o,l*=60):c=d>0&&d<1?0:l,new Fn(l,c,d,e.opacity)}function sj(e,n,i,s){return arguments.length===1?Fk(e):new Fn(e,n,i,s??1)}function Fn(e,n,i,s){this.h=+e,this.s=+n,this.l=+i,this.opacity=+s}Tg(Fn,sj,Dk(jo,{brighter(e){return e=e==null?au:Math.pow(au,e),new Fn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?_o:Math.pow(_o,e),new Fn(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,i=this.l,s=i+(i<.5?i:1-i)*n,o=2*i-s;return new en(Tc(e>=240?e-240:e+120,o,s),Tc(e,o,s),Tc(e<120?e+240:e-120,o,s),this.opacity)},clamp(){return new Fn(aw(this.h),Ha(this.s),Ha(this.l),uu(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=uu(this.opacity);return`${e===1?"hsl(":"hsla("}${aw(this.h)}, ${Ha(this.s)*100}%, ${Ha(this.l)*100}%${e===1?")":`, ${e})`}`}}));function aw(e){return e=(e||0)%360,e<0?e+360:e}function Ha(e){return Math.max(0,Math.min(1,e||0))}function Tc(e,n,i){return(e<60?n+(i-n)*e/60:e<180?i:e<240?n+(i-n)*(240-e)/60:n)*255}const zk=e=>()=>e;function oj(e,n){return function(i){return e+i*n}}function aj(e,n,i){return e=Math.pow(e,i),n=Math.pow(n,i)-e,i=1/i,function(s){return Math.pow(e+s*n,i)}}function uj(e){return(e=+e)==1?Bk:function(n,i){return i-n?aj(n,i,e):zk(isNaN(n)?i:n)}}function Bk(e,n){var i=n-e;return i?oj(e,i):zk(isNaN(e)?n:e)}const uw=(function e(n){var i=uj(n);function s(o,u){var l=i((o=og(o)).r,(u=og(u)).r),c=i(o.g,u.g),d=i(o.b,u.b),h=Bk(o.opacity,u.opacity);return function(p){return o.r=l(p),o.g=c(p),o.b=d(p),o.opacity=h(p),o+""}}return s.gamma=e,s})(1);function Hr(e,n){return e=+e,n=+n,function(i){return e*(1-i)+n*i}}var ag=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jc=new RegExp(ag.source,"g");function lj(e){return function(){return e}}function cj(e){return function(n){return e(n)+""}}function fj(e,n){var i=ag.lastIndex=jc.lastIndex=0,s,o,u,l=-1,c=[],d=[];for(e=e+"",n=n+"";(s=ag.exec(e))&&(o=jc.exec(n));)(u=o.index)>i&&(u=n.slice(i,u),c[l]?c[l]+=u:c[++l]=u),(s=s[0])===(o=o[0])?c[l]?c[l]+=o:c[++l]=o:(c[++l]=null,d.push({i:l,x:Hr(s,o)})),i=jc.lastIndex;return i<n.length&&(u=n.slice(i),c[l]?c[l]+=u:c[++l]=u),c.length<2?d[0]?cj(d[0].x):lj(n):(n=d.length,function(h){for(var p=0,m;p<n;++p)c[(m=d[p]).i]=m.x(h);return c.join("")})}var lw=180/Math.PI,ug={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Uk(e,n,i,s,o,u){var l,c,d;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(d=e*i+n*s)&&(i-=e*d,s-=n*d),(c=Math.sqrt(i*i+s*s))&&(i/=c,s/=c,d/=c),e*s<n*i&&(e=-e,n=-n,d=-d,l=-l),{translateX:o,translateY:u,rotate:Math.atan2(n,e)*lw,skewX:Math.atan(d)*lw,scaleX:l,scaleY:c}}var Va;function dj(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?ug:Uk(n.a,n.b,n.c,n.d,n.e,n.f)}function hj(e){return e==null||(Va||(Va=document.createElementNS("http://www.w3.org/2000/svg","g")),Va.setAttribute("transform",e),!(e=Va.transform.baseVal.consolidate()))?ug:(e=e.matrix,Uk(e.a,e.b,e.c,e.d,e.e,e.f))}function Hk(e,n,i,s){function o(h){return h.length?h.pop()+" ":""}function u(h,p,m,v,x,C){if(h!==m||p!==v){var _=x.push("translate(",null,n,null,i);C.push({i:_-4,x:Hr(h,m)},{i:_-2,x:Hr(p,v)})}else(m||v)&&x.push("translate("+m+n+v+i)}function l(h,p,m,v){h!==p?(h-p>180?p+=360:p-h>180&&(h+=360),v.push({i:m.push(o(m)+"rotate(",null,s)-2,x:Hr(h,p)})):p&&m.push(o(m)+"rotate("+p+s)}function c(h,p,m,v){h!==p?v.push({i:m.push(o(m)+"skewX(",null,s)-2,x:Hr(h,p)}):p&&m.push(o(m)+"skewX("+p+s)}function d(h,p,m,v,x,C){if(h!==m||p!==v){var _=x.push(o(x)+"scale(",null,",",null,")");C.push({i:_-4,x:Hr(h,m)},{i:_-2,x:Hr(p,v)})}else(m!==1||v!==1)&&x.push(o(x)+"scale("+m+","+v+")")}return function(h,p){var m=[],v=[];return h=e(h),p=e(p),u(h.translateX,h.translateY,p.translateX,p.translateY,m,v),l(h.rotate,p.rotate,m,v),c(h.skewX,p.skewX,m,v),d(h.scaleX,h.scaleY,p.scaleX,p.scaleY,m,v),h=p=null,function(x){for(var C=-1,_=v.length,S;++C<_;)m[(S=v[C]).i]=S.x(x);return m.join("")}}}var pj=Hk(dj,"px, ","px)","deg)"),mj=Hk(hj,", ",")",")"),gj=1e-12;function cw(e){return((e=Math.exp(e))+1/e)/2}function vj(e){return((e=Math.exp(e))-1/e)/2}function yj(e){return((e=Math.exp(2*e))-1)/(e+1)}const wj=(function e(n,i,s){function o(u,l){var c=u[0],d=u[1],h=u[2],p=l[0],m=l[1],v=l[2],x=p-c,C=m-d,_=x*x+C*C,S,b;if(_<gj)b=Math.log(v/h)/n,S=function(P){return[c+P*x,d+P*C,h*Math.exp(n*P*b)]};else{var N=Math.sqrt(_),E=(v*v-h*h+s*_)/(2*h*i*N),k=(v*v-h*h-s*_)/(2*v*i*N),j=Math.log(Math.sqrt(E*E+1)-E),I=Math.log(Math.sqrt(k*k+1)-k);b=(I-j)/n,S=function(P){var D=P*b,A=cw(j),F=h/(i*N)*(A*yj(n*D+j)-vj(j));return[c+F*x,d+F*C,h*A/cw(n*D+j)]}}return S.duration=b*1e3*n/Math.SQRT2,S}return o.rho=function(u){var l=Math.max(.001,+u),c=l*l,d=c*c;return e(l,c,d)},o})(Math.SQRT2,2,4);var vs=0,co=0,so=0,Vk=1e3,lu,fo,cu=0,Ei=0,xu=0,ko=typeof performance=="object"&&performance.now?performance:Date,Wk=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function jg(){return Ei||(Wk(xj),Ei=ko.now()+xu)}function xj(){Ei=0}function fu(){this._call=this._time=this._next=null}fu.prototype=Gk.prototype={constructor:fu,restart:function(e,n,i){if(typeof e!="function")throw new TypeError("callback is not a function");i=(i==null?jg():+i)+(n==null?0:+n),!this._next&&fo!==this&&(fo?fo._next=this:lu=this,fo=this),this._call=e,this._time=i,lg()},stop:function(){this._call&&(this._call=null,this._time=1/0,lg())}};function Gk(e,n,i){var s=new fu;return s.restart(e,n,i),s}function _j(){jg(),++vs;for(var e=lu,n;e;)(n=Ei-e._time)>=0&&e._call.call(void 0,n),e=e._next;--vs}function fw(){Ei=(cu=ko.now())+xu,vs=co=0;try{_j()}finally{vs=0,bj(),Ei=0}}function Sj(){var e=ko.now(),n=e-cu;n>Vk&&(xu-=n,cu=e)}function bj(){for(var e,n=lu,i,s=1/0;n;)n._call?(s>n._time&&(s=n._time),e=n,n=n._next):(i=n._next,n._next=null,n=e?e._next=i:lu=i);fo=e,lg(s)}function lg(e){if(!vs){co&&(co=clearTimeout(co));var n=e-Ei;n>24?(e<1/0&&(co=setTimeout(fw,e-ko.now()-xu)),so&&(so=clearInterval(so))):(so||(cu=ko.now(),so=setInterval(Sj,Vk)),vs=1,Wk(fw))}}function dw(e,n,i){var s=new fu;return n=n==null?0:+n,s.restart(o=>{s.stop(),e(o+n)},n,i),s}var kj=yu("start","end","cancel","interrupt"),Ej=[],Yk=0,hw=1,cg=2,ru=3,pw=4,fg=5,iu=6;function _u(e,n,i,s,o,u){var l=e.__transition;if(!l)e.__transition={};else if(i in l)return;Nj(e,i,{name:n,index:s,group:o,on:kj,tween:Ej,time:u.time,delay:u.delay,duration:u.duration,ease:u.ease,timer:null,state:Yk})}function Ag(e,n){var i=Un(e,n);if(i.state>Yk)throw new Error("too late; already scheduled");return i}function Qn(e,n){var i=Un(e,n);if(i.state>ru)throw new Error("too late; already running");return i}function Un(e,n){var i=e.__transition;if(!i||!(i=i[n]))throw new Error("transition not found");return i}function Nj(e,n,i){var s=e.__transition,o;s[n]=i,i.timer=Gk(u,0,i.time);function u(h){i.state=hw,i.timer.restart(l,i.delay,i.time),i.delay<=h&&l(h-i.delay)}function l(h){var p,m,v,x;if(i.state!==hw)return d();for(p in s)if(x=s[p],x.name===i.name){if(x.state===ru)return dw(l);x.state===pw?(x.state=iu,x.timer.stop(),x.on.call("interrupt",e,e.__data__,x.index,x.group),delete s[p]):+p<n&&(x.state=iu,x.timer.stop(),x.on.call("cancel",e,e.__data__,x.index,x.group),delete s[p])}if(dw(function(){i.state===ru&&(i.state=pw,i.timer.restart(c,i.delay,i.time),c(h))}),i.state=cg,i.on.call("start",e,e.__data__,i.index,i.group),i.state===cg){for(i.state=ru,o=new Array(v=i.tween.length),p=0,m=-1;p<v;++p)(x=i.tween[p].value.call(e,e.__data__,i.index,i.group))&&(o[++m]=x);o.length=m+1}}function c(h){for(var p=h<i.duration?i.ease.call(null,h/i.duration):(i.timer.restart(d),i.state=fg,1),m=-1,v=o.length;++m<v;)o[m].call(e,p);i.state===fg&&(i.on.call("end",e,e.__data__,i.index,i.group),d())}function d(){i.state=iu,i.timer.stop(),delete s[n];for(var h in s)return;delete e.__transition}}function su(e,n){var i=e.__transition,s,o,u=!0,l;if(i){n=n==null?null:n+"";for(l in i){if((s=i[l]).name!==n){u=!1;continue}o=s.state>cg&&s.state<fg,s.state=iu,s.timer.stop(),s.on.call(o?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete i[l]}u&&delete e.__transition}}function Cj(e){return this.each(function(){su(this,e)})}function Rj(e,n){var i,s;return function(){var o=Qn(this,e),u=o.tween;if(u!==i){s=i=u;for(var l=0,c=s.length;l<c;++l)if(s[l].name===n){s=s.slice(),s.splice(l,1);break}}o.tween=s}}function Tj(e,n,i){var s,o;if(typeof i!="function")throw new Error;return function(){var u=Qn(this,e),l=u.tween;if(l!==s){o=(s=l).slice();for(var c={name:n,value:i},d=0,h=o.length;d<h;++d)if(o[d].name===n){o[d]=c;break}d===h&&o.push(c)}u.tween=o}}function jj(e,n){var i=this._id;if(e+="",arguments.length<2){for(var s=Un(this.node(),i).tween,o=0,u=s.length,l;o<u;++o)if((l=s[o]).name===e)return l.value;return null}return this.each((n==null?Rj:Tj)(i,e,n))}function Ig(e,n,i){var s=e._id;return e.each(function(){var o=Qn(this,s);(o.value||(o.value={}))[n]=i.apply(this,arguments)}),function(o){return Un(o,s).value[n]}}function Kk(e,n){var i;return(typeof n=="number"?Hr:n instanceof bo?uw:(i=bo(n))?(n=i,uw):fj)(e,n)}function Aj(e){return function(){this.removeAttribute(e)}}function Ij(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Mj(e,n,i){var s,o=i+"",u;return function(){var l=this.getAttribute(e);return l===o?null:l===s?u:u=n(s=l,i)}}function Pj(e,n,i){var s,o=i+"",u;return function(){var l=this.getAttributeNS(e.space,e.local);return l===o?null:l===s?u:u=n(s=l,i)}}function Oj(e,n,i){var s,o,u;return function(){var l,c=i(this),d;return c==null?void this.removeAttribute(e):(l=this.getAttribute(e),d=c+"",l===d?null:l===s&&d===o?u:(o=d,u=n(s=l,c)))}}function qj(e,n,i){var s,o,u;return function(){var l,c=i(this),d;return c==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),d=c+"",l===d?null:l===s&&d===o?u:(o=d,u=n(s=l,c)))}}function Lj(e,n){var i=wu(e),s=i==="transform"?mj:Kk;return this.attrTween(e,typeof n=="function"?(i.local?qj:Oj)(i,s,Ig(this,"attr."+e,n)):n==null?(i.local?Ij:Aj)(i):(i.local?Pj:Mj)(i,s,n))}function $j(e,n){return function(i){this.setAttribute(e,n.call(this,i))}}function Dj(e,n){return function(i){this.setAttributeNS(e.space,e.local,n.call(this,i))}}function Fj(e,n){var i,s;function o(){var u=n.apply(this,arguments);return u!==s&&(i=(s=u)&&Dj(e,u)),i}return o._value=n,o}function zj(e,n){var i,s;function o(){var u=n.apply(this,arguments);return u!==s&&(i=(s=u)&&$j(e,u)),i}return o._value=n,o}function Bj(e,n){var i="attr."+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;var s=wu(e);return this.tween(i,(s.local?Fj:zj)(s,n))}function Uj(e,n){return function(){Ag(this,e).delay=+n.apply(this,arguments)}}function Hj(e,n){return n=+n,function(){Ag(this,e).delay=n}}function Vj(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?Uj:Hj)(n,e)):Un(this.node(),n).delay}function Wj(e,n){return function(){Qn(this,e).duration=+n.apply(this,arguments)}}function Gj(e,n){return n=+n,function(){Qn(this,e).duration=n}}function Yj(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?Wj:Gj)(n,e)):Un(this.node(),n).duration}function Kj(e,n){if(typeof n!="function")throw new Error;return function(){Qn(this,e).ease=n}}function Xj(e){var n=this._id;return arguments.length?this.each(Kj(n,e)):Un(this.node(),n).ease}function Qj(e,n){return function(){var i=n.apply(this,arguments);if(typeof i!="function")throw new Error;Qn(this,e).ease=i}}function Zj(e){if(typeof e!="function")throw new Error;return this.each(Qj(this._id,e))}function Jj(e){typeof e!="function"&&(e=Ck(e));for(var n=this._groups,i=n.length,s=new Array(i),o=0;o<i;++o)for(var u=n[o],l=u.length,c=s[o]=[],d,h=0;h<l;++h)(d=u[h])&&e.call(d,d.__data__,h,u)&&c.push(d);return new gr(s,this._parents,this._name,this._id)}function eA(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,i=e._groups,s=n.length,o=i.length,u=Math.min(s,o),l=new Array(s),c=0;c<u;++c)for(var d=n[c],h=i[c],p=d.length,m=l[c]=new Array(p),v,x=0;x<p;++x)(v=d[x]||h[x])&&(m[x]=v);for(;c<s;++c)l[c]=n[c];return new gr(l,this._parents,this._name,this._id)}function tA(e){return(e+"").trim().split(/^|\s+/).every(function(n){var i=n.indexOf(".");return i>=0&&(n=n.slice(0,i)),!n||n==="start"})}function nA(e,n,i){var s,o,u=tA(n)?Ag:Qn;return function(){var l=u(this,e),c=l.on;c!==s&&(o=(s=c).copy()).on(n,i),l.on=o}}function rA(e,n){var i=this._id;return arguments.length<2?Un(this.node(),i).on.on(e):this.each(nA(i,e,n))}function iA(e){return function(){var n=this.parentNode;for(var i in this.__transition)if(+i!==e)return;n&&n.removeChild(this)}}function sA(){return this.on("end.remove",iA(this._id))}function oA(e){var n=this._name,i=this._id;typeof e!="function"&&(e=Cg(e));for(var s=this._groups,o=s.length,u=new Array(o),l=0;l<o;++l)for(var c=s[l],d=c.length,h=u[l]=new Array(d),p,m,v=0;v<d;++v)(p=c[v])&&(m=e.call(p,p.__data__,v,c))&&("__data__"in p&&(m.__data__=p.__data__),h[v]=m,_u(h[v],n,i,v,h,Un(p,i)));return new gr(u,this._parents,n,i)}function aA(e){var n=this._name,i=this._id;typeof e!="function"&&(e=Nk(e));for(var s=this._groups,o=s.length,u=[],l=[],c=0;c<o;++c)for(var d=s[c],h=d.length,p,m=0;m<h;++m)if(p=d[m]){for(var v=e.call(p,p.__data__,m,d),x,C=Un(p,i),_=0,S=v.length;_<S;++_)(x=v[_])&&_u(x,n,i,_,v,C);u.push(v),l.push(p)}return new gr(u,l,n,i)}var uA=To.prototype.constructor;function lA(){return new uA(this._groups,this._parents)}function cA(e,n){var i,s,o;return function(){var u=gs(this,e),l=(this.style.removeProperty(e),gs(this,e));return u===l?null:u===i&&l===s?o:o=n(i=u,s=l)}}function Xk(e){return function(){this.style.removeProperty(e)}}function fA(e,n,i){var s,o=i+"",u;return function(){var l=gs(this,e);return l===o?null:l===s?u:u=n(s=l,i)}}function dA(e,n,i){var s,o,u;return function(){var l=gs(this,e),c=i(this),d=c+"";return c==null&&(d=c=(this.style.removeProperty(e),gs(this,e))),l===d?null:l===s&&d===o?u:(o=d,u=n(s=l,c))}}function hA(e,n){var i,s,o,u="style."+n,l="end."+u,c;return function(){var d=Qn(this,e),h=d.on,p=d.value[u]==null?c||(c=Xk(n)):void 0;(h!==i||o!==p)&&(s=(i=h).copy()).on(l,o=p),d.on=s}}function pA(e,n,i){var s=(e+="")=="transform"?pj:Kk;return n==null?this.styleTween(e,cA(e,s)).on("end.style."+e,Xk(e)):typeof n=="function"?this.styleTween(e,dA(e,s,Ig(this,"style."+e,n))).each(hA(this._id,e)):this.styleTween(e,fA(e,s,n),i).on("end.style."+e,null)}function mA(e,n,i){return function(s){this.style.setProperty(e,n.call(this,s),i)}}function gA(e,n,i){var s,o;function u(){var l=n.apply(this,arguments);return l!==o&&(s=(o=l)&&mA(e,l,i)),s}return u._value=n,u}function vA(e,n,i){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(n==null)return this.tween(s,null);if(typeof n!="function")throw new Error;return this.tween(s,gA(e,n,i??""))}function yA(e){return function(){this.textContent=e}}function wA(e){return function(){var n=e(this);this.textContent=n??""}}function xA(e){return this.tween("text",typeof e=="function"?wA(Ig(this,"text",e)):yA(e==null?"":e+""))}function _A(e){return function(n){this.textContent=e.call(this,n)}}function SA(e){var n,i;function s(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&_A(o)),n}return s._value=e,s}function bA(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,SA(e))}function kA(){for(var e=this._name,n=this._id,i=Qk(),s=this._groups,o=s.length,u=0;u<o;++u)for(var l=s[u],c=l.length,d,h=0;h<c;++h)if(d=l[h]){var p=Un(d,n);_u(d,e,i,h,l,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new gr(s,this._parents,e,i)}function EA(){var e,n,i=this,s=i._id,o=i.size();return new Promise(function(u,l){var c={value:l},d={value:function(){--o===0&&u()}};i.each(function(){var h=Qn(this,s),p=h.on;p!==e&&(n=(e=p).copy(),n._.cancel.push(c),n._.interrupt.push(c),n._.end.push(d)),h.on=n}),o===0&&u()})}var NA=0;function gr(e,n,i,s){this._groups=e,this._parents=n,this._name=i,this._id=s}function Qk(){return++NA}var dr=To.prototype;gr.prototype={constructor:gr,select:oA,selectAll:aA,selectChild:dr.selectChild,selectChildren:dr.selectChildren,filter:Jj,merge:eA,selection:lA,transition:kA,call:dr.call,nodes:dr.nodes,node:dr.node,size:dr.size,empty:dr.empty,each:dr.each,on:rA,attr:Lj,attrTween:Bj,style:pA,styleTween:vA,text:xA,textTween:bA,remove:sA,tween:jj,delay:Vj,duration:Yj,ease:Xj,easeVarying:Zj,end:EA,[Symbol.iterator]:dr[Symbol.iterator]};function CA(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var RA={time:null,delay:0,duration:250,ease:CA};function TA(e,n){for(var i;!(i=e.__transition)||!(i=i[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return i}function jA(e){var n,i;e instanceof gr?(n=e._id,e=e._name):(n=Qk(),(i=RA).time=jg(),e=e==null?null:e+"");for(var s=this._groups,o=s.length,u=0;u<o;++u)for(var l=s[u],c=l.length,d,h=0;h<c;++h)(d=l[h])&&_u(d,e,n,h,l,i||TA(d,n));return new gr(s,this._parents,e,n)}To.prototype.interrupt=Cj;To.prototype.transition=jA;const Wa=e=>()=>e;function AA(e,{sourceEvent:n,target:i,transform:s,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:o}})}function pr(e,n,i){this.k=e,this.x=n,this.y=i}pr.prototype={constructor:pr,scale:function(e){return e===1?this:new pr(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new pr(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 mr=new pr(1,0,0);pr.prototype;function Ac(e){e.stopImmediatePropagation()}function oo(e){e.preventDefault(),e.stopImmediatePropagation()}function IA(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function MA(){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 mw(){return this.__zoom||mr}function PA(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function OA(){return navigator.maxTouchPoints||"ontouchstart"in this}function qA(e,n,i){var s=e.invertX(n[0][0])-i[0][0],o=e.invertX(n[1][0])-i[1][0],u=e.invertY(n[0][1])-i[0][1],l=e.invertY(n[1][1])-i[1][1];return e.translate(o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o),l>u?(u+l)/2:Math.min(0,u)||Math.max(0,l))}function Zk(){var e=IA,n=MA,i=qA,s=PA,o=OA,u=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],c=250,d=wj,h=yu("start","zoom","end"),p,m,v,x=500,C=150,_=0,S=10;function b(T){T.property("__zoom",mw).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",F).filter(o).on("touchstart.zoom",q).on("touchmove.zoom",Q).on("touchend.zoom touchcancel.zoom",K).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(T,Y,H,re){var X=T.selection?T.selection():T;X.property("__zoom",mw),T!==X?j(T,Y,H,re):X.interrupt().each(function(){I(this,arguments).event(re).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},b.scaleBy=function(T,Y,H,re){b.scaleTo(T,function(){var X=this.__zoom.k,$=typeof Y=="function"?Y.apply(this,arguments):Y;return X*$},H,re)},b.scaleTo=function(T,Y,H,re){b.transform(T,function(){var X=n.apply(this,arguments),$=this.__zoom,G=H==null?k(X):typeof H=="function"?H.apply(this,arguments):H,M=$.invert(G),B=typeof Y=="function"?Y.apply(this,arguments):Y;return i(E(N($,B),G,M),X,l)},H,re)},b.translateBy=function(T,Y,H,re){b.transform(T,function(){return i(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof H=="function"?H.apply(this,arguments):H),n.apply(this,arguments),l)},null,re)},b.translateTo=function(T,Y,H,re,X){b.transform(T,function(){var $=n.apply(this,arguments),G=this.__zoom,M=re==null?k($):typeof re=="function"?re.apply(this,arguments):re;return i(mr.translate(M[0],M[1]).scale(G.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof H=="function"?-H.apply(this,arguments):-H),$,l)},re,X)};function N(T,Y){return Y=Math.max(u[0],Math.min(u[1],Y)),Y===T.k?T:new pr(Y,T.x,T.y)}function E(T,Y,H){var re=Y[0]-H[0]*T.k,X=Y[1]-H[1]*T.k;return re===T.x&&X===T.y?T:new pr(T.k,re,X)}function k(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function j(T,Y,H,re){T.on("start.zoom",function(){I(this,arguments).event(re).start()}).on("interrupt.zoom end.zoom",function(){I(this,arguments).event(re).end()}).tween("zoom",function(){var X=this,$=arguments,G=I(X,$).event(re),M=n.apply(X,$),B=H==null?k(M):typeof H=="function"?H.apply(X,$):H,ae=Math.max(M[1][0]-M[0][0],M[1][1]-M[0][1]),z=X.__zoom,W=typeof Y=="function"?Y.apply(X,$):Y,ee=d(z.invert(B).concat(ae/z.k),W.invert(B).concat(ae/W.k));return function(se){if(se===1)se=W;else{var ce=ee(se),pe=ae/ce[2];se=new pr(pe,B[0]-ce[0]*pe,B[1]-ce[1]*pe)}G.zoom(null,se)}})}function I(T,Y,H){return!H&&T.__zooming||new P(T,Y)}function P(T,Y){this.that=T,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=n.apply(T,Y),this.taps=0}P.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,Y){return this.mouse&&T!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var Y=bn(this.that).datum();h.call(T,this.that,new AA(T,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:h}),Y)}};function D(T,...Y){if(!e.apply(this,arguments))return;var H=I(this,Y).event(T),re=this.__zoom,X=Math.max(u[0],Math.min(u[1],re.k*Math.pow(2,s.apply(this,arguments)))),$=Dn(T);if(H.wheel)(H.mouse[0][0]!==$[0]||H.mouse[0][1]!==$[1])&&(H.mouse[1]=re.invert(H.mouse[0]=$)),clearTimeout(H.wheel);else{if(re.k===X)return;H.mouse=[$,re.invert($)],su(this),H.start()}oo(T),H.wheel=setTimeout(G,C),H.zoom("mouse",i(E(N(re,X),H.mouse[0],H.mouse[1]),H.extent,l));function G(){H.wheel=null,H.end()}}function A(T,...Y){if(v||!e.apply(this,arguments))return;var H=T.currentTarget,re=I(this,Y,!0).event(T),X=bn(T.view).on("mousemove.zoom",B,!0).on("mouseup.zoom",ae,!0),$=Dn(T,H),G=T.clientX,M=T.clientY;Lk(T.view),Ac(T),re.mouse=[$,this.__zoom.invert($)],su(this),re.start();function B(z){if(oo(z),!re.moved){var W=z.clientX-G,ee=z.clientY-M;re.moved=W*W+ee*ee>_}re.event(z).zoom("mouse",i(E(re.that.__zoom,re.mouse[0]=Dn(z,H),re.mouse[1]),re.extent,l))}function ae(z){X.on("mousemove.zoom mouseup.zoom",null),$k(z.view,re.moved),oo(z),re.event(z).end()}}function F(T,...Y){if(e.apply(this,arguments)){var H=this.__zoom,re=Dn(T.changedTouches?T.changedTouches[0]:T,this),X=H.invert(re),$=H.k*(T.shiftKey?.5:2),G=i(E(N(H,$),re,X),n.apply(this,Y),l);oo(T),c>0?bn(this).transition().duration(c).call(j,G,re,T):bn(this).call(b.transform,G,re,T)}}function q(T,...Y){if(e.apply(this,arguments)){var H=T.touches,re=H.length,X=I(this,Y,T.changedTouches.length===re).event(T),$,G,M,B;for(Ac(T),G=0;G<re;++G)M=H[G],B=Dn(M,this),B=[B,this.__zoom.invert(B),M.identifier],X.touch0?!X.touch1&&X.touch0[2]!==B[2]&&(X.touch1=B,X.taps=0):(X.touch0=B,$=!0,X.taps=1+!!p);p&&(p=clearTimeout(p)),$&&(X.taps<2&&(m=B[0],p=setTimeout(function(){p=null},x)),su(this),X.start())}}function Q(T,...Y){if(this.__zooming){var H=I(this,Y).event(T),re=T.changedTouches,X=re.length,$,G,M,B;for(oo(T),$=0;$<X;++$)G=re[$],M=Dn(G,this),H.touch0&&H.touch0[2]===G.identifier?H.touch0[0]=M:H.touch1&&H.touch1[2]===G.identifier&&(H.touch1[0]=M);if(G=H.that.__zoom,H.touch1){var ae=H.touch0[0],z=H.touch0[1],W=H.touch1[0],ee=H.touch1[1],se=(se=W[0]-ae[0])*se+(se=W[1]-ae[1])*se,ce=(ce=ee[0]-z[0])*ce+(ce=ee[1]-z[1])*ce;G=N(G,Math.sqrt(se/ce)),M=[(ae[0]+W[0])/2,(ae[1]+W[1])/2],B=[(z[0]+ee[0])/2,(z[1]+ee[1])/2]}else if(H.touch0)M=H.touch0[0],B=H.touch0[1];else return;H.zoom("touch",i(E(G,M,B),H.extent,l))}}function K(T,...Y){if(this.__zooming){var H=I(this,Y).event(T),re=T.changedTouches,X=re.length,$,G;for(Ac(T),v&&clearTimeout(v),v=setTimeout(function(){v=null},x),$=0;$<X;++$)G=re[$],H.touch0&&H.touch0[2]===G.identifier?delete H.touch0:H.touch1&&H.touch1[2]===G.identifier&&delete H.touch1;if(H.touch1&&!H.touch0&&(H.touch0=H.touch1,delete H.touch1),H.touch0)H.touch0[1]=this.__zoom.invert(H.touch0[0]);else if(H.end(),H.taps===2&&(G=Dn(G,this),Math.hypot(m[0]-G[0],m[1]-G[1])<S)){var M=bn(this).on("dblclick.zoom");M&&M.apply(this,arguments)}}}return b.wheelDelta=function(T){return arguments.length?(s=typeof T=="function"?T:Wa(+T),b):s},b.filter=function(T){return arguments.length?(e=typeof T=="function"?T:Wa(!!T),b):e},b.touchable=function(T){return arguments.length?(o=typeof T=="function"?T:Wa(!!T),b):o},b.extent=function(T){return arguments.length?(n=typeof T=="function"?T:Wa([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),b):n},b.scaleExtent=function(T){return arguments.length?(u[0]=+T[0],u[1]=+T[1],b):[u[0],u[1]]},b.translateExtent=function(T){return arguments.length?(l[0][0]=+T[0][0],l[1][0]=+T[1][0],l[0][1]=+T[0][1],l[1][1]=+T[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(T){return arguments.length?(i=T,b):i},b.duration=function(T){return arguments.length?(c=+T,b):c},b.interpolate=function(T){return arguments.length?(d=T,b):d},b.on=function(){var T=h.on.apply(h,arguments);return T===h?b:T},b.clickDistance=function(T){return arguments.length?(_=(T=+T)*T,b):Math.sqrt(_)},b.tapDistance=function(T){return arguments.length?(S=+T,b):S},b}bk();const Su=O.createContext(null),LA=Su.Provider,vr={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.`},Jk=vr.error001();function Ue(e,n){const i=O.useContext(Su);if(i===null)throw new Error(Jk);return kk(i,e,n)}const Nt=()=>{const e=O.useContext(Su);if(e===null)throw new Error(Jk);return O.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},$A=e=>e.userSelectionActive?"none":"all";function Mg({position:e,children:n,className:i,style:s,...o}){const u=Ue($A),l=`${e}`.split("-");return oe.createElement("div",{className:$t(["react-flow__panel",i,...l]),style:{...s,pointerEvents:u},...o},n)}function DA({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:oe.createElement(Mg,{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"},oe.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const FA=({x:e,y:n,label:i,labelStyle:s={},labelShowBg:o=!0,labelBgStyle:u={},labelBgPadding:l=[2,4],labelBgBorderRadius:c=2,children:d,className:h,...p})=>{const m=O.useRef(null),[v,x]=O.useState({x:0,y:0,width:0,height:0}),C=$t(["react-flow__edge-textwrapper",h]);return O.useEffect(()=>{if(m.current){const _=m.current.getBBox();x({x:_.x,y:_.y,width:_.width,height:_.height})}},[i]),typeof i>"u"||!i?null:oe.createElement("g",{transform:`translate(${e-v.width/2} ${n-v.height/2})`,className:C,visibility:v.width?"visible":"hidden",...p},o&&oe.createElement("rect",{width:v.width+2*l[0],x:-l[0],y:-l[1],height:v.height+2*l[1],className:"react-flow__edge-textbg",style:u,rx:c,ry:c}),oe.createElement("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:m,style:s},i),d)};var zA=O.memo(FA);const Pg=e=>({width:e.offsetWidth,height:e.offsetHeight}),ys=(e,n=0,i=1)=>Math.min(Math.max(e,n),i),Og=(e={x:0,y:0},n)=>({x:ys(e.x,n[0][0],n[1][0]),y:ys(e.y,n[0][1],n[1][1])}),gw=(e,n,i)=>e<n?ys(Math.abs(e-n),1,50)/50:e>i?-ys(Math.abs(e-i),1,50)/50:0,eE=(e,n)=>{const i=gw(e.x,35,n.width-35)*20,s=gw(e.y,35,n.height-35)*20;return[i,s]},tE=e=>{var n;return((n=e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},nE=(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)}),Eo=({x:e,y:n,width:i,height:s})=>({x:e,y:n,x2:e+i,y2:n+s}),rE=({x:e,y:n,x2:i,y2:s})=>({x:e,y:n,width:i-e,height:s-n}),vw=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),BA=(e,n)=>rE(nE(Eo(e),Eo(n))),dg=(e,n)=>{const i=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),s=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(i*s)},UA=e=>kn(e.width)&&kn(e.height)&&kn(e.x)&&kn(e.y),kn=e=>!isNaN(e)&&isFinite(e),dt=Symbol.for("internals"),iE=["Enter"," ","Escape"],HA=(e,n)=>{},VA=e=>"nativeEvent"in e;function hg(e){var o,u;const n=VA(e)?e.nativeEvent:e,i=((u=(o=n.composedPath)==null?void 0:o.call(n))==null?void 0:u[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(i==null?void 0:i.nodeName)||(i==null?void 0:i.hasAttribute("contenteditable"))||!!(i!=null&&i.closest(".nokey"))}const sE=e=>"clientX"in e,Gr=(e,n)=>{var u,l;const i=sE(e),s=i?e.clientX:(u=e.touches)==null?void 0:u[0].clientX,o=i?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:s-((n==null?void 0:n.left)??0),y:o-((n==null?void 0:n.top)??0)}},du=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Ao=({id:e,path:n,labelX:i,labelY:s,label:o,labelStyle:u,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:m,markerStart:v,interactionWidth:x=20})=>oe.createElement(oe.Fragment,null,oe.createElement("path",{id:e,style:p,d:n,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:v}),x&&oe.createElement("path",{d:n,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),o&&kn(i)&&kn(s)?oe.createElement(zA,{x:i,y:s,label:o,labelStyle:u,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h}):null);Ao.displayName="BaseEdge";function ao(e,n,i){return i===void 0?i:s=>{const o=n().edges.find(u=>u.id===e);o&&i(s,{...o})}}function oE({sourceX:e,sourceY:n,targetX:i,targetY:s}){const o=Math.abs(i-e)/2,u=i<e?i+o:i-o,l=Math.abs(s-n)/2,c=s<n?s+l:s-l;return[u,c,o,l]}function aE({sourceX:e,sourceY:n,targetX:i,targetY:s,sourceControlX:o,sourceControlY:u,targetControlX:l,targetControlY:c}){const d=e*.125+o*.375+l*.375+i*.125,h=n*.125+u*.375+c*.375+s*.125,p=Math.abs(d-e),m=Math.abs(h-n);return[d,h,p,m]}var Ni;(function(e){e.Strict="strict",e.Loose="loose"})(Ni||(Ni={}));var Si;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Si||(Si={}));var No;(function(e){e.Partial="partial",e.Full="full"})(No||(No={}));var Wr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Wr||(Wr={}));var hu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(hu||(hu={}));var Ce;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ce||(Ce={}));function yw({pos:e,x1:n,y1:i,x2:s,y2:o}){return e===Ce.Left||e===Ce.Right?[.5*(n+s),i]:[n,.5*(i+o)]}function uE({sourceX:e,sourceY:n,sourcePosition:i=Ce.Bottom,targetX:s,targetY:o,targetPosition:u=Ce.Top}){const[l,c]=yw({pos:i,x1:e,y1:n,x2:s,y2:o}),[d,h]=yw({pos:u,x1:s,y1:o,x2:e,y2:n}),[p,m,v,x]=aE({sourceX:e,sourceY:n,targetX:s,targetY:o,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${e},${n} C${l},${c} ${d},${h} ${s},${o}`,p,m,v,x]}const qg=O.memo(({sourceX:e,sourceY:n,targetX:i,targetY:s,sourcePosition:o=Ce.Bottom,targetPosition:u=Ce.Top,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:x,markerStart:C,interactionWidth:_})=>{const[S,b,N]=uE({sourceX:e,sourceY:n,sourcePosition:o,targetX:i,targetY:s,targetPosition:u});return oe.createElement(Ao,{path:S,labelX:b,labelY:N,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:x,markerStart:C,interactionWidth:_})});qg.displayName="SimpleBezierEdge";const ww={[Ce.Left]:{x:-1,y:0},[Ce.Right]:{x:1,y:0},[Ce.Top]:{x:0,y:-1},[Ce.Bottom]:{x:0,y:1}},WA=({source:e,sourcePosition:n=Ce.Bottom,target:i})=>n===Ce.Left||n===Ce.Right?e.x<i.x?{x:1,y:0}:{x:-1,y:0}:e.y<i.y?{x:0,y:1}:{x:0,y:-1},xw=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function GA({source:e,sourcePosition:n=Ce.Bottom,target:i,targetPosition:s=Ce.Top,center:o,offset:u}){const l=ww[n],c=ww[s],d={x:e.x+l.x*u,y:e.y+l.y*u},h={x:i.x+c.x*u,y:i.y+c.y*u},p=WA({source:d,sourcePosition:n,target:h}),m=p.x!==0?"x":"y",v=p[m];let x=[],C,_;const S={x:0,y:0},b={x:0,y:0},[N,E,k,j]=oE({sourceX:e.x,sourceY:e.y,targetX:i.x,targetY:i.y});if(l[m]*c[m]===-1){C=o.x??N,_=o.y??E;const P=[{x:C,y:d.y},{x:C,y:h.y}],D=[{x:d.x,y:_},{x:h.x,y:_}];l[m]===v?x=m==="x"?P:D:x=m==="x"?D:P}else{const P=[{x:d.x,y:h.y}],D=[{x:h.x,y:d.y}];if(m==="x"?x=l.x===v?D:P:x=l.y===v?P:D,n===s){const K=Math.abs(e[m]-i[m]);if(K<=u){const T=Math.min(u-1,u-K);l[m]===v?S[m]=(d[m]>e[m]?-1:1)*T:b[m]=(h[m]>i[m]?-1:1)*T}}if(n!==s){const K=m==="x"?"y":"x",T=l[m]===c[K],Y=d[K]>h[K],H=d[K]<h[K];(l[m]===1&&(!T&&Y||T&&H)||l[m]!==1&&(!T&&H||T&&Y))&&(x=m==="x"?P:D)}const A={x:d.x+S.x,y:d.y+S.y},F={x:h.x+b.x,y:h.y+b.y},q=Math.max(Math.abs(A.x-x[0].x),Math.abs(F.x-x[0].x)),Q=Math.max(Math.abs(A.y-x[0].y),Math.abs(F.y-x[0].y));q>=Q?(C=(A.x+F.x)/2,_=x[0].y):(C=x[0].x,_=(A.y+F.y)/2)}return[[e,{x:d.x+S.x,y:d.y+S.y},...x,{x:h.x+b.x,y:h.y+b.y},i],C,_,k,j]}function YA(e,n,i,s){const o=Math.min(xw(e,n)/2,xw(n,i)/2,s),{x:u,y:l}=n;if(e.x===u&&u===i.x||e.y===l&&l===i.y)return`L${u} ${l}`;if(e.y===l){const h=e.x<i.x?-1:1,p=e.y<i.y?1:-1;return`L ${u+o*h},${l}Q ${u},${l} ${u},${l+o*p}`}const c=e.x<i.x?1:-1,d=e.y<i.y?-1:1;return`L ${u},${l+o*d}Q ${u},${l} ${u+o*c},${l}`}function pg({sourceX:e,sourceY:n,sourcePosition:i=Ce.Bottom,targetX:s,targetY:o,targetPosition:u=Ce.Top,borderRadius:l=5,centerX:c,centerY:d,offset:h=20}){const[p,m,v,x,C]=GA({source:{x:e,y:n},sourcePosition:i,target:{x:s,y:o},targetPosition:u,center:{x:c,y:d},offset:h});return[p.reduce((S,b,N)=>{let E="";return N>0&&N<p.length-1?E=YA(p[N-1],b,p[N+1],l):E=`${N===0?"M":"L"}${b.x} ${b.y}`,S+=E,S},""),m,v,x,C]}const bu=O.memo(({sourceX:e,sourceY:n,targetX:i,targetY:s,label:o,labelStyle:u,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:p,sourcePosition:m=Ce.Bottom,targetPosition:v=Ce.Top,markerEnd:x,markerStart:C,pathOptions:_,interactionWidth:S})=>{const[b,N,E]=pg({sourceX:e,sourceY:n,sourcePosition:m,targetX:i,targetY:s,targetPosition:v,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return oe.createElement(Ao,{path:b,labelX:N,labelY:E,label:o,labelStyle:u,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:x,markerStart:C,interactionWidth:S})});bu.displayName="SmoothStepEdge";const Lg=O.memo(e=>{var n;return oe.createElement(bu,{...e,pathOptions:O.useMemo(()=>{var i;return{borderRadius:0,offset:(i=e.pathOptions)==null?void 0:i.offset}},[(n=e.pathOptions)==null?void 0:n.offset])})});Lg.displayName="StepEdge";function KA({sourceX:e,sourceY:n,targetX:i,targetY:s}){const[o,u,l,c]=oE({sourceX:e,sourceY:n,targetX:i,targetY:s});return[`M ${e},${n}L ${i},${s}`,o,u,l,c]}const $g=O.memo(({sourceX:e,sourceY:n,targetX:i,targetY:s,label:o,labelStyle:u,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:m,markerStart:v,interactionWidth:x})=>{const[C,_,S]=KA({sourceX:e,sourceY:n,targetX:i,targetY:s});return oe.createElement(Ao,{path:C,labelX:_,labelY:S,label:o,labelStyle:u,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:m,markerStart:v,interactionWidth:x})});$g.displayName="StraightEdge";function Ga(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function _w({pos:e,x1:n,y1:i,x2:s,y2:o,c:u}){switch(e){case Ce.Left:return[n-Ga(n-s,u),i];case Ce.Right:return[n+Ga(s-n,u),i];case Ce.Top:return[n,i-Ga(i-o,u)];case Ce.Bottom:return[n,i+Ga(o-i,u)]}}function lE({sourceX:e,sourceY:n,sourcePosition:i=Ce.Bottom,targetX:s,targetY:o,targetPosition:u=Ce.Top,curvature:l=.25}){const[c,d]=_w({pos:i,x1:e,y1:n,x2:s,y2:o,c:l}),[h,p]=_w({pos:u,x1:s,y1:o,x2:e,y2:n,c:l}),[m,v,x,C]=aE({sourceX:e,sourceY:n,targetX:s,targetY:o,sourceControlX:c,sourceControlY:d,targetControlX:h,targetControlY:p});return[`M${e},${n} C${c},${d} ${h},${p} ${s},${o}`,m,v,x,C]}const pu=O.memo(({sourceX:e,sourceY:n,targetX:i,targetY:s,sourcePosition:o=Ce.Bottom,targetPosition:u=Ce.Top,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:x,markerStart:C,pathOptions:_,interactionWidth:S})=>{const[b,N,E]=lE({sourceX:e,sourceY:n,sourcePosition:o,targetX:i,targetY:s,targetPosition:u,curvature:_==null?void 0:_.curvature});return oe.createElement(Ao,{path:b,labelX:N,labelY:E,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:x,markerStart:C,interactionWidth:S})});pu.displayName="BezierEdge";const Dg=O.createContext(null),XA=Dg.Provider;Dg.Consumer;const QA=()=>O.useContext(Dg),ZA=e=>"id"in e&&"source"in e&&"target"in e,JA=({source:e,sourceHandle:n,target:i,targetHandle:s})=>`reactflow__edge-${e}${n||""}-${i}${s||""}`,mg=(e,n)=>typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,eI=(e,n)=>n.some(i=>i.source===e.source&&i.target===e.target&&(i.sourceHandle===e.sourceHandle||!i.sourceHandle&&!e.sourceHandle)&&(i.targetHandle===e.targetHandle||!i.targetHandle&&!e.targetHandle)),tI=(e,n)=>{if(!e.source||!e.target)return n;let i;return ZA(e)?i={...e}:i={...e,id:JA(e)},eI(i,n)?n:n.concat(i)},gg=({x:e,y:n},[i,s,o],u,[l,c])=>{const d={x:(e-i)/o,y:(n-s)/o};return u?{x:l*Math.round(d.x/l),y:c*Math.round(d.y/c)}:d},cE=({x:e,y:n},[i,s,o])=>({x:e*o+i,y:n*o+s}),ki=(e,n=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const i=(e.width??0)*n[0],s=(e.height??0)*n[1],o={x:e.position.x-i,y:e.position.y-s};return{...o,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-i,y:e.positionAbsolute.y-s}:o}},ku=(e,n=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const i=e.reduce((s,o)=>{const{x:u,y:l}=ki(o,n).positionAbsolute;return nE(s,Eo({x:u,y:l,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return rE(i)},fE=(e,n,[i,s,o]=[0,0,1],u=!1,l=!1,c=[0,0])=>{const d={x:(n.x-i)/o,y:(n.y-s)/o,width:n.width/o,height:n.height/o},h=[];return e.forEach(p=>{const{width:m,height:v,selectable:x=!0,hidden:C=!1}=p;if(l&&!x||C)return!1;const{positionAbsolute:_}=ki(p,c),S={x:_.x,y:_.y,width:m||0,height:v||0},b=dg(d,S),N=typeof m>"u"||typeof v>"u"||m===null||v===null,E=u&&b>0,k=(m||0)*(v||0);(N||E||b>=k||p.dragging)&&h.push(p)}),h},dE=(e,n)=>{const i=e.map(s=>s.id);return n.filter(s=>i.includes(s.source)||i.includes(s.target))},hE=(e,n,i,s,o,u=.1)=>{const l=n/(e.width*(1+u)),c=i/(e.height*(1+u)),d=Math.min(l,c),h=ys(d,s,o),p=e.x+e.width/2,m=e.y+e.height/2,v=n/2-p*h,x=i/2-m*h;return{x:v,y:x,zoom:h}},xi=(e,n=0)=>e.transition().duration(n);function Sw(e,n,i,s){return(n[i]||[]).reduce((o,u)=>{var l,c;return`${e.id}-${u.id}-${i}`!==s&&o.push({id:u.id||null,type:i,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+u.x+u.width/2,y:(((c=e.positionAbsolute)==null?void 0:c.y)??0)+u.y+u.height/2}),o},[])}function nI(e,n,i,s,o,u){const{x:l,y:c}=Gr(e),h=n.elementsFromPoint(l,c).find(C=>C.classList.contains("react-flow__handle"));if(h){const C=h.getAttribute("data-nodeid");if(C){const _=Fg(void 0,h),S=h.getAttribute("data-handleid"),b=u({nodeId:C,id:S,type:_});if(b){const N=o.find(E=>E.nodeId===C&&E.type===_&&E.id===S);return{handle:{id:S,type:_,nodeId:C,x:(N==null?void 0:N.x)||i.x,y:(N==null?void 0:N.y)||i.y},validHandleResult:b}}}}let p=[],m=1/0;if(o.forEach(C=>{const _=Math.sqrt((C.x-i.x)**2+(C.y-i.y)**2);if(_<=s){const S=u(C);_<=m&&(_<m?p=[{handle:C,validHandleResult:S}]:_===m&&p.push({handle:C,validHandleResult:S}),m=_)}}),!p.length)return{handle:null,validHandleResult:pE()};if(p.length===1)return p[0];const v=p.some(({validHandleResult:C})=>C.isValid),x=p.some(({handle:C})=>C.type==="target");return p.find(({handle:C,validHandleResult:_})=>x?C.type==="target":v?_.isValid:!0)||p[0]}const rI={source:null,target:null,sourceHandle:null,targetHandle:null},pE=()=>({handleDomNode:null,isValid:!1,connection:rI,endHandle:null});function mE(e,n,i,s,o,u,l){const c=o==="target",d=l.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),h={...pE(),handleDomNode:d};if(d){const p=Fg(void 0,d),m=d.getAttribute("data-nodeid"),v=d.getAttribute("data-handleid"),x=d.classList.contains("connectable"),C=d.classList.contains("connectableend"),_={source:c?m:i,sourceHandle:c?v:s,target:c?i:m,targetHandle:c?s:v};h.connection=_,x&&C&&(n===Ni.Strict?c&&p==="source"||!c&&p==="target":m!==i||v!==s)&&(h.endHandle={nodeId:m,handleId:v,type:p},h.isValid=u(_))}return h}function iI({nodes:e,nodeId:n,handleId:i,handleType:s}){return e.reduce((o,u)=>{if(u[dt]){const{handleBounds:l}=u[dt];let c=[],d=[];l&&(c=Sw(u,l,"source",`${n}-${i}-${s}`),d=Sw(u,l,"target",`${n}-${i}-${s}`)),o.push(...c,...d)}return o},[])}function Fg(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function Ic(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function sI(e,n){let i=null;return n?i="valid":e&&!n&&(i="invalid"),i}function gE({event:e,handleId:n,nodeId:i,onConnect:s,isTarget:o,getState:u,setState:l,isValidConnection:c,edgeUpdaterType:d,onReconnectEnd:h}){const p=tE(e.target),{connectionMode:m,domNode:v,autoPanOnConnect:x,connectionRadius:C,onConnectStart:_,panBy:S,getNodes:b,cancelConnection:N}=u();let E=0,k;const{x:j,y:I}=Gr(e),P=p==null?void 0:p.elementFromPoint(j,I),D=Fg(d,P),A=v==null?void 0:v.getBoundingClientRect();if(!A||!D)return;let F,q=Gr(e,A),Q=!1,K=null,T=!1,Y=null;const H=iI({nodes:b(),nodeId:i,handleId:n,handleType:D}),re=()=>{if(!x)return;const[G,M]=eE(q,A);S({x:G,y:M}),E=requestAnimationFrame(re)};l({connectionPosition:q,connectionStatus:null,connectionNodeId:i,connectionHandleId:n,connectionHandleType:D,connectionStartHandle:{nodeId:i,handleId:n,type:D},connectionEndHandle:null}),_==null||_(e,{nodeId:i,handleId:n,handleType:D});function X(G){const{transform:M}=u();q=Gr(G,A);const{handle:B,validHandleResult:ae}=nI(G,p,gg(q,M,!1,[1,1]),C,H,z=>mE(z,m,i,n,o?"target":"source",c,p));if(k=B,Q||(re(),Q=!0),Y=ae.handleDomNode,K=ae.connection,T=ae.isValid,l({connectionPosition:k&&T?cE({x:k.x,y:k.y},M):q,connectionStatus:sI(!!k,T),connectionEndHandle:ae.endHandle}),!k&&!T&&!Y)return Ic(F);K.source!==K.target&&Y&&(Ic(F),F=Y,Y.classList.add("connecting","react-flow__handle-connecting"),Y.classList.toggle("valid",T),Y.classList.toggle("react-flow__handle-valid",T))}function $(G){var M,B;(k||Y)&&K&&T&&(s==null||s(K)),(B=(M=u()).onConnectEnd)==null||B.call(M,G),d&&(h==null||h(G)),Ic(F),N(),cancelAnimationFrame(E),Q=!1,T=!1,K=null,Y=null,p.removeEventListener("mousemove",X),p.removeEventListener("mouseup",$),p.removeEventListener("touchmove",X),p.removeEventListener("touchend",$)}p.addEventListener("mousemove",X),p.addEventListener("mouseup",$),p.addEventListener("touchmove",X),p.addEventListener("touchend",$)}const bw=()=>!0,oI=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),aI=(e,n,i)=>s=>{const{connectionStartHandle:o,connectionEndHandle:u,connectionClickStartHandle:l}=s;return{connecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===n&&(o==null?void 0:o.type)===i||(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.handleId)===n&&(u==null?void 0:u.type)===i,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===n&&(l==null?void 0:l.type)===i}},vE=O.forwardRef(({type:e="source",position:n=Ce.Top,isValidConnection:i,isConnectable:s=!0,isConnectableStart:o=!0,isConnectableEnd:u=!0,id:l,onConnect:c,children:d,className:h,onMouseDown:p,onTouchStart:m,...v},x)=>{var A,F;const C=l||null,_=e==="target",S=Nt(),b=QA(),{connectOnClick:N,noPanClassName:E}=Ue(oI,Et),{connecting:k,clickConnecting:j}=Ue(aI(b,C,e),Et);b||(F=(A=S.getState()).onError)==null||F.call(A,"010",vr.error010());const I=q=>{const{defaultEdgeOptions:Q,onConnect:K,hasDefaultEdges:T}=S.getState(),Y={...Q,...q};if(T){const{edges:H,setEdges:re}=S.getState();re(tI(Y,H))}K==null||K(Y),c==null||c(Y)},P=q=>{if(!b)return;const Q=sE(q);o&&(Q&&q.button===0||!Q)&&gE({event:q,handleId:C,nodeId:b,onConnect:I,isTarget:_,getState:S.getState,setState:S.setState,isValidConnection:i||S.getState().isValidConnection||bw}),Q?p==null||p(q):m==null||m(q)},D=q=>{const{onClickConnectStart:Q,onClickConnectEnd:K,connectionClickStartHandle:T,connectionMode:Y,isValidConnection:H}=S.getState();if(!b||!T&&!o)return;if(!T){Q==null||Q(q,{nodeId:b,handleId:C,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:C}});return}const re=tE(q.target),X=i||H||bw,{connection:$,isValid:G}=mE({nodeId:b,id:C,type:e},Y,T.nodeId,T.handleId||null,T.type,X,re);G&&I($),K==null||K(q),S.setState({connectionClickStartHandle:null})};return oe.createElement("div",{"data-handleid":C,"data-nodeid":b,"data-handlepos":n,"data-id":`${b}-${C}-${e}`,className:$t(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",E,h,{source:!_,target:_,connectable:s,connectablestart:o,connectableend:u,connecting:j,connectionindicator:s&&(o&&!k||u&&k)}]),onMouseDown:P,onTouchStart:P,onClick:N?D:void 0,ref:x,...v},d)});vE.displayName="Handle";var ws=O.memo(vE);const yE=({data:e,isConnectable:n,targetPosition:i=Ce.Top,sourcePosition:s=Ce.Bottom})=>oe.createElement(oe.Fragment,null,oe.createElement(ws,{type:"target",position:i,isConnectable:n}),e==null?void 0:e.label,oe.createElement(ws,{type:"source",position:s,isConnectable:n}));yE.displayName="DefaultNode";var vg=O.memo(yE);const wE=({data:e,isConnectable:n,sourcePosition:i=Ce.Bottom})=>oe.createElement(oe.Fragment,null,e==null?void 0:e.label,oe.createElement(ws,{type:"source",position:i,isConnectable:n}));wE.displayName="InputNode";var xE=O.memo(wE);const _E=({data:e,isConnectable:n,targetPosition:i=Ce.Top})=>oe.createElement(oe.Fragment,null,oe.createElement(ws,{type:"target",position:i,isConnectable:n}),e==null?void 0:e.label);_E.displayName="OutputNode";var SE=O.memo(_E);const zg=()=>null;zg.displayName="GroupNode";const uI=e=>({selectedNodes:e.getNodes().filter(n=>n.selected),selectedEdges:e.edges.filter(n=>n.selected).map(n=>({...n}))}),Ya=e=>e.id;function lI(e,n){return Et(e.selectedNodes.map(Ya),n.selectedNodes.map(Ya))&&Et(e.selectedEdges.map(Ya),n.selectedEdges.map(Ya))}const bE=O.memo(({onSelectionChange:e})=>{const n=Nt(),{selectedNodes:i,selectedEdges:s}=Ue(uI,lI);return O.useEffect(()=>{const o={nodes:i,edges:s};e==null||e(o),n.getState().onSelectionChange.forEach(u=>u(o))},[i,s,e]),null});bE.displayName="SelectionListener";const cI=e=>!!e.onSelectionChange;function fI({onSelectionChange:e}){const n=Ue(cI);return e||n?oe.createElement(bE,{onSelectionChange:e}):null}const dI=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 ss(e,n){O.useEffect(()=>{typeof e<"u"&&n(e)},[e])}function qe(e,n,i){O.useEffect(()=>{typeof n<"u"&&i({[e]:n})},[n])}const hI=({nodes:e,edges:n,defaultNodes:i,defaultEdges:s,onConnect:o,onConnectStart:u,onConnectEnd:l,onClickConnectStart:c,onClickConnectEnd:d,nodesDraggable:h,nodesConnectable:p,nodesFocusable:m,edgesFocusable:v,edgesUpdatable:x,elevateNodesOnSelect:C,minZoom:_,maxZoom:S,nodeExtent:b,onNodesChange:N,onEdgesChange:E,elementsSelectable:k,connectionMode:j,snapGrid:I,snapToGrid:P,translateExtent:D,connectOnClick:A,defaultEdgeOptions:F,fitView:q,fitViewOptions:Q,onNodesDelete:K,onEdgesDelete:T,onNodeDrag:Y,onNodeDragStart:H,onNodeDragStop:re,onSelectionDrag:X,onSelectionDragStart:$,onSelectionDragStop:G,noPanClassName:M,nodeOrigin:B,rfId:ae,autoPanOnConnect:z,autoPanOnNodeDrag:W,onError:ee,connectionRadius:se,isValidConnection:ce,nodeDragThreshold:pe})=>{const{setNodes:me,setEdges:Pe,setDefaultNodesAndEdges:ze,setMinZoom:je,setMaxZoom:Me,setTranslateExtent:ke,setNodeExtent:De,reset:xe}=Ue(dI,Et),_e=Nt();return O.useEffect(()=>{const He=s==null?void 0:s.map(st=>({...st,...F}));return ze(i,He),()=>{xe()}},[]),qe("defaultEdgeOptions",F,_e.setState),qe("connectionMode",j,_e.setState),qe("onConnect",o,_e.setState),qe("onConnectStart",u,_e.setState),qe("onConnectEnd",l,_e.setState),qe("onClickConnectStart",c,_e.setState),qe("onClickConnectEnd",d,_e.setState),qe("nodesDraggable",h,_e.setState),qe("nodesConnectable",p,_e.setState),qe("nodesFocusable",m,_e.setState),qe("edgesFocusable",v,_e.setState),qe("edgesUpdatable",x,_e.setState),qe("elementsSelectable",k,_e.setState),qe("elevateNodesOnSelect",C,_e.setState),qe("snapToGrid",P,_e.setState),qe("snapGrid",I,_e.setState),qe("onNodesChange",N,_e.setState),qe("onEdgesChange",E,_e.setState),qe("connectOnClick",A,_e.setState),qe("fitViewOnInit",q,_e.setState),qe("fitViewOnInitOptions",Q,_e.setState),qe("onNodesDelete",K,_e.setState),qe("onEdgesDelete",T,_e.setState),qe("onNodeDrag",Y,_e.setState),qe("onNodeDragStart",H,_e.setState),qe("onNodeDragStop",re,_e.setState),qe("onSelectionDrag",X,_e.setState),qe("onSelectionDragStart",$,_e.setState),qe("onSelectionDragStop",G,_e.setState),qe("noPanClassName",M,_e.setState),qe("nodeOrigin",B,_e.setState),qe("rfId",ae,_e.setState),qe("autoPanOnConnect",z,_e.setState),qe("autoPanOnNodeDrag",W,_e.setState),qe("onError",ee,_e.setState),qe("connectionRadius",se,_e.setState),qe("isValidConnection",ce,_e.setState),qe("nodeDragThreshold",pe,_e.setState),ss(e,me),ss(n,Pe),ss(_,je),ss(S,Me),ss(D,ke),ss(b,De),null},kw={display:"none"},pI={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},kE="react-flow__node-desc",EE="react-flow__edge-desc",mI="react-flow__aria-live",gI=e=>e.ariaLiveMessage;function vI({rfId:e}){const n=Ue(gI);return oe.createElement("div",{id:`${mI}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:pI},n)}function yI({rfId:e,disableKeyboardA11y:n}){return oe.createElement(oe.Fragment,null,oe.createElement("div",{id:`${kE}-${e}`,style:kw},"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."," "),oe.createElement("div",{id:`${EE}-${e}`,style:kw},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!n&&oe.createElement(vI,{rfId:e}))}var Co=(e=null,n={actInsideInputWithModifier:!0})=>{const[i,s]=O.useState(!1),o=O.useRef(!1),u=O.useRef(new Set([])),[l,c]=O.useMemo(()=>{if(e!==null){const h=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),p=h.reduce((m,v)=>m.concat(...v),[]);return[h,p]}return[[],[]]},[e]);return O.useEffect(()=>{const d=typeof document<"u"?document:null,h=(n==null?void 0:n.target)||d;if(e!==null){const p=x=>{if(o.current=x.ctrlKey||x.metaKey||x.shiftKey,(!o.current||o.current&&!n.actInsideInputWithModifier)&&hg(x))return!1;const _=Nw(x.code,c);u.current.add(x[_]),Ew(l,u.current,!1)&&(x.preventDefault(),s(!0))},m=x=>{if((!o.current||o.current&&!n.actInsideInputWithModifier)&&hg(x))return!1;const _=Nw(x.code,c);Ew(l,u.current,!0)?(s(!1),u.current.clear()):u.current.delete(x[_]),x.key==="Meta"&&u.current.clear(),o.current=!1},v=()=>{u.current.clear(),s(!1)};return h==null||h.addEventListener("keydown",p),h==null||h.addEventListener("keyup",m),window.addEventListener("blur",v),()=>{h==null||h.removeEventListener("keydown",p),h==null||h.removeEventListener("keyup",m),window.removeEventListener("blur",v)}}},[e,s]),i};function Ew(e,n,i){return e.filter(s=>i||s.length===n.size).some(s=>s.every(o=>n.has(o)))}function Nw(e,n){return n.includes(e)?"code":"key"}function NE(e,n,i,s){var c,d;const o=e.parentNode||e.parentId;if(!o)return i;const u=n.get(o),l=ki(u,s);return NE(u,n,{x:(i.x??0)+l.x,y:(i.y??0)+l.y,z:(((c=u[dt])==null?void 0:c.z)??0)>(i.z??0)?((d=u[dt])==null?void 0:d.z)??0:i.z??0},s)}function CE(e,n,i){e.forEach(s=>{var u;const o=s.parentNode||s.parentId;if(o&&!e.has(o))throw new Error(`Parent node ${o} not found`);if(o||i!=null&&i[s.id]){const{x:l,y:c,z:d}=NE(s,e,{...s.position,z:((u=s[dt])==null?void 0:u.z)??0},n);s.positionAbsolute={x:l,y:c},s[dt].z=d,i!=null&&i[s.id]&&(s[dt].isParent=!0)}})}function Mc(e,n,i,s){const o=new Map,u={},l=s?1e3:0;return e.forEach(c=>{var x;const d=(kn(c.zIndex)?c.zIndex:0)+(c.selected?l:0),h=n.get(c.id),p={...c,positionAbsolute:{x:c.position.x,y:c.position.y}},m=c.parentNode||c.parentId;m&&(u[m]=!0);const v=(h==null?void 0:h.type)&&(h==null?void 0:h.type)!==c.type;Object.defineProperty(p,dt,{enumerable:!1,value:{handleBounds:v||(x=h==null?void 0:h[dt])==null?void 0:x.handleBounds,z:d}}),o.set(c.id,p)}),CE(o,i,u),o}function RE(e,n={}){const{getNodes:i,width:s,height:o,minZoom:u,maxZoom:l,d3Zoom:c,d3Selection:d,fitViewOnInitDone:h,fitViewOnInit:p,nodeOrigin:m}=e(),v=n.initial&&!h&&p;if(c&&d&&(v||!n.initial)){const C=i().filter(S=>{var N;const b=n.includeHiddenNodes?S.width&&S.height:!S.hidden;return(N=n.nodes)!=null&&N.length?b&&n.nodes.some(E=>E.id===S.id):b}),_=C.every(S=>S.width&&S.height);if(C.length>0&&_){const S=ku(C,m),{x:b,y:N,zoom:E}=hE(S,s,o,n.minZoom??u,n.maxZoom??l,n.padding??.1),k=mr.translate(b,N).scale(E);return typeof n.duration=="number"&&n.duration>0?c.transform(xi(d,n.duration),k):c.transform(d,k),!0}}return!1}function wI(e,n){return e.forEach(i=>{const s=n.get(i.id);s&&n.set(s.id,{...s,[dt]:s[dt],selected:i.selected})}),new Map(n)}function xI(e,n){return n.map(i=>{const s=e.find(o=>o.id===i.id);return s&&(i.selected=s.selected),i})}function Ka({changedNodes:e,changedEdges:n,get:i,set:s}){const{nodeInternals:o,edges:u,onNodesChange:l,onEdgesChange:c,hasDefaultNodes:d,hasDefaultEdges:h}=i();e!=null&&e.length&&(d&&s({nodeInternals:wI(e,o)}),l==null||l(e)),n!=null&&n.length&&(h&&s({edges:xI(n,u)}),c==null||c(n))}const os=()=>{},_I={zoomIn:os,zoomOut:os,zoomTo:os,getZoom:()=>1,setViewport:os,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:os,fitBounds:os,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},SI=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),bI=()=>{const e=Nt(),{d3Zoom:n,d3Selection:i}=Ue(SI,Et);return O.useMemo(()=>i&&n?{zoomIn:o=>n.scaleBy(xi(i,o==null?void 0:o.duration),1.2),zoomOut:o=>n.scaleBy(xi(i,o==null?void 0:o.duration),1/1.2),zoomTo:(o,u)=>n.scaleTo(xi(i,u==null?void 0:u.duration),o),getZoom:()=>e.getState().transform[2],setViewport:(o,u)=>{const[l,c,d]=e.getState().transform,h=mr.translate(o.x??l,o.y??c).scale(o.zoom??d);n.transform(xi(i,u==null?void 0:u.duration),h)},getViewport:()=>{const[o,u,l]=e.getState().transform;return{x:o,y:u,zoom:l}},fitView:o=>RE(e.getState,o),setCenter:(o,u,l)=>{const{width:c,height:d,maxZoom:h}=e.getState(),p=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:h,m=c/2-o*p,v=d/2-u*p,x=mr.translate(m,v).scale(p);n.transform(xi(i,l==null?void 0:l.duration),x)},fitBounds:(o,u)=>{const{width:l,height:c,minZoom:d,maxZoom:h}=e.getState(),{x:p,y:m,zoom:v}=hE(o,l,c,d,h,(u==null?void 0:u.padding)??.1),x=mr.translate(p,m).scale(v);n.transform(xi(i,u==null?void 0:u.duration),x)},project:o=>{const{transform:u,snapToGrid:l,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"),gg(o,u,l,c)},screenToFlowPosition:o=>{const{transform:u,snapToGrid:l,snapGrid:c,domNode:d}=e.getState();if(!d)return o;const{x:h,y:p}=d.getBoundingClientRect(),m={x:o.x-h,y:o.y-p};return gg(m,u,l,c)},flowToScreenPosition:o=>{const{transform:u,domNode:l}=e.getState();if(!l)return o;const{x:c,y:d}=l.getBoundingClientRect(),h=cE(o,u);return{x:h.x+c,y:h.y+d}},viewportInitialized:!0}:_I,[n,i])};function Io(){const e=bI(),n=Nt(),i=O.useCallback(()=>n.getState().getNodes().map(_=>({..._})),[]),s=O.useCallback(_=>n.getState().nodeInternals.get(_),[]),o=O.useCallback(()=>{const{edges:_=[]}=n.getState();return _.map(S=>({...S}))},[]),u=O.useCallback(_=>{const{edges:S=[]}=n.getState();return S.find(b=>b.id===_)},[]),l=O.useCallback(_=>{const{getNodes:S,setNodes:b,hasDefaultNodes:N,onNodesChange:E}=n.getState(),k=S(),j=typeof _=="function"?_(k):_;if(N)b(j);else if(E){const I=j.length===0?k.map(P=>({type:"remove",id:P.id})):j.map(P=>({item:P,type:"reset"}));E(I)}},[]),c=O.useCallback(_=>{const{edges:S=[],setEdges:b,hasDefaultEdges:N,onEdgesChange:E}=n.getState(),k=typeof _=="function"?_(S):_;if(N)b(k);else if(E){const j=k.length===0?S.map(I=>({type:"remove",id:I.id})):k.map(I=>({item:I,type:"reset"}));E(j)}},[]),d=O.useCallback(_=>{const S=Array.isArray(_)?_:[_],{getNodes:b,setNodes:N,hasDefaultNodes:E,onNodesChange:k}=n.getState();if(E){const I=[...b(),...S];N(I)}else if(k){const j=S.map(I=>({item:I,type:"add"}));k(j)}},[]),h=O.useCallback(_=>{const S=Array.isArray(_)?_:[_],{edges:b=[],setEdges:N,hasDefaultEdges:E,onEdgesChange:k}=n.getState();if(E)N([...b,...S]);else if(k){const j=S.map(I=>({item:I,type:"add"}));k(j)}},[]),p=O.useCallback(()=>{const{getNodes:_,edges:S=[],transform:b}=n.getState(),[N,E,k]=b;return{nodes:_().map(j=>({...j})),edges:S.map(j=>({...j})),viewport:{x:N,y:E,zoom:k}}},[]),m=O.useCallback(({nodes:_,edges:S})=>{const{nodeInternals:b,getNodes:N,edges:E,hasDefaultNodes:k,hasDefaultEdges:j,onNodesDelete:I,onEdgesDelete:P,onNodesChange:D,onEdgesChange:A}=n.getState(),F=(_||[]).map(Y=>Y.id),q=(S||[]).map(Y=>Y.id),Q=N().reduce((Y,H)=>{const re=H.parentNode||H.parentId,X=!F.includes(H.id)&&re&&Y.find(G=>G.id===re);return(typeof H.deletable=="boolean"?H.deletable:!0)&&(F.includes(H.id)||X)&&Y.push(H),Y},[]),K=E.filter(Y=>typeof Y.deletable=="boolean"?Y.deletable:!0),T=K.filter(Y=>q.includes(Y.id));if(Q||T){const Y=dE(Q,K),H=[...T,...Y],re=H.reduce((X,$)=>(X.includes($.id)||X.push($.id),X),[]);if((j||k)&&(j&&n.setState({edges:E.filter(X=>!re.includes(X.id))}),k&&(Q.forEach(X=>{b.delete(X.id)}),n.setState({nodeInternals:new Map(b)}))),re.length>0&&(P==null||P(H),A&&A(re.map(X=>({id:X,type:"remove"})))),Q.length>0&&(I==null||I(Q),D)){const X=Q.map($=>({id:$.id,type:"remove"}));D(X)}}},[]),v=O.useCallback(_=>{const S=UA(_),b=S?null:n.getState().nodeInternals.get(_.id);return!S&&!b?[null,null,S]:[S?_:vw(b),b,S]},[]),x=O.useCallback((_,S=!0,b)=>{const[N,E,k]=v(_);return N?(b||n.getState().getNodes()).filter(j=>{if(!k&&(j.id===E.id||!j.positionAbsolute))return!1;const I=vw(j),P=dg(I,N);return S&&P>0||P>=N.width*N.height}):[]},[]),C=O.useCallback((_,S,b=!0)=>{const[N]=v(_);if(!N)return!1;const E=dg(N,S);return b&&E>0||E>=N.width*N.height},[]);return O.useMemo(()=>({...e,getNodes:i,getNode:s,getEdges:o,getEdge:u,setNodes:l,setEdges:c,addNodes:d,addEdges:h,toObject:p,deleteElements:m,getIntersectingNodes:x,isNodeIntersecting:C}),[e,i,s,o,u,l,c,d,h,p,m,x,C])}const kI={actInsideInputWithModifier:!1};var EI=({deleteKeyCode:e,multiSelectionKeyCode:n})=>{const i=Nt(),{deleteElements:s}=Io(),o=Co(e,kI),u=Co(n);O.useEffect(()=>{if(o){const{edges:l,getNodes:c}=i.getState(),d=c().filter(p=>p.selected),h=l.filter(p=>p.selected);s({nodes:d,edges:h}),i.setState({nodesSelectionActive:!1})}},[o]),O.useEffect(()=>{i.setState({multiSelectionActive:u})},[u])};function NI(e){const n=Nt();O.useEffect(()=>{let i;const s=()=>{var u,l;if(!e.current)return;const o=Pg(e.current);(o.height===0||o.width===0)&&((l=(u=n.getState()).onError)==null||l.call(u,"004",vr.error004())),n.setState({width:o.width||500,height:o.height||500})};return s(),window.addEventListener("resize",s),e.current&&(i=new ResizeObserver(()=>s()),i.observe(e.current)),()=>{window.removeEventListener("resize",s),i&&e.current&&i.unobserve(e.current)}},[])}const Bg={position:"absolute",width:"100%",height:"100%",top:0,left:0},CI=(e,n)=>e.x!==n.x||e.y!==n.y||e.zoom!==n.k,Xa=e=>({x:e.x,y:e.y,zoom:e.k}),as=(e,n)=>e.target.closest(`.${n}`),Cw=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),Rw=e=>{const n=e.ctrlKey&&du()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n},RI=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),TI=({onMove:e,onMoveStart:n,onMoveEnd:i,onPaneContextMenu:s,zoomOnScroll:o=!0,zoomOnPinch:u=!0,panOnScroll:l=!1,panOnScrollSpeed:c=.5,panOnScrollMode:d=Si.Free,zoomOnDoubleClick:h=!0,elementsSelectable:p,panOnDrag:m=!0,defaultViewport:v,translateExtent:x,minZoom:C,maxZoom:_,zoomActivationKeyCode:S,preventScrolling:b=!0,children:N,noWheelClassName:E,noPanClassName:k})=>{const j=O.useRef(),I=Nt(),P=O.useRef(!1),D=O.useRef(!1),A=O.useRef(null),F=O.useRef({x:0,y:0,zoom:0}),{d3Zoom:q,d3Selection:Q,d3ZoomHandler:K,userSelectionActive:T}=Ue(RI,Et),Y=Co(S),H=O.useRef(0),re=O.useRef(!1),X=O.useRef();return NI(A),O.useEffect(()=>{if(A.current){const $=A.current.getBoundingClientRect(),G=Zk().scaleExtent([C,_]).translateExtent(x),M=bn(A.current).call(G),B=mr.translate(v.x,v.y).scale(ys(v.zoom,C,_)),ae=[[0,0],[$.width,$.height]],z=G.constrain()(B,ae,x);G.transform(M,z),G.wheelDelta(Rw),I.setState({d3Zoom:G,d3Selection:M,d3ZoomHandler:M.on("wheel.zoom"),transform:[z.x,z.y,z.k],domNode:A.current.closest(".react-flow")})}},[]),O.useEffect(()=>{Q&&q&&(l&&!Y&&!T?Q.on("wheel.zoom",$=>{if(as($,E))return!1;$.preventDefault(),$.stopImmediatePropagation();const G=Q.property("__zoom").k||1;if($.ctrlKey&&u){const ce=Dn($),pe=Rw($),me=G*Math.pow(2,pe);q.scaleTo(Q,me,ce,$);return}const M=$.deltaMode===1?20:1;let B=d===Si.Vertical?0:$.deltaX*M,ae=d===Si.Horizontal?0:$.deltaY*M;!du()&&$.shiftKey&&d!==Si.Vertical&&(B=$.deltaY*M,ae=0),q.translateBy(Q,-(B/G)*c,-(ae/G)*c,{internal:!0});const z=Xa(Q.property("__zoom")),{onViewportChangeStart:W,onViewportChange:ee,onViewportChangeEnd:se}=I.getState();clearTimeout(X.current),re.current||(re.current=!0,n==null||n($,z),W==null||W(z)),re.current&&(e==null||e($,z),ee==null||ee(z),X.current=setTimeout(()=>{i==null||i($,z),se==null||se(z),re.current=!1},150))},{passive:!1}):typeof K<"u"&&Q.on("wheel.zoom",function($,G){if(!b&&$.type==="wheel"&&!$.ctrlKey||as($,E))return null;$.preventDefault(),K.call(this,$,G)},{passive:!1}))},[T,l,d,Q,q,K,Y,u,b,E,n,e,i]),O.useEffect(()=>{q&&q.on("start",$=>{var B,ae;if(!$.sourceEvent||$.sourceEvent.internal)return null;H.current=(B=$.sourceEvent)==null?void 0:B.button;const{onViewportChangeStart:G}=I.getState(),M=Xa($.transform);P.current=!0,F.current=M,((ae=$.sourceEvent)==null?void 0:ae.type)==="mousedown"&&I.setState({paneDragging:!0}),G==null||G(M),n==null||n($.sourceEvent,M)})},[q,n]),O.useEffect(()=>{q&&(T&&!P.current?q.on("zoom",null):T||q.on("zoom",$=>{var M;const{onViewportChange:G}=I.getState();if(I.setState({transform:[$.transform.x,$.transform.y,$.transform.k]}),D.current=!!(s&&Cw(m,H.current??0)),(e||G)&&!((M=$.sourceEvent)!=null&&M.internal)){const B=Xa($.transform);G==null||G(B),e==null||e($.sourceEvent,B)}}))},[T,q,e,m,s]),O.useEffect(()=>{q&&q.on("end",$=>{if(!$.sourceEvent||$.sourceEvent.internal)return null;const{onViewportChangeEnd:G}=I.getState();if(P.current=!1,I.setState({paneDragging:!1}),s&&Cw(m,H.current??0)&&!D.current&&s($.sourceEvent),D.current=!1,(i||G)&&CI(F.current,$.transform)){const M=Xa($.transform);F.current=M,clearTimeout(j.current),j.current=setTimeout(()=>{G==null||G(M),i==null||i($.sourceEvent,M)},l?150:0)}})},[q,l,m,i,s]),O.useEffect(()=>{q&&q.filter($=>{const G=Y||o,M=u&&$.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&$.button===1&&$.type==="mousedown"&&(as($,"react-flow__node")||as($,"react-flow__edge")))return!0;if(!m&&!G&&!l&&!h&&!u||T||!h&&$.type==="dblclick"||as($,E)&&$.type==="wheel"||as($,k)&&($.type!=="wheel"||l&&$.type==="wheel"&&!Y)||!u&&$.ctrlKey&&$.type==="wheel"||!G&&!l&&!M&&$.type==="wheel"||!m&&($.type==="mousedown"||$.type==="touchstart")||Array.isArray(m)&&!m.includes($.button)&&$.type==="mousedown")return!1;const B=Array.isArray(m)&&m.includes($.button)||!$.button||$.button<=1;return(!$.ctrlKey||$.type==="wheel")&&B})},[T,q,o,u,l,h,m,p,Y]),oe.createElement("div",{className:"react-flow__renderer",ref:A,style:Bg},N)},jI=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function AI(){const{userSelectionActive:e,userSelectionRect:n}=Ue(jI,Et);return e&&n?oe.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 Tw(e,n){const i=n.parentNode||n.parentId,s=e.find(o=>o.id===i);if(s){const o=n.position.x+n.width-s.width,u=n.position.y+n.height-s.height;if(o>0||u>0||n.position.x<0||n.position.y<0){if(s.style={...s.style},s.style.width=s.style.width??s.width,s.style.height=s.style.height??s.height,o>0&&(s.style.width+=o),u>0&&(s.style.height+=u),n.position.x<0){const l=Math.abs(n.position.x);s.position.x=s.position.x-l,s.style.width+=l,n.position.x=0}if(n.position.y<0){const l=Math.abs(n.position.y);s.position.y=s.position.y-l,s.style.height+=l,n.position.y=0}s.width=s.style.width,s.height=s.style.height}}}function II(e,n){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const i=e.filter(s=>s.type==="add").map(s=>s.item);return n.reduce((s,o)=>{const u=e.filter(c=>c.id===o.id);if(u.length===0)return s.push(o),s;const l={...o};for(const c of u)if(c)switch(c.type){case"select":{l.selected=c.selected;break}case"position":{typeof c.position<"u"&&(l.position=c.position),typeof c.positionAbsolute<"u"&&(l.positionAbsolute=c.positionAbsolute),typeof c.dragging<"u"&&(l.dragging=c.dragging),l.expandParent&&Tw(s,l);break}case"dimensions":{typeof c.dimensions<"u"&&(l.width=c.dimensions.width,l.height=c.dimensions.height),typeof c.updateStyle<"u"&&(l.style={...l.style||{},...c.dimensions}),typeof c.resizing=="boolean"&&(l.resizing=c.resizing),l.expandParent&&Tw(s,l);break}case"remove":return s}return s.push(l),s},i)}function MI(e,n){return II(e,n)}const Vr=(e,n)=>({id:e,type:"select",selected:n});function cs(e,n){return e.reduce((i,s)=>{const o=n.includes(s.id);return!s.selected&&o?(s.selected=!0,i.push(Vr(s.id,!0))):s.selected&&!o&&(s.selected=!1,i.push(Vr(s.id,!1))),i},[])}const Pc=(e,n)=>i=>{i.target===n.current&&(e==null||e(i))},PI=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),TE=O.memo(({isSelecting:e,selectionMode:n=No.Full,panOnDrag:i,onSelectionStart:s,onSelectionEnd:o,onPaneClick:u,onPaneContextMenu:l,onPaneScroll:c,onPaneMouseEnter:d,onPaneMouseMove:h,onPaneMouseLeave:p,children:m})=>{const v=O.useRef(null),x=Nt(),C=O.useRef(0),_=O.useRef(0),S=O.useRef(),{userSelectionActive:b,elementsSelectable:N,dragging:E}=Ue(PI,Et),k=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),C.current=0,_.current=0},j=K=>{u==null||u(K),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},I=K=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){K.preventDefault();return}l==null||l(K)},P=c?K=>c(K):void 0,D=K=>{const{resetSelectedElements:T,domNode:Y}=x.getState();if(S.current=Y==null?void 0:Y.getBoundingClientRect(),!N||!e||K.button!==0||K.target!==v.current||!S.current)return;const{x:H,y:re}=Gr(K,S.current);T(),x.setState({userSelectionRect:{width:0,height:0,startX:H,startY:re,x:H,y:re}}),s==null||s(K)},A=K=>{const{userSelectionRect:T,nodeInternals:Y,edges:H,transform:re,onNodesChange:X,onEdgesChange:$,nodeOrigin:G,getNodes:M}=x.getState();if(!e||!S.current||!T)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const B=Gr(K,S.current),ae=T.startX??0,z=T.startY??0,W={...T,x:B.x<ae?B.x:ae,y:B.y<z?B.y:z,width:Math.abs(B.x-ae),height:Math.abs(B.y-z)},ee=M(),se=fE(Y,W,re,n===No.Partial,!0,G),ce=dE(se,H).map(me=>me.id),pe=se.map(me=>me.id);if(C.current!==pe.length){C.current=pe.length;const me=cs(ee,pe);me.length&&(X==null||X(me))}if(_.current!==ce.length){_.current=ce.length;const me=cs(H,ce);me.length&&($==null||$(me))}x.setState({userSelectionRect:W})},F=K=>{if(K.button!==0)return;const{userSelectionRect:T}=x.getState();!b&&T&&K.target===v.current&&(j==null||j(K)),x.setState({nodesSelectionActive:C.current>0}),k(),o==null||o(K)},q=K=>{b&&(x.setState({nodesSelectionActive:C.current>0}),o==null||o(K)),k()},Q=N&&(e||b);return oe.createElement("div",{className:$t(["react-flow__pane",{dragging:E,selection:e}]),onClick:Q?void 0:Pc(j,v),onContextMenu:Pc(I,v),onWheel:Pc(P,v),onMouseEnter:Q?void 0:d,onMouseDown:Q?D:void 0,onMouseMove:Q?A:h,onMouseUp:Q?F:void 0,onMouseLeave:Q?q:p,ref:v,style:Bg},m,oe.createElement(AI,null))});TE.displayName="Pane";function jE(e,n){const i=e.parentNode||e.parentId;if(!i)return!1;const s=n.get(i);return s?s.selected?!0:jE(s,n):!1}function jw(e,n,i){let s=e;do{if(s!=null&&s.matches(n))return!0;if(s===i.current)return!1;s=s.parentElement}while(s);return!1}function OI(e,n,i,s){return Array.from(e.values()).filter(o=>(o.selected||o.id===s)&&(!o.parentNode||o.parentId||!jE(o,e))&&(o.draggable||n&&typeof o.draggable>"u")).map(o=>{var u,l;return{id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:i.x-(((u=o.positionAbsolute)==null?void 0:u.x)??0),y:i.y-(((l=o.positionAbsolute)==null?void 0:l.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 qI(e,n){return!n||n==="parent"?n:[n[0],[n[1][0]-(e.width||0),n[1][1]-(e.height||0)]]}function AE(e,n,i,s,o=[0,0],u){const l=qI(e,e.extent||s);let c=l;const d=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(d&&e.width&&e.height){const m=i.get(d),{x:v,y:x}=ki(m,o).positionAbsolute;c=m&&kn(v)&&kn(x)&&kn(m.width)&&kn(m.height)?[[v+e.width*o[0],x+e.height*o[1]],[v+m.width-e.width+e.width*o[0],x+m.height-e.height+e.height*o[1]]]:c}else u==null||u("005",vr.error005()),c=l;else if(e.extent&&d&&e.extent!=="parent"){const m=i.get(d),{x:v,y:x}=ki(m,o).positionAbsolute;c=[[e.extent[0][0]+v,e.extent[0][1]+x],[e.extent[1][0]+v,e.extent[1][1]+x]]}let h={x:0,y:0};if(d){const m=i.get(d);h=ki(m,o).positionAbsolute}const p=c&&c!=="parent"?Og(n,c):n;return{position:{x:p.x-h.x,y:p.y-h.y},positionAbsolute:p}}function Oc({nodeId:e,dragItems:n,nodeInternals:i}){const s=n.map(o=>({...i.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[e?s.find(o=>o.id===e):s[0],s]}const Aw=(e,n,i,s)=>{const o=n.querySelectorAll(e);if(!o||!o.length)return null;const u=Array.from(o),l=n.getBoundingClientRect(),c={x:l.width*s[0],y:l.height*s[1]};return u.map(d=>{const h=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),position:d.getAttribute("data-handlepos"),x:(h.left-l.left-c.x)/i,y:(h.top-l.top-c.y)/i,...Pg(d)}})};function uo(e,n,i){return i===void 0?i:s=>{const o=n().nodeInternals.get(e);o&&i(s,{...o})}}function yg({id:e,store:n,unselect:i=!1,nodeRef:s}){const{addSelectedNodes:o,unselectNodesAndEdges:u,multiSelectionActive:l,nodeInternals:c,onError:d}=n.getState(),h=c.get(e);if(!h){d==null||d("012",vr.error012(e));return}n.setState({nodesSelectionActive:!1}),h.selected?(i||h.selected&&l)&&(u({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var p;return(p=s==null?void 0:s.current)==null?void 0:p.blur()})):o([e])}function LI(){const e=Nt();return O.useCallback(({sourceEvent:i})=>{const{transform:s,snapGrid:o,snapToGrid:u}=e.getState(),l=i.touches?i.touches[0].clientX:i.clientX,c=i.touches?i.touches[0].clientY:i.clientY,d={x:(l-s[0])/s[2],y:(c-s[1])/s[2]};return{xSnapped:u?o[0]*Math.round(d.x/o[0]):d.x,ySnapped:u?o[1]*Math.round(d.y/o[1]):d.y,...d}},[])}function qc(e){return(n,i,s)=>e==null?void 0:e(n,s)}function IE({nodeRef:e,disabled:n=!1,noDragClassName:i,handleSelector:s,nodeId:o,isSelectable:u,selectNodesOnDrag:l}){const c=Nt(),[d,h]=O.useState(!1),p=O.useRef([]),m=O.useRef({x:null,y:null}),v=O.useRef(0),x=O.useRef(null),C=O.useRef({x:0,y:0}),_=O.useRef(null),S=O.useRef(!1),b=O.useRef(!1),N=O.useRef(!1),E=LI();return O.useEffect(()=>{if(e!=null&&e.current){const k=bn(e.current),j=({x:D,y:A})=>{const{nodeInternals:F,onNodeDrag:q,onSelectionDrag:Q,updateNodePositions:K,nodeExtent:T,snapGrid:Y,snapToGrid:H,nodeOrigin:re,onError:X}=c.getState();m.current={x:D,y:A};let $=!1,G={x:0,y:0,x2:0,y2:0};if(p.current.length>1&&T){const B=ku(p.current,re);G=Eo(B)}if(p.current=p.current.map(B=>{const ae={x:D-B.distance.x,y:A-B.distance.y};H&&(ae.x=Y[0]*Math.round(ae.x/Y[0]),ae.y=Y[1]*Math.round(ae.y/Y[1]));const z=[[T[0][0],T[0][1]],[T[1][0],T[1][1]]];p.current.length>1&&T&&!B.extent&&(z[0][0]=B.positionAbsolute.x-G.x+T[0][0],z[1][0]=B.positionAbsolute.x+(B.width??0)-G.x2+T[1][0],z[0][1]=B.positionAbsolute.y-G.y+T[0][1],z[1][1]=B.positionAbsolute.y+(B.height??0)-G.y2+T[1][1]);const W=AE(B,ae,F,z,re,X);return $=$||B.position.x!==W.position.x||B.position.y!==W.position.y,B.position=W.position,B.positionAbsolute=W.positionAbsolute,B}),!$)return;K(p.current,!0,!0),h(!0);const M=o?q:qc(Q);if(M&&_.current){const[B,ae]=Oc({nodeId:o,dragItems:p.current,nodeInternals:F});M(_.current,B,ae)}},I=()=>{if(!x.current)return;const[D,A]=eE(C.current,x.current);if(D!==0||A!==0){const{transform:F,panBy:q}=c.getState();m.current.x=(m.current.x??0)-D/F[2],m.current.y=(m.current.y??0)-A/F[2],q({x:D,y:A})&&j(m.current)}v.current=requestAnimationFrame(I)},P=D=>{var re;const{nodeInternals:A,multiSelectionActive:F,nodesDraggable:q,unselectNodesAndEdges:Q,onNodeDragStart:K,onSelectionDragStart:T}=c.getState();b.current=!0;const Y=o?K:qc(T);(!l||!u)&&!F&&o&&((re=A.get(o))!=null&&re.selected||Q()),o&&u&&l&&yg({id:o,store:c,nodeRef:e});const H=E(D);if(m.current=H,p.current=OI(A,q,H,o),Y&&p.current){const[X,$]=Oc({nodeId:o,dragItems:p.current,nodeInternals:A});Y(D.sourceEvent,X,$)}};if(n)k.on(".drag",null);else{const D=G2().on("start",A=>{const{domNode:F,nodeDragThreshold:q}=c.getState();q===0&&P(A),N.current=!1;const Q=E(A);m.current=Q,x.current=(F==null?void 0:F.getBoundingClientRect())||null,C.current=Gr(A.sourceEvent,x.current)}).on("drag",A=>{var K,T;const F=E(A),{autoPanOnNodeDrag:q,nodeDragThreshold:Q}=c.getState();if(A.sourceEvent.type==="touchmove"&&A.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!S.current&&b.current&&q&&(S.current=!0,I()),!b.current){const Y=F.xSnapped-(((K=m==null?void 0:m.current)==null?void 0:K.x)??0),H=F.ySnapped-(((T=m==null?void 0:m.current)==null?void 0:T.y)??0);Math.sqrt(Y*Y+H*H)>Q&&P(A)}(m.current.x!==F.xSnapped||m.current.y!==F.ySnapped)&&p.current&&b.current&&(_.current=A.sourceEvent,C.current=Gr(A.sourceEvent,x.current),j(F))}}).on("end",A=>{if(!(!b.current||N.current)&&(h(!1),S.current=!1,b.current=!1,cancelAnimationFrame(v.current),p.current)){const{updateNodePositions:F,nodeInternals:q,onNodeDragStop:Q,onSelectionDragStop:K}=c.getState(),T=o?Q:qc(K);if(F(p.current,!1,!1),T){const[Y,H]=Oc({nodeId:o,dragItems:p.current,nodeInternals:q});T(A.sourceEvent,Y,H)}}}).filter(A=>{const F=A.target;return!A.button&&(!i||!jw(F,`.${i}`,e))&&(!s||jw(F,s,e))});return k.call(D),()=>{k.on(".drag",null)}}}},[e,n,i,s,u,c,o,l,E]),d}function ME(){const e=Nt();return O.useCallback(i=>{const{nodeInternals:s,nodeExtent:o,updateNodePositions:u,getNodes:l,snapToGrid:c,snapGrid:d,onError:h,nodesDraggable:p}=e.getState(),m=l().filter(N=>N.selected&&(N.draggable||p&&typeof N.draggable>"u")),v=c?d[0]:5,x=c?d[1]:5,C=i.isShiftPressed?4:1,_=i.x*v*C,S=i.y*x*C,b=m.map(N=>{if(N.positionAbsolute){const E={x:N.positionAbsolute.x+_,y:N.positionAbsolute.y+S};c&&(E.x=d[0]*Math.round(E.x/d[0]),E.y=d[1]*Math.round(E.y/d[1]));const{positionAbsolute:k,position:j}=AE(N,E,s,o,void 0,h);N.position=j,N.positionAbsolute=k}return N});u(b,!0,!1)},[])}const ps={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var lo=e=>{const n=({id:i,type:s,data:o,xPos:u,yPos:l,xPosOrigin:c,yPosOrigin:d,selected:h,onClick:p,onMouseEnter:m,onMouseMove:v,onMouseLeave:x,onContextMenu:C,onDoubleClick:_,style:S,className:b,isDraggable:N,isSelectable:E,isConnectable:k,isFocusable:j,selectNodesOnDrag:I,sourcePosition:P,targetPosition:D,hidden:A,resizeObserver:F,dragHandle:q,zIndex:Q,isParent:K,noDragClassName:T,noPanClassName:Y,initialized:H,disableKeyboardA11y:re,ariaLabel:X,rfId:$,hasHandleBounds:G})=>{const M=Nt(),B=O.useRef(null),ae=O.useRef(null),z=O.useRef(P),W=O.useRef(D),ee=O.useRef(s),se=E||N||p||m||v||x,ce=ME(),pe=uo(i,M.getState,m),me=uo(i,M.getState,v),Pe=uo(i,M.getState,x),ze=uo(i,M.getState,C),je=uo(i,M.getState,_),Me=xe=>{const{nodeDragThreshold:_e}=M.getState();if(E&&(!I||!N||_e>0)&&yg({id:i,store:M,nodeRef:B}),p){const He=M.getState().nodeInternals.get(i);He&&p(xe,{...He})}},ke=xe=>{if(!hg(xe)&&!re)if(iE.includes(xe.key)&&E){const _e=xe.key==="Escape";yg({id:i,store:M,unselect:_e,nodeRef:B})}else N&&h&&Object.prototype.hasOwnProperty.call(ps,xe.key)&&(M.setState({ariaLiveMessage:`Moved selected node ${xe.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~u}, y: ${~~l}`}),ce({x:ps[xe.key].x,y:ps[xe.key].y,isShiftPressed:xe.shiftKey}))};O.useEffect(()=>()=>{ae.current&&(F==null||F.unobserve(ae.current),ae.current=null)},[]),O.useEffect(()=>{if(B.current&&!A){const xe=B.current;(!H||!G||ae.current!==xe)&&(ae.current&&(F==null||F.unobserve(ae.current)),F==null||F.observe(xe),ae.current=xe)}},[A,H,G]),O.useEffect(()=>{const xe=ee.current!==s,_e=z.current!==P,He=W.current!==D;B.current&&(xe||_e||He)&&(xe&&(ee.current=s),_e&&(z.current=P),He&&(W.current=D),M.getState().updateNodeDimensions([{id:i,nodeElement:B.current,forceUpdate:!0}]))},[i,s,P,D]);const De=IE({nodeRef:B,disabled:A||!N,noDragClassName:T,handleSelector:q,nodeId:i,isSelectable:E,selectNodesOnDrag:I});return A?null:oe.createElement("div",{className:$t(["react-flow__node",`react-flow__node-${s}`,{[Y]:N},b,{selected:h,selectable:E,parent:K,dragging:De}]),ref:B,style:{zIndex:Q,transform:`translate(${c}px,${d}px)`,pointerEvents:se?"all":"none",visibility:H?"visible":"hidden",...S},"data-id":i,"data-testid":`rf__node-${i}`,onMouseEnter:pe,onMouseMove:me,onMouseLeave:Pe,onContextMenu:ze,onClick:Me,onDoubleClick:je,onKeyDown:j?ke:void 0,tabIndex:j?0:void 0,role:j?"button":void 0,"aria-describedby":re?void 0:`${kE}-${$}`,"aria-label":X},oe.createElement(XA,{value:i},oe.createElement(e,{id:i,data:o,type:s,xPos:u,yPos:l,selected:h,isConnectable:k,sourcePosition:P,targetPosition:D,dragging:De,dragHandle:q,zIndex:Q})))};return n.displayName="NodeWrapper",O.memo(n)};const $I=e=>{const n=e.getNodes().filter(i=>i.selected);return{...ku(n,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function DI({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:i}){const s=Nt(),{width:o,height:u,x:l,y:c,transformString:d,userSelectionActive:h}=Ue($I,Et),p=ME(),m=O.useRef(null);if(O.useEffect(()=>{var C;i||(C=m.current)==null||C.focus({preventScroll:!0})},[i]),IE({nodeRef:m}),h||!o||!u)return null;const v=e?C=>{const _=s.getState().getNodes().filter(S=>S.selected);e(C,_)}:void 0,x=C=>{Object.prototype.hasOwnProperty.call(ps,C.key)&&p({x:ps[C.key].x,y:ps[C.key].y,isShiftPressed:C.shiftKey})};return oe.createElement("div",{className:$t(["react-flow__nodesselection","react-flow__container",n]),style:{transform:d}},oe.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:v,tabIndex:i?void 0:-1,onKeyDown:i?void 0:x,style:{width:o,height:u,top:c,left:l}}))}var FI=O.memo(DI);const zI=e=>e.nodesSelectionActive,PE=({children:e,onPaneClick:n,onPaneMouseEnter:i,onPaneMouseMove:s,onPaneMouseLeave:o,onPaneContextMenu:u,onPaneScroll:l,deleteKeyCode:c,onMove:d,onMoveStart:h,onMoveEnd:p,selectionKeyCode:m,selectionOnDrag:v,selectionMode:x,onSelectionStart:C,onSelectionEnd:_,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:N,elementsSelectable:E,zoomOnScroll:k,zoomOnPinch:j,panOnScroll:I,panOnScrollSpeed:P,panOnScrollMode:D,zoomOnDoubleClick:A,panOnDrag:F,defaultViewport:q,translateExtent:Q,minZoom:K,maxZoom:T,preventScrolling:Y,onSelectionContextMenu:H,noWheelClassName:re,noPanClassName:X,disableKeyboardA11y:$})=>{const G=Ue(zI),M=Co(m),B=Co(b),ae=B||F,z=B||I,W=M||v&&ae!==!0;return EI({deleteKeyCode:c,multiSelectionKeyCode:S}),oe.createElement(TI,{onMove:d,onMoveStart:h,onMoveEnd:p,onPaneContextMenu:u,elementsSelectable:E,zoomOnScroll:k,zoomOnPinch:j,panOnScroll:z,panOnScrollSpeed:P,panOnScrollMode:D,zoomOnDoubleClick:A,panOnDrag:!M&&ae,defaultViewport:q,translateExtent:Q,minZoom:K,maxZoom:T,zoomActivationKeyCode:N,preventScrolling:Y,noWheelClassName:re,noPanClassName:X},oe.createElement(TE,{onSelectionStart:C,onSelectionEnd:_,onPaneClick:n,onPaneMouseEnter:i,onPaneMouseMove:s,onPaneMouseLeave:o,onPaneContextMenu:u,onPaneScroll:l,panOnDrag:ae,isSelecting:!!W,selectionMode:x},e,G&&oe.createElement(FI,{onSelectionContextMenu:H,noPanClassName:X,disableKeyboardA11y:$})))};PE.displayName="FlowRenderer";var BI=O.memo(PE);function UI(e){return Ue(O.useCallback(i=>e?fE(i.nodeInternals,{x:0,y:0,width:i.width,height:i.height},i.transform,!0):i.getNodes(),[e]))}function HI(e){const n={input:lo(e.input||xE),default:lo(e.default||vg),output:lo(e.output||SE),group:lo(e.group||zg)},i={},s=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,u)=>(o[u]=lo(e[u]||vg),o),i);return{...n,...s}}const VI=({x:e,y:n,width:i,height:s,origin:o})=>!i||!s?{x:e,y:n}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:n}:{x:e-i*o[0],y:n-s*o[1]},WI=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),OE=e=>{const{nodesDraggable:n,nodesConnectable:i,nodesFocusable:s,elementsSelectable:o,updateNodeDimensions:u,onError:l}=Ue(WI,Et),c=UI(e.onlyRenderVisibleElements),d=O.useRef(),h=O.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const p=new ResizeObserver(m=>{const v=m.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));u(v)});return d.current=p,p},[]);return O.useEffect(()=>()=>{var p;(p=d==null?void 0:d.current)==null||p.disconnect()},[]),oe.createElement("div",{className:"react-flow__nodes",style:Bg},c.map(p=>{var j,I,P;let m=p.type||"default";e.nodeTypes[m]||(l==null||l("003",vr.error003(m)),m="default");const v=e.nodeTypes[m]||e.nodeTypes.default,x=!!(p.draggable||n&&typeof p.draggable>"u"),C=!!(p.selectable||o&&typeof p.selectable>"u"),_=!!(p.connectable||i&&typeof p.connectable>"u"),S=!!(p.focusable||s&&typeof p.focusable>"u"),b=e.nodeExtent?Og(p.positionAbsolute,e.nodeExtent):p.positionAbsolute,N=(b==null?void 0:b.x)??0,E=(b==null?void 0:b.y)??0,k=VI({x:N,y:E,width:p.width??0,height:p.height??0,origin:e.nodeOrigin});return oe.createElement(v,{key:p.id,id:p.id,className:p.className,style:p.style,type:m,data:p.data,sourcePosition:p.sourcePosition||Ce.Bottom,targetPosition:p.targetPosition||Ce.Top,hidden:p.hidden,xPos:N,yPos:E,xPosOrigin:k.x,yPosOrigin:k.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!p.selected,isDraggable:x,isSelectable:C,isConnectable:_,isFocusable:S,resizeObserver:h,dragHandle:p.dragHandle,zIndex:((j=p[dt])==null?void 0:j.z)??0,isParent:!!((I=p[dt])!=null&&I.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!p.width&&!!p.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:p.ariaLabel,hasHandleBounds:!!((P=p[dt])!=null&&P.handleBounds)})}))};OE.displayName="NodeRenderer";var GI=O.memo(OE);const YI=(e,n,i)=>i===Ce.Left?e-n:i===Ce.Right?e+n:e,KI=(e,n,i)=>i===Ce.Top?e-n:i===Ce.Bottom?e+n:e,Iw="react-flow__edgeupdater",Mw=({position:e,centerX:n,centerY:i,radius:s=10,onMouseDown:o,onMouseEnter:u,onMouseOut:l,type:c})=>oe.createElement("circle",{onMouseDown:o,onMouseEnter:u,onMouseOut:l,className:$t([Iw,`${Iw}-${c}`]),cx:YI(n,s,e),cy:KI(i,s,e),r:s,stroke:"transparent",fill:"transparent"}),XI=()=>!0;var us=e=>{const n=({id:i,className:s,type:o,data:u,onClick:l,onEdgeDoubleClick:c,selected:d,animated:h,label:p,labelStyle:m,labelShowBg:v,labelBgStyle:x,labelBgPadding:C,labelBgBorderRadius:_,style:S,source:b,target:N,sourceX:E,sourceY:k,targetX:j,targetY:I,sourcePosition:P,targetPosition:D,elementsSelectable:A,hidden:F,sourceHandleId:q,targetHandleId:Q,onContextMenu:K,onMouseEnter:T,onMouseMove:Y,onMouseLeave:H,reconnectRadius:re,onReconnect:X,onReconnectStart:$,onReconnectEnd:G,markerEnd:M,markerStart:B,rfId:ae,ariaLabel:z,isFocusable:W,isReconnectable:ee,pathOptions:se,interactionWidth:ce,disableKeyboardA11y:pe})=>{const me=O.useRef(null),[Pe,ze]=O.useState(!1),[je,Me]=O.useState(!1),ke=Nt(),De=O.useMemo(()=>`url('#${mg(B,ae)}')`,[B,ae]),xe=O.useMemo(()=>`url('#${mg(M,ae)}')`,[M,ae]);if(F)return null;const _e=Ve=>{var It;const{edges:wt,addSelectedEdges:ct,unselectNodesAndEdges:ot,multiSelectionActive:rn}=ke.getState(),ht=wt.find(dn=>dn.id===i);ht&&(A&&(ke.setState({nodesSelectionActive:!1}),ht.selected&&rn?(ot({nodes:[],edges:[ht]}),(It=me.current)==null||It.blur()):ct([i])),l&&l(Ve,ht))},He=ao(i,ke.getState,c),st=ao(i,ke.getState,K),vt=ao(i,ke.getState,T),lt=ao(i,ke.getState,Y),Ke=ao(i,ke.getState,H),yt=(Ve,wt)=>{if(Ve.button!==0)return;const{edges:ct,isValidConnection:ot}=ke.getState(),rn=wt?N:b,ht=(wt?Q:q)||null,It=wt?"target":"source",dn=ot||XI,Vn=wt,Cn=ct.find(pn=>pn.id===i);Me(!0),$==null||$(Ve,Cn,It);const Mt=pn=>{Me(!1),G==null||G(pn,Cn,It)};gE({event:Ve,handleId:ht,nodeId:rn,onConnect:pn=>X==null?void 0:X(Cn,pn),isTarget:Vn,getState:ke.getState,setState:ke.setState,isValidConnection:dn,edgeUpdaterType:It,onReconnectEnd:Mt})},At=Ve=>yt(Ve,!0),Xe=Ve=>yt(Ve,!1),Ct=()=>ze(!0),Ze=()=>ze(!1),Wt=!A&&!l,Je=Ve=>{var wt;if(!pe&&iE.includes(Ve.key)&&A){const{unselectNodesAndEdges:ct,addSelectedEdges:ot,edges:rn}=ke.getState();Ve.key==="Escape"?((wt=me.current)==null||wt.blur(),ct({edges:[rn.find(It=>It.id===i)]})):ot([i])}};return oe.createElement("g",{className:$t(["react-flow__edge",`react-flow__edge-${o}`,s,{selected:d,animated:h,inactive:Wt,updating:Pe}]),onClick:_e,onDoubleClick:He,onContextMenu:st,onMouseEnter:vt,onMouseMove:lt,onMouseLeave:Ke,onKeyDown:W?Je:void 0,tabIndex:W?0:void 0,role:W?"button":"img","data-testid":`rf__edge-${i}`,"aria-label":z===null?void 0:z||`Edge from ${b} to ${N}`,"aria-describedby":W?`${EE}-${ae}`:void 0,ref:me},!je&&oe.createElement(e,{id:i,source:b,target:N,selected:d,animated:h,label:p,labelStyle:m,labelShowBg:v,labelBgStyle:x,labelBgPadding:C,labelBgBorderRadius:_,data:u,style:S,sourceX:E,sourceY:k,targetX:j,targetY:I,sourcePosition:P,targetPosition:D,sourceHandleId:q,targetHandleId:Q,markerStart:De,markerEnd:xe,pathOptions:se,interactionWidth:ce}),ee&&oe.createElement(oe.Fragment,null,(ee==="source"||ee===!0)&&oe.createElement(Mw,{position:P,centerX:E,centerY:k,radius:re,onMouseDown:At,onMouseEnter:Ct,onMouseOut:Ze,type:"source"}),(ee==="target"||ee===!0)&&oe.createElement(Mw,{position:D,centerX:j,centerY:I,radius:re,onMouseDown:Xe,onMouseEnter:Ct,onMouseOut:Ze,type:"target"})))};return n.displayName="EdgeWrapper",O.memo(n)};function QI(e){const n={default:us(e.default||pu),straight:us(e.bezier||$g),step:us(e.step||Lg),smoothstep:us(e.step||bu),simplebezier:us(e.simplebezier||qg)},i={},s=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,u)=>(o[u]=us(e[u]||pu),o),i);return{...n,...s}}function Pw(e,n,i=null){const s=((i==null?void 0:i.x)||0)+n.x,o=((i==null?void 0:i.y)||0)+n.y,u=(i==null?void 0:i.width)||n.width,l=(i==null?void 0:i.height)||n.height;switch(e){case Ce.Top:return{x:s+u/2,y:o};case Ce.Right:return{x:s+u,y:o+l/2};case Ce.Bottom:return{x:s+u/2,y:o+l};case Ce.Left:return{x:s,y:o+l/2}}}function Ow(e,n){return e?e.length===1||!n?e[0]:n&&e.find(i=>i.id===n)||null:null}const ZI=(e,n,i,s,o,u)=>{const l=Pw(i,e,n),c=Pw(u,s,o);return{sourceX:l.x,sourceY:l.y,targetX:c.x,targetY:c.y}};function JI({sourcePos:e,targetPos:n,sourceWidth:i,sourceHeight:s,targetWidth:o,targetHeight:u,width:l,height:c,transform:d}){const h={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+i,n.x+o),y2:Math.max(e.y+s,n.y+u)};h.x===h.x2&&(h.x2+=1),h.y===h.y2&&(h.y2+=1);const p=Eo({x:(0-d[0])/d[2],y:(0-d[1])/d[2],width:l/d[2],height:c/d[2]}),m=Math.max(0,Math.min(p.x2,h.x2)-Math.max(p.x,h.x)),v=Math.max(0,Math.min(p.y2,h.y2)-Math.max(p.y,h.y));return Math.ceil(m*v)>0}function qw(e){var s,o,u,l,c;const n=((s=e==null?void 0:e[dt])==null?void 0:s.handleBounds)||null,i=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((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)<"u";return[{x:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.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,!!i]}const eM=[{level:0,isMaxLevel:!0,edges:[]}];function tM(e,n,i=!1){let s=-1;const o=e.reduce((l,c)=>{var p,m;const d=kn(c.zIndex);let h=d?c.zIndex:0;if(i){const v=n.get(c.target),x=n.get(c.source),C=c.selected||(v==null?void 0:v.selected)||(x==null?void 0:x.selected),_=Math.max(((p=x==null?void 0:x[dt])==null?void 0:p.z)||0,((m=v==null?void 0:v[dt])==null?void 0:m.z)||0,1e3);h=(d?c.zIndex:0)+(C?_:0)}return l[h]?l[h].push(c):l[h]=[c],s=h>s?h:s,l},{}),u=Object.entries(o).map(([l,c])=>{const d=+l;return{edges:c,level:d,isMaxLevel:d===s}});return u.length===0?eM:u}function nM(e,n,i){const s=Ue(O.useCallback(o=>e?o.edges.filter(u=>{const l=n.get(u.source),c=n.get(u.target);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&JI({sourcePos:l.positionAbsolute||{x:0,y:0},targetPos:c.positionAbsolute||{x:0,y:0},sourceWidth:l.width,sourceHeight:l.height,targetWidth:c.width,targetHeight:c.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[e,n]));return tM(s,n,i)}const rM=({color:e="none",strokeWidth:n=1})=>oe.createElement("polyline",{style:{stroke:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),iM=({color:e="none",strokeWidth:n=1})=>oe.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Lw={[hu.Arrow]:rM,[hu.ArrowClosed]:iM};function sM(e){const n=Nt();return O.useMemo(()=>{var o,u;return Object.prototype.hasOwnProperty.call(Lw,e)?Lw[e]:((u=(o=n.getState()).onError)==null||u.call(o,"009",vr.error009(e)),null)},[e])}const oM=({id:e,type:n,color:i,width:s=12.5,height:o=12.5,markerUnits:u="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const d=sM(n);return d?oe.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:u,orient:c,refX:"0",refY:"0"},oe.createElement(d,{color:i,strokeWidth:l})):null},aM=({defaultColor:e,rfId:n})=>i=>{const s=[];return i.edges.reduce((o,u)=>([u.markerStart,u.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const c=mg(l,n);s.includes(c)||(o.push({id:c,color:l.color||e,...l}),s.push(c))}}),o),[]).sort((o,u)=>o.id.localeCompare(u.id))},qE=({defaultColor:e,rfId:n})=>{const i=Ue(O.useCallback(aM({defaultColor:e,rfId:n}),[e,n]),(s,o)=>!(s.length!==o.length||s.some((u,l)=>u.id!==o[l].id)));return oe.createElement("defs",null,i.map(s=>oe.createElement(oM,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient})))};qE.displayName="MarkerDefinitions";var uM=O.memo(qE);const lM=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}),LE=({defaultMarkerColor:e,onlyRenderVisibleElements:n,elevateEdgesOnSelect:i,rfId:s,edgeTypes:o,noPanClassName:u,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:d,onEdgeMouseLeave:h,onEdgeClick:p,onEdgeDoubleClick:m,onReconnect:v,onReconnectStart:x,onReconnectEnd:C,reconnectRadius:_,children:S,disableKeyboardA11y:b})=>{const{edgesFocusable:N,edgesUpdatable:E,elementsSelectable:k,width:j,height:I,connectionMode:P,nodeInternals:D,onError:A}=Ue(lM,Et),F=nM(n,D,i);return j?oe.createElement(oe.Fragment,null,F.map(({level:q,edges:Q,isMaxLevel:K})=>oe.createElement("svg",{key:q,style:{zIndex:q},width:j,height:I,className:"react-flow__edges react-flow__container"},K&&oe.createElement(uM,{defaultColor:e,rfId:s}),oe.createElement("g",null,Q.map(T=>{const[Y,H,re]=qw(D.get(T.source)),[X,$,G]=qw(D.get(T.target));if(!re||!G)return null;let M=T.type||"default";o[M]||(A==null||A("011",vr.error011(M)),M="default");const B=o[M]||o.default,ae=P===Ni.Strict?$.target:($.target??[]).concat($.source??[]),z=Ow(H.source,T.sourceHandle),W=Ow(ae,T.targetHandle),ee=(z==null?void 0:z.position)||Ce.Bottom,se=(W==null?void 0:W.position)||Ce.Top,ce=!!(T.focusable||N&&typeof T.focusable>"u"),pe=T.reconnectable||T.updatable,me=typeof v<"u"&&(pe||E&&typeof pe>"u");if(!z||!W)return A==null||A("008",vr.error008(z,T)),null;const{sourceX:Pe,sourceY:ze,targetX:je,targetY:Me}=ZI(Y,z,ee,X,W,se);return oe.createElement(B,{key:T.id,id:T.id,className:$t([T.className,u]),type:M,data:T.data,selected:!!T.selected,animated:!!T.animated,hidden:!!T.hidden,label:T.label,labelStyle:T.labelStyle,labelShowBg:T.labelShowBg,labelBgStyle:T.labelBgStyle,labelBgPadding:T.labelBgPadding,labelBgBorderRadius:T.labelBgBorderRadius,style:T.style,source:T.source,target:T.target,sourceHandleId:T.sourceHandle,targetHandleId:T.targetHandle,markerEnd:T.markerEnd,markerStart:T.markerStart,sourceX:Pe,sourceY:ze,targetX:je,targetY:Me,sourcePosition:ee,targetPosition:se,elementsSelectable:k,onContextMenu:l,onMouseEnter:c,onMouseMove:d,onMouseLeave:h,onClick:p,onEdgeDoubleClick:m,onReconnect:v,onReconnectStart:x,onReconnectEnd:C,reconnectRadius:_,rfId:s,ariaLabel:T.ariaLabel,isFocusable:ce,isReconnectable:me,pathOptions:"pathOptions"in T?T.pathOptions:void 0,interactionWidth:T.interactionWidth,disableKeyboardA11y:b})})))),S):null};LE.displayName="EdgeRenderer";var cM=O.memo(LE);const fM=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function dM({children:e}){const n=Ue(fM);return oe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:n}},e)}function hM(e){const n=Io(),i=O.useRef(!1);O.useEffect(()=>{!i.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),i.current=!0)},[e,n.viewportInitialized])}const pM={[Ce.Left]:Ce.Right,[Ce.Right]:Ce.Left,[Ce.Top]:Ce.Bottom,[Ce.Bottom]:Ce.Top},$E=({nodeId:e,handleType:n,style:i,type:s=Wr.Bezier,CustomComponent:o,connectionStatus:u})=>{var I,P,D;const{fromNode:l,handleId:c,toX:d,toY:h,connectionMode:p}=Ue(O.useCallback(A=>({fromNode:A.nodeInternals.get(e),handleId:A.connectionHandleId,toX:(A.connectionPosition.x-A.transform[0])/A.transform[2],toY:(A.connectionPosition.y-A.transform[1])/A.transform[2],connectionMode:A.connectionMode}),[e]),Et),m=(I=l==null?void 0:l[dt])==null?void 0:I.handleBounds;let v=m==null?void 0:m[n];if(p===Ni.Loose&&(v=v||(m==null?void 0:m[n==="source"?"target":"source"])),!l||!v)return null;const x=c?v.find(A=>A.id===c):v[0],C=x?x.x+x.width/2:(l.width??0)/2,_=x?x.y+x.height/2:l.height??0,S=(((P=l.positionAbsolute)==null?void 0:P.x)??0)+C,b=(((D=l.positionAbsolute)==null?void 0:D.y)??0)+_,N=x==null?void 0:x.position,E=N?pM[N]:null;if(!N||!E)return null;if(o)return oe.createElement(o,{connectionLineType:s,connectionLineStyle:i,fromNode:l,fromHandle:x,fromX:S,fromY:b,toX:d,toY:h,fromPosition:N,toPosition:E,connectionStatus:u});let k="";const j={sourceX:S,sourceY:b,sourcePosition:N,targetX:d,targetY:h,targetPosition:E};return s===Wr.Bezier?[k]=lE(j):s===Wr.Step?[k]=pg({...j,borderRadius:0}):s===Wr.SmoothStep?[k]=pg(j):s===Wr.SimpleBezier?[k]=uE(j):k=`M${S},${b} ${d},${h}`,oe.createElement("path",{d:k,fill:"none",className:"react-flow__connection-path",style:i})};$E.displayName="ConnectionLine";const mM=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function gM({containerStyle:e,style:n,type:i,component:s}){const{nodeId:o,handleType:u,nodesConnectable:l,width:c,height:d,connectionStatus:h}=Ue(mM,Et);return!(o&&u&&c&&l)?null:oe.createElement("svg",{style:e,width:c,height:d,className:"react-flow__edges react-flow__connectionline react-flow__container"},oe.createElement("g",{className:$t(["react-flow__connection",h])},oe.createElement($E,{nodeId:o,handleType:u,style:n,type:i,CustomComponent:s,connectionStatus:h})))}function $w(e,n){return O.useRef(null),Nt(),O.useMemo(()=>n(e),[e])}const DE=({nodeTypes:e,edgeTypes:n,onMove:i,onMoveStart:s,onMoveEnd:o,onInit:u,onNodeClick:l,onEdgeClick:c,onNodeDoubleClick:d,onEdgeDoubleClick:h,onNodeMouseEnter:p,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:x,onSelectionContextMenu:C,onSelectionStart:_,onSelectionEnd:S,connectionLineType:b,connectionLineStyle:N,connectionLineComponent:E,connectionLineContainerStyle:k,selectionKeyCode:j,selectionOnDrag:I,selectionMode:P,multiSelectionKeyCode:D,panActivationKeyCode:A,zoomActivationKeyCode:F,deleteKeyCode:q,onlyRenderVisibleElements:Q,elementsSelectable:K,selectNodesOnDrag:T,defaultViewport:Y,translateExtent:H,minZoom:re,maxZoom:X,preventScrolling:$,defaultMarkerColor:G,zoomOnScroll:M,zoomOnPinch:B,panOnScroll:ae,panOnScrollSpeed:z,panOnScrollMode:W,zoomOnDoubleClick:ee,panOnDrag:se,onPaneClick:ce,onPaneMouseEnter:pe,onPaneMouseMove:me,onPaneMouseLeave:Pe,onPaneScroll:ze,onPaneContextMenu:je,onEdgeContextMenu:Me,onEdgeMouseEnter:ke,onEdgeMouseMove:De,onEdgeMouseLeave:xe,onReconnect:_e,onReconnectStart:He,onReconnectEnd:st,reconnectRadius:vt,noDragClassName:lt,noWheelClassName:Ke,noPanClassName:yt,elevateEdgesOnSelect:At,disableKeyboardA11y:Xe,nodeOrigin:Ct,nodeExtent:Ze,rfId:Wt})=>{const Je=$w(e,HI),Ve=$w(n,QI);return hM(u),oe.createElement(BI,{onPaneClick:ce,onPaneMouseEnter:pe,onPaneMouseMove:me,onPaneMouseLeave:Pe,onPaneContextMenu:je,onPaneScroll:ze,deleteKeyCode:q,selectionKeyCode:j,selectionOnDrag:I,selectionMode:P,onSelectionStart:_,onSelectionEnd:S,multiSelectionKeyCode:D,panActivationKeyCode:A,zoomActivationKeyCode:F,elementsSelectable:K,onMove:i,onMoveStart:s,onMoveEnd:o,zoomOnScroll:M,zoomOnPinch:B,zoomOnDoubleClick:ee,panOnScroll:ae,panOnScrollSpeed:z,panOnScrollMode:W,panOnDrag:se,defaultViewport:Y,translateExtent:H,minZoom:re,maxZoom:X,onSelectionContextMenu:C,preventScrolling:$,noDragClassName:lt,noWheelClassName:Ke,noPanClassName:yt,disableKeyboardA11y:Xe},oe.createElement(dM,null,oe.createElement(cM,{edgeTypes:Ve,onEdgeClick:c,onEdgeDoubleClick:h,onlyRenderVisibleElements:Q,onEdgeContextMenu:Me,onEdgeMouseEnter:ke,onEdgeMouseMove:De,onEdgeMouseLeave:xe,onReconnect:_e,onReconnectStart:He,onReconnectEnd:st,reconnectRadius:vt,defaultMarkerColor:G,noPanClassName:yt,elevateEdgesOnSelect:!!At,disableKeyboardA11y:Xe,rfId:Wt},oe.createElement(gM,{style:N,type:b,component:E,containerStyle:k})),oe.createElement("div",{className:"react-flow__edgelabel-renderer"}),oe.createElement(GI,{nodeTypes:Je,onNodeClick:l,onNodeDoubleClick:d,onNodeMouseEnter:p,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:x,selectNodesOnDrag:T,onlyRenderVisibleElements:Q,noPanClassName:yt,noDragClassName:lt,disableKeyboardA11y:Xe,nodeOrigin:Ct,nodeExtent:Ze,rfId:Wt})))};DE.displayName="GraphView";var vM=O.memo(DE);const wg=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ur={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:wg,nodeExtent:wg,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ni.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:HA,isValidConnection:void 0},yM=()=>sT((e,n)=>({...Ur,setNodes:i=>{const{nodeInternals:s,nodeOrigin:o,elevateNodesOnSelect:u}=n();e({nodeInternals:Mc(i,s,o,u)})},getNodes:()=>Array.from(n().nodeInternals.values()),setEdges:i=>{const{defaultEdgeOptions:s={}}=n();e({edges:i.map(o=>({...s,...o}))})},setDefaultNodesAndEdges:(i,s)=>{const o=typeof i<"u",u=typeof s<"u",l=o?Mc(i,new Map,n().nodeOrigin,n().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:u?s:[],hasDefaultNodes:o,hasDefaultEdges:u})},updateNodeDimensions:i=>{const{onNodesChange:s,nodeInternals:o,fitViewOnInit:u,fitViewOnInitDone:l,fitViewOnInitOptions:c,domNode:d,nodeOrigin:h}=n(),p=d==null?void 0:d.querySelector(".react-flow__viewport");if(!p)return;const m=window.getComputedStyle(p),{m22:v}=new window.DOMMatrixReadOnly(m.transform),x=i.reduce((_,S)=>{const b=o.get(S.id);if(b!=null&&b.hidden)o.set(b.id,{...b,[dt]:{...b[dt],handleBounds:void 0}});else if(b){const N=Pg(S.nodeElement);!!(N.width&&N.height&&(b.width!==N.width||b.height!==N.height||S.forceUpdate))&&(o.set(b.id,{...b,[dt]:{...b[dt],handleBounds:{source:Aw(".source",S.nodeElement,v,h),target:Aw(".target",S.nodeElement,v,h)}},...N}),_.push({id:b.id,type:"dimensions",dimensions:N}))}return _},[]);CE(o,h);const C=l||u&&!l&&RE(n,{initial:!0,...c});e({nodeInternals:new Map(o),fitViewOnInitDone:C}),(x==null?void 0:x.length)>0&&(s==null||s(x))},updateNodePositions:(i,s=!0,o=!1)=>{const{triggerNodeChanges:u}=n(),l=i.map(c=>{const d={id:c.id,type:"position",dragging:o};return s&&(d.positionAbsolute=c.positionAbsolute,d.position=c.position),d});u(l)},triggerNodeChanges:i=>{const{onNodesChange:s,nodeInternals:o,hasDefaultNodes:u,nodeOrigin:l,getNodes:c,elevateNodesOnSelect:d}=n();if(i!=null&&i.length){if(u){const h=MI(i,c()),p=Mc(h,o,l,d);e({nodeInternals:p})}s==null||s(i)}},addSelectedNodes:i=>{const{multiSelectionActive:s,edges:o,getNodes:u}=n();let l,c=null;s?l=i.map(d=>Vr(d,!0)):(l=cs(u(),i),c=cs(o,[])),Ka({changedNodes:l,changedEdges:c,get:n,set:e})},addSelectedEdges:i=>{const{multiSelectionActive:s,edges:o,getNodes:u}=n();let l,c=null;s?l=i.map(d=>Vr(d,!0)):(l=cs(o,i),c=cs(u(),[])),Ka({changedNodes:c,changedEdges:l,get:n,set:e})},unselectNodesAndEdges:({nodes:i,edges:s}={})=>{const{edges:o,getNodes:u}=n(),l=i||u(),c=s||o,d=l.map(p=>(p.selected=!1,Vr(p.id,!1))),h=c.map(p=>Vr(p.id,!1));Ka({changedNodes:d,changedEdges:h,get:n,set:e})},setMinZoom:i=>{const{d3Zoom:s,maxZoom:o}=n();s==null||s.scaleExtent([i,o]),e({minZoom:i})},setMaxZoom:i=>{const{d3Zoom:s,minZoom:o}=n();s==null||s.scaleExtent([o,i]),e({maxZoom:i})},setTranslateExtent:i=>{var s;(s=n().d3Zoom)==null||s.translateExtent(i),e({translateExtent:i})},resetSelectedElements:()=>{const{edges:i,getNodes:s}=n(),u=s().filter(c=>c.selected).map(c=>Vr(c.id,!1)),l=i.filter(c=>c.selected).map(c=>Vr(c.id,!1));Ka({changedNodes:u,changedEdges:l,get:n,set:e})},setNodeExtent:i=>{const{nodeInternals:s}=n();s.forEach(o=>{o.positionAbsolute=Og(o.position,i)}),e({nodeExtent:i,nodeInternals:new Map(s)})},panBy:i=>{const{transform:s,width:o,height:u,d3Zoom:l,d3Selection:c,translateExtent:d}=n();if(!l||!c||!i.x&&!i.y)return!1;const h=mr.translate(s[0]+i.x,s[1]+i.y).scale(s[2]),p=[[0,0],[o,u]],m=l==null?void 0:l.constrain()(h,p,d);return l.transform(c,m),s[0]!==m.x||s[1]!==m.y||s[2]!==m.k},cancelConnection:()=>e({connectionNodeId:Ur.connectionNodeId,connectionHandleId:Ur.connectionHandleId,connectionHandleType:Ur.connectionHandleType,connectionStatus:Ur.connectionStatus,connectionStartHandle:Ur.connectionStartHandle,connectionEndHandle:Ur.connectionEndHandle}),reset:()=>e({...Ur})}),Object.is),Ug=({children:e})=>{const n=O.useRef(null);return n.current||(n.current=yM()),oe.createElement(LA,{value:n.current},e)};Ug.displayName="ReactFlowProvider";const FE=({children:e})=>O.useContext(Su)?oe.createElement(oe.Fragment,null,e):oe.createElement(Ug,null,e);FE.displayName="ReactFlowWrapper";const wM={input:xE,default:vg,output:SE,group:zg},xM={default:pu,straight:$g,step:Lg,smoothstep:bu,simplebezier:qg},_M=[0,0],SM=[15,15],bM={x:0,y:0,zoom:1},kM={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},zE=O.forwardRef(({nodes:e,edges:n,defaultNodes:i,defaultEdges:s,className:o,nodeTypes:u=wM,edgeTypes:l=xM,onNodeClick:c,onEdgeClick:d,onInit:h,onMove:p,onMoveStart:m,onMoveEnd:v,onConnect:x,onConnectStart:C,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:b,onNodeMouseEnter:N,onNodeMouseMove:E,onNodeMouseLeave:k,onNodeContextMenu:j,onNodeDoubleClick:I,onNodeDragStart:P,onNodeDrag:D,onNodeDragStop:A,onNodesDelete:F,onEdgesDelete:q,onSelectionChange:Q,onSelectionDragStart:K,onSelectionDrag:T,onSelectionDragStop:Y,onSelectionContextMenu:H,onSelectionStart:re,onSelectionEnd:X,connectionMode:$=Ni.Strict,connectionLineType:G=Wr.Bezier,connectionLineStyle:M,connectionLineComponent:B,connectionLineContainerStyle:ae,deleteKeyCode:z="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:ee=!1,selectionMode:se=No.Full,panActivationKeyCode:ce="Space",multiSelectionKeyCode:pe=du()?"Meta":"Control",zoomActivationKeyCode:me=du()?"Meta":"Control",snapToGrid:Pe=!1,snapGrid:ze=SM,onlyRenderVisibleElements:je=!1,selectNodesOnDrag:Me=!0,nodesDraggable:ke,nodesConnectable:De,nodesFocusable:xe,nodeOrigin:_e=_M,edgesFocusable:He,edgesUpdatable:st,elementsSelectable:vt,defaultViewport:lt=bM,minZoom:Ke=.5,maxZoom:yt=2,translateExtent:At=wg,preventScrolling:Xe=!0,nodeExtent:Ct,defaultMarkerColor:Ze="#b1b1b7",zoomOnScroll:Wt=!0,zoomOnPinch:Je=!0,panOnScroll:Ve=!1,panOnScrollSpeed:wt=.5,panOnScrollMode:ct=Si.Free,zoomOnDoubleClick:ot=!0,panOnDrag:rn=!0,onPaneClick:ht,onPaneMouseEnter:It,onPaneMouseMove:dn,onPaneMouseLeave:Vn,onPaneScroll:Cn,onPaneContextMenu:Mt,children:hn,onEdgeContextMenu:pn,onEdgeDoubleClick:Xr,onEdgeMouseEnter:Qr,onEdgeMouseMove:Ai,onEdgeMouseLeave:Pt,onEdgeUpdate:Jn,onEdgeUpdateStart:Rn,onEdgeUpdateEnd:sn,onReconnect:er,onReconnectStart:Tn,onReconnectEnd:Ii,reconnectRadius:mn=10,edgeUpdaterRadius:tr=10,onNodesChange:nr,onEdgesChange:xr,noDragClassName:Gt="nodrag",noWheelClassName:Es="nowheel",noPanClassName:Zr="nopan",fitView:jn=!1,fitViewOptions:Mi,connectOnClick:Jr=!0,attributionPosition:rr,proOptions:Pi,defaultEdgeOptions:St,elevateNodesOnSelect:ei=!0,elevateEdgesOnSelect:_r=!1,disableKeyboardA11y:Sr=!1,autoPanOnConnect:Oi=!0,autoPanOnNodeDrag:Ge=!0,connectionRadius:ti=20,isValidConnection:ni,onError:Ot,style:Z,id:ne,nodeDragThreshold:fe,...ge},ve)=>{const ye=ne||"1";return oe.createElement("div",{...ge,style:{...Z,...kM},ref:ve,className:$t(["react-flow",o]),"data-testid":"rf__wrapper",id:ne},oe.createElement(FE,null,oe.createElement(vM,{onInit:h,onMove:p,onMoveStart:m,onMoveEnd:v,onNodeClick:c,onEdgeClick:d,onNodeMouseEnter:N,onNodeMouseMove:E,onNodeMouseLeave:k,onNodeContextMenu:j,onNodeDoubleClick:I,nodeTypes:u,edgeTypes:l,connectionLineType:G,connectionLineStyle:M,connectionLineComponent:B,connectionLineContainerStyle:ae,selectionKeyCode:W,selectionOnDrag:ee,selectionMode:se,deleteKeyCode:z,multiSelectionKeyCode:pe,panActivationKeyCode:ce,zoomActivationKeyCode:me,onlyRenderVisibleElements:je,selectNodesOnDrag:Me,defaultViewport:lt,translateExtent:At,minZoom:Ke,maxZoom:yt,preventScrolling:Xe,zoomOnScroll:Wt,zoomOnPinch:Je,zoomOnDoubleClick:ot,panOnScroll:Ve,panOnScrollSpeed:wt,panOnScrollMode:ct,panOnDrag:rn,onPaneClick:ht,onPaneMouseEnter:It,onPaneMouseMove:dn,onPaneMouseLeave:Vn,onPaneScroll:Cn,onPaneContextMenu:Mt,onSelectionContextMenu:H,onSelectionStart:re,onSelectionEnd:X,onEdgeContextMenu:pn,onEdgeDoubleClick:Xr,onEdgeMouseEnter:Qr,onEdgeMouseMove:Ai,onEdgeMouseLeave:Pt,onReconnect:er??Jn,onReconnectStart:Tn??Rn,onReconnectEnd:Ii??sn,reconnectRadius:mn??tr,defaultMarkerColor:Ze,noDragClassName:Gt,noWheelClassName:Es,noPanClassName:Zr,elevateEdgesOnSelect:_r,rfId:ye,disableKeyboardA11y:Sr,nodeOrigin:_e,nodeExtent:Ct}),oe.createElement(hI,{nodes:e,edges:n,defaultNodes:i,defaultEdges:s,onConnect:x,onConnectStart:C,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:b,nodesDraggable:ke,nodesConnectable:De,nodesFocusable:xe,edgesFocusable:He,edgesUpdatable:st,elementsSelectable:vt,elevateNodesOnSelect:ei,minZoom:Ke,maxZoom:yt,nodeExtent:Ct,onNodesChange:nr,onEdgesChange:xr,snapToGrid:Pe,snapGrid:ze,connectionMode:$,translateExtent:At,connectOnClick:Jr,defaultEdgeOptions:St,fitView:jn,fitViewOptions:Mi,onNodesDelete:F,onEdgesDelete:q,onNodeDragStart:P,onNodeDrag:D,onNodeDragStop:A,onSelectionDrag:T,onSelectionDragStart:K,onSelectionDragStop:Y,noPanClassName:Zr,nodeOrigin:_e,rfId:ye,autoPanOnConnect:Oi,autoPanOnNodeDrag:Ge,onError:Ot,connectionRadius:ti,isValidConnection:ni,nodeDragThreshold:fe}),oe.createElement(fI,{onSelectionChange:Q}),hn,oe.createElement(DA,{proOptions:Pi,position:rr}),oe.createElement(yI,{rfId:ye,disableKeyboardA11y:Sr})))});zE.displayName="ReactFlow";const EM=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function BE(){return Ue(EM,Et)}const UE=({id:e,x:n,y:i,width:s,height:o,style:u,color:l,strokeColor:c,strokeWidth:d,className:h,borderRadius:p,shapeRendering:m,onClick:v,selected:x})=>{const{background:C,backgroundColor:_}=u||{},S=l||C||_;return oe.createElement("rect",{className:$t(["react-flow__minimap-node",{selected:x},h]),x:n,y:i,rx:p,ry:p,width:s,height:o,fill:S,stroke:c,strokeWidth:d,shapeRendering:m,onClick:v?b=>v(b,e):void 0})};UE.displayName="MiniMapNode";var NM=O.memo(UE);const CM=e=>e.nodeOrigin,RM=e=>e.getNodes().filter(n=>!n.hidden&&n.width&&n.height),Lc=e=>e instanceof Function?e:()=>e;function TM({nodeStrokeColor:e="transparent",nodeColor:n="#e2e2e2",nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:o=2,nodeComponent:u=NM,onClick:l}){const c=Ue(RM,Et),d=Ue(CM),h=Lc(n),p=Lc(e),m=Lc(i),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return oe.createElement(oe.Fragment,null,c.map(x=>{const{x:C,y:_}=ki(x,d).positionAbsolute;return oe.createElement(u,{key:x.id,x:C,y:_,width:x.width,height:x.height,style:x.style,selected:x.selected,className:m(x),color:h(x),borderRadius:s,strokeColor:p(x),strokeWidth:o,shapeRendering:v,onClick:l,id:x.id})}))}var jM=O.memo(TM);const AM=200,IM=150,MM=e=>{const n=e.getNodes(),i={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:i,boundingRect:n.length>0?BA(ku(n,e.nodeOrigin),i):i,rfId:e.rfId}},PM="react-flow__minimap-desc";function HE({style:e,className:n,nodeStrokeColor:i="transparent",nodeColor:s="#e2e2e2",nodeClassName:o="",nodeBorderRadius:u=5,nodeStrokeWidth:l=2,nodeComponent:c,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:h="none",maskStrokeWidth:p=1,position:m="bottom-right",onClick:v,onNodeClick:x,pannable:C=!1,zoomable:_=!1,ariaLabel:S="React Flow mini map",inversePan:b=!1,zoomStep:N=10,offsetScale:E=5}){const k=Nt(),j=O.useRef(null),{boundingRect:I,viewBB:P,rfId:D}=Ue(MM,Et),A=(e==null?void 0:e.width)??AM,F=(e==null?void 0:e.height)??IM,q=I.width/A,Q=I.height/F,K=Math.max(q,Q),T=K*A,Y=K*F,H=E*K,re=I.x-(T-I.width)/2-H,X=I.y-(Y-I.height)/2-H,$=T+H*2,G=Y+H*2,M=`${PM}-${D}`,B=O.useRef(0);B.current=K,O.useEffect(()=>{if(j.current){const W=bn(j.current),ee=pe=>{const{transform:me,d3Selection:Pe,d3Zoom:ze}=k.getState();if(pe.sourceEvent.type!=="wheel"||!Pe||!ze)return;const je=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*N,Me=me[2]*Math.pow(2,je);ze.scaleTo(Pe,Me)},se=pe=>{const{transform:me,d3Selection:Pe,d3Zoom:ze,translateExtent:je,width:Me,height:ke}=k.getState();if(pe.sourceEvent.type!=="mousemove"||!Pe||!ze)return;const De=B.current*Math.max(1,me[2])*(b?-1:1),xe={x:me[0]-pe.sourceEvent.movementX*De,y:me[1]-pe.sourceEvent.movementY*De},_e=[[0,0],[Me,ke]],He=mr.translate(xe.x,xe.y).scale(me[2]),st=ze.constrain()(He,_e,je);ze.transform(Pe,st)},ce=Zk().on("zoom",C?se:null).on("zoom.wheel",_?ee:null);return W.call(ce),()=>{W.on("zoom",null)}}},[C,_,b,N]);const ae=v?W=>{const ee=Dn(W);v(W,{x:ee[0],y:ee[1]})}:void 0,z=x?(W,ee)=>{const se=k.getState().nodeInternals.get(ee);x(W,se)}:void 0;return oe.createElement(Mg,{position:m,style:e,className:$t(["react-flow__minimap",n]),"data-testid":"rf__minimap"},oe.createElement("svg",{width:A,height:F,viewBox:`${re} ${X} ${$} ${G}`,role:"img","aria-labelledby":M,ref:j,onClick:ae},S&&oe.createElement("title",{id:M},S),oe.createElement(jM,{onClick:z,nodeColor:s,nodeStrokeColor:i,nodeBorderRadius:u,nodeClassName:o,nodeStrokeWidth:l,nodeComponent:c}),oe.createElement("path",{className:"react-flow__minimap-mask",d:`M${re-H},${X-H}h${$+H*2}v${G+H*2}h${-$-H*2}z
|
|
57
|
+
M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fill:d,fillRule:"evenodd",stroke:h,strokeWidth:p,pointerEvents:"none"})))}HE.displayName="MiniMap";var OM=O.memo(HE);function qM(){return oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},oe.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function LM(){return oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},oe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function $M(){return oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},oe.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 DM(){return oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},oe.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 FM(){return oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},oe.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 fs=({children:e,className:n,...i})=>oe.createElement("button",{type:"button",className:$t(["react-flow__controls-button",n]),...i},e);fs.displayName="ControlButton";const zM=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),VE=({style:e,showZoom:n=!0,showFitView:i=!0,showInteractive:s=!0,fitViewOptions:o,onZoomIn:u,onZoomOut:l,onFitView:c,onInteractiveChange:d,className:h,children:p,position:m="bottom-left"})=>{const v=Nt(),[x,C]=O.useState(!1),{isInteractive:_,minZoomReached:S,maxZoomReached:b}=Ue(zM,Et),{zoomIn:N,zoomOut:E,fitView:k}=Io();if(O.useEffect(()=>{C(!0)},[]),!x)return null;const j=()=>{N(),u==null||u()},I=()=>{E(),l==null||l()},P=()=>{k(o),c==null||c()},D=()=>{v.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),d==null||d(!_)};return oe.createElement(Mg,{className:$t(["react-flow__controls",h]),position:m,style:e,"data-testid":"rf__controls"},n&&oe.createElement(oe.Fragment,null,oe.createElement(fs,{onClick:j,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},oe.createElement(qM,null)),oe.createElement(fs,{onClick:I,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},oe.createElement(LM,null))),i&&oe.createElement(fs,{className:"react-flow__controls-fitview",onClick:P,title:"fit view","aria-label":"fit view"},oe.createElement($M,null)),s&&oe.createElement(fs,{className:"react-flow__controls-interactive",onClick:D,title:"toggle interactivity","aria-label":"toggle interactivity"},_?oe.createElement(FM,null):oe.createElement(DM,null)),p)};VE.displayName="Controls";var BM=O.memo(VE),zn;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(zn||(zn={}));function UM({color:e,dimensions:n,lineWidth:i}){return oe.createElement("path",{stroke:e,strokeWidth:i,d:`M${n[0]/2} 0 V${n[1]} M0 ${n[1]/2} H${n[0]}`})}function HM({color:e,radius:n}){return oe.createElement("circle",{cx:n,cy:n,r:n,fill:e})}const VM={[zn.Dots]:"#91919a",[zn.Lines]:"#eee",[zn.Cross]:"#e2e2e2"},WM={[zn.Dots]:1,[zn.Lines]:1,[zn.Cross]:6},GM=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function WE({id:e,variant:n=zn.Dots,gap:i=20,size:s,lineWidth:o=1,offset:u=2,color:l,style:c,className:d}){const h=O.useRef(null),{transform:p,patternId:m}=Ue(GM,Et),v=l||VM[n],x=s||WM[n],C=n===zn.Dots,_=n===zn.Cross,S=Array.isArray(i)?i:[i,i],b=[S[0]*p[2]||1,S[1]*p[2]||1],N=x*p[2],E=_?[N,N]:b,k=C?[N/u,N/u]:[E[0]/u,E[1]/u];return oe.createElement("svg",{className:$t(["react-flow__background",d]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:h,"data-testid":"rf__background"},oe.createElement("pattern",{id:m+e,x:p[0]%b[0],y:p[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`},C?oe.createElement(HM,{color:v,radius:N/u}):oe.createElement(UM,{dimensions:E,color:v,lineWidth:o})),oe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}WE.displayName="Background";var YM=O.memo(WE);function GE(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function YE(e,n=0){if(!e||typeof e!="object"||n>6)return null;const i=e;if(typeof i.input_tokens=="number"||typeof i.output_tokens=="number"||typeof i.cache_read_input_tokens=="number"||typeof i.cache_creation_input_tokens=="number")return{inputTokens:Number(i.input_tokens??0),outputTokens:Number(i.output_tokens??0),cacheReadTokens:Number(i.cache_read_input_tokens??0),cacheCreateTokens:Number(i.cache_creation_input_tokens??0)};for(const s of Object.values(i)){const o=YE(s,n+1);if(o)return o}return null}function KM(e,n){e.inputTokens+=n.inputTokens,e.outputTokens+=n.outputTokens,e.cacheReadTokens+=n.cacheReadTokens,e.cacheCreateTokens+=n.cacheCreateTokens}const XM=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function KE(e,n=0){if(!e||typeof e!="object"||n>6)return null;const i=e;if(typeof i.model=="string"&&XM.test(i.model))return i.model;for(const s of Object.values(i)){const o=KE(s,n+1);if(o)return o}return null}function xg(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,totalEvents:0}}function Yr(e){if(!e)return;const n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n[n.length-1]}function Hg(e,n){return`${e}::${n}`}function mu(e){return e.agent_type??e.subagent_type??"subagent"}function _g(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function vo(e,n,i,s){const o=n;let u=e.agents.get(o);return u||(u={id:o,sessionId:n,label:"session",kind:"root",state:"active",startedAt:i,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,inFlightTool:null,usage:GE()},e.agents.set(o,u),u)}function XE(e,n,i,s){const o=Hg(n,i),u=e.agents.get(o);if(!u)return null;!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=Yr(s.cwd));const l=mu(s);return l&&(u.label==="subagent"||!u.label)&&(u.label=l),u}function Dw(e,n,i){const s=n.session_id??"unknown",o=_g(n);if(o){const d=XE(e,s,o,n);if(d)return d}const u=e.activeSubagentStack.get(s),l=u&&u.length>0?u[u.length-1]:null;if(l){const d=e.agents.get(Hg(s,l));if(d)return!d.cwd&&n.cwd&&(d.cwd=n.cwd,d.cwdBasename=Yr(n.cwd)),d}const c=vo(e,s,i,!1);return c.synthetic&&(c.synthetic=!1,c.startedAt=i),!c.cwd&&n.cwd&&(c.cwd=n.cwd,c.cwdBasename=Yr(n.cwd)),c.label==="session"&&n.cwd&&(c.label=Yr(n.cwd)??"session"),c}function QM(e,n,i,s,o){const u=Hg(n,i),l=vo(e,n,o,!0);let c=e.agents.get(u);if(c){!c.cwd&&s.cwd&&(c.cwd=s.cwd,c.cwdBasename=Yr(s.cwd));const d=mu(s);return d&&(c.label==="subagent"||!c.label)&&(c.label=d),c}return c={id:u,sessionId:n,label:mu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:o,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Yr(s.cwd),toolCount:0,childCount:0,inFlightTool:null,usage:GE()},e.agents.set(u,c),l.childCount+=1,c}function ZM(e,n,i){const s=e.activeSubagentStack.get(n)??[];s.push(i),e.activeSubagentStack.set(n,s)}function JM(e,n,i){const s=e.activeSubagentStack.get(n);if(s){for(let o=s.length-1;o>=0;o--)if(s[o]===i){s.splice(o,1);break}s.length===0&&e.activeSubagentStack.delete(n)}}function $c(e,n=80){if(e==null)return"";if(typeof e=="string")return e.length>n?e.slice(0,n-1)+"…":e;try{const i=JSON.stringify(e);return i.length>n?i.slice(0,n-1)+"…":i}catch{return String(e)}}function ho(e){let n=null;for(let i=e.tools.length-1;i>=0;i--){const s=e.tools[i];if(s.endedAt==null){n=s;break}}e.inFlightTool=n}function eP(e,n,i,s){if(e.agents.size<=i)return!1;const o=[];for(const[l,c]of e.agents)c.state==="done"&&c.endedAt!=null&&n-c.endedAt>s&&o.push({id:l,endedAt:c.endedAt});if(o.length===0)return!1;o.sort((l,c)=>l.endedAt-c.endedAt);let u=0;for(const l of o){if(e.agents.size<=i)break;e.agents.delete(l.id),u++}return u>0}function tP(e,n,i,s){const o=new Map;for(const[h,p]of e.agents){let m=o.get(p.sessionId);m||(m={ids:[],endedAt:0,live:!1},o.set(p.sessionId,m)),m.ids.push(h),p.state==="done"&&p.endedAt!=null?m.endedAt=Math.max(m.endedAt,p.endedAt):m.live=!0}const u=[...o.values()].filter(h=>!h.live&&h.endedAt>0&&n-h.endedAt>s).sort((h,p)=>h.endedAt-p.endedAt);let c=[...o.values()].filter(h=>!h.live).length-i;if(c<=0)return!1;let d=!1;for(const h of u){if(c<=0)break;for(const p of h.ids)e.agents.delete(p);c--,d=!0}return d}function nP(e,n,i){let s=!1;for(const o of e.agents.values()){let u=!1;for(const l of o.tools)l.endedAt==null&&n-l.startedAt>i&&(l.endedAt=l.startedAt+i,l.ok=!1,l.errorPreview="stale (no PostToolUse received)",e.toolIndex.delete(l.id),e.toolOwner.delete(l.id),u=!0,s=!0);u&&ho(o)}return s}function Fw(e,n){if(n.seq<=e.lastSeq)return e;const i=n.payload??{},s=n.receivedAt,o=i.hook_event_name??"Unknown";if(o==="__clear")return{...xg(),lastSeq:n.seq};e.totalEvents+=1,e.lastSeq=n.seq;const u=i.session_id??"unknown";if(o==="ModelObserved"){const d=typeof i.model=="string"?i.model:null;if(d){const p=e.agents.get(u);p&&(p.model=d)}const h=i.subagentModels;if(h&&typeof h=="object")for(const[p,m]of Object.entries(h)){if(typeof m!="string")continue;const v=`${u}::${p}`,x=e.agents.get(v);x&&(x.model=m)}return e}if(o==="ContextObserved"){const d=i.context??null;if(d){const h=e.agents.get(u);h&&(h.context={msgsUser:Number(d.msgsUser??0),msgsAssistant:Number(d.msgsAssistant??0),toolUses:Number(d.toolUses??0),toolResults:Number(d.toolResults??0),systemReminders:Number(d.systemReminders??0),currentContextTokens:Number(d.currentContextTokens??0),claudeMdFiles:Array.isArray(d.claudeMdFiles)?d.claudeMdFiles:[]})}return e}if(o==="UsageObserved"){const d=i.usage??null;if(d){const h=e.agents.get(u);h&&(h.usage.inputTokens=Number(d.input_tokens??0),h.usage.outputTokens=Number(d.output_tokens??0),h.usage.cacheReadTokens=Number(d.cache_read_input_tokens??d.cached_input_tokens??0),h.usage.cacheCreateTokens=Number(d.cache_creation_input_tokens??0),typeof d.reasoning_output_tokens=="number"&&(h.usage.reasoningOutputTokens=Number(d.reasoning_output_tokens)))}return e}const l=Dw(e,i,s);l.provider||(l.provider=i.provider==="codex"?"codex":"claude"),typeof i.model_context_window=="number"&&i.model_context_window>0&&(l.contextWindow=i.model_context_window);const c=KE(i);switch(c&&(l.model=c),o){case"SessionStart":{const d=vo(e,u,s,!1);d.synthetic=!1,d.state="active",d.startedAt=d.startedAt||s,!d.cwd&&i.cwd&&(d.cwd=i.cwd,d.cwdBasename=Yr(i.cwd)),d.label==="session"&&i.cwd&&(d.label=Yr(i.cwd)??"session");break}case"UserPromptSubmit":{for(const m of e.agents.values())m.sessionId===u&&m.kind==="subagent"&&m.state==="done"&&m.exitAt==null&&m.endedAt!=null&&m.endedAt<s&&(m.exitAt=s);const d=vo(e,u,s,!1);d.state="active",d.endedAt=void 0,d.exitAt=void 0;const h=Dw(e,i,s);h.state="active",h.exitAt=void 0,h.endedAt=void 0;const p=(typeof i.prompt=="string"?i.prompt:typeof i.message=="string"?i.message:"")??"";p&&(h.prompts.push({at:s,text:p}),h.firstPrompt||(h.firstPrompt=$c(p,120)));break}case"PreToolUse":{const d=i.tool_use_id??`${l.id}:${l.toolCount}`,h={id:d,name:i.tool_name??"?",input:i.tool_input,inputPreview:$c(i.tool_input),agentId:l.id,startedAt:s};l.tools.push(h),l.toolCount+=1,l.state="active",e.toolIndex.set(d,h),e.toolOwner.set(d,l.id),ho(l);break}case"PostToolUse":case"PostToolUseFailure":{const d=i.tool_use_id;if(!d)break;let h=e.toolIndex.get(d),p=!1;if(!h)for(const x of e.agents.values()){const C=x.tools.find(_=>_.id===d);if(C){h=C,p=!0;break}}if(!h)break;h.endedAt=s,h.ok=o==="PostToolUse",h.response=i.tool_response,o==="PostToolUseFailure"?h.errorPreview=$c(i.tool_response):p&&(h.errorPreview=void 0);const m=YE(i.tool_response);m&&(h.usage=m),e.toolIndex.delete(d);const v=e.toolOwner.get(d)??h.agentId;if(e.toolOwner.delete(d),v){const x=e.agents.get(v);x&&(m&&KM(x.usage,m),ho(x))}break}case"SubagentStart":{const d=_g(i);if(!d)break;const h=QM(e,u,d,i,s);h.state="active",h.startedAt=h.startedAt||s,h.exitAt=void 0,h.endedAt=void 0;const p=mu(i);p&&(h.label=p),ZM(e,u,d);break}case"SubagentStop":{const d=_g(i);if(!d)break;const h=XE(e,u,d,i);if(!h)break;h.state="done",h.endedAt=s,ho(h),JM(e,u,d);break}case"Stop":case"SessionEnd":{const d=vo(e,u,s,!1);d.state="done",d.endedAt=s,ho(d);break}}return e}function Vg(e){let n=5381;for(let i=0;i<e.length;i++)n=(n<<5)+n^e.charCodeAt(i);return Math.abs(n)%360}const rP=Date.UTC(2026,8,1);function iP(){return Date.now()<rP?{input:2,output:10,cacheRead:.2,cacheWrite:2.5}:{input:3,output:15,cacheRead:.3,cacheWrite:3.75}}const sP=[{match:/^claude[-_](fable|mythos)[-_]5\b/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5}},{match:/^claude[-_]opus[-_]5\b/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25}},{match:/^claude[-_]sonnet[-_]5\b/i,rates:iP()},{match:/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25}},{match:/^claude[-_]opus[-_]4(?:[-_.]1)?\b/i,rates:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75}},{match:/^claude[-_]sonnet[-_]4[-_.](?:5|6)\b/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75}},{match:/^claude[-_]sonnet[-_]4\b/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75}},{match:/^claude[-_]haiku[-_]4[-_.]5\b/i,rates:{input:1,output:5,cacheRead:.1,cacheWrite:1.25}},{match:/^claude[-_]haiku[-_]3[-_.]5\b/i,rates:{input:.8,output:4,cacheRead:.08,cacheWrite:1}},{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:/^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 oP(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Wg(e){if(!e)return null;for(const n of sP)if(n.match.test(e))return n.rates;return null}const aP=272e3,uP=/^gpt[-_]5[-_.](?:6(?![-_]cyber)|5|4)/i;function lP(e,n){return!e||n<=aP?{input:1,output:1}:uP.test(e)?{input:2,output:1.5}:{input:1,output:1}}function tn(e,n){const i=Wg(n);if(!i)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const s=oP(n),o=s?Math.max(0,e.inputTokens-e.cacheReadTokens):e.inputTokens,u=s?lP(n,e.inputTokens):{input:1,output:1},l=o*i.input*u.input/1e6,c=e.outputTokens*i.output*u.output/1e6,d=e.cacheReadTokens*i.cacheRead*u.input/1e6,h=e.cacheCreateTokens*i.cacheWrite*u.input/1e6;return{input:l,output:c,cacheRead:d,cacheWrite:h,total:l+c+d+h}}const zw=2e5,cP=1e6,fP=[/\[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],dP=[{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 QE(e){if(!e)return zw;for(const n of fP)if(n.test(e))return cP;for(const n of dP)if(n.match.test(e))return n.window;return zw}function $e(e){return e<=0?"—":e<.005?"<1¢":e<1?`${(e*100).toFixed(e<.1?1:0)}¢`:e<100?`$${e.toFixed(2)}`:e<1e4?`$${e.toFixed(0)}`:`$${(e/1e3).toFixed(1)}k`}function gu(e,n){if(e<=0||n<10)return null;const i=e/n,s=i*60;return s>=.01?`${$e(s)}/min`:`${$e(i*3600)}/hr`}function Sn(e){return e.toLocaleString()}function hP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function pP({agent:e,onClose:n}){var h;const i=e.context,s=e.usage,o=(i==null?void 0:i.currentContextTokens)??0,u=QE(e.model),l=Math.min(100,o/u*100),c=tn(s,e.model),d=s.inputTokens+s.cacheReadTokens+s.cacheCreateTokens;return y.jsx("div",{className:"ctx-modal-backdrop",onClick:n,role:"presentation",children:y.jsxs("div",{className:"ctx-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-label":"Context breakdown",children:[y.jsxs("header",{className:"ctx-modal-head",children:[y.jsxs("div",{children:[y.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),y.jsx("div",{className:"ctx-modal-sub",children:"approximation — CC's /context isn't hook-exposed"})]}),y.jsx("button",{className:"ctx-modal-close",onClick:n,"aria-label":"Close",children:"×"})]}),y.jsxs("section",{className:"ctx-window-row",children:[y.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(l),children:y.jsx("div",{className:"ctx-window-fill",style:{width:`${l}%`}})}),y.jsxs("div",{className:"ctx-window-meta",children:[y.jsxs("span",{className:"ctx-window-pct",children:[l.toFixed(1),"%"]}),y.jsxs("span",{className:"ctx-window-num",children:[Sn(o)," / ",Sn(u)," tok (current turn)"]})]})]}),y.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),y.jsxs("div",{className:"ctx-grid",children:[y.jsx($n,{label:"input tokens",val:Sn(s.inputTokens)}),y.jsx($n,{label:"output tokens",val:Sn(s.outputTokens)}),y.jsx($n,{label:"cache reads",val:Sn(s.cacheReadTokens)}),y.jsx($n,{label:"cache writes",val:Sn(s.cacheCreateTokens)}),y.jsx($n,{label:"cumulative total",val:Sn(d)}),y.jsx($n,{label:"estimated cost",val:$e(c.total),accent:!0})]}),y.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),y.jsxs("div",{className:"ctx-grid",children:[y.jsx($n,{label:"user messages",val:Sn((i==null?void 0:i.msgsUser)??0)}),y.jsx($n,{label:"assistant messages",val:Sn((i==null?void 0:i.msgsAssistant)??0)}),y.jsx($n,{label:"tool uses",val:Sn((i==null?void 0:i.toolUses)??0)}),y.jsx($n,{label:"tool results",val:Sn((i==null?void 0:i.toolResults)??0)}),y.jsx($n,{label:"system-reminders",val:Sn((i==null?void 0:i.systemReminders)??0)})]}),y.jsx("h3",{className:"ctx-section-title",children:"CLAUDE.md files in scope"}),(((h=i==null?void 0:i.claudeMdFiles)==null?void 0:h.length)??0)===0?y.jsx("div",{className:"ctx-empty",children:"No CLAUDE.md files found on the path from cwd to ~/.claude."}):y.jsx("ul",{className:"ctx-md-list",children:i.claudeMdFiles.map(p=>y.jsxs("li",{children:[y.jsx("span",{className:"ctx-md-path",title:p.path,children:p.path}),y.jsx("span",{className:"ctx-md-size",children:hP(p.bytes)})]},p.path))})]})})}function $n({label:e,val:n,accent:i}){return y.jsxs("div",{className:`ctx-row${i?" accent":""}`,children:[y.jsx("span",{className:"ctx-row-label",children:e}),y.jsx("span",{className:"ctx-row-val",children:n})]})}function mP({currentContextTokens:e,modelId:n,size:i=26,onClick:s,title:o}){const u=QE(n),l=Math.min(1,e/u),c=i/2-3,d=i/2,h=2*Math.PI*c,p=h*l,m=l>.9?"var(--err)":l>.7?"var(--inflight)":"var(--accent)";return y.jsx("button",{type:"button",className:"ctx-donut",onClick:s,title:o??`context: ${e.toLocaleString()} / ${u.toLocaleString()} (${(l*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:y.jsxs("svg",{width:i,height:i,viewBox:`0 0 ${i} ${i}`,children:[y.jsx("circle",{cx:d,cy:d,r:c,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),y.jsx("circle",{cx:d,cy:d,r:c,stroke:m,strokeWidth:"2.5",fill:"none",strokeDasharray:`${p} ${h-p}`,strokeDashoffset:h/4,strokeLinecap:"round",style:{transition:"stroke-dasharray 400ms ease"}}),y.jsx("text",{x:d,y:d+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(l*100)})]})})}function gP(e,n){const i=Wg(n);if(!i)return"no rates for this model";const s=l=>l.toLocaleString(),o=l=>`$${l}/MTok`,u=tn(e,n);return[`model: ${n}`,`input ${s(e.inputTokens).padStart(14)} × ${o(i.input).padEnd(11)} = ${$e(u.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${o(i.output).padEnd(11)} = ${$e(u.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${o(i.cacheRead).padEnd(11)} = ${$e(u.cacheRead)}`,`cache w ${s(e.cacheCreateTokens).padStart(14)} × ${o(i.cacheWrite).padEnd(11)} = ${$e(u.cacheWrite)}`,"─────────────────────────────────────────",`total = ${$e(u.total)}`].join(`
|
|
58
|
+
`)}function vP(e,n,i){const s=(n??i)-e;if(s<1e3)return`${Math.max(0,s)}ms`;const o=Math.floor(s/1e3);if(o<60)return`${o}s`;const u=Math.floor(o/60),l=o%60;return`${u}m ${String(l).padStart(2,"0")}s`}function yP({data:e,selected:n}){var h;const i=e.now??Date.now(),s=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",n?"selected":""].filter(Boolean).join(" "),o=e.tools.filter(p=>!p.endedAt).length,l=`hsl(${Vg(e.sessionId)} 70% 60%)`,c=((h=e.context)==null?void 0:h.currentContextTokens)??0,d=e.kind==="root"&&c>0;return y.jsxs("div",{className:s,style:{"--accent":l},children:[y.jsx("span",{className:"accent-stripe"}),y.jsx(ws,{type:"target",position:Ce.Left,style:{background:"transparent",border:"none"}}),y.jsxs("div",{className:"head",children:[y.jsxs("div",{className:"title",children:[y.jsx(wP,{state:e.state}),y.jsx("span",{className:"label",title:e.cwd,children:e.label}),e.synthetic&&y.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),y.jsxs("div",{className:"head-right",children:[d&&e.onOpenContext&&y.jsx(mP,{currentContextTokens:c,modelId:e.model,onClick:()=>e.onOpenContext(e.sessionId)}),y.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:vP(e.startedAt,e.endedAt,i)})]})]}),y.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&y.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model&&y.jsx("span",{className:"model-chip",title:e.model,children:Mo(e.model)})]}),e.tools.length>0&&y.jsx(_P,{tools:e.tools,now:i}),y.jsxs("div",{className:"meta",children:[y.jsxs("span",{children:[y.jsx("b",{children:e.toolCount})," tools"]}),o>0&&y.jsxs("span",{className:"inflight-meta",children:[y.jsx("b",{children:o})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&y.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:[y.jsx("b",{children:xP(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&Wg(e.model)&&(()=>{const p=tn(e.usage,e.model);if(p.total<=0)return null;const m=Math.max(0,((e.endedAt??i)-e.startedAt)/1e3),v=e.state==="active"?gu(p.total,m):null,x=gP(e.usage,e.model)+(v?`
|
|
59
|
+
burn: ${v}`:"");return y.jsxs("span",{className:"cost-meta",title:x,children:[y.jsx("b",{children:$e(p.total)}),v&&y.jsx("span",{className:"cost-rate",children:v})]})})()]}),y.jsx(ws,{type:"source",position:Ce.Right,style:{background:"transparent",border:"none"}})]})}function wP({state:e}){const n=e==="active"?"live":e==="done"?"done":"err";return y.jsx("span",{className:`state-pill state-${e}`,children:n})}function xP(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(2)}M`}function _P({tools:e,now:n}){const u=new Array(24).fill(0);let l=0;for(const v of e){const x=n-v.startedAt;if(x<0||x>=6e4)continue;const C=23-Math.floor(x/2500);C>=0&&C<24&&(u[C]+=1,l+=1)}const c=Math.max(1,...u),d=132,h=14,p=d/24,m=c/(2500/1e3);return y.jsxs("div",{className:"tool-spark-row",title:`${l} tool calls in last 60s · peak ${m.toFixed(1)}/s`,children:[y.jsx("svg",{className:"tool-spark",width:d,height:h,viewBox:`0 0 ${d} ${h}`,"aria-hidden":!0,children:u.map((v,x)=>{const C=v===0?1.5:Math.max(1.5,v/c*h),_=x===23&&v>0,b=`tool-spark-bar${v>0?" active":""}${_?" latest":""}`;return y.jsx("rect",{x:x*p+.4,y:h-C,width:Math.max(.5,p-1),height:C,rx:.8,className:b},x)})}),y.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function Mo(e){const n=e.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const o=n[1][0].toUpperCase()+n[1].slice(1).toLowerCase(),u=n[2].replace(/[-_]/g,".");return`${o} ${u}`}const i=e.match(/^gpt[-_](\d+(?:[-_.]\d+)*)[-_]codex\b/i);if(i)return`GPT-${i[1].replace(/[-_]/g,".")} Codex`;const s=e.match(/^gpt[-_](\d+(?:[-_.]\d+)*)/i);return s?`GPT-${s[1].replace(/[-_]/g,".")}`:e}function Bw(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function SP(e){if(e.endedAt==null)return"in-flight…";const n=e.endedAt-e.startedAt;return n<1e3?`${n}ms`:`${(n/1e3).toFixed(2)}s`}function bP({tool:e,onClose:n}){O.useEffect(()=>{const s=o=>{o.key==="Escape"&&n()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n]);const i=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return y.jsx("div",{className:"modal-backdrop",onClick:n,role:"dialog","aria-modal":"true",children:y.jsxs("div",{className:"modal",onClick:s=>s.stopPropagation(),children:[y.jsxs("header",{className:"modal-head",children:[y.jsxs("div",{className:"modal-title",children:[y.jsx("span",{className:`status-dot ${i}`}),y.jsx("span",{className:"modal-tool-name",children:e.name}),y.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),y.jsxs("div",{className:"modal-actions",children:[y.jsx("span",{className:"modal-dur",children:SP(e)}),y.jsx("button",{className:"btn icon-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),y.jsxs("section",{className:"modal-body",children:[y.jsxs("div",{className:"modal-section",children:[y.jsx("h4",{children:"Input"}),y.jsx("pre",{children:Bw(e.input??e.inputPreview)})]}),y.jsxs("div",{className:"modal-section",children:[y.jsxs("h4",{children:["Response ",i==="err"&&y.jsx("span",{className:"err-tag",children:"error"})]}),y.jsx("pre",{children:e.endedAt==null?"(waiting…)":Bw(e.response??e.errorPreview)})]})]})]})})}const Qa=18,Uw=26,kP=12;function EP(e){const n=new Map;for(const o of e.nodeInternals.values()){const u=o.data;if(!(u!=null&&u.sessionId)||u.exitAt!=null||o.width==null||o.height==null)continue;const l=o.position.x,c=o.position.y,d=l+o.width,h=c+o.height,p=n.get(u.sessionId);p?(p.minX=Math.min(p.minX,l),p.minY=Math.min(p.minY,c),p.maxX=Math.max(p.maxX,d),p.maxY=Math.max(p.maxY,h),u.kind==="root"&&(p.label=Hw(u)??p.label)):n.set(u.sessionId,{minX:l,minY:c,maxX:d,maxY:h,label:Hw(u)??u.sessionId})}const i=new Map;for(const o of n.values())i.set(o.label,(i.get(o.label)??0)+1);const s=[];for(const[o,u]of n){const c=(i.get(u.label)??0)>1?`${u.label} · ${NP(o)}`:u.label;s.push({sessionId:o,label:c,x:u.minX-Qa,y:u.minY-Qa-Uw,w:u.maxX-u.minX+Qa*2,h:u.maxY-u.minY+Qa*2+Uw})}return s}function NP(e){const n=e.match(/[a-zA-Z0-9]{4}/);return n?n[0]:e.slice(0,4)}function Hw(e){if(e.kind==="root")return e.label}function CP(){const{x:e,y:n,zoom:i}=BE(),s=Io(),o=Ue(EP,RP);if(o.length<=1)return null;const u=l=>{try{const c=s.getNodes().filter(d=>{const h=d.data;return(h==null?void 0:h.sessionId)===l});if(c.length===0)return;s.fitView({padding:.3,duration:500,nodes:c})}catch{}};return y.jsx("div",{className:"session-clusters",children:o.map(l=>{const c=Vg(l.sessionId),d={position:"absolute",left:l.x*i+e,top:l.y*i+n,width:l.w*i,height:l.h*i,borderColor:`hsl(${c} 65% 55% / 0.32)`,background:`hsl(${c} 70% 50% / 0.04)`},h={position:"absolute",left:l.x*i+e+16*i,top:(l.y-kP)*i+n,color:`hsl(${c} 70% 78%)`,borderColor:`hsl(${c} 65% 55% / 0.5)`,transform:`scale(${Math.min(1,i)})`,transformOrigin:"left top"};return y.jsxs(oe.Fragment,{children:[y.jsx("div",{className:"cluster-card",style:d,"aria-hidden":!0}),y.jsx("button",{type:"button",className:"cluster-label",style:h,title:`Fit view to ${l.label} · drag the wrapper to move the whole session`,onClick:()=>u(l.sessionId),children:l.label})]},l.sessionId)})})}function RP(e,n){if(e.length!==n.length)return!1;for(let i=0;i<e.length;i++){const s=e[i],o=n[i];if(s.sessionId!==o.sessionId||s.label!==o.label||s.x!==o.x||s.y!==o.y||s.w!==o.w||s.h!==o.h)return!1}return!0}function TP({data:e}){return y.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const ZE=600,jP=36,Sg=16,AP=60,IP=6,Vw=220,Ww=96,MP=28,PP={Read:"file",Write:"file",Edit:"file",MultiEdit:"file",Glob:"file",Grep:"file",LS:"file",NotebookEdit:"file",Bash:"shell",PowerShell:"shell",shell:"shell",exec_command:"shell",shell_command:"shell",write_stdin:"shell",wait:"shell",apply_patch:"file",update_plan:"task",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"};function OP(e){return e.startsWith("mcp__")?"mcp":PP[e]??"other"}const qP={Read:"📖",Write:"💾",Edit:"✏️",MultiEdit:"🔧",Glob:"🗺️",Grep:"🔎",Bash:"⚡",PowerShell:"💻",shell:"⚡",exec_command:"⚡",shell_command:"⚡",write_stdin:"💻",wait:"⏳",apply_patch:"🩹",update_plan:"📋",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:"📡"};function Gw(e){return e.startsWith("mcp__")?"🔌":qP[e]??"✨"}const LP={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 JE(e){if(!e)return null;let n=e.trim();if(!n)return null;const i=n.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(i)return JE(i[1]);for(;;){const u=n.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!u)break;n=n.slice(u[0].length)}n=n.replace(/^sudo(?:\s+-\S+)*\s+/,""),n=n.replace(/^(?:time|nohup|xargs)\s+/,"");const s=n.match(/^([^\s|;&<>(]+)/);if(!s)return null;let o=s[1];return o=o.replace(/^.*[/\\]/,""),o=o.replace(/\.(exe|cmd|bat|ps1)$/i,""),o||null}function $P(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const n=e;if(typeof n.cmd=="string")return n.cmd;if(typeof n.command=="string")return n.command;if(Array.isArray(n.command)&&n.command.every(i=>typeof i=="string")){const i=n.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(i[0]??"")){const s=i.findIndex(o=>/^(-Command|-c)$/i.test(o));if(s>=0&&s+1<i.length)return i[s+1]}return i.join(" ")}return typeof n.script=="string"?n.script:null}const DP=new Set(["Bash","PowerShell","shell","exec_command","shell_command","write_stdin","wait"]),FP=new Set(["shell","exec_command","shell_command","write_stdin","wait","apply_patch","update_plan"]);function zP(e,n){return FP.has(e)?Math.max(Ww,34+n.length*7.5):Ww}function BP(e,n){if(!DP.has(e))return null;const i=$P(n);if(!i)return null;const s=JE(i);return s?{emoji:LP[s]??"⚙️",label:s,category:"shell",detail:i}:null}const UP=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),Yw={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:"🗄️"},Kw={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 HP(e){const i=e.replace(/\\/g,"/").replace(/\/+$/,""),s=i.lastIndexOf("/");return s>=0?i.slice(s+1):i}function VP(e){const n=e.toLowerCase();if(Kw[n])return Kw[n];if(n.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(n))return"🧪";const i=n.lastIndexOf(".");if(i>0&&i<n.length-1){const s=n.slice(i+1);if(Yw[s])return Yw[s]}return"📄"}function WP(e,n){if(!n||typeof n!="object")return null;const i=n;if(e==="apply_patch"&&typeof i.patch=="string"){const s=i.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return s?s[1].trim():null}return typeof i.file_path=="string"?i.file_path:typeof i.notebook_path=="string"?i.notebook_path:typeof i.path=="string"?i.path:e==="Glob"&&typeof i.pattern=="string"?i.pattern:null}function GP(e,n){if(!UP.has(e))return null;const i=WP(e,n);if(!i)return null;const s=HP(i);return s?{emoji:e==="LS"?"📂":VP(s),label:s,category:"file",detail:i}:null}const eN={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 tN(e){if(!e.startsWith("mcp__"))return null;const n=e.slice(5),i=n.indexOf("__");return i<=0?{server:n,method:""}:{server:n.slice(0,i),method:n.slice(i+2)}}function YP(e){let n=5381;for(let i=0;i<e.length;i++)n=(n<<5)+n^e.charCodeAt(i);return Math.abs(n)%360}function KP(e,n){const i=tN(e);if(!i)return null;const{server:s,method:o}=i;if(!o)return null;const u=eN[s.toLowerCase()];return{emoji:(u==null?void 0:u.emoji)??"🔌",label:o,category:"mcp",detail:u?`${u.name} · ${o}`:`${s} · ${o}`}}function XP(e,n){return BP(e,n)??GP(e,n)??KP(e)}const QP={shell:"Shell",exec_command:"Shell",shell_command:"Shell",write_stdin:"stdin",wait:"wait",apply_patch:"Edit",update_plan:"Plan"};function ZP(e){const n=tN(e);if(n){const s=eN[n.server.toLowerCase()];return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:n.server,hue:YP(n.server)}}const i=QP[e];return i?{emoji:Gw(e),label:i}:{emoji:Gw(e),label:e}}function JP(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function e3(e,n,i){if(i==null)return 1;const s=n-i;return s<0?1:Math.max(0,1-s/ZE)}function t3(e,n,i,s,o,u){const l=[];for(const c of e.values()){if(!n.has(c.id)||c.exitAt!=null&&u-c.exitAt>ZE)continue;const d=s.get(c.id)??i.get(c.id);if(!d)continue;const h=c.tools.slice(-4);if(h.length===0)continue;const p=c.exitAt??null,m=o.get(c.id),v=Math.max((m==null?void 0:m.width)??Vw,Vw),x=(m==null?void 0:m.height)??130,C=d.x,_=d.y,S=C+v,b=_+x/2;h.forEach((N,E)=>{const k=E*jP,j=C+v+AP,I=_+IP+k,P=e3(N,u,p),D=N.inputPreview??"",A=JP(N),F=P<.999,q=ZP(N.name);l.push({id:N.id,toolId:N.id,agentId:c.id,toolName:N.name,name:q.label,emoji:q.emoji,status:A,category:OP(N.name),mcpHue:q.hue,inputPreview:D,fade:P,fading:F,worldX:j,worldY:I,anchorX:S,anchorY:b,spawnDx:S-j,spawnDy:b-(I+Sg)});const Q=XP(N.name,N.input);if(Q){const K=zP(N.name,q.label),T=j+K+MP,Y=I,H=j+K,re=I+Sg;l.push({id:`sub:${N.id}`,toolId:N.id,agentId:c.id,toolName:N.name,name:Q.label,emoji:Q.emoji,isSub:!0,status:A,category:Q.category,inputPreview:Q.detail??D,fade:P,fading:F,worldX:T,worldY:Y,anchorX:H,anchorY:re,spawnDx:H-T,spawnDy:0})}})}return l}function n3({agents:e,visibleAgentIds:n,positions:i,pinned:s,measured:o,dimUnmatched:u,spotlight:l,hiddenCategories:c,now:d,onOpenTool:h}){const{x:p,y:m,zoom:v}=BE(),x=t3(e,n,i,s,o,d),C=c&&c.size>0?x.filter(_=>!c.has(_.category)):x;return y.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[y.jsx("svg",{className:"tool-bursts-svg",children:C.map(_=>{const S=_.anchorX*v+p,b=_.anchorY*v+m,N=(_.worldX+6)*v+p,E=(_.worldY+Sg)*v+m,k=S+(N-S)*.55,j=u!=null&&!u.has(_.agentId),I=l!=null&&!l.has(_.agentId),P=_.fade*(j||I?.14:1);return y.jsx("path",{d:`M ${S} ${b} Q ${k} ${b}, ${N} ${E}`,className:`tool-conn status-${_.status}${_.fading?" fading":""}`,opacity:P},`l:${_.id}`)})}),C.map(_=>{const S=_.worldX*v+p,b=_.worldY*v+m,N={left:`${S}px`,top:`${b}px`,transform:`scale(${v})`,transformOrigin:"left top","--spawn-dx":`${_.spawnDx}px`,"--spawn-dy":`${_.spawnDy}px`},E=_.isSub?`${_.toolName} · ${_.name}`:_.toolName,k=_.inputPreview?`${E} · ${_.inputPreview}`:E,j=h!=null,I=_.mcpHue!=null?{"--cat-accent":`hsl(${_.mcpHue} 65% 65%)`}:{},P=u!=null&&!u.has(_.agentId),D=l!=null&&!l.has(_.agentId),A=P||D?" dim":"";return y.jsx("div",{className:"tool-burst-wrap",style:N,children:y.jsxs("div",{className:`tool-burst cat-${_.category} status-${_.status}${_.fading?" fading":""}${j?" clickable":""}${_.isSub?" sub":""}${A}`,style:I,title:k,role:j?"button":void 0,tabIndex:j?0:void 0,"aria-label":j?`Open ${_.toolName} ${_.status==="inflight"?"in flight":_.status} — click for details`:void 0,onClick:j?()=>h(_.toolId):void 0,onKeyDown:j?F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),h(_.toolId))}:void 0,children:[y.jsx("span",{className:"tb-emoji",children:_.emoji}),y.jsx("span",{className:"tb-name",children:_.name}),_.status==="inflight"&&y.jsx("span",{className:"tb-spin"}),_.status==="done"&&y.jsx("span",{className:"tb-mark done",children:"✓"}),_.status==="err"&&y.jsx("span",{className:"tb-mark err",children:"×"})]})},_.id)})]})}function r3({state:e,sessionId:n,onClose:i}){const s=O.useMemo(()=>s3(e,n),[e,n]);return s?y.jsx("div",{className:"modal-backdrop",onClick:i,role:"presentation",children:y.jsxs("div",{className:"modal session-summary",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[y.jsxs("div",{className:"modal-head",children:[y.jsxs("div",{className:"modal-title",children:[y.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),y.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),y.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),y.jsxs("div",{className:"modal-actions",children:[y.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),y.jsx("button",{className:"btn",onClick:i,"aria-label":"Close",children:"×"})]})]}),y.jsxs("div",{className:"modal-body",children:[y.jsxs("section",{className:"ss-hero",children:[y.jsxs("div",{className:"ss-hero-left",children:[y.jsx("div",{className:"ss-cost-label",children:"total spend"}),y.jsx("div",{className:"ss-cost",children:$e(s.cost.total)}),s.modelChips.length>0&&y.jsx("div",{className:"ss-models",children:s.modelChips.map(o=>y.jsx("span",{className:"model-chip",title:o,children:Mo(o)},o))})]}),y.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&y.jsxs(y.Fragment,{children:[y.jsx(i3,{cost:s.cost}),y.jsxs("div",{className:"ss-cost-legend",children:[y.jsxs("span",{className:"ssl ssl-in",children:["input ",y.jsx("b",{children:$e(s.cost.input)})]}),y.jsxs("span",{className:"ssl ssl-out",children:["output ",y.jsx("b",{children:$e(s.cost.output)})]}),y.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",y.jsx("b",{children:$e(s.cost.cacheRead)})]}),y.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",y.jsx("b",{children:$e(s.cost.cacheWrite)})]})]})]})})]}),y.jsxs("section",{className:"ss-stats",children:[y.jsx(ls,{label:"agents",value:s.agentCount}),y.jsx(ls,{label:"subagents",value:s.subagentCount}),y.jsx(ls,{label:"tool calls",value:s.toolCount}),y.jsx(ls,{label:"prompts",value:s.promptCount}),y.jsx(ls,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&y.jsx(ls,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&y.jsxs("section",{className:"modal-section",children:[y.jsx("h4",{children:"Most-used tools"}),y.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([o,u])=>y.jsxs("div",{className:"ss-tt",children:[y.jsx("span",{className:"ss-tt-name",children:o}),y.jsx("span",{className:"ss-tt-bar",children:y.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/s.topTools[0][1]*100}%`}})}),y.jsx("span",{className:"ss-tt-count",children:u})]},o))})]}),s.firstPrompt&&y.jsxs("section",{className:"modal-section",children:[y.jsx("h4",{children:"Opening prompt"}),y.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function ls({label:e,value:n,tone:i}){return y.jsxs("div",{className:`ss-stat${i?` tone-${i}`:""}`,children:[y.jsx("div",{className:"ss-stat-value",children:n}),y.jsx("div",{className:"ss-stat-label",children:e})]})}function i3({cost:e}){const n=e.total;if(n<=0)return null;const i=(s,o,u)=>{if(s<=0)return null;const l=s/n*100;return y.jsx("span",{className:`cb-seg ${o}`,style:{width:`${l}%`},title:`${u}: ${$e(s)} (${l.toFixed(0)}%)`},o)};return y.jsxs("div",{className:"cost-bar cost-bar-lg","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 s3(e,n){const i=e.agents.get(n);if(!i)return null;const s=[];for(const E of e.agents.values())E.sessionId===n&&s.push(E);if(s.length===0)return null;const o={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},u=new Set,l=new Map;let c=0,d=0,h=0,p=0,m=0,v,x=1/0,C=0;for(const E of s){const k=tn(E.usage,E.model);o.input+=k.input,o.output+=k.output,o.cacheRead+=k.cacheRead,o.cacheWrite+=k.cacheWrite,o.total+=k.total,E.model&&u.add(E.model),E.kind==="subagent"&&m++,d+=E.prompts.length,!v&&E.prompts.length>0&&(v=E.prompts[0].text),h+=E.usage.inputTokens+E.usage.outputTokens,c+=E.tools.length,x=Math.min(x,E.startedAt),C=Math.max(C,E.endedAt??Date.now());for(const j of E.tools)l.set(j.name,(l.get(j.name)??0)+1),j.ok===!1&&p++}const _=Math.max(0,C-x),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`,N=Array.from(l.entries()).sort((E,k)=>k[1]-E[1]).slice(0,5);return{sessionId:n,label:i.label||i.cwdBasename||"session",cwd:i.cwd,durationLabel:b,cost:o,modelChips:Array.from(u),agentCount:s.length,subagentCount:m,toolCount:c,promptCount:d,tokensSum:h,errCount:p,topTools:N,firstPrompt:v}}function o3(e,n){const i=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let o=s.tools.length,u=tn(s.usage,s.model).total,l=s.endedAt??s.startedAt;for(const c of e.agents.values()){if(c.sessionId!==s.sessionId||c.kind==="root")continue;o+=c.tools.length,u+=tn(c.usage,c.model).total;const d=c.endedAt??c.startedAt;d>l&&(l=d)}i.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",cwdBasename:s.cwdBasename,state:s.state,modelId:s.model,toolCount:o,cost:u,startedAt:s.startedAt,lastActivity:l})}return i.sort((s,o)=>{if(s.state!==o.state){if(s.state==="active")return-1;if(o.state==="active")return 1}return o.lastActivity-s.lastActivity}),i}function a3(e,n,i){const s=(n??i)-e;if(s<1e3)return"<1s";const o=Math.floor(s/1e3);if(o<60)return`${o}s`;const u=Math.floor(o/60);return u<60?`${u}m`:`${Math.floor(u/60)}h ${u%60}m`}function u3({state:e,now:n,selectedIds:i,onSelect:s,onClose:o}){const u=O.useMemo(()=>o3(e),[e,e.lastSeq,n]),l=u.filter(c=>c.state==="active").length;return y.jsxs("aside",{className:"session-list","aria-label":"Sessions",children:[y.jsxs("div",{className:"sl-header",children:[y.jsxs("h3",{children:["Sessions ",y.jsx("span",{className:"sl-count",children:u.length})]}),l>0&&y.jsxs("span",{className:"sl-live-count",children:[l," live"]}),y.jsx("button",{className:"btn icon-btn sl-close",onClick:o,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),y.jsxs("div",{className:"sl-rows",children:[u.length===0&&y.jsx("div",{className:"sl-empty",children:"No sessions yet."}),u.map(c=>{const d=i.has(c.sessionId);return y.jsxs("button",{type:"button",className:`sl-row state-${c.state}${d?" selected":""}`,onClick:()=>s(c.sessionId),title:`Focus ${c.label}`,children:[y.jsx("span",{className:`sl-dot state-${c.state}`,"aria-hidden":!0}),y.jsxs("div",{className:"sl-row-body",children:[y.jsxs("div",{className:"sl-row-head",children:[y.jsx("span",{className:"sl-label",children:c.label}),c.modelId&&y.jsx("span",{className:"model-chip",title:c.modelId,children:Mo(c.modelId)})]}),y.jsxs("div",{className:"sl-row-meta",children:[y.jsxs("span",{title:"tool calls",children:[y.jsx("b",{children:c.toolCount})," tools"]}),c.cost>0&&y.jsx("span",{className:"sl-cost",title:"total spend",children:y.jsx("b",{children:$e(c.cost)})}),y.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(c.startedAt).toLocaleString()}`,children:a3(c.startedAt,c.state==="active"?void 0:c.lastActivity,n)})]})]})]},c.sessionId)})]})]})}function hr(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(2)}M`}function l3({cost:e}){const n=e.total;if(n<=0)return null;const i=(s,o,u)=>{if(s<=0)return null;const l=s/n*100;return y.jsx("span",{className:`cb-seg ${o}`,style:{width:`${l}%`},title:`${u}: ${$e(s)} (${l.toFixed(0)}%)`},o)};return y.jsxs("div",{className:"cost-bar","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 c3(e,n){const i=e-n;if(i<=0)return null;const s=Math.floor(i/3600),o=Math.floor(i%3600/60);if(s>23){const u=Math.floor(i/86400),l=Math.floor(i%86400/3600);return`${u}d ${l}h`}return s>0?`${s}h ${o}m`:`${o}m`}function f3(e,n,i,s){const o=Math.max(0,n-s),u=Math.max(0,i-o);if(u<120)return null;const l=Math.min(100,u/i*100),c=e-l;if(Math.abs(c)<3)return{label:"on pace",color:"var(--ok)",expectedPct:l,isDeficit:!1};if(c>0){const d=100-e,h=u>0?e/u:0,p=h>0?d/h:1/0,m={label:`${Math.round(c)}% ahead`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(p<o&&p<86400){const v=Math.floor(p/3600),x=Math.floor(p%3600/60);m.runsOutIn=v>0?`${v}h ${x}m`:`${x}m`}return m}return{label:`${Math.round(-c)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function vi({pct:e,label:n,reset:i,resetAt:s,windowSec:o,limitReached:u,nowSec:l}){const c=Math.min(100,Math.max(0,e)),h=u||c>=90?"var(--err)":c>=70?"var(--warn)":"var(--accent)",p=c===0?"< 1%":`${c}%`,m=c===0?2:c,v=s?c3(s,l):null,x=s&&o?f3(c,s,o,l):null;return y.jsxs("div",{className:"qb-row",children:[y.jsxs("div",{className:"qb-meta",children:[y.jsxs("span",{className:"qb-label",children:[n,u&&y.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),y.jsx("span",{className:"qb-pct",style:{color:h},children:p})]}),y.jsxs("div",{className:"qb-track",children:[y.jsx("div",{className:"qb-fill",style:{width:`${m}%`,background:h,opacity:c===0?.4:1}}),x&&y.jsx("div",{className:"qb-pace-marker",style:{left:`${x.expectedPct}%`,background:x.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(x.expectedPct)}% by now`})]}),y.jsxs("div",{className:"qb-reset-row",children:[v?y.jsxs("span",{className:"qb-reset",children:["resets in ",v]}):i?y.jsxs("span",{className:"qb-reset",children:["resets ",i]}):null,x&&y.jsx("span",{className:"qb-pace",style:{color:x.color},children:x.runsOutIn?`runs out in ${x.runsOutIn}`:x.label})]})]})}const d3=6e4;function h3(){const[e,n]=O.useState(null),[i,s]=O.useState(!1),o=O.useRef(null),u=async(c=!1)=>{c&&s(!0);try{const h=await fetch(c?"/api/quota?refresh=1":"/api/quota");h.ok&&n(await h.json())}catch{}finally{c&&s(!1)}};return O.useEffect(()=>(u(!0),o.current=window.setInterval(()=>u(!1),d3),()=>{o.current!=null&&window.clearInterval(o.current)}),[]),{quota:e,loading:i,refresh:()=>u(!0)}}function p3(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.";default:return"ChatGPT API unreachable — click ↻ to retry."}}const nN=6e4;function m3(){const[e,n]=O.useState(null),[i,s]=O.useState(!1),o=O.useRef(null),u=async(c=!1)=>{c&&s(!0);try{const h=await fetch(c?"/api/codex-quota?refresh=1":"/api/codex-quota");h.ok&&n(await h.json())}catch{}finally{c&&s(!1)}};return O.useEffect(()=>(u(!0),o.current=window.setInterval(()=>u(!1),nN),()=>{o.current!=null&&window.clearInterval(o.current)}),[]),{data:e,loading:i,refresh:()=>u(!0)}}function g3(){const[e,n]=O.useState(null),i=O.useRef(null),s=async()=>{try{const o=await fetch("/api/codex-usage");o.ok&&n(await o.json())}catch{}};return O.useEffect(()=>(s(),i.current=window.setInterval(s,nN),()=>{i.current!=null&&window.clearInterval(i.current)}),[]),{data:e}}function v3({state:e,now:n,onClose:i}){var P,D;const{quota:s,loading:o,refresh:u}=h3(),{data:l,loading:c,refresh:d}=m3(),{data:h}=g3(),[p,m]=O.useState(()=>Math.floor(Date.now()/1e3));O.useEffect(()=>{const A=window.setInterval(()=>m(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(A)},[]);const{byModel:v,totalCost:x,totalTokens:C,burnRate:_}=O.useMemo(()=>{const A=new Map,F={total:0,input:0,output:0,cacheRead:0,cacheWrite:0};let q=0,Q=0,K=0,T=0;for(const $ of e.agents.values()){const G=$.model??"__unknown__",M=tn($.usage,$.model),B=A.get(G);B?(B.inputTokens+=$.usage.inputTokens,B.outputTokens+=$.usage.outputTokens,B.cacheReadTokens+=$.usage.cacheReadTokens,B.cacheCreateTokens+=$.usage.cacheCreateTokens,B.cost.total+=M.total,B.cost.input+=M.input,B.cost.output+=M.output,B.cost.cacheRead+=M.cacheRead,B.cost.cacheWrite+=M.cacheWrite,B.agentCount++):A.set(G,{model:G,inputTokens:$.usage.inputTokens,outputTokens:$.usage.outputTokens,cacheReadTokens:$.usage.cacheReadTokens,cacheCreateTokens:$.usage.cacheCreateTokens,cost:{...M},agentCount:1}),F.total+=M.total,F.input+=M.input,F.output+=M.output,F.cacheRead+=M.cacheRead,F.cacheWrite+=M.cacheWrite,q+=$.usage.inputTokens,Q+=$.usage.outputTokens,K+=$.usage.cacheReadTokens,T+=$.usage.cacheCreateTokens}const Y=Array.from(A.values()).sort(($,G)=>G.cost.total-$.cost.total);let H=0,re=0;for(const $ of e.agents.values()){if($.state!=="active")continue;const G=tn($.usage,$.model);H+=G.total,re=Math.max(re,(($.endedAt??n)-$.startedAt)/1e3)}const X=re>0?gu(H,re):null;return{byModel:Y,totalCost:F,totalTokens:{in:q,out:Q,cacheR:K,cacheC:T},burnRate:X}},[e,e.lastSeq,n]),S=O.useMemo(()=>{const A=[];for(const F of e.agents.values()){if(F.kind!=="root")continue;let q=tn(F.usage,F.model).total,Q=F.usage.inputTokens,K=F.usage.outputTokens;for(const T of e.agents.values())T.sessionId!==F.sessionId||T.kind==="root"||(q+=tn(T.usage,T.model).total,Q+=T.usage.inputTokens,K+=T.usage.outputTokens);A.push({sessionId:F.sessionId,label:F.label||F.cwdBasename||"session",state:F.state,cost:q,inputTokens:Q,outputTokens:K})}return A.sort((F,q)=>q.cost-F.cost).slice(0,12)},[e,e.lastSeq]),b=x.total>0,N=C.in+C.out,E=o||c,k=Math.max((s==null?void 0:s.fetchedAt)??0,(l==null?void 0:l.fetchedAt)??0),j=k>0?(()=>{const A=p-Math.floor(k/1e3);return A<10?"just now":A<60?`${A}s ago`:A<3600?`${Math.floor(A/60)}m ago`:`${Math.floor(A/3600)}h ago`})():null,I=()=>{u(),d()};return y.jsxs("div",{className:"usage-panel","aria-label":"Usage",children:[y.jsxs("div",{className:"up-header",children:[y.jsx("h3",{children:"Usage"}),_&&y.jsx("span",{className:"up-rate",children:_}),y.jsxs("div",{className:"up-header-right",children:[j&&!E&&y.jsx("span",{className:"up-last-updated",children:j}),y.jsx("button",{type:"button",className:"btn up-refresh-btn",onClick:I,disabled:E,title:"Refresh Claude + Codex quota",children:E?"…":"↻"}),y.jsx("button",{type:"button",className:"btn icon-btn up-close",onClick:i,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),y.jsxs("section",{className:"up-section up-quota-section",children:[y.jsx("h4",{className:"up-section-title",children:"Claude quota"}),s!=null&&s.ok?y.jsxs("div",{className:"up-quota-bars",children:[s.session5hPct!=null&&y.jsx(vi,{label:"5-hour window",pct:s.session5hPct,reset:s.session5hReset,resetAt:s.session5hResetAt,windowSec:s.session5hWindowSec,nowSec:p}),s.week7dPct!=null&&y.jsx(vi,{label:"7-day window",pct:s.week7dPct,reset:s.week7dReset,resetAt:s.week7dResetAt,windowSec:s.week7dWindowSec,nowSec:p}),s.weekSonnetPct!=null&&y.jsx(vi,{label:"Sonnet (7d)",pct:s.weekSonnetPct,nowSec:p}),s.weekOpusPct!=null&&y.jsx(vi,{label:"Opus (7d)",pct:s.weekOpusPct,nowSec:p})]}):(s==null?void 0:s.ok)===!1?y.jsxs("div",{className:"up-quota-na",children:[y.jsx("span",{children:"Quota unavailable."}),y.jsxs("span",{className:"up-quota-hint",children:["Run ",y.jsx("code",{children:"/usage"})," in a claude session, then click ↻"]})]}):y.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),y.jsxs("section",{className:"up-section up-quota-section",children:[y.jsxs("h4",{className:"up-section-title",children:["Codex quota",(l==null?void 0:l.ok)&&l.planLabel&&y.jsx("span",{className:"up-plan-badge",children:l.planLabel})]}),l!=null&&l.ok?y.jsxs("div",{className:"up-quota-bars",children:[(P=l.windows)==null?void 0:P.map(A=>y.jsx(vi,{label:A.label,pct:A.pct,reset:A.reset??void 0,resetAt:A.resetAt??void 0,windowSec:A.windowSec??void 0,limitReached:l.limitReached&&A.pct>=100,nowSec:p},A.id)),(D=l.extraWindows)==null?void 0:D.map(A=>y.jsx(vi,{label:A.label,pct:A.pct,reset:A.reset??void 0,resetAt:A.resetAt??void 0,windowSec:A.windowSec??void 0,nowSec:p},A.id)),l.creditLimit&&y.jsx(vi,{label:`spend cap · $${Math.round(l.creditLimit.used)} of $${Math.round(l.creditLimit.limit)}`,pct:l.creditLimit.usedPct,reset:l.creditLimit.reset??void 0,resetAt:l.creditLimit.resetAt??void 0,limitReached:l.spendControlReached,nowSec:p}),(h==null?void 0:h.ok)&&h.window7d&&h.window7d.sessionCount>0&&y.jsxs("div",{className:"up-quota-sub",children:[hr(h.window7d.totalTokens)," tokens · ",h.window7d.sessionCount," session",h.window7d.sessionCount!==1?"s":""," (7d)"]}),l.creditsBalance&&!l.creditsUnlimited&&y.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",l.creditsBalance,l.overageReached&&" · overage limit reached"]}),l.creditsUnlimited&&y.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),l.resetCredits&&l.resetCredits.availableCount>0&&y.jsxs("div",{className:"up-quota-sub up-reset-credits",title:"Redeem in the Codex CLI or ChatGPT — agents-deck only reports them",children:[l.resetCredits.availableCount," rate-limit reset",l.resetCredits.availableCount!==1?"s":""," available",l.resetCredits.nextExpiryAt&&` · expires ${new Date(l.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),l.promo&&y.jsx("div",{className:"up-quota-sub",children:l.promo}),l.partial&&y.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(l==null?void 0:l.ok)===!1?y.jsxs("div",{className:"up-quota-na",children:[y.jsx("span",{children:"Quota unavailable."}),y.jsx("span",{className:"up-quota-hint",children:p3(l.reason)})]}):y.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),b?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"up-total",children:[y.jsx("span",{className:"up-total-value",children:$e(x.total)}),y.jsx("span",{className:"up-total-label",children:"total spend"})]}),y.jsx(l3,{cost:x}),N>0&&y.jsxs("div",{className:"up-tokens-row",children:[y.jsxs("span",{className:"up-tok",children:[y.jsx("span",{className:"up-k",children:"in"}),hr(C.in)]}),y.jsxs("span",{className:"up-tok",children:[y.jsx("span",{className:"up-k",children:"out"}),hr(C.out)]}),C.cacheR>0&&y.jsxs("span",{className:"up-tok",children:[y.jsx("span",{className:"up-k",children:"cache r"}),hr(C.cacheR)]}),C.cacheC>0&&y.jsxs("span",{className:"up-tok",children:[y.jsx("span",{className:"up-k",children:"cache c"}),hr(C.cacheC)]})]}),v.filter(A=>A.cost.total>0).length>0&&y.jsxs("section",{className:"up-section",children:[y.jsx("h4",{className:"up-section-title",children:"By model"}),y.jsxs("table",{className:"up-table",children:[y.jsx("thead",{children:y.jsxs("tr",{children:[y.jsx("th",{children:"Model"}),y.jsx("th",{children:"Tokens"}),y.jsx("th",{children:"Cost"})]})}),y.jsx("tbody",{children:v.filter(A=>A.cost.total>0).map(A=>y.jsxs("tr",{children:[y.jsx("td",{className:"up-model-name",title:A.model,children:Mo(A.model)}),y.jsx("td",{className:"up-num",children:hr(A.inputTokens+A.outputTokens)}),y.jsx("td",{className:"up-num up-cost-val",children:$e(A.cost.total)})]},A.model))})]})]}),S.filter(A=>A.cost>0).length>0&&y.jsxs("section",{className:"up-section",children:[y.jsx("h4",{className:"up-section-title",children:"By session"}),y.jsx("div",{className:"up-sessions",children:S.filter(A=>A.cost>0).map(A=>y.jsxs("div",{className:"up-session-row",children:[y.jsx("span",{className:`sl-dot state-${A.state}`,"aria-hidden":!0}),y.jsx("span",{className:"up-session-label",children:A.label}),y.jsx("span",{className:"up-session-tokens",children:hr(A.inputTokens+A.outputTokens)}),y.jsx("span",{className:"up-session-cost",children:$e(A.cost)})]},A.sessionId))})]})]}):N>0?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"up-tokens-row",children:[y.jsxs("span",{className:"up-tok",children:[y.jsx("span",{className:"up-k",children:"in"}),hr(C.in)]}),y.jsxs("span",{className:"up-tok",children:[y.jsx("span",{className:"up-k",children:"out"}),hr(C.out)]})]}),y.jsx("div",{className:"up-hint",children:"Cost appears once a known model is detected."})]}):y.jsxs("div",{className:"up-empty",children:["No usage data yet.",y.jsx("br",{}),"Start a Claude Code or Codex session."]})]})}const y3=15e3,w3=[70,80,85,90,95];function x3(e,n){const i=e-n;if(i<=0)return null;const s=Math.floor(i/86400),o=Math.floor(i%86400/3600),u=Math.floor(i%3600/60);return s>0?`${s}d ${o}h`:o>0?`${o}h ${u}m`:`${u}m`}function Xw(e,n){const i=n-Math.floor(e/1e3);return i<60?"just now":i<3600?`${Math.floor(i/60)}m ago`:i<86400?`${Math.floor(i/3600)}h ago`:`${Math.floor(i/86400)}d ago`}function _3(e){if(e.event==="switch")return`would switch — ${e.detail??"another account"}`;const i={"below-threshold":"under threshold","no-qualifying-candidate":"no better account","all-exhausted":"every account spent",cooldown:"cooling down","external-engine":"handled elsewhere"}[e.reason??""]??e.reason??"nothing to do";return e.detail?`stays put · ${i}, ${e.detail}`:`stays put · ${i}`}function S3(e){return e==="http-429"?"rate limited":e==="http-401"?"re-login needed":e==="timeout"?"timed out":e==="network"?"unreachable":e}function b3({lane:e,nowSec:n}){const i=Math.min(100,Math.max(0,e.pct)),s=i>=90?"var(--err)":i>=70?"var(--warn)":"var(--accent)",o=e.resetAt?x3(e.resetAt,n):null;return y.jsxs("div",{className:"ap-lane",children:[y.jsx("span",{className:"ap-lane-label",children:e.label}),y.jsx("div",{className:"ap-lane-track",children:y.jsx("div",{className:"ap-lane-fill",style:{width:`${i===0?1.5:i}%`,background:s,opacity:i===0?.4:1}})}),y.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[i,"%"]}),y.jsx("span",{className:"ap-lane-reset",children:o?`resets ${o}`:""})]})}function k3({onClose:e}){var P,D,A,F;const[n,i]=O.useState(null),[s,o]=O.useState(null),[u,l]=O.useState(null),[c,d]=O.useState(null),[h,p]=O.useState(null),[m,v]=O.useState(null),[x,C]=O.useState(()=>Math.floor(Date.now()/1e3)),_=O.useRef(null),S=O.useCallback(async(q=!1)=>{try{const[Q,K]=await Promise.all([fetch(`/api/claude-accounts${q?"?refresh=1":""}`),fetch("/api/cswap-auto")]);Q.ok&&i(await Q.json()),K.ok&&o(await K.json())}catch{}},[]),b=O.useCallback(async(q,Q)=>{d(Q),v(null);try{const T=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(q)})).json().catch(()=>null);return T!=null&&T.ok||v((T==null?void 0:T.detail)||(T==null?void 0:T.reason)||"command failed"),T}catch{return v("server unreachable"),null}finally{d(null)}},[]);O.useEffect(()=>(S(!0),_.current=window.setInterval(()=>S(!1),y3),()=>{_.current!=null&&window.clearInterval(_.current)}),[S]),O.useEffect(()=>{const q=window.setInterval(()=>C(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(q)},[]);const N=((P=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:P.value)??"90",E=(D=n==null?void 0:n.accounts)==null?void 0:D.find(q=>q.active),k=E!=null&&E.lanes.length?Math.max(...E.lanes.map(q=>q.pct)):null,j=k!=null&&k>=Number(N)-15,I=async q=>{p(q),v(null);try{const K=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:q})})).json().catch(()=>null);K!=null&&K.ok||v((K==null?void 0:K.output)||(K==null?void 0:K.reason)||"switch failed"),await S(!0)}catch{v("server unreachable")}finally{p(null)}};return y.jsxs("div",{className:"accounts-panel","aria-label":"Claude accounts",children:[y.jsxs("div",{className:"ap-header",children:[y.jsx("h3",{children:"Accounts"}),y.jsxs("div",{className:"ap-header-right",children:[y.jsx("button",{type:"button",className:"btn ap-refresh",onClick:()=>S(!0),title:"Reload from claude-swap",children:"↻"}),y.jsx("button",{type:"button",className:"btn icon-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),n==null?y.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?y.jsxs(y.Fragment,{children:[(A=n.accounts)==null?void 0:A.map(q=>y.jsxs("div",{className:`ap-account${q.active?" active":""}${q.disabled?" disabled":""}`,children:[y.jsxs("div",{className:"ap-account-head",children:[y.jsx("span",{className:"ap-num",children:q.num}),q.alias&&y.jsx("span",{className:"ap-alias",children:q.alias}),y.jsx("span",{className:"ap-email",title:q.org??void 0,children:q.email}),q.active?y.jsx("span",{className:"ap-badge-active",children:"● active"}):y.jsx("button",{type:"button",className:"btn ap-switch",disabled:h!=null||q.disabled,onClick:()=>I(q.num),title:q.disabled?"Held out of rotation":`Switch to ${q.alias??q.email}`,children:h===q.num?"…":"switch"})]}),q.lanes.length>0?q.lanes.map(Q=>y.jsx(b3,{lane:Q,nowSec:x},Q.id)):y.jsx("div",{className:"ap-hint",children:"No usage recorded yet."}),y.jsxs("div",{className:"ap-meta",children:[q.error&&y.jsx("span",{className:"ap-err",children:S3(q.error)}),q.fetchedAt?y.jsx("span",{className:q.stale?"ap-stale":void 0,children:Xw(q.fetchedAt,x)}):y.jsx("span",{className:"ap-stale",children:"never fetched"}),((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!q.active&&y.jsx("button",{type:"button",className:"ap-rotate",disabled:c!=null,onClick:()=>b({action:"account",account:q.num,enabled:q.disabled},`rot-${q.num}`).then(()=>S(!0)),title:q.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:q.disabled?"held out":"in rotation"})]})]},q.num)),(s==null?void 0:s.ok)&&y.jsxs("div",{className:"ap-auto",children:[y.jsxs("div",{className:"ap-auto-head",children:[y.jsx("span",{className:"ap-auto-title",children:"Auto-switch"}),y.jsxs("button",{type:"button",className:`ap-auto-state toggle${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,disabled:c!=null,onClick:()=>b({action:"enable",enabled:!s.enabled},"enable").then(()=>S(!0)),title:s.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[y.jsx("i",{className:s.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),s.enabled?"on":"off"]})]}),s.external&&y.jsxs("p",{className:"ap-auto-note",children:[y.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",y.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",s.enabled?" — this toggle takes over when you stop it.":"."]}),y.jsxs("div",{className:"ap-auto-row",children:[y.jsx("span",{className:"ap-auto-key",children:"switch when"}),k!=null&&y.jsxs("span",{className:`ap-auto-now${j?" near":""}`,children:["now ",Math.round(k),"%"]}),y.jsx("span",{className:"ap-field",children:y.jsx("select",{"aria-label":"Switch threshold",value:N,disabled:c!=null,onChange:q=>b({action:"setting",key:"autoswitch.threshold",value:q.target.value},"threshold").then(()=>S(!0)),children:w3.map(q=>y.jsxs("option",{value:q,children:[q,"%"]},q))})})]}),y.jsxs("div",{className:"ap-auto-row",children:[y.jsx("span",{className:"ap-auto-key",children:"switch to"}),y.jsx("span",{className:"ap-field",children:y.jsxs("select",{"aria-label":"Target account strategy",value:((F=s.settings["autoswitch.strategy"])==null?void 0:F.value)??"best",disabled:c!=null,onChange:q=>b({action:"setting",key:"autoswitch.strategy",value:q.target.value},"strategy").then(()=>S(!0)),children:[y.jsx("option",{value:"best",children:"most quota left"}),y.jsx("option",{value:"consume-first",children:"soonest reset"})]})})]}),y.jsxs("div",{className:"ap-auto-foot",children:[y.jsx("button",{type:"button",className:"ap-auto-dry",disabled:c!=null,onClick:async()=>l(await b({action:"preview"},"preview")),title:"Evaluate a switch without performing one",children:c==="preview"?"checking…":"dry run"}),u!=null&&u.ok?y.jsx("span",{className:`ap-auto-result${u.event==="switch"?" would":""}`,children:_3(u)}):s.lastTick?y.jsxs("span",{className:"ap-auto-result",children:["checked ",Xw(s.lastTick.at,x)]}):null]})]}),m&&y.jsx("div",{className:"ap-failure",children:m}),y.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 reads what claude-swap already collected.",children:"Read from claude-swap, not polled."})]}):y.jsxs("div",{className:"ap-empty",children:[y.jsx("span",{children:"No accounts found."}),y.jsx("span",{className:"ap-hint",children:n.reason==="no_store"?"This panel reads claude-swap's store. Install it with uv tool install claude-swap, then run cswap add.":"claude-swap's store could not be read."})]})]})}function yi(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 Qw(e){return e.replace(/^anthropic\./,"").replace(/^claude-/,"").replace(/-\d{8}$/,"")}function Za(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"}function E3(e){return new Date(Date.now()-(e-1)*864e5).toISOString().slice(0,10).replace(/-/g,"")}const N3=[7,14,30,90];function C3(e){const[n,i]=O.useState(null),[s,o]=O.useState(!1),u=(l=!1)=>{o(!0);const d=`/api/ccusage?since=${E3(e)}${l?"&refresh=1":""}`;fetch(d).then(h=>h.json()).then(i).catch(()=>i({ok:!1,error:"request failed"})).finally(()=>o(!1))};return O.useEffect(()=>{u(!1)},[e]),{data:n,loading:s,reload:()=>u(!0)}}function R3({onClose:e}){var b,N;const[n,i]=O.useState(30),[s,o]=O.useState(null),{data:u,loading:l,reload:c}=C3(n);O.useEffect(()=>{const E=k=>{k.key==="Escape"&&e()};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[e]);const d=u!=null&&u.ok?u.days??[]:[],h=O.useMemo(()=>d.reduce((E,k)=>Math.max(E,k.totalCost),0),[d]),{totalCost:p,totalTok:m,inOut:v,cacheRead:x,modelCosts:C}=O.useMemo(()=>{let E=0,k=0,j=0,I=0;const P=new Map;for(const D of d){E+=D.totalCost,k+=D.totalTokens,j+=D.inputTokens+D.outputTokens,I+=D.cacheReadTokens;for(const A of D.modelBreakdowns)P.set(A.modelName,(P.get(A.modelName)??0)+A.cost)}return{totalCost:E,totalTok:k,inOut:j,cacheRead:I,modelCosts:P}},[d]),_=O.useMemo(()=>Array.from(C.entries()).sort((E,k)=>k[1]-E[1]),[C]),S=s?d.find(E=>E.period===s)??null:null;return y.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:y.jsxs("div",{className:"uh-modal",onClick:E=>E.stopPropagation(),role:"dialog","aria-label":"Usage history",children:[y.jsxs("header",{className:"uh-head",children:[y.jsxs("div",{className:"uh-titlewrap",children:[y.jsx("div",{className:"uh-title",children:"Usage history"}),y.jsx("div",{className:"uh-sub",children:"via ccusage · local Claude / Codex logs"})]}),y.jsx("div",{className:"uh-range",role:"tablist","aria-label":"Range",children:N3.map(E=>y.jsxs("button",{role:"tab","aria-selected":n===E,className:`uh-range-btn${n===E?" on":""}`,onClick:()=>{i(E),o(null)},children:[E,"d"]},E))}),y.jsx("button",{className:"btn icon-btn uh-reload",onClick:c,title:"Re-run ccusage","aria-label":"Reload",children:"↻"}),y.jsx("button",{className:"uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),l&&d.length===0?y.jsx("div",{className:"uh-status",children:"running ccusage… (first run downloads the package)"}):u&&!u.ok?y.jsxs("div",{className:"uh-status uh-err",children:["ccusage failed: ",u.error]}):d.length===0?y.jsx("div",{className:"uh-status",children:"no usage in this range"}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"uh-totals",children:[y.jsx(Ja,{label:"total cost",val:$e(p),accent:!0}),y.jsx(Ja,{label:"tokens",val:yi(m)}),y.jsx(Ja,{label:"input+output",val:yi(v)}),y.jsx(Ja,{label:"cache reads",val:yi(x)})]}),y.jsx("div",{className:"uh-chart",role:"img","aria-label":"Daily cost by model",children:d.map(E=>{const k=h>0?E.totalCost/h*100:0,j=E.period===s;return y.jsxs("button",{className:`uh-bar-col${j?" sel":""}`,onClick:()=>o(j?null:E.period),title:`${E.period} · ${$e(E.totalCost)}`,style:{flexBasis:`${100/d.length}%`},children:[y.jsx("div",{className:"uh-bar",style:{height:`${Math.max(k,E.totalCost>0?2:0)}%`},children:E.modelBreakdowns.slice().sort((I,P)=>P.cost-I.cost).map(I=>{const P=E.totalCost>0?I.cost/E.totalCost*100:0;return y.jsx("div",{className:"uh-bar-seg",style:{height:`${P}%`,background:Za(I.modelName)}},I.modelName)})}),y.jsx("span",{className:"uh-bar-label",children:E.period.slice(5)})]},E.period)})}),y.jsx("div",{className:"uh-legend",children:_.map(([E,k])=>y.jsxs("span",{className:"uh-legend-item",children:[y.jsx("span",{className:"uh-legend-dot",style:{background:Za(E)}}),Qw(E)," ",y.jsx("span",{className:"uh-legend-cost",children:$e(k)})]},E))}),S&&y.jsxs("div",{className:"uh-detail",children:[y.jsxs("div",{className:"uh-detail-head",children:[y.jsx("span",{className:"uh-detail-date",children:S.period}),y.jsx("span",{className:"uh-detail-cost",children:$e(S.totalCost)}),(N=(b=S.metadata)==null?void 0:b.agents)!=null&&N.length?y.jsx("span",{className:"uh-detail-agents",children:S.metadata.agents.join(" · ")}):null]}),y.jsxs("div",{className:"uh-detail-mini",children:[y.jsx(eu,{label:"input",val:yi(S.inputTokens)}),y.jsx(eu,{label:"output",val:yi(S.outputTokens)}),y.jsx(eu,{label:"cache write",val:yi(S.cacheCreationTokens)}),y.jsx(eu,{label:"cache read",val:yi(S.cacheReadTokens)})]}),y.jsx("div",{className:"uh-detail-models",children:S.modelBreakdowns.slice().sort((E,k)=>k.cost-E.cost).map(E=>{const k=S.totalCost>0?E.cost/S.totalCost*100:0;return y.jsxs("div",{className:"uh-model-row",children:[y.jsxs("span",{className:"uh-model-name",children:[y.jsx("span",{className:"uh-legend-dot",style:{background:Za(E.modelName)}}),Qw(E.modelName)]}),y.jsx("span",{className:"uh-model-bar",children:y.jsx("span",{className:"uh-model-bar-fill",style:{width:`${k}%`,background:Za(E.modelName)}})}),y.jsx("span",{className:"uh-model-cost",children:$e(E.cost)})]},E.modelName)})})]})]})]})})}function Ja({label:e,val:n,accent:i}){return y.jsxs("div",{className:"uh-stat",children:[y.jsx("span",{className:`uh-stat-val${i?" accent":""}`,children:n}),y.jsx("span",{className:"uh-stat-label",children:e})]})}function eu({label:e,val:n}){return y.jsxs("div",{className:"uh-ministat",children:[y.jsx("span",{className:"uh-ministat-val",children:n}),y.jsx("span",{className:"uh-ministat-label",children:e})]})}function Gg(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 Dc,Zw;function T3(){if(Zw)return Dc;Zw=1;function e(){this.__data__=[],this.size=0}return Dc=e,Dc}var Fc,Jw;function xs(){if(Jw)return Fc;Jw=1;function e(n,i){return n===i||n!==n&&i!==i}return Fc=e,Fc}var zc,ex;function Eu(){if(ex)return zc;ex=1;var e=xs();function n(i,s){for(var o=i.length;o--;)if(e(i[o][0],s))return o;return-1}return zc=n,zc}var Bc,tx;function j3(){if(tx)return Bc;tx=1;var e=Eu(),n=Array.prototype,i=n.splice;function s(o){var u=this.__data__,l=e(u,o);if(l<0)return!1;var c=u.length-1;return l==c?u.pop():i.call(u,l,1),--this.size,!0}return Bc=s,Bc}var Uc,nx;function A3(){if(nx)return Uc;nx=1;var e=Eu();function n(i){var s=this.__data__,o=e(s,i);return o<0?void 0:s[o][1]}return Uc=n,Uc}var Hc,rx;function I3(){if(rx)return Hc;rx=1;var e=Eu();function n(i){return e(this.__data__,i)>-1}return Hc=n,Hc}var Vc,ix;function M3(){if(ix)return Vc;ix=1;var e=Eu();function n(i,s){var o=this.__data__,u=e(o,i);return u<0?(++this.size,o.push([i,s])):o[u][1]=s,this}return Vc=n,Vc}var Wc,sx;function Nu(){if(sx)return Wc;sx=1;var e=T3(),n=j3(),i=A3(),s=I3(),o=M3();function u(l){var c=-1,d=l==null?0:l.length;for(this.clear();++c<d;){var h=l[c];this.set(h[0],h[1])}}return u.prototype.clear=e,u.prototype.delete=n,u.prototype.get=i,u.prototype.has=s,u.prototype.set=o,Wc=u,Wc}var Gc,ox;function P3(){if(ox)return Gc;ox=1;var e=Nu();function n(){this.__data__=new e,this.size=0}return Gc=n,Gc}var Yc,ax;function O3(){if(ax)return Yc;ax=1;function e(n){var i=this.__data__,s=i.delete(n);return this.size=i.size,s}return Yc=e,Yc}var Kc,ux;function q3(){if(ux)return Kc;ux=1;function e(n){return this.__data__.get(n)}return Kc=e,Kc}var Xc,lx;function L3(){if(lx)return Xc;lx=1;function e(n){return this.__data__.has(n)}return Xc=e,Xc}var Qc,cx;function rN(){if(cx)return Qc;cx=1;var e=typeof Fa=="object"&&Fa&&Fa.Object===Object&&Fa;return Qc=e,Qc}var Zc,fx;function Hn(){if(fx)return Zc;fx=1;var e=rN(),n=typeof self=="object"&&self&&self.Object===Object&&self,i=e||n||Function("return this")();return Zc=i,Zc}var Jc,dx;function _s(){if(dx)return Jc;dx=1;var e=Hn(),n=e.Symbol;return Jc=n,Jc}var ef,hx;function $3(){if(hx)return ef;hx=1;var e=_s(),n=Object.prototype,i=n.hasOwnProperty,s=n.toString,o=e?e.toStringTag:void 0;function u(l){var c=i.call(l,o),d=l[o];try{l[o]=void 0;var h=!0}catch{}var p=s.call(l);return h&&(c?l[o]=d:delete l[o]),p}return ef=u,ef}var tf,px;function D3(){if(px)return tf;px=1;var e=Object.prototype,n=e.toString;function i(s){return n.call(s)}return tf=i,tf}var nf,mx;function Ci(){if(mx)return nf;mx=1;var e=_s(),n=$3(),i=D3(),s="[object Null]",o="[object Undefined]",u=e?e.toStringTag:void 0;function l(c){return c==null?c===void 0?o:s:u&&u in Object(c)?n(c):i(c)}return nf=l,nf}var rf,gx;function En(){if(gx)return rf;gx=1;function e(n){var i=typeof n;return n!=null&&(i=="object"||i=="function")}return rf=e,rf}var sf,vx;function Po(){if(vx)return sf;vx=1;var e=Ci(),n=En(),i="[object AsyncFunction]",s="[object Function]",o="[object GeneratorFunction]",u="[object Proxy]";function l(c){if(!n(c))return!1;var d=e(c);return d==s||d==o||d==i||d==u}return sf=l,sf}var of,yx;function F3(){if(yx)return of;yx=1;var e=Hn(),n=e["__core-js_shared__"];return of=n,of}var af,wx;function z3(){if(wx)return af;wx=1;var e=F3(),n=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function i(s){return!!n&&n in s}return af=i,af}var uf,xx;function iN(){if(xx)return uf;xx=1;var e=Function.prototype,n=e.toString;function i(s){if(s!=null){try{return n.call(s)}catch{}try{return s+""}catch{}}return""}return uf=i,uf}var lf,_x;function B3(){if(_x)return lf;_x=1;var e=Po(),n=z3(),i=En(),s=iN(),o=/[\\^$.*+?()[\]{}|]/g,u=/^\[object .+?Constructor\]$/,l=Function.prototype,c=Object.prototype,d=l.toString,h=c.hasOwnProperty,p=RegExp("^"+d.call(h).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(v){if(!i(v)||n(v))return!1;var x=e(v)?p:u;return x.test(s(v))}return lf=m,lf}var cf,Sx;function U3(){if(Sx)return cf;Sx=1;function e(n,i){return n==null?void 0:n[i]}return cf=e,cf}var ff,bx;function Ri(){if(bx)return ff;bx=1;var e=B3(),n=U3();function i(s,o){var u=n(s,o);return e(u)?u:void 0}return ff=i,ff}var df,kx;function Yg(){if(kx)return df;kx=1;var e=Ri(),n=Hn(),i=e(n,"Map");return df=i,df}var hf,Ex;function Cu(){if(Ex)return hf;Ex=1;var e=Ri(),n=e(Object,"create");return hf=n,hf}var pf,Nx;function H3(){if(Nx)return pf;Nx=1;var e=Cu();function n(){this.__data__=e?e(null):{},this.size=0}return pf=n,pf}var mf,Cx;function V3(){if(Cx)return mf;Cx=1;function e(n){var i=this.has(n)&&delete this.__data__[n];return this.size-=i?1:0,i}return mf=e,mf}var gf,Rx;function W3(){if(Rx)return gf;Rx=1;var e=Cu(),n="__lodash_hash_undefined__",i=Object.prototype,s=i.hasOwnProperty;function o(u){var l=this.__data__;if(e){var c=l[u];return c===n?void 0:c}return s.call(l,u)?l[u]:void 0}return gf=o,gf}var vf,Tx;function G3(){if(Tx)return vf;Tx=1;var e=Cu(),n=Object.prototype,i=n.hasOwnProperty;function s(o){var u=this.__data__;return e?u[o]!==void 0:i.call(u,o)}return vf=s,vf}var yf,jx;function Y3(){if(jx)return yf;jx=1;var e=Cu(),n="__lodash_hash_undefined__";function i(s,o){var u=this.__data__;return this.size+=this.has(s)?0:1,u[s]=e&&o===void 0?n:o,this}return yf=i,yf}var wf,Ax;function K3(){if(Ax)return wf;Ax=1;var e=H3(),n=V3(),i=W3(),s=G3(),o=Y3();function u(l){var c=-1,d=l==null?0:l.length;for(this.clear();++c<d;){var h=l[c];this.set(h[0],h[1])}}return u.prototype.clear=e,u.prototype.delete=n,u.prototype.get=i,u.prototype.has=s,u.prototype.set=o,wf=u,wf}var xf,Ix;function X3(){if(Ix)return xf;Ix=1;var e=K3(),n=Nu(),i=Yg();function s(){this.size=0,this.__data__={hash:new e,map:new(i||n),string:new e}}return xf=s,xf}var _f,Mx;function Q3(){if(Mx)return _f;Mx=1;function e(n){var i=typeof n;return i=="string"||i=="number"||i=="symbol"||i=="boolean"?n!=="__proto__":n===null}return _f=e,_f}var Sf,Px;function Ru(){if(Px)return Sf;Px=1;var e=Q3();function n(i,s){var o=i.__data__;return e(s)?o[typeof s=="string"?"string":"hash"]:o.map}return Sf=n,Sf}var bf,Ox;function Z3(){if(Ox)return bf;Ox=1;var e=Ru();function n(i){var s=e(this,i).delete(i);return this.size-=s?1:0,s}return bf=n,bf}var kf,qx;function J3(){if(qx)return kf;qx=1;var e=Ru();function n(i){return e(this,i).get(i)}return kf=n,kf}var Ef,Lx;function eO(){if(Lx)return Ef;Lx=1;var e=Ru();function n(i){return e(this,i).has(i)}return Ef=n,Ef}var Nf,$x;function tO(){if($x)return Nf;$x=1;var e=Ru();function n(i,s){var o=e(this,i),u=o.size;return o.set(i,s),this.size+=o.size==u?0:1,this}return Nf=n,Nf}var Cf,Dx;function Kg(){if(Dx)return Cf;Dx=1;var e=X3(),n=Z3(),i=J3(),s=eO(),o=tO();function u(l){var c=-1,d=l==null?0:l.length;for(this.clear();++c<d;){var h=l[c];this.set(h[0],h[1])}}return u.prototype.clear=e,u.prototype.delete=n,u.prototype.get=i,u.prototype.has=s,u.prototype.set=o,Cf=u,Cf}var Rf,Fx;function nO(){if(Fx)return Rf;Fx=1;var e=Nu(),n=Yg(),i=Kg(),s=200;function o(u,l){var c=this.__data__;if(c instanceof e){var d=c.__data__;if(!n||d.length<s-1)return d.push([u,l]),this.size=++c.size,this;c=this.__data__=new i(d)}return c.set(u,l),this.size=c.size,this}return Rf=o,Rf}var Tf,zx;function Tu(){if(zx)return Tf;zx=1;var e=Nu(),n=P3(),i=O3(),s=q3(),o=L3(),u=nO();function l(c){var d=this.__data__=new e(c);this.size=d.size}return l.prototype.clear=n,l.prototype.delete=i,l.prototype.get=s,l.prototype.has=o,l.prototype.set=u,Tf=l,Tf}var jf,Bx;function Xg(){if(Bx)return jf;Bx=1;function e(n,i){for(var s=-1,o=n==null?0:n.length;++s<o&&i(n[s],s,n)!==!1;);return n}return jf=e,jf}var Af,Ux;function sN(){if(Ux)return Af;Ux=1;var e=Ri(),n=(function(){try{var i=e(Object,"defineProperty");return i({},"",{}),i}catch{}})();return Af=n,Af}var If,Hx;function ju(){if(Hx)return If;Hx=1;var e=sN();function n(i,s,o){s=="__proto__"&&e?e(i,s,{configurable:!0,enumerable:!0,value:o,writable:!0}):i[s]=o}return If=n,If}var Mf,Vx;function Au(){if(Vx)return Mf;Vx=1;var e=ju(),n=xs(),i=Object.prototype,s=i.hasOwnProperty;function o(u,l,c){var d=u[l];(!(s.call(u,l)&&n(d,c))||c===void 0&&!(l in u))&&e(u,l,c)}return Mf=o,Mf}var Pf,Wx;function Oo(){if(Wx)return Pf;Wx=1;var e=Au(),n=ju();function i(s,o,u,l){var c=!u;u||(u={});for(var d=-1,h=o.length;++d<h;){var p=o[d],m=l?l(u[p],s[p],p,u,s):void 0;m===void 0&&(m=s[p]),c?n(u,p,m):e(u,p,m)}return u}return Pf=i,Pf}var Of,Gx;function rO(){if(Gx)return Of;Gx=1;function e(n,i){for(var s=-1,o=Array(n);++s<n;)o[s]=i(s);return o}return Of=e,Of}var qf,Yx;function Zn(){if(Yx)return qf;Yx=1;function e(n){return n!=null&&typeof n=="object"}return qf=e,qf}var Lf,Kx;function iO(){if(Kx)return Lf;Kx=1;var e=Ci(),n=Zn(),i="[object Arguments]";function s(o){return n(o)&&e(o)==i}return Lf=s,Lf}var $f,Xx;function qo(){if(Xx)return $f;Xx=1;var e=iO(),n=Zn(),i=Object.prototype,s=i.hasOwnProperty,o=i.propertyIsEnumerable,u=e((function(){return arguments})())?e:function(l){return n(l)&&s.call(l,"callee")&&!o.call(l,"callee")};return $f=u,$f}var Df,Qx;function _t(){if(Qx)return Df;Qx=1;var e=Array.isArray;return Df=e,Df}var po={exports:{}},Ff,Zx;function sO(){if(Zx)return Ff;Zx=1;function e(){return!1}return Ff=e,Ff}po.exports;var Jx;function Ss(){return Jx||(Jx=1,(function(e,n){var i=Hn(),s=sO(),o=n&&!n.nodeType&&n,u=o&&!0&&e&&!e.nodeType&&e,l=u&&u.exports===o,c=l?i.Buffer:void 0,d=c?c.isBuffer:void 0,h=d||s;e.exports=h})(po,po.exports)),po.exports}var zf,e1;function Iu(){if(e1)return zf;e1=1;var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function i(s,o){var u=typeof s;return o=o??e,!!o&&(u=="number"||u!="symbol"&&n.test(s))&&s>-1&&s%1==0&&s<o}return zf=i,zf}var Bf,t1;function Qg(){if(t1)return Bf;t1=1;var e=9007199254740991;function n(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=e}return Bf=n,Bf}var Uf,n1;function oO(){if(n1)return Uf;n1=1;var e=Ci(),n=Qg(),i=Zn(),s="[object Arguments]",o="[object Array]",u="[object Boolean]",l="[object Date]",c="[object Error]",d="[object Function]",h="[object Map]",p="[object Number]",m="[object Object]",v="[object RegExp]",x="[object Set]",C="[object String]",_="[object WeakMap]",S="[object ArrayBuffer]",b="[object DataView]",N="[object Float32Array]",E="[object Float64Array]",k="[object Int8Array]",j="[object Int16Array]",I="[object Int32Array]",P="[object Uint8Array]",D="[object Uint8ClampedArray]",A="[object Uint16Array]",F="[object Uint32Array]",q={};q[N]=q[E]=q[k]=q[j]=q[I]=q[P]=q[D]=q[A]=q[F]=!0,q[s]=q[o]=q[S]=q[u]=q[b]=q[l]=q[c]=q[d]=q[h]=q[p]=q[m]=q[v]=q[x]=q[C]=q[_]=!1;function Q(K){return i(K)&&n(K.length)&&!!q[e(K)]}return Uf=Q,Uf}var Hf,r1;function Mu(){if(r1)return Hf;r1=1;function e(n){return function(i){return n(i)}}return Hf=e,Hf}var mo={exports:{}};mo.exports;var i1;function Zg(){return i1||(i1=1,(function(e,n){var i=rN(),s=n&&!n.nodeType&&n,o=s&&!0&&e&&!e.nodeType&&e,u=o&&o.exports===s,l=u&&i.process,c=(function(){try{var d=o&&o.require&&o.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=c})(mo,mo.exports)),mo.exports}var Vf,s1;function Lo(){if(s1)return Vf;s1=1;var e=oO(),n=Mu(),i=Zg(),s=i&&i.isTypedArray,o=s?n(s):e;return Vf=o,Vf}var Wf,o1;function oN(){if(o1)return Wf;o1=1;var e=rO(),n=qo(),i=_t(),s=Ss(),o=Iu(),u=Lo(),l=Object.prototype,c=l.hasOwnProperty;function d(h,p){var m=i(h),v=!m&&n(h),x=!m&&!v&&s(h),C=!m&&!v&&!x&&u(h),_=m||v||x||C,S=_?e(h.length,String):[],b=S.length;for(var N in h)(p||c.call(h,N))&&!(_&&(N=="length"||x&&(N=="offset"||N=="parent")||C&&(N=="buffer"||N=="byteLength"||N=="byteOffset")||o(N,b)))&&S.push(N);return S}return Wf=d,Wf}var Gf,a1;function Pu(){if(a1)return Gf;a1=1;var e=Object.prototype;function n(i){var s=i&&i.constructor,o=typeof s=="function"&&s.prototype||e;return i===o}return Gf=n,Gf}var Yf,u1;function aN(){if(u1)return Yf;u1=1;function e(n,i){return function(s){return n(i(s))}}return Yf=e,Yf}var Kf,l1;function aO(){if(l1)return Kf;l1=1;var e=aN(),n=e(Object.keys,Object);return Kf=n,Kf}var Xf,c1;function Jg(){if(c1)return Xf;c1=1;var e=Pu(),n=aO(),i=Object.prototype,s=i.hasOwnProperty;function o(u){if(!e(u))return n(u);var l=[];for(var c in Object(u))s.call(u,c)&&c!="constructor"&&l.push(c);return l}return Xf=o,Xf}var Qf,f1;function yr(){if(f1)return Qf;f1=1;var e=Po(),n=Qg();function i(s){return s!=null&&n(s.length)&&!e(s)}return Qf=i,Qf}var Zf,d1;function Kr(){if(d1)return Zf;d1=1;var e=oN(),n=Jg(),i=yr();function s(o){return i(o)?e(o):n(o)}return Zf=s,Zf}var Jf,h1;function uO(){if(h1)return Jf;h1=1;var e=Oo(),n=Kr();function i(s,o){return s&&e(o,n(o),s)}return Jf=i,Jf}var ed,p1;function lO(){if(p1)return ed;p1=1;function e(n){var i=[];if(n!=null)for(var s in Object(n))i.push(s);return i}return ed=e,ed}var td,m1;function cO(){if(m1)return td;m1=1;var e=En(),n=Pu(),i=lO(),s=Object.prototype,o=s.hasOwnProperty;function u(l){if(!e(l))return i(l);var c=n(l),d=[];for(var h in l)h=="constructor"&&(c||!o.call(l,h))||d.push(h);return d}return td=u,td}var nd,g1;function Ti(){if(g1)return nd;g1=1;var e=oN(),n=cO(),i=yr();function s(o){return i(o)?e(o,!0):n(o)}return nd=s,nd}var rd,v1;function fO(){if(v1)return rd;v1=1;var e=Oo(),n=Ti();function i(s,o){return s&&e(o,n(o),s)}return rd=i,rd}var go={exports:{}};go.exports;var y1;function uN(){return y1||(y1=1,(function(e,n){var i=Hn(),s=n&&!n.nodeType&&n,o=s&&!0&&e&&!e.nodeType&&e,u=o&&o.exports===s,l=u?i.Buffer:void 0,c=l?l.allocUnsafe:void 0;function d(h,p){if(p)return h.slice();var m=h.length,v=c?c(m):new h.constructor(m);return h.copy(v),v}e.exports=d})(go,go.exports)),go.exports}var id,w1;function lN(){if(w1)return id;w1=1;function e(n,i){var s=-1,o=n.length;for(i||(i=Array(o));++s<o;)i[s]=n[s];return i}return id=e,id}var sd,x1;function cN(){if(x1)return sd;x1=1;function e(n,i){for(var s=-1,o=n==null?0:n.length,u=0,l=[];++s<o;){var c=n[s];i(c,s,n)&&(l[u++]=c)}return l}return sd=e,sd}var od,_1;function fN(){if(_1)return od;_1=1;function e(){return[]}return od=e,od}var ad,S1;function ev(){if(S1)return ad;S1=1;var e=cN(),n=fN(),i=Object.prototype,s=i.propertyIsEnumerable,o=Object.getOwnPropertySymbols,u=o?function(l){return l==null?[]:(l=Object(l),e(o(l),function(c){return s.call(l,c)}))}:n;return ad=u,ad}var ud,b1;function dO(){if(b1)return ud;b1=1;var e=Oo(),n=ev();function i(s,o){return e(s,n(s),o)}return ud=i,ud}var ld,k1;function tv(){if(k1)return ld;k1=1;function e(n,i){for(var s=-1,o=i.length,u=n.length;++s<o;)n[u+s]=i[s];return n}return ld=e,ld}var cd,E1;function Ou(){if(E1)return cd;E1=1;var e=aN(),n=e(Object.getPrototypeOf,Object);return cd=n,cd}var fd,N1;function dN(){if(N1)return fd;N1=1;var e=tv(),n=Ou(),i=ev(),s=fN(),o=Object.getOwnPropertySymbols,u=o?function(l){for(var c=[];l;)e(c,i(l)),l=n(l);return c}:s;return fd=u,fd}var dd,C1;function hO(){if(C1)return dd;C1=1;var e=Oo(),n=dN();function i(s,o){return e(s,n(s),o)}return dd=i,dd}var hd,R1;function hN(){if(R1)return hd;R1=1;var e=tv(),n=_t();function i(s,o,u){var l=o(s);return n(s)?l:e(l,u(s))}return hd=i,hd}var pd,T1;function pN(){if(T1)return pd;T1=1;var e=hN(),n=ev(),i=Kr();function s(o){return e(o,i,n)}return pd=s,pd}var md,j1;function pO(){if(j1)return md;j1=1;var e=hN(),n=dN(),i=Ti();function s(o){return e(o,i,n)}return md=s,md}var gd,A1;function mO(){if(A1)return gd;A1=1;var e=Ri(),n=Hn(),i=e(n,"DataView");return gd=i,gd}var vd,I1;function gO(){if(I1)return vd;I1=1;var e=Ri(),n=Hn(),i=e(n,"Promise");return vd=i,vd}var yd,M1;function mN(){if(M1)return yd;M1=1;var e=Ri(),n=Hn(),i=e(n,"Set");return yd=i,yd}var wd,P1;function vO(){if(P1)return wd;P1=1;var e=Ri(),n=Hn(),i=e(n,"WeakMap");return wd=i,wd}var xd,O1;function bs(){if(O1)return xd;O1=1;var e=mO(),n=Yg(),i=gO(),s=mN(),o=vO(),u=Ci(),l=iN(),c="[object Map]",d="[object Object]",h="[object Promise]",p="[object Set]",m="[object WeakMap]",v="[object DataView]",x=l(e),C=l(n),_=l(i),S=l(s),b=l(o),N=u;return(e&&N(new e(new ArrayBuffer(1)))!=v||n&&N(new n)!=c||i&&N(i.resolve())!=h||s&&N(new s)!=p||o&&N(new o)!=m)&&(N=function(E){var k=u(E),j=k==d?E.constructor:void 0,I=j?l(j):"";if(I)switch(I){case x:return v;case C:return c;case _:return h;case S:return p;case b:return m}return k}),xd=N,xd}var _d,q1;function yO(){if(q1)return _d;q1=1;var e=Object.prototype,n=e.hasOwnProperty;function i(s){var o=s.length,u=new s.constructor(o);return o&&typeof s[0]=="string"&&n.call(s,"index")&&(u.index=s.index,u.input=s.input),u}return _d=i,_d}var Sd,L1;function gN(){if(L1)return Sd;L1=1;var e=Hn(),n=e.Uint8Array;return Sd=n,Sd}var bd,$1;function nv(){if($1)return bd;$1=1;var e=gN();function n(i){var s=new i.constructor(i.byteLength);return new e(s).set(new e(i)),s}return bd=n,bd}var kd,D1;function wO(){if(D1)return kd;D1=1;var e=nv();function n(i,s){var o=s?e(i.buffer):i.buffer;return new i.constructor(o,i.byteOffset,i.byteLength)}return kd=n,kd}var Ed,F1;function xO(){if(F1)return Ed;F1=1;var e=/\w*$/;function n(i){var s=new i.constructor(i.source,e.exec(i));return s.lastIndex=i.lastIndex,s}return Ed=n,Ed}var Nd,z1;function _O(){if(z1)return Nd;z1=1;var e=_s(),n=e?e.prototype:void 0,i=n?n.valueOf:void 0;function s(o){return i?Object(i.call(o)):{}}return Nd=s,Nd}var Cd,B1;function vN(){if(B1)return Cd;B1=1;var e=nv();function n(i,s){var o=s?e(i.buffer):i.buffer;return new i.constructor(o,i.byteOffset,i.length)}return Cd=n,Cd}var Rd,U1;function SO(){if(U1)return Rd;U1=1;var e=nv(),n=wO(),i=xO(),s=_O(),o=vN(),u="[object Boolean]",l="[object Date]",c="[object Map]",d="[object Number]",h="[object RegExp]",p="[object Set]",m="[object String]",v="[object Symbol]",x="[object ArrayBuffer]",C="[object DataView]",_="[object Float32Array]",S="[object Float64Array]",b="[object Int8Array]",N="[object Int16Array]",E="[object Int32Array]",k="[object Uint8Array]",j="[object Uint8ClampedArray]",I="[object Uint16Array]",P="[object Uint32Array]";function D(A,F,q){var Q=A.constructor;switch(F){case x:return e(A);case u:case l:return new Q(+A);case C:return n(A,q);case _:case S:case b:case N:case E:case k:case j:case I:case P:return o(A,q);case c:return new Q;case d:case m:return new Q(A);case h:return i(A);case p:return new Q;case v:return s(A)}}return Rd=D,Rd}var Td,H1;function yN(){if(H1)return Td;H1=1;var e=En(),n=Object.create,i=(function(){function s(){}return function(o){if(!e(o))return{};if(n)return n(o);s.prototype=o;var u=new s;return s.prototype=void 0,u}})();return Td=i,Td}var jd,V1;function wN(){if(V1)return jd;V1=1;var e=yN(),n=Ou(),i=Pu();function s(o){return typeof o.constructor=="function"&&!i(o)?e(n(o)):{}}return jd=s,jd}var Ad,W1;function bO(){if(W1)return Ad;W1=1;var e=bs(),n=Zn(),i="[object Map]";function s(o){return n(o)&&e(o)==i}return Ad=s,Ad}var Id,G1;function kO(){if(G1)return Id;G1=1;var e=bO(),n=Mu(),i=Zg(),s=i&&i.isMap,o=s?n(s):e;return Id=o,Id}var Md,Y1;function EO(){if(Y1)return Md;Y1=1;var e=bs(),n=Zn(),i="[object Set]";function s(o){return n(o)&&e(o)==i}return Md=s,Md}var Pd,K1;function NO(){if(K1)return Pd;K1=1;var e=EO(),n=Mu(),i=Zg(),s=i&&i.isSet,o=s?n(s):e;return Pd=o,Pd}var Od,X1;function xN(){if(X1)return Od;X1=1;var e=Tu(),n=Xg(),i=Au(),s=uO(),o=fO(),u=uN(),l=lN(),c=dO(),d=hO(),h=pN(),p=pO(),m=bs(),v=yO(),x=SO(),C=wN(),_=_t(),S=Ss(),b=kO(),N=En(),E=NO(),k=Kr(),j=Ti(),I=1,P=2,D=4,A="[object Arguments]",F="[object Array]",q="[object Boolean]",Q="[object Date]",K="[object Error]",T="[object Function]",Y="[object GeneratorFunction]",H="[object Map]",re="[object Number]",X="[object Object]",$="[object RegExp]",G="[object Set]",M="[object String]",B="[object Symbol]",ae="[object WeakMap]",z="[object ArrayBuffer]",W="[object DataView]",ee="[object Float32Array]",se="[object Float64Array]",ce="[object Int8Array]",pe="[object Int16Array]",me="[object Int32Array]",Pe="[object Uint8Array]",ze="[object Uint8ClampedArray]",je="[object Uint16Array]",Me="[object Uint32Array]",ke={};ke[A]=ke[F]=ke[z]=ke[W]=ke[q]=ke[Q]=ke[ee]=ke[se]=ke[ce]=ke[pe]=ke[me]=ke[H]=ke[re]=ke[X]=ke[$]=ke[G]=ke[M]=ke[B]=ke[Pe]=ke[ze]=ke[je]=ke[Me]=!0,ke[K]=ke[T]=ke[ae]=!1;function De(xe,_e,He,st,vt,lt){var Ke,yt=_e&I,At=_e&P,Xe=_e&D;if(He&&(Ke=vt?He(xe,st,vt,lt):He(xe)),Ke!==void 0)return Ke;if(!N(xe))return xe;var Ct=_(xe);if(Ct){if(Ke=v(xe),!yt)return l(xe,Ke)}else{var Ze=m(xe),Wt=Ze==T||Ze==Y;if(S(xe))return u(xe,yt);if(Ze==X||Ze==A||Wt&&!vt){if(Ke=At||Wt?{}:C(xe),!yt)return At?d(xe,o(Ke,xe)):c(xe,s(Ke,xe))}else{if(!ke[Ze])return vt?xe:{};Ke=x(xe,Ze,yt)}}lt||(lt=new e);var Je=lt.get(xe);if(Je)return Je;lt.set(xe,Ke),E(xe)?xe.forEach(function(ct){Ke.add(De(ct,_e,He,ct,xe,lt))}):b(xe)&&xe.forEach(function(ct,ot){Ke.set(ot,De(ct,_e,He,ot,xe,lt))});var Ve=Xe?At?p:h:At?j:k,wt=Ct?void 0:Ve(xe);return n(wt||xe,function(ct,ot){wt&&(ot=ct,ct=xe[ot]),i(Ke,ot,De(ct,_e,He,ot,xe,lt))}),Ke}return Od=De,Od}var qd,Q1;function CO(){if(Q1)return qd;Q1=1;var e=xN(),n=4;function i(s){return e(s,n)}return qd=i,qd}var Ld,Z1;function rv(){if(Z1)return Ld;Z1=1;function e(n){return function(){return n}}return Ld=e,Ld}var $d,J1;function RO(){if(J1)return $d;J1=1;function e(n){return function(i,s,o){for(var u=-1,l=Object(i),c=o(i),d=c.length;d--;){var h=c[n?d:++u];if(s(l[h],h,l)===!1)break}return i}}return $d=e,$d}var Dd,e_;function iv(){if(e_)return Dd;e_=1;var e=RO(),n=e();return Dd=n,Dd}var Fd,t_;function sv(){if(t_)return Fd;t_=1;var e=iv(),n=Kr();function i(s,o){return s&&e(s,o,n)}return Fd=i,Fd}var zd,n_;function TO(){if(n_)return zd;n_=1;var e=yr();function n(i,s){return function(o,u){if(o==null)return o;if(!e(o))return i(o,u);for(var l=o.length,c=s?l:-1,d=Object(o);(s?c--:++c<l)&&u(d[c],c,d)!==!1;);return o}}return zd=n,zd}var Bd,r_;function qu(){if(r_)return Bd;r_=1;var e=sv(),n=TO(),i=n(e);return Bd=i,Bd}var Ud,i_;function ji(){if(i_)return Ud;i_=1;function e(n){return n}return Ud=e,Ud}var Hd,s_;function _N(){if(s_)return Hd;s_=1;var e=ji();function n(i){return typeof i=="function"?i:e}return Hd=n,Hd}var Vd,o_;function SN(){if(o_)return Vd;o_=1;var e=Xg(),n=qu(),i=_N(),s=_t();function o(u,l){var c=s(u)?e:n;return c(u,i(l))}return Vd=o,Vd}var Wd,a_;function bN(){return a_||(a_=1,Wd=SN()),Wd}var Gd,u_;function jO(){if(u_)return Gd;u_=1;var e=qu();function n(i,s){var o=[];return e(i,function(u,l,c){s(u,l,c)&&o.push(u)}),o}return Gd=n,Gd}var Yd,l_;function AO(){if(l_)return Yd;l_=1;var e="__lodash_hash_undefined__";function n(i){return this.__data__.set(i,e),this}return Yd=n,Yd}var Kd,c_;function IO(){if(c_)return Kd;c_=1;function e(n){return this.__data__.has(n)}return Kd=e,Kd}var Xd,f_;function kN(){if(f_)return Xd;f_=1;var e=Kg(),n=AO(),i=IO();function s(o){var u=-1,l=o==null?0:o.length;for(this.__data__=new e;++u<l;)this.add(o[u])}return s.prototype.add=s.prototype.push=n,s.prototype.has=i,Xd=s,Xd}var Qd,d_;function MO(){if(d_)return Qd;d_=1;function e(n,i){for(var s=-1,o=n==null?0:n.length;++s<o;)if(i(n[s],s,n))return!0;return!1}return Qd=e,Qd}var Zd,h_;function EN(){if(h_)return Zd;h_=1;function e(n,i){return n.has(i)}return Zd=e,Zd}var Jd,p_;function NN(){if(p_)return Jd;p_=1;var e=kN(),n=MO(),i=EN(),s=1,o=2;function u(l,c,d,h,p,m){var v=d&s,x=l.length,C=c.length;if(x!=C&&!(v&&C>x))return!1;var _=m.get(l),S=m.get(c);if(_&&S)return _==c&&S==l;var b=-1,N=!0,E=d&o?new e:void 0;for(m.set(l,c),m.set(c,l);++b<x;){var k=l[b],j=c[b];if(h)var I=v?h(j,k,b,c,l,m):h(k,j,b,l,c,m);if(I!==void 0){if(I)continue;N=!1;break}if(E){if(!n(c,function(P,D){if(!i(E,D)&&(k===P||p(k,P,d,h,m)))return E.push(D)})){N=!1;break}}else if(!(k===j||p(k,j,d,h,m))){N=!1;break}}return m.delete(l),m.delete(c),N}return Jd=u,Jd}var eh,m_;function PO(){if(m_)return eh;m_=1;function e(n){var i=-1,s=Array(n.size);return n.forEach(function(o,u){s[++i]=[u,o]}),s}return eh=e,eh}var th,g_;function ov(){if(g_)return th;g_=1;function e(n){var i=-1,s=Array(n.size);return n.forEach(function(o){s[++i]=o}),s}return th=e,th}var nh,v_;function OO(){if(v_)return nh;v_=1;var e=_s(),n=gN(),i=xs(),s=NN(),o=PO(),u=ov(),l=1,c=2,d="[object Boolean]",h="[object Date]",p="[object Error]",m="[object Map]",v="[object Number]",x="[object RegExp]",C="[object Set]",_="[object String]",S="[object Symbol]",b="[object ArrayBuffer]",N="[object DataView]",E=e?e.prototype:void 0,k=E?E.valueOf:void 0;function j(I,P,D,A,F,q,Q){switch(D){case N:if(I.byteLength!=P.byteLength||I.byteOffset!=P.byteOffset)return!1;I=I.buffer,P=P.buffer;case b:return!(I.byteLength!=P.byteLength||!q(new n(I),new n(P)));case d:case h:case v:return i(+I,+P);case p:return I.name==P.name&&I.message==P.message;case x:case _:return I==P+"";case m:var K=o;case C:var T=A&l;if(K||(K=u),I.size!=P.size&&!T)return!1;var Y=Q.get(I);if(Y)return Y==P;A|=c,Q.set(I,P);var H=s(K(I),K(P),A,F,q,Q);return Q.delete(I),H;case S:if(k)return k.call(I)==k.call(P)}return!1}return nh=j,nh}var rh,y_;function qO(){if(y_)return rh;y_=1;var e=pN(),n=1,i=Object.prototype,s=i.hasOwnProperty;function o(u,l,c,d,h,p){var m=c&n,v=e(u),x=v.length,C=e(l),_=C.length;if(x!=_&&!m)return!1;for(var S=x;S--;){var b=v[S];if(!(m?b in l:s.call(l,b)))return!1}var N=p.get(u),E=p.get(l);if(N&&E)return N==l&&E==u;var k=!0;p.set(u,l),p.set(l,u);for(var j=m;++S<x;){b=v[S];var I=u[b],P=l[b];if(d)var D=m?d(P,I,b,l,u,p):d(I,P,b,u,l,p);if(!(D===void 0?I===P||h(I,P,c,d,p):D)){k=!1;break}j||(j=b=="constructor")}if(k&&!j){var A=u.constructor,F=l.constructor;A!=F&&"constructor"in u&&"constructor"in l&&!(typeof A=="function"&&A instanceof A&&typeof F=="function"&&F instanceof F)&&(k=!1)}return p.delete(u),p.delete(l),k}return rh=o,rh}var ih,w_;function LO(){if(w_)return ih;w_=1;var e=Tu(),n=NN(),i=OO(),s=qO(),o=bs(),u=_t(),l=Ss(),c=Lo(),d=1,h="[object Arguments]",p="[object Array]",m="[object Object]",v=Object.prototype,x=v.hasOwnProperty;function C(_,S,b,N,E,k){var j=u(_),I=u(S),P=j?p:o(_),D=I?p:o(S);P=P==h?m:P,D=D==h?m:D;var A=P==m,F=D==m,q=P==D;if(q&&l(_)){if(!l(S))return!1;j=!0,A=!1}if(q&&!A)return k||(k=new e),j||c(_)?n(_,S,b,N,E,k):i(_,S,P,b,N,E,k);if(!(b&d)){var Q=A&&x.call(_,"__wrapped__"),K=F&&x.call(S,"__wrapped__");if(Q||K){var T=Q?_.value():_,Y=K?S.value():S;return k||(k=new e),E(T,Y,b,N,k)}}return q?(k||(k=new e),s(_,S,b,N,E,k)):!1}return ih=C,ih}var sh,x_;function CN(){if(x_)return sh;x_=1;var e=LO(),n=Zn();function i(s,o,u,l,c){return s===o?!0:s==null||o==null||!n(s)&&!n(o)?s!==s&&o!==o:e(s,o,u,l,i,c)}return sh=i,sh}var oh,__;function $O(){if(__)return oh;__=1;var e=Tu(),n=CN(),i=1,s=2;function o(u,l,c,d){var h=c.length,p=h,m=!d;if(u==null)return!p;for(u=Object(u);h--;){var v=c[h];if(m&&v[2]?v[1]!==u[v[0]]:!(v[0]in u))return!1}for(;++h<p;){v=c[h];var x=v[0],C=u[x],_=v[1];if(m&&v[2]){if(C===void 0&&!(x in u))return!1}else{var S=new e;if(d)var b=d(C,_,x,u,l,S);if(!(b===void 0?n(_,C,i|s,d,S):b))return!1}}return!0}return oh=o,oh}var ah,S_;function RN(){if(S_)return ah;S_=1;var e=En();function n(i){return i===i&&!e(i)}return ah=n,ah}var uh,b_;function DO(){if(b_)return uh;b_=1;var e=RN(),n=Kr();function i(s){for(var o=n(s),u=o.length;u--;){var l=o[u],c=s[l];o[u]=[l,c,e(c)]}return o}return uh=i,uh}var lh,k_;function TN(){if(k_)return lh;k_=1;function e(n,i){return function(s){return s==null?!1:s[n]===i&&(i!==void 0||n in Object(s))}}return lh=e,lh}var ch,E_;function FO(){if(E_)return ch;E_=1;var e=$O(),n=DO(),i=TN();function s(o){var u=n(o);return u.length==1&&u[0][2]?i(u[0][0],u[0][1]):function(l){return l===o||e(l,o,u)}}return ch=s,ch}var fh,N_;function ks(){if(N_)return fh;N_=1;var e=Ci(),n=Zn(),i="[object Symbol]";function s(o){return typeof o=="symbol"||n(o)&&e(o)==i}return fh=s,fh}var dh,C_;function av(){if(C_)return dh;C_=1;var e=_t(),n=ks(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function o(u,l){if(e(u))return!1;var c=typeof u;return c=="number"||c=="symbol"||c=="boolean"||u==null||n(u)?!0:s.test(u)||!i.test(u)||l!=null&&u in Object(l)}return dh=o,dh}var hh,R_;function zO(){if(R_)return hh;R_=1;var e=Kg(),n="Expected a function";function i(s,o){if(typeof s!="function"||o!=null&&typeof o!="function")throw new TypeError(n);var u=function(){var l=arguments,c=o?o.apply(this,l):l[0],d=u.cache;if(d.has(c))return d.get(c);var h=s.apply(this,l);return u.cache=d.set(c,h)||d,h};return u.cache=new(i.Cache||e),u}return i.Cache=e,hh=i,hh}var ph,T_;function BO(){if(T_)return ph;T_=1;var e=zO(),n=500;function i(s){var o=e(s,function(l){return u.size===n&&u.clear(),l}),u=o.cache;return o}return ph=i,ph}var mh,j_;function UO(){if(j_)return mh;j_=1;var e=BO(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,s=e(function(o){var u=[];return o.charCodeAt(0)===46&&u.push(""),o.replace(n,function(l,c,d,h){u.push(d?h.replace(i,"$1"):c||l)}),u});return mh=s,mh}var gh,A_;function Lu(){if(A_)return gh;A_=1;function e(n,i){for(var s=-1,o=n==null?0:n.length,u=Array(o);++s<o;)u[s]=i(n[s],s,n);return u}return gh=e,gh}var vh,I_;function HO(){if(I_)return vh;I_=1;var e=_s(),n=Lu(),i=_t(),s=ks(),o=e?e.prototype:void 0,u=o?o.toString:void 0;function l(c){if(typeof c=="string")return c;if(i(c))return n(c,l)+"";if(s(c))return u?u.call(c):"";var d=c+"";return d=="0"&&1/c==-1/0?"-0":d}return vh=l,vh}var yh,M_;function jN(){if(M_)return yh;M_=1;var e=HO();function n(i){return i==null?"":e(i)}return yh=n,yh}var wh,P_;function $u(){if(P_)return wh;P_=1;var e=_t(),n=av(),i=UO(),s=jN();function o(u,l){return e(u)?u:n(u,l)?[u]:i(s(u))}return wh=o,wh}var xh,O_;function $o(){if(O_)return xh;O_=1;var e=ks();function n(i){if(typeof i=="string"||e(i))return i;var s=i+"";return s=="0"&&1/i==-1/0?"-0":s}return xh=n,xh}var _h,q_;function Du(){if(q_)return _h;q_=1;var e=$u(),n=$o();function i(s,o){o=e(o,s);for(var u=0,l=o.length;s!=null&&u<l;)s=s[n(o[u++])];return u&&u==l?s:void 0}return _h=i,_h}var Sh,L_;function VO(){if(L_)return Sh;L_=1;var e=Du();function n(i,s,o){var u=i==null?void 0:e(i,s);return u===void 0?o:u}return Sh=n,Sh}var bh,$_;function WO(){if($_)return bh;$_=1;function e(n,i){return n!=null&&i in Object(n)}return bh=e,bh}var kh,D_;function AN(){if(D_)return kh;D_=1;var e=$u(),n=qo(),i=_t(),s=Iu(),o=Qg(),u=$o();function l(c,d,h){d=e(d,c);for(var p=-1,m=d.length,v=!1;++p<m;){var x=u(d[p]);if(!(v=c!=null&&h(c,x)))break;c=c[x]}return v||++p!=m?v:(m=c==null?0:c.length,!!m&&o(m)&&s(x,m)&&(i(c)||n(c)))}return kh=l,kh}var Eh,F_;function IN(){if(F_)return Eh;F_=1;var e=WO(),n=AN();function i(s,o){return s!=null&&n(s,o,e)}return Eh=i,Eh}var Nh,z_;function GO(){if(z_)return Nh;z_=1;var e=CN(),n=VO(),i=IN(),s=av(),o=RN(),u=TN(),l=$o(),c=1,d=2;function h(p,m){return s(p)&&o(m)?u(l(p),m):function(v){var x=n(v,p);return x===void 0&&x===m?i(v,p):e(m,x,c|d)}}return Nh=h,Nh}var Ch,B_;function MN(){if(B_)return Ch;B_=1;function e(n){return function(i){return i==null?void 0:i[n]}}return Ch=e,Ch}var Rh,U_;function YO(){if(U_)return Rh;U_=1;var e=Du();function n(i){return function(s){return e(s,i)}}return Rh=n,Rh}var Th,H_;function KO(){if(H_)return Th;H_=1;var e=MN(),n=YO(),i=av(),s=$o();function o(u){return i(u)?e(s(u)):n(u)}return Th=o,Th}var jh,V_;function wr(){if(V_)return jh;V_=1;var e=FO(),n=GO(),i=ji(),s=_t(),o=KO();function u(l){return typeof l=="function"?l:l==null?i:typeof l=="object"?s(l)?n(l[0],l[1]):e(l):o(l)}return jh=u,jh}var Ah,W_;function PN(){if(W_)return Ah;W_=1;var e=cN(),n=jO(),i=wr(),s=_t();function o(u,l){var c=s(u)?e:n;return c(u,i(l,3))}return Ah=o,Ah}var Ih,G_;function XO(){if(G_)return Ih;G_=1;var e=Object.prototype,n=e.hasOwnProperty;function i(s,o){return s!=null&&n.call(s,o)}return Ih=i,Ih}var Mh,Y_;function ON(){if(Y_)return Mh;Y_=1;var e=XO(),n=AN();function i(s,o){return s!=null&&n(s,o,e)}return Mh=i,Mh}var Ph,K_;function QO(){if(K_)return Ph;K_=1;var e=Jg(),n=bs(),i=qo(),s=_t(),o=yr(),u=Ss(),l=Pu(),c=Lo(),d="[object Map]",h="[object Set]",p=Object.prototype,m=p.hasOwnProperty;function v(x){if(x==null)return!0;if(o(x)&&(s(x)||typeof x=="string"||typeof x.splice=="function"||u(x)||c(x)||i(x)))return!x.length;var C=n(x);if(C==d||C==h)return!x.size;if(l(x))return!e(x).length;for(var _ in x)if(m.call(x,_))return!1;return!0}return Ph=v,Ph}var Oh,X_;function qN(){if(X_)return Oh;X_=1;function e(n){return n===void 0}return Oh=e,Oh}var qh,Q_;function LN(){if(Q_)return qh;Q_=1;var e=qu(),n=yr();function i(s,o){var u=-1,l=n(s)?Array(s.length):[];return e(s,function(c,d,h){l[++u]=o(c,d,h)}),l}return qh=i,qh}var Lh,Z_;function $N(){if(Z_)return Lh;Z_=1;var e=Lu(),n=wr(),i=LN(),s=_t();function o(u,l){var c=s(u)?e:i;return c(u,n(l,3))}return Lh=o,Lh}var $h,J_;function ZO(){if(J_)return $h;J_=1;function e(n,i,s,o){var u=-1,l=n==null?0:n.length;for(o&&l&&(s=n[++u]);++u<l;)s=i(s,n[u],u,n);return s}return $h=e,$h}var Dh,eS;function JO(){if(eS)return Dh;eS=1;function e(n,i,s,o,u){return u(n,function(l,c,d){s=o?(o=!1,l):i(s,l,c,d)}),s}return Dh=e,Dh}var Fh,tS;function DN(){if(tS)return Fh;tS=1;var e=ZO(),n=qu(),i=wr(),s=JO(),o=_t();function u(l,c,d){var h=o(l)?e:s,p=arguments.length<3;return h(l,i(c,4),d,p,n)}return Fh=u,Fh}var zh,nS;function eq(){if(nS)return zh;nS=1;var e=Ci(),n=_t(),i=Zn(),s="[object String]";function o(u){return typeof u=="string"||!n(u)&&i(u)&&e(u)==s}return zh=o,zh}var Bh,rS;function tq(){if(rS)return Bh;rS=1;var e=MN(),n=e("length");return Bh=n,Bh}var Uh,iS;function nq(){if(iS)return Uh;iS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",i="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",o=n+i+s,u="\\ufe0e\\ufe0f",l="\\u200d",c=RegExp("["+l+e+o+u+"]");function d(h){return c.test(h)}return Uh=d,Uh}var Hh,sS;function rq(){if(sS)return Hh;sS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",i="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",o=n+i+s,u="\\ufe0e\\ufe0f",l="["+e+"]",c="["+o+"]",d="\\ud83c[\\udffb-\\udfff]",h="(?:"+c+"|"+d+")",p="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",v="[\\ud800-\\udbff][\\udc00-\\udfff]",x="\\u200d",C=h+"?",_="["+u+"]?",S="(?:"+x+"(?:"+[p,m,v].join("|")+")"+_+C+")*",b=_+C+S,N="(?:"+[p+c+"?",c,m,v,l].join("|")+")",E=RegExp(d+"(?="+d+")|"+N+b,"g");function k(j){for(var I=E.lastIndex=0;E.test(j);)++I;return I}return Hh=k,Hh}var Vh,oS;function iq(){if(oS)return Vh;oS=1;var e=tq(),n=nq(),i=rq();function s(o){return n(o)?i(o):e(o)}return Vh=s,Vh}var Wh,aS;function sq(){if(aS)return Wh;aS=1;var e=Jg(),n=bs(),i=yr(),s=eq(),o=iq(),u="[object Map]",l="[object Set]";function c(d){if(d==null)return 0;if(i(d))return s(d)?o(d):d.length;var h=n(d);return h==u||h==l?d.size:e(d).length}return Wh=c,Wh}var Gh,uS;function oq(){if(uS)return Gh;uS=1;var e=Xg(),n=yN(),i=sv(),s=wr(),o=Ou(),u=_t(),l=Ss(),c=Po(),d=En(),h=Lo();function p(m,v,x){var C=u(m),_=C||l(m)||h(m);if(v=s(v,4),x==null){var S=m&&m.constructor;_?x=C?new S:[]:d(m)?x=c(S)?n(o(m)):{}:x={}}return(_?e:i)(m,function(b,N,E){return v(x,b,N,E)}),x}return Gh=p,Gh}var Yh,lS;function aq(){if(lS)return Yh;lS=1;var e=_s(),n=qo(),i=_t(),s=e?e.isConcatSpreadable:void 0;function o(u){return i(u)||n(u)||!!(s&&u&&u[s])}return Yh=o,Yh}var Kh,cS;function uv(){if(cS)return Kh;cS=1;var e=tv(),n=aq();function i(s,o,u,l,c){var d=-1,h=s.length;for(u||(u=n),c||(c=[]);++d<h;){var p=s[d];o>0&&u(p)?o>1?i(p,o-1,u,l,c):e(c,p):l||(c[c.length]=p)}return c}return Kh=i,Kh}var Xh,fS;function uq(){if(fS)return Xh;fS=1;function e(n,i,s){switch(s.length){case 0:return n.call(i);case 1:return n.call(i,s[0]);case 2:return n.call(i,s[0],s[1]);case 3:return n.call(i,s[0],s[1],s[2])}return n.apply(i,s)}return Xh=e,Xh}var Qh,dS;function FN(){if(dS)return Qh;dS=1;var e=uq(),n=Math.max;function i(s,o,u){return o=n(o===void 0?s.length-1:o,0),function(){for(var l=arguments,c=-1,d=n(l.length-o,0),h=Array(d);++c<d;)h[c]=l[o+c];c=-1;for(var p=Array(o+1);++c<o;)p[c]=l[c];return p[o]=u(h),e(s,this,p)}}return Qh=i,Qh}var Zh,hS;function lq(){if(hS)return Zh;hS=1;var e=rv(),n=sN(),i=ji(),s=n?function(o,u){return n(o,"toString",{configurable:!0,enumerable:!1,value:e(u),writable:!0})}:i;return Zh=s,Zh}var Jh,pS;function cq(){if(pS)return Jh;pS=1;var e=800,n=16,i=Date.now;function s(o){var u=0,l=0;return function(){var c=i(),d=n-(c-l);if(l=c,d>0){if(++u>=e)return arguments[0]}else u=0;return o.apply(void 0,arguments)}}return Jh=s,Jh}var ep,mS;function zN(){if(mS)return ep;mS=1;var e=lq(),n=cq(),i=n(e);return ep=i,ep}var tp,gS;function Fu(){if(gS)return tp;gS=1;var e=ji(),n=FN(),i=zN();function s(o,u){return i(n(o,u,e),o+"")}return tp=s,tp}var np,vS;function BN(){if(vS)return np;vS=1;function e(n,i,s,o){for(var u=n.length,l=s+(o?1:-1);o?l--:++l<u;)if(i(n[l],l,n))return l;return-1}return np=e,np}var rp,yS;function fq(){if(yS)return rp;yS=1;function e(n){return n!==n}return rp=e,rp}var ip,wS;function dq(){if(wS)return ip;wS=1;function e(n,i,s){for(var o=s-1,u=n.length;++o<u;)if(n[o]===i)return o;return-1}return ip=e,ip}var sp,xS;function hq(){if(xS)return sp;xS=1;var e=BN(),n=fq(),i=dq();function s(o,u,l){return u===u?i(o,u,l):e(o,n,l)}return sp=s,sp}var op,_S;function pq(){if(_S)return op;_S=1;var e=hq();function n(i,s){var o=i==null?0:i.length;return!!o&&e(i,s,0)>-1}return op=n,op}var ap,SS;function mq(){if(SS)return ap;SS=1;function e(n,i,s){for(var o=-1,u=n==null?0:n.length;++o<u;)if(s(i,n[o]))return!0;return!1}return ap=e,ap}var up,bS;function gq(){if(bS)return up;bS=1;function e(){}return up=e,up}var lp,kS;function vq(){if(kS)return lp;kS=1;var e=mN(),n=gq(),i=ov(),s=1/0,o=e&&1/i(new e([,-0]))[1]==s?function(u){return new e(u)}:n;return lp=o,lp}var cp,ES;function yq(){if(ES)return cp;ES=1;var e=kN(),n=pq(),i=mq(),s=EN(),o=vq(),u=ov(),l=200;function c(d,h,p){var m=-1,v=n,x=d.length,C=!0,_=[],S=_;if(p)C=!1,v=i;else if(x>=l){var b=h?null:o(d);if(b)return u(b);C=!1,v=s,S=new e}else S=h?[]:_;e:for(;++m<x;){var N=d[m],E=h?h(N):N;if(N=p||N!==0?N:0,C&&E===E){for(var k=S.length;k--;)if(S[k]===E)continue e;h&&S.push(E),_.push(N)}else v(S,E,p)||(S!==_&&S.push(E),_.push(N))}return _}return cp=c,cp}var fp,NS;function UN(){if(NS)return fp;NS=1;var e=yr(),n=Zn();function i(s){return n(s)&&e(s)}return fp=i,fp}var dp,CS;function wq(){if(CS)return dp;CS=1;var e=uv(),n=Fu(),i=yq(),s=UN(),o=n(function(u){return i(e(u,1,s,!0))});return dp=o,dp}var hp,RS;function xq(){if(RS)return hp;RS=1;var e=Lu();function n(i,s){return e(s,function(o){return i[o]})}return hp=n,hp}var pp,TS;function HN(){if(TS)return pp;TS=1;var e=xq(),n=Kr();function i(s){return s==null?[]:e(s,n(s))}return pp=i,pp}var mp,jS;function Nn(){if(jS)return mp;jS=1;var e;if(typeof Gg=="function")try{e={clone:CO(),constant:rv(),each:bN(),filter:PN(),has:ON(),isArray:_t(),isEmpty:QO(),isFunction:Po(),isUndefined:qN(),keys:Kr(),map:$N(),reduce:DN(),size:sq(),transform:oq(),union:wq(),values:HN()}}catch{}return e||(e=window._),mp=e,mp}var gp,AS;function lv(){if(AS)return gp;AS=1;var e=Nn();gp=o;var n="\0",i="\0",s="";function o(p){this._isDirected=e.has(p,"directed")?p.directed:!0,this._isMultigraph=e.has(p,"multigraph")?p.multigraph:!1,this._isCompound=e.has(p,"compound")?p.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[i]={}),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(p){return this._label=p,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultNodeLabelFn=p,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var p=this;return e.filter(this.nodes(),function(m){return e.isEmpty(p._in[m])})},o.prototype.sinks=function(){var p=this;return e.filter(this.nodes(),function(m){return e.isEmpty(p._out[m])})},o.prototype.setNodes=function(p,m){var v=arguments,x=this;return e.each(p,function(C){v.length>1?x.setNode(C,m):x.setNode(C)}),this},o.prototype.setNode=function(p,m){return e.has(this._nodes,p)?(arguments.length>1&&(this._nodes[p]=m),this):(this._nodes[p]=arguments.length>1?m:this._defaultNodeLabelFn(p),this._isCompound&&(this._parent[p]=i,this._children[p]={},this._children[i][p]=!0),this._in[p]={},this._preds[p]={},this._out[p]={},this._sucs[p]={},++this._nodeCount,this)},o.prototype.node=function(p){return this._nodes[p]},o.prototype.hasNode=function(p){return e.has(this._nodes,p)},o.prototype.removeNode=function(p){var m=this;if(e.has(this._nodes,p)){var v=function(x){m.removeEdge(m._edgeObjs[x])};delete this._nodes[p],this._isCompound&&(this._removeFromParentsChildList(p),delete this._parent[p],e.each(this.children(p),function(x){m.setParent(x)}),delete this._children[p]),e.each(e.keys(this._in[p]),v),delete this._in[p],delete this._preds[p],e.each(e.keys(this._out[p]),v),delete this._out[p],delete this._sucs[p],--this._nodeCount}return this},o.prototype.setParent=function(p,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=i;else{m+="";for(var v=m;!e.isUndefined(v);v=this.parent(v))if(v===p)throw new Error("Setting "+m+" as parent of "+p+" would create a cycle");this.setNode(m)}return this.setNode(p),this._removeFromParentsChildList(p),this._parent[p]=m,this._children[m][p]=!0,this},o.prototype._removeFromParentsChildList=function(p){delete this._children[this._parent[p]][p]},o.prototype.parent=function(p){if(this._isCompound){var m=this._parent[p];if(m!==i)return m}},o.prototype.children=function(p){if(e.isUndefined(p)&&(p=i),this._isCompound){var m=this._children[p];if(m)return e.keys(m)}else{if(p===i)return this.nodes();if(this.hasNode(p))return[]}},o.prototype.predecessors=function(p){var m=this._preds[p];if(m)return e.keys(m)},o.prototype.successors=function(p){var m=this._sucs[p];if(m)return e.keys(m)},o.prototype.neighbors=function(p){var m=this.predecessors(p);if(m)return e.union(m,this.successors(p))},o.prototype.isLeaf=function(p){var m;return this.isDirected()?m=this.successors(p):m=this.neighbors(p),m.length===0},o.prototype.filterNodes=function(p){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var v=this;e.each(this._nodes,function(_,S){p(S)&&m.setNode(S,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,v.edge(_))});var x={};function C(_){var S=v.parent(_);return S===void 0||m.hasNode(S)?(x[_]=S,S):S in x?x[S]:C(S)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,C(_))}),m},o.prototype.setDefaultEdgeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultEdgeLabelFn=p,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(p,m){var v=this,x=arguments;return e.reduce(p,function(C,_){return x.length>1?v.setEdge(C,_,m):v.setEdge(C,_),_}),this},o.prototype.setEdge=function(){var p,m,v,x,C=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(p=_.v,m=_.w,v=_.name,arguments.length===2&&(x=arguments[1],C=!0)):(p=_,m=arguments[1],v=arguments[3],arguments.length>2&&(x=arguments[2],C=!0)),p=""+p,m=""+m,e.isUndefined(v)||(v=""+v);var S=c(this._isDirected,p,m,v);if(e.has(this._edgeLabels,S))return C&&(this._edgeLabels[S]=x),this;if(!e.isUndefined(v)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(p),this.setNode(m),this._edgeLabels[S]=C?x:this._defaultEdgeLabelFn(p,m,v);var b=d(this._isDirected,p,m,v);return p=b.v,m=b.w,Object.freeze(b),this._edgeObjs[S]=b,u(this._preds[m],p),u(this._sucs[p],m),this._in[m][S]=b,this._out[p][S]=b,this._edgeCount++,this},o.prototype.edge=function(p,m,v){var x=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,p,m,v);return this._edgeLabels[x]},o.prototype.hasEdge=function(p,m,v){var x=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,p,m,v);return e.has(this._edgeLabels,x)},o.prototype.removeEdge=function(p,m,v){var x=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,p,m,v),C=this._edgeObjs[x];return C&&(p=C.v,m=C.w,delete this._edgeLabels[x],delete this._edgeObjs[x],l(this._preds[m],p),l(this._sucs[p],m),delete this._in[m][x],delete this._out[p][x],this._edgeCount--),this},o.prototype.inEdges=function(p,m){var v=this._in[p];if(v){var x=e.values(v);return m?e.filter(x,function(C){return C.v===m}):x}},o.prototype.outEdges=function(p,m){var v=this._out[p];if(v){var x=e.values(v);return m?e.filter(x,function(C){return C.w===m}):x}},o.prototype.nodeEdges=function(p,m){var v=this.inEdges(p,m);if(v)return v.concat(this.outEdges(p,m))};function u(p,m){p[m]?p[m]++:p[m]=1}function l(p,m){--p[m]||delete p[m]}function c(p,m,v,x){var C=""+m,_=""+v;if(!p&&C>_){var S=C;C=_,_=S}return C+s+_+s+(e.isUndefined(x)?n:x)}function d(p,m,v,x){var C=""+m,_=""+v;if(!p&&C>_){var S=C;C=_,_=S}var b={v:C,w:_};return x&&(b.name=x),b}function h(p,m){return c(p,m.v,m.w,m.name)}return gp}var vp,IS;function _q(){return IS||(IS=1,vp="2.1.8"),vp}var yp,MS;function Sq(){return MS||(MS=1,yp={Graph:lv(),version:_q()}),yp}var wp,PS;function bq(){if(PS)return wp;PS=1;var e=Nn(),n=lv();wp={write:i,read:u};function i(l){var c={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:s(l),edges:o(l)};return e.isUndefined(l.graph())||(c.value=e.clone(l.graph())),c}function s(l){return e.map(l.nodes(),function(c){var d=l.node(c),h=l.parent(c),p={v:c};return e.isUndefined(d)||(p.value=d),e.isUndefined(h)||(p.parent=h),p})}function o(l){return e.map(l.edges(),function(c){var d=l.edge(c),h={v:c.v,w:c.w};return e.isUndefined(c.name)||(h.name=c.name),e.isUndefined(d)||(h.value=d),h})}function u(l){var c=new n(l.options).setGraph(l.value);return e.each(l.nodes,function(d){c.setNode(d.v,d.value),d.parent&&c.setParent(d.v,d.parent)}),e.each(l.edges,function(d){c.setEdge({v:d.v,w:d.w,name:d.name},d.value)}),c}return wp}var xp,OS;function kq(){if(OS)return xp;OS=1;var e=Nn();xp=n;function n(i){var s={},o=[],u;function l(c){e.has(s,c)||(s[c]=!0,u.push(c),e.each(i.successors(c),l),e.each(i.predecessors(c),l))}return e.each(i.nodes(),function(c){u=[],l(c),u.length&&o.push(u)}),o}return xp}var _p,qS;function VN(){if(qS)return _p;qS=1;var e=Nn();_p=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(i){return i.key})},n.prototype.has=function(i){return e.has(this._keyIndices,i)},n.prototype.priority=function(i){var s=this._keyIndices[i];if(s!==void 0)return this._arr[s].priority},n.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(i,s){var o=this._keyIndices;if(i=String(i),!e.has(o,i)){var u=this._arr,l=u.length;return o[i]=l,u.push({key:i,priority:s}),this._decrease(l),!0}return!1},n.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var i=this._arr.pop();return delete this._keyIndices[i.key],this._heapify(0),i.key},n.prototype.decrease=function(i,s){var o=this._keyIndices[i];if(s>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+i+" Old: "+this._arr[o].priority+" New: "+s);this._arr[o].priority=s,this._decrease(o)},n.prototype._heapify=function(i){var s=this._arr,o=2*i,u=o+1,l=i;o<s.length&&(l=s[o].priority<s[l].priority?o:l,u<s.length&&(l=s[u].priority<s[l].priority?u:l),l!==i&&(this._swap(i,l),this._heapify(l)))},n.prototype._decrease=function(i){for(var s=this._arr,o=s[i].priority,u;i!==0&&(u=i>>1,!(s[u].priority<o));)this._swap(i,u),i=u},n.prototype._swap=function(i,s){var o=this._arr,u=this._keyIndices,l=o[i],c=o[s];o[i]=c,o[s]=l,u[c.key]=i,u[l.key]=s},_p}var Sp,LS;function WN(){if(LS)return Sp;LS=1;var e=Nn(),n=VN();Sp=s;var i=e.constant(1);function s(u,l,c,d){return o(u,String(l),c||i,d||function(h){return u.outEdges(h)})}function o(u,l,c,d){var h={},p=new n,m,v,x=function(C){var _=C.v!==m?C.v:C.w,S=h[_],b=c(C),N=v.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+C+" Weight: "+b);N<S.distance&&(S.distance=N,S.predecessor=m,p.decrease(_,N))};for(u.nodes().forEach(function(C){var _=C===l?0:Number.POSITIVE_INFINITY;h[C]={distance:_},p.add(C,_)});p.size()>0&&(m=p.removeMin(),v=h[m],v.distance!==Number.POSITIVE_INFINITY);)d(m).forEach(x);return h}return Sp}var bp,$S;function Eq(){if($S)return bp;$S=1;var e=WN(),n=Nn();bp=i;function i(s,o,u){return n.transform(s.nodes(),function(l,c){l[c]=e(s,c,o,u)},{})}return bp}var kp,DS;function GN(){if(DS)return kp;DS=1;var e=Nn();kp=n;function n(i){var s=0,o=[],u={},l=[];function c(d){var h=u[d]={onStack:!0,lowlink:s,index:s++};if(o.push(d),i.successors(d).forEach(function(v){e.has(u,v)?u[v].onStack&&(h.lowlink=Math.min(h.lowlink,u[v].index)):(c(v),h.lowlink=Math.min(h.lowlink,u[v].lowlink))}),h.lowlink===h.index){var p=[],m;do m=o.pop(),u[m].onStack=!1,p.push(m);while(d!==m);l.push(p)}}return i.nodes().forEach(function(d){e.has(u,d)||c(d)}),l}return kp}var Ep,FS;function Nq(){if(FS)return Ep;FS=1;var e=Nn(),n=GN();Ep=i;function i(s){return e.filter(n(s),function(o){return o.length>1||o.length===1&&s.hasEdge(o[0],o[0])})}return Ep}var Np,zS;function Cq(){if(zS)return Np;zS=1;var e=Nn();Np=i;var n=e.constant(1);function i(o,u,l){return s(o,u||n,l||function(c){return o.outEdges(c)})}function s(o,u,l){var c={},d=o.nodes();return d.forEach(function(h){c[h]={},c[h][h]={distance:0},d.forEach(function(p){h!==p&&(c[h][p]={distance:Number.POSITIVE_INFINITY})}),l(h).forEach(function(p){var m=p.v===h?p.w:p.v,v=u(p);c[h][m]={distance:v,predecessor:h}})}),d.forEach(function(h){var p=c[h];d.forEach(function(m){var v=c[m];d.forEach(function(x){var C=v[h],_=p[x],S=v[x],b=C.distance+_.distance;b<S.distance&&(S.distance=b,S.predecessor=_.predecessor)})})}),c}return Np}var Cp,BS;function YN(){if(BS)return Cp;BS=1;var e=Nn();Cp=n,n.CycleException=i;function n(s){var o={},u={},l=[];function c(d){if(e.has(u,d))throw new i;e.has(o,d)||(u[d]=!0,o[d]=!0,e.each(s.predecessors(d),c),delete u[d],l.push(d))}if(e.each(s.sinks(),c),e.size(o)!==s.nodeCount())throw new i;return l}function i(){}return i.prototype=new Error,Cp}var Rp,US;function Rq(){if(US)return Rp;US=1;var e=YN();Rp=n;function n(i){try{e(i)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return Rp}var Tp,HS;function KN(){if(HS)return Tp;HS=1;var e=Nn();Tp=n;function n(s,o,u){e.isArray(o)||(o=[o]);var l=(s.isDirected()?s.successors:s.neighbors).bind(s),c=[],d={};return e.each(o,function(h){if(!s.hasNode(h))throw new Error("Graph does not have node: "+h);i(s,h,u==="post",d,l,c)}),c}function i(s,o,u,l,c,d){e.has(l,o)||(l[o]=!0,u||d.push(o),e.each(c(o),function(h){i(s,h,u,l,c,d)}),u&&d.push(o))}return Tp}var jp,VS;function Tq(){if(VS)return jp;VS=1;var e=KN();jp=n;function n(i,s){return e(i,s,"post")}return jp}var Ap,WS;function jq(){if(WS)return Ap;WS=1;var e=KN();Ap=n;function n(i,s){return e(i,s,"pre")}return Ap}var Ip,GS;function Aq(){if(GS)return Ip;GS=1;var e=Nn(),n=lv(),i=VN();Ip=s;function s(o,u){var l=new n,c={},d=new i,h;function p(v){var x=v.v===h?v.w:v.v,C=d.priority(x);if(C!==void 0){var _=u(v);_<C&&(c[x]=h,d.decrease(x,_))}}if(o.nodeCount()===0)return l;e.each(o.nodes(),function(v){d.add(v,Number.POSITIVE_INFINITY),l.setNode(v)}),d.decrease(o.nodes()[0],0);for(var m=!1;d.size()>0;){if(h=d.removeMin(),e.has(c,h))l.setEdge(h,c[h]);else{if(m)throw new Error("Input graph is not connected: "+o);m=!0}o.nodeEdges(h).forEach(p)}return l}return Ip}var Mp,YS;function Iq(){return YS||(YS=1,Mp={components:kq(),dijkstra:WN(),dijkstraAll:Eq(),findCycles:Nq(),floydWarshall:Cq(),isAcyclic:Rq(),postorder:Tq(),preorder:jq(),prim:Aq(),tarjan:GN(),topsort:YN()}),Mp}var Pp,KS;function Mq(){if(KS)return Pp;KS=1;var e=Sq();return Pp={Graph:e.Graph,json:bq(),alg:Iq(),version:e.version},Pp}var Op,XS;function Bn(){if(XS)return Op;XS=1;var e;if(typeof Gg=="function")try{e=Mq()}catch{}return e||(e=window.graphlib),Op=e,Op}var qp,QS;function Pq(){if(QS)return qp;QS=1;var e=xN(),n=1,i=4;function s(o){return e(o,n|i)}return qp=s,qp}var Lp,ZS;function zu(){if(ZS)return Lp;ZS=1;var e=xs(),n=yr(),i=Iu(),s=En();function o(u,l,c){if(!s(c))return!1;var d=typeof l;return(d=="number"?n(c)&&i(l,c.length):d=="string"&&l in c)?e(c[l],u):!1}return Lp=o,Lp}var $p,JS;function Oq(){if(JS)return $p;JS=1;var e=Fu(),n=xs(),i=zu(),s=Ti(),o=Object.prototype,u=o.hasOwnProperty,l=e(function(c,d){c=Object(c);var h=-1,p=d.length,m=p>2?d[2]:void 0;for(m&&i(d[0],d[1],m)&&(p=1);++h<p;)for(var v=d[h],x=s(v),C=-1,_=x.length;++C<_;){var S=x[C],b=c[S];(b===void 0||n(b,o[S])&&!u.call(c,S))&&(c[S]=v[S])}return c});return $p=l,$p}var Dp,eb;function qq(){if(eb)return Dp;eb=1;var e=wr(),n=yr(),i=Kr();function s(o){return function(u,l,c){var d=Object(u);if(!n(u)){var h=e(l,3);u=i(u),l=function(m){return h(d[m],m,d)}}var p=o(u,l,c);return p>-1?d[h?u[p]:p]:void 0}}return Dp=s,Dp}var Fp,tb;function Lq(){if(tb)return Fp;tb=1;var e=/\s/;function n(i){for(var s=i.length;s--&&e.test(i.charAt(s)););return s}return Fp=n,Fp}var zp,nb;function $q(){if(nb)return zp;nb=1;var e=Lq(),n=/^\s+/;function i(s){return s&&s.slice(0,e(s)+1).replace(n,"")}return zp=i,zp}var Bp,rb;function Dq(){if(rb)return Bp;rb=1;var e=$q(),n=En(),i=ks(),s=NaN,o=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;function d(h){if(typeof h=="number")return h;if(i(h))return s;if(n(h)){var p=typeof h.valueOf=="function"?h.valueOf():h;h=n(p)?p+"":p}if(typeof h!="string")return h===0?h:+h;h=e(h);var m=u.test(h);return m||l.test(h)?c(h.slice(2),m?2:8):o.test(h)?s:+h}return Bp=d,Bp}var Up,ib;function XN(){if(ib)return Up;ib=1;var e=Dq(),n=1/0,i=17976931348623157e292;function s(o){if(!o)return o===0?o:0;if(o=e(o),o===n||o===-n){var u=o<0?-1:1;return u*i}return o===o?o:0}return Up=s,Up}var Hp,sb;function Fq(){if(sb)return Hp;sb=1;var e=XN();function n(i){var s=e(i),o=s%1;return s===s?o?s-o:s:0}return Hp=n,Hp}var Vp,ob;function zq(){if(ob)return Vp;ob=1;var e=BN(),n=wr(),i=Fq(),s=Math.max;function o(u,l,c){var d=u==null?0:u.length;if(!d)return-1;var h=c==null?0:i(c);return h<0&&(h=s(d+h,0)),e(u,n(l,3),h)}return Vp=o,Vp}var Wp,ab;function Bq(){if(ab)return Wp;ab=1;var e=qq(),n=zq(),i=e(n);return Wp=i,Wp}var Gp,ub;function QN(){if(ub)return Gp;ub=1;var e=uv();function n(i){var s=i==null?0:i.length;return s?e(i,1):[]}return Gp=n,Gp}var Yp,lb;function Uq(){if(lb)return Yp;lb=1;var e=iv(),n=_N(),i=Ti();function s(o,u){return o==null?o:e(o,n(u),i)}return Yp=s,Yp}var Kp,cb;function Hq(){if(cb)return Kp;cb=1;function e(n){var i=n==null?0:n.length;return i?n[i-1]:void 0}return Kp=e,Kp}var Xp,fb;function Vq(){if(fb)return Xp;fb=1;var e=ju(),n=sv(),i=wr();function s(o,u){var l={};return u=i(u,3),n(o,function(c,d,h){e(l,d,u(c,d,h))}),l}return Xp=s,Xp}var Qp,db;function cv(){if(db)return Qp;db=1;var e=ks();function n(i,s,o){for(var u=-1,l=i.length;++u<l;){var c=i[u],d=s(c);if(d!=null&&(h===void 0?d===d&&!e(d):o(d,h)))var h=d,p=c}return p}return Qp=n,Qp}var Zp,hb;function Wq(){if(hb)return Zp;hb=1;function e(n,i){return n>i}return Zp=e,Zp}var Jp,pb;function Gq(){if(pb)return Jp;pb=1;var e=cv(),n=Wq(),i=ji();function s(o){return o&&o.length?e(o,i,n):void 0}return Jp=s,Jp}var em,mb;function ZN(){if(mb)return em;mb=1;var e=ju(),n=xs();function i(s,o,u){(u!==void 0&&!n(s[o],u)||u===void 0&&!(o in s))&&e(s,o,u)}return em=i,em}var tm,gb;function Yq(){if(gb)return tm;gb=1;var e=Ci(),n=Ou(),i=Zn(),s="[object Object]",o=Function.prototype,u=Object.prototype,l=o.toString,c=u.hasOwnProperty,d=l.call(Object);function h(p){if(!i(p)||e(p)!=s)return!1;var m=n(p);if(m===null)return!0;var v=c.call(m,"constructor")&&m.constructor;return typeof v=="function"&&v instanceof v&&l.call(v)==d}return tm=h,tm}var nm,vb;function JN(){if(vb)return nm;vb=1;function e(n,i){if(!(i==="constructor"&&typeof n[i]=="function")&&i!="__proto__")return n[i]}return nm=e,nm}var rm,yb;function Kq(){if(yb)return rm;yb=1;var e=Oo(),n=Ti();function i(s){return e(s,n(s))}return rm=i,rm}var im,wb;function Xq(){if(wb)return im;wb=1;var e=ZN(),n=uN(),i=vN(),s=lN(),o=wN(),u=qo(),l=_t(),c=UN(),d=Ss(),h=Po(),p=En(),m=Yq(),v=Lo(),x=JN(),C=Kq();function _(S,b,N,E,k,j,I){var P=x(S,N),D=x(b,N),A=I.get(D);if(A){e(S,N,A);return}var F=j?j(P,D,N+"",S,b,I):void 0,q=F===void 0;if(q){var Q=l(D),K=!Q&&d(D),T=!Q&&!K&&v(D);F=D,Q||K||T?l(P)?F=P:c(P)?F=s(P):K?(q=!1,F=n(D,!0)):T?(q=!1,F=i(D,!0)):F=[]:m(D)||u(D)?(F=P,u(P)?F=C(P):(!p(P)||h(P))&&(F=o(D))):q=!1}q&&(I.set(D,F),k(F,D,E,j,I),I.delete(D)),e(S,N,F)}return im=_,im}var sm,xb;function Qq(){if(xb)return sm;xb=1;var e=Tu(),n=ZN(),i=iv(),s=Xq(),o=En(),u=Ti(),l=JN();function c(d,h,p,m,v){d!==h&&i(h,function(x,C){if(v||(v=new e),o(x))s(d,h,C,p,c,m,v);else{var _=m?m(l(d,C),x,C+"",d,h,v):void 0;_===void 0&&(_=x),n(d,C,_)}},u)}return sm=c,sm}var om,_b;function Zq(){if(_b)return om;_b=1;var e=Fu(),n=zu();function i(s){return e(function(o,u){var l=-1,c=u.length,d=c>1?u[c-1]:void 0,h=c>2?u[2]:void 0;for(d=s.length>3&&typeof d=="function"?(c--,d):void 0,h&&n(u[0],u[1],h)&&(d=c<3?void 0:d,c=1),o=Object(o);++l<c;){var p=u[l];p&&s(o,p,l,d)}return o})}return om=i,om}var am,Sb;function Jq(){if(Sb)return am;Sb=1;var e=Qq(),n=Zq(),i=n(function(s,o,u){e(s,o,u)});return am=i,am}var um,bb;function eC(){if(bb)return um;bb=1;function e(n,i){return n<i}return um=e,um}var lm,kb;function eL(){if(kb)return lm;kb=1;var e=cv(),n=eC(),i=ji();function s(o){return o&&o.length?e(o,i,n):void 0}return lm=s,lm}var cm,Eb;function tL(){if(Eb)return cm;Eb=1;var e=cv(),n=wr(),i=eC();function s(o,u){return o&&o.length?e(o,n(u,2),i):void 0}return cm=s,cm}var fm,Nb;function nL(){if(Nb)return fm;Nb=1;var e=Hn(),n=function(){return e.Date.now()};return fm=n,fm}var dm,Cb;function rL(){if(Cb)return dm;Cb=1;var e=Au(),n=$u(),i=Iu(),s=En(),o=$o();function u(l,c,d,h){if(!s(l))return l;c=n(c,l);for(var p=-1,m=c.length,v=m-1,x=l;x!=null&&++p<m;){var C=o(c[p]),_=d;if(C==="__proto__"||C==="constructor"||C==="prototype")return l;if(p!=v){var S=x[C];_=h?h(S,C,x):void 0,_===void 0&&(_=s(S)?S:i(c[p+1])?[]:{})}e(x,C,_),x=x[C]}return l}return dm=u,dm}var hm,Rb;function iL(){if(Rb)return hm;Rb=1;var e=Du(),n=rL(),i=$u();function s(o,u,l){for(var c=-1,d=u.length,h={};++c<d;){var p=u[c],m=e(o,p);l(m,p)&&n(h,i(p,o),m)}return h}return hm=s,hm}var pm,Tb;function sL(){if(Tb)return pm;Tb=1;var e=iL(),n=IN();function i(s,o){return e(s,o,function(u,l){return n(s,l)})}return pm=i,pm}var mm,jb;function oL(){if(jb)return mm;jb=1;var e=QN(),n=FN(),i=zN();function s(o){return i(n(o,void 0,e),o+"")}return mm=s,mm}var gm,Ab;function aL(){if(Ab)return gm;Ab=1;var e=sL(),n=oL(),i=n(function(s,o){return s==null?{}:e(s,o)});return gm=i,gm}var vm,Ib;function uL(){if(Ib)return vm;Ib=1;var e=Math.ceil,n=Math.max;function i(s,o,u,l){for(var c=-1,d=n(e((o-s)/(u||1)),0),h=Array(d);d--;)h[l?d:++c]=s,s+=u;return h}return vm=i,vm}var ym,Mb;function lL(){if(Mb)return ym;Mb=1;var e=uL(),n=zu(),i=XN();function s(o){return function(u,l,c){return c&&typeof c!="number"&&n(u,l,c)&&(l=c=void 0),u=i(u),l===void 0?(l=u,u=0):l=i(l),c=c===void 0?u<l?1:-1:i(c),e(u,l,c,o)}}return ym=s,ym}var wm,Pb;function cL(){if(Pb)return wm;Pb=1;var e=lL(),n=e();return wm=n,wm}var xm,Ob;function fL(){if(Ob)return xm;Ob=1;function e(n,i){var s=n.length;for(n.sort(i);s--;)n[s]=n[s].value;return n}return xm=e,xm}var _m,qb;function dL(){if(qb)return _m;qb=1;var e=ks();function n(i,s){if(i!==s){var o=i!==void 0,u=i===null,l=i===i,c=e(i),d=s!==void 0,h=s===null,p=s===s,m=e(s);if(!h&&!m&&!c&&i>s||c&&d&&p&&!h&&!m||u&&d&&p||!o&&p||!l)return 1;if(!u&&!c&&!m&&i<s||m&&o&&l&&!u&&!c||h&&o&&l||!d&&l||!p)return-1}return 0}return _m=n,_m}var Sm,Lb;function hL(){if(Lb)return Sm;Lb=1;var e=dL();function n(i,s,o){for(var u=-1,l=i.criteria,c=s.criteria,d=l.length,h=o.length;++u<d;){var p=e(l[u],c[u]);if(p){if(u>=h)return p;var m=o[u];return p*(m=="desc"?-1:1)}}return i.index-s.index}return Sm=n,Sm}var bm,$b;function pL(){if($b)return bm;$b=1;var e=Lu(),n=Du(),i=wr(),s=LN(),o=fL(),u=Mu(),l=hL(),c=ji(),d=_t();function h(p,m,v){m.length?m=e(m,function(_){return d(_)?function(S){return n(S,_.length===1?_[0]:_)}:_}):m=[c];var x=-1;m=e(m,u(i));var C=s(p,function(_,S,b){var N=e(m,function(E){return E(_)});return{criteria:N,index:++x,value:_}});return o(C,function(_,S){return l(_,S,v)})}return bm=h,bm}var km,Db;function mL(){if(Db)return km;Db=1;var e=uv(),n=pL(),i=Fu(),s=zu(),o=i(function(u,l){if(u==null)return[];var c=l.length;return c>1&&s(u,l[0],l[1])?l=[]:c>2&&s(l[0],l[1],l[2])&&(l=[l[0]]),n(u,e(l,1),[])});return km=o,km}var Em,Fb;function gL(){if(Fb)return Em;Fb=1;var e=jN(),n=0;function i(s){var o=++n;return e(s)+o}return Em=i,Em}var Nm,zb;function vL(){if(zb)return Nm;zb=1;function e(n,i,s){for(var o=-1,u=n.length,l=i.length,c={};++o<u;){var d=o<l?i[o]:void 0;s(c,n[o],d)}return c}return Nm=e,Nm}var Cm,Bb;function yL(){if(Bb)return Cm;Bb=1;var e=Au(),n=vL();function i(s,o){return n(s||[],o||[],e)}return Cm=i,Cm}var Rm,Ub;function it(){if(Ub)return Rm;Ub=1;var e;if(typeof Gg=="function")try{e={cloneDeep:Pq(),constant:rv(),defaults:Oq(),each:bN(),filter:PN(),find:Bq(),flatten:QN(),forEach:SN(),forIn:Uq(),has:ON(),isUndefined:qN(),last:Hq(),map:$N(),mapValues:Vq(),max:Gq(),merge:Jq(),min:eL(),minBy:tL(),now:nL(),pick:aL(),range:cL(),reduce:DN(),sortBy:mL(),uniqueId:gL(),values:HN(),zipObject:yL()}}catch{}return e||(e=window._),Rm=e,Rm}var Tm,Hb;function wL(){if(Hb)return Tm;Hb=1,Tm=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,o=s._prev;if(o!==s)return n(o),o},e.prototype.enqueue=function(s){var o=this._sentinel;s._prev&&s._next&&n(s),s._next=o._next,o._next._prev=s,o._next=s,s._prev=o},e.prototype.toString=function(){for(var s=[],o=this._sentinel,u=o._prev;u!==o;)s.push(JSON.stringify(u,i)),u=u._prev;return"["+s.join(", ")+"]"};function n(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function i(s,o){if(s!=="_next"&&s!=="_prev")return o}return Tm}var jm,Vb;function xL(){if(Vb)return jm;Vb=1;var e=it(),n=Bn().Graph,i=wL();jm=o;var s=e.constant(1);function o(h,p){if(h.nodeCount()<=1)return[];var m=c(h,p||s),v=u(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(v,function(x){return h.outEdges(x.v,x.w)}),!0)}function u(h,p,m){for(var v=[],x=p[p.length-1],C=p[0],_;h.nodeCount();){for(;_=C.dequeue();)l(h,p,m,_);for(;_=x.dequeue();)l(h,p,m,_);if(h.nodeCount()){for(var S=p.length-2;S>0;--S)if(_=p[S].dequeue(),_){v=v.concat(l(h,p,m,_,!0));break}}}return v}function l(h,p,m,v,x){var C=x?[]:void 0;return e.forEach(h.inEdges(v.v),function(_){var S=h.edge(_),b=h.node(_.v);x&&C.push({v:_.v,w:_.w}),b.out-=S,d(p,m,b)}),e.forEach(h.outEdges(v.v),function(_){var S=h.edge(_),b=_.w,N=h.node(b);N.in-=S,d(p,m,N)}),h.removeNode(v.v),C}function c(h,p){var m=new n,v=0,x=0;e.forEach(h.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),e.forEach(h.edges(),function(S){var b=m.edge(S.v,S.w)||0,N=p(S),E=b+N;m.setEdge(S.v,S.w,E),x=Math.max(x,m.node(S.v).out+=N),v=Math.max(v,m.node(S.w).in+=N)});var C=e.range(x+v+3).map(function(){return new i}),_=v+1;return e.forEach(m.nodes(),function(S){d(C,_,m.node(S))}),{graph:m,buckets:C,zeroIdx:_}}function d(h,p,m){m.out?m.in?h[m.out-m.in+p].enqueue(m):h[h.length-1].enqueue(m):h[0].enqueue(m)}return jm}var Am,Wb;function _L(){if(Wb)return Am;Wb=1;var e=it(),n=xL();Am={run:i,undo:o};function i(u){var l=u.graph().acyclicer==="greedy"?n(u,c(u)):s(u);e.forEach(l,function(d){var h=u.edge(d);u.removeEdge(d),h.forwardName=d.name,h.reversed=!0,u.setEdge(d.w,d.v,h,e.uniqueId("rev"))});function c(d){return function(h){return d.edge(h).weight}}}function s(u){var l=[],c={},d={};function h(p){e.has(d,p)||(d[p]=!0,c[p]=!0,e.forEach(u.outEdges(p),function(m){e.has(c,m.w)?l.push(m):h(m.w)}),delete c[p])}return e.forEach(u.nodes(),h),l}function o(u){e.forEach(u.edges(),function(l){var c=u.edge(l);if(c.reversed){u.removeEdge(l);var d=c.forwardName;delete c.reversed,delete c.forwardName,u.setEdge(l.w,l.v,c,d)}})}return Am}var Im,Gb;function nn(){if(Gb)return Im;Gb=1;var e=it(),n=Bn().Graph;Im={addDummyNode:i,simplify:s,asNonCompoundGraph:o,successorWeights:u,predecessorWeights:l,intersectRect:c,buildLayerMatrix:d,normalizeRanks:h,removeEmptyRanks:p,addBorderNode:m,maxRank:v,partition:x,time:C,notime:_};function i(S,b,N,E){var k;do k=e.uniqueId(E);while(S.hasNode(k));return N.dummy=b,S.setNode(k,N),k}function s(S){var b=new n().setGraph(S.graph());return e.forEach(S.nodes(),function(N){b.setNode(N,S.node(N))}),e.forEach(S.edges(),function(N){var E=b.edge(N.v,N.w)||{weight:0,minlen:1},k=S.edge(N);b.setEdge(N.v,N.w,{weight:E.weight+k.weight,minlen:Math.max(E.minlen,k.minlen)})}),b}function o(S){var b=new n({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(N){S.children(N).length||b.setNode(N,S.node(N))}),e.forEach(S.edges(),function(N){b.setEdge(N,S.edge(N))}),b}function u(S){var b=e.map(S.nodes(),function(N){var E={};return e.forEach(S.outEdges(N),function(k){E[k.w]=(E[k.w]||0)+S.edge(k).weight}),E});return e.zipObject(S.nodes(),b)}function l(S){var b=e.map(S.nodes(),function(N){var E={};return e.forEach(S.inEdges(N),function(k){E[k.v]=(E[k.v]||0)+S.edge(k).weight}),E});return e.zipObject(S.nodes(),b)}function c(S,b){var N=S.x,E=S.y,k=b.x-N,j=b.y-E,I=S.width/2,P=S.height/2;if(!k&&!j)throw new Error("Not possible to find intersection inside of the rectangle");var D,A;return Math.abs(j)*I>Math.abs(k)*P?(j<0&&(P=-P),D=P*k/j,A=P):(k<0&&(I=-I),D=I,A=I*j/k),{x:N+D,y:E+A}}function d(S){var b=e.map(e.range(v(S)+1),function(){return[]});return e.forEach(S.nodes(),function(N){var E=S.node(N),k=E.rank;e.isUndefined(k)||(b[k][E.order]=N)}),b}function h(S){var b=e.min(e.map(S.nodes(),function(N){return S.node(N).rank}));e.forEach(S.nodes(),function(N){var E=S.node(N);e.has(E,"rank")&&(E.rank-=b)})}function p(S){var b=e.min(e.map(S.nodes(),function(j){return S.node(j).rank})),N=[];e.forEach(S.nodes(),function(j){var I=S.node(j).rank-b;N[I]||(N[I]=[]),N[I].push(j)});var E=0,k=S.graph().nodeRankFactor;e.forEach(N,function(j,I){e.isUndefined(j)&&I%k!==0?--E:E&&e.forEach(j,function(P){S.node(P).rank+=E})})}function m(S,b,N,E){var k={width:0,height:0};return arguments.length>=4&&(k.rank=N,k.order=E),i(S,"border",k,b)}function v(S){return e.max(e.map(S.nodes(),function(b){var N=S.node(b).rank;if(!e.isUndefined(N))return N}))}function x(S,b){var N={lhs:[],rhs:[]};return e.forEach(S,function(E){b(E)?N.lhs.push(E):N.rhs.push(E)}),N}function C(S,b){var N=e.now();try{return b()}finally{console.log(S+" time: "+(e.now()-N)+"ms")}}function _(S,b){return b()}return Im}var Mm,Yb;function SL(){if(Yb)return Mm;Yb=1;var e=it(),n=nn();Mm={run:i,undo:o};function i(u){u.graph().dummyChains=[],e.forEach(u.edges(),function(l){s(u,l)})}function s(u,l){var c=l.v,d=u.node(c).rank,h=l.w,p=u.node(h).rank,m=l.name,v=u.edge(l),x=v.labelRank;if(p!==d+1){u.removeEdge(l);var C,_,S;for(S=0,++d;d<p;++S,++d)v.points=[],_={width:0,height:0,edgeLabel:v,edgeObj:l,rank:d},C=n.addDummyNode(u,"edge",_,"_d"),d===x&&(_.width=v.width,_.height=v.height,_.dummy="edge-label",_.labelpos=v.labelpos),u.setEdge(c,C,{weight:v.weight},m),S===0&&u.graph().dummyChains.push(C),c=C;u.setEdge(c,h,{weight:v.weight},m)}}function o(u){e.forEach(u.graph().dummyChains,function(l){var c=u.node(l),d=c.edgeLabel,h;for(u.setEdge(c.edgeObj,d);c.dummy;)h=u.successors(l)[0],u.removeNode(l),d.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(d.x=c.x,d.y=c.y,d.width=c.width,d.height=c.height),l=h,c=u.node(l)})}return Mm}var Pm,Kb;function vu(){if(Kb)return Pm;Kb=1;var e=it();Pm={longestPath:n,slack:i};function n(s){var o={};function u(l){var c=s.node(l);if(e.has(o,l))return c.rank;o[l]=!0;var d=e.min(e.map(s.outEdges(l),function(h){return u(h.w)-s.edge(h).minlen}));return(d===Number.POSITIVE_INFINITY||d===void 0||d===null)&&(d=0),c.rank=d}e.forEach(s.sources(),u)}function i(s,o){return s.node(o.w).rank-s.node(o.v).rank-s.edge(o).minlen}return Pm}var Om,Xb;function tC(){if(Xb)return Om;Xb=1;var e=it(),n=Bn().Graph,i=vu().slack;Om=s;function s(c){var d=new n({directed:!1}),h=c.nodes()[0],p=c.nodeCount();d.setNode(h,{});for(var m,v;o(d,c)<p;)m=u(d,c),v=d.hasNode(m.v)?i(c,m):-i(c,m),l(d,c,v);return d}function o(c,d){function h(p){e.forEach(d.nodeEdges(p),function(m){var v=m.v,x=p===v?m.w:v;!c.hasNode(x)&&!i(d,m)&&(c.setNode(x,{}),c.setEdge(p,x,{}),h(x))})}return e.forEach(c.nodes(),h),c.nodeCount()}function u(c,d){return e.minBy(d.edges(),function(h){if(c.hasNode(h.v)!==c.hasNode(h.w))return i(d,h)})}function l(c,d,h){e.forEach(c.nodes(),function(p){d.node(p).rank+=h})}return Om}var qm,Qb;function bL(){if(Qb)return qm;Qb=1;var e=it(),n=tC(),i=vu().slack,s=vu().longestPath,o=Bn().alg.preorder,u=Bn().alg.postorder,l=nn().simplify;qm=c,c.initLowLimValues=m,c.initCutValues=d,c.calcCutValue=p,c.leaveEdge=x,c.enterEdge=C,c.exchangeEdges=_;function c(E){E=l(E),s(E);var k=n(E);m(k),d(k,E);for(var j,I;j=x(k);)I=C(k,E,j),_(k,E,j,I)}function d(E,k){var j=u(E,E.nodes());j=j.slice(0,j.length-1),e.forEach(j,function(I){h(E,k,I)})}function h(E,k,j){var I=E.node(j),P=I.parent;E.edge(j,P).cutvalue=p(E,k,j)}function p(E,k,j){var I=E.node(j),P=I.parent,D=!0,A=k.edge(j,P),F=0;return A||(D=!1,A=k.edge(P,j)),F=A.weight,e.forEach(k.nodeEdges(j),function(q){var Q=q.v===j,K=Q?q.w:q.v;if(K!==P){var T=Q===D,Y=k.edge(q).weight;if(F+=T?Y:-Y,b(E,j,K)){var H=E.edge(j,K).cutvalue;F+=T?-H:H}}}),F}function m(E,k){arguments.length<2&&(k=E.nodes()[0]),v(E,{},1,k)}function v(E,k,j,I,P){var D=j,A=E.node(I);return k[I]=!0,e.forEach(E.neighbors(I),function(F){e.has(k,F)||(j=v(E,k,j,F,I))}),A.low=D,A.lim=j++,P?A.parent=P:delete A.parent,j}function x(E){return e.find(E.edges(),function(k){return E.edge(k).cutvalue<0})}function C(E,k,j){var I=j.v,P=j.w;k.hasEdge(I,P)||(I=j.w,P=j.v);var D=E.node(I),A=E.node(P),F=D,q=!1;D.lim>A.lim&&(F=A,q=!0);var Q=e.filter(k.edges(),function(K){return q===N(E,E.node(K.v),F)&&q!==N(E,E.node(K.w),F)});return e.minBy(Q,function(K){return i(k,K)})}function _(E,k,j,I){var P=j.v,D=j.w;E.removeEdge(P,D),E.setEdge(I.v,I.w,{}),m(E),d(E,k),S(E,k)}function S(E,k){var j=e.find(E.nodes(),function(P){return!k.node(P).parent}),I=o(E,j);I=I.slice(1),e.forEach(I,function(P){var D=E.node(P).parent,A=k.edge(P,D),F=!1;A||(A=k.edge(D,P),F=!0),k.node(P).rank=k.node(D).rank+(F?A.minlen:-A.minlen)})}function b(E,k,j){return E.hasEdge(k,j)}function N(E,k,j){return j.low<=k.lim&&k.lim<=j.lim}return qm}var Lm,Zb;function kL(){if(Zb)return Lm;Zb=1;var e=vu(),n=e.longestPath,i=tC(),s=bL();Lm=o;function o(d){switch(d.graph().ranker){case"network-simplex":c(d);break;case"tight-tree":l(d);break;case"longest-path":u(d);break;default:c(d)}}var u=n;function l(d){n(d),i(d)}function c(d){s(d)}return Lm}var $m,Jb;function EL(){if(Jb)return $m;Jb=1;var e=it();$m=n;function n(o){var u=s(o);e.forEach(o.graph().dummyChains,function(l){for(var c=o.node(l),d=c.edgeObj,h=i(o,u,d.v,d.w),p=h.path,m=h.lca,v=0,x=p[v],C=!0;l!==d.w;){if(c=o.node(l),C){for(;(x=p[v])!==m&&o.node(x).maxRank<c.rank;)v++;x===m&&(C=!1)}if(!C){for(;v<p.length-1&&o.node(x=p[v+1]).minRank<=c.rank;)v++;x=p[v]}o.setParent(l,x),l=o.successors(l)[0]}})}function i(o,u,l,c){var d=[],h=[],p=Math.min(u[l].low,u[c].low),m=Math.max(u[l].lim,u[c].lim),v,x;v=l;do v=o.parent(v),d.push(v);while(v&&(u[v].low>p||m>u[v].lim));for(x=v,v=c;(v=o.parent(v))!==x;)h.push(v);return{path:d.concat(h.reverse()),lca:x}}function s(o){var u={},l=0;function c(d){var h=l;e.forEach(o.children(d),c),u[d]={low:h,lim:l++}}return e.forEach(o.children(),c),u}return $m}var Dm,ek;function NL(){if(ek)return Dm;ek=1;var e=it(),n=nn();Dm={run:i,cleanup:l};function i(c){var d=n.addDummyNode(c,"root",{},"_root"),h=o(c),p=e.max(e.values(h))-1,m=2*p+1;c.graph().nestingRoot=d,e.forEach(c.edges(),function(x){c.edge(x).minlen*=m});var v=u(c)+1;e.forEach(c.children(),function(x){s(c,d,m,v,p,h,x)}),c.graph().nodeRankFactor=m}function s(c,d,h,p,m,v,x){var C=c.children(x);if(!C.length){x!==d&&c.setEdge(d,x,{weight:0,minlen:h});return}var _=n.addBorderNode(c,"_bt"),S=n.addBorderNode(c,"_bb"),b=c.node(x);c.setParent(_,x),b.borderTop=_,c.setParent(S,x),b.borderBottom=S,e.forEach(C,function(N){s(c,d,h,p,m,v,N);var E=c.node(N),k=E.borderTop?E.borderTop:N,j=E.borderBottom?E.borderBottom:N,I=E.borderTop?p:2*p,P=k!==j?1:m-v[x]+1;c.setEdge(_,k,{weight:I,minlen:P,nestingEdge:!0}),c.setEdge(j,S,{weight:I,minlen:P,nestingEdge:!0})}),c.parent(x)||c.setEdge(d,_,{weight:0,minlen:m+v[x]})}function o(c){var d={};function h(p,m){var v=c.children(p);v&&v.length&&e.forEach(v,function(x){h(x,m+1)}),d[p]=m}return e.forEach(c.children(),function(p){h(p,1)}),d}function u(c){return e.reduce(c.edges(),function(d,h){return d+c.edge(h).weight},0)}function l(c){var d=c.graph();c.removeNode(d.nestingRoot),delete d.nestingRoot,e.forEach(c.edges(),function(h){var p=c.edge(h);p.nestingEdge&&c.removeEdge(h)})}return Dm}var Fm,tk;function CL(){if(tk)return Fm;tk=1;var e=it(),n=nn();Fm=i;function i(o){function u(l){var c=o.children(l),d=o.node(l);if(c.length&&e.forEach(c,u),e.has(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(var h=d.minRank,p=d.maxRank+1;h<p;++h)s(o,"borderLeft","_bl",l,d,h),s(o,"borderRight","_br",l,d,h)}}e.forEach(o.children(),u)}function s(o,u,l,c,d,h){var p={width:0,height:0,rank:h,borderType:u},m=d[u][h-1],v=n.addDummyNode(o,"border",p,l);d[u][h]=v,o.setParent(v,c),m&&o.setEdge(m,v,{weight:1})}return Fm}var zm,nk;function RL(){if(nk)return zm;nk=1;var e=it();zm={adjust:n,undo:i};function n(h){var p=h.graph().rankdir.toLowerCase();(p==="lr"||p==="rl")&&s(h)}function i(h){var p=h.graph().rankdir.toLowerCase();(p==="bt"||p==="rl")&&u(h),(p==="lr"||p==="rl")&&(c(h),s(h))}function s(h){e.forEach(h.nodes(),function(p){o(h.node(p))}),e.forEach(h.edges(),function(p){o(h.edge(p))})}function o(h){var p=h.width;h.width=h.height,h.height=p}function u(h){e.forEach(h.nodes(),function(p){l(h.node(p))}),e.forEach(h.edges(),function(p){var m=h.edge(p);e.forEach(m.points,l),e.has(m,"y")&&l(m)})}function l(h){h.y=-h.y}function c(h){e.forEach(h.nodes(),function(p){d(h.node(p))}),e.forEach(h.edges(),function(p){var m=h.edge(p);e.forEach(m.points,d),e.has(m,"x")&&d(m)})}function d(h){var p=h.x;h.x=h.y,h.y=p}return zm}var Bm,rk;function TL(){if(rk)return Bm;rk=1;var e=it();Bm=n;function n(i){var s={},o=e.filter(i.nodes(),function(h){return!i.children(h).length}),u=e.max(e.map(o,function(h){return i.node(h).rank})),l=e.map(e.range(u+1),function(){return[]});function c(h){if(!e.has(s,h)){s[h]=!0;var p=i.node(h);l[p.rank].push(h),e.forEach(i.successors(h),c)}}var d=e.sortBy(o,function(h){return i.node(h).rank});return e.forEach(d,c),l}return Bm}var Um,ik;function jL(){if(ik)return Um;ik=1;var e=it();Um=n;function n(s,o){for(var u=0,l=1;l<o.length;++l)u+=i(s,o[l-1],o[l]);return u}function i(s,o,u){for(var l=e.zipObject(u,e.map(u,function(v,x){return x})),c=e.flatten(e.map(o,function(v){return e.sortBy(e.map(s.outEdges(v),function(x){return{pos:l[x.w],weight:s.edge(x).weight}}),"pos")}),!0),d=1;d<u.length;)d<<=1;var h=2*d-1;d-=1;var p=e.map(new Array(h),function(){return 0}),m=0;return e.forEach(c.forEach(function(v){var x=v.pos+d;p[x]+=v.weight;for(var C=0;x>0;)x%2&&(C+=p[x+1]),x=x-1>>1,p[x]+=v.weight;m+=v.weight*C})),m}return Um}var Hm,sk;function AL(){if(sk)return Hm;sk=1;var e=it();Hm=n;function n(i,s){return e.map(s,function(o){var u=i.inEdges(o);if(u.length){var l=e.reduce(u,function(c,d){var h=i.edge(d),p=i.node(d.v);return{sum:c.sum+h.weight*p.order,weight:c.weight+h.weight}},{sum:0,weight:0});return{v:o,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:o}})}return Hm}var Vm,ok;function IL(){if(ok)return Vm;ok=1;var e=it();Vm=n;function n(o,u){var l={};e.forEach(o,function(d,h){var p=l[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:h};e.isUndefined(d.barycenter)||(p.barycenter=d.barycenter,p.weight=d.weight)}),e.forEach(u.edges(),function(d){var h=l[d.v],p=l[d.w];!e.isUndefined(h)&&!e.isUndefined(p)&&(p.indegree++,h.out.push(l[d.w]))});var c=e.filter(l,function(d){return!d.indegree});return i(c)}function i(o){var u=[];function l(h){return function(p){p.merged||(e.isUndefined(p.barycenter)||e.isUndefined(h.barycenter)||p.barycenter>=h.barycenter)&&s(h,p)}}function c(h){return function(p){p.in.push(h),--p.indegree===0&&o.push(p)}}for(;o.length;){var d=o.pop();u.push(d),e.forEach(d.in.reverse(),l(d)),e.forEach(d.out,c(d))}return e.map(e.filter(u,function(h){return!h.merged}),function(h){return e.pick(h,["vs","i","barycenter","weight"])})}function s(o,u){var l=0,c=0;o.weight&&(l+=o.barycenter*o.weight,c+=o.weight),u.weight&&(l+=u.barycenter*u.weight,c+=u.weight),o.vs=u.vs.concat(o.vs),o.barycenter=l/c,o.weight=c,o.i=Math.min(u.i,o.i),u.merged=!0}return Vm}var Wm,ak;function ML(){if(ak)return Wm;ak=1;var e=it(),n=nn();Wm=i;function i(u,l){var c=n.partition(u,function(_){return e.has(_,"barycenter")}),d=c.lhs,h=e.sortBy(c.rhs,function(_){return-_.i}),p=[],m=0,v=0,x=0;d.sort(o(!!l)),x=s(p,h,x),e.forEach(d,function(_){x+=_.vs.length,p.push(_.vs),m+=_.barycenter*_.weight,v+=_.weight,x=s(p,h,x)});var C={vs:e.flatten(p,!0)};return v&&(C.barycenter=m/v,C.weight=v),C}function s(u,l,c){for(var d;l.length&&(d=e.last(l)).i<=c;)l.pop(),u.push(d.vs),c++;return c}function o(u){return function(l,c){return l.barycenter<c.barycenter?-1:l.barycenter>c.barycenter?1:u?c.i-l.i:l.i-c.i}}return Wm}var Gm,uk;function PL(){if(uk)return Gm;uk=1;var e=it(),n=AL(),i=IL(),s=ML();Gm=o;function o(c,d,h,p){var m=c.children(d),v=c.node(d),x=v?v.borderLeft:void 0,C=v?v.borderRight:void 0,_={};x&&(m=e.filter(m,function(j){return j!==x&&j!==C}));var S=n(c,m);e.forEach(S,function(j){if(c.children(j.v).length){var I=o(c,j.v,h,p);_[j.v]=I,e.has(I,"barycenter")&&l(j,I)}});var b=i(S,h);u(b,_);var N=s(b,p);if(x&&(N.vs=e.flatten([x,N.vs,C],!0),c.predecessors(x).length)){var E=c.node(c.predecessors(x)[0]),k=c.node(c.predecessors(C)[0]);e.has(N,"barycenter")||(N.barycenter=0,N.weight=0),N.barycenter=(N.barycenter*N.weight+E.order+k.order)/(N.weight+2),N.weight+=2}return N}function u(c,d){e.forEach(c,function(h){h.vs=e.flatten(h.vs.map(function(p){return d[p]?d[p].vs:p}),!0)})}function l(c,d){e.isUndefined(c.barycenter)?(c.barycenter=d.barycenter,c.weight=d.weight):(c.barycenter=(c.barycenter*c.weight+d.barycenter*d.weight)/(c.weight+d.weight),c.weight+=d.weight)}return Gm}var Ym,lk;function OL(){if(lk)return Ym;lk=1;var e=it(),n=Bn().Graph;Ym=i;function i(o,u,l){var c=s(o),d=new n({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(h){return o.node(h)});return e.forEach(o.nodes(),function(h){var p=o.node(h),m=o.parent(h);(p.rank===u||p.minRank<=u&&u<=p.maxRank)&&(d.setNode(h),d.setParent(h,m||c),e.forEach(o[l](h),function(v){var x=v.v===h?v.w:v.v,C=d.edge(x,h),_=e.isUndefined(C)?0:C.weight;d.setEdge(x,h,{weight:o.edge(v).weight+_})}),e.has(p,"minRank")&&d.setNode(h,{borderLeft:p.borderLeft[u],borderRight:p.borderRight[u]}))}),d}function s(o){for(var u;o.hasNode(u=e.uniqueId("_root")););return u}return Ym}var Km,ck;function qL(){if(ck)return Km;ck=1;var e=it();Km=n;function n(i,s,o){var u={},l;e.forEach(o,function(c){for(var d=i.parent(c),h,p;d;){if(h=i.parent(d),h?(p=u[h],u[h]=d):(p=l,l=d),p&&p!==d){s.setEdge(p,d);return}d=h}})}return Km}var Xm,fk;function LL(){if(fk)return Xm;fk=1;var e=it(),n=TL(),i=jL(),s=PL(),o=OL(),u=qL(),l=Bn().Graph,c=nn();Xm=d;function d(v){var x=c.maxRank(v),C=h(v,e.range(1,x+1),"inEdges"),_=h(v,e.range(x-1,-1,-1),"outEdges"),S=n(v);m(v,S);for(var b=Number.POSITIVE_INFINITY,N,E=0,k=0;k<4;++E,++k){p(E%2?C:_,E%4>=2),S=c.buildLayerMatrix(v);var j=i(v,S);j<b&&(k=0,N=e.cloneDeep(S),b=j)}m(v,N)}function h(v,x,C){return e.map(x,function(_){return o(v,_,C)})}function p(v,x){var C=new l;e.forEach(v,function(_){var S=_.graph().root,b=s(_,S,C,x);e.forEach(b.vs,function(N,E){_.node(N).order=E}),u(_,C,b.vs)})}function m(v,x){e.forEach(x,function(C){e.forEach(C,function(_,S){v.node(_).order=S})})}return Xm}var Qm,dk;function $L(){if(dk)return Qm;dk=1;var e=it(),n=Bn().Graph,i=nn();Qm={positionX:C,findType1Conflicts:s,findType2Conflicts:o,addConflict:l,hasConflict:c,verticalAlignment:d,horizontalCompaction:h,alignCoordinates:v,findSmallestWidthAlignment:m,balance:x};function s(b,N){var E={};function k(j,I){var P=0,D=0,A=j.length,F=e.last(I);return e.forEach(I,function(q,Q){var K=u(b,q),T=K?b.node(K).order:A;(K||q===F)&&(e.forEach(I.slice(D,Q+1),function(Y){e.forEach(b.predecessors(Y),function(H){var re=b.node(H),X=re.order;(X<P||T<X)&&!(re.dummy&&b.node(Y).dummy)&&l(E,H,Y)})}),D=Q+1,P=T)}),I}return e.reduce(N,k),E}function o(b,N){var E={};function k(I,P,D,A,F){var q;e.forEach(e.range(P,D),function(Q){q=I[Q],b.node(q).dummy&&e.forEach(b.predecessors(q),function(K){var T=b.node(K);T.dummy&&(T.order<A||T.order>F)&&l(E,K,q)})})}function j(I,P){var D=-1,A,F=0;return e.forEach(P,function(q,Q){if(b.node(q).dummy==="border"){var K=b.predecessors(q);K.length&&(A=b.node(K[0]).order,k(P,F,Q,D,A),F=Q,D=A)}k(P,F,P.length,A,I.length)}),P}return e.reduce(N,j),E}function u(b,N){if(b.node(N).dummy)return e.find(b.predecessors(N),function(E){return b.node(E).dummy})}function l(b,N,E){if(N>E){var k=N;N=E,E=k}var j=b[N];j||(b[N]=j={}),j[E]=!0}function c(b,N,E){if(N>E){var k=N;N=E,E=k}return e.has(b[N],E)}function d(b,N,E,k){var j={},I={},P={};return e.forEach(N,function(D){e.forEach(D,function(A,F){j[A]=A,I[A]=A,P[A]=F})}),e.forEach(N,function(D){var A=-1;e.forEach(D,function(F){var q=k(F);if(q.length){q=e.sortBy(q,function(H){return P[H]});for(var Q=(q.length-1)/2,K=Math.floor(Q),T=Math.ceil(Q);K<=T;++K){var Y=q[K];I[F]===F&&A<P[Y]&&!c(E,F,Y)&&(I[Y]=F,I[F]=j[F]=j[Y],A=P[Y])}}})}),{root:j,align:I}}function h(b,N,E,k,j){var I={},P=p(b,N,E,j),D=j?"borderLeft":"borderRight";function A(Q,K){for(var T=P.nodes(),Y=T.pop(),H={};Y;)H[Y]?Q(Y):(H[Y]=!0,T.push(Y),T=T.concat(K(Y))),Y=T.pop()}function F(Q){I[Q]=P.inEdges(Q).reduce(function(K,T){return Math.max(K,I[T.v]+P.edge(T))},0)}function q(Q){var K=P.outEdges(Q).reduce(function(Y,H){return Math.min(Y,I[H.w]-P.edge(H))},Number.POSITIVE_INFINITY),T=b.node(Q);K!==Number.POSITIVE_INFINITY&&T.borderType!==D&&(I[Q]=Math.max(I[Q],K))}return A(F,P.predecessors.bind(P)),A(q,P.successors.bind(P)),e.forEach(k,function(Q){I[Q]=I[E[Q]]}),I}function p(b,N,E,k){var j=new n,I=b.graph(),P=_(I.nodesep,I.edgesep,k);return e.forEach(N,function(D){var A;e.forEach(D,function(F){var q=E[F];if(j.setNode(q),A){var Q=E[A],K=j.edge(Q,q);j.setEdge(Q,q,Math.max(P(b,F,A),K||0))}A=F})}),j}function m(b,N){return e.minBy(e.values(N),function(E){var k=Number.NEGATIVE_INFINITY,j=Number.POSITIVE_INFINITY;return e.forIn(E,function(I,P){var D=S(b,P)/2;k=Math.max(I+D,k),j=Math.min(I-D,j)}),k-j})}function v(b,N){var E=e.values(N),k=e.min(E),j=e.max(E);e.forEach(["u","d"],function(I){e.forEach(["l","r"],function(P){var D=I+P,A=b[D],F;if(A!==N){var q=e.values(A);F=P==="l"?k-e.min(q):j-e.max(q),F&&(b[D]=e.mapValues(A,function(Q){return Q+F}))}})})}function x(b,N){return e.mapValues(b.ul,function(E,k){if(N)return b[N.toLowerCase()][k];var j=e.sortBy(e.map(b,k));return(j[1]+j[2])/2})}function C(b){var N=i.buildLayerMatrix(b),E=e.merge(s(b,N),o(b,N)),k={},j;e.forEach(["u","d"],function(P){j=P==="u"?N:e.values(N).reverse(),e.forEach(["l","r"],function(D){D==="r"&&(j=e.map(j,function(Q){return e.values(Q).reverse()}));var A=(P==="u"?b.predecessors:b.successors).bind(b),F=d(b,j,E,A),q=h(b,j,F.root,F.align,D==="r");D==="r"&&(q=e.mapValues(q,function(Q){return-Q})),k[P+D]=q})});var I=m(b,k);return v(k,I),x(k,b.graph().align)}function _(b,N,E){return function(k,j,I){var P=k.node(j),D=k.node(I),A=0,F;if(A+=P.width/2,e.has(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":F=-P.width/2;break;case"r":F=P.width/2;break}if(F&&(A+=E?F:-F),F=0,A+=(P.dummy?N:b)/2,A+=(D.dummy?N:b)/2,A+=D.width/2,e.has(D,"labelpos"))switch(D.labelpos.toLowerCase()){case"l":F=D.width/2;break;case"r":F=-D.width/2;break}return F&&(A+=E?F:-F),F=0,A}}function S(b,N){return b.node(N).width}return Qm}var Zm,hk;function DL(){if(hk)return Zm;hk=1;var e=it(),n=nn(),i=$L().positionX;Zm=s;function s(u){u=n.asNonCompoundGraph(u),o(u),e.forEach(i(u),function(l,c){u.node(c).x=l})}function o(u){var l=n.buildLayerMatrix(u),c=u.graph().ranksep,d=0;e.forEach(l,function(h){var p=e.max(e.map(h,function(m){return u.node(m).height}));e.forEach(h,function(m){u.node(m).y=d+p/2}),d+=p+c})}return Zm}var Jm,pk;function FL(){if(pk)return Jm;pk=1;var e=it(),n=_L(),i=SL(),s=kL(),o=nn().normalizeRanks,u=EL(),l=nn().removeEmptyRanks,c=NL(),d=CL(),h=RL(),p=LL(),m=DL(),v=nn(),x=Bn().Graph;Jm=C;function C(z,W){var ee=W&&W.debugTiming?v.time:v.notime;ee("layout",function(){var se=ee(" buildLayoutGraph",function(){return A(z)});ee(" runLayout",function(){_(se,ee)}),ee(" updateInputGraph",function(){S(z,se)})})}function _(z,W){W(" makeSpaceForEdgeLabels",function(){F(z)}),W(" removeSelfEdges",function(){$(z)}),W(" acyclic",function(){n.run(z)}),W(" nestingGraph.run",function(){c.run(z)}),W(" rank",function(){s(v.asNonCompoundGraph(z))}),W(" injectEdgeLabelProxies",function(){q(z)}),W(" removeEmptyRanks",function(){l(z)}),W(" nestingGraph.cleanup",function(){c.cleanup(z)}),W(" normalizeRanks",function(){o(z)}),W(" assignRankMinMax",function(){Q(z)}),W(" removeEdgeLabelProxies",function(){K(z)}),W(" normalize.run",function(){i.run(z)}),W(" parentDummyChains",function(){u(z)}),W(" addBorderSegments",function(){d(z)}),W(" order",function(){p(z)}),W(" insertSelfEdges",function(){G(z)}),W(" adjustCoordinateSystem",function(){h.adjust(z)}),W(" position",function(){m(z)}),W(" positionSelfEdges",function(){M(z)}),W(" removeBorderNodes",function(){X(z)}),W(" normalize.undo",function(){i.undo(z)}),W(" fixupEdgeLabelCoords",function(){H(z)}),W(" undoCoordinateSystem",function(){h.undo(z)}),W(" translateGraph",function(){T(z)}),W(" assignNodeIntersects",function(){Y(z)}),W(" reversePoints",function(){re(z)}),W(" acyclic.undo",function(){n.undo(z)})}function S(z,W){e.forEach(z.nodes(),function(ee){var se=z.node(ee),ce=W.node(ee);se&&(se.x=ce.x,se.y=ce.y,W.children(ee).length&&(se.width=ce.width,se.height=ce.height))}),e.forEach(z.edges(),function(ee){var se=z.edge(ee),ce=W.edge(ee);se.points=ce.points,e.has(ce,"x")&&(se.x=ce.x,se.y=ce.y)}),z.graph().width=W.graph().width,z.graph().height=W.graph().height}var b=["nodesep","edgesep","ranksep","marginx","marginy"],N={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],k=["width","height"],j={width:0,height:0},I=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},D=["labelpos"];function A(z){var W=new x({multigraph:!0,compound:!0}),ee=ae(z.graph());return W.setGraph(e.merge({},N,B(ee,b),e.pick(ee,E))),e.forEach(z.nodes(),function(se){var ce=ae(z.node(se));W.setNode(se,e.defaults(B(ce,k),j)),W.setParent(se,z.parent(se))}),e.forEach(z.edges(),function(se){var ce=ae(z.edge(se));W.setEdge(se,e.merge({},P,B(ce,I),e.pick(ce,D)))}),W}function F(z){var W=z.graph();W.ranksep/=2,e.forEach(z.edges(),function(ee){var se=z.edge(ee);se.minlen*=2,se.labelpos.toLowerCase()!=="c"&&(W.rankdir==="TB"||W.rankdir==="BT"?se.width+=se.labeloffset:se.height+=se.labeloffset)})}function q(z){e.forEach(z.edges(),function(W){var ee=z.edge(W);if(ee.width&&ee.height){var se=z.node(W.v),ce=z.node(W.w),pe={rank:(ce.rank-se.rank)/2+se.rank,e:W};v.addDummyNode(z,"edge-proxy",pe,"_ep")}})}function Q(z){var W=0;e.forEach(z.nodes(),function(ee){var se=z.node(ee);se.borderTop&&(se.minRank=z.node(se.borderTop).rank,se.maxRank=z.node(se.borderBottom).rank,W=e.max(W,se.maxRank))}),z.graph().maxRank=W}function K(z){e.forEach(z.nodes(),function(W){var ee=z.node(W);ee.dummy==="edge-proxy"&&(z.edge(ee.e).labelRank=ee.rank,z.removeNode(W))})}function T(z){var W=Number.POSITIVE_INFINITY,ee=0,se=Number.POSITIVE_INFINITY,ce=0,pe=z.graph(),me=pe.marginx||0,Pe=pe.marginy||0;function ze(je){var Me=je.x,ke=je.y,De=je.width,xe=je.height;W=Math.min(W,Me-De/2),ee=Math.max(ee,Me+De/2),se=Math.min(se,ke-xe/2),ce=Math.max(ce,ke+xe/2)}e.forEach(z.nodes(),function(je){ze(z.node(je))}),e.forEach(z.edges(),function(je){var Me=z.edge(je);e.has(Me,"x")&&ze(Me)}),W-=me,se-=Pe,e.forEach(z.nodes(),function(je){var Me=z.node(je);Me.x-=W,Me.y-=se}),e.forEach(z.edges(),function(je){var Me=z.edge(je);e.forEach(Me.points,function(ke){ke.x-=W,ke.y-=se}),e.has(Me,"x")&&(Me.x-=W),e.has(Me,"y")&&(Me.y-=se)}),pe.width=ee-W+me,pe.height=ce-se+Pe}function Y(z){e.forEach(z.edges(),function(W){var ee=z.edge(W),se=z.node(W.v),ce=z.node(W.w),pe,me;ee.points?(pe=ee.points[0],me=ee.points[ee.points.length-1]):(ee.points=[],pe=ce,me=se),ee.points.unshift(v.intersectRect(se,pe)),ee.points.push(v.intersectRect(ce,me))})}function H(z){e.forEach(z.edges(),function(W){var ee=z.edge(W);if(e.has(ee,"x"))switch((ee.labelpos==="l"||ee.labelpos==="r")&&(ee.width-=ee.labeloffset),ee.labelpos){case"l":ee.x-=ee.width/2+ee.labeloffset;break;case"r":ee.x+=ee.width/2+ee.labeloffset;break}})}function re(z){e.forEach(z.edges(),function(W){var ee=z.edge(W);ee.reversed&&ee.points.reverse()})}function X(z){e.forEach(z.nodes(),function(W){if(z.children(W).length){var ee=z.node(W),se=z.node(ee.borderTop),ce=z.node(ee.borderBottom),pe=z.node(e.last(ee.borderLeft)),me=z.node(e.last(ee.borderRight));ee.width=Math.abs(me.x-pe.x),ee.height=Math.abs(ce.y-se.y),ee.x=pe.x+ee.width/2,ee.y=se.y+ee.height/2}}),e.forEach(z.nodes(),function(W){z.node(W).dummy==="border"&&z.removeNode(W)})}function $(z){e.forEach(z.edges(),function(W){if(W.v===W.w){var ee=z.node(W.v);ee.selfEdges||(ee.selfEdges=[]),ee.selfEdges.push({e:W,label:z.edge(W)}),z.removeEdge(W)}})}function G(z){var W=v.buildLayerMatrix(z);e.forEach(W,function(ee){var se=0;e.forEach(ee,function(ce,pe){var me=z.node(ce);me.order=pe+se,e.forEach(me.selfEdges,function(Pe){v.addDummyNode(z,"selfedge",{width:Pe.label.width,height:Pe.label.height,rank:me.rank,order:pe+ ++se,e:Pe.e,label:Pe.label},"_se")}),delete me.selfEdges})})}function M(z){e.forEach(z.nodes(),function(W){var ee=z.node(W);if(ee.dummy==="selfedge"){var se=z.node(ee.e.v),ce=se.x+se.width/2,pe=se.y,me=ee.x-ce,Pe=se.height/2;z.setEdge(ee.e,ee.label),z.removeNode(W),ee.label.points=[{x:ce+2*me/3,y:pe-Pe},{x:ce+5*me/6,y:pe-Pe},{x:ce+me,y:pe},{x:ce+5*me/6,y:pe+Pe},{x:ce+2*me/3,y:pe+Pe}],ee.label.x=ee.x,ee.label.y=ee.y}})}function B(z,W){return e.mapValues(e.pick(z,W),Number)}function ae(z){var W={};return e.forEach(z,function(ee,se){W[se.toLowerCase()]=ee}),W}return Jm}var eg,mk;function zL(){if(mk)return eg;mk=1;var e=it(),n=nn(),i=Bn().Graph;eg={debugOrdering:s};function s(o){var u=n.buildLayerMatrix(o),l=new i({compound:!0,multigraph:!0}).setGraph({});return e.forEach(o.nodes(),function(c){l.setNode(c,{label:c}),l.setParent(c,"layer"+o.node(c).rank)}),e.forEach(o.edges(),function(c){l.setEdge(c.v,c.w,{},c.name)}),e.forEach(u,function(c,d){var h="layer"+d;l.setNode(h,{rank:"same"}),e.reduce(c,function(p,m){return l.setEdge(p,m,{style:"invis"}),m})}),l}return eg}var tg,gk;function BL(){return gk||(gk=1,tg="0.8.5"),tg}var ng,vk;function UL(){return vk||(vk=1,ng={graphlib:Bn(),layout:FL(),debug:zL(),util:{time:nn().time,notime:nn().notime},version:BL()}),ng}var HL=UL();const yk=Ng(HL),ms=240,yo=130,wo=74,fv=72,wk=wo+fv;function VL(e){let n=ms;for(const i of e.values())n=Math.max(n,i.width);return n}const WL=420,GL=2;function dv(e){var i;return((i=e.data)==null?void 0:i.sessionId)??"_default"}function YL(e,n,i,s,o){const u=new yk.graphlib.Graph;u.setDefaultEdgeLabel(()=>({})),u.setGraph({rankdir:i,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const l=e.filter(_=>!o.has(_)),c=new Set(l);for(const _ of l){const S=s.get(_);u.setNode(_,{width:(S==null?void 0:S.width)??ms,height:(S==null?void 0:S.height)??yo})}for(const _ of n)c.has(_.source)&&c.has(_.target)&&u.setEdge(_.source,_.target);yk.layout(u);const d=new Map;let h=1/0,p=1/0,m=-1/0,v=-1/0;for(const _ of l){const S=u.node(_);if(!S)continue;const b=s.get(_),N=(b==null?void 0:b.width)??ms,E=(b==null?void 0:b.height)??yo,k=S.x-N/2,j=S.y-E/2;d.set(_,{x:k,y:j}),k<h&&(h=k),j<p&&(p=j),k+N>m&&(m=k+N),j+E>v&&(v=j+E)}if(Number.isFinite(h)&&Number.isFinite(p))for(const[_,S]of d)d.set(_,{x:S.x-h,y:S.y-p});let x=Number.isFinite(m)?m-h:0,C=Number.isFinite(v)?v-p:0;for(const _ of e){const S=o.get(_);if(!S)continue;const b=s.get(_);x=Math.max(x,S.x+((b==null?void 0:b.width)??ms)),C=Math.max(C,S.y+((b==null?void 0:b.height)??yo))}return{positions:d,width:x,height:C}}function KL(e,n,i={}){const s=i.direction??"LR",o=i.pinned??new Map,u=i.measured??new Map,l=new Map;for(const S of e){const b=dv(S),N=l.get(b);N?N.push(S.id):l.set(b,[S.id])}const d=Array.from(l.keys()).sort().map(S=>({sid:S,...YL(l.get(S),n,s,u,o)})),h=VL(u),p=i.availableHeight&&i.availableHeight>0?i.availableHeight:Number.POSITIVE_INFINITY,m=S=>{const b=[[]];let N=0;for(const E of d)b.length<S&&N>0&&N+E.height>p&&(b.push([]),N=0),b[b.length-1].push(E),N+=E.height+wk;return b},v=S=>S.reduce((b,N)=>Math.max(b,N.width),0)+WL;let x=m(i.availableWidth?GL:1);x.length>1&&x.reduce((b,N)=>b+v(N),0)+h*(x.length-1)>(i.availableWidth??0)&&(x=m(1));const C=new Map;let _=0;for(const S of x){let b=0;for(const{positions:N,height:E}of S){for(const[k,j]of N)C.set(k,{x:j.x+_,y:j.y+b});b+=E+wk}_+=v(S)+h}return e.map(S=>{const b=o.get(S.id);if(b)return{...S,position:b};const N=C.get(S.id);return N?{...S,position:N}:S})}function XL(e,n,i,s){const u=wo+fv,l=60,c=v=>{const x=s.get(v);return{w:(x==null?void 0:x.width)??ms,h:(x==null?void 0:x.height)??yo}},d=new Map(e.map(v=>[v.id,dv(v)])),h=[],p=e.map(v=>({id:v.id,pos:i.get(v.id)??n.get(v.id)})).filter(v=>v.pos!=null).sort((v,x)=>v.pos.y-x.pos.y||v.pos.x-x.pos.x||v.id.localeCompare(x.id)),m=[];for(const{id:v,pos:x}of p){const{w:C,h:_}=c(v),S=d.get(v)??"_default";if(i.has(v)){h.push({x:x.x,y:x.y,w:C,h:_,sid:S});continue}let b=x.y;for(let N=0;N<h.length+1;N++){const E=h.find(k=>{const j=k.sid===S?24:l,I=k.sid===S?24:u;return x.x<k.x+k.w+j&&k.x<x.x+C+j&&b<k.y+k.h+I&&k.y<b+_+I});if(!E)break;b=E.y+E.h+(E.sid===S?24:u)}b!==x.y&&(n.set(v,{x:x.x,y:b}),m.push(v)),h.push({x:x.x,y:b,w:C,h:_,sid:S})}return m}function QL(e,n,i,s,o){const u=v=>{const x=s.get(v);return{w:(x==null?void 0:x.width)??ms,h:(x==null?void 0:x.height)??yo}},l=v=>i.get(v)??n.get(v),c=new Map,d=[];for(const v of e){const x=l(v.id);if(!x)continue;const{w:C,h:_}=u(v.id);if(o.has(v.id)&&!i.has(v.id)){const S=dv(v);(c.get(S)??c.set(S,[]).get(S)).push(v)}else d.push({x:x.x,y:x.y,w:C,h:_})}if(c.size===0)return[];const h=wo+fv,p=(v,x,C,_)=>d.some(S=>v<S.x+S.w+wo&&S.x<v+C+wo&&x<S.y+S.h+h&&S.y<x+_+h),m=[];for(const v of[...c.keys()].sort()){const x=c.get(v);let C=1/0,_=1/0,S=-1/0,b=-1/0;for(const D of x){const A=l(D.id),{w:F,h:q}=u(D.id);C=Math.min(C,A.x),_=Math.min(_,A.y),S=Math.max(S,A.x+F),b=Math.max(b,A.y+q)}const N=S-C,E=b-_,k=[...new Set(d.map(D=>Math.round(D.x)))].sort((D,A)=>D-A),j=k.length?k:[C],I=[0,...d.map(D=>D.y+D.h+h)].sort((D,A)=>D-A);let P=null;e:for(const D of j)for(const A of I){if(A>=_)break;if(!p(D,A,N,E)){P={x:D,y:A};break e}}if(P){const D=P.x-C,A=P.y-_;for(const F of x){const q=l(F.id);n.set(F.id,{x:q.x+D,y:q.y+A})}m.push(v)}for(const D of x){const A=l(D.id),{w:F,h:q}=u(D.id);d.push({x:A.x,y:A.y,w:F,h:q})}}return m}const ZL=600;function bg(e,n){return!(e.exitAt!=null&&n-e.exitAt>ZL||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function JL(e,n){const i=new Set;for(const s of e.agents.values())bg(s,n)&&i.add(s.id);return i}function wi(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function e$(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(2)}M`}const t$={agent:yP,sessionGroup:TP},tu=18,n$=9e4,r$=200,i$=5*6e4,s$=6,o$=2*6e4,hv="agent-dag.layout",pv="agent-dag.viewport",nC="agent-dag.summariesDismissed",rC="agent-dag.sessionListOpen",iC="agent-dag.detailOpen",sC="agent-dag.usagePanelOpen",xk="agent-dag.accountsPanelOpen";function a$(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(rC)==="1"}catch{return!1}}function u$(e){if(!(typeof window>"u"))try{window.localStorage.setItem(rC,e?"1":"0")}catch{}}function l$(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(iC)==="1"}catch{return!1}}function c$(e){if(!(typeof window>"u"))try{window.localStorage.setItem(iC,e?"1":"0")}catch{}}function f$(){if(typeof window>"u")return!0;const e=window.localStorage.getItem(sC);try{return e===null?!0:e==="1"}catch{return!0}}function d$(e){if(!(typeof window>"u"))try{window.localStorage.setItem(sC,e?"1":"0")}catch{}}function h$(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(nC);if(!e)return new Set;const n=JSON.parse(e);return new Set(Array.isArray(n)?n.filter(i=>typeof i=="string"):[])}catch{return new Set}}function _k(e){if(!(typeof window>"u"))try{const n=Array.from(e),i=n.length>200?n.slice(-200):n;window.localStorage.setItem(nC,JSON.stringify(i))}catch{}}function p$(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const n=window.localStorage.getItem(hv);if(!n)return e;const i=JSON.parse(n);if(!("v"in i)){const o=Object.entries(i).filter(([,u])=>u&&typeof u.x=="number"&&typeof u.y=="number");return{positions:o,pins:o.map(([u])=>u)}}return{positions:Object.entries(i.positions??{}).filter(([,o])=>o&&typeof o.x=="number"&&typeof o.y=="number"),pins:Array.isArray(i.pins)?i.pins:[]}}catch{return e}}function rg(e,n){if(!(typeof window>"u"))try{const i={};for(const[s,o]of e)i[s]=o;for(const[s,o]of n)i[s]=o;window.localStorage.setItem(hv,JSON.stringify({v:2,positions:i,pins:Array.from(n.keys())}))}catch{}}function m$(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(pv);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 g$(e){if(!(typeof window>"u"))try{window.localStorage.setItem(pv,JSON.stringify(e))}catch{}}function Sk(){if(!(typeof window>"u")){try{window.localStorage.removeItem(hv)}catch{}try{window.localStorage.removeItem(pv)}catch{}}}function v$(e,n){const i=e.agents.get(n);if(!i)return;const s=[];for(const p of e.agents.values())p.sessionId===n&&s.push(p);const o={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:n,label:i.label,cwd:i.cwd,startedAt:i.startedAt,endedAt:i.endedAt,model:i.model,agents:s.map(p=>({id:p.id,kind:p.kind,label:p.label,parentId:p.parentId,state:p.state,startedAt:p.startedAt,endedAt:p.endedAt,model:p.model,cwd:p.cwd,usage:p.usage,prompts:p.prompts,tools:p.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}))}))},u=JSON.stringify(o,null,2),l=new Blob([u],{type:"application/json"}),c=URL.createObjectURL(l),d=document.createElement("a"),h=(i.label||"session").replace(/[^a-z0-9._-]/gi,"_");d.href=c,d.download=`agents-deck-${h}-${n.slice(0,8)}.json`,document.body.appendChild(d),d.click(),document.body.removeChild(d),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const kg={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Eg={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},y$={Read:"file",Write:"file",Edit:"file",MultiEdit:"file",Glob:"file",Grep:"file",LS:"file",NotebookEdit:"file",Bash:"shell",PowerShell:"shell",shell:"shell",exec_command:"shell",shell_command:"shell",write_stdin:"shell",wait:"shell",apply_patch:"file",update_plan:"task",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"};function oC(e){return e.startsWith("mcp__")?"mcp":y$[e]??"other"}function aC(e,n){var s,o,u;if(!n)return!0;const i=n.toLowerCase();if(e.label.toLowerCase().includes(i)||(s=e.cwd)!=null&&s.toLowerCase().includes(i)||(o=e.cwdBasename)!=null&&o.toLowerCase().includes(i)||e.sessionId.toLowerCase().includes(i)||(u=e.firstPrompt)!=null&&u.toLowerCase().includes(i))return!0;for(const l of e.tools)if(l.name.toLowerCase().includes(i))return!0;return!1}function w$(e,n){if(!n)return null;const i=new Set([n]);let s=n;for(;s;){const u=e.agents.get(s);if(!(u!=null&&u.parentId)||i.has(u.parentId))break;i.add(u.parentId),s=u.parentId}let o=!0;for(;o;){o=!1;for(const u of e.agents.values())u.parentId&&i.has(u.parentId)&&!i.has(u.id)&&(i.add(u.id),o=!0)}return i}function x$(e,n,i,s,o,u,l,c,d,h,p,m,v,x){const C=[],_=[],S=new Set;if(u)for(const k of e.agents.values())aC(k,u)&&S.add(k.id);for(const k of e.agents.values()){if(!v.has(k.id))continue;const j=u?!S.has(k.id):!1,I=k.exitAt!=null,P=m!=null&&!m.has(k.id),D=[j?"rf-dim":"",I?"rf-exiting":"",P?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,A=l.get(k.id);if(C.push({id:k.id,type:"agent",position:{x:0,y:0},data:{...k,now:n,dim:j,onOpenContext:x},className:D,...A?{width:A.width,height:A.height}:null}),k.parentId&&v.has(k.parentId)){const F=Vg(k.sessionId),q=k.state==="active"?`hsl(${F} 80% 72%)`:`hsl(${F} 50% 55%)`,Q=u&&!S.has(k.id)&&!S.has(k.parentId),K=I,T=p.size>0&&(p.has(k.id)||p.has(k.parentId)),Y=m!=null&&!m.has(k.id)&&!m.has(k.parentId),H=k.state==="active"?2:1.5,re=T?H+1.5:H,X=Q||K?.2:Y?.12:1,$=[K?"rf-edge-exiting":"",T?"rf-edge-selected":""].filter(Boolean).join(" ")||void 0;_.push({id:`e:${k.parentId}->${k.id}`,source:k.parentId,target:k.id,animated:(k.state==="active"||T)&&!Q&&!K,type:"smoothstep",style:{stroke:q,strokeWidth:re,opacity:X,transition:"opacity 500ms ease, stroke-width 200ms ease"},className:$})}}const b=C.filter(k=>!o.has(k.id)&&!c.has(k.id));if(b.length>0||d!==h.current){if(b.length>0){const k=KL(C,_,{direction:"LR",pinned:o,measured:l,availableWidth:i,availableHeight:s});for(const j of k)c.has(j.id)||c.set(j.id,j.position);QL(C,c,o,l,new Set(b.map(j=>j.id)))}XL(C,c,o,l),h.current=d}for(const k of Array.from(c.keys()))e.agents.has(k)||c.delete(k);if(e.agents.size>0)for(const k of Array.from(o.keys()))e.agents.has(k)||o.delete(k);const N=[];let E=!1;for(const k of C){let j=o.get(k.id)??c.get(k.id);j||(j={x:0,y:0},c.set(k.id,j),E=!0),N.push({...k,position:j})}return E&&(h.current=""),{nodes:N,edges:_}}function _$(){return y.jsx(Ug,{children:y.jsx(S$,{})})}function S$(){const e=Io(),n=O.useRef(xg()),[,i]=O.useState(0),s=O.useCallback(()=>i(Z=>Z+1),[]),[o,u]=O.useState(()=>new Set),[l,c]=O.useState(null),[d,h]=O.useState(null),p=O.useCallback((Z,ne)=>{u(fe=>{if(!ne)return new Set([Z]);const ge=new Set(fe);return ge.has(Z)?ge.delete(Z):ge.add(Z),ge}),c(fe=>ne&&fe===Z?fe:Z)},[]),m=O.useCallback(()=>{u(new Set),c(null)},[]),[v,x]=O.useState(null),[C,_]=O.useState(null),S=O.useCallback(Z=>_(Z),[]),b=O.useRef(h$()),[N,E]=O.useState(a$);O.useEffect(()=>{u$(N)},[N]);const[k,j]=O.useState(l$);O.useEffect(()=>{c$(k)},[k]);const[I,P]=O.useState(f$);O.useEffect(()=>{d$(I)},[I]);const[D,A]=O.useState(()=>{try{const Z=window.localStorage.getItem(xk);return Z===null?!0:Z==="1"}catch{return!0}});O.useEffect(()=>{try{window.localStorage.setItem(xk,D?"1":"0")}catch{}},[D]);const[F,q]=O.useState(null),[Q,K]=O.useState(!1),[T,Y]=O.useState(0),[H,re]=O.useState(0);O.useEffect(()=>{fetch("/api/sound-hook").then(Z=>Z.ok?Z.json():null).then(Z=>{Z!=null&&Z.ok&&(q(Z.enabled===!0),Y((Z.foreign??[]).filter(ne=>ne.worksHere).length),re(typeof Z.parked=="number"?Z.parked:0))}).catch(()=>{})},[]);const X=O.useCallback(async()=>{K(!0);try{const ne=await(await fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!F})})).json().catch(()=>null);ne!=null&&ne.ok&&q(ne.enabled===!0),fetch("/api/sound-hook").then(fe=>fe.ok?fe.json():null).then(fe=>{fe!=null&&fe.ok&&(Y((fe.foreign??[]).filter(ge=>ge.worksHere).length),re(typeof fe.parked=="number"?fe.parked:0))}).catch(()=>{})}catch{}finally{K(!1)}},[F]),$=O.useCallback(()=>{E(Z=>(Z||A(!1),!Z))},[]),G=O.useCallback(()=>{A(Z=>(Z||E(!1),!Z))},[]),[M,B]=O.useState(!1),[ae,z]=O.useState(0),[W,ee]=O.useState(!1),[se,ce]=O.useState(!1),pe=O.useRef([]),[me,Pe]=O.useState(Date.now()),ze=O.useRef(p$()).current;O.useRef(!1);const je=O.useRef(new Map(ze.positions.filter(([Z])=>ze.pins.includes(Z)))),Me=O.useRef(null),ke=O.useState(()=>m$())[0],[De,xe]=O.useState(""),[_e,He]=O.useState(()=>new Set),[st,vt]=O.useState(()=>typeof window>"u"?"dark":window.localStorage.getItem("agent-dag.theme")??"dark"),[lt,Ke]=O.useState(!1),yt=O.useRef(null);O.useEffect(()=>{document.documentElement.dataset.theme=st;try{window.localStorage.setItem("agent-dag.theme",st)}catch{}},[st]),O.useEffect(()=>{if(!ke)return;const Z=window.setTimeout(()=>{try{e.setViewport(ke,{duration:0})}catch{}},60);return()=>window.clearTimeout(Z)},[e,ke]);const At=O.useRef(!0),Xe=O.useRef(null);O.useEffect(()=>{const Z=new EventSource("/events");return Z.addEventListener("open",()=>{ee(!0),Ke(!0)}),Z.addEventListener("error",()=>ee(!1)),Z.addEventListener("replay-end",()=>{At.current=!1,Xe.current!=null&&(window.clearTimeout(Xe.current),Xe.current=null),s()}),Z.addEventListener("hook",ne=>{try{const fe=JSON.parse(ne.data);if(se){pe.current.push(fe);return}n.current=Fw(n.current,fe),fe.replay===!0||At.current||Date.now()-fe.receivedAt>3e4?(Xe.current!=null&&window.clearTimeout(Xe.current),Xe.current=window.setTimeout(()=>{Xe.current=null,s()},120)):(Xe.current!=null&&(window.clearTimeout(Xe.current),Xe.current=null),s())}catch{}}),()=>{Z.close(),Xe.current!=null&&(window.clearTimeout(Xe.current),Xe.current=null)}},[se,s]),O.useEffect(()=>{if(!se&&pe.current.length!==0){for(const Z of pe.current)n.current=Fw(n.current,Z);pe.current.length=0,s()}},[se,s]),O.useEffect(()=>{const Z=setInterval(()=>{const ne=Date.now();Pe(ne);let fe=nP(n.current,ne,n$);eP(n.current,ne,r$,i$)&&(fe=!0),tP(n.current,ne,s$,o$)&&(fe=!0),fe&&s()},250);return()=>clearInterval(Z)},[s]);const Ct=O.useRef(null),Ze=O.useRef(0),Wt=420,Je=O.useCallback((Z=500)=>{try{const ye=document.querySelector(".canvas-wrap"),Ae=Array.from(document.querySelectorAll(".react-flow__node")).filter(nt=>nt.offsetWidth>0);if(!ye||Ae.length===0)return;const We=ye.getBoundingClientRect(),pt=e.getViewport();if(!Number.isFinite(pt.zoom)||pt.zoom<=0)return;const mt=nt=>(nt-We.left-pt.x)/pt.zoom,Ye=nt=>(nt-We.top-pt.y)/pt.zoom,Ut=Ae.map(nt=>nt.getBoundingClientRect()),An=Math.min(...Ut.map(nt=>mt(nt.left))),br=Math.max(...Ut.map(nt=>mt(nt.right))),ri=Math.min(...Ut.map(nt=>Ye(nt.top))),Ns=Math.max(...Ut.map(nt=>Ye(nt.bottom))),qi=br-An,ii=Ns-ri;if(!(qi>0&&ii>0))return;const on=Math.max(.2,Math.min(1,(We.width-160)/(qi+Wt)*.86,(We.height-160)/ii*.86));e.setViewport({x:80-An*on,y:Math.max(80,(We.height-ii*on)/2)-ri*on,zoom:on},{duration:Z}),Ze.current=Date.now(),window.setTimeout(()=>{try{const nt={x:80-An*on,y:Math.max(80,(We.height-ii*on)/2)-ri*on,zoom:on},Do=e.getViewport();(Math.abs(Do.zoom-on)>.01||Math.abs(Do.x-nt.x)>2)&&e.setViewport(nt,{duration:0})}catch{}},Z+60)}catch{}},[e]),Ve=O.useRef(""),wt=O.useRef(null),ct=O.useRef(0),ot=O.useCallback(()=>{ct.current=Date.now()},[]),rn="agent-dag.autoFitDisabled",ht=O.useRef((()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(rn)==="1"}catch{return!1}})()),[It,dn]=O.useState(ht.current),Vn=O.useCallback(()=>{if(!ht.current){ht.current=!0,dn(!0);try{window.localStorage.setItem(rn,"1")}catch{}}},[]),Cn=O.useCallback(()=>{ht.current=!1,dn(!1);try{window.localStorage.removeItem(rn)}catch{}Je(400)},[e,Je]);O.useEffect(()=>{const Z=setInterval(()=>{if(ht.current||Date.now()-ct.current<800)return;const ne=n.current,fe=Date.now(),ge=[];for(const mt of ne.agents.values())bg(mt,fe)&&ge.push({id:mt.id});if(ge.length===0)return;const ve=e.getViewport(),ye=window.innerWidth-360,Ae=window.innerHeight-52;let We=!1,pt=!1;for(const{id:mt}of ge){const Ye=Mt.current.get(mt),Ut=je.current.get(mt)??Pt.current.get(mt);if(!Ye||!Ut)continue;pt=!0;const An=Ut.x*ve.zoom+ve.x,br=Ut.y*ve.zoom+ve.y,ri=(Ut.x+Ye.width)*ve.zoom+ve.x,Ns=(Ut.y+Ye.height)*ve.zoom+ve.y;if(ri>0&&An<ye&&Ns>0&&br<Ae){We=!0;break}}pt&&!We&&Je(600)},1500);return()=>clearInterval(Z)},[e]);const Mt=O.useRef(new Map),hn=O.useRef(0),pn=O.useCallback(Z=>{const ne=Mt.current;let fe=!1;for(const ge of Z.nodeInternals.values()){const ve=ge.width,ye=ge.height;if(ve==null||ye==null)continue;const Ae=ne.get(ge.id);Ae?(Math.abs(Ae.height-ye)>4||Math.abs(Ae.width-ve)>4)&&(ne.set(ge.id,{width:ve,height:ye}),fe=!0):(ne.set(ge.id,{width:ve,height:ye}),fe=!0)}return fe&&(hn.current+=1),hn.current},[]),Xr=Ue(pn),[Qr,Ai]=O.useState(0);O.useEffect(()=>{let Z=0;return Z=requestAnimationFrame(()=>{const fe=Mt.current;let ge=!1;for(const ve of document.querySelectorAll(".react-flow__node[data-id]")){const ye=ve.getAttribute("data-id");if(!ye)continue;const Ae=ve.offsetWidth,We=ve.offsetHeight;if(!Ae||!We)continue;const pt=fe.get(ye);(!pt||Math.abs(pt.width-Ae)>4||Math.abs(pt.height-We)>4)&&(fe.set(ye,{width:Ae,height:We}),ge=!0)}ge&&Ai(ve=>ve+1)}),()=>cancelAnimationFrame(Z)});const Pt=O.useRef(new Map(ze.positions)),Jn=O.useRef(""),Rn=O.useMemo(()=>{const Z=[];for(const ne of n.current.agents.values())bg(ne,me)&&Z.push(ne.id+(ne.parentId?`>${ne.parentId}`:""));return Z.sort(),`${Z.join("|")}#sv${Xr}.${Qr}`},[n.current,n.current.lastSeq,me,Xr,Qr]),sn=O.useRef(null);O.useEffect(()=>(sn.current!=null&&window.clearTimeout(sn.current),sn.current=window.setTimeout(()=>{rg(Pt.current,je.current)},1500),()=>{sn.current!=null&&window.clearTimeout(sn.current)}),[Rn]),O.useEffect(()=>{if(Ve.current===Rn)return;const Z=Ve.current;if(Ve.current=Rn,!Z||ht.current)return;Date.now()-Ze.current>1200&&Je(400),Ct.current&&window.clearTimeout(Ct.current),Ct.current=window.setTimeout(()=>{ht.current||Je(500)},280)},[Rn,e,Je]);const er=O.useMemo(()=>{if(o.size===0)return null;const Z=new Set;for(const ne of o){const fe=w$(n.current,ne);if(fe)for(const ge of fe)Z.add(ge)}return Z.size>0?Z:null},[n.current,n.current.lastSeq,o]),Tn=O.useMemo(()=>JL(n.current,me),[n.current,n.current.lastSeq,me]),Ii=O.useRef(null),[mn,tr]=O.useState({w:0,h:0});O.useEffect(()=>{const Z=Ii.current;if(!Z||typeof ResizeObserver>"u")return;const ne=new ResizeObserver(fe=>{var ve;const ge=(ve=fe[0])==null?void 0:ve.contentRect;ge&&tr(ye=>Math.abs(ye.w-ge.width)>40||Math.abs(ye.h-ge.height)>40?{w:ge.width,h:ge.height}:ye)});return ne.observe(Z),tr({w:Z.clientWidth,h:Z.clientHeight}),()=>ne.disconnect()},[]);const nr=mn.w>0?mn.w*.92:0,xr=mn.h>0?mn.h:0,{nodes:Gt,edges:Es}=O.useMemo(()=>x$(n.current,me,nr,xr,je.current,De,Mt.current,Pt.current,Rn,Jn,o,er,Tn,S),[n.current,n.current.lastSeq,me,nr,xr,De,Rn,o,er,Tn,S,ae]),Zr=O.useMemo(()=>{const Z=new Map;for(const fe of Gt){const ge=fe.data;if(!(ge!=null&&ge.sessionId)||ge.exitAt!=null)continue;const ve=fe.width,ye=fe.height;if(ve==null||ye==null)continue;const Ae=fe.position.x,We=fe.position.y,pt=Ae+ve,mt=We+ye,Ye=Z.get(ge.sessionId);Ye?(Ye.minX=Math.min(Ye.minX,Ae),Ye.minY=Math.min(Ye.minY,We),Ye.maxX=Math.max(Ye.maxX,pt),Ye.maxY=Math.max(Ye.maxY,mt)):Z.set(ge.sessionId,{minX:Ae,minY:We,maxX:pt,maxY:mt})}const ne=[];for(const[fe,ge]of Z){const ve=ge.maxX-ge.minX+tu*2,ye=ge.maxY-ge.minY+tu*2;ne.push({id:`group:${fe}`,type:"sessionGroup",position:{x:ge.minX-tu,y:ge.minY-tu},data:{sessionId:fe,w:ve,h:ye},width:ve,height:ye,style:{width:ve,height:ye},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return ne},[Gt,me]),jn=O.useMemo(()=>[...Zr,...Gt],[Zr,Gt]),Mi=O.useMemo(()=>{if(!De)return null;const Z=new Set;for(const ne of n.current.agents.values())aC(ne,De)&&Z.add(ne.id);return Z},[n.current,n.current.lastSeq,De]),Jr=O.useMemo(()=>{const Z=new Set;for(const ne of n.current.agents.values())for(const fe of ne.tools)Z.add(oC(fe.name));return Object.keys(kg).filter(ne=>Z.has(ne))},[n.current,n.current.lastSeq]),rr=O.useMemo(()=>{const Z=new Map;for(const fe of n.current.agents.values())for(const ge of fe.tools){if(!ge.name.startsWith("mcp__"))continue;const ve=ge.name.slice(5),ye=ve.indexOf("__"),Ae=ye>0?ve.slice(0,ye):ve;Z.set(Ae,(Z.get(Ae)??0)+1)}const ne=[];for(const[fe,ge]of Z){let ve=5381;for(let ye=0;ye<fe.length;ye++)ve=(ve<<5)+ve^fe.charCodeAt(ye);ne.push({server:fe,count:ge,hue:Math.abs(ve)%360})}return ne.sort((fe,ge)=>ge.count-fe.count),ne},[n.current,n.current.lastSeq]),Pi=O.useCallback(Z=>{He(ne=>{const fe=new Set(ne);return fe.has(Z)?fe.delete(Z):fe.add(Z),fe})},[]),St=l?n.current.agents.get(l):null,ei=d?Array.from(n.current.agents.values()).flatMap(Z=>Z.tools).find(Z=>Z.id===d)??null:null,_r=O.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}n.current=xg(),je.current.clear(),Mt.current.clear(),Pt.current.clear(),Jn.current="",Sk(),m(),s()},[s,m]),Sr=O.useCallback(()=>{je.current.clear(),Pt.current.clear(),Jn.current="",Sk(),s(),window.setTimeout(()=>Je(500),80)},[s,e,Je]),Oi=O.useCallback(()=>Je(500),[Je]),Ge=O.useCallback(Z=>{if(Gt.length===0)return;const ne=Gt.slice().sort((ye,Ae)=>ye.position.y-Ae.position.y||ye.position.x-Ae.position.x),fe=l?ne.findIndex(ye=>ye.id===l):-1;let ge;fe===-1?ge=Z===1?0:ne.length-1:ge=(fe+Z+ne.length)%ne.length;const ve=ne[ge];ve&&(p(ve.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[ve]})}catch{}Ze.current=Date.now()},30))},[Gt,l,p,e]);O.useEffect(()=>{const Z=ne=>{var ge,ve;const fe=((ge=ne.target)==null?void 0:ge.tagName)==="INPUT";if(ne.key==="Escape"){fe?ne.target.blur():m();return}if(!fe){if(ne.key==="/"){ne.preventDefault(),(ve=yt.current)==null||ve.focus();return}ne.key===" "&&(ne.preventDefault(),ce(ye=>!ye)),(ne.key==="c"||ne.key==="C")&&_r(),(ne.key==="r"||ne.key==="R")&&Sr(),(ne.key==="f"||ne.key==="F")&&Oi(),(ne.key==="l"||ne.key==="L")&&$(),(ne.key==="h"||ne.key==="H")&&B(ye=>!ye),(ne.key==="u"||ne.key==="U")&&P(ye=>!ye),(ne.key==="a"||ne.key==="A")&&G(),(ne.key==="j"||ne.key==="J")&&Ge(1),(ne.key==="k"||ne.key==="K")&&Ge(-1),(ne.key==="t"||ne.key==="T")&&vt(ye=>ye==="dark"?"light":"dark")}};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[_r,Sr,Oi,m,Ge]);const ti=n.current.agents.size,ni=new Set(Array.from(n.current.agents.values()).map(Z=>Z.sessionId)).size,Ot=O.useMemo(()=>{let Z=0,ne=0,fe=0,ge=0,ve=0,ye=0,Ae=0,We=0,pt=0;for(const mt of n.current.agents.values()){Z+=mt.usage.inputTokens,ne+=mt.usage.outputTokens,fe+=mt.usage.cacheReadTokens,ge+=mt.usage.cacheCreateTokens;const Ye=tn(mt.usage,mt.model);ve+=Ye.total,ye+=Ye.input,Ae+=Ye.output,We+=Ye.cacheRead,pt+=Ye.cacheWrite}return{inT:Z,outT:ne,cacheR:fe,cacheC:ge,sum:Z+ne,cost:{total:ve,input:ye,output:Ae,cacheRead:We,cacheWrite:pt}}},[n.current,n.current.lastSeq]);return y.jsxs("div",{className:"app",children:[y.jsxs("header",{className:"topbar",children:[y.jsxs("div",{className:"brand",children:[y.jsx("span",{className:"logo"}),"agents-deck ",y.jsxs("span",{className:"v",children:["v","1.27.0"]})]}),St&&(()=>{const Z=tn(St.usage,St.model),ne=Math.max(0,((St.endedAt??me)-St.startedAt)/1e3),fe=St.state==="active"?gu(Z.total,ne):null,ge=o.size-1;return y.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${St.label}`,onClick:()=>{try{const ve=Gt.find(ye=>ye.id===St.id);ve&&e.fitView({padding:.35,duration:500,nodes:[ve]}),Ze.current=Date.now()}catch{}},children:[y.jsx("span",{className:`state-pill state-${St.state}`,children:St.state==="active"?"live":St.state}),y.jsx("span",{className:"selected-label",children:St.label}),Z.total>0&&y.jsxs("span",{className:"selected-cost",children:[$e(Z.total),fe?y.jsxs("span",{className:"selected-rate",children:[" · ",fe]}):null]}),ge>0&&y.jsxs("span",{className:"selected-extra",children:["+",ge]}),y.jsx("span",{role:"button","aria-label":"Deselect",className:"selected-close",onClick:ve=>{ve.stopPropagation(),m()},children:"×"})]})})(),y.jsxs("div",{className:"actions",children:[y.jsxs("div",{className:"search",children:[y.jsx("span",{className:"search-icon","aria-hidden":!0,children:"⌕"}),y.jsx("input",{ref:yt,type:"text",placeholder:"Search agents, cwd, tools…",value:De,onChange:Z=>xe(Z.target.value),spellCheck:!1,"aria-label":"Filter the graph"}),De?y.jsx("button",{className:"search-clear","aria-label":"Clear search",onClick:()=>xe(""),children:"×"}):y.jsx("kbd",{className:"search-kbd","aria-hidden":!0,children:"/"})]}),y.jsxs("span",{className:"status",role:"status",children:[y.jsx("span",{className:`pill ${W?"live":"dead"}`,title:W?"Receiving events":"SSE disconnected",children:W?"live":"offline"}),y.jsxs("span",{className:"stat",title:"Distinct CC sessions",children:[y.jsx("span",{className:"count",children:ni}),y.jsx("span",{className:"lbl",children:"sessions"})]}),y.jsxs("span",{className:"stat",title:"Total agents (root + subagents)",children:[y.jsx("span",{className:"count",children:ti}),y.jsx("span",{className:"lbl",children:"agents"})]}),y.jsxs("span",{className:"stat",title:"Total hook events received",children:[y.jsx("span",{className:"count",children:n.current.totalEvents}),y.jsx("span",{className:"lbl",children:"events"})]}),Ot.sum>0&&y.jsxs("span",{className:"stat",title:`in:${Ot.inT.toLocaleString()} out:${Ot.outT.toLocaleString()} cache-r:${Ot.cacheR.toLocaleString()} cache-c:${Ot.cacheC.toLocaleString()}`,children:[y.jsx("span",{className:"count",children:e$(Ot.sum)}),y.jsx("span",{className:"lbl",children:"tokens"})]}),rr.length>0&&y.jsxs("span",{className:"stat mcp-legend",title:`MCP servers seen this session:
|
|
60
|
+
${rr.map(Z=>` ${Z.server}: ${Z.count} call${Z.count===1?"":"s"}`).join(`
|
|
61
|
+
`)}`,children:[rr.slice(0,6).map(Z=>y.jsx("span",{className:"mcp-dot",style:{background:`hsl(${Z.hue} 65% 65%)`}},Z.server)),rr.length>6&&y.jsxs("span",{className:"mcp-more",children:["+",rr.length-6]}),y.jsx("span",{className:"lbl",children:"mcp"})]}),Ot.cost.total>0&&(()=>{let Z=0,ne=0;for(const ve of n.current.agents.values()){if(ve.state!=="active")continue;const ye=tn(ve.usage,ve.model);Z+=ye.total,ne=Math.max(ne,((ve.endedAt??me)-ve.startedAt)/1e3)}const fe=ne>0?gu(Z,ne):null,ge=`input ${$e(Ot.cost.input)} + output ${$e(Ot.cost.output)} + cache r ${$e(Ot.cost.cacheRead)} + cache w ${$e(Ot.cost.cacheWrite)}${fe?`
|
|
62
|
+
active burn: ${fe}`:""}`;return y.jsxs("span",{className:"stat",title:ge,children:[y.jsx("span",{className:"count",children:$e(Ot.cost.total)}),y.jsxs("span",{className:"lbl",children:["cost",fe?` · ${fe}`:""]})]})})()]}),y.jsx("button",{className:`btn ${se?"warn":""}`,onClick:()=>ce(Z=>!Z),title:"Pause/resume live updates (Space)",children:se?`Resume${pe.current.length?` · ${pe.current.length}`:""}`:"Pause"}),y.jsx("button",{className:`btn icon-btn ${I?"primary":""}`,onClick:()=>P(Z=>!Z),title:`${I?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel",children:"$"}),F!==null&&y.jsx("button",{className:`btn icon-btn ${F?"primary":""}`,onClick:Z=>{if(Z.shiftKey&&H>0){K(!0),fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restore"})}).then(()=>fetch("/api/sound-hook")).then(ne=>ne.ok?ne.json():null).then(ne=>{ne!=null&&ne.ok&&(q(ne.enabled===!0),re(ne.parked??0))}).catch(()=>{}).finally(()=>K(!1));return}X()},disabled:Q,title:(F?"Sound on turn finish: on — click to remove the hook":"Sound on turn finish: off — click to add a Stop hook")+(T>0?`
|
|
63
|
+
|
|
64
|
+
${T} sound hook${T>1?"s":""} of your own in settings.json also run${T>1?"":"s"} here.`:"")+(H>0?`
|
|
65
|
+
|
|
66
|
+
${H} of your own sound hook${H>1?"s were":" was"} set aside so this switch actually controls the sound. Nothing was deleted — shift-click to put ${H>1?"them":"it"} back.`:""),"aria-label":"Toggle finish sound","aria-pressed":F,children:y.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:[y.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),F?y.jsxs(y.Fragment,{children:[y.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),y.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):y.jsxs(y.Fragment,{children:[y.jsx("path",{d:"M10 5.6l2.6 2.8"}),y.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),y.jsx("button",{className:`btn icon-btn ${D?"primary":""}`,onClick:G,title:`${D?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel",children:y.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:[y.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),y.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),y.jsx("button",{className:`btn icon-btn ${N?"primary":""}`,onClick:$,title:`${N?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list",children:"☰"}),y.jsx("button",{className:`btn icon-btn ${M?"primary":""}`,onClick:()=>B(Z=>!Z),title:"Usage history — ccusage (H)","aria-label":"Open usage history",children:y.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[y.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),y.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),y.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),y.jsx("button",{className:"btn",onClick:Sr,title:"Auto-arrange — clear pins (R)",children:"Re-layout"}),y.jsx("button",{className:"btn",onClick:_r,title:"Clear canvas (C)",children:"Clear"}),y.jsx("button",{className:"btn icon-btn",onClick:()=>vt(Z=>Z==="dark"?"light":"dark"),title:`Switch to ${st==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:st==="dark"?"☀":"☾"})]})]}),lt&&!W&&y.jsxs("div",{className:"conn-banner",role:"alert",children:[y.jsx("span",{className:"conn-dot"}),"Lost connection to agents-deck server. Reconnecting…"]}),I&&y.jsx(v3,{state:n.current,now:me,onClose:()=>P(!1)}),D&&y.jsx(k3,{onClose:()=>A(!1)}),N&&y.jsx(u3,{state:n.current,now:me,selectedIds:o,onSelect:Z=>{p(Z,!1),window.setTimeout(()=>{try{const ne=Gt.find(fe=>fe.id===Z);ne&&e.fitView({padding:.3,duration:500,nodes:[ne]}),Ze.current=Date.now()}catch{}},60)},onClose:()=>E(!1)}),y.jsxs("div",{className:"canvas-wrap",ref:Ii,children:[ti===0&&y.jsx(b$,{live:W,everConnected:lt}),Jr.length>1&&y.jsx("div",{className:"cat-filter-bar",role:"toolbar","aria-label":"Filter tools by category",children:Jr.map(Z=>{const ne=_e.has(Z);return y.jsxs("button",{type:"button",className:`cat-filter${ne?" off":""}`,onClick:()=>Pi(Z),title:`${ne?"Show":"Hide"} ${Eg[Z]} tools`,children:[y.jsx("span",{className:"cat-emoji",children:kg[Z]}),y.jsx("span",{className:"cat-name",children:Eg[Z]})]},Z)})}),y.jsxs(zE,{nodes:jn,edges:Es,nodeTypes:t$,fitView:!ke,fitViewOptions:{padding:.25,duration:400},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,onNodeClick:(Z,ne)=>{if(ne.type==="sessionGroup"){m();return}p(ne.id,Z.shiftKey)},onPaneClick:()=>m(),onMoveStart:()=>{Date.now()-Ze.current<1200||Vn()},onMove:(Z,ne)=>{ot(),wt.current&&window.clearTimeout(wt.current),wt.current=window.setTimeout(()=>g$(ne),250)},onNodeDragStart:(Z,ne)=>{var fe;if(ot(),Vn(),ne.type==="sessionGroup"){const ge=(fe=ne.data)==null?void 0:fe.sessionId,ve=new Map;if(ge)for(const ye of Gt){const Ae=ye.data;(Ae==null?void 0:Ae.sessionId)===ge&&ve.set(ye.id,{x:ye.position.x,y:ye.position.y})}Me.current={start:{x:ne.position.x,y:ne.position.y},members:ve};return}je.current.set(ne.id,{x:ne.position.x,y:ne.position.y})},onNodeDrag:(Z,ne)=>{if(ot(),ne.type==="sessionGroup"){const fe=Me.current;if(!fe)return;const ge=ne.position.x-fe.start.x,ve=ne.position.y-fe.start.y;for(const[ye,Ae]of fe.members){const We={x:Ae.x+ge,y:Ae.y+ve};je.current.set(ye,We),Pt.current.set(ye,We)}z(ye=>ye+1);return}je.current.set(ne.id,{x:ne.position.x,y:ne.position.y}),Pt.current.set(ne.id,{x:ne.position.x,y:ne.position.y})},onNodeDragStop:(Z,ne)=>{if(ot(),ne.type==="sessionGroup"){const fe=Me.current;if(fe){const ge=ne.position.x-fe.start.x,ve=ne.position.y-fe.start.y;for(const[ye,Ae]of fe.members){const We={x:Ae.x+ge,y:Ae.y+ve};je.current.set(ye,We),Pt.current.set(ye,We)}}Me.current=null,rg(Pt.current,je.current),z(ge=>ge+1);return}je.current.set(ne.id,{x:ne.position.x,y:ne.position.y}),Pt.current.set(ne.id,{x:ne.position.x,y:ne.position.y}),rg(Pt.current,je.current)},children:[y.jsx(YM,{gap:28,size:1,color:wi("--grid-line")}),y.jsx(CP,{}),y.jsx(n3,{agents:n.current.agents,visibleAgentIds:Tn,positions:Pt.current,pinned:je.current,measured:Mt.current,dimUnmatched:Mi,spotlight:er,hiddenCategories:_e,now:me,onOpenTool:h}),y.jsx(BM,{showInteractive:!1,children:y.jsx(fs,{onClick:Cn,title:It?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:It?{color:"var(--accent)"}:void 0,children:y.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[y.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),y.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})})}),y.jsx(OM,{zoomable:!0,pannable:!0,nodeColor:Z=>{const ne=Z.data;return ne.state==="err"?wi("--err"):ne.state==="active"?wi("--inflight"):wi("--ok")},nodeStrokeWidth:2,maskColor:wi("--minimap-mask"),style:{background:wi("--panel"),border:`1px solid ${wi("--line")}`,borderRadius:8}})]})]}),k?y.jsxs("aside",{className:"detail",children:[y.jsx("button",{type:"button",className:"detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>j(!1),children:"×"}),St?y.jsx(N$,{agent:St,now:me,onOpenTool:h,onShowSummary:Z=>{b.current.has(Z)&&(b.current.delete(Z),_k(b.current)),x(Z)},onExportSession:Z=>v$(n.current,Z)}):y.jsx(E$,{count:ti})]}):y.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>j(!0),children:"‹"}),ei&&y.jsx(bP,{tool:ei,onClose:()=>h(null)}),M&&y.jsx(R3,{onClose:()=>B(!1)}),C&&(()=>{const Z=n.current.agents.get(C);return Z?y.jsx(pP,{agent:Z,onClose:()=>_(null)}):null})(),v&&y.jsx(r3,{state:n.current,sessionId:v,onClose:()=>{b.current.add(v),_k(b.current),x(null)}})]})}function b$({live:e,everConnected:n}){const i=!e;return y.jsxs("div",{className:"empty-hero",children:[y.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[y.jsx("div",{className:"core"}),y.jsxs("div",{className:"orbit r1",children:[y.jsx("span",{className:"dot"}),y.jsx("span",{className:"dot b"})]}),y.jsxs("div",{className:"orbit r2",children:[y.jsx("span",{className:"dot"}),y.jsx("span",{className:"dot b"})]}),y.jsxs("div",{className:"orbit r3",children:[y.jsx("span",{className:"dot"}),y.jsx("span",{className:"dot b"})]})]}),i?y.jsxs(y.Fragment,{children:[y.jsx("h2",{children:n?"Disconnected from server":"Server unreachable"}),y.jsxs("p",{children:["The browser cannot reach ",y.jsx("code",{children:"/events"}),". Check that",y.jsx("code",{children:"agents-deck"})," is still running in your terminal, then this page will resume automatically."]})]}):k$()]})}function k$(){return y.jsxs(y.Fragment,{children:[y.jsx("h2",{children:"Waiting for Claude Code or Codex"}),y.jsxs("p",{children:["Run ",y.jsx("code",{children:"claude"})," or ",y.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."]}),y.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",y.jsx("code",{children:"agents-deck"})," is running and that hooks are installed in ",y.jsx("code",{children:"~/.claude/settings.json"})," and"," ",y.jsx("code",{children:"~/.codex/hooks.json"}),". (Codex requires"," ",y.jsx("code",{children:"/hooks"})," trust on first run.)"]})]})}function E$({count:e}){return y.jsxs(y.Fragment,{children:[y.jsx("h3",{children:"Detail"}),e===0?y.jsxs("div",{className:"hint",children:["No data yet. Start a Claude Code or Codex session anywhere on this machine — agents-deck is in ",y.jsx("code",{children:"--all"})," mode and listens to every workspace."]}):y.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),y.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),y.jsxs("div",{className:"shortcuts",children:[y.jsxs("div",{className:"sc",children:[y.jsx("kbd",{children:"drag"}),y.jsx("span",{children:"move a node"})]}),y.jsxs("div",{className:"sc",children:[y.jsx("kbd",{children:"/"}),y.jsx("span",{children:"focus search"})]}),y.jsxs("div",{className:"sc",children:[y.jsx("kbd",{children:"space"}),y.jsx("span",{children:"pause / resume"})]}),y.jsxs("div",{className:"sc",children:[y.jsx("kbd",{children:"J"}),y.jsx("span",{children:"next agent"})]}),y.jsxs("div",{className:"sc",children:[y.jsx("kbd",{children:"K"}),y.jsx("span",{children:"previous agent"})]}),y.jsxs("div",{className:"sc",children:[y.jsx("kbd",{children:"R"}),y.jsx("span",{children:"re-arrange"})]}),y.jsxs("div",{className:"sc",children:[y.jsx("kbd",{children:"F"}),y.jsx("span",{children:"fit view"})]}),y.jsxs("div",{className:"sc",children:[y.jsx("kbd",{children:"L"}),y.jsx("span",{children:"session list"})]}),y.jsxs("div",{className:"sc",children:[y.jsx("kbd",{children:"H"}),y.jsx("span",{children:"usage history"})]}),y.jsxs("div",{className:"sc",children:[y.jsx("kbd",{children:"U"}),y.jsx("span",{children:"usage panel"})]}),y.jsxs("div",{className:"sc",children:[y.jsx("kbd",{children:"C"}),y.jsx("span",{children:"clear canvas"})]}),y.jsxs("div",{className:"sc",children:[y.jsx("kbd",{children:"T"}),y.jsx("span",{children:"toggle theme"})]}),y.jsxs("div",{className:"sc",children:[y.jsx("kbd",{children:"Esc"}),y.jsx("span",{children:"deselect"})]})]})]})}function N$({agent:e,now:n,onOpenTool:i,onShowSummary:s,onExportSession:o}){const u=(e.endedAt??n)-e.startedAt,l=Math.max(0,Math.floor(u/1e3)),c=l<60?`${l}s`:`${Math.floor(l/60)}m ${String(l%60).padStart(2,"0")}s`,d=tn(e.usage,e.model),h=d.total>0,p=e.usage.inputTokens+e.usage.outputTokens,m=new Map;for(const _ of e.tools){const S=oC(_.name);m.set(S,(m.get(S)??0)+1)}const v=e.tools.filter(_=>_.ok===!1).length,x=e.tools.filter(_=>!_.endedAt).length,C=Array.from(m.entries()).sort((_,S)=>S[1]-_[1]);return y.jsxs(y.Fragment,{children:[y.jsxs("header",{className:"detail-hero",children:[y.jsxs("div",{className:"hero-line",children:[y.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),y.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),y.jsxs("div",{className:"hero-meta",children:[y.jsx("span",{className:"hero-meta-item",children:e.kind}),y.jsx("span",{className:"hero-sep",children:"·"}),y.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:c}),e.model&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"hero-sep",children:"·"}),y.jsx("span",{className:"model-chip",title:e.model,children:Mo(e.model)})]})]}),h&&y.jsxs("div",{className:"hero-cost",children:[y.jsxs("div",{className:"hero-cost-headline",children:[y.jsx("span",{className:"hero-cost-value",children:$e(d.total)}),y.jsx("span",{className:"hero-cost-label",children:"spend"})]}),y.jsx(C$,{cost:d})]}),y.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&y.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),o&&y.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&&y.jsxs("section",{className:"detail-section",children:[y.jsx("h3",{children:"Activity"}),y.jsxs("div",{className:"activity-row",children:[y.jsxs("div",{className:"activity-counters",children:[y.jsxs("span",{className:"ac-item",children:[y.jsx("b",{children:e.toolCount})," calls"]}),x>0&&y.jsxs("span",{className:"ac-item ac-live",children:[y.jsx("b",{children:x})," live"]}),v>0&&y.jsxs("span",{className:"ac-item ac-err",children:[y.jsx("b",{children:v})," err"]})]}),y.jsx("div",{className:"cat-strip",children:C.map(([_,S])=>y.jsxs("span",{className:`cat-chip cat-${_}`,title:`${S} ${Eg[_]} call${S===1?"":"s"}`,children:[y.jsx("span",{className:"cat-emoji",children:kg[_]}),y.jsx("span",{className:"cat-count",children:S})]},_))})]})]}),p>0&&y.jsxs("section",{className:"detail-section",children:[y.jsx("h3",{children:"Tokens"}),y.jsxs("div",{className:"tokens-grid",children:[y.jsxs("div",{children:[y.jsx("span",{className:"k",children:"in"}),y.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),y.jsxs("div",{children:[y.jsx("span",{className:"k",children:"out"}),y.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),y.jsxs("div",{children:[y.jsx("span",{className:"k",children:"cache r"}),y.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),y.jsxs("div",{children:[y.jsx("span",{className:"k",children:"cache c"}),y.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),y.jsxs("section",{className:"detail-section",children:[y.jsx("h3",{children:"Identity"}),y.jsxs("div",{children:[e.cwd&&y.jsxs("div",{className:"row",children:[y.jsx("span",{className:"k",children:"cwd"}),y.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),y.jsxs("div",{className:"row",children:[y.jsx("span",{className:"k",children:"session"}),y.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&y.jsxs("div",{className:"row",children:[y.jsx("span",{className:"k",children:"parent"}),y.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&y.jsxs("section",{className:"detail-section",children:[y.jsxs("h3",{children:["Prompts ",y.jsx("span",{className:"section-count",children:e.prompts.length})]}),y.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((_,S)=>y.jsxs("div",{className:"prompt-entry",children:[y.jsx("div",{className:"prompt-time",children:new Date(_.at).toLocaleTimeString()}),y.jsx("div",{className:"prompt-text",children:_.text})]},S))})]}),y.jsxs("section",{className:"detail-section",children:[y.jsxs("h3",{children:["Tool calls ",y.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&y.jsx("div",{className:"empty",children:"No tool calls yet."}),y.jsx("div",{children:e.tools.slice().reverse().map(_=>y.jsx(R$,{t:_,now:n,onClick:()=>i(_.id)},_.id))})]})]})}function C$({cost:e}){const n=e.total;if(n<=0)return null;const i=(s,o,u)=>{if(s<=0)return null;const l=s/n*100;return y.jsx("span",{className:`cb-seg ${o}`,style:{width:`${l}%`},title:`${u}: ${$e(s)} (${l.toFixed(0)}%)`},o)};return y.jsxs("div",{className:"cost-bar","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 R$({t:e,now:n,onClick:i}){const s=e.endedAt==null?"inflight":e.ok===!1?"err":"done",o=(e.endedAt??n)-e.startedAt,u=e.endedAt==null?"…":o<1e3?`${o}ms`:`${(o/1e3).toFixed(1)}s`;return y.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:i,children:[y.jsxs("span",{className:"name",children:[y.jsx("span",{className:`status-dot ${s}`}),e.name]}),y.jsx("span",{style:{color:"var(--muted)"},children:u})]})}const T$=GR.createRoot(document.getElementById("root"));T$.render(y.jsx(_$,{}));
|