@wrongstack/webui-hq 0.284.0 → 0.285.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/assets/icons-DqY1dCmo.js +1 -0
- package/dist/assets/index-8UgsUYFY.js +21 -0
- package/dist/assets/index-Cw3VaZli.css +1 -0
- package/dist/assets/markdown-1TXf7spl.js +35 -0
- package/dist/assets/rolldown-runtime-QTnfLwEv.js +1 -0
- package/dist/assets/vendor-B486on_u.js +9 -0
- package/dist/index.html +6 -5
- package/package.json +6 -6
- package/dist/assets/icons-pvlkbVv-.js +0 -304
- package/dist/assets/index-B3kgppNi.css +0 -1
- package/dist/assets/index-BVzUGgAc.js +0 -62
- package/dist/assets/markdown-DMGNhxEM.js +0 -43
- package/dist/assets/vendor-CGiuGcge.js +0 -9
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import{j as d,M as z1,r as D1,a as O1}from"./markdown-DMGNhxEM.js";import{r as rd,a as z,Z as K0,U as H1,C as k1,H as R1,b as J0,c as B1,B as ud,T as F0,S as As,M as U1,d as ui,O as L1,L as $1,e as W0,g as V1,R as P0,f as ey,h as Y1,W as wg,i as X1,j as I1,G as G1,F as Z1,D as Q1,k as K1,l as J1,m as F1,n as W1,o as P1,P as fd,p as eS,q as tS,s as nS,t as ty,u as lS,v as aS,w as iS,x as sS,y as oS,z as cS,A as dd,E as Wa,I as rS,J as uS,K as ny,N as fS,X as dS,Q as ly,V as hd,Y as md,_ as hS,$ as mS,a0 as pS,a1 as gS}from"./icons-pvlkbVv-.js";import{r as ay}from"./vendor-CGiuGcge.js";(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function s(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(c){if(c.ep)return;c.ep=!0;const u=s(c);fetch(c.href,u)}})();var mf={exports:{}},cs={},pf={exports:{}},gf={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* scheduler.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and 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 Ng;function yS(){return Ng||(Ng=1,(function(n){function a(E,M){var O=E.length;E.push(M);e:for(;0<O;){var R=O-1>>>1,Z=E[R];if(0<c(Z,M))E[R]=M,E[O]=Z,O=R;else break e}}function s(E){return E.length===0?null:E[0]}function o(E){if(E.length===0)return null;var M=E[0],O=E.pop();if(O!==M){E[0]=O;e:for(var R=0,Z=E.length,ee=Z>>>1;R<ee;){var P=2*(R+1)-1,oe=E[P],ce=P+1,ue=E[ce];if(0>c(oe,O))ce<Z&&0>c(ue,oe)?(E[R]=ue,E[ce]=O,R=ce):(E[R]=oe,E[P]=O,R=P);else if(ce<Z&&0>c(ue,O))E[R]=ue,E[ce]=O,R=ce;else break e}}return M}function c(E,M){var O=E.sortIndex-M.sortIndex;return O!==0?O:E.id-M.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var f=Date,m=f.now();n.unstable_now=function(){return f.now()-m}}var p=[],y=[],x=1,g=null,v=3,S=!1,w=!1,q=!1,C=!1,_=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function A(E){for(var M=s(y);M!==null;){if(M.callback===null)o(y);else if(M.startTime<=E)o(y),M.sortIndex=M.expirationTime,a(p,M);else break;M=s(y)}}function $(E){if(q=!1,A(E),!w)if(s(p)!==null)w=!0,D||(D=!0,F());else{var M=s(y);M!==null&&B($,M.startTime-E)}}var D=!1,L=-1,Y=5,G=-1;function te(){return C?!0:!(n.unstable_now()-G<Y)}function I(){if(C=!1,D){var E=n.unstable_now();G=E;var M=!0;try{e:{w=!1,q&&(q=!1,k(L),L=-1),S=!0;var O=v;try{t:{for(A(E),g=s(p);g!==null&&!(g.expirationTime>E&&te());){var R=g.callback;if(typeof R=="function"){g.callback=null,v=g.priorityLevel;var Z=R(g.expirationTime<=E);if(E=n.unstable_now(),typeof Z=="function"){g.callback=Z,A(E),M=!0;break t}g===s(p)&&o(p),A(E)}else o(p);g=s(p)}if(g!==null)M=!0;else{var ee=s(y);ee!==null&&B($,ee.startTime-E),M=!1}}break e}finally{g=null,v=O,S=!1}M=void 0}}finally{M?F():D=!1}}}var F;if(typeof j=="function")F=function(){j(I)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,T=V.port2;V.port1.onmessage=I,F=function(){T.postMessage(null)}}else F=function(){_(I,0)};function B(E,M){L=_(function(){E(n.unstable_now())},M)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(E){E.callback=null},n.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<E?Math.floor(1e3/E):5},n.unstable_getCurrentPriorityLevel=function(){return v},n.unstable_next=function(E){switch(v){case 1:case 2:case 3:var M=3;break;default:M=v}var O=v;v=M;try{return E()}finally{v=O}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(E,M){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var O=v;v=E;try{return M()}finally{v=O}},n.unstable_scheduleCallback=function(E,M,O){var R=n.unstable_now();switch(typeof O=="object"&&O!==null?(O=O.delay,O=typeof O=="number"&&0<O?R+O:R):O=R,E){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=O+Z,E={id:x++,callback:M,priorityLevel:E,startTime:O,expirationTime:Z,sortIndex:-1},O>R?(E.sortIndex=O,a(y,E),s(p)===null&&E===s(y)&&(q?(k(L),L=-1):q=!0,B($,O-R))):(E.sortIndex=Z,a(p,E),w||S||(w=!0,D||(D=!0,F()))),E},n.unstable_shouldYield=te,n.unstable_wrapCallback=function(E){var M=v;return function(){var O=v;v=M;try{return E.apply(this,arguments)}finally{v=O}}}})(gf)),gf}var jg;function vS(){return jg||(jg=1,pf.exports=yS()),pf.exports}/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-dom-client.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and 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 Eg;function xS(){if(Eg)return cs;Eg=1;var n=vS(),a=rd(),s=ay();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function f(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(u(e)!==e)throw Error(o(188))}function y(e){var t=e.alternate;if(!t){if(t=u(e),t===null)throw Error(o(188));return t!==e?null:e}for(var l=e,i=t;;){var r=l.return;if(r===null)break;var h=r.alternate;if(h===null){if(i=r.return,i!==null){l=i;continue}break}if(r.child===h.child){for(h=r.child;h;){if(h===l)return p(r),e;if(h===i)return p(r),t;h=h.sibling}throw Error(o(188))}if(l.return!==i.return)l=r,i=h;else{for(var b=!1,N=r.child;N;){if(N===l){b=!0,l=r,i=h;break}if(N===i){b=!0,i=r,l=h;break}N=N.sibling}if(!b){for(N=h.child;N;){if(N===l){b=!0,l=h,i=r;break}if(N===i){b=!0,i=h,l=r;break}N=N.sibling}if(!b)throw Error(o(189))}}if(l.alternate!==i)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?e:t}function x(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=x(e),t!==null)return t;e=e.sibling}return null}var g=Object.assign,v=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),j=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),te=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function F(e){return e===null||typeof e!="object"?null:(e=I&&e[I]||e["@@iterator"],typeof e=="function"?e:null)}var V=Symbol.for("react.client.reference");function T(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===V?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case q:return"Fragment";case _:return"Profiler";case C:return"StrictMode";case $:return"Suspense";case D:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case j:return e.displayName||"Context";case k:return(e._context.displayName||"Context")+".Consumer";case A:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case L:return t=e.displayName||null,t!==null?t:T(e.type)||"Memo";case Y:t=e._payload,e=e._init;try{return T(e(t))}catch{}}return null}var B=Array.isArray,E=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O={pending:!1,data:null,method:null,action:null},R=[],Z=-1;function ee(e){return{current:e}}function P(e){0>Z||(e.current=R[Z],R[Z]=null,Z--)}function oe(e,t){Z++,R[Z]=e.current,e.current=t}var ce=ee(null),ue=ee(null),xe=ee(null),de=ee(null);function le(e,t){switch(oe(xe,t),oe(ue,e),oe(ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ip(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ip(t),e=Gp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}P(ce),oe(ce,e)}function re(){P(ce),P(ue),P(xe)}function pe(e){e.memoizedState!==null&&oe(de,e);var t=ce.current,l=Gp(t,e.type);t!==l&&(oe(ue,e),oe(ce,l))}function Se(e){ue.current===e&&(P(ce),P(ue)),de.current===e&&(P(de),as._currentValue=O)}var he,ge;function we(e){if(he===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);he=t&&t[1]||"",ge=-1<l.stack.indexOf(`
|
|
18
|
-
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
19
|
-
`+he+e+ge}var Ee=!1;function Be(e,t){if(!e||Ee)return"";Ee=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(W){var J=W}Reflect.construct(e,[],ie)}else{try{ie.call()}catch(W){J=W}e.call(ie.prototype)}}else{try{throw Error()}catch(W){J=W}(ie=e())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(W){if(W&&J&&typeof W.stack=="string")return[W.stack,J.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=i.DetermineComponentFrameRoot(),b=h[0],N=h[1];if(b&&N){var H=b.split(`
|
|
20
|
-
`),K=N.split(`
|
|
21
|
-
`);for(r=i=0;i<H.length&&!H[i].includes("DetermineComponentFrameRoot");)i++;for(;r<K.length&&!K[r].includes("DetermineComponentFrameRoot");)r++;if(i===H.length||r===K.length)for(i=H.length-1,r=K.length-1;1<=i&&0<=r&&H[i]!==K[r];)r--;for(;1<=i&&0<=r;i--,r--)if(H[i]!==K[r]){if(i!==1||r!==1)do if(i--,r--,0>r||H[i]!==K[r]){var ne=`
|
|
22
|
-
`+H[i].replace(" at new "," at ");return e.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",e.displayName)),ne}while(1<=i&&0<=r);break}}}finally{Ee=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?we(l):""}function Je(e,t){switch(e.tag){case 26:case 27:case 5:return we(e.type);case 16:return we("Lazy");case 13:return e.child!==t&&t!==null?we("Suspense Fallback"):we("Suspense");case 19:return we("SuspenseList");case 0:case 15:return Be(e.type,!1);case 11:return Be(e.type.render,!1);case 1:return Be(e.type,!0);case 31:return we("Activity");default:return""}}function pt(e){try{var t="",l=null;do t+=Je(e,l),l=e,e=e.return;while(e);return t}catch(i){return`
|
|
23
|
-
Error generating stack: `+i.message+`
|
|
24
|
-
`+i.stack}}var ht=Object.prototype.hasOwnProperty,se=n.unstable_scheduleCallback,Oe=n.unstable_cancelCallback,xn=n.unstable_shouldYield,bn=n.unstable_requestPaint,Fe=n.unstable_now,Mt=n.unstable_getCurrentPriorityLevel,Lt=n.unstable_ImmediatePriority,$t=n.unstable_UserBlockingPriority,Vt=n.unstable_NormalPriority,Fc=n.unstable_LowPriority,sa=n.unstable_IdlePriority,Wc=n.log,Pc=n.unstable_setDisableYieldValue,Ml=null,gt=null;function un(e){if(typeof Wc=="function"&&Pc(e),gt&&typeof gt.setStrictMode=="function")try{gt.setStrictMode(Ml,e)}catch{}}var yt=Math.clz32?Math.clz32:nr,er=Math.log,tr=Math.LN2;function nr(e){return e>>>=0,e===0?32:31-(er(e)/tr|0)|0}var oa=256,ca=262144,ra=4194304;function Sn(e){var t=e&42;if(t!==0)return t;switch(e&-e){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ua(e,t,l){var i=e.pendingLanes;if(i===0)return 0;var r=0,h=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var N=i&134217727;return N!==0?(i=N&~h,i!==0?r=Sn(i):(b&=N,b!==0?r=Sn(b):l||(l=N&~e,l!==0&&(r=Sn(l))))):(N=i&~h,N!==0?r=Sn(N):b!==0?r=Sn(b):l||(l=i&~e,l!==0&&(r=Sn(l)))),r===0?0:t!==0&&t!==r&&(t&h)===0&&(h=r&-r,l=t&-t,h>=l||h===32&&(l&4194048)!==0)?t:r}function Tl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function lr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Bs(){var e=ra;return ra<<=1,(ra&62914560)===0&&(ra=4194304),e}function fi(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function Al(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ar(e,t,l,i,r,h){var b=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var N=e.entanglements,H=e.expirationTimes,K=e.hiddenUpdates;for(l=b&~l;0<l;){var ne=31-yt(l),ie=1<<ne;N[ne]=0,H[ne]=-1;var J=K[ne];if(J!==null)for(K[ne]=null,ne=0;ne<J.length;ne++){var W=J[ne];W!==null&&(W.lane&=-536870913)}l&=~ie}i!==0&&Us(e,i,0),h!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=h&~(b&~t))}function Us(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-yt(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|l&261930}function Ls(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var i=31-yt(l),r=1<<i;r&t|e[i]&t&&(e[i]|=t),l&=~r}}function $s(e,t){var l=t&-t;return l=(l&42)!==0?1:di(l),(l&(e.suspendedLanes|t))!==0?0:l}function di(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function hi(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Vs(){var e=M.p;return e!==0?e:(e=window.event,e===void 0?32:pg(e.type))}function Ys(e,t){var l=M.p;try{return M.p=e,t()}finally{M.p=l}}var fn=Math.random().toString(36).slice(2),st="__reactFiber$"+fn,mt="__reactProps$"+fn,wn="__reactContainer$"+fn,fa="__reactEvents$"+fn,Xs="__reactListeners$"+fn,ir="__reactHandles$"+fn,Is="__reactResources$"+fn,zl="__reactMarker$"+fn;function mi(e){delete e[st],delete e[mt],delete e[fa],delete e[Xs],delete e[ir]}function Gn(e){var t=e[st];if(t)return t;for(var l=e.parentNode;l;){if(t=l[wn]||l[st]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=Pp(e);e!==null;){if(l=e[st])return l;e=Pp(e)}return t}e=l,l=e.parentNode}return null}function Zn(e){if(e=e[st]||e[wn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Qn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Kn(e){var t=e[Is];return t||(t=e[Is]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function et(e){e[zl]=!0}var Gs=new Set,Zs={};function Nn(e,t){Jn(e,t),Jn(e+"Capture",t)}function Jn(e,t){for(Zs[e]=t,e=0;e<t.length;e++)Gs.add(t[e])}var sr=RegExp("^[: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]*$"),Qs={},pi={};function or(e){return ht.call(pi,e)?!0:ht.call(Qs,e)?!1:sr.test(e)?pi[e]=!0:(Qs[e]=!0,!1)}function da(e,t,l){if(or(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function ha(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function Ft(e,t,l,i){if(i===null)e.removeAttribute(l);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+i)}}function xt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ks(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function cr(e,t,l){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var r=i.get,h=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(b){l=""+b,h.call(this,b)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function gi(e){if(!e._valueTracker){var t=Ks(e)?"checked":"value";e._valueTracker=cr(e,t,""+e[t])}}function yi(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),i="";return e&&(i=Ks(e)?e.checked?"true":"false":e.value),e=i,e!==l?(t.setValue(e),!0):!1}function ma(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Js=/[\n"\\]/g;function bt(e){return e.replace(Js,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function vi(e,t,l,i,r,h,b,N){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+xt(t)):e.value!==""+xt(t)&&(e.value=""+xt(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?xi(e,b,xt(t)):l!=null?xi(e,b,xt(l)):i!=null&&e.removeAttribute("value"),r==null&&h!=null&&(e.defaultChecked=!!h),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+xt(N):e.removeAttribute("name")}function pa(e,t,l,i,r,h,b,N){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),t!=null||l!=null){if(!(h!=="submit"&&h!=="reset"||t!=null)){gi(e);return}l=l!=null?""+xt(l):"",t=t!=null?""+xt(t):l,N||t===e.value||(e.value=t),e.defaultValue=t}i=i??r,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=N?e.checked:!!i,e.defaultChecked=!!i,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),gi(e)}function xi(e,t,l){t==="number"&&ma(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Fn(e,t,l,i){if(e=e.options,t){t={};for(var r=0;r<l.length;r++)t["$"+l[r]]=!0;for(l=0;l<e.length;l++)r=t.hasOwnProperty("$"+e[l].value),e[l].selected!==r&&(e[l].selected=r),r&&i&&(e[l].defaultSelected=!0)}else{for(l=""+xt(l),t=null,r=0;r<e.length;r++){if(e[r].value===l){e[r].selected=!0,i&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function bi(e,t,l){if(t!=null&&(t=""+xt(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+xt(l):""}function $d(e,t,l,i){if(t==null){if(i!=null){if(l!=null)throw Error(o(92));if(B(i)){if(1<i.length)throw Error(o(93));i=i[0]}l=i}l==null&&(l=""),t=l}l=xt(t),e.defaultValue=l,i=e.textContent,i===l&&i!==""&&i!==null&&(e.value=i),gi(e)}function ga(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var qx=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Vd(e,t,l){var i=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,l):typeof l!="number"||l===0||qx.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function Yd(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var i in l)!l.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var r in t)i=t[r],t.hasOwnProperty(r)&&l[r]!==i&&Vd(e,r,i)}else for(var h in t)t.hasOwnProperty(h)&&Vd(e,h,t[h])}function rr(e){if(e.indexOf("-")===-1)return!1;switch(e){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 Cx=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Mx=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Fs(e){return Mx.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function jn(){}var ur=null;function fr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ya=null,va=null;function Xd(e){var t=Zn(e);if(t&&(e=t.stateNode)){var l=e[mt]||null;e:switch(e=t.stateNode,t.type){case"input":if(vi(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+bt(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var i=l[t];if(i!==e&&i.form===e.form){var r=i[mt]||null;if(!r)throw Error(o(90));vi(i,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<l.length;t++)i=l[t],i.form===e.form&&yi(i)}break e;case"textarea":bi(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Fn(e,!!l.multiple,t,!1)}}}var dr=!1;function Id(e,t,l){if(dr)return e(t,l);dr=!0;try{var i=e(t);return i}finally{if(dr=!1,(ya!==null||va!==null)&&(Uo(),ya&&(t=ya,e=va,va=ya=null,Xd(t),e)))for(t=0;t<e.length;t++)Xd(e[t])}}function Si(e,t){var l=e.stateNode;if(l===null)return null;var i=l[mt]||null;if(i===null)return null;l=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var En=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hr=!1;if(En)try{var wi={};Object.defineProperty(wi,"passive",{get:function(){hr=!0}}),window.addEventListener("test",wi,wi),window.removeEventListener("test",wi,wi)}catch{hr=!1}var Wn=null,mr=null,Ws=null;function Gd(){if(Ws)return Ws;var e,t=mr,l=t.length,i,r="value"in Wn?Wn.value:Wn.textContent,h=r.length;for(e=0;e<l&&t[e]===r[e];e++);var b=l-e;for(i=1;i<=b&&t[l-i]===r[h-i];i++);return Ws=r.slice(e,1<i?1-i:void 0)}function Ps(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function eo(){return!0}function Zd(){return!1}function St(e){function t(l,i,r,h,b){this._reactName=l,this._targetInst=r,this.type=i,this.nativeEvent=h,this.target=b,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(l=e[N],this[N]=l?l(h):h[N]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?eo:Zd,this.isPropagationStopped=Zd,this}return g(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=eo)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=eo)},persist:function(){},isPersistent:eo}),t}var Dl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},to=St(Dl),Ni=g({},Dl,{view:0,detail:0}),Tx=St(Ni),pr,gr,ji,no=g({},Ni,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ji&&(ji&&e.type==="mousemove"?(pr=e.screenX-ji.screenX,gr=e.screenY-ji.screenY):gr=pr=0,ji=e),pr)},movementY:function(e){return"movementY"in e?e.movementY:gr}}),Qd=St(no),Ax=g({},no,{dataTransfer:0}),zx=St(Ax),Dx=g({},Ni,{relatedTarget:0}),yr=St(Dx),Ox=g({},Dl,{animationName:0,elapsedTime:0,pseudoElement:0}),Hx=St(Ox),kx=g({},Dl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Rx=St(kx),Bx=g({},Dl,{data:0}),Kd=St(Bx),Ux={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Lx={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"},$x={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vx(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=$x[e])?!!t[e]:!1}function vr(){return Vx}var Yx=g({},Ni,{key:function(e){if(e.key){var t=Ux[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ps(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Lx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vr,charCode:function(e){return e.type==="keypress"?Ps(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ps(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Xx=St(Yx),Ix=g({},no,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jd=St(Ix),Gx=g({},Ni,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vr}),Zx=St(Gx),Qx=g({},Dl,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kx=St(Qx),Jx=g({},no,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Fx=St(Jx),Wx=g({},Dl,{newState:0,oldState:0}),Px=St(Wx),eb=[9,13,27,32],xr=En&&"CompositionEvent"in window,Ei=null;En&&"documentMode"in document&&(Ei=document.documentMode);var tb=En&&"TextEvent"in window&&!Ei,Fd=En&&(!xr||Ei&&8<Ei&&11>=Ei),Wd=" ",Pd=!1;function eh(e,t){switch(e){case"keyup":return eb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function th(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var xa=!1;function nb(e,t){switch(e){case"compositionend":return th(t);case"keypress":return t.which!==32?null:(Pd=!0,Wd);case"textInput":return e=t.data,e===Wd&&Pd?null:e;default:return null}}function lb(e,t){if(xa)return e==="compositionend"||!xr&&eh(e,t)?(e=Gd(),Ws=mr=Wn=null,xa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Fd&&t.locale!=="ko"?null:t.data;default:return null}}var ab={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 nh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ab[e.type]:t==="textarea"}function lh(e,t,l,i){ya?va?va.push(i):va=[i]:ya=i,t=Go(t,"onChange"),0<t.length&&(l=new to("onChange","change",null,l,i),e.push({event:l,listeners:t}))}var _i=null,qi=null;function ib(e){Up(e,0)}function lo(e){var t=Qn(e);if(yi(t))return e}function ah(e,t){if(e==="change")return t}var ih=!1;if(En){var br;if(En){var Sr="oninput"in document;if(!Sr){var sh=document.createElement("div");sh.setAttribute("oninput","return;"),Sr=typeof sh.oninput=="function"}br=Sr}else br=!1;ih=br&&(!document.documentMode||9<document.documentMode)}function oh(){_i&&(_i.detachEvent("onpropertychange",ch),qi=_i=null)}function ch(e){if(e.propertyName==="value"&&lo(qi)){var t=[];lh(t,qi,e,fr(e)),Id(ib,t)}}function sb(e,t,l){e==="focusin"?(oh(),_i=t,qi=l,_i.attachEvent("onpropertychange",ch)):e==="focusout"&&oh()}function ob(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return lo(qi)}function cb(e,t){if(e==="click")return lo(t)}function rb(e,t){if(e==="input"||e==="change")return lo(t)}function ub(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Tt=typeof Object.is=="function"?Object.is:ub;function Ci(e,t){if(Tt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),i=Object.keys(t);if(l.length!==i.length)return!1;for(i=0;i<l.length;i++){var r=l[i];if(!ht.call(t,r)||!Tt(e[r],t[r]))return!1}return!0}function rh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function uh(e,t){var l=rh(e);e=0;for(var i;l;){if(l.nodeType===3){if(i=e+l.textContent.length,e<=t&&i>=t)return{node:l,offset:t-e};e=i}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=rh(l)}}function fh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?fh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function dh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ma(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=ma(e.document)}return t}function wr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var fb=En&&"documentMode"in document&&11>=document.documentMode,ba=null,Nr=null,Mi=null,jr=!1;function hh(e,t,l){var i=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;jr||ba==null||ba!==ma(i)||(i=ba,"selectionStart"in i&&wr(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Mi&&Ci(Mi,i)||(Mi=i,i=Go(Nr,"onSelect"),0<i.length&&(t=new to("onSelect","select",null,t,l),e.push({event:t,listeners:i}),t.target=ba)))}function Ol(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Sa={animationend:Ol("Animation","AnimationEnd"),animationiteration:Ol("Animation","AnimationIteration"),animationstart:Ol("Animation","AnimationStart"),transitionrun:Ol("Transition","TransitionRun"),transitionstart:Ol("Transition","TransitionStart"),transitioncancel:Ol("Transition","TransitionCancel"),transitionend:Ol("Transition","TransitionEnd")},Er={},mh={};En&&(mh=document.createElement("div").style,"AnimationEvent"in window||(delete Sa.animationend.animation,delete Sa.animationiteration.animation,delete Sa.animationstart.animation),"TransitionEvent"in window||delete Sa.transitionend.transition);function Hl(e){if(Er[e])return Er[e];if(!Sa[e])return e;var t=Sa[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in mh)return Er[e]=t[l];return e}var ph=Hl("animationend"),gh=Hl("animationiteration"),yh=Hl("animationstart"),db=Hl("transitionrun"),hb=Hl("transitionstart"),mb=Hl("transitioncancel"),vh=Hl("transitionend"),xh=new Map,_r="abort auxClick beforeToggle 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(" ");_r.push("scrollEnd");function Wt(e,t){xh.set(e,t),Nn(t,[e])}var ao=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Yt=[],wa=0,qr=0;function io(){for(var e=wa,t=qr=wa=0;t<e;){var l=Yt[t];Yt[t++]=null;var i=Yt[t];Yt[t++]=null;var r=Yt[t];Yt[t++]=null;var h=Yt[t];if(Yt[t++]=null,i!==null&&r!==null){var b=i.pending;b===null?r.next=r:(r.next=b.next,b.next=r),i.pending=r}h!==0&&bh(l,r,h)}}function so(e,t,l,i){Yt[wa++]=e,Yt[wa++]=t,Yt[wa++]=l,Yt[wa++]=i,qr|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Cr(e,t,l,i){return so(e,t,l,i),oo(e)}function kl(e,t){return so(e,null,null,t),oo(e)}function bh(e,t,l){e.lanes|=l;var i=e.alternate;i!==null&&(i.lanes|=l);for(var r=!1,h=e.return;h!==null;)h.childLanes|=l,i=h.alternate,i!==null&&(i.childLanes|=l),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(r=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,r&&t!==null&&(r=31-yt(l),e=h.hiddenUpdates,i=e[r],i===null?e[r]=[t]:i.push(t),t.lane=l|536870912),h):null}function oo(e){if(50<Fi)throw Fi=0,Ru=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Na={};function pb(e,t,l,i){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function At(e,t,l,i){return new pb(e,t,l,i)}function Mr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _n(e,t){var l=e.alternate;return l===null?(l=At(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Sh(e,t){e.flags&=65011714;var l=e.alternate;return l===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function co(e,t,l,i,r,h){var b=0;if(i=e,typeof e=="function")Mr(e)&&(b=1);else if(typeof e=="string")b=b1(e,l,ce.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=At(31,l,t,r),e.elementType=G,e.lanes=h,e;case q:return Rl(l.children,r,h,t);case C:b=8,r|=24;break;case _:return e=At(12,l,t,r|2),e.elementType=_,e.lanes=h,e;case $:return e=At(13,l,t,r),e.elementType=$,e.lanes=h,e;case D:return e=At(19,l,t,r),e.elementType=D,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case j:b=10;break e;case k:b=9;break e;case A:b=11;break e;case L:b=14;break e;case Y:b=16,i=null;break e}b=29,l=Error(o(130,e===null?"null":typeof e,"")),i=null}return t=At(b,l,t,r),t.elementType=e,t.type=i,t.lanes=h,t}function Rl(e,t,l,i){return e=At(7,e,i,t),e.lanes=l,e}function Tr(e,t,l){return e=At(6,e,null,t),e.lanes=l,e}function wh(e){var t=At(18,null,null,0);return t.stateNode=e,t}function Ar(e,t,l){return t=At(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Nh=new WeakMap;function Xt(e,t){if(typeof e=="object"&&e!==null){var l=Nh.get(e);return l!==void 0?l:(t={value:e,source:t,stack:pt(t)},Nh.set(e,t),t)}return{value:e,source:t,stack:pt(t)}}var ja=[],Ea=0,ro=null,Ti=0,It=[],Gt=0,Pn=null,dn=1,hn="";function qn(e,t){ja[Ea++]=Ti,ja[Ea++]=ro,ro=e,Ti=t}function jh(e,t,l){It[Gt++]=dn,It[Gt++]=hn,It[Gt++]=Pn,Pn=e;var i=dn;e=hn;var r=32-yt(i)-1;i&=~(1<<r),l+=1;var h=32-yt(t)+r;if(30<h){var b=r-r%5;h=(i&(1<<b)-1).toString(32),i>>=b,r-=b,dn=1<<32-yt(t)+r|l<<r|i,hn=h+e}else dn=1<<h|l<<r|i,hn=e}function zr(e){e.return!==null&&(qn(e,1),jh(e,1,0))}function Dr(e){for(;e===ro;)ro=ja[--Ea],ja[Ea]=null,Ti=ja[--Ea],ja[Ea]=null;for(;e===Pn;)Pn=It[--Gt],It[Gt]=null,hn=It[--Gt],It[Gt]=null,dn=It[--Gt],It[Gt]=null}function Eh(e,t){It[Gt++]=dn,It[Gt++]=hn,It[Gt++]=Pn,dn=t.id,hn=t.overflow,Pn=e}var rt=null,Ye=null,Te=!1,el=null,Zt=!1,Or=Error(o(519));function tl(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ai(Xt(t,e)),Or}function _h(e){var t=e.stateNode,l=e.type,i=e.memoizedProps;switch(t[st]=e,t[mt]=i,l){case"dialog":qe("cancel",t),qe("close",t);break;case"iframe":case"object":case"embed":qe("load",t);break;case"video":case"audio":for(l=0;l<Pi.length;l++)qe(Pi[l],t);break;case"source":qe("error",t);break;case"img":case"image":case"link":qe("error",t),qe("load",t);break;case"details":qe("toggle",t);break;case"input":qe("invalid",t),pa(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":qe("invalid",t);break;case"textarea":qe("invalid",t),$d(t,i.value,i.defaultValue,i.children)}l=i.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||i.suppressHydrationWarning===!0||Yp(t.textContent,l)?(i.popover!=null&&(qe("beforetoggle",t),qe("toggle",t)),i.onScroll!=null&&qe("scroll",t),i.onScrollEnd!=null&&qe("scrollend",t),i.onClick!=null&&(t.onclick=jn),t=!0):t=!1,t||tl(e,!0)}function qh(e){for(rt=e.return;rt;)switch(rt.tag){case 5:case 31:case 13:Zt=!1;return;case 27:case 3:Zt=!0;return;default:rt=rt.return}}function _a(e){if(e!==rt)return!1;if(!Te)return qh(e),Te=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Wu(e.type,e.memoizedProps)),l=!l),l&&Ye&&tl(e),qh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Ye=Wp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Ye=Wp(e)}else t===27?(t=Ye,pl(e.type)?(e=lf,lf=null,Ye=e):Ye=t):Ye=rt?Kt(e.stateNode.nextSibling):null;return!0}function Bl(){Ye=rt=null,Te=!1}function Hr(){var e=el;return e!==null&&(Et===null?Et=e:Et.push.apply(Et,e),el=null),e}function Ai(e){el===null?el=[e]:el.push(e)}var kr=ee(null),Ul=null,Cn=null;function nl(e,t,l){oe(kr,t._currentValue),t._currentValue=l}function Mn(e){e._currentValue=kr.current,P(kr)}function Rr(e,t,l){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===l)break;e=e.return}}function Br(e,t,l,i){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var h=r.dependencies;if(h!==null){var b=r.child;h=h.firstContext;e:for(;h!==null;){var N=h;h=r;for(var H=0;H<t.length;H++)if(N.context===t[H]){h.lanes|=l,N=h.alternate,N!==null&&(N.lanes|=l),Rr(h.return,l,e),i||(b=null);break e}h=N.next}}else if(r.tag===18){if(b=r.return,b===null)throw Error(o(341));b.lanes|=l,h=b.alternate,h!==null&&(h.lanes|=l),Rr(b,l,e),b=null}else b=r.child;if(b!==null)b.return=r;else for(b=r;b!==null;){if(b===e){b=null;break}if(r=b.sibling,r!==null){r.return=b.return,b=r;break}b=b.return}r=b}}function qa(e,t,l,i){e=null;for(var r=t,h=!1;r!==null;){if(!h){if((r.flags&524288)!==0)h=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var b=r.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var N=r.type;Tt(r.pendingProps.value,b.value)||(e!==null?e.push(N):e=[N])}}else if(r===de.current){if(b=r.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(as):e=[as])}r=r.return}e!==null&&Br(t,e,l,i),t.flags|=262144}function uo(e){for(e=e.firstContext;e!==null;){if(!Tt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ll(e){Ul=e,Cn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ut(e){return Ch(Ul,e)}function fo(e,t){return Ul===null&&Ll(e),Ch(e,t)}function Ch(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},Cn===null){if(e===null)throw Error(o(308));Cn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Cn=Cn.next=t;return l}var gb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},yb=n.unstable_scheduleCallback,vb=n.unstable_NormalPriority,tt={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ur(){return{controller:new gb,data:new Map,refCount:0}}function zi(e){e.refCount--,e.refCount===0&&yb(vb,function(){e.controller.abort()})}var Di=null,Lr=0,Ca=0,Ma=null;function xb(e,t){if(Di===null){var l=Di=[];Lr=0,Ca=Yu(),Ma={status:"pending",value:void 0,then:function(i){l.push(i)}}}return Lr++,t.then(Mh,Mh),t}function Mh(){if(--Lr===0&&Di!==null){Ma!==null&&(Ma.status="fulfilled");var e=Di;Di=null,Ca=0,Ma=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function bb(e,t){var l=[],i={status:"pending",value:null,reason:null,then:function(r){l.push(r)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var r=0;r<l.length;r++)(0,l[r])(t)},function(r){for(i.status="rejected",i.reason=r,r=0;r<l.length;r++)(0,l[r])(void 0)}),i}var Th=E.S;E.S=function(e,t){hp=Fe(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&xb(e,t),Th!==null&&Th(e,t)};var $l=ee(null);function $r(){var e=$l.current;return e!==null?e:Ve.pooledCache}function ho(e,t){t===null?oe($l,$l.current):oe($l,t.pool)}function Ah(){var e=$r();return e===null?null:{parent:tt._currentValue,pool:e}}var Ta=Error(o(460)),Vr=Error(o(474)),mo=Error(o(542)),po={then:function(){}};function zh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Dh(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(jn,jn),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Hh(e),e;default:if(typeof t.status=="string")t.then(jn,jn);else{if(e=Ve,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=i}},function(i){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Hh(e),e}throw Yl=t,Ta}}function Vl(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Yl=l,Ta):l}}var Yl=null;function Oh(){if(Yl===null)throw Error(o(459));var e=Yl;return Yl=null,e}function Hh(e){if(e===Ta||e===mo)throw Error(o(483))}var Aa=null,Oi=0;function go(e){var t=Oi;return Oi+=1,Aa===null&&(Aa=[]),Dh(Aa,e,t)}function Hi(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function yo(e,t){throw t.$$typeof===v?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function kh(e){function t(X,U){if(e){var Q=X.deletions;Q===null?(X.deletions=[U],X.flags|=16):Q.push(U)}}function l(X,U){if(!e)return null;for(;U!==null;)t(X,U),U=U.sibling;return null}function i(X){for(var U=new Map;X!==null;)X.key!==null?U.set(X.key,X):U.set(X.index,X),X=X.sibling;return U}function r(X,U){return X=_n(X,U),X.index=0,X.sibling=null,X}function h(X,U,Q){return X.index=Q,e?(Q=X.alternate,Q!==null?(Q=Q.index,Q<U?(X.flags|=67108866,U):Q):(X.flags|=67108866,U)):(X.flags|=1048576,U)}function b(X){return e&&X.alternate===null&&(X.flags|=67108866),X}function N(X,U,Q,ae){return U===null||U.tag!==6?(U=Tr(Q,X.mode,ae),U.return=X,U):(U=r(U,Q),U.return=X,U)}function H(X,U,Q,ae){var ve=Q.type;return ve===q?ne(X,U,Q.props.children,ae,Q.key):U!==null&&(U.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===Y&&Vl(ve)===U.type)?(U=r(U,Q.props),Hi(U,Q),U.return=X,U):(U=co(Q.type,Q.key,Q.props,null,X.mode,ae),Hi(U,Q),U.return=X,U)}function K(X,U,Q,ae){return U===null||U.tag!==4||U.stateNode.containerInfo!==Q.containerInfo||U.stateNode.implementation!==Q.implementation?(U=Ar(Q,X.mode,ae),U.return=X,U):(U=r(U,Q.children||[]),U.return=X,U)}function ne(X,U,Q,ae,ve){return U===null||U.tag!==7?(U=Rl(Q,X.mode,ae,ve),U.return=X,U):(U=r(U,Q),U.return=X,U)}function ie(X,U,Q){if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return U=Tr(""+U,X.mode,Q),U.return=X,U;if(typeof U=="object"&&U!==null){switch(U.$$typeof){case S:return Q=co(U.type,U.key,U.props,null,X.mode,Q),Hi(Q,U),Q.return=X,Q;case w:return U=Ar(U,X.mode,Q),U.return=X,U;case Y:return U=Vl(U),ie(X,U,Q)}if(B(U)||F(U))return U=Rl(U,X.mode,Q,null),U.return=X,U;if(typeof U.then=="function")return ie(X,go(U),Q);if(U.$$typeof===j)return ie(X,fo(X,U),Q);yo(X,U)}return null}function J(X,U,Q,ae){var ve=U!==null?U.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return ve!==null?null:N(X,U,""+Q,ae);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case S:return Q.key===ve?H(X,U,Q,ae):null;case w:return Q.key===ve?K(X,U,Q,ae):null;case Y:return Q=Vl(Q),J(X,U,Q,ae)}if(B(Q)||F(Q))return ve!==null?null:ne(X,U,Q,ae,null);if(typeof Q.then=="function")return J(X,U,go(Q),ae);if(Q.$$typeof===j)return J(X,U,fo(X,Q),ae);yo(X,Q)}return null}function W(X,U,Q,ae,ve){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return X=X.get(Q)||null,N(U,X,""+ae,ve);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case S:return X=X.get(ae.key===null?Q:ae.key)||null,H(U,X,ae,ve);case w:return X=X.get(ae.key===null?Q:ae.key)||null,K(U,X,ae,ve);case Y:return ae=Vl(ae),W(X,U,Q,ae,ve)}if(B(ae)||F(ae))return X=X.get(Q)||null,ne(U,X,ae,ve,null);if(typeof ae.then=="function")return W(X,U,Q,go(ae),ve);if(ae.$$typeof===j)return W(X,U,Q,fo(U,ae),ve);yo(U,ae)}return null}function fe(X,U,Q,ae){for(var ve=null,ze=null,me=U,je=U=0,Me=null;me!==null&&je<Q.length;je++){me.index>je?(Me=me,me=null):Me=me.sibling;var De=J(X,me,Q[je],ae);if(De===null){me===null&&(me=Me);break}e&&me&&De.alternate===null&&t(X,me),U=h(De,U,je),ze===null?ve=De:ze.sibling=De,ze=De,me=Me}if(je===Q.length)return l(X,me),Te&&qn(X,je),ve;if(me===null){for(;je<Q.length;je++)me=ie(X,Q[je],ae),me!==null&&(U=h(me,U,je),ze===null?ve=me:ze.sibling=me,ze=me);return Te&&qn(X,je),ve}for(me=i(me);je<Q.length;je++)Me=W(me,X,je,Q[je],ae),Me!==null&&(e&&Me.alternate!==null&&me.delete(Me.key===null?je:Me.key),U=h(Me,U,je),ze===null?ve=Me:ze.sibling=Me,ze=Me);return e&&me.forEach(function(bl){return t(X,bl)}),Te&&qn(X,je),ve}function be(X,U,Q,ae){if(Q==null)throw Error(o(151));for(var ve=null,ze=null,me=U,je=U=0,Me=null,De=Q.next();me!==null&&!De.done;je++,De=Q.next()){me.index>je?(Me=me,me=null):Me=me.sibling;var bl=J(X,me,De.value,ae);if(bl===null){me===null&&(me=Me);break}e&&me&&bl.alternate===null&&t(X,me),U=h(bl,U,je),ze===null?ve=bl:ze.sibling=bl,ze=bl,me=Me}if(De.done)return l(X,me),Te&&qn(X,je),ve;if(me===null){for(;!De.done;je++,De=Q.next())De=ie(X,De.value,ae),De!==null&&(U=h(De,U,je),ze===null?ve=De:ze.sibling=De,ze=De);return Te&&qn(X,je),ve}for(me=i(me);!De.done;je++,De=Q.next())De=W(me,X,je,De.value,ae),De!==null&&(e&&De.alternate!==null&&me.delete(De.key===null?je:De.key),U=h(De,U,je),ze===null?ve=De:ze.sibling=De,ze=De);return e&&me.forEach(function(A1){return t(X,A1)}),Te&&qn(X,je),ve}function $e(X,U,Q,ae){if(typeof Q=="object"&&Q!==null&&Q.type===q&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case S:e:{for(var ve=Q.key;U!==null;){if(U.key===ve){if(ve=Q.type,ve===q){if(U.tag===7){l(X,U.sibling),ae=r(U,Q.props.children),ae.return=X,X=ae;break e}}else if(U.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===Y&&Vl(ve)===U.type){l(X,U.sibling),ae=r(U,Q.props),Hi(ae,Q),ae.return=X,X=ae;break e}l(X,U);break}else t(X,U);U=U.sibling}Q.type===q?(ae=Rl(Q.props.children,X.mode,ae,Q.key),ae.return=X,X=ae):(ae=co(Q.type,Q.key,Q.props,null,X.mode,ae),Hi(ae,Q),ae.return=X,X=ae)}return b(X);case w:e:{for(ve=Q.key;U!==null;){if(U.key===ve)if(U.tag===4&&U.stateNode.containerInfo===Q.containerInfo&&U.stateNode.implementation===Q.implementation){l(X,U.sibling),ae=r(U,Q.children||[]),ae.return=X,X=ae;break e}else{l(X,U);break}else t(X,U);U=U.sibling}ae=Ar(Q,X.mode,ae),ae.return=X,X=ae}return b(X);case Y:return Q=Vl(Q),$e(X,U,Q,ae)}if(B(Q))return fe(X,U,Q,ae);if(F(Q)){if(ve=F(Q),typeof ve!="function")throw Error(o(150));return Q=ve.call(Q),be(X,U,Q,ae)}if(typeof Q.then=="function")return $e(X,U,go(Q),ae);if(Q.$$typeof===j)return $e(X,U,fo(X,Q),ae);yo(X,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,U!==null&&U.tag===6?(l(X,U.sibling),ae=r(U,Q),ae.return=X,X=ae):(l(X,U),ae=Tr(Q,X.mode,ae),ae.return=X,X=ae),b(X)):l(X,U)}return function(X,U,Q,ae){try{Oi=0;var ve=$e(X,U,Q,ae);return Aa=null,ve}catch(me){if(me===Ta||me===mo)throw me;var ze=At(29,me,null,X.mode);return ze.lanes=ae,ze.return=X,ze}}}var Xl=kh(!0),Rh=kh(!1),ll=!1;function Yr(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xr(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function al(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function il(e,t,l){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(He&2)!==0){var r=i.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),i.pending=t,t=oo(e),bh(e,null,l),t}return so(e,i,t,l),oo(e)}function ki(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,Ls(e,l)}}function Ir(e,t){var l=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,l===i)){var r=null,h=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};h===null?r=h=b:h=h.next=b,l=l.next}while(l!==null);h===null?r=h=t:h=h.next=t}else r=h=t;l={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:h,shared:i.shared,callbacks:i.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var Gr=!1;function Ri(){if(Gr){var e=Ma;if(e!==null)throw e}}function Bi(e,t,l,i){Gr=!1;var r=e.updateQueue;ll=!1;var h=r.firstBaseUpdate,b=r.lastBaseUpdate,N=r.shared.pending;if(N!==null){r.shared.pending=null;var H=N,K=H.next;H.next=null,b===null?h=K:b.next=K,b=H;var ne=e.alternate;ne!==null&&(ne=ne.updateQueue,N=ne.lastBaseUpdate,N!==b&&(N===null?ne.firstBaseUpdate=K:N.next=K,ne.lastBaseUpdate=H))}if(h!==null){var ie=r.baseState;b=0,ne=K=H=null,N=h;do{var J=N.lane&-536870913,W=J!==N.lane;if(W?(Ce&J)===J:(i&J)===J){J!==0&&J===Ca&&(Gr=!0),ne!==null&&(ne=ne.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var fe=e,be=N;J=t;var $e=l;switch(be.tag){case 1:if(fe=be.payload,typeof fe=="function"){ie=fe.call($e,ie,J);break e}ie=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=be.payload,J=typeof fe=="function"?fe.call($e,ie,J):fe,J==null)break e;ie=g({},ie,J);break e;case 2:ll=!0}}J=N.callback,J!==null&&(e.flags|=64,W&&(e.flags|=8192),W=r.callbacks,W===null?r.callbacks=[J]:W.push(J))}else W={lane:J,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ne===null?(K=ne=W,H=ie):ne=ne.next=W,b|=J;if(N=N.next,N===null){if(N=r.shared.pending,N===null)break;W=N,N=W.next,W.next=null,r.lastBaseUpdate=W,r.shared.pending=null}}while(!0);ne===null&&(H=ie),r.baseState=H,r.firstBaseUpdate=K,r.lastBaseUpdate=ne,h===null&&(r.shared.lanes=0),ul|=b,e.lanes=b,e.memoizedState=ie}}function Bh(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Uh(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Bh(l[e],t)}var za=ee(null),vo=ee(0);function Lh(e,t){e=Bn,oe(vo,e),oe(za,t),Bn=e|t.baseLanes}function Zr(){oe(vo,Bn),oe(za,za.current)}function Qr(){Bn=vo.current,P(za),P(vo)}var zt=ee(null),Qt=null;function sl(e){var t=e.alternate;oe(We,We.current&1),oe(zt,e),Qt===null&&(t===null||za.current!==null||t.memoizedState!==null)&&(Qt=e)}function Kr(e){oe(We,We.current),oe(zt,e),Qt===null&&(Qt=e)}function $h(e){e.tag===22?(oe(We,We.current),oe(zt,e),Qt===null&&(Qt=e)):ol()}function ol(){oe(We,We.current),oe(zt,zt.current)}function Dt(e){P(zt),Qt===e&&(Qt=null),P(We)}var We=ee(0);function xo(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||tf(l)||nf(l)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Tn=0,Ne=null,Ue=null,nt=null,bo=!1,Da=!1,Il=!1,So=0,Ui=0,Oa=null,Sb=0;function Qe(){throw Error(o(321))}function Jr(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!Tt(e[l],t[l]))return!1;return!0}function Fr(e,t,l,i,r,h){return Tn=h,Ne=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?jm:du,Il=!1,h=l(i,r),Il=!1,Da&&(h=Yh(t,l,i,r)),Vh(e),h}function Vh(e){E.H=Vi;var t=Ue!==null&&Ue.next!==null;if(Tn=0,nt=Ue=Ne=null,bo=!1,Ui=0,Oa=null,t)throw Error(o(300));e===null||lt||(e=e.dependencies,e!==null&&uo(e)&&(lt=!0))}function Yh(e,t,l,i){Ne=e;var r=0;do{if(Da&&(Oa=null),Ui=0,Da=!1,25<=r)throw Error(o(301));if(r+=1,nt=Ue=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}E.H=Em,h=t(l,i)}while(Da);return h}function wb(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?Li(t):t,e=e.useState()[0],(Ue!==null?Ue.memoizedState:null)!==e&&(Ne.flags|=1024),t}function Wr(){var e=So!==0;return So=0,e}function Pr(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function eu(e){if(bo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}bo=!1}Tn=0,nt=Ue=Ne=null,Da=!1,Ui=So=0,Oa=null}function vt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nt===null?Ne.memoizedState=nt=e:nt=nt.next=e,nt}function Pe(){if(Ue===null){var e=Ne.alternate;e=e!==null?e.memoizedState:null}else e=Ue.next;var t=nt===null?Ne.memoizedState:nt.next;if(t!==null)nt=t,Ue=e;else{if(e===null)throw Ne.alternate===null?Error(o(467)):Error(o(310));Ue=e,e={memoizedState:Ue.memoizedState,baseState:Ue.baseState,baseQueue:Ue.baseQueue,queue:Ue.queue,next:null},nt===null?Ne.memoizedState=nt=e:nt=nt.next=e}return nt}function wo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Li(e){var t=Ui;return Ui+=1,Oa===null&&(Oa=[]),e=Dh(Oa,e,t),t=Ne,(nt===null?t.memoizedState:nt.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?jm:du),e}function No(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Li(e);if(e.$$typeof===j)return ut(e)}throw Error(o(438,String(e)))}function tu(e){var t=null,l=Ne.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var i=Ne.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=wo(),Ne.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),i=0;i<e;i++)l[i]=te;return t.index++,l}function An(e,t){return typeof t=="function"?t(e):t}function jo(e){var t=Pe();return nu(t,Ue,e)}function nu(e,t,l){var i=e.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=l;var r=e.baseQueue,h=i.pending;if(h!==null){if(r!==null){var b=r.next;r.next=h.next,h.next=b}t.baseQueue=r=h,i.pending=null}if(h=e.baseState,r===null)e.memoizedState=h;else{t=r.next;var N=b=null,H=null,K=t,ne=!1;do{var ie=K.lane&-536870913;if(ie!==K.lane?(Ce&ie)===ie:(Tn&ie)===ie){var J=K.revertLane;if(J===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),ie===Ca&&(ne=!0);else if((Tn&J)===J){K=K.next,J===Ca&&(ne=!0);continue}else ie={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(N=H=ie,b=h):H=H.next=ie,Ne.lanes|=J,ul|=J;ie=K.action,Il&&l(h,ie),h=K.hasEagerState?K.eagerState:l(h,ie)}else J={lane:ie,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(N=H=J,b=h):H=H.next=J,Ne.lanes|=ie,ul|=ie;K=K.next}while(K!==null&&K!==t);if(H===null?b=h:H.next=N,!Tt(h,e.memoizedState)&&(lt=!0,ne&&(l=Ma,l!==null)))throw l;e.memoizedState=h,e.baseState=b,e.baseQueue=H,i.lastRenderedState=h}return r===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function lu(e){var t=Pe(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var i=l.dispatch,r=l.pending,h=t.memoizedState;if(r!==null){l.pending=null;var b=r=r.next;do h=e(h,b.action),b=b.next;while(b!==r);Tt(h,t.memoizedState)||(lt=!0),t.memoizedState=h,t.baseQueue===null&&(t.baseState=h),l.lastRenderedState=h}return[h,i]}function Xh(e,t,l){var i=Ne,r=Pe(),h=Te;if(h){if(l===void 0)throw Error(o(407));l=l()}else l=t();var b=!Tt((Ue||r).memoizedState,l);if(b&&(r.memoizedState=l,lt=!0),r=r.queue,su(Zh.bind(null,i,r,e),[e]),r.getSnapshot!==t||b||nt!==null&&nt.memoizedState.tag&1){if(i.flags|=2048,Ha(9,{destroy:void 0},Gh.bind(null,i,r,l,t),null),Ve===null)throw Error(o(349));h||(Tn&127)!==0||Ih(i,t,l)}return l}function Ih(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Ne.updateQueue,t===null?(t=wo(),Ne.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function Gh(e,t,l,i){t.value=l,t.getSnapshot=i,Qh(t)&&Kh(e)}function Zh(e,t,l){return l(function(){Qh(t)&&Kh(e)})}function Qh(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!Tt(e,l)}catch{return!0}}function Kh(e){var t=kl(e,2);t!==null&&_t(t,e,2)}function au(e){var t=vt();if(typeof e=="function"){var l=e;if(e=l(),Il){un(!0);try{l()}finally{un(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:An,lastRenderedState:e},t}function Jh(e,t,l,i){return e.baseState=l,nu(e,Ue,typeof i=="function"?i:An)}function Nb(e,t,l,i,r){if(qo(e))throw Error(o(485));if(e=t.action,e!==null){var h={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){h.listeners.push(b)}};E.T!==null?l(!0):h.isTransition=!1,i(h),l=t.pending,l===null?(h.next=t.pending=h,Fh(t,h)):(h.next=l.next,t.pending=l.next=h)}}function Fh(e,t){var l=t.action,i=t.payload,r=e.state;if(t.isTransition){var h=E.T,b={};E.T=b;try{var N=l(r,i),H=E.S;H!==null&&H(b,N),Wh(e,t,N)}catch(K){iu(e,t,K)}finally{h!==null&&b.types!==null&&(h.types=b.types),E.T=h}}else try{h=l(r,i),Wh(e,t,h)}catch(K){iu(e,t,K)}}function Wh(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(i){Ph(e,t,i)},function(i){return iu(e,t,i)}):Ph(e,t,l)}function Ph(e,t,l){t.status="fulfilled",t.value=l,em(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,Fh(e,l)))}function iu(e,t,l){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=l,em(t),t=t.next;while(t!==i)}e.action=null}function em(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function tm(e,t){return t}function nm(e,t){if(Te){var l=Ve.formState;if(l!==null){e:{var i=Ne;if(Te){if(Ye){t:{for(var r=Ye,h=Zt;r.nodeType!==8;){if(!h){r=null;break t}if(r=Kt(r.nextSibling),r===null){r=null;break t}}h=r.data,r=h==="F!"||h==="F"?r:null}if(r){Ye=Kt(r.nextSibling),i=r.data==="F!";break e}}tl(i)}i=!1}i&&(t=l[0])}}return l=vt(),l.memoizedState=l.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tm,lastRenderedState:t},l.queue=i,l=Sm.bind(null,Ne,i),i.dispatch=l,i=au(!1),h=fu.bind(null,Ne,!1,i.queue),i=vt(),r={state:t,dispatch:null,action:e,pending:null},i.queue=r,l=Nb.bind(null,Ne,r,h,l),r.dispatch=l,i.memoizedState=e,[t,l,!1]}function lm(e){var t=Pe();return am(t,Ue,e)}function am(e,t,l){if(t=nu(e,t,tm)[0],e=jo(An)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=Li(t)}catch(b){throw b===Ta?mo:b}else i=t;t=Pe();var r=t.queue,h=r.dispatch;return l!==t.memoizedState&&(Ne.flags|=2048,Ha(9,{destroy:void 0},jb.bind(null,r,l),null)),[i,h,e]}function jb(e,t){e.action=t}function im(e){var t=Pe(),l=Ue;if(l!==null)return am(t,l,e);Pe(),t=t.memoizedState,l=Pe();var i=l.queue.dispatch;return l.memoizedState=e,[t,i,!1]}function Ha(e,t,l,i){return e={tag:e,create:l,deps:i,inst:t,next:null},t=Ne.updateQueue,t===null&&(t=wo(),Ne.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(i=l.next,l.next=e,e.next=i,t.lastEffect=e),e}function sm(){return Pe().memoizedState}function Eo(e,t,l,i){var r=vt();Ne.flags|=e,r.memoizedState=Ha(1|t,{destroy:void 0},l,i===void 0?null:i)}function _o(e,t,l,i){var r=Pe();i=i===void 0?null:i;var h=r.memoizedState.inst;Ue!==null&&i!==null&&Jr(i,Ue.memoizedState.deps)?r.memoizedState=Ha(t,h,l,i):(Ne.flags|=e,r.memoizedState=Ha(1|t,h,l,i))}function om(e,t){Eo(8390656,8,e,t)}function su(e,t){_o(2048,8,e,t)}function Eb(e){Ne.flags|=4;var t=Ne.updateQueue;if(t===null)t=wo(),Ne.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function cm(e){var t=Pe().memoizedState;return Eb({ref:t,nextImpl:e}),function(){if((He&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function rm(e,t){return _o(4,2,e,t)}function um(e,t){return _o(4,4,e,t)}function fm(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function dm(e,t,l){l=l!=null?l.concat([e]):null,_o(4,4,fm.bind(null,t,e),l)}function ou(){}function hm(e,t){var l=Pe();t=t===void 0?null:t;var i=l.memoizedState;return t!==null&&Jr(t,i[1])?i[0]:(l.memoizedState=[e,t],e)}function mm(e,t){var l=Pe();t=t===void 0?null:t;var i=l.memoizedState;if(t!==null&&Jr(t,i[1]))return i[0];if(i=e(),Il){un(!0);try{e()}finally{un(!1)}}return l.memoizedState=[i,t],i}function cu(e,t,l){return l===void 0||(Tn&1073741824)!==0&&(Ce&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=pp(),Ne.lanes|=e,ul|=e,l)}function pm(e,t,l,i){return Tt(l,t)?l:za.current!==null?(e=cu(e,l,i),Tt(e,t)||(lt=!0),e):(Tn&42)===0||(Tn&1073741824)!==0&&(Ce&261930)===0?(lt=!0,e.memoizedState=l):(e=pp(),Ne.lanes|=e,ul|=e,t)}function gm(e,t,l,i,r){var h=M.p;M.p=h!==0&&8>h?h:8;var b=E.T,N={};E.T=N,fu(e,!1,t,l);try{var H=r(),K=E.S;if(K!==null&&K(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ne=bb(H,i);$i(e,t,ne,kt(e))}else $i(e,t,i,kt(e))}catch(ie){$i(e,t,{then:function(){},status:"rejected",reason:ie},kt())}finally{M.p=h,b!==null&&N.types!==null&&(b.types=N.types),E.T=b}}function _b(){}function ru(e,t,l,i){if(e.tag!==5)throw Error(o(476));var r=ym(e).queue;gm(e,r,t,O,l===null?_b:function(){return vm(e),l(i)})}function ym(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:O,baseState:O,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:An,lastRenderedState:O},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:An,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function vm(e){var t=ym(e);t.next===null&&(t=e.alternate.memoizedState),$i(e,t.next.queue,{},kt())}function uu(){return ut(as)}function xm(){return Pe().memoizedState}function bm(){return Pe().memoizedState}function qb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=kt();e=al(l);var i=il(t,e,l);i!==null&&(_t(i,t,l),ki(i,t,l)),t={cache:Ur()},e.payload=t;return}t=t.return}}function Cb(e,t,l){var i=kt();l={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},qo(e)?wm(t,l):(l=Cr(e,t,l,i),l!==null&&(_t(l,e,i),Nm(l,t,i)))}function Sm(e,t,l){var i=kt();$i(e,t,l,i)}function $i(e,t,l,i){var r={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(qo(e))wm(t,r);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=t.lastRenderedReducer,h!==null))try{var b=t.lastRenderedState,N=h(b,l);if(r.hasEagerState=!0,r.eagerState=N,Tt(N,b))return so(e,t,r,0),Ve===null&&io(),!1}catch{}if(l=Cr(e,t,r,i),l!==null)return _t(l,e,i),Nm(l,t,i),!0}return!1}function fu(e,t,l,i){if(i={lane:2,revertLane:Yu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},qo(e)){if(t)throw Error(o(479))}else t=Cr(e,l,i,2),t!==null&&_t(t,e,2)}function qo(e){var t=e.alternate;return e===Ne||t!==null&&t===Ne}function wm(e,t){Da=bo=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Nm(e,t,l){if((l&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,Ls(e,l)}}var Vi={readContext:ut,use:No,useCallback:Qe,useContext:Qe,useEffect:Qe,useImperativeHandle:Qe,useLayoutEffect:Qe,useInsertionEffect:Qe,useMemo:Qe,useReducer:Qe,useRef:Qe,useState:Qe,useDebugValue:Qe,useDeferredValue:Qe,useTransition:Qe,useSyncExternalStore:Qe,useId:Qe,useHostTransitionStatus:Qe,useFormState:Qe,useActionState:Qe,useOptimistic:Qe,useMemoCache:Qe,useCacheRefresh:Qe};Vi.useEffectEvent=Qe;var jm={readContext:ut,use:No,useCallback:function(e,t){return vt().memoizedState=[e,t===void 0?null:t],e},useContext:ut,useEffect:om,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,Eo(4194308,4,fm.bind(null,t,e),l)},useLayoutEffect:function(e,t){return Eo(4194308,4,e,t)},useInsertionEffect:function(e,t){Eo(4,2,e,t)},useMemo:function(e,t){var l=vt();t=t===void 0?null:t;var i=e();if(Il){un(!0);try{e()}finally{un(!1)}}return l.memoizedState=[i,t],i},useReducer:function(e,t,l){var i=vt();if(l!==void 0){var r=l(t);if(Il){un(!0);try{l(t)}finally{un(!1)}}}else r=t;return i.memoizedState=i.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},i.queue=e,e=e.dispatch=Cb.bind(null,Ne,e),[i.memoizedState,e]},useRef:function(e){var t=vt();return e={current:e},t.memoizedState=e},useState:function(e){e=au(e);var t=e.queue,l=Sm.bind(null,Ne,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:ou,useDeferredValue:function(e,t){var l=vt();return cu(l,e,t)},useTransition:function(){var e=au(!1);return e=gm.bind(null,Ne,e.queue,!0,!1),vt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var i=Ne,r=vt();if(Te){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),Ve===null)throw Error(o(349));(Ce&127)!==0||Ih(i,t,l)}r.memoizedState=l;var h={value:l,getSnapshot:t};return r.queue=h,om(Zh.bind(null,i,h,e),[e]),i.flags|=2048,Ha(9,{destroy:void 0},Gh.bind(null,i,h,l,t),null),l},useId:function(){var e=vt(),t=Ve.identifierPrefix;if(Te){var l=hn,i=dn;l=(i&~(1<<32-yt(i)-1)).toString(32)+l,t="_"+t+"R_"+l,l=So++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=Sb++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:uu,useFormState:nm,useActionState:nm,useOptimistic:function(e){var t=vt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=fu.bind(null,Ne,!0,l),l.dispatch=t,[e,t]},useMemoCache:tu,useCacheRefresh:function(){return vt().memoizedState=qb.bind(null,Ne)},useEffectEvent:function(e){var t=vt(),l={impl:e};return t.memoizedState=l,function(){if((He&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},du={readContext:ut,use:No,useCallback:hm,useContext:ut,useEffect:su,useImperativeHandle:dm,useInsertionEffect:rm,useLayoutEffect:um,useMemo:mm,useReducer:jo,useRef:sm,useState:function(){return jo(An)},useDebugValue:ou,useDeferredValue:function(e,t){var l=Pe();return pm(l,Ue.memoizedState,e,t)},useTransition:function(){var e=jo(An)[0],t=Pe().memoizedState;return[typeof e=="boolean"?e:Li(e),t]},useSyncExternalStore:Xh,useId:xm,useHostTransitionStatus:uu,useFormState:lm,useActionState:lm,useOptimistic:function(e,t){var l=Pe();return Jh(l,Ue,e,t)},useMemoCache:tu,useCacheRefresh:bm};du.useEffectEvent=cm;var Em={readContext:ut,use:No,useCallback:hm,useContext:ut,useEffect:su,useImperativeHandle:dm,useInsertionEffect:rm,useLayoutEffect:um,useMemo:mm,useReducer:lu,useRef:sm,useState:function(){return lu(An)},useDebugValue:ou,useDeferredValue:function(e,t){var l=Pe();return Ue===null?cu(l,e,t):pm(l,Ue.memoizedState,e,t)},useTransition:function(){var e=lu(An)[0],t=Pe().memoizedState;return[typeof e=="boolean"?e:Li(e),t]},useSyncExternalStore:Xh,useId:xm,useHostTransitionStatus:uu,useFormState:im,useActionState:im,useOptimistic:function(e,t){var l=Pe();return Ue!==null?Jh(l,Ue,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:tu,useCacheRefresh:bm};Em.useEffectEvent=cm;function hu(e,t,l,i){t=e.memoizedState,l=l(i,t),l=l==null?t:g({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var mu={enqueueSetState:function(e,t,l){e=e._reactInternals;var i=kt(),r=al(i);r.payload=t,l!=null&&(r.callback=l),t=il(e,r,i),t!==null&&(_t(t,e,i),ki(t,e,i))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var i=kt(),r=al(i);r.tag=1,r.payload=t,l!=null&&(r.callback=l),t=il(e,r,i),t!==null&&(_t(t,e,i),ki(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=kt(),i=al(l);i.tag=2,t!=null&&(i.callback=t),t=il(e,i,l),t!==null&&(_t(t,e,l),ki(t,e,l))}};function _m(e,t,l,i,r,h,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,h,b):t.prototype&&t.prototype.isPureReactComponent?!Ci(l,i)||!Ci(r,h):!0}function qm(e,t,l,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,i),t.state!==e&&mu.enqueueReplaceState(t,t.state,null)}function Gl(e,t){var l=t;if("ref"in t){l={};for(var i in t)i!=="ref"&&(l[i]=t[i])}if(e=e.defaultProps){l===t&&(l=g({},l));for(var r in e)l[r]===void 0&&(l[r]=e[r])}return l}function Cm(e){ao(e)}function Mm(e){console.error(e)}function Tm(e){ao(e)}function Co(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function Am(e,t,l){try{var i=e.onCaughtError;i(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function pu(e,t,l){return l=al(l),l.tag=3,l.payload={element:null},l.callback=function(){Co(e,t)},l}function zm(e){return e=al(e),e.tag=3,e}function Dm(e,t,l,i){var r=l.type.getDerivedStateFromError;if(typeof r=="function"){var h=i.value;e.payload=function(){return r(h)},e.callback=function(){Am(t,l,i)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Am(t,l,i),typeof r!="function"&&(fl===null?fl=new Set([this]):fl.add(this));var N=i.stack;this.componentDidCatch(i.value,{componentStack:N!==null?N:""})})}function Mb(e,t,l,i,r){if(l.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=l.alternate,t!==null&&qa(t,l,r,!0),l=zt.current,l!==null){switch(l.tag){case 31:case 13:return Qt===null?Lo():l.alternate===null&&Ke===0&&(Ke=3),l.flags&=-257,l.flags|=65536,l.lanes=r,i===po?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([i]):t.add(i),Lu(e,i,r)),!1;case 22:return l.flags|=65536,i===po?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([i]):l.add(i)),Lu(e,i,r)),!1}throw Error(o(435,l.tag))}return Lu(e,i,r),Lo(),!1}if(Te)return t=zt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,i!==Or&&(e=Error(o(422),{cause:i}),Ai(Xt(e,l)))):(i!==Or&&(t=Error(o(423),{cause:i}),Ai(Xt(t,l))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,i=Xt(i,l),r=pu(e.stateNode,i,r),Ir(e,r),Ke!==4&&(Ke=2)),!1;var h=Error(o(520),{cause:i});if(h=Xt(h,l),Ji===null?Ji=[h]:Ji.push(h),Ke!==4&&(Ke=2),t===null)return!0;i=Xt(i,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=r&-r,l.lanes|=e,e=pu(l.stateNode,i,e),Ir(l,e),!1;case 1:if(t=l.type,h=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(fl===null||!fl.has(h))))return l.flags|=65536,r&=-r,l.lanes|=r,r=zm(r),Dm(r,e,l,i),Ir(l,r),!1}l=l.return}while(l!==null);return!1}var gu=Error(o(461)),lt=!1;function ft(e,t,l,i){t.child=e===null?Rh(t,null,l,i):Xl(t,e.child,l,i)}function Om(e,t,l,i,r){l=l.render;var h=t.ref;if("ref"in i){var b={};for(var N in i)N!=="ref"&&(b[N]=i[N])}else b=i;return Ll(t),i=Fr(e,t,l,b,h,r),N=Wr(),e!==null&&!lt?(Pr(e,t,r),zn(e,t,r)):(Te&&N&&zr(t),t.flags|=1,ft(e,t,i,r),t.child)}function Hm(e,t,l,i,r){if(e===null){var h=l.type;return typeof h=="function"&&!Mr(h)&&h.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=h,km(e,t,h,i,r)):(e=co(l.type,null,i,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(h=e.child,!ju(e,r)){var b=h.memoizedProps;if(l=l.compare,l=l!==null?l:Ci,l(b,i)&&e.ref===t.ref)return zn(e,t,r)}return t.flags|=1,e=_n(h,i),e.ref=t.ref,e.return=t,t.child=e}function km(e,t,l,i,r){if(e!==null){var h=e.memoizedProps;if(Ci(h,i)&&e.ref===t.ref)if(lt=!1,t.pendingProps=i=h,ju(e,r))(e.flags&131072)!==0&&(lt=!0);else return t.lanes=e.lanes,zn(e,t,r)}return yu(e,t,l,i,r)}function Rm(e,t,l,i){var r=i.children,h=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(h=h!==null?h.baseLanes|l:l,e!==null){for(i=t.child=e.child,r=0;i!==null;)r=r|i.lanes|i.childLanes,i=i.sibling;i=r&~h}else i=0,t.child=null;return Bm(e,t,h,l,i)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ho(t,h!==null?h.cachePool:null),h!==null?Lh(t,h):Zr(),$h(t);else return i=t.lanes=536870912,Bm(e,t,h!==null?h.baseLanes|l:l,l,i)}else h!==null?(ho(t,h.cachePool),Lh(t,h),ol(),t.memoizedState=null):(e!==null&&ho(t,null),Zr(),ol());return ft(e,t,r,l),t.child}function Yi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Bm(e,t,l,i,r){var h=$r();return h=h===null?null:{parent:tt._currentValue,pool:h},t.memoizedState={baseLanes:l,cachePool:h},e!==null&&ho(t,null),Zr(),$h(t),e!==null&&qa(e,t,i,!0),t.childLanes=r,null}function Mo(e,t){return t=Ao({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Um(e,t,l){return Xl(t,e.child,null,l),e=Mo(t,t.pendingProps),e.flags|=2,Dt(t),t.memoizedState=null,e}function Tb(e,t,l){var i=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Te){if(i.mode==="hidden")return e=Mo(t,i),t.lanes=536870912,Yi(null,e);if(Kr(t),(e=Ye)?(e=Fp(e,Zt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Pn!==null?{id:dn,overflow:hn}:null,retryLane:536870912,hydrationErrors:null},l=wh(e),l.return=t,t.child=l,rt=t,Ye=null)):e=null,e===null)throw tl(t);return t.lanes=536870912,null}return Mo(t,i)}var h=e.memoizedState;if(h!==null){var b=h.dehydrated;if(Kr(t),r)if(t.flags&256)t.flags&=-257,t=Um(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(lt||qa(e,t,l,!1),r=(l&e.childLanes)!==0,lt||r){if(i=Ve,i!==null&&(b=$s(i,l),b!==0&&b!==h.retryLane))throw h.retryLane=b,kl(e,b),_t(i,e,b),gu;Lo(),t=Um(e,t,l)}else e=h.treeContext,Ye=Kt(b.nextSibling),rt=t,Te=!0,el=null,Zt=!1,e!==null&&Eh(t,e),t=Mo(t,i),t.flags|=4096;return t}return e=_n(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function To(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function yu(e,t,l,i,r){return Ll(t),l=Fr(e,t,l,i,void 0,r),i=Wr(),e!==null&&!lt?(Pr(e,t,r),zn(e,t,r)):(Te&&i&&zr(t),t.flags|=1,ft(e,t,l,r),t.child)}function Lm(e,t,l,i,r,h){return Ll(t),t.updateQueue=null,l=Yh(t,i,l,r),Vh(e),i=Wr(),e!==null&&!lt?(Pr(e,t,h),zn(e,t,h)):(Te&&i&&zr(t),t.flags|=1,ft(e,t,l,h),t.child)}function $m(e,t,l,i,r){if(Ll(t),t.stateNode===null){var h=Na,b=l.contextType;typeof b=="object"&&b!==null&&(h=ut(b)),h=new l(i,h),t.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=mu,t.stateNode=h,h._reactInternals=t,h=t.stateNode,h.props=i,h.state=t.memoizedState,h.refs={},Yr(t),b=l.contextType,h.context=typeof b=="object"&&b!==null?ut(b):Na,h.state=t.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(hu(t,l,b,i),h.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(b=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),b!==h.state&&mu.enqueueReplaceState(h,h.state,null),Bi(t,i,h,r),Ri(),h.state=t.memoizedState),typeof h.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){h=t.stateNode;var N=t.memoizedProps,H=Gl(l,N);h.props=H;var K=h.context,ne=l.contextType;b=Na,typeof ne=="object"&&ne!==null&&(b=ut(ne));var ie=l.getDerivedStateFromProps;ne=typeof ie=="function"||typeof h.getSnapshotBeforeUpdate=="function",N=t.pendingProps!==N,ne||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(N||K!==b)&&qm(t,h,i,b),ll=!1;var J=t.memoizedState;h.state=J,Bi(t,i,h,r),Ri(),K=t.memoizedState,N||J!==K||ll?(typeof ie=="function"&&(hu(t,l,ie,i),K=t.memoizedState),(H=ll||_m(t,l,H,i,J,K,b))?(ne||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(t.flags|=4194308)):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=K),h.props=i,h.state=K,h.context=b,i=H):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{h=t.stateNode,Xr(e,t),b=t.memoizedProps,ne=Gl(l,b),h.props=ne,ie=t.pendingProps,J=h.context,K=l.contextType,H=Na,typeof K=="object"&&K!==null&&(H=ut(K)),N=l.getDerivedStateFromProps,(K=typeof N=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(b!==ie||J!==H)&&qm(t,h,i,H),ll=!1,J=t.memoizedState,h.state=J,Bi(t,i,h,r),Ri();var W=t.memoizedState;b!==ie||J!==W||ll||e!==null&&e.dependencies!==null&&uo(e.dependencies)?(typeof N=="function"&&(hu(t,l,N,i),W=t.memoizedState),(ne=ll||_m(t,l,ne,i,J,W,H)||e!==null&&e.dependencies!==null&&uo(e.dependencies))?(K||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(i,W,H),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(i,W,H)),typeof h.componentDidUpdate=="function"&&(t.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof h.componentDidUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=W),h.props=i,h.state=W,h.context=H,i=ne):(typeof h.componentDidUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(t.flags|=1024),i=!1)}return h=i,To(e,t),i=(t.flags&128)!==0,h||i?(h=t.stateNode,l=i&&typeof l.getDerivedStateFromError!="function"?null:h.render(),t.flags|=1,e!==null&&i?(t.child=Xl(t,e.child,null,r),t.child=Xl(t,null,l,r)):ft(e,t,l,r),t.memoizedState=h.state,e=t.child):e=zn(e,t,r),e}function Vm(e,t,l,i){return Bl(),t.flags|=256,ft(e,t,l,i),t.child}var vu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xu(e){return{baseLanes:e,cachePool:Ah()}}function bu(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=Ht),e}function Ym(e,t,l){var i=t.pendingProps,r=!1,h=(t.flags&128)!==0,b;if((b=h)||(b=e!==null&&e.memoizedState===null?!1:(We.current&2)!==0),b&&(r=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(Te){if(r?sl(t):ol(),(e=Ye)?(e=Fp(e,Zt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Pn!==null?{id:dn,overflow:hn}:null,retryLane:536870912,hydrationErrors:null},l=wh(e),l.return=t,t.child=l,rt=t,Ye=null)):e=null,e===null)throw tl(t);return nf(e)?t.lanes=32:t.lanes=536870912,null}var N=i.children;return i=i.fallback,r?(ol(),r=t.mode,N=Ao({mode:"hidden",children:N},r),i=Rl(i,r,l,null),N.return=t,i.return=t,N.sibling=i,t.child=N,i=t.child,i.memoizedState=xu(l),i.childLanes=bu(e,b,l),t.memoizedState=vu,Yi(null,i)):(sl(t),Su(t,N))}var H=e.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(h)t.flags&256?(sl(t),t.flags&=-257,t=wu(e,t,l)):t.memoizedState!==null?(ol(),t.child=e.child,t.flags|=128,t=null):(ol(),N=i.fallback,r=t.mode,i=Ao({mode:"visible",children:i.children},r),N=Rl(N,r,l,null),N.flags|=2,i.return=t,N.return=t,i.sibling=N,t.child=i,Xl(t,e.child,null,l),i=t.child,i.memoizedState=xu(l),i.childLanes=bu(e,b,l),t.memoizedState=vu,t=Yi(null,i));else if(sl(t),nf(N)){if(b=N.nextSibling&&N.nextSibling.dataset,b)var K=b.dgst;b=K,i=Error(o(419)),i.stack="",i.digest=b,Ai({value:i,source:null,stack:null}),t=wu(e,t,l)}else if(lt||qa(e,t,l,!1),b=(l&e.childLanes)!==0,lt||b){if(b=Ve,b!==null&&(i=$s(b,l),i!==0&&i!==H.retryLane))throw H.retryLane=i,kl(e,i),_t(b,e,i),gu;tf(N)||Lo(),t=wu(e,t,l)}else tf(N)?(t.flags|=192,t.child=e.child,t=null):(e=H.treeContext,Ye=Kt(N.nextSibling),rt=t,Te=!0,el=null,Zt=!1,e!==null&&Eh(t,e),t=Su(t,i.children),t.flags|=4096);return t}return r?(ol(),N=i.fallback,r=t.mode,H=e.child,K=H.sibling,i=_n(H,{mode:"hidden",children:i.children}),i.subtreeFlags=H.subtreeFlags&65011712,K!==null?N=_n(K,N):(N=Rl(N,r,l,null),N.flags|=2),N.return=t,i.return=t,i.sibling=N,t.child=i,Yi(null,i),i=t.child,N=e.child.memoizedState,N===null?N=xu(l):(r=N.cachePool,r!==null?(H=tt._currentValue,r=r.parent!==H?{parent:H,pool:H}:r):r=Ah(),N={baseLanes:N.baseLanes|l,cachePool:r}),i.memoizedState=N,i.childLanes=bu(e,b,l),t.memoizedState=vu,Yi(e.child,i)):(sl(t),l=e.child,e=l.sibling,l=_n(l,{mode:"visible",children:i.children}),l.return=t,l.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=l,t.memoizedState=null,l)}function Su(e,t){return t=Ao({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ao(e,t){return e=At(22,e,null,t),e.lanes=0,e}function wu(e,t,l){return Xl(t,e.child,null,l),e=Su(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Xm(e,t,l){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Rr(e.return,t,l)}function Nu(e,t,l,i,r,h){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:l,tailMode:r,treeForkCount:h}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=i,b.tail=l,b.tailMode=r,b.treeForkCount=h)}function Im(e,t,l){var i=t.pendingProps,r=i.revealOrder,h=i.tail;i=i.children;var b=We.current,N=(b&2)!==0;if(N?(b=b&1|2,t.flags|=128):b&=1,oe(We,b),ft(e,t,i,l),i=Te?Ti:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Xm(e,l,t);else if(e.tag===19)Xm(e,l,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(l=t.child,r=null;l!==null;)e=l.alternate,e!==null&&xo(e)===null&&(r=l),l=l.sibling;l=r,l===null?(r=t.child,t.child=null):(r=l.sibling,l.sibling=null),Nu(t,!1,r,l,h,i);break;case"backwards":case"unstable_legacy-backwards":for(l=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&xo(e)===null){t.child=r;break}e=r.sibling,r.sibling=l,l=r,r=e}Nu(t,!0,l,null,h,i);break;case"together":Nu(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function zn(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),ul|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(qa(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,l=_n(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=_n(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function ju(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&uo(e)))}function Ab(e,t,l){switch(t.tag){case 3:le(t,t.stateNode.containerInfo),nl(t,tt,e.memoizedState.cache),Bl();break;case 27:case 5:pe(t);break;case 4:le(t,t.stateNode.containerInfo);break;case 10:nl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Kr(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(sl(t),t.flags|=128,null):(l&t.child.childLanes)!==0?Ym(e,t,l):(sl(t),e=zn(e,t,l),e!==null?e.sibling:null);sl(t);break;case 19:var r=(e.flags&128)!==0;if(i=(l&t.childLanes)!==0,i||(qa(e,t,l,!1),i=(l&t.childLanes)!==0),r){if(i)return Im(e,t,l);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),oe(We,We.current),i)break;return null;case 22:return t.lanes=0,Rm(e,t,l,t.pendingProps);case 24:nl(t,tt,e.memoizedState.cache)}return zn(e,t,l)}function Gm(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)lt=!0;else{if(!ju(e,l)&&(t.flags&128)===0)return lt=!1,Ab(e,t,l);lt=(e.flags&131072)!==0}else lt=!1,Te&&(t.flags&1048576)!==0&&jh(t,Ti,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Vl(t.elementType),t.type=e,typeof e=="function")Mr(e)?(i=Gl(e,i),t.tag=1,t=$m(null,t,e,i,l)):(t.tag=0,t=yu(null,t,e,i,l));else{if(e!=null){var r=e.$$typeof;if(r===A){t.tag=11,t=Om(null,t,e,i,l);break e}else if(r===L){t.tag=14,t=Hm(null,t,e,i,l);break e}}throw t=T(e)||e,Error(o(306,t,""))}}return t;case 0:return yu(e,t,t.type,t.pendingProps,l);case 1:return i=t.type,r=Gl(i,t.pendingProps),$m(e,t,i,r,l);case 3:e:{if(le(t,t.stateNode.containerInfo),e===null)throw Error(o(387));i=t.pendingProps;var h=t.memoizedState;r=h.element,Xr(e,t),Bi(t,i,null,l);var b=t.memoizedState;if(i=b.cache,nl(t,tt,i),i!==h.cache&&Br(t,[tt],l,!0),Ri(),i=b.element,h.isDehydrated)if(h={element:i,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=h,t.memoizedState=h,t.flags&256){t=Vm(e,t,i,l);break e}else if(i!==r){r=Xt(Error(o(424)),t),Ai(r),t=Vm(e,t,i,l);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Ye=Kt(e.firstChild),rt=t,Te=!0,el=null,Zt=!0,l=Rh(t,null,i,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(Bl(),i===r){t=zn(e,t,l);break e}ft(e,t,i,l)}t=t.child}return t;case 26:return To(e,t),e===null?(l=lg(t.type,null,t.pendingProps,null))?t.memoizedState=l:Te||(l=t.type,e=t.pendingProps,i=Zo(xe.current).createElement(l),i[st]=t,i[mt]=e,dt(i,l,e),et(i),t.stateNode=i):t.memoizedState=lg(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pe(t),e===null&&Te&&(i=t.stateNode=eg(t.type,t.pendingProps,xe.current),rt=t,Zt=!0,r=Ye,pl(t.type)?(lf=r,Ye=Kt(i.firstChild)):Ye=r),ft(e,t,t.pendingProps.children,l),To(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Te&&((r=i=Ye)&&(i=o1(i,t.type,t.pendingProps,Zt),i!==null?(t.stateNode=i,rt=t,Ye=Kt(i.firstChild),Zt=!1,r=!0):r=!1),r||tl(t)),pe(t),r=t.type,h=t.pendingProps,b=e!==null?e.memoizedProps:null,i=h.children,Wu(r,h)?i=null:b!==null&&Wu(r,b)&&(t.flags|=32),t.memoizedState!==null&&(r=Fr(e,t,wb,null,null,l),as._currentValue=r),To(e,t),ft(e,t,i,l),t.child;case 6:return e===null&&Te&&((e=l=Ye)&&(l=c1(l,t.pendingProps,Zt),l!==null?(t.stateNode=l,rt=t,Ye=null,e=!0):e=!1),e||tl(t)),null;case 13:return Ym(e,t,l);case 4:return le(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Xl(t,null,i,l):ft(e,t,i,l),t.child;case 11:return Om(e,t,t.type,t.pendingProps,l);case 7:return ft(e,t,t.pendingProps,l),t.child;case 8:return ft(e,t,t.pendingProps.children,l),t.child;case 12:return ft(e,t,t.pendingProps.children,l),t.child;case 10:return i=t.pendingProps,nl(t,t.type,i.value),ft(e,t,i.children,l),t.child;case 9:return r=t.type._context,i=t.pendingProps.children,Ll(t),r=ut(r),i=i(r),t.flags|=1,ft(e,t,i,l),t.child;case 14:return Hm(e,t,t.type,t.pendingProps,l);case 15:return km(e,t,t.type,t.pendingProps,l);case 19:return Im(e,t,l);case 31:return Tb(e,t,l);case 22:return Rm(e,t,l,t.pendingProps);case 24:return Ll(t),i=ut(tt),e===null?(r=$r(),r===null&&(r=Ve,h=Ur(),r.pooledCache=h,h.refCount++,h!==null&&(r.pooledCacheLanes|=l),r=h),t.memoizedState={parent:i,cache:r},Yr(t),nl(t,tt,r)):((e.lanes&l)!==0&&(Xr(e,t),Bi(t,null,null,l),Ri()),r=e.memoizedState,h=t.memoizedState,r.parent!==i?(r={parent:i,cache:i},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),nl(t,tt,i)):(i=h.cache,nl(t,tt,i),i!==r.cache&&Br(t,[tt],l,!0))),ft(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function Dn(e){e.flags|=4}function Eu(e,t,l,i,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(xp())e.flags|=8192;else throw Yl=po,Vr}else e.flags&=-16777217}function Zm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!cg(t))if(xp())e.flags|=8192;else throw Yl=po,Vr}function zo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Bs():536870912,e.lanes|=t,Ua|=t)}function Xi(e,t){if(!Te)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var i=null;l!==null;)l.alternate!==null&&(i=l),l=l.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Xe(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,i=0;if(t)for(var r=e.child;r!==null;)l|=r.lanes|r.childLanes,i|=r.subtreeFlags&65011712,i|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)l|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=i,e.childLanes=l,t}function zb(e,t,l){var i=t.pendingProps;switch(Dr(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xe(t),null;case 1:return Xe(t),null;case 3:return l=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Mn(tt),re(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(_a(t)?Dn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Hr())),Xe(t),null;case 26:var r=t.type,h=t.memoizedState;return e===null?(Dn(t),h!==null?(Xe(t),Zm(t,h)):(Xe(t),Eu(t,r,null,i,l))):h?h!==e.memoizedState?(Dn(t),Xe(t),Zm(t,h)):(Xe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&Dn(t),Xe(t),Eu(t,r,e,i,l)),null;case 27:if(Se(t),l=xe.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Dn(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return Xe(t),null}e=ce.current,_a(t)?_h(t):(e=eg(r,i,l),t.stateNode=e,Dn(t))}return Xe(t),null;case 5:if(Se(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Dn(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return Xe(t),null}if(h=ce.current,_a(t))_h(t);else{var b=Zo(xe.current);switch(h){case 1:h=b.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:h=b.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":h=b.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":h=b.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":h=b.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof i.is=="string"?b.createElement("select",{is:i.is}):b.createElement("select"),i.multiple?h.multiple=!0:i.size&&(h.size=i.size);break;default:h=typeof i.is=="string"?b.createElement(r,{is:i.is}):b.createElement(r)}}h[st]=t,h[mt]=i;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)h.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=h;e:switch(dt(h,r,i),r){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Dn(t)}}return Xe(t),Eu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Dn(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(o(166));if(e=xe.current,_a(t)){if(e=t.stateNode,l=t.memoizedProps,i=null,r=rt,r!==null)switch(r.tag){case 27:case 5:i=r.memoizedProps}e[st]=t,e=!!(e.nodeValue===l||i!==null&&i.suppressHydrationWarning===!0||Yp(e.nodeValue,l)),e||tl(t,!0)}else e=Zo(e).createTextNode(i),e[st]=t,t.stateNode=e}return Xe(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(i=_a(t),l!==null){if(e===null){if(!i)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[st]=t}else Bl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Xe(t),e=!1}else l=Hr(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(Dt(t),t):(Dt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Xe(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=_a(t),i!==null&&i.dehydrated!==null){if(e===null){if(!r)throw Error(o(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(o(317));r[st]=t}else Bl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Xe(t),r=!1}else r=Hr(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Dt(t),t):(Dt(t),null)}return Dt(t),(t.flags&128)!==0?(t.lanes=l,t):(l=i!==null,e=e!==null&&e.memoizedState!==null,l&&(i=t.child,r=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(r=i.alternate.memoizedState.cachePool.pool),h=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),h!==r&&(i.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),zo(t,t.updateQueue),Xe(t),null);case 4:return re(),e===null&&Zu(t.stateNode.containerInfo),Xe(t),null;case 10:return Mn(t.type),Xe(t),null;case 19:if(P(We),i=t.memoizedState,i===null)return Xe(t),null;if(r=(t.flags&128)!==0,h=i.rendering,h===null)if(r)Xi(i,!1);else{if(Ke!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(h=xo(e),h!==null){for(t.flags|=128,Xi(i,!1),e=h.updateQueue,t.updateQueue=e,zo(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Sh(l,e),l=l.sibling;return oe(We,We.current&1|2),Te&&qn(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&Fe()>Ro&&(t.flags|=128,r=!0,Xi(i,!1),t.lanes=4194304)}else{if(!r)if(e=xo(h),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,zo(t,e),Xi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!h.alternate&&!Te)return Xe(t),null}else 2*Fe()-i.renderingStartTime>Ro&&l!==536870912&&(t.flags|=128,r=!0,Xi(i,!1),t.lanes=4194304);i.isBackwards?(h.sibling=t.child,t.child=h):(e=i.last,e!==null?e.sibling=h:t.child=h,i.last=h)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Fe(),e.sibling=null,l=We.current,oe(We,r?l&1|2:l&1),Te&&qn(t,i.treeForkCount),e):(Xe(t),null);case 22:case 23:return Dt(t),Qr(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(l&536870912)!==0&&(t.flags&128)===0&&(Xe(t),t.subtreeFlags&6&&(t.flags|=8192)):Xe(t),l=t.updateQueue,l!==null&&zo(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==l&&(t.flags|=2048),e!==null&&P($l),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Mn(tt),Xe(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Db(e,t){switch(Dr(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Mn(tt),re(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Se(t),null;case 31:if(t.memoizedState!==null){if(Dt(t),t.alternate===null)throw Error(o(340));Bl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Dt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Bl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return P(We),null;case 4:return re(),null;case 10:return Mn(t.type),null;case 22:case 23:return Dt(t),Qr(),e!==null&&P($l),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Mn(tt),null;case 25:return null;default:return null}}function Qm(e,t){switch(Dr(t),t.tag){case 3:Mn(tt),re();break;case 26:case 27:case 5:Se(t);break;case 4:re();break;case 31:t.memoizedState!==null&&Dt(t);break;case 13:Dt(t);break;case 19:P(We);break;case 10:Mn(t.type);break;case 22:case 23:Dt(t),Qr(),e!==null&&P($l);break;case 24:Mn(tt)}}function Ii(e,t){try{var l=t.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var r=i.next;l=r;do{if((l.tag&e)===e){i=void 0;var h=l.create,b=l.inst;i=h(),b.destroy=i}l=l.next}while(l!==r)}}catch(N){Re(t,t.return,N)}}function cl(e,t,l){try{var i=t.updateQueue,r=i!==null?i.lastEffect:null;if(r!==null){var h=r.next;i=h;do{if((i.tag&e)===e){var b=i.inst,N=b.destroy;if(N!==void 0){b.destroy=void 0,r=t;var H=l,K=N;try{K()}catch(ne){Re(r,H,ne)}}}i=i.next}while(i!==h)}}catch(ne){Re(t,t.return,ne)}}function Km(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{Uh(t,l)}catch(i){Re(e,e.return,i)}}}function Jm(e,t,l){l.props=Gl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(i){Re(e,t,i)}}function Gi(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof l=="function"?e.refCleanup=l(i):l.current=i}}catch(r){Re(e,t,r)}}function mn(e,t){var l=e.ref,i=e.refCleanup;if(l!==null)if(typeof i=="function")try{i()}catch(r){Re(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(r){Re(e,t,r)}else l.current=null}function Fm(e){var t=e.type,l=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break e;case"img":l.src?i.src=l.src:l.srcSet&&(i.srcset=l.srcSet)}}catch(r){Re(e,e.return,r)}}function _u(e,t,l){try{var i=e.stateNode;t1(i,e.type,l,t),i[mt]=t}catch(r){Re(e,e.return,r)}}function Wm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&pl(e.type)||e.tag===4}function qu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Wm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&pl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Cu(e,t,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=jn));else if(i!==4&&(i===27&&pl(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Cu(e,t,l),e=e.sibling;e!==null;)Cu(e,t,l),e=e.sibling}function Do(e,t,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(i!==4&&(i===27&&pl(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Do(e,t,l),e=e.sibling;e!==null;)Do(e,t,l),e=e.sibling}function Pm(e){var t=e.stateNode,l=e.memoizedProps;try{for(var i=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);dt(t,i,l),t[st]=e,t[mt]=l}catch(h){Re(e,e.return,h)}}var On=!1,at=!1,Mu=!1,ep=typeof WeakSet=="function"?WeakSet:Set,ct=null;function Ob(e,t){if(e=e.containerInfo,Ju=ec,e=dh(e),wr(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var i=l.getSelection&&l.getSelection();if(i&&i.rangeCount!==0){l=i.anchorNode;var r=i.anchorOffset,h=i.focusNode;i=i.focusOffset;try{l.nodeType,h.nodeType}catch{l=null;break e}var b=0,N=-1,H=-1,K=0,ne=0,ie=e,J=null;t:for(;;){for(var W;ie!==l||r!==0&&ie.nodeType!==3||(N=b+r),ie!==h||i!==0&&ie.nodeType!==3||(H=b+i),ie.nodeType===3&&(b+=ie.nodeValue.length),(W=ie.firstChild)!==null;)J=ie,ie=W;for(;;){if(ie===e)break t;if(J===l&&++K===r&&(N=b),J===h&&++ne===i&&(H=b),(W=ie.nextSibling)!==null)break;ie=J,J=ie.parentNode}ie=W}l=N===-1||H===-1?null:{start:N,end:H}}else l=null}l=l||{start:0,end:0}}else l=null;for(Fu={focusedElem:e,selectionRange:l},ec=!1,ct=t;ct!==null;)if(t=ct,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ct=e;else for(;ct!==null;){switch(t=ct,h=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)r=e[l],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,l=t,r=h.memoizedProps,h=h.memoizedState,i=l.stateNode;try{var fe=Gl(l.type,r);e=i.getSnapshotBeforeUpdate(fe,h),i.__reactInternalSnapshotBeforeUpdate=e}catch(be){Re(l,l.return,be)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)ef(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":ef(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,ct=e;break}ct=t.return}}function tp(e,t,l){var i=l.flags;switch(l.tag){case 0:case 11:case 15:kn(e,l),i&4&&Ii(5,l);break;case 1:if(kn(e,l),i&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(b){Re(l,l.return,b)}else{var r=Gl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){Re(l,l.return,b)}}i&64&&Km(l),i&512&&Gi(l,l.return);break;case 3:if(kn(e,l),i&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{Uh(e,t)}catch(b){Re(l,l.return,b)}}break;case 27:t===null&&i&4&&Pm(l);case 26:case 5:kn(e,l),t===null&&i&4&&Fm(l),i&512&&Gi(l,l.return);break;case 12:kn(e,l);break;case 31:kn(e,l),i&4&&ap(e,l);break;case 13:kn(e,l),i&4&&ip(e,l),i&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Yb.bind(null,l),r1(e,l))));break;case 22:if(i=l.memoizedState!==null||On,!i){t=t!==null&&t.memoizedState!==null||at,r=On;var h=at;On=i,(at=t)&&!h?Rn(e,l,(l.subtreeFlags&8772)!==0):kn(e,l),On=r,at=h}break;case 30:break;default:kn(e,l)}}function np(e){var t=e.alternate;t!==null&&(e.alternate=null,np(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&mi(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Ie=null,wt=!1;function Hn(e,t,l){for(l=l.child;l!==null;)lp(e,t,l),l=l.sibling}function lp(e,t,l){if(gt&&typeof gt.onCommitFiberUnmount=="function")try{gt.onCommitFiberUnmount(Ml,l)}catch{}switch(l.tag){case 26:at||mn(l,t),Hn(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:at||mn(l,t);var i=Ie,r=wt;pl(l.type)&&(Ie=l.stateNode,wt=!1),Hn(e,t,l),ts(l.stateNode),Ie=i,wt=r;break;case 5:at||mn(l,t);case 6:if(i=Ie,r=wt,Ie=null,Hn(e,t,l),Ie=i,wt=r,Ie!==null)if(wt)try{(Ie.nodeType===9?Ie.body:Ie.nodeName==="HTML"?Ie.ownerDocument.body:Ie).removeChild(l.stateNode)}catch(h){Re(l,t,h)}else try{Ie.removeChild(l.stateNode)}catch(h){Re(l,t,h)}break;case 18:Ie!==null&&(wt?(e=Ie,Kp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),Za(e)):Kp(Ie,l.stateNode));break;case 4:i=Ie,r=wt,Ie=l.stateNode.containerInfo,wt=!0,Hn(e,t,l),Ie=i,wt=r;break;case 0:case 11:case 14:case 15:cl(2,l,t),at||cl(4,l,t),Hn(e,t,l);break;case 1:at||(mn(l,t),i=l.stateNode,typeof i.componentWillUnmount=="function"&&Jm(l,t,i)),Hn(e,t,l);break;case 21:Hn(e,t,l);break;case 22:at=(i=at)||l.memoizedState!==null,Hn(e,t,l),at=i;break;default:Hn(e,t,l)}}function ap(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Za(e)}catch(l){Re(t,t.return,l)}}}function ip(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Za(e)}catch(l){Re(t,t.return,l)}}function Hb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ep),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ep),t;default:throw Error(o(435,e.tag))}}function Oo(e,t){var l=Hb(e);t.forEach(function(i){if(!l.has(i)){l.add(i);var r=Xb.bind(null,e,i);i.then(r,r)}})}function Nt(e,t){var l=t.deletions;if(l!==null)for(var i=0;i<l.length;i++){var r=l[i],h=e,b=t,N=b;e:for(;N!==null;){switch(N.tag){case 27:if(pl(N.type)){Ie=N.stateNode,wt=!1;break e}break;case 5:Ie=N.stateNode,wt=!1;break e;case 3:case 4:Ie=N.stateNode.containerInfo,wt=!0;break e}N=N.return}if(Ie===null)throw Error(o(160));lp(h,b,r),Ie=null,wt=!1,h=r.alternate,h!==null&&(h.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)sp(t,e),t=t.sibling}var Pt=null;function sp(e,t){var l=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Nt(t,e),jt(e),i&4&&(cl(3,e,e.return),Ii(3,e),cl(5,e,e.return));break;case 1:Nt(t,e),jt(e),i&512&&(at||l===null||mn(l,l.return)),i&64&&On&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?i:l.concat(i))));break;case 26:var r=Pt;if(Nt(t,e),jt(e),i&512&&(at||l===null||mn(l,l.return)),i&4){var h=l!==null?l.memoizedState:null;if(i=e.memoizedState,l===null)if(i===null)if(e.stateNode===null){e:{i=e.type,l=e.memoizedProps,r=r.ownerDocument||r;t:switch(i){case"title":h=r.getElementsByTagName("title")[0],(!h||h[zl]||h[st]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=r.createElement(i),r.head.insertBefore(h,r.querySelector("head > title"))),dt(h,i,l),h[st]=e,et(h),i=h;break e;case"link":var b=sg("link","href",r).get(i+(l.href||""));if(b){for(var N=0;N<b.length;N++)if(h=b[N],h.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&h.getAttribute("rel")===(l.rel==null?null:l.rel)&&h.getAttribute("title")===(l.title==null?null:l.title)&&h.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){b.splice(N,1);break t}}h=r.createElement(i),dt(h,i,l),r.head.appendChild(h);break;case"meta":if(b=sg("meta","content",r).get(i+(l.content||""))){for(N=0;N<b.length;N++)if(h=b[N],h.getAttribute("content")===(l.content==null?null:""+l.content)&&h.getAttribute("name")===(l.name==null?null:l.name)&&h.getAttribute("property")===(l.property==null?null:l.property)&&h.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&h.getAttribute("charset")===(l.charSet==null?null:l.charSet)){b.splice(N,1);break t}}h=r.createElement(i),dt(h,i,l),r.head.appendChild(h);break;default:throw Error(o(468,i))}h[st]=e,et(h),i=h}e.stateNode=i}else og(r,e.type,e.stateNode);else e.stateNode=ig(r,i,e.memoizedProps);else h!==i?(h===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):h.count--,i===null?og(r,e.type,e.stateNode):ig(r,i,e.memoizedProps)):i===null&&e.stateNode!==null&&_u(e,e.memoizedProps,l.memoizedProps)}break;case 27:Nt(t,e),jt(e),i&512&&(at||l===null||mn(l,l.return)),l!==null&&i&4&&_u(e,e.memoizedProps,l.memoizedProps);break;case 5:if(Nt(t,e),jt(e),i&512&&(at||l===null||mn(l,l.return)),e.flags&32){r=e.stateNode;try{ga(r,"")}catch(fe){Re(e,e.return,fe)}}i&4&&e.stateNode!=null&&(r=e.memoizedProps,_u(e,r,l!==null?l.memoizedProps:r)),i&1024&&(Mu=!0);break;case 6:if(Nt(t,e),jt(e),i&4){if(e.stateNode===null)throw Error(o(162));i=e.memoizedProps,l=e.stateNode;try{l.nodeValue=i}catch(fe){Re(e,e.return,fe)}}break;case 3:if(Jo=null,r=Pt,Pt=Qo(t.containerInfo),Nt(t,e),Pt=r,jt(e),i&4&&l!==null&&l.memoizedState.isDehydrated)try{Za(t.containerInfo)}catch(fe){Re(e,e.return,fe)}Mu&&(Mu=!1,op(e));break;case 4:i=Pt,Pt=Qo(e.stateNode.containerInfo),Nt(t,e),jt(e),Pt=i;break;case 12:Nt(t,e),jt(e);break;case 31:Nt(t,e),jt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Oo(e,i)));break;case 13:Nt(t,e),jt(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(ko=Fe()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Oo(e,i)));break;case 22:r=e.memoizedState!==null;var H=l!==null&&l.memoizedState!==null,K=On,ne=at;if(On=K||r,at=ne||H,Nt(t,e),at=ne,On=K,jt(e),i&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(l===null||H||On||at||Zl(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){H=l=t;try{if(h=H.stateNode,r)b=h.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{N=H.stateNode;var ie=H.memoizedProps.style,J=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;N.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(fe){Re(H,H.return,fe)}}}else if(t.tag===6){if(l===null){H=t;try{H.stateNode.nodeValue=r?"":H.memoizedProps}catch(fe){Re(H,H.return,fe)}}}else if(t.tag===18){if(l===null){H=t;try{var W=H.stateNode;r?Jp(W,!0):Jp(H.stateNode,!1)}catch(fe){Re(H,H.return,fe)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(l=i.retryQueue,l!==null&&(i.retryQueue=null,Oo(e,l))));break;case 19:Nt(t,e),jt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Oo(e,i)));break;case 30:break;case 21:break;default:Nt(t,e),jt(e)}}function jt(e){var t=e.flags;if(t&2){try{for(var l,i=e.return;i!==null;){if(Wm(i)){l=i;break}i=i.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var r=l.stateNode,h=qu(e);Do(e,h,r);break;case 5:var b=l.stateNode;l.flags&32&&(ga(b,""),l.flags&=-33);var N=qu(e);Do(e,N,b);break;case 3:case 4:var H=l.stateNode.containerInfo,K=qu(e);Cu(e,K,H);break;default:throw Error(o(161))}}catch(ne){Re(e,e.return,ne)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function op(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;op(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function kn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)tp(e,t.alternate,t),t=t.sibling}function Zl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:cl(4,t,t.return),Zl(t);break;case 1:mn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Jm(t,t.return,l),Zl(t);break;case 27:ts(t.stateNode);case 26:case 5:mn(t,t.return),Zl(t);break;case 22:t.memoizedState===null&&Zl(t);break;case 30:Zl(t);break;default:Zl(t)}e=e.sibling}}function Rn(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,r=e,h=t,b=h.flags;switch(h.tag){case 0:case 11:case 15:Rn(r,h,l),Ii(4,h);break;case 1:if(Rn(r,h,l),i=h,r=i.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(K){Re(i,i.return,K)}if(i=h,r=i.updateQueue,r!==null){var N=i.stateNode;try{var H=r.shared.hiddenCallbacks;if(H!==null)for(r.shared.hiddenCallbacks=null,r=0;r<H.length;r++)Bh(H[r],N)}catch(K){Re(i,i.return,K)}}l&&b&64&&Km(h),Gi(h,h.return);break;case 27:Pm(h);case 26:case 5:Rn(r,h,l),l&&i===null&&b&4&&Fm(h),Gi(h,h.return);break;case 12:Rn(r,h,l);break;case 31:Rn(r,h,l),l&&b&4&&ap(r,h);break;case 13:Rn(r,h,l),l&&b&4&&ip(r,h);break;case 22:h.memoizedState===null&&Rn(r,h,l),Gi(h,h.return);break;case 30:break;default:Rn(r,h,l)}t=t.sibling}}function Tu(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&zi(l))}function Au(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&zi(e))}function en(e,t,l,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)cp(e,t,l,i),t=t.sibling}function cp(e,t,l,i){var r=t.flags;switch(t.tag){case 0:case 11:case 15:en(e,t,l,i),r&2048&&Ii(9,t);break;case 1:en(e,t,l,i);break;case 3:en(e,t,l,i),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&zi(e)));break;case 12:if(r&2048){en(e,t,l,i),e=t.stateNode;try{var h=t.memoizedProps,b=h.id,N=h.onPostCommit;typeof N=="function"&&N(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(H){Re(t,t.return,H)}}else en(e,t,l,i);break;case 31:en(e,t,l,i);break;case 13:en(e,t,l,i);break;case 23:break;case 22:h=t.stateNode,b=t.alternate,t.memoizedState!==null?h._visibility&2?en(e,t,l,i):Zi(e,t):h._visibility&2?en(e,t,l,i):(h._visibility|=2,ka(e,t,l,i,(t.subtreeFlags&10256)!==0||!1)),r&2048&&Tu(b,t);break;case 24:en(e,t,l,i),r&2048&&Au(t.alternate,t);break;default:en(e,t,l,i)}}function ka(e,t,l,i,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var h=e,b=t,N=l,H=i,K=b.flags;switch(b.tag){case 0:case 11:case 15:ka(h,b,N,H,r),Ii(8,b);break;case 23:break;case 22:var ne=b.stateNode;b.memoizedState!==null?ne._visibility&2?ka(h,b,N,H,r):Zi(h,b):(ne._visibility|=2,ka(h,b,N,H,r)),r&&K&2048&&Tu(b.alternate,b);break;case 24:ka(h,b,N,H,r),r&&K&2048&&Au(b.alternate,b);break;default:ka(h,b,N,H,r)}t=t.sibling}}function Zi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,i=t,r=i.flags;switch(i.tag){case 22:Zi(l,i),r&2048&&Tu(i.alternate,i);break;case 24:Zi(l,i),r&2048&&Au(i.alternate,i);break;default:Zi(l,i)}t=t.sibling}}var Qi=8192;function Ra(e,t,l){if(e.subtreeFlags&Qi)for(e=e.child;e!==null;)rp(e,t,l),e=e.sibling}function rp(e,t,l){switch(e.tag){case 26:Ra(e,t,l),e.flags&Qi&&e.memoizedState!==null&&S1(l,Pt,e.memoizedState,e.memoizedProps);break;case 5:Ra(e,t,l);break;case 3:case 4:var i=Pt;Pt=Qo(e.stateNode.containerInfo),Ra(e,t,l),Pt=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=Qi,Qi=16777216,Ra(e,t,l),Qi=i):Ra(e,t,l));break;default:Ra(e,t,l)}}function up(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ki(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var i=t[l];ct=i,dp(i,e)}up(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)fp(e),e=e.sibling}function fp(e){switch(e.tag){case 0:case 11:case 15:Ki(e),e.flags&2048&&cl(9,e,e.return);break;case 3:Ki(e);break;case 12:Ki(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ho(e)):Ki(e);break;default:Ki(e)}}function Ho(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var i=t[l];ct=i,dp(i,e)}up(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:cl(8,t,t.return),Ho(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,Ho(t));break;default:Ho(t)}e=e.sibling}}function dp(e,t){for(;ct!==null;){var l=ct;switch(l.tag){case 0:case 11:case 15:cl(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var i=l.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:zi(l.memoizedState.cache)}if(i=l.child,i!==null)i.return=l,ct=i;else e:for(l=e;ct!==null;){i=ct;var r=i.sibling,h=i.return;if(np(i),i===l){ct=null;break e}if(r!==null){r.return=h,ct=r;break e}ct=h}}}var kb={getCacheForType:function(e){var t=ut(tt),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return ut(tt).controller.signal}},Rb=typeof WeakMap=="function"?WeakMap:Map,He=0,Ve=null,_e=null,Ce=0,ke=0,Ot=null,rl=!1,Ba=!1,zu=!1,Bn=0,Ke=0,ul=0,Ql=0,Du=0,Ht=0,Ua=0,Ji=null,Et=null,Ou=!1,ko=0,hp=0,Ro=1/0,Bo=null,fl=null,ot=0,dl=null,La=null,Un=0,Hu=0,ku=null,mp=null,Fi=0,Ru=null;function kt(){return(He&2)!==0&&Ce!==0?Ce&-Ce:E.T!==null?Yu():Vs()}function pp(){if(Ht===0)if((Ce&536870912)===0||Te){var e=ca;ca<<=1,(ca&3932160)===0&&(ca=262144),Ht=e}else Ht=536870912;return e=zt.current,e!==null&&(e.flags|=32),Ht}function _t(e,t,l){(e===Ve&&(ke===2||ke===9)||e.cancelPendingCommit!==null)&&($a(e,0),hl(e,Ce,Ht,!1)),Al(e,l),((He&2)===0||e!==Ve)&&(e===Ve&&((He&2)===0&&(Ql|=l),Ke===4&&hl(e,Ce,Ht,!1)),pn(e))}function gp(e,t,l){if((He&6)!==0)throw Error(o(327));var i=!l&&(t&127)===0&&(t&e.expiredLanes)===0||Tl(e,t),r=i?Lb(e,t):Uu(e,t,!0),h=i;do{if(r===0){Ba&&!i&&hl(e,t,0,!1);break}else{if(l=e.current.alternate,h&&!Bb(l)){r=Uu(e,t,!1),h=!1;continue}if(r===2){if(h=t,e.errorRecoveryDisabledLanes&h)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var N=e;r=Ji;var H=N.current.memoizedState.isDehydrated;if(H&&($a(N,b).flags|=256),b=Uu(N,b,!1),b!==2){if(zu&&!H){N.errorRecoveryDisabledLanes|=h,Ql|=h,r=4;break e}h=Et,Et=r,h!==null&&(Et===null?Et=h:Et.push.apply(Et,h))}r=b}if(h=!1,r!==2)continue}}if(r===1){$a(e,0),hl(e,t,0,!0);break}e:{switch(i=e,h=r,h){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:hl(i,t,Ht,!rl);break e;case 2:Et=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(r=ko+300-Fe(),10<r)){if(hl(i,t,Ht,!rl),ua(i,0,!0)!==0)break e;Un=t,i.timeoutHandle=Zp(yp.bind(null,i,l,Et,Bo,Ou,t,Ht,Ql,Ua,rl,h,"Throttled",-0,0),r);break e}yp(i,l,Et,Bo,Ou,t,Ht,Ql,Ua,rl,h,null,-0,0)}}break}while(!0);pn(e)}function yp(e,t,l,i,r,h,b,N,H,K,ne,ie,J,W){if(e.timeoutHandle=-1,ie=t.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:jn},rp(t,h,ie);var fe=(h&62914560)===h?ko-Fe():(h&4194048)===h?hp-Fe():0;if(fe=w1(ie,fe),fe!==null){Un=h,e.cancelPendingCommit=fe(Ep.bind(null,e,t,h,l,i,r,b,N,H,ne,ie,null,J,W)),hl(e,h,b,!K);return}}Ep(e,t,h,l,i,r,b,N,H)}function Bb(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var i=0;i<l.length;i++){var r=l[i],h=r.getSnapshot;r=r.value;try{if(!Tt(h(),r))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function hl(e,t,l,i){t&=~Du,t&=~Ql,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var r=t;0<r;){var h=31-yt(r),b=1<<h;i[h]=-1,r&=~b}l!==0&&Us(e,l,t)}function Uo(){return(He&6)===0?(Wi(0),!1):!0}function Bu(){if(_e!==null){if(ke===0)var e=_e.return;else e=_e,Cn=Ul=null,eu(e),Aa=null,Oi=0,e=_e;for(;e!==null;)Qm(e.alternate,e),e=e.return;_e=null}}function $a(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,a1(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),Un=0,Bu(),Ve=e,_e=l=_n(e.current,null),Ce=t,ke=0,Ot=null,rl=!1,Ba=Tl(e,t),zu=!1,Ua=Ht=Du=Ql=ul=Ke=0,Et=Ji=null,Ou=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var r=31-yt(i),h=1<<r;t|=e[r],i&=~h}return Bn=t,io(),l}function vp(e,t){Ne=null,E.H=Vi,t===Ta||t===mo?(t=Oh(),ke=3):t===Vr?(t=Oh(),ke=4):ke=t===gu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ot=t,_e===null&&(Ke=1,Co(e,Xt(t,e.current)))}function xp(){var e=zt.current;return e===null?!0:(Ce&4194048)===Ce?Qt===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?e===Qt:!1}function bp(){var e=E.H;return E.H=Vi,e===null?Vi:e}function Sp(){var e=E.A;return E.A=kb,e}function Lo(){Ke=4,rl||(Ce&4194048)!==Ce&&zt.current!==null||(Ba=!0),(ul&134217727)===0&&(Ql&134217727)===0||Ve===null||hl(Ve,Ce,Ht,!1)}function Uu(e,t,l){var i=He;He|=2;var r=bp(),h=Sp();(Ve!==e||Ce!==t)&&(Bo=null,$a(e,t)),t=!1;var b=Ke;e:do try{if(ke!==0&&_e!==null){var N=_e,H=Ot;switch(ke){case 8:Bu(),b=6;break e;case 3:case 2:case 9:case 6:zt.current===null&&(t=!0);var K=ke;if(ke=0,Ot=null,Va(e,N,H,K),l&&Ba){b=0;break e}break;default:K=ke,ke=0,Ot=null,Va(e,N,H,K)}}Ub(),b=Ke;break}catch(ne){vp(e,ne)}while(!0);return t&&e.shellSuspendCounter++,Cn=Ul=null,He=i,E.H=r,E.A=h,_e===null&&(Ve=null,Ce=0,io()),b}function Ub(){for(;_e!==null;)wp(_e)}function Lb(e,t){var l=He;He|=2;var i=bp(),r=Sp();Ve!==e||Ce!==t?(Bo=null,Ro=Fe()+500,$a(e,t)):Ba=Tl(e,t);e:do try{if(ke!==0&&_e!==null){t=_e;var h=Ot;t:switch(ke){case 1:ke=0,Ot=null,Va(e,t,h,1);break;case 2:case 9:if(zh(h)){ke=0,Ot=null,Np(t);break}t=function(){ke!==2&&ke!==9||Ve!==e||(ke=7),pn(e)},h.then(t,t);break e;case 3:ke=7;break e;case 4:ke=5;break e;case 7:zh(h)?(ke=0,Ot=null,Np(t)):(ke=0,Ot=null,Va(e,t,h,7));break;case 5:var b=null;switch(_e.tag){case 26:b=_e.memoizedState;case 5:case 27:var N=_e;if(b?cg(b):N.stateNode.complete){ke=0,Ot=null;var H=N.sibling;if(H!==null)_e=H;else{var K=N.return;K!==null?(_e=K,$o(K)):_e=null}break t}}ke=0,Ot=null,Va(e,t,h,5);break;case 6:ke=0,Ot=null,Va(e,t,h,6);break;case 8:Bu(),Ke=6;break e;default:throw Error(o(462))}}$b();break}catch(ne){vp(e,ne)}while(!0);return Cn=Ul=null,E.H=i,E.A=r,He=l,_e!==null?0:(Ve=null,Ce=0,io(),Ke)}function $b(){for(;_e!==null&&!xn();)wp(_e)}function wp(e){var t=Gm(e.alternate,e,Bn);e.memoizedProps=e.pendingProps,t===null?$o(e):_e=t}function Np(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=Lm(l,t,t.pendingProps,t.type,void 0,Ce);break;case 11:t=Lm(l,t,t.pendingProps,t.type.render,t.ref,Ce);break;case 5:eu(t);default:Qm(l,t),t=_e=Sh(t,Bn),t=Gm(l,t,Bn)}e.memoizedProps=e.pendingProps,t===null?$o(e):_e=t}function Va(e,t,l,i){Cn=Ul=null,eu(t),Aa=null,Oi=0;var r=t.return;try{if(Mb(e,r,t,l,Ce)){Ke=1,Co(e,Xt(l,e.current)),_e=null;return}}catch(h){if(r!==null)throw _e=r,h;Ke=1,Co(e,Xt(l,e.current)),_e=null;return}t.flags&32768?(Te||i===1?e=!0:Ba||(Ce&536870912)!==0?e=!1:(rl=e=!0,(i===2||i===9||i===3||i===6)&&(i=zt.current,i!==null&&i.tag===13&&(i.flags|=16384))),jp(t,e)):$o(t)}function $o(e){var t=e;do{if((t.flags&32768)!==0){jp(t,rl);return}e=t.return;var l=zb(t.alternate,t,Bn);if(l!==null){_e=l;return}if(t=t.sibling,t!==null){_e=t;return}_e=t=e}while(t!==null);Ke===0&&(Ke=5)}function jp(e,t){do{var l=Db(e.alternate,e);if(l!==null){l.flags&=32767,_e=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){_e=e;return}_e=e=l}while(e!==null);Ke=6,_e=null}function Ep(e,t,l,i,r,h,b,N,H){e.cancelPendingCommit=null;do Vo();while(ot!==0);if((He&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(h=t.lanes|t.childLanes,h|=qr,ar(e,l,h,b,N,H),e===Ve&&(_e=Ve=null,Ce=0),La=t,dl=e,Un=l,Hu=h,ku=r,mp=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Ib(Vt,function(){return Tp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=E.T,E.T=null,r=M.p,M.p=2,b=He,He|=4;try{Ob(e,t,l)}finally{He=b,M.p=r,E.T=i}}ot=1,_p(),qp(),Cp()}}function _p(){if(ot===1){ot=0;var e=dl,t=La,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=E.T,E.T=null;var i=M.p;M.p=2;var r=He;He|=4;try{sp(t,e);var h=Fu,b=dh(e.containerInfo),N=h.focusedElem,H=h.selectionRange;if(b!==N&&N&&N.ownerDocument&&fh(N.ownerDocument.documentElement,N)){if(H!==null&&wr(N)){var K=H.start,ne=H.end;if(ne===void 0&&(ne=K),"selectionStart"in N)N.selectionStart=K,N.selectionEnd=Math.min(ne,N.value.length);else{var ie=N.ownerDocument||document,J=ie&&ie.defaultView||window;if(J.getSelection){var W=J.getSelection(),fe=N.textContent.length,be=Math.min(H.start,fe),$e=H.end===void 0?be:Math.min(H.end,fe);!W.extend&&be>$e&&(b=$e,$e=be,be=b);var X=uh(N,be),U=uh(N,$e);if(X&&U&&(W.rangeCount!==1||W.anchorNode!==X.node||W.anchorOffset!==X.offset||W.focusNode!==U.node||W.focusOffset!==U.offset)){var Q=ie.createRange();Q.setStart(X.node,X.offset),W.removeAllRanges(),be>$e?(W.addRange(Q),W.extend(U.node,U.offset)):(Q.setEnd(U.node,U.offset),W.addRange(Q))}}}}for(ie=[],W=N;W=W.parentNode;)W.nodeType===1&&ie.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ie.length;N++){var ae=ie[N];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}ec=!!Ju,Fu=Ju=null}finally{He=r,M.p=i,E.T=l}}e.current=t,ot=2}}function qp(){if(ot===2){ot=0;var e=dl,t=La,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=E.T,E.T=null;var i=M.p;M.p=2;var r=He;He|=4;try{tp(e,t.alternate,t)}finally{He=r,M.p=i,E.T=l}}ot=3}}function Cp(){if(ot===4||ot===3){ot=0,bn();var e=dl,t=La,l=Un,i=mp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ot=5:(ot=0,La=dl=null,Mp(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(fl=null),hi(l),t=t.stateNode,gt&&typeof gt.onCommitFiberRoot=="function")try{gt.onCommitFiberRoot(Ml,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=E.T,r=M.p,M.p=2,E.T=null;try{for(var h=e.onRecoverableError,b=0;b<i.length;b++){var N=i[b];h(N.value,{componentStack:N.stack})}}finally{E.T=t,M.p=r}}(Un&3)!==0&&Vo(),pn(e),r=e.pendingLanes,(l&261930)!==0&&(r&42)!==0?e===Ru?Fi++:(Fi=0,Ru=e):Fi=0,Wi(0)}}function Mp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,zi(t)))}function Vo(){return _p(),qp(),Cp(),Tp()}function Tp(){if(ot!==5)return!1;var e=dl,t=Hu;Hu=0;var l=hi(Un),i=E.T,r=M.p;try{M.p=32>l?32:l,E.T=null,l=ku,ku=null;var h=dl,b=Un;if(ot=0,La=dl=null,Un=0,(He&6)!==0)throw Error(o(331));var N=He;if(He|=4,fp(h.current),cp(h,h.current,b,l),He=N,Wi(0,!1),gt&&typeof gt.onPostCommitFiberRoot=="function")try{gt.onPostCommitFiberRoot(Ml,h)}catch{}return!0}finally{M.p=r,E.T=i,Mp(e,t)}}function Ap(e,t,l){t=Xt(l,t),t=pu(e.stateNode,t,2),e=il(e,t,2),e!==null&&(Al(e,2),pn(e))}function Re(e,t,l){if(e.tag===3)Ap(e,e,l);else for(;t!==null;){if(t.tag===3){Ap(t,e,l);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(fl===null||!fl.has(i))){e=Xt(l,e),l=zm(2),i=il(t,l,2),i!==null&&(Dm(l,i,t,e),Al(i,2),pn(i));break}}t=t.return}}function Lu(e,t,l){var i=e.pingCache;if(i===null){i=e.pingCache=new Rb;var r=new Set;i.set(t,r)}else r=i.get(t),r===void 0&&(r=new Set,i.set(t,r));r.has(l)||(zu=!0,r.add(l),e=Vb.bind(null,e,t,l),t.then(e,e))}function Vb(e,t,l){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Ve===e&&(Ce&l)===l&&(Ke===4||Ke===3&&(Ce&62914560)===Ce&&300>Fe()-ko?(He&2)===0&&$a(e,0):Du|=l,Ua===Ce&&(Ua=0)),pn(e)}function zp(e,t){t===0&&(t=Bs()),e=kl(e,t),e!==null&&(Al(e,t),pn(e))}function Yb(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),zp(e,l)}function Xb(e,t){var l=0;switch(e.tag){case 31:case 13:var i=e.stateNode,r=e.memoizedState;r!==null&&(l=r.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(o(314))}i!==null&&i.delete(t),zp(e,l)}function Ib(e,t){return se(e,t)}var Yo=null,Ya=null,$u=!1,Xo=!1,Vu=!1,ml=0;function pn(e){e!==Ya&&e.next===null&&(Ya===null?Yo=Ya=e:Ya=Ya.next=e),Xo=!0,$u||($u=!0,Zb())}function Wi(e,t){if(!Vu&&Xo){Vu=!0;do for(var l=!1,i=Yo;i!==null;){if(e!==0){var r=i.pendingLanes;if(r===0)var h=0;else{var b=i.suspendedLanes,N=i.pingedLanes;h=(1<<31-yt(42|e)+1)-1,h&=r&~(b&~N),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(l=!0,kp(i,h))}else h=Ce,h=ua(i,i===Ve?h:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(h&3)===0||Tl(i,h)||(l=!0,kp(i,h));i=i.next}while(l);Vu=!1}}function Gb(){Dp()}function Dp(){Xo=$u=!1;var e=0;ml!==0&&l1()&&(e=ml);for(var t=Fe(),l=null,i=Yo;i!==null;){var r=i.next,h=Op(i,t);h===0?(i.next=null,l===null?Yo=r:l.next=r,r===null&&(Ya=l)):(l=i,(e!==0||(h&3)!==0)&&(Xo=!0)),i=r}ot!==0&&ot!==5||Wi(e),ml!==0&&(ml=0)}function Op(e,t){for(var l=e.suspendedLanes,i=e.pingedLanes,r=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var b=31-yt(h),N=1<<b,H=r[b];H===-1?((N&l)===0||(N&i)!==0)&&(r[b]=lr(N,t)):H<=t&&(e.expiredLanes|=N),h&=~N}if(t=Ve,l=Ce,l=ua(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,l===0||e===t&&(ke===2||ke===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&Oe(i),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||Tl(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(i!==null&&Oe(i),hi(l)){case 2:case 8:l=$t;break;case 32:l=Vt;break;case 268435456:l=sa;break;default:l=Vt}return i=Hp.bind(null,e),l=se(l,i),e.callbackPriority=t,e.callbackNode=l,t}return i!==null&&i!==null&&Oe(i),e.callbackPriority=2,e.callbackNode=null,2}function Hp(e,t){if(ot!==0&&ot!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Vo()&&e.callbackNode!==l)return null;var i=Ce;return i=ua(e,e===Ve?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(gp(e,i,t),Op(e,Fe()),e.callbackNode!=null&&e.callbackNode===l?Hp.bind(null,e):null)}function kp(e,t){if(Vo())return null;gp(e,t,!0)}function Zb(){i1(function(){(He&6)!==0?se(Lt,Gb):Dp()})}function Yu(){if(ml===0){var e=Ca;e===0&&(e=oa,oa<<=1,(oa&261888)===0&&(oa=256)),ml=e}return ml}function Rp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Fs(""+e)}function Bp(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function Qb(e,t,l,i,r){if(t==="submit"&&l&&l.stateNode===r){var h=Rp((r[mt]||null).action),b=i.submitter;b&&(t=(t=b[mt]||null)?Rp(t.formAction):b.getAttribute("formAction"),t!==null&&(h=t,b=null));var N=new to("action","action",null,i,r);e.push({event:N,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(ml!==0){var H=b?Bp(r,b):new FormData(r);ru(l,{pending:!0,data:H,method:r.method,action:h},null,H)}}else typeof h=="function"&&(N.preventDefault(),H=b?Bp(r,b):new FormData(r),ru(l,{pending:!0,data:H,method:r.method,action:h},h,H))},currentTarget:r}]})}}for(var Xu=0;Xu<_r.length;Xu++){var Iu=_r[Xu],Kb=Iu.toLowerCase(),Jb=Iu[0].toUpperCase()+Iu.slice(1);Wt(Kb,"on"+Jb)}Wt(ph,"onAnimationEnd"),Wt(gh,"onAnimationIteration"),Wt(yh,"onAnimationStart"),Wt("dblclick","onDoubleClick"),Wt("focusin","onFocus"),Wt("focusout","onBlur"),Wt(db,"onTransitionRun"),Wt(hb,"onTransitionStart"),Wt(mb,"onTransitionCancel"),Wt(vh,"onTransitionEnd"),Jn("onMouseEnter",["mouseout","mouseover"]),Jn("onMouseLeave",["mouseout","mouseover"]),Jn("onPointerEnter",["pointerout","pointerover"]),Jn("onPointerLeave",["pointerout","pointerover"]),Nn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Nn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Nn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Nn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Nn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Nn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Pi="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(" "),Fb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Pi));function Up(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var i=e[l],r=i.event;i=i.listeners;e:{var h=void 0;if(t)for(var b=i.length-1;0<=b;b--){var N=i[b],H=N.instance,K=N.currentTarget;if(N=N.listener,H!==h&&r.isPropagationStopped())break e;h=N,r.currentTarget=K;try{h(r)}catch(ne){ao(ne)}r.currentTarget=null,h=H}else for(b=0;b<i.length;b++){if(N=i[b],H=N.instance,K=N.currentTarget,N=N.listener,H!==h&&r.isPropagationStopped())break e;h=N,r.currentTarget=K;try{h(r)}catch(ne){ao(ne)}r.currentTarget=null,h=H}}}}function qe(e,t){var l=t[fa];l===void 0&&(l=t[fa]=new Set);var i=e+"__bubble";l.has(i)||(Lp(t,e,2,!1),l.add(i))}function Gu(e,t,l){var i=0;t&&(i|=4),Lp(l,e,i,t)}var Io="_reactListening"+Math.random().toString(36).slice(2);function Zu(e){if(!e[Io]){e[Io]=!0,Gs.forEach(function(l){l!=="selectionchange"&&(Fb.has(l)||Gu(l,!1,e),Gu(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Io]||(t[Io]=!0,Gu("selectionchange",!1,t))}}function Lp(e,t,l,i){switch(pg(t)){case 2:var r=E1;break;case 8:r=_1;break;default:r=rf}l=r.bind(null,t,l,e),r=void 0,!hr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),i?r!==void 0?e.addEventListener(t,l,{capture:!0,passive:r}):e.addEventListener(t,l,!0):r!==void 0?e.addEventListener(t,l,{passive:r}):e.addEventListener(t,l,!1)}function Qu(e,t,l,i,r){var h=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var b=i.tag;if(b===3||b===4){var N=i.stateNode.containerInfo;if(N===r)break;if(b===4)for(b=i.return;b!==null;){var H=b.tag;if((H===3||H===4)&&b.stateNode.containerInfo===r)return;b=b.return}for(;N!==null;){if(b=Gn(N),b===null)return;if(H=b.tag,H===5||H===6||H===26||H===27){i=h=b;continue e}N=N.parentNode}}i=i.return}Id(function(){var K=h,ne=fr(l),ie=[];e:{var J=xh.get(e);if(J!==void 0){var W=to,fe=e;switch(e){case"keypress":if(Ps(l)===0)break e;case"keydown":case"keyup":W=Xx;break;case"focusin":fe="focus",W=yr;break;case"focusout":fe="blur",W=yr;break;case"beforeblur":case"afterblur":W=yr;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":W=Qd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=zx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=Zx;break;case ph:case gh:case yh:W=Hx;break;case vh:W=Kx;break;case"scroll":case"scrollend":W=Tx;break;case"wheel":W=Fx;break;case"copy":case"cut":case"paste":W=Rx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=Jd;break;case"toggle":case"beforetoggle":W=Px}var be=(t&4)!==0,$e=!be&&(e==="scroll"||e==="scrollend"),X=be?J!==null?J+"Capture":null:J;be=[];for(var U=K,Q;U!==null;){var ae=U;if(Q=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||Q===null||X===null||(ae=Si(U,X),ae!=null&&be.push(es(U,ae,Q))),$e)break;U=U.return}0<be.length&&(J=new W(J,fe,null,l,ne),ie.push({event:J,listeners:be}))}}if((t&7)===0){e:{if(J=e==="mouseover"||e==="pointerover",W=e==="mouseout"||e==="pointerout",J&&l!==ur&&(fe=l.relatedTarget||l.fromElement)&&(Gn(fe)||fe[wn]))break e;if((W||J)&&(J=ne.window===ne?ne:(J=ne.ownerDocument)?J.defaultView||J.parentWindow:window,W?(fe=l.relatedTarget||l.toElement,W=K,fe=fe?Gn(fe):null,fe!==null&&($e=u(fe),be=fe.tag,fe!==$e||be!==5&&be!==27&&be!==6)&&(fe=null)):(W=null,fe=K),W!==fe)){if(be=Qd,ae="onMouseLeave",X="onMouseEnter",U="mouse",(e==="pointerout"||e==="pointerover")&&(be=Jd,ae="onPointerLeave",X="onPointerEnter",U="pointer"),$e=W==null?J:Qn(W),Q=fe==null?J:Qn(fe),J=new be(ae,U+"leave",W,l,ne),J.target=$e,J.relatedTarget=Q,ae=null,Gn(ne)===K&&(be=new be(X,U+"enter",fe,l,ne),be.target=Q,be.relatedTarget=$e,ae=be),$e=ae,W&&fe)t:{for(be=Wb,X=W,U=fe,Q=0,ae=X;ae;ae=be(ae))Q++;ae=0;for(var ve=U;ve;ve=be(ve))ae++;for(;0<Q-ae;)X=be(X),Q--;for(;0<ae-Q;)U=be(U),ae--;for(;Q--;){if(X===U||U!==null&&X===U.alternate){be=X;break t}X=be(X),U=be(U)}be=null}else be=null;W!==null&&$p(ie,J,W,be,!1),fe!==null&&$e!==null&&$p(ie,$e,fe,be,!0)}}e:{if(J=K?Qn(K):window,W=J.nodeName&&J.nodeName.toLowerCase(),W==="select"||W==="input"&&J.type==="file")var ze=ah;else if(nh(J))if(ih)ze=rb;else{ze=ob;var me=sb}else W=J.nodeName,!W||W.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?K&&rr(K.elementType)&&(ze=ah):ze=cb;if(ze&&(ze=ze(e,K))){lh(ie,ze,l,ne);break e}me&&me(e,J,K),e==="focusout"&&K&&J.type==="number"&&K.memoizedProps.value!=null&&xi(J,"number",J.value)}switch(me=K?Qn(K):window,e){case"focusin":(nh(me)||me.contentEditable==="true")&&(ba=me,Nr=K,Mi=null);break;case"focusout":Mi=Nr=ba=null;break;case"mousedown":jr=!0;break;case"contextmenu":case"mouseup":case"dragend":jr=!1,hh(ie,l,ne);break;case"selectionchange":if(fb)break;case"keydown":case"keyup":hh(ie,l,ne)}var je;if(xr)e:{switch(e){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else xa?eh(e,l)&&(Me="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Me="onCompositionStart");Me&&(Fd&&l.locale!=="ko"&&(xa||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&xa&&(je=Gd()):(Wn=ne,mr="value"in Wn?Wn.value:Wn.textContent,xa=!0)),me=Go(K,Me),0<me.length&&(Me=new Kd(Me,e,null,l,ne),ie.push({event:Me,listeners:me}),je?Me.data=je:(je=th(l),je!==null&&(Me.data=je)))),(je=tb?nb(e,l):lb(e,l))&&(Me=Go(K,"onBeforeInput"),0<Me.length&&(me=new Kd("onBeforeInput","beforeinput",null,l,ne),ie.push({event:me,listeners:Me}),me.data=je)),Qb(ie,e,K,l,ne)}Up(ie,t)})}function es(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Go(e,t){for(var l=t+"Capture",i=[];e!==null;){var r=e,h=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||h===null||(r=Si(e,l),r!=null&&i.unshift(es(e,r,h)),r=Si(e,t),r!=null&&i.push(es(e,r,h))),e.tag===3)return i;e=e.return}return[]}function Wb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function $p(e,t,l,i,r){for(var h=t._reactName,b=[];l!==null&&l!==i;){var N=l,H=N.alternate,K=N.stateNode;if(N=N.tag,H!==null&&H===i)break;N!==5&&N!==26&&N!==27||K===null||(H=K,r?(K=Si(l,h),K!=null&&b.unshift(es(l,K,H))):r||(K=Si(l,h),K!=null&&b.push(es(l,K,H)))),l=l.return}b.length!==0&&e.push({event:t,listeners:b})}var Pb=/\r\n?/g,e1=/\u0000|\uFFFD/g;function Vp(e){return(typeof e=="string"?e:""+e).replace(Pb,`
|
|
25
|
-
`).replace(e1,"")}function Yp(e,t){return t=Vp(t),Vp(e)===t}function Le(e,t,l,i,r,h){switch(l){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||ga(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&ga(e,""+i);break;case"className":ha(e,"class",i);break;case"tabIndex":ha(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":ha(e,l,i);break;case"style":Yd(e,i,h);break;case"data":if(t!=="object"){ha(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=Fs(""+i),e.setAttribute(l,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(l==="formAction"?(t!=="input"&&Le(e,t,"name",r.name,r,null),Le(e,t,"formEncType",r.formEncType,r,null),Le(e,t,"formMethod",r.formMethod,r,null),Le(e,t,"formTarget",r.formTarget,r,null)):(Le(e,t,"encType",r.encType,r,null),Le(e,t,"method",r.method,r,null),Le(e,t,"target",r.target,r,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=Fs(""+i),e.setAttribute(l,i);break;case"onClick":i!=null&&(e.onclick=jn);break;case"onScroll":i!=null&&qe("scroll",e);break;case"onScrollEnd":i!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(l=i.__html,l!=null){if(r.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}l=Fs(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""+i):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":i===!0?e.setAttribute(l,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,i):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(l,i):e.removeAttribute(l);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(l):e.setAttribute(l,i);break;case"popover":qe("beforetoggle",e),qe("toggle",e),da(e,"popover",i);break;case"xlinkActuate":Ft(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Ft(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Ft(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Ft(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Ft(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Ft(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Ft(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Ft(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Ft(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":da(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Cx.get(l)||l,da(e,l,i))}}function Ku(e,t,l,i,r,h){switch(l){case"style":Yd(e,i,h);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(l=i.__html,l!=null){if(r.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof i=="string"?ga(e,i):(typeof i=="number"||typeof i=="bigint")&&ga(e,""+i);break;case"onScroll":i!=null&&qe("scroll",e);break;case"onScrollEnd":i!=null&&qe("scrollend",e);break;case"onClick":i!=null&&(e.onclick=jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zs.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(r=l.endsWith("Capture"),t=l.slice(2,r?l.length-7:void 0),h=e[mt]||null,h=h!=null?h[l]:null,typeof h=="function"&&e.removeEventListener(t,h,r),typeof i=="function")){typeof h!="function"&&h!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,i,r);break e}l in e?e[l]=i:i===!0?e.setAttribute(l,""):da(e,l,i)}}}function dt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var i=!1,r=!1,h;for(h in l)if(l.hasOwnProperty(h)){var b=l[h];if(b!=null)switch(h){case"src":i=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Le(e,t,h,b,l,null)}}r&&Le(e,t,"srcSet",l.srcSet,l,null),i&&Le(e,t,"src",l.src,l,null);return;case"input":qe("invalid",e);var N=h=b=r=null,H=null,K=null;for(i in l)if(l.hasOwnProperty(i)){var ne=l[i];if(ne!=null)switch(i){case"name":r=ne;break;case"type":b=ne;break;case"checked":H=ne;break;case"defaultChecked":K=ne;break;case"value":h=ne;break;case"defaultValue":N=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(o(137,t));break;default:Le(e,t,i,ne,l,null)}}pa(e,h,N,H,K,b,r,!1);return;case"select":qe("invalid",e),i=b=h=null;for(r in l)if(l.hasOwnProperty(r)&&(N=l[r],N!=null))switch(r){case"value":h=N;break;case"defaultValue":b=N;break;case"multiple":i=N;default:Le(e,t,r,N,l,null)}t=h,l=b,e.multiple=!!i,t!=null?Fn(e,!!i,t,!1):l!=null&&Fn(e,!!i,l,!0);return;case"textarea":qe("invalid",e),h=r=i=null;for(b in l)if(l.hasOwnProperty(b)&&(N=l[b],N!=null))switch(b){case"value":i=N;break;case"defaultValue":r=N;break;case"children":h=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(o(91));break;default:Le(e,t,b,N,l,null)}$d(e,i,r,h);return;case"option":for(H in l)l.hasOwnProperty(H)&&(i=l[H],i!=null)&&(H==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":Le(e,t,H,i,l,null));return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(i=0;i<Pi.length;i++)qe(Pi[i],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in l)if(l.hasOwnProperty(K)&&(i=l[K],i!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Le(e,t,K,i,l,null)}return;default:if(rr(t)){for(ne in l)l.hasOwnProperty(ne)&&(i=l[ne],i!==void 0&&Ku(e,t,ne,i,l,void 0));return}}for(N in l)l.hasOwnProperty(N)&&(i=l[N],i!=null&&Le(e,t,N,i,l,null))}function t1(e,t,l,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,h=null,b=null,N=null,H=null,K=null,ne=null;for(W in l){var ie=l[W];if(l.hasOwnProperty(W)&&ie!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":H=ie;default:i.hasOwnProperty(W)||Le(e,t,W,null,i,ie)}}for(var J in i){var W=i[J];if(ie=l[J],i.hasOwnProperty(J)&&(W!=null||ie!=null))switch(J){case"type":h=W;break;case"name":r=W;break;case"checked":K=W;break;case"defaultChecked":ne=W;break;case"value":b=W;break;case"defaultValue":N=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(o(137,t));break;default:W!==ie&&Le(e,t,J,W,i,ie)}}vi(e,b,N,H,K,ne,h,r);return;case"select":W=b=N=J=null;for(h in l)if(H=l[h],l.hasOwnProperty(h)&&H!=null)switch(h){case"value":break;case"multiple":W=H;default:i.hasOwnProperty(h)||Le(e,t,h,null,i,H)}for(r in i)if(h=i[r],H=l[r],i.hasOwnProperty(r)&&(h!=null||H!=null))switch(r){case"value":J=h;break;case"defaultValue":N=h;break;case"multiple":b=h;default:h!==H&&Le(e,t,r,h,i,H)}t=N,l=b,i=W,J!=null?Fn(e,!!l,J,!1):!!i!=!!l&&(t!=null?Fn(e,!!l,t,!0):Fn(e,!!l,l?[]:"",!1));return;case"textarea":W=J=null;for(N in l)if(r=l[N],l.hasOwnProperty(N)&&r!=null&&!i.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Le(e,t,N,null,i,r)}for(b in i)if(r=i[b],h=l[b],i.hasOwnProperty(b)&&(r!=null||h!=null))switch(b){case"value":J=r;break;case"defaultValue":W=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(o(91));break;default:r!==h&&Le(e,t,b,r,i,h)}bi(e,J,W);return;case"option":for(var fe in l)J=l[fe],l.hasOwnProperty(fe)&&J!=null&&!i.hasOwnProperty(fe)&&(fe==="selected"?e.selected=!1:Le(e,t,fe,null,i,J));for(H in i)J=i[H],W=l[H],i.hasOwnProperty(H)&&J!==W&&(J!=null||W!=null)&&(H==="selected"?e.selected=J&&typeof J!="function"&&typeof J!="symbol":Le(e,t,H,J,i,W));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var be in l)J=l[be],l.hasOwnProperty(be)&&J!=null&&!i.hasOwnProperty(be)&&Le(e,t,be,null,i,J);for(K in i)if(J=i[K],W=l[K],i.hasOwnProperty(K)&&J!==W&&(J!=null||W!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(o(137,t));break;default:Le(e,t,K,J,i,W)}return;default:if(rr(t)){for(var $e in l)J=l[$e],l.hasOwnProperty($e)&&J!==void 0&&!i.hasOwnProperty($e)&&Ku(e,t,$e,void 0,i,J);for(ne in i)J=i[ne],W=l[ne],!i.hasOwnProperty(ne)||J===W||J===void 0&&W===void 0||Ku(e,t,ne,J,i,W);return}}for(var X in l)J=l[X],l.hasOwnProperty(X)&&J!=null&&!i.hasOwnProperty(X)&&Le(e,t,X,null,i,J);for(ie in i)J=i[ie],W=l[ie],!i.hasOwnProperty(ie)||J===W||J==null&&W==null||Le(e,t,ie,J,i,W)}function Xp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function n1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),i=0;i<l.length;i++){var r=l[i],h=r.transferSize,b=r.initiatorType,N=r.duration;if(h&&N&&Xp(b)){for(b=0,N=r.responseEnd,i+=1;i<l.length;i++){var H=l[i],K=H.startTime;if(K>N)break;var ne=H.transferSize,ie=H.initiatorType;ne&&Xp(ie)&&(H=H.responseEnd,b+=ne*(H<N?1:(N-K)/(H-K)))}if(--i,t+=8*(h+b)/(r.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Ju=null,Fu=null;function Zo(e){return e.nodeType===9?e:e.ownerDocument}function Ip(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Gp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Wu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Pu=null;function l1(){var e=window.event;return e&&e.type==="popstate"?e===Pu?!1:(Pu=e,!0):(Pu=null,!1)}var Zp=typeof setTimeout=="function"?setTimeout:void 0,a1=typeof clearTimeout=="function"?clearTimeout:void 0,Qp=typeof Promise=="function"?Promise:void 0,i1=typeof queueMicrotask=="function"?queueMicrotask:typeof Qp<"u"?function(e){return Qp.resolve(null).then(e).catch(s1)}:Zp;function s1(e){setTimeout(function(){throw e})}function pl(e){return e==="head"}function Kp(e,t){var l=t,i=0;do{var r=l.nextSibling;if(e.removeChild(l),r&&r.nodeType===8)if(l=r.data,l==="/$"||l==="/&"){if(i===0){e.removeChild(r),Za(t);return}i--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")i++;else if(l==="html")ts(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,ts(l);for(var h=l.firstChild;h;){var b=h.nextSibling,N=h.nodeName;h[zl]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&h.rel.toLowerCase()==="stylesheet"||l.removeChild(h),h=b}}else l==="body"&&ts(e.ownerDocument.body);l=r}while(l);Za(t)}function Jp(e,t){var l=e;e=0;do{var i=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),i&&i.nodeType===8)if(l=i.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=i}while(l)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":ef(l),mi(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function o1(e,t,l,i){for(;e.nodeType===1;){var r=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[zl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var h=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Kt(e.nextSibling),e===null)break}return null}function c1(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Kt(e.nextSibling),e===null))return null;return e}function Fp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Kt(e.nextSibling),e===null))return null;return e}function tf(e){return e.data==="$?"||e.data==="$~"}function nf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function r1(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var i=function(){t(),l.removeEventListener("DOMContentLoaded",i)};l.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function Kt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var lf=null;function Wp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Kt(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function Pp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function eg(e,t,l){switch(t=Zo(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function ts(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);mi(e)}var Jt=new Map,tg=new Set;function Qo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ln=M.d;M.d={f:u1,r:f1,D:d1,C:h1,L:m1,m:p1,X:y1,S:g1,M:v1};function u1(){var e=Ln.f(),t=Uo();return e||t}function f1(e){var t=Zn(e);t!==null&&t.tag===5&&t.type==="form"?vm(t):Ln.r(e)}var Xa=typeof document>"u"?null:document;function ng(e,t,l){var i=Xa;if(i&&typeof t=="string"&&t){var r=bt(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof l=="string"&&(r+='[crossorigin="'+l+'"]'),tg.has(r)||(tg.add(r),e={rel:e,crossOrigin:l,href:t},i.querySelector(r)===null&&(t=i.createElement("link"),dt(t,"link",e),et(t),i.head.appendChild(t)))}}function d1(e){Ln.D(e),ng("dns-prefetch",e,null)}function h1(e,t){Ln.C(e,t),ng("preconnect",e,t)}function m1(e,t,l){Ln.L(e,t,l);var i=Xa;if(i&&e&&t){var r='link[rel="preload"][as="'+bt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(r+='[imagesrcset="'+bt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(r+='[imagesizes="'+bt(l.imageSizes)+'"]')):r+='[href="'+bt(e)+'"]';var h=r;switch(t){case"style":h=Ia(e);break;case"script":h=Ga(e)}Jt.has(h)||(e=g({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Jt.set(h,e),i.querySelector(r)!==null||t==="style"&&i.querySelector(ns(h))||t==="script"&&i.querySelector(ls(h))||(t=i.createElement("link"),dt(t,"link",e),et(t),i.head.appendChild(t)))}}function p1(e,t){Ln.m(e,t);var l=Xa;if(l&&e){var i=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+bt(i)+'"][href="'+bt(e)+'"]',h=r;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ga(e)}if(!Jt.has(h)&&(e=g({rel:"modulepreload",href:e},t),Jt.set(h,e),l.querySelector(r)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ls(h)))return}i=l.createElement("link"),dt(i,"link",e),et(i),l.head.appendChild(i)}}}function g1(e,t,l){Ln.S(e,t,l);var i=Xa;if(i&&e){var r=Kn(i).hoistableStyles,h=Ia(e);t=t||"default";var b=r.get(h);if(!b){var N={loading:0,preload:null};if(b=i.querySelector(ns(h)))N.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Jt.get(h))&&af(e,l);var H=b=i.createElement("link");et(H),dt(H,"link",e),H._p=new Promise(function(K,ne){H.onload=K,H.onerror=ne}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Ko(b,t,i)}b={type:"stylesheet",instance:b,count:1,state:N},r.set(h,b)}}}function y1(e,t){Ln.X(e,t);var l=Xa;if(l&&e){var i=Kn(l).hoistableScripts,r=Ga(e),h=i.get(r);h||(h=l.querySelector(ls(r)),h||(e=g({src:e,async:!0},t),(t=Jt.get(r))&&sf(e,t),h=l.createElement("script"),et(h),dt(h,"link",e),l.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},i.set(r,h))}}function v1(e,t){Ln.M(e,t);var l=Xa;if(l&&e){var i=Kn(l).hoistableScripts,r=Ga(e),h=i.get(r);h||(h=l.querySelector(ls(r)),h||(e=g({src:e,async:!0,type:"module"},t),(t=Jt.get(r))&&sf(e,t),h=l.createElement("script"),et(h),dt(h,"link",e),l.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},i.set(r,h))}}function lg(e,t,l,i){var r=(r=xe.current)?Qo(r):null;if(!r)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=Ia(l.href),l=Kn(r).hoistableStyles,i=l.get(t),i||(i={type:"style",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=Ia(l.href);var h=Kn(r).hoistableStyles,b=h.get(e);if(b||(r=r.ownerDocument||r,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,b),(h=r.querySelector(ns(e)))&&!h._p&&(b.instance=h,b.state.loading=5),Jt.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Jt.set(e,l),h||x1(r,e,l,b.state))),t&&i===null)throw Error(o(528,""));return b}if(t&&i!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ga(l),l=Kn(r).hoistableScripts,i=l.get(t),i||(i={type:"script",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Ia(e){return'href="'+bt(e)+'"'}function ns(e){return'link[rel="stylesheet"]['+e+"]"}function ag(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function x1(e,t,l,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),dt(t,"link",l),et(t),e.head.appendChild(t))}function Ga(e){return'[src="'+bt(e)+'"]'}function ls(e){return"script[async]"+e}function ig(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+bt(l.href)+'"]');if(i)return t.instance=i,et(i),i;var r=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),et(i),dt(i,"style",r),Ko(i,l.precedence,e),t.instance=i;case"stylesheet":r=Ia(l.href);var h=e.querySelector(ns(r));if(h)return t.state.loading|=4,t.instance=h,et(h),h;i=ag(l),(r=Jt.get(r))&&af(i,r),h=(e.ownerDocument||e).createElement("link"),et(h);var b=h;return b._p=new Promise(function(N,H){b.onload=N,b.onerror=H}),dt(h,"link",i),t.state.loading|=4,Ko(h,l.precedence,e),t.instance=h;case"script":return h=Ga(l.src),(r=e.querySelector(ls(h)))?(t.instance=r,et(r),r):(i=l,(r=Jt.get(h))&&(i=g({},l),sf(i,r)),e=e.ownerDocument||e,r=e.createElement("script"),et(r),dt(r,"link",i),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Ko(i,l.precedence,e));return t.instance}function Ko(e,t,l){for(var i=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=i.length?i[i.length-1]:null,h=r,b=0;b<i.length;b++){var N=i[b];if(N.dataset.precedence===t)h=N;else if(h!==r)break}h?h.parentNode.insertBefore(e,h.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function af(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function sf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Jo=null;function sg(e,t,l){if(Jo===null){var i=new Map,r=Jo=new Map;r.set(l,i)}else r=Jo,i=r.get(l),i||(i=new Map,r.set(l,i));if(i.has(e))return i;for(i.set(e,null),l=l.getElementsByTagName(e),r=0;r<l.length;r++){var h=l[r];if(!(h[zl]||h[st]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var b=h.getAttribute(t)||"";b=e+b;var N=i.get(b);N?N.push(h):i.set(b,[h])}}return i}function og(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function b1(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function cg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function S1(e,t,l,i){if(l.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var r=Ia(i.href),h=t.querySelector(ns(r));if(h){t=h._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Fo.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=h,et(h);return}h=t.ownerDocument||t,i=ag(i),(r=Jt.get(r))&&af(i,r),h=h.createElement("link"),et(h);var b=h;b._p=new Promise(function(N,H){b.onload=N,b.onerror=H}),dt(h,"link",i),l.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Fo.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var of=0;function w1(e,t){return e.stylesheets&&e.count===0&&Po(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var i=setTimeout(function(){if(e.stylesheets&&Po(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+t);0<e.imgBytes&&of===0&&(of=62500*n1());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Po(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>of?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(r)}}:null}function Fo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Po(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Wo=null;function Po(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Wo=new Map,t.forEach(N1,e),Wo=null,Fo.call(e))}function N1(e,t){if(!(t.state.loading&4)){var l=Wo.get(e);if(l)var i=l.get(null);else{l=new Map,Wo.set(e,l);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<r.length;h++){var b=r[h];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),i=b)}i&&l.set(null,i)}r=t.instance,b=r.getAttribute("data-precedence"),h=l.get(b)||i,h===i&&l.set(null,r),l.set(b,r),this.count++,i=Fo.bind(this),r.addEventListener("load",i),r.addEventListener("error",i),h?h.parentNode.insertBefore(r,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var as={$$typeof:j,Provider:null,Consumer:null,_currentValue:O,_currentValue2:O,_threadCount:0};function j1(e,t,l,i,r,h,b,N,H){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=fi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fi(0),this.hiddenUpdates=fi(null),this.identifierPrefix=i,this.onUncaughtError=r,this.onCaughtError=h,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function rg(e,t,l,i,r,h,b,N,H,K,ne,ie){return e=new j1(e,t,l,b,H,K,ne,ie,N),t=1,h===!0&&(t|=24),h=At(3,null,null,t),e.current=h,h.stateNode=e,t=Ur(),t.refCount++,e.pooledCache=t,t.refCount++,h.memoizedState={element:i,isDehydrated:l,cache:t},Yr(h),e}function ug(e){return e?(e=Na,e):Na}function fg(e,t,l,i,r,h){r=ug(r),i.context===null?i.context=r:i.pendingContext=r,i=al(t),i.payload={element:l},h=h===void 0?null:h,h!==null&&(i.callback=h),l=il(e,i,t),l!==null&&(_t(l,e,t),ki(l,e,t))}function dg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function cf(e,t){dg(e,t),(e=e.alternate)&&dg(e,t)}function hg(e){if(e.tag===13||e.tag===31){var t=kl(e,67108864);t!==null&&_t(t,e,67108864),cf(e,67108864)}}function mg(e){if(e.tag===13||e.tag===31){var t=kt();t=di(t);var l=kl(e,t);l!==null&&_t(l,e,t),cf(e,t)}}var ec=!0;function E1(e,t,l,i){var r=E.T;E.T=null;var h=M.p;try{M.p=2,rf(e,t,l,i)}finally{M.p=h,E.T=r}}function _1(e,t,l,i){var r=E.T;E.T=null;var h=M.p;try{M.p=8,rf(e,t,l,i)}finally{M.p=h,E.T=r}}function rf(e,t,l,i){if(ec){var r=uf(i);if(r===null)Qu(e,t,i,tc,l),gg(e,i);else if(C1(r,e,t,l,i))i.stopPropagation();else if(gg(e,i),t&4&&-1<q1.indexOf(e)){for(;r!==null;){var h=Zn(r);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var b=Sn(h.pendingLanes);if(b!==0){var N=h;for(N.pendingLanes|=2,N.entangledLanes|=2;b;){var H=1<<31-yt(b);N.entanglements[1]|=H,b&=~H}pn(h),(He&6)===0&&(Ro=Fe()+500,Wi(0))}}break;case 31:case 13:N=kl(h,2),N!==null&&_t(N,h,2),Uo(),cf(h,2)}if(h=uf(i),h===null&&Qu(e,t,i,tc,l),h===r)break;r=h}r!==null&&i.stopPropagation()}else Qu(e,t,i,null,l)}}function uf(e){return e=fr(e),ff(e)}var tc=null;function ff(e){if(tc=null,e=Gn(e),e!==null){var t=u(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=f(t),e!==null)return e;e=null}else if(l===31){if(e=m(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return tc=e,null}function pg(e){switch(e){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Mt()){case Lt:return 2;case $t:return 8;case Vt:case Fc:return 32;case sa:return 268435456;default:return 32}default:return 32}}var df=!1,gl=null,yl=null,vl=null,is=new Map,ss=new Map,xl=[],q1="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".split(" ");function gg(e,t){switch(e){case"focusin":case"focusout":gl=null;break;case"dragenter":case"dragleave":yl=null;break;case"mouseover":case"mouseout":vl=null;break;case"pointerover":case"pointerout":is.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ss.delete(t.pointerId)}}function os(e,t,l,i,r,h){return e===null||e.nativeEvent!==h?(e={blockedOn:t,domEventName:l,eventSystemFlags:i,nativeEvent:h,targetContainers:[r]},t!==null&&(t=Zn(t),t!==null&&hg(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function C1(e,t,l,i,r){switch(t){case"focusin":return gl=os(gl,e,t,l,i,r),!0;case"dragenter":return yl=os(yl,e,t,l,i,r),!0;case"mouseover":return vl=os(vl,e,t,l,i,r),!0;case"pointerover":var h=r.pointerId;return is.set(h,os(is.get(h)||null,e,t,l,i,r)),!0;case"gotpointercapture":return h=r.pointerId,ss.set(h,os(ss.get(h)||null,e,t,l,i,r)),!0}return!1}function yg(e){var t=Gn(e.target);if(t!==null){var l=u(t);if(l!==null){if(t=l.tag,t===13){if(t=f(l),t!==null){e.blockedOn=t,Ys(e.priority,function(){mg(l)});return}}else if(t===31){if(t=m(l),t!==null){e.blockedOn=t,Ys(e.priority,function(){mg(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function nc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=uf(e.nativeEvent);if(l===null){l=e.nativeEvent;var i=new l.constructor(l.type,l);ur=i,l.target.dispatchEvent(i),ur=null}else return t=Zn(l),t!==null&&hg(t),e.blockedOn=l,!1;t.shift()}return!0}function vg(e,t,l){nc(e)&&l.delete(t)}function M1(){df=!1,gl!==null&&nc(gl)&&(gl=null),yl!==null&&nc(yl)&&(yl=null),vl!==null&&nc(vl)&&(vl=null),is.forEach(vg),ss.forEach(vg)}function lc(e,t){e.blockedOn===t&&(e.blockedOn=null,df||(df=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,M1)))}var ac=null;function xg(e){ac!==e&&(ac=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){ac===e&&(ac=null);for(var t=0;t<e.length;t+=3){var l=e[t],i=e[t+1],r=e[t+2];if(typeof i!="function"){if(ff(i||l)===null)continue;break}var h=Zn(l);h!==null&&(e.splice(t,3),t-=3,ru(h,{pending:!0,data:r,method:l.method,action:i},i,r))}}))}function Za(e){function t(H){return lc(H,e)}gl!==null&&lc(gl,e),yl!==null&&lc(yl,e),vl!==null&&lc(vl,e),is.forEach(t),ss.forEach(t);for(var l=0;l<xl.length;l++){var i=xl[l];i.blockedOn===e&&(i.blockedOn=null)}for(;0<xl.length&&(l=xl[0],l.blockedOn===null);)yg(l),l.blockedOn===null&&xl.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(i=0;i<l.length;i+=3){var r=l[i],h=l[i+1],b=r[mt]||null;if(typeof h=="function")b||xg(l);else if(b){var N=null;if(h&&h.hasAttribute("formAction")){if(r=h,b=h[mt]||null)N=b.formAction;else if(ff(r)!==null)continue}else N=b.action;typeof N=="function"?l[i+1]=N:(l.splice(i,3),i-=3),xg(l)}}}function bg(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(b){return r=b})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),i||setTimeout(l,20)}function l(){if(!i&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function hf(e){this._internalRoot=e}ic.prototype.render=hf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,i=kt();fg(l,i,e,t,null,null)},ic.prototype.unmount=hf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;fg(e.current,2,null,e,null,null),Uo(),t[wn]=null}};function ic(e){this._internalRoot=e}ic.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vs();e={blockedOn:null,target:e,priority:t};for(var l=0;l<xl.length&&t!==0&&t<xl[l].priority;l++);xl.splice(l,0,e),l===0&&yg(e)}};var Sg=a.version;if(Sg!=="19.2.7")throw Error(o(527,Sg,"19.2.7"));M.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=y(t),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var T1={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sc.isDisabled&&sc.supportsFiber)try{Ml=sc.inject(T1),gt=sc}catch{}}return cs.createRoot=function(e,t){if(!c(e))throw Error(o(299));var l=!1,i="",r=Cm,h=Mm,b=Tm;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(h=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=rg(e,1,!1,null,null,l,i,null,r,h,b,bg),e[wn]=t.current,Zu(e),new hf(t)},cs.hydrateRoot=function(e,t,l){if(!c(e))throw Error(o(299));var i=!1,r="",h=Cm,b=Mm,N=Tm,H=null;return l!=null&&(l.unstable_strictMode===!0&&(i=!0),l.identifierPrefix!==void 0&&(r=l.identifierPrefix),l.onUncaughtError!==void 0&&(h=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(N=l.onRecoverableError),l.formState!==void 0&&(H=l.formState)),t=rg(e,1,!0,t,l??null,i,r,H,h,b,N,bg),t.context=ug(null),l=t.current,i=kt(),i=di(i),r=al(i),r.callback=null,il(l,r,i),l=i,t.current.lanes=l,Al(t,l),pn(t),e[wn]=t.current,Zu(e),new ic(t)},cs.version="19.2.7",cs}var _g;function bS(){if(_g)return mf.exports;_g=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),mf.exports=xS(),mf.exports}var SS=bS();const iy="wrongstack.hq.token.v1";function sy(){if(typeof window>"u")return null;try{const n=new URLSearchParams(window.location.search).get("token");return n!==null&&n.length>0?n:null}catch{return null}}function oy(){if(typeof window>"u")return null;try{return window.sessionStorage??null}catch{return null}}function cy(){try{const n=oy()?.getItem(iy)??null;return n!==null&&n.length>0?n:null}catch{return null}}function pd(n){try{oy()?.setItem(iy,n)}catch{}}function gd(){const n=sy();return n!==null?(pd(n),n):cy()}function wS(){if(typeof window>"u")return;const n=sy();if(n!==null&&(pd(n),cy()===n))try{const a=new URL(window.location.href);a.searchParams.delete("token"),window.history.replaceState(null,"",`${a.pathname}${a.search}${a.hash}`)}catch{}}function NS(){const n=gd();return n!==null?{Authorization:`Bearer ${n}`}:{}}function Rc(n,a){const s={...a?.headers??{},...NS()};return fetch(n,{...a,headers:s})}const jS=25e3,ES=1e4,_S=3e4;class qS{ws=null;handlers=new Set;stateHandlers=new Set;reconnectAttempt=0;reconnectTimer=null;heartbeatTimer=null;lastMessageAt=0;stopped=!1;_state="disconnected";url;maxRetries;heartbeatIntervalMs;heartbeatTimeoutMs;maxBackoffMs;constructor(a){if(this.maxRetries=a?.maxRetries??1/0,this.heartbeatIntervalMs=a?.heartbeatIntervalMs??jS,this.heartbeatTimeoutMs=a?.heartbeatTimeoutMs??ES,this.maxBackoffMs=a?.maxBackoffMs??_S,a?.url)this.url=a.url;else{const s=typeof window<"u"?window.location:{host:"127.0.0.1:3499",protocol:"http:"},o=s.protocol==="https:"?"wss:":"ws:",c=gd(),u=`${o}//${s.host}/ws/browser`;this.url=c!==null?`${u}?token=${encodeURIComponent(c)}`:u}}get state(){return this._state}get isConnected(){return this.ws?.readyState===WebSocket.OPEN}connect(){if(this.stopped||this.ws!==null)return;this.emitState("connecting");let a;try{a=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws=a,a.onopen=()=>{this.reconnectAttempt=0,this.lastMessageAt=Date.now(),this.emitState("connected"),this.startHeartbeat()},a.onmessage=s=>{this.lastMessageAt=Date.now();try{const o=JSON.parse(typeof s.data=="string"?s.data:"");for(const c of this.handlers)try{c(o)}catch{}}catch{}},a.onclose=()=>this.handleClose("close"),a.onerror=()=>this.handleClose("error")}close(){this.stopped=!0,this.stopHeartbeat(),this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws?.close(1e3,"client closed"),this.ws=null,this.emitState("disconnected")}on(a){return this.handlers.add(a),()=>this.handlers.delete(a)}onStateChange(a){return this.stateHandlers.add(a),a(this._state),()=>this.stateHandlers.delete(a)}handleClose(a){this.ws!==null&&(this.ws=null,this.stopHeartbeat(),this.scheduleReconnect())}scheduleReconnect(){if(this.stopped||this.reconnectTimer!==null)return;if(this.reconnectAttempt>=this.maxRetries){this.emitState("disconnected");return}const s=1e3*2**Math.min(this.reconnectAttempt,4)*(.5+Math.random()*.5),o=Math.min(s,this.maxBackoffMs);this.reconnectAttempt++,this.emitState("reconnecting"),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},o)}get isHeartbeatTimedOut(){return this.ws===null?!0:Date.now()-this.lastMessageAt>this.heartbeatIntervalMs+this.heartbeatTimeoutMs}startHeartbeat(){this.stopHeartbeat(),this.lastMessageAt=Date.now(),this.heartbeatTimer=setInterval(()=>{this.isHeartbeatTimedOut&&this.ws!==null&&(this.ws.close(4e3,"heartbeat timeout"),this.ws=null,this.scheduleReconnect())},this.heartbeatIntervalMs)}stopHeartbeat(){this.heartbeatTimer!==null&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}emitState(a){this._state=a;for(const s of this.stateHandlers)try{s(a)}catch{}}}let oc=null;function ry(){return oc===null&&(oc=new qS,oc.connect()),oc}let ni={snapshot:null,events:[],alerts:[],activeView:"cockpit",selectedSessionId:null,selectedAgentId:null,selectedClientId:null,connected:!1,authRequired:!1};const Vf=new Set,Yf=new Map;function CS(n){for(const a of Vf){const s=Yf.get(a);(s==null||s.some(o=>n.includes(o)))&&a()}}function MS(n,a){return Vf.add(n),Yf.set(n,a??null),()=>{Vf.delete(n),Yf.delete(n)}}function qg(){return ni}function _l(n){ni={...ni,...n},CS(Object.keys(n))}let Cg=!1;function TS(){if(Cg)return;Cg=!0,ry().on(a=>{a.type==="hq.snapshot"?_l({snapshot:a.snapshot,connected:!0}):a.type==="hq.event"?_l({events:[...ni.events,a.event].slice(-500)}):a.type==="hq.alert"&&_l({alerts:[...ni.alerts,a].slice(-100)})})}function cn(n){return z.useEffect(()=>{TS()},[]),z.useSyncExternalStore(a=>MS(a,n),qg,qg)}function Pa(n){_l({activeView:n})}function yd(n,a=null){_l({selectedSessionId:n,selectedAgentId:a})}function uy(n,a){_l({selectedSessionId:n,selectedAgentId:a})}function AS(n){_l({selectedClientId:n})}function vd(){ni.authRequired||_l({authRequired:!0})}async function Cl(n){let a;try{a=await Rc(n)}catch{throw new Error(`Network error fetching ${n}`)}if(a.status===401)throw vd(),new Error(`401 Unauthorized fetching ${n} — browser token required`);if(!a.ok)throw new Error(`${a.status} ${a.statusText}`);try{return await a.json()}catch{throw new Error(`Invalid JSON response from ${n}: ${a.status}`)}}async function zS(n){let a;try{a=await Rc("/api/mailbox-send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch{throw new Error("Network error sending mailbox message")}if(a.status===401)throw vd(),new Error("401 Unauthorized — browser token required");if(!a.ok){const s=await a.json().catch(()=>null),o=typeof s?.error=="string"?s.error:a.statusText||`HTTP ${a.status}`;throw new Error(o)}try{return await a.json()}catch{throw new Error("Invalid JSON response from mailbox-send API")}}async function fy(n,a,s){let o;try{o=await Rc("/api/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:n,type:a,payload:s})})}catch{throw new Error("Network error sending command")}if(o.status===401)throw vd(),new Error("401 Unauthorized — browser token required");if(!o.ok){const u=(await o.json().catch(()=>null))?.error??(o.statusText||`HTTP ${o.status}`);throw new Error(u)}try{return await o.json()}catch{throw new Error("Invalid JSON response from command API")}}function DS(){const n=cn(["alerts","snapshot"]),[a,s]=z.useState([]),[o,c]=z.useState([]);z.useEffect(()=>{let f=!1;const m=()=>{Cl("/api/alerts").then(y=>{f||(s(y.active),c(y.history))}).catch(()=>{})};m();const p=setInterval(m,15e3);return()=>{f=!0,clearInterval(p)}},[]);const u=n.alerts.slice(-50).reverse();return d.jsxs("div",{children:[a.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"hq-card-title",children:["Active Alerts (",a.length,")"]}),a.map(f=>d.jsxs("div",{className:"hq-card",style:{borderColor:"var(--red)"},children:[d.jsxs("div",{className:"hq-row",children:[d.jsx("span",{className:"hq-pill "+f.severity,children:f.severity}),d.jsx("span",{style:{fontWeight:700},children:f.ruleId}),d.jsxs("span",{className:"hq-mono",style:{marginLeft:"auto",color:"var(--dim)"},children:["since ",new Date(f.firstFiredAt).toLocaleTimeString()]})]}),d.jsx("div",{style:{marginTop:4},children:f.message})]},f.id))]}),d.jsxs("div",{className:"hq-card-title",children:["Live Alert Feed (last ",u.length,")"]}),u.length===0?d.jsx("div",{className:"hq-empty",children:"No live alerts. Alerts fire when fleet rules trigger (cost, stale, failures)."}):u.map((f,m)=>d.jsxs("div",{className:"hq-card",children:[d.jsxs("div",{className:"hq-row",children:[d.jsx("span",{className:"hq-pill "+f.severity,children:f.severity}),d.jsx("span",{className:"hq-mono",style:{marginLeft:"auto",color:"var(--dim)"},children:new Date(f.timestamp).toLocaleTimeString()})]}),d.jsx("div",{style:{marginTop:4},children:f.message})]},m)),d.jsxs("div",{className:"hq-card-title",children:["Alert History (",o.length,")"]}),d.jsx("div",{className:"hq-card",children:o.length===0?d.jsx("div",{className:"hq-empty",children:"No historical alerts."}):o.slice(-30).reverse().map((f,m)=>d.jsxs("div",{className:"hq-row",children:[d.jsx("span",{className:"hq-pill "+f.severity,children:f.severity}),d.jsx("span",{className:"hq-mono",children:f.ruleId}),d.jsx("span",{style:{color:"var(--muted)"},children:f.message}),d.jsx("span",{className:"hq-mono",style:{marginLeft:"auto",color:"var(--dim)"},children:new Date(f.lastFiredAt).toLocaleTimeString()})]},m))})]})}function xd(n,a=200){const s=cn(["events"]),[o,c]=z.useState([]),[u,f]=z.useState(!0);return z.useEffect(()=>{let p=!1;return Cl(`/api/events?type=${encodeURIComponent(n)}&limit=${a}`).then(y=>{p||(c([...y.events??[]].reverse()),f(!1))}).catch(()=>{p||f(!1)}),()=>{p=!0}},[n,a]),{events:z.useMemo(()=>{const p=new Set,y=[];for(const x of o)x.type!==n||p.has(x.id)||(p.add(x.id),y.push(x));for(const x of s.events)x.type!==n||p.has(x.id)||(p.add(x.id),y.push(x));return y},[o,s.events,n]),loading:u}}const OS={decision_requested:{label:"Requested",Icon:B1,cls:"info"},decision_answered:{label:"Answered",Icon:J0,cls:"active"},decision_ask_human:{label:"Ask Human",Icon:R1,cls:"warn"},decision_denied:{label:"Denied",Icon:k1,cls:"error"},human_answered:{label:"Human",Icon:H1,cls:"info"},intervention:{label:"Intervention",Icon:K0,cls:"warn"}};function HS(){const{events:n,loading:a}=xd("brain.event",200),s=n.slice(-200).reverse();return s.length===0?d.jsx("div",{className:"hq-empty",children:a?"Loading brain history…":"No brain decisions yet. Brain events appear when autonomous consumers (Director, AutoPhase, Eternal) route decisions through the Brain."}):d.jsxs("div",{children:[d.jsxs("div",{className:"hq-card-title",children:["Brain Decisions (last ",s.length,")"]}),s.map(o=>{const c=o.payload,u=OS[c.kind]??{label:c.kind,Icon:ud,cls:"info"};return d.jsxs("div",{className:"hq-card",children:[d.jsxs("div",{className:"hq-row",children:[d.jsx(u.Icon,{size:15,className:`hq-kind-icon ${u.cls}`}),d.jsx("span",{style:{fontWeight:700},children:u.label}),c.source!==void 0&&d.jsx("span",{className:"hq-pill info",children:c.source}),c.risk!==void 0&&d.jsxs("span",{className:`hq-pill ${c.risk==="high"||c.risk==="critical"?"error":"warn"}`,children:[c.risk," risk"]}),d.jsx("span",{className:"hq-mono hq-row-time",children:new Date(c.at).toLocaleTimeString()})]}),c.question!==void 0&&d.jsx("div",{className:"hq-mono hq-row-detail",children:c.question}),c.decision!==void 0&&d.jsx("div",{className:"hq-row",style:{marginTop:4},children:d.jsxs("span",{className:"hq-pill active",children:["→ ",c.decision]})}),c.detail!==void 0&&d.jsx("div",{className:"hq-mono hq-row-subtle",children:c.detail}),c.kind==="intervention"&&d.jsxs("div",{className:"hq-row",style:{marginTop:4},children:[d.jsx("span",{className:"hq-pill warn",children:c.interventionKind}),d.jsx("span",{className:"hq-pill",children:c.intervened?"steered":"observed"})]})]},o.id)})]})}function kS(){const n=cn(["snapshot","alerts"]),a=n.snapshot,s=a?.totals,o=a?.machines??[],c=a?.projects??[],u=a?.clients??[],f=a?.liveSessions??[],m=u.filter(V=>V.capabilities.includes("control.receive")),p=n.selectedClientId??m[0]?.clientId??null,y=m.find(V=>V.clientId===p)??m[0]??null,[x,g]=z.useState([]),[v,S]=z.useState([]),[w,q]=z.useState(null),[C,_]=z.useState(null),[k,j]=z.useState(null),[A,$]=z.useState(null);z.useEffect(()=>{let V=!1;const T=()=>{Cl("/api/alerts").then(E=>{V||(g(E.active),S(E.history),q(null))}).catch(E=>{V||q(E instanceof Error?E.message:String(E))})};T();const B=setInterval(T,15e3);return()=>{V=!0,clearInterval(B)}},[]);const D=z.useMemo(()=>{const V=n.alerts.slice(-30).reverse().map(O=>({severity:typeof O.severity=="string"?O.severity:"info",ruleId:"live",message:"Live alert envelope received.",timestamp:typeof O.timestamp=="string"?O.timestamp:new Date().toISOString()})),T=[...x,...v].slice(-30).reverse().map(O=>({severity:typeof O.severity=="string"?O.severity:"info",ruleId:typeof O.ruleId=="string"?O.ruleId:"alert",message:typeof O.message=="string"?O.message:"",timestamp:typeof O.lastFiredAt=="string"?O.lastFiredAt:typeof O.firstFiredAt=="string"?O.firstFiredAt:new Date().toISOString()})),B=[...V,...T],E=new Set,M=[];for(const O of B){const R=`${O.ruleId}|${O.message}|${O.timestamp}`;if(!E.has(R)&&(E.add(R),M.push(O),M.length>=12))break}return M},[n.alerts,x,v]),L=z.useMemo(()=>{let V=0,T=0,B=0,E=0,M=0;for(const O of f){O.status==="active"&&(M+=1);for(const R of O.agents??[])V+=1,R.status==="running"||R.status==="streaming"?T+=1:R.status==="waiting_user"?B+=1:R.status==="error"&&(E+=1)}return{total:V,busy:T,waiting:B,errored:E,activeSessions:M}},[f]),Y=z.useMemo(()=>[...c].sort((V,T)=>T.totalCostUsd-V.totalCostUsd).slice(0,4),[c]);async function G(V){if(y!==null){_(V),j(null),$(null);try{const T=V==="pause-noisy"?{subject:"HQ quick action: pause noisy agents",body:"HQ operator requests: pause non-critical/noisy agent work, reduce chatter, and keep only essential status updates until resumed.",priority:"high"}:{subject:"HQ quick action: status request",body:"HQ operator requests a concise status broadcast from active agents: current task, blocker if any, and next expected action.",priority:"normal"},B=await fy(y.clientId,"broadcast",T);j(`queued ${B.commandId}`)}catch(T){$(T instanceof Error?T.message:String(T))}finally{_(null)}}}const te=[{title:"Fleet",view:"fleet",cta:"open fleet",body:d.jsxs("div",{className:"hq-cockpit-grid",children:[d.jsx(Sl,{label:"machines",value:o.length}),d.jsx(Sl,{label:"clients",value:u.length}),d.jsx(Sl,{label:"sessions",value:L.activeSessions,accent:L.activeSessions>0?"green":void 0}),d.jsx(Sl,{label:"agents",value:L.total}),d.jsx(Sl,{label:"busy",value:L.busy,accent:L.busy>0?"green":void 0}),d.jsx(Sl,{label:"waiting",value:L.waiting,accent:L.waiting>0?"warn":void 0}),d.jsx(Sl,{label:"errored",value:L.errored,accent:L.errored>0?"error":void 0}),d.jsx(Sl,{label:"cost $",value:(s?.totalCostUsd??0).toFixed(2),accent:"green"})]})}],I={title:"Alerts",view:"alerts",cta:"open alerts",body:D.length===0?d.jsx("div",{className:"hq-empty",style:{padding:14,fontSize:12},children:"No alerts in the last few minutes."}):d.jsx("div",{className:"hq-cockpit-alert-list",children:D.map((V,T)=>d.jsxs("div",{className:"hq-cockpit-alert-row",children:[d.jsx("span",{className:"hq-pill "+US(V.severity),children:V.severity}),d.jsx("span",{className:"hq-mono",children:V.ruleId}),d.jsx("span",{className:"hq-cockpit-alert-msg",children:V.message}),d.jsx("span",{className:"hq-mono",style:{color:"var(--dim)",marginLeft:"auto"},children:BS(V.timestamp)})]},`${V.ruleId}-${V.timestamp}-${T}`))})},F={title:"Cost",view:"cost",cta:"open cost",body:Y.length===0?d.jsx("div",{className:"hq-empty",style:{padding:14,fontSize:12},children:"No cost data yet — connect some clients."}):d.jsx("div",{className:"hq-cockpit-cost-list",children:Y.map(V=>{const T=(s?.totalCostUsd??0)>0?V.totalCostUsd/s.totalCostUsd*100:0;return d.jsxs("div",{className:"hq-cockpit-cost-row",children:[d.jsxs("div",{className:"hq-cockpit-cost-line",children:[d.jsx("span",{className:"hq-cockpit-cost-name",children:V.projectName}),d.jsx("span",{className:"hq-mono",style:{color:"var(--dim)"},children:V.projectId}),d.jsxs("span",{className:"hq-mono",style:{color:"var(--green)",marginLeft:"auto"},children:["$",V.totalCostUsd.toFixed(4)]}),d.jsxs("span",{className:"hq-mono",style:{color:"var(--dim)"},children:[T.toFixed(1),"%"]})]}),d.jsx("div",{className:"hq-cockpit-cost-bar","aria-label":`${T.toFixed(1)}% of fleet cost`,children:d.jsx("span",{style:{width:`${Math.max(2,T)}%`}})}),d.jsxs("div",{className:"hq-cockpit-cost-meta",children:[d.jsxs("span",{children:[V.activeSessions," sessions"]}),d.jsxs("span",{children:[V.activeSubagents," subagents"]}),d.jsxs("span",{children:[V.activeClients," clients"]})]})]},V.projectId)})})};return d.jsxs("div",{children:[d.jsx("div",{className:"hq-card-title",children:"Cockpit"}),d.jsxs("div",{className:"hq-card hq-cockpit-summary",children:[d.jsxs("div",{className:"hq-row",children:[d.jsx("span",{className:"hq-pill info",children:n.connected?"connected":"reconnecting"}),d.jsxs("span",{className:"hq-pill",children:[s?.activeMachines??0," machines"]}),d.jsxs("span",{className:"hq-pill",children:[s?.activeSessions??0," sessions"]}),d.jsxs("span",{className:"hq-pill",children:[s?.activeAgents??0," agents"]}),d.jsxs("span",{className:"hq-pill green",children:["$",(s?.totalCostUsd??0).toFixed(2)]}),x.length>0&&d.jsxs("span",{className:"hq-pill error",children:[x.length," active alerts"]}),w!==null&&d.jsx("span",{className:"hq-pill error",children:w}),d.jsx("button",{type:"button",className:"hq-btn secondary",style:{marginLeft:"auto"},onClick:()=>Pa("fleet"),children:"Open Fleet"})]}),d.jsxs("div",{className:"hq-cockpit-actions","aria-label":"Cockpit quick actions",children:[d.jsxs("div",{className:"hq-cockpit-actions-copy",children:[d.jsx("span",{className:"hq-card-title",style:{margin:0},children:"Quick Actions"}),d.jsx("span",{className:"hq-mono",children:y===null?"no controllable client connected":`target ${RS(y.clientId)}`})]}),d.jsxs("div",{className:"hq-cockpit-actions-buttons",children:[d.jsx("button",{type:"button",className:"hq-btn secondary",disabled:y===null||C!==null,onClick:()=>{G("pause-noisy")},children:C==="pause-noisy"?"Queuing…":"Pause noisy agents"}),d.jsx("button",{type:"button",className:"hq-btn secondary",disabled:y===null||C!==null,onClick:()=>{G("status-request")},children:C==="status-request"?"Queuing…":"Broadcast status request"}),d.jsx("button",{type:"button",className:"hq-btn secondary",onClick:()=>Pa("control"),children:"Open Control"})]}),k!==null&&d.jsx("span",{className:"hq-pill info",children:k}),A!==null&&d.jsx("span",{className:"hq-pill error",children:A})]})]}),[...te,I,F].map(V=>d.jsxs("div",{className:"hq-card hq-cockpit-section",children:[d.jsxs("div",{className:"hq-row",children:[d.jsx("span",{className:"hq-card-title",style:{margin:0},children:V.title}),d.jsx("button",{type:"button",className:"hq-btn secondary",style:{marginLeft:"auto"},onClick:()=>Pa(V.view),children:V.cta})]}),V.body]},V.title))]})}function Sl({label:n,value:a,accent:s}){return d.jsxs("div",{className:"hq-stat"+(s?` ${s}`:""),children:[d.jsx("span",{className:"hq-stat-num",children:a}),d.jsx("span",{className:"hq-stat-label",children:n})]})}function RS(n){return n.length<=18?n:`${n.slice(0,9)}…${n.slice(-6)}`}function BS(n){const a=new Date(n);return Number.isNaN(a.getTime())?n:a.toLocaleTimeString()}function US(n){return n==="critical"||n==="error"||n==="high"?"error":n==="warn"||n==="warning"||n==="medium"?"warn":n==="info"||n==="low"?"info":"idle"}const dy="wrongstack.hq.local-prefs.v1",qt={control:{cmdType:"steer",abortTarget:"leader",spawnRole:"bug-hunter",spawnTask:"",steerTo:"leader",steerSubject:"",steerBody:"",broadcastSubject:"",broadcastBody:""},mailbox:{query:"",types:[],priorities:[],includeCompleted:!0}};let Wl=null;const Xf=new Set;function hy(){for(const n of Xf)n()}function xc(n){return typeof structuredClone=="function"?structuredClone(n):JSON.parse(JSON.stringify(n))}function yf(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function LS(){if(typeof window>"u"||typeof window.localStorage>"u")return xc(qt);try{const n=window.localStorage.getItem(dy);if(n===null)return xc(qt);const a=JSON.parse(n);return $S(a)}catch{return xc(qt)}}function $S(n){if(!yf(n))return xc(qt);const a=yf(n.control)?n.control:{},s=yf(n.mailbox)?n.mailbox:{};return{control:{cmdType:a.cmdType==="btw"||a.cmdType==="queue"||a.cmdType==="abort"||a.cmdType==="spawn"||a.cmdType==="broadcast"||a.cmdType==="run-command"?a.cmdType:qt.control.cmdType,abortTarget:a.abortTarget==="fleet"?"fleet":"leader",spawnRole:typeof a.spawnRole=="string"&&a.spawnRole.length>0?a.spawnRole:qt.control.spawnRole,spawnTask:typeof a.spawnTask=="string"?a.spawnTask:qt.control.spawnTask,steerTo:typeof a.steerTo=="string"?a.steerTo:qt.control.steerTo,steerSubject:typeof a.steerSubject=="string"?a.steerSubject:qt.control.steerSubject,steerBody:typeof a.steerBody=="string"?a.steerBody:qt.control.steerBody,broadcastSubject:typeof a.broadcastSubject=="string"?a.broadcastSubject:qt.control.broadcastSubject,broadcastBody:typeof a.broadcastBody=="string"?a.broadcastBody:qt.control.broadcastBody},mailbox:{query:typeof s.query=="string"?s.query:qt.mailbox.query,types:Array.isArray(s.types)?s.types.filter(c=>typeof c=="string"):[],priorities:Array.isArray(s.priorities)?s.priorities.filter(c=>typeof c=="string"):[],includeCompleted:typeof s.includeCompleted=="boolean"?s.includeCompleted:!0}}}function bd(){return Wl===null&&(Wl=LS()),Wl}function my(n){if(!(typeof window>"u"||typeof window.localStorage>"u"))try{window.localStorage.setItem(dy,JSON.stringify(n))}catch{}}function VS(n){return Xf.add(n),()=>Xf.delete(n)}function YS(){return bd()}function XS(){return qt}function py(){return z.useSyncExternalStore(VS,YS,XS)}function $n(n){const a=bd();Wl={...a,control:{...a.control,...n}},my(Wl),hy()}function IS(n){const a=bd();Wl={...a,mailbox:{...a.mailbox,...n}},my(Wl),hy()}const cc={steer:{label:"steer",icon:d.jsx(K0,{size:13}),desc:"High-priority course correction — interrupts the agent at the next turn."},btw:{label:"btw",icon:d.jsx(W0,{size:13}),desc:"Non-urgent FYI — rides alongside the run without interrupting it."},queue:{label:"queue",icon:d.jsx($1,{size:13}),desc:"Queue a prompt — picked up after the current run finishes."},abort:{label:"abort",icon:d.jsx(L1,{size:13}),desc:"Stop the leader run or every subagent on the client. Destructive.",danger:!0},spawn:{label:"spawn",icon:d.jsx(ui,{size:13}),desc:"Launch a role subagent (bug-hunter, critic, …) with an optional task."},broadcast:{label:"broadcast",icon:d.jsx(U1,{size:13}),desc:"Mailbox message to every agent in the client’s project."},"run-command":{label:"run-command",icon:d.jsx(As,{size:13}),desc:"Route a shell command to the client. RCE-gated (--hq-allow-exec + control.execute).",danger:!0}};function GS(){const n=cn(["snapshot","selectedClientId"]),a=(n.snapshot?.clients??[]).filter(se=>se.capabilities.includes("control.receive")),s=n.selectedClientId??a[0]?.clientId??null,o=a.find(se=>se.clientId===s)??a[0]??null,u=py().control,[f,m]=z.useState(u.cmdType),[p,y]=z.useState("compose"),[x,g]=z.useState(u.steerTo),[v,S]=z.useState(u.steerSubject),[w,q]=z.useState(u.steerBody),[C,_]=z.useState(u.spawnRole),[k,j]=z.useState(u.spawnTask),[A,$]=z.useState(u.abortTarget),[D,L]=z.useState(u.broadcastSubject),[Y,G]=z.useState(u.broadcastBody),[te,I]=z.useState(""),[F,V]=z.useState(""),[T,B]=z.useState(""),[E,M]=z.useState(null),[O,R]=z.useState(null),[Z,ee]=z.useState(!1),[P,oe]=z.useState([]),[ce,ue]=z.useState(!1),[xe,de]=z.useState(null),[le,re]=z.useState(null),pe=z.useMemo(()=>ht(),[f,x,v,w,C,k,A,D,Y,te,F]),Se=pe.risk==="danger",he=f==="run-command"?"RUN":"ABORT",ge=s!==null&&pe.disabledReason===null&&(!Se||T===he),we=pe.disabledReason===null&&s!==null;function Ee(){y("compose"),B(""),R(null),M(null)}function Be(se){m(se),$n({cmdType:se}),Ee()}async function Je(){ue(!0),de(null);try{const se=await Cl("/api/commands?limit=25");oe(se.commands.slice().reverse())}catch(se){de(se instanceof Error?se.message:String(se))}finally{ue(!1)}}z.useEffect(()=>{Je();const se=setInterval(()=>{document.hidden||Je()},5e3);return()=>clearInterval(se)},[]);async function pt(){if(!(s===null||!ge)){ee(!0),R(null),M(null);try{const se=await fy(s,pe.type,pe.payload);M(`queued ${pe.type} command ${se.commandId}`),re(se.commandId),y("compose"),B(""),Je()}catch(se){R(se instanceof Error?se.message:String(se))}finally{ee(!1)}}}z.useEffect(()=>{const se=Oe=>{Oe.key!=="Enter"||!(Oe.ctrlKey||Oe.metaKey)||(Oe.preventDefault(),p==="compose"&&we?(y("preview"),M(null),R(null)):p==="preview"&&ge&&!Z&&pt())};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)});function ht(){if(f==="steer"||f==="btw"||f==="queue"){const Oe=w.trim(),xn=f==="steer"?"Send high-priority steer to":f==="btw"?"Post a non-urgent FYI (btw) to":"Queue a prompt for";return{type:f,payload:{to:x||"leader",subject:v||`HQ ${f}`,body:w,priority:f==="steer"?"high":"normal"},disabledReason:Oe.length===0?"Message body is required.":null,risk:"normal",summary:`${xn} ${x||"leader"}.`}}if(f==="run-command"){const Oe=te.trim();return{type:"run-command",payload:{command:te,...F.trim()?{cwd:F.trim()}:{}},disabledReason:Oe.length===0?"Command is required.":null,risk:"danger",summary:"Route a shell command to the client (requires --hq-allow-exec + control.execute; delivered as a steer, the agent’s permission policy still applies)."}}if(f==="abort")return{type:"abort",payload:{target:A},disabledReason:null,risk:"danger",summary:A==="fleet"?"Abort all subagents on the selected client.":"Abort the selected target on the selected client."};if(f==="spawn"){const Oe=k.trim();return{type:"spawn",payload:{role:C,...Oe?{task:Oe}:{}},disabledReason:C.trim().length===0?"Role is required.":null,risk:"normal",summary:`Spawn a ${C} subagent${Oe?" with an initial task":""}.`}}const se=Y.trim();return{type:"broadcast",payload:{subject:D||"HQ broadcast",body:Y,priority:"normal"},disabledReason:se.length===0?"Broadcast body is required.":null,risk:"normal",summary:"Broadcast a normal-priority mailbox message to the selected client project."}}return a.length===0?d.jsxs("div",{className:"hq-empty",children:["No controllable clients connected. Clients must advertise the ",d.jsx("code",{children:"control.receive"})," ","capability (CLI/TUI/WebUI surfaces do this automatically when connected to HQ)."]}):d.jsxs("div",{className:"hq-control-grid",children:[d.jsxs("div",{className:"hq-control-composer",children:[d.jsx("div",{className:"hq-card-title",children:"Command Target"}),d.jsxs("div",{className:"hq-card hq-control-target",children:[d.jsx("label",{className:"hq-label",children:"Client"}),d.jsx("select",{className:"hq-select",value:s??"",onChange:se=>{AS(se.target.value),Ee()},children:a.map(se=>d.jsxs("option",{value:se.clientId,children:[se.kind," — ",se.hostname??se.clientId," (",se.projectId,")"]},se.clientId))}),o!==null&&d.jsxs("div",{className:"hq-control-meta",children:[d.jsxs("span",{children:[d.jsx("strong",{children:"kind"})," ",o.kind]}),d.jsxs("span",{children:[d.jsx("strong",{children:"host"})," ",o.hostname??"unknown"]}),d.jsxs("span",{children:[d.jsx("strong",{children:"project"})," ",o.projectId]}),d.jsxs("span",{children:[d.jsx("strong",{children:"client"})," ",vf(o.clientId)]})]})]}),d.jsx("div",{className:"hq-card-title",children:"Command Type"}),d.jsxs("div",{className:"hq-control-steps","aria-label":"Control command stages",children:[d.jsx("span",{className:"hq-step active",children:"1 compose"}),d.jsx("span",{className:"hq-step"+(p==="preview"?" active":""),children:"2 preview"}),d.jsx("span",{className:"hq-step"+(E!==null?" active":""),children:"3 queued"})]}),d.jsx("div",{className:"hq-control-types",children:Object.keys(cc).map(se=>{const Oe=cc[se];return d.jsxs("button",{type:"button",title:Oe.desc,className:"hq-control-type"+(f===se?" selected":"")+(Oe.danger===!0?" danger":""),onClick:()=>Be(se),children:[Oe.icon,Oe.label]},se)})}),d.jsxs("div",{className:"hq-control-typedesc",children:[cc[f].danger===!0&&d.jsx(F0,{size:12}),cc[f].desc]}),d.jsxs("div",{style:{marginTop:12},children:[(f==="steer"||f==="btw"||f==="queue")&&d.jsxs("div",{className:"hq-card",children:[d.jsxs("label",{className:"hq-label",children:["To (agent address — e.g. ",d.jsx("code",{children:"leader"}),", ",d.jsx("code",{children:"leader@sessionTag"}),", or a subagent id)"]}),d.jsx("input",{className:"hq-input",value:x,onChange:se=>{g(se.target.value),$n({steerTo:se.target.value})},placeholder:"leader"}),d.jsx("label",{className:"hq-label",style:{marginTop:8},children:"Subject"}),d.jsx("input",{className:"hq-input",value:v,onChange:se=>{S(se.target.value),$n({steerSubject:se.target.value})}}),d.jsx("label",{className:"hq-label",style:{marginTop:8},children:"Body"}),d.jsx("textarea",{className:"hq-textarea",value:w,onChange:se=>{q(se.target.value),$n({steerBody:se.target.value})}})]}),f==="abort"&&d.jsxs("div",{className:"hq-card hq-card-danger",children:[d.jsx("label",{className:"hq-label",children:"Target"}),d.jsxs("select",{className:"hq-select",value:A,onChange:se=>{$(se.target.value),$n({abortTarget:se.target.value})},children:[d.jsx("option",{value:"leader",children:"leader (session leader)"}),d.jsx("option",{value:"fleet",children:"fleet (all subagents)"})]}),d.jsxs("div",{className:"hq-control-warning",children:["Abort is destructive. Preview requires typing ",d.jsx("strong",{children:"ABORT"})," before dispatch."]})]}),f==="spawn"&&d.jsxs("div",{className:"hq-card",children:[d.jsx("label",{className:"hq-label",children:"Role"}),d.jsxs("select",{className:"hq-select",value:C,onChange:se=>{_(se.target.value),$n({spawnRole:se.target.value})},children:[d.jsx("option",{value:"bug-hunter",children:"bug-hunter"}),d.jsx("option",{value:"refactor-planner",children:"refactor-planner"}),d.jsx("option",{value:"critic",children:"critic"}),d.jsx("option",{value:"security-scanner",children:"security-scanner"}),d.jsx("option",{value:"code-reviewer",children:"code-reviewer"})]}),d.jsx("label",{className:"hq-label",style:{marginTop:8},children:"Task (optional)"}),d.jsx("textarea",{className:"hq-textarea",value:k,onChange:se=>{j(se.target.value),$n({spawnTask:se.target.value})},placeholder:"Describe the task…"})]}),f==="run-command"&&d.jsxs("div",{className:"hq-card hq-card-danger",children:[d.jsx("label",{className:"hq-label",children:"Shell command"}),d.jsx("textarea",{className:"hq-textarea",value:te,onChange:se=>I(se.target.value),placeholder:"pnpm test"}),d.jsx("label",{className:"hq-label",style:{marginTop:8},children:"Working directory (optional — defaults to the agent's project root)"}),d.jsx("input",{className:"hq-input",value:F,onChange:se=>V(se.target.value),placeholder:""}),d.jsxs("div",{className:"hq-control-warning",children:["RCE-gated: the client must run with ",d.jsx("code",{children:"--hq-allow-exec"})," and your token needs the ",d.jsx("code",{children:"control.execute"})," capability — otherwise the server rejects this. Preview requires typing ",d.jsx("strong",{children:"RUN"})," before dispatch."]})]}),f==="broadcast"&&d.jsxs("div",{className:"hq-card",children:[d.jsx("label",{className:"hq-label",children:"Subject"}),d.jsx("input",{className:"hq-input",value:D,onChange:se=>{L(se.target.value),$n({broadcastSubject:se.target.value})}}),d.jsx("label",{className:"hq-label",style:{marginTop:8},children:"Body"}),d.jsx("textarea",{className:"hq-textarea",value:Y,onChange:se=>{G(se.target.value),$n({broadcastBody:se.target.value})}})]})]}),d.jsx("div",{className:"hq-card-title",children:"Dispatch Gate"}),d.jsxs("div",{className:"hq-card hq-command-preview"+(pe.risk==="danger"?" hq-card-danger":""),children:[d.jsxs("div",{className:"hq-row",children:[d.jsx("span",{className:"hq-pill "+(pe.risk==="danger"?"error":"info"),children:pe.risk}),d.jsx("span",{children:pe.summary}),pe.disabledReason!==null&&d.jsx("span",{className:"hq-pill warn",children:pe.disabledReason})]}),p==="preview"?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"hq-msg-sublabel",children:"payload preview"}),d.jsx("pre",{className:"hq-msg-pre",children:JSON.stringify({clientId:s,type:pe.type,payload:pe.payload},null,2)}),Se&&d.jsxs(d.Fragment,{children:[d.jsx("label",{className:"hq-label",style:{marginTop:12},children:"Confirm destructive dispatch"}),d.jsx("input",{className:"hq-input",value:T,onChange:se=>B(se.target.value),placeholder:`Type ${he}`})]}),d.jsxs("div",{className:"hq-row",style:{marginTop:12},children:[d.jsx("button",{className:"hq-btn",disabled:Z||!ge,onClick:()=>{pt()},title:"Ctrl+Enter",children:Z?"Dispatching…":"Dispatch Command"}),d.jsx("button",{className:"hq-btn secondary",disabled:Z,onClick:Ee,children:"Back to Compose"})]})]}):d.jsx("button",{className:"hq-btn",disabled:!we,onClick:()=>{y("preview"),M(null),R(null)},title:"Ctrl+Enter",children:"Preview Command"})]}),E&&d.jsx("div",{className:"hq-pill active",style:{marginTop:12},children:E}),O&&d.jsx("div",{className:"hq-pill error",style:{marginTop:12},children:O})]}),d.jsxs("div",{className:"hq-control-audit",children:[d.jsx("div",{className:"hq-card-title",children:"Command Audit"}),d.jsxs("div",{className:"hq-card hq-command-audit",children:[d.jsxs("div",{className:"hq-row",children:[d.jsxs("span",{className:"hq-pill info",children:["recent ",P.length]}),ce&&d.jsx("span",{className:"hq-pill idle",children:"refreshing"}),xe!==null&&d.jsx("span",{className:"hq-pill error",children:xe}),d.jsx("button",{className:"hq-btn secondary",style:{marginLeft:"auto"},onClick:()=>{Je()},children:"Refresh"})]}),P.length===0?d.jsx("div",{className:"hq-empty",style:{padding:16,fontSize:12},children:"No command audit entries yet."}):d.jsx("div",{className:"hq-audit-list",children:P.map(se=>d.jsxs("div",{className:"hq-audit-row"+(se.commandId===le?" just-dispatched":"")+(s!==null&&se.clientId===s?"":" other-client"),children:[d.jsxs("div",{className:"hq-audit-main",children:[d.jsx("span",{className:"hq-pill "+ZS(se),children:se.status}),d.jsx("span",{className:"hq-pill info",children:se.type}),d.jsx("span",{className:"hq-mono",children:vf(se.commandId)}),se.ackStatus!==void 0&&d.jsxs("span",{className:"hq-pill "+QS(se.ackStatus),children:["ack ",se.ackStatus]})]}),d.jsxs("div",{className:"hq-audit-meta",children:[d.jsxs("span",{children:[d.jsx("strong",{children:"client"})," ",vf(se.clientId)]}),d.jsxs("span",{children:[d.jsx("strong",{children:"by"})," ",se.enqueuedBy]}),d.jsxs("span",{children:[d.jsx("strong",{children:"queued"})," ",Mg(se.enqueuedAt)]}),se.ackedAt!==void 0&&d.jsxs("span",{children:[d.jsx("strong",{children:"acked"})," ",Mg(se.ackedAt)]})]}),se.ackMessage!==void 0&&se.ackMessage.length>0&&d.jsx("div",{className:"hq-audit-message",children:se.ackMessage})]},se.commandId))})]})]})]})}function vf(n){return n.length>18?`${n.slice(0,10)}…${n.slice(-6)}`:n}function Mg(n,a=Date.now()){const s=new Date(n);if(Number.isNaN(s.getTime()))return n;const o=Math.max(0,a-s.getTime());return o<6e4?`${Math.floor(o/1e3)}s ago`:o<36e5?`${Math.floor(o/6e4)}m ago`:s.toLocaleTimeString()}function ZS(n){return n.ackStatus==="failed"||n.ackStatus==="rejected"?"error":n.status==="acked"?"active":n.status==="delivered"?"info":n.status==="queued"?"warn":"idle"}function QS(n){return n==="failed"||n==="rejected"?"error":n==="completed"?"active":"info"}function KS(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}k`:String(n)}function JS(){const n=cn(["snapshot"]),a=n.snapshot?.projects??[],s=n.snapshot?.liveSessions??[],o=n.snapshot?.totals.totalCostUsd??0,c=z.useMemo(()=>s.map(m=>{let p=0,y=0;const x=new Set;for(const g of m.agents)p+=g.costUsd??0,y+=(g.tokensIn??0)+(g.tokensOut??0),g.model!==void 0&&x.add(g.model);return{s:m,cost:p,tokens:y,models:[...x]}}).filter(m=>m.cost>0||m.tokens>0).sort((m,p)=>p.cost-m.cost),[s]);if(a.length===0)return d.jsx("div",{className:"hq-empty",children:"No cost data yet — connect some clients."});const u=[...a].sort((f,m)=>m.totalCostUsd-f.totalCostUsd);return d.jsxs("div",{children:[d.jsxs("div",{className:"hq-kpi-row",children:[d.jsxs("div",{className:"hq-kpi hero",children:[d.jsxs("span",{className:"hq-kpi-value accent-cost",children:["$",o.toFixed(4)]}),d.jsx("span",{className:"hq-kpi-label",children:"total fleet cost"})]}),d.jsxs("div",{className:"hq-kpi",children:[d.jsx("span",{className:"hq-kpi-value",children:a.length}),d.jsx("span",{className:"hq-kpi-label",children:"projects"})]}),d.jsxs("div",{className:"hq-kpi",children:[d.jsx("span",{className:"hq-kpi-value",children:c.length}),d.jsx("span",{className:"hq-kpi-label",children:"costed sessions"})]})]}),d.jsx("div",{className:"hq-card-title",children:"By Project"}),u.map(f=>{const m=o>0?f.totalCostUsd/o*100:0;return d.jsxs("div",{className:"hq-card",children:[d.jsxs("div",{className:"hq-row",children:[d.jsx("span",{style:{fontWeight:700},children:f.projectName}),d.jsx("span",{className:"hq-mono hq-row-subtle",children:f.projectId}),d.jsxs("span",{className:"hq-cost-amount",children:["$",f.totalCostUsd.toFixed(4)]}),d.jsxs("span",{className:"hq-mono hq-row-subtle",children:[m.toFixed(1),"%"]})]}),d.jsx("div",{className:"hq-share-track",children:d.jsx("div",{className:"hq-share-fill",style:{width:`${m}%`}})}),d.jsxs("div",{className:"hq-row",style:{marginTop:4},children:[d.jsxs("span",{className:"hq-pill info",children:[f.activeSessions," sessions"]}),d.jsxs("span",{className:"hq-pill active",children:[f.activeSubagents," subagents"]}),d.jsxs("span",{className:"hq-pill idle",children:[f.activeClients," clients"]})]})]},f.projectId)}),c.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"hq-card-title",children:"By Session"}),d.jsx("div",{className:"hq-card",children:c.map(({s:f,cost:m,tokens:p,models:y})=>d.jsxs("div",{className:"hq-row hq-row-click",onClick:()=>{yd(f.sessionId),Pa("console")},title:"Open in Console",children:[d.jsx("span",{style:{fontWeight:600},children:f.projectName}),d.jsx("span",{className:"hq-pill idle",children:f.clientKind}),y.map(x=>d.jsx("span",{className:"hq-pill info",children:x},x)),d.jsxs("span",{className:"hq-mono hq-row-subtle",children:[KS(p)," tok"]}),d.jsxs("span",{className:"hq-cost-amount",children:["$",m.toFixed(4)]})]},f.sessionId))})]})]})}function it(n){if(typeof n=="string"||typeof n=="number")return""+n;let a="";if(Array.isArray(n))for(let s=0,o;s<n.length;s++)(o=it(n[s]))!==""&&(a+=(a&&" ")+o);else for(let s in n)n[s]&&(a+=(a&&" ")+s);return a}var FS={value:()=>{}};function Bc(){for(var n=0,a=arguments.length,s={},o;n<a;++n){if(!(o=arguments[n]+"")||o in s||/[\s.]/.test(o))throw new Error("illegal type: "+o);s[o]=[]}return new bc(s)}function bc(n){this._=n}function WS(n,a){return n.trim().split(/^|\s+/).map(function(s){var o="",c=s.indexOf(".");if(c>=0&&(o=s.slice(c+1),s=s.slice(0,c)),s&&!a.hasOwnProperty(s))throw new Error("unknown type: "+s);return{type:s,name:o}})}bc.prototype=Bc.prototype={constructor:bc,on:function(n,a){var s=this._,o=WS(n+"",s),c,u=-1,f=o.length;if(arguments.length<2){for(;++u<f;)if((c=(n=o[u]).type)&&(c=PS(s[c],n.name)))return c;return}if(a!=null&&typeof a!="function")throw new Error("invalid callback: "+a);for(;++u<f;)if(c=(n=o[u]).type)s[c]=Tg(s[c],n.name,a);else if(a==null)for(c in s)s[c]=Tg(s[c],n.name,null);return this},copy:function(){var n={},a=this._;for(var s in a)n[s]=a[s].slice();return new bc(n)},call:function(n,a){if((c=arguments.length-2)>0)for(var s=new Array(c),o=0,c,u;o<c;++o)s[o]=arguments[o+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(u=this._[n],o=0,c=u.length;o<c;++o)u[o].value.apply(a,s)},apply:function(n,a,s){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var o=this._[n],c=0,u=o.length;c<u;++c)o[c].value.apply(a,s)}};function PS(n,a){for(var s=0,o=n.length,c;s<o;++s)if((c=n[s]).name===a)return c.value}function Tg(n,a,s){for(var o=0,c=n.length;o<c;++o)if(n[o].name===a){n[o]=FS,n=n.slice(0,o).concat(n.slice(o+1));break}return s!=null&&n.push({name:a,value:s}),n}var If="http://www.w3.org/1999/xhtml";const Ag={svg:"http://www.w3.org/2000/svg",xhtml:If,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Uc(n){var a=n+="",s=a.indexOf(":");return s>=0&&(a=n.slice(0,s))!=="xmlns"&&(n=n.slice(s+1)),Ag.hasOwnProperty(a)?{space:Ag[a],local:n}:n}function ew(n){return function(){var a=this.ownerDocument,s=this.namespaceURI;return s===If&&a.documentElement.namespaceURI===If?a.createElement(n):a.createElementNS(s,n)}}function tw(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function gy(n){var a=Uc(n);return(a.local?tw:ew)(a)}function nw(){}function Sd(n){return n==null?nw:function(){return this.querySelector(n)}}function lw(n){typeof n!="function"&&(n=Sd(n));for(var a=this._groups,s=a.length,o=new Array(s),c=0;c<s;++c)for(var u=a[c],f=u.length,m=o[c]=new Array(f),p,y,x=0;x<f;++x)(p=u[x])&&(y=n.call(p,p.__data__,x,u))&&("__data__"in p&&(y.__data__=p.__data__),m[x]=y);return new Ut(o,this._parents)}function aw(n){return n==null?[]:Array.isArray(n)?n:Array.from(n)}function iw(){return[]}function yy(n){return n==null?iw:function(){return this.querySelectorAll(n)}}function sw(n){return function(){return aw(n.apply(this,arguments))}}function ow(n){typeof n=="function"?n=sw(n):n=yy(n);for(var a=this._groups,s=a.length,o=[],c=[],u=0;u<s;++u)for(var f=a[u],m=f.length,p,y=0;y<m;++y)(p=f[y])&&(o.push(n.call(p,p.__data__,y,f)),c.push(p));return new Ut(o,c)}function vy(n){return function(){return this.matches(n)}}function xy(n){return function(a){return a.matches(n)}}var cw=Array.prototype.find;function rw(n){return function(){return cw.call(this.children,n)}}function uw(){return this.firstElementChild}function fw(n){return this.select(n==null?uw:rw(typeof n=="function"?n:xy(n)))}var dw=Array.prototype.filter;function hw(){return Array.from(this.children)}function mw(n){return function(){return dw.call(this.children,n)}}function pw(n){return this.selectAll(n==null?hw:mw(typeof n=="function"?n:xy(n)))}function gw(n){typeof n!="function"&&(n=vy(n));for(var a=this._groups,s=a.length,o=new Array(s),c=0;c<s;++c)for(var u=a[c],f=u.length,m=o[c]=[],p,y=0;y<f;++y)(p=u[y])&&n.call(p,p.__data__,y,u)&&m.push(p);return new Ut(o,this._parents)}function by(n){return new Array(n.length)}function yw(){return new Ut(this._enter||this._groups.map(by),this._parents)}function _c(n,a){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=a}_c.prototype={constructor:_c,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,a){return this._parent.insertBefore(n,a)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}};function vw(n){return function(){return n}}function xw(n,a,s,o,c,u){for(var f=0,m,p=a.length,y=u.length;f<y;++f)(m=a[f])?(m.__data__=u[f],o[f]=m):s[f]=new _c(n,u[f]);for(;f<p;++f)(m=a[f])&&(c[f]=m)}function bw(n,a,s,o,c,u,f){var m,p,y=new Map,x=a.length,g=u.length,v=new Array(x),S;for(m=0;m<x;++m)(p=a[m])&&(v[m]=S=f.call(p,p.__data__,m,a)+"",y.has(S)?c[m]=p:y.set(S,p));for(m=0;m<g;++m)S=f.call(n,u[m],m,u)+"",(p=y.get(S))?(o[m]=p,p.__data__=u[m],y.delete(S)):s[m]=new _c(n,u[m]);for(m=0;m<x;++m)(p=a[m])&&y.get(v[m])===p&&(c[m]=p)}function Sw(n){return n.__data__}function ww(n,a){if(!arguments.length)return Array.from(this,Sw);var s=a?bw:xw,o=this._parents,c=this._groups;typeof n!="function"&&(n=vw(n));for(var u=c.length,f=new Array(u),m=new Array(u),p=new Array(u),y=0;y<u;++y){var x=o[y],g=c[y],v=g.length,S=Nw(n.call(x,x&&x.__data__,y,o)),w=S.length,q=m[y]=new Array(w),C=f[y]=new Array(w),_=p[y]=new Array(v);s(x,g,q,C,_,S,a);for(var k=0,j=0,A,$;k<w;++k)if(A=q[k]){for(k>=j&&(j=k+1);!($=C[j])&&++j<w;);A._next=$||null}}return f=new Ut(f,o),f._enter=m,f._exit=p,f}function Nw(n){return typeof n=="object"&&"length"in n?n:Array.from(n)}function jw(){return new Ut(this._exit||this._groups.map(by),this._parents)}function Ew(n,a,s){var o=this.enter(),c=this,u=this.exit();return typeof n=="function"?(o=n(o),o&&(o=o.selection())):o=o.append(n+""),a!=null&&(c=a(c),c&&(c=c.selection())),s==null?u.remove():s(u),o&&c?o.merge(c).order():c}function _w(n){for(var a=n.selection?n.selection():n,s=this._groups,o=a._groups,c=s.length,u=o.length,f=Math.min(c,u),m=new Array(c),p=0;p<f;++p)for(var y=s[p],x=o[p],g=y.length,v=m[p]=new Array(g),S,w=0;w<g;++w)(S=y[w]||x[w])&&(v[w]=S);for(;p<c;++p)m[p]=s[p];return new Ut(m,this._parents)}function qw(){for(var n=this._groups,a=-1,s=n.length;++a<s;)for(var o=n[a],c=o.length-1,u=o[c],f;--c>=0;)(f=o[c])&&(u&&f.compareDocumentPosition(u)^4&&u.parentNode.insertBefore(f,u),u=f);return this}function Cw(n){n||(n=Mw);function a(g,v){return g&&v?n(g.__data__,v.__data__):!g-!v}for(var s=this._groups,o=s.length,c=new Array(o),u=0;u<o;++u){for(var f=s[u],m=f.length,p=c[u]=new Array(m),y,x=0;x<m;++x)(y=f[x])&&(p[x]=y);p.sort(a)}return new Ut(c,this._parents).order()}function Mw(n,a){return n<a?-1:n>a?1:n>=a?0:NaN}function Tw(){var n=arguments[0];return arguments[0]=this,n.apply(null,arguments),this}function Aw(){return Array.from(this)}function zw(){for(var n=this._groups,a=0,s=n.length;a<s;++a)for(var o=n[a],c=0,u=o.length;c<u;++c){var f=o[c];if(f)return f}return null}function Dw(){let n=0;for(const a of this)++n;return n}function Ow(){return!this.node()}function Hw(n){for(var a=this._groups,s=0,o=a.length;s<o;++s)for(var c=a[s],u=0,f=c.length,m;u<f;++u)(m=c[u])&&n.call(m,m.__data__,u,c);return this}function kw(n){return function(){this.removeAttribute(n)}}function Rw(n){return function(){this.removeAttributeNS(n.space,n.local)}}function Bw(n,a){return function(){this.setAttribute(n,a)}}function Uw(n,a){return function(){this.setAttributeNS(n.space,n.local,a)}}function Lw(n,a){return function(){var s=a.apply(this,arguments);s==null?this.removeAttribute(n):this.setAttribute(n,s)}}function $w(n,a){return function(){var s=a.apply(this,arguments);s==null?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,s)}}function Vw(n,a){var s=Uc(n);if(arguments.length<2){var o=this.node();return s.local?o.getAttributeNS(s.space,s.local):o.getAttribute(s)}return this.each((a==null?s.local?Rw:kw:typeof a=="function"?s.local?$w:Lw:s.local?Uw:Bw)(s,a))}function Sy(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function Yw(n){return function(){this.style.removeProperty(n)}}function Xw(n,a,s){return function(){this.style.setProperty(n,a,s)}}function Iw(n,a,s){return function(){var o=a.apply(this,arguments);o==null?this.style.removeProperty(n):this.style.setProperty(n,o,s)}}function Gw(n,a,s){return arguments.length>1?this.each((a==null?Yw:typeof a=="function"?Iw:Xw)(n,a,s??"")):li(this.node(),n)}function li(n,a){return n.style.getPropertyValue(a)||Sy(n).getComputedStyle(n,null).getPropertyValue(a)}function Zw(n){return function(){delete this[n]}}function Qw(n,a){return function(){this[n]=a}}function Kw(n,a){return function(){var s=a.apply(this,arguments);s==null?delete this[n]:this[n]=s}}function Jw(n,a){return arguments.length>1?this.each((a==null?Zw:typeof a=="function"?Kw:Qw)(n,a)):this.node()[n]}function wy(n){return n.trim().split(/^|\s+/)}function wd(n){return n.classList||new Ny(n)}function Ny(n){this._node=n,this._names=wy(n.getAttribute("class")||"")}Ny.prototype={add:function(n){var a=this._names.indexOf(n);a<0&&(this._names.push(n),this._node.setAttribute("class",this._names.join(" ")))},remove:function(n){var a=this._names.indexOf(n);a>=0&&(this._names.splice(a,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};function jy(n,a){for(var s=wd(n),o=-1,c=a.length;++o<c;)s.add(a[o])}function Ey(n,a){for(var s=wd(n),o=-1,c=a.length;++o<c;)s.remove(a[o])}function Fw(n){return function(){jy(this,n)}}function Ww(n){return function(){Ey(this,n)}}function Pw(n,a){return function(){(a.apply(this,arguments)?jy:Ey)(this,n)}}function eN(n,a){var s=wy(n+"");if(arguments.length<2){for(var o=wd(this.node()),c=-1,u=s.length;++c<u;)if(!o.contains(s[c]))return!1;return!0}return this.each((typeof a=="function"?Pw:a?Fw:Ww)(s,a))}function tN(){this.textContent=""}function nN(n){return function(){this.textContent=n}}function lN(n){return function(){var a=n.apply(this,arguments);this.textContent=a??""}}function aN(n){return arguments.length?this.each(n==null?tN:(typeof n=="function"?lN:nN)(n)):this.node().textContent}function iN(){this.innerHTML=""}function sN(n){return function(){this.innerHTML=n}}function oN(n){return function(){var a=n.apply(this,arguments);this.innerHTML=a??""}}function cN(n){return arguments.length?this.each(n==null?iN:(typeof n=="function"?oN:sN)(n)):this.node().innerHTML}function rN(){this.nextSibling&&this.parentNode.appendChild(this)}function uN(){return this.each(rN)}function fN(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function dN(){return this.each(fN)}function hN(n){var a=typeof n=="function"?n:gy(n);return this.select(function(){return this.appendChild(a.apply(this,arguments))})}function mN(){return null}function pN(n,a){var s=typeof n=="function"?n:gy(n),o=a==null?mN:typeof a=="function"?a:Sd(a);return this.select(function(){return this.insertBefore(s.apply(this,arguments),o.apply(this,arguments)||null)})}function gN(){var n=this.parentNode;n&&n.removeChild(this)}function yN(){return this.each(gN)}function vN(){var n=this.cloneNode(!1),a=this.parentNode;return a?a.insertBefore(n,this.nextSibling):n}function xN(){var n=this.cloneNode(!0),a=this.parentNode;return a?a.insertBefore(n,this.nextSibling):n}function bN(n){return this.select(n?xN:vN)}function SN(n){return arguments.length?this.property("__data__",n):this.node().__data__}function wN(n){return function(a){n.call(this,a,this.__data__)}}function NN(n){return n.trim().split(/^|\s+/).map(function(a){var s="",o=a.indexOf(".");return o>=0&&(s=a.slice(o+1),a=a.slice(0,o)),{type:a,name:s}})}function jN(n){return function(){var a=this.__on;if(a){for(var s=0,o=-1,c=a.length,u;s<c;++s)u=a[s],(!n.type||u.type===n.type)&&u.name===n.name?this.removeEventListener(u.type,u.listener,u.options):a[++o]=u;++o?a.length=o:delete this.__on}}}function EN(n,a,s){return function(){var o=this.__on,c,u=wN(a);if(o){for(var f=0,m=o.length;f<m;++f)if((c=o[f]).type===n.type&&c.name===n.name){this.removeEventListener(c.type,c.listener,c.options),this.addEventListener(c.type,c.listener=u,c.options=s),c.value=a;return}}this.addEventListener(n.type,u,s),c={type:n.type,name:n.name,value:a,listener:u,options:s},o?o.push(c):this.__on=[c]}}function _N(n,a,s){var o=NN(n+""),c,u=o.length,f;if(arguments.length<2){var m=this.node().__on;if(m){for(var p=0,y=m.length,x;p<y;++p)for(c=0,x=m[p];c<u;++c)if((f=o[c]).type===x.type&&f.name===x.name)return x.value}return}for(m=a?EN:jN,c=0;c<u;++c)this.each(m(o[c],a,s));return this}function _y(n,a,s){var o=Sy(n),c=o.CustomEvent;typeof c=="function"?c=new c(a,s):(c=o.document.createEvent("Event"),s?(c.initEvent(a,s.bubbles,s.cancelable),c.detail=s.detail):c.initEvent(a,!1,!1)),n.dispatchEvent(c)}function qN(n,a){return function(){return _y(this,n,a)}}function CN(n,a){return function(){return _y(this,n,a.apply(this,arguments))}}function MN(n,a){return this.each((typeof a=="function"?CN:qN)(n,a))}function*TN(){for(var n=this._groups,a=0,s=n.length;a<s;++a)for(var o=n[a],c=0,u=o.length,f;c<u;++c)(f=o[c])&&(yield f)}var qy=[null];function Ut(n,a){this._groups=n,this._parents=a}function zs(){return new Ut([[document.documentElement]],qy)}function AN(){return this}Ut.prototype=zs.prototype={constructor:Ut,select:lw,selectAll:ow,selectChild:fw,selectChildren:pw,filter:gw,data:ww,enter:yw,exit:jw,join:Ew,merge:_w,selection:AN,order:qw,sort:Cw,call:Tw,nodes:Aw,node:zw,size:Dw,empty:Ow,each:Hw,attr:Vw,style:Gw,property:Jw,classed:eN,text:aN,html:cN,raise:uN,lower:dN,append:hN,insert:pN,remove:yN,clone:bN,datum:SN,on:_N,dispatch:MN,[Symbol.iterator]:TN};function Bt(n){return typeof n=="string"?new Ut([[document.querySelector(n)]],[document.documentElement]):new Ut([[n]],qy)}function zN(n){let a;for(;a=n.sourceEvent;)n=a;return n}function nn(n,a){if(n=zN(n),a===void 0&&(a=n.currentTarget),a){var s=a.ownerSVGElement||a;if(s.createSVGPoint){var o=s.createSVGPoint();return o.x=n.clientX,o.y=n.clientY,o=o.matrixTransform(a.getScreenCTM().inverse()),[o.x,o.y]}if(a.getBoundingClientRect){var c=a.getBoundingClientRect();return[n.clientX-c.left-a.clientLeft,n.clientY-c.top-a.clientTop]}}return[n.pageX,n.pageY]}const DN={passive:!1},bs={capture:!0,passive:!1};function xf(n){n.stopImmediatePropagation()}function ei(n){n.preventDefault(),n.stopImmediatePropagation()}function Cy(n){var a=n.document.documentElement,s=Bt(n).on("dragstart.drag",ei,bs);"onselectstart"in a?s.on("selectstart.drag",ei,bs):(a.__noselect=a.style.MozUserSelect,a.style.MozUserSelect="none")}function My(n,a){var s=n.document.documentElement,o=Bt(n).on("dragstart.drag",null);a&&(o.on("click.drag",ei,bs),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in s?o.on("selectstart.drag",null):(s.style.MozUserSelect=s.__noselect,delete s.__noselect)}const rc=n=>()=>n;function Gf(n,{sourceEvent:a,subject:s,target:o,identifier:c,active:u,x:f,y:m,dx:p,dy:y,dispatch:x}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:a,enumerable:!0,configurable:!0},subject:{value:s,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:c,enumerable:!0,configurable:!0},active:{value:u,enumerable:!0,configurable:!0},x:{value:f,enumerable:!0,configurable:!0},y:{value:m,enumerable:!0,configurable:!0},dx:{value:p,enumerable:!0,configurable:!0},dy:{value:y,enumerable:!0,configurable:!0},_:{value:x}})}Gf.prototype.on=function(){var n=this._.on.apply(this._,arguments);return n===this._?this:n};function ON(n){return!n.ctrlKey&&!n.button}function HN(){return this.parentNode}function kN(n,a){return a??{x:n.x,y:n.y}}function RN(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ty(){var n=ON,a=HN,s=kN,o=RN,c={},u=Bc("start","drag","end"),f=0,m,p,y,x,g=0;function v(A){A.on("mousedown.drag",S).filter(o).on("touchstart.drag",C).on("touchmove.drag",_,DN).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function S(A,$){if(!(x||!n.call(this,A,$))){var D=j(this,a.call(this,A,$),A,$,"mouse");D&&(Bt(A.view).on("mousemove.drag",w,bs).on("mouseup.drag",q,bs),Cy(A.view),xf(A),y=!1,m=A.clientX,p=A.clientY,D("start",A))}}function w(A){if(ei(A),!y){var $=A.clientX-m,D=A.clientY-p;y=$*$+D*D>g}c.mouse("drag",A)}function q(A){Bt(A.view).on("mousemove.drag mouseup.drag",null),My(A.view,y),ei(A),c.mouse("end",A)}function C(A,$){if(n.call(this,A,$)){var D=A.changedTouches,L=a.call(this,A,$),Y=D.length,G,te;for(G=0;G<Y;++G)(te=j(this,L,A,$,D[G].identifier,D[G]))&&(xf(A),te("start",A,D[G]))}}function _(A){var $=A.changedTouches,D=$.length,L,Y;for(L=0;L<D;++L)(Y=c[$[L].identifier])&&(ei(A),Y("drag",A,$[L]))}function k(A){var $=A.changedTouches,D=$.length,L,Y;for(x&&clearTimeout(x),x=setTimeout(function(){x=null},500),L=0;L<D;++L)(Y=c[$[L].identifier])&&(xf(A),Y("end",A,$[L]))}function j(A,$,D,L,Y,G){var te=u.copy(),I=nn(G||D,$),F,V,T;if((T=s.call(A,new Gf("beforestart",{sourceEvent:D,target:v,identifier:Y,active:f,x:I[0],y:I[1],dx:0,dy:0,dispatch:te}),L))!=null)return F=T.x-I[0]||0,V=T.y-I[1]||0,function B(E,M,O){var R=I,Z;switch(E){case"start":c[Y]=B,Z=f++;break;case"end":delete c[Y],--f;case"drag":I=nn(O||M,$),Z=f;break}te.call(E,A,new Gf(E,{sourceEvent:M,subject:T,target:v,identifier:Y,active:Z,x:I[0]+F,y:I[1]+V,dx:I[0]-R[0],dy:I[1]-R[1],dispatch:te}),L)}}return v.filter=function(A){return arguments.length?(n=typeof A=="function"?A:rc(!!A),v):n},v.container=function(A){return arguments.length?(a=typeof A=="function"?A:rc(A),v):a},v.subject=function(A){return arguments.length?(s=typeof A=="function"?A:rc(A),v):s},v.touchable=function(A){return arguments.length?(o=typeof A=="function"?A:rc(!!A),v):o},v.on=function(){var A=u.on.apply(u,arguments);return A===u?v:A},v.clickDistance=function(A){return arguments.length?(g=(A=+A)*A,v):Math.sqrt(g)},v}function Nd(n,a,s){n.prototype=a.prototype=s,s.constructor=n}function Ay(n,a){var s=Object.create(n.prototype);for(var o in a)s[o]=a[o];return s}function Ds(){}var Ss=.7,qc=1/Ss,ti="\\s*([+-]?\\d+)\\s*",ws="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",yn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",BN=/^#([0-9a-f]{3,8})$/,UN=new RegExp(`^rgb\\(${ti},${ti},${ti}\\)$`),LN=new RegExp(`^rgb\\(${yn},${yn},${yn}\\)$`),$N=new RegExp(`^rgba\\(${ti},${ti},${ti},${ws}\\)$`),VN=new RegExp(`^rgba\\(${yn},${yn},${yn},${ws}\\)$`),YN=new RegExp(`^hsl\\(${ws},${yn},${yn}\\)$`),XN=new RegExp(`^hsla\\(${ws},${yn},${yn},${ws}\\)$`),zg={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};Nd(Ds,ta,{copy(n){return Object.assign(new this.constructor,this,n)},displayable(){return this.rgb().displayable()},hex:Dg,formatHex:Dg,formatHex8:IN,formatHsl:GN,formatRgb:Og,toString:Og});function Dg(){return this.rgb().formatHex()}function IN(){return this.rgb().formatHex8()}function GN(){return zy(this).formatHsl()}function Og(){return this.rgb().formatRgb()}function ta(n){var a,s;return n=(n+"").trim().toLowerCase(),(a=BN.exec(n))?(s=a[1].length,a=parseInt(a[1],16),s===6?Hg(a):s===3?new Ct(a>>8&15|a>>4&240,a>>4&15|a&240,(a&15)<<4|a&15,1):s===8?uc(a>>24&255,a>>16&255,a>>8&255,(a&255)/255):s===4?uc(a>>12&15|a>>8&240,a>>8&15|a>>4&240,a>>4&15|a&240,((a&15)<<4|a&15)/255):null):(a=UN.exec(n))?new Ct(a[1],a[2],a[3],1):(a=LN.exec(n))?new Ct(a[1]*255/100,a[2]*255/100,a[3]*255/100,1):(a=$N.exec(n))?uc(a[1],a[2],a[3],a[4]):(a=VN.exec(n))?uc(a[1]*255/100,a[2]*255/100,a[3]*255/100,a[4]):(a=YN.exec(n))?Bg(a[1],a[2]/100,a[3]/100,1):(a=XN.exec(n))?Bg(a[1],a[2]/100,a[3]/100,a[4]):zg.hasOwnProperty(n)?Hg(zg[n]):n==="transparent"?new Ct(NaN,NaN,NaN,0):null}function Hg(n){return new Ct(n>>16&255,n>>8&255,n&255,1)}function uc(n,a,s,o){return o<=0&&(n=a=s=NaN),new Ct(n,a,s,o)}function ZN(n){return n instanceof Ds||(n=ta(n)),n?(n=n.rgb(),new Ct(n.r,n.g,n.b,n.opacity)):new Ct}function Zf(n,a,s,o){return arguments.length===1?ZN(n):new Ct(n,a,s,o??1)}function Ct(n,a,s,o){this.r=+n,this.g=+a,this.b=+s,this.opacity=+o}Nd(Ct,Zf,Ay(Ds,{brighter(n){return n=n==null?qc:Math.pow(qc,n),new Ct(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?Ss:Math.pow(Ss,n),new Ct(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new Ct(Pl(this.r),Pl(this.g),Pl(this.b),Cc(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:kg,formatHex:kg,formatHex8:QN,formatRgb:Rg,toString:Rg}));function kg(){return`#${Jl(this.r)}${Jl(this.g)}${Jl(this.b)}`}function QN(){return`#${Jl(this.r)}${Jl(this.g)}${Jl(this.b)}${Jl((isNaN(this.opacity)?1:this.opacity)*255)}`}function Rg(){const n=Cc(this.opacity);return`${n===1?"rgb(":"rgba("}${Pl(this.r)}, ${Pl(this.g)}, ${Pl(this.b)}${n===1?")":`, ${n})`}`}function Cc(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function Pl(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function Jl(n){return n=Pl(n),(n<16?"0":"")+n.toString(16)}function Bg(n,a,s,o){return o<=0?n=a=s=NaN:s<=0||s>=1?n=a=NaN:a<=0&&(n=NaN),new ln(n,a,s,o)}function zy(n){if(n instanceof ln)return new ln(n.h,n.s,n.l,n.opacity);if(n instanceof Ds||(n=ta(n)),!n)return new ln;if(n instanceof ln)return n;n=n.rgb();var a=n.r/255,s=n.g/255,o=n.b/255,c=Math.min(a,s,o),u=Math.max(a,s,o),f=NaN,m=u-c,p=(u+c)/2;return m?(a===u?f=(s-o)/m+(s<o)*6:s===u?f=(o-a)/m+2:f=(a-s)/m+4,m/=p<.5?u+c:2-u-c,f*=60):m=p>0&&p<1?0:f,new ln(f,m,p,n.opacity)}function KN(n,a,s,o){return arguments.length===1?zy(n):new ln(n,a,s,o??1)}function ln(n,a,s,o){this.h=+n,this.s=+a,this.l=+s,this.opacity=+o}Nd(ln,KN,Ay(Ds,{brighter(n){return n=n==null?qc:Math.pow(qc,n),new ln(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?Ss:Math.pow(Ss,n),new ln(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,a=isNaN(n)||isNaN(this.s)?0:this.s,s=this.l,o=s+(s<.5?s:1-s)*a,c=2*s-o;return new Ct(bf(n>=240?n-240:n+120,c,o),bf(n,c,o),bf(n<120?n+240:n-120,c,o),this.opacity)},clamp(){return new ln(Ug(this.h),fc(this.s),fc(this.l),Cc(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 n=Cc(this.opacity);return`${n===1?"hsl(":"hsla("}${Ug(this.h)}, ${fc(this.s)*100}%, ${fc(this.l)*100}%${n===1?")":`, ${n})`}`}}));function Ug(n){return n=(n||0)%360,n<0?n+360:n}function fc(n){return Math.max(0,Math.min(1,n||0))}function bf(n,a,s){return(n<60?a+(s-a)*n/60:n<180?s:n<240?a+(s-a)*(240-n)/60:a)*255}const jd=n=>()=>n;function JN(n,a){return function(s){return n+s*a}}function FN(n,a,s){return n=Math.pow(n,s),a=Math.pow(a,s)-n,s=1/s,function(o){return Math.pow(n+o*a,s)}}function WN(n){return(n=+n)==1?Dy:function(a,s){return s-a?FN(a,s,n):jd(isNaN(a)?s:a)}}function Dy(n,a){var s=a-n;return s?JN(n,s):jd(isNaN(n)?a:n)}const Mc=(function n(a){var s=WN(a);function o(c,u){var f=s((c=Zf(c)).r,(u=Zf(u)).r),m=s(c.g,u.g),p=s(c.b,u.b),y=Dy(c.opacity,u.opacity);return function(x){return c.r=f(x),c.g=m(x),c.b=p(x),c.opacity=y(x),c+""}}return o.gamma=n,o})(1);function PN(n,a){a||(a=[]);var s=n?Math.min(a.length,n.length):0,o=a.slice(),c;return function(u){for(c=0;c<s;++c)o[c]=n[c]*(1-u)+a[c]*u;return o}}function ej(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function tj(n,a){var s=a?a.length:0,o=n?Math.min(s,n.length):0,c=new Array(o),u=new Array(s),f;for(f=0;f<o;++f)c[f]=ys(n[f],a[f]);for(;f<s;++f)u[f]=a[f];return function(m){for(f=0;f<o;++f)u[f]=c[f](m);return u}}function nj(n,a){var s=new Date;return n=+n,a=+a,function(o){return s.setTime(n*(1-o)+a*o),s}}function gn(n,a){return n=+n,a=+a,function(s){return n*(1-s)+a*s}}function lj(n,a){var s={},o={},c;(n===null||typeof n!="object")&&(n={}),(a===null||typeof a!="object")&&(a={});for(c in a)c in n?s[c]=ys(n[c],a[c]):o[c]=a[c];return function(u){for(c in s)o[c]=s[c](u);return o}}var Qf=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Sf=new RegExp(Qf.source,"g");function aj(n){return function(){return n}}function ij(n){return function(a){return n(a)+""}}function Oy(n,a){var s=Qf.lastIndex=Sf.lastIndex=0,o,c,u,f=-1,m=[],p=[];for(n=n+"",a=a+"";(o=Qf.exec(n))&&(c=Sf.exec(a));)(u=c.index)>s&&(u=a.slice(s,u),m[f]?m[f]+=u:m[++f]=u),(o=o[0])===(c=c[0])?m[f]?m[f]+=c:m[++f]=c:(m[++f]=null,p.push({i:f,x:gn(o,c)})),s=Sf.lastIndex;return s<a.length&&(u=a.slice(s),m[f]?m[f]+=u:m[++f]=u),m.length<2?p[0]?ij(p[0].x):aj(a):(a=p.length,function(y){for(var x=0,g;x<a;++x)m[(g=p[x]).i]=g.x(y);return m.join("")})}function ys(n,a){var s=typeof a,o;return a==null||s==="boolean"?jd(a):(s==="number"?gn:s==="string"?(o=ta(a))?(a=o,Mc):Oy:a instanceof ta?Mc:a instanceof Date?nj:ej(a)?PN:Array.isArray(a)?tj:typeof a.valueOf!="function"&&typeof a.toString!="function"||isNaN(a)?lj:gn)(n,a)}var Lg=180/Math.PI,Kf={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Hy(n,a,s,o,c,u){var f,m,p;return(f=Math.sqrt(n*n+a*a))&&(n/=f,a/=f),(p=n*s+a*o)&&(s-=n*p,o-=a*p),(m=Math.sqrt(s*s+o*o))&&(s/=m,o/=m,p/=m),n*o<a*s&&(n=-n,a=-a,p=-p,f=-f),{translateX:c,translateY:u,rotate:Math.atan2(a,n)*Lg,skewX:Math.atan(p)*Lg,scaleX:f,scaleY:m}}var dc;function sj(n){const a=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(n+"");return a.isIdentity?Kf:Hy(a.a,a.b,a.c,a.d,a.e,a.f)}function oj(n){return n==null||(dc||(dc=document.createElementNS("http://www.w3.org/2000/svg","g")),dc.setAttribute("transform",n),!(n=dc.transform.baseVal.consolidate()))?Kf:(n=n.matrix,Hy(n.a,n.b,n.c,n.d,n.e,n.f))}function ky(n,a,s,o){function c(y){return y.length?y.pop()+" ":""}function u(y,x,g,v,S,w){if(y!==g||x!==v){var q=S.push("translate(",null,a,null,s);w.push({i:q-4,x:gn(y,g)},{i:q-2,x:gn(x,v)})}else(g||v)&&S.push("translate("+g+a+v+s)}function f(y,x,g,v){y!==x?(y-x>180?x+=360:x-y>180&&(y+=360),v.push({i:g.push(c(g)+"rotate(",null,o)-2,x:gn(y,x)})):x&&g.push(c(g)+"rotate("+x+o)}function m(y,x,g,v){y!==x?v.push({i:g.push(c(g)+"skewX(",null,o)-2,x:gn(y,x)}):x&&g.push(c(g)+"skewX("+x+o)}function p(y,x,g,v,S,w){if(y!==g||x!==v){var q=S.push(c(S)+"scale(",null,",",null,")");w.push({i:q-4,x:gn(y,g)},{i:q-2,x:gn(x,v)})}else(g!==1||v!==1)&&S.push(c(S)+"scale("+g+","+v+")")}return function(y,x){var g=[],v=[];return y=n(y),x=n(x),u(y.translateX,y.translateY,x.translateX,x.translateY,g,v),f(y.rotate,x.rotate,g,v),m(y.skewX,x.skewX,g,v),p(y.scaleX,y.scaleY,x.scaleX,x.scaleY,g,v),y=x=null,function(S){for(var w=-1,q=v.length,C;++w<q;)g[(C=v[w]).i]=C.x(S);return g.join("")}}}var cj=ky(sj,"px, ","px)","deg)"),rj=ky(oj,", ",")",")"),uj=1e-12;function $g(n){return((n=Math.exp(n))+1/n)/2}function fj(n){return((n=Math.exp(n))-1/n)/2}function dj(n){return((n=Math.exp(2*n))-1)/(n+1)}const Sc=(function n(a,s,o){function c(u,f){var m=u[0],p=u[1],y=u[2],x=f[0],g=f[1],v=f[2],S=x-m,w=g-p,q=S*S+w*w,C,_;if(q<uj)_=Math.log(v/y)/a,C=function(L){return[m+L*S,p+L*w,y*Math.exp(a*L*_)]};else{var k=Math.sqrt(q),j=(v*v-y*y+o*q)/(2*y*s*k),A=(v*v-y*y-o*q)/(2*v*s*k),$=Math.log(Math.sqrt(j*j+1)-j),D=Math.log(Math.sqrt(A*A+1)-A);_=(D-$)/a,C=function(L){var Y=L*_,G=$g($),te=y/(s*k)*(G*dj(a*Y+$)-fj($));return[m+te*S,p+te*w,y*G/$g(a*Y+$)]}}return C.duration=_*1e3*a/Math.SQRT2,C}return c.rho=function(u){var f=Math.max(.001,+u),m=f*f,p=m*m;return n(f,m,p)},c})(Math.SQRT2,2,4);var ai=0,ps=0,rs=0,Ry=1e3,Tc,gs,Ac=0,na=0,Lc=0,Ns=typeof performance=="object"&&performance.now?performance:Date,By=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function Ed(){return na||(By(hj),na=Ns.now()+Lc)}function hj(){na=0}function zc(){this._call=this._time=this._next=null}zc.prototype=Uy.prototype={constructor:zc,restart:function(n,a,s){if(typeof n!="function")throw new TypeError("callback is not a function");s=(s==null?Ed():+s)+(a==null?0:+a),!this._next&&gs!==this&&(gs?gs._next=this:Tc=this,gs=this),this._call=n,this._time=s,Jf()},stop:function(){this._call&&(this._call=null,this._time=1/0,Jf())}};function Uy(n,a,s){var o=new zc;return o.restart(n,a,s),o}function mj(){Ed(),++ai;for(var n=Tc,a;n;)(a=na-n._time)>=0&&n._call.call(void 0,a),n=n._next;--ai}function Vg(){na=(Ac=Ns.now())+Lc,ai=ps=0;try{mj()}finally{ai=0,gj(),na=0}}function pj(){var n=Ns.now(),a=n-Ac;a>Ry&&(Lc-=a,Ac=n)}function gj(){for(var n,a=Tc,s,o=1/0;a;)a._call?(o>a._time&&(o=a._time),n=a,a=a._next):(s=a._next,a._next=null,a=n?n._next=s:Tc=s);gs=n,Jf(o)}function Jf(n){if(!ai){ps&&(ps=clearTimeout(ps));var a=n-na;a>24?(n<1/0&&(ps=setTimeout(Vg,n-Ns.now()-Lc)),rs&&(rs=clearInterval(rs))):(rs||(Ac=Ns.now(),rs=setInterval(pj,Ry)),ai=1,By(Vg))}}function Yg(n,a,s){var o=new zc;return a=a==null?0:+a,o.restart(c=>{o.stop(),n(c+a)},a,s),o}var yj=Bc("start","end","cancel","interrupt"),vj=[],Ly=0,Xg=1,Ff=2,wc=3,Ig=4,Wf=5,Nc=6;function $c(n,a,s,o,c,u){var f=n.__transition;if(!f)n.__transition={};else if(s in f)return;xj(n,s,{name:a,index:o,group:c,on:yj,tween:vj,time:u.time,delay:u.delay,duration:u.duration,ease:u.ease,timer:null,state:Ly})}function _d(n,a){var s=rn(n,a);if(s.state>Ly)throw new Error("too late; already scheduled");return s}function vn(n,a){var s=rn(n,a);if(s.state>wc)throw new Error("too late; already running");return s}function rn(n,a){var s=n.__transition;if(!s||!(s=s[a]))throw new Error("transition not found");return s}function xj(n,a,s){var o=n.__transition,c;o[a]=s,s.timer=Uy(u,0,s.time);function u(y){s.state=Xg,s.timer.restart(f,s.delay,s.time),s.delay<=y&&f(y-s.delay)}function f(y){var x,g,v,S;if(s.state!==Xg)return p();for(x in o)if(S=o[x],S.name===s.name){if(S.state===wc)return Yg(f);S.state===Ig?(S.state=Nc,S.timer.stop(),S.on.call("interrupt",n,n.__data__,S.index,S.group),delete o[x]):+x<a&&(S.state=Nc,S.timer.stop(),S.on.call("cancel",n,n.__data__,S.index,S.group),delete o[x])}if(Yg(function(){s.state===wc&&(s.state=Ig,s.timer.restart(m,s.delay,s.time),m(y))}),s.state=Ff,s.on.call("start",n,n.__data__,s.index,s.group),s.state===Ff){for(s.state=wc,c=new Array(v=s.tween.length),x=0,g=-1;x<v;++x)(S=s.tween[x].value.call(n,n.__data__,s.index,s.group))&&(c[++g]=S);c.length=g+1}}function m(y){for(var x=y<s.duration?s.ease.call(null,y/s.duration):(s.timer.restart(p),s.state=Wf,1),g=-1,v=c.length;++g<v;)c[g].call(n,x);s.state===Wf&&(s.on.call("end",n,n.__data__,s.index,s.group),p())}function p(){s.state=Nc,s.timer.stop(),delete o[a];for(var y in o)return;delete n.__transition}}function jc(n,a){var s=n.__transition,o,c,u=!0,f;if(s){a=a==null?null:a+"";for(f in s){if((o=s[f]).name!==a){u=!1;continue}c=o.state>Ff&&o.state<Wf,o.state=Nc,o.timer.stop(),o.on.call(c?"interrupt":"cancel",n,n.__data__,o.index,o.group),delete s[f]}u&&delete n.__transition}}function bj(n){return this.each(function(){jc(this,n)})}function Sj(n,a){var s,o;return function(){var c=vn(this,n),u=c.tween;if(u!==s){o=s=u;for(var f=0,m=o.length;f<m;++f)if(o[f].name===a){o=o.slice(),o.splice(f,1);break}}c.tween=o}}function wj(n,a,s){var o,c;if(typeof s!="function")throw new Error;return function(){var u=vn(this,n),f=u.tween;if(f!==o){c=(o=f).slice();for(var m={name:a,value:s},p=0,y=c.length;p<y;++p)if(c[p].name===a){c[p]=m;break}p===y&&c.push(m)}u.tween=c}}function Nj(n,a){var s=this._id;if(n+="",arguments.length<2){for(var o=rn(this.node(),s).tween,c=0,u=o.length,f;c<u;++c)if((f=o[c]).name===n)return f.value;return null}return this.each((a==null?Sj:wj)(s,n,a))}function qd(n,a,s){var o=n._id;return n.each(function(){var c=vn(this,o);(c.value||(c.value={}))[a]=s.apply(this,arguments)}),function(c){return rn(c,o).value[a]}}function $y(n,a){var s;return(typeof a=="number"?gn:a instanceof ta?Mc:(s=ta(a))?(a=s,Mc):Oy)(n,a)}function jj(n){return function(){this.removeAttribute(n)}}function Ej(n){return function(){this.removeAttributeNS(n.space,n.local)}}function _j(n,a,s){var o,c=s+"",u;return function(){var f=this.getAttribute(n);return f===c?null:f===o?u:u=a(o=f,s)}}function qj(n,a,s){var o,c=s+"",u;return function(){var f=this.getAttributeNS(n.space,n.local);return f===c?null:f===o?u:u=a(o=f,s)}}function Cj(n,a,s){var o,c,u;return function(){var f,m=s(this),p;return m==null?void this.removeAttribute(n):(f=this.getAttribute(n),p=m+"",f===p?null:f===o&&p===c?u:(c=p,u=a(o=f,m)))}}function Mj(n,a,s){var o,c,u;return function(){var f,m=s(this),p;return m==null?void this.removeAttributeNS(n.space,n.local):(f=this.getAttributeNS(n.space,n.local),p=m+"",f===p?null:f===o&&p===c?u:(c=p,u=a(o=f,m)))}}function Tj(n,a){var s=Uc(n),o=s==="transform"?rj:$y;return this.attrTween(n,typeof a=="function"?(s.local?Mj:Cj)(s,o,qd(this,"attr."+n,a)):a==null?(s.local?Ej:jj)(s):(s.local?qj:_j)(s,o,a))}function Aj(n,a){return function(s){this.setAttribute(n,a.call(this,s))}}function zj(n,a){return function(s){this.setAttributeNS(n.space,n.local,a.call(this,s))}}function Dj(n,a){var s,o;function c(){var u=a.apply(this,arguments);return u!==o&&(s=(o=u)&&zj(n,u)),s}return c._value=a,c}function Oj(n,a){var s,o;function c(){var u=a.apply(this,arguments);return u!==o&&(s=(o=u)&&Aj(n,u)),s}return c._value=a,c}function Hj(n,a){var s="attr."+n;if(arguments.length<2)return(s=this.tween(s))&&s._value;if(a==null)return this.tween(s,null);if(typeof a!="function")throw new Error;var o=Uc(n);return this.tween(s,(o.local?Dj:Oj)(o,a))}function kj(n,a){return function(){_d(this,n).delay=+a.apply(this,arguments)}}function Rj(n,a){return a=+a,function(){_d(this,n).delay=a}}function Bj(n){var a=this._id;return arguments.length?this.each((typeof n=="function"?kj:Rj)(a,n)):rn(this.node(),a).delay}function Uj(n,a){return function(){vn(this,n).duration=+a.apply(this,arguments)}}function Lj(n,a){return a=+a,function(){vn(this,n).duration=a}}function $j(n){var a=this._id;return arguments.length?this.each((typeof n=="function"?Uj:Lj)(a,n)):rn(this.node(),a).duration}function Vj(n,a){if(typeof a!="function")throw new Error;return function(){vn(this,n).ease=a}}function Yj(n){var a=this._id;return arguments.length?this.each(Vj(a,n)):rn(this.node(),a).ease}function Xj(n,a){return function(){var s=a.apply(this,arguments);if(typeof s!="function")throw new Error;vn(this,n).ease=s}}function Ij(n){if(typeof n!="function")throw new Error;return this.each(Xj(this._id,n))}function Gj(n){typeof n!="function"&&(n=vy(n));for(var a=this._groups,s=a.length,o=new Array(s),c=0;c<s;++c)for(var u=a[c],f=u.length,m=o[c]=[],p,y=0;y<f;++y)(p=u[y])&&n.call(p,p.__data__,y,u)&&m.push(p);return new Xn(o,this._parents,this._name,this._id)}function Zj(n){if(n._id!==this._id)throw new Error;for(var a=this._groups,s=n._groups,o=a.length,c=s.length,u=Math.min(o,c),f=new Array(o),m=0;m<u;++m)for(var p=a[m],y=s[m],x=p.length,g=f[m]=new Array(x),v,S=0;S<x;++S)(v=p[S]||y[S])&&(g[S]=v);for(;m<o;++m)f[m]=a[m];return new Xn(f,this._parents,this._name,this._id)}function Qj(n){return(n+"").trim().split(/^|\s+/).every(function(a){var s=a.indexOf(".");return s>=0&&(a=a.slice(0,s)),!a||a==="start"})}function Kj(n,a,s){var o,c,u=Qj(a)?_d:vn;return function(){var f=u(this,n),m=f.on;m!==o&&(c=(o=m).copy()).on(a,s),f.on=c}}function Jj(n,a){var s=this._id;return arguments.length<2?rn(this.node(),s).on.on(n):this.each(Kj(s,n,a))}function Fj(n){return function(){var a=this.parentNode;for(var s in this.__transition)if(+s!==n)return;a&&a.removeChild(this)}}function Wj(){return this.on("end.remove",Fj(this._id))}function Pj(n){var a=this._name,s=this._id;typeof n!="function"&&(n=Sd(n));for(var o=this._groups,c=o.length,u=new Array(c),f=0;f<c;++f)for(var m=o[f],p=m.length,y=u[f]=new Array(p),x,g,v=0;v<p;++v)(x=m[v])&&(g=n.call(x,x.__data__,v,m))&&("__data__"in x&&(g.__data__=x.__data__),y[v]=g,$c(y[v],a,s,v,y,rn(x,s)));return new Xn(u,this._parents,a,s)}function e2(n){var a=this._name,s=this._id;typeof n!="function"&&(n=yy(n));for(var o=this._groups,c=o.length,u=[],f=[],m=0;m<c;++m)for(var p=o[m],y=p.length,x,g=0;g<y;++g)if(x=p[g]){for(var v=n.call(x,x.__data__,g,p),S,w=rn(x,s),q=0,C=v.length;q<C;++q)(S=v[q])&&$c(S,a,s,q,v,w);u.push(v),f.push(x)}return new Xn(u,f,a,s)}var t2=zs.prototype.constructor;function n2(){return new t2(this._groups,this._parents)}function l2(n,a){var s,o,c;return function(){var u=li(this,n),f=(this.style.removeProperty(n),li(this,n));return u===f?null:u===s&&f===o?c:c=a(s=u,o=f)}}function Vy(n){return function(){this.style.removeProperty(n)}}function a2(n,a,s){var o,c=s+"",u;return function(){var f=li(this,n);return f===c?null:f===o?u:u=a(o=f,s)}}function i2(n,a,s){var o,c,u;return function(){var f=li(this,n),m=s(this),p=m+"";return m==null&&(p=m=(this.style.removeProperty(n),li(this,n))),f===p?null:f===o&&p===c?u:(c=p,u=a(o=f,m))}}function s2(n,a){var s,o,c,u="style."+a,f="end."+u,m;return function(){var p=vn(this,n),y=p.on,x=p.value[u]==null?m||(m=Vy(a)):void 0;(y!==s||c!==x)&&(o=(s=y).copy()).on(f,c=x),p.on=o}}function o2(n,a,s){var o=(n+="")=="transform"?cj:$y;return a==null?this.styleTween(n,l2(n,o)).on("end.style."+n,Vy(n)):typeof a=="function"?this.styleTween(n,i2(n,o,qd(this,"style."+n,a))).each(s2(this._id,n)):this.styleTween(n,a2(n,o,a),s).on("end.style."+n,null)}function c2(n,a,s){return function(o){this.style.setProperty(n,a.call(this,o),s)}}function r2(n,a,s){var o,c;function u(){var f=a.apply(this,arguments);return f!==c&&(o=(c=f)&&c2(n,f,s)),o}return u._value=a,u}function u2(n,a,s){var o="style."+(n+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(a==null)return this.tween(o,null);if(typeof a!="function")throw new Error;return this.tween(o,r2(n,a,s??""))}function f2(n){return function(){this.textContent=n}}function d2(n){return function(){var a=n(this);this.textContent=a??""}}function h2(n){return this.tween("text",typeof n=="function"?d2(qd(this,"text",n)):f2(n==null?"":n+""))}function m2(n){return function(a){this.textContent=n.call(this,a)}}function p2(n){var a,s;function o(){var c=n.apply(this,arguments);return c!==s&&(a=(s=c)&&m2(c)),a}return o._value=n,o}function g2(n){var a="text";if(arguments.length<1)return(a=this.tween(a))&&a._value;if(n==null)return this.tween(a,null);if(typeof n!="function")throw new Error;return this.tween(a,p2(n))}function y2(){for(var n=this._name,a=this._id,s=Yy(),o=this._groups,c=o.length,u=0;u<c;++u)for(var f=o[u],m=f.length,p,y=0;y<m;++y)if(p=f[y]){var x=rn(p,a);$c(p,n,s,y,f,{time:x.time+x.delay+x.duration,delay:0,duration:x.duration,ease:x.ease})}return new Xn(o,this._parents,n,s)}function v2(){var n,a,s=this,o=s._id,c=s.size();return new Promise(function(u,f){var m={value:f},p={value:function(){--c===0&&u()}};s.each(function(){var y=vn(this,o),x=y.on;x!==n&&(a=(n=x).copy(),a._.cancel.push(m),a._.interrupt.push(m),a._.end.push(p)),y.on=a}),c===0&&u()})}var x2=0;function Xn(n,a,s,o){this._groups=n,this._parents=a,this._name=s,this._id=o}function Yy(){return++x2}var Vn=zs.prototype;Xn.prototype={constructor:Xn,select:Pj,selectAll:e2,selectChild:Vn.selectChild,selectChildren:Vn.selectChildren,filter:Gj,merge:Zj,selection:n2,transition:y2,call:Vn.call,nodes:Vn.nodes,node:Vn.node,size:Vn.size,empty:Vn.empty,each:Vn.each,on:Jj,attr:Tj,attrTween:Hj,style:o2,styleTween:u2,text:h2,textTween:g2,remove:Wj,tween:Nj,delay:Bj,duration:$j,ease:Yj,easeVarying:Ij,end:v2,[Symbol.iterator]:Vn[Symbol.iterator]};function b2(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}var S2={time:null,delay:0,duration:250,ease:b2};function w2(n,a){for(var s;!(s=n.__transition)||!(s=s[a]);)if(!(n=n.parentNode))throw new Error(`transition ${a} not found`);return s}function N2(n){var a,s;n instanceof Xn?(a=n._id,n=n._name):(a=Yy(),(s=S2).time=Ed(),n=n==null?null:n+"");for(var o=this._groups,c=o.length,u=0;u<c;++u)for(var f=o[u],m=f.length,p,y=0;y<m;++y)(p=f[y])&&$c(p,n,a,y,f,s||w2(p,a));return new Xn(o,this._parents,n,a)}zs.prototype.interrupt=bj;zs.prototype.transition=N2;const hc=n=>()=>n;function j2(n,{sourceEvent:a,target:s,transform:o,dispatch:c}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:a,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:c}})}function Yn(n,a,s){this.k=n,this.x=a,this.y=s}Yn.prototype={constructor:Yn,scale:function(n){return n===1?this:new Yn(this.k*n,this.x,this.y)},translate:function(n,a){return n===0&a===0?this:new Yn(this.k,this.x+this.k*n,this.y+this.k*a)},apply:function(n){return[n[0]*this.k+this.x,n[1]*this.k+this.y]},applyX:function(n){return n*this.k+this.x},applyY:function(n){return n*this.k+this.y},invert:function(n){return[(n[0]-this.x)/this.k,(n[1]-this.y)/this.k]},invertX:function(n){return(n-this.x)/this.k},invertY:function(n){return(n-this.y)/this.k},rescaleX:function(n){return n.copy().domain(n.range().map(this.invertX,this).map(n.invert,n))},rescaleY:function(n){return n.copy().domain(n.range().map(this.invertY,this).map(n.invert,n))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Vc=new Yn(1,0,0);Xy.prototype=Yn.prototype;function Xy(n){for(;!n.__zoom;)if(!(n=n.parentNode))return Vc;return n.__zoom}function wf(n){n.stopImmediatePropagation()}function us(n){n.preventDefault(),n.stopImmediatePropagation()}function E2(n){return(!n.ctrlKey||n.type==="wheel")&&!n.button}function _2(){var n=this;return n instanceof SVGElement?(n=n.ownerSVGElement||n,n.hasAttribute("viewBox")?(n=n.viewBox.baseVal,[[n.x,n.y],[n.x+n.width,n.y+n.height]]):[[0,0],[n.width.baseVal.value,n.height.baseVal.value]]):[[0,0],[n.clientWidth,n.clientHeight]]}function Gg(){return this.__zoom||Vc}function q2(n){return-n.deltaY*(n.deltaMode===1?.05:n.deltaMode?1:.002)*(n.ctrlKey?10:1)}function C2(){return navigator.maxTouchPoints||"ontouchstart"in this}function M2(n,a,s){var o=n.invertX(a[0][0])-s[0][0],c=n.invertX(a[1][0])-s[1][0],u=n.invertY(a[0][1])-s[0][1],f=n.invertY(a[1][1])-s[1][1];return n.translate(c>o?(o+c)/2:Math.min(0,o)||Math.max(0,c),f>u?(u+f)/2:Math.min(0,u)||Math.max(0,f))}function Iy(){var n=E2,a=_2,s=M2,o=q2,c=C2,u=[0,1/0],f=[[-1/0,-1/0],[1/0,1/0]],m=250,p=Sc,y=Bc("start","zoom","end"),x,g,v,S=500,w=150,q=0,C=10;function _(T){T.property("__zoom",Gg).on("wheel.zoom",Y,{passive:!1}).on("mousedown.zoom",G).on("dblclick.zoom",te).filter(c).on("touchstart.zoom",I).on("touchmove.zoom",F).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(T,B,E,M){var O=T.selection?T.selection():T;O.property("__zoom",Gg),T!==O?$(T,B,E,M):O.interrupt().each(function(){D(this,arguments).event(M).start().zoom(null,typeof B=="function"?B.apply(this,arguments):B).end()})},_.scaleBy=function(T,B,E,M){_.scaleTo(T,function(){var O=this.__zoom.k,R=typeof B=="function"?B.apply(this,arguments):B;return O*R},E,M)},_.scaleTo=function(T,B,E,M){_.transform(T,function(){var O=a.apply(this,arguments),R=this.__zoom,Z=E==null?A(O):typeof E=="function"?E.apply(this,arguments):E,ee=R.invert(Z),P=typeof B=="function"?B.apply(this,arguments):B;return s(j(k(R,P),Z,ee),O,f)},E,M)},_.translateBy=function(T,B,E,M){_.transform(T,function(){return s(this.__zoom.translate(typeof B=="function"?B.apply(this,arguments):B,typeof E=="function"?E.apply(this,arguments):E),a.apply(this,arguments),f)},null,M)},_.translateTo=function(T,B,E,M,O){_.transform(T,function(){var R=a.apply(this,arguments),Z=this.__zoom,ee=M==null?A(R):typeof M=="function"?M.apply(this,arguments):M;return s(Vc.translate(ee[0],ee[1]).scale(Z.k).translate(typeof B=="function"?-B.apply(this,arguments):-B,typeof E=="function"?-E.apply(this,arguments):-E),R,f)},M,O)};function k(T,B){return B=Math.max(u[0],Math.min(u[1],B)),B===T.k?T:new Yn(B,T.x,T.y)}function j(T,B,E){var M=B[0]-E[0]*T.k,O=B[1]-E[1]*T.k;return M===T.x&&O===T.y?T:new Yn(T.k,M,O)}function A(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function $(T,B,E,M){T.on("start.zoom",function(){D(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){D(this,arguments).event(M).end()}).tween("zoom",function(){var O=this,R=arguments,Z=D(O,R).event(M),ee=a.apply(O,R),P=E==null?A(ee):typeof E=="function"?E.apply(O,R):E,oe=Math.max(ee[1][0]-ee[0][0],ee[1][1]-ee[0][1]),ce=O.__zoom,ue=typeof B=="function"?B.apply(O,R):B,xe=p(ce.invert(P).concat(oe/ce.k),ue.invert(P).concat(oe/ue.k));return function(de){if(de===1)de=ue;else{var le=xe(de),re=oe/le[2];de=new Yn(re,P[0]-le[0]*re,P[1]-le[1]*re)}Z.zoom(null,de)}})}function D(T,B,E){return!E&&T.__zooming||new L(T,B)}function L(T,B){this.that=T,this.args=B,this.active=0,this.sourceEvent=null,this.extent=a.apply(T,B),this.taps=0}L.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,B){return this.mouse&&T!=="mouse"&&(this.mouse[1]=B.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=B.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=B.invert(this.touch1[0])),this.that.__zoom=B,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var B=Bt(this.that).datum();y.call(T,this.that,new j2(T,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:y}),B)}};function Y(T,...B){if(!n.apply(this,arguments))return;var E=D(this,B).event(T),M=this.__zoom,O=Math.max(u[0],Math.min(u[1],M.k*Math.pow(2,o.apply(this,arguments)))),R=nn(T);if(E.wheel)(E.mouse[0][0]!==R[0]||E.mouse[0][1]!==R[1])&&(E.mouse[1]=M.invert(E.mouse[0]=R)),clearTimeout(E.wheel);else{if(M.k===O)return;E.mouse=[R,M.invert(R)],jc(this),E.start()}us(T),E.wheel=setTimeout(Z,w),E.zoom("mouse",s(j(k(M,O),E.mouse[0],E.mouse[1]),E.extent,f));function Z(){E.wheel=null,E.end()}}function G(T,...B){if(v||!n.apply(this,arguments))return;var E=T.currentTarget,M=D(this,B,!0).event(T),O=Bt(T.view).on("mousemove.zoom",P,!0).on("mouseup.zoom",oe,!0),R=nn(T,E),Z=T.clientX,ee=T.clientY;Cy(T.view),wf(T),M.mouse=[R,this.__zoom.invert(R)],jc(this),M.start();function P(ce){if(us(ce),!M.moved){var ue=ce.clientX-Z,xe=ce.clientY-ee;M.moved=ue*ue+xe*xe>q}M.event(ce).zoom("mouse",s(j(M.that.__zoom,M.mouse[0]=nn(ce,E),M.mouse[1]),M.extent,f))}function oe(ce){O.on("mousemove.zoom mouseup.zoom",null),My(ce.view,M.moved),us(ce),M.event(ce).end()}}function te(T,...B){if(n.apply(this,arguments)){var E=this.__zoom,M=nn(T.changedTouches?T.changedTouches[0]:T,this),O=E.invert(M),R=E.k*(T.shiftKey?.5:2),Z=s(j(k(E,R),M,O),a.apply(this,B),f);us(T),m>0?Bt(this).transition().duration(m).call($,Z,M,T):Bt(this).call(_.transform,Z,M,T)}}function I(T,...B){if(n.apply(this,arguments)){var E=T.touches,M=E.length,O=D(this,B,T.changedTouches.length===M).event(T),R,Z,ee,P;for(wf(T),Z=0;Z<M;++Z)ee=E[Z],P=nn(ee,this),P=[P,this.__zoom.invert(P),ee.identifier],O.touch0?!O.touch1&&O.touch0[2]!==P[2]&&(O.touch1=P,O.taps=0):(O.touch0=P,R=!0,O.taps=1+!!x);x&&(x=clearTimeout(x)),R&&(O.taps<2&&(g=P[0],x=setTimeout(function(){x=null},S)),jc(this),O.start())}}function F(T,...B){if(this.__zooming){var E=D(this,B).event(T),M=T.changedTouches,O=M.length,R,Z,ee,P;for(us(T),R=0;R<O;++R)Z=M[R],ee=nn(Z,this),E.touch0&&E.touch0[2]===Z.identifier?E.touch0[0]=ee:E.touch1&&E.touch1[2]===Z.identifier&&(E.touch1[0]=ee);if(Z=E.that.__zoom,E.touch1){var oe=E.touch0[0],ce=E.touch0[1],ue=E.touch1[0],xe=E.touch1[1],de=(de=ue[0]-oe[0])*de+(de=ue[1]-oe[1])*de,le=(le=xe[0]-ce[0])*le+(le=xe[1]-ce[1])*le;Z=k(Z,Math.sqrt(de/le)),ee=[(oe[0]+ue[0])/2,(oe[1]+ue[1])/2],P=[(ce[0]+xe[0])/2,(ce[1]+xe[1])/2]}else if(E.touch0)ee=E.touch0[0],P=E.touch0[1];else return;E.zoom("touch",s(j(Z,ee,P),E.extent,f))}}function V(T,...B){if(this.__zooming){var E=D(this,B).event(T),M=T.changedTouches,O=M.length,R,Z;for(wf(T),v&&clearTimeout(v),v=setTimeout(function(){v=null},S),R=0;R<O;++R)Z=M[R],E.touch0&&E.touch0[2]===Z.identifier?delete E.touch0:E.touch1&&E.touch1[2]===Z.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(Z=nn(Z,this),Math.hypot(g[0]-Z[0],g[1]-Z[1])<C)){var ee=Bt(this).on("dblclick.zoom");ee&&ee.apply(this,arguments)}}}return _.wheelDelta=function(T){return arguments.length?(o=typeof T=="function"?T:hc(+T),_):o},_.filter=function(T){return arguments.length?(n=typeof T=="function"?T:hc(!!T),_):n},_.touchable=function(T){return arguments.length?(c=typeof T=="function"?T:hc(!!T),_):c},_.extent=function(T){return arguments.length?(a=typeof T=="function"?T:hc([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),_):a},_.scaleExtent=function(T){return arguments.length?(u[0]=+T[0],u[1]=+T[1],_):[u[0],u[1]]},_.translateExtent=function(T){return arguments.length?(f[0][0]=+T[0][0],f[1][0]=+T[1][0],f[0][1]=+T[0][1],f[1][1]=+T[1][1],_):[[f[0][0],f[0][1]],[f[1][0],f[1][1]]]},_.constrain=function(T){return arguments.length?(s=T,_):s},_.duration=function(T){return arguments.length?(m=+T,_):m},_.interpolate=function(T){return arguments.length?(p=T,_):p},_.on=function(){var T=y.on.apply(y,arguments);return T===y?_:T},_.clickDistance=function(T){return arguments.length?(q=(T=+T)*T,_):Math.sqrt(q)},_.tapDistance=function(T){return arguments.length?(C=+T,_):C},_}const on={error001:(n="react")=>`Seems like you have not used ${n==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${n}flow.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:n=>`Node type "${n}" not found. Using fallback type "default".`,error004:()=>"The 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:n=>`The old edge with id=${n} does not exist.`,error009:n=>`Marker type "${n}" doesn't exist.`,error008:(n,{id:a,sourceHandle:s,targetHandle:o})=>`Couldn't create edge for ${n} handle id: "${n==="source"?s:o}", edge id: ${a}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:n=>`Edge type "${n}" not found. Using fallback type "default".`,error012:n=>`Node with id "${n}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(n="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${n}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:n=>`Edge with id "${n}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},js=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Gy=["Enter"," ","Escape"],Zy={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:n,x:a,y:s})=>`Moved selected node ${n}. New position, x: ${a}, y: ${s}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var ii;(function(n){n.Strict="strict",n.Loose="loose"})(ii||(ii={}));var ea;(function(n){n.Free="free",n.Vertical="vertical",n.Horizontal="horizontal"})(ea||(ea={}));var Es;(function(n){n.Partial="partial",n.Full="full"})(Es||(Es={}));const Qy={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var El;(function(n){n.Bezier="default",n.Straight="straight",n.Step="step",n.SmoothStep="smoothstep",n.SimpleBezier="simplebezier"})(El||(El={}));var _s;(function(n){n.Arrow="arrow",n.ArrowClosed="arrowclosed"})(_s||(_s={}));var ye;(function(n){n.Left="left",n.Top="top",n.Right="right",n.Bottom="bottom"})(ye||(ye={}));const Zg={[ye.Left]:ye.Right,[ye.Right]:ye.Left,[ye.Top]:ye.Bottom,[ye.Bottom]:ye.Top};function Ky(n){return n===null?null:n?"valid":"invalid"}const Jy=n=>"id"in n&&"source"in n&&"target"in n,T2=n=>"id"in n&&"position"in n&&!("source"in n)&&!("target"in n),Cd=n=>"id"in n&&"internals"in n&&!("source"in n)&&!("target"in n),Os=(n,a=[0,0])=>{const{width:s,height:o}=In(n),c=n.origin??a,u=s*c[0],f=o*c[1];return{x:n.position.x-u,y:n.position.y-f}},A2=(n,a={nodeOrigin:[0,0]})=>{if(n.length===0)return{x:0,y:0,width:0,height:0};const s=n.reduce((o,c)=>{const u=typeof c=="string";let f=!a.nodeLookup&&!u?c:void 0;a.nodeLookup&&(f=u?a.nodeLookup.get(c):Cd(c)?c:a.nodeLookup.get(c.id));const m=f?Dc(f,a.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Yc(o,m)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Xc(s)},Hs=(n,a={})=>{let s={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return n.forEach(c=>{(a.filter===void 0||a.filter(c))&&(s=Yc(s,Dc(c)),o=!0)}),o?Xc(s):{x:0,y:0,width:0,height:0}},Md=(n,a,[s,o,c]=[0,0,1],u=!1,f=!1)=>{const m=(a.x-s)/c,p=(a.y-o)/c,y=a.width/c,x=a.height/c,g=[];for(const v of n.values()){const{measured:S,selectable:w=!0,hidden:q=!1}=v;if(f&&!w||q)continue;const C=S.width??v.width??v.initialWidth??0,_=S.height??v.height??v.initialHeight??0,{x:k,y:j}=v.internals.positionAbsolute,A=ev(m,p,y,x,k,j,C,_),$=C*_,D=u&&A>0;(!v.internals.handleBounds||D||A>=$||v.dragging)&&g.push(v)}return g},z2=(n,a)=>{const s=new Set;return n.forEach(o=>{s.add(o.id)}),a.filter(o=>s.has(o.source)||s.has(o.target))};function D2(n,a){const s=new Map,o=a?.nodes?new Set(a.nodes.map(c=>c.id)):null;return n.forEach(c=>{c.measured.width&&c.measured.height&&(a?.includeHiddenNodes||!c.hidden)&&(!o||o.has(c.id))&&s.set(c.id,c)}),s}async function O2({nodes:n,width:a,height:s,panZoom:o,minZoom:c,maxZoom:u},f){if(n.size===0)return!0;const m=D2(n,f),p=Hs(m),y=Ad(p,a,s,f?.minZoom??c,f?.maxZoom??u,f?.padding??.1);return await o.setViewport(y,{duration:f?.duration,ease:f?.ease,interpolate:f?.interpolate}),!0}function Fy({nodeId:n,nextPosition:a,nodeLookup:s,nodeOrigin:o=[0,0],nodeExtent:c,onError:u}){const f=s.get(n),m=f.parentId?s.get(f.parentId):void 0,{x:p,y}=m?m.internals.positionAbsolute:{x:0,y:0},x=f.origin??o;let g=f.extent||c;if(f.extent==="parent"&&!f.expandParent)if(!m)u?.("005",on.error005());else{const S=m.measured.width,w=m.measured.height;S&&w&&(g=[[p,y],[p+S,y+w]])}else m&&aa(f.extent)&&(g=[[f.extent[0][0]+p,f.extent[0][1]+y],[f.extent[1][0]+p,f.extent[1][1]+y]]);const v=aa(g)?la(a,g,f.measured):a;return(f.measured.width===void 0||f.measured.height===void 0)&&u?.("015",on.error015()),{position:{x:v.x-p+(f.measured.width??0)*x[0],y:v.y-y+(f.measured.height??0)*x[1]},positionAbsolute:v}}async function H2({nodesToRemove:n=[],edgesToRemove:a=[],nodes:s,edges:o,onBeforeDelete:c}){const u=new Set(n.map(v=>v.id)),f=[];for(const v of s){if(v.deletable===!1)continue;const S=u.has(v.id),w=!S&&v.parentId&&f.find(q=>q.id===v.parentId);(S||w)&&f.push(v)}const m=new Set(a.map(v=>v.id)),p=o.filter(v=>v.deletable!==!1),x=z2(f,p);for(const v of p)m.has(v.id)&&!x.find(w=>w.id===v.id)&&x.push(v);if(!c)return{edges:x,nodes:f};const g=await c({nodes:f,edges:x});return typeof g=="boolean"?g?{edges:x,nodes:f}:{edges:[],nodes:[]}:g}const si=(n,a=0,s=1)=>Math.min(Math.max(n,a),s),la=(n={x:0,y:0},a,s)=>({x:si(n.x,a[0][0],a[1][0]-(s?.width??0)),y:si(n.y,a[0][1],a[1][1]-(s?.height??0))});function Wy(n,a,s){const{width:o,height:c}=In(s),{x:u,y:f}=s.internals.positionAbsolute;return la(n,[[u,f],[u+o,f+c]],a)}const Qg=(n,a,s)=>n<a?si(Math.abs(n-a),1,a)/a:n>s?-si(Math.abs(n-s),1,a)/a:0,Td=(n,a,s=15,o=40)=>{const c=Qg(n.x,o,a.width-o)*s,u=Qg(n.y,o,a.height-o)*s;return[c,u]},Yc=(n,a)=>({x:Math.min(n.x,a.x),y:Math.min(n.y,a.y),x2:Math.max(n.x2,a.x2),y2:Math.max(n.y2,a.y2)}),Pf=({x:n,y:a,width:s,height:o})=>({x:n,y:a,x2:n+s,y2:a+o}),Xc=({x:n,y:a,x2:s,y2:o})=>({x:n,y:a,width:s-n,height:o-a}),qs=(n,a=[0,0])=>{const{x:s,y:o}=Cd(n)?n.internals.positionAbsolute:Os(n,a);return{x:s,y:o,width:n.measured?.width??n.width??n.initialWidth??0,height:n.measured?.height??n.height??n.initialHeight??0}},Dc=(n,a=[0,0])=>{const{x:s,y:o}=Cd(n)?n.internals.positionAbsolute:Os(n,a);return{x:s,y:o,x2:s+(n.measured?.width??n.width??n.initialWidth??0),y2:o+(n.measured?.height??n.height??n.initialHeight??0)}},Py=(n,a)=>Xc(Yc(Pf(n),Pf(a))),ev=(n,a,s,o,c,u,f,m)=>{const p=Math.max(0,Math.min(n+s,c+f)-Math.max(n,c)),y=Math.max(0,Math.min(a+o,u+m)-Math.max(a,u));return Math.ceil(p*y)},Oc=(n,a)=>ev(n.x,n.y,n.width,n.height,a.x,a.y,a.width,a.height),Kg=n=>an(n.width)&&an(n.height)&&an(n.x)&&an(n.y),an=n=>!isNaN(n)&&isFinite(n),tv=(n,a)=>(s,o)=>{},ks=(n,a=[1,1])=>({x:a[0]*Math.round(n.x/a[0]),y:a[1]*Math.round(n.y/a[1])}),Rs=({x:n,y:a},[s,o,c],u=!1,f=[1,1])=>{const m={x:(n-s)/c,y:(a-o)/c};return u?ks(m,f):m},oi=({x:n,y:a},[s,o,c])=>({x:n*c+s,y:a*c+o});function Qa(n,a){if(typeof n=="number")return Math.floor((a-a/(1+n))*.5);if(typeof n=="string"&&n.endsWith("px")){const s=parseFloat(n);if(!Number.isNaN(s))return Math.floor(s)}if(typeof n=="string"&&n.endsWith("%")){const s=parseFloat(n);if(!Number.isNaN(s))return Math.floor(a*s*.01)}return console.error(`The padding value "${n}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function k2(n,a,s){if(typeof n=="string"||typeof n=="number"){const o=Qa(n,s),c=Qa(n,a);return{top:o,right:c,bottom:o,left:c,x:c*2,y:o*2}}if(typeof n=="object"){const o=Qa(n.top??n.y??0,s),c=Qa(n.bottom??n.y??0,s),u=Qa(n.left??n.x??0,a),f=Qa(n.right??n.x??0,a);return{top:o,right:f,bottom:c,left:u,x:u+f,y:o+c}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function R2(n,a,s,o,c,u){const{x:f,y:m}=oi(n,[a,s,o]),{x:p,y}=oi({x:n.x+n.width,y:n.y+n.height},[a,s,o]),x=c-p,g=u-y;return{left:Math.floor(f),top:Math.floor(m),right:Math.floor(x),bottom:Math.floor(g)}}const Ad=(n,a,s,o,c,u)=>{const f=k2(u,a,s),m=(a-f.x)/n.width,p=(s-f.y)/n.height,y=Math.min(m,p),x=si(y,o,c),g=n.x+n.width/2,v=n.y+n.height/2,S=a/2-g*x,w=s/2-v*x,q=R2(n,S,w,x,a,s),C={left:Math.min(q.left-f.left,0),top:Math.min(q.top-f.top,0),right:Math.min(q.right-f.right,0),bottom:Math.min(q.bottom-f.bottom,0)};return{x:S-C.left+C.right,y:w-C.top+C.bottom,zoom:x}},Cs=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function aa(n){return n!=null&&n!=="parent"}function In(n){return{width:n.measured?.width??n.width??n.initialWidth??0,height:n.measured?.height??n.height??n.initialHeight??0}}function nv(n){return(n.measured?.width??n.width??n.initialWidth)!==void 0&&(n.measured?.height??n.height??n.initialHeight)!==void 0}function lv(n,a={width:0,height:0},s,o,c){const u={...n},f=o.get(s);if(f){const m=f.origin||c;u.x+=f.internals.positionAbsolute.x-(a.width??0)*m[0],u.y+=f.internals.positionAbsolute.y-(a.height??0)*m[1]}return u}function Jg(n,a){if(n.size!==a.size)return!1;for(const s of n)if(!a.has(s))return!1;return!0}function B2(){let n,a;return{promise:new Promise((o,c)=>{n=o,a=c}),resolve:n,reject:a}}function U2(n){return{...Zy,...n||{}}}function vs(n,{snapGrid:a=[0,0],snapToGrid:s=!1,transform:o,containerBounds:c}){const{x:u,y:f}=sn(n),m=Rs({x:u-(c?.left??0),y:f-(c?.top??0)},o),{x:p,y}=s?ks(m,a):m;return{xSnapped:p,ySnapped:y,...m}}const zd=n=>({width:n.offsetWidth,height:n.offsetHeight}),av=n=>n?.getRootNode?.()||window?.document,L2=["INPUT","SELECT","TEXTAREA"];function iv(n){const a=n.composedPath?.()?.[0]||n.target;return a?.nodeType!==1?!1:L2.includes(a.nodeName)||a.hasAttribute("contenteditable")||!!a.closest(".nokey")}const sv=n=>"clientX"in n,sn=(n,a)=>{const s=sv(n),o=s?n.clientX:n.touches?.[0].clientX,c=s?n.clientY:n.touches?.[0].clientY;return{x:o-(a?.left??0),y:c-(a?.top??0)}},Fg=(n,a,s,o,c)=>{const u=a.querySelectorAll(`.${n}`);return!u||!u.length?null:Array.from(u).map(f=>{const m=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),type:n,nodeId:c,position:f.getAttribute("data-handlepos"),x:(m.left-s.left)/o,y:(m.top-s.top)/o,...zd(f)}})};function ov({sourceX:n,sourceY:a,targetX:s,targetY:o,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:m}){const p=n*.125+c*.375+f*.375+s*.125,y=a*.125+u*.375+m*.375+o*.125,x=Math.abs(p-n),g=Math.abs(y-a);return[p,y,x,g]}function mc(n,a){return n>=0?.5*n:a*25*Math.sqrt(-n)}function Wg({pos:n,x1:a,y1:s,x2:o,y2:c,c:u}){switch(n){case ye.Left:return[a-mc(a-o,u),s];case ye.Right:return[a+mc(o-a,u),s];case ye.Top:return[a,s-mc(s-c,u)];case ye.Bottom:return[a,s+mc(c-s,u)]}}function cv({sourceX:n,sourceY:a,sourcePosition:s=ye.Bottom,targetX:o,targetY:c,targetPosition:u=ye.Top,curvature:f=.25}){const[m,p]=Wg({pos:s,x1:n,y1:a,x2:o,y2:c,c:f}),[y,x]=Wg({pos:u,x1:o,y1:c,x2:n,y2:a,c:f}),[g,v,S,w]=ov({sourceX:n,sourceY:a,targetX:o,targetY:c,sourceControlX:m,sourceControlY:p,targetControlX:y,targetControlY:x});return[`M${n},${a} C${m},${p} ${y},${x} ${o},${c}`,g,v,S,w]}function rv({sourceX:n,sourceY:a,targetX:s,targetY:o}){const c=Math.abs(s-n)/2,u=s<n?s+c:s-c,f=Math.abs(o-a)/2,m=o<a?o+f:o-f;return[u,m,c,f]}function $2({sourceNode:n,targetNode:a,selected:s=!1,zIndex:o=0,elevateOnSelect:c=!1,zIndexMode:u="basic"}){if(u==="manual")return o;const f=c&&s?o+1e3:o,m=Math.max(n.parentId||c&&n.selected?n.internals.z:0,a.parentId||c&&a.selected?a.internals.z:0);return f+m}function V2({sourceNode:n,targetNode:a,width:s,height:o,transform:c}){const u=Yc(Dc(n),Dc(a));u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const f={x:-c[0]/c[2],y:-c[1]/c[2],width:s/c[2],height:o/c[2]};return Oc(f,Xc(u))>0}const Y2=({source:n,sourceHandle:a,target:s,targetHandle:o})=>`xy-edge__${n}${a||""}-${s}${o||""}`,X2=(n,a)=>a.some(s=>s.source===n.source&&s.target===n.target&&(s.sourceHandle===n.sourceHandle||!s.sourceHandle&&!n.sourceHandle)&&(s.targetHandle===n.targetHandle||!s.targetHandle&&!n.targetHandle)),I2=(n,a,s={})=>{if(!n.source||!n.target)return s.onError?.("006",on.error006()),a;const o=s.getEdgeId||Y2;let c;return Jy(n)?c={...n}:c={...n,id:o(n)},X2(c,a)?a:(c.sourceHandle===null&&delete c.sourceHandle,c.targetHandle===null&&delete c.targetHandle,a.concat(c))};function uv({sourceX:n,sourceY:a,targetX:s,targetY:o}){const[c,u,f,m]=rv({sourceX:n,sourceY:a,targetX:s,targetY:o});return[`M ${n},${a}L ${s},${o}`,c,u,f,m]}const Pg={[ye.Left]:{x:-1,y:0},[ye.Right]:{x:1,y:0},[ye.Top]:{x:0,y:-1},[ye.Bottom]:{x:0,y:1}},G2=({source:n,sourcePosition:a=ye.Bottom,target:s})=>a===ye.Left||a===ye.Right?n.x<s.x?{x:1,y:0}:{x:-1,y:0}:n.y<s.y?{x:0,y:1}:{x:0,y:-1},e0=(n,a)=>Math.sqrt(Math.pow(a.x-n.x,2)+Math.pow(a.y-n.y,2));function Z2({source:n,sourcePosition:a=ye.Bottom,target:s,targetPosition:o=ye.Top,center:c,offset:u,stepPosition:f}){const m=Pg[a],p=Pg[o],y={x:n.x+m.x*u,y:n.y+m.y*u},x={x:s.x+p.x*u,y:s.y+p.y*u},g=G2({source:y,sourcePosition:a,target:x}),v=g.x!==0?"x":"y",S=g[v];let w=[],q,C;const _={x:0,y:0},k={x:0,y:0},[,,j,A]=rv({sourceX:n.x,sourceY:n.y,targetX:s.x,targetY:s.y});if(m[v]*p[v]===-1){v==="x"?(q=c.x??y.x+(x.x-y.x)*f,C=c.y??(y.y+x.y)/2):(q=c.x??(y.x+x.x)/2,C=c.y??y.y+(x.y-y.y)*f);const Y=[{x:q,y:y.y},{x:q,y:x.y}],G=[{x:y.x,y:C},{x:x.x,y:C}];m[v]===S?w=v==="x"?Y:G:w=v==="x"?G:Y}else{const Y=[{x:y.x,y:x.y}],G=[{x:x.x,y:y.y}];if(v==="x"?w=m.x===S?G:Y:w=m.y===S?Y:G,a===o){const T=Math.abs(n[v]-s[v]);if(T<=u){const B=Math.min(u-1,u-T);m[v]===S?_[v]=(y[v]>n[v]?-1:1)*B:k[v]=(x[v]>s[v]?-1:1)*B}}if(a!==o){const T=v==="x"?"y":"x",B=m[v]===p[T],E=y[T]>x[T],M=y[T]<x[T];(m[v]===1&&(!B&&E||B&&M)||m[v]!==1&&(!B&&M||B&&E))&&(w=v==="x"?Y:G)}const te={x:y.x+_.x,y:y.y+_.y},I={x:x.x+k.x,y:x.y+k.y},F=Math.max(Math.abs(te.x-w[0].x),Math.abs(I.x-w[0].x)),V=Math.max(Math.abs(te.y-w[0].y),Math.abs(I.y-w[0].y));F>=V?(q=(te.x+I.x)/2,C=w[0].y):(q=w[0].x,C=(te.y+I.y)/2)}const $={x:y.x+_.x,y:y.y+_.y},D={x:x.x+k.x,y:x.y+k.y};return[[n,...$.x!==w[0].x||$.y!==w[0].y?[$]:[],...w,...D.x!==w[w.length-1].x||D.y!==w[w.length-1].y?[D]:[],s],q,C,j,A]}function Q2(n,a,s,o){const c=Math.min(e0(n,a)/2,e0(a,s)/2,o),{x:u,y:f}=a;if(n.x===u&&u===s.x||n.y===f&&f===s.y)return`L${u} ${f}`;if(n.y===f){const y=n.x<s.x?-1:1,x=n.y<s.y?1:-1;return`L ${u+c*y},${f}Q ${u},${f} ${u},${f+c*x}`}const m=n.x<s.x?1:-1,p=n.y<s.y?-1:1;return`L ${u},${f+c*p}Q ${u},${f} ${u+c*m},${f}`}function ed({sourceX:n,sourceY:a,sourcePosition:s=ye.Bottom,targetX:o,targetY:c,targetPosition:u=ye.Top,borderRadius:f=5,centerX:m,centerY:p,offset:y=20,stepPosition:x=.5}){const[g,v,S,w,q]=Z2({source:{x:n,y:a},sourcePosition:s,target:{x:o,y:c},targetPosition:u,center:{x:m,y:p},offset:y,stepPosition:x});let C=`M${g[0].x} ${g[0].y}`;for(let _=1;_<g.length-1;_++)C+=Q2(g[_-1],g[_],g[_+1],f);return C+=`L${g[g.length-1].x} ${g[g.length-1].y}`,[C,v,S,w,q]}function t0(n){return n&&!!(n.internals.handleBounds||n.handles?.length)&&!!(n.measured.width||n.width||n.initialWidth)}function K2(n){const{sourceNode:a,targetNode:s}=n;if(!t0(a)||!t0(s))return null;const o=a.internals.handleBounds||n0(a.handles),c=s.internals.handleBounds||n0(s.handles),u=l0(o?.source??[],n.sourceHandle),f=l0(n.connectionMode===ii.Strict?c?.target??[]:(c?.target??[]).concat(c?.source??[]),n.targetHandle);if(!u||!f)return n.onError?.("008",on.error008(u?"target":"source",{id:n.id,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle})),null;const m=u?.position||ye.Bottom,p=f?.position||ye.Top,y=ia(a,u,m),x=ia(s,f,p);return{sourceX:y.x,sourceY:y.y,targetX:x.x,targetY:x.y,sourcePosition:m,targetPosition:p}}function n0(n){if(!n)return null;const a=[],s=[];for(const o of n)o.width=o.width??1,o.height=o.height??1,o.type==="source"?a.push(o):o.type==="target"&&s.push(o);return{source:a,target:s}}function ia(n,a,s=ye.Left,o=!1){const c=(a?.x??0)+n.internals.positionAbsolute.x,u=(a?.y??0)+n.internals.positionAbsolute.y,{width:f,height:m}=a??In(n);if(o)return{x:c+f/2,y:u+m/2};switch(a?.position??s){case ye.Top:return{x:c+f/2,y:u};case ye.Right:return{x:c+f,y:u+m/2};case ye.Bottom:return{x:c+f/2,y:u+m};case ye.Left:return{x:c,y:u+m/2}}}function l0(n,a){return n&&(a?n.find(s=>s.id===a):n[0])||null}function td(n,a){return n?typeof n=="string"?n:`${a?`${a}__`:""}${Object.keys(n).sort().map(o=>`${o}=${n[o]}`).join("&")}`:""}function J2(n,{id:a,defaultColor:s,defaultMarkerStart:o,defaultMarkerEnd:c}){const u=new Set;return n.reduce((f,m)=>([m.markerStart||o,m.markerEnd||c].forEach(p=>{if(p&&typeof p=="object"){const y=td(p,a);u.has(y)||(f.push({id:y,color:p.color||s,...p}),u.add(y))}}),f),[]).sort((f,m)=>f.id.localeCompare(m.id))}const fv=1e3,F2=10,Dd={nodeOrigin:[0,0],nodeExtent:js,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},W2={...Dd,checkEquality:!0};function Od(n,a){const s={...n};for(const o in a)a[o]!==void 0&&(s[o]=a[o]);return s}function P2(n,a,s){const o=Od(Dd,s);for(const c of n.values())if(c.parentId)kd(c,n,a,o);else{const u=Os(c,o.nodeOrigin),f=aa(c.extent)?c.extent:o.nodeExtent,m=la(u,f,In(c));c.internals.positionAbsolute=m}}function eE(n,a){if(!n.handles)return n.measured?a?.internals.handleBounds:void 0;const s=[],o=[];for(const c of n.handles){const u={id:c.id,width:c.width??1,height:c.height??1,nodeId:n.id,x:c.x,y:c.y,position:c.position,type:c.type};c.type==="source"?s.push(u):c.type==="target"&&o.push(u)}return{source:s,target:o}}function Hd(n){return n==="manual"}function nd(n,a,s,o={}){const c=Od(W2,o),u={i:0},f=new Map(a),m=c?.elevateNodesOnSelect&&!Hd(c.zIndexMode)?fv:0;let p=n.length>0,y=!1;a.clear(),s.clear();for(const x of n){let g=f.get(x.id);if(c.checkEquality&&x===g?.internals.userNode)a.set(x.id,g);else{const v=Os(x,c.nodeOrigin),S=aa(x.extent)?x.extent:c.nodeExtent,w=la(v,S,In(x));g={...c.defaults,...x,measured:{width:x.measured?.width,height:x.measured?.height},internals:{positionAbsolute:w,handleBounds:eE(x,g),z:dv(x,m,c.zIndexMode),userNode:x}},a.set(x.id,g)}(g.measured===void 0||g.measured.width===void 0||g.measured.height===void 0)&&!g.hidden&&(p=!1),x.parentId&&kd(g,a,s,o,u),y||=x.selected??!1}return{nodesInitialized:p,hasSelectedNodes:y}}function tE(n,a){if(!n.parentId)return;const s=a.get(n.parentId);s?s.set(n.id,n):a.set(n.parentId,new Map([[n.id,n]]))}function kd(n,a,s,o,c){const{elevateNodesOnSelect:u,nodeOrigin:f,nodeExtent:m,zIndexMode:p}=Od(Dd,o),y=n.parentId,x=a.get(y);if(!x){console.warn(`Parent node ${y} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}tE(n,s),c&&!x.parentId&&x.internals.rootParentIndex===void 0&&p==="auto"&&(x.internals.rootParentIndex=++c.i,x.internals.z=x.internals.z+c.i*F2),c&&x.internals.rootParentIndex!==void 0&&(c.i=x.internals.rootParentIndex);const g=u&&!Hd(p)?fv:0,{x:v,y:S,z:w}=nE(n,x,f,m,g,p),{positionAbsolute:q}=n.internals,C=v!==q.x||S!==q.y;(C||w!==n.internals.z)&&a.set(n.id,{...n,internals:{...n.internals,positionAbsolute:C?{x:v,y:S}:q,z:w}})}function dv(n,a,s){const o=an(n.zIndex)?n.zIndex:0;return Hd(s)?o:o+(n.selected?a:0)}function nE(n,a,s,o,c,u){const{x:f,y:m}=a.internals.positionAbsolute,p=In(n),y=Os(n,s),x=aa(n.extent)?la(y,n.extent,p):y;let g=la({x:f+x.x,y:m+x.y},o,p);n.extent==="parent"&&(g=Wy(g,p,a));const v=dv(n,c,u),S=a.internals.z??0;return{x:g.x,y:g.y,z:S>=v?S+1:v}}function Rd(n,a,s,o=[0,0]){const c=[],u=new Map;for(const f of n){const m=a.get(f.parentId);if(!m)continue;const p=u.get(f.parentId)?.expandedRect??qs(m),y=Py(p,f.rect);u.set(f.parentId,{expandedRect:y,parent:m})}return u.size>0&&u.forEach(({expandedRect:f,parent:m},p)=>{const y=m.internals.positionAbsolute,x=In(m),g=m.origin??o,v=f.x<y.x?Math.round(Math.abs(y.x-f.x)):0,S=f.y<y.y?Math.round(Math.abs(y.y-f.y)):0,w=Math.max(x.width,Math.round(f.width)),q=Math.max(x.height,Math.round(f.height)),C=(w-x.width)*g[0],_=(q-x.height)*g[1];(v>0||S>0||C||_)&&(c.push({id:p,type:"position",position:{x:m.position.x-v+C,y:m.position.y-S+_}}),s.get(p)?.forEach(k=>{n.some(j=>j.id===k.id)||c.push({id:k.id,type:"position",position:{x:k.position.x+v,y:k.position.y+S}})})),(x.width<f.width||x.height<f.height||v||S)&&c.push({id:p,type:"dimensions",setAttributes:!0,dimensions:{width:w+(v?g[0]*v-C:0),height:q+(S?g[1]*S-_:0)}})}),c}function lE(n,a,s,o,c,u,f){const m=o?.querySelector(".xyflow__viewport");let p=!1;if(!m)return{changes:[],updatedInternals:p};const y=[],x=window.getComputedStyle(m),{m22:g}=new window.DOMMatrixReadOnly(x.transform),v=[];for(const S of n.values()){const w=a.get(S.id);if(!w)continue;if(w.hidden){a.set(w.id,{...w,internals:{...w.internals,handleBounds:void 0}}),p=!0;continue}const q=zd(S.nodeElement),C=w.measured.width!==q.width||w.measured.height!==q.height;if(!!(q.width&&q.height&&(C||!w.internals.handleBounds||S.force))){const k=S.nodeElement.getBoundingClientRect(),j=aa(w.extent)?w.extent:u;let{positionAbsolute:A}=w.internals;w.parentId&&w.extent==="parent"?A=Wy(A,q,a.get(w.parentId)):j&&(A=la(A,j,q));const $={...w,measured:q,internals:{...w.internals,positionAbsolute:A,handleBounds:{source:Fg("source",S.nodeElement,k,g,w.id),target:Fg("target",S.nodeElement,k,g,w.id)}}};a.set(w.id,$),w.parentId&&kd($,a,s,{nodeOrigin:c,zIndexMode:f}),p=!0,C&&(y.push({id:w.id,type:"dimensions",dimensions:q}),w.expandParent&&w.parentId&&v.push({id:w.id,parentId:w.parentId,rect:qs($,c)}))}}if(v.length>0){const S=Rd(v,a,s,c);y.push(...S)}return{changes:y,updatedInternals:p}}async function aE({delta:n,panZoom:a,transform:s,translateExtent:o,width:c,height:u}){if(!a||!n.x&&!n.y)return!1;const f=await a.setViewportConstrained({x:s[0]+n.x,y:s[1]+n.y,zoom:s[2]},[[0,0],[c,u]],o);return!!f&&(f.x!==s[0]||f.y!==s[1]||f.k!==s[2])}function a0(n,a,s,o,c,u){let f=c;const m=o.get(f)||new Map;o.set(f,m.set(s,a)),f=`${c}-${n}`;const p=o.get(f)||new Map;if(o.set(f,p.set(s,a)),u){f=`${c}-${n}-${u}`;const y=o.get(f)||new Map;o.set(f,y.set(s,a))}}function hv(n,a,s){n.clear(),a.clear();for(const o of s){const{source:c,target:u,sourceHandle:f=null,targetHandle:m=null}=o,p={edgeId:o.id,source:c,target:u,sourceHandle:f,targetHandle:m},y=`${c}-${f}--${u}-${m}`,x=`${u}-${m}--${c}-${f}`;a0("source",p,x,n,c,f),a0("target",p,y,n,u,m),a.set(o.id,o)}}function mv(n,a){if(!n.parentId)return!1;const s=a.get(n.parentId);return s?s.selected?!0:mv(s,a):!1}function i0(n,a,s){let o=n;do{if(o?.matches?.(a))return!0;if(o===s)return!1;o=o?.parentElement}while(o);return!1}function iE(n,a,s,o){const c=new Map;for(const[u,f]of n)if((f.selected||f.id===o)&&(!f.parentId||!mv(f,n))&&(f.draggable||a&&typeof f.draggable>"u")){const m=n.get(u);m&&c.set(u,{id:u,position:m.position||{x:0,y:0},distance:{x:s.x-m.internals.positionAbsolute.x,y:s.y-m.internals.positionAbsolute.y},extent:m.extent,parentId:m.parentId,origin:m.origin,expandParent:m.expandParent,internals:{positionAbsolute:m.internals.positionAbsolute||{x:0,y:0}},measured:{width:m.measured.width??0,height:m.measured.height??0}})}return c}function Nf({nodeId:n,dragItems:a,nodeLookup:s,dragging:o=!0}){const c=[];for(const[f,m]of a){const p=s.get(f)?.internals.userNode;p&&c.push({...p,position:m.position,dragging:o})}if(!n)return[c[0],c];const u=s.get(n)?.internals.userNode;return[u?{...u,position:a.get(n)?.position||u.position,dragging:o}:c[0],c]}function sE({dragItems:n,snapGrid:a,x:s,y:o}){const c=n.values().next().value;if(!c)return null;const u={x:s-c.distance.x,y:o-c.distance.y},f=ks(u,a);return{x:f.x-u.x,y:f.y-u.y}}function oE({onNodeMouseDown:n,getStoreItems:a,onDragStart:s,onDrag:o,onDragStop:c}){let u={x:null,y:null},f=0,m=new Map,p=!1,y={x:0,y:0},x=null,g=!1,v=null,S=!1,w=!1,q=null;function C({noDragClassName:k,handleSelector:j,domNode:A,isSelectable:$,nodeId:D,nodeClickDistance:L=0}){v=Bt(A);function Y({x:F,y:V}){const{nodeLookup:T,nodeExtent:B,snapGrid:E,snapToGrid:M,nodeOrigin:O,onNodeDrag:R,onSelectionDrag:Z,onError:ee,updateNodePositions:P}=a();u={x:F,y:V};let oe=!1;const ce=m.size>1,ue=ce&&B?Pf(Hs(m)):null,xe=ce&&M?sE({dragItems:m,snapGrid:E,x:F,y:V}):null;for(const[de,le]of m){if(!T.has(de))continue;let re={x:F-le.distance.x,y:V-le.distance.y};M&&(re=xe?{x:Math.round(re.x+xe.x),y:Math.round(re.y+xe.y)}:ks(re,E));let pe=null;if(ce&&B&&!le.extent&&ue){const{positionAbsolute:ge}=le.internals,we=ge.x-ue.x+B[0][0],Ee=ge.x+le.measured.width-ue.x2+B[1][0],Be=ge.y-ue.y+B[0][1],Je=ge.y+le.measured.height-ue.y2+B[1][1];pe=[[we,Be],[Ee,Je]]}const{position:Se,positionAbsolute:he}=Fy({nodeId:de,nextPosition:re,nodeLookup:T,nodeExtent:pe||B,nodeOrigin:O,onError:ee});oe=oe||le.position.x!==Se.x||le.position.y!==Se.y,le.position=Se,le.internals.positionAbsolute=he}if(w=w||oe,!!oe&&(P(m,!0),q&&(o||R||!D&&Z))){const[de,le]=Nf({nodeId:D,dragItems:m,nodeLookup:T});o?.(q,m,de,le),R?.(q,de,le),D||Z?.(q,le)}}async function G(){if(!x)return;const{transform:F,panBy:V,autoPanSpeed:T,autoPanOnNodeDrag:B}=a();if(!B){p=!1,cancelAnimationFrame(f);return}const[E,M]=Td(y,x,T);(E!==0||M!==0)&&(u.x=(u.x??0)-E/F[2],u.y=(u.y??0)-M/F[2],await V({x:E,y:M})&&Y(u)),f=requestAnimationFrame(G)}function te(F){const{nodeLookup:V,multiSelectionActive:T,nodesDraggable:B,transform:E,snapGrid:M,snapToGrid:O,selectNodesOnDrag:R,onNodeDragStart:Z,onSelectionDragStart:ee,unselectNodesAndEdges:P}=a();g=!0,(!R||!$)&&!T&&D&&(V.get(D)?.selected||P()),$&&R&&D&&n?.(D);const oe=vs(F.sourceEvent,{transform:E,snapGrid:M,snapToGrid:O,containerBounds:x});if(u=oe,m=iE(V,B,oe,D),m.size>0&&(s||Z||!D&&ee)){const[ce,ue]=Nf({nodeId:D,dragItems:m,nodeLookup:V});s?.(F.sourceEvent,m,ce,ue),Z?.(F.sourceEvent,ce,ue),D||ee?.(F.sourceEvent,ue)}}const I=Ty().clickDistance(L).on("start",F=>{const{domNode:V,nodeDragThreshold:T,transform:B,snapGrid:E,snapToGrid:M}=a();x=V?.getBoundingClientRect()||null,S=!1,w=!1,q=F.sourceEvent,T===0&&te(F),u=vs(F.sourceEvent,{transform:B,snapGrid:E,snapToGrid:M,containerBounds:x}),y=sn(F.sourceEvent,x)}).on("drag",F=>{const{autoPanOnNodeDrag:V,transform:T,snapGrid:B,snapToGrid:E,nodeDragThreshold:M,nodeLookup:O}=a(),R=vs(F.sourceEvent,{transform:T,snapGrid:B,snapToGrid:E,containerBounds:x});if(q=F.sourceEvent,(F.sourceEvent.type==="touchmove"&&F.sourceEvent.touches.length>1||D&&!O.has(D))&&(S=!0),!S){if(!p&&V&&g&&(p=!0,G()),!g){const Z=sn(F.sourceEvent,x),ee=Z.x-y.x,P=Z.y-y.y;Math.sqrt(ee*ee+P*P)>M&&te(F)}(u.x!==R.xSnapped||u.y!==R.ySnapped)&&m&&g&&(y=sn(F.sourceEvent,x),Y(R))}}).on("end",F=>{if(!g||S){S&&m.size>0&&a().updateNodePositions(m,!1);return}if(p=!1,g=!1,cancelAnimationFrame(f),m.size>0){const{nodeLookup:V,updateNodePositions:T,onNodeDragStop:B,onSelectionDragStop:E}=a();if(w&&(T(m,!1),w=!1),c||B||!D&&E){const[M,O]=Nf({nodeId:D,dragItems:m,nodeLookup:V,dragging:!1});c?.(F.sourceEvent,m,M,O),B?.(F.sourceEvent,M,O),D||E?.(F.sourceEvent,O)}}}).filter(F=>{const V=F.target;return!F.button&&(!k||!i0(V,`.${k}`,A))&&(!j||i0(V,j,A))});v.call(I)}function _(){v?.on(".drag",null)}return{update:C,destroy:_}}function cE(n,a,s){const o=[],c={x:n.x-s,y:n.y-s,width:s*2,height:s*2};for(const u of a.values())Oc(c,qs(u))>0&&o.push(u);return o}const rE=250;function uE(n,a,s,o){let c=[],u=1/0;const f=cE(n,s,a+rE);for(const m of f){const p=[...m.internals.handleBounds?.source??[],...m.internals.handleBounds?.target??[]];for(const y of p){if(o.nodeId===y.nodeId&&o.type===y.type&&o.id===y.id)continue;const{x,y:g}=ia(m,y,y.position,!0),v=Math.sqrt(Math.pow(x-n.x,2)+Math.pow(g-n.y,2));v>a||(v<u?(c=[{...y,x,y:g}],u=v):v===u&&c.push({...y,x,y:g}))}}if(!c.length)return null;if(c.length>1){const m=o.type==="source"?"target":"source";return c.find(p=>p.type===m)??c[0]}return c[0]}function pv(n,a,s,o,c,u=!1){const f=o.get(n);if(!f)return null;const m=c==="strict"?f.internals.handleBounds?.[a]:[...f.internals.handleBounds?.source??[],...f.internals.handleBounds?.target??[]],p=(s?m?.find(y=>y.id===s):m?.[0])??null;return p&&u?{...p,...ia(f,p,p.position,!0)}:p}function gv(n,a){return n||(a?.classList.contains("target")?"target":a?.classList.contains("source")?"source":null)}function fE(n,a){let s=null;return a?s=!0:n&&!a&&(s=!1),s}const yv=()=>!0;function dE(n,{connectionMode:a,connectionRadius:s,handleId:o,nodeId:c,edgeUpdaterType:u,isTarget:f,domNode:m,nodeLookup:p,lib:y,autoPanOnConnect:x,flowId:g,panBy:v,cancelConnection:S,onConnectStart:w,onConnect:q,onConnectEnd:C,isValidConnection:_=yv,onReconnectEnd:k,updateConnection:j,getTransform:A,getFromHandle:$,autoPanSpeed:D,dragThreshold:L=1,handleDomNode:Y}){const G=av(n.target);let te=0,I;const{x:F,y:V}=sn(n),T=gv(u,Y),B=m?.getBoundingClientRect();let E=!1;if(!B||!T)return;const M=pv(c,T,o,p,a);if(!M)return;let O=sn(n,B),R=!1,Z=null,ee=!1,P=null;function oe(){if(!x||!B)return;const[Se,he]=Td(O,B,D);v({x:Se,y:he}),te=requestAnimationFrame(oe)}const ce={...M,nodeId:c,type:T,position:M.position},ue=p.get(c);let de={inProgress:!0,isValid:null,from:ia(ue,ce,ye.Left,!0),fromHandle:ce,fromPosition:ce.position,fromNode:ue,to:O,toHandle:null,toPosition:Zg[ce.position],toNode:null,pointer:O};function le(){E=!0,j(de),w?.(n,{nodeId:c,handleId:o,handleType:T})}L===0&&le();function re(Se){if(!E){const{x:Je,y:pt}=sn(Se),ht=Je-F,se=pt-V;if(!(ht*ht+se*se>L*L))return;le()}if(!$()||!ce){pe(Se);return}const he=A();O=sn(Se,B),I=uE(Rs(O,he,!1,[1,1]),s,p,ce),R||(oe(),R=!0);const ge=vv(Se,{handle:I,connectionMode:a,fromNodeId:c,fromHandleId:o,fromType:f?"target":"source",isValidConnection:_,doc:G,lib:y,flowId:g,nodeLookup:p});P=ge.handleDomNode,Z=ge.connection,ee=fE(!!I,ge.isValid);const we=p.get(c),Ee=we?ia(we,ce,ye.Left,!0):de.from,Be={...de,from:Ee,isValid:ee,to:ge.toHandle&&ee?oi({x:ge.toHandle.x,y:ge.toHandle.y},he):O,toHandle:ge.toHandle,toPosition:ee&&ge.toHandle?ge.toHandle.position:Zg[ce.position],toNode:ge.toHandle?p.get(ge.toHandle.nodeId):null,pointer:O};j(Be),de=Be}function pe(Se){if(!("touches"in Se&&Se.touches.length>0)){if(E){(I||P)&&Z&&ee&&q?.(Z);const{inProgress:he,...ge}=de,we={...ge,toPosition:de.toHandle?de.toPosition:null};C?.(Se,we),u&&k?.(Se,we)}S(),cancelAnimationFrame(te),R=!1,ee=!1,Z=null,P=null,G.removeEventListener("mousemove",re),G.removeEventListener("mouseup",pe),G.removeEventListener("touchmove",re),G.removeEventListener("touchend",pe)}}G.addEventListener("mousemove",re),G.addEventListener("mouseup",pe),G.addEventListener("touchmove",re),G.addEventListener("touchend",pe)}function vv(n,{handle:a,connectionMode:s,fromNodeId:o,fromHandleId:c,fromType:u,doc:f,lib:m,flowId:p,isValidConnection:y=yv,nodeLookup:x}){const g=u==="target",v=a?f.querySelector(`.${m}-flow__handle[data-id="${p}-${a?.nodeId}-${a?.id}-${a?.type}"]`):null,{x:S,y:w}=sn(n),q=f.elementFromPoint(S,w),C=q?.classList.contains(`${m}-flow__handle`)?q:v,_={handleDomNode:C,isValid:!1,connection:null,toHandle:null};if(C){const k=gv(void 0,C),j=C.getAttribute("data-nodeid"),A=C.getAttribute("data-handleid"),$=C.classList.contains("connectable"),D=C.classList.contains("connectableend");if(!j||!k)return _;const L={source:g?j:o,sourceHandle:g?A:c,target:g?o:j,targetHandle:g?c:A};_.connection=L;const G=$&&D&&(s===ii.Strict?g&&k==="source"||!g&&k==="target":j!==o||A!==c);_.isValid=G&&y(L),_.toHandle=pv(j,k,A,x,s,!0)}return _}const ld={onPointerDown:dE,isValid:vv};function hE({domNode:n,panZoom:a,getTransform:s,getViewScale:o}){const c=Bt(n);function u({translateExtent:m,width:p,height:y,zoomStep:x=1,pannable:g=!0,zoomable:v=!0,inversePan:S=!1}){const w=j=>{if(j.sourceEvent.type!=="wheel"||!a)return;const A=s(),$=j.sourceEvent.ctrlKey&&Cs()?10:1,D=-j.sourceEvent.deltaY*(j.sourceEvent.deltaMode===1?.05:j.sourceEvent.deltaMode?1:.002)*x,L=A[2]*Math.pow(2,D*$);a.scaleTo(L)};let q=[0,0];const C=j=>{(j.sourceEvent.type==="mousedown"||j.sourceEvent.type==="touchstart")&&(q=[j.sourceEvent.clientX??j.sourceEvent.touches[0].clientX,j.sourceEvent.clientY??j.sourceEvent.touches[0].clientY])},_=j=>{const A=s();if(j.sourceEvent.type!=="mousemove"&&j.sourceEvent.type!=="touchmove"||!a)return;const $=[j.sourceEvent.clientX??j.sourceEvent.touches[0].clientX,j.sourceEvent.clientY??j.sourceEvent.touches[0].clientY],D=[$[0]-q[0],$[1]-q[1]];q=$;const L=o()*Math.max(A[2],Math.log(A[2]))*(S?-1:1),Y={x:A[0]-D[0]*L,y:A[1]-D[1]*L},G=[[0,0],[p,y]];a.setViewportConstrained({x:Y.x,y:Y.y,zoom:A[2]},G,m)},k=Iy().on("start",C).on("zoom",g?_:null).on("zoom.wheel",v?w:null);c.call(k,{})}function f(){c.on("zoom",null)}return{update:u,destroy:f,pointer:nn}}const Ic=n=>({x:n.x,y:n.y,zoom:n.k}),jf=({x:n,y:a,zoom:s})=>Vc.translate(n,a).scale(s),Ja=(n,a)=>n.target.closest(`.${a}`),xv=(n,a)=>a===2&&Array.isArray(n)&&n.includes(2),mE=n=>((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2,Ef=(n,a=0,s=mE,o=()=>{})=>{const c=typeof a=="number"&&a>0;return c||o(),c?n.transition().duration(a).ease(s).on("end",o):n},bv=n=>{const a=n.ctrlKey&&Cs()?10:1;return-n.deltaY*(n.deltaMode===1?.05:n.deltaMode?1:.002)*a};function pE({zoomPanValues:n,noWheelClassName:a,d3Selection:s,d3Zoom:o,panOnScrollMode:c,panOnScrollSpeed:u,zoomOnPinch:f,onPanZoomStart:m,onPanZoom:p,onPanZoomEnd:y}){return x=>{if(Ja(x,a))return x.ctrlKey&&x.preventDefault(),!1;x.preventDefault(),x.stopImmediatePropagation();const g=s.property("__zoom").k||1;if(x.ctrlKey&&f){const C=nn(x),_=bv(x),k=g*Math.pow(2,_);o.scaleTo(s,k,C,x);return}const v=x.deltaMode===1?20:1;let S=c===ea.Vertical?0:x.deltaX*v,w=c===ea.Horizontal?0:x.deltaY*v;!Cs()&&x.shiftKey&&c!==ea.Vertical&&(S=x.deltaY*v,w=0),o.translateBy(s,-(S/g)*u,-(w/g)*u,{internal:!0});const q=Ic(s.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling?(p?.(x,q),n.panScrollTimeout=setTimeout(()=>{y?.(x,q),n.isPanScrolling=!1},150)):(n.isPanScrolling=!0,m?.(x,q))}}function gE({noWheelClassName:n,preventScrolling:a,d3ZoomHandler:s}){return function(o,c){const u=o.type==="wheel",f=!a&&u&&!o.ctrlKey,m=Ja(o,n);if(o.ctrlKey&&u&&m&&o.preventDefault(),f||m)return null;o.preventDefault(),s.call(this,o,c)}}function yE({zoomPanValues:n,onDraggingChange:a,onPanZoomStart:s}){return o=>{if(o.sourceEvent?.internal)return;const c=Ic(o.transform);n.mouseButton=o.sourceEvent?.button||0,n.isZoomingOrPanning=!0,n.prevViewport=c,o.sourceEvent?.type==="mousedown"&&a(!0),s&&s?.(o.sourceEvent,c)}}function vE({zoomPanValues:n,panOnDrag:a,onPaneContextMenu:s,onTransformChange:o,onPanZoom:c}){return u=>{n.usedRightMouseButton=!!(s&&xv(a,n.mouseButton??0)),u.sourceEvent?.sync||o([u.transform.x,u.transform.y,u.transform.k]),c&&!u.sourceEvent?.internal&&c?.(u.sourceEvent,Ic(u.transform))}}function xE({zoomPanValues:n,panOnDrag:a,panOnScroll:s,onDraggingChange:o,onPanZoomEnd:c,onPaneContextMenu:u}){return f=>{if(!f.sourceEvent?.internal&&(n.isZoomingOrPanning=!1,u&&xv(a,n.mouseButton??0)&&!n.usedRightMouseButton&&f.sourceEvent&&u(f.sourceEvent),n.usedRightMouseButton=!1,o(!1),c)){const m=Ic(f.transform);n.prevViewport=m,clearTimeout(n.timerId),n.timerId=setTimeout(()=>{c?.(f.sourceEvent,m)},s?150:0)}}}function bE({zoomActivationKeyPressed:n,zoomOnScroll:a,zoomOnPinch:s,panOnDrag:o,panOnScroll:c,zoomOnDoubleClick:u,userSelectionActive:f,noWheelClassName:m,noPanClassName:p,lib:y,connectionInProgress:x}){return g=>{const v=n||a,S=s&&g.ctrlKey,w=g.type==="wheel";if(g.button===1&&g.type==="mousedown"&&(Ja(g,`${y}-flow__node`)||Ja(g,`${y}-flow__edge`)))return!0;if(!o&&!v&&!c&&!u&&!s||f||x&&!w||Ja(g,m)&&w||Ja(g,p)&&(!w||c&&w&&!n)||!s&&g.ctrlKey&&w)return!1;if(!s&&g.type==="touchstart"&&g.touches?.length>1)return g.preventDefault(),!1;if(!v&&!c&&!S&&w||!o&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(o)&&!o.includes(g.button)&&g.type==="mousedown")return!1;const q=Array.isArray(o)&&o.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||w)&&q}}function SE({domNode:n,minZoom:a,maxZoom:s,translateExtent:o,viewport:c,onPanZoom:u,onPanZoomStart:f,onPanZoomEnd:m,onDraggingChange:p}){const y={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},x=n.getBoundingClientRect(),g=Iy().scaleExtent([a,s]).translateExtent(o),v=Bt(n).call(g);k({x:c.x,y:c.y,zoom:si(c.zoom,a,s)},[[0,0],[x.width,x.height]],o);const S=v.on("wheel.zoom"),w=v.on("dblclick.zoom");g.wheelDelta(bv);async function q(I,F){return v?new Promise(V=>{g?.interpolate(F?.interpolate==="linear"?ys:Sc).transform(Ef(v,F?.duration,F?.ease,()=>V(!0)),I)}):!1}function C({noWheelClassName:I,noPanClassName:F,onPaneContextMenu:V,userSelectionActive:T,panOnScroll:B,panOnDrag:E,panOnScrollMode:M,panOnScrollSpeed:O,preventScrolling:R,zoomOnPinch:Z,zoomOnScroll:ee,zoomOnDoubleClick:P,zoomActivationKeyPressed:oe,lib:ce,onTransformChange:ue,connectionInProgress:xe,paneClickDistance:de,selectionOnDrag:le}){T&&!y.isZoomingOrPanning&&_();const re=B&&!oe&&!T;g.clickDistance(le?1/0:!an(de)||de<0?0:de);const pe=re?pE({zoomPanValues:y,noWheelClassName:I,d3Selection:v,d3Zoom:g,panOnScrollMode:M,panOnScrollSpeed:O,zoomOnPinch:Z,onPanZoomStart:f,onPanZoom:u,onPanZoomEnd:m}):gE({noWheelClassName:I,preventScrolling:R,d3ZoomHandler:S});v.on("wheel.zoom",pe,{passive:!1});const Se=yE({zoomPanValues:y,onDraggingChange:p,onPanZoomStart:f});g.on("start",Se);const he=vE({zoomPanValues:y,panOnDrag:E,onPaneContextMenu:!!V,onPanZoom:u,onTransformChange:ue});g.on("zoom",he);const ge=xE({zoomPanValues:y,panOnDrag:E,panOnScroll:B,onPaneContextMenu:V,onPanZoomEnd:m,onDraggingChange:p});g.on("end",ge);const we=bE({zoomActivationKeyPressed:oe,panOnDrag:E,zoomOnScroll:ee,panOnScroll:B,zoomOnDoubleClick:P,zoomOnPinch:Z,userSelectionActive:T,noPanClassName:F,noWheelClassName:I,lib:ce,connectionInProgress:xe});g.filter(we),P?v.on("dblclick.zoom",w):v.on("dblclick.zoom",null)}function _(){g.on("zoom",null)}async function k(I,F,V){const T=jf(I),B=g?.constrain()(T,F,V);return B&&await q(B),B}async function j(I,F){const V=jf(I);return await q(V,F),V}function A(I){if(v){const F=jf(I),V=v.property("__zoom");(V.k!==I.zoom||V.x!==I.x||V.y!==I.y)&&g?.transform(v,F,null,{sync:!0})}}function $(){const I=v?Xy(v.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}async function D(I,F){return v?new Promise(V=>{g?.interpolate(F?.interpolate==="linear"?ys:Sc).scaleTo(Ef(v,F?.duration,F?.ease,()=>V(!0)),I)}):!1}async function L(I,F){return v?new Promise(V=>{g?.interpolate(F?.interpolate==="linear"?ys:Sc).scaleBy(Ef(v,F?.duration,F?.ease,()=>V(!0)),I)}):!1}function Y(I){g?.scaleExtent(I)}function G(I){g?.translateExtent(I)}function te(I){const F=!an(I)||I<0?0:I;g?.clickDistance(F)}return{update:C,destroy:_,setViewport:j,setViewportConstrained:k,getViewport:$,scaleTo:D,scaleBy:L,setScaleExtent:Y,setTranslateExtent:G,syncViewport:A,setClickDistance:te}}var ci;(function(n){n.Line="line",n.Handle="handle"})(ci||(ci={}));function wE({width:n,prevWidth:a,height:s,prevHeight:o,affectsX:c,affectsY:u}){const f=n-a,m=s-o,p=[f>0?1:f<0?-1:0,m>0?1:m<0?-1:0];return f&&c&&(p[0]=p[0]*-1),m&&u&&(p[1]=p[1]*-1),p}function s0(n){const a=n.includes("right")||n.includes("left"),s=n.includes("bottom")||n.includes("top"),o=n.includes("left"),c=n.includes("top");return{isHorizontal:a,isVertical:s,affectsX:o,affectsY:c}}function wl(n,a){return Math.max(0,a-n)}function Nl(n,a){return Math.max(0,n-a)}function pc(n,a,s){return Math.max(0,a-n,n-s)}function o0(n,a){return n?!a:a}function NE(n,a,s,o,c,u,f,m){let{affectsX:p,affectsY:y}=a;const{isHorizontal:x,isVertical:g}=a,v=x&&g,{xSnapped:S,ySnapped:w}=s,{minWidth:q,maxWidth:C,minHeight:_,maxHeight:k}=o,{x:j,y:A,width:$,height:D,aspectRatio:L}=n;let Y=Math.floor(x?S-n.pointerX:0),G=Math.floor(g?w-n.pointerY:0);const te=$+(p?-Y:Y),I=D+(y?-G:G),F=-u[0]*$,V=-u[1]*D;let T=pc(te,q,C),B=pc(I,_,k);if(f){let O=0,R=0;p&&Y<0?O=wl(j+Y+F,f[0][0]):!p&&Y>0&&(O=Nl(j+te+F,f[1][0])),y&&G<0?R=wl(A+G+V,f[0][1]):!y&&G>0&&(R=Nl(A+I+V,f[1][1])),T=Math.max(T,O),B=Math.max(B,R)}if(m){let O=0,R=0;p&&Y>0?O=Nl(j+Y,m[0][0]):!p&&Y<0&&(O=wl(j+te,m[1][0])),y&&G>0?R=Nl(A+G,m[0][1]):!y&&G<0&&(R=wl(A+I,m[1][1])),T=Math.max(T,O),B=Math.max(B,R)}if(c){if(x){const O=pc(te/L,_,k)*L;if(T=Math.max(T,O),f){let R=0;!p&&!y||p&&!y&&v?R=Nl(A+V+te/L,f[1][1])*L:R=wl(A+V+(p?Y:-Y)/L,f[0][1])*L,T=Math.max(T,R)}if(m){let R=0;!p&&!y||p&&!y&&v?R=wl(A+te/L,m[1][1])*L:R=Nl(A+(p?Y:-Y)/L,m[0][1])*L,T=Math.max(T,R)}}if(g){const O=pc(I*L,q,C)/L;if(B=Math.max(B,O),f){let R=0;!p&&!y||y&&!p&&v?R=Nl(j+I*L+F,f[1][0])/L:R=wl(j+(y?G:-G)*L+F,f[0][0])/L,B=Math.max(B,R)}if(m){let R=0;!p&&!y||y&&!p&&v?R=wl(j+I*L,m[1][0])/L:R=Nl(j+(y?G:-G)*L,m[0][0])/L,B=Math.max(B,R)}}}G=G+(G<0?B:-B),Y=Y+(Y<0?T:-T),c&&(v?te>I*L?G=(o0(p,y)?-Y:Y)/L:Y=(o0(p,y)?-G:G)*L:x?(G=Y/L,y=p):(Y=G*L,p=y));const E=p?j+Y:j,M=y?A+G:A;return{width:$+(p?-Y:Y),height:D+(y?-G:G),x:u[0]*Y*(p?-1:1)+E,y:u[1]*G*(y?-1:1)+M}}const Sv={width:0,height:0,x:0,y:0},jE={...Sv,pointerX:0,pointerY:0,aspectRatio:1};function EE(n,a,s){const o=a.position.x+n.position.x,c=a.position.y+n.position.y,u=n.measured.width??0,f=n.measured.height??0,m=s[0]*u,p=s[1]*f;return[[o-m,c-p],[o+u-m,c+f-p]]}function _E({domNode:n,nodeId:a,getStoreItems:s,onChange:o,onEnd:c}){const u=Bt(n);let f={controlDirection:s0("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function m({controlPosition:y,boundaries:x,keepAspectRatio:g,resizeDirection:v,onResizeStart:S,onResize:w,onResizeEnd:q,shouldResize:C}){let _={...Sv},k={...jE};f={boundaries:x,resizeDirection:v,keepAspectRatio:g,controlDirection:s0(y)};let j,A=null,$=[],D,L,Y,G=!1;const te=Ty().on("start",I=>{const{nodeLookup:F,transform:V,snapGrid:T,snapToGrid:B,nodeOrigin:E,paneDomNode:M}=s();if(j=F.get(a),!j)return;A=M?.getBoundingClientRect()??null;const{xSnapped:O,ySnapped:R}=vs(I.sourceEvent,{transform:V,snapGrid:T,snapToGrid:B,containerBounds:A});_={width:j.measured.width??0,height:j.measured.height??0,x:j.position.x??0,y:j.position.y??0},k={..._,pointerX:O,pointerY:R,aspectRatio:_.width/_.height},D=void 0,L=aa(j.extent)?j.extent:void 0,j.parentId&&(j.extent==="parent"||j.expandParent)&&(D=F.get(j.parentId)),D&&j.extent==="parent"&&(L=[[0,0],[D.measured.width,D.measured.height]]),$=[],Y=void 0;for(const[Z,ee]of F)if(ee.parentId===a&&($.push({id:Z,position:{...ee.position},extent:ee.extent}),ee.extent==="parent"||ee.expandParent)){const P=EE(ee,j,ee.origin??E);Y?Y=[[Math.min(P[0][0],Y[0][0]),Math.min(P[0][1],Y[0][1])],[Math.max(P[1][0],Y[1][0]),Math.max(P[1][1],Y[1][1])]]:Y=P}S?.(I,{..._})}).on("drag",I=>{const{transform:F,snapGrid:V,snapToGrid:T,nodeOrigin:B}=s(),E=vs(I.sourceEvent,{transform:F,snapGrid:V,snapToGrid:T,containerBounds:A}),M=[];if(!j)return;const{x:O,y:R,width:Z,height:ee}=_,P={},oe=j.origin??B,{width:ce,height:ue,x:xe,y:de}=NE(k,f.controlDirection,E,f.boundaries,f.keepAspectRatio,oe,L,Y),le=ce!==Z,re=ue!==ee,pe=xe!==O&&le,Se=de!==R&&re;if(!pe&&!Se&&!le&&!re)return;if((pe||Se||oe[0]===1||oe[1]===1)&&(P.x=pe?xe:_.x,P.y=Se?de:_.y,_.x=P.x,_.y=P.y,$.length>0)){const Ee=xe-O,Be=de-R;for(const Je of $)Je.position={x:Je.position.x-Ee+oe[0]*(ce-Z),y:Je.position.y-Be+oe[1]*(ue-ee)},M.push(Je)}if((le||re)&&(P.width=le&&(!f.resizeDirection||f.resizeDirection==="horizontal")?ce:_.width,P.height=re&&(!f.resizeDirection||f.resizeDirection==="vertical")?ue:_.height,_.width=P.width,_.height=P.height),D&&j.expandParent){const Ee=oe[0]*(P.width??0);P.x&&P.x<Ee&&(_.x=Ee,k.x=k.x-(P.x-Ee));const Be=oe[1]*(P.height??0);P.y&&P.y<Be&&(_.y=Be,k.y=k.y-(P.y-Be))}const he=wE({width:_.width,prevWidth:Z,height:_.height,prevHeight:ee,affectsX:f.controlDirection.affectsX,affectsY:f.controlDirection.affectsY}),ge={..._,direction:he};C?.(I,ge)!==!1&&(G=!0,w?.(I,ge),o(P,M))}).on("end",I=>{G&&(q?.(I,{..._}),c?.({..._}),G=!1)});u.call(te)}function p(){u.on(".drag",null)}return{update:m,destroy:p}}var _f={exports:{}},qf={},Cf={exports:{}},Mf={};/**
|
|
26
|
-
* @license React
|
|
27
|
-
* use-sync-external-store-shim.production.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Meta Platforms, Inc. and 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 c0;function qE(){if(c0)return Mf;c0=1;var n=rd();function a(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}var s=typeof Object.is=="function"?Object.is:a,o=n.useState,c=n.useEffect,u=n.useLayoutEffect,f=n.useDebugValue;function m(g,v){var S=v(),w=o({inst:{value:S,getSnapshot:v}}),q=w[0].inst,C=w[1];return u(function(){q.value=S,q.getSnapshot=v,p(q)&&C({inst:q})},[g,S,v]),c(function(){return p(q)&&C({inst:q}),g(function(){p(q)&&C({inst:q})})},[g]),f(S),S}function p(g){var v=g.getSnapshot;g=g.value;try{var S=v();return!s(g,S)}catch{return!0}}function y(g,v){return v()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?y:m;return Mf.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:x,Mf}var r0;function CE(){return r0||(r0=1,Cf.exports=qE()),Cf.exports}/**
|
|
34
|
-
* @license React
|
|
35
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var u0;function ME(){if(u0)return qf;u0=1;var n=rd(),a=CE();function s(y,x){return y===x&&(y!==0||1/y===1/x)||y!==y&&x!==x}var o=typeof Object.is=="function"?Object.is:s,c=a.useSyncExternalStore,u=n.useRef,f=n.useEffect,m=n.useMemo,p=n.useDebugValue;return qf.useSyncExternalStoreWithSelector=function(y,x,g,v,S){var w=u(null);if(w.current===null){var q={hasValue:!1,value:null};w.current=q}else q=w.current;w=m(function(){function _(D){if(!k){if(k=!0,j=D,D=v(D),S!==void 0&&q.hasValue){var L=q.value;if(S(L,D))return A=L}return A=D}if(L=A,o(j,D))return L;var Y=v(D);return S!==void 0&&S(L,Y)?(j=D,L):(j=D,A=Y)}var k=!1,j,A,$=g===void 0?null:g;return[function(){return _(x())},$===null?void 0:function(){return _($())}]},[x,g,v,S]);var C=c(y,w[0],w[1]);return f(function(){q.hasValue=!0,q.value=C},[C]),p(C),C},qf}var f0;function TE(){return f0||(f0=1,_f.exports=ME()),_f.exports}var AE=TE();const zE=V1(AE),DE={},d0=n=>{let a;const s=new Set,o=(x,g)=>{const v=typeof x=="function"?x(a):x;if(!Object.is(v,a)){const S=a;a=g??(typeof v!="object"||v===null)?v:Object.assign({},a,v),s.forEach(w=>w(a,S))}},c=()=>a,p={setState:o,getState:c,getInitialState:()=>y,subscribe:x=>(s.add(x),()=>s.delete(x)),destroy:()=>{(DE?"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."),s.clear()}},y=a=n(o,c,p);return p},OE=n=>n?d0(n):d0,{useDebugValue:HE}=P0,{useSyncExternalStoreWithSelector:kE}=zE,RE=n=>n;function wv(n,a=RE,s){const o=kE(n.subscribe,n.getState,n.getServerState||n.getInitialState,a,s);return HE(o),o}const h0=(n,a)=>{const s=OE(n),o=(c,u=a)=>wv(s,c,u);return Object.assign(o,s),o},BE=(n,a)=>n?h0(n,a):h0;function Ge(n,a){if(Object.is(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;if(n instanceof Map&&a instanceof Map){if(n.size!==a.size)return!1;for(const[o,c]of n)if(!Object.is(c,a.get(o)))return!1;return!0}if(n instanceof Set&&a instanceof Set){if(n.size!==a.size)return!1;for(const o of n)if(!a.has(o))return!1;return!0}const s=Object.keys(n);if(s.length!==Object.keys(a).length)return!1;for(const o of s)if(!Object.prototype.hasOwnProperty.call(a,o)||!Object.is(n[o],a[o]))return!1;return!0}var UE=ay();const Gc=z.createContext(null),LE=Gc.Provider,Nv=on.error001("react");function Ae(n,a){const s=z.useContext(Gc);if(s===null)throw new Error(Nv);return wv(s,n,a)}function Ze(){const n=z.useContext(Gc);if(n===null)throw new Error(Nv);return z.useMemo(()=>({getState:n.getState,setState:n.setState,subscribe:n.subscribe}),[n])}const m0={display:"none"},$E={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},jv="react-flow__node-desc",Ev="react-flow__edge-desc",VE="react-flow__aria-live",YE=n=>n.ariaLiveMessage,XE=n=>n.ariaLabelConfig;function IE({rfId:n}){const a=Ae(YE);return d.jsx("div",{id:`${VE}-${n}`,"aria-live":"assertive","aria-atomic":"true",style:$E,children:a})}function GE({rfId:n,disableKeyboardA11y:a}){const s=Ae(XE);return d.jsxs(d.Fragment,{children:[d.jsx("div",{id:`${jv}-${n}`,style:m0,children:a?s["node.a11yDescription.default"]:s["node.a11yDescription.keyboardDisabled"]}),d.jsx("div",{id:`${Ev}-${n}`,style:m0,children:s["edge.a11yDescription.default"]}),!a&&d.jsx(IE,{rfId:n})]})}const Zc=z.forwardRef(({position:n="top-left",children:a,className:s,style:o,...c},u)=>{const f=`${n}`.split("-");return d.jsx("div",{className:it(["react-flow__panel",s,...f]),style:o,ref:u,...c,children:a})});Zc.displayName="Panel";const p0="https://reactflow.dev?utm_source=attribution";function ZE({proOptions:n,position:a="bottom-right"}){return n?.hideAttribution?null:d.jsx(Zc,{position:a,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${p0}`,children:d.jsx("a",{href:p0,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const QE=n=>{const a=[],s=[];for(const[,o]of n.nodeLookup)o.selected&&a.push(o.internals.userNode);for(const[,o]of n.edgeLookup)o.selected&&s.push(o);return{selectedNodes:a,selectedEdges:s}},gc=n=>n.id;function KE(n,a){return Ge(n.selectedNodes.map(gc),a.selectedNodes.map(gc))&&Ge(n.selectedEdges.map(gc),a.selectedEdges.map(gc))}function JE({onSelectionChange:n}){const a=Ze(),{selectedNodes:s,selectedEdges:o}=Ae(QE,KE);return z.useEffect(()=>{const c={nodes:s,edges:o};n?.(c),a.getState().onSelectionChangeHandlers.forEach(u=>u(c))},[s,o,n]),null}const FE=n=>!!n.onSelectionChangeHandlers;function WE({onSelectionChange:n}){const a=Ae(FE);return n||a?d.jsx(JE,{onSelectionChange:n}):null}const _v=[0,0],PE={x:0,y:0,zoom:1},e_=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],g0=[...e_,"rfId"],t_=n=>({setNodes:n.setNodes,setEdges:n.setEdges,setMinZoom:n.setMinZoom,setMaxZoom:n.setMaxZoom,setTranslateExtent:n.setTranslateExtent,setNodeExtent:n.setNodeExtent,reset:n.reset,setDefaultNodesAndEdges:n.setDefaultNodesAndEdges}),y0={translateExtent:js,nodeOrigin:_v,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function n_(n){const{setNodes:a,setEdges:s,setMinZoom:o,setMaxZoom:c,setTranslateExtent:u,setNodeExtent:f,reset:m,setDefaultNodesAndEdges:p}=Ae(t_,Ge),y=Ze();z.useEffect(()=>(p(n.defaultNodes,n.defaultEdges),()=>{x.current=y0,m()}),[]);const x=z.useRef(y0);return z.useEffect(()=>{for(const g of g0){const v=n[g],S=x.current[g];v!==S&&(typeof n[g]>"u"||(g==="nodes"?a(v):g==="edges"?s(v):g==="minZoom"?o(v):g==="maxZoom"?c(v):g==="translateExtent"?u(v):g==="nodeExtent"?f(v):g==="ariaLabelConfig"?y.setState({ariaLabelConfig:U2(v)}):g==="fitView"?y.setState({fitViewQueued:v}):g==="fitViewOptions"?y.setState({fitViewOptions:v}):y.setState({[g]:v})))}x.current=n},g0.map(g=>n[g])),null}function v0(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function l_(n){const[a,s]=z.useState(n==="system"?null:n);return z.useEffect(()=>{if(n!=="system"){s(n);return}const o=v0(),c=()=>s(o?.matches?"dark":"light");return c(),o?.addEventListener("change",c),()=>{o?.removeEventListener("change",c)}},[n]),a!==null?a:v0()?.matches?"dark":"light"}const x0=typeof document<"u"?document:null;function Ms(n=null,a={target:x0,actInsideInputWithModifier:!0}){const[s,o]=z.useState(!1),c=z.useRef(!1),u=z.useRef(new Set([])),[f,m]=z.useMemo(()=>{if(n!==null){const y=(Array.isArray(n)?n:[n]).filter(g=>typeof g=="string").map(g=>g.replace("+",`
|
|
42
|
-
`).replace(`
|
|
43
|
-
|
|
44
|
-
`,`
|
|
45
|
-
+`).split(`
|
|
46
|
-
`)),x=y.reduce((g,v)=>g.concat(...v),[]);return[y,x]}return[[],[]]},[n]);return z.useEffect(()=>{const p=a?.target??x0,y=a?.actInsideInputWithModifier??!0;if(n!==null){const x=S=>{if(c.current=S.ctrlKey||S.metaKey||S.shiftKey||S.altKey,(!c.current||c.current&&!y)&&iv(S))return!1;const q=S0(S.code,m);if(u.current.add(S[q]),b0(f,u.current,!1)){const C=S.composedPath?.()?.[0]||S.target,_=C?.nodeName==="BUTTON"||C?.nodeName==="A";a.preventDefault!==!1&&(c.current||!_)&&S.preventDefault(),o(!0)}},g=S=>{const w=S0(S.code,m);b0(f,u.current,!0)?(o(!1),u.current.clear()):u.current.delete(S[w]),S.key==="Meta"&&u.current.clear(),c.current=!1},v=()=>{u.current.clear(),o(!1)};return p?.addEventListener("keydown",x),p?.addEventListener("keyup",g),window.addEventListener("blur",v),window.addEventListener("contextmenu",v),()=>{p?.removeEventListener("keydown",x),p?.removeEventListener("keyup",g),window.removeEventListener("blur",v),window.removeEventListener("contextmenu",v)}}},[n,o]),s}function b0(n,a,s){return n.filter(o=>s||o.length===a.size).some(o=>o.every(c=>a.has(c)))}function S0(n,a){return a.includes(n)?"code":"key"}const a_=()=>{const n=Ze();return z.useMemo(()=>({zoomIn:async a=>{const{panZoom:s}=n.getState();return s?s.scaleBy(1.2,a):!1},zoomOut:async a=>{const{panZoom:s}=n.getState();return s?s.scaleBy(1/1.2,a):!1},zoomTo:async(a,s)=>{const{panZoom:o}=n.getState();return o?o.scaleTo(a,s):!1},getZoom:()=>n.getState().transform[2],setViewport:async(a,s)=>{const{transform:[o,c,u],panZoom:f}=n.getState();return f?(await f.setViewport({x:a.x??o,y:a.y??c,zoom:a.zoom??u},s),!0):!1},getViewport:()=>{const[a,s,o]=n.getState().transform;return{x:a,y:s,zoom:o}},setCenter:async(a,s,o)=>n.getState().setCenter(a,s,o),fitBounds:async(a,s)=>{const{width:o,height:c,minZoom:u,maxZoom:f,panZoom:m}=n.getState(),p=Ad(a,o,c,u,f,s?.padding??.1);return m?(await m.setViewport(p,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0):!1},screenToFlowPosition:(a,s={})=>{const{transform:o,snapGrid:c,snapToGrid:u,domNode:f}=n.getState();if(!f)return a;const{x:m,y:p}=f.getBoundingClientRect(),y={x:a.x-m,y:a.y-p},x=s.snapGrid??c,g=s.snapToGrid??u;return Rs(y,o,g,x)},flowToScreenPosition:a=>{const{transform:s,domNode:o}=n.getState();if(!o)return a;const{x:c,y:u}=o.getBoundingClientRect(),f=oi(a,s);return{x:f.x+c,y:f.y+u}}}),[])};function qv(n,a){const s=[],o=new Map,c=[];for(const u of n)if(u.type==="add"){c.push(u);continue}else if(u.type==="remove"||u.type==="replace")o.set(u.id,[u]);else{const f=o.get(u.id);f?f.push(u):o.set(u.id,[u])}for(const u of a){const f=o.get(u.id);if(!f){s.push(u);continue}if(f[0].type==="remove")continue;if(f[0].type==="replace"){s.push({...f[0].item});continue}const m={...u};for(const p of f)i_(p,m);s.push(m)}return c.length&&c.forEach(u=>{u.index!==void 0?s.splice(u.index,0,{...u.item}):s.push({...u.item})}),s}function i_(n,a){switch(n.type){case"select":{a.selected=n.selected;break}case"position":{typeof n.position<"u"&&(a.position=n.position),typeof n.dragging<"u"&&(a.dragging=n.dragging);break}case"dimensions":{typeof n.dimensions<"u"&&(a.measured={...n.dimensions},n.setAttributes&&((n.setAttributes===!0||n.setAttributes==="width")&&(a.width=n.dimensions.width),(n.setAttributes===!0||n.setAttributes==="height")&&(a.height=n.dimensions.height))),typeof n.resizing=="boolean"&&(a.resizing=n.resizing);break}}}function Cv(n,a){return qv(n,a)}function Mv(n,a){return qv(n,a)}function Kl(n,a){return{id:n,type:"select",selected:a}}function Fa(n,a=new Set,s=!1){const o=[];for(const[c,u]of n){const f=a.has(c);!(u.selected===void 0&&!f)&&u.selected!==f&&(s&&(u.selected=f),o.push(Kl(u.id,f)))}return o}function w0({items:n=[],lookup:a}){const s=[],o=new Map(n.map(c=>[c.id,c]));for(const[c,u]of n.entries()){const f=a.get(u.id),m=f?.internals?.userNode??f;m!==void 0&&m!==u&&s.push({id:u.id,item:u,type:"replace"}),m===void 0&&s.push({item:u,type:"add",index:c})}for(const[c]of a)o.get(c)===void 0&&s.push({id:c,type:"remove"});return s}function N0(n){return{id:n.id,type:"remove"}}const s_=tv();function o_(n,a,s={}){return I2(n,a,{...s,onError:s.onError??s_})}const j0=n=>T2(n),c_=n=>Jy(n);function Tv(n){return z.forwardRef(n)}const r_=typeof window<"u"?z.useLayoutEffect:z.useEffect;function E0(n){const[a,s]=z.useState(BigInt(0)),[o]=z.useState(()=>u_(()=>s(c=>c+BigInt(1))));return r_(()=>{const c=o.get();c.length&&(n(c),o.reset())},[a]),o}function u_(n){let a=[];return{get:()=>a,reset:()=>{a=[]},push:s=>{a.push(s),n()}}}const Av=z.createContext(null);function f_({children:n}){const a=Ze(),s=z.useCallback(m=>{const{nodes:p=[],setNodes:y,hasDefaultNodes:x,onNodesChange:g,nodeLookup:v,fitViewQueued:S,onNodesChangeMiddlewareMap:w}=a.getState();let q=p;for(const _ of m)q=typeof _=="function"?_(q):_;let C=w0({items:q,lookup:v});for(const _ of w.values())C=_(C);x&&y(q),C.length>0?g?.(C):S&&window.requestAnimationFrame(()=>{const{fitViewQueued:_,nodes:k,setNodes:j}=a.getState();_&&j(k)})},[]),o=E0(s),c=z.useCallback(m=>{const{edges:p=[],setEdges:y,hasDefaultEdges:x,onEdgesChange:g,edgeLookup:v}=a.getState();let S=p;for(const w of m)S=typeof w=="function"?w(S):w;x?y(S):g&&g(w0({items:S,lookup:v}))},[]),u=E0(c),f=z.useMemo(()=>({nodeQueue:o,edgeQueue:u}),[]);return d.jsx(Av.Provider,{value:f,children:n})}function d_(){const n=z.useContext(Av);if(!n)throw new Error("useBatchContext must be used within a BatchProvider");return n}const h_=n=>!!n.panZoom;function Qc(){const n=a_(),a=Ze(),s=d_(),o=Ae(h_),c=z.useMemo(()=>{const u=g=>a.getState().nodeLookup.get(g),f=g=>{s.nodeQueue.push(g)},m=g=>{s.edgeQueue.push(g)},p=g=>{const{nodeLookup:v,nodeOrigin:S}=a.getState(),w=j0(g)?g:v.get(g.id),q=w.parentId?lv(w.position,w.measured,w.parentId,v,S):w.position,C={...w,position:q,width:w.measured?.width??w.width,height:w.measured?.height??w.height};return qs(C)},y=(g,v,S={replace:!1})=>{f(w=>w.map(q=>{if(q.id===g){const C=typeof v=="function"?v(q):v;return S.replace&&j0(C)?C:{...q,...C}}return q}))},x=(g,v,S={replace:!1})=>{m(w=>w.map(q=>{if(q.id===g){const C=typeof v=="function"?v(q):v;return S.replace&&c_(C)?C:{...q,...C}}return q}))};return{getNodes:()=>a.getState().nodes.map(g=>({...g})),getNode:g=>u(g)?.internals.userNode,getInternalNode:u,getEdges:()=>{const{edges:g=[]}=a.getState();return g.map(v=>({...v}))},getEdge:g=>a.getState().edgeLookup.get(g),setNodes:f,setEdges:m,addNodes:g=>{const v=Array.isArray(g)?g:[g];s.nodeQueue.push(S=>[...S,...v])},addEdges:g=>{const v=Array.isArray(g)?g:[g];s.edgeQueue.push(S=>[...S,...v])},toObject:()=>{const{nodes:g=[],edges:v=[],transform:S}=a.getState(),[w,q,C]=S;return{nodes:g.map(_=>({..._})),edges:v.map(_=>({..._})),viewport:{x:w,y:q,zoom:C}}},deleteElements:async({nodes:g=[],edges:v=[]})=>{const{nodes:S,edges:w,onNodesDelete:q,onEdgesDelete:C,triggerNodeChanges:_,triggerEdgeChanges:k,onDelete:j,onBeforeDelete:A}=a.getState(),{nodes:$,edges:D}=await H2({nodesToRemove:g,edgesToRemove:v,nodes:S,edges:w,onBeforeDelete:A}),L=D.length>0,Y=$.length>0;if(L){const G=D.map(N0);C?.(D),k(G)}if(Y){const G=$.map(N0);q?.($),_(G)}return(Y||L)&&j?.({nodes:$,edges:D}),{deletedNodes:$,deletedEdges:D}},getIntersectingNodes:(g,v=!0,S)=>{const w=Kg(g),q=w?g:p(g),C=S!==void 0;return q?(S||a.getState().nodes).filter(_=>{const k=a.getState().nodeLookup.get(_.id);if(k&&!w&&(_.id===g.id||!k.internals.positionAbsolute))return!1;const j=qs(C?_:k),A=Oc(j,q);return v&&A>0||A>=j.width*j.height||A>=q.width*q.height}):[]},isNodeIntersecting:(g,v,S=!0)=>{const q=Kg(g)?g:p(g);if(!q)return!1;const C=Oc(q,v);return S&&C>0||C>=v.width*v.height||C>=q.width*q.height},updateNode:y,updateNodeData:(g,v,S={replace:!1})=>{y(g,w=>{const q=typeof v=="function"?v(w):v;return S.replace?{...w,data:q}:{...w,data:{...w.data,...q}}},S)},updateEdge:x,updateEdgeData:(g,v,S={replace:!1})=>{x(g,w=>{const q=typeof v=="function"?v(w):v;return S.replace?{...w,data:q}:{...w,data:{...w.data,...q}}},S)},getNodesBounds:g=>{const{nodeLookup:v,nodeOrigin:S}=a.getState();return A2(g,{nodeLookup:v,nodeOrigin:S})},getHandleConnections:({type:g,id:v,nodeId:S})=>Array.from(a.getState().connectionLookup.get(`${S}-${g}${v?`-${v}`:""}`)?.values()??[]),getNodeConnections:({type:g,handleId:v,nodeId:S})=>Array.from(a.getState().connectionLookup.get(`${S}${g?v?`-${g}-${v}`:`-${g}`:""}`)?.values()??[]),fitView:async g=>{const v=a.getState().fitViewResolver??B2();return a.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:v}),s.nodeQueue.push(S=>[...S]),v.promise}}},[]);return z.useMemo(()=>({...c,...n,viewportInitialized:o}),[o])}const _0=n=>n.selected,m_=typeof window<"u"?window:void 0;function p_({deleteKeyCode:n,multiSelectionKeyCode:a}){const s=Ze(),{deleteElements:o}=Qc(),c=Ms(n,{actInsideInputWithModifier:!1}),u=Ms(a,{target:m_});z.useEffect(()=>{if(c){const{edges:f,nodes:m}=s.getState();o({nodes:m.filter(_0),edges:f.filter(_0)}),s.setState({nodesSelectionActive:!1})}},[c]),z.useEffect(()=>{s.setState({multiSelectionActive:u})},[u])}function g_(n){const a=Ze();z.useEffect(()=>{const s=()=>{if(!n.current||!(n.current.checkVisibility?.()??!0))return!1;const o=zd(n.current);(o.height===0||o.width===0)&&a.getState().onError?.("004",on.error004()),a.setState({width:o.width||500,height:o.height||500})};if(n.current){s(),window.addEventListener("resize",s);const o=new ResizeObserver(()=>s());return o.observe(n.current),()=>{window.removeEventListener("resize",s),o&&n.current&&o.unobserve(n.current)}}},[])}const Kc={position:"absolute",width:"100%",height:"100%",top:0,left:0},y_=n=>({userSelectionActive:n.userSelectionActive,lib:n.lib,connectionInProgress:n.connection.inProgress});function v_({onPaneContextMenu:n,zoomOnScroll:a=!0,zoomOnPinch:s=!0,panOnScroll:o=!1,panOnScrollSpeed:c=.5,panOnScrollMode:u=ea.Free,zoomOnDoubleClick:f=!0,panOnDrag:m=!0,defaultViewport:p,translateExtent:y,minZoom:x,maxZoom:g,zoomActivationKeyCode:v,preventScrolling:S=!0,children:w,noWheelClassName:q,noPanClassName:C,onViewportChange:_,isControlledViewport:k,paneClickDistance:j,selectionOnDrag:A}){const $=Ze(),D=z.useRef(null),{userSelectionActive:L,lib:Y,connectionInProgress:G}=Ae(y_,Ge),te=Ms(v),I=z.useRef();g_(D);const F=z.useCallback(V=>{_?.({x:V[0],y:V[1],zoom:V[2]}),k||$.setState({transform:V})},[_,k]);return z.useEffect(()=>{if(D.current){I.current=SE({domNode:D.current,minZoom:x,maxZoom:g,translateExtent:y,viewport:p,onDraggingChange:E=>$.setState(M=>M.paneDragging===E?M:{paneDragging:E}),onPanZoomStart:(E,M)=>{const{onViewportChangeStart:O,onMoveStart:R}=$.getState();R?.(E,M),O?.(M)},onPanZoom:(E,M)=>{const{onViewportChange:O,onMove:R}=$.getState();R?.(E,M),O?.(M)},onPanZoomEnd:(E,M)=>{const{onViewportChangeEnd:O,onMoveEnd:R}=$.getState();R?.(E,M),O?.(M)}});const{x:V,y:T,zoom:B}=I.current.getViewport();return $.setState({panZoom:I.current,transform:[V,T,B],domNode:D.current.closest(".react-flow")}),()=>{I.current?.destroy()}}},[]),z.useEffect(()=>{I.current?.update({onPaneContextMenu:n,zoomOnScroll:a,zoomOnPinch:s,panOnScroll:o,panOnScrollSpeed:c,panOnScrollMode:u,zoomOnDoubleClick:f,panOnDrag:m,zoomActivationKeyPressed:te,preventScrolling:S,noPanClassName:C,userSelectionActive:L,noWheelClassName:q,lib:Y,onTransformChange:F,connectionInProgress:G,selectionOnDrag:A,paneClickDistance:j})},[n,a,s,o,c,u,f,m,te,S,C,L,q,Y,F,G,A,j]),d.jsx("div",{className:"react-flow__renderer",ref:D,style:Kc,children:w})}const x_=n=>({userSelectionActive:n.userSelectionActive,userSelectionRect:n.userSelectionRect});function b_(){const{userSelectionActive:n,userSelectionRect:a}=Ae(x_,Ge);return n&&a?d.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:a.width,height:a.height,transform:`translate(${a.x}px, ${a.y}px)`}}):null}const Tf=(n,a)=>s=>{s.target===a.current&&n?.(s)},S_=n=>({userSelectionActive:n.userSelectionActive,elementsSelectable:n.elementsSelectable,dragging:n.paneDragging,panBy:n.panBy,autoPanSpeed:n.autoPanSpeed});function w_({isSelecting:n,selectionKeyPressed:a,selectionMode:s=Es.Full,panOnDrag:o,autoPanOnSelection:c,paneClickDistance:u,selectionOnDrag:f,onSelectionStart:m,onSelectionEnd:p,onPaneClick:y,onPaneContextMenu:x,onPaneScroll:g,onPaneMouseEnter:v,onPaneMouseMove:S,onPaneMouseLeave:w,children:q}){const C=z.useRef(0),_=Ze(),{userSelectionActive:k,elementsSelectable:j,dragging:A,panBy:$,autoPanSpeed:D}=Ae(S_,Ge),L=j&&(n||k),Y=z.useRef(null),G=z.useRef(),te=z.useRef(new Set),I=z.useRef(new Set),F=z.useRef(!1),V=z.useRef(!1),T=z.useRef({x:0,y:0}),B=z.useRef(!1),E=le=>{if(V.current||F.current||_.getState().connection.inProgress){V.current=!1,F.current=!1;return}y?.(le),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},M=le=>{if(Array.isArray(o)&&o?.includes(2)){le.preventDefault();return}x?.(le)},O=g?le=>g(le):void 0,R=le=>{V.current&&(le.stopPropagation(),V.current=!1)},Z=le=>{const{domNode:re,transform:pe}=_.getState();if(G.current=re?.getBoundingClientRect(),!G.current)return;const Se=le.target===Y.current;if(!Se&&!!le.target.closest(".nokey")||!n||!(f&&Se||a)||le.button!==0||!le.isPrimary)return;le.target?.setPointerCapture?.(le.pointerId),V.current=!1;const{x:we,y:Ee}=sn(le.nativeEvent,G.current),Be=Rs({x:we,y:Ee},pe);_.setState({userSelectionRect:{width:0,height:0,startX:Be.x,startY:Be.y,x:we,y:Ee}}),Se||(le.stopPropagation(),le.preventDefault())};function ee(le,re){const{userSelectionRect:pe}=_.getState();if(!pe)return;const{transform:Se,nodeLookup:he,edgeLookup:ge,connectionLookup:we,triggerNodeChanges:Ee,triggerEdgeChanges:Be,defaultEdgeOptions:Je}=_.getState(),pt={x:pe.startX,y:pe.startY},{x:ht,y:se}=oi(pt,Se),Oe={startX:pt.x,startY:pt.y,x:le<ht?le:ht,y:re<se?re:se,width:Math.abs(le-ht),height:Math.abs(re-se)},xn=te.current,bn=I.current;te.current=new Set(Md(he,Oe,Se,s===Es.Partial,!0).map(Mt=>Mt.id)),I.current=new Set;const Fe=Je?.selectable??!0;for(const Mt of te.current){const Lt=we.get(Mt);if(Lt)for(const{edgeId:$t}of Lt.values()){const Vt=ge.get($t);Vt&&(Vt.selectable??Fe)&&I.current.add($t)}}if(!Jg(xn,te.current)){const Mt=Fa(he,te.current,!0);Ee(Mt)}if(!Jg(bn,I.current)){const Mt=Fa(ge,I.current);Be(Mt)}_.setState({userSelectionRect:Oe,userSelectionActive:!0,nodesSelectionActive:!1})}function P(){if(!c||!G.current)return;const[le,re]=Td(T.current,G.current,D);$({x:le,y:re}).then(pe=>{if(!V.current||!pe){C.current=requestAnimationFrame(P);return}const{x:Se,y:he}=T.current;ee(Se,he),C.current=requestAnimationFrame(P)})}const oe=()=>{cancelAnimationFrame(C.current),C.current=0,B.current=!1};z.useEffect(()=>()=>oe(),[]);const ce=le=>{const{userSelectionRect:re,transform:pe,resetSelectedElements:Se}=_.getState();if(!G.current||!re)return;const{x:he,y:ge}=sn(le.nativeEvent,G.current);T.current={x:he,y:ge};const we=oi({x:re.startX,y:re.startY},pe);if(!V.current){const Ee=a?0:u;if(Math.hypot(he-we.x,ge-we.y)<=Ee)return;Se(),m?.(le)}V.current=!0,B.current||(P(),B.current=!0),ee(he,ge)},ue=le=>{if(!L){le.target===Y.current&&_.getState().connection.inProgress&&(F.current=!0);return}le.button===0&&(le.target?.releasePointerCapture?.(le.pointerId),!k&&le.target===Y.current&&_.getState().userSelectionRect&&E?.(le),_.setState({userSelectionActive:!1,userSelectionRect:null}),V.current&&(p?.(le),_.setState({nodesSelectionActive:te.current.size>0})),oe())},xe=le=>{le.target?.releasePointerCapture?.(le.pointerId),oe()},de=o===!0||Array.isArray(o)&&o.includes(0);return d.jsxs("div",{className:it(["react-flow__pane",{draggable:de,dragging:A,selection:n}]),onClick:L?void 0:Tf(E,Y),onContextMenu:Tf(M,Y),onWheel:Tf(O,Y),onPointerEnter:L?void 0:v,onPointerMove:L?ce:S,onPointerUp:ue,onPointerCancel:L?xe:void 0,onPointerDownCapture:L?Z:void 0,onClickCapture:L?R:void 0,onPointerLeave:w,ref:Y,style:Kc,children:[q,d.jsx(b_,{})]})}function ad({id:n,store:a,unselect:s=!1,nodeRef:o}){const{addSelectedNodes:c,unselectNodesAndEdges:u,multiSelectionActive:f,nodeLookup:m,onError:p}=a.getState(),y=m.get(n);if(!y){p?.("012",on.error012(n));return}a.setState({nodesSelectionActive:!1}),y.selected?(s||y.selected&&f)&&(u({nodes:[y],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):c([n])}function zv({nodeRef:n,disabled:a=!1,noDragClassName:s,handleSelector:o,nodeId:c,isSelectable:u,nodeClickDistance:f}){const m=Ze(),[p,y]=z.useState(!1),x=z.useRef();return z.useEffect(()=>{x.current=oE({getStoreItems:()=>m.getState(),onNodeMouseDown:g=>{ad({id:g,store:m,nodeRef:n})},onDragStart:()=>{y(!0)},onDragStop:()=>{y(!1)}})},[]),z.useEffect(()=>{if(!(a||!n.current||!x.current))return x.current.update({noDragClassName:s,handleSelector:o,domNode:n.current,isSelectable:u,nodeId:c,nodeClickDistance:f}),()=>{x.current?.destroy()}},[s,o,a,u,n,c,f]),p}const N_=n=>a=>a.selected&&(a.draggable||n&&typeof a.draggable>"u");function Dv(){const n=Ze();return z.useCallback(s=>{const{nodeExtent:o,snapToGrid:c,snapGrid:u,nodesDraggable:f,onError:m,updateNodePositions:p,nodeLookup:y,nodeOrigin:x}=n.getState(),g=new Map,v=N_(f),S=c?u[0]:5,w=c?u[1]:5,q=s.direction.x*S*s.factor,C=s.direction.y*w*s.factor;for(const[,_]of y){if(!v(_))continue;let k={x:_.internals.positionAbsolute.x+q,y:_.internals.positionAbsolute.y+C};c&&(k=ks(k,u));const{position:j,positionAbsolute:A}=Fy({nodeId:_.id,nextPosition:k,nodeLookup:y,nodeExtent:o,nodeOrigin:x,onError:m});_.position=j,_.internals.positionAbsolute=A,g.set(_.id,_)}p(g)},[])}const Bd=z.createContext(null),j_=Bd.Provider;Bd.Consumer;const Ov=()=>z.useContext(Bd),E_=n=>({connectOnClick:n.connectOnClick,noPanClassName:n.noPanClassName,rfId:n.rfId}),Hv=z.createContext(null);function __({children:n}){const a=Ae(E_,Ge);return d.jsx(Hv.Provider,{value:a,children:n})}function q_(){const n=z.useContext(Hv);if(!n)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return n}const C_={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},M_=(n,a,s)=>o=>{const{connectionClickStartHandle:c,connectionMode:u,connection:f}=o,{fromHandle:m,toHandle:p,isValid:y}=f;if(!m&&!c)return C_;const x=p?.nodeId===n&&p?.id===a&&p?.type===s;return{connectingFrom:m?.nodeId===n&&m?.id===a&&m?.type===s,connectingTo:x,clickConnecting:c?.nodeId===n&&c?.id===a&&c?.type===s,isPossibleEndHandle:u===ii.Strict?m?.type!==s:n!==m?.nodeId||a!==m?.id,connectionInProcess:!!m,clickConnectionInProcess:!!c,valid:x&&y}};function T_({type:n="source",position:a=ye.Top,isValidConnection:s,isConnectable:o=!0,isConnectableStart:c=!0,isConnectableEnd:u=!0,id:f,onConnect:m,children:p,className:y,onMouseDown:x,onTouchStart:g,...v},S){const w=f||null,q=n==="target",C=Ze(),_=Ov(),{connectOnClick:k,noPanClassName:j,rfId:A}=q_(),{connectingFrom:$,connectingTo:D,clickConnecting:L,isPossibleEndHandle:Y,connectionInProcess:G,clickConnectionInProcess:te,valid:I}=Ae(M_(_,w,n),Ge);_||C.getState().onError?.("010",on.error010());const F=B=>{const{defaultEdgeOptions:E,onConnect:M,hasDefaultEdges:O}=C.getState(),R={...E,...B};if(O){const{edges:Z,setEdges:ee,onError:P}=C.getState();ee(o_(R,Z,{onError:P}))}M?.(R),m?.(R)},V=B=>{if(!_)return;const E=sv(B.nativeEvent);if(c&&(E&&B.button===0||!E)){const M=C.getState();ld.onPointerDown(B.nativeEvent,{handleDomNode:B.currentTarget,autoPanOnConnect:M.autoPanOnConnect,connectionMode:M.connectionMode,connectionRadius:M.connectionRadius,domNode:M.domNode,nodeLookup:M.nodeLookup,lib:M.lib,isTarget:q,handleId:w,nodeId:_,flowId:M.rfId,panBy:M.panBy,cancelConnection:M.cancelConnection,onConnectStart:M.onConnectStart,onConnectEnd:(...O)=>C.getState().onConnectEnd?.(...O),updateConnection:M.updateConnection,onConnect:F,isValidConnection:s||((...O)=>C.getState().isValidConnection?.(...O)??!0),getTransform:()=>C.getState().transform,getFromHandle:()=>C.getState().connection.fromHandle,autoPanSpeed:M.autoPanSpeed,dragThreshold:M.connectionDragThreshold})}E?x?.(B):g?.(B)},T=B=>{const{onClickConnectStart:E,onClickConnectEnd:M,connectionClickStartHandle:O,connectionMode:R,isValidConnection:Z,lib:ee,rfId:P,nodeLookup:oe,connection:ce}=C.getState();if(!_||!O&&!c)return;if(!O){E?.(B.nativeEvent,{nodeId:_,handleId:w,handleType:n}),C.setState({connectionClickStartHandle:{nodeId:_,type:n,id:w}});return}const ue=av(B.target),xe=s||Z,{connection:de,isValid:le}=ld.isValid(B.nativeEvent,{handle:{nodeId:_,id:w,type:n},connectionMode:R,fromNodeId:O.nodeId,fromHandleId:O.id||null,fromType:O.type,isValidConnection:xe,flowId:P,doc:ue,lib:ee,nodeLookup:oe});le&&de&&F(de);const re=structuredClone(ce);delete re.inProgress,re.toPosition=re.toHandle?re.toHandle.position:null,M?.(B,re),C.setState({connectionClickStartHandle:null})};return d.jsx("div",{"data-handleid":w,"data-nodeid":_,"data-handlepos":a,"data-id":`${A}-${_}-${w}-${n}`,className:it(["react-flow__handle",`react-flow__handle-${a}`,"nodrag",j,y,{source:!q,target:q,connectable:o,connectablestart:c,connectableend:u,clickconnecting:L,connectingfrom:$,connectingto:D,valid:I,connectionindicator:o&&(!G||Y)&&(G||te?u:c)}]),onMouseDown:V,onTouchStart:V,onClick:k?T:void 0,ref:S,...v,children:p})}const ri=z.memo(Tv(T_));function A_({data:n,isConnectable:a,sourcePosition:s=ye.Bottom}){return d.jsxs(d.Fragment,{children:[n?.label,d.jsx(ri,{type:"source",position:s,isConnectable:a})]})}function z_({data:n,isConnectable:a,targetPosition:s=ye.Top,sourcePosition:o=ye.Bottom}){return d.jsxs(d.Fragment,{children:[d.jsx(ri,{type:"target",position:s,isConnectable:a}),n?.label,d.jsx(ri,{type:"source",position:o,isConnectable:a})]})}function D_(){return null}function O_({data:n,isConnectable:a,targetPosition:s=ye.Top}){return d.jsxs(d.Fragment,{children:[d.jsx(ri,{type:"target",position:s,isConnectable:a}),n?.label]})}const Hc={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},q0={input:A_,default:z_,output:O_,group:D_};function H_(n){return n.internals.handleBounds===void 0?{width:n.width??n.initialWidth??n.style?.width,height:n.height??n.initialHeight??n.style?.height}:{width:n.width??n.style?.width,height:n.height??n.style?.height}}const k_=n=>{const{width:a,height:s,x:o,y:c}=Hs(n.nodeLookup,{filter:u=>!!u.selected});return{width:an(a)?a:null,height:an(s)?s:null,userSelectionActive:n.userSelectionActive,transformString:`translate(${n.transform[0]}px,${n.transform[1]}px) scale(${n.transform[2]}) translate(${o}px,${c}px)`}};function R_({onSelectionContextMenu:n,noPanClassName:a,disableKeyboardA11y:s}){const o=Ze(),{width:c,height:u,transformString:f,userSelectionActive:m}=Ae(k_,Ge),p=Dv(),y=z.useRef(null);z.useEffect(()=>{s||y.current?.focus({preventScroll:!0})},[s]);const x=!m&&c!==null&&u!==null;if(zv({nodeRef:y,disabled:!x}),!x)return null;const g=n?S=>{const w=o.getState().nodes.filter(q=>q.selected);n(S,w)}:void 0,v=S=>{Object.prototype.hasOwnProperty.call(Hc,S.key)&&(S.preventDefault(),p({direction:Hc[S.key],factor:S.shiftKey?4:1}))};return d.jsx("div",{className:it(["react-flow__nodesselection","react-flow__container",a]),style:{transform:f},children:d.jsx("div",{ref:y,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:s?void 0:-1,onKeyDown:s?void 0:v,style:{width:c,height:u}})})}const C0=typeof window<"u"?window:void 0,B_=n=>({nodesSelectionActive:n.nodesSelectionActive,userSelectionActive:n.userSelectionActive});function kv({children:n,onPaneClick:a,onPaneMouseEnter:s,onPaneMouseMove:o,onPaneMouseLeave:c,onPaneContextMenu:u,onPaneScroll:f,paneClickDistance:m,deleteKeyCode:p,selectionKeyCode:y,selectionOnDrag:x,selectionMode:g,onSelectionStart:v,onSelectionEnd:S,multiSelectionKeyCode:w,panActivationKeyCode:q,zoomActivationKeyCode:C,elementsSelectable:_,zoomOnScroll:k,zoomOnPinch:j,panOnScroll:A,panOnScrollSpeed:$,panOnScrollMode:D,zoomOnDoubleClick:L,panOnDrag:Y,autoPanOnSelection:G,defaultViewport:te,translateExtent:I,minZoom:F,maxZoom:V,preventScrolling:T,onSelectionContextMenu:B,noWheelClassName:E,noPanClassName:M,disableKeyboardA11y:O,onViewportChange:R,isControlledViewport:Z}){const{nodesSelectionActive:ee,userSelectionActive:P}=Ae(B_,Ge),oe=Ms(y,{target:C0}),ce=Ms(q,{target:C0}),ue=ce||Y,xe=ce||A,de=x&&ue!==!0,le=oe||P||de;return p_({deleteKeyCode:p,multiSelectionKeyCode:w}),d.jsx(v_,{onPaneContextMenu:u,elementsSelectable:_,zoomOnScroll:k,zoomOnPinch:j,panOnScroll:xe,panOnScrollSpeed:$,panOnScrollMode:D,zoomOnDoubleClick:L,panOnDrag:!oe&&ue,defaultViewport:te,translateExtent:I,minZoom:F,maxZoom:V,zoomActivationKeyCode:C,preventScrolling:T,noWheelClassName:E,noPanClassName:M,onViewportChange:R,isControlledViewport:Z,paneClickDistance:m,selectionOnDrag:de,children:d.jsxs(w_,{onSelectionStart:v,onSelectionEnd:S,onPaneClick:a,onPaneMouseEnter:s,onPaneMouseMove:o,onPaneMouseLeave:c,onPaneContextMenu:u,onPaneScroll:f,panOnDrag:ue,autoPanOnSelection:G,isSelecting:!!le,selectionMode:g,selectionKeyPressed:oe,paneClickDistance:m,selectionOnDrag:de,children:[n,ee&&d.jsx(R_,{onSelectionContextMenu:B,noPanClassName:M,disableKeyboardA11y:O})]})})}kv.displayName="FlowRenderer";const U_=z.memo(kv),L_=n=>a=>n?Md(a.nodeLookup,{x:0,y:0,width:a.width,height:a.height},a.transform,!0).map(s=>s.id):Array.from(a.nodeLookup.keys());function $_(n){return Ae(z.useCallback(L_(n),[n]),Ge)}const V_=n=>n.updateNodeInternals;function Y_(){const n=Ae(V_),[a]=z.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(s=>{const o=new Map;s.forEach(c=>{const u=c.target.getAttribute("data-id");o.set(u,{id:u,nodeElement:c.target,force:!0})}),n(o)}));return z.useEffect(()=>()=>{a?.disconnect()},[a]),a}function X_({node:n,nodeType:a,hasDimensions:s,resizeObserver:o}){const c=Ze(),u=z.useRef(null),f=z.useRef(null),m=z.useRef(n.sourcePosition),p=z.useRef(n.targetPosition),y=z.useRef(a),x=s&&!!n.internals.handleBounds;return z.useEffect(()=>{u.current&&!n.hidden&&(!x||f.current!==u.current)&&(f.current&&o?.unobserve(f.current),o?.observe(u.current),f.current=u.current)},[x,n.hidden]),z.useEffect(()=>()=>{f.current&&(o?.unobserve(f.current),f.current=null)},[]),z.useEffect(()=>{if(u.current){const g=y.current!==a,v=m.current!==n.sourcePosition,S=p.current!==n.targetPosition;(g||v||S)&&(y.current=a,m.current=n.sourcePosition,p.current=n.targetPosition,c.getState().updateNodeInternals(new Map([[n.id,{id:n.id,nodeElement:u.current,force:!0}]])))}},[n.id,a,n.sourcePosition,n.targetPosition]),u}function I_({id:n,onClick:a,onMouseEnter:s,onMouseMove:o,onMouseLeave:c,onContextMenu:u,onDoubleClick:f,nodesDraggable:m,elementsSelectable:p,nodesConnectable:y,nodesFocusable:x,resizeObserver:g,noDragClassName:v,noPanClassName:S,disableKeyboardA11y:w,rfId:q,nodeTypes:C,nodeClickDistance:_,onError:k}){const{node:j,internals:A,isParent:$}=Ae(le=>{const re=le.nodeLookup.get(n),pe=le.parentLookup.has(n);return{node:re,internals:re.internals,isParent:pe}},Ge);let D=j.type||"default",L=C?.[D]||q0[D];L===void 0&&(k?.("003",on.error003(D)),D="default",L=C?.default||q0.default);const Y=!!(j.draggable||m&&typeof j.draggable>"u"),G=!!(j.selectable||p&&typeof j.selectable>"u"),te=!!(j.connectable||y&&typeof j.connectable>"u"),I=!!(j.focusable||x&&typeof j.focusable>"u"),F=Ze(),V=nv(j),T=X_({node:j,nodeType:D,hasDimensions:V,resizeObserver:g}),B=zv({nodeRef:T,disabled:j.hidden||!Y,noDragClassName:v,handleSelector:j.dragHandle,nodeId:n,isSelectable:G,nodeClickDistance:_}),E=Dv();if(j.hidden)return null;const M=In(j),O=H_(j),R=G||Y||a||s||o||c,Z=s?le=>s(le,{...A.userNode}):void 0,ee=o?le=>o(le,{...A.userNode}):void 0,P=c?le=>c(le,{...A.userNode}):void 0,oe=u?le=>u(le,{...A.userNode}):void 0,ce=f?le=>f(le,{...A.userNode}):void 0,ue=le=>{const{selectNodesOnDrag:re,nodeDragThreshold:pe}=F.getState();G&&(!re||!Y||pe>0)&&ad({id:n,store:F,nodeRef:T}),a&&a(le,{...A.userNode})},xe=le=>{if(!(iv(le.nativeEvent)||w)){if(Gy.includes(le.key)&&G){const re=le.key==="Escape";ad({id:n,store:F,unselect:re,nodeRef:T})}else if(Y&&j.selected&&Object.prototype.hasOwnProperty.call(Hc,le.key)){le.preventDefault();const{ariaLabelConfig:re}=F.getState();F.setState({ariaLiveMessage:re["node.a11yDescription.ariaLiveMessage"]({direction:le.key.replace("Arrow","").toLowerCase(),x:~~A.positionAbsolute.x,y:~~A.positionAbsolute.y})}),E({direction:Hc[le.key],factor:le.shiftKey?4:1})}}},de=()=>{if(w||!T.current?.matches(":focus-visible"))return;const{transform:le,width:re,height:pe,autoPanOnNodeFocus:Se,setCenter:he}=F.getState();if(!Se)return;Md(new Map([[n,j]]),{x:0,y:0,width:re,height:pe},le,!0).length>0||he(j.position.x+M.width/2,j.position.y+M.height/2,{zoom:le[2]})};return d.jsx("div",{className:it(["react-flow__node",`react-flow__node-${D}`,{[S]:Y},j.className,{selected:j.selected,selectable:G,parent:$,draggable:Y,dragging:B}]),ref:T,style:{zIndex:A.z,transform:`translate(${A.positionAbsolute.x}px,${A.positionAbsolute.y}px)`,pointerEvents:R?"all":"none",visibility:V?"visible":"hidden",...j.style,...O},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:Z,onMouseMove:ee,onMouseLeave:P,onContextMenu:oe,onClick:ue,onDoubleClick:ce,onKeyDown:I?xe:void 0,tabIndex:I?0:void 0,onFocus:I?de:void 0,role:j.ariaRole??(I?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${jv}-${q}`,"aria-label":j.ariaLabel,...j.domAttributes,children:d.jsx(j_,{value:n,children:d.jsx(L,{id:n,data:j.data,type:D,positionAbsoluteX:A.positionAbsolute.x,positionAbsoluteY:A.positionAbsolute.y,selected:j.selected??!1,selectable:G,draggable:Y,deletable:j.deletable??!0,isConnectable:te,sourcePosition:j.sourcePosition,targetPosition:j.targetPosition,dragging:B,dragHandle:j.dragHandle,zIndex:A.z,parentId:j.parentId,...M})})})}var G_=z.memo(I_);const Z_=n=>({nodesDraggable:n.nodesDraggable,nodesConnectable:n.nodesConnectable,nodesFocusable:n.nodesFocusable,elementsSelectable:n.elementsSelectable,onError:n.onError});function Rv(n){const{nodesDraggable:a,nodesConnectable:s,nodesFocusable:o,elementsSelectable:c,onError:u}=Ae(Z_,Ge),f=$_(n.onlyRenderVisibleElements),m=Y_();return d.jsx("div",{className:"react-flow__nodes",style:Kc,children:f.map(p=>d.jsx(G_,{id:p,nodeTypes:n.nodeTypes,nodeExtent:n.nodeExtent,onClick:n.onNodeClick,onMouseEnter:n.onNodeMouseEnter,onMouseMove:n.onNodeMouseMove,onMouseLeave:n.onNodeMouseLeave,onContextMenu:n.onNodeContextMenu,onDoubleClick:n.onNodeDoubleClick,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,resizeObserver:m,nodesDraggable:a,nodesConnectable:s,nodesFocusable:o,elementsSelectable:c,nodeClickDistance:n.nodeClickDistance,onError:u},p))})}Rv.displayName="NodeRenderer";const Q_=z.memo(Rv);function K_(n){return Ae(z.useCallback(s=>{if(!n)return s.edges.map(c=>c.id);const o=[];if(s.width&&s.height)for(const c of s.edges){const u=s.nodeLookup.get(c.source),f=s.nodeLookup.get(c.target);u&&f&&V2({sourceNode:u,targetNode:f,width:s.width,height:s.height,transform:s.transform})&&o.push(c.id)}return o},[n]),Ge)}const J_=({color:n="none",strokeWidth:a=1})=>{const s={strokeWidth:a,...n&&{stroke:n}};return d.jsx("polyline",{className:"arrow",style:s,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},F_=({color:n="none",strokeWidth:a=1})=>{const s={strokeWidth:a,...n&&{stroke:n,fill:n}};return d.jsx("polyline",{className:"arrowclosed",style:s,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},M0={[_s.Arrow]:J_,[_s.ArrowClosed]:F_};function W_(n){const a=Ze();return z.useMemo(()=>Object.prototype.hasOwnProperty.call(M0,n)?M0[n]:(a.getState().onError?.("009",on.error009(n)),null),[n])}const P_=({id:n,type:a,color:s,width:o=12.5,height:c=12.5,markerUnits:u="strokeWidth",strokeWidth:f,orient:m="auto-start-reverse"})=>{const p=W_(a);return p?d.jsx("marker",{className:"react-flow__arrowhead",id:n,markerWidth:`${o}`,markerHeight:`${c}`,viewBox:"-10 -10 20 20",markerUnits:u,orient:m,refX:"0",refY:"0",children:d.jsx(p,{color:s,strokeWidth:f})}):null},Bv=({defaultColor:n,rfId:a})=>{const s=Ae(u=>u.edges),o=Ae(u=>u.defaultEdgeOptions),c=z.useMemo(()=>J2(s,{id:a,defaultColor:n,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[s,o,a,n]);return c.length?d.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:d.jsx("defs",{children:c.map(u=>d.jsx(P_,{id:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,strokeWidth:u.strokeWidth,orient:u.orient},u.id))})}):null};Bv.displayName="MarkerDefinitions";var eq=z.memo(Bv);function Uv({x:n,y:a,label:s,labelStyle:o,labelShowBg:c=!0,labelBgStyle:u,labelBgPadding:f=[2,4],labelBgBorderRadius:m=2,children:p,className:y,...x}){const[g,v]=z.useState({x:1,y:0,width:0,height:0}),S=it(["react-flow__edge-textwrapper",y]),w=z.useRef(null);return z.useEffect(()=>{if(w.current){const q=w.current.getBBox();v({x:q.x,y:q.y,width:q.width,height:q.height})}},[s]),s?d.jsxs("g",{transform:`translate(${n-g.width/2} ${a-g.height/2})`,className:S,visibility:g.width?"visible":"hidden",...x,children:[c&&d.jsx("rect",{width:g.width+2*f[0],x:-f[0],y:-f[1],height:g.height+2*f[1],className:"react-flow__edge-textbg",style:u,rx:m,ry:m}),d.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:w,style:o,children:s}),p]}):null}Uv.displayName="EdgeText";const tq=z.memo(Uv);function Jc({path:n,labelX:a,labelY:s,label:o,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:p,interactionWidth:y=20,...x}){return d.jsxs(d.Fragment,{children:[d.jsx("path",{...x,d:n,fill:"none",className:it(["react-flow__edge-path",x.className])}),y?d.jsx("path",{d:n,fill:"none",strokeOpacity:0,strokeWidth:y,className:"react-flow__edge-interaction"}):null,o&&an(a)&&an(s)?d.jsx(tq,{x:a,y:s,label:o,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:p}):null]})}function T0({pos:n,x1:a,y1:s,x2:o,y2:c}){return n===ye.Left||n===ye.Right?[.5*(a+o),s]:[a,.5*(s+c)]}function Lv({sourceX:n,sourceY:a,sourcePosition:s=ye.Bottom,targetX:o,targetY:c,targetPosition:u=ye.Top}){const[f,m]=T0({pos:s,x1:n,y1:a,x2:o,y2:c}),[p,y]=T0({pos:u,x1:o,y1:c,x2:n,y2:a}),[x,g,v,S]=ov({sourceX:n,sourceY:a,targetX:o,targetY:c,sourceControlX:f,sourceControlY:m,targetControlX:p,targetControlY:y});return[`M${n},${a} C${f},${m} ${p},${y} ${o},${c}`,x,g,v,S]}function $v(n){return z.memo(({id:a,sourceX:s,sourceY:o,targetX:c,targetY:u,sourcePosition:f,targetPosition:m,label:p,labelStyle:y,labelShowBg:x,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:S,style:w,markerEnd:q,markerStart:C,interactionWidth:_})=>{const[k,j,A]=Lv({sourceX:s,sourceY:o,sourcePosition:f,targetX:c,targetY:u,targetPosition:m}),$=n.isInternal?void 0:a;return d.jsx(Jc,{id:$,path:k,labelX:j,labelY:A,label:p,labelStyle:y,labelShowBg:x,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:S,style:w,markerEnd:q,markerStart:C,interactionWidth:_})})}const nq=$v({isInternal:!1}),Vv=$v({isInternal:!0});nq.displayName="SimpleBezierEdge";Vv.displayName="SimpleBezierEdgeInternal";function Yv(n){return z.memo(({id:a,sourceX:s,sourceY:o,targetX:c,targetY:u,label:f,labelStyle:m,labelShowBg:p,labelBgStyle:y,labelBgPadding:x,labelBgBorderRadius:g,style:v,sourcePosition:S=ye.Bottom,targetPosition:w=ye.Top,markerEnd:q,markerStart:C,pathOptions:_,interactionWidth:k})=>{const[j,A,$]=ed({sourceX:s,sourceY:o,sourcePosition:S,targetX:c,targetY:u,targetPosition:w,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),D=n.isInternal?void 0:a;return d.jsx(Jc,{id:D,path:j,labelX:A,labelY:$,label:f,labelStyle:m,labelShowBg:p,labelBgStyle:y,labelBgPadding:x,labelBgBorderRadius:g,style:v,markerEnd:q,markerStart:C,interactionWidth:k})})}const Xv=Yv({isInternal:!1}),Iv=Yv({isInternal:!0});Xv.displayName="SmoothStepEdge";Iv.displayName="SmoothStepEdgeInternal";function Gv(n){return z.memo(({id:a,...s})=>{const o=n.isInternal?void 0:a;return d.jsx(Xv,{...s,id:o,pathOptions:z.useMemo(()=>({borderRadius:0,offset:s.pathOptions?.offset}),[s.pathOptions?.offset])})})}const lq=Gv({isInternal:!1}),Zv=Gv({isInternal:!0});lq.displayName="StepEdge";Zv.displayName="StepEdgeInternal";function Qv(n){return z.memo(({id:a,sourceX:s,sourceY:o,targetX:c,targetY:u,label:f,labelStyle:m,labelShowBg:p,labelBgStyle:y,labelBgPadding:x,labelBgBorderRadius:g,style:v,markerEnd:S,markerStart:w,interactionWidth:q})=>{const[C,_,k]=uv({sourceX:s,sourceY:o,targetX:c,targetY:u}),j=n.isInternal?void 0:a;return d.jsx(Jc,{id:j,path:C,labelX:_,labelY:k,label:f,labelStyle:m,labelShowBg:p,labelBgStyle:y,labelBgPadding:x,labelBgBorderRadius:g,style:v,markerEnd:S,markerStart:w,interactionWidth:q})})}const aq=Qv({isInternal:!1}),Kv=Qv({isInternal:!0});aq.displayName="StraightEdge";Kv.displayName="StraightEdgeInternal";function Jv(n){return z.memo(({id:a,sourceX:s,sourceY:o,targetX:c,targetY:u,sourcePosition:f=ye.Bottom,targetPosition:m=ye.Top,label:p,labelStyle:y,labelShowBg:x,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:S,style:w,markerEnd:q,markerStart:C,pathOptions:_,interactionWidth:k})=>{const[j,A,$]=cv({sourceX:s,sourceY:o,sourcePosition:f,targetX:c,targetY:u,targetPosition:m,curvature:_?.curvature}),D=n.isInternal?void 0:a;return d.jsx(Jc,{id:D,path:j,labelX:A,labelY:$,label:p,labelStyle:y,labelShowBg:x,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:S,style:w,markerEnd:q,markerStart:C,interactionWidth:k})})}const iq=Jv({isInternal:!1}),Fv=Jv({isInternal:!0});iq.displayName="BezierEdge";Fv.displayName="BezierEdgeInternal";const A0={default:Fv,straight:Kv,step:Zv,smoothstep:Iv,simplebezier:Vv},z0={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},sq=(n,a,s)=>s===ye.Left?n-a:s===ye.Right?n+a:n,oq=(n,a,s)=>s===ye.Top?n-a:s===ye.Bottom?n+a:n,D0="react-flow__edgeupdater";function O0({position:n,centerX:a,centerY:s,radius:o=10,onMouseDown:c,onMouseEnter:u,onMouseOut:f,type:m}){return d.jsx("circle",{onMouseDown:c,onMouseEnter:u,onMouseOut:f,className:it([D0,`${D0}-${m}`]),cx:sq(a,o,n),cy:oq(s,o,n),r:o,stroke:"transparent",fill:"transparent"})}function cq({isReconnectable:n,reconnectRadius:a,edge:s,sourceX:o,sourceY:c,targetX:u,targetY:f,sourcePosition:m,targetPosition:p,onReconnect:y,onReconnectStart:x,onReconnectEnd:g,setReconnecting:v,setUpdateHover:S}){const w=Ze(),q=(A,$)=>{if(A.button!==0)return;const{autoPanOnConnect:D,domNode:L,connectionMode:Y,connectionRadius:G,lib:te,onConnectStart:I,cancelConnection:F,nodeLookup:V,rfId:T,panBy:B,updateConnection:E}=w.getState(),M=$.type==="target",O=(ee,P)=>{v(!1),g?.(ee,s,$.type,P)},R=ee=>y?.(s,ee),Z=(ee,P)=>{v(!0),x?.(A,s,$.type),I?.(ee,P)};ld.onPointerDown(A.nativeEvent,{autoPanOnConnect:D,connectionMode:Y,connectionRadius:G,domNode:L,handleId:$.id,nodeId:$.nodeId,nodeLookup:V,isTarget:M,edgeUpdaterType:$.type,lib:te,flowId:T,cancelConnection:F,panBy:B,isValidConnection:(...ee)=>w.getState().isValidConnection?.(...ee)??!0,onConnect:R,onConnectStart:Z,onConnectEnd:(...ee)=>w.getState().onConnectEnd?.(...ee),onReconnectEnd:O,updateConnection:E,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:A.currentTarget})},C=A=>q(A,{nodeId:s.target,id:s.targetHandle??null,type:"target"}),_=A=>q(A,{nodeId:s.source,id:s.sourceHandle??null,type:"source"}),k=()=>S(!0),j=()=>S(!1);return d.jsxs(d.Fragment,{children:[(n===!0||n==="source")&&d.jsx(O0,{position:m,centerX:o,centerY:c,radius:a,onMouseDown:C,onMouseEnter:k,onMouseOut:j,type:"source"}),(n===!0||n==="target")&&d.jsx(O0,{position:p,centerX:u,centerY:f,radius:a,onMouseDown:_,onMouseEnter:k,onMouseOut:j,type:"target"})]})}function rq({id:n,edgesFocusable:a,edgesReconnectable:s,elementsSelectable:o,onClick:c,onDoubleClick:u,onContextMenu:f,onMouseEnter:m,onMouseMove:p,onMouseLeave:y,reconnectRadius:x,onReconnect:g,onReconnectStart:v,onReconnectEnd:S,rfId:w,edgeTypes:q,noPanClassName:C,onError:_,disableKeyboardA11y:k}){let j=Ae(he=>he.edgeLookup.get(n));const A=Ae(he=>he.defaultEdgeOptions);j=A?{...A,...j}:j;let $=j.type||"default",D=q?.[$]||A0[$];D===void 0&&(_?.("011",on.error011($)),$="default",D=q?.default||A0.default);const L=!!(j.focusable||a&&typeof j.focusable>"u"),Y=typeof g<"u"&&(j.reconnectable||s&&typeof j.reconnectable>"u"),G=!!(j.selectable||o&&typeof j.selectable>"u"),te=z.useRef(null),[I,F]=z.useState(!1),[V,T]=z.useState(!1),B=Ze(),{zIndex:E=j.zIndex,sourceX:M,sourceY:O,targetX:R,targetY:Z,sourcePosition:ee,targetPosition:P}=Ae(z.useCallback(he=>{const ge=he.nodeLookup.get(j.source),we=he.nodeLookup.get(j.target);if(!ge||!we)return z0;const Ee=K2({id:n,sourceNode:ge,targetNode:we,sourceHandle:j.sourceHandle||null,targetHandle:j.targetHandle||null,connectionMode:he.connectionMode,onError:_}),Be=$2({selected:j.selected,zIndex:j.zIndex,sourceNode:ge,targetNode:we,elevateOnSelect:he.elevateEdgesOnSelect,zIndexMode:he.zIndexMode});return{...Ee||z0,zIndex:Be}},[j.source,j.target,j.sourceHandle,j.targetHandle,j.selected,j.zIndex]),Ge),oe=z.useMemo(()=>j.markerStart?`url('#${td(j.markerStart,w)}')`:void 0,[j.markerStart,w]),ce=z.useMemo(()=>j.markerEnd?`url('#${td(j.markerEnd,w)}')`:void 0,[j.markerEnd,w]);if(j.hidden||M===null||O===null||R===null||Z===null)return null;const ue=he=>{const{addSelectedEdges:ge,unselectNodesAndEdges:we,multiSelectionActive:Ee}=B.getState();G&&(B.setState({nodesSelectionActive:!1}),j.selected&&Ee?(we({nodes:[],edges:[j]}),te.current?.blur()):ge([n])),c&&c(he,j)},xe=u?he=>{u(he,{...j})}:void 0,de=f?he=>{f(he,{...j})}:void 0,le=m?he=>{m(he,{...j})}:void 0,re=p?he=>{p(he,{...j})}:void 0,pe=y?he=>{y(he,{...j})}:void 0,Se=he=>{if(!k&&Gy.includes(he.key)&&G){const{unselectNodesAndEdges:ge,addSelectedEdges:we}=B.getState();he.key==="Escape"?(te.current?.blur(),ge({edges:[j]})):we([n])}};return d.jsx("svg",{style:{zIndex:E},children:d.jsxs("g",{className:it(["react-flow__edge",`react-flow__edge-${$}`,j.className,C,{selected:j.selected,animated:j.animated,inactive:!G&&!c,updating:I,selectable:G}]),onClick:ue,onDoubleClick:xe,onContextMenu:de,onMouseEnter:le,onMouseMove:re,onMouseLeave:pe,onKeyDown:L?Se:void 0,tabIndex:L?0:void 0,role:j.ariaRole??(L?"group":"img"),"aria-roledescription":"edge","data-id":n,"data-testid":`rf__edge-${n}`,"aria-label":j.ariaLabel===null?void 0:j.ariaLabel||`Edge from ${j.source} to ${j.target}`,"aria-describedby":L?`${Ev}-${w}`:void 0,ref:te,...j.domAttributes,children:[!V&&d.jsx(D,{id:n,source:j.source,target:j.target,type:j.type,selected:j.selected,animated:j.animated,selectable:G,deletable:j.deletable??!0,label:j.label,labelStyle:j.labelStyle,labelShowBg:j.labelShowBg,labelBgStyle:j.labelBgStyle,labelBgPadding:j.labelBgPadding,labelBgBorderRadius:j.labelBgBorderRadius,sourceX:M,sourceY:O,targetX:R,targetY:Z,sourcePosition:ee,targetPosition:P,data:j.data,style:j.style,sourceHandleId:j.sourceHandle,targetHandleId:j.targetHandle,markerStart:oe,markerEnd:ce,pathOptions:"pathOptions"in j?j.pathOptions:void 0,interactionWidth:j.interactionWidth}),Y&&d.jsx(cq,{edge:j,isReconnectable:Y,reconnectRadius:x,onReconnect:g,onReconnectStart:v,onReconnectEnd:S,sourceX:M,sourceY:O,targetX:R,targetY:Z,sourcePosition:ee,targetPosition:P,setUpdateHover:F,setReconnecting:T})]})})}var uq=z.memo(rq);const fq=n=>({edgesFocusable:n.edgesFocusable,edgesReconnectable:n.edgesReconnectable,elementsSelectable:n.elementsSelectable,connectionMode:n.connectionMode,onError:n.onError});function Wv({defaultMarkerColor:n,onlyRenderVisibleElements:a,rfId:s,edgeTypes:o,noPanClassName:c,onReconnect:u,onEdgeContextMenu:f,onEdgeMouseEnter:m,onEdgeMouseMove:p,onEdgeMouseLeave:y,onEdgeClick:x,reconnectRadius:g,onEdgeDoubleClick:v,onReconnectStart:S,onReconnectEnd:w,disableKeyboardA11y:q}){const{edgesFocusable:C,edgesReconnectable:_,elementsSelectable:k,onError:j}=Ae(fq,Ge),A=K_(a);return d.jsxs("div",{className:"react-flow__edges",children:[d.jsx(eq,{defaultColor:n,rfId:s}),A.map($=>d.jsx(uq,{id:$,edgesFocusable:C,edgesReconnectable:_,elementsSelectable:k,noPanClassName:c,onReconnect:u,onContextMenu:f,onMouseEnter:m,onMouseMove:p,onMouseLeave:y,onClick:x,reconnectRadius:g,onDoubleClick:v,onReconnectStart:S,onReconnectEnd:w,rfId:s,onError:j,edgeTypes:o,disableKeyboardA11y:q},$))]})}Wv.displayName="EdgeRenderer";const dq=z.memo(Wv),hq=n=>`translate(${n.transform[0]}px,${n.transform[1]}px) scale(${n.transform[2]})`;function mq({children:n}){const a=Ae(hq);return d.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:a},children:n})}function pq(n){const a=Qc(),s=z.useRef(!1);z.useEffect(()=>{!s.current&&a.viewportInitialized&&n&&(setTimeout(()=>n(a),1),s.current=!0)},[n,a.viewportInitialized])}const gq=n=>n.panZoom?.syncViewport;function yq(n){const a=Ae(gq),s=Ze();return z.useEffect(()=>{n&&(a?.(n),s.setState({transform:[n.x,n.y,n.zoom]}))},[n,a]),null}function vq(n){return n.connection.inProgress?{...n.connection,to:Rs(n.connection.to,n.transform)}:{...n.connection}}function xq(n){return vq}function bq(n){const a=xq();return Ae(a,Ge)}const Sq=n=>({nodesConnectable:n.nodesConnectable,isValid:n.connection.isValid,inProgress:n.connection.inProgress,width:n.width,height:n.height});function wq({containerStyle:n,style:a,type:s,component:o}){const{nodesConnectable:c,width:u,height:f,isValid:m,inProgress:p}=Ae(Sq,Ge);return!(u&&c&&p)?null:d.jsx("svg",{style:n,width:u,height:f,className:"react-flow__connectionline react-flow__container",children:d.jsx("g",{className:it(["react-flow__connection",Ky(m)]),children:d.jsx(Pv,{style:a,type:s,CustomComponent:o,isValid:m})})})}const Pv=({style:n,type:a=El.Bezier,CustomComponent:s,isValid:o})=>{const{inProgress:c,from:u,fromNode:f,fromHandle:m,fromPosition:p,to:y,toNode:x,toHandle:g,toPosition:v,pointer:S}=bq();if(!c)return;if(s)return d.jsx(s,{connectionLineType:a,connectionLineStyle:n,fromNode:f,fromHandle:m,fromX:u.x,fromY:u.y,toX:y.x,toY:y.y,fromPosition:p,toPosition:v,connectionStatus:Ky(o),toNode:x,toHandle:g,pointer:S});let w="";const q={sourceX:u.x,sourceY:u.y,sourcePosition:p,targetX:y.x,targetY:y.y,targetPosition:v};switch(a){case El.Bezier:[w]=cv(q);break;case El.SimpleBezier:[w]=Lv(q);break;case El.Step:[w]=ed({...q,borderRadius:0});break;case El.SmoothStep:[w]=ed(q);break;default:[w]=uv(q)}return d.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:n})};Pv.displayName="ConnectionLine";const Nq={};function H0(n=Nq){z.useRef(n),Ze(),z.useEffect(()=>{},[n])}function jq(){Ze(),z.useRef(!1),z.useEffect(()=>{},[])}function ex({nodeTypes:n,edgeTypes:a,onInit:s,onNodeClick:o,onEdgeClick:c,onNodeDoubleClick:u,onEdgeDoubleClick:f,onNodeMouseEnter:m,onNodeMouseMove:p,onNodeMouseLeave:y,onNodeContextMenu:x,onSelectionContextMenu:g,onSelectionStart:v,onSelectionEnd:S,connectionLineType:w,connectionLineStyle:q,connectionLineComponent:C,connectionLineContainerStyle:_,selectionKeyCode:k,selectionOnDrag:j,selectionMode:A,multiSelectionKeyCode:$,panActivationKeyCode:D,zoomActivationKeyCode:L,deleteKeyCode:Y,onlyRenderVisibleElements:G,elementsSelectable:te,defaultViewport:I,translateExtent:F,minZoom:V,maxZoom:T,preventScrolling:B,defaultMarkerColor:E,zoomOnScroll:M,zoomOnPinch:O,panOnScroll:R,panOnScrollSpeed:Z,panOnScrollMode:ee,zoomOnDoubleClick:P,panOnDrag:oe,autoPanOnSelection:ce,onPaneClick:ue,onPaneMouseEnter:xe,onPaneMouseMove:de,onPaneMouseLeave:le,onPaneScroll:re,onPaneContextMenu:pe,paneClickDistance:Se,nodeClickDistance:he,onEdgeContextMenu:ge,onEdgeMouseEnter:we,onEdgeMouseMove:Ee,onEdgeMouseLeave:Be,reconnectRadius:Je,onReconnect:pt,onReconnectStart:ht,onReconnectEnd:se,noDragClassName:Oe,noWheelClassName:xn,noPanClassName:bn,disableKeyboardA11y:Fe,nodeExtent:Mt,rfId:Lt,viewport:$t,onViewportChange:Vt}){return H0(n),H0(a),jq(),pq(s),yq($t),d.jsx(U_,{onPaneClick:ue,onPaneMouseEnter:xe,onPaneMouseMove:de,onPaneMouseLeave:le,onPaneContextMenu:pe,onPaneScroll:re,paneClickDistance:Se,deleteKeyCode:Y,selectionKeyCode:k,selectionOnDrag:j,selectionMode:A,onSelectionStart:v,onSelectionEnd:S,multiSelectionKeyCode:$,panActivationKeyCode:D,zoomActivationKeyCode:L,elementsSelectable:te,zoomOnScroll:M,zoomOnPinch:O,zoomOnDoubleClick:P,panOnScroll:R,panOnScrollSpeed:Z,panOnScrollMode:ee,panOnDrag:oe,autoPanOnSelection:ce,defaultViewport:I,translateExtent:F,minZoom:V,maxZoom:T,onSelectionContextMenu:g,preventScrolling:B,noDragClassName:Oe,noWheelClassName:xn,noPanClassName:bn,disableKeyboardA11y:Fe,onViewportChange:Vt,isControlledViewport:!!$t,children:d.jsxs(mq,{children:[d.jsx(dq,{edgeTypes:a,onEdgeClick:c,onEdgeDoubleClick:f,onReconnect:pt,onReconnectStart:ht,onReconnectEnd:se,onlyRenderVisibleElements:G,onEdgeContextMenu:ge,onEdgeMouseEnter:we,onEdgeMouseMove:Ee,onEdgeMouseLeave:Be,reconnectRadius:Je,defaultMarkerColor:E,noPanClassName:bn,disableKeyboardA11y:Fe,rfId:Lt}),d.jsx(wq,{style:q,type:w,component:C,containerStyle:_}),d.jsx("div",{className:"react-flow__edgelabel-renderer"}),d.jsx(Q_,{nodeTypes:n,onNodeClick:o,onNodeDoubleClick:u,onNodeMouseEnter:m,onNodeMouseMove:p,onNodeMouseLeave:y,onNodeContextMenu:x,nodeClickDistance:he,onlyRenderVisibleElements:G,noPanClassName:bn,noDragClassName:Oe,disableKeyboardA11y:Fe,nodeExtent:Mt,rfId:Lt}),d.jsx("div",{className:"react-flow__viewport-portal"})]})})}ex.displayName="GraphView";const Eq=z.memo(ex),_q=tv(),k0=({nodes:n,edges:a,defaultNodes:s,defaultEdges:o,width:c,height:u,fitView:f,fitViewOptions:m,minZoom:p=.5,maxZoom:y=2,nodeOrigin:x,nodeExtent:g,zIndexMode:v="basic"}={})=>{const S=new Map,w=new Map,q=new Map,C=new Map,_=o??a??[],k=s??n??[],j=x??[0,0],A=g??js;hv(q,C,_);const{nodesInitialized:$}=nd(k,S,w,{nodeOrigin:j,nodeExtent:A,zIndexMode:v});let D=[0,0,1];if(f&&c&&u){const L=Hs(S,{filter:I=>!!((I.width||I.initialWidth)&&(I.height||I.initialHeight))}),{x:Y,y:G,zoom:te}=Ad(L,c,u,p,y,m?.padding??.1);D=[Y,G,te]}return{rfId:"1",width:c??0,height:u??0,transform:D,nodes:k,nodesInitialized:$,nodeLookup:S,parentLookup:w,edges:_,edgeLookup:C,connectionLookup:q,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:s!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:p,maxZoom:y,translateExtent:js,nodeExtent:A,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ii.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:j,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:f??!1,fitViewOptions:m,fitViewResolver:null,connection:{...Qy},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:_q,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Zy,zIndexMode:v,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},qq=({nodes:n,edges:a,defaultNodes:s,defaultEdges:o,width:c,height:u,fitView:f,fitViewOptions:m,minZoom:p,maxZoom:y,nodeOrigin:x,nodeExtent:g,zIndexMode:v})=>BE((S,w)=>{async function q(){const{nodeLookup:C,panZoom:_,fitViewOptions:k,fitViewResolver:j,width:A,height:$,minZoom:D,maxZoom:L}=w();_&&(await O2({nodes:C,width:A,height:$,panZoom:_,minZoom:D,maxZoom:L},k),j?.resolve(!0),S({fitViewResolver:null}))}return{...k0({nodes:n,edges:a,width:c,height:u,fitView:f,fitViewOptions:m,minZoom:p,maxZoom:y,nodeOrigin:x,nodeExtent:g,defaultNodes:s,defaultEdges:o,zIndexMode:v}),setNodes:C=>{const{nodeLookup:_,parentLookup:k,nodeOrigin:j,elevateNodesOnSelect:A,fitViewQueued:$,zIndexMode:D,nodesSelectionActive:L}=w(),{nodesInitialized:Y,hasSelectedNodes:G}=nd(C,_,k,{nodeOrigin:j,nodeExtent:g,elevateNodesOnSelect:A,checkEquality:!0,zIndexMode:D}),te=L&&G;$&&Y?(q(),S({nodes:C,nodesInitialized:Y,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:te})):S({nodes:C,nodesInitialized:Y,nodesSelectionActive:te})},setEdges:C=>{const{connectionLookup:_,edgeLookup:k}=w();hv(_,k,C),S({edges:C})},setDefaultNodesAndEdges:(C,_)=>{if(C){const{setNodes:k}=w();k(C),S({hasDefaultNodes:!0})}if(_){const{setEdges:k}=w();k(_),S({hasDefaultEdges:!0})}},updateNodeInternals:C=>{const{triggerNodeChanges:_,nodeLookup:k,parentLookup:j,domNode:A,nodeOrigin:$,nodeExtent:D,debug:L,fitViewQueued:Y,zIndexMode:G}=w(),{changes:te,updatedInternals:I}=lE(C,k,j,A,$,D,G);I&&(P2(k,j,{nodeOrigin:$,nodeExtent:D,zIndexMode:G}),Y?(q(),S({fitViewQueued:!1,fitViewOptions:void 0})):S({}),te?.length>0&&(L&&console.log("React Flow: trigger node changes",te),_?.(te)))},updateNodePositions:(C,_=!1)=>{const k=[];let j=[];const{nodeLookup:A,triggerNodeChanges:$,connection:D,updateConnection:L,onNodesChangeMiddlewareMap:Y}=w();for(const[G,te]of C){const I=A.get(G),F=!!(I?.expandParent&&I?.parentId&&te?.position),V={id:G,type:"position",position:F?{x:Math.max(0,te.position.x),y:Math.max(0,te.position.y)}:te.position,dragging:_};if(I&&D.inProgress&&D.fromNode.id===I.id){const T=ia(I,D.fromHandle,ye.Left,!0);L({...D,from:T})}F&&I.parentId&&k.push({id:G,parentId:I.parentId,rect:{...te.internals.positionAbsolute,width:te.measured.width??0,height:te.measured.height??0}}),j.push(V)}if(k.length>0){const{parentLookup:G,nodeOrigin:te}=w(),I=Rd(k,A,G,te);j.push(...I)}for(const G of Y.values())j=G(j);$(j)},triggerNodeChanges:C=>{const{onNodesChange:_,setNodes:k,nodes:j,hasDefaultNodes:A,debug:$}=w();if(C?.length){if(A){const D=Cv(C,j);k(D)}$&&console.log("React Flow: trigger node changes",C),_?.(C)}},triggerEdgeChanges:C=>{const{onEdgesChange:_,setEdges:k,edges:j,hasDefaultEdges:A,debug:$}=w();if(C?.length){if(A){const D=Mv(C,j);k(D)}$&&console.log("React Flow: trigger edge changes",C),_?.(C)}},addSelectedNodes:C=>{const{multiSelectionActive:_,edgeLookup:k,nodeLookup:j,triggerNodeChanges:A,triggerEdgeChanges:$}=w();if(_){const D=C.map(L=>Kl(L,!0));A(D);return}A(Fa(j,new Set([...C]),!0)),$(Fa(k))},addSelectedEdges:C=>{const{multiSelectionActive:_,edgeLookup:k,nodeLookup:j,triggerNodeChanges:A,triggerEdgeChanges:$}=w();if(_){const D=C.map(L=>Kl(L,!0));$(D);return}$(Fa(k,new Set([...C]))),A(Fa(j,new Set,!0))},unselectNodesAndEdges:({nodes:C,edges:_}={})=>{const{edges:k,nodes:j,nodeLookup:A,triggerNodeChanges:$,triggerEdgeChanges:D}=w(),L=C||j,Y=_||k,G=[];for(const I of L){if(!I.selected)continue;const F=A.get(I.id);F&&(F.selected=!1),G.push(Kl(I.id,!1))}const te=[];for(const I of Y)I.selected&&te.push(Kl(I.id,!1));$(G),D(te)},setMinZoom:C=>{const{panZoom:_,maxZoom:k}=w();_?.setScaleExtent([C,k]),S({minZoom:C})},setMaxZoom:C=>{const{panZoom:_,minZoom:k}=w();_?.setScaleExtent([k,C]),S({maxZoom:C})},setTranslateExtent:C=>{w().panZoom?.setTranslateExtent(C),S({translateExtent:C})},resetSelectedElements:()=>{const{edges:C,nodes:_,triggerNodeChanges:k,triggerEdgeChanges:j,elementsSelectable:A}=w();if(!A)return;const $=_.reduce((L,Y)=>Y.selected?[...L,Kl(Y.id,!1)]:L,[]),D=C.reduce((L,Y)=>Y.selected?[...L,Kl(Y.id,!1)]:L,[]);k($),j(D)},setNodeExtent:C=>{const{nodes:_,nodeLookup:k,parentLookup:j,nodeOrigin:A,elevateNodesOnSelect:$,nodeExtent:D,zIndexMode:L}=w();C[0][0]===D[0][0]&&C[0][1]===D[0][1]&&C[1][0]===D[1][0]&&C[1][1]===D[1][1]||(nd(_,k,j,{nodeOrigin:A,nodeExtent:C,elevateNodesOnSelect:$,checkEquality:!1,zIndexMode:L}),S({nodeExtent:C}))},panBy:C=>{const{transform:_,width:k,height:j,panZoom:A,translateExtent:$}=w();return aE({delta:C,panZoom:A,transform:_,translateExtent:$,width:k,height:j})},setCenter:async(C,_,k)=>{const{width:j,height:A,maxZoom:$,panZoom:D}=w();if(!D)return!1;const L=typeof k?.zoom<"u"?k.zoom:$;return await D.setViewport({x:j/2-C*L,y:A/2-_*L,zoom:L},{duration:k?.duration,ease:k?.ease,interpolate:k?.interpolate}),!0},cancelConnection:()=>{S({connection:{...Qy}})},updateConnection:C=>{S({connection:C})},reset:()=>S({...k0()})}},Object.is);function tx({initialNodes:n,initialEdges:a,defaultNodes:s,defaultEdges:o,initialWidth:c,initialHeight:u,initialMinZoom:f,initialMaxZoom:m,initialFitViewOptions:p,fitView:y,nodeOrigin:x,nodeExtent:g,zIndexMode:v,children:S}){const[w]=z.useState(()=>qq({nodes:n,edges:a,defaultNodes:s,defaultEdges:o,width:c,height:u,fitView:y,minZoom:f,maxZoom:m,fitViewOptions:p,nodeOrigin:x,nodeExtent:g,zIndexMode:v}));return d.jsx(LE,{value:w,children:d.jsx(f_,{children:d.jsx(__,{children:S})})})}function Cq({children:n,nodes:a,edges:s,defaultNodes:o,defaultEdges:c,width:u,height:f,fitView:m,fitViewOptions:p,minZoom:y,maxZoom:x,nodeOrigin:g,nodeExtent:v,zIndexMode:S}){return z.useContext(Gc)?d.jsx(d.Fragment,{children:n}):d.jsx(tx,{initialNodes:a,initialEdges:s,defaultNodes:o,defaultEdges:c,initialWidth:u,initialHeight:f,fitView:m,initialFitViewOptions:p,initialMinZoom:y,initialMaxZoom:x,nodeOrigin:g,nodeExtent:v,zIndexMode:S,children:n})}const Mq={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Tq({nodes:n,edges:a,defaultNodes:s,defaultEdges:o,className:c,nodeTypes:u,edgeTypes:f,onNodeClick:m,onEdgeClick:p,onInit:y,onMove:x,onMoveStart:g,onMoveEnd:v,onConnect:S,onConnectStart:w,onConnectEnd:q,onClickConnectStart:C,onClickConnectEnd:_,onNodeMouseEnter:k,onNodeMouseMove:j,onNodeMouseLeave:A,onNodeContextMenu:$,onNodeDoubleClick:D,onNodeDragStart:L,onNodeDrag:Y,onNodeDragStop:G,onNodesDelete:te,onEdgesDelete:I,onDelete:F,onSelectionChange:V,onSelectionDragStart:T,onSelectionDrag:B,onSelectionDragStop:E,onSelectionContextMenu:M,onSelectionStart:O,onSelectionEnd:R,onBeforeDelete:Z,connectionMode:ee,connectionLineType:P=El.Bezier,connectionLineStyle:oe,connectionLineComponent:ce,connectionLineContainerStyle:ue,deleteKeyCode:xe="Backspace",selectionKeyCode:de="Shift",selectionOnDrag:le=!1,selectionMode:re=Es.Full,panActivationKeyCode:pe="Space",multiSelectionKeyCode:Se=Cs()?"Meta":"Control",zoomActivationKeyCode:he=Cs()?"Meta":"Control",snapToGrid:ge,snapGrid:we,onlyRenderVisibleElements:Ee=!1,selectNodesOnDrag:Be,nodesDraggable:Je,autoPanOnNodeFocus:pt,nodesConnectable:ht,nodesFocusable:se,nodeOrigin:Oe=_v,edgesFocusable:xn,edgesReconnectable:bn,elementsSelectable:Fe=!0,defaultViewport:Mt=PE,minZoom:Lt=.5,maxZoom:$t=2,translateExtent:Vt=js,preventScrolling:Fc=!0,nodeExtent:sa,defaultMarkerColor:Wc="#b1b1b7",zoomOnScroll:Pc=!0,zoomOnPinch:Ml=!0,panOnScroll:gt=!1,panOnScrollSpeed:un=.5,panOnScrollMode:yt=ea.Free,zoomOnDoubleClick:er=!0,panOnDrag:tr=!0,onPaneClick:nr,onPaneMouseEnter:oa,onPaneMouseMove:ca,onPaneMouseLeave:ra,onPaneScroll:Sn,onPaneContextMenu:ua,paneClickDistance:Tl=1,nodeClickDistance:lr=0,children:Bs,onReconnect:fi,onReconnectStart:Al,onReconnectEnd:ar,onEdgeContextMenu:Us,onEdgeDoubleClick:Ls,onEdgeMouseEnter:$s,onEdgeMouseMove:di,onEdgeMouseLeave:hi,reconnectRadius:Vs=10,onNodesChange:Ys,onEdgesChange:fn,noDragClassName:st="nodrag",noWheelClassName:mt="nowheel",noPanClassName:wn="nopan",fitView:fa,fitViewOptions:Xs,connectOnClick:ir,attributionPosition:Is,proOptions:zl,defaultEdgeOptions:mi,elevateNodesOnSelect:Gn=!0,elevateEdgesOnSelect:Zn=!1,disableKeyboardA11y:Qn=!1,autoPanOnConnect:Kn,autoPanOnNodeDrag:et,autoPanOnSelection:Gs=!0,autoPanSpeed:Zs,connectionRadius:Nn,isValidConnection:Jn,onError:sr,style:Qs,id:pi,nodeDragThreshold:or,connectionDragThreshold:da,viewport:ha,onViewportChange:Ft,width:xt,height:Ks,colorMode:cr="light",debug:gi,onScroll:yi,ariaLabelConfig:ma,zIndexMode:Js="basic",...bt},vi){const pa=pi||"1",xi=l_(cr),Fn=z.useCallback(bi=>{bi.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),yi?.(bi)},[yi]);return d.jsx("div",{"data-testid":"rf__wrapper",...bt,onScroll:Fn,style:{...Qs,...Mq},ref:vi,className:it(["react-flow",c,xi]),id:pi,role:"application",children:d.jsxs(Cq,{nodes:n,edges:a,width:xt,height:Ks,fitView:fa,fitViewOptions:Xs,minZoom:Lt,maxZoom:$t,nodeOrigin:Oe,nodeExtent:sa,zIndexMode:Js,children:[d.jsx(n_,{nodes:n,edges:a,defaultNodes:s,defaultEdges:o,onConnect:S,onConnectStart:w,onConnectEnd:q,onClickConnectStart:C,onClickConnectEnd:_,nodesDraggable:Je,autoPanOnNodeFocus:pt,nodesConnectable:ht,nodesFocusable:se,edgesFocusable:xn,edgesReconnectable:bn,elementsSelectable:Fe,elevateNodesOnSelect:Gn,elevateEdgesOnSelect:Zn,minZoom:Lt,maxZoom:$t,nodeExtent:sa,onNodesChange:Ys,onEdgesChange:fn,snapToGrid:ge,snapGrid:we,connectionMode:ee,translateExtent:Vt,connectOnClick:ir,defaultEdgeOptions:mi,fitView:fa,fitViewOptions:Xs,onNodesDelete:te,onEdgesDelete:I,onDelete:F,onNodeDragStart:L,onNodeDrag:Y,onNodeDragStop:G,onSelectionDrag:B,onSelectionDragStart:T,onSelectionDragStop:E,onMove:x,onMoveStart:g,onMoveEnd:v,noPanClassName:wn,nodeOrigin:Oe,rfId:pa,autoPanOnConnect:Kn,autoPanOnNodeDrag:et,autoPanSpeed:Zs,onError:sr,connectionRadius:Nn,isValidConnection:Jn,selectNodesOnDrag:Be,nodeDragThreshold:or,connectionDragThreshold:da,onBeforeDelete:Z,debug:gi,ariaLabelConfig:ma,zIndexMode:Js}),d.jsx(Eq,{onInit:y,onNodeClick:m,onEdgeClick:p,onNodeMouseEnter:k,onNodeMouseMove:j,onNodeMouseLeave:A,onNodeContextMenu:$,onNodeDoubleClick:D,nodeTypes:u,edgeTypes:f,connectionLineType:P,connectionLineStyle:oe,connectionLineComponent:ce,connectionLineContainerStyle:ue,selectionKeyCode:de,selectionOnDrag:le,selectionMode:re,deleteKeyCode:xe,multiSelectionKeyCode:Se,panActivationKeyCode:pe,zoomActivationKeyCode:he,onlyRenderVisibleElements:Ee,defaultViewport:Mt,translateExtent:Vt,minZoom:Lt,maxZoom:$t,preventScrolling:Fc,zoomOnScroll:Pc,zoomOnPinch:Ml,zoomOnDoubleClick:er,panOnScroll:gt,panOnScrollSpeed:un,panOnScrollMode:yt,panOnDrag:tr,autoPanOnSelection:Gs,onPaneClick:nr,onPaneMouseEnter:oa,onPaneMouseMove:ca,onPaneMouseLeave:ra,onPaneScroll:Sn,onPaneContextMenu:ua,paneClickDistance:Tl,nodeClickDistance:lr,onSelectionContextMenu:M,onSelectionStart:O,onSelectionEnd:R,onReconnect:fi,onReconnectStart:Al,onReconnectEnd:ar,onEdgeContextMenu:Us,onEdgeDoubleClick:Ls,onEdgeMouseEnter:$s,onEdgeMouseMove:di,onEdgeMouseLeave:hi,reconnectRadius:Vs,defaultMarkerColor:Wc,noDragClassName:st,noWheelClassName:mt,noPanClassName:wn,rfId:pa,disableKeyboardA11y:Qn,nodeExtent:sa,viewport:ha,onViewportChange:Ft}),d.jsx(WE,{onSelectionChange:V}),Bs,d.jsx(ZE,{proOptions:zl,position:Is}),d.jsx(GE,{rfId:pa,disableKeyboardA11y:Qn})]})})}var Aq=Tv(Tq);function zq(n){const[a,s]=z.useState(n),o=z.useCallback(c=>s(u=>Cv(c,u)),[]);return[a,s,o]}function Dq(n){const[a,s]=z.useState(n),o=z.useCallback(c=>s(u=>Mv(c,u)),[]);return[a,s,o]}function Oq({dimensions:n,lineWidth:a,variant:s,className:o}){return d.jsx("path",{strokeWidth:a,d:`M${n[0]/2} 0 V${n[1]} M0 ${n[1]/2} H${n[0]}`,className:it(["react-flow__background-pattern",s,o])})}function Hq({radius:n,className:a}){return d.jsx("circle",{cx:n,cy:n,r:n,className:it(["react-flow__background-pattern","dots",a])})}var ql;(function(n){n.Lines="lines",n.Dots="dots",n.Cross="cross"})(ql||(ql={}));const kq={[ql.Dots]:1,[ql.Lines]:1,[ql.Cross]:6},Rq=n=>({transform:n.transform,patternId:`pattern-${n.rfId}`});function nx({id:n,variant:a=ql.Dots,gap:s=20,size:o,lineWidth:c=1,offset:u=0,color:f,bgColor:m,style:p,className:y,patternClassName:x}){const g=z.useRef(null),{transform:v,patternId:S}=Ae(Rq,Ge),w=o||kq[a],q=a===ql.Dots,C=a===ql.Cross,_=Array.isArray(s)?s:[s,s],k=[_[0]*v[2]||1,_[1]*v[2]||1],j=w*v[2],A=Array.isArray(u)?u:[u,u],$=C?[j,j]:k,D=[A[0]*v[2]||1+$[0]/2,A[1]*v[2]||1+$[1]/2],L=`${S}${n||""}`;return d.jsxs("svg",{className:it(["react-flow__background",y]),style:{...p,...Kc,"--xy-background-color-props":m,"--xy-background-pattern-color-props":f},ref:g,"data-testid":"rf__background",children:[d.jsx("pattern",{id:L,x:v[0]%k[0],y:v[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${D[0]},-${D[1]})`,children:q?d.jsx(Hq,{radius:j/2,className:x}):d.jsx(Oq,{dimensions:$,lineWidth:c,variant:a,className:x})}),d.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${L})`})]})}nx.displayName="Background";const Bq=z.memo(nx);function Uq(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:d.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Lq(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:d.jsx("path",{d:"M0 0h32v4.2H0z"})})}function $q(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:d.jsx("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 Vq(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:d.jsx("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 Yq(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:d.jsx("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"})})}function yc({children:n,className:a,...s}){return d.jsx("button",{type:"button",className:it(["react-flow__controls-button",a]),...s,children:n})}const Xq=n=>({isInteractive:n.nodesDraggable||n.nodesConnectable||n.elementsSelectable,minZoomReached:n.transform[2]<=n.minZoom,maxZoomReached:n.transform[2]>=n.maxZoom,ariaLabelConfig:n.ariaLabelConfig});function lx({style:n,showZoom:a=!0,showFitView:s=!0,showInteractive:o=!0,fitViewOptions:c,onZoomIn:u,onZoomOut:f,onFitView:m,onInteractiveChange:p,className:y,children:x,position:g="bottom-left",orientation:v="vertical","aria-label":S}){const w=Ze(),{isInteractive:q,minZoomReached:C,maxZoomReached:_,ariaLabelConfig:k}=Ae(Xq,Ge),{zoomIn:j,zoomOut:A,fitView:$}=Qc(),D=()=>{j(),u?.()},L=()=>{A(),f?.()},Y=()=>{$(c),m?.()},G=()=>{w.setState({nodesDraggable:!q,nodesConnectable:!q,elementsSelectable:!q}),p?.(!q)},te=v==="horizontal"?"horizontal":"vertical";return d.jsxs(Zc,{className:it(["react-flow__controls",te,y]),position:g,style:n,"data-testid":"rf__controls","aria-label":S??k["controls.ariaLabel"],children:[a&&d.jsxs(d.Fragment,{children:[d.jsx(yc,{onClick:D,className:"react-flow__controls-zoomin",title:k["controls.zoomIn.ariaLabel"],"aria-label":k["controls.zoomIn.ariaLabel"],disabled:_,children:d.jsx(Uq,{})}),d.jsx(yc,{onClick:L,className:"react-flow__controls-zoomout",title:k["controls.zoomOut.ariaLabel"],"aria-label":k["controls.zoomOut.ariaLabel"],disabled:C,children:d.jsx(Lq,{})})]}),s&&d.jsx(yc,{className:"react-flow__controls-fitview",onClick:Y,title:k["controls.fitView.ariaLabel"],"aria-label":k["controls.fitView.ariaLabel"],children:d.jsx($q,{})}),o&&d.jsx(yc,{className:"react-flow__controls-interactive",onClick:G,title:k["controls.interactive.ariaLabel"],"aria-label":k["controls.interactive.ariaLabel"],children:q?d.jsx(Yq,{}):d.jsx(Vq,{})}),x]})}lx.displayName="Controls";const Iq=z.memo(lx);function Gq({id:n,x:a,y:s,width:o,height:c,style:u,color:f,strokeColor:m,strokeWidth:p,className:y,borderRadius:x,shapeRendering:g,selected:v,onClick:S}){const{background:w,backgroundColor:q}=u||{},C=f||w||q;return d.jsx("rect",{className:it(["react-flow__minimap-node",{selected:v},y]),x:a,y:s,rx:x,ry:x,width:o,height:c,style:{fill:C,stroke:m,strokeWidth:p},shapeRendering:g,onClick:S?_=>S(_,n):void 0})}const Zq=z.memo(Gq),Qq=n=>n.nodes.map(a=>a.id),Af=n=>n instanceof Function?n:()=>n;function Kq({nodeStrokeColor:n,nodeColor:a,nodeClassName:s="",nodeBorderRadius:o=5,nodeStrokeWidth:c,nodeComponent:u=Zq,onClick:f}){const m=Ae(Qq,Ge),p=Af(a),y=Af(n),x=Af(s),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return d.jsx(d.Fragment,{children:m.map(v=>d.jsx(Fq,{id:v,nodeColorFunc:p,nodeStrokeColorFunc:y,nodeClassNameFunc:x,nodeBorderRadius:o,nodeStrokeWidth:c,NodeComponent:u,onClick:f,shapeRendering:g},v))})}function Jq({id:n,nodeColorFunc:a,nodeStrokeColorFunc:s,nodeClassNameFunc:o,nodeBorderRadius:c,nodeStrokeWidth:u,shapeRendering:f,NodeComponent:m,onClick:p}){const{node:y,x,y:g,width:v,height:S}=Ae(w=>{const q=w.nodeLookup.get(n);if(!q)return{node:void 0,x:0,y:0,width:0,height:0};const C=q.internals.userNode,{x:_,y:k}=q.internals.positionAbsolute,{width:j,height:A}=In(C);return{node:C,x:_,y:k,width:j,height:A}},Ge);return!y||y.hidden||!nv(y)?null:d.jsx(m,{x,y:g,width:v,height:S,style:y.style,selected:!!y.selected,className:o(y),color:a(y),borderRadius:c,strokeColor:s(y),strokeWidth:u,shapeRendering:f,onClick:p,id:y.id})}const Fq=z.memo(Jq);var Wq=z.memo(Kq);const Pq=200,eC=150,tC=n=>!n.hidden,nC=n=>{const a={x:-n.transform[0]/n.transform[2],y:-n.transform[1]/n.transform[2],width:n.width/n.transform[2],height:n.height/n.transform[2]};return{viewBB:a,boundingRect:n.nodeLookup.size>0?Py(Hs(n.nodeLookup,{filter:tC}),a):a,rfId:n.rfId,panZoom:n.panZoom,translateExtent:n.translateExtent,flowWidth:n.width,flowHeight:n.height,ariaLabelConfig:n.ariaLabelConfig}},lC="react-flow__minimap-desc";function ax({style:n,className:a,nodeStrokeColor:s,nodeColor:o,nodeClassName:c="",nodeBorderRadius:u=5,nodeStrokeWidth:f,nodeComponent:m,bgColor:p,maskColor:y,maskStrokeColor:x,maskStrokeWidth:g,position:v="bottom-right",onClick:S,onNodeClick:w,pannable:q=!1,zoomable:C=!1,ariaLabel:_,inversePan:k,zoomStep:j=1,offsetScale:A=5}){const $=Ze(),D=z.useRef(null),{boundingRect:L,viewBB:Y,rfId:G,panZoom:te,translateExtent:I,flowWidth:F,flowHeight:V,ariaLabelConfig:T}=Ae(nC,Ge),B=n?.width??Pq,E=n?.height??eC,M=L.width/B,O=L.height/E,R=Math.max(M,O),Z=R*B,ee=R*E,P=A*R,oe=L.x-(Z-L.width)/2-P,ce=L.y-(ee-L.height)/2-P,ue=Z+P*2,xe=ee+P*2,de=`${lC}-${G}`,le=z.useRef(0),re=z.useRef();le.current=R,z.useEffect(()=>{if(D.current&&te)return re.current=hE({domNode:D.current,panZoom:te,getTransform:()=>$.getState().transform,getViewScale:()=>le.current}),()=>{re.current?.destroy()}},[te]),z.useEffect(()=>{re.current?.update({translateExtent:I,width:F,height:V,inversePan:k,pannable:q,zoomStep:j,zoomable:C})},[q,C,k,j,I,F,V]);const pe=S?ge=>{const[we,Ee]=re.current?.pointer(ge)||[0,0];S(ge,{x:we,y:Ee})}:void 0,Se=w?z.useCallback((ge,we)=>{const Ee=$.getState().nodeLookup.get(we).internals.userNode;w(ge,Ee)},[]):void 0,he=_??T["minimap.ariaLabel"];return d.jsx(Zc,{position:v,style:{...n,"--xy-minimap-background-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-background-color-props":typeof y=="string"?y:void 0,"--xy-minimap-mask-stroke-color-props":typeof x=="string"?x:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*R:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof s=="string"?s:void 0,"--xy-minimap-node-stroke-width-props":typeof f=="number"?f:void 0},className:it(["react-flow__minimap",a]),"data-testid":"rf__minimap",children:d.jsxs("svg",{width:B,height:E,viewBox:`${oe} ${ce} ${ue} ${xe}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":de,ref:D,onClick:pe,children:[he&&d.jsx("title",{id:de,children:he}),d.jsx(Wq,{onClick:Se,nodeColor:o,nodeStrokeColor:s,nodeBorderRadius:u,nodeClassName:c,nodeStrokeWidth:f,nodeComponent:m}),d.jsx("path",{className:"react-flow__minimap-mask",d:`M${oe-P},${ce-P}h${ue+P*2}v${xe+P*2}h${-ue-P*2}z
|
|
47
|
-
M${Y.x},${Y.y}h${Y.width}v${Y.height}h${-Y.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ax.displayName="MiniMap";const aC=z.memo(ax),iC=n=>a=>n?`${Math.max(1/a.transform[2],1)}`:void 0,sC={[ci.Line]:"right",[ci.Handle]:"bottom-right"};function oC({nodeId:n,position:a,variant:s=ci.Handle,className:o,style:c=void 0,children:u,color:f,minWidth:m=10,minHeight:p=10,maxWidth:y=Number.MAX_VALUE,maxHeight:x=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:v,autoScale:S=!0,shouldResize:w,onResizeStart:q,onResize:C,onResizeEnd:_}){const k=Ov(),j=typeof n=="string"?n:k,A=Ze(),$=z.useRef(null),D=s===ci.Handle,L=Ae(z.useCallback(iC(D&&S),[D,S]),Ge),Y=z.useRef(null),G=a??sC[s];z.useEffect(()=>{if(!(!$.current||!j))return Y.current||(Y.current=_E({domNode:$.current,nodeId:j,getStoreItems:()=>{const{nodeLookup:I,transform:F,snapGrid:V,snapToGrid:T,nodeOrigin:B,domNode:E}=A.getState();return{nodeLookup:I,transform:F,snapGrid:V,snapToGrid:T,nodeOrigin:B,paneDomNode:E}},onChange:(I,F)=>{const{triggerNodeChanges:V,nodeLookup:T,parentLookup:B,nodeOrigin:E}=A.getState(),M=[],O={x:I.x,y:I.y},R=T.get(j);if(R&&R.expandParent&&R.parentId){const Z=R.origin??E,ee=I.width??R.measured.width??0,P=I.height??R.measured.height??0,oe={id:R.id,parentId:R.parentId,rect:{width:ee,height:P,...lv({x:I.x??R.position.x,y:I.y??R.position.y},{width:ee,height:P},R.parentId,T,Z)}},ce=Rd([oe],T,B,E);M.push(...ce),O.x=I.x?Math.max(Z[0]*ee,I.x):void 0,O.y=I.y?Math.max(Z[1]*P,I.y):void 0}if(O.x!==void 0&&O.y!==void 0){const Z={id:j,type:"position",position:{...O}};M.push(Z)}if(I.width!==void 0&&I.height!==void 0){const ee={id:j,type:"dimensions",resizing:!0,setAttributes:v?v==="horizontal"?"width":"height":!0,dimensions:{width:I.width,height:I.height}};M.push(ee)}for(const Z of F){const ee={...Z,type:"position"};M.push(ee)}V(M)},onEnd:({width:I,height:F})=>{const V={id:j,type:"dimensions",resizing:!1,dimensions:{width:I,height:F}};A.getState().triggerNodeChanges([V])}})),Y.current.update({controlPosition:G,boundaries:{minWidth:m,minHeight:p,maxWidth:y,maxHeight:x},keepAspectRatio:g,resizeDirection:v,onResizeStart:q,onResize:C,onResizeEnd:_,shouldResize:w}),()=>{Y.current?.destroy()}},[G,m,p,y,x,g,q,C,_,w]);const te=G.split("-");return d.jsx("div",{className:it(["react-flow__resize-control","nodrag",...te,s,o]),ref:$,style:{...c,scale:L,...f&&{[D?"backgroundColor":"borderColor"]:f}},children:u})}z.memo(oC);const Ts=null,{min:Fl,max:tn,abs:R0,floor:cC}=Math,ix=(n,a,s)=>Fl(s,tn(a,n)),sx=n=>[...n].sort((a,s)=>a-s),ox=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)},id=()=>{let n;return[new Promise(a=>{n=a}),n]},cx=n=>{let a;return()=>(n&&(a=n(),n=void 0),a)},xs=(n,a,s)=>{const o=s?"unshift":"push";for(let c=0;c<a;c++)n[o](-1);return n},rx=(n,a)=>{const s=n.t[a];return s===-1?n.o:s},rC=(n,a,s)=>{const o=n.t[a]===-1;return n.t[a]=s,n.i=Fl(a,n.i),o},Ec=(n,a)=>{if(!n.l)return 0;if(n.i>=a)return n.u[a];n.i<0&&(n.u[0]=0,n.i=0);let s=n.i,o=n.u[s];for(;s<a;)o+=rx(n,s),n.u[++s]=o;return n.i=a,o},Ka=(n,a,s=0,o=n.l-1)=>{let c=s;for(;s<=o;){const u=cC((s+o)/2);Ec(n,u)<=a?(c=u,s=u+1):o=u-1}return ix(c,0,n.l-1)},B0=(n,a,s)=>{const o=a-n.l;return n.i=s?-1:Fl(a-1,n.i),n.l=a,o>0?(xs(n.u,o),xs(n.t,o,s),n.o*o):(n.u.splice(o),(s?n.t.splice(0,-o):n.t.splice(o)).reduce((c,u)=>c-(u===-1?n.o:u),0))},uC=typeof window<"u",fC=n=>n.documentElement,dC=n=>n.ownerDocument,hC=n=>n.defaultView,ux=cx(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),mC=cx(()=>"scrollBehavior"in fC(document).style),pC=n=>tn(n.h(),n.p()),gC=(n,a=40,s=0,o,c=!1)=>{let u=!!s,f=1,m=0,p=0,y=0,x=0,g=0,v=0,S=0,w=0,q=Ts,C=[0,u?tn(s-1,0):-1],_=0,k=!1;const j=((V,T,B)=>({o:T,t:B?xs(B.slice(0,Fl(V,B.length)),tn(0,V-B.length)):xs([],V),l:V,i:-1,u:xs([],V+1)}))(n,o?o[1]:a,o&&o[0]),A=new Set,$=()=>y-p,D=()=>$()+g+x,L=(V,T)=>((B,E,M,O)=>{if(O=Fl(O,B.l-1),Ec(B,O)<=E){const R=Ka(B,M,O);return[Ka(B,E,O,R),R]}{const R=Ka(B,E,void 0,O);return[R,Ka(B,M,R)]}})(j,V,T,C[0]),Y=()=>Ec(j,j.l),G=(V,T)=>{const B=Ec(j,V)-g;return T?Y()-B-te(V):B},te=V=>rx(j,V),I=(V,T=-1)=>j.t[V]===T,F=V=>{V&&(ux()&&S!==0||q&&w===1?g+=V:x+=V)};return{v:()=>{A.clear()},m:()=>f,_:()=>(V=>[V.t.slice(),V.o])(j),S:(V=200)=>{if(!k||u)return C;let T,B;if(v)[T,B]=C;else{let E=tn(0,D()),M=E+m;c||(V=tn(0,V),S!==1&&(E-=V),S!==2&&(M+=V)),[T,B]=C=L(tn(0,E),tn(0,M)),q&&(T=Fl(T,q[0]),B=tn(B,q[1]))}return[tn(T,0),Fl(B,j.l-1)]},$:V=>Ka(j,V-p),I,k:G,R:te,T:()=>j.l,C:()=>y,M:()=>S!==0,p:()=>m,O:()=>p,h:Y,H:()=>(v=x,x=0,[v,w===2]),W:(V,T)=>{const B=[V,T];return A.add(B),()=>{A.delete(B)}},B:(V,T)=>{let B,E,M=0;switch(V){case 1:{if(T===y&&w===0)break;const O=v;v=0;const R=T-y,Z=R0(R);O&&Z<R0(O)+1||w!==0||(S=R<0?2:1),u&&(u=!1),y=T,M=4;const ee=$();ee>=-m&&ee<=Y()&&(M+=1,E=Z>m);break}case 2:M=8,S!==0&&(B=!0,M+=1),S=0,w=0,q=Ts;break;case 3:{const O=T.filter(([R,Z])=>!I(R,Z));if(!O.length)break;F(O.reduce((R,[Z,ee])=>{let P;if(w===2)P=!0;else if(q&&w===1)P=Z<q[0];else{const oe=$(),ce=G(Z),ue=te(Z);P=S!==1&&w===0?ce+ue<oe:ce<oe&&ce+ue<oe+m}return P&&(R+=ee-te(Z)),R},0));for(const[R,Z]of O){const ee=te(R),P=rC(j,R,Z);c&&(_+=P?Z:Z-ee)}c&&m&&_>m&&(F(((R,Z)=>{let ee=0;const P=[];R.t.forEach((le,re)=>{le!==-1&&(P.push(le),re<Z&&ee++)}),R.i=-1;const oe=sx(P),ce=oe.length,ue=ce/2|0,xe=ce%2==0?(oe[ue-1]+oe[ue])/2:oe[ue],de=R.o;return((R.o=xe)-de)*tn(Z-ee,0)})(j,Ka(j,D()))),c=!1),M=3,E=!0;break}case 4:m!==T&&(m||(k=E=!0),m=T,M=3);break;case 5:T[1]?(F(B0(j,T[0],!0)),w=2,M=1):(B0(j,T[0]),M=1);break;case 6:p=T;break;case 7:w=1;break;case 8:q=L(T,T+m),M=1}M&&(f=1+(2147483647&f),B&&g&&(x+=g,g=0),A.forEach(([O,R])=>{M&O&&R(E)}))}}},Ud=setTimeout,zf=(n,a)=>a?-n:n,yC=(n,a,s,o,c,u)=>{const f=Date.now;let m=0,p=!1,y=!1,x=!1,g=!1;const v=(()=>{let _;const k=()=>{_!=Ts&&clearTimeout(_)},j=()=>{k(),_=Ud(()=>{_=Ts,(()=>{if(p||y)return p=!1,void v();x=!1,n.B(2)})()},150)};return j.J=k,j})(),S=()=>{m=f(),x&&(g=!0),n.B(1,o()),v()},w=_=>{if(p||!n.M()||_.ctrlKey)return;const k=f()-m;150>k&&50<k&&(s?_.deltaX:_.deltaY)&&(p=!0)},q=()=>{y=!0,x=g=!1},C=()=>{y=!1,ux()&&(x=!0)};return a.addEventListener("scroll",S),a.addEventListener("wheel",w,{passive:!0}),a.addEventListener("touchstart",q,{passive:!0}),a.addEventListener("touchend",C,{passive:!0}),{A:()=>{a.removeEventListener("scroll",S),a.removeEventListener("wheel",w),a.removeEventListener("touchstart",q),a.removeEventListener("touchend",C),v.J()},L:()=>{const[_,k]=n.H();_&&(c(_,k,g),g=!1,k&&n.p()>n.h()&&n.B(1,o()))}}},vC=(n,a,s)=>{let o;return[async(c,u)=>{if(!await a())return;o&&o();const f=()=>{const[m,p]=id();return o=()=>{p(!1)},n.p()&&Ud(o,150),[m,n.W(2,()=>{p(!0)})]};if(u&&mC())n.B(8,c()),ox(async()=>{for(;;){let m=!0;for(let[x,g]=n.S();x<=g;x++)if(n.I(x)){m=!1;break}if(m)break;const[p,y]=f();try{if(!await p)return}finally{y()}}n.B(7),s(c(),u)});else for(;;){const[m,p]=f();try{if(n.B(7),s(c()),!await m)return}finally{p()}}},()=>{o&&o()}]},xC=(n,a)=>{let s,o,c=id(),u=!1;const f=a?"scrollLeft":"scrollTop",m=a?"overflowX":"overflowY",[p,y]=vC(n,()=>c[0],(x,g)=>{x=zf(x,u),g?s.scrollTo({[a?"left":"top"]:x,behavior:"smooth"}):s[f]=x});return{N(x,g){s=g,a&&(u=getComputedStyle(g).direction==="rtl"),o=yC(n,g,a,()=>zf(g[f],u),(v,S,w)=>{if(w){const q=g.style,C=q[m];q[m]="hidden",Ud(()=>{q[m]=C})}g[f]=zf(n.C()+v,u),S&&y()}),c[1](!0)},v(){o&&o.A(),c[1](!1),c=id()},P:()=>u,V(x){p(()=>x)},X(x){x+=n.C(),p(()=>x)},Y(x,{align:g,smooth:v,offset:S=0}={}){if(x=ix(x,0,n.T()-1),g==="nearest"){const w=n.k(x),q=n.C();if(w<q)g="start";else{if(!(w+n.R(x)>q+n.p()))return;g="end"}}p(()=>S+n.O()+n.k(x)+(g==="end"?n.R(x)-n.p():g==="center"?(n.R(x)-n.p())/2:0),v)},q:()=>{o&&o.L()}}},bC=n=>{let a;return{D(s){(a||(a=new(hC(dC(s))).ResizeObserver(n))).observe(s)},j(s){a.unobserve(s)},A(){a&&a.disconnect()}}},SC=(n,a)=>{let s;const o=a?"width":"height",c=new WeakMap,u=bC(f=>{const m=[];for(const{target:p,contentRect:y}of f)if(p.offsetParent)if(p===s)n.B(4,y[o]);else{const x=c.get(p);x!=Ts&&m.push([x,y[o]])}m.length&&n.B(3,m)});return{G(f){u.D(s=f)},U:(f,m)=>(c.set(f,m),u.D(f),()=>{c.delete(f),u.j(f)}),v:u.A}},kc=uC?z.useLayoutEffect:z.useEffect,Rt="current",fx=(n,a)=>{if(Array.isArray(n))for(const s of n)fx(s,a);else n==null||typeof n=="boolean"||a.push(n)},wC=(n,a)=>{const s=n.key;return s??"_"+a},NC=n=>{const a=z.useRef(null);return a[Rt]||(a[Rt]=n())},U0=n=>{const a=z.useRef(n);return kc(()=>{a[Rt]=n},[n]),a},jC=z.memo(({Z:n,ee:a,te:s,oe:o,ne:c,re:u,ie:f,se:m})=>{const p=z.useRef(null);kc(()=>a(p[Rt],s),[s]);const y=z.useMemo(()=>{const x={contain:"layout style",position:c&&m?void 0:"absolute",[f?"height":"width"]:"100%",[f?"top":"left"]:0,[f?"left":"top"]:o,visibility:!c||m?void 0:"hidden"};return f&&(x.display="inline-flex"),x},[o,c,m,f]);return d.jsx(u,typeof u=="string"?{ref:p,style:y,children:n}:{ref:p,style:y,index:s,children:n})}),EC=(n,a)=>z.useMemo(()=>{if(typeof n=="function")return[o=>n(a[o],o),a.length];const s=(o=>{const c=[];return fx(o,c),c})(n);return[o=>s[o],s.length]},[n,a]),_C=z.forwardRef(({children:n,data:a,bufferSize:s,itemSize:o,shift:c,horizontal:u,keepMounted:f,cache:m,startMargin:p=0,ssrCount:y,as:x="div",item:g="div",scrollRef:v,onScroll:S,onScrollEnd:w},q)=>{const[C,_]=EC(n,a),k=z.useRef(null),j=z.useRef(!!y),A=U0(S),$=U0(w),[D,L,Y,G]=NC(()=>{const M=!!u,O=gC(_,o,y,m,!o);return[O,SC(O,M),xC(O,M),M]});_!==D.T()&&D.B(5,[_,c]),p!==D.O()&&D.B(6,p);const[te,I]=z.useReducer(D.m,void 0,D.m),F=D.M(),V=D.h(),T=Y.P(),B=[],E=M=>{const O=C(M);return d.jsx(jC,{ee:L.U,te:M,oe:D.k(M,T),ne:D.I(M),re:g,Z:O,ie:G,se:j[Rt]},wC(O,M))};if(kc(()=>{j[Rt]=!1,D.W(1,R=>{R?UE.flushSync(I):I()}),D.W(4,()=>{A[Rt]&&A[Rt](D.C())}),D.W(8,()=>{$[Rt]&&$[Rt]()});const M=k[Rt],O=R=>{L.G(R),Y.N(M,R)};return v?ox(()=>{v[Rt]&&O(v[Rt])}):O(M.parentElement),()=>{D.v(),L.v(),Y.v()}},[]),kc(()=>{Y.q()},[te]),z.useImperativeHandle(q,()=>({get cache(){return D._()},get scrollOffset(){return D.C()},get scrollSize(){return pC(D)},get viewportSize(){return D.p()},findItemIndex:D.$,getItemOffset:D.k,getItemSize:D.R,scrollToIndex:Y.Y,scrollTo:Y.V,scrollBy:Y.X}),[]),f){const M=new Set(f);for(let[O,R]=D.S(s);O<=R;O++)M.add(O);sx([...M]).forEach(O=>{B.push(E(O))})}else for(let[M,O]=D.S(s);M<=O;M++)B.push(E(M));return d.jsx(x,{ref:k,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:G?V:"100%",height:G?"100%":V,pointerEvents:F?"none":void 0},children:B})}),dx=z.forwardRef(({children:n,data:a,bufferSize:s,itemSize:o,shift:c,horizontal:u,keepMounted:f,cache:m,ssrCount:p,item:y,onScroll:x,onScrollEnd:g,style:v,...S},w)=>d.jsx("div",{...S,style:{display:u?"inline-block":"block",[u?"overflowX":"overflowY"]:"auto",contain:"strict",width:"100%",height:"100%",...v},children:d.jsx(_C,{ref:w,data:a,bufferSize:s,itemSize:o,shift:c,horizontal:u,keepMounted:f,cache:m,ssrCount:p,item:y,onScroll:x,onScrollEnd:g,children:n})}));function sd(){return{entries:[],seen:new Set,consumedBatches:new Set,openTools:new Map,rev:0}}function qC(n){return(n.role==="tool"||n.role==="error")&&n.toolUseId!==void 0&&n.toolInput===void 0}function hx(n){return n.toolUseId!==void 0&&n.toolInput!==void 0?`tu:${n.toolUseId}`:`${n.ts}|${n.role}|${n.tool??""}|${n.text}`}function mx(n,a){const s={...a};if(qC(s)){const c=s.toolUseId!==void 0?n.openTools.get(s.toolUseId):void 0;if(c!==void 0){const u={...n.entries[c]};u.text=s.text||"",s.durationMs!==void 0&&(u.durationMs=s.durationMs),s.isError&&(u.role="error",u.isError=!0),n.entries[c]=u;return}}const o=hx(s);n.seen.has(o)||(n.seen.add(o),s.role==="tool"&&s.toolUseId!==void 0&&s.toolInput!==void 0&&n.openTools.set(s.toolUseId,n.entries.length),n.entries.push(s))}function CC(n,a){const s=sd();s.rev=n.rev+1;for(const o of a)mx(s,o);return s}function MC(n,a,s){if(s.length===0)return n;const o=a!==void 0?`${a}:${s.length}`:`k:${hx(s[0])}:${s.length}`;if(n.consumedBatches.has(o))return n;const c={entries:[...n.entries],seen:new Set(n.seen),consumedBatches:new Set(n.consumedBatches),openTools:new Map(n.openTools),rev:n.rev+1};c.consumedBatches.add(o);for(const u of s)mx(c,u);return c}function od(n){return n.role==="tool"&&n.toolInput!==void 0&&n.text===""&&n.durationMs===void 0&&n.isError!==!0}const TC="leader";function px(n,a){return`${a}:${n.ts}:${n.role}:${n.toolUseId??""}`}function L0(n){const a=[],s=o=>(o.role==="assistant"||o.role==="thinking")&&o.tool===void 0&&o.toolUseId===void 0&&o.isError!==!0;for(const o of n){const c=a[a.length-1];c!==void 0&&s(o)&&s(c)&&c.role===o.role&&(c.agentId??"")===(o.agentId??"")?a[a.length-1]={...c,text:c.text+o.text}:a.push(o)}return a}function AC(n){const a=n.kind==="thinking"?"thinking":n.kind==="tool_use"||n.kind==="tool_result"?"tool":n.kind==="error"?"error":n.kind==="system"||n.kind==="status"?"system":"assistant";return{ts:n.ts,role:a,text:n.content,...n.toolName!==void 0?{tool:n.toolName}:{},...n.kind==="error"?{isError:!0}:{},agentId:n.subagentId}}function gx(n,a){const s=cn(["events"]),c=a!==null&&!(a===TC),[u,f]=z.useState(sd),[m,p]=z.useState(!1),[y,x]=z.useState(null),[g,v]=z.useState(!1),[S,w]=z.useState({total:0}),q=z.useRef(null),[C,_]=z.useState(!0),k=z.useRef(!0),j=M=>{k.current=M,_(M)},A=z.useRef(u);A.current=u;const[$,D]=z.useState([]),[L,Y]=z.useState(!1);z.useEffect(()=>{if(D([]),a===null||n===null||!c)return;let M=!1;return Y(!0),Cl(`/api/sessions/${encodeURIComponent(n)}/agents/${encodeURIComponent(a)}/messages?full=1`).then(O=>{M||(D((O.entries??[]).map(R=>({...R,agentId:a}))),w(R=>({...R,source:O.source})),Y(!1))}).catch(()=>{M||Y(!1)}),()=>{M=!0}},[a,n,c]);const G=z.useMemo(()=>{if(!c||a===null)return[];const M=s.events.filter(Z=>Z.type==="agent.message"&&(Z.sessionId===void 0||Z.sessionId===n)).map(Z=>Z.payload).filter(Z=>Z.subagentId===a).map(Z=>({...AC(Z),agentId:a})),O=new Set,R=[];for(const Z of[...$,...M]){const ee=`${Z.ts}|${Z.role}|${Z.text}`;O.has(ee)||(O.add(ee),R.push(Z))}return L0(R)},[$,s.events,a,n,c]);z.useEffect(()=>{if(n===null||c)return;let M=!1;p(!0),x(null),k.current=!0,_(!0);const O=g?"full=1":"limit=1000";return Cl(`/api/sessions/${encodeURIComponent(n)}/events?${O}`).then(R=>{M||(f(Z=>CC(Z,R.entries)),w({source:R.source,projectName:R.projectName,total:R.total}),p(!1))}).catch(R=>{M||(x(R.message),p(!1))}),()=>{M=!0}},[n,g,c]),z.useEffect(()=>{f(sd()),w({total:0}),v(!1)},[n,a]),z.useEffect(()=>{if(n===null||c)return;let M=A.current;for(const O of s.events){if(O.type!=="session.transcript"||O.sessionId!==n)continue;const R=O.payload;Array.isArray(R.entries)&&(M=MC(M,R.fromSeq,R.entries))}M!==A.current&&f(M)},[s.events,n,c]);const te=z.useMemo(()=>L0(u.entries),[u.entries]),I=c?G:te;z.useEffect(()=>{k.current&&I.length>0&&q.current?.scrollToIndex(I.length-1,{align:"end"})},[I.length,u.rev]);const F=()=>{const M=q.current;M&&j(M.scrollSize-M.scrollOffset-M.viewportSize<80)},V=()=>{j(!0),q.current?.scrollToIndex(I.length-1,{align:"end"})},T=Math.max(0,I.length-8),B=(M,O)=>od(M)&&O>=T,E=z.useMemo(()=>{let M=0,O=0,R=0;for(let Z=0;Z<I.length;Z++){const ee=I[Z];ee.tool!==void 0&&M++,(ee.role==="error"||ee.isError)&&O++,od(ee)&&Z>=T&&R++}return{turns:I.length,tools:M,errors:O,running:R}},[I,T]);return{entries:I,loading:c?L:m,error:y,meta:S,full:g,setFull:v,stats:E,isRunningAt:B,listRef:q,onScroll:F,pinned:C,jumpToLatest:V}}function yx({text:n,label:a}){const[s,o]=z.useState(!1),c=()=>{navigator.clipboard?.writeText(n).then(()=>{o(!0),setTimeout(()=>o(!1),1200)},()=>{})};return d.jsxs("button",{type:"button",className:"hq-copy-btn",onClick:c,title:"Copy to clipboard",children:[s?d.jsx(ey,{size:12}):d.jsx(Y1,{size:12}),a!==void 0&&d.jsx("span",{children:s?"copied":a})]})}function cd(n){return n==null||typeof n=="boolean"?"":typeof n=="string"||typeof n=="number"?String(n):Array.isArray(n)?n.map(cd).join(""):z.isValidElement(n)?cd(n.props.children):""}const zC={a:({children:n,href:a})=>d.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:n}),table:({children:n})=>d.jsx("div",{className:"hq-md-table-wrap",children:d.jsx("table",{children:n})}),pre:({children:n})=>{const a=Array.isArray(n)?n[0]:n,s=z.isValidElement(a)?a.props:void 0,o=/language-(\w+)/.exec(s?.className??"")?.[1],c=cd(s?.children).replace(/\n$/,""),u=c===""?0:c.split(`
|
|
48
|
-
`).length;return d.jsxs("div",{className:"hq-md-code",children:[d.jsxs("div",{className:"hq-md-code-bar",children:[d.jsx("span",{className:"hq-md-code-lang",children:o??"text"}),d.jsxs("span",{className:"hq-md-code-meta",children:[u," line",u===1?"":"s"]}),d.jsx(yx,{text:c})]}),d.jsx("pre",{children:n})]})}},vx=z.memo(function({text:a}){return d.jsx("div",{className:"hq-md",children:d.jsx(z1,{remarkPlugins:[O1],rehypePlugins:[D1],components:zC,children:a})})});var DC={file:{color:"#60a5fa"},edit:{color:"#fbbf24"},search:{color:"#a78bfa"},folder:{color:"#38bdf8"},terminal:{color:"#67e8f9"},web:{color:"#34d399"},git:{color:"#a3e635"},tree:{color:"#22d3ee"},code:{color:"#818cf8"},test:{color:"#4ade80"},package:{color:"#f472b6"},document:{color:"#94a3b8"},scaffold:{color:"#c084fc"},todo:{color:"#facc15"},plan:{color:"#2dd4bf"},task:{color:"#5eead4"},meta:{color:"#cbd5e1"},index:{color:"#06b6d4"},json:{color:"#eab308"},diff:{color:"#93c5fd"},logs:{color:"#a3a3a3"},settings:{color:"#9ca3af"},brain:{color:"#e879f9"},fallback:{color:"#9ca3af"}},OC={read:"file",cat:"file",view:"file",write:"file",create:"file",edit:"edit",replace:"edit",str_replace:"edit",multi_edit:"edit",patch:"diff",grep:"search",search:"search",rg:"search",ripgrep:"search",glob:"search",find:"search",folder:"folder",ls:"folder",list:"folder",set_working_dir:"folder",tree:"tree",bash:"terminal",shell:"terminal",sh:"terminal",exec:"terminal",run:"terminal",command:"terminal",fetch:"web",web_fetch:"web",web_search:"web",git:"git",diff:"diff",lint:"code",format:"settings",typecheck:"code",test:"test",install:"package",outdated:"package",audit:"package",document:"document",scaffold:"scaffold",todo:"todo",plan:"plan",task:"task",json:"json",index:"index",logs:"logs",mode:"meta",tool_search:"meta",tool_use:"meta",batch_tool_use:"meta",tool_help:"meta",remember:"brain",forget:"brain",search_memory:"brain",find_related_memories:"brain"};function HC(n){return n?OC[n.toLowerCase()]??"fallback":"fallback"}const kC={file:cS,edit:oS,search:sS,folder:iS,terminal:aS,web:lS,git:ty,tree:nS,code:tS,test:eS,package:fd,document:P1,scaffold:W1,todo:F1,plan:J1,task:K1,meta:wg,index:Q1,json:Z1,diff:G1,logs:I1,settings:X1,brain:ud,fallback:wg};function RC(n){const a=HC(n??"");return{Icon:kC[a],color:DC[a].color}}var BC=["path","file_path","pattern","command","cmd","url","query","description","content"];function jl(n,a){return n.length>a?`${n.slice(0,a-1)}…`:n}function Df(n){const a=n.file_path??n.path??n.filepath;return typeof a=="string"?a:""}function UC(n){try{return JSON.stringify(n)}catch{return String(n)}}function LC(n){if(typeof n=="string"){const a=n.trim();if(a.startsWith("{")||a.startsWith("["))try{const s=JSON.parse(a);if(s&&typeof s=="object")return{obj:s,raw:s}}catch{}return{obj:null,raw:n}}return n&&typeof n=="object"?{obj:n,raw:n}:{obj:null,raw:n}}function $C(n,a){if(a==null||a==="")return"";const{obj:s,raw:o}=LC(a);if(!s)return jl(String(o),120);const c=(n??"").toLowerCase();if(/^todo(_?write)?$|^todos$/.test(c)||Array.isArray(s.todos)){const u=s.todos??[];if(Array.isArray(u)){const f=u.filter(y=>y?.status==="completed").length,m=u.filter(y=>y?.status==="in_progress").length,p=[`${u.length} todo${u.length===1?"":"s"}`];return f>0&&p.push(`${f} done`),m>0&&p.push(`${m} in-progress`),p.join(" · ")}}if(/batch|parallel/.test(c)||Array.isArray(s.tool_uses)||Array.isArray(s.calls)){const u=s.tool_uses??s.calls??s.batch;if(Array.isArray(u)){const f=new Set;for(const y of u)y&&typeof y=="object"&&"name"in y?f.add(String(y.name)):y&&typeof y=="object"&&"tool"in y&&f.add(String(y.tool));const m=[...f].slice(0,3).join(", "),p=f.size>3?` +${f.size-3}`:"";return`${u.length} sub-tool${u.length===1?"":"s"}${m?` · ${m}${p}`:""}`}}if(/^(edit|str_replace|edit_file|patch)$/.test(c)){const u=Df(s),f=typeof s.old_string=="string"?s.old_string:"",m=typeof s.new_string=="string"?s.new_string:"",p=f?f.split(`
|
|
49
|
-
`).length:0,y=m?m.split(`
|
|
50
|
-
`).length:0;return`edit ${u||"(file)"}${p||y?` (${p} → ${y} lines)`:""}`}if(/^(write|write_file|create_file|new_file)$/.test(c)){const u=Df(s),f=typeof s.content=="string"?s.content:"",m=f?f.split(`
|
|
51
|
-
`).length:0;return`write ${u||"(file)"}${m?` · ${m} lines`:""}`}if(/^(bash|shell|sh|exec|run|run_command|run_shell|command)$/.test(c)){const u=s.command??s.cmd??s.script;if(typeof u=="string")return`$ ${jl(u,110)}`}if(/^(fetch|http|web|web_fetch|web_search|webfetch|curl|request)$/.test(c)){const u=s.url;if(typeof u=="string")return`${(s.method??"GET").toUpperCase()} ${jl(u,100)}`}if(/^(grep|search|ripgrep|rg)$/.test(c)){const u=s.pattern,f=s.path??s.glob??s.type;if(typeof u=="string")return f?`grep ${jl(u,60)} in ${f}`:`grep ${jl(u,100)}`}if(/^(glob|find)$/.test(c)){const u=s.pattern??s.glob;if(typeof u=="string")return`glob ${jl(u,80)}`}if(/^(read|read_file|cat|view)$/.test(c)){const u=Df(s),f=s.offset,m=s.limit;if(u&&(typeof f=="number"||typeof m=="number")){const p=f??0,y=typeof m=="number"?p+m:"";return`read ${u} (${p}…${y})`}if(u)return`read ${u}`}for(const u of BC){const f=s[u];if(typeof f=="string"&&f.length>0)return`${u}: ${jl(f,100)}`}return jl(UC(o),120)}function VC(n){const a=(n??"").toLowerCase().replace(/^mcp__[^_]+__/,"");return/^(edit|str_replace|edit_file|patch|apply_patch|multiedit)$/.test(a)?"edit":/^(write|write_file|create_file|new_file)$/.test(a)?"write":/^(bash|shell|exec|run|run_command|run_shell|powershell|terminal)$/.test(a)?"bash":/^(read|read_file|cat|open)$/.test(a)?"read":/^(grep|search|ripgrep|glob|find)$/.test(a)?"search":/^(fetch|http|web|webfetch|websearch|curl|request)$/.test(a)?"fetch":/todo/.test(a)?"todo":"generic"}function xx(n){if(n===void 0)return;const a=n.trim();if(!(a===""||a[0]!=="{"&&a[0]!=="["))try{return JSON.parse(a)}catch{return}}function YC(n,a){return a===void 0||a===""||a==="{}"?"":$C(n,a)}function XC(n){const a=xx(n);if(a===void 0)return n??"";try{return JSON.stringify(a,null,2)}catch{return n??""}}function IC(n){const a=xx(n);if(a===null||typeof a!="object")return null;const s=a.todos;if(!Array.isArray(s))return null;const o=[];for(const c of s){if(!c||typeof c!="object")continue;const u=c,f=u.status==="completed"?"completed":u.status==="in_progress"?"in_progress":"pending",m=typeof u.content=="string"?u.content:typeof u.subject=="string"?u.subject:typeof u.title=="string"?u.title:"";o.push({status:f,content:m})}return o.length>0?o:null}function GC(n){if(n===void 0||!Number.isFinite(n)||n<0)return"";if(n<1e3)return`${Math.round(n)}ms`;if(n<6e4)return`${(n/1e3).toFixed(n<1e4?1:0)}s`;const a=Math.floor(n/6e4),s=Math.round(n%6e4/1e3);return`${a}m${s}s`}function ZC(n){return n?n.replace(/^mcp__([^_]+)__/,"$1:"):"tool"}function QC(n){if(!n)return"";const a=new Date(n);return Number.isNaN(a.getTime())?"":a.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}var $0=5e3;function KC(n){if(typeof n=="string"){const a=n.trim();if(a.startsWith("{")||a.startsWith("["))try{const s=JSON.parse(a);if(s&&typeof s=="object")return s}catch{return null}return null}return n&&typeof n=="object"?n:null}function bx(n,a){if(!n)return null;const s=KC(a);if(!s)return null;const o=n.toLowerCase(),c=String(s.file_path??s.path??"");switch(o){case"edit":case"str_replace":case"edit_file":case"multi_edit":{const u=typeof s.old_string=="string"?s.old_string:"",f=typeof s.new_string=="string"?s.new_string:"";return!u&&!f?null:{mode:"lcs",oldText:u,newText:f,caption:`edit ${c}`.trim()}}case"write":case"write_file":case"create_file":{const u=typeof s.content=="string"?s.content:"";return u?{mode:"lcs",oldText:"",newText:u,caption:`write ${c} (new)`.trim()}:null}case"patch":{const u=typeof s.patch=="string"?s.patch:"";return u.trim()?{mode:"unified",patchText:u,caption:c?`patch ${c}`:"patch"}:null}default:return null}}function JC(n,a){const s=n.split(`
|
|
52
|
-
`),o=a.split(`
|
|
53
|
-
`);if(s.length>$0||o.length>$0)return null;const c=s.length,u=o.length,f=Array.from({length:c+1},()=>new Array(u+1).fill(0));for(let x=c-1;x>=0;x--)for(let g=u-1;g>=0;g--)f[x][g]=s[x]===o[g]?f[x+1][g+1]+1:Math.max(f[x+1][g],f[x][g+1]);const m=[];let p=0,y=0;for(;p<c&&y<u;)s[p]===o[y]?(m.push({kind:"ctx",text:s[p]}),p++,y++):f[p+1][y]>=f[p][y+1]?(m.push({kind:"del",text:s[p]}),p++):(m.push({kind:"add",text:o[y]}),y++);for(;p<c;)m.push({kind:"del",text:s[p++]});for(;y<u;)m.push({kind:"add",text:o[y++]});return m}function FC(n){const a=[],s=n.split(`
|
|
54
|
-
`);for(const o of s)o.startsWith("@@")||o.startsWith("--- ")||o.startsWith("+++ ")||o.startsWith("diff ")||o.startsWith("index ")||o.startsWith("\\ ")?a.push({kind:"meta",text:o}):o.startsWith("+")?a.push({kind:"add",text:o.slice(1)}):o.startsWith("-")?a.push({kind:"del",text:o.slice(1)}):a.push({kind:"ctx",text:o.startsWith(" ")?o.slice(1):o});return a.length>0&&a[a.length-1].kind==="ctx"&&a[a.length-1].text===""&&a.pop(),a}function WC(n,a){const s=bx(n,a);return s?s.mode==="unified"?{caption:s.caption,rows:FC(s.patchText)}:{caption:s.caption,rows:JC(s.oldText,s.newText)}:null}const PC={add:"+",del:"-",ctx:" ",meta:"@"};function eM({toolName:n,toolInput:a}){const s=z.useMemo(()=>WC(n,a),[n,a]);if(!s)return null;const{caption:o,rows:c}=s;if(c===null)return d.jsxs("div",{className:"hq-tool-empty",children:["diff too large to render — ",o]});const u=c.filter(m=>m.kind==="add").length,f=c.filter(m=>m.kind==="del").length;return d.jsxs("div",{className:"hq-diff",children:[d.jsxs("div",{className:"hq-diff-stat",children:[d.jsx("span",{className:"hq-diff-path",title:o,children:o}),d.jsxs("span",{className:"hq-diff-add-count",children:["+",u]}),d.jsxs("span",{className:"hq-diff-del-count",children:["-",f]})]}),d.jsx("pre",{className:"hq-diff-body",children:c.map((m,p)=>d.jsxs("span",{className:`hq-diff-line ${m.kind}`,children:[d.jsx("span",{className:"hq-diff-gutter",children:PC[m.kind]}),m.text||" "]},p))})]})}function tM(n,a){return bx(n,a)!==null}const nM=25,Of=12;function Hf({text:n,isError:a,wrap:s,framed:o=!0}){const c=z.useMemo(()=>n.split(`
|
|
55
|
-
`),[n]),u=c.length>nM,[f,m]=z.useState(!u),p=f?n:c.slice(0,Of).join(`
|
|
56
|
-
`);return d.jsxs("div",{className:`hq-result${o?"":" bare"}`,children:[d.jsx("pre",{className:`hq-result-pre ${s?"wrap":"nowrap"}${a?" err":""}`,children:p}),u&&d.jsx("button",{type:"button",className:"hq-result-toggle",onClick:()=>m(y=>!y),children:f?d.jsxs(d.Fragment,{children:[d.jsx(rS,{size:12})," collapse to ",Of," lines"]}):d.jsxs(d.Fragment,{children:[d.jsx(uS,{size:12})," show all ",c.length," lines (+",c.length-Of," more)"]})})]})}function lM(n,a){const s=a.trim();if(/^\s*\d+→/m.test(a.slice(0,200)))return{kind:"numbered"};if(s.startsWith("{")&&s.endsWith("}")||s.startsWith("[")&&s.endsWith("]"))try{const f=JSON.parse(s);if(typeof f=="object"&&f!==null)return{kind:"json",value:f}}catch{}const o=!!n&&/^(bash|shell|exec|run|powershell)/i.test(n),c=a.match(/(?:^|\n)\s*(?:\[?exit(?:\s*code)?\]?\s*[:=]?\s*)(\d+)\s*$/i),u=a.match(/(?:^|\s)(\d+\s*ms|\d+\.\d+s)\s*$/i);if(o||c){let f=a;return c&&(f=a.slice(0,c.index).trimEnd()),{kind:"bash",stdout:f,exitCode:c?Number(c[1]):void 0,duration:u?.[1]}}return{kind:"plain"}}function aM({value:n,isError:a}){const s=z.useMemo(()=>{try{return JSON.stringify(n,null,2)}catch{return String(n)}},[n]),o=s.split(`
|
|
57
|
-
`).length,[c,u]=z.useState(o<30);return d.jsxs("div",{className:`hq-result${a?" err-frame":""}`,children:[d.jsxs("button",{type:"button",className:"hq-result-jsonbar",onClick:()=>u(f=>!f),children:[d.jsxs("span",{className:"hq-result-jsonbar-left",children:[c?d.jsx(dd,{size:12}):d.jsx(Wa,{size:12}),d.jsxs("span",{children:["JSON · ",o," lines"]})]}),d.jsx("span",{children:c?"collapse":"expand"})]}),c&&d.jsx("pre",{className:`hq-result-pre nowrap${a?" err":""}`,children:s})]})}function iM({toolName:n,result:a,isError:s}){const o=z.useMemo(()=>lM(n,a),[n,a]);return o.kind==="json"?d.jsx(aM,{value:o.value,isError:s}):o.kind==="numbered"?d.jsx(Hf,{text:a,isError:s,wrap:!1}):o.kind==="bash"?d.jsxs("div",{className:"hq-result hq-result-bash",children:[o.stdout!==void 0&&o.stdout!==""&&d.jsx(Hf,{text:o.stdout,isError:s,wrap:!0,framed:!1}),(o.exitCode!==void 0||o.duration!==void 0)&&d.jsxs("div",{className:`hq-result-exit${o.exitCode!==void 0&&o.exitCode!==0?" bad":""}`,children:[o.exitCode!==void 0&&d.jsxs("span",{children:["exit code ",o.exitCode]}),o.duration!==void 0&&d.jsx("span",{children:o.duration})]})]}):d.jsx(Hf,{text:a,isError:s,wrap:!0})}const sM={completed:"✔",in_progress:"▶",pending:"○"};function oM({todos:n}){const a=n.filter(s=>s.status==="completed").length;return d.jsxs("div",{className:"hq-tool-section",children:[d.jsxs("div",{className:"hq-tool-section-label",children:["todos · ",a,"/",n.length," done"]}),d.jsx("ul",{className:"hq-todo-list",children:n.map((s,o)=>d.jsxs("li",{className:`hq-todo ${s.status}`,children:[d.jsx("span",{className:"hq-todo-mark",children:sM[s.status]}),d.jsx("span",{className:"hq-todo-text",children:s.content||"(empty)"})]},o))})]})}function cM({entry:n}){const a=VC(n.tool),s=tM(n.tool,n.toolInput),o=a==="todo"?IC(n.toolInput):null,c=n.text??"",u=c.trim()!=="";return d.jsxs("div",{className:"hq-tool-body",children:[s?d.jsxs("div",{className:"hq-tool-section",children:[d.jsx("div",{className:"hq-tool-section-label",children:"changes"}),d.jsx(eM,{toolName:n.tool,toolInput:n.toolInput}),u&&!n.isError&&d.jsx("div",{className:"hq-tool-result-note",children:c.split(`
|
|
58
|
-
`)[0]})]}):o?d.jsx(oM,{todos:o}):n.toolInput!==void 0&&n.toolInput!=="{}"&&d.jsxs("div",{className:"hq-tool-section",children:[d.jsx("div",{className:"hq-tool-section-label",children:"input"}),d.jsx("pre",{className:"hq-tool-pre",children:XC(n.toolInput)})]}),!s&&u&&d.jsxs("div",{className:"hq-tool-section",children:[d.jsxs("div",{className:"hq-tool-section-head",children:[d.jsx("span",{className:"hq-tool-section-label",children:n.isError?"error":"output"}),d.jsx(yx,{text:c,label:"copy"})]}),d.jsx(iM,{toolName:n.tool,result:c,isError:n.isError})]}),!u&&!n.isError&&!o&&!s&&d.jsx("div",{className:"hq-tool-empty",children:"(no output)"})]})}function rM({entry:n,running:a}){const[s,o]=z.useState(!1),c=YC(n.tool,n.toolInput),u=GC(n.durationMs),f=ZC(n.tool),{Icon:m,color:p}=RC(n.tool);return d.jsxs("div",{className:`hq-chat-turn tool ${n.isError?"err":""}`,children:[d.jsxs("button",{type:"button",className:"hq-tool-head",onClick:()=>o(y=>!y),children:[d.jsx("span",{className:"hq-tool-caret",children:s?d.jsx(dd,{size:13}):d.jsx(Wa,{size:13})}),d.jsx("span",{className:"hq-tool-icon",style:{color:p},children:d.jsx(m,{size:14})}),d.jsx("span",{className:"hq-tool-name",children:f}),c!==""&&d.jsx("span",{className:"hq-tool-summary",children:c}),u!==""&&d.jsx("span",{className:"hq-tool-dur",children:u}),d.jsx("span",{className:"hq-tool-status","aria-hidden":!0,children:a?d.jsx("span",{className:"hq-tool-running-dot",title:"running"}):n.isError?d.jsx(ny,{size:14,className:"hq-status-err"}):d.jsx(J0,{size:14,className:"hq-status-ok"})})]}),s&&d.jsx(cM,{entry:n})]})}function uM({entry:n}){const[a,s]=z.useState(!1),o=n.text.split(`
|
|
59
|
-
`)[0]??"";return d.jsxs("div",{className:"hq-chat-turn thinking",children:[d.jsxs("button",{type:"button",className:"hq-thinking-head",onClick:()=>s(c=>!c),children:[d.jsx("span",{className:"hq-tool-caret",children:a?d.jsx(dd,{size:13}):d.jsx(Wa,{size:13})}),d.jsx(ud,{size:13,className:"hq-thinking-icon"}),d.jsx("span",{className:"hq-thinking-label",children:"thinking"}),!a&&d.jsx("span",{className:"hq-thinking-peek",children:o})]}),a&&d.jsx("div",{className:"hq-thinking-body",children:d.jsx(vx,{text:n.text})})]})}const Sx=z.memo(function({entry:a,running:s}){const o=QC(a.ts);return a.role==="tool"||a.role==="error"&&a.toolInput!==void 0?d.jsx(rM,{entry:a,running:s??od(a)}):a.role==="thinking"?d.jsx(uM,{entry:a}):a.role==="user"?d.jsx("div",{className:"hq-chat-turn user",children:d.jsxs("div",{className:"hq-chat-bubble user",children:[d.jsxs("div",{className:"hq-chat-role",children:["you",a.agentId!==void 0?` · ${a.agentId}`:"",o!==""&&d.jsx("span",{className:"hq-chat-clock",children:o})]}),d.jsx("div",{className:"hq-chat-prose",children:a.text})]})}):a.role==="assistant"?d.jsx("div",{className:"hq-chat-turn assistant",children:d.jsxs("div",{className:"hq-chat-bubble assistant",children:[d.jsxs("div",{className:"hq-chat-role",children:["agent",a.agentId!==void 0?` · ${a.agentId}`:"",o!==""&&d.jsx("span",{className:"hq-chat-clock",children:o})]}),d.jsx(vx,{text:a.text})]})}):a.role==="error"?d.jsx("div",{className:"hq-chat-turn error",children:d.jsxs("div",{className:"hq-chat-bubble error",children:[d.jsxs("div",{className:"hq-chat-role err",children:["error",o!==""&&d.jsx("span",{className:"hq-chat-clock",children:o})]}),d.jsx("pre",{className:"hq-tool-pre err",children:a.text})]})}):a.text.trim()===""?null:d.jsx("div",{className:"hq-chat-turn system",children:d.jsxs("span",{className:"hq-chat-system-line",children:[a.text,o!==""&&d.jsx("span",{className:"hq-chat-clock",children:o})]})})});function fM(n){return n==="active"||n==="running"||n==="streaming"?"active":n==="waiting_user"?"warn":n==="error"||n==="stale"||n==="closing"?"error":"info"}function dM(n){return n.sessionId===void 0?null:{sessionId:n.sessionId,agentId:n.agentId??null,label:n.label,status:n.status}}function hM({target:n,onClose:a}){const s=gx(n.sessionId,n.agentId),{entries:o}=s;return z.useEffect(()=>{const c=u=>{u.key==="Escape"&&a()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),d.jsxs("aside",{className:"hq-fleet-drawer",role:"dialog","aria-label":n.label,children:[d.jsxs("div",{className:"hq-fleet-drawer-header",children:[n.agentId!==null?d.jsx(ui,{size:14,className:"hq-chat-header-icon"}):d.jsx(As,{size:14,className:"hq-chat-header-icon"}),d.jsx("span",{className:"hq-fleet-drawer-title",title:n.label,children:n.label}),n.status!==void 0&&d.jsx("span",{className:`hq-pill ${fM(n.status)}`,children:n.status}),d.jsxs("span",{className:"hq-fleet-drawer-actions",children:[d.jsxs("button",{type:"button",className:"hq-btn secondary",onClick:()=>Pa("console"),title:"Open this conversation in the full Console",children:[d.jsx(fS,{size:12})," Console"]}),d.jsx("button",{type:"button",className:"hq-btn secondary",onClick:a,"aria-label":"Close",title:"Close (Esc)",children:d.jsx(dS,{size:13})})]})]}),d.jsxs("div",{className:"hq-fleet-drawer-stats",children:[d.jsxs("span",{className:"hq-pill",children:[s.stats.turns," turns"]}),d.jsxs("span",{className:"hq-pill",children:[s.stats.tools," tools"]}),s.stats.running>0&&d.jsxs("span",{className:"hq-pill running",children:[s.stats.running," running"]}),s.stats.errors>0&&d.jsxs("span",{className:"hq-pill error",children:[s.stats.errors," err"]}),s.meta.source!==void 0&&d.jsx("span",{className:"hq-pill",title:s.meta.source==="disk"?"full history replayed from this machine":"live ring only (remote or not yet persisted)",children:s.meta.source==="disk"?"full history":"live ring"})]}),d.jsxs("div",{className:"hq-chat-scroll hq-fleet-drawer-body",children:[s.loading&&o.length===0?d.jsx("div",{className:"hq-empty",children:"Loading transcript…"}):s.error!==null?d.jsxs("div",{className:"hq-empty",children:["Error: ",s.error]}):o.length===0?d.jsx("div",{className:"hq-empty",children:n.agentId!==null?`No messages from ${n.label} yet.`:"No transcript entries yet."}):d.jsx(dx,{ref:s.listRef,onScroll:s.onScroll,className:"hq-chat-vlist",children:o.map((c,u)=>d.jsx("div",{className:"hq-chat-rowpad",children:d.jsx(Sx,{entry:c,running:s.isRunningAt(c,u)})},px(c,u)))}),!s.pinned&&o.length>0&&d.jsx("button",{type:"button",className:"hq-chat-jump",onClick:s.jumpToLatest,title:"Jump to latest",children:d.jsx(ly,{size:14})})]})]})}const mM=300,vc=118,pM=18,gM=42,yM=64;function vM(n){return n==="machine"?0:n==="project"?1:n==="terminal"?2:3}function xM(n){const a=n.filter(y=>y.kind==="machine"),s=new Map,o=new Map,c=new Map;for(const y of n)if(y.kind==="project"&&y.machineId!==void 0){const x=s.get(y.machineId)??[];x.push(y),s.set(y.machineId,x)}else if(y.kind==="terminal"){const x=wx(y.machineId??"",y.projectId??""),g=o.get(x)??[];g.push(y),o.set(x,g)}else if(y.kind==="agent"&&y.sessionId!==void 0){const x=c.get(y.sessionId)??[];x.push(y),c.set(y.sessionId,x)}const u=new Map;let f=0;const m=y=>y.length===0?0:((y[0]??0)+(y[y.length-1]??0))/2;for(const y of a){const x=s.get(y.machineId??"")??[],g=[];for(const v of x){const S=o.get(v.id)??[],w=[];for(const C of S){const _=c.get(C.sessionId??"")??[];let k;if(_.length>0){const j=[];for(const A of _)u.set(A.id,f),j.push(f),f+=vc;k=m(j)}else k=f,f+=vc;u.set(C.id,k),w.push(k),f+=pM}let q;w.length>0?q=m(w):(q=f,f+=vc),u.set(v.id,q),g.push(q),f+=gM}g.length>0?u.set(y.id,m(g)):(u.set(y.id,f),f+=vc),f+=yM}const p=new Map;for(const y of n)p.set(y.id,{x:vM(y.kind)*mM,y:u.get(y.id)??0});return p}function V0(n){return`machine:${n}`}function wx(n,a){return`project:${n}:${a}`}function bM(n){return`terminal:${n}`}function SM(n,a){return`agent:${n}:${a}`}function kf(n,a,s,o){const c=`${s}->${o}`;a.has(c)||(a.add(c),n.push({id:c,source:s,target:o}))}function wM(n,a){return n?.projectName??a?.projectName??"unknown project"}function NM(n,a){const s=n?.projectRootDisplay??a?.projectRoot;if(!(s===void 0||s.length===0))return s.length>54?`…${s.slice(-51)}`:s}function jM(n){return`${n.clientKind.toUpperCase()} · ${n.sessionId.length>18?`…${n.sessionId.slice(-14)}`:n.sessionId}`}function EM(n,a){return{sessionId:n.sessionId??`client:${n.clientId}`,clientKind:n.kind,machineId:n.machineId,...n.hostname!==void 0?{hostname:n.hostname}:{},...n.pid!==void 0?{pid:n.pid}:{},projectId:n.projectId,projectName:a?.projectName??n.projectId,projectRoot:a?.projectRootDisplay??"",...a?.gitBranch!==void 0?{gitBranch:a.gitBranch}:{},status:n.connected?"idle":"stale",startedAt:n.connectedAt??n.lastSeenAt,lastActivityAt:n.lastSeenAt,agentCount:0,agents:[]}}function _M(n,a,s,o){const c=a.get(n),u=s.find(g=>g.machineId===n),f=o.find(g=>g.machineId===n),m=c?.hostname??u?.hostname??f?.hostname??n,p=c?.sessionCount??s.filter(g=>g.machineId===n).length,y=c?.agentCount??s.reduce((g,v)=>g+(v.machineId===n?v.agents.length:0),0),x=c?.clientCount??o.filter(g=>g.machineId===n&&g.connected).length;return{label:m,sub:n,chips:[`${x} client${x===1?"":"s"}`,`${p} terminal${p===1?"":"s"}`,`${y} agent${y===1?"":"s"}`]}}function Nx(n){if(n===null)return{nodes:[],edges:[]};const a=[],s=[],o=new Set,c=new Set,u=new Map((n.machines??[]).map(g=>[g.machineId,g])),f=new Map((n.projects??[]).map(g=>[g.projectId,g])),m=[...n.liveSessions??[]],p=new Set(m.map(g=>g.sessionId));for(const g of n.clients??[]){if(!g.connected)continue;const v=g.sessionId??`client:${g.clientId}`;p.has(v)||(m.push(EM(g,f.get(g.projectId))),p.add(v))}const y=new Set;for(const g of n.machines??[])y.add(g.machineId);for(const g of m)y.add(g.machineId);for(const g of n.clients??[])g.connected&&y.add(g.machineId);for(const g of y){const v=V0(g),S=_M(g,u,m,n.clients??[]);a.push({id:v,kind:"machine",label:S.label,sub:S.sub,chips:S.chips,machineId:g}),o.add(v)}const x=m.sort((g,v)=>{const S=g.machineId.localeCompare(v.machineId);if(S!==0)return S;const w=g.projectName.localeCompare(v.projectName);return w!==0?w:g.sessionId.localeCompare(v.sessionId)});for(const g of x){const v=g.machineId,S=f.get(g.projectId),w=wx(v,g.projectId);if(!o.has(w)){const C=[`${S?.activeClients??x.filter(_=>_.machineId===v&&_.projectId===g.projectId).length} client${(S?.activeClients??0)===1?"":"s"}`,`${S?.activeSessions??x.filter(_=>_.machineId===v&&_.projectId===g.projectId).length} terminal${(S?.activeSessions??0)===1?"":"s"}`];S?.gitBranch!==void 0&&C.push(S.gitBranch),a.push({id:w,kind:"project",label:wM(S,g),sub:NM(S,g),status:S?.status??g.status,chips:C,machineId:v,projectId:g.projectId}),o.add(w)}kf(s,c,V0(v),w);const q=bM(g.sessionId);if(!o.has(q)){const C=g.sessionId.startsWith("client:")&&g.agents.length===0,_=[g.clientKind,g.status,`${g.agentCount} agent${g.agentCount===1?"":"s"}`];g.gitBranch!==void 0&&_.push(g.gitBranch),a.push({id:q,kind:"terminal",label:jM(g),sub:C?"waiting for session telemetry":g.projectName,status:g.status,chips:_,machineId:v,projectId:g.projectId,sessionId:g.sessionId,clientKind:g.clientKind,session:g,isSyntheticSession:C}),o.add(q)}kf(s,c,w,q);for(const C of g.agents){const _=SM(g.sessionId,C.id);a.push({id:_,kind:"agent",label:C.name||C.id,sub:C.currentTool??C.partialText,status:C.status,chips:[C.status,`${C.iterations} iter`,`${C.toolCalls} tools`,...C.model!==void 0?[C.model]:[]],machineId:v,projectId:g.projectId,sessionId:g.sessionId,agentId:C.id,agent:C,session:g}),kf(s,c,q,_)}}return{nodes:a,edges:s}}const qM=220,CM=104;function MM(n,a){return n==="machine"?d.jsx(hd,{size:14,className:"hq-fleet-node-icon"}):n==="project"?d.jsx(md,{size:14,className:"hq-fleet-node-icon"}):n==="terminal"?d.jsx(As,{size:14,className:"hq-fleet-node-icon"}):d.jsx(ui,{size:14,className:`hq-fleet-agent-dot ${a??"idle"}`})}function Y0(n){return n===void 0?"idle":n==="active"||n==="running"||n==="streaming"?"active":n==="waiting_user"?"warn":n==="error"||n==="stale"||n==="closing"?"error":n}function jx(n){return n==="active"||n==="running"||n==="streaming"}function TM({data:n,selected:a}){const s=n.kind==="terminal"||n.kind==="agent";return d.jsxs("div",{className:`hq-flow-node ${n.kind}${a?" selected":""}${s?" clickable":""}`,children:[d.jsx(ri,{type:"target",position:ye.Left,className:"hq-flow-handle"}),d.jsxs("div",{className:"hq-flow-title",children:[n.kind==="agent"?d.jsx("span",{className:`hq-flow-dot ${Y0(n.status)}`}):MM(n.kind,n.clientKind),d.jsx("span",{className:"hq-flow-label",children:n.label})]}),n.sub!==void 0&&d.jsx("div",{className:"hq-flow-sub",children:n.sub}),d.jsx("div",{className:"hq-flow-chips",children:n.chips.slice(0,4).map(o=>d.jsx("span",{className:`hq-pill ${Y0(o)}`,children:o},o))}),d.jsx(ri,{type:"source",position:ye.Right,className:"hq-flow-handle"})]})}const AM={fleet:TM};function X0(n){const a=xM(n);return n.map(s=>({id:s.id,type:"fleet",data:s,position:a.get(s.id)??{x:0,y:0},style:{width:qM,minHeight:CM}}))}function zM(n){const a=new Map(n.nodes.map(s=>[s.id,s.status]));return n.edges.map(s=>{const o=jx(a.get(s.target));return{...s,type:"smoothstep",animated:o,markerEnd:{type:_s.ArrowClosed,width:14,height:14},className:`hq-flow-edge${o?" live":""}`}})}function DM({topology:n}){const[a,s,o]=zq([]),[c,u,f]=Dq([]),{fitView:m}=Qc(),p=z.useRef(!1);z.useEffect(()=>{const v=X0(n.nodes);s(S=>{if(!p.current)return v;const w=new Map(S.map(q=>[q.id,q.position]));return v.map(q=>{const C=w.get(q.id);return C!==void 0?{...q,position:C}:q})}),u(zM(n))},[n,s,u]);const y=z.useCallback(()=>{p.current=!1,s(X0(n.nodes)),window.setTimeout(()=>{m({padding:.18,duration:400})},50)},[n,s,m]),[x,g]=z.useState(null);return d.jsxs("div",{className:"hq-flow-canvas","data-testid":"hq-react-flow-fleet",children:[d.jsxs("button",{type:"button",className:"hq-btn secondary hq-flow-arrange",onClick:y,title:"Re-run the hierarchical layout and frame the whole fleet",children:[d.jsx(hS,{size:13})," Auto arrange"]}),d.jsxs(Aq,{nodes:a,edges:c,nodeTypes:AM,onNodesChange:o,onEdgesChange:f,onNodeDragStop:()=>{p.current=!0},fitView:!0,fitViewOptions:{padding:.18},minZoom:.25,maxZoom:1.4,nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!0,onNodeClick:(v,S)=>{const w=dM(S.data);w!==null&&(w.agentId!==null?uy(w.sessionId,w.agentId):yd(w.sessionId),g(w))},children:[d.jsx(Bq,{color:"rgba(148, 163, 184, 0.16)",gap:22}),d.jsx(aC,{pannable:!0,zoomable:!0,className:"hq-flow-minimap",nodeColor:v=>{const S=v.data?.kind;return S==="machine"?"hsl(190 86% 54%)":S==="project"?"hsl(258 84% 74%)":S==="terminal"?"hsl(38 94% 58%)":"hsl(150 64% 46%)"}}),d.jsx(Iq,{className:"hq-flow-controls"})]}),x!==null&&d.jsx(hM,{target:x,onClose:()=>g(null)})]})}function OM(){const a=cn(["snapshot","selectedSessionId"]).snapshot,s=z.useMemo(()=>Nx(a),[a]);if(a===null)return d.jsx("div",{className:"hq-empty",children:"Waiting for fleet data…"});if(s.nodes.length===0)return d.jsx("div",{className:"hq-empty",children:"No machines or connected clients yet. Open a WrongStack CLI/TUI/WebUI with HQ running and they appear here automatically."});const o=a.machines?.length??new Set(s.nodes.map(m=>m.machineId).filter(Boolean)).size,c=s.nodes.filter(m=>m.kind==="terminal").length,u=s.nodes.filter(m=>m.kind==="agent").length,f=s.nodes.filter(m=>m.kind==="agent"&&jx(m.status)).length;return d.jsxs("div",{className:"hq-flow-shell",children:[d.jsxs("div",{className:"hq-flow-toolbar",children:[d.jsxs("div",{children:[d.jsx("div",{className:"hq-card-title",style:{margin:0},children:"Fleet Topology"}),d.jsx("div",{className:"hq-row-subtle",children:"machine → project → terminal/TUI/CLI/WebUI → agent; click a terminal or agent for chat history"})]}),d.jsxs("div",{className:"hq-flow-stats",children:[d.jsxs("span",{className:"hq-pill info",children:[o," machines"]}),d.jsxs("span",{className:"hq-pill info",children:[c," terminals"]}),d.jsx("span",{className:`hq-pill ${f>0?"active":"info"}`,children:f>0?`${f}/${u} agents live`:`${u} agents`})]})]}),d.jsx(tx,{children:d.jsx(DM,{topology:s})}),d.jsxs("div",{className:"hq-flow-legend",children:[d.jsxs("span",{children:[d.jsx(hd,{size:12})," machine"]}),d.jsxs("span",{children:[d.jsx(md,{size:12})," project"]}),d.jsxs("span",{children:[d.jsx(As,{size:12})," terminal / TUI / CLI / WebUI"]}),d.jsxs("span",{children:[d.jsx(ty,{size:12})," branch shown as chip when known"]}),d.jsxs("span",{children:[d.jsx(ui,{size:12})," AMK agent"]})]})]})}function HM(n){const a=Nx(n),s=[],o=new Map,c=new Map,u=new Map,f=p=>`machine:${p.machineId}`,m=p=>`project:${p.machineId}:${p.projectId}`;for(const p of a.nodes){if(p.kind!=="machine")continue;const y={id:p.id,label:p.label,sub:p.sub,projects:[]};o.set(p.id,y),s.push(y)}for(const p of a.nodes){if(p.kind!=="project")continue;const y=o.get(f(p));if(y===void 0)continue;const x={id:p.id,label:p.label,clients:[]};c.set(p.id,x),y.projects.push(x)}for(const p of a.nodes){if(p.kind!=="terminal"||p.sessionId===void 0)continue;const y=c.get(m(p));if(y===void 0)continue;const x={sessionId:p.sessionId,label:p.label,clientKind:p.clientKind,status:p.status,synthetic:p.isSyntheticSession===!0,agents:[]};u.set(p.sessionId,x),y.clients.push(x)}for(const p of a.nodes){if(p.kind!=="agent"||p.sessionId===void 0||p.agentId===void 0)continue;const y=u.get(p.sessionId);y!==void 0&&y.agents.push({id:p.agentId,label:p.label,status:p.status})}return s.map(p=>({...p,projects:p.projects.filter(y=>y.clients.length>0)})).filter(p=>p.projects.length>0)}function I0(n){return n==="active"||n==="running"||n==="streaming"?"active":n==="waiting_user"?"warn":n==="error"||n==="stale"||n==="closing"?"error":"idle"}function kM({snapshot:n,selectedSessionId:a,selectedAgentId:s}){const o=z.useMemo(()=>HM(n),[n]),[c,u]=z.useState(new Set),f=m=>u(p=>{const y=new Set(p);return y.has(m)?y.delete(m):y.add(m),y});return o.length===0?d.jsx("div",{className:"hq-fleetnav",children:d.jsx("div",{className:"hq-empty",style:{padding:16,fontSize:12},children:"No live sessions. Open a WrongStack CLI/TUI/WebUI connected to HQ."})}):d.jsx("div",{className:"hq-fleetnav",role:"tree","aria-label":"Fleet navigator",children:o.map(m=>{const p=!c.has(m.id);return d.jsxs("div",{className:"hq-nav-machine",children:[d.jsxs("button",{type:"button",className:"hq-nav-row machine",onClick:()=>f(m.id),"aria-expanded":p,children:[d.jsx(Wa,{size:12,className:"hq-nav-caret"+(p?" open":"")}),d.jsx(hd,{size:13}),d.jsx("span",{className:"hq-nav-label",title:m.sub??m.label,children:m.label})]}),p&&m.projects.map(y=>{const x=!c.has(y.id);return d.jsxs("div",{className:"hq-nav-project",children:[d.jsxs("button",{type:"button",className:"hq-nav-row project",onClick:()=>f(y.id),"aria-expanded":x,children:[d.jsx(Wa,{size:12,className:"hq-nav-caret"+(x?" open":"")}),d.jsx(md,{size:13}),d.jsx("span",{className:"hq-nav-label",title:y.label,children:y.label})]}),x&&y.clients.map(g=>{const v=!c.has(g.sessionId),S=a===g.sessionId&&s===null;return d.jsxs("div",{className:"hq-nav-client",children:[d.jsxs("div",{className:"hq-nav-clientrow",children:[g.agents.length>0?d.jsx("button",{type:"button",className:"hq-nav-caretbtn",onClick:()=>f(g.sessionId),"aria-label":v?"Collapse":"Expand",children:d.jsx(Wa,{size:12,className:"hq-nav-caret"+(v?" open":"")})}):d.jsx("span",{className:"hq-nav-caretbtn"}),d.jsxs("button",{type:"button",className:"hq-nav-row client"+(S?" selected":""),onClick:()=>yd(g.sessionId),title:g.synthetic?"waiting for session telemetry":g.label,children:[d.jsx("span",{className:"hq-nav-dot "+I0(g.status)}),d.jsx(As,{size:12}),d.jsx("span",{className:"hq-nav-label",children:g.label}),g.agents.length>0&&d.jsx("span",{className:"hq-nav-count",children:g.agents.length})]})]}),v&&g.agents.map(w=>{const q=a===g.sessionId&&s===w.id;return d.jsxs("button",{type:"button",className:"hq-nav-row agent"+(q?" selected":""),onClick:()=>uy(g.sessionId,w.id),title:w.label,children:[d.jsx("span",{className:"hq-nav-dot "+I0(w.status)}),d.jsx(ui,{size:12}),d.jsx("span",{className:"hq-nav-label",children:w.label})]},w.id)})]},g.sessionId)})]},y.id)})]},m.id)})})}function RM(){const n=cn(["selectedSessionId","selectedAgentId","snapshot"]),a=n.selectedSessionId,s=n.selectedAgentId,o=s!==null,c=gx(a,s),{entries:u,meta:f,stats:m}=c,p=n.snapshot?.liveSessions??[],y=z.useMemo(()=>p.flatMap(x=>x.agents).find(x=>x.id===s)??null,[s,p]);return d.jsxs("div",{className:"hq-console-shell",children:[d.jsx(kM,{snapshot:n.snapshot??null,selectedSessionId:a,selectedAgentId:s}),d.jsxs("div",{className:"hq-console",children:[d.jsxs("div",{className:"hq-chat-header",children:[d.jsx(W0,{size:15,className:"hq-chat-header-icon"}),d.jsx("span",{className:"hq-card-title",style:{margin:0},children:"Console"}),o&&d.jsxs("span",{className:"hq-pill active",children:[d.jsx(ui,{size:12})," ",y?.name??s]}),f.projectName!==void 0&&!o&&d.jsx("span",{className:"hq-pill",children:f.projectName}),f.source!==void 0&&d.jsx("span",{className:"hq-pill",title:f.source==="disk"?"disk = full history replayed from this machine":"stream = live ring only (remote or not yet persisted)",children:f.source==="disk"?"full history":"live ring"}),d.jsxs("span",{className:"hq-chat-counts",children:[d.jsxs("span",{className:"hq-pill",children:[m.turns," turns"]}),d.jsxs("span",{className:"hq-pill",children:[m.tools," tools"]}),m.running>0&&d.jsxs("span",{className:"hq-pill running",children:[m.running," running"]}),m.errors>0&&d.jsxs("span",{className:"hq-pill error",children:[m.errors," err"]}),!o&&!c.full&&f.total>u.length&&d.jsxs("button",{type:"button",className:"hq-btn secondary hq-chat-fullbtn",onClick:()=>c.setFull(!0),title:`History is truncated — load all ${f.total} turns`,children:[d.jsx(mS,{size:12})," load all ",f.total]})]})]}),a===null?d.jsx("div",{className:"hq-empty",children:"Pick a client or agent from the tree on the left."}):c.loading&&u.length===0?d.jsx("div",{className:"hq-empty",children:o?"Loading agent history…":"Loading transcript…"}):c.error!==null?d.jsxs("div",{className:"hq-empty",children:["Error: ",c.error]}):d.jsxs("div",{className:"hq-chat-scroll",children:[u.length===0?d.jsx("div",{className:"hq-empty",children:o?`No messages from ${y?.name??s??"this agent"} yet.`:"No transcript entries yet."}):d.jsx(dx,{ref:c.listRef,onScroll:c.onScroll,className:"hq-chat-vlist",children:u.map((x,g)=>d.jsx("div",{className:"hq-chat-rowpad",children:d.jsx(Sx,{entry:x,running:c.isRunningAt(x,g)})},px(x,g)))}),!c.pinned&&u.length>0&&d.jsx("button",{type:"button",className:"hq-chat-jump",onClick:c.jumpToLatest,title:"Jump to latest",children:d.jsx(ly,{size:14})})]})]})]})}const BM=[{value:"steer",label:"steer — redirect the current work"},{value:"btw",label:"btw — FYI, no action required"},{value:"queue",label:"queue — note for the next agent"},{value:"broadcast",label:"broadcast — all agents in the project"}];function UM({projects:n,sender:a}){const s=a??zS,[o,c]=z.useState(!1),[u,f]=z.useState(""),[m,p]=z.useState("steer"),[y,x]=z.useState("leader"),[g,v]=z.useState("normal"),[S,w]=z.useState(""),[q,C]=z.useState(""),[_,k]=z.useState({phase:"idle"}),j=u||n[0]?.projectId||"",A=_.phase!=="sending"&&q.trim().length>0&&j.length>0,$=async()=>{if(A){k({phase:"sending"});try{const D=await s({projectId:j,type:m,...m!=="broadcast"?{to:y.trim()||"leader"}:{},subject:S.trim()||"HQ prompt",body:q.trim(),priority:g});k({phase:"sent",messageId:D.messageId}),C("")}catch(D){k({phase:"error",message:D instanceof Error?D.message:String(D)})}}};return o?d.jsxs("div",{className:"hq-card hq-composer",children:[d.jsxs("div",{className:"hq-row",style:{alignItems:"baseline"},children:[d.jsx("span",{className:"hq-card-title",style:{margin:0},children:"Send to project mailbox"}),d.jsx("span",{className:"hq-composer-hint",children:"lands in the mailbox file — picked up by the next agent, no live client needed"}),d.jsx("button",{type:"button",className:"hq-toggle",style:{marginLeft:"auto"},"aria-label":"Collapse composer",onClick:()=>c(!1),children:"▾"})]}),d.jsxs("div",{className:"hq-composer-grid",children:[d.jsxs("label",{className:"hq-composer-field",children:[d.jsx("span",{children:"project"}),d.jsx("select",{className:"hq-select",value:j,onChange:D=>f(D.target.value),children:n.map(D=>d.jsx("option",{value:D.projectId,children:D.label??D.projectId},D.projectId))})]}),d.jsxs("label",{className:"hq-composer-field",children:[d.jsx("span",{children:"type"}),d.jsx("select",{className:"hq-select",value:m,onChange:D=>p(D.target.value),children:BM.map(D=>d.jsx("option",{value:D.value,children:D.label},D.value))})]}),m!=="broadcast"&&d.jsxs("label",{className:"hq-composer-field",children:[d.jsx("span",{children:"to"}),d.jsx("input",{className:"hq-input",value:y,placeholder:"leader",onChange:D=>x(D.target.value)})]}),d.jsxs("label",{className:"hq-composer-field",children:[d.jsx("span",{children:"priority"}),d.jsxs("select",{className:"hq-select",value:g,onChange:D=>v(D.target.value),children:[d.jsx("option",{value:"high",children:"high"}),d.jsx("option",{value:"normal",children:"normal"}),d.jsx("option",{value:"low",children:"low"})]})]})]}),d.jsx("input",{className:"hq-input",value:S,placeholder:"subject (optional)",onChange:D=>w(D.target.value)}),d.jsx("textarea",{className:"hq-input hq-composer-body",value:q,rows:3,placeholder:"Message body — e.g. “after the current task, run the full test suite”",onChange:D=>C(D.target.value)}),d.jsxs("div",{className:"hq-row",children:[d.jsx("button",{type:"button",className:"hq-btn",disabled:!A,onClick:()=>{$()},children:_.phase==="sending"?"Sending…":"Send"}),_.phase==="sent"&&d.jsxs("span",{className:"hq-composer-status ok",children:["delivered",_.messageId!==void 0?` · ${_.messageId.slice(0,8)}`:""]}),_.phase==="error"&&d.jsx("span",{className:"hq-composer-status err",title:_.message,children:_.message})]})]}):d.jsxs("div",{className:"hq-composer-bar",children:[d.jsx("button",{type:"button",className:"hq-btn",disabled:n.length===0,title:n.length===0?"No projects reported yet — connect a client first":"Write a message into a project mailbox (works with zero connected agents)",onClick:()=>c(!0),children:"✉️ Compose"}),_.phase==="sent"&&d.jsxs("span",{className:"hq-composer-status ok",children:["delivered",_.messageId!==void 0?` · ${_.messageId.slice(0,8)}`:""]})]})}function LM(n){if(typeof n!="object"||n===null)return!1;const a=n;return typeof a.mailboxId=="string"&&(a.scope==="project"||a.scope==="global")&&Array.isArray(a.messages)&&Array.isArray(a.agents)&&typeof a.totals=="object"&&a.totals!==null}function $M(n){if(typeof n!="object"||n===null)return!1;const a=n;return typeof a.mailboxId=="string"&&typeof a.action=="string"&&(a.message===void 0||typeof a.message=="object")}function Rf(n,a){let s=n.get(a);return s===void 0&&(s={projectId:a,messages:[],countersFromSnapshot:!1,onlineAgentCount:0,highPriorityCount:0,unreadCount:0,incompleteCount:0},n.set(a,s)),s}function VM(n){let a=0,s=0,o=0;for(const c of n){const u=c.message;u.priority==="high"&&(a+=1),u.completed||(o+=1,(u.readCount??0)===0&&(s+=1))}return{highPriorityCount:a,unreadCount:s,incompleteCount:o}}function YM(n){const a=new Map;for(const s of n)(a.get(s.message.mailId)===void 0||s.source==="event")&&a.set(s.message.mailId,s);return Array.from(a.values()).sort((s,o)=>o.message.timestamp.localeCompare(s.message.timestamp))}function Ld(n,a){const s=new Map;if(n!==null)for(const u of n.mailboxes){const f=Rf(s,u.projectId);f.mailboxId=u.mailboxId,f.scope=u.scope,f.onlineAgentCount=u.onlineAgentCount,f.highPriorityCount=u.highPriorityCount,f.unreadCount=u.unreadCount,f.incompleteCount=u.incompleteCount,f.countersFromSnapshot=!0}for(const u of a){if(u.type!=="mailbox.snapshot"||!LM(u.payload))continue;const f=u.payload,m=Rf(s,u.projectId);m.mailboxId=f.mailboxId,m.scope=f.scope;for(const p of f.messages)m.messages.push({message:p,source:"snapshot",key:`s:${u.id}:${p.messageId}`,projectId:u.projectId})}const o=new Map;for(const u of a){if(u.type!=="mailbox.event"||!$M(u.payload))continue;const f=u.payload,m=Rf(s,u.projectId);m.mailboxId=f.mailboxId,m.scope=m.scope??"project",f.message!==void 0&&!o.has(f.message.mailId)&&(o.set(f.message.mailId,m),m.messages.push({message:f.message,source:"event",key:`e:${f.message.mailId}:${u.seq}`,projectId:u.projectId})),f.agent?.online&&(m.onlineAgentCount+=1)}for(const u of s.values())if(u.messages=YM(u.messages),!u.countersFromSnapshot){const f=VM(u.messages);u.highPriorityCount=f.highPriorityCount,u.unreadCount=f.unreadCount,u.incompleteCount=f.incompleteCount}const c=Array.from(s.values()).sort((u,f)=>{const m=u.messages[0]?.message.timestamp??"";return(f.messages[0]?.message.timestamp??"").localeCompare(m)});return{projects:c,hasAnyActivity:c.some(u=>u.messages.length>0)}}const XM=Object.freeze({types:new Set,priorities:new Set,projectIds:new Set,includeCompleted:!0,query:""});function IM(n,a){switch(a.type){case"toggle-type":{const s=new Set(n.types);return s.has(a.value)?s.delete(a.value):s.add(a.value),{...n,types:s}}case"toggle-priority":{const s=new Set(n.priorities);return s.has(a.value)?s.delete(a.value):s.add(a.value),{...n,priorities:s}}case"toggle-project":{const s=new Set(n.projectIds);return s.has(a.value)?s.delete(a.value):s.add(a.value),{...n,projectIds:s}}case"set-query":return{...n,query:a.value};case"set-include-completed":return{...n,includeCompleted:a.value};case"clear-all":return XM;default:return n}}function GM(n,a={}){const s=a.includeCompleted??!0,o=a.types&&a.types.length>0?new Set(a.types):null,c=a.priorities&&a.priorities.length>0?new Set(a.priorities):null,u=a.projectIds&&a.projectIds.length>0?new Set(a.projectIds):null,f=a.query?.trim().toLowerCase()??"",m=a.limit??500,p=[];for(const v of n){const S=v.message;!s&&S.completed||o&&!o.has(S.type)||c&&!c.has(S.priority)||u||f.length>0&&!`${S.subject}
|
|
60
|
-
${S.from}
|
|
61
|
-
${S.to}
|
|
62
|
-
${S.bodyPreview??""}`.toLowerCase().includes(f)||p.push({key:v.key,flat:v})}p.sort((v,S)=>{const w=S.flat.message.timestamp.localeCompare(v.flat.message.timestamp);return w!==0?w:v.flat.message.mailId.localeCompare(S.flat.message.mailId)});const y=p.length,x=y>m,g=x?p.slice(0,m):p;return{totalMatched:y,returned:g.length,truncated:x,entries:g}}function ZM(n,a,s={}){const{projectIds:o,...c}=s,u=Ld(n,a);let f=[];const m=o!==void 0&&o.length>0?new Set(o):null;for(const p of u.projects)m&&!m.has(p.projectId)||(f=f.concat(p.messages));return GM(f,c)}function QM(n){if(typeof n!="object"||n===null)return!1;const a=n;if(typeof a.error!="object"||a.error===null)return!1;const s=a.error;return typeof s.code=="string"&&typeof s.message=="string"}async function fs(n){const a=`/api/mailbox/messages/${encodeURIComponent(n.mailId)}/action`,s=await Rc(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!s.ok){let o=`${s.status} ${s.statusText}`;try{const c=await s.json();QM(c)&&(o=`${c.error.code}: ${c.error.message}`)}catch{}throw new Error(`mailbox action failed — ${o}`)}return await s.json()}const ds={markRead:n=>fs({...n,action:"mark-read"}),acknowledge:n=>fs({...n,action:"acknowledge"}),reopen:n=>fs({...n,action:"reopen"}),softDelete:n=>fs({...n,action:"soft-delete"}),restore:n=>fs({...n,action:"restore"})};function KM({mailId:n,actorId:a,projectId:s,isDeleted:o=!1,onAction:c,disabled:u=!1}){const[f,m]=z.useState(null),[p,y]=z.useState(null),x=async(v,S)=>{if(!(u||f!==null)){m(v),y(null);try{await S(),c?.(n,v)}catch(w){y(w instanceof Error?w.message:String(w))}finally{m(null)}}},g={mailId:n,readerId:a,projectId:s};return d.jsxs("div",{className:"hq-msg-actions",children:[!o&&d.jsx("button",{type:"button",className:"hq-btn secondary",disabled:u||f!==null,onClick:()=>x("mark-read",()=>ds.markRead(g)),children:f==="mark-read"?"…":"Mark read"}),!o&&d.jsx("button",{type:"button",className:"hq-btn",disabled:u||f!==null,onClick:()=>x("acknowledge",()=>ds.acknowledge(g)),children:f==="acknowledge"?"…":"Acknowledge"}),!o&&d.jsx("button",{type:"button",className:"hq-btn secondary",disabled:u||f!==null,onClick:()=>x("reopen",()=>ds.reopen(g)),children:f==="reopen"?"…":"Reopen"}),!o&&d.jsx("button",{type:"button",className:"hq-btn danger",disabled:u||f!==null,onClick:()=>x("soft-delete",()=>ds.softDelete(g)),children:f==="soft-delete"?"…":"Delete"}),o&&d.jsx("button",{type:"button",className:"hq-btn secondary",disabled:u||f!==null,onClick:()=>x("restore",()=>ds.restore(g)),children:f==="restore"?"…":"Restore"}),p!==null&&d.jsx("span",{className:"hq-msg-action-error",title:p,children:p})]})}function JM(n){const a=new Date(n);return Number.isNaN(a.getTime())?n:a.toLocaleString()}function Bf(n){return n.length<=14?n:`${n.slice(0,8)}…${n.slice(-4)}`}const FM={note:{icon:"📝",tone:"info"},ask:{icon:"❓",tone:"warn"},assign:{icon:"📌",tone:"warn"},steer:{icon:"🛞",tone:"warn"},btw:{icon:"💬",tone:"info"},broadcast:{icon:"📣",tone:"info"},status:{icon:"📊",tone:"idle"},result:{icon:"✅",tone:"running"},review:{icon:"🔍",tone:"info"},control:{icon:"⚙️",tone:"error"}},WM="hq-operator";function Ex({flat:n,defaultExpanded:a}){const[s,o]=z.useState(!!a),c=n.message,u=c.hasBody||c.bodyPreview!==void 0&&c.bodyPreview.length>0,f=FM[c.type]??{icon:"✉️",tone:"info"},m=`${c.from} → ${c.to}`;return d.jsxs("div",{className:"hq-msg"+(c.completed?" done":""),children:[d.jsxs("div",{className:"hq-msg-head",onClick:()=>u&&o(p=>!p),children:[d.jsx("span",{className:"hq-msg-icon",title:c.type,children:f.icon}),d.jsx("span",{className:"hq-pill "+f.tone,children:c.type}),c.priority==="high"&&d.jsx("span",{className:"hq-pill error",children:"high"}),c.priority==="low"&&d.jsx("span",{className:"hq-pill idle",children:"low"}),d.jsx("span",{className:"hq-msg-subject",title:c.subject,children:c.subject||"(no subject)"}),d.jsx("span",{className:"hq-mono hq-msg-route",children:m}),d.jsx("span",{className:"hq-mono hq-msg-time",title:c.timestamp,children:JM(c.timestamp)}),d.jsx("span",{className:"hq-mono hq-msg-id",children:Bf(c.messageId)}),d.jsx("span",{className:"hq-msg-flag "+(c.completed?"done":"open"),children:c.completed?`completed${c.completedBy!==void 0?` by ${c.completedBy}`:""}`:"open"}),u&&d.jsx("button",{type:"button",className:"hq-toggle hq-msg-toggle",onClick:p=>{p.stopPropagation(),o(y=>!y)},"aria-label":s?"Collapse body":"Expand body",children:s?"▾":"▸"})]}),s&&d.jsxs("div",{className:"hq-msg-body",children:[c.bodyPreview!==void 0&&c.bodyPreview.length>0?d.jsx("pre",{className:"hq-msg-pre",children:c.bodyPreview}):d.jsx("div",{className:"hq-empty",style:{padding:8,fontSize:12},children:"(empty body)"}),c.outcomePreview!==void 0&&c.outcomePreview.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"hq-msg-sublabel",children:"outcome"}),d.jsx("pre",{className:"hq-msg-pre",children:c.outcomePreview})]}),d.jsxs("div",{className:"hq-msg-meta",children:[d.jsxs("span",{children:[d.jsx("strong",{children:"source:"})," ",n.source]}),c.replyTo!==void 0&&d.jsxs("span",{children:[d.jsx("strong",{children:"reply to:"})," ",Bf(c.replyTo)]}),c.senderSessionId!==void 0&&d.jsxs("span",{children:[d.jsx("strong",{children:"sender session:"})," ",Bf(c.senderSessionId)]}),(c.readCount??0)>0&&d.jsxs("span",{children:[d.jsx("strong",{children:"reads:"})," ",c.readCount]}),c.unreadCount!==void 0&&c.unreadCount>0&&d.jsxs("span",{children:[d.jsx("strong",{children:"unread:"})," ",c.unreadCount]}),c.task!==void 0&&d.jsxs("span",{children:[d.jsx("strong",{children:"task:"})," ",c.task.taskId??"—",c.task.agentName!==void 0?` · ${c.task.agentName}`:"",c.task.status!==void 0?` (${c.task.status})`:""]})]}),n.projectId!==void 0&&d.jsx(KM,{mailId:c.mailId,actorId:WM,projectId:n.projectId})]})]})}const PM=["ask","assign","steer","review","result","status","broadcast","note","btw","control"],eT=["high","normal","low"];function tT({snapshot:n,events:a}={}){const s=cn(["snapshot","events"]),o=n!==void 0?n:s.snapshot,c=a!==void 0?a:s.events,u=py(),f=z.useMemo(()=>{const v=u.mailbox;return{types:new Set(v.types),priorities:new Set(v.priorities),projectIds:new Set,includeCompleted:v.includeCompleted,query:v.query}},[u.mailbox]),[m,p]=z.useReducer(IM,f);z.useEffect(()=>{IS({query:m.query,types:Array.from(m.types),priorities:Array.from(m.priorities),includeCompleted:m.includeCompleted})},[m.query,m.types,m.priorities,m.includeCompleted]);const y=z.useMemo(()=>Ld(o??null,c).projects.map(S=>({projectId:S.projectId,count:S.messages.length})),[o,c]),x=z.useMemo(()=>ZM(o??null,c,{types:Array.from(m.types),priorities:Array.from(m.priorities),projectIds:Array.from(m.projectIds),includeCompleted:m.includeCompleted,query:m.query||void 0,limit:500}),[o,c,m]),g=m.types.size+m.priorities.size+m.projectIds.size+(m.includeCompleted?0:1)+(m.query.trim().length>0?1:0);return d.jsxs("div",{children:[d.jsxs("div",{className:"hq-card-title",children:["Live mailbox feed · ",x.returned," of ",x.totalMatched," message",x.totalMatched===1?"":"s",x.truncated?" · refined to fit":""]}),d.jsxs("div",{className:"hq-card hq-mailbox-filterbar",children:[d.jsx("label",{className:"hq-label",htmlFor:"mailbox-live-query",children:"Search"}),d.jsx("input",{id:"mailbox-live-query",className:"hq-input",value:m.query,onChange:v=>p({type:"set-query",value:v.target.value}),placeholder:"subject / sender / recipient / body…"}),d.jsx(Uf,{title:"Types",children:PM.map(v=>d.jsx(Lf,{selected:m.types.has(v),label:v,onClick:()=>p({type:"toggle-type",value:v})},v))}),d.jsx(Uf,{title:"Priority",children:eT.map(v=>d.jsx(Lf,{selected:m.priorities.has(v),label:v,tone:v==="high"?"error":v==="low"?"idle":"info",onClick:()=>p({type:"toggle-priority",value:v})},v))}),y.length>0&&d.jsx(Uf,{title:"Projects",children:y.map(v=>d.jsx(Lf,{selected:m.projectIds.has(v.projectId),label:`${v.projectId} (${v.count})`,onClick:()=>p({type:"toggle-project",value:v.projectId})},v.projectId))}),d.jsxs("div",{className:"hq-row hq-mailbox-filter-actions",children:[d.jsxs("label",{className:"hq-check",children:[d.jsx("input",{type:"checkbox",checked:m.includeCompleted,onChange:v=>p({type:"set-include-completed",value:v.target.checked})}),"include completed"]}),d.jsxs("button",{type:"button",className:"hq-btn secondary",disabled:g===0,onClick:()=>p({type:"clear-all"}),children:["Clear filters",g>0?` (${g})`:""]})]})]}),x.entries.length===0?d.jsx("div",{className:"hq-empty",children:"No mailbox activity matches the current filters."}):d.jsx("div",{className:"hq-msg-list hq-live-feed",children:x.entries.map((v,S)=>d.jsx(Ex,{flat:v.flat,defaultExpanded:S===0&&m.query.trim().length>0},v.key))})]})}function Uf({title:n,children:a}){return d.jsxs("div",{className:"hq-filter-section",children:[d.jsx("div",{className:"hq-msg-sublabel",children:n}),d.jsx("div",{className:"hq-filter-chip-row",children:a})]})}function Lf({selected:n,label:a,onClick:s,tone:o="info"}){return d.jsx("button",{type:"button",className:`hq-filter-chip hq-pill ${o}${n?" selected":""}`,"aria-pressed":n,onClick:s,children:a})}function nT(){const n=cn(["snapshot","events"]),a=n.snapshot,[s,o]=z.useState("live"),{events:c}=xd("mailbox.event",300),u=z.useMemo(()=>[...c,...n.events.filter(g=>g.type!=="mailbox.event")],[c,n.events]),{projects:f,hasAnyActivity:m}=z.useMemo(()=>Ld(a,u),[a,u]),p=a?.totals.unreadMailboxMessages??0,y=a?.totals.incompleteMailboxMessages??0,x=z.useMemo(()=>{const g=new Map;for(const v of a?.projects??[])g.set(v.projectId,{projectId:v.projectId,label:v.projectName});for(const v of f)g.has(v.projectId)||g.set(v.projectId,{projectId:v.projectId});return Array.from(g.values())},[a,f]);return f.length===0&&x.length===0?d.jsx("div",{className:"hq-empty",children:"No mailbox activity reported by connected clients."}):d.jsxs("div",{children:[d.jsxs("div",{className:"hq-card-title",children:["Mailbox Activity — ",f.length," project",f.length===1?"":"s"," ·"," ",p," unread · ",y," incomplete",m?" · showing detailed messages":""]}),d.jsx(UM,{projects:x}),d.jsxs("div",{className:"hq-mailbox-modebar",role:"tablist","aria-label":"Mailbox view mode",children:[d.jsx("button",{type:"button",className:"hq-btn secondary"+(s==="live"?" hq-btn-selected":""),"aria-selected":s==="live",onClick:()=>o("live"),children:"Live feed"}),d.jsx("button",{type:"button",className:"hq-btn secondary"+(s==="grouped"?" hq-btn-selected":""),"aria-selected":s==="grouped",onClick:()=>o("grouped"),children:"Grouped by project"})]}),s==="live"?d.jsx(tT,{snapshot:a,events:u}):f.map(g=>d.jsx(lT,{group:g},g.projectId))]})}function lT({group:n}){const[a,s]=z.useState(!0);return d.jsxs("div",{className:"hq-card",children:[d.jsxs("div",{className:"hq-row",style:{alignItems:"baseline"},children:[d.jsx("button",{type:"button",className:"hq-toggle",onClick:()=>s(o=>!o),"aria-label":a?"Collapse project messages":"Expand project messages",children:a?"▾":"▸"}),d.jsx("span",{style:{fontWeight:700},children:n.projectId}),n.scope!==void 0&&d.jsx("span",{className:"hq-pill info",children:n.scope}),n.mailboxId!==void 0&&d.jsx("span",{className:"hq-mono",style:{color:"var(--dim)"},children:n.mailboxId}),d.jsxs("span",{className:"hq-mono",style:{color:"var(--dim)",marginLeft:"auto"},children:[n.messages.length," message",n.messages.length===1?"":"s"]})]}),d.jsxs("div",{className:"hq-grid",style:{gridTemplateColumns:"repeat(5,1fr)",marginTop:8},children:[d.jsx(hs,{label:"messages",value:n.messages.length}),d.jsx(hs,{label:"unread",value:n.unreadCount,accent:n.unreadCount>0?"amber":void 0}),d.jsx(hs,{label:"incomplete",value:n.incompleteCount,accent:n.incompleteCount>0?"red":void 0}),d.jsx(hs,{label:"high-priority",value:n.highPriorityCount,accent:n.highPriorityCount>0?"red":void 0}),d.jsx(hs,{label:"online agents",value:n.onlineAgentCount,accent:n.onlineAgentCount>0?"green":void 0})]}),a&&n.messages.length>0&&d.jsx("div",{className:"hq-msg-list",style:{marginTop:12},children:n.messages.map(o=>d.jsx(Ex,{flat:o},o.key))}),a&&n.messages.length===0&&d.jsx("div",{className:"hq-empty",style:{padding:16,fontSize:12},children:"Snapshot counters reported for this project, but no detailed mailbox events have streamed yet."})]})}function hs({label:n,value:a,accent:s}){const o=s==="amber"?"var(--amber)":s==="red"?"var(--red)":s==="green"?"var(--green)":"var(--text)";return d.jsxs("div",{style:{textAlign:"center"},children:[d.jsx("div",{className:"hq-stat-num",style:{color:o},children:a}),d.jsx("div",{className:"hq-stat-label",children:n})]})}function aT({hadToken:n}){const[a,s]=z.useState(""),o=()=>{const c=a.trim();c.length!==0&&(pd(c),window.location.reload())};return d.jsx("div",{className:"hq-token-gate",children:d.jsxs("div",{className:"hq-token-card",children:[d.jsx("div",{className:"hq-brand",children:"WrongStack HQ"}),d.jsx("div",{className:"hq-token-title",children:"Browser token required"}),d.jsx("p",{className:"hq-token-text",children:n?"The saved token was rejected — it may have been revoked or the server was reset. Paste a current browser token.":"This HQ server runs in token mode. Paste the browser token printed at startup (the ?token= value in the URL wstack --hq shows)."}),d.jsx("input",{className:"hq-token-input",type:"password",autoFocus:!0,placeholder:"browser token",value:a,onChange:c=>s(c.target.value),onKeyDown:c=>{c.key==="Enter"&&o()}}),d.jsx("button",{className:"hq-token-submit",onClick:o,disabled:a.trim().length===0,children:"Connect"}),d.jsxs("p",{className:"hq-token-hint",children:["Manage tokens with ",d.jsx("code",{children:"wstack hq token list"})," / ",d.jsx("code",{children:"wstack hq token create"})," ","— they live in ",d.jsx("code",{children:"~/.wrongstack/hq/auth.json"}),"."]})]})})}function $f({points:n,color:a,height:s=140,format:o,emptyLabel:c="no data"}){const[u,f]=z.useState(null),m=z.useId(),p=720,y=s,x=46,g=8,v=10,S=22,w=p-x-g,q=y-v-S,C=z.useMemo(()=>Math.max(...n.map(G=>G.value),0),[n]);if(n.length===0||C<=0)return d.jsx("div",{className:"hq-chart-empty",children:c});const _=n.length,k=w/_,j=Math.max(2,Math.min(18,k-2)),A=G=>v+q*(1-G/C),$=[C*.25,C*.5,C*.75,C],D=Math.max(1,Math.round(_/5)),L=G=>new Date(G).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),Y=u!==null?n[u]:void 0;return d.jsxs("div",{className:"hq-chart",children:[d.jsxs("svg",{viewBox:`0 0 ${p} ${y}`,className:"hq-chart-svg",role:"img",onMouseLeave:()=>f(null),children:[d.jsx("clipPath",{id:m,children:d.jsx("rect",{x,y:v,width:w,height:q})}),$.map((G,te)=>d.jsxs("g",{children:[d.jsx("line",{x1:x,x2:p-g,y1:A(G),y2:A(G),className:"hq-chart-grid"}),d.jsx("text",{x:x-6,y:A(G)+3,className:"hq-chart-ytick",textAnchor:"end",children:o(G)})]},te)),d.jsx("line",{x1:x,x2:p-g,y1:v+q,y2:v+q,className:"hq-chart-axis"}),d.jsx("g",{clipPath:`url(#${m})`,children:n.map((G,te)=>{const I=x+te*k+(k-j)/2,F=A(G.value),V=v+q-F;return V<=0?null:d.jsx("rect",{x:I,y:F,width:j,height:V,rx:Math.min(3,j/2),fill:a,opacity:u===null||u===te?1:.45},te)})}),n.map((G,te)=>te%D===0?d.jsx("text",{x:x+te*k+k/2,y:y-6,className:"hq-chart-xtick",textAnchor:"middle",children:L(G.ts)},te):null),n.map((G,te)=>d.jsx("rect",{x:x+te*k,y:v,width:k,height:q,fill:"transparent",onMouseEnter:()=>f(te)},te))]}),Y!==void 0&&d.jsxs("div",{className:"hq-chart-tooltip",children:[d.jsx("span",{className:"hq-chart-tooltip-swatch",style:{background:a}}),d.jsx("span",{className:"hq-chart-tooltip-value",children:o(Y.value)}),d.jsx("span",{className:"hq-chart-tooltip-time",children:L(Y.ts)})]})]})}const G0=[{label:"1h",ms:3600*1e3},{label:"6h",ms:360*60*1e3},{label:"24h",ms:1440*60*1e3},{label:"7d",ms:10080*60*1e3}];function Z0(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}k`:String(Math.round(n))}function iT(){const[n,a]=z.useState([]),[s,o]=z.useState(null),[c,u]=z.useState(G0[2].ms);if(z.useEffect(()=>{let v=!1;const S=()=>{Cl("/api/trends/cost").then(q=>{v||(a(q.samples),o(null))}).catch(q=>{v||o(q.message)})};S();const w=setInterval(S,3e4);return()=>{v=!0,clearInterval(w)}},[]),s!==null)return d.jsxs("div",{className:"hq-empty",children:["Error loading trends: ",s]});if(n.length===0)return d.jsx("div",{className:"hq-empty",children:"No trend data yet. Trends accumulate as cost signals arrive."});const f=Date.now()-c,m=n.filter(v=>v.ts>=f),p=m.length>0?m:n.slice(-24),y=p.reduce((v,S)=>v+S.costUsd,0),x=p.reduce((v,S)=>v+S.inputTokens+S.outputTokens,0),g=p.reduce((v,S)=>v+S.toolCalls,0);return d.jsxs("div",{children:[d.jsxs("div",{className:"hq-filter-row",children:[G0.map(v=>d.jsx("button",{type:"button",className:`hq-pill hq-filter-chip${c===v.ms?" selected":""}`,onClick:()=>u(v.ms),children:v.label},v.label)),d.jsxs("span",{className:"hq-mono hq-row-subtle",style:{marginLeft:"auto"},children:[p.length," × 5-min buckets"]})]}),d.jsxs("div",{className:"hq-kpi-row",children:[d.jsxs("div",{className:"hq-kpi",children:[d.jsxs("span",{className:"hq-kpi-value accent-cost",children:["$",y.toFixed(4)]}),d.jsx("span",{className:"hq-kpi-label",children:"cost"})]}),d.jsxs("div",{className:"hq-kpi",children:[d.jsx("span",{className:"hq-kpi-value",children:Z0(x)}),d.jsx("span",{className:"hq-kpi-label",children:"tokens"})]}),d.jsxs("div",{className:"hq-kpi",children:[d.jsx("span",{className:"hq-kpi-value",children:g.toLocaleString()}),d.jsx("span",{className:"hq-kpi-label",children:"tool calls"})]})]}),d.jsxs("div",{className:"hq-card",children:[d.jsx("div",{className:"hq-card-title",children:"Cost (USD)"}),d.jsx($f,{points:p.map(v=>({ts:v.ts,value:v.costUsd})),color:"var(--chart-1)",format:v=>`$${v>=1?v.toFixed(2):v.toFixed(4)}`})]}),d.jsxs("div",{className:"hq-card",children:[d.jsx("div",{className:"hq-card-title",children:"Tokens (in + out)"}),d.jsx($f,{points:p.map(v=>({ts:v.ts,value:v.inputTokens+v.outputTokens})),color:"var(--chart-2)",format:Z0})]}),d.jsxs("div",{className:"hq-card",children:[d.jsx("div",{className:"hq-card-title",children:"Tool calls"}),d.jsx($f,{points:p.map(v=>({ts:v.ts,value:v.toolCalls})),color:"var(--chart-3)",format:v=>String(Math.round(v))})]})]})}const _x={allocated:{Icon:fd,cls:"info"},committed:{Icon:ey,cls:"active"},merged:{Icon:gS,cls:"active"},conflict:{Icon:F0,cls:"warn"},released:{Icon:pS,cls:"idle"},failed:{Icon:ny,cls:"error"}};function sT({e:n}){const a=n.payload,s=_x[a.kind]??{Icon:fd,cls:"info"};return d.jsxs("div",{className:"hq-row",children:[d.jsx(s.Icon,{size:14,className:`hq-kind-icon ${s.cls}`}),d.jsx("span",{style:{fontWeight:700},children:a.kind}),a.branch!==void 0&&d.jsx("span",{className:"hq-pill info",children:a.branch}),a.kind==="committed"&&d.jsxs("span",{className:"hq-mono hq-diffstat",children:[d.jsxs("span",{className:"hq-diff-add-count",children:["+",a.insertions??0]})," ",d.jsxs("span",{className:"hq-diff-del-count",children:["−",a.deletions??0]})," in ",a.files??0," file(s)"," ",a.sha!==void 0?`(${a.sha.slice(0,7)})`:""]}),a.kind==="conflict"&&a.conflictFiles!==void 0&&d.jsxs("span",{className:"hq-mono hq-row-error",children:["conflicts: ",a.conflictFiles.join(", ")]}),a.kind==="failed"&&d.jsx("span",{className:"hq-mono hq-row-error",children:a.error}),d.jsx("span",{className:"hq-mono hq-row-time",children:new Date(n.timestamp).toLocaleTimeString()})]})}function oT(){const{events:n,loading:a}=xd("worktree.event",300),s=z.useMemo(()=>{const o=new Map;for(const c of n){const f=c.payload.ownerId??"(unknown)",m=o.get(f)??[];m.push(c),o.set(f,m)}return Array.from(o.entries()).reverse()},[n]);return s.length===0?d.jsx("div",{className:"hq-empty",children:a?"Loading worktree history…":"No worktree events yet. These appear when AutoPhase allocates/merges git worktrees for parallel phases."}):d.jsxs("div",{children:[d.jsxs("div",{className:"hq-card-title",children:["Worktree Lifecycle (",s.length," worktree",s.length===1?"":"s",")"]}),s.map(([o,c])=>{const u=c[c.length-1].payload,f=_x[u.kind]??{cls:"info"};return d.jsxs("div",{className:"hq-card",children:[d.jsxs("div",{className:"hq-row hq-lane-head",children:[d.jsx("span",{className:"hq-mono",style:{fontWeight:700},children:o}),d.jsx("span",{className:`hq-pill ${f.cls}`,children:u.kind}),d.jsxs("span",{className:"hq-mono hq-row-time",children:[c.length," events"]})]}),c.map(m=>d.jsx(sT,{e:m},m.id))]},o)})]})}const cT=[{id:"cockpit",label:"Cockpit",icon:"🛰"},{id:"fleet",label:"Fleet",icon:"🖥"},{id:"console",label:"Console",icon:"💬"},{id:"mailbox",label:"Mailbox",icon:"📬"},{id:"cost",label:"Cost",icon:"💰"},{id:"brain",label:"Brain",icon:"🧠"},{id:"worktree",label:"Worktrees",icon:"🌿"},{id:"trends",label:"Trends",icon:"📈"},{id:"alerts",label:"Alerts",icon:"🔔"},{id:"control",label:"Control",icon:"⚡"}];function rT(){const n=cn(["snapshot","alerts","activeView","authRequired"]);if(z.useEffect(()=>{Cl("/api/snapshot").catch(()=>{})},[]),n.authRequired)return d.jsx(aT,{hadToken:gd()!==null});const s=n.snapshot?.totals,o=s?.unreadMailboxMessages??0,c=n.alerts.filter(u=>u.severity!=="info").length;return d.jsxs("div",{className:"hq-app",children:[d.jsxs("header",{className:"hq-header",children:[d.jsx("div",{className:"hq-brand",children:"WrongStack HQ"}),d.jsx("span",{className:"hq-ui-badge",title:"Served from @wrongstack/webui-hq/dist",children:"built webui-hq"}),d.jsx("div",{className:"hq-led","data-live":n.connected}),d.jsx("span",{className:"hq-conn",children:n.connected?"connected":"reconnecting…"}),d.jsxs("div",{className:"hq-stats",children:[d.jsx(ms,{label:"machines",value:s?.activeMachines??0}),d.jsx(ms,{label:"clients",value:s?.activeClients??0}),d.jsx(ms,{label:"sessions",value:s?.activeSessions??0}),d.jsx(ms,{label:"agents",value:s?.activeAgents??0}),d.jsx(ms,{label:"cost $",value:(s?.totalCostUsd??0).toFixed(2),accent:"green"})]})]}),d.jsx("nav",{className:"hq-nav",children:cT.map(u=>d.jsxs("button",{className:"hq-tab"+(n.activeView===u.id?" active":""),onClick:()=>Pa(u.id),children:[d.jsx("span",{className:"hq-tab-icon",children:u.icon}),d.jsx("span",{className:"hq-tab-label",children:u.label}),u.id==="mailbox"&&o>0?d.jsx("span",{className:"hq-badge",children:o}):null,u.id==="alerts"&&c>0?d.jsx("span",{className:"hq-badge red",children:c}):null]},u.id))}),d.jsxs("main",{className:"hq-main",children:[n.activeView==="cockpit"&&d.jsx(kS,{}),n.activeView==="fleet"&&d.jsx(OM,{}),n.activeView==="console"&&d.jsx(RM,{}),n.activeView==="mailbox"&&d.jsx(nT,{}),n.activeView==="cost"&&d.jsx(JS,{}),n.activeView==="brain"&&d.jsx(HS,{}),n.activeView==="worktree"&&d.jsx(oT,{}),n.activeView==="trends"&&d.jsx(iT,{}),n.activeView==="alerts"&&d.jsx(DS,{}),n.activeView==="control"&&d.jsx(GS,{})]})]})}function ms({label:n,value:a,accent:s}){return d.jsxs("div",{className:"hq-stat"+(s?` ${s}`:""),children:[d.jsx("span",{className:"hq-stat-num",children:a}),d.jsx("span",{className:"hq-stat-label",children:n})]})}const Q0=document.getElementById("root");Q0!==null&&(wS(),ry(),SS.createRoot(Q0).render(d.jsx(P0.StrictMode,{children:d.jsx(rT,{})})));
|