function KE(e,n){for(var r=0;r<n.length;r++){const a=n[r];if(typeof a!="string"&&!Array.isArray(a)){for(const l in a)if(l!=="default"&&!(l in e)){const c=Object.getOwnPropertyDescriptor(a,l);c&&Object.defineProperty(e,l,c.get?c:{enumerable:!0,get:()=>a[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&a(d)}).observe(document,{childList:!0,subtree:!0});function r(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(l){if(l.ep)return;l.ep=!0;const c=r(l);fetch(l.href,c)}})();function Cp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var eh={exports:{}},qi={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var hv;function QE(){if(hv)return qi;hv=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(a,l,c){var d=null;if(c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+l.key),"key"in l){c={};for(var f in l)f!=="key"&&(c[f]=l[f])}else c=l;return l=c.ref,{$$typeof:e,type:a,key:d,ref:l!==void 0?l:null,props:c}}return qi.Fragment=n,qi.jsx=r,qi.jsxs=r,qi}var pv;function JE(){return pv||(pv=1,eh.exports=QE()),eh.exports}var o=JE(),th={exports:{}},Xe={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var gv;function eC(){if(gv)return Xe;gv=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),x=Symbol.iterator;function y(C){return C===null||typeof C!="object"?null:(C=x&&C[x]||C["@@iterator"],typeof C=="function"?C:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,N={};function S(C,$,Y){this.props=C,this.context=$,this.refs=N,this.updater=Y||b}S.prototype.isReactComponent={},S.prototype.setState=function(C,$){if(typeof C!="object"&&typeof C!="function"&&C!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,C,$,"setState")},S.prototype.forceUpdate=function(C){this.updater.enqueueForceUpdate(this,C,"forceUpdate")};function _(){}_.prototype=S.prototype;function A(C,$,Y){this.props=C,this.context=$,this.refs=N,this.updater=Y||b}var E=A.prototype=new _;E.constructor=A,j(E,S.prototype),E.isPureReactComponent=!0;var M=Array.isArray,T={H:null,A:null,T:null,S:null,V:null},D=Object.prototype.hasOwnProperty;function z(C,$,Y,V,J,ce){return Y=ce.ref,{$$typeof:e,type:C,key:$,ref:Y!==void 0?Y:null,props:ce}}function H(C,$){return z(C.type,$,void 0,void 0,void 0,C.props)}function q(C){return typeof C=="object"&&C!==null&&C.$$typeof===e}function X(C){var $={"=":"=0",":":"=2"};return"$"+C.replace(/[=:]/g,function(Y){return $[Y]})}var W=/\/+/g;function G(C,$){return typeof C=="object"&&C!==null&&C.key!=null?X(""+C.key):$.toString(36)}function ne(){}function B(C){switch(C.status){case"fulfilled":return C.value;case"rejected":throw C.reason;default:switch(typeof C.status=="string"?C.then(ne,ne):(C.status="pending",C.then(function($){C.status==="pending"&&(C.status="fulfilled",C.value=$)},function($){C.status==="pending"&&(C.status="rejected",C.reason=$)})),C.status){case"fulfilled":return C.value;case"rejected":throw C.reason}}throw C}function U(C,$,Y,V,J){var ce=typeof C;(ce==="undefined"||ce==="boolean")&&(C=null);var fe=!1;if(C===null)fe=!0;else switch(ce){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(C.$$typeof){case e:case n:fe=!0;break;case g:return fe=C._init,U(fe(C._payload),$,Y,V,J)}}if(fe)return J=J(C),fe=V===""?"."+G(C,0):V,M(J)?(Y="",fe!=null&&(Y=fe.replace(W,"$&/")+"/"),U(J,$,Y,"",function(ge){return ge})):J!=null&&(q(J)&&(J=H(J,Y+(J.key==null||C&&C.key===J.key?"":(""+J.key).replace(W,"$&/")+"/")+fe)),$.push(J)),1;fe=0;var ee=V===""?".":V+":";if(M(C))for(var ie=0;ie<C.length;ie++)V=C[ie],ce=ee+G(V,ie),fe+=U(V,$,Y,ce,J);else if(ie=y(C),typeof ie=="function")for(C=ie.call(C),ie=0;!(V=C.next()).done;)V=V.value,ce=ee+G(V,ie++),fe+=U(V,$,Y,ce,J);else if(ce==="object"){if(typeof C.then=="function")return U(B(C),$,Y,V,J);throw $=String(C),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(C).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}return fe}function R(C,$,Y){if(C==null)return C;var V=[],J=0;return U(C,V,"","",function(ce){return $.call(Y,ce,J++)}),V}function L(C){if(C._status===-1){var $=C._result;$=$(),$.then(function(Y){(C._status===0||C._status===-1)&&(C._status=1,C._result=Y)},function(Y){(C._status===0||C._status===-1)&&(C._status=2,C._result=Y)}),C._status===-1&&(C._status=0,C._result=$)}if(C._status===1)return C._result.default;throw C._result}var I=typeof reportError=="function"?reportError:function(C){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof C=="object"&&C!==null&&typeof C.message=="string"?String(C.message):String(C),error:C});if(!window.dispatchEvent($))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",C);return}console.error(C)};function P(){}return Xe.Children={map:R,forEach:function(C,$,Y){R(C,function(){$.apply(this,arguments)},Y)},count:function(C){var $=0;return R(C,function(){$++}),$},toArray:function(C){return R(C,function($){return $})||[]},only:function(C){if(!q(C))throw Error("React.Children.only expected to receive a single React element child.");return C}},Xe.Component=S,Xe.Fragment=r,Xe.Profiler=l,Xe.PureComponent=A,Xe.StrictMode=a,Xe.Suspense=m,Xe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,Xe.__COMPILER_RUNTIME={__proto__:null,c:function(C){return T.H.useMemoCache(C)}},Xe.cache=function(C){return function(){return C.apply(null,arguments)}},Xe.cloneElement=function(C,$,Y){if(C==null)throw Error("The argument must be a React element, but you passed "+C+".");var V=j({},C.props),J=C.key,ce=void 0;if($!=null)for(fe in $.ref!==void 0&&(ce=void 0),$.key!==void 0&&(J=""+$.key),$)!D.call($,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&$.ref===void 0||(V[fe]=$[fe]);var fe=arguments.length-2;if(fe===1)V.children=Y;else if(1<fe){for(var ee=Array(fe),ie=0;ie<fe;ie++)ee[ie]=arguments[ie+2];V.children=ee}return z(C.type,J,void 0,void 0,ce,V)},Xe.createContext=function(C){return C={$$typeof:d,_currentValue:C,_currentValue2:C,_threadCount:0,Provider:null,Consumer:null},C.Provider=C,C.Consumer={$$typeof:c,_context:C},C},Xe.createElement=function(C,$,Y){var V,J={},ce=null;if($!=null)for(V in $.key!==void 0&&(ce=""+$.key),$)D.call($,V)&&V!=="key"&&V!=="__self"&&V!=="__source"&&(J[V]=$[V]);var fe=arguments.length-2;if(fe===1)J.children=Y;else if(1<fe){for(var ee=Array(fe),ie=0;ie<fe;ie++)ee[ie]=arguments[ie+2];J.children=ee}if(C&&C.defaultProps)for(V in fe=C.defaultProps,fe)J[V]===void 0&&(J[V]=fe[V]);return z(C,ce,void 0,void 0,null,J)},Xe.createRef=function(){return{current:null}},Xe.forwardRef=function(C){return{$$typeof:f,render:C}},Xe.isValidElement=q,Xe.lazy=function(C){return{$$typeof:g,_payload:{_status:-1,_result:C},_init:L}},Xe.memo=function(C,$){return{$$typeof:h,type:C,compare:$===void 0?null:$}},Xe.startTransition=function(C){var $=T.T,Y={};T.T=Y;try{var V=C(),J=T.S;J!==null&&J(Y,V),typeof V=="object"&&V!==null&&typeof V.then=="function"&&V.then(P,I)}catch(ce){I(ce)}finally{T.T=$}},Xe.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},Xe.use=function(C){return T.H.use(C)},Xe.useActionState=function(C,$,Y){return T.H.useActionState(C,$,Y)},Xe.useCallback=function(C,$){return T.H.useCallback(C,$)},Xe.useContext=function(C){return T.H.useContext(C)},Xe.useDebugValue=function(){},Xe.useDeferredValue=function(C,$){return T.H.useDeferredValue(C,$)},Xe.useEffect=function(C,$,Y){var V=T.H;if(typeof Y=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return V.useEffect(C,$)},Xe.useId=function(){return T.H.useId()},Xe.useImperativeHandle=function(C,$,Y){return T.H.useImperativeHandle(C,$,Y)},Xe.useInsertionEffect=function(C,$){return T.H.useInsertionEffect(C,$)},Xe.useLayoutEffect=function(C,$){return T.H.useLayoutEffect(C,$)},Xe.useMemo=function(C,$){return T.H.useMemo(C,$)},Xe.useOptimistic=function(C,$){return T.H.useOptimistic(C,$)},Xe.useReducer=function(C,$,Y){return T.H.useReducer(C,$,Y)},Xe.useRef=function(C){return T.H.useRef(C)},Xe.useState=function(C){return T.H.useState(C)},Xe.useSyncExternalStore=function(C,$,Y){return T.H.useSyncExternalStore(C,$,Y)},Xe.useTransition=function(){return T.H.useTransition()},Xe.version="19.1.1",Xe}var xv;function wl(){return xv||(xv=1,th.exports=eC()),th.exports}var w=wl();const Nn=Cp(w),yw=KE({__proto__:null,default:Nn},[w]);var nh={exports:{}},Fi={},sh={exports:{}},rh={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var yv;function tC(){return yv||(yv=1,(function(e){function n(R,L){var I=R.length;R.push(L);e:for(;0<I;){var P=I-1>>>1,C=R[P];if(0<l(C,L))R[P]=L,R[I]=C,I=P;else break e}}function r(R){return R.length===0?null:R[0]}function a(R){if(R.length===0)return null;var L=R[0],I=R.pop();if(I!==L){R[0]=I;e:for(var P=0,C=R.length,$=C>>>1;P<$;){var Y=2*(P+1)-1,V=R[Y],J=Y+1,ce=R[J];if(0>l(V,I))J<C&&0>l(ce,V)?(R[P]=ce,R[J]=I,P=J):(R[P]=V,R[Y]=I,P=Y);else if(J<C&&0>l(ce,I))R[P]=ce,R[J]=I,P=J;else break e}}return L}function l(R,L){var I=R.sortIndex-L.sortIndex;return I!==0?I:R.id-L.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],h=[],g=1,x=null,y=3,b=!1,j=!1,N=!1,S=!1,_=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function M(R){for(var L=r(h);L!==null;){if(L.callback===null)a(h);else if(L.startTime<=R)a(h),L.sortIndex=L.expirationTime,n(m,L);else break;L=r(h)}}function T(R){if(N=!1,M(R),!j)if(r(m)!==null)j=!0,D||(D=!0,G());else{var L=r(h);L!==null&&U(T,L.startTime-R)}}var D=!1,z=-1,H=5,q=-1;function X(){return S?!0:!(e.unstable_now()-q<H)}function W(){if(S=!1,D){var R=e.unstable_now();q=R;var L=!0;try{e:{j=!1,N&&(N=!1,A(z),z=-1),b=!0;var I=y;try{t:{for(M(R),x=r(m);x!==null&&!(x.expirationTime>R&&X());){var P=x.callback;if(typeof P=="function"){x.callback=null,y=x.priorityLevel;var C=P(x.expirationTime<=R);if(R=e.unstable_now(),typeof C=="function"){x.callback=C,M(R),L=!0;break t}x===r(m)&&a(m),M(R)}else a(m);x=r(m)}if(x!==null)L=!0;else{var $=r(h);$!==null&&U(T,$.startTime-R),L=!1}}break e}finally{x=null,y=I,b=!1}L=void 0}}finally{L?G():D=!1}}}var G;if(typeof E=="function")G=function(){E(W)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,B=ne.port2;ne.port1.onmessage=W,G=function(){B.postMessage(null)}}else G=function(){_(W,0)};function U(R,L){z=_(function(){R(e.unstable_now())},L)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(R){switch(y){case 1:case 2:case 3:var L=3;break;default:L=y}var I=y;y=L;try{return R()}finally{y=I}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(R,L){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var I=y;y=R;try{return L()}finally{y=I}},e.unstable_scheduleCallback=function(R,L,I){var P=e.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?P+I:P):I=P,R){case 1:var C=-1;break;case 2:C=250;break;case 5:C=1073741823;break;case 4:C=1e4;break;default:C=5e3}return C=I+C,R={id:g++,callback:L,priorityLevel:R,startTime:I,expirationTime:C,sortIndex:-1},I>P?(R.sortIndex=I,n(h,R),r(m)===null&&R===r(h)&&(N?(A(z),z=-1):N=!0,U(T,I-P))):(R.sortIndex=C,n(m,R),j||b||(j=!0,D||(D=!0,G()))),R},e.unstable_shouldYield=X,e.unstable_wrapCallback=function(R){var L=y;return function(){var I=y;y=L;try{return R.apply(this,arguments)}finally{y=I}}}})(rh)),rh}var vv;function nC(){return vv||(vv=1,sh.exports=tC()),sh.exports}var oh={exports:{}},Jt={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var bv;function sC(){if(bv)return Jt;bv=1;var e=wl();function n(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var a={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},l=Symbol.for("react.portal");function c(m,h,g){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:x==null?null:""+x,children:m,containerInfo:h,implementation:g}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Jt.createPortal=function(m,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(n(299));return c(m,h,null,g)},Jt.flushSync=function(m){var h=d.T,g=a.p;try{if(d.T=null,a.p=2,m)return m()}finally{d.T=h,a.p=g,a.d.f()}},Jt.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,a.d.C(m,h))},Jt.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Jt.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var g=h.as,x=f(g,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?a.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:x,integrity:y,fetchPriority:b}):g==="script"&&a.d.X(m,{crossOrigin:x,integrity:y,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Jt.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=f(h.as,h.crossOrigin);a.d.M(m,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&a.d.M(m)},Jt.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,x=f(g,h.crossOrigin);a.d.L(m,g,{crossOrigin:x,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Jt.preloadModule=function(m,h){if(typeof m=="string")if(h){var g=f(h.as,h.crossOrigin);a.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(m)},Jt.requestFormReset=function(m){a.d.r(m)},Jt.unstable_batchedUpdates=function(m,h){return m(h)},Jt.useFormState=function(m,h,g){return d.H.useFormState(m,h,g)},Jt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Jt.version="19.1.1",Jt}var wv;function vw(){if(wv)return oh.exports;wv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),oh.exports=sC(),oh.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Nv;function rC(){if(Nv)return Fi;Nv=1;var e=nC(),n=wl(),r=vw();function a(t){var s="https://react.dev/errors/"+t;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)s+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var s=t,i=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(i=s.return),t=s.return;while(t)}return s.tag===3?i:null}function d(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function f(t){if(c(t)!==t)throw Error(a(188))}function m(t){var s=t.alternate;if(!s){if(s=c(t),s===null)throw Error(a(188));return s!==t?null:t}for(var i=t,u=s;;){var p=i.return;if(p===null)break;var v=p.alternate;if(v===null){if(u=p.return,u!==null){i=u;continue}break}if(p.child===v.child){for(v=p.child;v;){if(v===i)return f(p),t;if(v===u)return f(p),s;v=v.sibling}throw Error(a(188))}if(i.return!==u.return)i=p,u=v;else{for(var k=!1,O=p.child;O;){if(O===i){k=!0,i=p,u=v;break}if(O===u){k=!0,u=p,i=v;break}O=O.sibling}if(!k){for(O=v.child;O;){if(O===i){k=!0,i=v,u=p;break}if(O===u){k=!0,u=v,i=p;break}O=O.sibling}if(!k)throw Error(a(189))}}if(i.alternate!==u)throw Error(a(190))}if(i.tag!==3)throw Error(a(188));return i.stateNode.current===i?t:s}function h(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t;for(t=t.child;t!==null;){if(s=h(t),s!==null)return s;t=t.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),_=Symbol.for("react.provider"),A=Symbol.for("react.consumer"),E=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),X=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function G(t){return t===null||typeof t!="object"?null:(t=W&&t[W]||t["@@iterator"],typeof t=="function"?t:null)}var ne=Symbol.for("react.client.reference");function B(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ne?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case j:return"Fragment";case S:return"Profiler";case N:return"StrictMode";case T:return"Suspense";case D:return"SuspenseList";case q:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case b:return"Portal";case E:return(t.displayName||"Context")+".Provider";case A:return(t._context.displayName||"Context")+".Consumer";case M:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case z:return s=t.displayName||null,s!==null?s:B(t.type)||"Memo";case H:s=t._payload,t=t._init;try{return B(t(s))}catch{}}return null}var U=Array.isArray,R=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},P=[],C=-1;function $(t){return{current:t}}function Y(t){0>C||(t.current=P[C],P[C]=null,C--)}function V(t,s){C++,P[C]=t.current,t.current=s}var J=$(null),ce=$(null),fe=$(null),ee=$(null);function ie(t,s){switch(V(fe,s),V(ce,t),V(J,null),s.nodeType){case 9:case 11:t=(t=s.documentElement)&&(t=t.namespaceURI)?By(t):0;break;default:if(t=s.tagName,s=s.namespaceURI)s=By(s),t=Vy(s,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Y(J),V(J,t)}function ge(){Y(J),Y(ce),Y(fe)}function Ee(t){t.memoizedState!==null&&V(ee,t);var s=J.current,i=Vy(s,t.type);s!==i&&(V(ce,t),V(J,i))}function Ne(t){ce.current===t&&(Y(J),Y(ce)),ee.current===t&&(Y(ee),Pi._currentValue=I)}var ve=Object.prototype.hasOwnProperty,ze=e.unstable_scheduleCallback,re=e.unstable_cancelCallback,Q=e.unstable_shouldYield,me=e.unstable_requestPaint,be=e.unstable_now,Ce=e.unstable_getCurrentPriorityLevel,we=e.unstable_ImmediatePriority,Me=e.unstable_UserBlockingPriority,je=e.unstable_NormalPriority,Se=e.unstable_LowPriority,Ke=e.unstable_IdlePriority,tt=e.log,Be=e.unstable_setDisableYieldValue,_e=null,xe=null;function $e(t){if(typeof tt=="function"&&Be(t),xe&&typeof xe.setStrictMode=="function")try{xe.setStrictMode(_e,t)}catch{}}var Ge=Math.clz32?Math.clz32:_o,qt=Math.log,rn=Math.LN2;function _o(t){return t>>>=0,t===0?32:31-(qt(t)/rn|0)|0}var Jn=256,vs=4194304;function pe(t){var s=t&42;if(s!==0)return s;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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:case 262144:case 524288:case 1048576:case 2097152:return t&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ae(t,s,i){var u=t.pendingLanes;if(u===0)return 0;var p=0,v=t.suspendedLanes,k=t.pingedLanes;t=t.warmLanes;var O=u&134217727;return O!==0?(u=O&~v,u!==0?p=pe(u):(k&=O,k!==0?p=pe(k):i||(i=O&~t,i!==0&&(p=pe(i))))):(O=u&~v,O!==0?p=pe(O):k!==0?p=pe(k):i||(i=u&~t,i!==0&&(p=pe(i)))),p===0?0:s!==0&&s!==p&&(s&v)===0&&(v=p&-p,i=s&-s,v>=i||v===32&&(i&4194048)!==0)?s:p}function Ie(t,s){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&s)===0}function Ot(t,s){switch(t){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 Ft(){var t=Jn;return Jn<<=1,(Jn&4194048)===0&&(Jn=256),t}function Pe(){var t=vs;return vs<<=1,(vs&62914560)===0&&(vs=4194304),t}function ye(t){for(var s=[],i=0;31>i;i++)s.push(t);return s}function dt(t,s){t.pendingLanes|=s,s!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function _t(t,s,i,u,p,v){var k=t.pendingLanes;t.pendingLanes=i,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=i,t.entangledLanes&=i,t.errorRecoveryDisabledLanes&=i,t.shellSuspendCounter=0;var O=t.entanglements,F=t.expirationTimes,se=t.hiddenUpdates;for(i=k&~i;0<i;){var ue=31-Ge(i),he=1<<ue;O[ue]=0,F[ue]=-1;var oe=se[ue];if(oe!==null)for(se[ue]=null,ue=0;ue<oe.length;ue++){var ae=oe[ue];ae!==null&&(ae.lane&=-536870913)}i&=~he}u!==0&&ot(t,u,0),v!==0&&p===0&&t.tag!==0&&(t.suspendedLanes|=v&~(k&~s))}function ot(t,s,i){t.pendingLanes|=s,t.suspendedLanes&=~s;var u=31-Ge(s);t.entangledLanes|=s,t.entanglements[u]=t.entanglements[u]|1073741824|i&4194090}function kn(t,s){var i=t.entangledLanes|=s;for(t=t.entanglements;i;){var u=31-Ge(i),p=1<<u;p&s|t[u]&s&&(t[u]|=s),i&=~p}}function mn(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Pn(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Ll(){var t=L.p;return t!==0?t:(t=window.event,t===void 0?32:lv(t.type))}function qd(t,s){var i=L.p;try{return L.p=t,s()}finally{L.p=i}}var es=Math.random().toString(36).slice(2),Ht="__reactFiber$"+es,Kt="__reactProps$"+es,Ks="__reactContainer$"+es,qa="__reactEvents$"+es,Fd="__reactListeners$"+es,Yd="__reactHandles$"+es,$l="__reactResources$"+es,Br="__reactMarker$"+es;function Fa(t){delete t[Ht],delete t[Kt],delete t[qa],delete t[Fd],delete t[Yd]}function Qs(t){var s=t[Ht];if(s)return s;for(var i=t.parentNode;i;){if(s=i[Ks]||i[Ht]){if(i=s.alternate,s.child!==null||i!==null&&i.child!==null)for(t=Gy(t);t!==null;){if(i=t[Ht])return i;t=Gy(t)}return s}t=i,i=t.parentNode}return null}function bs(t){if(t=t[Ht]||t[Ks]){var s=t.tag;if(s===5||s===6||s===13||s===26||s===27||s===3)return t}return null}function Js(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t.stateNode;throw Error(a(33))}function ws(t){var s=t[$l];return s||(s=t[$l]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Tt(t){t[Br]=!0}var Pl=new Set,Hl={};function Ns(t,s){er(t,s),er(t+"Capture",s)}function er(t,s){for(Hl[t]=s,t=0;t<s.length;t++)Pl.add(s[t])}var Gd=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]*$"),Ya={},Ul={};function Xd(t){return ve.call(Ul,t)?!0:ve.call(Ya,t)?!1:Gd.test(t)?Ul[t]=!0:(Ya[t]=!0,!1)}function Eo(t,s,i){if(Xd(s))if(i===null)t.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":t.removeAttribute(s);return;case"boolean":var u=s.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(s);return}}t.setAttribute(s,""+i)}}function Co(t,s,i){if(i===null)t.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttribute(s,""+i)}}function Hn(t,s,i,u){if(u===null)t.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttributeNS(s,i,""+u)}}var Ga,Bl;function js(t){if(Ga===void 0)try{throw Error()}catch(i){var s=i.stack.trim().match(/\n( *(at )?)/);Ga=s&&s[1]||"",Bl=-1<i.stack.indexOf(`
    at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Ga+t+Bl}var Xa=!1;function Za(t,s){if(!t||Xa)return"";Xa=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(s){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(ae){var oe=ae}Reflect.construct(t,[],he)}else{try{he.call()}catch(ae){oe=ae}t.call(he.prototype)}}else{try{throw Error()}catch(ae){oe=ae}(he=t())&&typeof he.catch=="function"&&he.catch(function(){})}}catch(ae){if(ae&&oe&&typeof ae.stack=="string")return[ae.stack,oe.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=u.DetermineComponentFrameRoot(),k=v[0],O=v[1];if(k&&O){var F=k.split(`
`),se=O.split(`
`);for(p=u=0;u<F.length&&!F[u].includes("DetermineComponentFrameRoot");)u++;for(;p<se.length&&!se[p].includes("DetermineComponentFrameRoot");)p++;if(u===F.length||p===se.length)for(u=F.length-1,p=se.length-1;1<=u&&0<=p&&F[u]!==se[p];)p--;for(;1<=u&&0<=p;u--,p--)if(F[u]!==se[p]){if(u!==1||p!==1)do if(u--,p--,0>p||F[u]!==se[p]){var ue=`
`+F[u].replace(" at new "," at ");return t.displayName&&ue.includes("<anonymous>")&&(ue=ue.replace("<anonymous>",t.displayName)),ue}while(1<=u&&0<=p);break}}}finally{Xa=!1,Error.prepareStackTrace=i}return(i=t?t.displayName||t.name:"")?js(i):""}function Zd(t){switch(t.tag){case 26:case 27:case 5:return js(t.type);case 16:return js("Lazy");case 13:return js("Suspense");case 19:return js("SuspenseList");case 0:case 15:return Za(t.type,!1);case 11:return Za(t.type.render,!1);case 1:return Za(t.type,!0);case 31:return js("Activity");default:return""}}function Vl(t){try{var s="";do s+=Zd(t),t=t.return;while(t);return s}catch(i){return`
Error generating stack: `+i.message+`
`+i.stack}}function on(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function ql(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Wd(t){var s=ql(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),u=""+t[s];if(!t.hasOwnProperty(s)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var p=i.get,v=i.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return p.call(this)},set:function(k){u=""+k,v.call(this,k)}}),Object.defineProperty(t,s,{enumerable:i.enumerable}),{getValue:function(){return u},setValue:function(k){u=""+k},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function ko(t){t._valueTracker||(t._valueTracker=Wd(t))}function Wa(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var i=s.getValue(),u="";return t&&(u=ql(t)?t.checked?"true":"false":t.value),t=u,t!==i?(s.setValue(t),!0):!1}function To(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Kd=/[\n"\\]/g;function an(t){return t.replace(Kd,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Vr(t,s,i,u,p,v,k,O){t.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?t.type=k:t.removeAttribute("type"),s!=null?k==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+on(s)):t.value!==""+on(s)&&(t.value=""+on(s)):k!=="submit"&&k!=="reset"||t.removeAttribute("value"),s!=null?Ka(t,k,on(s)):i!=null?Ka(t,k,on(i)):u!=null&&t.removeAttribute("value"),p==null&&v!=null&&(t.defaultChecked=!!v),p!=null&&(t.checked=p&&typeof p!="function"&&typeof p!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?t.name=""+on(O):t.removeAttribute("name")}function Fl(t,s,i,u,p,v,k,O){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.type=v),s!=null||i!=null){if(!(v!=="submit"&&v!=="reset"||s!=null))return;i=i!=null?""+on(i):"",s=s!=null?""+on(s):i,O||s===t.value||(t.value=s),t.defaultValue=s}u=u??p,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=O?t.checked:!!u,t.defaultChecked=!!u,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(t.name=k)}function Ka(t,s,i){s==="number"&&To(t.ownerDocument)===t||t.defaultValue===""+i||(t.defaultValue=""+i)}function Ss(t,s,i,u){if(t=t.options,s){s={};for(var p=0;p<i.length;p++)s["$"+i[p]]=!0;for(i=0;i<t.length;i++)p=s.hasOwnProperty("$"+t[i].value),t[i].selected!==p&&(t[i].selected=p),p&&u&&(t[i].defaultSelected=!0)}else{for(i=""+on(i),s=null,p=0;p<t.length;p++){if(t[p].value===i){t[p].selected=!0,u&&(t[p].defaultSelected=!0);return}s!==null||t[p].disabled||(s=t[p])}s!==null&&(s.selected=!0)}}function Hg(t,s,i){if(s!=null&&(s=""+on(s),s!==t.value&&(t.value=s),i==null)){t.defaultValue!==s&&(t.defaultValue=s);return}t.defaultValue=i!=null?""+on(i):""}function Ug(t,s,i,u){if(s==null){if(u!=null){if(i!=null)throw Error(a(92));if(U(u)){if(1<u.length)throw Error(a(93));u=u[0]}i=u}i==null&&(i=""),s=i}i=on(s),t.defaultValue=i,u=t.textContent,u===i&&u!==""&&u!==null&&(t.value=u)}function Ao(t,s){if(s){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=s;return}}t.textContent=s}var XS=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 Bg(t,s,i){var u=s.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?u?t.setProperty(s,""):s==="float"?t.cssFloat="":t[s]="":u?t.setProperty(s,i):typeof i!="number"||i===0||XS.has(s)?s==="float"?t.cssFloat=i:t[s]=(""+i).trim():t[s]=i+"px"}function Vg(t,s,i){if(s!=null&&typeof s!="object")throw Error(a(62));if(t=t.style,i!=null){for(var u in i)!i.hasOwnProperty(u)||s!=null&&s.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var p in s)u=s[p],s.hasOwnProperty(p)&&i[p]!==u&&Bg(t,p,u)}else for(var v in s)s.hasOwnProperty(v)&&Bg(t,v,s[v])}function Qd(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ZS=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"]]),WS=/^[\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 Yl(t){return WS.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}var Jd=null;function ef(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Mo=null,Ro=null;function qg(t){var s=bs(t);if(s&&(t=s.stateNode)){var i=t[Kt]||null;e:switch(t=s.stateNode,s.type){case"input":if(Vr(t,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),s=i.name,i.type==="radio"&&s!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+an(""+s)+'"][type="radio"]'),s=0;s<i.length;s++){var u=i[s];if(u!==t&&u.form===t.form){var p=u[Kt]||null;if(!p)throw Error(a(90));Vr(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(s=0;s<i.length;s++)u=i[s],u.form===t.form&&Wa(u)}break e;case"textarea":Hg(t,i.value,i.defaultValue);break e;case"select":s=i.value,s!=null&&Ss(t,!!i.multiple,s,!1)}}}var tf=!1;function Fg(t,s,i){if(tf)return t(s,i);tf=!0;try{var u=t(s);return u}finally{if(tf=!1,(Mo!==null||Ro!==null)&&(Mc(),Mo&&(s=Mo,t=Ro,Ro=Mo=null,qg(s),t)))for(s=0;s<t.length;s++)qg(t[s])}}function Qa(t,s){var i=t.stateNode;if(i===null)return null;var u=i[Kt]||null;if(u===null)return null;i=u[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(a(231,s,typeof i));return i}var _s=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),nf=!1;if(_s)try{var Ja={};Object.defineProperty(Ja,"passive",{get:function(){nf=!0}}),window.addEventListener("test",Ja,Ja),window.removeEventListener("test",Ja,Ja)}catch{nf=!1}var tr=null,sf=null,Gl=null;function Yg(){if(Gl)return Gl;var t,s=sf,i=s.length,u,p="value"in tr?tr.value:tr.textContent,v=p.length;for(t=0;t<i&&s[t]===p[t];t++);var k=i-t;for(u=1;u<=k&&s[i-u]===p[v-u];u++);return Gl=p.slice(t,1<u?1-u:void 0)}function Xl(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function Zl(){return!0}function Gg(){return!1}function ln(t){function s(i,u,p,v,k){this._reactName=i,this._targetInst=p,this.type=u,this.nativeEvent=v,this.target=k,this.currentTarget=null;for(var O in t)t.hasOwnProperty(O)&&(i=t[O],this[O]=i?i(v):v[O]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Zl:Gg,this.isPropagationStopped=Gg,this}return g(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Zl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Zl)},persist:function(){},isPersistent:Zl}),s}var qr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wl=ln(qr),ei=g({},qr,{view:0,detail:0}),KS=ln(ei),rf,of,ti,Kl=g({},ei,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lf,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ti&&(ti&&t.type==="mousemove"?(rf=t.screenX-ti.screenX,of=t.screenY-ti.screenY):of=rf=0,ti=t),rf)},movementY:function(t){return"movementY"in t?t.movementY:of}}),Xg=ln(Kl),QS=g({},Kl,{dataTransfer:0}),JS=ln(QS),e_=g({},ei,{relatedTarget:0}),af=ln(e_),t_=g({},qr,{animationName:0,elapsedTime:0,pseudoElement:0}),n_=ln(t_),s_=g({},qr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),r_=ln(s_),o_=g({},qr,{data:0}),Zg=ln(o_),a_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},i_={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"},l_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function c_(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=l_[t])?!!s[t]:!1}function lf(){return c_}var u_=g({},ei,{key:function(t){if(t.key){var s=a_[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=Xl(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?i_[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lf,charCode:function(t){return t.type==="keypress"?Xl(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Xl(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),d_=ln(u_),f_=g({},Kl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wg=ln(f_),m_=g({},ei,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lf}),h_=ln(m_),p_=g({},qr,{propertyName:0,elapsedTime:0,pseudoElement:0}),g_=ln(p_),x_=g({},Kl,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),y_=ln(x_),v_=g({},qr,{newState:0,oldState:0}),b_=ln(v_),w_=[9,13,27,32],cf=_s&&"CompositionEvent"in window,ni=null;_s&&"documentMode"in document&&(ni=document.documentMode);var N_=_s&&"TextEvent"in window&&!ni,Kg=_s&&(!cf||ni&&8<ni&&11>=ni),Qg=" ",Jg=!1;function ex(t,s){switch(t){case"keyup":return w_.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tx(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Do=!1;function j_(t,s){switch(t){case"compositionend":return tx(s);case"keypress":return s.which!==32?null:(Jg=!0,Qg);case"textInput":return t=s.data,t===Qg&&Jg?null:t;default:return null}}function S_(t,s){if(Do)return t==="compositionend"||!cf&&ex(t,s)?(t=Yg(),Gl=sf=tr=null,Do=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Kg&&s.locale!=="ko"?null:s.data;default:return null}}var __={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 nx(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!__[t.type]:s==="textarea"}function sx(t,s,i,u){Mo?Ro?Ro.push(u):Ro=[u]:Mo=u,s=Lc(s,"onChange"),0<s.length&&(i=new Wl("onChange","change",null,i,u),t.push({event:i,listeners:s}))}var si=null,ri=null;function E_(t){Ly(t,0)}function Ql(t){var s=Js(t);if(Wa(s))return t}function rx(t,s){if(t==="change")return s}var ox=!1;if(_s){var uf;if(_s){var df="oninput"in document;if(!df){var ax=document.createElement("div");ax.setAttribute("oninput","return;"),df=typeof ax.oninput=="function"}uf=df}else uf=!1;ox=uf&&(!document.documentMode||9<document.documentMode)}function ix(){si&&(si.detachEvent("onpropertychange",lx),ri=si=null)}function lx(t){if(t.propertyName==="value"&&Ql(ri)){var s=[];sx(s,ri,t,ef(t)),Fg(E_,s)}}function C_(t,s,i){t==="focusin"?(ix(),si=s,ri=i,si.attachEvent("onpropertychange",lx)):t==="focusout"&&ix()}function k_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ql(ri)}function T_(t,s){if(t==="click")return Ql(s)}function A_(t,s){if(t==="input"||t==="change")return Ql(s)}function M_(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var hn=typeof Object.is=="function"?Object.is:M_;function oi(t,s){if(hn(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var i=Object.keys(t),u=Object.keys(s);if(i.length!==u.length)return!1;for(u=0;u<i.length;u++){var p=i[u];if(!ve.call(s,p)||!hn(t[p],s[p]))return!1}return!0}function cx(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function ux(t,s){var i=cx(t);t=0;for(var u;i;){if(i.nodeType===3){if(u=t+i.textContent.length,t<=s&&u>=s)return{node:i,offset:s-t};t=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=cx(i)}}function dx(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?dx(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function fx(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var s=To(t.document);s instanceof t.HTMLIFrameElement;){try{var i=typeof s.contentWindow.location.href=="string"}catch{i=!1}if(i)t=s.contentWindow;else break;s=To(t.document)}return s}function ff(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}var R_=_s&&"documentMode"in document&&11>=document.documentMode,Oo=null,mf=null,ai=null,hf=!1;function mx(t,s,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;hf||Oo==null||Oo!==To(u)||(u=Oo,"selectionStart"in u&&ff(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),ai&&oi(ai,u)||(ai=u,u=Lc(mf,"onSelect"),0<u.length&&(s=new Wl("onSelect","select",null,s,i),t.push({event:s,listeners:u}),s.target=Oo)))}function Fr(t,s){var i={};return i[t.toLowerCase()]=s.toLowerCase(),i["Webkit"+t]="webkit"+s,i["Moz"+t]="moz"+s,i}var zo={animationend:Fr("Animation","AnimationEnd"),animationiteration:Fr("Animation","AnimationIteration"),animationstart:Fr("Animation","AnimationStart"),transitionrun:Fr("Transition","TransitionRun"),transitionstart:Fr("Transition","TransitionStart"),transitioncancel:Fr("Transition","TransitionCancel"),transitionend:Fr("Transition","TransitionEnd")},pf={},hx={};_s&&(hx=document.createElement("div").style,"AnimationEvent"in window||(delete zo.animationend.animation,delete zo.animationiteration.animation,delete zo.animationstart.animation),"TransitionEvent"in window||delete zo.transitionend.transition);function Yr(t){if(pf[t])return pf[t];if(!zo[t])return t;var s=zo[t],i;for(i in s)if(s.hasOwnProperty(i)&&i in hx)return pf[t]=s[i];return t}var px=Yr("animationend"),gx=Yr("animationiteration"),xx=Yr("animationstart"),D_=Yr("transitionrun"),O_=Yr("transitionstart"),z_=Yr("transitioncancel"),yx=Yr("transitionend"),vx=new Map,gf="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(" ");gf.push("scrollEnd");function Un(t,s){vx.set(t,s),Ns(s,[t])}var bx=new WeakMap;function Tn(t,s){if(typeof t=="object"&&t!==null){var i=bx.get(t);return i!==void 0?i:(s={value:t,source:s,stack:Vl(s)},bx.set(t,s),s)}return{value:t,source:s,stack:Vl(s)}}var An=[],Io=0,xf=0;function Jl(){for(var t=Io,s=xf=Io=0;s<t;){var i=An[s];An[s++]=null;var u=An[s];An[s++]=null;var p=An[s];An[s++]=null;var v=An[s];if(An[s++]=null,u!==null&&p!==null){var k=u.pending;k===null?p.next=p:(p.next=k.next,k.next=p),u.pending=p}v!==0&&wx(i,p,v)}}function ec(t,s,i,u){An[Io++]=t,An[Io++]=s,An[Io++]=i,An[Io++]=u,xf|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function yf(t,s,i,u){return ec(t,s,i,u),tc(t)}function Lo(t,s){return ec(t,null,null,s),tc(t)}function wx(t,s,i){t.lanes|=i;var u=t.alternate;u!==null&&(u.lanes|=i);for(var p=!1,v=t.return;v!==null;)v.childLanes|=i,u=v.alternate,u!==null&&(u.childLanes|=i),v.tag===22&&(t=v.stateNode,t===null||t._visibility&1||(p=!0)),t=v,v=v.return;return t.tag===3?(v=t.stateNode,p&&s!==null&&(p=31-Ge(i),t=v.hiddenUpdates,u=t[p],u===null?t[p]=[s]:u.push(s),s.lane=i|536870912),v):null}function tc(t){if(50<Mi)throw Mi=0,Sm=null,Error(a(185));for(var s=t.return;s!==null;)t=s,s=t.return;return t.tag===3?t.stateNode:null}var $o={};function I_(t,s,i,u){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pn(t,s,i,u){return new I_(t,s,i,u)}function vf(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Es(t,s){var i=t.alternate;return i===null?(i=pn(t.tag,s,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=s,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&65011712,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,s=t.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i.refCleanup=t.refCleanup,i}function Nx(t,s){t.flags&=65011714;var i=t.alternate;return i===null?(t.childLanes=0,t.lanes=s,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=i.childLanes,t.lanes=i.lanes,t.child=i.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=i.memoizedProps,t.memoizedState=i.memoizedState,t.updateQueue=i.updateQueue,t.type=i.type,s=i.dependencies,t.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),t}function nc(t,s,i,u,p,v){var k=0;if(u=t,typeof t=="function")vf(t)&&(k=1);else if(typeof t=="string")k=$E(t,i,J.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case q:return t=pn(31,i,s,p),t.elementType=q,t.lanes=v,t;case j:return Gr(i.children,p,v,s);case N:k=8,p|=24;break;case S:return t=pn(12,i,s,p|2),t.elementType=S,t.lanes=v,t;case T:return t=pn(13,i,s,p),t.elementType=T,t.lanes=v,t;case D:return t=pn(19,i,s,p),t.elementType=D,t.lanes=v,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case _:case E:k=10;break e;case A:k=9;break e;case M:k=11;break e;case z:k=14;break e;case H:k=16,u=null;break e}k=29,i=Error(a(130,t===null?"null":typeof t,"")),u=null}return s=pn(k,i,s,p),s.elementType=t,s.type=u,s.lanes=v,s}function Gr(t,s,i,u){return t=pn(7,t,u,s),t.lanes=i,t}function bf(t,s,i){return t=pn(6,t,null,s),t.lanes=i,t}function wf(t,s,i){return s=pn(4,t.children!==null?t.children:[],t.key,s),s.lanes=i,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}var Po=[],Ho=0,sc=null,rc=0,Mn=[],Rn=0,Xr=null,Cs=1,ks="";function Zr(t,s){Po[Ho++]=rc,Po[Ho++]=sc,sc=t,rc=s}function jx(t,s,i){Mn[Rn++]=Cs,Mn[Rn++]=ks,Mn[Rn++]=Xr,Xr=t;var u=Cs;t=ks;var p=32-Ge(u)-1;u&=~(1<<p),i+=1;var v=32-Ge(s)+p;if(30<v){var k=p-p%5;v=(u&(1<<k)-1).toString(32),u>>=k,p-=k,Cs=1<<32-Ge(s)+p|i<<p|u,ks=v+t}else Cs=1<<v|i<<p|u,ks=t}function Nf(t){t.return!==null&&(Zr(t,1),jx(t,1,0))}function jf(t){for(;t===sc;)sc=Po[--Ho],Po[Ho]=null,rc=Po[--Ho],Po[Ho]=null;for(;t===Xr;)Xr=Mn[--Rn],Mn[Rn]=null,ks=Mn[--Rn],Mn[Rn]=null,Cs=Mn[--Rn],Mn[Rn]=null}var tn=null,jt=null,ct=!1,Wr=null,ts=!1,Sf=Error(a(519));function Kr(t){var s=Error(a(418,""));throw ci(Tn(s,t)),Sf}function Sx(t){var s=t.stateNode,i=t.type,u=t.memoizedProps;switch(s[Ht]=t,s[Kt]=u,i){case"dialog":st("cancel",s),st("close",s);break;case"iframe":case"object":case"embed":st("load",s);break;case"video":case"audio":for(i=0;i<Di.length;i++)st(Di[i],s);break;case"source":st("error",s);break;case"img":case"image":case"link":st("error",s),st("load",s);break;case"details":st("toggle",s);break;case"input":st("invalid",s),Fl(s,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0),ko(s);break;case"select":st("invalid",s);break;case"textarea":st("invalid",s),Ug(s,u.value,u.defaultValue,u.children),ko(s)}i=u.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||s.textContent===""+i||u.suppressHydrationWarning===!0||Uy(s.textContent,i)?(u.popover!=null&&(st("beforetoggle",s),st("toggle",s)),u.onScroll!=null&&st("scroll",s),u.onScrollEnd!=null&&st("scrollend",s),u.onClick!=null&&(s.onclick=$c),s=!0):s=!1,s||Kr(t)}function _x(t){for(tn=t.return;tn;)switch(tn.tag){case 5:case 13:ts=!1;return;case 27:case 3:ts=!0;return;default:tn=tn.return}}function ii(t){if(t!==tn)return!1;if(!ct)return _x(t),ct=!0,!1;var s=t.tag,i;if((i=s!==3&&s!==27)&&((i=s===5)&&(i=t.type,i=!(i!=="form"&&i!=="button")||Hm(t.type,t.memoizedProps)),i=!i),i&&jt&&Kr(t),_x(t),s===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));e:{for(t=t.nextSibling,s=0;t;){if(t.nodeType===8)if(i=t.data,i==="/$"){if(s===0){jt=Vn(t.nextSibling);break e}s--}else i!=="$"&&i!=="$!"&&i!=="$?"||s++;t=t.nextSibling}jt=null}}else s===27?(s=jt,xr(t.type)?(t=qm,qm=null,jt=t):jt=s):jt=tn?Vn(t.stateNode.nextSibling):null;return!0}function li(){jt=tn=null,ct=!1}function Ex(){var t=Wr;return t!==null&&(dn===null?dn=t:dn.push.apply(dn,t),Wr=null),t}function ci(t){Wr===null?Wr=[t]:Wr.push(t)}var _f=$(null),Qr=null,Ts=null;function nr(t,s,i){V(_f,s._currentValue),s._currentValue=i}function As(t){t._currentValue=_f.current,Y(_f)}function Ef(t,s,i){for(;t!==null;){var u=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),t===i)break;t=t.return}}function Cf(t,s,i,u){var p=t.child;for(p!==null&&(p.return=t);p!==null;){var v=p.dependencies;if(v!==null){var k=p.child;v=v.firstContext;e:for(;v!==null;){var O=v;v=p;for(var F=0;F<s.length;F++)if(O.context===s[F]){v.lanes|=i,O=v.alternate,O!==null&&(O.lanes|=i),Ef(v.return,i,t),u||(k=null);break e}v=O.next}}else if(p.tag===18){if(k=p.return,k===null)throw Error(a(341));k.lanes|=i,v=k.alternate,v!==null&&(v.lanes|=i),Ef(k,i,t),k=null}else k=p.child;if(k!==null)k.return=p;else for(k=p;k!==null;){if(k===t){k=null;break}if(p=k.sibling,p!==null){p.return=k.return,k=p;break}k=k.return}p=k}}function ui(t,s,i,u){t=null;for(var p=s,v=!1;p!==null;){if(!v){if((p.flags&524288)!==0)v=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var k=p.alternate;if(k===null)throw Error(a(387));if(k=k.memoizedProps,k!==null){var O=p.type;hn(p.pendingProps.value,k.value)||(t!==null?t.push(O):t=[O])}}else if(p===ee.current){if(k=p.alternate,k===null)throw Error(a(387));k.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(t!==null?t.push(Pi):t=[Pi])}p=p.return}t!==null&&Cf(s,t,i,u),s.flags|=262144}function oc(t){for(t=t.firstContext;t!==null;){if(!hn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Jr(t){Qr=t,Ts=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Qt(t){return Cx(Qr,t)}function ac(t,s){return Qr===null&&Jr(t),Cx(t,s)}function Cx(t,s){var i=s._currentValue;if(s={context:s,memoizedValue:i,next:null},Ts===null){if(t===null)throw Error(a(308));Ts=s,t.dependencies={lanes:0,firstContext:s},t.flags|=524288}else Ts=Ts.next=s;return i}var L_=typeof AbortController<"u"?AbortController:function(){var t=[],s=this.signal={aborted:!1,addEventListener:function(i,u){t.push(u)}};this.abort=function(){s.aborted=!0,t.forEach(function(i){return i()})}},$_=e.unstable_scheduleCallback,P_=e.unstable_NormalPriority,zt={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function kf(){return{controller:new L_,data:new Map,refCount:0}}function di(t){t.refCount--,t.refCount===0&&$_(P_,function(){t.controller.abort()})}var fi=null,Tf=0,Uo=0,Bo=null;function H_(t,s){if(fi===null){var i=fi=[];Tf=0,Uo=Mm(),Bo={status:"pending",value:void 0,then:function(u){i.push(u)}}}return Tf++,s.then(kx,kx),s}function kx(){if(--Tf===0&&fi!==null){Bo!==null&&(Bo.status="fulfilled");var t=fi;fi=null,Uo=0,Bo=null;for(var s=0;s<t.length;s++)(0,t[s])()}}function U_(t,s){var i=[],u={status:"pending",value:null,reason:null,then:function(p){i.push(p)}};return t.then(function(){u.status="fulfilled",u.value=s;for(var p=0;p<i.length;p++)(0,i[p])(s)},function(p){for(u.status="rejected",u.reason=p,p=0;p<i.length;p++)(0,i[p])(void 0)}),u}var Tx=R.S;R.S=function(t,s){typeof s=="object"&&s!==null&&typeof s.then=="function"&&H_(t,s),Tx!==null&&Tx(t,s)};var eo=$(null);function Af(){var t=eo.current;return t!==null?t:yt.pooledCache}function ic(t,s){s===null?V(eo,eo.current):V(eo,s.pool)}function Ax(){var t=Af();return t===null?null:{parent:zt._currentValue,pool:t}}var mi=Error(a(460)),Mx=Error(a(474)),lc=Error(a(542)),Mf={then:function(){}};function Rx(t){return t=t.status,t==="fulfilled"||t==="rejected"}function cc(){}function Dx(t,s,i){switch(i=t[i],i===void 0?t.push(s):i!==s&&(s.then(cc,cc),s=i),s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,zx(t),t;default:if(typeof s.status=="string")s.then(cc,cc);else{if(t=yt,t!==null&&100<t.shellSuspendCounter)throw Error(a(482));t=s,t.status="pending",t.then(function(u){if(s.status==="pending"){var p=s;p.status="fulfilled",p.value=u}},function(u){if(s.status==="pending"){var p=s;p.status="rejected",p.reason=u}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,zx(t),t}throw hi=s,mi}}var hi=null;function Ox(){if(hi===null)throw Error(a(459));var t=hi;return hi=null,t}function zx(t){if(t===mi||t===lc)throw Error(a(483))}var sr=!1;function Rf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Df(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function rr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function or(t,s,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(ft&2)!==0){var p=u.pending;return p===null?s.next=s:(s.next=p.next,p.next=s),u.pending=s,s=tc(t),wx(t,null,i),s}return ec(t,u,s,i),tc(t)}function pi(t,s,i){if(s=s.updateQueue,s!==null&&(s=s.shared,(i&4194048)!==0)){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,kn(t,i)}}function Of(t,s){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var p=null,v=null;if(i=i.firstBaseUpdate,i!==null){do{var k={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};v===null?p=v=k:v=v.next=k,i=i.next}while(i!==null);v===null?p=v=s:v=v.next=s}else p=v=s;i={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:v,shared:u.shared,callbacks:u.callbacks},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=s:t.next=s,i.lastBaseUpdate=s}var zf=!1;function gi(){if(zf){var t=Bo;if(t!==null)throw t}}function xi(t,s,i,u){zf=!1;var p=t.updateQueue;sr=!1;var v=p.firstBaseUpdate,k=p.lastBaseUpdate,O=p.shared.pending;if(O!==null){p.shared.pending=null;var F=O,se=F.next;F.next=null,k===null?v=se:k.next=se,k=F;var ue=t.alternate;ue!==null&&(ue=ue.updateQueue,O=ue.lastBaseUpdate,O!==k&&(O===null?ue.firstBaseUpdate=se:O.next=se,ue.lastBaseUpdate=F))}if(v!==null){var he=p.baseState;k=0,ue=se=F=null,O=v;do{var oe=O.lane&-536870913,ae=oe!==O.lane;if(ae?(it&oe)===oe:(u&oe)===oe){oe!==0&&oe===Uo&&(zf=!0),ue!==null&&(ue=ue.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var Fe=t,Ve=O;oe=s;var gt=i;switch(Ve.tag){case 1:if(Fe=Ve.payload,typeof Fe=="function"){he=Fe.call(gt,he,oe);break e}he=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=Ve.payload,oe=typeof Fe=="function"?Fe.call(gt,he,oe):Fe,oe==null)break e;he=g({},he,oe);break e;case 2:sr=!0}}oe=O.callback,oe!==null&&(t.flags|=64,ae&&(t.flags|=8192),ae=p.callbacks,ae===null?p.callbacks=[oe]:ae.push(oe))}else ae={lane:oe,tag:O.tag,payload:O.payload,callback:O.callback,next:null},ue===null?(se=ue=ae,F=he):ue=ue.next=ae,k|=oe;if(O=O.next,O===null){if(O=p.shared.pending,O===null)break;ae=O,O=ae.next,ae.next=null,p.lastBaseUpdate=ae,p.shared.pending=null}}while(!0);ue===null&&(F=he),p.baseState=F,p.firstBaseUpdate=se,p.lastBaseUpdate=ue,v===null&&(p.shared.lanes=0),mr|=k,t.lanes=k,t.memoizedState=he}}function Ix(t,s){if(typeof t!="function")throw Error(a(191,t));t.call(s)}function Lx(t,s){var i=t.callbacks;if(i!==null)for(t.callbacks=null,t=0;t<i.length;t++)Ix(i[t],s)}var Vo=$(null),uc=$(0);function $x(t,s){t=Ls,V(uc,t),V(Vo,s),Ls=t|s.baseLanes}function If(){V(uc,Ls),V(Vo,Vo.current)}function Lf(){Ls=uc.current,Y(Vo),Y(uc)}var ar=0,Qe=null,ht=null,At=null,dc=!1,qo=!1,to=!1,fc=0,yi=0,Fo=null,B_=0;function Et(){throw Error(a(321))}function $f(t,s){if(s===null)return!1;for(var i=0;i<s.length&&i<t.length;i++)if(!hn(t[i],s[i]))return!1;return!0}function Pf(t,s,i,u,p,v){return ar=v,Qe=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,R.H=t===null||t.memoizedState===null?w0:N0,to=!1,v=i(u,p),to=!1,qo&&(v=Hx(s,i,u,p)),Px(t),v}function Px(t){R.H=yc;var s=ht!==null&&ht.next!==null;if(ar=0,At=ht=Qe=null,dc=!1,yi=0,Fo=null,s)throw Error(a(300));t===null||Ut||(t=t.dependencies,t!==null&&oc(t)&&(Ut=!0))}function Hx(t,s,i,u){Qe=t;var p=0;do{if(qo&&(Fo=null),yi=0,qo=!1,25<=p)throw Error(a(301));if(p+=1,At=ht=null,t.updateQueue!=null){var v=t.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}R.H=Z_,v=s(i,u)}while(qo);return v}function V_(){var t=R.H,s=t.useState()[0];return s=typeof s.then=="function"?vi(s):s,t=t.useState()[0],(ht!==null?ht.memoizedState:null)!==t&&(Qe.flags|=1024),s}function Hf(){var t=fc!==0;return fc=0,t}function Uf(t,s,i){s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~i}function Bf(t){if(dc){for(t=t.memoizedState;t!==null;){var s=t.queue;s!==null&&(s.pending=null),t=t.next}dc=!1}ar=0,At=ht=Qe=null,qo=!1,yi=fc=0,Fo=null}function cn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return At===null?Qe.memoizedState=At=t:At=At.next=t,At}function Mt(){if(ht===null){var t=Qe.alternate;t=t!==null?t.memoizedState:null}else t=ht.next;var s=At===null?Qe.memoizedState:At.next;if(s!==null)At=s,ht=t;else{if(t===null)throw Qe.alternate===null?Error(a(467)):Error(a(310));ht=t,t={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},At===null?Qe.memoizedState=At=t:At=At.next=t}return At}function Vf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function vi(t){var s=yi;return yi+=1,Fo===null&&(Fo=[]),t=Dx(Fo,t,s),s=Qe,(At===null?s.memoizedState:At.next)===null&&(s=s.alternate,R.H=s===null||s.memoizedState===null?w0:N0),t}function mc(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return vi(t);if(t.$$typeof===E)return Qt(t)}throw Error(a(438,String(t)))}function qf(t){var s=null,i=Qe.updateQueue;if(i!==null&&(s=i.memoCache),s==null){var u=Qe.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(s={data:u.data.map(function(p){return p.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),i===null&&(i=Vf(),Qe.updateQueue=i),i.memoCache=s,i=s.data[s.index],i===void 0)for(i=s.data[s.index]=Array(t),u=0;u<t;u++)i[u]=X;return s.index++,i}function Ms(t,s){return typeof s=="function"?s(t):s}function hc(t){var s=Mt();return Ff(s,ht,t)}function Ff(t,s,i){var u=t.queue;if(u===null)throw Error(a(311));u.lastRenderedReducer=i;var p=t.baseQueue,v=u.pending;if(v!==null){if(p!==null){var k=p.next;p.next=v.next,v.next=k}s.baseQueue=p=v,u.pending=null}if(v=t.baseState,p===null)t.memoizedState=v;else{s=p.next;var O=k=null,F=null,se=s,ue=!1;do{var he=se.lane&-536870913;if(he!==se.lane?(it&he)===he:(ar&he)===he){var oe=se.revertLane;if(oe===0)F!==null&&(F=F.next={lane:0,revertLane:0,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null}),he===Uo&&(ue=!0);else if((ar&oe)===oe){se=se.next,oe===Uo&&(ue=!0);continue}else he={lane:0,revertLane:se.revertLane,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},F===null?(O=F=he,k=v):F=F.next=he,Qe.lanes|=oe,mr|=oe;he=se.action,to&&i(v,he),v=se.hasEagerState?se.eagerState:i(v,he)}else oe={lane:he,revertLane:se.revertLane,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},F===null?(O=F=oe,k=v):F=F.next=oe,Qe.lanes|=he,mr|=he;se=se.next}while(se!==null&&se!==s);if(F===null?k=v:F.next=O,!hn(v,t.memoizedState)&&(Ut=!0,ue&&(i=Bo,i!==null)))throw i;t.memoizedState=v,t.baseState=k,t.baseQueue=F,u.lastRenderedState=v}return p===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function Yf(t){var s=Mt(),i=s.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=t;var u=i.dispatch,p=i.pending,v=s.memoizedState;if(p!==null){i.pending=null;var k=p=p.next;do v=t(v,k.action),k=k.next;while(k!==p);hn(v,s.memoizedState)||(Ut=!0),s.memoizedState=v,s.baseQueue===null&&(s.baseState=v),i.lastRenderedState=v}return[v,u]}function Ux(t,s,i){var u=Qe,p=Mt(),v=ct;if(v){if(i===void 0)throw Error(a(407));i=i()}else i=s();var k=!hn((ht||p).memoizedState,i);k&&(p.memoizedState=i,Ut=!0),p=p.queue;var O=qx.bind(null,u,p,t);if(bi(2048,8,O,[t]),p.getSnapshot!==s||k||At!==null&&At.memoizedState.tag&1){if(u.flags|=2048,Yo(9,pc(),Vx.bind(null,u,p,i,s),null),yt===null)throw Error(a(349));v||(ar&124)!==0||Bx(u,s,i)}return i}function Bx(t,s,i){t.flags|=16384,t={getSnapshot:s,value:i},s=Qe.updateQueue,s===null?(s=Vf(),Qe.updateQueue=s,s.stores=[t]):(i=s.stores,i===null?s.stores=[t]:i.push(t))}function Vx(t,s,i,u){s.value=i,s.getSnapshot=u,Fx(s)&&Yx(t)}function qx(t,s,i){return i(function(){Fx(s)&&Yx(t)})}function Fx(t){var s=t.getSnapshot;t=t.value;try{var i=s();return!hn(t,i)}catch{return!0}}function Yx(t){var s=Lo(t,2);s!==null&&bn(s,t,2)}function Gf(t){var s=cn();if(typeof t=="function"){var i=t;if(t=i(),to){$e(!0);try{i()}finally{$e(!1)}}}return s.memoizedState=s.baseState=t,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:t},s}function Gx(t,s,i,u){return t.baseState=i,Ff(t,ht,typeof u=="function"?u:Ms)}function q_(t,s,i,u,p){if(xc(t))throw Error(a(485));if(t=s.action,t!==null){var v={payload:p,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(k){v.listeners.push(k)}};R.T!==null?i(!0):v.isTransition=!1,u(v),i=s.pending,i===null?(v.next=s.pending=v,Xx(s,v)):(v.next=i.next,s.pending=i.next=v)}}function Xx(t,s){var i=s.action,u=s.payload,p=t.state;if(s.isTransition){var v=R.T,k={};R.T=k;try{var O=i(p,u),F=R.S;F!==null&&F(k,O),Zx(t,s,O)}catch(se){Xf(t,s,se)}finally{R.T=v}}else try{v=i(p,u),Zx(t,s,v)}catch(se){Xf(t,s,se)}}function Zx(t,s,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(u){Wx(t,s,u)},function(u){return Xf(t,s,u)}):Wx(t,s,i)}function Wx(t,s,i){s.status="fulfilled",s.value=i,Kx(s),t.state=i,s=t.pending,s!==null&&(i=s.next,i===s?t.pending=null:(i=i.next,s.next=i,Xx(t,i)))}function Xf(t,s,i){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do s.status="rejected",s.reason=i,Kx(s),s=s.next;while(s!==u)}t.action=null}function Kx(t){t=t.listeners;for(var s=0;s<t.length;s++)(0,t[s])()}function Qx(t,s){return s}function Jx(t,s){if(ct){var i=yt.formState;if(i!==null){e:{var u=Qe;if(ct){if(jt){t:{for(var p=jt,v=ts;p.nodeType!==8;){if(!v){p=null;break t}if(p=Vn(p.nextSibling),p===null){p=null;break t}}v=p.data,p=v==="F!"||v==="F"?p:null}if(p){jt=Vn(p.nextSibling),u=p.data==="F!";break e}}Kr(u)}u=!1}u&&(s=i[0])}}return i=cn(),i.memoizedState=i.baseState=s,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qx,lastRenderedState:s},i.queue=u,i=y0.bind(null,Qe,u),u.dispatch=i,u=Gf(!1),v=Jf.bind(null,Qe,!1,u.queue),u=cn(),p={state:s,dispatch:null,action:t,pending:null},u.queue=p,i=q_.bind(null,Qe,p,v,i),p.dispatch=i,u.memoizedState=t,[s,i,!1]}function e0(t){var s=Mt();return t0(s,ht,t)}function t0(t,s,i){if(s=Ff(t,s,Qx)[0],t=hc(Ms)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var u=vi(s)}catch(k){throw k===mi?lc:k}else u=s;s=Mt();var p=s.queue,v=p.dispatch;return i!==s.memoizedState&&(Qe.flags|=2048,Yo(9,pc(),F_.bind(null,p,i),null)),[u,v,t]}function F_(t,s){t.action=s}function n0(t){var s=Mt(),i=ht;if(i!==null)return t0(s,i,t);Mt(),s=s.memoizedState,i=Mt();var u=i.queue.dispatch;return i.memoizedState=t,[s,u,!1]}function Yo(t,s,i,u){return t={tag:t,create:i,deps:u,inst:s,next:null},s=Qe.updateQueue,s===null&&(s=Vf(),Qe.updateQueue=s),i=s.lastEffect,i===null?s.lastEffect=t.next=t:(u=i.next,i.next=t,t.next=u,s.lastEffect=t),t}function pc(){return{destroy:void 0,resource:void 0}}function s0(){return Mt().memoizedState}function gc(t,s,i,u){var p=cn();u=u===void 0?null:u,Qe.flags|=t,p.memoizedState=Yo(1|s,pc(),i,u)}function bi(t,s,i,u){var p=Mt();u=u===void 0?null:u;var v=p.memoizedState.inst;ht!==null&&u!==null&&$f(u,ht.memoizedState.deps)?p.memoizedState=Yo(s,v,i,u):(Qe.flags|=t,p.memoizedState=Yo(1|s,v,i,u))}function r0(t,s){gc(8390656,8,t,s)}function o0(t,s){bi(2048,8,t,s)}function a0(t,s){return bi(4,2,t,s)}function i0(t,s){return bi(4,4,t,s)}function l0(t,s){if(typeof s=="function"){t=t();var i=s(t);return function(){typeof i=="function"?i():s(null)}}if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function c0(t,s,i){i=i!=null?i.concat([t]):null,bi(4,4,l0.bind(null,s,t),i)}function Zf(){}function u0(t,s){var i=Mt();s=s===void 0?null:s;var u=i.memoizedState;return s!==null&&$f(s,u[1])?u[0]:(i.memoizedState=[t,s],t)}function d0(t,s){var i=Mt();s=s===void 0?null:s;var u=i.memoizedState;if(s!==null&&$f(s,u[1]))return u[0];if(u=t(),to){$e(!0);try{t()}finally{$e(!1)}}return i.memoizedState=[u,s],u}function Wf(t,s,i){return i===void 0||(ar&1073741824)!==0?t.memoizedState=s:(t.memoizedState=i,t=hy(),Qe.lanes|=t,mr|=t,i)}function f0(t,s,i,u){return hn(i,s)?i:Vo.current!==null?(t=Wf(t,i,u),hn(t,s)||(Ut=!0),t):(ar&42)===0?(Ut=!0,t.memoizedState=i):(t=hy(),Qe.lanes|=t,mr|=t,s)}function m0(t,s,i,u,p){var v=L.p;L.p=v!==0&&8>v?v:8;var k=R.T,O={};R.T=O,Jf(t,!1,s,i);try{var F=p(),se=R.S;if(se!==null&&se(O,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var ue=U_(F,u);wi(t,s,ue,vn(t))}else wi(t,s,u,vn(t))}catch(he){wi(t,s,{then:function(){},status:"rejected",reason:he},vn())}finally{L.p=v,R.T=k}}function Y_(){}function Kf(t,s,i,u){if(t.tag!==5)throw Error(a(476));var p=h0(t).queue;m0(t,p,s,I,i===null?Y_:function(){return p0(t),i(u)})}function h0(t){var s=t.memoizedState;if(s!==null)return s;s={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:I},next:null};var i={};return s.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:i},next:null},t.memoizedState=s,t=t.alternate,t!==null&&(t.memoizedState=s),s}function p0(t){var s=h0(t).next.queue;wi(t,s,{},vn())}function Qf(){return Qt(Pi)}function g0(){return Mt().memoizedState}function x0(){return Mt().memoizedState}function G_(t){for(var s=t.return;s!==null;){switch(s.tag){case 24:case 3:var i=vn();t=rr(i);var u=or(s,t,i);u!==null&&(bn(u,s,i),pi(u,s,i)),s={cache:kf()},t.payload=s;return}s=s.return}}function X_(t,s,i){var u=vn();i={lane:u,revertLane:0,action:i,hasEagerState:!1,eagerState:null,next:null},xc(t)?v0(s,i):(i=yf(t,s,i,u),i!==null&&(bn(i,t,u),b0(i,s,u)))}function y0(t,s,i){var u=vn();wi(t,s,i,u)}function wi(t,s,i,u){var p={lane:u,revertLane:0,action:i,hasEagerState:!1,eagerState:null,next:null};if(xc(t))v0(s,p);else{var v=t.alternate;if(t.lanes===0&&(v===null||v.lanes===0)&&(v=s.lastRenderedReducer,v!==null))try{var k=s.lastRenderedState,O=v(k,i);if(p.hasEagerState=!0,p.eagerState=O,hn(O,k))return ec(t,s,p,0),yt===null&&Jl(),!1}catch{}finally{}if(i=yf(t,s,p,u),i!==null)return bn(i,t,u),b0(i,s,u),!0}return!1}function Jf(t,s,i,u){if(u={lane:2,revertLane:Mm(),action:u,hasEagerState:!1,eagerState:null,next:null},xc(t)){if(s)throw Error(a(479))}else s=yf(t,i,u,2),s!==null&&bn(s,t,2)}function xc(t){var s=t.alternate;return t===Qe||s!==null&&s===Qe}function v0(t,s){qo=dc=!0;var i=t.pending;i===null?s.next=s:(s.next=i.next,i.next=s),t.pending=s}function b0(t,s,i){if((i&4194048)!==0){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,kn(t,i)}}var yc={readContext:Qt,use:mc,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et},w0={readContext:Qt,use:mc,useCallback:function(t,s){return cn().memoizedState=[t,s===void 0?null:s],t},useContext:Qt,useEffect:r0,useImperativeHandle:function(t,s,i){i=i!=null?i.concat([t]):null,gc(4194308,4,l0.bind(null,s,t),i)},useLayoutEffect:function(t,s){return gc(4194308,4,t,s)},useInsertionEffect:function(t,s){gc(4,2,t,s)},useMemo:function(t,s){var i=cn();s=s===void 0?null:s;var u=t();if(to){$e(!0);try{t()}finally{$e(!1)}}return i.memoizedState=[u,s],u},useReducer:function(t,s,i){var u=cn();if(i!==void 0){var p=i(s);if(to){$e(!0);try{i(s)}finally{$e(!1)}}}else p=s;return u.memoizedState=u.baseState=p,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:p},u.queue=t,t=t.dispatch=X_.bind(null,Qe,t),[u.memoizedState,t]},useRef:function(t){var s=cn();return t={current:t},s.memoizedState=t},useState:function(t){t=Gf(t);var s=t.queue,i=y0.bind(null,Qe,s);return s.dispatch=i,[t.memoizedState,i]},useDebugValue:Zf,useDeferredValue:function(t,s){var i=cn();return Wf(i,t,s)},useTransition:function(){var t=Gf(!1);return t=m0.bind(null,Qe,t.queue,!0,!1),cn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,s,i){var u=Qe,p=cn();if(ct){if(i===void 0)throw Error(a(407));i=i()}else{if(i=s(),yt===null)throw Error(a(349));(it&124)!==0||Bx(u,s,i)}p.memoizedState=i;var v={value:i,getSnapshot:s};return p.queue=v,r0(qx.bind(null,u,v,t),[t]),u.flags|=2048,Yo(9,pc(),Vx.bind(null,u,v,i,s),null),i},useId:function(){var t=cn(),s=yt.identifierPrefix;if(ct){var i=ks,u=Cs;i=(u&~(1<<32-Ge(u)-1)).toString(32)+i,s="«"+s+"R"+i,i=fc++,0<i&&(s+="H"+i.toString(32)),s+="»"}else i=B_++,s="«"+s+"r"+i.toString(32)+"»";return t.memoizedState=s},useHostTransitionStatus:Qf,useFormState:Jx,useActionState:Jx,useOptimistic:function(t){var s=cn();s.memoizedState=s.baseState=t;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=i,s=Jf.bind(null,Qe,!0,i),i.dispatch=s,[t,s]},useMemoCache:qf,useCacheRefresh:function(){return cn().memoizedState=G_.bind(null,Qe)}},N0={readContext:Qt,use:mc,useCallback:u0,useContext:Qt,useEffect:o0,useImperativeHandle:c0,useInsertionEffect:a0,useLayoutEffect:i0,useMemo:d0,useReducer:hc,useRef:s0,useState:function(){return hc(Ms)},useDebugValue:Zf,useDeferredValue:function(t,s){var i=Mt();return f0(i,ht.memoizedState,t,s)},useTransition:function(){var t=hc(Ms)[0],s=Mt().memoizedState;return[typeof t=="boolean"?t:vi(t),s]},useSyncExternalStore:Ux,useId:g0,useHostTransitionStatus:Qf,useFormState:e0,useActionState:e0,useOptimistic:function(t,s){var i=Mt();return Gx(i,ht,t,s)},useMemoCache:qf,useCacheRefresh:x0},Z_={readContext:Qt,use:mc,useCallback:u0,useContext:Qt,useEffect:o0,useImperativeHandle:c0,useInsertionEffect:a0,useLayoutEffect:i0,useMemo:d0,useReducer:Yf,useRef:s0,useState:function(){return Yf(Ms)},useDebugValue:Zf,useDeferredValue:function(t,s){var i=Mt();return ht===null?Wf(i,t,s):f0(i,ht.memoizedState,t,s)},useTransition:function(){var t=Yf(Ms)[0],s=Mt().memoizedState;return[typeof t=="boolean"?t:vi(t),s]},useSyncExternalStore:Ux,useId:g0,useHostTransitionStatus:Qf,useFormState:n0,useActionState:n0,useOptimistic:function(t,s){var i=Mt();return ht!==null?Gx(i,ht,t,s):(i.baseState=t,[t,i.queue.dispatch])},useMemoCache:qf,useCacheRefresh:x0},Go=null,Ni=0;function vc(t){var s=Ni;return Ni+=1,Go===null&&(Go=[]),Dx(Go,t,s)}function ji(t,s){s=s.props.ref,t.ref=s!==void 0?s:null}function bc(t,s){throw s.$$typeof===x?Error(a(525)):(t=Object.prototype.toString.call(s),Error(a(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t)))}function j0(t){var s=t._init;return s(t._payload)}function S0(t){function s(K,Z){if(t){var te=K.deletions;te===null?(K.deletions=[Z],K.flags|=16):te.push(Z)}}function i(K,Z){if(!t)return null;for(;Z!==null;)s(K,Z),Z=Z.sibling;return null}function u(K){for(var Z=new Map;K!==null;)K.key!==null?Z.set(K.key,K):Z.set(K.index,K),K=K.sibling;return Z}function p(K,Z){return K=Es(K,Z),K.index=0,K.sibling=null,K}function v(K,Z,te){return K.index=te,t?(te=K.alternate,te!==null?(te=te.index,te<Z?(K.flags|=67108866,Z):te):(K.flags|=67108866,Z)):(K.flags|=1048576,Z)}function k(K){return t&&K.alternate===null&&(K.flags|=67108866),K}function O(K,Z,te,de){return Z===null||Z.tag!==6?(Z=bf(te,K.mode,de),Z.return=K,Z):(Z=p(Z,te),Z.return=K,Z)}function F(K,Z,te,de){var Re=te.type;return Re===j?ue(K,Z,te.props.children,de,te.key):Z!==null&&(Z.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===H&&j0(Re)===Z.type)?(Z=p(Z,te.props),ji(Z,te),Z.return=K,Z):(Z=nc(te.type,te.key,te.props,null,K.mode,de),ji(Z,te),Z.return=K,Z)}function se(K,Z,te,de){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==te.containerInfo||Z.stateNode.implementation!==te.implementation?(Z=wf(te,K.mode,de),Z.return=K,Z):(Z=p(Z,te.children||[]),Z.return=K,Z)}function ue(K,Z,te,de,Re){return Z===null||Z.tag!==7?(Z=Gr(te,K.mode,de,Re),Z.return=K,Z):(Z=p(Z,te),Z.return=K,Z)}function he(K,Z,te){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Z=bf(""+Z,K.mode,te),Z.return=K,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case y:return te=nc(Z.type,Z.key,Z.props,null,K.mode,te),ji(te,Z),te.return=K,te;case b:return Z=wf(Z,K.mode,te),Z.return=K,Z;case H:var de=Z._init;return Z=de(Z._payload),he(K,Z,te)}if(U(Z)||G(Z))return Z=Gr(Z,K.mode,te,null),Z.return=K,Z;if(typeof Z.then=="function")return he(K,vc(Z),te);if(Z.$$typeof===E)return he(K,ac(K,Z),te);bc(K,Z)}return null}function oe(K,Z,te,de){var Re=Z!==null?Z.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return Re!==null?null:O(K,Z,""+te,de);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case y:return te.key===Re?F(K,Z,te,de):null;case b:return te.key===Re?se(K,Z,te,de):null;case H:return Re=te._init,te=Re(te._payload),oe(K,Z,te,de)}if(U(te)||G(te))return Re!==null?null:ue(K,Z,te,de,null);if(typeof te.then=="function")return oe(K,Z,vc(te),de);if(te.$$typeof===E)return oe(K,Z,ac(K,te),de);bc(K,te)}return null}function ae(K,Z,te,de,Re){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return K=K.get(te)||null,O(Z,K,""+de,Re);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case y:return K=K.get(de.key===null?te:de.key)||null,F(Z,K,de,Re);case b:return K=K.get(de.key===null?te:de.key)||null,se(Z,K,de,Re);case H:var et=de._init;return de=et(de._payload),ae(K,Z,te,de,Re)}if(U(de)||G(de))return K=K.get(te)||null,ue(Z,K,de,Re,null);if(typeof de.then=="function")return ae(K,Z,te,vc(de),Re);if(de.$$typeof===E)return ae(K,Z,te,ac(Z,de),Re);bc(Z,de)}return null}function Fe(K,Z,te,de){for(var Re=null,et=null,He=Z,qe=Z=0,Vt=null;He!==null&&qe<te.length;qe++){He.index>qe?(Vt=He,He=null):Vt=He.sibling;var lt=oe(K,He,te[qe],de);if(lt===null){He===null&&(He=Vt);break}t&&He&&lt.alternate===null&&s(K,He),Z=v(lt,Z,qe),et===null?Re=lt:et.sibling=lt,et=lt,He=Vt}if(qe===te.length)return i(K,He),ct&&Zr(K,qe),Re;if(He===null){for(;qe<te.length;qe++)He=he(K,te[qe],de),He!==null&&(Z=v(He,Z,qe),et===null?Re=He:et.sibling=He,et=He);return ct&&Zr(K,qe),Re}for(He=u(He);qe<te.length;qe++)Vt=ae(He,K,qe,te[qe],de),Vt!==null&&(t&&Vt.alternate!==null&&He.delete(Vt.key===null?qe:Vt.key),Z=v(Vt,Z,qe),et===null?Re=Vt:et.sibling=Vt,et=Vt);return t&&He.forEach(function(Nr){return s(K,Nr)}),ct&&Zr(K,qe),Re}function Ve(K,Z,te,de){if(te==null)throw Error(a(151));for(var Re=null,et=null,He=Z,qe=Z=0,Vt=null,lt=te.next();He!==null&&!lt.done;qe++,lt=te.next()){He.index>qe?(Vt=He,He=null):Vt=He.sibling;var Nr=oe(K,He,lt.value,de);if(Nr===null){He===null&&(He=Vt);break}t&&He&&Nr.alternate===null&&s(K,He),Z=v(Nr,Z,qe),et===null?Re=Nr:et.sibling=Nr,et=Nr,He=Vt}if(lt.done)return i(K,He),ct&&Zr(K,qe),Re;if(He===null){for(;!lt.done;qe++,lt=te.next())lt=he(K,lt.value,de),lt!==null&&(Z=v(lt,Z,qe),et===null?Re=lt:et.sibling=lt,et=lt);return ct&&Zr(K,qe),Re}for(He=u(He);!lt.done;qe++,lt=te.next())lt=ae(He,K,qe,lt.value,de),lt!==null&&(t&&lt.alternate!==null&&He.delete(lt.key===null?qe:lt.key),Z=v(lt,Z,qe),et===null?Re=lt:et.sibling=lt,et=lt);return t&&He.forEach(function(WE){return s(K,WE)}),ct&&Zr(K,qe),Re}function gt(K,Z,te,de){if(typeof te=="object"&&te!==null&&te.type===j&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case y:e:{for(var Re=te.key;Z!==null;){if(Z.key===Re){if(Re=te.type,Re===j){if(Z.tag===7){i(K,Z.sibling),de=p(Z,te.props.children),de.return=K,K=de;break e}}else if(Z.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===H&&j0(Re)===Z.type){i(K,Z.sibling),de=p(Z,te.props),ji(de,te),de.return=K,K=de;break e}i(K,Z);break}else s(K,Z);Z=Z.sibling}te.type===j?(de=Gr(te.props.children,K.mode,de,te.key),de.return=K,K=de):(de=nc(te.type,te.key,te.props,null,K.mode,de),ji(de,te),de.return=K,K=de)}return k(K);case b:e:{for(Re=te.key;Z!==null;){if(Z.key===Re)if(Z.tag===4&&Z.stateNode.containerInfo===te.containerInfo&&Z.stateNode.implementation===te.implementation){i(K,Z.sibling),de=p(Z,te.children||[]),de.return=K,K=de;break e}else{i(K,Z);break}else s(K,Z);Z=Z.sibling}de=wf(te,K.mode,de),de.return=K,K=de}return k(K);case H:return Re=te._init,te=Re(te._payload),gt(K,Z,te,de)}if(U(te))return Fe(K,Z,te,de);if(G(te)){if(Re=G(te),typeof Re!="function")throw Error(a(150));return te=Re.call(te),Ve(K,Z,te,de)}if(typeof te.then=="function")return gt(K,Z,vc(te),de);if(te.$$typeof===E)return gt(K,Z,ac(K,te),de);bc(K,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,Z!==null&&Z.tag===6?(i(K,Z.sibling),de=p(Z,te),de.return=K,K=de):(i(K,Z),de=bf(te,K.mode,de),de.return=K,K=de),k(K)):i(K,Z)}return function(K,Z,te,de){try{Ni=0;var Re=gt(K,Z,te,de);return Go=null,Re}catch(He){if(He===mi||He===lc)throw He;var et=pn(29,He,null,K.mode);return et.lanes=de,et.return=K,et}finally{}}}var Xo=S0(!0),_0=S0(!1),Dn=$(null),ns=null;function ir(t){var s=t.alternate;V(It,It.current&1),V(Dn,t),ns===null&&(s===null||Vo.current!==null||s.memoizedState!==null)&&(ns=t)}function E0(t){if(t.tag===22){if(V(It,It.current),V(Dn,t),ns===null){var s=t.alternate;s!==null&&s.memoizedState!==null&&(ns=t)}}else lr()}function lr(){V(It,It.current),V(Dn,Dn.current)}function Rs(t){Y(Dn),ns===t&&(ns=null),Y(It)}var It=$(0);function wc(t){for(var s=t;s!==null;){if(s.tag===13){var i=s.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||Vm(i)))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}function em(t,s,i,u){s=t.memoizedState,i=i(u,s),i=i==null?s:g({},s,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var tm={enqueueSetState:function(t,s,i){t=t._reactInternals;var u=vn(),p=rr(u);p.payload=s,i!=null&&(p.callback=i),s=or(t,p,u),s!==null&&(bn(s,t,u),pi(s,t,u))},enqueueReplaceState:function(t,s,i){t=t._reactInternals;var u=vn(),p=rr(u);p.tag=1,p.payload=s,i!=null&&(p.callback=i),s=or(t,p,u),s!==null&&(bn(s,t,u),pi(s,t,u))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var i=vn(),u=rr(i);u.tag=2,s!=null&&(u.callback=s),s=or(t,u,i),s!==null&&(bn(s,t,i),pi(s,t,i))}};function C0(t,s,i,u,p,v,k){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,v,k):s.prototype&&s.prototype.isPureReactComponent?!oi(i,u)||!oi(p,v):!0}function k0(t,s,i,u){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(i,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(i,u),s.state!==t&&tm.enqueueReplaceState(s,s.state,null)}function no(t,s){var i=s;if("ref"in s){i={};for(var u in s)u!=="ref"&&(i[u]=s[u])}if(t=t.defaultProps){i===s&&(i=g({},i));for(var p in t)i[p]===void 0&&(i[p]=t[p])}return i}var Nc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)};function T0(t){Nc(t)}function A0(t){console.error(t)}function M0(t){Nc(t)}function jc(t,s){try{var i=t.onUncaughtError;i(s.value,{componentStack:s.stack})}catch(u){setTimeout(function(){throw u})}}function R0(t,s,i){try{var u=t.onCaughtError;u(i.value,{componentStack:i.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function nm(t,s,i){return i=rr(i),i.tag=3,i.payload={element:null},i.callback=function(){jc(t,s)},i}function D0(t){return t=rr(t),t.tag=3,t}function O0(t,s,i,u){var p=i.type.getDerivedStateFromError;if(typeof p=="function"){var v=u.value;t.payload=function(){return p(v)},t.callback=function(){R0(s,i,u)}}var k=i.stateNode;k!==null&&typeof k.componentDidCatch=="function"&&(t.callback=function(){R0(s,i,u),typeof p!="function"&&(hr===null?hr=new Set([this]):hr.add(this));var O=u.stack;this.componentDidCatch(u.value,{componentStack:O!==null?O:""})})}function W_(t,s,i,u,p){if(i.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(s=i.alternate,s!==null&&ui(s,i,p,!0),i=Dn.current,i!==null){switch(i.tag){case 13:return ns===null?Em():i.alternate===null&&St===0&&(St=3),i.flags&=-257,i.flags|=65536,i.lanes=p,u===Mf?i.flags|=16384:(s=i.updateQueue,s===null?i.updateQueue=new Set([u]):s.add(u),km(t,u,p)),!1;case 22:return i.flags|=65536,u===Mf?i.flags|=16384:(s=i.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([u])},i.updateQueue=s):(i=s.retryQueue,i===null?s.retryQueue=new Set([u]):i.add(u)),km(t,u,p)),!1}throw Error(a(435,i.tag))}return km(t,u,p),Em(),!1}if(ct)return s=Dn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=p,u!==Sf&&(t=Error(a(422),{cause:u}),ci(Tn(t,i)))):(u!==Sf&&(s=Error(a(423),{cause:u}),ci(Tn(s,i))),t=t.current.alternate,t.flags|=65536,p&=-p,t.lanes|=p,u=Tn(u,i),p=nm(t.stateNode,u,p),Of(t,p),St!==4&&(St=2)),!1;var v=Error(a(520),{cause:u});if(v=Tn(v,i),Ai===null?Ai=[v]:Ai.push(v),St!==4&&(St=2),s===null)return!0;u=Tn(u,i),i=s;do{switch(i.tag){case 3:return i.flags|=65536,t=p&-p,i.lanes|=t,t=nm(i.stateNode,u,t),Of(i,t),!1;case 1:if(s=i.type,v=i.stateNode,(i.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(hr===null||!hr.has(v))))return i.flags|=65536,p&=-p,i.lanes|=p,p=D0(p),O0(p,t,i,u),Of(i,p),!1}i=i.return}while(i!==null);return!1}var z0=Error(a(461)),Ut=!1;function Yt(t,s,i,u){s.child=t===null?_0(s,null,i,u):Xo(s,t.child,i,u)}function I0(t,s,i,u,p){i=i.render;var v=s.ref;if("ref"in u){var k={};for(var O in u)O!=="ref"&&(k[O]=u[O])}else k=u;return Jr(s),u=Pf(t,s,i,k,v,p),O=Hf(),t!==null&&!Ut?(Uf(t,s,p),Ds(t,s,p)):(ct&&O&&Nf(s),s.flags|=1,Yt(t,s,u,p),s.child)}function L0(t,s,i,u,p){if(t===null){var v=i.type;return typeof v=="function"&&!vf(v)&&v.defaultProps===void 0&&i.compare===null?(s.tag=15,s.type=v,$0(t,s,v,u,p)):(t=nc(i.type,null,u,s,s.mode,p),t.ref=s.ref,t.return=s,s.child=t)}if(v=t.child,!um(t,p)){var k=v.memoizedProps;if(i=i.compare,i=i!==null?i:oi,i(k,u)&&t.ref===s.ref)return Ds(t,s,p)}return s.flags|=1,t=Es(v,u),t.ref=s.ref,t.return=s,s.child=t}function $0(t,s,i,u,p){if(t!==null){var v=t.memoizedProps;if(oi(v,u)&&t.ref===s.ref)if(Ut=!1,s.pendingProps=u=v,um(t,p))(t.flags&131072)!==0&&(Ut=!0);else return s.lanes=t.lanes,Ds(t,s,p)}return sm(t,s,i,u,p)}function P0(t,s,i){var u=s.pendingProps,p=u.children,v=t!==null?t.memoizedState:null;if(u.mode==="hidden"){if((s.flags&128)!==0){if(u=v!==null?v.baseLanes|i:i,t!==null){for(p=s.child=t.child,v=0;p!==null;)v=v|p.lanes|p.childLanes,p=p.sibling;s.childLanes=v&~u}else s.childLanes=0,s.child=null;return H0(t,s,u,i)}if((i&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},t!==null&&ic(s,v!==null?v.cachePool:null),v!==null?$x(s,v):If(),E0(s);else return s.lanes=s.childLanes=536870912,H0(t,s,v!==null?v.baseLanes|i:i,i)}else v!==null?(ic(s,v.cachePool),$x(s,v),lr(),s.memoizedState=null):(t!==null&&ic(s,null),If(),lr());return Yt(t,s,p,i),s.child}function H0(t,s,i,u){var p=Af();return p=p===null?null:{parent:zt._currentValue,pool:p},s.memoizedState={baseLanes:i,cachePool:p},t!==null&&ic(s,null),If(),E0(s),t!==null&&ui(t,s,u,!0),null}function Sc(t,s){var i=s.ref;if(i===null)t!==null&&t.ref!==null&&(s.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(t===null||t.ref!==i)&&(s.flags|=4194816)}}function sm(t,s,i,u,p){return Jr(s),i=Pf(t,s,i,u,void 0,p),u=Hf(),t!==null&&!Ut?(Uf(t,s,p),Ds(t,s,p)):(ct&&u&&Nf(s),s.flags|=1,Yt(t,s,i,p),s.child)}function U0(t,s,i,u,p,v){return Jr(s),s.updateQueue=null,i=Hx(s,u,i,p),Px(t),u=Hf(),t!==null&&!Ut?(Uf(t,s,v),Ds(t,s,v)):(ct&&u&&Nf(s),s.flags|=1,Yt(t,s,i,v),s.child)}function B0(t,s,i,u,p){if(Jr(s),s.stateNode===null){var v=$o,k=i.contextType;typeof k=="object"&&k!==null&&(v=Qt(k)),v=new i(u,v),s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=tm,s.stateNode=v,v._reactInternals=s,v=s.stateNode,v.props=u,v.state=s.memoizedState,v.refs={},Rf(s),k=i.contextType,v.context=typeof k=="object"&&k!==null?Qt(k):$o,v.state=s.memoizedState,k=i.getDerivedStateFromProps,typeof k=="function"&&(em(s,i,k,u),v.state=s.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(k=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),k!==v.state&&tm.enqueueReplaceState(v,v.state,null),xi(s,u,v,p),gi(),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308),u=!0}else if(t===null){v=s.stateNode;var O=s.memoizedProps,F=no(i,O);v.props=F;var se=v.context,ue=i.contextType;k=$o,typeof ue=="object"&&ue!==null&&(k=Qt(ue));var he=i.getDerivedStateFromProps;ue=typeof he=="function"||typeof v.getSnapshotBeforeUpdate=="function",O=s.pendingProps!==O,ue||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(O||se!==k)&&k0(s,v,u,k),sr=!1;var oe=s.memoizedState;v.state=oe,xi(s,u,v,p),gi(),se=s.memoizedState,O||oe!==se||sr?(typeof he=="function"&&(em(s,i,he,u),se=s.memoizedState),(F=sr||C0(s,i,F,u,oe,se,k))?(ue||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(s.flags|=4194308)):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=u,s.memoizedState=se),v.props=u,v.state=se,v.context=k,u=F):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{v=s.stateNode,Df(t,s),k=s.memoizedProps,ue=no(i,k),v.props=ue,he=s.pendingProps,oe=v.context,se=i.contextType,F=$o,typeof se=="object"&&se!==null&&(F=Qt(se)),O=i.getDerivedStateFromProps,(se=typeof O=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(k!==he||oe!==F)&&k0(s,v,u,F),sr=!1,oe=s.memoizedState,v.state=oe,xi(s,u,v,p),gi();var ae=s.memoizedState;k!==he||oe!==ae||sr||t!==null&&t.dependencies!==null&&oc(t.dependencies)?(typeof O=="function"&&(em(s,i,O,u),ae=s.memoizedState),(ue=sr||C0(s,i,ue,u,oe,ae,F)||t!==null&&t.dependencies!==null&&oc(t.dependencies))?(se||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(u,ae,F),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(u,ae,F)),typeof v.componentDidUpdate=="function"&&(s.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof v.componentDidUpdate!="function"||k===t.memoizedProps&&oe===t.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||k===t.memoizedProps&&oe===t.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=ae),v.props=u,v.state=ae,v.context=F,u=ue):(typeof v.componentDidUpdate!="function"||k===t.memoizedProps&&oe===t.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||k===t.memoizedProps&&oe===t.memoizedState||(s.flags|=1024),u=!1)}return v=u,Sc(t,s),u=(s.flags&128)!==0,v||u?(v=s.stateNode,i=u&&typeof i.getDerivedStateFromError!="function"?null:v.render(),s.flags|=1,t!==null&&u?(s.child=Xo(s,t.child,null,p),s.child=Xo(s,null,i,p)):Yt(t,s,i,p),s.memoizedState=v.state,t=s.child):t=Ds(t,s,p),t}function V0(t,s,i,u){return li(),s.flags|=256,Yt(t,s,i,u),s.child}var rm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function om(t){return{baseLanes:t,cachePool:Ax()}}function am(t,s,i){return t=t!==null?t.childLanes&~i:0,s&&(t|=On),t}function q0(t,s,i){var u=s.pendingProps,p=!1,v=(s.flags&128)!==0,k;if((k=v)||(k=t!==null&&t.memoizedState===null?!1:(It.current&2)!==0),k&&(p=!0,s.flags&=-129),k=(s.flags&32)!==0,s.flags&=-33,t===null){if(ct){if(p?ir(s):lr(),ct){var O=jt,F;if(F=O){e:{for(F=O,O=ts;F.nodeType!==8;){if(!O){O=null;break e}if(F=Vn(F.nextSibling),F===null){O=null;break e}}O=F}O!==null?(s.memoizedState={dehydrated:O,treeContext:Xr!==null?{id:Cs,overflow:ks}:null,retryLane:536870912,hydrationErrors:null},F=pn(18,null,null,0),F.stateNode=O,F.return=s,s.child=F,tn=s,jt=null,F=!0):F=!1}F||Kr(s)}if(O=s.memoizedState,O!==null&&(O=O.dehydrated,O!==null))return Vm(O)?s.lanes=32:s.lanes=536870912,null;Rs(s)}return O=u.children,u=u.fallback,p?(lr(),p=s.mode,O=_c({mode:"hidden",children:O},p),u=Gr(u,p,i,null),O.return=s,u.return=s,O.sibling=u,s.child=O,p=s.child,p.memoizedState=om(i),p.childLanes=am(t,k,i),s.memoizedState=rm,u):(ir(s),im(s,O))}if(F=t.memoizedState,F!==null&&(O=F.dehydrated,O!==null)){if(v)s.flags&256?(ir(s),s.flags&=-257,s=lm(t,s,i)):s.memoizedState!==null?(lr(),s.child=t.child,s.flags|=128,s=null):(lr(),p=u.fallback,O=s.mode,u=_c({mode:"visible",children:u.children},O),p=Gr(p,O,i,null),p.flags|=2,u.return=s,p.return=s,u.sibling=p,s.child=u,Xo(s,t.child,null,i),u=s.child,u.memoizedState=om(i),u.childLanes=am(t,k,i),s.memoizedState=rm,s=p);else if(ir(s),Vm(O)){if(k=O.nextSibling&&O.nextSibling.dataset,k)var se=k.dgst;k=se,u=Error(a(419)),u.stack="",u.digest=k,ci({value:u,source:null,stack:null}),s=lm(t,s,i)}else if(Ut||ui(t,s,i,!1),k=(i&t.childLanes)!==0,Ut||k){if(k=yt,k!==null&&(u=i&-i,u=(u&42)!==0?1:mn(u),u=(u&(k.suspendedLanes|i))!==0?0:u,u!==0&&u!==F.retryLane))throw F.retryLane=u,Lo(t,u),bn(k,t,u),z0;O.data==="$?"||Em(),s=lm(t,s,i)}else O.data==="$?"?(s.flags|=192,s.child=t.child,s=null):(t=F.treeContext,jt=Vn(O.nextSibling),tn=s,ct=!0,Wr=null,ts=!1,t!==null&&(Mn[Rn++]=Cs,Mn[Rn++]=ks,Mn[Rn++]=Xr,Cs=t.id,ks=t.overflow,Xr=s),s=im(s,u.children),s.flags|=4096);return s}return p?(lr(),p=u.fallback,O=s.mode,F=t.child,se=F.sibling,u=Es(F,{mode:"hidden",children:u.children}),u.subtreeFlags=F.subtreeFlags&65011712,se!==null?p=Es(se,p):(p=Gr(p,O,i,null),p.flags|=2),p.return=s,u.return=s,u.sibling=p,s.child=u,u=p,p=s.child,O=t.child.memoizedState,O===null?O=om(i):(F=O.cachePool,F!==null?(se=zt._currentValue,F=F.parent!==se?{parent:se,pool:se}:F):F=Ax(),O={baseLanes:O.baseLanes|i,cachePool:F}),p.memoizedState=O,p.childLanes=am(t,k,i),s.memoizedState=rm,u):(ir(s),i=t.child,t=i.sibling,i=Es(i,{mode:"visible",children:u.children}),i.return=s,i.sibling=null,t!==null&&(k=s.deletions,k===null?(s.deletions=[t],s.flags|=16):k.push(t)),s.child=i,s.memoizedState=null,i)}function im(t,s){return s=_c({mode:"visible",children:s},t.mode),s.return=t,t.child=s}function _c(t,s){return t=pn(22,t,null,s),t.lanes=0,t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},t}function lm(t,s,i){return Xo(s,t.child,null,i),t=im(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function F0(t,s,i){t.lanes|=s;var u=t.alternate;u!==null&&(u.lanes|=s),Ef(t.return,s,i)}function cm(t,s,i,u,p){var v=t.memoizedState;v===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:p}:(v.isBackwards=s,v.rendering=null,v.renderingStartTime=0,v.last=u,v.tail=i,v.tailMode=p)}function Y0(t,s,i){var u=s.pendingProps,p=u.revealOrder,v=u.tail;if(Yt(t,s,u.children,i),u=It.current,(u&2)!==0)u=u&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&F0(t,i,s);else if(t.tag===19)F0(t,i,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}u&=1}switch(V(It,u),p){case"forwards":for(i=s.child,p=null;i!==null;)t=i.alternate,t!==null&&wc(t)===null&&(p=i),i=i.sibling;i=p,i===null?(p=s.child,s.child=null):(p=i.sibling,i.sibling=null),cm(s,!1,p,i,v);break;case"backwards":for(i=null,p=s.child,s.child=null;p!==null;){if(t=p.alternate,t!==null&&wc(t)===null){s.child=p;break}t=p.sibling,p.sibling=i,i=p,p=t}cm(s,!0,i,null,v);break;case"together":cm(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Ds(t,s,i){if(t!==null&&(s.dependencies=t.dependencies),mr|=s.lanes,(i&s.childLanes)===0)if(t!==null){if(ui(t,s,i,!1),(i&s.childLanes)===0)return null}else return null;if(t!==null&&s.child!==t.child)throw Error(a(153));if(s.child!==null){for(t=s.child,i=Es(t,t.pendingProps),s.child=i,i.return=s;t.sibling!==null;)t=t.sibling,i=i.sibling=Es(t,t.pendingProps),i.return=s;i.sibling=null}return s.child}function um(t,s){return(t.lanes&s)!==0?!0:(t=t.dependencies,!!(t!==null&&oc(t)))}function K_(t,s,i){switch(s.tag){case 3:ie(s,s.stateNode.containerInfo),nr(s,zt,t.memoizedState.cache),li();break;case 27:case 5:Ee(s);break;case 4:ie(s,s.stateNode.containerInfo);break;case 10:nr(s,s.type,s.memoizedProps.value);break;case 13:var u=s.memoizedState;if(u!==null)return u.dehydrated!==null?(ir(s),s.flags|=128,null):(i&s.child.childLanes)!==0?q0(t,s,i):(ir(s),t=Ds(t,s,i),t!==null?t.sibling:null);ir(s);break;case 19:var p=(t.flags&128)!==0;if(u=(i&s.childLanes)!==0,u||(ui(t,s,i,!1),u=(i&s.childLanes)!==0),p){if(u)return Y0(t,s,i);s.flags|=128}if(p=s.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),V(It,It.current),u)break;return null;case 22:case 23:return s.lanes=0,P0(t,s,i);case 24:nr(s,zt,t.memoizedState.cache)}return Ds(t,s,i)}function G0(t,s,i){if(t!==null)if(t.memoizedProps!==s.pendingProps)Ut=!0;else{if(!um(t,i)&&(s.flags&128)===0)return Ut=!1,K_(t,s,i);Ut=(t.flags&131072)!==0}else Ut=!1,ct&&(s.flags&1048576)!==0&&jx(s,rc,s.index);switch(s.lanes=0,s.tag){case 16:e:{t=s.pendingProps;var u=s.elementType,p=u._init;if(u=p(u._payload),s.type=u,typeof u=="function")vf(u)?(t=no(u,t),s.tag=1,s=B0(null,s,u,t,i)):(s.tag=0,s=sm(null,s,u,t,i));else{if(u!=null){if(p=u.$$typeof,p===M){s.tag=11,s=I0(null,s,u,t,i);break e}else if(p===z){s.tag=14,s=L0(null,s,u,t,i);break e}}throw s=B(u)||u,Error(a(306,s,""))}}return s;case 0:return sm(t,s,s.type,s.pendingProps,i);case 1:return u=s.type,p=no(u,s.pendingProps),B0(t,s,u,p,i);case 3:e:{if(ie(s,s.stateNode.containerInfo),t===null)throw Error(a(387));u=s.pendingProps;var v=s.memoizedState;p=v.element,Df(t,s),xi(s,u,null,i);var k=s.memoizedState;if(u=k.cache,nr(s,zt,u),u!==v.cache&&Cf(s,[zt],i,!0),gi(),u=k.element,v.isDehydrated)if(v={element:u,isDehydrated:!1,cache:k.cache},s.updateQueue.baseState=v,s.memoizedState=v,s.flags&256){s=V0(t,s,u,i);break e}else if(u!==p){p=Tn(Error(a(424)),s),ci(p),s=V0(t,s,u,i);break e}else{switch(t=s.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(jt=Vn(t.firstChild),tn=s,ct=!0,Wr=null,ts=!0,i=_0(s,null,u,i),s.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(li(),u===p){s=Ds(t,s,i);break e}Yt(t,s,u,i)}s=s.child}return s;case 26:return Sc(t,s),t===null?(i=Ky(s.type,null,s.pendingProps,null))?s.memoizedState=i:ct||(i=s.type,t=s.pendingProps,u=Pc(fe.current).createElement(i),u[Ht]=s,u[Kt]=t,Xt(u,i,t),Tt(u),s.stateNode=u):s.memoizedState=Ky(s.type,t.memoizedProps,s.pendingProps,t.memoizedState),null;case 27:return Ee(s),t===null&&ct&&(u=s.stateNode=Xy(s.type,s.pendingProps,fe.current),tn=s,ts=!0,p=jt,xr(s.type)?(qm=p,jt=Vn(u.firstChild)):jt=p),Yt(t,s,s.pendingProps.children,i),Sc(t,s),t===null&&(s.flags|=4194304),s.child;case 5:return t===null&&ct&&((p=u=jt)&&(u=_E(u,s.type,s.pendingProps,ts),u!==null?(s.stateNode=u,tn=s,jt=Vn(u.firstChild),ts=!1,p=!0):p=!1),p||Kr(s)),Ee(s),p=s.type,v=s.pendingProps,k=t!==null?t.memoizedProps:null,u=v.children,Hm(p,v)?u=null:k!==null&&Hm(p,k)&&(s.flags|=32),s.memoizedState!==null&&(p=Pf(t,s,V_,null,null,i),Pi._currentValue=p),Sc(t,s),Yt(t,s,u,i),s.child;case 6:return t===null&&ct&&((t=i=jt)&&(i=EE(i,s.pendingProps,ts),i!==null?(s.stateNode=i,tn=s,jt=null,t=!0):t=!1),t||Kr(s)),null;case 13:return q0(t,s,i);case 4:return ie(s,s.stateNode.containerInfo),u=s.pendingProps,t===null?s.child=Xo(s,null,u,i):Yt(t,s,u,i),s.child;case 11:return I0(t,s,s.type,s.pendingProps,i);case 7:return Yt(t,s,s.pendingProps,i),s.child;case 8:return Yt(t,s,s.pendingProps.children,i),s.child;case 12:return Yt(t,s,s.pendingProps.children,i),s.child;case 10:return u=s.pendingProps,nr(s,s.type,u.value),Yt(t,s,u.children,i),s.child;case 9:return p=s.type._context,u=s.pendingProps.children,Jr(s),p=Qt(p),u=u(p),s.flags|=1,Yt(t,s,u,i),s.child;case 14:return L0(t,s,s.type,s.pendingProps,i);case 15:return $0(t,s,s.type,s.pendingProps,i);case 19:return Y0(t,s,i);case 31:return u=s.pendingProps,i=s.mode,u={mode:u.mode,children:u.children},t===null?(i=_c(u,i),i.ref=s.ref,s.child=i,i.return=s,s=i):(i=Es(t.child,u),i.ref=s.ref,s.child=i,i.return=s,s=i),s;case 22:return P0(t,s,i);case 24:return Jr(s),u=Qt(zt),t===null?(p=Af(),p===null&&(p=yt,v=kf(),p.pooledCache=v,v.refCount++,v!==null&&(p.pooledCacheLanes|=i),p=v),s.memoizedState={parent:u,cache:p},Rf(s),nr(s,zt,p)):((t.lanes&i)!==0&&(Df(t,s),xi(s,null,null,i),gi()),p=t.memoizedState,v=s.memoizedState,p.parent!==u?(p={parent:u,cache:u},s.memoizedState=p,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=p),nr(s,zt,u)):(u=v.cache,nr(s,zt,u),u!==p.cache&&Cf(s,[zt],i,!0))),Yt(t,s,s.pendingProps.children,i),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function Os(t){t.flags|=4}function X0(t,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!nv(s)){if(s=Dn.current,s!==null&&((it&4194048)===it?ns!==null:(it&62914560)!==it&&(it&536870912)===0||s!==ns))throw hi=Mf,Mx;t.flags|=8192}}function Ec(t,s){s!==null&&(t.flags|=4),t.flags&16384&&(s=t.tag!==22?Pe():536870912,t.lanes|=s,Qo|=s)}function Si(t,s){if(!ct)switch(t.tailMode){case"hidden":s=t.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function Nt(t){var s=t.alternate!==null&&t.alternate.child===t.child,i=0,u=0;if(s)for(var p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags&65011712,u|=p.flags&65011712,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=u,t.childLanes=i,s}function Q_(t,s,i){var u=s.pendingProps;switch(jf(s),s.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nt(s),null;case 1:return Nt(s),null;case 3:return i=s.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),s.memoizedState.cache!==u&&(s.flags|=2048),As(zt),ge(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(t===null||t.child===null)&&(ii(s)?Os(s):t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Ex())),Nt(s),null;case 26:return i=s.memoizedState,t===null?(Os(s),i!==null?(Nt(s),X0(s,i)):(Nt(s),s.flags&=-16777217)):i?i!==t.memoizedState?(Os(s),Nt(s),X0(s,i)):(Nt(s),s.flags&=-16777217):(t.memoizedProps!==u&&Os(s),Nt(s),s.flags&=-16777217),null;case 27:Ne(s),i=fe.current;var p=s.type;if(t!==null&&s.stateNode!=null)t.memoizedProps!==u&&Os(s);else{if(!u){if(s.stateNode===null)throw Error(a(166));return Nt(s),null}t=J.current,ii(s)?Sx(s):(t=Xy(p,u,i),s.stateNode=t,Os(s))}return Nt(s),null;case 5:if(Ne(s),i=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==u&&Os(s);else{if(!u){if(s.stateNode===null)throw Error(a(166));return Nt(s),null}if(t=J.current,ii(s))Sx(s);else{switch(p=Pc(fe.current),t){case 1:t=p.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:t=p.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":t=p.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":t=p.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":t=p.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild);break;case"select":t=typeof u.is=="string"?p.createElement("select",{is:u.is}):p.createElement("select"),u.multiple?t.multiple=!0:u.size&&(t.size=u.size);break;default:t=typeof u.is=="string"?p.createElement(i,{is:u.is}):p.createElement(i)}}t[Ht]=s,t[Kt]=u;e:for(p=s.child;p!==null;){if(p.tag===5||p.tag===6)t.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===s)break e;for(;p.sibling===null;){if(p.return===null||p.return===s)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}s.stateNode=t;e:switch(Xt(t,i,u),i){case"button":case"input":case"select":case"textarea":t=!!u.autoFocus;break e;case"img":t=!0;break e;default:t=!1}t&&Os(s)}}return Nt(s),s.flags&=-16777217,null;case 6:if(t&&s.stateNode!=null)t.memoizedProps!==u&&Os(s);else{if(typeof u!="string"&&s.stateNode===null)throw Error(a(166));if(t=fe.current,ii(s)){if(t=s.stateNode,i=s.memoizedProps,u=null,p=tn,p!==null)switch(p.tag){case 27:case 5:u=p.memoizedProps}t[Ht]=s,t=!!(t.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||Uy(t.nodeValue,i)),t||Kr(s)}else t=Pc(t).createTextNode(u),t[Ht]=s,s.stateNode=t}return Nt(s),null;case 13:if(u=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(p=ii(s),u!==null&&u.dehydrated!==null){if(t===null){if(!p)throw Error(a(318));if(p=s.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(a(317));p[Ht]=s}else li(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Nt(s),p=!1}else p=Ex(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=p),p=!0;if(!p)return s.flags&256?(Rs(s),s):(Rs(s),null)}if(Rs(s),(s.flags&128)!==0)return s.lanes=i,s;if(i=u!==null,t=t!==null&&t.memoizedState!==null,i){u=s.child,p=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(p=u.alternate.memoizedState.cachePool.pool);var v=null;u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(v=u.memoizedState.cachePool.pool),v!==p&&(u.flags|=2048)}return i!==t&&i&&(s.child.flags|=8192),Ec(s,s.updateQueue),Nt(s),null;case 4:return ge(),t===null&&zm(s.stateNode.containerInfo),Nt(s),null;case 10:return As(s.type),Nt(s),null;case 19:if(Y(It),p=s.memoizedState,p===null)return Nt(s),null;if(u=(s.flags&128)!==0,v=p.rendering,v===null)if(u)Si(p,!1);else{if(St!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(v=wc(t),v!==null){for(s.flags|=128,Si(p,!1),t=v.updateQueue,s.updateQueue=t,Ec(s,t),s.subtreeFlags=0,t=i,i=s.child;i!==null;)Nx(i,t),i=i.sibling;return V(It,It.current&1|2),s.child}t=t.sibling}p.tail!==null&&be()>Tc&&(s.flags|=128,u=!0,Si(p,!1),s.lanes=4194304)}else{if(!u)if(t=wc(v),t!==null){if(s.flags|=128,u=!0,t=t.updateQueue,s.updateQueue=t,Ec(s,t),Si(p,!0),p.tail===null&&p.tailMode==="hidden"&&!v.alternate&&!ct)return Nt(s),null}else 2*be()-p.renderingStartTime>Tc&&i!==536870912&&(s.flags|=128,u=!0,Si(p,!1),s.lanes=4194304);p.isBackwards?(v.sibling=s.child,s.child=v):(t=p.last,t!==null?t.sibling=v:s.child=v,p.last=v)}return p.tail!==null?(s=p.tail,p.rendering=s,p.tail=s.sibling,p.renderingStartTime=be(),s.sibling=null,t=It.current,V(It,u?t&1|2:t&1),s):(Nt(s),null);case 22:case 23:return Rs(s),Lf(),u=s.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(s.flags|=8192):u&&(s.flags|=8192),u?(i&536870912)!==0&&(s.flags&128)===0&&(Nt(s),s.subtreeFlags&6&&(s.flags|=8192)):Nt(s),i=s.updateQueue,i!==null&&Ec(s,i.retryQueue),i=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==i&&(s.flags|=2048),t!==null&&Y(eo),null;case 24:return i=null,t!==null&&(i=t.memoizedState.cache),s.memoizedState.cache!==i&&(s.flags|=2048),As(zt),Nt(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function J_(t,s){switch(jf(s),s.tag){case 1:return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return As(zt),ge(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 26:case 27:case 5:return Ne(s),null;case 13:if(Rs(s),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(a(340));li()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return Y(It),null;case 4:return ge(),null;case 10:return As(s.type),null;case 22:case 23:return Rs(s),Lf(),t!==null&&Y(eo),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 24:return As(zt),null;case 25:return null;default:return null}}function Z0(t,s){switch(jf(s),s.tag){case 3:As(zt),ge();break;case 26:case 27:case 5:Ne(s);break;case 4:ge();break;case 13:Rs(s);break;case 19:Y(It);break;case 10:As(s.type);break;case 22:case 23:Rs(s),Lf(),t!==null&&Y(eo);break;case 24:As(zt)}}function _i(t,s){try{var i=s.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var p=u.next;i=p;do{if((i.tag&t)===t){u=void 0;var v=i.create,k=i.inst;u=v(),k.destroy=u}i=i.next}while(i!==p)}}catch(O){xt(s,s.return,O)}}function cr(t,s,i){try{var u=s.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var v=p.next;u=v;do{if((u.tag&t)===t){var k=u.inst,O=k.destroy;if(O!==void 0){k.destroy=void 0,p=s;var F=i,se=O;try{se()}catch(ue){xt(p,F,ue)}}}u=u.next}while(u!==v)}}catch(ue){xt(s,s.return,ue)}}function W0(t){var s=t.updateQueue;if(s!==null){var i=t.stateNode;try{Lx(s,i)}catch(u){xt(t,t.return,u)}}}function K0(t,s,i){i.props=no(t.type,t.memoizedProps),i.state=t.memoizedState;try{i.componentWillUnmount()}catch(u){xt(t,s,u)}}function Ei(t,s){try{var i=t.ref;if(i!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof i=="function"?t.refCleanup=i(u):i.current=u}}catch(p){xt(t,s,p)}}function ss(t,s){var i=t.ref,u=t.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(p){xt(t,s,p)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(p){xt(t,s,p)}else i.current=null}function Q0(t){var s=t.type,i=t.memoizedProps,u=t.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":i.autoFocus&&u.focus();break e;case"img":i.src?u.src=i.src:i.srcSet&&(u.srcset=i.srcSet)}}catch(p){xt(t,t.return,p)}}function dm(t,s,i){try{var u=t.stateNode;bE(u,t.type,i,s),u[Kt]=s}catch(p){xt(t,t.return,p)}}function J0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&xr(t.type)||t.tag===4}function fm(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||J0(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&xr(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function mm(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(t,s):(s=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,s.appendChild(t),i=i._reactRootContainer,i!=null||s.onclick!==null||(s.onclick=$c));else if(u!==4&&(u===27&&xr(t.type)&&(i=t.stateNode,s=null),t=t.child,t!==null))for(mm(t,s,i),t=t.sibling;t!==null;)mm(t,s,i),t=t.sibling}function Cc(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?i.insertBefore(t,s):i.appendChild(t);else if(u!==4&&(u===27&&xr(t.type)&&(i=t.stateNode),t=t.child,t!==null))for(Cc(t,s,i),t=t.sibling;t!==null;)Cc(t,s,i),t=t.sibling}function ey(t){var s=t.stateNode,i=t.memoizedProps;try{for(var u=t.type,p=s.attributes;p.length;)s.removeAttributeNode(p[0]);Xt(s,u,i),s[Ht]=t,s[Kt]=i}catch(v){xt(t,t.return,v)}}var zs=!1,Ct=!1,hm=!1,ty=typeof WeakSet=="function"?WeakSet:Set,Bt=null;function eE(t,s){if(t=t.containerInfo,$m=Fc,t=fx(t),ff(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var p=u.anchorOffset,v=u.focusNode;u=u.focusOffset;try{i.nodeType,v.nodeType}catch{i=null;break e}var k=0,O=-1,F=-1,se=0,ue=0,he=t,oe=null;t:for(;;){for(var ae;he!==i||p!==0&&he.nodeType!==3||(O=k+p),he!==v||u!==0&&he.nodeType!==3||(F=k+u),he.nodeType===3&&(k+=he.nodeValue.length),(ae=he.firstChild)!==null;)oe=he,he=ae;for(;;){if(he===t)break t;if(oe===i&&++se===p&&(O=k),oe===v&&++ue===u&&(F=k),(ae=he.nextSibling)!==null)break;he=oe,oe=he.parentNode}he=ae}i=O===-1||F===-1?null:{start:O,end:F}}else i=null}i=i||{start:0,end:0}}else i=null;for(Pm={focusedElem:t,selectionRange:i},Fc=!1,Bt=s;Bt!==null;)if(s=Bt,t=s.child,(s.subtreeFlags&1024)!==0&&t!==null)t.return=s,Bt=t;else for(;Bt!==null;){switch(s=Bt,v=s.alternate,t=s.flags,s.tag){case 0:break;case 11:case 15:break;case 1:if((t&1024)!==0&&v!==null){t=void 0,i=s,p=v.memoizedProps,v=v.memoizedState,u=i.stateNode;try{var Fe=no(i.type,p,i.elementType===i.type);t=u.getSnapshotBeforeUpdate(Fe,v),u.__reactInternalSnapshotBeforeUpdate=t}catch(Ve){xt(i,i.return,Ve)}}break;case 3:if((t&1024)!==0){if(t=s.stateNode.containerInfo,i=t.nodeType,i===9)Bm(t);else if(i===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Bm(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(a(163))}if(t=s.sibling,t!==null){t.return=s.return,Bt=t;break}Bt=s.return}}function ny(t,s,i){var u=i.flags;switch(i.tag){case 0:case 11:case 15:ur(t,i),u&4&&_i(5,i);break;case 1:if(ur(t,i),u&4)if(t=i.stateNode,s===null)try{t.componentDidMount()}catch(k){xt(i,i.return,k)}else{var p=no(i.type,s.memoizedProps);s=s.memoizedState;try{t.componentDidUpdate(p,s,t.__reactInternalSnapshotBeforeUpdate)}catch(k){xt(i,i.return,k)}}u&64&&W0(i),u&512&&Ei(i,i.return);break;case 3:if(ur(t,i),u&64&&(t=i.updateQueue,t!==null)){if(s=null,i.child!==null)switch(i.child.tag){case 27:case 5:s=i.child.stateNode;break;case 1:s=i.child.stateNode}try{Lx(t,s)}catch(k){xt(i,i.return,k)}}break;case 27:s===null&&u&4&&ey(i);case 26:case 5:ur(t,i),s===null&&u&4&&Q0(i),u&512&&Ei(i,i.return);break;case 12:ur(t,i);break;case 13:ur(t,i),u&4&&oy(t,i),u&64&&(t=i.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(i=cE.bind(null,i),CE(t,i))));break;case 22:if(u=i.memoizedState!==null||zs,!u){s=s!==null&&s.memoizedState!==null||Ct,p=zs;var v=Ct;zs=u,(Ct=s)&&!v?dr(t,i,(i.subtreeFlags&8772)!==0):ur(t,i),zs=p,Ct=v}break;case 30:break;default:ur(t,i)}}function sy(t){var s=t.alternate;s!==null&&(t.alternate=null,sy(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&Fa(s)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var vt=null,un=!1;function Is(t,s,i){for(i=i.child;i!==null;)ry(t,s,i),i=i.sibling}function ry(t,s,i){if(xe&&typeof xe.onCommitFiberUnmount=="function")try{xe.onCommitFiberUnmount(_e,i)}catch{}switch(i.tag){case 26:Ct||ss(i,s),Is(t,s,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Ct||ss(i,s);var u=vt,p=un;xr(i.type)&&(vt=i.stateNode,un=!1),Is(t,s,i),zi(i.stateNode),vt=u,un=p;break;case 5:Ct||ss(i,s);case 6:if(u=vt,p=un,vt=null,Is(t,s,i),vt=u,un=p,vt!==null)if(un)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(i.stateNode)}catch(v){xt(i,s,v)}else try{vt.removeChild(i.stateNode)}catch(v){xt(i,s,v)}break;case 18:vt!==null&&(un?(t=vt,Yy(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,i.stateNode),Vi(t)):Yy(vt,i.stateNode));break;case 4:u=vt,p=un,vt=i.stateNode.containerInfo,un=!0,Is(t,s,i),vt=u,un=p;break;case 0:case 11:case 14:case 15:Ct||cr(2,i,s),Ct||cr(4,i,s),Is(t,s,i);break;case 1:Ct||(ss(i,s),u=i.stateNode,typeof u.componentWillUnmount=="function"&&K0(i,s,u)),Is(t,s,i);break;case 21:Is(t,s,i);break;case 22:Ct=(u=Ct)||i.memoizedState!==null,Is(t,s,i),Ct=u;break;default:Is(t,s,i)}}function oy(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Vi(t)}catch(i){xt(s,s.return,i)}}function tE(t){switch(t.tag){case 13:case 19:var s=t.stateNode;return s===null&&(s=t.stateNode=new ty),s;case 22:return t=t.stateNode,s=t._retryCache,s===null&&(s=t._retryCache=new ty),s;default:throw Error(a(435,t.tag))}}function pm(t,s){var i=tE(t);s.forEach(function(u){var p=uE.bind(null,t,u);i.has(u)||(i.add(u),u.then(p,p))})}function gn(t,s){var i=s.deletions;if(i!==null)for(var u=0;u<i.length;u++){var p=i[u],v=t,k=s,O=k;e:for(;O!==null;){switch(O.tag){case 27:if(xr(O.type)){vt=O.stateNode,un=!1;break e}break;case 5:vt=O.stateNode,un=!1;break e;case 3:case 4:vt=O.stateNode.containerInfo,un=!0;break e}O=O.return}if(vt===null)throw Error(a(160));ry(v,k,p),vt=null,un=!1,v=p.alternate,v!==null&&(v.return=null),p.return=null}if(s.subtreeFlags&13878)for(s=s.child;s!==null;)ay(s,t),s=s.sibling}var Bn=null;function ay(t,s){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:gn(s,t),xn(t),u&4&&(cr(3,t,t.return),_i(3,t),cr(5,t,t.return));break;case 1:gn(s,t),xn(t),u&512&&(Ct||i===null||ss(i,i.return)),u&64&&zs&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(i=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=i===null?u:i.concat(u))));break;case 26:var p=Bn;if(gn(s,t),xn(t),u&512&&(Ct||i===null||ss(i,i.return)),u&4){var v=i!==null?i.memoizedState:null;if(u=t.memoizedState,i===null)if(u===null)if(t.stateNode===null){e:{u=t.type,i=t.memoizedProps,p=p.ownerDocument||p;t:switch(u){case"title":v=p.getElementsByTagName("title")[0],(!v||v[Br]||v[Ht]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=p.createElement(u),p.head.insertBefore(v,p.querySelector("head > title"))),Xt(v,u,i),v[Ht]=t,Tt(v),u=v;break e;case"link":var k=ev("link","href",p).get(u+(i.href||""));if(k){for(var O=0;O<k.length;O++)if(v=k[O],v.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&v.getAttribute("rel")===(i.rel==null?null:i.rel)&&v.getAttribute("title")===(i.title==null?null:i.title)&&v.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){k.splice(O,1);break t}}v=p.createElement(u),Xt(v,u,i),p.head.appendChild(v);break;case"meta":if(k=ev("meta","content",p).get(u+(i.content||""))){for(O=0;O<k.length;O++)if(v=k[O],v.getAttribute("content")===(i.content==null?null:""+i.content)&&v.getAttribute("name")===(i.name==null?null:i.name)&&v.getAttribute("property")===(i.property==null?null:i.property)&&v.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&v.getAttribute("charset")===(i.charSet==null?null:i.charSet)){k.splice(O,1);break t}}v=p.createElement(u),Xt(v,u,i),p.head.appendChild(v);break;default:throw Error(a(468,u))}v[Ht]=t,Tt(v),u=v}t.stateNode=u}else tv(p,t.type,t.stateNode);else t.stateNode=Jy(p,u,t.memoizedProps);else v!==u?(v===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):v.count--,u===null?tv(p,t.type,t.stateNode):Jy(p,u,t.memoizedProps)):u===null&&t.stateNode!==null&&dm(t,t.memoizedProps,i.memoizedProps)}break;case 27:gn(s,t),xn(t),u&512&&(Ct||i===null||ss(i,i.return)),i!==null&&u&4&&dm(t,t.memoizedProps,i.memoizedProps);break;case 5:if(gn(s,t),xn(t),u&512&&(Ct||i===null||ss(i,i.return)),t.flags&32){p=t.stateNode;try{Ao(p,"")}catch(ae){xt(t,t.return,ae)}}u&4&&t.stateNode!=null&&(p=t.memoizedProps,dm(t,p,i!==null?i.memoizedProps:p)),u&1024&&(hm=!0);break;case 6:if(gn(s,t),xn(t),u&4){if(t.stateNode===null)throw Error(a(162));u=t.memoizedProps,i=t.stateNode;try{i.nodeValue=u}catch(ae){xt(t,t.return,ae)}}break;case 3:if(Bc=null,p=Bn,Bn=Hc(s.containerInfo),gn(s,t),Bn=p,xn(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{Vi(s.containerInfo)}catch(ae){xt(t,t.return,ae)}hm&&(hm=!1,iy(t));break;case 4:u=Bn,Bn=Hc(t.stateNode.containerInfo),gn(s,t),xn(t),Bn=u;break;case 12:gn(s,t),xn(t);break;case 13:gn(s,t),xn(t),t.child.flags&8192&&t.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(wm=be()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,pm(t,u)));break;case 22:p=t.memoizedState!==null;var F=i!==null&&i.memoizedState!==null,se=zs,ue=Ct;if(zs=se||p,Ct=ue||F,gn(s,t),Ct=ue,zs=se,xn(t),u&8192)e:for(s=t.stateNode,s._visibility=p?s._visibility&-2:s._visibility|1,p&&(i===null||F||zs||Ct||so(t)),i=null,s=t;;){if(s.tag===5||s.tag===26){if(i===null){F=i=s;try{if(v=F.stateNode,p)k=v.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none";else{O=F.stateNode;var he=F.memoizedProps.style,oe=he!=null&&he.hasOwnProperty("display")?he.display:null;O.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(ae){xt(F,F.return,ae)}}}else if(s.tag===6){if(i===null){F=s;try{F.stateNode.nodeValue=p?"":F.memoizedProps}catch(ae){xt(F,F.return,ae)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===t)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;i===s&&(i=null),s=s.return}i===s&&(i=null),s.sibling.return=s.return,s=s.sibling}u&4&&(u=t.updateQueue,u!==null&&(i=u.retryQueue,i!==null&&(u.retryQueue=null,pm(t,i))));break;case 19:gn(s,t),xn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,pm(t,u)));break;case 30:break;case 21:break;default:gn(s,t),xn(t)}}function xn(t){var s=t.flags;if(s&2){try{for(var i,u=t.return;u!==null;){if(J0(u)){i=u;break}u=u.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var p=i.stateNode,v=fm(t);Cc(t,v,p);break;case 5:var k=i.stateNode;i.flags&32&&(Ao(k,""),i.flags&=-33);var O=fm(t);Cc(t,O,k);break;case 3:case 4:var F=i.stateNode.containerInfo,se=fm(t);mm(t,se,F);break;default:throw Error(a(161))}}catch(ue){xt(t,t.return,ue)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function iy(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var s=t;iy(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),t=t.sibling}}function ur(t,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)ny(t,s.alternate,s),s=s.sibling}function so(t){for(t=t.child;t!==null;){var s=t;switch(s.tag){case 0:case 11:case 14:case 15:cr(4,s,s.return),so(s);break;case 1:ss(s,s.return);var i=s.stateNode;typeof i.componentWillUnmount=="function"&&K0(s,s.return,i),so(s);break;case 27:zi(s.stateNode);case 26:case 5:ss(s,s.return),so(s);break;case 22:s.memoizedState===null&&so(s);break;case 30:so(s);break;default:so(s)}t=t.sibling}}function dr(t,s,i){for(i=i&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var u=s.alternate,p=t,v=s,k=v.flags;switch(v.tag){case 0:case 11:case 15:dr(p,v,i),_i(4,v);break;case 1:if(dr(p,v,i),u=v,p=u.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(se){xt(u,u.return,se)}if(u=v,p=u.updateQueue,p!==null){var O=u.stateNode;try{var F=p.shared.hiddenCallbacks;if(F!==null)for(p.shared.hiddenCallbacks=null,p=0;p<F.length;p++)Ix(F[p],O)}catch(se){xt(u,u.return,se)}}i&&k&64&&W0(v),Ei(v,v.return);break;case 27:ey(v);case 26:case 5:dr(p,v,i),i&&u===null&&k&4&&Q0(v),Ei(v,v.return);break;case 12:dr(p,v,i);break;case 13:dr(p,v,i),i&&k&4&&oy(p,v);break;case 22:v.memoizedState===null&&dr(p,v,i),Ei(v,v.return);break;case 30:break;default:dr(p,v,i)}s=s.sibling}}function gm(t,s){var i=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),t=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(t=s.memoizedState.cachePool.pool),t!==i&&(t!=null&&t.refCount++,i!=null&&di(i))}function xm(t,s){t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&di(t))}function rs(t,s,i,u){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)ly(t,s,i,u),s=s.sibling}function ly(t,s,i,u){var p=s.flags;switch(s.tag){case 0:case 11:case 15:rs(t,s,i,u),p&2048&&_i(9,s);break;case 1:rs(t,s,i,u);break;case 3:rs(t,s,i,u),p&2048&&(t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&di(t)));break;case 12:if(p&2048){rs(t,s,i,u),t=s.stateNode;try{var v=s.memoizedProps,k=v.id,O=v.onPostCommit;typeof O=="function"&&O(k,s.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(F){xt(s,s.return,F)}}else rs(t,s,i,u);break;case 13:rs(t,s,i,u);break;case 23:break;case 22:v=s.stateNode,k=s.alternate,s.memoizedState!==null?v._visibility&2?rs(t,s,i,u):Ci(t,s):v._visibility&2?rs(t,s,i,u):(v._visibility|=2,Zo(t,s,i,u,(s.subtreeFlags&10256)!==0)),p&2048&&gm(k,s);break;case 24:rs(t,s,i,u),p&2048&&xm(s.alternate,s);break;default:rs(t,s,i,u)}}function Zo(t,s,i,u,p){for(p=p&&(s.subtreeFlags&10256)!==0,s=s.child;s!==null;){var v=t,k=s,O=i,F=u,se=k.flags;switch(k.tag){case 0:case 11:case 15:Zo(v,k,O,F,p),_i(8,k);break;case 23:break;case 22:var ue=k.stateNode;k.memoizedState!==null?ue._visibility&2?Zo(v,k,O,F,p):Ci(v,k):(ue._visibility|=2,Zo(v,k,O,F,p)),p&&se&2048&&gm(k.alternate,k);break;case 24:Zo(v,k,O,F,p),p&&se&2048&&xm(k.alternate,k);break;default:Zo(v,k,O,F,p)}s=s.sibling}}function Ci(t,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var i=t,u=s,p=u.flags;switch(u.tag){case 22:Ci(i,u),p&2048&&gm(u.alternate,u);break;case 24:Ci(i,u),p&2048&&xm(u.alternate,u);break;default:Ci(i,u)}s=s.sibling}}var ki=8192;function Wo(t){if(t.subtreeFlags&ki)for(t=t.child;t!==null;)cy(t),t=t.sibling}function cy(t){switch(t.tag){case 26:Wo(t),t.flags&ki&&t.memoizedState!==null&&HE(Bn,t.memoizedState,t.memoizedProps);break;case 5:Wo(t);break;case 3:case 4:var s=Bn;Bn=Hc(t.stateNode.containerInfo),Wo(t),Bn=s;break;case 22:t.memoizedState===null&&(s=t.alternate,s!==null&&s.memoizedState!==null?(s=ki,ki=16777216,Wo(t),ki=s):Wo(t));break;default:Wo(t)}}function uy(t){var s=t.alternate;if(s!==null&&(t=s.child,t!==null)){s.child=null;do s=t.sibling,t.sibling=null,t=s;while(t!==null)}}function Ti(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var i=0;i<s.length;i++){var u=s[i];Bt=u,fy(u,t)}uy(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)dy(t),t=t.sibling}function dy(t){switch(t.tag){case 0:case 11:case 15:Ti(t),t.flags&2048&&cr(9,t,t.return);break;case 3:Ti(t);break;case 12:Ti(t);break;case 22:var s=t.stateNode;t.memoizedState!==null&&s._visibility&2&&(t.return===null||t.return.tag!==13)?(s._visibility&=-3,kc(t)):Ti(t);break;default:Ti(t)}}function kc(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var i=0;i<s.length;i++){var u=s[i];Bt=u,fy(u,t)}uy(t)}for(t=t.child;t!==null;){switch(s=t,s.tag){case 0:case 11:case 15:cr(8,s,s.return),kc(s);break;case 22:i=s.stateNode,i._visibility&2&&(i._visibility&=-3,kc(s));break;default:kc(s)}t=t.sibling}}function fy(t,s){for(;Bt!==null;){var i=Bt;switch(i.tag){case 0:case 11:case 15:cr(8,i,s);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var u=i.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:di(i.memoizedState.cache)}if(u=i.child,u!==null)u.return=i,Bt=u;else e:for(i=t;Bt!==null;){u=Bt;var p=u.sibling,v=u.return;if(sy(u),u===i){Bt=null;break e}if(p!==null){p.return=v,Bt=p;break e}Bt=v}}}var nE={getCacheForType:function(t){var s=Qt(zt),i=s.data.get(t);return i===void 0&&(i=t(),s.data.set(t,i)),i}},sE=typeof WeakMap=="function"?WeakMap:Map,ft=0,yt=null,nt=null,it=0,mt=0,yn=null,fr=!1,Ko=!1,ym=!1,Ls=0,St=0,mr=0,ro=0,vm=0,On=0,Qo=0,Ai=null,dn=null,bm=!1,wm=0,Tc=1/0,Ac=null,hr=null,Gt=0,pr=null,Jo=null,ea=0,Nm=0,jm=null,my=null,Mi=0,Sm=null;function vn(){if((ft&2)!==0&&it!==0)return it&-it;if(R.T!==null){var t=Uo;return t!==0?t:Mm()}return Ll()}function hy(){On===0&&(On=(it&536870912)===0||ct?Ft():536870912);var t=Dn.current;return t!==null&&(t.flags|=32),On}function bn(t,s,i){(t===yt&&(mt===2||mt===9)||t.cancelPendingCommit!==null)&&(ta(t,0),gr(t,it,On,!1)),dt(t,i),((ft&2)===0||t!==yt)&&(t===yt&&((ft&2)===0&&(ro|=i),St===4&&gr(t,it,On,!1)),os(t))}function py(t,s,i){if((ft&6)!==0)throw Error(a(327));var u=!i&&(s&124)===0&&(s&t.expiredLanes)===0||Ie(t,s),p=u?aE(t,s):Cm(t,s,!0),v=u;do{if(p===0){Ko&&!u&&gr(t,s,0,!1);break}else{if(i=t.current.alternate,v&&!rE(i)){p=Cm(t,s,!1),v=!1;continue}if(p===2){if(v=s,t.errorRecoveryDisabledLanes&v)var k=0;else k=t.pendingLanes&-536870913,k=k!==0?k:k&536870912?536870912:0;if(k!==0){s=k;e:{var O=t;p=Ai;var F=O.current.memoizedState.isDehydrated;if(F&&(ta(O,k).flags|=256),k=Cm(O,k,!1),k!==2){if(ym&&!F){O.errorRecoveryDisabledLanes|=v,ro|=v,p=4;break e}v=dn,dn=p,v!==null&&(dn===null?dn=v:dn.push.apply(dn,v))}p=k}if(v=!1,p!==2)continue}}if(p===1){ta(t,0),gr(t,s,0,!0);break}e:{switch(u=t,v=p,v){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:gr(u,s,On,!fr);break e;case 2:dn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(p=wm+300-be(),10<p)){if(gr(u,s,On,!fr),Ae(u,0,!0)!==0)break e;u.timeoutHandle=qy(gy.bind(null,u,i,dn,Ac,bm,s,On,ro,Qo,fr,v,2,-0,0),p);break e}gy(u,i,dn,Ac,bm,s,On,ro,Qo,fr,v,0,-0,0)}}break}while(!0);os(t)}function gy(t,s,i,u,p,v,k,O,F,se,ue,he,oe,ae){if(t.timeoutHandle=-1,he=s.subtreeFlags,(he&8192||(he&16785408)===16785408)&&($i={stylesheets:null,count:0,unsuspend:PE},cy(s),he=UE(),he!==null)){t.cancelPendingCommit=he(jy.bind(null,t,s,v,i,u,p,k,O,F,ue,1,oe,ae)),gr(t,v,k,!se);return}jy(t,s,v,i,u,p,k,O,F)}function rE(t){for(var s=t;;){var i=s.tag;if((i===0||i===11||i===15)&&s.flags&16384&&(i=s.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var u=0;u<i.length;u++){var p=i[u],v=p.getSnapshot;p=p.value;try{if(!hn(v(),p))return!1}catch{return!1}}if(i=s.child,s.subtreeFlags&16384&&i!==null)i.return=s,s=i;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function gr(t,s,i,u){s&=~vm,s&=~ro,t.suspendedLanes|=s,t.pingedLanes&=~s,u&&(t.warmLanes|=s),u=t.expirationTimes;for(var p=s;0<p;){var v=31-Ge(p),k=1<<v;u[v]=-1,p&=~k}i!==0&&ot(t,i,s)}function Mc(){return(ft&6)===0?(Ri(0),!1):!0}function _m(){if(nt!==null){if(mt===0)var t=nt.return;else t=nt,Ts=Qr=null,Bf(t),Go=null,Ni=0,t=nt;for(;t!==null;)Z0(t.alternate,t),t=t.return;nt=null}}function ta(t,s){var i=t.timeoutHandle;i!==-1&&(t.timeoutHandle=-1,NE(i)),i=t.cancelPendingCommit,i!==null&&(t.cancelPendingCommit=null,i()),_m(),yt=t,nt=i=Es(t.current,null),it=s,mt=0,yn=null,fr=!1,Ko=Ie(t,s),ym=!1,Qo=On=vm=ro=mr=St=0,dn=Ai=null,bm=!1,(s&8)!==0&&(s|=s&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=s;0<u;){var p=31-Ge(u),v=1<<p;s|=t[p],u&=~v}return Ls=s,Jl(),i}function xy(t,s){Qe=null,R.H=yc,s===mi||s===lc?(s=Ox(),mt=3):s===Mx?(s=Ox(),mt=4):mt=s===z0?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,yn=s,nt===null&&(St=1,jc(t,Tn(s,t.current)))}function yy(){var t=R.H;return R.H=yc,t===null?yc:t}function vy(){var t=R.A;return R.A=nE,t}function Em(){St=4,fr||(it&4194048)!==it&&Dn.current!==null||(Ko=!0),(mr&134217727)===0&&(ro&134217727)===0||yt===null||gr(yt,it,On,!1)}function Cm(t,s,i){var u=ft;ft|=2;var p=yy(),v=vy();(yt!==t||it!==s)&&(Ac=null,ta(t,s)),s=!1;var k=St;e:do try{if(mt!==0&&nt!==null){var O=nt,F=yn;switch(mt){case 8:_m(),k=6;break e;case 3:case 2:case 9:case 6:Dn.current===null&&(s=!0);var se=mt;if(mt=0,yn=null,na(t,O,F,se),i&&Ko){k=0;break e}break;default:se=mt,mt=0,yn=null,na(t,O,F,se)}}oE(),k=St;break}catch(ue){xy(t,ue)}while(!0);return s&&t.shellSuspendCounter++,Ts=Qr=null,ft=u,R.H=p,R.A=v,nt===null&&(yt=null,it=0,Jl()),k}function oE(){for(;nt!==null;)by(nt)}function aE(t,s){var i=ft;ft|=2;var u=yy(),p=vy();yt!==t||it!==s?(Ac=null,Tc=be()+500,ta(t,s)):Ko=Ie(t,s);e:do try{if(mt!==0&&nt!==null){s=nt;var v=yn;t:switch(mt){case 1:mt=0,yn=null,na(t,s,v,1);break;case 2:case 9:if(Rx(v)){mt=0,yn=null,wy(s);break}s=function(){mt!==2&&mt!==9||yt!==t||(mt=7),os(t)},v.then(s,s);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:Rx(v)?(mt=0,yn=null,wy(s)):(mt=0,yn=null,na(t,s,v,7));break;case 5:var k=null;switch(nt.tag){case 26:k=nt.memoizedState;case 5:case 27:var O=nt;if(!k||nv(k)){mt=0,yn=null;var F=O.sibling;if(F!==null)nt=F;else{var se=O.return;se!==null?(nt=se,Rc(se)):nt=null}break t}}mt=0,yn=null,na(t,s,v,5);break;case 6:mt=0,yn=null,na(t,s,v,6);break;case 8:_m(),St=6;break e;default:throw Error(a(462))}}iE();break}catch(ue){xy(t,ue)}while(!0);return Ts=Qr=null,R.H=u,R.A=p,ft=i,nt!==null?0:(yt=null,it=0,Jl(),St)}function iE(){for(;nt!==null&&!Q();)by(nt)}function by(t){var s=G0(t.alternate,t,Ls);t.memoizedProps=t.pendingProps,s===null?Rc(t):nt=s}function wy(t){var s=t,i=s.alternate;switch(s.tag){case 15:case 0:s=U0(i,s,s.pendingProps,s.type,void 0,it);break;case 11:s=U0(i,s,s.pendingProps,s.type.render,s.ref,it);break;case 5:Bf(s);default:Z0(i,s),s=nt=Nx(s,Ls),s=G0(i,s,Ls)}t.memoizedProps=t.pendingProps,s===null?Rc(t):nt=s}function na(t,s,i,u){Ts=Qr=null,Bf(s),Go=null,Ni=0;var p=s.return;try{if(W_(t,p,s,i,it)){St=1,jc(t,Tn(i,t.current)),nt=null;return}}catch(v){if(p!==null)throw nt=p,v;St=1,jc(t,Tn(i,t.current)),nt=null;return}s.flags&32768?(ct||u===1?t=!0:Ko||(it&536870912)!==0?t=!1:(fr=t=!0,(u===2||u===9||u===3||u===6)&&(u=Dn.current,u!==null&&u.tag===13&&(u.flags|=16384))),Ny(s,t)):Rc(s)}function Rc(t){var s=t;do{if((s.flags&32768)!==0){Ny(s,fr);return}t=s.return;var i=Q_(s.alternate,s,Ls);if(i!==null){nt=i;return}if(s=s.sibling,s!==null){nt=s;return}nt=s=t}while(s!==null);St===0&&(St=5)}function Ny(t,s){do{var i=J_(t.alternate,t);if(i!==null){i.flags&=32767,nt=i;return}if(i=t.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!s&&(t=t.sibling,t!==null)){nt=t;return}nt=t=i}while(t!==null);St=6,nt=null}function jy(t,s,i,u,p,v,k,O,F){t.cancelPendingCommit=null;do Dc();while(Gt!==0);if((ft&6)!==0)throw Error(a(327));if(s!==null){if(s===t.current)throw Error(a(177));if(v=s.lanes|s.childLanes,v|=xf,_t(t,i,v,k,O,F),t===yt&&(nt=yt=null,it=0),Jo=s,pr=t,ea=i,Nm=v,jm=p,my=u,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,dE(je,function(){return ky(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||u){u=R.T,R.T=null,p=L.p,L.p=2,k=ft,ft|=4;try{eE(t,s,i)}finally{ft=k,L.p=p,R.T=u}}Gt=1,Sy(),_y(),Ey()}}function Sy(){if(Gt===1){Gt=0;var t=pr,s=Jo,i=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||i){i=R.T,R.T=null;var u=L.p;L.p=2;var p=ft;ft|=4;try{ay(s,t);var v=Pm,k=fx(t.containerInfo),O=v.focusedElem,F=v.selectionRange;if(k!==O&&O&&O.ownerDocument&&dx(O.ownerDocument.documentElement,O)){if(F!==null&&ff(O)){var se=F.start,ue=F.end;if(ue===void 0&&(ue=se),"selectionStart"in O)O.selectionStart=se,O.selectionEnd=Math.min(ue,O.value.length);else{var he=O.ownerDocument||document,oe=he&&he.defaultView||window;if(oe.getSelection){var ae=oe.getSelection(),Fe=O.textContent.length,Ve=Math.min(F.start,Fe),gt=F.end===void 0?Ve:Math.min(F.end,Fe);!ae.extend&&Ve>gt&&(k=gt,gt=Ve,Ve=k);var K=ux(O,Ve),Z=ux(O,gt);if(K&&Z&&(ae.rangeCount!==1||ae.anchorNode!==K.node||ae.anchorOffset!==K.offset||ae.focusNode!==Z.node||ae.focusOffset!==Z.offset)){var te=he.createRange();te.setStart(K.node,K.offset),ae.removeAllRanges(),Ve>gt?(ae.addRange(te),ae.extend(Z.node,Z.offset)):(te.setEnd(Z.node,Z.offset),ae.addRange(te))}}}}for(he=[],ae=O;ae=ae.parentNode;)ae.nodeType===1&&he.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<he.length;O++){var de=he[O];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}Fc=!!$m,Pm=$m=null}finally{ft=p,L.p=u,R.T=i}}t.current=s,Gt=2}}function _y(){if(Gt===2){Gt=0;var t=pr,s=Jo,i=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||i){i=R.T,R.T=null;var u=L.p;L.p=2;var p=ft;ft|=4;try{ny(t,s.alternate,s)}finally{ft=p,L.p=u,R.T=i}}Gt=3}}function Ey(){if(Gt===4||Gt===3){Gt=0,me();var t=pr,s=Jo,i=ea,u=my;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Gt=5:(Gt=0,Jo=pr=null,Cy(t,t.pendingLanes));var p=t.pendingLanes;if(p===0&&(hr=null),Pn(i),s=s.stateNode,xe&&typeof xe.onCommitFiberRoot=="function")try{xe.onCommitFiberRoot(_e,s,void 0,(s.current.flags&128)===128)}catch{}if(u!==null){s=R.T,p=L.p,L.p=2,R.T=null;try{for(var v=t.onRecoverableError,k=0;k<u.length;k++){var O=u[k];v(O.value,{componentStack:O.stack})}}finally{R.T=s,L.p=p}}(ea&3)!==0&&Dc(),os(t),p=t.pendingLanes,(i&4194090)!==0&&(p&42)!==0?t===Sm?Mi++:(Mi=0,Sm=t):Mi=0,Ri(0)}}function Cy(t,s){(t.pooledCacheLanes&=s)===0&&(s=t.pooledCache,s!=null&&(t.pooledCache=null,di(s)))}function Dc(t){return Sy(),_y(),Ey(),ky()}function ky(){if(Gt!==5)return!1;var t=pr,s=Nm;Nm=0;var i=Pn(ea),u=R.T,p=L.p;try{L.p=32>i?32:i,R.T=null,i=jm,jm=null;var v=pr,k=ea;if(Gt=0,Jo=pr=null,ea=0,(ft&6)!==0)throw Error(a(331));var O=ft;if(ft|=4,dy(v.current),ly(v,v.current,k,i),ft=O,Ri(0,!1),xe&&typeof xe.onPostCommitFiberRoot=="function")try{xe.onPostCommitFiberRoot(_e,v)}catch{}return!0}finally{L.p=p,R.T=u,Cy(t,s)}}function Ty(t,s,i){s=Tn(i,s),s=nm(t.stateNode,s,2),t=or(t,s,2),t!==null&&(dt(t,2),os(t))}function xt(t,s,i){if(t.tag===3)Ty(t,t,i);else for(;s!==null;){if(s.tag===3){Ty(s,t,i);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(hr===null||!hr.has(u))){t=Tn(i,t),i=D0(2),u=or(s,i,2),u!==null&&(O0(i,u,s,t),dt(u,2),os(u));break}}s=s.return}}function km(t,s,i){var u=t.pingCache;if(u===null){u=t.pingCache=new sE;var p=new Set;u.set(s,p)}else p=u.get(s),p===void 0&&(p=new Set,u.set(s,p));p.has(i)||(ym=!0,p.add(i),t=lE.bind(null,t,s,i),s.then(t,t))}function lE(t,s,i){var u=t.pingCache;u!==null&&u.delete(s),t.pingedLanes|=t.suspendedLanes&i,t.warmLanes&=~i,yt===t&&(it&i)===i&&(St===4||St===3&&(it&62914560)===it&&300>be()-wm?(ft&2)===0&&ta(t,0):vm|=i,Qo===it&&(Qo=0)),os(t)}function Ay(t,s){s===0&&(s=Pe()),t=Lo(t,s),t!==null&&(dt(t,s),os(t))}function cE(t){var s=t.memoizedState,i=0;s!==null&&(i=s.retryLane),Ay(t,i)}function uE(t,s){var i=0;switch(t.tag){case 13:var u=t.stateNode,p=t.memoizedState;p!==null&&(i=p.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(a(314))}u!==null&&u.delete(s),Ay(t,i)}function dE(t,s){return ze(t,s)}var Oc=null,sa=null,Tm=!1,zc=!1,Am=!1,oo=0;function os(t){t!==sa&&t.next===null&&(sa===null?Oc=sa=t:sa=sa.next=t),zc=!0,Tm||(Tm=!0,mE())}function Ri(t,s){if(!Am&&zc){Am=!0;do for(var i=!1,u=Oc;u!==null;){if(t!==0){var p=u.pendingLanes;if(p===0)var v=0;else{var k=u.suspendedLanes,O=u.pingedLanes;v=(1<<31-Ge(42|t)+1)-1,v&=p&~(k&~O),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(i=!0,Oy(u,v))}else v=it,v=Ae(u,u===yt?v:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(v&3)===0||Ie(u,v)||(i=!0,Oy(u,v));u=u.next}while(i);Am=!1}}function fE(){My()}function My(){zc=Tm=!1;var t=0;oo!==0&&(wE()&&(t=oo),oo=0);for(var s=be(),i=null,u=Oc;u!==null;){var p=u.next,v=Ry(u,s);v===0?(u.next=null,i===null?Oc=p:i.next=p,p===null&&(sa=i)):(i=u,(t!==0||(v&3)!==0)&&(zc=!0)),u=p}Ri(t)}function Ry(t,s){for(var i=t.suspendedLanes,u=t.pingedLanes,p=t.expirationTimes,v=t.pendingLanes&-62914561;0<v;){var k=31-Ge(v),O=1<<k,F=p[k];F===-1?((O&i)===0||(O&u)!==0)&&(p[k]=Ot(O,s)):F<=s&&(t.expiredLanes|=O),v&=~O}if(s=yt,i=it,i=Ae(t,t===s?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,i===0||t===s&&(mt===2||mt===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&re(u),t.callbackNode=null,t.callbackPriority=0;if((i&3)===0||Ie(t,i)){if(s=i&-i,s===t.callbackPriority)return s;switch(u!==null&&re(u),Pn(i)){case 2:case 8:i=Me;break;case 32:i=je;break;case 268435456:i=Ke;break;default:i=je}return u=Dy.bind(null,t),i=ze(i,u),t.callbackPriority=s,t.callbackNode=i,s}return u!==null&&u!==null&&re(u),t.callbackPriority=2,t.callbackNode=null,2}function Dy(t,s){if(Gt!==0&&Gt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var i=t.callbackNode;if(Dc()&&t.callbackNode!==i)return null;var u=it;return u=Ae(t,t===yt?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(py(t,u,s),Ry(t,be()),t.callbackNode!=null&&t.callbackNode===i?Dy.bind(null,t):null)}function Oy(t,s){if(Dc())return null;py(t,s,!0)}function mE(){jE(function(){(ft&6)!==0?ze(we,fE):My()})}function Mm(){return oo===0&&(oo=Ft()),oo}function zy(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Yl(""+t)}function Iy(t,s){var i=s.ownerDocument.createElement("input");return i.name=s.name,i.value=s.value,t.id&&i.setAttribute("form",t.id),s.parentNode.insertBefore(i,s),t=new FormData(t),i.parentNode.removeChild(i),t}function hE(t,s,i,u,p){if(s==="submit"&&i&&i.stateNode===p){var v=zy((p[Kt]||null).action),k=u.submitter;k&&(s=(s=k[Kt]||null)?zy(s.formAction):k.getAttribute("formAction"),s!==null&&(v=s,k=null));var O=new Wl("action","action",null,u,p);t.push({event:O,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(oo!==0){var F=k?Iy(p,k):new FormData(p);Kf(i,{pending:!0,data:F,method:p.method,action:v},null,F)}}else typeof v=="function"&&(O.preventDefault(),F=k?Iy(p,k):new FormData(p),Kf(i,{pending:!0,data:F,method:p.method,action:v},v,F))},currentTarget:p}]})}}for(var Rm=0;Rm<gf.length;Rm++){var Dm=gf[Rm],pE=Dm.toLowerCase(),gE=Dm[0].toUpperCase()+Dm.slice(1);Un(pE,"on"+gE)}Un(px,"onAnimationEnd"),Un(gx,"onAnimationIteration"),Un(xx,"onAnimationStart"),Un("dblclick","onDoubleClick"),Un("focusin","onFocus"),Un("focusout","onBlur"),Un(D_,"onTransitionRun"),Un(O_,"onTransitionStart"),Un(z_,"onTransitionCancel"),Un(yx,"onTransitionEnd"),er("onMouseEnter",["mouseout","mouseover"]),er("onMouseLeave",["mouseout","mouseover"]),er("onPointerEnter",["pointerout","pointerover"]),er("onPointerLeave",["pointerout","pointerover"]),Ns("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ns("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ns("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ns("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ns("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ns("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Di="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(" "),xE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Di));function Ly(t,s){s=(s&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],p=u.event;u=u.listeners;e:{var v=void 0;if(s)for(var k=u.length-1;0<=k;k--){var O=u[k],F=O.instance,se=O.currentTarget;if(O=O.listener,F!==v&&p.isPropagationStopped())break e;v=O,p.currentTarget=se;try{v(p)}catch(ue){Nc(ue)}p.currentTarget=null,v=F}else for(k=0;k<u.length;k++){if(O=u[k],F=O.instance,se=O.currentTarget,O=O.listener,F!==v&&p.isPropagationStopped())break e;v=O,p.currentTarget=se;try{v(p)}catch(ue){Nc(ue)}p.currentTarget=null,v=F}}}}function st(t,s){var i=s[qa];i===void 0&&(i=s[qa]=new Set);var u=t+"__bubble";i.has(u)||($y(s,t,2,!1),i.add(u))}function Om(t,s,i){var u=0;s&&(u|=4),$y(i,t,u,s)}var Ic="_reactListening"+Math.random().toString(36).slice(2);function zm(t){if(!t[Ic]){t[Ic]=!0,Pl.forEach(function(i){i!=="selectionchange"&&(xE.has(i)||Om(i,!1,t),Om(i,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[Ic]||(s[Ic]=!0,Om("selectionchange",!1,s))}}function $y(t,s,i,u){switch(lv(s)){case 2:var p=qE;break;case 8:p=FE;break;default:p=Zm}i=p.bind(null,s,i,t),p=void 0,!nf||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(p=!0),u?p!==void 0?t.addEventListener(s,i,{capture:!0,passive:p}):t.addEventListener(s,i,!0):p!==void 0?t.addEventListener(s,i,{passive:p}):t.addEventListener(s,i,!1)}function Im(t,s,i,u,p){var v=u;if((s&1)===0&&(s&2)===0&&u!==null)e:for(;;){if(u===null)return;var k=u.tag;if(k===3||k===4){var O=u.stateNode.containerInfo;if(O===p)break;if(k===4)for(k=u.return;k!==null;){var F=k.tag;if((F===3||F===4)&&k.stateNode.containerInfo===p)return;k=k.return}for(;O!==null;){if(k=Qs(O),k===null)return;if(F=k.tag,F===5||F===6||F===26||F===27){u=v=k;continue e}O=O.parentNode}}u=u.return}Fg(function(){var se=v,ue=ef(i),he=[];e:{var oe=vx.get(t);if(oe!==void 0){var ae=Wl,Fe=t;switch(t){case"keypress":if(Xl(i)===0)break e;case"keydown":case"keyup":ae=d_;break;case"focusin":Fe="focus",ae=af;break;case"focusout":Fe="blur",ae=af;break;case"beforeblur":case"afterblur":ae=af;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ae=Xg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=JS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=h_;break;case px:case gx:case xx:ae=n_;break;case yx:ae=g_;break;case"scroll":case"scrollend":ae=KS;break;case"wheel":ae=y_;break;case"copy":case"cut":case"paste":ae=r_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=Wg;break;case"toggle":case"beforetoggle":ae=b_}var Ve=(s&4)!==0,gt=!Ve&&(t==="scroll"||t==="scrollend"),K=Ve?oe!==null?oe+"Capture":null:oe;Ve=[];for(var Z=se,te;Z!==null;){var de=Z;if(te=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||te===null||K===null||(de=Qa(Z,K),de!=null&&Ve.push(Oi(Z,de,te))),gt)break;Z=Z.return}0<Ve.length&&(oe=new ae(oe,Fe,null,i,ue),he.push({event:oe,listeners:Ve}))}}if((s&7)===0){e:{if(oe=t==="mouseover"||t==="pointerover",ae=t==="mouseout"||t==="pointerout",oe&&i!==Jd&&(Fe=i.relatedTarget||i.fromElement)&&(Qs(Fe)||Fe[Ks]))break e;if((ae||oe)&&(oe=ue.window===ue?ue:(oe=ue.ownerDocument)?oe.defaultView||oe.parentWindow:window,ae?(Fe=i.relatedTarget||i.toElement,ae=se,Fe=Fe?Qs(Fe):null,Fe!==null&&(gt=c(Fe),Ve=Fe.tag,Fe!==gt||Ve!==5&&Ve!==27&&Ve!==6)&&(Fe=null)):(ae=null,Fe=se),ae!==Fe)){if(Ve=Xg,de="onMouseLeave",K="onMouseEnter",Z="mouse",(t==="pointerout"||t==="pointerover")&&(Ve=Wg,de="onPointerLeave",K="onPointerEnter",Z="pointer"),gt=ae==null?oe:Js(ae),te=Fe==null?oe:Js(Fe),oe=new Ve(de,Z+"leave",ae,i,ue),oe.target=gt,oe.relatedTarget=te,de=null,Qs(ue)===se&&(Ve=new Ve(K,Z+"enter",Fe,i,ue),Ve.target=te,Ve.relatedTarget=gt,de=Ve),gt=de,ae&&Fe)t:{for(Ve=ae,K=Fe,Z=0,te=Ve;te;te=ra(te))Z++;for(te=0,de=K;de;de=ra(de))te++;for(;0<Z-te;)Ve=ra(Ve),Z--;for(;0<te-Z;)K=ra(K),te--;for(;Z--;){if(Ve===K||K!==null&&Ve===K.alternate)break t;Ve=ra(Ve),K=ra(K)}Ve=null}else Ve=null;ae!==null&&Py(he,oe,ae,Ve,!1),Fe!==null&&gt!==null&&Py(he,gt,Fe,Ve,!0)}}e:{if(oe=se?Js(se):window,ae=oe.nodeName&&oe.nodeName.toLowerCase(),ae==="select"||ae==="input"&&oe.type==="file")var Re=rx;else if(nx(oe))if(ox)Re=A_;else{Re=k_;var et=C_}else ae=oe.nodeName,!ae||ae.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?se&&Qd(se.elementType)&&(Re=rx):Re=T_;if(Re&&(Re=Re(t,se))){sx(he,Re,i,ue);break e}et&&et(t,oe,se),t==="focusout"&&se&&oe.type==="number"&&se.memoizedProps.value!=null&&Ka(oe,"number",oe.value)}switch(et=se?Js(se):window,t){case"focusin":(nx(et)||et.contentEditable==="true")&&(Oo=et,mf=se,ai=null);break;case"focusout":ai=mf=Oo=null;break;case"mousedown":hf=!0;break;case"contextmenu":case"mouseup":case"dragend":hf=!1,mx(he,i,ue);break;case"selectionchange":if(R_)break;case"keydown":case"keyup":mx(he,i,ue)}var He;if(cf)e:{switch(t){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else Do?ex(t,i)&&(qe="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(qe="onCompositionStart");qe&&(Kg&&i.locale!=="ko"&&(Do||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&Do&&(He=Yg()):(tr=ue,sf="value"in tr?tr.value:tr.textContent,Do=!0)),et=Lc(se,qe),0<et.length&&(qe=new Zg(qe,t,null,i,ue),he.push({event:qe,listeners:et}),He?qe.data=He:(He=tx(i),He!==null&&(qe.data=He)))),(He=N_?j_(t,i):S_(t,i))&&(qe=Lc(se,"onBeforeInput"),0<qe.length&&(et=new Zg("onBeforeInput","beforeinput",null,i,ue),he.push({event:et,listeners:qe}),et.data=He)),hE(he,t,se,i,ue)}Ly(he,s)})}function Oi(t,s,i){return{instance:t,listener:s,currentTarget:i}}function Lc(t,s){for(var i=s+"Capture",u=[];t!==null;){var p=t,v=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||v===null||(p=Qa(t,i),p!=null&&u.unshift(Oi(t,p,v)),p=Qa(t,s),p!=null&&u.push(Oi(t,p,v))),t.tag===3)return u;t=t.return}return[]}function ra(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Py(t,s,i,u,p){for(var v=s._reactName,k=[];i!==null&&i!==u;){var O=i,F=O.alternate,se=O.stateNode;if(O=O.tag,F!==null&&F===u)break;O!==5&&O!==26&&O!==27||se===null||(F=se,p?(se=Qa(i,v),se!=null&&k.unshift(Oi(i,se,F))):p||(se=Qa(i,v),se!=null&&k.push(Oi(i,se,F)))),i=i.return}k.length!==0&&t.push({event:s,listeners:k})}var yE=/\r\n?/g,vE=/\u0000|\uFFFD/g;function Hy(t){return(typeof t=="string"?t:""+t).replace(yE,`
`).replace(vE,"")}function Uy(t,s){return s=Hy(s),Hy(t)===s}function $c(){}function pt(t,s,i,u,p,v){switch(i){case"children":typeof u=="string"?s==="body"||s==="textarea"&&u===""||Ao(t,u):(typeof u=="number"||typeof u=="bigint")&&s!=="body"&&Ao(t,""+u);break;case"className":Co(t,"class",u);break;case"tabIndex":Co(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Co(t,i,u);break;case"style":Vg(t,u,v);break;case"data":if(s!=="object"){Co(t,"data",u);break}case"src":case"href":if(u===""&&(s!=="a"||i!=="href")){t.removeAttribute(i);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=Yl(""+u),t.setAttribute(i,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(i,"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 v=="function"&&(i==="formAction"?(s!=="input"&&pt(t,s,"name",p.name,p,null),pt(t,s,"formEncType",p.formEncType,p,null),pt(t,s,"formMethod",p.formMethod,p,null),pt(t,s,"formTarget",p.formTarget,p,null)):(pt(t,s,"encType",p.encType,p,null),pt(t,s,"method",p.method,p,null),pt(t,s,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=Yl(""+u),t.setAttribute(i,u);break;case"onClick":u!=null&&(t.onclick=$c);break;case"onScroll":u!=null&&st("scroll",t);break;case"onScrollEnd":u!=null&&st("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(a(61));if(i=u.__html,i!=null){if(p.children!=null)throw Error(a(60));t.innerHTML=i}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}i=Yl(""+u),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,""+u):t.removeAttribute(i);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":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,""):t.removeAttribute(i);break;case"capture":case"download":u===!0?t.setAttribute(i,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,u):t.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(i,u):t.removeAttribute(i);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(i):t.setAttribute(i,u);break;case"popover":st("beforetoggle",t),st("toggle",t),Eo(t,"popover",u);break;case"xlinkActuate":Hn(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Hn(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Hn(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Hn(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Hn(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Hn(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Hn(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Hn(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Hn(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Eo(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=ZS.get(i)||i,Eo(t,i,u))}}function Lm(t,s,i,u,p,v){switch(i){case"style":Vg(t,u,v);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(a(61));if(i=u.__html,i!=null){if(p.children!=null)throw Error(a(60));t.innerHTML=i}}break;case"children":typeof u=="string"?Ao(t,u):(typeof u=="number"||typeof u=="bigint")&&Ao(t,""+u);break;case"onScroll":u!=null&&st("scroll",t);break;case"onScrollEnd":u!=null&&st("scrollend",t);break;case"onClick":u!=null&&(t.onclick=$c);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Hl.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(p=i.endsWith("Capture"),s=i.slice(2,p?i.length-7:void 0),v=t[Kt]||null,v=v!=null?v[i]:null,typeof v=="function"&&t.removeEventListener(s,v,p),typeof u=="function")){typeof v!="function"&&v!==null&&(i in t?t[i]=null:t.hasAttribute(i)&&t.removeAttribute(i)),t.addEventListener(s,u,p);break e}i in t?t[i]=u:u===!0?t.setAttribute(i,""):Eo(t,i,u)}}}function Xt(t,s,i){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":st("error",t),st("load",t);var u=!1,p=!1,v;for(v in i)if(i.hasOwnProperty(v)){var k=i[v];if(k!=null)switch(v){case"src":u=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:pt(t,s,v,k,i,null)}}p&&pt(t,s,"srcSet",i.srcSet,i,null),u&&pt(t,s,"src",i.src,i,null);return;case"input":st("invalid",t);var O=v=k=p=null,F=null,se=null;for(u in i)if(i.hasOwnProperty(u)){var ue=i[u];if(ue!=null)switch(u){case"name":p=ue;break;case"type":k=ue;break;case"checked":F=ue;break;case"defaultChecked":se=ue;break;case"value":v=ue;break;case"defaultValue":O=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(a(137,s));break;default:pt(t,s,u,ue,i,null)}}Fl(t,v,O,F,se,k,p,!1),ko(t);return;case"select":st("invalid",t),u=k=v=null;for(p in i)if(i.hasOwnProperty(p)&&(O=i[p],O!=null))switch(p){case"value":v=O;break;case"defaultValue":k=O;break;case"multiple":u=O;default:pt(t,s,p,O,i,null)}s=v,i=k,t.multiple=!!u,s!=null?Ss(t,!!u,s,!1):i!=null&&Ss(t,!!u,i,!0);return;case"textarea":st("invalid",t),v=p=u=null;for(k in i)if(i.hasOwnProperty(k)&&(O=i[k],O!=null))switch(k){case"value":u=O;break;case"defaultValue":p=O;break;case"children":v=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(a(91));break;default:pt(t,s,k,O,i,null)}Ug(t,u,p,v),ko(t);return;case"option":for(F in i)if(i.hasOwnProperty(F)&&(u=i[F],u!=null))switch(F){case"selected":t.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:pt(t,s,F,u,i,null)}return;case"dialog":st("beforetoggle",t),st("toggle",t),st("cancel",t),st("close",t);break;case"iframe":case"object":st("load",t);break;case"video":case"audio":for(u=0;u<Di.length;u++)st(Di[u],t);break;case"image":st("error",t),st("load",t);break;case"details":st("toggle",t);break;case"embed":case"source":case"link":st("error",t),st("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(se in i)if(i.hasOwnProperty(se)&&(u=i[se],u!=null))switch(se){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:pt(t,s,se,u,i,null)}return;default:if(Qd(s)){for(ue in i)i.hasOwnProperty(ue)&&(u=i[ue],u!==void 0&&Lm(t,s,ue,u,i,void 0));return}}for(O in i)i.hasOwnProperty(O)&&(u=i[O],u!=null&&pt(t,s,O,u,i,null))}function bE(t,s,i,u){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,v=null,k=null,O=null,F=null,se=null,ue=null;for(ae in i){var he=i[ae];if(i.hasOwnProperty(ae)&&he!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":F=he;default:u.hasOwnProperty(ae)||pt(t,s,ae,null,u,he)}}for(var oe in u){var ae=u[oe];if(he=i[oe],u.hasOwnProperty(oe)&&(ae!=null||he!=null))switch(oe){case"type":v=ae;break;case"name":p=ae;break;case"checked":se=ae;break;case"defaultChecked":ue=ae;break;case"value":k=ae;break;case"defaultValue":O=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(a(137,s));break;default:ae!==he&&pt(t,s,oe,ae,u,he)}}Vr(t,k,O,F,se,ue,v,p);return;case"select":ae=k=O=oe=null;for(v in i)if(F=i[v],i.hasOwnProperty(v)&&F!=null)switch(v){case"value":break;case"multiple":ae=F;default:u.hasOwnProperty(v)||pt(t,s,v,null,u,F)}for(p in u)if(v=u[p],F=i[p],u.hasOwnProperty(p)&&(v!=null||F!=null))switch(p){case"value":oe=v;break;case"defaultValue":O=v;break;case"multiple":k=v;default:v!==F&&pt(t,s,p,v,u,F)}s=O,i=k,u=ae,oe!=null?Ss(t,!!i,oe,!1):!!u!=!!i&&(s!=null?Ss(t,!!i,s,!0):Ss(t,!!i,i?[]:"",!1));return;case"textarea":ae=oe=null;for(O in i)if(p=i[O],i.hasOwnProperty(O)&&p!=null&&!u.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:pt(t,s,O,null,u,p)}for(k in u)if(p=u[k],v=i[k],u.hasOwnProperty(k)&&(p!=null||v!=null))switch(k){case"value":oe=p;break;case"defaultValue":ae=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(a(91));break;default:p!==v&&pt(t,s,k,p,u,v)}Hg(t,oe,ae);return;case"option":for(var Fe in i)if(oe=i[Fe],i.hasOwnProperty(Fe)&&oe!=null&&!u.hasOwnProperty(Fe))switch(Fe){case"selected":t.selected=!1;break;default:pt(t,s,Fe,null,u,oe)}for(F in u)if(oe=u[F],ae=i[F],u.hasOwnProperty(F)&&oe!==ae&&(oe!=null||ae!=null))switch(F){case"selected":t.selected=oe&&typeof oe!="function"&&typeof oe!="symbol";break;default:pt(t,s,F,oe,u,ae)}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 Ve in i)oe=i[Ve],i.hasOwnProperty(Ve)&&oe!=null&&!u.hasOwnProperty(Ve)&&pt(t,s,Ve,null,u,oe);for(se in u)if(oe=u[se],ae=i[se],u.hasOwnProperty(se)&&oe!==ae&&(oe!=null||ae!=null))switch(se){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(a(137,s));break;default:pt(t,s,se,oe,u,ae)}return;default:if(Qd(s)){for(var gt in i)oe=i[gt],i.hasOwnProperty(gt)&&oe!==void 0&&!u.hasOwnProperty(gt)&&Lm(t,s,gt,void 0,u,oe);for(ue in u)oe=u[ue],ae=i[ue],!u.hasOwnProperty(ue)||oe===ae||oe===void 0&&ae===void 0||Lm(t,s,ue,oe,u,ae);return}}for(var K in i)oe=i[K],i.hasOwnProperty(K)&&oe!=null&&!u.hasOwnProperty(K)&&pt(t,s,K,null,u,oe);for(he in u)oe=u[he],ae=i[he],!u.hasOwnProperty(he)||oe===ae||oe==null&&ae==null||pt(t,s,he,oe,u,ae)}var $m=null,Pm=null;function Pc(t){return t.nodeType===9?t:t.ownerDocument}function By(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Vy(t,s){if(t===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&s==="foreignObject"?0:t}function Hm(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Um=null;function wE(){var t=window.event;return t&&t.type==="popstate"?t===Um?!1:(Um=t,!0):(Um=null,!1)}var qy=typeof setTimeout=="function"?setTimeout:void 0,NE=typeof clearTimeout=="function"?clearTimeout:void 0,Fy=typeof Promise=="function"?Promise:void 0,jE=typeof queueMicrotask=="function"?queueMicrotask:typeof Fy<"u"?function(t){return Fy.resolve(null).then(t).catch(SE)}:qy;function SE(t){setTimeout(function(){throw t})}function xr(t){return t==="head"}function Yy(t,s){var i=s,u=0,p=0;do{var v=i.nextSibling;if(t.removeChild(i),v&&v.nodeType===8)if(i=v.data,i==="/$"){if(0<u&&8>u){i=u;var k=t.ownerDocument;if(i&1&&zi(k.documentElement),i&2&&zi(k.body),i&4)for(i=k.head,zi(i),k=i.firstChild;k;){var O=k.nextSibling,F=k.nodeName;k[Br]||F==="SCRIPT"||F==="STYLE"||F==="LINK"&&k.rel.toLowerCase()==="stylesheet"||i.removeChild(k),k=O}}if(p===0){t.removeChild(v),Vi(s);return}p--}else i==="$"||i==="$?"||i==="$!"?p++:u=i.charCodeAt(0)-48;else u=0;i=v}while(i);Vi(s)}function Bm(t){var s=t.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var i=s;switch(s=s.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Bm(i),Fa(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}t.removeChild(i)}}function _E(t,s,i,u){for(;t.nodeType===1;){var p=i;if(t.nodeName.toLowerCase()!==s.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[Br])switch(s){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(v=t.getAttribute("rel"),v==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(v!==p.rel||t.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||t.getAttribute("title")!==(p.title==null?null:p.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(v=t.getAttribute("src"),(v!==(p.src==null?null:p.src)||t.getAttribute("type")!==(p.type==null?null:p.type)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&v&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(s==="input"&&t.type==="hidden"){var v=p.name==null?null:""+p.name;if(p.type==="hidden"&&t.getAttribute("name")===v)return t}else return t;if(t=Vn(t.nextSibling),t===null)break}return null}function EE(t,s,i){if(s==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Vn(t.nextSibling),t===null))return null;return t}function Vm(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState==="complete"}function CE(t,s){var i=t.ownerDocument;if(t.data!=="$?"||i.readyState==="complete")s();else{var u=function(){s(),i.removeEventListener("DOMContentLoaded",u)};i.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function Vn(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?"||s==="F!"||s==="F")break;if(s==="/$")return null}}return t}var qm=null;function Gy(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"){if(s===0)return t;s--}else i==="/$"&&s++}t=t.previousSibling}return null}function Xy(t,s,i){switch(s=Pc(i),t){case"html":if(t=s.documentElement,!t)throw Error(a(452));return t;case"head":if(t=s.head,!t)throw Error(a(453));return t;case"body":if(t=s.body,!t)throw Error(a(454));return t;default:throw Error(a(451))}}function zi(t){for(var s=t.attributes;s.length;)t.removeAttributeNode(s[0]);Fa(t)}var zn=new Map,Zy=new Set;function Hc(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var $s=L.d;L.d={f:kE,r:TE,D:AE,C:ME,L:RE,m:DE,X:zE,S:OE,M:IE};function kE(){var t=$s.f(),s=Mc();return t||s}function TE(t){var s=bs(t);s!==null&&s.tag===5&&s.type==="form"?p0(s):$s.r(t)}var oa=typeof document>"u"?null:document;function Wy(t,s,i){var u=oa;if(u&&typeof s=="string"&&s){var p=an(s);p='link[rel="'+t+'"][href="'+p+'"]',typeof i=="string"&&(p+='[crossorigin="'+i+'"]'),Zy.has(p)||(Zy.add(p),t={rel:t,crossOrigin:i,href:s},u.querySelector(p)===null&&(s=u.createElement("link"),Xt(s,"link",t),Tt(s),u.head.appendChild(s)))}}function AE(t){$s.D(t),Wy("dns-prefetch",t,null)}function ME(t,s){$s.C(t,s),Wy("preconnect",t,s)}function RE(t,s,i){$s.L(t,s,i);var u=oa;if(u&&t&&s){var p='link[rel="preload"][as="'+an(s)+'"]';s==="image"&&i&&i.imageSrcSet?(p+='[imagesrcset="'+an(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(p+='[imagesizes="'+an(i.imageSizes)+'"]')):p+='[href="'+an(t)+'"]';var v=p;switch(s){case"style":v=aa(t);break;case"script":v=ia(t)}zn.has(v)||(t=g({rel:"preload",href:s==="image"&&i&&i.imageSrcSet?void 0:t,as:s},i),zn.set(v,t),u.querySelector(p)!==null||s==="style"&&u.querySelector(Ii(v))||s==="script"&&u.querySelector(Li(v))||(s=u.createElement("link"),Xt(s,"link",t),Tt(s),u.head.appendChild(s)))}}function DE(t,s){$s.m(t,s);var i=oa;if(i&&t){var u=s&&typeof s.as=="string"?s.as:"script",p='link[rel="modulepreload"][as="'+an(u)+'"][href="'+an(t)+'"]',v=p;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=ia(t)}if(!zn.has(v)&&(t=g({rel:"modulepreload",href:t},s),zn.set(v,t),i.querySelector(p)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Li(v)))return}u=i.createElement("link"),Xt(u,"link",t),Tt(u),i.head.appendChild(u)}}}function OE(t,s,i){$s.S(t,s,i);var u=oa;if(u&&t){var p=ws(u).hoistableStyles,v=aa(t);s=s||"default";var k=p.get(v);if(!k){var O={loading:0,preload:null};if(k=u.querySelector(Ii(v)))O.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":s},i),(i=zn.get(v))&&Fm(t,i);var F=k=u.createElement("link");Tt(F),Xt(F,"link",t),F._p=new Promise(function(se,ue){F.onload=se,F.onerror=ue}),F.addEventListener("load",function(){O.loading|=1}),F.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Uc(k,s,u)}k={type:"stylesheet",instance:k,count:1,state:O},p.set(v,k)}}}function zE(t,s){$s.X(t,s);var i=oa;if(i&&t){var u=ws(i).hoistableScripts,p=ia(t),v=u.get(p);v||(v=i.querySelector(Li(p)),v||(t=g({src:t,async:!0},s),(s=zn.get(p))&&Ym(t,s),v=i.createElement("script"),Tt(v),Xt(v,"link",t),i.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(p,v))}}function IE(t,s){$s.M(t,s);var i=oa;if(i&&t){var u=ws(i).hoistableScripts,p=ia(t),v=u.get(p);v||(v=i.querySelector(Li(p)),v||(t=g({src:t,async:!0,type:"module"},s),(s=zn.get(p))&&Ym(t,s),v=i.createElement("script"),Tt(v),Xt(v,"link",t),i.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(p,v))}}function Ky(t,s,i,u){var p=(p=fe.current)?Hc(p):null;if(!p)throw Error(a(446));switch(t){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(s=aa(i.href),i=ws(p).hoistableStyles,u=i.get(s),u||(u={type:"style",instance:null,count:0,state:null},i.set(s,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){t=aa(i.href);var v=ws(p).hoistableStyles,k=v.get(t);if(k||(p=p.ownerDocument||p,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(t,k),(v=p.querySelector(Ii(t)))&&!v._p&&(k.instance=v,k.state.loading=5),zn.has(t)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},zn.set(t,i),v||LE(p,t,i,k.state))),s&&u===null)throw Error(a(528,""));return k}if(s&&u!==null)throw Error(a(529,""));return null;case"script":return s=i.async,i=i.src,typeof i=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=ia(i),i=ws(p).hoistableScripts,u=i.get(s),u||(u={type:"script",instance:null,count:0,state:null},i.set(s,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,t))}}function aa(t){return'href="'+an(t)+'"'}function Ii(t){return'link[rel="stylesheet"]['+t+"]"}function Qy(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function LE(t,s,i,u){t.querySelector('link[rel="preload"][as="style"]['+s+"]")?u.loading=1:(s=t.createElement("link"),u.preload=s,s.addEventListener("load",function(){return u.loading|=1}),s.addEventListener("error",function(){return u.loading|=2}),Xt(s,"link",i),Tt(s),t.head.appendChild(s))}function ia(t){return'[src="'+an(t)+'"]'}function Li(t){return"script[async]"+t}function Jy(t,s,i){if(s.count++,s.instance===null)switch(s.type){case"style":var u=t.querySelector('style[data-href~="'+an(i.href)+'"]');if(u)return s.instance=u,Tt(u),u;var p=g({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),Tt(u),Xt(u,"style",p),Uc(u,i.precedence,t),s.instance=u;case"stylesheet":p=aa(i.href);var v=t.querySelector(Ii(p));if(v)return s.state.loading|=4,s.instance=v,Tt(v),v;u=Qy(i),(p=zn.get(p))&&Fm(u,p),v=(t.ownerDocument||t).createElement("link"),Tt(v);var k=v;return k._p=new Promise(function(O,F){k.onload=O,k.onerror=F}),Xt(v,"link",u),s.state.loading|=4,Uc(v,i.precedence,t),s.instance=v;case"script":return v=ia(i.src),(p=t.querySelector(Li(v)))?(s.instance=p,Tt(p),p):(u=i,(p=zn.get(v))&&(u=g({},i),Ym(u,p)),t=t.ownerDocument||t,p=t.createElement("script"),Tt(p),Xt(p,"link",u),t.head.appendChild(p),s.instance=p);case"void":return null;default:throw Error(a(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(u=s.instance,s.state.loading|=4,Uc(u,i.precedence,t));return s.instance}function Uc(t,s,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=u.length?u[u.length-1]:null,v=p,k=0;k<u.length;k++){var O=u[k];if(O.dataset.precedence===s)v=O;else if(v!==p)break}v?v.parentNode.insertBefore(t,v.nextSibling):(s=i.nodeType===9?i.head:i,s.insertBefore(t,s.firstChild))}function Fm(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.title==null&&(t.title=s.title)}function Ym(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.integrity==null&&(t.integrity=s.integrity)}var Bc=null;function ev(t,s,i){if(Bc===null){var u=new Map,p=Bc=new Map;p.set(i,u)}else p=Bc,u=p.get(i),u||(u=new Map,p.set(i,u));if(u.has(t))return u;for(u.set(t,null),i=i.getElementsByTagName(t),p=0;p<i.length;p++){var v=i[p];if(!(v[Br]||v[Ht]||t==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var k=v.getAttribute(s)||"";k=t+k;var O=u.get(k);O?O.push(v):u.set(k,[v])}}return u}function tv(t,s,i){t=t.ownerDocument||t,t.head.insertBefore(i,s==="title"?t.querySelector("head > title"):null)}function $E(t,s,i){if(i===1||s.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return t=s.disabled,typeof s.precedence=="string"&&t==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function nv(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}var $i=null;function PE(){}function HE(t,s,i){if($i===null)throw Error(a(475));var u=$i;if(s.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var p=aa(i.href),v=t.querySelector(Ii(p));if(v){t=v._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(u.count++,u=Vc.bind(u),t.then(u,u)),s.state.loading|=4,s.instance=v,Tt(v);return}v=t.ownerDocument||t,i=Qy(i),(p=zn.get(p))&&Fm(i,p),v=v.createElement("link"),Tt(v);var k=v;k._p=new Promise(function(O,F){k.onload=O,k.onerror=F}),Xt(v,"link",i),s.instance=v}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(u.count++,s=Vc.bind(u),t.addEventListener("load",s),t.addEventListener("error",s))}}function UE(){if($i===null)throw Error(a(475));var t=$i;return t.stylesheets&&t.count===0&&Gm(t,t.stylesheets),0<t.count?function(s){var i=setTimeout(function(){if(t.stylesheets&&Gm(t,t.stylesheets),t.unsuspend){var u=t.unsuspend;t.unsuspend=null,u()}},6e4);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(i)}}:null}function Vc(){if(this.count--,this.count===0){if(this.stylesheets)Gm(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var qc=null;function Gm(t,s){t.stylesheets=null,t.unsuspend!==null&&(t.count++,qc=new Map,s.forEach(BE,t),qc=null,Vc.call(t))}function BE(t,s){if(!(s.state.loading&4)){var i=qc.get(t);if(i)var u=i.get(null);else{i=new Map,qc.set(t,i);for(var p=t.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<p.length;v++){var k=p[v];(k.nodeName==="LINK"||k.getAttribute("media")!=="not all")&&(i.set(k.dataset.precedence,k),u=k)}u&&i.set(null,u)}p=s.instance,k=p.getAttribute("data-precedence"),v=i.get(k)||u,v===u&&i.set(null,p),i.set(k,p),this.count++,u=Vc.bind(this),p.addEventListener("load",u),p.addEventListener("error",u),v?v.parentNode.insertBefore(p,v.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(p,t.firstChild)),s.state.loading|=4}}var Pi={$$typeof:E,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function VE(t,s,i,u,p,v,k,O){this.tag=1,this.containerInfo=t,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=ye(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ye(0),this.hiddenUpdates=ye(null),this.identifierPrefix=u,this.onUncaughtError=p,this.onCaughtError=v,this.onRecoverableError=k,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function sv(t,s,i,u,p,v,k,O,F,se,ue,he){return t=new VE(t,s,i,k,O,F,se,he),s=1,v===!0&&(s|=24),v=pn(3,null,null,s),t.current=v,v.stateNode=t,s=kf(),s.refCount++,t.pooledCache=s,s.refCount++,v.memoizedState={element:u,isDehydrated:i,cache:s},Rf(v),t}function rv(t){return t?(t=$o,t):$o}function ov(t,s,i,u,p,v){p=rv(p),u.context===null?u.context=p:u.pendingContext=p,u=rr(s),u.payload={element:i},v=v===void 0?null:v,v!==null&&(u.callback=v),i=or(t,u,s),i!==null&&(bn(i,t,s),pi(i,t,s))}function av(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<s?i:s}}function Xm(t,s){av(t,s),(t=t.alternate)&&av(t,s)}function iv(t){if(t.tag===13){var s=Lo(t,67108864);s!==null&&bn(s,t,67108864),Xm(t,67108864)}}var Fc=!0;function qE(t,s,i,u){var p=R.T;R.T=null;var v=L.p;try{L.p=2,Zm(t,s,i,u)}finally{L.p=v,R.T=p}}function FE(t,s,i,u){var p=R.T;R.T=null;var v=L.p;try{L.p=8,Zm(t,s,i,u)}finally{L.p=v,R.T=p}}function Zm(t,s,i,u){if(Fc){var p=Wm(u);if(p===null)Im(t,s,u,Yc,i),cv(t,u);else if(GE(p,t,s,i,u))u.stopPropagation();else if(cv(t,u),s&4&&-1<YE.indexOf(t)){for(;p!==null;){var v=bs(p);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var k=pe(v.pendingLanes);if(k!==0){var O=v;for(O.pendingLanes|=2,O.entangledLanes|=2;k;){var F=1<<31-Ge(k);O.entanglements[1]|=F,k&=~F}os(v),(ft&6)===0&&(Tc=be()+500,Ri(0))}}break;case 13:O=Lo(v,2),O!==null&&bn(O,v,2),Mc(),Xm(v,2)}if(v=Wm(u),v===null&&Im(t,s,u,Yc,i),v===p)break;p=v}p!==null&&u.stopPropagation()}else Im(t,s,u,null,i)}}function Wm(t){return t=ef(t),Km(t)}var Yc=null;function Km(t){if(Yc=null,t=Qs(t),t!==null){var s=c(t);if(s===null)t=null;else{var i=s.tag;if(i===13){if(t=d(s),t!==null)return t;t=null}else if(i===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null)}}return Yc=t,null}function lv(t){switch(t){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(Ce()){case we:return 2;case Me:return 8;case je:case Se:return 32;case Ke:return 268435456;default:return 32}default:return 32}}var Qm=!1,yr=null,vr=null,br=null,Hi=new Map,Ui=new Map,wr=[],YE="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 cv(t,s){switch(t){case"focusin":case"focusout":yr=null;break;case"dragenter":case"dragleave":vr=null;break;case"mouseover":case"mouseout":br=null;break;case"pointerover":case"pointerout":Hi.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ui.delete(s.pointerId)}}function Bi(t,s,i,u,p,v){return t===null||t.nativeEvent!==v?(t={blockedOn:s,domEventName:i,eventSystemFlags:u,nativeEvent:v,targetContainers:[p]},s!==null&&(s=bs(s),s!==null&&iv(s)),t):(t.eventSystemFlags|=u,s=t.targetContainers,p!==null&&s.indexOf(p)===-1&&s.push(p),t)}function GE(t,s,i,u,p){switch(s){case"focusin":return yr=Bi(yr,t,s,i,u,p),!0;case"dragenter":return vr=Bi(vr,t,s,i,u,p),!0;case"mouseover":return br=Bi(br,t,s,i,u,p),!0;case"pointerover":var v=p.pointerId;return Hi.set(v,Bi(Hi.get(v)||null,t,s,i,u,p)),!0;case"gotpointercapture":return v=p.pointerId,Ui.set(v,Bi(Ui.get(v)||null,t,s,i,u,p)),!0}return!1}function uv(t){var s=Qs(t.target);if(s!==null){var i=c(s);if(i!==null){if(s=i.tag,s===13){if(s=d(i),s!==null){t.blockedOn=s,qd(t.priority,function(){if(i.tag===13){var u=vn();u=mn(u);var p=Lo(i,u);p!==null&&bn(p,i,u),Xm(i,u)}});return}}else if(s===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Gc(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var i=Wm(t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);Jd=u,i.target.dispatchEvent(u),Jd=null}else return s=bs(i),s!==null&&iv(s),t.blockedOn=i,!1;s.shift()}return!0}function dv(t,s,i){Gc(t)&&i.delete(s)}function XE(){Qm=!1,yr!==null&&Gc(yr)&&(yr=null),vr!==null&&Gc(vr)&&(vr=null),br!==null&&Gc(br)&&(br=null),Hi.forEach(dv),Ui.forEach(dv)}function Xc(t,s){t.blockedOn===s&&(t.blockedOn=null,Qm||(Qm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,XE)))}var Zc=null;function fv(t){Zc!==t&&(Zc=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Zc===t&&(Zc=null);for(var s=0;s<t.length;s+=3){var i=t[s],u=t[s+1],p=t[s+2];if(typeof u!="function"){if(Km(u||i)===null)continue;break}var v=bs(i);v!==null&&(t.splice(s,3),s-=3,Kf(v,{pending:!0,data:p,method:i.method,action:u},u,p))}}))}function Vi(t){function s(F){return Xc(F,t)}yr!==null&&Xc(yr,t),vr!==null&&Xc(vr,t),br!==null&&Xc(br,t),Hi.forEach(s),Ui.forEach(s);for(var i=0;i<wr.length;i++){var u=wr[i];u.blockedOn===t&&(u.blockedOn=null)}for(;0<wr.length&&(i=wr[0],i.blockedOn===null);)uv(i),i.blockedOn===null&&wr.shift();if(i=(t.ownerDocument||t).$$reactFormReplay,i!=null)for(u=0;u<i.length;u+=3){var p=i[u],v=i[u+1],k=p[Kt]||null;if(typeof v=="function")k||fv(i);else if(k){var O=null;if(v&&v.hasAttribute("formAction")){if(p=v,k=v[Kt]||null)O=k.formAction;else if(Km(p)!==null)continue}else O=k.action;typeof O=="function"?i[u+1]=O:(i.splice(u,3),u-=3),fv(i)}}}function Jm(t){this._internalRoot=t}Wc.prototype.render=Jm.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(a(409));var i=s.current,u=vn();ov(i,u,t,s,null,null)},Wc.prototype.unmount=Jm.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;ov(t.current,2,null,t,null,null),Mc(),s[Ks]=null}};function Wc(t){this._internalRoot=t}Wc.prototype.unstable_scheduleHydration=function(t){if(t){var s=Ll();t={blockedOn:null,target:t,priority:s};for(var i=0;i<wr.length&&s!==0&&s<wr[i].priority;i++);wr.splice(i,0,t),i===0&&uv(t)}};var mv=n.version;if(mv!=="19.1.1")throw Error(a(527,mv,"19.1.1"));L.findDOMNode=function(t){var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(a(188)):(t=Object.keys(t).join(","),Error(a(268,t)));return t=m(s),t=t!==null?h(t):null,t=t===null?null:t.stateNode,t};var ZE={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kc.isDisabled&&Kc.supportsFiber)try{_e=Kc.inject(ZE),xe=Kc}catch{}}return Fi.createRoot=function(t,s){if(!l(t))throw Error(a(299));var i=!1,u="",p=T0,v=A0,k=M0,O=null;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(p=s.onUncaughtError),s.onCaughtError!==void 0&&(v=s.onCaughtError),s.onRecoverableError!==void 0&&(k=s.onRecoverableError),s.unstable_transitionCallbacks!==void 0&&(O=s.unstable_transitionCallbacks)),s=sv(t,1,!1,null,null,i,u,p,v,k,O,null),t[Ks]=s.current,zm(t),new Jm(s)},Fi.hydrateRoot=function(t,s,i){if(!l(t))throw Error(a(299));var u=!1,p="",v=T0,k=A0,O=M0,F=null,se=null;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(p=i.identifierPrefix),i.onUncaughtError!==void 0&&(v=i.onUncaughtError),i.onCaughtError!==void 0&&(k=i.onCaughtError),i.onRecoverableError!==void 0&&(O=i.onRecoverableError),i.unstable_transitionCallbacks!==void 0&&(F=i.unstable_transitionCallbacks),i.formState!==void 0&&(se=i.formState)),s=sv(t,1,!0,s,i??null,u,p,v,k,O,F,se),s.context=rv(null),i=s.current,u=vn(),u=mn(u),p=rr(u),p.callback=null,or(i,p,u),i=u,s.current.lanes=i,dt(s,i),os(s),t[Ks]=s.current,zm(t),new Wc(s)},Fi.version="19.1.1",Fi}var jv;function oC(){if(jv)return nh.exports;jv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),nh.exports=rC(),nh.exports}var aC=oC();function Sv(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function ad(...e){return n=>{let r=!1;const a=e.map(l=>{const c=Sv(l,n);return!r&&typeof c=="function"&&(r=!0),c});if(r)return()=>{for(let l=0;l<a.length;l++){const c=a[l];typeof c=="function"?c():Sv(e[l],null)}}}}function rt(...e){return w.useCallback(ad(...e),e)}function ja(e){const n=lC(e),r=w.forwardRef((a,l)=>{const{children:c,...d}=a,f=w.Children.toArray(c),m=f.find(uC);if(m){const h=m.props.children,g=f.map(x=>x===m?w.Children.count(h)>1?w.Children.only(null):w.isValidElement(h)?h.props.children:null:x);return o.jsx(n,{...d,ref:l,children:w.isValidElement(h)?w.cloneElement(h,void 0,g):null})}return o.jsx(n,{...d,ref:l,children:c})});return r.displayName=`${e}.Slot`,r}var iC=ja("Slot");function lC(e){const n=w.forwardRef((r,a)=>{const{children:l,...c}=r;if(w.isValidElement(l)){const d=fC(l),f=dC(c,l.props);return l.type!==w.Fragment&&(f.ref=a?ad(a,d):d),w.cloneElement(l,f)}return w.Children.count(l)>1?w.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var bw=Symbol("radix.slottable");function cC(e){const n=({children:r})=>o.jsx(o.Fragment,{children:r});return n.displayName=`${e}.Slottable`,n.__radixId=bw,n}function uC(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===bw}function dC(e,n){const r={...n};for(const a in n){const l=e[a],c=n[a];/^on[A-Z]/.test(a)?l&&c?r[a]=(...f)=>{const m=c(...f);return l(...f),m}:l&&(r[a]=l):a==="style"?r[a]={...l,...c}:a==="className"&&(r[a]=[l,c].filter(Boolean).join(" "))}return{...e,...r}}function fC(e){let n=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function ww(e){var n,r,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(n=0;n<l;n++)e[n]&&(r=ww(e[n]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function Nw(){for(var e,n,r=0,a="",l=arguments.length;r<l;r++)(e=arguments[r])&&(n=ww(e))&&(a&&(a+=" "),a+=n);return a}const _v=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ev=Nw,jw=(e,n)=>r=>{var a;if(n?.variants==null)return Ev(e,r?.class,r?.className);const{variants:l,defaultVariants:c}=n,d=Object.keys(l).map(h=>{const g=r?.[h],x=c?.[h];if(g===null)return null;const y=_v(g)||_v(x);return l[h][y]}),f=r&&Object.entries(r).reduce((h,g)=>{let[x,y]=g;return y===void 0||(h[x]=y),h},{}),m=n==null||(a=n.compoundVariants)===null||a===void 0?void 0:a.reduce((h,g)=>{let{class:x,className:y,...b}=g;return Object.entries(b).every(j=>{let[N,S]=j;return Array.isArray(S)?S.includes({...c,...f}[N]):{...c,...f}[N]===S})?[...h,x,y]:h},[]);return Ev(e,d,m,r?.class,r?.className)},kp="-",mC=e=>{const n=pC(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:d=>{const f=d.split(kp);return f[0]===""&&f.length!==1&&f.shift(),Sw(f,n)||hC(d)},getConflictingClassGroupIds:(d,f)=>{const m=r[d]||[];return f&&a[d]?[...m,...a[d]]:m}}},Sw=(e,n)=>{if(e.length===0)return n.classGroupId;const r=e[0],a=n.nextPart.get(r),l=a?Sw(e.slice(1),a):void 0;if(l)return l;if(n.validators.length===0)return;const c=e.join(kp);return n.validators.find(({validator:d})=>d(c))?.classGroupId},Cv=/^\[(.+)\]$/,hC=e=>{if(Cv.test(e)){const n=Cv.exec(e)[1],r=n?.substring(0,n.indexOf(":"));if(r)return"arbitrary.."+r}},pC=e=>{const{theme:n,classGroups:r}=e,a={nextPart:new Map,validators:[]};for(const l in r)Uh(r[l],a,l,n);return a},Uh=(e,n,r,a)=>{e.forEach(l=>{if(typeof l=="string"){const c=l===""?n:kv(n,l);c.classGroupId=r;return}if(typeof l=="function"){if(gC(l)){Uh(l(a),n,r,a);return}n.validators.push({validator:l,classGroupId:r});return}Object.entries(l).forEach(([c,d])=>{Uh(d,kv(n,c),r,a)})})},kv=(e,n)=>{let r=e;return n.split(kp).forEach(a=>{r.nextPart.has(a)||r.nextPart.set(a,{nextPart:new Map,validators:[]}),r=r.nextPart.get(a)}),r},gC=e=>e.isThemeGetter,xC=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,r=new Map,a=new Map;const l=(c,d)=>{r.set(c,d),n++,n>e&&(n=0,a=r,r=new Map)};return{get(c){let d=r.get(c);if(d!==void 0)return d;if((d=a.get(c))!==void 0)return l(c,d),d},set(c,d){r.has(c)?r.set(c,d):l(c,d)}}},Bh="!",Vh=":",yC=Vh.length,vC=e=>{const{prefix:n,experimentalParseClassName:r}=e;let a=l=>{const c=[];let d=0,f=0,m=0,h;for(let j=0;j<l.length;j++){let N=l[j];if(d===0&&f===0){if(N===Vh){c.push(l.slice(m,j)),m=j+yC;continue}if(N==="/"){h=j;continue}}N==="["?d++:N==="]"?d--:N==="("?f++:N===")"&&f--}const g=c.length===0?l:l.substring(m),x=bC(g),y=x!==g,b=h&&h>m?h-m:void 0;return{modifiers:c,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:b}};if(n){const l=n+Vh,c=a;a=d=>d.startsWith(l)?c(d.substring(l.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:d,maybePostfixModifierPosition:void 0}}if(r){const l=a;a=c=>r({className:c,parseClassName:l})}return a},bC=e=>e.endsWith(Bh)?e.substring(0,e.length-1):e.startsWith(Bh)?e.substring(1):e,wC=e=>{const n=Object.fromEntries(e.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const l=[];let c=[];return a.forEach(d=>{d[0]==="["||n[d]?(l.push(...c.sort(),d),c=[]):c.push(d)}),l.push(...c.sort()),l}},NC=e=>({cache:xC(e.cacheSize),parseClassName:vC(e),sortModifiers:wC(e),...mC(e)}),jC=/\s+/,SC=(e,n)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:l,sortModifiers:c}=n,d=[],f=e.trim().split(jC);let m="";for(let h=f.length-1;h>=0;h-=1){const g=f[h],{isExternal:x,modifiers:y,hasImportantModifier:b,baseClassName:j,maybePostfixModifierPosition:N}=r(g);if(x){m=g+(m.length>0?" "+m:m);continue}let S=!!N,_=a(S?j.substring(0,N):j);if(!_){if(!S){m=g+(m.length>0?" "+m:m);continue}if(_=a(j),!_){m=g+(m.length>0?" "+m:m);continue}S=!1}const A=c(y).join(":"),E=b?A+Bh:A,M=E+_;if(d.includes(M))continue;d.push(M);const T=l(_,S);for(let D=0;D<T.length;++D){const z=T[D];d.push(E+z)}m=g+(m.length>0?" "+m:m)}return m};function _C(){let e=0,n,r,a="";for(;e<arguments.length;)(n=arguments[e++])&&(r=_w(n))&&(a&&(a+=" "),a+=r);return a}const _w=e=>{if(typeof e=="string")return e;let n,r="";for(let a=0;a<e.length;a++)e[a]&&(n=_w(e[a]))&&(r&&(r+=" "),r+=n);return r};function EC(e,...n){let r,a,l,c=d;function d(m){const h=n.reduce((g,x)=>x(g),e());return r=NC(h),a=r.cache.get,l=r.cache.set,c=f,f(m)}function f(m){const h=a(m);if(h)return h;const g=SC(m,r);return l(m,g),g}return function(){return c(_C.apply(null,arguments))}}const Lt=e=>{const n=r=>r[e]||[];return n.isThemeGetter=!0,n},Ew=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Cw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,CC=/^\d+\/\d+$/,kC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,TC=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,AC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,MC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,la=e=>CC.test(e),Je=e=>!!e&&!Number.isNaN(Number(e)),jr=e=>!!e&&Number.isInteger(Number(e)),ah=e=>e.endsWith("%")&&Je(e.slice(0,-1)),Ps=e=>kC.test(e),DC=()=>!0,OC=e=>TC.test(e)&&!AC.test(e),kw=()=>!1,zC=e=>MC.test(e),IC=e=>RC.test(e),LC=e=>!De(e)&&!Oe(e),$C=e=>La(e,Mw,kw),De=e=>Ew.test(e),ao=e=>La(e,Rw,OC),ih=e=>La(e,VC,Je),Tv=e=>La(e,Tw,kw),PC=e=>La(e,Aw,IC),Qc=e=>La(e,Dw,zC),Oe=e=>Cw.test(e),Yi=e=>$a(e,Rw),HC=e=>$a(e,qC),Av=e=>$a(e,Tw),UC=e=>$a(e,Mw),BC=e=>$a(e,Aw),Jc=e=>$a(e,Dw,!0),La=(e,n,r)=>{const a=Ew.exec(e);return a?a[1]?n(a[1]):r(a[2]):!1},$a=(e,n,r=!1)=>{const a=Cw.exec(e);return a?a[1]?n(a[1]):r:!1},Tw=e=>e==="position"||e==="percentage",Aw=e=>e==="image"||e==="url",Mw=e=>e==="length"||e==="size"||e==="bg-size",Rw=e=>e==="length",VC=e=>e==="number",qC=e=>e==="family-name",Dw=e=>e==="shadow",FC=()=>{const e=Lt("color"),n=Lt("font"),r=Lt("text"),a=Lt("font-weight"),l=Lt("tracking"),c=Lt("leading"),d=Lt("breakpoint"),f=Lt("container"),m=Lt("spacing"),h=Lt("radius"),g=Lt("shadow"),x=Lt("inset-shadow"),y=Lt("text-shadow"),b=Lt("drop-shadow"),j=Lt("blur"),N=Lt("perspective"),S=Lt("aspect"),_=Lt("ease"),A=Lt("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...M(),Oe,De],D=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],H=()=>[Oe,De,m],q=()=>[la,"full","auto",...H()],X=()=>[jr,"none","subgrid",Oe,De],W=()=>["auto",{span:["full",jr,Oe,De]},jr,Oe,De],G=()=>[jr,"auto",Oe,De],ne=()=>["auto","min","max","fr",Oe,De],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...H()],L=()=>[la,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],I=()=>[e,Oe,De],P=()=>[...M(),Av,Tv,{position:[Oe,De]}],C=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",UC,$C,{size:[Oe,De]}],Y=()=>[ah,Yi,ao],V=()=>["","none","full",h,Oe,De],J=()=>["",Je,Yi,ao],ce=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>[Je,ah,Av,Tv],ie=()=>["","none",j,Oe,De],ge=()=>["none",Je,Oe,De],Ee=()=>["none",Je,Oe,De],Ne=()=>[Je,Oe,De],ve=()=>[la,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ps],breakpoint:[Ps],color:[DC],container:[Ps],"drop-shadow":[Ps],ease:["in","out","in-out"],font:[LC],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ps],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ps],shadow:[Ps],spacing:["px",Je],text:[Ps],"text-shadow":[Ps],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",la,De,Oe,S]}],container:["container"],columns:[{columns:[Je,De,Oe,f]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{start:q()}],end:[{end:q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[jr,"auto",Oe,De]}],basis:[{basis:[la,"full","auto",f,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Je,la,"auto","initial","none",De]}],grow:[{grow:["",Je,Oe,De]}],shrink:[{shrink:["",Je,Oe,De]}],order:[{order:[jr,"first","last","none",Oe,De]}],"grid-cols":[{"grid-cols":X()}],"col-start-end":[{col:W()}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":X()}],"row-start-end":[{row:W()}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ne()}],"auto-rows":[{"auto-rows":ne()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],w:[{w:[f,"screen",...L()]}],"min-w":[{"min-w":[f,"screen","none",...L()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[d]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",r,Yi,ao]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,Oe,ih]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ah,De]}],"font-family":[{font:[HC,De,n]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[l,Oe,De]}],"line-clamp":[{"line-clamp":[Je,"none",Oe,ih]}],leading:[{leading:[c,...H()]}],"list-image":[{"list-image":["none",Oe,De]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Oe,De]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ce(),"wavy"]}],"text-decoration-thickness":[{decoration:[Je,"from-font","auto",Oe,ao]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Je,"auto",Oe,De]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Oe,De]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Oe,De]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:C()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},jr,Oe,De],radial:["",Oe,De],conic:[jr,Oe,De]},BC,PC]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ce(),"hidden","none"]}],"divide-style":[{divide:[...ce(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...ce(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Je,Oe,De]}],"outline-w":[{outline:["",Je,Yi,ao]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",g,Jc,Qc]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",x,Jc,Qc]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Je,ao]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",y,Jc,Qc]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Je,Oe,De]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Je]}],"mask-image-linear-from-pos":[{"mask-linear-from":ee()}],"mask-image-linear-to-pos":[{"mask-linear-to":ee()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ee()}],"mask-image-t-to-pos":[{"mask-t-to":ee()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ee()}],"mask-image-r-to-pos":[{"mask-r-to":ee()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ee()}],"mask-image-b-to-pos":[{"mask-b-to":ee()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ee()}],"mask-image-l-to-pos":[{"mask-l-to":ee()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ee()}],"mask-image-x-to-pos":[{"mask-x-to":ee()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ee()}],"mask-image-y-to-pos":[{"mask-y-to":ee()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Oe,De]}],"mask-image-radial-from-pos":[{"mask-radial-from":ee()}],"mask-image-radial-to-pos":[{"mask-radial-to":ee()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[Je]}],"mask-image-conic-from-pos":[{"mask-conic-from":ee()}],"mask-image-conic-to-pos":[{"mask-conic-to":ee()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:C()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Oe,De]}],filter:[{filter:["","none",Oe,De]}],blur:[{blur:ie()}],brightness:[{brightness:[Je,Oe,De]}],contrast:[{contrast:[Je,Oe,De]}],"drop-shadow":[{"drop-shadow":["","none",b,Jc,Qc]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",Je,Oe,De]}],"hue-rotate":[{"hue-rotate":[Je,Oe,De]}],invert:[{invert:["",Je,Oe,De]}],saturate:[{saturate:[Je,Oe,De]}],sepia:[{sepia:["",Je,Oe,De]}],"backdrop-filter":[{"backdrop-filter":["","none",Oe,De]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[Je,Oe,De]}],"backdrop-contrast":[{"backdrop-contrast":[Je,Oe,De]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Je,Oe,De]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Je,Oe,De]}],"backdrop-invert":[{"backdrop-invert":["",Je,Oe,De]}],"backdrop-opacity":[{"backdrop-opacity":[Je,Oe,De]}],"backdrop-saturate":[{"backdrop-saturate":[Je,Oe,De]}],"backdrop-sepia":[{"backdrop-sepia":["",Je,Oe,De]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Oe,De]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Je,"initial",Oe,De]}],ease:[{ease:["linear","initial",_,Oe,De]}],delay:[{delay:[Je,Oe,De]}],animate:[{animate:["none",A,Oe,De]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,Oe,De]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:Ee()}],"scale-x":[{"scale-x":Ee()}],"scale-y":[{"scale-y":Ee()}],"scale-z":[{"scale-z":Ee()}],"scale-3d":["scale-3d"],skew:[{skew:Ne()}],"skew-x":[{"skew-x":Ne()}],"skew-y":[{"skew-y":Ne()}],transform:[{transform:[Oe,De,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Oe,De]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Oe,De]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[Je,Yi,ao,ih]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},YC=EC(FC);function We(...e){return YC(Nw(e))}const GC=jw("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Le({className:e,variant:n,size:r,asChild:a=!1,...l}){const c=a?iC:"button";return o.jsx(c,{"data-slot":"button",className:We(GC({variant:n,size:r,className:e})),...l})}const XC=jw("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ut({className:e,variant:n,...r}){return o.jsx("div",{className:We(XC({variant:n}),e),...r})}function ke(e,n,{checkForDefaultPrevented:r=!0}={}){return function(l){if(e?.(l),r===!1||!l.defaultPrevented)return n?.(l)}}function Kn(e,n=[]){let r=[];function a(c,d){const f=w.createContext(d),m=r.length;r=[...r,d];const h=x=>{const{scope:y,children:b,...j}=x,N=y?.[e]?.[m]||f,S=w.useMemo(()=>j,Object.values(j));return o.jsx(N.Provider,{value:S,children:b})};h.displayName=c+"Provider";function g(x,y){const b=y?.[e]?.[m]||f,j=w.useContext(b);if(j)return j;if(d!==void 0)return d;throw new Error(`\`${x}\` must be used within \`${c}\``)}return[h,g]}const l=()=>{const c=r.map(d=>w.createContext(d));return function(f){const m=f?.[e]||c;return w.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return l.scopeName=e,[a,ZC(l,...n)]}function ZC(...e){const n=e[0];if(e.length===1)return n;const r=()=>{const a=e.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(c){const d=a.reduce((f,{useScope:m,scopeName:h})=>{const x=m(c)[`__scope${h}`];return{...f,...x}},{});return w.useMemo(()=>({[`__scope${n.scopeName}`]:d}),[d])}};return r.scopeName=n.scopeName,r}var Wt=globalThis?.document?w.useLayoutEffect:()=>{},WC=yw[" useInsertionEffect ".trim().toString()]||Wt;function Ar({prop:e,defaultProp:n,onChange:r=()=>{},caller:a}){const[l,c,d]=KC({defaultProp:n,onChange:r}),f=e!==void 0,m=f?e:l;{const g=w.useRef(e!==void 0);w.useEffect(()=>{const x=g.current;x!==f&&console.warn(`${a} is changing from ${x?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=f},[f,a])}const h=w.useCallback(g=>{if(f){const x=QC(g)?g(e):g;x!==e&&d.current?.(x)}else c(g)},[f,e,c,d]);return[m,h]}function KC({defaultProp:e,onChange:n}){const[r,a]=w.useState(e),l=w.useRef(r),c=w.useRef(n);return WC(()=>{c.current=n},[n]),w.useEffect(()=>{l.current!==r&&(c.current?.(r),l.current=r)},[r,l]),[r,a,c]}function QC(e){return typeof e=="function"}var Nl=vw();const JC=Cp(Nl);var ek=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ye=ek.reduce((e,n)=>{const r=ja(`Primitive.${n}`),a=w.forwardRef((l,c)=>{const{asChild:d,...f}=l,m=d?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(m,{...f,ref:c})});return a.displayName=`Primitive.${n}`,{...e,[n]:a}},{});function Ow(e,n){e&&Nl.flushSync(()=>e.dispatchEvent(n))}function Tp(e){const n=e+"CollectionProvider",[r,a]=Kn(n),[l,c]=r(n,{collectionRef:{current:null},itemMap:new Map}),d=N=>{const{scope:S,children:_}=N,A=Nn.useRef(null),E=Nn.useRef(new Map).current;return o.jsx(l,{scope:S,itemMap:E,collectionRef:A,children:_})};d.displayName=n;const f=e+"CollectionSlot",m=ja(f),h=Nn.forwardRef((N,S)=>{const{scope:_,children:A}=N,E=c(f,_),M=rt(S,E.collectionRef);return o.jsx(m,{ref:M,children:A})});h.displayName=f;const g=e+"CollectionItemSlot",x="data-radix-collection-item",y=ja(g),b=Nn.forwardRef((N,S)=>{const{scope:_,children:A,...E}=N,M=Nn.useRef(null),T=rt(S,M),D=c(g,_);return Nn.useEffect(()=>(D.itemMap.set(M,{ref:M,...E}),()=>void D.itemMap.delete(M))),o.jsx(y,{[x]:"",ref:T,children:A})});b.displayName=g;function j(N){const S=c(e+"CollectionConsumer",N);return Nn.useCallback(()=>{const A=S.collectionRef.current;if(!A)return[];const E=Array.from(A.querySelectorAll(`[${x}]`));return Array.from(S.itemMap.values()).sort((D,z)=>E.indexOf(D.ref.current)-E.indexOf(z.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:d,Slot:h,ItemSlot:b},j,a]}var tk=w.createContext(void 0);function jl(e){const n=w.useContext(tk);return e||n||"ltr"}function Zt(e){const n=w.useRef(e);return w.useEffect(()=>{n.current=e}),w.useMemo(()=>(...r)=>n.current?.(...r),[])}function nk(e,n=globalThis?.document){const r=Zt(e);w.useEffect(()=>{const a=l=>{l.key==="Escape"&&r(l)};return n.addEventListener("keydown",a,{capture:!0}),()=>n.removeEventListener("keydown",a,{capture:!0})},[r,n])}var sk="DismissableLayer",qh="dismissableLayer.update",rk="dismissableLayer.pointerDownOutside",ok="dismissableLayer.focusOutside",Mv,zw=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),id=w.forwardRef((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:f,...m}=e,h=w.useContext(zw),[g,x]=w.useState(null),y=g?.ownerDocument??globalThis?.document,[,b]=w.useState({}),j=rt(n,z=>x(z)),N=Array.from(h.layers),[S]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),_=N.indexOf(S),A=g?N.indexOf(g):-1,E=h.layersWithOutsidePointerEventsDisabled.size>0,M=A>=_,T=lk(z=>{const H=z.target,q=[...h.branches].some(X=>X.contains(H));!M||q||(l?.(z),d?.(z),z.defaultPrevented||f?.())},y),D=ck(z=>{const H=z.target;[...h.branches].some(X=>X.contains(H))||(c?.(z),d?.(z),z.defaultPrevented||f?.())},y);return nk(z=>{A===h.layers.size-1&&(a?.(z),!z.defaultPrevented&&f&&(z.preventDefault(),f()))},y),w.useEffect(()=>{if(g)return r&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Mv=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(g)),h.layers.add(g),Rv(),()=>{r&&h.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=Mv)}},[g,y,r,h]),w.useEffect(()=>()=>{g&&(h.layers.delete(g),h.layersWithOutsidePointerEventsDisabled.delete(g),Rv())},[g,h]),w.useEffect(()=>{const z=()=>b({});return document.addEventListener(qh,z),()=>document.removeEventListener(qh,z)},[]),o.jsx(Ye.div,{...m,ref:j,style:{pointerEvents:E?M?"auto":"none":void 0,...e.style},onFocusCapture:ke(e.onFocusCapture,D.onFocusCapture),onBlurCapture:ke(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:ke(e.onPointerDownCapture,T.onPointerDownCapture)})});id.displayName=sk;var ak="DismissableLayerBranch",ik=w.forwardRef((e,n)=>{const r=w.useContext(zw),a=w.useRef(null),l=rt(n,a);return w.useEffect(()=>{const c=a.current;if(c)return r.branches.add(c),()=>{r.branches.delete(c)}},[r.branches]),o.jsx(Ye.div,{...e,ref:l})});ik.displayName=ak;function lk(e,n=globalThis?.document){const r=Zt(e),a=w.useRef(!1),l=w.useRef(()=>{});return w.useEffect(()=>{const c=f=>{if(f.target&&!a.current){let m=function(){Iw(rk,r,h,{discrete:!0})};const h={originalEvent:f};f.pointerType==="touch"?(n.removeEventListener("click",l.current),l.current=m,n.addEventListener("click",l.current,{once:!0})):m()}else n.removeEventListener("click",l.current);a.current=!1},d=window.setTimeout(()=>{n.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(d),n.removeEventListener("pointerdown",c),n.removeEventListener("click",l.current)}},[n,r]),{onPointerDownCapture:()=>a.current=!0}}function ck(e,n=globalThis?.document){const r=Zt(e),a=w.useRef(!1);return w.useEffect(()=>{const l=c=>{c.target&&!a.current&&Iw(ok,r,{originalEvent:c},{discrete:!1})};return n.addEventListener("focusin",l),()=>n.removeEventListener("focusin",l)},[n,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function Rv(){const e=new CustomEvent(qh);document.dispatchEvent(e)}function Iw(e,n,r,{discrete:a}){const l=r.originalEvent.target,c=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});n&&l.addEventListener(e,n,{once:!0}),a?Ow(l,c):l.dispatchEvent(c)}var lh=0;function Lw(){w.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Dv()),document.body.insertAdjacentElement("beforeend",e[1]??Dv()),lh++,()=>{lh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),lh--}},[])}function Dv(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ch="focusScope.autoFocusOnMount",uh="focusScope.autoFocusOnUnmount",Ov={bubbles:!1,cancelable:!0},uk="FocusScope",Ap=w.forwardRef((e,n)=>{const{loop:r=!1,trapped:a=!1,onMountAutoFocus:l,onUnmountAutoFocus:c,...d}=e,[f,m]=w.useState(null),h=Zt(l),g=Zt(c),x=w.useRef(null),y=rt(n,N=>m(N)),b=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(a){let N=function(E){if(b.paused||!f)return;const M=E.target;f.contains(M)?x.current=M:Er(x.current,{select:!0})},S=function(E){if(b.paused||!f)return;const M=E.relatedTarget;M!==null&&(f.contains(M)||Er(x.current,{select:!0}))},_=function(E){if(document.activeElement===document.body)for(const T of E)T.removedNodes.length>0&&Er(f)};document.addEventListener("focusin",N),document.addEventListener("focusout",S);const A=new MutationObserver(_);return f&&A.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",S),A.disconnect()}}},[a,f,b.paused]),w.useEffect(()=>{if(f){Iv.add(b);const N=document.activeElement;if(!f.contains(N)){const _=new CustomEvent(ch,Ov);f.addEventListener(ch,h),f.dispatchEvent(_),_.defaultPrevented||(dk(gk($w(f)),{select:!0}),document.activeElement===N&&Er(f))}return()=>{f.removeEventListener(ch,h),setTimeout(()=>{const _=new CustomEvent(uh,Ov);f.addEventListener(uh,g),f.dispatchEvent(_),_.defaultPrevented||Er(N??document.body,{select:!0}),f.removeEventListener(uh,g),Iv.remove(b)},0)}}},[f,h,g,b]);const j=w.useCallback(N=>{if(!r&&!a||b.paused)return;const S=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,_=document.activeElement;if(S&&_){const A=N.currentTarget,[E,M]=fk(A);E&&M?!N.shiftKey&&_===M?(N.preventDefault(),r&&Er(E,{select:!0})):N.shiftKey&&_===E&&(N.preventDefault(),r&&Er(M,{select:!0})):_===A&&N.preventDefault()}},[r,a,b.paused]);return o.jsx(Ye.div,{tabIndex:-1,...d,ref:y,onKeyDown:j})});Ap.displayName=uk;function dk(e,{select:n=!1}={}){const r=document.activeElement;for(const a of e)if(Er(a,{select:n}),document.activeElement!==r)return}function fk(e){const n=$w(e),r=zv(n,e),a=zv(n.reverse(),e);return[r,a]}function $w(e){const n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const l=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||l?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)n.push(r.currentNode);return n}function zv(e,n){for(const r of e)if(!mk(r,{upTo:n}))return r}function mk(e,{upTo:n}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(n!==void 0&&e===n)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function hk(e){return e instanceof HTMLInputElement&&"select"in e}function Er(e,{select:n=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&hk(e)&&n&&e.select()}}var Iv=pk();function pk(){let e=[];return{add(n){const r=e[0];n!==r&&r?.pause(),e=Lv(e,n),e.unshift(n)},remove(n){e=Lv(e,n),e[0]?.resume()}}}function Lv(e,n){const r=[...e],a=r.indexOf(n);return a!==-1&&r.splice(a,1),r}function gk(e){return e.filter(n=>n.tagName!=="A")}var xk=yw[" useId ".trim().toString()]||(()=>{}),yk=0;function Mr(e){const[n,r]=w.useState(xk());return Wt(()=>{r(a=>a??String(yk++))},[e]),n?`radix-${n}`:""}const vk=["top","right","bottom","left"],Rr=Math.min,jn=Math.max,Du=Math.round,eu=Math.floor,ds=e=>({x:e,y:e}),bk={left:"right",right:"left",bottom:"top",top:"bottom"},wk={start:"end",end:"start"};function Fh(e,n,r){return jn(e,Rr(n,r))}function Gs(e,n){return typeof e=="function"?e(n):e}function Xs(e){return e.split("-")[0]}function Pa(e){return e.split("-")[1]}function Mp(e){return e==="x"?"y":"x"}function Rp(e){return e==="y"?"height":"width"}const Nk=new Set(["top","bottom"]);function cs(e){return Nk.has(Xs(e))?"y":"x"}function Dp(e){return Mp(cs(e))}function jk(e,n,r){r===void 0&&(r=!1);const a=Pa(e),l=Dp(e),c=Rp(l);let d=l==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return n.reference[c]>n.floating[c]&&(d=Ou(d)),[d,Ou(d)]}function Sk(e){const n=Ou(e);return[Yh(e),n,Yh(n)]}function Yh(e){return e.replace(/start|end/g,n=>wk[n])}const $v=["left","right"],Pv=["right","left"],_k=["top","bottom"],Ek=["bottom","top"];function Ck(e,n,r){switch(e){case"top":case"bottom":return r?n?Pv:$v:n?$v:Pv;case"left":case"right":return n?_k:Ek;default:return[]}}function kk(e,n,r,a){const l=Pa(e);let c=Ck(Xs(e),r==="start",a);return l&&(c=c.map(d=>d+"-"+l),n&&(c=c.concat(c.map(Yh)))),c}function Ou(e){return e.replace(/left|right|bottom|top/g,n=>bk[n])}function Tk(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pw(e){return typeof e!="number"?Tk(e):{top:e,right:e,bottom:e,left:e}}function zu(e){const{x:n,y:r,width:a,height:l}=e;return{width:a,height:l,top:r,left:n,right:n+a,bottom:r+l,x:n,y:r}}function Hv(e,n,r){let{reference:a,floating:l}=e;const c=cs(n),d=Dp(n),f=Rp(d),m=Xs(n),h=c==="y",g=a.x+a.width/2-l.width/2,x=a.y+a.height/2-l.height/2,y=a[f]/2-l[f]/2;let b;switch(m){case"top":b={x:g,y:a.y-l.height};break;case"bottom":b={x:g,y:a.y+a.height};break;case"right":b={x:a.x+a.width,y:x};break;case"left":b={x:a.x-l.width,y:x};break;default:b={x:a.x,y:a.y}}switch(Pa(n)){case"start":b[d]-=y*(r&&h?-1:1);break;case"end":b[d]+=y*(r&&h?-1:1);break}return b}const Ak=async(e,n,r)=>{const{placement:a="bottom",strategy:l="absolute",middleware:c=[],platform:d}=r,f=c.filter(Boolean),m=await(d.isRTL==null?void 0:d.isRTL(n));let h=await d.getElementRects({reference:e,floating:n,strategy:l}),{x:g,y:x}=Hv(h,a,m),y=a,b={},j=0;for(let N=0;N<f.length;N++){const{name:S,fn:_}=f[N],{x:A,y:E,data:M,reset:T}=await _({x:g,y:x,initialPlacement:a,placement:y,strategy:l,middlewareData:b,rects:h,platform:d,elements:{reference:e,floating:n}});g=A??g,x=E??x,b={...b,[S]:{...b[S],...M}},T&&j<=50&&(j++,typeof T=="object"&&(T.placement&&(y=T.placement),T.rects&&(h=T.rects===!0?await d.getElementRects({reference:e,floating:n,strategy:l}):T.rects),{x:g,y:x}=Hv(h,y,m)),N=-1)}return{x:g,y:x,placement:y,strategy:l,middlewareData:b}};async function ol(e,n){var r;n===void 0&&(n={});const{x:a,y:l,platform:c,rects:d,elements:f,strategy:m}=e,{boundary:h="clippingAncestors",rootBoundary:g="viewport",elementContext:x="floating",altBoundary:y=!1,padding:b=0}=Gs(n,e),j=Pw(b),S=f[y?x==="floating"?"reference":"floating":x],_=zu(await c.getClippingRect({element:(r=await(c.isElement==null?void 0:c.isElement(S)))==null||r?S:S.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:h,rootBoundary:g,strategy:m})),A=x==="floating"?{x:a,y:l,width:d.floating.width,height:d.floating.height}:d.reference,E=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),M=await(c.isElement==null?void 0:c.isElement(E))?await(c.getScale==null?void 0:c.getScale(E))||{x:1,y:1}:{x:1,y:1},T=zu(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:A,offsetParent:E,strategy:m}):A);return{top:(_.top-T.top+j.top)/M.y,bottom:(T.bottom-_.bottom+j.bottom)/M.y,left:(_.left-T.left+j.left)/M.x,right:(T.right-_.right+j.right)/M.x}}const Mk=e=>({name:"arrow",options:e,async fn(n){const{x:r,y:a,placement:l,rects:c,platform:d,elements:f,middlewareData:m}=n,{element:h,padding:g=0}=Gs(e,n)||{};if(h==null)return{};const x=Pw(g),y={x:r,y:a},b=Dp(l),j=Rp(b),N=await d.getDimensions(h),S=b==="y",_=S?"top":"left",A=S?"bottom":"right",E=S?"clientHeight":"clientWidth",M=c.reference[j]+c.reference[b]-y[b]-c.floating[j],T=y[b]-c.reference[b],D=await(d.getOffsetParent==null?void 0:d.getOffsetParent(h));let z=D?D[E]:0;(!z||!await(d.isElement==null?void 0:d.isElement(D)))&&(z=f.floating[E]||c.floating[j]);const H=M/2-T/2,q=z/2-N[j]/2-1,X=Rr(x[_],q),W=Rr(x[A],q),G=X,ne=z-N[j]-W,B=z/2-N[j]/2+H,U=Fh(G,B,ne),R=!m.arrow&&Pa(l)!=null&&B!==U&&c.reference[j]/2-(B<G?X:W)-N[j]/2<0,L=R?B<G?B-G:B-ne:0;return{[b]:y[b]+L,data:{[b]:U,centerOffset:B-U-L,...R&&{alignmentOffset:L}},reset:R}}}),Rk=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(n){var r,a;const{placement:l,middlewareData:c,rects:d,initialPlacement:f,platform:m,elements:h}=n,{mainAxis:g=!0,crossAxis:x=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:N=!0,...S}=Gs(e,n);if((r=c.arrow)!=null&&r.alignmentOffset)return{};const _=Xs(l),A=cs(f),E=Xs(f)===f,M=await(m.isRTL==null?void 0:m.isRTL(h.floating)),T=y||(E||!N?[Ou(f)]:Sk(f)),D=j!=="none";!y&&D&&T.push(...kk(f,N,j,M));const z=[f,...T],H=await ol(n,S),q=[];let X=((a=c.flip)==null?void 0:a.overflows)||[];if(g&&q.push(H[_]),x){const B=jk(l,d,M);q.push(H[B[0]],H[B[1]])}if(X=[...X,{placement:l,overflows:q}],!q.every(B=>B<=0)){var W,G;const B=(((W=c.flip)==null?void 0:W.index)||0)+1,U=z[B];if(U&&(!(x==="alignment"?A!==cs(U):!1)||X.every(I=>cs(I.placement)===A?I.overflows[0]>0:!0)))return{data:{index:B,overflows:X},reset:{placement:U}};let R=(G=X.filter(L=>L.overflows[0]<=0).sort((L,I)=>L.overflows[1]-I.overflows[1])[0])==null?void 0:G.placement;if(!R)switch(b){case"bestFit":{var ne;const L=(ne=X.filter(I=>{if(D){const P=cs(I.placement);return P===A||P==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(P=>P>0).reduce((P,C)=>P+C,0)]).sort((I,P)=>I[1]-P[1])[0])==null?void 0:ne[0];L&&(R=L);break}case"initialPlacement":R=f;break}if(l!==R)return{reset:{placement:R}}}return{}}}};function Uv(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function Bv(e){return vk.some(n=>e[n]>=0)}const Dk=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:r}=n,{strategy:a="referenceHidden",...l}=Gs(e,n);switch(a){case"referenceHidden":{const c=await ol(n,{...l,elementContext:"reference"}),d=Uv(c,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:Bv(d)}}}case"escaped":{const c=await ol(n,{...l,altBoundary:!0}),d=Uv(c,r.floating);return{data:{escapedOffsets:d,escaped:Bv(d)}}}default:return{}}}}},Hw=new Set(["left","top"]);async function Ok(e,n){const{placement:r,platform:a,elements:l}=e,c=await(a.isRTL==null?void 0:a.isRTL(l.floating)),d=Xs(r),f=Pa(r),m=cs(r)==="y",h=Hw.has(d)?-1:1,g=c&&m?-1:1,x=Gs(n,e);let{mainAxis:y,crossAxis:b,alignmentAxis:j}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return f&&typeof j=="number"&&(b=f==="end"?j*-1:j),m?{x:b*g,y:y*h}:{x:y*h,y:b*g}}const zk=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var r,a;const{x:l,y:c,placement:d,middlewareData:f}=n,m=await Ok(n,e);return d===((r=f.offset)==null?void 0:r.placement)&&(a=f.arrow)!=null&&a.alignmentOffset?{}:{x:l+m.x,y:c+m.y,data:{...m,placement:d}}}}},Ik=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:r,y:a,placement:l}=n,{mainAxis:c=!0,crossAxis:d=!1,limiter:f={fn:S=>{let{x:_,y:A}=S;return{x:_,y:A}}},...m}=Gs(e,n),h={x:r,y:a},g=await ol(n,m),x=cs(Xs(l)),y=Mp(x);let b=h[y],j=h[x];if(c){const S=y==="y"?"top":"left",_=y==="y"?"bottom":"right",A=b+g[S],E=b-g[_];b=Fh(A,b,E)}if(d){const S=x==="y"?"top":"left",_=x==="y"?"bottom":"right",A=j+g[S],E=j-g[_];j=Fh(A,j,E)}const N=f.fn({...n,[y]:b,[x]:j});return{...N,data:{x:N.x-r,y:N.y-a,enabled:{[y]:c,[x]:d}}}}}},Lk=function(e){return e===void 0&&(e={}),{options:e,fn(n){const{x:r,y:a,placement:l,rects:c,middlewareData:d}=n,{offset:f=0,mainAxis:m=!0,crossAxis:h=!0}=Gs(e,n),g={x:r,y:a},x=cs(l),y=Mp(x);let b=g[y],j=g[x];const N=Gs(f,n),S=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(m){const E=y==="y"?"height":"width",M=c.reference[y]-c.floating[E]+S.mainAxis,T=c.reference[y]+c.reference[E]-S.mainAxis;b<M?b=M:b>T&&(b=T)}if(h){var _,A;const E=y==="y"?"width":"height",M=Hw.has(Xs(l)),T=c.reference[x]-c.floating[E]+(M&&((_=d.offset)==null?void 0:_[x])||0)+(M?0:S.crossAxis),D=c.reference[x]+c.reference[E]+(M?0:((A=d.offset)==null?void 0:A[x])||0)-(M?S.crossAxis:0);j<T?j=T:j>D&&(j=D)}return{[y]:b,[x]:j}}}},$k=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){var r,a;const{placement:l,rects:c,platform:d,elements:f}=n,{apply:m=()=>{},...h}=Gs(e,n),g=await ol(n,h),x=Xs(l),y=Pa(l),b=cs(l)==="y",{width:j,height:N}=c.floating;let S,_;x==="top"||x==="bottom"?(S=x,_=y===(await(d.isRTL==null?void 0:d.isRTL(f.floating))?"start":"end")?"left":"right"):(_=x,S=y==="end"?"top":"bottom");const A=N-g.top-g.bottom,E=j-g.left-g.right,M=Rr(N-g[S],A),T=Rr(j-g[_],E),D=!n.middlewareData.shift;let z=M,H=T;if((r=n.middlewareData.shift)!=null&&r.enabled.x&&(H=E),(a=n.middlewareData.shift)!=null&&a.enabled.y&&(z=A),D&&!y){const X=jn(g.left,0),W=jn(g.right,0),G=jn(g.top,0),ne=jn(g.bottom,0);b?H=j-2*(X!==0||W!==0?X+W:jn(g.left,g.right)):z=N-2*(G!==0||ne!==0?G+ne:jn(g.top,g.bottom))}await m({...n,availableWidth:H,availableHeight:z});const q=await d.getDimensions(f.floating);return j!==q.width||N!==q.height?{reset:{rects:!0}}:{}}}};function ld(){return typeof window<"u"}function Ha(e){return Uw(e)?(e.nodeName||"").toLowerCase():"#document"}function _n(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function gs(e){var n;return(n=(Uw(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function Uw(e){return ld()?e instanceof Node||e instanceof _n(e).Node:!1}function Xn(e){return ld()?e instanceof Element||e instanceof _n(e).Element:!1}function ms(e){return ld()?e instanceof HTMLElement||e instanceof _n(e).HTMLElement:!1}function Vv(e){return!ld()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _n(e).ShadowRoot}const Pk=new Set(["inline","contents"]);function Sl(e){const{overflow:n,overflowX:r,overflowY:a,display:l}=Zn(e);return/auto|scroll|overlay|hidden|clip/.test(n+a+r)&&!Pk.has(l)}const Hk=new Set(["table","td","th"]);function Uk(e){return Hk.has(Ha(e))}const Bk=[":popover-open",":modal"];function cd(e){return Bk.some(n=>{try{return e.matches(n)}catch{return!1}})}const Vk=["transform","translate","scale","rotate","perspective"],qk=["transform","translate","scale","rotate","perspective","filter"],Fk=["paint","layout","strict","content"];function Op(e){const n=zp(),r=Xn(e)?Zn(e):e;return Vk.some(a=>r[a]?r[a]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!n&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!n&&(r.filter?r.filter!=="none":!1)||qk.some(a=>(r.willChange||"").includes(a))||Fk.some(a=>(r.contain||"").includes(a))}function Yk(e){let n=Dr(e);for(;ms(n)&&!Sa(n);){if(Op(n))return n;if(cd(n))return null;n=Dr(n)}return null}function zp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Gk=new Set(["html","body","#document"]);function Sa(e){return Gk.has(Ha(e))}function Zn(e){return _n(e).getComputedStyle(e)}function ud(e){return Xn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Dr(e){if(Ha(e)==="html")return e;const n=e.assignedSlot||e.parentNode||Vv(e)&&e.host||gs(e);return Vv(n)?n.host:n}function Bw(e){const n=Dr(e);return Sa(n)?e.ownerDocument?e.ownerDocument.body:e.body:ms(n)&&Sl(n)?n:Bw(n)}function al(e,n,r){var a;n===void 0&&(n=[]),r===void 0&&(r=!0);const l=Bw(e),c=l===((a=e.ownerDocument)==null?void 0:a.body),d=_n(l);if(c){const f=Gh(d);return n.concat(d,d.visualViewport||[],Sl(l)?l:[],f&&r?al(f):[])}return n.concat(l,al(l,[],r))}function Gh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Vw(e){const n=Zn(e);let r=parseFloat(n.width)||0,a=parseFloat(n.height)||0;const l=ms(e),c=l?e.offsetWidth:r,d=l?e.offsetHeight:a,f=Du(r)!==c||Du(a)!==d;return f&&(r=c,a=d),{width:r,height:a,$:f}}function Ip(e){return Xn(e)?e:e.contextElement}function xa(e){const n=Ip(e);if(!ms(n))return ds(1);const r=n.getBoundingClientRect(),{width:a,height:l,$:c}=Vw(n);let d=(c?Du(r.width):r.width)/a,f=(c?Du(r.height):r.height)/l;return(!d||!Number.isFinite(d))&&(d=1),(!f||!Number.isFinite(f))&&(f=1),{x:d,y:f}}const Xk=ds(0);function qw(e){const n=_n(e);return!zp()||!n.visualViewport?Xk:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function Zk(e,n,r){return n===void 0&&(n=!1),!r||n&&r!==_n(e)?!1:n}function po(e,n,r,a){n===void 0&&(n=!1),r===void 0&&(r=!1);const l=e.getBoundingClientRect(),c=Ip(e);let d=ds(1);n&&(a?Xn(a)&&(d=xa(a)):d=xa(e));const f=Zk(c,r,a)?qw(c):ds(0);let m=(l.left+f.x)/d.x,h=(l.top+f.y)/d.y,g=l.width/d.x,x=l.height/d.y;if(c){const y=_n(c),b=a&&Xn(a)?_n(a):a;let j=y,N=Gh(j);for(;N&&a&&b!==j;){const S=xa(N),_=N.getBoundingClientRect(),A=Zn(N),E=_.left+(N.clientLeft+parseFloat(A.paddingLeft))*S.x,M=_.top+(N.clientTop+parseFloat(A.paddingTop))*S.y;m*=S.x,h*=S.y,g*=S.x,x*=S.y,m+=E,h+=M,j=_n(N),N=Gh(j)}}return zu({width:g,height:x,x:m,y:h})}function dd(e,n){const r=ud(e).scrollLeft;return n?n.left+r:po(gs(e)).left+r}function Fw(e,n){const r=e.getBoundingClientRect(),a=r.left+n.scrollLeft-dd(e,r),l=r.top+n.scrollTop;return{x:a,y:l}}function Wk(e){let{elements:n,rect:r,offsetParent:a,strategy:l}=e;const c=l==="fixed",d=gs(a),f=n?cd(n.floating):!1;if(a===d||f&&c)return r;let m={scrollLeft:0,scrollTop:0},h=ds(1);const g=ds(0),x=ms(a);if((x||!x&&!c)&&((Ha(a)!=="body"||Sl(d))&&(m=ud(a)),ms(a))){const b=po(a);h=xa(a),g.x=b.x+a.clientLeft,g.y=b.y+a.clientTop}const y=d&&!x&&!c?Fw(d,m):ds(0);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-m.scrollLeft*h.x+g.x+y.x,y:r.y*h.y-m.scrollTop*h.y+g.y+y.y}}function Kk(e){return Array.from(e.getClientRects())}function Qk(e){const n=gs(e),r=ud(e),a=e.ownerDocument.body,l=jn(n.scrollWidth,n.clientWidth,a.scrollWidth,a.clientWidth),c=jn(n.scrollHeight,n.clientHeight,a.scrollHeight,a.clientHeight);let d=-r.scrollLeft+dd(e);const f=-r.scrollTop;return Zn(a).direction==="rtl"&&(d+=jn(n.clientWidth,a.clientWidth)-l),{width:l,height:c,x:d,y:f}}const qv=25;function Jk(e,n){const r=_n(e),a=gs(e),l=r.visualViewport;let c=a.clientWidth,d=a.clientHeight,f=0,m=0;if(l){c=l.width,d=l.height;const g=zp();(!g||g&&n==="fixed")&&(f=l.offsetLeft,m=l.offsetTop)}const h=dd(a);if(h<=0){const g=a.ownerDocument,x=g.body,y=getComputedStyle(x),b=g.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,j=Math.abs(a.clientWidth-x.clientWidth-b);j<=qv&&(c-=j)}else h<=qv&&(c+=h);return{width:c,height:d,x:f,y:m}}const e4=new Set(["absolute","fixed"]);function t4(e,n){const r=po(e,!0,n==="fixed"),a=r.top+e.clientTop,l=r.left+e.clientLeft,c=ms(e)?xa(e):ds(1),d=e.clientWidth*c.x,f=e.clientHeight*c.y,m=l*c.x,h=a*c.y;return{width:d,height:f,x:m,y:h}}function Fv(e,n,r){let a;if(n==="viewport")a=Jk(e,r);else if(n==="document")a=Qk(gs(e));else if(Xn(n))a=t4(n,r);else{const l=qw(e);a={x:n.x-l.x,y:n.y-l.y,width:n.width,height:n.height}}return zu(a)}function Yw(e,n){const r=Dr(e);return r===n||!Xn(r)||Sa(r)?!1:Zn(r).position==="fixed"||Yw(r,n)}function n4(e,n){const r=n.get(e);if(r)return r;let a=al(e,[],!1).filter(f=>Xn(f)&&Ha(f)!=="body"),l=null;const c=Zn(e).position==="fixed";let d=c?Dr(e):e;for(;Xn(d)&&!Sa(d);){const f=Zn(d),m=Op(d);!m&&f.position==="fixed"&&(l=null),(c?!m&&!l:!m&&f.position==="static"&&!!l&&e4.has(l.position)||Sl(d)&&!m&&Yw(e,d))?a=a.filter(g=>g!==d):l=f,d=Dr(d)}return n.set(e,a),a}function s4(e){let{element:n,boundary:r,rootBoundary:a,strategy:l}=e;const d=[...r==="clippingAncestors"?cd(n)?[]:n4(n,this._c):[].concat(r),a],f=d[0],m=d.reduce((h,g)=>{const x=Fv(n,g,l);return h.top=jn(x.top,h.top),h.right=Rr(x.right,h.right),h.bottom=Rr(x.bottom,h.bottom),h.left=jn(x.left,h.left),h},Fv(n,f,l));return{width:m.right-m.left,height:m.bottom-m.top,x:m.left,y:m.top}}function r4(e){const{width:n,height:r}=Vw(e);return{width:n,height:r}}function o4(e,n,r){const a=ms(n),l=gs(n),c=r==="fixed",d=po(e,!0,c,n);let f={scrollLeft:0,scrollTop:0};const m=ds(0);function h(){m.x=dd(l)}if(a||!a&&!c)if((Ha(n)!=="body"||Sl(l))&&(f=ud(n)),a){const b=po(n,!0,c,n);m.x=b.x+n.clientLeft,m.y=b.y+n.clientTop}else l&&h();c&&!a&&l&&h();const g=l&&!a&&!c?Fw(l,f):ds(0),x=d.left+f.scrollLeft-m.x-g.x,y=d.top+f.scrollTop-m.y-g.y;return{x,y,width:d.width,height:d.height}}function dh(e){return Zn(e).position==="static"}function Yv(e,n){if(!ms(e)||Zn(e).position==="fixed")return null;if(n)return n(e);let r=e.offsetParent;return gs(e)===r&&(r=r.ownerDocument.body),r}function Gw(e,n){const r=_n(e);if(cd(e))return r;if(!ms(e)){let l=Dr(e);for(;l&&!Sa(l);){if(Xn(l)&&!dh(l))return l;l=Dr(l)}return r}let a=Yv(e,n);for(;a&&Uk(a)&&dh(a);)a=Yv(a,n);return a&&Sa(a)&&dh(a)&&!Op(a)?r:a||Yk(e)||r}const a4=async function(e){const n=this.getOffsetParent||Gw,r=this.getDimensions,a=await r(e.floating);return{reference:o4(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function i4(e){return Zn(e).direction==="rtl"}const l4={convertOffsetParentRelativeRectToViewportRelativeRect:Wk,getDocumentElement:gs,getClippingRect:s4,getOffsetParent:Gw,getElementRects:a4,getClientRects:Kk,getDimensions:r4,getScale:xa,isElement:Xn,isRTL:i4};function Xw(e,n){return e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height}function c4(e,n){let r=null,a;const l=gs(e);function c(){var f;clearTimeout(a),(f=r)==null||f.disconnect(),r=null}function d(f,m){f===void 0&&(f=!1),m===void 0&&(m=1),c();const h=e.getBoundingClientRect(),{left:g,top:x,width:y,height:b}=h;if(f||n(),!y||!b)return;const j=eu(x),N=eu(l.clientWidth-(g+y)),S=eu(l.clientHeight-(x+b)),_=eu(g),E={rootMargin:-j+"px "+-N+"px "+-S+"px "+-_+"px",threshold:jn(0,Rr(1,m))||1};let M=!0;function T(D){const z=D[0].intersectionRatio;if(z!==m){if(!M)return d();z?d(!1,z):a=setTimeout(()=>{d(!1,1e-7)},1e3)}z===1&&!Xw(h,e.getBoundingClientRect())&&d(),M=!1}try{r=new IntersectionObserver(T,{...E,root:l.ownerDocument})}catch{r=new IntersectionObserver(T,E)}r.observe(e)}return d(!0),c}function u4(e,n,r,a){a===void 0&&(a={});const{ancestorScroll:l=!0,ancestorResize:c=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:m=!1}=a,h=Ip(e),g=l||c?[...h?al(h):[],...al(n)]:[];g.forEach(_=>{l&&_.addEventListener("scroll",r,{passive:!0}),c&&_.addEventListener("resize",r)});const x=h&&f?c4(h,r):null;let y=-1,b=null;d&&(b=new ResizeObserver(_=>{let[A]=_;A&&A.target===h&&b&&(b.unobserve(n),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var E;(E=b)==null||E.observe(n)})),r()}),h&&!m&&b.observe(h),b.observe(n));let j,N=m?po(e):null;m&&S();function S(){const _=po(e);N&&!Xw(N,_)&&r(),N=_,j=requestAnimationFrame(S)}return r(),()=>{var _;g.forEach(A=>{l&&A.removeEventListener("scroll",r),c&&A.removeEventListener("resize",r)}),x?.(),(_=b)==null||_.disconnect(),b=null,m&&cancelAnimationFrame(j)}}const d4=zk,f4=Ik,m4=Rk,h4=$k,p4=Dk,Gv=Mk,g4=Lk,x4=(e,n,r)=>{const a=new Map,l={platform:l4,...r},c={...l.platform,_c:a};return Ak(e,n,{...l,platform:c})};var y4=typeof document<"u",v4=function(){},yu=y4?w.useLayoutEffect:v4;function Iu(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(typeof e=="function"&&e.toString()===n.toString())return!0;let r,a,l;if(e&&n&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==n.length)return!1;for(a=r;a--!==0;)if(!Iu(e[a],n[a]))return!1;return!0}if(l=Object.keys(e),r=l.length,r!==Object.keys(n).length)return!1;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(n,l[a]))return!1;for(a=r;a--!==0;){const c=l[a];if(!(c==="_owner"&&e.$$typeof)&&!Iu(e[c],n[c]))return!1}return!0}return e!==e&&n!==n}function Zw(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Xv(e,n){const r=Zw(e);return Math.round(n*r)/r}function fh(e){const n=w.useRef(e);return yu(()=>{n.current=e}),n}function b4(e){e===void 0&&(e={});const{placement:n="bottom",strategy:r="absolute",middleware:a=[],platform:l,elements:{reference:c,floating:d}={},transform:f=!0,whileElementsMounted:m,open:h}=e,[g,x]=w.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[y,b]=w.useState(a);Iu(y,a)||b(a);const[j,N]=w.useState(null),[S,_]=w.useState(null),A=w.useCallback(I=>{I!==D.current&&(D.current=I,N(I))},[]),E=w.useCallback(I=>{I!==z.current&&(z.current=I,_(I))},[]),M=c||j,T=d||S,D=w.useRef(null),z=w.useRef(null),H=w.useRef(g),q=m!=null,X=fh(m),W=fh(l),G=fh(h),ne=w.useCallback(()=>{if(!D.current||!z.current)return;const I={placement:n,strategy:r,middleware:y};W.current&&(I.platform=W.current),x4(D.current,z.current,I).then(P=>{const C={...P,isPositioned:G.current!==!1};B.current&&!Iu(H.current,C)&&(H.current=C,Nl.flushSync(()=>{x(C)}))})},[y,n,r,W,G]);yu(()=>{h===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,x(I=>({...I,isPositioned:!1})))},[h]);const B=w.useRef(!1);yu(()=>(B.current=!0,()=>{B.current=!1}),[]),yu(()=>{if(M&&(D.current=M),T&&(z.current=T),M&&T){if(X.current)return X.current(M,T,ne);ne()}},[M,T,ne,X,q]);const U=w.useMemo(()=>({reference:D,floating:z,setReference:A,setFloating:E}),[A,E]),R=w.useMemo(()=>({reference:M,floating:T}),[M,T]),L=w.useMemo(()=>{const I={position:r,left:0,top:0};if(!R.floating)return I;const P=Xv(R.floating,g.x),C=Xv(R.floating,g.y);return f?{...I,transform:"translate("+P+"px, "+C+"px)",...Zw(R.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:P,top:C}},[r,f,R.floating,g.x,g.y]);return w.useMemo(()=>({...g,update:ne,refs:U,elements:R,floatingStyles:L}),[g,ne,U,R,L])}const w4=e=>{function n(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:a,padding:l}=typeof e=="function"?e(r):e;return a&&n(a)?a.current!=null?Gv({element:a.current,padding:l}).fn(r):{}:a?Gv({element:a,padding:l}).fn(r):{}}}},N4=(e,n)=>({...d4(e),options:[e,n]}),j4=(e,n)=>({...f4(e),options:[e,n]}),S4=(e,n)=>({...g4(e),options:[e,n]}),_4=(e,n)=>({...m4(e),options:[e,n]}),E4=(e,n)=>({...h4(e),options:[e,n]}),C4=(e,n)=>({...p4(e),options:[e,n]}),k4=(e,n)=>({...w4(e),options:[e,n]});var T4="Arrow",Ww=w.forwardRef((e,n)=>{const{children:r,width:a=10,height:l=5,...c}=e;return o.jsx(Ye.svg,{...c,ref:n,width:a,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ww.displayName=T4;var A4=Ww;function Lp(e){const[n,r]=w.useState(void 0);return Wt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const c=l[0];let d,f;if("borderBoxSize"in c){const m=c.borderBoxSize,h=Array.isArray(m)?m[0]:m;d=h.inlineSize,f=h.blockSize}else d=e.offsetWidth,f=e.offsetHeight;r({width:d,height:f})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}else r(void 0)},[e]),n}var $p="Popper",[Kw,Ua]=Kn($p),[M4,Qw]=Kw($p),Jw=e=>{const{__scopePopper:n,children:r}=e,[a,l]=w.useState(null);return o.jsx(M4,{scope:n,anchor:a,onAnchorChange:l,children:r})};Jw.displayName=$p;var e1="PopperAnchor",t1=w.forwardRef((e,n)=>{const{__scopePopper:r,virtualRef:a,...l}=e,c=Qw(e1,r),d=w.useRef(null),f=rt(n,d),m=w.useRef(null);return w.useEffect(()=>{const h=m.current;m.current=a?.current||d.current,h!==m.current&&c.onAnchorChange(m.current)}),a?null:o.jsx(Ye.div,{...l,ref:f})});t1.displayName=e1;var Pp="PopperContent",[R4,D4]=Kw(Pp),n1=w.forwardRef((e,n)=>{const{__scopePopper:r,side:a="bottom",sideOffset:l=0,align:c="center",alignOffset:d=0,arrowPadding:f=0,avoidCollisions:m=!0,collisionBoundary:h=[],collisionPadding:g=0,sticky:x="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:j,...N}=e,S=Qw(Pp,r),[_,A]=w.useState(null),E=rt(n,ee=>A(ee)),[M,T]=w.useState(null),D=Lp(M),z=D?.width??0,H=D?.height??0,q=a+(c!=="center"?"-"+c:""),X=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},W=Array.isArray(h)?h:[h],G=W.length>0,ne={padding:X,boundary:W.filter(z4),altBoundary:G},{refs:B,floatingStyles:U,placement:R,isPositioned:L,middlewareData:I}=b4({strategy:"fixed",placement:q,whileElementsMounted:(...ee)=>u4(...ee,{animationFrame:b==="always"}),elements:{reference:S.anchor},middleware:[N4({mainAxis:l+H,alignmentAxis:d}),m&&j4({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?S4():void 0,...ne}),m&&_4({...ne}),E4({...ne,apply:({elements:ee,rects:ie,availableWidth:ge,availableHeight:Ee})=>{const{width:Ne,height:ve}=ie.reference,ze=ee.floating.style;ze.setProperty("--radix-popper-available-width",`${ge}px`),ze.setProperty("--radix-popper-available-height",`${Ee}px`),ze.setProperty("--radix-popper-anchor-width",`${Ne}px`),ze.setProperty("--radix-popper-anchor-height",`${ve}px`)}}),M&&k4({element:M,padding:f}),I4({arrowWidth:z,arrowHeight:H}),y&&C4({strategy:"referenceHidden",...ne})]}),[P,C]=o1(R),$=Zt(j);Wt(()=>{L&&$?.()},[L,$]);const Y=I.arrow?.x,V=I.arrow?.y,J=I.arrow?.centerOffset!==0,[ce,fe]=w.useState();return Wt(()=>{_&&fe(window.getComputedStyle(_).zIndex)},[_]),o.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:L?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(" "),...I.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(R4,{scope:r,placedSide:P,onArrowChange:T,arrowX:Y,arrowY:V,shouldHideArrow:J,children:o.jsx(Ye.div,{"data-side":P,"data-align":C,...N,ref:E,style:{...N.style,animation:L?void 0:"none"}})})})});n1.displayName=Pp;var s1="PopperArrow",O4={top:"bottom",right:"left",bottom:"top",left:"right"},r1=w.forwardRef(function(n,r){const{__scopePopper:a,...l}=n,c=D4(s1,a),d=O4[c.placedSide];return o.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[d]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:o.jsx(A4,{...l,ref:r,style:{...l.style,display:"block"}})})});r1.displayName=s1;function z4(e){return e!==null}var I4=e=>({name:"transformOrigin",options:e,fn(n){const{placement:r,rects:a,middlewareData:l}=n,d=l.arrow?.centerOffset!==0,f=d?0:e.arrowWidth,m=d?0:e.arrowHeight,[h,g]=o1(r),x={start:"0%",center:"50%",end:"100%"}[g],y=(l.arrow?.x??0)+f/2,b=(l.arrow?.y??0)+m/2;let j="",N="";return h==="bottom"?(j=d?x:`${y}px`,N=`${-m}px`):h==="top"?(j=d?x:`${y}px`,N=`${a.floating.height+m}px`):h==="right"?(j=`${-m}px`,N=d?x:`${b}px`):h==="left"&&(j=`${a.floating.width+m}px`,N=d?x:`${b}px`),{data:{x:j,y:N}}}});function o1(e){const[n,r="center"]=e.split("-");return[n,r]}var Hp=Jw,Up=t1,Bp=n1,Vp=r1,L4="Portal",fd=w.forwardRef((e,n)=>{const{container:r,...a}=e,[l,c]=w.useState(!1);Wt(()=>c(!0),[]);const d=r||l&&globalThis?.document?.body;return d?JC.createPortal(o.jsx(Ye.div,{...a,ref:n}),d):null});fd.displayName=L4;function $4(e,n){return w.useReducer((r,a)=>n[r][a]??r,e)}var Cn=e=>{const{present:n,children:r}=e,a=P4(n),l=typeof r=="function"?r({present:a.isPresent}):w.Children.only(r),c=rt(a.ref,H4(l));return typeof r=="function"||a.isPresent?w.cloneElement(l,{ref:c}):null};Cn.displayName="Presence";function P4(e){const[n,r]=w.useState(),a=w.useRef(null),l=w.useRef(e),c=w.useRef("none"),d=e?"mounted":"unmounted",[f,m]=$4(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const h=tu(a.current);c.current=f==="mounted"?h:"none"},[f]),Wt(()=>{const h=a.current,g=l.current;if(g!==e){const y=c.current,b=tu(h);e?m("MOUNT"):b==="none"||h?.display==="none"?m("UNMOUNT"):m(g&&y!==b?"ANIMATION_OUT":"UNMOUNT"),l.current=e}},[e,m]),Wt(()=>{if(n){let h;const g=n.ownerDocument.defaultView??window,x=b=>{const N=tu(a.current).includes(CSS.escape(b.animationName));if(b.target===n&&N&&(m("ANIMATION_END"),!l.current)){const S=n.style.animationFillMode;n.style.animationFillMode="forwards",h=g.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=S)})}},y=b=>{b.target===n&&(c.current=tu(a.current))};return n.addEventListener("animationstart",y),n.addEventListener("animationcancel",x),n.addEventListener("animationend",x),()=>{g.clearTimeout(h),n.removeEventListener("animationstart",y),n.removeEventListener("animationcancel",x),n.removeEventListener("animationend",x)}}else m("ANIMATION_END")},[n,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:w.useCallback(h=>{a.current=h?getComputedStyle(h):null,r(h)},[])}}function tu(e){return e?.animationName||"none"}function H4(e){let n=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var mh="rovingFocusGroup.onEntryFocus",U4={bubbles:!1,cancelable:!0},_l="RovingFocusGroup",[Xh,a1,B4]=Tp(_l),[V4,md]=Kn(_l,[B4]),[q4,F4]=V4(_l),i1=w.forwardRef((e,n)=>o.jsx(Xh.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Xh.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Y4,{...e,ref:n})})}));i1.displayName=_l;var Y4=w.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,orientation:a,loop:l=!1,dir:c,currentTabStopId:d,defaultCurrentTabStopId:f,onCurrentTabStopIdChange:m,onEntryFocus:h,preventScrollOnEntryFocus:g=!1,...x}=e,y=w.useRef(null),b=rt(n,y),j=jl(c),[N,S]=Ar({prop:d,defaultProp:f??null,onChange:m,caller:_l}),[_,A]=w.useState(!1),E=Zt(h),M=a1(r),T=w.useRef(!1),[D,z]=w.useState(0);return w.useEffect(()=>{const H=y.current;if(H)return H.addEventListener(mh,E),()=>H.removeEventListener(mh,E)},[E]),o.jsx(q4,{scope:r,orientation:a,dir:j,loop:l,currentTabStopId:N,onItemFocus:w.useCallback(H=>S(H),[S]),onItemShiftTab:w.useCallback(()=>A(!0),[]),onFocusableItemAdd:w.useCallback(()=>z(H=>H+1),[]),onFocusableItemRemove:w.useCallback(()=>z(H=>H-1),[]),children:o.jsx(Ye.div,{tabIndex:_||D===0?-1:0,"data-orientation":a,...x,ref:b,style:{outline:"none",...e.style},onMouseDown:ke(e.onMouseDown,()=>{T.current=!0}),onFocus:ke(e.onFocus,H=>{const q=!T.current;if(H.target===H.currentTarget&&q&&!_){const X=new CustomEvent(mh,U4);if(H.currentTarget.dispatchEvent(X),!X.defaultPrevented){const W=M().filter(R=>R.focusable),G=W.find(R=>R.active),ne=W.find(R=>R.id===N),U=[G,ne,...W].filter(Boolean).map(R=>R.ref.current);u1(U,g)}}T.current=!1}),onBlur:ke(e.onBlur,()=>A(!1))})})}),l1="RovingFocusGroupItem",c1=w.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:a=!0,active:l=!1,tabStopId:c,children:d,...f}=e,m=Mr(),h=c||m,g=F4(l1,r),x=g.currentTabStopId===h,y=a1(r),{onFocusableItemAdd:b,onFocusableItemRemove:j,currentTabStopId:N}=g;return w.useEffect(()=>{if(a)return b(),()=>j()},[a,b,j]),o.jsx(Xh.ItemSlot,{scope:r,id:h,focusable:a,active:l,children:o.jsx(Ye.span,{tabIndex:x?0:-1,"data-orientation":g.orientation,...f,ref:n,onMouseDown:ke(e.onMouseDown,S=>{a?g.onItemFocus(h):S.preventDefault()}),onFocus:ke(e.onFocus,()=>g.onItemFocus(h)),onKeyDown:ke(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){g.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const _=Z4(S,g.orientation,g.dir);if(_!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let E=y().filter(M=>M.focusable).map(M=>M.ref.current);if(_==="last")E.reverse();else if(_==="prev"||_==="next"){_==="prev"&&E.reverse();const M=E.indexOf(S.currentTarget);E=g.loop?W4(E,M+1):E.slice(M+1)}setTimeout(()=>u1(E))}}),children:typeof d=="function"?d({isCurrentTabStop:x,hasTabStop:N!=null}):d})})});c1.displayName=l1;var G4={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function X4(e,n){return n!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Z4(e,n,r){const a=X4(e.key,r);if(!(n==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(n==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return G4[a]}function u1(e,n=!1){const r=document.activeElement;for(const a of e)if(a===r||(a.focus({preventScroll:n}),document.activeElement!==r))return}function W4(e,n){return e.map((r,a)=>e[(n+a)%e.length])}var d1=i1,f1=c1,K4=function(e){if(typeof document>"u")return null;var n=Array.isArray(e)?e[0]:e;return n.ownerDocument.body},ca=new WeakMap,nu=new WeakMap,su={},hh=0,m1=function(e){return e&&(e.host||m1(e.parentNode))},Q4=function(e,n){return n.map(function(r){if(e.contains(r))return r;var a=m1(r);return a&&e.contains(a)?a:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},J4=function(e,n,r,a){var l=Q4(n,Array.isArray(e)?e:[e]);su[r]||(su[r]=new WeakMap);var c=su[r],d=[],f=new Set,m=new Set(l),h=function(x){!x||f.has(x)||(f.add(x),h(x.parentNode))};l.forEach(h);var g=function(x){!x||m.has(x)||Array.prototype.forEach.call(x.children,function(y){if(f.has(y))g(y);else try{var b=y.getAttribute(a),j=b!==null&&b!=="false",N=(ca.get(y)||0)+1,S=(c.get(y)||0)+1;ca.set(y,N),c.set(y,S),d.push(y),N===1&&j&&nu.set(y,!0),S===1&&y.setAttribute(r,"true"),j||y.setAttribute(a,"true")}catch(_){console.error("aria-hidden: cannot operate on ",y,_)}})};return g(n),f.clear(),hh++,function(){d.forEach(function(x){var y=ca.get(x)-1,b=c.get(x)-1;ca.set(x,y),c.set(x,b),y||(nu.has(x)||x.removeAttribute(a),nu.delete(x)),b||x.removeAttribute(r)}),hh--,hh||(ca=new WeakMap,ca=new WeakMap,nu=new WeakMap,su={})}},h1=function(e,n,r){r===void 0&&(r="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),l=K4(e);return l?(a.push.apply(a,Array.from(l.querySelectorAll("[aria-live], script"))),J4(a,l,r,"aria-hidden")):function(){return null}},ls=function(){return ls=Object.assign||function(n){for(var r,a=1,l=arguments.length;a<l;a++){r=arguments[a];for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(n[c]=r[c])}return n},ls.apply(this,arguments)};function p1(e,n){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(r[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,a=Object.getOwnPropertySymbols(e);l<a.length;l++)n.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r}function e3(e,n,r){if(r||arguments.length===2)for(var a=0,l=n.length,c;a<l;a++)(c||!(a in n))&&(c||(c=Array.prototype.slice.call(n,0,a)),c[a]=n[a]);return e.concat(c||Array.prototype.slice.call(n))}var vu="right-scroll-bar-position",bu="width-before-scroll-bar",t3="with-scroll-bars-hidden",n3="--removed-body-scroll-bar-size";function ph(e,n){return typeof e=="function"?e(n):e&&(e.current=n),e}function s3(e,n){var r=w.useState(function(){return{value:e,callback:n,facade:{get current(){return r.value},set current(a){var l=r.value;l!==a&&(r.value=a,r.callback(a,l))}}}})[0];return r.callback=n,r.facade}var r3=typeof window<"u"?w.useLayoutEffect:w.useEffect,Zv=new WeakMap;function o3(e,n){var r=s3(null,function(a){return e.forEach(function(l){return ph(l,a)})});return r3(function(){var a=Zv.get(r);if(a){var l=new Set(a),c=new Set(e),d=r.current;l.forEach(function(f){c.has(f)||ph(f,null)}),c.forEach(function(f){l.has(f)||ph(f,d)})}Zv.set(r,e)},[e]),r}function a3(e){return e}function i3(e,n){n===void 0&&(n=a3);var r=[],a=!1,l={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(c){var d=n(c,a);return r.push(d),function(){r=r.filter(function(f){return f!==d})}},assignSyncMedium:function(c){for(a=!0;r.length;){var d=r;r=[],d.forEach(c)}r={push:function(f){return c(f)},filter:function(){return r}}},assignMedium:function(c){a=!0;var d=[];if(r.length){var f=r;r=[],f.forEach(c),d=r}var m=function(){var g=d;d=[],g.forEach(c)},h=function(){return Promise.resolve().then(m)};h(),r={push:function(g){d.push(g),h()},filter:function(g){return d=d.filter(g),r}}}};return l}function l3(e){e===void 0&&(e={});var n=i3(null);return n.options=ls({async:!0,ssr:!1},e),n}var g1=function(e){var n=e.sideCar,r=p1(e,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=n.read();if(!a)throw new Error("Sidecar medium not found");return w.createElement(a,ls({},r))};g1.isSideCarExport=!0;function c3(e,n){return e.useMedium(n),g1}var x1=l3(),gh=function(){},hd=w.forwardRef(function(e,n){var r=w.useRef(null),a=w.useState({onScrollCapture:gh,onWheelCapture:gh,onTouchMoveCapture:gh}),l=a[0],c=a[1],d=e.forwardProps,f=e.children,m=e.className,h=e.removeScrollBar,g=e.enabled,x=e.shards,y=e.sideCar,b=e.noRelative,j=e.noIsolation,N=e.inert,S=e.allowPinchZoom,_=e.as,A=_===void 0?"div":_,E=e.gapMode,M=p1(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=y,D=o3([r,n]),z=ls(ls({},M),l);return w.createElement(w.Fragment,null,g&&w.createElement(T,{sideCar:x1,removeScrollBar:h,shards:x,noRelative:b,noIsolation:j,inert:N,setCallbacks:c,allowPinchZoom:!!S,lockRef:r,gapMode:E}),d?w.cloneElement(w.Children.only(f),ls(ls({},z),{ref:D})):w.createElement(A,ls({},z,{className:m,ref:D}),f))});hd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};hd.classNames={fullWidth:bu,zeroRight:vu};var u3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function d3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var n=u3();return n&&e.setAttribute("nonce",n),e}function f3(e,n){e.styleSheet?e.styleSheet.cssText=n:e.appendChild(document.createTextNode(n))}function m3(e){var n=document.head||document.getElementsByTagName("head")[0];n.appendChild(e)}var h3=function(){var e=0,n=null;return{add:function(r){e==0&&(n=d3())&&(f3(n,r),m3(n)),e++},remove:function(){e--,!e&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},p3=function(){var e=h3();return function(n,r){w.useEffect(function(){return e.add(n),function(){e.remove()}},[n&&r])}},y1=function(){var e=p3(),n=function(r){var a=r.styles,l=r.dynamic;return e(a,l),null};return n},g3={left:0,top:0,right:0,gap:0},xh=function(e){return parseInt(e||"",10)||0},x3=function(e){var n=window.getComputedStyle(document.body),r=n[e==="padding"?"paddingLeft":"marginLeft"],a=n[e==="padding"?"paddingTop":"marginTop"],l=n[e==="padding"?"paddingRight":"marginRight"];return[xh(r),xh(a),xh(l)]},y3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return g3;var n=x3(e),r=document.documentElement.clientWidth,a=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,a-r+n[2]-n[0])}},v3=y1(),ya="data-scroll-locked",b3=function(e,n,r,a){var l=e.left,c=e.top,d=e.right,f=e.gap;return r===void 0&&(r="margin"),`
  .`.concat(t3,` {
   overflow: hidden `).concat(a,`;
   padding-right: `).concat(f,"px ").concat(a,`;
  }
  body[`).concat(ya,`] {
    overflow: hidden `).concat(a,`;
    overscroll-behavior: contain;
    `).concat([n&&"position: relative ".concat(a,";"),r==="margin"&&`
    padding-left: `.concat(l,`px;
    padding-top: `).concat(c,`px;
    padding-right: `).concat(d,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(f,"px ").concat(a,`;
    `),r==="padding"&&"padding-right: ".concat(f,"px ").concat(a,";")].filter(Boolean).join(""),`
  }

  .`).concat(vu,` {
    right: `).concat(f,"px ").concat(a,`;
  }

  .`).concat(bu,` {
    margin-right: `).concat(f,"px ").concat(a,`;
  }

  .`).concat(vu," .").concat(vu,` {
    right: 0 `).concat(a,`;
  }

  .`).concat(bu," .").concat(bu,` {
    margin-right: 0 `).concat(a,`;
  }

  body[`).concat(ya,`] {
    `).concat(n3,": ").concat(f,`px;
  }
`)},Wv=function(){var e=parseInt(document.body.getAttribute(ya)||"0",10);return isFinite(e)?e:0},w3=function(){w.useEffect(function(){return document.body.setAttribute(ya,(Wv()+1).toString()),function(){var e=Wv()-1;e<=0?document.body.removeAttribute(ya):document.body.setAttribute(ya,e.toString())}},[])},N3=function(e){var n=e.noRelative,r=e.noImportant,a=e.gapMode,l=a===void 0?"margin":a;w3();var c=w.useMemo(function(){return y3(l)},[l]);return w.createElement(v3,{styles:b3(c,!n,l,r?"":"!important")})},Zh=!1;if(typeof window<"u")try{var ru=Object.defineProperty({},"passive",{get:function(){return Zh=!0,!0}});window.addEventListener("test",ru,ru),window.removeEventListener("test",ru,ru)}catch{Zh=!1}var ua=Zh?{passive:!1}:!1,j3=function(e){return e.tagName==="TEXTAREA"},v1=function(e,n){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[n]!=="hidden"&&!(r.overflowY===r.overflowX&&!j3(e)&&r[n]==="visible")},S3=function(e){return v1(e,"overflowY")},_3=function(e){return v1(e,"overflowX")},Kv=function(e,n){var r=n.ownerDocument,a=n;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var l=b1(e,a);if(l){var c=w1(e,a),d=c[1],f=c[2];if(d>f)return!0}a=a.parentNode}while(a&&a!==r.body);return!1},E3=function(e){var n=e.scrollTop,r=e.scrollHeight,a=e.clientHeight;return[n,r,a]},C3=function(e){var n=e.scrollLeft,r=e.scrollWidth,a=e.clientWidth;return[n,r,a]},b1=function(e,n){return e==="v"?S3(n):_3(n)},w1=function(e,n){return e==="v"?E3(n):C3(n)},k3=function(e,n){return e==="h"&&n==="rtl"?-1:1},T3=function(e,n,r,a,l){var c=k3(e,window.getComputedStyle(n).direction),d=c*a,f=r.target,m=n.contains(f),h=!1,g=d>0,x=0,y=0;do{if(!f)break;var b=w1(e,f),j=b[0],N=b[1],S=b[2],_=N-S-c*j;(j||_)&&b1(e,f)&&(x+=_,y+=j);var A=f.parentNode;f=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!m&&f!==document.body||m&&(n.contains(f)||n===f));return(g&&Math.abs(x)<1||!g&&Math.abs(y)<1)&&(h=!0),h},ou=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Qv=function(e){return[e.deltaX,e.deltaY]},Jv=function(e){return e&&"current"in e?e.current:e},A3=function(e,n){return e[0]===n[0]&&e[1]===n[1]},M3=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},R3=0,da=[];function D3(e){var n=w.useRef([]),r=w.useRef([0,0]),a=w.useRef(),l=w.useState(R3++)[0],c=w.useState(y1)[0],d=w.useRef(e);w.useEffect(function(){d.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(l));var N=e3([e.lockRef.current],(e.shards||[]).map(Jv),!0).filter(Boolean);return N.forEach(function(S){return S.classList.add("allow-interactivity-".concat(l))}),function(){document.body.classList.remove("block-interactivity-".concat(l)),N.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(l))})}}},[e.inert,e.lockRef.current,e.shards]);var f=w.useCallback(function(N,S){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!d.current.allowPinchZoom;var _=ou(N),A=r.current,E="deltaX"in N?N.deltaX:A[0]-_[0],M="deltaY"in N?N.deltaY:A[1]-_[1],T,D=N.target,z=Math.abs(E)>Math.abs(M)?"h":"v";if("touches"in N&&z==="h"&&D.type==="range")return!1;var H=Kv(z,D);if(!H)return!0;if(H?T=z:(T=z==="v"?"h":"v",H=Kv(z,D)),!H)return!1;if(!a.current&&"changedTouches"in N&&(E||M)&&(a.current=T),!T)return!0;var q=a.current||T;return T3(q,S,N,q==="h"?E:M)},[]),m=w.useCallback(function(N){var S=N;if(!(!da.length||da[da.length-1]!==c)){var _="deltaY"in S?Qv(S):ou(S),A=n.current.filter(function(T){return T.name===S.type&&(T.target===S.target||S.target===T.shadowParent)&&A3(T.delta,_)})[0];if(A&&A.should){S.cancelable&&S.preventDefault();return}if(!A){var E=(d.current.shards||[]).map(Jv).filter(Boolean).filter(function(T){return T.contains(S.target)}),M=E.length>0?f(S,E[0]):!d.current.noIsolation;M&&S.cancelable&&S.preventDefault()}}},[]),h=w.useCallback(function(N,S,_,A){var E={name:N,delta:S,target:_,should:A,shadowParent:O3(_)};n.current.push(E),setTimeout(function(){n.current=n.current.filter(function(M){return M!==E})},1)},[]),g=w.useCallback(function(N){r.current=ou(N),a.current=void 0},[]),x=w.useCallback(function(N){h(N.type,Qv(N),N.target,f(N,e.lockRef.current))},[]),y=w.useCallback(function(N){h(N.type,ou(N),N.target,f(N,e.lockRef.current))},[]);w.useEffect(function(){return da.push(c),e.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:y}),document.addEventListener("wheel",m,ua),document.addEventListener("touchmove",m,ua),document.addEventListener("touchstart",g,ua),function(){da=da.filter(function(N){return N!==c}),document.removeEventListener("wheel",m,ua),document.removeEventListener("touchmove",m,ua),document.removeEventListener("touchstart",g,ua)}},[]);var b=e.removeScrollBar,j=e.inert;return w.createElement(w.Fragment,null,j?w.createElement(c,{styles:M3(l)}):null,b?w.createElement(N3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function O3(e){for(var n=null;e!==null;)e instanceof ShadowRoot&&(n=e.host,e=e.host),e=e.parentNode;return n}const z3=c3(x1,D3);var qp=w.forwardRef(function(e,n){return w.createElement(hd,ls({},e,{ref:n,sideCar:z3}))});qp.classNames=hd.classNames;var Wh=["Enter"," "],I3=["ArrowDown","PageUp","Home"],N1=["ArrowUp","PageDown","End"],L3=[...I3,...N1],$3={ltr:[...Wh,"ArrowRight"],rtl:[...Wh,"ArrowLeft"]},P3={ltr:["ArrowLeft"],rtl:["ArrowRight"]},El="Menu",[il,H3,U3]=Tp(El),[wo,j1]=Kn(El,[U3,Ua,md]),pd=Ua(),S1=md(),[B3,No]=wo(El),[V3,Cl]=wo(El),_1=e=>{const{__scopeMenu:n,open:r=!1,children:a,dir:l,onOpenChange:c,modal:d=!0}=e,f=pd(n),[m,h]=w.useState(null),g=w.useRef(!1),x=Zt(c),y=jl(l);return w.useEffect(()=>{const b=()=>{g.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>g.current=!1;return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),o.jsx(Hp,{...f,children:o.jsx(B3,{scope:n,open:r,onOpenChange:x,content:m,onContentChange:h,children:o.jsx(V3,{scope:n,onClose:w.useCallback(()=>x(!1),[x]),isUsingKeyboardRef:g,dir:y,modal:d,children:a})})})};_1.displayName=El;var q3="MenuAnchor",Fp=w.forwardRef((e,n)=>{const{__scopeMenu:r,...a}=e,l=pd(r);return o.jsx(Up,{...l,...a,ref:n})});Fp.displayName=q3;var Yp="MenuPortal",[F3,E1]=wo(Yp,{forceMount:void 0}),C1=e=>{const{__scopeMenu:n,forceMount:r,children:a,container:l}=e,c=No(Yp,n);return o.jsx(F3,{scope:n,forceMount:r,children:o.jsx(Cn,{present:r||c.open,children:o.jsx(fd,{asChild:!0,container:l,children:a})})})};C1.displayName=Yp;var Ln="MenuContent",[Y3,Gp]=wo(Ln),k1=w.forwardRef((e,n)=>{const r=E1(Ln,e.__scopeMenu),{forceMount:a=r.forceMount,...l}=e,c=No(Ln,e.__scopeMenu),d=Cl(Ln,e.__scopeMenu);return o.jsx(il.Provider,{scope:e.__scopeMenu,children:o.jsx(Cn,{present:a||c.open,children:o.jsx(il.Slot,{scope:e.__scopeMenu,children:d.modal?o.jsx(G3,{...l,ref:n}):o.jsx(X3,{...l,ref:n})})})})}),G3=w.forwardRef((e,n)=>{const r=No(Ln,e.__scopeMenu),a=w.useRef(null),l=rt(n,a);return w.useEffect(()=>{const c=a.current;if(c)return h1(c)},[]),o.jsx(Xp,{...e,ref:l,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ke(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),X3=w.forwardRef((e,n)=>{const r=No(Ln,e.__scopeMenu);return o.jsx(Xp,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Z3=ja("MenuContent.ScrollLock"),Xp=w.forwardRef((e,n)=>{const{__scopeMenu:r,loop:a=!1,trapFocus:l,onOpenAutoFocus:c,onCloseAutoFocus:d,disableOutsidePointerEvents:f,onEntryFocus:m,onEscapeKeyDown:h,onPointerDownOutside:g,onFocusOutside:x,onInteractOutside:y,onDismiss:b,disableOutsideScroll:j,...N}=e,S=No(Ln,r),_=Cl(Ln,r),A=pd(r),E=S1(r),M=H3(r),[T,D]=w.useState(null),z=w.useRef(null),H=rt(n,z,S.onContentChange),q=w.useRef(0),X=w.useRef(""),W=w.useRef(0),G=w.useRef(null),ne=w.useRef("right"),B=w.useRef(0),U=j?qp:w.Fragment,R=j?{as:Z3,allowPinchZoom:!0}:void 0,L=P=>{const C=X.current+P,$=M().filter(ee=>!ee.disabled),Y=document.activeElement,V=$.find(ee=>ee.ref.current===Y)?.textValue,J=$.map(ee=>ee.textValue),ce=iT(J,C,V),fe=$.find(ee=>ee.textValue===ce)?.ref.current;(function ee(ie){X.current=ie,window.clearTimeout(q.current),ie!==""&&(q.current=window.setTimeout(()=>ee(""),1e3))})(C),fe&&setTimeout(()=>fe.focus())};w.useEffect(()=>()=>window.clearTimeout(q.current),[]),Lw();const I=w.useCallback(P=>ne.current===G.current?.side&&cT(P,G.current?.area),[]);return o.jsx(Y3,{scope:r,searchRef:X,onItemEnter:w.useCallback(P=>{I(P)&&P.preventDefault()},[I]),onItemLeave:w.useCallback(P=>{I(P)||(z.current?.focus(),D(null))},[I]),onTriggerLeave:w.useCallback(P=>{I(P)&&P.preventDefault()},[I]),pointerGraceTimerRef:W,onPointerGraceIntentChange:w.useCallback(P=>{G.current=P},[]),children:o.jsx(U,{...R,children:o.jsx(Ap,{asChild:!0,trapped:l,onMountAutoFocus:ke(c,P=>{P.preventDefault(),z.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:d,children:o.jsx(id,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:h,onPointerDownOutside:g,onFocusOutside:x,onInteractOutside:y,onDismiss:b,children:o.jsx(d1,{asChild:!0,...E,dir:_.dir,orientation:"vertical",loop:a,currentTabStopId:T,onCurrentTabStopIdChange:D,onEntryFocus:ke(m,P=>{_.isUsingKeyboardRef.current||P.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(Bp,{role:"menu","aria-orientation":"vertical","data-state":q1(S.open),"data-radix-menu-content":"",dir:_.dir,...A,...N,ref:H,style:{outline:"none",...N.style},onKeyDown:ke(N.onKeyDown,P=>{const $=P.target.closest("[data-radix-menu-content]")===P.currentTarget,Y=P.ctrlKey||P.altKey||P.metaKey,V=P.key.length===1;$&&(P.key==="Tab"&&P.preventDefault(),!Y&&V&&L(P.key));const J=z.current;if(P.target!==J||!L3.includes(P.key))return;P.preventDefault();const fe=M().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);N1.includes(P.key)&&fe.reverse(),oT(fe)}),onBlur:ke(e.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(q.current),X.current="")}),onPointerMove:ke(e.onPointerMove,ll(P=>{const C=P.target,$=B.current!==P.clientX;if(P.currentTarget.contains(C)&&$){const Y=P.clientX>B.current?"right":"left";ne.current=Y,B.current=P.clientX}}))})})})})})})});k1.displayName=Ln;var W3="MenuGroup",Zp=w.forwardRef((e,n)=>{const{__scopeMenu:r,...a}=e;return o.jsx(Ye.div,{role:"group",...a,ref:n})});Zp.displayName=W3;var K3="MenuLabel",T1=w.forwardRef((e,n)=>{const{__scopeMenu:r,...a}=e;return o.jsx(Ye.div,{...a,ref:n})});T1.displayName=K3;var Lu="MenuItem",eb="menu.itemSelect",gd=w.forwardRef((e,n)=>{const{disabled:r=!1,onSelect:a,...l}=e,c=w.useRef(null),d=Cl(Lu,e.__scopeMenu),f=Gp(Lu,e.__scopeMenu),m=rt(n,c),h=w.useRef(!1),g=()=>{const x=c.current;if(!r&&x){const y=new CustomEvent(eb,{bubbles:!0,cancelable:!0});x.addEventListener(eb,b=>a?.(b),{once:!0}),Ow(x,y),y.defaultPrevented?h.current=!1:d.onClose()}};return o.jsx(A1,{...l,ref:m,disabled:r,onClick:ke(e.onClick,g),onPointerDown:x=>{e.onPointerDown?.(x),h.current=!0},onPointerUp:ke(e.onPointerUp,x=>{h.current||x.currentTarget?.click()}),onKeyDown:ke(e.onKeyDown,x=>{const y=f.searchRef.current!=="";r||y&&x.key===" "||Wh.includes(x.key)&&(x.currentTarget.click(),x.preventDefault())})})});gd.displayName=Lu;var A1=w.forwardRef((e,n)=>{const{__scopeMenu:r,disabled:a=!1,textValue:l,...c}=e,d=Gp(Lu,r),f=S1(r),m=w.useRef(null),h=rt(n,m),[g,x]=w.useState(!1),[y,b]=w.useState("");return w.useEffect(()=>{const j=m.current;j&&b((j.textContent??"").trim())},[c.children]),o.jsx(il.ItemSlot,{scope:r,disabled:a,textValue:l??y,children:o.jsx(f1,{asChild:!0,...f,focusable:!a,children:o.jsx(Ye.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...c,ref:h,onPointerMove:ke(e.onPointerMove,ll(j=>{a?d.onItemLeave(j):(d.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ke(e.onPointerLeave,ll(j=>d.onItemLeave(j))),onFocus:ke(e.onFocus,()=>x(!0)),onBlur:ke(e.onBlur,()=>x(!1))})})})}),Q3="MenuCheckboxItem",M1=w.forwardRef((e,n)=>{const{checked:r=!1,onCheckedChange:a,...l}=e;return o.jsx(I1,{scope:e.__scopeMenu,checked:r,children:o.jsx(gd,{role:"menuitemcheckbox","aria-checked":$u(r)?"mixed":r,...l,ref:n,"data-state":Kp(r),onSelect:ke(l.onSelect,()=>a?.($u(r)?!0:!r),{checkForDefaultPrevented:!1})})})});M1.displayName=Q3;var R1="MenuRadioGroup",[J3,eT]=wo(R1,{value:void 0,onValueChange:()=>{}}),D1=w.forwardRef((e,n)=>{const{value:r,onValueChange:a,...l}=e,c=Zt(a);return o.jsx(J3,{scope:e.__scopeMenu,value:r,onValueChange:c,children:o.jsx(Zp,{...l,ref:n})})});D1.displayName=R1;var O1="MenuRadioItem",z1=w.forwardRef((e,n)=>{const{value:r,...a}=e,l=eT(O1,e.__scopeMenu),c=r===l.value;return o.jsx(I1,{scope:e.__scopeMenu,checked:c,children:o.jsx(gd,{role:"menuitemradio","aria-checked":c,...a,ref:n,"data-state":Kp(c),onSelect:ke(a.onSelect,()=>l.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});z1.displayName=O1;var Wp="MenuItemIndicator",[I1,tT]=wo(Wp,{checked:!1}),L1=w.forwardRef((e,n)=>{const{__scopeMenu:r,forceMount:a,...l}=e,c=tT(Wp,r);return o.jsx(Cn,{present:a||$u(c.checked)||c.checked===!0,children:o.jsx(Ye.span,{...l,ref:n,"data-state":Kp(c.checked)})})});L1.displayName=Wp;var nT="MenuSeparator",$1=w.forwardRef((e,n)=>{const{__scopeMenu:r,...a}=e;return o.jsx(Ye.div,{role:"separator","aria-orientation":"horizontal",...a,ref:n})});$1.displayName=nT;var sT="MenuArrow",P1=w.forwardRef((e,n)=>{const{__scopeMenu:r,...a}=e,l=pd(r);return o.jsx(Vp,{...l,...a,ref:n})});P1.displayName=sT;var rT="MenuSub",[X7,H1]=wo(rT),Zi="MenuSubTrigger",U1=w.forwardRef((e,n)=>{const r=No(Zi,e.__scopeMenu),a=Cl(Zi,e.__scopeMenu),l=H1(Zi,e.__scopeMenu),c=Gp(Zi,e.__scopeMenu),d=w.useRef(null),{pointerGraceTimerRef:f,onPointerGraceIntentChange:m}=c,h={__scopeMenu:e.__scopeMenu},g=w.useCallback(()=>{d.current&&window.clearTimeout(d.current),d.current=null},[]);return w.useEffect(()=>g,[g]),w.useEffect(()=>{const x=f.current;return()=>{window.clearTimeout(x),m(null)}},[f,m]),o.jsx(Fp,{asChild:!0,...h,children:o.jsx(A1,{id:l.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":l.contentId,"data-state":q1(r.open),...e,ref:ad(n,l.onTriggerChange),onClick:x=>{e.onClick?.(x),!(e.disabled||x.defaultPrevented)&&(x.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ke(e.onPointerMove,ll(x=>{c.onItemEnter(x),!x.defaultPrevented&&!e.disabled&&!r.open&&!d.current&&(c.onPointerGraceIntentChange(null),d.current=window.setTimeout(()=>{r.onOpenChange(!0),g()},100))})),onPointerLeave:ke(e.onPointerLeave,ll(x=>{g();const y=r.content?.getBoundingClientRect();if(y){const b=r.content?.dataset.side,j=b==="right",N=j?-5:5,S=y[j?"left":"right"],_=y[j?"right":"left"];c.onPointerGraceIntentChange({area:[{x:x.clientX+N,y:x.clientY},{x:S,y:y.top},{x:_,y:y.top},{x:_,y:y.bottom},{x:S,y:y.bottom}],side:b}),window.clearTimeout(f.current),f.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(x),x.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:ke(e.onKeyDown,x=>{const y=c.searchRef.current!=="";e.disabled||y&&x.key===" "||$3[a.dir].includes(x.key)&&(r.onOpenChange(!0),r.content?.focus(),x.preventDefault())})})})});U1.displayName=Zi;var B1="MenuSubContent",V1=w.forwardRef((e,n)=>{const r=E1(Ln,e.__scopeMenu),{forceMount:a=r.forceMount,...l}=e,c=No(Ln,e.__scopeMenu),d=Cl(Ln,e.__scopeMenu),f=H1(B1,e.__scopeMenu),m=w.useRef(null),h=rt(n,m);return o.jsx(il.Provider,{scope:e.__scopeMenu,children:o.jsx(Cn,{present:a||c.open,children:o.jsx(il.Slot,{scope:e.__scopeMenu,children:o.jsx(Xp,{id:f.contentId,"aria-labelledby":f.triggerId,...l,ref:h,align:"start",side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:g=>{d.isUsingKeyboardRef.current&&m.current?.focus(),g.preventDefault()},onCloseAutoFocus:g=>g.preventDefault(),onFocusOutside:ke(e.onFocusOutside,g=>{g.target!==f.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:ke(e.onEscapeKeyDown,g=>{d.onClose(),g.preventDefault()}),onKeyDown:ke(e.onKeyDown,g=>{const x=g.currentTarget.contains(g.target),y=P3[d.dir].includes(g.key);x&&y&&(c.onOpenChange(!1),f.trigger?.focus(),g.preventDefault())})})})})})});V1.displayName=B1;function q1(e){return e?"open":"closed"}function $u(e){return e==="indeterminate"}function Kp(e){return $u(e)?"indeterminate":e?"checked":"unchecked"}function oT(e){const n=document.activeElement;for(const r of e)if(r===n||(r.focus(),document.activeElement!==n))return}function aT(e,n){return e.map((r,a)=>e[(n+a)%e.length])}function iT(e,n,r){const l=n.length>1&&Array.from(n).every(h=>h===n[0])?n[0]:n,c=r?e.indexOf(r):-1;let d=aT(e,Math.max(c,0));l.length===1&&(d=d.filter(h=>h!==r));const m=d.find(h=>h.toLowerCase().startsWith(l.toLowerCase()));return m!==r?m:void 0}function lT(e,n){const{x:r,y:a}=e;let l=!1;for(let c=0,d=n.length-1;c<n.length;d=c++){const f=n[c],m=n[d],h=f.x,g=f.y,x=m.x,y=m.y;g>a!=y>a&&r<(x-h)*(a-g)/(y-g)+h&&(l=!l)}return l}function cT(e,n){if(!n)return!1;const r={x:e.clientX,y:e.clientY};return lT(r,n)}function ll(e){return n=>n.pointerType==="mouse"?e(n):void 0}var uT=_1,dT=Fp,fT=C1,mT=k1,hT=Zp,pT=T1,gT=gd,xT=M1,yT=D1,vT=z1,bT=L1,wT=$1,NT=P1,jT=U1,ST=V1,xd="DropdownMenu",[_T,Z7]=Kn(xd,[j1]),sn=j1(),[ET,F1]=_T(xd),Y1=e=>{const{__scopeDropdownMenu:n,children:r,dir:a,open:l,defaultOpen:c,onOpenChange:d,modal:f=!0}=e,m=sn(n),h=w.useRef(null),[g,x]=Ar({prop:l,defaultProp:c??!1,onChange:d,caller:xd});return o.jsx(ET,{scope:n,triggerId:Mr(),triggerRef:h,contentId:Mr(),open:g,onOpenChange:x,onOpenToggle:w.useCallback(()=>x(y=>!y),[x]),modal:f,children:o.jsx(uT,{...m,open:g,onOpenChange:x,dir:a,modal:f,children:r})})};Y1.displayName=xd;var G1="DropdownMenuTrigger",X1=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,disabled:a=!1,...l}=e,c=F1(G1,r),d=sn(r);return o.jsx(dT,{asChild:!0,...d,children:o.jsx(Ye.button,{type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...l,ref:ad(n,c.triggerRef),onPointerDown:ke(e.onPointerDown,f=>{!a&&f.button===0&&f.ctrlKey===!1&&(c.onOpenToggle(),c.open||f.preventDefault())}),onKeyDown:ke(e.onKeyDown,f=>{a||(["Enter"," "].includes(f.key)&&c.onOpenToggle(),f.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});X1.displayName=G1;var CT="DropdownMenuPortal",Z1=e=>{const{__scopeDropdownMenu:n,...r}=e,a=sn(n);return o.jsx(fT,{...a,...r})};Z1.displayName=CT;var W1="DropdownMenuContent",K1=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...a}=e,l=F1(W1,r),c=sn(r),d=w.useRef(!1);return o.jsx(mT,{id:l.contentId,"aria-labelledby":l.triggerId,...c,...a,ref:n,onCloseAutoFocus:ke(e.onCloseAutoFocus,f=>{d.current||l.triggerRef.current?.focus(),d.current=!1,f.preventDefault()}),onInteractOutside:ke(e.onInteractOutside,f=>{const m=f.detail.originalEvent,h=m.button===0&&m.ctrlKey===!0,g=m.button===2||h;(!l.modal||g)&&(d.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});K1.displayName=W1;var kT="DropdownMenuGroup",TT=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...a}=e,l=sn(r);return o.jsx(hT,{...l,...a,ref:n})});TT.displayName=kT;var AT="DropdownMenuLabel",Q1=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...a}=e,l=sn(r);return o.jsx(pT,{...l,...a,ref:n})});Q1.displayName=AT;var MT="DropdownMenuItem",J1=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...a}=e,l=sn(r);return o.jsx(gT,{...l,...a,ref:n})});J1.displayName=MT;var RT="DropdownMenuCheckboxItem",DT=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...a}=e,l=sn(r);return o.jsx(xT,{...l,...a,ref:n})});DT.displayName=RT;var OT="DropdownMenuRadioGroup",zT=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...a}=e,l=sn(r);return o.jsx(yT,{...l,...a,ref:n})});zT.displayName=OT;var IT="DropdownMenuRadioItem",LT=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...a}=e,l=sn(r);return o.jsx(vT,{...l,...a,ref:n})});LT.displayName=IT;var $T="DropdownMenuItemIndicator",PT=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...a}=e,l=sn(r);return o.jsx(bT,{...l,...a,ref:n})});PT.displayName=$T;var HT="DropdownMenuSeparator",eN=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...a}=e,l=sn(r);return o.jsx(wT,{...l,...a,ref:n})});eN.displayName=HT;var UT="DropdownMenuArrow",BT=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...a}=e,l=sn(r);return o.jsx(NT,{...l,...a,ref:n})});BT.displayName=UT;var VT="DropdownMenuSubTrigger",qT=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...a}=e,l=sn(r);return o.jsx(jT,{...l,...a,ref:n})});qT.displayName=VT;var FT="DropdownMenuSubContent",YT=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...a}=e,l=sn(r);return o.jsx(ST,{...l,...a,ref:n,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});YT.displayName=FT;var GT=Y1,XT=X1,ZT=Z1,WT=K1,KT=Q1,QT=J1,JT=eN;/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const eA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),tA=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,a)=>a?a.toUpperCase():r.toLowerCase()),tb=e=>{const n=tA(e);return n.charAt(0).toUpperCase()+n.slice(1)},tN=(...e)=>e.filter((n,r,a)=>!!n&&n.trim()!==""&&a.indexOf(n)===r).join(" ").trim(),nA=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0};/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var sA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rA=w.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:l="",children:c,iconNode:d,...f},m)=>w.createElement("svg",{ref:m,...sA,width:n,height:n,stroke:e,strokeWidth:a?Number(r)*24/Number(n):r,className:tN("lucide",l),...!c&&!nA(f)&&{"aria-hidden":"true"},...f},[...d.map(([h,g])=>w.createElement(h,g)),...Array.isArray(c)?c:[c]]));/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Te=(e,n)=>{const r=w.forwardRef(({className:a,...l},c)=>w.createElement(rA,{ref:c,iconNode:n,className:tN(`lucide-${eA(tb(e))}`,`lucide-${e}`,a),...l}));return r.displayName=tb(e),r};/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oA=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Qp=Te("activity",oA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const aA=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],iA=Te("arrow-down",aA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lA=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],cA=Te("arrow-left-right",lA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const uA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],dA=Te("arrow-left",uA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fA=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],nN=Te("book-open",fA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mA=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Vs=Te("bot",mA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hA=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],ha=Te("chart-column",hA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pA=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],gA=Te("check-check",pA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],jo=Te("check",xA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Rt=Te("chevron-down",yA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vA=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],sN=Te("chevron-left",vA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],en=Te("chevron-right",bA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wA=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],rN=Te("chevron-up",wA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const NA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],hs=Te("circle-alert",NA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jA=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],yd=Te("circle-check-big",jA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const SA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],nn=Te("circle-check",SA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _A=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],EA=Te("circle-play",_A);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const CA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],kl=Te("circle-x",CA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kA=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Jp=Te("clock",kA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const TA=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],AA=Te("cloud",TA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const MA=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],oN=Te("code",MA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const RA=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],DA=Te("container",RA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const OA=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],uo=Te("copy",OA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zA=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Kh=Te("database",zA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const IA=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Pu=Te("download",IA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const LA=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],$A=Te("ellipsis-vertical",LA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const PA=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Hu=Te("external-link",PA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const HA=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],qs=Te("file-text",HA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const UA=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],aN=Te("folder-open",UA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const BA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],iN=Te("globe",BA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const VA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],qA=Te("grid-3x3",VA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const FA=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],YA=Te("house",FA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const GA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],XA=Te("image",GA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ZA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Fs=Te("info",ZA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const WA=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],KA=Te("key",WA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const QA=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],JA=Te("layers",QA);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const eM=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],tM=Te("lightbulb",eM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Or=Te("loader-circle",nM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],rM=Te("lock",sM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oM=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],aM=Te("map",oM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iM=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],lM=Te("maximize",iM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cM=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],eg=Te("message-square",cM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const uM=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],dM=Te("moon",uM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fM=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],lN=Te("music",fM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mM=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Uu=Te("package",mM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],pM=Te("panel-right-open",hM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gM=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],xM=Te("paperclip",gM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yM=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],nb=Te("play",yM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],tg=Te("plus",vM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bM=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ng=Te("refresh-cw",bM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wM=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],Qh=Te("rocket",wM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const NM=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],sg=Te("rotate-ccw",NM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Bu=Te("search",jM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const SM=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],_M=Te("send-horizontal",SM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const EM=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],el=Te("send",EM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const CM=[["path",{d:"M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5",key:"bt2siv"}],["path",{d:"M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z",key:"1hjrv1"}],["path",{d:"M22 17v-1a2 2 0 0 0-2-2h-1",key:"1iynyr"}],["path",{d:"M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z",key:"161ggg"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],kM=Te("server-off",CM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const TM=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Jh=Te("settings",TM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const AM=[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]],MM=Te("shuffle",AM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const RM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],vd=Te("square",RM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const DM=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],OM=Te("sun",DM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zM=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],rg=Te("trash-2",zM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const IM=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],LM=Te("triangle-alert",IM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $M=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],PM=Te("upload",$M);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const HM=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],cN=Te("user",HM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const UM=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Us=Te("workflow",UM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const BM=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],_a=Te("wrench",BM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const VM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ea=Te("x",VM);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qM=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],og=Te("zap",qM);function bd({...e}){return o.jsx(GT,{"data-slot":"dropdown-menu",...e})}function wd({...e}){return o.jsx(XT,{"data-slot":"dropdown-menu-trigger",...e})}function Nd({className:e,sideOffset:n=4,...r}){return o.jsx(ZT,{children:o.jsx(WT,{"data-slot":"dropdown-menu-content",sideOffset:n,className:We("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...r})})}function $t({className:e,inset:n,variant:r="default",...a}){return o.jsx(QT,{"data-slot":"dropdown-menu-item","data-inset":n,"data-variant":r,className:We("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...a})}function yh({className:e,inset:n,...r}){return o.jsx(KT,{"data-slot":"dropdown-menu-label","data-inset":n,className:We("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function va({className:e,...n}){return o.jsx(JT,{"data-slot":"dropdown-menu-separator",className:We("bg-border -mx-1 my-1 h-px",e),...n})}function Vu({size:e="md",className:n}){return o.jsx(Or,{className:We("animate-spin",{"h-4 w-4":e==="sm","h-6 w-6":e==="md","h-8 w-8":e==="lg"},n)})}const FM=e=>e==="workflow"?Us:Vs;function YM({agents:e,workflows:n,entities:r,selectedItem:a,onSelect:l,onBrowseGallery:c,isLoading:d=!1}){const[f,m]=w.useState(!1),h=r||[...e,...n],g=j=>{l(j),m(!1)},x=a?FM(a.type):Vs,y=a?.name||a?.id||"Select Agent or Workflow",b=a?.metadata?.lazy_loaded!==!1;return o.jsxs(bd,{open:f,onOpenChange:m,children:[o.jsx(wd,{asChild:!0,children:o.jsx(Le,{variant:"outline",className:"w-64 justify-between font-mono text-sm",disabled:d,children:d?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Vu,{size:"sm"}),o.jsx("span",{className:"text-muted-foreground",children:"Loading..."})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx(x,{className:"h-4 w-4 flex-shrink-0"}),o.jsx("span",{className:"truncate",children:y}),a&&!b&&o.jsx(Or,{className:"h-3 w-3 text-muted-foreground animate-spin ml-auto flex-shrink-0"})]}),o.jsx(Rt,{className:"h-4 w-4 opacity-50"})]})})}),o.jsxs(Nd,{className:"w-80 font-mono",children:[(()=>{const j=h.filter(_=>_.type==="workflow"),N=h.filter(_=>_.type==="agent"),S=h[0]?.type;return o.jsxs(o.Fragment,{children:[S==="workflow"&&j.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs(yh,{className:"flex items-center gap-2",children:[o.jsx(Us,{className:"h-4 w-4"}),"Workflows (",j.length,")"]}),j.map(_=>{const A=_.metadata?.lazy_loaded!==!1;return o.jsx($t,{className:"cursor-pointer group",onClick:()=>g(_),children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx(Us,{className:"h-4 w-4 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"truncate font-medium block",children:_.name||_.id}),A&&_.description&&o.jsx("div",{className:"text-xs text-muted-foreground line-clamp-2",children:_.description})]})]})},_.id)})]}),j.length>0&&N.length>0&&o.jsx(va,{}),N.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs(yh,{className:"flex items-center gap-2",children:[o.jsx(Vs,{className:"h-4 w-4"}),"Agents (",N.length,")"]}),N.map(_=>{const A=_.metadata?.lazy_loaded!==!1;return o.jsx($t,{className:"cursor-pointer group",onClick:()=>g(_),children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx(Vs,{className:"h-4 w-4 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"truncate font-medium block",children:_.name||_.id}),A&&_.description&&o.jsx("div",{className:"text-xs text-muted-foreground line-clamp-2",children:_.description})]})]})},_.id)})]}),S==="agent"&&j.length>0&&o.jsxs(o.Fragment,{children:[N.length>0&&o.jsx(va,{}),o.jsxs(yh,{className:"flex items-center gap-2",children:[o.jsx(Us,{className:"h-4 w-4"}),"Workflows (",j.length,")"]}),j.map(_=>{const A=_.metadata?.lazy_loaded!==!1;return o.jsx($t,{className:"cursor-pointer group",onClick:()=>g(_),children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx(Us,{className:"h-4 w-4 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"truncate font-medium block",children:_.name||_.id}),A&&_.description&&o.jsx("div",{className:"text-xs text-muted-foreground line-clamp-2",children:_.description})]})]})},_.id)})]})]})})(),h.length===0&&o.jsx($t,{disabled:!0,children:o.jsx("div",{className:"text-center text-muted-foreground py-2",children:d?"Loading agents and workflows...":"No agents or workflows found"})}),o.jsx(va,{}),o.jsxs($t,{className:"cursor-pointer text-primary",onClick:()=>{c?.(),m(!1)},children:[o.jsx(tg,{className:"h-4 w-4 mr-2"}),"Browse Gallery"]})]})]})}var GM=(e,n,r,a,l,c,d,f)=>{let m=document.documentElement,h=["light","dark"];function g(b){(Array.isArray(e)?e:[e]).forEach(j=>{let N=j==="class",S=N&&c?l.map(_=>c[_]||_):l;N?(m.classList.remove(...S),m.classList.add(c&&c[b]?c[b]:b)):m.setAttribute(j,b)}),x(b)}function x(b){f&&h.includes(b)&&(m.style.colorScheme=b)}function y(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(a)g(a);else try{let b=localStorage.getItem(n)||r,j=d&&b==="system"?y():b;g(j)}catch{}},sb=["light","dark"],uN="(prefers-color-scheme: dark)",XM=typeof window>"u",ag=w.createContext(void 0),ZM={setTheme:e=>{},themes:[]},WM=()=>{var e;return(e=w.useContext(ag))!=null?e:ZM},KM=e=>w.useContext(ag)?w.createElement(w.Fragment,null,e.children):w.createElement(JM,{...e}),QM=["light","dark"],JM=({forcedTheme:e,disableTransitionOnChange:n=!1,enableSystem:r=!0,enableColorScheme:a=!0,storageKey:l="theme",themes:c=QM,defaultTheme:d=r?"system":"light",attribute:f="data-theme",value:m,children:h,nonce:g,scriptProps:x})=>{let[y,b]=w.useState(()=>t5(l,d)),[j,N]=w.useState(()=>y==="system"?vh():y),S=m?Object.values(m):c,_=w.useCallback(T=>{let D=T;if(!D)return;T==="system"&&r&&(D=vh());let z=m?m[D]:D,H=n?n5(g):null,q=document.documentElement,X=W=>{W==="class"?(q.classList.remove(...S),z&&q.classList.add(z)):W.startsWith("data-")&&(z?q.setAttribute(W,z):q.removeAttribute(W))};if(Array.isArray(f)?f.forEach(X):X(f),a){let W=sb.includes(d)?d:null,G=sb.includes(D)?D:W;q.style.colorScheme=G}H?.()},[g]),A=w.useCallback(T=>{let D=typeof T=="function"?T(y):T;b(D);try{localStorage.setItem(l,D)}catch{}},[y]),E=w.useCallback(T=>{let D=vh(T);N(D),y==="system"&&r&&!e&&_("system")},[y,e]);w.useEffect(()=>{let T=window.matchMedia(uN);return T.addListener(E),E(T),()=>T.removeListener(E)},[E]),w.useEffect(()=>{let T=D=>{D.key===l&&(D.newValue?b(D.newValue):A(d))};return window.addEventListener("storage",T),()=>window.removeEventListener("storage",T)},[A]),w.useEffect(()=>{_(e??y)},[e,y]);let M=w.useMemo(()=>({theme:y,setTheme:A,forcedTheme:e,resolvedTheme:y==="system"?j:y,themes:r?[...c,"system"]:c,systemTheme:r?j:void 0}),[y,A,e,j,r,c]);return w.createElement(ag.Provider,{value:M},w.createElement(e5,{forcedTheme:e,storageKey:l,attribute:f,enableSystem:r,enableColorScheme:a,defaultTheme:d,value:m,themes:c,nonce:g,scriptProps:x}),h)},e5=w.memo(({forcedTheme:e,storageKey:n,attribute:r,enableSystem:a,enableColorScheme:l,defaultTheme:c,value:d,themes:f,nonce:m,scriptProps:h})=>{let g=JSON.stringify([r,n,c,e,f,d,a,l]).slice(1,-1);return w.createElement("script",{...h,suppressHydrationWarning:!0,nonce:typeof window>"u"?m:"",dangerouslySetInnerHTML:{__html:`(${GM.toString()})(${g})`}})}),t5=(e,n)=>{if(XM)return;let r;try{r=localStorage.getItem(e)||void 0}catch{}return r||n},n5=e=>{let n=document.createElement("style");return e&&n.setAttribute("nonce",e),n.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(n),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(n)},1)}},vh=e=>(e||(e=window.matchMedia(uN)),e.matches?"dark":"light");function s5(){const{setTheme:e}=WM();return o.jsxs(bd,{children:[o.jsx(wd,{asChild:!0,children:o.jsxs(Le,{variant:"ghost",size:"sm",children:[o.jsx(OM,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),o.jsx(dM,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),o.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),o.jsxs(Nd,{align:"end",children:[o.jsx($t,{onClick:()=>e("light"),children:"Light"}),o.jsx($t,{onClick:()=>e("dark"),children:"Dark"}),o.jsx($t,{onClick:()=>e("system"),children:"System"})]})]})}const rb=e=>{let n;const r=new Set,a=(h,g)=>{const x=typeof h=="function"?h(n):h;if(!Object.is(x,n)){const y=n;n=g??(typeof x!="object"||x===null)?x:Object.assign({},n,x),r.forEach(b=>b(n,y))}},l=()=>n,f={setState:a,getState:l,getInitialState:()=>m,subscribe:h=>(r.add(h),()=>r.delete(h))},m=n=e(a,l,f);return f},r5=(e=>e?rb(e):rb),o5=e=>e;function a5(e,n=o5){const r=Nn.useSyncExternalStore(e.subscribe,Nn.useCallback(()=>n(e.getState()),[e,n]),Nn.useCallback(()=>n(e.getInitialState()),[e,n]));return Nn.useDebugValue(r),r}const i5=e=>{const n=r5(e),r=a=>a5(n,a);return Object.assign(r,n),r},l5=(e=>i5),ob={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_API_BASE_URL:""},cl=new Map,au=e=>{const n=cl.get(e);return n?Object.fromEntries(Object.entries(n.stores).map(([r,a])=>[r,a.getState()])):{}},c5=(e,n,r)=>{if(e===void 0)return{type:"untracked",connection:n.connect(r)};const a=cl.get(r.name);if(a)return{type:"tracked",store:e,...a};const l={connection:n.connect(r),stores:{}};return cl.set(r.name,l),{type:"tracked",store:e,...l}},u5=(e,n)=>{if(n===void 0)return;const r=cl.get(e);r&&(delete r.stores[n],Object.keys(r.stores).length===0&&cl.delete(e))},d5=e=>{var n,r;if(!e)return;const a=e.split(`
`),l=a.findIndex(d=>d.includes("api.setState"));if(l<0)return;const c=((n=a[l+1])==null?void 0:n.trim())||"";return(r=/.+ (.+) .+/.exec(c))==null?void 0:r[1]},f5=(e,n={})=>(r,a,l)=>{const{enabled:c,anonymousActionType:d,store:f,...m}=n;let h;try{h=(c??(ob?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!h)return e(r,a,l);const{connection:g,...x}=c5(f,h,m);let y=!0;l.setState=((N,S,_)=>{const A=r(N,S);if(!y)return A;const E=_===void 0?{type:d||d5(new Error().stack)||"anonymous"}:typeof _=="string"?{type:_}:_;return f===void 0?(g?.send(E,a()),A):(g?.send({...E,type:`${f}/${E.type}`},{...au(m.name),[f]:l.getState()}),A)}),l.devtools={cleanup:()=>{g&&typeof g.unsubscribe=="function"&&g.unsubscribe(),u5(m.name,f)}};const b=(...N)=>{const S=y;y=!1,r(...N),y=S},j=e(l.setState,a,l);if(x.type==="untracked"?g?.init(j):(x.stores[x.store]=l,g?.init(Object.fromEntries(Object.entries(x.stores).map(([N,S])=>[N,N===x.store?j:S.getState()])))),l.dispatchFromDevtools&&typeof l.dispatch=="function"){let N=!1;const S=l.dispatch;l.dispatch=(..._)=>{(ob?"production":void 0)!=="production"&&_[0].type==="__setState"&&!N&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),N=!0),S(..._)}}return g.subscribe(N=>{var S;switch(N.type){case"ACTION":if(typeof N.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return bh(N.payload,_=>{if(_.type==="__setState"){if(f===void 0){b(_.state);return}Object.keys(_.state).length!==1&&console.error(`
                    [zustand devtools middleware] Unsupported __setState action format.
                    When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
                    and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
                    `);const A=_.state[f];if(A==null)return;JSON.stringify(l.getState())!==JSON.stringify(A)&&b(A);return}l.dispatchFromDevtools&&typeof l.dispatch=="function"&&l.dispatch(_)});case"DISPATCH":switch(N.payload.type){case"RESET":return b(j),f===void 0?g?.init(l.getState()):g?.init(au(m.name));case"COMMIT":if(f===void 0){g?.init(l.getState());return}return g?.init(au(m.name));case"ROLLBACK":return bh(N.state,_=>{if(f===void 0){b(_),g?.init(l.getState());return}b(_[f]),g?.init(au(m.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return bh(N.state,_=>{if(f===void 0){b(_);return}JSON.stringify(l.getState())!==JSON.stringify(_[f])&&b(_[f])});case"IMPORT_STATE":{const{nextLiftedState:_}=N.payload,A=(S=_.computedStates.slice(-1)[0])==null?void 0:S.state;if(!A)return;b(f===void 0?A:A[f]),g?.send(null,_);return}case"PAUSE_RECORDING":return y=!y}return}}),j},m5=f5,bh=(e,n)=>{let r;try{r=JSON.parse(e)}catch(a){console.error("[zustand devtools middleware] Could not parse the received json",a)}r!==void 0&&n(r)};function h5(e,n){let r;try{r=e()}catch{return}return{getItem:l=>{var c;const d=m=>m===null?null:JSON.parse(m,void 0),f=(c=r.getItem(l))!=null?c:null;return f instanceof Promise?f.then(d):d(f)},setItem:(l,c)=>r.setItem(l,JSON.stringify(c,void 0)),removeItem:l=>r.removeItem(l)}}const ep=e=>n=>{try{const r=e(n);return r instanceof Promise?r:{then(a){return ep(a)(r)},catch(a){return this}}}catch(r){return{then(a){return this},catch(a){return ep(a)(r)}}}},p5=(e,n)=>(r,a,l)=>{let c={storage:h5(()=>localStorage),partialize:N=>N,version:0,merge:(N,S)=>({...S,...N}),...n},d=!1;const f=new Set,m=new Set;let h=c.storage;if(!h)return e((...N)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),r(...N)},a,l);const g=()=>{const N=c.partialize({...a()});return h.setItem(c.name,{state:N,version:c.version})},x=l.setState;l.setState=(N,S)=>(x(N,S),g());const y=e((...N)=>(r(...N),g()),a,l);l.getInitialState=()=>y;let b;const j=()=>{var N,S;if(!h)return;d=!1,f.forEach(A=>{var E;return A((E=a())!=null?E:y)});const _=((S=c.onRehydrateStorage)==null?void 0:S.call(c,(N=a())!=null?N:y))||void 0;return ep(h.getItem.bind(h))(c.name).then(A=>{if(A)if(typeof A.version=="number"&&A.version!==c.version){if(c.migrate){const E=c.migrate(A.state,A.version);return E instanceof Promise?E.then(M=>[!0,M]):[!0,E]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,A.state];return[!1,void 0]}).then(A=>{var E;const[M,T]=A;if(b=c.merge(T,(E=a())!=null?E:y),r(b,!0),M)return g()}).then(()=>{_?.(b,void 0),b=a(),d=!0,m.forEach(A=>A(b))}).catch(A=>{_?.(void 0,A)})};return l.persist={setOptions:N=>{c={...c,...N},N.storage&&(h=N.storage)},clearStorage:()=>{h?.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>j(),hasHydrated:()=>d,onHydrate:N=>(f.add(N),()=>{f.delete(N)}),onFinishHydration:N=>(m.add(N),()=>{m.delete(N)})},c.skipHydration||j(),b||y},g5=p5,le=l5()(m5(g5(e=>({agents:[],workflows:[],entities:[],selectedAgent:void 0,isLoadingEntities:!0,entityError:null,currentConversation:void 0,availableConversations:[],chatItems:[],isStreaming:!1,isSubmitting:!1,loadingConversations:!1,inputValue:"",attachments:[],conversationUsage:{total_tokens:0,message_count:0},pendingApprovals:[],currentSession:void 0,availableSessions:[],sessionCheckpoints:[],loadingSessions:!1,loadingCheckpoints:!1,showDebugPanel:!0,debugPanelMinimized:!1,debugPanelWidth:320,debugEvents:[],isResizing:!1,showToolCalls:!0,streamingEnabled:!0,debugPanelTab:"events",debugTraceSubTab:"spans",contextInspectorViewMode:"tokens",contextInspectorCumulative:!1,showAboutModal:!1,showGallery:!1,showDeployModal:!1,showEntityNotFoundToast:!1,toasts:[],oaiMode:{enabled:!1,model:"gpt-4o-mini"},uiMode:"developer",runtime:"python",serverCapabilities:{instrumentation:!1,openai_proxy:!1,deployment:!1},authRequired:!1,serverVersion:null,isDeploying:!1,deploymentLogs:[],lastDeployment:null,azureDeploymentEnabled:!1,setAgents:n=>e({agents:n}),setWorkflows:n=>e({workflows:n}),setEntities:n=>e({entities:n}),setSelectedAgent:n=>e({selectedAgent:n}),addAgent:n=>e(r=>({agents:[...r.agents,n]})),addWorkflow:n=>e(r=>({workflows:[...r.workflows,n]})),updateAgent:n=>e(r=>({agents:r.agents.map(a=>a.id===n.id?n:a),selectedAgent:r.selectedAgent?.id===n.id&&r.selectedAgent.type==="agent"?n:r.selectedAgent})),updateWorkflow:n=>e(r=>({workflows:r.workflows.map(a=>a.id===n.id?n:a),selectedAgent:r.selectedAgent?.id===n.id&&r.selectedAgent.type==="workflow"?n:r.selectedAgent})),removeEntity:n=>e(r=>({agents:r.agents.filter(a=>a.id!==n),workflows:r.workflows.filter(a=>a.id!==n),selectedAgent:r.selectedAgent?.id===n?void 0:r.selectedAgent})),setEntityError:n=>e({entityError:n}),setIsLoadingEntities:n=>e({isLoadingEntities:n}),setCurrentConversation:n=>e({currentConversation:n}),setAvailableConversations:n=>e({availableConversations:n}),setChatItems:n=>e({chatItems:n}),setIsStreaming:n=>e({isStreaming:n}),setIsSubmitting:n=>e({isSubmitting:n}),setLoadingConversations:n=>e({loadingConversations:n}),setInputValue:n=>e({inputValue:n}),setAttachments:n=>e({attachments:n}),updateConversationUsage:n=>e(r=>({conversationUsage:{total_tokens:r.conversationUsage.total_tokens+n,message_count:r.conversationUsage.message_count+1}})),setPendingApprovals:n=>e({pendingApprovals:n}),setCurrentSession:n=>e({currentSession:n}),setAvailableSessions:n=>e({availableSessions:n}),setSessionCheckpoints:n=>e({sessionCheckpoints:n}),setLoadingSessions:n=>e({loadingSessions:n}),setLoadingCheckpoints:n=>e({loadingCheckpoints:n}),addSession:n=>e(r=>({availableSessions:[n,...r.availableSessions]})),removeSession:n=>e(r=>({availableSessions:r.availableSessions.filter(a=>a.conversation_id!==n),currentSession:r.currentSession?.conversation_id===n?void 0:r.currentSession,sessionCheckpoints:r.currentSession?.conversation_id===n?[]:r.sessionCheckpoints})),setShowDebugPanel:n=>e({showDebugPanel:n}),setDebugPanelMinimized:n=>e({debugPanelMinimized:n}),setDebugPanelWidth:n=>e({debugPanelWidth:n}),setShowToolCalls:n=>e({showToolCalls:n}),setStreamingEnabled:n=>e({streamingEnabled:n}),addDebugEvent:n=>e(r=>{const a=Math.floor(Date.now()/1e3),c=(r.debugEvents.length>0?r.debugEvents[r.debugEvents.length-1]:null)?._uiTimestamp??0,d=Math.max(a,c+1);return{debugEvents:[...r.debugEvents,{...n,_uiTimestamp:"created_at"in n&&n.created_at?n.created_at:d}]}}),clearDebugEvents:()=>e({debugEvents:[]}),setIsResizing:n=>e({isResizing:n}),setDebugPanelTab:n=>e({debugPanelTab:n}),setDebugTraceSubTab:n=>e({debugTraceSubTab:n}),setContextInspectorViewMode:n=>e({contextInspectorViewMode:n}),setContextInspectorCumulative:n=>e({contextInspectorCumulative:n}),setShowAboutModal:n=>e({showAboutModal:n}),setShowGallery:n=>e({showGallery:n}),setShowDeployModal:n=>e({showDeployModal:n}),setShowEntityNotFoundToast:n=>e({showEntityNotFoundToast:n}),addToast:n=>e(r=>({toasts:[...r.toasts,{id:`toast-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,type:n.type||"info",duration:n.duration||4e3,...n}]})),removeToast:n=>e(r=>({toasts:r.toasts.filter(a=>a.id!==n)})),setOAIMode:n=>e(r=>n.enabled&&!r.oaiMode.enabled?(Object.keys(localStorage).forEach(a=>{a.startsWith("devui_convs_")&&localStorage.removeItem(a)}),{oaiMode:n,currentConversation:void 0,availableConversations:[],chatItems:[],inputValue:"",attachments:[],conversationUsage:{total_tokens:0,message_count:0},isStreaming:!1,isSubmitting:!1,pendingApprovals:[],debugEvents:[]}):!n.enabled&&r.oaiMode.enabled?(Object.keys(localStorage).forEach(a=>{a.startsWith("devui_convs_")&&localStorage.removeItem(a)}),{oaiMode:n,currentConversation:void 0,availableConversations:[],chatItems:[],inputValue:"",attachments:[],conversationUsage:{total_tokens:0,message_count:0},isStreaming:!1,isSubmitting:!1,pendingApprovals:[],debugEvents:[]}):{oaiMode:n}),toggleOAIMode:()=>e(n=>{const r=!n.oaiMode.enabled;return{oaiMode:{...n.oaiMode,enabled:r},currentConversation:void 0,availableConversations:[],chatItems:[],inputValue:"",attachments:[],conversationUsage:{total_tokens:0,message_count:0},isStreaming:!1,isSubmitting:!1,pendingApprovals:[],debugEvents:[]}}),setServerMeta:n=>e({uiMode:n.uiMode,runtime:n.runtime,serverCapabilities:n.capabilities,authRequired:n.authRequired,serverVersion:n.version||null}),startDeployment:()=>e({isDeploying:!0,deploymentLogs:[],lastDeployment:null}),addDeploymentLog:n=>e(r=>({deploymentLogs:[...r.deploymentLogs,n]})),setDeploymentResult:n=>e({isDeploying:!1,lastDeployment:n}),stopDeployment:()=>e({isDeploying:!1}),clearDeploymentState:()=>e({isDeploying:!1,deploymentLogs:[],lastDeployment:null}),setAzureDeploymentEnabled:n=>e({azureDeploymentEnabled:n}),selectEntity:n=>{e({selectedAgent:n,currentConversation:void 0,availableConversations:[],chatItems:[],inputValue:"",attachments:[],conversationUsage:{total_tokens:0,message_count:0},isStreaming:!1,isSubmitting:!1,pendingApprovals:[],currentSession:void 0,availableSessions:[],sessionCheckpoints:[],debugEvents:[]});const r=new URL(window.location.href);r.searchParams.set("entity_id",n.id),window.history.pushState({},"",r)}}),{name:"devui-storage",partialize:e=>({showDebugPanel:e.showDebugPanel,debugPanelMinimized:e.debugPanelMinimized,debugPanelWidth:e.debugPanelWidth,showToolCalls:e.showToolCalls,streamingEnabled:e.streamingEnabled,oaiMode:e.oaiMode,azureDeploymentEnabled:e.azureDeploymentEnabled,debugPanelTab:e.debugPanelTab,debugTraceSubTab:e.debugTraceSubTab,contextInspectorViewMode:e.contextInspectorViewMode,contextInspectorCumulative:e.contextInspectorCumulative})}),{name:"DevUI Store"})),wu=Object.freeze(Object.defineProperty({__proto__:null,useDevUIStore:le},Symbol.toStringTag,{value:"Module"}));function ab({agents:e,workflows:n,entities:r,selectedItem:a,onSelect:l,onBrowseGallery:c,isLoading:d=!1,onSettingsClick:f}){const{oaiMode:m,serverVersion:h}=le();return o.jsxs("header",{className:"flex h-14 items-center gap-4 border-b px-4",children:[o.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 805 805",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[o.jsx("path",{d:"M402.488 119.713C439.197 119.713 468.955 149.472 468.955 186.18C468.955 192.086 471.708 197.849 476.915 200.635L546.702 237.977C555.862 242.879 566.95 240.96 576.092 236.023C585.476 230.955 596.218 228.078 607.632 228.078C644.341 228.078 674.098 257.836 674.099 294.545C674.099 316.95 663.013 336.765 646.028 348.806C637.861 354.595 631.412 363.24 631.412 373.251V430.818C631.412 440.83 637.861 449.475 646.028 455.264C663.013 467.305 674.099 487.121 674.099 509.526C674.099 546.235 644.341 575.994 607.632 575.994C598.598 575.994 589.985 574.191 582.133 570.926C573.644 567.397 563.91 566.393 555.804 570.731L469.581 616.867C469.193 617.074 468.955 617.479 468.955 617.919C468.955 654.628 439.197 684.386 402.488 684.386C365.779 684.386 336.021 654.628 336.021 617.919C336.021 616.802 335.423 615.765 334.439 615.238L249.895 570C241.61 565.567 231.646 566.713 223.034 570.472C214.898 574.024 205.914 575.994 196.47 575.994C159.761 575.994 130.002 546.235 130.002 509.526C130.002 486.66 141.549 466.49 159.13 454.531C167.604 448.766 174.349 439.975 174.349 429.726V372.538C174.349 362.289 167.604 353.498 159.13 347.734C141.549 335.774 130.002 315.604 130.002 292.738C130.002 256.029 159.761 226.271 196.47 226.271C208.223 226.271 219.263 229.322 228.843 234.674C238.065 239.827 249.351 241.894 258.666 236.91L328.655 199.459C333.448 196.895 336.021 191.616 336.021 186.18C336.021 149.471 365.779 119.713 402.488 119.713ZM475.716 394.444C471.337 396.787 468.955 401.586 468.955 406.552C468.955 429.68 457.142 450.048 439.221 461.954C430.571 467.7 423.653 476.574 423.653 486.959V537.511C423.653 547.896 430.746 556.851 439.379 562.622C449 569.053 461.434 572.052 471.637 566.592L527.264 536.826C536.887 531.677 541.164 520.44 541.164 509.526C541.164 485.968 553.42 465.272 571.904 453.468C580.846 447.757 588.054 438.749 588.054 428.139V371.427C588.054 363.494 582.671 356.676 575.716 352.862C569.342 349.366 561.663 348.454 555.253 351.884L475.716 394.444ZM247.992 349.841C241.997 346.633 234.806 347.465 228.873 350.785C222.524 354.337 217.706 360.639 217.706 367.915V429.162C217.706 439.537 224.611 448.404 233.248 454.152C251.144 466.062 262.937 486.417 262.937 509.526C262.937 519.654 267.026 529.991 275.955 534.769L334.852 566.284C344.582 571.49 356.362 568.81 365.528 562.667C373.735 557.166 380.296 548.643 380.296 538.764V486.305C380.296 476.067 373.564 467.282 365.103 461.516C347.548 449.552 336.021 429.398 336.021 406.552C336.021 400.967 333.389 395.536 328.465 392.902L247.992 349.841ZM270.019 280.008C265.421 282.469 262.936 287.522 262.937 292.738C262.937 293.308 262.929 293.876 262.915 294.443C262.615 306.354 266.961 318.871 277.466 324.492L334.017 354.751C344.13 360.163 356.442 357.269 366.027 350.969C376.495 344.088 389.024 340.085 402.488 340.085C416.203 340.085 428.947 344.239 439.532 351.357C449.163 357.834 461.63 360.861 471.864 355.385L526.625 326.083C537.106 320.474 541.458 307.999 541.182 296.115C541.17 295.593 541.164 295.069 541.164 294.545C541.164 288.551 538.376 282.696 533.091 279.868L463.562 242.664C454.384 237.753 443.274 239.688 434.123 244.65C424.716 249.75 413.941 252.647 402.488 252.647C390.83 252.647 379.873 249.646 370.348 244.373C361.148 239.281 349.917 237.256 340.646 242.217L270.019 280.008Z",fill:"url(#paint0_linear_510_1294)"}),o.jsx("defs",{children:o.jsxs("linearGradient",{id:"paint0_linear_510_1294",x1:"255.628",y1:"-34.3245",x2:"618.483",y2:"632.032",gradientUnits:"userSpaceOnUse",children:[o.jsx("stop",{stopColor:"#D59FFF"}),o.jsx("stop",{offset:"1",stopColor:"#8562C5"})]})})]}),"Dev UI",h&&o.jsxs("span",{className:"text-xs text-muted-foreground ml-1",children:["v",h]}),m.enabled&&o.jsxs(ut,{variant:"secondary",className:"gap-1 ml-2",children:[o.jsx(og,{className:"h-3 w-3"}),"OpenAI: ",m.model]})]}),!m.enabled&&o.jsx(YM,{agents:e,workflows:n,entities:r,selectedItem:a,onSelect:l,onBrowseGallery:c,isLoading:d}),o.jsx("div",{className:"flex-1"}),o.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[o.jsx(s5,{}),o.jsx(Le,{variant:"ghost",size:"sm",onClick:g=>{g.stopPropagation(),f?.()},children:o.jsx(Jh,{className:"h-4 w-4"})})]})]})}function tp(e,[n,r]){return Math.min(r,Math.max(n,e))}function x5(e,n){return w.useReducer((r,a)=>n[r][a]??r,e)}var ig="ScrollArea",[dN,W7]=Kn(ig),[y5,$n]=dN(ig),fN=w.forwardRef((e,n)=>{const{__scopeScrollArea:r,type:a="hover",dir:l,scrollHideDelay:c=600,...d}=e,[f,m]=w.useState(null),[h,g]=w.useState(null),[x,y]=w.useState(null),[b,j]=w.useState(null),[N,S]=w.useState(null),[_,A]=w.useState(0),[E,M]=w.useState(0),[T,D]=w.useState(!1),[z,H]=w.useState(!1),q=rt(n,W=>m(W)),X=jl(l);return o.jsx(y5,{scope:r,type:a,dir:X,scrollHideDelay:c,scrollArea:f,viewport:h,onViewportChange:g,content:x,onContentChange:y,scrollbarX:b,onScrollbarXChange:j,scrollbarXEnabled:T,onScrollbarXEnabledChange:D,scrollbarY:N,onScrollbarYChange:S,scrollbarYEnabled:z,onScrollbarYEnabledChange:H,onCornerWidthChange:A,onCornerHeightChange:M,children:o.jsx(Ye.div,{dir:X,...d,ref:q,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":E+"px",...e.style}})})});fN.displayName=ig;var mN="ScrollAreaViewport",hN=w.forwardRef((e,n)=>{const{__scopeScrollArea:r,children:a,nonce:l,...c}=e,d=$n(mN,r),f=w.useRef(null),m=rt(n,f,d.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),o.jsx(Ye.div,{"data-radix-scroll-area-viewport":"",...c,ref:m,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...e.style},children:o.jsx("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})});hN.displayName=mN;var xs="ScrollAreaScrollbar",lg=w.forwardRef((e,n)=>{const{forceMount:r,...a}=e,l=$n(xs,e.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:d}=l,f=e.orientation==="horizontal";return w.useEffect(()=>(f?c(!0):d(!0),()=>{f?c(!1):d(!1)}),[f,c,d]),l.type==="hover"?o.jsx(v5,{...a,ref:n,forceMount:r}):l.type==="scroll"?o.jsx(b5,{...a,ref:n,forceMount:r}):l.type==="auto"?o.jsx(pN,{...a,ref:n,forceMount:r}):l.type==="always"?o.jsx(cg,{...a,ref:n}):null});lg.displayName=xs;var v5=w.forwardRef((e,n)=>{const{forceMount:r,...a}=e,l=$n(xs,e.__scopeScrollArea),[c,d]=w.useState(!1);return w.useEffect(()=>{const f=l.scrollArea;let m=0;if(f){const h=()=>{window.clearTimeout(m),d(!0)},g=()=>{m=window.setTimeout(()=>d(!1),l.scrollHideDelay)};return f.addEventListener("pointerenter",h),f.addEventListener("pointerleave",g),()=>{window.clearTimeout(m),f.removeEventListener("pointerenter",h),f.removeEventListener("pointerleave",g)}}},[l.scrollArea,l.scrollHideDelay]),o.jsx(Cn,{present:r||c,children:o.jsx(pN,{"data-state":c?"visible":"hidden",...a,ref:n})})}),b5=w.forwardRef((e,n)=>{const{forceMount:r,...a}=e,l=$n(xs,e.__scopeScrollArea),c=e.orientation==="horizontal",d=Sd(()=>m("SCROLL_END"),100),[f,m]=x5("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return w.useEffect(()=>{if(f==="idle"){const h=window.setTimeout(()=>m("HIDE"),l.scrollHideDelay);return()=>window.clearTimeout(h)}},[f,l.scrollHideDelay,m]),w.useEffect(()=>{const h=l.viewport,g=c?"scrollLeft":"scrollTop";if(h){let x=h[g];const y=()=>{const b=h[g];x!==b&&(m("SCROLL"),d()),x=b};return h.addEventListener("scroll",y),()=>h.removeEventListener("scroll",y)}},[l.viewport,c,m,d]),o.jsx(Cn,{present:r||f!=="hidden",children:o.jsx(cg,{"data-state":f==="hidden"?"hidden":"visible",...a,ref:n,onPointerEnter:ke(e.onPointerEnter,()=>m("POINTER_ENTER")),onPointerLeave:ke(e.onPointerLeave,()=>m("POINTER_LEAVE"))})})}),pN=w.forwardRef((e,n)=>{const r=$n(xs,e.__scopeScrollArea),{forceMount:a,...l}=e,[c,d]=w.useState(!1),f=e.orientation==="horizontal",m=Sd(()=>{if(r.viewport){const h=r.viewport.offsetWidth<r.viewport.scrollWidth,g=r.viewport.offsetHeight<r.viewport.scrollHeight;d(f?h:g)}},10);return Ca(r.viewport,m),Ca(r.content,m),o.jsx(Cn,{present:a||c,children:o.jsx(cg,{"data-state":c?"visible":"hidden",...l,ref:n})})}),cg=w.forwardRef((e,n)=>{const{orientation:r="vertical",...a}=e,l=$n(xs,e.__scopeScrollArea),c=w.useRef(null),d=w.useRef(0),[f,m]=w.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=bN(f.viewport,f.content),g={...a,sizes:f,onSizesChange:m,hasThumb:h>0&&h<1,onThumbChange:y=>c.current=y,onThumbPointerUp:()=>d.current=0,onThumbPointerDown:y=>d.current=y};function x(y,b){return E5(y,d.current,f,b)}return r==="horizontal"?o.jsx(w5,{...g,ref:n,onThumbPositionChange:()=>{if(l.viewport&&c.current){const y=l.viewport.scrollLeft,b=ib(y,f,l.dir);c.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:y=>{l.viewport&&(l.viewport.scrollLeft=y)},onDragScroll:y=>{l.viewport&&(l.viewport.scrollLeft=x(y,l.dir))}}):r==="vertical"?o.jsx(N5,{...g,ref:n,onThumbPositionChange:()=>{if(l.viewport&&c.current){const y=l.viewport.scrollTop,b=ib(y,f);c.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:y=>{l.viewport&&(l.viewport.scrollTop=y)},onDragScroll:y=>{l.viewport&&(l.viewport.scrollTop=x(y))}}):null}),w5=w.forwardRef((e,n)=>{const{sizes:r,onSizesChange:a,...l}=e,c=$n(xs,e.__scopeScrollArea),[d,f]=w.useState(),m=w.useRef(null),h=rt(n,m,c.onScrollbarXChange);return w.useEffect(()=>{m.current&&f(getComputedStyle(m.current))},[m]),o.jsx(xN,{"data-orientation":"horizontal",...l,ref:h,sizes:r,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":jd(r)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.x),onDragScroll:g=>e.onDragScroll(g.x),onWheelScroll:(g,x)=>{if(c.viewport){const y=c.viewport.scrollLeft+g.deltaX;e.onWheelScroll(y),NN(y,x)&&g.preventDefault()}},onResize:()=>{m.current&&c.viewport&&d&&a({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:m.current.clientWidth,paddingStart:Fu(d.paddingLeft),paddingEnd:Fu(d.paddingRight)}})}})}),N5=w.forwardRef((e,n)=>{const{sizes:r,onSizesChange:a,...l}=e,c=$n(xs,e.__scopeScrollArea),[d,f]=w.useState(),m=w.useRef(null),h=rt(n,m,c.onScrollbarYChange);return w.useEffect(()=>{m.current&&f(getComputedStyle(m.current))},[m]),o.jsx(xN,{"data-orientation":"vertical",...l,ref:h,sizes:r,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":jd(r)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.y),onDragScroll:g=>e.onDragScroll(g.y),onWheelScroll:(g,x)=>{if(c.viewport){const y=c.viewport.scrollTop+g.deltaY;e.onWheelScroll(y),NN(y,x)&&g.preventDefault()}},onResize:()=>{m.current&&c.viewport&&d&&a({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:m.current.clientHeight,paddingStart:Fu(d.paddingTop),paddingEnd:Fu(d.paddingBottom)}})}})}),[j5,gN]=dN(xs),xN=w.forwardRef((e,n)=>{const{__scopeScrollArea:r,sizes:a,hasThumb:l,onThumbChange:c,onThumbPointerUp:d,onThumbPointerDown:f,onThumbPositionChange:m,onDragScroll:h,onWheelScroll:g,onResize:x,...y}=e,b=$n(xs,r),[j,N]=w.useState(null),S=rt(n,q=>N(q)),_=w.useRef(null),A=w.useRef(""),E=b.viewport,M=a.content-a.viewport,T=Zt(g),D=Zt(m),z=Sd(x,10);function H(q){if(_.current){const X=q.clientX-_.current.left,W=q.clientY-_.current.top;h({x:X,y:W})}}return w.useEffect(()=>{const q=X=>{const W=X.target;j?.contains(W)&&T(X,M)};return document.addEventListener("wheel",q,{passive:!1}),()=>document.removeEventListener("wheel",q,{passive:!1})},[E,j,M,T]),w.useEffect(D,[a,D]),Ca(j,z),Ca(b.content,z),o.jsx(j5,{scope:r,scrollbar:j,hasThumb:l,onThumbChange:Zt(c),onThumbPointerUp:Zt(d),onThumbPositionChange:D,onThumbPointerDown:Zt(f),children:o.jsx(Ye.div,{...y,ref:S,style:{position:"absolute",...y.style},onPointerDown:ke(e.onPointerDown,q=>{q.button===0&&(q.target.setPointerCapture(q.pointerId),_.current=j.getBoundingClientRect(),A.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",b.viewport&&(b.viewport.style.scrollBehavior="auto"),H(q))}),onPointerMove:ke(e.onPointerMove,H),onPointerUp:ke(e.onPointerUp,q=>{const X=q.target;X.hasPointerCapture(q.pointerId)&&X.releasePointerCapture(q.pointerId),document.body.style.webkitUserSelect=A.current,b.viewport&&(b.viewport.style.scrollBehavior=""),_.current=null})})})}),qu="ScrollAreaThumb",yN=w.forwardRef((e,n)=>{const{forceMount:r,...a}=e,l=gN(qu,e.__scopeScrollArea);return o.jsx(Cn,{present:r||l.hasThumb,children:o.jsx(S5,{ref:n,...a})})}),S5=w.forwardRef((e,n)=>{const{__scopeScrollArea:r,style:a,...l}=e,c=$n(qu,r),d=gN(qu,r),{onThumbPositionChange:f}=d,m=rt(n,x=>d.onThumbChange(x)),h=w.useRef(void 0),g=Sd(()=>{h.current&&(h.current(),h.current=void 0)},100);return w.useEffect(()=>{const x=c.viewport;if(x){const y=()=>{if(g(),!h.current){const b=C5(x,f);h.current=b,f()}};return f(),x.addEventListener("scroll",y),()=>x.removeEventListener("scroll",y)}},[c.viewport,g,f]),o.jsx(Ye.div,{"data-state":d.hasThumb?"visible":"hidden",...l,ref:m,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:ke(e.onPointerDownCapture,x=>{const b=x.target.getBoundingClientRect(),j=x.clientX-b.left,N=x.clientY-b.top;d.onThumbPointerDown({x:j,y:N})}),onPointerUp:ke(e.onPointerUp,d.onThumbPointerUp)})});yN.displayName=qu;var ug="ScrollAreaCorner",vN=w.forwardRef((e,n)=>{const r=$n(ug,e.__scopeScrollArea),a=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&a?o.jsx(_5,{...e,ref:n}):null});vN.displayName=ug;var _5=w.forwardRef((e,n)=>{const{__scopeScrollArea:r,...a}=e,l=$n(ug,r),[c,d]=w.useState(0),[f,m]=w.useState(0),h=!!(c&&f);return Ca(l.scrollbarX,()=>{const g=l.scrollbarX?.offsetHeight||0;l.onCornerHeightChange(g),m(g)}),Ca(l.scrollbarY,()=>{const g=l.scrollbarY?.offsetWidth||0;l.onCornerWidthChange(g),d(g)}),h?o.jsx(Ye.div,{...a,ref:n,style:{width:c,height:f,position:"absolute",right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Fu(e){return e?parseInt(e,10):0}function bN(e,n){const r=e/n;return isNaN(r)?0:r}function jd(e){const n=bN(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=(e.scrollbar.size-r)*n;return Math.max(a,18)}function E5(e,n,r,a="ltr"){const l=jd(r),c=l/2,d=n||c,f=l-d,m=r.scrollbar.paddingStart+d,h=r.scrollbar.size-r.scrollbar.paddingEnd-f,g=r.content-r.viewport,x=a==="ltr"?[0,g]:[g*-1,0];return wN([m,h],x)(e)}function ib(e,n,r="ltr"){const a=jd(n),l=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,c=n.scrollbar.size-l,d=n.content-n.viewport,f=c-a,m=r==="ltr"?[0,d]:[d*-1,0],h=tp(e,m);return wN([0,d],[0,f])(h)}function wN(e,n){return r=>{if(e[0]===e[1]||n[0]===n[1])return n[0];const a=(n[1]-n[0])/(e[1]-e[0]);return n[0]+a*(r-e[0])}}function NN(e,n){return e>0&&e<n}var C5=(e,n=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},a=0;return(function l(){const c={left:e.scrollLeft,top:e.scrollTop},d=r.left!==c.left,f=r.top!==c.top;(d||f)&&n(),r=c,a=window.requestAnimationFrame(l)})(),()=>window.cancelAnimationFrame(a)};function Sd(e,n){const r=Zt(e),a=w.useRef(0);return w.useEffect(()=>()=>window.clearTimeout(a.current),[]),w.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(r,n)},[r,n])}function Ca(e,n){const r=Zt(n);Wt(()=>{let a=0;if(e){const l=new ResizeObserver(()=>{cancelAnimationFrame(a),a=window.requestAnimationFrame(r)});return l.observe(e),()=>{window.cancelAnimationFrame(a),l.unobserve(e)}}},[e,r])}var jN=fN,k5=hN,T5=vN;const Wn=w.forwardRef(({className:e,children:n,...r},a)=>o.jsxs(jN,{ref:a,className:We("relative overflow-hidden",e),...r,children:[o.jsx(k5,{className:"h-full w-full rounded-[inherit]",children:n}),o.jsx(SN,{}),o.jsx(T5,{})]}));Wn.displayName=jN.displayName;const SN=w.forwardRef(({className:e,orientation:n="vertical",...r},a)=>o.jsx(lg,{ref:a,orientation:n,className:We("flex touch-none select-none transition-colors",n==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",n==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:o.jsx(yN,{className:"relative flex-1 rounded-full bg-border"})}));SN.displayName=lg.displayName;var _d="Tabs",[A5,K7]=Kn(_d,[md]),_N=md(),[M5,dg]=A5(_d),EN=w.forwardRef((e,n)=>{const{__scopeTabs:r,value:a,onValueChange:l,defaultValue:c,orientation:d="horizontal",dir:f,activationMode:m="automatic",...h}=e,g=jl(f),[x,y]=Ar({prop:a,onChange:l,defaultProp:c??"",caller:_d});return o.jsx(M5,{scope:r,baseId:Mr(),value:x,onValueChange:y,orientation:d,dir:g,activationMode:m,children:o.jsx(Ye.div,{dir:g,"data-orientation":d,...h,ref:n})})});EN.displayName=_d;var CN="TabsList",kN=w.forwardRef((e,n)=>{const{__scopeTabs:r,loop:a=!0,...l}=e,c=dg(CN,r),d=_N(r);return o.jsx(d1,{asChild:!0,...d,orientation:c.orientation,dir:c.dir,loop:a,children:o.jsx(Ye.div,{role:"tablist","aria-orientation":c.orientation,...l,ref:n})})});kN.displayName=CN;var TN="TabsTrigger",AN=w.forwardRef((e,n)=>{const{__scopeTabs:r,value:a,disabled:l=!1,...c}=e,d=dg(TN,r),f=_N(r),m=DN(d.baseId,a),h=ON(d.baseId,a),g=a===d.value;return o.jsx(f1,{asChild:!0,...f,focusable:!l,active:g,children:o.jsx(Ye.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":h,"data-state":g?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:m,...c,ref:n,onMouseDown:ke(e.onMouseDown,x=>{!l&&x.button===0&&x.ctrlKey===!1?d.onValueChange(a):x.preventDefault()}),onKeyDown:ke(e.onKeyDown,x=>{[" ","Enter"].includes(x.key)&&d.onValueChange(a)}),onFocus:ke(e.onFocus,()=>{const x=d.activationMode!=="manual";!g&&!l&&x&&d.onValueChange(a)})})})});AN.displayName=TN;var MN="TabsContent",RN=w.forwardRef((e,n)=>{const{__scopeTabs:r,value:a,forceMount:l,children:c,...d}=e,f=dg(MN,r),m=DN(f.baseId,a),h=ON(f.baseId,a),g=a===f.value,x=w.useRef(g);return w.useEffect(()=>{const y=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(y)},[]),o.jsx(Cn,{present:l||g,children:({present:y})=>o.jsx(Ye.div,{"data-state":g?"active":"inactive","data-orientation":f.orientation,role:"tabpanel","aria-labelledby":m,hidden:!y,id:h,tabIndex:0,...d,ref:n,style:{...e.style,animationDuration:x.current?"0s":void 0},children:y&&c})})});RN.displayName=MN;function DN(e,n){return`${e}-trigger-${n}`}function ON(e,n){return`${e}-content-${n}`}var R5=EN,zN=kN,IN=AN,LN=RN;const D5=R5,$N=w.forwardRef(({className:e,...n},r)=>o.jsx(zN,{ref:r,className:We("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...n}));$N.displayName=zN.displayName;const Nu=w.forwardRef(({className:e,...n},r)=>o.jsx(IN,{ref:r,className:We("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...n}));Nu.displayName=IN.displayName;const ju=w.forwardRef(({className:e,...n},r)=>o.jsx(LN,{ref:r,className:We("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...n}));ju.displayName=LN.displayName;function fg(e){const n=w.useRef({value:e,previous:e});return w.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}var Ed="Checkbox",[O5,Q7]=Kn(Ed),[z5,mg]=O5(Ed);function I5(e){const{__scopeCheckbox:n,checked:r,children:a,defaultChecked:l,disabled:c,form:d,name:f,onCheckedChange:m,required:h,value:g="on",internal_do_not_use_render:x}=e,[y,b]=Ar({prop:r,defaultProp:l??!1,onChange:m,caller:Ed}),[j,N]=w.useState(null),[S,_]=w.useState(null),A=w.useRef(!1),E=j?!!d||!!j.closest("form"):!0,M={checked:y,disabled:c,setChecked:b,control:j,setControl:N,name:f,form:d,value:g,hasConsumerStoppedPropagationRef:A,required:h,defaultChecked:Tr(l)?!1:l,isFormControl:E,bubbleInput:S,setBubbleInput:_};return o.jsx(z5,{scope:n,...M,children:L5(x)?x(M):a})}var PN="CheckboxTrigger",HN=w.forwardRef(({__scopeCheckbox:e,onKeyDown:n,onClick:r,...a},l)=>{const{control:c,value:d,disabled:f,checked:m,required:h,setControl:g,setChecked:x,hasConsumerStoppedPropagationRef:y,isFormControl:b,bubbleInput:j}=mg(PN,e),N=rt(l,g),S=w.useRef(m);return w.useEffect(()=>{const _=c?.form;if(_){const A=()=>x(S.current);return _.addEventListener("reset",A),()=>_.removeEventListener("reset",A)}},[c,x]),o.jsx(Ye.button,{type:"button",role:"checkbox","aria-checked":Tr(m)?"mixed":m,"aria-required":h,"data-state":YN(m),"data-disabled":f?"":void 0,disabled:f,value:d,...a,ref:N,onKeyDown:ke(n,_=>{_.key==="Enter"&&_.preventDefault()}),onClick:ke(r,_=>{x(A=>Tr(A)?!0:!A),j&&b&&(y.current=_.isPropagationStopped(),y.current||_.stopPropagation())})})});HN.displayName=PN;var UN=w.forwardRef((e,n)=>{const{__scopeCheckbox:r,name:a,checked:l,defaultChecked:c,required:d,disabled:f,value:m,onCheckedChange:h,form:g,...x}=e;return o.jsx(I5,{__scopeCheckbox:r,checked:l,defaultChecked:c,disabled:f,required:d,onCheckedChange:h,name:a,form:g,value:m,internal_do_not_use_render:({isFormControl:y})=>o.jsxs(o.Fragment,{children:[o.jsx(HN,{...x,ref:n,__scopeCheckbox:r}),y&&o.jsx(FN,{__scopeCheckbox:r})]})})});UN.displayName=Ed;var BN="CheckboxIndicator",VN=w.forwardRef((e,n)=>{const{__scopeCheckbox:r,forceMount:a,...l}=e,c=mg(BN,r);return o.jsx(Cn,{present:a||Tr(c.checked)||c.checked===!0,children:o.jsx(Ye.span,{"data-state":YN(c.checked),"data-disabled":c.disabled?"":void 0,...l,ref:n,style:{pointerEvents:"none",...e.style}})})});VN.displayName=BN;var qN="CheckboxBubbleInput",FN=w.forwardRef(({__scopeCheckbox:e,...n},r)=>{const{control:a,hasConsumerStoppedPropagationRef:l,checked:c,defaultChecked:d,required:f,disabled:m,name:h,value:g,form:x,bubbleInput:y,setBubbleInput:b}=mg(qN,e),j=rt(r,b),N=fg(c),S=Lp(a);w.useEffect(()=>{const A=y;if(!A)return;const E=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(E,"checked").set,D=!l.current;if(N!==c&&T){const z=new Event("click",{bubbles:D});A.indeterminate=Tr(c),T.call(A,Tr(c)?!1:c),A.dispatchEvent(z)}},[y,N,c,l]);const _=w.useRef(Tr(c)?!1:c);return o.jsx(Ye.input,{type:"checkbox","aria-hidden":!0,defaultChecked:d??_.current,required:f,disabled:m,name:h,value:g,form:x,...n,tabIndex:-1,ref:j,style:{...n.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});FN.displayName=qN;function L5(e){return typeof e=="function"}function Tr(e){return e==="indeterminate"}function YN(e){return Tr(e)?"indeterminate":e?"checked":"unchecked"}function co({className:e,...n}){return o.jsx(UN,{"data-slot":"checkbox",className:We("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:o.jsx(VN,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:o.jsx(jo,{className:"size-3.5"})})})}var GN=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),$5="VisuallyHidden",XN=w.forwardRef((e,n)=>o.jsx(Ye.span,{...e,ref:n,style:{...GN,...e.style}}));XN.displayName=$5;var P5=XN,[Cd,J7]=Kn("Tooltip",[Ua]),kd=Ua(),ZN="TooltipProvider",H5=700,np="tooltip.open",[U5,hg]=Cd(ZN),WN=e=>{const{__scopeTooltip:n,delayDuration:r=H5,skipDelayDuration:a=300,disableHoverableContent:l=!1,children:c}=e,d=w.useRef(!0),f=w.useRef(!1),m=w.useRef(0);return w.useEffect(()=>{const h=m.current;return()=>window.clearTimeout(h)},[]),o.jsx(U5,{scope:n,isOpenDelayedRef:d,delayDuration:r,onOpen:w.useCallback(()=>{window.clearTimeout(m.current),d.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>d.current=!0,a)},[a]),isPointerInTransitRef:f,onPointerInTransitChange:w.useCallback(h=>{f.current=h},[]),disableHoverableContent:l,children:c})};WN.displayName=ZN;var ul="Tooltip",[B5,Tl]=Cd(ul),KN=e=>{const{__scopeTooltip:n,children:r,open:a,defaultOpen:l,onOpenChange:c,disableHoverableContent:d,delayDuration:f}=e,m=hg(ul,e.__scopeTooltip),h=kd(n),[g,x]=w.useState(null),y=Mr(),b=w.useRef(0),j=d??m.disableHoverableContent,N=f??m.delayDuration,S=w.useRef(!1),[_,A]=Ar({prop:a,defaultProp:l??!1,onChange:z=>{z?(m.onOpen(),document.dispatchEvent(new CustomEvent(np))):m.onClose(),c?.(z)},caller:ul}),E=w.useMemo(()=>_?S.current?"delayed-open":"instant-open":"closed",[_]),M=w.useCallback(()=>{window.clearTimeout(b.current),b.current=0,S.current=!1,A(!0)},[A]),T=w.useCallback(()=>{window.clearTimeout(b.current),b.current=0,A(!1)},[A]),D=w.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{S.current=!0,A(!0),b.current=0},N)},[N,A]);return w.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),o.jsx(Hp,{...h,children:o.jsx(B5,{scope:n,contentId:y,open:_,stateAttribute:E,trigger:g,onTriggerChange:x,onTriggerEnter:w.useCallback(()=>{m.isOpenDelayedRef.current?D():M()},[m.isOpenDelayedRef,D,M]),onTriggerLeave:w.useCallback(()=>{j?T():(window.clearTimeout(b.current),b.current=0)},[T,j]),onOpen:M,onClose:T,disableHoverableContent:j,children:r})})};KN.displayName=ul;var sp="TooltipTrigger",QN=w.forwardRef((e,n)=>{const{__scopeTooltip:r,...a}=e,l=Tl(sp,r),c=hg(sp,r),d=kd(r),f=w.useRef(null),m=rt(n,f,l.onTriggerChange),h=w.useRef(!1),g=w.useRef(!1),x=w.useCallback(()=>h.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),o.jsx(Up,{asChild:!0,...d,children:o.jsx(Ye.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...a,ref:m,onPointerMove:ke(e.onPointerMove,y=>{y.pointerType!=="touch"&&!g.current&&!c.isPointerInTransitRef.current&&(l.onTriggerEnter(),g.current=!0)}),onPointerLeave:ke(e.onPointerLeave,()=>{l.onTriggerLeave(),g.current=!1}),onPointerDown:ke(e.onPointerDown,()=>{l.open&&l.onClose(),h.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:ke(e.onFocus,()=>{h.current||l.onOpen()}),onBlur:ke(e.onBlur,l.onClose),onClick:ke(e.onClick,l.onClose)})})});QN.displayName=sp;var pg="TooltipPortal",[V5,q5]=Cd(pg,{forceMount:void 0}),JN=e=>{const{__scopeTooltip:n,forceMount:r,children:a,container:l}=e,c=Tl(pg,n);return o.jsx(V5,{scope:n,forceMount:r,children:o.jsx(Cn,{present:r||c.open,children:o.jsx(fd,{asChild:!0,container:l,children:a})})})};JN.displayName=pg;var ka="TooltipContent",e2=w.forwardRef((e,n)=>{const r=q5(ka,e.__scopeTooltip),{forceMount:a=r.forceMount,side:l="top",...c}=e,d=Tl(ka,e.__scopeTooltip);return o.jsx(Cn,{present:a||d.open,children:d.disableHoverableContent?o.jsx(t2,{side:l,...c,ref:n}):o.jsx(F5,{side:l,...c,ref:n})})}),F5=w.forwardRef((e,n)=>{const r=Tl(ka,e.__scopeTooltip),a=hg(ka,e.__scopeTooltip),l=w.useRef(null),c=rt(n,l),[d,f]=w.useState(null),{trigger:m,onClose:h}=r,g=l.current,{onPointerInTransitChange:x}=a,y=w.useCallback(()=>{f(null),x(!1)},[x]),b=w.useCallback((j,N)=>{const S=j.currentTarget,_={x:j.clientX,y:j.clientY},A=W5(_,S.getBoundingClientRect()),E=K5(_,A),M=Q5(N.getBoundingClientRect()),T=eR([...E,...M]);f(T),x(!0)},[x]);return w.useEffect(()=>()=>y(),[y]),w.useEffect(()=>{if(m&&g){const j=S=>b(S,g),N=S=>b(S,m);return m.addEventListener("pointerleave",j),g.addEventListener("pointerleave",N),()=>{m.removeEventListener("pointerleave",j),g.removeEventListener("pointerleave",N)}}},[m,g,b,y]),w.useEffect(()=>{if(d){const j=N=>{const S=N.target,_={x:N.clientX,y:N.clientY},A=m?.contains(S)||g?.contains(S),E=!J5(_,d);A?y():E&&(y(),h())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[m,g,d,h,y]),o.jsx(t2,{...e,ref:c})}),[Y5,G5]=Cd(ul,{isInside:!1}),X5=cC("TooltipContent"),t2=w.forwardRef((e,n)=>{const{__scopeTooltip:r,children:a,"aria-label":l,onEscapeKeyDown:c,onPointerDownOutside:d,...f}=e,m=Tl(ka,r),h=kd(r),{onClose:g}=m;return w.useEffect(()=>(document.addEventListener(np,g),()=>document.removeEventListener(np,g)),[g]),w.useEffect(()=>{if(m.trigger){const x=y=>{y.target?.contains(m.trigger)&&g()};return window.addEventListener("scroll",x,{capture:!0}),()=>window.removeEventListener("scroll",x,{capture:!0})}},[m.trigger,g]),o.jsx(id,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:x=>x.preventDefault(),onDismiss:g,children:o.jsxs(Bp,{"data-state":m.stateAttribute,...h,...f,ref:n,style:{...f.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(X5,{children:a}),o.jsx(Y5,{scope:r,isInside:!0,children:o.jsx(P5,{id:m.contentId,role:"tooltip",children:l||a})})]})})});e2.displayName=ka;var n2="TooltipArrow",Z5=w.forwardRef((e,n)=>{const{__scopeTooltip:r,...a}=e,l=kd(r);return G5(n2,r).isInside?null:o.jsx(Vp,{...l,...a,ref:n})});Z5.displayName=n2;function W5(e,n){const r=Math.abs(n.top-e.y),a=Math.abs(n.bottom-e.y),l=Math.abs(n.right-e.x),c=Math.abs(n.left-e.x);switch(Math.min(r,a,l,c)){case c:return"left";case l:return"right";case r:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function K5(e,n,r=5){const a=[];switch(n){case"top":a.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":a.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":a.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":a.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return a}function Q5(e){const{top:n,right:r,bottom:a,left:l}=e;return[{x:l,y:n},{x:r,y:n},{x:r,y:a},{x:l,y:a}]}function J5(e,n){const{x:r,y:a}=e;let l=!1;for(let c=0,d=n.length-1;c<n.length;d=c++){const f=n[c],m=n[d],h=f.x,g=f.y,x=m.x,y=m.y;g>a!=y>a&&r<(x-h)*(a-g)/(y-g)+h&&(l=!l)}return l}function eR(e){const n=e.slice();return n.sort((r,a)=>r.x<a.x?-1:r.x>a.x?1:r.y<a.y?-1:r.y>a.y?1:0),tR(n)}function tR(e){if(e.length<=1)return e.slice();const n=[];for(let a=0;a<e.length;a++){const l=e[a];for(;n.length>=2;){const c=n[n.length-1],d=n[n.length-2];if((c.x-d.x)*(l.y-d.y)>=(c.y-d.y)*(l.x-d.x))n.pop();else break}n.push(l)}n.pop();const r=[];for(let a=e.length-1;a>=0;a--){const l=e[a];for(;r.length>=2;){const c=r[r.length-1],d=r[r.length-2];if((c.x-d.x)*(l.y-d.y)>=(c.y-d.y)*(l.x-d.x))r.pop();else break}r.push(l)}return r.pop(),n.length===1&&r.length===1&&n[0].x===r[0].x&&n[0].y===r[0].y?n:n.concat(r)}var nR=WN,sR=KN,rR=QN,oR=JN,s2=e2;const aR=nR,iR=sR,lR=rR,r2=w.forwardRef(({className:e,sideOffset:n=4,...r},a)=>o.jsx(oR,{children:o.jsx(s2,{ref:a,sideOffset:n,className:We("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));r2.displayName=s2.displayName;const fa={MODEL:"gen_ai.request.model",INPUT_TOKENS:"gen_ai.usage.input_tokens",OUTPUT_TOKENS:"gen_ai.usage.output_tokens",INPUT_MESSAGES:"gen_ai.input.messages",SYSTEM_INSTRUCTIONS:"gen_ai.system_instructions"};function cR(e){return e.type==="text"}function uR(e){return e.type==="tool_call"||e.type==="function_call"}function dR(e){return e.type==="tool_result"||e.type==="function_result"||e.type==="tool_call_response"}function fR(e){if(!e)return[];try{return JSON.parse(e)}catch{return[]}}function mR(e){const n={system:0,user:0,assistant:0,toolCalls:0,toolResults:0,total:0};try{let r;if(typeof e=="string")r=fR(e);else if(Array.isArray(e))r=e;else return n;for(const a of r){if(!a||typeof a!="object")continue;const l=a.role,c=a.parts;let d=0;if(Array.isArray(c)){for(const f of c)if(!(!f||typeof f!="object")){if(cR(f)){const m=f.content||f.text||"";d+=m.length}else if(uR(f)){const m=f.name||"",h=f.arguments||"";n.toolCalls+=m.length+h.length}else if(dR(f)){const m=f.result||f.response||"";n.toolResults+=m.length}}}l==="system"?n.system+=d:l==="user"?n.user+=d:l==="assistant"?n.assistant+=d:l==="tool"&&(n.toolResults+=d)}n.total=n.system+n.user+n.assistant+n.toolCalls+n.toolResults}catch{}return n}function hR(e){const n=e.filter(l=>l.type==="response.trace.completed"),r=new Map;for(const l of n){if(!("data"in l))continue;const c=l.data,d=c.response_id||"unknown";r.has(d)||r.set(d,[]),r.get(d).push(c)}const a=[];for(const[l,c]of r){let d=0,f=0,m,h=Date.now()/1e3,g,x=0,y={system:0,user:0,assistant:0,toolCalls:0,toolResults:0,total:0};for(const b of c){const j=b.attributes||{},N=j[fa.INPUT_TOKENS],S=j[fa.OUTPUT_TOKENS];N!==void 0&&(d+=Number(N)),S!==void 0&&(f+=Number(S)),j[fa.MODEL]&&(m=String(j[fa.MODEL])),b.start_time&&b.start_time<h&&(h=b.start_time),b.entity_id&&(g=b.entity_id),b.duration_ms&&(x+=Number(b.duration_ms));const _=j[fa.INPUT_MESSAGES];_&&y.total===0&&(y=mR(_));const A=j[fa.SYSTEM_INSTRUCTIONS];A&&typeof A=="string"&&y.system===0&&(y.system=A.length,y.total+=A.length)}(d>0||f>0)&&a.push({response_id:l,timestamp:h,input_tokens:d,output_tokens:f,total_tokens:d+f,model:m,entity_id:g,duration_ms:x,composition:y})}return a.sort((l,c)=>l.timestamp-c.timestamp),a}function pR(e){if(e.length===0)return{totalInput:0,totalOutput:0,totalTokens:0,avgInput:0,avgOutput:0,avgTotal:0,peakInput:0,peakOutput:0,peakTotal:0,turnCount:0};const n=e.reduce((f,m)=>f+m.input_tokens,0),r=e.reduce((f,m)=>f+m.output_tokens,0),a=n+r,l=Math.max(...e.map(f=>f.input_tokens)),c=Math.max(...e.map(f=>f.output_tokens)),d=Math.max(...e.map(f=>f.total_tokens));return{totalInput:n,totalOutput:r,totalTokens:a,avgInput:Math.round(n/e.length),avgOutput:Math.round(r/e.length),avgTotal:Math.round(a/e.length),peakInput:l,peakOutput:c,peakTotal:d,turnCount:e.length}}function gR(e){return e.reduce((n,r)=>({system:n.system+r.composition.system,user:n.user+r.composition.user,assistant:n.assistant+r.composition.assistant,toolCalls:n.toolCalls+r.composition.toolCalls,toolResults:n.toolResults+r.composition.toolResults,total:n.total+r.composition.total}),{system:0,user:0,assistant:0,toolCalls:0,toolResults:0,total:0})}function In(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const Pt={input:"bg-blue-500 dark:bg-blue-600",output:"bg-emerald-500 dark:bg-emerald-600",system:"bg-purple-500 dark:bg-purple-600",user:"bg-blue-500 dark:bg-blue-600",assistant:"bg-emerald-500 dark:bg-emerald-600",toolCalls:"bg-amber-500 dark:bg-amber-600",toolResults:"bg-orange-500 dark:bg-orange-600"};function lb({segments:e,maxValue:n,height:r=20,renderLabel:a}){const l=e.reduce((f,m)=>f+m.value,0);if(l===0)return o.jsx("div",{className:"flex items-center gap-2 w-full",children:o.jsx("div",{className:"rounded bg-muted/30 flex-1",style:{height:`${r}px`}})});const c=n>0?l/n*100:100,d=e.filter(f=>f.value>0).map(f=>({...f,percent:Math.round(f.value/l*100)}));return o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[o.jsx("div",{className:"relative rounded overflow-hidden bg-muted/30 flex-1",style:{height:`${r}px`},children:o.jsx(aR,{delayDuration:150,children:o.jsx("div",{className:"h-full flex transition-all duration-300",style:{width:`${c}%`},children:d.map(f=>o.jsxs(iR,{children:[o.jsx(lR,{asChild:!0,children:o.jsx("div",{className:`h-full ${f.color} transition-all duration-150 hover:brightness-110 hover:scale-y-[1.15] origin-bottom cursor-default`,style:{width:`${f.value/l*100}%`}})}),o.jsx(r2,{side:"top",className:"text-xs",children:o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:`w-2 h-2 rounded-sm ${f.color} flex-shrink-0`}),o.jsx("span",{className:"font-medium",children:f.label}),o.jsxs("span",{className:"opacity-80",children:[In(f.value)," (",f.percent,"%)"]})]})})]},f.key))})})}),a?.(l,e)]})}function xR(e,n){return[{key:"input",value:e,color:Pt.input,label:"Input"},{key:"output",value:n,color:Pt.output,label:"Output"}]}function yR(e){return[{key:"system",value:e.system,color:Pt.system,label:"System"},{key:"user",value:e.user,color:Pt.user,label:"User"},{key:"assistant",value:e.assistant,color:Pt.assistant,label:"Assistant"},{key:"toolCalls",value:e.toolCalls,color:Pt.toolCalls,label:"Tool Calls"},{key:"toolResults",value:e.toolResults,color:Pt.toolResults,label:"Tool Results"}]}function o2({composition:e,className:n=""}){const{system:r,user:a,assistant:l,toolCalls:c,toolResults:d,total:f}=e;if(f===0)return o.jsx("div",{className:`text-xs text-muted-foreground ${n}`,children:"No composition data available"});const m=[{label:"System",value:r,color:Pt.system},{label:"User",value:a,color:Pt.user},{label:"Assistant",value:l,color:Pt.assistant},{label:"Tool Calls",value:c,color:Pt.toolCalls},{label:"Tool Results",value:d,color:Pt.toolResults}].filter(h=>h.value>0);return o.jsx("div",{className:`space-y-1.5 ${n}`,children:m.map(h=>{const g=Math.round(h.value/f*100);return o.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[o.jsx("div",{className:`w-2 h-2 rounded-sm ${h.color}`}),o.jsx("span",{className:"text-muted-foreground w-20",children:h.label}),o.jsx("div",{className:"flex-1 h-3 bg-muted/30 rounded overflow-hidden",children:o.jsx("div",{className:`h-full ${h.color} transition-all duration-300`,style:{width:`${g}%`}})}),o.jsxs("span",{className:"font-mono w-10 text-right text-muted-foreground",children:[g,"%"]})]},h.label)})})}function vR({turn:e,index:n,maxValue:r,maxCompositionValue:a,cumulativeInput:l,cumulativeOutput:c,cumulativeComposition:d,showCumulative:f,viewMode:m}){const[h,g]=w.useState(!1),x=f?l:e.input_tokens,y=f?c:e.output_tokens,b=f?d:e.composition,j=new Date(e.timestamp*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return o.jsxs("div",{className:"border-b border-muted/50 last:border-0",children:[o.jsxs("div",{className:"flex items-center gap-3 py-2 px-2 hover:bg-muted/30 cursor-pointer transition-colors",onClick:()=>g(!h),children:[o.jsx("div",{className:"w-6 h-6 rounded-full bg-muted flex items-center justify-center text-xs font-medium flex-shrink-0",children:n+1}),o.jsx("div",{className:"flex-1 min-w-0",children:m==="tokens"?o.jsx(lb,{segments:xR(x,y),maxValue:r,height:20,renderLabel:(N,S)=>o.jsxs("div",{className:"flex items-center gap-1 text-xs font-mono text-muted-foreground min-w-[80px] justify-end",children:[o.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:["↑",In(S[0]?.value||0)]}),o.jsx("span",{children:"/"}),o.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["↓",In(S[1]?.value||0)]})]})}):o.jsx(lb,{segments:yR(b),maxValue:a,height:20,renderLabel:N=>o.jsxs("div",{className:"text-xs font-mono text-muted-foreground min-w-[50px] text-right",children:[In(Math.round(N/4)),"~"]})})}),o.jsx("div",{className:"text-muted-foreground flex-shrink-0",children:h?o.jsx(Rt,{className:"h-4 w-4"}):o.jsx(en,{className:"h-4 w-4"})})]}),h&&o.jsx("div",{className:"pb-3",children:o.jsxs("div",{className:"flex items-start gap-3 px-2",children:[o.jsx("div",{className:"w-6 flex justify-center flex-shrink-0",children:o.jsx("div",{className:"w-px h-full bg-muted"})}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("div",{className:"text-muted-foreground text-xs mt-1",children:"└─"}),o.jsxs("div",{className:"flex-1 space-y-3",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[o.jsxs("div",{children:["Time: ",o.jsx("span",{className:"font-mono text-foreground",children:j})]}),o.jsxs("div",{children:["Duration: ",o.jsxs("span",{className:"font-mono text-foreground",children:[e.duration_ms.toFixed(0),"ms"]})]}),e.model&&o.jsxs("div",{children:["Model: ",o.jsx("span",{className:"font-mono text-foreground",children:e.model})]}),e.entity_id&&o.jsxs("div",{children:["Entity: ",o.jsx("span",{className:"font-mono text-foreground",children:e.entity_id})]})]}),m==="tokens"&&o.jsxs("div",{className:"flex gap-4 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"Input:"})," ",o.jsx("span",{className:"font-mono",children:e.input_tokens.toLocaleString()})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-emerald-600 dark:text-emerald-400",children:"Output:"})," ",o.jsx("span",{className:"font-mono",children:e.output_tokens.toLocaleString()})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Total:"})," ",o.jsx("span",{className:"font-mono",children:e.total_tokens.toLocaleString()})]})]}),m==="composition"&&e.composition.total>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-xs text-muted-foreground mb-2 flex items-center gap-1",children:[o.jsx(Fs,{className:"h-3 w-3"}),"Context Composition (estimated from ~",In(Math.round(e.composition.total/4))," tokens)"]}),o.jsx(o2,{composition:e.composition})]})]})]})})]})})]})}function wh({label:e,value:n,icon:r,color:a="default"}){const l={default:"text-muted-foreground",blue:"text-blue-600 dark:text-blue-400",green:"text-emerald-600 dark:text-emerald-400"}[a];return o.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/30 rounded",children:[o.jsx(r,{className:`h-4 w-4 ${l}`}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-xs text-muted-foreground truncate",children:e}),o.jsx("div",{className:"font-mono text-sm font-medium",children:n})]})]})}function bR({events:e}){const n=le(x=>x.contextInspectorViewMode),r=le(x=>x.setContextInspectorViewMode),a=le(x=>x.contextInspectorCumulative),l=le(x=>x.setContextInspectorCumulative),c=w.useMemo(()=>hR(e),[e]),d=w.useMemo(()=>pR(c),[c]),f=w.useMemo(()=>gR(c),[c]),m=w.useMemo(()=>c.length===0?0:a?d.totalTokens:0,[c,a,d.totalTokens]),h=w.useMemo(()=>c.length===0?0:a?f.total:0,[c,a,f.total]),g=w.useMemo(()=>{let x=0,y=0,b={system:0,user:0,assistant:0,toolCalls:0,toolResults:0,total:0};return c.map(j=>(x+=j.input_tokens,y+=j.output_tokens,b={system:b.system+j.composition.system,user:b.user+j.composition.user,assistant:b.assistant+j.composition.assistant,toolCalls:b.toolCalls+j.composition.toolCalls,toolResults:b.toolResults+j.composition.toolResults,total:b.total+j.composition.total},{input:x,output:y,composition:{...b}}))},[c]);return c.length===0?o.jsxs("div",{className:"flex flex-col items-center text-center p-6 pt-9",children:[o.jsx(ha,{className:"h-8 w-8 text-muted-foreground mb-3"}),o.jsx("div",{className:"text-sm font-medium mb-1",children:"No Data"}),o.jsxs("div",{className:"text-xs text-muted-foreground max-w-[200px]",children:["Run"," ",o.jsx("span",{className:"font-mono bg-accent/10 px-1 rounded",children:"devui --instrumentation"})," ","and start a conversation."]})]}):o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"p-3 border-b flex-shrink-0 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ha,{className:"h-4 w-4"}),o.jsx("span",{className:"font-medium text-sm",children:"Context Inspector"}),o.jsxs(ut,{variant:"outline",className:"text-xs",children:[c.length," turn",c.length!==1?"s":""]})]}),o.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[o.jsx(co,{checked:a,onCheckedChange:x=>l(x===!0),className:"h-3.5 w-3.5"}),o.jsx("span",{children:"Cumulative"})]})]}),o.jsxs("div",{className:"flex items-center bg-muted rounded-md p-1",children:[o.jsx("button",{onClick:()=>r("tokens"),className:`flex-1 px-3 py-1.5 text-xs rounded transition-colors ${n==="tokens"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Tokens"}),o.jsx("button",{onClick:()=>r("composition"),className:`flex-1 px-3 py-1.5 text-xs rounded transition-colors ${n==="composition"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Composition"})]}),o.jsx("div",{className:"text-xs text-muted-foreground",children:n==="tokens"?"Token usage per turn":"Context breakdown by message type (chars)"})]}),o.jsx(Wn,{className:"flex-1",children:o.jsxs("div",{className:"p-3 space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-4 text-xs px-1 flex-wrap",children:[n==="tokens"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:`w-3 h-3 rounded ${Pt.input}`}),o.jsx("span",{className:"text-muted-foreground",children:"Input (↑)"})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:`w-3 h-3 rounded ${Pt.output}`}),o.jsx("span",{className:"text-muted-foreground",children:"Output (↓)"})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:`w-2.5 h-2.5 rounded-sm ${Pt.system}`}),o.jsx("span",{className:"text-muted-foreground",children:"System"})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:`w-2.5 h-2.5 rounded-sm ${Pt.user}`}),o.jsx("span",{className:"text-muted-foreground",children:"User"})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:`w-2.5 h-2.5 rounded-sm ${Pt.assistant}`}),o.jsx("span",{className:"text-muted-foreground",children:"Assistant"})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:`w-2.5 h-2.5 rounded-sm ${Pt.toolCalls}`}),o.jsx("span",{className:"text-muted-foreground",children:"Tools"})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:`w-2.5 h-2.5 rounded-sm ${Pt.toolResults}`}),o.jsx("span",{className:"text-muted-foreground",children:"Results"})]})]}),o.jsx("div",{className:"flex-1"}),o.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[o.jsx(Fs,{className:"h-3 w-3"}),o.jsx("span",{children:"Click for details"})]})]}),o.jsx("div",{className:"border rounded-lg overflow-hidden",children:c.map((x,y)=>o.jsx(vR,{turn:x,index:y,maxValue:m,maxCompositionValue:h,cumulativeInput:g[y]?.input||0,cumulativeOutput:g[y]?.output||0,cumulativeComposition:g[y]?.composition||x.composition,showCumulative:a,viewMode:n},x.response_id))}),o.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[o.jsx("div",{className:"p-3 bg-muted/30 border-b",children:o.jsx("span",{className:"text-xs font-medium",children:"Session Summary"})}),o.jsxs("div",{className:"p-3 space-y-3",children:[o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.jsx(wh,{label:"Total Tokens",value:In(d.totalTokens),icon:JA}),o.jsx(wh,{label:"Input",value:In(d.totalInput),icon:ha,color:"blue"}),o.jsx(wh,{label:"Output",value:In(d.totalOutput),icon:ha,color:"green"})]}),c.length>1&&o.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs pt-2 border-t border-muted/50",children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-muted-foreground",children:"Avg per turn:"}),o.jsx("span",{className:"font-mono",children:In(d.avgTotal)})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-muted-foreground",children:"Peak turn:"}),o.jsx("span",{className:"font-mono",children:In(d.peakTotal)})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-muted-foreground",children:"Avg input:"}),o.jsx("span",{className:"font-mono text-blue-600 dark:text-blue-400",children:In(d.avgInput)})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-muted-foreground",children:"Avg output:"}),o.jsx("span",{className:"font-mono text-emerald-600 dark:text-emerald-400",children:In(d.avgOutput)})]})]}),f.total>0&&o.jsx("div",{className:"pt-3 border-t border-muted/50",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("div",{className:"text-muted-foreground text-xs mt-0.5",children:"└─"}),o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"text-xs text-muted-foreground mb-2 flex items-center gap-1",children:[o.jsx(Fs,{className:"h-3 w-3"}),"Total Composition (all turns)"]}),o.jsx(o2,{composition:f})]})]})})]})]})]})})]})}function a2(){return o.jsx("div",{className:"flex items-center gap-2 py-3 px-2",children:o.jsx("div",{className:"flex-1 border-t border-border/50"})})}function i2(e){const n=[];let r=!1;for(let a=0;a<e.length;a++){const l=e[a];r&&l.type!=="response.done"&&(n.push({type:"separator",id:`sep-${a}`}),r=!1),n.push(l),(l.type==="response.done"||l.type==="response.completed")&&(r=!0)}return n}function zr(e){if(e.type==="response.function_result.complete"){const n=e;return{call_id:n.call_id,output:n.output,status:n.status}}return null}function gg(e){const n=[],r=new Map,a=new Map;let l="";for(const c of e){if(c.type==="response.trace.completed"||c.type==="response.trace.completed")continue;if(c.type==="response.output_item.added"){const m=c.item;if(m.type==="function_call"){const h=m,g=h.call_id;r.set(g,{name:h.name,arguments:"",callId:g,itemId:h.id,timestamp:new Date().toISOString()}),a.set(g,h.name)}n.push(c);continue}const d=zr(c)!==null;if(c.type==="response.completed"||c.type==="response.done"||c.type==="error"||c.type==="response.workflow_event.completed"||c.type==="response.trace.completed"||c.type==="response.trace.completed"||d){if(l.trim()&&(n.push({type:"response.output_text.delta",delta:l.trim()}),l=""),(c.type==="response.trace.completed"||c.type==="response.trace.completed")&&"data"in c){const m=c.data;if(m.attributes&&m.attributes["gen_ai.output.messages"]&&typeof m.attributes["gen_ai.output.messages"]=="string")try{const h=JSON.parse(m.attributes["gen_ai.output.messages"]);for(const g of h)if(g.parts)for(const x of g.parts)x.type==="tool_call"&&x.name&&x.id&&a.set(x.id,x.name)}catch{}}const f=zr(c);if(f){const m=f.call_id;if(m&&r.has(m)){const h=r.get(m),g=a.get(m)||h.name||"unknown";n.push({type:"response.function_call.complete",data:{name:g,arguments:h.arguments,call_id:h.callId}}),r.delete(m)}}n.push(c);continue}if(c.type==="response.function_call.delta"&&"data"in c){const f=c.data,m=f.call_id||`call_${Date.now()}`;r.has(m)||r.set(m,{name:f.name||void 0,arguments:"",callId:m,timestamp:new Date().toISOString()}),f.name&&f.name.trim()&&(r.get(m).name=f.name.trim());continue}if(c.type==="response.function_call.complete"&&"data"in c){n.push(c);continue}if(c.type==="response.function_call_arguments.delta"){let f="",m=null;if("delta"in c&&typeof c.delta=="string"&&(f=c.delta),"item_id"in c&&c.item_id){const h=c.item_id;for(const[g,x]of r.entries())if(x.itemId===h||g===h){m=g;break}}if(f&&m){const h=r.get(m);if(h){if(f==="{}"&&h.arguments==="")continue;h.arguments+=f}else console.warn(`Received argument delta for unknown call with item_id: ${"item_id"in c?c.item_id:"unknown"}`)}continue}if(c.type==="response.output_text.delta"&&"delta"in c){l+=c.delta||"",l.length>100&&(l.includes(`

`)||l.trim().match(/[.!?]\s*$/))&&(n.push({type:"response.output_text.delta",delta:l.trim()}),l="");continue}c.type!=="response.usage.complete"&&n.push(c)}for(const[,c]of r)if(c.arguments.trim()&&c.arguments.trim().length>2){const d=a.get(c.callId)||c.name||"unknown";n.push({type:"response.function_call.complete",data:{name:d,arguments:c.arguments,call_id:c.callId}})}return l.trim()&&n.push({type:"response.output_text.delta",delta:l.trim()}),n}function wR(e){switch(e.type){case"response.output_text.delta":if("delta"in e){const n=e.delta||"";return n.length>60?`${n.slice(0,60)}...`:n}return"Text output";case"response.function_call.complete":if("data"in e&&e.data){const n=e.data;let r=n.name||"unknown";(!r||r==="unknown")&&(r="function_call");const a=n.arguments?typeof n.arguments=="string"?n.arguments.slice(0,30):JSON.stringify(n.arguments).slice(0,30):"";return`Calling ${r}(${a}${a.length>=30?"...":""})`}return"Function call";case"response.function_call_arguments.delta":return"delta"in e&&e.delta?`Function arg delta: ${e.delta.slice(0,30)}${e.delta.length>30?"...":""}`:"Function arguments...";case"response.function_result.complete":{const r=e.output.slice(0,40);return`Function result: ${r}${r.length>=40?"...":""}`}case"response.output_item.added":{const n=e;return n.item.type==="function_call"?`Tool call: ${n.item.name}`:"Output item added"}case"response.workflow_event.completed":return"data"in e&&e.data?`Executor: ${e.data.executor_id||"unknown"}`:"Workflow event";case"response.trace.completed":return"data"in e&&e.data?`Trace: ${e.data.operation_name||"unknown"}`:"Trace event";case"response.completed":if("response"in e&&e.response&&"usage"in e.response){const r=e.response.usage;if(r)return`Response complete (${r.total_tokens} tokens)`}return"Response complete";case"response.done":return"Response complete";case"error":return"message"in e&&typeof e.message=="string"?e.message:"Error occurred";default:return`${e.type}`}}function NR(e){switch(e){case"response.output_text.delta":return eg;case"response.function_call.complete":case"response.function_call.delta":case"response.function_call_arguments.delta":return _a;case"response.function_result.complete":return nn;case"response.output_item.added":return nn;case"response.workflow_event.completed":return Qp;case"response.trace.completed":return Bu;case"response.completed":return nn;case"response.done":return nn;case"error":return kl;default:return hs}}function jR(e){switch(e){case"response.output_text.delta":return"text-gray-600 dark:text-gray-400";case"response.function_call.complete":case"response.function_call.delta":case"response.function_call_arguments.delta":return"text-blue-600 dark:text-blue-400";case"response.function_result.complete":return"text-green-600 dark:text-green-400";case"response.output_item.added":return"text-green-600 dark:text-green-400";case"response.workflow_event.completed":return"text-purple-600 dark:text-purple-400";case"response.trace.completed":return"text-orange-600 dark:text-orange-400";case"response.completed":return"text-green-600 dark:text-green-400";case"response.done":return"text-green-600 dark:text-green-400";case"error":return"text-red-600 dark:text-red-400";default:return"text-gray-600 dark:text-gray-400"}}function SR({event:e}){const[n,r]=w.useState(!1),a=e.type||"unknown",l=NR(a),c=jR(a),d="_uiTimestamp"in e&&typeof e._uiTimestamp=="number"?new Date(e._uiTimestamp*1e3).toLocaleTimeString():new Date().toLocaleTimeString(),f=wR(e),m=e.type==="response.function_call.complete"&&"data"in e&&e.data||e.type==="response.function_result.complete"||e.type==="response.output_item.added"&&zr(e)!==null||e.type==="response.workflow_event.completed"&&"data"in e&&e.data||e.type==="response.trace.completed"&&"data"in e&&e.data||e.type==="response.trace.completed"&&"data"in e&&e.data||e.type==="response.output_text.delta"&&"delta"in e&&e.delta&&e.delta.length>100||e.type==="response.completed"&&"response"in e&&e.response||e.type==="error";return o.jsxs("div",{className:"border-l-2 border-muted pl-3 py-2 hover:bg-muted/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-1",children:[o.jsx(l,{className:`h-3 w-3 ${c}`}),o.jsx("span",{className:"font-mono",children:d}),o.jsx(ut,{variant:"outline",className:"text-xs py-0",children:e.type?e.type.replace("response.",""):"unknown"})]}),o.jsxs("div",{className:"text-sm",children:[o.jsxs("div",{className:`flex items-center gap-2 ${m?"cursor-pointer":""}`,onClick:()=>m&&r(!n),children:[m&&o.jsx("div",{className:"text-muted-foreground",children:n?o.jsx(Rt,{className:"h-3 w-3"}):o.jsx(en,{className:"h-3 w-3"})}),o.jsx("div",{className:"text-muted-foreground flex-1",children:m&&f.length>80?`${f.slice(0,80)}...`:f})]}),n&&m&&o.jsx("div",{className:"mt-2 ml-5 p-3 bg-muted/30 rounded border",children:o.jsx(_R,{event:e})})]})]})}function _R({event:e}){if(e.type==="error"){const n=e;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(kl,{className:"h-4 w-4 text-red-500"}),o.jsx("span",{className:"font-semibold text-sm",children:"Error Details"})]}),o.jsxs("div",{className:"text-xs",children:[n.message&&o.jsxs("div",{className:"mb-2",children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Message:"}),o.jsx("div",{className:"mt-1",children:o.jsx("pre",{className:"text-xs bg-destructive/10 border border-destructive/30 rounded p-2 text-destructive whitespace-pre-wrap break-all",children:n.message})})]}),n.code&&o.jsxs("div",{className:"mb-2",children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Code:"}),o.jsx("span",{className:"ml-2 font-mono text-xs",children:n.code})]}),n.param&&o.jsxs("div",{className:"mb-2",children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Parameter:"}),o.jsx("span",{className:"ml-2 font-mono text-xs",children:n.param})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Raw Event:"}),o.jsx("div",{className:"mt-1",children:o.jsx("pre",{className:"text-xs bg-background border rounded p-2 whitespace-pre-wrap break-all max-h-32 overflow-auto",children:JSON.stringify(e,null,2)})})]})]})]})}switch(e.type){case"response.function_call.complete":if("data"in e&&e.data){const n=e.data;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(_a,{className:"h-4 w-4 text-blue-500"}),o.jsx("span",{className:"font-semibold text-sm",children:"Function Call"})]}),o.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Function:"}),o.jsx("span",{className:"ml-2 font-mono bg-blue-100 dark:bg-blue-900 px-2 py-1 rounded",children:n.name||"unknown"})]}),n.call_id&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Call ID:"}),o.jsx("span",{className:"ml-2 font-mono text-xs",children:n.call_id})]}),n.arguments&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Arguments:"}),o.jsx("div",{className:"mt-1 max-h-32 overflow-auto",children:o.jsx("pre",{className:"text-xs bg-background border rounded p-2 whitespace-pre-wrap max-w-full break-all",children:typeof n.arguments=="string"?n.arguments:JSON.stringify(n.arguments,null,1)})})]})]})]})}break;case"response.function_result.complete":{const n=e;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(nn,{className:"h-4 w-4 text-green-500"}),o.jsx("span",{className:"font-semibold text-sm",children:"Function Result"})]}),o.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Call ID:"}),o.jsx("span",{className:"ml-2 font-mono text-xs",children:n.call_id})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Status:"}),o.jsx("span",{className:`ml-2 px-2 py-1 rounded text-xs font-medium ${n.status==="completed"?"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200":"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200"}`,children:n.status})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Output:"}),o.jsx("div",{className:"mt-1 max-h-32 overflow-auto",children:o.jsx("pre",{className:"text-xs bg-background border rounded p-2 whitespace-pre-wrap max-w-full break-all",children:n.output})})]})]})]})}case"response.output_item.added":{const n=zr(e);if(n)return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(nn,{className:"h-4 w-4 text-green-500"}),o.jsx("span",{className:"font-semibold text-sm",children:"Function Result"})]}),o.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Call ID:"}),o.jsx("span",{className:"ml-2 font-mono text-xs",children:n.call_id})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Status:"}),o.jsx("span",{className:`ml-2 px-2 py-1 rounded text-xs font-medium ${n.status==="completed"?"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200":"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200"}`,children:n.status})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Output:"}),o.jsx("div",{className:"mt-1 max-h-32 overflow-auto",children:o.jsx("pre",{className:"text-xs bg-background border rounded p-2 whitespace-pre-wrap max-w-full break-all",children:n.output})})]})]})]});break}case"response.workflow_event.completed":if("data"in e&&e.data){const n=e.data;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Qp,{className:"h-4 w-4 text-purple-500"}),o.jsx("span",{className:"font-semibold text-sm",children:"Workflow Event"})]}),o.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Event Type:"}),o.jsx("span",{className:"ml-2 font-mono bg-purple-100 dark:bg-purple-900 px-2 py-1 rounded",children:n.event_type||"unknown"})]}),n.executor_id&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Executor:"}),o.jsx("span",{className:"ml-2 font-mono",children:n.executor_id})]}),n.timestamp&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Timestamp:"}),o.jsx("span",{className:"ml-2 font-mono text-xs",children:n.timestamp})]}),n.data&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Data:"}),o.jsx("div",{className:"mt-1 max-h-32 overflow-auto",children:o.jsx("pre",{className:"text-xs bg-background border rounded p-2 whitespace-pre-wrap max-w-full break-all",children:typeof n.data=="string"?n.data:JSON.stringify(n.data,null,1)})})]})]})]})}break;case"response.trace.completed":if("data"in e&&e.data){const n=e.data;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Bu,{className:"h-4 w-4 text-orange-500"}),o.jsx("span",{className:"font-semibold text-sm",children:"Trace Event"})]}),o.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Operation:"}),o.jsx("span",{className:"ml-2 font-mono bg-orange-100 dark:bg-orange-900 px-2 py-1 rounded",children:n.operation_name||"unknown"})]}),n.span_id&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Span ID:"}),o.jsx("span",{className:"ml-2 font-mono text-xs",children:n.span_id})]}),n.trace_id&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Trace ID:"}),o.jsx("span",{className:"ml-2 font-mono text-xs",children:n.trace_id})]}),n.duration_ms&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Duration:"}),o.jsxs("span",{className:"ml-2 font-mono text-xs",children:[Number(n.duration_ms).toFixed(2),"ms"]})]}),n.status&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Status:"}),o.jsx("span",{className:`ml-2 px-2 py-1 rounded text-xs font-medium ${n.status==="StatusCode.UNSET"||n.status==="OK"?"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200":"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200"}`,children:n.status||"unknown"})]}),n.entity_id&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Entity:"}),o.jsx("span",{className:"ml-2 font-mono text-xs",children:n.entity_id})]}),n.attributes&&Object.keys(n.attributes).length>0&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Attributes:"}),o.jsx("div",{className:"mt-1 max-h-32 overflow-auto",children:o.jsx("pre",{className:"text-xs bg-background border rounded p-2 whitespace-pre-wrap break-all",children:l2(n.attributes)})})]})]})]})}break;case"response.output_text.delta":if("delta"in e&&e.delta)return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(eg,{className:"h-4 w-4 text-gray-500"}),o.jsx("span",{className:"font-semibold text-sm",children:"Text Output"})]}),o.jsx("div",{className:"max-h-32 overflow-auto",children:o.jsx("pre",{className:"text-xs bg-background border rounded p-2 whitespace-pre-wrap max-w-full break-all",children:e.delta})})]});break;case"response.completed":if("response"in e&&e.response){const r=e.response;return o.jsx("div",{className:"space-y-2",children:o.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs",children:[r.usage&&o.jsxs(o.Fragment,{children:[o.jsx("div",{children:o.jsx("span",{className:"font-medium text-muted-foreground",children:"Usage:"})}),o.jsxs("div",{className:"ml-4 space-y-1",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Input tokens:"}),o.jsx("span",{className:"ml-2 font-mono",children:r.usage.input_tokens})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Output tokens:"}),o.jsx("span",{className:"ml-2 font-mono",children:r.usage.output_tokens})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Total tokens:"}),o.jsx("span",{className:"ml-2 font-mono bg-green-100 dark:bg-green-900 px-2 py-1 rounded",children:r.usage.total_tokens})]})]})]}),r.id&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Response ID:"}),o.jsx("span",{className:"ml-2 font-mono text-xs break-all",children:r.id})]}),r.model&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Model:"}),o.jsx("span",{className:"ml-2 font-mono text-xs break-all",children:r.model})]})]})})}break;default:return o.jsx("div",{className:"text-xs text-muted-foreground",children:o.jsx("pre",{className:"bg-background border rounded p-2 overflow-auto max-h-32",children:JSON.stringify(e,null,2)})})}return null}function ER({events:e,isStreaming:n}){const r=w.useRef(null),a=gg(e),c=[...i2(a)].reverse();return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Qp,{className:"h-4 w-4"}),o.jsx("span",{className:"font-medium",children:"Events"}),o.jsxs(ut,{variant:"outline",children:[a.length,e.length>a.length?` (${e.length} raw)`:""]})]}),n&&o.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[o.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-green-500 dark:bg-green-400"}),"Streaming"]})]}),o.jsx(Wn,{ref:r,className:"flex-1",children:o.jsx("div",{className:"p-3",children:a.length===0?o.jsx("div",{className:"text-center text-muted-foreground text-sm py-8",children:e.length===0?"No events yet. Start a conversation to see real-time events.":"Processing events... Accumulated events will appear here."}):o.jsx("div",{className:"space-y-2",children:c.map((d,f)=>"type"in d&&d.type==="separator"?o.jsx(a2,{},d.id):o.jsx(SR,{event:d},`${d.type}-${f}`))})})})]})}function CR(e){const n=new Map;for(const a of e){if(!("data"in a))continue;const c=a.data.response_id||"unknown";n.has(c)||n.set(c,[]),n.get(c).push(a)}const r=[];for(const[a,l]of n){const c=new Map,d=[];for(const y of l){if(!("data"in y))continue;const b=y.data,j=b.span_id||`span_${Math.random()}`;c.set(j,{event:y,data:b,children:[]})}for(const y of l){if(!("data"in y))continue;const b=y.data,j=b.span_id||"",N=b.parent_span_id,S=c.get(j);S&&(N&&c.has(N)?c.get(N).children.push(S):d.push(S))}d.sort((y,b)=>(y.data.start_time||0)-(b.data.start_time||0));const f=y=>{y.children.sort((b,j)=>(b.data.start_time||0)-(j.data.start_time||0)),y.children.forEach(f)};d.forEach(f);const m=l[0],h=m&&"data"in m?m.data:null,g=Math.min(...l.map(y=>("data"in y?y.data:null)?.start_time||Date.now()/1e3)),x=l.reduce((y,b)=>{const j="data"in b?b.data:null;return y+(j?.duration_ms||0)},0);r.push({response_id:a,timestamp:g,traces:d,totalDuration:x,entity_id:h?.entity_id})}return r.sort((a,l)=>l.timestamp-a.timestamp),r}function Su(e){if(typeof e=="string"){const n=e.trim();if(n.startsWith("[")||n.startsWith("{"))try{const r=JSON.parse(e);return Su(r)}catch{return e}return e}if(Array.isArray(e))return e.map(Su);if(e!==null&&typeof e=="object"){const n={};for(const[r,a]of Object.entries(e))n[r]=Su(a);return n}return e}function l2(e){try{const n=Su(e);return JSON.stringify(n,null,2)}catch{return JSON.stringify(e,null,2)}}function kR(e){return e.includes("invoke_agent")||e.includes("Agent")?"bg-purple-100 dark:bg-purple-900 text-purple-800 dark:text-purple-200":e.includes("chat")||e.includes("Chat")?"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200":e.includes("tool")||e.includes("execute")?"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200":"bg-orange-100 dark:bg-orange-900 text-orange-800 dark:text-orange-200"}function c2({node:e,depth:n=0}){const[r,a]=w.useState(n<2),[l,c]=w.useState(!1),{data:d}=e,f=d.operation_name||"Unknown",m=d.duration_ms?`${Number(d.duration_ms).toFixed(1)}ms`:"",h=e.children.length>0,g=d.attributes?.["gen_ai.usage.input_tokens"],x=d.attributes?.["gen_ai.usage.output_tokens"],y=g!==void 0||x!==void 0;return o.jsxs("div",{className:"relative",children:[n>0&&o.jsx("div",{className:"absolute left-0 top-0 bottom-0 border-l-2 border-muted",style:{marginLeft:`${(n-1)*16+8}px`}}),o.jsxs("div",{className:"flex items-center gap-2 py-1.5 hover:bg-muted/50 rounded transition-colors",style:{paddingLeft:`${n*16}px`},children:[o.jsx("button",{onClick:()=>h?a(!r):c(!l),className:"w-4 h-4 flex items-center justify-center text-muted-foreground hover:text-foreground",children:h?r?o.jsx(Rt,{className:"h-3 w-3"}):o.jsx(en,{className:"h-3 w-3"}):l?o.jsx(Rt,{className:"h-3 w-3"}):o.jsx(en,{className:"h-3 w-3"})}),o.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded font-medium ${kR(f)}`,children:f.replace("Agent.","").replace("invoke_agent ","")}),m&&o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:m}),y&&o.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:[g!==void 0&&o.jsxs("span",{children:["↑",String(g)]}),g!==void 0&&x!==void 0&&o.jsx("span",{className:"mx-0.5",children:"/"}),x!==void 0&&o.jsxs("span",{children:["↓",String(x)]})]})]}),l&&!h&&o.jsx("div",{className:"ml-4 mt-1 mb-2 p-2 bg-muted/30 rounded border text-xs",style:{marginLeft:`${n*16+20}px`},children:o.jsxs("div",{className:"space-y-1",children:[d.span_id&&o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{className:"text-muted-foreground w-20",children:"Span ID:"}),o.jsx("span",{className:"font-mono text-xs break-all",children:d.span_id})]}),d.trace_id&&o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{className:"text-muted-foreground w-20",children:"Trace ID:"}),o.jsx("span",{className:"font-mono text-xs break-all",children:d.trace_id})]}),d.status&&o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{className:"text-muted-foreground w-20",children:"Status:"}),o.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs ${d.status==="StatusCode.UNSET"||d.status==="OK"?"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200":"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200"}`,children:d.status})]}),d.attributes&&Object.keys(d.attributes).length>0&&o.jsxs("div",{className:"mt-2",children:[o.jsx("span",{className:"text-muted-foreground block mb-1",children:"Attributes:"}),o.jsx("pre",{className:"text-xs bg-background border rounded p-2 overflow-auto max-h-32 whitespace-pre-wrap break-all",children:l2(d.attributes)})]})]})}),h&&r&&o.jsx("div",{children:e.children.map((b,j)=>o.jsx(c2,{node:b,depth:n+1},b.data.span_id||j))})]})}function TR({group:e}){const[n,r]=w.useState(!0),a=new Date(e.timestamp*1e3).toLocaleTimeString(),l=e.totalDuration>0?`${e.totalDuration.toFixed(0)}ms`:"",c=e.traces.reduce((d,f)=>{const m=h=>1+h.children.reduce((g,x)=>g+m(x),0);return d+m(f)},0);return o.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>r(!n),children:[o.jsx("div",{className:"text-muted-foreground",children:n?o.jsx(Rt,{className:"h-4 w-4"}):o.jsx(en,{className:"h-4 w-4"})}),o.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:a}),e.entity_id&&o.jsx(ut,{variant:"outline",className:"text-xs py-0",children:e.entity_id.replace("agent_","").replace("workflow_","")}),o.jsx("div",{className:"flex-1"}),l&&o.jsx(ut,{variant:"secondary",className:"text-xs py-0",children:l}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[c," span",c!==1?"s":""]})]}),n&&o.jsx("div",{className:"p-2 border-t",children:e.traces.map((d,f)=>o.jsx(c2,{node:d,depth:0},d.data.span_id||f))})]})}function AR({events:e}){const n=le(c=>c.debugTraceSubTab),r=le(c=>c.setDebugTraceSubTab),a=e.filter(c=>c.type==="response.trace.completed"),l=CR(a);return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex items-center gap-2 p-3 border-b",children:[o.jsx(Bu,{className:"h-4 w-4"}),o.jsx("span",{className:"font-medium",children:"Traces"}),o.jsx(ut,{variant:"outline",children:a.length}),o.jsx("div",{className:"flex-1"}),o.jsxs("div",{className:"flex items-center bg-muted rounded-md p-1 min-w-0",children:[o.jsx("button",{onClick:()=>r("spans"),className:`px-3 py-1.5 text-xs rounded transition-colors truncate ${n==="spans"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"OTel Spans"}),o.jsxs("button",{onClick:()=>r("context"),className:`px-3 py-1.5 text-xs rounded transition-colors flex items-center gap-1.5 min-w-0 ${n==="context"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:[o.jsx(ha,{className:"h-3.5 w-3.5 flex-shrink-0"}),o.jsx("span",{className:"truncate",children:"Context Inspector"})]})]})]}),n==="spans"?o.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[a.length>0&&o.jsx("div",{className:"p-3 border-b flex-shrink-0",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Bu,{className:"h-4 w-4"}),o.jsx("span",{className:"font-medium text-sm",children:"OTel Spans"}),o.jsxs(ut,{variant:"outline",className:"text-xs",children:[l.length," turn",l.length!==1?"s":""]})]})}),a.length===0?o.jsxs("div",{className:"flex flex-col items-center text-center p-6 pt-9",children:[o.jsx(ha,{className:"h-8 w-8 text-muted-foreground mb-3"}),o.jsx("div",{className:"text-sm font-medium mb-1",children:"No Data"}),o.jsxs("div",{className:"text-xs text-muted-foreground max-w-[200px]",children:["Run"," ",o.jsx("span",{className:"font-mono bg-accent/10 px-1 rounded",children:"devui --instrumentation"})," ","and start a conversation."]})]}):o.jsx(Wn,{className:"flex-1",children:o.jsx("div",{className:"p-3",children:o.jsx("div",{className:"space-y-3",children:l.map(c=>o.jsx(TR,{group:c},c.response_id))})})})]}):o.jsx(bR,{events:e})]})}function MR({events:e}){const n=gg(e),r=[],a=n.filter(m=>m.type==="response.function_call.complete"),l=e.filter(m=>zr(m)!==null),c=new Map;l.forEach(m=>{const h=zr(m);h&&c.set(h.call_id,m)}),a.forEach(m=>{if(r.push(m),"data"in m&&m.data&&m.data.call_id){const h=String(m.data.call_id),g=c.get(h);g&&(r.push(g),c.delete(h))}}),c.forEach(m=>{r.push(m)});const f=[...i2(r)].reverse();return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex items-center gap-2 p-3 border-b",children:[o.jsx(_a,{className:"h-4 w-4"}),o.jsx("span",{className:"font-medium",children:"Tools"}),o.jsx(ut,{variant:"outline",children:r.length})]}),o.jsx(Wn,{className:"flex-1",children:o.jsx("div",{className:"p-3",children:r.length===0?o.jsx("div",{className:"text-center text-muted-foreground text-sm py-8",children:"No tool executions yet. Tool calls will appear here during conversations."}):o.jsx("div",{className:"space-y-3",children:f.map((m,h)=>"type"in m&&m.type==="separator"?o.jsx(a2,{},m.id):o.jsx(RR,{event:m},h))})})})]})}function RR({event:e}){const n="_uiTimestamp"in e&&typeof e._uiTimestamp=="number"?new Date(e._uiTimestamp*1e3).toLocaleTimeString():new Date().toLocaleTimeString(),r=e.type==="response.function_call.complete",a=zr(e),l=a!==null;if(!r&&!l)return null;const c=r&&"data"in e?e.data:null;return o.jsxs("div",{className:"border rounded p-3",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(og,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-400"}),o.jsx("span",{className:"font-medium text-sm",children:r?"Tool Call":"Tool Result"}),r&&c&&c.name!==void 0&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",String(c.name),")"]})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:n})]}),r&&c&&o.jsxs("div",{className:"p-2 bg-blue-50 dark:bg-blue-950/50 border border-blue-200 dark:border-blue-800 rounded",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(_a,{className:"h-3 w-3 text-blue-600 dark:text-blue-400"}),o.jsx("span",{className:"text-xs font-mono bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 px-2 py-1 rounded",children:"CALL"}),o.jsx("span",{className:"font-medium text-sm",children:String(c.name||"unknown")})]}),c.arguments!==void 0&&o.jsxs("div",{className:"text-xs",children:[o.jsx("span",{className:"text-muted-foreground mb-1 block",children:"Arguments:"}),o.jsx("pre",{className:"p-2 bg-background border rounded text-xs overflow-auto max-h-32 max-w-full break-all whitespace-pre-wrap",children:typeof c.arguments=="string"?c.arguments:JSON.stringify(c.arguments,null,1)})]})]}),l&&a&&o.jsxs("div",{className:"p-2 bg-green-50 dark:bg-green-950/50 border border-green-200 dark:border-green-800 rounded",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(nn,{className:"h-3 w-3 text-green-600 dark:text-green-400"}),o.jsx("span",{className:"text-xs font-mono bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200 px-2 py-1 rounded",children:"RESULT"}),a.status!=="completed"&&o.jsx("span",{className:"ml-auto px-2 py-1 rounded text-xs font-medium bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200",children:a.status})]}),o.jsxs("div",{className:"text-xs space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-muted-foreground",children:"Call ID:"}),o.jsx("span",{className:"font-mono text-xs break-all",children:a.call_id})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground block mb-1",children:"Output:"}),o.jsx("pre",{className:"p-2 bg-background border rounded text-xs overflow-auto max-h-32 break-all whitespace-pre-wrap",children:a.output})]})]})]})]})}function DR({events:e,isStreaming:n=!1,onMinimize:r}){const a=le(d=>d.debugPanelTab),l=le(d=>d.setDebugPanelTab),c=w.useMemo(()=>{const d=gg(e),f=d.length,m=e.filter(g=>g.type==="response.trace.completed").length,h=d.filter(g=>g.type==="response.function_call.complete").length+e.filter(g=>zr(g)!==null).length;return{eventsCount:f,tracesCount:m,toolsCount:h}},[e]);return o.jsx("div",{className:"flex-1 border-l flex flex-col min-h-0",children:o.jsxs(D5,{value:a,onValueChange:d=>l(d),className:"flex-1 flex flex-col min-h-0",children:[o.jsxs("div",{className:"px-3 pt-3 flex items-center gap-2 flex-shrink-0",children:[o.jsxs($N,{className:"flex-1",children:[o.jsxs(Nu,{value:"events",className:"flex-1 gap-1.5",children:["Events",c.eventsCount>0&&o.jsx("span",{className:"text-[10px] bg-muted-foreground/20 text-muted-foreground px-1.5 py-0.5 rounded-full min-w-[1.25rem] text-center",children:c.eventsCount})]}),o.jsxs(Nu,{value:"traces",className:"flex-1 gap-1.5",children:["Traces",c.tracesCount>0&&o.jsx("span",{className:"text-[10px] bg-muted-foreground/20 text-muted-foreground px-1.5 py-0.5 rounded-full min-w-[1.25rem] text-center",children:c.tracesCount})]}),o.jsxs(Nu,{value:"tools",className:"flex-1 gap-1.5",children:["Tools",c.toolsCount>0&&o.jsx("span",{className:"text-[10px] bg-muted-foreground/20 text-muted-foreground px-1.5 py-0.5 rounded-full min-w-[1.25rem] text-center",children:c.toolsCount})]})]}),r&&o.jsx(Le,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0 flex-shrink-0",title:"Minimize debug panel",children:o.jsx(en,{className:"h-4 w-4"})})]}),o.jsx(ju,{value:"events",className:"flex-1 mt-0 overflow-hidden",children:o.jsx(ER,{events:e,isStreaming:n})}),o.jsx(ju,{value:"traces",className:"flex-1 mt-0 overflow-hidden",children:o.jsx(AR,{events:e})}),o.jsx(ju,{value:"tools",className:"flex-1 mt-0 overflow-hidden",children:o.jsx(MR,{events:e})})]})})}function Ir({open:e,onOpenChange:n,children:r}){if(!e)return null;const a=()=>{n(!1)},l=d=>{d.stopPropagation()},c=d=>{d.stopPropagation()};return o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[o.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:a}),o.jsx("div",{className:"relative z-10",onClick:l,onMouseDown:c,onMouseUp:d=>d.stopPropagation(),children:r})]})}function Lr({children:e,className:n=""}){const a=n.includes("w-[")||n.includes("w-full")||n.includes("max-w-")?"":"max-w-lg w-full";return o.jsx("div",{className:`relative bg-background border rounded-lg shadow-lg max-h-[90vh] overflow-hidden ${a} ${n}`,children:e})}function $r({children:e,className:n=""}){return o.jsx("div",{className:`space-y-2 ${n}`,children:e})}function Pr({children:e,className:n=""}){return o.jsx("h2",{className:`text-lg font-semibold ${n}`,children:e})}function OR({children:e,className:n=""}){return o.jsx("p",{className:`text-sm text-muted-foreground ${n}`,children:e})}function So({onClose:e}){return o.jsx(Le,{variant:"ghost",size:"sm",onClick:e,className:"absolute top-4 right-4 h-8 w-8 p-0 rounded-sm opacity-70 hover:opacity-100",children:o.jsx(Ea,{className:"h-4 w-4"})})}function zR({children:e}){return o.jsx("div",{className:"flex justify-end gap-2 p-4 border-t bg-muted/50",children:e})}function as({className:e,type:n,...r}){return o.jsx("input",{type:n,"data-slot":"input",className:We("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}var IR="Label",u2=w.forwardRef((e,n)=>o.jsx(Ye.label,{...e,ref:n,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));u2.displayName=IR;var LR=u2;function kt({className:e,...n}){return o.jsx(LR,{"data-slot":"label",className:We("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...n})}var Td="Switch",[$R,e$]=Kn(Td),[PR,HR]=$R(Td),d2=w.forwardRef((e,n)=>{const{__scopeSwitch:r,name:a,checked:l,defaultChecked:c,required:d,disabled:f,value:m="on",onCheckedChange:h,form:g,...x}=e,[y,b]=w.useState(null),j=rt(n,E=>b(E)),N=w.useRef(!1),S=y?g||!!y.closest("form"):!0,[_,A]=Ar({prop:l,defaultProp:c??!1,onChange:h,caller:Td});return o.jsxs(PR,{scope:r,checked:_,disabled:f,children:[o.jsx(Ye.button,{type:"button",role:"switch","aria-checked":_,"aria-required":d,"data-state":p2(_),"data-disabled":f?"":void 0,disabled:f,value:m,...x,ref:j,onClick:ke(e.onClick,E=>{A(M=>!M),S&&(N.current=E.isPropagationStopped(),N.current||E.stopPropagation())})}),S&&o.jsx(h2,{control:y,bubbles:!N.current,name:a,value:m,checked:_,required:d,disabled:f,form:g,style:{transform:"translateX(-100%)"}})]})});d2.displayName=Td;var f2="SwitchThumb",m2=w.forwardRef((e,n)=>{const{__scopeSwitch:r,...a}=e,l=HR(f2,r);return o.jsx(Ye.span,{"data-state":p2(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:n})});m2.displayName=f2;var UR="SwitchBubbleInput",h2=w.forwardRef(({__scopeSwitch:e,control:n,checked:r,bubbles:a=!0,...l},c)=>{const d=w.useRef(null),f=rt(d,c),m=fg(r),h=Lp(n);return w.useEffect(()=>{const g=d.current;if(!g)return;const x=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(x,"checked").set;if(m!==r&&b){const j=new Event("click",{bubbles:a});b.call(g,r),g.dispatchEvent(j)}},[m,r,a]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...l,tabIndex:-1,ref:f,style:{...l.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});h2.displayName=UR;function p2(e){return e?"checked":"unchecked"}var g2=d2,BR=m2;const Wi=w.forwardRef(({className:e,...n},r)=>o.jsx(g2,{className:We("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...n,ref:r,children:o.jsx(BR,{className:We("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Wi.displayName=g2.displayName;const VR=["gpt-4.1","gpt-4.1-mini","o1","o1-mini","o3-mini"];function cb({open:e,onOpenChange:n,onBackendUrlChange:r}){const[a,l]=w.useState("general"),{oaiMode:c,setOAIMode:d,azureDeploymentEnabled:f,setAzureDeploymentEnabled:m,authRequired:h,serverCapabilities:g,serverVersion:x,runtime:y,uiMode:b,streamingEnabled:j,setStreamingEnabled:N}=le(),S="",[_,A]=w.useState(()=>localStorage.getItem("devui_backend_url")||S),[E,M]=w.useState(_),[T,D]=w.useState(!!localStorage.getItem("devui_auth_token")),[z,H]=w.useState(""),q=()=>{try{new URL(E),localStorage.setItem("devui_backend_url",E),A(E),r?.(E),n(!1),window.location.reload()}catch{alert("Please enter a valid URL (e.g., http://localhost:8080)")}},X=()=>{localStorage.removeItem("devui_backend_url"),M(S),A(S),r?.(S),window.location.reload()},W=()=>{z.trim()&&(localStorage.setItem("devui_auth_token",z.trim()),D(!0),H(""),window.location.reload())},G=()=>{localStorage.removeItem("devui_auth_token"),D(!1),H(""),window.location.reload()},ne=E!==_,B=!localStorage.getItem("devui_backend_url");return o.jsx(Ir,{open:e,onOpenChange:n,children:o.jsxs(Lr,{className:"w-[600px] max-w-[90vw] flex flex-col max-h-[85vh]",children:[o.jsx($r,{className:"p-6 pb-2 flex-shrink-0",children:o.jsx(Pr,{children:"Settings"})}),o.jsx(So,{onClose:()=>n(!1)}),o.jsxs("div",{className:"flex border-b px-6 flex-shrink-0",children:[o.jsxs("button",{onClick:()=>l("general"),className:`px-4 py-2 text-sm font-medium transition-colors relative ${a==="general"?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:["General",a==="general"&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),g.openai_proxy&&o.jsxs("button",{onClick:()=>l("proxy"),className:`px-4 py-2 text-sm font-medium transition-colors relative ${a==="proxy"?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:["OpenAI Proxy",a==="proxy"&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),o.jsxs("button",{onClick:()=>l("about"),className:`px-4 py-2 text-sm font-medium transition-colors relative ${a==="about"?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:["About",a==="about"&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]}),o.jsxs("div",{className:"px-6 pb-6 overflow-y-auto flex-1 min-h-[400px]",children:[a==="general"&&o.jsxs("div",{className:"space-y-6 pt-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(kt,{htmlFor:"backend-url",className:"text-sm font-medium",children:"Backend URL"}),!B&&o.jsxs(Le,{variant:"ghost",size:"sm",onClick:X,className:"h-7 text-xs",title:"Reset to default",children:[o.jsx(sg,{className:"h-3 w-3 mr-1"}),"Reset"]})]}),o.jsx(as,{id:"backend-url",type:"url",value:E,onChange:U=>M(U.target.value),placeholder:"http://localhost:8080",className:"font-mono text-sm"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Default: ",o.jsx("span",{className:"font-mono",children:S})]}),o.jsx("div",{className:"flex gap-2 pt-2 min-h-[36px]",children:ne&&o.jsxs(o.Fragment,{children:[o.jsx(Le,{onClick:q,size:"sm",className:"flex-1",children:"Apply & Reload"}),o.jsx(Le,{onClick:()=>M(_),variant:"outline",size:"sm",className:"flex-1",children:"Cancel"})]})})]}),(h||T)&&o.jsxs("div",{className:"space-y-3 border-t pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(kt,{className:"text-sm font-medium",children:"Authentication Token"}),!h&&T&&o.jsx("span",{className:"text-xs text-muted-foreground",children:"(Not required by current backend)"})]}),T?o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(as,{type:"password",value:"••••••••••••••••••••",disabled:!0,className:"font-mono text-sm flex-1"}),o.jsx(Le,{variant:"destructive",size:"sm",onClick:G,className:"flex-shrink-0",children:"Clear"})]}),o.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"✓ Token configured and stored locally"})]}):o.jsxs("div",{className:"space-y-3",children:[o.jsx(as,{type:"password",value:z,onChange:U=>H(U.target.value),placeholder:"Enter bearer token",className:"font-mono text-sm",onKeyDown:U=>{U.key==="Enter"&&z.trim()&&W()}}),o.jsx(Le,{onClick:W,size:"sm",disabled:!z.trim(),className:"w-full",children:"Save & Reload"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:h?"Required by backend (started with --auth flag)":"Not required by current backend"})]})]}),g.deployment&&o.jsxs("div",{className:"space-y-3 border-t pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(kt,{className:"text-sm font-medium",children:"Azure Deployment"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Enable one-click deployment to Azure Container Apps"})]}),o.jsx(Wi,{checked:f,onCheckedChange:m})]}),o.jsxs("details",{className:"group",children:[o.jsxs("summary",{className:"cursor-pointer text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[o.jsx(en,{className:"h-3 w-3 transition-transform group-open:rotate-90"}),"Learn more about Azure deployment"]}),o.jsxs("div",{className:"mt-3 space-y-3 pl-4",children:[o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:'When enabled, agents that support deployment will show a "Deploy to Azure" button. This allows you to deploy your agent to Azure Container Apps directly from DevUI.'}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"text-xs font-medium",children:"When enabled:"}),o.jsxs("ul",{className:"text-xs text-muted-foreground space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:'Shows "Deploy to Azure" for supported agents'}),o.jsx("li",{children:"Requires Azure CLI and proper authentication"}),o.jsx("li",{children:"Backend must have deployment capabilities enabled"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"text-xs font-medium",children:"When disabled:"}),o.jsxs("ul",{className:"text-xs text-muted-foreground space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:'Shows "Deployment Guide" for all agents'}),o.jsx("li",{children:"Provides Docker templates and manual deployment instructions"}),o.jsx("li",{children:"No backend deployment capabilities required"})]})]})]})]})]}),o.jsx("div",{className:"space-y-3 border-t pt-6",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(kt,{className:"text-sm font-medium",children:"Show Tool Calls"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Display function/tool calls and results in chat messages"})]}),o.jsx(Wi,{checked:le.getState().showToolCalls,onCheckedChange:U=>le.getState().setShowToolCalls(U)})]})}),o.jsxs("div",{className:"space-y-3 border-t pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(kt,{className:"text-sm font-medium",children:"Streaming Mode"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Stream responses token-by-token as they're generated"})]}),o.jsx(Wi,{checked:j,onCheckedChange:N})]}),!j&&o.jsxs("div",{className:"flex items-start gap-2 text-xs text-amber-600 dark:text-amber-400 bg-amber-500/10 p-3 rounded",children:[o.jsx(Fs,{className:"h-3.5 w-3.5 flex-shrink-0 mt-0.5"}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Non-streaming mode limitations:"}),o.jsxs("ul",{className:"mt-1 space-y-0.5 list-disc list-inside text-amber-600/80 dark:text-amber-400/80",children:[o.jsx("li",{children:"Tool calls won't display in real-time"}),o.jsx("li",{children:"No typing indicator during generation"}),o.jsx("li",{children:"Response appears all at once when complete"})]})]})]})]})]}),a==="proxy"&&g.openai_proxy&&o.jsxs("div",{className:"space-y-6 pt-4",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(kt,{className:"text-base font-medium",children:"OpenAI Proxy Mode"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Route requests through DevUI backend to OpenAI API"})]}),o.jsx(Wi,{checked:c.enabled,onCheckedChange:U=>d({...c,enabled:U})})]}),!c.enabled&&o.jsx("div",{className:"bordder border-muted bg-muted/30 rounded-lg p-4 space-y-3",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(Fs,{className:"h-4 w-4 flex-shrink-0 mt-0.5 text-blue-600 dark:text-blue-400"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"About OpenAI Proxy Mode"}),o.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["When enabled, your chat requests are sent to your DevUI backend"," ",o.jsxs("span",{className:"font-mono font-semibold",children:["(",_,")"]}),", which then forwards them to OpenAI's API. This keeps your"," ",o.jsx("span",{className:"font-mono font-semibold",children:"OPENAI_API_KEY"})," ","secure on the server instead of exposing it in the browser."]}),o.jsxs("div",{className:"space-y-1.5 pt-1",children:[o.jsx("p",{className:"text-xs font-medium",children:"Requirements:"}),o.jsxs("ul",{className:"text-xs text-muted-foreground space-y-0.5 list-disc list-inside",children:[o.jsxs("li",{children:["Backend must have"," ",o.jsx("span",{className:"font-mono",children:"OPENAI_API_KEY"})," ","configured"]}),o.jsx("li",{children:"Backend must support OpenAI Responses API proxying (DevUI does)"})]})]}),o.jsxs("div",{className:"space-y-1.5 pt-1",children:[o.jsx("p",{className:"text-xs font-medium",children:"Why use this?"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Quickly test and compare OpenAI models directly through the DevUI interface without creating custom agents or exposing API keys in the browser."})]})]})]})}),c.enabled&&o.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-muted",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{className:"text-sm font-medium",children:"Model"}),o.jsx(as,{type:"text",value:c.model,onChange:U=>d({...c,model:U.target.value}),placeholder:"gpt-4.1-mini",className:"font-mono text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter any OpenAI model ID (e.g., gpt-4.1, o1, o3-mini)"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{className:"text-xs text-muted-foreground",children:"Common presets"}),o.jsx("div",{className:"flex flex-wrap gap-2",children:VR.map(U=>o.jsx(Le,{variant:c.model===U?"default":"outline",size:"sm",onClick:()=>d({...c,model:U}),className:"text-xs h-7",children:U},U))})]}),o.jsxs("details",{className:"group",children:[o.jsxs("summary",{className:"cursor-pointer text-sm font-medium text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[o.jsx(en,{className:"h-3 w-3 transition-transform group-open:rotate-90"}),"Advanced Parameters (optional)"]}),o.jsxs("div",{className:"space-y-3 mt-3 pl-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(kt,{className:"text-xs",children:"Temperature"}),o.jsx(as,{type:"number",step:"0.1",min:"0",max:"2",value:c.temperature??"",onChange:U=>d({...c,temperature:U.target.value?parseFloat(U.target.value):void 0}),placeholder:"1.0 (default)",className:"text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls randomness (0-2)"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(kt,{className:"text-xs",children:"Max Output Tokens"}),o.jsx(as,{type:"number",min:"1",value:c.max_output_tokens??"",onChange:U=>d({...c,max_output_tokens:U.target.value?parseInt(U.target.value):void 0}),placeholder:"Auto",className:"text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Maximum tokens in response"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(kt,{className:"text-xs",children:"Top P"}),o.jsx(as,{type:"number",step:"0.1",min:"0",max:"1",value:c.top_p??"",onChange:U=>d({...c,top_p:U.target.value?parseFloat(U.target.value):void 0}),placeholder:"1.0 (default)",className:"text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Nucleus sampling (0-1)"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(kt,{className:"text-xs",children:"Reasoning Effort (o-series models)"}),o.jsxs("select",{value:c.reasoning_effort??"",onChange:U=>d({...c,reasoning_effort:U.target.value?U.target.value:void 0}),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[o.jsx("option",{value:"",children:"Auto (default)"}),o.jsx("option",{value:"minimal",children:"Minimal"}),o.jsx("option",{value:"low",children:"Low"}),o.jsx("option",{value:"medium",children:"Medium"}),o.jsx("option",{value:"high",children:"High"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Constrains reasoning effort (faster/cheaper vs thorough)"})]})]})]})]})]}),c.enabled&&o.jsxs("div",{className:"flex items-start gap-2 text-xs text-muted-foreground bg-muted/50 p-3 rounded",children:[o.jsx(Fs,{className:"h-3.5 w-3.5 flex-shrink-0 mt-0.5"}),o.jsx("div",{className:"space-y-1",children:o.jsxs("p",{children:["Requests route through"," ",o.jsx("span",{className:"font-mono font-semibold",children:_})," ","to OpenAI API. Server must have"," ",o.jsx("span",{className:"font-mono font-semibold",children:"OPENAI_API_KEY"})," ","configured."]})})]})]}),a==="about"&&o.jsxs("div",{className:"space-y-4 pt-4",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"DevUI is a sample app for getting started with Agent Framework."}),o.jsxs("div",{className:"space-y-2 text-sm",children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-muted-foreground",children:"Version:"}),o.jsx("span",{className:"font-mono",children:x||"Unknown"})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-muted-foreground",children:"Runtime:"}),o.jsx("span",{className:"font-mono capitalize",children:y||"Unknown"})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-muted-foreground",children:"UI Mode:"}),o.jsx("span",{className:"font-mono capitalize",children:b||"Unknown"})]})]}),(g||h!==void 0)&&o.jsxs("div",{className:"space-y-2 pt-2",children:[o.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Capabilities"}),o.jsxs("div",{className:"space-y-1 text-sm",children:[g?.instrumentation!==void 0&&o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-muted-foreground",children:"Instrumentation:"}),o.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${g.instrumentation?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-muted text-muted-foreground"}`,children:g.instrumentation?"Enabled":"Disabled"})]}),g?.openai_proxy!==void 0&&o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-muted-foreground",children:"OpenAI Proxy:"}),o.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${g.openai_proxy?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-muted text-muted-foreground"}`,children:g.openai_proxy?"Available":"Not Configured"})]}),g?.deployment!==void 0&&o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-muted-foreground",children:"Deployment:"}),o.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${g.deployment?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-muted text-muted-foreground"}`,children:g.deployment?"Available":"Disabled"})]}),h!==void 0&&o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-muted-foreground",children:"Authentication:"}),o.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${h?"bg-blue-500/10 text-blue-600 dark:text-blue-400":"bg-muted text-muted-foreground"}`,children:h?"Required":"Not Required"})]})]})]}),o.jsx("div",{className:"flex justify-center pt-2",children:o.jsxs(Le,{variant:"outline",size:"sm",onClick:()=>window.open("https://github.com/microsoft/agent-framework","_blank"),className:"text-xs",children:[o.jsx(Hu,{className:"h-3 w-3 mr-1"}),"Learn More about Agent Framework"]})})]})]})]})})}const qR="modulepreload",FR=function(e,n){return new URL(e,n).href},ub={},_u=function(n,r,a){let l=Promise.resolve();if(r&&r.length>0){let h=function(g){return Promise.all(g.map(x=>Promise.resolve(x).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};const d=document.getElementsByTagName("link"),f=document.querySelector("meta[property=csp-nonce]"),m=f?.nonce||f?.getAttribute("nonce");l=h(r.map(g=>{if(g=FR(g,a),g in ub)return;ub[g]=!0;const x=g.endsWith(".css"),y=x?'[rel="stylesheet"]':"";if(a)for(let j=d.length-1;j>=0;j--){const N=d[j];if(N.href===g&&(!x||N.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${g}"]${y}`))return;const b=document.createElement("link");if(b.rel=x?"stylesheet":qR,x||(b.as="script"),b.crossOrigin="",b.href=g,m&&b.setAttribute("nonce",m),document.head.appendChild(b),x)return new Promise((j,N)=>{b.addEventListener("load",j),b.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${g}`)))})}))}function c(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return l.then(d=>{for(const f of d||[])f.status==="rejected"&&c(f.reason);return n().catch(c)})},x2="devui_streaming_state_",y2=1440*60*1e3;function Yu(e){return`${x2}${e}`}function YR(e){let n="";for(const r of e)r.type==="response.output_text.delta"&&"delta"in r&&(n+=r.delta);return n}function v2(e){try{const n=Yu(e.conversationId),r=JSON.stringify(e);localStorage.setItem(n,r)}catch(n){console.error("Failed to save streaming state:",n);try{b2();const r=Yu(e.conversationId),a=JSON.stringify(e);localStorage.setItem(r,a)}catch{console.error("Failed to save streaming state even after cleanup")}}}function ba(e){try{const n=Yu(e),r=localStorage.getItem(n);if(!r)return null;const a=JSON.parse(r);return Date.now()-a.timestamp>y2?(Eu(e),null):a.completed?null:a}catch(n){return console.error("Failed to load streaming state:",n),null}}function Nh(e,n,r,a){try{const l=ba(e),c="sequence_number"in n?n.sequence_number:void 0,d=l?[...l.events,n]:[n],f={conversationId:e,responseId:r,lastMessageId:a,lastSequenceNumber:c??l?.lastSequenceNumber??-1,events:d,timestamp:Date.now(),completed:n.type==="response.completed"||n.type==="response.failed",accumulatedText:YR(d)};v2(f)}catch(l){console.error("Failed to update streaming state:",l)}}function jh(e){try{const n=ba(e);n&&(n.completed=!0,n.timestamp=Date.now(),v2(n))}catch(n){console.error("Failed to mark streaming as completed:",n)}}function Eu(e){try{const n=Yu(e);localStorage.removeItem(n)}catch(n){console.error("Failed to clear streaming state:",n)}}function b2(){try{const e=Object.keys(localStorage),n=Date.now();for(const r of e)if(r.startsWith(x2))try{const a=localStorage.getItem(r);if(a){const l=JSON.parse(a);(n-l.timestamp>y2||l.completed)&&localStorage.removeItem(r)}}catch{localStorage.removeItem(r)}}catch(e){console.error("Failed to clear expired streaming states:",e)}}function GR(){b2()}function w2(){const[e,n]=w.useState(!1),r=w.useRef(null),a=w.useCallback(()=>(r.current=new AbortController,n(!1),r.current.signal),[]),l=w.useCallback(()=>{r.current&&(n(!0),r.current.abort(),r.current=null)},[]),c=w.useCallback(()=>{n(!1)},[]),d=w.useCallback(()=>{r.current&&(r.current.abort(),r.current=null)},[]);return{isCancelling:e,createAbortSignal:a,handleCancel:l,resetCancelling:c,cleanup:d}}function Gu(e){return e instanceof DOMException&&e.name==="AbortError"}function XR(e={}){const{onDrop:n,disabled:r=!1}=e,[a,l]=w.useState(!1),[c,d]=w.useState([]),f=w.useRef(0),m=w.useCallback(b=>{b.preventDefault(),b.stopPropagation(),!r&&(f.current++,b.dataTransfer.items&&b.dataTransfer.items.length>0&&l(!0))},[r]),h=w.useCallback(b=>{b.preventDefault(),b.stopPropagation(),!r&&(f.current--,f.current===0&&l(!1))},[r]),g=w.useCallback(b=>{b.preventDefault(),b.stopPropagation()},[]),x=w.useCallback(b=>{if(b.preventDefault(),b.stopPropagation(),l(!1),f.current=0,r)return;const j=Array.from(b.dataTransfer.files);j.length>0&&(d(j),n?.(j))},[r,n]),y=w.useCallback(()=>{d([])},[]);return{isDragOver:a,droppedFiles:c,clearDroppedFiles:y,dragHandlers:{onDragEnter:m,onDragLeave:h,onDragOver:g,onDrop:x}}}const ZR="",WR=1e3,Sh=10;function KR(){const e=localStorage.getItem("devui_backend_url");return e||ZR}function QR(e){return new Promise(n=>setTimeout(n,e))}class JR{baseUrl;authToken=null;constructor(n){this.baseUrl=n||KR(),this.authToken=localStorage.getItem("devui_auth_token")}setBaseUrl(n){this.baseUrl=n}getBaseUrl(){return this.baseUrl}setAuthToken(n){this.authToken=n,n?localStorage.setItem("devui_auth_token",n):localStorage.removeItem("devui_auth_token")}getAuthToken(){return this.authToken}clearAuthToken(){this.setAuthToken(null)}async request(n,r={}){const a=`${this.baseUrl}${n}`,l={"Content-Type":"application/json",...r.headers};this.authToken&&(l.Authorization=`Bearer ${this.authToken}`);const c=await fetch(a,{...r,headers:l});if(!c.ok){if(c.status===401)throw this.clearAuthToken(),new Error("UNAUTHORIZED");let d=`API request failed: ${c.status} ${c.statusText}`;try{const f=await c.json();f.detail?typeof f.detail=="string"?d=f.detail:typeof f.detail=="object"&&f.detail.error?.message&&(d=f.detail.error.message):f.error?.message&&(d=f.error.message)}catch{}throw new Error(d)}return c.json()}async getHealth(){return this.request("/health")}async getMeta(){return this.request("/meta")}async getEntities(){const r=(await this.request("/v1/entities")).entities.map(c=>{if(c.type==="agent")return{id:c.id,name:c.name,description:c.description,type:"agent",source:c.source||"directory",tools:(c.tools||[]).map(d=>typeof d=="string"?d:JSON.stringify(d)),has_env:!!(c.required_env_vars&&c.required_env_vars.length>0),module_path:typeof c.metadata?.module_path=="string"?c.metadata.module_path:void 0,required_env_vars:c.required_env_vars,metadata:c.metadata,deployment_supported:c.deployment_supported,deployment_reason:c.deployment_reason,instructions:c.instructions,model_id:c.model_id,chat_client_type:c.chat_client_type,context_providers:c.context_providers,middleware:c.middleware};{const d=c.executors||c.tools||[];let f=c.start_executor_id||"";if(!f&&d.length>0){const m=d[0];typeof m=="string"&&(f=m)}return{id:c.id,name:c.name,description:c.description,type:"workflow",source:c.source||"directory",executors:d.map(m=>typeof m=="string"?m:JSON.stringify(m)),has_env:!!(c.required_env_vars&&c.required_env_vars.length>0),module_path:typeof c.metadata?.module_path=="string"?c.metadata.module_path:void 0,required_env_vars:c.required_env_vars,metadata:c.metadata,deployment_supported:c.deployment_supported,deployment_reason:c.deployment_reason,input_schema:c.input_schema||{type:"string"},input_type_name:c.input_type_name||"Input",start_executor_id:f,tools:[]}}}),a=r.filter(c=>c.type==="agent"),l=r.filter(c=>c.type==="workflow");return{entities:r,agents:a,workflows:l}}async getAgents(){const{agents:n}=await this.getEntities();return n}async getWorkflows(){const{workflows:n}=await this.getEntities();return n}async getAgentInfo(n){return this.request(`/v1/entities/${n}/info?type=agent`)}async getWorkflowInfo(n){return this.request(`/v1/entities/${n}/info?type=workflow`)}async reloadEntity(n){return this.request(`/v1/entities/${n}/reload`,{method:"POST"})}async createConversation(n){const{oaiMode:r}=await _u(()=>Promise.resolve().then(()=>wu),void 0,import.meta.url).then(c=>({oaiMode:c.useDevUIStore.getState().oaiMode})),a={};r.enabled&&(a["X-Proxy-Backend"]="openai");const l=await this.request("/v1/conversations",{method:"POST",headers:a,body:JSON.stringify({metadata:n})});return{id:l.id,object:"conversation",created_at:l.created_at,metadata:l.metadata}}async listConversations(n){const r=n?`/v1/conversations?agent_id=${encodeURIComponent(n)}`:"/v1/conversations",a=await this.request(r);return{data:a.data.map(l=>({id:l.id,object:"conversation",created_at:l.created_at,metadata:l.metadata})),has_more:a.has_more}}async getConversation(n){const r=await this.request(`/v1/conversations/${n}`);return{id:r.id,object:"conversation",created_at:r.created_at,metadata:r.metadata}}async deleteConversation(n){try{return await this.request(`/v1/conversations/${n}`,{method:"DELETE"}),Eu(n),!0}catch{return!1}}async listConversationItems(n,r){const a=new URLSearchParams;r?.limit&&a.set("limit",r.limit.toString()),r?.after&&a.set("after",r.after),r?.order&&a.set("order",r.order);const l=a.toString(),c=`/v1/conversations/${n}/items${l?`?${l}`:""}`;return this.request(c)}async getConversationItem(n,r){const a=`/v1/conversations/${n}/items/${r}`;return this.request(a)}async deleteConversationItem(n,r){const a=await fetch(`${this.baseUrl}/v1/conversations/${n}/items/${r}`,{method:"DELETE"});if(!a.ok)throw new Error(`Failed to delete item: ${a.statusText}`)}async*streamOpenAIResponse(n,r,a,l){const{oaiMode:c}=await _u(()=>Promise.resolve().then(()=>wu),void 0,import.meta.url).then(x=>({oaiMode:x.useDevUIStore.getState().oaiMode}));c.enabled&&(n.model=c.model,c.temperature!==void 0&&(n.temperature=c.temperature),c.max_output_tokens!==void 0&&(n.max_output_tokens=c.max_output_tokens),c.top_p!==void 0&&(n.top_p=c.top_p),c.instructions!==void 0&&(n.instructions=c.instructions),c.reasoning_effort!==void 0&&(n.reasoning={effort:c.reasoning_effort}));let d=-1,f=0,m=!1,h=l,g;if(r){const x=ba(r);if(x)if(l||(h=x.responseId),d=x.lastSequenceNumber,g=x.lastMessageId,l)m=x.events.length>0;else for(const y of x.events)m=!0,yield y}for(;f<=Sh;)try{let x;if(h){const N=new URLSearchParams;N.set("stream","true"),d>=0&&N.set("starting_after",d.toString());const S=`${this.baseUrl}/v1/responses/${h}?${N.toString()}`,_={Accept:"text/event-stream"};this.authToken&&(_.Authorization=`Bearer ${this.authToken}`),x=await fetch(S,{method:"GET",headers:_,signal:a})}else{const N=`${this.baseUrl}/v1/responses`,S={"Content-Type":"application/json",Accept:"text/event-stream"};c.enabled&&(S["X-Proxy-Backend"]="openai"),this.authToken&&(S.Authorization=`Bearer ${this.authToken}`),x=await fetch(N,{method:"POST",headers:S,body:JSON.stringify(n),signal:a})}if(!x.ok){if(x.status===401)throw this.clearAuthToken(),new Error("UNAUTHORIZED");if(x.status>=400&&x.status<500){let S=`Client error ${x.status}`;try{const _=await x.json();_.error&&_.error.message?S=_.error.message:_.detail&&(S=_.detail)}catch{}throw new Error(`CLIENT_ERROR: ${S}`)}let N=`Request failed with status ${x.status}`;try{const S=await x.json();S.error&&S.error.message?N=S.error.message:S.detail&&(N=S.detail)}catch{}throw new Error(N)}const y=x.body?.getReader();if(!y)throw new Error("Response body is not readable");const b=new TextDecoder;let j="";try{for(;;){if(a?.aborted)throw new DOMException("Request aborted","AbortError");const{done:N,value:S}=await y.read();if(N){r&&jh(r);return}const _=b.decode(S,{stream:!0});j+=_;const A=j.split(`
`);j=A.pop()||"";for(const E of A)if(E.startsWith("data: ")){const M=E.slice(6);if(M==="[DONE]"){r&&jh(r);return}try{const T=JSON.parse(M);if("response"in T&&T.response&&typeof T.response=="object"&&"id"in T.response){const z=T.response.id;(!h||h!==z)&&(h=z)}else if("id"in T&&typeof T.id=="string"&&T.id.startsWith("resp_")){const z=T.id;(!h||h!==z)&&(h=z)}"item_id"in T&&T.item_id&&(g=T.item_id);const D="sequence_number"in T?T.sequence_number:void 0;if(D!==void 0)if(m&&D<=1&&d>1)r&&Eu(r),yield{type:"error",message:"Connection lost - previous response failed. Starting new response."},d=D,m=!0,r&&h&&Nh(r,T,h,g),yield T;else{if(D<=d)continue;d=D,m=!0,r&&h&&Nh(r,T,h,g),yield T}else m=!0,r&&h&&Nh(r,T,h,g),yield T}catch(T){console.error("Failed to parse OpenAI SSE event:",T)}}}}finally{y.releaseLock()}}catch(x){const y=x instanceof Error?x.message:String(x);if(Gu(x))throw r&&jh(r),x;if(y==="UNAUTHORIZED"||y.startsWith("CLIENT_ERROR:"))throw x;if(f++,f>Sh)throw new Error(`Connection failed after ${Sh} retry attempts: ${y}`);const b=Math.min(WR*Math.pow(2,f-1),3e4);await QR(b)}}async*streamAgentExecutionOpenAI(n,r,a,l){const c={metadata:{entity_id:n},input:r.input,stream:!0,conversation:r.conversation_id};return yield*this.streamAgentExecutionOpenAIDirect(n,c,r.conversation_id,a,l)}async*streamAgentExecutionOpenAIDirect(n,r,a,l,c){yield*this.streamOpenAIResponse(r,a,l,c)}async*streamWorkflowExecutionOpenAI(n,r,a){const l={metadata:{entity_id:n},input:JSON.stringify(r.input_data||{}),stream:!0,conversation:r.conversation_id,extra_body:r.checkpoint_id?{entity_id:n,checkpoint_id:r.checkpoint_id}:void 0};yield*this.streamOpenAIResponse(l,r.conversation_id,a)}async runAgentSync(n,r){const{oaiMode:a}=await _u(()=>Promise.resolve().then(()=>wu),void 0,import.meta.url).then(d=>({oaiMode:d.useDevUIStore.getState().oaiMode})),l={metadata:{entity_id:n},input:r.input,stream:!1,conversation:r.conversation_id};a.enabled&&(l.model=a.model,a.temperature!==void 0&&(l.temperature=a.temperature),a.max_output_tokens!==void 0&&(l.max_output_tokens=a.max_output_tokens));const c={};return a.enabled&&(c["X-Proxy-Backend"]="openai"),this.request("/v1/responses",{method:"POST",headers:c,body:JSON.stringify(l)})}async runWorkflowSync(n,r){const a={metadata:{entity_id:n},input:JSON.stringify(r.input_data||{}),stream:!1,conversation:r.conversation_id,extra_body:r.checkpoint_id?{entity_id:n,checkpoint_id:r.checkpoint_id}:void 0};return this.request("/v1/responses",{method:"POST",body:JSON.stringify(a)})}clearStreamingState(n){Eu(n)}async*streamDeployment(n){const r=await fetch(`${this.baseUrl}/v1/deployments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,stream:!0})});if(!r.ok)throw new Error(`Deployment failed: ${r.statusText}`);const a=r.body?.getReader();if(!a)throw new Error("No response body");const l=new TextDecoder;let c="";try{for(;;){const{done:d,value:f}=await a.read();if(d)break;c+=l.decode(f,{stream:!0});const m=c.split(`
`);c=m.pop()||"";for(const h of m)if(h.startsWith("data: ")){const g=h.slice(6);if(g==="[DONE]")return;try{yield JSON.parse(g)}catch(x){yield{type:"deploy.error",message:`Failed to parse deployment event: ${x instanceof Error?x.message:"Unknown error"}`}}}}}catch(d){throw yield{type:"deploy.failed",message:`Stream interrupted: ${d instanceof Error?d.message:"Unknown error"}`},d}finally{a.releaseLock()}}async listWorkflowSessions(n){const r=`/v1/conversations?entity_id=${encodeURIComponent(n)}&type=workflow_session`;return{data:(await this.request(r)).data.map(c=>({conversation_id:c.id,entity_id:c.metadata?.entity_id||n,created_at:c.created_at,metadata:{name:c.metadata?.name||`Session ${new Date(c.created_at*1e3).toLocaleString()}`,description:c.metadata?.description,type:"workflow_session",checkpoint_summary:c.metadata?.checkpoint_summary}}))}}async createWorkflowSession(n,r){const a={entity_id:n,type:"workflow_session",name:r?.name||`Session ${new Date().toLocaleString()}`,...r?.description&&{description:r.description}},l=await this.createConversation(a);return{conversation_id:l.id,entity_id:n,created_at:l.created_at,metadata:{name:a.name,description:a.description,type:"workflow_session"}}}async deleteWorkflowSession(n,r){if(!await this.deleteConversation(r))throw new Error("Failed to delete workflow session")}}const Ze=new JR;function eD({open:e,onClose:n,agentName:r="Agent",entity:a}){const c=le(C=>C.azureDeploymentEnabled)&&(a?.deployment_supported??!1),[d,f]=w.useState(c?"azure":"docker"),[m,h]=w.useState(null),g=w.useRef(null),x=w.useRef(null),y=le(C=>C.isDeploying),b=le(C=>C.deploymentLogs),j=le(C=>C.lastDeployment),N=le(C=>C.startDeployment),S=le(C=>C.addDeploymentLog),_=le(C=>C.setDeploymentResult),A=le(C=>C.stopDeployment),E=le(C=>C.clearDeploymentState),M=C=>{const $=C.toLowerCase().replace(/[_\s]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/--+/g,"-").replace(/^[^a-z]+/,"").replace(/-$/,"");return($.match(/^[a-z]/)?$:`app-${$}`).substring(0,31)},T=a?M(a.id):"",[D,z]=w.useState("my-test-rg"),[H,q]=w.useState(T),[X,W]=w.useState("eastus"),[G,ne]=w.useState(null);w.useEffect(()=>{if(a){const C=M(a.id);q(C);const $=B(C);ne($)}},[a?.id]),w.useEffect(()=>{x.current&&b.length>0&&(x.current.scrollTop=x.current.scrollHeight)},[b]);const B=C=>C?C.length>=32?"App name must be less than 32 characters":/^[a-z0-9-]+$/.test(C)?/^[a-z]/.test(C)?/[a-z0-9]$/.test(C)?C.includes("--")?"App name cannot contain consecutive hyphens (--)":null:"App name must end with a letter or number":"App name must start with a lowercase letter":"App name must contain only lowercase letters, numbers, and hyphens (no underscores or uppercase)":null;w.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const U=async()=>{if(!a?.id||!D||!H)return;const C=D.trim(),$=H.trim(),Y=B($);if(Y){ne(Y);return}try{N();for await(const V of Ze.streamDeployment({entity_id:a.id,resource_group:C,app_name:$,region:X,ui_mode:"user"}))S(V.message),V.type==="deploy.completed"&&V.url&&V.auth_token?_({url:V.url,authToken:V.auth_token}):V.type==="deploy.failed"&&A()}catch(V){S(`Error: ${V instanceof Error?V.message:"Deployment failed"}`),A()}},R=async(C,$)=>{try{await navigator.clipboard.writeText(C),h($),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{h(null),g.current=null},2e3)}catch{h(null)}},L=`# Dockerfile for ${r}
FROM python:3.11-slim

WORKDIR /app

# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy agent/workflow directories
COPY . .

# Expose DevUI default port
EXPOSE 8080

# Run DevUI server
CMD ["devui", ".", "--port", "8080", "--host", "0.0.0.0"]
`,I=`# docker-compose.yml
version: '3.8'

services:
  ${r.toLowerCase().replace(/\s+/g,"-")}:
    build: .
    environment:
      # OpenAI
      - OPENAI_API_KEY=\${OPENAI_API_KEY}
      - OPENAI_CHAT_MODEL_ID=\${OPENAI_CHAT_MODEL_ID:-gpt-4o-mini}
      # Or Azure OpenAI
      - AZURE_OPENAI_API_KEY=\${AZURE_OPENAI_API_KEY}
      - AZURE_OPENAI_ENDPOINT=\${AZURE_OPENAI_ENDPOINT}
      - AZURE_OPENAI_CHAT_DEPLOYMENT_NAME=\${AZURE_OPENAI_CHAT_DEPLOYMENT_NAME}
      # Optional: Enable instrumentation
      - ENABLE_INSTRUMENTATION=\${ENABLE_INSTRUMENTATION:-false}
    ports:
      - "8080:8080"
    restart: unless-stopped
`,P=`# requirements.txt
agent-framework-devui>=0.1.0
agent-framework>=0.1.0
# Chat clients (install what you need)
openai>=1.0.0
# azure-openai
# anthropic
`;return o.jsx(Ir,{open:e,onOpenChange:n,children:o.jsxs(Lr,{className:"w-[800px] max-w-[90vw]",children:[o.jsx(So,{onClose:n}),o.jsxs($r,{className:"p-6 pb-2",children:[o.jsxs(Pr,{className:"flex items-center gap-2",children:[o.jsx(Qh,{className:"h-5 w-5"}),"Deploy ",r]}),o.jsx("p",{className:"text-sm text-muted-foreground pt-1",children:"Get started with containerizing your agent for deployment."})]}),o.jsxs("div",{className:"flex border-b px-6",children:[o.jsxs("button",{onClick:()=>f("docker"),className:`px-4 py-2 text-sm font-medium transition-colors relative ${d==="docker"?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[o.jsx(DA,{className:"h-4 w-4 mr-2 inline"}),"Docker",d==="docker"&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),c&&o.jsxs("button",{onClick:()=>f("azure"),className:`px-4 py-2 text-sm font-medium transition-colors relative ${d==="azure"?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[o.jsx(AA,{className:"h-4 w-4 mr-2 inline"}),"Azure",d==="azure"&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]}),o.jsx("div",{className:"px-6 pb-6 min-h-[400px]",children:o.jsx(Wn,{className:"h-[500px]",children:o.jsxs("div",{className:"pr-4",children:[d==="docker"&&o.jsxs("div",{className:"space-y-4 pt-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"font-semibold mb-2",children:"Containerize with Docker"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Package your agent as a Docker container for consistent deployment anywhere."})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("span",{className:"text-sm font-medium",children:"Dockerfile"}),o.jsx(Le,{size:"sm",variant:"ghost",onClick:()=>R(L,"dockerfile"),children:m==="dockerfile"?o.jsxs(o.Fragment,{children:[o.jsx(nn,{className:"h-4 w-4 mr-1 text-green-500"}),"Copied!"]}):o.jsxs(o.Fragment,{children:[o.jsx(uo,{className:"h-4 w-4 mr-1"}),"Copy"]})})]}),o.jsx("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto border",children:L})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("span",{className:"text-sm font-medium",children:"docker-compose.yml"}),o.jsx(Le,{size:"sm",variant:"ghost",onClick:()=>R(I,"compose"),children:m==="compose"?o.jsxs(o.Fragment,{children:[o.jsx(nn,{className:"h-4 w-4 mr-1 text-green-500"}),"Copied!"]}):o.jsxs(o.Fragment,{children:[o.jsx(uo,{className:"h-4 w-4 mr-1"}),"Copy"]})})]}),o.jsx("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto border",children:I})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("span",{className:"text-sm font-medium",children:"requirements.txt"}),o.jsx(Le,{size:"sm",variant:"ghost",onClick:()=>R(P,"requirements"),children:m==="requirements"?o.jsxs(o.Fragment,{children:[o.jsx(nn,{className:"h-4 w-4 mr-1 text-green-500"}),"Copied!"]}):o.jsxs(o.Fragment,{children:[o.jsx(uo,{className:"h-4 w-4 mr-1"}),"Copy"]})})]}),o.jsx("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto border",children:P})]}),o.jsxs("div",{className:"bg-blue-50 dark:bg-blue-950/50 border border-blue-200 dark:border-blue-800 rounded-md p-3",children:[o.jsx("h4",{className:"text-sm font-semibold mb-2",children:"Quick Start"}),o.jsxs("ol",{className:"text-xs space-y-1 list-decimal list-inside text-muted-foreground",children:[o.jsx("li",{children:"Save the files above to your project directory"}),o.jsxs("li",{children:["Build:"," ",o.jsxs("code",{className:"bg-muted px-1 rounded",children:["docker build -t ",r.toLowerCase(),"-agent ."]})]}),o.jsxs("li",{children:["Run:"," ",o.jsx("code",{className:"bg-muted px-1 rounded",children:"docker-compose up"})]}),o.jsx("li",{children:"Your agent is now running in a container!"})]})]}),o.jsxs("div",{className:"bg-amber-50 dark:bg-amber-950/50 border border-amber-200 dark:border-amber-800 rounded-md p-3",children:[o.jsx("h4",{className:"text-sm font-semibold mb-2 text-amber-900 dark:text-amber-100",children:"⚠️ Production Considerations"}),o.jsxs("ul",{className:"text-xs space-y-1 list-disc list-inside text-amber-800 dark:text-amber-200",children:[o.jsxs("li",{children:[o.jsx("strong",{children:"In-memory state:"})," Conversations are lost when container restarts"]}),o.jsxs("li",{children:[o.jsx("strong",{children:"No authentication:"})," Add reverse proxy (nginx, Caddy) with auth for production"]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Security:"})," Use Azure Key Vault for secrets management"]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Scaling:"})," Single instance only due to in-memory conversation store"]})]})]}),o.jsxs("div",{className:"border-t pt-4",children:[o.jsx("h4",{className:"font-semibold text-sm mb-3",children:"Pre-Deployment Checklist"}),o.jsxs("div",{className:"space-y-2 text-sm",children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(nn,{className:"h-4 w-4 mt-0.5 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:"text-muted-foreground",children:"Set environment variables (API keys, secrets)"})]}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(nn,{className:"h-4 w-4 mt-0.5 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:"text-muted-foreground",children:"Test agent locally in container"})]}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(nn,{className:"h-4 w-4 mt-0.5 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:"text-muted-foreground",children:"Configure logging and monitoring"})]}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(nn,{className:"h-4 w-4 mt-0.5 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:"text-muted-foreground",children:"Set up error handling and retries"})]})]})]})]}),d==="azure"&&o.jsxs("div",{className:"space-y-4 pt-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"font-semibold mb-2",children:"Deploy to Azure Container Apps"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:c?"One-click deployment to Azure with automatic containerization and authentication.":"Azure Container Apps provides serverless containers with auto-scaling and integrated monitoring."})]}),o.jsxs("div",{className:"bg-blue-50 dark:bg-blue-950/50 border border-blue-200 dark:border-blue-800 rounded-md p-3",children:[o.jsx("h4",{className:"text-sm font-semibold mb-2 text-blue-900 dark:text-blue-100",children:"Prerequisites for Azure Deployment"}),o.jsxs("ul",{className:"text-xs space-y-1 list-disc list-inside text-blue-800 dark:text-blue-200",children:[o.jsxs("li",{children:["Azure CLI installed and authenticated (",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"az login"}),")"]}),o.jsx("li",{children:"Docker installed and running"}),o.jsxs("li",{children:["Azure subscription with the following providers registered:",o.jsxs("ul",{className:"ml-4 mt-1 space-y-0.5",children:[o.jsxs("li",{className:"list-none",children:["• ",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded text-xs",children:"Microsoft.App"})," (Container Apps)"]}),o.jsxs("li",{className:"list-none",children:["• ",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded text-xs",children:"Microsoft.ContainerRegistry"})," (ACR)"]}),o.jsxs("li",{className:"list-none",children:["• ",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded text-xs",children:"Microsoft.OperationalInsights"})," (Logging)"]})]})]})]}),o.jsxs("details",{className:"mt-2",children:[o.jsx("summary",{className:"text-xs cursor-pointer hover:underline text-blue-700 dark:text-blue-300",children:"How to register providers?"}),o.jsxs("div",{className:"mt-2 p-2 bg-blue-100 dark:bg-blue-900 rounded text-xs",children:[o.jsx("p",{className:"mb-1",children:"Run these commands once per subscription:"}),o.jsxs("code",{className:"block font-mono",children:["az provider register -n Microsoft.App --wait",o.jsx("br",{}),"az provider register -n Microsoft.ContainerRegistry --wait",o.jsx("br",{}),"az provider register -n Microsoft.OperationalInsights --wait"]})]})]})]}),c&&a&&!j&&o.jsxs("div",{className:"border rounded-lg p-4 space-y-4",children:[y?o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[o.jsx(Or,{className:"h-4 w-4 animate-spin"}),"Deploying..."]}),o.jsx("div",{ref:x,className:"bg-muted p-3 rounded-md text-xs font-mono max-h-60 overflow-y-auto space-y-1",children:b.map((C,$)=>o.jsx("div",{className:C.includes("failed")||C.includes("Error")?"text-red-600":"",children:C},$))})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium",children:"Resource Group"}),o.jsx("input",{type:"text",className:"w-full mt-1 px-3 py-2 border rounded-md text-sm",placeholder:"my-test-rg",value:D,onChange:C=>z(C.target.value)})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium",children:"App Name"}),o.jsx("input",{type:"text",className:`w-full mt-1 px-3 py-2 border rounded-md text-sm ${G?"border-red-500":""}`,placeholder:"my-agent-app",value:H,onChange:C=>{const $=C.target.value;q($);const Y=B($.trim());ne(Y)}}),G&&o.jsx("p",{className:"mt-1 text-xs text-red-600",children:G})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium",children:"Region"}),o.jsxs("select",{className:"w-full mt-1 px-3 py-2 border rounded-md text-sm",value:X,onChange:C=>W(C.target.value),children:[o.jsx("option",{value:"eastus",children:"East US"}),o.jsx("option",{value:"westus",children:"West US"}),o.jsx("option",{value:"westeurope",children:"West Europe"}),o.jsx("option",{value:"eastasia",children:"East Asia"})]})]})]}),o.jsxs(Le,{onClick:U,disabled:!D||!H||!!G,className:"w-full",children:[o.jsx(Qh,{className:"h-4 w-4 mr-2"}),"Deploy to Azure"]})]}),!y&&b.length>0&&!j&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-red-600",children:[o.jsx(hs,{className:"h-4 w-4"}),"Deployment Failed"]}),o.jsx("div",{className:"bg-muted p-3 rounded-md text-xs font-mono max-h-60 overflow-y-auto space-y-1",children:b.map((C,$)=>o.jsx("div",{className:C.includes("failed")||C.includes("Error")?"text-red-600":"",children:C},$))}),o.jsx(Le,{onClick:E,variant:"outline",className:"w-full",children:"Try Again"})]})]}),j&&o.jsxs("div",{className:"border-2 border-green-200 bg-green-50 dark:bg-green-950/50 rounded-lg p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(nn,{className:"h-5 w-5 text-green-600"}),o.jsx("h4",{className:"font-semibold text-green-900 dark:text-green-100",children:"Deployment Successful!"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium text-green-800 dark:text-green-200",children:"Deployment URL"}),o.jsxs("div",{className:"flex gap-2 mt-1",children:[o.jsx("code",{className:"flex-1 bg-white dark:bg-gray-900 px-3 py-2 rounded border text-sm",children:j.url}),o.jsx(Le,{size:"sm",variant:"outline",onClick:()=>window.open(j.url,"_blank"),children:o.jsx(Hu,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium text-green-800 dark:text-green-200",children:"Auth Token (save this - shown only once)"}),o.jsxs("div",{className:"flex gap-2 mt-1",children:[o.jsx("code",{className:"flex-1 bg-white dark:bg-gray-900 px-3 py-2 rounded border text-sm font-mono",children:j.authToken}),o.jsx(Le,{size:"sm",variant:"outline",onClick:()=>navigator.clipboard.writeText(j.authToken),children:o.jsx(uo,{className:"h-4 w-4"})})]})]})]}),o.jsx(Le,{onClick:E,variant:"outline",className:"w-full",children:"Deploy Another"})]}),!c&&a?.deployment_reason&&o.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/50 border border-amber-200 dark:border-amber-800 rounded-md p-3",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(hs,{className:"h-4 w-4 mt-0.5 text-amber-600 flex-shrink-0"}),o.jsxs("div",{className:"text-sm text-amber-800 dark:text-amber-200",children:[o.jsx("strong",{children:"Deployment not available:"})," ",a.deployment_reason]})]})}),!c&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[o.jsx("h4",{className:"font-medium text-sm",children:"Prerequisites"}),o.jsxs("ul",{className:"text-xs space-y-1 list-disc list-inside text-muted-foreground",children:[o.jsx("li",{children:"Azure subscription"}),o.jsxs("li",{children:["Azure CLI installed (",o.jsx("code",{className:"bg-muted px-1 rounded",children:"az --version"}),")"]}),o.jsx("li",{children:"Docker installed and running"}),o.jsxs("li",{children:["Logged in to Azure:"," ",o.jsx("code",{className:"bg-muted px-1 rounded",children:"az login"})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"font-medium text-sm",children:"Deployment Steps"}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"border-l-2 border-primary pl-3",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("div",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-bold",children:"1"}),o.jsx("h5",{className:"font-medium text-sm",children:"Create Azure Container Registry"})]}),o.jsx("pre",{className:"bg-muted p-2 rounded text-xs overflow-x-auto border mt-2",children:`# Create resource group
az group create --name myResourceGroup --location eastus

# Create container registry
az acr create --resource-group myResourceGroup \\
  --name myregistry --sku Basic`})]}),o.jsxs("div",{className:"border-l-2 border-primary pl-3",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("div",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-bold",children:"2"}),o.jsx("h5",{className:"font-medium text-sm",children:"Build and Push Docker Image"})]}),o.jsx("pre",{className:"bg-muted p-2 rounded text-xs overflow-x-auto border mt-2",children:`# Build and push in one command
az acr build --registry myregistry \\
  --image ${r.toLowerCase()}-agent:latest .`})]}),o.jsxs("div",{className:"border-l-2 border-primary pl-3",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("div",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-bold",children:"3"}),o.jsx("h5",{className:"font-medium text-sm",children:"Create Container Apps Environment"})]}),o.jsx("pre",{className:"bg-muted p-2 rounded text-xs overflow-x-auto border mt-2",children:`az containerapp env create --name myEnvironment \\
  --resource-group myResourceGroup \\
  --location eastus`})]}),o.jsxs("div",{className:"border-l-2 border-primary pl-3",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("div",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-bold",children:"4"}),o.jsx("h5",{className:"font-medium text-sm",children:"Deploy Container App"})]}),o.jsx("pre",{className:"bg-muted p-2 rounded text-xs overflow-x-auto border mt-2",children:`az containerapp create --name ${r.toLowerCase()}-app \\
  --resource-group myResourceGroup \\
  --environment myEnvironment \\
  --image myregistry.azurecr.io/${r.toLowerCase()}-agent:latest \\
  --target-port 8080 \\
  --ingress 'external' \\
  --registry-server myregistry.azurecr.io \\
  --env-vars OPENAI_API_KEY=secretref:openai-key OPENAI_CHAT_MODEL_ID=gpt-4o-mini`})]}),o.jsxs("div",{className:"border-l-2 border-primary pl-3",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("div",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-bold",children:"5"}),o.jsx("h5",{className:"font-medium text-sm",children:"Get Application URL"})]}),o.jsx("pre",{className:"bg-muted p-2 rounded text-xs overflow-x-auto border mt-2",children:`az containerapp show --name ${r.toLowerCase()}-app \\
  --resource-group myResourceGroup \\
  --query properties.configuration.ingress.fqdn`})]})]})]}),o.jsxs("div",{className:"bg-blue-50 dark:bg-blue-950/50 border border-blue-200 dark:border-blue-800 rounded-md p-3",children:[o.jsx("h4",{className:"text-sm font-semibold mb-2",children:"Learn More"}),o.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Explore Azure Container Apps documentation for advanced features like scaling, monitoring, and CI/CD integration."}),o.jsx(Le,{size:"sm",variant:"outline",className:"w-full",asChild:!0,children:o.jsxs("a",{href:"https://learn.microsoft.com/azure/container-apps/",target:"_blank",rel:"noopener noreferrer",children:[o.jsx(Hu,{className:"h-3 w-3 mr-1"}),"View Azure Container Apps Documentation"]})})]})]})]})]})})})]})})}function tD({className:e,...n}){return o.jsx("div",{"data-slot":"card",className:We("bg-card text-card-foreground flex flex-col gap-6 rounded border py-6 shadow-sm",e),...n})}function nD({className:e,...n}){return o.jsx("div",{"data-slot":"card-header",className:We("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...n})}function N2({className:e,...n}){return o.jsx("div",{"data-slot":"card-title",className:We("leading-none font-semibold",e),...n})}function sD({className:e,...n}){return o.jsx("div",{"data-slot":"card-description",className:We("text-muted-foreground text-sm",e),...n})}function rD({className:e,...n}){return o.jsx("div",{"data-slot":"card-content",className:We("px-6",e),...n})}function oD({className:e,...n}){return o.jsx("div",{"data-slot":"card-footer",className:We("flex items-center px-6 [.border-t]:pt-6",e),...n})}const Cr=[{id:"foundry-weather-agent",name:"Azure AI Weather Agent",description:"Weather agent using Azure AI Agent (Foundry) with Azure CLI authentication",type:"agent",url:"https://raw.githubusercontent.com/microsoft/agent-framework/main/python/samples/getting_started/devui/foundry_agent/agent.py",tags:["azure-ai","foundry","tools"],author:"Microsoft",difficulty:"beginner",features:["Azure AI Agent integration","Azure CLI authentication","Mock weather tools"],requiredEnvVars:[{name:"AZURE_AI_PROJECT_ENDPOINT",description:"Azure AI Foundry project endpoint URL",required:!0,example:"https://your-project.api.azureml.ms"},{name:"FOUNDRY_MODEL_DEPLOYMENT_NAME",description:"Name of the deployed model in Azure AI Foundry",required:!0,example:"gpt-4o"}]},{id:"weather-agent-azure",name:"Azure OpenAI Weather Agent",description:"Weather agent using Azure OpenAI with API key authentication",type:"agent",url:"https://raw.githubusercontent.com/microsoft/agent-framework/main/python/samples/getting_started/devui/weather_agent_azure/agent.py",tags:["azure","openai","tools"],author:"Microsoft",difficulty:"beginner",features:["Azure OpenAI integration","API key authentication","Function calling","Mock weather tools"],requiredEnvVars:[{name:"AZURE_OPENAI_API_KEY",description:"Azure OpenAI API key",required:!0},{name:"AZURE_OPENAI_CHAT_DEPLOYMENT_NAME",description:"Name of the deployed model in Azure OpenAI",required:!0,example:"gpt-4o"},{name:"AZURE_OPENAI_ENDPOINT",description:"Azure OpenAI endpoint URL",required:!0,example:"https://your-resource.openai.azure.com"}]},{id:"spam-workflow",name:"Spam Detection Workflow",description:"5-step workflow demonstrating email spam detection with branching logic",type:"workflow",url:"https://raw.githubusercontent.com/microsoft/agent-framework/main/python/samples/getting_started/devui/spam_workflow/workflow.py",tags:["workflow","branching","multi-step"],author:"Microsoft",difficulty:"beginner",features:["Sequential execution","Conditional branching","Mock spam detection"]},{id:"fanout-workflow",name:"Complex Fan-In/Fan-Out Workflow",description:"Advanced data processing workflow with parallel validation, transformation, and quality assurance stages",type:"workflow",url:"https://raw.githubusercontent.com/microsoft/agent-framework/main/python/samples/getting_started/devui/fanout_workflow/workflow.py",tags:["workflow","fan-out","fan-in","parallel"],author:"Microsoft",difficulty:"advanced",features:["Fan-out pattern","Parallel execution","Complex state management","Multi-stage processing"]}];Cr.filter(e=>e.type==="agent"),Cr.filter(e=>e.type==="workflow"),Cr.filter(e=>e.difficulty==="beginner"),Cr.filter(e=>e.difficulty==="intermediate"),Cr.filter(e=>e.difficulty==="advanced");const aD=e=>{switch(e){case"beginner":return"bg-green-100 text-green-700 border-green-200";case"intermediate":return"bg-yellow-100 text-yellow-700 border-yellow-200";case"advanced":return"bg-red-100 text-red-700 border-red-200";default:return"bg-gray-100 text-gray-700 border-gray-200"}},j2=w.forwardRef(({className:e,...n},r)=>o.jsx("div",{ref:r,role:"alert",className:We("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",e),...n}));j2.displayName="Alert";const S2=w.forwardRef(({className:e,...n},r)=>o.jsx("h5",{ref:r,className:We("mb-1 font-medium leading-none tracking-tight",e),...n}));S2.displayName="AlertTitle";const _2=w.forwardRef(({className:e,...n},r)=>o.jsx("div",{ref:r,className:We("text-sm [&_p]:leading-relaxed",e),...n}));_2.displayName="AlertDescription";function E2({children:e,copyable:n=!1}){const[r,a]=w.useState(!1),l=()=>{navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),2e3)};return o.jsxs("div",{className:"relative",children:[o.jsx("pre",{className:"bg-muted p-3 rounded-md text-sm overflow-x-auto font-mono",children:o.jsx("code",{children:e})}),n&&o.jsx(Le,{variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:l,children:r?o.jsx(jo,{className:"h-3 w-3"}):o.jsx(uo,{className:"h-3 w-3"})})]})}function iu({number:e,title:n,description:r,code:a,action:l,copyable:c=!1}){return o.jsxs("div",{className:"flex gap-4",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary text-primary-foreground font-semibold",children:e})}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:n}),r&&o.jsx("p",{className:"text-sm text-muted-foreground",children:r}),a&&o.jsx(E2,{copyable:c,children:a}),l&&o.jsx("div",{children:l})]})]})}function iD({sample:e,open:n,onOpenChange:r}){const a=e.requiredEnvVars&&e.requiredEnvVars.length>0,l=a?0:-1;return o.jsx(Ir,{open:n,onOpenChange:r,children:o.jsxs(Lr,{className:"max-w-3xl",children:[o.jsxs($r,{className:"px-6 pt-6 pb-2",children:[o.jsxs(Pr,{children:["Setup: ",e.name]}),o.jsxs(OR,{children:["Follow these steps to run this sample ",e.type," locally"]})]}),o.jsx("div",{className:"px-6 pb-6",children:o.jsx(Wn,{className:"h-[500px]",children:o.jsxs("div",{className:"space-y-6 pr-4",children:[o.jsx(iu,{number:1,title:"Download the sample file",action:o.jsx(Le,{asChild:!0,size:"sm",children:o.jsxs("a",{href:e.url,download:`${e.id}.py`,target:"_blank",rel:"noopener noreferrer",children:[o.jsx(Pu,{className:"h-4 w-4 mr-2"}),"Download ",e.id,".py"]})})}),o.jsx(iu,{number:2,title:"Create a project folder",description:"Create a dedicated folder for this sample and move the downloaded file there:",code:`mkdir -p ~/my-agents/${e.id}
mv ~/Downloads/${e.id}.py ~/my-agents/${e.id}/`,copyable:!0}),a&&o.jsx(iu,{number:3,title:"Set up environment variables",description:"Create a .env file in the project folder with these required variables:",code:e.requiredEnvVars.map(c=>`${c.name}=${c.example||"your-value-here"}
# ${c.description}`).join(`

`),copyable:!0}),o.jsx(iu,{number:4+l,title:"Run with DevUI",description:"Navigate to the folder and start DevUI:",code:`cd ~/my-agents/${e.id}
devui .`,copyable:!0}),o.jsxs(j2,{children:[o.jsx(tM,{className:"h-4 w-4"}),o.jsx(S2,{children:"Alternative: Run Programmatically"}),o.jsxs(_2,{className:"mt-2",children:[o.jsxs("p",{className:"mb-2",children:["You can also run the ",e.type," directly in Python:"]}),o.jsx(E2,{copyable:!0,children:`from ${e.id} import ${e.type}
import asyncio

async def main():
    response = await ${e.type}.run("Hello!")
    print(response)

asyncio.run(main())`})]})]}),o.jsxs("div",{className:"flex gap-2 pt-4 border-t",children:[o.jsx(Le,{variant:"outline",size:"sm",asChild:!0,children:o.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:[o.jsx(Hu,{className:"h-4 w-4 mr-2"}),"View Source"]})}),o.jsx(Le,{variant:"outline",size:"sm",asChild:!0,children:o.jsxs("a",{href:"https://github.com/microsoft/agent-framework#readme",target:"_blank",rel:"noopener noreferrer",children:[o.jsx(nN,{className:"h-4 w-4 mr-2"}),"Documentation"]})})]})]})})})]})})}function lD({sample:e}){const[n,r]=w.useState(!1),a=e.type==="workflow"?Us:Vs;return o.jsxs(o.Fragment,{children:[o.jsxs(tD,{className:"hover:shadow-md transition-shadow duration-200 h-full flex flex-col overflow-hidden w-full",children:[o.jsxs(nD,{className:"pb-3 min-w-0",children:[o.jsxs("div",{className:"flex items-start justify-between mb-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(a,{className:"h-5 w-5"}),o.jsx(ut,{variant:"secondary",className:"text-xs",children:e.type})]}),o.jsx(ut,{variant:"outline",className:We("text-xs border",aD(e.difficulty)),children:e.difficulty})]}),o.jsx(N2,{className:"text-lg leading-tight",children:e.name}),o.jsx(sD,{className:"text-sm line-clamp-3",children:e.description})]}),o.jsx(rD,{className:"pt-0 flex-1 min-w-0 overflow-hidden",children:o.jsxs("div",{className:"space-y-3 min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.tags.slice(0,3).map(l=>o.jsx(ut,{variant:"outline",className:"text-xs",children:l},l)),e.tags.length>3&&o.jsxs(ut,{variant:"outline",className:"text-xs",children:["+",e.tags.length-3]})]}),e.requiredEnvVars&&e.requiredEnvVars.length>0&&o.jsxs("details",{className:"group min-w-0 max-w-full overflow-hidden",children:[o.jsxs("summary",{className:"cursor-pointer list-none p-2 bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800 rounded-md hover:bg-amber-100 dark:hover:bg-amber-950/30 transition-colors flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx(KA,{className:"h-3.5 w-3.5 text-amber-600 dark:text-amber-500 flex-shrink-0"}),o.jsxs("span",{className:"text-xs font-medium text-amber-900 dark:text-amber-100 truncate",children:["Requires ",e.requiredEnvVars.length," env var",e.requiredEnvVars.length>1?"s":""]})]}),o.jsx(Rt,{className:"h-3 w-3 text-amber-600 dark:text-amber-500 flex-shrink-0 group-open:rotate-180 transition-transform"})]}),o.jsx("div",{className:"mt-2 p-2 bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800 rounded-md space-y-2 min-w-0 max-w-full overflow-hidden",children:e.requiredEnvVars.map(l=>o.jsxs("div",{className:"text-xs min-w-0 max-w-full overflow-hidden",children:[o.jsx("div",{className:"font-mono font-medium text-amber-900 dark:text-amber-100 break-words",children:l.name}),o.jsx("div",{className:"text-amber-700 dark:text-amber-300 mt-0.5 break-words",children:l.description}),l.example&&o.jsx("div",{className:"font-mono text-amber-600 dark:text-amber-400 mt-0.5 break-all",children:l.example})]},l.name))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Key Features:"}),o.jsx("ul",{className:"text-xs space-y-1",children:e.features.slice(0,3).map(l=>o.jsxs("li",{className:"flex items-center gap-1",children:[o.jsx("div",{className:"w-1 h-1 rounded-full bg-current opacity-50"}),o.jsx("span",{children:l})]},l))})]})]})}),o.jsxs(oD,{className:"pt-3 flex-col gap-3",children:[o.jsx("div",{className:"w-full flex items-center justify-between text-xs text-muted-foreground",children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(cN,{className:"h-3 w-3"}),o.jsx("span",{children:e.author})]})}),o.jsxs("div",{className:"w-full flex gap-2",children:[o.jsx(Le,{asChild:!0,className:"flex-1",size:"sm",children:o.jsxs("a",{href:e.url,download:`${e.id}.py`,target:"_blank",rel:"noopener noreferrer",children:[o.jsx(Pu,{className:"h-4 w-4 mr-2"}),"Download"]})}),o.jsxs(Le,{variant:"outline",className:"flex-1",size:"sm",onClick:()=>r(!0),children:[o.jsx(nN,{className:"h-4 w-4 mr-2"}),"Setup Guide"]})]})]})]}),o.jsx(iD,{sample:e,open:n,onOpenChange:r})]})}function _h({samples:e}){return o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:e.map(n=>o.jsx("div",{className:"min-w-0",children:o.jsx(lD,{sample:n})},n.id))})}function db({onClose:e,variant:n="inline",hasExistingEntities:r=!1}){return n==="inline"?o.jsx("div",{className:"flex-1 overflow-auto",children:o.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-8",children:[o.jsx("div",{className:"mb-8 p-4 bg-muted/50 border border-border rounded-lg",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(LM,{className:"h-5 w-5 text-amber-500 flex-shrink-0 mt-0.5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h3",{className:"font-semibold mb-1",children:"No agents or workflows configured yet!"}),o.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:["You can configure agents or workflows by running"," ",o.jsx("code",{className:"px-1.5 py-0.5 bg-background rounded text-xs",children:"devui"})," ","in a directory containing them."]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Browse the sample agents and workflows below. Download them, review the code, and run them locally to get started quickly."})]})]})}),o.jsxs("div",{className:"mb-6",children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Sample Gallery"}),o.jsx(_h,{samples:Cr})]}),o.jsx("div",{className:"text-center mt-12 pt-8 border-t",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Want to create your own agents or workflows? Check out the"," ",o.jsx("a",{href:"https://github.com/microsoft/agent-framework",className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",children:"documentation"})]})})]})}):n==="route"?o.jsx("div",{className:"h-full overflow-auto",children:o.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-8",children:[o.jsxs("div",{className:"mb-8",children:[r&&o.jsx("div",{className:"mb-4",children:o.jsxs(Le,{variant:"ghost",onClick:e,className:"gap-2",children:[o.jsx(dA,{className:"h-4 w-4"}),"Back"]})}),o.jsxs("div",{className:"text-center",children:[o.jsx("h2",{className:"text-2xl font-semibold mb-2",children:"Sample Gallery"}),o.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"Browse sample agents and workflows to learn the Agent Framework. Download these curated examples and run them locally. Examples range from beginner to advanced."})]})]}),o.jsx(_h,{samples:Cr}),o.jsx("div",{className:"text-center mt-12 pt-8 border-t",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Want to create your own agents or workflows? Check out the"," ",o.jsx("a",{href:"https://github.com/microsoft/agent-framework",className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",children:"documentation"})]})})]})}):o.jsx(_h,{samples:Cr})}function tl({className:e,...n}){return o.jsx("textarea",{"data-slot":"textarea",className:We("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...n})}function cD({onFilesSelected:e,accept:n="image/*,.pdf,audio/*,.wav,.mp3,.m4a,.ogg",multiple:r=!0,maxSize:a=50*1024*1024,disabled:l=!1,className:c=""}){const d=w.useRef(null),f=y=>{if(!y||y.length===0)return;const b=[],j=[];Array.from(y).forEach(N=>{if(N.size>a){j.push(`${N.name} is too large (max ${uD(a)})`);return}if(n&&!dD(N,n)){j.push(`${N.name} is not an accepted file type`);return}b.push(N)}),j.length>0&&console.warn("File upload errors:",j),b.length>0&&e(b)},m=()=>{d.current&&d.current.click()},h=y=>{f(y.target.files),y.target.value=""},g=y=>{if(y.preventDefault(),y.stopPropagation(),l)return;const b=y.dataTransfer.files;f(b)},x=y=>{y.preventDefault(),y.stopPropagation()};return o.jsxs("div",{className:c,children:[o.jsx("input",{ref:d,type:"file",accept:n,multiple:r,onChange:h,className:"hidden",disabled:l}),o.jsx(Le,{type:"button",variant:"outline",size:"icon",onClick:m,disabled:l,onDrop:g,onDragOver:x,className:"shrink-0 transition-colors hover:bg-muted",title:"Upload files (images, PDFs, audio)",children:o.jsx(PM,{className:"h-4 w-4"})})]})}function uD(e){if(e===0)return"0 Bytes";const n=1024,r=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,a)).toFixed(2))+" "+r[a]}function dD(e,n){return n.split(",").map(a=>a.trim()).some(a=>{if(a.startsWith("."))return e.name.toLowerCase().endsWith(a.toLowerCase());if(a.includes("/*")){const[l]=a.split("/");return e.type.startsWith(l+"/")}else return e.type===a})}function fD({attachments:e,onRemoveAttachment:n,className:r=""}){return e.length===0?null:o.jsx("div",{className:`flex flex-wrap gap-2 p-2 bg-muted rounded-lg ${r}`,children:e.map(a=>o.jsx(mD,{attachment:a,onRemove:()=>n(a.id)},a.id))})}function mD({attachment:e,onRemove:n}){const[r,a]=w.useState(!1),l=()=>{switch(e.type){case"image":return e.preview?o.jsx("img",{src:e.preview,alt:e.file.name,className:"w-full h-full object-cover"}):o.jsx("div",{className:"flex items-center justify-center w-full h-full bg-gray-200",children:o.jsx(XA,{className:"h-6 w-6 text-gray-400"})});case"pdf":return o.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full bg-red-50",children:[o.jsx(qs,{className:"h-6 w-6 text-red-500 mb-1"}),o.jsx("span",{className:"text-xs text-red-600",children:"PDF"})]});case"audio":return o.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full bg-purple-50",children:[o.jsx(lN,{className:"h-6 w-6 text-purple-500 mb-1"}),o.jsx("span",{className:"text-xs text-purple-600",children:"AUDIO"})]});default:return o.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full bg-gray-100",children:[o.jsx(qs,{className:"h-6 w-6 text-gray-500 mb-1"}),o.jsx("span",{className:"text-xs text-gray-600",children:"FILE"})]})}};return o.jsxs("div",{className:"relative w-16 h-16 rounded border overflow-hidden group cursor-pointer",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),title:e.file.name,children:[l(),o.jsx("div",{className:`absolute inset-0 bg-black/60 flex items-center justify-center transition-all duration-200 ease-in-out ${r?"opacity-100 backdrop-blur-sm":"opacity-0 pointer-events-none"}`,onClick:n,children:o.jsx("div",{className:`transition-all duration-200 ease-in-out ${r?"scale-100 opacity-100":"scale-75 opacity-0"}`,children:o.jsx(rg,{className:"h-5 w-5 text-white drop-shadow-lg"})})}),o.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black bg-opacity-75 text-white text-xs p-1 truncate opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:e.file.name})]})}function xg({onSubmit:e,isSubmitting:n=!1,isStreaming:r=!1,onCancel:a,isCancelling:l=!1,placeholder:c,showFileUpload:d=!0,maxAttachments:f=10,className:m="",disabled:h=!1,entityName:g="assistant",externalFiles:x,onExternalFilesProcessed:y}){const[b,j]=w.useState(""),[N,S]=w.useState([]),[_,A]=w.useState(!1),[E,M]=w.useState(null),T=w.useRef(null);w.useEffect(()=>{x&&x.length>0&&(X(x),y?.())},[x,y]);const D=1e4,z=I=>I.type.startsWith("image/")?"image":I.type==="application/pdf"?"pdf":I.type.startsWith("audio/")?"audio":"other",H=I=>new Promise((P,C)=>{const $=new FileReader;$.onload=()=>P($.result),$.onerror=C,$.readAsDataURL(I)}),q=I=>{const P=I.trim(),C=P.split(`
`);if(/^{[\s\S]*}$|^\[[\s\S]*\]$/.test(P))return".json";if(/^<\?xml|^<html|^<!DOCTYPE/i.test(P))return".html";if(/^```/.test(P))return".md";if(/\t/.test(I)&&C.length>1)return".tsv";if(C.length>2){const $=C.filter(V=>V.includes(",")),Y=C.filter(V=>V.includes(";"));if($.length>C.length*.5&&$.reduce((J,ce)=>J+(ce.match(/,/g)||[]).length,0)/$.length>=2||Y.length>C.length*.5&&Y.reduce((J,ce)=>J+(ce.match(/;/g)||[]).length,0)/Y.length>=2)return".csv"}return".txt"},X=w.useCallback(async I=>{if(N.length+I.length>f){console.warn(`Cannot add more than ${f} attachments`);return}const P=[];for(const C of I){const $={id:`${Date.now()}-${Math.random()}`,file:C,type:z(C)};if(C.type.startsWith("image/"))try{$.preview=await H(C)}catch(Y){console.error("Failed to generate preview:",Y)}P.push($)}S(C=>[...C,...P])},[N.length,f]),W=I=>{S(P=>P.filter(C=>C.id!==I))},G=I=>{I.preventDefault(),I.stopPropagation(),A(!0)},ne=I=>{I.preventDefault(),I.stopPropagation(),A(!1)},B=async I=>{I.preventDefault(),I.stopPropagation(),A(!1);const P=Array.from(I.dataTransfer.files);P.length>0&&await X(P)},U=async I=>{const P=Array.from(I.clipboardData.items),C=[];let $=!1;for(const Y of P)if(Y.type.startsWith("image/")){I.preventDefault();const V=Y.getAsFile();if(V){const J=Date.now();C.push(new File([V],`screenshot-${J}.png`,{type:V.type}))}}else Y.type==="text/plain"&&!$&&($=!0,I.preventDefault(),await new Promise(V=>{Y.getAsString(J=>{const ce=(J.match(/\n/g)||[]).length;if(J.length>D||ce>50||/^\s*[{[][\s\S]*[}\]]\s*$/.test(J)||/^<\?xml|^<html|^<!DOCTYPE/i.test(J)){const ee=q(J),ie=Date.now(),ge=new Blob([J],{type:"text/plain"});C.push(new File([ge],`pasted-text-${ie}${ee}`,{type:"text/plain"}))}else{const ee=T.current;if(ee){const ie=ee.selectionStart,ge=ee.selectionEnd,Ee=ee.value,Ne=Ee.slice(0,ie)+J+Ee.slice(ge);j(Ne),setTimeout(()=>{ee.selectionStart=ee.selectionEnd=ie+J.length,ee.focus()},0)}}V()})}));if(C.length>0){await X(C);const Y=C.length===1?C[0].name.includes("screenshot")?"Screenshot added as attachment":"Large text converted to file":`${C.length} files added`;M(Y),setTimeout(()=>M(null),3e3)}},R=async I=>{if(I.preventDefault(),!b.trim()&&N.length===0||n||h)return;const P=b.trim(),C=[];P&&C.push({text:P,type:"input_text"});for(const $ of N){const Y=await H($.file);if($.file.type.startsWith("image/"))C.push({detail:"auto",type:"input_image",image_url:Y});else if($.file.type==="text/plain"&&($.file.name.includes("pasted-text-")||$.file.name.endsWith(".txt")||$.file.name.endsWith(".csv")||$.file.name.endsWith(".json")||$.file.name.endsWith(".html")||$.file.name.endsWith(".md")||$.file.name.endsWith(".tsv"))){const V=await $.file.text();C.push({text:V,type:"input_text"})}else{const V=Y.split(",")[1];C.push({type:"input_file",file_data:V,file_url:Y,filename:$.file.name})}}await e(C),j(""),S([])},L=!h&&!n&&!r&&(b.trim()||N.length>0);return o.jsxs("div",{className:`relative ${m}`,onDragOver:G,onDragLeave:ne,onDrop:B,children:[_&&o.jsx("div",{className:"absolute inset-2 border-2 border-dashed border-blue-400 dark:border-blue-500 rounded-lg bg-blue-50/80 dark:bg-blue-950/40 backdrop-blur-sm flex items-center justify-center transition-all duration-200 ease-in-out z-10",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-blue-600 dark:text-blue-400 text-sm font-medium mb-1",children:"Drop files here"}),o.jsx("div",{className:"text-blue-500 dark:text-blue-500 text-xs",children:"Images, PDFs, and other files"})]})}),N.length>0&&o.jsx("div",{className:"mb-3",children:o.jsx(fD,{attachments:N,onRemoveAttachment:W})}),E&&o.jsxs("div",{className:`absolute bottom-24 left-1/2 -translate-x-1/2 z-20
                      bg-blue-500 text-white px-4 py-2 rounded-full text-sm
                      animate-in slide-in-from-bottom-2 fade-in duration-200
                      flex items-center gap-2 shadow-lg`,children:[E.includes("screenshot")?o.jsx(xM,{className:"h-3 w-3"}):o.jsx(qs,{className:"h-3 w-3"}),E]}),o.jsxs("form",{onSubmit:R,className:"flex gap-2 items-end",children:[o.jsx(tl,{ref:T,value:b,onChange:I=>j(I.target.value),onPaste:U,onKeyDown:I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),R(I))},placeholder:c||`Message ${g}... (Shift+Enter for new line)`,disabled:h||n||r,className:"flex-1 min-h-[40px] max-h-[200px] resize-none",style:{fieldSizing:"content"}}),d&&o.jsx(cD,{onFilesSelected:X,disabled:h||n||r}),r&&a?o.jsx(Le,{type:"button",size:"icon",onClick:a,disabled:l,className:"shrink-0 h-10 transition-all",title:"Stop generating","aria-label":"Stop generating response",children:l?o.jsx(Vu,{size:"sm"}):o.jsx(vd,{className:"h-4 w-4 fill-current"})}):o.jsx(Le,{type:"submit",size:"icon",disabled:!L,className:"shrink-0 h-10 transition-all",title:"Send message","aria-label":"Send message",children:n?o.jsx(Vu,{size:"sm"}):o.jsx(_M,{className:"h-4 w-4"})})]})]})}function hD({code:e,language:n}){const[r,a]=w.useState(!1),l=w.useRef(null);w.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]);const c=async()=>{try{await navigator.clipboard.writeText(e),a(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{a(!1),l.current=null},2e3)}catch(d){console.error("Failed to copy code:",d)}};return o.jsxs("div",{className:"relative group",children:[o.jsx("pre",{className:"my-3 p-3 bg-foreground/5 dark:bg-foreground/10 rounded overflow-x-auto border border-foreground/10",children:o.jsxs("code",{className:"text-xs font-mono block whitespace-pre-wrap break-words",children:[n&&o.jsx("span",{className:"opacity-60 text-[10px] mb-1 block uppercase",children:n}),e]})}),o.jsx("button",{onClick:c,className:`absolute top-2 right-2 p-1.5 rounded-md border shadow-sm
                   bg-background hover:bg-accent
                   text-muted-foreground hover:text-foreground
                   transition-all duration-200
                   opacity-0 group-hover:opacity-100`,title:r?"Copied!":"Copy code",children:r?o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-green-600 dark:text-green-400",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})}):o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),o.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})}function pD({content:e,className:n=""}){const r=e.split(`
`),a=[];let l=0;for(;l<r.length;){const c=r[l];if(c.trim().startsWith("```")){const f=[],h=c.trim().match(/^```(\w+)?/)?.[1]||"";for(l++;l<r.length&&!r[l].trim().startsWith("```");)f.push(r[l]),l++;l++,a.push(o.jsx(hD,{code:f.join(`
`), language: h
}, a.length)); continue
  } const d = c.match(/^(#{1,6})\s+(.+)$/); if (d) { const f = d[1].length, m = d[2], g = `${["text-2xl", "text-xl", "text-lg", "text-base", "text-sm", "text-sm"][f - 1]} font-semibold mt-4 mb-2 first:mt-0 break-words`, x = f === 1 ? o.jsx("h1", { className: g, children: wn(m) }, a.length) : f === 2 ? o.jsx("h2", { className: g, children: wn(m) }, a.length) : f === 3 ? o.jsx("h3", { className: g, children: wn(m) }, a.length) : f === 4 ? o.jsx("h4", { className: g, children: wn(m) }, a.length) : f === 5 ? o.jsx("h5", { className: g, children: wn(m) }, a.length) : o.jsx("h6", { className: g, children: wn(m) }, a.length); a.push(x), l++; continue } if (c.match(/^[\s]*[-*+]\s+/)) { const f = []; for (; l < r.length && r[l].match(/^[\s]*[-*+]\s+/);) { const m = r[l].replace(/^[\s]*[-*+]\s+/, ""); f.push(m), l++ } a.push(o.jsx("ul", { className: "my-2 ml-4 list-disc space-y-1 break-words", children: f.map((m, h) => o.jsx("li", { className: "text-sm break-words", children: wn(m) }, h)) }, a.length)); continue } if (c.match(/^[\s]*\d+\.\s+/)) { const f = []; for (; l < r.length && r[l].match(/^[\s]*\d+\.\s+/);) { const m = r[l].replace(/^[\s]*\d+\.\s+/, ""); f.push(m), l++ } a.push(o.jsx("ol", { className: "my-2 ml-4 list-decimal space-y-1 break-words", children: f.map((m, h) => o.jsx("li", { className: "text-sm break-words", children: wn(m) }, h)) }, a.length)); continue } if (c.trim().startsWith("|") && c.trim().endsWith("|")) { const f = []; for (; l < r.length && r[l].trim().startsWith("|") && r[l].trim().endsWith("|");)f.push(r[l].trim()), l++; if (f.length >= 2) { const m = f[0].split("|").slice(1, -1).map(g => g.trim()); if (f[1].match(/^\|[\s\-:|]+\|$/)) { const g = f.slice(2).map(x => x.split("|").slice(1, -1).map(y => y.trim())); a.push(o.jsx("div", { className: "my-3 overflow-x-auto", children: o.jsxs("table", { className: "min-w-full border border-foreground/10 text-sm", children: [o.jsx("thead", { className: "bg-foreground/5", children: o.jsx("tr", { children: m.map((x, y) => o.jsx("th", { className: "border-b border-foreground/10 px-3 py-2 text-left font-semibold break-words", children: wn(x) }, y)) }) }), o.jsx("tbody", { children: g.map((x, y) => o.jsx("tr", { className: "border-b border-foreground/5 last:border-b-0", children: x.map((b, j) => o.jsx("td", { className: "px-3 py-2 border-r border-foreground/5 last:border-r-0 break-words", children: wn(b) }, j)) }, y)) })] }) }, a.length)); continue } } for (const m of f) a.push(o.jsx("p", { className: "my-1", children: wn(m) }, a.length)); continue } if (c.trim().startsWith(">")) { const f = []; for (; l < r.length && r[l].trim().startsWith(">");)f.push(r[l].replace(/^>\s?/, "")), l++; a.push(o.jsx("blockquote", { className: "my-2 pl-4 border-l-4 border-current/30 opacity-80 italic break-words", children: f.map((m, h) => o.jsx("div", { className: "break-words", children: wn(m) }, h)) }, a.length)); continue } if (c.match(/^[\s]*[-*_]{3,}[\s]*$/)) { a.push(o.jsx("hr", { className: "my-4 border-t border-border" }, a.length)), l++; continue } if (c.trim() === "") { a.push(o.jsx("div", { className: "h-2" }, a.length)), l++; continue } a.push(o.jsx("p", { className: "my-1 break-words", children: wn(c) }, a.length)), l++
  } return o.jsx("div", { className: `markdown-content break-words ${n}`, children: a })
} function wn(e) { const n = []; let r = e, a = 0; for (; r.length > 0;) { const l = r.match(/`([^`]+)`/); if (l && l.index !== void 0) { l.index > 0 && n.push(o.jsx("span", { children: nl(r.slice(0, l.index)) }, a++)), n.push(o.jsx("code", { className: "px-1.5 py-0.5 bg-foreground/10 rounded text-xs font-mono border border-foreground/20", children: l[1] }, a++)), r = r.slice(l.index + l[0].length); continue } n.push(o.jsx("span", { children: nl(r) }, a++)); break } return n } function nl(e) { const n = []; let r = e, a = 0; for (; r.length > 0;) { const l = [{ regex: /\*\*\[([^\]]+)\]\(([^)]+)\)\*\*/, component: "strong-link" }, { regex: /__\[([^\]]+)\]\(([^)]+)\)__/, component: "strong-link" }, { regex: /\*\[([^\]]+)\]\(([^)]+)\)\*/, component: "em-link" }, { regex: /_\[([^\]]+)\]\(([^)]+)\)_/, component: "em-link" }, { regex: /\[([^\]]+)\]\(([^)]+)\)/, component: "link" }, { regex: /\*\*(.+?)\*\*/, component: "strong" }, { regex: /__(.+?)__/, component: "strong" }, { regex: /\*(.+?)\*/, component: "em" }, { regex: /_(.+?)_/, component: "em" }]; let c = !1; for (const d of l) { const f = r.match(d.regex); if (f && f.index !== void 0) { if (f.index > 0 && n.push(r.slice(0, f.index)), d.component === "strong") n.push(o.jsx("strong", { className: "font-semibold", children: f[1] }, a++)); else if (d.component === "em") n.push(o.jsx("em", { className: "italic", children: f[1] }, a++)); else if (d.component === "strong-link") { const m = f[1], h = f[2], g = nl(m); n.push(o.jsx("strong", { className: "font-semibold", children: o.jsx("a", { href: h, target: "_blank", rel: "noopener noreferrer", className: "text-primary hover:underline break-words", children: g }) }, a++)) } else if (d.component === "em-link") { const m = f[1], h = f[2], g = nl(m); n.push(o.jsx("em", { className: "italic", children: o.jsx("a", { href: h, target: "_blank", rel: "noopener noreferrer", className: "text-primary hover:underline break-words", children: g }) }, a++)) } else if (d.component === "link") { const m = f[1], h = f[2], g = nl(m); n.push(o.jsx("a", { href: h, target: "_blank", rel: "noopener noreferrer", className: "text-primary hover:underline break-words", children: g }, a++)) } r = r.slice(f.index + f[0].length), c = !0; break } } if (!c) { r.length > 0 && n.push(r); break } } return n } function gD({ content: e, className: n, isStreaming: r }) { if (e.type !== "text" && e.type !== "input_text" && e.type !== "output_text") return null; const a = e.text; return o.jsxs("div", { className: `break-words ${n || ""}`, children: [o.jsx(pD, { content: a }), r && a.length > 0 && o.jsx("span", { className: "ml-1 inline-block h-2 w-2 animate-pulse rounded-full bg-current" })] }) } function xD({ content: e, className: n }) { const [r, a] = w.useState(!1), [l, c] = w.useState(!1); if (e.type !== "input_image" && e.type !== "output_image") return null; const d = e.image_url; return r ? o.jsx("div", { className: `my-2 p-3 border rounded-lg bg-muted ${n || ""}`, children: o.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [o.jsx(qs, { className: "h-4 w-4" }), o.jsx("span", { children: "Image could not be loaded" })] }) }) : o.jsxs("div", { className: `my-2 ${n || ""}`, children: [o.jsx("img", { src: d, alt: "Uploaded image", className: `rounded-lg border max-w-full transition-all cursor-pointer ${l ? "max-h-none" : "max-h-64"}`, onClick: () => c(!l), onError: () => a(!0) }), l && o.jsx("div", { className: "text-xs text-muted-foreground mt-1", children: "Click to collapse" })] }) } function yD(e, n) { const [r, a] = w.useState(null); return w.useEffect(() => { if (!e) { a(null); return } try { let l; if (e.startsWith("data:")) { const h = e.split(","); if (h.length !== 2) { a(null); return } l = h[1] } else l = e; const c = atob(l), d = new Uint8Array(c.length); for (let h = 0; h < c.length; h++)d[h] = c.charCodeAt(h); const f = new Blob([d], { type: n }), m = URL.createObjectURL(f); return a(m), () => { URL.revokeObjectURL(m) } } catch (l) { console.error("Failed to convert base64 to blob URL:", l), a(null) } }, [e, n]), r } function vD({ content: e, className: n }) { const [r, a] = w.useState(!0), l = e.type === "input_file" || e.type === "output_file", c = l ? e.file_url || e.file_data : void 0, d = l ? e.filename || "file" : void 0, f = d?.toLowerCase().endsWith(".pdf") || c?.includes("application/pdf"), m = d?.toLowerCase().match(/\.(mp3|wav|m4a|ogg|flac|aac)$/), h = l && f ? e.file_data || e.file_url : void 0, g = yD(h, "application/pdf"); if (!l) return null; const x = g || c, y = () => { x && window.open(x, "_blank") }; return f && c ? o.jsxs("div", { className: `my-2 ${n || ""}`, children: [o.jsxs("div", { className: "flex items-center gap-2 mb-2 px-1", children: [o.jsx(qs, { className: "h-4 w-4 text-red-500" }), o.jsx("span", { className: "text-sm font-medium truncate flex-1", children: d }), o.jsx("button", { onClick: () => a(!r), className: "text-xs text-muted-foreground hover:text-foreground flex items-center gap-1", children: r ? o.jsxs(o.Fragment, { children: [o.jsx(Rt, { className: "h-3 w-3" }), "Collapse"] }) : o.jsxs(o.Fragment, { children: [o.jsx(en, { className: "h-3 w-3" }), "Expand"] }) })] }), r && o.jsxs("div", { className: "border rounded-lg p-6 bg-muted/50 flex flex-col items-center justify-center gap-4", children: [o.jsx(qs, { className: "h-16 w-16 text-red-400" }), o.jsxs("div", { className: "text-center", children: [o.jsx("p", { className: "text-sm font-medium mb-1", children: d }), o.jsx("p", { className: "text-xs text-muted-foreground", children: "PDF Document" })] }), o.jsxs("div", { className: "flex gap-3", children: [o.jsx("button", { onClick: y, className: "text-sm bg-primary text-primary-foreground hover:bg-primary/90 flex items-center gap-2 px-4 py-2 rounded-md transition-colors", children: "Open in new tab" }), o.jsxs("a", { href: x || c, download: d, className: "text-sm text-foreground hover:bg-accent flex items-center gap-2 px-4 py-2 border rounded-md transition-colors", children: [o.jsx(Pu, { className: "h-4 w-4" }), "Download"] })] })] })] }) : m && c ? o.jsxs("div", { className: `my-2 p-3 border rounded-lg ${n || ""}`, children: [o.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [o.jsx(lN, { className: "h-4 w-4 text-muted-foreground" }), o.jsx("span", { className: "text-sm font-medium", children: d })] }), o.jsxs("audio", { controls: !0, className: "w-full", children: [o.jsx("source", { src: c }), "Your browser does not support audio playback."] })] }) : o.jsx("div", { className: `my-2 p-3 border rounded-lg bg-muted ${n || ""}`, children: o.jsxs("div", { className: "flex items-center justify-between", children: [o.jsxs("div", { className: "flex items-center gap-2", children: [o.jsx(qs, { className: "h-4 w-4 text-muted-foreground" }), o.jsx("span", { className: "text-sm", children: d })] }), c && o.jsxs("a", { href: c, download: d, className: "text-xs text-primary hover:underline flex items-center gap-1", children: [o.jsx(Pu, { className: "h-3 w-3" }), "Download"] })] }) }) } function bD({ content: e, className: n }) { const [r, a] = w.useState(!1); if (e.type !== "output_data") return null; const l = e.data, c = e.mime_type, d = e.description; let f = l; try { const m = JSON.parse(l); f = JSON.stringify(m, null, 2) } catch { } return o.jsxs("div", { className: `my-2 p-3 border rounded-lg bg-muted ${n || ""}`, children: [o.jsxs("div", { className: "flex items-center gap-2 cursor-pointer", onClick: () => a(!r), children: [o.jsx(qs, { className: "h-4 w-4 text-muted-foreground" }), o.jsx("span", { className: "text-sm font-medium", children: d || "Data Output" }), o.jsx("span", { className: "text-xs text-muted-foreground ml-auto", children: c }), r ? o.jsx(Rt, { className: "h-4 w-4 text-muted-foreground" }) : o.jsx(en, { className: "h-4 w-4 text-muted-foreground" })] }), r && o.jsx("pre", { className: "mt-2 text-xs overflow-auto max-h-64 bg-background p-2 rounded border font-mono", children: f })] }) } function wD({ content: e, className: n }) { const [r, a] = w.useState(!1); if (e.type !== "function_approval_request") return null; const { status: l, function_call: c } = e, f = { pending: { icon: Jp, label: "Awaiting approval", iconClass: "text-amber-600 dark:text-amber-400" }, approved: { icon: jo, label: "Approved", iconClass: "text-green-600 dark:text-green-400" }, rejected: { icon: Ea, label: "Rejected", iconClass: "text-red-600 dark:text-red-400" } }[l], m = f.icon; let h; try { h = typeof c.arguments == "string" ? JSON.parse(c.arguments) : c.arguments } catch { h = c.arguments } return o.jsxs("div", { className: n, children: [o.jsxs("button", { onClick: () => a(!r), className: "flex items-center gap-2 px-2 py-1 text-xs rounded hover:bg-muted/50 transition-colors w-fit", children: [o.jsx(m, { className: `h-3 w-3 ${f.iconClass}` }), o.jsx("span", { className: "text-muted-foreground font-mono", children: c.name }), o.jsx("span", { className: `text-xs ${f.iconClass}`, children: f.label }), r ? o.jsx("span", { className: "text-xs text-muted-foreground", children: "▼" }) : o.jsx("span", { className: "text-xs text-muted-foreground", children: "▶" })] }), r && o.jsx("div", { className: "ml-5 mt-1 text-xs font-mono text-muted-foreground border-l-2 border-muted pl-3", children: o.jsx("pre", { className: "whitespace-pre-wrap break-all", children: JSON.stringify(h, null, 2) }) })] }) } function ND({ content: e, className: n, isStreaming: r }) { switch (e.type) { case "text": case "input_text": case "output_text": return o.jsx(gD, { content: e, className: n, isStreaming: r }); case "input_image": case "output_image": return o.jsx(xD, { content: e, className: n }); case "input_file": case "output_file": return o.jsx(vD, { content: e, className: n }); case "output_data": return o.jsx(bD, { content: e, className: n }); case "function_approval_request": return o.jsx(wD, { content: e, className: n }); default: return null } } function jD({ name: e, arguments: n, className: r }) { const [a, l] = w.useState(!1); let c; try { c = typeof n == "string" ? JSON.parse(n) : n } catch { c = n } return o.jsxs("div", { className: `my-2 p-3 border rounded bg-blue-50 dark:bg-blue-950/20 ${r || ""}`, children: [o.jsxs("div", { className: "flex items-center gap-2 cursor-pointer", onClick: () => l(!a), children: [o.jsx(oN, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" }), o.jsxs("span", { className: "text-sm font-medium text-blue-800 dark:text-blue-300", children: ["Function Call: ", e] }), a ? o.jsx(Rt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400 ml-auto" }) : o.jsx(en, { className: "h-4 w-4 text-blue-600 dark:text-blue-400 ml-auto" })] }), a && o.jsxs("div", { className: "mt-2 text-xs font-mono bg-white dark:bg-gray-900 p-2 rounded border", children: [o.jsx("div", { className: "text-blue-600 dark:text-blue-400 mb-1", children: "Arguments:" }), o.jsx("pre", { className: "whitespace-pre-wrap", children: JSON.stringify(c, null, 2) })] })] }) } function SD({ output: e, call_id: n, className: r }) { const [a, l] = w.useState(!1); let c; try { c = typeof e == "string" ? JSON.parse(e) : e } catch { c = e } return o.jsxs("div", { className: `my-2 p-3 border rounded bg-green-50 dark:bg-green-950/20 ${r || ""}`, children: [o.jsxs("div", { className: "flex items-center gap-2 cursor-pointer", onClick: () => l(!a), children: [o.jsx(oN, { className: "h-4 w-4 text-green-600 dark:text-green-400" }), o.jsx("span", { className: "text-sm font-medium text-green-800 dark:text-green-300", children: "Function Result" }), a ? o.jsx(Rt, { className: "h-4 w-4 text-green-600 dark:text-green-400 ml-auto" }) : o.jsx(en, { className: "h-4 w-4 text-green-600 dark:text-green-400 ml-auto" })] }), a && o.jsxs("div", { className: "mt-2 text-xs font-mono bg-white dark:bg-gray-900 p-2 rounded border", children: [o.jsx("div", { className: "text-green-600 dark:text-green-400 mb-1", children: "Output:" }), o.jsx("pre", { className: "whitespace-pre-wrap", children: JSON.stringify(c, null, 2) }), o.jsxs("div", { className: "text-gray-500 text-[10px] mt-2", children: ["Call ID: ", n] })] })] }) } function _D({ item: e, className: n }) { if (e.type === "message") { const r = e.status === "in_progress", a = e.content.length > 0; return o.jsxs("div", { className: n, children: [e.content.map((l, c) => o.jsx(ND, { content: l, className: c > 0 ? "mt-2" : "", isStreaming: r }, c)), r && !a && o.jsx("div", { className: "flex items-center space-x-1", children: o.jsxs("div", { className: "flex space-x-1", children: [o.jsx("div", { className: "h-2 w-2 animate-bounce rounded-full bg-current [animation-delay:-0.3s]" }), o.jsx("div", { className: "h-2 w-2 animate-bounce rounded-full bg-current [animation-delay:-0.15s]" }), o.jsx("div", { className: "h-2 w-2 animate-bounce rounded-full bg-current" })] }) })] }) } return e.type === "function_call" ? o.jsx(jD, { name: e.name, arguments: e.arguments, className: n }) : e.type === "function_call_output" ? o.jsx(SD, { output: e.output, call_id: e.call_id, className: n }) : null } var ED = [" ", "Enter", "ArrowUp", "ArrowDown"], CD = [" ", "Enter"], go = "Select", [Ad, Md, kD] = Tp(go), [Ba, t$] = Kn(go, [kD, Ua]), Rd = Ua(), [TD, Hr] = Ba(go), [AD, MD] = Ba(go), C2 = e => { const { __scopeSelect: n, children: r, open: a, defaultOpen: l, onOpenChange: c, value: d, defaultValue: f, onValueChange: m, dir: h, name: g, autoComplete: x, disabled: y, required: b, form: j } = e, N = Rd(n), [S, _] = w.useState(null), [A, E] = w.useState(null), [M, T] = w.useState(!1), D = jl(h), [z, H] = Ar({ prop: a, defaultProp: l ?? !1, onChange: c, caller: go }), [q, X] = Ar({ prop: d, defaultProp: f, onChange: m, caller: go }), W = w.useRef(null), G = S ? j || !!S.closest("form") : !0, [ne, B] = w.useState(new Set), U = Array.from(ne).map(R => R.props.value).join(";"); return o.jsx(Hp, { ...N, children: o.jsxs(TD, { required: b, scope: n, trigger: S, onTriggerChange: _, valueNode: A, onValueNodeChange: E, valueNodeHasChildren: M, onValueNodeHasChildrenChange: T, contentId: Mr(), value: q, onValueChange: X, open: z, onOpenChange: H, dir: D, triggerPointerDownPosRef: W, disabled: y, children: [o.jsx(Ad.Provider, { scope: n, children: o.jsx(AD, { scope: e.__scopeSelect, onNativeOptionAdd: w.useCallback(R => { B(L => new Set(L).add(R)) }, []), onNativeOptionRemove: w.useCallback(R => { B(L => { const I = new Set(L); return I.delete(R), I }) }, []), children: r }) }), G ? o.jsxs(Z2, { "aria-hidden": !0, required: b, tabIndex: -1, name: g, autoComplete: x, value: q, onChange: R => X(R.target.value), disabled: y, form: j, children: [q === void 0 ? o.jsx("option", { value: "" }) : null, Array.from(ne)] }, U) : null] }) }) }; C2.displayName = go; var k2 = "SelectTrigger", T2 = w.forwardRef((e, n) => { const { __scopeSelect: r, disabled: a = !1, ...l } = e, c = Rd(r), d = Hr(k2, r), f = d.disabled || a, m = rt(n, d.onTriggerChange), h = Md(r), g = w.useRef("touch"), [x, y, b] = K2(N => { const S = h().filter(E => !E.disabled), _ = S.find(E => E.value === d.value), A = Q2(S, N, _); A !== void 0 && d.onValueChange(A.value) }), j = N => { f || (d.onOpenChange(!0), b()), N && (d.triggerPointerDownPosRef.current = { x: Math.round(N.pageX), y: Math.round(N.pageY) }) }; return o.jsx(Up, { asChild: !0, ...c, children: o.jsx(Ye.button, { type: "button", role: "combobox", "aria-controls": d.contentId, "aria-expanded": d.open, "aria-required": d.required, "aria-autocomplete": "none", dir: d.dir, "data-state": d.open ? "open" : "closed", disabled: f, "data-disabled": f ? "" : void 0, "data-placeholder": W2(d.value) ? "" : void 0, ...l, ref: m, onClick: ke(l.onClick, N => { N.currentTarget.focus(), g.current !== "mouse" && j(N) }), onPointerDown: ke(l.onPointerDown, N => { g.current = N.pointerType; const S = N.target; S.hasPointerCapture(N.pointerId) && S.releasePointerCapture(N.pointerId), N.button === 0 && N.ctrlKey === !1 && N.pointerType === "mouse" && (j(N), N.preventDefault()) }), onKeyDown: ke(l.onKeyDown, N => { const S = x.current !== ""; !(N.ctrlKey || N.altKey || N.metaKey) && N.key.length === 1 && y(N.key), !(S && N.key === " ") && ED.includes(N.key) && (j(), N.preventDefault()) }) }) }) }); T2.displayName = k2; var A2 = "SelectValue", M2 = w.forwardRef((e, n) => { const { __scopeSelect: r, className: a, style: l, children: c, placeholder: d = "", ...f } = e, m = Hr(A2, r), { onValueNodeHasChildrenChange: h } = m, g = c !== void 0, x = rt(n, m.onValueNodeChange); return Wt(() => { h(g) }, [h, g]), o.jsx(Ye.span, { ...f, ref: x, style: { pointerEvents: "none" }, children: W2(m.value) ? o.jsx(o.Fragment, { children: d }) : c }) }); M2.displayName = A2; var RD = "SelectIcon", R2 = w.forwardRef((e, n) => { const { __scopeSelect: r, children: a, ...l } = e; return o.jsx(Ye.span, { "aria-hidden": !0, ...l, ref: n, children: a || "▼" }) }); R2.displayName = RD; var DD = "SelectPortal", D2 = e => o.jsx(fd, { asChild: !0, ...e }); D2.displayName = DD; var xo = "SelectContent", O2 = w.forwardRef((e, n) => { const r = Hr(xo, e.__scopeSelect), [a, l] = w.useState(); if (Wt(() => { l(new DocumentFragment) }, []), !r.open) { const c = a; return c ? Nl.createPortal(o.jsx(z2, { scope: e.__scopeSelect, children: o.jsx(Ad.Slot, { scope: e.__scopeSelect, children: o.jsx("div", { children: e.children }) }) }), c) : null } return o.jsx(I2, { ...e, ref: n }) }); O2.displayName = xo; var qn = 10, [z2, Ur] = Ba(xo), OD = "SelectContentImpl", zD = ja("SelectContent.RemoveScroll"), I2 = w.forwardRef((e, n) => { const { __scopeSelect: r, position: a = "item-aligned", onCloseAutoFocus: l, onEscapeKeyDown: c, onPointerDownOutside: d, side: f, sideOffset: m, align: h, alignOffset: g, arrowPadding: x, collisionBoundary: y, collisionPadding: b, sticky: j, hideWhenDetached: N, avoidCollisions: S, ..._ } = e, A = Hr(xo, r), [E, M] = w.useState(null), [T, D] = w.useState(null), z = rt(n, ee => M(ee)), [H, q] = w.useState(null), [X, W] = w.useState(null), G = Md(r), [ne, B] = w.useState(!1), U = w.useRef(!1); w.useEffect(() => { if (E) return h1(E) }, [E]), Lw(); const R = w.useCallback(ee => { const [ie, ...ge] = G().map(ve => ve.ref.current), [Ee] = ge.slice(-1), Ne = document.activeElement; for (const ve of ee) if (ve === Ne || (ve?.scrollIntoView({ block: "nearest" }), ve === ie && T && (T.scrollTop = 0), ve === Ee && T && (T.scrollTop = T.scrollHeight), ve?.focus(), document.activeElement !== Ne)) return }, [G, T]), L = w.useCallback(() => R([H, E]), [R, H, E]); w.useEffect(() => { ne && L() }, [ne, L]); const { onOpenChange: I, triggerPointerDownPosRef: P } = A; w.useEffect(() => { if (E) { let ee = { x: 0, y: 0 }; const ie = Ee => { ee = { x: Math.abs(Math.round(Ee.pageX) - (P.current?.x ?? 0)), y: Math.abs(Math.round(Ee.pageY) - (P.current?.y ?? 0)) } }, ge = Ee => { ee.x <= 10 && ee.y <= 10 ? Ee.preventDefault() : E.contains(Ee.target) || I(!1), document.removeEventListener("pointermove", ie), P.current = null }; return P.current !== null && (document.addEventListener("pointermove", ie), document.addEventListener("pointerup", ge, { capture: !0, once: !0 })), () => { document.removeEventListener("pointermove", ie), document.removeEventListener("pointerup", ge, { capture: !0 }) } } }, [E, I, P]), w.useEffect(() => { const ee = () => I(!1); return window.addEventListener("blur", ee), window.addEventListener("resize", ee), () => { window.removeEventListener("blur", ee), window.removeEventListener("resize", ee) } }, [I]); const [C, $] = K2(ee => { const ie = G().filter(Ne => !Ne.disabled), ge = ie.find(Ne => Ne.ref.current === document.activeElement), Ee = Q2(ie, ee, ge); Ee && setTimeout(() => Ee.ref.current.focus()) }), Y = w.useCallback((ee, ie, ge) => { const Ee = !U.current && !ge; (A.value !== void 0 && A.value === ie || Ee) && (q(ee), Ee && (U.current = !0)) }, [A.value]), V = w.useCallback(() => E?.focus(), [E]), J = w.useCallback((ee, ie, ge) => { const Ee = !U.current && !ge; (A.value !== void 0 && A.value === ie || Ee) && W(ee) }, [A.value]), ce = a === "popper" ? rp : L2, fe = ce === rp ? { side: f, sideOffset: m, align: h, alignOffset: g, arrowPadding: x, collisionBoundary: y, collisionPadding: b, sticky: j, hideWhenDetached: N, avoidCollisions: S } : {}; return o.jsx(z2, { scope: r, content: E, viewport: T, onViewportChange: D, itemRefCallback: Y, selectedItem: H, onItemLeave: V, itemTextRefCallback: J, focusSelectedItem: L, selectedItemText: X, position: a, isPositioned: ne, searchRef: C, children: o.jsx(qp, { as: zD, allowPinchZoom: !0, children: o.jsx(Ap, { asChild: !0, trapped: A.open, onMountAutoFocus: ee => { ee.preventDefault() }, onUnmountAutoFocus: ke(l, ee => { A.trigger?.focus({ preventScroll: !0 }), ee.preventDefault() }), children: o.jsx(id, { asChild: !0, disableOutsidePointerEvents: !0, onEscapeKeyDown: c, onPointerDownOutside: d, onFocusOutside: ee => ee.preventDefault(), onDismiss: () => A.onOpenChange(!1), children: o.jsx(ce, { role: "listbox", id: A.contentId, "data-state": A.open ? "open" : "closed", dir: A.dir, onContextMenu: ee => ee.preventDefault(), ..._, ...fe, onPlaced: () => B(!0), ref: z, style: { display: "flex", flexDirection: "column", outline: "none", ..._.style }, onKeyDown: ke(_.onKeyDown, ee => { const ie = ee.ctrlKey || ee.altKey || ee.metaKey; if (ee.key === "Tab" && ee.preventDefault(), !ie && ee.key.length === 1 && $(ee.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(ee.key)) { let Ee = G().filter(Ne => !Ne.disabled).map(Ne => Ne.ref.current); if (["ArrowUp", "End"].includes(ee.key) && (Ee = Ee.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(ee.key)) { const Ne = ee.target, ve = Ee.indexOf(Ne); Ee = Ee.slice(ve + 1) } setTimeout(() => R(Ee)), ee.preventDefault() } }) }) }) }) }) }) }); I2.displayName = OD; var ID = "SelectItemAlignedPosition", L2 = w.forwardRef((e, n) => { const { __scopeSelect: r, onPlaced: a, ...l } = e, c = Hr(xo, r), d = Ur(xo, r), [f, m] = w.useState(null), [h, g] = w.useState(null), x = rt(n, z => g(z)), y = Md(r), b = w.useRef(!1), j = w.useRef(!0), { viewport: N, selectedItem: S, selectedItemText: _, focusSelectedItem: A } = d, E = w.useCallback(() => { if (c.trigger && c.valueNode && f && h && N && S && _) { const z = c.trigger.getBoundingClientRect(), H = h.getBoundingClientRect(), q = c.valueNode.getBoundingClientRect(), X = _.getBoundingClientRect(); if (c.dir !== "rtl") { const Ne = X.left - H.left, ve = q.left - Ne, ze = z.left - ve, re = z.width + ze, Q = Math.max(re, H.width), me = window.innerWidth - qn, be = tp(ve, [qn, Math.max(qn, me - Q)]); f.style.minWidth = re + "px", f.style.left = be + "px" } else { const Ne = H.right - X.right, ve = window.innerWidth - q.right - Ne, ze = window.innerWidth - z.right - ve, re = z.width + ze, Q = Math.max(re, H.width), me = window.innerWidth - qn, be = tp(ve, [qn, Math.max(qn, me - Q)]); f.style.minWidth = re + "px", f.style.right = be + "px" } const W = y(), G = window.innerHeight - qn * 2, ne = N.scrollHeight, B = window.getComputedStyle(h), U = parseInt(B.borderTopWidth, 10), R = parseInt(B.paddingTop, 10), L = parseInt(B.borderBottomWidth, 10), I = parseInt(B.paddingBottom, 10), P = U + R + ne + I + L, C = Math.min(S.offsetHeight * 5, P), $ = window.getComputedStyle(N), Y = parseInt($.paddingTop, 10), V = parseInt($.paddingBottom, 10), J = z.top + z.height / 2 - qn, ce = G - J, fe = S.offsetHeight / 2, ee = S.offsetTop + fe, ie = U + R + ee, ge = P - ie; if (ie <= J) { const Ne = W.length > 0 && S === W[W.length - 1].ref.current; f.style.bottom = "0px"; const ve = h.clientHeight - N.offsetTop - N.offsetHeight, ze = Math.max(ce, fe + (Ne ? V : 0) + ve + L), re = ie + ze; f.style.height = re + "px" } else { const Ne = W.length > 0 && S === W[0].ref.current; f.style.top = "0px"; const ze = Math.max(J, U + N.offsetTop + (Ne ? Y : 0) + fe) + ge; f.style.height = ze + "px", N.scrollTop = ie - J + N.offsetTop } f.style.margin = `${qn}px 0`, f.style.minHeight = C + "px", f.style.maxHeight = G + "px", a?.(), requestAnimationFrame(() => b.current = !0) } }, [y, c.trigger, c.valueNode, f, h, N, S, _, c.dir, a]); Wt(() => E(), [E]); const [M, T] = w.useState(); Wt(() => { h && T(window.getComputedStyle(h).zIndex) }, [h]); const D = w.useCallback(z => { z && j.current === !0 && (E(), A?.(), j.current = !1) }, [E, A]); return o.jsx($D, { scope: r, contentWrapper: f, shouldExpandOnScrollRef: b, onScrollButtonChange: D, children: o.jsx("div", { ref: m, style: { display: "flex", flexDirection: "column", position: "fixed", zIndex: M }, children: o.jsx(Ye.div, { ...l, ref: x, style: { boxSizing: "border-box", maxHeight: "100%", ...l.style } }) }) }) }); L2.displayName = ID; var LD = "SelectPopperPosition", rp = w.forwardRef((e, n) => { const { __scopeSelect: r, align: a = "start", collisionPadding: l = qn, ...c } = e, d = Rd(r); return o.jsx(Bp, { ...d, ...c, ref: n, align: a, collisionPadding: l, style: { boxSizing: "border-box", ...c.style, "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)", "--radix-select-content-available-width": "var(--radix-popper-available-width)", "--radix-select-content-available-height": "var(--radix-popper-available-height)", "--radix-select-trigger-width": "var(--radix-popper-anchor-width)", "--radix-select-trigger-height": "var(--radix-popper-anchor-height)" } }) }); rp.displayName = LD; var [$D, yg] = Ba(xo, {}), op = "SelectViewport", $2 = w.forwardRef((e, n) => { const { __scopeSelect: r, nonce: a, ...l } = e, c = Ur(op, r), d = yg(op, r), f = rt(n, c.onViewportChange), m = w.useRef(0); return o.jsxs(o.Fragment, { children: [o.jsx("style", { dangerouslySetInnerHTML: { __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}" }, nonce: a }), o.jsx(Ad.Slot, { scope: r, children: o.jsx(Ye.div, { "data-radix-select-viewport": "", role: "presentation", ...l, ref: f, style: { position: "relative", flex: 1, overflow: "hidden auto", ...l.style }, onScroll: ke(l.onScroll, h => { const g = h.currentTarget, { contentWrapper: x, shouldExpandOnScrollRef: y } = d; if (y?.current && x) { const b = Math.abs(m.current - g.scrollTop); if (b > 0) { const j = window.innerHeight - qn * 2, N = parseFloat(x.style.minHeight), S = parseFloat(x.style.height), _ = Math.max(N, S); if (_ < j) { const A = _ + b, E = Math.min(j, A), M = A - E; x.style.height = E + "px", x.style.bottom === "0px" && (g.scrollTop = M > 0 ? M : 0, x.style.justifyContent = "flex-end") } } } m.current = g.scrollTop }) }) })] }) }); $2.displayName = op; var P2 = "SelectGroup", [PD, HD] = Ba(P2), UD = w.forwardRef((e, n) => { const { __scopeSelect: r, ...a } = e, l = Mr(); return o.jsx(PD, { scope: r, id: l, children: o.jsx(Ye.div, { role: "group", "aria-labelledby": l, ...a, ref: n }) }) }); UD.displayName = P2; var H2 = "SelectLabel", BD = w.forwardRef((e, n) => { const { __scopeSelect: r, ...a } = e, l = HD(H2, r); return o.jsx(Ye.div, { id: l.id, ...a, ref: n }) }); BD.displayName = H2; var Xu = "SelectItem", [VD, U2] = Ba(Xu), B2 = w.forwardRef((e, n) => { const { __scopeSelect: r, value: a, disabled: l = !1, textValue: c, ...d } = e, f = Hr(Xu, r), m = Ur(Xu, r), h = f.value === a, [g, x] = w.useState(c ?? ""), [y, b] = w.useState(!1), j = rt(n, A => m.itemRefCallback?.(A, a, l)), N = Mr(), S = w.useRef("touch"), _ = () => { l || (f.onValueChange(a), f.onOpenChange(!1)) }; if (a === "") throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."); return o.jsx(VD, { scope: r, value: a, disabled: l, textId: N, isSelected: h, onItemTextChange: w.useCallback(A => { x(E => E || (A?.textContent ?? "").trim()) }, []), children: o.jsx(Ad.ItemSlot, { scope: r, value: a, disabled: l, textValue: g, children: o.jsx(Ye.div, { role: "option", "aria-labelledby": N, "data-highlighted": y ? "" : void 0, "aria-selected": h && y, "data-state": h ? "checked" : "unchecked", "aria-disabled": l || void 0, "data-disabled": l ? "" : void 0, tabIndex: l ? void 0 : -1, ...d, ref: j, onFocus: ke(d.onFocus, () => b(!0)), onBlur: ke(d.onBlur, () => b(!1)), onClick: ke(d.onClick, () => { S.current !== "mouse" && _() }), onPointerUp: ke(d.onPointerUp, () => { S.current === "mouse" && _() }), onPointerDown: ke(d.onPointerDown, A => { S.current = A.pointerType }), onPointerMove: ke(d.onPointerMove, A => { S.current = A.pointerType, l ? m.onItemLeave?.() : S.current === "mouse" && A.currentTarget.focus({ preventScroll: !0 }) }), onPointerLeave: ke(d.onPointerLeave, A => { A.currentTarget === document.activeElement && m.onItemLeave?.() }), onKeyDown: ke(d.onKeyDown, A => { m.searchRef?.current !== "" && A.key === " " || (CD.includes(A.key) && _(), A.key === " " && A.preventDefault()) }) }) }) }) }); B2.displayName = Xu; var Ki = "SelectItemText", V2 = w.forwardRef((e, n) => { const { __scopeSelect: r, className: a, style: l, ...c } = e, d = Hr(Ki, r), f = Ur(Ki, r), m = U2(Ki, r), h = MD(Ki, r), [g, x] = w.useState(null), y = rt(n, _ => x(_), m.onItemTextChange, _ => f.itemTextRefCallback?.(_, m.value, m.disabled)), b = g?.textContent, j = w.useMemo(() => o.jsx("option", { value: m.value, disabled: m.disabled, children: b }, m.value), [m.disabled, m.value, b]), { onNativeOptionAdd: N, onNativeOptionRemove: S } = h; return Wt(() => (N(j), () => S(j)), [N, S, j]), o.jsxs(o.Fragment, { children: [o.jsx(Ye.span, { id: m.textId, ...c, ref: y }), m.isSelected && d.valueNode && !d.valueNodeHasChildren ? Nl.createPortal(c.children, d.valueNode) : null] }) }); V2.displayName = Ki; var q2 = "SelectItemIndicator", F2 = w.forwardRef((e, n) => { const { __scopeSelect: r, ...a } = e; return U2(q2, r).isSelected ? o.jsx(Ye.span, { "aria-hidden": !0, ...a, ref: n }) : null }); F2.displayName = q2; var ap = "SelectScrollUpButton", Y2 = w.forwardRef((e, n) => { const r = Ur(ap, e.__scopeSelect), a = yg(ap, e.__scopeSelect), [l, c] = w.useState(!1), d = rt(n, a.onScrollButtonChange); return Wt(() => { if (r.viewport && r.isPositioned) { let f = function () { const h = m.scrollTop > 0; c(h) }; const m = r.viewport; return f(), m.addEventListener("scroll", f), () => m.removeEventListener("scroll", f) } }, [r.viewport, r.isPositioned]), l ? o.jsx(X2, { ...e, ref: d, onAutoScroll: () => { const { viewport: f, selectedItem: m } = r; f && m && (f.scrollTop = f.scrollTop - m.offsetHeight) } }) : null }); Y2.displayName = ap; var ip = "SelectScrollDownButton", G2 = w.forwardRef((e, n) => { const r = Ur(ip, e.__scopeSelect), a = yg(ip, e.__scopeSelect), [l, c] = w.useState(!1), d = rt(n, a.onScrollButtonChange); return Wt(() => { if (r.viewport && r.isPositioned) { let f = function () { const h = m.scrollHeight - m.clientHeight, g = Math.ceil(m.scrollTop) < h; c(g) }; const m = r.viewport; return f(), m.addEventListener("scroll", f), () => m.removeEventListener("scroll", f) } }, [r.viewport, r.isPositioned]), l ? o.jsx(X2, { ...e, ref: d, onAutoScroll: () => { const { viewport: f, selectedItem: m } = r; f && m && (f.scrollTop = f.scrollTop + m.offsetHeight) } }) : null }); G2.displayName = ip; var X2 = w.forwardRef((e, n) => { const { __scopeSelect: r, onAutoScroll: a, ...l } = e, c = Ur("SelectScrollButton", r), d = w.useRef(null), f = Md(r), m = w.useCallback(() => { d.current !== null && (window.clearInterval(d.current), d.current = null) }, []); return w.useEffect(() => () => m(), [m]), Wt(() => { f().find(g => g.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" }) }, [f]), o.jsx(Ye.div, { "aria-hidden": !0, ...l, ref: n, style: { flexShrink: 0, ...l.style }, onPointerDown: ke(l.onPointerDown, () => { d.current === null && (d.current = window.setInterval(a, 50)) }), onPointerMove: ke(l.onPointerMove, () => { c.onItemLeave?.(), d.current === null && (d.current = window.setInterval(a, 50)) }), onPointerLeave: ke(l.onPointerLeave, () => { m() }) }) }), qD = "SelectSeparator", FD = w.forwardRef((e, n) => { const { __scopeSelect: r, ...a } = e; return o.jsx(Ye.div, { "aria-hidden": !0, ...a, ref: n }) }); FD.displayName = qD; var lp = "SelectArrow", YD = w.forwardRef((e, n) => { const { __scopeSelect: r, ...a } = e, l = Rd(r), c = Hr(lp, r), d = Ur(lp, r); return c.open && d.position === "popper" ? o.jsx(Vp, { ...l, ...a, ref: n }) : null }); YD.displayName = lp; var GD = "SelectBubbleInput", Z2 = w.forwardRef(({ __scopeSelect: e, value: n, ...r }, a) => { const l = w.useRef(null), c = rt(a, l), d = fg(n); return w.useEffect(() => { const f = l.current; if (!f) return; const m = window.HTMLSelectElement.prototype, g = Object.getOwnPropertyDescriptor(m, "value").set; if (d !== n && g) { const x = new Event("change", { bubbles: !0 }); g.call(f, n), f.dispatchEvent(x) } }, [d, n]), o.jsx(Ye.select, { ...r, style: { ...GN, ...r.style }, ref: c, defaultValue: n }) }); Z2.displayName = GD; function W2(e) { return e === "" || e === void 0 } function K2(e) { const n = Zt(e), r = w.useRef(""), a = w.useRef(0), l = w.useCallback(d => { const f = r.current + d; n(f), (function m(h) { r.current = h, window.clearTimeout(a.current), h !== "" && (a.current = window.setTimeout(() => m(""), 1e3)) })(f) }, [n]), c = w.useCallback(() => { r.current = "", window.clearTimeout(a.current) }, []); return w.useEffect(() => () => window.clearTimeout(a.current), []), [r, l, c] } function Q2(e, n, r) { const l = n.length > 1 && Array.from(n).every(h => h === n[0]) ? n[0] : n, c = r ? e.indexOf(r) : -1; let d = XD(e, Math.max(c, 0)); l.length === 1 && (d = d.filter(h => h !== r)); const m = d.find(h => h.textValue.toLowerCase().startsWith(l.toLowerCase())); return m !== r ? m : void 0 } function XD(e, n) { return e.map((r, a) => e[(n + a) % e.length]) } var ZD = C2, WD = T2, KD = M2, QD = R2, JD = D2, e6 = O2, t6 = $2, n6 = B2, s6 = V2, r6 = F2, o6 = Y2, a6 = G2; function vg({ ...e }) { return o.jsx(ZD, { "data-slot": "select", ...e }) } function bg({ ...e }) { return o.jsx(KD, { "data-slot": "select-value", ...e }) } function wg({ className: e, size: n = "default", children: r, ...a }) { return o.jsxs(WD, { "data-slot": "select-trigger", "data-size": n, className: We("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", e), ...a, children: [r, o.jsx(QD, { asChild: !0, children: o.jsx(Rt, { className: "size-4 opacity-50" }) })] }) } function Ng({ className: e, children: n, position: r = "popper", ...a }) { return o.jsx(JD, { children: o.jsxs(e6, { "data-slot": "select-content", className: We("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md", r === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", e), position: r, ...a, children: [o.jsx(i6, {}), o.jsx(t6, { className: We("p-1", r === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"), children: n }), o.jsx(l6, {})] }) }) } function jg({ className: e, children: n, ...r }) { return o.jsxs(n6, { "data-slot": "select-item", className: We("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", e), ...r, children: [o.jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: o.jsx(r6, { children: o.jsx(jo, { className: "size-4" }) }) }), o.jsx(s6, { children: n })] }) } function i6({ className: e, ...n }) { return o.jsx(o6, { "data-slot": "select-scroll-up-button", className: We("flex cursor-default items-center justify-center py-1", e), ...n, children: o.jsx(rN, { className: "size-4" }) }) } function l6({ className: e, ...n }) { return o.jsx(a6, { "data-slot": "select-scroll-down-button", className: We("flex cursor-default items-center justify-center py-1", e), ...n, children: o.jsx(Rt, { className: "size-4" }) }) } function io({ title: e, icon: n, children: r, className: a = "" }) { return o.jsxs("div", { className: `border rounded-lg p-4 bg-card ${a}`, children: [o.jsxs("div", { className: "flex items-center gap-2 mb-3", children: [n, o.jsx("h3", { className: "text-sm font-semibold text-foreground", children: e })] }), o.jsx("div", { className: "text-sm text-muted-foreground", children: r })] }) } function c6({ agent: e, open: n, onOpenChange: r }) { const a = e.source === "directory" ? o.jsx(aN, { className: "h-4 w-4 text-muted-foreground" }) : e.source === "in_memory" ? o.jsx(Kh, { className: "h-4 w-4 text-muted-foreground" }) : o.jsx(iN, { className: "h-4 w-4 text-muted-foreground" }), l = e.source === "directory" ? "Local" : e.source === "in_memory" ? "In-Memory" : "Gallery"; return o.jsx(Ir, { open: n, onOpenChange: r, children: o.jsxs(Lr, { className: "max-w-4xl max-h-[90vh] flex flex-col", children: [o.jsxs($r, { className: "px-6 pt-6 flex-shrink-0", children: [o.jsx(Pr, { children: "Agent Details" }), o.jsx(So, { onClose: () => r(!1) })] }), o.jsxs("div", { className: "px-6 pb-6 overflow-y-auto flex-1", children: [o.jsxs("div", { className: "mb-6", children: [o.jsxs("div", { className: "flex items-center gap-3 mb-2", children: [o.jsx(Vs, { className: "h-6 w-6 text-primary" }), o.jsx("h2", { className: "text-xl font-semibold text-foreground", children: e.name || e.id })] }), e.description && o.jsx("p", { className: "text-muted-foreground", children: e.description })] }), o.jsx("div", { className: "h-px bg-border mb-6" }), o.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 mb-4", children: [(e.model_id || e.chat_client_type) && o.jsx(io, { title: "Model & Client", icon: o.jsx(Vs, { className: "h-4 w-4 text-muted-foreground" }), children: o.jsxs("div", { className: "space-y-1", children: [e.model_id && o.jsx("div", { className: "font-mono text-foreground", children: e.model_id }), e.chat_client_type && o.jsxs("div", { className: "text-xs", children: ["(", e.chat_client_type, ")"] })] }) }), o.jsx(io, { title: "Source", icon: a, children: o.jsxs("div", { className: "space-y-1", children: [o.jsx("div", { className: "text-foreground", children: l }), e.module_path && o.jsx("div", { className: "font-mono text-xs break-all", children: e.module_path })] }) }), o.jsx(io, { title: "Environment", icon: e.has_env ? o.jsx(kl, { className: "h-4 w-4 text-orange-500" }) : o.jsx(yd, { className: "h-4 w-4 text-green-500" }), className: "md:col-span-2", children: o.jsx("div", { className: e.has_env ? "text-orange-600 dark:text-orange-400" : "text-green-600 dark:text-green-400", children: e.has_env ? "Requires environment variables" : "No environment variables required" }) })] }), e.instructions && o.jsx(io, { title: "Instructions", icon: o.jsx(qs, { className: "h-4 w-4 text-muted-foreground" }), className: "mb-4", children: o.jsx("div", { className: "text-sm text-foreground leading-relaxed whitespace-pre-wrap", children: e.instructions }) }), o.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [e.tools && e.tools.length > 0 && o.jsx(io, { title: `Tools (${e.tools.length})`, icon: o.jsx(Uu, { className: "h-4 w-4 text-muted-foreground" }), children: o.jsx("ul", { className: "space-y-1", children: e.tools.map((c, d) => o.jsxs("li", { className: "font-mono text-xs text-foreground", children: ["• ", c] }, d)) }) }), e.middleware && e.middleware.length > 0 && o.jsx(io, { title: `MiddlewareTypes (${e.middleware.length})`, icon: o.jsx(Uu, { className: "h-4 w-4 text-muted-foreground" }), children: o.jsx("ul", { className: "space-y-1", children: e.middleware.map((c, d) => o.jsxs("li", { className: "font-mono text-xs text-foreground", children: ["• ", c] }, d)) }) }), e.context_providers && e.context_providers.length > 0 && o.jsx(io, { title: `Context Providers (${e.context_providers.length})`, icon: o.jsx(Kh, { className: "h-4 w-4 text-muted-foreground" }), className: !e.middleware || e.middleware.length === 0 ? "md:col-start-2" : "", children: o.jsx("ul", { className: "space-y-1", children: e.context_providers.map((c, d) => o.jsxs("li", { className: "font-mono text-xs text-foreground", children: ["• ", c] }, d)) }) })] })] })] }) }) } function u6({ item: e, toolCalls: n = [], toolResults: r = [] }) {
  const [a, l] = w.useState(!1), [c, d] = w.useState(!1), [f, m] = w.useState(!1), h = le(y => y.showToolCalls), g = () => e.type === "message" ? e.content.filter(y => y.type === "text").map(y => y.text).join(`
`):"",x=async()=>{const y=g();if(y)try{await navigator.clipboard.writeText(y),d(!0),setTimeout(()=>d(!1),2e3)}catch(b){console.error("Failed to copy:",b)}};if(e.type==="message"){const y=e.role==="user",b=e.status==="incomplete",j=y?cN:b?hs:Vs,N=g();return o.jsxs("div",{className:`flex gap-3 ${y?"flex-row-reverse":""}`,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[o.jsx("div",{className:`flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-md border ${y?"bg-primary text-primary-foreground":b?"bg-orange-100 dark:bg-orange-900 text-orange-600 dark:text-orange-400 border-orange-200 dark:border-orange-800":"bg-muted"}`,children:o.jsx(j,{className:"h-4 w-4"})}),o.jsxs("div",{className:`flex flex-col space-y-1 ${y?"items-end":"items-start"} max-w-[80%]`,children:[o.jsxs("div",{className:"relative group",children:[o.jsxs("div",{className:`rounded px-3 py-2 text-sm ${y?"bg-primary text-primary-foreground":b?"bg-orange-50 dark:bg-orange-950/50 text-orange-800 dark:text-orange-200 border border-orange-200 dark:border-orange-800":"bg-muted"}`,children:[b&&o.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[o.jsx(hs,{className:"h-4 w-4 text-orange-500 mt-0.5 flex-shrink-0"}),o.jsx("span",{className:"font-medium text-sm",children:"Unable to process request"})]}),o.jsx("div",{className:b?"text-xs leading-relaxed break-all":"",children:o.jsx(_D,{item:e})})]}),N&&a&&o.jsx("button",{onClick:x,className:`absolute top-1 right-1
                           p-1.5 rounded-md border shadow-sm
                           bg-background hover:bg-accent
                           text-muted-foreground hover:text-foreground
                           transition-all duration-200 ease-in-out
                           opacity-0 group-hover:opacity-100`,title:c?"Copied!":"Copy message",children:c?o.jsx(gA,{className:"h-3.5 w-3.5 text-green-600 dark:text-green-400"}):o.jsx(uo,{className:"h-3.5 w-3.5"})})]}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground font-mono",children:[o.jsx("span",{children:e.created_at?new Date(e.created_at*1e3).toLocaleTimeString():new Date().toLocaleTimeString()}),!y&&e.usage&&o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"•"}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:["↑",e.usage.input_tokens]}),o.jsxs("span",{className:"text-green-600 dark:text-green-400",children:["↓",e.usage.output_tokens]}),o.jsxs("span",{children:["(",e.usage.total_tokens," tokens)"]})]})]}),!y&&h&&n.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"•"}),o.jsxs("button",{onClick:()=>m(!f),className:"flex items-center gap-1 hover:text-foreground transition-colors",title:`${n.length} tool call${n.length>1?"s":""} - click to ${f?"hide":"show"} details`,children:[o.jsx(_a,{className:"h-3 w-3"}),o.jsx("span",{children:n.length})]})]})]}),!y&&f&&n.length>0&&o.jsx("div",{className:"mt-2 ml-0 p-3 bg-muted/30 rounded-md border border-muted",children:o.jsx("div",{className:"space-y-2",children:n.map(S=>{const _=r.find(A=>A.call_id===S.call_id);return o.jsx("div",{className:"text-xs",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(_a,{className:"h-3 w-3 text-muted-foreground mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"font-mono text-muted-foreground",children:[o.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:S.name}),o.jsx("span",{className:"text-muted-foreground/60 ml-1",children:S.arguments&&o.jsxs("span",{className:"break-all",children:["(",S.arguments,")"]})})]}),_&&_.output&&o.jsx("div",{className:"mt-1 pl-5 border-l-2 border-green-600/20",children:o.jsxs("div",{className:"flex items-start gap-1",children:[o.jsx(jo,{className:"h-3 w-3 text-green-600 dark:text-green-400 mt-0.5 flex-shrink-0"}),o.jsx("pre",{className:"font-mono text-muted-foreground whitespace-pre-wrap break-all",children:_.output.substring(0,200)+(_.output.length>200?"...":"")})]})}),S.status==="incomplete"&&o.jsx("div",{className:"mt-1 pl-5 border-l-2 border-orange-600/20",children:o.jsxs("div",{className:"flex items-start gap-1",children:[o.jsx(Ea,{className:"h-3 w-3 text-orange-600 dark:text-orange-400 mt-0.5 flex-shrink-0"}),o.jsx("span",{className:"font-mono text-orange-600 dark:text-orange-400",children:"Failed"})]})})]})]})},S.id)})})})]})]})}return e.type==="function_call"||e.type==="function_call_output",null}function d6({selectedAgent:e,onDebugEvent:n}){const r=le(re=>re.currentConversation),a=le(re=>re.availableConversations),l=le(re=>re.chatItems),c=le(re=>re.isStreaming),d=le(re=>re.isSubmitting),f=le(re=>re.loadingConversations),m=le(re=>re.uiMode),h=le(re=>re.conversationUsage),g=le(re=>re.pendingApprovals),x=le(re=>re.oaiMode),y=le(re=>re.streamingEnabled),b=le(re=>re.setCurrentConversation),j=le(re=>re.setAvailableConversations),N=le(re=>re.setChatItems),S=le(re=>re.setIsStreaming),_=le(re=>re.setIsSubmitting),A=le(re=>re.setLoadingConversations),E=le(re=>re.updateConversationUsage),M=le(re=>re.setPendingApprovals),[T,D]=w.useState(!1),[z,H]=w.useState(null),[q,X]=w.useState(!1),[W,G]=w.useState(!1),{isCancelling:ne,createAbortSignal:B,handleCancel:U,resetCancelling:R}=w2(),{isDragOver:L,droppedFiles:I,clearDroppedFiles:P,dragHandlers:C}=XR({disabled:d||c}),$=w.useRef(null),Y=w.useRef(null),V=w.useRef(null),J=w.useRef(!1),ce=w.useRef("");w.useEffect(()=>{if(!Y.current)return;const re=$.current?.querySelector("[data-radix-scroll-area-viewport]");let Q=!1;if(re){const{scrollTop:me,scrollHeight:be,clientHeight:Ce}=re,we=be-me-Ce<100;Q=J.current||we}else Q=!0;Q&&Y.current.scrollIntoView({behavior:c?"instant":"smooth"}),J.current&&!c&&(J.current=!1)},[l,c]),w.useEffect(()=>{},[c,d]),w.useEffect(()=>{const re=async(me,be,Ce)=>{const we=ba(be.id);if(!we||!we.responseId){S(!1);return}try{const Me={model:Ce.id,input:[],stream:!0,conversation:be.id},je=Ze.streamAgentExecutionOpenAIDirect(Ce.id,Me,be.id,void 0,we.responseId);for await(const tt of je){if(n(tt),tt.type==="response.completed"){const _e=tt.response?.usage;_e&&(V.current={input_tokens:_e.input_tokens,output_tokens:_e.output_tokens,total_tokens:_e.total_tokens});continue}if(tt.type==="response.failed"){const _e=tt.response?.error,xe=_e?typeof _e=="object"&&"message"in _e?_e.message:JSON.stringify(_e):"Request failed",$e=le.getState().chatItems;N($e.map(Ge=>Ge.id===me.id&&Ge.type==="message"?{...Ge,content:[{type:"text",text:ce.current||xe}],status:"incomplete"}:Ge)),S(!1);return}if(tt.type==="response.function_approval.requested"){const Be=tt;M([...le.getState().pendingApprovals,{request_id:Be.request_id,function_call:Be.function_call}]);continue}if(tt.type==="response.function_approval.responded"){const Be=tt;M(le.getState().pendingApprovals.filter(_e=>_e.request_id!==Be.request_id));continue}if(tt.type==="error"){const _e=tt.message||"An error occurred",xe=le.getState().chatItems;N(xe.map($e=>$e.id===me.id&&$e.type==="message"?{...$e,content:[{type:"text",text:ce.current||_e}],status:"incomplete"}:$e)),S(!1);return}if(tt.type==="response.output_text.delta"&&"delta"in tt&&tt.delta){ce.current+=tt.delta;const Be=le.getState().chatItems;N(Be.map(_e=>_e.id===me.id&&_e.type==="message"?{..._e,content:[{type:"text",text:ce.current}],status:"in_progress"}:_e))}}const Se=V.current,Ke=le.getState().chatItems;N(Ke.map(tt=>tt.id===me.id&&tt.type==="message"?{...tt,status:"completed",usage:Se||void 0}:tt)),S(!1),Se&&E(Se.total_tokens),V.current=null}catch(Me){const je=le.getState().chatItems;N(je.map(Se=>Se.id===me.id&&Se.type==="message"?{...Se,content:[{type:"text",text:`Error resuming stream: ${Me instanceof Error?Me.message:"Unknown error"}`}],status:"incomplete"}:Se)),S(!1)}},Q=async()=>{if(e){A(!0);try{try{const{data:we}=await Ze.listConversations(e.id);if(j(we),we.length>0){const Me=we[0];b(Me);try{let je=[],Se=!0,Ke,tt=[];for(;Se;){const _e=await Ze.listConversationItems(Me.id,{order:"asc",after:Ke});je=je.concat(_e.data),Se=_e.has_more,_e.metadata?.traces&&_e.metadata.traces.length>0&&(tt=_e.metadata.traces),Se&&_e.data.length>0&&(Ke=_e.data[_e.data.length-1].id)}if(N(je),S(!1),tt.length>0){n("clear");for(const _e of tt)n({type:"response.trace.completed",data:_e,sequence_number:0})}const Be=ba(Me.id);if(Be&&!Be.completed){ce.current=Be.accumulatedText||"";const _e={id:Be.lastMessageId||`assistant-${Date.now()}`,type:"message",role:"assistant",content:Be.accumulatedText?[{type:"text",text:Be.accumulatedText}]:[],status:"in_progress"};N([...je,_e]),S(!0),setTimeout(()=>{re(_e,Me,e)},100)}setTimeout(()=>{Y.current?.scrollIntoView({behavior:"smooth"})},100)}catch{console.debug(`No items found for conversation ${Me.id}, starting fresh`),N([]),S(!1)}return}}catch{}const me=`devui_convs_${e.id}`,be=localStorage.getItem(me);if(be)try{const we=JSON.parse(be);if(we.length>0)try{await Ze.listConversationItems(we[0].id),j(we),b(we[0]),N([]),S(!1);return}catch{console.debug(`Cached conversation ${we[0].id} no longer exists, clearing cache`),localStorage.removeItem(me)}}catch{localStorage.removeItem(me)}const Ce=await Ze.createConversation({agent_id:e.id});b(Ce),j([Ce]),N([]),S(!1),H(null),localStorage.setItem(me,JSON.stringify([Ce]))}catch(me){j([]),N([]),S(!1);const be=me instanceof Error?me.message:"Failed to create conversation";H({message:be,type:"conversation_creation_error"})}finally{A(!1)}}};N([]),S(!1),b(void 0),ce.current="",Q()},[e,n,N,S,A,j,b,M,E]);const fe=w.useCallback(async()=>{if(e)try{const re=await Ze.createConversation({agent_id:e.id});b(re),j([re,...le.getState().availableConversations]),N([]),S(!1),H(null),le.setState({conversationUsage:{total_tokens:0,message_count:0}}),ce.current="",n("clear");const Q=`devui_convs_${e.id}`,me=[re,...a];localStorage.setItem(Q,JSON.stringify(me))}catch(re){const Q=re instanceof Error?re.message:"Failed to create conversation";H({message:Q,type:"conversation_creation_error"})}},[e,n,b,j,N,S]),ee=w.useCallback(async(re,Q)=>{if(Q&&(Q.preventDefault(),Q.stopPropagation()),!!confirm("Delete this conversation? This cannot be undone."))try{if(await Ze.deleteConversation(re)){const be=a.filter(Ce=>Ce.id!==re);if(j(be),r?.id===re)if(be.length>0){const Ce=be[0];b(Ce),N([]),S(!1)}else b(void 0),N([]),S(!1),le.setState({conversationUsage:{total_tokens:0,message_count:0}}),ce.current="";n("clear")}}catch{alert("Failed to delete conversation. Please try again.")}},[a,r,n,j,b,N,S]),ie=w.useCallback(async()=>{if(q||!e)return;X(!0);const re=le.getState().addToast,Q=le.getState().updateAgent;try{await Ze.reloadEntity(e.id);const me=await Ze.getAgentInfo(e.id);Q(me),re({message:`${e.name} has been reloaded successfully`,type:"success"})}catch(me){const be=me instanceof Error?me.message:"Failed to reload entity";re({message:`Failed to reload: ${be}`,type:"error",duration:6e3})}finally{X(!1)}},[q,e]),ge=w.useCallback(async re=>{const Q=a.find(me=>me.id===re);if(Q){b(Q),n("clear");try{let me=[],be=!0,Ce,we=[];for(;be;){const Se=await Ze.listConversationItems(re,{order:"asc",after:Ce});me=me.concat(Se.data),be=Se.has_more,Se.metadata?.traces&&Se.metadata.traces.length>0&&(we=Se.metadata.traces),be&&Se.data.length>0&&(Ce=Se.data[Se.data.length-1].id)}const Me=me;if(N(Me),S(!1),we.length>0)for(const Se of we)n({type:"response.trace.completed",data:Se,sequence_number:0});le.setState({conversationUsage:{total_tokens:0,message_count:Me.length}});const je=ba(re);if(je?.accumulatedText){ce.current=je.accumulatedText;const Se={id:`assistant-${Date.now()}`,type:"message",role:"assistant",content:[{type:"output_text",text:je.accumulatedText}],status:"in_progress"};N([...Me,Se]),S(!0)}setTimeout(()=>{Y.current?.scrollIntoView({behavior:"smooth"})},100)}catch{console.debug(`No items found for conversation ${re}, starting with empty chat`),N([]),S(!1),le.setState({conversationUsage:{total_tokens:0,message_count:0}})}ce.current=""}},[a,n,b,N,S]),Ee=async(re,Q)=>{const me=g.find(Se=>Se.request_id===re);if(!me)return;const be=Math.floor(Date.now()/1e3),Ce={id:`user-approval-${Date.now()}`,type:"message",role:"user",content:[{type:"function_approval_request",request_id:re,status:Q?"approved":"rejected",function_call:me.function_call}],status:"completed",created_at:be},we=le.getState().chatItems;N([...we,Ce]);const je={input:[{type:"message",role:"user",content:[{type:"function_approval_response",request_id:re,approved:Q,function_call:me.function_call}]}],conversation_id:r?.id};return M(le.getState().pendingApprovals.filter(Se=>Se.request_id!==re)),je},Ne=w.useCallback(async re=>{if(!e)return;const Q=re.input.some(we=>we.type==="message"&&Array.isArray(we.content)&&we.content.some(Me=>Me.type==="function_approval_response")),me=[];for(const we of re.input)if(we.type==="message"&&Array.isArray(we.content)){for(const Me of we.content)if(Me.type==="input_text")me.push({type:"text",text:Me.text});else if(Me.type==="input_image")me.push({type:"input_image",image_url:Me.image_url||"",detail:"auto"});else if(Me.type==="input_file"){const je=Me;me.push({type:"input_file",file_data:je.file_data,filename:je.filename})}}const be=Math.floor(Date.now()/1e3);if(!Q&&me.length>0){const we={id:`user-${Date.now()}`,type:"message",role:"user",content:me,status:"completed",created_at:be};N([...le.getState().chatItems,we])}S(!0);const Ce={id:`assistant-${Date.now()}`,type:"message",role:"assistant",content:[],status:"in_progress",created_at:be};N([...le.getState().chatItems,Ce]);try{let we=r;if(!we)try{we=await Ze.createConversation({agent_id:e.id}),b(we),j([we,...le.getState().availableConversations]),H(null)}catch(Be){const _e=Be instanceof Error?Be.message:"Failed to create conversation";H({message:_e,type:"conversation_creation_error"}),_(!1),S(!1);return}we?.id&&Ze.clearStreamingState(we.id);const Me={input:re.input,conversation_id:we?.id};ce.current="";const je=B(),Se=Ze.streamAgentExecutionOpenAI(e.id,Me,je);for await(const Be of Se){if(n(Be),Be.type==="response.completed"){const xe=Be.response?.usage;xe&&(V.current={input_tokens:xe.input_tokens,output_tokens:xe.output_tokens,total_tokens:xe.total_tokens});continue}if(Be.type==="response.failed"){const xe=Be.response?.error;let $e="Request failed";xe&&(typeof xe=="object"&&"message"in xe?($e=xe.message,"code"in xe&&xe.code&&($e+=` (Code: ${xe.code})`)):typeof xe=="string"&&($e=xe));const Ge=le.getState().chatItems;N(Ge.map(qt=>qt.id===Ce.id&&qt.type==="message"?{...qt,content:[{type:"text",text:ce.current||$e}],status:"incomplete"}:qt)),S(!1);return}if(Be.type==="response.function_approval.requested"){const _e=Be;M([...le.getState().pendingApprovals,{request_id:_e.request_id,function_call:_e.function_call}]);const xe=le.getState().chatItems;N(xe.map($e=>$e.id===Ce.id&&$e.type==="message"?{...$e,content:[...$e.content,{type:"function_approval_request",request_id:_e.request_id,status:"pending",function_call:_e.function_call}],status:"in_progress"}:$e));continue}if(Be.type==="response.function_call_arguments.delta"){const _e=Be,xe=le.getState().chatItems;N(xe.map($e=>$e.type==="function_call"&&$e.call_id===_e.item_id?{...$e,arguments:($e.arguments||"")+(_e.delta||"")}:$e));continue}if(Be.type==="response.function_result.complete"){const _e=Be,xe={id:`result-${Date.now()}`,type:"function_call_output",call_id:_e.call_id,output:_e.output,status:_e.status==="completed"?"completed":"incomplete",created_at:Math.floor(Date.now()/1e3)},$e=le.getState().chatItems;N([...$e,xe]);continue}if(Be.type==="error"){const xe=Be.message||"An error occurred",$e=le.getState().chatItems;N($e.map(Ge=>Ge.id===Ce.id&&Ge.type==="message"?{...Ge,content:[{type:"text",text:xe}],status:"incomplete"}:Ge)),S(!1);return}if(Be.type==="response.output_item.added"){const xe=Be.item;if(xe.type==="function_call"){const Ge=xe,qt={id:Ge.id||`call-${Date.now()}`,type:"function_call",name:Ge.name,arguments:Ge.arguments||"",call_id:Ge.call_id,status:Ge.status||"in_progress",created_at:Math.floor(Date.now()/1e3)},rn=le.getState().chatItems;N([...rn,qt]);continue}const $e=le.getState().chatItems;N($e.map(Ge=>{if(Ge.id===Ce.id&&Ge.type==="message"){const qt=Ge.content;let rn=null;if(xe.type==="output_image"?rn={type:"output_image",image_url:xe.image_url,alt_text:xe.alt_text,mime_type:xe.mime_type}:xe.type==="output_file"?rn={type:"output_file",filename:xe.filename,file_url:xe.file_url,file_data:xe.file_data,mime_type:xe.mime_type}:xe.type==="output_data"&&(rn={type:"output_data",data:xe.data,mime_type:xe.mime_type,description:xe.description}),rn)return{...Ge,content:[...qt,rn],status:"in_progress"}}return Ge}));continue}if(Be.type==="response.output_text.delta"&&"delta"in Be&&Be.delta){ce.current+=Be.delta;const _e=le.getState().chatItems;N(_e.map(xe=>{if(xe.id===Ce.id&&xe.type==="message"){const $e=xe.content.filter(Ge=>Ge.type!=="text");return{...xe,content:[...$e,{type:"text",text:ce.current}],status:"in_progress"}}return xe}))}}const Ke=V.current,tt=le.getState().chatItems;N(tt.map(Be=>Be.id===Ce.id&&Be.type==="message"?{...Be,status:"completed",usage:Ke||void 0}:Be)),S(!1),Ke&&E(Ke.total_tokens),V.current=null}catch(we){if(Gu(we)){G(!0);const Me=le.getState().chatItems;N(Me.map(je=>je.id===Ce.id&&je.type==="message"?{...je,status:ce.current?"completed":"incomplete",content:je.content}:je))}else{const Me=le.getState().chatItems;N(Me.map(je=>je.id===Ce.id&&je.type==="message"?{...je,content:[{type:"text",text:`Error: ${we instanceof Error?we.message:"Failed to get response"}`}],status:"incomplete"}:je))}S(!1),R()}},[e,r,n,N,S,b,j,M,E,B,R]),ve=w.useCallback(async re=>{if(!e)return;const Q=re.input.some(Ce=>Ce.type==="message"&&Array.isArray(Ce.content)&&Ce.content.some(we=>we.type==="function_approval_response")),me=[];for(const Ce of re.input)if(Ce.type==="message"&&Array.isArray(Ce.content)){for(const we of Ce.content)if(we.type==="input_text")me.push({type:"text",text:we.text});else if(we.type==="input_image")me.push({type:"input_image",image_url:we.image_url||"",detail:"auto"});else if(we.type==="input_file"){const Me=we;me.push({type:"input_file",file_data:Me.file_data,filename:Me.filename})}}const be=Math.floor(Date.now()/1e3);if(!Q&&me.length>0){const Ce={id:`user-${Date.now()}`,type:"message",role:"user",content:me,status:"completed",created_at:be};N([...le.getState().chatItems,Ce])}_(!0);try{let Ce=r;if(!Ce)try{Ce=await Ze.createConversation({agent_id:e.id}),b(Ce),j([Ce,...le.getState().availableConversations]),H(null)}catch(_e){const xe=_e instanceof Error?_e.message:"Failed to create conversation";H({message:xe,type:"conversation_creation_error"}),_(!1);return}const we=await Ze.runAgentSync(e.id,{input:re.input,conversation_id:Ce?.id}),Me=[],je=[],Se=[];if(we.output){for(const _e of we.output)if(_e.type==="message"){const xe=_e;if(xe.content)for(const $e of xe.content)$e.type==="output_text"?Me.push({type:"text",text:$e.text}):($e.type==="output_image"||$e.type==="output_file"||$e.type==="output_data")&&Me.push($e)}else if(_e.type==="function_call"){const xe=_e;je.push({id:xe.id||`call-${Date.now()}`,type:"function_call",name:xe.name,arguments:xe.arguments||"",call_id:xe.call_id,status:xe.status||"completed",created_at:be})}else if(_e.type==="function_call_output"){const xe=_e;Se.push({id:`result-${Date.now()}`,type:"function_call_output",call_id:xe.call_id,output:xe.output,status:"completed",created_at:be})}}const Ke={id:`assistant-${Date.now()}`,type:"message",role:"assistant",content:Me,status:"completed",created_at:be,usage:we.usage?{input_tokens:we.usage.input_tokens,output_tokens:we.usage.output_tokens,total_tokens:we.usage.total_tokens}:void 0},Be=[...le.getState().chatItems,Ke,...je,...Se];N(Be),we.usage&&E(we.usage.total_tokens),n({type:"response.completed",response:we,sequence_number:0})}catch(Ce){const we=Ce instanceof Error?Ce.message:"Failed to get response",Me={id:`assistant-${Date.now()}`,type:"message",role:"assistant",content:[{type:"text",text:`Error: ${we}`}],status:"incomplete",created_at:be},je=le.getState().chatItems;N([...je,Me])}finally{_(!1)}},[e,r,n,N,b,j,E,_]),ze=async re=>{if(!(!e||re.length===0)){J.current=!0,G(!1),_(!0);try{const me={input:[{type:"message",role:"user",content:re}],conversation_id:r?.id};y?await Ne(me):await ve(me)}finally{_(!1)}}};return o.jsxs("div",{className:"flex h-[calc(100vh-3.5rem)] flex-col relative",...C,children:[L&&o.jsx("div",{className:"absolute inset-0 z-50 bg-blue-50/95 dark:bg-blue-950/95 backdrop-blur-sm flex items-center justify-center border-2 border-dashed border-blue-400 dark:border-blue-500 rounded-lg m-2",children:o.jsxs("div",{className:"text-center p-8",children:[o.jsx("div",{className:"text-blue-600 dark:text-blue-400 text-lg font-medium mb-2",children:"Drop files here"}),o.jsx("div",{className:"text-blue-500/80 dark:text-blue-400/70 text-sm",children:"Images, PDFs, audio, and other files"})]})}),o.jsxs("div",{className:"border-b pb-2  p-4 flex-shrink-0",children:[o.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center lg:justify-between gap-3 mb-3",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("h2",{className:"font-semibold text-sm truncate",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Vs,{className:"h-4 w-4 flex-shrink-0"}),o.jsx("span",{className:"truncate",children:x.enabled?`Chat with ${x.model}`:`Chat with ${e.name||e.id}`})]})}),!x.enabled&&m==="developer"&&o.jsxs(o.Fragment,{children:[o.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>D(!0),className:"h-6 w-6 p-0 flex-shrink-0",title:"View agent details",children:o.jsx(Fs,{className:"h-4 w-4"})}),e.source!=="in_memory"&&o.jsx(Le,{variant:"ghost",size:"sm",onClick:ie,disabled:q,className:"h-6 w-6 p-0 flex-shrink-0",title:q?"Reloading...":"Reload entity code (hot reload)",children:o.jsx(ng,{className:`h-4 w-4 ${q?"animate-spin":""}`})})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2 flex-shrink-0",children:[o.jsxs(vg,{value:r?.id||"",onValueChange:ge,disabled:f||d,children:[o.jsx(wg,{className:"w-full sm:w-64",children:o.jsx(bg,{placeholder:f?"Loading...":a.length===0?"No conversations":r?`Conversation ${r.id.slice(-8)}`:"Select conversation",children:r&&o.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[o.jsxs("span",{children:["Conversation ",r.id.slice(-8)]}),h.total_tokens>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsxs("span",{className:"text-muted-foreground",children:[h.total_tokens>=1e3?`${(h.total_tokens/1e3).toFixed(1)}k`:h.total_tokens," ","tokens"]})]})]})})}),o.jsx(Ng,{children:a.map(re=>o.jsx(jg,{value:re.id,children:o.jsxs("div",{className:"flex items-center justify-between w-full",children:[o.jsxs("span",{children:["Conversation ",re.id.slice(-8)]}),re.created_at&&o.jsx("span",{className:"text-xs text-muted-foreground ml-3",children:new Date(re.created_at*1e3).toLocaleDateString()})]})},re.id))})]}),o.jsx(Le,{variant:"outline",size:"icon",onClick:()=>r&&ee(r.id),disabled:!r||d,title:r?`Delete Conversation ${r.id.slice(-8)}`:"No conversation selected",children:o.jsx(rg,{className:"h-4 w-4"})}),o.jsxs(Le,{variant:"outline",size:"lg",onClick:fe,disabled:!e||d,className:"whitespace-nowrap ",children:[o.jsx(tg,{className:"h-4 w-4 mr-2"}),o.jsx("span",{className:"hidden md:inline",children:" New Conversation"})]})]})]}),x.enabled?o.jsx("p",{className:"text-sm text-muted-foreground",children:"Using OpenAI model directly. Local agent tools and instructions are not applied."}):e.description&&o.jsx("p",{className:"text-sm text-muted-foreground",children:e.description})]}),z&&o.jsxs("div",{className:"mx-4 mt-2 p-3 bg-destructive/10 border border-destructive/30 rounded-md flex items-start gap-2",children:[o.jsx(hs,{className:"h-4 w-4 text-destructive mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-sm font-medium text-destructive",children:"Failed to Create Conversation"}),o.jsx("div",{className:"text-xs text-destructive/90 mt-1 break-words",children:z.message}),z.code&&o.jsxs("div",{className:"text-xs text-destructive/70 mt-1",children:["Error Code: ",z.code]})]}),o.jsx("button",{onClick:()=>H(null),className:"text-destructive hover:text-destructive/80 flex-shrink-0",title:"Dismiss error",children:o.jsx(Ea,{className:"h-4 w-4"})})]}),o.jsx(Wn,{className:"flex-1 p-4 h-0",ref:$,children:o.jsxs("div",{className:"space-y-4",children:[l.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-center",children:[o.jsxs("div",{className:"text-muted-foreground text-sm",children:["Start a conversation with"," ",e.name||e.id]}),o.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Type a message below to begin"})]}):(()=>{const re=[],Q=new Map,me=new Map;let be=null;const Ce=[],we=[];for(let Me=0;Me<l.length;Me++){const je=l[Me];if(je.type==="message"&&je.role==="assistant"){if(Q.has(je.id)||(Q.set(je.id,[]),me.set(je.id,[])),Ce.length>0){const Se=Q.get(je.id)||[];Se.push(...Ce),Q.set(je.id,Se),Ce.length=0}if(we.length>0){const Se=me.get(je.id)||[];Se.push(...we),me.set(je.id,Se),we.length=0}be=je.id}else if(je.type==="function_call")if(be){const Se=Q.get(be)||[];Se.push(je),Q.set(be,Se)}else Ce.push(je);else if(je.type==="function_call_output")if(be){const Se=me.get(be)||[];Se.push(je),me.set(be,Se)}else we.push(je);else je.type==="message"&&je.role==="user"&&(be=null)}for(const Me of l)if(Me.type==="message"){const je=Q.get(Me.id)||[],Se=me.get(Me.id)||[];re.push(o.jsx(u6,{item:Me,toolCalls:je,toolResults:Se},Me.id))}return re})(),W&&!c&&o.jsx("div",{className:"px-4 py-2",children:o.jsx("div",{className:"border rounded-lg border-orange-500/40 bg-orange-500/5 dark:bg-orange-500/10",children:o.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",children:[o.jsx(vd,{className:"w-4 h-4 text-orange-500 dark:text-orange-400 fill-current"}),o.jsx("span",{className:"font-medium text-sm text-orange-700 dark:text-orange-300",children:"Response stopped by user"})]})})}),o.jsx("div",{ref:Y})]})}),g.length>0&&o.jsx("div",{className:"border-t bg-amber-50 dark:bg-amber-950/20 p-4 flex-shrink-0",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(hs,{className:"h-5 w-5 text-amber-600 dark:text-amber-500 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h4",{className:"font-medium text-sm mb-2",children:"Approval Required"}),o.jsx("div",{className:"space-y-2",children:g.map(re=>o.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg p-3 border border-amber-200 dark:border-amber-900",children:[o.jsxs("div",{className:"font-mono text-xs mb-3 break-all",children:[o.jsx("span",{className:"text-blue-600 dark:text-blue-400 font-semibold",children:re.function_call.name}),o.jsx("span",{className:"text-gray-500",children:"("}),o.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:JSON.stringify(re.function_call.arguments)}),o.jsx("span",{className:"text-gray-500",children:")"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(Le,{size:"sm",onClick:async()=>{const Q=await Ee(re.request_id,!0);Q&&await Ne(Q)},variant:"default",className:"flex-1 sm:flex-none",children:[o.jsx(jo,{className:"h-4 w-4 mr-1"}),"Approve"]}),o.jsxs(Le,{size:"sm",onClick:async()=>{const Q=await Ee(re.request_id,!1);Q&&await Ne(Q)},variant:"outline",className:"flex-1 sm:flex-none",children:[o.jsx(Ea,{className:"h-4 w-4 mr-1"}),"Reject"]})]})]},re.request_id))})]})]})}),o.jsx("div",{className:"border-t flex-shrink-0",children:o.jsx("div",{className:"p-4",children:o.jsx(xg,{onSubmit:ze,isSubmitting:d,isStreaming:c,onCancel:U,isCancelling:ne,placeholder:`Message ${e.name||e.id}... (Shift+Enter for new line)`,showFileUpload:!0,entityName:e.name||e.id,disabled:!e,externalFiles:I,onExternalFilesProcessed:P})})}),o.jsx(c6,{agent:e,open:T,onOpenChange:D})]})}function fb({message:e="Loading...",description:n,size:r="md",className:a,fullPage:l=!1}){const c=o.jsxs("div",{className:We("flex flex-col items-center justify-center gap-3",l?"min-h-[50vh]":"py-8",a),children:[o.jsx(Vu,{size:r,className:"text-muted-foreground"}),o.jsxs("div",{className:"text-center space-y-1",children:[o.jsx("p",{className:We("font-medium text-muted-foreground",r==="sm"&&"text-sm",r==="lg"&&"text-lg"),children:e}),n&&o.jsx("p",{className:"text-sm text-muted-foreground/80",children:n})]})]});return l?o.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:c}):c}function f6(e){return["name","title","id","key","label","type","status","tag","category","code","username","password","email"].includes(e.toLowerCase())}function m6(e){if(e.type)return e;if(e.anyOf&&e.anyOf.length>0){const n=e.anyOf.filter(r=>r.type!=="null"&&r.type!==void 0);if(n.length>0)return{...n[0],default:e.default??n[0].default,description:e.description??n[0].description,title:e.title??n[0].title}}if(e.oneOf&&e.oneOf.length>0){const n=e.oneOf.filter(r=>r.type!=="null"&&r.type!==void 0);if(n.length>0)return{...n[0],default:e.default??n[0].default,description:e.description??n[0].description,title:e.title??n[0].title}}return e}function J2(e,n){return n.format==="textarea"||!!n.description&&n.description.length>100||n.type==="string"&&!n.enum&&!f6(e)}function h6(e,n){const r=J2(e,n),a=!!n.description&&n.description.length>150;return r||a?"md:col-span-2 lg:col-span-3 xl:col-span-4":n.type==="array"||n.description&&n.description.length>80?"xl:col-span-2":""}function ej(e,n){if(e.type!=="object"||!e.properties)return!1;const r=e.properties,a=Object.keys(r).filter(l=>!n.includes(l));return n.includes("role")&&a.some(l=>["text","message","content"].includes(l))&&r.role?.type==="string"}function Eh({name:e,schema:n,value:r,onChange:a,isRequired:l=!1,isReadOnly:c=!1}){const d=m6(n),{type:f,description:m,enum:h,default:g}=d,x=J2(e,d),y=()=>{if(c)return o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:e,className:"text-muted-foreground",children:e}),o.jsx("div",{className:"text-sm p-2 bg-muted rounded border",children:typeof r=="object"?JSON.stringify(r,null,2):String(r)}),m&&o.jsx("p",{className:"text-xs text-muted-foreground",children:m})]});switch(f){case"string":return h?o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:e,children:[e,l&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),o.jsxs(vg,{value:typeof r=="string"&&r?r:typeof g=="string"?g:h[0],onValueChange:b=>a(b),children:[o.jsx(wg,{children:o.jsx(bg,{placeholder:`Select ${e}`})}),o.jsx(Ng,{children:h.map(b=>o.jsx(jg,{value:b,children:b},b))})]}),m&&o.jsx("p",{className:"text-sm text-muted-foreground",children:m})]}):x?o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:e,children:[e,l&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),o.jsx(tl,{id:e,value:typeof r=="string"?r:"",onChange:b=>a(b.target.value),placeholder:typeof g=="string"?g:`Enter ${e}`,rows:4,className:"min-w-[300px] w-full"}),m&&o.jsx("p",{className:"text-sm text-muted-foreground",children:m})]}):o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:e,children:[e,l&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),o.jsx(as,{id:e,type:"text",value:typeof r=="string"?r:"",onChange:b=>a(b.target.value),placeholder:typeof g=="string"?g:`Enter ${e}`}),m&&o.jsx("p",{className:"text-sm text-muted-foreground",children:m})]});case"integer":case"number":return o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:e,children:[e,l&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),o.jsx(as,{id:e,type:"number",step:f==="integer"?"1":"any",value:typeof r=="number"?r:"",onChange:b=>{const j=f==="integer"?parseInt(b.target.value):parseFloat(b.target.value);a(isNaN(j)?"":j)},placeholder:typeof g=="number"?g.toString():`Enter ${e}`}),m&&o.jsx("p",{className:"text-sm text-muted-foreground",children:m})]});case"boolean":return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(co,{id:e,checked:!!r,onCheckedChange:b=>a(b)}),o.jsxs(kt,{htmlFor:e,children:[e,l&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]})]}),m&&o.jsx("p",{className:"text-sm text-muted-foreground",children:m})]});case"array":return o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:e,children:[e,l&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),o.jsx(tl,{id:e,value:Array.isArray(r)?r.join(", "):typeof r=="string"?r:"",onChange:b=>{const j=b.target.value.split(",").map(N=>N.trim()).filter(N=>N.length>0);a(j)},placeholder:"Enter items separated by commas",rows:2}),m&&o.jsx("p",{className:"text-sm text-muted-foreground",children:m})]});case"object":default:return o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:e,children:[e,l&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),o.jsx(tl,{id:e,value:typeof r=="object"&&r!==null?JSON.stringify(r,null,2):typeof r=="string"?r:"",onChange:b=>{try{const j=JSON.parse(b.target.value);a(j)}catch{a(b.target.value)}},placeholder:'{"key": "value"}',rows:3,className:"font-mono text-xs"}),m&&o.jsx("p",{className:"text-sm text-muted-foreground",children:m})]})}};return o.jsx("div",{className:h6(e,d),children:y()})}function cp({schema:e,values:n,onChange:r,disabled:a=!1,readOnlyFields:l=[],hideFields:c=[],showCollapsedByDefault:d=!1,layout:f="stack"}){const[m,h]=w.useState(d),g=f==="grid"?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-3",x=e.properties||{},y=Object.keys(x).filter(X=>!c.includes(X)),b=(e.required||[]).filter(X=>!c.includes(X)),j=ej(e,b),N=y.filter(X=>b.includes(X)&&!(j&&X==="role")),S=y.filter(X=>!b.includes(X)),_=j?[...S].sort((X,W)=>{const G=ne=>["text","message","content"].includes(ne)?1:0;return G(W)-G(X)}):S,E=Math.max(0,(j?1:6)-N.length),M=_.slice(0,E),T=_.slice(E),D=T.length>0,z=N.length>0,H=(X,W)=>{r({...n,[X]:W})},q=f==="grid"?"md:col-span-2 lg:col-span-3 xl:col-span-4":"";return o.jsxs("div",{className:g,children:[N.map(X=>o.jsx(Eh,{name:X,schema:x[X],value:n[X],onChange:W=>H(X,W),isRequired:!0,isReadOnly:a||l.includes(X)},X)),z&&S.length>0&&o.jsx("div",{className:q,children:o.jsx("div",{className:"border-t border-border"})}),M.map(X=>o.jsx(Eh,{name:X,schema:x[X],value:n[X],onChange:W=>H(X,W),isRequired:!1,isReadOnly:a||l.includes(X)},X)),D&&o.jsx("div",{className:q,children:o.jsx(Le,{type:"button",variant:"ghost",size:"sm",onClick:()=>h(!m),className:"w-full justify-center gap-2",disabled:a,children:m?o.jsxs(o.Fragment,{children:[o.jsx(rN,{className:"h-4 w-4"}),"Hide ",T.length," optional field",T.length!==1?"s":""]}):o.jsxs(o.Fragment,{children:[o.jsx(Rt,{className:"h-4 w-4"}),"Show ",T.length," optional field",T.length!==1?"s":""]})})}),m&&T.map(X=>o.jsx(Eh,{name:X,schema:x[X],value:n[X],onChange:W=>H(X,W),isRequired:!1,isReadOnly:a||l.includes(X)},X))]})}function tj(e,n){return(e.required||[]).every(a=>{const l=n[a];return l!==void 0&&l!==""&&l!==null})}function p6(e,n){const r=e.required||[],a={};return Object.keys(n).forEach(l=>{const c=n[l];(r.includes(l)||c!==void 0&&c!==""&&c!==null)&&(a[l]=c)}),a}function g6({inputSchema:e,inputTypeName:n,onSubmit:r,isSubmitting:a=!1,className:l}){const[c,d]=w.useState(!1),f=l?.includes("embedded"),[m,h]=w.useState({}),[g,x]=w.useState(!1),y=e.properties||{},b=Object.keys(y),j=e.required||[],N=e.type==="string"&&!e.enum,S=ej(e,j),_=N?m.value!==void 0&&m.value!=="":j.length>0?j.every(T=>S&&T==="role"&&m.role==="user"?!0:m[T]!==void 0&&m[T]!==""):Object.keys(m).length>0;w.useEffect(()=>{if(e.type==="string")h({value:e.default||""});else if(e.type==="object"&&e.properties){const T={};Object.entries(e.properties).forEach(([D,z])=>{z.default!==void 0?T[D]=z.default:z.enum&&z.enum.length>0&&(T[D]=z.enum[0])}),S&&!T.role&&(T.role="user"),h(T)}},[e,S]);const A=T=>{if(T.preventDefault(),x(!0),e.type==="string")r({input:m.value||""});else if(e.type==="object"){const D=e.properties||{},z=Object.keys(D);if(z.length===1){const H=z[0];r({[H]:m[H]||""})}else{const H=p6(e,m);r(H)}}else r(m);f||d(!1),x(!1)},E=T=>{h(T)},M=()=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"simple-input",children:"Input"}),o.jsx(tl,{id:"simple-input",value:typeof m.value=="string"?m.value:"",onChange:T=>h({value:T.target.value}),placeholder:typeof e.default=="string"?e.default:"Enter input",rows:4,className:"min-w-[300px] w-full"}),e.description&&o.jsx("p",{className:"text-sm text-muted-foreground",children:e.description})]});return f?o.jsxs("form",{onSubmit:A,className:l,children:[N&&M(),!N&&o.jsx(cp,{schema:e,values:m,onChange:E,disabled:g,hideFields:S?["role"]:[],layout:"grid"}),o.jsx("div",{className:"flex gap-2 mt-4 justify-end",children:o.jsxs(Le,{type:"submit",disabled:g||!_,size:"default",children:[o.jsx(el,{className:"h-4 w-4"}),g?"Running...":"Run Workflow"]})})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:We("flex flex-col",l),children:[o.jsxs("div",{className:"border-b border-border px-4 py-3 bg-muted",children:[o.jsx(N2,{className:"text-sm mb-3",children:"Run Workflow"}),o.jsxs(Le,{onClick:()=>d(!0),disabled:a,className:"w-full",size:"default",children:[o.jsx(el,{className:"h-4 w-4 mr-2"}),a?"Running...":"Run Workflow"]})]}),o.jsxs("div",{className:"px-4 py-3",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:[o.jsx("strong",{children:"Input Type:"})," ",o.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:n}),e.type==="object"&&e.properties&&o.jsxs("span",{className:"ml-2",children:["(",Object.keys(e.properties).length," field",Object.keys(e.properties).length!==1?"s":"",")"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:'Click "Run Workflow" to configure inputs and execute'})]})]}),o.jsx(Ir,{open:c,onOpenChange:d,children:o.jsxs(Lr,{className:"w-full max-w-md sm:max-w-lg md:max-w-2xl lg:max-w-4xl xl:max-w-5xl max-h-[90vh] flex flex-col",children:[o.jsxs($r,{children:[o.jsx(Pr,{children:"Run Workflow"}),o.jsx(So,{onClose:()=>d(!1)})]}),o.jsx("div",{className:"px-8 py-4 border-b flex-shrink-0",children:o.jsx("div",{className:"text-sm text-muted-foreground",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"font-medium",children:"Input Type:"}),o.jsx("code",{className:"bg-muted px-3 py-1 text-xs font-mono",children:n}),e.type==="object"&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[b.length," field",b.length!==1?"s":""]})]})})}),o.jsx("div",{className:"px-8 py-6 overflow-y-auto flex-1 min-h-0",children:o.jsxs("form",{id:"workflow-modal-form",onSubmit:A,children:[N&&M(),!N&&o.jsx(cp,{schema:e,values:m,onChange:E,disabled:g,hideFields:S?["role"]:[],layout:"grid"})]})}),o.jsx("div",{className:"px-8 py-4 border-t flex-shrink-0",children:o.jsxs(zR,{children:[o.jsx(Le,{variant:"outline",onClick:()=>d(!1),disabled:g,children:"Cancel"}),o.jsxs(Le,{type:"submit",form:"workflow-modal-form",disabled:g||!_,children:[o.jsx(el,{className:"h-4 w-4 mr-2"}),g?"Running...":"Run Workflow"]})]})})]})})]})}function x6(e,n,r="LR"){if(e.length===0)return e;if(e.length===1)return e.map(j=>({...j,position:{x:0,y:0}}));const a=new Map,l=new Map;e.forEach(j=>{a.set(j.id,[]),l.set(j.id,[])}),n.forEach(j=>{a.get(j.source)?.push(j.target),l.get(j.target)?.push(j.source)});const c=e.filter(j=>(l.get(j.id)||[]).length===0);c.length===0&&c.push(e[0]);const d=220,f=120,m=r==="LR"?350:280,h=r==="TB"?250:180,g=new Map,x=new Map,y=[],b=new Set;for(c.forEach(j=>{y.push({nodeId:j.id,level:0})});y.length>0;){const{nodeId:j,level:N}=y.shift();if(b.has(j))continue;b.add(j),x.has(N)||x.set(N,[]),x.get(N).push(j),(a.get(j)||[]).forEach(_=>{b.has(_)||y.push({nodeId:_,level:N+1})})}return e.forEach(j=>{if(!b.has(j.id)){const S=Math.max(...Array.from(x.keys()),-1)+1;x.has(S)||x.set(S,[]),x.get(S).push(j.id)}}),x.forEach((j,N)=>{const S=j.length;j.forEach((_,A)=>{let E,M;r==="LR"?(E=N*m,M=-((S-1)*h)/2+A*h):(M=N*h,E=-((S-1)*m)/2+A*m),g.set(_,{x:E,y:M,level:N})})}),e.map(j=>{const N=g.get(j.id)||{x:0,y:0};return{...j,position:{x:N.x-d/2,y:N.y-f/2}}})}function y6(e){if(typeof e!="object"||e===null)return!1;const n=e;return"id"in n&&"edge_groups"in n&&"executors"in n&&"start_executor_id"in n&&"max_iterations"in n&&typeof n.id=="string"&&Array.isArray(n.edge_groups)&&typeof n.executors=="object"&&typeof n.start_executor_id=="string"&&typeof n.max_iterations=="number"}function nj(e){return y6(e)?e:null}function sj(e){if(!e||e.type!=="object"||!e.properties)return!1;const n=e.properties,r="text"in n&&n.text?.type==="string",a="role"in n&&n.role?.type==="string";return!!(r&&a||Object.keys(n).length===1&&r)}function Cu(e,n=50,r="..."){return e.length<=n?e:e.substring(0,n)+r}function up(e,n,r){if(!e)return console.warn("convertWorkflowDumpToNodes: workflowDump is undefined"),[];const a=nj(e);let l,c;return a?(l=Object.values(a.executors).map(f=>({id:f.id,type:f.type,name:f.name||f.id,description:f.description,config:f.config})),c=a.start_executor_id):(l=rj(e),c=e?.start_executor_id),!l||!Array.isArray(l)||l.length===0?(console.warn("No executors found in workflow dump. Available keys:",Object.keys(e)),[]):l.map(f=>({id:f.id,type:"executor",position:{x:0,y:0},data:{executorId:f.id,executorType:f.type,name:f.name||f.id,state:"pending",isStartNode:f.id===c,layoutDirection:r||"LR",onNodeClick:n}}))}function dp(e){if(!e)return console.warn("convertWorkflowDumpToEdges: workflowDump is undefined"),[];const n=nj(e);let r;return n?(r=[],n.edge_groups.forEach(l=>{l.edges.forEach(c=>{r.push({source:c.source_id,target:c.target_id,condition:c.condition_name})})})):r=oj(e),!r||!Array.isArray(r)||r.length===0?(console.warn("No connections found in workflow dump. Available keys:",Object.keys(e)),[]):r.map(l=>{const c=l.source===l.target;return{id:`${l.source}-${l.target}`,source:l.source,target:l.target,sourceHandle:"source",targetHandle:"target",type:c?"selfLoop":"default",animated:!1,style:{stroke:"#6b7280",strokeWidth:2}}})}function rj(e){if(e.executors&&typeof e.executors=="object"&&!Array.isArray(e.executors)){const a=e.executors;return Object.entries(a).map(([l,c])=>({id:l,type:c.type_||c.type||"executor",name:c.name||l,description:c.description,config:c.config}))}const n=["executors","agents","steps","nodes"];for(const a of n)if(e[a]&&Array.isArray(e[a]))return e[a];if(e.config&&typeof e.config=="object")return rj(e.config);const r=[];return Object.entries(e).forEach(([a,l])=>{if(typeof l=="object"&&l!==null&&("type"in l||"type_"in l)){const c=l;r.push({id:a,type:c.type_||c.type||"executor",name:c.name||a,description:c.description,config:c.config})}}),r}function oj(e){if(e.edge_groups&&Array.isArray(e.edge_groups)){const r=[];return e.edge_groups.forEach(a=>{if(typeof a=="object"&&a!==null&&"edges"in a){const l=a.edges;Array.isArray(l)&&l.forEach(c=>{if(typeof c=="object"&&c!==null&&"source_id"in c&&"target_id"in c){const d=c;r.push({source:d.source_id,target:d.target_id,condition:d.condition_name||void 0})}})}}),r}const n=["connections","edges","transitions","links"];for(const r of n)if(e[r]&&Array.isArray(e[r]))return e[r];return e.config&&typeof e.config=="object"?oj(e.config):[]}function fp(e,n,r="LR"){return x6(e,n,r)}function v6(e,n){const r={};let a=!1;const l={};return e.forEach(c=>{if(c.type==="response.output_item.added"||c.type==="response.output_item.done"){const f=c.item;if(f&&f.type==="executor_action"&&"executor_id"in f){const m=f.executor_id,h=f.id;if(c.type==="response.output_item.added"&&(l[m]=h),!(l[m]===h)&&c.type==="response.output_item.done")return;let x="pending",y;c.type==="response.output_item.added"?x="running":c.type==="response.output_item.done"&&(f.status==="completed"?x="completed":f.status==="failed"?(x="failed",y=f.error?typeof f.error=="string"?f.error:JSON.stringify(f.error):"Execution failed"):f.status==="cancelled"&&(x="cancelled")),r[m]={nodeId:m,state:x,data:f.result,error:y,timestamp:new Date().toISOString()}}}else if(c.type==="response.created"||c.type==="response.in_progress")a=!0;else if(c.type==="response.workflow_event.completed"&&"data"in c&&c.data){const f=c.data,m=f.executor_id,h=f.event_type,g=f.data;let x="pending",y;h==="ExecutorInvokedEvent"?x="running":h==="ExecutorCompletedEvent"?x="completed":h?.includes("Error")||h?.includes("Failed")?(x="failed",y=typeof g=="string"?g:"Execution failed"):h?.includes("Cancel")?x="cancelled":h==="WorkflowCompletedEvent"||h==="WorkflowOutputEvent"?x="completed":h==="WorkflowStartedEvent"&&(a=!0),m&&(r[m]={nodeId:m,state:x,data:g,error:y,timestamp:new Date().toISOString()})}}),a&&n&&!r[n]&&(e.some(d=>{if(d.type==="response.output_item.done"){const m=d.item;return m&&m.type==="executor_action"&&"executor_id"in m&&m.executor_id===n}if(d.type==="response.workflow_event.completed"&&"data"in d&&d.data){const f=d.data;return f.executor_id===n&&(f.event_type==="ExecutorCompletedEvent"||f.event_type==="ExecutorFailedEvent"||typeof f.event_type=="string"&&f.event_type.includes("Error")||typeof f.event_type=="string"&&f.event_type.includes("Failed"))}return!1})||(r[n]={nodeId:n,state:"running",data:void 0,error:void 0,timestamp:new Date().toISOString()})),r}function b6(e,n,r=!0){return e.map(a=>{const l=n[a.id];return l?{...a,data:{...a.data,state:l.state,outputData:l.data,error:l.error,isStreaming:r,layoutDirection:a.data.layoutDirection}}:a})}function w6(e){const n={};return e.forEach(a=>{if(a.type==="response.output_item.added"||a.type==="response.output_item.done"){const c=a.item;if(c&&c.type==="executor_action"&&"executor_id"in c){const d=c.executor_id;n[d]={lastEvent:a.type==="response.output_item.added"?"ExecutorInvokedEvent":"ExecutorCompletedEvent",timestamp:new Date().toISOString()}}}else if(a.type==="response.workflow_event.completed"&&"data"in a&&a.data){const c=a.data,d=c.executor_id,f=c.event_type;d&&(f==="ExecutorInvokedEvent"||f==="ExecutorCompletedEvent")&&(n[d]={lastEvent:f,timestamp:new Date().toISOString()})}}),Object.entries(n).filter(([,a])=>a.lastEvent==="ExecutorInvokedEvent").map(([a])=>a)}function N6(e,n){const r=w6(n),a={};return n.forEach(l=>{if(l.type==="response.workflow_event.completed"&&"data"in l&&l.data){const d=l.data,f=d.executor_id,m=d.event_type;f&&m&&(a[f]||(a[f]={completed:!1,invoked:!1}),m==="ExecutorInvokedEvent"?a[f].invoked=!0:m==="ExecutorCompletedEvent"&&(a[f].completed=!0))}}),e.map(l=>{const c=a[l.source],d=a[l.target],f=r.includes(l.target);let m={...l.style},h=!1;return c?.completed&&f?(m={stroke:"#643FB2",strokeWidth:3,strokeDasharray:"5,5"},h=!0):c?.completed&&d?.completed?m={stroke:"#10b981",strokeWidth:2}:c?.completed&&d?.invoked?m={stroke:"#f59e0b",strokeWidth:2}:m={stroke:"#6b7280",strokeWidth:2},{...l,style:m,animated:h}})}function Ch(e){const n=new Map,r=new Set;return e.forEach(a=>{const l=`${a.source}-${a.target}`,c=`${a.target}-${a.source}`;if(a.source===a.target){n.set(l,a);return}if(n.has(c)){r.add(c),r.add(l);const d=n.get(c);n.set(c,{...d,markerStart:{type:"arrow",width:20,height:20},markerEnd:{type:"arrow",width:20,height:20},data:{...d.data,isBidirectional:!0}})}else r.has(l)||n.set(l,a)}),Array.from(n.values())}function aj({inputSchema:e,onRun:n,onCancel:r,isSubmitting:a,isCancelling:l=!1,workflowState:c,checkpoints:d=[],showCheckpoints:f=!0}){const[m,h]=w.useState(!1);w.useEffect(()=>{const T=D=>{D.key==="Escape"&&m&&h(!1)};if(m)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[m]);const g=w.useMemo(()=>{const T=sj(e);if(!e)return{needsInput:!1,hasDefaults:!1,fieldCount:0,canRunDirectly:!0,isChatMessage:!1};if(e.type==="string")return{needsInput:!e.default,hasDefaults:!!e.default,fieldCount:1,canRunDirectly:!!e.default,isChatMessage:!1};if(e.type==="object"&&e.properties){const D=e.properties,z=Object.entries(D),H=z.filter(([,q])=>q.default!==void 0||q.enum&&q.enum.length>0);return{needsInput:z.length>0,hasDefaults:H.length>0,fieldCount:z.length,canRunDirectly:z.length===0||H.length===z.length,isChatMessage:T}}return{needsInput:!1,hasDefaults:!1,fieldCount:0,canRunDirectly:!0,isChatMessage:!1}},[e]),x=()=>{if(c==="running"&&r)r();else if(g.canRunDirectly){const T={};e?.type==="string"&&e.default?T.input=e.default:e?.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([D,z])=>{z.default!==void 0?T[D]=z.default:z.enum&&z.enum.length>0&&(T[D]=z.enum[0])}),n(T)}else h(!0)},y=T=>{if(g.canRunDirectly){const D={};e?.type==="string"&&e.default?D.input=e.default:e?.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([z,H])=>{H.default!==void 0?D[z]=H.default:H.enum&&H.enum.length>0&&(D[z]=H.enum[0])}),n(D,T)}else h(!0)},b=f&&d.length>0,j=T=>{if(!T)return"";const D=T/1024;return D<1?`${T} B`:D<1024?`${D.toFixed(1)} KB`:`${(D/1024).toFixed(1)} MB`},N=()=>{const T=l?o.jsx(Or,{className:"w-4 h-4 animate-spin"}):c==="running"&&r?o.jsx(vd,{className:"w-4 h-4 fill-current"}):c==="running"?o.jsx(Or,{className:"w-4 h-4 animate-spin"}):c==="error"?o.jsx(sg,{className:"w-4 h-4"}):g.needsInput&&!g.canRunDirectly?o.jsx(Jh,{className:"w-4 h-4"}):o.jsx(nb,{className:"w-4 h-4"}),D=l?"Stopping...":c==="running"&&r?"Stop":c==="running"?"Running...":c==="completed"?"Run Again":c==="error"?"Retry":g.fieldCount===0||g.canRunDirectly?"Run Workflow":"Configure & Run";return{icon:T,text:D}},{icon:S,text:_}=N(),A=c==="running"&&!r||l,E=c==="error"?"destructive":"default",M=()=>b||g.needsInput?o.jsxs(bd,{children:[o.jsxs("div",{className:"flex w-full",children:[o.jsxs(Le,{onClick:x,disabled:A,variant:E,className:"gap-2 rounded-r-none flex-1",title:c==="running"&&r?"Stop workflow execution":void 0,children:[S,_]}),o.jsx(wd,{asChild:!0,children:o.jsx(Le,{disabled:A,variant:E,className:"rounded-l-none border-l-0 px-2",title:"More options",children:o.jsx(Rt,{className:"w-4 h-4"})})})]}),o.jsxs(Nd,{align:"end",className:"w-80 max-h-[400px] overflow-y-auto",children:[b&&o.jsxs($t,{onClick:x,children:[o.jsx(nb,{className:"w-4 h-4 mr-2"}),"Run Fresh"]}),g.needsInput&&o.jsxs($t,{onClick:()=>h(!0),children:[o.jsx(Jh,{className:"w-4 h-4 mr-2"}),"Configure Inputs"]}),b&&o.jsxs(o.Fragment,{children:[o.jsx(va,{}),o.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"Resume from checkpoint"}),d.map((D,z)=>o.jsxs($t,{onClick:()=>y(D.checkpoint_id),className:"flex flex-col items-start py-2",children:[o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[o.jsx(ng,{className:"w-4 h-4 flex-shrink-0"}),o.jsx("span",{className:"font-medium",children:D.metadata.iteration_count===0?"Initial State":`Step ${D.metadata.iteration_count}`}),z===0&&o.jsx(ut,{variant:"secondary",className:"text-[10px] h-4 px-1 ml-auto",children:"Latest"})]}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground ml-6 mt-0.5",children:[o.jsx(Jp,{className:"w-3 h-3"}),o.jsx("span",{children:new Date(D.timestamp).toLocaleTimeString()}),D.metadata.size_bytes&&o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"•"}),o.jsx("span",{children:j(D.metadata.size_bytes)})]})]})]},D.checkpoint_id))]})]})]}):o.jsxs(Le,{onClick:x,disabled:A,variant:E,className:"gap-2 w-full",title:c==="running"&&r?"Stop workflow execution":void 0,children:[S,_]});return o.jsxs(o.Fragment,{children:[M(),e&&o.jsx(Ir,{open:m,onOpenChange:h,children:o.jsxs(Lr,{className:"w-full min-w-[400px] max-w-md sm:max-w-lg md:max-w-2xl lg:max-w-4xl xl:max-w-5xl max-h-[90vh] flex flex-col",children:[o.jsxs($r,{className:"px-8 pt-6",children:[o.jsx(Pr,{children:"Configure Workflow Inputs"}),o.jsx(So,{onClose:()=>h(!1)})]}),o.jsx("div",{className:"px-8 py-4 border-b flex-shrink-0",children:o.jsx("div",{className:"text-sm text-muted-foreground",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"font-medium",children:"Input Type:"}),o.jsx(ut,{variant:"secondary",children:g.isChatMessage?"Chat Message":e.type==="string"?"Simple Text":"Structured Data"})]})})}),o.jsx("div",{className:"flex-1 overflow-y-auto py-4 px-8",children:g.isChatMessage?o.jsx(xg,{onSubmit:async T=>{n([{type:"message",role:"user",content:T}]),h(!1)},isSubmitting:a,placeholder:"Enter your message...",entityName:"workflow",showFileUpload:!0}):o.jsx(g6,{inputSchema:e,inputTypeName:"Input",onSubmit:T=>{n(T),h(!1)},isSubmitting:a,className:"embedded"})})]})})]})}function Dt(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let r=0,a;r<e.length;r++)(a=Dt(e[r]))!==""&&(n+=(n&&" ")+a);else for(let r in e)e[r]&&(n+=(n&&" ")+r);return n}var j6={value:()=>{}};function Dd(){for(var e=0,n=arguments.length,r={},a;e<n;++e){if(!(a=arguments[e]+"")||a in r||/[\s.]/.test(a))throw new Error("illegal type: "+a);r[a]=[]}return new ku(r)}function ku(e){this._=e}function S6(e,n){return e.trim().split(/^|\s+/).map(function(r){var a="",l=r.indexOf(".");if(l>=0&&(a=r.slice(l+1),r=r.slice(0,l)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:a}})}ku.prototype=Dd.prototype={constructor:ku,on:function(e,n){var r=this._,a=S6(e+"",r),l,c=-1,d=a.length;if(arguments.length<2){for(;++c<d;)if((l=(e=a[c]).type)&&(l=_6(r[l],e.name)))return l;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++c<d;)if(l=(e=a[c]).type)r[l]=mb(r[l],e.name,n);else if(n==null)for(l in r)r[l]=mb(r[l],e.name,null);return this},copy:function(){var e={},n=this._;for(var r in n)e[r]=n[r].slice();return new ku(e)},call:function(e,n){if((l=arguments.length-2)>0)for(var r=new Array(l),a=0,l,c;a<l;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(c=this._[e],a=0,l=c.length;a<l;++a)c[a].value.apply(n,r)},apply:function(e,n,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var a=this._[e],l=0,c=a.length;l<c;++l)a[l].value.apply(n,r)}};function _6(e,n){for(var r=0,a=e.length,l;r<a;++r)if((l=e[r]).name===n)return l.value}function mb(e,n,r){for(var a=0,l=e.length;a<l;++a)if(e[a].name===n){e[a]=j6,e=e.slice(0,a).concat(e.slice(a+1));break}return r!=null&&e.push({name:n,value:r}),e}var mp="http://www.w3.org/1999/xhtml";const hb={svg:"http://www.w3.org/2000/svg",xhtml:mp,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Od(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),hb.hasOwnProperty(n)?{space:hb[n],local:e}:e}function E6(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===mp&&n.documentElement.namespaceURI===mp?n.createElement(e):n.createElementNS(r,e)}}function C6(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ij(e){var n=Od(e);return(n.local?C6:E6)(n)}function k6(){}function Sg(e){return e==null?k6:function(){return this.querySelector(e)}}function T6(e){typeof e!="function"&&(e=Sg(e));for(var n=this._groups,r=n.length,a=new Array(r),l=0;l<r;++l)for(var c=n[l],d=c.length,f=a[l]=new Array(d),m,h,g=0;g<d;++g)(m=c[g])&&(h=e.call(m,m.__data__,g,c))&&("__data__"in m&&(h.__data__=m.__data__),f[g]=h);return new En(a,this._parents)}function A6(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function M6(){return[]}function lj(e){return e==null?M6:function(){return this.querySelectorAll(e)}}function R6(e){return function(){return A6(e.apply(this,arguments))}}function D6(e){typeof e=="function"?e=R6(e):e=lj(e);for(var n=this._groups,r=n.length,a=[],l=[],c=0;c<r;++c)for(var d=n[c],f=d.length,m,h=0;h<f;++h)(m=d[h])&&(a.push(e.call(m,m.__data__,h,d)),l.push(m));return new En(a,l)}function cj(e){return function(){return this.matches(e)}}function uj(e){return function(n){return n.matches(e)}}var O6=Array.prototype.find;function z6(e){return function(){return O6.call(this.children,e)}}function I6(){return this.firstElementChild}function L6(e){return this.select(e==null?I6:z6(typeof e=="function"?e:uj(e)))}var $6=Array.prototype.filter;function P6(){return Array.from(this.children)}function H6(e){return function(){return $6.call(this.children,e)}}function U6(e){return this.selectAll(e==null?P6:H6(typeof e=="function"?e:uj(e)))}function B6(e){typeof e!="function"&&(e=cj(e));for(var n=this._groups,r=n.length,a=new Array(r),l=0;l<r;++l)for(var c=n[l],d=c.length,f=a[l]=[],m,h=0;h<d;++h)(m=c[h])&&e.call(m,m.__data__,h,c)&&f.push(m);return new En(a,this._parents)}function dj(e){return new Array(e.length)}function V6(){return new En(this._enter||this._groups.map(dj),this._parents)}function Zu(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}Zu.prototype={constructor:Zu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function q6(e){return function(){return e}}function F6(e,n,r,a,l,c){for(var d=0,f,m=n.length,h=c.length;d<h;++d)(f=n[d])?(f.__data__=c[d],a[d]=f):r[d]=new Zu(e,c[d]);for(;d<m;++d)(f=n[d])&&(l[d]=f)}function Y6(e,n,r,a,l,c,d){var f,m,h=new Map,g=n.length,x=c.length,y=new Array(g),b;for(f=0;f<g;++f)(m=n[f])&&(y[f]=b=d.call(m,m.__data__,f,n)+"",h.has(b)?l[f]=m:h.set(b,m));for(f=0;f<x;++f)b=d.call(e,c[f],f,c)+"",(m=h.get(b))?(a[f]=m,m.__data__=c[f],h.delete(b)):r[f]=new Zu(e,c[f]);for(f=0;f<g;++f)(m=n[f])&&h.get(y[f])===m&&(l[f]=m)}function G6(e){return e.__data__}function X6(e,n){if(!arguments.length)return Array.from(this,G6);var r=n?Y6:F6,a=this._parents,l=this._groups;typeof e!="function"&&(e=q6(e));for(var c=l.length,d=new Array(c),f=new Array(c),m=new Array(c),h=0;h<c;++h){var g=a[h],x=l[h],y=x.length,b=Z6(e.call(g,g&&g.__data__,h,a)),j=b.length,N=f[h]=new Array(j),S=d[h]=new Array(j),_=m[h]=new Array(y);r(g,x,N,S,_,b,n);for(var A=0,E=0,M,T;A<j;++A)if(M=N[A]){for(A>=E&&(E=A+1);!(T=S[E])&&++E<j;);M._next=T||null}}return d=new En(d,a),d._enter=f,d._exit=m,d}function Z6(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function W6(){return new En(this._exit||this._groups.map(dj),this._parents)}function K6(e,n,r){var a=this.enter(),l=this,c=this.exit();return typeof e=="function"?(a=e(a),a&&(a=a.selection())):a=a.append(e+""),n!=null&&(l=n(l),l&&(l=l.selection())),r==null?c.remove():r(c),a&&l?a.merge(l).order():l}function Q6(e){for(var n=e.selection?e.selection():e,r=this._groups,a=n._groups,l=r.length,c=a.length,d=Math.min(l,c),f=new Array(l),m=0;m<d;++m)for(var h=r[m],g=a[m],x=h.length,y=f[m]=new Array(x),b,j=0;j<x;++j)(b=h[j]||g[j])&&(y[j]=b);for(;m<l;++m)f[m]=r[m];return new En(f,this._parents)}function J6(){for(var e=this._groups,n=-1,r=e.length;++n<r;)for(var a=e[n],l=a.length-1,c=a[l],d;--l>=0;)(d=a[l])&&(c&&d.compareDocumentPosition(c)^4&&c.parentNode.insertBefore(d,c),c=d);return this}function eO(e){e||(e=tO);function n(x,y){return x&&y?e(x.__data__,y.__data__):!x-!y}for(var r=this._groups,a=r.length,l=new Array(a),c=0;c<a;++c){for(var d=r[c],f=d.length,m=l[c]=new Array(f),h,g=0;g<f;++g)(h=d[g])&&(m[g]=h);m.sort(n)}return new En(l,this._parents).order()}function tO(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function nO(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function sO(){return Array.from(this)}function rO(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var a=e[n],l=0,c=a.length;l<c;++l){var d=a[l];if(d)return d}return null}function oO(){let e=0;for(const n of this)++e;return e}function aO(){return!this.node()}function iO(e){for(var n=this._groups,r=0,a=n.length;r<a;++r)for(var l=n[r],c=0,d=l.length,f;c<d;++c)(f=l[c])&&e.call(f,f.__data__,c,l);return this}function lO(e){return function(){this.removeAttribute(e)}}function cO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uO(e,n){return function(){this.setAttribute(e,n)}}function dO(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function fO(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function mO(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function hO(e,n){var r=Od(e);if(arguments.length<2){var a=this.node();return r.local?a.getAttributeNS(r.space,r.local):a.getAttribute(r)}return this.each((n==null?r.local?cO:lO:typeof n=="function"?r.local?mO:fO:r.local?dO:uO)(r,n))}function fj(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function pO(e){return function(){this.style.removeProperty(e)}}function gO(e,n,r){return function(){this.style.setProperty(e,n,r)}}function xO(e,n,r){return function(){var a=n.apply(this,arguments);a==null?this.style.removeProperty(e):this.style.setProperty(e,a,r)}}function yO(e,n,r){return arguments.length>1?this.each((n==null?pO:typeof n=="function"?xO:gO)(e,n,r??"")):Ta(this.node(),e)}function Ta(e,n){return e.style.getPropertyValue(n)||fj(e).getComputedStyle(e,null).getPropertyValue(n)}function vO(e){return function(){delete this[e]}}function bO(e,n){return function(){this[e]=n}}function wO(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function NO(e,n){return arguments.length>1?this.each((n==null?vO:typeof n=="function"?wO:bO)(e,n)):this.node()[e]}function mj(e){return e.trim().split(/^|\s+/)}function _g(e){return e.classList||new hj(e)}function hj(e){this._node=e,this._names=mj(e.getAttribute("class")||"")}hj.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function pj(e,n){for(var r=_g(e),a=-1,l=n.length;++a<l;)r.add(n[a])}function gj(e,n){for(var r=_g(e),a=-1,l=n.length;++a<l;)r.remove(n[a])}function jO(e){return function(){pj(this,e)}}function SO(e){return function(){gj(this,e)}}function _O(e,n){return function(){(n.apply(this,arguments)?pj:gj)(this,e)}}function EO(e,n){var r=mj(e+"");if(arguments.length<2){for(var a=_g(this.node()),l=-1,c=r.length;++l<c;)if(!a.contains(r[l]))return!1;return!0}return this.each((typeof n=="function"?_O:n?jO:SO)(r,n))}function CO(){this.textContent=""}function kO(e){return function(){this.textContent=e}}function TO(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function AO(e){return arguments.length?this.each(e==null?CO:(typeof e=="function"?TO:kO)(e)):this.node().textContent}function MO(){this.innerHTML=""}function RO(e){return function(){this.innerHTML=e}}function DO(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function OO(e){return arguments.length?this.each(e==null?MO:(typeof e=="function"?DO:RO)(e)):this.node().innerHTML}function zO(){this.nextSibling&&this.parentNode.appendChild(this)}function IO(){return this.each(zO)}function LO(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $O(){return this.each(LO)}function PO(e){var n=typeof e=="function"?e:ij(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function HO(){return null}function UO(e,n){var r=typeof e=="function"?e:ij(e),a=n==null?HO:typeof n=="function"?n:Sg(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),a.apply(this,arguments)||null)})}function BO(){var e=this.parentNode;e&&e.removeChild(this)}function VO(){return this.each(BO)}function qO(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function FO(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function YO(e){return this.select(e?FO:qO)}function GO(e){return arguments.length?this.property("__data__",e):this.node().__data__}function XO(e){return function(n){e.call(this,n,this.__data__)}}function ZO(e){return e.trim().split(/^|\s+/).map(function(n){var r="",a=n.indexOf(".");return a>=0&&(r=n.slice(a+1),n=n.slice(0,a)),{type:n,name:r}})}function WO(e){return function(){var n=this.__on;if(n){for(var r=0,a=-1,l=n.length,c;r<l;++r)c=n[r],(!e.type||c.type===e.type)&&c.name===e.name?this.removeEventListener(c.type,c.listener,c.options):n[++a]=c;++a?n.length=a:delete this.__on}}}function KO(e,n,r){return function(){var a=this.__on,l,c=XO(n);if(a){for(var d=0,f=a.length;d<f;++d)if((l=a[d]).type===e.type&&l.name===e.name){this.removeEventListener(l.type,l.listener,l.options),this.addEventListener(l.type,l.listener=c,l.options=r),l.value=n;return}}this.addEventListener(e.type,c,r),l={type:e.type,name:e.name,value:n,listener:c,options:r},a?a.push(l):this.__on=[l]}}function QO(e,n,r){var a=ZO(e+""),l,c=a.length,d;if(arguments.length<2){var f=this.node().__on;if(f){for(var m=0,h=f.length,g;m<h;++m)for(l=0,g=f[m];l<c;++l)if((d=a[l]).type===g.type&&d.name===g.name)return g.value}return}for(f=n?KO:WO,l=0;l<c;++l)this.each(f(a[l],n,r));return this}function xj(e,n,r){var a=fj(e),l=a.CustomEvent;typeof l=="function"?l=new l(n,r):(l=a.document.createEvent("Event"),r?(l.initEvent(n,r.bubbles,r.cancelable),l.detail=r.detail):l.initEvent(n,!1,!1)),e.dispatchEvent(l)}function JO(e,n){return function(){return xj(this,e,n)}}function e8(e,n){return function(){return xj(this,e,n.apply(this,arguments))}}function t8(e,n){return this.each((typeof n=="function"?e8:JO)(e,n))}function*n8(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var a=e[n],l=0,c=a.length,d;l<c;++l)(d=a[l])&&(yield d)}var yj=[null];function En(e,n){this._groups=e,this._parents=n}function Al(){return new En([[document.documentElement]],yj)}function s8(){return this}En.prototype=Al.prototype={constructor:En,select:T6,selectAll:D6,selectChild:L6,selectChildren:U6,filter:B6,data:X6,enter:V6,exit:W6,join:K6,merge:Q6,selection:s8,order:J6,sort:eO,call:nO,nodes:sO,node:rO,size:oO,empty:aO,each:iO,attr:hO,style:yO,property:NO,classed:EO,text:AO,html:OO,raise:IO,lower:$O,append:PO,insert:UO,remove:VO,clone:YO,datum:GO,on:QO,dispatch:t8,[Symbol.iterator]:n8};function Sn(e){return typeof e=="string"?new En([[document.querySelector(e)]],[document.documentElement]):new En([[e]],yj)}function r8(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Fn(e,n){if(e=r8(e),n===void 0&&(n=e.currentTarget),n){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var a=r.createSVGPoint();return a.x=e.clientX,a.y=e.clientY,a=a.matrixTransform(n.getScreenCTM().inverse()),[a.x,a.y]}if(n.getBoundingClientRect){var l=n.getBoundingClientRect();return[e.clientX-l.left-n.clientLeft,e.clientY-l.top-n.clientTop]}}return[e.pageX,e.pageY]}const o8={passive:!1},dl={capture:!0,passive:!1};function kh(e){e.stopImmediatePropagation()}function wa(e){e.preventDefault(),e.stopImmediatePropagation()}function vj(e){var n=e.document.documentElement,r=Sn(e).on("dragstart.drag",wa,dl);"onselectstart"in n?r.on("selectstart.drag",wa,dl):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function bj(e,n){var r=e.document.documentElement,a=Sn(e).on("dragstart.drag",null);n&&(a.on("click.drag",wa,dl),setTimeout(function(){a.on("click.drag",null)},0)),"onselectstart"in r?a.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const lu=e=>()=>e;function hp(e,{sourceEvent:n,subject:r,target:a,identifier:l,active:c,x:d,y:f,dx:m,dy:h,dispatch:g}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:a,enumerable:!0,configurable:!0},identifier:{value:l,enumerable:!0,configurable:!0},active:{value:c,enumerable:!0,configurable:!0},x:{value:d,enumerable:!0,configurable:!0},y:{value:f,enumerable:!0,configurable:!0},dx:{value:m,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:g}})}hp.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function a8(e){return!e.ctrlKey&&!e.button}function i8(){return this.parentNode}function l8(e,n){return n??{x:e.x,y:e.y}}function c8(){return navigator.maxTouchPoints||"ontouchstart"in this}function wj(){var e=a8,n=i8,r=l8,a=c8,l={},c=Dd("start","drag","end"),d=0,f,m,h,g,x=0;function y(M){M.on("mousedown.drag",b).filter(a).on("touchstart.drag",S).on("touchmove.drag",_,o8).on("touchend.drag touchcancel.drag",A).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function b(M,T){if(!(g||!e.call(this,M,T))){var D=E(this,n.call(this,M,T),M,T,"mouse");D&&(Sn(M.view).on("mousemove.drag",j,dl).on("mouseup.drag",N,dl),vj(M.view),kh(M),h=!1,f=M.clientX,m=M.clientY,D("start",M))}}function j(M){if(wa(M),!h){var T=M.clientX-f,D=M.clientY-m;h=T*T+D*D>x}l.mouse("drag",M)}function N(M){Sn(M.view).on("mousemove.drag mouseup.drag",null),bj(M.view,h),wa(M),l.mouse("end",M)}function S(M,T){if(e.call(this,M,T)){var D=M.changedTouches,z=n.call(this,M,T),H=D.length,q,X;for(q=0;q<H;++q)(X=E(this,z,M,T,D[q].identifier,D[q]))&&(kh(M),X("start",M,D[q]))}}function _(M){var T=M.changedTouches,D=T.length,z,H;for(z=0;z<D;++z)(H=l[T[z].identifier])&&(wa(M),H("drag",M,T[z]))}function A(M){var T=M.changedTouches,D=T.length,z,H;for(g&&clearTimeout(g),g=setTimeout(function(){g=null},500),z=0;z<D;++z)(H=l[T[z].identifier])&&(kh(M),H("end",M,T[z]))}function E(M,T,D,z,H,q){var X=c.copy(),W=Fn(q||D,T),G,ne,B;if((B=r.call(M,new hp("beforestart",{sourceEvent:D,target:y,identifier:H,active:d,x:W[0],y:W[1],dx:0,dy:0,dispatch:X}),z))!=null)return G=B.x-W[0]||0,ne=B.y-W[1]||0,function U(R,L,I){var P=W,C;switch(R){case"start":l[H]=U,C=d++;break;case"end":delete l[H],--d;case"drag":W=Fn(I||L,T),C=d;break}X.call(R,M,new hp(R,{sourceEvent:L,subject:B,target:y,identifier:H,active:C,x:W[0]+G,y:W[1]+ne,dx:W[0]-P[0],dy:W[1]-P[1],dispatch:X}),z)}}return y.filter=function(M){return arguments.length?(e=typeof M=="function"?M:lu(!!M),y):e},y.container=function(M){return arguments.length?(n=typeof M=="function"?M:lu(M),y):n},y.subject=function(M){return arguments.length?(r=typeof M=="function"?M:lu(M),y):r},y.touchable=function(M){return arguments.length?(a=typeof M=="function"?M:lu(!!M),y):a},y.on=function(){var M=c.on.apply(c,arguments);return M===c?y:M},y.clickDistance=function(M){return arguments.length?(x=(M=+M)*M,y):Math.sqrt(x)},y}function Eg(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function Nj(e,n){var r=Object.create(e.prototype);for(var a in n)r[a]=n[a];return r}function Ml(){}var fl=.7,Wu=1/fl,Na="\\s*([+-]?\\d+)\\s*",ml="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",u8=/^#([0-9a-f]{3,8})$/,d8=new RegExp(`^rgb\\(${Na},${Na},${Na}\\)$`),f8=new RegExp(`^rgb\\(${fs},${fs},${fs}\\)$`),m8=new RegExp(`^rgba\\(${Na},${Na},${Na},${ml}\\)$`),h8=new RegExp(`^rgba\\(${fs},${fs},${fs},${ml}\\)$`),p8=new RegExp(`^hsl\\(${ml},${fs},${fs}\\)$`),g8=new RegExp(`^hsla\\(${ml},${fs},${fs},${ml}\\)$`),pb={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};Eg(Ml,yo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:gb,formatHex:gb,formatHex8:x8,formatHsl:y8,formatRgb:xb,toString:xb});function gb(){return this.rgb().formatHex()}function x8(){return this.rgb().formatHex8()}function y8(){return jj(this).formatHsl()}function xb(){return this.rgb().formatRgb()}function yo(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=u8.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?yb(n):r===3?new fn(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?cu(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?cu(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=d8.exec(e))?new fn(n[1],n[2],n[3],1):(n=f8.exec(e))?new fn(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=m8.exec(e))?cu(n[1],n[2],n[3],n[4]):(n=h8.exec(e))?cu(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=p8.exec(e))?wb(n[1],n[2]/100,n[3]/100,1):(n=g8.exec(e))?wb(n[1],n[2]/100,n[3]/100,n[4]):pb.hasOwnProperty(e)?yb(pb[e]):e==="transparent"?new fn(NaN,NaN,NaN,0):null}function yb(e){return new fn(e>>16&255,e>>8&255,e&255,1)}function cu(e,n,r,a){return a<=0&&(e=n=r=NaN),new fn(e,n,r,a)}function v8(e){return e instanceof Ml||(e=yo(e)),e?(e=e.rgb(),new fn(e.r,e.g,e.b,e.opacity)):new fn}function pp(e,n,r,a){return arguments.length===1?v8(e):new fn(e,n,r,a??1)}function fn(e,n,r,a){this.r=+e,this.g=+n,this.b=+r,this.opacity=+a}Eg(fn,pp,Nj(Ml,{brighter(e){return e=e==null?Wu:Math.pow(Wu,e),new fn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?fl:Math.pow(fl,e),new fn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new fn(mo(this.r),mo(this.g),mo(this.b),Ku(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:vb,formatHex:vb,formatHex8:b8,formatRgb:bb,toString:bb}));function vb(){return`#${fo(this.r)}${fo(this.g)}${fo(this.b)}`}function b8(){return`#${fo(this.r)}${fo(this.g)}${fo(this.b)}${fo((isNaN(this.opacity)?1:this.opacity)*255)}`}function bb(){const e=Ku(this.opacity);return`${e===1?"rgb(":"rgba("}${mo(this.r)}, ${mo(this.g)}, ${mo(this.b)}${e===1?")":`, ${e})`}`}function Ku(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function mo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function fo(e){return e=mo(e),(e<16?"0":"")+e.toString(16)}function wb(e,n,r,a){return a<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new Yn(e,n,r,a)}function jj(e){if(e instanceof Yn)return new Yn(e.h,e.s,e.l,e.opacity);if(e instanceof Ml||(e=yo(e)),!e)return new Yn;if(e instanceof Yn)return e;e=e.rgb();var n=e.r/255,r=e.g/255,a=e.b/255,l=Math.min(n,r,a),c=Math.max(n,r,a),d=NaN,f=c-l,m=(c+l)/2;return f?(n===c?d=(r-a)/f+(r<a)*6:r===c?d=(a-n)/f+2:d=(n-r)/f+4,f/=m<.5?c+l:2-c-l,d*=60):f=m>0&&m<1?0:d,new Yn(d,f,m,e.opacity)}function w8(e,n,r,a){return arguments.length===1?jj(e):new Yn(e,n,r,a??1)}function Yn(e,n,r,a){this.h=+e,this.s=+n,this.l=+r,this.opacity=+a}Eg(Yn,w8,Nj(Ml,{brighter(e){return e=e==null?Wu:Math.pow(Wu,e),new Yn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?fl:Math.pow(fl,e),new Yn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,a=r+(r<.5?r:1-r)*n,l=2*r-a;return new fn(Th(e>=240?e-240:e+120,l,a),Th(e,l,a),Th(e<120?e+240:e-120,l,a),this.opacity)},clamp(){return new Yn(Nb(this.h),uu(this.s),uu(this.l),Ku(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Ku(this.opacity);return`${e===1?"hsl(":"hsla("}${Nb(this.h)}, ${uu(this.s)*100}%, ${uu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Nb(e){return e=(e||0)%360,e<0?e+360:e}function uu(e){return Math.max(0,Math.min(1,e||0))}function Th(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const Cg=e=>()=>e;function N8(e,n){return function(r){return e+r*n}}function j8(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(a){return Math.pow(e+a*n,r)}}function S8(e){return(e=+e)==1?Sj:function(n,r){return r-n?j8(n,r,e):Cg(isNaN(n)?r:n)}}function Sj(e,n){var r=n-e;return r?N8(e,r):Cg(isNaN(e)?n:e)}const Qu=(function e(n){var r=S8(n);function a(l,c){var d=r((l=pp(l)).r,(c=pp(c)).r),f=r(l.g,c.g),m=r(l.b,c.b),h=Sj(l.opacity,c.opacity);return function(g){return l.r=d(g),l.g=f(g),l.b=m(g),l.opacity=h(g),l+""}}return a.gamma=e,a})(1);function _8(e,n){n||(n=[]);var r=e?Math.min(n.length,e.length):0,a=n.slice(),l;return function(c){for(l=0;l<r;++l)a[l]=e[l]*(1-c)+n[l]*c;return a}}function E8(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function C8(e,n){var r=n?n.length:0,a=e?Math.min(r,e.length):0,l=new Array(a),c=new Array(r),d;for(d=0;d<a;++d)l[d]=sl(e[d],n[d]);for(;d<r;++d)c[d]=n[d];return function(f){for(d=0;d<a;++d)c[d]=l[d](f);return c}}function k8(e,n){var r=new Date;return e=+e,n=+n,function(a){return r.setTime(e*(1-a)+n*a),r}}function is(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}function T8(e,n){var r={},a={},l;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(l in n)l in e?r[l]=sl(e[l],n[l]):a[l]=n[l];return function(c){for(l in r)a[l]=r[l](c);return a}}var gp=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ah=new RegExp(gp.source,"g");function A8(e){return function(){return e}}function M8(e){return function(n){return e(n)+""}}function _j(e,n){var r=gp.lastIndex=Ah.lastIndex=0,a,l,c,d=-1,f=[],m=[];for(e=e+"",n=n+"";(a=gp.exec(e))&&(l=Ah.exec(n));)(c=l.index)>r&&(c=n.slice(r,c),f[d]?f[d]+=c:f[++d]=c),(a=a[0])===(l=l[0])?f[d]?f[d]+=l:f[++d]=l:(f[++d]=null,m.push({i:d,x:is(a,l)})),r=Ah.lastIndex;return r<n.length&&(c=n.slice(r),f[d]?f[d]+=c:f[++d]=c),f.length<2?m[0]?M8(m[0].x):A8(n):(n=m.length,function(h){for(var g=0,x;g<n;++g)f[(x=m[g]).i]=x.x(h);return f.join("")})}function sl(e,n){var r=typeof n,a;return n==null||r==="boolean"?Cg(n):(r==="number"?is:r==="string"?(a=yo(n))?(n=a,Qu):_j:n instanceof yo?Qu:n instanceof Date?k8:E8(n)?_8:Array.isArray(n)?C8:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?T8:is)(e,n)}var jb=180/Math.PI,xp={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ej(e,n,r,a,l,c){var d,f,m;return(d=Math.sqrt(e*e+n*n))&&(e/=d,n/=d),(m=e*r+n*a)&&(r-=e*m,a-=n*m),(f=Math.sqrt(r*r+a*a))&&(r/=f,a/=f,m/=f),e*a<n*r&&(e=-e,n=-n,m=-m,d=-d),{translateX:l,translateY:c,rotate:Math.atan2(n,e)*jb,skewX:Math.atan(m)*jb,scaleX:d,scaleY:f}}var du;function R8(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?xp:Ej(n.a,n.b,n.c,n.d,n.e,n.f)}function D8(e){return e==null||(du||(du=document.createElementNS("http://www.w3.org/2000/svg","g")),du.setAttribute("transform",e),!(e=du.transform.baseVal.consolidate()))?xp:(e=e.matrix,Ej(e.a,e.b,e.c,e.d,e.e,e.f))}function Cj(e,n,r,a){function l(h){return h.length?h.pop()+" ":""}function c(h,g,x,y,b,j){if(h!==x||g!==y){var N=b.push("translate(",null,n,null,r);j.push({i:N-4,x:is(h,x)},{i:N-2,x:is(g,y)})}else(x||y)&&b.push("translate("+x+n+y+r)}function d(h,g,x,y){h!==g?(h-g>180?g+=360:g-h>180&&(h+=360),y.push({i:x.push(l(x)+"rotate(",null,a)-2,x:is(h,g)})):g&&x.push(l(x)+"rotate("+g+a)}function f(h,g,x,y){h!==g?y.push({i:x.push(l(x)+"skewX(",null,a)-2,x:is(h,g)}):g&&x.push(l(x)+"skewX("+g+a)}function m(h,g,x,y,b,j){if(h!==x||g!==y){var N=b.push(l(b)+"scale(",null,",",null,")");j.push({i:N-4,x:is(h,x)},{i:N-2,x:is(g,y)})}else(x!==1||y!==1)&&b.push(l(b)+"scale("+x+","+y+")")}return function(h,g){var x=[],y=[];return h=e(h),g=e(g),c(h.translateX,h.translateY,g.translateX,g.translateY,x,y),d(h.rotate,g.rotate,x,y),f(h.skewX,g.skewX,x,y),m(h.scaleX,h.scaleY,g.scaleX,g.scaleY,x,y),h=g=null,function(b){for(var j=-1,N=y.length,S;++j<N;)x[(S=y[j]).i]=S.x(b);return x.join("")}}}var O8=Cj(R8,"px, ","px)","deg)"),z8=Cj(D8,", ",")",")"),I8=1e-12;function Sb(e){return((e=Math.exp(e))+1/e)/2}function L8(e){return((e=Math.exp(e))-1/e)/2}function $8(e){return((e=Math.exp(2*e))-1)/(e+1)}const Tu=(function e(n,r,a){function l(c,d){var f=c[0],m=c[1],h=c[2],g=d[0],x=d[1],y=d[2],b=g-f,j=x-m,N=b*b+j*j,S,_;if(N<I8)_=Math.log(y/h)/n,S=function(z){return[f+z*b,m+z*j,h*Math.exp(n*z*_)]};else{var A=Math.sqrt(N),E=(y*y-h*h+a*N)/(2*h*r*A),M=(y*y-h*h-a*N)/(2*y*r*A),T=Math.log(Math.sqrt(E*E+1)-E),D=Math.log(Math.sqrt(M*M+1)-M);_=(D-T)/n,S=function(z){var H=z*_,q=Sb(T),X=h/(r*A)*(q*$8(n*H+T)-L8(T));return[f+X*b,m+X*j,h*q/Sb(n*H+T)]}}return S.duration=_*1e3*n/Math.SQRT2,S}return l.rho=function(c){var d=Math.max(.001,+c),f=d*d,m=f*f;return e(d,f,m)},l})(Math.SQRT2,2,4);var Aa=0,Qi=0,Gi=0,kj=1e3,Ju,Ji,ed=0,vo=0,zd=0,hl=typeof performance=="object"&&performance.now?performance:Date,Tj=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function kg(){return vo||(Tj(P8),vo=hl.now()+zd)}function P8(){vo=0}function td(){this._call=this._time=this._next=null}td.prototype=Aj.prototype={constructor:td,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?kg():+r)+(n==null?0:+n),!this._next&&Ji!==this&&(Ji?Ji._next=this:Ju=this,Ji=this),this._call=e,this._time=r,yp()},stop:function(){this._call&&(this._call=null,this._time=1/0,yp())}};function Aj(e,n,r){var a=new td;return a.restart(e,n,r),a}function H8(){kg(),++Aa;for(var e=Ju,n;e;)(n=vo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Aa}function _b(){vo=(ed=hl.now())+zd,Aa=Qi=0;try{H8()}finally{Aa=0,B8(),vo=0}}function U8(){var e=hl.now(),n=e-ed;n>kj&&(zd-=n,ed=e)}function B8(){for(var e,n=Ju,r,a=1/0;n;)n._call?(a>n._time&&(a=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:Ju=r);Ji=e,yp(a)}function yp(e){if(!Aa){Qi&&(Qi=clearTimeout(Qi));var n=e-vo;n>24?(e<1/0&&(Qi=setTimeout(_b,e-hl.now()-zd)),Gi&&(Gi=clearInterval(Gi))):(Gi||(ed=hl.now(),Gi=setInterval(U8,kj)),Aa=1,Tj(_b))}}function Eb(e,n,r){var a=new td;return n=n==null?0:+n,a.restart(l=>{a.stop(),e(l+n)},n,r),a}var V8=Dd("start","end","cancel","interrupt"),q8=[],Mj=0,Cb=1,vp=2,Au=3,kb=4,bp=5,Mu=6;function Id(e,n,r,a,l,c){var d=e.__transition;if(!d)e.__transition={};else if(r in d)return;F8(e,r,{name:n,index:a,group:l,on:V8,tween:q8,time:c.time,delay:c.delay,duration:c.duration,ease:c.ease,timer:null,state:Mj})}function Tg(e,n){var r=Qn(e,n);if(r.state>Mj)throw new Error("too late; already scheduled");return r}function ys(e,n){var r=Qn(e,n);if(r.state>Au)throw new Error("too late; already running");return r}function Qn(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function F8(e,n,r){var a=e.__transition,l;a[n]=r,r.timer=Aj(c,0,r.time);function c(h){r.state=Cb,r.timer.restart(d,r.delay,r.time),r.delay<=h&&d(h-r.delay)}function d(h){var g,x,y,b;if(r.state!==Cb)return m();for(g in a)if(b=a[g],b.name===r.name){if(b.state===Au)return Eb(d);b.state===kb?(b.state=Mu,b.timer.stop(),b.on.call("interrupt",e,e.__data__,b.index,b.group),delete a[g]):+g<n&&(b.state=Mu,b.timer.stop(),b.on.call("cancel",e,e.__data__,b.index,b.group),delete a[g])}if(Eb(function(){r.state===Au&&(r.state=kb,r.timer.restart(f,r.delay,r.time),f(h))}),r.state=vp,r.on.call("start",e,e.__data__,r.index,r.group),r.state===vp){for(r.state=Au,l=new Array(y=r.tween.length),g=0,x=-1;g<y;++g)(b=r.tween[g].value.call(e,e.__data__,r.index,r.group))&&(l[++x]=b);l.length=x+1}}function f(h){for(var g=h<r.duration?r.ease.call(null,h/r.duration):(r.timer.restart(m),r.state=bp,1),x=-1,y=l.length;++x<y;)l[x].call(e,g);r.state===bp&&(r.on.call("end",e,e.__data__,r.index,r.group),m())}function m(){r.state=Mu,r.timer.stop(),delete a[n];for(var h in a)return;delete e.__transition}}function Ru(e,n){var r=e.__transition,a,l,c=!0,d;if(r){n=n==null?null:n+"";for(d in r){if((a=r[d]).name!==n){c=!1;continue}l=a.state>vp&&a.state<bp,a.state=Mu,a.timer.stop(),a.on.call(l?"interrupt":"cancel",e,e.__data__,a.index,a.group),delete r[d]}c&&delete e.__transition}}function Y8(e){return this.each(function(){Ru(this,e)})}function G8(e,n){var r,a;return function(){var l=ys(this,e),c=l.tween;if(c!==r){a=r=c;for(var d=0,f=a.length;d<f;++d)if(a[d].name===n){a=a.slice(),a.splice(d,1);break}}l.tween=a}}function X8(e,n,r){var a,l;if(typeof r!="function")throw new Error;return function(){var c=ys(this,e),d=c.tween;if(d!==a){l=(a=d).slice();for(var f={name:n,value:r},m=0,h=l.length;m<h;++m)if(l[m].name===n){l[m]=f;break}m===h&&l.push(f)}c.tween=l}}function Z8(e,n){var r=this._id;if(e+="",arguments.length<2){for(var a=Qn(this.node(),r).tween,l=0,c=a.length,d;l<c;++l)if((d=a[l]).name===e)return d.value;return null}return this.each((n==null?G8:X8)(r,e,n))}function Ag(e,n,r){var a=e._id;return e.each(function(){var l=ys(this,a);(l.value||(l.value={}))[n]=r.apply(this,arguments)}),function(l){return Qn(l,a).value[n]}}function Rj(e,n){var r;return(typeof n=="number"?is:n instanceof yo?Qu:(r=yo(n))?(n=r,Qu):_j)(e,n)}function W8(e){return function(){this.removeAttribute(e)}}function K8(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Q8(e,n,r){var a,l=r+"",c;return function(){var d=this.getAttribute(e);return d===l?null:d===a?c:c=n(a=d,r)}}function J8(e,n,r){var a,l=r+"",c;return function(){var d=this.getAttributeNS(e.space,e.local);return d===l?null:d===a?c:c=n(a=d,r)}}function e9(e,n,r){var a,l,c;return function(){var d,f=r(this),m;return f==null?void this.removeAttribute(e):(d=this.getAttribute(e),m=f+"",d===m?null:d===a&&m===l?c:(l=m,c=n(a=d,f)))}}function t9(e,n,r){var a,l,c;return function(){var d,f=r(this),m;return f==null?void this.removeAttributeNS(e.space,e.local):(d=this.getAttributeNS(e.space,e.local),m=f+"",d===m?null:d===a&&m===l?c:(l=m,c=n(a=d,f)))}}function n9(e,n){var r=Od(e),a=r==="transform"?z8:Rj;return this.attrTween(e,typeof n=="function"?(r.local?t9:e9)(r,a,Ag(this,"attr."+e,n)):n==null?(r.local?K8:W8)(r):(r.local?J8:Q8)(r,a,n))}function s9(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function r9(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function o9(e,n){var r,a;function l(){var c=n.apply(this,arguments);return c!==a&&(r=(a=c)&&r9(e,c)),r}return l._value=n,l}function a9(e,n){var r,a;function l(){var c=n.apply(this,arguments);return c!==a&&(r=(a=c)&&s9(e,c)),r}return l._value=n,l}function i9(e,n){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;var a=Od(e);return this.tween(r,(a.local?o9:a9)(a,n))}function l9(e,n){return function(){Tg(this,e).delay=+n.apply(this,arguments)}}function c9(e,n){return n=+n,function(){Tg(this,e).delay=n}}function u9(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?l9:c9)(n,e)):Qn(this.node(),n).delay}function d9(e,n){return function(){ys(this,e).duration=+n.apply(this,arguments)}}function f9(e,n){return n=+n,function(){ys(this,e).duration=n}}function m9(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?d9:f9)(n,e)):Qn(this.node(),n).duration}function h9(e,n){if(typeof n!="function")throw new Error;return function(){ys(this,e).ease=n}}function p9(e){var n=this._id;return arguments.length?this.each(h9(n,e)):Qn(this.node(),n).ease}function g9(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;ys(this,e).ease=r}}function x9(e){if(typeof e!="function")throw new Error;return this.each(g9(this._id,e))}function y9(e){typeof e!="function"&&(e=cj(e));for(var n=this._groups,r=n.length,a=new Array(r),l=0;l<r;++l)for(var c=n[l],d=c.length,f=a[l]=[],m,h=0;h<d;++h)(m=c[h])&&e.call(m,m.__data__,h,c)&&f.push(m);return new Zs(a,this._parents,this._name,this._id)}function v9(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,r=e._groups,a=n.length,l=r.length,c=Math.min(a,l),d=new Array(a),f=0;f<c;++f)for(var m=n[f],h=r[f],g=m.length,x=d[f]=new Array(g),y,b=0;b<g;++b)(y=m[b]||h[b])&&(x[b]=y);for(;f<a;++f)d[f]=n[f];return new Zs(d,this._parents,this._name,this._id)}function b9(e){return(e+"").trim().split(/^|\s+/).every(function(n){var r=n.indexOf(".");return r>=0&&(n=n.slice(0,r)),!n||n==="start"})}function w9(e,n,r){var a,l,c=b9(n)?Tg:ys;return function(){var d=c(this,e),f=d.on;f!==a&&(l=(a=f).copy()).on(n,r),d.on=l}}function N9(e,n){var r=this._id;return arguments.length<2?Qn(this.node(),r).on.on(e):this.each(w9(r,e,n))}function j9(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function S9(){return this.on("end.remove",j9(this._id))}function _9(e){var n=this._name,r=this._id;typeof e!="function"&&(e=Sg(e));for(var a=this._groups,l=a.length,c=new Array(l),d=0;d<l;++d)for(var f=a[d],m=f.length,h=c[d]=new Array(m),g,x,y=0;y<m;++y)(g=f[y])&&(x=e.call(g,g.__data__,y,f))&&("__data__"in g&&(x.__data__=g.__data__),h[y]=x,Id(h[y],n,r,y,h,Qn(g,r)));return new Zs(c,this._parents,n,r)}function E9(e){var n=this._name,r=this._id;typeof e!="function"&&(e=lj(e));for(var a=this._groups,l=a.length,c=[],d=[],f=0;f<l;++f)for(var m=a[f],h=m.length,g,x=0;x<h;++x)if(g=m[x]){for(var y=e.call(g,g.__data__,x,m),b,j=Qn(g,r),N=0,S=y.length;N<S;++N)(b=y[N])&&Id(b,n,r,N,y,j);c.push(y),d.push(g)}return new Zs(c,d,n,r)}var C9=Al.prototype.constructor;function k9(){return new C9(this._groups,this._parents)}function T9(e,n){var r,a,l;return function(){var c=Ta(this,e),d=(this.style.removeProperty(e),Ta(this,e));return c===d?null:c===r&&d===a?l:l=n(r=c,a=d)}}function Dj(e){return function(){this.style.removeProperty(e)}}function A9(e,n,r){var a,l=r+"",c;return function(){var d=Ta(this,e);return d===l?null:d===a?c:c=n(a=d,r)}}function M9(e,n,r){var a,l,c;return function(){var d=Ta(this,e),f=r(this),m=f+"";return f==null&&(m=f=(this.style.removeProperty(e),Ta(this,e))),d===m?null:d===a&&m===l?c:(l=m,c=n(a=d,f))}}function R9(e,n){var r,a,l,c="style."+n,d="end."+c,f;return function(){var m=ys(this,e),h=m.on,g=m.value[c]==null?f||(f=Dj(n)):void 0;(h!==r||l!==g)&&(a=(r=h).copy()).on(d,l=g),m.on=a}}function D9(e,n,r){var a=(e+="")=="transform"?O8:Rj;return n==null?this.styleTween(e,T9(e,a)).on("end.style."+e,Dj(e)):typeof n=="function"?this.styleTween(e,M9(e,a,Ag(this,"style."+e,n))).each(R9(this._id,e)):this.styleTween(e,A9(e,a,n),r).on("end.style."+e,null)}function O9(e,n,r){return function(a){this.style.setProperty(e,n.call(this,a),r)}}function z9(e,n,r){var a,l;function c(){var d=n.apply(this,arguments);return d!==l&&(a=(l=d)&&O9(e,d,r)),a}return c._value=n,c}function I9(e,n,r){var a="style."+(e+="");if(arguments.length<2)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,z9(e,n,r??""))}function L9(e){return function(){this.textContent=e}}function $9(e){return function(){var n=e(this);this.textContent=n??""}}function P9(e){return this.tween("text",typeof e=="function"?$9(Ag(this,"text",e)):L9(e==null?"":e+""))}function H9(e){return function(n){this.textContent=e.call(this,n)}}function U9(e){var n,r;function a(){var l=e.apply(this,arguments);return l!==r&&(n=(r=l)&&H9(l)),n}return a._value=e,a}function B9(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,U9(e))}function V9(){for(var e=this._name,n=this._id,r=Oj(),a=this._groups,l=a.length,c=0;c<l;++c)for(var d=a[c],f=d.length,m,h=0;h<f;++h)if(m=d[h]){var g=Qn(m,n);Id(m,e,r,h,d,{time:g.time+g.delay+g.duration,delay:0,duration:g.duration,ease:g.ease})}return new Zs(a,this._parents,e,r)}function q9(){var e,n,r=this,a=r._id,l=r.size();return new Promise(function(c,d){var f={value:d},m={value:function(){--l===0&&c()}};r.each(function(){var h=ys(this,a),g=h.on;g!==e&&(n=(e=g).copy(),n._.cancel.push(f),n._.interrupt.push(f),n._.end.push(m)),h.on=n}),l===0&&c()})}var F9=0;function Zs(e,n,r,a){this._groups=e,this._parents=n,this._name=r,this._id=a}function Oj(){return++F9}var Hs=Al.prototype;Zs.prototype={constructor:Zs,select:_9,selectAll:E9,selectChild:Hs.selectChild,selectChildren:Hs.selectChildren,filter:y9,merge:v9,selection:k9,transition:V9,call:Hs.call,nodes:Hs.nodes,node:Hs.node,size:Hs.size,empty:Hs.empty,each:Hs.each,on:N9,attr:n9,attrTween:i9,style:D9,styleTween:I9,text:P9,textTween:B9,remove:S9,tween:Z8,delay:u9,duration:m9,ease:p9,easeVarying:x9,end:q9,[Symbol.iterator]:Hs[Symbol.iterator]};function Y9(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var G9={time:null,delay:0,duration:250,ease:Y9};function X9(e,n){for(var r;!(r=e.__transition)||!(r=r[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return r}function Z9(e){var n,r;e instanceof Zs?(n=e._id,e=e._name):(n=Oj(),(r=G9).time=kg(),e=e==null?null:e+"");for(var a=this._groups,l=a.length,c=0;c<l;++c)for(var d=a[c],f=d.length,m,h=0;h<f;++h)(m=d[h])&&Id(m,e,n,h,d,r||X9(m,n));return new Zs(a,this._parents,e,n)}Al.prototype.interrupt=Y8;Al.prototype.transition=Z9;const fu=e=>()=>e;function W9(e,{sourceEvent:n,target:r,transform:a,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:a,enumerable:!0,configurable:!0},_:{value:l}})}function Bs(e,n,r){this.k=e,this.x=n,this.y=r}Bs.prototype={constructor:Bs,scale:function(e){return e===1?this:new Bs(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Bs(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ld=new Bs(1,0,0);zj.prototype=Bs.prototype;function zj(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ld;return e.__zoom}function Mh(e){e.stopImmediatePropagation()}function Xi(e){e.preventDefault(),e.stopImmediatePropagation()}function K9(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Q9(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Tb(){return this.__zoom||Ld}function J9(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ez(){return navigator.maxTouchPoints||"ontouchstart"in this}function tz(e,n,r){var a=e.invertX(n[0][0])-r[0][0],l=e.invertX(n[1][0])-r[1][0],c=e.invertY(n[0][1])-r[0][1],d=e.invertY(n[1][1])-r[1][1];return e.translate(l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l),d>c?(c+d)/2:Math.min(0,c)||Math.max(0,d))}function Ij(){var e=K9,n=Q9,r=tz,a=J9,l=ez,c=[0,1/0],d=[[-1/0,-1/0],[1/0,1/0]],f=250,m=Tu,h=Dd("start","zoom","end"),g,x,y,b=500,j=150,N=0,S=10;function _(B){B.property("__zoom",Tb).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",q).on("dblclick.zoom",X).filter(l).on("touchstart.zoom",W).on("touchmove.zoom",G).on("touchend.zoom touchcancel.zoom",ne).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(B,U,R,L){var I=B.selection?B.selection():B;I.property("__zoom",Tb),B!==I?T(B,U,R,L):I.interrupt().each(function(){D(this,arguments).event(L).start().zoom(null,typeof U=="function"?U.apply(this,arguments):U).end()})},_.scaleBy=function(B,U,R,L){_.scaleTo(B,function(){var I=this.__zoom.k,P=typeof U=="function"?U.apply(this,arguments):U;return I*P},R,L)},_.scaleTo=function(B,U,R,L){_.transform(B,function(){var I=n.apply(this,arguments),P=this.__zoom,C=R==null?M(I):typeof R=="function"?R.apply(this,arguments):R,$=P.invert(C),Y=typeof U=="function"?U.apply(this,arguments):U;return r(E(A(P,Y),C,$),I,d)},R,L)},_.translateBy=function(B,U,R,L){_.transform(B,function(){return r(this.__zoom.translate(typeof U=="function"?U.apply(this,arguments):U,typeof R=="function"?R.apply(this,arguments):R),n.apply(this,arguments),d)},null,L)},_.translateTo=function(B,U,R,L,I){_.transform(B,function(){var P=n.apply(this,arguments),C=this.__zoom,$=L==null?M(P):typeof L=="function"?L.apply(this,arguments):L;return r(Ld.translate($[0],$[1]).scale(C.k).translate(typeof U=="function"?-U.apply(this,arguments):-U,typeof R=="function"?-R.apply(this,arguments):-R),P,d)},L,I)};function A(B,U){return U=Math.max(c[0],Math.min(c[1],U)),U===B.k?B:new Bs(U,B.x,B.y)}function E(B,U,R){var L=U[0]-R[0]*B.k,I=U[1]-R[1]*B.k;return L===B.x&&I===B.y?B:new Bs(B.k,L,I)}function M(B){return[(+B[0][0]+ +B[1][0])/2,(+B[0][1]+ +B[1][1])/2]}function T(B,U,R,L){B.on("start.zoom",function(){D(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){D(this,arguments).event(L).end()}).tween("zoom",function(){var I=this,P=arguments,C=D(I,P).event(L),$=n.apply(I,P),Y=R==null?M($):typeof R=="function"?R.apply(I,P):R,V=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),J=I.__zoom,ce=typeof U=="function"?U.apply(I,P):U,fe=m(J.invert(Y).concat(V/J.k),ce.invert(Y).concat(V/ce.k));return function(ee){if(ee===1)ee=ce;else{var ie=fe(ee),ge=V/ie[2];ee=new Bs(ge,Y[0]-ie[0]*ge,Y[1]-ie[1]*ge)}C.zoom(null,ee)}})}function D(B,U,R){return!R&&B.__zooming||new z(B,U)}function z(B,U){this.that=B,this.args=U,this.active=0,this.sourceEvent=null,this.extent=n.apply(B,U),this.taps=0}z.prototype={event:function(B){return B&&(this.sourceEvent=B),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(B,U){return this.mouse&&B!=="mouse"&&(this.mouse[1]=U.invert(this.mouse[0])),this.touch0&&B!=="touch"&&(this.touch0[1]=U.invert(this.touch0[0])),this.touch1&&B!=="touch"&&(this.touch1[1]=U.invert(this.touch1[0])),this.that.__zoom=U,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(B){var U=Sn(this.that).datum();h.call(B,this.that,new W9(B,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:h}),U)}};function H(B,...U){if(!e.apply(this,arguments))return;var R=D(this,U).event(B),L=this.__zoom,I=Math.max(c[0],Math.min(c[1],L.k*Math.pow(2,a.apply(this,arguments)))),P=Fn(B);if(R.wheel)(R.mouse[0][0]!==P[0]||R.mouse[0][1]!==P[1])&&(R.mouse[1]=L.invert(R.mouse[0]=P)),clearTimeout(R.wheel);else{if(L.k===I)return;R.mouse=[P,L.invert(P)],Ru(this),R.start()}Xi(B),R.wheel=setTimeout(C,j),R.zoom("mouse",r(E(A(L,I),R.mouse[0],R.mouse[1]),R.extent,d));function C(){R.wheel=null,R.end()}}function q(B,...U){if(y||!e.apply(this,arguments))return;var R=B.currentTarget,L=D(this,U,!0).event(B),I=Sn(B.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",V,!0),P=Fn(B,R),C=B.clientX,$=B.clientY;vj(B.view),Mh(B),L.mouse=[P,this.__zoom.invert(P)],Ru(this),L.start();function Y(J){if(Xi(J),!L.moved){var ce=J.clientX-C,fe=J.clientY-$;L.moved=ce*ce+fe*fe>N}L.event(J).zoom("mouse",r(E(L.that.__zoom,L.mouse[0]=Fn(J,R),L.mouse[1]),L.extent,d))}function V(J){I.on("mousemove.zoom mouseup.zoom",null),bj(J.view,L.moved),Xi(J),L.event(J).end()}}function X(B,...U){if(e.apply(this,arguments)){var R=this.__zoom,L=Fn(B.changedTouches?B.changedTouches[0]:B,this),I=R.invert(L),P=R.k*(B.shiftKey?.5:2),C=r(E(A(R,P),L,I),n.apply(this,U),d);Xi(B),f>0?Sn(this).transition().duration(f).call(T,C,L,B):Sn(this).call(_.transform,C,L,B)}}function W(B,...U){if(e.apply(this,arguments)){var R=B.touches,L=R.length,I=D(this,U,B.changedTouches.length===L).event(B),P,C,$,Y;for(Mh(B),C=0;C<L;++C)$=R[C],Y=Fn($,this),Y=[Y,this.__zoom.invert(Y),$.identifier],I.touch0?!I.touch1&&I.touch0[2]!==Y[2]&&(I.touch1=Y,I.taps=0):(I.touch0=Y,P=!0,I.taps=1+!!g);g&&(g=clearTimeout(g)),P&&(I.taps<2&&(x=Y[0],g=setTimeout(function(){g=null},b)),Ru(this),I.start())}}function G(B,...U){if(this.__zooming){var R=D(this,U).event(B),L=B.changedTouches,I=L.length,P,C,$,Y;for(Xi(B),P=0;P<I;++P)C=L[P],$=Fn(C,this),R.touch0&&R.touch0[2]===C.identifier?R.touch0[0]=$:R.touch1&&R.touch1[2]===C.identifier&&(R.touch1[0]=$);if(C=R.that.__zoom,R.touch1){var V=R.touch0[0],J=R.touch0[1],ce=R.touch1[0],fe=R.touch1[1],ee=(ee=ce[0]-V[0])*ee+(ee=ce[1]-V[1])*ee,ie=(ie=fe[0]-J[0])*ie+(ie=fe[1]-J[1])*ie;C=A(C,Math.sqrt(ee/ie)),$=[(V[0]+ce[0])/2,(V[1]+ce[1])/2],Y=[(J[0]+fe[0])/2,(J[1]+fe[1])/2]}else if(R.touch0)$=R.touch0[0],Y=R.touch0[1];else return;R.zoom("touch",r(E(C,$,Y),R.extent,d))}}function ne(B,...U){if(this.__zooming){var R=D(this,U).event(B),L=B.changedTouches,I=L.length,P,C;for(Mh(B),y&&clearTimeout(y),y=setTimeout(function(){y=null},b),P=0;P<I;++P)C=L[P],R.touch0&&R.touch0[2]===C.identifier?delete R.touch0:R.touch1&&R.touch1[2]===C.identifier&&delete R.touch1;if(R.touch1&&!R.touch0&&(R.touch0=R.touch1,delete R.touch1),R.touch0)R.touch0[1]=this.__zoom.invert(R.touch0[0]);else if(R.end(),R.taps===2&&(C=Fn(C,this),Math.hypot(x[0]-C[0],x[1]-C[1])<S)){var $=Sn(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return _.wheelDelta=function(B){return arguments.length?(a=typeof B=="function"?B:fu(+B),_):a},_.filter=function(B){return arguments.length?(e=typeof B=="function"?B:fu(!!B),_):e},_.touchable=function(B){return arguments.length?(l=typeof B=="function"?B:fu(!!B),_):l},_.extent=function(B){return arguments.length?(n=typeof B=="function"?B:fu([[+B[0][0],+B[0][1]],[+B[1][0],+B[1][1]]]),_):n},_.scaleExtent=function(B){return arguments.length?(c[0]=+B[0],c[1]=+B[1],_):[c[0],c[1]]},_.translateExtent=function(B){return arguments.length?(d[0][0]=+B[0][0],d[1][0]=+B[1][0],d[0][1]=+B[0][1],d[1][1]=+B[1][1],_):[[d[0][0],d[0][1]],[d[1][0],d[1][1]]]},_.constrain=function(B){return arguments.length?(r=B,_):r},_.duration=function(B){return arguments.length?(f=+B,_):f},_.interpolate=function(B){return arguments.length?(m=B,_):m},_.on=function(){var B=h.on.apply(h,arguments);return B===h?_:B},_.clickDistance=function(B){return arguments.length?(N=(B=+B)*B,_):Math.sqrt(N)},_.tapDistance=function(B){return arguments.length?(S=+B,_):S},_}const ps={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:n,sourceHandle:r,targetHandle:a})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r:a}", edge id: ${n}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/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."},pl=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Lj=["Enter"," ","Escape"],$j={"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:e,x:n,y:r})=>`Moved selected node ${e}. New position, x: ${n}, y: ${r}`,"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 Ma;(function(e){e.Strict="strict",e.Loose="loose"})(Ma||(Ma={}));var ho;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ho||(ho={}));var gl;(function(e){e.Partial="partial",e.Full="full"})(gl||(gl={}));const Pj={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var kr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(kr||(kr={}));var nd;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(nd||(nd={}));var Ue;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ue||(Ue={}));const Ab={[Ue.Left]:Ue.Right,[Ue.Right]:Ue.Left,[Ue.Top]:Ue.Bottom,[Ue.Bottom]:Ue.Top};function Hj(e){return e===null?null:e?"valid":"invalid"}const Uj=e=>"id"in e&&"source"in e&&"target"in e,nz=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Mg=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Rl=(e,n=[0,0])=>{const{width:r,height:a}=Ws(e),l=e.origin??n,c=r*l[0],d=a*l[1];return{x:e.position.x-c,y:e.position.y-d}},sz=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((a,l)=>{const c=typeof l=="string";let d=!n.nodeLookup&&!c?l:void 0;n.nodeLookup&&(d=c?n.nodeLookup.get(l):Mg(l)?l:n.nodeLookup.get(l.id));const f=d?sd(d,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return $d(a,f)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Pd(r)},Dl=(e,n={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(a=>{if(n.filter===void 0||n.filter(a)){const l=sd(a);r=$d(r,l)}}),Pd(r)},Rg=(e,n,[r,a,l]=[0,0,1],c=!1,d=!1)=>{const f={...zl(n,[r,a,l]),width:n.width/l,height:n.height/l},m=[];for(const h of e.values()){const{measured:g,selectable:x=!0,hidden:y=!1}=h;if(d&&!x||y)continue;const b=g.width??h.width??h.initialWidth??null,j=g.height??h.height??h.initialHeight??null,N=xl(f,Da(h)),S=(b??0)*(j??0),_=c&&N>0;(!h.internals.handleBounds||_||N>=S||h.dragging)&&m.push(h)}return m},rz=(e,n)=>{const r=new Set;return e.forEach(a=>{r.add(a.id)}),n.filter(a=>r.has(a.source)||r.has(a.target))};function oz(e,n){const r=new Map,a=n?.nodes?new Set(n.nodes.map(l=>l.id)):null;return e.forEach(l=>{l.measured.width&&l.measured.height&&(n?.includeHiddenNodes||!l.hidden)&&(!a||a.has(l.id))&&r.set(l.id,l)}),r}async function az({nodes:e,width:n,height:r,panZoom:a,minZoom:l,maxZoom:c},d){if(e.size===0)return Promise.resolve(!0);const f=oz(e,d),m=Dl(f),h=Dg(m,n,r,d?.minZoom??l,d?.maxZoom??c,d?.padding??.1);return await a.setViewport(h,{duration:d?.duration,ease:d?.ease,interpolate:d?.interpolate}),Promise.resolve(!0)}function Bj({nodeId:e,nextPosition:n,nodeLookup:r,nodeOrigin:a=[0,0],nodeExtent:l,onError:c}){const d=r.get(e),f=d.parentId?r.get(d.parentId):void 0,{x:m,y:h}=f?f.internals.positionAbsolute:{x:0,y:0},g=d.origin??a;let x=d.extent||l;if(d.extent==="parent"&&!d.expandParent)if(!f)c?.("005",ps.error005());else{const b=f.measured.width,j=f.measured.height;b&&j&&(x=[[m,h],[m+b,h+j]])}else f&&Oa(d.extent)&&(x=[[d.extent[0][0]+m,d.extent[0][1]+h],[d.extent[1][0]+m,d.extent[1][1]+h]]);const y=Oa(x)?bo(n,x,d.measured):n;return(d.measured.width===void 0||d.measured.height===void 0)&&c?.("015",ps.error015()),{position:{x:y.x-m+(d.measured.width??0)*g[0],y:y.y-h+(d.measured.height??0)*g[1]},positionAbsolute:y}}async function iz({nodesToRemove:e=[],edgesToRemove:n=[],nodes:r,edges:a,onBeforeDelete:l}){const c=new Set(e.map(y=>y.id)),d=[];for(const y of r){if(y.deletable===!1)continue;const b=c.has(y.id),j=!b&&y.parentId&&d.find(N=>N.id===y.parentId);(b||j)&&d.push(y)}const f=new Set(n.map(y=>y.id)),m=a.filter(y=>y.deletable!==!1),g=rz(d,m);for(const y of m)f.has(y.id)&&!g.find(j=>j.id===y.id)&&g.push(y);if(!l)return{edges:g,nodes:d};const x=await l({nodes:d,edges:g});return typeof x=="boolean"?x?{edges:g,nodes:d}:{edges:[],nodes:[]}:x}const Ra=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),bo=(e={x:0,y:0},n,r)=>({x:Ra(e.x,n[0][0],n[1][0]-(r?.width??0)),y:Ra(e.y,n[0][1],n[1][1]-(r?.height??0))});function Vj(e,n,r){const{width:a,height:l}=Ws(r),{x:c,y:d}=r.internals.positionAbsolute;return bo(e,[[c,d],[c+a,d+l]],n)}const Mb=(e,n,r)=>e<n?Ra(Math.abs(e-n),1,n)/n:e>r?-Ra(Math.abs(e-r),1,n)/n:0,qj=(e,n,r=15,a=40)=>{const l=Mb(e.x,a,n.width-a)*r,c=Mb(e.y,a,n.height-a)*r;return[l,c]},$d=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),wp=({x:e,y:n,width:r,height:a})=>({x:e,y:n,x2:e+r,y2:n+a}),Pd=({x:e,y:n,x2:r,y2:a})=>({x:e,y:n,width:r-e,height:a-n}),Da=(e,n=[0,0])=>{const{x:r,y:a}=Mg(e)?e.internals.positionAbsolute:Rl(e,n);return{x:r,y:a,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},sd=(e,n=[0,0])=>{const{x:r,y:a}=Mg(e)?e.internals.positionAbsolute:Rl(e,n);return{x:r,y:a,x2:r+(e.measured?.width??e.width??e.initialWidth??0),y2:a+(e.measured?.height??e.height??e.initialHeight??0)}},Fj=(e,n)=>Pd($d(wp(e),wp(n))),xl=(e,n)=>{const r=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),a=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(r*a)},Rb=e=>Gn(e.width)&&Gn(e.height)&&Gn(e.x)&&Gn(e.y),Gn=e=>!isNaN(e)&&isFinite(e),lz=(e,n)=>{},Ol=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),zl=({x:e,y:n},[r,a,l],c=!1,d=[1,1])=>{const f={x:(e-r)/l,y:(n-a)/l};return c?Ol(f,d):f},rd=({x:e,y:n},[r,a,l])=>({x:e*l+r,y:n*l+a});function ma(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(n*r*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function cz(e,n,r){if(typeof e=="string"||typeof e=="number"){const a=ma(e,r),l=ma(e,n);return{top:a,right:l,bottom:a,left:l,x:l*2,y:a*2}}if(typeof e=="object"){const a=ma(e.top??e.y??0,r),l=ma(e.bottom??e.y??0,r),c=ma(e.left??e.x??0,n),d=ma(e.right??e.x??0,n);return{top:a,right:d,bottom:l,left:c,x:c+d,y:a+l}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function uz(e,n,r,a,l,c){const{x:d,y:f}=rd(e,[n,r,a]),{x:m,y:h}=rd({x:e.x+e.width,y:e.y+e.height},[n,r,a]),g=l-m,x=c-h;return{left:Math.floor(d),top:Math.floor(f),right:Math.floor(g),bottom:Math.floor(x)}}const Dg=(e,n,r,a,l,c)=>{const d=cz(c,n,r),f=(n-d.x)/e.width,m=(r-d.y)/e.height,h=Math.min(f,m),g=Ra(h,a,l),x=e.x+e.width/2,y=e.y+e.height/2,b=n/2-x*g,j=r/2-y*g,N=uz(e,b,j,g,n,r),S={left:Math.min(N.left-d.left,0),top:Math.min(N.top-d.top,0),right:Math.min(N.right-d.right,0),bottom:Math.min(N.bottom-d.bottom,0)};return{x:b-S.left+S.right,y:j-S.top+S.bottom,zoom:g}},yl=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Oa(e){return e!=null&&e!=="parent"}function Ws(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Yj(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Gj(e,n={width:0,height:0},r,a,l){const c={...e},d=a.get(r);if(d){const f=d.origin||l;c.x+=d.internals.positionAbsolute.x-(n.width??0)*f[0],c.y+=d.internals.positionAbsolute.y-(n.height??0)*f[1]}return c}function Db(e,n){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}function dz(){let e,n;return{promise:new Promise((a,l)=>{e=a,n=l}),resolve:e,reject:n}}function fz(e){return{...$j,...e||{}}}function rl(e,{snapGrid:n=[0,0],snapToGrid:r=!1,transform:a,containerBounds:l}){const{x:c,y:d}=us(e),f=zl({x:c-(l?.left??0),y:d-(l?.top??0)},a),{x:m,y:h}=r?Ol(f,n):f;return{xSnapped:m,ySnapped:h,...f}}const Og=e=>({width:e.offsetWidth,height:e.offsetHeight}),Xj=e=>e?.getRootNode?.()||window?.document,mz=["INPUT","SELECT","TEXTAREA"];function Zj(e){const n=e.composedPath?.()?.[0]||e.target;return n?.nodeType!==1?!1:mz.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const Wj=e=>"clientX"in e,us=(e,n)=>{const r=Wj(e),a=r?e.clientX:e.touches?.[0].clientX,l=r?e.clientY:e.touches?.[0].clientY;return{x:a-(n?.left??0),y:l-(n?.top??0)}},Ob=(e,n,r,a,l)=>{const c=n.querySelectorAll(`.${e}`);return!c||!c.length?null:Array.from(c).map(d=>{const f=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),type:e,nodeId:l,position:d.getAttribute("data-handlepos"),x:(f.left-r.left)/a,y:(f.top-r.top)/a,...Og(d)}})};function Kj({sourceX:e,sourceY:n,targetX:r,targetY:a,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:f}){const m=e*.125+l*.375+d*.375+r*.125,h=n*.125+c*.375+f*.375+a*.125,g=Math.abs(m-e),x=Math.abs(h-n);return[m,h,g,x]}function mu(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function zb({pos:e,x1:n,y1:r,x2:a,y2:l,c}){switch(e){case Ue.Left:return[n-mu(n-a,c),r];case Ue.Right:return[n+mu(a-n,c),r];case Ue.Top:return[n,r-mu(r-l,c)];case Ue.Bottom:return[n,r+mu(l-r,c)]}}function Qj({sourceX:e,sourceY:n,sourcePosition:r=Ue.Bottom,targetX:a,targetY:l,targetPosition:c=Ue.Top,curvature:d=.25}){const[f,m]=zb({pos:r,x1:e,y1:n,x2:a,y2:l,c:d}),[h,g]=zb({pos:c,x1:a,y1:l,x2:e,y2:n,c:d}),[x,y,b,j]=Kj({sourceX:e,sourceY:n,targetX:a,targetY:l,sourceControlX:f,sourceControlY:m,targetControlX:h,targetControlY:g});return[`M${e},${n} C${f},${m} ${h},${g} ${a},${l}`,x,y,b,j]}function Jj({sourceX:e,sourceY:n,targetX:r,targetY:a}){const l=Math.abs(r-e)/2,c=r<e?r+l:r-l,d=Math.abs(a-n)/2,f=a<n?a+d:a-d;return[c,f,l,d]}function hz({sourceNode:e,targetNode:n,selected:r=!1,zIndex:a,elevateOnSelect:l=!1}){if(a!==void 0)return a;const c=l&&r?1e3:0,d=Math.max(e.parentId?e.internals.z:0,n.parentId?n.internals.z:0);return c+d}function pz({sourceNode:e,targetNode:n,width:r,height:a,transform:l}){const c=$d(sd(e),sd(n));c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const d={x:-l[0]/l[2],y:-l[1]/l[2],width:r/l[2],height:a/l[2]};return xl(d,Pd(c))>0}const gz=({source:e,sourceHandle:n,target:r,targetHandle:a})=>`xy-edge__${e}${n||""}-${r}${a||""}`,xz=(e,n)=>n.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),yz=(e,n)=>{if(!e.source||!e.target)return n;let r;return Uj(e)?r={...e}:r={...e,id:gz(e)},xz(r,n)?n:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,n.concat(r))};function eS({sourceX:e,sourceY:n,targetX:r,targetY:a}){const[l,c,d,f]=Jj({sourceX:e,sourceY:n,targetX:r,targetY:a});return[`M ${e},${n}L ${r},${a}`,l,c,d,f]}const Ib={[Ue.Left]:{x:-1,y:0},[Ue.Right]:{x:1,y:0},[Ue.Top]:{x:0,y:-1},[Ue.Bottom]:{x:0,y:1}},vz=({source:e,sourcePosition:n=Ue.Bottom,target:r})=>n===Ue.Left||n===Ue.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},Lb=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function bz({source:e,sourcePosition:n=Ue.Bottom,target:r,targetPosition:a=Ue.Top,center:l,offset:c,stepPosition:d}){const f=Ib[n],m=Ib[a],h={x:e.x+f.x*c,y:e.y+f.y*c},g={x:r.x+m.x*c,y:r.y+m.y*c},x=vz({source:h,sourcePosition:n,target:g}),y=x.x!==0?"x":"y",b=x[y];let j=[],N,S;const _={x:0,y:0},A={x:0,y:0},[,,E,M]=Jj({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(f[y]*m[y]===-1){y==="x"?(N=l.x??h.x+(g.x-h.x)*d,S=l.y??(h.y+g.y)/2):(N=l.x??(h.x+g.x)/2,S=l.y??h.y+(g.y-h.y)*d);const D=[{x:N,y:h.y},{x:N,y:g.y}],z=[{x:h.x,y:S},{x:g.x,y:S}];f[y]===b?j=y==="x"?D:z:j=y==="x"?z:D}else{const D=[{x:h.x,y:g.y}],z=[{x:g.x,y:h.y}];if(y==="x"?j=f.x===b?z:D:j=f.y===b?D:z,n===a){const G=Math.abs(e[y]-r[y]);if(G<=c){const ne=Math.min(c-1,c-G);f[y]===b?_[y]=(h[y]>e[y]?-1:1)*ne:A[y]=(g[y]>r[y]?-1:1)*ne}}if(n!==a){const G=y==="x"?"y":"x",ne=f[y]===m[G],B=h[G]>g[G],U=h[G]<g[G];(f[y]===1&&(!ne&&B||ne&&U)||f[y]!==1&&(!ne&&U||ne&&B))&&(j=y==="x"?D:z)}const H={x:h.x+_.x,y:h.y+_.y},q={x:g.x+A.x,y:g.y+A.y},X=Math.max(Math.abs(H.x-j[0].x),Math.abs(q.x-j[0].x)),W=Math.max(Math.abs(H.y-j[0].y),Math.abs(q.y-j[0].y));X>=W?(N=(H.x+q.x)/2,S=j[0].y):(N=j[0].x,S=(H.y+q.y)/2)}return[[e,{x:h.x+_.x,y:h.y+_.y},...j,{x:g.x+A.x,y:g.y+A.y},r],N,S,E,M]}function wz(e,n,r,a){const l=Math.min(Lb(e,n)/2,Lb(n,r)/2,a),{x:c,y:d}=n;if(e.x===c&&c===r.x||e.y===d&&d===r.y)return`L${c} ${d}`;if(e.y===d){const h=e.x<r.x?-1:1,g=e.y<r.y?1:-1;return`L ${c+l*h},${d}Q ${c},${d} ${c},${d+l*g}`}const f=e.x<r.x?1:-1,m=e.y<r.y?-1:1;return`L ${c},${d+l*m}Q ${c},${d} ${c+l*f},${d}`}function Np({sourceX:e,sourceY:n,sourcePosition:r=Ue.Bottom,targetX:a,targetY:l,targetPosition:c=Ue.Top,borderRadius:d=5,centerX:f,centerY:m,offset:h=20,stepPosition:g=.5}){const[x,y,b,j,N]=bz({source:{x:e,y:n},sourcePosition:r,target:{x:a,y:l},targetPosition:c,center:{x:f,y:m},offset:h,stepPosition:g});return[x.reduce((_,A,E)=>{let M="";return E>0&&E<x.length-1?M=wz(x[E-1],A,x[E+1],d):M=`${E===0?"M":"L"}${A.x} ${A.y}`,_+=M,_},""),y,b,j,N]}function $b(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Nz(e){const{sourceNode:n,targetNode:r}=e;if(!$b(n)||!$b(r))return null;const a=n.internals.handleBounds||Pb(n.handles),l=r.internals.handleBounds||Pb(r.handles),c=Hb(a?.source??[],e.sourceHandle),d=Hb(e.connectionMode===Ma.Strict?l?.target??[]:(l?.target??[]).concat(l?.source??[]),e.targetHandle);if(!c||!d)return e.onError?.("008",ps.error008(c?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const f=c?.position||Ue.Bottom,m=d?.position||Ue.Top,h=vl(n,c,f),g=vl(r,d,m);return{sourceX:h.x,sourceY:h.y,targetX:g.x,targetY:g.y,sourcePosition:f,targetPosition:m}}function Pb(e){if(!e)return null;const n=[],r=[];for(const a of e)a.width=a.width??1,a.height=a.height??1,a.type==="source"?n.push(a):a.type==="target"&&r.push(a);return{source:n,target:r}}function vl(e,n,r=Ue.Left,a=!1){const l=(n?.x??0)+e.internals.positionAbsolute.x,c=(n?.y??0)+e.internals.positionAbsolute.y,{width:d,height:f}=n??Ws(e);if(a)return{x:l+d/2,y:c+f/2};switch(n?.position??r){case Ue.Top:return{x:l+d/2,y:c};case Ue.Right:return{x:l+d,y:c+f/2};case Ue.Bottom:return{x:l+d/2,y:c+f};case Ue.Left:return{x:l,y:c+f/2}}}function Hb(e,n){return e&&(n?e.find(r=>r.id===n):e[0])||null}function jp(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(a=>`${a}=${e[a]}`).join("&")}`:""}function jz(e,{id:n,defaultColor:r,defaultMarkerStart:a,defaultMarkerEnd:l}){const c=new Set;return e.reduce((d,f)=>([f.markerStart||a,f.markerEnd||l].forEach(m=>{if(m&&typeof m=="object"){const h=jp(m,n);c.has(h)||(d.push({id:h,color:m.color||r,...m}),c.add(h))}}),d),[]).sort((d,f)=>d.id.localeCompare(f.id))}const zg={nodeOrigin:[0,0],nodeExtent:pl,elevateNodesOnSelect:!0,defaults:{}},Sz={...zg,checkEquality:!0};function Ig(e,n){const r={...e};for(const a in n)n[a]!==void 0&&(r[a]=n[a]);return r}function _z(e,n,r){const a=Ig(zg,r);for(const l of e.values())if(l.parentId)Lg(l,e,n,a);else{const c=Rl(l,a.nodeOrigin),d=Oa(l.extent)?l.extent:a.nodeExtent,f=bo(c,d,Ws(l));l.internals.positionAbsolute=f}}function Sp(e,n,r,a){const l=Ig(Sz,a);let c=e.length>0;const d=new Map(n),f=l?.elevateNodesOnSelect?1e3:0;n.clear(),r.clear();for(const m of e){let h=d.get(m.id);if(l.checkEquality&&m===h?.internals.userNode)n.set(m.id,h);else{const g=Rl(m,l.nodeOrigin),x=Oa(m.extent)?m.extent:l.nodeExtent,y=bo(g,x,Ws(m));h={...l.defaults,...m,measured:{width:m.measured?.width,height:m.measured?.height},internals:{positionAbsolute:y,handleBounds:m.measured?h?.internals.handleBounds:void 0,z:tS(m,f),userNode:m}},n.set(m.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),m.parentId&&Lg(h,n,r,a)}return c}function Ez(e,n){if(!e.parentId)return;const r=n.get(e.parentId);r?r.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function Lg(e,n,r,a){const{elevateNodesOnSelect:l,nodeOrigin:c,nodeExtent:d}=Ig(zg,a),f=e.parentId,m=n.get(f);if(!m){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ez(e,r);const h=l?1e3:0,{x:g,y:x,z:y}=Cz(e,m,c,d,h),{positionAbsolute:b}=e.internals,j=g!==b.x||x!==b.y;(j||y!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:j?{x:g,y:x}:b,z:y}})}function tS(e,n){return(Gn(e.zIndex)?e.zIndex:0)+(e.selected?n:0)}function Cz(e,n,r,a,l){const{x:c,y:d}=n.internals.positionAbsolute,f=Ws(e),m=Rl(e,r),h=Oa(e.extent)?bo(m,e.extent,f):m;let g=bo({x:c+h.x,y:d+h.y},a,f);e.extent==="parent"&&(g=Vj(g,f,n));const x=tS(e,l),y=n.internals.z??0;return{x:g.x,y:g.y,z:y>=x?y+1:x}}function $g(e,n,r,a=[0,0]){const l=[],c=new Map;for(const d of e){const f=n.get(d.parentId);if(!f)continue;const m=c.get(d.parentId)?.expandedRect??Da(f),h=Fj(m,d.rect);c.set(d.parentId,{expandedRect:h,parent:f})}return c.size>0&&c.forEach(({expandedRect:d,parent:f},m)=>{const h=f.internals.positionAbsolute,g=Ws(f),x=f.origin??a,y=d.x<h.x?Math.round(Math.abs(h.x-d.x)):0,b=d.y<h.y?Math.round(Math.abs(h.y-d.y)):0,j=Math.max(g.width,Math.round(d.width)),N=Math.max(g.height,Math.round(d.height)),S=(j-g.width)*x[0],_=(N-g.height)*x[1];(y>0||b>0||S||_)&&(l.push({id:m,type:"position",position:{x:f.position.x-y+S,y:f.position.y-b+_}}),r.get(m)?.forEach(A=>{e.some(E=>E.id===A.id)||l.push({id:A.id,type:"position",position:{x:A.position.x+y,y:A.position.y+b}})})),(g.width<d.width||g.height<d.height||y||b)&&l.push({id:m,type:"dimensions",setAttributes:!0,dimensions:{width:j+(y?x[0]*y-S:0),height:N+(b?x[1]*b-_:0)}})}),l}function kz(e,n,r,a,l,c){const d=a?.querySelector(".xyflow__viewport");let f=!1;if(!d)return{changes:[],updatedInternals:f};const m=[],h=window.getComputedStyle(d),{m22:g}=new window.DOMMatrixReadOnly(h.transform),x=[];for(const y of e.values()){const b=n.get(y.id);if(!b)continue;if(b.hidden){n.set(b.id,{...b,internals:{...b.internals,handleBounds:void 0}}),f=!0;continue}const j=Og(y.nodeElement),N=b.measured.width!==j.width||b.measured.height!==j.height;if(!!(j.width&&j.height&&(N||!b.internals.handleBounds||y.force))){const _=y.nodeElement.getBoundingClientRect(),A=Oa(b.extent)?b.extent:c;let{positionAbsolute:E}=b.internals;b.parentId&&b.extent==="parent"?E=Vj(E,j,n.get(b.parentId)):A&&(E=bo(E,A,j));const M={...b,measured:j,internals:{...b.internals,positionAbsolute:E,handleBounds:{source:Ob("source",y.nodeElement,_,g,b.id),target:Ob("target",y.nodeElement,_,g,b.id)}}};n.set(b.id,M),b.parentId&&Lg(M,n,r,{nodeOrigin:l}),f=!0,N&&(m.push({id:b.id,type:"dimensions",dimensions:j}),b.expandParent&&b.parentId&&x.push({id:b.id,parentId:b.parentId,rect:Da(M,l)}))}}if(x.length>0){const y=$g(x,n,r,l);m.push(...y)}return{changes:m,updatedInternals:f}}async function Tz({delta:e,panZoom:n,transform:r,translateExtent:a,width:l,height:c}){if(!n||!e.x&&!e.y)return Promise.resolve(!1);const d=await n.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[l,c]],a),f=!!d&&(d.x!==r[0]||d.y!==r[1]||d.k!==r[2]);return Promise.resolve(f)}function Ub(e,n,r,a,l,c){let d=l;const f=a.get(d)||new Map;a.set(d,f.set(r,n)),d=`${l}-${e}`;const m=a.get(d)||new Map;if(a.set(d,m.set(r,n)),c){d=`${l}-${e}-${c}`;const h=a.get(d)||new Map;a.set(d,h.set(r,n))}}function nS(e,n,r){e.clear(),n.clear();for(const a of r){const{source:l,target:c,sourceHandle:d=null,targetHandle:f=null}=a,m={edgeId:a.id,source:l,target:c,sourceHandle:d,targetHandle:f},h=`${l}-${d}--${c}-${f}`,g=`${c}-${f}--${l}-${d}`;Ub("source",m,g,e,l,d),Ub("target",m,h,e,c,f),n.set(a.id,a)}}function sS(e,n){if(!e.parentId)return!1;const r=n.get(e.parentId);return r?r.selected?!0:sS(r,n):!1}function Bb(e,n,r){let a=e;do{if(a?.matches?.(n))return!0;if(a===r)return!1;a=a?.parentElement}while(a);return!1}function Az(e,n,r,a){const l=new Map;for(const[c,d]of e)if((d.selected||d.id===a)&&(!d.parentId||!sS(d,e))&&(d.draggable||n&&typeof d.draggable>"u")){const f=e.get(c);f&&l.set(c,{id:c,position:f.position||{x:0,y:0},distance:{x:r.x-f.internals.positionAbsolute.x,y:r.y-f.internals.positionAbsolute.y},extent:f.extent,parentId:f.parentId,origin:f.origin,expandParent:f.expandParent,internals:{positionAbsolute:f.internals.positionAbsolute||{x:0,y:0}},measured:{width:f.measured.width??0,height:f.measured.height??0}})}return l}function Rh({nodeId:e,dragItems:n,nodeLookup:r,dragging:a=!0}){const l=[];for(const[d,f]of n){const m=r.get(d)?.internals.userNode;m&&l.push({...m,position:f.position,dragging:a})}if(!e)return[l[0],l];const c=r.get(e)?.internals.userNode;return[c?{...c,position:n.get(e)?.position||c.position,dragging:a}:l[0],l]}function Mz({dragItems:e,snapGrid:n,x:r,y:a}){const l=e.values().next().value;if(!l)return null;const c={x:r-l.distance.x,y:a-l.distance.y},d=Ol(c,n);return{x:d.x-c.x,y:d.y-c.y}}function Rz({onNodeMouseDown:e,getStoreItems:n,onDragStart:r,onDrag:a,onDragStop:l}){let c={x:null,y:null},d=0,f=new Map,m=!1,h={x:0,y:0},g=null,x=!1,y=null,b=!1,j=!1,N=null;function S({noDragClassName:A,handleSelector:E,domNode:M,isSelectable:T,nodeId:D,nodeClickDistance:z=0}){y=Sn(M);function H({x:G,y:ne}){const{nodeLookup:B,nodeExtent:U,snapGrid:R,snapToGrid:L,nodeOrigin:I,onNodeDrag:P,onSelectionDrag:C,onError:$,updateNodePositions:Y}=n();c={x:G,y:ne};let V=!1;const J=f.size>1,ce=J&&U?wp(Dl(f)):null,fe=J&&L?Mz({dragItems:f,snapGrid:R,x:G,y:ne}):null;for(const[ee,ie]of f){if(!B.has(ee))continue;let ge={x:G-ie.distance.x,y:ne-ie.distance.y};L&&(ge=fe?{x:Math.round(ge.x+fe.x),y:Math.round(ge.y+fe.y)}:Ol(ge,R));let Ee=null;if(J&&U&&!ie.extent&&ce){const{positionAbsolute:ze}=ie.internals,re=ze.x-ce.x+U[0][0],Q=ze.x+ie.measured.width-ce.x2+U[1][0],me=ze.y-ce.y+U[0][1],be=ze.y+ie.measured.height-ce.y2+U[1][1];Ee=[[re,me],[Q,be]]}const{position:Ne,positionAbsolute:ve}=Bj({nodeId:ee,nextPosition:ge,nodeLookup:B,nodeExtent:Ee||U,nodeOrigin:I,onError:$});V=V||ie.position.x!==Ne.x||ie.position.y!==Ne.y,ie.position=Ne,ie.internals.positionAbsolute=ve}if(j=j||V,!!V&&(Y(f,!0),N&&(a||P||!D&&C))){const[ee,ie]=Rh({nodeId:D,dragItems:f,nodeLookup:B});a?.(N,f,ee,ie),P?.(N,ee,ie),D||C?.(N,ie)}}async function q(){if(!g)return;const{transform:G,panBy:ne,autoPanSpeed:B,autoPanOnNodeDrag:U}=n();if(!U){m=!1,cancelAnimationFrame(d);return}const[R,L]=qj(h,g,B);(R!==0||L!==0)&&(c.x=(c.x??0)-R/G[2],c.y=(c.y??0)-L/G[2],await ne({x:R,y:L})&&H(c)),d=requestAnimationFrame(q)}function X(G){const{nodeLookup:ne,multiSelectionActive:B,nodesDraggable:U,transform:R,snapGrid:L,snapToGrid:I,selectNodesOnDrag:P,onNodeDragStart:C,onSelectionDragStart:$,unselectNodesAndEdges:Y}=n();x=!0,(!P||!T)&&!B&&D&&(ne.get(D)?.selected||Y()),T&&P&&D&&e?.(D);const V=rl(G.sourceEvent,{transform:R,snapGrid:L,snapToGrid:I,containerBounds:g});if(c=V,f=Az(ne,U,V,D),f.size>0&&(r||C||!D&&$)){const[J,ce]=Rh({nodeId:D,dragItems:f,nodeLookup:ne});r?.(G.sourceEvent,f,J,ce),C?.(G.sourceEvent,J,ce),D||$?.(G.sourceEvent,ce)}}const W=wj().clickDistance(z).on("start",G=>{const{domNode:ne,nodeDragThreshold:B,transform:U,snapGrid:R,snapToGrid:L}=n();g=ne?.getBoundingClientRect()||null,b=!1,j=!1,N=G.sourceEvent,B===0&&X(G),c=rl(G.sourceEvent,{transform:U,snapGrid:R,snapToGrid:L,containerBounds:g}),h=us(G.sourceEvent,g)}).on("drag",G=>{const{autoPanOnNodeDrag:ne,transform:B,snapGrid:U,snapToGrid:R,nodeDragThreshold:L,nodeLookup:I}=n(),P=rl(G.sourceEvent,{transform:B,snapGrid:U,snapToGrid:R,containerBounds:g});if(N=G.sourceEvent,(G.sourceEvent.type==="touchmove"&&G.sourceEvent.touches.length>1||D&&!I.has(D))&&(b=!0),!b){if(!m&&ne&&x&&(m=!0,q()),!x){const C=P.xSnapped-(c.x??0),$=P.ySnapped-(c.y??0);Math.sqrt(C*C+$*$)>L&&X(G)}(c.x!==P.xSnapped||c.y!==P.ySnapped)&&f&&x&&(h=us(G.sourceEvent,g),H(P))}}).on("end",G=>{if(!(!x||b)&&(m=!1,x=!1,cancelAnimationFrame(d),f.size>0)){const{nodeLookup:ne,updateNodePositions:B,onNodeDragStop:U,onSelectionDragStop:R}=n();if(j&&(B(f,!1),j=!1),l||U||!D&&R){const[L,I]=Rh({nodeId:D,dragItems:f,nodeLookup:ne,dragging:!1});l?.(G.sourceEvent,f,L,I),U?.(G.sourceEvent,L,I),D||R?.(G.sourceEvent,I)}}}).filter(G=>{const ne=G.target;return!G.button&&(!A||!Bb(ne,`.${A}`,M))&&(!E||Bb(ne,E,M))});y.call(W)}function _(){y?.on(".drag",null)}return{update:S,destroy:_}}function Dz(e,n,r){const a=[],l={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const c of n.values())xl(l,Da(c))>0&&a.push(c);return a}const Oz=250;function zz(e,n,r,a){let l=[],c=1/0;const d=Dz(e,r,n+Oz);for(const f of d){const m=[...f.internals.handleBounds?.source??[],...f.internals.handleBounds?.target??[]];for(const h of m){if(a.nodeId===h.nodeId&&a.type===h.type&&a.id===h.id)continue;const{x:g,y:x}=vl(f,h,h.position,!0),y=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(x-e.y,2));y>n||(y<c?(l=[{...h,x:g,y:x}],c=y):y===c&&l.push({...h,x:g,y:x}))}}if(!l.length)return null;if(l.length>1){const f=a.type==="source"?"target":"source";return l.find(m=>m.type===f)??l[0]}return l[0]}function rS(e,n,r,a,l,c=!1){const d=a.get(e);if(!d)return null;const f=l==="strict"?d.internals.handleBounds?.[n]:[...d.internals.handleBounds?.source??[],...d.internals.handleBounds?.target??[]],m=(r?f?.find(h=>h.id===r):f?.[0])??null;return m&&c?{...m,...vl(d,m,m.position,!0)}:m}function oS(e,n){return e||(n?.classList.contains("target")?"target":n?.classList.contains("source")?"source":null)}function Iz(e,n){let r=null;return n?r=!0:e&&!n&&(r=!1),r}const aS=()=>!0;function Lz(e,{connectionMode:n,connectionRadius:r,handleId:a,nodeId:l,edgeUpdaterType:c,isTarget:d,domNode:f,nodeLookup:m,lib:h,autoPanOnConnect:g,flowId:x,panBy:y,cancelConnection:b,onConnectStart:j,onConnect:N,onConnectEnd:S,isValidConnection:_=aS,onReconnectEnd:A,updateConnection:E,getTransform:M,getFromHandle:T,autoPanSpeed:D,dragThreshold:z=1,handleDomNode:H}){const q=Xj(e.target);let X=0,W;const{x:G,y:ne}=us(e),B=oS(c,H),U=f?.getBoundingClientRect();let R=!1;if(!U||!B)return;const L=rS(l,B,a,m,n);if(!L)return;let I=us(e,U),P=!1,C=null,$=!1,Y=null;function V(){if(!g||!U)return;const[Ne,ve]=qj(I,U,D);y({x:Ne,y:ve}),X=requestAnimationFrame(V)}const J={...L,nodeId:l,type:B,position:L.position},ce=m.get(l);let ee={inProgress:!0,isValid:null,from:vl(ce,J,Ue.Left,!0),fromHandle:J,fromPosition:J.position,fromNode:ce,to:I,toHandle:null,toPosition:Ab[J.position],toNode:null};function ie(){R=!0,E(ee),j?.(e,{nodeId:l,handleId:a,handleType:B})}z===0&&ie();function ge(Ne){if(!R){const{x:Q,y:me}=us(Ne),be=Q-G,Ce=me-ne;if(!(be*be+Ce*Ce>z*z))return;ie()}if(!T()||!J){Ee(Ne);return}const ve=M();I=us(Ne,U),W=zz(zl(I,ve,!1,[1,1]),r,m,J),P||(V(),P=!0);const ze=iS(Ne,{handle:W,connectionMode:n,fromNodeId:l,fromHandleId:a,fromType:d?"target":"source",isValidConnection:_,doc:q,lib:h,flowId:x,nodeLookup:m});Y=ze.handleDomNode,C=ze.connection,$=Iz(!!W,ze.isValid);const re={...ee,isValid:$,to:ze.toHandle&&$?rd({x:ze.toHandle.x,y:ze.toHandle.y},ve):I,toHandle:ze.toHandle,toPosition:$&&ze.toHandle?ze.toHandle.position:Ab[J.position],toNode:ze.toHandle?m.get(ze.toHandle.nodeId):null};$&&W&&ee.toHandle&&re.toHandle&&ee.toHandle.type===re.toHandle.type&&ee.toHandle.nodeId===re.toHandle.nodeId&&ee.toHandle.id===re.toHandle.id&&ee.to.x===re.to.x&&ee.to.y===re.to.y||(E(re),ee=re)}function Ee(Ne){if(R){(W||Y)&&C&&$&&N?.(C);const{inProgress:ve,...ze}=ee,re={...ze,toPosition:ee.toHandle?ee.toPosition:null};S?.(Ne,re),c&&A?.(Ne,re)}b(),cancelAnimationFrame(X),P=!1,$=!1,C=null,Y=null,q.removeEventListener("mousemove",ge),q.removeEventListener("mouseup",Ee),q.removeEventListener("touchmove",ge),q.removeEventListener("touchend",Ee)}q.addEventListener("mousemove",ge),q.addEventListener("mouseup",Ee),q.addEventListener("touchmove",ge),q.addEventListener("touchend",Ee)}function iS(e,{handle:n,connectionMode:r,fromNodeId:a,fromHandleId:l,fromType:c,doc:d,lib:f,flowId:m,isValidConnection:h=aS,nodeLookup:g}){const x=c==="target",y=n?d.querySelector(`.${f}-flow__handle[data-id="${m}-${n?.nodeId}-${n?.id}-${n?.type}"]`):null,{x:b,y:j}=us(e),N=d.elementFromPoint(b,j),S=N?.classList.contains(`${f}-flow__handle`)?N:y,_={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const A=oS(void 0,S),E=S.getAttribute("data-nodeid"),M=S.getAttribute("data-handleid"),T=S.classList.contains("connectable"),D=S.classList.contains("connectableend");if(!E||!A)return _;const z={source:x?E:a,sourceHandle:x?M:l,target:x?a:E,targetHandle:x?l:M};_.connection=z;const q=T&&D&&(r===Ma.Strict?x&&A==="source"||!x&&A==="target":E!==a||M!==l);_.isValid=q&&h(z),_.toHandle=rS(E,A,M,g,r,!0)}return _}const _p={onPointerDown:Lz,isValid:iS};function $z({domNode:e,panZoom:n,getTransform:r,getViewScale:a}){const l=Sn(e);function c({translateExtent:f,width:m,height:h,zoomStep:g=1,pannable:x=!0,zoomable:y=!0,inversePan:b=!1}){const j=E=>{if(E.sourceEvent.type!=="wheel"||!n)return;const M=r(),T=E.sourceEvent.ctrlKey&&yl()?10:1,D=-E.sourceEvent.deltaY*(E.sourceEvent.deltaMode===1?.05:E.sourceEvent.deltaMode?1:.002)*g,z=M[2]*Math.pow(2,D*T);n.scaleTo(z)};let N=[0,0];const S=E=>{(E.sourceEvent.type==="mousedown"||E.sourceEvent.type==="touchstart")&&(N=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY])},_=E=>{const M=r();if(E.sourceEvent.type!=="mousemove"&&E.sourceEvent.type!=="touchmove"||!n)return;const T=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY],D=[T[0]-N[0],T[1]-N[1]];N=T;const z=a()*Math.max(M[2],Math.log(M[2]))*(b?-1:1),H={x:M[0]-D[0]*z,y:M[1]-D[1]*z},q=[[0,0],[m,h]];n.setViewportConstrained({x:H.x,y:H.y,zoom:M[2]},q,f)},A=Ij().on("start",S).on("zoom",x?_:null).on("zoom.wheel",y?j:null);l.call(A,{})}function d(){l.on("zoom",null)}return{update:c,destroy:d,pointer:Fn}}const Pz=(e,n)=>e.x!==n.x||e.y!==n.y||e.zoom!==n.k,Hd=e=>({x:e.x,y:e.y,zoom:e.k}),Dh=({x:e,y:n,zoom:r})=>Ld.translate(e,n).scale(r),pa=(e,n)=>e.target.closest(`.${n}`),lS=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),Hz=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Oh=(e,n=0,r=Hz,a=()=>{})=>{const l=typeof n=="number"&&n>0;return l||a(),l?e.transition().duration(n).ease(r).on("end",a):e},cS=e=>{const n=e.ctrlKey&&yl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function Uz({zoomPanValues:e,noWheelClassName:n,d3Selection:r,d3Zoom:a,panOnScrollMode:l,panOnScrollSpeed:c,zoomOnPinch:d,onPanZoomStart:f,onPanZoom:m,onPanZoomEnd:h}){return g=>{if(pa(g,n))return!1;g.preventDefault(),g.stopImmediatePropagation();const x=r.property("__zoom").k||1;if(g.ctrlKey&&d){const S=Fn(g),_=cS(g),A=x*Math.pow(2,_);a.scaleTo(r,A,S,g);return}const y=g.deltaMode===1?20:1;let b=l===ho.Vertical?0:g.deltaX*y,j=l===ho.Horizontal?0:g.deltaY*y;!yl()&&g.shiftKey&&l!==ho.Vertical&&(b=g.deltaY*y,j=0),a.translateBy(r,-(b/x)*c,-(j/x)*c,{internal:!0});const N=Hd(r.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,f?.(g,N)),e.isPanScrolling&&(m?.(g,N),e.panScrollTimeout=setTimeout(()=>{h?.(g,N),e.isPanScrolling=!1},150))}}function Bz({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:r}){return function(a,l){const c=a.type==="wheel",d=!n&&c&&!a.ctrlKey,f=pa(a,e);if(a.ctrlKey&&c&&f&&a.preventDefault(),d||f)return null;a.preventDefault(),r.call(this,a,l)}}function Vz({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:r}){return a=>{if(a.sourceEvent?.internal)return;const l=Hd(a.transform);e.mouseButton=a.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=l,a.sourceEvent?.type==="mousedown"&&n(!0),r&&r?.(a.sourceEvent,l)}}function qz({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:r,onTransformChange:a,onPanZoom:l}){return c=>{e.usedRightMouseButton=!!(r&&lS(n,e.mouseButton??0)),c.sourceEvent?.sync||a([c.transform.x,c.transform.y,c.transform.k]),l&&!c.sourceEvent?.internal&&l?.(c.sourceEvent,Hd(c.transform))}}function Fz({zoomPanValues:e,panOnDrag:n,panOnScroll:r,onDraggingChange:a,onPanZoomEnd:l,onPaneContextMenu:c}){return d=>{if(!d.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,c&&lS(n,e.mouseButton??0)&&!e.usedRightMouseButton&&d.sourceEvent&&c(d.sourceEvent),e.usedRightMouseButton=!1,a(!1),l&&Pz(e.prevViewport,d.transform))){const f=Hd(d.transform);e.prevViewport=f,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{l?.(d.sourceEvent,f)},r?150:0)}}}function Yz({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:a,panOnScroll:l,zoomOnDoubleClick:c,userSelectionActive:d,noWheelClassName:f,noPanClassName:m,lib:h}){return g=>{const x=e||n,y=r&&g.ctrlKey;if(g.button===1&&g.type==="mousedown"&&(pa(g,`${h}-flow__node`)||pa(g,`${h}-flow__edge`)))return!0;if(!a&&!x&&!l&&!c&&!r||d||pa(g,f)&&g.type==="wheel"||pa(g,m)&&(g.type!=="wheel"||l&&g.type==="wheel"&&!e)||!r&&g.ctrlKey&&g.type==="wheel")return!1;if(!r&&g.type==="touchstart"&&g.touches?.length>1)return g.preventDefault(),!1;if(!x&&!l&&!y&&g.type==="wheel"||!a&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(a)&&!a.includes(g.button)&&g.type==="mousedown")return!1;const b=Array.isArray(a)&&a.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||g.type==="wheel")&&b}}function Gz({domNode:e,minZoom:n,maxZoom:r,paneClickDistance:a,translateExtent:l,viewport:c,onPanZoom:d,onPanZoomStart:f,onPanZoomEnd:m,onDraggingChange:h}){const g={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},x=e.getBoundingClientRect(),y=Ij().clickDistance(!Gn(a)||a<0?0:a).scaleExtent([n,r]).translateExtent(l),b=Sn(e).call(y);E({x:c.x,y:c.y,zoom:Ra(c.zoom,n,r)},[[0,0],[x.width,x.height]],l);const j=b.on("wheel.zoom"),N=b.on("dblclick.zoom");y.wheelDelta(cS);function S(G,ne){return b?new Promise(B=>{y?.interpolate(ne?.interpolate==="linear"?sl:Tu).transform(Oh(b,ne?.duration,ne?.ease,()=>B(!0)),G)}):Promise.resolve(!1)}function _({noWheelClassName:G,noPanClassName:ne,onPaneContextMenu:B,userSelectionActive:U,panOnScroll:R,panOnDrag:L,panOnScrollMode:I,panOnScrollSpeed:P,preventScrolling:C,zoomOnPinch:$,zoomOnScroll:Y,zoomOnDoubleClick:V,zoomActivationKeyPressed:J,lib:ce,onTransformChange:fe}){U&&!g.isZoomingOrPanning&&A();const ie=R&&!J&&!U?Uz({zoomPanValues:g,noWheelClassName:G,d3Selection:b,d3Zoom:y,panOnScrollMode:I,panOnScrollSpeed:P,zoomOnPinch:$,onPanZoomStart:f,onPanZoom:d,onPanZoomEnd:m}):Bz({noWheelClassName:G,preventScrolling:C,d3ZoomHandler:j});if(b.on("wheel.zoom",ie,{passive:!1}),!U){const Ee=Vz({zoomPanValues:g,onDraggingChange:h,onPanZoomStart:f});y.on("start",Ee);const Ne=qz({zoomPanValues:g,panOnDrag:L,onPaneContextMenu:!!B,onPanZoom:d,onTransformChange:fe});y.on("zoom",Ne);const ve=Fz({zoomPanValues:g,panOnDrag:L,panOnScroll:R,onPaneContextMenu:B,onPanZoomEnd:m,onDraggingChange:h});y.on("end",ve)}const ge=Yz({zoomActivationKeyPressed:J,panOnDrag:L,zoomOnScroll:Y,panOnScroll:R,zoomOnDoubleClick:V,zoomOnPinch:$,userSelectionActive:U,noPanClassName:ne,noWheelClassName:G,lib:ce});y.filter(ge),V?b.on("dblclick.zoom",N):b.on("dblclick.zoom",null)}function A(){y.on("zoom",null)}async function E(G,ne,B){const U=Dh(G),R=y?.constrain()(U,ne,B);return R&&await S(R),new Promise(L=>L(R))}async function M(G,ne){const B=Dh(G);return await S(B,ne),new Promise(U=>U(B))}function T(G){if(b){const ne=Dh(G),B=b.property("__zoom");(B.k!==G.zoom||B.x!==G.x||B.y!==G.y)&&y?.transform(b,ne,null,{sync:!0})}}function D(){const G=b?zj(b.node()):{x:0,y:0,k:1};return{x:G.x,y:G.y,zoom:G.k}}function z(G,ne){return b?new Promise(B=>{y?.interpolate(ne?.interpolate==="linear"?sl:Tu).scaleTo(Oh(b,ne?.duration,ne?.ease,()=>B(!0)),G)}):Promise.resolve(!1)}function H(G,ne){return b?new Promise(B=>{y?.interpolate(ne?.interpolate==="linear"?sl:Tu).scaleBy(Oh(b,ne?.duration,ne?.ease,()=>B(!0)),G)}):Promise.resolve(!1)}function q(G){y?.scaleExtent(G)}function X(G){y?.translateExtent(G)}function W(G){const ne=!Gn(G)||G<0?0:G;y?.clickDistance(ne)}return{update:_,destroy:A,setViewport:M,setViewportConstrained:E,getViewport:D,scaleTo:z,scaleBy:H,setScaleExtent:q,setTranslateExtent:X,syncViewport:T,setClickDistance:W}}var za;(function(e){e.Line="line",e.Handle="handle"})(za||(za={}));function Xz({width:e,prevWidth:n,height:r,prevHeight:a,affectsX:l,affectsY:c}){const d=e-n,f=r-a,m=[d>0?1:d<0?-1:0,f>0?1:f<0?-1:0];return d&&l&&(m[0]=m[0]*-1),f&&c&&(m[1]=m[1]*-1),m}function Zz(e){const n=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),a=e.includes("left"),l=e.includes("top");return{isHorizontal:n,isVertical:r,affectsX:a,affectsY:l}}function Sr(e,n){return Math.max(0,n-e)}function _r(e,n){return Math.max(0,e-n)}function hu(e,n,r){return Math.max(0,n-e,e-r)}function Vb(e,n){return e?!n:n}function Wz(e,n,r,a,l,c,d,f){let{affectsX:m,affectsY:h}=n;const{isHorizontal:g,isVertical:x}=n,y=g&&x,{xSnapped:b,ySnapped:j}=r,{minWidth:N,maxWidth:S,minHeight:_,maxHeight:A}=a,{x:E,y:M,width:T,height:D,aspectRatio:z}=e;let H=Math.floor(g?b-e.pointerX:0),q=Math.floor(x?j-e.pointerY:0);const X=T+(m?-H:H),W=D+(h?-q:q),G=-c[0]*T,ne=-c[1]*D;let B=hu(X,N,S),U=hu(W,_,A);if(d){let I=0,P=0;m&&H<0?I=Sr(E+H+G,d[0][0]):!m&&H>0&&(I=_r(E+X+G,d[1][0])),h&&q<0?P=Sr(M+q+ne,d[0][1]):!h&&q>0&&(P=_r(M+W+ne,d[1][1])),B=Math.max(B,I),U=Math.max(U,P)}if(f){let I=0,P=0;m&&H>0?I=_r(E+H,f[0][0]):!m&&H<0&&(I=Sr(E+X,f[1][0])),h&&q>0?P=_r(M+q,f[0][1]):!h&&q<0&&(P=Sr(M+W,f[1][1])),B=Math.max(B,I),U=Math.max(U,P)}if(l){if(g){const I=hu(X/z,_,A)*z;if(B=Math.max(B,I),d){let P=0;!m&&!h||m&&!h&&y?P=_r(M+ne+X/z,d[1][1])*z:P=Sr(M+ne+(m?H:-H)/z,d[0][1])*z,B=Math.max(B,P)}if(f){let P=0;!m&&!h||m&&!h&&y?P=Sr(M+X/z,f[1][1])*z:P=_r(M+(m?H:-H)/z,f[0][1])*z,B=Math.max(B,P)}}if(x){const I=hu(W*z,N,S)/z;if(U=Math.max(U,I),d){let P=0;!m&&!h||h&&!m&&y?P=_r(E+W*z+G,d[1][0])/z:P=Sr(E+(h?q:-q)*z+G,d[0][0])/z,U=Math.max(U,P)}if(f){let P=0;!m&&!h||h&&!m&&y?P=Sr(E+W*z,f[1][0])/z:P=_r(E+(h?q:-q)*z,f[0][0])/z,U=Math.max(U,P)}}}q=q+(q<0?U:-U),H=H+(H<0?B:-B),l&&(y?X>W*z?q=(Vb(m,h)?-H:H)/z:H=(Vb(m,h)?-q:q)*z:g?(q=H/z,h=m):(H=q*z,m=h));const R=m?E+H:E,L=h?M+q:M;return{width:T+(m?-H:H),height:D+(h?-q:q),x:c[0]*H*(m?-1:1)+R,y:c[1]*q*(h?-1:1)+L}}const uS={width:0,height:0,x:0,y:0},Kz={...uS,pointerX:0,pointerY:0,aspectRatio:1};function Qz(e){return[[0,0],[e.measured.width,e.measured.height]]}function Jz(e,n,r){const a=n.position.x+e.position.x,l=n.position.y+e.position.y,c=e.measured.width??0,d=e.measured.height??0,f=r[0]*c,m=r[1]*d;return[[a-f,l-m],[a+c-f,l+d-m]]}function eI({domNode:e,nodeId:n,getStoreItems:r,onChange:a,onEnd:l}){const c=Sn(e);function d({controlPosition:m,boundaries:h,keepAspectRatio:g,resizeDirection:x,onResizeStart:y,onResize:b,onResizeEnd:j,shouldResize:N}){let S={...uS},_={...Kz};const A=Zz(m);let E,M=null,T=[],D,z,H;const q=wj().on("start",X=>{const{nodeLookup:W,transform:G,snapGrid:ne,snapToGrid:B,nodeOrigin:U,paneDomNode:R}=r();if(E=W.get(n),!E)return;M=R?.getBoundingClientRect()??null;const{xSnapped:L,ySnapped:I}=rl(X.sourceEvent,{transform:G,snapGrid:ne,snapToGrid:B,containerBounds:M});S={width:E.measured.width??0,height:E.measured.height??0,x:E.position.x??0,y:E.position.y??0},_={...S,pointerX:L,pointerY:I,aspectRatio:S.width/S.height},D=void 0,E.parentId&&(E.extent==="parent"||E.expandParent)&&(D=W.get(E.parentId),z=D&&E.extent==="parent"?Qz(D):void 0),T=[],H=void 0;for(const[P,C]of W)if(C.parentId===n&&(T.push({id:P,position:{...C.position},extent:C.extent}),C.extent==="parent"||C.expandParent)){const $=Jz(C,E,C.origin??U);H?H=[[Math.min($[0][0],H[0][0]),Math.min($[0][1],H[0][1])],[Math.max($[1][0],H[1][0]),Math.max($[1][1],H[1][1])]]:H=$}y?.(X,{...S})}).on("drag",X=>{const{transform:W,snapGrid:G,snapToGrid:ne,nodeOrigin:B}=r(),U=rl(X.sourceEvent,{transform:W,snapGrid:G,snapToGrid:ne,containerBounds:M}),R=[];if(!E)return;const{x:L,y:I,width:P,height:C}=S,$={},Y=E.origin??B,{width:V,height:J,x:ce,y:fe}=Wz(_,A,U,h,g,Y,z,H),ee=V!==P,ie=J!==C,ge=ce!==L&&ee,Ee=fe!==I&&ie;if(!ge&&!Ee&&!ee&&!ie)return;if((ge||Ee||Y[0]===1||Y[1]===1)&&($.x=ge?ce:S.x,$.y=Ee?fe:S.y,S.x=$.x,S.y=$.y,T.length>0)){const re=ce-L,Q=fe-I;for(const me of T)me.position={x:me.position.x-re+Y[0]*(V-P),y:me.position.y-Q+Y[1]*(J-C)},R.push(me)}if((ee||ie)&&($.width=ee&&(!x||x==="horizontal")?V:S.width,$.height=ie&&(!x||x==="vertical")?J:S.height,S.width=$.width,S.height=$.height),D&&E.expandParent){const re=Y[0]*($.width??0);$.x&&$.x<re&&(S.x=re,_.x=_.x-($.x-re));const Q=Y[1]*($.height??0);$.y&&$.y<Q&&(S.y=Q,_.y=_.y-($.y-Q))}const Ne=Xz({width:S.width,prevWidth:P,height:S.height,prevHeight:C,affectsX:A.affectsX,affectsY:A.affectsY}),ve={...S,direction:Ne};N?.(X,ve)!==!1&&(b?.(X,ve),a($,R))}).on("end",X=>{j?.(X,{...S}),l?.({...S})});c.call(q)}function f(){c.on(".drag",null)}return{update:d,destroy:f}}var zh={exports:{}},Ih={},Lh={exports:{}},$h={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var qb;function tI(){if(qb)return $h;qb=1;var e=wl();function n(x,y){return x===y&&(x!==0||1/x===1/y)||x!==x&&y!==y}var r=typeof Object.is=="function"?Object.is:n,a=e.useState,l=e.useEffect,c=e.useLayoutEffect,d=e.useDebugValue;function f(x,y){var b=y(),j=a({inst:{value:b,getSnapshot:y}}),N=j[0].inst,S=j[1];return c(function(){N.value=b,N.getSnapshot=y,m(N)&&S({inst:N})},[x,b,y]),l(function(){return m(N)&&S({inst:N}),x(function(){m(N)&&S({inst:N})})},[x]),d(b),b}function m(x){var y=x.getSnapshot;x=x.value;try{var b=y();return!r(x,b)}catch{return!0}}function h(x,y){return y()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return $h.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,$h}var Fb;function nI(){return Fb||(Fb=1,Lh.exports=tI()),Lh.exports}/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Yb;function sI(){if(Yb)return Ih;Yb=1;var e=wl(),n=nI();function r(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var a=typeof Object.is=="function"?Object.is:r,l=n.useSyncExternalStore,c=e.useRef,d=e.useEffect,f=e.useMemo,m=e.useDebugValue;return Ih.useSyncExternalStoreWithSelector=function(h,g,x,y,b){var j=c(null);if(j.current===null){var N={hasValue:!1,value:null};j.current=N}else N=j.current;j=f(function(){function _(D){if(!A){if(A=!0,E=D,D=y(D),b!==void 0&&N.hasValue){var z=N.value;if(b(z,D))return M=z}return M=D}if(z=M,a(E,D))return z;var H=y(D);return b!==void 0&&b(z,H)?(E=D,z):(E=D,M=H)}var A=!1,E,M,T=x===void 0?null:x;return[function(){return _(g())},T===null?void 0:function(){return _(T())}]},[g,x,y,b]);var S=l(h,j[0],j[1]);return d(function(){N.hasValue=!0,N.value=S},[S]),m(S),S},Ih}var Gb;function rI(){return Gb||(Gb=1,zh.exports=sI()),zh.exports}var oI=rI();const aI=Cp(oI),iI={},Xb=e=>{let n;const r=new Set,a=(g,x)=>{const y=typeof g=="function"?g(n):g;if(!Object.is(y,n)){const b=n;n=x??(typeof y!="object"||y===null)?y:Object.assign({},n,y),r.forEach(j=>j(n,b))}},l=()=>n,m={setState:a,getState:l,getInitialState:()=>h,subscribe:g=>(r.add(g),()=>r.delete(g)),destroy:()=>{(iI?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},h=n=e(a,l,m);return m},lI=e=>e?Xb(e):Xb,{useDebugValue:cI}=Nn,{useSyncExternalStoreWithSelector:uI}=aI,dI=e=>e;function dS(e,n=dI,r){const a=uI(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,r);return cI(a),a}const Zb=(e,n)=>{const r=lI(e),a=(l,c=n)=>dS(r,l,c);return Object.assign(a,r),a},fI=(e,n)=>e?Zb(e,n):Zb;function bt(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[a,l]of e)if(!Object.is(l,n.get(a)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const a of e)if(!n.has(a))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(const a of r)if(!Object.prototype.hasOwnProperty.call(n,a)||!Object.is(e[a],n[a]))return!1;return!0}const Ud=w.createContext(null),mI=Ud.Provider,fS=ps.error001();function at(e,n){const r=w.useContext(Ud);if(r===null)throw new Error(fS);return dS(r,e,n)}function wt(){const e=w.useContext(Ud);if(e===null)throw new Error(fS);return w.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Wb={display:"none"},hI={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},mS="react-flow__node-desc",hS="react-flow__edge-desc",pI="react-flow__aria-live",gI=e=>e.ariaLiveMessage,xI=e=>e.ariaLabelConfig;function yI({rfId:e}){const n=at(gI);return o.jsx("div",{id:`${pI}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:hI,children:n})}function vI({rfId:e,disableKeyboardA11y:n}){const r=at(xI);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${mS}-${e}`,style:Wb,children:n?r["node.a11yDescription.default"]:r["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${hS}-${e}`,style:Wb,children:r["edge.a11yDescription.default"]}),!n&&o.jsx(yI,{rfId:e})]})}const Bd=w.forwardRef(({position:e="top-left",children:n,className:r,style:a,...l},c)=>{const d=`${e}`.split("-");return o.jsx("div",{className:Dt(["react-flow__panel",r,...d]),style:a,ref:c,...l,children:n})});Bd.displayName="Panel";function bI({proOptions:e,position:n="bottom-right"}){return e?.hideAttribution?null:o.jsx(Bd,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const wI=e=>{const n=[],r=[];for(const[,a]of e.nodeLookup)a.selected&&n.push(a.internals.userNode);for(const[,a]of e.edgeLookup)a.selected&&r.push(a);return{selectedNodes:n,selectedEdges:r}},pu=e=>e.id;function NI(e,n){return bt(e.selectedNodes.map(pu),n.selectedNodes.map(pu))&&bt(e.selectedEdges.map(pu),n.selectedEdges.map(pu))}function jI({onSelectionChange:e}){const n=wt(),{selectedNodes:r,selectedEdges:a}=at(wI,NI);return w.useEffect(()=>{const l={nodes:r,edges:a};e?.(l),n.getState().onSelectionChangeHandlers.forEach(c=>c(l))},[r,a,e]),null}const SI=e=>!!e.onSelectionChangeHandlers;function _I({onSelectionChange:e}){const n=at(SI);return e||n?o.jsx(jI,{onSelectionChange:e}):null}const pS=[0,0],EI={x:0,y:0,zoom:1},CI=["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","paneClickDistance","ariaLabelConfig"],Kb=[...CI,"rfId"],kI=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setPaneClickDistance:e.setPaneClickDistance}),Qb={translateExtent:pl,nodeOrigin:pS,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function TI(e){const{setNodes:n,setEdges:r,setMinZoom:a,setMaxZoom:l,setTranslateExtent:c,setNodeExtent:d,reset:f,setDefaultNodesAndEdges:m,setPaneClickDistance:h}=at(kI,bt),g=wt();w.useEffect(()=>(m(e.defaultNodes,e.defaultEdges),()=>{x.current=Qb,f()}),[]);const x=w.useRef(Qb);return w.useEffect(()=>{for(const y of Kb){const b=e[y],j=x.current[y];b!==j&&(typeof e[y]>"u"||(y==="nodes"?n(b):y==="edges"?r(b):y==="minZoom"?a(b):y==="maxZoom"?l(b):y==="translateExtent"?c(b):y==="nodeExtent"?d(b):y==="paneClickDistance"?h(b):y==="ariaLabelConfig"?g.setState({ariaLabelConfig:fz(b)}):y==="fitView"?g.setState({fitViewQueued:b}):y==="fitViewOptions"?g.setState({fitViewOptions:b}):g.setState({[y]:b})))}x.current=e},Kb.map(y=>e[y])),null}function Jb(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function AI(e){const[n,r]=w.useState(e==="system"?null:e);return w.useEffect(()=>{if(e!=="system"){r(e);return}const a=Jb(),l=()=>r(a?.matches?"dark":"light");return l(),a?.addEventListener("change",l),()=>{a?.removeEventListener("change",l)}},[e]),n!==null?n:Jb()?.matches?"dark":"light"}const ew=typeof document<"u"?document:null;function bl(e=null,n={target:ew,actInsideInputWithModifier:!0}){const[r,a]=w.useState(!1),l=w.useRef(!1),c=w.useRef(new Set([])),[d,f]=w.useMemo(()=>{if(e!==null){const h=(Array.isArray(e)?e:[e]).filter(x=>typeof x=="string").map(x=>x.replace("+",`
`).replace(`

`,`
+`).split(`
`)),g=h.reduce((x,y)=>x.concat(...y),[]);return[h,g]}return[[],[]]},[e]);return w.useEffect(()=>{const m=n?.target??ew,h=n?.actInsideInputWithModifier??!0;if(e!==null){const g=b=>{if(l.current=b.ctrlKey||b.metaKey||b.shiftKey||b.altKey,(!l.current||l.current&&!h)&&Zj(b))return!1;const N=nw(b.code,f);if(c.current.add(b[N]),tw(d,c.current,!1)){const S=b.composedPath?.()?.[0]||b.target,_=S?.nodeName==="BUTTON"||S?.nodeName==="A";n.preventDefault!==!1&&(l.current||!_)&&b.preventDefault(),a(!0)}},x=b=>{const j=nw(b.code,f);tw(d,c.current,!0)?(a(!1),c.current.clear()):c.current.delete(b[j]),b.key==="Meta"&&c.current.clear(),l.current=!1},y=()=>{c.current.clear(),a(!1)};return m?.addEventListener("keydown",g),m?.addEventListener("keyup",x),window.addEventListener("blur",y),window.addEventListener("contextmenu",y),()=>{m?.removeEventListener("keydown",g),m?.removeEventListener("keyup",x),window.removeEventListener("blur",y),window.removeEventListener("contextmenu",y)}}},[e,a]),r}function tw(e,n,r){return e.filter(a=>r||a.length===n.size).some(a=>a.every(l=>n.has(l)))}function nw(e,n){return n.includes(e)?"code":"key"}const MI=()=>{const e=wt();return w.useMemo(()=>({zoomIn:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1.2,{duration:n?.duration}):Promise.resolve(!1)},zoomOut:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1/1.2,{duration:n?.duration}):Promise.resolve(!1)},zoomTo:(n,r)=>{const{panZoom:a}=e.getState();return a?a.scaleTo(n,{duration:r?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(n,r)=>{const{transform:[a,l,c],panZoom:d}=e.getState();return d?(await d.setViewport({x:n.x??a,y:n.y??l,zoom:n.zoom??c},r),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[n,r,a]=e.getState().transform;return{x:n,y:r,zoom:a}},setCenter:async(n,r,a)=>e.getState().setCenter(n,r,a),fitBounds:async(n,r)=>{const{width:a,height:l,minZoom:c,maxZoom:d,panZoom:f}=e.getState(),m=Dg(n,a,l,c,d,r?.padding??.1);return f?(await f.setViewport(m,{duration:r?.duration,ease:r?.ease,interpolate:r?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(n,r={})=>{const{transform:a,snapGrid:l,snapToGrid:c,domNode:d}=e.getState();if(!d)return n;const{x:f,y:m}=d.getBoundingClientRect(),h={x:n.x-f,y:n.y-m},g=r.snapGrid??l,x=r.snapToGrid??c;return zl(h,a,x,g)},flowToScreenPosition:n=>{const{transform:r,domNode:a}=e.getState();if(!a)return n;const{x:l,y:c}=a.getBoundingClientRect(),d=rd(n,r);return{x:d.x+l,y:d.y+c}}}),[])};function gS(e,n){const r=[],a=new Map,l=[];for(const c of e)if(c.type==="add"){l.push(c);continue}else if(c.type==="remove"||c.type==="replace")a.set(c.id,[c]);else{const d=a.get(c.id);d?d.push(c):a.set(c.id,[c])}for(const c of n){const d=a.get(c.id);if(!d){r.push(c);continue}if(d[0].type==="remove")continue;if(d[0].type==="replace"){r.push({...d[0].item});continue}const f={...c};for(const m of d)RI(m,f);r.push(f)}return l.length&&l.forEach(c=>{c.index!==void 0?r.splice(c.index,0,{...c.item}):r.push({...c.item})}),r}function RI(e,n){switch(e.type){case"select":{n.selected=e.selected;break}case"position":{typeof e.position<"u"&&(n.position=e.position),typeof e.dragging<"u"&&(n.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(n.measured??={},n.measured.width=e.dimensions.width,n.measured.height=e.dimensions.height,e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(n.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(n.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(n.resizing=e.resizing);break}}}function xS(e,n){return gS(e,n)}function yS(e,n){return gS(e,n)}function lo(e,n){return{id:e,type:"select",selected:n}}function ga(e,n=new Set,r=!1){const a=[];for(const[l,c]of e){const d=n.has(l);!(c.selected===void 0&&!d)&&c.selected!==d&&(r&&(c.selected=d),a.push(lo(c.id,d)))}return a}function sw({items:e=[],lookup:n}){const r=[],a=new Map(e.map(l=>[l.id,l]));for(const[l,c]of e.entries()){const d=n.get(c.id),f=d?.internals?.userNode??d;f!==void 0&&f!==c&&r.push({id:c.id,item:c,type:"replace"}),f===void 0&&r.push({item:c,type:"add",index:l})}for(const[l]of n)a.get(l)===void 0&&r.push({id:l,type:"remove"});return r}function rw(e){return{id:e.id,type:"remove"}}const ow=e=>nz(e),DI=e=>Uj(e);function vS(e){return w.forwardRef(e)}const OI=typeof window<"u"?w.useLayoutEffect:w.useEffect;function aw(e){const[n,r]=w.useState(BigInt(0)),[a]=w.useState(()=>zI(()=>r(l=>l+BigInt(1))));return OI(()=>{const l=a.get();l.length&&(e(l),a.reset())},[n]),a}function zI(e){let n=[];return{get:()=>n,reset:()=>{n=[]},push:r=>{n.push(r),e()}}}const bS=w.createContext(null);function II({children:e}){const n=wt(),r=w.useCallback(f=>{const{nodes:m=[],setNodes:h,hasDefaultNodes:g,onNodesChange:x,nodeLookup:y,fitViewQueued:b}=n.getState();let j=m;for(const S of f)j=typeof S=="function"?S(j):S;const N=sw({items:j,lookup:y});g&&h(j),N.length>0?x?.(N):b&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:_,setNodes:A}=n.getState();S&&A(_)})},[]),a=aw(r),l=w.useCallback(f=>{const{edges:m=[],setEdges:h,hasDefaultEdges:g,onEdgesChange:x,edgeLookup:y}=n.getState();let b=m;for(const j of f)b=typeof j=="function"?j(b):j;g?h(b):x&&x(sw({items:b,lookup:y}))},[]),c=aw(l),d=w.useMemo(()=>({nodeQueue:a,edgeQueue:c}),[]);return o.jsx(bS.Provider,{value:d,children:e})}function LI(){const e=w.useContext(bS);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const $I=e=>!!e.panZoom;function Va(){const e=MI(),n=wt(),r=LI(),a=at($I),l=w.useMemo(()=>{const c=x=>n.getState().nodeLookup.get(x),d=x=>{r.nodeQueue.push(x)},f=x=>{r.edgeQueue.push(x)},m=x=>{const{nodeLookup:y,nodeOrigin:b}=n.getState(),j=ow(x)?x:y.get(x.id),N=j.parentId?Gj(j.position,j.measured,j.parentId,y,b):j.position,S={...j,position:N,width:j.measured?.width??j.width,height:j.measured?.height??j.height};return Da(S)},h=(x,y,b={replace:!1})=>{d(j=>j.map(N=>{if(N.id===x){const S=typeof y=="function"?y(N):y;return b.replace&&ow(S)?S:{...N,...S}}return N}))},g=(x,y,b={replace:!1})=>{f(j=>j.map(N=>{if(N.id===x){const S=typeof y=="function"?y(N):y;return b.replace&&DI(S)?S:{...N,...S}}return N}))};return{getNodes:()=>n.getState().nodes.map(x=>({...x})),getNode:x=>c(x)?.internals.userNode,getInternalNode:c,getEdges:()=>{const{edges:x=[]}=n.getState();return x.map(y=>({...y}))},getEdge:x=>n.getState().edgeLookup.get(x),setNodes:d,setEdges:f,addNodes:x=>{const y=Array.isArray(x)?x:[x];r.nodeQueue.push(b=>[...b,...y])},addEdges:x=>{const y=Array.isArray(x)?x:[x];r.edgeQueue.push(b=>[...b,...y])},toObject:()=>{const{nodes:x=[],edges:y=[],transform:b}=n.getState(),[j,N,S]=b;return{nodes:x.map(_=>({..._})),edges:y.map(_=>({..._})),viewport:{x:j,y:N,zoom:S}}},deleteElements:async({nodes:x=[],edges:y=[]})=>{const{nodes:b,edges:j,onNodesDelete:N,onEdgesDelete:S,triggerNodeChanges:_,triggerEdgeChanges:A,onDelete:E,onBeforeDelete:M}=n.getState(),{nodes:T,edges:D}=await iz({nodesToRemove:x,edgesToRemove:y,nodes:b,edges:j,onBeforeDelete:M}),z=D.length>0,H=T.length>0;if(z){const q=D.map(rw);S?.(D),A(q)}if(H){const q=T.map(rw);N?.(T),_(q)}return(H||z)&&E?.({nodes:T,edges:D}),{deletedNodes:T,deletedEdges:D}},getIntersectingNodes:(x,y=!0,b)=>{const j=Rb(x),N=j?x:m(x),S=b!==void 0;return N?(b||n.getState().nodes).filter(_=>{const A=n.getState().nodeLookup.get(_.id);if(A&&!j&&(_.id===x.id||!A.internals.positionAbsolute))return!1;const E=Da(S?_:A),M=xl(E,N);return y&&M>0||M>=E.width*E.height||M>=N.width*N.height}):[]},isNodeIntersecting:(x,y,b=!0)=>{const N=Rb(x)?x:m(x);if(!N)return!1;const S=xl(N,y);return b&&S>0||S>=N.width*N.height},updateNode:h,updateNodeData:(x,y,b={replace:!1})=>{h(x,j=>{const N=typeof y=="function"?y(j):y;return b.replace?{...j,data:N}:{...j,data:{...j.data,...N}}},b)},updateEdge:g,updateEdgeData:(x,y,b={replace:!1})=>{g(x,j=>{const N=typeof y=="function"?y(j):y;return b.replace?{...j,data:N}:{...j,data:{...j.data,...N}}},b)},getNodesBounds:x=>{const{nodeLookup:y,nodeOrigin:b}=n.getState();return sz(x,{nodeLookup:y,nodeOrigin:b})},getHandleConnections:({type:x,id:y,nodeId:b})=>Array.from(n.getState().connectionLookup.get(`${b}-${x}${y?`-${y}`:""}`)?.values()??[]),getNodeConnections:({type:x,handleId:y,nodeId:b})=>Array.from(n.getState().connectionLookup.get(`${b}${x?y?`-${x}-${y}`:`-${x}`:""}`)?.values()??[]),fitView:async x=>{const y=n.getState().fitViewResolver??dz();return n.setState({fitViewQueued:!0,fitViewOptions:x,fitViewResolver:y}),r.nodeQueue.push(b=>[...b]),y.promise}}},[]);return w.useMemo(()=>({...l,...e,viewportInitialized:a}),[a])}const iw=e=>e.selected,PI=typeof window<"u"?window:void 0;function HI({deleteKeyCode:e,multiSelectionKeyCode:n}){const r=wt(),{deleteElements:a}=Va(),l=bl(e,{actInsideInputWithModifier:!1}),c=bl(n,{target:PI});w.useEffect(()=>{if(l){const{edges:d,nodes:f}=r.getState();a({nodes:f.filter(iw),edges:d.filter(iw)}),r.setState({nodesSelectionActive:!1})}},[l]),w.useEffect(()=>{r.setState({multiSelectionActive:c})},[c])}function UI(e){const n=wt();w.useEffect(()=>{const r=()=>{if(!e.current)return!1;const a=Og(e.current);(a.height===0||a.width===0)&&n.getState().onError?.("004",ps.error004()),n.setState({width:a.width||500,height:a.height||500})};if(e.current){r(),window.addEventListener("resize",r);const a=new ResizeObserver(()=>r());return a.observe(e.current),()=>{window.removeEventListener("resize",r),a&&e.current&&a.unobserve(e.current)}}},[])}const Vd={position:"absolute",width:"100%",height:"100%",top:0,left:0},BI=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function VI({onPaneContextMenu:e,zoomOnScroll:n=!0,zoomOnPinch:r=!0,panOnScroll:a=!1,panOnScrollSpeed:l=.5,panOnScrollMode:c=ho.Free,zoomOnDoubleClick:d=!0,panOnDrag:f=!0,defaultViewport:m,translateExtent:h,minZoom:g,maxZoom:x,zoomActivationKeyCode:y,preventScrolling:b=!0,children:j,noWheelClassName:N,noPanClassName:S,onViewportChange:_,isControlledViewport:A,paneClickDistance:E}){const M=wt(),T=w.useRef(null),{userSelectionActive:D,lib:z}=at(BI,bt),H=bl(y),q=w.useRef();UI(T);const X=w.useCallback(W=>{_?.({x:W[0],y:W[1],zoom:W[2]}),A||M.setState({transform:W})},[_,A]);return w.useEffect(()=>{if(T.current){q.current=Gz({domNode:T.current,minZoom:g,maxZoom:x,translateExtent:h,viewport:m,paneClickDistance:E,onDraggingChange:B=>M.setState({paneDragging:B}),onPanZoomStart:(B,U)=>{const{onViewportChangeStart:R,onMoveStart:L}=M.getState();L?.(B,U),R?.(U)},onPanZoom:(B,U)=>{const{onViewportChange:R,onMove:L}=M.getState();L?.(B,U),R?.(U)},onPanZoomEnd:(B,U)=>{const{onViewportChangeEnd:R,onMoveEnd:L}=M.getState();L?.(B,U),R?.(U)}});const{x:W,y:G,zoom:ne}=q.current.getViewport();return M.setState({panZoom:q.current,transform:[W,G,ne],domNode:T.current.closest(".react-flow")}),()=>{q.current?.destroy()}}},[]),w.useEffect(()=>{q.current?.update({onPaneContextMenu:e,zoomOnScroll:n,zoomOnPinch:r,panOnScroll:a,panOnScrollSpeed:l,panOnScrollMode:c,zoomOnDoubleClick:d,panOnDrag:f,zoomActivationKeyPressed:H,preventScrolling:b,noPanClassName:S,userSelectionActive:D,noWheelClassName:N,lib:z,onTransformChange:X})},[e,n,r,a,l,c,d,f,H,b,S,D,N,z,X]),o.jsx("div",{className:"react-flow__renderer",ref:T,style:Vd,children:j})}const qI=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function FI(){const{userSelectionActive:e,userSelectionRect:n}=at(qI,bt);return e&&n?o.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const Ph=(e,n)=>r=>{r.target===n.current&&e?.(r)},YI=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function GI({isSelecting:e,selectionKeyPressed:n,selectionMode:r=gl.Full,panOnDrag:a,selectionOnDrag:l,onSelectionStart:c,onSelectionEnd:d,onPaneClick:f,onPaneContextMenu:m,onPaneScroll:h,onPaneMouseEnter:g,onPaneMouseMove:x,onPaneMouseLeave:y,children:b}){const j=wt(),{userSelectionActive:N,elementsSelectable:S,dragging:_,connectionInProgress:A}=at(YI,bt),E=S&&(e||N),M=w.useRef(null),T=w.useRef(),D=w.useRef(new Set),z=w.useRef(new Set),H=w.useRef(!1),q=w.useRef(!1),X=L=>{if(H.current||A){H.current=!1;return}f?.(L),j.getState().resetSelectedElements(),j.setState({nodesSelectionActive:!1})},W=L=>{if(Array.isArray(a)&&a?.includes(2)){L.preventDefault();return}m?.(L)},G=h?L=>h(L):void 0,ne=L=>{const{resetSelectedElements:I,domNode:P}=j.getState();if(T.current=P?.getBoundingClientRect(),!S||!e||L.button!==0||L.target!==M.current||!T.current)return;L.target?.setPointerCapture?.(L.pointerId),q.current=!0,H.current=!1;const{x:C,y:$}=us(L.nativeEvent,T.current);I(),j.setState({userSelectionRect:{width:0,height:0,startX:C,startY:$,x:C,y:$}}),c?.(L)},B=L=>{const{userSelectionRect:I,transform:P,nodeLookup:C,edgeLookup:$,connectionLookup:Y,triggerNodeChanges:V,triggerEdgeChanges:J,defaultEdgeOptions:ce}=j.getState();if(!T.current||!I)return;H.current=!0;const{x:fe,y:ee}=us(L.nativeEvent,T.current),{startX:ie,startY:ge}=I,Ee={startX:ie,startY:ge,x:fe<ie?fe:ie,y:ee<ge?ee:ge,width:Math.abs(fe-ie),height:Math.abs(ee-ge)},Ne=D.current,ve=z.current;D.current=new Set(Rg(C,Ee,P,r===gl.Partial,!0).map(re=>re.id)),z.current=new Set;const ze=ce?.selectable??!0;for(const re of D.current){const Q=Y.get(re);if(Q)for(const{edgeId:me}of Q.values()){const be=$.get(me);be&&(be.selectable??ze)&&z.current.add(me)}}if(!Db(Ne,D.current)){const re=ga(C,D.current,!0);V(re)}if(!Db(ve,z.current)){const re=ga($,z.current);J(re)}j.setState({userSelectionRect:Ee,userSelectionActive:!0,nodesSelectionActive:!1})},U=L=>{if(L.button!==0||!q.current)return;L.target?.releasePointerCapture?.(L.pointerId);const{userSelectionRect:I}=j.getState();!N&&I&&L.target===M.current&&X?.(L),j.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:D.current.size>0}),d?.(L),(n||l)&&(H.current=!1),q.current=!1},R=a===!0||Array.isArray(a)&&a.includes(0);return o.jsxs("div",{className:Dt(["react-flow__pane",{draggable:R,dragging:_,selection:e}]),onClick:E?void 0:Ph(X,M),onContextMenu:Ph(W,M),onWheel:Ph(G,M),onPointerEnter:E?void 0:g,onPointerDown:E?ne:x,onPointerMove:E?B:x,onPointerUp:E?U:void 0,onPointerLeave:y,ref:M,style:Vd,children:[b,o.jsx(FI,{})]})}function Ep({id:e,store:n,unselect:r=!1,nodeRef:a}){const{addSelectedNodes:l,unselectNodesAndEdges:c,multiSelectionActive:d,nodeLookup:f,onError:m}=n.getState(),h=f.get(e);if(!h){m?.("012",ps.error012(e));return}n.setState({nodesSelectionActive:!1}),h.selected?(r||h.selected&&d)&&(c({nodes:[h],edges:[]}),requestAnimationFrame(()=>a?.current?.blur())):l([e])}function wS({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:a,nodeId:l,isSelectable:c,nodeClickDistance:d}){const f=wt(),[m,h]=w.useState(!1),g=w.useRef();return w.useEffect(()=>{g.current=Rz({getStoreItems:()=>f.getState(),onNodeMouseDown:x=>{Ep({id:x,store:f,nodeRef:e})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),w.useEffect(()=>{if(n)g.current?.destroy();else if(e.current)return g.current?.update({noDragClassName:r,handleSelector:a,domNode:e.current,isSelectable:c,nodeId:l,nodeClickDistance:d}),()=>{g.current?.destroy()}},[r,a,n,c,e,l]),m}const XI=e=>n=>n.selected&&(n.draggable||e&&typeof n.draggable>"u");function NS(){const e=wt();return w.useCallback(r=>{const{nodeExtent:a,snapToGrid:l,snapGrid:c,nodesDraggable:d,onError:f,updateNodePositions:m,nodeLookup:h,nodeOrigin:g}=e.getState(),x=new Map,y=XI(d),b=l?c[0]:5,j=l?c[1]:5,N=r.direction.x*b*r.factor,S=r.direction.y*j*r.factor;for(const[,_]of h){if(!y(_))continue;let A={x:_.internals.positionAbsolute.x+N,y:_.internals.positionAbsolute.y+S};l&&(A=Ol(A,c));const{position:E,positionAbsolute:M}=Bj({nodeId:_.id,nextPosition:A,nodeLookup:h,nodeExtent:a,nodeOrigin:g,onError:f});_.position=E,_.internals.positionAbsolute=M,x.set(_.id,_)}m(x)},[])}const Pg=w.createContext(null),ZI=Pg.Provider;Pg.Consumer;const jS=()=>w.useContext(Pg),WI=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),KI=(e,n,r)=>a=>{const{connectionClickStartHandle:l,connectionMode:c,connection:d}=a,{fromHandle:f,toHandle:m,isValid:h}=d,g=m?.nodeId===e&&m?.id===n&&m?.type===r;return{connectingFrom:f?.nodeId===e&&f?.id===n&&f?.type===r,connectingTo:g,clickConnecting:l?.nodeId===e&&l?.id===n&&l?.type===r,isPossibleEndHandle:c===Ma.Strict?f?.type!==r:e!==f?.nodeId||n!==f?.id,connectionInProcess:!!f,clickConnectionInProcess:!!l,valid:g&&h}};function QI({type:e="source",position:n=Ue.Top,isValidConnection:r,isConnectable:a=!0,isConnectableStart:l=!0,isConnectableEnd:c=!0,id:d,onConnect:f,children:m,className:h,onMouseDown:g,onTouchStart:x,...y},b){const j=d||null,N=e==="target",S=wt(),_=jS(),{connectOnClick:A,noPanClassName:E,rfId:M}=at(WI,bt),{connectingFrom:T,connectingTo:D,clickConnecting:z,isPossibleEndHandle:H,connectionInProcess:q,clickConnectionInProcess:X,valid:W}=at(KI(_,j,e),bt);_||S.getState().onError?.("010",ps.error010());const G=U=>{const{defaultEdgeOptions:R,onConnect:L,hasDefaultEdges:I}=S.getState(),P={...R,...U};if(I){const{edges:C,setEdges:$}=S.getState();$(yz(P,C))}L?.(P),f?.(P)},ne=U=>{if(!_)return;const R=Wj(U.nativeEvent);if(l&&(R&&U.button===0||!R)){const L=S.getState();_p.onPointerDown(U.nativeEvent,{handleDomNode:U.currentTarget,autoPanOnConnect:L.autoPanOnConnect,connectionMode:L.connectionMode,connectionRadius:L.connectionRadius,domNode:L.domNode,nodeLookup:L.nodeLookup,lib:L.lib,isTarget:N,handleId:j,nodeId:_,flowId:L.rfId,panBy:L.panBy,cancelConnection:L.cancelConnection,onConnectStart:L.onConnectStart,onConnectEnd:L.onConnectEnd,updateConnection:L.updateConnection,onConnect:G,isValidConnection:r||L.isValidConnection,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:L.autoPanSpeed,dragThreshold:L.connectionDragThreshold})}R?g?.(U):x?.(U)},B=U=>{const{onClickConnectStart:R,onClickConnectEnd:L,connectionClickStartHandle:I,connectionMode:P,isValidConnection:C,lib:$,rfId:Y,nodeLookup:V,connection:J}=S.getState();if(!_||!I&&!l)return;if(!I){R?.(U.nativeEvent,{nodeId:_,handleId:j,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:_,type:e,id:j}});return}const ce=Xj(U.target),fe=r||C,{connection:ee,isValid:ie}=_p.isValid(U.nativeEvent,{handle:{nodeId:_,id:j,type:e},connectionMode:P,fromNodeId:I.nodeId,fromHandleId:I.id||null,fromType:I.type,isValidConnection:fe,flowId:Y,doc:ce,lib:$,nodeLookup:V});ie&&ee&&G(ee);const ge=structuredClone(J);delete ge.inProgress,ge.toPosition=ge.toHandle?ge.toHandle.position:null,L?.(U,ge),S.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":j,"data-nodeid":_,"data-handlepos":n,"data-id":`${M}-${_}-${j}-${e}`,className:Dt(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",E,h,{source:!N,target:N,connectable:a,connectablestart:l,connectableend:c,clickconnecting:z,connectingfrom:T,connectingto:D,valid:W,connectionindicator:a&&(!q||H)&&(q||X?c:l)}]),onMouseDown:ne,onTouchStart:ne,onClick:A?B:void 0,ref:b,...y,children:m})}const Ia=w.memo(vS(QI));function JI({data:e,isConnectable:n,sourcePosition:r=Ue.Bottom}){return o.jsxs(o.Fragment,{children:[e?.label,o.jsx(Ia,{type:"source",position:r,isConnectable:n})]})}function eL({data:e,isConnectable:n,targetPosition:r=Ue.Top,sourcePosition:a=Ue.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Ia,{type:"target",position:r,isConnectable:n}),e?.label,o.jsx(Ia,{type:"source",position:a,isConnectable:n})]})}function tL(){return null}function nL({data:e,isConnectable:n,targetPosition:r=Ue.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Ia,{type:"target",position:r,isConnectable:n}),e?.label]})}const od={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},lw={input:JI,default:eL,output:nL,group:tL};function sL(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const rL=e=>{const{width:n,height:r,x:a,y:l}=Dl(e.nodeLookup,{filter:c=>!!c.selected});return{width:Gn(n)?n:null,height:Gn(r)?r:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${a}px,${l}px)`}};function oL({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const a=wt(),{width:l,height:c,transformString:d,userSelectionActive:f}=at(rL,bt),m=NS(),h=w.useRef(null);if(w.useEffect(()=>{r||h.current?.focus({preventScroll:!0})},[r]),wS({nodeRef:h}),f||!l||!c)return null;const g=e?y=>{const b=a.getState().nodes.filter(j=>j.selected);e(y,b)}:void 0,x=y=>{Object.prototype.hasOwnProperty.call(od,y.key)&&(y.preventDefault(),m({direction:od[y.key],factor:y.shiftKey?4:1}))};return o.jsx("div",{className:Dt(["react-flow__nodesselection","react-flow__container",n]),style:{transform:d},children:o.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:r?void 0:-1,onKeyDown:r?void 0:x,style:{width:l,height:c}})})}const cw=typeof window<"u"?window:void 0,aL=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function SS({children:e,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:a,onPaneMouseLeave:l,onPaneContextMenu:c,onPaneScroll:d,paneClickDistance:f,deleteKeyCode:m,selectionKeyCode:h,selectionOnDrag:g,selectionMode:x,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:j,panActivationKeyCode:N,zoomActivationKeyCode:S,elementsSelectable:_,zoomOnScroll:A,zoomOnPinch:E,panOnScroll:M,panOnScrollSpeed:T,panOnScrollMode:D,zoomOnDoubleClick:z,panOnDrag:H,defaultViewport:q,translateExtent:X,minZoom:W,maxZoom:G,preventScrolling:ne,onSelectionContextMenu:B,noWheelClassName:U,noPanClassName:R,disableKeyboardA11y:L,onViewportChange:I,isControlledViewport:P}){const{nodesSelectionActive:C,userSelectionActive:$}=at(aL),Y=bl(h,{target:cw}),V=bl(N,{target:cw}),J=V||H,ce=V||M,fe=g&&J!==!0,ee=Y||$||fe;return HI({deleteKeyCode:m,multiSelectionKeyCode:j}),o.jsx(VI,{onPaneContextMenu:c,elementsSelectable:_,zoomOnScroll:A,zoomOnPinch:E,panOnScroll:ce,panOnScrollSpeed:T,panOnScrollMode:D,zoomOnDoubleClick:z,panOnDrag:!Y&&J,defaultViewport:q,translateExtent:X,minZoom:W,maxZoom:G,zoomActivationKeyCode:S,preventScrolling:ne,noWheelClassName:U,noPanClassName:R,onViewportChange:I,isControlledViewport:P,paneClickDistance:f,children:o.jsxs(GI,{onSelectionStart:y,onSelectionEnd:b,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:a,onPaneMouseLeave:l,onPaneContextMenu:c,onPaneScroll:d,panOnDrag:J,isSelecting:!!ee,selectionMode:x,selectionKeyPressed:Y,selectionOnDrag:fe,children:[e,C&&o.jsx(oL,{onSelectionContextMenu:B,noPanClassName:R,disableKeyboardA11y:L})]})})}SS.displayName="FlowRenderer";const iL=w.memo(SS),lL=e=>n=>e?Rg(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map(r=>r.id):Array.from(n.nodeLookup.keys());function cL(e){return at(w.useCallback(lL(e),[e]),bt)}const uL=e=>e.updateNodeInternals;function dL(){const e=at(uL),[n]=w.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(r=>{const a=new Map;r.forEach(l=>{const c=l.target.getAttribute("data-id");a.set(c,{id:c,nodeElement:l.target,force:!0})}),e(a)}));return w.useEffect(()=>()=>{n?.disconnect()},[n]),n}function fL({node:e,nodeType:n,hasDimensions:r,resizeObserver:a}){const l=wt(),c=w.useRef(null),d=w.useRef(null),f=w.useRef(e.sourcePosition),m=w.useRef(e.targetPosition),h=w.useRef(n),g=r&&!!e.internals.handleBounds;return w.useEffect(()=>{c.current&&!e.hidden&&(!g||d.current!==c.current)&&(d.current&&a?.unobserve(d.current),a?.observe(c.current),d.current=c.current)},[g,e.hidden]),w.useEffect(()=>()=>{d.current&&(a?.unobserve(d.current),d.current=null)},[]),w.useEffect(()=>{if(c.current){const x=h.current!==n,y=f.current!==e.sourcePosition,b=m.current!==e.targetPosition;(x||y||b)&&(h.current=n,f.current=e.sourcePosition,m.current=e.targetPosition,l.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:c.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),c}function mL({id:e,onClick:n,onMouseEnter:r,onMouseMove:a,onMouseLeave:l,onContextMenu:c,onDoubleClick:d,nodesDraggable:f,elementsSelectable:m,nodesConnectable:h,nodesFocusable:g,resizeObserver:x,noDragClassName:y,noPanClassName:b,disableKeyboardA11y:j,rfId:N,nodeTypes:S,nodeClickDistance:_,onError:A}){const{node:E,internals:M,isParent:T}=at(ie=>{const ge=ie.nodeLookup.get(e),Ee=ie.parentLookup.has(e);return{node:ge,internals:ge.internals,isParent:Ee}},bt);let D=E.type||"default",z=S?.[D]||lw[D];z===void 0&&(A?.("003",ps.error003(D)),D="default",z=S?.default||lw.default);const H=!!(E.draggable||f&&typeof E.draggable>"u"),q=!!(E.selectable||m&&typeof E.selectable>"u"),X=!!(E.connectable||h&&typeof E.connectable>"u"),W=!!(E.focusable||g&&typeof E.focusable>"u"),G=wt(),ne=Yj(E),B=fL({node:E,nodeType:D,hasDimensions:ne,resizeObserver:x}),U=wS({nodeRef:B,disabled:E.hidden||!H,noDragClassName:y,handleSelector:E.dragHandle,nodeId:e,isSelectable:q,nodeClickDistance:_}),R=NS();if(E.hidden)return null;const L=Ws(E),I=sL(E),P=q||H||n||r||a||l,C=r?ie=>r(ie,{...M.userNode}):void 0,$=a?ie=>a(ie,{...M.userNode}):void 0,Y=l?ie=>l(ie,{...M.userNode}):void 0,V=c?ie=>c(ie,{...M.userNode}):void 0,J=d?ie=>d(ie,{...M.userNode}):void 0,ce=ie=>{const{selectNodesOnDrag:ge,nodeDragThreshold:Ee}=G.getState();q&&(!ge||!H||Ee>0)&&Ep({id:e,store:G,nodeRef:B}),n&&n(ie,{...M.userNode})},fe=ie=>{if(!(Zj(ie.nativeEvent)||j)){if(Lj.includes(ie.key)&&q){const ge=ie.key==="Escape";Ep({id:e,store:G,unselect:ge,nodeRef:B})}else if(H&&E.selected&&Object.prototype.hasOwnProperty.call(od,ie.key)){ie.preventDefault();const{ariaLabelConfig:ge}=G.getState();G.setState({ariaLiveMessage:ge["node.a11yDescription.ariaLiveMessage"]({direction:ie.key.replace("Arrow","").toLowerCase(),x:~~M.positionAbsolute.x,y:~~M.positionAbsolute.y})}),R({direction:od[ie.key],factor:ie.shiftKey?4:1})}}},ee=()=>{if(j||!B.current?.matches(":focus-visible"))return;const{transform:ie,width:ge,height:Ee,autoPanOnNodeFocus:Ne,setCenter:ve}=G.getState();if(!Ne)return;Rg(new Map([[e,E]]),{x:0,y:0,width:ge,height:Ee},ie,!0).length>0||ve(E.position.x+L.width/2,E.position.y+L.height/2,{zoom:ie[2]})};return o.jsx("div",{className:Dt(["react-flow__node",`react-flow__node-${D}`,{[b]:H},E.className,{selected:E.selected,selectable:q,parent:T,draggable:H,dragging:U}]),ref:B,style:{zIndex:M.z,transform:`translate(${M.positionAbsolute.x}px,${M.positionAbsolute.y}px)`,pointerEvents:P?"all":"none",visibility:ne?"visible":"hidden",...E.style,...I},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:C,onMouseMove:$,onMouseLeave:Y,onContextMenu:V,onClick:ce,onDoubleClick:J,onKeyDown:W?fe:void 0,tabIndex:W?0:void 0,onFocus:W?ee:void 0,role:E.ariaRole??(W?"group":void 0),"aria-roledescription":"node","aria-describedby":j?void 0:`${mS}-${N}`,"aria-label":E.ariaLabel,...E.domAttributes,children:o.jsx(ZI,{value:e,children:o.jsx(z,{id:e,data:E.data,type:D,positionAbsoluteX:M.positionAbsolute.x,positionAbsoluteY:M.positionAbsolute.y,selected:E.selected??!1,selectable:q,draggable:H,deletable:E.deletable??!0,isConnectable:X,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:U,dragHandle:E.dragHandle,zIndex:M.z,parentId:E.parentId,...L})})})}const hL=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function _S(e){const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:a,elementsSelectable:l,onError:c}=at(hL,bt),d=cL(e.onlyRenderVisibleElements),f=dL();return o.jsx("div",{className:"react-flow__nodes",style:Vd,children:d.map(m=>o.jsx(mL,{id:m,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:f,nodesDraggable:n,nodesConnectable:r,nodesFocusable:a,elementsSelectable:l,nodeClickDistance:e.nodeClickDistance,onError:c},m))})}_S.displayName="NodeRenderer";const pL=w.memo(_S);function gL(e){return at(w.useCallback(r=>{if(!e)return r.edges.map(l=>l.id);const a=[];if(r.width&&r.height)for(const l of r.edges){const c=r.nodeLookup.get(l.source),d=r.nodeLookup.get(l.target);c&&d&&pz({sourceNode:c,targetNode:d,width:r.width,height:r.height,transform:r.transform})&&a.push(l.id)}return a},[e]),bt)}const xL=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:r,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},yL=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:r,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},uw={[nd.Arrow]:xL,[nd.ArrowClosed]:yL};function vL(e){const n=wt();return w.useMemo(()=>Object.prototype.hasOwnProperty.call(uw,e)?uw[e]:(n.getState().onError?.("009",ps.error009(e)),null),[e])}const bL=({id:e,type:n,color:r,width:a=12.5,height:l=12.5,markerUnits:c="strokeWidth",strokeWidth:d,orient:f="auto-start-reverse"})=>{const m=vL(n);return m?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${a}`,markerHeight:`${l}`,viewBox:"-10 -10 20 20",markerUnits:c,orient:f,refX:"0",refY:"0",children:o.jsx(m,{color:r,strokeWidth:d})}):null},ES=({defaultColor:e,rfId:n})=>{const r=at(c=>c.edges),a=at(c=>c.defaultEdgeOptions),l=w.useMemo(()=>jz(r,{id:n,defaultColor:e,defaultMarkerStart:a?.markerStart,defaultMarkerEnd:a?.markerEnd}),[r,a,n,e]);return l.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:l.map(c=>o.jsx(bL,{id:c.id,type:c.type,color:c.color,width:c.width,height:c.height,markerUnits:c.markerUnits,strokeWidth:c.strokeWidth,orient:c.orient},c.id))})}):null};ES.displayName="MarkerDefinitions";var wL=w.memo(ES);function CS({x:e,y:n,label:r,labelStyle:a,labelShowBg:l=!0,labelBgStyle:c,labelBgPadding:d=[2,4],labelBgBorderRadius:f=2,children:m,className:h,...g}){const[x,y]=w.useState({x:1,y:0,width:0,height:0}),b=Dt(["react-flow__edge-textwrapper",h]),j=w.useRef(null);return w.useEffect(()=>{if(j.current){const N=j.current.getBBox();y({x:N.x,y:N.y,width:N.width,height:N.height})}},[r]),r?o.jsxs("g",{transform:`translate(${e-x.width/2} ${n-x.height/2})`,className:b,visibility:x.width?"visible":"hidden",...g,children:[l&&o.jsx("rect",{width:x.width+2*d[0],x:-d[0],y:-d[1],height:x.height+2*d[1],className:"react-flow__edge-textbg",style:c,rx:f,ry:f}),o.jsx("text",{className:"react-flow__edge-text",y:x.height/2,dy:"0.3em",ref:j,style:a,children:r}),m]}):null}CS.displayName="EdgeText";const NL=w.memo(CS);function Il({path:e,labelX:n,labelY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m,interactionWidth:h=20,...g}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...g,d:e,fill:"none",className:Dt(["react-flow__edge-path",g.className])}),h?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,a&&Gn(n)&&Gn(r)?o.jsx(NL,{x:n,y:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m}):null]})}function dw({pos:e,x1:n,y1:r,x2:a,y2:l}){return e===Ue.Left||e===Ue.Right?[.5*(n+a),r]:[n,.5*(r+l)]}function kS({sourceX:e,sourceY:n,sourcePosition:r=Ue.Bottom,targetX:a,targetY:l,targetPosition:c=Ue.Top}){const[d,f]=dw({pos:r,x1:e,y1:n,x2:a,y2:l}),[m,h]=dw({pos:c,x1:a,y1:l,x2:e,y2:n}),[g,x,y,b]=Kj({sourceX:e,sourceY:n,targetX:a,targetY:l,sourceControlX:d,sourceControlY:f,targetControlX:m,targetControlY:h});return[`M${e},${n} C${d},${f} ${m},${h} ${a},${l}`,g,x,y,b]}function TS(e){return w.memo(({id:n,sourceX:r,sourceY:a,targetX:l,targetY:c,sourcePosition:d,targetPosition:f,label:m,labelStyle:h,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:b,style:j,markerEnd:N,markerStart:S,interactionWidth:_})=>{const[A,E,M]=kS({sourceX:r,sourceY:a,sourcePosition:d,targetX:l,targetY:c,targetPosition:f}),T=e.isInternal?void 0:n;return o.jsx(Il,{id:T,path:A,labelX:E,labelY:M,label:m,labelStyle:h,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:b,style:j,markerEnd:N,markerStart:S,interactionWidth:_})})}const jL=TS({isInternal:!1}),AS=TS({isInternal:!0});jL.displayName="SimpleBezierEdge";AS.displayName="SimpleBezierEdgeInternal";function MS(e){return w.memo(({id:n,sourceX:r,sourceY:a,targetX:l,targetY:c,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:x,style:y,sourcePosition:b=Ue.Bottom,targetPosition:j=Ue.Top,markerEnd:N,markerStart:S,pathOptions:_,interactionWidth:A})=>{const[E,M,T]=Np({sourceX:r,sourceY:a,sourcePosition:b,targetX:l,targetY:c,targetPosition:j,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),D=e.isInternal?void 0:n;return o.jsx(Il,{id:D,path:E,labelX:M,labelY:T,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:x,style:y,markerEnd:N,markerStart:S,interactionWidth:A})})}const RS=MS({isInternal:!1}),DS=MS({isInternal:!0});RS.displayName="SmoothStepEdge";DS.displayName="SmoothStepEdgeInternal";function OS(e){return w.memo(({id:n,...r})=>{const a=e.isInternal?void 0:n;return o.jsx(RS,{...r,id:a,pathOptions:w.useMemo(()=>({borderRadius:0,offset:r.pathOptions?.offset}),[r.pathOptions?.offset])})})}const SL=OS({isInternal:!1}),zS=OS({isInternal:!0});SL.displayName="StepEdge";zS.displayName="StepEdgeInternal";function IS(e){return w.memo(({id:n,sourceX:r,sourceY:a,targetX:l,targetY:c,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:x,style:y,markerEnd:b,markerStart:j,interactionWidth:N})=>{const[S,_,A]=eS({sourceX:r,sourceY:a,targetX:l,targetY:c}),E=e.isInternal?void 0:n;return o.jsx(Il,{id:E,path:S,labelX:_,labelY:A,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:x,style:y,markerEnd:b,markerStart:j,interactionWidth:N})})}const _L=IS({isInternal:!1}),LS=IS({isInternal:!0});_L.displayName="StraightEdge";LS.displayName="StraightEdgeInternal";function $S(e){return w.memo(({id:n,sourceX:r,sourceY:a,targetX:l,targetY:c,sourcePosition:d=Ue.Bottom,targetPosition:f=Ue.Top,label:m,labelStyle:h,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:b,style:j,markerEnd:N,markerStart:S,pathOptions:_,interactionWidth:A})=>{const[E,M,T]=Qj({sourceX:r,sourceY:a,sourcePosition:d,targetX:l,targetY:c,targetPosition:f,curvature:_?.curvature}),D=e.isInternal?void 0:n;return o.jsx(Il,{id:D,path:E,labelX:M,labelY:T,label:m,labelStyle:h,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:b,style:j,markerEnd:N,markerStart:S,interactionWidth:A})})}const EL=$S({isInternal:!1}),PS=$S({isInternal:!0});EL.displayName="BezierEdge";PS.displayName="BezierEdgeInternal";const fw={default:PS,straight:LS,step:zS,smoothstep:DS,simplebezier:AS},mw={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},CL=(e,n,r)=>r===Ue.Left?e-n:r===Ue.Right?e+n:e,kL=(e,n,r)=>r===Ue.Top?e-n:r===Ue.Bottom?e+n:e,hw="react-flow__edgeupdater";function pw({position:e,centerX:n,centerY:r,radius:a=10,onMouseDown:l,onMouseEnter:c,onMouseOut:d,type:f}){return o.jsx("circle",{onMouseDown:l,onMouseEnter:c,onMouseOut:d,className:Dt([hw,`${hw}-${f}`]),cx:CL(n,a,e),cy:kL(r,a,e),r:a,stroke:"transparent",fill:"transparent"})}function TL({isReconnectable:e,reconnectRadius:n,edge:r,sourceX:a,sourceY:l,targetX:c,targetY:d,sourcePosition:f,targetPosition:m,onReconnect:h,onReconnectStart:g,onReconnectEnd:x,setReconnecting:y,setUpdateHover:b}){const j=wt(),N=(M,T)=>{if(M.button!==0)return;const{autoPanOnConnect:D,domNode:z,isValidConnection:H,connectionMode:q,connectionRadius:X,lib:W,onConnectStart:G,onConnectEnd:ne,cancelConnection:B,nodeLookup:U,rfId:R,panBy:L,updateConnection:I}=j.getState(),P=T.type==="target",C=(V,J)=>{y(!1),x?.(V,r,T.type,J)},$=V=>h?.(r,V),Y=(V,J)=>{y(!0),g?.(M,r,T.type),G?.(V,J)};_p.onPointerDown(M.nativeEvent,{autoPanOnConnect:D,connectionMode:q,connectionRadius:X,domNode:z,handleId:T.id,nodeId:T.nodeId,nodeLookup:U,isTarget:P,edgeUpdaterType:T.type,lib:W,flowId:R,cancelConnection:B,panBy:L,isValidConnection:H,onConnect:$,onConnectStart:Y,onConnectEnd:ne,onReconnectEnd:C,updateConnection:I,getTransform:()=>j.getState().transform,getFromHandle:()=>j.getState().connection.fromHandle,dragThreshold:j.getState().connectionDragThreshold,handleDomNode:M.currentTarget})},S=M=>N(M,{nodeId:r.target,id:r.targetHandle??null,type:"target"}),_=M=>N(M,{nodeId:r.source,id:r.sourceHandle??null,type:"source"}),A=()=>b(!0),E=()=>b(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(pw,{position:f,centerX:a,centerY:l,radius:n,onMouseDown:S,onMouseEnter:A,onMouseOut:E,type:"source"}),(e===!0||e==="target")&&o.jsx(pw,{position:m,centerX:c,centerY:d,radius:n,onMouseDown:_,onMouseEnter:A,onMouseOut:E,type:"target"})]})}function AL({id:e,edgesFocusable:n,edgesReconnectable:r,elementsSelectable:a,onClick:l,onDoubleClick:c,onContextMenu:d,onMouseEnter:f,onMouseMove:m,onMouseLeave:h,reconnectRadius:g,onReconnect:x,onReconnectStart:y,onReconnectEnd:b,rfId:j,edgeTypes:N,noPanClassName:S,onError:_,disableKeyboardA11y:A}){let E=at(ve=>ve.edgeLookup.get(e));const M=at(ve=>ve.defaultEdgeOptions);E=M?{...M,...E}:E;let T=E.type||"default",D=N?.[T]||fw[T];D===void 0&&(_?.("011",ps.error011(T)),T="default",D=N?.default||fw.default);const z=!!(E.focusable||n&&typeof E.focusable>"u"),H=typeof x<"u"&&(E.reconnectable||r&&typeof E.reconnectable>"u"),q=!!(E.selectable||a&&typeof E.selectable>"u"),X=w.useRef(null),[W,G]=w.useState(!1),[ne,B]=w.useState(!1),U=wt(),{zIndex:R,sourceX:L,sourceY:I,targetX:P,targetY:C,sourcePosition:$,targetPosition:Y}=at(w.useCallback(ve=>{const ze=ve.nodeLookup.get(E.source),re=ve.nodeLookup.get(E.target);if(!ze||!re)return{zIndex:E.zIndex,...mw};const Q=Nz({id:e,sourceNode:ze,targetNode:re,sourceHandle:E.sourceHandle||null,targetHandle:E.targetHandle||null,connectionMode:ve.connectionMode,onError:_});return{zIndex:hz({selected:E.selected,zIndex:E.zIndex,sourceNode:ze,targetNode:re,elevateOnSelect:ve.elevateEdgesOnSelect}),...Q||mw}},[E.source,E.target,E.sourceHandle,E.targetHandle,E.selected,E.zIndex]),bt),V=w.useMemo(()=>E.markerStart?`url('#${jp(E.markerStart,j)}')`:void 0,[E.markerStart,j]),J=w.useMemo(()=>E.markerEnd?`url('#${jp(E.markerEnd,j)}')`:void 0,[E.markerEnd,j]);if(E.hidden||L===null||I===null||P===null||C===null)return null;const ce=ve=>{const{addSelectedEdges:ze,unselectNodesAndEdges:re,multiSelectionActive:Q}=U.getState();q&&(U.setState({nodesSelectionActive:!1}),E.selected&&Q?(re({nodes:[],edges:[E]}),X.current?.blur()):ze([e])),l&&l(ve,E)},fe=c?ve=>{c(ve,{...E})}:void 0,ee=d?ve=>{d(ve,{...E})}:void 0,ie=f?ve=>{f(ve,{...E})}:void 0,ge=m?ve=>{m(ve,{...E})}:void 0,Ee=h?ve=>{h(ve,{...E})}:void 0,Ne=ve=>{if(!A&&Lj.includes(ve.key)&&q){const{unselectNodesAndEdges:ze,addSelectedEdges:re}=U.getState();ve.key==="Escape"?(X.current?.blur(),ze({edges:[E]})):re([e])}};return o.jsx("svg",{style:{zIndex:R},children:o.jsxs("g",{className:Dt(["react-flow__edge",`react-flow__edge-${T}`,E.className,S,{selected:E.selected,animated:E.animated,inactive:!q&&!l,updating:W,selectable:q}]),onClick:ce,onDoubleClick:fe,onContextMenu:ee,onMouseEnter:ie,onMouseMove:ge,onMouseLeave:Ee,onKeyDown:z?Ne:void 0,tabIndex:z?0:void 0,role:E.ariaRole??(z?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":E.ariaLabel===null?void 0:E.ariaLabel||`Edge from ${E.source} to ${E.target}`,"aria-describedby":z?`${hS}-${j}`:void 0,ref:X,...E.domAttributes,children:[!ne&&o.jsx(D,{id:e,source:E.source,target:E.target,type:E.type,selected:E.selected,animated:E.animated,selectable:q,deletable:E.deletable??!0,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,sourceX:L,sourceY:I,targetX:P,targetY:C,sourcePosition:$,targetPosition:Y,data:E.data,style:E.style,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerStart:V,markerEnd:J,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth}),H&&o.jsx(TL,{edge:E,isReconnectable:H,reconnectRadius:g,onReconnect:x,onReconnectStart:y,onReconnectEnd:b,sourceX:L,sourceY:I,targetX:P,targetY:C,sourcePosition:$,targetPosition:Y,setUpdateHover:G,setReconnecting:B})]})})}const ML=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function HS({defaultMarkerColor:e,onlyRenderVisibleElements:n,rfId:r,edgeTypes:a,noPanClassName:l,onReconnect:c,onEdgeContextMenu:d,onEdgeMouseEnter:f,onEdgeMouseMove:m,onEdgeMouseLeave:h,onEdgeClick:g,reconnectRadius:x,onEdgeDoubleClick:y,onReconnectStart:b,onReconnectEnd:j,disableKeyboardA11y:N}){const{edgesFocusable:S,edgesReconnectable:_,elementsSelectable:A,onError:E}=at(ML,bt),M=gL(n);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(wL,{defaultColor:e,rfId:r}),M.map(T=>o.jsx(AL,{id:T,edgesFocusable:S,edgesReconnectable:_,elementsSelectable:A,noPanClassName:l,onReconnect:c,onContextMenu:d,onMouseEnter:f,onMouseMove:m,onMouseLeave:h,onClick:g,reconnectRadius:x,onDoubleClick:y,onReconnectStart:b,onReconnectEnd:j,rfId:r,onError:E,edgeTypes:a,disableKeyboardA11y:N},T))]})}HS.displayName="EdgeRenderer";const RL=w.memo(HS),DL=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function OL({children:e}){const n=at(DL);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}function zL(e){const n=Va(),r=w.useRef(!1);w.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const IL=e=>e.panZoom?.syncViewport;function LL(e){const n=at(IL),r=wt();return w.useEffect(()=>{e&&(n?.(e),r.setState({transform:[e.x,e.y,e.zoom]}))},[e,n]),null}function $L(e){return e.connection.inProgress?{...e.connection,to:zl(e.connection.to,e.transform)}:{...e.connection}}function PL(e){return $L}function HL(e){const n=PL();return at(n,bt)}const UL=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function BL({containerStyle:e,style:n,type:r,component:a}){const{nodesConnectable:l,width:c,height:d,isValid:f,inProgress:m}=at(UL,bt);return!(c&&l&&m)?null:o.jsx("svg",{style:e,width:c,height:d,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:Dt(["react-flow__connection",Hj(f)]),children:o.jsx(US,{style:n,type:r,CustomComponent:a,isValid:f})})})}const US=({style:e,type:n=kr.Bezier,CustomComponent:r,isValid:a})=>{const{inProgress:l,from:c,fromNode:d,fromHandle:f,fromPosition:m,to:h,toNode:g,toHandle:x,toPosition:y}=HL();if(!l)return;if(r)return o.jsx(r,{connectionLineType:n,connectionLineStyle:e,fromNode:d,fromHandle:f,fromX:c.x,fromY:c.y,toX:h.x,toY:h.y,fromPosition:m,toPosition:y,connectionStatus:Hj(a),toNode:g,toHandle:x});let b="";const j={sourceX:c.x,sourceY:c.y,sourcePosition:m,targetX:h.x,targetY:h.y,targetPosition:y};switch(n){case kr.Bezier:[b]=Qj(j);break;case kr.SimpleBezier:[b]=kS(j);break;case kr.Step:[b]=Np({...j,borderRadius:0});break;case kr.SmoothStep:[b]=Np(j);break;default:[b]=eS(j)}return o.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:e})};US.displayName="ConnectionLine";const VL={};function gw(e=VL){w.useRef(e),wt(),w.useEffect(()=>{},[e])}function qL(){wt(),w.useRef(!1),w.useEffect(()=>{},[])}function BS({nodeTypes:e,edgeTypes:n,onInit:r,onNodeClick:a,onEdgeClick:l,onNodeDoubleClick:c,onEdgeDoubleClick:d,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:h,onNodeContextMenu:g,onSelectionContextMenu:x,onSelectionStart:y,onSelectionEnd:b,connectionLineType:j,connectionLineStyle:N,connectionLineComponent:S,connectionLineContainerStyle:_,selectionKeyCode:A,selectionOnDrag:E,selectionMode:M,multiSelectionKeyCode:T,panActivationKeyCode:D,zoomActivationKeyCode:z,deleteKeyCode:H,onlyRenderVisibleElements:q,elementsSelectable:X,defaultViewport:W,translateExtent:G,minZoom:ne,maxZoom:B,preventScrolling:U,defaultMarkerColor:R,zoomOnScroll:L,zoomOnPinch:I,panOnScroll:P,panOnScrollSpeed:C,panOnScrollMode:$,zoomOnDoubleClick:Y,panOnDrag:V,onPaneClick:J,onPaneMouseEnter:ce,onPaneMouseMove:fe,onPaneMouseLeave:ee,onPaneScroll:ie,onPaneContextMenu:ge,paneClickDistance:Ee,nodeClickDistance:Ne,onEdgeContextMenu:ve,onEdgeMouseEnter:ze,onEdgeMouseMove:re,onEdgeMouseLeave:Q,reconnectRadius:me,onReconnect:be,onReconnectStart:Ce,onReconnectEnd:we,noDragClassName:Me,noWheelClassName:je,noPanClassName:Se,disableKeyboardA11y:Ke,nodeExtent:tt,rfId:Be,viewport:_e,onViewportChange:xe}){return gw(e),gw(n),qL(),zL(r),LL(_e),o.jsx(iL,{onPaneClick:J,onPaneMouseEnter:ce,onPaneMouseMove:fe,onPaneMouseLeave:ee,onPaneContextMenu:ge,onPaneScroll:ie,paneClickDistance:Ee,deleteKeyCode:H,selectionKeyCode:A,selectionOnDrag:E,selectionMode:M,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:T,panActivationKeyCode:D,zoomActivationKeyCode:z,elementsSelectable:X,zoomOnScroll:L,zoomOnPinch:I,zoomOnDoubleClick:Y,panOnScroll:P,panOnScrollSpeed:C,panOnScrollMode:$,panOnDrag:V,defaultViewport:W,translateExtent:G,minZoom:ne,maxZoom:B,onSelectionContextMenu:x,preventScrolling:U,noDragClassName:Me,noWheelClassName:je,noPanClassName:Se,disableKeyboardA11y:Ke,onViewportChange:xe,isControlledViewport:!!_e,children:o.jsxs(OL,{children:[o.jsx(RL,{edgeTypes:n,onEdgeClick:l,onEdgeDoubleClick:d,onReconnect:be,onReconnectStart:Ce,onReconnectEnd:we,onlyRenderVisibleElements:q,onEdgeContextMenu:ve,onEdgeMouseEnter:ze,onEdgeMouseMove:re,onEdgeMouseLeave:Q,reconnectRadius:me,defaultMarkerColor:R,noPanClassName:Se,disableKeyboardA11y:Ke,rfId:Be}),o.jsx(BL,{style:N,type:j,component:S,containerStyle:_}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(pL,{nodeTypes:e,onNodeClick:a,onNodeDoubleClick:c,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:h,onNodeContextMenu:g,nodeClickDistance:Ne,onlyRenderVisibleElements:q,noPanClassName:Se,noDragClassName:Me,disableKeyboardA11y:Ke,nodeExtent:tt,rfId:Be}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}BS.displayName="GraphView";const FL=w.memo(BS),xw=({nodes:e,edges:n,defaultNodes:r,defaultEdges:a,width:l,height:c,fitView:d,fitViewOptions:f,minZoom:m=.5,maxZoom:h=2,nodeOrigin:g,nodeExtent:x}={})=>{const y=new Map,b=new Map,j=new Map,N=new Map,S=a??n??[],_=r??e??[],A=g??[0,0],E=x??pl;nS(j,N,S);const M=Sp(_,y,b,{nodeOrigin:A,nodeExtent:E,elevateNodesOnSelect:!1});let T=[0,0,1];if(d&&l&&c){const D=Dl(y,{filter:X=>!!((X.width||X.initialWidth)&&(X.height||X.initialHeight))}),{x:z,y:H,zoom:q}=Dg(D,l,c,m,h,f?.padding??.1);T=[z,H,q]}return{rfId:"1",width:0,height:0,transform:T,nodes:_,nodesInitialized:M,nodeLookup:y,parentLookup:b,edges:S,edgeLookup:N,connectionLookup:j,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:r!==void 0,hasDefaultEdges:a!==void 0,panZoom:null,minZoom:m,maxZoom:h,translateExtent:pl,nodeExtent:E,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ma.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:A,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:d??!1,fitViewOptions:f,fitViewResolver:null,connection:{...Pj},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:lz,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:$j}},YL=({nodes:e,edges:n,defaultNodes:r,defaultEdges:a,width:l,height:c,fitView:d,fitViewOptions:f,minZoom:m,maxZoom:h,nodeOrigin:g,nodeExtent:x})=>fI((y,b)=>{async function j(){const{nodeLookup:N,panZoom:S,fitViewOptions:_,fitViewResolver:A,width:E,height:M,minZoom:T,maxZoom:D}=b();S&&(await az({nodes:N,width:E,height:M,panZoom:S,minZoom:T,maxZoom:D},_),A?.resolve(!0),y({fitViewResolver:null}))}return{...xw({nodes:e,edges:n,width:l,height:c,fitView:d,fitViewOptions:f,minZoom:m,maxZoom:h,nodeOrigin:g,nodeExtent:x,defaultNodes:r,defaultEdges:a}),setNodes:N=>{const{nodeLookup:S,parentLookup:_,nodeOrigin:A,elevateNodesOnSelect:E,fitViewQueued:M}=b(),T=Sp(N,S,_,{nodeOrigin:A,nodeExtent:x,elevateNodesOnSelect:E,checkEquality:!0});M&&T?(j(),y({nodes:N,nodesInitialized:T,fitViewQueued:!1,fitViewOptions:void 0})):y({nodes:N,nodesInitialized:T})},setEdges:N=>{const{connectionLookup:S,edgeLookup:_}=b();nS(S,_,N),y({edges:N})},setDefaultNodesAndEdges:(N,S)=>{if(N){const{setNodes:_}=b();_(N),y({hasDefaultNodes:!0})}if(S){const{setEdges:_}=b();_(S),y({hasDefaultEdges:!0})}},updateNodeInternals:N=>{const{triggerNodeChanges:S,nodeLookup:_,parentLookup:A,domNode:E,nodeOrigin:M,nodeExtent:T,debug:D,fitViewQueued:z}=b(),{changes:H,updatedInternals:q}=kz(N,_,A,E,M,T);q&&(_z(_,A,{nodeOrigin:M,nodeExtent:T}),z?(j(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),H?.length>0&&(D&&console.log("React Flow: trigger node changes",H),S?.(H)))},updateNodePositions:(N,S=!1)=>{const _=[],A=[],{nodeLookup:E,triggerNodeChanges:M}=b();for(const[T,D]of N){const z=E.get(T),H=!!(z?.expandParent&&z?.parentId&&D?.position),q={id:T,type:"position",position:H?{x:Math.max(0,D.position.x),y:Math.max(0,D.position.y)}:D.position,dragging:S};H&&z.parentId&&_.push({id:T,parentId:z.parentId,rect:{...D.internals.positionAbsolute,width:D.measured.width??0,height:D.measured.height??0}}),A.push(q)}if(_.length>0){const{parentLookup:T,nodeOrigin:D}=b(),z=$g(_,E,T,D);A.push(...z)}M(A)},triggerNodeChanges:N=>{const{onNodesChange:S,setNodes:_,nodes:A,hasDefaultNodes:E,debug:M}=b();if(N?.length){if(E){const T=xS(N,A);_(T)}M&&console.log("React Flow: trigger node changes",N),S?.(N)}},triggerEdgeChanges:N=>{const{onEdgesChange:S,setEdges:_,edges:A,hasDefaultEdges:E,debug:M}=b();if(N?.length){if(E){const T=yS(N,A);_(T)}M&&console.log("React Flow: trigger edge changes",N),S?.(N)}},addSelectedNodes:N=>{const{multiSelectionActive:S,edgeLookup:_,nodeLookup:A,triggerNodeChanges:E,triggerEdgeChanges:M}=b();if(S){const T=N.map(D=>lo(D,!0));E(T);return}E(ga(A,new Set([...N]),!0)),M(ga(_))},addSelectedEdges:N=>{const{multiSelectionActive:S,edgeLookup:_,nodeLookup:A,triggerNodeChanges:E,triggerEdgeChanges:M}=b();if(S){const T=N.map(D=>lo(D,!0));M(T);return}M(ga(_,new Set([...N]))),E(ga(A,new Set,!0))},unselectNodesAndEdges:({nodes:N,edges:S}={})=>{const{edges:_,nodes:A,nodeLookup:E,triggerNodeChanges:M,triggerEdgeChanges:T}=b(),D=N||A,z=S||_,H=D.map(X=>{const W=E.get(X.id);return W&&(W.selected=!1),lo(X.id,!1)}),q=z.map(X=>lo(X.id,!1));M(H),T(q)},setMinZoom:N=>{const{panZoom:S,maxZoom:_}=b();S?.setScaleExtent([N,_]),y({minZoom:N})},setMaxZoom:N=>{const{panZoom:S,minZoom:_}=b();S?.setScaleExtent([_,N]),y({maxZoom:N})},setTranslateExtent:N=>{b().panZoom?.setTranslateExtent(N),y({translateExtent:N})},setPaneClickDistance:N=>{b().panZoom?.setClickDistance(N)},resetSelectedElements:()=>{const{edges:N,nodes:S,triggerNodeChanges:_,triggerEdgeChanges:A,elementsSelectable:E}=b();if(!E)return;const M=S.reduce((D,z)=>z.selected?[...D,lo(z.id,!1)]:D,[]),T=N.reduce((D,z)=>z.selected?[...D,lo(z.id,!1)]:D,[]);_(M),A(T)},setNodeExtent:N=>{const{nodes:S,nodeLookup:_,parentLookup:A,nodeOrigin:E,elevateNodesOnSelect:M,nodeExtent:T}=b();N[0][0]===T[0][0]&&N[0][1]===T[0][1]&&N[1][0]===T[1][0]&&N[1][1]===T[1][1]||(Sp(S,_,A,{nodeOrigin:E,nodeExtent:N,elevateNodesOnSelect:M,checkEquality:!1}),y({nodeExtent:N}))},panBy:N=>{const{transform:S,width:_,height:A,panZoom:E,translateExtent:M}=b();return Tz({delta:N,panZoom:E,transform:S,translateExtent:M,width:_,height:A})},setCenter:async(N,S,_)=>{const{width:A,height:E,maxZoom:M,panZoom:T}=b();if(!T)return Promise.resolve(!1);const D=typeof _?.zoom<"u"?_.zoom:M;return await T.setViewport({x:A/2-N*D,y:E/2-S*D,zoom:D},{duration:_?.duration,ease:_?.ease,interpolate:_?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{y({connection:{...Pj}})},updateConnection:N=>{y({connection:N})},reset:()=>y({...xw()})}},Object.is);function GL({initialNodes:e,initialEdges:n,defaultNodes:r,defaultEdges:a,initialWidth:l,initialHeight:c,initialMinZoom:d,initialMaxZoom:f,initialFitViewOptions:m,fitView:h,nodeOrigin:g,nodeExtent:x,children:y}){const[b]=w.useState(()=>YL({nodes:e,edges:n,defaultNodes:r,defaultEdges:a,width:l,height:c,fitView:h,minZoom:d,maxZoom:f,fitViewOptions:m,nodeOrigin:g,nodeExtent:x}));return o.jsx(mI,{value:b,children:o.jsx(II,{children:y})})}function XL({children:e,nodes:n,edges:r,defaultNodes:a,defaultEdges:l,width:c,height:d,fitView:f,fitViewOptions:m,minZoom:h,maxZoom:g,nodeOrigin:x,nodeExtent:y}){return w.useContext(Ud)?o.jsx(o.Fragment,{children:e}):o.jsx(GL,{initialNodes:n,initialEdges:r,defaultNodes:a,defaultEdges:l,initialWidth:c,initialHeight:d,fitView:f,initialFitViewOptions:m,initialMinZoom:h,initialMaxZoom:g,nodeOrigin:x,nodeExtent:y,children:e})}const ZL={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function WL({nodes:e,edges:n,defaultNodes:r,defaultEdges:a,className:l,nodeTypes:c,edgeTypes:d,onNodeClick:f,onEdgeClick:m,onInit:h,onMove:g,onMoveStart:x,onMoveEnd:y,onConnect:b,onConnectStart:j,onConnectEnd:N,onClickConnectStart:S,onClickConnectEnd:_,onNodeMouseEnter:A,onNodeMouseMove:E,onNodeMouseLeave:M,onNodeContextMenu:T,onNodeDoubleClick:D,onNodeDragStart:z,onNodeDrag:H,onNodeDragStop:q,onNodesDelete:X,onEdgesDelete:W,onDelete:G,onSelectionChange:ne,onSelectionDragStart:B,onSelectionDrag:U,onSelectionDragStop:R,onSelectionContextMenu:L,onSelectionStart:I,onSelectionEnd:P,onBeforeDelete:C,connectionMode:$,connectionLineType:Y=kr.Bezier,connectionLineStyle:V,connectionLineComponent:J,connectionLineContainerStyle:ce,deleteKeyCode:fe="Backspace",selectionKeyCode:ee="Shift",selectionOnDrag:ie=!1,selectionMode:ge=gl.Full,panActivationKeyCode:Ee="Space",multiSelectionKeyCode:Ne=yl()?"Meta":"Control",zoomActivationKeyCode:ve=yl()?"Meta":"Control",snapToGrid:ze,snapGrid:re,onlyRenderVisibleElements:Q=!1,selectNodesOnDrag:me,nodesDraggable:be,autoPanOnNodeFocus:Ce,nodesConnectable:we,nodesFocusable:Me,nodeOrigin:je=pS,edgesFocusable:Se,edgesReconnectable:Ke,elementsSelectable:tt=!0,defaultViewport:Be=EI,minZoom:_e=.5,maxZoom:xe=2,translateExtent:$e=pl,preventScrolling:Ge=!0,nodeExtent:qt,defaultMarkerColor:rn="#b1b1b7",zoomOnScroll:_o=!0,zoomOnPinch:Jn=!0,panOnScroll:vs=!1,panOnScrollSpeed:pe=.5,panOnScrollMode:Ae=ho.Free,zoomOnDoubleClick:Ie=!0,panOnDrag:Ot=!0,onPaneClick:Ft,onPaneMouseEnter:Pe,onPaneMouseMove:ye,onPaneMouseLeave:dt,onPaneScroll:_t,onPaneContextMenu:ot,paneClickDistance:kn=0,nodeClickDistance:mn=0,children:Pn,onReconnect:Ll,onReconnectStart:qd,onReconnectEnd:es,onEdgeContextMenu:Ht,onEdgeDoubleClick:Kt,onEdgeMouseEnter:Ks,onEdgeMouseMove:qa,onEdgeMouseLeave:Fd,reconnectRadius:Yd=10,onNodesChange:$l,onEdgesChange:Br,noDragClassName:Fa="nodrag",noWheelClassName:Qs="nowheel",noPanClassName:bs="nopan",fitView:Js,fitViewOptions:ws,connectOnClick:Tt,attributionPosition:Pl,proOptions:Hl,defaultEdgeOptions:Ns,elevateNodesOnSelect:er,elevateEdgesOnSelect:Gd,disableKeyboardA11y:Ya=!1,autoPanOnConnect:Ul,autoPanOnNodeDrag:Xd,autoPanSpeed:Eo,connectionRadius:Co,isValidConnection:Hn,onError:Ga,style:Bl,id:js,nodeDragThreshold:Xa,connectionDragThreshold:Za,viewport:Zd,onViewportChange:Vl,width:on,height:ql,colorMode:Wd="light",debug:ko,onScroll:Wa,ariaLabelConfig:To,...Kd},an){const Vr=js||"1",Fl=AI(Wd),Ka=w.useCallback(Ss=>{Ss.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Wa?.(Ss)},[Wa]);return o.jsx("div",{"data-testid":"rf__wrapper",...Kd,onScroll:Ka,style:{...Bl,...ZL},ref:an,className:Dt(["react-flow",l,Fl]),id:js,role:"application",children:o.jsxs(XL,{nodes:e,edges:n,width:on,height:ql,fitView:Js,fitViewOptions:ws,minZoom:_e,maxZoom:xe,nodeOrigin:je,nodeExtent:qt,children:[o.jsx(FL,{onInit:h,onNodeClick:f,onEdgeClick:m,onNodeMouseEnter:A,onNodeMouseMove:E,onNodeMouseLeave:M,onNodeContextMenu:T,onNodeDoubleClick:D,nodeTypes:c,edgeTypes:d,connectionLineType:Y,connectionLineStyle:V,connectionLineComponent:J,connectionLineContainerStyle:ce,selectionKeyCode:ee,selectionOnDrag:ie,selectionMode:ge,deleteKeyCode:fe,multiSelectionKeyCode:Ne,panActivationKeyCode:Ee,zoomActivationKeyCode:ve,onlyRenderVisibleElements:Q,defaultViewport:Be,translateExtent:$e,minZoom:_e,maxZoom:xe,preventScrolling:Ge,zoomOnScroll:_o,zoomOnPinch:Jn,zoomOnDoubleClick:Ie,panOnScroll:vs,panOnScrollSpeed:pe,panOnScrollMode:Ae,panOnDrag:Ot,onPaneClick:Ft,onPaneMouseEnter:Pe,onPaneMouseMove:ye,onPaneMouseLeave:dt,onPaneScroll:_t,onPaneContextMenu:ot,paneClickDistance:kn,nodeClickDistance:mn,onSelectionContextMenu:L,onSelectionStart:I,onSelectionEnd:P,onReconnect:Ll,onReconnectStart:qd,onReconnectEnd:es,onEdgeContextMenu:Ht,onEdgeDoubleClick:Kt,onEdgeMouseEnter:Ks,onEdgeMouseMove:qa,onEdgeMouseLeave:Fd,reconnectRadius:Yd,defaultMarkerColor:rn,noDragClassName:Fa,noWheelClassName:Qs,noPanClassName:bs,rfId:Vr,disableKeyboardA11y:Ya,nodeExtent:qt,viewport:Zd,onViewportChange:Vl}),o.jsx(TI,{nodes:e,edges:n,defaultNodes:r,defaultEdges:a,onConnect:b,onConnectStart:j,onConnectEnd:N,onClickConnectStart:S,onClickConnectEnd:_,nodesDraggable:be,autoPanOnNodeFocus:Ce,nodesConnectable:we,nodesFocusable:Me,edgesFocusable:Se,edgesReconnectable:Ke,elementsSelectable:tt,elevateNodesOnSelect:er,elevateEdgesOnSelect:Gd,minZoom:_e,maxZoom:xe,nodeExtent:qt,onNodesChange:$l,onEdgesChange:Br,snapToGrid:ze,snapGrid:re,connectionMode:$,translateExtent:$e,connectOnClick:Tt,defaultEdgeOptions:Ns,fitView:Js,fitViewOptions:ws,onNodesDelete:X,onEdgesDelete:W,onDelete:G,onNodeDragStart:z,onNodeDrag:H,onNodeDragStop:q,onSelectionDrag:U,onSelectionDragStart:B,onSelectionDragStop:R,onMove:g,onMoveStart:x,onMoveEnd:y,noPanClassName:bs,nodeOrigin:je,rfId:Vr,autoPanOnConnect:Ul,autoPanOnNodeDrag:Xd,autoPanSpeed:Eo,onError:Ga,connectionRadius:Co,isValidConnection:Hn,selectNodesOnDrag:me,nodeDragThreshold:Xa,connectionDragThreshold:Za,onBeforeDelete:C,paneClickDistance:kn,debug:ko,ariaLabelConfig:To}),o.jsx(_I,{onSelectionChange:ne}),Pn,o.jsx(bI,{proOptions:Hl,position:Pl}),o.jsx(vI,{rfId:Vr,disableKeyboardA11y:Ya})]})})}var KL=vS(WL);function QL(e){const[n,r]=w.useState(e),a=w.useCallback(l=>r(c=>xS(l,c)),[]);return[n,r,a]}function JL(e){const[n,r]=w.useState(e),a=w.useCallback(l=>r(c=>yS(l,c)),[]);return[n,r,a]}function e7(e){return at(w.useCallback(r=>r.nodeLookup.get(e),[e]),bt)}function t7({dimensions:e,lineWidth:n,variant:r,className:a}){return o.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Dt(["react-flow__background-pattern",r,a])})}function n7({radius:e,className:n}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Dt(["react-flow__background-pattern","dots",n])})}var Ys;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ys||(Ys={}));const s7={[Ys.Dots]:1,[Ys.Lines]:1,[Ys.Cross]:6},r7=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function VS({id:e,variant:n=Ys.Dots,gap:r=20,size:a,lineWidth:l=1,offset:c=0,color:d,bgColor:f,style:m,className:h,patternClassName:g}){const x=w.useRef(null),{transform:y,patternId:b}=at(r7,bt),j=a||s7[n],N=n===Ys.Dots,S=n===Ys.Cross,_=Array.isArray(r)?r:[r,r],A=[_[0]*y[2]||1,_[1]*y[2]||1],E=j*y[2],M=Array.isArray(c)?c:[c,c],T=S?[E,E]:A,D=[M[0]*y[2]||1+T[0]/2,M[1]*y[2]||1+T[1]/2],z=`${b}${e||""}`;return o.jsxs("svg",{className:Dt(["react-flow__background",h]),style:{...m,...Vd,"--xy-background-color-props":f,"--xy-background-pattern-color-props":d},ref:x,"data-testid":"rf__background",children:[o.jsx("pattern",{id:z,x:y[0]%A[0],y:y[1]%A[1],width:A[0],height:A[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${D[0]},-${D[1]})`,children:N?o.jsx(n7,{radius:E/2,className:g}):o.jsx(t7,{dimensions:T,lineWidth:l,variant:n,className:g})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${z})`})]})}VS.displayName="Background";const o7=w.memo(VS);function a7(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function i7(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function l7(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.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 c7(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 u7(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 gu({children:e,className:n,...r}){return o.jsx("button",{type:"button",className:Dt(["react-flow__controls-button",n]),...r,children:e})}const d7=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function qS({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:a=!0,fitViewOptions:l,onZoomIn:c,onZoomOut:d,onFitView:f,onInteractiveChange:m,className:h,children:g,position:x="bottom-left",orientation:y="vertical","aria-label":b}){const j=wt(),{isInteractive:N,minZoomReached:S,maxZoomReached:_,ariaLabelConfig:A}=at(d7,bt),{zoomIn:E,zoomOut:M,fitView:T}=Va(),D=()=>{E(),c?.()},z=()=>{M(),d?.()},H=()=>{T(l),f?.()},q=()=>{j.setState({nodesDraggable:!N,nodesConnectable:!N,elementsSelectable:!N}),m?.(!N)},X=y==="horizontal"?"horizontal":"vertical";return o.jsxs(Bd,{className:Dt(["react-flow__controls",X,h]),position:x,style:e,"data-testid":"rf__controls","aria-label":b??A["controls.ariaLabel"],children:[n&&o.jsxs(o.Fragment,{children:[o.jsx(gu,{onClick:D,className:"react-flow__controls-zoomin",title:A["controls.zoomIn.ariaLabel"],"aria-label":A["controls.zoomIn.ariaLabel"],disabled:_,children:o.jsx(a7,{})}),o.jsx(gu,{onClick:z,className:"react-flow__controls-zoomout",title:A["controls.zoomOut.ariaLabel"],"aria-label":A["controls.zoomOut.ariaLabel"],disabled:S,children:o.jsx(i7,{})})]}),r&&o.jsx(gu,{className:"react-flow__controls-fitview",onClick:H,title:A["controls.fitView.ariaLabel"],"aria-label":A["controls.fitView.ariaLabel"],children:o.jsx(l7,{})}),a&&o.jsx(gu,{className:"react-flow__controls-interactive",onClick:q,title:A["controls.interactive.ariaLabel"],"aria-label":A["controls.interactive.ariaLabel"],children:N?o.jsx(u7,{}):o.jsx(c7,{})}),g]})}qS.displayName="Controls";const f7=w.memo(qS);function m7({id:e,x:n,y:r,width:a,height:l,style:c,color:d,strokeColor:f,strokeWidth:m,className:h,borderRadius:g,shapeRendering:x,selected:y,onClick:b}){const{background:j,backgroundColor:N}=c||{},S=d||j||N;return o.jsx("rect",{className:Dt(["react-flow__minimap-node",{selected:y},h]),x:n,y:r,rx:g,ry:g,width:a,height:l,style:{fill:S,stroke:f,strokeWidth:m},shapeRendering:x,onClick:b?_=>b(_,e):void 0})}const h7=w.memo(m7),p7=e=>e.nodes.map(n=>n.id),Hh=e=>e instanceof Function?e:()=>e;function g7({nodeStrokeColor:e,nodeColor:n,nodeClassName:r="",nodeBorderRadius:a=5,nodeStrokeWidth:l,nodeComponent:c=h7,onClick:d}){const f=at(p7,bt),m=Hh(n),h=Hh(e),g=Hh(r),x=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:f.map(y=>o.jsx(y7,{id:y,nodeColorFunc:m,nodeStrokeColorFunc:h,nodeClassNameFunc:g,nodeBorderRadius:a,nodeStrokeWidth:l,NodeComponent:c,onClick:d,shapeRendering:x},y))})}function x7({id:e,nodeColorFunc:n,nodeStrokeColorFunc:r,nodeClassNameFunc:a,nodeBorderRadius:l,nodeStrokeWidth:c,shapeRendering:d,NodeComponent:f,onClick:m}){const{node:h,x:g,y:x,width:y,height:b}=at(j=>{const{internals:N}=j.nodeLookup.get(e),S=N.userNode,{x:_,y:A}=N.positionAbsolute,{width:E,height:M}=Ws(S);return{node:S,x:_,y:A,width:E,height:M}},bt);return!h||h.hidden||!Yj(h)?null:o.jsx(f,{x:g,y:x,width:y,height:b,style:h.style,selected:!!h.selected,className:a(h),color:n(h),borderRadius:l,strokeColor:r(h),strokeWidth:c,shapeRendering:d,onClick:m,id:h.id})}const y7=w.memo(x7);var v7=w.memo(g7);const b7=200,w7=150,N7=e=>!e.hidden,j7=e=>{const n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:e.nodeLookup.size>0?Fj(Dl(e.nodeLookup,{filter:N7}),n):n,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},S7="react-flow__minimap-desc";function FS({style:e,className:n,nodeStrokeColor:r,nodeColor:a,nodeClassName:l="",nodeBorderRadius:c=5,nodeStrokeWidth:d,nodeComponent:f,bgColor:m,maskColor:h,maskStrokeColor:g,maskStrokeWidth:x,position:y="bottom-right",onClick:b,onNodeClick:j,pannable:N=!1,zoomable:S=!1,ariaLabel:_,inversePan:A,zoomStep:E=1,offsetScale:M=5}){const T=wt(),D=w.useRef(null),{boundingRect:z,viewBB:H,rfId:q,panZoom:X,translateExtent:W,flowWidth:G,flowHeight:ne,ariaLabelConfig:B}=at(j7,bt),U=e?.width??b7,R=e?.height??w7,L=z.width/U,I=z.height/R,P=Math.max(L,I),C=P*U,$=P*R,Y=M*P,V=z.x-(C-z.width)/2-Y,J=z.y-($-z.height)/2-Y,ce=C+Y*2,fe=$+Y*2,ee=`${S7}-${q}`,ie=w.useRef(0),ge=w.useRef();ie.current=P,w.useEffect(()=>{if(D.current&&X)return ge.current=$z({domNode:D.current,panZoom:X,getTransform:()=>T.getState().transform,getViewScale:()=>ie.current}),()=>{ge.current?.destroy()}},[X]),w.useEffect(()=>{ge.current?.update({translateExtent:W,width:G,height:ne,inversePan:A,pannable:N,zoomStep:E,zoomable:S})},[N,S,A,E,W,G,ne]);const Ee=b?ze=>{const[re,Q]=ge.current?.pointer(ze)||[0,0];b(ze,{x:re,y:Q})}:void 0,Ne=j?w.useCallback((ze,re)=>{const Q=T.getState().nodeLookup.get(re).internals.userNode;j(ze,Q)},[]):void 0,ve=_??B["minimap.ariaLabel"];return o.jsx(Bd,{position:y,style:{...e,"--xy-minimap-background-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-color-props":typeof g=="string"?g:void 0,"--xy-minimap-mask-stroke-width-props":typeof x=="number"?x*P:void 0,"--xy-minimap-node-background-color-props":typeof a=="string"?a:void 0,"--xy-minimap-node-stroke-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-width-props":typeof d=="number"?d:void 0},className:Dt(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:U,height:R,viewBox:`${V} ${J} ${ce} ${fe}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ee,ref:D,onClick:Ee,children:[ve&&o.jsx("title",{id:ee,children:ve}),o.jsx(v7,{onClick:Ne,nodeColor:a,nodeStrokeColor:r,nodeBorderRadius:c,nodeClassName:l,nodeStrokeWidth:d,nodeComponent:f}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${V-Y},${J-Y}h${ce+Y*2}v${fe+Y*2}h${-ce-Y*2}z
        M${H.x},${H.y}h${H.width}v${H.height}h${-H.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}FS.displayName="MiniMap";const _7=w.memo(FS),E7=e=>n=>e?`${Math.max(1/n.transform[2],1)}`:void 0,C7={[za.Line]:"right",[za.Handle]:"bottom-right"};function k7({nodeId:e,position:n,variant:r=za.Handle,className:a,style:l=void 0,children:c,color:d,minWidth:f=10,minHeight:m=10,maxWidth:h=Number.MAX_VALUE,maxHeight:g=Number.MAX_VALUE,keepAspectRatio:x=!1,resizeDirection:y,autoScale:b=!0,shouldResize:j,onResizeStart:N,onResize:S,onResizeEnd:_}){const A=jS(),E=typeof e=="string"?e:A,M=wt(),T=w.useRef(null),D=r===za.Handle,z=at(w.useCallback(E7(D&&b),[D,b]),bt),H=w.useRef(null),q=n??C7[r];w.useEffect(()=>{if(!(!T.current||!E))return H.current||(H.current=eI({domNode:T.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:W,transform:G,snapGrid:ne,snapToGrid:B,nodeOrigin:U,domNode:R}=M.getState();return{nodeLookup:W,transform:G,snapGrid:ne,snapToGrid:B,nodeOrigin:U,paneDomNode:R}},onChange:(W,G)=>{const{triggerNodeChanges:ne,nodeLookup:B,parentLookup:U,nodeOrigin:R}=M.getState(),L=[],I={x:W.x,y:W.y},P=B.get(E);if(P&&P.expandParent&&P.parentId){const C=P.origin??R,$=W.width??P.measured.width??0,Y=W.height??P.measured.height??0,V={id:P.id,parentId:P.parentId,rect:{width:$,height:Y,...Gj({x:W.x??P.position.x,y:W.y??P.position.y},{width:$,height:Y},P.parentId,B,C)}},J=$g([V],B,U,R);L.push(...J),I.x=W.x?Math.max(C[0]*$,W.x):void 0,I.y=W.y?Math.max(C[1]*Y,W.y):void 0}if(I.x!==void 0&&I.y!==void 0){const C={id:E,type:"position",position:{...I}};L.push(C)}if(W.width!==void 0&&W.height!==void 0){const $={id:E,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:W.width,height:W.height}};L.push($)}for(const C of G){const $={...C,type:"position"};L.push($)}ne(L)},onEnd:({width:W,height:G})=>{const ne={id:E,type:"dimensions",resizing:!1,dimensions:{width:W,height:G}};M.getState().triggerNodeChanges([ne])}})),H.current.update({controlPosition:q,boundaries:{minWidth:f,minHeight:m,maxWidth:h,maxHeight:g},keepAspectRatio:x,resizeDirection:y,onResizeStart:N,onResize:S,onResizeEnd:_,shouldResize:j}),()=>{H.current?.destroy()}},[q,f,m,h,g,x,N,S,_,j]);const X=q.split("-");return o.jsx("div",{className:Dt(["react-flow__resize-control","nodrag",...X,r,a]),ref:T,style:{...l,scale:z,...d&&{[D?"backgroundColor":"borderColor"]:d}},children:c})}w.memo(k7);const T7=e=>{switch(e){case"running":return{borderColor:"border-[#643FB2] dark:border-[#8B5CF6]",glow:"shadow-lg shadow-[#643FB2]/20",badgeColor:"bg-[#643FB2] dark:bg-[#8B5CF6]"};case"completed":return{borderColor:"border-green-500 dark:border-green-400",glow:"shadow-lg shadow-green-500/20",badgeColor:"bg-green-500 dark:bg-green-400"};case"failed":return{borderColor:"border-red-500 dark:border-red-400",glow:"shadow-lg shadow-red-500/20",badgeColor:"bg-red-500 dark:bg-red-400"};case"cancelled":return{borderColor:"border-orange-500 dark:border-orange-400",glow:"shadow-lg shadow-orange-500/20",badgeColor:"bg-orange-500 dark:bg-orange-400"};case"pending":default:return{borderColor:"border-gray-300 dark:border-gray-600",glow:"",badgeColor:"bg-gray-400 dark:bg-gray-500"}}},YS=w.memo(({data:e,selected:n})=>{const r=e,a=T7(r.state),[l,c]=w.useState(!1),d=r.outputData||r.error,f=r.state==="running",m=f&&(r.isStreaming??!0),h=r.layoutDirection==="TB",g=h?Ue.Top:Ue.Left,x=h?Ue.Bottom:Ue.Right,y=()=>{if(r.error&&typeof r.error=="string"){const b=Cu(r.error,200);return o.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-950/20 p-2 rounded border border-red-200 dark:border-red-800 break-words max-h-32 overflow-auto",children:b})}if(r.outputData)try{const b=typeof r.outputData=="string"?r.outputData:JSON.stringify(r.outputData,null,2);return o.jsx("div",{className:"text-xs text-gray-700 dark:text-gray-300 bg-muted/50 p-2 rounded border max-h-32 overflow-auto",children:o.jsx("pre",{className:"whitespace-pre-wrap font-mono",children:b})})}catch{return o.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400 bg-muted/50 p-2 rounded border",children:"[Unable to display output]"})}return null};return o.jsxs("div",{className:We("group relative w-64 bg-card dark:bg-card rounded border-2 transition-all duration-200",a.borderColor,n?"ring-2 ring-blue-500 ring-offset-2":"",f?a.glow:"shadow-sm"),children:[o.jsx(Ia,{type:"target",position:g,id:"target",className:"!w-2 !h-2 !rounded-full !border !border-gray-600 dark:!border-gray-500 transition-colors !min-w-0 !min-h-0",style:{backgroundColor:r.state==="running"?"#643FB2":r.state==="completed"?"#10b981":r.state==="failed"?"#ef4444":r.state==="cancelled"?"#f97316":"#4b5563"}}),o.jsx(Ia,{type:"source",position:x,id:"source",className:"!w-2 !h-2 !rounded-full !border !border-gray-600 dark:!border-gray-500 transition-colors !min-w-0 !min-h-0",style:{backgroundColor:r.state==="running"?"#643FB2":r.state==="completed"?"#10b981":r.state==="failed"?"#ef4444":r.state==="cancelled"?"#f97316":"#4b5563"}}),o.jsxs("div",{className:"p-3",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"flex-shrink-0 relative",children:o.jsx("div",{className:"w-10 h-10 rounded-lg bg-gray-900/90 dark:bg-gray-800/90 flex items-center justify-center",children:r.isStartNode?o.jsx(YA,{className:"w-5 h-5 text-[#643FB2] dark:text-[#8B5CF6]"}):o.jsx(Us,{className:"w-5 h-5 text-gray-300 dark:text-gray-400"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("h3",{className:"font-medium text-sm text-gray-900 dark:text-gray-100 truncate",children:r.name||r.executorId}),f&&o.jsx(Or,{className:`w-4 h-4 text-[#643FB2] dark:text-[#8B5CF6] ${m?"animate-spin":""} flex-shrink-0`})]}),r.executorType&&o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate mt-0.5",children:r.executorType})]})]}),d&&o.jsxs("div",{className:"mt-2 border-t border-border/50 pt-2",children:[o.jsxs("button",{onClick:b=>{b.stopPropagation(),c(!l)},className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors w-full",children:[l?o.jsx(Rt,{className:"w-3 h-3"}):o.jsx(en,{className:"w-3 h-3"}),o.jsx("span",{children:r.error?"Show error":"Show output"})]}),l&&o.jsx("div",{className:"mt-2",children:y()})]}),f&&o.jsx("div",{className:"absolute inset-0 rounded border-2 border-[#643FB2]/30 dark:border-[#8B5CF6]/30 animate-pulse pointer-events-none"})]})]})});YS.displayName="ExecutorNode";const A7=w.memo(function({id:n,source:r,markerEnd:a,style:l}){const c=e7(r);if(!c)return null;const{width:d,height:f}=c.measured,{x:m,y:h}=c.internals.positionAbsolute;if(!d||!f)return null;const x=c.data?.layoutDirection==="TB",y=100,b=40;let j;if(x){const N=m+d/2,S=h+f,_=m+d/2,A=h,E=m+d+y;j=`M ${N} ${S} C ${N} ${S+b}, ${E} ${S+b}, ${E} ${h+f/2} C ${E} ${A-b}, ${_} ${A-b}, ${_} ${A}`}else{const N=m+d,S=h+f/2,_=m,A=h+f/2,E=h+f+y;j=`M ${N} ${S} C ${N+b} ${S}, ${N+b} ${E}, ${m+d/2} ${E} C ${_-b} ${E}, ${_-b} ${A}, ${_} ${A}`}return o.jsx(Il,{id:n,path:j,markerEnd:a,style:l})}),M7={executor:YS},R7={selfLoop:A7};function D7({workflowDump:e,onNodeSelect:n,viewOptions:r,onToggleViewOption:a,layoutDirection:l,onLayoutDirectionChange:c}){const{fitView:d,setViewport:f,setNodes:m}=Va(),h=()=>{f({x:0,y:0,zoom:1})},g=()=>{d({padding:.2})},x=()=>{if(!e)return;const y=up(e,n,l),b=dp(e),j=fp(y,b,l);m(j)};return o.jsx("div",{className:"absolute top-4 right-4 z-10",children:o.jsxs(bd,{children:[o.jsx(wd,{asChild:!0,children:o.jsxs(Le,{variant:"outline",size:"sm",className:"h-8 w-8 p-0 bg-white/90 backdrop-blur-sm border-gray-200 shadow-sm hover:bg-white dark:bg-gray-800/90 dark:border-gray-600 dark:hover:bg-gray-800",children:[o.jsx($A,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"View options"})]})}),o.jsxs(Nd,{align:"end",className:"w-56",children:[o.jsxs($t,{className:"flex items-center justify-between",onClick:()=>a?.("showMinimap"),children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx(aM,{className:"mr-2 h-4 w-4"}),"Show Minimap"]}),o.jsx(co,{checked:r.showMinimap,onChange:()=>{}})]}),o.jsxs($t,{className:"flex items-center justify-between",onClick:()=>a?.("showGrid"),children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx(qA,{className:"mr-2 h-4 w-4"}),"Show Grid"]}),o.jsx(co,{checked:r.showGrid,onChange:()=>{}})]}),o.jsxs($t,{className:"flex items-center justify-between",onClick:()=>a?.("animateRun"),children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx(og,{className:"mr-2 h-4 w-4"}),"Animate Run"]}),o.jsx(co,{checked:r.animateRun,onChange:()=>{}})]}),o.jsxs($t,{className:"flex items-center justify-between",onClick:()=>a?.("consolidateBidirectionalEdges"),children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx(cA,{className:"mr-2 h-4 w-4"}),"Merge Bidirectional Edges"]}),o.jsx(co,{checked:r.consolidateBidirectionalEdges,onChange:()=>{}})]}),o.jsx(va,{}),o.jsxs($t,{className:"flex items-center justify-between",onClick:()=>{const y=l==="LR"?"TB":"LR";if(c?.(y),e){const b=up(e,n,y),j=dp(e),N=fp(b,j,y);m(N)}},children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx(iA,{className:"mr-2 h-4 w-4"}),"Vertical Layout"]}),o.jsx(co,{checked:l==="TB",onChange:()=>{}})]}),o.jsx(va,{}),o.jsxs($t,{onClick:h,children:[o.jsx(sg,{className:"mr-2 h-4 w-4"}),"Reset Zoom"]}),o.jsxs($t,{onClick:g,children:[o.jsx(lM,{className:"mr-2 h-4 w-4"}),"Fit to Screen"]}),o.jsxs($t,{onClick:x,children:[o.jsx(MM,{className:"mr-2 h-4 w-4"}),"Auto-arrange"]})]})]})})}function O7({nodes:e,nodeUpdates:n,isStreaming:r,animateRun:a}){const{fitView:l}=Va();return w.useEffect(()=>{if(a)if(r){const c=e.filter(d=>d.data.state==="running");if(c.length>0){const d=c[0];l({nodes:[d],duration:800,padding:.3,minZoom:.8,maxZoom:1.5})}}else e.length>0&&l({duration:1e3,padding:.2})},[n,r,a,e]),null}const z7=w.memo(({timelineVisible:e})=>{const{fitView:n}=Va();return w.useEffect(()=>{const r=setTimeout(()=>{n({padding:.2,duration:300})},350);return()=>clearTimeout(r)},[e]),null}),I7=w.memo(function({workflowDump:n,events:r,isStreaming:a,onNodeSelect:l,className:c="",viewOptions:d={showMinimap:!1,showGrid:!0,animateRun:!0,consolidateBidirectionalEdges:!0},onToggleViewOption:f,layoutDirection:m="TB",onLayoutDirectionChange:h,timelineVisible:g=!1}){const{initialNodes:x,initialEdges:y}=w.useMemo(()=>{if(!n)return{initialNodes:[],initialEdges:[]};const T=up(n,l,m),D=dp(n),z=d.consolidateBidirectionalEdges?Ch(D):D;return{initialNodes:T.length>0?fp(T,z,m):T,initialEdges:z}},[n,l,m,d.consolidateBidirectionalEdges]),[b,j,N]=QL(x),[S,_,A]=JL(y),E=w.useMemo(()=>v6(r,n?.start_executor_id),[r,n?.start_executor_id]);w.useMemo(()=>{Object.keys(E).length>0?j(T=>b6(T,E,a)):r.length===0&&j(T=>T.map(D=>({...D,data:{...D.data,state:"pending",outputData:void 0,error:void 0,isStreaming:!1}})))},[E,j,r.length,a]),w.useMemo(()=>{r.length>0?_(T=>{const D=N6(T,r);return d.consolidateBidirectionalEdges?Ch(D):D}):_(T=>{const D=T.map(z=>({...z,animated:!1,style:{stroke:"#6b7280",strokeWidth:2}}));return d.consolidateBidirectionalEdges?Ch(D):D})},[r,_,d.consolidateBidirectionalEdges]),w.useEffect(()=>{x.length>0&&(j(x),_(y))},[n,d.consolidateBidirectionalEdges]);const M=w.useCallback((T,D)=>{T.stopPropagation(),l?.(D.data.executorId,D.data)},[l]);return n?x.length===0?o.jsx("div",{className:`flex items-center justify-center h-full bg-gray-50 dark:bg-gray-900 rounded border border-gray-200 dark:border-gray-700 ${c}`,children:o.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[o.jsx("div",{className:"text-lg font-medium mb-2",children:"No Executors Found"}),o.jsx("div",{className:"text-sm",children:"Could not extract executors from workflow dump."}),o.jsxs("details",{className:"mt-2 text-xs",children:[o.jsx("summary",{className:"cursor-pointer",children:"Debug Info"}),o.jsx("pre",{className:"mt-1 p-2 bg-gray-100 dark:bg-gray-800 rounded text-left overflow-auto",children:JSON.stringify(n,null,2)})]})]})}):o.jsxs("div",{className:`h-full w-full ${c}`,children:[o.jsxs(KL,{nodes:b,edges:S,onNodesChange:N,onEdgesChange:A,onNodeClick:M,nodeTypes:M7,edgeTypes:R7,fitView:!0,fitViewOptions:{padding:.2},minZoom:.1,maxZoom:1.5,defaultEdgeOptions:{type:"default",animated:!1,style:{stroke:"#6b7280",strokeWidth:2}},nodesDraggable:!a,nodesConnectable:!1,elementsSelectable:!0,proOptions:{hideAttribution:!0},children:[d.showGrid&&o.jsx(o7,{variant:Ys.Dots,gap:20,size:1,color:"#e5e7eb",className:"dark:opacity-30"}),o.jsx(f7,{position:"bottom-left",showInteractive:!1,style:{backgroundColor:"rgba(255, 255, 255, 0.9)",border:"1px solid #e5e7eb",borderRadius:"3px"},className:"dark:!bg-gray-800/90 dark:!border-gray-600"}),d.showMinimap&&o.jsx(_7,{nodeColor:T=>{switch(T.data?.state){case"running":return"#643FB2";case"completed":return"#10b981";case"failed":return"#ef4444";case"cancelled":return"#f97316";default:return"#6b7280"}},maskColor:"rgba(0, 0, 0, 0.1)",position:"bottom-right",style:{backgroundColor:"rgba(255, 255, 255, 0.9)",border:"1px solid #e5e7eb",borderRadius:"8px"},className:"dark:!bg-gray-800/90 dark:!border-gray-600"}),o.jsx(O7,{nodes:b,nodeUpdates:E,isStreaming:a,animateRun:d.animateRun}),o.jsx(z7,{timelineVisible:g}),o.jsx(D7,{workflowDump:n,onNodeSelect:l,viewOptions:d,onToggleViewOption:f,layoutDirection:m,onLayoutDirectionChange:h})]}),o.jsx("style",{children:`
        .react-flow__edge-path {
          transition: stroke 0.3s ease, stroke-width 0.3s ease;
        }
        .react-flow__edge.animated .react-flow__edge-path {
          stroke-dasharray: 5 5;
          animation: dash 1s linear infinite;
        }
        @keyframes dash {
          0% { stroke-dashoffset: 0; }
          100% { stroke-dashoffset: -10; }
        }

        /* Dark theme styles for React Flow controls */
        .dark .react-flow__controls {
          background-color: rgba(31, 41, 55, 0.9) !important;
          border-color: rgb(75, 85, 99) !important;
        }
        .dark .react-flow__controls-button {
          background-color: rgba(31, 41, 55, 0.9) !important;
          border-color: rgb(75, 85, 99) !important;
          color: rgb(229, 231, 235) !important;
        }
        .dark .react-flow__controls-button:hover {
          background-color: rgba(55, 65, 81, 0.9) !important;
          color: rgb(255, 255, 255) !important;
        }
        .dark .react-flow__controls-button svg {
          fill: rgb(229, 231, 235) !important;
        }
        .dark .react-flow__controls-button:hover svg {
          fill: rgb(255, 255, 255) !important;
        }
      `})]}):o.jsx("div",{className:`flex items-center justify-center h-full bg-gray-50 dark:bg-gray-900 rounded border border-gray-200 dark:border-gray-700 ${c}`,children:o.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[o.jsx("div",{className:"text-lg font-medium mb-2",children:"No Workflow Data"}),o.jsx("div",{className:"text-sm",children:"Workflow dump is not available."})]})})});function xu({title:e,icon:n,children:r,className:a=""}){return o.jsxs("div",{className:`border rounded-lg p-4 bg-card ${a}`,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n,o.jsx("h3",{className:"text-sm font-semibold text-foreground",children:e})]}),o.jsx("div",{className:"text-sm text-muted-foreground",children:r})]})}function L7({workflow:e,open:n,onOpenChange:r}){const a=e.source==="directory"?o.jsx(aN,{className:"h-4 w-4 text-muted-foreground"}):e.source==="in_memory"?o.jsx(Kh,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(iN,{className:"h-4 w-4 text-muted-foreground"}),l=e.source==="directory"?"Local":e.source==="in_memory"?"In-Memory":"Gallery";return o.jsx(Ir,{open:n,onOpenChange:r,children:o.jsxs(Lr,{className:"max-w-4xl max-h-[90vh] flex flex-col",children:[o.jsxs($r,{className:"px-6 pt-6 flex-shrink-0",children:[o.jsx(Pr,{children:"Workflow Details"}),o.jsx(So,{onClose:()=>r(!1)})]}),o.jsxs("div",{className:"px-6 pb-6 overflow-y-auto flex-1",children:[o.jsxs("div",{className:"mb-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[o.jsx(Us,{className:"h-6 w-6 text-primary"}),o.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e.name||e.id})]}),e.description&&o.jsx("p",{className:"text-muted-foreground",children:e.description})]}),o.jsx("div",{className:"h-px bg-border mb-6"}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[o.jsx(xu,{title:"Start Executor",icon:o.jsx(EA,{className:"h-4 w-4 text-muted-foreground"}),children:o.jsx("div",{className:"font-mono text-foreground",children:e.start_executor_id})}),o.jsx(xu,{title:"Source",icon:a,children:o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-foreground",children:l}),e.module_path&&o.jsx("div",{className:"font-mono text-xs break-all",children:e.module_path})]})}),o.jsx(xu,{title:"Environment",icon:e.has_env?o.jsx(kl,{className:"h-4 w-4 text-orange-500"}):o.jsx(yd,{className:"h-4 w-4 text-green-500"}),className:"md:col-span-2",children:o.jsx("div",{className:e.has_env?"text-orange-600 dark:text-orange-400":"text-green-600 dark:text-green-400",children:e.has_env?"Requires environment variables":"No environment variables required"})})]}),o.jsx(xu,{title:`Executors (${e.executors.length})`,icon:o.jsx(Uu,{className:"h-4 w-4 text-muted-foreground"}),children:e.executors.length>0?o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2",children:e.executors.map((c,d)=>o.jsx("div",{className:"font-mono text-xs text-foreground bg-muted px-2 py-1 rounded truncate",title:c,children:c},d))}):o.jsx("div",{className:"text-muted-foreground",children:"No executors configured"})})]})]})})}function $7({session:e,checkpoints:n,open:r,onOpenChange:a}){const[l,c]=w.useState(null),[d,f]=w.useState(null),[m,h]=w.useState(!1),[g,x]=w.useState(!0);if(w.useEffect(()=>{r&&n.length>0&&(n.some(_=>_.checkpoint_id===l)||c(n[0].checkpoint_id))},[r,n]),w.useEffect(()=>{if(!l||!e)return;(async()=>{h(!0);try{const _=await Ze.getConversationItem(e.conversation_id,`checkpoint_${l}`);f(_.metadata?.full_checkpoint??null)}catch(_){console.error("Failed to load checkpoint:",_),f(null)}finally{h(!1)}})()},[l,e]),!e)return null;const y=n.find(S=>S.checkpoint_id===l),b=d?.shared_state?._executor_state?Object.keys(d.shared_state._executor_state):[],j=d?.messages?Object.keys(d.messages):[],N=S=>{if(!S)return"";const _=S/1024;return _<1?`${S} B`:_<1024?`${_.toFixed(1)} KB`:`${(_/1024).toFixed(1)} MB`};return o.jsx(Ir,{open:r,onOpenChange:a,children:o.jsxs(Lr,{className:"w-[90vw] max-w-6xl min-w-[800px] h-[85vh] flex flex-col p-0",children:[o.jsx($r,{className:"px-6 pt-6 pb-4 border-b flex-shrink-0",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex-1",children:[o.jsx(Pr,{children:e.metadata.name}),o.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[n.length," checkpoint",n.length!==1?"s":""]}),o.jsx("div",{className:"text-xs text-muted-foreground mt-2 max-w-2xl",children:"This is a read only view of the current checkpoint ids in the checkpoint storage for this workflow run."})]}),o.jsx(So,{onClose:()=>a(!1)})]})}),o.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[o.jsx("div",{className:"w-80 border-r flex flex-col",children:o.jsx(Wn,{className:"flex-1",children:o.jsx("div",{className:"p-4 space-y-2",children:n.length===0?o.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"No checkpoints yet"}):n.map((S,_)=>{const A=S.checkpoint_id===l,E=S.metadata.has_pending_hil;return o.jsxs("div",{className:"relative",children:[o.jsx("button",{onClick:()=>c(S.checkpoint_id),className:We("relative w-full text-left p-3 rounded-lg border transition-colors",A?"bg-primary/10 border-primary":"hover:bg-muted/50 border-transparent"),children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"flex flex-col items-center pt-1",children:o.jsx("div",{className:We("w-2 h-2 rounded-full z-10",E?"bg-blue-500 ring-2 ring-blue-500/20":"bg-muted-foreground/30")})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm font-medium",children:S.metadata.iteration_count===0?"Initial State":`Step ${S.metadata.iteration_count}`}),o.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/70",title:S.checkpoint_id,children:S.checkpoint_id.slice(0,8)}),_===0&&o.jsx(ut,{variant:"secondary",className:"text-[10px] h-4 px-1",children:"Latest"}),E&&o.jsxs(ut,{variant:"secondary",className:"text-[10px] h-4 px-1.5",children:[S.metadata.pending_hil_count," HIL"]})]}),o.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground mt-1",children:[o.jsx("span",{children:new Date(S.timestamp).toLocaleTimeString()}),S.metadata.size_bytes&&o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"•"}),o.jsx("span",{children:N(S.metadata.size_bytes)})]})]})]})]})}),_<n.length-1&&o.jsx("div",{className:"absolute left-[18px] top-[30px] w-px h-[calc(100%+8px)] bg-border"})]},S.checkpoint_id)})})})}),o.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:!d&&!m?o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Select a checkpoint to view details"}):o.jsx(Wn,{className:"flex-1",children:o.jsxs("div",{className:"p-6 space-y-6 relative",children:[m&&o.jsx("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center z-10",children:o.jsx(Or,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),o.jsxs("div",{className:"flex items-start justify-between pb-4 border-b",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx(Jp,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"font-medium",children:y?.metadata.iteration_count===0?"Initial State":`Step ${y?.metadata.iteration_count}`}),y?.metadata.size_bytes&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["• ",N(y.metadata.size_bytes)]})]}),o.jsx("div",{className:"text-sm text-muted-foreground",children:y&&new Date(y.timestamp).toLocaleString()}),y&&o.jsxs("div",{className:"text-xs font-mono text-muted-foreground/70 mt-1",children:["ID: ",y.checkpoint_id]})]}),y?.metadata.has_pending_hil&&o.jsxs(ut,{variant:"secondary",children:[y.metadata.pending_hil_count," HIL Pending"]})]}),b.length>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-sm font-medium mb-3 flex items-center gap-2",children:[o.jsx(Uu,{className:"h-4 w-4"}),"Active Executors (",b.length,")"]}),o.jsx("div",{className:"flex flex-wrap gap-2",children:b.map(S=>o.jsx(ut,{variant:"outline",className:"font-mono text-xs",children:S},S))})]}),j.length>0&&d&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-sm font-medium mb-3 flex items-center gap-2",children:[o.jsx(eg,{className:"h-4 w-4"}),"Messages"]}),o.jsx("div",{className:"grid grid-cols-2 gap-3",children:j.map(S=>{const _=d.messages[S]?.length;return o.jsxs("div",{className:"bg-muted/50 p-3 rounded-lg",children:[o.jsx("div",{className:"text-xs font-mono text-muted-foreground mb-1",children:S}),o.jsxs("div",{className:"font-medium",children:[_," message",_!==1?"s":""]})]},S)})})]}),d?.pending_request_info_events&&Object.keys(d.pending_request_info_events).length>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-sm font-medium mb-3 flex items-center gap-2",children:[o.jsx(hs,{className:"h-4 w-4"}),"Pending HIL Requests (",Object.keys(d.pending_request_info_events).length,")"]}),o.jsx("div",{className:"space-y-2",children:Object.entries(d.pending_request_info_events).map(([S,_])=>o.jsxs("div",{className:"bg-muted/50 border border-border p-3 rounded-lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("code",{className:"text-xs bg-background px-2 py-1 rounded",children:[S.slice(0,24),"..."]}),o.jsx(ut,{variant:"outline",className:"text-xs",children:_.source_executor_id})]}),o.jsxs("div",{className:"text-xs space-y-1",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Request:"})," ",o.jsx("code",{className:"bg-background px-1 py-0.5 rounded",children:_.request_type?.split(".").pop()||_.request_type})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Response:"})," ",o.jsx("code",{className:"bg-background px-1 py-0.5 rounded",children:_.response_type?.split(".").pop()||_.response_type})]})]})]},S))})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium mb-3",children:"Shared State"}),d?.shared_state&&Object.keys(d.shared_state).filter(S=>S!=="_executor_state").length>0?o.jsx("div",{className:"flex flex-wrap gap-2",children:Object.keys(d.shared_state).filter(S=>S!=="_executor_state").map(S=>o.jsx(ut,{variant:"secondary",className:"font-mono text-xs",children:S},S))}):o.jsx("div",{className:"text-sm text-muted-foreground",children:"No custom state"})]}),o.jsxs("div",{className:"border-t pt-6",children:[o.jsxs("button",{onClick:()=>x(!g),className:"flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors w-full",children:[g?o.jsx(Rt,{className:"h-4 w-4"}):o.jsx(en,{className:"h-4 w-4"}),"Raw JSON"]}),g&&o.jsx("pre",{className:"mt-3 text-[10px] font-mono bg-muted p-4 rounded overflow-x-auto",children:JSON.stringify(d,null,2)})]})]})})})]})]})})}function P7({request:e,response:n,onResponseChange:r,onSubmit:a,isSubmitting:l}){const[c,d]=w.useState(!0),f=h=>{r(h)},m=tj(e.request_schema,n);return o.jsx("div",{className:"relative group",children:o.jsx("div",{children:o.jsx("div",{className:"flex-1",children:o.jsxs("div",{className:"border border-orange-200 dark:border-orange-800 bg-orange-50/50 dark:bg-orange-950/20 overflow-hidden rounded-lg",children:[o.jsxs("div",{className:"px-4 py-3 bg-orange-100/50 dark:bg-orange-950/30 border-b border-orange-200 dark:border-orange-800 flex items-center justify-between cursor-pointer hover:bg-orange-100 dark:hover:bg-orange-950/40 transition-colors",onClick:()=>d(!c),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-medium text-sm text-orange-900 dark:text-orange-100",children:"Workflow needs your input"}),o.jsx(ut,{variant:"outline",className:"text-xs font-mono border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",children:e.request_id.slice(0,8)}),!c&&o.jsx("span",{className:"text-xs text-orange-600 dark:text-orange-400 animate-pulse",children:"Click to respond"})]}),l&&o.jsx(ut,{variant:"secondary",className:"animate-pulse",children:"Submitting..."})]}),c&&o.jsxs("div",{className:"p-4 space-y-4",children:[Object.keys(e.request_data).length>0&&o.jsxs("div",{className:"bg-white/60 dark:bg-gray-900/30 rounded-md p-3 space-y-2",children:[o.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Context"}),o.jsx("div",{className:"max-h-48 overflow-y-auto space-y-1 pr-2",children:Object.entries(e.request_data).filter(([h])=>!["request_id","source_executor_id"].includes(h)).map(([h,g])=>o.jsxs("div",{className:"text-sm",children:[o.jsxs("span",{className:"font-medium text-muted-foreground",children:[h,":"]})," ",o.jsx("span",{className:"text-foreground break-all",children:typeof g=="object"?JSON.stringify(g,null,2):String(g)})]},h))})]}),e.request_schema?.description&&o.jsxs("div",{className:"text-sm text-muted-foreground bg-blue-50 dark:bg-blue-950/20 p-3 rounded-md border border-blue-200 dark:border-blue-800",children:[o.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"What's needed:"}),o.jsx("p",{className:"text-blue-800 dark:text-blue-200",children:e.request_schema.description})]}),o.jsx("div",{className:"space-y-3",children:o.jsx(cp,{schema:e.request_schema,values:n,onChange:f})}),o.jsxs("div",{className:"space-y-2 pt-2",children:[o.jsxs(Le,{size:"default",onClick:a,disabled:!m||l,className:"w-full gap-2",children:[o.jsx(el,{className:"w-4 h-4"}),"Submit Response"]}),!m&&o.jsx("div",{className:"text-xs text-muted-foreground text-center",children:"Please fill in all required fields"})]})]})]})})})})}function H7(e,n=!0){switch(e){case"running":return o.jsx(Or,{className:`w-4 h-4 text-[#643FB2] dark:text-[#8B5CF6] ${n?"animate-spin":""}`});case"completed":return o.jsx(yd,{className:"w-4 h-4 text-green-500 dark:text-green-400"});case"failed":return o.jsx(kl,{className:"w-4 h-4 text-red-500 dark:text-red-400"});case"cancelled":return o.jsx(hs,{className:"w-4 h-4 text-orange-500 dark:text-orange-400"});default:return o.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400 dark:border-gray-500"})}}function U7(e){switch(e){case"running":return"bg-[#643FB2]/10 text-[#643FB2] dark:bg-[#8B5CF6]/10 dark:text-[#8B5CF6] border-[#643FB2]/20 dark:border-[#8B5CF6]/20";case"completed":return"bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/20";case"failed":return"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20";case"cancelled":return"bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/20";default:return"bg-gray-500/10 text-gray-600 dark:text-gray-400 border-gray-500/20"}}function B7({run:e,isExpanded:n,onToggle:r,onClick:a,isSelected:l,isStreaming:c}){const d=new Date(e.timestamp).toLocaleTimeString(),m=e.output.trim().length>0||e.error,h=w.useRef(null);return w.useEffect(()=>{n&&e.state==="running"&&h.current&&(h.current.scrollTop=h.current.scrollHeight)},[e.output,n,e.state]),o.jsxs("div",{className:`border rounded-lg transition-all ${l?"border-blue-500 dark:border-blue-400 bg-blue-500/5 dark:bg-blue-500/10":"border-border hover:border-muted-foreground/30"}`,children:[o.jsxs("div",{className:"p-3 cursor-pointer",onClick:()=>{a(),m&&r()},children:[o.jsxs("div",{className:"grid grid-cols-[auto_auto_1fr_auto] items-center gap-2 mb-1",children:[o.jsx("div",{className:"w-3 text-muted-foreground",children:m&&o.jsx(o.Fragment,{children:n?o.jsx(Rt,{className:"w-3 h-3"}):o.jsx(en,{className:"w-3 h-3"})})}),o.jsx("div",{children:H7(e.state,c)}),o.jsx("span",{className:"font-medium text-sm truncate overflow-hidden",children:e.executorName}),e.runNumber>1?o.jsxs(ut,{variant:"outline",className:"text-xs whitespace-nowrap",children:["Run #",e.runNumber]}):o.jsx("div",{})]}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground ml-5",children:[o.jsx("span",{className:"font-mono",children:d}),o.jsx(ut,{variant:"outline",className:`text-xs border ${U7(e.state)}`,children:e.state})]})]}),n&&m&&o.jsx("div",{className:"border-t px-3 py-2 bg-muted/30",children:e.error?o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-xs font-medium text-red-600 dark:text-red-400",children:"Error:"}),o.jsx("pre",{className:"text-xs bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-800 rounded p-2 overflow-y-auto overflow-x-hidden max-h-40 whitespace-pre-wrap break-all",children:e.error})]}):o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Output:"}),o.jsx("pre",{ref:h,className:"text-xs bg-background border rounded p-2 overflow-y-auto overflow-x-hidden max-h-60 whitespace-pre-wrap break-all",children:e.output})]})})]})}function V7({events:e,itemOutputs:n,currentExecutorId:r,isStreaming:a,onExecutorClick:l,selectedExecutorId:c,workflowResult:d,pendingHilRequests:f=[],hilResponses:m={},onHilResponseChange:h,onHilSubmit:g,isSubmittingHil:x=!1,inputSchema:y,onRun:b,onCancel:j,isCancelling:N=!1,workflowState:S="ready",wasCancelled:_=!1,checkpoints:A=[]}){const[E,M]=w.useState(new Set),[T,D]=w.useState(0),[z,H]=w.useState(!1),q=w.useRef(null),X=w.useRef(null),W=w.useRef(null);w.useEffect(()=>{if(a){const U=setInterval(()=>{D(R=>R+1)},100);return()=>clearInterval(U)}},[a]);const{executorRuns:G,executorRunCount:ne}=w.useMemo(()=>{const U=[],R=new Map;return e.forEach(L=>{const I="_uiTimestamp"in L&&typeof L._uiTimestamp=="number"?L._uiTimestamp*1e3:Date.now();if(L.type==="response.output_item.added"){const P=L.item;if(P&&P.type==="executor_action"&&"executor_id"in P&&P.id){const C=String(P.executor_id),$=P.id,Y=(R.get(C)||0)+1;R.set(C,Y),U.push({executorId:C,executorName:Cu(C,35),itemId:$,state:"running",output:n[$]||"",timestamp:I,runNumber:Y})}else if(P&&P.type==="message"&&"metadata"in P&&P.id){const C=P.metadata;if(C?.agent_id&&C?.source==="magentic"){const $=C.agent_id,Y=P.id,V=(R.get($)||0)+1;R.set($,V),U.push({executorId:$,executorName:Cu($,35),itemId:Y,state:"running",output:n[Y]||"",timestamp:I,runNumber:V})}}}if(L.type==="response.output_item.done"){const P=L.item;if(P&&P.type==="executor_action"&&"executor_id"in P&&P.id){const C=P.id,$=U.find(Y=>Y.itemId===C);$&&($.state=P.status==="completed"?"completed":P.status==="failed"?"failed":"completed",$.output=n[C]||"",P.status==="failed"&&"error"in P&&P.error&&($.error=String(P.error)))}else if(P&&P.type==="message"&&"metadata"in P&&P.id){const C=P.metadata;if(C?.agent_id&&C?.source==="magentic"){const $=P.id,Y=U.find(V=>V.itemId===$);Y&&(Y.state=P.status==="completed"?"completed":"failed",Y.output=n[$]||"")}}}if(L.type==="response.workflow_event.completed"&&"data"in L&&L.data){const P=L.data,C=P.executor_id;if(!C)return;const $=P.event_type;if($==="ExecutorInvokedEvent"){const Y=(R.get(C)||0)+1;R.set(C,Y);const V=`fallback_${C}_${I}`;U.push({executorId:C,executorName:Cu(C,35),itemId:V,state:"running",output:n[V]||"",timestamp:I,runNumber:Y})}else if($==="ExecutorCompletedEvent"){let Y;for(let V=U.length-1;V>=0;V--)if(U[V].executorId===C&&U[V].state==="running"){Y=U[V];break}Y&&(Y.state="completed",Y.output=n[Y.itemId]||"")}else if($?.includes("Error")||$?.includes("Failed")){let Y;for(let V=U.length-1;V>=0;V--)if(U[V].executorId===C&&U[V].state==="running"){Y=U[V];break}Y&&(Y.state="failed",Y.error=typeof P.data=="string"?P.data:"Execution failed")}}}),U.forEach(L=>{L.state==="running"&&n[L.itemId]&&(L.output=n[L.itemId])}),{executorRuns:U,executorRunCount:R}},[e,n,T]);w.useEffect(()=>{r&&M(U=>{const R=new Set(U);return R.add(`${r}-${ne.get(r)||1}`),R})},[r,ne]),w.useEffect(()=>{if(G.length>0&&a){const U=G[G.length-1],R=`${U.executorId}-${U.runNumber}`;R!==q.current&&(q.current=R,X.current&&X.current.scrollIntoView({behavior:"smooth",block:"end"}))}},[G,a]),w.useEffect(()=>{d&&!a&&X.current&&setTimeout(()=>{X.current?.scrollIntoView({behavior:"smooth",block:"end"})},100)},[d,a]),w.useEffect(()=>{!a&&G.length>0&&f.length===0&&setTimeout(()=>{X.current?.scrollIntoView({behavior:"smooth",block:"end"})},100)},[a,f.length,G.length]),w.useEffect(()=>{f.length>0&&W.current&&setTimeout(()=>{W.current?.scrollIntoView({behavior:"smooth",block:"end"}),W.current?.classList.add("highlight-attention"),setTimeout(()=>{W.current?.classList.remove("highlight-attention")},1e3)},100)},[f.length]);const B=()=>{const U=G.map(R=>{const I=`[${new Date(R.timestamp).toLocaleTimeString()}] ${R.executorName} (${R.state})`,P=R.error||R.output||"(no output)";return`${I}
${P}
`}).join(`
`);navigator.clipboard.writeText(U),H(!0),setTimeout(()=>H(!1),2e3)};return o.jsxs("div",{className:"h-full flex flex-col border-l bg-muted/30",children:[o.jsxs("div",{className:"p-3 border-b bg-background flex items-center justify-between flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-medium text-sm",children:"Execution Timeline"}),o.jsx(ut,{variant:"outline",className:"text-xs",children:G.length}),a&&o.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[o.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-[#643FB2] dark:bg-[#8B5CF6]"}),o.jsx("span",{children:"Running"})]})]}),G.length>0&&o.jsx(Le,{variant:"ghost",size:"sm",onClick:B,className:`h-7 px-2 text-xs ${z?"text-green-600 dark:text-green-400":""}`,children:z?o.jsxs(o.Fragment,{children:[o.jsx(jo,{className:"w-3 h-3 mr-1"}),"Copied!"]}):o.jsxs(o.Fragment,{children:[o.jsx(uo,{className:"w-3 h-3 mr-1"}),"Copy All"]})})]}),o.jsx(Wn,{className:"flex-1",children:o.jsxs("div",{className:"p-3 space-y-2",children:[G.length===0?o.jsx("div",{className:"text-center text-muted-foreground text-sm py-8",children:a?"Workflow is running...":"Ready to run workflow"}):o.jsxs(o.Fragment,{children:[G.map((U,R)=>{const L=`${U.executorId}-${U.runNumber}`;return o.jsx(B7,{run:U,isExpanded:E.has(L),onToggle:()=>{M(I=>{const P=new Set(I);return P.has(L)?P.delete(L):P.add(L),P})},onClick:()=>l?.(U.executorId),isSelected:c===U.executorId,isStreaming:a},`${L}-${R}`)}),f.length>0&&o.jsx("div",{ref:W,"data-hil-form":!0,className:"transition-all duration-300",children:f.map(U=>o.jsx(P7,{request:U,response:m[U.request_id]||{},onResponseChange:R=>h?.(U.request_id,R),onSubmit:()=>g?.(),isSubmitting:x},U.request_id))})]}),d&&d.trim().length>0&&!a&&!_&&o.jsxs("div",{className:"border rounded-lg border-green-500/40 bg-green-500/5 dark:bg-green-500/10",children:[o.jsx("div",{className:"p-3 bg-green-500/10 border-b border-green-500/20",children:o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx(yd,{className:"w-4 h-4 text-green-500 dark:text-green-400"}),o.jsx("span",{className:"font-medium text-sm",children:"Workflow Complete"})]})}),o.jsx("div",{className:"border-t px-3 py-2 bg-muted/30",children:o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Final Output:"}),o.jsx("pre",{className:"text-xs bg-background border rounded p-2 overflow-y-auto overflow-x-hidden max-h-60 whitespace-pre-wrap break-all",children:d})]})})]}),_&&!a&&o.jsx("div",{className:"border rounded-lg border-orange-500/40 bg-orange-500/5 dark:bg-orange-500/10",children:o.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",children:[o.jsx(vd,{className:"w-4 h-4 text-orange-500 dark:text-orange-400 fill-current"}),o.jsx("span",{className:"font-medium text-sm text-orange-700 dark:text-orange-300",children:"Execution stopped by user"})]})}),o.jsx("div",{ref:X})]})}),(b||j)&&f.length===0&&o.jsx("div",{className:"border-t p-3 bg-background flex-shrink-0",children:y&&sj(y)?o.jsx(xg,{onSubmit:async U=>{b?.([{type:"message",role:"user",content:U}])},isSubmitting:S==="running",isStreaming:S==="running",onCancel:j,isCancelling:N,placeholder:"Message workflow...",showFileUpload:!0,entityName:"workflow"}):o.jsx(aj,{inputSchema:y,onRun:b||(()=>{}),onCancel:j,isSubmitting:S==="running",isCancelling:N,workflowState:S,checkpoints:A,showCheckpoints:!1})})]})}function q7({selectedWorkflow:e,onDebugEvent:n}){const[r,a]=w.useState(null),[l,c]=w.useState(!1),[d,f]=w.useState(null),[m,h]=w.useState([]),[g,x]=w.useState(!1),[y,b]=w.useState(!1),[j,N]=w.useState(null),[S,_]=w.useState(!1),[A,E]=w.useState(!1),[M,T]=w.useState(!1),[D,z]=w.useState(!1),[H,q]=w.useState(""),[X,W]=w.useState([]),{isCancelling:G,createAbortSignal:ne,handleCancel:B,resetCancelling:U}=w2(),[R,L]=w.useState([]),[I,P]=w.useState({}),C=w.useRef({}),$=w.useRef(null),Y=w.useRef(null),V=le(pe=>pe.currentSession),J=le(pe=>pe.availableSessions),ce=le(pe=>pe.loadingSessions),fe=le(pe=>pe.setCurrentSession),ee=le(pe=>pe.setAvailableSessions),ie=le(pe=>pe.setLoadingSessions),ge=le(pe=>pe.addSession),Ee=le(pe=>pe.removeSession),Ne=le(pe=>pe.addToast),ve=le(pe=>pe.runtime),ze=le(pe=>pe.streamingEnabled),[re,Q]=w.useState(()=>{const pe=localStorage.getItem("workflowViewOptions"),Ae={showMinimap:!1,showGrid:!0,animateRun:!1,consolidateBidirectionalEdges:!0};if(pe){const Ie=JSON.parse(pe);return{...Ae,...Ie}}return Ae}),[me,be]=w.useState(()=>localStorage.getItem("workflowLayoutDirection")||"TB");w.useEffect(()=>{localStorage.setItem("workflowViewOptions",JSON.stringify(re))},[re]),w.useEffect(()=>{localStorage.setItem("workflowLayoutDirection",me)},[me]);const Ce=pe=>{Q(Ae=>({...Ae,[pe]:!Ae[pe]}))},we=async()=>{if(M||!e)return;T(!0);const{addToast:pe,updateWorkflow:Ae}=await _u(()=>Promise.resolve().then(()=>wu),void 0,import.meta.url).then(Ie=>({addToast:Ie.useDevUIStore.getState().addToast,updateWorkflow:Ie.useDevUIStore.getState().updateWorkflow}));try{await Ze.reloadEntity(e.id);const Ie=await Ze.getWorkflowInfo(e.id);Ae(Ie),a(Ie),pe({message:`${e.name} has been reloaded successfully`,type:"success"})}catch(Ie){const Ot=Ie instanceof Error?Ie.message:"Failed to reload entity";pe({message:`Failed to reload: ${Ot}`,type:"error",duration:6e3})}finally{T(!1)}};w.useEffect(()=>{const pe=async()=>{if(e.type==="workflow"){c(!0),f(null);try{const Ae=await Ze.getWorkflowInfo(e.id);a(Ae),f(null)}catch(Ae){a(null);const Ie=Ae instanceof Error?Ae.message:String(Ae);f(Ie),console.error("Error loading workflow info:",Ae)}finally{c(!1)}}};h([]),x(!1),N(null),q(""),f(null),C.current={},$.current=null,Y.current=null,pe()},[e.id,e.type]);const Me=w.useCallback(async()=>{if(r){ie(!0);try{const pe=await Ze.listWorkflowSessions(r.id);if(pe.data.length===0){const Ae=await Ze.createWorkflowSession(r.id,{name:`Checkpoint Storage ${new Date().toLocaleString()}`});ee([Ae]),fe(Ae)}else{const Ae=[...pe.data].sort((Ie,Ot)=>Ot.created_at-Ie.created_at);if(ee(Ae),!V){const Ie=Ae[0];fe(Ie),await Se(Ie)}}}catch(pe){console.error("Failed to load sessions:",pe),ve!=="dotnet"&&Ne({message:"Failed to load sessions",type:"error"})}finally{ie(!1)}}},[r,V,ve,Ne,ee,fe]);w.useEffect(()=>{Me()},[r?.id,ve]);const je=w.useCallback(async()=>{if(!V){W([]);return}try{const Ae=(await Ze.listConversationItems(V.conversation_id,{limit:100})).data.filter(Ie=>typeof Ie=="object"&&Ie!==null&&"type"in Ie&&Ie.type==="checkpoint");W(Ae)}catch(pe){console.error(`Failed to load checkpoints for session ${V.conversation_id}:`,pe),W([])}},[V]);w.useEffect(()=>{A&&V&&je()},[A,V,je]);const Se=w.useCallback(async pe=>{!pe||!r||(h([]),x(!1),b(!1),N(null),z(!1),q(""),L([]),P({}),C.current={},$.current=null,Y.current=null)},[r]),Ke=w.useCallback(async pe=>{const Ae=J.find(Ie=>Ie.conversation_id===pe);Ae&&(fe(Ae),await Se(Ae))},[J,fe,Se]),tt=w.useCallback(async()=>{if(r)try{const pe=await Ze.createWorkflowSession(r.id,{name:`Checkpoint Storage ${new Date().toLocaleString()}`});console.log("[WorkflowView] Created new session:",pe.conversation_id),console.log("[WorkflowView] Previous session:",V?.conversation_id),ge(pe),fe(pe),await Se(pe),await new Promise(Ae=>setTimeout(Ae,100)),Ne({message:"New checkpoint storage created",type:"success"})}catch(pe){console.error("Failed to create checkpoint storage:",pe),Ne({message:"Failed to create checkpoint storage",type:"error"})}},[r,V,ge,fe,Se,Ne]),Be=w.useCallback(async()=>{if(!(!V||!r)&&confirm("Delete this session? All checkpoints will be lost."))try{await Ze.deleteWorkflowSession(r.id,V.conversation_id),Ee(V.conversation_id),Ne({message:"Session deleted",type:"success"})}catch(pe){console.error("Failed to delete session:",pe),Ne({message:"Failed to delete session",type:"error"})}},[V,r,Ee,Ne]),_e=pe=>{N(pe)},xe=w.useMemo(()=>m.filter(pe=>pe.type==="response.output_item.added"||pe.type==="response.output_item.done"||pe.type==="response.created"||pe.type==="response.in_progress"||pe.type==="response.completed"||pe.type==="response.failed"||pe.type==="response.workflow_event.completed"||pe.type==="response.workflow_event.complete"),[m]),$e=w.useMemo(()=>{const pe=[];return xe.forEach(Ae=>{if(Ae.type==="response.output_item.added"||Ae.type==="response.output_item.done"){const Ie=Ae.item;Ie&&Ie.type==="executor_action"&&"executor_id"in Ie&&Ie.executor_id&&pe.push({executorId:String(Ie.executor_id),message:Ae.type==="response.output_item.added"?"Executor started":Ie.status==="completed"?"Executor completed":Ie.status==="failed"?"Executor failed":"Executor processing",timestamp:new Date().toISOString(),status:Ie.status==="completed"?"completed":Ie.status==="failed"?"error":"running"})}else if(Ae.type==="response.workflow_event.complete"&&"data"in Ae&&Ae.data&&typeof Ae.data=="object"){const Ie=Ae.data;Ie.executor_id!=null&&pe.push({executorId:String(Ie.executor_id),message:String(Ie.event_type||"Processing"),timestamp:String(Ie.timestamp||new Date().toISOString()),status:String(Ie.event_type||"").includes("Completed")?"completed":String(Ie.event_type||"").includes("Error")?"error":"running"})}}),pe},[xe]),Ge=w.useMemo(()=>g?$e.filter(Ae=>Ae.status==="running").slice(-2).map(Ae=>Ae.executorId):[],[$e,g]),qt=w.useCallback(async(pe,Ae)=>{if(!e||e.type!=="workflow")return;x(!0),b(!1),h([]),q(""),C.current={},$.current=null,Y.current=null,L([]),P({}),n("clear");const Ie=ne();try{console.log("[WorkflowView] Running workflow with:"),console.log("  - Current session ID:",V?.conversation_id),console.log("  - Input data:",pe);const Ot={input_data:pe,conversation_id:V?.conversation_id||void 0,checkpoint_id:Ae};V?.conversation_id?Ze.clearStreamingState(V.conversation_id):Ze.clearStreamingState(e.id);const Ft=Ze.streamWorkflowExecutionOpenAI(e.id,Ot,Ie);for await(const Pe of Ft){if((Pe.type==="response.output_item.added"||Pe.type==="response.output_item.done"||Pe.type==="response.created"||Pe.type==="response.in_progress"||Pe.type==="response.completed"||Pe.type==="response.failed"||Pe.type==="response.workflow_event.completed"||Pe.type==="response.workflow_event.complete")&&h(ye=>{const dt=Math.floor(Date.now()/1e3),_t=ye.length>0&&ye[ye.length-1]._uiTimestamp||0,ot=Math.max(dt,_t+1);return[...ye,{...Pe,_uiTimestamp:ot}]}),n(Pe),Pe.type==="response.output_item.added"){const ye=Pe.item;if(ye&&ye.type==="executor_action"&&ye.executor_id&&ye.id&&($.current=ye.id,C.current[ye.id]||(C.current[ye.id]="")),ye&&ye.type==="message"&&"metadata"in ye&&ye.metadata?.source==="magentic"&&ye.id&&($.current=ye.id,C.current[ye.id]||(C.current[ye.id]="")),ye&&ye.type==="message"&&(!("metadata"in ye)||!ye.metadata?.source)&&"content"in ye&&Array.isArray(ye.content)){for(const dt of ye.content)if(dt.type==="output_text"&&dt.text){const _t=dt.text;q(ot=>ot&&ot.length>0?ot+`

`+_t:_t);try{const ot=JSON.parse(dt.text);typeof ot=="object"&&ot!==null&&(Y.current=ot)}catch{}}}}if(Pe.type,Pe.type,Pe.type==="response.workflow_event.completed"&&"data"in Pe&&Pe.data){const ye=Pe.data;if(ye.event_type==="ExecutorInvokedEvent"&&ye.executor_id){const dt=`fallback_${ye.executor_id}_${Date.now()}`;$.current=dt,C.current[dt]||(C.current[dt]="")}(ye.event_type==="WorkflowCompletedEvent"||ye.event_type==="WorkflowOutputEvent")&&ye.data&&(typeof ye.data=="object"&&(Y.current=ye.data),$.current=null)}if(Pe.type==="response.output_text.delta"&&"delta"in Pe&&Pe.delta){const ye=Pe.item_id||$.current;ye&&(C.current[ye]||(C.current[ye]=""),C.current[ye]+=Pe.delta)}if(Pe.type==="response.request_info.requested"){const ye=Pe;L(ot=>[...ot,{request_id:ye.request_id,request_data:ye.request_data,request_schema:ye.request_schema}]);const dt=ye.request_schema,_t={};dt.properties&&Object.entries(dt.properties).forEach(([ot,kn])=>{const mn=kn;mn.enum&&mn.enum.length>0?_t[ot]=mn.enum[0]:mn.default!==void 0&&(_t[ot]=mn.default)}),P(ot=>({...ot,[ye.request_id]:_t}))}if(Pe.type==="error")break}x(!1)}catch(Ot){Gu(Ot)?(console.log("Workflow execution cancelled by user"),b(!0),L([]),P({})):console.error("Workflow execution error:",Ot),x(!1),U()}},[e,n,V,ne,U]),rn=w.useCallback(async(pe,Ae)=>{if(!(!e||e.type!=="workflow")){x(!1),b(!1),h([]),q(""),C.current={},$.current=null,Y.current=null,L([]),P({}),n("clear");try{const Ie=await Ze.runWorkflowSync(e.id,{input_data:pe,conversation_id:V?.conversation_id||void 0,checkpoint_id:Ae});if(Ie.output){for(const Ft of Ie.output)if(Ft.type==="message"&&"content"in Ft&&Array.isArray(Ft.content)){for(const Pe of Ft.content)if(Pe.type==="output_text"&&Pe.text){q(ye=>ye&&ye.length>0?ye+`

`+Pe.text:Pe.text||"");try{const ye=JSON.parse(Pe.text||"");typeof ye=="object"&&ye!==null&&(Y.current=ye)}catch{}}}}const Ot={type:"response.completed",response:Ie,sequence_number:0};h([Ot]),n(Ot),await je()}catch(Ie){console.error("Workflow execution error:",Ie);const Ft={type:"response.failed",response:{error:{message:Ie instanceof Error?Ie.message:"Workflow execution failed"}},sequence_number:0};h([Ft]),n(Ft)}}},[e,V,n,je]),_o=w.useCallback(async(pe,Ae)=>{ze?await qt(pe,Ae):await rn(pe,Ae)},[ze,qt,rn]),Jn=w.useCallback(()=>{for(const pe of R){const Ae=I[pe.request_id]||{};if(!tj(pe.request_schema,Ae))return!1}return!0},[R,I]),vs=w.useCallback(async()=>{if(!e||e.type!=="workflow")return;if(!Jn()){console.warn("Cannot submit: Not all HIL forms are valid");return}x(!0),L([]),P({});const pe=ne();try{const Ae={input_data:[{type:"message",content:[{type:"workflow_hil_response",responses:I}]}],conversation_id:V?.conversation_id||void 0},Ie=Ze.streamWorkflowExecutionOpenAI(e.id,Ae,pe);let Ot=!1;const Ft=[];for await(const Pe of Ie){if((Pe.type==="response.output_item.added"||Pe.type==="response.output_item.done"||Pe.type==="response.created"||Pe.type==="response.in_progress"||Pe.type==="response.completed"||Pe.type==="response.failed"||Pe.type==="response.workflow_event.completed")&&h(ye=>{const dt=Math.floor(Date.now()/1e3),_t=ye.length>0&&ye[ye.length-1]._uiTimestamp||0,ot=Math.max(dt,_t+1);return[...ye,{...Pe,_uiTimestamp:ot}]}),n(Pe),Pe.type==="response.request_info.requested"){const ye=Pe;Ot=!0;const dt={request_id:ye.request_id,request_data:ye.request_data,request_schema:ye.request_schema};Ft.push(dt);const _t=ye.request_schema,ot={};_t.properties&&Object.entries(_t.properties).forEach(([kn,mn])=>{const Pn=mn;Pn.enum&&Pn.enum.length>0?ot[kn]=Pn.enum[0]:Pn.default!==void 0&&(ot[kn]=Pn.default)}),P(kn=>({...kn,[ye.request_id]:ot}))}if(Pe.type==="response.output_item.added"){const ye=Pe.item;if(ye&&ye.type==="executor_action"&&ye.executor_id&&ye.id&&($.current=ye.id,C.current[ye.id]||(C.current[ye.id]="")),ye&&ye.type==="message"&&"content"in ye&&Array.isArray(ye.content)){for(const dt of ye.content)if(dt.type==="output_text"&&dt.text){const _t=dt.text;q(ot=>ot&&ot.length>0?ot+`

`+_t:_t);try{const ot=JSON.parse(_t);typeof ot=="object"&&ot!==null&&(Y.current=ot)}catch{}}}}if(Pe.type==="response.output_text.delta"&&"delta"in Pe&&Pe.delta){const ye=$.current;ye&&(C.current[ye]||(C.current[ye]=""),C.current[ye]+=Pe.delta)}Pe.type==="response.completed"&&await je(),Pe.type==="response.failed"&&await je()}Ot&&L(Ft),x(!1),await je()}catch(Ae){Gu(Ae)?(console.log("HIL submission cancelled by user"),b(!0)):console.error("HIL submission error:",Ae),x(!1),U(),await je()}},[e,I,n,V,Jn,ne,U,je]);return l?o.jsx(fb,{message:"Loading workflow...",description:"Fetching workflow structure and configuration"}):d?o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsxs("div",{className:"text-center max-w-md p-6",children:[o.jsx("div",{className:"text-red-500 mb-4",children:o.jsx("svg",{className:"w-16 h-16 mx-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Failed to Load Workflow"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:d}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"This may not be a valid workflow entity. Check the file contains a workflow export."})]})}):!r?.workflow_dump&&!$e.length?o.jsx(fb,{message:"Initializing workflow...",description:"Setting up workflow execution environment"}):o.jsxs("div",{className:"workflow-view flex flex-col h-full",children:[o.jsxs("div",{className:"border-b pb-2 p-4 flex-shrink-0",children:[o.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center lg:justify-between gap-3 mb-3",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("h2",{className:"font-semibold text-sm truncate",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Us,{className:"h-4 w-4 flex-shrink-0"}),o.jsx("span",{className:"truncate",children:e.name||e.id})]})}),o.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>_(!0),className:"h-6 w-6 p-0 flex-shrink-0",title:"View workflow details",children:o.jsx(Fs,{className:"h-4 w-4"})}),e.source!=="in_memory"&&o.jsx(Le,{variant:"ghost",size:"sm",onClick:we,disabled:M,className:"h-6 w-6 p-0 flex-shrink-0",title:M?"Reloading...":"Reload entity code (hot reload)",children:o.jsx(ng,{className:`h-4 w-4 ${M?"animate-spin":""}`})})]}),r&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2 flex-shrink-0",children:[o.jsxs(vg,{value:V?.conversation_id||"",onValueChange:Ke,disabled:ce,children:[o.jsx(wg,{className:"w-full sm:w-64",children:o.jsx(bg,{placeholder:ce?"Loading...":J.length===0?"No checkpoint storages":"Select checkpoint storage",children:V&&o.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[o.jsx("span",{className:"truncate",children:V.metadata.name||`Checkpoint Storage ${V.conversation_id.slice(-8)}`}),V.metadata.checkpoint_summary&&V.metadata.checkpoint_summary.count>0&&o.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[o.jsx(ut,{variant:"secondary",className:"h-4 px-1.5 text-[10px]",children:V.metadata.checkpoint_summary.count}),V.metadata.checkpoint_summary.has_pending_hil&&o.jsx(ut,{variant:"secondary",className:"h-4 px-1.5 text-[10px]",children:"HIL"})]})]})})}),o.jsx(Ng,{children:J.map(pe=>o.jsx(jg,{value:pe.conversation_id,children:o.jsxs("div",{className:"flex items-center justify-between w-full gap-2",children:[o.jsx("span",{className:"truncate",children:pe.metadata.name||`Checkpoint Storage ${pe.conversation_id.slice(-8)}`}),o.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[pe.created_at&&o.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(pe.created_at*1e3).toLocaleTimeString()}),pe.metadata.checkpoint_summary&&pe.metadata.checkpoint_summary.count>0&&o.jsxs(o.Fragment,{children:[o.jsx(ut,{variant:"secondary",className:"h-4 px-1.5 text-[10px]",children:pe.metadata.checkpoint_summary.count}),pe.metadata.checkpoint_summary.has_pending_hil&&o.jsx(ut,{variant:"secondary",className:"h-4 px-1.5 text-[10px]",children:"HIL"})]})]})]})},pe.conversation_id))})]}),o.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>E(!0),disabled:!V,className:"h-9 w-9 p-0 flex-shrink-0",title:"View checkpoint details",children:o.jsx(Fs,{className:"h-4 w-4"})}),o.jsx(Le,{variant:"ghost",size:"sm",onClick:Be,disabled:!V||ce,className:"h-9 w-9 p-0",title:"Delete current session",children:o.jsx(rg,{className:"h-4 w-4 "})}),o.jsx(Le,{variant:"ghost",size:"sm",onClick:tt,disabled:ce,className:"h-9 px-3",title:"New session",children:o.jsx(tg,{className:"h-4 w-4"})}),D&&o.jsx(aj,{inputSchema:r.input_schema,onRun:_o,onCancel:B,isSubmitting:g,isCancelling:G,workflowState:g?"running":$e.length>0?"completed":"ready",checkpoints:X,showCheckpoints:!1})]})]}),e.description&&o.jsx("p",{className:"text-sm text-muted-foreground",children:e.description})]}),R.length>0&&o.jsx("div",{className:"bg-orange-100 dark:bg-orange-950/30 border-b border-orange-300 dark:border-orange-800 px-4 py-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(hs,{className:"w-4 h-4 text-orange-600 dark:text-orange-400"}),o.jsxs("span",{className:"text-sm font-medium text-orange-900 dark:text-orange-100",children:["Workflow is waiting for your input (",R.length," ","request",R.length>1?"s":"",")"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[R.length>1&&o.jsxs(Le,{size:"sm",onClick:vs,disabled:!Jn()||g,className:"gap-1",children:[o.jsx(el,{className:"w-3.5 h-3.5"}),"Submit All"]}),o.jsx(Le,{size:"sm",variant:"ghost",onClick:()=>{document.querySelector("[data-hil-form]")?.scrollIntoView({behavior:"smooth",block:"center"})},className:"text-orange-700 hover:text-orange-900 dark:text-orange-400 dark:hover:text-orange-200",children:"Jump to input →"})]})]})}),o.jsxs("div",{className:"flex-1 min-h-0 flex gap-0",children:[o.jsx("div",{className:"flex-1 min-w-0 transition-all duration-300",children:r?.workflow_dump&&o.jsx(I7,{workflowDump:r.workflow_dump,events:xe,isStreaming:g,onNodeSelect:_e,className:"h-full",viewOptions:re,onToggleViewOption:Ce,layoutDirection:me,onLayoutDirectionChange:be,timelineVisible:!0})}),o.jsx("div",{className:"flex-shrink-0 overflow-hidden transition-all duration-300 ease-out border-l",style:{width:D?"2.5rem":"28rem"},children:D?o.jsxs("div",{className:"h-full w-10 bg-background flex flex-col items-center py-2 cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>z(!1),title:"Expand timeline",children:[o.jsx("div",{className:"h-8 w-8 flex items-center justify-center",children:o.jsx(sN,{className:"h-4 w-4 text-muted-foreground"})}),o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 pointer-events-none",children:[o.jsx("div",{className:"text-xs text-muted-foreground select-none",style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:"Execution Timeline"}),xe.length>0&&o.jsx("div",{className:`bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center ${g?"animate-pulse":""}`,style:{fontSize:"10px"},children:xe.length})]})]}):o.jsxs("div",{className:"w-[28rem] h-full flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between p-2 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h3",{className:"text-sm font-medium",children:"Execution Timeline"}),xe.length>0&&o.jsx("div",{className:`bg-primary text-primary-foreground rounded-full px-2 h-5 flex items-center justify-center ${g?"animate-pulse":""}`,style:{fontSize:"11px",minWidth:"20px"},children:xe.length})]}),o.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>z(!0),className:"h-8 w-8 p-0",title:"Minimize timeline",children:o.jsx(en,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(V7,{events:xe,itemOutputs:C.current,currentExecutorId:Ge[Ge.length-1]||null,isStreaming:g,onExecutorClick:_e,selectedExecutorId:j,workflowResult:H,pendingHilRequests:R,hilResponses:I,onHilResponseChange:(pe,Ae)=>{P(Ie=>({...Ie,[pe]:Ae}))},onHilSubmit:vs,isSubmittingHil:g,inputSchema:r?.input_schema,onRun:(pe,Ae)=>{_o(pe,Ae)},onCancel:B,isCancelling:G,workflowState:g?"running":y?"cancelled":$e.length>0?"completed":"ready",wasCancelled:y,checkpoints:X})})]})})]}),o.jsx(L7,{workflow:e,open:S,onOpenChange:_}),o.jsx($7,{session:V||null,checkpoints:X,open:A,onOpenChange:E})]})}function GS({message:e,type:n="info",duration:r=4e3,onClose:a}){const[l,c]=w.useState(!0);w.useEffect(()=>{const m=setTimeout(()=>{c(!1),setTimeout(a,300)},r);return()=>clearTimeout(m)},[r,a]);const d={info:"bg-primary/10 border-primary/20",success:"bg-green-50 dark:bg-green-950 border-green-200 dark:border-green-800",warning:"bg-orange-50 dark:bg-orange-950 border-orange-200 dark:border-orange-800",error:"bg-red-50 dark:bg-red-950 border-red-200 dark:border-red-800"}[n],f={info:"text-primary",success:"text-green-800 dark:text-green-200",warning:"text-orange-800 dark:text-orange-200",error:"text-red-800 dark:text-red-200"}[n];return o.jsxs("div",{className:`fixed top-4 right-4 z-50 flex items-start gap-3 p-4 rounded-lg border shadow-lg max-w-md transition-all duration-300 ${l?"opacity-100 translate-x-0":"opacity-0 translate-x-4"} ${d}`,children:[o.jsx("p",{className:`text-sm flex-1 ${f}`,children:e}),o.jsx("button",{onClick:()=>{c(!1),setTimeout(a,300)},className:`flex-shrink-0 hover:opacity-70 transition-opacity ${f}`,children:o.jsx(Ea,{className:"h-4 w-4"})})]})}function F7({toasts:e,onRemove:n}){return o.jsx("div",{className:"fixed top-4 right-4 z-50 flex flex-col gap-2",children:e.map(r=>o.jsx(GS,{message:r.message,type:r.type,duration:r.duration,onClose:()=>n(r.id)},r.id))})}function Y7(){const[e,n]=w.useState(!1),[r,a]=w.useState(""),[l,c]=w.useState(!1),[d,f]=w.useState(""),m=le(Q=>Q.agents),h=le(Q=>Q.workflows),g=le(Q=>Q.entities),x=le(Q=>Q.selectedAgent),y=le(Q=>Q.azureDeploymentEnabled),b=le(Q=>Q.isLoadingEntities),j=le(Q=>Q.entityError),N=le(Q=>Q.oaiMode),S=le(Q=>Q.uiMode),_=le(Q=>Q.setAgents),A=le(Q=>Q.setWorkflows),E=le(Q=>Q.setEntities),M=le(Q=>Q.selectEntity),T=le(Q=>Q.updateAgent),D=le(Q=>Q.updateWorkflow),z=le(Q=>Q.setIsLoadingEntities),H=le(Q=>Q.setEntityError),q=le(Q=>Q.showDebugPanel),X=le(Q=>Q.debugPanelMinimized),W=le(Q=>Q.debugPanelWidth),G=le(Q=>Q.debugEvents),ne=le(Q=>Q.isResizing),B=le(Q=>Q.setShowDebugPanel),U=le(Q=>Q.setDebugPanelMinimized),R=le(Q=>Q.setDebugPanelWidth),L=le(Q=>Q.addDebugEvent),I=le(Q=>Q.clearDebugEvents),P=le(Q=>Q.setIsResizing),C=le(Q=>Q.showAboutModal),$=le(Q=>Q.showGallery),Y=le(Q=>Q.showDeployModal),V=le(Q=>Q.showEntityNotFoundToast),J=le(Q=>Q.setShowAboutModal),ce=le(Q=>Q.setShowGallery),fe=le(Q=>Q.setShowDeployModal),ee=le(Q=>Q.setShowEntityNotFoundToast),ie=le(Q=>Q.toasts),ge=le(Q=>Q.addToast),Ee=le(Q=>Q.removeToast);w.useEffect(()=>{(async()=>{try{const me=await Ze.getMeta();if(me.auth_required&&(n(!0),!Ze.getAuthToken())){H("UNAUTHORIZED"),z(!1);return}le.getState().setServerMeta({uiMode:me.ui_mode,runtime:me.runtime,capabilities:me.capabilities,authRequired:me.auth_required,version:me.version});const{entities:be,agents:Ce,workflows:we}=await Ze.getEntities();E(be),_(Ce),A(we);const je=new URLSearchParams(window.location.search).get("entity_id");let Se;if(je&&(Se=be.find(Ke=>Ke.id===je),Se||ee(!0)),!Se)if(Se=be.length>0?be[0]:void 0,Se){const Ke=new URL(window.location.href);Ke.searchParams.set("entity_id",Se.id),window.history.replaceState({},"",Ke)}else{const Ke=new URL(window.location.href);Ke.searchParams.delete("entity_id"),window.history.replaceState({},"",Ke)}if(Se&&(M(Se),Se.metadata?.lazy_loaded===!1))try{if(Se.type==="agent"){const Ke=await Ze.getAgentInfo(Se.id);T(Ke)}else{const Ke=await Ze.getWorkflowInfo(Se.id);D(Ke)}}catch(Ke){console.error(`Failed to load full info for first entity ${Se.id}:`,Ke);const tt=Ke instanceof Error?Ke.message:String(Ke);ge({type:"error",message:`Failed to load "${Se.id}": ${tt}`})}z(!1)}catch(me){console.error("Failed to load agents/workflows:",me);const be=me instanceof Error?me.message:"Failed to load data";be==="UNAUTHORIZED"&&n(!0),H(be),z(!1)}})()},[_,A,M,T,D,z,H,ee,ge,E]);const Ne=w.useCallback(async()=>{if(r.trim()){c(!0),f("");try{Ze.setAuthToken(r.trim()),await Ze.getEntities(),window.location.reload()}catch(Q){Ze.clearAuthToken(),c(!1);const me=Q instanceof Error?Q.message:"Unknown error";f(me==="UNAUTHORIZED"?"Invalid token. Please check and try again.":`Failed to connect: ${me}`)}}},[r]);w.useEffect(()=>{if(N.enabled&&x?.type==="workflow"){const Q=m[0];Q&&M(Q)}},[N.enabled,x,m,M]);const ve=w.useCallback(Q=>{Q.preventDefault(),P(!0);const me=Q.clientX,be=W,Ce=Me=>{const je=me-Me.clientX,Se=Math.max(200,Math.min(window.innerWidth*.5,be+je));R(Se)},we=()=>{P(!1),document.removeEventListener("mousemove",Ce),document.removeEventListener("mouseup",we)};document.addEventListener("mousemove",Ce),document.addEventListener("mouseup",we)},[W]),ze=w.useCallback(async Q=>{if(M(Q),Q.metadata?.lazy_loaded===!1)try{if(Q.type==="agent"){const me=await Ze.getAgentInfo(Q.id);T(me)}else{const me=await Ze.getWorkflowInfo(Q.id);D(me)}}catch(me){console.error(`Failed to load full info for ${Q.id}:`,me);const be=me instanceof Error?me.message:String(me);ge({type:"error",message:`Failed to load "${Q.id}": ${be}`})}},[M,T,D,ge]),re=w.useCallback(Q=>{Q==="clear"?I():L(Q)},[L,I]);if(b)return o.jsxs("div",{className:"h-screen flex flex-col bg-background",children:[o.jsxs("header",{className:"flex h-14 items-center gap-4 border-b px-4",children:[o.jsx("div",{className:"w-64 h-9 bg-muted animate-pulse rounded-md"}),o.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[o.jsx("div",{className:"w-8 h-8 bg-muted animate-pulse rounded-md"}),o.jsx("div",{className:"w-8 h-8 bg-muted animate-pulse rounded-md"})]})]}),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-lg font-medium",children:"Initializing DevUI..."}),o.jsx("div",{className:"text-sm text-muted-foreground mt-2",children:"Loading agents and workflows from your configuration"})]})})]});if(j){const Q=Ze.getBaseUrl(),me=j==="UNAUTHORIZED"||e;let be="8080";try{if(Q){const Ce=new URL(Q);be=Ce.port||(Ce.protocol==="https:"?"443":"80")}}catch{}return o.jsxs("div",{className:"h-screen flex flex-col bg-background",children:[o.jsx(ab,{agents:[],workflows:[],entities:[],selectedItem:void 0,onSelect:()=>{},isLoading:!1,onSettingsClick:()=>J(!0)}),o.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:o.jsxs("div",{className:"text-center space-y-6 max-w-2xl",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx("div",{className:"rounded-full bg-muted p-4 animate-pulse",children:me?o.jsx(rM,{className:"h-12 w-12 text-muted-foreground"}):o.jsx(kM,{className:"h-12 w-12 text-muted-foreground"})})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:me?"Authentication Required":"Can't Connect to Backend"}),o.jsx("p",{className:"text-muted-foreground text-base",children:me?"This backend requires a bearer token to access.":"No worries! Just start the DevUI backend server and you'll be good to go."})]}),me?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"text-left bg-muted/50 rounded-lg p-4 space-y-3",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"Enter Authentication Token"}),o.jsx(as,{type:"password",placeholder:"Paste token from server logs",value:r,onChange:Ce=>a(Ce.target.value),onKeyDown:Ce=>{Ce.key==="Enter"&&!l&&Ne()},disabled:l,className:"font-mono text-sm"}),o.jsx(Le,{onClick:Ne,disabled:!r.trim()||l,className:"w-full",children:l?"Verifying...":"Connect"}),d&&o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 text-center",children:d})]}),o.jsxs("details",{className:"text-left group",children:[o.jsxs("summary",{className:"text-sm text-muted-foreground cursor-pointer hover:text-foreground flex items-center gap-2 justify-center",children:[o.jsx(Rt,{className:"h-4 w-4 transition-transform group-open:rotate-180"}),"Where do I find the token?"]}),o.jsxs("div",{className:"mt-3 text-left bg-muted/30 rounded-lg p-3 space-y-2",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Look for this in your DevUI server startup logs:"}),o.jsxs("code",{className:"block bg-background px-2 py-1 rounded text-xs font-mono text-foreground",children:["🔑 DEV TOKEN (localhost only, shown once):",o.jsx("br",{}),"   abc123xyz..."]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"text-left bg-muted/50 rounded-lg p-4 space-y-3",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"Start the backend:"}),o.jsxs("code",{className:"block bg-background px-3 py-2 rounded border text-sm font-mono text-foreground",children:["devui ./agents --port ",be]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Or launch programmatically with"," ",o.jsx("code",{className:"text-xs",children:"serve(entities=[agent])"})]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Default:"," ",o.jsx("span",{className:"font-mono",children:Q})]})]}),j&&o.jsxs("details",{className:"text-left group",children:[o.jsxs("summary",{className:"text-sm text-muted-foreground cursor-pointer hover:text-foreground flex items-center gap-2",children:[o.jsx(Rt,{className:"h-4 w-4 transition-transform group-open:rotate-180"}),"Error details"]}),o.jsx("p",{className:"mt-2 text-xs text-muted-foreground font-mono bg-muted/30 p-3 rounded border",children:j})]}),o.jsx(Le,{onClick:()=>window.location.reload(),variant:"default",className:"mt-2",children:"Retry Connection"})]})]})}),o.jsx(cb,{open:C,onOpenChange:J})]})}return o.jsxs("div",{className:"h-screen flex flex-col bg-background max-h-screen",children:[o.jsx(ab,{agents:m,workflows:h,entities:g,selectedItem:x,onSelect:ze,onBrowseGallery:()=>ce(!0),isLoading:b,onSettingsClick:()=>J(!0)}),o.jsx("div",{className:"flex flex-1 overflow-hidden",children:$?o.jsx("div",{className:"flex-1 w-full",children:o.jsx(db,{variant:"route",onClose:()=>ce(!1),hasExistingEntities:m.length>0||h.length>0})}):m.length===0&&h.length===0?o.jsx(db,{variant:"inline"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex-1 min-w-0",children:x?x.type==="agent"?o.jsx(d6,{selectedAgent:x,onDebugEvent:re}):o.jsx(q7,{selectedWorkflow:x,onDebugEvent:re}):o.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select an agent or workflow to get started."})}),S==="developer"&&q?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`w-1 cursor-col-resize flex-shrink-0 relative group transition-colors duration-200 ease-in-out ${ne?"bg-primary/40":"bg-border hover:bg-primary/20"}`,onMouseDown:ve,children:o.jsx("div",{className:"absolute inset-y-0 -left-2 -right-2 flex items-center justify-center",children:o.jsx("div",{className:`h-12 w-1 rounded-full transition-all duration-200 ease-in-out ${ne?"bg-primary shadow-lg shadow-primary/25":"bg-primary/30 group-hover:bg-primary group-hover:shadow-md group-hover:shadow-primary/20"}`})})}),o.jsx("div",{className:"flex-shrink-0 flex flex-col h-[calc(100vh-3.7rem)]",style:{width:X?"2.5rem":`${W}px`},children:X?o.jsxs("div",{className:"h-full w-10 bg-background border-l flex flex-col items-center py-2 cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>U(!1),title:"Expand debug panel",children:[o.jsx("div",{className:"h-8 w-8 flex items-center justify-center",children:o.jsx(sN,{className:"h-4 w-4 text-muted-foreground"})}),o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 pointer-events-none",children:[o.jsx("div",{className:"text-xs text-muted-foreground select-none",style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:"Debug Panel"}),G.length>0&&o.jsx("div",{className:"bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center",style:{fontSize:"10px"},children:G.length})]})]}):o.jsxs(o.Fragment,{children:[o.jsx(DR,{events:G,isStreaming:!1,onMinimize:()=>U(!0)}),o.jsx("div",{className:"border-t bg-muted/30 px-3 py-2.5 flex-shrink-0",children:o.jsxs(Le,{onClick:()=>fe(!0),className:"w-full",variant:"outline",size:"sm",children:[o.jsx(Qh,{className:"h-3 w-3 mr-2 flex-shrink-0"}),o.jsx("span",{className:"truncate text-xs",children:y&&x?.deployment_supported?"Deploy to Azure":"Deployment Guide"})]})})]})})]}):S==="developer"?o.jsx("div",{className:"flex-shrink-0",children:o.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>B(!0),className:"h-full w-10 rounded-none border-l",title:"Show debug panel",children:o.jsx(pM,{className:"h-4 w-4"})})}):null]})}),o.jsx(cb,{open:C,onOpenChange:J}),o.jsx(eD,{open:Y,onClose:()=>fe(!1),agentName:x?.name,entity:x}),V&&o.jsx(GS,{message:"Entity not found. Showing first available entity instead.",type:"info",onClose:()=>ee(!1)}),o.jsx(F7,{toasts:ie,onRemove:Ee})]})}function G7({children:e,attribute:n="class",defaultTheme:r="dark",enableSystem:a=!0,disableTransitionOnChange:l=!0,...c}){return o.jsx(KM,{attribute:n,defaultTheme:r,enableSystem:a,disableTransitionOnChange:l,...c,children:e})}GR();aC.createRoot(document.getElementById("root")).render(o.jsx(w.StrictMode,{children:o.jsx(G7,{attribute:"class",defaultTheme:"dark",enableSystem:!0,disableTransitionOnChange:!0,children:o.jsx(Y7,{})})}));
