@inspectr/mcplab 1.26.0 → 1.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/app/assets/index-BMHfGuzL.js +258 -0
  2. package/dist/app/assets/index-CVe_v-Bh.css +1 -0
  3. package/dist/app/index.html +2 -2
  4. package/dist/app-server/assistant-common.js +1 -1
  5. package/dist/app-server/assistant-common.js.map +1 -1
  6. package/dist/app-server/copilotkit-telemetry.d.ts +1 -1
  7. package/dist/app-server/dev-mcp.d.ts +5 -2
  8. package/dist/app-server/global-copilot-domain.d.ts +33 -13
  9. package/dist/app-server/global-copilot-mastra-route.d.ts +1 -1
  10. package/dist/app-server/global-copilot-mastra-runtime.d.ts +9 -3
  11. package/dist/app-server/global-copilot-mastra-storage.d.ts +3 -3
  12. package/dist/app-server/global-copilot-mastra-threads.d.ts +9 -3
  13. package/dist/app-server/global-copilot-mastra-tools.d.ts +54 -34
  14. package/dist/app-server/global-copilot-mastra.d.ts +38 -25
  15. package/dist/app-server/global-copilot-memory.d.ts +59 -48
  16. package/dist/app-server/global-copilot-threads.d.ts +8 -8
  17. package/dist/app-server/oauth-debugger-domain.d.ts +207 -183
  18. package/dist/app-server/result-assistant-domain.d.ts +81 -65
  19. package/dist/app-server/router.d.ts.map +1 -1
  20. package/dist/app-server/router.js +4 -1
  21. package/dist/app-server/router.js.map +1 -1
  22. package/dist/app-server/runs-store.d.ts +7 -0
  23. package/dist/app-server/runs-store.d.ts.map +1 -1
  24. package/dist/app-server/runs-store.js +5 -1
  25. package/dist/app-server/runs-store.js.map +1 -1
  26. package/dist/app-server/scenario-assistant-domain.d.ts +156 -127
  27. package/dist/app-server/scenario-assistant-domain.d.ts.map +1 -1
  28. package/dist/app-server/scenario-assistant-domain.js +32 -12
  29. package/dist/app-server/scenario-assistant-domain.js.map +1 -1
  30. package/dist/app-server/settings-store.d.ts +4 -4
  31. package/dist/app-server/store-utils.d.ts +1 -1
  32. package/dist/app-server/types.d.ts +25 -25
  33. package/dist/cli-branding.d.ts +2 -0
  34. package/dist/cli-branding.d.ts.map +1 -1
  35. package/dist/cli-branding.js +13 -0
  36. package/dist/cli-branding.js.map +1 -1
  37. package/dist/cli.js +3 -0
  38. package/dist/cli.js.map +1 -1
  39. package/package.json +4 -4
  40. package/dist/app/assets/index-WORUf0Lp.js +0 -258
  41. package/dist/app/assets/index-jX47Pkmh.css +0 -1
@@ -0,0 +1,258 @@
1
+ function a9(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(r,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();var Ah=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hy={exports:{}},Nd={},Vy={exports:{}},tn={};var DE;function s9(){if(DE)return tn;DE=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.iterator;function v($){return $===null||typeof $!="object"?null:($=p&&$[p]||$["@@iterator"],typeof $=="function"?$:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,y={};function b($,F,G){this.props=$,this.context=F,this.refs=y,this.updater=G||x}b.prototype.isReactComponent={},b.prototype.setState=function($,F){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,F,"setState")},b.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function S(){}S.prototype=b.prototype;function N($,F,G){this.props=$,this.context=F,this.refs=y,this.updater=G||x}var C=N.prototype=new S;C.constructor=N,j(C,b.prototype),C.isPureReactComponent=!0;var k=Array.isArray,A=Object.prototype.hasOwnProperty,E={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function O($,F,G){var re,oe={},ue=null,ae=null;if(F!=null)for(re in F.ref!==void 0&&(ae=F.ref),F.key!==void 0&&(ue=""+F.key),F)A.call(F,re)&&!P.hasOwnProperty(re)&&(oe[re]=F[re]);var ye=arguments.length-2;if(ye===1)oe.children=G;else if(1<ye){for(var se=Array(ye),de=0;de<ye;de++)se[de]=arguments[de+2];oe.children=se}if($&&$.defaultProps)for(re in ye=$.defaultProps,ye)oe[re]===void 0&&(oe[re]=ye[re]);return{$$typeof:e,type:$,key:ue,ref:ae,props:oe,_owner:E.current}}function D($,F){return{$$typeof:e,type:$.type,key:F,ref:$.ref,props:$.props,_owner:$._owner}}function K($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function q($){var F={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(G){return F[G]})}var B=/\/+/g;function Y($,F){return typeof $=="object"&&$!==null&&$.key!=null?q(""+$.key):F.toString(36)}function z($,F,G,re,oe){var ue=typeof $;(ue==="undefined"||ue==="boolean")&&($=null);var ae=!1;if($===null)ae=!0;else switch(ue){case"string":case"number":ae=!0;break;case"object":switch($.$$typeof){case e:case t:ae=!0}}if(ae)return ae=$,oe=oe(ae),$=re===""?"."+Y(ae,0):re,k(oe)?(G="",$!=null&&(G=$.replace(B,"$&/")+"/"),z(oe,F,G,"",function(de){return de})):oe!=null&&(K(oe)&&(oe=D(oe,G+(!oe.key||ae&&ae.key===oe.key?"":(""+oe.key).replace(B,"$&/")+"/")+$)),F.push(oe)),1;if(ae=0,re=re===""?".":re+":",k($))for(var ye=0;ye<$.length;ye++){ue=$[ye];var se=re+Y(ue,ye);ae+=z(ue,F,G,se,oe)}else if(se=v($),typeof se=="function")for($=se.call($),ye=0;!(ue=$.next()).done;)ue=ue.value,se=re+Y(ue,ye++),ae+=z(ue,F,G,se,oe);else if(ue==="object")throw F=String($),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.");return ae}function I($,F,G){if($==null)return $;var re=[],oe=0;return z($,re,"","",function(ue){return F.call(G,ue,oe++)}),re}function T($){if($._status===-1){var F=$._result;F=F(),F.then(function(G){($._status===0||$._status===-1)&&($._status=1,$._result=G)},function(G){($._status===0||$._status===-1)&&($._status=2,$._result=G)}),$._status===-1&&($._status=0,$._result=F)}if($._status===1)return $._result.default;throw $._result}var V={current:null},H={transition:null},M={ReactCurrentDispatcher:V,ReactCurrentBatchConfig:H,ReactCurrentOwner:E};function X(){throw Error("act(...) is not supported in production builds of React.")}return tn.Children={map:I,forEach:function($,F,G){I($,function(){F.apply(this,arguments)},G)},count:function($){var F=0;return I($,function(){F++}),F},toArray:function($){return I($,function(F){return F})||[]},only:function($){if(!K($))throw Error("React.Children.only expected to receive a single React element child.");return $}},tn.Component=b,tn.Fragment=n,tn.Profiler=s,tn.PureComponent=N,tn.StrictMode=r,tn.Suspense=d,tn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=M,tn.act=X,tn.cloneElement=function($,F,G){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var re=j({},$.props),oe=$.key,ue=$.ref,ae=$._owner;if(F!=null){if(F.ref!==void 0&&(ue=F.ref,ae=E.current),F.key!==void 0&&(oe=""+F.key),$.type&&$.type.defaultProps)var ye=$.type.defaultProps;for(se in F)A.call(F,se)&&!P.hasOwnProperty(se)&&(re[se]=F[se]===void 0&&ye!==void 0?ye[se]:F[se])}var se=arguments.length-2;if(se===1)re.children=G;else if(1<se){ye=Array(se);for(var de=0;de<se;de++)ye[de]=arguments[de+2];re.children=ye}return{$$typeof:e,type:$.type,key:oe,ref:ue,props:re,_owner:ae}},tn.createContext=function($){return $={$$typeof:i,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:o,_context:$},$.Consumer=$},tn.createElement=O,tn.createFactory=function($){var F=O.bind(null,$);return F.type=$,F},tn.createRef=function(){return{current:null}},tn.forwardRef=function($){return{$$typeof:c,render:$}},tn.isValidElement=K,tn.lazy=function($){return{$$typeof:m,_payload:{_status:-1,_result:$},_init:T}},tn.memo=function($,F){return{$$typeof:f,type:$,compare:F===void 0?null:F}},tn.startTransition=function($){var F=H.transition;H.transition={};try{$()}finally{H.transition=F}},tn.unstable_act=X,tn.useCallback=function($,F){return V.current.useCallback($,F)},tn.useContext=function($){return V.current.useContext($)},tn.useDebugValue=function(){},tn.useDeferredValue=function($){return V.current.useDeferredValue($)},tn.useEffect=function($,F){return V.current.useEffect($,F)},tn.useId=function(){return V.current.useId()},tn.useImperativeHandle=function($,F,G){return V.current.useImperativeHandle($,F,G)},tn.useInsertionEffect=function($,F){return V.current.useInsertionEffect($,F)},tn.useLayoutEffect=function($,F){return V.current.useLayoutEffect($,F)},tn.useMemo=function($,F){return V.current.useMemo($,F)},tn.useReducer=function($,F,G){return V.current.useReducer($,F,G)},tn.useRef=function($){return V.current.useRef($)},tn.useState=function($){return V.current.useState($)},tn.useSyncExternalStore=function($,F,G){return V.current.useSyncExternalStore($,F,G)},tn.useTransition=function(){return V.current.useTransition()},tn.version="18.3.1",tn}var LE;function rC(){return LE||(LE=1,Vy.exports=s9()),Vy.exports}var FE;function o9(){if(FE)return Nd;FE=1;var e=rC(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function i(c,d,f){var m,p={},v=null,x=null;f!==void 0&&(v=""+f),d.key!==void 0&&(v=""+d.key),d.ref!==void 0&&(x=d.ref);for(m in d)r.call(d,m)&&!o.hasOwnProperty(m)&&(p[m]=d[m]);if(c&&c.defaultProps)for(m in d=c.defaultProps,d)p[m]===void 0&&(p[m]=d[m]);return{$$typeof:t,type:c,key:v,ref:x,props:p,_owner:s.current}}return Nd.Fragment=n,Nd.jsx=i,Nd.jsxs=i,Nd}var zE;function i9(){return zE||(zE=1,Hy.exports=o9()),Hy.exports}var a=i9(),Eh={},Ky={exports:{}},ta={},Gy={exports:{}},Yy={};var BE;function l9(){return BE||(BE=1,(function(e){function t(H,M){var X=H.length;H.push(M);e:for(;0<X;){var $=X-1>>>1,F=H[$];if(0<s(F,M))H[$]=M,H[X]=F,X=$;else break e}}function n(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var M=H[0],X=H.pop();if(X!==M){H[0]=X;e:for(var $=0,F=H.length,G=F>>>1;$<G;){var re=2*($+1)-1,oe=H[re],ue=re+1,ae=H[ue];if(0>s(oe,X))ue<F&&0>s(ae,oe)?(H[$]=ae,H[ue]=X,$=ue):(H[$]=oe,H[re]=X,$=re);else if(ue<F&&0>s(ae,X))H[$]=ae,H[ue]=X,$=ue;else break e}}return M}function s(H,M){var X=H.sortIndex-M.sortIndex;return X!==0?X:H.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,c=i.now();e.unstable_now=function(){return i.now()-c}}var d=[],f=[],m=1,p=null,v=3,x=!1,j=!1,y=!1,b=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(H){for(var M=n(f);M!==null;){if(M.callback===null)r(f);else if(M.startTime<=H)r(f),M.sortIndex=M.expirationTime,t(d,M);else break;M=n(f)}}function k(H){if(y=!1,C(H),!j)if(n(d)!==null)j=!0,T(A);else{var M=n(f);M!==null&&V(k,M.startTime-H)}}function A(H,M){j=!1,y&&(y=!1,S(O),O=-1),x=!0;var X=v;try{for(C(M),p=n(d);p!==null&&(!(p.expirationTime>M)||H&&!q());){var $=p.callback;if(typeof $=="function"){p.callback=null,v=p.priorityLevel;var F=$(p.expirationTime<=M);M=e.unstable_now(),typeof F=="function"?p.callback=F:p===n(d)&&r(d),C(M)}else r(d);p=n(d)}if(p!==null)var G=!0;else{var re=n(f);re!==null&&V(k,re.startTime-M),G=!1}return G}finally{p=null,v=X,x=!1}}var E=!1,P=null,O=-1,D=5,K=-1;function q(){return!(e.unstable_now()-K<D)}function B(){if(P!==null){var H=e.unstable_now();K=H;var M=!0;try{M=P(!0,H)}finally{M?Y():(E=!1,P=null)}}else E=!1}var Y;if(typeof N=="function")Y=function(){N(B)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,I=z.port2;z.port1.onmessage=B,Y=function(){I.postMessage(null)}}else Y=function(){b(B,0)};function T(H){P=H,E||(E=!0,Y())}function V(H,M){O=b(function(){H(e.unstable_now())},M)}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(H){H.callback=null},e.unstable_continueExecution=function(){j||x||(j=!0,T(A))},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(H){switch(v){case 1:case 2:case 3:var M=3;break;default:M=v}var X=v;v=M;try{return H()}finally{v=X}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(H,M){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var X=v;v=H;try{return M()}finally{v=X}},e.unstable_scheduleCallback=function(H,M,X){var $=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?$+X:$):X=$,H){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=X+F,H={id:m++,callback:M,priorityLevel:H,startTime:X,expirationTime:F,sortIndex:-1},X>$?(H.sortIndex=X,t(f,H),n(d)===null&&H===n(f)&&(y?(S(O),O=-1):y=!0,V(k,X-$))):(H.sortIndex=F,t(d,H),j||x||(j=!0,T(A))),H},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(H){var M=v;return function(){var X=v;v=M;try{return H.apply(this,arguments)}finally{v=X}}}})(Yy)),Yy}var qE;function c9(){return qE||(qE=1,Gy.exports=l9()),Gy.exports}var UE;function u9(){if(UE)return ta;UE=1;var e=rC(),t=c9();function n(l){for(var u="https://reactjs.org/docs/error-decoder.html?invariant="+l,g=1;g<arguments.length;g++)u+="&args[]="+encodeURIComponent(arguments[g]);return"Minified React error #"+l+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,s={};function o(l,u){i(l,u),i(l+"Capture",u)}function i(l,u){for(s[l]=u,l=0;l<u.length;l++)r.add(u[l])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,f=/^[: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]*$/,m={},p={};function v(l){return d.call(p,l)?!0:d.call(m,l)?!1:f.test(l)?p[l]=!0:(m[l]=!0,!1)}function x(l,u,g,w){if(g!==null&&g.type===0)return!1;switch(typeof u){case"function":case"symbol":return!0;case"boolean":return w?!1:g!==null?!g.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function j(l,u,g,w){if(u===null||typeof u>"u"||x(l,u,g,w))return!0;if(w)return!1;if(g!==null)switch(g.type){case 3:return!u;case 4:return u===!1;case 5:return isNaN(u);case 6:return isNaN(u)||1>u}return!1}function y(l,u,g,w,_,R,L){this.acceptsBooleans=u===2||u===3||u===4,this.attributeName=w,this.attributeNamespace=_,this.mustUseProperty=g,this.propertyName=l,this.type=u,this.sanitizeURL=R,this.removeEmptyString=L}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){b[l]=new y(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var u=l[0];b[u]=new y(u,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){b[l]=new y(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){b[l]=new y(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){b[l]=new y(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){b[l]=new y(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){b[l]=new y(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){b[l]=new y(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){b[l]=new y(l,5,!1,l.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function N(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var u=l.replace(S,N);b[u]=new y(u,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var u=l.replace(S,N);b[u]=new y(u,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var u=l.replace(S,N);b[u]=new y(u,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){b[l]=new y(l,1,!1,l.toLowerCase(),null,!1,!1)}),b.xlinkHref=new y("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){b[l]=new y(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,u,g,w){var _=b.hasOwnProperty(u)?b[u]:null;(_!==null?_.type!==0:w||!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(j(u,g,_,w)&&(g=null),w||_===null?v(u)&&(g===null?l.removeAttribute(u):l.setAttribute(u,""+g)):_.mustUseProperty?l[_.propertyName]=g===null?_.type===3?!1:"":g:(u=_.attributeName,w=_.attributeNamespace,g===null?l.removeAttribute(u):(_=_.type,g=_===3||_===4&&g===!0?"":""+g,w?l.setAttributeNS(w,u,g):l.setAttribute(u,g))))}var k=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,A=Symbol.for("react.element"),E=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),K=Symbol.for("react.provider"),q=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),H=Symbol.iterator;function M(l){return l===null||typeof l!="object"?null:(l=H&&l[H]||l["@@iterator"],typeof l=="function"?l:null)}var X=Object.assign,$;function F(l){if($===void 0)try{throw Error()}catch(g){var u=g.stack.trim().match(/\n( *(at )?)/);$=u&&u[1]||""}return`
2
+ `+$+l}var G=!1;function re(l,u){if(!l||G)return"";G=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(u)if(u=function(){throw Error()},Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(Ce){var w=Ce}Reflect.construct(l,[],u)}else{try{u.call()}catch(Ce){w=Ce}l.call(u.prototype)}else{try{throw Error()}catch(Ce){w=Ce}l()}}catch(Ce){if(Ce&&w&&typeof Ce.stack=="string"){for(var _=Ce.stack.split(`
3
+ `),R=w.stack.split(`
4
+ `),L=_.length-1,te=R.length-1;1<=L&&0<=te&&_[L]!==R[te];)te--;for(;1<=L&&0<=te;L--,te--)if(_[L]!==R[te]){if(L!==1||te!==1)do if(L--,te--,0>te||_[L]!==R[te]){var ce=`
5
+ `+_[L].replace(" at new "," at ");return l.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",l.displayName)),ce}while(1<=L&&0<=te);break}}}finally{G=!1,Error.prepareStackTrace=g}return(l=l?l.displayName||l.name:"")?F(l):""}function oe(l){switch(l.tag){case 5:return F(l.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return l=re(l.type,!1),l;case 11:return l=re(l.type.render,!1),l;case 1:return l=re(l.type,!0),l;default:return""}}function ue(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case P:return"Fragment";case E:return"Portal";case D:return"Profiler";case O:return"StrictMode";case Y:return"Suspense";case z:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case q:return(l.displayName||"Context")+".Consumer";case K:return(l._context.displayName||"Context")+".Provider";case B:var u=l.render;return l=l.displayName,l||(l=u.displayName||u.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case I:return u=l.displayName||null,u!==null?u:ue(l.type)||"Memo";case T:u=l._payload,l=l._init;try{return ue(l(u))}catch{}}return null}function ae(l){var u=l.type;switch(l.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=u.render,l=l.displayName||l.name||"",u.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ue(u);case 8:return u===O?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}return null}function ye(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function se(l){var u=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function de(l){var u=se(l)?"checked":"value",g=Object.getOwnPropertyDescriptor(l.constructor.prototype,u),w=""+l[u];if(!l.hasOwnProperty(u)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var _=g.get,R=g.set;return Object.defineProperty(l,u,{configurable:!0,get:function(){return _.call(this)},set:function(L){w=""+L,R.call(this,L)}}),Object.defineProperty(l,u,{enumerable:g.enumerable}),{getValue:function(){return w},setValue:function(L){w=""+L},stopTracking:function(){l._valueTracker=null,delete l[u]}}}}function De(l){l._valueTracker||(l._valueTracker=de(l))}function ge(l){if(!l)return!1;var u=l._valueTracker;if(!u)return!0;var g=u.getValue(),w="";return l&&(w=se(l)?l.checked?"true":"false":l.value),l=w,l!==g?(u.setValue(l),!0):!1}function ve(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function Se(l,u){var g=u.checked;return X({},u,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:g??l._wrapperState.initialChecked})}function at(l,u){var g=u.defaultValue==null?"":u.defaultValue,w=u.checked!=null?u.checked:u.defaultChecked;g=ye(u.value!=null?u.value:g),l._wrapperState={initialChecked:w,initialValue:g,controlled:u.type==="checkbox"||u.type==="radio"?u.checked!=null:u.value!=null}}function tt(l,u){u=u.checked,u!=null&&C(l,"checked",u,!1)}function it(l,u){tt(l,u);var g=ye(u.value),w=u.type;if(g!=null)w==="number"?(g===0&&l.value===""||l.value!=g)&&(l.value=""+g):l.value!==""+g&&(l.value=""+g);else if(w==="submit"||w==="reset"){l.removeAttribute("value");return}u.hasOwnProperty("value")?Ye(l,u.type,g):u.hasOwnProperty("defaultValue")&&Ye(l,u.type,ye(u.defaultValue)),u.checked==null&&u.defaultChecked!=null&&(l.defaultChecked=!!u.defaultChecked)}function kt(l,u,g){if(u.hasOwnProperty("value")||u.hasOwnProperty("defaultValue")){var w=u.type;if(!(w!=="submit"&&w!=="reset"||u.value!==void 0&&u.value!==null))return;u=""+l._wrapperState.initialValue,g||u===l.value||(l.value=u),l.defaultValue=u}g=l.name,g!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,g!==""&&(l.name=g)}function Ye(l,u,g){(u!=="number"||ve(l.ownerDocument)!==l)&&(g==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+g&&(l.defaultValue=""+g))}var _e=Array.isArray;function Ee(l,u,g,w){if(l=l.options,u){u={};for(var _=0;_<g.length;_++)u["$"+g[_]]=!0;for(g=0;g<l.length;g++)_=u.hasOwnProperty("$"+l[g].value),l[g].selected!==_&&(l[g].selected=_),_&&w&&(l[g].defaultSelected=!0)}else{for(g=""+ye(g),u=null,_=0;_<l.length;_++){if(l[_].value===g){l[_].selected=!0,w&&(l[_].defaultSelected=!0);return}u!==null||l[_].disabled||(u=l[_])}u!==null&&(u.selected=!0)}}function Ze(l,u){if(u.dangerouslySetInnerHTML!=null)throw Error(n(91));return X({},u,{value:void 0,defaultValue:void 0,children:""+l._wrapperState.initialValue})}function pt(l,u){var g=u.value;if(g==null){if(g=u.children,u=u.defaultValue,g!=null){if(u!=null)throw Error(n(92));if(_e(g)){if(1<g.length)throw Error(n(93));g=g[0]}u=g}u==null&&(u=""),g=u}l._wrapperState={initialValue:ye(g)}}function Lt(l,u){var g=ye(u.value),w=ye(u.defaultValue);g!=null&&(g=""+g,g!==l.value&&(l.value=g),u.defaultValue==null&&l.defaultValue!==g&&(l.defaultValue=g)),w!=null&&(l.defaultValue=""+w)}function Ut(l){var u=l.textContent;u===l._wrapperState.initialValue&&u!==""&&u!==null&&(l.value=u)}function Nt(l){switch(l){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function an(l,u){return l==null||l==="http://www.w3.org/1999/xhtml"?Nt(u):l==="http://www.w3.org/2000/svg"&&u==="foreignObject"?"http://www.w3.org/1999/xhtml":l}var on,zt=(function(l){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(u,g,w,_){MSApp.execUnsafeLocalFunction(function(){return l(u,g,w,_)})}:l})(function(l,u){if(l.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in l)l.innerHTML=u;else{for(on=on||document.createElement("div"),on.innerHTML="<svg>"+u.valueOf().toString()+"</svg>",u=on.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;u.firstChild;)l.appendChild(u.firstChild)}});function sn(l,u){if(u){var g=l.firstChild;if(g&&g===l.lastChild&&g.nodeType===3){g.nodeValue=u;return}}l.textContent=u}var nn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Re=["Webkit","ms","Moz","O"];Object.keys(nn).forEach(function(l){Re.forEach(function(u){u=u+l.charAt(0).toUpperCase()+l.substring(1),nn[u]=nn[l]})});function Be(l,u,g){return u==null||typeof u=="boolean"||u===""?"":g||typeof u!="number"||u===0||nn.hasOwnProperty(l)&&nn[l]?(""+u).trim():u+"px"}function qe(l,u){l=l.style;for(var g in u)if(u.hasOwnProperty(g)){var w=g.indexOf("--")===0,_=Be(g,u[g],w);g==="float"&&(g="cssFloat"),w?l.setProperty(g,_):l[g]=_}}var Bt=X({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Wt(l,u){if(u){if(Bt[l]&&(u.children!=null||u.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(u.dangerouslySetInnerHTML!=null){if(u.children!=null)throw Error(n(60));if(typeof u.dangerouslySetInnerHTML!="object"||!("__html"in u.dangerouslySetInnerHTML))throw Error(n(61))}if(u.style!=null&&typeof u.style!="object")throw Error(n(62))}}function yt(l,u){if(l.indexOf("-")===-1)return typeof u.is=="string";switch(l){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 fe=null;function Ie(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var Ge=null,U=null,le=null;function pe(l){if(l=cd(l)){if(typeof Ge!="function")throw Error(n(280));var u=l.stateNode;u&&(u=Up(u),Ge(l.stateNode,l.type,u))}}function J(l){U?le?le.push(l):le=[l]:U=l}function xe(){if(U){var l=U,u=le;if(le=U=null,pe(l),u)for(l=0;l<u.length;l++)pe(u[l])}}function be(l,u){return l(u)}function we(){}var W=!1;function he(l,u,g){if(W)return l(u,g);W=!0;try{return be(l,u,g)}finally{W=!1,(U!==null||le!==null)&&(we(),xe())}}function ke(l,u){var g=l.stateNode;if(g===null)return null;var w=Up(g);if(w===null)return null;g=w[u];e:switch(u){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(w=!w.disabled)||(l=l.type,w=!(l==="button"||l==="input"||l==="select"||l==="textarea")),l=!w;break e;default:l=!1}if(l)return null;if(g&&typeof g!="function")throw Error(n(231,u,typeof g));return g}var Ve=!1;if(c)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){Ve=!0}}),window.addEventListener("test",ee,ee),window.removeEventListener("test",ee,ee)}catch{Ve=!1}function Le(l,u,g,w,_,R,L,te,ce){var Ce=Array.prototype.slice.call(arguments,3);try{u.apply(g,Ce)}catch(ze){this.onError(ze)}}var ot=!1,Ht=null,Pe=!1,Zt=null,Ct={onError:function(l){ot=!0,Ht=l}};function Xt(l,u,g,w,_,R,L,te,ce){ot=!1,Ht=null,Le.apply(Ct,arguments)}function Xn(l,u,g,w,_,R,L,te,ce){if(Xt.apply(this,arguments),ot){if(ot){var Ce=Ht;ot=!1,Ht=null}else throw Error(n(198));Pe||(Pe=!0,Zt=Ce)}}function qn(l){var u=l,g=l;if(l.alternate)for(;u.return;)u=u.return;else{l=u;do u=l,(u.flags&4098)!==0&&(g=u.return),l=u.return;while(l)}return u.tag===3?g:null}function to(l){if(l.tag===13){var u=l.memoizedState;if(u===null&&(l=l.alternate,l!==null&&(u=l.memoizedState)),u!==null)return u.dehydrated}return null}function Li(l){if(qn(l)!==l)throw Error(n(188))}function no(l){var u=l.alternate;if(!u){if(u=qn(l),u===null)throw Error(n(188));return u!==l?null:l}for(var g=l,w=u;;){var _=g.return;if(_===null)break;var R=_.alternate;if(R===null){if(w=_.return,w!==null){g=w;continue}break}if(_.child===R.child){for(R=_.child;R;){if(R===g)return Li(_),l;if(R===w)return Li(_),u;R=R.sibling}throw Error(n(188))}if(g.return!==w.return)g=_,w=R;else{for(var L=!1,te=_.child;te;){if(te===g){L=!0,g=_,w=R;break}if(te===w){L=!0,w=_,g=R;break}te=te.sibling}if(!L){for(te=R.child;te;){if(te===g){L=!0,g=R,w=_;break}if(te===w){L=!0,w=R,g=_;break}te=te.sibling}if(!L)throw Error(n(189))}}if(g.alternate!==w)throw Error(n(190))}if(g.tag!==3)throw Error(n(188));return g.stateNode.current===g?l:u}function Fi(l){return l=no(l),l!==null?Ln(l):null}function Ln(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){var u=Ln(l);if(u!==null)return u;l=l.sibling}return null}var zi=t.unstable_scheduleCallback,ls=t.unstable_cancelCallback,Ar=t.unstable_shouldYield,Ho=t.unstable_requestPaint,jn=t.unstable_now,Vu=t.unstable_getCurrentPriorityLevel,Bi=t.unstable_ImmediatePriority,ie=t.unstable_UserBlockingPriority,nt=t.unstable_NormalPriority,Qt=t.unstable_LowPriority,Et=t.unstable_IdlePriority,Ft=null,rn=null;function sr(l){if(rn&&typeof rn.onCommitFiberRoot=="function")try{rn.onCommitFiberRoot(Ft,l,void 0,(l.current.flags&128)===128)}catch{}}var Sn=Math.clz32?Math.clz32:gt,ne=Math.log,Te=Math.LN2;function gt(l){return l>>>=0,l===0?32:31-(ne(l)/Te|0)|0}var bt=64,Nn=4194304;function vn(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function fn(l,u){var g=l.pendingLanes;if(g===0)return 0;var w=0,_=l.suspendedLanes,R=l.pingedLanes,L=g&268435455;if(L!==0){var te=L&~_;te!==0?w=vn(te):(R&=L,R!==0&&(w=vn(R)))}else L=g&~_,L!==0?w=vn(L):R!==0&&(w=vn(R));if(w===0)return 0;if(u!==0&&u!==w&&(u&_)===0&&(_=w&-w,R=u&-u,_>=R||_===16&&(R&4194240)!==0))return u;if((w&4)!==0&&(w|=g&16),u=l.entangledLanes,u!==0)for(l=l.entanglements,u&=w;0<u;)g=31-Sn(u),_=1<<g,w|=l[g],u&=~_;return w}function pn(l,u){switch(l){case 1:case 2:case 4:return u+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Yr(l,u){for(var g=l.suspendedLanes,w=l.pingedLanes,_=l.expirationTimes,R=l.pendingLanes;0<R;){var L=31-Sn(R),te=1<<L,ce=_[L];ce===-1?((te&g)===0||(te&w)!==0)&&(_[L]=pn(te,u)):ce<=u&&(l.expiredLanes|=te),R&=~te}}function wt(l){return l=l.pendingLanes&-1073741825,l!==0?l:l&1073741824?1073741824:0}function Qn(){var l=bt;return bt<<=1,(bt&4194240)===0&&(bt=64),l}function Vn(l){for(var u=[],g=0;31>g;g++)u.push(l);return u}function mr(l,u,g){l.pendingLanes|=u,u!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,u=31-Sn(u),l[u]=g}function Vo(l,u){var g=l.pendingLanes&~u;l.pendingLanes=u,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=u,l.mutableReadLanes&=u,l.entangledLanes&=u,u=l.entanglements;var w=l.eventTimes;for(l=l.expirationTimes;0<g;){var _=31-Sn(g),R=1<<_;u[_]=0,w[_]=-1,l[_]=-1,g&=~R}}function ro(l,u){var g=l.entangledLanes|=u;for(l=l.entanglements;g;){var w=31-Sn(g),_=1<<w;_&u|l[w]&u&&(l[w]|=u),g&=~_}}var Ot=0;function Ql(l){return l&=-l,1<l?4<l?(l&268435455)!==0?16:536870912:4:1}var gk,mx,vk,xk,yk,gx=!1,Ap=[],Ko=null,Go=null,Yo=null,Ku=new Map,Gu=new Map,Xo=[],_U="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function bk(l,u){switch(l){case"focusin":case"focusout":Ko=null;break;case"dragenter":case"dragleave":Go=null;break;case"mouseover":case"mouseout":Yo=null;break;case"pointerover":case"pointerout":Ku.delete(u.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gu.delete(u.pointerId)}}function Yu(l,u,g,w,_,R){return l===null||l.nativeEvent!==R?(l={blockedOn:u,domEventName:g,eventSystemFlags:w,nativeEvent:R,targetContainers:[_]},u!==null&&(u=cd(u),u!==null&&mx(u)),l):(l.eventSystemFlags|=w,u=l.targetContainers,_!==null&&u.indexOf(_)===-1&&u.push(_),l)}function kU(l,u,g,w,_){switch(u){case"focusin":return Ko=Yu(Ko,l,u,g,w,_),!0;case"dragenter":return Go=Yu(Go,l,u,g,w,_),!0;case"mouseover":return Yo=Yu(Yo,l,u,g,w,_),!0;case"pointerover":var R=_.pointerId;return Ku.set(R,Yu(Ku.get(R)||null,l,u,g,w,_)),!0;case"gotpointercapture":return R=_.pointerId,Gu.set(R,Yu(Gu.get(R)||null,l,u,g,w,_)),!0}return!1}function wk(l){var u=qi(l.target);if(u!==null){var g=qn(u);if(g!==null){if(u=g.tag,u===13){if(u=to(g),u!==null){l.blockedOn=u,yk(l.priority,function(){vk(g)});return}}else if(u===3&&g.stateNode.current.memoizedState.isDehydrated){l.blockedOn=g.tag===3?g.stateNode.containerInfo:null;return}}}l.blockedOn=null}function Ep(l){if(l.blockedOn!==null)return!1;for(var u=l.targetContainers;0<u.length;){var g=xx(l.domEventName,l.eventSystemFlags,u[0],l.nativeEvent);if(g===null){g=l.nativeEvent;var w=new g.constructor(g.type,g);fe=w,g.target.dispatchEvent(w),fe=null}else return u=cd(g),u!==null&&mx(u),l.blockedOn=g,!1;u.shift()}return!0}function jk(l,u,g){Ep(l)&&g.delete(u)}function AU(){gx=!1,Ko!==null&&Ep(Ko)&&(Ko=null),Go!==null&&Ep(Go)&&(Go=null),Yo!==null&&Ep(Yo)&&(Yo=null),Ku.forEach(jk),Gu.forEach(jk)}function Xu(l,u){l.blockedOn===u&&(l.blockedOn=null,gx||(gx=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,AU)))}function Qu(l){function u(_){return Xu(_,l)}if(0<Ap.length){Xu(Ap[0],l);for(var g=1;g<Ap.length;g++){var w=Ap[g];w.blockedOn===l&&(w.blockedOn=null)}}for(Ko!==null&&Xu(Ko,l),Go!==null&&Xu(Go,l),Yo!==null&&Xu(Yo,l),Ku.forEach(u),Gu.forEach(u),g=0;g<Xo.length;g++)w=Xo[g],w.blockedOn===l&&(w.blockedOn=null);for(;0<Xo.length&&(g=Xo[0],g.blockedOn===null);)wk(g),g.blockedOn===null&&Xo.shift()}var Jl=k.ReactCurrentBatchConfig,Pp=!0;function EU(l,u,g,w){var _=Ot,R=Jl.transition;Jl.transition=null;try{Ot=1,vx(l,u,g,w)}finally{Ot=_,Jl.transition=R}}function PU(l,u,g,w){var _=Ot,R=Jl.transition;Jl.transition=null;try{Ot=4,vx(l,u,g,w)}finally{Ot=_,Jl.transition=R}}function vx(l,u,g,w){if(Pp){var _=xx(l,u,g,w);if(_===null)Ix(l,u,w,Rp,g),bk(l,w);else if(kU(_,l,u,g,w))w.stopPropagation();else if(bk(l,w),u&4&&-1<_U.indexOf(l)){for(;_!==null;){var R=cd(_);if(R!==null&&gk(R),R=xx(l,u,g,w),R===null&&Ix(l,u,w,Rp,g),R===_)break;_=R}_!==null&&w.stopPropagation()}else Ix(l,u,w,null,g)}}var Rp=null;function xx(l,u,g,w){if(Rp=null,l=Ie(w),l=qi(l),l!==null)if(u=qn(l),u===null)l=null;else if(g=u.tag,g===13){if(l=to(u),l!==null)return l;l=null}else if(g===3){if(u.stateNode.current.memoizedState.isDehydrated)return u.tag===3?u.stateNode.containerInfo:null;l=null}else u!==l&&(l=null);return Rp=l,null}function Sk(l){switch(l){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Vu()){case Bi:return 1;case ie:return 4;case nt:case Qt:return 16;case Et:return 536870912;default:return 16}default:return 16}}var Qo=null,yx=null,Tp=null;function Nk(){if(Tp)return Tp;var l,u=yx,g=u.length,w,_="value"in Qo?Qo.value:Qo.textContent,R=_.length;for(l=0;l<g&&u[l]===_[l];l++);var L=g-l;for(w=1;w<=L&&u[g-w]===_[R-w];w++);return Tp=_.slice(l,1<w?1-w:void 0)}function Op(l){var u=l.keyCode;return"charCode"in l?(l=l.charCode,l===0&&u===13&&(l=13)):l=u,l===10&&(l=13),32<=l||l===13?l:0}function Mp(){return!0}function Ck(){return!1}function ha(l){function u(g,w,_,R,L){this._reactName=g,this._targetInst=_,this.type=w,this.nativeEvent=R,this.target=L,this.currentTarget=null;for(var te in l)l.hasOwnProperty(te)&&(g=l[te],this[te]=g?g(R):R[te]);return this.isDefaultPrevented=(R.defaultPrevented!=null?R.defaultPrevented:R.returnValue===!1)?Mp:Ck,this.isPropagationStopped=Ck,this}return X(u.prototype,{preventDefault:function(){this.defaultPrevented=!0;var g=this.nativeEvent;g&&(g.preventDefault?g.preventDefault():typeof g.returnValue!="unknown"&&(g.returnValue=!1),this.isDefaultPrevented=Mp)},stopPropagation:function(){var g=this.nativeEvent;g&&(g.stopPropagation?g.stopPropagation():typeof g.cancelBubble!="unknown"&&(g.cancelBubble=!0),this.isPropagationStopped=Mp)},persist:function(){},isPersistent:Mp}),u}var Zl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bx=ha(Zl),Ju=X({},Zl,{view:0,detail:0}),RU=ha(Ju),wx,jx,Zu,Ip=X({},Ju,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nx,button:0,buttons:0,relatedTarget:function(l){return l.relatedTarget===void 0?l.fromElement===l.srcElement?l.toElement:l.fromElement:l.relatedTarget},movementX:function(l){return"movementX"in l?l.movementX:(l!==Zu&&(Zu&&l.type==="mousemove"?(wx=l.screenX-Zu.screenX,jx=l.screenY-Zu.screenY):jx=wx=0,Zu=l),wx)},movementY:function(l){return"movementY"in l?l.movementY:jx}}),_k=ha(Ip),TU=X({},Ip,{dataTransfer:0}),OU=ha(TU),MU=X({},Ju,{relatedTarget:0}),Sx=ha(MU),IU=X({},Zl,{animationName:0,elapsedTime:0,pseudoElement:0}),$U=ha(IU),DU=X({},Zl,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),LU=ha(DU),FU=X({},Zl,{data:0}),kk=ha(FU),zU={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},BU={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"},qU={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function UU(l){var u=this.nativeEvent;return u.getModifierState?u.getModifierState(l):(l=qU[l])?!!u[l]:!1}function Nx(){return UU}var WU=X({},Ju,{key:function(l){if(l.key){var u=zU[l.key]||l.key;if(u!=="Unidentified")return u}return l.type==="keypress"?(l=Op(l),l===13?"Enter":String.fromCharCode(l)):l.type==="keydown"||l.type==="keyup"?BU[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nx,charCode:function(l){return l.type==="keypress"?Op(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?Op(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),HU=ha(WU),VU=X({},Ip,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ak=ha(VU),KU=X({},Ju,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nx}),GU=ha(KU),YU=X({},Zl,{propertyName:0,elapsedTime:0,pseudoElement:0}),XU=ha(YU),QU=X({},Ip,{deltaX:function(l){return"deltaX"in l?l.deltaX:"wheelDeltaX"in l?-l.wheelDeltaX:0},deltaY:function(l){return"deltaY"in l?l.deltaY:"wheelDeltaY"in l?-l.wheelDeltaY:"wheelDelta"in l?-l.wheelDelta:0},deltaZ:0,deltaMode:0}),JU=ha(QU),ZU=[9,13,27,32],Cx=c&&"CompositionEvent"in window,ed=null;c&&"documentMode"in document&&(ed=document.documentMode);var e7=c&&"TextEvent"in window&&!ed,Ek=c&&(!Cx||ed&&8<ed&&11>=ed),Pk=" ",Rk=!1;function Tk(l,u){switch(l){case"keyup":return ZU.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ok(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ec=!1;function t7(l,u){switch(l){case"compositionend":return Ok(u);case"keypress":return u.which!==32?null:(Rk=!0,Pk);case"textInput":return l=u.data,l===Pk&&Rk?null:l;default:return null}}function n7(l,u){if(ec)return l==="compositionend"||!Cx&&Tk(l,u)?(l=Nk(),Tp=yx=Qo=null,ec=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1<u.char.length)return u.char;if(u.which)return String.fromCharCode(u.which)}return null;case"compositionend":return Ek&&u.locale!=="ko"?null:u.data;default:return null}}var r7={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 Mk(l){var u=l&&l.nodeName&&l.nodeName.toLowerCase();return u==="input"?!!r7[l.type]:u==="textarea"}function Ik(l,u,g,w){J(w),u=zp(u,"onChange"),0<u.length&&(g=new bx("onChange","change",null,g,w),l.push({event:g,listeners:u}))}var td=null,nd=null;function a7(l){Zk(l,0)}function $p(l){var u=sc(l);if(ge(u))return l}function s7(l,u){if(l==="change")return u}var $k=!1;if(c){var _x;if(c){var kx="oninput"in document;if(!kx){var Dk=document.createElement("div");Dk.setAttribute("oninput","return;"),kx=typeof Dk.oninput=="function"}_x=kx}else _x=!1;$k=_x&&(!document.documentMode||9<document.documentMode)}function Lk(){td&&(td.detachEvent("onpropertychange",Fk),nd=td=null)}function Fk(l){if(l.propertyName==="value"&&$p(nd)){var u=[];Ik(u,nd,l,Ie(l)),he(a7,u)}}function o7(l,u,g){l==="focusin"?(Lk(),td=u,nd=g,td.attachEvent("onpropertychange",Fk)):l==="focusout"&&Lk()}function i7(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return $p(nd)}function l7(l,u){if(l==="click")return $p(u)}function c7(l,u){if(l==="input"||l==="change")return $p(u)}function u7(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var cs=typeof Object.is=="function"?Object.is:u7;function rd(l,u){if(cs(l,u))return!0;if(typeof l!="object"||l===null||typeof u!="object"||u===null)return!1;var g=Object.keys(l),w=Object.keys(u);if(g.length!==w.length)return!1;for(w=0;w<g.length;w++){var _=g[w];if(!d.call(u,_)||!cs(l[_],u[_]))return!1}return!0}function zk(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function Bk(l,u){var g=zk(l);l=0;for(var w;g;){if(g.nodeType===3){if(w=l+g.textContent.length,l<=u&&w>=u)return{node:g,offset:u-l};l=w}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=zk(g)}}function qk(l,u){return l&&u?l===u?!0:l&&l.nodeType===3?!1:u&&u.nodeType===3?qk(l,u.parentNode):"contains"in l?l.contains(u):l.compareDocumentPosition?!!(l.compareDocumentPosition(u)&16):!1:!1}function Uk(){for(var l=window,u=ve();u instanceof l.HTMLIFrameElement;){try{var g=typeof u.contentWindow.location.href=="string"}catch{g=!1}if(g)l=u.contentWindow;else break;u=ve(l.document)}return u}function Ax(l){var u=l&&l.nodeName&&l.nodeName.toLowerCase();return u&&(u==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||u==="textarea"||l.contentEditable==="true")}function d7(l){var u=Uk(),g=l.focusedElem,w=l.selectionRange;if(u!==g&&g&&g.ownerDocument&&qk(g.ownerDocument.documentElement,g)){if(w!==null&&Ax(g)){if(u=w.start,l=w.end,l===void 0&&(l=u),"selectionStart"in g)g.selectionStart=u,g.selectionEnd=Math.min(l,g.value.length);else if(l=(u=g.ownerDocument||document)&&u.defaultView||window,l.getSelection){l=l.getSelection();var _=g.textContent.length,R=Math.min(w.start,_);w=w.end===void 0?R:Math.min(w.end,_),!l.extend&&R>w&&(_=w,w=R,R=_),_=Bk(g,R);var L=Bk(g,w);_&&L&&(l.rangeCount!==1||l.anchorNode!==_.node||l.anchorOffset!==_.offset||l.focusNode!==L.node||l.focusOffset!==L.offset)&&(u=u.createRange(),u.setStart(_.node,_.offset),l.removeAllRanges(),R>w?(l.addRange(u),l.extend(L.node,L.offset)):(u.setEnd(L.node,L.offset),l.addRange(u)))}}for(u=[],l=g;l=l.parentNode;)l.nodeType===1&&u.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<u.length;g++)l=u[g],l.element.scrollLeft=l.left,l.element.scrollTop=l.top}}var f7=c&&"documentMode"in document&&11>=document.documentMode,tc=null,Ex=null,ad=null,Px=!1;function Wk(l,u,g){var w=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;Px||tc==null||tc!==ve(w)||(w=tc,"selectionStart"in w&&Ax(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),ad&&rd(ad,w)||(ad=w,w=zp(Ex,"onSelect"),0<w.length&&(u=new bx("onSelect","select",null,u,g),l.push({event:u,listeners:w}),u.target=tc)))}function Dp(l,u){var g={};return g[l.toLowerCase()]=u.toLowerCase(),g["Webkit"+l]="webkit"+u,g["Moz"+l]="moz"+u,g}var nc={animationend:Dp("Animation","AnimationEnd"),animationiteration:Dp("Animation","AnimationIteration"),animationstart:Dp("Animation","AnimationStart"),transitionend:Dp("Transition","TransitionEnd")},Rx={},Hk={};c&&(Hk=document.createElement("div").style,"AnimationEvent"in window||(delete nc.animationend.animation,delete nc.animationiteration.animation,delete nc.animationstart.animation),"TransitionEvent"in window||delete nc.transitionend.transition);function Lp(l){if(Rx[l])return Rx[l];if(!nc[l])return l;var u=nc[l],g;for(g in u)if(u.hasOwnProperty(g)&&g in Hk)return Rx[l]=u[g];return l}var Vk=Lp("animationend"),Kk=Lp("animationiteration"),Gk=Lp("animationstart"),Yk=Lp("transitionend"),Xk=new Map,Qk="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Jo(l,u){Xk.set(l,u),o(u,[l])}for(var Tx=0;Tx<Qk.length;Tx++){var Ox=Qk[Tx],p7=Ox.toLowerCase(),h7=Ox[0].toUpperCase()+Ox.slice(1);Jo(p7,"on"+h7)}Jo(Vk,"onAnimationEnd"),Jo(Kk,"onAnimationIteration"),Jo(Gk,"onAnimationStart"),Jo("dblclick","onDoubleClick"),Jo("focusin","onFocus"),Jo("focusout","onBlur"),Jo(Yk,"onTransitionEnd"),i("onMouseEnter",["mouseout","mouseover"]),i("onMouseLeave",["mouseout","mouseover"]),i("onPointerEnter",["pointerout","pointerover"]),i("onPointerLeave",["pointerout","pointerover"]),o("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),o("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),o("onBeforeInput",["compositionend","keypress","textInput","paste"]),o("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var sd="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(" "),m7=new Set("cancel close invalid load scroll toggle".split(" ").concat(sd));function Jk(l,u,g){var w=l.type||"unknown-event";l.currentTarget=g,Xn(w,u,void 0,l),l.currentTarget=null}function Zk(l,u){u=(u&4)!==0;for(var g=0;g<l.length;g++){var w=l[g],_=w.event;w=w.listeners;e:{var R=void 0;if(u)for(var L=w.length-1;0<=L;L--){var te=w[L],ce=te.instance,Ce=te.currentTarget;if(te=te.listener,ce!==R&&_.isPropagationStopped())break e;Jk(_,te,Ce),R=ce}else for(L=0;L<w.length;L++){if(te=w[L],ce=te.instance,Ce=te.currentTarget,te=te.listener,ce!==R&&_.isPropagationStopped())break e;Jk(_,te,Ce),R=ce}}}if(Pe)throw l=Zt,Pe=!1,Zt=null,l}function Rn(l,u){var g=u[Bx];g===void 0&&(g=u[Bx]=new Set);var w=l+"__bubble";g.has(w)||(eA(u,l,2,!1),g.add(w))}function Mx(l,u,g){var w=0;u&&(w|=4),eA(g,l,w,u)}var Fp="_reactListening"+Math.random().toString(36).slice(2);function od(l){if(!l[Fp]){l[Fp]=!0,r.forEach(function(g){g!=="selectionchange"&&(m7.has(g)||Mx(g,!1,l),Mx(g,!0,l))});var u=l.nodeType===9?l:l.ownerDocument;u===null||u[Fp]||(u[Fp]=!0,Mx("selectionchange",!1,u))}}function eA(l,u,g,w){switch(Sk(u)){case 1:var _=EU;break;case 4:_=PU;break;default:_=vx}g=_.bind(null,u,g,l),_=void 0,!Ve||u!=="touchstart"&&u!=="touchmove"&&u!=="wheel"||(_=!0),w?_!==void 0?l.addEventListener(u,g,{capture:!0,passive:_}):l.addEventListener(u,g,!0):_!==void 0?l.addEventListener(u,g,{passive:_}):l.addEventListener(u,g,!1)}function Ix(l,u,g,w,_){var R=w;if((u&1)===0&&(u&2)===0&&w!==null)e:for(;;){if(w===null)return;var L=w.tag;if(L===3||L===4){var te=w.stateNode.containerInfo;if(te===_||te.nodeType===8&&te.parentNode===_)break;if(L===4)for(L=w.return;L!==null;){var ce=L.tag;if((ce===3||ce===4)&&(ce=L.stateNode.containerInfo,ce===_||ce.nodeType===8&&ce.parentNode===_))return;L=L.return}for(;te!==null;){if(L=qi(te),L===null)return;if(ce=L.tag,ce===5||ce===6){w=R=L;continue e}te=te.parentNode}}w=w.return}he(function(){var Ce=R,ze=Ie(g),Ke=[];e:{var Fe=Xk.get(l);if(Fe!==void 0){var dt=bx,vt=l;switch(l){case"keypress":if(Op(g)===0)break e;case"keydown":case"keyup":dt=HU;break;case"focusin":vt="focus",dt=Sx;break;case"focusout":vt="blur",dt=Sx;break;case"beforeblur":case"afterblur":dt=Sx;break;case"click":if(g.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":dt=_k;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":dt=OU;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":dt=GU;break;case Vk:case Kk:case Gk:dt=$U;break;case Yk:dt=XU;break;case"scroll":dt=RU;break;case"wheel":dt=JU;break;case"copy":case"cut":case"paste":dt=LU;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":dt=Ak}var xt=(u&4)!==0,Jn=!xt&&l==="scroll",je=xt?Fe!==null?Fe+"Capture":null:Fe;xt=[];for(var me=Ce,Ne;me!==null;){Ne=me;var Xe=Ne.stateNode;if(Ne.tag===5&&Xe!==null&&(Ne=Xe,je!==null&&(Xe=ke(me,je),Xe!=null&&xt.push(id(me,Xe,Ne)))),Jn)break;me=me.return}0<xt.length&&(Fe=new dt(Fe,vt,null,g,ze),Ke.push({event:Fe,listeners:xt}))}}if((u&7)===0){e:{if(Fe=l==="mouseover"||l==="pointerover",dt=l==="mouseout"||l==="pointerout",Fe&&g!==fe&&(vt=g.relatedTarget||g.fromElement)&&(qi(vt)||vt[ao]))break e;if((dt||Fe)&&(Fe=ze.window===ze?ze:(Fe=ze.ownerDocument)?Fe.defaultView||Fe.parentWindow:window,dt?(vt=g.relatedTarget||g.toElement,dt=Ce,vt=vt?qi(vt):null,vt!==null&&(Jn=qn(vt),vt!==Jn||vt.tag!==5&&vt.tag!==6)&&(vt=null)):(dt=null,vt=Ce),dt!==vt)){if(xt=_k,Xe="onMouseLeave",je="onMouseEnter",me="mouse",(l==="pointerout"||l==="pointerover")&&(xt=Ak,Xe="onPointerLeave",je="onPointerEnter",me="pointer"),Jn=dt==null?Fe:sc(dt),Ne=vt==null?Fe:sc(vt),Fe=new xt(Xe,me+"leave",dt,g,ze),Fe.target=Jn,Fe.relatedTarget=Ne,Xe=null,qi(ze)===Ce&&(xt=new xt(je,me+"enter",vt,g,ze),xt.target=Ne,xt.relatedTarget=Jn,Xe=xt),Jn=Xe,dt&&vt)t:{for(xt=dt,je=vt,me=0,Ne=xt;Ne;Ne=rc(Ne))me++;for(Ne=0,Xe=je;Xe;Xe=rc(Xe))Ne++;for(;0<me-Ne;)xt=rc(xt),me--;for(;0<Ne-me;)je=rc(je),Ne--;for(;me--;){if(xt===je||je!==null&&xt===je.alternate)break t;xt=rc(xt),je=rc(je)}xt=null}else xt=null;dt!==null&&tA(Ke,Fe,dt,xt,!1),vt!==null&&Jn!==null&&tA(Ke,Jn,vt,xt,!0)}}e:{if(Fe=Ce?sc(Ce):window,dt=Fe.nodeName&&Fe.nodeName.toLowerCase(),dt==="select"||dt==="input"&&Fe.type==="file")var jt=s7;else if(Mk(Fe))if($k)jt=c7;else{jt=i7;var Pt=o7}else(dt=Fe.nodeName)&&dt.toLowerCase()==="input"&&(Fe.type==="checkbox"||Fe.type==="radio")&&(jt=l7);if(jt&&(jt=jt(l,Ce))){Ik(Ke,jt,g,ze);break e}Pt&&Pt(l,Fe,Ce),l==="focusout"&&(Pt=Fe._wrapperState)&&Pt.controlled&&Fe.type==="number"&&Ye(Fe,"number",Fe.value)}switch(Pt=Ce?sc(Ce):window,l){case"focusin":(Mk(Pt)||Pt.contentEditable==="true")&&(tc=Pt,Ex=Ce,ad=null);break;case"focusout":ad=Ex=tc=null;break;case"mousedown":Px=!0;break;case"contextmenu":case"mouseup":case"dragend":Px=!1,Wk(Ke,g,ze);break;case"selectionchange":if(f7)break;case"keydown":case"keyup":Wk(Ke,g,ze)}var Rt;if(Cx)e:{switch(l){case"compositionstart":var qt="onCompositionStart";break e;case"compositionend":qt="onCompositionEnd";break e;case"compositionupdate":qt="onCompositionUpdate";break e}qt=void 0}else ec?Tk(l,g)&&(qt="onCompositionEnd"):l==="keydown"&&g.keyCode===229&&(qt="onCompositionStart");qt&&(Ek&&g.locale!=="ko"&&(ec||qt!=="onCompositionStart"?qt==="onCompositionEnd"&&ec&&(Rt=Nk()):(Qo=ze,yx="value"in Qo?Qo.value:Qo.textContent,ec=!0)),Pt=zp(Ce,qt),0<Pt.length&&(qt=new kk(qt,l,null,g,ze),Ke.push({event:qt,listeners:Pt}),Rt?qt.data=Rt:(Rt=Ok(g),Rt!==null&&(qt.data=Rt)))),(Rt=e7?t7(l,g):n7(l,g))&&(Ce=zp(Ce,"onBeforeInput"),0<Ce.length&&(ze=new kk("onBeforeInput","beforeinput",null,g,ze),Ke.push({event:ze,listeners:Ce}),ze.data=Rt))}Zk(Ke,u)})}function id(l,u,g){return{instance:l,listener:u,currentTarget:g}}function zp(l,u){for(var g=u+"Capture",w=[];l!==null;){var _=l,R=_.stateNode;_.tag===5&&R!==null&&(_=R,R=ke(l,g),R!=null&&w.unshift(id(l,R,_)),R=ke(l,u),R!=null&&w.push(id(l,R,_))),l=l.return}return w}function rc(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5);return l||null}function tA(l,u,g,w,_){for(var R=u._reactName,L=[];g!==null&&g!==w;){var te=g,ce=te.alternate,Ce=te.stateNode;if(ce!==null&&ce===w)break;te.tag===5&&Ce!==null&&(te=Ce,_?(ce=ke(g,R),ce!=null&&L.unshift(id(g,ce,te))):_||(ce=ke(g,R),ce!=null&&L.push(id(g,ce,te)))),g=g.return}L.length!==0&&l.push({event:u,listeners:L})}var g7=/\r\n?/g,v7=/\u0000|\uFFFD/g;function nA(l){return(typeof l=="string"?l:""+l).replace(g7,`
6
+ `).replace(v7,"")}function Bp(l,u,g){if(u=nA(u),nA(l)!==u&&g)throw Error(n(425))}function qp(){}var $x=null,Dx=null;function Lx(l,u){return l==="textarea"||l==="noscript"||typeof u.children=="string"||typeof u.children=="number"||typeof u.dangerouslySetInnerHTML=="object"&&u.dangerouslySetInnerHTML!==null&&u.dangerouslySetInnerHTML.__html!=null}var Fx=typeof setTimeout=="function"?setTimeout:void 0,x7=typeof clearTimeout=="function"?clearTimeout:void 0,rA=typeof Promise=="function"?Promise:void 0,y7=typeof queueMicrotask=="function"?queueMicrotask:typeof rA<"u"?function(l){return rA.resolve(null).then(l).catch(b7)}:Fx;function b7(l){setTimeout(function(){throw l})}function zx(l,u){var g=u,w=0;do{var _=g.nextSibling;if(l.removeChild(g),_&&_.nodeType===8)if(g=_.data,g==="/$"){if(w===0){l.removeChild(_),Qu(u);return}w--}else g!=="$"&&g!=="$?"&&g!=="$!"||w++;g=_}while(g);Qu(u)}function Zo(l){for(;l!=null;l=l.nextSibling){var u=l.nodeType;if(u===1||u===3)break;if(u===8){if(u=l.data,u==="$"||u==="$!"||u==="$?")break;if(u==="/$")return null}}return l}function aA(l){l=l.previousSibling;for(var u=0;l;){if(l.nodeType===8){var g=l.data;if(g==="$"||g==="$!"||g==="$?"){if(u===0)return l;u--}else g==="/$"&&u++}l=l.previousSibling}return null}var ac=Math.random().toString(36).slice(2),Ms="__reactFiber$"+ac,ld="__reactProps$"+ac,ao="__reactContainer$"+ac,Bx="__reactEvents$"+ac,w7="__reactListeners$"+ac,j7="__reactHandles$"+ac;function qi(l){var u=l[Ms];if(u)return u;for(var g=l.parentNode;g;){if(u=g[ao]||g[Ms]){if(g=u.alternate,u.child!==null||g!==null&&g.child!==null)for(l=aA(l);l!==null;){if(g=l[Ms])return g;l=aA(l)}return u}l=g,g=l.parentNode}return null}function cd(l){return l=l[Ms]||l[ao],!l||l.tag!==5&&l.tag!==6&&l.tag!==13&&l.tag!==3?null:l}function sc(l){if(l.tag===5||l.tag===6)return l.stateNode;throw Error(n(33))}function Up(l){return l[ld]||null}var qx=[],oc=-1;function ei(l){return{current:l}}function Tn(l){0>oc||(l.current=qx[oc],qx[oc]=null,oc--)}function Cn(l,u){oc++,qx[oc]=l.current,l.current=u}var ti={},Er=ei(ti),Xr=ei(!1),Ui=ti;function ic(l,u){var g=l.type.contextTypes;if(!g)return ti;var w=l.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===u)return w.__reactInternalMemoizedMaskedChildContext;var _={},R;for(R in g)_[R]=u[R];return w&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=u,l.__reactInternalMemoizedMaskedChildContext=_),_}function Qr(l){return l=l.childContextTypes,l!=null}function Wp(){Tn(Xr),Tn(Er)}function sA(l,u,g){if(Er.current!==ti)throw Error(n(168));Cn(Er,u),Cn(Xr,g)}function oA(l,u,g){var w=l.stateNode;if(u=u.childContextTypes,typeof w.getChildContext!="function")return g;w=w.getChildContext();for(var _ in w)if(!(_ in u))throw Error(n(108,ae(l)||"Unknown",_));return X({},g,w)}function Hp(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||ti,Ui=Er.current,Cn(Er,l),Cn(Xr,Xr.current),!0}function iA(l,u,g){var w=l.stateNode;if(!w)throw Error(n(169));g?(l=oA(l,u,Ui),w.__reactInternalMemoizedMergedChildContext=l,Tn(Xr),Tn(Er),Cn(Er,l)):Tn(Xr),Cn(Xr,g)}var so=null,Vp=!1,Ux=!1;function lA(l){so===null?so=[l]:so.push(l)}function S7(l){Vp=!0,lA(l)}function ni(){if(!Ux&&so!==null){Ux=!0;var l=0,u=Ot;try{var g=so;for(Ot=1;l<g.length;l++){var w=g[l];do w=w(!0);while(w!==null)}so=null,Vp=!1}catch(_){throw so!==null&&(so=so.slice(l+1)),zi(Bi,ni),_}finally{Ot=u,Ux=!1}}return null}var lc=[],cc=0,Kp=null,Gp=0,Ra=[],Ta=0,Wi=null,oo=1,io="";function Hi(l,u){lc[cc++]=Gp,lc[cc++]=Kp,Kp=l,Gp=u}function cA(l,u,g){Ra[Ta++]=oo,Ra[Ta++]=io,Ra[Ta++]=Wi,Wi=l;var w=oo;l=io;var _=32-Sn(w)-1;w&=~(1<<_),g+=1;var R=32-Sn(u)+_;if(30<R){var L=_-_%5;R=(w&(1<<L)-1).toString(32),w>>=L,_-=L,oo=1<<32-Sn(u)+_|g<<_|w,io=R+l}else oo=1<<R|g<<_|w,io=l}function Wx(l){l.return!==null&&(Hi(l,1),cA(l,1,0))}function Hx(l){for(;l===Kp;)Kp=lc[--cc],lc[cc]=null,Gp=lc[--cc],lc[cc]=null;for(;l===Wi;)Wi=Ra[--Ta],Ra[Ta]=null,io=Ra[--Ta],Ra[Ta]=null,oo=Ra[--Ta],Ra[Ta]=null}var ma=null,ga=null,Fn=!1,us=null;function uA(l,u){var g=$a(5,null,null,0);g.elementType="DELETED",g.stateNode=u,g.return=l,u=l.deletions,u===null?(l.deletions=[g],l.flags|=16):u.push(g)}function dA(l,u){switch(l.tag){case 5:var g=l.type;return u=u.nodeType!==1||g.toLowerCase()!==u.nodeName.toLowerCase()?null:u,u!==null?(l.stateNode=u,ma=l,ga=Zo(u.firstChild),!0):!1;case 6:return u=l.pendingProps===""||u.nodeType!==3?null:u,u!==null?(l.stateNode=u,ma=l,ga=null,!0):!1;case 13:return u=u.nodeType!==8?null:u,u!==null?(g=Wi!==null?{id:oo,overflow:io}:null,l.memoizedState={dehydrated:u,treeContext:g,retryLane:1073741824},g=$a(18,null,null,0),g.stateNode=u,g.return=l,l.child=g,ma=l,ga=null,!0):!1;default:return!1}}function Vx(l){return(l.mode&1)!==0&&(l.flags&128)===0}function Kx(l){if(Fn){var u=ga;if(u){var g=u;if(!dA(l,u)){if(Vx(l))throw Error(n(418));u=Zo(g.nextSibling);var w=ma;u&&dA(l,u)?uA(w,g):(l.flags=l.flags&-4097|2,Fn=!1,ma=l)}}else{if(Vx(l))throw Error(n(418));l.flags=l.flags&-4097|2,Fn=!1,ma=l}}}function fA(l){for(l=l.return;l!==null&&l.tag!==5&&l.tag!==3&&l.tag!==13;)l=l.return;ma=l}function Yp(l){if(l!==ma)return!1;if(!Fn)return fA(l),Fn=!0,!1;var u;if((u=l.tag!==3)&&!(u=l.tag!==5)&&(u=l.type,u=u!=="head"&&u!=="body"&&!Lx(l.type,l.memoizedProps)),u&&(u=ga)){if(Vx(l))throw pA(),Error(n(418));for(;u;)uA(l,u),u=Zo(u.nextSibling)}if(fA(l),l.tag===13){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(n(317));e:{for(l=l.nextSibling,u=0;l;){if(l.nodeType===8){var g=l.data;if(g==="/$"){if(u===0){ga=Zo(l.nextSibling);break e}u--}else g!=="$"&&g!=="$!"&&g!=="$?"||u++}l=l.nextSibling}ga=null}}else ga=ma?Zo(l.stateNode.nextSibling):null;return!0}function pA(){for(var l=ga;l;)l=Zo(l.nextSibling)}function uc(){ga=ma=null,Fn=!1}function Gx(l){us===null?us=[l]:us.push(l)}var N7=k.ReactCurrentBatchConfig;function ud(l,u,g){if(l=g.ref,l!==null&&typeof l!="function"&&typeof l!="object"){if(g._owner){if(g=g._owner,g){if(g.tag!==1)throw Error(n(309));var w=g.stateNode}if(!w)throw Error(n(147,l));var _=w,R=""+l;return u!==null&&u.ref!==null&&typeof u.ref=="function"&&u.ref._stringRef===R?u.ref:(u=function(L){var te=_.refs;L===null?delete te[R]:te[R]=L},u._stringRef=R,u)}if(typeof l!="string")throw Error(n(284));if(!g._owner)throw Error(n(290,l))}return l}function Xp(l,u){throw l=Object.prototype.toString.call(u),Error(n(31,l==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":l))}function hA(l){var u=l._init;return u(l._payload)}function mA(l){function u(je,me){if(l){var Ne=je.deletions;Ne===null?(je.deletions=[me],je.flags|=16):Ne.push(me)}}function g(je,me){if(!l)return null;for(;me!==null;)u(je,me),me=me.sibling;return null}function w(je,me){for(je=new Map;me!==null;)me.key!==null?je.set(me.key,me):je.set(me.index,me),me=me.sibling;return je}function _(je,me){return je=ui(je,me),je.index=0,je.sibling=null,je}function R(je,me,Ne){return je.index=Ne,l?(Ne=je.alternate,Ne!==null?(Ne=Ne.index,Ne<me?(je.flags|=2,me):Ne):(je.flags|=2,me)):(je.flags|=1048576,me)}function L(je){return l&&je.alternate===null&&(je.flags|=2),je}function te(je,me,Ne,Xe){return me===null||me.tag!==6?(me=Fy(Ne,je.mode,Xe),me.return=je,me):(me=_(me,Ne),me.return=je,me)}function ce(je,me,Ne,Xe){var jt=Ne.type;return jt===P?ze(je,me,Ne.props.children,Xe,Ne.key):me!==null&&(me.elementType===jt||typeof jt=="object"&&jt!==null&&jt.$$typeof===T&&hA(jt)===me.type)?(Xe=_(me,Ne.props),Xe.ref=ud(je,me,Ne),Xe.return=je,Xe):(Xe=bh(Ne.type,Ne.key,Ne.props,null,je.mode,Xe),Xe.ref=ud(je,me,Ne),Xe.return=je,Xe)}function Ce(je,me,Ne,Xe){return me===null||me.tag!==4||me.stateNode.containerInfo!==Ne.containerInfo||me.stateNode.implementation!==Ne.implementation?(me=zy(Ne,je.mode,Xe),me.return=je,me):(me=_(me,Ne.children||[]),me.return=je,me)}function ze(je,me,Ne,Xe,jt){return me===null||me.tag!==7?(me=Zi(Ne,je.mode,Xe,jt),me.return=je,me):(me=_(me,Ne),me.return=je,me)}function Ke(je,me,Ne){if(typeof me=="string"&&me!==""||typeof me=="number")return me=Fy(""+me,je.mode,Ne),me.return=je,me;if(typeof me=="object"&&me!==null){switch(me.$$typeof){case A:return Ne=bh(me.type,me.key,me.props,null,je.mode,Ne),Ne.ref=ud(je,null,me),Ne.return=je,Ne;case E:return me=zy(me,je.mode,Ne),me.return=je,me;case T:var Xe=me._init;return Ke(je,Xe(me._payload),Ne)}if(_e(me)||M(me))return me=Zi(me,je.mode,Ne,null),me.return=je,me;Xp(je,me)}return null}function Fe(je,me,Ne,Xe){var jt=me!==null?me.key:null;if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number")return jt!==null?null:te(je,me,""+Ne,Xe);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case A:return Ne.key===jt?ce(je,me,Ne,Xe):null;case E:return Ne.key===jt?Ce(je,me,Ne,Xe):null;case T:return jt=Ne._init,Fe(je,me,jt(Ne._payload),Xe)}if(_e(Ne)||M(Ne))return jt!==null?null:ze(je,me,Ne,Xe,null);Xp(je,Ne)}return null}function dt(je,me,Ne,Xe,jt){if(typeof Xe=="string"&&Xe!==""||typeof Xe=="number")return je=je.get(Ne)||null,te(me,je,""+Xe,jt);if(typeof Xe=="object"&&Xe!==null){switch(Xe.$$typeof){case A:return je=je.get(Xe.key===null?Ne:Xe.key)||null,ce(me,je,Xe,jt);case E:return je=je.get(Xe.key===null?Ne:Xe.key)||null,Ce(me,je,Xe,jt);case T:var Pt=Xe._init;return dt(je,me,Ne,Pt(Xe._payload),jt)}if(_e(Xe)||M(Xe))return je=je.get(Ne)||null,ze(me,je,Xe,jt,null);Xp(me,Xe)}return null}function vt(je,me,Ne,Xe){for(var jt=null,Pt=null,Rt=me,qt=me=0,xr=null;Rt!==null&&qt<Ne.length;qt++){Rt.index>qt?(xr=Rt,Rt=null):xr=Rt.sibling;var cn=Fe(je,Rt,Ne[qt],Xe);if(cn===null){Rt===null&&(Rt=xr);break}l&&Rt&&cn.alternate===null&&u(je,Rt),me=R(cn,me,qt),Pt===null?jt=cn:Pt.sibling=cn,Pt=cn,Rt=xr}if(qt===Ne.length)return g(je,Rt),Fn&&Hi(je,qt),jt;if(Rt===null){for(;qt<Ne.length;qt++)Rt=Ke(je,Ne[qt],Xe),Rt!==null&&(me=R(Rt,me,qt),Pt===null?jt=Rt:Pt.sibling=Rt,Pt=Rt);return Fn&&Hi(je,qt),jt}for(Rt=w(je,Rt);qt<Ne.length;qt++)xr=dt(Rt,je,qt,Ne[qt],Xe),xr!==null&&(l&&xr.alternate!==null&&Rt.delete(xr.key===null?qt:xr.key),me=R(xr,me,qt),Pt===null?jt=xr:Pt.sibling=xr,Pt=xr);return l&&Rt.forEach(function(di){return u(je,di)}),Fn&&Hi(je,qt),jt}function xt(je,me,Ne,Xe){var jt=M(Ne);if(typeof jt!="function")throw Error(n(150));if(Ne=jt.call(Ne),Ne==null)throw Error(n(151));for(var Pt=jt=null,Rt=me,qt=me=0,xr=null,cn=Ne.next();Rt!==null&&!cn.done;qt++,cn=Ne.next()){Rt.index>qt?(xr=Rt,Rt=null):xr=Rt.sibling;var di=Fe(je,Rt,cn.value,Xe);if(di===null){Rt===null&&(Rt=xr);break}l&&Rt&&di.alternate===null&&u(je,Rt),me=R(di,me,qt),Pt===null?jt=di:Pt.sibling=di,Pt=di,Rt=xr}if(cn.done)return g(je,Rt),Fn&&Hi(je,qt),jt;if(Rt===null){for(;!cn.done;qt++,cn=Ne.next())cn=Ke(je,cn.value,Xe),cn!==null&&(me=R(cn,me,qt),Pt===null?jt=cn:Pt.sibling=cn,Pt=cn);return Fn&&Hi(je,qt),jt}for(Rt=w(je,Rt);!cn.done;qt++,cn=Ne.next())cn=dt(Rt,je,qt,cn.value,Xe),cn!==null&&(l&&cn.alternate!==null&&Rt.delete(cn.key===null?qt:cn.key),me=R(cn,me,qt),Pt===null?jt=cn:Pt.sibling=cn,Pt=cn);return l&&Rt.forEach(function(r9){return u(je,r9)}),Fn&&Hi(je,qt),jt}function Jn(je,me,Ne,Xe){if(typeof Ne=="object"&&Ne!==null&&Ne.type===P&&Ne.key===null&&(Ne=Ne.props.children),typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case A:e:{for(var jt=Ne.key,Pt=me;Pt!==null;){if(Pt.key===jt){if(jt=Ne.type,jt===P){if(Pt.tag===7){g(je,Pt.sibling),me=_(Pt,Ne.props.children),me.return=je,je=me;break e}}else if(Pt.elementType===jt||typeof jt=="object"&&jt!==null&&jt.$$typeof===T&&hA(jt)===Pt.type){g(je,Pt.sibling),me=_(Pt,Ne.props),me.ref=ud(je,Pt,Ne),me.return=je,je=me;break e}g(je,Pt);break}else u(je,Pt);Pt=Pt.sibling}Ne.type===P?(me=Zi(Ne.props.children,je.mode,Xe,Ne.key),me.return=je,je=me):(Xe=bh(Ne.type,Ne.key,Ne.props,null,je.mode,Xe),Xe.ref=ud(je,me,Ne),Xe.return=je,je=Xe)}return L(je);case E:e:{for(Pt=Ne.key;me!==null;){if(me.key===Pt)if(me.tag===4&&me.stateNode.containerInfo===Ne.containerInfo&&me.stateNode.implementation===Ne.implementation){g(je,me.sibling),me=_(me,Ne.children||[]),me.return=je,je=me;break e}else{g(je,me);break}else u(je,me);me=me.sibling}me=zy(Ne,je.mode,Xe),me.return=je,je=me}return L(je);case T:return Pt=Ne._init,Jn(je,me,Pt(Ne._payload),Xe)}if(_e(Ne))return vt(je,me,Ne,Xe);if(M(Ne))return xt(je,me,Ne,Xe);Xp(je,Ne)}return typeof Ne=="string"&&Ne!==""||typeof Ne=="number"?(Ne=""+Ne,me!==null&&me.tag===6?(g(je,me.sibling),me=_(me,Ne),me.return=je,je=me):(g(je,me),me=Fy(Ne,je.mode,Xe),me.return=je,je=me),L(je)):g(je,me)}return Jn}var dc=mA(!0),gA=mA(!1),Qp=ei(null),Jp=null,fc=null,Yx=null;function Xx(){Yx=fc=Jp=null}function Qx(l){var u=Qp.current;Tn(Qp),l._currentValue=u}function Jx(l,u,g){for(;l!==null;){var w=l.alternate;if((l.childLanes&u)!==u?(l.childLanes|=u,w!==null&&(w.childLanes|=u)):w!==null&&(w.childLanes&u)!==u&&(w.childLanes|=u),l===g)break;l=l.return}}function pc(l,u){Jp=l,Yx=fc=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&u)!==0&&(Jr=!0),l.firstContext=null)}function Oa(l){var u=l._currentValue;if(Yx!==l)if(l={context:l,memoizedValue:u,next:null},fc===null){if(Jp===null)throw Error(n(308));fc=l,Jp.dependencies={lanes:0,firstContext:l}}else fc=fc.next=l;return u}var Vi=null;function Zx(l){Vi===null?Vi=[l]:Vi.push(l)}function vA(l,u,g,w){var _=u.interleaved;return _===null?(g.next=g,Zx(u)):(g.next=_.next,_.next=g),u.interleaved=g,lo(l,w)}function lo(l,u){l.lanes|=u;var g=l.alternate;for(g!==null&&(g.lanes|=u),g=l,l=l.return;l!==null;)l.childLanes|=u,g=l.alternate,g!==null&&(g.childLanes|=u),g=l,l=l.return;return g.tag===3?g.stateNode:null}var ri=!1;function ey(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function xA(l,u){l=l.updateQueue,u.updateQueue===l&&(u.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function co(l,u){return{eventTime:l,lane:u,tag:0,payload:null,callback:null,next:null}}function ai(l,u,g){var w=l.updateQueue;if(w===null)return null;if(w=w.shared,(ln&2)!==0){var _=w.pending;return _===null?u.next=u:(u.next=_.next,_.next=u),w.pending=u,lo(l,g)}return _=w.interleaved,_===null?(u.next=u,Zx(w)):(u.next=_.next,_.next=u),w.interleaved=u,lo(l,g)}function Zp(l,u,g){if(u=u.updateQueue,u!==null&&(u=u.shared,(g&4194240)!==0)){var w=u.lanes;w&=l.pendingLanes,g|=w,u.lanes=g,ro(l,g)}}function yA(l,u){var g=l.updateQueue,w=l.alternate;if(w!==null&&(w=w.updateQueue,g===w)){var _=null,R=null;if(g=g.firstBaseUpdate,g!==null){do{var L={eventTime:g.eventTime,lane:g.lane,tag:g.tag,payload:g.payload,callback:g.callback,next:null};R===null?_=R=L:R=R.next=L,g=g.next}while(g!==null);R===null?_=R=u:R=R.next=u}else _=R=u;g={baseState:w.baseState,firstBaseUpdate:_,lastBaseUpdate:R,shared:w.shared,effects:w.effects},l.updateQueue=g;return}l=g.lastBaseUpdate,l===null?g.firstBaseUpdate=u:l.next=u,g.lastBaseUpdate=u}function eh(l,u,g,w){var _=l.updateQueue;ri=!1;var R=_.firstBaseUpdate,L=_.lastBaseUpdate,te=_.shared.pending;if(te!==null){_.shared.pending=null;var ce=te,Ce=ce.next;ce.next=null,L===null?R=Ce:L.next=Ce,L=ce;var ze=l.alternate;ze!==null&&(ze=ze.updateQueue,te=ze.lastBaseUpdate,te!==L&&(te===null?ze.firstBaseUpdate=Ce:te.next=Ce,ze.lastBaseUpdate=ce))}if(R!==null){var Ke=_.baseState;L=0,ze=Ce=ce=null,te=R;do{var Fe=te.lane,dt=te.eventTime;if((w&Fe)===Fe){ze!==null&&(ze=ze.next={eventTime:dt,lane:0,tag:te.tag,payload:te.payload,callback:te.callback,next:null});e:{var vt=l,xt=te;switch(Fe=u,dt=g,xt.tag){case 1:if(vt=xt.payload,typeof vt=="function"){Ke=vt.call(dt,Ke,Fe);break e}Ke=vt;break e;case 3:vt.flags=vt.flags&-65537|128;case 0:if(vt=xt.payload,Fe=typeof vt=="function"?vt.call(dt,Ke,Fe):vt,Fe==null)break e;Ke=X({},Ke,Fe);break e;case 2:ri=!0}}te.callback!==null&&te.lane!==0&&(l.flags|=64,Fe=_.effects,Fe===null?_.effects=[te]:Fe.push(te))}else dt={eventTime:dt,lane:Fe,tag:te.tag,payload:te.payload,callback:te.callback,next:null},ze===null?(Ce=ze=dt,ce=Ke):ze=ze.next=dt,L|=Fe;if(te=te.next,te===null){if(te=_.shared.pending,te===null)break;Fe=te,te=Fe.next,Fe.next=null,_.lastBaseUpdate=Fe,_.shared.pending=null}}while(!0);if(ze===null&&(ce=Ke),_.baseState=ce,_.firstBaseUpdate=Ce,_.lastBaseUpdate=ze,u=_.shared.interleaved,u!==null){_=u;do L|=_.lane,_=_.next;while(_!==u)}else R===null&&(_.shared.lanes=0);Yi|=L,l.lanes=L,l.memoizedState=Ke}}function bA(l,u,g){if(l=u.effects,u.effects=null,l!==null)for(u=0;u<l.length;u++){var w=l[u],_=w.callback;if(_!==null){if(w.callback=null,w=g,typeof _!="function")throw Error(n(191,_));_.call(w)}}}var dd={},Is=ei(dd),fd=ei(dd),pd=ei(dd);function Ki(l){if(l===dd)throw Error(n(174));return l}function ty(l,u){switch(Cn(pd,u),Cn(fd,l),Cn(Is,dd),l=u.nodeType,l){case 9:case 11:u=(u=u.documentElement)?u.namespaceURI:an(null,"");break;default:l=l===8?u.parentNode:u,u=l.namespaceURI||null,l=l.tagName,u=an(u,l)}Tn(Is),Cn(Is,u)}function hc(){Tn(Is),Tn(fd),Tn(pd)}function wA(l){Ki(pd.current);var u=Ki(Is.current),g=an(u,l.type);u!==g&&(Cn(fd,l),Cn(Is,g))}function ny(l){fd.current===l&&(Tn(Is),Tn(fd))}var Un=ei(0);function th(l){for(var u=l;u!==null;){if(u.tag===13){var g=u.memoizedState;if(g!==null&&(g=g.dehydrated,g===null||g.data==="$?"||g.data==="$!"))return u}else if(u.tag===19&&u.memoizedProps.revealOrder!==void 0){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===l)break;for(;u.sibling===null;){if(u.return===null||u.return===l)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var ry=[];function ay(){for(var l=0;l<ry.length;l++)ry[l]._workInProgressVersionPrimary=null;ry.length=0}var nh=k.ReactCurrentDispatcher,sy=k.ReactCurrentBatchConfig,Gi=0,Wn=null,or=null,gr=null,rh=!1,hd=!1,md=0,C7=0;function Pr(){throw Error(n(321))}function oy(l,u){if(u===null)return!1;for(var g=0;g<u.length&&g<l.length;g++)if(!cs(l[g],u[g]))return!1;return!0}function iy(l,u,g,w,_,R){if(Gi=R,Wn=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,nh.current=l===null||l.memoizedState===null?E7:P7,l=g(w,_),hd){R=0;do{if(hd=!1,md=0,25<=R)throw Error(n(301));R+=1,gr=or=null,u.updateQueue=null,nh.current=R7,l=g(w,_)}while(hd)}if(nh.current=oh,u=or!==null&&or.next!==null,Gi=0,gr=or=Wn=null,rh=!1,u)throw Error(n(300));return l}function ly(){var l=md!==0;return md=0,l}function $s(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gr===null?Wn.memoizedState=gr=l:gr=gr.next=l,gr}function Ma(){if(or===null){var l=Wn.alternate;l=l!==null?l.memoizedState:null}else l=or.next;var u=gr===null?Wn.memoizedState:gr.next;if(u!==null)gr=u,or=l;else{if(l===null)throw Error(n(310));or=l,l={memoizedState:or.memoizedState,baseState:or.baseState,baseQueue:or.baseQueue,queue:or.queue,next:null},gr===null?Wn.memoizedState=gr=l:gr=gr.next=l}return gr}function gd(l,u){return typeof u=="function"?u(l):u}function cy(l){var u=Ma(),g=u.queue;if(g===null)throw Error(n(311));g.lastRenderedReducer=l;var w=or,_=w.baseQueue,R=g.pending;if(R!==null){if(_!==null){var L=_.next;_.next=R.next,R.next=L}w.baseQueue=_=R,g.pending=null}if(_!==null){R=_.next,w=w.baseState;var te=L=null,ce=null,Ce=R;do{var ze=Ce.lane;if((Gi&ze)===ze)ce!==null&&(ce=ce.next={lane:0,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null}),w=Ce.hasEagerState?Ce.eagerState:l(w,Ce.action);else{var Ke={lane:ze,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null};ce===null?(te=ce=Ke,L=w):ce=ce.next=Ke,Wn.lanes|=ze,Yi|=ze}Ce=Ce.next}while(Ce!==null&&Ce!==R);ce===null?L=w:ce.next=te,cs(w,u.memoizedState)||(Jr=!0),u.memoizedState=w,u.baseState=L,u.baseQueue=ce,g.lastRenderedState=w}if(l=g.interleaved,l!==null){_=l;do R=_.lane,Wn.lanes|=R,Yi|=R,_=_.next;while(_!==l)}else _===null&&(g.lanes=0);return[u.memoizedState,g.dispatch]}function uy(l){var u=Ma(),g=u.queue;if(g===null)throw Error(n(311));g.lastRenderedReducer=l;var w=g.dispatch,_=g.pending,R=u.memoizedState;if(_!==null){g.pending=null;var L=_=_.next;do R=l(R,L.action),L=L.next;while(L!==_);cs(R,u.memoizedState)||(Jr=!0),u.memoizedState=R,u.baseQueue===null&&(u.baseState=R),g.lastRenderedState=R}return[R,w]}function jA(){}function SA(l,u){var g=Wn,w=Ma(),_=u(),R=!cs(w.memoizedState,_);if(R&&(w.memoizedState=_,Jr=!0),w=w.queue,dy(_A.bind(null,g,w,l),[l]),w.getSnapshot!==u||R||gr!==null&&gr.memoizedState.tag&1){if(g.flags|=2048,vd(9,CA.bind(null,g,w,_,u),void 0,null),vr===null)throw Error(n(349));(Gi&30)!==0||NA(g,u,_)}return _}function NA(l,u,g){l.flags|=16384,l={getSnapshot:u,value:g},u=Wn.updateQueue,u===null?(u={lastEffect:null,stores:null},Wn.updateQueue=u,u.stores=[l]):(g=u.stores,g===null?u.stores=[l]:g.push(l))}function CA(l,u,g,w){u.value=g,u.getSnapshot=w,kA(u)&&AA(l)}function _A(l,u,g){return g(function(){kA(u)&&AA(l)})}function kA(l){var u=l.getSnapshot;l=l.value;try{var g=u();return!cs(l,g)}catch{return!0}}function AA(l){var u=lo(l,1);u!==null&&hs(u,l,1,-1)}function EA(l){var u=$s();return typeof l=="function"&&(l=l()),u.memoizedState=u.baseState=l,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:gd,lastRenderedState:l},u.queue=l,l=l.dispatch=A7.bind(null,Wn,l),[u.memoizedState,l]}function vd(l,u,g,w){return l={tag:l,create:u,destroy:g,deps:w,next:null},u=Wn.updateQueue,u===null?(u={lastEffect:null,stores:null},Wn.updateQueue=u,u.lastEffect=l.next=l):(g=u.lastEffect,g===null?u.lastEffect=l.next=l:(w=g.next,g.next=l,l.next=w,u.lastEffect=l)),l}function PA(){return Ma().memoizedState}function ah(l,u,g,w){var _=$s();Wn.flags|=l,_.memoizedState=vd(1|u,g,void 0,w===void 0?null:w)}function sh(l,u,g,w){var _=Ma();w=w===void 0?null:w;var R=void 0;if(or!==null){var L=or.memoizedState;if(R=L.destroy,w!==null&&oy(w,L.deps)){_.memoizedState=vd(u,g,R,w);return}}Wn.flags|=l,_.memoizedState=vd(1|u,g,R,w)}function RA(l,u){return ah(8390656,8,l,u)}function dy(l,u){return sh(2048,8,l,u)}function TA(l,u){return sh(4,2,l,u)}function OA(l,u){return sh(4,4,l,u)}function MA(l,u){if(typeof u=="function")return l=l(),u(l),function(){u(null)};if(u!=null)return l=l(),u.current=l,function(){u.current=null}}function IA(l,u,g){return g=g!=null?g.concat([l]):null,sh(4,4,MA.bind(null,u,l),g)}function fy(){}function $A(l,u){var g=Ma();u=u===void 0?null:u;var w=g.memoizedState;return w!==null&&u!==null&&oy(u,w[1])?w[0]:(g.memoizedState=[l,u],l)}function DA(l,u){var g=Ma();u=u===void 0?null:u;var w=g.memoizedState;return w!==null&&u!==null&&oy(u,w[1])?w[0]:(l=l(),g.memoizedState=[l,u],l)}function LA(l,u,g){return(Gi&21)===0?(l.baseState&&(l.baseState=!1,Jr=!0),l.memoizedState=g):(cs(g,u)||(g=Qn(),Wn.lanes|=g,Yi|=g,l.baseState=!0),u)}function _7(l,u){var g=Ot;Ot=g!==0&&4>g?g:4,l(!0);var w=sy.transition;sy.transition={};try{l(!1),u()}finally{Ot=g,sy.transition=w}}function FA(){return Ma().memoizedState}function k7(l,u,g){var w=li(l);if(g={lane:w,action:g,hasEagerState:!1,eagerState:null,next:null},zA(l))BA(u,g);else if(g=vA(l,u,g,w),g!==null){var _=Dr();hs(g,l,w,_),qA(g,u,w)}}function A7(l,u,g){var w=li(l),_={lane:w,action:g,hasEagerState:!1,eagerState:null,next:null};if(zA(l))BA(u,_);else{var R=l.alternate;if(l.lanes===0&&(R===null||R.lanes===0)&&(R=u.lastRenderedReducer,R!==null))try{var L=u.lastRenderedState,te=R(L,g);if(_.hasEagerState=!0,_.eagerState=te,cs(te,L)){var ce=u.interleaved;ce===null?(_.next=_,Zx(u)):(_.next=ce.next,ce.next=_),u.interleaved=_;return}}catch{}g=vA(l,u,_,w),g!==null&&(_=Dr(),hs(g,l,w,_),qA(g,u,w))}}function zA(l){var u=l.alternate;return l===Wn||u!==null&&u===Wn}function BA(l,u){hd=rh=!0;var g=l.pending;g===null?u.next=u:(u.next=g.next,g.next=u),l.pending=u}function qA(l,u,g){if((g&4194240)!==0){var w=u.lanes;w&=l.pendingLanes,g|=w,u.lanes=g,ro(l,g)}}var oh={readContext:Oa,useCallback:Pr,useContext:Pr,useEffect:Pr,useImperativeHandle:Pr,useInsertionEffect:Pr,useLayoutEffect:Pr,useMemo:Pr,useReducer:Pr,useRef:Pr,useState:Pr,useDebugValue:Pr,useDeferredValue:Pr,useTransition:Pr,useMutableSource:Pr,useSyncExternalStore:Pr,useId:Pr,unstable_isNewReconciler:!1},E7={readContext:Oa,useCallback:function(l,u){return $s().memoizedState=[l,u===void 0?null:u],l},useContext:Oa,useEffect:RA,useImperativeHandle:function(l,u,g){return g=g!=null?g.concat([l]):null,ah(4194308,4,MA.bind(null,u,l),g)},useLayoutEffect:function(l,u){return ah(4194308,4,l,u)},useInsertionEffect:function(l,u){return ah(4,2,l,u)},useMemo:function(l,u){var g=$s();return u=u===void 0?null:u,l=l(),g.memoizedState=[l,u],l},useReducer:function(l,u,g){var w=$s();return u=g!==void 0?g(u):u,w.memoizedState=w.baseState=u,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},w.queue=l,l=l.dispatch=k7.bind(null,Wn,l),[w.memoizedState,l]},useRef:function(l){var u=$s();return l={current:l},u.memoizedState=l},useState:EA,useDebugValue:fy,useDeferredValue:function(l){return $s().memoizedState=l},useTransition:function(){var l=EA(!1),u=l[0];return l=_7.bind(null,l[1]),$s().memoizedState=l,[u,l]},useMutableSource:function(){},useSyncExternalStore:function(l,u,g){var w=Wn,_=$s();if(Fn){if(g===void 0)throw Error(n(407));g=g()}else{if(g=u(),vr===null)throw Error(n(349));(Gi&30)!==0||NA(w,u,g)}_.memoizedState=g;var R={value:g,getSnapshot:u};return _.queue=R,RA(_A.bind(null,w,R,l),[l]),w.flags|=2048,vd(9,CA.bind(null,w,R,g,u),void 0,null),g},useId:function(){var l=$s(),u=vr.identifierPrefix;if(Fn){var g=io,w=oo;g=(w&~(1<<32-Sn(w)-1)).toString(32)+g,u=":"+u+"R"+g,g=md++,0<g&&(u+="H"+g.toString(32)),u+=":"}else g=C7++,u=":"+u+"r"+g.toString(32)+":";return l.memoizedState=u},unstable_isNewReconciler:!1},P7={readContext:Oa,useCallback:$A,useContext:Oa,useEffect:dy,useImperativeHandle:IA,useInsertionEffect:TA,useLayoutEffect:OA,useMemo:DA,useReducer:cy,useRef:PA,useState:function(){return cy(gd)},useDebugValue:fy,useDeferredValue:function(l){var u=Ma();return LA(u,or.memoizedState,l)},useTransition:function(){var l=cy(gd)[0],u=Ma().memoizedState;return[l,u]},useMutableSource:jA,useSyncExternalStore:SA,useId:FA,unstable_isNewReconciler:!1},R7={readContext:Oa,useCallback:$A,useContext:Oa,useEffect:dy,useImperativeHandle:IA,useInsertionEffect:TA,useLayoutEffect:OA,useMemo:DA,useReducer:uy,useRef:PA,useState:function(){return uy(gd)},useDebugValue:fy,useDeferredValue:function(l){var u=Ma();return or===null?u.memoizedState=l:LA(u,or.memoizedState,l)},useTransition:function(){var l=uy(gd)[0],u=Ma().memoizedState;return[l,u]},useMutableSource:jA,useSyncExternalStore:SA,useId:FA,unstable_isNewReconciler:!1};function ds(l,u){if(l&&l.defaultProps){u=X({},u),l=l.defaultProps;for(var g in l)u[g]===void 0&&(u[g]=l[g]);return u}return u}function py(l,u,g,w){u=l.memoizedState,g=g(w,u),g=g==null?u:X({},u,g),l.memoizedState=g,l.lanes===0&&(l.updateQueue.baseState=g)}var ih={isMounted:function(l){return(l=l._reactInternals)?qn(l)===l:!1},enqueueSetState:function(l,u,g){l=l._reactInternals;var w=Dr(),_=li(l),R=co(w,_);R.payload=u,g!=null&&(R.callback=g),u=ai(l,R,_),u!==null&&(hs(u,l,_,w),Zp(u,l,_))},enqueueReplaceState:function(l,u,g){l=l._reactInternals;var w=Dr(),_=li(l),R=co(w,_);R.tag=1,R.payload=u,g!=null&&(R.callback=g),u=ai(l,R,_),u!==null&&(hs(u,l,_,w),Zp(u,l,_))},enqueueForceUpdate:function(l,u){l=l._reactInternals;var g=Dr(),w=li(l),_=co(g,w);_.tag=2,u!=null&&(_.callback=u),u=ai(l,_,w),u!==null&&(hs(u,l,w,g),Zp(u,l,w))}};function UA(l,u,g,w,_,R,L){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(w,R,L):u.prototype&&u.prototype.isPureReactComponent?!rd(g,w)||!rd(_,R):!0}function WA(l,u,g){var w=!1,_=ti,R=u.contextType;return typeof R=="object"&&R!==null?R=Oa(R):(_=Qr(u)?Ui:Er.current,w=u.contextTypes,R=(w=w!=null)?ic(l,_):ti),u=new u(g,R),l.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=ih,l.stateNode=u,u._reactInternals=l,w&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=_,l.__reactInternalMemoizedMaskedChildContext=R),u}function HA(l,u,g,w){l=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(g,w),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(g,w),u.state!==l&&ih.enqueueReplaceState(u,u.state,null)}function hy(l,u,g,w){var _=l.stateNode;_.props=g,_.state=l.memoizedState,_.refs={},ey(l);var R=u.contextType;typeof R=="object"&&R!==null?_.context=Oa(R):(R=Qr(u)?Ui:Er.current,_.context=ic(l,R)),_.state=l.memoizedState,R=u.getDerivedStateFromProps,typeof R=="function"&&(py(l,u,R,g),_.state=l.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(u=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),u!==_.state&&ih.enqueueReplaceState(_,_.state,null),eh(l,g,_,w),_.state=l.memoizedState),typeof _.componentDidMount=="function"&&(l.flags|=4194308)}function mc(l,u){try{var g="",w=u;do g+=oe(w),w=w.return;while(w);var _=g}catch(R){_=`
7
+ Error generating stack: `+R.message+`
8
+ `+R.stack}return{value:l,source:u,stack:_,digest:null}}function my(l,u,g){return{value:l,source:null,stack:g??null,digest:u??null}}function gy(l,u){try{console.error(u.value)}catch(g){setTimeout(function(){throw g})}}var T7=typeof WeakMap=="function"?WeakMap:Map;function VA(l,u,g){g=co(-1,g),g.tag=3,g.payload={element:null};var w=u.value;return g.callback=function(){hh||(hh=!0,Ry=w),gy(l,u)},g}function KA(l,u,g){g=co(-1,g),g.tag=3;var w=l.type.getDerivedStateFromError;if(typeof w=="function"){var _=u.value;g.payload=function(){return w(_)},g.callback=function(){gy(l,u)}}var R=l.stateNode;return R!==null&&typeof R.componentDidCatch=="function"&&(g.callback=function(){gy(l,u),typeof w!="function"&&(oi===null?oi=new Set([this]):oi.add(this));var L=u.stack;this.componentDidCatch(u.value,{componentStack:L!==null?L:""})}),g}function GA(l,u,g){var w=l.pingCache;if(w===null){w=l.pingCache=new T7;var _=new Set;w.set(u,_)}else _=w.get(u),_===void 0&&(_=new Set,w.set(u,_));_.has(g)||(_.add(g),l=V7.bind(null,l,u,g),u.then(l,l))}function YA(l){do{var u;if((u=l.tag===13)&&(u=l.memoizedState,u=u!==null?u.dehydrated!==null:!0),u)return l;l=l.return}while(l!==null);return null}function XA(l,u,g,w,_){return(l.mode&1)===0?(l===u?l.flags|=65536:(l.flags|=128,g.flags|=131072,g.flags&=-52805,g.tag===1&&(g.alternate===null?g.tag=17:(u=co(-1,1),u.tag=2,ai(g,u,1))),g.lanes|=1),l):(l.flags|=65536,l.lanes=_,l)}var O7=k.ReactCurrentOwner,Jr=!1;function $r(l,u,g,w){u.child=l===null?gA(u,null,g,w):dc(u,l.child,g,w)}function QA(l,u,g,w,_){g=g.render;var R=u.ref;return pc(u,_),w=iy(l,u,g,w,R,_),g=ly(),l!==null&&!Jr?(u.updateQueue=l.updateQueue,u.flags&=-2053,l.lanes&=~_,uo(l,u,_)):(Fn&&g&&Wx(u),u.flags|=1,$r(l,u,w,_),u.child)}function JA(l,u,g,w,_){if(l===null){var R=g.type;return typeof R=="function"&&!Ly(R)&&R.defaultProps===void 0&&g.compare===null&&g.defaultProps===void 0?(u.tag=15,u.type=R,ZA(l,u,R,w,_)):(l=bh(g.type,null,w,u,u.mode,_),l.ref=u.ref,l.return=u,u.child=l)}if(R=l.child,(l.lanes&_)===0){var L=R.memoizedProps;if(g=g.compare,g=g!==null?g:rd,g(L,w)&&l.ref===u.ref)return uo(l,u,_)}return u.flags|=1,l=ui(R,w),l.ref=u.ref,l.return=u,u.child=l}function ZA(l,u,g,w,_){if(l!==null){var R=l.memoizedProps;if(rd(R,w)&&l.ref===u.ref)if(Jr=!1,u.pendingProps=w=R,(l.lanes&_)!==0)(l.flags&131072)!==0&&(Jr=!0);else return u.lanes=l.lanes,uo(l,u,_)}return vy(l,u,g,w,_)}function eE(l,u,g){var w=u.pendingProps,_=w.children,R=l!==null?l.memoizedState:null;if(w.mode==="hidden")if((u.mode&1)===0)u.memoizedState={baseLanes:0,cachePool:null,transitions:null},Cn(vc,va),va|=g;else{if((g&1073741824)===0)return l=R!==null?R.baseLanes|g:g,u.lanes=u.childLanes=1073741824,u.memoizedState={baseLanes:l,cachePool:null,transitions:null},u.updateQueue=null,Cn(vc,va),va|=l,null;u.memoizedState={baseLanes:0,cachePool:null,transitions:null},w=R!==null?R.baseLanes:g,Cn(vc,va),va|=w}else R!==null?(w=R.baseLanes|g,u.memoizedState=null):w=g,Cn(vc,va),va|=w;return $r(l,u,_,g),u.child}function tE(l,u){var g=u.ref;(l===null&&g!==null||l!==null&&l.ref!==g)&&(u.flags|=512,u.flags|=2097152)}function vy(l,u,g,w,_){var R=Qr(g)?Ui:Er.current;return R=ic(u,R),pc(u,_),g=iy(l,u,g,w,R,_),w=ly(),l!==null&&!Jr?(u.updateQueue=l.updateQueue,u.flags&=-2053,l.lanes&=~_,uo(l,u,_)):(Fn&&w&&Wx(u),u.flags|=1,$r(l,u,g,_),u.child)}function nE(l,u,g,w,_){if(Qr(g)){var R=!0;Hp(u)}else R=!1;if(pc(u,_),u.stateNode===null)ch(l,u),WA(u,g,w),hy(u,g,w,_),w=!0;else if(l===null){var L=u.stateNode,te=u.memoizedProps;L.props=te;var ce=L.context,Ce=g.contextType;typeof Ce=="object"&&Ce!==null?Ce=Oa(Ce):(Ce=Qr(g)?Ui:Er.current,Ce=ic(u,Ce));var ze=g.getDerivedStateFromProps,Ke=typeof ze=="function"||typeof L.getSnapshotBeforeUpdate=="function";Ke||typeof L.UNSAFE_componentWillReceiveProps!="function"&&typeof L.componentWillReceiveProps!="function"||(te!==w||ce!==Ce)&&HA(u,L,w,Ce),ri=!1;var Fe=u.memoizedState;L.state=Fe,eh(u,w,L,_),ce=u.memoizedState,te!==w||Fe!==ce||Xr.current||ri?(typeof ze=="function"&&(py(u,g,ze,w),ce=u.memoizedState),(te=ri||UA(u,g,te,w,Fe,ce,Ce))?(Ke||typeof L.UNSAFE_componentWillMount!="function"&&typeof L.componentWillMount!="function"||(typeof L.componentWillMount=="function"&&L.componentWillMount(),typeof L.UNSAFE_componentWillMount=="function"&&L.UNSAFE_componentWillMount()),typeof L.componentDidMount=="function"&&(u.flags|=4194308)):(typeof L.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=w,u.memoizedState=ce),L.props=w,L.state=ce,L.context=Ce,w=te):(typeof L.componentDidMount=="function"&&(u.flags|=4194308),w=!1)}else{L=u.stateNode,xA(l,u),te=u.memoizedProps,Ce=u.type===u.elementType?te:ds(u.type,te),L.props=Ce,Ke=u.pendingProps,Fe=L.context,ce=g.contextType,typeof ce=="object"&&ce!==null?ce=Oa(ce):(ce=Qr(g)?Ui:Er.current,ce=ic(u,ce));var dt=g.getDerivedStateFromProps;(ze=typeof dt=="function"||typeof L.getSnapshotBeforeUpdate=="function")||typeof L.UNSAFE_componentWillReceiveProps!="function"&&typeof L.componentWillReceiveProps!="function"||(te!==Ke||Fe!==ce)&&HA(u,L,w,ce),ri=!1,Fe=u.memoizedState,L.state=Fe,eh(u,w,L,_);var vt=u.memoizedState;te!==Ke||Fe!==vt||Xr.current||ri?(typeof dt=="function"&&(py(u,g,dt,w),vt=u.memoizedState),(Ce=ri||UA(u,g,Ce,w,Fe,vt,ce)||!1)?(ze||typeof L.UNSAFE_componentWillUpdate!="function"&&typeof L.componentWillUpdate!="function"||(typeof L.componentWillUpdate=="function"&&L.componentWillUpdate(w,vt,ce),typeof L.UNSAFE_componentWillUpdate=="function"&&L.UNSAFE_componentWillUpdate(w,vt,ce)),typeof L.componentDidUpdate=="function"&&(u.flags|=4),typeof L.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof L.componentDidUpdate!="function"||te===l.memoizedProps&&Fe===l.memoizedState||(u.flags|=4),typeof L.getSnapshotBeforeUpdate!="function"||te===l.memoizedProps&&Fe===l.memoizedState||(u.flags|=1024),u.memoizedProps=w,u.memoizedState=vt),L.props=w,L.state=vt,L.context=ce,w=Ce):(typeof L.componentDidUpdate!="function"||te===l.memoizedProps&&Fe===l.memoizedState||(u.flags|=4),typeof L.getSnapshotBeforeUpdate!="function"||te===l.memoizedProps&&Fe===l.memoizedState||(u.flags|=1024),w=!1)}return xy(l,u,g,w,R,_)}function xy(l,u,g,w,_,R){tE(l,u);var L=(u.flags&128)!==0;if(!w&&!L)return _&&iA(u,g,!1),uo(l,u,R);w=u.stateNode,O7.current=u;var te=L&&typeof g.getDerivedStateFromError!="function"?null:w.render();return u.flags|=1,l!==null&&L?(u.child=dc(u,l.child,null,R),u.child=dc(u,null,te,R)):$r(l,u,te,R),u.memoizedState=w.state,_&&iA(u,g,!0),u.child}function rE(l){var u=l.stateNode;u.pendingContext?sA(l,u.pendingContext,u.pendingContext!==u.context):u.context&&sA(l,u.context,!1),ty(l,u.containerInfo)}function aE(l,u,g,w,_){return uc(),Gx(_),u.flags|=256,$r(l,u,g,w),u.child}var yy={dehydrated:null,treeContext:null,retryLane:0};function by(l){return{baseLanes:l,cachePool:null,transitions:null}}function sE(l,u,g){var w=u.pendingProps,_=Un.current,R=!1,L=(u.flags&128)!==0,te;if((te=L)||(te=l!==null&&l.memoizedState===null?!1:(_&2)!==0),te?(R=!0,u.flags&=-129):(l===null||l.memoizedState!==null)&&(_|=1),Cn(Un,_&1),l===null)return Kx(u),l=u.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((u.mode&1)===0?u.lanes=1:l.data==="$!"?u.lanes=8:u.lanes=1073741824,null):(L=w.children,l=w.fallback,R?(w=u.mode,R=u.child,L={mode:"hidden",children:L},(w&1)===0&&R!==null?(R.childLanes=0,R.pendingProps=L):R=wh(L,w,0,null),l=Zi(l,w,g,null),R.return=u,l.return=u,R.sibling=l,u.child=R,u.child.memoizedState=by(g),u.memoizedState=yy,l):wy(u,L));if(_=l.memoizedState,_!==null&&(te=_.dehydrated,te!==null))return M7(l,u,L,w,te,_,g);if(R){R=w.fallback,L=u.mode,_=l.child,te=_.sibling;var ce={mode:"hidden",children:w.children};return(L&1)===0&&u.child!==_?(w=u.child,w.childLanes=0,w.pendingProps=ce,u.deletions=null):(w=ui(_,ce),w.subtreeFlags=_.subtreeFlags&14680064),te!==null?R=ui(te,R):(R=Zi(R,L,g,null),R.flags|=2),R.return=u,w.return=u,w.sibling=R,u.child=w,w=R,R=u.child,L=l.child.memoizedState,L=L===null?by(g):{baseLanes:L.baseLanes|g,cachePool:null,transitions:L.transitions},R.memoizedState=L,R.childLanes=l.childLanes&~g,u.memoizedState=yy,w}return R=l.child,l=R.sibling,w=ui(R,{mode:"visible",children:w.children}),(u.mode&1)===0&&(w.lanes=g),w.return=u,w.sibling=null,l!==null&&(g=u.deletions,g===null?(u.deletions=[l],u.flags|=16):g.push(l)),u.child=w,u.memoizedState=null,w}function wy(l,u){return u=wh({mode:"visible",children:u},l.mode,0,null),u.return=l,l.child=u}function lh(l,u,g,w){return w!==null&&Gx(w),dc(u,l.child,null,g),l=wy(u,u.pendingProps.children),l.flags|=2,u.memoizedState=null,l}function M7(l,u,g,w,_,R,L){if(g)return u.flags&256?(u.flags&=-257,w=my(Error(n(422))),lh(l,u,L,w)):u.memoizedState!==null?(u.child=l.child,u.flags|=128,null):(R=w.fallback,_=u.mode,w=wh({mode:"visible",children:w.children},_,0,null),R=Zi(R,_,L,null),R.flags|=2,w.return=u,R.return=u,w.sibling=R,u.child=w,(u.mode&1)!==0&&dc(u,l.child,null,L),u.child.memoizedState=by(L),u.memoizedState=yy,R);if((u.mode&1)===0)return lh(l,u,L,null);if(_.data==="$!"){if(w=_.nextSibling&&_.nextSibling.dataset,w)var te=w.dgst;return w=te,R=Error(n(419)),w=my(R,w,void 0),lh(l,u,L,w)}if(te=(L&l.childLanes)!==0,Jr||te){if(w=vr,w!==null){switch(L&-L){case 4:_=2;break;case 16:_=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:_=32;break;case 536870912:_=268435456;break;default:_=0}_=(_&(w.suspendedLanes|L))!==0?0:_,_!==0&&_!==R.retryLane&&(R.retryLane=_,lo(l,_),hs(w,l,_,-1))}return Dy(),w=my(Error(n(421))),lh(l,u,L,w)}return _.data==="$?"?(u.flags|=128,u.child=l.child,u=K7.bind(null,l),_._reactRetry=u,null):(l=R.treeContext,ga=Zo(_.nextSibling),ma=u,Fn=!0,us=null,l!==null&&(Ra[Ta++]=oo,Ra[Ta++]=io,Ra[Ta++]=Wi,oo=l.id,io=l.overflow,Wi=u),u=wy(u,w.children),u.flags|=4096,u)}function oE(l,u,g){l.lanes|=u;var w=l.alternate;w!==null&&(w.lanes|=u),Jx(l.return,u,g)}function jy(l,u,g,w,_){var R=l.memoizedState;R===null?l.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:w,tail:g,tailMode:_}:(R.isBackwards=u,R.rendering=null,R.renderingStartTime=0,R.last=w,R.tail=g,R.tailMode=_)}function iE(l,u,g){var w=u.pendingProps,_=w.revealOrder,R=w.tail;if($r(l,u,w.children,g),w=Un.current,(w&2)!==0)w=w&1|2,u.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=u.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&oE(l,g,u);else if(l.tag===19)oE(l,g,u);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===u)break e;for(;l.sibling===null;){if(l.return===null||l.return===u)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}w&=1}if(Cn(Un,w),(u.mode&1)===0)u.memoizedState=null;else switch(_){case"forwards":for(g=u.child,_=null;g!==null;)l=g.alternate,l!==null&&th(l)===null&&(_=g),g=g.sibling;g=_,g===null?(_=u.child,u.child=null):(_=g.sibling,g.sibling=null),jy(u,!1,_,g,R);break;case"backwards":for(g=null,_=u.child,u.child=null;_!==null;){if(l=_.alternate,l!==null&&th(l)===null){u.child=_;break}l=_.sibling,_.sibling=g,g=_,_=l}jy(u,!0,g,null,R);break;case"together":jy(u,!1,null,null,void 0);break;default:u.memoizedState=null}return u.child}function ch(l,u){(u.mode&1)===0&&l!==null&&(l.alternate=null,u.alternate=null,u.flags|=2)}function uo(l,u,g){if(l!==null&&(u.dependencies=l.dependencies),Yi|=u.lanes,(g&u.childLanes)===0)return null;if(l!==null&&u.child!==l.child)throw Error(n(153));if(u.child!==null){for(l=u.child,g=ui(l,l.pendingProps),u.child=g,g.return=u;l.sibling!==null;)l=l.sibling,g=g.sibling=ui(l,l.pendingProps),g.return=u;g.sibling=null}return u.child}function I7(l,u,g){switch(u.tag){case 3:rE(u),uc();break;case 5:wA(u);break;case 1:Qr(u.type)&&Hp(u);break;case 4:ty(u,u.stateNode.containerInfo);break;case 10:var w=u.type._context,_=u.memoizedProps.value;Cn(Qp,w._currentValue),w._currentValue=_;break;case 13:if(w=u.memoizedState,w!==null)return w.dehydrated!==null?(Cn(Un,Un.current&1),u.flags|=128,null):(g&u.child.childLanes)!==0?sE(l,u,g):(Cn(Un,Un.current&1),l=uo(l,u,g),l!==null?l.sibling:null);Cn(Un,Un.current&1);break;case 19:if(w=(g&u.childLanes)!==0,(l.flags&128)!==0){if(w)return iE(l,u,g);u.flags|=128}if(_=u.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),Cn(Un,Un.current),w)break;return null;case 22:case 23:return u.lanes=0,eE(l,u,g)}return uo(l,u,g)}var lE,Sy,cE,uE;lE=function(l,u){for(var g=u.child;g!==null;){if(g.tag===5||g.tag===6)l.appendChild(g.stateNode);else if(g.tag!==4&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===u)break;for(;g.sibling===null;){if(g.return===null||g.return===u)return;g=g.return}g.sibling.return=g.return,g=g.sibling}},Sy=function(){},cE=function(l,u,g,w){var _=l.memoizedProps;if(_!==w){l=u.stateNode,Ki(Is.current);var R=null;switch(g){case"input":_=Se(l,_),w=Se(l,w),R=[];break;case"select":_=X({},_,{value:void 0}),w=X({},w,{value:void 0}),R=[];break;case"textarea":_=Ze(l,_),w=Ze(l,w),R=[];break;default:typeof _.onClick!="function"&&typeof w.onClick=="function"&&(l.onclick=qp)}Wt(g,w);var L;g=null;for(Ce in _)if(!w.hasOwnProperty(Ce)&&_.hasOwnProperty(Ce)&&_[Ce]!=null)if(Ce==="style"){var te=_[Ce];for(L in te)te.hasOwnProperty(L)&&(g||(g={}),g[L]="")}else Ce!=="dangerouslySetInnerHTML"&&Ce!=="children"&&Ce!=="suppressContentEditableWarning"&&Ce!=="suppressHydrationWarning"&&Ce!=="autoFocus"&&(s.hasOwnProperty(Ce)?R||(R=[]):(R=R||[]).push(Ce,null));for(Ce in w){var ce=w[Ce];if(te=_?.[Ce],w.hasOwnProperty(Ce)&&ce!==te&&(ce!=null||te!=null))if(Ce==="style")if(te){for(L in te)!te.hasOwnProperty(L)||ce&&ce.hasOwnProperty(L)||(g||(g={}),g[L]="");for(L in ce)ce.hasOwnProperty(L)&&te[L]!==ce[L]&&(g||(g={}),g[L]=ce[L])}else g||(R||(R=[]),R.push(Ce,g)),g=ce;else Ce==="dangerouslySetInnerHTML"?(ce=ce?ce.__html:void 0,te=te?te.__html:void 0,ce!=null&&te!==ce&&(R=R||[]).push(Ce,ce)):Ce==="children"?typeof ce!="string"&&typeof ce!="number"||(R=R||[]).push(Ce,""+ce):Ce!=="suppressContentEditableWarning"&&Ce!=="suppressHydrationWarning"&&(s.hasOwnProperty(Ce)?(ce!=null&&Ce==="onScroll"&&Rn("scroll",l),R||te===ce||(R=[])):(R=R||[]).push(Ce,ce))}g&&(R=R||[]).push("style",g);var Ce=R;(u.updateQueue=Ce)&&(u.flags|=4)}},uE=function(l,u,g,w){g!==w&&(u.flags|=4)};function xd(l,u){if(!Fn)switch(l.tailMode){case"hidden":u=l.tail;for(var g=null;u!==null;)u.alternate!==null&&(g=u),u=u.sibling;g===null?l.tail=null:g.sibling=null;break;case"collapsed":g=l.tail;for(var w=null;g!==null;)g.alternate!==null&&(w=g),g=g.sibling;w===null?u||l.tail===null?l.tail=null:l.tail.sibling=null:w.sibling=null}}function Rr(l){var u=l.alternate!==null&&l.alternate.child===l.child,g=0,w=0;if(u)for(var _=l.child;_!==null;)g|=_.lanes|_.childLanes,w|=_.subtreeFlags&14680064,w|=_.flags&14680064,_.return=l,_=_.sibling;else for(_=l.child;_!==null;)g|=_.lanes|_.childLanes,w|=_.subtreeFlags,w|=_.flags,_.return=l,_=_.sibling;return l.subtreeFlags|=w,l.childLanes=g,u}function $7(l,u,g){var w=u.pendingProps;switch(Hx(u),u.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rr(u),null;case 1:return Qr(u.type)&&Wp(),Rr(u),null;case 3:return w=u.stateNode,hc(),Tn(Xr),Tn(Er),ay(),w.pendingContext&&(w.context=w.pendingContext,w.pendingContext=null),(l===null||l.child===null)&&(Yp(u)?u.flags|=4:l===null||l.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,us!==null&&(My(us),us=null))),Sy(l,u),Rr(u),null;case 5:ny(u);var _=Ki(pd.current);if(g=u.type,l!==null&&u.stateNode!=null)cE(l,u,g,w,_),l.ref!==u.ref&&(u.flags|=512,u.flags|=2097152);else{if(!w){if(u.stateNode===null)throw Error(n(166));return Rr(u),null}if(l=Ki(Is.current),Yp(u)){w=u.stateNode,g=u.type;var R=u.memoizedProps;switch(w[Ms]=u,w[ld]=R,l=(u.mode&1)!==0,g){case"dialog":Rn("cancel",w),Rn("close",w);break;case"iframe":case"object":case"embed":Rn("load",w);break;case"video":case"audio":for(_=0;_<sd.length;_++)Rn(sd[_],w);break;case"source":Rn("error",w);break;case"img":case"image":case"link":Rn("error",w),Rn("load",w);break;case"details":Rn("toggle",w);break;case"input":at(w,R),Rn("invalid",w);break;case"select":w._wrapperState={wasMultiple:!!R.multiple},Rn("invalid",w);break;case"textarea":pt(w,R),Rn("invalid",w)}Wt(g,R),_=null;for(var L in R)if(R.hasOwnProperty(L)){var te=R[L];L==="children"?typeof te=="string"?w.textContent!==te&&(R.suppressHydrationWarning!==!0&&Bp(w.textContent,te,l),_=["children",te]):typeof te=="number"&&w.textContent!==""+te&&(R.suppressHydrationWarning!==!0&&Bp(w.textContent,te,l),_=["children",""+te]):s.hasOwnProperty(L)&&te!=null&&L==="onScroll"&&Rn("scroll",w)}switch(g){case"input":De(w),kt(w,R,!0);break;case"textarea":De(w),Ut(w);break;case"select":case"option":break;default:typeof R.onClick=="function"&&(w.onclick=qp)}w=_,u.updateQueue=w,w!==null&&(u.flags|=4)}else{L=_.nodeType===9?_:_.ownerDocument,l==="http://www.w3.org/1999/xhtml"&&(l=Nt(g)),l==="http://www.w3.org/1999/xhtml"?g==="script"?(l=L.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild)):typeof w.is=="string"?l=L.createElement(g,{is:w.is}):(l=L.createElement(g),g==="select"&&(L=l,w.multiple?L.multiple=!0:w.size&&(L.size=w.size))):l=L.createElementNS(l,g),l[Ms]=u,l[ld]=w,lE(l,u,!1,!1),u.stateNode=l;e:{switch(L=yt(g,w),g){case"dialog":Rn("cancel",l),Rn("close",l),_=w;break;case"iframe":case"object":case"embed":Rn("load",l),_=w;break;case"video":case"audio":for(_=0;_<sd.length;_++)Rn(sd[_],l);_=w;break;case"source":Rn("error",l),_=w;break;case"img":case"image":case"link":Rn("error",l),Rn("load",l),_=w;break;case"details":Rn("toggle",l),_=w;break;case"input":at(l,w),_=Se(l,w),Rn("invalid",l);break;case"option":_=w;break;case"select":l._wrapperState={wasMultiple:!!w.multiple},_=X({},w,{value:void 0}),Rn("invalid",l);break;case"textarea":pt(l,w),_=Ze(l,w),Rn("invalid",l);break;default:_=w}Wt(g,_),te=_;for(R in te)if(te.hasOwnProperty(R)){var ce=te[R];R==="style"?qe(l,ce):R==="dangerouslySetInnerHTML"?(ce=ce?ce.__html:void 0,ce!=null&&zt(l,ce)):R==="children"?typeof ce=="string"?(g!=="textarea"||ce!=="")&&sn(l,ce):typeof ce=="number"&&sn(l,""+ce):R!=="suppressContentEditableWarning"&&R!=="suppressHydrationWarning"&&R!=="autoFocus"&&(s.hasOwnProperty(R)?ce!=null&&R==="onScroll"&&Rn("scroll",l):ce!=null&&C(l,R,ce,L))}switch(g){case"input":De(l),kt(l,w,!1);break;case"textarea":De(l),Ut(l);break;case"option":w.value!=null&&l.setAttribute("value",""+ye(w.value));break;case"select":l.multiple=!!w.multiple,R=w.value,R!=null?Ee(l,!!w.multiple,R,!1):w.defaultValue!=null&&Ee(l,!!w.multiple,w.defaultValue,!0);break;default:typeof _.onClick=="function"&&(l.onclick=qp)}switch(g){case"button":case"input":case"select":case"textarea":w=!!w.autoFocus;break e;case"img":w=!0;break e;default:w=!1}}w&&(u.flags|=4)}u.ref!==null&&(u.flags|=512,u.flags|=2097152)}return Rr(u),null;case 6:if(l&&u.stateNode!=null)uE(l,u,l.memoizedProps,w);else{if(typeof w!="string"&&u.stateNode===null)throw Error(n(166));if(g=Ki(pd.current),Ki(Is.current),Yp(u)){if(w=u.stateNode,g=u.memoizedProps,w[Ms]=u,(R=w.nodeValue!==g)&&(l=ma,l!==null))switch(l.tag){case 3:Bp(w.nodeValue,g,(l.mode&1)!==0);break;case 5:l.memoizedProps.suppressHydrationWarning!==!0&&Bp(w.nodeValue,g,(l.mode&1)!==0)}R&&(u.flags|=4)}else w=(g.nodeType===9?g:g.ownerDocument).createTextNode(w),w[Ms]=u,u.stateNode=w}return Rr(u),null;case 13:if(Tn(Un),w=u.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(Fn&&ga!==null&&(u.mode&1)!==0&&(u.flags&128)===0)pA(),uc(),u.flags|=98560,R=!1;else if(R=Yp(u),w!==null&&w.dehydrated!==null){if(l===null){if(!R)throw Error(n(318));if(R=u.memoizedState,R=R!==null?R.dehydrated:null,!R)throw Error(n(317));R[Ms]=u}else uc(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Rr(u),R=!1}else us!==null&&(My(us),us=null),R=!0;if(!R)return u.flags&65536?u:null}return(u.flags&128)!==0?(u.lanes=g,u):(w=w!==null,w!==(l!==null&&l.memoizedState!==null)&&w&&(u.child.flags|=8192,(u.mode&1)!==0&&(l===null||(Un.current&1)!==0?ir===0&&(ir=3):Dy())),u.updateQueue!==null&&(u.flags|=4),Rr(u),null);case 4:return hc(),Sy(l,u),l===null&&od(u.stateNode.containerInfo),Rr(u),null;case 10:return Qx(u.type._context),Rr(u),null;case 17:return Qr(u.type)&&Wp(),Rr(u),null;case 19:if(Tn(Un),R=u.memoizedState,R===null)return Rr(u),null;if(w=(u.flags&128)!==0,L=R.rendering,L===null)if(w)xd(R,!1);else{if(ir!==0||l!==null&&(l.flags&128)!==0)for(l=u.child;l!==null;){if(L=th(l),L!==null){for(u.flags|=128,xd(R,!1),w=L.updateQueue,w!==null&&(u.updateQueue=w,u.flags|=4),u.subtreeFlags=0,w=g,g=u.child;g!==null;)R=g,l=w,R.flags&=14680066,L=R.alternate,L===null?(R.childLanes=0,R.lanes=l,R.child=null,R.subtreeFlags=0,R.memoizedProps=null,R.memoizedState=null,R.updateQueue=null,R.dependencies=null,R.stateNode=null):(R.childLanes=L.childLanes,R.lanes=L.lanes,R.child=L.child,R.subtreeFlags=0,R.deletions=null,R.memoizedProps=L.memoizedProps,R.memoizedState=L.memoizedState,R.updateQueue=L.updateQueue,R.type=L.type,l=L.dependencies,R.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),g=g.sibling;return Cn(Un,Un.current&1|2),u.child}l=l.sibling}R.tail!==null&&jn()>xc&&(u.flags|=128,w=!0,xd(R,!1),u.lanes=4194304)}else{if(!w)if(l=th(L),l!==null){if(u.flags|=128,w=!0,g=l.updateQueue,g!==null&&(u.updateQueue=g,u.flags|=4),xd(R,!0),R.tail===null&&R.tailMode==="hidden"&&!L.alternate&&!Fn)return Rr(u),null}else 2*jn()-R.renderingStartTime>xc&&g!==1073741824&&(u.flags|=128,w=!0,xd(R,!1),u.lanes=4194304);R.isBackwards?(L.sibling=u.child,u.child=L):(g=R.last,g!==null?g.sibling=L:u.child=L,R.last=L)}return R.tail!==null?(u=R.tail,R.rendering=u,R.tail=u.sibling,R.renderingStartTime=jn(),u.sibling=null,g=Un.current,Cn(Un,w?g&1|2:g&1),u):(Rr(u),null);case 22:case 23:return $y(),w=u.memoizedState!==null,l!==null&&l.memoizedState!==null!==w&&(u.flags|=8192),w&&(u.mode&1)!==0?(va&1073741824)!==0&&(Rr(u),u.subtreeFlags&6&&(u.flags|=8192)):Rr(u),null;case 24:return null;case 25:return null}throw Error(n(156,u.tag))}function D7(l,u){switch(Hx(u),u.tag){case 1:return Qr(u.type)&&Wp(),l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 3:return hc(),Tn(Xr),Tn(Er),ay(),l=u.flags,(l&65536)!==0&&(l&128)===0?(u.flags=l&-65537|128,u):null;case 5:return ny(u),null;case 13:if(Tn(Un),l=u.memoizedState,l!==null&&l.dehydrated!==null){if(u.alternate===null)throw Error(n(340));uc()}return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 19:return Tn(Un),null;case 4:return hc(),null;case 10:return Qx(u.type._context),null;case 22:case 23:return $y(),null;case 24:return null;default:return null}}var uh=!1,Tr=!1,L7=typeof WeakSet=="function"?WeakSet:Set,ht=null;function gc(l,u){var g=l.ref;if(g!==null)if(typeof g=="function")try{g(null)}catch(w){Kn(l,u,w)}else g.current=null}function Ny(l,u,g){try{g()}catch(w){Kn(l,u,w)}}var dE=!1;function F7(l,u){if($x=Pp,l=Uk(),Ax(l)){if("selectionStart"in l)var g={start:l.selectionStart,end:l.selectionEnd};else e:{g=(g=l.ownerDocument)&&g.defaultView||window;var w=g.getSelection&&g.getSelection();if(w&&w.rangeCount!==0){g=w.anchorNode;var _=w.anchorOffset,R=w.focusNode;w=w.focusOffset;try{g.nodeType,R.nodeType}catch{g=null;break e}var L=0,te=-1,ce=-1,Ce=0,ze=0,Ke=l,Fe=null;t:for(;;){for(var dt;Ke!==g||_!==0&&Ke.nodeType!==3||(te=L+_),Ke!==R||w!==0&&Ke.nodeType!==3||(ce=L+w),Ke.nodeType===3&&(L+=Ke.nodeValue.length),(dt=Ke.firstChild)!==null;)Fe=Ke,Ke=dt;for(;;){if(Ke===l)break t;if(Fe===g&&++Ce===_&&(te=L),Fe===R&&++ze===w&&(ce=L),(dt=Ke.nextSibling)!==null)break;Ke=Fe,Fe=Ke.parentNode}Ke=dt}g=te===-1||ce===-1?null:{start:te,end:ce}}else g=null}g=g||{start:0,end:0}}else g=null;for(Dx={focusedElem:l,selectionRange:g},Pp=!1,ht=u;ht!==null;)if(u=ht,l=u.child,(u.subtreeFlags&1028)!==0&&l!==null)l.return=u,ht=l;else for(;ht!==null;){u=ht;try{var vt=u.alternate;if((u.flags&1024)!==0)switch(u.tag){case 0:case 11:case 15:break;case 1:if(vt!==null){var xt=vt.memoizedProps,Jn=vt.memoizedState,je=u.stateNode,me=je.getSnapshotBeforeUpdate(u.elementType===u.type?xt:ds(u.type,xt),Jn);je.__reactInternalSnapshotBeforeUpdate=me}break;case 3:var Ne=u.stateNode.containerInfo;Ne.nodeType===1?Ne.textContent="":Ne.nodeType===9&&Ne.documentElement&&Ne.removeChild(Ne.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Xe){Kn(u,u.return,Xe)}if(l=u.sibling,l!==null){l.return=u.return,ht=l;break}ht=u.return}return vt=dE,dE=!1,vt}function yd(l,u,g){var w=u.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var _=w=w.next;do{if((_.tag&l)===l){var R=_.destroy;_.destroy=void 0,R!==void 0&&Ny(u,g,R)}_=_.next}while(_!==w)}}function dh(l,u){if(u=u.updateQueue,u=u!==null?u.lastEffect:null,u!==null){var g=u=u.next;do{if((g.tag&l)===l){var w=g.create;g.destroy=w()}g=g.next}while(g!==u)}}function Cy(l){var u=l.ref;if(u!==null){var g=l.stateNode;l.tag,l=g,typeof u=="function"?u(l):u.current=l}}function fE(l){var u=l.alternate;u!==null&&(l.alternate=null,fE(u)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(u=l.stateNode,u!==null&&(delete u[Ms],delete u[ld],delete u[Bx],delete u[w7],delete u[j7])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function pE(l){return l.tag===5||l.tag===3||l.tag===4}function hE(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||pE(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function _y(l,u,g){var w=l.tag;if(w===5||w===6)l=l.stateNode,u?g.nodeType===8?g.parentNode.insertBefore(l,u):g.insertBefore(l,u):(g.nodeType===8?(u=g.parentNode,u.insertBefore(l,g)):(u=g,u.appendChild(l)),g=g._reactRootContainer,g!=null||u.onclick!==null||(u.onclick=qp));else if(w!==4&&(l=l.child,l!==null))for(_y(l,u,g),l=l.sibling;l!==null;)_y(l,u,g),l=l.sibling}function ky(l,u,g){var w=l.tag;if(w===5||w===6)l=l.stateNode,u?g.insertBefore(l,u):g.appendChild(l);else if(w!==4&&(l=l.child,l!==null))for(ky(l,u,g),l=l.sibling;l!==null;)ky(l,u,g),l=l.sibling}var Sr=null,fs=!1;function si(l,u,g){for(g=g.child;g!==null;)mE(l,u,g),g=g.sibling}function mE(l,u,g){if(rn&&typeof rn.onCommitFiberUnmount=="function")try{rn.onCommitFiberUnmount(Ft,g)}catch{}switch(g.tag){case 5:Tr||gc(g,u);case 6:var w=Sr,_=fs;Sr=null,si(l,u,g),Sr=w,fs=_,Sr!==null&&(fs?(l=Sr,g=g.stateNode,l.nodeType===8?l.parentNode.removeChild(g):l.removeChild(g)):Sr.removeChild(g.stateNode));break;case 18:Sr!==null&&(fs?(l=Sr,g=g.stateNode,l.nodeType===8?zx(l.parentNode,g):l.nodeType===1&&zx(l,g),Qu(l)):zx(Sr,g.stateNode));break;case 4:w=Sr,_=fs,Sr=g.stateNode.containerInfo,fs=!0,si(l,u,g),Sr=w,fs=_;break;case 0:case 11:case 14:case 15:if(!Tr&&(w=g.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){_=w=w.next;do{var R=_,L=R.destroy;R=R.tag,L!==void 0&&((R&2)!==0||(R&4)!==0)&&Ny(g,u,L),_=_.next}while(_!==w)}si(l,u,g);break;case 1:if(!Tr&&(gc(g,u),w=g.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=g.memoizedProps,w.state=g.memoizedState,w.componentWillUnmount()}catch(te){Kn(g,u,te)}si(l,u,g);break;case 21:si(l,u,g);break;case 22:g.mode&1?(Tr=(w=Tr)||g.memoizedState!==null,si(l,u,g),Tr=w):si(l,u,g);break;default:si(l,u,g)}}function gE(l){var u=l.updateQueue;if(u!==null){l.updateQueue=null;var g=l.stateNode;g===null&&(g=l.stateNode=new L7),u.forEach(function(w){var _=G7.bind(null,l,w);g.has(w)||(g.add(w),w.then(_,_))})}}function ps(l,u){var g=u.deletions;if(g!==null)for(var w=0;w<g.length;w++){var _=g[w];try{var R=l,L=u,te=L;e:for(;te!==null;){switch(te.tag){case 5:Sr=te.stateNode,fs=!1;break e;case 3:Sr=te.stateNode.containerInfo,fs=!0;break e;case 4:Sr=te.stateNode.containerInfo,fs=!0;break e}te=te.return}if(Sr===null)throw Error(n(160));mE(R,L,_),Sr=null,fs=!1;var ce=_.alternate;ce!==null&&(ce.return=null),_.return=null}catch(Ce){Kn(_,u,Ce)}}if(u.subtreeFlags&12854)for(u=u.child;u!==null;)vE(u,l),u=u.sibling}function vE(l,u){var g=l.alternate,w=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:if(ps(u,l),Ds(l),w&4){try{yd(3,l,l.return),dh(3,l)}catch(xt){Kn(l,l.return,xt)}try{yd(5,l,l.return)}catch(xt){Kn(l,l.return,xt)}}break;case 1:ps(u,l),Ds(l),w&512&&g!==null&&gc(g,g.return);break;case 5:if(ps(u,l),Ds(l),w&512&&g!==null&&gc(g,g.return),l.flags&32){var _=l.stateNode;try{sn(_,"")}catch(xt){Kn(l,l.return,xt)}}if(w&4&&(_=l.stateNode,_!=null)){var R=l.memoizedProps,L=g!==null?g.memoizedProps:R,te=l.type,ce=l.updateQueue;if(l.updateQueue=null,ce!==null)try{te==="input"&&R.type==="radio"&&R.name!=null&&tt(_,R),yt(te,L);var Ce=yt(te,R);for(L=0;L<ce.length;L+=2){var ze=ce[L],Ke=ce[L+1];ze==="style"?qe(_,Ke):ze==="dangerouslySetInnerHTML"?zt(_,Ke):ze==="children"?sn(_,Ke):C(_,ze,Ke,Ce)}switch(te){case"input":it(_,R);break;case"textarea":Lt(_,R);break;case"select":var Fe=_._wrapperState.wasMultiple;_._wrapperState.wasMultiple=!!R.multiple;var dt=R.value;dt!=null?Ee(_,!!R.multiple,dt,!1):Fe!==!!R.multiple&&(R.defaultValue!=null?Ee(_,!!R.multiple,R.defaultValue,!0):Ee(_,!!R.multiple,R.multiple?[]:"",!1))}_[ld]=R}catch(xt){Kn(l,l.return,xt)}}break;case 6:if(ps(u,l),Ds(l),w&4){if(l.stateNode===null)throw Error(n(162));_=l.stateNode,R=l.memoizedProps;try{_.nodeValue=R}catch(xt){Kn(l,l.return,xt)}}break;case 3:if(ps(u,l),Ds(l),w&4&&g!==null&&g.memoizedState.isDehydrated)try{Qu(u.containerInfo)}catch(xt){Kn(l,l.return,xt)}break;case 4:ps(u,l),Ds(l);break;case 13:ps(u,l),Ds(l),_=l.child,_.flags&8192&&(R=_.memoizedState!==null,_.stateNode.isHidden=R,!R||_.alternate!==null&&_.alternate.memoizedState!==null||(Py=jn())),w&4&&gE(l);break;case 22:if(ze=g!==null&&g.memoizedState!==null,l.mode&1?(Tr=(Ce=Tr)||ze,ps(u,l),Tr=Ce):ps(u,l),Ds(l),w&8192){if(Ce=l.memoizedState!==null,(l.stateNode.isHidden=Ce)&&!ze&&(l.mode&1)!==0)for(ht=l,ze=l.child;ze!==null;){for(Ke=ht=ze;ht!==null;){switch(Fe=ht,dt=Fe.child,Fe.tag){case 0:case 11:case 14:case 15:yd(4,Fe,Fe.return);break;case 1:gc(Fe,Fe.return);var vt=Fe.stateNode;if(typeof vt.componentWillUnmount=="function"){w=Fe,g=Fe.return;try{u=w,vt.props=u.memoizedProps,vt.state=u.memoizedState,vt.componentWillUnmount()}catch(xt){Kn(w,g,xt)}}break;case 5:gc(Fe,Fe.return);break;case 22:if(Fe.memoizedState!==null){bE(Ke);continue}}dt!==null?(dt.return=Fe,ht=dt):bE(Ke)}ze=ze.sibling}e:for(ze=null,Ke=l;;){if(Ke.tag===5){if(ze===null){ze=Ke;try{_=Ke.stateNode,Ce?(R=_.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none"):(te=Ke.stateNode,ce=Ke.memoizedProps.style,L=ce!=null&&ce.hasOwnProperty("display")?ce.display:null,te.style.display=Be("display",L))}catch(xt){Kn(l,l.return,xt)}}}else if(Ke.tag===6){if(ze===null)try{Ke.stateNode.nodeValue=Ce?"":Ke.memoizedProps}catch(xt){Kn(l,l.return,xt)}}else if((Ke.tag!==22&&Ke.tag!==23||Ke.memoizedState===null||Ke===l)&&Ke.child!==null){Ke.child.return=Ke,Ke=Ke.child;continue}if(Ke===l)break e;for(;Ke.sibling===null;){if(Ke.return===null||Ke.return===l)break e;ze===Ke&&(ze=null),Ke=Ke.return}ze===Ke&&(ze=null),Ke.sibling.return=Ke.return,Ke=Ke.sibling}}break;case 19:ps(u,l),Ds(l),w&4&&gE(l);break;case 21:break;default:ps(u,l),Ds(l)}}function Ds(l){var u=l.flags;if(u&2){try{e:{for(var g=l.return;g!==null;){if(pE(g)){var w=g;break e}g=g.return}throw Error(n(160))}switch(w.tag){case 5:var _=w.stateNode;w.flags&32&&(sn(_,""),w.flags&=-33);var R=hE(l);ky(l,R,_);break;case 3:case 4:var L=w.stateNode.containerInfo,te=hE(l);_y(l,te,L);break;default:throw Error(n(161))}}catch(ce){Kn(l,l.return,ce)}l.flags&=-3}u&4096&&(l.flags&=-4097)}function z7(l,u,g){ht=l,xE(l)}function xE(l,u,g){for(var w=(l.mode&1)!==0;ht!==null;){var _=ht,R=_.child;if(_.tag===22&&w){var L=_.memoizedState!==null||uh;if(!L){var te=_.alternate,ce=te!==null&&te.memoizedState!==null||Tr;te=uh;var Ce=Tr;if(uh=L,(Tr=ce)&&!Ce)for(ht=_;ht!==null;)L=ht,ce=L.child,L.tag===22&&L.memoizedState!==null?wE(_):ce!==null?(ce.return=L,ht=ce):wE(_);for(;R!==null;)ht=R,xE(R),R=R.sibling;ht=_,uh=te,Tr=Ce}yE(l)}else(_.subtreeFlags&8772)!==0&&R!==null?(R.return=_,ht=R):yE(l)}}function yE(l){for(;ht!==null;){var u=ht;if((u.flags&8772)!==0){var g=u.alternate;try{if((u.flags&8772)!==0)switch(u.tag){case 0:case 11:case 15:Tr||dh(5,u);break;case 1:var w=u.stateNode;if(u.flags&4&&!Tr)if(g===null)w.componentDidMount();else{var _=u.elementType===u.type?g.memoizedProps:ds(u.type,g.memoizedProps);w.componentDidUpdate(_,g.memoizedState,w.__reactInternalSnapshotBeforeUpdate)}var R=u.updateQueue;R!==null&&bA(u,R,w);break;case 3:var L=u.updateQueue;if(L!==null){if(g=null,u.child!==null)switch(u.child.tag){case 5:g=u.child.stateNode;break;case 1:g=u.child.stateNode}bA(u,L,g)}break;case 5:var te=u.stateNode;if(g===null&&u.flags&4){g=te;var ce=u.memoizedProps;switch(u.type){case"button":case"input":case"select":case"textarea":ce.autoFocus&&g.focus();break;case"img":ce.src&&(g.src=ce.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(u.memoizedState===null){var Ce=u.alternate;if(Ce!==null){var ze=Ce.memoizedState;if(ze!==null){var Ke=ze.dehydrated;Ke!==null&&Qu(Ke)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Tr||u.flags&512&&Cy(u)}catch(Fe){Kn(u,u.return,Fe)}}if(u===l){ht=null;break}if(g=u.sibling,g!==null){g.return=u.return,ht=g;break}ht=u.return}}function bE(l){for(;ht!==null;){var u=ht;if(u===l){ht=null;break}var g=u.sibling;if(g!==null){g.return=u.return,ht=g;break}ht=u.return}}function wE(l){for(;ht!==null;){var u=ht;try{switch(u.tag){case 0:case 11:case 15:var g=u.return;try{dh(4,u)}catch(ce){Kn(u,g,ce)}break;case 1:var w=u.stateNode;if(typeof w.componentDidMount=="function"){var _=u.return;try{w.componentDidMount()}catch(ce){Kn(u,_,ce)}}var R=u.return;try{Cy(u)}catch(ce){Kn(u,R,ce)}break;case 5:var L=u.return;try{Cy(u)}catch(ce){Kn(u,L,ce)}}}catch(ce){Kn(u,u.return,ce)}if(u===l){ht=null;break}var te=u.sibling;if(te!==null){te.return=u.return,ht=te;break}ht=u.return}}var B7=Math.ceil,fh=k.ReactCurrentDispatcher,Ay=k.ReactCurrentOwner,Ia=k.ReactCurrentBatchConfig,ln=0,vr=null,er=null,Nr=0,va=0,vc=ei(0),ir=0,bd=null,Yi=0,ph=0,Ey=0,wd=null,Zr=null,Py=0,xc=1/0,fo=null,hh=!1,Ry=null,oi=null,mh=!1,ii=null,gh=0,jd=0,Ty=null,vh=-1,xh=0;function Dr(){return(ln&6)!==0?jn():vh!==-1?vh:vh=jn()}function li(l){return(l.mode&1)===0?1:(ln&2)!==0&&Nr!==0?Nr&-Nr:N7.transition!==null?(xh===0&&(xh=Qn()),xh):(l=Ot,l!==0||(l=window.event,l=l===void 0?16:Sk(l.type)),l)}function hs(l,u,g,w){if(50<jd)throw jd=0,Ty=null,Error(n(185));mr(l,g,w),((ln&2)===0||l!==vr)&&(l===vr&&((ln&2)===0&&(ph|=g),ir===4&&ci(l,Nr)),ea(l,w),g===1&&ln===0&&(u.mode&1)===0&&(xc=jn()+500,Vp&&ni()))}function ea(l,u){var g=l.callbackNode;Yr(l,u);var w=fn(l,l===vr?Nr:0);if(w===0)g!==null&&ls(g),l.callbackNode=null,l.callbackPriority=0;else if(u=w&-w,l.callbackPriority!==u){if(g!=null&&ls(g),u===1)l.tag===0?S7(SE.bind(null,l)):lA(SE.bind(null,l)),y7(function(){(ln&6)===0&&ni()}),g=null;else{switch(Ql(w)){case 1:g=Bi;break;case 4:g=ie;break;case 16:g=nt;break;case 536870912:g=Et;break;default:g=nt}g=RE(g,jE.bind(null,l))}l.callbackPriority=u,l.callbackNode=g}}function jE(l,u){if(vh=-1,xh=0,(ln&6)!==0)throw Error(n(327));var g=l.callbackNode;if(yc()&&l.callbackNode!==g)return null;var w=fn(l,l===vr?Nr:0);if(w===0)return null;if((w&30)!==0||(w&l.expiredLanes)!==0||u)u=yh(l,w);else{u=w;var _=ln;ln|=2;var R=CE();(vr!==l||Nr!==u)&&(fo=null,xc=jn()+500,Qi(l,u));do try{W7();break}catch(te){NE(l,te)}while(!0);Xx(),fh.current=R,ln=_,er!==null?u=0:(vr=null,Nr=0,u=ir)}if(u!==0){if(u===2&&(_=wt(l),_!==0&&(w=_,u=Oy(l,_))),u===1)throw g=bd,Qi(l,0),ci(l,w),ea(l,jn()),g;if(u===6)ci(l,w);else{if(_=l.current.alternate,(w&30)===0&&!q7(_)&&(u=yh(l,w),u===2&&(R=wt(l),R!==0&&(w=R,u=Oy(l,R))),u===1))throw g=bd,Qi(l,0),ci(l,w),ea(l,jn()),g;switch(l.finishedWork=_,l.finishedLanes=w,u){case 0:case 1:throw Error(n(345));case 2:Ji(l,Zr,fo);break;case 3:if(ci(l,w),(w&130023424)===w&&(u=Py+500-jn(),10<u)){if(fn(l,0)!==0)break;if(_=l.suspendedLanes,(_&w)!==w){Dr(),l.pingedLanes|=l.suspendedLanes&_;break}l.timeoutHandle=Fx(Ji.bind(null,l,Zr,fo),u);break}Ji(l,Zr,fo);break;case 4:if(ci(l,w),(w&4194240)===w)break;for(u=l.eventTimes,_=-1;0<w;){var L=31-Sn(w);R=1<<L,L=u[L],L>_&&(_=L),w&=~R}if(w=_,w=jn()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*B7(w/1960))-w,10<w){l.timeoutHandle=Fx(Ji.bind(null,l,Zr,fo),w);break}Ji(l,Zr,fo);break;case 5:Ji(l,Zr,fo);break;default:throw Error(n(329))}}}return ea(l,jn()),l.callbackNode===g?jE.bind(null,l):null}function Oy(l,u){var g=wd;return l.current.memoizedState.isDehydrated&&(Qi(l,u).flags|=256),l=yh(l,u),l!==2&&(u=Zr,Zr=g,u!==null&&My(u)),l}function My(l){Zr===null?Zr=l:Zr.push.apply(Zr,l)}function q7(l){for(var u=l;;){if(u.flags&16384){var g=u.updateQueue;if(g!==null&&(g=g.stores,g!==null))for(var w=0;w<g.length;w++){var _=g[w],R=_.getSnapshot;_=_.value;try{if(!cs(R(),_))return!1}catch{return!1}}}if(g=u.child,u.subtreeFlags&16384&&g!==null)g.return=u,u=g;else{if(u===l)break;for(;u.sibling===null;){if(u.return===null||u.return===l)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function ci(l,u){for(u&=~Ey,u&=~ph,l.suspendedLanes|=u,l.pingedLanes&=~u,l=l.expirationTimes;0<u;){var g=31-Sn(u),w=1<<g;l[g]=-1,u&=~w}}function SE(l){if((ln&6)!==0)throw Error(n(327));yc();var u=fn(l,0);if((u&1)===0)return ea(l,jn()),null;var g=yh(l,u);if(l.tag!==0&&g===2){var w=wt(l);w!==0&&(u=w,g=Oy(l,w))}if(g===1)throw g=bd,Qi(l,0),ci(l,u),ea(l,jn()),g;if(g===6)throw Error(n(345));return l.finishedWork=l.current.alternate,l.finishedLanes=u,Ji(l,Zr,fo),ea(l,jn()),null}function Iy(l,u){var g=ln;ln|=1;try{return l(u)}finally{ln=g,ln===0&&(xc=jn()+500,Vp&&ni())}}function Xi(l){ii!==null&&ii.tag===0&&(ln&6)===0&&yc();var u=ln;ln|=1;var g=Ia.transition,w=Ot;try{if(Ia.transition=null,Ot=1,l)return l()}finally{Ot=w,Ia.transition=g,ln=u,(ln&6)===0&&ni()}}function $y(){va=vc.current,Tn(vc)}function Qi(l,u){l.finishedWork=null,l.finishedLanes=0;var g=l.timeoutHandle;if(g!==-1&&(l.timeoutHandle=-1,x7(g)),er!==null)for(g=er.return;g!==null;){var w=g;switch(Hx(w),w.tag){case 1:w=w.type.childContextTypes,w!=null&&Wp();break;case 3:hc(),Tn(Xr),Tn(Er),ay();break;case 5:ny(w);break;case 4:hc();break;case 13:Tn(Un);break;case 19:Tn(Un);break;case 10:Qx(w.type._context);break;case 22:case 23:$y()}g=g.return}if(vr=l,er=l=ui(l.current,null),Nr=va=u,ir=0,bd=null,Ey=ph=Yi=0,Zr=wd=null,Vi!==null){for(u=0;u<Vi.length;u++)if(g=Vi[u],w=g.interleaved,w!==null){g.interleaved=null;var _=w.next,R=g.pending;if(R!==null){var L=R.next;R.next=_,w.next=L}g.pending=w}Vi=null}return l}function NE(l,u){do{var g=er;try{if(Xx(),nh.current=oh,rh){for(var w=Wn.memoizedState;w!==null;){var _=w.queue;_!==null&&(_.pending=null),w=w.next}rh=!1}if(Gi=0,gr=or=Wn=null,hd=!1,md=0,Ay.current=null,g===null||g.return===null){ir=1,bd=u,er=null;break}e:{var R=l,L=g.return,te=g,ce=u;if(u=Nr,te.flags|=32768,ce!==null&&typeof ce=="object"&&typeof ce.then=="function"){var Ce=ce,ze=te,Ke=ze.tag;if((ze.mode&1)===0&&(Ke===0||Ke===11||Ke===15)){var Fe=ze.alternate;Fe?(ze.updateQueue=Fe.updateQueue,ze.memoizedState=Fe.memoizedState,ze.lanes=Fe.lanes):(ze.updateQueue=null,ze.memoizedState=null)}var dt=YA(L);if(dt!==null){dt.flags&=-257,XA(dt,L,te,R,u),dt.mode&1&&GA(R,Ce,u),u=dt,ce=Ce;var vt=u.updateQueue;if(vt===null){var xt=new Set;xt.add(ce),u.updateQueue=xt}else vt.add(ce);break e}else{if((u&1)===0){GA(R,Ce,u),Dy();break e}ce=Error(n(426))}}else if(Fn&&te.mode&1){var Jn=YA(L);if(Jn!==null){(Jn.flags&65536)===0&&(Jn.flags|=256),XA(Jn,L,te,R,u),Gx(mc(ce,te));break e}}R=ce=mc(ce,te),ir!==4&&(ir=2),wd===null?wd=[R]:wd.push(R),R=L;do{switch(R.tag){case 3:R.flags|=65536,u&=-u,R.lanes|=u;var je=VA(R,ce,u);yA(R,je);break e;case 1:te=ce;var me=R.type,Ne=R.stateNode;if((R.flags&128)===0&&(typeof me.getDerivedStateFromError=="function"||Ne!==null&&typeof Ne.componentDidCatch=="function"&&(oi===null||!oi.has(Ne)))){R.flags|=65536,u&=-u,R.lanes|=u;var Xe=KA(R,te,u);yA(R,Xe);break e}}R=R.return}while(R!==null)}kE(g)}catch(jt){u=jt,er===g&&g!==null&&(er=g=g.return);continue}break}while(!0)}function CE(){var l=fh.current;return fh.current=oh,l===null?oh:l}function Dy(){(ir===0||ir===3||ir===2)&&(ir=4),vr===null||(Yi&268435455)===0&&(ph&268435455)===0||ci(vr,Nr)}function yh(l,u){var g=ln;ln|=2;var w=CE();(vr!==l||Nr!==u)&&(fo=null,Qi(l,u));do try{U7();break}catch(_){NE(l,_)}while(!0);if(Xx(),ln=g,fh.current=w,er!==null)throw Error(n(261));return vr=null,Nr=0,ir}function U7(){for(;er!==null;)_E(er)}function W7(){for(;er!==null&&!Ar();)_E(er)}function _E(l){var u=PE(l.alternate,l,va);l.memoizedProps=l.pendingProps,u===null?kE(l):er=u,Ay.current=null}function kE(l){var u=l;do{var g=u.alternate;if(l=u.return,(u.flags&32768)===0){if(g=$7(g,u,va),g!==null){er=g;return}}else{if(g=D7(g,u),g!==null){g.flags&=32767,er=g;return}if(l!==null)l.flags|=32768,l.subtreeFlags=0,l.deletions=null;else{ir=6,er=null;return}}if(u=u.sibling,u!==null){er=u;return}er=u=l}while(u!==null);ir===0&&(ir=5)}function Ji(l,u,g){var w=Ot,_=Ia.transition;try{Ia.transition=null,Ot=1,H7(l,u,g,w)}finally{Ia.transition=_,Ot=w}return null}function H7(l,u,g,w){do yc();while(ii!==null);if((ln&6)!==0)throw Error(n(327));g=l.finishedWork;var _=l.finishedLanes;if(g===null)return null;if(l.finishedWork=null,l.finishedLanes=0,g===l.current)throw Error(n(177));l.callbackNode=null,l.callbackPriority=0;var R=g.lanes|g.childLanes;if(Vo(l,R),l===vr&&(er=vr=null,Nr=0),(g.subtreeFlags&2064)===0&&(g.flags&2064)===0||mh||(mh=!0,RE(nt,function(){return yc(),null})),R=(g.flags&15990)!==0,(g.subtreeFlags&15990)!==0||R){R=Ia.transition,Ia.transition=null;var L=Ot;Ot=1;var te=ln;ln|=4,Ay.current=null,F7(l,g),vE(g,l),d7(Dx),Pp=!!$x,Dx=$x=null,l.current=g,z7(g),Ho(),ln=te,Ot=L,Ia.transition=R}else l.current=g;if(mh&&(mh=!1,ii=l,gh=_),R=l.pendingLanes,R===0&&(oi=null),sr(g.stateNode),ea(l,jn()),u!==null)for(w=l.onRecoverableError,g=0;g<u.length;g++)_=u[g],w(_.value,{componentStack:_.stack,digest:_.digest});if(hh)throw hh=!1,l=Ry,Ry=null,l;return(gh&1)!==0&&l.tag!==0&&yc(),R=l.pendingLanes,(R&1)!==0?l===Ty?jd++:(jd=0,Ty=l):jd=0,ni(),null}function yc(){if(ii!==null){var l=Ql(gh),u=Ia.transition,g=Ot;try{if(Ia.transition=null,Ot=16>l?16:l,ii===null)var w=!1;else{if(l=ii,ii=null,gh=0,(ln&6)!==0)throw Error(n(331));var _=ln;for(ln|=4,ht=l.current;ht!==null;){var R=ht,L=R.child;if((ht.flags&16)!==0){var te=R.deletions;if(te!==null){for(var ce=0;ce<te.length;ce++){var Ce=te[ce];for(ht=Ce;ht!==null;){var ze=ht;switch(ze.tag){case 0:case 11:case 15:yd(8,ze,R)}var Ke=ze.child;if(Ke!==null)Ke.return=ze,ht=Ke;else for(;ht!==null;){ze=ht;var Fe=ze.sibling,dt=ze.return;if(fE(ze),ze===Ce){ht=null;break}if(Fe!==null){Fe.return=dt,ht=Fe;break}ht=dt}}}var vt=R.alternate;if(vt!==null){var xt=vt.child;if(xt!==null){vt.child=null;do{var Jn=xt.sibling;xt.sibling=null,xt=Jn}while(xt!==null)}}ht=R}}if((R.subtreeFlags&2064)!==0&&L!==null)L.return=R,ht=L;else e:for(;ht!==null;){if(R=ht,(R.flags&2048)!==0)switch(R.tag){case 0:case 11:case 15:yd(9,R,R.return)}var je=R.sibling;if(je!==null){je.return=R.return,ht=je;break e}ht=R.return}}var me=l.current;for(ht=me;ht!==null;){L=ht;var Ne=L.child;if((L.subtreeFlags&2064)!==0&&Ne!==null)Ne.return=L,ht=Ne;else e:for(L=me;ht!==null;){if(te=ht,(te.flags&2048)!==0)try{switch(te.tag){case 0:case 11:case 15:dh(9,te)}}catch(jt){Kn(te,te.return,jt)}if(te===L){ht=null;break e}var Xe=te.sibling;if(Xe!==null){Xe.return=te.return,ht=Xe;break e}ht=te.return}}if(ln=_,ni(),rn&&typeof rn.onPostCommitFiberRoot=="function")try{rn.onPostCommitFiberRoot(Ft,l)}catch{}w=!0}return w}finally{Ot=g,Ia.transition=u}}return!1}function AE(l,u,g){u=mc(g,u),u=VA(l,u,1),l=ai(l,u,1),u=Dr(),l!==null&&(mr(l,1,u),ea(l,u))}function Kn(l,u,g){if(l.tag===3)AE(l,l,g);else for(;u!==null;){if(u.tag===3){AE(u,l,g);break}else if(u.tag===1){var w=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof w.componentDidCatch=="function"&&(oi===null||!oi.has(w))){l=mc(g,l),l=KA(u,l,1),u=ai(u,l,1),l=Dr(),u!==null&&(mr(u,1,l),ea(u,l));break}}u=u.return}}function V7(l,u,g){var w=l.pingCache;w!==null&&w.delete(u),u=Dr(),l.pingedLanes|=l.suspendedLanes&g,vr===l&&(Nr&g)===g&&(ir===4||ir===3&&(Nr&130023424)===Nr&&500>jn()-Py?Qi(l,0):Ey|=g),ea(l,u)}function EE(l,u){u===0&&((l.mode&1)===0?u=1:(u=Nn,Nn<<=1,(Nn&130023424)===0&&(Nn=4194304)));var g=Dr();l=lo(l,u),l!==null&&(mr(l,u,g),ea(l,g))}function K7(l){var u=l.memoizedState,g=0;u!==null&&(g=u.retryLane),EE(l,g)}function G7(l,u){var g=0;switch(l.tag){case 13:var w=l.stateNode,_=l.memoizedState;_!==null&&(g=_.retryLane);break;case 19:w=l.stateNode;break;default:throw Error(n(314))}w!==null&&w.delete(u),EE(l,g)}var PE;PE=function(l,u,g){if(l!==null)if(l.memoizedProps!==u.pendingProps||Xr.current)Jr=!0;else{if((l.lanes&g)===0&&(u.flags&128)===0)return Jr=!1,I7(l,u,g);Jr=(l.flags&131072)!==0}else Jr=!1,Fn&&(u.flags&1048576)!==0&&cA(u,Gp,u.index);switch(u.lanes=0,u.tag){case 2:var w=u.type;ch(l,u),l=u.pendingProps;var _=ic(u,Er.current);pc(u,g),_=iy(null,u,w,l,_,g);var R=ly();return u.flags|=1,typeof _=="object"&&_!==null&&typeof _.render=="function"&&_.$$typeof===void 0?(u.tag=1,u.memoizedState=null,u.updateQueue=null,Qr(w)?(R=!0,Hp(u)):R=!1,u.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,ey(u),_.updater=ih,u.stateNode=_,_._reactInternals=u,hy(u,w,l,g),u=xy(null,u,w,!0,R,g)):(u.tag=0,Fn&&R&&Wx(u),$r(null,u,_,g),u=u.child),u;case 16:w=u.elementType;e:{switch(ch(l,u),l=u.pendingProps,_=w._init,w=_(w._payload),u.type=w,_=u.tag=X7(w),l=ds(w,l),_){case 0:u=vy(null,u,w,l,g);break e;case 1:u=nE(null,u,w,l,g);break e;case 11:u=QA(null,u,w,l,g);break e;case 14:u=JA(null,u,w,ds(w.type,l),g);break e}throw Error(n(306,w,""))}return u;case 0:return w=u.type,_=u.pendingProps,_=u.elementType===w?_:ds(w,_),vy(l,u,w,_,g);case 1:return w=u.type,_=u.pendingProps,_=u.elementType===w?_:ds(w,_),nE(l,u,w,_,g);case 3:e:{if(rE(u),l===null)throw Error(n(387));w=u.pendingProps,R=u.memoizedState,_=R.element,xA(l,u),eh(u,w,null,g);var L=u.memoizedState;if(w=L.element,R.isDehydrated)if(R={element:w,isDehydrated:!1,cache:L.cache,pendingSuspenseBoundaries:L.pendingSuspenseBoundaries,transitions:L.transitions},u.updateQueue.baseState=R,u.memoizedState=R,u.flags&256){_=mc(Error(n(423)),u),u=aE(l,u,w,g,_);break e}else if(w!==_){_=mc(Error(n(424)),u),u=aE(l,u,w,g,_);break e}else for(ga=Zo(u.stateNode.containerInfo.firstChild),ma=u,Fn=!0,us=null,g=gA(u,null,w,g),u.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(uc(),w===_){u=uo(l,u,g);break e}$r(l,u,w,g)}u=u.child}return u;case 5:return wA(u),l===null&&Kx(u),w=u.type,_=u.pendingProps,R=l!==null?l.memoizedProps:null,L=_.children,Lx(w,_)?L=null:R!==null&&Lx(w,R)&&(u.flags|=32),tE(l,u),$r(l,u,L,g),u.child;case 6:return l===null&&Kx(u),null;case 13:return sE(l,u,g);case 4:return ty(u,u.stateNode.containerInfo),w=u.pendingProps,l===null?u.child=dc(u,null,w,g):$r(l,u,w,g),u.child;case 11:return w=u.type,_=u.pendingProps,_=u.elementType===w?_:ds(w,_),QA(l,u,w,_,g);case 7:return $r(l,u,u.pendingProps,g),u.child;case 8:return $r(l,u,u.pendingProps.children,g),u.child;case 12:return $r(l,u,u.pendingProps.children,g),u.child;case 10:e:{if(w=u.type._context,_=u.pendingProps,R=u.memoizedProps,L=_.value,Cn(Qp,w._currentValue),w._currentValue=L,R!==null)if(cs(R.value,L)){if(R.children===_.children&&!Xr.current){u=uo(l,u,g);break e}}else for(R=u.child,R!==null&&(R.return=u);R!==null;){var te=R.dependencies;if(te!==null){L=R.child;for(var ce=te.firstContext;ce!==null;){if(ce.context===w){if(R.tag===1){ce=co(-1,g&-g),ce.tag=2;var Ce=R.updateQueue;if(Ce!==null){Ce=Ce.shared;var ze=Ce.pending;ze===null?ce.next=ce:(ce.next=ze.next,ze.next=ce),Ce.pending=ce}}R.lanes|=g,ce=R.alternate,ce!==null&&(ce.lanes|=g),Jx(R.return,g,u),te.lanes|=g;break}ce=ce.next}}else if(R.tag===10)L=R.type===u.type?null:R.child;else if(R.tag===18){if(L=R.return,L===null)throw Error(n(341));L.lanes|=g,te=L.alternate,te!==null&&(te.lanes|=g),Jx(L,g,u),L=R.sibling}else L=R.child;if(L!==null)L.return=R;else for(L=R;L!==null;){if(L===u){L=null;break}if(R=L.sibling,R!==null){R.return=L.return,L=R;break}L=L.return}R=L}$r(l,u,_.children,g),u=u.child}return u;case 9:return _=u.type,w=u.pendingProps.children,pc(u,g),_=Oa(_),w=w(_),u.flags|=1,$r(l,u,w,g),u.child;case 14:return w=u.type,_=ds(w,u.pendingProps),_=ds(w.type,_),JA(l,u,w,_,g);case 15:return ZA(l,u,u.type,u.pendingProps,g);case 17:return w=u.type,_=u.pendingProps,_=u.elementType===w?_:ds(w,_),ch(l,u),u.tag=1,Qr(w)?(l=!0,Hp(u)):l=!1,pc(u,g),WA(u,w,_),hy(u,w,_,g),xy(null,u,w,!0,l,g);case 19:return iE(l,u,g);case 22:return eE(l,u,g)}throw Error(n(156,u.tag))};function RE(l,u){return zi(l,u)}function Y7(l,u,g,w){this.tag=l,this.key=g,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $a(l,u,g,w){return new Y7(l,u,g,w)}function Ly(l){return l=l.prototype,!(!l||!l.isReactComponent)}function X7(l){if(typeof l=="function")return Ly(l)?1:0;if(l!=null){if(l=l.$$typeof,l===B)return 11;if(l===I)return 14}return 2}function ui(l,u){var g=l.alternate;return g===null?(g=$a(l.tag,u,l.key,l.mode),g.elementType=l.elementType,g.type=l.type,g.stateNode=l.stateNode,g.alternate=l,l.alternate=g):(g.pendingProps=u,g.type=l.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=l.flags&14680064,g.childLanes=l.childLanes,g.lanes=l.lanes,g.child=l.child,g.memoizedProps=l.memoizedProps,g.memoizedState=l.memoizedState,g.updateQueue=l.updateQueue,u=l.dependencies,g.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},g.sibling=l.sibling,g.index=l.index,g.ref=l.ref,g}function bh(l,u,g,w,_,R){var L=2;if(w=l,typeof l=="function")Ly(l)&&(L=1);else if(typeof l=="string")L=5;else e:switch(l){case P:return Zi(g.children,_,R,u);case O:L=8,_|=8;break;case D:return l=$a(12,g,u,_|2),l.elementType=D,l.lanes=R,l;case Y:return l=$a(13,g,u,_),l.elementType=Y,l.lanes=R,l;case z:return l=$a(19,g,u,_),l.elementType=z,l.lanes=R,l;case V:return wh(g,_,R,u);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case K:L=10;break e;case q:L=9;break e;case B:L=11;break e;case I:L=14;break e;case T:L=16,w=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return u=$a(L,g,u,_),u.elementType=l,u.type=w,u.lanes=R,u}function Zi(l,u,g,w){return l=$a(7,l,w,u),l.lanes=g,l}function wh(l,u,g,w){return l=$a(22,l,w,u),l.elementType=V,l.lanes=g,l.stateNode={isHidden:!1},l}function Fy(l,u,g){return l=$a(6,l,null,u),l.lanes=g,l}function zy(l,u,g){return u=$a(4,l.children!==null?l.children:[],l.key,u),u.lanes=g,u.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},u}function Q7(l,u,g,w,_){this.tag=u,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vn(0),this.expirationTimes=Vn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vn(0),this.identifierPrefix=w,this.onRecoverableError=_,this.mutableSourceEagerHydrationData=null}function By(l,u,g,w,_,R,L,te,ce){return l=new Q7(l,u,g,te,ce),u===1?(u=1,R===!0&&(u|=8)):u=0,R=$a(3,null,null,u),l.current=R,R.stateNode=l,R.memoizedState={element:w,isDehydrated:g,cache:null,transitions:null,pendingSuspenseBoundaries:null},ey(R),l}function J7(l,u,g){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:E,key:w==null?null:""+w,children:l,containerInfo:u,implementation:g}}function TE(l){if(!l)return ti;l=l._reactInternals;e:{if(qn(l)!==l||l.tag!==1)throw Error(n(170));var u=l;do{switch(u.tag){case 3:u=u.stateNode.context;break e;case 1:if(Qr(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break e}}u=u.return}while(u!==null);throw Error(n(171))}if(l.tag===1){var g=l.type;if(Qr(g))return oA(l,g,u)}return u}function OE(l,u,g,w,_,R,L,te,ce){return l=By(g,w,!0,l,_,R,L,te,ce),l.context=TE(null),g=l.current,w=Dr(),_=li(g),R=co(w,_),R.callback=u??null,ai(g,R,_),l.current.lanes=_,mr(l,_,w),ea(l,w),l}function jh(l,u,g,w){var _=u.current,R=Dr(),L=li(_);return g=TE(g),u.context===null?u.context=g:u.pendingContext=g,u=co(R,L),u.payload={element:l},w=w===void 0?null:w,w!==null&&(u.callback=w),l=ai(_,u,L),l!==null&&(hs(l,_,L,R),Zp(l,_,L)),L}function Sh(l){return l=l.current,l.child?(l.child.tag===5,l.child.stateNode):null}function ME(l,u){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var g=l.retryLane;l.retryLane=g!==0&&g<u?g:u}}function qy(l,u){ME(l,u),(l=l.alternate)&&ME(l,u)}function Z7(){return null}var IE=typeof reportError=="function"?reportError:function(l){console.error(l)};function Uy(l){this._internalRoot=l}Nh.prototype.render=Uy.prototype.render=function(l){var u=this._internalRoot;if(u===null)throw Error(n(409));jh(l,u,null,null)},Nh.prototype.unmount=Uy.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var u=l.containerInfo;Xi(function(){jh(null,l,null,null)}),u[ao]=null}};function Nh(l){this._internalRoot=l}Nh.prototype.unstable_scheduleHydration=function(l){if(l){var u=xk();l={blockedOn:null,target:l,priority:u};for(var g=0;g<Xo.length&&u!==0&&u<Xo[g].priority;g++);Xo.splice(g,0,l),g===0&&wk(l)}};function Wy(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function Ch(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11&&(l.nodeType!==8||l.nodeValue!==" react-mount-point-unstable "))}function $E(){}function e9(l,u,g,w,_){if(_){if(typeof w=="function"){var R=w;w=function(){var Ce=Sh(L);R.call(Ce)}}var L=OE(u,w,l,0,null,!1,!1,"",$E);return l._reactRootContainer=L,l[ao]=L.current,od(l.nodeType===8?l.parentNode:l),Xi(),L}for(;_=l.lastChild;)l.removeChild(_);if(typeof w=="function"){var te=w;w=function(){var Ce=Sh(ce);te.call(Ce)}}var ce=By(l,0,!1,null,null,!1,!1,"",$E);return l._reactRootContainer=ce,l[ao]=ce.current,od(l.nodeType===8?l.parentNode:l),Xi(function(){jh(u,ce,g,w)}),ce}function _h(l,u,g,w,_){var R=g._reactRootContainer;if(R){var L=R;if(typeof _=="function"){var te=_;_=function(){var ce=Sh(L);te.call(ce)}}jh(u,L,l,_)}else L=e9(g,u,l,_,w);return Sh(L)}gk=function(l){switch(l.tag){case 3:var u=l.stateNode;if(u.current.memoizedState.isDehydrated){var g=vn(u.pendingLanes);g!==0&&(ro(u,g|1),ea(u,jn()),(ln&6)===0&&(xc=jn()+500,ni()))}break;case 13:Xi(function(){var w=lo(l,1);if(w!==null){var _=Dr();hs(w,l,1,_)}}),qy(l,1)}},mx=function(l){if(l.tag===13){var u=lo(l,134217728);if(u!==null){var g=Dr();hs(u,l,134217728,g)}qy(l,134217728)}},vk=function(l){if(l.tag===13){var u=li(l),g=lo(l,u);if(g!==null){var w=Dr();hs(g,l,u,w)}qy(l,u)}},xk=function(){return Ot},yk=function(l,u){var g=Ot;try{return Ot=l,u()}finally{Ot=g}},Ge=function(l,u,g){switch(u){case"input":if(it(l,g),u=g.name,g.type==="radio"&&u!=null){for(g=l;g.parentNode;)g=g.parentNode;for(g=g.querySelectorAll("input[name="+JSON.stringify(""+u)+'][type="radio"]'),u=0;u<g.length;u++){var w=g[u];if(w!==l&&w.form===l.form){var _=Up(w);if(!_)throw Error(n(90));ge(w),it(w,_)}}}break;case"textarea":Lt(l,g);break;case"select":u=g.value,u!=null&&Ee(l,!!g.multiple,u,!1)}},be=Iy,we=Xi;var t9={usingClientEntryPoint:!1,Events:[cd,sc,Up,J,xe,Iy]},Sd={findFiberByHostInstance:qi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},n9={bundleType:Sd.bundleType,version:Sd.version,rendererPackageName:Sd.rendererPackageName,rendererConfig:Sd.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:k.ReactCurrentDispatcher,findHostInstanceByFiber:function(l){return l=Fi(l),l===null?null:l.stateNode},findFiberByHostInstance:Sd.findFiberByHostInstance||Z7,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var kh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!kh.isDisabled&&kh.supportsFiber)try{Ft=kh.inject(n9),rn=kh}catch{}}return ta.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=t9,ta.createPortal=function(l,u){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Wy(u))throw Error(n(200));return J7(l,u,null,g)},ta.createRoot=function(l,u){if(!Wy(l))throw Error(n(299));var g=!1,w="",_=IE;return u!=null&&(u.unstable_strictMode===!0&&(g=!0),u.identifierPrefix!==void 0&&(w=u.identifierPrefix),u.onRecoverableError!==void 0&&(_=u.onRecoverableError)),u=By(l,1,!1,null,null,g,!1,w,_),l[ao]=u.current,od(l.nodeType===8?l.parentNode:l),new Uy(u)},ta.findDOMNode=function(l){if(l==null)return null;if(l.nodeType===1)return l;var u=l._reactInternals;if(u===void 0)throw typeof l.render=="function"?Error(n(188)):(l=Object.keys(l).join(","),Error(n(268,l)));return l=Fi(u),l=l===null?null:l.stateNode,l},ta.flushSync=function(l){return Xi(l)},ta.hydrate=function(l,u,g){if(!Ch(u))throw Error(n(200));return _h(null,l,u,!0,g)},ta.hydrateRoot=function(l,u,g){if(!Wy(l))throw Error(n(405));var w=g!=null&&g.hydratedSources||null,_=!1,R="",L=IE;if(g!=null&&(g.unstable_strictMode===!0&&(_=!0),g.identifierPrefix!==void 0&&(R=g.identifierPrefix),g.onRecoverableError!==void 0&&(L=g.onRecoverableError)),u=OE(u,null,l,1,g??null,_,!1,R,L),l[ao]=u.current,od(l),w)for(l=0;l<w.length;l++)g=w[l],_=g._getVersion,_=_(g._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[g,_]:u.mutableSourceEagerHydrationData.push(g,_);return new Nh(u)},ta.render=function(l,u,g){if(!Ch(u))throw Error(n(200));return _h(null,l,u,!1,g)},ta.unmountComponentAtNode=function(l){if(!Ch(l))throw Error(n(40));return l._reactRootContainer?(Xi(function(){_h(null,null,l,!1,function(){l._reactRootContainer=null,l[ao]=null})}),!0):!1},ta.unstable_batchedUpdates=Iy,ta.unstable_renderSubtreeIntoContainer=function(l,u,g,w){if(!Ch(g))throw Error(n(200));if(l==null||l._reactInternals===void 0)throw Error(n(38));return _h(l,u,g,!1,w)},ta.version="18.3.1-next-f1338f8080-20240426",ta}var WE;function qD(){if(WE)return Ky.exports;WE=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ky.exports=u9(),Ky.exports}var HE;function d9(){if(HE)return Eh;HE=1;var e=qD();return Eh.createRoot=e.createRoot,Eh.hydrateRoot=e.hydrateRoot,Eh}var f9=d9(),h=rC();const Q=xn(h),aC=a9({__proto__:null,default:Q},[h]),p9=1,h9=1e6;let Xy=0;function m9(){return Xy=(Xy+1)%Number.MAX_SAFE_INTEGER,Xy.toString()}const Qy=new Map,VE=e=>{if(Qy.has(e))return;const t=setTimeout(()=>{Qy.delete(e),Vd({type:"REMOVE_TOAST",toastId:e})},h9);Qy.set(e,t)},g9=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,p9)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?VE(n):e.toasts.forEach(r=>{VE(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},rm=[];let am={toasts:[]};function Vd(e){am=g9(am,e),rm.forEach(t=>{t(am)})}function Me({...e}){const t=m9(),n=s=>Vd({type:"UPDATE_TOAST",toast:{...s,id:t}}),r=()=>Vd({type:"DISMISS_TOAST",toastId:t});return Vd({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||r()}}}),{id:t,dismiss:r,update:n}}function v9(){const[e,t]=h.useState(am);return h.useEffect(()=>(rm.push(t),()=>{const n=rm.indexOf(t);n>-1&&rm.splice(n,1)}),[e]),{...e,toast:Me,dismiss:n=>Vd({type:"DISMISS_TOAST",toastId:n})}}var _u=qD();const UD=xn(_u);function We(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}function KE(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Vr(...e){return t=>{let n=!1;const r=e.map(s=>{const o=KE(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():KE(e[s],null)}}}}function Tt(...e){return h.useCallback(Vr(...e),e)}function x9(e,t){const n=h.createContext(t),r=o=>{const{children:i,...c}=o,d=h.useMemo(()=>c,Object.values(c));return a.jsx(n.Provider,{value:d,children:i})};r.displayName=e+"Provider";function s(o){const i=h.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,s]}function kr(e,t=[]){let n=[];function r(o,i){const c=h.createContext(i),d=n.length;n=[...n,i];const f=p=>{const{scope:v,children:x,...j}=p,y=v?.[e]?.[d]||c,b=h.useMemo(()=>j,Object.values(j));return a.jsx(y.Provider,{value:b,children:x})};f.displayName=o+"Provider";function m(p,v){const x=v?.[e]?.[d]||c,j=h.useContext(x);if(j)return j;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[f,m]}const s=()=>{const o=n.map(i=>h.createContext(i));return function(c){const d=c?.[e]||o;return h.useMemo(()=>({[`__scope${e}`]:{...c,[e]:d}}),[c,d])}};return s.scopeName=e,[r,y9(s,...t)]}function y9(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((c,{useScope:d,scopeName:f})=>{const p=d(o)[`__scope${f}`];return{...c,...p}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function GE(e){const t=b9(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),d=c.find(j9);if(d){const f=d.props.children,m=c.map(p=>p===d?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function b9(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=N9(s),c=S9(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var w9=Symbol("radix.slottable");function j9(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===w9}function S9(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const d=o(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function N9(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Qf(e){const t=e+"CollectionProvider",[n,r]=kr(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=y=>{const{scope:b,children:S}=y,N=Q.useRef(null),C=Q.useRef(new Map).current;return a.jsx(s,{scope:b,itemMap:C,collectionRef:N,children:S})};i.displayName=t;const c=e+"CollectionSlot",d=GE(c),f=Q.forwardRef((y,b)=>{const{scope:S,children:N}=y,C=o(c,S),k=Tt(b,C.collectionRef);return a.jsx(d,{ref:k,children:N})});f.displayName=c;const m=e+"CollectionItemSlot",p="data-radix-collection-item",v=GE(m),x=Q.forwardRef((y,b)=>{const{scope:S,children:N,...C}=y,k=Q.useRef(null),A=Tt(b,k),E=o(m,S);return Q.useEffect(()=>(E.itemMap.set(k,{ref:k,...C}),()=>{E.itemMap.delete(k)})),a.jsx(v,{[p]:"",ref:A,children:N})});x.displayName=m;function j(y){const b=o(e+"CollectionConsumer",y);return Q.useCallback(()=>{const N=b.collectionRef.current;if(!N)return[];const C=Array.from(N.querySelectorAll(`[${p}]`));return Array.from(b.itemMap.values()).sort((E,P)=>C.indexOf(E.ref.current)-C.indexOf(P.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:i,Slot:f,ItemSlot:x},j,r]}function C9(e){const t=_9(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),d=c.find(A9);if(d){const f=d.props.children,m=c.map(p=>p===d?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function _9(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=P9(s),c=E9(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var k9=Symbol("radix.slottable");function A9(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===k9}function E9(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const d=o(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function P9(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var R9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lt=R9.reduce((e,t)=>{const n=C9(`Primitive.${t}`),r=h.forwardRef((s,o)=>{const{asChild:i,...c}=s,d=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function sC(e,t){e&&_u.flushSync(()=>e.dispatchEvent(t))}function Zn(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>t.current?.(...n),[])}function T9(e,t=globalThis?.document){const n=Zn(e);h.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var O9="DismissableLayer",BS="dismissableLayer.update",M9="dismissableLayer.pointerDownOutside",I9="dismissableLayer.focusOutside",YE,WD=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Fl=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:c,...d}=e,f=h.useContext(WD),[m,p]=h.useState(null),v=m?.ownerDocument??globalThis?.document,[,x]=h.useState({}),j=Tt(t,P=>p(P)),y=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),S=y.indexOf(b),N=m?y.indexOf(m):-1,C=f.layersWithOutsidePointerEventsDisabled.size>0,k=N>=S,A=D9(P=>{const O=P.target,D=[...f.branches].some(K=>K.contains(O));!k||D||(s?.(P),i?.(P),P.defaultPrevented||c?.())},v),E=L9(P=>{const O=P.target;[...f.branches].some(K=>K.contains(O))||(o?.(P),i?.(P),P.defaultPrevented||c?.())},v);return T9(P=>{N===f.layers.size-1&&(r?.(P),!P.defaultPrevented&&c&&(P.preventDefault(),c()))},v),h.useEffect(()=>{if(m)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(YE=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(m)),f.layers.add(m),XE(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=YE)}},[m,v,n,f]),h.useEffect(()=>()=>{m&&(f.layers.delete(m),f.layersWithOutsidePointerEventsDisabled.delete(m),XE())},[m,f]),h.useEffect(()=>{const P=()=>x({});return document.addEventListener(BS,P),()=>document.removeEventListener(BS,P)},[]),a.jsx(lt.div,{...d,ref:j,style:{pointerEvents:C?k?"auto":"none":void 0,...e.style},onFocusCapture:We(e.onFocusCapture,E.onFocusCapture),onBlurCapture:We(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:We(e.onPointerDownCapture,A.onPointerDownCapture)})});Fl.displayName=O9;var $9="DismissableLayerBranch",HD=h.forwardRef((e,t)=>{const n=h.useContext(WD),r=h.useRef(null),s=Tt(t,r);return h.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(lt.div,{...e,ref:s})});HD.displayName=$9;function D9(e,t=globalThis?.document){const n=Zn(e),r=h.useRef(!1),s=h.useRef(()=>{});return h.useEffect(()=>{const o=c=>{if(c.target&&!r.current){let d=function(){VD(M9,n,f,{discrete:!0})};const f={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=d,t.addEventListener("click",s.current,{once:!0})):d()}else t.removeEventListener("click",s.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function L9(e,t=globalThis?.document){const n=Zn(e),r=h.useRef(!1);return h.useEffect(()=>{const s=o=>{o.target&&!r.current&&VD(I9,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function XE(){const e=new CustomEvent(BS);document.dispatchEvent(e)}function VD(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?sC(s,o):s.dispatchEvent(o)}var F9=Fl,z9=HD,pr=globalThis?.document?h.useLayoutEffect:()=>{},B9="Portal",zl=h.forwardRef((e,t)=>{const{container:n,...r}=e,[s,o]=h.useState(!1);pr(()=>o(!0),[]);const i=n||s&&globalThis?.document?.body;return i?UD.createPortal(a.jsx(lt.div,{...r,ref:t}),i):null});zl.displayName=B9;function q9(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var ar=e=>{const{present:t,children:n}=e,r=U9(t),s=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),o=Tt(r.ref,W9(s));return typeof n=="function"||r.isPresent?h.cloneElement(s,{ref:o}):null};ar.displayName="Presence";function U9(e){const[t,n]=h.useState(),r=h.useRef(null),s=h.useRef(e),o=h.useRef("none"),i=e?"mounted":"unmounted",[c,d]=q9(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const f=Ph(r.current);o.current=c==="mounted"?f:"none"},[c]),pr(()=>{const f=r.current,m=s.current;if(m!==e){const v=o.current,x=Ph(f);e?d("MOUNT"):x==="none"||f?.display==="none"?d("UNMOUNT"):d(m&&v!==x?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,d]),pr(()=>{if(t){let f;const m=t.ownerDocument.defaultView??window,p=x=>{const y=Ph(r.current).includes(CSS.escape(x.animationName));if(x.target===t&&y&&(d("ANIMATION_END"),!s.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",f=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},v=x=>{x.target===t&&(o.current=Ph(r.current))};return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{m.clearTimeout(f),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:h.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Ph(e){return e?.animationName||"none"}function W9(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var H9=aC[" useInsertionEffect ".trim().toString()]||pr;function Aa({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=V9({defaultProp:t,onChange:n}),c=e!==void 0,d=c?e:s;{const m=h.useRef(e!==void 0);h.useEffect(()=>{const p=m.current;p!==c&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${c?"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.`),m.current=c},[c,r])}const f=h.useCallback(m=>{if(c){const p=K9(m)?m(e):m;p!==e&&i.current?.(p)}else o(m)},[c,e,o,i]);return[d,f]}function V9({defaultProp:e,onChange:t}){const[n,r]=h.useState(e),s=h.useRef(n),o=h.useRef(t);return H9(()=>{o.current=t},[t]),h.useEffect(()=>{s.current!==n&&(o.current?.(n),s.current=n)},[n,s]),[n,r,o]}function K9(e){return typeof e=="function"}var KD=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"}),G9="VisuallyHidden",Dg=h.forwardRef((e,t)=>a.jsx(lt.span,{...e,ref:t,style:{...KD,...e.style}}));Dg.displayName=G9;var Y9=Dg,oC="ToastProvider",[iC,X9,Q9]=Qf("Toast"),[GD]=kr("Toast",[Q9]),[J9,Lg]=GD(oC),YD=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[c,d]=h.useState(null),[f,m]=h.useState(0),p=h.useRef(!1),v=h.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${oC}\`. Expected non-empty \`string\`.`),a.jsx(iC.Provider,{scope:t,children:a.jsx(J9,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:o,toastCount:f,viewport:c,onViewportChange:d,onToastAdd:h.useCallback(()=>m(x=>x+1),[]),onToastRemove:h.useCallback(()=>m(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:v,children:i})})};YD.displayName=oC;var XD="ToastViewport",Z9=["F8"],qS="toast.viewportPause",US="toast.viewportResume",QD=h.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=Z9,label:s="Notifications ({hotkey})",...o}=e,i=Lg(XD,n),c=X9(n),d=h.useRef(null),f=h.useRef(null),m=h.useRef(null),p=h.useRef(null),v=Tt(t,p,i.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),j=i.toastCount>0;h.useEffect(()=>{const b=S=>{r.length!==0&&r.every(C=>S[C]||S.code===C)&&p.current?.focus()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]),h.useEffect(()=>{const b=d.current,S=p.current;if(j&&b&&S){const N=()=>{if(!i.isClosePausedRef.current){const E=new CustomEvent(qS);S.dispatchEvent(E),i.isClosePausedRef.current=!0}},C=()=>{if(i.isClosePausedRef.current){const E=new CustomEvent(US);S.dispatchEvent(E),i.isClosePausedRef.current=!1}},k=E=>{!b.contains(E.relatedTarget)&&C()},A=()=>{b.contains(document.activeElement)||C()};return b.addEventListener("focusin",N),b.addEventListener("focusout",k),b.addEventListener("pointermove",N),b.addEventListener("pointerleave",A),window.addEventListener("blur",N),window.addEventListener("focus",C),()=>{b.removeEventListener("focusin",N),b.removeEventListener("focusout",k),b.removeEventListener("pointermove",N),b.removeEventListener("pointerleave",A),window.removeEventListener("blur",N),window.removeEventListener("focus",C)}}},[j,i.isClosePausedRef]);const y=h.useCallback(({tabbingDirection:b})=>{const N=c().map(C=>{const k=C.ref.current,A=[k,...fW(k)];return b==="forwards"?A:A.reverse()});return(b==="forwards"?N.reverse():N).flat()},[c]);return h.useEffect(()=>{const b=p.current;if(b){const S=N=>{const C=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!C){const A=document.activeElement,E=N.shiftKey;if(N.target===b&&E){f.current?.focus();return}const D=y({tabbingDirection:E?"backwards":"forwards"}),K=D.findIndex(q=>q===A);Jy(D.slice(K+1))?N.preventDefault():E?f.current?.focus():m.current?.focus()}};return b.addEventListener("keydown",S),()=>b.removeEventListener("keydown",S)}},[c,y]),a.jsxs(z9,{ref:d,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:j?void 0:"none"},children:[j&&a.jsx(WS,{ref:f,onFocusFromOutsideViewport:()=>{const b=y({tabbingDirection:"forwards"});Jy(b)}}),a.jsx(iC.Slot,{scope:n,children:a.jsx(lt.ol,{tabIndex:-1,...o,ref:v})}),j&&a.jsx(WS,{ref:m,onFocusFromOutsideViewport:()=>{const b=y({tabbingDirection:"backwards"});Jy(b)}})]})});QD.displayName=XD;var JD="ToastFocusProxy",WS=h.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,o=Lg(JD,n);return a.jsx(Dg,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{const c=i.relatedTarget;!o.viewport?.contains(c)&&r()}})});WS.displayName=JD;var Jf="Toast",eW="toast.swipeStart",tW="toast.swipeMove",nW="toast.swipeCancel",rW="toast.swipeEnd",ZD=h.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:o,...i}=e,[c,d]=Aa({prop:r,defaultProp:s??!0,onChange:o,caller:Jf});return a.jsx(ar,{present:n||c,children:a.jsx(oW,{open:c,...i,ref:t,onClose:()=>d(!1),onPause:Zn(e.onPause),onResume:Zn(e.onResume),onSwipeStart:We(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:We(e.onSwipeMove,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:We(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:We(e.onSwipeEnd,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),d(!1)})})})});ZD.displayName=Jf;var[aW,sW]=GD(Jf,{onClose(){}}),oW=h.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:c,onPause:d,onResume:f,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:v,onSwipeEnd:x,...j}=e,y=Lg(Jf,n),[b,S]=h.useState(null),N=Tt(t,z=>S(z)),C=h.useRef(null),k=h.useRef(null),A=s||y.duration,E=h.useRef(0),P=h.useRef(A),O=h.useRef(0),{onToastAdd:D,onToastRemove:K}=y,q=Zn(()=>{b?.contains(document.activeElement)&&y.viewport?.focus(),i()}),B=h.useCallback(z=>{!z||z===1/0||(window.clearTimeout(O.current),E.current=new Date().getTime(),O.current=window.setTimeout(q,z))},[q]);h.useEffect(()=>{const z=y.viewport;if(z){const I=()=>{B(P.current),f?.()},T=()=>{const V=new Date().getTime()-E.current;P.current=P.current-V,window.clearTimeout(O.current),d?.()};return z.addEventListener(qS,T),z.addEventListener(US,I),()=>{z.removeEventListener(qS,T),z.removeEventListener(US,I)}}},[y.viewport,A,d,f,B]),h.useEffect(()=>{o&&!y.isClosePausedRef.current&&B(A)},[o,A,y.isClosePausedRef,B]),h.useEffect(()=>(D(),()=>K()),[D,K]);const Y=h.useMemo(()=>b?o5(b):null,[b]);return y.viewport?a.jsxs(a.Fragment,{children:[Y&&a.jsx(iW,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:Y}),a.jsx(aW,{scope:n,onClose:q,children:_u.createPortal(a.jsx(iC.ItemSlot,{scope:n,children:a.jsx(F9,{asChild:!0,onEscapeKeyDown:We(c,()=>{y.isFocusedToastEscapeKeyDownRef.current||q(),y.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(lt.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":y.swipeDirection,...j,ref:N,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:We(e.onKeyDown,z=>{z.key==="Escape"&&(c?.(z.nativeEvent),z.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,q()))}),onPointerDown:We(e.onPointerDown,z=>{z.button===0&&(C.current={x:z.clientX,y:z.clientY})}),onPointerMove:We(e.onPointerMove,z=>{if(!C.current)return;const I=z.clientX-C.current.x,T=z.clientY-C.current.y,V=!!k.current,H=["left","right"].includes(y.swipeDirection),M=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,X=H?M(0,I):0,$=H?0:M(0,T),F=z.pointerType==="touch"?10:2,G={x:X,y:$},re={originalEvent:z,delta:G};V?(k.current=G,Rh(tW,p,re,{discrete:!1})):QE(G,y.swipeDirection,F)?(k.current=G,Rh(eW,m,re,{discrete:!1}),z.target.setPointerCapture(z.pointerId)):(Math.abs(I)>F||Math.abs(T)>F)&&(C.current=null)}),onPointerUp:We(e.onPointerUp,z=>{const I=k.current,T=z.target;if(T.hasPointerCapture(z.pointerId)&&T.releasePointerCapture(z.pointerId),k.current=null,C.current=null,I){const V=z.currentTarget,H={originalEvent:z,delta:I};QE(I,y.swipeDirection,y.swipeThreshold)?Rh(rW,x,H,{discrete:!0}):Rh(nW,v,H,{discrete:!0}),V.addEventListener("click",M=>M.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),iW=e=>{const{__scopeToast:t,children:n,...r}=e,s=Lg(Jf,t),[o,i]=h.useState(!1),[c,d]=h.useState(!1);return uW(()=>i(!0)),h.useEffect(()=>{const f=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(f)},[]),c?null:a.jsx(zl,{asChild:!0,children:a.jsx(Dg,{...r,children:o&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},lW="ToastTitle",e5=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(lt.div,{...r,ref:t})});e5.displayName=lW;var cW="ToastDescription",t5=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(lt.div,{...r,ref:t})});t5.displayName=cW;var n5="ToastAction",r5=h.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?a.jsx(s5,{altText:n,asChild:!0,children:a.jsx(lC,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${n5}\`. Expected non-empty \`string\`.`),null)});r5.displayName=n5;var a5="ToastClose",lC=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=sW(a5,n);return a.jsx(s5,{asChild:!0,children:a.jsx(lt.button,{type:"button",...r,ref:t,onClick:We(e.onClick,s.onClose)})})});lC.displayName=a5;var s5=h.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return a.jsx(lt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function o5(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),dW(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",o=r.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...o5(r))}}),t}function Rh(e,t,n,{discrete:r}){const s=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?sC(s,o):s.dispatchEvent(o)}var QE=(e,t,n=0)=>{const r=Math.abs(e.x),s=Math.abs(e.y),o=r>s;return t==="left"||t==="right"?o&&r>n:!o&&s>n};function uW(e=()=>{}){const t=Zn(e);pr(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function dW(e){return e.nodeType===e.ELEMENT_NODE}function fW(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Jy(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var pW=YD,i5=QD,l5=ZD,c5=e5,u5=t5,d5=r5,f5=lC;function p5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=p5(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Yt(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=p5(e))&&(r&&(r+=" "),r+=t);return r}const JE=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ZE=Yt,Bl=(e,t)=>n=>{var r;if(t?.variants==null)return ZE(e,n?.class,n?.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(f=>{const m=n?.[f],p=o?.[f];if(m===null)return null;const v=JE(m)||JE(p);return s[f][v]}),c=n&&Object.entries(n).reduce((f,m)=>{let[p,v]=m;return v===void 0||(f[p]=v),f},{}),d=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,m)=>{let{class:p,className:v,...x}=m;return Object.entries(x).every(j=>{let[y,b]=j;return Array.isArray(b)?b.includes({...o,...c}[y]):{...o,...c}[y]===b})?[...f,p,v]:f},[]);return ZE(e,i,d,n?.class,n?.className)};const hW=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),h5=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();var mW={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"};const gW=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...c},d)=>h.createElement("svg",{ref:d,...mW,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:h5("lucide",s),...c},[...i.map(([f,m])=>h.createElement(f,m)),...Array.isArray(o)?o:[o]]));const ft=(e,t)=>{const n=h.forwardRef(({className:r,...s},o)=>h.createElement(gW,{ref:o,iconNode:t,className:h5(`lucide-${hW(e)}`,r),...s}));return n.displayName=`${e}`,n};const cC=ft("Activity",[["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"}]]);const m5=ft("ArrowLeftRight",[["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"}]]);const Si=ft("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Wr=ft("Bot",[["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"}]]);const g5=ft("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);const jl=ft("ChartColumn",[["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"}]]);const Gc=ft("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const en=ft("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Fg=ft("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const Ns=ft("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const zc=ft("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);const Zy=ft("CircleAlert",[["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"}]]);const Wa=ft("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const vW=ft("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const cl=ft("CircleX",[["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"}]]);const xW=ft("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const eP=ft("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);const Ea=ft("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const Hr=ft("Copy",[["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"}]]);const v5=ft("Database",[["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"}]]);const zr=ft("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const zg=ft("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const Yc=ft("ExternalLink",[["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"}]]);const yW=ft("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const x5=ft("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const uC=ft("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);const HS=ft("FileText",[["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"}]]);const y5=ft("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);const bW=ft("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const b5=ft("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);const wW=ft("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);const jW=ft("House",[["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"}]]);const SW=ft("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const mm=ft("Layers",[["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:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);const dC=ft("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);const NW=ft("Lightbulb",[["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"}]]);const VS=ft("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);const CW=ft("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);const _r=ft("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const w5=ft("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);const _W=ft("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);const j5=ft("NotebookTabs",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M15 2v20",key:"dcj49h"}],["path",{d:"M15 7h5",key:"1xj5lc"}],["path",{d:"M15 12h5",key:"w5shd9"}],["path",{d:"M15 17h5",key:"1qaofu"}]]);const Mc=ft("NotepadText",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"16",height:"18",x:"4",y:"4",rx:"2",key:"1u9h20"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);const kW=ft("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);const KS=ft("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);const GS=ft("PanelRightOpen",[["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"}]]);const tP=ft("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);const Zf=ft("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const Cs=ft("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const Ao=ft("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const fC=ft("RectangleEllipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);const Ka=ft("RefreshCw",[["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"}]]);const AW=ft("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const pC=ft("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const EW=ft("Send",[["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"}]]);const hC=ft("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const PW=ft("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const oa=ft("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const RW=ft("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);const Kd=ft("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const mC=ft("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);const Ga=ft("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const sm=ft("TriangleAlert",[["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"}]]);const TW=ft("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);const Xc=ft("User",[["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"}]]);const S5=ft("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);const Ba=ft("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);const ua=ft("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),gC="-",OW=e=>{const t=IW(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const c=i.split(gC);return c[0]===""&&c.length!==1&&c.shift(),N5(c,t)||MW(i)},getConflictingClassGroupIds:(i,c)=>{const d=n[i]||[];return c&&r[i]?[...d,...r[i]]:d}}},N5=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?N5(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(gC);return t.validators.find(({validator:i})=>i(o))?.classGroupId},nP=/^\[(.+)\]$/,MW=e=>{if(nP.test(e)){const t=nP.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},IW=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return DW(Object.entries(e.classGroups),n).forEach(([o,i])=>{YS(i,r,o,t)}),r},YS=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:rP(t,s);o.classGroupId=n;return}if(typeof s=="function"){if($W(s)){YS(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([o,i])=>{YS(i,rP(t,o),n,r)})})},rP=(e,t)=>{let n=e;return t.split(gC).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},$W=e=>e.isThemeGetter,DW=(e,t)=>t?e.map(([n,r])=>{const s=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,c])=>[t+i,c])):o);return[n,s]}):e,LW=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return s(o,i),i},set(o,i){n.has(o)?n.set(o,i):s(o,i)}}},C5="!",FW=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],o=t.length,i=c=>{const d=[];let f=0,m=0,p;for(let b=0;b<c.length;b++){let S=c[b];if(f===0){if(S===s&&(r||c.slice(b,b+o)===t)){d.push(c.slice(m,b)),m=b+o;continue}if(S==="/"){p=b;continue}}S==="["?f++:S==="]"&&f--}const v=d.length===0?c:c.substring(m),x=v.startsWith(C5),j=x?v.substring(1):v,y=p&&p>m?p-m:void 0;return{modifiers:d,hasImportantModifier:x,baseClassName:j,maybePostfixModifierPosition:y}};return n?c=>n({className:c,parseClassName:i}):i},zW=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},BW=e=>({cache:LW(e.cacheSize),parseClassName:FW(e),...OW(e)}),qW=/\s+/,UW=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(qW);let c="";for(let d=i.length-1;d>=0;d-=1){const f=i[d],{modifiers:m,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:x}=n(f);let j=!!x,y=r(j?v.substring(0,x):v);if(!y){if(!j){c=f+(c.length>0?" "+c:c);continue}if(y=r(v),!y){c=f+(c.length>0?" "+c:c);continue}j=!1}const b=zW(m).join(":"),S=p?b+C5:b,N=S+y;if(o.includes(N))continue;o.push(N);const C=s(y,j);for(let k=0;k<C.length;++k){const A=C[k];o.push(S+A)}c=f+(c.length>0?" "+c:c)}return c};function WW(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=_5(t))&&(r&&(r+=" "),r+=n);return r}const _5=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=_5(e[r]))&&(n&&(n+=" "),n+=t);return n};function HW(e,...t){let n,r,s,o=i;function i(d){const f=t.reduce((m,p)=>p(m),e());return n=BW(f),r=n.cache.get,s=n.cache.set,o=c,c(d)}function c(d){const f=r(d);if(f)return f;const m=UW(d,n);return s(d,m),m}return function(){return o(WW.apply(null,arguments))}}const On=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},k5=/^\[(?:([a-z-]+):)?(.+)\]$/i,VW=/^\d+\/\d+$/,KW=new Set(["px","full","screen"]),GW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,YW=/\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$/,XW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,QW=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,JW=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,po=e=>Bc(e)||KW.has(e)||VW.test(e),fi=e=>ku(e,"length",oH),Bc=e=>!!e&&!Number.isNaN(Number(e)),eb=e=>ku(e,"number",Bc),Cd=e=>!!e&&Number.isInteger(Number(e)),ZW=e=>e.endsWith("%")&&Bc(e.slice(0,-1)),Jt=e=>k5.test(e),pi=e=>GW.test(e),eH=new Set(["length","size","percentage"]),tH=e=>ku(e,eH,A5),nH=e=>ku(e,"position",A5),rH=new Set(["image","url"]),aH=e=>ku(e,rH,lH),sH=e=>ku(e,"",iH),_d=()=>!0,ku=(e,t,n)=>{const r=k5.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},oH=e=>YW.test(e)&&!XW.test(e),A5=()=>!1,iH=e=>QW.test(e),lH=e=>JW.test(e),cH=()=>{const e=On("colors"),t=On("spacing"),n=On("blur"),r=On("brightness"),s=On("borderColor"),o=On("borderRadius"),i=On("borderSpacing"),c=On("borderWidth"),d=On("contrast"),f=On("grayscale"),m=On("hueRotate"),p=On("invert"),v=On("gap"),x=On("gradientColorStops"),j=On("gradientColorStopPositions"),y=On("inset"),b=On("margin"),S=On("opacity"),N=On("padding"),C=On("saturate"),k=On("scale"),A=On("sepia"),E=On("skew"),P=On("space"),O=On("translate"),D=()=>["auto","contain","none"],K=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",Jt,t],B=()=>[Jt,t],Y=()=>["",po,fi],z=()=>["auto",Bc,Jt],I=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],T=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],M=()=>["","0",Jt],X=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>[Bc,Jt];return{cacheSize:500,separator:":",theme:{colors:[_d],spacing:[po,fi],blur:["none","",pi,Jt],brightness:$(),borderColor:[e],borderRadius:["none","","full",pi,Jt],borderSpacing:B(),borderWidth:Y(),contrast:$(),grayscale:M(),hueRotate:$(),invert:M(),gap:B(),gradientColorStops:[e],gradientColorStopPositions:[ZW,fi],inset:q(),margin:q(),opacity:$(),padding:B(),saturate:$(),scale:$(),sepia:M(),skew:$(),space:B(),translate:B()},classGroups:{aspect:[{aspect:["auto","square","video",Jt]}],container:["container"],columns:[{columns:[pi]}],"break-after":[{"break-after":X()}],"break-before":[{"break-before":X()}],"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"],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:[...I(),Jt]}],overflow:[{overflow:K()}],"overflow-x":[{"overflow-x":K()}],"overflow-y":[{"overflow-y":K()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Cd,Jt]}],basis:[{basis:q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Jt]}],grow:[{grow:M()}],shrink:[{shrink:M()}],order:[{order:["first","last","none",Cd,Jt]}],"grid-cols":[{"grid-cols":[_d]}],"col-start-end":[{col:["auto",{span:["full",Cd,Jt]},Jt]}],"col-start":[{"col-start":z()}],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":[_d]}],"row-start-end":[{row:["auto",{span:[Cd,Jt]},Jt]}],"row-start":[{"row-start":z()}],"row-end":[{"row-end":z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Jt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Jt]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Jt,t]}],"min-w":[{"min-w":[Jt,t,"min","max","fit"]}],"max-w":[{"max-w":[Jt,t,"none","full","min","max","fit","prose",{screen:[pi]},pi]}],h:[{h:[Jt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Jt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Jt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Jt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",pi,fi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",eb]}],"font-family":[{font:[_d]}],"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:["tighter","tight","normal","wide","wider","widest",Jt]}],"line-clamp":[{"line-clamp":["none",Bc,eb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",po,Jt]}],"list-image":[{"list-image":["none",Jt]}],"list-style-type":[{list:["none","disc","decimal",Jt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[S]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[S]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...T(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",po,fi]}],"underline-offset":[{"underline-offset":["auto",po,Jt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Jt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Jt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[S]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...I(),nH]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tH]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},aH]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[j]}],"gradient-via-pos":[{via:[j]}],"gradient-to-pos":[{to:[j]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[S]}],"border-style":[{border:[...T(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[S]}],"divide-style":[{divide:T()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...T()]}],"outline-offset":[{"outline-offset":[po,Jt]}],"outline-w":[{outline:[po,fi]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[S]}],"ring-offset-w":[{"ring-offset":[po,fi]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",pi,sH]}],"shadow-color":[{shadow:[_d]}],opacity:[{opacity:[S]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",pi,Jt]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[p]}],saturate:[{saturate:[C]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[S]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[A]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Jt]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",Jt]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",Jt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[Cd,Jt]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Jt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",Jt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"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",Jt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[po,fi,eb]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"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-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-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"],"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"]}}},uH=HW(cH);function $e(...e){return uH(Yt(e))}function Hn(e,t=""){return typeof e=="string"&&e.trim().length>0?e.trim():t}const dH=pW,E5=h.forwardRef(({className:e,...t},n)=>a.jsx(i5,{ref:n,className:$e("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));E5.displayName=i5.displayName;const fH=Bl("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),P5=h.forwardRef(({className:e,variant:t,...n},r)=>a.jsx(l5,{ref:r,className:$e(fH({variant:t}),e),...n}));P5.displayName=l5.displayName;const pH=h.forwardRef(({className:e,...t},n)=>a.jsx(d5,{ref:n,className:$e("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));pH.displayName=d5.displayName;const R5=h.forwardRef(({className:e,...t},n)=>a.jsx(f5,{ref:n,className:$e("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:a.jsx(ua,{className:"h-4 w-4"})}));R5.displayName=f5.displayName;const T5=h.forwardRef(({className:e,...t},n)=>a.jsx(c5,{ref:n,className:$e("text-sm font-semibold",e),...t}));T5.displayName=c5.displayName;const O5=h.forwardRef(({className:e,...t},n)=>a.jsx(u5,{ref:n,className:$e("text-sm opacity-90",e),...t}));O5.displayName=u5.displayName;function hH(){const{toasts:e}=v9();return a.jsxs(dH,{children:[e.map(function({id:t,title:n,description:r,action:s,...o}){return a.jsxs(P5,{...o,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(T5,{children:n}),r&&a.jsx(O5,{children:r})]}),s,a.jsx(R5,{})]},t)}),a.jsx(E5,{})]})}var aP=["light","dark"],mH="(prefers-color-scheme: dark)",gH=h.createContext(void 0),vH={setTheme:e=>{},themes:[]},xH=()=>{var e;return(e=h.useContext(gH))!=null?e:vH};h.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:o,value:i,attrs:c,nonce:d})=>{let f=o==="system",m=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${c.map(j=>`'${j}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,p=s?aP.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",v=(j,y=!1,b=!0)=>{let S=i?i[j]:j,N=y?j+"|| ''":`'${S}'`,C="";return s&&b&&!y&&aP.includes(j)&&(C+=`d.style.colorScheme = '${j}';`),n==="class"?y||S?C+=`c.add(${N})`:C+="null":S&&(C+=`d[s](n,${N})`),C},x=e?`!function(){${m}${v(e)}}()`:r?`!function(){try{${m}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${f})){var t='${mH}',m=window.matchMedia(t);if(m.media!==t||m.matches){${v("dark")}}else{${v("light")}}}else if(e){${i?`var x=${JSON.stringify(i)};`:""}${v(i?"x[e]":"e",!0)}}${f?"":"else{"+v(o,!1,!1)+"}"}${p}}catch(e){}}()`:`!function(){try{${m}var e=localStorage.getItem('${t}');if(e){${i?`var x=${JSON.stringify(i)};`:""}${v(i?"x[e]":"e",!0)}}else{${v(o,!1,!1)};}${p}}catch(t){}}();`;return h.createElement("script",{nonce:d,dangerouslySetInnerHTML:{__html:x}})});var yH=e=>{switch(e){case"success":return jH;case"info":return NH;case"warning":return SH;case"error":return CH;default:return null}},bH=Array(12).fill(0),wH=({visible:e,className:t})=>Q.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Q.createElement("div",{className:"sonner-spinner"},bH.map((n,r)=>Q.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),jH=Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Q.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),SH=Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Q.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),NH=Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Q.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),CH=Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Q.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),_H=Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Q.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Q.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),kH=()=>{let[e,t]=Q.useState(document.hidden);return Q.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},XS=1,AH=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,s=typeof e?.id=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:XS++,o=this.toasts.find(c=>c.id===s),i=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(c=>c.id===s?(this.publish({...c,...e,id:s,title:n}),{...c,...e,id:s,dismissible:i,title:n}):c):this.addToast({title:n,...r,dismissible:i,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),s=n!==void 0,o,i=r.then(async d=>{if(o=["resolve",d],Q.isValidElement(d))s=!1,this.create({id:n,type:"default",message:d});else if(PH(d)&&!d.ok){s=!1;let f=typeof t.error=="function"?await t.error(`HTTP error! status: ${d.status}`):t.error,m=typeof t.description=="function"?await t.description(`HTTP error! status: ${d.status}`):t.description;this.create({id:n,type:"error",message:f,description:m})}else if(t.success!==void 0){s=!1;let f=typeof t.success=="function"?await t.success(d):t.success,m=typeof t.description=="function"?await t.description(d):t.description;this.create({id:n,type:"success",message:f,description:m})}}).catch(async d=>{if(o=["reject",d],t.error!==void 0){s=!1;let f=typeof t.error=="function"?await t.error(d):t.error,m=typeof t.description=="function"?await t.description(d):t.description;this.create({id:n,type:"error",message:f,description:m})}}).finally(()=>{var d;s&&(this.dismiss(n),n=void 0),(d=t.finally)==null||d.call(t)}),c=()=>new Promise((d,f)=>i.then(()=>o[0]==="reject"?f(o[1]):d(o[1])).catch(f));return typeof n!="string"&&typeof n!="number"?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(e,t)=>{let n=t?.id||XS++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},ra=new AH,EH=(e,t)=>{let n=t?.id||XS++;return ra.addToast({title:e,...t,id:n}),n},PH=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",RH=EH,TH=()=>ra.toasts,OH=()=>ra.getActiveToasts();Object.assign(RH,{success:ra.success,info:ra.info,warning:ra.warning,error:ra.error,custom:ra.custom,message:ra.message,promise:ra.promise,dismiss:ra.dismiss,loading:ra.loading},{getHistory:TH,getToasts:OH});function MH(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}MH(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
9
+ `);function Th(e){return e.label!==void 0}var IH=3,$H="32px",DH="16px",sP=4e3,LH=356,FH=14,zH=20,BH=200;function ms(...e){return e.filter(Boolean).join(" ")}function qH(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var UH=e=>{var t,n,r,s,o,i,c,d,f,m,p;let{invert:v,toast:x,unstyled:j,interacting:y,setHeights:b,visibleToasts:S,heights:N,index:C,toasts:k,expanded:A,removeToast:E,defaultRichColors:P,closeButton:O,style:D,cancelButtonStyle:K,actionButtonStyle:q,className:B="",descriptionClassName:Y="",duration:z,position:I,gap:T,loadingIcon:V,expandByDefault:H,classNames:M,icons:X,closeButtonAriaLabel:$="Close toast",pauseWhenPageIsHidden:F}=e,[G,re]=Q.useState(null),[oe,ue]=Q.useState(null),[ae,ye]=Q.useState(!1),[se,de]=Q.useState(!1),[De,ge]=Q.useState(!1),[ve,Se]=Q.useState(!1),[at,tt]=Q.useState(!1),[it,kt]=Q.useState(0),[Ye,_e]=Q.useState(0),Ee=Q.useRef(x.duration||z||sP),Ze=Q.useRef(null),pt=Q.useRef(null),Lt=C===0,Ut=C+1<=S,Nt=x.type,an=x.dismissible!==!1,on=x.className||"",zt=x.descriptionClassName||"",sn=Q.useMemo(()=>N.findIndex(xe=>xe.toastId===x.id)||0,[N,x.id]),nn=Q.useMemo(()=>{var xe;return(xe=x.closeButton)!=null?xe:O},[x.closeButton,O]),Re=Q.useMemo(()=>x.duration||z||sP,[x.duration,z]),Be=Q.useRef(0),qe=Q.useRef(0),Bt=Q.useRef(0),Wt=Q.useRef(null),[yt,fe]=I.split("-"),Ie=Q.useMemo(()=>N.reduce((xe,be,we)=>we>=sn?xe:xe+be.height,0),[N,sn]),Ge=kH(),U=x.invert||v,le=Nt==="loading";qe.current=Q.useMemo(()=>sn*T+Ie,[sn,Ie]),Q.useEffect(()=>{Ee.current=Re},[Re]),Q.useEffect(()=>{ye(!0)},[]),Q.useEffect(()=>{let xe=pt.current;if(xe){let be=xe.getBoundingClientRect().height;return _e(be),b(we=>[{toastId:x.id,height:be,position:x.position},...we]),()=>b(we=>we.filter(W=>W.toastId!==x.id))}},[b,x.id]),Q.useLayoutEffect(()=>{if(!ae)return;let xe=pt.current,be=xe.style.height;xe.style.height="auto";let we=xe.getBoundingClientRect().height;xe.style.height=be,_e(we),b(W=>W.find(he=>he.toastId===x.id)?W.map(he=>he.toastId===x.id?{...he,height:we}:he):[{toastId:x.id,height:we,position:x.position},...W])},[ae,x.title,x.description,b,x.id]);let pe=Q.useCallback(()=>{de(!0),kt(qe.current),b(xe=>xe.filter(be=>be.toastId!==x.id)),setTimeout(()=>{E(x)},BH)},[x,E,b,qe]);Q.useEffect(()=>{if(x.promise&&Nt==="loading"||x.duration===1/0||x.type==="loading")return;let xe;return A||y||F&&Ge?(()=>{if(Bt.current<Be.current){let be=new Date().getTime()-Be.current;Ee.current=Ee.current-be}Bt.current=new Date().getTime()})():Ee.current!==1/0&&(Be.current=new Date().getTime(),xe=setTimeout(()=>{var be;(be=x.onAutoClose)==null||be.call(x,x),pe()},Ee.current)),()=>clearTimeout(xe)},[A,y,x,Nt,F,Ge,pe]),Q.useEffect(()=>{x.delete&&pe()},[pe,x.delete]);function J(){var xe,be,we;return X!=null&&X.loading?Q.createElement("div",{className:ms(M?.loader,(xe=x?.classNames)==null?void 0:xe.loader,"sonner-loader"),"data-visible":Nt==="loading"},X.loading):V?Q.createElement("div",{className:ms(M?.loader,(be=x?.classNames)==null?void 0:be.loader,"sonner-loader"),"data-visible":Nt==="loading"},V):Q.createElement(wH,{className:ms(M?.loader,(we=x?.classNames)==null?void 0:we.loader),visible:Nt==="loading"})}return Q.createElement("li",{tabIndex:0,ref:pt,className:ms(B,on,M?.toast,(t=x?.classNames)==null?void 0:t.toast,M?.default,M?.[Nt],(n=x?.classNames)==null?void 0:n[Nt]),"data-sonner-toast":"","data-rich-colors":(r=x.richColors)!=null?r:P,"data-styled":!(x.jsx||x.unstyled||j),"data-mounted":ae,"data-promise":!!x.promise,"data-swiped":at,"data-removed":se,"data-visible":Ut,"data-y-position":yt,"data-x-position":fe,"data-index":C,"data-front":Lt,"data-swiping":De,"data-dismissible":an,"data-type":Nt,"data-invert":U,"data-swipe-out":ve,"data-swipe-direction":oe,"data-expanded":!!(A||H&&ae),style:{"--index":C,"--toasts-before":C,"--z-index":k.length-C,"--offset":`${se?it:qe.current}px`,"--initial-height":H?"auto":`${Ye}px`,...D,...x.style},onDragEnd:()=>{ge(!1),re(null),Wt.current=null},onPointerDown:xe=>{le||!an||(Ze.current=new Date,kt(qe.current),xe.target.setPointerCapture(xe.pointerId),xe.target.tagName!=="BUTTON"&&(ge(!0),Wt.current={x:xe.clientX,y:xe.clientY}))},onPointerUp:()=>{var xe,be,we,W;if(ve||!an)return;Wt.current=null;let he=Number(((xe=pt.current)==null?void 0:xe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ke=Number(((be=pt.current)==null?void 0:be.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ve=new Date().getTime()-((we=Ze.current)==null?void 0:we.getTime()),ee=G==="x"?he:ke,Le=Math.abs(ee)/Ve;if(Math.abs(ee)>=zH||Le>.11){kt(qe.current),(W=x.onDismiss)==null||W.call(x,x),ue(G==="x"?he>0?"right":"left":ke>0?"down":"up"),pe(),Se(!0),tt(!1);return}ge(!1),re(null)},onPointerMove:xe=>{var be,we,W,he;if(!Wt.current||!an||((be=window.getSelection())==null?void 0:be.toString().length)>0)return;let ke=xe.clientY-Wt.current.y,Ve=xe.clientX-Wt.current.x,ee=(we=e.swipeDirections)!=null?we:qH(I);!G&&(Math.abs(Ve)>1||Math.abs(ke)>1)&&re(Math.abs(Ve)>Math.abs(ke)?"x":"y");let Le={x:0,y:0};G==="y"?(ee.includes("top")||ee.includes("bottom"))&&(ee.includes("top")&&ke<0||ee.includes("bottom")&&ke>0)&&(Le.y=ke):G==="x"&&(ee.includes("left")||ee.includes("right"))&&(ee.includes("left")&&Ve<0||ee.includes("right")&&Ve>0)&&(Le.x=Ve),(Math.abs(Le.x)>0||Math.abs(Le.y)>0)&&tt(!0),(W=pt.current)==null||W.style.setProperty("--swipe-amount-x",`${Le.x}px`),(he=pt.current)==null||he.style.setProperty("--swipe-amount-y",`${Le.y}px`)}},nn&&!x.jsx?Q.createElement("button",{"aria-label":$,"data-disabled":le,"data-close-button":!0,onClick:le||!an?()=>{}:()=>{var xe;pe(),(xe=x.onDismiss)==null||xe.call(x,x)},className:ms(M?.closeButton,(s=x?.classNames)==null?void 0:s.closeButton)},(o=X?.close)!=null?o:_H):null,x.jsx||h.isValidElement(x.title)?x.jsx?x.jsx:typeof x.title=="function"?x.title():x.title:Q.createElement(Q.Fragment,null,Nt||x.icon||x.promise?Q.createElement("div",{"data-icon":"",className:ms(M?.icon,(i=x?.classNames)==null?void 0:i.icon)},x.promise||x.type==="loading"&&!x.icon?x.icon||J():null,x.type!=="loading"?x.icon||X?.[Nt]||yH(Nt):null):null,Q.createElement("div",{"data-content":"",className:ms(M?.content,(c=x?.classNames)==null?void 0:c.content)},Q.createElement("div",{"data-title":"",className:ms(M?.title,(d=x?.classNames)==null?void 0:d.title)},typeof x.title=="function"?x.title():x.title),x.description?Q.createElement("div",{"data-description":"",className:ms(Y,zt,M?.description,(f=x?.classNames)==null?void 0:f.description)},typeof x.description=="function"?x.description():x.description):null),h.isValidElement(x.cancel)?x.cancel:x.cancel&&Th(x.cancel)?Q.createElement("button",{"data-button":!0,"data-cancel":!0,style:x.cancelButtonStyle||K,onClick:xe=>{var be,we;Th(x.cancel)&&an&&((we=(be=x.cancel).onClick)==null||we.call(be,xe),pe())},className:ms(M?.cancelButton,(m=x?.classNames)==null?void 0:m.cancelButton)},x.cancel.label):null,h.isValidElement(x.action)?x.action:x.action&&Th(x.action)?Q.createElement("button",{"data-button":!0,"data-action":!0,style:x.actionButtonStyle||q,onClick:xe=>{var be,we;Th(x.action)&&((we=(be=x.action).onClick)==null||we.call(be,xe),!xe.defaultPrevented&&pe())},className:ms(M?.actionButton,(p=x?.classNames)==null?void 0:p.actionButton)},x.action.label):null))};function oP(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function WH(e,t){let n={};return[e,t].forEach((r,s)=>{let o=s===1,i=o?"--mobile-offset":"--offset",c=o?DH:$H;function d(f){["top","right","bottom","left"].forEach(m=>{n[`${i}-${m}`]=typeof f=="number"?`${f}px`:f})}typeof r=="number"||typeof r=="string"?d(r):typeof r=="object"?["top","right","bottom","left"].forEach(f=>{r[f]===void 0?n[`${i}-${f}`]=c:n[`${i}-${f}`]=typeof r[f]=="number"?`${r[f]}px`:r[f]}):d(c)}),n}var HH=h.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:s=["altKey","KeyT"],expand:o,closeButton:i,className:c,offset:d,mobileOffset:f,theme:m="light",richColors:p,duration:v,style:x,visibleToasts:j=IH,toastOptions:y,dir:b=oP(),gap:S=FH,loadingIcon:N,icons:C,containerAriaLabel:k="Notifications",pauseWhenPageIsHidden:A}=e,[E,P]=Q.useState([]),O=Q.useMemo(()=>Array.from(new Set([r].concat(E.filter(F=>F.position).map(F=>F.position)))),[E,r]),[D,K]=Q.useState([]),[q,B]=Q.useState(!1),[Y,z]=Q.useState(!1),[I,T]=Q.useState(m!=="system"?m:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=Q.useRef(null),H=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=Q.useRef(null),X=Q.useRef(!1),$=Q.useCallback(F=>{P(G=>{var re;return(re=G.find(oe=>oe.id===F.id))!=null&&re.delete||ra.dismiss(F.id),G.filter(({id:oe})=>oe!==F.id)})},[]);return Q.useEffect(()=>ra.subscribe(F=>{if(F.dismiss){P(G=>G.map(re=>re.id===F.id?{...re,delete:!0}:re));return}setTimeout(()=>{UD.flushSync(()=>{P(G=>{let re=G.findIndex(oe=>oe.id===F.id);return re!==-1?[...G.slice(0,re),{...G[re],...F},...G.slice(re+1)]:[F,...G]})})})}),[]),Q.useEffect(()=>{if(m!=="system"){T(m);return}if(m==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?T("dark"):T("light")),typeof window>"u")return;let F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:G})=>{T(G?"dark":"light")})}catch{F.addListener(({matches:re})=>{try{T(re?"dark":"light")}catch(oe){console.error(oe)}})}},[m]),Q.useEffect(()=>{E.length<=1&&B(!1)},[E]),Q.useEffect(()=>{let F=G=>{var re,oe;s.every(ue=>G[ue]||G.code===ue)&&(B(!0),(re=V.current)==null||re.focus()),G.code==="Escape"&&(document.activeElement===V.current||(oe=V.current)!=null&&oe.contains(document.activeElement))&&B(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[s]),Q.useEffect(()=>{if(V.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,X.current=!1)}},[V.current]),Q.createElement("section",{ref:t,"aria-label":`${k} ${H}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},O.map((F,G)=>{var re;let[oe,ue]=F.split("-");return E.length?Q.createElement("ol",{key:F,dir:b==="auto"?oP():b,tabIndex:-1,ref:V,className:c,"data-sonner-toaster":!0,"data-theme":I,"data-y-position":oe,"data-lifted":q&&E.length>1&&!o,"data-x-position":ue,style:{"--front-toast-height":`${((re=D[0])==null?void 0:re.height)||0}px`,"--width":`${LH}px`,"--gap":`${S}px`,...x,...WH(d,f)},onBlur:ae=>{X.current&&!ae.currentTarget.contains(ae.relatedTarget)&&(X.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:ae=>{ae.target instanceof HTMLElement&&ae.target.dataset.dismissible==="false"||X.current||(X.current=!0,M.current=ae.relatedTarget)},onMouseEnter:()=>B(!0),onMouseMove:()=>B(!0),onMouseLeave:()=>{Y||B(!1)},onDragEnd:()=>B(!1),onPointerDown:ae=>{ae.target instanceof HTMLElement&&ae.target.dataset.dismissible==="false"||z(!0)},onPointerUp:()=>z(!1)},E.filter(ae=>!ae.position&&G===0||ae.position===F).map((ae,ye)=>{var se,de;return Q.createElement(UH,{key:ae.id,icons:C,index:ye,toast:ae,defaultRichColors:p,duration:(se=y?.duration)!=null?se:v,className:y?.className,descriptionClassName:y?.descriptionClassName,invert:n,visibleToasts:j,closeButton:(de=y?.closeButton)!=null?de:i,interacting:Y,position:F,style:y?.style,unstyled:y?.unstyled,classNames:y?.classNames,cancelButtonStyle:y?.cancelButtonStyle,actionButtonStyle:y?.actionButtonStyle,removeToast:$,toasts:E.filter(De=>De.position==ae.position),heights:D.filter(De=>De.position==ae.position),setHeights:K,expandByDefault:o,gap:S,loadingIcon:N,expanded:q,pauseWhenPageIsHidden:A,swipeDirections:e.swipeDirections})})):null}))});const VH=({...e})=>{const{theme:t="system"}=xH();return a.jsx(HH,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};var KH=aC[" useId ".trim().toString()]||(()=>{}),GH=0;function fr(e){const[t,n]=h.useState(KH());return pr(()=>{n(r=>r??String(GH++))},[e]),e||(t?`radix-${t}`:"")}const YH=["top","right","bottom","left"],Ni=Math.min,wa=Math.max,gm=Math.round,Oh=Math.floor,Us=e=>({x:e,y:e}),XH={left:"right",right:"left",bottom:"top",top:"bottom"},QH={start:"end",end:"start"};function QS(e,t,n){return wa(e,Ni(t,n))}function Eo(e,t){return typeof e=="function"?e(t):e}function Po(e){return e.split("-")[0]}function Au(e){return e.split("-")[1]}function vC(e){return e==="x"?"y":"x"}function xC(e){return e==="y"?"height":"width"}const JH=new Set(["top","bottom"]);function Bs(e){return JH.has(Po(e))?"y":"x"}function yC(e){return vC(Bs(e))}function ZH(e,t,n){n===void 0&&(n=!1);const r=Au(e),s=yC(e),o=xC(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=vm(i)),[i,vm(i)]}function eV(e){const t=vm(e);return[JS(e),t,JS(t)]}function JS(e){return e.replace(/start|end/g,t=>QH[t])}const iP=["left","right"],lP=["right","left"],tV=["top","bottom"],nV=["bottom","top"];function rV(e,t,n){switch(e){case"top":case"bottom":return n?t?lP:iP:t?iP:lP;case"left":case"right":return t?tV:nV;default:return[]}}function aV(e,t,n,r){const s=Au(e);let o=rV(Po(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(JS)))),o}function vm(e){return e.replace(/left|right|bottom|top/g,t=>XH[t])}function sV(e){return{top:0,right:0,bottom:0,left:0,...e}}function M5(e){return typeof e!="number"?sV(e):{top:e,right:e,bottom:e,left:e}}function xm(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function cP(e,t,n){let{reference:r,floating:s}=e;const o=Bs(t),i=yC(t),c=xC(i),d=Po(t),f=o==="y",m=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,v=r[c]/2-s[c]/2;let x;switch(d){case"top":x={x:m,y:r.y-s.height};break;case"bottom":x={x:m,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:p};break;case"left":x={x:r.x-s.width,y:p};break;default:x={x:r.x,y:r.y}}switch(Au(t)){case"start":x[i]-=v*(n&&f?-1:1);break;case"end":x[i]+=v*(n&&f?-1:1);break}return x}async function oV(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:c,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:m="viewport",elementContext:p="floating",altBoundary:v=!1,padding:x=0}=Eo(t,e),j=M5(x),b=c[v?p==="floating"?"reference":"floating":p],S=xm(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(b)))==null||n?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:f,rootBoundary:m,strategy:d})),N=p==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),k=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},A=xm(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:N,offsetParent:C,strategy:d}):N);return{top:(S.top-A.top+j.top)/k.y,bottom:(A.bottom-S.bottom+j.bottom)/k.y,left:(S.left-A.left+j.left)/k.x,right:(A.right-S.right+j.right)/k.x}}const iV=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,c=o.filter(Boolean),d=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:m,y:p}=cP(f,r,d),v=r,x={},j=0;for(let b=0;b<c.length;b++){var y;const{name:S,fn:N}=c[b],{x:C,y:k,data:A,reset:E}=await N({x:m,y:p,initialPlacement:r,placement:v,strategy:s,middlewareData:x,rects:f,platform:{...i,detectOverflow:(y=i.detectOverflow)!=null?y:oV},elements:{reference:e,floating:t}});m=C??m,p=k??p,x={...x,[S]:{...x[S],...A}},E&&j<=50&&(j++,typeof E=="object"&&(E.placement&&(v=E.placement),E.rects&&(f=E.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):E.rects),{x:m,y:p}=cP(f,v,d)),b=-1)}return{x:m,y:p,placement:v,strategy:s,middlewareData:x}},lV=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:c,middlewareData:d}=t,{element:f,padding:m=0}=Eo(e,t)||{};if(f==null)return{};const p=M5(m),v={x:n,y:r},x=yC(s),j=xC(x),y=await i.getDimensions(f),b=x==="y",S=b?"top":"left",N=b?"bottom":"right",C=b?"clientHeight":"clientWidth",k=o.reference[j]+o.reference[x]-v[x]-o.floating[j],A=v[x]-o.reference[x],E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(f));let P=E?E[C]:0;(!P||!await(i.isElement==null?void 0:i.isElement(E)))&&(P=c.floating[C]||o.floating[j]);const O=k/2-A/2,D=P/2-y[j]/2-1,K=Ni(p[S],D),q=Ni(p[N],D),B=K,Y=P-y[j]-q,z=P/2-y[j]/2+O,I=QS(B,z,Y),T=!d.arrow&&Au(s)!=null&&z!==I&&o.reference[j]/2-(z<B?K:q)-y[j]/2<0,V=T?z<B?z-B:z-Y:0;return{[x]:v[x]+V,data:{[x]:I,centerOffset:z-I-V,...T&&{alignmentOffset:V}},reset:T}}}),cV=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:c,platform:d,elements:f}=t,{mainAxis:m=!0,crossAxis:p=!0,fallbackPlacements:v,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:y=!0,...b}=Eo(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const S=Po(s),N=Bs(c),C=Po(c)===c,k=await(d.isRTL==null?void 0:d.isRTL(f.floating)),A=v||(C||!y?[vm(c)]:eV(c)),E=j!=="none";!v&&E&&A.push(...aV(c,y,j,k));const P=[c,...A],O=await d.detectOverflow(t,b),D=[];let K=((r=o.flip)==null?void 0:r.overflows)||[];if(m&&D.push(O[S]),p){const z=ZH(s,i,k);D.push(O[z[0]],O[z[1]])}if(K=[...K,{placement:s,overflows:D}],!D.every(z=>z<=0)){var q,B;const z=(((q=o.flip)==null?void 0:q.index)||0)+1,I=P[z];if(I&&(!(p==="alignment"?N!==Bs(I):!1)||K.every(H=>Bs(H.placement)===N?H.overflows[0]>0:!0)))return{data:{index:z,overflows:K},reset:{placement:I}};let T=(B=K.filter(V=>V.overflows[0]<=0).sort((V,H)=>V.overflows[1]-H.overflows[1])[0])==null?void 0:B.placement;if(!T)switch(x){case"bestFit":{var Y;const V=(Y=K.filter(H=>{if(E){const M=Bs(H.placement);return M===N||M==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(M=>M>0).reduce((M,X)=>M+X,0)]).sort((H,M)=>H[1]-M[1])[0])==null?void 0:Y[0];V&&(T=V);break}case"initialPlacement":T=c;break}if(s!==T)return{reset:{placement:T}}}return{}}}};function uP(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function dP(e){return YH.some(t=>e[t]>=0)}const uV=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=Eo(e,t);switch(s){case"referenceHidden":{const i=await r.detectOverflow(t,{...o,elementContext:"reference"}),c=uP(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:dP(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...o,altBoundary:!0}),c=uP(i,n.floating);return{data:{escapedOffsets:c,escaped:dP(c)}}}default:return{}}}}},I5=new Set(["left","top"]);async function dV(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=Po(n),c=Au(n),d=Bs(n)==="y",f=I5.has(i)?-1:1,m=o&&d?-1:1,p=Eo(t,e);let{mainAxis:v,crossAxis:x,alignmentAxis:j}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof j=="number"&&(x=c==="end"?j*-1:j),d?{x:x*m,y:v*f}:{x:v*f,y:x*m}}const fV=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:c}=t,d=await dV(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:s+d.x,y:o+d.y,data:{...d,placement:i}}}}},pV=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:d={fn:S=>{let{x:N,y:C}=S;return{x:N,y:C}}},...f}=Eo(e,t),m={x:n,y:r},p=await o.detectOverflow(t,f),v=Bs(Po(s)),x=vC(v);let j=m[x],y=m[v];if(i){const S=x==="y"?"top":"left",N=x==="y"?"bottom":"right",C=j+p[S],k=j-p[N];j=QS(C,j,k)}if(c){const S=v==="y"?"top":"left",N=v==="y"?"bottom":"right",C=y+p[S],k=y-p[N];y=QS(C,y,k)}const b=d.fn({...t,[x]:j,[v]:y});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[x]:i,[v]:c}}}}}},hV=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:c=0,mainAxis:d=!0,crossAxis:f=!0}=Eo(e,t),m={x:n,y:r},p=Bs(s),v=vC(p);let x=m[v],j=m[p];const y=Eo(c,t),b=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(d){const C=v==="y"?"height":"width",k=o.reference[v]-o.floating[C]+b.mainAxis,A=o.reference[v]+o.reference[C]-b.mainAxis;x<k?x=k:x>A&&(x=A)}if(f){var S,N;const C=v==="y"?"width":"height",k=I5.has(Po(s)),A=o.reference[p]-o.floating[C]+(k&&((S=i.offset)==null?void 0:S[p])||0)+(k?0:b.crossAxis),E=o.reference[p]+o.reference[C]+(k?0:((N=i.offset)==null?void 0:N[p])||0)-(k?b.crossAxis:0);j<A?j=A:j>E&&(j=E)}return{[v]:x,[p]:j}}}},mV=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:c}=t,{apply:d=()=>{},...f}=Eo(e,t),m=await i.detectOverflow(t,f),p=Po(s),v=Au(s),x=Bs(s)==="y",{width:j,height:y}=o.floating;let b,S;p==="top"||p==="bottom"?(b=p,S=v===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(S=p,b=v==="end"?"top":"bottom");const N=y-m.top-m.bottom,C=j-m.left-m.right,k=Ni(y-m[b],N),A=Ni(j-m[S],C),E=!t.middlewareData.shift;let P=k,O=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=C),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=N),E&&!v){const K=wa(m.left,0),q=wa(m.right,0),B=wa(m.top,0),Y=wa(m.bottom,0);x?O=j-2*(K!==0||q!==0?K+q:wa(m.left,m.right)):P=y-2*(B!==0||Y!==0?B+Y:wa(m.top,m.bottom))}await d({...t,availableWidth:O,availableHeight:P});const D=await i.getDimensions(c.floating);return j!==D.width||y!==D.height?{reset:{rects:!0}}:{}}}};function Bg(){return typeof window<"u"}function Eu(e){return $5(e)?(e.nodeName||"").toLowerCase():"#document"}function Ca(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qs(e){var t;return(t=($5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $5(e){return Bg()?e instanceof Node||e instanceof Ca(e).Node:!1}function ks(e){return Bg()?e instanceof Element||e instanceof Ca(e).Element:!1}function Ks(e){return Bg()?e instanceof HTMLElement||e instanceof Ca(e).HTMLElement:!1}function fP(e){return!Bg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ca(e).ShadowRoot}const gV=new Set(["inline","contents"]);function ep(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=As(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!gV.has(s)}const vV=new Set(["table","td","th"]);function xV(e){return vV.has(Eu(e))}const yV=[":popover-open",":modal"];function qg(e){return yV.some(t=>{try{return e.matches(t)}catch{return!1}})}const bV=["transform","translate","scale","rotate","perspective"],wV=["transform","translate","scale","rotate","perspective","filter"],jV=["paint","layout","strict","content"];function bC(e){const t=wC(),n=ks(e)?As(e):e;return bV.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||wV.some(r=>(n.willChange||"").includes(r))||jV.some(r=>(n.contain||"").includes(r))}function SV(e){let t=Ci(e);for(;Ks(t)&&!Qc(t);){if(bC(t))return t;if(qg(t))return null;t=Ci(t)}return null}function wC(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const NV=new Set(["html","body","#document"]);function Qc(e){return NV.has(Eu(e))}function As(e){return Ca(e).getComputedStyle(e)}function Ug(e){return ks(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ci(e){if(Eu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fP(e)&&e.host||Qs(e);return fP(t)?t.host:t}function D5(e){const t=Ci(e);return Qc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ks(t)&&ep(t)?t:D5(t)}function af(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=D5(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Ca(s);if(o){const c=ZS(i);return t.concat(i,i.visualViewport||[],ep(s)?s:[],c&&n?af(c):[])}return t.concat(s,af(s,[],n))}function ZS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function L5(e){const t=As(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ks(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,c=gm(n)!==o||gm(r)!==i;return c&&(n=o,r=i),{width:n,height:r,$:c}}function jC(e){return ks(e)?e:e.contextElement}function qc(e){const t=jC(e);if(!Ks(t))return Us(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=L5(t);let i=(o?gm(n.width):n.width)/r,c=(o?gm(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const CV=Us(0);function F5(e){const t=Ca(e);return!wC()||!t.visualViewport?CV:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _V(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ca(e)?!1:t}function Sl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=jC(e);let i=Us(1);t&&(r?ks(r)&&(i=qc(r)):i=qc(e));const c=_V(o,n,r)?F5(o):Us(0);let d=(s.left+c.x)/i.x,f=(s.top+c.y)/i.y,m=s.width/i.x,p=s.height/i.y;if(o){const v=Ca(o),x=r&&ks(r)?Ca(r):r;let j=v,y=ZS(j);for(;y&&r&&x!==j;){const b=qc(y),S=y.getBoundingClientRect(),N=As(y),C=S.left+(y.clientLeft+parseFloat(N.paddingLeft))*b.x,k=S.top+(y.clientTop+parseFloat(N.paddingTop))*b.y;d*=b.x,f*=b.y,m*=b.x,p*=b.y,d+=C,f+=k,j=Ca(y),y=ZS(j)}}return xm({width:m,height:p,x:d,y:f})}function Wg(e,t){const n=Ug(e).scrollLeft;return t?t.left+n:Sl(Qs(e)).left+n}function z5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Wg(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function kV(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=Qs(r),c=t?qg(t.floating):!1;if(r===i||c&&o)return n;let d={scrollLeft:0,scrollTop:0},f=Us(1);const m=Us(0),p=Ks(r);if((p||!p&&!o)&&((Eu(r)!=="body"||ep(i))&&(d=Ug(r)),Ks(r))){const x=Sl(r);f=qc(r),m.x=x.x+r.clientLeft,m.y=x.y+r.clientTop}const v=i&&!p&&!o?z5(i,d):Us(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+m.x+v.x,y:n.y*f.y-d.scrollTop*f.y+m.y+v.y}}function AV(e){return Array.from(e.getClientRects())}function EV(e){const t=Qs(e),n=Ug(e),r=e.ownerDocument.body,s=wa(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=wa(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Wg(e);const c=-n.scrollTop;return As(r).direction==="rtl"&&(i+=wa(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:c}}const pP=25;function PV(e,t){const n=Ca(e),r=Qs(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,c=0,d=0;if(s){o=s.width,i=s.height;const m=wC();(!m||m&&t==="fixed")&&(c=s.offsetLeft,d=s.offsetTop)}const f=Wg(r);if(f<=0){const m=r.ownerDocument,p=m.body,v=getComputedStyle(p),x=m.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,j=Math.abs(r.clientWidth-p.clientWidth-x);j<=pP&&(o-=j)}else f<=pP&&(o+=f);return{width:o,height:i,x:c,y:d}}const RV=new Set(["absolute","fixed"]);function TV(e,t){const n=Sl(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=Ks(e)?qc(e):Us(1),i=e.clientWidth*o.x,c=e.clientHeight*o.y,d=s*o.x,f=r*o.y;return{width:i,height:c,x:d,y:f}}function hP(e,t,n){let r;if(t==="viewport")r=PV(e,n);else if(t==="document")r=EV(Qs(e));else if(ks(t))r=TV(t,n);else{const s=F5(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return xm(r)}function B5(e,t){const n=Ci(e);return n===t||!ks(n)||Qc(n)?!1:As(n).position==="fixed"||B5(n,t)}function OV(e,t){const n=t.get(e);if(n)return n;let r=af(e,[],!1).filter(c=>ks(c)&&Eu(c)!=="body"),s=null;const o=As(e).position==="fixed";let i=o?Ci(e):e;for(;ks(i)&&!Qc(i);){const c=As(i),d=bC(i);!d&&c.position==="fixed"&&(s=null),(o?!d&&!s:!d&&c.position==="static"&&!!s&&RV.has(s.position)||ep(i)&&!d&&B5(e,i))?r=r.filter(m=>m!==i):s=c,i=Ci(i)}return t.set(e,r),r}function MV(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?qg(t)?[]:OV(t,this._c):[].concat(n),r],c=i[0],d=i.reduce((f,m)=>{const p=hP(t,m,s);return f.top=wa(p.top,f.top),f.right=Ni(p.right,f.right),f.bottom=Ni(p.bottom,f.bottom),f.left=wa(p.left,f.left),f},hP(t,c,s));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function IV(e){const{width:t,height:n}=L5(e);return{width:t,height:n}}function $V(e,t,n){const r=Ks(t),s=Qs(t),o=n==="fixed",i=Sl(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const d=Us(0);function f(){d.x=Wg(s)}if(r||!r&&!o)if((Eu(t)!=="body"||ep(s))&&(c=Ug(t)),r){const x=Sl(t,!0,o,t);d.x=x.x+t.clientLeft,d.y=x.y+t.clientTop}else s&&f();o&&!r&&s&&f();const m=s&&!r&&!o?z5(s,c):Us(0),p=i.left+c.scrollLeft-d.x-m.x,v=i.top+c.scrollTop-d.y-m.y;return{x:p,y:v,width:i.width,height:i.height}}function tb(e){return As(e).position==="static"}function mP(e,t){if(!Ks(e)||As(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Qs(e)===n&&(n=n.ownerDocument.body),n}function q5(e,t){const n=Ca(e);if(qg(e))return n;if(!Ks(e)){let s=Ci(e);for(;s&&!Qc(s);){if(ks(s)&&!tb(s))return s;s=Ci(s)}return n}let r=mP(e,t);for(;r&&xV(r)&&tb(r);)r=mP(r,t);return r&&Qc(r)&&tb(r)&&!bC(r)?n:r||SV(e)||n}const DV=async function(e){const t=this.getOffsetParent||q5,n=this.getDimensions,r=await n(e.floating);return{reference:$V(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function LV(e){return As(e).direction==="rtl"}const FV={convertOffsetParentRelativeRectToViewportRelativeRect:kV,getDocumentElement:Qs,getClippingRect:MV,getOffsetParent:q5,getElementRects:DV,getClientRects:AV,getDimensions:IV,getScale:qc,isElement:ks,isRTL:LV};function U5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function zV(e,t){let n=null,r;const s=Qs(e);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),o();const f=e.getBoundingClientRect(),{left:m,top:p,width:v,height:x}=f;if(c||t(),!v||!x)return;const j=Oh(p),y=Oh(s.clientWidth-(m+v)),b=Oh(s.clientHeight-(p+x)),S=Oh(m),C={rootMargin:-j+"px "+-y+"px "+-b+"px "+-S+"px",threshold:wa(0,Ni(1,d))||1};let k=!0;function A(E){const P=E[0].intersectionRatio;if(P!==d){if(!k)return i();P?i(!1,P):r=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!U5(f,e.getBoundingClientRect())&&i(),k=!1}try{n=new IntersectionObserver(A,{...C,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,C)}n.observe(e)}return i(!0),o}function BV(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,f=jC(e),m=s||o?[...f?af(f):[],...af(t)]:[];m.forEach(S=>{s&&S.addEventListener("scroll",n,{passive:!0}),o&&S.addEventListener("resize",n)});const p=f&&c?zV(f,n):null;let v=-1,x=null;i&&(x=new ResizeObserver(S=>{let[N]=S;N&&N.target===f&&x&&(x.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var C;(C=x)==null||C.observe(t)})),n()}),f&&!d&&x.observe(f),x.observe(t));let j,y=d?Sl(e):null;d&&b();function b(){const S=Sl(e);y&&!U5(y,S)&&n(),y=S,j=requestAnimationFrame(b)}return n(),()=>{var S;m.forEach(N=>{s&&N.removeEventListener("scroll",n),o&&N.removeEventListener("resize",n)}),p?.(),(S=x)==null||S.disconnect(),x=null,d&&cancelAnimationFrame(j)}}const qV=fV,UV=pV,WV=cV,HV=mV,VV=uV,gP=lV,KV=hV,GV=(e,t,n)=>{const r=new Map,s={platform:FV,...n},o={...s.platform,_c:r};return iV(e,t,{...s,platform:o})};var YV=typeof document<"u",XV=function(){},om=YV?h.useLayoutEffect:XV;function ym(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ym(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!ym(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function W5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vP(e,t){const n=W5(e);return Math.round(t*n)/n}function nb(e){const t=h.useRef(e);return om(()=>{t.current=e}),t}function QV(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:i}={},transform:c=!0,whileElementsMounted:d,open:f}=e,[m,p]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,x]=h.useState(r);ym(v,r)||x(r);const[j,y]=h.useState(null),[b,S]=h.useState(null),N=h.useCallback(H=>{H!==E.current&&(E.current=H,y(H))},[]),C=h.useCallback(H=>{H!==P.current&&(P.current=H,S(H))},[]),k=o||j,A=i||b,E=h.useRef(null),P=h.useRef(null),O=h.useRef(m),D=d!=null,K=nb(d),q=nb(s),B=nb(f),Y=h.useCallback(()=>{if(!E.current||!P.current)return;const H={placement:t,strategy:n,middleware:v};q.current&&(H.platform=q.current),GV(E.current,P.current,H).then(M=>{const X={...M,isPositioned:B.current!==!1};z.current&&!ym(O.current,X)&&(O.current=X,_u.flushSync(()=>{p(X)}))})},[v,t,n,q,B]);om(()=>{f===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,p(H=>({...H,isPositioned:!1})))},[f]);const z=h.useRef(!1);om(()=>(z.current=!0,()=>{z.current=!1}),[]),om(()=>{if(k&&(E.current=k),A&&(P.current=A),k&&A){if(K.current)return K.current(k,A,Y);Y()}},[k,A,Y,K,D]);const I=h.useMemo(()=>({reference:E,floating:P,setReference:N,setFloating:C}),[N,C]),T=h.useMemo(()=>({reference:k,floating:A}),[k,A]),V=h.useMemo(()=>{const H={position:n,left:0,top:0};if(!T.floating)return H;const M=vP(T.floating,m.x),X=vP(T.floating,m.y);return c?{...H,transform:"translate("+M+"px, "+X+"px)",...W5(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:X}},[n,c,T.floating,m.x,m.y]);return h.useMemo(()=>({...m,update:Y,refs:I,elements:T,floatingStyles:V}),[m,Y,I,T,V])}const JV=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?gP({element:r.current,padding:s}).fn(n):{}:r?gP({element:r,padding:s}).fn(n):{}}}},ZV=(e,t)=>({...qV(e),options:[e,t]}),eK=(e,t)=>({...UV(e),options:[e,t]}),tK=(e,t)=>({...KV(e),options:[e,t]}),nK=(e,t)=>({...WV(e),options:[e,t]}),rK=(e,t)=>({...HV(e),options:[e,t]}),aK=(e,t)=>({...VV(e),options:[e,t]}),sK=(e,t)=>({...JV(e),options:[e,t]});var oK="Arrow",H5=h.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return a.jsx(lt.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});H5.displayName=oK;var iK=H5;function Hg(e){const[t,n]=h.useState(void 0);return pr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let i,c;if("borderBoxSize"in o){const d=o.borderBoxSize,f=Array.isArray(d)?d[0]:d;i=f.inlineSize,c=f.blockSize}else i=e.offsetWidth,c=e.offsetHeight;n({width:i,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var SC="Popper",[V5,Ei]=kr(SC),[lK,K5]=V5(SC),G5=e=>{const{__scopePopper:t,children:n}=e,[r,s]=h.useState(null);return a.jsx(lK,{scope:t,anchor:r,onAnchorChange:s,children:n})};G5.displayName=SC;var Y5="PopperAnchor",X5=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=K5(Y5,n),i=h.useRef(null),c=Tt(t,i),d=h.useRef(null);return h.useEffect(()=>{const f=d.current;d.current=r?.current||i.current,f!==d.current&&o.onAnchorChange(d.current)}),r?null:a.jsx(lt.div,{...s,ref:c})});X5.displayName=Y5;var NC="PopperContent",[cK,uK]=V5(NC),Q5=h.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:p="partial",hideWhenDetached:v=!1,updatePositionStrategy:x="optimized",onPlaced:j,...y}=e,b=K5(NC,n),[S,N]=h.useState(null),C=Tt(t,ae=>N(ae)),[k,A]=h.useState(null),E=Hg(k),P=E?.width??0,O=E?.height??0,D=r+(o!=="center"?"-"+o:""),K=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},q=Array.isArray(f)?f:[f],B=q.length>0,Y={padding:K,boundary:q.filter(fK),altBoundary:B},{refs:z,floatingStyles:I,placement:T,isPositioned:V,middlewareData:H}=QV({strategy:"fixed",placement:D,whileElementsMounted:(...ae)=>BV(...ae,{animationFrame:x==="always"}),elements:{reference:b.anchor},middleware:[ZV({mainAxis:s+O,alignmentAxis:i}),d&&eK({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?tK():void 0,...Y}),d&&nK({...Y}),rK({...Y,apply:({elements:ae,rects:ye,availableWidth:se,availableHeight:de})=>{const{width:De,height:ge}=ye.reference,ve=ae.floating.style;ve.setProperty("--radix-popper-available-width",`${se}px`),ve.setProperty("--radix-popper-available-height",`${de}px`),ve.setProperty("--radix-popper-anchor-width",`${De}px`),ve.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),k&&sK({element:k,padding:c}),pK({arrowWidth:P,arrowHeight:O}),v&&aK({strategy:"referenceHidden",...Y})]}),[M,X]=e3(T),$=Zn(j);pr(()=>{V&&$?.()},[V,$]);const F=H.arrow?.x,G=H.arrow?.y,re=H.arrow?.centerOffset!==0,[oe,ue]=h.useState();return pr(()=>{S&&ue(window.getComputedStyle(S).zIndex)},[S]),a.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:V?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(cK,{scope:n,placedSide:M,onArrowChange:A,arrowX:F,arrowY:G,shouldHideArrow:re,children:a.jsx(lt.div,{"data-side":M,"data-align":X,...y,ref:C,style:{...y.style,animation:V?void 0:"none"}})})})});Q5.displayName=NC;var J5="PopperArrow",dK={top:"bottom",right:"left",bottom:"top",left:"right"},Z5=h.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=uK(J5,r),i=dK[o.placedSide];return a.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:a.jsx(iK,{...s,ref:n,style:{...s.style,display:"block"}})})});Z5.displayName=J5;function fK(e){return e!==null}var pK=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:s}=t,i=s.arrow?.centerOffset!==0,c=i?0:e.arrowWidth,d=i?0:e.arrowHeight,[f,m]=e3(n),p={start:"0%",center:"50%",end:"100%"}[m],v=(s.arrow?.x??0)+c/2,x=(s.arrow?.y??0)+d/2;let j="",y="";return f==="bottom"?(j=i?p:`${v}px`,y=`${-d}px`):f==="top"?(j=i?p:`${v}px`,y=`${r.floating.height+d}px`):f==="right"?(j=`${-d}px`,y=i?p:`${x}px`):f==="left"&&(j=`${r.floating.width+d}px`,y=i?p:`${x}px`),{data:{x:j,y}}}});function e3(e){const[t,n="center"]=e.split("-");return[t,n]}var Vg=G5,tp=X5,Kg=Q5,Gg=Z5,hK=Symbol("radix.slottable");function mK(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=hK,t}var[Yg]=kr("Tooltip",[Ei]),Xg=Ei(),t3="TooltipProvider",gK=700,e1="tooltip.open",[vK,CC]=Yg(t3),n3=e=>{const{__scopeTooltip:t,delayDuration:n=gK,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,i=h.useRef(!0),c=h.useRef(!1),d=h.useRef(0);return h.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),a.jsx(vK,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:h.useCallback(()=>{window.clearTimeout(d.current),i.current=!1},[]),onClose:h.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:h.useCallback(f=>{c.current=f},[]),disableHoverableContent:s,children:o})};n3.displayName=t3;var sf="Tooltip",[xK,np]=Yg(sf),r3=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:i,delayDuration:c}=e,d=CC(sf,e.__scopeTooltip),f=Xg(t),[m,p]=h.useState(null),v=fr(),x=h.useRef(0),j=i??d.disableHoverableContent,y=c??d.delayDuration,b=h.useRef(!1),[S,N]=Aa({prop:r,defaultProp:s??!1,onChange:P=>{P?(d.onOpen(),document.dispatchEvent(new CustomEvent(e1))):d.onClose(),o?.(P)},caller:sf}),C=h.useMemo(()=>S?b.current?"delayed-open":"instant-open":"closed",[S]),k=h.useCallback(()=>{window.clearTimeout(x.current),x.current=0,b.current=!1,N(!0)},[N]),A=h.useCallback(()=>{window.clearTimeout(x.current),x.current=0,N(!1)},[N]),E=h.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{b.current=!0,N(!0),x.current=0},y)},[y,N]);return h.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),a.jsx(Vg,{...f,children:a.jsx(xK,{scope:t,contentId:v,open:S,stateAttribute:C,trigger:m,onTriggerChange:p,onTriggerEnter:h.useCallback(()=>{d.isOpenDelayedRef.current?E():k()},[d.isOpenDelayedRef,E,k]),onTriggerLeave:h.useCallback(()=>{j?A():(window.clearTimeout(x.current),x.current=0)},[A,j]),onOpen:k,onClose:A,disableHoverableContent:j,children:n})})};r3.displayName=sf;var t1="TooltipTrigger",a3=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=np(t1,n),o=CC(t1,n),i=Xg(n),c=h.useRef(null),d=Tt(t,c,s.onTriggerChange),f=h.useRef(!1),m=h.useRef(!1),p=h.useCallback(()=>f.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(tp,{asChild:!0,...i,children:a.jsx(lt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:d,onPointerMove:We(e.onPointerMove,v=>{v.pointerType!=="touch"&&!m.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:We(e.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:We(e.onPointerDown,()=>{s.open&&s.onClose(),f.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:We(e.onFocus,()=>{f.current||s.onOpen()}),onBlur:We(e.onBlur,s.onClose),onClick:We(e.onClick,s.onClose)})})});a3.displayName=t1;var _C="TooltipPortal",[yK,bK]=Yg(_C,{forceMount:void 0}),s3=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,o=np(_C,t);return a.jsx(yK,{scope:t,forceMount:n,children:a.jsx(ar,{present:n||o.open,children:a.jsx(zl,{asChild:!0,container:s,children:r})})})};s3.displayName=_C;var Jc="TooltipContent",o3=h.forwardRef((e,t)=>{const n=bK(Jc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...o}=e,i=np(Jc,e.__scopeTooltip);return a.jsx(ar,{present:r||i.open,children:i.disableHoverableContent?a.jsx(i3,{side:s,...o,ref:t}):a.jsx(wK,{side:s,...o,ref:t})})}),wK=h.forwardRef((e,t)=>{const n=np(Jc,e.__scopeTooltip),r=CC(Jc,e.__scopeTooltip),s=h.useRef(null),o=Tt(t,s),[i,c]=h.useState(null),{trigger:d,onClose:f}=n,m=s.current,{onPointerInTransitChange:p}=r,v=h.useCallback(()=>{c(null),p(!1)},[p]),x=h.useCallback((j,y)=>{const b=j.currentTarget,S={x:j.clientX,y:j.clientY},N=_K(S,b.getBoundingClientRect()),C=kK(S,N),k=AK(y.getBoundingClientRect()),A=PK([...C,...k]);c(A),p(!0)},[p]);return h.useEffect(()=>()=>v(),[v]),h.useEffect(()=>{if(d&&m){const j=b=>x(b,m),y=b=>x(b,d);return d.addEventListener("pointerleave",j),m.addEventListener("pointerleave",y),()=>{d.removeEventListener("pointerleave",j),m.removeEventListener("pointerleave",y)}}},[d,m,x,v]),h.useEffect(()=>{if(i){const j=y=>{const b=y.target,S={x:y.clientX,y:y.clientY},N=d?.contains(b)||m?.contains(b),C=!EK(S,i);N?v():C&&(v(),f())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[d,m,i,f,v]),a.jsx(i3,{...e,ref:o})}),[jK,SK]=Yg(sf,{isInside:!1}),NK=mK("TooltipContent"),i3=h.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...c}=e,d=np(Jc,n),f=Xg(n),{onClose:m}=d;return h.useEffect(()=>(document.addEventListener(e1,m),()=>document.removeEventListener(e1,m)),[m]),h.useEffect(()=>{if(d.trigger){const p=v=>{v.target?.contains(d.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,m]),a.jsx(Fl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:a.jsxs(Kg,{"data-state":d.stateAttribute,...f,...c,ref:t,style:{...c.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:[a.jsx(NK,{children:r}),a.jsx(jK,{scope:n,isInside:!0,children:a.jsx(Y9,{id:d.contentId,role:"tooltip",children:s||r})})]})})});o3.displayName=Jc;var l3="TooltipArrow",CK=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Xg(n);return SK(l3,n).isInside?null:a.jsx(Gg,{...s,...r,ref:t})});CK.displayName=l3;function _K(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,s,o)){case o:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function kK(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function AK(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function EK(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const c=t[o],d=t[i],f=c.x,m=c.y,p=d.x,v=d.y;m>r!=v>r&&n<(p-f)*(r-m)/(v-m)+f&&(s=!s)}return s}function PK(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),RK(t)}function RK(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const o=n[n.length-1],i=n[n.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var TK=n3,OK=r3,MK=a3,IK=s3,c3=o3;const Ro=TK,To=OK,Oo=MK,Gs=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(IK,{children:a.jsx(c3,{ref:r,sideOffset:t,className:$e("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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),...n})}));Gs.displayName=c3.displayName;var Qg=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},$K=class extends Qg{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},u3=new $K,DK={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},LK=class{#e=DK;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},n1=new LK;function FK(e){setTimeout(e,0)}var zK=typeof window>"u"||"Deno"in globalThis;function xs(){}function BK(e,t){return typeof e=="function"?e(t):e}function qK(e){return typeof e=="number"&&e>=0&&e!==1/0}function UK(e,t){return Math.max(e+(t||0)-Date.now(),0)}function r1(e,t){return typeof e=="function"?e(t):e}function WK(e,t){return typeof e=="function"?e(t):e}function xP(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:o,queryKey:i,stale:c}=e;if(i){if(r){if(t.queryHash!==kC(i,t.options))return!1}else if(!lf(t.queryKey,i))return!1}if(n!=="all"){const d=t.isActive();if(n==="active"&&!d||n==="inactive"&&d)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||s&&s!==t.state.fetchStatus||o&&!o(t))}function yP(e,t){const{exact:n,status:r,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(of(t.options.mutationKey)!==of(o))return!1}else if(!lf(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function kC(e,t){return(t?.queryKeyHashFn||of)(e)}function of(e){return JSON.stringify(e,(t,n)=>a1(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function lf(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>lf(e[n],t[n])):!1}var HK=Object.prototype.hasOwnProperty;function d3(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=bP(e)&&bP(t);if(!r&&!(a1(e)&&a1(t)))return t;const o=(r?e:Object.keys(e)).length,i=r?t:Object.keys(t),c=i.length,d=r?new Array(c):{};let f=0;for(let m=0;m<c;m++){const p=r?m:i[m],v=e[p],x=t[p];if(v===x){d[p]=v,(r?m<o:HK.call(e,p))&&f++;continue}if(v===null||x===null||typeof v!="object"||typeof x!="object"){d[p]=x;continue}const j=d3(v,x,n+1);d[p]=j,j===v&&f++}return o===c&&f===o?e:d}function bP(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function a1(e){if(!wP(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!wP(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function wP(e){return Object.prototype.toString.call(e)==="[object Object]"}function VK(e){return new Promise(t=>{n1.setTimeout(t,e)})}function KK(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?d3(e,t):t}function GK(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function YK(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var AC=Symbol();function f3(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===AC?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function XK(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var p3=(()=>{let e=()=>zK;return{isServer(){return e()},setIsServer(t){e=t}}})();function QK(){let e,t;const n=new Promise((s,o)=>{e=s,t=o});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var JK=FK;function ZK(){let e=[],t=0,n=c=>{c()},r=c=>{c()},s=JK;const o=c=>{t?e.push(c):s(()=>{n(c)})},i=()=>{const c=e;e=[],c.length&&s(()=>{r(()=>{c.forEach(d=>{n(d)})})})};return{batch:c=>{let d;t++;try{d=c()}finally{t--,t||i()}return d},batchCalls:c=>(...d)=>{o(()=>{c(...d)})},schedule:o,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{s=c}}}var Fr=ZK(),eG=class extends Qg{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},bm=new eG;function tG(e){return Math.min(1e3*2**e,3e4)}function h3(e){return(e??"online")==="online"?bm.isOnline():!0}var s1=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function m3(e){let t=!1,n=0,r;const s=QK(),o=()=>s.status!=="pending",i=y=>{if(!o()){const b=new s1(y);v(b),e.onCancel?.(b)}},c=()=>{t=!0},d=()=>{t=!1},f=()=>u3.isFocused()&&(e.networkMode==="always"||bm.isOnline())&&e.canRun(),m=()=>h3(e.networkMode)&&e.canRun(),p=y=>{o()||(r?.(),s.resolve(y))},v=y=>{o()||(r?.(),s.reject(y))},x=()=>new Promise(y=>{r=b=>{(o()||f())&&y(b)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),j=()=>{if(o())return;let y;const b=n===0?e.initialPromise:void 0;try{y=b??e.fn()}catch(S){y=Promise.reject(S)}Promise.resolve(y).then(p).catch(S=>{if(o())return;const N=e.retry??(p3.isServer()?0:3),C=e.retryDelay??tG,k=typeof C=="function"?C(n,S):C,A=N===!0||typeof N=="number"&&n<N||typeof N=="function"&&N(n,S);if(t||!A){v(S);return}n++,e.onFail?.(n,S),VK(k).then(()=>f()?void 0:x()).then(()=>{t?v(S):j()})})};return{promise:s,status:()=>s.status,cancel:i,continue:()=>(r?.(),s),cancelRetry:c,continueRetry:d,canStart:m,start:()=>(m()?j():x().then(j),s)}}var g3=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),qK(this.gcTime)&&(this.#e=n1.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(p3.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(n1.clearTimeout(this.#e),this.#e=void 0)}};function nG(e){return{onFetch:(t,n)=>{const r=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],i=t.state.data?.pageParams||[];let c={pages:[],pageParams:[]},d=0;const f=async()=>{let m=!1;const p=j=>{XK(j,()=>t.signal,()=>m=!0)},v=f3(t.options,t.fetchOptions),x=async(j,y,b)=>{if(m)return Promise.reject(t.signal.reason);if(y==null&&j.pages.length)return Promise.resolve(j);const N=(()=>{const E={client:t.client,queryKey:t.queryKey,pageParam:y,direction:b?"backward":"forward",meta:t.options.meta};return p(E),E})(),C=await v(N),{maxPages:k}=t.options,A=b?YK:GK;return{pages:A(j.pages,C,k),pageParams:A(j.pageParams,y,k)}};if(s&&o.length){const j=s==="backward",y=j?rG:jP,b={pages:o,pageParams:i},S=y(r,b);c=await x(b,S,j)}else{const j=e??o.length;do{const y=d===0?i[0]??r.initialPageParam:jP(r,c);if(d>0&&y==null)break;c=await x(c,y),d++}while(d<j)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=f}}}function jP(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function rG(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var aG=class extends g3{#e;#t;#n;#a;#s;#r;#l;#o;constructor(e){super(),this.#o=!1,this.#l=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#a=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=NP(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#l,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=NP(this.options);t.data!==void 0&&(this.setState(SP(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#a.remove(this)}setData(e,t){const n=KK(this.state.data,e,this.options);return this.#i({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#i({type:"setState",state:e})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(xs).catch(xs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>WK(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===AC||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>r1(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!UK(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#o||this.#c()?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#a.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const d=this.observers.find(f=>f.options.queryFn);d&&this.setOptions(d.options)}const n=new AbortController,r=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},s=()=>{const d=f3(this.options,t),m=(()=>{const p={client:this.#s,queryKey:this.queryKey,meta:this.meta};return r(p),p})();return this.#o=!1,this.options.persister?this.options.persister(d,m,this):d(m)},i=(()=>{const d={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:s};return r(d),d})();(this.#e==="infinite"?nG(this.options.pages):this.options.behavior)?.onFetch(i,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#i({type:"fetch",meta:i.fetchOptions?.meta}),this.#r=m3({initialPromise:t?.initialPromise,fn:i.fetchFn,onCancel:d=>{d instanceof s1&&d.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(d,f)=>{this.#i({type:"failed",failureCount:d,error:f})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0});try{const d=await this.#r.start();if(d===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(d),this.#a.config.onSuccess?.(d,this),this.#a.config.onSettled?.(d,this.state.error,this),d}catch(d){if(d instanceof s1){if(d.silent)return this.#r.promise;if(d.revert){if(this.state.data===void 0)throw d;return this.state.data}}throw this.#i({type:"error",error:d}),this.#a.config.onError?.(d,this),this.#a.config.onSettled?.(this.state.data,d,this),d}finally{this.scheduleGc()}}#i(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...sG(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...SP(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?r:void 0,r;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),Fr.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#a.notify({query:this,type:"updated",action:e})})}};function sG(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:h3(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function SP(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function NP(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var oG=class extends g3{#e;#t;#n;#a;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||iG(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#s({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=m3({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(o,i)=>{this.#s({type:"failed",failureCount:o,error:i})},onPause:()=>{this.#s({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",s=!this.#a.canStart();try{if(r)t();else{this.#s({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const i=await this.options.onMutate?.(e,n);i!==this.state.context&&this.#s({type:"pending",context:i,variables:e,isPaused:s})}const o=await this.#a.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#s({type:"success",data:o}),o}catch(o){try{await this.#n.config.onError?.(o,e,this.state.context,this,n)}catch(i){Promise.reject(i)}try{await this.options.onError?.(o,e,this.state.context,n)}catch(i){Promise.reject(i)}try{await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,n)}catch(i){Promise.reject(i)}try{await this.options.onSettled?.(void 0,o,e,this.state.context,n)}catch(i){Promise.reject(i)}throw this.#s({type:"error",error:o}),o}finally{this.#n.runNext(this)}}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Fr.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function iG(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var lG=class extends Qg{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new oG({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Mh(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Mh(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Mh(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Mh(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Fr.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>yP(t,n))}findAll(e={}){return this.getAll().filter(t=>yP(e,t))}notify(e){Fr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Fr.batch(()=>Promise.all(e.map(t=>t.continue().catch(xs))))}};function Mh(e){return e.options.scope?.id}var cG=class extends Qg{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,s=t.queryHash??kC(r,t);let o=this.get(s);return o||(o=new aG({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Fr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>xP(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>xP(e,n)):t}notify(e){Fr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Fr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Fr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},uG=class{#e;#t;#n;#a;#s;#r;#l;#o;constructor(e={}){this.#e=e.queryCache||new cG,this.#t=e.mutationCache||new lG,this.#n=e.defaultOptions||{},this.#a=new Map,this.#s=new Map,this.#r=0}mount(){this.#r++,this.#r===1&&(this.#l=u3.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=bm.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#r--,this.#r===0&&(this.#l?.(),this.#l=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(r1(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=this.#e.get(r.queryHash)?.state.data,i=BK(t,o);if(i!==void 0)return this.#e.build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Fr.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;Fr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return Fr.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Fr.batch(()=>this.#e.findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(xs).catch(xs)}invalidateQueries(e,t={}){return Fr.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Fr.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(xs)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(xs)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(r1(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xs).catch(xs)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xs).catch(xs)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return bm.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#a.set(of(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#a.values()],n={};return t.forEach(r=>{lf(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#s.set(of(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(r=>{lf(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=kC(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===AC&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},dG=h.createContext(void 0),fG=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(dG.Provider,{value:e,children:t}));var EC=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,v3=/^[\\/]{2}/;function pG(e,t){return t+e.replace(/\\/g,"/")}var CP="popstate";function _P(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function hG(e={}){function t(r,s){let o=s.state?.masked,{pathname:i,search:c,hash:d}=o||r.location;return o1("",{pathname:i,search:c,hash:d},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:cf(s)}return gG(t,n,null,e)}function Bn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ya(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function mG(){return Math.random().toString(36).substring(2,10)}function kP(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function o1(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Pu(t):t,state:n,key:t&&t.key||r||mG(),mask:s}}function cf({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Pu(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function gG(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:o=!1}=r,i=s.history,c="POP",d=null,f=m();f==null&&(f=0,i.replaceState({...i.state,idx:f},""));function m(){return(i.state||{idx:null}).idx}function p(){c="POP";let b=m(),S=b==null?null:b-f;f=b,d&&d({action:c,location:y.location,delta:S})}function v(b,S){c="PUSH";let N=_P(b)?b:o1(y.location,b,S);f=m()+1;let C=kP(N,f),k=y.createHref(N.mask||N);try{i.pushState(C,"",k)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;s.location.assign(k)}o&&d&&d({action:c,location:y.location,delta:1})}function x(b,S){c="REPLACE";let N=_P(b)?b:o1(y.location,b,S);f=m();let C=kP(N,f),k=y.createHref(N.mask||N);i.replaceState(C,"",k),o&&d&&d({action:c,location:y.location,delta:0})}function j(b){return vG(s,b)}let y={get action(){return c},get location(){return e(s,i)},listen(b){if(d)throw new Error("A history only accepts one active listener");return s.addEventListener(CP,p),d=b,()=>{s.removeEventListener(CP,p),d=null}},createHref(b){return t(s,b)},createURL:j,encodeLocation(b){let S=j(b);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:v,replace:x,go(b){return i.go(b)}};return y}function vG(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Bn(r,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:cf(t);return s=s.replace(/ $/,"%20"),!n&&v3.test(s)&&(s=r+s),new URL(s,r)}function x3(e,t,n="/"){return xG(e,t,n,!1)}function xG(e,t,n,r,s){let o=typeof t=="string"?Pu(t):t,i=Mo(o.pathname||"/",n);if(i==null)return null;let c=yG(e),d=null,f=PG(i);for(let m=0;d==null&&m<c.length;++m)d=EG(c[m],f,r);return d}function yG(e){let t=y3(e);return bG(t),t}function y3(e,t=[],n=[],r="",s=!1){let o=(i,c,d=s,f)=>{let m={relativePath:f===void 0?i.path||"":f,caseSensitive:i.caseSensitive===!0,childrenIndex:c,route:i};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(r)&&d)return;Bn(m.relativePath.startsWith(r),`Absolute route path "${m.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(r.length)}let p=_s([r,m.relativePath]),v=n.concat(m);i.children&&i.children.length>0&&(Bn(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),y3(i.children,t,v,p,d)),!(i.path==null&&!i.index)&&t.push({path:p,score:kG(p,i.index),routesMeta:v.map((x,j)=>{let[y,b]=j3(x.relativePath,x.caseSensitive,j===v.length-1);return{...x,matcher:y,compiledParams:b}})})};return e.forEach((i,c)=>{if(i.path===""||!i.path?.includes("?"))o(i,c);else for(let d of b3(i.path))o(i,c,!0,d)}),t}function b3(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return s?[o,""]:[o];let i=b3(r.join("/")),c=[];return c.push(...i.map(d=>d===""?o:[o,d].join("/"))),s&&c.push(...i),c.map(d=>e.startsWith("/")&&d===""?"/":d)}function bG(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:AG(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var wG=/^:[\w-]+$/,jG=3,SG=2,NG=1,CG=10,_G=-2,AP=e=>e==="*";function kG(e,t){let n=e.split("/"),r=n.length;return n.some(AP)&&(r+=_G),t&&(r+=SG),n.filter(s=>!AP(s)).reduce((s,o)=>s+(wG.test(o)?jG:o===""?NG:CG),r)}function AG(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function EG(e,t,n=!1){let{routesMeta:r}=e,s={},o="/",i=[];for(let c=0;c<r.length;++c){let d=r[c],f=c===r.length-1,m=o==="/"?t:t.slice(o.length)||"/",p={path:d.relativePath,caseSensitive:d.caseSensitive,end:f},v=d.matcher&&d.compiledParams?w3(p,m,d.matcher,d.compiledParams):gn(p,m),x=d.route;if(!v&&f&&n&&!r[r.length-1].route.index&&(v=gn({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},m)),!v)return null;Object.assign(s,v.params),i.push({params:s,pathname:_s([o,v.pathname]),pathnameBase:OG(_s([o,v.pathnameBase])),route:x}),v.pathnameBase!=="/"&&(o=_s([o,v.pathnameBase]))}return i}function gn(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=j3(e.path,e.caseSensitive,e.end);return w3(e,t,n,r)}function w3(e,t,n,r){let s=t.match(n);if(!s)return null;let o=s[0],i=o.replace(/(.)\/+$/,"$1"),c=s.slice(1);return{params:r.reduce((f,{paramName:m,isOptional:p},v)=>{if(m==="*"){let j=c[v]||"";i=o.slice(0,o.length-j.length).replace(/(.)\/+$/,"$1")}const x=c[v];return p&&!x?f[m]=void 0:f[m]=(x||"").replace(/%2F/g,"/"),f},{}),pathname:o,pathnameBase:i,pattern:e}}function j3(e,t=!1,n=!0){Ya(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,c,d,f,m)=>{if(r.push({paramName:c,isOptional:d!=null}),d){let p=m.charAt(f+i.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function PG(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ya(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Mo(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function RG(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Pu(e):e,o;return n?(n=S3(n),n.startsWith("/")?o=EP(n.substring(1),"/"):o=EP(n,t)):o=t,{pathname:o,search:MG(r),hash:IG(s)}}function EP(e,t){let n=wm(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function rb(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function TG(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function PC(e){let t=TG(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Jg(e,t,n,r=!1){let s;typeof e=="string"?s=Pu(e):(s={...e},Bn(!s.pathname||!s.pathname.includes("?"),rb("?","pathname","search",s)),Bn(!s.pathname||!s.pathname.includes("#"),rb("#","pathname","hash",s)),Bn(!s.search||!s.search.includes("#"),rb("#","search","hash",s)));let o=e===""||s.pathname==="",i=o?"/":s.pathname,c;if(i==null)c=n;else{let p=t.length-1;if(!r&&i.startsWith("..")){let v=i.split("/");for(;v[0]==="..";)v.shift(),p-=1;s.pathname=v.join("/")}c=p>=0?t[p]:"/"}let d=RG(s,c),f=i&&i!=="/"&&i.endsWith("/"),m=(o||i===".")&&n.endsWith("/");return!d.pathname.endsWith("/")&&(f||m)&&(d.pathname+="/"),d}var S3=e=>e.replace(/[\\/]{2,}/g,"/"),_s=e=>S3(e.join("/")),wm=e=>e.replace(/\/+$/,""),OG=e=>wm(e).replace(/^\/*/,"/"),MG=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,IG=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,$G=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function DG(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function LG(e){let t=e.map(n=>n.route.path).filter(Boolean);return _s(t)||"/"}var N3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function C3(e,t){let n=e;if(typeof n!="string"||!EC.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(N3)try{let o=new URL(window.location.href),i=v3.test(n)?new URL(pG(n,o.protocol)):new URL(n),c=Mo(i.pathname,t);i.origin===o.origin&&c!=null?n=c+i.search+i.hash:s=!0}catch{Ya(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var _3=["POST","PUT","PATCH","DELETE"];new Set(_3);var FG=["GET",..._3];new Set(FG);var zG=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function BG(e){try{return zG.includes(new URL(e).protocol)}catch{return!1}}var Ru=h.createContext(null);Ru.displayName="DataRouter";var Zg=h.createContext(null);Zg.displayName="DataRouterState";var k3=h.createContext(!1);function qG(){return h.useContext(k3)}var A3=h.createContext({isTransitioning:!1});A3.displayName="ViewTransition";var UG=h.createContext(new Map);UG.displayName="Fetchers";var WG=h.createContext(null);WG.displayName="Await";var Pa=h.createContext(null);Pa.displayName="Navigation";var rp=h.createContext(null);rp.displayName="Location";var as=h.createContext({outlet:null,matches:[],isDataRoute:!1});as.displayName="Route";var RC=h.createContext(null);RC.displayName="RouteError";var E3="REACT_ROUTER_ERROR",HG="REDIRECT",VG="ROUTE_ERROR_RESPONSE";function KG(e){if(e.startsWith(`${E3}:${HG}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function GG(e){if(e.startsWith(`${E3}:${VG}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new $G(t.status,t.statusText,t.data)}catch{}}function YG(e,{relative:t}={}){Bn(Tu(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=h.useContext(Pa),{hash:s,pathname:o,search:i}=ap(e,{relative:t}),c=o;return n!=="/"&&(c=o==="/"?n:_s([n,o])),r.createHref({pathname:c,search:i,hash:s})}function Tu(){return h.useContext(rp)!=null}function Kr(){return Bn(Tu(),"useLocation() may be used only in the context of a <Router> component."),h.useContext(rp).location}var P3="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function R3(e){h.useContext(Pa).static||h.useLayoutEffect(e)}function ss(){let{isDataRoute:e}=h.useContext(as);return e?uY():XG()}function XG(){Bn(Tu(),"useNavigate() may be used only in the context of a <Router> component.");let e=h.useContext(Ru),{basename:t,navigator:n}=h.useContext(Pa),{matches:r}=h.useContext(as),{pathname:s}=Kr(),o=JSON.stringify(PC(r)),i=h.useRef(!1);return R3(()=>{i.current=!0}),h.useCallback((d,f={})=>{if(Ya(i.current,P3),!i.current)return;if(typeof d=="number"){n.go(d);return}let m=Jg(d,JSON.parse(o),s,f.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:_s([t,m.pathname])),(f.replace?n.replace:n.push)(m,f.state,f)},[t,n,o,s,e])}var QG=h.createContext(null);function JG(e){let t=h.useContext(as).outlet;return h.useMemo(()=>t&&h.createElement(QG.Provider,{value:e},t),[t,e])}function ql(){let{matches:e}=h.useContext(as);return e[e.length-1]?.params??{}}function ap(e,{relative:t}={}){let{matches:n}=h.useContext(as),{pathname:r}=Kr(),s=JSON.stringify(PC(n));return h.useMemo(()=>Jg(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function ZG(e,t){return T3(e,t)}function T3(e,t,n){Bn(Tu(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=h.useContext(Pa),{matches:s}=h.useContext(as),o=s[s.length-1],i=o?o.params:{},c=o?o.pathname:"/",d=o?o.pathnameBase:"/",f=o&&o.route;{let b=f&&f.path||"";M3(c,!f||b.endsWith("*")||b.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${b}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
10
+
11
+ Please change the parent <Route path="${b}"> to <Route path="${b==="/"?"*":`${b}/*`}">.`)}let m=Kr(),p;if(t){let b=typeof t=="string"?Pu(t):t;Bn(d==="/"||b.pathname?.startsWith(d),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${b.pathname}" was given in the \`location\` prop.`),p=b}else p=m;let v=p.pathname||"/",x=v;if(d!=="/"){let b=d.replace(/^\//,"").split("/");x="/"+v.replace(/^\//,"").split("/").slice(b.length).join("/")}let j=n&&n.state.matches.length?n.state.matches.map(b=>Object.assign(b,{route:n.manifest[b.route.id]||b.route})):x3(e,{pathname:x});Ya(f||j!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Ya(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let y=aY(j&&j.map(b=>Object.assign({},b,{params:Object.assign({},i,b.params),pathname:_s([d,r.encodeLocation?r.encodeLocation(b.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?d:_s([d,r.encodeLocation?r.encodeLocation(b.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathnameBase])})),s,n);return t&&y?h.createElement(rp.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...p},navigationType:"POP"}},y):y}function eY(){let e=cY(),t=DG(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=h.createElement(h.Fragment,null,h.createElement("p",null,"💿 Hey developer 👋"),h.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",h.createElement("code",{style:o},"ErrorBoundary")," or"," ",h.createElement("code",{style:o},"errorElement")," prop on your route.")),h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),n?h.createElement("pre",{style:s},n):null,i)}var tY=h.createElement(eY,null),O3=class extends h.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=GG(e.digest);n&&(e=n)}let t=e!==void 0?h.createElement(as.Provider,{value:this.props.routeContext},h.createElement(RC.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?h.createElement(nY,{error:e},t):t}};O3.contextType=k3;var ab=new WeakMap;function nY({children:e,error:t}){let{basename:n}=h.useContext(Pa);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=KG(t.digest);if(r){let s=ab.get(t);if(s)throw s;let o=C3(r.location,n),i=o.absoluteURL||o.to;if(BG(i))throw new Error("Invalid redirect location");if(N3&&!ab.get(t))if(o.isExternal||r.reloadDocument)window.location.href=i;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:r.replace}));throw ab.set(t,c),c}return h.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i}`})}}return e}function rY({routeContext:e,match:t,children:n}){let r=h.useContext(Ru);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),h.createElement(as.Provider,{value:e},n)}function aY(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,o=r?.errors;if(o!=null){let m=s.findIndex(p=>p.route.id&&o?.[p.route.id]!==void 0);Bn(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,m+1))}let i=!1,c=-1;if(n&&r){i=r.renderFallback;for(let m=0;m<s.length;m++){let p=s[m];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(c=m),p.route.id){let{loaderData:v,errors:x}=r,j=p.route.loader&&!v.hasOwnProperty(p.route.id)&&(!x||x[p.route.id]===void 0);if(p.route.lazy||j){n.isStatic&&(i=!0),c>=0?s=s.slice(0,c+1):s=[s[0]];break}}}}let d=n?.onError,f=r&&d?(m,p)=>{d(m,{location:r.location,params:r.matches?.[0]?.params??{},pattern:LG(r.matches),errorInfo:p})}:void 0;return s.reduceRight((m,p,v)=>{let x,j=!1,y=null,b=null;r&&(x=o&&p.route.id?o[p.route.id]:void 0,y=p.route.errorElement||tY,i&&(c<0&&v===0?(M3("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,b=null):c===v&&(j=!0,b=p.route.hydrateFallbackElement||null)));let S=t.concat(s.slice(0,v+1)),N=()=>{let C;return x?C=y:j?C=b:p.route.Component?C=h.createElement(p.route.Component,null):p.route.element?C=p.route.element:C=m,h.createElement(rY,{match:p,routeContext:{outlet:m,matches:S,isDataRoute:r!=null},children:C})};return r&&(p.route.ErrorBoundary||p.route.errorElement||v===0)?h.createElement(O3,{location:r.location,revalidation:r.revalidation,component:y,error:x,children:N(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:f}):N()},null)}function TC(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function sY(e){let t=h.useContext(Ru);return Bn(t,TC(e)),t}function oY(e){let t=h.useContext(Zg);return Bn(t,TC(e)),t}function iY(e){let t=h.useContext(as);return Bn(t,TC(e)),t}function OC(e){let t=iY(e),n=t.matches[t.matches.length-1];return Bn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function lY(){return OC("useRouteId")}function cY(){let e=h.useContext(RC),t=oY("useRouteError"),n=OC("useRouteError");return e!==void 0?e:t.errors?.[n]}function uY(){let{router:e}=sY("useNavigate"),t=OC("useNavigate"),n=h.useRef(!1);return R3(()=>{n.current=!0}),h.useCallback(async(s,o={})=>{Ya(n.current,P3),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var PP={};function M3(e,t,n){!t&&!PP[e]&&(PP[e]=!0,Ya(!1,n))}h.memo(dY);function dY({routes:e,manifest:t,future:n,state:r,isStatic:s,onError:o}){return T3(e,void 0,{manifest:t,state:r,isStatic:s,onError:o})}function I3({to:e,replace:t,state:n,relative:r}){Bn(Tu(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=h.useContext(Pa);Ya(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=h.useContext(as),{pathname:i}=Kr(),c=ss(),d=Jg(e,PC(o),i,r==="path"),f=JSON.stringify(d);return h.useEffect(()=>{c(JSON.parse(f),{replace:t,state:n,relative:r})},[c,f,r,t,n]),null}function RP(e){return JG(e.context)}function yn(e){Bn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function fY({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:o=!1,useTransitions:i}){Bn(!Tu(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),d=h.useMemo(()=>({basename:c,navigator:s,static:o,useTransitions:i,future:{}}),[c,s,o,i]);typeof n=="string"&&(n=Pu(n));let{pathname:f="/",search:m="",hash:p="",state:v=null,key:x="default",mask:j}=n,y=h.useMemo(()=>{let b=Mo(f,c);return b==null?null:{location:{pathname:b,search:m,hash:p,state:v,key:x,mask:j},navigationType:r}},[c,f,m,p,v,x,r,j]);return Ya(y!=null,`<Router basename="${c}"> is not able to match the URL "${f}${m}${p}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:h.createElement(Pa.Provider,{value:d},h.createElement(rp.Provider,{children:t,value:y}))}function pY({children:e,location:t}){return ZG(i1(e),t)}function i1(e,t=[]){let n=[];return h.Children.forEach(e,(r,s)=>{if(!h.isValidElement(r))return;let o=[...t,s];if(r.type===h.Fragment){n.push.apply(n,i1(r.props.children,o));return}Bn(r.type===yn,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Bn(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=i1(r.props.children,o)),n.push(i)}),n}var im="get",lm="application/x-www-form-urlencoded";function ev(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function hY(e){return ev(e)&&e.tagName.toLowerCase()==="button"}function mY(e){return ev(e)&&e.tagName.toLowerCase()==="form"}function gY(e){return ev(e)&&e.tagName.toLowerCase()==="input"}function vY(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xY(e,t){return e.button===0&&(!t||t==="_self")&&!vY(e)}function l1(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function yY(e,t){let n=l1(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var Ih=null;function bY(){if(Ih===null)try{new FormData(document.createElement("form"),0),Ih=!1}catch{Ih=!0}return Ih}var wY=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function sb(e){return e!=null&&!wY.has(e)?(Ya(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${lm}"`),null):e}function jY(e,t){let n,r,s,o,i;if(mY(e)){let c=e.getAttribute("action");r=c?Mo(c,t):null,n=e.getAttribute("method")||im,s=sb(e.getAttribute("enctype"))||lm,o=new FormData(e)}else if(hY(e)||gY(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let d=e.getAttribute("formaction")||c.getAttribute("action");if(r=d?Mo(d,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||im,s=sb(e.getAttribute("formenctype"))||sb(c.getAttribute("enctype"))||lm,o=new FormData(c,e),!bY()){let{name:f,type:m,value:p}=e;if(m==="image"){let v=f?`${f}.`:"";o.append(`${v}x`,"0"),o.append(`${v}y`,"0")}else f&&o.append(f,p)}}else{if(ev(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=im,r=null,s=lm,i=e}return o&&s==="text/plain"&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:o,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function MC(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function $3(e,t,n,r){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&Mo(s.pathname,t)==="/"?s.pathname=`${wm(t)}/_root.${r}`:s.pathname=`${wm(s.pathname)}.${r}`,s}async function SY(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function NY(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function CY(e,t,n){let r=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let i=await SY(o,n);return i.links?i.links():[]}return[]}));return EY(r.flat(1).filter(NY).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function TP(e,t,n,r,s,o){let i=(d,f)=>n[f]?d.route.id!==n[f].route.id:!0,c=(d,f)=>n[f].pathname!==d.pathname||n[f].route.path?.endsWith("*")&&n[f].params["*"]!==d.params["*"];return o==="assets"?t.filter((d,f)=>i(d,f)||c(d,f)):o==="data"?t.filter((d,f)=>{let m=r.routes[d.route.id];if(!m||!m.hasLoader)return!1;if(i(d,f)||c(d,f))return!0;if(d.route.shouldRevalidate){let p=d.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:d.params,defaultShouldRevalidate:!0});if(typeof p=="boolean")return p}return!0}):[]}function _Y(e,t,{includeHydrateFallback:n}={}){return kY(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function kY(e){return[...new Set(e)]}function AY(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function EY(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let o=JSON.stringify(AY(s));return n.has(o)||(n.add(o),r.push({key:o,link:s})),r},[])}function IC(){let e=h.useContext(Ru);return MC(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function PY(){let e=h.useContext(Zg);return MC(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var $C=h.createContext(void 0);$C.displayName="FrameworkContext";function tv(){let e=h.useContext($C);return MC(e,"You must render this element inside a <HydratedRouter> element"),e}function RY(e,t){let n=h.useContext($C),[r,s]=h.useState(!1),[o,i]=h.useState(!1),{onFocus:c,onBlur:d,onMouseEnter:f,onMouseLeave:m,onTouchStart:p}=t,v=h.useRef(null);h.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let y=S=>{S.forEach(N=>{i(N.isIntersecting)})},b=new IntersectionObserver(y,{threshold:.5});return v.current&&b.observe(v.current),()=>{b.disconnect()}}},[e]),h.useEffect(()=>{if(r){let y=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(y)}}},[r]);let x=()=>{s(!0)},j=()=>{s(!1),i(!1)};return n?e!=="intent"?[o,v,{}]:[o,v,{onFocus:kd(c,x),onBlur:kd(d,j),onMouseEnter:kd(f,x),onMouseLeave:kd(m,j),onTouchStart:kd(p,x)}]:[!1,v,{}]}function kd(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function TY({page:e,...t}){let n=qG(),{nonce:r}=tv(),{router:s}=IC(),o=h.useMemo(()=>x3(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?(t.nonce==null&&r&&(t={...t,nonce:r}),n?h.createElement(MY,{page:e,matches:o,...t}):h.createElement(IY,{page:e,matches:o,...t})):null}function OY(e){let{manifest:t,routeModules:n}=tv(),[r,s]=h.useState([]);return h.useEffect(()=>{let o=!1;return CY(e,t,n).then(i=>{o||s(i)}),()=>{o=!0}},[e,t,n]),r}function MY({page:e,matches:t,...n}){let r=Kr(),{future:s}=tv(),{basename:o}=IC(),i=h.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let c=$3(e,o,s.v8_trailingSlashAwareDataRequests,"rsc"),d=!1,f=[];for(let m of t)typeof m.route.shouldRevalidate=="function"?d=!0:f.push(m.route.id);return d&&f.length>0&&c.searchParams.set("_routes",f.join(",")),[c.pathname+c.search]},[o,s.v8_trailingSlashAwareDataRequests,e,r,t]);return h.createElement(h.Fragment,null,i.map(c=>h.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...n})))}function IY({page:e,matches:t,...n}){let r=Kr(),{future:s,manifest:o,routeModules:i}=tv(),{basename:c}=IC(),{loaderData:d,matches:f}=PY(),m=h.useMemo(()=>TP(e,t,f,o,r,"data"),[e,t,f,o,r]),p=h.useMemo(()=>TP(e,t,f,o,r,"assets"),[e,t,f,o,r]),v=h.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let y=new Set,b=!1;if(t.forEach(N=>{let C=o.routes[N.route.id];!C||!C.hasLoader||(!m.some(k=>k.route.id===N.route.id)&&N.route.id in d&&i[N.route.id]?.shouldRevalidate||C.hasClientLoader?b=!0:y.add(N.route.id))}),y.size===0)return[];let S=$3(e,c,s.v8_trailingSlashAwareDataRequests,"data");return b&&y.size>0&&S.searchParams.set("_routes",t.filter(N=>y.has(N.route.id)).map(N=>N.route.id).join(",")),[S.pathname+S.search]},[c,s.v8_trailingSlashAwareDataRequests,d,r,o,m,t,e,i]),x=h.useMemo(()=>_Y(p,o),[p,o]),j=OY(p);return h.createElement(h.Fragment,null,v.map(y=>h.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...n})),x.map(y=>h.createElement("link",{key:y,rel:"modulepreload",href:y,...n})),j.map(({key:y,link:b})=>h.createElement("link",{key:y,nonce:n.nonce,...b,crossOrigin:b.crossOrigin??n.crossOrigin})))}function $Y(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var DY=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{DY&&(window.__reactRouterVersion="7.18.2")}catch{}function LY({basename:e,children:t,useTransitions:n,window:r}){let s=h.useRef();s.current==null&&(s.current=hG({window:r,v5Compat:!0}));let o=s.current,[i,c]=h.useState({action:o.action,location:o.location}),d=h.useCallback(f=>{n===!1?c(f):h.startTransition(()=>c(f))},[n]);return h.useLayoutEffect(()=>o.listen(d),[o,d]),h.createElement(fY,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,useTransitions:n})}var At=h.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:o,replace:i,mask:c,state:d,target:f,to:m,preventScrollReset:p,viewTransition:v,defaultShouldRevalidate:x,...j},y){let{basename:b,navigator:S,useTransitions:N}=h.useContext(Pa),C=typeof m=="string"&&EC.test(m),k=C3(m,b);m=k.to;let A=YG(m,{relative:s}),E=Kr(),P=null;if(c){let I=Jg(c,[],E.mask?E.mask.pathname:"/",!0);b!=="/"&&(I.pathname=I.pathname==="/"?b:_s([b,I.pathname])),P=S.createHref(I)}let[O,D,K]=RY(r,j),q=BY(m,{replace:i,mask:c,state:d,target:f,preventScrollReset:p,relative:s,viewTransition:v,defaultShouldRevalidate:x,useTransitions:N});function B(I){t&&t(I),I.defaultPrevented||q(I)}let Y=!(k.isExternal||o),z=h.createElement("a",{...j,...K,href:(Y?P:void 0)||k.absoluteURL||A,onClick:Y?B:t,ref:$Y(y,D),target:f,"data-discover":!C&&n==="render"?"true":void 0});return O&&!C?h.createElement(h.Fragment,null,z,h.createElement(TY,{page:A})):z});At.displayName="Link";var D3=h.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:o,to:i,viewTransition:c,children:d,...f},m){let p=ap(i,{relative:f.relative}),v=Kr(),x=h.useContext(Zg),{navigator:j,basename:y}=h.useContext(Pa),b=x!=null&&VY(p)&&c===!0,S=j.encodeLocation?j.encodeLocation(p).pathname:p.pathname,N=v.pathname,C=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(N=N.toLowerCase(),C=C?C.toLowerCase():null,S=S.toLowerCase()),C&&y&&(C=Mo(C,y)||C);const k=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let A=N===S||!s&&N.startsWith(S)&&N.charAt(k)==="/",E=C!=null&&(C===S||!s&&C.startsWith(S)&&C.charAt(S.length)==="/"),P={isActive:A,isPending:E,isTransitioning:b},O=A?t:void 0,D;typeof r=="function"?D=r(P):D=[r,A?"active":null,E?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let K=typeof o=="function"?o(P):o;return h.createElement(At,{...f,"aria-current":O,className:D,ref:m,style:K,to:i,viewTransition:c},typeof d=="function"?d(P):d)});D3.displayName="NavLink";var FY=h.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:o,method:i=im,action:c,onSubmit:d,relative:f,preventScrollReset:m,viewTransition:p,defaultShouldRevalidate:v,...x},j)=>{let{useTransitions:y}=h.useContext(Pa),b=WY(),S=HY(c,{relative:f}),N=i.toLowerCase()==="get"?"get":"post",C=typeof c=="string"&&EC.test(c),k=A=>{if(d&&d(A),A.defaultPrevented)return;A.preventDefault();let E=A.nativeEvent.submitter,P=E?.getAttribute("formmethod")||i,O=()=>b(E||A.currentTarget,{fetcherKey:t,method:P,navigate:n,replace:s,state:o,relative:f,preventScrollReset:m,viewTransition:p,defaultShouldRevalidate:v});y&&n!==!1?h.startTransition(()=>O()):O()};return h.createElement("form",{ref:j,method:N,action:S,onSubmit:r?d:k,...x,"data-discover":!C&&e==="render"?"true":void 0})});FY.displayName="Form";function zY(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function L3(e){let t=h.useContext(Ru);return Bn(t,zY(e)),t}function BY(e,{target:t,replace:n,mask:r,state:s,preventScrollReset:o,relative:i,viewTransition:c,defaultShouldRevalidate:d,useTransitions:f}={}){let m=ss(),p=Kr(),v=ap(e,{relative:i});return h.useCallback(x=>{if(xY(x,t)){x.preventDefault();let j=n!==void 0?n:cf(p)===cf(v),y=()=>m(e,{replace:j,mask:r,state:s,preventScrollReset:o,relative:i,viewTransition:c,defaultShouldRevalidate:d});f?h.startTransition(()=>y()):y()}},[p,m,v,n,r,s,t,e,o,i,c,d,f])}function Fo(e){Ya(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=h.useRef(l1(e)),n=h.useRef(!1),r=Kr(),s=h.useMemo(()=>yY(r.search,n.current?null:t.current),[r.search]),o=ss(),i=h.useCallback((c,d)=>{const f=l1(typeof c=="function"?c(new URLSearchParams(s)):c);n.current=!0,o("?"+f,d)},[o,s]);return[s,i]}var qY=0,UY=()=>`__${String(++qY)}__`;function WY(){let{router:e}=L3("useSubmit"),{basename:t}=h.useContext(Pa),n=lY(),r=e.fetch,s=e.navigate;return h.useCallback(async(o,i={})=>{let{action:c,method:d,encType:f,formData:m,body:p}=jY(o,t);if(i.navigate===!1){let v=i.fetcherKey||UY();await r(v,n,i.action||c,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:m,body:p,formMethod:i.method||d,formEncType:i.encType||f,flushSync:i.flushSync})}else await s(i.action||c,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:m,body:p,formMethod:i.method||d,formEncType:i.encType||f,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[r,s,t,n])}function HY(e,{relative:t}={}){let{basename:n}=h.useContext(Pa),r=h.useContext(as);Bn(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),o={...ap(e||".",{relative:t})},i=Kr();if(e==null){o.search=i.search;let c=new URLSearchParams(o.search),d=c.getAll("index");if(d.some(m=>m==="")){c.delete("index"),d.filter(p=>p).forEach(p=>c.append("index",p));let m=c.toString();o.search=m?`?${m}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:_s([n,o.pathname])),cf(o)}function VY(e,{relative:t}={}){let n=h.useContext(A3);Bn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=L3("useViewTransitionState"),s=ap(e,{relative:t});if(!n.isTransitioning)return!1;let o=Mo(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Mo(n.nextLocation.pathname,r)||n.nextLocation.pathname;return gn(s.pathname,i)!=null||gn(s.pathname,o)!=null}var KY=Symbol.for("react.lazy"),jm=aC[" use ".trim().toString()];function GY(e){return typeof e=="object"&&e!==null&&"then"in e}function F3(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===KY&&"_payload"in e&&GY(e._payload)}function nv(e){const t=YY(e),n=h.forwardRef((r,s)=>{let{children:o,...i}=r;F3(o)&&typeof jm=="function"&&(o=jm(o._payload));const c=h.Children.toArray(o),d=c.find(QY);if(d){const f=d.props.children,m=c.map(p=>p===d?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var Pi=nv("Slot");function YY(e){const t=h.forwardRef((n,r)=>{let{children:s,...o}=n;if(F3(s)&&typeof jm=="function"&&(s=jm(s._payload)),h.isValidElement(s)){const i=ZY(s),c=JY(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var XY=Symbol("radix.slottable");function QY(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===XY}function JY(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const d=o(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function ZY(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const ob=768;function eX(){const[e,t]=h.useState(void 0);return h.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ob-1}px)`),r=()=>{t(window.innerWidth<ob)};return n.addEventListener("change",r),t(window.innerWidth<ob),()=>n.removeEventListener("change",r)},[]),!!e}const DC=Bl("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Z=h.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},o)=>{const i=r?Pi:"button";return a.jsx(i,{className:$e(DC({variant:t,size:n,className:e})),ref:o,...s})});Z.displayName="Button";const _t=h.forwardRef(({className:e,type:t,...n},r)=>a.jsx("input",{type:t,className:$e("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));_t.displayName="Input";var tX=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],nX=tX.reduce((e,t)=>{const n=nv(`Primitive.${t}`),r=h.forwardRef((s,o)=>{const{asChild:i,...c}=s,d=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),rX="Separator",OP="horizontal",aX=["horizontal","vertical"],z3=h.forwardRef((e,t)=>{const{decorative:n,orientation:r=OP,...s}=e,o=sX(r)?r:OP,c=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return a.jsx(nX.div,{"data-orientation":o,...c,...s,ref:t})});z3.displayName=rX;function sX(e){return aX.includes(e)}var B3=z3;const q3=h.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},s)=>a.jsx(B3,{ref:s,decorative:n,orientation:t,className:$e("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));q3.displayName=B3.displayName;var ib="focusScope.autoFocusOnMount",lb="focusScope.autoFocusOnUnmount",MP={bubbles:!1,cancelable:!0},oX="FocusScope",sp=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[c,d]=h.useState(null),f=Zn(s),m=Zn(o),p=h.useRef(null),v=Tt(t,y=>d(y)),x=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(r){let y=function(C){if(x.paused||!c)return;const k=C.target;c.contains(k)?p.current=k:mi(p.current,{select:!0})},b=function(C){if(x.paused||!c)return;const k=C.relatedTarget;k!==null&&(c.contains(k)||mi(p.current,{select:!0}))},S=function(C){if(document.activeElement===document.body)for(const A of C)A.removedNodes.length>0&&mi(c)};document.addEventListener("focusin",y),document.addEventListener("focusout",b);const N=new MutationObserver(S);return c&&N.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",b),N.disconnect()}}},[r,c,x.paused]),h.useEffect(()=>{if(c){$P.add(x);const y=document.activeElement;if(!c.contains(y)){const S=new CustomEvent(ib,MP);c.addEventListener(ib,f),c.dispatchEvent(S),S.defaultPrevented||(iX(fX(U3(c)),{select:!0}),document.activeElement===y&&mi(c))}return()=>{c.removeEventListener(ib,f),setTimeout(()=>{const S=new CustomEvent(lb,MP);c.addEventListener(lb,m),c.dispatchEvent(S),S.defaultPrevented||mi(y??document.body,{select:!0}),c.removeEventListener(lb,m),$P.remove(x)},0)}}},[c,f,m,x]);const j=h.useCallback(y=>{if(!n&&!r||x.paused)return;const b=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,S=document.activeElement;if(b&&S){const N=y.currentTarget,[C,k]=lX(N);C&&k?!y.shiftKey&&S===k?(y.preventDefault(),n&&mi(C,{select:!0})):y.shiftKey&&S===C&&(y.preventDefault(),n&&mi(k,{select:!0})):S===N&&y.preventDefault()}},[n,r,x.paused]);return a.jsx(lt.div,{tabIndex:-1,...i,ref:v,onKeyDown:j})});sp.displayName=oX;function iX(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(mi(r,{select:t}),document.activeElement!==n)return}function lX(e){const t=U3(e),n=IP(t,e),r=IP(t.reverse(),e);return[n,r]}function U3(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function IP(e,t){for(const n of e)if(!cX(n,{upTo:t}))return n}function cX(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function uX(e){return e instanceof HTMLInputElement&&"select"in e}function mi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&uX(e)&&t&&e.select()}}var $P=dX();function dX(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=DP(e,t),e.unshift(t)},remove(t){e=DP(e,t),e[0]?.resume()}}}function DP(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function fX(e){return e.filter(t=>t.tagName!=="A")}var cb=0;function rv(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??LP()),document.body.insertAdjacentElement("beforeend",e[1]??LP()),cb++,()=>{cb===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),cb--}},[])}function LP(){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 Ls=function(){return Ls=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Ls.apply(this,arguments)};function W3(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function pX(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var cm="right-scroll-bar-position",um="width-before-scroll-bar",hX="with-scroll-bars-hidden",mX="--removed-body-scroll-bar-size";function ub(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function gX(e,t){var n=h.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var vX=typeof window<"u"?h.useLayoutEffect:h.useEffect,FP=new WeakMap;function xX(e,t){var n=gX(null,function(r){return e.forEach(function(s){return ub(s,r)})});return vX(function(){var r=FP.get(n);if(r){var s=new Set(r),o=new Set(e),i=n.current;s.forEach(function(c){o.has(c)||ub(c,null)}),o.forEach(function(c){s.has(c)||ub(c,i)})}FP.set(n,e)},[e]),n}function yX(e){return e}function bX(e,t){t===void 0&&(t=yX);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(c){return o(c)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(o),i=n}var d=function(){var m=i;i=[],m.forEach(o)},f=function(){return Promise.resolve().then(d)};f(),n={push:function(m){i.push(m),f()},filter:function(m){return i=i.filter(m),n}}}};return s}function wX(e){e===void 0&&(e={});var t=bX(null);return t.options=Ls({async:!0,ssr:!1},e),t}var H3=function(e){var t=e.sideCar,n=W3(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return h.createElement(r,Ls({},n))};H3.isSideCarExport=!0;function jX(e,t){return e.useMedium(t),H3}var V3=wX(),db=function(){},av=h.forwardRef(function(e,t){var n=h.useRef(null),r=h.useState({onScrollCapture:db,onWheelCapture:db,onTouchMoveCapture:db}),s=r[0],o=r[1],i=e.forwardProps,c=e.children,d=e.className,f=e.removeScrollBar,m=e.enabled,p=e.shards,v=e.sideCar,x=e.noRelative,j=e.noIsolation,y=e.inert,b=e.allowPinchZoom,S=e.as,N=S===void 0?"div":S,C=e.gapMode,k=W3(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=v,E=xX([n,t]),P=Ls(Ls({},k),s);return h.createElement(h.Fragment,null,m&&h.createElement(A,{sideCar:V3,removeScrollBar:f,shards:p,noRelative:x,noIsolation:j,inert:y,setCallbacks:o,allowPinchZoom:!!b,lockRef:n,gapMode:C}),i?h.cloneElement(h.Children.only(c),Ls(Ls({},P),{ref:E})):h.createElement(N,Ls({},P,{className:d,ref:E}),c))});av.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};av.classNames={fullWidth:um,zeroRight:cm};var SX=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function NX(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=SX();return t&&e.setAttribute("nonce",t),e}function CX(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function _X(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var kX=function(){var e=0,t=null;return{add:function(n){e==0&&(t=NX())&&(CX(t,n),_X(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},AX=function(){var e=kX();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},K3=function(){var e=AX(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},EX={left:0,top:0,right:0,gap:0},fb=function(e){return parseInt(e||"",10)||0},PX=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[fb(n),fb(r),fb(s)]},RX=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return EX;var t=PX(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},TX=K3(),Uc="data-scroll-locked",OX=function(e,t,n,r){var s=e.left,o=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
12
+ .`.concat(hX,` {
13
+ overflow: hidden `).concat(r,`;
14
+ padding-right: `).concat(c,"px ").concat(r,`;
15
+ }
16
+ body[`).concat(Uc,`] {
17
+ overflow: hidden `).concat(r,`;
18
+ overscroll-behavior: contain;
19
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
20
+ padding-left: `.concat(s,`px;
21
+ padding-top: `).concat(o,`px;
22
+ padding-right: `).concat(i,`px;
23
+ margin-left:0;
24
+ margin-top:0;
25
+ margin-right: `).concat(c,"px ").concat(r,`;
26
+ `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
27
+ }
28
+
29
+ .`).concat(cm,` {
30
+ right: `).concat(c,"px ").concat(r,`;
31
+ }
32
+
33
+ .`).concat(um,` {
34
+ margin-right: `).concat(c,"px ").concat(r,`;
35
+ }
36
+
37
+ .`).concat(cm," .").concat(cm,` {
38
+ right: 0 `).concat(r,`;
39
+ }
40
+
41
+ .`).concat(um," .").concat(um,` {
42
+ margin-right: 0 `).concat(r,`;
43
+ }
44
+
45
+ body[`).concat(Uc,`] {
46
+ `).concat(mX,": ").concat(c,`px;
47
+ }
48
+ `)},zP=function(){var e=parseInt(document.body.getAttribute(Uc)||"0",10);return isFinite(e)?e:0},MX=function(){h.useEffect(function(){return document.body.setAttribute(Uc,(zP()+1).toString()),function(){var e=zP()-1;e<=0?document.body.removeAttribute(Uc):document.body.setAttribute(Uc,e.toString())}},[])},IX=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;MX();var o=h.useMemo(function(){return RX(s)},[s]);return h.createElement(TX,{styles:OX(o,!t,s,n?"":"!important")})},c1=!1;if(typeof window<"u")try{var $h=Object.defineProperty({},"passive",{get:function(){return c1=!0,!0}});window.addEventListener("test",$h,$h),window.removeEventListener("test",$h,$h)}catch{c1=!1}var bc=c1?{passive:!1}:!1,$X=function(e){return e.tagName==="TEXTAREA"},G3=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!$X(e)&&n[t]==="visible")},DX=function(e){return G3(e,"overflowY")},LX=function(e){return G3(e,"overflowX")},BP=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Y3(e,r);if(s){var o=X3(e,r),i=o[1],c=o[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},FX=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},zX=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Y3=function(e,t){return e==="v"?DX(t):LX(t)},X3=function(e,t){return e==="v"?FX(t):zX(t)},BX=function(e,t){return e==="h"&&t==="rtl"?-1:1},qX=function(e,t,n,r,s){var o=BX(e,window.getComputedStyle(t).direction),i=o*r,c=n.target,d=t.contains(c),f=!1,m=i>0,p=0,v=0;do{if(!c)break;var x=X3(e,c),j=x[0],y=x[1],b=x[2],S=y-b-o*j;(j||S)&&Y3(e,c)&&(p+=S,v+=j);var N=c.parentNode;c=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!d&&c!==document.body||d&&(t.contains(c)||t===c));return(m&&Math.abs(p)<1||!m&&Math.abs(v)<1)&&(f=!0),f},Dh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},qP=function(e){return[e.deltaX,e.deltaY]},UP=function(e){return e&&"current"in e?e.current:e},UX=function(e,t){return e[0]===t[0]&&e[1]===t[1]},WX=function(e){return`
49
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
50
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
51
+ `)},HX=0,wc=[];function VX(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),s=h.useState(HX++)[0],o=h.useState(K3)[0],i=h.useRef(e);h.useEffect(function(){i.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var y=pX([e.lockRef.current],(e.shards||[]).map(UP),!0).filter(Boolean);return y.forEach(function(b){return b.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),y.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var c=h.useCallback(function(y,b){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!i.current.allowPinchZoom;var S=Dh(y),N=n.current,C="deltaX"in y?y.deltaX:N[0]-S[0],k="deltaY"in y?y.deltaY:N[1]-S[1],A,E=y.target,P=Math.abs(C)>Math.abs(k)?"h":"v";if("touches"in y&&P==="h"&&E.type==="range")return!1;var O=window.getSelection(),D=O&&O.anchorNode,K=D?D===E||D.contains(E):!1;if(K)return!1;var q=BP(P,E);if(!q)return!0;if(q?A=P:(A=P==="v"?"h":"v",q=BP(P,E)),!q)return!1;if(!r.current&&"changedTouches"in y&&(C||k)&&(r.current=A),!A)return!0;var B=r.current||A;return qX(B,b,y,B==="h"?C:k)},[]),d=h.useCallback(function(y){var b=y;if(!(!wc.length||wc[wc.length-1]!==o)){var S="deltaY"in b?qP(b):Dh(b),N=t.current.filter(function(A){return A.name===b.type&&(A.target===b.target||b.target===A.shadowParent)&&UX(A.delta,S)})[0];if(N&&N.should){b.cancelable&&b.preventDefault();return}if(!N){var C=(i.current.shards||[]).map(UP).filter(Boolean).filter(function(A){return A.contains(b.target)}),k=C.length>0?c(b,C[0]):!i.current.noIsolation;k&&b.cancelable&&b.preventDefault()}}},[]),f=h.useCallback(function(y,b,S,N){var C={name:y,delta:b,target:S,should:N,shadowParent:KX(S)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(k){return k!==C})},1)},[]),m=h.useCallback(function(y){n.current=Dh(y),r.current=void 0},[]),p=h.useCallback(function(y){f(y.type,qP(y),y.target,c(y,e.lockRef.current))},[]),v=h.useCallback(function(y){f(y.type,Dh(y),y.target,c(y,e.lockRef.current))},[]);h.useEffect(function(){return wc.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:v}),document.addEventListener("wheel",d,bc),document.addEventListener("touchmove",d,bc),document.addEventListener("touchstart",m,bc),function(){wc=wc.filter(function(y){return y!==o}),document.removeEventListener("wheel",d,bc),document.removeEventListener("touchmove",d,bc),document.removeEventListener("touchstart",m,bc)}},[]);var x=e.removeScrollBar,j=e.inert;return h.createElement(h.Fragment,null,j?h.createElement(o,{styles:WX(s)}):null,x?h.createElement(IX,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function KX(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const GX=jX(V3,VX);var op=h.forwardRef(function(e,t){return h.createElement(av,Ls({},e,{ref:t,sideCar:GX}))});op.classNames=av.classNames;var YX=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},jc=new WeakMap,Lh=new WeakMap,Fh={},pb=0,Q3=function(e){return e&&(e.host||Q3(e.parentNode))},XX=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Q3(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},QX=function(e,t,n,r){var s=XX(t,Array.isArray(e)?e:[e]);Fh[n]||(Fh[n]=new WeakMap);var o=Fh[n],i=[],c=new Set,d=new Set(s),f=function(p){!p||c.has(p)||(c.add(p),f(p.parentNode))};s.forEach(f);var m=function(p){!p||d.has(p)||Array.prototype.forEach.call(p.children,function(v){if(c.has(v))m(v);else try{var x=v.getAttribute(r),j=x!==null&&x!=="false",y=(jc.get(v)||0)+1,b=(o.get(v)||0)+1;jc.set(v,y),o.set(v,b),i.push(v),y===1&&j&&Lh.set(v,!0),b===1&&v.setAttribute(n,"true"),j||v.setAttribute(r,"true")}catch(S){console.error("aria-hidden: cannot operate on ",v,S)}})};return m(t),c.clear(),pb++,function(){i.forEach(function(p){var v=jc.get(p)-1,x=o.get(p)-1;jc.set(p,v),o.set(p,x),v||(Lh.has(p)||p.removeAttribute(r),Lh.delete(p)),x||p.removeAttribute(n)}),pb--,pb||(jc=new WeakMap,jc=new WeakMap,Lh=new WeakMap,Fh={})}},sv=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=YX(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),QX(r,s,n,"aria-hidden")):function(){return null}};function JX(e){const t=ZX(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),d=c.find(tQ);if(d){const f=d.props.children,m=c.map(p=>p===d?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function ZX(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=rQ(s),c=nQ(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var eQ=Symbol("radix.slottable");function tQ(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eQ}function nQ(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const d=o(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function rQ(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ov="Dialog",[J3,Z3]=kr(ov),[aQ,Rs]=J3(ov),eL=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,c=h.useRef(null),d=h.useRef(null),[f,m]=Aa({prop:r,defaultProp:s??!1,onChange:o,caller:ov});return a.jsx(aQ,{scope:t,triggerRef:c,contentRef:d,contentId:fr(),titleId:fr(),descriptionId:fr(),open:f,onOpenChange:m,onOpenToggle:h.useCallback(()=>m(p=>!p),[m]),modal:i,children:n})};eL.displayName=ov;var tL="DialogTrigger",nL=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Rs(tL,n),o=Tt(t,s.triggerRef);return a.jsx(lt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":zC(s.open),...r,ref:o,onClick:We(e.onClick,s.onOpenToggle)})});nL.displayName=tL;var LC="DialogPortal",[sQ,rL]=J3(LC,{forceMount:void 0}),aL=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=Rs(LC,t);return a.jsx(sQ,{scope:t,forceMount:n,children:h.Children.map(r,i=>a.jsx(ar,{present:n||o.open,children:a.jsx(zl,{asChild:!0,container:s,children:i})}))})};aL.displayName=LC;var Sm="DialogOverlay",sL=h.forwardRef((e,t)=>{const n=rL(Sm,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Rs(Sm,e.__scopeDialog);return o.modal?a.jsx(ar,{present:r||o.open,children:a.jsx(iQ,{...s,ref:t})}):null});sL.displayName=Sm;var oQ=JX("DialogOverlay.RemoveScroll"),iQ=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Rs(Sm,n);return a.jsx(op,{as:oQ,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(lt.div,{"data-state":zC(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Nl="DialogContent",oL=h.forwardRef((e,t)=>{const n=rL(Nl,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Rs(Nl,e.__scopeDialog);return a.jsx(ar,{present:r||o.open,children:o.modal?a.jsx(lQ,{...s,ref:t}):a.jsx(cQ,{...s,ref:t})})});oL.displayName=Nl;var lQ=h.forwardRef((e,t)=>{const n=Rs(Nl,e.__scopeDialog),r=h.useRef(null),s=Tt(t,n.contentRef,r);return h.useEffect(()=>{const o=r.current;if(o)return sv(o)},[]),a.jsx(iL,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:We(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:We(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&o.preventDefault()}),onFocusOutside:We(e.onFocusOutside,o=>o.preventDefault())})}),cQ=h.forwardRef((e,t)=>{const n=Rs(Nl,e.__scopeDialog),r=h.useRef(!1),s=h.useRef(!1);return a.jsx(iL,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;n.triggerRef.current?.contains(i)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),iL=h.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,c=Rs(Nl,n),d=h.useRef(null),f=Tt(t,d);return rv(),a.jsxs(a.Fragment,{children:[a.jsx(sp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:a.jsx(Fl,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":zC(c.open),...i,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(dQ,{titleId:c.titleId}),a.jsx(pQ,{contentRef:d,descriptionId:c.descriptionId})]})]})}),FC="DialogTitle",lL=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Rs(FC,n);return a.jsx(lt.h2,{id:s.titleId,...r,ref:t})});lL.displayName=FC;var cL="DialogDescription",uL=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Rs(cL,n);return a.jsx(lt.p,{id:s.descriptionId,...r,ref:t})});uL.displayName=cL;var dL="DialogClose",fL=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Rs(dL,n);return a.jsx(lt.button,{type:"button",...r,ref:t,onClick:We(e.onClick,()=>s.onOpenChange(!1))})});fL.displayName=dL;function zC(e){return e?"open":"closed"}var pL="DialogTitleWarning",[uQ,hL]=x9(pL,{contentName:Nl,titleName:FC,docsSlug:"dialog"}),dQ=({titleId:e})=>{const t=hL(pL),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
52
+
53
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
54
+
55
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},fQ="DialogDescriptionWarning",pQ=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${hL(fQ).contentName}}.`;return h.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},iv=eL,hQ=nL,lv=aL,Ou=sL,Mu=oL,ip=lL,lp=uL,cv=fL;const mL=iv,mQ=lv,gL=h.forwardRef(({className:e,...t},n)=>a.jsx(Ou,{className:$e("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));gL.displayName=Ou.displayName;const gQ=Bl("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),BC=h.forwardRef(({side:e="right",className:t,children:n,...r},s)=>a.jsxs(mQ,{children:[a.jsx(gL,{}),a.jsxs(Mu,{ref:s,className:$e(gQ({side:e}),t),...r,children:[n,a.jsxs(cv,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[a.jsx(ua,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));BC.displayName=Mu.displayName;const vL=({className:e,...t})=>a.jsx("div",{className:$e("flex flex-col space-y-2 text-center sm:text-left",e),...t});vL.displayName="SheetHeader";const xL=h.forwardRef(({className:e,...t},n)=>a.jsx(ip,{ref:n,className:$e("text-lg font-semibold text-foreground",e),...t}));xL.displayName=ip.displayName;const vQ=h.forwardRef(({className:e,...t},n)=>a.jsx(lp,{ref:n,className:$e("text-sm text-muted-foreground",e),...t}));vQ.displayName=lp.displayName;function WP({className:e,...t}){return a.jsx("div",{className:$e("animate-pulse rounded-md bg-muted",e),...t})}const xQ="sidebar:state",yQ=3600*24*7,bQ="16rem",wQ="18rem",jQ="3rem",SQ="b",yL=h.createContext(null);function cp(){const e=h.useContext(yL);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const bL=h.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:s,children:o,...i},c)=>{const d=eX(),[f,m]=h.useState(!1),[p,v]=h.useState(e),x=t??p,j=h.useCallback(N=>{const C=typeof N=="function"?N(x):N;n?n(C):v(C),document.cookie=`${xQ}=${C}; path=/; max-age=${yQ}`},[n,x]),y=h.useCallback(()=>d?m(N=>!N):j(N=>!N),[d,j,m]);h.useEffect(()=>{const N=C=>{C.key===SQ&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),y())};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[y]);const b=x?"expanded":"collapsed",S=h.useMemo(()=>({state:b,open:x,setOpen:j,isMobile:d,openMobile:f,setOpenMobile:m,toggleSidebar:y}),[b,x,j,d,f,m,y]);return a.jsx(yL.Provider,{value:S,children:a.jsx(Ro,{delayDuration:0,children:a.jsx("div",{style:{"--sidebar-width":bQ,"--sidebar-width-icon":jQ,...s},className:$e("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",r),ref:c,...i,children:o})})})});bL.displayName="SidebarProvider";const wL=h.forwardRef(({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:s,...o},i)=>{const{isMobile:c,state:d,openMobile:f,setOpenMobile:m}=cp();return n==="none"?a.jsx("div",{className:$e("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",r),ref:i,...o,children:s}):c?a.jsx(mL,{open:f,onOpenChange:m,...o,children:a.jsx(BC,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":wQ},side:e,children:a.jsx("div",{className:"flex h-full w-full flex-col",children:s})})}):a.jsxs("div",{ref:i,className:"group peer hidden text-sidebar-foreground md:block","data-state":d,"data-collapsible":d==="collapsed"?n:"","data-variant":t,"data-side":e,children:[a.jsx("div",{className:$e("relative h-svh w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),a.jsx("div",{className:$e("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...o,children:a.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:s})})]})});wL.displayName="Sidebar";const jL=h.forwardRef(({className:e,onClick:t,...n},r)=>{const{toggleSidebar:s}=cp();return a.jsxs(Z,{ref:r,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:$e("h-7 w-7",e),onClick:o=>{t?.(o),s()},...n,children:[a.jsx(kW,{}),a.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});jL.displayName="SidebarTrigger";const NQ=h.forwardRef(({className:e,...t},n)=>{const{toggleSidebar:r}=cp();return a.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:$e("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 hover:after:bg-sidebar-border sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});NQ.displayName="SidebarRail";const CQ=h.forwardRef(({className:e,...t},n)=>a.jsx("main",{ref:n,className:$e("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));CQ.displayName="SidebarInset";const _Q=h.forwardRef(({className:e,...t},n)=>a.jsx(_t,{ref:n,"data-sidebar":"input",className:$e("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));_Q.displayName="SidebarInput";const SL=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,"data-sidebar":"header",className:$e("flex flex-col gap-2 p-2",e),...t}));SL.displayName="SidebarHeader";const NL=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,"data-sidebar":"footer",className:$e("flex flex-col gap-2 p-2",e),...t}));NL.displayName="SidebarFooter";const u1=h.forwardRef(({className:e,...t},n)=>a.jsx(q3,{ref:n,"data-sidebar":"separator",className:$e("mx-2 w-auto bg-sidebar-border",e),...t}));u1.displayName="SidebarSeparator";const CL=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,"data-sidebar":"content",className:$e("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));CL.displayName="SidebarContent";const _L=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,"data-sidebar":"group",className:$e("relative flex w-full min-w-0 flex-col p-2",e),...t}));_L.displayName="SidebarGroup";const kL=h.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const s=t?Pi:"div";return a.jsx(s,{ref:r,"data-sidebar":"group-label",className:$e("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...n})});kL.displayName="SidebarGroupLabel";const kQ=h.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const s=t?Pi:"button";return a.jsx(s,{ref:r,"data-sidebar":"group-action",className:$e("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...n})});kQ.displayName="SidebarGroupAction";const AL=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,"data-sidebar":"group-content",className:$e("w-full text-sm",e),...t}));AL.displayName="SidebarGroupContent";const EL=h.forwardRef(({className:e,...t},n)=>a.jsx("ul",{ref:n,"data-sidebar":"menu",className:$e("flex w-full min-w-0 flex-col gap-1",e),...t}));EL.displayName="SidebarMenu";const PL=h.forwardRef(({className:e,...t},n)=>a.jsx("li",{ref:n,"data-sidebar":"menu-item",className:$e("group/menu-item relative",e),...t}));PL.displayName="SidebarMenuItem";const AQ=Bl("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),RL=h.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n="default",size:r="default",tooltip:s,className:o,...i},c)=>{const d=e?Pi:"button",{isMobile:f,state:m}=cp(),p=a.jsx(d,{ref:c,"data-sidebar":"menu-button","data-size":r,"data-active":t,className:$e(AQ({variant:n,size:r}),o),...i});return s?(typeof s=="string"&&(s={children:s}),a.jsxs(To,{children:[a.jsx(Oo,{asChild:!0,children:p}),a.jsx(Gs,{side:"right",align:"center",hidden:m!=="collapsed"||f,...s})]})):p});RL.displayName="SidebarMenuButton";const EQ=h.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},s)=>{const o=t?Pi:"button";return a.jsx(o,{ref:s,"data-sidebar":"menu-action",className:$e("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...r})});EQ.displayName="SidebarMenuAction";const PQ=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:$e("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));PQ.displayName="SidebarMenuBadge";const RQ=h.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{const s=h.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return a.jsxs("div",{ref:r,"data-sidebar":"menu-skeleton",className:$e("flex h-8 items-center gap-2 rounded-md px-2",e),...n,children:[t&&a.jsx(WP,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),a.jsx(WP,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":s}})]})});RQ.displayName="SidebarMenuSkeleton";const TQ=h.forwardRef(({className:e,...t},n)=>a.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:$e("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));TQ.displayName="SidebarMenuSub";const OQ=h.forwardRef(({...e},t)=>a.jsx("li",{ref:t,...e}));OQ.displayName="SidebarMenuSubItem";const MQ=h.forwardRef(({asChild:e=!1,size:t="md",isActive:n,className:r,...s},o)=>{const i=e?Pi:"a";return a.jsx(i,{ref:o,"data-sidebar":"menu-sub-button","data-size":t,"data-active":n,className:$e("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",r),...s})});MQ.displayName="SidebarMenuSubButton";const TL=h.forwardRef(({className:e,activeClassName:t,pendingClassName:n,to:r,...s},o)=>a.jsx(D3,{ref:o,to:r,className:({isActive:i,isPending:c})=>$e(e,i&&t,c&&n),...s}));TL.displayName="NavLink";function IQ({width:e=24,height:t=24,from:n="#53afba",to:r="#76fffb",...s}){const o=`grad-${h.useId().slice(1)}`;return a.jsxs("svg",{className:"inline-block",width:e,height:t,viewBox:"0 0 1648 1648",xmlns:"http://www.w3.org/2000/svg",...s,children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:o,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[a.jsx("stop",{offset:"0%",style:{stopColor:n}}),a.jsx("stop",{offset:"100%",style:{stopColor:r}})]})}),a.jsx("path",{d:"m610 216.654c-66.158 4.092-126.119 35.849-164.917 87.346-8.408 11.16-13.344 19.191-19.983 32.513-12.431 24.946-19.521 50.434-22.11 79.487-1.665 18.687-.854 826.238.841 837.939 7.867 54.284 32.465 101.134 70.706 134.667 16.297 14.291 32.283 24.657 53.963 34.991 16.889 8.05 34.568 13.468 60.5 18.541 9.019 1.764 52.201 1.795 61.5.044 26.487-4.989 43.97-10.341 61-18.675 15.131-7.406 21.53-11.135 60.5-35.267 20.813-12.887 23.095-14.298 29.5-18.24l13-8 13-8c6.901-4.247 12.593-7.767 29.54-18.271 5.796-3.593 12.771-7.863 15.5-9.49 2.728-1.626 8.56-5.19 12.96-7.921 4.4-2.73 72.575-44.711 151.5-93.29s150.925-92.918 160-98.531c9.075-5.612 24.15-14.936 33.5-20.719s23.075-14.234 30.5-18.78c85.169-52.142 120.029-73.942 130.014-81.304 40.974-30.211 68.344-69.764 81.788-118.194 13.864-49.94 8.549-104.847-14.809-153-16.836-34.708-41.252-62.432-74.993-85.154-4.125-2.778-17.625-11.26-30-18.849s-27-16.594-32.5-20.009c-5.5-3.416-109.45-67.427-231-142.246-306.386-188.593-335.221-206.352-350-215.553-30.562-19.028-59.301-29.911-90-34.083-11.697-1.59-30.408-2.514-39.5-1.952m-10.5 77.269c-39.541 6.402-76.013 29.73-97.661 62.467-13.001 19.66-19.718 38.39-22.802 63.584-1.472 12.028-1.434 802.191.04 818.026 1.861 19.998 6.142 35.48 14.415 52.133 17.942 36.114 53.025 64.18 91.508 73.203 3.575.839 8.975 2.118 12 2.844 8.221 1.973 40.343 1.613 49.971-.56 32.301-7.289 65.233-26.686 94.817-55.849 15.26-15.042 22.884-24.803 33.571-42.979 13.939-23.706 20.949-43.36 27.745-77.792 1.004-5.086 1.428-50 1.949-206.5.465-139.686 1.001-201.809 1.777-206 .611-3.3 1.608-9.15 2.217-13 1.672-10.583 4.039-21.117 7.191-32 8.179-28.247 20.714-55.13 37.188-79.751 24.262-36.262 53.189-63.572 93.074-87.872 4.95-3.016 12.825-7.435 17.5-9.82s8.95-4.668 9.5-5.074c3.565-2.63 34.688-13.266 52.465-17.93 6.2-1.627 11.49-3.174 11.754-3.439 1.003-1.002-1.016-2.602-10.967-8.689-5.639-3.449-16.552-10.172-24.252-14.94-13.435-8.319-31.76-19.604-58.5-36.029-6.875-4.222-16.1-9.911-20.5-12.641-7.667-4.758-73.088-45.103-122.5-75.546-75.227-46.348-108.509-66.591-116.5-70.86-9.422-5.033-25.23-10.76-37.043-13.419-7.967-1.794-40.076-2.843-47.957-1.567m473.5 305.564c-5.775.685-11.625 1.491-13 1.792-1.375.3-5.2 1.088-8.5 1.749-7.914 1.587-27.103 7.461-36.5 11.174-38.797 15.33-75.171 44.925-98.829 80.41-11.24 16.86-21.329 38.407-26.167 55.888-2.443 8.825-3.85 14.608-4.866 20-.621 3.3-1.653 8.475-2.292 11.5-.846 4.008-1.345 59.624-1.837 205-.618 182.331-.824 200.361-2.399 209.5-1.629 9.459-4.196 22.506-6.744 34.279-.628 2.903-.881 5.54-.561 5.859.596.596 455.986-279.084 472.195-290.001 17.547-11.819 36.335-33.412 46.291-53.203 3.956-7.863 9.527-23.924 11.597-33.434 4.848-22.272 3.572-48.26-3.506-71.387-6.907-22.572-18.055-40.93-35.316-58.158-12.705-12.681-16.829-15.485-79.066-53.756-7.15-4.397-15.7-9.654-19-11.684-3.3-2.029-8.925-5.504-12.5-7.722-53.826-33.397-67.199-40.611-88.616-47.8-29.343-9.85-61.599-13.421-90.384-10.006m-1066.25 1048.256c3.988.189 10.513.189 14.5 0 3.988-.19.725-.346-7.25-.346s-11.238.156-7.25.346",fill:`url(#${o})`,fillRule:"evenodd"})]})}const $Q=[{title:"Home",items:[{title:"Dashboard",url:"/",icon:dC}]},{title:"Lab",items:[{title:"MCP Evaluations",url:"/mcp-evaluations",icon:y5},{title:"Analyze MCP",url:"/tool-analysis",icon:w5},{title:"OAuth Debugger",url:"/oauth-debugger",icon:PW}]},{title:"Libraries",items:[{title:"Test Cases",url:"/libraries/test-cases",icon:uC},{title:"MCP servers",url:"/libraries/servers",icon:v5},{title:"Agents",url:"/libraries/agents",icon:Wr}]},{title:"Execution",items:[{title:"Run Evaluation",url:"/run",icon:Cs},{title:"Evaluation Results",url:"/results",icon:jl},{title:"Compare Evaluations",url:"/compare",icon:b5},{title:"MCP Analysis Results",url:"/tool-analysis-results",icon:j5},{title:"Custom Reports",url:"/markdown-reports",icon:Mc}]},{title:"Workspace",items:[{title:"Settings",url:"/settings",icon:hC},{title:"MCPLab MCP server",url:"/settings/mcp",icon:VS}]}];function DQ(e={version:null}){const t=e.version??null,{state:n}=cp(),r=n==="collapsed",s=Kr(),o=h.useMemo(()=>$Q,[]);return a.jsxs(wL,{collapsible:"icon",children:[a.jsx(SL,{className:`border-b border-sidebar-border py-3 ${r?"px-2":"px-4"}`,children:a.jsxs("div",{className:`flex items-center ${r?"justify-center overflow-visible":"gap-2.5 overflow-hidden"}`,children:[a.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-sidebar-accent/50 border border-primary/60",children:a.jsx(IQ,{width:22,height:22,from:"#f97316",to:"#fb923c"})}),!r&&a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-semibold text-sidebar-foreground",children:"MCPLab"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"MCP Evaluation Lab"})]})]})}),a.jsx(CL,{children:o.map((i,c)=>a.jsxs("div",{children:[c>0&&!r&&a.jsx(u1,{className:"my-1.5"}),a.jsxs(_L,{className:r?"px-2":"px-3 py-2",children:[!r&&a.jsx(kL,{className:"px-1 pb-1.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/90",children:i.title}),a.jsx(AL,{children:a.jsx(EL,{children:i.items.map(d=>a.jsx(PL,{children:a.jsx(RL,{asChild:!0,isActive:d.url==="/"?s.pathname==="/":d.url==="/settings"?s.pathname==="/settings":s.pathname.startsWith(d.url),tooltip:d.title,children:a.jsxs(TL,{to:d.url,end:d.url==="/"||d.url==="/settings",activeClassName:"bg-sidebar-accent text-sidebar-accent-foreground",children:[a.jsx(d.icon,{className:"h-4 w-4"}),a.jsx("span",{children:d.title})]})})},d.title))})})]})]},i.title))}),a.jsxs(NL,{className:r?"px-2 py-2":"px-3 py-3",children:[a.jsx(u1,{className:"my-1.5"}),a.jsxs("div",{className:`flex ${r?"justify-center":"items-center justify-center gap-2"} w-full`,children:[a.jsxs("a",{href:"https://github.com/inspectr-hq/mcplab",target:"_blank",rel:"noreferrer",className:`inline-flex items-center rounded-md border border-sidebar-border/70 bg-sidebar-accent/20 text-sidebar-foreground/85 transition-colors hover:bg-sidebar-accent/35 hover:text-sidebar-foreground ${r?"justify-center p-2":"gap-2 px-2.5 py-1.5"}`,title:`GitHub${t?` · v${t}`:""}`,"aria-label":"GitHub repository",children:[a.jsx(wW,{className:"h-4 w-4 shrink-0"}),!r&&a.jsx("span",{className:"text-xs text-sidebar-foreground/85",children:`v${t??"unknown"}`})]}),!r&&a.jsxs("a",{href:"https://inspectr.dev",target:"_blank",rel:"noreferrer",className:"text-xs text-muted-foreground transition-colors hover:text-sidebar-foreground",children:["Built by ",a.jsx("span",{className:"text-[#00e5ff] hover:text-[#00b8d4]",children:"Inspectr"})]})]})]})]})}const OL=h.forwardRef(({...e},t)=>a.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));OL.displayName="Breadcrumb";const ML=h.forwardRef(({className:e,...t},n)=>a.jsx("ol",{ref:n,className:$e("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));ML.displayName="BreadcrumbList";const IL=h.forwardRef(({className:e,...t},n)=>a.jsx("li",{ref:n,className:$e("inline-flex items-center gap-1.5",e),...t}));IL.displayName="BreadcrumbItem";const $L=h.forwardRef(({asChild:e,className:t,...n},r)=>{const s=e?Pi:"a";return a.jsx(s,{ref:r,className:$e("transition-colors hover:text-foreground",t),...n})});$L.displayName="BreadcrumbLink";const DL=h.forwardRef(({className:e,...t},n)=>a.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:$e("font-normal text-foreground",e),...t}));DL.displayName="BreadcrumbPage";const LL=({children:e,className:t,...n})=>a.jsx("li",{role:"presentation","aria-hidden":"true",className:$e("[&>svg]:size-3.5",t),...n,children:e??a.jsx(Fg,{})});LL.displayName="BreadcrumbSeparator";function Fs(){return{input:0,output:0,total:0,hasInput:!1,hasOutput:!1,hasTotal:!1}}function Ec(e,t){t&&(typeof t.inputTokens=="number"&&(e.input+=t.inputTokens,e.hasInput=!0),typeof t.outputTokens=="number"&&(e.output+=t.outputTokens,e.hasOutput=!0),typeof t.totalTokens=="number"&&(e.total+=t.totalTokens,e.hasTotal=!0))}function xo(e){return!e.hasInput&&!e.hasOutput&&!e.hasTotal?null:{inputTokens:e.hasInput?e.input:null,outputTokens:e.hasOutput?e.output:null,totalTokens:e.hasTotal?e.total:null}}function LQ(e){const t=Fs();for(const n of e)Ec(t,n);return xo(t)}const FQ={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",pdf:"application/pdf",txt:"text/plain",md:"text/markdown",csv:"text/csv"};function zQ(e){return e.startsWith("image/")?"image":"document"}function BQ(e){return e?.split(".").pop()?.toLowerCase()??""}function qQ(e){if(e.media_type)return e.media_type;if(e.path)return FQ[BQ(e.path)]}function d1(e){const t={passed:0,failed:0,not_evaluated:0,total:0};for(const n of e){if(n.status==="passed")t.passed+=1;else if(n.status==="failed")t.failed+=1;else if(n.status==="not_evaluated")t.not_evaluated+=1;else continue;t.total+=1}return t}class UQ{add(t,n,r){if(typeof arguments[0]!="string")for(let s in arguments[0])this.add(s,arguments[0][s],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(s){this[s]=this[s]||[],n&&this[s][r?"unshift":"push"](n)},this)}run(t,n){this[t]=this[t]||[],this[t].forEach(function(r){r.call(n&&n.context?n.context:n,n)})}}class WQ{constructor(t){this.jsep=t,this.registered={}}register(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach(s=>{if(typeof s!="object"||!s.name||!s.init)throw new Error("Invalid JSEP plugin format");this.registered[s.name]||(s.init(this.jsep),this.registered[s.name]=s)})}}class Ae{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+Ae.version}static addUnaryOp(t){return Ae.max_unop_len=Math.max(t.length,Ae.max_unop_len),Ae.unary_ops[t]=1,Ae}static addBinaryOp(t,n,r){return Ae.max_binop_len=Math.max(t.length,Ae.max_binop_len),Ae.binary_ops[t]=n,r?Ae.right_associative.add(t):Ae.right_associative.delete(t),Ae}static addIdentifierChar(t){return Ae.additional_identifier_chars.add(t),Ae}static addLiteral(t,n){return Ae.literals[t]=n,Ae}static removeUnaryOp(t){return delete Ae.unary_ops[t],t.length===Ae.max_unop_len&&(Ae.max_unop_len=Ae.getMaxKeyLen(Ae.unary_ops)),Ae}static removeAllUnaryOps(){return Ae.unary_ops={},Ae.max_unop_len=0,Ae}static removeIdentifierChar(t){return Ae.additional_identifier_chars.delete(t),Ae}static removeBinaryOp(t){return delete Ae.binary_ops[t],t.length===Ae.max_binop_len&&(Ae.max_binop_len=Ae.getMaxKeyLen(Ae.binary_ops)),Ae.right_associative.delete(t),Ae}static removeAllBinaryOps(){return Ae.binary_ops={},Ae.max_binop_len=0,Ae}static removeLiteral(t){return delete Ae.literals[t],Ae}static removeAllLiterals(){return Ae.literals={},Ae}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new Ae(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(n=>n.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return Ae.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!Ae.binary_ops[String.fromCharCode(t)]||Ae.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return Ae.isIdentifierStart(t)||Ae.isDecimalDigit(t)}throwError(t){const n=new Error(t+" at character "+this.index);throw n.index=this.index,n.description=t,n}runHook(t,n){if(Ae.hooks[t]){const r={context:this,node:n};return Ae.hooks.run(t,r),r.node}return n}searchHook(t){if(Ae.hooks[t]){const n={context:this};return Ae.hooks[t].find(function(r){return r.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===Ae.SPACE_CODE||t===Ae.TAB_CODE||t===Ae.LF_CODE||t===Ae.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:Ae.COMPOUND,body:t};return this.runHook("after-all",n)}gobbleExpressions(t){let n=[],r,s;for(;this.index<this.expr.length;)if(r=this.code,r===Ae.SEMCOL_CODE||r===Ae.COMMA_CODE)this.index++;else if(s=this.gobbleExpression())n.push(s);else if(this.index<this.expr.length){if(r===t)break;this.throwError('Unexpected "'+this.char+'"')}return n}gobbleExpression(){const t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,Ae.max_binop_len),n=t.length;for(;n>0;){if(Ae.binary_ops.hasOwnProperty(t)&&(!Ae.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!Ae.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=n,t;t=t.substr(0,--n)}return!1}gobbleBinaryExpression(){let t,n,r,s,o,i,c,d,f;if(i=this.gobbleToken(),!i||(n=this.gobbleBinaryOp(),!n))return i;for(o={value:n,prec:Ae.binaryPrecedence(n),right_a:Ae.right_associative.has(n)},c=this.gobbleToken(),c||this.throwError("Expected expression after "+n),s=[i,o,c];n=this.gobbleBinaryOp();){if(r=Ae.binaryPrecedence(n),r===0){this.index-=n.length;break}o={value:n,prec:r,right_a:Ae.right_associative.has(n)},f=n;const m=p=>o.right_a&&p.right_a?r>p.prec:r<=p.prec;for(;s.length>2&&m(s[s.length-2]);)c=s.pop(),n=s.pop().value,i=s.pop(),t={type:Ae.BINARY_EXP,operator:n,left:i,right:c},s.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+f),s.push(o,t)}for(d=s.length-1,t=s[d];d>1;)t={type:Ae.BINARY_EXP,operator:s[d-1].value,left:s[d-2],right:t},d-=2;return t}gobbleToken(){let t,n,r,s;if(this.gobbleSpaces(),s=this.searchHook("gobble-token"),s)return this.runHook("after-token",s);if(t=this.code,Ae.isDecimalDigit(t)||t===Ae.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===Ae.SQUOTE_CODE||t===Ae.DQUOTE_CODE)s=this.gobbleStringLiteral();else if(t===Ae.OBRACK_CODE)s=this.gobbleArray();else{for(n=this.expr.substr(this.index,Ae.max_unop_len),r=n.length;r>0;){if(Ae.unary_ops.hasOwnProperty(n)&&(!Ae.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!Ae.isIdentifierPart(this.expr.charCodeAt(this.index+n.length)))){this.index+=r;const o=this.gobbleToken();return o||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:Ae.UNARY_EXP,operator:n,argument:o,prefix:!0})}n=n.substr(0,--r)}Ae.isIdentifierStart(t)?(s=this.gobbleIdentifier(),Ae.literals.hasOwnProperty(s.name)?s={type:Ae.LITERAL,value:Ae.literals[s.name],raw:s.name}:s.name===Ae.this_str&&(s={type:Ae.THIS_EXP})):t===Ae.OPAREN_CODE&&(s=this.gobbleGroup())}return s?(s=this.gobbleTokenProperty(s),this.runHook("after-token",s)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let n=this.code;for(;n===Ae.PERIOD_CODE||n===Ae.OBRACK_CODE||n===Ae.OPAREN_CODE||n===Ae.QUMARK_CODE;){let r;if(n===Ae.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==Ae.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===Ae.OBRACK_CODE?(t={type:Ae.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),n=this.code,n!==Ae.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===Ae.OPAREN_CODE?t={type:Ae.CALL_EXP,arguments:this.gobbleArguments(Ae.CPAREN_CODE),callee:t}:(n===Ae.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),t={type:Ae.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),r&&(t.optional=!0),this.gobbleSpaces(),n=this.code}return t}gobbleNumericLiteral(){let t="",n,r;for(;Ae.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===Ae.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);Ae.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(n=this.char,n==="e"||n==="E"){for(t+=this.expr.charAt(this.index++),n=this.char,(n==="+"||n==="-")&&(t+=this.expr.charAt(this.index++));Ae.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);Ae.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return r=this.code,Ae.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(r===Ae.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===Ae.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:Ae.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="";const n=this.index,r=this.expr.charAt(this.index++);let s=!1;for(;this.index<this.expr.length;){let o=this.expr.charAt(this.index++);if(o===r){s=!0;break}else if(o==="\\")switch(o=this.expr.charAt(this.index++),o){case"n":t+=`
56
+ `;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=o}else t+=o}return s||this.throwError('Unclosed quote after "'+t+'"'),{type:Ae.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let t=this.code,n=this.index;for(Ae.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,Ae.isIdentifierPart(t));)this.index++;return{type:Ae.IDENTIFIER,name:this.expr.slice(n,this.index)}}gobbleArguments(t){const n=[];let r=!1,s=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===t){r=!0,this.index++,t===Ae.CPAREN_CODE&&s&&s>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(o===Ae.COMMA_CODE){if(this.index++,s++,s!==n.length){if(t===Ae.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===Ae.CBRACK_CODE)for(let i=n.length;i<s;i++)n.push(null)}}else if(n.length!==s&&s!==0)this.throwError("Expected comma");else{const i=this.gobbleExpression();(!i||i.type===Ae.COMPOUND)&&this.throwError("Expected comma"),n.push(i)}}return r||this.throwError("Expected "+String.fromCharCode(t)),n}gobbleGroup(){this.index++;let t=this.gobbleExpressions(Ae.CPAREN_CODE);if(this.code===Ae.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:Ae.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:Ae.ARRAY_EXP,elements:this.gobbleArguments(Ae.CBRACK_CODE)}}}const HQ=new UQ;Object.assign(Ae,{hooks:HQ,plugins:new WQ(Ae),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});Ae.max_unop_len=Ae.getMaxKeyLen(Ae.unary_ops);Ae.max_binop_len=Ae.getMaxKeyLen(Ae.binary_ops);const Io=e=>new Ae(e).parse(),VQ=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(Ae).filter(e=>!VQ.includes(e)&&Io[e]===void 0).forEach(e=>{Io[e]=Ae[e]});Io.Jsep=Ae;const KQ="ConditionalExpression";var GQ={name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;const r=n.node,s=this.gobbleExpression();if(s||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const o=this.gobbleExpression();if(o||this.throwError("Expected expression"),n.node={type:KQ,test:r,consequent:s,alternate:o},r.operator&&e.binary_ops[r.operator]<=.9){let i=r;for(;i.right.operator&&e.binary_ops[i.right.operator]<=.9;)i=i.right;n.node.test=i.right,i.right=n.node,n.node=r}}else this.throwError("Expected :")}})}};Io.plugins.register(GQ);const HP=47,YQ=92;var XQ={name:"regex",init(e){e.hooks.add("gobble-token",function(n){if(this.code===HP){const r=++this.index;let s=!1;for(;this.index<this.expr.length;){if(this.code===HP&&!s){const o=this.expr.slice(r,this.index);let i="";for(;++this.index<this.expr.length;){const d=this.code;if(d>=97&&d<=122||d>=65&&d<=90||d>=48&&d<=57)i+=this.char;else break}let c;try{c=new RegExp(o,i)}catch(d){this.throwError(d.message)}return n.node={type:e.LITERAL,value:c,raw:this.expr.slice(r-1,this.index)},n.node=this.gobbleTokenProperty(n.node),n.node}this.code===e.OBRACK_CODE?s=!0:s&&this.code===e.CBRACK_CODE&&(s=!1),this.index+=this.code===YQ?2:1}this.throwError("Unclosed Regex")}})}};const hb=43,QQ=45,Pc={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[hb,QQ],assignmentPrecedence:.9,init(e){const t=[e.IDENTIFIER,e.MEMBER_EXP];Pc.assignmentOperators.forEach(r=>e.addBinaryOp(r,Pc.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(s){const o=this.code;Pc.updateOperators.some(i=>i===o&&i===this.expr.charCodeAt(this.index+1))&&(this.index+=2,s.node={type:"UpdateExpression",operator:o===hb?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!s.node.argument||!t.includes(s.node.argument.type))&&this.throwError(`Unexpected ${s.node.operator}`))}),e.hooks.add("after-token",function(s){if(s.node){const o=this.code;Pc.updateOperators.some(i=>i===o&&i===this.expr.charCodeAt(this.index+1))&&(t.includes(s.node.type)||this.throwError(`Unexpected ${s.node.operator}`),this.index+=2,s.node={type:"UpdateExpression",operator:o===hb?"++":"--",argument:s.node,prefix:!1})}}),e.hooks.add("after-expression",function(s){s.node&&n(s.node)});function n(r){Pc.assignmentOperators.has(r.operator)?(r.type="AssignmentExpression",n(r.left),n(r.right)):r.operator||Object.values(r).forEach(s=>{s&&typeof s=="object"&&n(s)})}}};Io.plugins.register(XQ,Pc);Io.addUnaryOp("typeof");Io.addUnaryOp("void");Io.addLiteral("null",null);Io.addLiteral("undefined",void 0);function mb(e){const t=e.type==="contains"?`contains ${e.value}`:e.type==="regex"?`matches regex ${e.pattern}`:e.equals!==void 0?`JSONPath ${e.path} == ${String(e.equals)}`:`JSONPath ${e.path} exists`;return`Tool input · ${e.tool} ${t}`}function JQ(e){return e.type==="contains"||e.type==="regex"}function Ad(e,t){if(t==="tool_not_used")return`Tool input assertion failed: tool not used: ${e.tool}`;if(t==="invalid_regex"&&e.type==="regex")return`Tool input assertion failed: invalid regex ${e.pattern}`;const n=e.type==="contains"?`contains ${e.value}`:e.type==="regex"?`regex ${e.pattern}`:e.equals!==void 0?`JSONPath ${e.path} == ${String(e.equals)}`:`JSONPath ${e.path} exists`;return t==="invalid_jsonpath"&&e.type==="jsonpath"?`Tool input assertion failed: invalid JSONPath ${e.path} (expected: ${n})`:t==="serialization"&&JQ(e)?`Tool input assertion failed: could not serialize tool input for ${e.tool} (expected: ${n})`:`Tool input assertion failed: ${e.tool} input did not match (expected: ${n})`}function FL(e){return e.length>0?`Tool sequence · ${e.join(" -> ")}`:"Tool sequence"}function go(e){return e==null?void 0:String(e)}function ZQ(e,t){return`${e}-${t+1}`}function Gd(e){return Hn(e)||void 0}function qC(e){return e!==void 0?{temperature:e}:{}}function eJ(e){const t=e.media_type??qQ(e)??"application/octet-stream";return{type:zQ(t),media_type:t,data:e.data??"",...e.url?{url:e.url}:{},...e.name?{name:e.name}:{}}}function tJ(e){switch(e.type){case"regex":return{type:"response_regex",value:e.pattern};case"contains":return{type:"response_contains",value:e.value};case"not_contains":return{type:"response_not_contains",value:e.value};case"starts_with":return{type:"response_starts_with",value:e.value};case"ends_with":return{type:"response_ends_with",value:e.value};case"equals":return{type:"response_equals",value:e.value};case"jsonpath":return{type:"response_jsonpath",path:e.path,equals:e.equals};case"jsonpath_exists":return{type:"response_jsonpath_exists",path:e.path};case"jsonpath_not_exists":return{type:"response_jsonpath_not_exists",path:e.path};default:throw new Error(`Unsupported response assertion type in config: ${String(e?.type??"(missing type)")}`)}}function nJ(e){return{type:`tool_input_${e.type}`,tool:e.tool,...e.path?{path:e.path}:{},...e.equals!==void 0?{equals:e.equals}:{},...e.value!==void 0?{value:e.value}:{},...e.pattern!==void 0?{value:e.pattern}:{}}}function rJ(e){if(e.type==="required_tool"||e.type==="forbidden_tool"||e.type==="tool_sequence"||e.type.startsWith("tool_input_")||e.type==="agent_check")return null;const t=go(e.value);return e.type==="response_contains"?t?{type:"contains",value:t}:null:e.type==="response_not_contains"?t?{type:"not_contains",value:t}:null:e.type==="response_starts_with"?t?{type:"starts_with",value:t}:null:e.type==="response_ends_with"?t?{type:"ends_with",value:t}:null:e.type==="response_equals"?t?{type:"equals",value:t}:null:e.type==="response_regex"?t?{type:"regex",pattern:t}:null:e.type==="response_jsonpath"?e.path?.trim()?e.equals!==void 0?{type:"jsonpath",path:e.path.trim(),equals:e.equals}:{type:"jsonpath",path:e.path.trim()}:null:e.type==="response_jsonpath_exists"?e.path?.trim()?{type:"jsonpath_exists",path:e.path.trim()}:null:e.type==="response_jsonpath_not_exists"&&e.path?.trim()?{type:"jsonpath_not_exists",path:e.path.trim()}:null}function aJ(e,t){const n=e.filter(p=>p.type==="required_tool").map(p=>p.value).filter(p=>typeof p=="string"&&p.length>0),r=e.filter(p=>p.type==="forbidden_tool").map(p=>p.value).filter(p=>typeof p=="string"&&p.length>0),s=e.find(p=>p.type==="tool_sequence")?.sequence?.map(p=>p.trim()).filter(p=>typeof p=="string"&&p.length>0),o=e.map(p=>rJ(p)).filter(p=>!!p),i=e.filter(p=>p.type.startsWith("tool_input_")).flatMap(p=>{if(!p.tool)return[];const v=go(p.value);return p.type==="tool_input_contains"&&v!==void 0?[{type:"contains",tool:p.tool,value:v}]:p.type==="tool_input_regex"&&v!==void 0?[{type:"regex",tool:p.tool,pattern:v}]:p.type==="tool_input_jsonpath"&&p.path?[{type:"jsonpath",tool:p.tool,path:p.path,...p.equals!==void 0?{equals:p.equals}:{}}]:[]}),c=e.filter(p=>p.type==="agent_check").flatMap(p=>p.label?.trim()&&p.prompt?.trim()?[{label:p.label.trim(),prompt:p.prompt.trim()}]:[]),d=n.length>0||r.length>0?{...n.length>0?{required_tools:n}:{},...r.length>0?{forbidden_tools:r}:{}}:void 0,f={...t?.include_prompt?{include_prompt:!0}:{},...t?.include_tool_sequence?{include_tool_sequence:!0}:{},...t?.include_tool_inputs?{include_tool_inputs:!0}:{}},m=Object.keys(f).length>0;if(!(!d&&!s?.length&&i.length===0&&o.length===0&&c.length===0&&!m))return{...d?{tool_constraints:d}:{},...s&&s.length>0?{tool_sequence:s}:{},...i.length>0?{tool_input_assertions:i}:{},...o.length>0?{response_assertions:o}:{},...c.length>0?{agent_assertions:c}:{},...m?{agent_context:f}:{}}}function sJ(e){if(e.length!==0)return e.map(t=>({name:t.name,from:"final_text",regex:t.pattern}))}function zL(e,t){const n=aJ(e.evalRules,e.agentContext),r=sJ(e.extractRules);return{id:e.id,name:Gd(e.name),mcp_servers:t,prompt:e.prompt,attachments:e.attachments,eval:n,extract:r}}function VP(e){if(!("id"in e)||!e.id)return null;const t=String(e.id),n=e.auth,r={id:t,name:String(e.name||t),transport:"streamable-http",url:String(e.url||""),authType:n?.type==="bearer"?"bearer":n?.type==="api_key"||n?.type==="oauth_client_credentials"?"api-key":n?.type==="oauth_authorization_code"?"oauth2":"none",authValue:n?.type==="bearer"?String(n.token||"")||(n.env?`\${${n.env}}`:void 0):n?.type==="api_key"?String(n.value||""):void 0,apiKeyHeaderName:n?.type==="api_key"?String(n.header_name||""):void 0,oauthClientId:n?.type==="oauth_authorization_code"&&String(n.client_id||"")||void 0,oauthClientSecret:n?.type==="oauth_authorization_code"&&String(n.client_secret||"")||void 0,oauthRedirectUrl:n?.type==="oauth_authorization_code"&&String(n.redirect_url||"")||void 0,oauthScope:(n?.type==="oauth_authorization_code"||n?.type==="oauth_client_credentials")&&String(n.scope||"")||void 0,oauthMode:n?.type==="oauth_authorization_code"?n.mode:void 0,oauthAuthorizationUrl:n?.type==="oauth_authorization_code"&&String(n.authorization_url||"")||void 0,oauthTokenEndpoint:n?.type==="oauth_authorization_code"&&String(n.token_url||"")||void 0,oauthTokenUrl:n?.type==="oauth_client_credentials"?String(n.token_url||""):void 0,oauthClientIdEnv:n?.type==="oauth_client_credentials"?String(n.client_id_env||""):void 0,oauthClientSecretEnv:n?.type==="oauth_client_credentials"?String(n.client_secret_env||""):void 0,oauthAudience:n?.type==="oauth_client_credentials"&&String(n.audience||"")||void 0};return{id:t,server:r}}function dm(e){const t=typeof e.config.name=="string"&&e.config.name.trim().length>0?e.config.name.trim():void 0,n=Array.isArray(e.config.servers)?e.config.servers:[],r=Array.isArray(e.config.agents)?e.config.agents:[],s=new Map,o=[],i=[];for(const p of n){if("ref"in p){const b=String(p.ref||"").trim();if(!b)continue;s.set(b,b),i.push({kind:"referenced",ref:b});continue}const v=String(p.id||p.name||"").trim();if(!v)continue;const x=v;s.set(v,x);const j=p.auth?.type==="bearer"?"bearer":p.auth?.type==="api_key"||p.auth?.type==="oauth_client_credentials"?"api-key":p.auth?.type==="oauth_authorization_code"?"oauth2":"none",y={id:x,name:String(p.name||v),transport:"streamable-http",url:p.url,authType:j,authValue:p.auth?.type==="bearer"?p.auth.token??(p.auth.env?`\${${p.auth.env}}`:void 0):p.auth?.type==="api_key"?p.auth.value:void 0,apiKeyHeaderName:p.auth?.type==="api_key"?p.auth.header_name:void 0,oauthClientId:p.auth?.type==="oauth_authorization_code"?p.auth.client_id:void 0,oauthClientSecret:p.auth?.type==="oauth_authorization_code"?p.auth.client_secret:void 0,oauthRedirectUrl:p.auth?.type==="oauth_authorization_code"?p.auth.redirect_url:void 0,oauthScope:p.auth?.type==="oauth_authorization_code"||p.auth?.type==="oauth_client_credentials"?p.auth.scope:void 0,oauthMode:p.auth?.type==="oauth_authorization_code"?p.auth.mode:void 0,oauthAuthorizationUrl:p.auth?.type==="oauth_authorization_code"?p.auth.authorization_url:void 0,oauthTokenEndpoint:p.auth?.type==="oauth_authorization_code"?p.auth.token_url:void 0,oauthTokenUrl:p.auth?.type==="oauth_client_credentials"?p.auth.token_url:void 0,oauthClientIdEnv:p.auth?.type==="oauth_client_credentials"?p.auth.client_id_env:void 0,oauthClientSecretEnv:p.auth?.type==="oauth_client_credentials"?p.auth.client_secret_env:void 0,oauthAudience:p.auth?.type==="oauth_client_credentials"?p.auth.audience:void 0};o.push(y),i.push({kind:"inline",server:y})}const c=[],d=[];for(const p of r){if("ref"in p){const b=String(p.ref||"").trim();if(!b)continue;d.push({kind:"referenced",ref:b});continue}const v=String(p.id||p.name||"").trim();if(!v)continue;const x=v,j=p.provider==="azure_openai"?"azure":p.provider,y={id:x,name:String(p.name||v),provider:j,model:p.model,...qC(p.temperature),maxTokens:p.max_tokens??2048,maxTurns:p.max_turns,systemPrompt:p.system};c.push(y),d.push({kind:"inline",agent:y})}const f=[],m=[];return e.config.scenarios.forEach((p,v)=>{if("ref"in p){const b=String(p.ref||"").trim();if(!b)return;const S=p.mcp_servers,N=Array.isArray(S)?S.flatMap(C=>{const k=C;if("ref"in k&&k.ref)return[{kind:"referenced",ref:String(k.ref)}];const A=VP(k);return A?[{kind:"inline",server:A.server}]:[]}):void 0;m.push({kind:"referenced",ref:b,...N?{mcpServers:N}:{}});return}const x=[];for(const b of p.eval?.tool_constraints?.required_tools??[])x.push({type:"required_tool",value:b});for(const b of p.eval?.tool_constraints?.forbidden_tools??[])x.push({type:"forbidden_tool",value:b});p.eval?.tool_sequence?.length&&x.push({type:"tool_sequence",sequence:[...p.eval.tool_sequence]});for(const b of p.eval?.response_assertions??[])x.push(tJ(b));for(const b of p.eval?.tool_input_assertions??[])x.push(nJ(b));for(const b of p.eval?.agent_assertions??[])x.push({type:"agent_check",label:b.label,prompt:b.prompt});const j=p.eval?.agent_context&&(p.eval.agent_context.include_prompt||p.eval.agent_context.include_tool_sequence||p.eval.agent_context.include_tool_inputs)?{include_prompt:p.eval.agent_context.include_prompt,include_tool_sequence:p.eval.agent_context.include_tool_sequence,include_tool_inputs:p.eval.agent_context.include_tool_inputs}:void 0,y={id:p.id||ZQ("scn",v),name:Gd(p.name)||p.id||`Scenario ${v+1}`,serverIds:(()=>{if((p.servers??[]).length>0)return p.servers.map(S=>s.get(S)??S).filter(Boolean);const b=p.mcp_servers;return Array.isArray(b)?b.flatMap(S=>{if("ref"in S&&S.ref)return[String(S.ref)];const N=VP(S);if(N){const C=N.id;return s.has(C)||(s.set(C,C),o.push(N.server),i.push({kind:"inline",server:o[o.length-1]})),[C]}return[]}):[]})(),prompt:p.prompt,attachments:p.attachments?.map(eJ),evalRules:x,extractRules:(p.extract??[]).map(b=>({name:b.name,pattern:b.regex})),...j?{agentContext:j}:{}};f.push(y),m.push({kind:"inline",scenario:y})}),{id:e.id,name:t||e.name,configName:t,configHash:e.hash,description:e.path,...e.relativePath?{relativePath:e.relativePath}:{},...e.suitePath!==void 0?{suitePath:e.suitePath}:{},loadError:e.error,loadWarnings:e.warnings,servers:o,serverEntries:i,agents:c,agentEntries:d,scenarios:f,scenarioEntries:m,runDefaults:e.config.run_defaults?.selected_agents&&e.config.run_defaults.selected_agents.length>0?{selectedAgentNames:[...e.config.run_defaults.selected_agents]}:void 0,createdAt:e.mtime,updatedAt:e.mtime,sourcePath:e.path}}function oJ(e){const t={id:"library",name:"library",path:"library",mtime:new Date(0).toISOString(),hash:"",config:{servers:Object.entries(e.servers).map(([r,s])=>({id:r,name:Gd(s.name)||r,transport:s.transport,url:s.url,auth:s.auth})),agents:Object.entries(e.agents).map(([r,s])=>({id:r,name:Gd(s.name)||r,provider:s.provider,model:s.model,temperature:s.temperature,max_tokens:s.max_tokens,max_turns:s.max_turns,system:s.system})),scenarios:e.scenarios.map((r,s)=>({...r,name:Gd(r.name)||r.id||`Scenario ${s+1}`}))}},n=dm(t);return{servers:n.servers,agents:n.agents,scenarios:n.scenarios}}function KP(e){const t=new Map,n=x=>{const j=x.id,y=x.authValue?.trim()??"",b=x.apiKeyHeaderName?.trim()??"",S=x.authType==="bearer"?(()=>{if(!y)throw new Error(`Server '${j}' is missing bearer token value`);return{type:"bearer",token:y}})():x.authType==="api-key"&&!x.oauthTokenUrl?{type:"api_key",...b?{header_name:b}:{},value:(()=>{if(!y)throw new Error(`Server '${j}' is missing API key value`);return y})()}:x.authType==="api-key"?{type:"oauth_client_credentials",token_url:x.oauthTokenUrl||"",client_id_env:x.oauthClientIdEnv||"",client_secret_env:x.oauthClientSecretEnv||"",...x.oauthScope?{scope:x.oauthScope}:{},...x.oauthAudience?{audience:x.oauthAudience}:{}}:x.authType==="oauth2"?{type:"oauth_authorization_code",...x.oauthMode==="dcr"?{mode:"dcr"}:{},...x.oauthMode!=="dcr"&&x.oauthClientId?{client_id:x.oauthClientId}:{},...x.oauthClientSecret?{client_secret:x.oauthClientSecret}:{},...x.oauthRedirectUrl?{redirect_url:x.oauthRedirectUrl}:{},...x.oauthScope?{scope:x.oauthScope}:{},...x.oauthAuthorizationUrl?{authorization_url:x.oauthAuthorizationUrl}:{},...x.oauthTokenEndpoint?{token_url:x.oauthTokenEndpoint}:{}}:void 0;return{id:j,...x.name&&x.name!==j?{name:x.name}:{},transport:"http",url:x.url||"http://localhost:3000/mcp",...S!==void 0?{auth:S}:{}}},r=e.serverEntries&&e.serverEntries.length>0?e.serverEntries:[...e.servers.map(x=>({kind:"inline",server:x}))],s=new Set,o=new Map,i=r.flatMap(x=>{if(x.kind==="referenced"){const y=String(x.ref||"").trim();return!y||s.has(y)?[]:(s.add(y),t.set(y,y),[{ref:y}])}const j=n(x.server);return t.set(x.server.id,j.id),o.set(j.id,j),[j]}),c=x=>{const j=x.id;return{id:j,...x.name&&x.name!==j?{name:x.name}:{},provider:x.provider==="azure"?"azure_openai":x.provider==="anthropic"?"anthropic":"openai",model:x.model,...qC(x.temperature),max_tokens:x.maxTokens,max_turns:x.maxTurns,system:x.systemPrompt}},d=e.agentEntries&&e.agentEntries.length>0?e.agentEntries:[...e.agents.map(x=>({kind:"inline",agent:x}))],f=new Set,m=d.flatMap(x=>{if(x.kind==="referenced"){const j=String(x.ref||"").trim();return!j||f.has(j)?[]:(f.add(j),[{ref:j}])}return[c(x.agent)]}),p=x=>{const j=x.serverIds.length>0?x.serverIds.map(y=>{const b=t.get(y)??y;return o.get(b)??{ref:b}}):void 0;return zL(x,j)},v=e.scenarioEntries&&e.scenarioEntries.length>0?e.scenarioEntries.map(x=>x.kind==="referenced"?{ref:x.ref,...Array.isArray(x.mcpServers)?{mcp_servers:x.mcpServers.map(j=>j.kind==="referenced"?{ref:j.ref}:n(j.server))}:{}}:p(x.scenario)):[...e.scenarios.map(x=>p(x))];return{name:e.configName?.trim()||void 0,servers:i,agents:m,scenarios:v,run_defaults:e.runDefaults?.selectedAgentNames&&e.runDefaults.selectedAgentNames.length>0?{selected_agents:[...e.runDefaults.selectedAgentNames]}:void 0}}function iJ(e){const t=Object.fromEntries((e.servers??[]).map(r=>[r.id,(()=>{const s=r.authValue?.trim()??"",o=r.apiKeyHeaderName?.trim()??"";return{...r.name&&r.name!==r.id?{name:r.name}:{},transport:"http",url:r.url||"http://localhost:3000/mcp",auth:r.authType==="bearer"?(()=>{if(!s)throw new Error(`Server '${r.id}' is missing bearer token value`);return{type:"bearer",token:s}})():r.authType==="api-key"&&!r.oauthTokenUrl?{type:"api_key",...o?{header_name:o}:{},value:(()=>{if(!s)throw new Error(`Server '${r.id}' is missing API key value`);return s})()}:r.authType==="api-key"?{type:"oauth_client_credentials",token_url:r.oauthTokenUrl||"",client_id_env:r.oauthClientIdEnv||"",client_secret_env:r.oauthClientSecretEnv||"",...r.oauthScope?{scope:r.oauthScope}:{},...r.oauthAudience?{audience:r.oauthAudience}:{}}:r.authType==="oauth2"?{type:"oauth_authorization_code",...r.oauthMode==="dcr"?{mode:"dcr"}:{},...r.oauthMode!=="dcr"&&r.oauthClientId?{client_id:r.oauthClientId}:{},...r.oauthClientSecret?{client_secret:r.oauthClientSecret}:{},...r.oauthRedirectUrl?{redirect_url:r.oauthRedirectUrl}:{},...r.oauthScope?{scope:r.oauthScope}:{},...r.oauthAuthorizationUrl?{authorization_url:r.oauthAuthorizationUrl}:{},...r.oauthTokenEndpoint?{token_url:r.oauthTokenEndpoint}:{}}:void 0}})()])),n=Object.fromEntries(e.agents.map(r=>[r.id,{...r.name&&r.name!==r.id?{name:r.name}:{},provider:r.provider==="azure"?"azure_openai":r.provider==="anthropic"?"anthropic":"openai",model:r.model,...qC(r.temperature),max_tokens:r.maxTokens,max_turns:r.maxTurns,system:r.systemPrompt}]));return{servers:t,agents:n,scenarios:e.scenarios.map(r=>zL(r,r.serverIds.length>0?r.serverIds.map(s=>({ref:s})):void 0))}}function lJ(e,t){if(e)return`${e}::${t??""}`}function gb(e){return e.type==="text"}function BL(e,t){if(!t)return e.tool_calls.map((s,o)=>({name:s,arguments:{},duration:e.tool_durations_ms[o]??0,timestamp:new Date().toISOString()}));const n=[],r=new Map;for(const s of t.messages)for(const o of s.content)o.type==="tool_use"?n.push({id:o.id,name:o.name,input:o.input??{},ts:s.ts}):o.type==="tool_result"&&r.set(o.tool_use_id,{durationMs:o.duration_ms,tsEnd:o.ts_end});return n.map((s,o)=>{const i=r.get(s.id);return{name:s.name,arguments:s.input,duration:i?.durationMs??e.tool_durations_ms[o]??0,timestamp:i?.tsEnd??s.ts??new Date().toISOString()}})}function qL(e,t){const n=[];if(!e)return n;let r;const s=e.messages??[];for(let o=0;o<s.length;o+=1){const i=s[o];if(i.role==="user"){for(const c of i.content)c.type==="text"?n.push({id:`user_prompt-${n.length}`,kind:"user_prompt",text:c.text,timestamp:i.ts}):c.type==="image"?n.push({id:`attachment-${n.length}`,kind:"user_prompt",text:`[Attached image: ${c.name??"image"}]`,timestamp:i.ts}):c.type==="document"&&n.push({id:`attachment-${n.length}`,kind:"user_prompt",text:`[Attached document: ${c.name??"document"} (${c.media_type})]`,timestamp:i.ts});continue}if(i.role==="assistant"){const c=i.content.filter(m=>m.type==="tool_use");for(const m of i.content)m.type==="text"&&(n.push({id:`assistant_thought-${n.length}`,kind:"assistant_thought",text:m.text,timestamp:i.ts}),r=n.length-1);const d=s[o+1],f=d?.role==="tool";if(c.length>0&&f){const m=new Map,p=[];for(const v of d.content)v.type==="tool_result"&&(v.tool_use_id?m.set(v.tool_use_id,v):p.push(v));for(const v of c){n.push({id:`tool_call-${n.length}`,kind:"tool_call",text:GP(v.input??{}),toolName:v.name,timestamp:i.ts,estimatedTokens:v.estimated_tokens?{inputTokens:v.estimated_tokens.input,outputTokens:v.estimated_tokens.output,totalTokens:v.estimated_tokens.total}:void 0,estimatedTokenMethod:v.estimated_tokens?.method});const x=m.get(v.id);if(!x)continue;const j=x.content.filter(gb).map(y=>y.text).join(`
57
+ `);n.push({id:`tool_result-${n.length}`,kind:"tool_result",text:j,toolName:x.name,ok:!x.is_error,durationMs:x.duration_ms,timestamp:x.ts_end??d.ts,estimatedTokens:x.estimated_tokens?{inputTokens:x.estimated_tokens.input,outputTokens:x.estimated_tokens.output,totalTokens:x.estimated_tokens.total}:void 0,estimatedTokenMethod:x.estimated_tokens?.method}),m.delete(v.id)}for(const v of[...m.values(),...p]){const x=v.content.filter(gb).map(j=>j.text).join(`
58
+ `);n.push({id:`tool_result-${n.length}`,kind:"tool_result",text:x,toolName:v.name,ok:!v.is_error,durationMs:v.duration_ms,timestamp:v.ts_end??d.ts,estimatedTokens:v.estimated_tokens?{inputTokens:v.estimated_tokens.input,outputTokens:v.estimated_tokens.output,totalTokens:v.estimated_tokens.total}:void 0,estimatedTokenMethod:v.estimated_tokens?.method})}o+=1}else for(const m of c)n.push({id:`tool_call-${n.length}`,kind:"tool_call",text:GP(m.input??{}),toolName:m.name,timestamp:i.ts,estimatedTokens:m.estimated_tokens?{inputTokens:m.estimated_tokens.input,outputTokens:m.estimated_tokens.output,totalTokens:m.estimated_tokens.total}:void 0,estimatedTokenMethod:m.estimated_tokens?.method});continue}if(i.role==="tool")for(const c of i.content){if(c.type!=="tool_result")continue;const d=c.content.filter(gb).map(f=>f.text).join(`
59
+ `);n.push({id:`tool_result-${n.length}`,kind:"tool_result",text:d,toolName:c.name,ok:!c.is_error,durationMs:c.duration_ms,timestamp:c.ts_end??i.ts,estimatedTokens:c.estimated_tokens?{inputTokens:c.estimated_tokens.input,outputTokens:c.estimated_tokens.output,totalTokens:c.estimated_tokens.total}:void 0,estimatedTokenMethod:c.estimated_tokens?.method})}}return typeof r=="number"&&n[r]&&(n[r]={...n[r],kind:"assistant_final"}),n}function GP(e){try{return JSON.stringify(e)}catch{return String(e)}}function YP(e,t){t&&(typeof t.input_tokens=="number"&&(e.input+=t.input_tokens,e.hasInput=!0),typeof t.output_tokens=="number"&&(e.output+=t.output_tokens,e.hasOutput=!0),typeof t.total_tokens=="number"&&(e.total+=t.total_tokens,e.hasTotal=!0))}function vb(e,t){if(typeof e!="number"||t<=0)return new Array(t).fill(void 0);const n=Math.floor(e/t),r=e%t;return Array.from({length:t},(s,o)=>n+(o<r?1:0))}function UL(e){const t=Fs(),n=Fs(),r=new Map;if(!e)return{assistant:null,tool:null,perTool:{}};for(const o of e.messages??[]){if(o.role!=="assistant")continue;YP(t,o.usage);const i=o.content.filter(p=>p.type==="tool_use");if(i.length===0)continue;if(i.every(p=>!!p.estimated_tokens)){for(const p of i){const v=p.estimated_tokens;n.input+=v.input,n.hasInput=!0,n.output+=v.output,n.hasOutput=!0,n.total+=v.total,n.hasTotal=!0;const x=r.get(p.name)??Fs();x.input+=v.input,x.hasInput=!0,x.output+=v.output,x.hasOutput=!0,x.total+=v.total,x.hasTotal=!0,r.set(p.name,x)}continue}YP(n,o.usage);const d=vb(o.usage?.input_tokens,i.length),f=vb(o.usage?.output_tokens,i.length),m=vb(o.usage?.total_tokens,i.length);for(let p=0;p<i.length;p+=1){const v=i[p].name,x=r.get(v)??Fs(),j=d[p],y=f[p],b=m[p];typeof j=="number"&&(x.input+=j,x.hasInput=!0),typeof y=="number"&&(x.output+=y,x.hasOutput=!0),typeof b=="number"&&(x.total+=b,x.hasTotal=!0),r.set(v,x)}}const s={};for(const[o,i]of Array.from(r.entries()).sort((c,d)=>c[0].localeCompare(d[0]))){const c=xo(i);c&&(s[o]=c)}return{assistant:xo(t),tool:xo(n),perTool:s}}function WL(e,t){if(t){const n=Date.parse(t.ts_start),r=Date.parse(t.ts_end);if(Number.isFinite(n)&&Number.isFinite(r))return Math.max(0,r-n)}return e.tool_durations_ms.reduce((n,r)=>n+r,0)}function cJ(e){return d1(e.flatMap(t=>t.checkResults??[]))}function XP(e,t=[]){const n=new Map;for(const c of t){const d=lJ(c.scenario_id,c.agent);if(!d)continue;const f=n.get(d)??[];f.push(c),n.set(d,f)}const r=e.scenarios.map(c=>{const d=n.get(`${c.scenario_id}::${c.agent}`)??[],f=new Map;for(const S of d)f.set(S.run_index,S);const m=c.runs.map((S,N)=>{const C=f.get(S.run_index)??d[N],k=UL(C);return{runIndex:S.run_index,passed:S.pass,error:S.error,toolCalls:BL(S,C),assistantTokenUsage:k.assistant,toolTokenUsage:k.tool,toolTokenUsageByTool:k.perTool,finalAnswer:S.final_text,conversation:qL(C),duration:WL(S,C),extractedValues:Object.fromEntries(Object.entries(S.extracted).map(([A,E])=>[A,String(E??"")])),failureReasons:S.failures,checkResults:S.check_results}}),p=Fs(),v=Fs(),x=new Map;for(const S of m){Ec(p,S.assistantTokenUsage),Ec(v,S.toolTokenUsage);for(const[N,C]of Object.entries(S.toolTokenUsageByTool??{})){const k=x.get(N)??Fs();Ec(k,C),x.set(N,k)}}const j={};for(const[S,N]of Array.from(x.entries()).sort((C,k)=>C[0].localeCompare(k[0]))){const C=xo(N);C&&(j[S]=C)}const y=m.length===0?0:Math.round(m.reduce((S,N)=>S+N.duration,0)/m.length),b=m.length===0?0:m.reduce((S,N)=>S+N.toolCalls.length,0)/m.length;return{scenarioId:c.scenario_id,scenarioName:c.scenario_name||c.scenario_id,agentId:c.agent,agentName:c.agent,provider:c.provider,model:c.model,runs:m,passRate:c.pass_rate,avgToolCalls:b,avgDuration:y,checkCounts:cJ(m),assistantTokenUsage:xo(p),toolTokenUsage:xo(v),toolTokenUsageByTool:j}}),s=Fs(),o=Fs();for(const c of r)Ec(s,c.assistantTokenUsage),Ec(o,c.toolTokenUsage);const i=r.reduce((c,d)=>(c.passed+=d.checkCounts?.passed??0,c.failed+=d.checkCounts?.failed??0,c.not_evaluated+=d.checkCounts?.not_evaluated??0,c.total+=d.checkCounts?.total??0,c),{passed:0,failed:0,not_evaluated:0,total:0});return{id:e.metadata.run_id,configId:"",configHash:e.metadata.config_hash,configPath:e.metadata.config_path,configName:e.metadata.config_name,langsmithTraceUrls:e.metadata.langsmith_trace_urls,rerunAgents:e.metadata.rerun_agents,rerunScenarioIds:e.metadata.rerun_scenario_ids,rerunServerOverrideAll:e.metadata.rerun_server_override_all,rerunScenarioServerOverrides:e.metadata.rerun_scenario_server_overrides,timestamp:e.metadata.timestamp,runNote:e.metadata.run_note,mcpServerVersions:e.metadata.mcp_server_versions??{},scenarios:r,assistantTokenUsage:xo(s),toolTokenUsage:xo(o),overallPassRate:e.summary.pass_rate,totalScenarios:e.summary.total_scenarios,totalRuns:e.summary.total_runs,avgToolCalls:e.summary.avg_tool_calls_per_run,avgLatency:Math.round(e.summary.avg_tool_latency_ms??0),checkCounts:i,totalToolDurationMs:typeof e.metadata.total_tool_duration_ms=="number"?Math.max(0,e.metadata.total_tool_duration_ms??0):0}}function uJ(e,t){const n=UL(t??void 0);return{runIndex:e.run_index,passed:e.pass,error:e.error,toolCalls:BL(e,t??void 0),assistantTokenUsage:n.assistant,toolTokenUsage:n.tool,toolTokenUsageByTool:n.perTool,finalAnswer:e.final_text,conversation:qL(t??void 0),duration:WL(e,t??void 0),extractedValues:Object.fromEntries(Object.entries(e.extracted).map(([r,s])=>[r,String(s??"")])),failureReasons:e.failures,checkResults:e.check_results}}function dJ(){return typeof window>"u"?"":window.location.port==="8685"?"http://127.0.0.1:8787":""}const yo=dJ();class UC extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}status}async function St(e,t){const n=await fetch(`${yo}${e}`,{...t,headers:{"content-type":"application/json",...t?.headers||{}}});if(!n.ok){const r=await n.text();throw new UC(n.status,`Request failed (${n.status}): ${r}`)}return await n.json()}async function fJ(e,t){const n=await fetch(`${yo}${e}`,{...t,headers:{}});if(!n.ok){const r=await n.text();throw new UC(n.status,`Request failed (${n.status}): ${r}`)}return n.text()}function QP(e,t){const n=new EventSource(`${yo}${e}`),r=e.replace(/\/events$/,""),s=["session_started","turn_started","tool_call_requested","tool_call_approved","tool_call_denied","tool_call_resolved","assistant_message_completed","session_warning","session_error","session_finished"];let o=!1;const i=()=>{o||(o=!0,n.close())},c=d=>{if(!o&&!(typeof d.data!="string"||!d.data))try{const f=JSON.parse(d.data);f.type==="session_finished"&&i(),t(f)}catch{}};for(const d of s)n.addEventListener(d,c);return n.onerror=()=>{if(!o){if(n.readyState===2){i();return}fetch(`${yo}${r}`,{method:"GET",cache:"no-store",headers:{accept:"application/json"}}).then(d=>{(d.status===404||d.status===410)&&i()}).catch(()=>{})}},()=>i()}function xb(e,t,n){if(typeof n!="number"||!Number.isFinite(n))return;const r=Math.floor(n);r<=0||e.set(t,String(r))}function yb(e,t,n){if(typeof n!="number"||!Number.isFinite(n))return;const r=Math.floor(n);r<0||e.set(t,String(r))}const st={health:()=>St("/api/health"),getSettings:()=>St("/api/settings"),updateSettings:e=>St("/api/settings",{method:"PUT",body:JSON.stringify(e)}),listConfigs:()=>St("/api/evals"),createConfig:(e,t)=>St("/api/evals",{method:"POST",body:JSON.stringify({fileName:e,config:t})}),updateConfig:(e,t,n)=>St(`/api/evals/${e}`,{method:"PUT",body:JSON.stringify({config:t,fileName:n})}),deleteConfig:e=>St(`/api/evals/${e}`,{method:"DELETE"}),listRuns:e=>{const t=new URLSearchParams;e?.since?.trim()&&t.set("since",e.since.trim()),e?.until?.trim()&&t.set("until",e.until.trim()),typeof e?.lastDays=="number"&&Number.isFinite(e.lastDays)&&e.lastDays>0&&t.set("last_days",String(Math.floor(e.lastDays))),e?.scenario?.trim()&&t.set("scenario",e.scenario.trim()),xb(t,"limit",e?.limit),yb(t,"offset",e?.offset);const n=t.size>0?`?${t.toString()}`:"";return St(`/api/runs${n}`)},getLatestPassRatesByConfigIds:e=>St("/api/runs/latest-pass-rates",{method:"POST",body:JSON.stringify(e)}).then(t=>t.byConfigId),listMarkdownReports:e=>{const t=new URLSearchParams;xb(t,"limit",e?.limit),yb(t,"offset",e?.offset);const n=t.size>0?`?${t.toString()}`:"";return St(`/api/markdown-reports${n}`)},listToolAnalysisServers:()=>St("/api/tool-analysis-results/servers").then(e=>e.data),getMarkdownReport:e=>St(`/api/markdown-reports/content?path=${encodeURIComponent(e)}`),getMarkdownReportById:e=>St(`/api/markdown-reports/${encodeURIComponent(e)}`),deleteMarkdownReport:e=>St(`/api/markdown-reports?path=${encodeURIComponent(e)}`,{method:"DELETE"}).then(()=>{}),getRun:e=>St(`/api/runs/${e}`),deleteRun:e=>St(`/api/runs/${e}`,{method:"DELETE"}),updateRunNote:(e,t)=>St(`/api/runs/${encodeURIComponent(e)}/note`,{method:"PATCH",body:JSON.stringify({runNote:t??""})}).then(()=>{}),getRunTrace:e=>St(`/api/runs/${e}/trace`),applyResultAssistantReport:e=>St(`/api/runs/${encodeURIComponent(e.runId)}/assistant/apply-report`,{method:"POST",body:JSON.stringify({markdown:e.markdown,outputPath:e.outputPath,overwrite:e.overwrite})}),createResultAssistantSession:(e,t)=>St("/api/result-assistant/sessions",{method:"POST",body:JSON.stringify(e),signal:t}),getResultAssistantSession:e=>St(`/api/result-assistant/sessions/${e}`),sendResultAssistantMessage:(e,t,n)=>St(`/api/result-assistant/sessions/${e}/messages`,{method:"POST",body:JSON.stringify({message:t}),signal:n}),approveResultAssistantToolCall:(e,t,n)=>St(`/api/result-assistant/sessions/${e}/tool-calls/${t}/approve`,{method:"POST",body:JSON.stringify(n===void 0?{}:{argumentsOverride:n})}),denyResultAssistantToolCall:(e,t)=>St(`/api/result-assistant/sessions/${e}/tool-calls/${t}/deny`,{method:"POST",body:JSON.stringify({})}),closeResultAssistantSession:e=>St(`/api/result-assistant/sessions/${e}`,{method:"DELETE"}).then(()=>{}),subscribeResultAssistantSessionEvents:(e,t)=>QP(`/api/result-assistant/sessions/${e}/events`,t),getLibraries:()=>St("/api/libraries"),saveLibraries:e=>St("/api/libraries",{method:"PUT",body:JSON.stringify(e)}),startRun:e=>St("/api/runs",{method:"POST",body:JSON.stringify(e)}),runScenarioPreview:e=>St("/api/runs/preview",{method:"POST",body:JSON.stringify(e)}),listProviderModels:e=>St(`/api/providers/models?provider=${encodeURIComponent(e)}`),createScenarioAssistantSession:(e,t)=>St("/api/scenario-assistant/sessions",{method:"POST",body:JSON.stringify(e),signal:t}),getScenarioAssistantSession:e=>St(`/api/scenario-assistant/sessions/${e}`),sendScenarioAssistantMessage:(e,t,n)=>St(`/api/scenario-assistant/sessions/${e}/messages`,{method:"POST",body:JSON.stringify({message:t}),signal:n}),approveScenarioAssistantToolCall:(e,t)=>St(`/api/scenario-assistant/sessions/${e}/tool-calls/${t}/approve`,{method:"POST",body:JSON.stringify({})}),denyScenarioAssistantToolCall:(e,t)=>St(`/api/scenario-assistant/sessions/${e}/tool-calls/${t}/deny`,{method:"POST",body:JSON.stringify({})}),approveAllScenarioAssistantToolCalls:e=>St(`/api/scenario-assistant/sessions/${e}/tool-calls/approve-all`,{method:"POST",body:JSON.stringify({})}),closeScenarioAssistantSession:e=>St(`/api/scenario-assistant/sessions/${e}`,{method:"DELETE"}),subscribeScenarioAssistantSessionEvents:(e,t)=>QP(`/api/scenario-assistant/sessions/${e}/events`,t),discoverToolsForAnalysis:e=>St("/api/tool-analysis/discover-tools",{method:"POST",body:JSON.stringify(e)}),startToolAnalysis:e=>St("/api/tool-analysis/jobs",{method:"POST",body:JSON.stringify(e)}),getToolAnalysisResult:e=>St(`/api/tool-analysis/jobs/${e}/result`),stopToolAnalysis:e=>St(`/api/tool-analysis/jobs/${e}/stop`,{method:"POST"}),subscribeToolAnalysisJob:(e,t)=>{const n=new EventSource(`${yo}/api/tool-analysis/jobs/${e}/events`);let r=!1;const s=()=>{r||(r=!0,n.close())},o=i=>{if(!r&&!(typeof i.data!="string"||!i.data))try{const c=JSON.parse(i.data);t(c),(c.type==="completed"||c.type==="error")&&s()}catch{}};return n.addEventListener("started",o),n.addEventListener("log",o),n.addEventListener("completed",o),n.addEventListener("error",o),n.onerror=()=>{r||(t({type:"error",ts:new Date().toISOString(),payload:{message:"SSE connection error"}}),s())},()=>s()},listToolAnalysisResults:e=>{const t=new URLSearchParams;xb(t,"limit",e?.limit),yb(t,"offset",e?.offset),e?.server?.trim()&&t.set("server",e.server.trim());const n=t.size>0?`?${t.toString()}`:"";return St(`/api/tool-analysis-results${n}`)},getToolAnalysisSavedResult:e=>St(`/api/tool-analysis-results/${e}`),deleteToolAnalysisSavedResult:e=>St(`/api/tool-analysis-results/${e}`,{method:"DELETE"}).then(()=>{}),createOAuthDebuggerSession:e=>St("/api/oauth-debugger/sessions",{method:"POST",body:JSON.stringify(e)}),getOAuthDebuggerSession:e=>St(`/api/oauth-debugger/sessions/${e}`),startOAuthDebuggerSession:e=>St(`/api/oauth-debugger/sessions/${e}/start`,{method:"POST",body:JSON.stringify({})}),subscribeOAuthDebuggerSession:(e,t)=>{const n=new EventSource(`${yo}/api/oauth-debugger/sessions/${e}/events`);let r=!1;const s=()=>{r||(r=!0,n.close())},o=i=>{if(!r&&!(typeof i.data!="string"||!i.data))try{const c=JSON.parse(i.data);t(c),(c.type==="completed"||c.type==="error"||c.type==="stopped")&&s()}catch{}};return["started","step_started","step_completed","step_failed","http_request","http_response","validation","log","waiting_for_user","waiting_for_browser_callback","completed","error","stopped"].forEach(i=>n.addEventListener(i,o)),n.onerror=()=>{r||(t({type:"error",ts:new Date().toISOString(),payload:{message:"SSE connection error"}}),s())},()=>s()},submitOAuthDebuggerManualCallback:(e,t)=>St(`/api/oauth-debugger/sessions/${e}/manual-callback`,{method:"POST",body:JSON.stringify(t)}),stopOAuthDebuggerSession:e=>St(`/api/oauth-debugger/sessions/${e}/stop`,{method:"POST",body:JSON.stringify({})}),exportOAuthDebuggerSession:(e,t)=>t==="json"?St(`/api/oauth-debugger/sessions/${e}/export?format=json`):fJ(`/api/oauth-debugger/sessions/${e}/export?format=${t}`),createOAuthRuntimeSession:e=>St("/api/oauth-runtime/sessions",{method:"POST",body:JSON.stringify(e)}),getOAuthRuntimeSession:e=>St(`/api/oauth-runtime/sessions/${e}`),getOAuthRuntimeSessionToken:e=>St(`/api/oauth-runtime/sessions/${e}/token`),submitOAuthRuntimeCallback:(e,t)=>St(`/api/oauth-runtime/sessions/${e}/callback`,{method:"POST",body:JSON.stringify(t)}),cancelOAuthRuntimeSession:e=>St(`/api/oauth-runtime/sessions/${e}/cancel`,{method:"POST",body:JSON.stringify({})}),ensureOAuthServers:e=>St("/api/oauth-runtime/servers/ensure",{method:"POST",body:JSON.stringify(e)}),stopRun:e=>St(`/api/runs/jobs/${e}/stop`,{method:"POST"}),getRunQueue:()=>St("/api/runs/queue"),subscribeRunQueue:e=>{if(typeof SharedWorker>"u"){const r=new EventSource(`${yo}/api/runs/queue/events`);let s=!1;return r.onopen=()=>{s||e({type:"connected",ts:new Date().toISOString(),payload:{message:"SSE connected"}})},r.addEventListener("queue_event",o=>{if(!s)try{e(JSON.parse(o.data))}catch{}}),r.onerror=()=>{s||(e({type:"error",ts:new Date().toISOString(),payload:{message:"SSE connection error",reconnecting:r.readyState!==2}}),r.readyState===2&&(r.onerror=null,s=!0))},()=>{s||(s=!0,r.close())}}const t=new SharedWorker(new URL("/assets/sse-queue-worker-BMo6aPaB.js",import.meta.url),{type:"module"});let n=!1;return t.onerror=()=>{n||e({type:"error",ts:new Date().toISOString(),payload:{message:"Queue worker failed to load"}})},t.port.onmessage=r=>{if(!n&&!(typeof r.data!="object"||!r.data)){if(r.data.type==="ping"){t.port.postMessage({type:"pong"});return}e(r.data)}},t.port.start(),t.port.postMessage({type:"init",baseUrl:yo}),()=>{n||(n=!0,t.port.postMessage({type:"close"}),t.port.onmessage=null,t.port.close())}},removeQueuedRun:e=>St(`/api/runs/queue/${e}`,{method:"DELETE"}).then(()=>{}),resumeQueue:()=>St("/api/runs/queue/resume",{method:"POST"}),subscribeRunJob:(e,t)=>{const n=new EventSource(`${yo}/api/runs/jobs/${e}/events`);let r=!1;const s=()=>{r||(r=!0,n.close())},o=i=>{if(!r&&!(typeof i.data!="string"||!i.data))try{const c=JSON.parse(i.data);t(c),(c.type==="completed"||c.type==="error")&&s()}catch{}};return n.addEventListener("queued",o),n.addEventListener("started",o),n.addEventListener("log",o),n.addEventListener("completed",o),n.addEventListener("error",o),n.addEventListener("oauth_required",o),n.onerror=()=>{r||(t({type:"error",ts:new Date().toISOString(),payload:{message:"SSE connection error"}}),s())},()=>{s()}}};function pJ(e){if(e.sourcePath){const t=e.sourcePath.split("/");return t[t.length-1].replace(/\.(yaml|yml)$/i,"")}return e.name||`config-${Date.now()}`}function hJ(e){return e||`config-${Date.now()}`}const mJ={async health(){return st.health()},async listConfigs(){return(await st.listConfigs()).map(dm)},async createConfig(e){const t=await st.createConfig(pJ(e),KP(e));return dm(t)},async updateConfig(e){const t=await st.updateConfig(e.id,KP(e),hJ(e.name));return dm(t)},async deleteConfig(e){await st.deleteConfig(e)},async listResults(e){let n=0;const r=[];for(;;){const o=await st.listRuns({...e,limit:100,offset:n});if(r.push(...o.data),!o.has_more||o.next_offset===null)break;n=o.next_offset}const s=r.map(async o=>{const[{results:i},c]=await Promise.all([st.getRun(o.runId),st.getRunTrace(o.runId)]);return XP(i,c.records)});return Promise.all(s)},async listRunSummaries(e){const t=Math.max(1,Math.min(100,e?.limit??100));let n=Math.max(0,e?.offset??0);const r=[];for(;;){const s=await st.listRuns({...e,limit:t,offset:n});if(r.push(...s.data),!s.has_more||s.next_offset===null)break;n=s.next_offset}return r},async listRunSummariesPage(e){return st.listRuns(e)},async getLatestPassRatesByConfigIds(e){return st.getLatestPassRatesByConfigIds(e)},async getResult(e){try{const[{results:t},n]=await Promise.all([st.getRun(e),st.getRunTrace(e)]);return XP(t,n.records)}catch{return}},async deleteResult(e){await st.deleteRun(e)},async updateRunNote(e,t){await st.updateRunNote(e,t)},async listMarkdownReports(e){if(e?.limit!==void 0||e?.offset!==void 0)return(await st.listMarkdownReports(e)).data;const t=[];let n=0;const r=100;for(;;){const s=await st.listMarkdownReports({limit:r,offset:n});if(t.push(...s.data),!s.has_more||s.next_offset===null)break;n=s.next_offset}return t},async listMarkdownReportsPage(e){return st.listMarkdownReports(e)},async getMarkdownReport(e){return st.getMarkdownReport(e)},async getMarkdownReportById(e){return st.getMarkdownReportById(e)},async deleteMarkdownReport(e){await st.deleteMarkdownReport(e)},async startRun(e){const t=await st.startRun(e);return typeof window<"u"&&window.dispatchEvent(new Event("mcplab:run-queue-changed")),t},async runScenarioPreview(e){const t=await st.runScenarioPreview(e),n=t.scenario.run;if(!n)throw new Error("Preview run did not return a run result");return{runId:t.runId,scenarioId:t.scenario.scenarioId,agentName:t.scenario.agent,run:uJ(n,t.scenario.traceRecord)}},async stopRun(e){await st.stopRun(e)},async getRunQueue(){return st.getRunQueue()},subscribeRunQueue(e){return st.subscribeRunQueue(e)},async removeQueuedRun(e){await st.removeQueuedRun(e)},async resumeQueue(){return st.resumeQueue()},subscribeRunJob(e,t){return st.subscribeRunJob(e,t)},async applyResultAssistantReport(e){return st.applyResultAssistantReport(e)},async createResultAssistantSession(e,t){return st.createResultAssistantSession(e,t)},async getResultAssistantSession(e){return st.getResultAssistantSession(e)},async sendResultAssistantMessage(e,t,n){return st.sendResultAssistantMessage(e,t,n)},async approveResultAssistantToolCall(e,t,n){return st.approveResultAssistantToolCall(e,t,n)},async denyResultAssistantToolCall(e,t){return st.denyResultAssistantToolCall(e,t)},async closeResultAssistantSession(e){await st.closeResultAssistantSession(e)},subscribeResultAssistantSessionEvents(e,t){return st.subscribeResultAssistantSessionEvents(e,t)},async getLibraries(){const e=await st.getLibraries();return oJ(e)},async saveLibraries(e){await st.saveLibraries(iJ(e))},async listProviderModels(e){return st.listProviderModels(e)},async getWorkspaceSettings(){return st.getSettings()},async updateWorkspaceSettings(e){return st.updateSettings(e)},async createScenarioAssistantSession(e,t){return st.createScenarioAssistantSession(e,t)},async getScenarioAssistantSession(e){return st.getScenarioAssistantSession(e)},async sendScenarioAssistantMessage(e,t,n){return st.sendScenarioAssistantMessage(e,t,n)},async approveScenarioAssistantToolCall(e,t){return st.approveScenarioAssistantToolCall(e,t)},async denyScenarioAssistantToolCall(e,t){return st.denyScenarioAssistantToolCall(e,t)},async approveAllScenarioAssistantToolCalls(e){return st.approveAllScenarioAssistantToolCalls(e)},async closeScenarioAssistantSession(e){await st.closeScenarioAssistantSession(e)},subscribeScenarioAssistantSessionEvents(e,t){return st.subscribeScenarioAssistantSessionEvents(e,t)},async discoverToolsForAnalysis(e){return st.discoverToolsForAnalysis(e)},async startToolAnalysis(e){return st.startToolAnalysis(e)},subscribeToolAnalysisJob(e,t){return st.subscribeToolAnalysisJob(e,t)},async getToolAnalysisResult(e){return st.getToolAnalysisResult(e)},async stopToolAnalysis(e){return st.stopToolAnalysis(e)},async listToolAnalysisResults(e){if(e?.limit!==void 0||e?.offset!==void 0)return(await st.listToolAnalysisResults(e)).data;const t=[];let n=0;const r=100;for(;;){const s=await st.listToolAnalysisResults({limit:r,offset:n});if(t.push(...s.data),!s.has_more||s.next_offset===null)break;n=s.next_offset}return t},async listToolAnalysisResultsPage(e){return st.listToolAnalysisResults(e)},async listToolAnalysisServers(){return st.listToolAnalysisServers()},async getToolAnalysisSavedResult(e){return st.getToolAnalysisSavedResult(e)},async deleteToolAnalysisSavedResult(e){await st.deleteToolAnalysisSavedResult(e)},async createOAuthDebuggerSession(e){return st.createOAuthDebuggerSession(e)},async getOAuthDebuggerSession(e){return st.getOAuthDebuggerSession(e)},async startOAuthDebuggerSession(e){return st.startOAuthDebuggerSession(e)},subscribeOAuthDebuggerSession(e,t){return st.subscribeOAuthDebuggerSession(e,t)},async submitOAuthDebuggerManualCallback(e,t){return st.submitOAuthDebuggerManualCallback(e,t)},async stopOAuthDebuggerSession(e){return st.stopOAuthDebuggerSession(e)},async exportOAuthDebuggerSession(e,t){return st.exportOAuthDebuggerSession(e,t)},async createOAuthRuntimeSession(e){return st.createOAuthRuntimeSession(e)},async getOAuthRuntimeSession(e){return st.getOAuthRuntimeSession(e)},async getOAuthRuntimeSessionToken(e){return st.getOAuthRuntimeSessionToken(e)},async submitOAuthRuntimeCallback(e,t){return st.submitOAuthRuntimeCallback(e,t)},async cancelOAuthRuntimeSession(e){return st.cancelOAuthRuntimeSession(e)},async ensureOAuthServers(e){return st.ensureOAuthServers(e)}},HL=h.createContext(null);function gJ({children:e}){const t="workspace",[n,r]=h.useState("checking"),[s,o]=h.useState(null);h.useEffect(()=>{r("checking"),st.health().then(c=>{r("connected"),o(typeof c?.version=="string"?c.version:null)}).catch(()=>{r("disconnected"),o(null)})},[t]);const i=h.useMemo(()=>mJ,[]);return a.jsx(HL.Provider,{value:{mode:t,connection:n,version:s,source:i},children:e})}function Dn(){const e=h.useContext(HL);if(!e)throw new Error("useDataSource must be used within DataSourceProvider");return e}const vJ=5,xJ=2e3;function yJ(e){return e.filter(t=>t.status==="blocked_auth"&&t.blockedReason==="oauth_required").length}function JP(e){const t=e?.active??null,n=Array.isArray(e?.active_jobs)?e.active_jobs:t?[t]:[],r=Array.isArray(e?.admitting_jobs)?e.admitting_jobs:[],s=Array.isArray(e?.queued)?e.queued:[];return{active:t,active_jobs:n,admitting_jobs:r,queued:s}}function VL(){const{source:e}=Dn(),[t,n]=h.useState({active:null,active_jobs:[],admitting_jobs:[],queued:[]}),[r,s]=h.useState("connecting"),[o,i]=h.useState(0),[c,d]=h.useState(0),f=h.useRef("connecting"),m=h.useRef(0),p=h.useRef(new Set);return h.useEffect(()=>{let v=!1,x=0,j=null,y=null,b=0;const S=E=>{const P=m.current;e.getRunQueue().then(O=>{if(v||E!==b||P!==m.current)return;const D=JP(O);p.current=new Set([...D.active_jobs,...D.admitting_jobs].map(K=>K.jobId)),n(D)}).catch(()=>{})},N=()=>{j!==null&&(window.clearTimeout(j),j=null)},C=()=>{if(v)return;N();const E=++b;s("connecting"),f.current="connecting",y?.(),y=e.subscribeRunQueue(P=>{const O=P.payload.event;if(P.type==="connected"){x=0,s("connected"),f.current="connected";return}if(P.type==="queue_event"&&O){m.current+=1;const D=JP(O),K=new Set([...D.active_jobs,...D.admitting_jobs,...D.queued].map(B=>B.jobId)),q=[...p.current].filter(B=>!K.has(B)).length;q>0&&i(B=>B+q),p.current=new Set([...D.active_jobs,...D.admitting_jobs].map(B=>B.jobId)),s("connected"),f.current="connected",n(D);return}if(P.type==="error"){if(y?.(),y=null,x>=vJ){s("disconnected"),f.current="disconnected";return}x+=1,s("connecting"),f.current="connecting";const D=xJ*2**(x-1);j=window.setTimeout(()=>{C()},D)}}),S(E)};C();const k=()=>S(b);window.addEventListener("mcplab:run-queue-changed",k);const A=()=>{f.current!=="connected"&&C()};return window.addEventListener("focus",A),()=>{v=!0,y?.(),N(),window.removeEventListener("focus",A),window.removeEventListener("mcplab:run-queue-changed",k)}},[e,c]),h.useMemo(()=>{const v=t.active_jobs.length>0||t.admitting_jobs.length>0,x=t.active_jobs.length+t.admitting_jobs.length,j=t.queued.length,y=yJ(t.queued);return{isRunning:v,runningCount:x,completionVersion:o,queuedCount:j,oauthBlockedCount:y,streamStatus:r,reconnectStream:()=>{d(b=>b+1)}}},[t,r])}const bJ=(e,t)=>{if(e==="/")return[{label:"Dashboard"}];const n=[{label:"Dashboard",to:"/"}];if(gn("/mcp-evaluations/:id/edit",e))return n.push({label:"MCP Evaluations",to:"/mcp-evaluations"},{label:"MCP Evaluation",to:e.replace(/\/edit$/,"")},{label:"Edit"}),n;if(gn("/mcp-evaluations/:id",e))return n.push({label:"MCP Evaluations",to:"/mcp-evaluations"},{label:"MCP Evaluation"}),n;if(gn("/mcp-evaluations",e))return n.push({label:"MCP Evaluations"}),n;if(gn("/settings/mcp",e))return n.push({label:"Settings",to:"/settings"},{label:"MCP Connection"}),n;if(gn("/settings",e))return n.push({label:"Settings"}),n;if(gn("/tool-analysis",e))return n.push({label:"Analyze MCP Tools"}),n;if(gn("/tool-analysis-results/:id",e)){const r=gn("/tool-analysis-results/:id",e);return n.push({label:"Tool Analysis Results",to:"/tool-analysis-results"},{label:r?.params.id??"Report"}),n}if(gn("/tool-analysis-results",e))return n.push({label:"Tool Analysis Results"}),n;if(gn("/markdown-reports/view",e))return n.push({label:"Markdown Reports",to:"/markdown-reports"},{label:"View Report"}),n;if(gn("/markdown-reports",e))return n.push({label:"Markdown Reports"}),n;if(gn("/oauth-debugger",e))return n.push({label:"OAuth Debugger"}),n;if(gn("/results/:id",e))return n.push({label:"Evaluation Results",to:"/results"},{label:"Result"}),n;if(gn("/results",e))return n.push({label:"Evaluation Results"}),n;if(gn("/run",e))return n.push({label:"Run Evaluation"}),n;if(gn("/libraries/servers/:serverId",e)){const r=gn("/libraries/servers/:serverId",e),s=r?.params.serverId?decodeURIComponent(r.params.serverId):"Server";return n.push({label:"Libraries",to:"/libraries/servers"},{label:"MCP servers",to:"/libraries/servers"},{label:s==="new"?"New Server":s}),n}if(gn("/libraries/servers",e))return n.push({label:"Libraries",to:"/libraries/servers"},{label:"MCP servers"}),n;if(gn("/libraries/agents/:agentName",e)){const r=gn("/libraries/agents/:agentName",e),s=r?.params.agentName?decodeURIComponent(r.params.agentName):"Agent";return n.push({label:"Libraries",to:"/libraries/agents"},{label:"Agents",to:"/libraries/agents"},{label:s==="new"?"New Agent":s}),n}if(gn("/libraries/agents",e))return n.push({label:"Libraries",to:"/libraries/agents"},{label:"Agents"}),n;if(gn("/libraries/test-cases/:testCaseId",e)){const r=gn("/libraries/test-cases/:testCaseId",e),s=r?.params.testCaseId?decodeURIComponent(r.params.testCaseId):"Test Case";return n.push({label:"Libraries",to:"/libraries/test-cases"},{label:"Test Cases",to:"/libraries/test-cases"},{label:s}),n}if(gn("/libraries/test-cases",e))return n.push({label:"Libraries",to:"/libraries/test-cases"},{label:"Test Cases"}),n;if(gn("/compare/results",e))return n.push({label:"Compare Evaluations",to:"/compare"},{label:"Full Result Compare"}),n;if(gn("/compare",e)){const s=new URLSearchParams(t).get("mode")==="within-run"?"Agents":"Runs";return n.push({label:"Compare Evaluations",to:"/compare"},{label:s}),n}return n};function wJ(){const e=Kr(),t=new URLSearchParams(e.search).get("embed")==="1",n=bJ(e.pathname,e.search),{version:r}=Dn(),{isRunning:s,runningCount:o,queuedCount:i,oauthBlockedCount:c,streamStatus:d,reconnectStream:f}=VL(),m=i+o;return t?a.jsx("main",{className:"min-h-screen overflow-auto bg-background p-4",children:a.jsx(RP,{})}):a.jsx(bL,{children:a.jsxs("div",{className:"flex min-h-screen w-full",children:[a.jsx(DQ,{version:r}),a.jsxs("div",{className:"flex flex-1 flex-col",children:[a.jsxs("header",{className:"flex h-12 items-center gap-2 border-b bg-card px-4",children:[a.jsx(jL,{}),a.jsx(OL,{children:a.jsx(ML,{children:n.map((p,v)=>{const x=v===n.length-1;return a.jsxs(h.Fragment,{children:[a.jsx(IL,{children:p.to&&!x?a.jsx($L,{asChild:!0,children:a.jsx(At,{to:p.to,children:p.label})}):a.jsx(DL,{children:p.label})}),!x&&a.jsx(LL,{})]},`${p.label}-${v}`)})})}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[(s||i>0||c>0)&&a.jsxs(At,{to:"/run",className:"inline-flex items-center gap-2 rounded-full border px-2.5 py-1 hover:bg-muted/50 transition-colors",title:"Open Run Evaluation queue",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"Run Queue"}),a.jsx("span",{className:`inline-flex min-w-5 items-center justify-center rounded-full px-1.5 py-0.5 text-xs font-semibold ${c>0?"bg-yellow-500/20 text-yellow-800 dark:text-yellow-300":"bg-muted text-foreground"}`,children:m}),s&&a.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-emerald-500 border-t-transparent","aria-label":"Queue processing"}),c>0&&a.jsx("span",{className:"text-xs text-yellow-700 dark:text-yellow-400",children:"OAuth wait"})]}),a.jsxs("button",{type:"button",className:"inline-flex items-center gap-2 rounded-full border px-2.5 py-1 disabled:opacity-70",onClick:()=>{d==="disconnected"&&f()},disabled:d==="connecting",title:d==="disconnected"?"Retry queue connection":d==="connecting"?"Connecting to queue stream...":"Queue stream connected",children:[a.jsx("span",{className:`h-2 w-2 rounded-full ${d==="connected"?"bg-emerald-500":d==="connecting"?"bg-amber-400":"bg-rose-500"}`,"aria-hidden":"true"}),a.jsx("span",{className:`text-xs ${d==="connected"?"text-emerald-700":d==="connecting"?"text-muted-foreground":"text-destructive"}`,children:d})]})]})]}),a.jsx("main",{className:"flex-1 overflow-auto p-6",children:a.jsx(RP,{})})]})]})})}const KL=h.createContext(null);function jJ({children:e}){const{source:t}=Dn(),[n,r]=h.useState([]),[s,o]=h.useState(!0),i=h.useCallback(async()=>{o(!0);try{const v=await t.listConfigs();r(v)}finally{o(!1)}},[t]);h.useEffect(()=>{i()},[i]);const c=h.useCallback(v=>n.find(x=>x.id===v),[n]),d=h.useCallback(async v=>{const x=await t.createConfig(v);return r(j=>[...j,x]),x},[t]),f=h.useCallback(async(v,x)=>{const j=await t.updateConfig({...x,id:v});return r(y=>y.map(b=>b.id===v?j:b)),j},[t]),m=h.useCallback(async v=>{await t.deleteConfig(v),r(x=>x.filter(j=>j.id!==v))},[t]),p=h.useCallback(async v=>{const x=n.find(b=>b.id===v);if(!x)throw new Error("Config not found");const j={...structuredClone(x),id:`cfg-${Date.now()}`,name:`${x.name} (Copy)`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},y=await t.createConfig(j);return r(b=>[...b,y]),y},[n,t]);return a.jsx(KL.Provider,{value:{configs:n,loading:s,getConfig:c,addConfig:d,updateConfig:f,deleteConfig:m,cloneConfig:p,reload:i},children:e})}function up(){const e=h.useContext(KL);if(!e)throw new Error("useConfigs must be used within ConfigProvider");return e}const GL=h.createContext(null);function SJ({children:e}){const{source:t}=Dn(),[n,r]=h.useState({servers:[],agents:[],scenarios:[]}),[s,o]=h.useState(!0),i=h.useCallback(async()=>{o(!0);try{const f=await t.getLibraries();r(f)}finally{o(!1)}},[t]);h.useEffect(()=>{i()},[t]),h.useEffect(()=>{const f=()=>{i()};return window.addEventListener("focus",f),()=>{window.removeEventListener("focus",f)}},[t]);const c=h.useCallback(async f=>{r(f),await t.saveLibraries(f)},[t]),d=h.useMemo(()=>({...n,loading:s,setServers:async f=>c({...n,servers:f}),setAgents:async f=>c({...n,agents:f}),setScenarios:async f=>c({...n,scenarios:f}),reload:i}),[n,s,i,c]);return a.jsx(GL.Provider,{value:d,children:e})}function Ts(){const e=h.useContext(GL);if(!e)throw new Error("useLibraries must be used within LibraryProvider");return e}const Qe=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:$e("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Qe.displayName="Card";const $t=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:$e("flex flex-col space-y-1.5 p-6",e),...t}));$t.displayName="CardHeader";const Dt=h.forwardRef(({className:e,...t},n)=>a.jsx("h3",{ref:n,className:$e("text-2xl font-semibold leading-none tracking-tight",e),...t}));Dt.displayName="CardTitle";const Mr=h.forwardRef(({className:e,...t},n)=>a.jsx("p",{ref:n,className:$e("text-sm text-muted-foreground",e),...t}));Mr.displayName="CardDescription";const Je=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:$e("p-6 pt-0",e),...t}));Je.displayName="CardContent";const NJ=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:$e("flex items-center p-6 pt-0",e),...t}));NJ.displayName="CardFooter";const ia=h.forwardRef(({className:e,containerClassName:t,...n},r)=>a.jsx("div",{className:$e("relative w-full overflow-auto",t),children:a.jsx("table",{ref:r,className:$e("w-full caption-bottom text-sm",e),...n})}));ia.displayName="Table";const la=h.forwardRef(({className:e,...t},n)=>a.jsx("thead",{ref:n,className:$e("[&_tr]:border-b",e),...t}));la.displayName="TableHeader";const ca=h.forwardRef(({className:e,...t},n)=>a.jsx("tbody",{ref:n,className:$e("[&_tr:last-child]:border-0",e),...t}));ca.displayName="TableBody";const CJ=h.forwardRef(({className:e,...t},n)=>a.jsx("tfoot",{ref:n,className:$e("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));CJ.displayName="TableFooter";const Vt=h.forwardRef(({className:e,...t},n)=>a.jsx("tr",{ref:n,className:$e("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",e),...t}));Vt.displayName="TableRow";const ct=h.forwardRef(({className:e,...t},n)=>a.jsx("th",{ref:n,className:$e("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));ct.displayName="TableHead";const Ue=h.forwardRef(({className:e,...t},n)=>a.jsx("td",{ref:n,className:$e("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Ue.displayName="TableCell";const _J=h.forwardRef(({className:e,...t},n)=>a.jsx("caption",{ref:n,className:$e("mt-4 text-sm text-muted-foreground",e),...t}));_J.displayName="TableCaption";function nr({title:e,value:t,subtitle:n,icon:r,trend:s,compact:o=!1}){return a.jsx(Qe,{className:o?"h-fit self-start":void 0,children:a.jsx(Je,{className:o?"p-2":"p-4",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:o?"space-y-0.5":"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:e}),a.jsx("p",{className:o?"text-lg font-bold":"text-2xl font-bold",children:t}),n&&a.jsxs("p",{className:`text-xs ${s==="up"?"text-success":s==="down"?"text-destructive":"text-muted-foreground"}`,children:[s==="up"&&"↑ ",s==="down"&&"↓ ",n]})]}),a.jsx("div",{className:o?"rounded-lg bg-primary/10 p-0.5":"rounded-lg bg-primary/10 p-2",children:a.jsx(r,{className:"h-4 w-4 text-primary"})})]})})})}const kJ=Bl("inline-flex items-center rounded-full 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 hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}}),et=h.forwardRef(({className:e,variant:t,asChild:n,...r},s)=>{const o=n?Pi:"div";return a.jsx(o,{ref:s,className:$e(kJ({variant:t}),e),...r})});et.displayName="Badge";function zs({rate:e,className:t}){const n=Math.round(e*100),r=n>=80?"default":n>=50?"secondary":"destructive";return a.jsxs(et,{variant:r,className:`font-mono text-xs ${n>=80?"bg-success/15 text-success hover:bg-success/20 border-0":n>=50?"bg-warning/15 text-warning hover:bg-warning/20 border-0":"bg-destructive/15 text-destructive hover:bg-destructive/20 border-0"} ${t??""}`,children:[n,"%"]})}function AJ(e){const t=[];for(const n of e.scenarios)for(const r of n.runs)r.error&&t.push(r.error),t.push(...r.failureReasons);return t.map(n=>String(n??"").trim()).filter(Boolean)}function EJ(e){const t=e.toLowerCase();return t.includes("invalid_token")||t.includes("authentication failed")||t.includes("bearer token")||t.includes("oauth")?"auth":t.includes("429")||t.includes("too many requests")||t.includes("rate limit")?"rate_limit":t.includes("scenario error:")||t.includes("failed to list tools")||t.includes("failed to connect to mcp server")||t.includes("tool call failed")||t.includes("fetch failed")||t.includes("streamable http error")?"infra":null}function PJ(e){return e==="auth"?"Auth error":e==="rate_limit"?"Rate limited":"Infra error"}function RJ(e){const t=AJ(e),n=["auth","rate_limit","infra"];for(const r of n){const s=t.find(o=>EJ(o)===r);if(s)return{kind:r,label:PJ(r),detail:s}}return null}function TJ(e){return e==="auth"?"border-amber-500/30 bg-amber-500/10 text-amber-700":e==="rate_limit"?"border-orange-500/30 bg-orange-500/10 text-orange-700":"border-slate-500/30 bg-slate-500/10 text-slate-700"}function YL({run:e}){const t=RJ(e);return t?a.jsx(Ro,{delayDuration:0,children:a.jsxs(To,{children:[a.jsx(Oo,{asChild:!0,children:a.jsx(et,{variant:"outline",className:`h-5 text-[10px] ${TJ(t.kind)}`,children:t.label})}),a.jsx(Gs,{className:"max-w-sm text-xs",children:a.jsx("p",{children:t.detail})})]})}):null}var bb,ZP;function fa(){if(ZP)return bb;ZP=1;var e=Array.isArray;return bb=e,bb}var wb,eR;function XL(){if(eR)return wb;eR=1;var e=typeof Ah=="object"&&Ah&&Ah.Object===Object&&Ah;return wb=e,wb}var jb,tR;function Js(){if(tR)return jb;tR=1;var e=XL(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return jb=n,jb}var Sb,nR;function dp(){if(nR)return Sb;nR=1;var e=Js(),t=e.Symbol;return Sb=t,Sb}var Nb,rR;function OJ(){if(rR)return Nb;rR=1;var e=dp(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,s=e?e.toStringTag:void 0;function o(i){var c=n.call(i,s),d=i[s];try{i[s]=void 0;var f=!0}catch{}var m=r.call(i);return f&&(c?i[s]=d:delete i[s]),m}return Nb=o,Nb}var Cb,aR;function MJ(){if(aR)return Cb;aR=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Cb=n,Cb}var _b,sR;function zo(){if(sR)return _b;sR=1;var e=dp(),t=OJ(),n=MJ(),r="[object Null]",s="[object Undefined]",o=e?e.toStringTag:void 0;function i(c){return c==null?c===void 0?s:r:o&&o in Object(c)?t(c):n(c)}return _b=i,_b}var kb,oR;function Bo(){if(oR)return kb;oR=1;function e(t){return t!=null&&typeof t=="object"}return kb=e,kb}var Ab,iR;function Iu(){if(iR)return Ab;iR=1;var e=zo(),t=Bo(),n="[object Symbol]";function r(s){return typeof s=="symbol"||t(s)&&e(s)==n}return Ab=r,Ab}var Eb,lR;function WC(){if(lR)return Eb;lR=1;var e=fa(),t=Iu(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function s(o,i){if(e(o))return!1;var c=typeof o;return c=="number"||c=="symbol"||c=="boolean"||o==null||t(o)?!0:r.test(o)||!n.test(o)||i!=null&&o in Object(i)}return Eb=s,Eb}var Pb,cR;function Ri(){if(cR)return Pb;cR=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Pb=e,Pb}var Rb,uR;function HC(){if(uR)return Rb;uR=1;var e=zo(),t=Ri(),n="[object AsyncFunction]",r="[object Function]",s="[object GeneratorFunction]",o="[object Proxy]";function i(c){if(!t(c))return!1;var d=e(c);return d==r||d==s||d==n||d==o}return Rb=i,Rb}var Tb,dR;function IJ(){if(dR)return Tb;dR=1;var e=Js(),t=e["__core-js_shared__"];return Tb=t,Tb}var Ob,fR;function $J(){if(fR)return Ob;fR=1;var e=IJ(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return Ob=n,Ob}var Mb,pR;function QL(){if(pR)return Mb;pR=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return Mb=n,Mb}var Ib,hR;function DJ(){if(hR)return Ib;hR=1;var e=HC(),t=$J(),n=Ri(),r=QL(),s=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,i=Function.prototype,c=Object.prototype,d=i.toString,f=c.hasOwnProperty,m=RegExp("^"+d.call(f).replace(s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(v){if(!n(v)||t(v))return!1;var x=e(v)?m:o;return x.test(r(v))}return Ib=p,Ib}var $b,mR;function LJ(){if(mR)return $b;mR=1;function e(t,n){return t?.[n]}return $b=e,$b}var Db,gR;function Ul(){if(gR)return Db;gR=1;var e=DJ(),t=LJ();function n(r,s){var o=t(r,s);return e(o)?o:void 0}return Db=n,Db}var Lb,vR;function uv(){if(vR)return Lb;vR=1;var e=Ul(),t=e(Object,"create");return Lb=t,Lb}var Fb,xR;function FJ(){if(xR)return Fb;xR=1;var e=uv();function t(){this.__data__=e?e(null):{},this.size=0}return Fb=t,Fb}var zb,yR;function zJ(){if(yR)return zb;yR=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return zb=e,zb}var Bb,bR;function BJ(){if(bR)return Bb;bR=1;var e=uv(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function s(o){var i=this.__data__;if(e){var c=i[o];return c===t?void 0:c}return r.call(i,o)?i[o]:void 0}return Bb=s,Bb}var qb,wR;function qJ(){if(wR)return qb;wR=1;var e=uv(),t=Object.prototype,n=t.hasOwnProperty;function r(s){var o=this.__data__;return e?o[s]!==void 0:n.call(o,s)}return qb=r,qb}var Ub,jR;function UJ(){if(jR)return Ub;jR=1;var e=uv(),t="__lodash_hash_undefined__";function n(r,s){var o=this.__data__;return this.size+=this.has(r)?0:1,o[r]=e&&s===void 0?t:s,this}return Ub=n,Ub}var Wb,SR;function WJ(){if(SR)return Wb;SR=1;var e=FJ(),t=zJ(),n=BJ(),r=qJ(),s=UJ();function o(i){var c=-1,d=i==null?0:i.length;for(this.clear();++c<d;){var f=i[c];this.set(f[0],f[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=s,Wb=o,Wb}var Hb,NR;function HJ(){if(NR)return Hb;NR=1;function e(){this.__data__=[],this.size=0}return Hb=e,Hb}var Vb,CR;function VC(){if(CR)return Vb;CR=1;function e(t,n){return t===n||t!==t&&n!==n}return Vb=e,Vb}var Kb,_R;function dv(){if(_R)return Kb;_R=1;var e=VC();function t(n,r){for(var s=n.length;s--;)if(e(n[s][0],r))return s;return-1}return Kb=t,Kb}var Gb,kR;function VJ(){if(kR)return Gb;kR=1;var e=dv(),t=Array.prototype,n=t.splice;function r(s){var o=this.__data__,i=e(o,s);if(i<0)return!1;var c=o.length-1;return i==c?o.pop():n.call(o,i,1),--this.size,!0}return Gb=r,Gb}var Yb,AR;function KJ(){if(AR)return Yb;AR=1;var e=dv();function t(n){var r=this.__data__,s=e(r,n);return s<0?void 0:r[s][1]}return Yb=t,Yb}var Xb,ER;function GJ(){if(ER)return Xb;ER=1;var e=dv();function t(n){return e(this.__data__,n)>-1}return Xb=t,Xb}var Qb,PR;function YJ(){if(PR)return Qb;PR=1;var e=dv();function t(n,r){var s=this.__data__,o=e(s,n);return o<0?(++this.size,s.push([n,r])):s[o][1]=r,this}return Qb=t,Qb}var Jb,RR;function fv(){if(RR)return Jb;RR=1;var e=HJ(),t=VJ(),n=KJ(),r=GJ(),s=YJ();function o(i){var c=-1,d=i==null?0:i.length;for(this.clear();++c<d;){var f=i[c];this.set(f[0],f[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=s,Jb=o,Jb}var Zb,TR;function KC(){if(TR)return Zb;TR=1;var e=Ul(),t=Js(),n=e(t,"Map");return Zb=n,Zb}var e0,OR;function XJ(){if(OR)return e0;OR=1;var e=WJ(),t=fv(),n=KC();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return e0=r,e0}var t0,MR;function QJ(){if(MR)return t0;MR=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return t0=e,t0}var n0,IR;function pv(){if(IR)return n0;IR=1;var e=QJ();function t(n,r){var s=n.__data__;return e(r)?s[typeof r=="string"?"string":"hash"]:s.map}return n0=t,n0}var r0,$R;function JJ(){if($R)return r0;$R=1;var e=pv();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return r0=t,r0}var a0,DR;function ZJ(){if(DR)return a0;DR=1;var e=pv();function t(n){return e(this,n).get(n)}return a0=t,a0}var s0,LR;function eZ(){if(LR)return s0;LR=1;var e=pv();function t(n){return e(this,n).has(n)}return s0=t,s0}var o0,FR;function tZ(){if(FR)return o0;FR=1;var e=pv();function t(n,r){var s=e(this,n),o=s.size;return s.set(n,r),this.size+=s.size==o?0:1,this}return o0=t,o0}var i0,zR;function GC(){if(zR)return i0;zR=1;var e=XJ(),t=JJ(),n=ZJ(),r=eZ(),s=tZ();function o(i){var c=-1,d=i==null?0:i.length;for(this.clear();++c<d;){var f=i[c];this.set(f[0],f[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=s,i0=o,i0}var l0,BR;function JL(){if(BR)return l0;BR=1;var e=GC(),t="Expected a function";function n(r,s){if(typeof r!="function"||s!=null&&typeof s!="function")throw new TypeError(t);var o=function(){var i=arguments,c=s?s.apply(this,i):i[0],d=o.cache;if(d.has(c))return d.get(c);var f=r.apply(this,i);return o.cache=d.set(c,f)||d,f};return o.cache=new(n.Cache||e),o}return n.Cache=e,l0=n,l0}var c0,qR;function nZ(){if(qR)return c0;qR=1;var e=JL(),t=500;function n(r){var s=e(r,function(i){return o.size===t&&o.clear(),i}),o=s.cache;return s}return c0=n,c0}var u0,UR;function rZ(){if(UR)return u0;UR=1;var e=nZ(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(s){var o=[];return s.charCodeAt(0)===46&&o.push(""),s.replace(t,function(i,c,d,f){o.push(d?f.replace(n,"$1"):c||i)}),o});return u0=r,u0}var d0,WR;function YC(){if(WR)return d0;WR=1;function e(t,n){for(var r=-1,s=t==null?0:t.length,o=Array(s);++r<s;)o[r]=n(t[r],r,t);return o}return d0=e,d0}var f0,HR;function aZ(){if(HR)return f0;HR=1;var e=dp(),t=YC(),n=fa(),r=Iu(),s=e?e.prototype:void 0,o=s?s.toString:void 0;function i(c){if(typeof c=="string")return c;if(n(c))return t(c,i)+"";if(r(c))return o?o.call(c):"";var d=c+"";return d=="0"&&1/c==-1/0?"-0":d}return f0=i,f0}var p0,VR;function ZL(){if(VR)return p0;VR=1;var e=aZ();function t(n){return n==null?"":e(n)}return p0=t,p0}var h0,KR;function e4(){if(KR)return h0;KR=1;var e=fa(),t=WC(),n=rZ(),r=ZL();function s(o,i){return e(o)?o:t(o,i)?[o]:n(r(o))}return h0=s,h0}var m0,GR;function hv(){if(GR)return m0;GR=1;var e=Iu();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return m0=t,m0}var g0,YR;function XC(){if(YR)return g0;YR=1;var e=e4(),t=hv();function n(r,s){s=e(s,r);for(var o=0,i=s.length;r!=null&&o<i;)r=r[t(s[o++])];return o&&o==i?r:void 0}return g0=n,g0}var v0,XR;function t4(){if(XR)return v0;XR=1;var e=XC();function t(n,r,s){var o=n==null?void 0:e(n,r);return o===void 0?s:o}return v0=t,v0}var sZ=t4();const _a=xn(sZ);var x0,QR;function oZ(){if(QR)return x0;QR=1;function e(t){return t==null}return x0=e,x0}var iZ=oZ();const Gt=xn(iZ);var y0,JR;function lZ(){if(JR)return y0;JR=1;var e=zo(),t=fa(),n=Bo(),r="[object String]";function s(o){return typeof o=="string"||!t(o)&&n(o)&&e(o)==r}return y0=s,y0}var cZ=lZ();const Cl=xn(cZ);var uZ=HC();const Kt=xn(uZ);var dZ=Ri();const $u=xn(dZ);var b0={exports:{}},hn={};var ZR;function fZ(){if(ZR)return hn;ZR=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.server_context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),j;j=Symbol.for("react.module.reference");function y(b){if(typeof b=="object"&&b!==null){var S=b.$$typeof;switch(S){case e:switch(b=b.type,b){case n:case s:case r:case f:case m:return b;default:switch(b=b&&b.$$typeof,b){case c:case i:case d:case v:case p:case o:return b;default:return S}}case t:return S}}}return hn.ContextConsumer=i,hn.ContextProvider=o,hn.Element=e,hn.ForwardRef=d,hn.Fragment=n,hn.Lazy=v,hn.Memo=p,hn.Portal=t,hn.Profiler=s,hn.StrictMode=r,hn.Suspense=f,hn.SuspenseList=m,hn.isAsyncMode=function(){return!1},hn.isConcurrentMode=function(){return!1},hn.isContextConsumer=function(b){return y(b)===i},hn.isContextProvider=function(b){return y(b)===o},hn.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===e},hn.isForwardRef=function(b){return y(b)===d},hn.isFragment=function(b){return y(b)===n},hn.isLazy=function(b){return y(b)===v},hn.isMemo=function(b){return y(b)===p},hn.isPortal=function(b){return y(b)===t},hn.isProfiler=function(b){return y(b)===s},hn.isStrictMode=function(b){return y(b)===r},hn.isSuspense=function(b){return y(b)===f},hn.isSuspenseList=function(b){return y(b)===m},hn.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===n||b===s||b===r||b===f||b===m||b===x||typeof b=="object"&&b!==null&&(b.$$typeof===v||b.$$typeof===p||b.$$typeof===o||b.$$typeof===i||b.$$typeof===d||b.$$typeof===j||b.getModuleId!==void 0)},hn.typeOf=y,hn}var eT;function pZ(){return eT||(eT=1,b0.exports=fZ()),b0.exports}var hZ=pZ(),w0,tT;function n4(){if(tT)return w0;tT=1;var e=zo(),t=Bo(),n="[object Number]";function r(s){return typeof s=="number"||t(s)&&e(s)==n}return w0=r,w0}var j0,nT;function mZ(){if(nT)return j0;nT=1;var e=n4();function t(n){return e(n)&&n!=+n}return j0=t,j0}var gZ=mZ();const fp=xn(gZ);var vZ=n4();const xZ=xn(vZ);var Br=function(t){return t===0?0:t>0?1:-1},ul=function(t){return Cl(t)&&t.indexOf("%")===t.length-1},rt=function(t){return xZ(t)&&!fp(t)},yZ=function(t){return Gt(t)},dr=function(t){return rt(t)||Cl(t)},bZ=0,Du=function(t){var n=++bZ;return"".concat(t||"").concat(n)},qr=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!rt(t)&&!Cl(t))return r;var o;if(ul(t)){var i=t.indexOf("%");o=n*parseFloat(t.slice(0,i))/100}else o=+t;return fp(o)&&(o=r),s&&o>n&&(o=n),o},Rc=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},wZ=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},s=0;s<n;s++)if(!r[t[s]])r[t[s]]=!0;else return!0;return!1},ja=function(t,n){return rt(t)&&rt(n)?function(r){return t+r*(n-t)}:function(){return n}};function Nm(e,t,n){return!e||!e.length?null:e.find(function(r){return r&&(typeof t=="function"?t(r):_a(r,t))===n})}var jZ=function(t,n){return rt(t)&&rt(n)?t-n:Cl(t)&&Cl(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function Wc(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function f1(e){"@babel/helpers - typeof";return f1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f1(e)}var SZ=["viewBox","children"],NZ=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],rT=["points","pathLength"],S0={svg:SZ,polygon:rT,polyline:rT},QC=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],Cm=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var r=t;if(h.isValidElement(t)&&(r=t.props),!$u(r))return null;var s={};return Object.keys(r).forEach(function(o){QC.includes(o)&&(s[o]=n||function(i){return r[o](r,i)})}),s},CZ=function(t,n,r){return function(s){return t(n,r,s),null}},_l=function(t,n,r){if(!$u(t)||f1(t)!=="object")return null;var s=null;return Object.keys(t).forEach(function(o){var i=t[o];QC.includes(o)&&typeof i=="function"&&(s||(s={}),s[o]=CZ(i,n,r))}),s},_Z=["children"],kZ=["children"];function aT(e,t){if(e==null)return{};var n=AZ(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function AZ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function p1(e){"@babel/helpers - typeof";return p1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p1(e)}var sT={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},jo=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},oT=null,N0=null,JC=function e(t){if(t===oT&&Array.isArray(N0))return N0;var n=[];return h.Children.forEach(t,function(r){Gt(r)||(hZ.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),N0=n,oT=t,n};function ka(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(s){return jo(s)}):r=[jo(t)],JC(e).forEach(function(s){var o=_a(s,"type.displayName")||_a(s,"type.name");r.indexOf(o)!==-1&&n.push(s)}),n}function ba(e,t){var n=ka(e,t);return n&&n[0]}var iT=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,s=n.height;return!(!rt(r)||r<=0||!rt(s)||s<=0)},EZ=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],PZ=function(t){return t&&t.type&&Cl(t.type)&&EZ.indexOf(t.type)>=0},RZ=function(t){return t&&p1(t)==="object"&&"clipDot"in t},TZ=function(t,n,r,s){var o,i=(o=S0?.[s])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!Kt(t)&&(s&&i.includes(n)||NZ.includes(n))||r&&QC.includes(n)},Mt=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var s=t;if(h.isValidElement(t)&&(s=t.props),!$u(s))return null;var o={};return Object.keys(s).forEach(function(i){var c;TZ((c=s)===null||c===void 0?void 0:c[i],i,n,r)&&(o[i]=s[i])}),o},h1=function e(t,n){if(t===n)return!0;var r=h.Children.count(t);if(r!==h.Children.count(n))return!1;if(r===0)return!0;if(r===1)return lT(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var s=0;s<r;s++){var o=t[s],i=n[s];if(Array.isArray(o)||Array.isArray(i)){if(!e(o,i))return!1}else if(!lT(o,i))return!1}return!0},lT=function(t,n){if(Gt(t)&&Gt(n))return!0;if(!Gt(t)&&!Gt(n)){var r=t.props||{},s=r.children,o=aT(r,_Z),i=n.props||{},c=i.children,d=aT(i,kZ);return s&&c?Wc(o,d)&&h1(s,c):!s&&!c?Wc(o,d):!1}return!1},cT=function(t,n){var r=[],s={};return JC(t).forEach(function(o,i){if(PZ(o))r.push(o);else if(o){var c=jo(o.type),d=n[c]||{},f=d.handler,m=d.once;if(f&&(!m||!s[c])){var p=f(o,c,i);r.push(p),s[c]=!0}}}),r},OZ=function(t){var n=t&&t.type;return n&&sT[n]?sT[n]:null},MZ=function(t,n){return JC(n).indexOf(t)},IZ=["children","width","height","viewBox","className","style","title","desc"];function m1(){return m1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m1.apply(this,arguments)}function $Z(e,t){if(e==null)return{};var n=DZ(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function DZ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function g1(e){var t=e.children,n=e.width,r=e.height,s=e.viewBox,o=e.className,i=e.style,c=e.title,d=e.desc,f=$Z(e,IZ),m=s||{width:n,height:r,x:0,y:0},p=Yt("recharts-surface",o);return Q.createElement("svg",m1({},Mt(f,!0,"svg"),{className:p,width:n,height:r,style:i,viewBox:"".concat(m.x," ").concat(m.y," ").concat(m.width," ").concat(m.height)}),Q.createElement("title",null,c),Q.createElement("desc",null,d),t)}var LZ=["children","className"];function v1(){return v1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v1.apply(this,arguments)}function FZ(e,t){if(e==null)return{};var n=zZ(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function zZ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var un=Q.forwardRef(function(e,t){var n=e.children,r=e.className,s=FZ(e,LZ),o=Yt("recharts-layer",r);return Q.createElement("g",v1({className:o},Mt(s,!0),{ref:t}),n)}),So=function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),o=2;o<r;o++)s[o-2]=arguments[o]},C0,uT;function BZ(){if(uT)return C0;uT=1;function e(t,n,r){var s=-1,o=t.length;n<0&&(n=-n>o?0:o+n),r=r>o?o:r,r<0&&(r+=o),o=n>r?0:r-n>>>0,n>>>=0;for(var i=Array(o);++s<o;)i[s]=t[s+n];return i}return C0=e,C0}var _0,dT;function qZ(){if(dT)return _0;dT=1;var e=BZ();function t(n,r,s){var o=n.length;return s=s===void 0?o:s,!r&&s>=o?n:e(n,r,s)}return _0=t,_0}var k0,fT;function r4(){if(fT)return k0;fT=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=t+n+r,o="\\ufe0e\\ufe0f",i="\\u200d",c=RegExp("["+i+e+s+o+"]");function d(f){return c.test(f)}return k0=d,k0}var A0,pT;function UZ(){if(pT)return A0;pT=1;function e(t){return t.split("")}return A0=e,A0}var E0,hT;function WZ(){if(hT)return E0;hT=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=t+n+r,o="\\ufe0e\\ufe0f",i="["+e+"]",c="["+s+"]",d="\\ud83c[\\udffb-\\udfff]",f="(?:"+c+"|"+d+")",m="[^"+e+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",v="[\\ud800-\\udbff][\\udc00-\\udfff]",x="\\u200d",j=f+"?",y="["+o+"]?",b="(?:"+x+"(?:"+[m,p,v].join("|")+")"+y+j+")*",S=y+j+b,N="(?:"+[m+c+"?",c,p,v,i].join("|")+")",C=RegExp(d+"(?="+d+")|"+N+S,"g");function k(A){return A.match(C)||[]}return E0=k,E0}var P0,mT;function HZ(){if(mT)return P0;mT=1;var e=UZ(),t=r4(),n=WZ();function r(s){return t(s)?n(s):e(s)}return P0=r,P0}var R0,gT;function VZ(){if(gT)return R0;gT=1;var e=qZ(),t=r4(),n=HZ(),r=ZL();function s(o){return function(i){i=r(i);var c=t(i)?n(i):void 0,d=c?c[0]:i.charAt(0),f=c?e(c,1).join(""):i.slice(1);return d[o]()+f}}return R0=s,R0}var T0,vT;function KZ(){if(vT)return T0;vT=1;var e=VZ(),t=e("toUpperCase");return T0=t,T0}var GZ=KZ();const mv=xn(GZ);function kn(e){return function(){return e}}const a4=Math.cos,_m=Math.sin,Os=Math.sqrt,km=Math.PI,gv=2*km,x1=Math.PI,y1=2*x1,ol=1e-6,YZ=y1-ol;function s4(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function XZ(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return s4;const n=10**t;return function(r){this._+=r[0];for(let s=1,o=r.length;s<o;++s)this._+=Math.round(arguments[s]*n)/n+r[s]}}class QZ{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?s4:XZ(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,s){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+s}`}bezierCurveTo(t,n,r,s,o,i){this._append`C${+t},${+n},${+r},${+s},${this._x1=+o},${this._y1=+i}`}arcTo(t,n,r,s,o){if(t=+t,n=+n,r=+r,s=+s,o=+o,o<0)throw new Error(`negative radius: ${o}`);let i=this._x1,c=this._y1,d=r-t,f=s-n,m=i-t,p=c-n,v=m*m+p*p;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(v>ol)if(!(Math.abs(p*d-f*m)>ol)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let x=r-i,j=s-c,y=d*d+f*f,b=x*x+j*j,S=Math.sqrt(y),N=Math.sqrt(v),C=o*Math.tan((x1-Math.acos((y+v-b)/(2*S*N)))/2),k=C/N,A=C/S;Math.abs(k-1)>ol&&this._append`L${t+k*m},${n+k*p}`,this._append`A${o},${o},0,0,${+(p*x>m*j)},${this._x1=t+A*d},${this._y1=n+A*f}`}}arc(t,n,r,s,o,i){if(t=+t,n=+n,r=+r,i=!!i,r<0)throw new Error(`negative radius: ${r}`);let c=r*Math.cos(s),d=r*Math.sin(s),f=t+c,m=n+d,p=1^i,v=i?s-o:o-s;this._x1===null?this._append`M${f},${m}`:(Math.abs(this._x1-f)>ol||Math.abs(this._y1-m)>ol)&&this._append`L${f},${m}`,r&&(v<0&&(v=v%y1+y1),v>YZ?this._append`A${r},${r},0,1,${p},${t-c},${n-d}A${r},${r},0,1,${p},${this._x1=f},${this._y1=m}`:v>ol&&this._append`A${r},${r},0,${+(v>=x1)},${p},${this._x1=t+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(t,n,r,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+s}h${-r}Z`}toString(){return this._}}function ZC(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new QZ(t)}function e_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function o4(e){this._context=e}o4.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function vv(e){return new o4(e)}function i4(e){return e[0]}function l4(e){return e[1]}function c4(e,t){var n=kn(!0),r=null,s=vv,o=null,i=ZC(c);e=typeof e=="function"?e:e===void 0?i4:kn(e),t=typeof t=="function"?t:t===void 0?l4:kn(t);function c(d){var f,m=(d=e_(d)).length,p,v=!1,x;for(r==null&&(o=s(x=i())),f=0;f<=m;++f)!(f<m&&n(p=d[f],f,d))===v&&((v=!v)?o.lineStart():o.lineEnd()),v&&o.point(+e(p,f,d),+t(p,f,d));if(x)return o=null,x+""||null}return c.x=function(d){return arguments.length?(e=typeof d=="function"?d:kn(+d),c):e},c.y=function(d){return arguments.length?(t=typeof d=="function"?d:kn(+d),c):t},c.defined=function(d){return arguments.length?(n=typeof d=="function"?d:kn(!!d),c):n},c.curve=function(d){return arguments.length?(s=d,r!=null&&(o=s(r)),c):s},c.context=function(d){return arguments.length?(d==null?r=o=null:o=s(r=d),c):r},c}function zh(e,t,n){var r=null,s=kn(!0),o=null,i=vv,c=null,d=ZC(f);e=typeof e=="function"?e:e===void 0?i4:kn(+e),t=typeof t=="function"?t:kn(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?l4:kn(+n);function f(p){var v,x,j,y=(p=e_(p)).length,b,S=!1,N,C=new Array(y),k=new Array(y);for(o==null&&(c=i(N=d())),v=0;v<=y;++v){if(!(v<y&&s(b=p[v],v,p))===S)if(S=!S)x=v,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),j=v-1;j>=x;--j)c.point(C[j],k[j]);c.lineEnd(),c.areaEnd()}S&&(C[v]=+e(b,v,p),k[v]=+t(b,v,p),c.point(r?+r(b,v,p):C[v],n?+n(b,v,p):k[v]))}if(N)return c=null,N+""||null}function m(){return c4().defined(s).curve(i).context(o)}return f.x=function(p){return arguments.length?(e=typeof p=="function"?p:kn(+p),r=null,f):e},f.x0=function(p){return arguments.length?(e=typeof p=="function"?p:kn(+p),f):e},f.x1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:kn(+p),f):r},f.y=function(p){return arguments.length?(t=typeof p=="function"?p:kn(+p),n=null,f):t},f.y0=function(p){return arguments.length?(t=typeof p=="function"?p:kn(+p),f):t},f.y1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:kn(+p),f):n},f.lineX0=f.lineY0=function(){return m().x(e).y(t)},f.lineY1=function(){return m().x(e).y(n)},f.lineX1=function(){return m().x(r).y(t)},f.defined=function(p){return arguments.length?(s=typeof p=="function"?p:kn(!!p),f):s},f.curve=function(p){return arguments.length?(i=p,o!=null&&(c=i(o)),f):i},f.context=function(p){return arguments.length?(p==null?o=c=null:c=i(o=p),f):o},f}class u4{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function JZ(e){return new u4(e,!0)}function ZZ(e){return new u4(e,!1)}const t_={draw(e,t){const n=Os(t/km);e.moveTo(n,0),e.arc(0,0,n,0,gv)}},eee={draw(e,t){const n=Os(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},d4=Os(1/3),tee=d4*2,nee={draw(e,t){const n=Os(t/tee),r=n*d4;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},ree={draw(e,t){const n=Os(t),r=-n/2;e.rect(r,r,n,n)}},aee=.8908130915292852,f4=_m(km/10)/_m(7*km/10),see=_m(gv/10)*f4,oee=-a4(gv/10)*f4,iee={draw(e,t){const n=Os(t*aee),r=see*n,s=oee*n;e.moveTo(0,-n),e.lineTo(r,s);for(let o=1;o<5;++o){const i=gv*o/5,c=a4(i),d=_m(i);e.lineTo(d*n,-c*n),e.lineTo(c*r-d*s,d*r+c*s)}e.closePath()}},O0=Os(3),lee={draw(e,t){const n=-Os(t/(O0*3));e.moveTo(0,n*2),e.lineTo(-O0*n,-n),e.lineTo(O0*n,-n),e.closePath()}},Da=-.5,La=Os(3)/2,b1=1/Os(12),cee=(b1/2+1)*3,uee={draw(e,t){const n=Os(t/cee),r=n/2,s=n*b1,o=r,i=n*b1+n,c=-o,d=i;e.moveTo(r,s),e.lineTo(o,i),e.lineTo(c,d),e.lineTo(Da*r-La*s,La*r+Da*s),e.lineTo(Da*o-La*i,La*o+Da*i),e.lineTo(Da*c-La*d,La*c+Da*d),e.lineTo(Da*r+La*s,Da*s-La*r),e.lineTo(Da*o+La*i,Da*i-La*o),e.lineTo(Da*c+La*d,Da*d-La*c),e.closePath()}};function dee(e,t){let n=null,r=ZC(s);e=typeof e=="function"?e:kn(e||t_),t=typeof t=="function"?t:kn(t===void 0?64:+t);function s(){let o;if(n||(n=o=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),o)return n=null,o+""||null}return s.type=function(o){return arguments.length?(e=typeof o=="function"?o:kn(o),s):e},s.size=function(o){return arguments.length?(t=typeof o=="function"?o:kn(+o),s):t},s.context=function(o){return arguments.length?(n=o??null,s):n},s}function Am(){}function Em(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function p4(e){this._context=e}p4.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Em(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Em(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function fee(e){return new p4(e)}function h4(e){this._context=e}h4.prototype={areaStart:Am,areaEnd:Am,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Em(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function pee(e){return new h4(e)}function m4(e){this._context=e}m4.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Em(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function hee(e){return new m4(e)}function g4(e){this._context=e}g4.prototype={areaStart:Am,areaEnd:Am,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function mee(e){return new g4(e)}function xT(e){return e<0?-1:1}function yT(e,t,n){var r=e._x1-e._x0,s=t-e._x1,o=(e._y1-e._y0)/(r||s<0&&-0),i=(n-e._y1)/(s||r<0&&-0),c=(o*s+i*r)/(r+s);return(xT(o)+xT(i))*Math.min(Math.abs(o),Math.abs(i),.5*Math.abs(c))||0}function bT(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function M0(e,t,n){var r=e._x0,s=e._y0,o=e._x1,i=e._y1,c=(o-r)/3;e._context.bezierCurveTo(r+c,s+c*t,o-c,i-c*n,o,i)}function Pm(e){this._context=e}Pm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:M0(this,this._t0,bT(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,M0(this,bT(this,n=yT(this,e,t)),n);break;default:M0(this,this._t0,n=yT(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function v4(e){this._context=new x4(e)}(v4.prototype=Object.create(Pm.prototype)).point=function(e,t){Pm.prototype.point.call(this,t,e)};function x4(e){this._context=e}x4.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,s,o){this._context.bezierCurveTo(t,e,r,n,o,s)}};function gee(e){return new Pm(e)}function vee(e){return new v4(e)}function y4(e){this._context=e}y4.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=wT(e),s=wT(t),o=0,i=1;i<n;++o,++i)this._context.bezierCurveTo(r[0][o],s[0][o],r[1][o],s[1][o],e[i],t[i]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function wT(e){var t,n=e.length-1,r,s=new Array(n),o=new Array(n),i=new Array(n);for(s[0]=0,o[0]=2,i[0]=e[0]+2*e[1],t=1;t<n-1;++t)s[t]=1,o[t]=4,i[t]=4*e[t]+2*e[t+1];for(s[n-1]=2,o[n-1]=7,i[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=s[t]/o[t-1],o[t]-=r,i[t]-=r*i[t-1];for(s[n-1]=i[n-1]/o[n-1],t=n-2;t>=0;--t)s[t]=(i[t]-s[t+1])/o[t];for(o[n-1]=(e[n]+s[n-1])/2,t=0;t<n-1;++t)o[t]=2*e[t+1]-s[t+1];return[s,o]}function xee(e){return new y4(e)}function xv(e,t){this._context=e,this._t=t}xv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function yee(e){return new xv(e,.5)}function bee(e){return new xv(e,0)}function wee(e){return new xv(e,1)}function Zc(e,t){if((i=e.length)>1)for(var n=1,r,s,o=e[t[0]],i,c=o.length;n<i;++n)for(s=o,o=e[t[n]],r=0;r<c;++r)o[r][1]+=o[r][0]=isNaN(s[r][1])?s[r][0]:s[r][1]}function w1(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function jee(e,t){return e[t]}function See(e){const t=[];return t.key=e,t}function Nee(){var e=kn([]),t=w1,n=Zc,r=jee;function s(o){var i=Array.from(e.apply(this,arguments),See),c,d=i.length,f=-1,m;for(const p of o)for(c=0,++f;c<d;++c)(i[c][f]=[0,+r(p,i[c].key,f,o)]).data=p;for(c=0,m=e_(t(i));c<d;++c)i[m[c]].index=c;return n(i,m),i}return s.keys=function(o){return arguments.length?(e=typeof o=="function"?o:kn(Array.from(o)),s):e},s.value=function(o){return arguments.length?(r=typeof o=="function"?o:kn(+o),s):r},s.order=function(o){return arguments.length?(t=o==null?w1:typeof o=="function"?o:kn(Array.from(o)),s):t},s.offset=function(o){return arguments.length?(n=o??Zc,s):n},s}function Cee(e,t){if((r=e.length)>0){for(var n,r,s=0,o=e[0].length,i;s<o;++s){for(i=n=0;n<r;++n)i+=e[n][s][1]||0;if(i)for(n=0;n<r;++n)e[n][s][1]/=i}Zc(e,t)}}function _ee(e,t){if((s=e.length)>0){for(var n=0,r=e[t[0]],s,o=r.length;n<o;++n){for(var i=0,c=0;i<s;++i)c+=e[i][n][1]||0;r[n][1]+=r[n][0]=-c/2}Zc(e,t)}}function kee(e,t){if(!(!((i=e.length)>0)||!((o=(s=e[t[0]]).length)>0))){for(var n=0,r=1,s,o,i;r<o;++r){for(var c=0,d=0,f=0;c<i;++c){for(var m=e[t[c]],p=m[r][1]||0,v=m[r-1][1]||0,x=(p-v)/2,j=0;j<c;++j){var y=e[t[j]],b=y[r][1]||0,S=y[r-1][1]||0;x+=b-S}d+=p,f+=x*p}s[r-1][1]+=s[r-1][0]=n,d&&(n-=f/d)}s[r-1][1]+=s[r-1][0]=n,Zc(e,t)}}function uf(e){"@babel/helpers - typeof";return uf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uf(e)}var Aee=["type","size","sizeType"];function j1(){return j1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},j1.apply(this,arguments)}function jT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ST(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jT(Object(n),!0).forEach(function(r){Eee(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Eee(e,t,n){return t=Pee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pee(e){var t=Ree(e,"string");return uf(t)=="symbol"?t:t+""}function Ree(e,t){if(uf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(uf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Tee(e,t){if(e==null)return{};var n=Oee(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Oee(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var b4={symbolCircle:t_,symbolCross:eee,symbolDiamond:nee,symbolSquare:ree,symbolStar:iee,symbolTriangle:lee,symbolWye:uee},Mee=Math.PI/180,Iee=function(t){var n="symbol".concat(mv(t));return b4[n]||t_},$ee=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var s=18*Mee;return 1.25*t*t*(Math.tan(s)-Math.tan(s*2)*Math.pow(Math.tan(s),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},Dee=function(t,n){b4["symbol".concat(mv(t))]=n},n_=function(t){var n=t.type,r=n===void 0?"circle":n,s=t.size,o=s===void 0?64:s,i=t.sizeType,c=i===void 0?"area":i,d=Tee(t,Aee),f=ST(ST({},d),{},{type:r,size:o,sizeType:c}),m=function(){var b=Iee(r),S=dee().type(b).size($ee(o,c,r));return S()},p=f.className,v=f.cx,x=f.cy,j=Mt(f,!0);return v===+v&&x===+x&&o===+o?Q.createElement("path",j1({},j,{className:Yt("recharts-symbols",p),transform:"translate(".concat(v,", ").concat(x,")"),d:m()})):null};n_.registerSymbol=Dee;function eu(e){"@babel/helpers - typeof";return eu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},eu(e)}function S1(){return S1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},S1.apply(this,arguments)}function NT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Lee(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?NT(Object(n),!0).forEach(function(r){df(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Fee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,j4(r.key),r)}}function Bee(e,t,n){return t&&zee(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function qee(e,t,n){return t=Rm(t),Uee(e,w4()?Reflect.construct(t,n||[],Rm(e).constructor):t.apply(e,n))}function Uee(e,t){if(t&&(eu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wee(e)}function Wee(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(w4=function(){return!!e})()}function Rm(e){return Rm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Rm(e)}function Hee(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&N1(e,t)}function N1(e,t){return N1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},N1(e,t)}function df(e,t,n){return t=j4(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j4(e){var t=Vee(e,"string");return eu(t)=="symbol"?t:t+""}function Vee(e,t){if(eu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(eu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Fa=32,r_=(function(e){function t(){return Fee(this,t),qee(this,t,arguments)}return Hee(t,e),Bee(t,[{key:"renderIcon",value:function(r){var s=this.props.inactiveColor,o=Fa/2,i=Fa/6,c=Fa/3,d=r.inactive?s:r.color;if(r.type==="plainline")return Q.createElement("line",{strokeWidth:4,fill:"none",stroke:d,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:o,x2:Fa,y2:o,className:"recharts-legend-icon"});if(r.type==="line")return Q.createElement("path",{strokeWidth:4,fill:"none",stroke:d,d:"M0,".concat(o,"h").concat(c,`
60
+ A`).concat(i,",").concat(i,",0,1,1,").concat(2*c,",").concat(o,`
61
+ H`).concat(Fa,"M").concat(2*c,",").concat(o,`
62
+ A`).concat(i,",").concat(i,",0,1,1,").concat(c,",").concat(o),className:"recharts-legend-icon"});if(r.type==="rect")return Q.createElement("path",{stroke:"none",fill:d,d:"M0,".concat(Fa/8,"h").concat(Fa,"v").concat(Fa*3/4,"h").concat(-Fa,"z"),className:"recharts-legend-icon"});if(Q.isValidElement(r.legendIcon)){var f=Lee({},r);return delete f.legendIcon,Q.cloneElement(r.legendIcon,f)}return Q.createElement(n_,{fill:d,cx:o,cy:o,size:Fa,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,s=this.props,o=s.payload,i=s.iconSize,c=s.layout,d=s.formatter,f=s.inactiveColor,m={x:0,y:0,width:Fa,height:Fa},p={display:c==="horizontal"?"inline-block":"block",marginRight:10},v={display:"inline-block",verticalAlign:"middle",marginRight:4};return o.map(function(x,j){var y=x.formatter||d,b=Yt(df(df({"recharts-legend-item":!0},"legend-item-".concat(j),!0),"inactive",x.inactive));if(x.type==="none")return null;var S=Kt(x.value)?null:x.value;So(!Kt(x.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var N=x.inactive?f:x.color;return Q.createElement("li",S1({className:b,style:p,key:"legend-item-".concat(j)},_l(r.props,x,j)),Q.createElement(g1,{width:i,height:i,viewBox:m,style:v},r.renderIcon(x)),Q.createElement("span",{className:"recharts-legend-item-text",style:{color:N}},y?y(S,x,j):S))})}},{key:"render",value:function(){var r=this.props,s=r.payload,o=r.layout,i=r.align;if(!s||!s.length)return null;var c={padding:0,margin:0,textAlign:o==="horizontal"?i:"left"};return Q.createElement("ul",{className:"recharts-default-legend",style:c},this.renderItems())}}])})(h.PureComponent);df(r_,"displayName","Legend");df(r_,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var I0,CT;function Kee(){if(CT)return I0;CT=1;var e=fv();function t(){this.__data__=new e,this.size=0}return I0=t,I0}var $0,_T;function Gee(){if(_T)return $0;_T=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return $0=e,$0}var D0,kT;function Yee(){if(kT)return D0;kT=1;function e(t){return this.__data__.get(t)}return D0=e,D0}var L0,AT;function Xee(){if(AT)return L0;AT=1;function e(t){return this.__data__.has(t)}return L0=e,L0}var F0,ET;function Qee(){if(ET)return F0;ET=1;var e=fv(),t=KC(),n=GC(),r=200;function s(o,i){var c=this.__data__;if(c instanceof e){var d=c.__data__;if(!t||d.length<r-1)return d.push([o,i]),this.size=++c.size,this;c=this.__data__=new n(d)}return c.set(o,i),this.size=c.size,this}return F0=s,F0}var z0,PT;function S4(){if(PT)return z0;PT=1;var e=fv(),t=Kee(),n=Gee(),r=Yee(),s=Xee(),o=Qee();function i(c){var d=this.__data__=new e(c);this.size=d.size}return i.prototype.clear=t,i.prototype.delete=n,i.prototype.get=r,i.prototype.has=s,i.prototype.set=o,z0=i,z0}var B0,RT;function Jee(){if(RT)return B0;RT=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return B0=t,B0}var q0,TT;function Zee(){if(TT)return q0;TT=1;function e(t){return this.__data__.has(t)}return q0=e,q0}var U0,OT;function N4(){if(OT)return U0;OT=1;var e=GC(),t=Jee(),n=Zee();function r(s){var o=-1,i=s==null?0:s.length;for(this.__data__=new e;++o<i;)this.add(s[o])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,U0=r,U0}var W0,MT;function C4(){if(MT)return W0;MT=1;function e(t,n){for(var r=-1,s=t==null?0:t.length;++r<s;)if(n(t[r],r,t))return!0;return!1}return W0=e,W0}var H0,IT;function _4(){if(IT)return H0;IT=1;function e(t,n){return t.has(n)}return H0=e,H0}var V0,$T;function k4(){if($T)return V0;$T=1;var e=N4(),t=C4(),n=_4(),r=1,s=2;function o(i,c,d,f,m,p){var v=d&r,x=i.length,j=c.length;if(x!=j&&!(v&&j>x))return!1;var y=p.get(i),b=p.get(c);if(y&&b)return y==c&&b==i;var S=-1,N=!0,C=d&s?new e:void 0;for(p.set(i,c),p.set(c,i);++S<x;){var k=i[S],A=c[S];if(f)var E=v?f(A,k,S,c,i,p):f(k,A,S,i,c,p);if(E!==void 0){if(E)continue;N=!1;break}if(C){if(!t(c,function(P,O){if(!n(C,O)&&(k===P||m(k,P,d,f,p)))return C.push(O)})){N=!1;break}}else if(!(k===A||m(k,A,d,f,p))){N=!1;break}}return p.delete(i),p.delete(c),N}return V0=o,V0}var K0,DT;function ete(){if(DT)return K0;DT=1;var e=Js(),t=e.Uint8Array;return K0=t,K0}var G0,LT;function tte(){if(LT)return G0;LT=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(s,o){r[++n]=[o,s]}),r}return G0=e,G0}var Y0,FT;function a_(){if(FT)return Y0;FT=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(s){r[++n]=s}),r}return Y0=e,Y0}var X0,zT;function nte(){if(zT)return X0;zT=1;var e=dp(),t=ete(),n=VC(),r=k4(),s=tte(),o=a_(),i=1,c=2,d="[object Boolean]",f="[object Date]",m="[object Error]",p="[object Map]",v="[object Number]",x="[object RegExp]",j="[object Set]",y="[object String]",b="[object Symbol]",S="[object ArrayBuffer]",N="[object DataView]",C=e?e.prototype:void 0,k=C?C.valueOf:void 0;function A(E,P,O,D,K,q,B){switch(O){case N:if(E.byteLength!=P.byteLength||E.byteOffset!=P.byteOffset)return!1;E=E.buffer,P=P.buffer;case S:return!(E.byteLength!=P.byteLength||!q(new t(E),new t(P)));case d:case f:case v:return n(+E,+P);case m:return E.name==P.name&&E.message==P.message;case x:case y:return E==P+"";case p:var Y=s;case j:var z=D&i;if(Y||(Y=o),E.size!=P.size&&!z)return!1;var I=B.get(E);if(I)return I==P;D|=c,B.set(E,P);var T=r(Y(E),Y(P),D,K,q,B);return B.delete(E),T;case b:if(k)return k.call(E)==k.call(P)}return!1}return X0=A,X0}var Q0,BT;function A4(){if(BT)return Q0;BT=1;function e(t,n){for(var r=-1,s=n.length,o=t.length;++r<s;)t[o+r]=n[r];return t}return Q0=e,Q0}var J0,qT;function rte(){if(qT)return J0;qT=1;var e=A4(),t=fa();function n(r,s,o){var i=s(r);return t(r)?i:e(i,o(r))}return J0=n,J0}var Z0,UT;function ate(){if(UT)return Z0;UT=1;function e(t,n){for(var r=-1,s=t==null?0:t.length,o=0,i=[];++r<s;){var c=t[r];n(c,r,t)&&(i[o++]=c)}return i}return Z0=e,Z0}var ew,WT;function ste(){if(WT)return ew;WT=1;function e(){return[]}return ew=e,ew}var tw,HT;function ote(){if(HT)return tw;HT=1;var e=ate(),t=ste(),n=Object.prototype,r=n.propertyIsEnumerable,s=Object.getOwnPropertySymbols,o=s?function(i){return i==null?[]:(i=Object(i),e(s(i),function(c){return r.call(i,c)}))}:t;return tw=o,tw}var nw,VT;function ite(){if(VT)return nw;VT=1;function e(t,n){for(var r=-1,s=Array(t);++r<t;)s[r]=n(r);return s}return nw=e,nw}var rw,KT;function lte(){if(KT)return rw;KT=1;var e=zo(),t=Bo(),n="[object Arguments]";function r(s){return t(s)&&e(s)==n}return rw=r,rw}var aw,GT;function s_(){if(GT)return aw;GT=1;var e=lte(),t=Bo(),n=Object.prototype,r=n.hasOwnProperty,s=n.propertyIsEnumerable,o=e((function(){return arguments})())?e:function(i){return t(i)&&r.call(i,"callee")&&!s.call(i,"callee")};return aw=o,aw}var Bd={exports:{}},sw,YT;function cte(){if(YT)return sw;YT=1;function e(){return!1}return sw=e,sw}Bd.exports;var XT;function E4(){return XT||(XT=1,(function(e,t){var n=Js(),r=cte(),s=t&&!t.nodeType&&t,o=s&&!0&&e&&!e.nodeType&&e,i=o&&o.exports===s,c=i?n.Buffer:void 0,d=c?c.isBuffer:void 0,f=d||r;e.exports=f})(Bd,Bd.exports)),Bd.exports}var ow,QT;function o_(){if(QT)return ow;QT=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,s){var o=typeof r;return s=s??e,!!s&&(o=="number"||o!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<s}return ow=n,ow}var iw,JT;function i_(){if(JT)return iw;JT=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return iw=t,iw}var lw,ZT;function ute(){if(ZT)return lw;ZT=1;var e=zo(),t=i_(),n=Bo(),r="[object Arguments]",s="[object Array]",o="[object Boolean]",i="[object Date]",c="[object Error]",d="[object Function]",f="[object Map]",m="[object Number]",p="[object Object]",v="[object RegExp]",x="[object Set]",j="[object String]",y="[object WeakMap]",b="[object ArrayBuffer]",S="[object DataView]",N="[object Float32Array]",C="[object Float64Array]",k="[object Int8Array]",A="[object Int16Array]",E="[object Int32Array]",P="[object Uint8Array]",O="[object Uint8ClampedArray]",D="[object Uint16Array]",K="[object Uint32Array]",q={};q[N]=q[C]=q[k]=q[A]=q[E]=q[P]=q[O]=q[D]=q[K]=!0,q[r]=q[s]=q[b]=q[o]=q[S]=q[i]=q[c]=q[d]=q[f]=q[m]=q[p]=q[v]=q[x]=q[j]=q[y]=!1;function B(Y){return n(Y)&&t(Y.length)&&!!q[e(Y)]}return lw=B,lw}var cw,eO;function P4(){if(eO)return cw;eO=1;function e(t){return function(n){return t(n)}}return cw=e,cw}var qd={exports:{}};qd.exports;var tO;function dte(){return tO||(tO=1,(function(e,t){var n=XL(),r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,o=s&&s.exports===r,i=o&&n.process,c=(function(){try{var d=s&&s.require&&s.require("util").types;return d||i&&i.binding&&i.binding("util")}catch{}})();e.exports=c})(qd,qd.exports)),qd.exports}var uw,nO;function R4(){if(nO)return uw;nO=1;var e=ute(),t=P4(),n=dte(),r=n&&n.isTypedArray,s=r?t(r):e;return uw=s,uw}var dw,rO;function fte(){if(rO)return dw;rO=1;var e=ite(),t=s_(),n=fa(),r=E4(),s=o_(),o=R4(),i=Object.prototype,c=i.hasOwnProperty;function d(f,m){var p=n(f),v=!p&&t(f),x=!p&&!v&&r(f),j=!p&&!v&&!x&&o(f),y=p||v||x||j,b=y?e(f.length,String):[],S=b.length;for(var N in f)(m||c.call(f,N))&&!(y&&(N=="length"||x&&(N=="offset"||N=="parent")||j&&(N=="buffer"||N=="byteLength"||N=="byteOffset")||s(N,S)))&&b.push(N);return b}return dw=d,dw}var fw,aO;function pte(){if(aO)return fw;aO=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,s=typeof r=="function"&&r.prototype||e;return n===s}return fw=t,fw}var pw,sO;function T4(){if(sO)return pw;sO=1;function e(t,n){return function(r){return t(n(r))}}return pw=e,pw}var hw,oO;function hte(){if(oO)return hw;oO=1;var e=T4(),t=e(Object.keys,Object);return hw=t,hw}var mw,iO;function mte(){if(iO)return mw;iO=1;var e=pte(),t=hte(),n=Object.prototype,r=n.hasOwnProperty;function s(o){if(!e(o))return t(o);var i=[];for(var c in Object(o))r.call(o,c)&&c!="constructor"&&i.push(c);return i}return mw=s,mw}var gw,lO;function pp(){if(lO)return gw;lO=1;var e=HC(),t=i_();function n(r){return r!=null&&t(r.length)&&!e(r)}return gw=n,gw}var vw,cO;function yv(){if(cO)return vw;cO=1;var e=fte(),t=mte(),n=pp();function r(s){return n(s)?e(s):t(s)}return vw=r,vw}var xw,uO;function gte(){if(uO)return xw;uO=1;var e=rte(),t=ote(),n=yv();function r(s){return e(s,n,t)}return xw=r,xw}var yw,dO;function vte(){if(dO)return yw;dO=1;var e=gte(),t=1,n=Object.prototype,r=n.hasOwnProperty;function s(o,i,c,d,f,m){var p=c&t,v=e(o),x=v.length,j=e(i),y=j.length;if(x!=y&&!p)return!1;for(var b=x;b--;){var S=v[b];if(!(p?S in i:r.call(i,S)))return!1}var N=m.get(o),C=m.get(i);if(N&&C)return N==i&&C==o;var k=!0;m.set(o,i),m.set(i,o);for(var A=p;++b<x;){S=v[b];var E=o[S],P=i[S];if(d)var O=p?d(P,E,S,i,o,m):d(E,P,S,o,i,m);if(!(O===void 0?E===P||f(E,P,c,d,m):O)){k=!1;break}A||(A=S=="constructor")}if(k&&!A){var D=o.constructor,K=i.constructor;D!=K&&"constructor"in o&&"constructor"in i&&!(typeof D=="function"&&D instanceof D&&typeof K=="function"&&K instanceof K)&&(k=!1)}return m.delete(o),m.delete(i),k}return yw=s,yw}var bw,fO;function xte(){if(fO)return bw;fO=1;var e=Ul(),t=Js(),n=e(t,"DataView");return bw=n,bw}var ww,pO;function yte(){if(pO)return ww;pO=1;var e=Ul(),t=Js(),n=e(t,"Promise");return ww=n,ww}var jw,hO;function O4(){if(hO)return jw;hO=1;var e=Ul(),t=Js(),n=e(t,"Set");return jw=n,jw}var Sw,mO;function bte(){if(mO)return Sw;mO=1;var e=Ul(),t=Js(),n=e(t,"WeakMap");return Sw=n,Sw}var Nw,gO;function wte(){if(gO)return Nw;gO=1;var e=xte(),t=KC(),n=yte(),r=O4(),s=bte(),o=zo(),i=QL(),c="[object Map]",d="[object Object]",f="[object Promise]",m="[object Set]",p="[object WeakMap]",v="[object DataView]",x=i(e),j=i(t),y=i(n),b=i(r),S=i(s),N=o;return(e&&N(new e(new ArrayBuffer(1)))!=v||t&&N(new t)!=c||n&&N(n.resolve())!=f||r&&N(new r)!=m||s&&N(new s)!=p)&&(N=function(C){var k=o(C),A=k==d?C.constructor:void 0,E=A?i(A):"";if(E)switch(E){case x:return v;case j:return c;case y:return f;case b:return m;case S:return p}return k}),Nw=N,Nw}var Cw,vO;function jte(){if(vO)return Cw;vO=1;var e=S4(),t=k4(),n=nte(),r=vte(),s=wte(),o=fa(),i=E4(),c=R4(),d=1,f="[object Arguments]",m="[object Array]",p="[object Object]",v=Object.prototype,x=v.hasOwnProperty;function j(y,b,S,N,C,k){var A=o(y),E=o(b),P=A?m:s(y),O=E?m:s(b);P=P==f?p:P,O=O==f?p:O;var D=P==p,K=O==p,q=P==O;if(q&&i(y)){if(!i(b))return!1;A=!0,D=!1}if(q&&!D)return k||(k=new e),A||c(y)?t(y,b,S,N,C,k):n(y,b,P,S,N,C,k);if(!(S&d)){var B=D&&x.call(y,"__wrapped__"),Y=K&&x.call(b,"__wrapped__");if(B||Y){var z=B?y.value():y,I=Y?b.value():b;return k||(k=new e),C(z,I,S,N,k)}}return q?(k||(k=new e),r(y,b,S,N,C,k)):!1}return Cw=j,Cw}var _w,xO;function l_(){if(xO)return _w;xO=1;var e=jte(),t=Bo();function n(r,s,o,i,c){return r===s?!0:r==null||s==null||!t(r)&&!t(s)?r!==r&&s!==s:e(r,s,o,i,n,c)}return _w=n,_w}var kw,yO;function Ste(){if(yO)return kw;yO=1;var e=S4(),t=l_(),n=1,r=2;function s(o,i,c,d){var f=c.length,m=f,p=!d;if(o==null)return!m;for(o=Object(o);f--;){var v=c[f];if(p&&v[2]?v[1]!==o[v[0]]:!(v[0]in o))return!1}for(;++f<m;){v=c[f];var x=v[0],j=o[x],y=v[1];if(p&&v[2]){if(j===void 0&&!(x in o))return!1}else{var b=new e;if(d)var S=d(j,y,x,o,i,b);if(!(S===void 0?t(y,j,n|r,d,b):S))return!1}}return!0}return kw=s,kw}var Aw,bO;function M4(){if(bO)return Aw;bO=1;var e=Ri();function t(n){return n===n&&!e(n)}return Aw=t,Aw}var Ew,wO;function Nte(){if(wO)return Ew;wO=1;var e=M4(),t=yv();function n(r){for(var s=t(r),o=s.length;o--;){var i=s[o],c=r[i];s[o]=[i,c,e(c)]}return s}return Ew=n,Ew}var Pw,jO;function I4(){if(jO)return Pw;jO=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return Pw=e,Pw}var Rw,SO;function Cte(){if(SO)return Rw;SO=1;var e=Ste(),t=Nte(),n=I4();function r(s){var o=t(s);return o.length==1&&o[0][2]?n(o[0][0],o[0][1]):function(i){return i===s||e(i,s,o)}}return Rw=r,Rw}var Tw,NO;function _te(){if(NO)return Tw;NO=1;function e(t,n){return t!=null&&n in Object(t)}return Tw=e,Tw}var Ow,CO;function kte(){if(CO)return Ow;CO=1;var e=e4(),t=s_(),n=fa(),r=o_(),s=i_(),o=hv();function i(c,d,f){d=e(d,c);for(var m=-1,p=d.length,v=!1;++m<p;){var x=o(d[m]);if(!(v=c!=null&&f(c,x)))break;c=c[x]}return v||++m!=p?v:(p=c==null?0:c.length,!!p&&s(p)&&r(x,p)&&(n(c)||t(c)))}return Ow=i,Ow}var Mw,_O;function Ate(){if(_O)return Mw;_O=1;var e=_te(),t=kte();function n(r,s){return r!=null&&t(r,s,e)}return Mw=n,Mw}var Iw,kO;function Ete(){if(kO)return Iw;kO=1;var e=l_(),t=t4(),n=Ate(),r=WC(),s=M4(),o=I4(),i=hv(),c=1,d=2;function f(m,p){return r(m)&&s(p)?o(i(m),p):function(v){var x=t(v,m);return x===void 0&&x===p?n(v,m):e(p,x,c|d)}}return Iw=f,Iw}var $w,AO;function Lu(){if(AO)return $w;AO=1;function e(t){return t}return $w=e,$w}var Dw,EO;function Pte(){if(EO)return Dw;EO=1;function e(t){return function(n){return n?.[t]}}return Dw=e,Dw}var Lw,PO;function Rte(){if(PO)return Lw;PO=1;var e=XC();function t(n){return function(r){return e(r,n)}}return Lw=t,Lw}var Fw,RO;function Tte(){if(RO)return Fw;RO=1;var e=Pte(),t=Rte(),n=WC(),r=hv();function s(o){return n(o)?e(r(o)):t(o)}return Fw=s,Fw}var zw,TO;function Zs(){if(TO)return zw;TO=1;var e=Cte(),t=Ete(),n=Lu(),r=fa(),s=Tte();function o(i){return typeof i=="function"?i:i==null?n:typeof i=="object"?r(i)?t(i[0],i[1]):e(i):s(i)}return zw=o,zw}var Bw,OO;function $4(){if(OO)return Bw;OO=1;function e(t,n,r,s){for(var o=t.length,i=r+(s?1:-1);s?i--:++i<o;)if(n(t[i],i,t))return i;return-1}return Bw=e,Bw}var qw,MO;function Ote(){if(MO)return qw;MO=1;function e(t){return t!==t}return qw=e,qw}var Uw,IO;function Mte(){if(IO)return Uw;IO=1;function e(t,n,r){for(var s=r-1,o=t.length;++s<o;)if(t[s]===n)return s;return-1}return Uw=e,Uw}var Ww,$O;function Ite(){if($O)return Ww;$O=1;var e=$4(),t=Ote(),n=Mte();function r(s,o,i){return o===o?n(s,o,i):e(s,t,i)}return Ww=r,Ww}var Hw,DO;function $te(){if(DO)return Hw;DO=1;var e=Ite();function t(n,r){var s=n==null?0:n.length;return!!s&&e(n,r,0)>-1}return Hw=t,Hw}var Vw,LO;function Dte(){if(LO)return Vw;LO=1;function e(t,n,r){for(var s=-1,o=t==null?0:t.length;++s<o;)if(r(n,t[s]))return!0;return!1}return Vw=e,Vw}var Kw,FO;function Lte(){if(FO)return Kw;FO=1;function e(){}return Kw=e,Kw}var Gw,zO;function Fte(){if(zO)return Gw;zO=1;var e=O4(),t=Lte(),n=a_(),r=1/0,s=e&&1/n(new e([,-0]))[1]==r?function(o){return new e(o)}:t;return Gw=s,Gw}var Yw,BO;function zte(){if(BO)return Yw;BO=1;var e=N4(),t=$te(),n=Dte(),r=_4(),s=Fte(),o=a_(),i=200;function c(d,f,m){var p=-1,v=t,x=d.length,j=!0,y=[],b=y;if(m)j=!1,v=n;else if(x>=i){var S=f?null:s(d);if(S)return o(S);j=!1,v=r,b=new e}else b=f?[]:y;e:for(;++p<x;){var N=d[p],C=f?f(N):N;if(N=m||N!==0?N:0,j&&C===C){for(var k=b.length;k--;)if(b[k]===C)continue e;f&&b.push(C),y.push(N)}else v(b,C,m)||(b!==y&&b.push(C),y.push(N))}return y}return Yw=c,Yw}var Xw,qO;function Bte(){if(qO)return Xw;qO=1;var e=Zs(),t=zte();function n(r,s){return r&&r.length?t(r,e(s,2)):[]}return Xw=n,Xw}var qte=Bte();const UO=xn(qte);function D4(e,t,n){return t===!0?UO(e,n):Kt(t)?UO(e,t):e}function tu(e){"@babel/helpers - typeof";return tu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tu(e)}var Ute=["ref"];function WO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ho(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?WO(Object(n),!0).forEach(function(r){bv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Wte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function HO(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,F4(r.key),r)}}function Hte(e,t,n){return t&&HO(e.prototype,t),n&&HO(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vte(e,t,n){return t=Tm(t),Kte(e,L4()?Reflect.construct(t,n||[],Tm(e).constructor):t.apply(e,n))}function Kte(e,t){if(t&&(tu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gte(e)}function Gte(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function L4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(L4=function(){return!!e})()}function Tm(e){return Tm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Tm(e)}function Yte(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&C1(e,t)}function C1(e,t){return C1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},C1(e,t)}function bv(e,t,n){return t=F4(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F4(e){var t=Xte(e,"string");return tu(t)=="symbol"?t:t+""}function Xte(e,t){if(tu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(tu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Qte(e,t){if(e==null)return{};var n=Jte(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Jte(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Zte(e){return e.value}function ene(e,t){if(Q.isValidElement(e))return Q.cloneElement(e,t);if(typeof e=="function")return Q.createElement(e,t);t.ref;var n=Qte(t,Ute);return Q.createElement(r_,n)}var VO=1,gl=(function(e){function t(){var n;Wte(this,t);for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return n=Vte(this,t,[].concat(s)),bv(n,"lastBoundingBox",{width:-1,height:-1}),n}return Yte(t,e),Hte(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,s=this.getBBox();s?(Math.abs(s.width-this.lastBoundingBox.width)>VO||Math.abs(s.height-this.lastBoundingBox.height)>VO)&&(this.lastBoundingBox.width=s.width,this.lastBoundingBox.height=s.height,r&&r(s)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?ho({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var s=this.props,o=s.layout,i=s.align,c=s.verticalAlign,d=s.margin,f=s.chartWidth,m=s.chartHeight,p,v;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(i==="center"&&o==="vertical"){var x=this.getBBoxSnapshot();p={left:((f||0)-x.width)/2}}else p=i==="right"?{right:d&&d.right||0}:{left:d&&d.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(c==="middle"){var j=this.getBBoxSnapshot();v={top:((m||0)-j.height)/2}}else v=c==="bottom"?{bottom:d&&d.bottom||0}:{top:d&&d.top||0};return ho(ho({},p),v)}},{key:"render",value:function(){var r=this,s=this.props,o=s.content,i=s.width,c=s.height,d=s.wrapperStyle,f=s.payloadUniqBy,m=s.payload,p=ho(ho({position:"absolute",width:i||"auto",height:c||"auto"},this.getDefaultPosition(d)),d);return Q.createElement("div",{className:"recharts-legend-wrapper",style:p,ref:function(x){r.wrapperNode=x}},ene(o,ho(ho({},this.props),{},{payload:D4(m,f,Zte)})))}}],[{key:"getWithHeight",value:function(r,s){var o=ho(ho({},this.defaultProps),r.props),i=o.layout;return i==="vertical"&&rt(r.props.height)?{height:r.props.height}:i==="horizontal"?{width:r.props.width||s}:null}}])})(h.PureComponent);bv(gl,"displayName","Legend");bv(gl,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var Qw,KO;function tne(){if(KO)return Qw;KO=1;var e=dp(),t=s_(),n=fa(),r=e?e.isConcatSpreadable:void 0;function s(o){return n(o)||t(o)||!!(r&&o&&o[r])}return Qw=s,Qw}var Jw,GO;function z4(){if(GO)return Jw;GO=1;var e=A4(),t=tne();function n(r,s,o,i,c){var d=-1,f=r.length;for(o||(o=t),c||(c=[]);++d<f;){var m=r[d];s>0&&o(m)?s>1?n(m,s-1,o,i,c):e(c,m):i||(c[c.length]=m)}return c}return Jw=n,Jw}var Zw,YO;function nne(){if(YO)return Zw;YO=1;function e(t){return function(n,r,s){for(var o=-1,i=Object(n),c=s(n),d=c.length;d--;){var f=c[t?d:++o];if(r(i[f],f,i)===!1)break}return n}}return Zw=e,Zw}var ej,XO;function rne(){if(XO)return ej;XO=1;var e=nne(),t=e();return ej=t,ej}var tj,QO;function B4(){if(QO)return tj;QO=1;var e=rne(),t=yv();function n(r,s){return r&&e(r,s,t)}return tj=n,tj}var nj,JO;function ane(){if(JO)return nj;JO=1;var e=pp();function t(n,r){return function(s,o){if(s==null)return s;if(!e(s))return n(s,o);for(var i=s.length,c=r?i:-1,d=Object(s);(r?c--:++c<i)&&o(d[c],c,d)!==!1;);return s}}return nj=t,nj}var rj,ZO;function c_(){if(ZO)return rj;ZO=1;var e=B4(),t=ane(),n=t(e);return rj=n,rj}var aj,e2;function q4(){if(e2)return aj;e2=1;var e=c_(),t=pp();function n(r,s){var o=-1,i=t(r)?Array(r.length):[];return e(r,function(c,d,f){i[++o]=s(c,d,f)}),i}return aj=n,aj}var sj,t2;function sne(){if(t2)return sj;t2=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return sj=e,sj}var oj,n2;function one(){if(n2)return oj;n2=1;var e=Iu();function t(n,r){if(n!==r){var s=n!==void 0,o=n===null,i=n===n,c=e(n),d=r!==void 0,f=r===null,m=r===r,p=e(r);if(!f&&!p&&!c&&n>r||c&&d&&m&&!f&&!p||o&&d&&m||!s&&m||!i)return 1;if(!o&&!c&&!p&&n<r||p&&s&&i&&!o&&!c||f&&s&&i||!d&&i||!m)return-1}return 0}return oj=t,oj}var ij,r2;function ine(){if(r2)return ij;r2=1;var e=one();function t(n,r,s){for(var o=-1,i=n.criteria,c=r.criteria,d=i.length,f=s.length;++o<d;){var m=e(i[o],c[o]);if(m){if(o>=f)return m;var p=s[o];return m*(p=="desc"?-1:1)}}return n.index-r.index}return ij=t,ij}var lj,a2;function lne(){if(a2)return lj;a2=1;var e=YC(),t=XC(),n=Zs(),r=q4(),s=sne(),o=P4(),i=ine(),c=Lu(),d=fa();function f(m,p,v){p.length?p=e(p,function(y){return d(y)?function(b){return t(b,y.length===1?y[0]:y)}:y}):p=[c];var x=-1;p=e(p,o(n));var j=r(m,function(y,b,S){var N=e(p,function(C){return C(y)});return{criteria:N,index:++x,value:y}});return s(j,function(y,b){return i(y,b,v)})}return lj=f,lj}var cj,s2;function cne(){if(s2)return cj;s2=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return cj=e,cj}var uj,o2;function une(){if(o2)return uj;o2=1;var e=cne(),t=Math.max;function n(r,s,o){return s=t(s===void 0?r.length-1:s,0),function(){for(var i=arguments,c=-1,d=t(i.length-s,0),f=Array(d);++c<d;)f[c]=i[s+c];c=-1;for(var m=Array(s+1);++c<s;)m[c]=i[c];return m[s]=o(f),e(r,this,m)}}return uj=n,uj}var dj,i2;function dne(){if(i2)return dj;i2=1;function e(t){return function(){return t}}return dj=e,dj}var fj,l2;function U4(){if(l2)return fj;l2=1;var e=Ul(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return fj=t,fj}var pj,c2;function fne(){if(c2)return pj;c2=1;var e=dne(),t=U4(),n=Lu(),r=t?function(s,o){return t(s,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:n;return pj=r,pj}var hj,u2;function pne(){if(u2)return hj;u2=1;var e=800,t=16,n=Date.now;function r(s){var o=0,i=0;return function(){var c=n(),d=t-(c-i);if(i=c,d>0){if(++o>=e)return arguments[0]}else o=0;return s.apply(void 0,arguments)}}return hj=r,hj}var mj,d2;function hne(){if(d2)return mj;d2=1;var e=fne(),t=pne(),n=t(e);return mj=n,mj}var gj,f2;function mne(){if(f2)return gj;f2=1;var e=Lu(),t=une(),n=hne();function r(s,o){return n(t(s,o,e),s+"")}return gj=r,gj}var vj,p2;function wv(){if(p2)return vj;p2=1;var e=VC(),t=pp(),n=o_(),r=Ri();function s(o,i,c){if(!r(c))return!1;var d=typeof i;return(d=="number"?t(c)&&n(i,c.length):d=="string"&&i in c)?e(c[i],o):!1}return vj=s,vj}var xj,h2;function gne(){if(h2)return xj;h2=1;var e=z4(),t=lne(),n=mne(),r=wv(),s=n(function(o,i){if(o==null)return[];var c=i.length;return c>1&&r(o,i[0],i[1])?i=[]:c>2&&r(i[0],i[1],i[2])&&(i=[i[0]]),t(o,e(i,1),[])});return xj=s,xj}var vne=gne();const u_=xn(vne);function ff(e){"@babel/helpers - typeof";return ff=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ff(e)}function _1(){return _1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_1.apply(this,arguments)}function xne(e,t){return jne(e)||wne(e,t)||bne(e,t)||yne()}function yne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
63
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bne(e,t){if(e){if(typeof e=="string")return m2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m2(e,t)}}function m2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function wne(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,c=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);d=!0);}catch(m){f=!0,s=m}finally{try{if(!d&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw s}}return c}}function jne(e){if(Array.isArray(e))return e}function g2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function yj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?g2(Object(n),!0).forEach(function(r){Sne(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Sne(e,t,n){return t=Nne(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nne(e){var t=Cne(e,"string");return ff(t)=="symbol"?t:t+""}function Cne(e,t){if(ff(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ff(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _ne(e){return Array.isArray(e)&&dr(e[0])&&dr(e[1])?e.join(" ~ "):e}var kne=function(t){var n=t.separator,r=n===void 0?" : ":n,s=t.contentStyle,o=s===void 0?{}:s,i=t.itemStyle,c=i===void 0?{}:i,d=t.labelStyle,f=d===void 0?{}:d,m=t.payload,p=t.formatter,v=t.itemSorter,x=t.wrapperClassName,j=t.labelClassName,y=t.label,b=t.labelFormatter,S=t.accessibilityLayer,N=S===void 0?!1:S,C=function(){if(m&&m.length){var B={padding:0,margin:0},Y=(v?u_(m,v):m).map(function(z,I){if(z.type==="none")return null;var T=yj({display:"block",paddingTop:4,paddingBottom:4,color:z.color||"#000"},c),V=z.formatter||p||_ne,H=z.value,M=z.name,X=H,$=M;if(V&&X!=null&&$!=null){var F=V(H,M,z,I,m);if(Array.isArray(F)){var G=xne(F,2);X=G[0],$=G[1]}else X=F}return Q.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(I),style:T},dr($)?Q.createElement("span",{className:"recharts-tooltip-item-name"},$):null,dr($)?Q.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,Q.createElement("span",{className:"recharts-tooltip-item-value"},X),Q.createElement("span",{className:"recharts-tooltip-item-unit"},z.unit||""))});return Q.createElement("ul",{className:"recharts-tooltip-item-list",style:B},Y)}return null},k=yj({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},o),A=yj({margin:0},f),E=!Gt(y),P=E?y:"",O=Yt("recharts-default-tooltip",x),D=Yt("recharts-tooltip-label",j);E&&b&&m!==void 0&&m!==null&&(P=b(y,m));var K=N?{role:"status","aria-live":"assertive"}:{};return Q.createElement("div",_1({className:O,style:k},K),Q.createElement("p",{className:D,style:A},Q.isValidElement(P)?P:"".concat(P)),C())};function pf(e){"@babel/helpers - typeof";return pf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pf(e)}function Bh(e,t,n){return t=Ane(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ane(e){var t=Ene(e,"string");return pf(t)=="symbol"?t:t+""}function Ene(e,t){if(pf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(pf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ed="recharts-tooltip-wrapper",Pne={visibility:"hidden"};function Rne(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return Yt(Ed,Bh(Bh(Bh(Bh({},"".concat(Ed,"-right"),rt(n)&&t&&rt(t.x)&&n>=t.x),"".concat(Ed,"-left"),rt(n)&&t&&rt(t.x)&&n<t.x),"".concat(Ed,"-bottom"),rt(r)&&t&&rt(t.y)&&r>=t.y),"".concat(Ed,"-top"),rt(r)&&t&&rt(t.y)&&r<t.y))}function v2(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.key,s=e.offsetTopLeft,o=e.position,i=e.reverseDirection,c=e.tooltipDimension,d=e.viewBox,f=e.viewBoxDimension;if(o&&rt(o[r]))return o[r];var m=n[r]-c-s,p=n[r]+s;if(t[r])return i[r]?m:p;if(i[r]){var v=m,x=d[r];return v<x?Math.max(p,d[r]):Math.max(m,d[r])}var j=p+c,y=d[r]+f;return j>y?Math.max(m,d[r]):Math.max(p,d[r])}function Tne(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function One(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,s=e.position,o=e.reverseDirection,i=e.tooltipBox,c=e.useTranslate3d,d=e.viewBox,f,m,p;return i.height>0&&i.width>0&&n?(m=v2({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:s,reverseDirection:o,tooltipDimension:i.width,viewBox:d,viewBoxDimension:d.width}),p=v2({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:s,reverseDirection:o,tooltipDimension:i.height,viewBox:d,viewBoxDimension:d.height}),f=Tne({translateX:m,translateY:p,useTranslate3d:c})):f=Pne,{cssProperties:f,cssClasses:Rne({translateX:m,translateY:p,coordinate:n})}}function nu(e){"@babel/helpers - typeof";return nu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nu(e)}function x2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function y2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?x2(Object(n),!0).forEach(function(r){A1(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Mne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ine(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,H4(r.key),r)}}function $ne(e,t,n){return t&&Ine(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dne(e,t,n){return t=Om(t),Lne(e,W4()?Reflect.construct(t,n||[],Om(e).constructor):t.apply(e,n))}function Lne(e,t){if(t&&(nu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fne(e)}function Fne(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(W4=function(){return!!e})()}function Om(e){return Om=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Om(e)}function zne(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&k1(e,t)}function k1(e,t){return k1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},k1(e,t)}function A1(e,t,n){return t=H4(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H4(e){var t=Bne(e,"string");return nu(t)=="symbol"?t:t+""}function Bne(e,t){if(nu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(nu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var b2=1,qne=(function(e){function t(){var n;Mne(this,t);for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return n=Dne(this,t,[].concat(s)),A1(n,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),A1(n,"handleKeyDown",function(i){if(i.key==="Escape"){var c,d,f,m;n.setState({dismissed:!0,dismissedAtCoordinate:{x:(c=(d=n.props.coordinate)===null||d===void 0?void 0:d.x)!==null&&c!==void 0?c:0,y:(f=(m=n.props.coordinate)===null||m===void 0?void 0:m.y)!==null&&f!==void 0?f:0}})}}),n}return zne(t,e),$ne(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();(Math.abs(r.width-this.state.lastBoundingBox.width)>b2||Math.abs(r.height-this.state.lastBoundingBox.height)>b2)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,s;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,s=this.props,o=s.active,i=s.allowEscapeViewBox,c=s.animationDuration,d=s.animationEasing,f=s.children,m=s.coordinate,p=s.hasPayload,v=s.isAnimationActive,x=s.offset,j=s.position,y=s.reverseDirection,b=s.useTranslate3d,S=s.viewBox,N=s.wrapperStyle,C=One({allowEscapeViewBox:i,coordinate:m,offsetTopLeft:x,position:j,reverseDirection:y,tooltipBox:this.state.lastBoundingBox,useTranslate3d:b,viewBox:S}),k=C.cssClasses,A=C.cssProperties,E=y2(y2({transition:v&&o?"transform ".concat(c,"ms ").concat(d):void 0},A),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&p?"visible":"hidden",position:"absolute",top:0,left:0},N);return Q.createElement("div",{tabIndex:-1,className:k,style:E,ref:function(O){r.wrapperNode=O}},f)}}])})(h.PureComponent),Une=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Wl={isSsr:Une()};function ru(e){"@babel/helpers - typeof";return ru=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ru(e)}function w2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function j2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?w2(Object(n),!0).forEach(function(r){d_(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Wne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hne(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,K4(r.key),r)}}function Vne(e,t,n){return t&&Hne(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kne(e,t,n){return t=Mm(t),Gne(e,V4()?Reflect.construct(t,n||[],Mm(e).constructor):t.apply(e,n))}function Gne(e,t){if(t&&(ru(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Yne(e)}function Yne(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function V4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(V4=function(){return!!e})()}function Mm(e){return Mm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Mm(e)}function Xne(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&E1(e,t)}function E1(e,t){return E1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},E1(e,t)}function d_(e,t,n){return t=K4(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K4(e){var t=Qne(e,"string");return ru(t)=="symbol"?t:t+""}function Qne(e,t){if(ru(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ru(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Jne(e){return e.dataKey}function Zne(e,t){return Q.isValidElement(e)?Q.cloneElement(e,t):typeof e=="function"?Q.createElement(e,t):Q.createElement(kne,t)}var aa=(function(e){function t(){return Wne(this,t),Kne(this,t,arguments)}return Xne(t,e),Vne(t,[{key:"render",value:function(){var r=this,s=this.props,o=s.active,i=s.allowEscapeViewBox,c=s.animationDuration,d=s.animationEasing,f=s.content,m=s.coordinate,p=s.filterNull,v=s.isAnimationActive,x=s.offset,j=s.payload,y=s.payloadUniqBy,b=s.position,S=s.reverseDirection,N=s.useTranslate3d,C=s.viewBox,k=s.wrapperStyle,A=j??[];p&&A.length&&(A=D4(j.filter(function(P){return P.value!=null&&(P.hide!==!0||r.props.includeHidden)}),y,Jne));var E=A.length>0;return Q.createElement(qne,{allowEscapeViewBox:i,animationDuration:c,animationEasing:d,isAnimationActive:v,active:o,coordinate:m,hasPayload:E,offset:x,position:b,reverseDirection:S,useTranslate3d:N,viewBox:C,wrapperStyle:k},Zne(f,j2(j2({},this.props),{},{payload:A})))}}])})(h.PureComponent);d_(aa,"displayName","Tooltip");d_(aa,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Wl.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var bj,S2;function ere(){if(S2)return bj;S2=1;var e=Js(),t=function(){return e.Date.now()};return bj=t,bj}var wj,N2;function tre(){if(N2)return wj;N2=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return wj=t,wj}var jj,C2;function nre(){if(C2)return jj;C2=1;var e=tre(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return jj=n,jj}var Sj,_2;function G4(){if(_2)return Sj;_2=1;var e=nre(),t=Ri(),n=Iu(),r=NaN,s=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,c=parseInt;function d(f){if(typeof f=="number")return f;if(n(f))return r;if(t(f)){var m=typeof f.valueOf=="function"?f.valueOf():f;f=t(m)?m+"":m}if(typeof f!="string")return f===0?f:+f;f=e(f);var p=o.test(f);return p||i.test(f)?c(f.slice(2),p?2:8):s.test(f)?r:+f}return Sj=d,Sj}var Nj,k2;function rre(){if(k2)return Nj;k2=1;var e=Ri(),t=ere(),n=G4(),r="Expected a function",s=Math.max,o=Math.min;function i(c,d,f){var m,p,v,x,j,y,b=0,S=!1,N=!1,C=!0;if(typeof c!="function")throw new TypeError(r);d=n(d)||0,e(f)&&(S=!!f.leading,N="maxWait"in f,v=N?s(n(f.maxWait)||0,d):v,C="trailing"in f?!!f.trailing:C);function k(Y){var z=m,I=p;return m=p=void 0,b=Y,x=c.apply(I,z),x}function A(Y){return b=Y,j=setTimeout(O,d),S?k(Y):x}function E(Y){var z=Y-y,I=Y-b,T=d-z;return N?o(T,v-I):T}function P(Y){var z=Y-y,I=Y-b;return y===void 0||z>=d||z<0||N&&I>=v}function O(){var Y=t();if(P(Y))return D(Y);j=setTimeout(O,E(Y))}function D(Y){return j=void 0,C&&m?k(Y):(m=p=void 0,x)}function K(){j!==void 0&&clearTimeout(j),b=0,m=y=p=j=void 0}function q(){return j===void 0?x:D(t())}function B(){var Y=t(),z=P(Y);if(m=arguments,p=this,y=Y,z){if(j===void 0)return A(y);if(N)return clearTimeout(j),j=setTimeout(O,d),k(y)}return j===void 0&&(j=setTimeout(O,d)),x}return B.cancel=K,B.flush=q,B}return Nj=i,Nj}var Cj,A2;function are(){if(A2)return Cj;A2=1;var e=rre(),t=Ri(),n="Expected a function";function r(s,o,i){var c=!0,d=!0;if(typeof s!="function")throw new TypeError(n);return t(i)&&(c="leading"in i?!!i.leading:c,d="trailing"in i?!!i.trailing:d),e(s,o,{leading:c,maxWait:o,trailing:d})}return Cj=r,Cj}var sre=are();const Y4=xn(sre);function hf(e){"@babel/helpers - typeof";return hf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hf(e)}function E2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function qh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?E2(Object(n),!0).forEach(function(r){ore(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ore(e,t,n){return t=ire(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ire(e){var t=lre(e,"string");return hf(t)=="symbol"?t:t+""}function lre(e,t){if(hf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cre(e,t){return pre(e)||fre(e,t)||dre(e,t)||ure()}function ure(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
64
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dre(e,t){if(e){if(typeof e=="string")return P2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return P2(e,t)}}function P2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fre(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,c=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);d=!0);}catch(m){f=!0,s=m}finally{try{if(!d&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw s}}return c}}function pre(e){if(Array.isArray(e))return e}var mf=h.forwardRef(function(e,t){var n=e.aspect,r=e.initialDimension,s=r===void 0?{width:-1,height:-1}:r,o=e.width,i=o===void 0?"100%":o,c=e.height,d=c===void 0?"100%":c,f=e.minWidth,m=f===void 0?0:f,p=e.minHeight,v=e.maxHeight,x=e.children,j=e.debounce,y=j===void 0?0:j,b=e.id,S=e.className,N=e.onResize,C=e.style,k=C===void 0?{}:C,A=h.useRef(null),E=h.useRef();E.current=N,h.useImperativeHandle(t,function(){return Object.defineProperty(A.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),A.current},configurable:!0})});var P=h.useState({containerWidth:s.width,containerHeight:s.height}),O=cre(P,2),D=O[0],K=O[1],q=h.useCallback(function(Y,z){K(function(I){var T=Math.round(Y),V=Math.round(z);return I.containerWidth===T&&I.containerHeight===V?I:{containerWidth:T,containerHeight:V}})},[]);h.useEffect(function(){var Y=function(M){var X,$=M[0].contentRect,F=$.width,G=$.height;q(F,G),(X=E.current)===null||X===void 0||X.call(E,F,G)};y>0&&(Y=Y4(Y,y,{trailing:!0,leading:!1}));var z=new ResizeObserver(Y),I=A.current.getBoundingClientRect(),T=I.width,V=I.height;return q(T,V),z.observe(A.current),function(){z.disconnect()}},[q,y]);var B=h.useMemo(function(){var Y=D.containerWidth,z=D.containerHeight;if(Y<0||z<0)return null;So(ul(i)||ul(d),`The width(%s) and height(%s) are both fixed numbers,
65
+ maybe you don't need to use a ResponsiveContainer.`,i,d),So(!n||n>0,"The aspect(%s) must be greater than zero.",n);var I=ul(i)?Y:i,T=ul(d)?z:d;n&&n>0&&(I?T=I/n:T&&(I=T*n),v&&T>v&&(T=v)),So(I>0||T>0,`The width(%s) and height(%s) of chart should be greater than 0,
66
+ please check the style of container, or the props width(%s) and height(%s),
67
+ or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
68
+ height and width.`,I,T,i,d,m,p,n);var V=!Array.isArray(x)&&jo(x.type).endsWith("Chart");return Q.Children.map(x,function(H){return Q.isValidElement(H)?h.cloneElement(H,qh({width:I,height:T},V?{style:qh({height:"100%",width:"100%",maxHeight:T,maxWidth:I},H.props.style)}:{})):H})},[n,x,d,v,p,m,D,i]);return Q.createElement("div",{id:b?"".concat(b):void 0,className:Yt("recharts-responsive-container",S),style:qh(qh({},k),{},{width:i,height:d,minWidth:m,minHeight:p,maxHeight:v}),ref:A},B)}),jv=function(t){return null};jv.displayName="Cell";function gf(e){"@babel/helpers - typeof";return gf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gf(e)}function R2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function P1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?R2(Object(n),!0).forEach(function(r){hre(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hre(e,t,n){return t=mre(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mre(e){var t=gre(e,"string");return gf(t)=="symbol"?t:t+""}function gre(e,t){if(gf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(gf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Sc={widthCache:{},cacheCount:0},vre=2e3,xre={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},T2="recharts_measurement_span";function yre(e){var t=P1({},e);return Object.keys(t).forEach(function(n){t[n]||delete t[n]}),t}var Yd=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Wl.isSsr)return{width:0,height:0};var r=yre(n),s=JSON.stringify({text:t,copyStyle:r});if(Sc.widthCache[s])return Sc.widthCache[s];try{var o=document.getElementById(T2);o||(o=document.createElement("span"),o.setAttribute("id",T2),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var i=P1(P1({},xre),r);Object.assign(o.style,i),o.textContent="".concat(t);var c=o.getBoundingClientRect(),d={width:c.width,height:c.height};return Sc.widthCache[s]=d,++Sc.cacheCount>vre&&(Sc.cacheCount=0,Sc.widthCache={}),d}catch{return{width:0,height:0}}},bre=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function vf(e){"@babel/helpers - typeof";return vf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vf(e)}function Im(e,t){return Nre(e)||Sre(e,t)||jre(e,t)||wre()}function wre(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
69
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jre(e,t){if(e){if(typeof e=="string")return O2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O2(e,t)}}function O2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Sre(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,c=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;d=!1}else for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);d=!0);}catch(m){f=!0,s=m}finally{try{if(!d&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw s}}return c}}function Nre(e){if(Array.isArray(e))return e}function Cre(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M2(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,kre(r.key),r)}}function _re(e,t,n){return t&&M2(e.prototype,t),n&&M2(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function kre(e){var t=Are(e,"string");return vf(t)=="symbol"?t:t+""}function Are(e,t){if(vf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(vf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var I2=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,$2=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Ere=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Pre=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,X4={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},Rre=Object.keys(X4),Ic="NaN";function Tre(e,t){return e*X4[t]}var Uh=(function(){function e(t,n){Cre(this,e),this.num=t,this.unit=n,this.num=t,this.unit=n,Number.isNaN(t)&&(this.unit=""),n!==""&&!Ere.test(n)&&(this.num=NaN,this.unit=""),Rre.includes(n)&&(this.num=Tre(t,n),this.unit="px")}return _re(e,[{key:"add",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num+n.num,this.unit)}},{key:"subtract",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num-n.num,this.unit)}},{key:"multiply",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num*n.num,this.unit||n.unit)}},{key:"divide",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num/n.num,this.unit||n.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(n){var r,s=(r=Pre.exec(n))!==null&&r!==void 0?r:[],o=Im(s,3),i=o[1],c=o[2];return new e(parseFloat(i),c??"")}}])})();function Q4(e){if(e.includes(Ic))return Ic;for(var t=e;t.includes("*")||t.includes("/");){var n,r=(n=I2.exec(t))!==null&&n!==void 0?n:[],s=Im(r,4),o=s[1],i=s[2],c=s[3],d=Uh.parse(o??""),f=Uh.parse(c??""),m=i==="*"?d.multiply(f):d.divide(f);if(m.isNaN())return Ic;t=t.replace(I2,m.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var p,v=(p=$2.exec(t))!==null&&p!==void 0?p:[],x=Im(v,4),j=x[1],y=x[2],b=x[3],S=Uh.parse(j??""),N=Uh.parse(b??""),C=y==="+"?S.add(N):S.subtract(N);if(C.isNaN())return Ic;t=t.replace($2,C.toString())}return t}var D2=/\(([^()]*)\)/;function Ore(e){for(var t=e;t.includes("(");){var n=D2.exec(t),r=Im(n,2),s=r[1];t=t.replace(D2,Q4(s))}return t}function Mre(e){var t=e.replace(/\s+/g,"");return t=Ore(t),t=Q4(t),t}function Ire(e){try{return Mre(e)}catch{return Ic}}function _j(e){var t=Ire(e.slice(5,-1));return t===Ic?"":t}var $re=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],Dre=["dx","dy","angle","className","breakAll"];function R1(){return R1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},R1.apply(this,arguments)}function L2(e,t){if(e==null)return{};var n=Lre(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Lre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function F2(e,t){return qre(e)||Bre(e,t)||zre(e,t)||Fre()}function Fre(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
70
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zre(e,t){if(e){if(typeof e=="string")return z2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return z2(e,t)}}function z2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Bre(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,c=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;d=!1}else for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);d=!0);}catch(m){f=!0,s=m}finally{try{if(!d&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw s}}return c}}function qre(e){if(Array.isArray(e))return e}var J4=/[ \f\n\r\t\v\u2028\u2029]+/,Z4=function(t){var n=t.children,r=t.breakAll,s=t.style;try{var o=[];Gt(n)||(r?o=n.toString().split(""):o=n.toString().split(J4));var i=o.map(function(d){return{word:d,width:Yd(d,s).width}}),c=r?0:Yd(" ",s).width;return{wordsWithComputedWidth:i,spaceWidth:c}}catch{return null}},Ure=function(t,n,r,s,o){var i=t.maxLines,c=t.children,d=t.style,f=t.breakAll,m=rt(i),p=c,v=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return I.reduce(function(T,V){var H=V.word,M=V.width,X=T[T.length-1];if(X&&(s==null||o||X.width+M+r<Number(s)))X.words.push(H),X.width+=M+r;else{var $={words:[H],width:M};T.push($)}return T},[])},x=v(n),j=function(I){return I.reduce(function(T,V){return T.width>V.width?T:V})};if(!m)return x;for(var y="…",b=function(I){var T=p.slice(0,I),V=Z4({breakAll:f,style:d,children:T+y}).wordsWithComputedWidth,H=v(V),M=H.length>i||j(H).width>Number(s);return[M,H]},S=0,N=p.length-1,C=0,k;S<=N&&C<=p.length-1;){var A=Math.floor((S+N)/2),E=A-1,P=b(E),O=F2(P,2),D=O[0],K=O[1],q=b(A),B=F2(q,1),Y=B[0];if(!D&&!Y&&(S=A+1),D&&Y&&(N=A-1),!D&&Y){k=K;break}C++}return k||x},B2=function(t){var n=Gt(t)?[]:t.toString().split(J4);return[{words:n}]},Wre=function(t){var n=t.width,r=t.scaleToFit,s=t.children,o=t.style,i=t.breakAll,c=t.maxLines;if((n||r)&&!Wl.isSsr){var d,f,m=Z4({breakAll:i,children:s,style:o});if(m){var p=m.wordsWithComputedWidth,v=m.spaceWidth;d=p,f=v}else return B2(s);return Ure({breakAll:i,children:s,maxLines:c,style:o},d,f,n,r)}return B2(s)},q2="#808080",kl=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,o=s===void 0?0:s,i=t.lineHeight,c=i===void 0?"1em":i,d=t.capHeight,f=d===void 0?"0.71em":d,m=t.scaleToFit,p=m===void 0?!1:m,v=t.textAnchor,x=v===void 0?"start":v,j=t.verticalAnchor,y=j===void 0?"end":j,b=t.fill,S=b===void 0?q2:b,N=L2(t,$re),C=h.useMemo(function(){return Wre({breakAll:N.breakAll,children:N.children,maxLines:N.maxLines,scaleToFit:p,style:N.style,width:N.width})},[N.breakAll,N.children,N.maxLines,p,N.style,N.width]),k=N.dx,A=N.dy,E=N.angle,P=N.className,O=N.breakAll,D=L2(N,Dre);if(!dr(r)||!dr(o))return null;var K=r+(rt(k)?k:0),q=o+(rt(A)?A:0),B;switch(y){case"start":B=_j("calc(".concat(f,")"));break;case"middle":B=_j("calc(".concat((C.length-1)/2," * -").concat(c," + (").concat(f," / 2))"));break;default:B=_j("calc(".concat(C.length-1," * -").concat(c,")"));break}var Y=[];if(p){var z=C[0].width,I=N.width;Y.push("scale(".concat((rt(I)?I/z:1)/z,")"))}return E&&Y.push("rotate(".concat(E,", ").concat(K,", ").concat(q,")")),Y.length&&(D.transform=Y.join(" ")),Q.createElement("text",R1({},Mt(D,!0),{x:K,y:q,className:Yt("recharts-text",P),textAnchor:x,fill:S.includes("url")?q2:S}),C.map(function(T,V){var H=T.words.join(O?"":" ");return Q.createElement("tspan",{x:K,dy:V===0?B:c,key:"".concat(H,"-").concat(V)},H)}))};function yi(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Hre(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function f_(e){let t,n,r;e.length!==2?(t=yi,n=(c,d)=>yi(e(c),d),r=(c,d)=>e(c)-d):(t=e===yi||e===Hre?e:Vre,n=e,r=e);function s(c,d,f=0,m=c.length){if(f<m){if(t(d,d)!==0)return m;do{const p=f+m>>>1;n(c[p],d)<0?f=p+1:m=p}while(f<m)}return f}function o(c,d,f=0,m=c.length){if(f<m){if(t(d,d)!==0)return m;do{const p=f+m>>>1;n(c[p],d)<=0?f=p+1:m=p}while(f<m)}return f}function i(c,d,f=0,m=c.length){const p=s(c,d,f,m-1);return p>f&&r(c[p-1],d)>-r(c[p],d)?p-1:p}return{left:s,center:i,right:o}}function Vre(){return 0}function eF(e){return e===null?NaN:+e}function*Kre(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const Gre=f_(yi),hp=Gre.right;f_(eF).center;class U2 extends Map{constructor(t,n=Qre){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,s]of t)this.set(r,s)}get(t){return super.get(W2(this,t))}has(t){return super.has(W2(this,t))}set(t,n){return super.set(Yre(this,t),n)}delete(t){return super.delete(Xre(this,t))}}function W2({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Yre({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Xre({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Qre(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Jre(e=yi){if(e===yi)return tF;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function tF(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const Zre=Math.sqrt(50),eae=Math.sqrt(10),tae=Math.sqrt(2);function $m(e,t,n){const r=(t-e)/Math.max(0,n),s=Math.floor(Math.log10(r)),o=r/Math.pow(10,s),i=o>=Zre?10:o>=eae?5:o>=tae?2:1;let c,d,f;return s<0?(f=Math.pow(10,-s)/i,c=Math.round(e*f),d=Math.round(t*f),c/f<e&&++c,d/f>t&&--d,f=-f):(f=Math.pow(10,s)*i,c=Math.round(e/f),d=Math.round(t/f),c*f<e&&++c,d*f>t&&--d),d<c&&.5<=n&&n<2?$m(e,t,n*2):[c,d,f]}function T1(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const r=t<e,[s,o,i]=r?$m(t,e,n):$m(e,t,n);if(!(o>=s))return[];const c=o-s+1,d=new Array(c);if(r)if(i<0)for(let f=0;f<c;++f)d[f]=(o-f)/-i;else for(let f=0;f<c;++f)d[f]=(o-f)*i;else if(i<0)for(let f=0;f<c;++f)d[f]=(s+f)/-i;else for(let f=0;f<c;++f)d[f]=(s+f)*i;return d}function O1(e,t,n){return t=+t,e=+e,n=+n,$m(e,t,n)[2]}function M1(e,t,n){t=+t,e=+e,n=+n;const r=t<e,s=r?O1(t,e,n):O1(e,t,n);return(r?-1:1)*(s<0?1/-s:s)}function H2(e,t){let n;for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function V2(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function nF(e,t,n=0,r=1/0,s){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(s=s===void 0?tF:Jre(s);r>n;){if(r-n>600){const d=r-n+1,f=t-n+1,m=Math.log(d),p=.5*Math.exp(2*m/3),v=.5*Math.sqrt(m*p*(d-p)/d)*(f-d/2<0?-1:1),x=Math.max(n,Math.floor(t-f*p/d+v)),j=Math.min(r,Math.floor(t+(d-f)*p/d+v));nF(e,t,x,j,s)}const o=e[t];let i=n,c=r;for(Pd(e,n,t),s(e[r],o)>0&&Pd(e,n,r);i<c;){for(Pd(e,i,c),++i,--c;s(e[i],o)<0;)++i;for(;s(e[c],o)>0;)--c}s(e[n],o)===0?Pd(e,n,c):(++c,Pd(e,c,r)),c<=t&&(n=c+1),t<=c&&(r=c-1)}return e}function Pd(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function nae(e,t,n){if(e=Float64Array.from(Kre(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return V2(e);if(t>=1)return H2(e);var r,s=(r-1)*t,o=Math.floor(s),i=H2(nF(e,o).subarray(0,o+1)),c=V2(e.subarray(o+1));return i+(c-i)*(s-o)}}function rae(e,t,n=eF){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,s=(r-1)*t,o=Math.floor(s),i=+n(e[o],o,e),c=+n(e[o+1],o+1,e);return i+(c-i)*(s-o)}}function aae(e,t,n){e=+e,t=+t,n=(s=arguments.length)<2?(t=e,e=0,1):s<3?1:+n;for(var r=-1,s=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(s);++r<s;)o[r]=e+r*n;return o}function os(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function qo(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const I1=Symbol("implicit");function p_(){var e=new U2,t=[],n=[],r=I1;function s(o){let i=e.get(o);if(i===void 0){if(r!==I1)return r;e.set(o,i=t.push(o)-1)}return n[i%n.length]}return s.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new U2;for(const i of o)e.has(i)||e.set(i,t.push(i)-1);return s},s.range=function(o){return arguments.length?(n=Array.from(o),s):n.slice()},s.unknown=function(o){return arguments.length?(r=o,s):r},s.copy=function(){return p_(t,n).unknown(r)},os.apply(s,arguments),s}function xf(){var e=p_().unknown(void 0),t=e.domain,n=e.range,r=0,s=1,o,i,c=!1,d=0,f=0,m=.5;delete e.unknown;function p(){var v=t().length,x=s<r,j=x?s:r,y=x?r:s;o=(y-j)/Math.max(1,v-d+f*2),c&&(o=Math.floor(o)),j+=(y-j-o*(v-d))*m,i=o*(1-d),c&&(j=Math.round(j),i=Math.round(i));var b=aae(v).map(function(S){return j+o*S});return n(x?b.reverse():b)}return e.domain=function(v){return arguments.length?(t(v),p()):t()},e.range=function(v){return arguments.length?([r,s]=v,r=+r,s=+s,p()):[r,s]},e.rangeRound=function(v){return[r,s]=v,r=+r,s=+s,c=!0,p()},e.bandwidth=function(){return i},e.step=function(){return o},e.round=function(v){return arguments.length?(c=!!v,p()):c},e.padding=function(v){return arguments.length?(d=Math.min(1,f=+v),p()):d},e.paddingInner=function(v){return arguments.length?(d=Math.min(1,v),p()):d},e.paddingOuter=function(v){return arguments.length?(f=+v,p()):f},e.align=function(v){return arguments.length?(m=Math.max(0,Math.min(1,v)),p()):m},e.copy=function(){return xf(t(),[r,s]).round(c).paddingInner(d).paddingOuter(f).align(m)},os.apply(p(),arguments)}function rF(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return rF(t())},e}function Xd(){return rF(xf.apply(null,arguments).paddingInner(1))}function h_(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function aF(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function mp(){}var yf=.7,Dm=1/yf,Hc="\\s*([+-]?\\d+)\\s*",bf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ws="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",sae=/^#([0-9a-f]{3,8})$/,oae=new RegExp(`^rgb\\(${Hc},${Hc},${Hc}\\)$`),iae=new RegExp(`^rgb\\(${Ws},${Ws},${Ws}\\)$`),lae=new RegExp(`^rgba\\(${Hc},${Hc},${Hc},${bf}\\)$`),cae=new RegExp(`^rgba\\(${Ws},${Ws},${Ws},${bf}\\)$`),uae=new RegExp(`^hsl\\(${bf},${Ws},${Ws}\\)$`),dae=new RegExp(`^hsla\\(${bf},${Ws},${Ws},${bf}\\)$`),K2={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};h_(mp,wf,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:G2,formatHex:G2,formatHex8:fae,formatHsl:pae,formatRgb:Y2,toString:Y2});function G2(){return this.rgb().formatHex()}function fae(){return this.rgb().formatHex8()}function pae(){return sF(this).formatHsl()}function Y2(){return this.rgb().formatRgb()}function wf(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=sae.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?X2(t):n===3?new da(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Wh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Wh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=oae.exec(e))?new da(t[1],t[2],t[3],1):(t=iae.exec(e))?new da(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=lae.exec(e))?Wh(t[1],t[2],t[3],t[4]):(t=cae.exec(e))?Wh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=uae.exec(e))?Z2(t[1],t[2]/100,t[3]/100,1):(t=dae.exec(e))?Z2(t[1],t[2]/100,t[3]/100,t[4]):K2.hasOwnProperty(e)?X2(K2[e]):e==="transparent"?new da(NaN,NaN,NaN,0):null}function X2(e){return new da(e>>16&255,e>>8&255,e&255,1)}function Wh(e,t,n,r){return r<=0&&(e=t=n=NaN),new da(e,t,n,r)}function hae(e){return e instanceof mp||(e=wf(e)),e?(e=e.rgb(),new da(e.r,e.g,e.b,e.opacity)):new da}function $1(e,t,n,r){return arguments.length===1?hae(e):new da(e,t,n,r??1)}function da(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}h_(da,$1,aF(mp,{brighter(e){return e=e==null?Dm:Math.pow(Dm,e),new da(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yf:Math.pow(yf,e),new da(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new da(vl(this.r),vl(this.g),vl(this.b),Lm(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:Q2,formatHex:Q2,formatHex8:mae,formatRgb:J2,toString:J2}));function Q2(){return`#${dl(this.r)}${dl(this.g)}${dl(this.b)}`}function mae(){return`#${dl(this.r)}${dl(this.g)}${dl(this.b)}${dl((isNaN(this.opacity)?1:this.opacity)*255)}`}function J2(){const e=Lm(this.opacity);return`${e===1?"rgb(":"rgba("}${vl(this.r)}, ${vl(this.g)}, ${vl(this.b)}${e===1?")":`, ${e})`}`}function Lm(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function vl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function dl(e){return e=vl(e),(e<16?"0":"")+e.toString(16)}function Z2(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ss(e,t,n,r)}function sF(e){if(e instanceof Ss)return new Ss(e.h,e.s,e.l,e.opacity);if(e instanceof mp||(e=wf(e)),!e)return new Ss;if(e instanceof Ss)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),o=Math.max(t,n,r),i=NaN,c=o-s,d=(o+s)/2;return c?(t===o?i=(n-r)/c+(n<r)*6:n===o?i=(r-t)/c+2:i=(t-n)/c+4,c/=d<.5?o+s:2-o-s,i*=60):c=d>0&&d<1?0:i,new Ss(i,c,d,e.opacity)}function gae(e,t,n,r){return arguments.length===1?sF(e):new Ss(e,t,n,r??1)}function Ss(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}h_(Ss,gae,aF(mp,{brighter(e){return e=e==null?Dm:Math.pow(Dm,e),new Ss(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yf:Math.pow(yf,e),new Ss(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new da(kj(e>=240?e-240:e+120,s,r),kj(e,s,r),kj(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Ss(eM(this.h),Hh(this.s),Hh(this.l),Lm(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=Lm(this.opacity);return`${e===1?"hsl(":"hsla("}${eM(this.h)}, ${Hh(this.s)*100}%, ${Hh(this.l)*100}%${e===1?")":`, ${e})`}`}}));function eM(e){return e=(e||0)%360,e<0?e+360:e}function Hh(e){return Math.max(0,Math.min(1,e||0))}function kj(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const m_=e=>()=>e;function vae(e,t){return function(n){return e+n*t}}function xae(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function yae(e){return(e=+e)==1?oF:function(t,n){return n-t?xae(t,n,e):m_(isNaN(t)?n:t)}}function oF(e,t){var n=t-e;return n?vae(e,n):m_(isNaN(e)?t:e)}const tM=(function e(t){var n=yae(t);function r(s,o){var i=n((s=$1(s)).r,(o=$1(o)).r),c=n(s.g,o.g),d=n(s.b,o.b),f=oF(s.opacity,o.opacity);return function(m){return s.r=i(m),s.g=c(m),s.b=d(m),s.opacity=f(m),s+""}}return r.gamma=e,r})(1);function bae(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(o){for(s=0;s<n;++s)r[s]=e[s]*(1-o)+t[s]*o;return r}}function wae(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function jae(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),o=new Array(n),i;for(i=0;i<r;++i)s[i]=Fu(e[i],t[i]);for(;i<n;++i)o[i]=t[i];return function(c){for(i=0;i<r;++i)o[i]=s[i](c);return o}}function Sae(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Fm(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Nae(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=Fu(e[s],t[s]):r[s]=t[s];return function(o){for(s in n)r[s]=n[s](o);return r}}var D1=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Aj=new RegExp(D1.source,"g");function Cae(e){return function(){return e}}function _ae(e){return function(t){return e(t)+""}}function kae(e,t){var n=D1.lastIndex=Aj.lastIndex=0,r,s,o,i=-1,c=[],d=[];for(e=e+"",t=t+"";(r=D1.exec(e))&&(s=Aj.exec(t));)(o=s.index)>n&&(o=t.slice(n,o),c[i]?c[i]+=o:c[++i]=o),(r=r[0])===(s=s[0])?c[i]?c[i]+=s:c[++i]=s:(c[++i]=null,d.push({i,x:Fm(r,s)})),n=Aj.lastIndex;return n<t.length&&(o=t.slice(n),c[i]?c[i]+=o:c[++i]=o),c.length<2?d[0]?_ae(d[0].x):Cae(t):(t=d.length,function(f){for(var m=0,p;m<t;++m)c[(p=d[m]).i]=p.x(f);return c.join("")})}function Fu(e,t){var n=typeof t,r;return t==null||n==="boolean"?m_(t):(n==="number"?Fm:n==="string"?(r=wf(t))?(t=r,tM):kae:t instanceof wf?tM:t instanceof Date?Sae:wae(t)?bae:Array.isArray(t)?jae:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Nae:Fm)(e,t)}function g_(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function Aae(e,t){t===void 0&&(t=e,e=Fu);for(var n=0,r=t.length-1,s=t[0],o=new Array(r<0?0:r);n<r;)o[n]=e(s,s=t[++n]);return function(i){var c=Math.max(0,Math.min(r-1,Math.floor(i*=r)));return o[c](i-c)}}function Eae(e){return function(){return e}}function zm(e){return+e}var nM=[0,1];function Ur(e){return e}function L1(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Eae(isNaN(t)?NaN:.5)}function Pae(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Rae(e,t,n){var r=e[0],s=e[1],o=t[0],i=t[1];return s<r?(r=L1(s,r),o=n(i,o)):(r=L1(r,s),o=n(o,i)),function(c){return o(r(c))}}function Tae(e,t,n){var r=Math.min(e.length,t.length)-1,s=new Array(r),o=new Array(r),i=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++i<r;)s[i]=L1(e[i],e[i+1]),o[i]=n(t[i],t[i+1]);return function(c){var d=hp(e,c,1,r)-1;return o[d](s[d](c))}}function gp(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Sv(){var e=nM,t=nM,n=Fu,r,s,o,i=Ur,c,d,f;function m(){var v=Math.min(e.length,t.length);return i!==Ur&&(i=Pae(e[0],e[v-1])),c=v>2?Tae:Rae,d=f=null,p}function p(v){return v==null||isNaN(v=+v)?o:(d||(d=c(e.map(r),t,n)))(r(i(v)))}return p.invert=function(v){return i(s((f||(f=c(t,e.map(r),Fm)))(v)))},p.domain=function(v){return arguments.length?(e=Array.from(v,zm),m()):e.slice()},p.range=function(v){return arguments.length?(t=Array.from(v),m()):t.slice()},p.rangeRound=function(v){return t=Array.from(v),n=g_,m()},p.clamp=function(v){return arguments.length?(i=v?!0:Ur,m()):i!==Ur},p.interpolate=function(v){return arguments.length?(n=v,m()):n},p.unknown=function(v){return arguments.length?(o=v,p):o},function(v,x){return r=v,s=x,m()}}function v_(){return Sv()(Ur,Ur)}function Oae(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Bm(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function au(e){return e=Bm(Math.abs(e)),e?e[1]:NaN}function Mae(e,t){return function(n,r){for(var s=n.length,o=[],i=0,c=e[0],d=0;s>0&&c>0&&(d+c+1>r&&(c=Math.max(1,r-d)),o.push(n.substring(s-=c,s+c)),!((d+=c+1)>r));)c=e[i=(i+1)%e.length];return o.reverse().join(t)}}function Iae(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var $ae=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function jf(e){if(!(t=$ae.exec(e)))throw new Error("invalid format: "+e);var t;return new x_({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}jf.prototype=x_.prototype;function x_(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}x_.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Dae(e){e:for(var t=e.length,n=1,r=-1,s;n<t;++n)switch(e[n]){case".":r=s=n;break;case"0":r===0&&(r=n),s=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(s+1):e}var qm;function Lae(e,t){var n=Bm(e,t);if(!n)return qm=void 0,e.toPrecision(t);var r=n[0],s=n[1],o=s-(qm=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,i=r.length;return o===i?r:o>i?r+new Array(o-i+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Bm(e,Math.max(0,t+o-1))[0]}function rM(e,t){var n=Bm(e,t);if(!n)return e+"";var r=n[0],s=n[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const aM={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Oae,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>rM(e*100,t),r:rM,s:Lae,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function sM(e){return e}var oM=Array.prototype.map,iM=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Fae(e){var t=e.grouping===void 0||e.thousands===void 0?sM:Mae(oM.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",s=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?sM:Iae(oM.call(e.numerals,String)),i=e.percent===void 0?"%":e.percent+"",c=e.minus===void 0?"−":e.minus+"",d=e.nan===void 0?"NaN":e.nan+"";function f(p,v){p=jf(p);var x=p.fill,j=p.align,y=p.sign,b=p.symbol,S=p.zero,N=p.width,C=p.comma,k=p.precision,A=p.trim,E=p.type;E==="n"?(C=!0,E="g"):aM[E]||(k===void 0&&(k=12),A=!0,E="g"),(S||x==="0"&&j==="=")&&(S=!0,x="0",j="=");var P=(v&&v.prefix!==void 0?v.prefix:"")+(b==="$"?n:b==="#"&&/[boxX]/.test(E)?"0"+E.toLowerCase():""),O=(b==="$"?r:/[%p]/.test(E)?i:"")+(v&&v.suffix!==void 0?v.suffix:""),D=aM[E],K=/[defgprs%]/.test(E);k=k===void 0?6:/[gprs]/.test(E)?Math.max(1,Math.min(21,k)):Math.max(0,Math.min(20,k));function q(B){var Y=P,z=O,I,T,V;if(E==="c")z=D(B)+z,B="";else{B=+B;var H=B<0||1/B<0;if(B=isNaN(B)?d:D(Math.abs(B),k),A&&(B=Dae(B)),H&&+B==0&&y!=="+"&&(H=!1),Y=(H?y==="("?y:c:y==="-"||y==="("?"":y)+Y,z=(E==="s"&&!isNaN(B)&&qm!==void 0?iM[8+qm/3]:"")+z+(H&&y==="("?")":""),K){for(I=-1,T=B.length;++I<T;)if(V=B.charCodeAt(I),48>V||V>57){z=(V===46?s+B.slice(I+1):B.slice(I))+z,B=B.slice(0,I);break}}}C&&!S&&(B=t(B,1/0));var M=Y.length+B.length+z.length,X=M<N?new Array(N-M+1).join(x):"";switch(C&&S&&(B=t(X+B,X.length?N-z.length:1/0),X=""),j){case"<":B=Y+B+z+X;break;case"=":B=Y+X+B+z;break;case"^":B=X.slice(0,M=X.length>>1)+Y+B+z+X.slice(M);break;default:B=X+Y+B+z;break}return o(B)}return q.toString=function(){return p+""},q}function m(p,v){var x=Math.max(-8,Math.min(8,Math.floor(au(v)/3)))*3,j=Math.pow(10,-x),y=f((p=jf(p),p.type="f",p),{suffix:iM[8+x/3]});return function(b){return y(j*b)}}return{format:f,formatPrefix:m}}var Vh,y_,iF;zae({thousands:",",grouping:[3],currency:["$",""]});function zae(e){return Vh=Fae(e),y_=Vh.format,iF=Vh.formatPrefix,Vh}function Bae(e){return Math.max(0,-au(Math.abs(e)))}function qae(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(au(t)/3)))*3-au(Math.abs(e)))}function Uae(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,au(t)-au(e))+1}function lF(e,t,n,r){var s=M1(e,t,n),o;switch(r=jf(r??",f"),r.type){case"s":{var i=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=qae(s,i))&&(r.precision=o),iF(r,i)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=Uae(s,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=Bae(s))&&(r.precision=o-(r.type==="%")*2);break}}return y_(r)}function Ti(e){var t=e.domain;return e.ticks=function(n){var r=t();return T1(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var s=t();return lF(s[0],s[s.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),s=0,o=r.length-1,i=r[s],c=r[o],d,f,m=10;for(c<i&&(f=i,i=c,c=f,f=s,s=o,o=f);m-- >0;){if(f=O1(i,c,n),f===d)return r[s]=i,r[o]=c,t(r);if(f>0)i=Math.floor(i/f)*f,c=Math.ceil(c/f)*f;else if(f<0)i=Math.ceil(i*f)/f,c=Math.floor(c*f)/f;else break;d=f}return e},e}function Um(){var e=v_();return e.copy=function(){return gp(e,Um())},os.apply(e,arguments),Ti(e)}function cF(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,zm),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return cF(e).unknown(t)},e=arguments.length?Array.from(e,zm):[0,1],Ti(n)}function uF(e,t){e=e.slice();var n=0,r=e.length-1,s=e[n],o=e[r],i;return o<s&&(i=n,n=r,r=i,i=s,s=o,o=i),e[n]=t.floor(s),e[r]=t.ceil(o),e}function lM(e){return Math.log(e)}function cM(e){return Math.exp(e)}function Wae(e){return-Math.log(-e)}function Hae(e){return-Math.exp(-e)}function Vae(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Kae(e){return e===10?Vae:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Gae(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function uM(e){return(t,n)=>-e(-t,n)}function b_(e){const t=e(lM,cM),n=t.domain;let r=10,s,o;function i(){return s=Gae(r),o=Kae(r),n()[0]<0?(s=uM(s),o=uM(o),e(Wae,Hae)):e(lM,cM),t}return t.base=function(c){return arguments.length?(r=+c,i()):r},t.domain=function(c){return arguments.length?(n(c),i()):n()},t.ticks=c=>{const d=n();let f=d[0],m=d[d.length-1];const p=m<f;p&&([f,m]=[m,f]);let v=s(f),x=s(m),j,y;const b=c==null?10:+c;let S=[];if(!(r%1)&&x-v<b){if(v=Math.floor(v),x=Math.ceil(x),f>0){for(;v<=x;++v)for(j=1;j<r;++j)if(y=v<0?j/o(-v):j*o(v),!(y<f)){if(y>m)break;S.push(y)}}else for(;v<=x;++v)for(j=r-1;j>=1;--j)if(y=v>0?j/o(-v):j*o(v),!(y<f)){if(y>m)break;S.push(y)}S.length*2<b&&(S=T1(f,m,b))}else S=T1(v,x,Math.min(x-v,b)).map(o);return p?S.reverse():S},t.tickFormat=(c,d)=>{if(c==null&&(c=10),d==null&&(d=r===10?"s":","),typeof d!="function"&&(!(r%1)&&(d=jf(d)).precision==null&&(d.trim=!0),d=y_(d)),c===1/0)return d;const f=Math.max(1,r*c/t.ticks().length);return m=>{let p=m/o(Math.round(s(m)));return p*r<r-.5&&(p*=r),p<=f?d(m):""}},t.nice=()=>n(uF(n(),{floor:c=>o(Math.floor(s(c))),ceil:c=>o(Math.ceil(s(c)))})),t}function dF(){const e=b_(Sv()).domain([1,10]);return e.copy=()=>gp(e,dF()).base(e.base()),os.apply(e,arguments),e}function dM(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function fM(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function w_(e){var t=1,n=e(dM(t),fM(t));return n.constant=function(r){return arguments.length?e(dM(t=+r),fM(t)):t},Ti(n)}function fF(){var e=w_(Sv());return e.copy=function(){return gp(e,fF()).constant(e.constant())},os.apply(e,arguments)}function pM(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Yae(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Xae(e){return e<0?-e*e:e*e}function j_(e){var t=e(Ur,Ur),n=1;function r(){return n===1?e(Ur,Ur):n===.5?e(Yae,Xae):e(pM(n),pM(1/n))}return t.exponent=function(s){return arguments.length?(n=+s,r()):n},Ti(t)}function S_(){var e=j_(Sv());return e.copy=function(){return gp(e,S_()).exponent(e.exponent())},os.apply(e,arguments),e}function Qae(){return S_.apply(null,arguments).exponent(.5)}function hM(e){return Math.sign(e)*e*e}function Jae(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function pF(){var e=v_(),t=[0,1],n=!1,r;function s(o){var i=Jae(e(o));return isNaN(i)?r:n?Math.round(i):i}return s.invert=function(o){return e.invert(hM(o))},s.domain=function(o){return arguments.length?(e.domain(o),s):e.domain()},s.range=function(o){return arguments.length?(e.range((t=Array.from(o,zm)).map(hM)),s):t.slice()},s.rangeRound=function(o){return s.range(o).round(!0)},s.round=function(o){return arguments.length?(n=!!o,s):n},s.clamp=function(o){return arguments.length?(e.clamp(o),s):e.clamp()},s.unknown=function(o){return arguments.length?(r=o,s):r},s.copy=function(){return pF(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},os.apply(s,arguments),Ti(s)}function hF(){var e=[],t=[],n=[],r;function s(){var i=0,c=Math.max(1,t.length);for(n=new Array(c-1);++i<c;)n[i-1]=rae(e,i/c);return o}function o(i){return i==null||isNaN(i=+i)?r:t[hp(n,i)]}return o.invertExtent=function(i){var c=t.indexOf(i);return c<0?[NaN,NaN]:[c>0?n[c-1]:e[0],c<n.length?n[c]:e[e.length-1]]},o.domain=function(i){if(!arguments.length)return e.slice();e=[];for(let c of i)c!=null&&!isNaN(c=+c)&&e.push(c);return e.sort(yi),s()},o.range=function(i){return arguments.length?(t=Array.from(i),s()):t.slice()},o.unknown=function(i){return arguments.length?(r=i,o):r},o.quantiles=function(){return n.slice()},o.copy=function(){return hF().domain(e).range(t).unknown(r)},os.apply(o,arguments)}function mF(){var e=0,t=1,n=1,r=[.5],s=[0,1],o;function i(d){return d!=null&&d<=d?s[hp(r,d,0,n)]:o}function c(){var d=-1;for(r=new Array(n);++d<n;)r[d]=((d+1)*t-(d-n)*e)/(n+1);return i}return i.domain=function(d){return arguments.length?([e,t]=d,e=+e,t=+t,c()):[e,t]},i.range=function(d){return arguments.length?(n=(s=Array.from(d)).length-1,c()):s.slice()},i.invertExtent=function(d){var f=s.indexOf(d);return f<0?[NaN,NaN]:f<1?[e,r[0]]:f>=n?[r[n-1],t]:[r[f-1],r[f]]},i.unknown=function(d){return arguments.length&&(o=d),i},i.thresholds=function(){return r.slice()},i.copy=function(){return mF().domain([e,t]).range(s).unknown(o)},os.apply(Ti(i),arguments)}function gF(){var e=[.5],t=[0,1],n,r=1;function s(o){return o!=null&&o<=o?t[hp(e,o,0,r)]:n}return s.domain=function(o){return arguments.length?(e=Array.from(o),r=Math.min(e.length,t.length-1),s):e.slice()},s.range=function(o){return arguments.length?(t=Array.from(o),r=Math.min(e.length,t.length-1),s):t.slice()},s.invertExtent=function(o){var i=t.indexOf(o);return[e[i-1],e[i]]},s.unknown=function(o){return arguments.length?(n=o,s):n},s.copy=function(){return gF().domain(e).range(t).unknown(n)},os.apply(s,arguments)}const Ej=new Date,Pj=new Date;function hr(e,t,n,r){function s(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return s.floor=o=>(e(o=new Date(+o)),o),s.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),s.round=o=>{const i=s(o),c=s.ceil(o);return o-i<c-o?i:c},s.offset=(o,i)=>(t(o=new Date(+o),i==null?1:Math.floor(i)),o),s.range=(o,i,c)=>{const d=[];if(o=s.ceil(o),c=c==null?1:Math.floor(c),!(o<i)||!(c>0))return d;let f;do d.push(f=new Date(+o)),t(o,c),e(o);while(f<o&&o<i);return d},s.filter=o=>hr(i=>{if(i>=i)for(;e(i),!o(i);)i.setTime(i-1)},(i,c)=>{if(i>=i)if(c<0)for(;++c<=0;)for(;t(i,-1),!o(i););else for(;--c>=0;)for(;t(i,1),!o(i););}),n&&(s.count=(o,i)=>(Ej.setTime(+o),Pj.setTime(+i),e(Ej),e(Pj),Math.floor(n(Ej,Pj))),s.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?s.filter(r?i=>r(i)%o===0:i=>s.count(0,i)%o===0):s)),s}const Wm=hr(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Wm.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?hr(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Wm);Wm.range;const bo=1e3,Ua=bo*60,wo=Ua*60,$o=wo*24,N_=$o*7,mM=$o*30,Rj=$o*365,fl=hr(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*bo)},(e,t)=>(t-e)/bo,e=>e.getUTCSeconds());fl.range;const C_=hr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*bo)},(e,t)=>{e.setTime(+e+t*Ua)},(e,t)=>(t-e)/Ua,e=>e.getMinutes());C_.range;const __=hr(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ua)},(e,t)=>(t-e)/Ua,e=>e.getUTCMinutes());__.range;const k_=hr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*bo-e.getMinutes()*Ua)},(e,t)=>{e.setTime(+e+t*wo)},(e,t)=>(t-e)/wo,e=>e.getHours());k_.range;const A_=hr(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*wo)},(e,t)=>(t-e)/wo,e=>e.getUTCHours());A_.range;const vp=hr(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ua)/$o,e=>e.getDate()-1);vp.range;const Nv=hr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/$o,e=>e.getUTCDate()-1);Nv.range;const vF=hr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/$o,e=>Math.floor(e/$o));vF.range;function Hl(e){return hr(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Ua)/N_)}const Cv=Hl(0),Hm=Hl(1),Zae=Hl(2),ese=Hl(3),su=Hl(4),tse=Hl(5),nse=Hl(6);Cv.range;Hm.range;Zae.range;ese.range;su.range;tse.range;nse.range;function Vl(e){return hr(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/N_)}const _v=Vl(0),Vm=Vl(1),rse=Vl(2),ase=Vl(3),ou=Vl(4),sse=Vl(5),ose=Vl(6);_v.range;Vm.range;rse.range;ase.range;ou.range;sse.range;ose.range;const E_=hr(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());E_.range;const P_=hr(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());P_.range;const Do=hr(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Do.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:hr(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Do.range;const Lo=hr(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Lo.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:hr(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});Lo.range;function xF(e,t,n,r,s,o){const i=[[fl,1,bo],[fl,5,5*bo],[fl,15,15*bo],[fl,30,30*bo],[o,1,Ua],[o,5,5*Ua],[o,15,15*Ua],[o,30,30*Ua],[s,1,wo],[s,3,3*wo],[s,6,6*wo],[s,12,12*wo],[r,1,$o],[r,2,2*$o],[n,1,N_],[t,1,mM],[t,3,3*mM],[e,1,Rj]];function c(f,m,p){const v=m<f;v&&([f,m]=[m,f]);const x=p&&typeof p.range=="function"?p:d(f,m,p),j=x?x.range(f,+m+1):[];return v?j.reverse():j}function d(f,m,p){const v=Math.abs(m-f)/p,x=f_(([,,b])=>b).right(i,v);if(x===i.length)return e.every(M1(f/Rj,m/Rj,p));if(x===0)return Wm.every(Math.max(M1(f,m,p),1));const[j,y]=i[v/i[x-1][2]<i[x][2]/v?x-1:x];return j.every(y)}return[c,d]}const[ise,lse]=xF(Lo,P_,_v,vF,A_,__),[cse,use]=xF(Do,E_,Cv,vp,k_,C_);function Tj(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Oj(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Rd(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function dse(e){var t=e.dateTime,n=e.date,r=e.time,s=e.periods,o=e.days,i=e.shortDays,c=e.months,d=e.shortMonths,f=Td(s),m=Od(s),p=Td(o),v=Od(o),x=Td(i),j=Od(i),y=Td(c),b=Od(c),S=Td(d),N=Od(d),C={a:V,A:H,b:M,B:X,c:null,d:wM,e:wM,f:Mse,g:Wse,G:Vse,H:Rse,I:Tse,j:Ose,L:yF,m:Ise,M:$se,p:$,q:F,Q:NM,s:CM,S:Dse,u:Lse,U:Fse,V:zse,w:Bse,W:qse,x:null,X:null,y:Use,Y:Hse,Z:Kse,"%":SM},k={a:G,A:re,b:oe,B:ue,c:null,d:jM,e:jM,f:Qse,g:ioe,G:coe,H:Gse,I:Yse,j:Xse,L:wF,m:Jse,M:Zse,p:ae,q:ye,Q:NM,s:CM,S:eoe,u:toe,U:noe,V:roe,w:aoe,W:soe,x:null,X:null,y:ooe,Y:loe,Z:uoe,"%":SM},A={a:K,A:q,b:B,B:Y,c:z,d:yM,e:yM,f:kse,g:xM,G:vM,H:bM,I:bM,j:Sse,L:_se,m:jse,M:Nse,p:D,q:wse,Q:Ese,s:Pse,S:Cse,u:gse,U:vse,V:xse,w:mse,W:yse,x:I,X:T,y:xM,Y:vM,Z:bse,"%":Ase};C.x=E(n,C),C.X=E(r,C),C.c=E(t,C),k.x=E(n,k),k.X=E(r,k),k.c=E(t,k);function E(se,de){return function(De){var ge=[],ve=-1,Se=0,at=se.length,tt,it,kt;for(De instanceof Date||(De=new Date(+De));++ve<at;)se.charCodeAt(ve)===37&&(ge.push(se.slice(Se,ve)),(it=gM[tt=se.charAt(++ve)])!=null?tt=se.charAt(++ve):it=tt==="e"?" ":"0",(kt=de[tt])&&(tt=kt(De,it)),ge.push(tt),Se=ve+1);return ge.push(se.slice(Se,ve)),ge.join("")}}function P(se,de){return function(De){var ge=Rd(1900,void 0,1),ve=O(ge,se,De+="",0),Se,at;if(ve!=De.length)return null;if("Q"in ge)return new Date(ge.Q);if("s"in ge)return new Date(ge.s*1e3+("L"in ge?ge.L:0));if(de&&!("Z"in ge)&&(ge.Z=0),"p"in ge&&(ge.H=ge.H%12+ge.p*12),ge.m===void 0&&(ge.m="q"in ge?ge.q:0),"V"in ge){if(ge.V<1||ge.V>53)return null;"w"in ge||(ge.w=1),"Z"in ge?(Se=Oj(Rd(ge.y,0,1)),at=Se.getUTCDay(),Se=at>4||at===0?Vm.ceil(Se):Vm(Se),Se=Nv.offset(Se,(ge.V-1)*7),ge.y=Se.getUTCFullYear(),ge.m=Se.getUTCMonth(),ge.d=Se.getUTCDate()+(ge.w+6)%7):(Se=Tj(Rd(ge.y,0,1)),at=Se.getDay(),Se=at>4||at===0?Hm.ceil(Se):Hm(Se),Se=vp.offset(Se,(ge.V-1)*7),ge.y=Se.getFullYear(),ge.m=Se.getMonth(),ge.d=Se.getDate()+(ge.w+6)%7)}else("W"in ge||"U"in ge)&&("w"in ge||(ge.w="u"in ge?ge.u%7:"W"in ge?1:0),at="Z"in ge?Oj(Rd(ge.y,0,1)).getUTCDay():Tj(Rd(ge.y,0,1)).getDay(),ge.m=0,ge.d="W"in ge?(ge.w+6)%7+ge.W*7-(at+5)%7:ge.w+ge.U*7-(at+6)%7);return"Z"in ge?(ge.H+=ge.Z/100|0,ge.M+=ge.Z%100,Oj(ge)):Tj(ge)}}function O(se,de,De,ge){for(var ve=0,Se=de.length,at=De.length,tt,it;ve<Se;){if(ge>=at)return-1;if(tt=de.charCodeAt(ve++),tt===37){if(tt=de.charAt(ve++),it=A[tt in gM?de.charAt(ve++):tt],!it||(ge=it(se,De,ge))<0)return-1}else if(tt!=De.charCodeAt(ge++))return-1}return ge}function D(se,de,De){var ge=f.exec(de.slice(De));return ge?(se.p=m.get(ge[0].toLowerCase()),De+ge[0].length):-1}function K(se,de,De){var ge=x.exec(de.slice(De));return ge?(se.w=j.get(ge[0].toLowerCase()),De+ge[0].length):-1}function q(se,de,De){var ge=p.exec(de.slice(De));return ge?(se.w=v.get(ge[0].toLowerCase()),De+ge[0].length):-1}function B(se,de,De){var ge=S.exec(de.slice(De));return ge?(se.m=N.get(ge[0].toLowerCase()),De+ge[0].length):-1}function Y(se,de,De){var ge=y.exec(de.slice(De));return ge?(se.m=b.get(ge[0].toLowerCase()),De+ge[0].length):-1}function z(se,de,De){return O(se,t,de,De)}function I(se,de,De){return O(se,n,de,De)}function T(se,de,De){return O(se,r,de,De)}function V(se){return i[se.getDay()]}function H(se){return o[se.getDay()]}function M(se){return d[se.getMonth()]}function X(se){return c[se.getMonth()]}function $(se){return s[+(se.getHours()>=12)]}function F(se){return 1+~~(se.getMonth()/3)}function G(se){return i[se.getUTCDay()]}function re(se){return o[se.getUTCDay()]}function oe(se){return d[se.getUTCMonth()]}function ue(se){return c[se.getUTCMonth()]}function ae(se){return s[+(se.getUTCHours()>=12)]}function ye(se){return 1+~~(se.getUTCMonth()/3)}return{format:function(se){var de=E(se+="",C);return de.toString=function(){return se},de},parse:function(se){var de=P(se+="",!1);return de.toString=function(){return se},de},utcFormat:function(se){var de=E(se+="",k);return de.toString=function(){return se},de},utcParse:function(se){var de=P(se+="",!0);return de.toString=function(){return se},de}}}var gM={"-":"",_:" ",0:"0"},jr=/^\s*\d+/,fse=/^%/,pse=/[\\^$*+?|[\]().{}]/g;function dn(e,t,n){var r=e<0?"-":"",s=(r?-e:e)+"",o=s.length;return r+(o<n?new Array(n-o+1).join(t)+s:s)}function hse(e){return e.replace(pse,"\\$&")}function Td(e){return new RegExp("^(?:"+e.map(hse).join("|")+")","i")}function Od(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function mse(e,t,n){var r=jr.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function gse(e,t,n){var r=jr.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function vse(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function xse(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function yse(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function vM(e,t,n){var r=jr.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function xM(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function bse(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function wse(e,t,n){var r=jr.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function jse(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function yM(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Sse(e,t,n){var r=jr.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function bM(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Nse(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Cse(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function _se(e,t,n){var r=jr.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function kse(e,t,n){var r=jr.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Ase(e,t,n){var r=fse.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Ese(e,t,n){var r=jr.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Pse(e,t,n){var r=jr.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function wM(e,t){return dn(e.getDate(),t,2)}function Rse(e,t){return dn(e.getHours(),t,2)}function Tse(e,t){return dn(e.getHours()%12||12,t,2)}function Ose(e,t){return dn(1+vp.count(Do(e),e),t,3)}function yF(e,t){return dn(e.getMilliseconds(),t,3)}function Mse(e,t){return yF(e,t)+"000"}function Ise(e,t){return dn(e.getMonth()+1,t,2)}function $se(e,t){return dn(e.getMinutes(),t,2)}function Dse(e,t){return dn(e.getSeconds(),t,2)}function Lse(e){var t=e.getDay();return t===0?7:t}function Fse(e,t){return dn(Cv.count(Do(e)-1,e),t,2)}function bF(e){var t=e.getDay();return t>=4||t===0?su(e):su.ceil(e)}function zse(e,t){return e=bF(e),dn(su.count(Do(e),e)+(Do(e).getDay()===4),t,2)}function Bse(e){return e.getDay()}function qse(e,t){return dn(Hm.count(Do(e)-1,e),t,2)}function Use(e,t){return dn(e.getFullYear()%100,t,2)}function Wse(e,t){return e=bF(e),dn(e.getFullYear()%100,t,2)}function Hse(e,t){return dn(e.getFullYear()%1e4,t,4)}function Vse(e,t){var n=e.getDay();return e=n>=4||n===0?su(e):su.ceil(e),dn(e.getFullYear()%1e4,t,4)}function Kse(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+dn(t/60|0,"0",2)+dn(t%60,"0",2)}function jM(e,t){return dn(e.getUTCDate(),t,2)}function Gse(e,t){return dn(e.getUTCHours(),t,2)}function Yse(e,t){return dn(e.getUTCHours()%12||12,t,2)}function Xse(e,t){return dn(1+Nv.count(Lo(e),e),t,3)}function wF(e,t){return dn(e.getUTCMilliseconds(),t,3)}function Qse(e,t){return wF(e,t)+"000"}function Jse(e,t){return dn(e.getUTCMonth()+1,t,2)}function Zse(e,t){return dn(e.getUTCMinutes(),t,2)}function eoe(e,t){return dn(e.getUTCSeconds(),t,2)}function toe(e){var t=e.getUTCDay();return t===0?7:t}function noe(e,t){return dn(_v.count(Lo(e)-1,e),t,2)}function jF(e){var t=e.getUTCDay();return t>=4||t===0?ou(e):ou.ceil(e)}function roe(e,t){return e=jF(e),dn(ou.count(Lo(e),e)+(Lo(e).getUTCDay()===4),t,2)}function aoe(e){return e.getUTCDay()}function soe(e,t){return dn(Vm.count(Lo(e)-1,e),t,2)}function ooe(e,t){return dn(e.getUTCFullYear()%100,t,2)}function ioe(e,t){return e=jF(e),dn(e.getUTCFullYear()%100,t,2)}function loe(e,t){return dn(e.getUTCFullYear()%1e4,t,4)}function coe(e,t){var n=e.getUTCDay();return e=n>=4||n===0?ou(e):ou.ceil(e),dn(e.getUTCFullYear()%1e4,t,4)}function uoe(){return"+0000"}function SM(){return"%"}function NM(e){return+e}function CM(e){return Math.floor(+e/1e3)}var Nc,SF,NF;doe({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function doe(e){return Nc=dse(e),SF=Nc.format,Nc.parse,NF=Nc.utcFormat,Nc.utcParse,Nc}function foe(e){return new Date(e)}function poe(e){return e instanceof Date?+e:+new Date(+e)}function R_(e,t,n,r,s,o,i,c,d,f){var m=v_(),p=m.invert,v=m.domain,x=f(".%L"),j=f(":%S"),y=f("%I:%M"),b=f("%I %p"),S=f("%a %d"),N=f("%b %d"),C=f("%B"),k=f("%Y");function A(E){return(d(E)<E?x:c(E)<E?j:i(E)<E?y:o(E)<E?b:r(E)<E?s(E)<E?S:N:n(E)<E?C:k)(E)}return m.invert=function(E){return new Date(p(E))},m.domain=function(E){return arguments.length?v(Array.from(E,poe)):v().map(foe)},m.ticks=function(E){var P=v();return e(P[0],P[P.length-1],E??10)},m.tickFormat=function(E,P){return P==null?A:f(P)},m.nice=function(E){var P=v();return(!E||typeof E.range!="function")&&(E=t(P[0],P[P.length-1],E??10)),E?v(uF(P,E)):m},m.copy=function(){return gp(m,R_(e,t,n,r,s,o,i,c,d,f))},m}function hoe(){return os.apply(R_(cse,use,Do,E_,Cv,vp,k_,C_,fl,SF).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function moe(){return os.apply(R_(ise,lse,Lo,P_,_v,Nv,A_,__,fl,NF).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function kv(){var e=0,t=1,n,r,s,o,i=Ur,c=!1,d;function f(p){return p==null||isNaN(p=+p)?d:i(s===0?.5:(p=(o(p)-n)*s,c?Math.max(0,Math.min(1,p)):p))}f.domain=function(p){return arguments.length?([e,t]=p,n=o(e=+e),r=o(t=+t),s=n===r?0:1/(r-n),f):[e,t]},f.clamp=function(p){return arguments.length?(c=!!p,f):c},f.interpolator=function(p){return arguments.length?(i=p,f):i};function m(p){return function(v){var x,j;return arguments.length?([x,j]=v,i=p(x,j),f):[i(0),i(1)]}}return f.range=m(Fu),f.rangeRound=m(g_),f.unknown=function(p){return arguments.length?(d=p,f):d},function(p){return o=p,n=p(e),r=p(t),s=n===r?0:1/(r-n),f}}function Oi(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function CF(){var e=Ti(kv()(Ur));return e.copy=function(){return Oi(e,CF())},qo.apply(e,arguments)}function _F(){var e=b_(kv()).domain([1,10]);return e.copy=function(){return Oi(e,_F()).base(e.base())},qo.apply(e,arguments)}function kF(){var e=w_(kv());return e.copy=function(){return Oi(e,kF()).constant(e.constant())},qo.apply(e,arguments)}function T_(){var e=j_(kv());return e.copy=function(){return Oi(e,T_()).exponent(e.exponent())},qo.apply(e,arguments)}function goe(){return T_.apply(null,arguments).exponent(.5)}function AF(){var e=[],t=Ur;function n(r){if(r!=null&&!isNaN(r=+r))return t((hp(e,r,1)-1)/(e.length-1))}return n.domain=function(r){if(!arguments.length)return e.slice();e=[];for(let s of r)s!=null&&!isNaN(s=+s)&&e.push(s);return e.sort(yi),n},n.interpolator=function(r){return arguments.length?(t=r,n):t},n.range=function(){return e.map((r,s)=>t(s/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(s,o)=>nae(e,o/r))},n.copy=function(){return AF(t).domain(e)},qo.apply(n,arguments)}function Av(){var e=0,t=.5,n=1,r=1,s,o,i,c,d,f=Ur,m,p=!1,v;function x(y){return isNaN(y=+y)?v:(y=.5+((y=+m(y))-o)*(r*y<r*o?c:d),f(p?Math.max(0,Math.min(1,y)):y))}x.domain=function(y){return arguments.length?([e,t,n]=y,s=m(e=+e),o=m(t=+t),i=m(n=+n),c=s===o?0:.5/(o-s),d=o===i?0:.5/(i-o),r=o<s?-1:1,x):[e,t,n]},x.clamp=function(y){return arguments.length?(p=!!y,x):p},x.interpolator=function(y){return arguments.length?(f=y,x):f};function j(y){return function(b){var S,N,C;return arguments.length?([S,N,C]=b,f=Aae(y,[S,N,C]),x):[f(0),f(.5),f(1)]}}return x.range=j(Fu),x.rangeRound=j(g_),x.unknown=function(y){return arguments.length?(v=y,x):v},function(y){return m=y,s=y(e),o=y(t),i=y(n),c=s===o?0:.5/(o-s),d=o===i?0:.5/(i-o),r=o<s?-1:1,x}}function EF(){var e=Ti(Av()(Ur));return e.copy=function(){return Oi(e,EF())},qo.apply(e,arguments)}function PF(){var e=b_(Av()).domain([.1,1,10]);return e.copy=function(){return Oi(e,PF()).base(e.base())},qo.apply(e,arguments)}function RF(){var e=w_(Av());return e.copy=function(){return Oi(e,RF()).constant(e.constant())},qo.apply(e,arguments)}function O_(){var e=j_(Av());return e.copy=function(){return Oi(e,O_()).exponent(e.exponent())},qo.apply(e,arguments)}function voe(){return O_.apply(null,arguments).exponent(.5)}const _M=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:xf,scaleDiverging:EF,scaleDivergingLog:PF,scaleDivergingPow:O_,scaleDivergingSqrt:voe,scaleDivergingSymlog:RF,scaleIdentity:cF,scaleImplicit:I1,scaleLinear:Um,scaleLog:dF,scaleOrdinal:p_,scalePoint:Xd,scalePow:S_,scaleQuantile:hF,scaleQuantize:mF,scaleRadial:pF,scaleSequential:CF,scaleSequentialLog:_F,scaleSequentialPow:T_,scaleSequentialQuantile:AF,scaleSequentialSqrt:goe,scaleSequentialSymlog:kF,scaleSqrt:Qae,scaleSymlog:fF,scaleThreshold:gF,scaleTime:hoe,scaleUtc:moe,tickFormat:lF},Symbol.toStringTag,{value:"Module"}));var Mj,kM;function Ev(){if(kM)return Mj;kM=1;var e=Iu();function t(n,r,s){for(var o=-1,i=n.length;++o<i;){var c=n[o],d=r(c);if(d!=null&&(f===void 0?d===d&&!e(d):s(d,f)))var f=d,m=c}return m}return Mj=t,Mj}var Ij,AM;function TF(){if(AM)return Ij;AM=1;function e(t,n){return t>n}return Ij=e,Ij}var $j,EM;function xoe(){if(EM)return $j;EM=1;var e=Ev(),t=TF(),n=Lu();function r(s){return s&&s.length?e(s,n,t):void 0}return $j=r,$j}var yoe=xoe();const Pv=xn(yoe);var Dj,PM;function OF(){if(PM)return Dj;PM=1;function e(t,n){return t<n}return Dj=e,Dj}var Lj,RM;function boe(){if(RM)return Lj;RM=1;var e=Ev(),t=OF(),n=Lu();function r(s){return s&&s.length?e(s,n,t):void 0}return Lj=r,Lj}var woe=boe();const Rv=xn(woe);var Fj,TM;function joe(){if(TM)return Fj;TM=1;var e=YC(),t=Zs(),n=q4(),r=fa();function s(o,i){var c=r(o)?e:n;return c(o,t(i,3))}return Fj=s,Fj}var zj,OM;function Soe(){if(OM)return zj;OM=1;var e=z4(),t=joe();function n(r,s){return e(t(r,s),1)}return zj=n,zj}var Noe=Soe();const Coe=xn(Noe);var Bj,MM;function _oe(){if(MM)return Bj;MM=1;var e=l_();function t(n,r){return e(n,r)}return Bj=t,Bj}var koe=_oe();const xp=xn(koe);var zu=1e9,Aoe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},I_,zn=!0,Xa="[DecimalError] ",xl=Xa+"Invalid argument: ",M_=Xa+"Exponent out of range: ",Bu=Math.floor,il=Math.pow,Eoe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Sa,yr=1e7,Mn=7,MF=9007199254740991,Km=Bu(MF/Mn),mt={};mt.absoluteValue=mt.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};mt.comparedTo=mt.cmp=function(e){var t,n,r,s,o=this;if(e=new o.constructor(e),o.s!==e.s)return o.s||-e.s;if(o.e!==e.e)return o.e>e.e^o.s<0?1:-1;for(r=o.d.length,s=e.d.length,t=0,n=r<s?r:s;t<n;++t)if(o.d[t]!==e.d[t])return o.d[t]>e.d[t]^o.s<0?1:-1;return r===s?0:r>s^o.s<0?1:-1};mt.decimalPlaces=mt.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Mn;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};mt.dividedBy=mt.div=function(e){return No(this,new this.constructor(e))};mt.dividedToIntegerBy=mt.idiv=function(e){var t=this,n=t.constructor;return wn(No(t,new n(e),0,1),n.precision)};mt.equals=mt.eq=function(e){return!this.cmp(e)};mt.exponent=function(){return rr(this)};mt.greaterThan=mt.gt=function(e){return this.cmp(e)>0};mt.greaterThanOrEqualTo=mt.gte=function(e){return this.cmp(e)>=0};mt.isInteger=mt.isint=function(){return this.e>this.d.length-2};mt.isNegative=mt.isneg=function(){return this.s<0};mt.isPositive=mt.ispos=function(){return this.s>0};mt.isZero=function(){return this.s===0};mt.lessThan=mt.lt=function(e){return this.cmp(e)<0};mt.lessThanOrEqualTo=mt.lte=function(e){return this.cmp(e)<1};mt.logarithm=mt.log=function(e){var t,n=this,r=n.constructor,s=r.precision,o=s+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(Sa))throw Error(Xa+"NaN");if(n.s<1)throw Error(Xa+(n.s?"NaN":"-Infinity"));return n.eq(Sa)?new r(0):(zn=!1,t=No(Sf(n,o),Sf(e,o),o),zn=!0,wn(t,s))};mt.minus=mt.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?DF(t,e):IF(t,(e.s=-e.s,e))};mt.modulo=mt.mod=function(e){var t,n=this,r=n.constructor,s=r.precision;if(e=new r(e),!e.s)throw Error(Xa+"NaN");return n.s?(zn=!1,t=No(n,e,0,1).times(e),zn=!0,n.minus(t)):wn(new r(n),s)};mt.naturalExponential=mt.exp=function(){return $F(this)};mt.naturalLogarithm=mt.ln=function(){return Sf(this)};mt.negated=mt.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};mt.plus=mt.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?IF(t,e):DF(t,(e.s=-e.s,e))};mt.precision=mt.sd=function(e){var t,n,r,s=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(xl+e);if(t=rr(s)+1,r=s.d.length-1,n=r*Mn+1,r=s.d[r],r){for(;r%10==0;r/=10)n--;for(r=s.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};mt.squareRoot=mt.sqrt=function(){var e,t,n,r,s,o,i,c=this,d=c.constructor;if(c.s<1){if(!c.s)return new d(0);throw Error(Xa+"NaN")}for(e=rr(c),zn=!1,s=Math.sqrt(+c),s==0||s==1/0?(t=qs(c.d),(t.length+e)%2==0&&(t+="0"),s=Math.sqrt(t),e=Bu((e+1)/2)-(e<0||e%2),s==1/0?t="5e"+e:(t=s.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new d(t)):r=new d(s.toString()),n=d.precision,s=i=n+3;;)if(o=r,r=o.plus(No(c,o,i+2)).times(.5),qs(o.d).slice(0,i)===(t=qs(r.d)).slice(0,i)){if(t=t.slice(i-3,i+1),s==i&&t=="4999"){if(wn(o,n+1,0),o.times(o).eq(c)){r=o;break}}else if(t!="9999")break;i+=4}return zn=!0,wn(r,n)};mt.times=mt.mul=function(e){var t,n,r,s,o,i,c,d,f,m=this,p=m.constructor,v=m.d,x=(e=new p(e)).d;if(!m.s||!e.s)return new p(0);for(e.s*=m.s,n=m.e+e.e,d=v.length,f=x.length,d<f&&(o=v,v=x,x=o,i=d,d=f,f=i),o=[],i=d+f,r=i;r--;)o.push(0);for(r=f;--r>=0;){for(t=0,s=d+r;s>r;)c=o[s]+x[r]*v[s-r-1]+t,o[s--]=c%yr|0,t=c/yr|0;o[s]=(o[s]+t)%yr|0}for(;!o[--i];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,zn?wn(e,p.precision):e};mt.toDecimalPlaces=mt.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(Ys(e,0,zu),t===void 0?t=r.rounding:Ys(t,0,8),wn(n,e+rr(n)+1,t))};mt.toExponential=function(e,t){var n,r=this,s=r.constructor;return e===void 0?n=Al(r,!0):(Ys(e,0,zu),t===void 0?t=s.rounding:Ys(t,0,8),r=wn(new s(r),e+1,t),n=Al(r,!0,e+1)),n};mt.toFixed=function(e,t){var n,r,s=this,o=s.constructor;return e===void 0?Al(s):(Ys(e,0,zu),t===void 0?t=o.rounding:Ys(t,0,8),r=wn(new o(s),e+rr(s)+1,t),n=Al(r.abs(),!1,e+rr(r)+1),s.isneg()&&!s.isZero()?"-"+n:n)};mt.toInteger=mt.toint=function(){var e=this,t=e.constructor;return wn(new t(e),rr(e)+1,t.rounding)};mt.toNumber=function(){return+this};mt.toPower=mt.pow=function(e){var t,n,r,s,o,i,c=this,d=c.constructor,f=12,m=+(e=new d(e));if(!e.s)return new d(Sa);if(c=new d(c),!c.s){if(e.s<1)throw Error(Xa+"Infinity");return c}if(c.eq(Sa))return c;if(r=d.precision,e.eq(Sa))return wn(c,r);if(t=e.e,n=e.d.length-1,i=t>=n,o=c.s,i){if((n=m<0?-m:m)<=MF){for(s=new d(Sa),t=Math.ceil(r/Mn+4),zn=!1;n%2&&(s=s.times(c),$M(s.d,t)),n=Bu(n/2),n!==0;)c=c.times(c),$M(c.d,t);return zn=!0,e.s<0?new d(Sa).div(s):wn(s,r)}}else if(o<0)throw Error(Xa+"NaN");return o=o<0&&e.d[Math.max(t,n)]&1?-1:1,c.s=1,zn=!1,s=e.times(Sf(c,r+f)),zn=!0,s=$F(s),s.s=o,s};mt.toPrecision=function(e,t){var n,r,s=this,o=s.constructor;return e===void 0?(n=rr(s),r=Al(s,n<=o.toExpNeg||n>=o.toExpPos)):(Ys(e,1,zu),t===void 0?t=o.rounding:Ys(t,0,8),s=wn(new o(s),e,t),n=rr(s),r=Al(s,e<=n||n<=o.toExpNeg,e)),r};mt.toSignificantDigits=mt.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(Ys(e,1,zu),t===void 0?t=r.rounding:Ys(t,0,8)),wn(new r(n),e,t)};mt.toString=mt.valueOf=mt.val=mt.toJSON=mt[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=rr(e),n=e.constructor;return Al(e,t<=n.toExpNeg||t>=n.toExpPos)};function IF(e,t){var n,r,s,o,i,c,d,f,m=e.constructor,p=m.precision;if(!e.s||!t.s)return t.s||(t=new m(e)),zn?wn(t,p):t;if(d=e.d,f=t.d,i=e.e,s=t.e,d=d.slice(),o=i-s,o){for(o<0?(r=d,o=-o,c=f.length):(r=f,s=i,c=d.length),i=Math.ceil(p/Mn),c=i>c?i+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=d.length,o=f.length,c-o<0&&(o=c,r=f,f=d,d=r),n=0;o;)n=(d[--o]=d[o]+f[o]+n)/yr|0,d[o]%=yr;for(n&&(d.unshift(n),++s),c=d.length;d[--c]==0;)d.pop();return t.d=d,t.e=s,zn?wn(t,p):t}function Ys(e,t,n){if(e!==~~e||e<t||e>n)throw Error(xl+e)}function qs(e){var t,n,r,s=e.length-1,o="",i=e[0];if(s>0){for(o+=i,t=1;t<s;t++)r=e[t]+"",n=Mn-r.length,n&&(o+=gi(n)),o+=r;i=e[t],r=i+"",n=Mn-r.length,n&&(o+=gi(n))}else if(i===0)return"0";for(;i%10===0;)i/=10;return o+i}var No=(function(){function e(r,s){var o,i=0,c=r.length;for(r=r.slice();c--;)o=r[c]*s+i,r[c]=o%yr|0,i=o/yr|0;return i&&r.unshift(i),r}function t(r,s,o,i){var c,d;if(o!=i)d=o>i?1:-1;else for(c=d=0;c<o;c++)if(r[c]!=s[c]){d=r[c]>s[c]?1:-1;break}return d}function n(r,s,o){for(var i=0;o--;)r[o]-=i,i=r[o]<s[o]?1:0,r[o]=i*yr+r[o]-s[o];for(;!r[0]&&r.length>1;)r.shift()}return function(r,s,o,i){var c,d,f,m,p,v,x,j,y,b,S,N,C,k,A,E,P,O,D=r.constructor,K=r.s==s.s?1:-1,q=r.d,B=s.d;if(!r.s)return new D(r);if(!s.s)throw Error(Xa+"Division by zero");for(d=r.e-s.e,P=B.length,A=q.length,x=new D(K),j=x.d=[],f=0;B[f]==(q[f]||0);)++f;if(B[f]>(q[f]||0)&&--d,o==null?N=o=D.precision:i?N=o+(rr(r)-rr(s))+1:N=o,N<0)return new D(0);if(N=N/Mn+2|0,f=0,P==1)for(m=0,B=B[0],N++;(f<A||m)&&N--;f++)C=m*yr+(q[f]||0),j[f]=C/B|0,m=C%B|0;else{for(m=yr/(B[0]+1)|0,m>1&&(B=e(B,m),q=e(q,m),P=B.length,A=q.length),k=P,y=q.slice(0,P),b=y.length;b<P;)y[b++]=0;O=B.slice(),O.unshift(0),E=B[0],B[1]>=yr/2&&++E;do m=0,c=t(B,y,P,b),c<0?(S=y[0],P!=b&&(S=S*yr+(y[1]||0)),m=S/E|0,m>1?(m>=yr&&(m=yr-1),p=e(B,m),v=p.length,b=y.length,c=t(p,y,v,b),c==1&&(m--,n(p,P<v?O:B,v))):(m==0&&(c=m=1),p=B.slice()),v=p.length,v<b&&p.unshift(0),n(y,p,b),c==-1&&(b=y.length,c=t(B,y,P,b),c<1&&(m++,n(y,P<b?O:B,b))),b=y.length):c===0&&(m++,y=[0]),j[f++]=m,c&&y[0]?y[b++]=q[k]||0:(y=[q[k]],b=1);while((k++<A||y[0]!==void 0)&&N--)}return j[0]||j.shift(),x.e=d,wn(x,i?o+rr(x)+1:o)}})();function $F(e,t){var n,r,s,o,i,c,d=0,f=0,m=e.constructor,p=m.precision;if(rr(e)>16)throw Error(M_+rr(e));if(!e.s)return new m(Sa);for(zn=!1,c=p,i=new m(.03125);e.abs().gte(.1);)e=e.times(i),f+=5;for(r=Math.log(il(2,f))/Math.LN10*2+5|0,c+=r,n=s=o=new m(Sa),m.precision=c;;){if(s=wn(s.times(e),c),n=n.times(++d),i=o.plus(No(s,n,c)),qs(i.d).slice(0,c)===qs(o.d).slice(0,c)){for(;f--;)o=wn(o.times(o),c);return m.precision=p,t==null?(zn=!0,wn(o,p)):o}o=i}}function rr(e){for(var t=e.e*Mn,n=e.d[0];n>=10;n/=10)t++;return t}function qj(e,t,n){if(t>e.LN10.sd())throw zn=!0,n&&(e.precision=n),Error(Xa+"LN10 precision limit exceeded");return wn(new e(e.LN10),t)}function gi(e){for(var t="";e--;)t+="0";return t}function Sf(e,t){var n,r,s,o,i,c,d,f,m,p=1,v=10,x=e,j=x.d,y=x.constructor,b=y.precision;if(x.s<1)throw Error(Xa+(x.s?"NaN":"-Infinity"));if(x.eq(Sa))return new y(0);if(t==null?(zn=!1,f=b):f=t,x.eq(10))return t==null&&(zn=!0),qj(y,f);if(f+=v,y.precision=f,n=qs(j),r=n.charAt(0),o=rr(x),Math.abs(o)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)x=x.times(e),n=qs(x.d),r=n.charAt(0),p++;o=rr(x),r>1?(x=new y("0."+n),o++):x=new y(r+"."+n.slice(1))}else return d=qj(y,f+2,b).times(o+""),x=Sf(new y(r+"."+n.slice(1)),f-v).plus(d),y.precision=b,t==null?(zn=!0,wn(x,b)):x;for(c=i=x=No(x.minus(Sa),x.plus(Sa),f),m=wn(x.times(x),f),s=3;;){if(i=wn(i.times(m),f),d=c.plus(No(i,new y(s),f)),qs(d.d).slice(0,f)===qs(c.d).slice(0,f))return c=c.times(2),o!==0&&(c=c.plus(qj(y,f+2,b).times(o+""))),c=No(c,new y(p),f),y.precision=b,t==null?(zn=!0,wn(c,b)):c;c=d,s+=2}}function IM(e,t){var n,r,s;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(s=t.length;t.charCodeAt(s-1)===48;)--s;if(t=t.slice(r,s),t){if(s-=r,n=n-r-1,e.e=Bu(n/Mn),e.d=[],r=(n+1)%Mn,n<0&&(r+=Mn),r<s){for(r&&e.d.push(+t.slice(0,r)),s-=Mn;r<s;)e.d.push(+t.slice(r,r+=Mn));t=t.slice(r),r=Mn-t.length}else r-=s;for(;r--;)t+="0";if(e.d.push(+t),zn&&(e.e>Km||e.e<-Km))throw Error(M_+n)}else e.s=0,e.e=0,e.d=[0];return e}function wn(e,t,n){var r,s,o,i,c,d,f,m,p=e.d;for(i=1,o=p[0];o>=10;o/=10)i++;if(r=t-i,r<0)r+=Mn,s=t,f=p[m=0];else{if(m=Math.ceil((r+1)/Mn),o=p.length,m>=o)return e;for(f=o=p[m],i=1;o>=10;o/=10)i++;r%=Mn,s=r-Mn+i}if(n!==void 0&&(o=il(10,i-s-1),c=f/o%10|0,d=t<0||p[m+1]!==void 0||f%o,d=n<4?(c||d)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||d||n==6&&(r>0?s>0?f/il(10,i-s):0:p[m-1])%10&1||n==(e.s<0?8:7))),t<1||!p[0])return d?(o=rr(e),p.length=1,t=t-o-1,p[0]=il(10,(Mn-t%Mn)%Mn),e.e=Bu(-t/Mn)||0):(p.length=1,p[0]=e.e=e.s=0),e;if(r==0?(p.length=m,o=1,m--):(p.length=m+1,o=il(10,Mn-r),p[m]=s>0?(f/il(10,i-s)%il(10,s)|0)*o:0),d)for(;;)if(m==0){(p[0]+=o)==yr&&(p[0]=1,++e.e);break}else{if(p[m]+=o,p[m]!=yr)break;p[m--]=0,o=1}for(r=p.length;p[--r]===0;)p.pop();if(zn&&(e.e>Km||e.e<-Km))throw Error(M_+rr(e));return e}function DF(e,t){var n,r,s,o,i,c,d,f,m,p,v=e.constructor,x=v.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new v(e),zn?wn(t,x):t;if(d=e.d,p=t.d,r=t.e,f=e.e,d=d.slice(),i=f-r,i){for(m=i<0,m?(n=d,i=-i,c=p.length):(n=p,r=f,c=d.length),s=Math.max(Math.ceil(x/Mn),c)+2,i>s&&(i=s,n.length=1),n.reverse(),s=i;s--;)n.push(0);n.reverse()}else{for(s=d.length,c=p.length,m=s<c,m&&(c=s),s=0;s<c;s++)if(d[s]!=p[s]){m=d[s]<p[s];break}i=0}for(m&&(n=d,d=p,p=n,t.s=-t.s),c=d.length,s=p.length-c;s>0;--s)d[c++]=0;for(s=p.length;s>i;){if(d[--s]<p[s]){for(o=s;o&&d[--o]===0;)d[o]=yr-1;--d[o],d[s]+=yr}d[s]-=p[s]}for(;d[--c]===0;)d.pop();for(;d[0]===0;d.shift())--r;return d[0]?(t.d=d,t.e=r,zn?wn(t,x):t):new v(0)}function Al(e,t,n){var r,s=rr(e),o=qs(e.d),i=o.length;return t?(n&&(r=n-i)>0?o=o.charAt(0)+"."+o.slice(1)+gi(r):i>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(s<0?"e":"e+")+s):s<0?(o="0."+gi(-s-1)+o,n&&(r=n-i)>0&&(o+=gi(r))):s>=i?(o+=gi(s+1-i),n&&(r=n-s-1)>0&&(o=o+"."+gi(r))):((r=s+1)<i&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-i)>0&&(s+1===i&&(o+="."),o+=gi(r))),e.s<0?"-"+o:o}function $M(e,t){if(e.length>t)return e.length=t,!0}function LF(e){var t,n,r;function s(o){var i=this;if(!(i instanceof s))return new s(o);if(i.constructor=s,o instanceof s){i.s=o.s,i.e=o.e,i.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(xl+o);if(o>0)i.s=1;else if(o<0)o=-o,i.s=-1;else{i.s=0,i.e=0,i.d=[0];return}if(o===~~o&&o<1e7){i.e=0,i.d=[o];return}return IM(i,o.toString())}else if(typeof o!="string")throw Error(xl+o);if(o.charCodeAt(0)===45?(o=o.slice(1),i.s=-1):i.s=1,Eoe.test(o))IM(i,o);else throw Error(xl+o)}if(s.prototype=mt,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=LF,s.config=s.set=Poe,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return s.config(e),s}function Poe(e){if(!e||typeof e!="object")throw Error(Xa+"Object expected");var t,n,r,s=["precision",1,zu,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<s.length;t+=3)if((r=e[n=s[t]])!==void 0)if(Bu(r)===r&&r>=s[t+1]&&r<=s[t+2])this[n]=r;else throw Error(xl+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(xl+n+": "+r);return this}var I_=LF(Aoe);Sa=new I_(1);const bn=I_;function Roe(e){return Ioe(e)||Moe(e)||Ooe(e)||Toe()}function Toe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
71
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ooe(e,t){if(e){if(typeof e=="string")return F1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F1(e,t)}}function Moe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Ioe(e){if(Array.isArray(e))return F1(e)}function F1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var $oe=function(t){return t},FF={},zF=function(t){return t===FF},DM=function(t){return function n(){return arguments.length===0||arguments.length===1&&zF(arguments.length<=0?void 0:arguments[0])?n:t.apply(void 0,arguments)}},Doe=function e(t,n){return t===1?n:DM(function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];var i=s.filter(function(c){return c!==FF}).length;return i>=t?n.apply(void 0,s):e(t-i,DM(function(){for(var c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];var m=s.map(function(p){return zF(p)?d.shift():p});return n.apply(void 0,Roe(m).concat(d))}))})},Tv=function(t){return Doe(t.length,t)},z1=function(t,n){for(var r=[],s=t;s<n;++s)r[s-t]=s;return r},Loe=Tv(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(n){return t[n]}).map(e)}),Foe=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(!n.length)return $oe;var s=n.reverse(),o=s[0],i=s.slice(1);return function(){return i.reduce(function(c,d){return d(c)},o.apply(void 0,arguments))}},B1=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},BF=function(t){var n=null,r=null;return function(){for(var s=arguments.length,o=new Array(s),i=0;i<s;i++)o[i]=arguments[i];return n&&o.every(function(c,d){return c===n[d]})||(n=o,r=t.apply(void 0,o)),r}};function zoe(e){var t;return e===0?t=1:t=Math.floor(new bn(e).abs().log(10).toNumber())+1,t}function Boe(e,t,n){for(var r=new bn(e),s=0,o=[];r.lt(t)&&s<1e5;)o.push(r.toNumber()),r=r.add(n),s++;return o}var qoe=Tv(function(e,t,n){var r=+e,s=+t;return r+n*(s-r)}),Uoe=Tv(function(e,t,n){var r=t-+e;return r=r||1/0,(n-e)/r}),Woe=Tv(function(e,t,n){var r=t-+e;return r=r||1/0,Math.max(0,Math.min(1,(n-e)/r))});const Ov={rangeStep:Boe,getDigitCount:zoe,interpolateNumber:qoe,uninterpolateNumber:Uoe,uninterpolateTruncation:Woe};function q1(e){return Koe(e)||Voe(e)||qF(e)||Hoe()}function Hoe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
72
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Voe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Koe(e){if(Array.isArray(e))return U1(e)}function Nf(e,t){return Xoe(e)||Yoe(e,t)||qF(e,t)||Goe()}function Goe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
73
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qF(e,t){if(e){if(typeof e=="string")return U1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return U1(e,t)}}function U1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Yoe(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,s=!1,o=void 0;try{for(var i=e[Symbol.iterator](),c;!(r=(c=i.next()).done)&&(n.push(c.value),!(t&&n.length===t));r=!0);}catch(d){s=!0,o=d}finally{try{!r&&i.return!=null&&i.return()}finally{if(s)throw o}}return n}}function Xoe(e){if(Array.isArray(e))return e}function UF(e){var t=Nf(e,2),n=t[0],r=t[1],s=n,o=r;return n>r&&(s=r,o=n),[s,o]}function WF(e,t,n){if(e.lte(0))return new bn(0);var r=Ov.getDigitCount(e.toNumber()),s=new bn(10).pow(r),o=e.div(s),i=r!==1?.05:.1,c=new bn(Math.ceil(o.div(i).toNumber())).add(n).mul(i),d=c.mul(s);return t?d:new bn(Math.ceil(d))}function Qoe(e,t,n){var r=1,s=new bn(e);if(!s.isint()&&n){var o=Math.abs(e);o<1?(r=new bn(10).pow(Ov.getDigitCount(e)-1),s=new bn(Math.floor(s.div(r).toNumber())).mul(r)):o>1&&(s=new bn(Math.floor(e)))}else e===0?s=new bn(Math.floor((t-1)/2)):n||(s=new bn(Math.floor(e)));var i=Math.floor((t-1)/2),c=Foe(Loe(function(d){return s.add(new bn(d-i).mul(r)).toNumber()}),z1);return c(0,t)}function HF(e,t,n,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new bn(0),tickMin:new bn(0),tickMax:new bn(0)};var o=WF(new bn(t).sub(e).div(n-1),r,s),i;e<=0&&t>=0?i=new bn(0):(i=new bn(e).add(t).div(2),i=i.sub(new bn(i).mod(o)));var c=Math.ceil(i.sub(e).div(o).toNumber()),d=Math.ceil(new bn(t).sub(i).div(o).toNumber()),f=c+d+1;return f>n?HF(e,t,n,r,s+1):(f<n&&(d=t>0?d+(n-f):d,c=t>0?c:c+(n-f)),{step:o,tickMin:i.sub(new bn(c).mul(o)),tickMax:i.add(new bn(d).mul(o))})}function Joe(e){var t=Nf(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=Math.max(s,2),c=UF([n,r]),d=Nf(c,2),f=d[0],m=d[1];if(f===-1/0||m===1/0){var p=m===1/0?[f].concat(q1(z1(0,s-1).map(function(){return 1/0}))):[].concat(q1(z1(0,s-1).map(function(){return-1/0})),[m]);return n>r?B1(p):p}if(f===m)return Qoe(f,s,o);var v=HF(f,m,i,o),x=v.step,j=v.tickMin,y=v.tickMax,b=Ov.rangeStep(j,y.add(new bn(.1).mul(x)),x);return n>r?B1(b):b}function Zoe(e,t){var n=Nf(e,2),r=n[0],s=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=UF([r,s]),c=Nf(i,2),d=c[0],f=c[1];if(d===-1/0||f===1/0)return[r,s];if(d===f)return[d];var m=Math.max(t,2),p=WF(new bn(f).sub(d).div(m-1),o,0),v=[].concat(q1(Ov.rangeStep(new bn(d),new bn(f).sub(new bn(.99).mul(p)),p)),[f]);return r>s?B1(v):v}var eie=BF(Joe),tie=BF(Zoe),nie="Invariant failed";function El(e,t){throw new Error(nie)}var rie=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function iu(e){"@babel/helpers - typeof";return iu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},iu(e)}function Gm(){return Gm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gm.apply(this,arguments)}function aie(e,t){return lie(e)||iie(e,t)||oie(e,t)||sie()}function sie(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
74
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oie(e,t){if(e){if(typeof e=="string")return LM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return LM(e,t)}}function LM(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function iie(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,c=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);d=!0);}catch(m){f=!0,s=m}finally{try{if(!d&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw s}}return c}}function lie(e){if(Array.isArray(e))return e}function cie(e,t){if(e==null)return{};var n=uie(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function uie(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function die(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,GF(r.key),r)}}function pie(e,t,n){return t&&fie(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function hie(e,t,n){return t=Ym(t),mie(e,VF()?Reflect.construct(t,n||[],Ym(e).constructor):t.apply(e,n))}function mie(e,t){if(t&&(iu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gie(e)}function gie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function VF(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(VF=function(){return!!e})()}function Ym(e){return Ym=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ym(e)}function vie(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&W1(e,t)}function W1(e,t){return W1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},W1(e,t)}function KF(e,t,n){return t=GF(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GF(e){var t=xie(e,"string");return iu(t)=="symbol"?t:t+""}function xie(e,t){if(iu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(iu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var yp=(function(e){function t(){return die(this,t),hie(this,t,arguments)}return vie(t,e),pie(t,[{key:"render",value:function(){var r=this.props,s=r.offset,o=r.layout,i=r.width,c=r.dataKey,d=r.data,f=r.dataPointFormatter,m=r.xAxis,p=r.yAxis,v=cie(r,rie),x=Mt(v,!1);this.props.direction==="x"&&m.type!=="number"&&El();var j=d.map(function(y){var b=f(y,c),S=b.x,N=b.y,C=b.value,k=b.errorVal;if(!k)return null;var A=[],E,P;if(Array.isArray(k)){var O=aie(k,2);E=O[0],P=O[1]}else E=P=k;if(o==="vertical"){var D=m.scale,K=N+s,q=K+i,B=K-i,Y=D(C-E),z=D(C+P);A.push({x1:z,y1:q,x2:z,y2:B}),A.push({x1:Y,y1:K,x2:z,y2:K}),A.push({x1:Y,y1:q,x2:Y,y2:B})}else if(o==="horizontal"){var I=p.scale,T=S+s,V=T-i,H=T+i,M=I(C-E),X=I(C+P);A.push({x1:V,y1:X,x2:H,y2:X}),A.push({x1:T,y1:M,x2:T,y2:X}),A.push({x1:V,y1:M,x2:H,y2:M})}return Q.createElement(un,Gm({className:"recharts-errorBar",key:"bar-".concat(A.map(function($){return"".concat($.x1,"-").concat($.x2,"-").concat($.y1,"-").concat($.y2)}))},x),A.map(function($){return Q.createElement("line",Gm({},$,{key:"line-".concat($.x1,"-").concat($.x2,"-").concat($.y1,"-").concat($.y2)}))}))});return Q.createElement(un,{className:"recharts-errorBars"},j)}}])})(Q.Component);KF(yp,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});KF(yp,"displayName","ErrorBar");function Cf(e){"@babel/helpers - typeof";return Cf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cf(e)}function FM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function el(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?FM(Object(n),!0).forEach(function(r){yie(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FM(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yie(e,t,n){return t=bie(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bie(e){var t=wie(e,"string");return Cf(t)=="symbol"?t:t+""}function wie(e,t){if(Cf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Cf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var YF=function(t){var n=t.children,r=t.formattedGraphicalItems,s=t.legendWidth,o=t.legendContent,i=ba(n,gl);if(!i)return null;var c=gl.defaultProps,d=c!==void 0?el(el({},c),i.props):{},f;return i.props&&i.props.payload?f=i.props&&i.props.payload:o==="children"?f=(r||[]).reduce(function(m,p){var v=p.item,x=p.props,j=x.sectors||x.data||[];return m.concat(j.map(function(y){return{type:i.props.iconType||v.props.legendType,value:y.name,color:y.fill,payload:y}}))},[]):f=(r||[]).map(function(m){var p=m.item,v=p.type.defaultProps,x=v!==void 0?el(el({},v),p.props):{},j=x.dataKey,y=x.name,b=x.legendType,S=x.hide;return{inactive:S,dataKey:j,type:d.iconType||b||"square",color:$_(p),value:y||j,payload:x}}),el(el(el({},d),gl.getWithHeight(i,s)),{},{payload:f,item:i})};function _f(e){"@babel/helpers - typeof";return _f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_f(e)}function zM(e){return Cie(e)||Nie(e)||Sie(e)||jie()}function jie(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
75
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sie(e,t){if(e){if(typeof e=="string")return H1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return H1(e,t)}}function Nie(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Cie(e){if(Array.isArray(e))return H1(e)}function H1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function BM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Yn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?BM(Object(n),!0).forEach(function(r){Vc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BM(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Vc(e,t,n){return t=_ie(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _ie(e){var t=kie(e,"string");return _f(t)=="symbol"?t:t+""}function kie(e,t){if(_f(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(_f(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ur(e,t,n){return Gt(e)||Gt(t)?n:dr(t)?_a(e,t,n):Kt(t)?t(e):n}function Qd(e,t,n,r){var s=Coe(e,function(c){return ur(c,t)});if(n==="number"){var o=s.filter(function(c){return rt(c)||parseFloat(c)});return o.length?[Rv(o),Pv(o)]:[1/0,-1/0]}var i=r?s.filter(function(c){return!Gt(c)}):s;return i.map(function(c){return dr(c)||c instanceof Date?c:""})}var Aie=function(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,i=-1,c=(n=r?.length)!==null&&n!==void 0?n:0;if(c<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var d=o.range,f=0;f<c;f++){var m=f>0?s[f-1].coordinate:s[c-1].coordinate,p=s[f].coordinate,v=f>=c-1?s[0].coordinate:s[f+1].coordinate,x=void 0;if(Br(p-m)!==Br(v-p)){var j=[];if(Br(v-p)===Br(d[1]-d[0])){x=v;var y=p+d[1]-d[0];j[0]=Math.min(y,(y+m)/2),j[1]=Math.max(y,(y+m)/2)}else{x=m;var b=v+d[1]-d[0];j[0]=Math.min(p,(b+p)/2),j[1]=Math.max(p,(b+p)/2)}var S=[Math.min(p,(x+p)/2),Math.max(p,(x+p)/2)];if(t>S[0]&&t<=S[1]||t>=j[0]&&t<=j[1]){i=s[f].index;break}}else{var N=Math.min(m,v),C=Math.max(m,v);if(t>(N+p)/2&&t<=(C+p)/2){i=s[f].index;break}}}else for(var k=0;k<c;k++)if(k===0&&t<=(r[k].coordinate+r[k+1].coordinate)/2||k>0&&k<c-1&&t>(r[k].coordinate+r[k-1].coordinate)/2&&t<=(r[k].coordinate+r[k+1].coordinate)/2||k===c-1&&t>(r[k].coordinate+r[k-1].coordinate)/2){i=r[k].index;break}return i},$_=function(t){var n,r=t,s=r.type.displayName,o=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Yn(Yn({},t.type.defaultProps),t.props):t.props,i=o.stroke,c=o.fill,d;switch(s){case"Line":d=i;break;case"Area":case"Radar":d=i&&i!=="none"?i:c;break;default:d=c;break}return d},Eie=function(t){var n=t.barSize,r=t.totalSize,s=t.stackGroups,o=s===void 0?{}:s;if(!o)return{};for(var i={},c=Object.keys(o),d=0,f=c.length;d<f;d++)for(var m=o[c[d]].stackGroups,p=Object.keys(m),v=0,x=p.length;v<x;v++){var j=m[p[v]],y=j.items,b=j.cateAxisId,S=y.filter(function(P){return jo(P.type).indexOf("Bar")>=0});if(S&&S.length){var N=S[0].type.defaultProps,C=N!==void 0?Yn(Yn({},N),S[0].props):S[0].props,k=C.barSize,A=C[b];i[A]||(i[A]=[]);var E=Gt(k)?n:k;i[A].push({item:S[0],stackList:S.slice(1),barSize:Gt(E)?void 0:qr(E,r,0)})}}return i},Pie=function(t){var n=t.barGap,r=t.barCategoryGap,s=t.bandSize,o=t.sizeList,i=o===void 0?[]:o,c=t.maxBarSize,d=i.length;if(d<1)return null;var f=qr(n,s,0,!0),m,p=[];if(i[0].barSize===+i[0].barSize){var v=!1,x=s/d,j=i.reduce(function(k,A){return k+A.barSize||0},0);j+=(d-1)*f,j>=s&&(j-=(d-1)*f,f=0),j>=s&&x>0&&(v=!0,x*=.9,j=d*x);var y=(s-j)/2>>0,b={offset:y-f,size:0};m=i.reduce(function(k,A){var E={item:A.item,position:{offset:b.offset+b.size+f,size:v?x:A.barSize}},P=[].concat(zM(k),[E]);return b=P[P.length-1].position,A.stackList&&A.stackList.length&&A.stackList.forEach(function(O){P.push({item:O,position:b})}),P},p)}else{var S=qr(r,s,0,!0);s-2*S-(d-1)*f<=0&&(f=0);var N=(s-2*S-(d-1)*f)/d;N>1&&(N>>=0);var C=c===+c?Math.min(N,c):N;m=i.reduce(function(k,A,E){var P=[].concat(zM(k),[{item:A.item,position:{offset:S+(N+f)*E+(N-C)/2,size:C}}]);return A.stackList&&A.stackList.length&&A.stackList.forEach(function(O){P.push({item:O,position:P[P.length-1].position})}),P},p)}return m},Rie=function(t,n,r,s){var o=r.children,i=r.width,c=r.margin,d=i-(c.left||0)-(c.right||0),f=YF({children:o,legendWidth:d});if(f){var m=s||{},p=m.width,v=m.height,x=f.align,j=f.verticalAlign,y=f.layout;if((y==="vertical"||y==="horizontal"&&j==="middle")&&x!=="center"&&rt(t[x]))return Yn(Yn({},t),{},Vc({},x,t[x]+(p||0)));if((y==="horizontal"||y==="vertical"&&x==="center")&&j!=="middle"&&rt(t[j]))return Yn(Yn({},t),{},Vc({},j,t[j]+(v||0)))}return t},Tie=function(t,n,r){return Gt(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},XF=function(t,n,r,s,o){var i=n.props.children,c=ka(i,yp).filter(function(f){return Tie(s,o,f.props.direction)});if(c&&c.length){var d=c.map(function(f){return f.props.dataKey});return t.reduce(function(f,m){var p=ur(m,r);if(Gt(p))return f;var v=Array.isArray(p)?[Rv(p),Pv(p)]:[p,p],x=d.reduce(function(j,y){var b=ur(m,y,0),S=v[0]-Math.abs(Array.isArray(b)?b[0]:b),N=v[1]+Math.abs(Array.isArray(b)?b[1]:b);return[Math.min(S,j[0]),Math.max(N,j[1])]},[1/0,-1/0]);return[Math.min(x[0],f[0]),Math.max(x[1],f[1])]},[1/0,-1/0])}return null},Oie=function(t,n,r,s,o){var i=n.map(function(c){return XF(t,c,r,o,s)}).filter(function(c){return!Gt(c)});return i&&i.length?i.reduce(function(c,d){return[Math.min(c[0],d[0]),Math.max(c[1],d[1])]},[1/0,-1/0]):null},QF=function(t,n,r,s,o){var i=n.map(function(d){var f=d.props.dataKey;return r==="number"&&f&&XF(t,d,f,s)||Qd(t,f,r,o)});if(r==="number")return i.reduce(function(d,f){return[Math.min(d[0],f[0]),Math.max(d[1],f[1])]},[1/0,-1/0]);var c={};return i.reduce(function(d,f){for(var m=0,p=f.length;m<p;m++)c[f[m]]||(c[f[m]]=!0,d.push(f[m]));return d},[])},JF=function(t,n){return t==="horizontal"&&n==="xAxis"||t==="vertical"&&n==="yAxis"||t==="centric"&&n==="angleAxis"||t==="radial"&&n==="radiusAxis"},pl=function(t,n,r){if(!t)return null;var s=t.scale,o=t.duplicateDomain,i=t.type,c=t.range,d=t.realScaleType==="scaleBand"?s.bandwidth()/2:2,f=(n||r)&&i==="category"&&s.bandwidth?s.bandwidth()/d:0;if(f=t.axisType==="angleAxis"&&c?.length>=2?Br(c[0]-c[1])*2*f:f,n&&(t.ticks||t.niceTicks)){var m=(t.ticks||t.niceTicks).map(function(p){var v=o?o.indexOf(p):p;return{coordinate:s(v)+f,value:p,offset:f}});return m.filter(function(p){return!fp(p.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(p,v){return{coordinate:s(p)+f,value:p,index:v,offset:f}}):s.ticks&&!r?s.ticks(t.tickCount).map(function(p){return{coordinate:s(p)+f,value:p,offset:f}}):s.domain().map(function(p,v){return{coordinate:s(p)+f,value:o?o[p]:p,index:v,offset:f}})},Uj=new WeakMap,Kh=function(t,n){if(typeof n!="function")return t;Uj.has(t)||Uj.set(t,new WeakMap);var r=Uj.get(t);if(r.has(n))return r.get(n);var s=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,s),s},ZF=function(t,n,r){var s=t.scale,o=t.type,i=t.layout,c=t.axisType;if(s==="auto")return i==="radial"&&c==="radiusAxis"?{scale:xf(),realScaleType:"band"}:i==="radial"&&c==="angleAxis"?{scale:Um(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:Xd(),realScaleType:"point"}:o==="category"?{scale:xf(),realScaleType:"band"}:{scale:Um(),realScaleType:"linear"};if(Cl(s)){var d="scale".concat(mv(s));return{scale:(_M[d]||Xd)(),realScaleType:_M[d]?d:"point"}}return Kt(s)?{scale:s}:{scale:Xd(),realScaleType:"point"}},qM=1e-4,ez=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,s=t.range(),o=Math.min(s[0],s[1])-qM,i=Math.max(s[0],s[1])+qM,c=t(n[0]),d=t(n[r-1]);(c<o||c>i||d<o||d>i)&&t.domain([n[0],n[r-1]])}},Mie=function(t,n){if(!t)return null;for(var r=0,s=t.length;r<s;r++)if(t[r].item===n)return t[r].position;return null},Iie=function(t,n){if(!n||n.length!==2||!rt(n[0])||!rt(n[1]))return t;var r=Math.min(n[0],n[1]),s=Math.max(n[0],n[1]),o=[t[0],t[1]];return(!rt(t[0])||t[0]<r)&&(o[0]=r),(!rt(t[1])||t[1]>s)&&(o[1]=s),o[0]>s&&(o[0]=s),o[1]<r&&(o[1]=r),o},$ie=function(t){var n=t.length;if(!(n<=0))for(var r=0,s=t[0].length;r<s;++r)for(var o=0,i=0,c=0;c<n;++c){var d=fp(t[c][r][1])?t[c][r][0]:t[c][r][1];d>=0?(t[c][r][0]=o,t[c][r][1]=o+d,o=t[c][r][1]):(t[c][r][0]=i,t[c][r][1]=i+d,i=t[c][r][1])}},Die=function(t){var n=t.length;if(!(n<=0))for(var r=0,s=t[0].length;r<s;++r)for(var o=0,i=0;i<n;++i){var c=fp(t[i][r][1])?t[i][r][0]:t[i][r][1];c>=0?(t[i][r][0]=o,t[i][r][1]=o+c,o=t[i][r][1]):(t[i][r][0]=0,t[i][r][1]=0)}},Lie={sign:$ie,expand:Cee,none:Zc,silhouette:_ee,wiggle:kee,positive:Die},Fie=function(t,n,r){var s=n.map(function(c){return c.props.dataKey}),o=Lie[r],i=Nee().keys(s).value(function(c,d){return+ur(c,d,0)}).order(w1).offset(o);return i(t)},zie=function(t,n,r,s,o,i){if(!t)return null;var c=i?n.reverse():n,d={},f=c.reduce(function(p,v){var x,j=(x=v.type)!==null&&x!==void 0&&x.defaultProps?Yn(Yn({},v.type.defaultProps),v.props):v.props,y=j.stackId,b=j.hide;if(b)return p;var S=j[r],N=p[S]||{hasStack:!1,stackGroups:{}};if(dr(y)){var C=N.stackGroups[y]||{numericAxisId:r,cateAxisId:s,items:[]};C.items.push(v),N.hasStack=!0,N.stackGroups[y]=C}else N.stackGroups[Du("_stackId_")]={numericAxisId:r,cateAxisId:s,items:[v]};return Yn(Yn({},p),{},Vc({},S,N))},d),m={};return Object.keys(f).reduce(function(p,v){var x=f[v];if(x.hasStack){var j={};x.stackGroups=Object.keys(x.stackGroups).reduce(function(y,b){var S=x.stackGroups[b];return Yn(Yn({},y),{},Vc({},b,{numericAxisId:r,cateAxisId:s,items:S.items,stackedData:Fie(t,S.items,o)}))},j)}return Yn(Yn({},p),{},Vc({},v,x))},m)},tz=function(t,n){var r=n.realScaleType,s=n.type,o=n.tickCount,i=n.originalDomain,c=n.allowDecimals,d=r||n.scale;if(d!=="auto"&&d!=="linear")return null;if(o&&s==="number"&&i&&(i[0]==="auto"||i[1]==="auto")){var f=t.domain();if(!f.length)return null;var m=eie(f,o,c);return t.domain([Rv(m),Pv(m)]),{niceTicks:m}}if(o&&s==="number"){var p=t.domain(),v=tie(p,o,c);return{niceTicks:v}}return null};function UM(e){var t=e.axis,n=e.ticks,r=e.bandSize,s=e.entry,o=e.index,i=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Gt(s[t.dataKey])){var c=Nm(n,"value",s[t.dataKey]);if(c)return c.coordinate+r/2}return n[o]?n[o].coordinate+r/2:null}var d=ur(s,Gt(i)?t.dataKey:i);return Gt(d)?null:t.scale(d)}var WM=function(t){var n=t.axis,r=t.ticks,s=t.offset,o=t.bandSize,i=t.entry,c=t.index;if(n.type==="category")return r[c]?r[c].coordinate+s:null;var d=ur(i,n.dataKey,n.domain[c]);return Gt(d)?null:n.scale(d)-o/2+s},Bie=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var s=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]);return s<=0&&o>=0?0:o<0?o:s}return r[0]},qie=function(t,n){var r,s=(r=t.type)!==null&&r!==void 0&&r.defaultProps?Yn(Yn({},t.type.defaultProps),t.props):t.props,o=s.stackId;if(dr(o)){var i=n[o];if(i){var c=i.items.indexOf(t);return c>=0?i.stackedData[c]:null}}return null},Uie=function(t){return t.reduce(function(n,r){return[Rv(r.concat([n[0]]).filter(rt)),Pv(r.concat([n[1]]).filter(rt))]},[1/0,-1/0])},nz=function(t,n,r){return Object.keys(t).reduce(function(s,o){var i=t[o],c=i.stackedData,d=c.reduce(function(f,m){var p=Uie(m.slice(n,r+1));return[Math.min(f[0],p[0]),Math.max(f[1],p[1])]},[1/0,-1/0]);return[Math.min(d[0],s[0]),Math.max(d[1],s[1])]},[1/0,-1/0]).map(function(s){return s===1/0||s===-1/0?0:s})},HM=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,VM=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,V1=function(t,n,r){if(Kt(t))return t(n,r);if(!Array.isArray(t))return n;var s=[];if(rt(t[0]))s[0]=r?t[0]:Math.min(t[0],n[0]);else if(HM.test(t[0])){var o=+HM.exec(t[0])[1];s[0]=n[0]-o}else Kt(t[0])?s[0]=t[0](n[0]):s[0]=n[0];if(rt(t[1]))s[1]=r?t[1]:Math.max(t[1],n[1]);else if(VM.test(t[1])){var i=+VM.exec(t[1])[1];s[1]=n[1]+i}else Kt(t[1])?s[1]=t[1](n[1]):s[1]=n[1];return s},Xm=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var s=t.scale.bandwidth();if(!r||s>0)return s}if(t&&n&&n.length>=2){for(var o=u_(n,function(p){return p.coordinate}),i=1/0,c=1,d=o.length;c<d;c++){var f=o[c],m=o[c-1];i=Math.min((f.coordinate||0)-(m.coordinate||0),i)}return i===1/0?0:i}return r?void 0:0},KM=function(t,n,r){return!t||!t.length||xp(t,_a(r,"type.defaultProps.domain"))?n:t},rz=function(t,n){var r=t.type.defaultProps?Yn(Yn({},t.type.defaultProps),t.props):t.props,s=r.dataKey,o=r.name,i=r.unit,c=r.formatter,d=r.tooltipType,f=r.chartType,m=r.hide;return Yn(Yn({},Mt(t,!1)),{},{dataKey:s,unit:i,formatter:c,name:o||s,color:$_(t),value:ur(n,s),type:d,payload:n,chartType:f,hide:m})};function kf(e){"@babel/helpers - typeof";return kf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kf(e)}function GM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function mo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?GM(Object(n),!0).forEach(function(r){az(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GM(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function az(e,t,n){return t=Wie(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wie(e){var t=Hie(e,"string");return kf(t)=="symbol"?t:t+""}function Hie(e,t){if(kf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(kf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vie(e,t){return Xie(e)||Yie(e,t)||Gie(e,t)||Kie()}function Kie(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
76
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gie(e,t){if(e){if(typeof e=="string")return YM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return YM(e,t)}}function YM(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Yie(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,c=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);d=!0);}catch(m){f=!0,s=m}finally{try{if(!d&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw s}}return c}}function Xie(e){if(Array.isArray(e))return e}var Qm=Math.PI/180,Qie=function(t){return t*180/Math.PI},Pn=function(t,n,r,s){return{x:t+Math.cos(-Qm*s)*r,y:n+Math.sin(-Qm*s)*r}},sz=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},Jie=function(t,n,r,s,o){var i=t.width,c=t.height,d=t.startAngle,f=t.endAngle,m=qr(t.cx,i,i/2),p=qr(t.cy,c,c/2),v=sz(i,c,r),x=qr(t.innerRadius,v,0),j=qr(t.outerRadius,v,v*.8),y=Object.keys(n);return y.reduce(function(b,S){var N=n[S],C=N.domain,k=N.reversed,A;if(Gt(N.range))s==="angleAxis"?A=[d,f]:s==="radiusAxis"&&(A=[x,j]),k&&(A=[A[1],A[0]]);else{A=N.range;var E=A,P=Vie(E,2);d=P[0],f=P[1]}var O=ZF(N,o),D=O.realScaleType,K=O.scale;K.domain(C).range(A),ez(K);var q=tz(K,mo(mo({},N),{},{realScaleType:D})),B=mo(mo(mo({},N),q),{},{range:A,radius:j,realScaleType:D,scale:K,cx:m,cy:p,innerRadius:x,outerRadius:j,startAngle:d,endAngle:f});return mo(mo({},b),{},az({},S,B))},{})},Zie=function(t,n){var r=t.x,s=t.y,o=n.x,i=n.y;return Math.sqrt(Math.pow(r-o,2)+Math.pow(s-i,2))},ele=function(t,n){var r=t.x,s=t.y,o=n.cx,i=n.cy,c=Zie({x:r,y:s},{x:o,y:i});if(c<=0)return{radius:c};var d=(r-o)/c,f=Math.acos(d);return s>i&&(f=2*Math.PI-f),{radius:c,angle:Qie(f),angleInRadian:f}},tle=function(t){var n=t.startAngle,r=t.endAngle,s=Math.floor(n/360),o=Math.floor(r/360),i=Math.min(s,o);return{startAngle:n-i*360,endAngle:r-i*360}},nle=function(t,n){var r=n.startAngle,s=n.endAngle,o=Math.floor(r/360),i=Math.floor(s/360),c=Math.min(o,i);return t+c*360},XM=function(t,n){var r=t.x,s=t.y,o=ele({x:r,y:s},n),i=o.radius,c=o.angle,d=n.innerRadius,f=n.outerRadius;if(i<d||i>f)return!1;if(i===0)return!0;var m=tle(n),p=m.startAngle,v=m.endAngle,x=c,j;if(p<=v){for(;x>v;)x-=360;for(;x<p;)x+=360;j=x>=p&&x<=v}else{for(;x>p;)x-=360;for(;x<v;)x+=360;j=x>=v&&x<=p}return j?mo(mo({},n),{},{radius:i,angle:nle(x,n)}):null},oz=function(t){return!h.isValidElement(t)&&!Kt(t)&&typeof t!="boolean"?t.className:""};function Af(e){"@babel/helpers - typeof";return Af=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Af(e)}var rle=["offset"];function ale(e){return lle(e)||ile(e)||ole(e)||sle()}function sle(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
77
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ole(e,t){if(e){if(typeof e=="string")return K1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return K1(e,t)}}function ile(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function lle(e){if(Array.isArray(e))return K1(e)}function K1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function cle(e,t){if(e==null)return{};var n=ule(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ule(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function QM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function cr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?QM(Object(n),!0).forEach(function(r){dle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QM(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function dle(e,t,n){return t=fle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fle(e){var t=ple(e,"string");return Af(t)=="symbol"?t:t+""}function ple(e,t){if(Af(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Af(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ef(){return Ef=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ef.apply(this,arguments)}var hle=function(t){var n=t.value,r=t.formatter,s=Gt(t.children)?n:t.children;return Kt(r)?r(s):s},mle=function(t,n){var r=Br(n-t),s=Math.min(Math.abs(n-t),360);return r*s},gle=function(t,n,r){var s=t.position,o=t.viewBox,i=t.offset,c=t.className,d=o,f=d.cx,m=d.cy,p=d.innerRadius,v=d.outerRadius,x=d.startAngle,j=d.endAngle,y=d.clockWise,b=(p+v)/2,S=mle(x,j),N=S>=0?1:-1,C,k;s==="insideStart"?(C=x+N*i,k=y):s==="insideEnd"?(C=j-N*i,k=!y):s==="end"&&(C=j+N*i,k=y),k=S<=0?k:!k;var A=Pn(f,m,b,C),E=Pn(f,m,b,C+(k?1:-1)*359),P="M".concat(A.x,",").concat(A.y,`
78
+ A`).concat(b,",").concat(b,",0,1,").concat(k?0:1,`,
79
+ `).concat(E.x,",").concat(E.y),O=Gt(t.id)?Du("recharts-radial-line-"):t.id;return Q.createElement("text",Ef({},r,{dominantBaseline:"central",className:Yt("recharts-radial-bar-label",c)}),Q.createElement("defs",null,Q.createElement("path",{id:O,d:P})),Q.createElement("textPath",{xlinkHref:"#".concat(O)},n))},vle=function(t){var n=t.viewBox,r=t.offset,s=t.position,o=n,i=o.cx,c=o.cy,d=o.innerRadius,f=o.outerRadius,m=o.startAngle,p=o.endAngle,v=(m+p)/2;if(s==="outside"){var x=Pn(i,c,f+r,v),j=x.x,y=x.y;return{x:j,y,textAnchor:j>=i?"start":"end",verticalAnchor:"middle"}}if(s==="center")return{x:i,y:c,textAnchor:"middle",verticalAnchor:"middle"};if(s==="centerTop")return{x:i,y:c,textAnchor:"middle",verticalAnchor:"start"};if(s==="centerBottom")return{x:i,y:c,textAnchor:"middle",verticalAnchor:"end"};var b=(d+f)/2,S=Pn(i,c,b,v),N=S.x,C=S.y;return{x:N,y:C,textAnchor:"middle",verticalAnchor:"middle"}},xle=function(t){var n=t.viewBox,r=t.parentViewBox,s=t.offset,o=t.position,i=n,c=i.x,d=i.y,f=i.width,m=i.height,p=m>=0?1:-1,v=p*s,x=p>0?"end":"start",j=p>0?"start":"end",y=f>=0?1:-1,b=y*s,S=y>0?"end":"start",N=y>0?"start":"end";if(o==="top"){var C={x:c+f/2,y:d-p*s,textAnchor:"middle",verticalAnchor:x};return cr(cr({},C),r?{height:Math.max(d-r.y,0),width:f}:{})}if(o==="bottom"){var k={x:c+f/2,y:d+m+v,textAnchor:"middle",verticalAnchor:j};return cr(cr({},k),r?{height:Math.max(r.y+r.height-(d+m),0),width:f}:{})}if(o==="left"){var A={x:c-b,y:d+m/2,textAnchor:S,verticalAnchor:"middle"};return cr(cr({},A),r?{width:Math.max(A.x-r.x,0),height:m}:{})}if(o==="right"){var E={x:c+f+b,y:d+m/2,textAnchor:N,verticalAnchor:"middle"};return cr(cr({},E),r?{width:Math.max(r.x+r.width-E.x,0),height:m}:{})}var P=r?{width:f,height:m}:{};return o==="insideLeft"?cr({x:c+b,y:d+m/2,textAnchor:N,verticalAnchor:"middle"},P):o==="insideRight"?cr({x:c+f-b,y:d+m/2,textAnchor:S,verticalAnchor:"middle"},P):o==="insideTop"?cr({x:c+f/2,y:d+v,textAnchor:"middle",verticalAnchor:j},P):o==="insideBottom"?cr({x:c+f/2,y:d+m-v,textAnchor:"middle",verticalAnchor:x},P):o==="insideTopLeft"?cr({x:c+b,y:d+v,textAnchor:N,verticalAnchor:j},P):o==="insideTopRight"?cr({x:c+f-b,y:d+v,textAnchor:S,verticalAnchor:j},P):o==="insideBottomLeft"?cr({x:c+b,y:d+m-v,textAnchor:N,verticalAnchor:x},P):o==="insideBottomRight"?cr({x:c+f-b,y:d+m-v,textAnchor:S,verticalAnchor:x},P):$u(o)&&(rt(o.x)||ul(o.x))&&(rt(o.y)||ul(o.y))?cr({x:c+qr(o.x,f),y:d+qr(o.y,m),textAnchor:"end",verticalAnchor:"end"},P):cr({x:c+f/2,y:d+m/2,textAnchor:"middle",verticalAnchor:"middle"},P)},yle=function(t){return"cx"in t&&rt(t.cx)};function br(e){var t=e.offset,n=t===void 0?5:t,r=cle(e,rle),s=cr({offset:n},r),o=s.viewBox,i=s.position,c=s.value,d=s.children,f=s.content,m=s.className,p=m===void 0?"":m,v=s.textBreakAll;if(!o||Gt(c)&&Gt(d)&&!h.isValidElement(f)&&!Kt(f))return null;if(h.isValidElement(f))return h.cloneElement(f,s);var x;if(Kt(f)){if(x=h.createElement(f,s),h.isValidElement(x))return x}else x=hle(s);var j=yle(o),y=Mt(s,!0);if(j&&(i==="insideStart"||i==="insideEnd"||i==="end"))return gle(s,x,y);var b=j?vle(s):xle(s);return Q.createElement(kl,Ef({className:Yt("recharts-label",p)},y,b,{breakAll:v}),x)}br.displayName="Label";var iz=function(t){var n=t.cx,r=t.cy,s=t.angle,o=t.startAngle,i=t.endAngle,c=t.r,d=t.radius,f=t.innerRadius,m=t.outerRadius,p=t.x,v=t.y,x=t.top,j=t.left,y=t.width,b=t.height,S=t.clockWise,N=t.labelViewBox;if(N)return N;if(rt(y)&&rt(b)){if(rt(p)&&rt(v))return{x:p,y:v,width:y,height:b};if(rt(x)&&rt(j))return{x,y:j,width:y,height:b}}return rt(p)&&rt(v)?{x:p,y:v,width:0,height:0}:rt(n)&&rt(r)?{cx:n,cy:r,startAngle:o||s||0,endAngle:i||s||0,innerRadius:f||0,outerRadius:m||d||c||0,clockWise:S}:t.viewBox?t.viewBox:{}},ble=function(t,n){return t?t===!0?Q.createElement(br,{key:"label-implicit",viewBox:n}):dr(t)?Q.createElement(br,{key:"label-implicit",viewBox:n,value:t}):h.isValidElement(t)?t.type===br?h.cloneElement(t,{key:"label-implicit",viewBox:n}):Q.createElement(br,{key:"label-implicit",content:t,viewBox:n}):Kt(t)?Q.createElement(br,{key:"label-implicit",content:t,viewBox:n}):$u(t)?Q.createElement(br,Ef({viewBox:n},t,{key:"label-implicit"})):null:null},wle=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var s=t.children,o=iz(t),i=ka(s,br).map(function(d,f){return h.cloneElement(d,{viewBox:n||o,key:"label-".concat(f)})});if(!r)return i;var c=ble(t.label,n||o);return[c].concat(ale(i))};br.parseViewBox=iz;br.renderCallByParent=wle;var Wj,JM;function jle(){if(JM)return Wj;JM=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Wj=e,Wj}var Sle=jle();const Nle=xn(Sle);function Pf(e){"@babel/helpers - typeof";return Pf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pf(e)}var Cle=["valueAccessor"],_le=["data","dataKey","clockWise","id","textBreakAll"];function kle(e){return Rle(e)||Ple(e)||Ele(e)||Ale()}function Ale(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
80
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ele(e,t){if(e){if(typeof e=="string")return G1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G1(e,t)}}function Ple(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Rle(e){if(Array.isArray(e))return G1(e)}function G1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Jm(){return Jm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jm.apply(this,arguments)}function ZM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function eI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ZM(Object(n),!0).forEach(function(r){Tle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZM(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Tle(e,t,n){return t=Ole(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ole(e){var t=Mle(e,"string");return Pf(t)=="symbol"?t:t+""}function Mle(e,t){if(Pf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Pf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tI(e,t){if(e==null)return{};var n=Ile(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ile(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var $le=function(t){return Array.isArray(t.value)?Nle(t.value):t.value};function Co(e){var t=e.valueAccessor,n=t===void 0?$le:t,r=tI(e,Cle),s=r.data,o=r.dataKey,i=r.clockWise,c=r.id,d=r.textBreakAll,f=tI(r,_le);return!s||!s.length?null:Q.createElement(un,{className:"recharts-label-list"},s.map(function(m,p){var v=Gt(o)?n(m,p):ur(m&&m.payload,o),x=Gt(c)?{}:{id:"".concat(c,"-").concat(p)};return Q.createElement(br,Jm({},Mt(m,!0),f,x,{parentViewBox:m.parentViewBox,value:v,textBreakAll:d,viewBox:br.parseViewBox(Gt(i)?m:eI(eI({},m),{},{clockWise:i})),key:"label-".concat(p),index:p}))}))}Co.displayName="LabelList";function Dle(e,t){return e?e===!0?Q.createElement(Co,{key:"labelList-implicit",data:t}):Q.isValidElement(e)||Kt(e)?Q.createElement(Co,{key:"labelList-implicit",data:t,content:e}):$u(e)?Q.createElement(Co,Jm({data:t},e,{key:"labelList-implicit"})):null:null}function Lle(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,s=ka(r,Co).map(function(i,c){return h.cloneElement(i,{data:t,key:"labelList-".concat(c)})});if(!n)return s;var o=Dle(e.label,t);return[o].concat(kle(s))}Co.renderCallByParent=Lle;function Rf(e){"@babel/helpers - typeof";return Rf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rf(e)}function Y1(){return Y1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Y1.apply(this,arguments)}function nI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function rI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nI(Object(n),!0).forEach(function(r){Fle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Fle(e,t,n){return t=zle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zle(e){var t=Ble(e,"string");return Rf(t)=="symbol"?t:t+""}function Ble(e,t){if(Rf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Rf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var qle=function(t,n){var r=Br(n-t),s=Math.min(Math.abs(n-t),359.999);return r*s},Gh=function(t){var n=t.cx,r=t.cy,s=t.radius,o=t.angle,i=t.sign,c=t.isExternal,d=t.cornerRadius,f=t.cornerIsExternal,m=d*(c?1:-1)+s,p=Math.asin(d/m)/Qm,v=f?o:o+i*p,x=Pn(n,r,m,v),j=Pn(n,r,s,v),y=f?o-i*p:o,b=Pn(n,r,m*Math.cos(p*Qm),y);return{center:x,circleTangency:j,lineTangency:b,theta:p}},lz=function(t){var n=t.cx,r=t.cy,s=t.innerRadius,o=t.outerRadius,i=t.startAngle,c=t.endAngle,d=qle(i,c),f=i+d,m=Pn(n,r,o,i),p=Pn(n,r,o,f),v="M ".concat(m.x,",").concat(m.y,`
81
+ A `).concat(o,",").concat(o,`,0,
82
+ `).concat(+(Math.abs(d)>180),",").concat(+(i>f),`,
83
+ `).concat(p.x,",").concat(p.y,`
84
+ `);if(s>0){var x=Pn(n,r,s,i),j=Pn(n,r,s,f);v+="L ".concat(j.x,",").concat(j.y,`
85
+ A `).concat(s,",").concat(s,`,0,
86
+ `).concat(+(Math.abs(d)>180),",").concat(+(i<=f),`,
87
+ `).concat(x.x,",").concat(x.y," Z")}else v+="L ".concat(n,",").concat(r," Z");return v},Ule=function(t){var n=t.cx,r=t.cy,s=t.innerRadius,o=t.outerRadius,i=t.cornerRadius,c=t.forceCornerRadius,d=t.cornerIsExternal,f=t.startAngle,m=t.endAngle,p=Br(m-f),v=Gh({cx:n,cy:r,radius:o,angle:f,sign:p,cornerRadius:i,cornerIsExternal:d}),x=v.circleTangency,j=v.lineTangency,y=v.theta,b=Gh({cx:n,cy:r,radius:o,angle:m,sign:-p,cornerRadius:i,cornerIsExternal:d}),S=b.circleTangency,N=b.lineTangency,C=b.theta,k=d?Math.abs(f-m):Math.abs(f-m)-y-C;if(k<0)return c?"M ".concat(j.x,",").concat(j.y,`
88
+ a`).concat(i,",").concat(i,",0,0,1,").concat(i*2,`,0
89
+ a`).concat(i,",").concat(i,",0,0,1,").concat(-i*2,`,0
90
+ `):lz({cx:n,cy:r,innerRadius:s,outerRadius:o,startAngle:f,endAngle:m});var A="M ".concat(j.x,",").concat(j.y,`
91
+ A`).concat(i,",").concat(i,",0,0,").concat(+(p<0),",").concat(x.x,",").concat(x.y,`
92
+ A`).concat(o,",").concat(o,",0,").concat(+(k>180),",").concat(+(p<0),",").concat(S.x,",").concat(S.y,`
93
+ A`).concat(i,",").concat(i,",0,0,").concat(+(p<0),",").concat(N.x,",").concat(N.y,`
94
+ `);if(s>0){var E=Gh({cx:n,cy:r,radius:s,angle:f,sign:p,isExternal:!0,cornerRadius:i,cornerIsExternal:d}),P=E.circleTangency,O=E.lineTangency,D=E.theta,K=Gh({cx:n,cy:r,radius:s,angle:m,sign:-p,isExternal:!0,cornerRadius:i,cornerIsExternal:d}),q=K.circleTangency,B=K.lineTangency,Y=K.theta,z=d?Math.abs(f-m):Math.abs(f-m)-D-Y;if(z<0&&i===0)return"".concat(A,"L").concat(n,",").concat(r,"Z");A+="L".concat(B.x,",").concat(B.y,`
95
+ A`).concat(i,",").concat(i,",0,0,").concat(+(p<0),",").concat(q.x,",").concat(q.y,`
96
+ A`).concat(s,",").concat(s,",0,").concat(+(z>180),",").concat(+(p>0),",").concat(P.x,",").concat(P.y,`
97
+ A`).concat(i,",").concat(i,",0,0,").concat(+(p<0),",").concat(O.x,",").concat(O.y,"Z")}else A+="L".concat(n,",").concat(r,"Z");return A},Wle={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},cz=function(t){var n=rI(rI({},Wle),t),r=n.cx,s=n.cy,o=n.innerRadius,i=n.outerRadius,c=n.cornerRadius,d=n.forceCornerRadius,f=n.cornerIsExternal,m=n.startAngle,p=n.endAngle,v=n.className;if(i<o||m===p)return null;var x=Yt("recharts-sector",v),j=i-o,y=qr(c,j,0,!0),b;return y>0&&Math.abs(m-p)<360?b=Ule({cx:r,cy:s,innerRadius:o,outerRadius:i,cornerRadius:Math.min(y,j/2),forceCornerRadius:d,cornerIsExternal:f,startAngle:m,endAngle:p}):b=lz({cx:r,cy:s,innerRadius:o,outerRadius:i,startAngle:m,endAngle:p}),Q.createElement("path",Y1({},Mt(n,!0),{className:x,d:b,role:"img"}))};function Tf(e){"@babel/helpers - typeof";return Tf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tf(e)}function X1(){return X1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},X1.apply(this,arguments)}function aI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function sI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?aI(Object(n),!0).forEach(function(r){Hle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Hle(e,t,n){return t=Vle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vle(e){var t=Kle(e,"string");return Tf(t)=="symbol"?t:t+""}function Kle(e,t){if(Tf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Tf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var oI={curveBasisClosed:pee,curveBasisOpen:hee,curveBasis:fee,curveBumpX:JZ,curveBumpY:ZZ,curveLinearClosed:mee,curveLinear:vv,curveMonotoneX:gee,curveMonotoneY:vee,curveNatural:xee,curveStep:yee,curveStepAfter:wee,curveStepBefore:bee},Yh=function(t){return t.x===+t.x&&t.y===+t.y},Md=function(t){return t.x},Id=function(t){return t.y},Gle=function(t,n){if(Kt(t))return t;var r="curve".concat(mv(t));return(r==="curveMonotone"||r==="curveBump")&&n?oI["".concat(r).concat(n==="vertical"?"Y":"X")]:oI[r]||vv},Yle=function(t){var n=t.type,r=n===void 0?"linear":n,s=t.points,o=s===void 0?[]:s,i=t.baseLine,c=t.layout,d=t.connectNulls,f=d===void 0?!1:d,m=Gle(r,c),p=f?o.filter(function(y){return Yh(y)}):o,v;if(Array.isArray(i)){var x=f?i.filter(function(y){return Yh(y)}):i,j=p.map(function(y,b){return sI(sI({},y),{},{base:x[b]})});return c==="vertical"?v=zh().y(Id).x1(Md).x0(function(y){return y.base.x}):v=zh().x(Md).y1(Id).y0(function(y){return y.base.y}),v.defined(Yh).curve(m),v(j)}return c==="vertical"&&rt(i)?v=zh().y(Id).x1(Md).x0(i):rt(i)?v=zh().x(Md).y1(Id).y0(i):v=c4().x(Md).y(Id),v.defined(Yh).curve(m),v(p)},Zm=function(t){var n=t.className,r=t.points,s=t.path,o=t.pathRef;if((!r||!r.length)&&!s)return null;var i=r&&r.length?Yle(t):s;return h.createElement("path",X1({},Mt(t,!1),Cm(t),{className:Yt("recharts-curve",n),d:i,ref:o}))},Hj={exports:{}},Vj,iI;function Xle(){if(iI)return Vj;iI=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Vj=e,Vj}var Kj,lI;function Qle(){if(lI)return Kj;lI=1;var e=Xle();function t(){}function n(){}return n.resetWarningCache=t,Kj=function(){function r(i,c,d,f,m,p){if(p!==e){var v=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw v.name="Invariant Violation",v}}r.isRequired=r;function s(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:s,element:r,elementType:r,instanceOf:s,node:r,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},Kj}var cI;function Jle(){return cI||(cI=1,Hj.exports=Qle()()),Hj.exports}var Zle=Jle();const mn=xn(Zle),{getOwnPropertyNames:ece,getOwnPropertySymbols:tce}=Object,{hasOwnProperty:nce}=Object.prototype;function Gj(e,t){return function(r,s,o){return e(r,s,o)&&t(r,s,o)}}function Xh(e){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,s);const{cache:o}=s,i=o.get(n),c=o.get(r);if(i&&c)return i===r&&c===n;o.set(n,r),o.set(r,n);const d=e(n,r,s);return o.delete(n),o.delete(r),d}}function rce(e){return e?.[Symbol.toStringTag]}function uI(e){return ece(e).concat(tce(e))}const ace=Object.hasOwn||((e,t)=>nce.call(e,t));function Kl(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const sce="__v",oce="__o",ice="_owner",{getOwnPropertyDescriptor:dI,keys:fI}=Object;function lce(e,t){return e.byteLength===t.byteLength&&eg(new Uint8Array(e),new Uint8Array(t))}function cce(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function uce(e,t){return e.byteLength===t.byteLength&&eg(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function dce(e,t){return Kl(e.getTime(),t.getTime())}function fce(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function pce(e,t){return e===t}function pI(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const s=new Array(r),o=e.entries();let i,c,d=0;for(;(i=o.next())&&!i.done;){const f=t.entries();let m=!1,p=0;for(;(c=f.next())&&!c.done;){if(s[p]){p++;continue}const v=i.value,x=c.value;if(n.equals(v[0],x[0],d,p,e,t,n)&&n.equals(v[1],x[1],v[0],x[0],e,t,n)){m=s[p]=!0;break}p++}if(!m)return!1;d++}return!0}const hce=Kl;function mce(e,t,n){const r=fI(e);let s=r.length;if(fI(t).length!==s)return!1;for(;s-- >0;)if(!uz(e,t,n,r[s]))return!1;return!0}function $d(e,t,n){const r=uI(e);let s=r.length;if(uI(t).length!==s)return!1;let o,i,c;for(;s-- >0;)if(o=r[s],!uz(e,t,n,o)||(i=dI(e,o),c=dI(t,o),(i||c)&&(!i||!c||i.configurable!==c.configurable||i.enumerable!==c.enumerable||i.writable!==c.writable)))return!1;return!0}function gce(e,t){return Kl(e.valueOf(),t.valueOf())}function vce(e,t){return e.source===t.source&&e.flags===t.flags}function hI(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const s=new Array(r),o=e.values();let i,c;for(;(i=o.next())&&!i.done;){const d=t.values();let f=!1,m=0;for(;(c=d.next())&&!c.done;){if(!s[m]&&n.equals(i.value,c.value,i.value,c.value,e,t,n)){f=s[m]=!0;break}m++}if(!f)return!1}return!0}function eg(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function xce(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function uz(e,t,n,r){return(r===ice||r===oce||r===sce)&&(e.$$typeof||t.$$typeof)?!0:ace(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const yce="[object ArrayBuffer]",bce="[object Arguments]",wce="[object Boolean]",jce="[object DataView]",Sce="[object Date]",Nce="[object Error]",Cce="[object Map]",_ce="[object Number]",kce="[object Object]",Ace="[object RegExp]",Ece="[object Set]",Pce="[object String]",Rce={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Tce="[object URL]",Oce=Object.prototype.toString;function Mce({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:c,areObjectsEqual:d,arePrimitiveWrappersEqual:f,areRegExpsEqual:m,areSetsEqual:p,areTypedArraysEqual:v,areUrlsEqual:x,unknownTagComparators:j}){return function(b,S,N){if(b===S)return!0;if(b==null||S==null)return!1;const C=typeof b;if(C!==typeof S)return!1;if(C!=="object")return C==="number"?c(b,S,N):C==="function"?o(b,S,N):!1;const k=b.constructor;if(k!==S.constructor)return!1;if(k===Object)return d(b,S,N);if(Array.isArray(b))return t(b,S,N);if(k===Date)return r(b,S,N);if(k===RegExp)return m(b,S,N);if(k===Map)return i(b,S,N);if(k===Set)return p(b,S,N);const A=Oce.call(b);if(A===Sce)return r(b,S,N);if(A===Ace)return m(b,S,N);if(A===Cce)return i(b,S,N);if(A===Ece)return p(b,S,N);if(A===kce)return typeof b.then!="function"&&typeof S.then!="function"&&d(b,S,N);if(A===Tce)return x(b,S,N);if(A===Nce)return s(b,S,N);if(A===bce)return d(b,S,N);if(Rce[A])return v(b,S,N);if(A===yce)return e(b,S,N);if(A===jce)return n(b,S,N);if(A===wce||A===_ce||A===Pce)return f(b,S,N);if(j){let E=j[A];if(!E){const P=rce(b);P&&(E=j[P])}if(E)return E(b,S,N)}return!1}}function Ice({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:lce,areArraysEqual:n?$d:cce,areDataViewsEqual:uce,areDatesEqual:dce,areErrorsEqual:fce,areFunctionsEqual:pce,areMapsEqual:n?Gj(pI,$d):pI,areNumbersEqual:hce,areObjectsEqual:n?$d:mce,arePrimitiveWrappersEqual:gce,areRegExpsEqual:vce,areSetsEqual:n?Gj(hI,$d):hI,areTypedArraysEqual:n?Gj(eg,$d):eg,areUrlsEqual:xce,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const s=Xh(r.areArraysEqual),o=Xh(r.areMapsEqual),i=Xh(r.areObjectsEqual),c=Xh(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:i,areSetsEqual:c})}return r}function $ce(e){return function(t,n,r,s,o,i,c){return e(t,n,c)}}function Dce({circular:e,comparator:t,createState:n,equals:r,strict:s}){if(n)return function(c,d){const{cache:f=e?new WeakMap:void 0,meta:m}=n();return t(c,d,{cache:f,equals:r,meta:m,strict:s})};if(e)return function(c,d){return t(c,d,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const o={cache:void 0,equals:r,meta:void 0,strict:s};return function(c,d){return t(c,d,o)}}const Lce=Mi();Mi({strict:!0});Mi({circular:!0});Mi({circular:!0,strict:!0});Mi({createInternalComparator:()=>Kl});Mi({strict:!0,createInternalComparator:()=>Kl});Mi({circular:!0,createInternalComparator:()=>Kl});Mi({circular:!0,createInternalComparator:()=>Kl,strict:!0});function Mi(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:s=!1}=e,o=Ice(e),i=Mce(o),c=n?n(i):$ce(i);return Dce({circular:t,comparator:i,createState:r,equals:c,strict:s})}function Fce(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function mI(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function s(o){n<0&&(n=o),o-n>t?(e(o),n=-1):Fce(s)};requestAnimationFrame(r)}function Q1(e){"@babel/helpers - typeof";return Q1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q1(e)}function zce(e){return Wce(e)||Uce(e)||qce(e)||Bce()}function Bce(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
98
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qce(e,t){if(e){if(typeof e=="string")return gI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gI(e,t)}}function gI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Uce(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Wce(e){if(Array.isArray(e))return e}function Hce(){var e={},t=function(){return null},n=!1,r=function s(o){if(!n){if(Array.isArray(o)){if(!o.length)return;var i=o,c=zce(i),d=c[0],f=c.slice(1);if(typeof d=="number"){mI(s.bind(null,f),d);return}s(d),mI(s.bind(null,f));return}Q1(o)==="object"&&(e=o,t(e)),typeof o=="function"&&o()}};return{stop:function(){n=!0},start:function(o){n=!1,r(o)},subscribe:function(o){return t=o,function(){t=function(){return null}}}}}function Of(e){"@babel/helpers - typeof";return Of=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Of(e)}function vI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function xI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vI(Object(n),!0).forEach(function(r){dz(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function dz(e,t,n){return t=Vce(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vce(e){var t=Kce(e,"string");return Of(t)==="symbol"?t:String(t)}function Kce(e,t){if(Of(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Of(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gce=function(t,n){return[Object.keys(t),Object.keys(n)].reduce(function(r,s){return r.filter(function(o){return s.includes(o)})})},Yce=function(t){return t},Xce=function(t){return t.replace(/([A-Z])/g,function(n){return"-".concat(n.toLowerCase())})},Jd=function(t,n){return Object.keys(n).reduce(function(r,s){return xI(xI({},r),{},dz({},s,t(s,n[s])))},{})},yI=function(t,n,r){return t.map(function(s){return"".concat(Xce(s)," ").concat(n,"ms ").concat(r)}).join(",")};function Qce(e,t){return eue(e)||Zce(e,t)||fz(e,t)||Jce()}function Jce(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
99
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zce(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,c=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);d=!0);}catch(m){f=!0,s=m}finally{try{if(!d&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw s}}return c}}function eue(e){if(Array.isArray(e))return e}function tue(e){return aue(e)||rue(e)||fz(e)||nue()}function nue(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
100
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fz(e,t){if(e){if(typeof e=="string")return J1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return J1(e,t)}}function rue(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function aue(e){if(Array.isArray(e))return J1(e)}function J1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var tg=1e-4,pz=function(t,n){return[0,3*t,3*n-6*t,3*t-3*n+1]},hz=function(t,n){return t.map(function(r,s){return r*Math.pow(n,s)}).reduce(function(r,s){return r+s})},bI=function(t,n){return function(r){var s=pz(t,n);return hz(s,r)}},sue=function(t,n){return function(r){var s=pz(t,n),o=[].concat(tue(s.map(function(i,c){return i*c}).slice(1)),[0]);return hz(o,r)}},wI=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var s=n[0],o=n[1],i=n[2],c=n[3];if(n.length===1)switch(n[0]){case"linear":s=0,o=0,i=1,c=1;break;case"ease":s=.25,o=.1,i=.25,c=1;break;case"ease-in":s=.42,o=0,i=1,c=1;break;case"ease-out":s=.42,o=0,i=.58,c=1;break;case"ease-in-out":s=0,o=0,i=.58,c=1;break;default:{var d=n[0].split("(");if(d[0]==="cubic-bezier"&&d[1].split(")")[0].split(",").length===4){var f=d[1].split(")")[0].split(",").map(function(b){return parseFloat(b)}),m=Qce(f,4);s=m[0],o=m[1],i=m[2],c=m[3]}}}var p=bI(s,i),v=bI(o,c),x=sue(s,i),j=function(S){return S>1?1:S<0?0:S},y=function(S){for(var N=S>1?1:S,C=N,k=0;k<8;++k){var A=p(C)-N,E=x(C);if(Math.abs(A-N)<tg||E<tg)return v(C);C=j(C-A/E)}return v(C)};return y.isStepper=!1,y},oue=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,s=t.damping,o=s===void 0?8:s,i=t.dt,c=i===void 0?17:i,d=function(m,p,v){var x=-(m-p)*r,j=v*o,y=v+(x-j)*c/1e3,b=v*c/1e3+m;return Math.abs(b-p)<tg&&Math.abs(y)<tg?[p,0]:[b,y]};return d.isStepper=!0,d.dt=c,d},iue=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var s=n[0];if(typeof s=="string")switch(s){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return wI(s);case"spring":return oue();default:if(s.split("(")[0]==="cubic-bezier")return wI(s)}return typeof s=="function"?s:null};function Mf(e){"@babel/helpers - typeof";return Mf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mf(e)}function jI(e){return uue(e)||cue(e)||mz(e)||lue()}function lue(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
101
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cue(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function uue(e){if(Array.isArray(e))return eN(e)}function SI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Cr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?SI(Object(n),!0).forEach(function(r){Z1(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Z1(e,t,n){return t=due(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function due(e){var t=fue(e,"string");return Mf(t)==="symbol"?t:String(t)}function fue(e,t){if(Mf(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Mf(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pue(e,t){return gue(e)||mue(e,t)||mz(e,t)||hue()}function hue(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
102
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mz(e,t){if(e){if(typeof e=="string")return eN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return eN(e,t)}}function eN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function mue(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,c=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);d=!0);}catch(m){f=!0,s=m}finally{try{if(!d&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw s}}return c}}function gue(e){if(Array.isArray(e))return e}var ng=function(t,n,r){return t+(n-t)*r},tN=function(t){var n=t.from,r=t.to;return n!==r},vue=function e(t,n,r){var s=Jd(function(o,i){if(tN(i)){var c=t(i.from,i.to,i.velocity),d=pue(c,2),f=d[0],m=d[1];return Cr(Cr({},i),{},{from:f,velocity:m})}return i},n);return r<1?Jd(function(o,i){return tN(i)?Cr(Cr({},i),{},{velocity:ng(i.velocity,s[o].velocity,r),from:ng(i.from,s[o].from,r)}):i},n):e(t,s,r-1)};const xue=(function(e,t,n,r,s){var o=Gce(e,t),i=o.reduce(function(b,S){return Cr(Cr({},b),{},Z1({},S,[e[S],t[S]]))},{}),c=o.reduce(function(b,S){return Cr(Cr({},b),{},Z1({},S,{from:e[S],velocity:0,to:t[S]}))},{}),d=-1,f,m,p=function(){return null},v=function(){return Jd(function(S,N){return N.from},c)},x=function(){return!Object.values(c).filter(tN).length},j=function(S){f||(f=S);var N=S-f,C=N/n.dt;c=vue(n,c,C),s(Cr(Cr(Cr({},e),t),v())),f=S,x()||(d=requestAnimationFrame(p))},y=function(S){m||(m=S);var N=(S-m)/r,C=Jd(function(A,E){return ng.apply(void 0,jI(E).concat([n(N)]))},i);if(s(Cr(Cr(Cr({},e),t),C)),N<1)d=requestAnimationFrame(p);else{var k=Jd(function(A,E){return ng.apply(void 0,jI(E).concat([n(1)]))},i);s(Cr(Cr(Cr({},e),t),k))}};return p=n.isStepper?j:y,function(){return requestAnimationFrame(p),function(){cancelAnimationFrame(d)}}});function lu(e){"@babel/helpers - typeof";return lu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lu(e)}var yue=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function bue(e,t){if(e==null)return{};var n=wue(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function wue(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,o;for(o=0;o<r.length;o++)s=r[o],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function Yj(e){return Cue(e)||Nue(e)||Sue(e)||jue()}function jue(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
103
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sue(e,t){if(e){if(typeof e=="string")return nN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nN(e,t)}}function Nue(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Cue(e){if(Array.isArray(e))return nN(e)}function nN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function NI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function gs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?NI(Object(n),!0).forEach(function(r){Ud(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ud(e,t,n){return t=gz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _ue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kue(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,gz(r.key),r)}}function Aue(e,t,n){return t&&kue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function gz(e){var t=Eue(e,"string");return lu(t)==="symbol"?t:String(t)}function Eue(e,t){if(lu(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(lu(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&rN(e,t)}function rN(e,t){return rN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},rN(e,t)}function Rue(e){var t=Tue();return function(){var r=rg(e),s;if(t){var o=rg(this).constructor;s=Reflect.construct(r,arguments,o)}else s=r.apply(this,arguments);return aN(this,s)}}function aN(e,t){if(t&&(lu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sN(e)}function sN(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Tue(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function rg(e){return rg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},rg(e)}var Xs=(function(e){Pue(n,e);var t=Rue(n);function n(r,s){var o;_ue(this,n),o=t.call(this,r,s);var i=o.props,c=i.isActive,d=i.attributeName,f=i.from,m=i.to,p=i.steps,v=i.children,x=i.duration;if(o.handleStyleChange=o.handleStyleChange.bind(sN(o)),o.changeStyle=o.changeStyle.bind(sN(o)),!c||x<=0)return o.state={style:{}},typeof v=="function"&&(o.state={style:m}),aN(o);if(p&&p.length)o.state={style:p[0].style};else if(f){if(typeof v=="function")return o.state={style:f},aN(o);o.state={style:d?Ud({},d,f):f}}else o.state={style:{}};return o}return Aue(n,[{key:"componentDidMount",value:function(){var s=this.props,o=s.isActive,i=s.canBegin;this.mounted=!0,!(!o||!i)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(s){var o=this.props,i=o.isActive,c=o.canBegin,d=o.attributeName,f=o.shouldReAnimate,m=o.to,p=o.from,v=this.state.style;if(c){if(!i){var x={style:d?Ud({},d,m):m};this.state&&v&&(d&&v[d]!==m||!d&&v!==m)&&this.setState(x);return}if(!(Lce(s.to,m)&&s.canBegin&&s.isActive)){var j=!s.canBegin||!s.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var y=j||f?p:s.to;if(this.state&&v){var b={style:d?Ud({},d,y):y};(d&&v[d]!==y||!d&&v!==y)&&this.setState(b)}this.runAnimation(gs(gs({},this.props),{},{from:y,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var s=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),s&&s()}},{key:"handleStyleChange",value:function(s){this.changeStyle(s)}},{key:"changeStyle",value:function(s){this.mounted&&this.setState({style:s})}},{key:"runJSAnimation",value:function(s){var o=this,i=s.from,c=s.to,d=s.duration,f=s.easing,m=s.begin,p=s.onAnimationEnd,v=s.onAnimationStart,x=xue(i,c,iue(f),d,this.changeStyle),j=function(){o.stopJSAnimation=x()};this.manager.start([v,m,j,d,p])}},{key:"runStepAnimation",value:function(s){var o=this,i=s.steps,c=s.begin,d=s.onAnimationStart,f=i[0],m=f.style,p=f.duration,v=p===void 0?0:p,x=function(y,b,S){if(S===0)return y;var N=b.duration,C=b.easing,k=C===void 0?"ease":C,A=b.style,E=b.properties,P=b.onAnimationEnd,O=S>0?i[S-1]:b,D=E||Object.keys(A);if(typeof k=="function"||k==="spring")return[].concat(Yj(y),[o.runJSAnimation.bind(o,{from:O.style,to:A,duration:N,easing:k}),N]);var K=yI(D,N,k),q=gs(gs(gs({},O.style),A),{},{transition:K});return[].concat(Yj(y),[q,N,P]).filter(Yce)};return this.manager.start([d].concat(Yj(i.reduce(x,[m,Math.max(v,c)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=Hce());var o=s.begin,i=s.duration,c=s.attributeName,d=s.to,f=s.easing,m=s.onAnimationStart,p=s.onAnimationEnd,v=s.steps,x=s.children,j=this.manager;if(this.unSubscribe=j.subscribe(this.handleStyleChange),typeof f=="function"||typeof x=="function"||f==="spring"){this.runJSAnimation(s);return}if(v.length>1){this.runStepAnimation(s);return}var y=c?Ud({},c,d):d,b=yI(Object.keys(y),i,f);j.start([m,o,gs(gs({},y),{},{transition:b}),i,p])}},{key:"render",value:function(){var s=this.props,o=s.children;s.begin;var i=s.duration;s.attributeName,s.easing;var c=s.isActive;s.steps,s.from,s.to,s.canBegin,s.onAnimationEnd,s.shouldReAnimate,s.onAnimationReStart;var d=bue(s,yue),f=h.Children.count(o),m=this.state.style;if(typeof o=="function")return o(m);if(!c||f===0||i<=0)return o;var p=function(x){var j=x.props,y=j.style,b=y===void 0?{}:y,S=j.className,N=h.cloneElement(x,gs(gs({},d),{},{style:gs(gs({},b),m),className:S}));return N};return f===1?p(h.Children.only(o)):Q.createElement("div",null,h.Children.map(o,function(v){return p(v)}))}}]),n})(h.PureComponent);Xs.displayName="Animate";Xs.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Xs.propTypes={from:mn.oneOfType([mn.object,mn.string]),to:mn.oneOfType([mn.object,mn.string]),attributeName:mn.string,duration:mn.number,begin:mn.number,easing:mn.oneOfType([mn.string,mn.func]),steps:mn.arrayOf(mn.shape({duration:mn.number.isRequired,style:mn.object.isRequired,easing:mn.oneOfType([mn.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),mn.func]),properties:mn.arrayOf("string"),onAnimationEnd:mn.func})),children:mn.oneOfType([mn.node,mn.func]),isActive:mn.bool,canBegin:mn.bool,onAnimationEnd:mn.func,shouldReAnimate:mn.bool,onAnimationStart:mn.func,onAnimationReStart:mn.func};function If(e){"@babel/helpers - typeof";return If=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},If(e)}function ag(){return ag=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ag.apply(this,arguments)}function Oue(e,t){return Due(e)||$ue(e,t)||Iue(e,t)||Mue()}function Mue(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
104
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Iue(e,t){if(e){if(typeof e=="string")return CI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return CI(e,t)}}function CI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function $ue(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,c=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);d=!0);}catch(m){f=!0,s=m}finally{try{if(!d&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw s}}return c}}function Due(e){if(Array.isArray(e))return e}function _I(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function kI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_I(Object(n),!0).forEach(function(r){Lue(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_I(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Lue(e,t,n){return t=Fue(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fue(e){var t=zue(e,"string");return If(t)=="symbol"?t:t+""}function zue(e,t){if(If(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(If(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var AI=function(t,n,r,s,o){var i=Math.min(Math.abs(r)/2,Math.abs(s)/2),c=s>=0?1:-1,d=r>=0?1:-1,f=s>=0&&r>=0||s<0&&r<0?1:0,m;if(i>0&&o instanceof Array){for(var p=[0,0,0,0],v=0,x=4;v<x;v++)p[v]=o[v]>i?i:o[v];m="M".concat(t,",").concat(n+c*p[0]),p[0]>0&&(m+="A ".concat(p[0],",").concat(p[0],",0,0,").concat(f,",").concat(t+d*p[0],",").concat(n)),m+="L ".concat(t+r-d*p[1],",").concat(n),p[1]>0&&(m+="A ".concat(p[1],",").concat(p[1],",0,0,").concat(f,`,
105
+ `).concat(t+r,",").concat(n+c*p[1])),m+="L ".concat(t+r,",").concat(n+s-c*p[2]),p[2]>0&&(m+="A ".concat(p[2],",").concat(p[2],",0,0,").concat(f,`,
106
+ `).concat(t+r-d*p[2],",").concat(n+s)),m+="L ".concat(t+d*p[3],",").concat(n+s),p[3]>0&&(m+="A ".concat(p[3],",").concat(p[3],",0,0,").concat(f,`,
107
+ `).concat(t,",").concat(n+s-c*p[3])),m+="Z"}else if(i>0&&o===+o&&o>0){var j=Math.min(i,o);m="M ".concat(t,",").concat(n+c*j,`
108
+ A `).concat(j,",").concat(j,",0,0,").concat(f,",").concat(t+d*j,",").concat(n,`
109
+ L `).concat(t+r-d*j,",").concat(n,`
110
+ A `).concat(j,",").concat(j,",0,0,").concat(f,",").concat(t+r,",").concat(n+c*j,`
111
+ L `).concat(t+r,",").concat(n+s-c*j,`
112
+ A `).concat(j,",").concat(j,",0,0,").concat(f,",").concat(t+r-d*j,",").concat(n+s,`
113
+ L `).concat(t+d*j,",").concat(n+s,`
114
+ A `).concat(j,",").concat(j,",0,0,").concat(f,",").concat(t,",").concat(n+s-c*j," Z")}else m="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(s," h ").concat(-r," Z");return m},Bue=function(t,n){if(!t||!n)return!1;var r=t.x,s=t.y,o=n.x,i=n.y,c=n.width,d=n.height;if(Math.abs(c)>0&&Math.abs(d)>0){var f=Math.min(o,o+c),m=Math.max(o,o+c),p=Math.min(i,i+d),v=Math.max(i,i+d);return r>=f&&r<=m&&s>=p&&s<=v}return!1},que={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},D_=function(t){var n=kI(kI({},que),t),r=h.useRef(),s=h.useState(-1),o=Oue(s,2),i=o[0],c=o[1];h.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var k=r.current.getTotalLength();k&&c(k)}catch{}},[]);var d=n.x,f=n.y,m=n.width,p=n.height,v=n.radius,x=n.className,j=n.animationEasing,y=n.animationDuration,b=n.animationBegin,S=n.isAnimationActive,N=n.isUpdateAnimationActive;if(d!==+d||f!==+f||m!==+m||p!==+p||m===0||p===0)return null;var C=Yt("recharts-rectangle",x);return N?Q.createElement(Xs,{canBegin:i>0,from:{width:m,height:p,x:d,y:f},to:{width:m,height:p,x:d,y:f},duration:y,animationEasing:j,isActive:N},function(k){var A=k.width,E=k.height,P=k.x,O=k.y;return Q.createElement(Xs,{canBegin:i>0,from:"0px ".concat(i===-1?1:i,"px"),to:"".concat(i,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:y,isActive:S,easing:j},Q.createElement("path",ag({},Mt(n,!0),{className:C,d:AI(P,O,A,E,v),ref:r})))}):Q.createElement("path",ag({},Mt(n,!0),{className:C,d:AI(d,f,m,p,v)}))},Uue=["points","className","baseLinePoints","connectNulls"];function $c(){return $c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$c.apply(this,arguments)}function Wue(e,t){if(e==null)return{};var n=Hue(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Hue(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function EI(e){return Yue(e)||Gue(e)||Kue(e)||Vue()}function Vue(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
115
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kue(e,t){if(e){if(typeof e=="string")return oN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oN(e,t)}}function Gue(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Yue(e){if(Array.isArray(e))return oN(e)}function oN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var PI=function(t){return t&&t.x===+t.x&&t.y===+t.y},Xue=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(r){PI(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),PI(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},Zd=function(t,n){var r=Xue(t);n&&(r=[r.reduce(function(o,i){return[].concat(EI(o),EI(i))},[])]);var s=r.map(function(o){return o.reduce(function(i,c,d){return"".concat(i).concat(d===0?"M":"L").concat(c.x,",").concat(c.y)},"")}).join("");return r.length===1?"".concat(s,"Z"):s},Que=function(t,n,r){var s=Zd(t,r);return"".concat(s.slice(-1)==="Z"?s.slice(0,-1):s,"L").concat(Zd(n.reverse(),r).slice(1))},Jue=function(t){var n=t.points,r=t.className,s=t.baseLinePoints,o=t.connectNulls,i=Wue(t,Uue);if(!n||!n.length)return null;var c=Yt("recharts-polygon",r);if(s&&s.length){var d=i.stroke&&i.stroke!=="none",f=Que(n,s,o);return Q.createElement("g",{className:c},Q.createElement("path",$c({},Mt(i,!0),{fill:f.slice(-1)==="Z"?i.fill:"none",stroke:"none",d:f})),d?Q.createElement("path",$c({},Mt(i,!0),{fill:"none",d:Zd(n,o)})):null,d?Q.createElement("path",$c({},Mt(i,!0),{fill:"none",d:Zd(s,o)})):null)}var m=Zd(n,o);return Q.createElement("path",$c({},Mt(i,!0),{fill:m.slice(-1)==="Z"?i.fill:"none",className:c,d:m}))};function iN(){return iN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},iN.apply(this,arguments)}var Mv=function(t){var n=t.cx,r=t.cy,s=t.r,o=t.className,i=Yt("recharts-dot",o);return n===+n&&r===+r&&s===+s?h.createElement("circle",iN({},Mt(t,!1),Cm(t),{className:i,cx:n,cy:r,r:s})):null};function $f(e){"@babel/helpers - typeof";return $f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$f(e)}var Zue=["x","y","top","left","width","height","className"];function lN(){return lN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},lN.apply(this,arguments)}function RI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ede(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?RI(Object(n),!0).forEach(function(r){tde(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tde(e,t,n){return t=nde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nde(e){var t=rde(e,"string");return $f(t)=="symbol"?t:t+""}function rde(e,t){if($f(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if($f(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ade(e,t){if(e==null)return{};var n=sde(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sde(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var ode=function(t,n,r,s,o,i){return"M".concat(t,",").concat(o,"v").concat(s,"M").concat(i,",").concat(n,"h").concat(r)},ide=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,o=s===void 0?0:s,i=t.top,c=i===void 0?0:i,d=t.left,f=d===void 0?0:d,m=t.width,p=m===void 0?0:m,v=t.height,x=v===void 0?0:v,j=t.className,y=ade(t,Zue),b=ede({x:r,y:o,top:c,left:f,width:p,height:x},y);return!rt(r)||!rt(o)||!rt(p)||!rt(x)||!rt(c)||!rt(f)?null:Q.createElement("path",lN({},Mt(b,!0),{className:Yt("recharts-cross",j),d:ode(r,o,p,x,c,f)}))},Xj,TI;function lde(){if(TI)return Xj;TI=1;var e=Ev(),t=TF(),n=Zs();function r(s,o){return s&&s.length?e(s,n(o,2),t):void 0}return Xj=r,Xj}var cde=lde();const ude=xn(cde);var Qj,OI;function dde(){if(OI)return Qj;OI=1;var e=Ev(),t=Zs(),n=OF();function r(s,o){return s&&s.length?e(s,t(o,2),n):void 0}return Qj=r,Qj}var fde=dde();const pde=xn(fde);var hde=["cx","cy","angle","ticks","axisLine"],mde=["ticks","tick","angle","tickFormatter","stroke"];function cu(e){"@babel/helpers - typeof";return cu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cu(e)}function ef(){return ef=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ef.apply(this,arguments)}function MI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function tl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?MI(Object(n),!0).forEach(function(r){Iv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function II(e,t){if(e==null)return{};var n=gde(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gde(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function vde(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $I(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,xz(r.key),r)}}function xde(e,t,n){return t&&$I(e.prototype,t),n&&$I(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function yde(e,t,n){return t=sg(t),bde(e,vz()?Reflect.construct(t,n||[],sg(e).constructor):t.apply(e,n))}function bde(e,t){if(t&&(cu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wde(e)}function wde(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(vz=function(){return!!e})()}function sg(e){return sg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},sg(e)}function jde(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&cN(e,t)}function cN(e,t){return cN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},cN(e,t)}function Iv(e,t,n){return t=xz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xz(e){var t=Sde(e,"string");return cu(t)=="symbol"?t:t+""}function Sde(e,t){if(cu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(cu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var $v=(function(e){function t(){return vde(this,t),yde(this,t,arguments)}return jde(t,e),xde(t,[{key:"getTickValueCoord",value:function(r){var s=r.coordinate,o=this.props,i=o.angle,c=o.cx,d=o.cy;return Pn(c,d,s,i)}},{key:"getTickTextAnchor",value:function(){var r=this.props.orientation,s;switch(r){case"left":s="end";break;case"right":s="start";break;default:s="middle";break}return s}},{key:"getViewBox",value:function(){var r=this.props,s=r.cx,o=r.cy,i=r.angle,c=r.ticks,d=ude(c,function(m){return m.coordinate||0}),f=pde(c,function(m){return m.coordinate||0});return{cx:s,cy:o,startAngle:i,endAngle:i,innerRadius:f.coordinate||0,outerRadius:d.coordinate||0}}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.cx,o=r.cy,i=r.angle,c=r.ticks,d=r.axisLine,f=II(r,hde),m=c.reduce(function(j,y){return[Math.min(j[0],y.coordinate),Math.max(j[1],y.coordinate)]},[1/0,-1/0]),p=Pn(s,o,m[0],i),v=Pn(s,o,m[1],i),x=tl(tl(tl({},Mt(f,!1)),{},{fill:"none"},Mt(d,!1)),{},{x1:p.x,y1:p.y,x2:v.x,y2:v.y});return Q.createElement("line",ef({className:"recharts-polar-radius-axis-line"},x))}},{key:"renderTicks",value:function(){var r=this,s=this.props,o=s.ticks,i=s.tick,c=s.angle,d=s.tickFormatter,f=s.stroke,m=II(s,mde),p=this.getTickTextAnchor(),v=Mt(m,!1),x=Mt(i,!1),j=o.map(function(y,b){var S=r.getTickValueCoord(y),N=tl(tl(tl(tl({textAnchor:p,transform:"rotate(".concat(90-c,", ").concat(S.x,", ").concat(S.y,")")},v),{},{stroke:"none",fill:f},x),{},{index:b},S),{},{payload:y});return Q.createElement(un,ef({className:Yt("recharts-polar-radius-axis-tick",oz(i)),key:"tick-".concat(y.coordinate)},_l(r.props,y,b)),t.renderTickItem(i,N,d?d(y.value,b):y.value))});return Q.createElement(un,{className:"recharts-polar-radius-axis-ticks"},j)}},{key:"render",value:function(){var r=this.props,s=r.ticks,o=r.axisLine,i=r.tick;return!s||!s.length?null:Q.createElement(un,{className:Yt("recharts-polar-radius-axis",this.props.className)},o&&this.renderAxisLine(),i&&this.renderTicks(),br.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(r,s,o){var i;return Q.isValidElement(r)?i=Q.cloneElement(r,s):Kt(r)?i=r(s):i=Q.createElement(kl,ef({},s,{className:"recharts-polar-radius-axis-tick-value"}),o),i}}])})(h.PureComponent);Iv($v,"displayName","PolarRadiusAxis");Iv($v,"axisType","radiusAxis");Iv($v,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function uu(e){"@babel/helpers - typeof";return uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uu(e)}function ll(){return ll=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ll.apply(this,arguments)}function DI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function nl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?DI(Object(n),!0).forEach(function(r){Dv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nde(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function LI(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,bz(r.key),r)}}function Cde(e,t,n){return t&&LI(e.prototype,t),n&&LI(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _de(e,t,n){return t=og(t),kde(e,yz()?Reflect.construct(t,n||[],og(e).constructor):t.apply(e,n))}function kde(e,t){if(t&&(uu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ade(e)}function Ade(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yz=function(){return!!e})()}function og(e){return og=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},og(e)}function Ede(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&uN(e,t)}function uN(e,t){return uN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},uN(e,t)}function Dv(e,t,n){return t=bz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bz(e){var t=Pde(e,"string");return uu(t)=="symbol"?t:t+""}function Pde(e,t){if(uu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(uu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Rde=Math.PI/180,FI=1e-5,Lv=(function(e){function t(){return Nde(this,t),_de(this,t,arguments)}return Ede(t,e),Cde(t,[{key:"getTickLineCoord",value:function(r){var s=this.props,o=s.cx,i=s.cy,c=s.radius,d=s.orientation,f=s.tickSize,m=f||8,p=Pn(o,i,c,r.coordinate),v=Pn(o,i,c+(d==="inner"?-1:1)*m,r.coordinate);return{x1:p.x,y1:p.y,x2:v.x,y2:v.y}}},{key:"getTickTextAnchor",value:function(r){var s=this.props.orientation,o=Math.cos(-r.coordinate*Rde),i;return o>FI?i=s==="outer"?"start":"end":o<-FI?i=s==="outer"?"end":"start":i="middle",i}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.cx,o=r.cy,i=r.radius,c=r.axisLine,d=r.axisLineType,f=nl(nl({},Mt(this.props,!1)),{},{fill:"none"},Mt(c,!1));if(d==="circle")return Q.createElement(Mv,ll({className:"recharts-polar-angle-axis-line"},f,{cx:s,cy:o,r:i}));var m=this.props.ticks,p=m.map(function(v){return Pn(s,o,i,v.coordinate)});return Q.createElement(Jue,ll({className:"recharts-polar-angle-axis-line"},f,{points:p}))}},{key:"renderTicks",value:function(){var r=this,s=this.props,o=s.ticks,i=s.tick,c=s.tickLine,d=s.tickFormatter,f=s.stroke,m=Mt(this.props,!1),p=Mt(i,!1),v=nl(nl({},m),{},{fill:"none"},Mt(c,!1)),x=o.map(function(j,y){var b=r.getTickLineCoord(j),S=r.getTickTextAnchor(j),N=nl(nl(nl({textAnchor:S},m),{},{stroke:"none",fill:f},p),{},{index:y,payload:j,x:b.x2,y:b.y2});return Q.createElement(un,ll({className:Yt("recharts-polar-angle-axis-tick",oz(i)),key:"tick-".concat(j.coordinate)},_l(r.props,j,y)),c&&Q.createElement("line",ll({className:"recharts-polar-angle-axis-tick-line"},v,b)),i&&t.renderTickItem(i,N,d?d(j.value,y):j.value))});return Q.createElement(un,{className:"recharts-polar-angle-axis-ticks"},x)}},{key:"render",value:function(){var r=this.props,s=r.ticks,o=r.radius,i=r.axisLine;return o<=0||!s||!s.length?null:Q.createElement(un,{className:Yt("recharts-polar-angle-axis",this.props.className)},i&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,s,o){var i;return Q.isValidElement(r)?i=Q.cloneElement(r,s):Kt(r)?i=r(s):i=Q.createElement(kl,ll({},s,{className:"recharts-polar-angle-axis-tick-value"}),o),i}}])})(h.PureComponent);Dv(Lv,"displayName","PolarAngleAxis");Dv(Lv,"axisType","angleAxis");Dv(Lv,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var Jj,zI;function Tde(){if(zI)return Jj;zI=1;var e=T4(),t=e(Object.getPrototypeOf,Object);return Jj=t,Jj}var Zj,BI;function Ode(){if(BI)return Zj;BI=1;var e=zo(),t=Tde(),n=Bo(),r="[object Object]",s=Function.prototype,o=Object.prototype,i=s.toString,c=o.hasOwnProperty,d=i.call(Object);function f(m){if(!n(m)||e(m)!=r)return!1;var p=t(m);if(p===null)return!0;var v=c.call(p,"constructor")&&p.constructor;return typeof v=="function"&&v instanceof v&&i.call(v)==d}return Zj=f,Zj}var Mde=Ode();const Ide=xn(Mde);var eS,qI;function $de(){if(qI)return eS;qI=1;var e=zo(),t=Bo(),n="[object Boolean]";function r(s){return s===!0||s===!1||t(s)&&e(s)==n}return eS=r,eS}var Dde=$de();const Lde=xn(Dde);function Df(e){"@babel/helpers - typeof";return Df=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Df(e)}function ig(){return ig=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ig.apply(this,arguments)}function Fde(e,t){return Ude(e)||qde(e,t)||Bde(e,t)||zde()}function zde(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
116
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bde(e,t){if(e){if(typeof e=="string")return UI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return UI(e,t)}}function UI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qde(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,c=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);d=!0);}catch(m){f=!0,s=m}finally{try{if(!d&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw s}}return c}}function Ude(e){if(Array.isArray(e))return e}function WI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function HI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?WI(Object(n),!0).forEach(function(r){Wde(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Wde(e,t,n){return t=Hde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hde(e){var t=Vde(e,"string");return Df(t)=="symbol"?t:t+""}function Vde(e,t){if(Df(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Df(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var VI=function(t,n,r,s,o){var i=r-s,c;return c="M ".concat(t,",").concat(n),c+="L ".concat(t+r,",").concat(n),c+="L ".concat(t+r-i/2,",").concat(n+o),c+="L ".concat(t+r-i/2-s,",").concat(n+o),c+="L ".concat(t,",").concat(n," Z"),c},Kde={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Gde=function(t){var n=HI(HI({},Kde),t),r=h.useRef(),s=h.useState(-1),o=Fde(s,2),i=o[0],c=o[1];h.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var C=r.current.getTotalLength();C&&c(C)}catch{}},[]);var d=n.x,f=n.y,m=n.upperWidth,p=n.lowerWidth,v=n.height,x=n.className,j=n.animationEasing,y=n.animationDuration,b=n.animationBegin,S=n.isUpdateAnimationActive;if(d!==+d||f!==+f||m!==+m||p!==+p||v!==+v||m===0&&p===0||v===0)return null;var N=Yt("recharts-trapezoid",x);return S?Q.createElement(Xs,{canBegin:i>0,from:{upperWidth:0,lowerWidth:0,height:v,x:d,y:f},to:{upperWidth:m,lowerWidth:p,height:v,x:d,y:f},duration:y,animationEasing:j,isActive:S},function(C){var k=C.upperWidth,A=C.lowerWidth,E=C.height,P=C.x,O=C.y;return Q.createElement(Xs,{canBegin:i>0,from:"0px ".concat(i===-1?1:i,"px"),to:"".concat(i,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:y,easing:j},Q.createElement("path",ig({},Mt(n,!0),{className:N,d:VI(P,O,k,A,E),ref:r})))}):Q.createElement("g",null,Q.createElement("path",ig({},Mt(n,!0),{className:N,d:VI(d,f,m,p,v)})))},Yde=["option","shapeType","propTransformer","activeClassName","isActive"];function Lf(e){"@babel/helpers - typeof";return Lf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lf(e)}function Xde(e,t){if(e==null)return{};var n=Qde(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Qde(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function KI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function lg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?KI(Object(n),!0).forEach(function(r){Jde(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):KI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Jde(e,t,n){return t=Zde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zde(e){var t=efe(e,"string");return Lf(t)=="symbol"?t:t+""}function efe(e,t){if(Lf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Lf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tfe(e,t){return lg(lg({},t),e)}function nfe(e,t){return e==="symbols"}function GI(e){var t=e.shapeType,n=e.elementProps;switch(t){case"rectangle":return Q.createElement(D_,n);case"trapezoid":return Q.createElement(Gde,n);case"sector":return Q.createElement(cz,n);case"symbols":if(nfe(t))return Q.createElement(n_,n);break;default:return null}}function rfe(e){return h.isValidElement(e)?e.props:e}function wz(e){var t=e.option,n=e.shapeType,r=e.propTransformer,s=r===void 0?tfe:r,o=e.activeClassName,i=o===void 0?"recharts-active-shape":o,c=e.isActive,d=Xde(e,Yde),f;if(h.isValidElement(t))f=h.cloneElement(t,lg(lg({},d),rfe(t)));else if(Kt(t))f=t(d);else if(Ide(t)&&!Lde(t)){var m=s(t,d);f=Q.createElement(GI,{shapeType:n,elementProps:m})}else{var p=d;f=Q.createElement(GI,{shapeType:n,elementProps:p})}return c?Q.createElement(un,{className:i},f):f}function Fv(e,t){return t!=null&&"trapezoids"in e.props}function zv(e,t){return t!=null&&"sectors"in e.props}function Ff(e,t){return t!=null&&"points"in e.props}function afe(e,t){var n,r,s=e.x===(t==null||(n=t.labelViewBox)===null||n===void 0?void 0:n.x)||e.x===t.x,o=e.y===(t==null||(r=t.labelViewBox)===null||r===void 0?void 0:r.y)||e.y===t.y;return s&&o}function sfe(e,t){var n=e.endAngle===t.endAngle,r=e.startAngle===t.startAngle;return n&&r}function ofe(e,t){var n=e.x===t.x,r=e.y===t.y,s=e.z===t.z;return n&&r&&s}function ife(e,t){var n;return Fv(e,t)?n=afe:zv(e,t)?n=sfe:Ff(e,t)&&(n=ofe),n}function lfe(e,t){var n;return Fv(e,t)?n="trapezoids":zv(e,t)?n="sectors":Ff(e,t)&&(n="points"),n}function cfe(e,t){if(Fv(e,t)){var n;return(n=t.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}if(zv(e,t)){var r;return(r=t.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}return Ff(e,t)?t.payload:{}}function ufe(e){var t=e.activeTooltipItem,n=e.graphicalItem,r=e.itemData,s=lfe(n,t),o=cfe(n,t),i=r.filter(function(d,f){var m=xp(o,d),p=n.props[s].filter(function(j){var y=ife(n,t);return y(j,t)}),v=n.props[s].indexOf(p[p.length-1]),x=f===v;return m&&x}),c=r.indexOf(i[i.length-1]);return c}var fm;function du(e){"@babel/helpers - typeof";return du=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},du(e)}function Dc(){return Dc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Dc.apply(this,arguments)}function YI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function _n(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?YI(Object(n),!0).forEach(function(r){qa(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):YI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function dfe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function XI(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Sz(r.key),r)}}function ffe(e,t,n){return t&&XI(e.prototype,t),n&&XI(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function pfe(e,t,n){return t=cg(t),hfe(e,jz()?Reflect.construct(t,n||[],cg(e).constructor):t.apply(e,n))}function hfe(e,t){if(t&&(du(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mfe(e)}function mfe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(jz=function(){return!!e})()}function cg(e){return cg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},cg(e)}function gfe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&dN(e,t)}function dN(e,t){return dN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},dN(e,t)}function qa(e,t,n){return t=Sz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sz(e){var t=vfe(e,"string");return du(t)=="symbol"?t:t+""}function vfe(e,t){if(du(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(du(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Uo=(function(e){function t(n){var r;return dfe(this,t),r=pfe(this,t,[n]),qa(r,"pieRef",null),qa(r,"sectorRefs",[]),qa(r,"id",Du("recharts-pie-")),qa(r,"handleAnimationEnd",function(){var s=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),Kt(s)&&s()}),qa(r,"handleAnimationStart",function(){var s=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),Kt(s)&&s()}),r.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},r}return gfe(t,e),ffe(t,[{key:"isActiveIndex",value:function(r){var s=this.props.activeIndex;return Array.isArray(s)?s.indexOf(r)!==-1:r===s}},{key:"hasActiveIndex",value:function(){var r=this.props.activeIndex;return Array.isArray(r)?r.length!==0:r||r===0}},{key:"renderLabels",value:function(r){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var o=this.props,i=o.label,c=o.labelLine,d=o.dataKey,f=o.valueKey,m=Mt(this.props,!1),p=Mt(i,!1),v=Mt(c,!1),x=i&&i.offsetRadius||20,j=r.map(function(y,b){var S=(y.startAngle+y.endAngle)/2,N=Pn(y.cx,y.cy,y.outerRadius+x,S),C=_n(_n(_n(_n({},m),y),{},{stroke:"none"},p),{},{index:b,textAnchor:t.getTextAnchor(N.x,y.cx)},N),k=_n(_n(_n(_n({},m),y),{},{fill:"none",stroke:y.fill},v),{},{index:b,points:[Pn(y.cx,y.cy,y.outerRadius,S),N]}),A=d;return Gt(d)&&Gt(f)?A="value":Gt(d)&&(A=f),Q.createElement(un,{key:"label-".concat(y.startAngle,"-").concat(y.endAngle,"-").concat(y.midAngle,"-").concat(b)},c&&t.renderLabelLineItem(c,k,"line"),t.renderLabelItem(i,C,ur(y,A)))});return Q.createElement(un,{className:"recharts-pie-labels"},j)}},{key:"renderSectorsStatically",value:function(r){var s=this,o=this.props,i=o.activeShape,c=o.blendStroke,d=o.inactiveShape;return r.map(function(f,m){if(f?.startAngle===0&&f?.endAngle===0&&r.length!==1)return null;var p=s.isActiveIndex(m),v=d&&s.hasActiveIndex()?d:null,x=p?i:v,j=_n(_n({},f),{},{stroke:c?f.fill:f.stroke,tabIndex:-1});return Q.createElement(un,Dc({ref:function(b){b&&!s.sectorRefs.includes(b)&&s.sectorRefs.push(b)},tabIndex:-1,className:"recharts-pie-sector"},_l(s.props,f,m),{key:"sector-".concat(f?.startAngle,"-").concat(f?.endAngle,"-").concat(f.midAngle,"-").concat(m)}),Q.createElement(wz,Dc({option:x,isActive:p,shapeType:"sector"},j)))})}},{key:"renderSectorsWithAnimation",value:function(){var r=this,s=this.props,o=s.sectors,i=s.isAnimationActive,c=s.animationBegin,d=s.animationDuration,f=s.animationEasing,m=s.animationId,p=this.state,v=p.prevSectors,x=p.prevIsAnimationActive;return Q.createElement(Xs,{begin:c,duration:d,isActive:i,easing:f,from:{t:0},to:{t:1},key:"pie-".concat(m,"-").concat(x),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(j){var y=j.t,b=[],S=o&&o[0],N=S.startAngle;return o.forEach(function(C,k){var A=v&&v[k],E=k>0?_a(C,"paddingAngle",0):0;if(A){var P=ja(A.endAngle-A.startAngle,C.endAngle-C.startAngle),O=_n(_n({},C),{},{startAngle:N+E,endAngle:N+P(y)+E});b.push(O),N=O.endAngle}else{var D=C.endAngle,K=C.startAngle,q=ja(0,D-K),B=q(y),Y=_n(_n({},C),{},{startAngle:N+E,endAngle:N+B+E});b.push(Y),N=Y.endAngle}}),Q.createElement(un,null,r.renderSectorsStatically(b))})}},{key:"attachKeyboardHandlers",value:function(r){var s=this;r.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var i=++s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[i].focus(),s.setState({sectorToFocus:i});break}case"ArrowRight":{var c=--s.state.sectorToFocus<0?s.sectorRefs.length-1:s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[c].focus(),s.setState({sectorToFocus:c});break}case"Escape":{s.sectorRefs[s.state.sectorToFocus].blur(),s.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,s=r.sectors,o=r.isAnimationActive,i=this.state.prevSectors;return o&&s&&s.length&&(!i||!xp(i,s))?this.renderSectorsWithAnimation():this.renderSectorsStatically(s)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,s=this.props,o=s.hide,i=s.sectors,c=s.className,d=s.label,f=s.cx,m=s.cy,p=s.innerRadius,v=s.outerRadius,x=s.isAnimationActive,j=this.state.isAnimationFinished;if(o||!i||!i.length||!rt(f)||!rt(m)||!rt(p)||!rt(v))return null;var y=Yt("recharts-pie",c);return Q.createElement(un,{tabIndex:this.props.rootTabIndex,className:y,ref:function(S){r.pieRef=S}},this.renderSectors(),d&&this.renderLabels(i),br.renderCallByParent(this.props,null,!1),(!x||j)&&Co.renderCallByParent(this.props,i,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return s.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:s.curSectors,isAnimationFinished:!0}:r.sectors!==s.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,s){return r>s?"start":r<s?"end":"middle"}},{key:"renderLabelLineItem",value:function(r,s,o){if(Q.isValidElement(r))return Q.cloneElement(r,s);if(Kt(r))return r(s);var i=Yt("recharts-pie-label-line",typeof r!="boolean"?r.className:"");return Q.createElement(Zm,Dc({},s,{key:o,type:"linear",className:i}))}},{key:"renderLabelItem",value:function(r,s,o){if(Q.isValidElement(r))return Q.cloneElement(r,s);var i=o;if(Kt(r)&&(i=r(s),Q.isValidElement(i)))return i;var c=Yt("recharts-pie-label-text",typeof r!="boolean"&&!Kt(r)?r.className:"");return Q.createElement(kl,Dc({},s,{alignmentBaseline:"middle",className:c}),i)}}])})(h.PureComponent);fm=Uo;qa(Uo,"displayName","Pie");qa(Uo,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!Wl.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});qa(Uo,"parseDeltaAngle",function(e,t){var n=Br(t-e),r=Math.min(Math.abs(t-e),360);return n*r});qa(Uo,"getRealPieData",function(e){var t=e.data,n=e.children,r=Mt(e,!1),s=ka(n,jv);return t&&t.length?t.map(function(o,i){return _n(_n(_n({payload:o},r),o),s&&s[i]&&s[i].props)}):s&&s.length?s.map(function(o){return _n(_n({},r),o.props)}):[]});qa(Uo,"parseCoordinateOfPie",function(e,t){var n=t.top,r=t.left,s=t.width,o=t.height,i=sz(s,o),c=r+qr(e.cx,s,s/2),d=n+qr(e.cy,o,o/2),f=qr(e.innerRadius,i,0),m=qr(e.outerRadius,i,i*.8),p=e.maxRadius||Math.sqrt(s*s+o*o)/2;return{cx:c,cy:d,innerRadius:f,outerRadius:m,maxRadius:p}});qa(Uo,"getComposedData",function(e){var t=e.item,n=e.offset,r=t.type.defaultProps!==void 0?_n(_n({},t.type.defaultProps),t.props):t.props,s=fm.getRealPieData(r);if(!s||!s.length)return null;var o=r.cornerRadius,i=r.startAngle,c=r.endAngle,d=r.paddingAngle,f=r.dataKey,m=r.nameKey,p=r.valueKey,v=r.tooltipType,x=Math.abs(r.minAngle),j=fm.parseCoordinateOfPie(r,n),y=fm.parseDeltaAngle(i,c),b=Math.abs(y),S=f;Gt(f)&&Gt(p)?(So(!1,`Use "dataKey" to specify the value of pie,
117
+ the props "valueKey" will be deprecated in 1.1.0`),S="value"):Gt(f)&&(So(!1,`Use "dataKey" to specify the value of pie,
118
+ the props "valueKey" will be deprecated in 1.1.0`),S=p);var N=s.filter(function(O){return ur(O,S,0)!==0}).length,C=(b>=360?N:N-1)*d,k=b-N*x-C,A=s.reduce(function(O,D){var K=ur(D,S,0);return O+(rt(K)?K:0)},0),E;if(A>0){var P;E=s.map(function(O,D){var K=ur(O,S,0),q=ur(O,m,D),B=(rt(K)?K:0)/A,Y;D?Y=P.endAngle+Br(y)*d*(K!==0?1:0):Y=i;var z=Y+Br(y)*((K!==0?x:0)+B*k),I=(Y+z)/2,T=(j.innerRadius+j.outerRadius)/2,V=[{name:q,value:K,payload:O,dataKey:S,type:v}],H=Pn(j.cx,j.cy,T,I);return P=_n(_n(_n({percent:B,cornerRadius:o,name:q,tooltipPayload:V,midAngle:I,middleRadius:T,tooltipPosition:H},O),j),{},{value:ur(O,S),startAngle:Y,endAngle:z,payload:O,paddingAngle:Br(y)*d}),P})}return _n(_n({},j),{},{sectors:E,data:s})});var tS,QI;function xfe(){if(QI)return tS;QI=1;var e=Math.ceil,t=Math.max;function n(r,s,o,i){for(var c=-1,d=t(e((s-r)/(o||1)),0),f=Array(d);d--;)f[i?d:++c]=r,r+=o;return f}return tS=n,tS}var nS,JI;function Nz(){if(JI)return nS;JI=1;var e=G4(),t=1/0,n=17976931348623157e292;function r(s){if(!s)return s===0?s:0;if(s=e(s),s===t||s===-t){var o=s<0?-1:1;return o*n}return s===s?s:0}return nS=r,nS}var rS,ZI;function yfe(){if(ZI)return rS;ZI=1;var e=xfe(),t=wv(),n=Nz();function r(s){return function(o,i,c){return c&&typeof c!="number"&&t(o,i,c)&&(i=c=void 0),o=n(o),i===void 0?(i=o,o=0):i=n(i),c=c===void 0?o<i?1:-1:n(c),e(o,i,c,s)}}return rS=r,rS}var aS,e$;function bfe(){if(e$)return aS;e$=1;var e=yfe(),t=e();return aS=t,aS}var wfe=bfe();const ug=xn(wfe);function zf(e){"@babel/helpers - typeof";return zf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zf(e)}function t$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function n$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?t$(Object(n),!0).forEach(function(r){Cz(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Cz(e,t,n){return t=jfe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jfe(e){var t=Sfe(e,"string");return zf(t)=="symbol"?t:t+""}function Sfe(e,t){if(zf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(zf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Nfe=["Webkit","Moz","O","ms"],Cfe=function(t,n){var r=t.replace(/(\w)/,function(o){return o.toUpperCase()}),s=Nfe.reduce(function(o,i){return n$(n$({},o),{},Cz({},i+r,n))},{});return s[t]=n,s};function fu(e){"@babel/helpers - typeof";return fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fu(e)}function dg(){return dg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},dg.apply(this,arguments)}function r$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function sS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?r$(Object(n),!0).forEach(function(r){ya(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a$(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,kz(r.key),r)}}function kfe(e,t,n){return t&&a$(e.prototype,t),n&&a$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Afe(e,t,n){return t=fg(t),Efe(e,_z()?Reflect.construct(t,n||[],fg(e).constructor):t.apply(e,n))}function Efe(e,t){if(t&&(fu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pfe(e)}function Pfe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_z=function(){return!!e})()}function fg(e){return fg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},fg(e)}function Rfe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&fN(e,t)}function fN(e,t){return fN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},fN(e,t)}function ya(e,t,n){return t=kz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kz(e){var t=Tfe(e,"string");return fu(t)=="symbol"?t:t+""}function Tfe(e,t){if(fu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(fu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ofe=function(t){var n=t.data,r=t.startIndex,s=t.endIndex,o=t.x,i=t.width,c=t.travellerWidth;if(!n||!n.length)return{};var d=n.length,f=Xd().domain(ug(0,d)).range([o,o+i-c]),m=f.domain().map(function(p){return f(p)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:f(r),endX:f(s),scale:f,scaleValues:m}},s$=function(t){return t.changedTouches&&!!t.changedTouches.length},pu=(function(e){function t(n){var r;return _fe(this,t),r=Afe(this,t,[n]),ya(r,"handleDrag",function(s){r.leaveTimer&&(clearTimeout(r.leaveTimer),r.leaveTimer=null),r.state.isTravellerMoving?r.handleTravellerMove(s):r.state.isSlideMoving&&r.handleSlideDrag(s)}),ya(r,"handleTouchMove",function(s){s.changedTouches!=null&&s.changedTouches.length>0&&r.handleDrag(s.changedTouches[0])}),ya(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var s=r.props,o=s.endIndex,i=s.onDragEnd,c=s.startIndex;i?.({endIndex:o,startIndex:c})}),r.detachDragEndListener()}),ya(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),ya(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),ya(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),ya(r,"handleSlideDragStart",function(s){var o=s$(s)?s.changedTouches[0]:s;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return Rfe(t,e),kfe(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var s=r.startX,o=r.endX,i=this.state.scaleValues,c=this.props,d=c.gap,f=c.data,m=f.length-1,p=Math.min(s,o),v=Math.max(s,o),x=t.getIndexInRange(i,p),j=t.getIndexInRange(i,v);return{startIndex:x-x%d,endIndex:j===m?m:j-j%d}}},{key:"getTextOfTick",value:function(r){var s=this.props,o=s.data,i=s.tickFormatter,c=s.dataKey,d=ur(o[r],c,r);return Kt(i)?i(d,r):d}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var s=this.state,o=s.slideMoveStartX,i=s.startX,c=s.endX,d=this.props,f=d.x,m=d.width,p=d.travellerWidth,v=d.startIndex,x=d.endIndex,j=d.onChange,y=r.pageX-o;y>0?y=Math.min(y,f+m-p-c,f+m-p-i):y<0&&(y=Math.max(y,f-i,f-c));var b=this.getIndex({startX:i+y,endX:c+y});(b.startIndex!==v||b.endIndex!==x)&&j&&j(b),this.setState({startX:i+y,endX:c+y,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,s){var o=s$(s)?s.changedTouches[0]:s;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var s=this.state,o=s.brushMoveStartX,i=s.movingTravellerId,c=s.endX,d=s.startX,f=this.state[i],m=this.props,p=m.x,v=m.width,x=m.travellerWidth,j=m.onChange,y=m.gap,b=m.data,S={startX:this.state.startX,endX:this.state.endX},N=r.pageX-o;N>0?N=Math.min(N,p+v-x-f):N<0&&(N=Math.max(N,p-f)),S[i]=f+N;var C=this.getIndex(S),k=C.startIndex,A=C.endIndex,E=function(){var O=b.length-1;return i==="startX"&&(c>d?k%y===0:A%y===0)||c<d&&A===O||i==="endX"&&(c>d?A%y===0:k%y===0)||c>d&&A===O};this.setState(ya(ya({},i,f+N),"brushMoveStartX",r.pageX),function(){j&&E()&&j(C)})}},{key:"handleTravellerMoveKeyboard",value:function(r,s){var o=this,i=this.state,c=i.scaleValues,d=i.startX,f=i.endX,m=this.state[s],p=c.indexOf(m);if(p!==-1){var v=p+r;if(!(v===-1||v>=c.length)){var x=c[v];s==="startX"&&x>=f||s==="endX"&&x<=d||this.setState(ya({},s,x),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,s=r.x,o=r.y,i=r.width,c=r.height,d=r.fill,f=r.stroke;return Q.createElement("rect",{stroke:f,fill:d,x:s,y:o,width:i,height:c})}},{key:"renderPanorama",value:function(){var r=this.props,s=r.x,o=r.y,i=r.width,c=r.height,d=r.data,f=r.children,m=r.padding,p=h.Children.only(f);return p?Q.cloneElement(p,{x:s,y:o,width:i,height:c,margin:m,compact:!0,data:d}):null}},{key:"renderTravellerLayer",value:function(r,s){var o,i,c=this,d=this.props,f=d.y,m=d.travellerWidth,p=d.height,v=d.traveller,x=d.ariaLabel,j=d.data,y=d.startIndex,b=d.endIndex,S=Math.max(r,this.props.x),N=sS(sS({},Mt(this.props,!1)),{},{x:S,y:f,width:m,height:p}),C=x||"Min value: ".concat((o=j[y])===null||o===void 0?void 0:o.name,", Max value: ").concat((i=j[b])===null||i===void 0?void 0:i.name);return Q.createElement(un,{tabIndex:0,role:"slider","aria-label":C,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[s],onTouchStart:this.travellerDragStartHandlers[s],onKeyDown:function(A){["ArrowLeft","ArrowRight"].includes(A.key)&&(A.preventDefault(),A.stopPropagation(),c.handleTravellerMoveKeyboard(A.key==="ArrowRight"?1:-1,s))},onFocus:function(){c.setState({isTravellerFocused:!0})},onBlur:function(){c.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(v,N))}},{key:"renderSlide",value:function(r,s){var o=this.props,i=o.y,c=o.height,d=o.stroke,f=o.travellerWidth,m=Math.min(r,s)+f,p=Math.max(Math.abs(s-r)-f,0);return Q.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:d,fillOpacity:.2,x:m,y:i,width:p,height:c})}},{key:"renderText",value:function(){var r=this.props,s=r.startIndex,o=r.endIndex,i=r.y,c=r.height,d=r.travellerWidth,f=r.stroke,m=this.state,p=m.startX,v=m.endX,x=5,j={pointerEvents:"none",fill:f};return Q.createElement(un,{className:"recharts-brush-texts"},Q.createElement(kl,dg({textAnchor:"end",verticalAnchor:"middle",x:Math.min(p,v)-x,y:i+c/2},j),this.getTextOfTick(s)),Q.createElement(kl,dg({textAnchor:"start",verticalAnchor:"middle",x:Math.max(p,v)+d+x,y:i+c/2},j),this.getTextOfTick(o)))}},{key:"render",value:function(){var r=this.props,s=r.data,o=r.className,i=r.children,c=r.x,d=r.y,f=r.width,m=r.height,p=r.alwaysShowText,v=this.state,x=v.startX,j=v.endX,y=v.isTextActive,b=v.isSlideMoving,S=v.isTravellerMoving,N=v.isTravellerFocused;if(!s||!s.length||!rt(c)||!rt(d)||!rt(f)||!rt(m)||f<=0||m<=0)return null;var C=Yt("recharts-brush",o),k=Q.Children.count(i)===1,A=Cfe("userSelect","none");return Q.createElement(un,{className:C,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:A},this.renderBackground(),k&&this.renderPanorama(),this.renderSlide(x,j),this.renderTravellerLayer(x,"startX"),this.renderTravellerLayer(j,"endX"),(y||b||S||N||p)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var s=r.x,o=r.y,i=r.width,c=r.height,d=r.stroke,f=Math.floor(o+c/2)-1;return Q.createElement(Q.Fragment,null,Q.createElement("rect",{x:s,y:o,width:i,height:c,fill:d,stroke:"none"}),Q.createElement("line",{x1:s+1,y1:f,x2:s+i-1,y2:f,fill:"none",stroke:"#fff"}),Q.createElement("line",{x1:s+1,y1:f+2,x2:s+i-1,y2:f+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,s){var o;return Q.isValidElement(r)?o=Q.cloneElement(r,s):Kt(r)?o=r(s):o=t.renderDefaultTraveller(s),o}},{key:"getDerivedStateFromProps",value:function(r,s){var o=r.data,i=r.width,c=r.x,d=r.travellerWidth,f=r.updateId,m=r.startIndex,p=r.endIndex;if(o!==s.prevData||f!==s.prevUpdateId)return sS({prevData:o,prevTravellerWidth:d,prevUpdateId:f,prevX:c,prevWidth:i},o&&o.length?Ofe({data:o,width:i,x:c,travellerWidth:d,startIndex:m,endIndex:p}):{scale:null,scaleValues:null});if(s.scale&&(i!==s.prevWidth||c!==s.prevX||d!==s.prevTravellerWidth)){s.scale.range([c,c+i-d]);var v=s.scale.domain().map(function(x){return s.scale(x)});return{prevData:o,prevTravellerWidth:d,prevUpdateId:f,prevX:c,prevWidth:i,startX:s.scale(r.startIndex),endX:s.scale(r.endIndex),scaleValues:v}}return null}},{key:"getIndexInRange",value:function(r,s){for(var o=r.length,i=0,c=o-1;c-i>1;){var d=Math.floor((i+c)/2);r[d]>s?c=d:i=d}return s>=r[c]?c:i}}])})(h.PureComponent);ya(pu,"displayName","Brush");ya(pu,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var oS,o$;function Mfe(){if(o$)return oS;o$=1;var e=c_();function t(n,r){var s;return e(n,function(o,i,c){return s=r(o,i,c),!s}),!!s}return oS=t,oS}var iS,i$;function Ife(){if(i$)return iS;i$=1;var e=C4(),t=Zs(),n=Mfe(),r=fa(),s=wv();function o(i,c,d){var f=r(i)?e:n;return d&&s(i,c,d)&&(c=void 0),f(i,t(c,3))}return iS=o,iS}var $fe=Ife();const Dfe=xn($fe);var Hs=function(t,n){var r=t.alwaysShow,s=t.ifOverflow;return r&&(s="extendDomain"),s===n},lS,l$;function Lfe(){if(l$)return lS;l$=1;var e=U4();function t(n,r,s){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:s,writable:!0}):n[r]=s}return lS=t,lS}var cS,c$;function Ffe(){if(c$)return cS;c$=1;var e=Lfe(),t=B4(),n=Zs();function r(s,o){var i={};return o=n(o,3),t(s,function(c,d,f){e(i,d,o(c,d,f))}),i}return cS=r,cS}var zfe=Ffe();const Bfe=xn(zfe);var uS,u$;function qfe(){if(u$)return uS;u$=1;function e(t,n){for(var r=-1,s=t==null?0:t.length;++r<s;)if(!n(t[r],r,t))return!1;return!0}return uS=e,uS}var dS,d$;function Ufe(){if(d$)return dS;d$=1;var e=c_();function t(n,r){var s=!0;return e(n,function(o,i,c){return s=!!r(o,i,c),s}),s}return dS=t,dS}var fS,f$;function Wfe(){if(f$)return fS;f$=1;var e=qfe(),t=Ufe(),n=Zs(),r=fa(),s=wv();function o(i,c,d){var f=r(i)?e:t;return d&&s(i,c,d)&&(c=void 0),f(i,n(c,3))}return fS=o,fS}var Hfe=Wfe();const Vfe=xn(Hfe);var Kfe=["x","y"];function Bf(e){"@babel/helpers - typeof";return Bf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bf(e)}function pN(){return pN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pN.apply(this,arguments)}function p$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Dd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?p$(Object(n),!0).forEach(function(r){Gfe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Gfe(e,t,n){return t=Yfe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yfe(e){var t=Xfe(e,"string");return Bf(t)=="symbol"?t:t+""}function Xfe(e,t){if(Bf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Bf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qfe(e,t){if(e==null)return{};var n=Jfe(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Jfe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Zfe(e,t){var n=e.x,r=e.y,s=Qfe(e,Kfe),o="".concat(n),i=parseInt(o,10),c="".concat(r),d=parseInt(c,10),f="".concat(t.height||s.height),m=parseInt(f,10),p="".concat(t.width||s.width),v=parseInt(p,10);return Dd(Dd(Dd(Dd(Dd({},t),s),i?{x:i}:{}),d?{y:d}:{}),{},{height:m,width:v,name:t.name,radius:t.radius})}function h$(e){return Q.createElement(wz,pN({shapeType:"rectangle",propTransformer:Zfe,activeClassName:"recharts-active-bar"},e))}var epe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,s){if(typeof t=="number")return t;var o=rt(r)||yZ(r);return o?t(r,s):(o||El(),n)}},tpe=["value","background"],Az;function hu(e){"@babel/helpers - typeof";return hu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hu(e)}function npe(e,t){if(e==null)return{};var n=rpe(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function rpe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function pg(){return pg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pg.apply(this,arguments)}function m$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function tr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?m$(Object(n),!0).forEach(function(r){xi(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ape(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g$(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Pz(r.key),r)}}function spe(e,t,n){return t&&g$(e.prototype,t),n&&g$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ope(e,t,n){return t=hg(t),ipe(e,Ez()?Reflect.construct(t,n||[],hg(e).constructor):t.apply(e,n))}function ipe(e,t){if(t&&(hu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return lpe(e)}function lpe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ez(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ez=function(){return!!e})()}function hg(e){return hg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},hg(e)}function cpe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&hN(e,t)}function hN(e,t){return hN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},hN(e,t)}function xi(e,t,n){return t=Pz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pz(e){var t=upe(e,"string");return hu(t)=="symbol"?t:t+""}function upe(e,t){if(hu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Gl=(function(e){function t(){var n;ape(this,t);for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return n=ope(this,t,[].concat(s)),xi(n,"state",{isAnimationFinished:!1}),xi(n,"id",Du("recharts-bar-")),xi(n,"handleAnimationEnd",function(){var i=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),i&&i()}),xi(n,"handleAnimationStart",function(){var i=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),i&&i()}),n}return cpe(t,e),spe(t,[{key:"renderRectanglesStatically",value:function(r){var s=this,o=this.props,i=o.shape,c=o.dataKey,d=o.activeIndex,f=o.activeBar,m=Mt(this.props,!1);return r&&r.map(function(p,v){var x=v===d,j=x?f:i,y=tr(tr(tr({},m),p),{},{isActive:x,option:j,index:v,dataKey:c,onAnimationStart:s.handleAnimationStart,onAnimationEnd:s.handleAnimationEnd});return Q.createElement(un,pg({className:"recharts-bar-rectangle"},_l(s.props,p,v),{key:"rectangle-".concat(p?.x,"-").concat(p?.y,"-").concat(p?.value,"-").concat(v)}),Q.createElement(h$,y))})}},{key:"renderRectanglesWithAnimation",value:function(){var r=this,s=this.props,o=s.data,i=s.layout,c=s.isAnimationActive,d=s.animationBegin,f=s.animationDuration,m=s.animationEasing,p=s.animationId,v=this.state.prevData;return Q.createElement(Xs,{begin:d,duration:f,isActive:c,easing:m,from:{t:0},to:{t:1},key:"bar-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(x){var j=x.t,y=o.map(function(b,S){var N=v&&v[S];if(N){var C=ja(N.x,b.x),k=ja(N.y,b.y),A=ja(N.width,b.width),E=ja(N.height,b.height);return tr(tr({},b),{},{x:C(j),y:k(j),width:A(j),height:E(j)})}if(i==="horizontal"){var P=ja(0,b.height),O=P(j);return tr(tr({},b),{},{y:b.y+b.height-O,height:O})}var D=ja(0,b.width),K=D(j);return tr(tr({},b),{},{width:K})});return Q.createElement(un,null,r.renderRectanglesStatically(y))})}},{key:"renderRectangles",value:function(){var r=this.props,s=r.data,o=r.isAnimationActive,i=this.state.prevData;return o&&s&&s.length&&(!i||!xp(i,s))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(s)}},{key:"renderBackground",value:function(){var r=this,s=this.props,o=s.data,i=s.dataKey,c=s.activeIndex,d=Mt(this.props.background,!1);return o.map(function(f,m){f.value;var p=f.background,v=npe(f,tpe);if(!p)return null;var x=tr(tr(tr(tr(tr({},v),{},{fill:"#eee"},p),d),_l(r.props,f,m)),{},{onAnimationStart:r.handleAnimationStart,onAnimationEnd:r.handleAnimationEnd,dataKey:i,index:m,className:"recharts-bar-background-rectangle"});return Q.createElement(h$,pg({key:"background-bar-".concat(m),option:r.props.background,isActive:m===c},x))})}},{key:"renderErrorBar",value:function(r,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,i=o.data,c=o.xAxis,d=o.yAxis,f=o.layout,m=o.children,p=ka(m,yp);if(!p)return null;var v=f==="vertical"?i[0].height/2:i[0].width/2,x=function(b,S){var N=Array.isArray(b.value)?b.value[1]:b.value;return{x:b.x,y:b.y,value:N,errorVal:ur(b,S)}},j={clipPath:r?"url(#clipPath-".concat(s,")"):null};return Q.createElement(un,j,p.map(function(y){return Q.cloneElement(y,{key:"error-bar-".concat(s,"-").concat(y.props.dataKey),data:i,xAxis:c,yAxis:d,layout:f,offset:v,dataPointFormatter:x})}))}},{key:"render",value:function(){var r=this.props,s=r.hide,o=r.data,i=r.className,c=r.xAxis,d=r.yAxis,f=r.left,m=r.top,p=r.width,v=r.height,x=r.isAnimationActive,j=r.background,y=r.id;if(s||!o||!o.length)return null;var b=this.state.isAnimationFinished,S=Yt("recharts-bar",i),N=c&&c.allowDataOverflow,C=d&&d.allowDataOverflow,k=N||C,A=Gt(y)?this.id:y;return Q.createElement(un,{className:S},N||C?Q.createElement("defs",null,Q.createElement("clipPath",{id:"clipPath-".concat(A)},Q.createElement("rect",{x:N?f:f-p/2,y:C?m:m-v/2,width:N?p:p*2,height:C?v:v*2}))):null,Q.createElement(un,{className:"recharts-bar-rectangles",clipPath:k?"url(#clipPath-".concat(A,")"):null},j?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(k,A),(!x||b)&&Co.renderCallByParent(this.props,o))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curData:r.data,prevData:s.curData}:r.data!==s.curData?{curData:r.data}:null}}])})(h.PureComponent);Az=Gl;xi(Gl,"displayName","Bar");xi(Gl,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Wl.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});xi(Gl,"getComposedData",function(e){var t=e.props,n=e.item,r=e.barPosition,s=e.bandSize,o=e.xAxis,i=e.yAxis,c=e.xAxisTicks,d=e.yAxisTicks,f=e.stackedData,m=e.dataStartIndex,p=e.displayedData,v=e.offset,x=Mie(r,n);if(!x)return null;var j=t.layout,y=n.type.defaultProps,b=y!==void 0?tr(tr({},y),n.props):n.props,S=b.dataKey,N=b.children,C=b.minPointSize,k=j==="horizontal"?i:o,A=f?k.scale.domain():null,E=Bie({numericAxis:k}),P=ka(N,jv),O=p.map(function(D,K){var q,B,Y,z,I,T;f?q=Iie(f[m+K],A):(q=ur(D,S),Array.isArray(q)||(q=[E,q]));var V=epe(C,Az.defaultProps.minPointSize)(q[1],K);if(j==="horizontal"){var H,M=[i.scale(q[0]),i.scale(q[1])],X=M[0],$=M[1];B=WM({axis:o,ticks:c,bandSize:s,offset:x.offset,entry:D,index:K}),Y=(H=$??X)!==null&&H!==void 0?H:void 0,z=x.size;var F=X-$;if(I=Number.isNaN(F)?0:F,T={x:B,y:i.y,width:z,height:i.height},Math.abs(V)>0&&Math.abs(I)<Math.abs(V)){var G=Br(I||V)*(Math.abs(V)-Math.abs(I));Y-=G,I+=G}}else{var re=[o.scale(q[0]),o.scale(q[1])],oe=re[0],ue=re[1];if(B=oe,Y=WM({axis:i,ticks:d,bandSize:s,offset:x.offset,entry:D,index:K}),z=ue-oe,I=x.size,T={x:o.x,y:Y,width:o.width,height:I},Math.abs(V)>0&&Math.abs(z)<Math.abs(V)){var ae=Br(z||V)*(Math.abs(V)-Math.abs(z));z+=ae}}return tr(tr(tr({},D),{},{x:B,y:Y,width:z,height:I,value:f?q:q[1],payload:D,background:T},P&&P[K]&&P[K].props),{},{tooltipPayload:[rz(n,D)],tooltipPosition:{x:B+z/2,y:Y+I/2}})});return tr({data:O,layout:j},v)});function qf(e){"@babel/helpers - typeof";return qf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qf(e)}function dpe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v$(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Rz(r.key),r)}}function fpe(e,t,n){return t&&v$(e.prototype,t),n&&v$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function x$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ys(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?x$(Object(n),!0).forEach(function(r){Bv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Bv(e,t,n){return t=Rz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rz(e){var t=ppe(e,"string");return qf(t)=="symbol"?t:t+""}function ppe(e,t){if(qf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(qf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Tz=function(t,n,r,s,o){var i=t.width,c=t.height,d=t.layout,f=t.children,m=Object.keys(n),p={left:r.left,leftMirror:r.left,right:i-r.right,rightMirror:i-r.right,top:r.top,topMirror:r.top,bottom:c-r.bottom,bottomMirror:c-r.bottom},v=!!ba(f,Gl);return m.reduce(function(x,j){var y=n[j],b=y.orientation,S=y.domain,N=y.padding,C=N===void 0?{}:N,k=y.mirror,A=y.reversed,E="".concat(b).concat(k?"Mirror":""),P,O,D,K,q;if(y.type==="number"&&(y.padding==="gap"||y.padding==="no-gap")){var B=S[1]-S[0],Y=1/0,z=y.categoricalDomain.sort(jZ);if(z.forEach(function(re,oe){oe>0&&(Y=Math.min((re||0)-(z[oe-1]||0),Y))}),Number.isFinite(Y)){var I=Y/B,T=y.layout==="vertical"?r.height:r.width;if(y.padding==="gap"&&(P=I*T/2),y.padding==="no-gap"){var V=qr(t.barCategoryGap,I*T),H=I*T/2;P=H-V-(H-V)/T*V}}}s==="xAxis"?O=[r.left+(C.left||0)+(P||0),r.left+r.width-(C.right||0)-(P||0)]:s==="yAxis"?O=d==="horizontal"?[r.top+r.height-(C.bottom||0),r.top+(C.top||0)]:[r.top+(C.top||0)+(P||0),r.top+r.height-(C.bottom||0)-(P||0)]:O=y.range,A&&(O=[O[1],O[0]]);var M=ZF(y,o,v),X=M.scale,$=M.realScaleType;X.domain(S).range(O),ez(X);var F=tz(X,ys(ys({},y),{},{realScaleType:$}));s==="xAxis"?(q=b==="top"&&!k||b==="bottom"&&k,D=r.left,K=p[E]-q*y.height):s==="yAxis"&&(q=b==="left"&&!k||b==="right"&&k,D=p[E]-q*y.width,K=r.top);var G=ys(ys(ys({},y),F),{},{realScaleType:$,x:D,y:K,scale:X,width:s==="xAxis"?r.width:y.width,height:s==="yAxis"?r.height:y.height});return G.bandSize=Xm(G,F),!y.hide&&s==="xAxis"?p[E]+=(q?-1:1)*G.height:y.hide||(p[E]+=(q?-1:1)*G.width),ys(ys({},x),{},Bv({},j,G))},{})},Oz=function(t,n){var r=t.x,s=t.y,o=n.x,i=n.y;return{x:Math.min(r,o),y:Math.min(s,i),width:Math.abs(o-r),height:Math.abs(i-s)}},hpe=function(t){var n=t.x1,r=t.y1,s=t.x2,o=t.y2;return Oz({x:n,y:r},{x:s,y:o})},Mz=(function(){function e(t){dpe(this,e),this.scale=t}return fpe(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.bandAware,o=r.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+i}case"end":{var c=this.bandwidth?this.bandwidth():0;return this.scale(n)+c}default:return this.scale(n)}if(s){var d=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+d}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),s=r[0],o=r[r.length-1];return s<=o?n>=s&&n<=o:n>=o&&n<=s}}],[{key:"create",value:function(n){return new e(n)}}])})();Bv(Mz,"EPS",1e-4);var L_=function(t){var n=Object.keys(t).reduce(function(r,s){return ys(ys({},r),{},Bv({},s,Mz.create(t[s])))},{});return ys(ys({},n),{},{apply:function(s){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=o.bandAware,c=o.position;return Bfe(s,function(d,f){return n[f].apply(d,{bandAware:i,position:c})})},isInRange:function(s){return Vfe(s,function(o,i){return n[i].isInRange(o)})}})};function mpe(e){return(e%180+180)%180}var gpe=function(t){var n=t.width,r=t.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=mpe(s),i=o*Math.PI/180,c=Math.atan(r/n),d=i>c&&i<Math.PI-c?r/Math.sin(i):n/Math.cos(i);return Math.abs(d)},pS,y$;function vpe(){if(y$)return pS;y$=1;var e=Zs(),t=pp(),n=yv();function r(s){return function(o,i,c){var d=Object(o);if(!t(o)){var f=e(i,3);o=n(o),i=function(p){return f(d[p],p,d)}}var m=s(o,i,c);return m>-1?d[f?o[m]:m]:void 0}}return pS=r,pS}var hS,b$;function xpe(){if(b$)return hS;b$=1;var e=Nz();function t(n){var r=e(n),s=r%1;return r===r?s?r-s:r:0}return hS=t,hS}var mS,w$;function ype(){if(w$)return mS;w$=1;var e=$4(),t=Zs(),n=xpe(),r=Math.max;function s(o,i,c){var d=o==null?0:o.length;if(!d)return-1;var f=c==null?0:n(c);return f<0&&(f=r(d+f,0)),e(o,t(i,3),f)}return mS=s,mS}var gS,j$;function bpe(){if(j$)return gS;j$=1;var e=vpe(),t=ype(),n=e(t);return gS=n,gS}bpe();var wpe=JL();const jpe=xn(wpe);var Spe=jpe(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),Iz=h.createContext(void 0),$z=h.createContext(void 0),Dz=h.createContext(void 0),Npe=h.createContext({}),Lz=h.createContext(void 0),Fz=h.createContext(0),zz=h.createContext(0),S$=function(t){var n=t.state,r=n.xAxisMap,s=n.yAxisMap,o=n.offset,i=t.clipPathId,c=t.children,d=t.width,f=t.height,m=Spe(o);return Q.createElement(Iz.Provider,{value:r},Q.createElement($z.Provider,{value:s},Q.createElement(Npe.Provider,{value:o},Q.createElement(Dz.Provider,{value:m},Q.createElement(Lz.Provider,{value:i},Q.createElement(Fz.Provider,{value:f},Q.createElement(zz.Provider,{value:d},c)))))))},Cpe=function(){return h.useContext(Lz)},Bz=function(t){var n=h.useContext(Iz);n==null&&El();var r=n[t];return r==null&&El(),r},qz=function(t){var n=h.useContext($z);n==null&&El();var r=n[t];return r==null&&El(),r},_pe=function(){var t=h.useContext(Dz);return t},Uz=function(){return h.useContext(zz)},Wz=function(){return h.useContext(Fz)};function mu(e){"@babel/helpers - typeof";return mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mu(e)}function kpe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ape(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Vz(r.key),r)}}function Epe(e,t,n){return t&&Ape(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ppe(e,t,n){return t=mg(t),Rpe(e,Hz()?Reflect.construct(t,n||[],mg(e).constructor):t.apply(e,n))}function Rpe(e,t){if(t&&(mu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Tpe(e)}function Tpe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Hz=function(){return!!e})()}function mg(e){return mg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},mg(e)}function Ope(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&mN(e,t)}function mN(e,t){return mN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},mN(e,t)}function N$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function C$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?N$(Object(n),!0).forEach(function(r){F_(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function F_(e,t,n){return t=Vz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vz(e){var t=Mpe(e,"string");return mu(t)=="symbol"?t:t+""}function Mpe(e,t){if(mu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(mu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Ipe(e,t){return Fpe(e)||Lpe(e,t)||Dpe(e,t)||$pe()}function $pe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
119
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dpe(e,t){if(e){if(typeof e=="string")return _$(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _$(e,t)}}function _$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Lpe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,c=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);d=!0);}catch(m){f=!0,s=m}finally{try{if(!d&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw s}}return c}}function Fpe(e){if(Array.isArray(e))return e}function gN(){return gN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gN.apply(this,arguments)}var zpe=function(t,n){var r;return Q.isValidElement(t)?r=Q.cloneElement(t,n):Kt(t)?r=t(n):r=Q.createElement("line",gN({},n,{className:"recharts-reference-line-line"})),r},Bpe=function(t,n,r,s,o,i,c,d,f){var m=o.x,p=o.y,v=o.width,x=o.height;if(r){var j=f.y,y=t.y.apply(j,{position:i});if(Hs(f,"discard")&&!t.y.isInRange(y))return null;var b=[{x:m+v,y},{x:m,y}];return d==="left"?b.reverse():b}if(n){var S=f.x,N=t.x.apply(S,{position:i});if(Hs(f,"discard")&&!t.x.isInRange(N))return null;var C=[{x:N,y:p+x},{x:N,y:p}];return c==="top"?C.reverse():C}if(s){var k=f.segment,A=k.map(function(E){return t.apply(E,{position:i})});return Hs(f,"discard")&&Dfe(A,function(E){return!t.isInRange(E)})?null:A}return null};function qpe(e){var t=e.x,n=e.y,r=e.segment,s=e.xAxisId,o=e.yAxisId,i=e.shape,c=e.className,d=e.alwaysShow,f=Cpe(),m=Bz(s),p=qz(o),v=_pe();if(!f||!v)return null;So(d===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var x=L_({x:m.scale,y:p.scale}),j=dr(t),y=dr(n),b=r&&r.length===2,S=Bpe(x,j,y,b,v,e.position,m.orientation,p.orientation,e);if(!S)return null;var N=Ipe(S,2),C=N[0],k=C.x,A=C.y,E=N[1],P=E.x,O=E.y,D=Hs(e,"hidden")?"url(#".concat(f,")"):void 0,K=C$(C$({clipPath:D},Mt(e,!0)),{},{x1:k,y1:A,x2:P,y2:O});return Q.createElement(un,{className:Yt("recharts-reference-line",c)},zpe(i,K),br.renderCallByParent(e,hpe({x1:k,y1:A,x2:P,y2:O})))}var z_=(function(e){function t(){return kpe(this,t),Ppe(this,t,arguments)}return Ope(t,e),Epe(t,[{key:"render",value:function(){return Q.createElement(qpe,this.props)}}])})(Q.Component);F_(z_,"displayName","ReferenceLine");F_(z_,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function vN(){return vN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vN.apply(this,arguments)}function gu(e){"@babel/helpers - typeof";return gu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gu(e)}function k$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function A$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?k$(Object(n),!0).forEach(function(r){qv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Upe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wpe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Gz(r.key),r)}}function Hpe(e,t,n){return t&&Wpe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vpe(e,t,n){return t=gg(t),Kpe(e,Kz()?Reflect.construct(t,n||[],gg(e).constructor):t.apply(e,n))}function Kpe(e,t){if(t&&(gu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gpe(e)}function Gpe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Kz=function(){return!!e})()}function gg(e){return gg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},gg(e)}function Ype(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xN(e,t)}function xN(e,t){return xN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},xN(e,t)}function qv(e,t,n){return t=Gz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gz(e){var t=Xpe(e,"string");return gu(t)=="symbol"?t:t+""}function Xpe(e,t){if(gu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(gu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Qpe=function(t){var n=t.x,r=t.y,s=t.xAxis,o=t.yAxis,i=L_({x:s.scale,y:o.scale}),c=i.apply({x:n,y:r},{bandAware:!0});return Hs(t,"discard")&&!i.isInRange(c)?null:c},Uv=(function(e){function t(){return Upe(this,t),Vpe(this,t,arguments)}return Ype(t,e),Hpe(t,[{key:"render",value:function(){var r=this.props,s=r.x,o=r.y,i=r.r,c=r.alwaysShow,d=r.clipPathId,f=dr(s),m=dr(o);if(So(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!f||!m)return null;var p=Qpe(this.props);if(!p)return null;var v=p.x,x=p.y,j=this.props,y=j.shape,b=j.className,S=Hs(this.props,"hidden")?"url(#".concat(d,")"):void 0,N=A$(A$({clipPath:S},Mt(this.props,!0)),{},{cx:v,cy:x});return Q.createElement(un,{className:Yt("recharts-reference-dot",b)},t.renderDot(y,N),br.renderCallByParent(this.props,{x:v-i,y:x-i,width:2*i,height:2*i}))}}])})(Q.Component);qv(Uv,"displayName","ReferenceDot");qv(Uv,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});qv(Uv,"renderDot",function(e,t){var n;return Q.isValidElement(e)?n=Q.cloneElement(e,t):Kt(e)?n=e(t):n=Q.createElement(Mv,vN({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),n});function yN(){return yN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yN.apply(this,arguments)}function vu(e){"@babel/helpers - typeof";return vu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vu(e)}function E$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function P$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?E$(Object(n),!0).forEach(function(r){Wv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Jpe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zpe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Xz(r.key),r)}}function ehe(e,t,n){return t&&Zpe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function the(e,t,n){return t=vg(t),nhe(e,Yz()?Reflect.construct(t,n||[],vg(e).constructor):t.apply(e,n))}function nhe(e,t){if(t&&(vu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rhe(e)}function rhe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Yz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Yz=function(){return!!e})()}function vg(e){return vg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},vg(e)}function ahe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&bN(e,t)}function bN(e,t){return bN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},bN(e,t)}function Wv(e,t,n){return t=Xz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xz(e){var t=she(e,"string");return vu(t)=="symbol"?t:t+""}function she(e,t){if(vu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(vu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ohe=function(t,n,r,s,o){var i=o.x1,c=o.x2,d=o.y1,f=o.y2,m=o.xAxis,p=o.yAxis;if(!m||!p)return null;var v=L_({x:m.scale,y:p.scale}),x={x:t?v.x.apply(i,{position:"start"}):v.x.rangeMin,y:r?v.y.apply(d,{position:"start"}):v.y.rangeMin},j={x:n?v.x.apply(c,{position:"end"}):v.x.rangeMax,y:s?v.y.apply(f,{position:"end"}):v.y.rangeMax};return Hs(o,"discard")&&(!v.isInRange(x)||!v.isInRange(j))?null:Oz(x,j)},Hv=(function(e){function t(){return Jpe(this,t),the(this,t,arguments)}return ahe(t,e),ehe(t,[{key:"render",value:function(){var r=this.props,s=r.x1,o=r.x2,i=r.y1,c=r.y2,d=r.className,f=r.alwaysShow,m=r.clipPathId;So(f===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var p=dr(s),v=dr(o),x=dr(i),j=dr(c),y=this.props.shape;if(!p&&!v&&!x&&!j&&!y)return null;var b=ohe(p,v,x,j,this.props);if(!b&&!y)return null;var S=Hs(this.props,"hidden")?"url(#".concat(m,")"):void 0;return Q.createElement(un,{className:Yt("recharts-reference-area",d)},t.renderRect(y,P$(P$({clipPath:S},Mt(this.props,!0)),b)),br.renderCallByParent(this.props,b))}}])})(Q.Component);Wv(Hv,"displayName","ReferenceArea");Wv(Hv,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});Wv(Hv,"renderRect",function(e,t){var n;return Q.isValidElement(e)?n=Q.cloneElement(e,t):Kt(e)?n=e(t):n=Q.createElement(D_,yN({},t,{className:"recharts-reference-area-rect"})),n});function Qz(e,t,n){if(t<1)return[];if(t===1&&n===void 0)return e;for(var r=[],s=0;s<e.length;s+=t)r.push(e[s]);return r}function ihe(e,t,n){var r={width:e.width+t.width,height:e.height+t.height};return gpe(r,n)}function lhe(e,t,n){var r=n==="width",s=e.x,o=e.y,i=e.width,c=e.height;return t===1?{start:r?s:o,end:r?s+i:o+c}:{start:r?s+i:o+c,end:r?s:o}}function xg(e,t,n,r,s){if(e*t<e*r||e*t>e*s)return!1;var o=n();return e*(t-e*o/2-r)>=0&&e*(t+e*o/2-s)<=0}function che(e,t){return Qz(e,t+1)}function uhe(e,t,n,r,s){for(var o=(r||[]).slice(),i=t.start,c=t.end,d=0,f=1,m=i,p=function(){var j=r?.[d];if(j===void 0)return{v:Qz(r,f)};var y=d,b,S=function(){return b===void 0&&(b=n(j,y)),b},N=j.coordinate,C=d===0||xg(e,N,S,m,c);C||(d=0,m=i,f+=1),C&&(m=N+e*(S()/2+s),d+=f)},v;f<=o.length;)if(v=p(),v)return v.v;return[]}function Uf(e){"@babel/helpers - typeof";return Uf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uf(e)}function R$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Or(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?R$(Object(n),!0).forEach(function(r){dhe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function dhe(e,t,n){return t=fhe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fhe(e){var t=phe(e,"string");return Uf(t)=="symbol"?t:t+""}function phe(e,t){if(Uf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Uf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hhe(e,t,n,r,s){for(var o=(r||[]).slice(),i=o.length,c=t.start,d=t.end,f=function(v){var x=o[v],j,y=function(){return j===void 0&&(j=n(x,v)),j};if(v===i-1){var b=e*(x.coordinate+e*y()/2-d);o[v]=x=Or(Or({},x),{},{tickCoord:b>0?x.coordinate-b*e:x.coordinate})}else o[v]=x=Or(Or({},x),{},{tickCoord:x.coordinate});var S=xg(e,x.tickCoord,y,c,d);S&&(d=x.tickCoord-e*(y()/2+s),o[v]=Or(Or({},x),{},{isShow:!0}))},m=i-1;m>=0;m--)f(m);return o}function mhe(e,t,n,r,s,o){var i=(r||[]).slice(),c=i.length,d=t.start,f=t.end;if(o){var m=r[c-1],p=n(m,c-1),v=e*(m.coordinate+e*p/2-f);i[c-1]=m=Or(Or({},m),{},{tickCoord:v>0?m.coordinate-v*e:m.coordinate});var x=xg(e,m.tickCoord,function(){return p},d,f);x&&(f=m.tickCoord-e*(p/2+s),i[c-1]=Or(Or({},m),{},{isShow:!0}))}for(var j=o?c-1:c,y=function(N){var C=i[N],k,A=function(){return k===void 0&&(k=n(C,N)),k};if(N===0){var E=e*(C.coordinate-e*A()/2-d);i[N]=C=Or(Or({},C),{},{tickCoord:E<0?C.coordinate-E*e:C.coordinate})}else i[N]=C=Or(Or({},C),{},{tickCoord:C.coordinate});var P=xg(e,C.tickCoord,A,d,f);P&&(d=C.tickCoord+e*(A()/2+s),i[N]=Or(Or({},C),{},{isShow:!0}))},b=0;b<j;b++)y(b);return i}function ghe(e,t,n){var r=e.tick,s=e.ticks,o=e.viewBox,i=e.minTickGap,c=e.orientation,d=e.interval,f=e.tickFormatter,m=e.unit,p=e.angle;if(!s||!s.length||!r)return[];if(rt(d)||Wl.isSsr)return che(s,typeof d=="number"&&rt(d)?d:0);var v=[],x=c==="top"||c==="bottom"?"width":"height",j=m&&x==="width"?Yd(m,{fontSize:t,letterSpacing:n}):{width:0,height:0},y=function(C,k){var A=Kt(f)?f(C.value,k):C.value;return x==="width"?ihe(Yd(A,{fontSize:t,letterSpacing:n}),j,p):Yd(A,{fontSize:t,letterSpacing:n})[x]},b=s.length>=2?Br(s[1].coordinate-s[0].coordinate):1,S=lhe(o,b,x);return d==="equidistantPreserveStart"?uhe(b,S,y,s,i):(d==="preserveStart"||d==="preserveStartEnd"?v=mhe(b,S,y,s,i,d==="preserveStartEnd"):v=hhe(b,S,y,s,i),v.filter(function(N){return N.isShow}))}var vhe=["viewBox"],xhe=["viewBox"],yhe=["ticks"];function xu(e){"@babel/helpers - typeof";return xu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xu(e)}function Lc(){return Lc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Lc.apply(this,arguments)}function T$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function lr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?T$(Object(n),!0).forEach(function(r){B_(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function vS(e,t){if(e==null)return{};var n=bhe(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function bhe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function whe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O$(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Zz(r.key),r)}}function jhe(e,t,n){return t&&O$(e.prototype,t),n&&O$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function She(e,t,n){return t=yg(t),Nhe(e,Jz()?Reflect.construct(t,n||[],yg(e).constructor):t.apply(e,n))}function Nhe(e,t){if(t&&(xu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Che(e)}function Che(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Jz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Jz=function(){return!!e})()}function yg(e){return yg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},yg(e)}function _he(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wN(e,t)}function wN(e,t){return wN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},wN(e,t)}function B_(e,t,n){return t=Zz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zz(e){var t=khe(e,"string");return xu(t)=="symbol"?t:t+""}function khe(e,t){if(xu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(xu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Vv=(function(e){function t(n){var r;return whe(this,t),r=She(this,t,[n]),r.state={fontSize:"",letterSpacing:""},r}return _he(t,e),jhe(t,[{key:"shouldComponentUpdate",value:function(r,s){var o=r.viewBox,i=vS(r,vhe),c=this.props,d=c.viewBox,f=vS(c,xhe);return!Wc(o,d)||!Wc(i,f)||!Wc(s,this.state)}},{key:"componentDidMount",value:function(){var r=this.layerReference;if(r){var s=r.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];s&&this.setState({fontSize:window.getComputedStyle(s).fontSize,letterSpacing:window.getComputedStyle(s).letterSpacing})}}},{key:"getTickLineCoord",value:function(r){var s=this.props,o=s.x,i=s.y,c=s.width,d=s.height,f=s.orientation,m=s.tickSize,p=s.mirror,v=s.tickMargin,x,j,y,b,S,N,C=p?-1:1,k=r.tickSize||m,A=rt(r.tickCoord)?r.tickCoord:r.coordinate;switch(f){case"top":x=j=r.coordinate,b=i+ +!p*d,y=b-C*k,N=y-C*v,S=A;break;case"left":y=b=r.coordinate,j=o+ +!p*c,x=j-C*k,S=x-C*v,N=A;break;case"right":y=b=r.coordinate,j=o+ +p*c,x=j+C*k,S=x+C*v,N=A;break;default:x=j=r.coordinate,b=i+ +p*d,y=b+C*k,N=y+C*v,S=A;break}return{line:{x1:x,y1:y,x2:j,y2:b},tick:{x:S,y:N}}}},{key:"getTickTextAnchor",value:function(){var r=this.props,s=r.orientation,o=r.mirror,i;switch(s){case"left":i=o?"start":"end";break;case"right":i=o?"end":"start";break;default:i="middle";break}return i}},{key:"getTickVerticalAnchor",value:function(){var r=this.props,s=r.orientation,o=r.mirror,i="end";switch(s){case"left":case"right":i="middle";break;case"top":i=o?"start":"end";break;default:i=o?"end":"start";break}return i}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.x,o=r.y,i=r.width,c=r.height,d=r.orientation,f=r.mirror,m=r.axisLine,p=lr(lr(lr({},Mt(this.props,!1)),Mt(m,!1)),{},{fill:"none"});if(d==="top"||d==="bottom"){var v=+(d==="top"&&!f||d==="bottom"&&f);p=lr(lr({},p),{},{x1:s,y1:o+v*c,x2:s+i,y2:o+v*c})}else{var x=+(d==="left"&&!f||d==="right"&&f);p=lr(lr({},p),{},{x1:s+x*i,y1:o,x2:s+x*i,y2:o+c})}return Q.createElement("line",Lc({},p,{className:Yt("recharts-cartesian-axis-line",_a(m,"className"))}))}},{key:"renderTicks",value:function(r,s,o){var i=this,c=this.props,d=c.tickLine,f=c.stroke,m=c.tick,p=c.tickFormatter,v=c.unit,x=ghe(lr(lr({},this.props),{},{ticks:r}),s,o),j=this.getTickTextAnchor(),y=this.getTickVerticalAnchor(),b=Mt(this.props,!1),S=Mt(m,!1),N=lr(lr({},b),{},{fill:"none"},Mt(d,!1)),C=x.map(function(k,A){var E=i.getTickLineCoord(k),P=E.line,O=E.tick,D=lr(lr(lr(lr({textAnchor:j,verticalAnchor:y},b),{},{stroke:"none",fill:f},S),O),{},{index:A,payload:k,visibleTicksCount:x.length,tickFormatter:p});return Q.createElement(un,Lc({className:"recharts-cartesian-axis-tick",key:"tick-".concat(k.value,"-").concat(k.coordinate,"-").concat(k.tickCoord)},_l(i.props,k,A)),d&&Q.createElement("line",Lc({},N,P,{className:Yt("recharts-cartesian-axis-tick-line",_a(d,"className"))})),m&&t.renderTickItem(m,D,"".concat(Kt(p)?p(k.value,A):k.value).concat(v||"")))});return Q.createElement("g",{className:"recharts-cartesian-axis-ticks"},C)}},{key:"render",value:function(){var r=this,s=this.props,o=s.axisLine,i=s.width,c=s.height,d=s.ticksGenerator,f=s.className,m=s.hide;if(m)return null;var p=this.props,v=p.ticks,x=vS(p,yhe),j=v;return Kt(d)&&(j=v&&v.length>0?d(this.props):d(x)),i<=0||c<=0||!j||!j.length?null:Q.createElement(un,{className:Yt("recharts-cartesian-axis",f),ref:function(b){r.layerReference=b}},o&&this.renderAxisLine(),this.renderTicks(j,this.state.fontSize,this.state.letterSpacing),br.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,s,o){var i,c=Yt(s.className,"recharts-cartesian-axis-tick-value");return Q.isValidElement(r)?i=Q.cloneElement(r,lr(lr({},s),{},{className:c})):Kt(r)?i=r(lr(lr({},s),{},{className:c})):i=Q.createElement(kl,Lc({},s,{className:"recharts-cartesian-axis-tick-value"}),o),i}}])})(h.Component);B_(Vv,"displayName","CartesianAxis");B_(Vv,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var Ahe=["type","layout","connectNulls","ref"],Ehe=["key"];function yu(e){"@babel/helpers - typeof";return yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yu(e)}function M$(e,t){if(e==null)return{};var n=Phe(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Phe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function tf(){return tf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tf.apply(this,arguments)}function I$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function xa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?I$(Object(n),!0).forEach(function(r){bs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Cc(e){return Mhe(e)||Ohe(e)||The(e)||Rhe()}function Rhe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
120
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function The(e,t){if(e){if(typeof e=="string")return jN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return jN(e,t)}}function Ohe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Mhe(e){if(Array.isArray(e))return jN(e)}function jN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ihe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $$(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,tB(r.key),r)}}function $he(e,t,n){return t&&$$(e.prototype,t),n&&$$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dhe(e,t,n){return t=bg(t),Lhe(e,eB()?Reflect.construct(t,n||[],bg(e).constructor):t.apply(e,n))}function Lhe(e,t){if(t&&(yu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fhe(e)}function Fhe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function eB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(eB=function(){return!!e})()}function bg(e){return bg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},bg(e)}function zhe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&SN(e,t)}function SN(e,t){return SN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},SN(e,t)}function bs(e,t,n){return t=tB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tB(e){var t=Bhe(e,"string");return yu(t)=="symbol"?t:t+""}function Bhe(e,t){if(yu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(yu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Pl=(function(e){function t(){var n;Ihe(this,t);for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return n=Dhe(this,t,[].concat(s)),bs(n,"state",{isAnimationFinished:!0,totalLength:0}),bs(n,"generateSimpleStrokeDasharray",function(i,c){return"".concat(c,"px ").concat(i-c,"px")}),bs(n,"getStrokeDasharray",function(i,c,d){var f=d.reduce(function(S,N){return S+N});if(!f)return n.generateSimpleStrokeDasharray(c,i);for(var m=Math.floor(i/f),p=i%f,v=c-i,x=[],j=0,y=0;j<d.length;y+=d[j],++j)if(y+d[j]>p){x=[].concat(Cc(d.slice(0,j)),[p-y]);break}var b=x.length%2===0?[0,v]:[v];return[].concat(Cc(t.repeat(d,m)),Cc(x),b).map(function(S){return"".concat(S,"px")}).join(", ")}),bs(n,"id",Du("recharts-line-")),bs(n,"pathRef",function(i){n.mainCurve=i}),bs(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),bs(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return zhe(t,e),$he(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,i=o.points,c=o.xAxis,d=o.yAxis,f=o.layout,m=o.children,p=ka(m,yp);if(!p)return null;var v=function(y,b){return{x:y.x,y:y.y,value:y.value,errorVal:ur(y.payload,b)}},x={clipPath:r?"url(#clipPath-".concat(s,")"):null};return Q.createElement(un,x,p.map(function(j){return Q.cloneElement(j,{key:"bar-".concat(j.props.dataKey),data:i,xAxis:c,yAxis:d,layout:f,dataPointFormatter:v})}))}},{key:"renderDots",value:function(r,s,o){var i=this.props.isAnimationActive;if(i&&!this.state.isAnimationFinished)return null;var c=this.props,d=c.dot,f=c.points,m=c.dataKey,p=Mt(this.props,!1),v=Mt(d,!0),x=f.map(function(y,b){var S=xa(xa(xa({key:"dot-".concat(b),r:3},p),v),{},{index:b,cx:y.x,cy:y.y,value:y.value,dataKey:m,payload:y.payload,points:f});return t.renderDotItem(d,S)}),j={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(o,")"):null};return Q.createElement(un,tf({className:"recharts-line-dots",key:"dots"},j),x)}},{key:"renderCurveStatically",value:function(r,s,o,i){var c=this.props,d=c.type,f=c.layout,m=c.connectNulls;c.ref;var p=M$(c,Ahe),v=xa(xa(xa({},Mt(p,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(o,")"):null,points:r},i),{},{type:d,layout:f,connectNulls:m});return Q.createElement(Zm,tf({},v,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,s){var o=this,i=this.props,c=i.points,d=i.strokeDasharray,f=i.isAnimationActive,m=i.animationBegin,p=i.animationDuration,v=i.animationEasing,x=i.animationId,j=i.animateNewValues,y=i.width,b=i.height,S=this.state,N=S.prevPoints,C=S.totalLength;return Q.createElement(Xs,{begin:m,duration:p,isActive:f,easing:v,from:{t:0},to:{t:1},key:"line-".concat(x),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(k){var A=k.t;if(N){var E=N.length/c.length,P=c.map(function(B,Y){var z=Math.floor(Y*E);if(N[z]){var I=N[z],T=ja(I.x,B.x),V=ja(I.y,B.y);return xa(xa({},B),{},{x:T(A),y:V(A)})}if(j){var H=ja(y*2,B.x),M=ja(b/2,B.y);return xa(xa({},B),{},{x:H(A),y:M(A)})}return xa(xa({},B),{},{x:B.x,y:B.y})});return o.renderCurveStatically(P,r,s)}var O=ja(0,C),D=O(A),K;if(d){var q="".concat(d).split(/[,\s]+/gim).map(function(B){return parseFloat(B)});K=o.getStrokeDasharray(D,C,q)}else K=o.generateSimpleStrokeDasharray(C,D);return o.renderCurveStatically(c,r,s,{strokeDasharray:K})})}},{key:"renderCurve",value:function(r,s){var o=this.props,i=o.points,c=o.isAnimationActive,d=this.state,f=d.prevPoints,m=d.totalLength;return c&&i&&i.length&&(!f&&m>0||!xp(f,i))?this.renderCurveWithAnimation(r,s):this.renderCurveStatically(i,r,s)}},{key:"render",value:function(){var r,s=this.props,o=s.hide,i=s.dot,c=s.points,d=s.className,f=s.xAxis,m=s.yAxis,p=s.top,v=s.left,x=s.width,j=s.height,y=s.isAnimationActive,b=s.id;if(o||!c||!c.length)return null;var S=this.state.isAnimationFinished,N=c.length===1,C=Yt("recharts-line",d),k=f&&f.allowDataOverflow,A=m&&m.allowDataOverflow,E=k||A,P=Gt(b)?this.id:b,O=(r=Mt(i,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},D=O.r,K=D===void 0?3:D,q=O.strokeWidth,B=q===void 0?2:q,Y=RZ(i)?i:{},z=Y.clipDot,I=z===void 0?!0:z,T=K*2+B;return Q.createElement(un,{className:C},k||A?Q.createElement("defs",null,Q.createElement("clipPath",{id:"clipPath-".concat(P)},Q.createElement("rect",{x:k?v:v-x/2,y:A?p:p-j/2,width:k?x:x*2,height:A?j:j*2})),!I&&Q.createElement("clipPath",{id:"clipPath-dots-".concat(P)},Q.createElement("rect",{x:v-T/2,y:p-T/2,width:x+T,height:j+T}))):null,!N&&this.renderCurve(E,P),this.renderErrorBar(E,P),(N||i)&&this.renderDots(E,I,P),(!y||S)&&Co.renderCallByParent(this.props,c))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:s.curPoints}:r.points!==s.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,s){for(var o=r.length%2!==0?[].concat(Cc(r),[0]):r,i=[],c=0;c<s;++c)i=[].concat(Cc(i),Cc(o));return i}},{key:"renderDotItem",value:function(r,s){var o;if(Q.isValidElement(r))o=Q.cloneElement(r,s);else if(Kt(r))o=r(s);else{var i=s.key,c=M$(s,Ehe),d=Yt("recharts-line-dot",typeof r!="boolean"?r.className:"");o=Q.createElement(Mv,tf({key:i},c,{className:d}))}return o}}])})(h.PureComponent);bs(Pl,"displayName","Line");bs(Pl,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Wl.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});bs(Pl,"getComposedData",function(e){var t=e.props,n=e.xAxis,r=e.yAxis,s=e.xAxisTicks,o=e.yAxisTicks,i=e.dataKey,c=e.bandSize,d=e.displayedData,f=e.offset,m=t.layout,p=d.map(function(v,x){var j=ur(v,i);return m==="horizontal"?{x:UM({axis:n,ticks:s,bandSize:c,entry:v,index:x}),y:Gt(j)?null:r.scale(j),value:j,payload:v}:{x:Gt(j)?null:n.scale(j),y:UM({axis:r,ticks:o,bandSize:c,entry:v,index:x}),value:j,payload:v}});return xa({points:p,layout:m},f)});function bu(e){"@babel/helpers - typeof";return bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bu(e)}function qhe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Uhe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,aB(r.key),r)}}function Whe(e,t,n){return t&&Uhe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Hhe(e,t,n){return t=wg(t),Vhe(e,nB()?Reflect.construct(t,n||[],wg(e).constructor):t.apply(e,n))}function Vhe(e,t){if(t&&(bu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Khe(e)}function Khe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nB=function(){return!!e})()}function wg(e){return wg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},wg(e)}function Ghe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&NN(e,t)}function NN(e,t){return NN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},NN(e,t)}function rB(e,t,n){return t=aB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aB(e){var t=Yhe(e,"string");return bu(t)=="symbol"?t:t+""}function Yhe(e,t){if(bu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(bu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function CN(){return CN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},CN.apply(this,arguments)}function Xhe(e){var t=e.xAxisId,n=Uz(),r=Wz(),s=Bz(t);return s==null?null:h.createElement(Vv,CN({},s,{className:Yt("recharts-".concat(s.axisType," ").concat(s.axisType),s.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(i){return pl(i,!0)}}))}var _i=(function(e){function t(){return qhe(this,t),Hhe(this,t,arguments)}return Ghe(t,e),Whe(t,[{key:"render",value:function(){return h.createElement(Xhe,this.props)}}])})(h.Component);rB(_i,"displayName","XAxis");rB(_i,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function wu(e){"@babel/helpers - typeof";return wu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wu(e)}function Qhe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jhe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,iB(r.key),r)}}function Zhe(e,t,n){return t&&Jhe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function eme(e,t,n){return t=jg(t),tme(e,sB()?Reflect.construct(t,n||[],jg(e).constructor):t.apply(e,n))}function tme(e,t){if(t&&(wu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return nme(e)}function nme(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sB=function(){return!!e})()}function jg(e){return jg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},jg(e)}function rme(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_N(e,t)}function _N(e,t){return _N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},_N(e,t)}function oB(e,t,n){return t=iB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iB(e){var t=ame(e,"string");return wu(t)=="symbol"?t:t+""}function ame(e,t){if(wu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(wu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function kN(){return kN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kN.apply(this,arguments)}var sme=function(t){var n=t.yAxisId,r=Uz(),s=Wz(),o=qz(n);return o==null?null:h.createElement(Vv,kN({},o,{className:Yt("recharts-".concat(o.axisType," ").concat(o.axisType),o.className),viewBox:{x:0,y:0,width:r,height:s},ticksGenerator:function(c){return pl(c,!0)}}))},ki=(function(e){function t(){return Qhe(this,t),eme(this,t,arguments)}return rme(t,e),Zhe(t,[{key:"render",value:function(){return h.createElement(sme,this.props)}}])})(h.Component);oB(ki,"displayName","YAxis");oB(ki,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function D$(e){return cme(e)||lme(e)||ime(e)||ome()}function ome(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
121
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ime(e,t){if(e){if(typeof e=="string")return AN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return AN(e,t)}}function lme(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function cme(e){if(Array.isArray(e))return AN(e)}function AN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var EN=function(t,n,r,s,o){var i=ka(t,z_),c=ka(t,Uv),d=[].concat(D$(i),D$(c)),f=ka(t,Hv),m="".concat(s,"Id"),p=s[0],v=n;if(d.length&&(v=d.reduce(function(y,b){if(b.props[m]===r&&Hs(b.props,"extendDomain")&&rt(b.props[p])){var S=b.props[p];return[Math.min(y[0],S),Math.max(y[1],S)]}return y},v)),f.length){var x="".concat(p,"1"),j="".concat(p,"2");v=f.reduce(function(y,b){if(b.props[m]===r&&Hs(b.props,"extendDomain")&&rt(b.props[x])&&rt(b.props[j])){var S=b.props[x],N=b.props[j];return[Math.min(y[0],S,N),Math.max(y[1],S,N)]}return y},v)}return o&&o.length&&(v=o.reduce(function(y,b){return rt(b)?[Math.min(y[0],b),Math.max(y[1],b)]:y},v)),v},xS={exports:{}},L$;function ume(){return L$||(L$=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(d,f,m){this.fn=d,this.context=f,this.once=m||!1}function o(d,f,m,p,v){if(typeof m!="function")throw new TypeError("The listener must be a function");var x=new s(m,p||d,v),j=n?n+f:f;return d._events[j]?d._events[j].fn?d._events[j]=[d._events[j],x]:d._events[j].push(x):(d._events[j]=x,d._eventsCount++),d}function i(d,f){--d._eventsCount===0?d._events=new r:delete d._events[f]}function c(){this._events=new r,this._eventsCount=0}c.prototype.eventNames=function(){var f=[],m,p;if(this._eventsCount===0)return f;for(p in m=this._events)t.call(m,p)&&f.push(n?p.slice(1):p);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(m)):f},c.prototype.listeners=function(f){var m=n?n+f:f,p=this._events[m];if(!p)return[];if(p.fn)return[p.fn];for(var v=0,x=p.length,j=new Array(x);v<x;v++)j[v]=p[v].fn;return j},c.prototype.listenerCount=function(f){var m=n?n+f:f,p=this._events[m];return p?p.fn?1:p.length:0},c.prototype.emit=function(f,m,p,v,x,j){var y=n?n+f:f;if(!this._events[y])return!1;var b=this._events[y],S=arguments.length,N,C;if(b.fn){switch(b.once&&this.removeListener(f,b.fn,void 0,!0),S){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,m),!0;case 3:return b.fn.call(b.context,m,p),!0;case 4:return b.fn.call(b.context,m,p,v),!0;case 5:return b.fn.call(b.context,m,p,v,x),!0;case 6:return b.fn.call(b.context,m,p,v,x,j),!0}for(C=1,N=new Array(S-1);C<S;C++)N[C-1]=arguments[C];b.fn.apply(b.context,N)}else{var k=b.length,A;for(C=0;C<k;C++)switch(b[C].once&&this.removeListener(f,b[C].fn,void 0,!0),S){case 1:b[C].fn.call(b[C].context);break;case 2:b[C].fn.call(b[C].context,m);break;case 3:b[C].fn.call(b[C].context,m,p);break;case 4:b[C].fn.call(b[C].context,m,p,v);break;default:if(!N)for(A=1,N=new Array(S-1);A<S;A++)N[A-1]=arguments[A];b[C].fn.apply(b[C].context,N)}}return!0},c.prototype.on=function(f,m,p){return o(this,f,m,p,!1)},c.prototype.once=function(f,m,p){return o(this,f,m,p,!0)},c.prototype.removeListener=function(f,m,p,v){var x=n?n+f:f;if(!this._events[x])return this;if(!m)return i(this,x),this;var j=this._events[x];if(j.fn)j.fn===m&&(!v||j.once)&&(!p||j.context===p)&&i(this,x);else{for(var y=0,b=[],S=j.length;y<S;y++)(j[y].fn!==m||v&&!j[y].once||p&&j[y].context!==p)&&b.push(j[y]);b.length?this._events[x]=b.length===1?b[0]:b:i(this,x)}return this},c.prototype.removeAllListeners=function(f){var m;return f?(m=n?n+f:f,this._events[m]&&i(this,m)):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,e.exports=c})(xS)),xS.exports}var dme=ume();const fme=xn(dme);var yS=new fme,bS="recharts.syncMouseEvents";function Wf(e){"@babel/helpers - typeof";return Wf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wf(e)}function pme(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hme(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,lB(r.key),r)}}function mme(e,t,n){return t&&hme(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function wS(e,t,n){return t=lB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lB(e){var t=gme(e,"string");return Wf(t)=="symbol"?t:t+""}function gme(e,t){if(Wf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Wf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var vme=(function(){function e(){pme(this,e),wS(this,"activeIndex",0),wS(this,"coordinateList",[]),wS(this,"layout","horizontal")}return mme(e,[{key:"setDetails",value:function(n){var r,s=n.coordinateList,o=s===void 0?null:s,i=n.container,c=i===void 0?null:i,d=n.layout,f=d===void 0?null:d,m=n.offset,p=m===void 0?null:m,v=n.mouseHandlerCallback,x=v===void 0?null:v;this.coordinateList=(r=o??this.coordinateList)!==null&&r!==void 0?r:[],this.container=c??this.container,this.layout=f??this.layout,this.offset=p??this.offset,this.mouseHandlerCallback=x??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var s=this.container.getBoundingClientRect(),o=s.x,i=s.y,c=s.height,d=this.coordinateList[this.activeIndex].coordinate,f=((n=window)===null||n===void 0?void 0:n.scrollX)||0,m=((r=window)===null||r===void 0?void 0:r.scrollY)||0,p=o+d+f,v=i+this.offset.top+c/2+m;this.mouseHandlerCallback({pageX:p,pageY:v})}}}])})();function xme(e,t,n){if(n==="number"&&t===!0&&Array.isArray(e)){var r=e?.[0],s=e?.[1];if(r&&s&&rt(r)&&rt(s))return!0}return!1}function yme(e,t,n,r){var s=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-s:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-s,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function cB(e){var t=e.cx,n=e.cy,r=e.radius,s=e.startAngle,o=e.endAngle,i=Pn(t,n,r,s),c=Pn(t,n,r,o);return{points:[i,c],cx:t,cy:n,radius:r,startAngle:s,endAngle:o}}function bme(e,t,n){var r,s,o,i;if(e==="horizontal")r=t.x,o=r,s=n.top,i=n.top+n.height;else if(e==="vertical")s=t.y,i=s,r=n.left,o=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var c=t.cx,d=t.cy,f=t.innerRadius,m=t.outerRadius,p=t.angle,v=Pn(c,d,f,p),x=Pn(c,d,m,p);r=v.x,s=v.y,o=x.x,i=x.y}else return cB(t);return[{x:r,y:s},{x:o,y:i}]}function Hf(e){"@babel/helpers - typeof";return Hf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hf(e)}function F$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Qh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?F$(Object(n),!0).forEach(function(r){wme(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function wme(e,t,n){return t=jme(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jme(e){var t=Sme(e,"string");return Hf(t)=="symbol"?t:t+""}function Sme(e,t){if(Hf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Hf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Nme(e){var t,n,r=e.element,s=e.tooltipEventType,o=e.isActive,i=e.activeCoordinate,c=e.activePayload,d=e.offset,f=e.activeTooltipIndex,m=e.tooltipAxisBandSize,p=e.layout,v=e.chartName,x=(t=r.props.cursor)!==null&&t!==void 0?t:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!x||!o||!i||v!=="ScatterChart"&&s!=="axis")return null;var j,y=Zm;if(v==="ScatterChart")j=i,y=ide;else if(v==="BarChart")j=yme(p,i,d,m),y=D_;else if(p==="radial"){var b=cB(i),S=b.cx,N=b.cy,C=b.radius,k=b.startAngle,A=b.endAngle;j={cx:S,cy:N,startAngle:k,endAngle:A,innerRadius:C,outerRadius:C},y=cz}else j={points:bme(p,i,d)},y=Zm;var E=Qh(Qh(Qh(Qh({stroke:"#ccc",pointerEvents:"none"},d),j),Mt(x,!1)),{},{payload:c,payloadIndex:f,className:Yt("recharts-tooltip-cursor",x.className)});return h.isValidElement(x)?h.cloneElement(x,E):h.createElement(y,E)}var Cme=["item"],_me=["children","className","width","height","style","compact","title","desc"];function ju(e){"@babel/helpers - typeof";return ju=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ju(e)}function Fc(){return Fc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fc.apply(this,arguments)}function z$(e,t){return Eme(e)||Ame(e,t)||dB(e,t)||kme()}function kme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
122
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ame(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,c=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);d=!0);}catch(m){f=!0,s=m}finally{try{if(!d&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw s}}return c}}function Eme(e){if(Array.isArray(e))return e}function B$(e,t){if(e==null)return{};var n=Pme(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Pme(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Rme(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tme(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,fB(r.key),r)}}function Ome(e,t,n){return t&&Tme(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mme(e,t,n){return t=Sg(t),Ime(e,uB()?Reflect.construct(t,n||[],Sg(e).constructor):t.apply(e,n))}function Ime(e,t){if(t&&(ju(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $me(e)}function $me(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uB=function(){return!!e})()}function Sg(e){return Sg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Sg(e)}function Dme(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&PN(e,t)}function PN(e,t){return PN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},PN(e,t)}function Su(e){return zme(e)||Fme(e)||dB(e)||Lme()}function Lme(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
123
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dB(e,t){if(e){if(typeof e=="string")return RN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return RN(e,t)}}function Fme(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function zme(e){if(Array.isArray(e))return RN(e)}function RN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function q$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?q$(Object(n),!0).forEach(function(r){It(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function It(e,t,n){return t=fB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fB(e){var t=Bme(e,"string");return ju(t)=="symbol"?t:t+""}function Bme(e,t){if(ju(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ju(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var qme={xAxis:["bottom","top"],yAxis:["left","right"]},Ume={width:"100%",height:"100%"},pB={x:0,y:0};function Jh(e){return e}var Wme=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},Hme=function(t,n,r,s){var o=n.find(function(m){return m&&m.index===r});if(o){if(t==="horizontal")return{x:o.coordinate,y:s.y};if(t==="vertical")return{x:s.x,y:o.coordinate};if(t==="centric"){var i=o.coordinate,c=s.radius;return Oe(Oe(Oe({},s),Pn(s.cx,s.cy,c,i)),{},{angle:i,radius:c})}var d=o.coordinate,f=s.angle;return Oe(Oe(Oe({},s),Pn(s.cx,s.cy,d,f)),{},{angle:f,radius:d})}return pB},Kv=function(t,n){var r=n.graphicalItems,s=n.dataStartIndex,o=n.dataEndIndex,i=(r??[]).reduce(function(c,d){var f=d.props.data;return f&&f.length?[].concat(Su(c),Su(f)):c},[]);return i.length>0?i:t&&t.length&&rt(s)&&rt(o)?t.slice(s,o+1):[]};function hB(e){return e==="number"?[0,"auto"]:void 0}var TN=function(t,n,r,s){var o=t.graphicalItems,i=t.tooltipAxis,c=Kv(n,t);return r<0||!o||!o.length||r>=c.length?null:o.reduce(function(d,f){var m,p=(m=f.props.data)!==null&&m!==void 0?m:n;p&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(p=p.slice(t.dataStartIndex,t.dataEndIndex+1));var v;if(i.dataKey&&!i.allowDuplicatedCategory){var x=p===void 0?c:p;v=Nm(x,i.dataKey,s)}else v=p&&p[r]||c[r];return v?[].concat(Su(d),[rz(f,v)]):d},[])},U$=function(t,n,r,s){var o=s||{x:t.chartX,y:t.chartY},i=Wme(o,r),c=t.orderedTooltipTicks,d=t.tooltipAxis,f=t.tooltipTicks,m=Aie(i,c,f,d);if(m>=0&&f){var p=f[m]&&f[m].value,v=TN(t,n,m,p),x=Hme(r,c,m,o);return{activeTooltipIndex:m,activeLabel:p,activePayload:v,activeCoordinate:x}}return null},Vme=function(t,n){var r=n.axes,s=n.graphicalItems,o=n.axisType,i=n.axisIdKey,c=n.stackGroups,d=n.dataStartIndex,f=n.dataEndIndex,m=t.layout,p=t.children,v=t.stackOffset,x=JF(m,o);return r.reduce(function(j,y){var b,S=y.type.defaultProps!==void 0?Oe(Oe({},y.type.defaultProps),y.props):y.props,N=S.type,C=S.dataKey,k=S.allowDataOverflow,A=S.allowDuplicatedCategory,E=S.scale,P=S.ticks,O=S.includeHidden,D=S[i];if(j[D])return j;var K=Kv(t.data,{graphicalItems:s.filter(function(F){var G,re=i in F.props?F.props[i]:(G=F.type.defaultProps)===null||G===void 0?void 0:G[i];return re===D}),dataStartIndex:d,dataEndIndex:f}),q=K.length,B,Y,z;xme(S.domain,k,N)&&(B=V1(S.domain,null,k),x&&(N==="number"||E!=="auto")&&(z=Qd(K,C,"category")));var I=hB(N);if(!B||B.length===0){var T,V=(T=S.domain)!==null&&T!==void 0?T:I;if(C){if(B=Qd(K,C,N),N==="category"&&x){var H=wZ(B);A&&H?(Y=B,B=ug(0,q)):A||(B=KM(V,B,y).reduce(function(F,G){return F.indexOf(G)>=0?F:[].concat(Su(F),[G])},[]))}else if(N==="category")A?B=B.filter(function(F){return F!==""&&!Gt(F)}):B=KM(V,B,y).reduce(function(F,G){return F.indexOf(G)>=0||G===""||Gt(G)?F:[].concat(Su(F),[G])},[]);else if(N==="number"){var M=Oie(K,s.filter(function(F){var G,re,oe=i in F.props?F.props[i]:(G=F.type.defaultProps)===null||G===void 0?void 0:G[i],ue="hide"in F.props?F.props.hide:(re=F.type.defaultProps)===null||re===void 0?void 0:re.hide;return oe===D&&(O||!ue)}),C,o,m);M&&(B=M)}x&&(N==="number"||E!=="auto")&&(z=Qd(K,C,"category"))}else x?B=ug(0,q):c&&c[D]&&c[D].hasStack&&N==="number"?B=v==="expand"?[0,1]:nz(c[D].stackGroups,d,f):B=QF(K,s.filter(function(F){var G=i in F.props?F.props[i]:F.type.defaultProps[i],re="hide"in F.props?F.props.hide:F.type.defaultProps.hide;return G===D&&(O||!re)}),N,m,!0);if(N==="number")B=EN(p,B,D,o,P),V&&(B=V1(V,B,k));else if(N==="category"&&V){var X=V,$=B.every(function(F){return X.indexOf(F)>=0});$&&(B=X)}}return Oe(Oe({},j),{},It({},D,Oe(Oe({},S),{},{axisType:o,domain:B,categoricalDomain:z,duplicateDomain:Y,originalDomain:(b=S.domain)!==null&&b!==void 0?b:I,isCategorical:x,layout:m})))},{})},Kme=function(t,n){var r=n.graphicalItems,s=n.Axis,o=n.axisType,i=n.axisIdKey,c=n.stackGroups,d=n.dataStartIndex,f=n.dataEndIndex,m=t.layout,p=t.children,v=Kv(t.data,{graphicalItems:r,dataStartIndex:d,dataEndIndex:f}),x=v.length,j=JF(m,o),y=-1;return r.reduce(function(b,S){var N=S.type.defaultProps!==void 0?Oe(Oe({},S.type.defaultProps),S.props):S.props,C=N[i],k=hB("number");if(!b[C]){y++;var A;return j?A=ug(0,x):c&&c[C]&&c[C].hasStack?(A=nz(c[C].stackGroups,d,f),A=EN(p,A,C,o)):(A=V1(k,QF(v,r.filter(function(E){var P,O,D=i in E.props?E.props[i]:(P=E.type.defaultProps)===null||P===void 0?void 0:P[i],K="hide"in E.props?E.props.hide:(O=E.type.defaultProps)===null||O===void 0?void 0:O.hide;return D===C&&!K}),"number",m),s.defaultProps.allowDataOverflow),A=EN(p,A,C,o)),Oe(Oe({},b),{},It({},C,Oe(Oe({axisType:o},s.defaultProps),{},{hide:!0,orientation:_a(qme,"".concat(o,".").concat(y%2),null),domain:A,originalDomain:k,isCategorical:j,layout:m})))}return b},{})},Gme=function(t,n){var r=n.axisType,s=r===void 0?"xAxis":r,o=n.AxisComp,i=n.graphicalItems,c=n.stackGroups,d=n.dataStartIndex,f=n.dataEndIndex,m=t.children,p="".concat(s,"Id"),v=ka(m,o),x={};return v&&v.length?x=Vme(t,{axes:v,graphicalItems:i,axisType:s,axisIdKey:p,stackGroups:c,dataStartIndex:d,dataEndIndex:f}):i&&i.length&&(x=Kme(t,{Axis:o,graphicalItems:i,axisType:s,axisIdKey:p,stackGroups:c,dataStartIndex:d,dataEndIndex:f})),x},Yme=function(t){var n=Rc(t),r=pl(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:u_(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Xm(n,r)}},W$=function(t){var n=t.children,r=t.defaultShowTooltip,s=ba(n,pu),o=0,i=0;return t.data&&t.data.length!==0&&(i=t.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(o=s.props.startIndex),s.props.endIndex>=0&&(i=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:i,activeTooltipIndex:-1,isTooltipActive:!!r}},Xme=function(t){return!t||!t.length?!1:t.some(function(n){var r=jo(n&&n.type);return r&&r.indexOf("Bar")>=0})},H$=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Qme=function(t,n){var r=t.props,s=t.graphicalItems,o=t.xAxisMap,i=o===void 0?{}:o,c=t.yAxisMap,d=c===void 0?{}:c,f=r.width,m=r.height,p=r.children,v=r.margin||{},x=ba(p,pu),j=ba(p,gl),y=Object.keys(d).reduce(function(A,E){var P=d[E],O=P.orientation;return!P.mirror&&!P.hide?Oe(Oe({},A),{},It({},O,A[O]+P.width)):A},{left:v.left||0,right:v.right||0}),b=Object.keys(i).reduce(function(A,E){var P=i[E],O=P.orientation;return!P.mirror&&!P.hide?Oe(Oe({},A),{},It({},O,_a(A,"".concat(O))+P.height)):A},{top:v.top||0,bottom:v.bottom||0}),S=Oe(Oe({},b),y),N=S.bottom;x&&(S.bottom+=x.props.height||pu.defaultProps.height),j&&n&&(S=Rie(S,s,r,n));var C=f-S.left-S.right,k=m-S.top-S.bottom;return Oe(Oe({brushBottom:N},S),{},{width:Math.max(C,0),height:Math.max(k,0)})},Jme=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},q_=function(t){var n=t.chartName,r=t.GraphicalChild,s=t.defaultTooltipEventType,o=s===void 0?"axis":s,i=t.validateTooltipEventTypes,c=i===void 0?["axis"]:i,d=t.axisComponents,f=t.legendContent,m=t.formatAxisMap,p=t.defaultProps,v=function(S,N){var C=N.graphicalItems,k=N.stackGroups,A=N.offset,E=N.updateId,P=N.dataStartIndex,O=N.dataEndIndex,D=S.barSize,K=S.layout,q=S.barGap,B=S.barCategoryGap,Y=S.maxBarSize,z=H$(K),I=z.numericAxisName,T=z.cateAxisName,V=Xme(C),H=[];return C.forEach(function(M,X){var $=Kv(S.data,{graphicalItems:[M],dataStartIndex:P,dataEndIndex:O}),F=M.type.defaultProps!==void 0?Oe(Oe({},M.type.defaultProps),M.props):M.props,G=F.dataKey,re=F.maxBarSize,oe=F["".concat(I,"Id")],ue=F["".concat(T,"Id")],ae={},ye=d.reduce(function(Ee,Ze){var pt=N["".concat(Ze.axisType,"Map")],Lt=F["".concat(Ze.axisType,"Id")];pt&&pt[Lt]||Ze.axisType==="zAxis"||El();var Ut=pt[Lt];return Oe(Oe({},Ee),{},It(It({},Ze.axisType,Ut),"".concat(Ze.axisType,"Ticks"),pl(Ut)))},ae),se=ye[T],de=ye["".concat(T,"Ticks")],De=k&&k[oe]&&k[oe].hasStack&&qie(M,k[oe].stackGroups),ge=jo(M.type).indexOf("Bar")>=0,ve=Xm(se,de),Se=[],at=V&&Eie({barSize:D,stackGroups:k,totalSize:Jme(ye,T)});if(ge){var tt,it,kt=Gt(re)?Y:re,Ye=(tt=(it=Xm(se,de,!0))!==null&&it!==void 0?it:kt)!==null&&tt!==void 0?tt:0;Se=Pie({barGap:q,barCategoryGap:B,bandSize:Ye!==ve?Ye:ve,sizeList:at[ue],maxBarSize:kt}),Ye!==ve&&(Se=Se.map(function(Ee){return Oe(Oe({},Ee),{},{position:Oe(Oe({},Ee.position),{},{offset:Ee.position.offset-Ye/2})})}))}var _e=M&&M.type&&M.type.getComposedData;_e&&H.push({props:Oe(Oe({},_e(Oe(Oe({},ye),{},{displayedData:$,props:S,dataKey:G,item:M,bandSize:ve,barPosition:Se,offset:A,stackedData:De,layout:K,dataStartIndex:P,dataEndIndex:O}))),{},It(It(It({key:M.key||"item-".concat(X)},I,ye[I]),T,ye[T]),"animationId",E)),childIndex:MZ(M,S.children),item:M})}),H},x=function(S,N){var C=S.props,k=S.dataStartIndex,A=S.dataEndIndex,E=S.updateId;if(!iT({props:C}))return null;var P=C.children,O=C.layout,D=C.stackOffset,K=C.data,q=C.reverseStackOrder,B=H$(O),Y=B.numericAxisName,z=B.cateAxisName,I=ka(P,r),T=zie(K,I,"".concat(Y,"Id"),"".concat(z,"Id"),D,q),V=d.reduce(function(F,G){var re="".concat(G.axisType,"Map");return Oe(Oe({},F),{},It({},re,Gme(C,Oe(Oe({},G),{},{graphicalItems:I,stackGroups:G.axisType===Y&&T,dataStartIndex:k,dataEndIndex:A}))))},{}),H=Qme(Oe(Oe({},V),{},{props:C,graphicalItems:I}),N?.legendBBox);Object.keys(V).forEach(function(F){V[F]=m(C,V[F],H,F.replace("Map",""),n)});var M=V["".concat(z,"Map")],X=Yme(M),$=v(C,Oe(Oe({},V),{},{dataStartIndex:k,dataEndIndex:A,updateId:E,graphicalItems:I,stackGroups:T,offset:H}));return Oe(Oe({formattedGraphicalItems:$,graphicalItems:I,offset:H,stackGroups:T},X),V)},j=(function(b){function S(N){var C,k,A;return Rme(this,S),A=Mme(this,S,[N]),It(A,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),It(A,"accessibilityManager",new vme),It(A,"handleLegendBBoxUpdate",function(E){if(E){var P=A.state,O=P.dataStartIndex,D=P.dataEndIndex,K=P.updateId;A.setState(Oe({legendBBox:E},x({props:A.props,dataStartIndex:O,dataEndIndex:D,updateId:K},Oe(Oe({},A.state),{},{legendBBox:E}))))}}),It(A,"handleReceiveSyncEvent",function(E,P,O){if(A.props.syncId===E){if(O===A.eventEmitterSymbol&&typeof A.props.syncMethod!="function")return;A.applySyncEvent(P)}}),It(A,"handleBrushChange",function(E){var P=E.startIndex,O=E.endIndex;if(P!==A.state.dataStartIndex||O!==A.state.dataEndIndex){var D=A.state.updateId;A.setState(function(){return Oe({dataStartIndex:P,dataEndIndex:O},x({props:A.props,dataStartIndex:P,dataEndIndex:O,updateId:D},A.state))}),A.triggerSyncEvent({dataStartIndex:P,dataEndIndex:O})}}),It(A,"handleMouseEnter",function(E){var P=A.getMouseInfo(E);if(P){var O=Oe(Oe({},P),{},{isTooltipActive:!0});A.setState(O),A.triggerSyncEvent(O);var D=A.props.onMouseEnter;Kt(D)&&D(O,E)}}),It(A,"triggeredAfterMouseMove",function(E){var P=A.getMouseInfo(E),O=P?Oe(Oe({},P),{},{isTooltipActive:!0}):{isTooltipActive:!1};A.setState(O),A.triggerSyncEvent(O);var D=A.props.onMouseMove;Kt(D)&&D(O,E)}),It(A,"handleItemMouseEnter",function(E){A.setState(function(){return{isTooltipActive:!0,activeItem:E,activePayload:E.tooltipPayload,activeCoordinate:E.tooltipPosition||{x:E.cx,y:E.cy}}})}),It(A,"handleItemMouseLeave",function(){A.setState(function(){return{isTooltipActive:!1}})}),It(A,"handleMouseMove",function(E){E.persist(),A.throttleTriggeredAfterMouseMove(E)}),It(A,"handleMouseLeave",function(E){A.throttleTriggeredAfterMouseMove.cancel();var P={isTooltipActive:!1};A.setState(P),A.triggerSyncEvent(P);var O=A.props.onMouseLeave;Kt(O)&&O(P,E)}),It(A,"handleOuterEvent",function(E){var P=OZ(E),O=_a(A.props,"".concat(P));if(P&&Kt(O)){var D,K;/.*touch.*/i.test(P)?K=A.getMouseInfo(E.changedTouches[0]):K=A.getMouseInfo(E),O((D=K)!==null&&D!==void 0?D:{},E)}}),It(A,"handleClick",function(E){var P=A.getMouseInfo(E);if(P){var O=Oe(Oe({},P),{},{isTooltipActive:!0});A.setState(O),A.triggerSyncEvent(O);var D=A.props.onClick;Kt(D)&&D(O,E)}}),It(A,"handleMouseDown",function(E){var P=A.props.onMouseDown;if(Kt(P)){var O=A.getMouseInfo(E);P(O,E)}}),It(A,"handleMouseUp",function(E){var P=A.props.onMouseUp;if(Kt(P)){var O=A.getMouseInfo(E);P(O,E)}}),It(A,"handleTouchMove",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&A.throttleTriggeredAfterMouseMove(E.changedTouches[0])}),It(A,"handleTouchStart",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&A.handleMouseDown(E.changedTouches[0])}),It(A,"handleTouchEnd",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&A.handleMouseUp(E.changedTouches[0])}),It(A,"handleDoubleClick",function(E){var P=A.props.onDoubleClick;if(Kt(P)){var O=A.getMouseInfo(E);P(O,E)}}),It(A,"handleContextMenu",function(E){var P=A.props.onContextMenu;if(Kt(P)){var O=A.getMouseInfo(E);P(O,E)}}),It(A,"triggerSyncEvent",function(E){A.props.syncId!==void 0&&yS.emit(bS,A.props.syncId,E,A.eventEmitterSymbol)}),It(A,"applySyncEvent",function(E){var P=A.props,O=P.layout,D=P.syncMethod,K=A.state.updateId,q=E.dataStartIndex,B=E.dataEndIndex;if(E.dataStartIndex!==void 0||E.dataEndIndex!==void 0)A.setState(Oe({dataStartIndex:q,dataEndIndex:B},x({props:A.props,dataStartIndex:q,dataEndIndex:B,updateId:K},A.state)));else if(E.activeTooltipIndex!==void 0){var Y=E.chartX,z=E.chartY,I=E.activeTooltipIndex,T=A.state,V=T.offset,H=T.tooltipTicks;if(!V)return;if(typeof D=="function")I=D(H,E);else if(D==="value"){I=-1;for(var M=0;M<H.length;M++)if(H[M].value===E.activeLabel){I=M;break}}var X=Oe(Oe({},V),{},{x:V.left,y:V.top}),$=Math.min(Y,X.x+X.width),F=Math.min(z,X.y+X.height),G=H[I]&&H[I].value,re=TN(A.state,A.props.data,I),oe=H[I]?{x:O==="horizontal"?H[I].coordinate:$,y:O==="horizontal"?F:H[I].coordinate}:pB;A.setState(Oe(Oe({},E),{},{activeLabel:G,activeCoordinate:oe,activePayload:re,activeTooltipIndex:I}))}else A.setState(E)}),It(A,"renderCursor",function(E){var P,O=A.state,D=O.isTooltipActive,K=O.activeCoordinate,q=O.activePayload,B=O.offset,Y=O.activeTooltipIndex,z=O.tooltipAxisBandSize,I=A.getTooltipEventType(),T=(P=E.props.active)!==null&&P!==void 0?P:D,V=A.props.layout,H=E.key||"_recharts-cursor";return Q.createElement(Nme,{key:H,activeCoordinate:K,activePayload:q,activeTooltipIndex:Y,chartName:n,element:E,isActive:T,layout:V,offset:B,tooltipAxisBandSize:z,tooltipEventType:I})}),It(A,"renderPolarAxis",function(E,P,O){var D=_a(E,"type.axisType"),K=_a(A.state,"".concat(D,"Map")),q=E.type.defaultProps,B=q!==void 0?Oe(Oe({},q),E.props):E.props,Y=K&&K[B["".concat(D,"Id")]];return h.cloneElement(E,Oe(Oe({},Y),{},{className:Yt(D,Y.className),key:E.key||"".concat(P,"-").concat(O),ticks:pl(Y,!0)}))}),It(A,"renderPolarGrid",function(E){var P=E.props,O=P.radialLines,D=P.polarAngles,K=P.polarRadius,q=A.state,B=q.radiusAxisMap,Y=q.angleAxisMap,z=Rc(B),I=Rc(Y),T=I.cx,V=I.cy,H=I.innerRadius,M=I.outerRadius;return h.cloneElement(E,{polarAngles:Array.isArray(D)?D:pl(I,!0).map(function(X){return X.coordinate}),polarRadius:Array.isArray(K)?K:pl(z,!0).map(function(X){return X.coordinate}),cx:T,cy:V,innerRadius:H,outerRadius:M,key:E.key||"polar-grid",radialLines:O})}),It(A,"renderLegend",function(){var E=A.state.formattedGraphicalItems,P=A.props,O=P.children,D=P.width,K=P.height,q=A.props.margin||{},B=D-(q.left||0)-(q.right||0),Y=YF({children:O,formattedGraphicalItems:E,legendWidth:B,legendContent:f});if(!Y)return null;var z=Y.item,I=B$(Y,Cme);return h.cloneElement(z,Oe(Oe({},I),{},{chartWidth:D,chartHeight:K,margin:q,onBBoxUpdate:A.handleLegendBBoxUpdate}))}),It(A,"renderTooltip",function(){var E,P=A.props,O=P.children,D=P.accessibilityLayer,K=ba(O,aa);if(!K)return null;var q=A.state,B=q.isTooltipActive,Y=q.activeCoordinate,z=q.activePayload,I=q.activeLabel,T=q.offset,V=(E=K.props.active)!==null&&E!==void 0?E:B;return h.cloneElement(K,{viewBox:Oe(Oe({},T),{},{x:T.left,y:T.top}),active:V,label:I,payload:V?z:[],coordinate:Y,accessibilityLayer:D})}),It(A,"renderBrush",function(E){var P=A.props,O=P.margin,D=P.data,K=A.state,q=K.offset,B=K.dataStartIndex,Y=K.dataEndIndex,z=K.updateId;return h.cloneElement(E,{key:E.key||"_recharts-brush",onChange:Kh(A.handleBrushChange,E.props.onChange),data:D,x:rt(E.props.x)?E.props.x:q.left,y:rt(E.props.y)?E.props.y:q.top+q.height+q.brushBottom-(O.bottom||0),width:rt(E.props.width)?E.props.width:q.width,startIndex:B,endIndex:Y,updateId:"brush-".concat(z)})}),It(A,"renderReferenceElement",function(E,P,O){if(!E)return null;var D=A,K=D.clipPathId,q=A.state,B=q.xAxisMap,Y=q.yAxisMap,z=q.offset,I=E.type.defaultProps||{},T=E.props,V=T.xAxisId,H=V===void 0?I.xAxisId:V,M=T.yAxisId,X=M===void 0?I.yAxisId:M;return h.cloneElement(E,{key:E.key||"".concat(P,"-").concat(O),xAxis:B[H],yAxis:Y[X],viewBox:{x:z.left,y:z.top,width:z.width,height:z.height},clipPathId:K})}),It(A,"renderActivePoints",function(E){var P=E.item,O=E.activePoint,D=E.basePoint,K=E.childIndex,q=E.isRange,B=[],Y=P.props.key,z=P.item.type.defaultProps!==void 0?Oe(Oe({},P.item.type.defaultProps),P.item.props):P.item.props,I=z.activeDot,T=z.dataKey,V=Oe(Oe({index:K,dataKey:T,cx:O.x,cy:O.y,r:4,fill:$_(P.item),strokeWidth:2,stroke:"#fff",payload:O.payload,value:O.value},Mt(I,!1)),Cm(I));return B.push(S.renderActiveDot(I,V,"".concat(Y,"-activePoint-").concat(K))),D?B.push(S.renderActiveDot(I,Oe(Oe({},V),{},{cx:D.x,cy:D.y}),"".concat(Y,"-basePoint-").concat(K))):q&&B.push(null),B}),It(A,"renderGraphicChild",function(E,P,O){var D=A.filterFormatItem(E,P,O);if(!D)return null;var K=A.getTooltipEventType(),q=A.state,B=q.isTooltipActive,Y=q.tooltipAxis,z=q.activeTooltipIndex,I=q.activeLabel,T=A.props.children,V=ba(T,aa),H=D.props,M=H.points,X=H.isRange,$=H.baseLine,F=D.item.type.defaultProps!==void 0?Oe(Oe({},D.item.type.defaultProps),D.item.props):D.item.props,G=F.activeDot,re=F.hide,oe=F.activeBar,ue=F.activeShape,ae=!!(!re&&B&&V&&(G||oe||ue)),ye={};K!=="axis"&&V&&V.props.trigger==="click"?ye={onClick:Kh(A.handleItemMouseEnter,E.props.onClick)}:K!=="axis"&&(ye={onMouseLeave:Kh(A.handleItemMouseLeave,E.props.onMouseLeave),onMouseEnter:Kh(A.handleItemMouseEnter,E.props.onMouseEnter)});var se=h.cloneElement(E,Oe(Oe({},D.props),ye));function de(Ze){return typeof Y.dataKey=="function"?Y.dataKey(Ze.payload):null}if(ae)if(z>=0){var De,ge;if(Y.dataKey&&!Y.allowDuplicatedCategory){var ve=typeof Y.dataKey=="function"?de:"payload.".concat(Y.dataKey.toString());De=Nm(M,ve,I),ge=X&&$&&Nm($,ve,I)}else De=M?.[z],ge=X&&$&&$[z];if(ue||oe){var Se=E.props.activeIndex!==void 0?E.props.activeIndex:z;return[h.cloneElement(E,Oe(Oe(Oe({},D.props),ye),{},{activeIndex:Se})),null,null]}if(!Gt(De))return[se].concat(Su(A.renderActivePoints({item:D,activePoint:De,basePoint:ge,childIndex:z,isRange:X})))}else{var at,tt=(at=A.getItemByXY(A.state.activeCoordinate))!==null&&at!==void 0?at:{graphicalItem:se},it=tt.graphicalItem,kt=it.item,Ye=kt===void 0?E:kt,_e=it.childIndex,Ee=Oe(Oe(Oe({},D.props),ye),{},{activeIndex:_e});return[h.cloneElement(Ye,Ee),null,null]}return X?[se,null,null]:[se,null]}),It(A,"renderCustomized",function(E,P,O){return h.cloneElement(E,Oe(Oe({key:"recharts-customized-".concat(O)},A.props),A.state))}),It(A,"renderMap",{CartesianGrid:{handler:Jh,once:!0},ReferenceArea:{handler:A.renderReferenceElement},ReferenceLine:{handler:Jh},ReferenceDot:{handler:A.renderReferenceElement},XAxis:{handler:Jh},YAxis:{handler:Jh},Brush:{handler:A.renderBrush,once:!0},Bar:{handler:A.renderGraphicChild},Line:{handler:A.renderGraphicChild},Area:{handler:A.renderGraphicChild},Radar:{handler:A.renderGraphicChild},RadialBar:{handler:A.renderGraphicChild},Scatter:{handler:A.renderGraphicChild},Pie:{handler:A.renderGraphicChild},Funnel:{handler:A.renderGraphicChild},Tooltip:{handler:A.renderCursor,once:!0},PolarGrid:{handler:A.renderPolarGrid,once:!0},PolarAngleAxis:{handler:A.renderPolarAxis},PolarRadiusAxis:{handler:A.renderPolarAxis},Customized:{handler:A.renderCustomized}}),A.clipPathId="".concat((C=N.id)!==null&&C!==void 0?C:Du("recharts"),"-clip"),A.throttleTriggeredAfterMouseMove=Y4(A.triggeredAfterMouseMove,(k=N.throttleDelay)!==null&&k!==void 0?k:1e3/60),A.state={},A}return Dme(S,b),Ome(S,[{key:"componentDidMount",value:function(){var C,k;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(k=this.props.margin.top)!==null&&k!==void 0?k:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var C=this.props,k=C.children,A=C.data,E=C.height,P=C.layout,O=ba(k,aa);if(O){var D=O.props.defaultIndex;if(!(typeof D!="number"||D<0||D>this.state.tooltipTicks.length-1)){var K=this.state.tooltipTicks[D]&&this.state.tooltipTicks[D].value,q=TN(this.state,A,D,K),B=this.state.tooltipTicks[D].coordinate,Y=(this.state.offset.top+E)/2,z=P==="horizontal",I=z?{x:B,y:Y}:{y:B,x:Y},T=this.state.formattedGraphicalItems.find(function(H){var M=H.item;return M.type.name==="Scatter"});T&&(I=Oe(Oe({},I),T.props.points[D].tooltipPosition),q=T.props.points[D].tooltipPayload);var V={activeTooltipIndex:D,isTooltipActive:!0,activeLabel:K,activePayload:q,activeCoordinate:I};this.setState(V),this.renderCursor(O),this.accessibilityManager.setIndex(D)}}}},{key:"getSnapshotBeforeUpdate",value:function(C,k){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==k.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==C.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==C.margin){var A,E;this.accessibilityManager.setDetails({offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(E=this.props.margin.top)!==null&&E!==void 0?E:0}})}return null}},{key:"componentDidUpdate",value:function(C){h1([ba(C.children,aa)],[ba(this.props.children,aa)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var C=ba(this.props.children,aa);if(C&&typeof C.props.shared=="boolean"){var k=C.props.shared?"axis":"item";return c.indexOf(k)>=0?k:o}return o}},{key:"getMouseInfo",value:function(C){if(!this.container)return null;var k=this.container,A=k.getBoundingClientRect(),E=bre(A),P={chartX:Math.round(C.pageX-E.left),chartY:Math.round(C.pageY-E.top)},O=A.width/k.offsetWidth||1,D=this.inRange(P.chartX,P.chartY,O);if(!D)return null;var K=this.state,q=K.xAxisMap,B=K.yAxisMap,Y=this.getTooltipEventType(),z=U$(this.state,this.props.data,this.props.layout,D);if(Y!=="axis"&&q&&B){var I=Rc(q).scale,T=Rc(B).scale,V=I&&I.invert?I.invert(P.chartX):null,H=T&&T.invert?T.invert(P.chartY):null;return Oe(Oe({},P),{},{xValue:V,yValue:H},z)}return z?Oe(Oe({},P),z):null}},{key:"inRange",value:function(C,k){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,E=this.props.layout,P=C/A,O=k/A;if(E==="horizontal"||E==="vertical"){var D=this.state.offset,K=P>=D.left&&P<=D.left+D.width&&O>=D.top&&O<=D.top+D.height;return K?{x:P,y:O}:null}var q=this.state,B=q.angleAxisMap,Y=q.radiusAxisMap;if(B&&Y){var z=Rc(B);return XM({x:P,y:O},z)}return null}},{key:"parseEventsOfWrapper",value:function(){var C=this.props.children,k=this.getTooltipEventType(),A=ba(C,aa),E={};A&&k==="axis"&&(A.props.trigger==="click"?E={onClick:this.handleClick}:E={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var P=Cm(this.props,this.handleOuterEvent);return Oe(Oe({},P),E)}},{key:"addListener",value:function(){yS.on(bS,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){yS.removeListener(bS,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(C,k,A){for(var E=this.state.formattedGraphicalItems,P=0,O=E.length;P<O;P++){var D=E[P];if(D.item===C||D.props.key===C.key||k===jo(D.item.type)&&A===D.childIndex)return D}return null}},{key:"renderClipPath",value:function(){var C=this.clipPathId,k=this.state.offset,A=k.left,E=k.top,P=k.height,O=k.width;return Q.createElement("defs",null,Q.createElement("clipPath",{id:C},Q.createElement("rect",{x:A,y:E,height:P,width:O})))}},{key:"getXScales",value:function(){var C=this.state.xAxisMap;return C?Object.entries(C).reduce(function(k,A){var E=z$(A,2),P=E[0],O=E[1];return Oe(Oe({},k),{},It({},P,O.scale))},{}):null}},{key:"getYScales",value:function(){var C=this.state.yAxisMap;return C?Object.entries(C).reduce(function(k,A){var E=z$(A,2),P=E[0],O=E[1];return Oe(Oe({},k),{},It({},P,O.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(C){var k;return(k=this.state.xAxisMap)===null||k===void 0||(k=k[C])===null||k===void 0?void 0:k.scale}},{key:"getYScaleByAxisId",value:function(C){var k;return(k=this.state.yAxisMap)===null||k===void 0||(k=k[C])===null||k===void 0?void 0:k.scale}},{key:"getItemByXY",value:function(C){var k=this.state,A=k.formattedGraphicalItems,E=k.activeItem;if(A&&A.length)for(var P=0,O=A.length;P<O;P++){var D=A[P],K=D.props,q=D.item,B=q.type.defaultProps!==void 0?Oe(Oe({},q.type.defaultProps),q.props):q.props,Y=jo(q.type);if(Y==="Bar"){var z=(K.data||[]).find(function(H){return Bue(C,H)});if(z)return{graphicalItem:D,payload:z}}else if(Y==="RadialBar"){var I=(K.data||[]).find(function(H){return XM(C,H)});if(I)return{graphicalItem:D,payload:I}}else if(Fv(D,E)||zv(D,E)||Ff(D,E)){var T=ufe({graphicalItem:D,activeTooltipItem:E,itemData:B.data}),V=B.activeIndex===void 0?T:B.activeIndex;return{graphicalItem:Oe(Oe({},D),{},{childIndex:V}),payload:Ff(D,E)?B.data[T]:D.props.data[T]}}}return null}},{key:"render",value:function(){var C=this;if(!iT(this))return null;var k=this.props,A=k.children,E=k.className,P=k.width,O=k.height,D=k.style,K=k.compact,q=k.title,B=k.desc,Y=B$(k,_me),z=Mt(Y,!1);if(K)return Q.createElement(S$,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},Q.createElement(g1,Fc({},z,{width:P,height:O,title:q,desc:B}),this.renderClipPath(),cT(A,this.renderMap)));if(this.props.accessibilityLayer){var I,T;z.tabIndex=(I=this.props.tabIndex)!==null&&I!==void 0?I:0,z.role=(T=this.props.role)!==null&&T!==void 0?T:"application",z.onKeyDown=function(H){C.accessibilityManager.keyboardEvent(H)},z.onFocus=function(){C.accessibilityManager.focus()}}var V=this.parseEventsOfWrapper();return Q.createElement(S$,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},Q.createElement("div",Fc({className:Yt("recharts-wrapper",E),style:Oe({position:"relative",cursor:"default",width:P,height:O},D)},V,{ref:function(M){C.container=M}}),Q.createElement(g1,Fc({},z,{width:P,height:O,title:q,desc:B,style:Ume}),this.renderClipPath(),cT(A,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(h.Component);It(j,"displayName",n),It(j,"defaultProps",Oe({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},p)),It(j,"getDerivedStateFromProps",function(b,S){var N=b.dataKey,C=b.data,k=b.children,A=b.width,E=b.height,P=b.layout,O=b.stackOffset,D=b.margin,K=S.dataStartIndex,q=S.dataEndIndex;if(S.updateId===void 0){var B=W$(b);return Oe(Oe(Oe({},B),{},{updateId:0},x(Oe(Oe({props:b},B),{},{updateId:0}),S)),{},{prevDataKey:N,prevData:C,prevWidth:A,prevHeight:E,prevLayout:P,prevStackOffset:O,prevMargin:D,prevChildren:k})}if(N!==S.prevDataKey||C!==S.prevData||A!==S.prevWidth||E!==S.prevHeight||P!==S.prevLayout||O!==S.prevStackOffset||!Wc(D,S.prevMargin)){var Y=W$(b),z={chartX:S.chartX,chartY:S.chartY,isTooltipActive:S.isTooltipActive},I=Oe(Oe({},U$(S,C,P)),{},{updateId:S.updateId+1}),T=Oe(Oe(Oe({},Y),z),I);return Oe(Oe(Oe({},T),x(Oe({props:b},T),S)),{},{prevDataKey:N,prevData:C,prevWidth:A,prevHeight:E,prevLayout:P,prevStackOffset:O,prevMargin:D,prevChildren:k})}if(!h1(k,S.prevChildren)){var V,H,M,X,$=ba(k,pu),F=$&&(V=(H=$.props)===null||H===void 0?void 0:H.startIndex)!==null&&V!==void 0?V:K,G=$&&(M=(X=$.props)===null||X===void 0?void 0:X.endIndex)!==null&&M!==void 0?M:q,re=F!==K||G!==q,oe=!Gt(C),ue=oe&&!re?S.updateId:S.updateId+1;return Oe(Oe({updateId:ue},x(Oe(Oe({props:b},S),{},{updateId:ue,dataStartIndex:F,dataEndIndex:G}),S)),{},{prevChildren:k,dataStartIndex:F,dataEndIndex:G})}return null}),It(j,"renderActiveDot",function(b,S,N){var C;return h.isValidElement(b)?C=h.cloneElement(b,S):Kt(b)?C=b(S):C=Q.createElement(Mv,S),Q.createElement(un,{className:"recharts-active-dot",key:N},C)});var y=h.forwardRef(function(S,N){return Q.createElement(j,Fc({},S,{ref:N}))});return y.displayName=j.displayName,y},ON=q_({chartName:"LineChart",GraphicalChild:Pl,axisComponents:[{axisType:"xAxis",AxisComp:_i},{axisType:"yAxis",AxisComp:ki}],formatAxisMap:Tz}),Zme=q_({chartName:"BarChart",GraphicalChild:Gl,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:_i},{axisType:"yAxis",AxisComp:ki}],formatAxisMap:Tz}),ege=q_({chartName:"PieChart",GraphicalChild:Uo,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Lv},{axisType:"radiusAxis",AxisComp:$v}],formatAxisMap:Jie,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function U_(e){const t=Array.from(new Map(e.scenarios.map(v=>{const x=String(v.scenarioId??"").trim(),j=String(v.scenarioName??"").trim();return!x&&!j?null:[x||j,j||x]}).filter(v=>!!v)).values()),n=e.scenarios.map(v=>v.agentName||v.agentId).filter(Boolean),r=Array.from(new Set(n.length>0?n:e.rerunAgents??[])),s=Array.from(new Set(e.scenarios.map(v=>v.model).filter(v=>!!v))),o=t.slice(0,2).join(", "),i=t.length>2?` +${t.length-2}`:"",c=s.slice(0,2).join(", "),d=s.length>2?` +${s.length-2}`:"",f=e.configName?.trim()||"",m=e.configPath?.trim()||"",p=f&&m?`${f} · ${m}`:f||m;return{scenarioCount:t.length,agentCount:r.length,scopePreview:p||(o?`${o}${i}`:"n/a"),modelSummary:c?`${c}${d}`:""}}function vi(e){const t=typeof e.toolTokensTotal=="number"?e.toolTokensTotal:null;return{id:e.runId,configId:"",configHash:e.configHash,configPath:e.configPath,configName:e.configName,langsmithTraceUrls:e.langsmithTraceUrls,rerunAgents:e.rerunAgents,rerunScenarioIds:e.rerunScenarioIds,rerunServerOverrideAll:e.rerunServerOverrideAll,rerunScenarioServerOverrides:e.rerunScenarioServerOverrides,timestamp:e.timestamp,runNote:e.runNote,mcpServerVersions:{},scenarios:(e.scenarioIds??[]).map((n,r)=>({scenarioId:n,scenarioName:e.scenarioNames?.[r]??n,agentId:"",agentName:"",runs:[],passRate:0,avgToolCalls:0,avgDuration:0})),assistantTokenUsage:null,toolTokenUsage:t===null?null:{inputTokens:null,outputTokens:null,totalTokens:t},overallPassRate:e.passRate,totalScenarios:e.totalScenarios,totalRuns:e.totalRuns,avgToolCalls:e.avgToolCalls,avgLatency:Math.round(e.avgLatencyMs??0),totalDurationMs:typeof e.totalDurationMs=="number"?Math.max(0,e.totalDurationMs):void 0,totalToolDurationMs:typeof e.totalToolDurationMs=="number"?Math.max(0,e.totalToolDurationMs):void 0,checkCounts:e.checkCounts}}const V$=10080*60*1e3;function K$(e){return e.length===0?0:e.reduce((t,n)=>t+n,0)/e.length}function G$(e,t=0){const n=Number(e.toFixed(t));return`${n>0?"+":""}${n.toFixed(t)}`}const tge=()=>{const{configs:e}=up(),{source:t}=Dn(),[n,r]=h.useState(!0),[s,o]=h.useState([]),[i,c]=h.useState([]),[d,f]=h.useState([]),[m,p]=h.useState("timestamp"),[v,x]=h.useState("desc"),j=T=>{if(m===T){x(V=>V==="asc"?"desc":"asc");return}p(T),x("desc")};h.useEffect(()=>{let T=!0;r(!0);const V=Date.now(),H=V-720*60*60*1e3,M=V-V$,X=M-V$,$=new Date(H).toISOString(),F=new Date(M).toISOString(),G=new Date(X).toISOString(),re=new Date(M-1).toISOString(),oe=new Date(V).toISOString(),ue=async(ae,ye)=>t.listRunSummaries?(await t.listRunSummaries({since:ae,until:ye})).map(vi):t.listResults({since:ae,until:ye});return Promise.all([t.listResults({since:$,until:oe}),ue(F,oe),ue(G,re)]).then(([ae,ye,se])=>{T&&(o(ae),c(ye),f(se))}).finally(()=>{T&&r(!1)}),()=>{T=!1}},[t]);const y=e.length,b=s.length,S=i.length===0?0:i.reduce((T,V)=>T+V.overallPassRate,0)/i.length,N=i.length===0?0:Math.round(i.reduce((T,V)=>T+V.avgLatency,0)/i.length),C=K$(d.map(T=>T.overallPassRate)),k=K$(d.map(T=>T.avgLatency)),A=(S-C)*100,E=N-k,P=d.length>0,O=P?`${G$(A,1)}% from last week`:"No prior-week baseline",D=P?`${G$(E,0)}ms from last week`:"No prior-week baseline",K=P?A>0?"up":A<0?"down":"neutral":"neutral",q=P?E<0?"up":E>0?"down":"neutral":"neutral",B=h.useMemo(()=>[...s].sort((V,H)=>{let M=0;return m==="timestamp"&&(M=new Date(V.timestamp).getTime()-new Date(H.timestamp).getTime()),m==="passRate"&&(M=V.overallPassRate-H.overallPassRate),m==="latency"&&(M=V.avgLatency-H.avgLatency),m==="scenarios"&&(M=V.totalScenarios-H.totalScenarios),v==="asc"?M:-M}),[s,m,v]),Y=B.slice(0,20),z=T=>{const V=T.toolTokenUsage?.totalTokens;return typeof V=="number"?V.toLocaleString():"n/a"},I=[...B].reverse().map(T=>({date:new Date(T.timestamp).toLocaleDateString("en-US",{month:"short",day:"numeric"}),passRate:Math.round(T.overallPassRate*100),latency:T.avgLatency}));return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(dC,{className:"h-6 w-6"}),"Dashboard"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Overview of your MCP evaluation runs"})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(Z,{asChild:!0,children:a.jsxs(At,{to:"/mcp-evaluations/new",children:[a.jsx(hC,{className:"mr-2 h-4 w-4"}),"New MCP Evaluation"]})}),a.jsx(Z,{variant:"outline",asChild:!0,children:a.jsxs(At,{to:"/run",children:[a.jsx(Cs,{className:"mr-2 h-4 w-4"}),"Run Evaluation"]})}),a.jsx(Z,{variant:"outline",asChild:!0,children:a.jsxs(At,{to:"/results",children:[a.jsx(jl,{className:"mr-2 h-4 w-4"}),"Browse Results"]})})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[a.jsx(nr,{title:"MCP Evaluations",value:y,icon:mm,subtitle:`${y} active`}),a.jsx(nr,{title:"Total Runs",value:b,icon:cC,subtitle:"Last 30 days"}),a.jsx(nr,{title:"Pass Rate",value:n?"—":`${Math.round(S*100)}%`,icon:jl,subtitle:n?"Loading...":O,trend:n?"neutral":K}),a.jsx(nr,{title:"Avg Latency",value:n?"—":`${N}ms`,icon:mC,subtitle:n?"Loading...":D,trend:n?"neutral":q})]}),a.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Pass Rate Trend"})}),a.jsx(Je,{children:a.jsx(mf,{width:"100%",height:200,children:a.jsxs(ON,{data:I,children:[a.jsx(_i,{dataKey:"date",tick:{fontSize:11},tickLine:!1,axisLine:!1}),a.jsx(ki,{domain:[0,100],tick:{fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:T=>`${T}%`}),a.jsx(aa,{formatter:T=>[`${T}%`,"Pass Rate"]}),a.jsx(Pl,{type:"monotone",dataKey:"passRate",stroke:"hsl(38, 92%, 50%)",strokeWidth:2,dot:{r:3,fill:"hsl(38, 92%, 50%)"}})]})})})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Recent Tool Latency (ms)"})}),a.jsx(Je,{children:a.jsx(mf,{width:"100%",height:200,children:a.jsxs(ON,{data:I,children:[a.jsx(_i,{dataKey:"date",tick:{fontSize:11},tickLine:!1,axisLine:!1}),a.jsx(ki,{tick:{fontSize:11},tickLine:!1,axisLine:!1}),a.jsx(aa,{formatter:T=>[`${T}ms`,"Latency"]}),a.jsx(Pl,{type:"monotone",dataKey:"latency",stroke:"hsl(200, 80%, 50%)",strokeWidth:2,dot:{r:3,fill:"hsl(200, 80%, 50%)"}})]})})})]})]}),a.jsx("div",{className:"grid gap-6",children:a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Recent Runs"})}),a.jsxs(Je,{className:"p-0",children:[a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Vt,{children:[a.jsx(ct,{children:"Run ID"}),a.jsx(ct,{children:"Evaluated"}),a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>j("timestamp"),children:["Timestamp",m==="timestamp"?v==="asc"?a.jsx(Ns,{className:"h-3.5 w-3.5"}):a.jsx(en,{className:"h-3.5 w-3.5"}):a.jsx(zc,{className:"h-3.5 w-3.5 text-muted-foreground"})]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex w-full items-center justify-end gap-1 hover:text-foreground",onClick:()=>j("passRate"),children:["Pass Rate",m==="passRate"?v==="asc"?a.jsx(Ns,{className:"h-3.5 w-3.5"}):a.jsx(en,{className:"h-3.5 w-3.5"}):a.jsx(zc,{className:"h-3.5 w-3.5 text-muted-foreground"})]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>j("scenarios"),children:["Scenarios",m==="scenarios"?v==="asc"?a.jsx(Ns,{className:"h-3.5 w-3.5"}):a.jsx(en,{className:"h-3.5 w-3.5"}):a.jsx(zc,{className:"h-3.5 w-3.5 text-muted-foreground"})]})}),a.jsx(ct,{className:"text-right",children:"Avg Tool Calls"}),a.jsx(ct,{className:"text-right",children:"Tool Tokens"})]})}),a.jsxs(ca,{children:[Y.length===0&&a.jsx(Vt,{children:a.jsx(Ue,{colSpan:7,className:"py-8 text-center text-sm text-muted-foreground",children:"No runs in the past 30 days."})}),Y.map(T=>a.jsxs(Vt,{className:"cursor-pointer",children:[a.jsx(Ue,{children:a.jsx(At,{to:`/results/${T.id}`,className:"font-mono text-xs text-primary hover:underline",children:T.id})}),a.jsx(Ue,{className:"text-[11px] text-muted-foreground",children:(()=>{const V=U_(T);return a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{children:["Evaluated: ",V.scenarioCount," scenario",V.scenarioCount===1?"":"s"," · ",V.agentCount," agent",V.agentCount===1?"":"s",V.modelSummary?` · ${V.modelSummary}`:""]}),a.jsx("div",{className:"font-mono text-xs text-foreground/80",children:V.scopePreview})]})})()}),a.jsx(Ue,{className:"text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(T.timestamp).toLocaleString()]})}),a.jsx(Ue,{className:"text-right",children:a.jsxs("div",{className:"flex flex-col items-end gap-1",children:[a.jsx(zs,{rate:T.overallPassRate}),a.jsx(YL,{run:T})]})}),a.jsx(Ue,{className:"text-right font-mono text-sm",children:T.totalScenarios}),a.jsx(Ue,{className:"text-right font-mono text-sm",children:T.avgToolCalls.toFixed(0)}),a.jsx(Ue,{className:"text-right font-mono text-sm",children:z(T)})]},T.id))]})]}),B.length>20&&a.jsx("div",{className:"border-t p-4 text-center",children:a.jsx(Z,{variant:"outline",asChild:!0,children:a.jsx(At,{to:"/results",children:"Show more"})})})]})]})})]})};function W_({value:e,onValueChange:t,placeholder:n="Search...",className:r,inputClassName:s,clearAriaLabel:o="Clear search"}){return a.jsxs("div",{className:$e("relative",r),children:[a.jsx(_t,{value:e,onChange:i=>t(i.target.value),placeholder:n,className:$e("h-9 w-[240px] pr-8",s)}),e&&a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 border border-border/60",onClick:()=>t(""),"aria-label":o,children:a.jsx(ua,{className:"h-4 w-4"})})]})}var nge=h.createContext(void 0);function qu(e){const t=h.useContext(nge);return e||t||"ltr"}var jS="rovingFocusGroup.onEntryFocus",rge={bubbles:!1,cancelable:!0},bp="RovingFocusGroup",[MN,mB,age]=Qf(bp),[sge,Gv]=kr(bp,[age]),[oge,ige]=sge(bp),gB=h.forwardRef((e,t)=>a.jsx(MN.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(MN.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(lge,{...e,ref:t})})}));gB.displayName=bp;var lge=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:m=!1,...p}=e,v=h.useRef(null),x=Tt(t,v),j=qu(o),[y,b]=Aa({prop:i,defaultProp:c??null,onChange:d,caller:bp}),[S,N]=h.useState(!1),C=Zn(f),k=mB(n),A=h.useRef(!1),[E,P]=h.useState(0);return h.useEffect(()=>{const O=v.current;if(O)return O.addEventListener(jS,C),()=>O.removeEventListener(jS,C)},[C]),a.jsx(oge,{scope:n,orientation:r,dir:j,loop:s,currentTabStopId:y,onItemFocus:h.useCallback(O=>b(O),[b]),onItemShiftTab:h.useCallback(()=>N(!0),[]),onFocusableItemAdd:h.useCallback(()=>P(O=>O+1),[]),onFocusableItemRemove:h.useCallback(()=>P(O=>O-1),[]),children:a.jsx(lt.div,{tabIndex:S||E===0?-1:0,"data-orientation":r,...p,ref:x,style:{outline:"none",...e.style},onMouseDown:We(e.onMouseDown,()=>{A.current=!0}),onFocus:We(e.onFocus,O=>{const D=!A.current;if(O.target===O.currentTarget&&D&&!S){const K=new CustomEvent(jS,rge);if(O.currentTarget.dispatchEvent(K),!K.defaultPrevented){const q=k().filter(T=>T.focusable),B=q.find(T=>T.active),Y=q.find(T=>T.id===y),I=[B,Y,...q].filter(Boolean).map(T=>T.ref.current);yB(I,m)}}A.current=!1}),onBlur:We(e.onBlur,()=>N(!1))})})}),vB="RovingFocusGroupItem",xB=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:i,...c}=e,d=fr(),f=o||d,m=ige(vB,n),p=m.currentTabStopId===f,v=mB(n),{onFocusableItemAdd:x,onFocusableItemRemove:j,currentTabStopId:y}=m;return h.useEffect(()=>{if(r)return x(),()=>j()},[r,x,j]),a.jsx(MN.ItemSlot,{scope:n,id:f,focusable:r,active:s,children:a.jsx(lt.span,{tabIndex:p?0:-1,"data-orientation":m.orientation,...c,ref:t,onMouseDown:We(e.onMouseDown,b=>{r?m.onItemFocus(f):b.preventDefault()}),onFocus:We(e.onFocus,()=>m.onItemFocus(f)),onKeyDown:We(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){m.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const S=dge(b,m.orientation,m.dir);if(S!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let C=v().filter(k=>k.focusable).map(k=>k.ref.current);if(S==="last")C.reverse();else if(S==="prev"||S==="next"){S==="prev"&&C.reverse();const k=C.indexOf(b.currentTarget);C=m.loop?fge(C,k+1):C.slice(k+1)}setTimeout(()=>yB(C))}}),children:typeof i=="function"?i({isCurrentTabStop:p,hasTabStop:y!=null}):i})})});xB.displayName=vB;var cge={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function uge(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function dge(e,t,n){const r=uge(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return cge[r]}function yB(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function fge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var bB=gB,wB=xB;function pge(e){const t=hge(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),d=c.find(gge);if(d){const f=d.props.children,m=c.map(p=>p===d?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function hge(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=xge(s),c=vge(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var mge=Symbol("radix.slottable");function gge(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===mge}function vge(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const d=o(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function xge(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var IN=["Enter"," "],yge=["ArrowDown","PageUp","Home"],jB=["ArrowUp","PageDown","End"],bge=[...yge,...jB],wge={ltr:[...IN,"ArrowRight"],rtl:[...IN,"ArrowLeft"]},jge={ltr:["ArrowLeft"],rtl:["ArrowRight"]},wp="Menu",[Vf,Sge,Nge]=Qf(wp),[Yl,SB]=kr(wp,[Nge,Ei,Gv]),Yv=Ei(),NB=Gv(),[Cge,Xl]=Yl(wp),[_ge,jp]=Yl(wp),CB=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:i=!0}=e,c=Yv(t),[d,f]=h.useState(null),m=h.useRef(!1),p=Zn(o),v=qu(s);return h.useEffect(()=>{const x=()=>{m.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>m.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),a.jsx(Vg,{...c,children:a.jsx(Cge,{scope:t,open:n,onOpenChange:p,content:d,onContentChange:f,children:a.jsx(_ge,{scope:t,onClose:h.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:v,modal:i,children:r})})})};CB.displayName=wp;var kge="MenuAnchor",H_=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Yv(n);return a.jsx(tp,{...s,...r,ref:t})});H_.displayName=kge;var V_="MenuPortal",[Age,_B]=Yl(V_,{forceMount:void 0}),kB=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=Xl(V_,t);return a.jsx(Age,{scope:t,forceMount:n,children:a.jsx(ar,{present:n||o.open,children:a.jsx(zl,{asChild:!0,container:s,children:r})})})};kB.displayName=V_;var Ha="MenuContent",[Ege,K_]=Yl(Ha),AB=h.forwardRef((e,t)=>{const n=_B(Ha,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Xl(Ha,e.__scopeMenu),i=jp(Ha,e.__scopeMenu);return a.jsx(Vf.Provider,{scope:e.__scopeMenu,children:a.jsx(ar,{present:r||o.open,children:a.jsx(Vf.Slot,{scope:e.__scopeMenu,children:i.modal?a.jsx(Pge,{...s,ref:t}):a.jsx(Rge,{...s,ref:t})})})})}),Pge=h.forwardRef((e,t)=>{const n=Xl(Ha,e.__scopeMenu),r=h.useRef(null),s=Tt(t,r);return h.useEffect(()=>{const o=r.current;if(o)return sv(o)},[]),a.jsx(G_,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:We(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Rge=h.forwardRef((e,t)=>{const n=Xl(Ha,e.__scopeMenu);return a.jsx(G_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Tge=pge("MenuContent.ScrollLock"),G_=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:v,onDismiss:x,disableOutsideScroll:j,...y}=e,b=Xl(Ha,n),S=jp(Ha,n),N=Yv(n),C=NB(n),k=Sge(n),[A,E]=h.useState(null),P=h.useRef(null),O=Tt(t,P,b.onContentChange),D=h.useRef(0),K=h.useRef(""),q=h.useRef(0),B=h.useRef(null),Y=h.useRef("right"),z=h.useRef(0),I=j?op:h.Fragment,T=j?{as:Tge,allowPinchZoom:!0}:void 0,V=M=>{const X=K.current+M,$=k().filter(ae=>!ae.disabled),F=document.activeElement,G=$.find(ae=>ae.ref.current===F)?.textValue,re=$.map(ae=>ae.textValue),oe=Wge(re,X,G),ue=$.find(ae=>ae.textValue===oe)?.ref.current;(function ae(ye){K.current=ye,window.clearTimeout(D.current),ye!==""&&(D.current=window.setTimeout(()=>ae(""),1e3))})(X),ue&&setTimeout(()=>ue.focus())};h.useEffect(()=>()=>window.clearTimeout(D.current),[]),rv();const H=h.useCallback(M=>Y.current===B.current?.side&&Vge(M,B.current?.area),[]);return a.jsx(Ege,{scope:n,searchRef:K,onItemEnter:h.useCallback(M=>{H(M)&&M.preventDefault()},[H]),onItemLeave:h.useCallback(M=>{H(M)||(P.current?.focus(),E(null))},[H]),onTriggerLeave:h.useCallback(M=>{H(M)&&M.preventDefault()},[H]),pointerGraceTimerRef:q,onPointerGraceIntentChange:h.useCallback(M=>{B.current=M},[]),children:a.jsx(I,{...T,children:a.jsx(sp,{asChild:!0,trapped:s,onMountAutoFocus:We(o,M=>{M.preventDefault(),P.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:a.jsx(Fl,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:v,onDismiss:x,children:a.jsx(bB,{asChild:!0,...C,dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:E,onEntryFocus:We(d,M=>{S.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(Kg,{role:"menu","aria-orientation":"vertical","data-state":WB(b.open),"data-radix-menu-content":"",dir:S.dir,...N,...y,ref:O,style:{outline:"none",...y.style},onKeyDown:We(y.onKeyDown,M=>{const $=M.target.closest("[data-radix-menu-content]")===M.currentTarget,F=M.ctrlKey||M.altKey||M.metaKey,G=M.key.length===1;$&&(M.key==="Tab"&&M.preventDefault(),!F&&G&&V(M.key));const re=P.current;if(M.target!==re||!bge.includes(M.key))return;M.preventDefault();const ue=k().filter(ae=>!ae.disabled).map(ae=>ae.ref.current);jB.includes(M.key)&&ue.reverse(),qge(ue)}),onBlur:We(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(D.current),K.current="")}),onPointerMove:We(e.onPointerMove,Kf(M=>{const X=M.target,$=z.current!==M.clientX;if(M.currentTarget.contains(X)&&$){const F=M.clientX>z.current?"right":"left";Y.current=F,z.current=M.clientX}}))})})})})})})});AB.displayName=Ha;var Oge="MenuGroup",Y_=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(lt.div,{role:"group",...r,ref:t})});Y_.displayName=Oge;var Mge="MenuLabel",EB=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(lt.div,{...r,ref:t})});EB.displayName=Mge;var Ng="MenuItem",Y$="menu.itemSelect",Xv=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=h.useRef(null),i=jp(Ng,e.__scopeMenu),c=K_(Ng,e.__scopeMenu),d=Tt(t,o),f=h.useRef(!1),m=()=>{const p=o.current;if(!n&&p){const v=new CustomEvent(Y$,{bubbles:!0,cancelable:!0});p.addEventListener(Y$,x=>r?.(x),{once:!0}),sC(p,v),v.defaultPrevented?f.current=!1:i.onClose()}};return a.jsx(PB,{...s,ref:d,disabled:n,onClick:We(e.onClick,m),onPointerDown:p=>{e.onPointerDown?.(p),f.current=!0},onPointerUp:We(e.onPointerUp,p=>{f.current||p.currentTarget?.click()}),onKeyDown:We(e.onKeyDown,p=>{const v=c.searchRef.current!=="";n||v&&p.key===" "||IN.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Xv.displayName=Ng;var PB=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,i=K_(Ng,n),c=NB(n),d=h.useRef(null),f=Tt(t,d),[m,p]=h.useState(!1),[v,x]=h.useState("");return h.useEffect(()=>{const j=d.current;j&&x((j.textContent??"").trim())},[o.children]),a.jsx(Vf.ItemSlot,{scope:n,disabled:r,textValue:s??v,children:a.jsx(wB,{asChild:!0,...c,focusable:!r,children:a.jsx(lt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:f,onPointerMove:We(e.onPointerMove,Kf(j=>{r?i.onItemLeave(j):(i.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:We(e.onPointerLeave,Kf(j=>i.onItemLeave(j))),onFocus:We(e.onFocus,()=>p(!0)),onBlur:We(e.onBlur,()=>p(!1))})})})}),Ige="MenuCheckboxItem",RB=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return a.jsx($B,{scope:e.__scopeMenu,checked:n,children:a.jsx(Xv,{role:"menuitemcheckbox","aria-checked":Cg(n)?"mixed":n,...s,ref:t,"data-state":Q_(n),onSelect:We(s.onSelect,()=>r?.(Cg(n)?!0:!n),{checkForDefaultPrevented:!1})})})});RB.displayName=Ige;var TB="MenuRadioGroup",[$ge,Dge]=Yl(TB,{value:void 0,onValueChange:()=>{}}),OB=h.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=Zn(r);return a.jsx($ge,{scope:e.__scopeMenu,value:n,onValueChange:o,children:a.jsx(Y_,{...s,ref:t})})});OB.displayName=TB;var MB="MenuRadioItem",IB=h.forwardRef((e,t)=>{const{value:n,...r}=e,s=Dge(MB,e.__scopeMenu),o=n===s.value;return a.jsx($B,{scope:e.__scopeMenu,checked:o,children:a.jsx(Xv,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":Q_(o),onSelect:We(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});IB.displayName=MB;var X_="MenuItemIndicator",[$B,Lge]=Yl(X_,{checked:!1}),DB=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=Lge(X_,n);return a.jsx(ar,{present:r||Cg(o.checked)||o.checked===!0,children:a.jsx(lt.span,{...s,ref:t,"data-state":Q_(o.checked)})})});DB.displayName=X_;var Fge="MenuSeparator",LB=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(lt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});LB.displayName=Fge;var zge="MenuArrow",FB=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Yv(n);return a.jsx(Gg,{...s,...r,ref:t})});FB.displayName=zge;var Bge="MenuSub",[Ewe,zB]=Yl(Bge),Wd="MenuSubTrigger",BB=h.forwardRef((e,t)=>{const n=Xl(Wd,e.__scopeMenu),r=jp(Wd,e.__scopeMenu),s=zB(Wd,e.__scopeMenu),o=K_(Wd,e.__scopeMenu),i=h.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=o,f={__scopeMenu:e.__scopeMenu},m=h.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return h.useEffect(()=>m,[m]),h.useEffect(()=>{const p=c.current;return()=>{window.clearTimeout(p),d(null)}},[c,d]),a.jsx(H_,{asChild:!0,...f,children:a.jsx(PB,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":WB(n.open),...e,ref:Vr(t,s.onTriggerChange),onClick:p=>{e.onClick?.(p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:We(e.onPointerMove,Kf(p=>{o.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:We(e.onPointerLeave,Kf(p=>{m();const v=n.content?.getBoundingClientRect();if(v){const x=n.content?.dataset.side,j=x==="right",y=j?-5:5,b=v[j?"left":"right"],S=v[j?"right":"left"];o.onPointerGraceIntentChange({area:[{x:p.clientX+y,y:p.clientY},{x:b,y:v.top},{x:S,y:v.top},{x:S,y:v.bottom},{x:b,y:v.bottom}],side:x}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(p),p.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:We(e.onKeyDown,p=>{const v=o.searchRef.current!=="";e.disabled||v&&p.key===" "||wge[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});BB.displayName=Wd;var qB="MenuSubContent",UB=h.forwardRef((e,t)=>{const n=_B(Ha,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Xl(Ha,e.__scopeMenu),i=jp(Ha,e.__scopeMenu),c=zB(qB,e.__scopeMenu),d=h.useRef(null),f=Tt(t,d);return a.jsx(Vf.Provider,{scope:e.__scopeMenu,children:a.jsx(ar,{present:r||o.open,children:a.jsx(Vf.Slot,{scope:e.__scopeMenu,children:a.jsx(G_,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:f,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{i.isUsingKeyboardRef.current&&d.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:We(e.onFocusOutside,m=>{m.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:We(e.onEscapeKeyDown,m=>{i.onClose(),m.preventDefault()}),onKeyDown:We(e.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),v=jge[i.dir].includes(m.key);p&&v&&(o.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});UB.displayName=qB;function WB(e){return e?"open":"closed"}function Cg(e){return e==="indeterminate"}function Q_(e){return Cg(e)?"indeterminate":e?"checked":"unchecked"}function qge(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Uge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Wge(e,t,n){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=Uge(e,Math.max(o,0));s.length===1&&(i=i.filter(f=>f!==n));const d=i.find(f=>f.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function Hge(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const c=t[o],d=t[i],f=c.x,m=c.y,p=d.x,v=d.y;m>r!=v>r&&n<(p-f)*(r-m)/(v-m)+f&&(s=!s)}return s}function Vge(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Hge(n,t)}function Kf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Kge=CB,Gge=H_,Yge=kB,Xge=AB,Qge=Y_,Jge=EB,Zge=Xv,eve=RB,tve=OB,nve=IB,rve=DB,ave=LB,sve=FB,ove=BB,ive=UB,Qv="DropdownMenu",[lve]=kr(Qv,[SB]),Gr=SB(),[cve,HB]=lve(Qv),VB=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:o,onOpenChange:i,modal:c=!0}=e,d=Gr(t),f=h.useRef(null),[m,p]=Aa({prop:s,defaultProp:o??!1,onChange:i,caller:Qv});return a.jsx(cve,{scope:t,triggerId:fr(),triggerRef:f,contentId:fr(),open:m,onOpenChange:p,onOpenToggle:h.useCallback(()=>p(v=>!v),[p]),modal:c,children:a.jsx(Kge,{...d,open:m,onOpenChange:p,dir:r,modal:c,children:n})})};VB.displayName=Qv;var KB="DropdownMenuTrigger",GB=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=HB(KB,n),i=Gr(n);return a.jsx(Gge,{asChild:!0,...i,children:a.jsx(lt.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Vr(t,o.triggerRef),onPointerDown:We(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(o.onOpenToggle(),o.open||c.preventDefault())}),onKeyDown:We(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&o.onOpenToggle(),c.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});GB.displayName=KB;var uve="DropdownMenuPortal",YB=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Gr(t);return a.jsx(Yge,{...r,...n})};YB.displayName=uve;var XB="DropdownMenuContent",QB=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=HB(XB,n),o=Gr(n),i=h.useRef(!1);return a.jsx(Xge,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:t,onCloseAutoFocus:We(e.onCloseAutoFocus,c=>{i.current||s.triggerRef.current?.focus(),i.current=!1,c.preventDefault()}),onInteractOutside:We(e.onInteractOutside,c=>{const d=c.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0,m=d.button===2||f;(!s.modal||m)&&(i.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)"}})});QB.displayName=XB;var dve="DropdownMenuGroup",fve=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(Qge,{...s,...r,ref:t})});fve.displayName=dve;var pve="DropdownMenuLabel",JB=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(Jge,{...s,...r,ref:t})});JB.displayName=pve;var hve="DropdownMenuItem",ZB=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(Zge,{...s,...r,ref:t})});ZB.displayName=hve;var mve="DropdownMenuCheckboxItem",e6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(eve,{...s,...r,ref:t})});e6.displayName=mve;var gve="DropdownMenuRadioGroup",vve=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(tve,{...s,...r,ref:t})});vve.displayName=gve;var xve="DropdownMenuRadioItem",t6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(nve,{...s,...r,ref:t})});t6.displayName=xve;var yve="DropdownMenuItemIndicator",n6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(rve,{...s,...r,ref:t})});n6.displayName=yve;var bve="DropdownMenuSeparator",r6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(ave,{...s,...r,ref:t})});r6.displayName=bve;var wve="DropdownMenuArrow",jve=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(sve,{...s,...r,ref:t})});jve.displayName=wve;var Sve="DropdownMenuSubTrigger",a6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(ove,{...s,...r,ref:t})});a6.displayName=Sve;var Nve="DropdownMenuSubContent",s6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(ive,{...s,...r,ref:t,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)"}})});s6.displayName=Nve;var Cve=VB,_ve=GB,kve=YB,o6=QB,i6=JB,l6=ZB,c6=e6,u6=t6,d6=n6,f6=r6,p6=a6,h6=s6;const Sp=Cve,Np=_ve,Ave=h.forwardRef(({className:e,inset:t,children:n,...r},s)=>a.jsxs(p6,{ref:s,className:$e("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...r,children:[n,a.jsx(Fg,{className:"ml-auto h-4 w-4"})]}));Ave.displayName=p6.displayName;const Eve=h.forwardRef(({className:e,...t},n)=>a.jsx(h6,{ref:n,className:$e("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",e),...t}));Eve.displayName=h6.displayName;const Uu=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(kve,{children:a.jsx(o6,{ref:r,sideOffset:t,className:$e("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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",e),...n})}));Uu.displayName=o6.displayName;const Ir=h.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(l6,{ref:r,className:$e("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...n}));Ir.displayName=l6.displayName;const Pve=h.forwardRef(({className:e,children:t,checked:n,...r},s)=>a.jsxs(c6,{ref:s,className:$e("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(d6,{children:a.jsx(Gc,{className:"h-4 w-4"})})}),t]}));Pve.displayName=c6.displayName;const Rve=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(u6,{ref:r,className:$e("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(d6,{children:a.jsx(xW,{className:"h-2 w-2 fill-current"})})}),t]}));Rve.displayName=u6.displayName;const m6=h.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(i6,{ref:r,className:$e("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));m6.displayName=i6.displayName;const g6=h.forwardRef(({className:e,...t},n)=>a.jsx(f6,{ref:n,className:$e("-mx-1 my-1 h-px bg-muted",e),...t}));g6.displayName=f6.displayName;function Gf(e,[t,n]){return Math.min(n,Math.max(t,e))}function Tve(e){const t=Ove(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),d=c.find(Ive);if(d){const f=d.props.children,m=c.map(p=>p===d?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function Ove(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=Dve(s),c=$ve(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Mve=Symbol("radix.slottable");function Ive(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Mve}function $ve(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const d=o(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Dve(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Jv(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Lve=[" ","Enter","ArrowUp","ArrowDown"],Fve=[" ","Enter"],Rl="Select",[Zv,ex,zve]=Qf(Rl),[Wu]=kr(Rl,[zve,Ei]),tx=Ei(),[Bve,Ii]=Wu(Rl),[qve,Uve]=Wu(Rl),v6=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:o,value:i,defaultValue:c,onValueChange:d,dir:f,name:m,autoComplete:p,disabled:v,required:x,form:j}=e,y=tx(t),[b,S]=h.useState(null),[N,C]=h.useState(null),[k,A]=h.useState(!1),E=qu(f),[P,O]=Aa({prop:r,defaultProp:s??!1,onChange:o,caller:Rl}),[D,K]=Aa({prop:i,defaultProp:c,onChange:d,caller:Rl}),q=h.useRef(null),B=b?j||!!b.closest("form"):!0,[Y,z]=h.useState(new Set),I=Array.from(Y).map(T=>T.props.value).join(";");return a.jsx(Vg,{...y,children:a.jsxs(Bve,{required:x,scope:t,trigger:b,onTriggerChange:S,valueNode:N,onValueNodeChange:C,valueNodeHasChildren:k,onValueNodeHasChildrenChange:A,contentId:fr(),value:D,onValueChange:K,open:P,onOpenChange:O,dir:E,triggerPointerDownPosRef:q,disabled:v,children:[a.jsx(Zv.Provider,{scope:t,children:a.jsx(qve,{scope:e.__scopeSelect,onNativeOptionAdd:h.useCallback(T=>{z(V=>new Set(V).add(T))},[]),onNativeOptionRemove:h.useCallback(T=>{z(V=>{const H=new Set(V);return H.delete(T),H})},[]),children:n})}),B?a.jsxs(B6,{"aria-hidden":!0,required:x,tabIndex:-1,name:m,autoComplete:p,value:D,onChange:T=>K(T.target.value),disabled:v,form:j,children:[D===void 0?a.jsx("option",{value:""}):null,Array.from(Y)]},I):null]})})};v6.displayName=Rl;var x6="SelectTrigger",y6=h.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,o=tx(n),i=Ii(x6,n),c=i.disabled||r,d=Tt(t,i.onTriggerChange),f=ex(n),m=h.useRef("touch"),[p,v,x]=U6(y=>{const b=f().filter(C=>!C.disabled),S=b.find(C=>C.value===i.value),N=W6(b,y,S);N!==void 0&&i.onValueChange(N.value)}),j=y=>{c||(i.onOpenChange(!0),x()),y&&(i.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})};return a.jsx(tp,{asChild:!0,...o,children:a.jsx(lt.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":q6(i.value)?"":void 0,...s,ref:d,onClick:We(s.onClick,y=>{y.currentTarget.focus(),m.current!=="mouse"&&j(y)}),onPointerDown:We(s.onPointerDown,y=>{m.current=y.pointerType;const b=y.target;b.hasPointerCapture(y.pointerId)&&b.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(j(y),y.preventDefault())}),onKeyDown:We(s.onKeyDown,y=>{const b=p.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&v(y.key),!(b&&y.key===" ")&&Lve.includes(y.key)&&(j(),y.preventDefault())})})})});y6.displayName=x6;var b6="SelectValue",w6=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:o,placeholder:i="",...c}=e,d=Ii(b6,n),{onValueNodeHasChildrenChange:f}=d,m=o!==void 0,p=Tt(t,d.onValueNodeChange);return pr(()=>{f(m)},[f,m]),a.jsx(lt.span,{...c,ref:p,style:{pointerEvents:"none"},children:q6(d.value)?a.jsx(a.Fragment,{children:i}):o})});w6.displayName=b6;var Wve="SelectIcon",j6=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return a.jsx(lt.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});j6.displayName=Wve;var Hve="SelectPortal",S6=e=>a.jsx(zl,{asChild:!0,...e});S6.displayName=Hve;var Tl="SelectContent",N6=h.forwardRef((e,t)=>{const n=Ii(Tl,e.__scopeSelect),[r,s]=h.useState();if(pr(()=>{s(new DocumentFragment)},[]),!n.open){const o=r;return o?_u.createPortal(a.jsx(C6,{scope:e.__scopeSelect,children:a.jsx(Zv.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),o):null}return a.jsx(_6,{...e,ref:t})});N6.displayName=Tl;var vs=10,[C6,$i]=Wu(Tl),Vve="SelectContentImpl",Kve=Tve("SelectContent.RemoveScroll"),_6=h.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:c,sideOffset:d,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:v,collisionPadding:x,sticky:j,hideWhenDetached:y,avoidCollisions:b,...S}=e,N=Ii(Tl,n),[C,k]=h.useState(null),[A,E]=h.useState(null),P=Tt(t,ae=>k(ae)),[O,D]=h.useState(null),[K,q]=h.useState(null),B=ex(n),[Y,z]=h.useState(!1),I=h.useRef(!1);h.useEffect(()=>{if(C)return sv(C)},[C]),rv();const T=h.useCallback(ae=>{const[ye,...se]=B().map(ge=>ge.ref.current),[de]=se.slice(-1),De=document.activeElement;for(const ge of ae)if(ge===De||(ge?.scrollIntoView({block:"nearest"}),ge===ye&&A&&(A.scrollTop=0),ge===de&&A&&(A.scrollTop=A.scrollHeight),ge?.focus(),document.activeElement!==De))return},[B,A]),V=h.useCallback(()=>T([O,C]),[T,O,C]);h.useEffect(()=>{Y&&V()},[Y,V]);const{onOpenChange:H,triggerPointerDownPosRef:M}=N;h.useEffect(()=>{if(C){let ae={x:0,y:0};const ye=de=>{ae={x:Math.abs(Math.round(de.pageX)-(M.current?.x??0)),y:Math.abs(Math.round(de.pageY)-(M.current?.y??0))}},se=de=>{ae.x<=10&&ae.y<=10?de.preventDefault():C.contains(de.target)||H(!1),document.removeEventListener("pointermove",ye),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",se,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",se,{capture:!0})}}},[C,H,M]),h.useEffect(()=>{const ae=()=>H(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[H]);const[X,$]=U6(ae=>{const ye=B().filter(De=>!De.disabled),se=ye.find(De=>De.ref.current===document.activeElement),de=W6(ye,ae,se);de&&setTimeout(()=>de.ref.current.focus())}),F=h.useCallback((ae,ye,se)=>{const de=!I.current&&!se;(N.value!==void 0&&N.value===ye||de)&&(D(ae),de&&(I.current=!0))},[N.value]),G=h.useCallback(()=>C?.focus(),[C]),re=h.useCallback((ae,ye,se)=>{const de=!I.current&&!se;(N.value!==void 0&&N.value===ye||de)&&q(ae)},[N.value]),oe=r==="popper"?$N:k6,ue=oe===$N?{side:c,sideOffset:d,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:v,collisionPadding:x,sticky:j,hideWhenDetached:y,avoidCollisions:b}:{};return a.jsx(C6,{scope:n,content:C,viewport:A,onViewportChange:E,itemRefCallback:F,selectedItem:O,onItemLeave:G,itemTextRefCallback:re,focusSelectedItem:V,selectedItemText:K,position:r,isPositioned:Y,searchRef:X,children:a.jsx(op,{as:Kve,allowPinchZoom:!0,children:a.jsx(sp,{asChild:!0,trapped:N.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:We(s,ae=>{N.trigger?.focus({preventScroll:!0}),ae.preventDefault()}),children:a.jsx(Fl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:a.jsx(oe,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:ae=>ae.preventDefault(),...S,...ue,onPlaced:()=>z(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:We(S.onKeyDown,ae=>{const ye=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!ye&&ae.key.length===1&&$(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let de=B().filter(De=>!De.disabled).map(De=>De.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(de=de.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const De=ae.target,ge=de.indexOf(De);de=de.slice(ge+1)}setTimeout(()=>T(de)),ae.preventDefault()}})})})})})})});_6.displayName=Vve;var Gve="SelectItemAlignedPosition",k6=h.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,o=Ii(Tl,n),i=$i(Tl,n),[c,d]=h.useState(null),[f,m]=h.useState(null),p=Tt(t,P=>m(P)),v=ex(n),x=h.useRef(!1),j=h.useRef(!0),{viewport:y,selectedItem:b,selectedItemText:S,focusSelectedItem:N}=i,C=h.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&f&&y&&b&&S){const P=o.trigger.getBoundingClientRect(),O=f.getBoundingClientRect(),D=o.valueNode.getBoundingClientRect(),K=S.getBoundingClientRect();if(o.dir!=="rtl"){const De=K.left-O.left,ge=D.left-De,ve=P.left-ge,Se=P.width+ve,at=Math.max(Se,O.width),tt=window.innerWidth-vs,it=Gf(ge,[vs,Math.max(vs,tt-at)]);c.style.minWidth=Se+"px",c.style.left=it+"px"}else{const De=O.right-K.right,ge=window.innerWidth-D.right-De,ve=window.innerWidth-P.right-ge,Se=P.width+ve,at=Math.max(Se,O.width),tt=window.innerWidth-vs,it=Gf(ge,[vs,Math.max(vs,tt-at)]);c.style.minWidth=Se+"px",c.style.right=it+"px"}const q=v(),B=window.innerHeight-vs*2,Y=y.scrollHeight,z=window.getComputedStyle(f),I=parseInt(z.borderTopWidth,10),T=parseInt(z.paddingTop,10),V=parseInt(z.borderBottomWidth,10),H=parseInt(z.paddingBottom,10),M=I+T+Y+H+V,X=Math.min(b.offsetHeight*5,M),$=window.getComputedStyle(y),F=parseInt($.paddingTop,10),G=parseInt($.paddingBottom,10),re=P.top+P.height/2-vs,oe=B-re,ue=b.offsetHeight/2,ae=b.offsetTop+ue,ye=I+T+ae,se=M-ye;if(ye<=re){const De=q.length>0&&b===q[q.length-1].ref.current;c.style.bottom="0px";const ge=f.clientHeight-y.offsetTop-y.offsetHeight,ve=Math.max(oe,ue+(De?G:0)+ge+V),Se=ye+ve;c.style.height=Se+"px"}else{const De=q.length>0&&b===q[0].ref.current;c.style.top="0px";const ve=Math.max(re,I+y.offsetTop+(De?F:0)+ue)+se;c.style.height=ve+"px",y.scrollTop=ye-re+y.offsetTop}c.style.margin=`${vs}px 0`,c.style.minHeight=X+"px",c.style.maxHeight=B+"px",r?.(),requestAnimationFrame(()=>x.current=!0)}},[v,o.trigger,o.valueNode,c,f,y,b,S,o.dir,r]);pr(()=>C(),[C]);const[k,A]=h.useState();pr(()=>{f&&A(window.getComputedStyle(f).zIndex)},[f]);const E=h.useCallback(P=>{P&&j.current===!0&&(C(),N?.(),j.current=!1)},[C,N]);return a.jsx(Xve,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:x,onScrollButtonChange:E,children:a.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:a.jsx(lt.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});k6.displayName=Gve;var Yve="SelectPopperPosition",$N=h.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=vs,...o}=e,i=tx(n);return a.jsx(Kg,{...i,...o,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...o.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)"}})});$N.displayName=Yve;var[Xve,J_]=Wu(Tl,{}),DN="SelectViewport",A6=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,o=$i(DN,n),i=J_(DN,n),c=Tt(t,o.onViewportChange),d=h.useRef(0);return a.jsxs(a.Fragment,{children:[a.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:r}),a.jsx(Zv.Slot,{scope:n,children:a.jsx(lt.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:We(s.onScroll,f=>{const m=f.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:v}=i;if(v?.current&&p){const x=Math.abs(d.current-m.scrollTop);if(x>0){const j=window.innerHeight-vs*2,y=parseFloat(p.style.minHeight),b=parseFloat(p.style.height),S=Math.max(y,b);if(S<j){const N=S+x,C=Math.min(j,N),k=N-C;p.style.height=C+"px",p.style.bottom==="0px"&&(m.scrollTop=k>0?k:0,p.style.justifyContent="flex-end")}}}d.current=m.scrollTop})})})]})});A6.displayName=DN;var E6="SelectGroup",[Qve,Jve]=Wu(E6),Zve=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=fr();return a.jsx(Qve,{scope:n,id:s,children:a.jsx(lt.div,{role:"group","aria-labelledby":s,...r,ref:t})})});Zve.displayName=E6;var P6="SelectLabel",R6=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Jve(P6,n);return a.jsx(lt.div,{id:s.id,...r,ref:t})});R6.displayName=P6;var _g="SelectItem",[exe,T6]=Wu(_g),O6=h.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:o,...i}=e,c=Ii(_g,n),d=$i(_g,n),f=c.value===r,[m,p]=h.useState(o??""),[v,x]=h.useState(!1),j=Tt(t,N=>d.itemRefCallback?.(N,r,s)),y=fr(),b=h.useRef("touch"),S=()=>{s||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")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 a.jsx(exe,{scope:n,value:r,disabled:s,textId:y,isSelected:f,onItemTextChange:h.useCallback(N=>{p(C=>C||(N?.textContent??"").trim())},[]),children:a.jsx(Zv.ItemSlot,{scope:n,value:r,disabled:s,textValue:m,children:a.jsx(lt.div,{role:"option","aria-labelledby":y,"data-highlighted":v?"":void 0,"aria-selected":f&&v,"data-state":f?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:j,onFocus:We(i.onFocus,()=>x(!0)),onBlur:We(i.onBlur,()=>x(!1)),onClick:We(i.onClick,()=>{b.current!=="mouse"&&S()}),onPointerUp:We(i.onPointerUp,()=>{b.current==="mouse"&&S()}),onPointerDown:We(i.onPointerDown,N=>{b.current=N.pointerType}),onPointerMove:We(i.onPointerMove,N=>{b.current=N.pointerType,s?d.onItemLeave?.():b.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:We(i.onPointerLeave,N=>{N.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:We(i.onKeyDown,N=>{d.searchRef?.current!==""&&N.key===" "||(Fve.includes(N.key)&&S(),N.key===" "&&N.preventDefault())})})})})});O6.displayName=_g;var Hd="SelectItemText",M6=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...o}=e,i=Ii(Hd,n),c=$i(Hd,n),d=T6(Hd,n),f=Uve(Hd,n),[m,p]=h.useState(null),v=Tt(t,S=>p(S),d.onItemTextChange,S=>c.itemTextRefCallback?.(S,d.value,d.disabled)),x=m?.textContent,j=h.useMemo(()=>a.jsx("option",{value:d.value,disabled:d.disabled,children:x},d.value),[d.disabled,d.value,x]),{onNativeOptionAdd:y,onNativeOptionRemove:b}=f;return pr(()=>(y(j),()=>b(j)),[y,b,j]),a.jsxs(a.Fragment,{children:[a.jsx(lt.span,{id:d.textId,...o,ref:v}),d.isSelected&&i.valueNode&&!i.valueNodeHasChildren?_u.createPortal(o.children,i.valueNode):null]})});M6.displayName=Hd;var I6="SelectItemIndicator",$6=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return T6(I6,n).isSelected?a.jsx(lt.span,{"aria-hidden":!0,...r,ref:t}):null});$6.displayName=I6;var LN="SelectScrollUpButton",D6=h.forwardRef((e,t)=>{const n=$i(LN,e.__scopeSelect),r=J_(LN,e.__scopeSelect),[s,o]=h.useState(!1),i=Tt(t,r.onScrollButtonChange);return pr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=d.scrollTop>0;o(f)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?a.jsx(F6,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null});D6.displayName=LN;var FN="SelectScrollDownButton",L6=h.forwardRef((e,t)=>{const n=$i(FN,e.__scopeSelect),r=J_(FN,e.__scopeSelect),[s,o]=h.useState(!1),i=Tt(t,r.onScrollButtonChange);return pr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=d.scrollHeight-d.clientHeight,m=Math.ceil(d.scrollTop)<f;o(m)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?a.jsx(F6,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null});L6.displayName=FN;var F6=h.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,o=$i("SelectScrollButton",n),i=h.useRef(null),c=ex(n),d=h.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return h.useEffect(()=>()=>d(),[d]),pr(()=>{c().find(m=>m.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),a.jsx(lt.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:We(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:We(s.onPointerMove,()=>{o.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:We(s.onPointerLeave,()=>{d()})})}),txe="SelectSeparator",z6=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(lt.div,{"aria-hidden":!0,...r,ref:t})});z6.displayName=txe;var zN="SelectArrow",nxe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=tx(n),o=Ii(zN,n),i=$i(zN,n);return o.open&&i.position==="popper"?a.jsx(Gg,{...s,...r,ref:t}):null});nxe.displayName=zN;var rxe="SelectBubbleInput",B6=h.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=h.useRef(null),o=Tt(r,s),i=Jv(t);return h.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(i!==t&&m){const p=new Event("change",{bubbles:!0});m.call(c,t),c.dispatchEvent(p)}},[i,t]),a.jsx(lt.select,{...n,style:{...KD,...n.style},ref:o,defaultValue:t})});B6.displayName=rxe;function q6(e){return e===""||e===void 0}function U6(e){const t=Zn(e),n=h.useRef(""),r=h.useRef(0),s=h.useCallback(i=>{const c=n.current+i;t(c),(function d(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>d(""),1e3))})(c)},[t]),o=h.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,o]}function W6(e,t,n){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=axe(e,Math.max(o,0));s.length===1&&(i=i.filter(f=>f!==n));const d=i.find(f=>f.textValue.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function axe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var sxe=v6,H6=y6,oxe=w6,ixe=j6,lxe=S6,V6=N6,cxe=A6,K6=R6,G6=O6,uxe=M6,dxe=$6,Y6=D6,X6=L6,Q6=z6;const In=sxe,$n=oxe,An=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(H6,{ref:r,className:$e("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,a.jsx(ixe,{asChild:!0,children:a.jsx(en,{className:"h-4 w-4 opacity-50"})})]}));An.displayName=H6.displayName;const J6=h.forwardRef(({className:e,...t},n)=>a.jsx(Y6,{ref:n,className:$e("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Ns,{className:"h-4 w-4"})}));J6.displayName=Y6.displayName;const Z6=h.forwardRef(({className:e,...t},n)=>a.jsx(X6,{ref:n,className:$e("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(en,{className:"h-4 w-4"})}));Z6.displayName=X6.displayName;const En=h.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>a.jsx(lxe,{children:a.jsxs(V6,{ref:s,className:$e("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",n==="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:n,...r,children:[a.jsx(J6,{}),a.jsx(cxe,{className:$e("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(Z6,{})]})}));En.displayName=V6.displayName;const fxe=h.forwardRef(({className:e,...t},n)=>a.jsx(K6,{ref:n,className:$e("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));fxe.displayName=K6.displayName;const ut=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(G6,{ref:r,className:$e("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(dxe,{children:a.jsx(Gc,{className:"h-4 w-4"})})}),a.jsx(uxe,{children:t})]}));ut.displayName=G6.displayName;const pxe=h.forwardRef(({className:e,...t},n)=>a.jsx(Q6,{ref:n,className:$e("-mx-1 my-1 h-px bg-muted",e),...t}));pxe.displayName=Q6.displayName;function BN(e){const n=(e.agentEntries&&e.agentEntries.length>0?e.agentEntries:e.agents.map(s=>({kind:"inline",agent:s}))).map(s=>s.kind==="inline"?s.agent.id:s.ref).map(s=>s.trim()).filter(Boolean),r=(e.runDefaults?.selectedAgentNames??[]).filter(s=>n.includes(s));return r.length>0?r:n}const hi=e=>e.configName?.trim()||e.name,hxe="(root)",e8="__ROOT__",X$="mcplab.configurations.collapsedSuites",SS=e=>e.suitePath&&e.suitePath.trim().length>0?e.suitePath.trim():null,rl=e=>e??hxe,NS=e=>e===null?e8:`suite:${e}`,mxe=e=>e===e8?null:e.startsWith("suite:")?e.slice(6):null,gxe=(e,t)=>t===null?e===null:e===null?!1:e===t||e.startsWith(`${t}/`),vxe=e=>{for(const t of e){const n=t.scenarioEntries??[];for(const s of n){if(s.kind==="inline"&&s.scenario?.id)return String(s.scenario.id);if(s.kind==="referenced"&&s.ref)return String(s.ref)}const r=t.scenarios??[];for(const s of r)if(s?.id)return String(s.id)}return null},xxe=e=>vxe([e]),yxe=e=>{const t=xxe(e);return t?{href:`/results?scenario=${encodeURIComponent(t)}`,tooltipLabel:`Open results filtered by scenario ${t}`}:{href:"/results",tooltipLabel:"Open results"}},Q$=["bg-red-400","bg-red-500","bg-orange-400","bg-orange-500","bg-amber-400","bg-amber-500","bg-yellow-400","bg-yellow-500","bg-lime-400","bg-lime-500","bg-green-400","bg-green-500","bg-emerald-400","bg-emerald-500","bg-teal-400","bg-teal-500","bg-cyan-400","bg-cyan-500","bg-sky-400","bg-sky-500","bg-blue-400","bg-blue-500","bg-indigo-400","bg-indigo-500","bg-violet-400","bg-violet-500","bg-purple-400","bg-purple-500","bg-fuchsia-400","bg-fuchsia-500","bg-pink-400","bg-pink-500","bg-rose-400","bg-rose-500"];function bxe(e){if(e===null)return"bg-slate-400";const t=e.split("").reduce((n,r)=>(n+r.charCodeAt(0))%Q$.length,0);return Q$[t]??"bg-slate-400"}const wxe=()=>{const{configs:e,deleteConfig:t,cloneConfig:n,loading:r,reload:s}=up(),{source:o}=Dn(),i=ss(),[c,d]=h.useState("name"),[f,m]=h.useState("asc"),[p,v]=h.useState(""),[x,j]=h.useState("all"),[y,b]=h.useState(()=>{try{const G=window.localStorage.getItem(X$);if(!G)return new Set;const re=JSON.parse(G);return Array.isArray(re)?new Set(re.filter(oe=>typeof oe=="string")):new Set}catch(G){return console.warn("Failed to restore collapsed suites from localStorage",G),new Set}}),[S,N]=h.useState(new Set),[C,k]=h.useState(new Set),[A,E]=h.useState(new Set),[P,O]=h.useState({}),D=p.trim().toLowerCase(),K=G=>{if(c===G){m(re=>re==="asc"?"desc":"asc");return}d(G),m(G==="updatedAt"?"desc":"asc")};h.useEffect(()=>{s();const G=()=>{s()};return window.addEventListener("focus",G),()=>{window.removeEventListener("focus",G)}},[s]),h.useEffect(()=>{let G=!1;return(async()=>{try{if(o.getLatestPassRatesByConfigIds){const oe=await o.getLatestPassRatesByConfigIds({lastDays:365,configs:e.map(ue=>({id:ue.id,sourcePath:ue.sourcePath,relativePath:ue.relativePath,configHash:ue.configHash}))});G||O(oe);return}O({})}catch{G||O({})}})(),()=>{G=!0}},[e,o]);const q=async(G,re)=>{await t(G),Me({title:"Deleted",description:`"${re}" has been removed.`})},B=async G=>{const re=await n(G);Me({title:"Cloned",description:`Created "${hi(re)}".`}),i(`/mcp-evaluations/${re.id}`)},Y=G=>G.agentEntries?.length??G.agents?.length??0,z=G=>G.scenarioEntries?.length??G.scenarios?.length??0,I=h.useMemo(()=>{const G=new Set;for(const re of e){const oe=SS(re);if(G.add(oe),!oe)continue;const ue=oe.split("/").filter(Boolean);for(let ae=1;ae<ue.length;ae+=1)G.add(ue.slice(0,ae).join("/"))}return Array.from(G).sort((re,oe)=>rl(re).localeCompare(rl(oe)))},[e]),T=h.useMemo(()=>e.filter(G=>{const re=SS(G),oe=x==="all"?void 0:mxe(x),ue=rl(re);return oe!==void 0&&!gxe(re,oe)?!1:D.length===0?!0:[hi(G),G.id,G.description??"",G.loadError??"",ue,G.relativePath??""].join(" ").toLowerCase().includes(D)}),[e,D,x]),V=h.useMemo(()=>[...T].sort((re,oe)=>{let ue=0;return c==="name"&&(ue=hi(re).localeCompare(hi(oe))),c==="scenarios"&&(ue=z(re)-z(oe)),c==="agents"&&(ue=Y(re)-Y(oe)),c==="updatedAt"&&(ue=new Date(re.updatedAt).getTime()-new Date(oe.updatedAt).getTime()),f==="asc"?ue:-ue}),[T,c,f]),H=G=>c!==G?a.jsx(zc,{className:"h-3.5 w-3.5 text-muted-foreground"}):f==="asc"?a.jsx(Ns,{className:"h-3.5 w-3.5"}):a.jsx(en,{className:"h-3.5 w-3.5"}),M=G=>{b(re=>{const oe=new Set(re);return oe.has(G)?oe.delete(G):oe.add(G),oe})},X=async(G,re,oe)=>{if(C.has(G))return;const ue=e.find(ye=>ye.id===G),ae=ue?BN(ue):[];k(ye=>new Set(ye).add(G));try{await o.startRun({configPath:re,runsPerScenario:1,...ae.length>0?{agents:ae}:{}}),N(ye=>new Set(ye).add(G)),window.setTimeout(()=>{N(ye=>{const se=new Set(ye);return se.delete(G),se})},2e3),Me({title:"Queued",description:`"${oe}" added to run queue.`})}catch(ye){Me({title:"Could not queue evaluation",description:ye instanceof Error?ye.message:String(ye),variant:"destructive"})}finally{k(ye=>{const se=new Set(ye);return se.delete(G),se})}};h.useEffect(()=>{try{window.localStorage.setItem(X$,JSON.stringify(Array.from(y)))}catch(G){console.warn("Failed to persist collapsed suites to localStorage (quota/private mode?)",G)}},[y]);const $=async(G,re,oe)=>{if(!A.has(G)){E(ue=>new Set(ue).add(G));try{const ue=oe.filter(ge=>typeof ge.sourcePath=="string"&&ge.sourcePath.trim().length>0);if(ue.length===0){Me({title:"No runnable evaluations",description:`Suite "${re}" has no evaluation files with a source path.`,variant:"destructive"});return}const ae=await Promise.allSettled(ue.map(ge=>{const ve=BN(ge);return o.startRun({configPath:String(ge.sourcePath),runsPerScenario:1,...ve.length>0?{agents:ve}:{}})})),ye=ae.filter(ge=>ge.status==="fulfilled").length,se=ae.length-ye,de=ae.find(ge=>ge.status==="rejected"),De=de?de.reason instanceof Error?de.reason.message:String(de.reason):void 0;Me({title:se===0?"Suite queued":"Suite queued with errors",description:se===0?`Queued ${ye} evaluation${ye===1?"":"s"} for suite "${re}".`:`Queued ${ye}/${ue.length} evaluations for suite "${re}" (${se} failed${De?`: ${De}`:""}).`,variant:se===0?"default":"destructive"})}catch(ue){Me({title:"Could not queue suite",description:ue instanceof Error?ue.message:String(ue),variant:"destructive"})}finally{E(ue=>{const ae=new Set(ue);return ae.delete(G),ae})}}},F=h.useMemo(()=>{const G=new Map;for(const re of V){const oe=SS(re),ue=G.get(oe);ue?ue.push(re):G.set(oe,[re])}return Array.from(G.entries()).sort((re,oe)=>rl(re[0]).localeCompare(rl(oe[0])))},[V]);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(y5,{className:"h-6 w-6"}),"MCP Evaluations"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage your MCP evaluation suites"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(W_,{value:p,onValueChange:v,placeholder:"Search evaluations..."}),a.jsxs(In,{value:x,onValueChange:j,children:[a.jsx(An,{className:"h-9 w-[200px]",children:a.jsx($n,{placeholder:"All suites"})}),a.jsxs(En,{children:[a.jsx(ut,{value:"all",children:"All suites"}),I.map(G=>a.jsx(ut,{value:NS(G),children:rl(G)},NS(G)))]})]}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{s()},children:[a.jsx(Ka,{className:"mr-2 h-4 w-4"}),"Refresh"]}),a.jsxs(Z,{variant:"outline",size:"sm",children:[a.jsx(TW,{className:"mr-2 h-4 w-4"}),"Import YAML"]}),a.jsx(Z,{size:"sm",asChild:!0,children:a.jsxs(At,{to:"/mcp-evaluations/new",children:[a.jsx(Ao,{className:"mr-2 h-4 w-4"}),"Create New"]})})]})]}),a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Vt,{children:[a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>K("name"),children:["Name",H("name")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>K("scenarios"),children:["Scenarios",H("scenarios")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>K("agents"),children:["Agents",H("agents")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>K("updatedAt"),children:["Last Updated",H("updatedAt")]})}),a.jsx(ct,{className:"text-right",children:"Last Run"}),a.jsx(ct,{className:"w-[220px] text-right"})]})}),a.jsxs(ca,{children:[F.map(([G,re])=>{const oe=rl(G),ue=NS(G),ae=y.has(ue),ye=A.has(ue);return a.jsxs(h.Fragment,{children:[a.jsx(Vt,{className:"bg-muted/40 hover:bg-muted/40",children:a.jsx(Ue,{colSpan:6,className:"py-2",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("button",{type:"button",className:"inline-flex h-6 items-center gap-2 text-xs leading-none hover:text-foreground",onClick:()=>M(ue),"aria-expanded":!ae,"aria-label":`${ae?"Expand":"Collapse"} suite ${oe}`,children:[a.jsx(Fg,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform ${ae?"":"rotate-90"}`,"aria-hidden":"true"}),a.jsx("span",{className:`h-2 w-2 rounded-full ${bxe(G)}`,"aria-hidden":"true"}),G===null?a.jsx(jW,{className:"h-3.5 w-3.5 text-muted-foreground","aria-hidden":"true"}):a.jsx(bW,{className:"h-3.5 w-3.5 text-muted-foreground","aria-hidden":"true"}),a.jsx("span",{className:"font-medium",children:oe}),a.jsxs("span",{className:"text-muted-foreground",children:["(",re.length,")"]})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-xs",disabled:ye,onClick:()=>{$(ue,oe,re)},children:[a.jsx(Cs,{className:"mr-1 h-3.5 w-3.5"}),ye?"Queueing...":"Run Suite"]})]})})},`suite-${ue}`),!ae&&re.map(se=>{const de=yxe(se);return a.jsxs(Vt,{children:[a.jsx(Ue,{children:a.jsxs("div",{children:[a.jsx(At,{to:`/mcp-evaluations/${se.id}`,className:"font-medium text-sm hover:text-primary",children:hi(se)}),se.loadError&&a.jsxs(et,{variant:"destructive",className:"ml-2 align-middle text-[10px]",children:[a.jsx(sm,{className:"mr-1 h-3 w-3"}),"Broken"]}),se.relativePath&&a.jsx("div",{className:"mt-0.5",children:a.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:se.relativePath})}),se.loadError&&a.jsx("p",{className:"text-xs text-destructive mt-0.5 break-all",children:se.loadError})]})}),a.jsx(Ue,{className:"text-right font-mono text-sm",children:z(se)}),a.jsx(Ue,{className:"text-right font-mono text-sm",children:Y(se)}),a.jsx(Ue,{className:"text-right text-xs text-muted-foreground",children:a.jsxs("div",{className:"inline-flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(se.updatedAt).toLocaleDateString()]})}),a.jsx(Ue,{className:"text-right",children:typeof P[se.id]=="number"?a.jsx("div",{className:"inline-flex justify-end",children:a.jsx(zs,{rate:P[se.id]})}):""}),a.jsx(Ue,{className:"w-[220px] whitespace-nowrap",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsxs(Sp,{children:[a.jsx(Np,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(zg,{className:"h-4 w-4"})})}),a.jsxs(Uu,{align:"end",children:[a.jsxs(Ir,{onClick:()=>i(`/mcp-evaluations/${se.id}`),children:[a.jsx(Zf,{className:"mr-2 h-3.5 w-3.5"}),"Edit"]}),a.jsxs(Ir,{onClick:()=>{B(se.id)},children:[a.jsx(Hr,{className:"mr-2 h-3.5 w-3.5"}),"Clone"]}),a.jsxs(Ir,{className:"text-destructive",onClick:()=>{q(se.id,hi(se))},children:[a.jsx(Ga,{className:"mr-2 h-3.5 w-3.5"}),"Delete"]})]})]}),a.jsx(Ro,{children:a.jsxs(To,{children:[a.jsx(Oo,{asChild:!0,children:a.jsx(Z,{size:"icon",variant:"outline",className:"h-8 w-8",asChild:!0,"aria-label":de.tooltipLabel,children:a.jsxs(At,{to:de.href,children:[a.jsx(jl,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"sr-only",children:de.tooltipLabel})]})})}),a.jsx(Gs,{children:de.tooltipLabel})]})}),a.jsx(Ro,{children:a.jsxs(To,{children:[a.jsx(Oo,{asChild:!0,children:a.jsx(Z,{size:"sm",variant:"outline",className:`h-8 px-2 text-xs ${S.has(se.id)?"border-green-600 bg-green-600 text-white hover:bg-green-700 hover:text-white":""}`,disabled:C.has(se.id)||!se.sourcePath,onClick:()=>se.sourcePath&&void X(se.id,se.sourcePath,hi(se)),"aria-label":`Queue ${hi(se)}`,children:S.has(se.id)?"Queued":C.has(se.id)?"Queueing...":a.jsxs(a.Fragment,{children:[a.jsx(CW,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"sr-only",children:"Queue evaluation"})]})})}),a.jsx(Gs,{children:"Queue evaluation run"})]})}),a.jsx(Z,{size:"sm",variant:"outline",asChild:!0,children:a.jsxs(At,{to:`/run?configId=${encodeURIComponent(se.id)}`,children:[a.jsx(Cs,{className:"h-3.5 w-3.5"}),"Run"]})})]})})]},se.id)})]},`suite-group-${ue}`)}),!r&&e.length===0&&a.jsx(Vt,{children:a.jsx(Ue,{colSpan:6,className:"text-center py-12 text-muted-foreground",children:"No MCP evaluations yet. Create your first one to get started."})}),!r&&e.length>0&&V.length===0&&a.jsx(Vt,{children:a.jsx(Ue,{colSpan:6,className:"text-center py-12 text-muted-foreground",children:"No MCP evaluations match this filter."})}),r&&a.jsx(Vt,{children:a.jsx(Ue,{colSpan:6,className:"text-center py-12 text-muted-foreground",children:"Loading MCP evaluations..."})})]})]})})})]})};var jxe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Sxe=jxe.reduce((e,t)=>{const n=nv(`Primitive.${t}`),r=h.forwardRef((s,o)=>{const{asChild:i,...c}=s,d=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Nxe="Label",t8=h.forwardRef((e,t)=>a.jsx(Sxe.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));t8.displayName=Nxe;var n8=t8;const Cxe=Bl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),He=h.forwardRef(({className:e,...t},n)=>a.jsx(n8,{ref:n,className:$e(Cxe(),e),...t}));He.displayName=n8.displayName;const Es=h.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:$e("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));Es.displayName="Textarea";var nx="Tabs",[_xe]=kr(nx,[Gv]),r8=Gv(),[kxe,Z_]=_xe(nx),a8=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:c,activationMode:d="automatic",...f}=e,m=qu(c),[p,v]=Aa({prop:r,onChange:s,defaultProp:o??"",caller:nx});return a.jsx(kxe,{scope:n,baseId:fr(),value:p,onValueChange:v,orientation:i,dir:m,activationMode:d,children:a.jsx(lt.div,{dir:m,"data-orientation":i,...f,ref:t})})});a8.displayName=nx;var s8="TabsList",o8=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=Z_(s8,n),i=r8(n);return a.jsx(bB,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:r,children:a.jsx(lt.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});o8.displayName=s8;var i8="TabsTrigger",l8=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,i=Z_(i8,n),c=r8(n),d=d8(i.baseId,r),f=f8(i.baseId,r),m=r===i.value;return a.jsx(wB,{asChild:!0,...c,focusable:!s,active:m,children:a.jsx(lt.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":f,"data-state":m?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...o,ref:t,onMouseDown:We(e.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?i.onValueChange(r):p.preventDefault()}),onKeyDown:We(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(r)}),onFocus:We(e.onFocus,()=>{const p=i.activationMode!=="manual";!m&&!s&&p&&i.onValueChange(r)})})})});l8.displayName=i8;var c8="TabsContent",u8=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...i}=e,c=Z_(c8,n),d=d8(c.baseId,r),f=f8(c.baseId,r),m=r===c.value,p=h.useRef(m);return h.useEffect(()=>{const v=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(v)},[]),a.jsx(ar,{present:s||m,children:({present:v})=>a.jsx(lt.div,{"data-state":m?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!v,id:f,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:v&&o})})});u8.displayName=c8;function d8(e,t){return`${e}-trigger-${t}`}function f8(e,t){return`${e}-content-${t}`}var Axe=a8,p8=o8,h8=l8,m8=u8;const rx=Axe,Cp=h.forwardRef(({className:e,...t},n)=>a.jsx(p8,{ref:n,className:$e("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Cp.displayName=p8.displayName;const Vs=h.forwardRef(({className:e,...t},n)=>a.jsx(h8,{ref:n,className:$e("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",e),...t}));Vs.displayName=h8.displayName;const Yf=h.forwardRef(({className:e,...t},n)=>a.jsx(m8,{ref:n,className:$e("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Yf.displayName=m8.displayName;const Exe={openai:"OpenAI",anthropic:"Anthropic",azure:"Azure OpenAI",azure_openai:"Azure OpenAI",google:"Google"};function kg(e){return Exe[e]??e}const J$={openai:"bg-emerald-100 text-emerald-800",anthropic:"bg-orange-100 text-orange-800",azure:"bg-blue-100 text-blue-800",azure_openai:"bg-blue-100 text-blue-800",google:"bg-yellow-100 text-yellow-800",custom:"bg-gray-100 text-gray-800"};function g8({provider:e}){return a.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${J$[e]??J$.custom}`,children:kg(e)})}var ax="Checkbox",[Pxe]=kr(ax),[Rxe,ek]=Pxe(ax);function Txe(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:s,disabled:o,form:i,name:c,onCheckedChange:d,required:f,value:m="on",internal_do_not_use_render:p}=e,[v,x]=Aa({prop:n,defaultProp:s??!1,onChange:d,caller:ax}),[j,y]=h.useState(null),[b,S]=h.useState(null),N=h.useRef(!1),C=j?!!i||!!j.closest("form"):!0,k={checked:v,disabled:o,setChecked:x,control:j,setControl:y,name:c,form:i,value:m,hasConsumerStoppedPropagationRef:N,required:f,defaultChecked:bi(s)?!1:s,isFormControl:C,bubbleInput:b,setBubbleInput:S};return a.jsx(Rxe,{scope:t,...k,children:Oxe(p)?p(k):r})}var v8="CheckboxTrigger",x8=h.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},s)=>{const{control:o,value:i,disabled:c,checked:d,required:f,setControl:m,setChecked:p,hasConsumerStoppedPropagationRef:v,isFormControl:x,bubbleInput:j}=ek(v8,e),y=Tt(s,m),b=h.useRef(d);return h.useEffect(()=>{const S=o?.form;if(S){const N=()=>p(b.current);return S.addEventListener("reset",N),()=>S.removeEventListener("reset",N)}},[o,p]),a.jsx(lt.button,{type:"button",role:"checkbox","aria-checked":bi(d)?"mixed":d,"aria-required":f,"data-state":S8(d),"data-disabled":c?"":void 0,disabled:c,value:i,...r,ref:y,onKeyDown:We(t,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:We(n,S=>{p(N=>bi(N)?!0:!N),j&&x&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})})});x8.displayName=v8;var tk=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:o,required:i,disabled:c,value:d,onCheckedChange:f,form:m,...p}=e;return a.jsx(Txe,{__scopeCheckbox:n,checked:s,defaultChecked:o,disabled:c,required:i,onCheckedChange:f,name:r,form:m,value:d,internal_do_not_use_render:({isFormControl:v})=>a.jsxs(a.Fragment,{children:[a.jsx(x8,{...p,ref:t,__scopeCheckbox:n}),v&&a.jsx(j8,{__scopeCheckbox:n})]})})});tk.displayName=ax;var y8="CheckboxIndicator",b8=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,o=ek(y8,n);return a.jsx(ar,{present:r||bi(o.checked)||o.checked===!0,children:a.jsx(lt.span,{"data-state":S8(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});b8.displayName=y8;var w8="CheckboxBubbleInput",j8=h.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:i,required:c,disabled:d,name:f,value:m,form:p,bubbleInput:v,setBubbleInput:x}=ek(w8,e),j=Tt(n,x),y=Jv(o),b=Hg(r);h.useEffect(()=>{const N=v;if(!N)return;const C=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(C,"checked").set,E=!s.current;if(y!==o&&A){const P=new Event("click",{bubbles:E});N.indeterminate=bi(o),A.call(N,bi(o)?!1:o),N.dispatchEvent(P)}},[v,y,o,s]);const S=h.useRef(bi(o)?!1:o);return a.jsx(lt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??S.current,required:c,disabled:d,name:f,value:m,form:p,...t,tabIndex:-1,ref:j,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});j8.displayName=w8;function Oxe(e){return typeof e=="function"}function bi(e){return e==="indeterminate"}function S8(e){return bi(e)?"indeterminate":e?"checked":"unchecked"}const wr=h.forwardRef(({className:e,...t},n)=>a.jsx(tk,{ref:n,className:$e("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:a.jsx(b8,{className:$e("flex items-center justify-center text-current"),children:a.jsx(Gc,{className:"h-4 w-4"})})}));wr.displayName=tk.displayName;var sx="Collapsible",[Mxe]=kr(sx),[Ixe,nk]=Mxe(sx),N8=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:i,...c}=e,[d,f]=Aa({prop:r,defaultProp:s??!1,onChange:i,caller:sx});return a.jsx(Ixe,{scope:n,disabled:o,contentId:fr(),open:d,onOpenToggle:h.useCallback(()=>f(m=>!m),[f]),children:a.jsx(lt.div,{"data-state":ak(d),"data-disabled":o?"":void 0,...c,ref:t})})});N8.displayName=sx;var C8="CollapsibleTrigger",_8=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=nk(C8,n);return a.jsx(lt.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":ak(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:We(e.onClick,s.onOpenToggle)})});_8.displayName=C8;var rk="CollapsibleContent",k8=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=nk(rk,e.__scopeCollapsible);return a.jsx(ar,{present:n||s.open,children:({present:o})=>a.jsx($xe,{...r,ref:t,present:o})})});k8.displayName=rk;var $xe=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=e,i=nk(rk,n),[c,d]=h.useState(r),f=h.useRef(null),m=Tt(t,f),p=h.useRef(0),v=p.current,x=h.useRef(0),j=x.current,y=i.open||c,b=h.useRef(y),S=h.useRef(void 0);return h.useEffect(()=>{const N=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(N)},[]),pr(()=>{const N=f.current;if(N){S.current=S.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const C=N.getBoundingClientRect();p.current=C.height,x.current=C.width,b.current||(N.style.transitionDuration=S.current.transitionDuration,N.style.animationName=S.current.animationName),d(r)}},[i.open,r]),a.jsx(lt.div,{"data-state":ak(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!y,...o,ref:m,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":j?`${j}px`:void 0,...e.style},children:y&&s})});function ak(e){return e?"open":"closed"}var Dxe=N8;const ws=Dxe,za=_8,js=k8;function Lxe(e){return e.length>0?`Tool sequence · ${e.join(" -> ")}`:"Tool sequence"}function Va({text:e,variant:t="assistant",className:n}){const r=Fxe(e);return a.jsx("div",{className:$e("space-y-2",t==="system"&&"text-xs",n),children:r.map((s,o)=>a.jsx(h.Fragment,{children:zxe(s,o,t)},`md-${o}`))})}function Fxe(e){const t=e.replace(/\r\n/g,`
124
+ `).split(`
125
+ `),n=[];let r=0;const s=i=>i.trim()==="",o=i=>i.trimStart().startsWith("```");for(;r<t.length;){const i=t[r],c=i.trim();if(s(i)){r+=1;continue}if(o(i)){const v=c.replace(/^```/,"").trim()||void 0;r+=1;const x=[];for(;r<t.length&&!o(t[r]);)x.push(t[r]),r+=1;r<t.length&&o(t[r])&&(r+=1),n.push({type:"code",lang:v,code:x.join(`
126
+ `)});continue}if(/^---+$/.test(c)||/^\*\*\*+$/.test(c)){n.push({type:"hr"}),r+=1;continue}if(c.startsWith(">")){const v=[];for(;r<t.length&&t[r].trim().startsWith(">");)v.push(t[r].trim().replace(/^>\s?/,"")),r+=1;n.push({type:"blockquote",text:v.join(`
127
+ `)});continue}const d=c.match(/^(#{1,4})\s+(.+)$/);if(d){n.push({type:"heading",level:d[1].length,text:d[2].trim()}),r+=1;continue}if(Z$(t,r)){const v=eD(t[r]);r+=2;const x=[];for(;r<t.length&&t[r].includes("|")&&!s(t[r]);)x.push(eD(t[r])),r+=1;n.push({type:"table",headers:v,rows:x});continue}const f=c.match(/^\d+\.\s+/),m=c.match(/^[-*+]\s+/);if(f||m){const v=!!f,x=[];for(;r<t.length;){const j=t[r].trim();if(v?/^\d+\.\s+/.test(j):/^[-*+]\s+/.test(j)){x.push(j.replace(v?/^\d+\.\s+/:/^[-*+]\s+/,"")),r+=1;continue}s(t[r])&&(r+=1);break}n.push({type:"list",ordered:v,items:x});continue}const p=[i];for(r+=1;r<t.length;){const v=t[r],x=v.trim();if(s(v)||o(v)||/^---+$/.test(x)||/^#{1,4}\s+/.test(x)||x.startsWith(">")||Z$(t,r)||/^\d+\.\s+/.test(x)||/^[-*+]\s+/.test(x))break;p.push(v),r+=1}n.push({type:"paragraph",text:p.join(`
128
+ `)})}return n}function Z$(e,t){if(t+1>=e.length)return!1;const n=e[t].trim(),r=e[t+1].trim();return n.includes("|")?/^\|?(\s*:?-{3,}:?\s*\|)+\s*:?-{3,}:?\s*\|?$/.test(r):!1}function eD(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(t=>t.trim())}function zxe(e,t,n){if(e.type==="hr")return a.jsx("hr",{className:"border-border/60"});if(e.type==="heading"){const r=e.level===1?"text-base font-semibold":e.level===2?"text-sm font-semibold":"text-sm font-medium";return a.jsx("h4",{className:r,children:_c(e.text,`${t}-h`)})}if(e.type==="paragraph")return a.jsx("p",{className:$e("whitespace-pre-wrap leading-relaxed",n==="system"&&"leading-normal"),children:_c(e.text,`${t}-p`)});if(e.type==="blockquote")return a.jsx("blockquote",{className:"border-l-2 border-muted-foreground/30 pl-3 text-muted-foreground italic",children:_c(e.text,`${t}-bq`)});if(e.type==="code")return a.jsxs("div",{className:"rounded-md border bg-muted/70",children:[e.lang&&a.jsx("div",{className:"border-b px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:e.lang}),a.jsx("pre",{className:"max-h-72 overflow-auto p-2 text-xs",children:a.jsx("code",{children:e.code})})]});if(e.type==="list"){const r=e.ordered?"ol":"ul";return a.jsx(r,{className:$e("space-y-1 pl-5",e.ordered?"list-decimal":"list-disc"),children:e.items.map((s,o)=>a.jsx("li",{className:"leading-relaxed",children:_c(s,`${t}-li-${o}`)},`${t}-li-${o}`))})}return e.type==="table"?a.jsx("div",{className:"overflow-x-auto rounded-md border",children:a.jsxs("table",{className:"w-full min-w-[480px] border-collapse text-xs",children:[a.jsx("thead",{className:"bg-muted/40",children:a.jsx("tr",{children:e.headers.map((r,s)=>a.jsx("th",{className:"border-b px-2 py-1.5 text-left font-semibold align-top",children:_c(r,`${t}-thc-${s}`)},`${t}-th-${s}`))})}),a.jsx("tbody",{children:e.rows.map((r,s)=>a.jsx("tr",{className:"border-t",children:r.map((o,i)=>a.jsx("td",{className:"px-2 py-1.5 align-top",children:_c(o,`${t}-tdc-${s}-${i}`)},`${t}-td-${s}-${i}`))},`${t}-row-${s}`))})]})}):null}function _c(e,t){return e.split(/(`[^`]+`|\*\*[^*]+\*\*|\*[^*\n]+\*|_[^_\n]+_|~~[^~\n]+~~|\[[^\]]+\]\([^)]+\))/g).filter(Boolean).map((r,s)=>{if(r.startsWith("`")&&r.endsWith("`"))return a.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.92em]",children:r.slice(1,-1)},`${t}-${s}`);if(r.startsWith("**")&&r.endsWith("**"))return a.jsx("strong",{children:r.slice(2,-2)},`${t}-${s}`);if(r.startsWith("*")&&r.endsWith("*"))return a.jsx("em",{children:r.slice(1,-1)},`${t}-${s}`);if(r.startsWith("_")&&r.endsWith("_"))return a.jsx("em",{children:r.slice(1,-1)},`${t}-${s}`);if(r.startsWith("~~")&&r.endsWith("~~"))return a.jsx("s",{children:r.slice(2,-2)},`${t}-${s}`);const o=r.match(/^\[([^\]]+)\]\(([^)]+)\)$/);return o?a.jsx("a",{href:o[2],target:"_blank",rel:"noreferrer",className:"underline underline-offset-2",children:o[1]},`${t}-${s}`):a.jsx(h.Fragment,{children:r},`${t}-${s}`)})}function A8({message:e,className:t,assistantLabel:n,renderActions:r}){const s=e.role;if(s==="tool"){const c=String(e.text??"").trim();return/^(Approved|Denied) tool call\b/i.test(c)?null:a.jsxs("div",{className:$e("rounded-md border border-sky-500/30 bg-sky-500/10 px-3 py-2 text-sm",t),children:[a.jsxs("div",{className:"mb-1 flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wide text-sky-700",children:[a.jsx(Ba,{className:"h-3.5 w-3.5"}),"Tool",a.jsx("span",{className:"font-normal normal-case text-sky-700/80",children:new Date(e.createdAt).toLocaleTimeString()})]}),a.jsx("p",{className:"whitespace-pre-wrap text-sky-900",children:e.text})]})}if(s==="system")return a.jsxs("div",{className:$e("flex items-start gap-2 text-xs",t),children:[a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(fC,{className:"h-3 w-3"})}),a.jsx("div",{className:"max-w-[92%] rounded-md border border-amber-400/30 bg-amber-50/70 p-3 text-sm",children:a.jsx(Va,{text:e.text,variant:"assistant"})})]});const o=s==="user",i=o?Xc:Wr;return a.jsxs("div",{className:$e(`flex items-start gap-2 text-xs ${o?"justify-end":"justify-start"}`,t),children:[!o&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(i,{className:"h-3 w-3"})}),a.jsxs("div",{className:"relative max-w-[92%]",children:[a.jsxs("div",{className:`max-w-full break-words rounded-md border px-3 py-2 text-sm ${o?"border-primary/20 bg-primary/10":"border-border/80 bg-background shadow-sm"}`,children:[!o&&n&&a.jsx("p",{className:"mb-2 text-[11px] font-semibold text-muted-foreground",children:n}),o?a.jsx("p",{className:"whitespace-pre-wrap",children:e.text}):a.jsx(Va,{text:e.text,variant:"assistant",className:"text-sm"})]}),r]}),o&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(Xc,{className:"h-3 w-3"})})]})}function qN({call:e,loading:t=!1,onApprove:n,onDeny:r,defaultOpen:s,className:o,description:i}){const c=e.status==="pending",d=e.tool||e.publicToolName||"unknown_tool";return a.jsxs("details",{open:s??c,className:$e("group overflow-hidden rounded-md border border-border/60 bg-background",o),children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2",children:[a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ba,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:`Tool call ${d}`}),a.jsx("span",{className:`shrink-0 whitespace-nowrap rounded px-1.5 py-0.5 text-[10px] font-semibold ${c?"bg-amber-100 text-amber-900":e.status==="error"?"bg-red-100 text-red-900":e.status==="denied"?"bg-gray-100 text-gray-700":"bg-muted text-muted-foreground"}`,children:c?"Needs approval":e.status==="error"?"Error":e.status==="denied"?"Denied":"Approved"})]})}),a.jsx(en,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),a.jsxs("div",{className:"space-y-2 border-t border-border/50 px-3 py-2",children:[i&&a.jsx(Va,{text:i,variant:"assistant",className:"text-sm"}),a.jsx("pre",{className:"max-h-40 w-full max-w-full overflow-x-auto overflow-y-auto whitespace-pre rounded border bg-muted/50 p-2 text-xs",children:a.jsx("code",{children:JSON.stringify(e.arguments??{},null,2)})}),e.error&&a.jsx("p",{className:"text-xs text-destructive",children:e.error}),c&&a.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-xs",disabled:t,onClick:()=>r?.(e.id),children:"Deny"}),a.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:t,onClick:()=>n?.(e.id),children:"Approve"})]})]})]})}function E8(){return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("div",{className:"inline-flex items-center gap-2 rounded-md border bg-background px-3 py-2 text-sm text-muted-foreground",children:[a.jsx(_r,{className:"h-4 w-4 animate-spin"}),"Thinking..."]})]})}function Bxe({snippets:e,snippetsLabel:t,onSnippetSelect:n,disabled:r=!1,contentClassName:s="w-[360px]"}){return a.jsxs(Sp,{children:[a.jsx(Np,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"h-7 shrink-0 gap-1 px-1.5 text-[11px] font-normal text-muted-foreground/80 hover:text-muted-foreground",disabled:r,children:[a.jsx(Ao,{className:"h-3 w-3"}),"Snippets",a.jsx(en,{className:"h-3 w-3"})]})}),a.jsxs(Uu,{align:"start",className:s,children:[a.jsx(m6,{children:t}),a.jsx(g6,{}),e.map(o=>a.jsx(Ir,{className:"items-start whitespace-normal px-2 py-2",onSelect:()=>n(o.prompt),children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("div",{className:"text-xs font-medium leading-tight",children:o.label}),a.jsx("div",{className:"text-[11px] leading-snug text-muted-foreground",children:o.description})]})},o.label))]})]})}function P8({input:e,onInputChange:t,onSend:n,onCancel:r,inputPlaceholder:s,snippets:o,snippetsLabel:i,onSnippetSelect:c,loading:d=!1,disabled:f=!1,inputRef:m,snippetContentClassName:p}){const v=f||d;return a.jsxs("div",{className:"rounded-xl border bg-background p-2 shadow-sm",children:[a.jsx(Es,{ref:m,value:e,onChange:x=>t(x.target.value),placeholder:s,disabled:f,rows:1,className:"min-h-10 max-h-40 resize-none border-0 bg-transparent px-2 py-1 text-sm shadow-none focus-visible:ring-0 focus-visible:ring-offset-0",onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),v||n())}}),a.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 px-1 pt-1",children:[a.jsx(Bxe,{snippets:o,snippetsLabel:i,onSnippetSelect:c,disabled:v,contentClassName:p}),d&&r?a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-full",onClick:r,"aria-label":"Cancel assistant message",title:"Cancel assistant message",children:[a.jsx("span",{className:"pointer-events-none absolute inset-[2px] rounded-full border border-primary/20 border-t-primary/70 motion-reduce:animate-none animate-[spin_2.2s_linear_infinite]"}),a.jsx("span",{className:"pointer-events-none absolute inset-[4px] rounded-full border border-primary/10 motion-reduce:animate-none animate-pulse"}),a.jsx(Kd,{className:"relative z-10 h-4 w-4"})]}):d?a.jsx(Z,{type:"button",size:"icon",className:"h-8 w-8 shrink-0 rounded-full",disabled:!0,"aria-label":"Assistant is loading",title:"Assistant is loading",children:a.jsx(_r,{className:"h-4 w-4 animate-spin"})}):a.jsx(Z,{type:"button",size:"icon",className:"h-8 w-8 shrink-0 rounded-full pr-0.5",onClick:n,disabled:v||!e.trim(),"aria-label":"Send assistant message",title:"Send assistant message",children:a.jsx(EW,{className:"h-4 w-4"})})]})]})}const qxe=iv,Uxe=lv,R8=h.forwardRef(({className:e,...t},n)=>a.jsx(Ou,{ref:n,className:$e("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));R8.displayName=Ou.displayName;const T8=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(Uxe,{children:[a.jsx(R8,{}),a.jsxs(Mu,{ref:r,className:$e("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,a.jsxs(cv,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[a.jsx(ua,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));T8.displayName=Mu.displayName;const O8=({className:e,...t})=>a.jsx("div",{className:$e("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});O8.displayName="DialogHeader";const M8=h.forwardRef(({className:e,...t},n)=>a.jsx(ip,{ref:n,className:$e("text-lg font-semibold leading-none tracking-tight",e),...t}));M8.displayName=ip.displayName;const I8=h.forwardRef(({className:e,...t},n)=>a.jsx(lp,{ref:n,className:$e("text-sm text-muted-foreground",e),...t}));I8.displayName=lp.displayName;function Wxe(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var sk="ScrollArea",[$8]=kr(sk),[Hxe,is]=$8(sk),D8=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:o=600,...i}=e,[c,d]=h.useState(null),[f,m]=h.useState(null),[p,v]=h.useState(null),[x,j]=h.useState(null),[y,b]=h.useState(null),[S,N]=h.useState(0),[C,k]=h.useState(0),[A,E]=h.useState(!1),[P,O]=h.useState(!1),D=Tt(t,q=>d(q)),K=qu(s);return a.jsx(Hxe,{scope:n,type:r,dir:K,scrollHideDelay:o,scrollArea:c,viewport:f,onViewportChange:m,content:p,onContentChange:v,scrollbarX:x,onScrollbarXChange:j,scrollbarXEnabled:A,onScrollbarXEnabledChange:E,scrollbarY:y,onScrollbarYChange:b,scrollbarYEnabled:P,onScrollbarYEnabledChange:O,onCornerWidthChange:N,onCornerHeightChange:k,children:a.jsx(lt.div,{dir:K,...i,ref:D,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})})});D8.displayName=sk;var L8="ScrollAreaViewport",F8=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:s,...o}=e,i=is(L8,n),c=h.useRef(null),d=Tt(t,c,i.onViewportChange);return a.jsxs(a.Fragment,{children:[a.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:s}),a.jsx(lt.div,{"data-radix-scroll-area-viewport":"",...o,ref:d,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:a.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});F8.displayName=L8;var eo="ScrollAreaScrollbar",ok=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=is(eo,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,c=e.orientation==="horizontal";return h.useEffect(()=>(c?o(!0):i(!0),()=>{c?o(!1):i(!1)}),[c,o,i]),s.type==="hover"?a.jsx(Vxe,{...r,ref:t,forceMount:n}):s.type==="scroll"?a.jsx(Kxe,{...r,ref:t,forceMount:n}):s.type==="auto"?a.jsx(z8,{...r,ref:t,forceMount:n}):s.type==="always"?a.jsx(ik,{...r,ref:t}):null});ok.displayName=eo;var Vxe=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=is(eo,e.__scopeScrollArea),[o,i]=h.useState(!1);return h.useEffect(()=>{const c=s.scrollArea;let d=0;if(c){const f=()=>{window.clearTimeout(d),i(!0)},m=()=>{d=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",f),c.addEventListener("pointerleave",m),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",f),c.removeEventListener("pointerleave",m)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(ar,{present:n||o,children:a.jsx(z8,{"data-state":o?"visible":"hidden",...r,ref:t})})}),Kxe=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=is(eo,e.__scopeScrollArea),o=e.orientation==="horizontal",i=ix(()=>d("SCROLL_END"),100),[c,d]=Wxe("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 h.useEffect(()=>{if(c==="idle"){const f=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(f)}},[c,s.scrollHideDelay,d]),h.useEffect(()=>{const f=s.viewport,m=o?"scrollLeft":"scrollTop";if(f){let p=f[m];const v=()=>{const x=f[m];p!==x&&(d("SCROLL"),i()),p=x};return f.addEventListener("scroll",v),()=>f.removeEventListener("scroll",v)}},[s.viewport,o,d,i]),a.jsx(ar,{present:n||c!=="hidden",children:a.jsx(ik,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:We(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:We(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),z8=h.forwardRef((e,t)=>{const n=is(eo,e.__scopeScrollArea),{forceMount:r,...s}=e,[o,i]=h.useState(!1),c=e.orientation==="horizontal",d=ix(()=>{if(n.viewport){const f=n.viewport.offsetWidth<n.viewport.scrollWidth,m=n.viewport.offsetHeight<n.viewport.scrollHeight;i(c?f:m)}},10);return Nu(n.viewport,d),Nu(n.content,d),a.jsx(ar,{present:r||o,children:a.jsx(ik,{"data-state":o?"visible":"hidden",...s,ref:t})})}),ik=h.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,s=is(eo,e.__scopeScrollArea),o=h.useRef(null),i=h.useRef(0),[c,d]=h.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=H8(c.viewport,c.content),m={...r,sizes:c,onSizesChange:d,hasThumb:f>0&&f<1,onThumbChange:v=>o.current=v,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:v=>i.current=v};function p(v,x){return Zxe(v,i.current,c,x)}return n==="horizontal"?a.jsx(Gxe,{...m,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const v=s.viewport.scrollLeft,x=tD(v,c,s.dir);o.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:v=>{s.viewport&&(s.viewport.scrollLeft=v)},onDragScroll:v=>{s.viewport&&(s.viewport.scrollLeft=p(v,s.dir))}}):n==="vertical"?a.jsx(Yxe,{...m,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const v=s.viewport.scrollTop,x=tD(v,c);o.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:v=>{s.viewport&&(s.viewport.scrollTop=v)},onDragScroll:v=>{s.viewport&&(s.viewport.scrollTop=p(v))}}):null}),Gxe=h.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,o=is(eo,e.__scopeScrollArea),[i,c]=h.useState(),d=h.useRef(null),f=Tt(t,d,o.onScrollbarXChange);return h.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(q8,{"data-orientation":"horizontal",...s,ref:f,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ox(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(o.viewport){const v=o.viewport.scrollLeft+m.deltaX;e.onWheelScroll(v),K8(v,p)&&m.preventDefault()}},onResize:()=>{d.current&&o.viewport&&i&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Eg(i.paddingLeft),paddingEnd:Eg(i.paddingRight)}})}})}),Yxe=h.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,o=is(eo,e.__scopeScrollArea),[i,c]=h.useState(),d=h.useRef(null),f=Tt(t,d,o.onScrollbarYChange);return h.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(q8,{"data-orientation":"vertical",...s,ref:f,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ox(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(o.viewport){const v=o.viewport.scrollTop+m.deltaY;e.onWheelScroll(v),K8(v,p)&&m.preventDefault()}},onResize:()=>{d.current&&o.viewport&&i&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Eg(i.paddingTop),paddingEnd:Eg(i.paddingBottom)}})}})}),[Xxe,B8]=$8(eo),q8=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:f,onWheelScroll:m,onResize:p,...v}=e,x=is(eo,n),[j,y]=h.useState(null),b=Tt(t,D=>y(D)),S=h.useRef(null),N=h.useRef(""),C=x.viewport,k=r.content-r.viewport,A=Zn(m),E=Zn(d),P=ix(p,10);function O(D){if(S.current){const K=D.clientX-S.current.left,q=D.clientY-S.current.top;f({x:K,y:q})}}return h.useEffect(()=>{const D=K=>{const q=K.target;j?.contains(q)&&A(K,k)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[C,j,k,A]),h.useEffect(E,[r,E]),Nu(j,P),Nu(x.content,P),a.jsx(Xxe,{scope:n,scrollbar:j,hasThumb:s,onThumbChange:Zn(o),onThumbPointerUp:Zn(i),onThumbPositionChange:E,onThumbPointerDown:Zn(c),children:a.jsx(lt.div,{...v,ref:b,style:{position:"absolute",...v.style},onPointerDown:We(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),S.current=j.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),O(D))}),onPointerMove:We(e.onPointerMove,O),onPointerUp:We(e.onPointerUp,D=>{const K=D.target;K.hasPointerCapture(D.pointerId)&&K.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=N.current,x.viewport&&(x.viewport.style.scrollBehavior=""),S.current=null})})})}),Ag="ScrollAreaThumb",U8=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=B8(Ag,e.__scopeScrollArea);return a.jsx(ar,{present:n||s.hasThumb,children:a.jsx(Qxe,{ref:t,...r})})}),Qxe=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...s}=e,o=is(Ag,n),i=B8(Ag,n),{onThumbPositionChange:c}=i,d=Tt(t,p=>i.onThumbChange(p)),f=h.useRef(void 0),m=ix(()=>{f.current&&(f.current(),f.current=void 0)},100);return h.useEffect(()=>{const p=o.viewport;if(p){const v=()=>{if(m(),!f.current){const x=eye(p,c);f.current=x,c()}};return c(),p.addEventListener("scroll",v),()=>p.removeEventListener("scroll",v)}},[o.viewport,m,c]),a.jsx(lt.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:We(e.onPointerDownCapture,p=>{const x=p.target.getBoundingClientRect(),j=p.clientX-x.left,y=p.clientY-x.top;i.onThumbPointerDown({x:j,y})}),onPointerUp:We(e.onPointerUp,i.onThumbPointerUp)})});U8.displayName=Ag;var lk="ScrollAreaCorner",W8=h.forwardRef((e,t)=>{const n=is(lk,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(Jxe,{...e,ref:t}):null});W8.displayName=lk;var Jxe=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,s=is(lk,n),[o,i]=h.useState(0),[c,d]=h.useState(0),f=!!(o&&c);return Nu(s.scrollbarX,()=>{const m=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(m),d(m)}),Nu(s.scrollbarY,()=>{const m=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(m),i(m)}),f?a.jsx(lt.div,{...r,ref:t,style:{width:o,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Eg(e){return e?parseInt(e,10):0}function H8(e,t){const n=e/t;return isNaN(n)?0:n}function ox(e){const t=H8(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function Zxe(e,t,n,r="ltr"){const s=ox(n),o=s/2,i=t||o,c=s-i,d=n.scrollbar.paddingStart+i,f=n.scrollbar.size-n.scrollbar.paddingEnd-c,m=n.content-n.viewport,p=r==="ltr"?[0,m]:[m*-1,0];return V8([d,f],p)(e)}function tD(e,t,n="ltr"){const r=ox(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,c=o-r,d=n==="ltr"?[0,i]:[i*-1,0],f=Gf(e,d);return V8([0,i],[0,c])(f)}function V8(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function K8(e,t){return e>0&&e<t}var eye=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=n.left!==o.left,c=n.top!==o.top;(i||c)&&t(),n=o,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function ix(e,t){const n=Zn(e),r=h.useRef(0);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),h.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Nu(e,t){const n=Zn(t);pr(()=>{let r=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(r),s.unobserve(e)}}},[e,n])}var G8=D8,tye=F8,nye=W8;const ck=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(G8,{ref:r,className:$e("relative overflow-hidden",e),...n,children:[a.jsx(tye,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(Y8,{}),a.jsx(nye,{})]}));ck.displayName=G8.displayName;const Y8=h.forwardRef(({className:e,orientation:t="vertical",...n},r)=>a.jsx(ok,{ref:r,orientation:t,className:$e("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:a.jsx(U8,{className:"relative flex-1 rounded-full bg-border"})}));Y8.displayName=ok.displayName;function UN(e){return e instanceof Error&&e.name==="AbortError"||typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError"}function rye(e,t,n){if(e.type==="agent_check"){const s=String(e.label??"").trim();return s?t.find(o=>o.type==="agent_check"&&o.label===s):void 0}if(e.type==="tool_input_contains"||e.type==="tool_input_regex"||e.type==="tool_input_jsonpath"){const s=t.filter(i=>i.type===e.type&&i.metadata?.tool===e.tool),o=i=>e.type==="tool_input_contains"?go(e.value)!==void 0&&go(i.metadata?.value)===go(e.value):e.type==="tool_input_regex"?go(e.value)!==void 0&&go(i.metadata?.pattern)===go(e.value):i.metadata?.path===e.path&&e.equals===void 0==(i.metadata?.equals===void 0)&&(e.equals===void 0||i.metadata?.equals===e.equals);return s.find(o)??t.find(i=>i.type===e.type&&i.label===n(e))}const r=n(e);return t.find(s=>s.type===e.type&&s.label===r)}function X8({evalRules:e,failureReasons:t,runError:n,checkResults:r}){return n||t.find(o=>o.startsWith("Scenario error:"))?e.map(o=>({rule:o,status:"not_evaluated",failureReason:void 0})):r?.length?e.map(o=>{const i=rye(o,r,lx);return{rule:o,status:i?.status??"not_evaluated",failureReason:i?.reason}}):e.map(o=>{const i=sye(o,t);return{rule:o,status:i?"failed":"passed",failureReason:i}})}function lx(e){if(e.type==="required_tool")return`Required tool · ${e.value}`;if(e.type==="forbidden_tool")return`Forbidden tool · ${e.value}`;if(e.type==="tool_sequence")return FL(e.sequence??[]);if(e.type==="tool_input_contains")return mb({type:"contains",tool:String(e.tool??""),value:String(e.value??"")});if(e.type==="tool_input_regex")return mb({type:"regex",tool:String(e.tool??""),pattern:String(e.value??"")});if(e.type==="tool_input_jsonpath"){const t={type:"jsonpath",tool:String(e.tool??""),path:String(e.path??""),...e.equals!==void 0?{equals:e.equals}:{}};return mb(t)}return e.type==="response_contains"?`Text contains · ${e.value}`:e.type==="response_not_contains"?`Text does not contain · ${e.value}`:e.type==="response_starts_with"?`Text starts with · ${e.value}`:e.type==="response_ends_with"?`Text ends with · ${e.value}`:e.type==="response_equals"?`Text equals · ${e.value}`:e.type==="response_regex"?`Text matches regex · ${e.value}`:e.type==="response_jsonpath"?e.equals!==void 0?`JSONPath equals · ${e.path} == ${String(e.equals)}`:`JSONPath exists · ${e.path}`:e.type==="response_jsonpath_exists"?`JSONPath exists · ${e.path}`:e.type==="response_jsonpath_not_exists"?`JSONPath not exists · ${e.path}`:e.type==="agent_check"?`Agent check · ${e.label}`:`${e.type} · ${e.value}`}function aye(e){return FL(e).replace(/^Tool sequence · /,"")}function sye(e,t){if(e.type==="tool_input_contains"||e.type==="tool_input_regex"||e.type==="tool_input_jsonpath"){const o=e.type==="tool_input_contains"?{type:"contains",tool:String(e.tool??""),value:String(e.value??"")}:e.type==="tool_input_regex"?{type:"regex",tool:String(e.tool??""),pattern:String(e.value??"")}:{type:"jsonpath",tool:String(e.tool??""),path:String(e.path??""),...e.equals!==void 0?{equals:e.equals}:{}},i=[Ad(o,"tool_not_used"),Ad(o,"input_mismatch"),Ad(o,"invalid_regex"),Ad(o,"invalid_jsonpath"),Ad(o,"serialization")];return t.find(c=>i.includes(c))}if(e.type==="response_jsonpath_exists"){const o=String(e.path??"").trim();return o?t.find(i=>i.startsWith(`JSONPath assertion failed: ${o}`)||i.startsWith(`JSONPath assertion failed: invalid JSON for path ${o}`)):void 0}const n=go(e.value);if((e.type==="response_contains"||e.type==="response_not_contains"||e.type==="response_starts_with"||e.type==="response_ends_with"||e.type==="response_equals"||e.type==="response_regex")&&n===void 0)return;const r=e.type==="required_tool"?`Required tool not used: ${e.value}`:e.type==="forbidden_tool"?`Forbidden tool used: ${e.value}`:e.type==="tool_sequence"?`Tool sequence order was not satisfied: ${(e.sequence??[]).join(" -> ")}`:e.type==="response_contains"?`Contains assertion failed: ${n}`:e.type==="response_not_contains"?`Not-contains assertion failed: ${n}`:e.type==="response_starts_with"?`Starts-with assertion failed: ${n}`:e.type==="response_ends_with"?`Ends-with assertion failed: ${n}`:e.type==="response_equals"?`Equals assertion failed: ${n}`:e.type==="response_regex"?`Regex assertion failed: ${n}`:e.type==="response_jsonpath"?e.equals!==void 0?`JSONPath equals assertion failed: ${e.path}`:`JSONPath assertion failed: ${e.path}`:e.type==="response_jsonpath_not_exists"?`JSONPath not-exists assertion failed: ${e.path}`:e.type==="agent_check"?String(e.label??""):"";if(!r)return;const s=t.find(o=>o===r);if(s)return s;if(e.type==="response_regex"){const o=n??"";return o?t.find(i=>i.startsWith("Regex assertion failed:")&&i.includes(o)):void 0}return e.type==="response_jsonpath"||e.type==="response_jsonpath_not_exists"?t.find(o=>o.includes(e.path??"")):e.type==="tool_sequence"?t.find(o=>o.startsWith(`Tool sequence order was not satisfied: ${aye(e.sequence??[])}`)||o.startsWith("Required tool in sequence not used:")):t.find(o=>o.startsWith(r))}async function oye(e){const{sessionId:t,source:n,serverName:r,onLaunchUrl:s,timeoutMs:o=5*6e4}=e,i=Date.now()+o;let c=!1;for(;Date.now()<i;){const{session:d}=await n.getOAuthRuntimeSession(t),f=d.authorizeLaunchUrl||d.authorizationUrl||"";if(f&&s&&s(f),d.status==="completed"&&d.hasAccessToken){c=!0;break}if(d.status==="error"||d.status==="stopped")throw new Error(`OAuth login failed for '${r}' (${d.status}). ${d.lastError||""}`.trim());await new Promise(m=>setTimeout(m,1500))}if(!c)throw new Error(`OAuth login timed out for '${r}'. Authorization was not completed within 5 minutes.`)}const iye=250;async function _o(e){const{serverNames:t,source:n,onServerAuthStart:r,onServerStatus:s,timeoutMs:o=5*6e4}=e,i=Array.from(new Set(t.filter(Boolean)));if(i.length===0)return;const c=Date.now()+o,d=new Set,f=new Map;for(;Date.now()<c;){const m=await n.ensureOAuthServers({serverNames:i});for(const v of m.servers){const x=`${v.status}:${v.debugState??""}:${v.runtimeSessionId??""}`;f.get(v.serverName)!==x&&(f.set(v.serverName,x),s?.({serverName:v.serverName,status:v.status,debugState:v.debugState,tokenExpiresAt:v.tokenExpiresAt,tokenExpiresInSeconds:v.tokenExpiresInSeconds,message:v.message}))}const p=m.servers.filter(v=>v.status==="auth_required");if(p.length===0&&m.allReady)return;for(const v of p){const x=v.runtimeSessionId;if(!x)throw new Error(v.message||`OAuth login required for '${v.serverName}'.`);d.has(x)||(d.add(x),r?.(v.serverName));const j=(()=>{let y=!1;return b=>{if(y||!b)return;y=!0;const S=b.startsWith("http")?b:`${window.location.origin}${b}`;window.open(S,"_blank","noopener,noreferrer")}})();j(v.authorizeLaunchUrl||v.authorizationUrl||""),await oye({sessionId:x,source:n,serverName:v.serverName,onLaunchUrl:j,timeoutMs:Math.max(1e4,c-Date.now())})}await new Promise(v=>{window.setTimeout(v,iye)})}throw new Error("OAuth login timed out before all required servers were authorized.")}const lye=[{label:"Suggest Checks",description:"Propose stronger evaluation checks for this scenario.",prompt:"Review the current checks in this scenario and suggest stronger alternatives. For each suggestion, explain what failure mode it catches that the existing checks miss. Prioritize checks that are deterministic, not sensitive to minor phrasing changes, and that would reliably catch regressions."},{label:"Suggest Value Capture Rules",description:"Recommend extract/value capture rules for key outputs.",prompt:"Analyze the expected tool calls and outputs in this scenario and suggest value capture rules that extract the most meaningful structured data. For each rule, explain which field to capture, why it matters for evaluation, and what a good vs. bad captured value looks like."},{label:"Generate Structured Updates",description:"Return apply-ready Checks and Value Capture suggestions.",prompt:["Propose concrete scenario updates and include structured suggestions that can be applied directly.","Return ONLY valid JSON envelope and no markdown.","Required shape:",'{"type":"assistant_message","text":"short rationale","suggestions":{"evalRules":{"replacement":[...]}, "extractRules":{"replacement":[...]}}}',"If tool usage is clear, include at least one required_tool check.","For argument validation, use tool_input_contains with tool and value, tool_input_regex with tool and value, or tool_input_jsonpath with tool and path plus optional equals.","Prefer deterministic checks and concise capture patterns."].join(`
129
+ `)},{label:"Improve Prompt Determinism",description:"Reduce ambiguity and improve reproducibility.",prompt:"Identify parts of this scenario's prompt or context that are ambiguous, open-ended, or likely to produce different results across runs. Suggest specific rewrites that make the expected behavior more deterministic — without changing the intent of what is being tested."},{label:"Generate Scenario Draft",description:"Create a draft scenario from the current context.",prompt:"Based on the current tool configuration and context, generate a complete scenario draft. Include a clear prompt, realistic expected tool calls with arguments, meaningful checks that validate the core behavior, and at least one value capture rule. Explain your choices so I can adjust them."}];function Q8(e){if(Array.isArray(e.sequence))return e.sequence.map(n=>n.trim()).filter(Boolean);const t=typeof e.value=="string"?e.value.trim():"";return!t||t.toLowerCase()==="tool sequence"?[]:t.split(/\s*(?:->|,|\n)\s*/).map(n=>n.trim()).filter(Boolean)}function cye(e){const t=[];let n=0;for(const r of e){if(r.type==="tool_sequence"){const s=Q8(r);s.length>0?t.push({type:"tool_sequence",sequence:s}):n+=1;continue}t.push(r)}return{rules:t,skippedToolSequences:n}}function uye(e){if(e.type==="tool_sequence"){const t=Q8(e);return t.length>0?`Tool sequence · ${t.join(" -> ")}`:"Tool sequence · No tool steps"}return lx(e)}function dye({open:e,onOpenChange:t,configId:n,configPath:r,scenario:s,agents:o,servers:i,defaultAssistantAgentName:c,initialUserMessage:d,onApplyPatch:f}){const{source:m}=Dn(),[p,v]=h.useState(null),[x,j]=h.useState(null),[y,b]=h.useState(""),[S,N]=h.useState(!1),[C,k]=h.useState(!1),[A,E]=h.useState(new Set),P=h.useRef(null),O=h.useRef(null),D=h.useRef(null),K=h.useRef(null),q=h.useRef(0),[B,Y]=h.useState(!1),z=h.useRef(!1),I=c||o[0]?.id||"",T=h.useCallback(()=>{const ve=K.current;ve&&ve.controller.abort()},[]);h.useEffect(()=>{if(!e||!I||p)return;let ve=!1;return N(!0),(async()=>{const at=Array.from(new Set(s.serverIds.filter(it=>i.find(Ye=>Ye.id===it)?.authType==="oauth2")));await _o({serverNames:at,source:m});const tt=await m.createScenarioAssistantSession({configId:n,configPath:r,scenarioId:s.id,selectedAssistantAgentName:I,context:{scenario:{id:s.id,name:s.name,prompt:s.prompt,serverNames:s.serverIds,evalRules:s.evalRules,extractRules:s.extractRules},availableServers:i.map(it=>({name:it.name||it.id,url:it.url})),availableAgents:o.map(it=>({name:it.name||it.id,provider:it.provider,model:it.model}))}});ve||(v(tt.sessionId),H(tt.session),N(!1))})().catch(at=>{ve||Me({title:"Could not start Scenario Assistant",description:at instanceof Error?at.message:String(at),variant:"destructive"})}).finally(()=>{ve||N(!1)}),()=>{ve=!0}},[e,m,p,n,r,s,o,i,I]);const V=()=>{T(),v(null),j(null),b(""),E(new Set),D.current=null},H=h.useCallback(ve=>{j(Se=>Se&&Se.messages.length>ve.messages.length?Se:ve)},[]),M=h.useCallback(()=>{const ve=K.current;ve&&(T(),b(ve.prompt),N(!1),k(!1))},[T]),X=ve=>{V(),m.closeScenarioAssistantSession(ve).catch(()=>{})};h.useEffect(()=>{e||p&&(z.current||B||X(p))},[e,p,m,B]),h.useEffect(()=>()=>{T(),p&&m.closeScenarioAssistantSession(p).catch(()=>{})},[T,p,m]),h.useEffect(()=>{if(!e)return;B&&Y(!1),z.current&&(z.current=!1);const ve=window.setTimeout(()=>{P.current?.scrollIntoView({behavior:"smooth",block:"end"})},0);return()=>window.clearTimeout(ve)},[e,S,x?.messages.length,x?.pendingToolCalls.length,x?.warnings.length]),h.useEffect(()=>{const ve=O.current;if(!ve)return;ve.style.height="0px";const Se=Math.min(ve.scrollHeight,160);ve.style.height=`${Math.max(40,Se)}px`},[y,e]);const $=o.length>0&&s.serverIds.length>0&&!!I,F=async ve=>{if(!p)return;const Se=ve.trim();if(!Se)return;const at=++q.current,tt=new AbortController,it=`msg-local-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,kt={id:it,role:"user",text:Se,createdAt:new Date().toISOString()};K.current={id:at,controller:tt,prompt:Se},k(!0),j(Ye=>Ye&&{...Ye,messages:[...Ye.messages,kt]}),b(""),N(!0);try{const Ye=await m.sendScenarioAssistantMessage(p,Se,tt.signal);if(tt.signal.aborted||K.current?.id!==at)return;H(Ye.session)}catch(Ye){if(UN(Ye)||tt.signal.aborted||K.current?.id!==at)return;j(_e=>_e&&{..._e,messages:_e.messages.filter(Ee=>Ee.id!==it)}),b(_e=>_e.trim()?_e:Se),Me({title:"Scenario Assistant error",description:Ye instanceof Error?Ye.message:String(Ye),variant:"destructive"})}finally{K.current?.id===at&&(K.current=null,N(!1),k(!1))}},G=ve=>{b(ve),requestAnimationFrame(()=>O.current?.focus())};h.useEffect(()=>{if(!e||!p||!x||!$||K.current)return;const ve=String(d??"").trim();ve&&D.current!==ve&&(D.current=ve,F(ve))},[e,p,x,$,d]),h.useEffect(()=>{if(!(!e||!p||!x))return m.subscribeScenarioAssistantSessionEvents(p,ve=>{H(ve.payload.session)})},[e,p,m,H]);const re=async ve=>{if(p){N(!0);try{const Se=await m.approveScenarioAssistantToolCall(p,ve);H(Se.session)}catch(Se){Me({title:"Tool call failed",description:Se instanceof Error?Se.message:String(Se),variant:"destructive"})}finally{N(!1)}}},oe=async ve=>{if(p){N(!0);try{const Se=await m.denyScenarioAssistantToolCall(p,ve);H(Se.session)}catch(Se){Me({title:"Could not deny tool call",description:Se instanceof Error?Se.message:String(Se),variant:"destructive"})}finally{N(!1)}}},ue=async()=>{if(p){N(!0);try{const ve=await m.approveAllScenarioAssistantToolCalls(p);H(ve.session)}catch(ve){Me({title:"Could not approve all tool calls",description:ve instanceof Error?ve.message:String(ve),variant:"destructive"})}finally{N(!1)}}},ae=(ve,Se,at,tt,it="replace")=>{if(!Se)return;if(at==="prompt"&&Se.prompt&&f({prompt:Se.prompt.replacement}),at==="evalRules"&&Se.evalRules){const Ye=cye(tt??Se.evalRules.replacement);f({evalRules:it==="append"?[...s.evalRules,...Ye.rules]:Ye.rules}),Ye.skippedToolSequences>0&&Me({title:"Skipped invalid tool sequence",description:"The assistant suggested a sequence check without any tool steps.",variant:"destructive"})}if(at==="extractRules"&&Se.extractRules&&f({extractRules:Se.extractRules.replacement}),ve){const Ye=`${ve}:${at}`;E(_e=>new Set([..._e,Ye]))}Me({title:"Applied suggestion",description:`Updated ${{prompt:"Prompt",evalRules:"Checks",extractRules:"Value Capture Rules"}[at]}`})},ye=(ve,Se,at,tt)=>{if(Se?.extractRules){if(f({extractRules:tt==="append"?[...s.extractRules,...at]:at}),ve){const it=`${ve}:extractRules`;E(kt=>new Set([...kt,it]))}Me({title:"Applied suggestion",description:"Updated Value Capture Rules"})}},se=()=>{const ve=document.activeElement;ve instanceof HTMLElement&&ve.blur()},de=ve=>{ve||(se(),Y(!1),z.current=!1),t(ve)},De=()=>{se(),z.current=!0,Y(!0),t(!1)},ge=()=>{se(),z.current=!1,Y(!1),p&&X(p)};return a.jsxs(a.Fragment,{children:[!e&&p&&a.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 rounded-md border bg-background px-3 py-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-medium",children:"Scenario Assistant (session active)"}),a.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:["Resume conversation for ",a.jsx("span",{className:"font-mono",children:s.id}),x?` · ${x.messages.length} messages`:""]})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>t(!0),children:[a.jsx(oa,{className:"mr-1.5 h-3.5 w-3.5"}),"Resume"]}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",className:"h-8 px-2 text-muted-foreground",onClick:ge,"aria-label":"Discard assistant session",title:"Discard assistant session",children:a.jsx(ua,{className:"h-4 w-4"})})]})]}),a.jsx(qxe,{open:e,onOpenChange:de,children:a.jsxs(T8,{className:"max-w-6xl h-[85vh] flex flex-col",children:[p&&a.jsxs("button",{type:"button",className:"absolute right-12 top-4 z-10 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",onClick:De,"aria-label":"Minimize assistant",title:"Minimize assistant",children:[a.jsx(_W,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Minimize"})]}),a.jsx(O8,{className:"pr-20",children:a.jsx("div",{className:"flex items-start justify-between gap-3",children:a.jsxs("div",{className:"min-w-0",children:[a.jsxs(M8,{className:"flex items-center gap-2",children:[a.jsx(oa,{className:"h-4 w-4"}),"Scenario Assistant"]}),a.jsx(I8,{children:"LLM-guided scenario authoring with MCP tool introspection and per-tool-call approval."})]})})}),$?a.jsxs("div",{className:"min-h-0 flex flex-1 flex-col gap-3",children:[a.jsx("div",{className:"grid gap-3 sm:grid-cols-1",children:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"MCP Context"}),a.jsxs("div",{className:"h-8 rounded-md border px-2 text-xs flex items-center gap-2",children:[a.jsx(Ba,{className:"h-3.5 w-3.5"}),x?`Loaded ${x.toolsLoaded} tools`:"Preparing..."]})]})}),a.jsx(ck,{className:"min-h-0 flex-1 rounded-md border p-3",children:a.jsxs("div",{className:"space-y-3",children:[x?.warnings?.map((ve,Se)=>a.jsx("div",{className:"rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:ve},`${ve}-${Se}`)),x?.messages.map(ve=>a.jsxs(h.Fragment,{children:[(()=>{const Se=ve.pendingToolCallIds??(ve.pendingToolCallId?[ve.pendingToolCallId]:[]),at=Se.map(_e=>(x?.pendingToolCalls??[]).find(Ee=>Ee.id===_e)).filter(_e=>!!_e),tt=Se.map(_e=>x.pendingToolCalls.find(Ee=>Ee.id===_e)??x.pendingToolCalls.find(Ee=>Ee.id===_e)).filter(Boolean);if(!(ve.role==="assistant"&&Se.length>0))return a.jsx("div",{className:"space-y-2",children:a.jsx(mye,{message:ve})});const kt=at.length,Ye=tt.length-kt;return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("div",{className:"w-full max-w-[92%] space-y-2",children:[tt.length>1&&kt>0&&a.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-amber-200 bg-amber-50/50 px-3 py-1.5",children:[a.jsxs("span",{className:"text-xs text-amber-900",children:[Ye," of ",tt.length," tool calls resolved"]}),a.jsxs(Z,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:kt===0,onClick:()=>{ue()},children:["Approve All (",kt,")"]})]}),tt.map((_e,Ee)=>a.jsx(qN,{call:_e,loading:S,description:Ee===0?ve.text:void 0,onApprove:Ze=>{re(Ze)},onDeny:Ze=>{oe(Ze)}},_e.id))]})]})})(),ve.suggestions&&a.jsxs("div",{className:"ml-0 space-y-3 rounded-md border border-dashed bg-muted/10 p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[a.jsx(oa,{className:"h-3.5 w-3.5"}),"Structured Suggestions"]}),ve.suggestions.prompt&&a.jsx(fye,{title:"Prompt",rationale:ve.suggestions.prompt.rationale,preview:ve.suggestions.prompt.replacement,applied:A.has(`${ve.id}:prompt`),onApply:()=>ae(ve.id,ve.suggestions,"prompt")}),ve.suggestions.evalRules&&a.jsx(pye,{rationale:ve.suggestions.evalRules.rationale,rules:ve.suggestions.evalRules.replacement,applied:A.has(`${ve.id}:evalRules`),onApply:Se=>ae(ve.id,ve.suggestions,"evalRules",Se,"append"),onReplace:Se=>ae(ve.id,ve.suggestions,"evalRules",Se,"replace")}),ve.suggestions.extractRules&&a.jsx(hye,{rationale:ve.suggestions.extractRules.rationale,rules:ve.suggestions.extractRules.replacement,applied:A.has(`${ve.id}:extractRules`),onApply:Se=>ye(ve.id,ve.suggestions,Se,"append"),onReplace:Se=>ye(ve.id,ve.suggestions,Se,"replace")}),(()=>{const Se=ve.suggestions?.notes,at=Array.isArray(Se)?Se:typeof Se=="string"?[Se]:[];return at.length===0?null:a.jsxs("div",{className:"space-y-2 rounded-md border p-3",children:[a.jsx("h5",{className:"text-sm font-medium",children:"Notes"}),a.jsx("ul",{className:"space-y-1 text-xs text-muted-foreground list-disc pl-4",children:at.map((tt,it)=>a.jsx("li",{children:tt},`${ve.id}-note-${it}`))})]})})()]})]},ve.id)),(x?.pendingToolCalls??[]).filter(ve=>!(x?.messages??[]).some(Se=>Se.pendingToolCallId===ve.id||Se.pendingToolCallIds?.includes(ve.id))).map(ve=>a.jsx(qN,{call:ve,loading:S,onApprove:Se=>{re(Se)},onDeny:Se=>{oe(Se)}},ve.id)),!x&&S&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(_r,{className:"h-4 w-4 animate-spin"}),"Starting assistant session..."]}),x&&S&&a.jsx(E8,{}),a.jsx("div",{ref:P})]})}),a.jsx(P8,{input:y,onInputChange:b,onSend:()=>{F(y)},onCancel:p&&C?M:void 0,inputPlaceholder:"Get assistance with creating or refining this scenario ...",snippets:lye,snippetsLabel:"Scenario Assistant Snippets",onSnippetSelect:G,loading:S,disabled:!p,inputRef:O,snippetContentClassName:"w-[320px]"})]}):a.jsx("div",{className:"rounded-md border p-3 text-sm text-muted-foreground",children:"Scenario Assistant requires a configured assistant agent and at least one selected server on the scenario."})]})})]})}function fye({title:e,rationale:t,preview:n,applied:r=!1,onApply:s}){return a.jsxs("div",{className:`space-y-2 rounded-md border p-3 ${r?"border-emerald-300 bg-emerald-50/40":""}`,children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h5",{className:"text-sm font-medium",children:e})}),t&&a.jsx("p",{className:"text-xs text-muted-foreground",children:t}),a.jsx("pre",{className:"max-h-56 overflow-auto rounded bg-muted p-2 text-xs whitespace-pre-wrap",children:n}),a.jsx("div",{className:"flex justify-end",children:a.jsx(Z,{type:"button",size:"sm",className:"h-8",variant:r?"secondary":"default",onClick:s,disabled:r,children:r?a.jsxs(a.Fragment,{children:[a.jsx(Wa,{className:"mr-1.5 h-3.5 w-3.5"}),"Applied"]}):"Apply"})})]})}function pye({rationale:e,rules:t,applied:n=!1,onApply:r,onReplace:s}){const[o,i]=h.useState(()=>new Set(t.map((p,v)=>v))),c=o.size,d=t.filter((p,v)=>o.has(v)),f=c===t.length,m=(p,v)=>{i(x=>{const j=new Set(x);return v?j.add(p):j.delete(p),j})};return a.jsxs("div",{className:`space-y-2 rounded-md border p-3 ${n?"border-emerald-300 bg-emerald-50/40":""}`,children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h5",{className:"text-sm font-medium",children:"Checks"})}),e&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e}),a.jsxs("div",{className:"space-y-2 rounded bg-muted/60 p-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[a.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[c," of ",t.length," selected"]}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-[11px]",disabled:n||t.length===0,onClick:()=>i(f?new Set:new Set(t.map((p,v)=>v))),children:f?"Unselect all":"Select all"})]}),t.map((p,v)=>{const x=uye(p),j=`scenario-assistant-check-${v}-${p.type}`;return a.jsxs("div",{className:"flex items-start gap-2 rounded bg-background p-2",children:[a.jsx(wr,{id:j,checked:o.has(v),disabled:n,onCheckedChange:y=>m(v,y===!0),"aria-label":`Select ${x}`}),a.jsxs("label",{htmlFor:j,className:"min-w-0 flex-1 cursor-pointer space-y-1",children:[a.jsx("span",{className:"block text-xs font-medium",children:x}),a.jsx("code",{className:"block break-words rounded bg-muted px-1.5 py-1 text-[11px] text-muted-foreground",children:JSON.stringify(p)})]})]},`${p.type}-${v}`)})]}),a.jsx("div",{className:"flex justify-end gap-2",children:n?a.jsxs(Z,{type:"button",size:"sm",variant:"secondary",disabled:!0,children:[a.jsx(Wa,{className:"mr-1.5 h-3.5 w-3.5"}),"Applied"]}):a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",size:"sm",className:"h-8",variant:"outline",onClick:()=>s(d),disabled:c===0,children:"Replace all"}),a.jsx(Z,{type:"button",size:"sm",className:"h-8",onClick:()=>r(d),disabled:c===0,children:"Add selected"})]})})]})}function hye({rationale:e,rules:t,applied:n=!1,onApply:r,onReplace:s}){const[o,i]=h.useState(()=>new Set(t.map((p,v)=>v))),c=o.size,d=t.filter((p,v)=>o.has(v)),f=c===t.length,m=(p,v)=>{i(x=>{const j=new Set(x);return v?j.add(p):j.delete(p),j})};return a.jsxs("div",{className:`space-y-2 rounded-md border p-3 ${n?"border-emerald-300 bg-emerald-50/40":""}`,children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h5",{className:"text-sm font-medium",children:"Value Capture Rules"})}),e&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e}),a.jsxs("div",{className:"space-y-2 rounded bg-muted/60 p-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[a.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[c," of ",t.length," selected"]}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-[11px]",disabled:n||t.length===0,onClick:()=>i(f?new Set:new Set(t.map((p,v)=>v))),children:f?"Unselect all":"Select all"})]}),t.map((p,v)=>{const x=`${p.name} · ${p.pattern}`,j=`scenario-assistant-extract-${v}-${p.name}`;return a.jsxs("div",{className:"flex items-start gap-2 rounded bg-background p-2",children:[a.jsx(wr,{id:j,checked:o.has(v),disabled:n,onCheckedChange:y=>m(v,y===!0),"aria-label":`Select ${x}`}),a.jsxs("label",{htmlFor:j,className:"min-w-0 flex-1 cursor-pointer space-y-1",children:[a.jsx("span",{className:"block text-xs font-medium",children:x}),a.jsx("code",{className:"block break-words rounded bg-muted px-1.5 py-1 text-[11px] text-muted-foreground",children:JSON.stringify(p)})]})]},`${p.name}-${v}`)})]}),a.jsx("div",{className:"flex justify-end gap-2",children:n?a.jsxs(Z,{type:"button",size:"sm",variant:"secondary",disabled:!0,children:[a.jsx(Wa,{className:"mr-1.5 h-3.5 w-3.5"}),"Applied"]}):a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",size:"sm",className:"h-8",variant:"outline",onClick:()=>s(d),disabled:c===0,children:"Replace all"}),a.jsx(Z,{type:"button",size:"sm",className:"h-8",onClick:()=>r(d),disabled:c===0,children:"Add selected"})]})})]})}function mye({message:e}){const t=async s=>{try{await navigator.clipboard.writeText(s),Me({title:"Copied"})}catch(o){Me({title:"Could not copy",description:o instanceof Error?o.message:String(o),variant:"destructive"})}},n=e.role==="user"||e.role==="assistant",r=e.role==="user";return a.jsx(A8,{message:e,assistantLabel:e.role==="assistant"?"Assistant":void 0,renderActions:n?a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:`absolute bottom-1 h-6 w-6 text-muted-foreground ${r?"-left-8":"-right-8"}`,onClick:()=>{t(e.text)},"aria-label":"Copy message",title:"Copy message",children:a.jsx(Hr,{className:"h-3.5 w-3.5"})}):void 0})}function na(e){return typeof e=="number"?e.toLocaleString():"n/a"}function WN(e,t){const n=t?.nonPositiveLabel??"0s";if(!Number.isFinite(e)||e<=0)return n;const r=Math.floor(e),s=Math.floor(r/3600),o=Math.floor(r%3600/60),i=r%60;return s>0?`${s}h ${o}m ${i}s`:o>0?`${o}m ${i}s`:`${i}s`}function gye({run:e,fallbackUserPrompt:t}){const[n,r]=h.useState(!0),[s,o]=h.useState(!1);return a.jsxs("div",{className:"space-y-2",children:[a.jsx(ws,{open:n,onOpenChange:r,children:a.jsxs("div",{className:"rounded-md border border-muted-foreground/20 bg-card p-2",children:[a.jsx(za,{asChild:!0,children:a.jsx("button",{type:"button",className:"mb-2 flex w-full items-center justify-between gap-2 text-left",children:a.jsxs("p",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(en,{className:`h-3.5 w-3.5 transition-transform ${n?"rotate-180":""}`}),a.jsx(Wr,{className:"h-3.5 w-3.5"}),"Final answer"]})})}),a.jsx(js,{children:a.jsx(HN,{text:e.finalAnswer||"No final answer captured.",maxLength:1200,className:"text-xs text-foreground"})})]})}),a.jsx(ws,{open:s,onOpenChange:o,children:a.jsxs("div",{className:"rounded-md border border-muted-foreground/20 bg-card p-2",children:[a.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[a.jsx(za,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2 text-left",children:[a.jsx(en,{className:`h-3.5 w-3.5 transition-transform ${s?"rotate-180":""}`}),a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Conversation trace"})]})}),a.jsxs(et,{variant:"outline",className:"h-5 text-[10px]",children:[e.toolCalls.length," tool calls"]})]}),a.jsx(js,{children:a.jsx("div",{className:"space-y-2 rounded-md border bg-muted/20 p-2",children:e.conversation.length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No conversation trace captured."}):e.conversation.map(i=>a.jsx(vye,{item:i,fallbackUserPrompt:t},i.id))})})]})})]})}function vye({item:e,fallbackUserPrompt:t}){if(e.kind==="tool_call"){const d=nD(e,"input");return a.jsx(aD,{variant:"call",title:`Tool call · ${e.toolName||"unknown"}${d}`,text:e.text})}if(e.kind==="tool_result"){const d=nD(e,"output"),f=e.ok?a.jsx(Wa,{className:"h-3.5 w-3.5 text-emerald-700 dark:text-emerald-300"}):a.jsx(cl,{className:"h-3.5 w-3.5 text-rose-700 dark:text-rose-300"});return a.jsx(aD,{variant:e.ok?"result_ok":"result_error",title:`Tool result · ${e.toolName||"unknown"} · ${e.ok?"ok":"error"}${typeof e.durationMs=="number"?` · ${e.durationMs}ms`:""}${d}`,text:e.text,icon:f})}const n=e.kind==="user_prompt",r=rD(e.text,e.kind),s=t?rD(t,"user_prompt"):"",o=n&&!r&&s?s:r,i=n?"User prompt":e.kind==="assistant_final"?"Agent final":"Agent",c=n?Xc:Wr;return a.jsxs("div",{className:`flex items-start gap-2 text-xs ${n?"justify-end":"justify-start"}`,children:[!n&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",children:a.jsx(c,{className:"h-3 w-3"})}),a.jsxs("div",{className:`max-w-[90%] rounded-md p-2 ${n?"bg-primary/10":"bg-muted/50"}`,children:[a.jsx("p",{className:`mb-1 text-[11px] font-semibold text-muted-foreground ${n?"text-right":""}`,children:i}),n?a.jsx(HN,{text:o,maxLength:280,className:"text-xs"}):a.jsx(HN,{text:o,maxLength:500,className:"text-xs"})]}),n&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(c,{className:"h-3 w-3"})})]})}function nD(e,t){const n=t==="input"?e.estimatedTokens?.inputTokens:e.estimatedTokens?.outputTokens;return typeof n!="number"?"":` · estimated ${na(n)} tokens`}function rD(e,t){const r=String(e??"").replace(/^\s+/,"");return t==="user_prompt"?r.replace(/^user:\s*/i,""):t==="assistant_final"||t==="assistant_thought"?r.replace(/^assistant:\s*/i,""):r}function aD({variant:e,title:t,text:n,icon:r}){const[s,o]=h.useState(!1),i={call:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300",result_ok:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",result_error:"border-rose-500/30 bg-rose-500/10 text-rose-700 dark:text-rose-300"};return a.jsx(ws,{open:s,onOpenChange:o,children:a.jsxs("div",{className:`rounded-md border p-2 text-xs ${i[e]}`,children:[a.jsx(za,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-2 text-left",children:[a.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[11px]",children:[r??a.jsx(Ba,{className:"h-3.5 w-3.5"}),a.jsx("span",{children:t})]}),a.jsx("span",{className:"text-[11px] font-semibold",children:s?"Hide content":"Show content"})]})}),a.jsx(js,{children:a.jsx("p",{className:"mt-2 font-mono whitespace-pre-wrap text-foreground",children:n})})]})})}function HN({text:e,maxLength:t,className:n}){const[r,s]=h.useState(!1),o=e.length>t,i=r||!o?e:`${e.slice(0,t)}...`;return a.jsxs("div",{children:[a.jsx(Va,{text:i,className:n}),o&&a.jsx("button",{type:"button",className:"mt-1 text-[11px] font-medium text-primary hover:underline",onClick:()=>s(c=>!c),children:r?"Show less":"Show all"})]})}const J8=["image/jpeg","image/png","image/gif","image/webp"],Z8=["application/pdf","text/plain","text/markdown","text/csv"];function xye(e){return J8.includes(e)||Z8.includes(e)}function sD({value:e,onValueChange:t,className:n,hideToolSequence:r=!1}){return a.jsxs(In,{value:e,onValueChange:s=>t(s),children:[a.jsx(An,{className:n,children:a.jsx($n,{})}),a.jsxs(En,{children:[a.jsx(ut,{value:"required_tool",children:"Required Tool"}),a.jsx(ut,{value:"forbidden_tool",children:"Forbidden Tool"}),!r&&a.jsx(ut,{value:"tool_sequence",children:"Tool Sequence"}),a.jsx(ut,{value:"agent_check",children:"Judge Agent"}),a.jsx(ut,{value:"response_contains",children:"Text contains"}),a.jsx(ut,{value:"response_not_contains",children:"Text does not contain"}),a.jsx(ut,{value:"response_starts_with",children:"Text starts with"}),a.jsx(ut,{value:"response_ends_with",children:"Text ends with"}),a.jsx(ut,{value:"response_equals",children:"Text equals"}),a.jsx(ut,{value:"response_regex",children:"Text matches regex"}),a.jsx(ut,{value:"tool_input_contains",children:"Tool input contains"}),a.jsx(ut,{value:"tool_input_regex",children:"Tool input regex"}),a.jsx(ut,{value:"tool_input_jsonpath",children:"Tool input JSONPath"}),a.jsx(ut,{value:"response_jsonpath",children:"JSONPath (optional equals)"}),a.jsx(ut,{value:"response_jsonpath_exists",children:"JSONPath exists"}),a.jsx(ut,{value:"response_jsonpath_not_exists",children:"JSONPath not exists"})]})]})}const yye=()=>({id:`scn-${Date.now()}`,name:"",serverIds:[],prompt:"",evalRules:[],extractRules:[]});function eq(e){return Lxe(e).replace(/^Tool sequence · /,"")}function pm(e){return e.startsWith("tool_input_")}function oD(e){const t=e.trim();if(t)return t==="true"?!0:t==="false"?!1:Number.isNaN(Number(t))?t:Number(t)}function VN({scenarios:e,scenarioOrigins:t,scenarioOverrides:n,agents:r,servers:s,configId:o,configPath:i,defaultAssistantAgentName:c,assistantInitialPromptByScenarioId:d,assistantAutoOpenNonceByScenarioId:f,testCaseReturnToPath:m,onChange:p,readOnly:v,allowAdd:x=!v,allowStructureEdits:j=!v}){const y=(C,k)=>{const A=e.map((E,P)=>P===C?{...E,...k}:E);p(A)},b=C=>p(e.filter((k,A)=>A!==C)),S=()=>p([...e,yye()]),N=(C,k)=>{const A=C+k;if(A<0||A>=e.length)return;const E=[...e],[P]=E.splice(C,1);E.splice(A,0,P),p(E)};return a.jsxs("div",{className:v?"space-y-2":"space-y-4",children:[!v&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Scenarios"}),x&&j&&a.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:S,children:[a.jsx(Ao,{className:"mr-1.5 h-3.5 w-3.5"}),"Add Scenario"]})]}),e.map((C,k)=>a.jsx(bye,{scenario:C,scenarioOrigin:t?.[k],hasMcpServerOverride:n?.[k],index:k,total:e.length,agents:r,servers:s,configId:o,configPath:i,defaultAssistantAgentName:c,assistantInitialPrompt:d?.[C.id],assistantAutoOpenNonce:f?.[C.id],testCaseReturnToPath:m,onUpdate:A=>y(k,A),onMoveUp:()=>N(k,-1),onMoveDown:()=>N(k,1),onRemove:()=>b(k),readOnly:v,allowStructureEdits:j},C.id)),e.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No scenarios configured. Add one to get started."})]})}function bye({scenario:e,scenarioOrigin:t,hasMcpServerOverride:n,index:r,total:s,agents:o,servers:i,configId:c,configPath:d,defaultAssistantAgentName:f,assistantInitialPrompt:m,assistantAutoOpenNonce:p,testCaseReturnToPath:v,onUpdate:x,onMoveUp:j,onMoveDown:y,onRemove:b,readOnly:S,allowStructureEdits:N}){const{source:C}=Dn(),[k,A]=h.useState("required_tool"),[E,P]=h.useState(""),[O,D]=h.useState(""),[K,q]=h.useState(""),[B,Y]=h.useState(""),[z,I]=h.useState(""),[T,V]=h.useState(""),[H,M]=h.useState(""),[X,$]=h.useState([]),[F,G]=h.useState(!1),[re,oe]=h.useState(null),[ue,ae]=h.useState(null),[ye,se]=h.useState(!1),[de,De]=h.useState(null),[ge,ve]=h.useState(""),[Se,at]=h.useState(null),[tt,it]=h.useState(!1),[kt,Ye]=h.useState(null),[_e,Ee]=h.useState(""),[Ze,pt]=h.useState(""),[Lt,Ut]=h.useState(!1),[Nt,an]=h.useState(f||o[0]?.id||""),[on,zt]=h.useState(!1),[sn,nn]=h.useState(null),[Re,Be]=h.useState(""),qe=h.useRef(null);function Bt(ie){if(!ie)return;const nt=Array.from(ie),Qt=new Array(nt.length).fill(null);let Et=0,Ft=0;const rn=()=>{const sr=Qt.filter(Sn=>Sn!==null);sr.length>0?(x({attachments:[...e.attachments??[],...sr]}),Ft>0&&Me({title:`${Ft} file${Ft>1?"s":""} skipped`,description:"Unsupported file type. Images must be JPEG/PNG/GIF/WebP; documents must be PDF, TXT, MD, or CSV.",variant:"destructive"})):nt.length>0&&Me({title:"Could not attach files",description:Ft>0?"Unsupported file type. Images must be JPEG/PNG/GIF/WebP; documents must be PDF, TXT, MD, or CSV.":"Files could not be read.",variant:"destructive"})};nt.forEach((sr,Sn)=>{const ne=new FileReader;ne.onload=()=>{const Te=ne.result,gt=Te.indexOf(","),bt=gt>=0?Te.slice(gt+1):"";if(bt){const vn=Te.slice(0,gt).replace("data:","").replace(";base64",""),fn=vn.startsWith("image/");xye(vn)?Qt[Sn]={type:fn?"image":"document",media_type:vn,data:bt,name:sr.name}:Ft++}++Et===nt.length&&rn()},ne.onerror=()=>{++Et===nt.length&&rn()},ne.readAsDataURL(sr)})}function Wt(ie){x({attachments:(e.attachments??[]).filter((nt,Qt)=>Qt!==ie)})}const[yt,fe]=h.useState(null),[Ie,Ge]=h.useState(!S),U=ie=>{const nt=ie.target;nt&&(nt.closest("button, a, input, select, textarea, [role='button']")||Ge(Qt=>!Qt))},le=ie=>ie?e.evalRules.findIndex(nt=>nt===ie):-1,pe=()=>{if(pm(k)){const Et=O.trim();if(!Et)return;let Ft;if(k==="tool_input_jsonpath"){const Sn=K.trim();if(!Sn)return;const ne=oD(B);Ft={type:k,tool:Et,path:Sn,...ne!==void 0?{equals:ne}:{}}}else{const Sn=E.trim();if(!Sn)return;Ft={type:k,tool:Et,value:Sn}}const rn=[...e.evalRules],sr=le(de);sr>=0?rn[sr]=Ft:rn.push(Ft),x({evalRules:rn}),D(""),q(""),P(""),Y(""),De(null),A("required_tool");return}if(k==="response_jsonpath"||k==="response_jsonpath_exists"||k==="response_jsonpath_not_exists"){const Et=K.trim();if(!Et)return;if(k==="response_jsonpath"){const Ft=oD(B);x({evalRules:[...e.evalRules,{type:k,path:Et,...Ft!==void 0?{equals:Ft}:{}}]})}else x({evalRules:[...e.evalRules,{type:k,path:Et}]});q(""),Y("");return}if(k==="agent_check"){const Et=z.trim(),Ft=T.trim();if(!Et||!Ft)return;const rn=[...e.evalRules],sr={type:"agent_check",label:Et,prompt:Ft},Sn=le(ue);Sn>=0?rn[Sn]=sr:rn.push(sr),x({evalRules:rn}),I(""),V(""),ae(null),se(!1),A("required_tool");return}if(k==="tool_sequence"){const Et=X.map(Ft=>Ft.trim()).filter(Ft=>typeof Ft=="string"&&Ft.length>0);if(Et.length===0)return;Ve(Et);return}if(!E.trim())return;const ie=[...e.evalRules],nt={type:k,value:E.trim()},Qt=le(de);Qt>=0?ie[Qt]=nt:ie.push(nt),x({evalRules:ie}),P(""),ve(""),De(null),A("required_tool")},J=()=>{const ie=H.trim();ie&&($(nt=>[...nt,ie]),M(""))},xe=(ie,nt)=>{const Qt=ie+nt;$(Et=>{if(Qt<0||Qt>=Et.length)return Et;const Ft=[...Et],[rn]=Ft.splice(ie,1);return Ft.splice(Qt,0,rn),Ft})},be=ie=>{$(nt=>nt.filter((Qt,Et)=>Et!==ie))},we=e.evalRules.findIndex(ie=>ie.type==="tool_sequence"),W=we>=0?e.evalRules[we]:void 0,he=W?.type==="tool_sequence"?W.sequence??[]:[],ke=we>=0,Ve=ie=>{const nt=[...e.evalRules],Qt=ie.length>0?{type:"tool_sequence",sequence:ie}:null,Et=le(re),Ft=Et>=0?Et:we;Ft>=0?Qt?nt[Ft]=Qt:nt.splice(Ft,1):Qt&&nt.push(Qt),x({evalRules:nt}),G(!1),$([]),M(""),oe(null),k==="tool_sequence"&&A("required_tool")};h.useEffect(()=>{F&&$(he)},[F,we,he.join("|")]),h.useEffect(()=>{G(k==="tool_sequence")},[k]),h.useEffect(()=>{se(k==="agent_check")},[k]),h.useEffect(()=>{re&&le(re)<0&&oe(null),ue&&le(ue)<0&&ae(null),de&&le(de)<0&&De(null)},[e.evalRules,re,ue,de]),h.useEffect(()=>{re&&k!=="tool_sequence"&&oe(null),ue&&k!=="agent_check"&&ae(null),de&&de.type!==k&&De(null)},[k,re,ue,de]);const ee=ie=>{const nt=e.evalRules.filter((Et,Ft)=>Ft!==ie),Qt=nt.some(Et=>Et.type==="agent_check");x({evalRules:nt,agentContext:Qt?e.agentContext:void 0})},Le=["response_contains","response_not_contains","response_starts_with","response_ends_with","response_equals","response_regex","tool_input_contains","tool_input_regex","tool_input_jsonpath"],ot=()=>{!_e.trim()||!Ze.trim()||(x({extractRules:[...e.extractRules,{name:_e.trim(),pattern:Ze.trim()}]}),Ee(""),pt(""))},Ht=ie=>{x({extractRules:e.extractRules.filter((nt,Qt)=>Qt!==ie)})},Pe=ie=>{const nt=e.serverIds.includes(ie)?e.serverIds.filter(Qt=>Qt!==ie):[...e.serverIds,ie];x({serverIds:nt})},Zt={required_tool:"Required",forbidden_tool:"Forbidden",tool_sequence:"Sequence",tool_input_contains:"Input Contains",tool_input_regex:"Input Regex",tool_input_jsonpath:"Input JSONPath",response_contains:"Contains",response_not_contains:"Not Contains",response_starts_with:"Starts With",response_ends_with:"Ends With",response_equals:"Equals",response_regex:"Regex",response_jsonpath:"JSONPath",response_jsonpath_exists:"JSONPath Exists",response_jsonpath_not_exists:"JSONPath Not Exists",agent_check:"Agent"},Ct={required_tool:"border-sky-300/60 bg-sky-500/10 text-sky-700",forbidden_tool:"border-rose-300/60 bg-rose-500/10 text-rose-700",tool_sequence:"border-teal-300/60 bg-teal-500/10 text-teal-700",tool_input_contains:"border-blue-300/60 bg-blue-500/10 text-blue-700",tool_input_regex:"border-blue-300/60 bg-blue-500/10 text-blue-700",tool_input_jsonpath:"border-blue-300/60 bg-blue-500/10 text-blue-700",response_contains:"border-violet-300/60 bg-violet-500/10 text-violet-700",response_not_contains:"border-amber-300/60 bg-amber-500/10 text-amber-700",response_starts_with:"border-cyan-300/60 bg-cyan-500/10 text-cyan-700",response_ends_with:"border-indigo-300/60 bg-indigo-500/10 text-indigo-700",response_equals:"border-lime-300/60 bg-lime-500/10 text-lime-700",response_regex:"border-fuchsia-300/60 bg-fuchsia-500/10 text-fuchsia-700",response_jsonpath:"border-emerald-300/60 bg-emerald-500/10 text-emerald-700",response_jsonpath_exists:"border-green-300/60 bg-green-500/10 text-green-700",response_jsonpath_not_exists:"border-orange-300/60 bg-orange-500/10 text-orange-700",agent_check:"border-teal-300/60 bg-teal-500/10 text-teal-700"},Xt=k==="required_tool"||k==="forbidden_tool",Xn=pm(k),qn=k==="response_jsonpath"||k==="response_jsonpath_exists"||k==="response_jsonpath_not_exists",to=k==="tool_sequence"&&F,Li=k==="agent_check"&&ye,no=e.serverIds.filter(ie=>i.some(nt=>nt.id===ie)),Fi=o.map(ie=>ie.id).filter(Boolean),Ln=no.length>0,[zi,ls]=h.useState(""),[Ar,Ho]=h.useState(0);h.useEffect(()=>{const ie=(m??"").trim();ie&&zi!==ie&&(Ut(!0),ls(ie))},[m,zi]),h.useEffect(()=>{p&&p!==Ar&&(Ut(!0),Ho(p))},[p,Ar]),h.useEffect(()=>{at(null),Ye(null),ve("")},[e.serverIds.join("|")]),h.useEffect(()=>{ve(""),q(""),Y(""),M("")},[k]),h.useEffect(()=>{Nt&&Fi.includes(Nt)||an(f||o[0]?.id||"")},[Nt,f,o,Fi]);const jn=async()=>{if(Nt){zt(!0),nn(null);try{const ie=e.serverIds.filter(Qt=>i.find(Ft=>Ft.id===Qt)?.authType==="oauth2");await _o({serverNames:ie,source:C});const nt=await C.runScenarioPreview({selectedAgentName:Nt,scenario:{id:e.id,name:e.name,prompt:e.prompt,serverNames:e.serverIds,attachments:e.attachments??[],evalRules:e.evalRules,extractRules:e.extractRules}});fe(nt)}catch(ie){nn(ie instanceof Error?ie.message:String(ie))}finally{zt(!1)}}},Vu=()=>{if(!yt)return;const ie=iD(e.evalRules,yt.run.failureReasons,yt.run.checkResults),nt=ie.length?ie.map(rn=>`${rn.status.toUpperCase()} - ${wye(rn.rule)}${rn.failureReason?` (${rn.failureReason})`:""}`).join(`
130
+ `):"No checks configured.",Qt=Object.keys(yt.run.extractedValues).length>0?Object.entries(yt.run.extractedValues).map(([rn,sr])=>`${rn}: ${String(sr)}`).join(`
131
+ `):"No extracted values.",Et=yt.run.toolCalls.length>0?yt.run.toolCalls.map((rn,sr)=>`${sr+1}. ${rn.name} (${rn.duration}ms)`).join(`
132
+ `):"No tool calls.",Ft=[`I ran a prompt preview for scenario '${e.id}' and want you to suggest concrete updates.`,`Run ID: ${yt.runId}`,`Agent: ${yt.agentName}`,`Outcome: ${yt.run.passed?"passed":"failed"}`,`Duration: ${yt.run.duration}ms`,"","Current check outcomes:",nt,"","Tool sequence:",Et,"","Extracted values:",Qt,"","Final answer:",yt.run.finalAnswer||"(empty)","","If the run has a meaningful ordered tool path, suggest a tool_sequence check using the raw tool names in the tool sequence order, even if other tools appear between them.","Use agent_check only for semantic or fuzzy validation;","Please propose concrete updates to the Prompt, Checks, and/or Value Capture Rules based on this preview."].join(`
133
+ `);Be(Ft),Ut(!0)},Bi=async()=>{if(!(!Ln||S)){it(!0),Ye(null);try{const ie=no.filter(Qt=>i.find(Ft=>Ft.id===Qt)?.authType==="oauth2");await _o({serverNames:ie,source:C});const nt=new Set;for(const Qt of no){const Et=await C.discoverToolsForAnalysis({serverNames:[Qt]});for(const Ft of Et.servers)for(const rn of Ft.tools)nt.add(rn.name)}at(Array.from(nt).sort((Qt,Et)=>Qt.localeCompare(Et)))}catch(ie){Ye(ie instanceof Error?ie.message:"Failed to load tools")}finally{it(!1)}}};return a.jsx(ws,{open:Ie,onOpenChange:Ge,children:a.jsxs(Qe,{className:S?"rounded-md border shadow-none":"border-dashed",children:[a.jsxs($t,{className:`${S?"px-3 py-3":"pb-3"} flex-row items-center justify-between space-y-0 cursor-pointer`,onClick:U,children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[!S&&a.jsx(za,{asChild:!0,children:a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",children:a.jsx(en,{className:`h-3.5 w-3.5 transition-transform ${Ie?"rotate-0":"-rotate-90"}`})})}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[r+1,"."]}),a.jsx(Dt,{className:"truncate text-sm font-medium",children:e.name||`Scenario ${r+1}`}),S&&t==="referenced"&&a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-6 px-2 text-xs",asChild:!0,children:a.jsx(At,{to:`/libraries/test-cases/${encodeURIComponent(e.id)}${v?`?returnTo=${encodeURIComponent(v)}`:""}`,children:"Edit test"})})]}),S?a.jsxs("div",{className:"flex items-center gap-2",children:[t&&a.jsx(et,{variant:t==="inline"?"secondary":"outline",children:t==="referenced"?"Referenced":"Inline"}),n&&a.jsx(et,{variant:"secondary",children:"Override"}),a.jsx(za,{asChild:!0,children:a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-8 w-8","aria-label":Ie?"Collapse scenario details":"Expand scenario details",children:a.jsx(en,{className:`h-4 w-4 transition-transform ${Ie?"rotate-180":""}`})})})]}):N&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>Ut(!0),title:o.length===0?"Add at least one agent in the config":e.serverIds.length===0?"Select at least one server for this scenario":"Open Scenario Assistant",children:[a.jsx(oa,{className:"h-3.5 w-3.5 text-amber-500"}),"Ask Assistant"]}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:j,disabled:r===0,"aria-label":"Move scenario up",children:a.jsx(Ns,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:y,disabled:r===s-1,"aria-label":"Move scenario down",children:a.jsx(en,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:b,children:a.jsx(Ga,{className:"h-3.5 w-3.5 text-destructive"})})]})]}),a.jsx(js,{children:a.jsxs(Je,{className:"space-y-3",children:[a.jsx(dye,{open:Lt,onOpenChange:ie=>{Ut(ie),ie||Be("")},configId:c,configPath:d,scenario:e,agents:o,servers:i,defaultAssistantAgentName:f,initialUserMessage:Re||m,onApplyPatch:ie=>x({...ie.prompt!==void 0?{prompt:ie.prompt}:{},...ie.evalRules!==void 0?{evalRules:ie.evalRules}:{},...ie.extractRules!==void 0?{extractRules:ie.extractRules}:{}})}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Name"}),a.jsx(_t,{value:e.name,onChange:ie=>x({name:ie.target.value}),disabled:S,placeholder:"e.g. List directory"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Servers"}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.map(ie=>a.jsx(et,{variant:e.serverIds.includes(ie.id)?"default":"outline",className:`cursor-pointer text-xs ${e.serverIds.includes(ie.id)?"":"opacity-50"}`,onClick:()=>!S&&Pe(ie.id),children:ie.name||ie.id},ie.id)),i.length===0&&a.jsx("span",{className:"text-xs text-muted-foreground",children:"Add servers above first"})]})]}),a.jsxs(Qe,{className:"border bg-card",children:[a.jsxs($t,{className:"pb-2",children:[a.jsx(Dt,{className:"text-sm",children:"Prompt"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"The instruction sent to the agent for this scenario. Be explicit about the task, expected output, and constraints."})]}),a.jsxs(Je,{className:"space-y-3 pt-0",children:[a.jsx(Es,{value:e.prompt,onChange:ie=>x({prompt:ie.target.value}),disabled:S,placeholder:"The prompt to send to the agent...",rows:4,className:"text-xs"}),a.jsxs("div",{children:[a.jsx("input",{ref:qe,type:"file",accept:[...J8,...Z8,".md"].join(","),multiple:!0,className:"hidden",onChange:ie=>Bt(ie.target.files)}),(e.attachments?.length??0)>0?a.jsxs("div",{className:"flex flex-wrap items-start gap-2",children:[e.attachments?.map((ie,nt)=>a.jsxs("div",{className:"group relative",title:`${ie.name??`attachment ${nt+1}`}`,children:[a.jsx("div",{className:"flex h-16 w-16 items-center justify-center overflow-hidden rounded border bg-muted",children:ie.type==="image"?a.jsx("img",{src:`data:${ie.media_type};base64,${ie.data}`,alt:ie.name??`attachment ${nt+1}`,className:"h-full w-full object-cover"}):a.jsx(HS,{className:"h-6 w-6 text-muted-foreground"})}),ie.name&&a.jsx("p",{className:"mt-0.5 max-w-[64px] truncate text-center text-xs text-muted-foreground",children:ie.name}),!S&&a.jsx("button",{type:"button",onClick:()=>Wt(nt),className:"absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full bg-destructive text-destructive-foreground group-hover:flex","aria-label":"Remove attachment",children:a.jsx(ua,{className:"h-2.5 w-2.5"})})]},nt)),!S&&a.jsx("button",{type:"button",onClick:()=>qe.current?.click(),className:"flex h-16 w-16 items-center justify-center self-start rounded border border-dashed text-muted-foreground hover:border-foreground hover:text-foreground","aria-label":"Attach file",title:"Attach file (image or document)",children:a.jsx(tP,{className:"h-4 w-4"})})]}):!S&&a.jsxs("button",{type:"button",onClick:()=>qe.current?.click(),className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",children:[a.jsx(tP,{className:"h-3.5 w-3.5"}),"Attach file"]})]})]})]}),!S&&a.jsxs(Qe,{className:"border bg-muted/20",children:[a.jsxs($t,{className:"pb-2",children:[a.jsx(Dt,{className:"text-sm",children:"Run Prompt Preview"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Execute the current draft prompt once and inspect final answer, conversation trace, tool calls, and check outcomes."})]}),a.jsxs(Je,{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(He,{className:"text-xs",children:"Agent"}),a.jsxs(In,{value:Nt,onValueChange:an,children:[a.jsx(An,{className:"h-8 text-xs",children:a.jsx($n,{placeholder:"Select agent"})}),a.jsx(En,{children:o.map(ie=>a.jsx(ut,{value:ie.id,children:ie.name||ie.id},ie.id))})]})]}),a.jsx("div",{className:"flex items-end",children:a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1.5 px-2 text-xs",onClick:()=>{jn()},disabled:on||!Nt||!e.prompt.trim()||e.serverIds.length===0,children:on?a.jsxs(a.Fragment,{children:[a.jsx(_r,{className:"h-3.5 w-3.5 animate-spin"}),"Running..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Cs,{className:"h-3.5 w-3.5"}),"Run Prompt"]})})})]}),!e.prompt.trim()&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Add a prompt to run preview."}),e.serverIds.length===0&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Select at least one server to run preview."}),sn&&a.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:sn}),yt&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[a.jsx(et,{variant:yt.run.passed?"default":"destructive",children:yt.run.passed?"Passed":"Failed"}),a.jsxs(et,{variant:"outline",children:[yt.run.duration,"ms"]}),a.jsxs(et,{variant:"outline",children:[yt.run.toolCalls.length," tool calls"]}),a.jsx(et,{variant:"outline",className:"font-mono",children:yt.agentName}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"ml-auto h-6 gap-1.5 px-2 text-[11px]",onClick:Vu,children:[a.jsx(oa,{className:"h-3.5 w-3.5 text-amber-500"}),"Send to Assistant"]})]}),e.evalRules.length===0?a.jsxs("div",{className:"rounded-md border bg-muted/20 p-2",children:[a.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Check results"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"No checks configured for this scenario."})]}):(()=>{const ie=iD(e.evalRules,yt.run.failureReasons,yt.run.checkResults),nt=ie.filter(Et=>Et.status==="passed"),Qt=ie.filter(Et=>Et.status==="failed");return a.jsxs("div",{className:"rounded-md border bg-muted/20 p-2",children:[a.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Checks"}),a.jsxs(et,{variant:"outline",className:"h-5 border-success/30 bg-success/10 text-success text-[10px]",children:[nt.length," passed"]}),a.jsxs(et,{variant:"outline",className:`h-5 text-[10px] ${Qt.length>0?"border-destructive/30 bg-destructive/10 text-destructive":""}`,children:[Qt.length," failed"]})]}),a.jsx("div",{className:"space-y-1",children:ie.map((Et,Ft)=>a.jsxs("div",{className:`flex items-start justify-between gap-2 rounded-md border px-2 py-1.5 text-xs ${Et.status==="failed"?"border-destructive/20 bg-destructive/5":"border-success/20 bg-success/5"}`,children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[Et.status==="failed"?a.jsx(cl,{className:"h-3.5 w-3.5 shrink-0 text-destructive"}):a.jsx(Wa,{className:"h-3.5 w-3.5 shrink-0 text-success"}),a.jsx("span",{className:"font-medium",children:jye(Et.rule)})]}),Et.failureReason&&a.jsx("p",{className:"mt-1 pl-5 text-[11px] text-muted-foreground",children:Sye(Et.failureReason)})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${Et.status==="failed"?"border-destructive/30 text-destructive":"border-success/30 text-success"}`,children:Et.status})]},`${e.id}-preview-check-${Ft}`))})]})})(),yt.run.failureReasons.length>0&&a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2",children:[a.jsx("p",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wide text-destructive",children:"Check failures"}),a.jsx("ul",{className:"list-disc space-y-1 pl-4 text-xs text-destructive",children:yt.run.failureReasons.map((ie,nt)=>a.jsx("li",{children:ie},`${yt.runId}-failure-${nt}`))})]}),Object.keys(yt.run.extractedValues).length>0&&a.jsxs("div",{className:"rounded-md border bg-background p-2",children:[a.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Extracted values"}),a.jsx("div",{className:"grid gap-1.5 sm:grid-cols-2",children:Object.entries(yt.run.extractedValues).map(([ie,nt])=>a.jsxs("div",{className:"rounded border bg-muted/20 px-2 py-1 text-xs",children:[a.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:ie}),a.jsx("div",{className:"break-all",children:String(nt)})]},ie))})]}),a.jsx(gye,{run:yt.run,fallbackUserPrompt:e.prompt})]})]})]}),a.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[a.jsxs(Qe,{className:"border bg-muted/20",children:[a.jsx($t,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(Dt,{className:"text-sm",children:"Checks"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Checks determine pass/fail for the scenario. Add tool checks or text pattern checks for the final answer."})]}),!S&&a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs shrink-0",onClick:()=>Ut(!0),title:"Ask for help improving checks",children:[a.jsx(oa,{className:"h-3.5 w-3.5 text-amber-500"}),"Ask Assistant"]})})]})}),a.jsx(Je,{className:"space-y-2",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(He,{className:"text-xs",children:"Checks (pass / fail)"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"These determine whether the scenario passes. Add tool checks (required/forbidden) or text pattern checks for the final answer."}),a.jsx("div",{className:"space-y-1.5",children:e.evalRules.length===0?a.jsx("p",{className:"rounded-md border border-dashed bg-background/60 px-2 py-2 text-xs text-muted-foreground",children:"No checks yet. Add tool checks or text pattern checks below."}):e.evalRules.map((ie,nt)=>a.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-md border bg-background px-2 py-2 text-xs",children:[a.jsx("div",{className:"min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`rounded-full border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide ${Ct[ie.type]}`,children:Zt[ie.type]}),ie.type==="agent_check"?a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-medium leading-tight",children:ie.label||"Unnamed check"}),ie.prompt&&a.jsx("div",{className:"mt-0.5 break-words text-[11px] leading-snug text-muted-foreground",children:ie.prompt})]}):ie.type==="tool_sequence"?a.jsx("span",{className:"font-mono break-all",children:eq(ie.sequence??[])}):pm(ie.type)?a.jsx("span",{className:"font-mono break-all",children:ie.type==="tool_input_contains"?`${ie.tool} contains ${String(ie.value)}`:ie.type==="tool_input_regex"?`${ie.tool} matches ${String(ie.value)}`:`${ie.tool} · ${ie.path} · ${ie.equals!==void 0?`== ${String(ie.equals)}`:"exists"}`}):a.jsx("span",{className:"font-mono break-all",children:ie.path?ie.equals!==void 0?`${ie.path} == ${String(ie.equals)}`:ie.path:ie.value})]})}),!S&&a.jsxs("div",{className:"flex items-center gap-1",children:[(ie.type==="tool_sequence"||ie.type==="agent_check"||Le.includes(ie.type))&&a.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-[11px]",onClick:()=>{if(ie.type==="tool_sequence"){A("tool_sequence"),$(ie.sequence??[]),oe(ie),G(!0);return}if(ie.type==="agent_check"){A("agent_check"),ae(ie),I(ie.label??""),V(ie.prompt??""),se(!0);return}A(ie.type),De(ie),P(String(ie.value??"")),D(ie.tool??""),q(ie.path??""),Y(ie.equals!==void 0?String(ie.equals):"")},"aria-label":`Edit check ${nt+1}`,children:a.jsx(RW,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>ee(nt),"aria-label":`Remove check ${nt+1}`,children:a.jsx(ua,{className:"h-3.5 w-3.5"})})]})]},nt))}),!S&&a.jsxs("div",{className:"space-y-2",children:[Li?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsx(sD,{value:k,onValueChange:A,className:"h-8 w-[14.5rem] shrink-0 text-xs"}),a.jsx(_t,{value:z,onChange:ie=>I(ie.target.value),placeholder:"Prompt name",className:"h-8 text-xs"}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:pe,children:ue!==null?"Update check":"Add check"})]}),a.jsx(Es,{value:T,onChange:ie=>V(ie.target.value),placeholder:"Judge prompt. Example: Confirm the answer includes a valid earliest and latest timestamp range, and that neither is 'Not available'.",className:"min-h-[64px] text-xs"})]}):a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx(sD,{value:k,onValueChange:A,className:"h-8 w-[14.5rem] shrink-0 text-xs",hideToolSequence:ke&&k!=="tool_sequence"}),qn?a.jsxs(a.Fragment,{children:[a.jsx(_t,{value:K,onChange:ie=>q(ie.target.value),placeholder:"JSONPath (e.g. $.status)",className:"h-8 text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),pe())}),k==="response_jsonpath"&&a.jsx(_t,{value:B,onChange:ie=>Y(ie.target.value),placeholder:"Equals (optional)",className:"h-8 w-[12rem] text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),pe())})]}):Xn?a.jsxs(a.Fragment,{children:[Se&&Se.length>0?a.jsxs(In,{value:O,onValueChange:D,children:[a.jsx(An,{className:"h-8 text-xs font-mono",children:a.jsx($n,{placeholder:"Select tool"})}),a.jsx(En,{children:Se.map(ie=>a.jsx(ut,{value:ie,children:ie},ie))})]}):a.jsx(_t,{value:O,onChange:ie=>D(ie.target.value),placeholder:"Tool name",className:"h-8 text-xs font-mono"}),k==="tool_input_jsonpath"&&a.jsx(_t,{value:K,onChange:ie=>q(ie.target.value),placeholder:"JSONPath (e.g. $.query)",className:"h-8 text-xs font-mono"}),k==="tool_input_jsonpath"?a.jsx(_t,{value:B,onChange:ie=>Y(ie.target.value),placeholder:"Equals (optional)",className:"h-8 w-[10rem] text-xs font-mono"}):a.jsx(_t,{value:E,onChange:ie=>P(ie.target.value),placeholder:k==="tool_input_regex"?"Regex pattern":"Text present in input",className:"h-8 w-[10rem] text-xs font-mono"})]}):to?a.jsxs("div",{className:"min-w-0 flex-1 flex items-end gap-2",children:[a.jsx(_t,{value:H,onChange:ie=>M(ie.target.value),placeholder:"Tool name",className:"h-8 text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),J())}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:J,children:"Add step"})]}):a.jsx(_t,{value:E,onChange:ie=>P(ie.target.value),placeholder:"Value",className:"h-8 text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),pe())}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:pe,children:de!==null?"Update check":"Add"})]}),to&&a.jsxs("div",{className:"space-y-2 rounded-md border bg-background px-2 py-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(He,{className:"text-xs",children:"Sequence steps"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Require these tools in order. Other tools may appear between them."})]}),!S&&X.length>0&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-[11px]",onClick:()=>$([]),children:"Clear"}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-[11px]",onClick:()=>Ve(X),children:ke?"Update sequence":"Add sequence"})]})]}),X.length===0?a.jsx("p",{className:"rounded-md border border-dashed bg-muted/20 px-2 py-2 text-xs text-muted-foreground",children:"No ordered tool sequence yet."}):a.jsx("div",{className:"space-y-1.5",children:X.map((ie,nt)=>a.jsxs("div",{className:"flex items-center gap-2 rounded-md border bg-muted/10 px-2 py-1.5",children:[a.jsxs("span",{className:"text-xs font-medium",children:[nt+1,"."]}),a.jsx("span",{className:"min-w-0 flex-1 font-mono text-xs break-all",children:ie}),!S&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>xe(nt,-1),disabled:nt===0,"aria-label":`Move tool ${nt+1} up`,children:a.jsx(Ns,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>xe(nt,1),disabled:nt===X.length-1,"aria-label":`Move tool ${nt+1} down`,children:a.jsx(en,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>be(nt),"aria-label":`Remove tool ${nt+1}`,children:a.jsx(ua,{className:"h-3.5 w-3.5"})})]})]},`${e.id}-tool-sequence-draft-${nt}`))})]}),Xt&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx(He,{className:"mb-1 block text-[11px] text-muted-foreground",children:"Pick from selected server tools (optional)"}),a.jsxs(In,{value:ge,onValueChange:ie=>{ve(ie),P(ie)},disabled:tt||!Se||Se.length===0,children:[a.jsx(An,{className:"h-8 text-xs",children:a.jsx($n,{placeholder:tt?"Loading tools...":Se&&Se.length>0?"Select tool to insert in value field":"Load tools first"})}),a.jsx(En,{children:(Se??[]).map(ie=>a.jsx(ut,{value:ie,children:ie},ie))})]})]}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:Bi,disabled:!Ln||tt,children:tt?"Loading...":Se?"Refresh tools":"Load tools"})]}),!Ln&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Select at least one server in this scenario to load tool names."}),kt&&a.jsxs("p",{className:"text-[11px] text-destructive",children:["Could not load tools: ",kt]})]})]})]})})]}),a.jsxs(Qe,{className:"border bg-muted/10",children:[a.jsx($t,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(Dt,{className:"text-sm",children:"Value Capture Rules"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Formerly “Extract Rules”. These do not fail the run. They capture structured values from the final answer for reporting and comparisons."})]}),!S&&a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs shrink-0",onClick:()=>Ut(!0),title:"Ask for help improving value capture rules",children:[a.jsx(oa,{className:"h-3.5 w-3.5 text-amber-500"}),"Ask Assistant"]})]})}),a.jsx(Je,{className:"space-y-2",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(He,{className:"text-xs",children:"Value Capture Rules"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Use regex patterns to capture values like max concentration, product names, date ranges, or IDs from the final answer text."}),a.jsx("div",{className:"space-y-1.5",children:e.extractRules.length===0?a.jsx("p",{className:"w-full rounded-md border border-dashed bg-background/60 px-2 py-2 text-xs text-muted-foreground",children:"No value capture rules yet. Add one below to capture structured output from the final answer."}):e.extractRules.map((ie,nt)=>a.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border bg-background px-2 py-2 text-xs",children:[a.jsx("div",{className:"min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"rounded-full border border-violet-300/60 bg-violet-500/10 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-violet-700",children:ie.name}),a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground",children:"regex:"}),a.jsx("code",{className:"font-mono break-all text-foreground",children:ie.pattern})]})}),!S&&a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>Ht(nt),"aria-label":`Remove value capture rule ${nt+1}`,children:a.jsx(ua,{className:"h-3.5 w-3.5"})})]},nt))}),!S&&a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx(_t,{value:_e,onChange:ie=>Ee(ie.target.value),placeholder:"Field name",className:"h-8 text-xs w-36"}),a.jsx(_t,{value:Ze,onChange:ie=>pt(ie.target.value),placeholder:"Regex pattern",className:"h-8 text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),ot())}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:ot,children:"Add"})]})]})})]})]}),e.evalRules.some(ie=>ie.type==="agent_check")&&a.jsxs(Qe,{className:"border bg-muted/10",children:[a.jsx($t,{className:"pb-2",children:a.jsxs("div",{className:"min-w-0",children:[a.jsx(Dt,{className:"text-sm",children:"Judge context"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Extra context is shared across all judge checks in this scenario and sent once in the batched judge request."})]})}),a.jsxs(Je,{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(wr,{id:`judge-ctx-prompt-${e.id}`,checked:e.agentContext?.include_prompt??!1,disabled:S,className:"mt-0.5",onCheckedChange:ie=>{x({agentContext:{...e.agentContext,include_prompt:ie===!0}})}}),a.jsxs("div",{children:[a.jsx(He,{htmlFor:`judge-ctx-prompt-${e.id}`,className:"cursor-pointer text-xs font-medium",children:"Include prompt"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Sends the scenario prompt so the judge can verify the answer addresses the original question."})]})]}),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(wr,{id:`judge-ctx-tools-${e.id}`,checked:e.agentContext?.include_tool_sequence??!1,disabled:S,className:"mt-0.5",onCheckedChange:ie=>{x({agentContext:{...e.agentContext,include_tool_sequence:ie===!0}})}}),a.jsxs("div",{children:[a.jsx(He,{htmlFor:`judge-ctx-tools-${e.id}`,className:"cursor-pointer text-xs font-medium",children:"Include tool sequence"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Sends the list of called tool names so the judge can reason about which tools were used."})]})]}),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(wr,{id:`judge-ctx-inputs-${e.id}`,checked:e.agentContext?.include_tool_inputs??!1,disabled:S,className:"mt-0.5",onCheckedChange:ie=>{x({agentContext:{...e.agentContext,include_tool_inputs:ie===!0}})}}),a.jsxs("div",{children:[a.jsx(He,{htmlFor:`judge-ctx-inputs-${e.id}`,className:"cursor-pointer text-xs font-medium",children:"Include tool inputs"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Sends the called MCP tools and their arguments so the judge can verify how the tools were used."})]})]})]})]})]})})]})})}function iD(e,t,n){return X8({evalRules:e,failureReasons:t,checkResults:n})}function wye(e){return e.type==="agent_check"?`${e.type}: ${e.label??""} — ${e.prompt??""}`:e.type==="tool_sequence"?`${e.type}: ${eq(e.sequence??[])}`:pm(e.type)?`${e.type}: ${e.tool??""}: ${lD(e)}`:e.path?`${e.type}: ${lD(e)}`:`${e.type}: ${e.value??""}`}function lD(e){return e.path?e.equals!==void 0?`${e.path} == ${String(e.equals)}`:e.path:String(e.value??"")}const jye=lx;function Sye(e){const t=String(e??"").trim(),n=t.match(/^Regex assertion failed:\s*(.+)$/i);return n?`Text match failed: ${n[1]}`:t}function tq(e){const t=e.name?.trim()||e.id||"Server",n=e.authValue?.trim()||"",r=e.oauthTokenUrl?.trim()||"";return e.authType==="bearer"&&n.length===0?`${t}: bearer token is required.`:e.authType==="api-key"&&r.length===0&&n.length===0?`${t}: API key value is required.`:null}const Pg=0;function Xf(e){return e??Pg}const Nye=()=>({id:`cfg-${Date.now()}`,name:"",configName:"",description:"",servers:[],serverEntries:[],agents:[],agentEntries:[],scenarios:[],scenarioEntries:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),cD=()=>{const{id:e,tab:t}=ql(),n=Kr(),r=ss(),[s,o]=Fo(),{getConfig:i,addConfig:c,updateConfig:d,loading:f}=up(),{source:m}=Dn(),{servers:p,agents:v,scenarios:x}=Ts(),j=e==="new",y=!j&&!!e,b=y?i(e):void 0,[S,N]=h.useState(j||t==="edit"),[C,k]=h.useState(()=>b?structuredClone(b):Nye()),[A,E]=h.useState(""),[P,O]=h.useState(""),[D,K]=h.useState({}),[q,B]=h.useState({}),[Y,z]=h.useState({}),I=h.useMemo(()=>{const W=t||s.get("tab");return W==="agents"||W==="scenarios"?W:"scenarios"},[t,s]),T=`${n.pathname}${n.search}`;h.useEffect(()=>{b&&!S&&k(structuredClone(b))},[b,S]),h.useEffect(()=>{t==="edit"&&!j&&N(!0)},[t,j]);const V=W=>k(he=>({...he,...W})),H=h.useMemo(()=>C.serverEntries&&C.serverEntries.length>0?C.serverEntries:(C.servers??[]).map(W=>({kind:"inline",server:W})),[C.serverEntries,C.servers]),M=h.useMemo(()=>C.scenarioEntries&&C.scenarioEntries.length>0?C.scenarioEntries:C.scenarios.map(W=>({kind:"inline",scenario:W})),[C.scenarioEntries,C.scenarios]),X=W=>{V({scenarioEntries:W,scenarios:W.filter(he=>he.kind==="inline").map(he=>he.scenario)})},$=h.useMemo(()=>C.agentEntries&&C.agentEntries.length>0?C.agentEntries:C.agents.map(W=>({kind:"inline",agent:W})),[C.agentEntries,C.agents]),F=W=>{V({agentEntries:W,agents:W.filter(he=>he.kind==="inline").map(he=>he.agent)})},G=!S,re=C.runDefaults?.selectedAgentNames??[],oe=async()=>{if(!C.name.trim()){Me({title:"Validation Error",description:"Config ID is required.",variant:"destructive"});return}const W=H.map(Pe=>Pe.kind==="referenced"?{kind:"referenced",ref:p.find(Ct=>Ct.id===Pe.ref)?.id||Pe.ref}:Pe),he=$.map(Pe=>Pe.kind==="referenced"?{kind:"referenced",ref:v.find(Ct=>Ct.id===Pe.ref)?.id||Pe.ref}:Pe),ke=M.map(Pe=>{if(Pe.kind==="referenced"){const Zt=x.find(Xt=>Xt.id===Pe.ref),Ct=(Pe.mcpServers??[]).map(Xt=>Xt.kind==="referenced"?{kind:"referenced",ref:p.find(qn=>qn.id===Xt.ref)?.id||Xt.ref}:Xt);return{kind:"referenced",ref:Zt?.id||Pe.ref,...Pe.mcpServers!==void 0?{mcpServers:Ct}:{}}}return Pe}),Ve=W.filter(Pe=>Pe.kind==="inline").map(Pe=>({server:Pe.server,error:tq(Pe.server)})).find(Pe=>!!Pe.error);if(Ve?.error){Me({title:"Validation Error",description:Ve.error,variant:"destructive"});return}if(ke.filter(Pe=>Pe.kind==="inline").some(Pe=>!Pe.scenario.name?.trim())){Me({title:"Validation Error",description:"Inline scenarios must have a name before saving.",variant:"destructive"});return}const Le=new Set(he.map(Pe=>Pe.kind==="inline"?Pe.agent.id:Pe.ref)),ot=(C.runDefaults?.selectedAgentNames??[]).filter(Pe=>Le.has(Pe)),Ht={...C,serverEntries:W,servers:W.filter(Pe=>Pe.kind==="inline").map(Pe=>Pe.server),agentEntries:he,agents:he.filter(Pe=>Pe.kind==="inline").map(Pe=>Pe.agent),scenarioEntries:ke,scenarios:ke.filter(Pe=>Pe.kind==="inline").map(Pe=>Pe.scenario),runDefaults:ot.length>0?{...C.runDefaults??{},selectedAgentNames:ot}:void 0,updatedAt:new Date().toISOString()};if(j){const Pe=await c(Ht);k(Pe);const Zt=Hn(Pe.configName,Hn(Pe.name,Pe.id));Me({title:"MCP Evaluation Created",description:`"${Zt}" has been saved.`}),r(`/mcp-evaluations/${Pe.id}`)}else{const Pe=await d(C.id,Ht);k(Pe);const Zt=Hn(Pe.configName,Hn(Pe.name,Pe.id));Me({title:"MCP Evaluation Updated",description:`"${Zt}" has been updated.`}),N(!1),r(`/mcp-evaluations/${Pe.id}`,{replace:!0})}},ue=Hn(C.configName,Hn(C.name,C.id)),ae=j?"New MCP Evaluation":S?`Editing: ${ue}`:ue,ye=j?"/mcp-evaluations/new":`/mcp-evaluations/${encodeURIComponent(C.id||e||"")}`,se=!!b?.loadError,de=h.useMemo(()=>v.map(W=>({id:W.id,ref:W.id,label:Hn(W.name,W.id),model:W.model})).sort((W,he)=>W.label.localeCompare(he.label)),[v]),De=(W,he)=>{const ke=he?Array.from(new Set([...re,W])):re.filter(Ve=>Ve!==W);V({runDefaults:{...C.runDefaults??{},selectedAgentNames:ke}})},ge=W=>{const he=new Set([...$.filter(Le=>Le.kind==="inline").map(Le=>Hn(Le.agent.name,Le.agent.id)),...v.map(Le=>Hn(Le.name,Le.id))]),ke=`${W}-custom`;let Ve=ke,ee=2;for(;he.has(Ve);)Ve=`${ke}-${ee}`,ee+=1;return Ve},ve=()=>{const he={id:`agt-${Date.now()}`,name:"",provider:"openai",model:"gpt-4o",temperature:Pg,maxTokens:4096};F([{kind:"inline",agent:he},...$]),K(ke=>({...ke,[he.id]:!0}))},Se=()=>{const W=v.find(Ve=>Ve.id===P);if(!W)return;const he=W.id;new Set($.filter(Ve=>Ve.kind==="referenced").map(Ve=>Ve.ref)).has(he)||F([...$,{kind:"referenced",ref:he}]),O("")},at=()=>{const W=new Set($.filter(ke=>ke.kind==="referenced").map(ke=>ke.ref)),he=v.filter(ke=>!W.has(ke.id)).map(ke=>({kind:"referenced",ref:ke.id}));he.length>0&&F([...$,...he])},tt=()=>{const W=v.find(ee=>ee.id===P);if(!W)return;const he=Hn(W.name,W.id),ke=ge(he),Ve={...structuredClone(W),id:`agt-${Date.now()}`,name:ke};F([...$,{kind:"inline",agent:Ve}]),K(ee=>({...ee,[Ve.id]:!0})),O(""),Me({title:"Imported agent as inline",description:ke})},it=W=>{const he=$[W];if(!he)return;const ke=he.kind==="inline"?he.agent.id:he.ref,Ve=re.filter(ee=>ee!==ke);V({runDefaults:{...C.runDefaults??{},selectedAgentNames:Ve}}),he.kind==="inline"&&K(ee=>{const Le={...ee};return delete Le[he.agent.id],Le}),F($.filter((ee,Le)=>Le!==W))},kt=(W,he)=>{const ke=W+he;if(ke<0||ke>=$.length)return;const Ve=[...$],[ee]=Ve.splice(W,1);Ve.splice(ke,0,ee),F(Ve)},Ye=W=>{const he=$[W];if(!he||he.kind!=="referenced")return;const ke=an(he.ref);if(!ke){Me({title:"Referenced agent not found",variant:"destructive"});return}const Ve=Hn(ke.name,ke.id),ee=ge(Ve),Le={...structuredClone(ke),id:`agt-${Date.now()}`,name:ee},ot=[...$];if(ot[W]={kind:"inline",agent:Le},F(ot),re.includes(he.ref)){const Ht=re.map(Pe=>Pe===he.ref?Le.id:Pe);V({runDefaults:{...C.runDefaults??{},selectedAgentNames:Array.from(new Set(Ht))}})}K(Ht=>({...Ht,[Le.id]:!0})),Me({title:"Referenced agent converted to inline",description:ee})},_e=()=>{const W=x.find(ke=>ke.id===A);if(!W)return;const he={...structuredClone(W),id:`scn-${Date.now()}`,serverIds:[...W.serverIds]};X([...M,{kind:"inline",scenario:he}]),z(ke=>({...ke,[he.id]:!0})),E("")},Ee=()=>{const he={id:`scn-${Date.now()}`,name:"",serverIds:[],prompt:"",evalRules:[],extractRules:[]};X([{kind:"inline",scenario:he},...M]),z(ke=>({...ke,[he.id]:!0}))},Ze=()=>{const W=x.find(Ve=>Ve.id===A);if(!W)return;const he=W.id;new Set(M.filter(Ve=>Ve.kind==="referenced").map(Ve=>Ve.ref)).has(he)||X([...M,{kind:"referenced",ref:he}]),E("")},pt=W=>{const he=M[W];he?.kind==="inline"&&z(ke=>{const Ve={...ke};return delete Ve[he.scenario.id],Ve}),X(M.filter((ke,Ve)=>Ve!==W))},Lt=(W,he)=>{const ke=W+he;if(ke<0||ke>=M.length)return;const Ve=[...M],[ee]=Ve.splice(W,1);Ve.splice(ke,0,ee),X(Ve)},Ut=W=>{const he=M[W];if(!he||he.kind!=="referenced")return;const ke=on(he.ref);if(!ke){Me({title:"Referenced scenario not found",variant:"destructive"});return}const Ve=new Set(M.filter(Ct=>Ct.kind==="inline").map(Ct=>Ct.scenario.name?.trim().toLowerCase()).filter(Boolean)),ee=`${Hn(ke.name,ke.id)}-custom`;let Le=ee,ot=2;for(;Ve.has(Le.toLowerCase());)Le=`${ee}-${ot}`,ot+=1;const Ht=Date.now(),Pe={...structuredClone(ke),id:`scn-${Ht}`,name:Le,serverIds:he.mcpServers&&he.mcpServers.length>0?he.mcpServers.map(Ct=>Ct.kind==="referenced"?Ct.ref:Ct.server.id):[...ke.serverIds]},Zt=[...M];Zt[W]={kind:"inline",scenario:Pe},X(Zt),z(Ct=>({...Ct,[Pe.id]:!0})),Me({title:"Referenced scenario converted to inline",description:Le})},Nt=W=>p.find(he=>he.id===W),an=W=>v.find(he=>he.id===W),on=W=>x.find(he=>he.id===W),zt=H.filter(W=>W.kind==="referenced").map(W=>W.ref),sn=zt.map(Nt).filter(W=>!!W),nn=$.filter(W=>W.kind==="referenced").map(W=>W.ref),Re=nn.map(an).filter(W=>!!W);$.filter(W=>W.kind==="inline");const Be=$.flatMap(W=>{if(W.kind==="referenced"){const he=an(W.ref);return he?[{agent:he,origin:"referenced",ref:W.ref}]:[]}return[{agent:W.agent,origin:"inline",ref:void 0}]}),qe=M.filter(W=>W.kind==="referenced").map(W=>W.ref),Bt=M.flatMap(W=>{if(W.kind==="referenced"){const he=on(W.ref);if(!he)return[];if(W.mcpServers===void 0)return[{scenario:he,origin:"referenced",hasMcpServerOverride:!1}];const ke=W.mcpServers.flatMap(Ve=>Ve.kind==="referenced"?[Ve.ref]:[Ve.server.id]);return[{scenario:{...he,serverIds:ke},origin:"referenced",hasMcpServerOverride:!0}]}return[{scenario:W.scenario,origin:"inline",hasMcpServerOverride:!1}]}),Wt=Array.from(new Map([...v,...C.agents,...Re].map(W=>[W.id,W])).values()),yt=Array.from(new Map([...p,...C.servers??[],...sn].map(W=>[W.id,W])).values()),fe=M.filter(W=>W.kind==="referenced").flatMap(W=>(W.mcpServers??[]).filter(he=>he.kind==="referenced").map(he=>he.ref)),Ie=Array.from(new Set([...zt,...fe].filter(W=>!Nt(W)))),Ge=nn.filter(W=>!an(W)),U=qe.filter(W=>!on(W));new Set(Ie);const le=new Set(U),pe=$.length,J=M.length,xe=[...p],be=(W,he)=>{const ke=M[W];if(!ke||ke.kind!=="referenced")return;const Ve=[...M];Ve[W]={kind:"referenced",ref:ke.ref,mcpServers:he.map(ee=>({kind:"referenced",ref:ee}))},X(Ve)},we=W=>{const he=M[W];if(!he||he.kind!=="referenced")return;const ke=[...M];ke[W]={kind:"referenced",ref:he.ref},X(ke)};return h.useEffect(()=>{if(!P)return;v.some(he=>he.id===P)||O("")},[v,P]),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Z,{variant:"ghost",size:"icon",asChild:!0,className:"h-8 w-8",children:a.jsx(At,{to:"/mcp-evaluations",children:a.jsx(Si,{className:"h-4 w-4"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h1",{className:"text-2xl font-bold truncate",children:ae}),a.jsx("p",{className:"text-sm text-muted-foreground",children:j?"Create a new MCP evaluation":f?"Loading configuration...":b?b.loadError?"MCP evaluation could not be fully loaded":a.jsxs(a.Fragment,{children:["Last updated ",a.jsx("span",{children:new Date(C.updatedAt).toLocaleDateString()})]}):"MCP evaluation not found"})]}),a.jsxs("div",{className:"flex gap-2 shrink-0",children:[y&&!S&&a.jsx(Z,{size:"sm",onClick:()=>{N(!0),r(`${ye}/edit`)},children:"Edit"}),y&&!S&&b&&!se&&a.jsx(Z,{size:"sm",variant:"outline",asChild:!0,children:a.jsxs(At,{to:`/run?configId=${encodeURIComponent(b.id)}`,children:[a.jsx(Cs,{className:"h-3.5 w-3.5"}),"Run Evaluation"]})}),y&&!S&&se&&a.jsxs(et,{variant:"destructive",className:"py-1 px-3 text-xs",children:[a.jsx(sm,{className:"mr-1 h-3 w-3"}),"Broken config"]}),S&&a.jsxs(a.Fragment,{children:[!j&&a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>{k(structuredClone(b)),N(!1),r(ye)},children:"Cancel"}),a.jsxs(Z,{size:"sm",onClick:()=>{oe()},children:[a.jsx(AW,{className:"mr-1.5 h-3.5 w-3.5"}),"Save"]})]})]})]}),se&&!S&&a.jsx(Qe,{className:"border-destructive/40",children:a.jsxs(Je,{className:"pt-6 space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(sm,{className:"mt-0.5 h-5 w-5 text-destructive"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-semibold",children:"This configuration is broken"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"The file is still present, but it could not be loaded because one or more references or fields are invalid."})]})]}),a.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[a.jsx("p",{className:"text-xs font-medium mb-1",children:"File"}),a.jsx("p",{className:"text-xs font-mono break-all",children:b?.sourcePath||b?.description})]}),a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-3",children:[a.jsx("p",{className:"text-xs font-medium mb-1 text-destructive",children:"Load Error"}),a.jsx("p",{className:"text-xs break-all text-destructive",children:b?.loadError})]}),(Ie.length>0||Ge.length>0||U.length>0)&&a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-background p-3 space-y-1.5",children:[a.jsx("p",{className:"text-xs font-medium",children:"Broken references"}),Ie.length>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Servers:"," ",a.jsx("span",{className:"text-destructive",children:Ie.join(", ")})]}),Ge.length>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Agents: ",a.jsx("span",{className:"text-destructive",children:Ge.join(", ")})]}),U.length>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Scenarios:"," ",a.jsx("span",{className:"text-destructive",children:U.join(", ")})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Valid items still render below. Only the missing references are marked as broken."})]})}),!se&&(C.loadWarnings?.length??0)>0&&a.jsx(Qe,{className:"border-amber-500/30",children:a.jsxs(Je,{className:"pt-4 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-amber-700 dark:text-amber-300",children:[a.jsx(sm,{className:"h-4 w-4"}),"Migration warnings"]}),C.loadWarnings?.map((W,he)=>a.jsx("p",{className:"text-xs text-muted-foreground",children:W},`${W}-${he}`))]})}),a.jsxs("div",{className:"flex gap-4",children:[a.jsx(et,{variant:I==="scenarios"?"default":"outline",className:"py-1 px-3 text-xs",children:a.jsxs(At,{to:`${ye}/scenarios`,className:"inline-flex items-center gap-1.5 whitespace-nowrap",children:[a.jsx(HS,{className:"h-3 w-3"}),J," scenario",J!==1?"s":""]})}),a.jsx(et,{variant:I==="agents"?"default":"outline",className:"py-1 px-3 text-xs",children:a.jsxs(At,{to:`${ye}/agents`,className:"inline-flex items-center gap-1.5 whitespace-nowrap",children:[a.jsx(Wr,{className:"h-3 w-3"}),pe," agent",pe!==1?"s":""]})})]}),a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6 space-y-3",children:a.jsxs("div",{className:`grid gap-4 ${G||!j?"sm:grid-cols-2":"sm:grid-cols-3"}`,children:[!G&&j&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Config ID"}),a.jsx(_t,{value:C.name,onChange:W=>V({name:W.target.value}),disabled:G,placeholder:"e.g. check-weather"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Name (optional)"}),a.jsx(_t,{value:C.configName||"",onChange:W=>V({configName:W.target.value}),disabled:G,placeholder:"e.g. Weather checks baseline"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Description"}),a.jsx(_t,{value:C.description||"",onChange:W=>V({description:W.target.value}),disabled:G,placeholder:"Brief description..."})]})]})})}),a.jsxs(rx,{value:I,onValueChange:W=>{if(W!=="servers"&&W!=="agents"&&W!=="scenarios")return;const he=new URLSearchParams(s);if(he.delete("tab"),o(he,{replace:!0}),e&&e!=="new"){r(`/mcp-evaluations/${encodeURIComponent(e)}/${W}`,{replace:!0});return}r(`/mcp-evaluations/${e??"new"}/${W}`,{replace:!0})},className:"space-y-4",children:[a.jsxs(Cp,{children:[a.jsxs(Vs,{value:"scenarios",className:"gap-1.5",children:[a.jsx(HS,{className:"h-3.5 w-3.5"}),"Scenarios"]}),a.jsxs(Vs,{value:"agents",className:"gap-1.5",children:[a.jsx(Wr,{className:"h-3.5 w-3.5"}),"Agents"]})]}),a.jsxs(Yf,{value:"agents",children:[!G&&a.jsx(Qe,{className:"mb-4",children:a.jsxs(Je,{className:"pt-4 space-y-3",children:[a.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",children:[a.jsxs(In,{value:P,onValueChange:O,children:[a.jsx(An,{className:"h-8",children:a.jsx($n,{placeholder:"Select agent from library"})}),a.jsx(En,{children:de.map(W=>a.jsx(ut,{value:W.id,children:W.label},W.id))})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:!P,onClick:Se,children:"Add Ref"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:!P,onClick:tt,children:"Import Inline"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:v.length===0||v.every(W=>$.some(he=>he.kind==="referenced"&&he.ref===W.id)),onClick:at,children:"Add All Refs"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",onClick:ve,children:"Add agent"})]})]}),a.jsxs("div",{className:"space-y-2",children:[$.map((W,he)=>{const ke=W.kind==="referenced"?an(W.ref):null,Ve=W.kind==="inline"?Hn(W.agent.name,W.agent.id):Hn(ke?.name,W.ref),ee=W.kind==="inline"?W.agent.model:ke?.model||"unknown",Le=W.kind==="inline"?W.agent.id:W.ref,ot=W.kind==="referenced"&&!ke,Ht=W.kind==="inline"?W.agent.id:W.ref,Pe=re.includes(Ht),Zt=W.kind==="inline"&&!!D[W.agent.id];return a.jsxs("div",{className:"rounded-md border text-sm",children:[a.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-6 w-6",onClick:()=>kt(he,-1),disabled:he===0,"aria-label":"Move agent up",children:a.jsx(Ns,{className:"h-3 w-3"})}),a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-6 w-6",onClick:()=>kt(he,1),disabled:he===$.length-1,"aria-label":"Move agent down",children:a.jsx(en,{className:"h-3 w-3"})})]}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[he+1,"."]}),a.jsx("span",{className:"truncate font-medium",children:Ve}),a.jsx(et,{variant:W.kind==="inline"?"secondary":"outline",children:W.kind==="inline"?"Inline":"Referenced"}),a.jsx(et,{variant:"outline",className:"font-mono text-[10px]",children:ee}),Pe&&a.jsx(et,{variant:"outline",className:"text-xs border-emerald-300 text-emerald-700 bg-emerald-50",children:"Default"}),ot&&a.jsx(et,{variant:"destructive",children:"Missing"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("label",{className:"mx-2 flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx("input",{type:"checkbox",checked:Pe,onChange:Ct=>De(Ht,Ct.target.checked)}),a.jsx("span",{children:"Default"})]}),W.kind==="inline"&&a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>K(Ct=>({...Ct,[W.agent.id]:!Ct[W.agent.id]})),children:Zt?"Collapse":"Expand"}),W.kind==="referenced"&&a.jsx(a.Fragment,{children:a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>Ye(he),disabled:ot,children:"Convert to inline"})}),a.jsx(Z,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>it(he),"aria-label":"Remove agent entry",children:a.jsx(Ga,{className:"h-3.5 w-3.5"})})]})]}),W.kind==="inline"&&Zt&&a.jsxs("div",{className:"border-t px-3 py-3 space-y-3",children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Name"}),a.jsx(_t,{value:W.agent.name,onChange:Ct=>{const Xt=[...$];Xt[he]={kind:"inline",agent:{...W.agent,name:Ct.target.value}},F(Xt)},placeholder:"e.g. GPT-5 Mini custom"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Provider"}),a.jsxs(In,{value:W.agent.provider,onValueChange:Ct=>{const Xt=[...$];Xt[he]={kind:"inline",agent:{...W.agent,provider:Ct}},F(Xt)},children:[a.jsx(An,{children:a.jsx($n,{})}),a.jsxs(En,{children:[a.jsx(ut,{value:"openai",children:"OpenAI"}),a.jsx(ut,{value:"anthropic",children:"Anthropic"}),a.jsx(ut,{value:"azure",children:"Azure OpenAI"}),a.jsx(ut,{value:"google",children:"Google"}),a.jsx(ut,{value:"custom",children:"Custom"})]})]})]})]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Model"}),a.jsx(_t,{value:W.agent.model,onChange:Ct=>{const Xt=[...$];Xt[he]={kind:"inline",agent:{...W.agent,model:Ct.target.value}},F(Xt)},className:"font-mono text-xs"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Max Tokens"}),a.jsx(_t,{type:"number",min:1,max:128e3,value:W.agent.maxTokens,onChange:Ct=>{const Xt=[...$];Xt[he]={kind:"inline",agent:{...W.agent,maxTokens:parseInt(Ct.target.value)||0}},F(Xt)},className:"font-mono text-xs"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Temperature"}),a.jsx(_t,{type:"number",min:0,max:2,step:.01,value:Xf(W.agent.temperature),onChange:Ct=>{const Xt=[...$];Xt[he]={kind:"inline",agent:{...W.agent,temperature:Number(Ct.target.value)||Pg}},F(Xt)},className:"font-mono text-xs"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"System Prompt"}),a.jsx(Es,{value:W.agent.systemPrompt||"",onChange:Ct=>{const Xt=[...$];Xt[he]={kind:"inline",agent:{...W.agent,systemPrompt:Ct.target.value}},F(Xt)},rows:3,className:"text-xs"})]})]})]},`agent-entry-${he}-${Le}`)}),$.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No agents configured yet. Add inline agents or references."})]}),Ge.length>0&&a.jsxs("p",{className:"text-xs text-destructive",children:["Missing agent refs: ",Ge.join(", ")]})]})}),G?a.jsx(Qe,{children:a.jsx(Je,{className:"pt-4",children:a.jsxs("div",{className:"space-y-2",children:[Be.map((W,he)=>{const ke=Hn(W.agent.name,W.agent.id),Ve=re.includes(W.origin==="inline"?W.agent.id:W.ref||W.agent.id),ee=W.ref??W.agent.id,Le=!!q[ee];return a.jsxs("div",{className:"rounded-md border p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:[he+1,"."]}),a.jsx("div",{className:"truncate font-medium text-sm",children:ke})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[Ve&&a.jsx(et,{variant:"outline",className:"text-xs border-emerald-300 text-emerald-700 bg-emerald-50",children:"Default"}),a.jsx(et,{variant:W.origin==="inline"?"secondary":"outline",children:W.origin==="inline"?"Inline":"Referenced"}),a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-8 w-8",onClick:()=>B(ot=>({...ot,[ee]:!ot[ee]})),"aria-label":Le?"Collapse agent details":"Expand agent details",children:a.jsx(en,{className:`h-4 w-4 transition-transform ${Le?"rotate-180":""}`})})]})]}),Le&&a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5 border-t pt-2",children:[a.jsx(g8,{provider:W.agent.provider}),a.jsx(et,{variant:"outline",className:"text-xs font-mono",children:W.agent.model}),a.jsxs(et,{variant:"outline",className:"text-xs font-mono",children:["max_tokens: ",W.agent.maxTokens]}),a.jsxs(et,{variant:"outline",className:"text-xs font-mono",children:["temperature: ",Xf(W.agent.temperature)]})]})]},`agent-view-${he}-${W.ref??W.agent.id}`)}),Be.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No agents configured."})]})})}):null]}),a.jsxs(Yf,{value:"scenarios",children:[!G&&a.jsx(Qe,{className:"mb-4",children:a.jsxs(Je,{className:"pt-4 space-y-3",children:[a.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",children:[a.jsxs(In,{value:A,onValueChange:E,children:[a.jsx(An,{className:"h-8",children:a.jsx($n,{placeholder:"Select scenario from library"})}),a.jsx(En,{children:[...x].sort((W,he)=>Hn(W.name,W.id).localeCompare(Hn(he.name,he.id))).map(W=>a.jsx(ut,{value:W.id,children:Hn(W.name,W.id)},W.id))})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:!A,onClick:Ze,children:"Add Ref"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:!A,onClick:_e,children:"Import Inline"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",onClick:Ee,children:"Add scenario"})]})]}),a.jsxs("div",{className:"space-y-2",children:[M.map((W,he)=>{const ke=W.kind==="referenced"?on(W.ref):null,Ve=W.kind==="inline"?Hn(W.scenario.name,W.scenario.id):Hn(ke?.name,W.ref),ee=W.kind==="inline"&&Hn(W.scenario.name).length===0,Le=W.kind==="referenced"&&le.has(W.ref),ot=W.kind==="referenced"&&Array.isArray(W.mcpServers),Ht=W.kind==="inline"&&!!Y[W.scenario.id];return a.jsxs("div",{className:"rounded-md border text-sm",children:[a.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-6 w-6",onClick:()=>Lt(he,-1),disabled:he===0,"aria-label":"Move scenario up",children:a.jsx(Ns,{className:"h-3 w-3"})}),a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-6 w-6",onClick:()=>Lt(he,1),disabled:he===M.length-1,"aria-label":"Move scenario down",children:a.jsx(en,{className:"h-3 w-3"})})]}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[he+1,"."]}),a.jsx("span",{className:"truncate font-medium",children:Ve}),a.jsx(et,{variant:W.kind==="inline"?"secondary":"outline",children:W.kind==="inline"?"Inline":"Referenced"}),ot&&a.jsx(et,{variant:"secondary",children:"Override"}),ee&&a.jsx(et,{variant:"destructive",children:"Name required"}),Le&&a.jsx(et,{variant:"destructive",children:"Missing"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[W.kind==="inline"&&a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-7 w-7",onClick:()=>z(Pe=>({...Pe,[W.scenario.id]:!Pe[W.scenario.id]})),"aria-label":Ht?"Collapse scenario details":"Expand scenario details",children:a.jsx(en,{className:`h-3.5 w-3.5 transition-transform ${Ht?"rotate-180":""}`})}),W.kind==="referenced"&&a.jsx(a.Fragment,{children:a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>Ut(he),disabled:Le,children:"Convert to inline"})}),a.jsx(Z,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>pt(he),"aria-label":"Remove scenario entry",children:a.jsx(Ga,{className:"h-3.5 w-3.5"})})]})]}),W.kind==="inline"&&Ht&&a.jsx("div",{className:"border-t px-3 py-3",children:a.jsx(VN,{scenarios:[W.scenario],scenarioOrigins:["inline"],agents:[...C.agents,...Re],servers:[...C.servers??[],...sn],configId:C.id,configPath:C.sourcePath,defaultAssistantAgentName:C.runDefaults?.selectedAgentNames?.[0],onChange:Pe=>{const Zt=Pe[0];if(!Zt)return;const Ct=[...M];Ct[he]={kind:"inline",scenario:Zt},X(Ct)},readOnly:!1,allowAdd:!1,allowStructureEdits:!1})}),W.kind==="referenced"&&!Le&&a.jsxs("div",{className:"border-t px-3 py-3 space-y-2",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Optional MCP server override for this referenced scenario."}),a.jsx("div",{className:"flex flex-wrap gap-2",children:xe.map(Pe=>{const Zt=(W.mcpServers??[]).some(Ct=>Ct.kind==="referenced"&&Ct.ref===Pe.id);return a.jsx(Z,{type:"button",size:"sm",variant:Zt?"default":"outline",className:`h-7 text-xs ${Zt?"":"opacity-70"}`,onClick:()=>{const Ct=(W.mcpServers??[]).filter(Xn=>Xn.kind==="referenced").map(Xn=>Xn.ref),Xt=Ct.includes(Pe.id)?Ct.filter(Xn=>Xn!==Pe.id):[...Ct,Pe.id];be(he,Xt)},children:Hn(Pe.name,Pe.id)},`${W.ref}-override-server-${Pe.id}`)})}),ot&&a.jsx(Z,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>we(he),children:"Reset override"})]})]},`scenario-entry-${he}-${W.kind==="inline"?W.scenario.id:W.ref}`)}),M.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No scenarios configured yet. Add inline scenarios or references."})]}),U.length>0&&a.jsxs("p",{className:"text-xs text-destructive",children:["Missing scenario refs: ",U.join(", ")]})]})}),G?a.jsx(Qe,{children:a.jsx(Je,{className:"pt-4",children:a.jsx(VN,{scenarios:Bt.map(W=>W.scenario),scenarioOrigins:Bt.map(W=>W.origin),scenarioOverrides:Bt.map(W=>W.hasMcpServerOverride),agents:Wt,servers:yt,configId:C.id,configPath:C.sourcePath,defaultAssistantAgentName:C.runDefaults?.selectedAgentNames?.[0],testCaseReturnToPath:T,onChange:()=>{},readOnly:!0})})}):null]})]})]})};var Cye=Symbol("radix.slottable");function _ye(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Cye,t}var nq="AlertDialog",[kye]=kr(nq,[Z3]),Wo=Z3(),rq=e=>{const{__scopeAlertDialog:t,...n}=e,r=Wo(t);return a.jsx(iv,{...r,...n,modal:!0})};rq.displayName=nq;var Aye="AlertDialogTrigger",Eye=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Wo(n);return a.jsx(hQ,{...s,...r,ref:t})});Eye.displayName=Aye;var Pye="AlertDialogPortal",aq=e=>{const{__scopeAlertDialog:t,...n}=e,r=Wo(t);return a.jsx(lv,{...r,...n})};aq.displayName=Pye;var Rye="AlertDialogOverlay",sq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Wo(n);return a.jsx(Ou,{...s,...r,ref:t})});sq.displayName=Rye;var Kc="AlertDialogContent",[Tye,Oye]=kye(Kc),Mye=_ye("AlertDialogContent"),oq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,o=Wo(n),i=h.useRef(null),c=Tt(t,i),d=h.useRef(null);return a.jsx(uQ,{contentName:Kc,titleName:iq,docsSlug:"alert-dialog",children:a.jsx(Tye,{scope:n,cancelRef:d,children:a.jsxs(Mu,{role:"alertdialog",...o,...s,ref:c,onOpenAutoFocus:We(s.onOpenAutoFocus,f=>{f.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[a.jsx(Mye,{children:r}),a.jsx($ye,{contentRef:i})]})})})});oq.displayName=Kc;var iq="AlertDialogTitle",lq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Wo(n);return a.jsx(ip,{...s,...r,ref:t})});lq.displayName=iq;var cq="AlertDialogDescription",uq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Wo(n);return a.jsx(lp,{...s,...r,ref:t})});uq.displayName=cq;var Iye="AlertDialogAction",dq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Wo(n);return a.jsx(cv,{...s,...r,ref:t})});dq.displayName=Iye;var fq="AlertDialogCancel",pq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=Oye(fq,n),o=Wo(n),i=Tt(t,s);return a.jsx(cv,{...o,...r,ref:i})});pq.displayName=fq;var $ye=({contentRef:e})=>{const t=`\`${Kc}\` requires a description for the component to be accessible for screen reader users.
134
+
135
+ You can add a description to the \`${Kc}\` by passing a \`${cq}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
136
+
137
+ Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Kc}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
138
+
139
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return h.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Dye=rq,Lye=aq,hq=sq,mq=oq,gq=dq,vq=pq,xq=lq,yq=uq;const Ps=Dye,Fye=Lye,bq=h.forwardRef(({className:e,...t},n)=>a.jsx(hq,{className:$e("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));bq.displayName=hq.displayName;const Qa=h.forwardRef(({className:e,...t},n)=>a.jsxs(Fye,{children:[a.jsx(bq,{}),a.jsx(mq,{ref:n,className:$e("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));Qa.displayName=mq.displayName;const Ja=({className:e,...t})=>a.jsx("div",{className:$e("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ja.displayName="AlertDialogHeader";const Za=({className:e,...t})=>a.jsx("div",{className:$e("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Za.displayName="AlertDialogFooter";const es=h.forwardRef(({className:e,...t},n)=>a.jsx(xq,{ref:n,className:$e("text-lg font-semibold",e),...t}));es.displayName=xq.displayName;const ts=h.forwardRef(({className:e,...t},n)=>a.jsx(yq,{ref:n,className:$e("text-sm text-muted-foreground",e),...t}));ts.displayName=yq.displayName;const ns=h.forwardRef(({className:e,...t},n)=>a.jsx(gq,{ref:n,className:$e(DC(),e),...t}));ns.displayName=gq.displayName;const rs=h.forwardRef(({className:e,...t},n)=>a.jsx(vq,{ref:n,className:$e(DC({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));rs.displayName=vq.displayName;const zye=()=>{const{servers:e,setServers:t,reload:n,loading:r}=Ts(),s=ss(),[o,i]=h.useState(null),[c,d]=h.useState(""),f=c.trim().toLowerCase(),m=y=>y.name?.trim()||y.id,p=async y=>{const b=`${m(y)}-copy`;let S=b,N=1;for(;e.some(k=>(k.name?.trim()||k.id)===S);)S=`${b}-${N}`,N+=1;const C={...structuredClone(y),id:`srv-${Date.now()}`,name:S};await t([...e,C]),Me({title:"Server duplicated",description:`Created ${S}.`})},v=async y=>{await t(e.filter(b=>b.id!==y.id)),Me({title:"Server deleted",description:`${m(y)} was removed.`}),i(null)},x=y=>y.transport==="stdio"?[y.command,...y.args||[]].filter(Boolean).join(" "):y.url||"",j=h.useMemo(()=>[...f.length===0?e:e.filter(b=>[m(b),b.id,b.transport,x(b),b.authType??""].join(" ").toLowerCase().includes(f))].sort((b,S)=>m(b).localeCompare(m(S),void 0,{sensitivity:"base"})),[e,f]);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(v5,{className:"h-6 w-6"}),"MCP Servers"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Reusable MCP server definitions shared across configurations."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(W_,{value:c,onValueChange:d,placeholder:"Search MCP servers..."}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{n()},disabled:r,children:[a.jsx(Ka,{className:"mr-2 h-4 w-4"}),"Refresh"]}),a.jsxs(Z,{type:"button",size:"sm",onClick:()=>s("/libraries/servers/new"),children:[a.jsx(Ao,{className:"mr-2 h-4 w-4"}),"Add Server"]})]})]}),e.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed py-16 text-center",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No servers configured. Add one to get started."}),a.jsxs(Z,{type:"button",size:"sm",className:"mt-4",onClick:()=>s("/libraries/servers/new"),children:[a.jsx(Ao,{className:"mr-2 h-4 w-4"}),"Add Server"]})]}):j.length===0?a.jsx("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed py-12 text-center",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"No servers match this filter."})}):a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Vt,{children:[a.jsx(ct,{children:"Name"}),a.jsx(ct,{children:"Transport"}),a.jsx(ct,{children:"Endpoint"}),a.jsx(ct,{children:"Auth"}),a.jsx(ct,{className:"text-right",children:"Actions"})]})}),a.jsx(ca,{children:j.map(y=>a.jsxs(Vt,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>s(`/libraries/servers/${encodeURIComponent(y.id)}`),children:[a.jsx(Ue,{className:"font-medium",children:m(y)}),a.jsx(Ue,{children:a.jsx(et,{variant:"secondary",className:"font-mono text-xs",children:y.transport})}),a.jsx(Ue,{children:a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:x(y)})}),a.jsx(Ue,{children:!y.authType||y.authType==="none"?a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}):a.jsx(et,{variant:"outline",className:"text-xs",children:y.authType})}),a.jsx(Ue,{className:"text-right",onClick:b=>b.stopPropagation(),children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>i(y),children:[a.jsx(Ga,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{p(y)},children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Duplicate"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>s(`/libraries/servers/${encodeURIComponent(y.id)}`),children:[a.jsx(Zf,{className:"mr-1.5 h-3.5 w-3.5"}),"Edit"]})]})})]},y.id))})]})})}),a.jsx(Ps,{open:!!o,onOpenChange:y=>!y&&i(null),children:a.jsxs(Qa,{children:[a.jsxs(Ja,{children:[a.jsx(es,{children:"Delete server?"}),a.jsxs(ts,{children:["This will permanently remove"," ",a.jsx("span",{className:"font-mono",children:o?m(o):""})," ","from the library. This action cannot be undone."]})]}),a.jsxs(Za,{children:[a.jsx(rs,{children:"Cancel"}),a.jsx(ns,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{o&&v(o)},children:"Delete Server"})]})]})})]})};function KN({className:e,disabled:t,...n}){const[r,s]=h.useState(!1);return a.jsxs("div",{className:"relative",children:[a.jsx(_t,{...n,disabled:t,type:r?"text":"password",className:[e,"pr-9"].filter(Boolean).join(" ")}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",disabled:t,"aria-label":r?"Hide value":"Show value","aria-pressed":r,title:r?"Hide value":"Show value",className:"absolute right-0 top-0 h-full w-9 rounded-l-none",onClick:()=>s(o=>!o),children:r?a.jsx(yW,{className:"h-4 w-4"}):a.jsx(x5,{className:"h-4 w-4"})})]})}const uD={stdio:"Check that the command is installed and the args are correct",sse:"Check that the server is running and the URL is reachable","streamable-http":"Check that the server is running and the URL is reachable"},dD=()=>({id:`srv-${Date.now()}`,name:"",transport:"stdio",authType:"none"}),Bye=()=>{const{serverId:e}=ql(),t=ss(),{servers:n,setServers:r}=Ts(),{source:s}=Dn(),o=e==="new",i=e?decodeURIComponent(e):"",c=o?null:n.find(I=>I.id===i||I.name===i),d=I=>I.name?.trim()||I.id,[f,m]=h.useState(()=>c??dD()),[p,v]=h.useState(!1),[x,j]=h.useState(!1),[y,b]=h.useState({status:"idle"}),[S,N]=h.useState(!1),[C,k]=h.useState(!1),[A,E]=h.useState([]),[P,O]=h.useState(!1),D=h.useRef(null);h.useEffect(()=>{const I=o?`new:${i||"new"}`:`srv:${i}`;if(D.current!==I){if(o){m(dD()),O(!1),D.current=I;return}c&&(m(c),O(!1),D.current=I)}},[o,i,c]);const K=I=>{O(!1),m(T=>({...T,authType:I,...I!=="bearer"&&I!=="api-key"?{authValue:void 0}:{},...I!=="api-key"?{apiKeyHeaderName:void 0}:{apiKeyHeaderName:T.apiKeyHeaderName||"X-API-Key"},...I!=="oauth2"?{oauthClientId:void 0,oauthClientSecret:void 0,oauthRedirectUrl:void 0,oauthScope:void 0,oauthMode:void 0,oauthAuthorizationUrl:void 0,oauthTokenEndpoint:void 0}:{oauthRedirectUrl:T.oauthRedirectUrl||void 0}}))},q=async()=>{if(N(!0),b({status:"loading"}),E([]),f.authType==="oauth2")try{k(!0),await _o({serverNames:[f.id],source:s,onServerStatus:I=>{const T=new Date().toLocaleTimeString(),V=typeof I.tokenExpiresInSeconds=="number"?` (valid ${WN(I.tokenExpiresInSeconds,{nonPositiveLabel:"expired"})}; until ${new Date(I.tokenExpiresAt||Date.now()).toLocaleTimeString()})`:"";if(I.status==="auth_required"){E(H=>[...H,`[${T}] OAuth debug: callback required for '${I.serverName}'`]);return}I.status==="ready"&&(I.debugState==="refreshed"?E(H=>[...H,`[${T}] OAuth debug: token refreshed (no callback)${V}`]):I.debugState==="reused"?E(H=>[...H,`[${T}] OAuth debug: session/token reused${V}`]):E(H=>[...H,`[${T}] OAuth debug: authorized${V}`]))}})}catch(I){b({status:"error",message:`OAuth login failed: ${I instanceof Error?I.message:String(I)}`,testedAt:new Date().toISOString()}),k(!1);return}finally{k(!1)}try{const T=(await s.discoverToolsForAnalysis({serverNames:[f.id]})).servers[0];T&&T.warnings.length===0?b({status:"success",toolNames:T.tools.map(V=>V.name),toolCount:T.tools.length,mcpServerVersion:T.mcpServerVersion,mcpServerImplementation:T.mcpServerImplementation,testedAt:new Date().toISOString()}):b({status:"error",message:T?.warnings[0]??"Connection failed",testedAt:new Date().toISOString()})}catch(I){b({status:"error",message:I instanceof Error?I.message:String(I),testedAt:new Date().toISOString()})}},B=async()=>{if(!f.name.trim()){Me({title:"Name is required",variant:"destructive"});return}const I=tq(f);if(I){Me({title:"Validation Error",description:I,variant:"destructive"});return}const T={...f,authValue:f.authValue?.trim(),apiKeyHeaderName:f.apiKeyHeaderName?.trim()||void 0};j(!0);try{if(o)await r([...n,T]),Me({title:"Server created"}),t(`/libraries/servers/${encodeURIComponent(T.id)}`);else{const V=n.map(H=>H.id===c?.id?T:H);await r(V),Me({title:"Server saved"}),T.id!==i&&t(`/libraries/servers/${encodeURIComponent(T.id)}`,{replace:!0})}}finally{j(!1)}},Y=async()=>{const I=n.filter(T=>T.id!==c?.id);await r(I),Me({title:"Server deleted"}),t("/libraries/servers")},z=()=>f.transport==="stdio"?[f.command,...f.args||[]].filter(Boolean).join(" "):f.url||"";return!o&&!c?a.jsxs("div",{className:"space-y-4",children:[a.jsxs(At,{to:"/libraries/servers",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[a.jsx(Si,{className:"h-4 w-4"})," Servers"]}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:['Server "',i,'" not found.']})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs(At,{to:"/libraries/servers",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[a.jsx(Si,{className:"h-4 w-4"})," Servers"]}),a.jsx("h1",{className:"text-2xl font-bold",children:o?"New Server":d(f)})]}),!o&&a.jsxs(Z,{type:"button",onClick:()=>{q()},disabled:y.status==="loading"||C,children:[a.jsx(S5,{className:"mr-2 h-4 w-4"}),"Test Connection"]})]}),S&&a.jsxs(Qe,{children:[a.jsxs($t,{className:"flex-row items-center justify-between space-y-0",children:[a.jsx(Dt,{className:"text-base",children:"Connection Test"}),a.jsx("button",{type:"button",onClick:()=>N(!1),className:"rounded-sm opacity-70 hover:opacity-100",children:a.jsx(ua,{className:"h-4 w-4"})})]}),a.jsxs(Je,{className:"space-y-3",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground",children:[a.jsx("span",{children:"Server:"}),a.jsx("span",{className:"font-medium text-foreground",children:d(f)}),a.jsx("span",{className:"mx-1",children:"·"}),a.jsx("span",{children:"Transport:"}),a.jsx("span",{className:"font-medium text-foreground",children:f.transport}),z()&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"mx-1",children:"·"}),a.jsx("span",{children:"Endpoint:"}),a.jsx("code",{className:"font-mono text-xs",children:z()})]})]}),y.status==="loading"&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(_r,{className:"h-4 w-4 animate-spin"}),C?"Waiting for OAuth login in browser…":"Connecting to MCP server…"]}),A.length>0&&a.jsx("div",{className:"space-y-0.5",children:A.map((I,T)=>a.jsx("p",{className:"text-xs text-muted-foreground",children:I},T))})]}),y.status==="success"&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("p",{className:"flex items-center gap-2 text-sm text-emerald-700",children:[a.jsx(Gc,{className:"h-4 w-4 shrink-0"}),"Connected — discovered ",y.toolCount," tool",y.toolCount!==1?"s":""]}),y.toolNames.length>0&&a.jsxs("div",{className:"rounded-md bg-muted p-3",children:[a.jsx("p",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"First 5 tools:"}),a.jsx("ul",{className:"space-y-0.5",children:y.toolNames.slice(0,5).map(I=>a.jsx("li",{className:"font-mono text-xs",children:I},I))})]}),(y.mcpServerImplementation||y.mcpServerVersion)&&a.jsx("div",{className:"rounded-md border bg-muted/40 p-3",children:a.jsxs("div",{className:"flex items-start gap-2",children:[y.mcpServerImplementation?.icons?.[0]?.src?a.jsx("img",{src:y.mcpServerImplementation.icons[0].src,alt:y.mcpServerImplementation.title||y.mcpServerImplementation.name,className:"h-7 w-7 rounded-sm border bg-background object-contain"}):null,a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"MCP server"}),a.jsx("p",{className:"truncate text-sm",children:y.mcpServerImplementation?y.mcpServerImplementation.title||y.mcpServerImplementation.name:"Unknown MCP server"}),y.mcpServerVersion?a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Version:"," ",a.jsx("code",{className:"font-mono",children:y.mcpServerVersion})]}):null,y.mcpServerImplementation?.description?a.jsx("p",{className:"text-xs text-muted-foreground",children:y.mcpServerImplementation.description}):null]})]})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Tested at ",new Date(y.testedAt).toLocaleString()]}),A.length>0&&a.jsx("div",{className:"space-y-0.5",children:A.map((I,T)=>a.jsx("p",{className:"text-xs text-muted-foreground",children:I},T))})]}),y.status==="error"&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-sm text-destructive",children:[a.jsx("span",{className:"font-medium",children:"✗ Connection failed"})," — ",y.message]}),uD[f.transport]&&a.jsxs("p",{className:"rounded-md bg-muted px-3 py-2 text-xs text-muted-foreground",children:["Hint: ",uD[f.transport]]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Tested at ",new Date(y.testedAt).toLocaleString()]})]})]})]}),a.jsxs(Qe,{children:[a.jsx($t,{children:a.jsx(Dt,{className:"text-base",children:"Configuration"})}),a.jsxs(Je,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{children:"Name"}),a.jsx(_t,{value:f.name,onChange:I=>m(T=>({...T,name:I.target.value})),placeholder:"e.g. Filesystem MCP"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{children:"Transport"}),a.jsxs(In,{value:f.transport,onValueChange:I=>m(T=>({...T,transport:I})),children:[a.jsx(An,{children:a.jsx($n,{})}),a.jsxs(En,{children:[a.jsx(ut,{value:"stdio",children:"stdio"}),a.jsx(ut,{value:"sse",children:"SSE"}),a.jsx(ut,{value:"streamable-http",children:"Streamable HTTP"})]})]})]})]}),f.transport==="stdio"?a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{children:"Command"}),a.jsx(_t,{value:f.command||"",onChange:I=>m(T=>({...T,command:I.target.value})),placeholder:"npx",className:"font-mono text-xs"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{children:"Args (comma-separated)"}),a.jsx(_t,{value:(f.args||[]).join(", "),onChange:I=>m(T=>({...T,args:I.target.value.split(",").map(V=>V.trim()).filter(Boolean)})),placeholder:"-y, @mcp/server",className:"font-mono text-xs"})]})]}):a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{children:"URL"}),a.jsx(_t,{value:f.url||"",onChange:I=>m(T=>({...T,url:I.target.value})),placeholder:"http://localhost:3001/sse",className:"font-mono text-xs"})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{children:"Auth Type"}),a.jsxs(In,{value:f.authType||"none",onValueChange:I=>K(I),children:[a.jsx(An,{children:a.jsx($n,{})}),a.jsxs(En,{children:[a.jsx(ut,{value:"none",children:"None"}),a.jsx(ut,{value:"bearer",children:"Bearer Token"}),a.jsx(ut,{value:"api-key",children:"API Key"}),a.jsx(ut,{value:"oauth2",children:"OAuth 2.0"})]})]})]}),f.authType==="bearer"&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{children:"Token"}),a.jsx(_t,{value:f.authValue||"",onChange:I=>m(T=>({...T,authValue:I.target.value})),placeholder:"${DATABRICKS_TOKEN}",className:"font-mono text-xs"})]})]}),f.authType==="bearer"&&a.jsxs("p",{className:"text-xs text-muted-foreground -mt-1",children:["Use ",a.jsx("code",{className:"rounded bg-muted px-1",children:"${VAR_NAME}"})," to reference an environment variable, or enter a token directly."]}),f.authType==="api-key"&&a.jsxs("div",{className:"space-y-3 rounded-md border p-3",children:[a.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"API Key"}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Header Name"}),a.jsx(_t,{value:f.apiKeyHeaderName||"X-API-Key",onChange:I=>m(T=>({...T,apiKeyHeaderName:I.target.value})),placeholder:"X-API-Key",className:"font-mono text-xs"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Value"}),a.jsx(KN,{value:f.authValue||"",onChange:I=>m(T=>({...T,authValue:I.target.value})),placeholder:"${MY_API_KEY}",className:"font-mono text-xs"})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Use ",a.jsx("code",{className:"rounded bg-muted px-1",children:"${VAR_NAME}"})," to reference an environment variable, or enter a value directly."]})]}),f.authType==="oauth2"&&a.jsxs("div",{className:"space-y-3 rounded-md border p-3",children:[a.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"OAuth 2.0 Flow"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Z,{type:"button",variant:!f.oauthMode||f.oauthMode==="pre_registered"?"default":"outline",size:"sm",onClick:()=>m(I=>({...I,oauthMode:"pre_registered"})),children:"Pre-registered"}),a.jsx(Z,{type:"button",variant:f.oauthMode==="dcr"?"default":"outline",size:"sm",onClick:()=>m(I=>({...I,oauthMode:"dcr",oauthClientId:void 0,oauthClientSecret:void 0})),children:"DCR (Dynamic)"})]}),(!f.oauthMode||f.oauthMode==="pre_registered")&&a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Client ID"}),a.jsx(_t,{value:f.oauthClientId||"",onChange:I=>m(T=>({...T,oauthClientId:I.target.value})),placeholder:"your-client-id",className:"font-mono text-xs"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Client Secret (optional)"}),a.jsx(KN,{value:f.oauthClientSecret||"",onChange:I=>m(T=>({...T,oauthClientSecret:I.target.value})),placeholder:"••••••••",className:"font-mono text-xs"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Scope (optional, space-separated)"}),a.jsx(_t,{value:f.oauthScope||"",onChange:I=>m(T=>({...T,oauthScope:I.target.value})),placeholder:"openid profile mcp",className:"font-mono text-xs"})]}),a.jsxs("div",{children:[a.jsxs("button",{type:"button",className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",onClick:()=>O(I=>!I),children:[a.jsx("span",{children:P?"▾":"▸"}),"Advanced — manual endpoint overrides"]}),P&&a.jsxs("div",{className:"mt-2 grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Authorization URL"}),a.jsx(_t,{value:f.oauthAuthorizationUrl||"",onChange:I=>m(T=>({...T,oauthAuthorizationUrl:I.target.value||void 0})),placeholder:"leave blank to use .well-known discovery",className:"font-mono text-xs"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Token URL"}),a.jsx(_t,{value:f.oauthTokenEndpoint||"",onChange:I=>m(T=>({...T,oauthTokenEndpoint:I.target.value||void 0})),placeholder:"leave blank to use .well-known discovery",className:"font-mono text-xs"})]})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between pt-2",children:[a.jsx("div",{children:!o&&a.jsx(Z,{type:"button",variant:"destructive",size:"sm",onClick:()=>v(!0),children:"Delete"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{type:"button",variant:"outline",size:"sm",onClick:()=>t("/libraries/servers"),children:"Cancel"}),a.jsxs(Z,{type:"button",size:"sm",onClick:()=>{B()},disabled:x,children:[x&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),o?"Create Server":"Save"]})]})]})]})]}),a.jsx(Ps,{open:p,onOpenChange:v,children:a.jsxs(Qa,{children:[a.jsxs(Ja,{children:[a.jsx(es,{children:"Delete server?"}),a.jsxs(ts,{children:["This will permanently remove the server ",a.jsx("span",{className:"font-mono",children:f.name}),". This action cannot be undone."]})]}),a.jsxs(Za,{children:[a.jsx(rs,{children:"Cancel"}),a.jsx(ns,{onClick:()=>{Y()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})},qye=()=>{const{agents:e,setAgents:t,reload:n,loading:r}=Ts(),s=ss(),[o,i]=h.useState(null),[c,d]=h.useState(""),f=c.trim().toLowerCase(),m=h.useMemo(()=>f.length===0?e:e.filter(x=>{const j=x.name.toLowerCase(),y=x.model.toLowerCase();return j.includes(f)||y.includes(f)}),[e,f]),p=async x=>{const j=`${x.name}-copy`;let y=j,b=1;for(;e.some(N=>N.name===y);)y=`${j}-${b}`,b+=1;const S={...structuredClone(x),id:`agt-${Date.now()}`,name:y};await t([...e,S]),Me({title:"Agent duplicated",description:`Created ${y}.`})},v=async x=>{await t(e.filter(j=>j.id!==x.id)),Me({title:"Agent deleted",description:`${x.name} was removed.`}),i(null)};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(Wr,{className:"h-6 w-6"}),"Agents"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Reusable agent profiles shared across configurations."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(W_,{value:c,onValueChange:d,placeholder:"Search agents..."}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{n()},disabled:r,children:[a.jsx(Ka,{className:"mr-2 h-4 w-4"}),"Refresh"]}),a.jsxs(Z,{type:"button",size:"sm",onClick:()=>s("/libraries/agents/new"),children:[a.jsx(Ao,{className:"mr-2 h-4 w-4"}),"Add Agent"]})]})]}),e.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed py-16 text-center",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No agents configured. Add one to get started."}),a.jsxs(Z,{type:"button",size:"sm",className:"mt-4",onClick:()=>s("/libraries/agents/new"),children:[a.jsx(Ao,{className:"mr-2 h-4 w-4"}),"Add Agent"]})]}):m.length===0?a.jsx("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed py-12 text-center",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"No agents match this filter."})}):a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Vt,{children:[a.jsx(ct,{children:"Name"}),a.jsx(ct,{children:"Provider"}),a.jsx(ct,{children:"Model"}),a.jsx(ct,{children:"Max Tokens"}),a.jsx(ct,{children:"Temperature"}),a.jsx(ct,{className:"text-right",children:"Actions"})]})}),a.jsx(ca,{children:m.map(x=>a.jsxs(Vt,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>s(`/libraries/agents/${encodeURIComponent(x.id)}`),children:[a.jsx(Ue,{className:"font-medium",children:x.name}),a.jsx(Ue,{children:a.jsx(g8,{provider:x.provider})}),a.jsx(Ue,{children:a.jsx("span",{className:"font-mono text-xs",children:x.model})}),a.jsx(Ue,{className:"font-mono text-xs",children:x.maxTokens}),a.jsx(Ue,{className:"font-mono text-xs",children:Xf(x.temperature).toFixed(2)}),a.jsx(Ue,{className:"text-right",onClick:j=>j.stopPropagation(),children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>i(x),children:[a.jsx(Ga,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{p(x)},children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Duplicate"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>s(`/libraries/agents/${encodeURIComponent(x.id)}`),children:[a.jsx(Zf,{className:"mr-1.5 h-3.5 w-3.5"}),"Edit"]})]})})]},x.id))})]})})}),a.jsx(Ps,{open:!!o,onOpenChange:x=>!x&&i(null),children:a.jsxs(Qa,{children:[a.jsxs(Ja,{children:[a.jsx(es,{children:"Delete agent?"}),a.jsxs(ts,{children:["This will permanently remove ",a.jsx("span",{className:"font-mono",children:o?.name})," ","from the library. This action cannot be undone."]})]}),a.jsxs(Za,{children:[a.jsx(rs,{children:"Cancel"}),a.jsx(ns,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{o&&v(o)},children:"Delete Agent"})]})]})})]})};var wq=["PageUp","PageDown"],jq=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Sq={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Hu="Slider",[GN,Uye,Wye]=Qf(Hu),[Nq]=kr(Hu,[Wye]),[Hye,cx]=Nq(Hu),Cq=h.forwardRef((e,t)=>{const{name:n,min:r=0,max:s=100,step:o=1,orientation:i="horizontal",disabled:c=!1,minStepsBetweenThumbs:d=0,defaultValue:f=[r],value:m,onValueChange:p=()=>{},onValueCommit:v=()=>{},inverted:x=!1,form:j,...y}=e,b=h.useRef(new Set),S=h.useRef(0),C=i==="horizontal"?Vye:Kye,[k=[],A]=Aa({prop:m,defaultProp:f,onChange:q=>{[...b.current][S.current]?.focus(),p(q)}}),E=h.useRef(k);function P(q){const B=Jye(k,q);K(q,B)}function O(q){K(q,S.current)}function D(){const q=E.current[S.current];k[S.current]!==q&&v(k)}function K(q,B,{commit:Y}={commit:!1}){const z=nbe(o),I=rbe(Math.round((q-r)/o)*o+r,z),T=Gf(I,[r,s]);A((V=[])=>{const H=Xye(V,T,B);if(tbe(H,d*o)){S.current=H.indexOf(T);const M=String(H)!==String(V);return M&&Y&&v(H),M?H:V}else return V})}return a.jsx(Hye,{scope:e.__scopeSlider,name:n,disabled:c,min:r,max:s,valueIndexToChangeRef:S,thumbs:b.current,values:k,orientation:i,form:j,children:a.jsx(GN.Provider,{scope:e.__scopeSlider,children:a.jsx(GN.Slot,{scope:e.__scopeSlider,children:a.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...y,ref:t,onPointerDown:We(y.onPointerDown,()=>{c||(E.current=k)}),min:r,max:s,inverted:x,onSlideStart:c?void 0:P,onSlideMove:c?void 0:O,onSlideEnd:c?void 0:D,onHomeKeyDown:()=>!c&&K(r,0,{commit:!0}),onEndKeyDown:()=>!c&&K(s,k.length-1,{commit:!0}),onStepKeyDown:({event:q,direction:B})=>{if(!c){const I=wq.includes(q.key)||q.shiftKey&&jq.includes(q.key)?10:1,T=S.current,V=k[T],H=o*I*B;K(V+H,T,{commit:!0})}}})})})})});Cq.displayName=Hu;var[_q,kq]=Nq(Hu,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Vye=h.forwardRef((e,t)=>{const{min:n,max:r,dir:s,inverted:o,onSlideStart:i,onSlideMove:c,onSlideEnd:d,onStepKeyDown:f,...m}=e,[p,v]=h.useState(null),x=Tt(t,C=>v(C)),j=h.useRef(void 0),y=qu(s),b=y==="ltr",S=b&&!o||!b&&o;function N(C){const k=j.current||p.getBoundingClientRect(),A=[0,k.width],P=uk(A,S?[n,r]:[r,n]);return j.current=k,P(C-k.left)}return a.jsx(_q,{scope:e.__scopeSlider,startEdge:S?"left":"right",endEdge:S?"right":"left",direction:S?1:-1,size:"width",children:a.jsx(Aq,{dir:y,"data-orientation":"horizontal",...m,ref:x,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const k=N(C.clientX);i?.(k)},onSlideMove:C=>{const k=N(C.clientX);c?.(k)},onSlideEnd:()=>{j.current=void 0,d?.()},onStepKeyDown:C=>{const A=Sq[S?"from-left":"from-right"].includes(C.key);f?.({event:C,direction:A?-1:1})}})})}),Kye=h.forwardRef((e,t)=>{const{min:n,max:r,inverted:s,onSlideStart:o,onSlideMove:i,onSlideEnd:c,onStepKeyDown:d,...f}=e,m=h.useRef(null),p=Tt(t,m),v=h.useRef(void 0),x=!s;function j(y){const b=v.current||m.current.getBoundingClientRect(),S=[0,b.height],C=uk(S,x?[r,n]:[n,r]);return v.current=b,C(y-b.top)}return a.jsx(_q,{scope:e.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:a.jsx(Aq,{"data-orientation":"vertical",...f,ref:p,style:{...f.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:y=>{const b=j(y.clientY);o?.(b)},onSlideMove:y=>{const b=j(y.clientY);i?.(b)},onSlideEnd:()=>{v.current=void 0,c?.()},onStepKeyDown:y=>{const S=Sq[x?"from-bottom":"from-top"].includes(y.key);d?.({event:y,direction:S?-1:1})}})})}),Aq=h.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:o,onHomeKeyDown:i,onEndKeyDown:c,onStepKeyDown:d,...f}=e,m=cx(Hu,n);return a.jsx(lt.span,{...f,ref:t,onKeyDown:We(e.onKeyDown,p=>{p.key==="Home"?(i(p),p.preventDefault()):p.key==="End"?(c(p),p.preventDefault()):wq.concat(jq).includes(p.key)&&(d(p),p.preventDefault())}),onPointerDown:We(e.onPointerDown,p=>{const v=p.target;v.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(v)?v.focus():r(p)}),onPointerMove:We(e.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&s(p)}),onPointerUp:We(e.onPointerUp,p=>{const v=p.target;v.hasPointerCapture(p.pointerId)&&(v.releasePointerCapture(p.pointerId),o(p))})})}),Eq="SliderTrack",Pq=h.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=cx(Eq,n);return a.jsx(lt.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:t})});Pq.displayName=Eq;var YN="SliderRange",Rq=h.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=cx(YN,n),o=kq(YN,n),i=h.useRef(null),c=Tt(t,i),d=s.values.length,f=s.values.map(v=>Mq(v,s.min,s.max)),m=d>1?Math.min(...f):0,p=100-Math.max(...f);return a.jsx(lt.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:c,style:{...e.style,[o.startEdge]:m+"%",[o.endEdge]:p+"%"}})});Rq.displayName=YN;var XN="SliderThumb",Tq=h.forwardRef((e,t)=>{const n=Uye(e.__scopeSlider),[r,s]=h.useState(null),o=Tt(t,c=>s(c)),i=h.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(Gye,{...e,ref:o,index:i})}),Gye=h.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:s,...o}=e,i=cx(XN,n),c=kq(XN,n),[d,f]=h.useState(null),m=Tt(t,N=>f(N)),p=d?i.form||!!d.closest("form"):!0,v=Hg(d),x=i.values[r],j=x===void 0?0:Mq(x,i.min,i.max),y=Qye(r,i.values.length),b=v?.[c.size],S=b?Zye(b,j,c.direction):0;return h.useEffect(()=>{if(d)return i.thumbs.add(d),()=>{i.thumbs.delete(d)}},[d,i.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${j}% + ${S}px)`},children:[a.jsx(GN.ItemSlot,{scope:e.__scopeSlider,children:a.jsx(lt.span,{role:"slider","aria-label":e["aria-label"]||y,"aria-valuemin":i.min,"aria-valuenow":x,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...o,ref:m,style:x===void 0?{display:"none"}:e.style,onFocus:We(e.onFocus,()=>{i.valueIndexToChangeRef.current=r})})}),p&&a.jsx(Oq,{name:s??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:x},r)]})});Tq.displayName=XN;var Yye="RadioBubbleInput",Oq=h.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const s=h.useRef(null),o=Tt(s,r),i=Jv(t);return h.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(i!==t&&m){const p=new Event("input",{bubbles:!0});m.call(c,t),c.dispatchEvent(p)}},[i,t]),a.jsx(lt.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});Oq.displayName=Yye;function Xye(e=[],t,n){const r=[...e];return r[n]=t,r.sort((s,o)=>s-o)}function Mq(e,t,n){const o=100/(n-t)*(e-t);return Gf(o,[0,100])}function Qye(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Jye(e,t){if(e.length===1)return 0;const n=e.map(s=>Math.abs(s-t)),r=Math.min(...n);return n.indexOf(r)}function Zye(e,t,n){const r=e/2,o=uk([0,50],[0,r]);return(r-o(t)*n)*n}function ebe(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function tbe(e,t){if(t>0){const n=ebe(e);return Math.min(...n)>=t}return!0}function uk(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function nbe(e){return(String(e).split(".")[1]||"").length}function rbe(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var Iq=Cq,abe=Pq,sbe=Rq,obe=Tq;const $q=h.forwardRef(({className:e,...t},n)=>a.jsxs(Iq,{ref:n,className:$e("relative flex w-full touch-none select-none items-center",e),...t,children:[a.jsx(abe,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(sbe,{className:"absolute h-full bg-primary"})}),a.jsx(obe,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));$q.displayName=Iq.displayName;function ibe(e){const t=lbe(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),d=c.find(ube);if(d){const f=d.props.children,m=c.map(p=>p===d?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function lbe(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=fbe(s),c=dbe(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var cbe=Symbol("radix.slottable");function ube(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===cbe}function dbe(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const d=o(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function fbe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ux="Popover",[Dq]=kr(ux,[Ei]),_p=Ei(),[pbe,Di]=Dq(ux),Lq=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:i=!1}=e,c=_p(t),d=h.useRef(null),[f,m]=h.useState(!1),[p,v]=Aa({prop:r,defaultProp:s??!1,onChange:o,caller:ux});return a.jsx(Vg,{...c,children:a.jsx(pbe,{scope:t,contentId:fr(),triggerRef:d,open:p,onOpenChange:v,onOpenToggle:h.useCallback(()=>v(x=>!x),[v]),hasCustomAnchor:f,onCustomAnchorAdd:h.useCallback(()=>m(!0),[]),onCustomAnchorRemove:h.useCallback(()=>m(!1),[]),modal:i,children:n})})};Lq.displayName=ux;var Fq="PopoverAnchor",hbe=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Di(Fq,n),o=_p(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:c}=s;return h.useEffect(()=>(i(),()=>c()),[i,c]),a.jsx(tp,{...o,...r,ref:t})});hbe.displayName=Fq;var zq="PopoverTrigger",Bq=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Di(zq,n),o=_p(n),i=Tt(t,s.triggerRef),c=a.jsx(lt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Vq(s.open),...r,ref:i,onClick:We(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:a.jsx(tp,{asChild:!0,...o,children:c})});Bq.displayName=zq;var dk="PopoverPortal",[mbe,gbe]=Dq(dk,{forceMount:void 0}),qq=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,o=Di(dk,t);return a.jsx(mbe,{scope:t,forceMount:n,children:a.jsx(ar,{present:n||o.open,children:a.jsx(zl,{asChild:!0,container:s,children:r})})})};qq.displayName=dk;var Cu="PopoverContent",Uq=h.forwardRef((e,t)=>{const n=gbe(Cu,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,o=Di(Cu,e.__scopePopover);return a.jsx(ar,{present:r||o.open,children:o.modal?a.jsx(xbe,{...s,ref:t}):a.jsx(ybe,{...s,ref:t})})});Uq.displayName=Cu;var vbe=ibe("PopoverContent.RemoveScroll"),xbe=h.forwardRef((e,t)=>{const n=Di(Cu,e.__scopePopover),r=h.useRef(null),s=Tt(t,r),o=h.useRef(!1);return h.useEffect(()=>{const i=r.current;if(i)return sv(i)},[]),a.jsx(op,{as:vbe,allowPinchZoom:!0,children:a.jsx(Wq,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:We(e.onCloseAutoFocus,i=>{i.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:We(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;o.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:We(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),ybe=h.forwardRef((e,t)=>{const n=Di(Cu,e.__scopePopover),r=h.useRef(!1),s=h.useRef(!1);return a.jsx(Wq,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;n.triggerRef.current?.contains(i)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),Wq=h.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,...p}=e,v=Di(Cu,n),x=_p(n);return rv(),a.jsx(sp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:a.jsx(Fl,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:m,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:f,onDismiss:()=>v.onOpenChange(!1),children:a.jsx(Kg,{"data-state":Vq(v.open),role:"dialog",id:v.contentId,...x,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Hq="PopoverClose",bbe=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Di(Hq,n);return a.jsx(lt.button,{type:"button",...r,ref:t,onClick:We(e.onClick,()=>s.onOpenChange(!1))})});bbe.displayName=Hq;var wbe="PopoverArrow",jbe=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=_p(n);return a.jsx(Gg,{...s,...r,ref:t})});jbe.displayName=wbe;function Vq(e){return e?"open":"closed"}var Sbe=Lq,Nbe=Bq,Cbe=qq,Kq=Uq;const wi=Sbe,ji=Nbe,ko=h.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>a.jsx(Cbe,{children:a.jsx(Kq,{ref:s,align:t,sideOffset:n,className:$e("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...r})}));ko.displayName=Kq.displayName;var fD=1,_be=.9,kbe=.8,Abe=.17,CS=.1,_S=.999,Ebe=.9999,Pbe=.99,Rbe=/[\\\/_+.#"@\[\(\{&]/,Tbe=/[\\\/_+.#"@\[\(\{&]/g,Obe=/[\s-]/,Gq=/[\s-]/g;function QN(e,t,n,r,s,o,i){if(o===t.length)return s===e.length?fD:Pbe;var c=`${s},${o}`;if(i[c]!==void 0)return i[c];for(var d=r.charAt(o),f=n.indexOf(d,s),m=0,p,v,x,j;f>=0;)p=QN(e,t,n,r,f+1,o+1,i),p>m&&(f===s?p*=fD:Rbe.test(e.charAt(f-1))?(p*=kbe,x=e.slice(s,f-1).match(Tbe),x&&s>0&&(p*=Math.pow(_S,x.length))):Obe.test(e.charAt(f-1))?(p*=_be,j=e.slice(s,f-1).match(Gq),j&&s>0&&(p*=Math.pow(_S,j.length))):(p*=Abe,s>0&&(p*=Math.pow(_S,f-s))),e.charAt(f)!==t.charAt(o)&&(p*=Ebe)),(p<CS&&n.charAt(f-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(f-1)!==r.charAt(o))&&(v=QN(e,t,n,r,f+1,o+2,i),v*CS>p&&(p=v*CS)),p>m&&(m=p),f=n.indexOf(d,f+1);return i[c]=m,m}function pD(e){return e.toLowerCase().replace(Gq," ")}function Mbe(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,QN(e,t,pD(e),pD(t),0,0,{})}var Ld='[cmdk-group=""]',kS='[cmdk-group-items=""]',Ibe='[cmdk-group-heading=""]',Yq='[cmdk-item=""]',hD=`${Yq}:not([aria-disabled="true"])`,JN="cmdk-item-select",Tc="data-value",$be=(e,t,n)=>Mbe(e,t,n),Xq=h.createContext(void 0),kp=()=>h.useContext(Xq),Qq=h.createContext(void 0),fk=()=>h.useContext(Qq),Jq=h.createContext(void 0),Zq=h.forwardRef((e,t)=>{let n=Oc(()=>{var F,G;return{search:"",value:(G=(F=e.value)!=null?F:e.defaultValue)!=null?G:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Oc(()=>new Set),s=Oc(()=>new Map),o=Oc(()=>new Map),i=Oc(()=>new Set),c=eU(e),{label:d,children:f,value:m,onValueChange:p,filter:v,shouldFilter:x,loop:j,disablePointerSelection:y=!1,vimBindings:b=!0,...S}=e,N=fr(),C=fr(),k=fr(),A=h.useRef(null),E=Kbe();Ol(()=>{if(m!==void 0){let F=m.trim();n.current.value=F,P.emit()}},[m]),Ol(()=>{E(6,Y)},[]);let P=h.useMemo(()=>({subscribe:F=>(i.current.add(F),()=>i.current.delete(F)),snapshot:()=>n.current,setState:(F,G,re)=>{var oe,ue,ae,ye;if(!Object.is(n.current[F],G)){if(n.current[F]=G,F==="search")B(),K(),E(1,q);else if(F==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let se=document.getElementById(k);se?se.focus():(oe=document.getElementById(N))==null||oe.focus()}if(E(7,()=>{var se;n.current.selectedItemId=(se=z())==null?void 0:se.id,P.emit()}),re||E(5,Y),((ue=c.current)==null?void 0:ue.value)!==void 0){let se=G??"";(ye=(ae=c.current).onValueChange)==null||ye.call(ae,se);return}}P.emit()}},emit:()=>{i.current.forEach(F=>F())}}),[]),O=h.useMemo(()=>({value:(F,G,re)=>{var oe;G!==((oe=o.current.get(F))==null?void 0:oe.value)&&(o.current.set(F,{value:G,keywords:re}),n.current.filtered.items.set(F,D(G,re)),E(2,()=>{K(),P.emit()}))},item:(F,G)=>(r.current.add(F),G&&(s.current.has(G)?s.current.get(G).add(F):s.current.set(G,new Set([F]))),E(3,()=>{B(),K(),n.current.value||q(),P.emit()}),()=>{o.current.delete(F),r.current.delete(F),n.current.filtered.items.delete(F);let re=z();E(4,()=>{B(),re?.getAttribute("id")===F&&q(),P.emit()})}),group:F=>(s.current.has(F)||s.current.set(F,new Set),()=>{o.current.delete(F),s.current.delete(F)}),filter:()=>c.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:N,inputId:k,labelId:C,listInnerRef:A}),[]);function D(F,G){var re,oe;let ue=(oe=(re=c.current)==null?void 0:re.filter)!=null?oe:$be;return F?ue(F,n.current.search,G):0}function K(){if(!n.current.search||c.current.shouldFilter===!1)return;let F=n.current.filtered.items,G=[];n.current.filtered.groups.forEach(oe=>{let ue=s.current.get(oe),ae=0;ue.forEach(ye=>{let se=F.get(ye);ae=Math.max(se,ae)}),G.push([oe,ae])});let re=A.current;I().sort((oe,ue)=>{var ae,ye;let se=oe.getAttribute("id"),de=ue.getAttribute("id");return((ae=F.get(de))!=null?ae:0)-((ye=F.get(se))!=null?ye:0)}).forEach(oe=>{let ue=oe.closest(kS);ue?ue.appendChild(oe.parentElement===ue?oe:oe.closest(`${kS} > *`)):re.appendChild(oe.parentElement===re?oe:oe.closest(`${kS} > *`))}),G.sort((oe,ue)=>ue[1]-oe[1]).forEach(oe=>{var ue;let ae=(ue=A.current)==null?void 0:ue.querySelector(`${Ld}[${Tc}="${encodeURIComponent(oe[0])}"]`);ae?.parentElement.appendChild(ae)})}function q(){let F=I().find(re=>re.getAttribute("aria-disabled")!=="true"),G=F?.getAttribute(Tc);P.setState("value",G||void 0)}function B(){var F,G,re,oe;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ue=0;for(let ae of r.current){let ye=(G=(F=o.current.get(ae))==null?void 0:F.value)!=null?G:"",se=(oe=(re=o.current.get(ae))==null?void 0:re.keywords)!=null?oe:[],de=D(ye,se);n.current.filtered.items.set(ae,de),de>0&&ue++}for(let[ae,ye]of s.current)for(let se of ye)if(n.current.filtered.items.get(se)>0){n.current.filtered.groups.add(ae);break}n.current.filtered.count=ue}function Y(){var F,G,re;let oe=z();oe&&(((F=oe.parentElement)==null?void 0:F.firstChild)===oe&&((re=(G=oe.closest(Ld))==null?void 0:G.querySelector(Ibe))==null||re.scrollIntoView({block:"nearest"})),oe.scrollIntoView({block:"nearest"}))}function z(){var F;return(F=A.current)==null?void 0:F.querySelector(`${Yq}[aria-selected="true"]`)}function I(){var F;return Array.from(((F=A.current)==null?void 0:F.querySelectorAll(hD))||[])}function T(F){let G=I()[F];G&&P.setState("value",G.getAttribute(Tc))}function V(F){var G;let re=z(),oe=I(),ue=oe.findIndex(ye=>ye===re),ae=oe[ue+F];(G=c.current)!=null&&G.loop&&(ae=ue+F<0?oe[oe.length-1]:ue+F===oe.length?oe[0]:oe[ue+F]),ae&&P.setState("value",ae.getAttribute(Tc))}function H(F){let G=z(),re=G?.closest(Ld),oe;for(;re&&!oe;)re=F>0?Hbe(re,Ld):Vbe(re,Ld),oe=re?.querySelector(hD);oe?P.setState("value",oe.getAttribute(Tc)):V(F)}let M=()=>T(I().length-1),X=F=>{F.preventDefault(),F.metaKey?M():F.altKey?H(1):V(1)},$=F=>{F.preventDefault(),F.metaKey?T(0):F.altKey?H(-1):V(-1)};return h.createElement(lt.div,{ref:t,tabIndex:-1,...S,"cmdk-root":"",onKeyDown:F=>{var G;(G=S.onKeyDown)==null||G.call(S,F);let re=F.nativeEvent.isComposing||F.keyCode===229;if(!(F.defaultPrevented||re))switch(F.key){case"n":case"j":{b&&F.ctrlKey&&X(F);break}case"ArrowDown":{X(F);break}case"p":case"k":{b&&F.ctrlKey&&$(F);break}case"ArrowUp":{$(F);break}case"Home":{F.preventDefault(),T(0);break}case"End":{F.preventDefault(),M();break}case"Enter":{F.preventDefault();let oe=z();if(oe){let ue=new Event(JN);oe.dispatchEvent(ue)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:O.inputId,id:O.labelId,style:Ybe},d),dx(e,F=>h.createElement(Qq.Provider,{value:P},h.createElement(Xq.Provider,{value:O},F))))}),Dbe=h.forwardRef((e,t)=>{var n,r;let s=fr(),o=h.useRef(null),i=h.useContext(Jq),c=kp(),d=eU(e),f=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:i?.forceMount;Ol(()=>{if(!f)return c.item(s,i?.id)},[f]);let m=tU(s,o,[e.value,e.children,o],e.keywords),p=fk(),v=Ai(E=>E.value&&E.value===m.current),x=Ai(E=>f||c.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);h.useEffect(()=>{let E=o.current;if(!(!E||e.disabled))return E.addEventListener(JN,j),()=>E.removeEventListener(JN,j)},[x,e.onSelect,e.disabled]);function j(){var E,P;y(),(P=(E=d.current).onSelect)==null||P.call(E,m.current)}function y(){p.setState("value",m.current,!0)}if(!x)return null;let{disabled:b,value:S,onSelect:N,forceMount:C,keywords:k,...A}=e;return h.createElement(lt.div,{ref:Vr(o,t),...A,id:s,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!v,"data-disabled":!!b,"data-selected":!!v,onPointerMove:b||c.getDisablePointerSelection()?void 0:y,onClick:b?void 0:j},e.children)}),Lbe=h.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...o}=e,i=fr(),c=h.useRef(null),d=h.useRef(null),f=fr(),m=kp(),p=Ai(x=>s||m.filter()===!1?!0:x.search?x.filtered.groups.has(i):!0);Ol(()=>m.group(i),[]),tU(i,c,[e.value,e.heading,d]);let v=h.useMemo(()=>({id:i,forceMount:s}),[s]);return h.createElement(lt.div,{ref:Vr(c,t),...o,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&h.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),dx(e,x=>h.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},h.createElement(Jq.Provider,{value:v},x))))}),Fbe=h.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=h.useRef(null),o=Ai(i=>!i.search);return!n&&!o?null:h.createElement(lt.div,{ref:Vr(s,t),...r,"cmdk-separator":"",role:"separator"})}),zbe=h.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,o=fk(),i=Ai(f=>f.search),c=Ai(f=>f.selectedItemId),d=kp();return h.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),h.createElement(lt.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:s?e.value:i,onChange:f=>{s||o.setState("search",f.target.value),n?.(f.target.value)}})}),Bbe=h.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,o=h.useRef(null),i=h.useRef(null),c=Ai(f=>f.selectedItemId),d=kp();return h.useEffect(()=>{if(i.current&&o.current){let f=i.current,m=o.current,p,v=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let x=f.offsetHeight;m.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return v.observe(f),()=>{cancelAnimationFrame(p),v.unobserve(f)}}},[]),h.createElement(lt.div,{ref:Vr(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:d.listId},dx(e,f=>h.createElement("div",{ref:Vr(i,d.listInnerRef),"cmdk-list-sizer":""},f)))}),qbe=h.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:o,container:i,...c}=e;return h.createElement(iv,{open:n,onOpenChange:r},h.createElement(lv,{container:i},h.createElement(Ou,{"cmdk-overlay":"",className:s}),h.createElement(Mu,{"aria-label":e.label,"cmdk-dialog":"",className:o},h.createElement(Zq,{ref:t,...c}))))}),Ube=h.forwardRef((e,t)=>Ai(n=>n.filtered.count===0)?h.createElement(lt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Wbe=h.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...o}=e;return h.createElement(lt.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},dx(e,i=>h.createElement("div",{"aria-hidden":!0},i)))}),pa=Object.assign(Zq,{List:Bbe,Item:Dbe,Input:zbe,Group:Lbe,Separator:Fbe,Dialog:qbe,Empty:Ube,Loading:Wbe});function Hbe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Vbe(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function eU(e){let t=h.useRef(e);return Ol(()=>{t.current=e}),t}var Ol=typeof window>"u"?h.useEffect:h.useLayoutEffect;function Oc(e){let t=h.useRef();return t.current===void 0&&(t.current=e()),t}function Ai(e){let t=fk(),n=()=>e(t.snapshot());return h.useSyncExternalStore(t.subscribe,n,n)}function tU(e,t,n,r=[]){let s=h.useRef(),o=kp();return Ol(()=>{var i;let c=(()=>{var f;for(let m of n){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(f=m.current.textContent)==null?void 0:f.trim():s.current}})(),d=r.map(f=>f.trim());o.value(e,c,d),(i=t.current)==null||i.setAttribute(Tc,c),s.current=c}),s}var Kbe=()=>{let[e,t]=h.useState(),n=Oc(()=>new Map);return Ol(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function Gbe(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function dx({asChild:e,children:t},n){return e&&h.isValidElement(t)?h.cloneElement(Gbe(t),{ref:t.ref},n(t.props.children)):n(t)}var Ybe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ml=h.forwardRef(({className:e,...t},n)=>a.jsx(pa,{ref:n,className:$e("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Ml.displayName=pa.displayName;const Il=h.forwardRef(({className:e,...t},n)=>a.jsxs("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[a.jsx(pC,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(pa.Input,{ref:n,className:$e("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));Il.displayName=pa.Input.displayName;const $l=h.forwardRef(({className:e,...t},n)=>a.jsx(pa.List,{ref:n,className:$e("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));$l.displayName=pa.List.displayName;const Dl=h.forwardRef((e,t)=>a.jsx(pa.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));Dl.displayName=pa.Empty.displayName;const Ll=h.forwardRef(({className:e,...t},n)=>a.jsx(pa.Group,{ref:n,className:$e("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Ll.displayName=pa.Group.displayName;const Xbe=h.forwardRef(({className:e,...t},n)=>a.jsx(pa.Separator,{ref:n,className:$e("-mx-1 h-px bg-border",e),...t}));Xbe.displayName=pa.Separator.displayName;const Na=h.forwardRef(({className:e,...t},n)=>a.jsx(pa.Item,{ref:n,className:$e("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),...t}));Na.displayName=pa.Item.displayName;const mD={openai:["gpt-4o","gpt-4o-mini","gpt-4-turbo","o1","o1-mini"],anthropic:["claude-3-5-sonnet-latest","claude-3-5-haiku-latest","claude-3-opus-latest"],azure:["gpt-4o","gpt-4-turbo"],google:["gemini-2.0-flash","gemini-1.5-pro"],custom:[]},gD={anthropic:"Check that `ANTHROPIC_API_KEY` is set in your environment",openai:"Check that `OPENAI_API_KEY` is set in your environment",azure:"Check that Azure OpenAI env vars are configured in your environment"},vD=()=>({id:`agt-${Date.now()}`,name:"",provider:"openai",model:"gpt-4o",temperature:Pg,maxTokens:4096}),Qbe=()=>{const{agentName:e}=ql(),t=ss(),{agents:n,setAgents:r}=Ts(),{source:s}=Dn(),o=e==="new",i=e?decodeURIComponent(e):"",c=o?null:n.find(M=>M.id===i)??n.find(M=>M.name===i),[d,f]=h.useState(()=>c??vD()),[m,p]=h.useState(!1),[v,x]=h.useState(!1),[j,y]=h.useState({status:"idle"}),[b,S]=h.useState(!1),[N,C]=h.useState([]),[k,A]=h.useState(!1),[E,P]=h.useState(!1),[O,D]=h.useState(!1),K=h.useRef(null);h.useEffect(()=>{const M=o?`new:${i||"new"}`:`agt:${i}`;if(K.current!==M){if(o){f(vD()),K.current=M;return}c&&(f(c),K.current=M)}},[o,i,c]);const q=d.provider==="anthropic"||d.provider==="openai"||d.provider==="azure",B=Array.from(new Set([...mD[d.provider]||[],...N])),Y=B.includes(d.model),z=O||!!d.model&&!Y,I=async()=>{if(S(!0),d.provider==="google"||d.provider==="custom"){y({status:"unsupported"});return}y({status:"loading"});try{const M=await s.listProviderModels(d.provider);y({status:"success",items:M.items,source:M.source,kind:M.kind,testedAt:new Date().toISOString()})}catch(M){y({status:"error",message:M instanceof Error?M.message:String(M),testedAt:new Date().toISOString()})}},T=async()=>{if(!q){Me({title:"Provider discovery not supported",description:"Model discovery is available for Anthropic, OpenAI, and Azure OpenAI."});return}A(!0);try{const M=await s.listProviderModels(d.provider);C(M.items),Me({title:M.kind==="deployments"?"Deployments loaded":"Models loaded",description:`${M.items.length} ${M.kind} from ${M.source}`})}catch(M){Me({title:"Could not load provider models",description:String(M instanceof Error?M.message:M),variant:"destructive"})}finally{A(!1)}},V=async()=>{if(!d.name.trim()){Me({title:"Name is required",variant:"destructive"});return}x(!0);try{if(o)await r([...n,d]),Me({title:"Agent created"}),t(`/libraries/agents/${encodeURIComponent(d.id)}`);else{const M=n.map(X=>X.id===c?.id?d:X);await r(M),Me({title:"Agent saved"}),d.id!==i&&t(`/libraries/agents/${encodeURIComponent(d.id)}`,{replace:!0})}}finally{x(!1)}},H=async()=>{const M=n.filter(X=>X.id!==c?.id);await r(M),Me({title:"Agent deleted"}),t("/libraries/agents")};return!o&&!c?a.jsxs("div",{className:"space-y-4",children:[a.jsxs(At,{to:"/libraries/agents",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[a.jsx(Si,{className:"h-4 w-4"})," Agents"]}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:['Agent "',i,'" not found.']})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs(At,{to:"/libraries/agents",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[a.jsx(Si,{className:"h-4 w-4"})," Agents"]}),a.jsx("h1",{className:"text-2xl font-bold",children:o?"New Agent":d.name})]}),!o&&a.jsxs(Z,{type:"button",onClick:()=>{I()},children:[a.jsx(S5,{className:"mr-2 h-4 w-4"}),"Test Connection"]})]}),b&&a.jsxs(Qe,{children:[a.jsxs($t,{className:"flex-row items-center justify-between space-y-0",children:[a.jsx(Dt,{className:"text-base",children:"Connection Test"}),a.jsx("button",{type:"button",onClick:()=>S(!1),className:"rounded-sm opacity-70 hover:opacity-100",children:a.jsx(ua,{className:"h-4 w-4"})})]}),a.jsxs(Je,{className:"space-y-3",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground",children:[a.jsx("span",{children:"Provider:"}),a.jsx("span",{className:"font-medium text-foreground",children:d.provider}),a.jsx("span",{className:"mx-1",children:"·"}),a.jsx("span",{children:"Endpoint:"}),a.jsxs("code",{className:"font-mono text-xs",children:["/api/providers/models?provider=",d.provider]})]}),j.status==="loading"&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(_r,{className:"h-4 w-4 animate-spin"}),"Testing connection..."]}),j.status==="success"&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("p",{className:"flex items-center gap-2 text-sm text-emerald-700",children:[a.jsx(Gc,{className:"h-4 w-4 shrink-0"}),"Connected — discovered ",j.items.length," ",j.kind," from"," ",j.source]}),a.jsxs("div",{className:"rounded-md bg-muted p-3",children:[a.jsxs("p",{className:"mb-1 text-xs font-medium text-muted-foreground",children:["First 5 ",j.kind,":"]}),a.jsx("ul",{className:"space-y-0.5",children:j.items.slice(0,5).map(M=>a.jsx("li",{className:"font-mono text-xs",children:M},M))})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Tested at ",new Date(j.testedAt).toLocaleString()]})]}),j.status==="error"&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-sm text-destructive",children:[a.jsx("span",{className:"font-medium",children:"✗ Connection failed"})," — ",j.message]}),gD[d.provider]&&a.jsxs("p",{className:"rounded-md bg-muted px-3 py-2 text-xs text-muted-foreground",children:["Hint: ",gD[d.provider]]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Tested at ",new Date(j.testedAt).toLocaleString()]})]}),j.status==="unsupported"&&a.jsxs("p",{className:"rounded-md bg-muted px-3 py-2 text-sm text-muted-foreground",children:["Connection testing is not supported for the"," ",a.jsx("span",{className:"font-medium",children:d.provider})," provider. Supported providers: Anthropic, OpenAI, Azure OpenAI."]})]})]}),a.jsxs(Qe,{children:[a.jsx($t,{children:a.jsx(Dt,{className:"text-base",children:"Configuration"})}),a.jsxs(Je,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{children:"Name"}),a.jsx(_t,{value:d.name,onChange:M=>f(X=>({...X,name:M.target.value})),placeholder:"e.g. GPT-4o"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{children:"Provider"}),a.jsxs(In,{value:d.provider,onValueChange:M=>f(X=>({...X,provider:M,model:mD[M]?.[0]||""})),children:[a.jsx(An,{children:a.jsx($n,{})}),a.jsxs(En,{children:[a.jsx(ut,{value:"openai",children:"OpenAI"}),a.jsx(ut,{value:"anthropic",children:"Anthropic"}),a.jsx(ut,{value:"azure",children:"Azure OpenAI"}),a.jsx(ut,{value:"google",children:"Google"}),a.jsx(ut,{value:"custom",children:"Custom"})]})]})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{children:d.provider==="azure"?"Deployment":"Model"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(wi,{open:E,onOpenChange:P,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":E,"aria-controls":"agent-model-command-list",className:"h-9 flex-1 justify-between font-mono text-xs",children:[a.jsx("span",{className:"truncate text-left",children:d.model||"Select model..."}),a.jsx(en,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(ko,{className:"w-[420px] p-0",align:"start",children:a.jsxs(Ml,{children:[a.jsx(Il,{placeholder:`Search ${d.provider==="azure"?"deployments":"models"}...`}),a.jsxs($l,{id:"agent-model-command-list",children:[a.jsxs(Dl,{children:["No ",d.provider==="azure"?"deployments":"models"," found."]}),a.jsxs(Ll,{heading:d.provider==="azure"?"Deployments":"Models",children:[B.map(M=>a.jsxs(Na,{value:M,onSelect:X=>{f($=>({...$,model:X})),D(!1),P(!1)},children:[a.jsx(Gc,{className:$e("mr-2 h-4 w-4",d.model===M?"opacity-100":"opacity-0")}),a.jsx("span",{className:"font-mono text-xs",children:M})]},M)),a.jsx(Na,{value:"__custom_model_id__",onSelect:()=>{D(!0),P(!1)},children:a.jsx("span",{className:"font-medium",children:d.provider==="azure"?"Custom deployment ID...":"Custom model ID..."})})]})]})]})})]}),q&&a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-9 shrink-0 text-xs",onClick:()=>{T()},disabled:k,title:d.provider==="azure"?"Fetch Azure OpenAI deployments":`Fetch ${d.provider} models`,children:[k?a.jsx(_r,{className:"mr-1 h-3 w-3 animate-spin"}):a.jsx(Ka,{className:"mr-1 h-3 w-3"}),d.provider==="azure"?"Fetch Deployments":"Fetch Models"]})]}),z&&a.jsx(_t,{value:d.model,onChange:M=>f(X=>({...X,model:M.target.value})),placeholder:d.provider==="azure"?"Type deployment name manually":"Type model name manually",className:"font-mono text-xs"}),N.length>0&&a.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Loaded ",N.length," ",d.provider==="azure"?"deployment names":"models"," from provider discovery."]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{children:"Max Tokens"}),a.jsx(_t,{type:"number",min:1,max:128e3,value:d.maxTokens,onChange:M=>f(X=>({...X,maxTokens:parseInt(M.target.value)||0})),className:"font-mono text-xs"})]})]}),a.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{children:"Max Turns"}),a.jsx(_t,{type:"number",min:1,max:50,value:d.maxTurns??"",onChange:M=>{const X=M.target.value.trim();f($=>({...$,maxTurns:X&&parseInt(X)||void 0}))},placeholder:"30 (default)",className:"font-mono text-xs"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Maximum number of LLM round-trips (tool calls + final answer) per eval run."})]})}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(He,{children:"Temperature"}),a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:Xf(d.temperature).toFixed(2)})]}),a.jsx($q,{value:[Xf(d.temperature)],onValueChange:([M])=>f(X=>({...X,temperature:M})),min:0,max:2,step:.01})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{children:"System Prompt"}),a.jsx(Es,{value:d.systemPrompt||"",onChange:M=>f(X=>({...X,systemPrompt:M.target.value})),placeholder:"Optional system prompt...",rows:3,className:"text-xs"})]}),a.jsxs("div",{className:"flex items-center justify-between pt-2",children:[a.jsx("div",{children:!o&&a.jsx(Z,{type:"button",variant:"destructive",size:"sm",onClick:()=>p(!0),children:"Delete"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{type:"button",variant:"outline",size:"sm",onClick:()=>t("/libraries/agents"),children:"Cancel"}),a.jsxs(Z,{type:"button",size:"sm",onClick:()=>{V()},disabled:v,children:[v&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),o?"Create Agent":"Save"]})]})]})]})]}),a.jsx(Ps,{open:m,onOpenChange:p,children:a.jsxs(Qa,{children:[a.jsxs(Ja,{children:[a.jsx(es,{children:"Delete agent?"}),a.jsxs(ts,{children:["This will permanently remove the agent ",a.jsx("span",{className:"font-mono",children:d.name}),". This action cannot be undone."]})]}),a.jsxs(Za,{children:[a.jsx(rs,{children:"Cancel"}),a.jsx(ns,{onClick:()=>{H()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})},xD="mcplab.resultAssistantScenarioHandoff",yD=()=>{const{testCaseId:e}=ql(),[t,n]=Fo(),r=ss(),{source:s}=Dn(),{scenarios:o,setScenarios:i,agents:c,servers:d,reload:f,loading:m}=Ts(),[p,v]=h.useState(""),[x,j]=h.useState("all"),[y,b]=h.useState("name"),[S,N]=h.useState("asc"),[C,k]=h.useState(""),[A,E]=h.useState(null),[P,O]=h.useState("idle"),[D,K]=h.useState(""),[q,B]=h.useState(""),[Y,z]=h.useState(0),[I,T]=h.useState(null),V=h.useRef(null),H=h.useRef(!1),M=h.useRef(!1),X=h.useRef(null),$=h.useRef(0),F=h.useRef(o);F.current=o;const G=h.useRef(i);G.current=i;const re=e?decodeURIComponent(e):void 0,oe=t.get("returnTo")?.trim()||"",ue=oe.startsWith("/")?oe:"",ae=re?o.findIndex(_e=>_e.id===re):-1,ye=ae>=0?o[ae]:void 0,se=async _e=>{if(!ye||ae<0||!_e)return;const Ee=[...o];Ee[ae]=_e,await i(Ee)},de=async()=>{const _e=X.current;if(!_e||!ye)return;if(H.current){M.current=!0;return}H.current=!0,M.current=!1;const Ee=++$.current;O("saving"),K("");try{await se(_e),Ee===$.current&&O("saved")}catch(Ze){const pt=Ze instanceof Error?Ze.message:String(Ze);Ee===$.current&&(O("error"),K(pt)),Me({title:"Could not save scenario",description:pt,variant:"destructive"})}finally{H.current=!1,M.current&&(M.current=!1,de())}},De=_e=>{X.current=_e,O("dirty"),K(""),V.current&&window.clearTimeout(V.current),V.current=window.setTimeout(()=>{V.current=null,de()},700)},ge=async()=>{const _e=`scn-${Date.now()}`;let Ee=_e,Ze=1;for(;o.some(Lt=>Lt.id===Ee);)Ee=`${_e}-${Ze}`,Ze+=1;const pt={id:Ee,name:"",serverIds:[],prompt:"",evalRules:[],extractRules:[]};await i([...o,pt]),r(`/libraries/test-cases/${encodeURIComponent(Ee)}`),Me({title:"Test case created",description:`Opened ${Ee} for editing.`})},ve=_e=>{const Ee=(_e||`scn-${Date.now()}`).trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9_-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")||`scn-${Date.now()}`;let Ze=Ee,pt=1;for(;o.some(Lt=>Lt.id===Ze);)Ze=`${Ee}-${pt}`,pt+=1;return Ze},Se=async(_e,Ee=!1)=>{const Ze=ve(`${_e.id}-copy`),pt={...structuredClone(_e),id:Ze,name:_e.name?`${_e.name} (Copy)`:""};await i([...o,pt]),Me({title:"Test case duplicated",description:`Created ${pt.id}.`}),Ee&&r(`/libraries/test-cases/${encodeURIComponent(pt.id)}`)},at=async _e=>{V.current&&(window.clearTimeout(V.current),V.current=null);const Ee=o.filter(Ze=>Ze.id!==_e.id);await i(Ee),Me({title:"Test case deleted",description:`${_e.id} was removed.`}),ye?.id===_e.id&&(E(null),X.current=null,O("idle"),K(""),r("/libraries/test-cases"))},tt=_e=>_e.map(Ee=>d.find(Ze=>Ze.id===Ee)).filter(Boolean).map(Ee=>Ee?.name||Ee?.id).filter(Boolean),it=h.useMemo(()=>{const _e=new Set;for(const Ee of o)for(const Ze of tt(Ee.serverIds))_e.add(Ze);return Array.from(_e).sort((Ee,Ze)=>Ee.localeCompare(Ze))},[o,d]),kt=h.useMemo(()=>{const _e=p.trim().toLowerCase(),Ee=o.filter(Ze=>{const pt=(Ze.name||"").toLowerCase(),Lt=Ze.id.toLowerCase(),Ut=(Ze.prompt||"").toLowerCase(),Nt=tt(Ze.serverIds);return x!=="all"&&!Nt.includes(x)?!1:_e?pt.includes(_e)||Lt.includes(_e)||Ut.includes(_e)||Nt.some(an=>an.toLowerCase().includes(_e)):!0});return Ee.sort((Ze,pt)=>{const Lt=tt(Ze.serverIds),Ut=tt(pt.serverIds);let Nt=0;switch(y){case"id":Nt=Ze.id.localeCompare(pt.id);break;case"servers":Nt=Lt.length-Ut.length;break;case"evalRules":Nt=Ze.evalRules.length-pt.evalRules.length;break;case"extractRules":Nt=Ze.extractRules.length-pt.extractRules.length;break;default:Nt=(Ze.name||Ze.id).localeCompare(pt.name||pt.id);break}return Nt===0&&(Nt=Ze.id.localeCompare(pt.id)),S==="asc"?Nt:-Nt}),Ee},[o,p,x,y,S,d]);h.useEffect(()=>{let _e=!0;return s.getWorkspaceSettings().then(Ee=>{!_e||!Ee||k(Ee.scenarioAssistantAgentName??"")}).catch(()=>{_e&&k("")}),()=>{_e=!1}},[s]),h.useEffect(()=>{if(re&&t.get("assistantHandoff")==="1")try{const _e=window.sessionStorage.getItem(xD);if(!_e)return;const Ee=JSON.parse(_e);if(!Ee||Ee.scenarioId!==re||!Ee.prompt)return;B(String(Ee.prompt)),z(Date.now()),window.sessionStorage.removeItem(xD);const Ze=new URLSearchParams(t);Ze.delete("assistantHandoff"),n(Ze,{replace:!0}),Me({title:"Suggestion sent to Scenario Assistant",description:"Review the suggestion and apply changes in the scenario editor."})}catch{}},[re,t,n]),h.useEffect(()=>{const _e=V.current!==null||H.current,Ee=X.current;if(ye&&Ee?.id===ye.id&&_e)return;if(!!Ee&&Ee.id!==ye?.id&&(V.current!==null||M.current)){V.current!==null&&(window.clearTimeout(V.current),V.current=null),M.current=!1;const pt=F.current,Lt=pt.findIndex(Ut=>Ut.id===Ee.id);if(Lt>=0){const Ut=[...pt];Ut[Lt]=Ee,G.current(Ut)}}V.current&&(window.clearTimeout(V.current),V.current=null),H.current=!1,M.current=!1,ye?(E(structuredClone(ye)),X.current=structuredClone(ye),O("idle"),K("")):(E(null),X.current=null,O("idle"),K(""))},[ye]),h.useEffect(()=>()=>{V.current&&window.clearTimeout(V.current)},[]);const Ye=C||c[0]?.name||"";return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(uC,{className:"h-6 w-6"}),"Manage Test Cases"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Reusable test case templates shared across configurations."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[ye&&a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>r("/libraries/test-cases"),children:[a.jsx(Si,{className:"mr-2 h-4 w-4"}),"Back to Overview"]}),ye&&ue&&a.jsx(Z,{type:"button",size:"sm",variant:"outline",asChild:!0,children:a.jsxs(At,{to:ue,children:[a.jsx(Si,{className:"mr-2 h-4 w-4"}),"Back to evaluation"]})}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{f()},disabled:m,children:[a.jsx(Ka,{className:"mr-2 h-4 w-4"}),"Refresh"]}),!ye&&a.jsxs(Z,{type:"button",size:"sm",onClick:()=>{ge()},children:[a.jsx(Ao,{className:"mr-1.5 h-3.5 w-3.5"}),"Add Test Case"]})]})]}),!ye&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-3 rounded-md border bg-muted/30 p-3 md:grid-cols-[1.6fr_1fr_1fr_auto]",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Search"}),a.jsxs("div",{className:"relative",children:[a.jsx(pC,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),a.jsx(_t,{value:p,onChange:_e=>v(_e.target.value),placeholder:"Search by name, id, prompt, server...",className:"h-8 pl-8 text-xs"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Server Filter"}),a.jsxs(In,{value:x,onValueChange:j,children:[a.jsx(An,{className:"h-8 text-xs",children:a.jsx($n,{})}),a.jsxs(En,{children:[a.jsx(ut,{value:"all",children:"All servers"}),it.map(_e=>a.jsx(ut,{value:_e,children:_e},_e))]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Sort By"}),a.jsxs(In,{value:y,onValueChange:_e=>b(_e),children:[a.jsx(An,{className:"h-8 text-xs",children:a.jsx($n,{})}),a.jsxs(En,{children:[a.jsx(ut,{value:"name",children:"Name"}),a.jsx(ut,{value:"id",children:"ID"}),a.jsx(ut,{value:"servers",children:"# Servers"}),a.jsx(ut,{value:"evalRules",children:"# Eval Rules"}),a.jsx(ut,{value:"extractRules",children:"# Extract Rules"})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Direction"}),a.jsxs(In,{value:S,onValueChange:_e=>N(_e),children:[a.jsx(An,{className:"h-8 w-28 text-xs",children:a.jsx($n,{})}),a.jsxs(En,{children:[a.jsx(ut,{value:"asc",children:"Ascending"}),a.jsx(ut,{value:"desc",children:"Descending"})]})]})]})]}),a.jsx(Qe,{children:a.jsxs(Je,{className:"space-y-3 pt-6",children:[a.jsxs("div",{className:"text-xs text-muted-foreground",children:["Showing ",kt.length," of ",o.length," test case",o.length!==1?"s":"","."]}),re&&!ye&&a.jsxs("div",{className:"rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:["Test case ",a.jsx("code",{className:"font-mono",children:re})," was not found."]}),o.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No library test cases yet."}):kt.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No test cases match the current filters."}):a.jsx("div",{className:"grid gap-3",children:kt.map(_e=>{const Ee=re===_e.id,Ze=`/libraries/test-cases/${encodeURIComponent(_e.id)}`,pt=tt(_e.serverIds);return a.jsx("div",{className:`rounded-lg border p-3 ${Ee?"border-primary bg-primary/5":""}`,children:a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"space-y-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(At,{to:Ze,className:"font-medium truncate hover:underline",children:_e.name||_e.id}),a.jsx(et,{variant:"outline",className:"font-mono text-[10px]",children:_e.id}),Ee&&a.jsx(et,{children:"Selected"})]}),a.jsxs("div",{className:"text-xs text-muted-foreground flex flex-wrap gap-x-3 gap-y-1",children:[a.jsxs("span",{children:[pt.length," server",pt.length!==1?"s":""]}),a.jsxs("span",{children:[_e.evalRules.length," eval rule",_e.evalRules.length!==1?"s":""]}),a.jsxs("span",{children:[_e.extractRules.length," extract rule",_e.extractRules.length!==1?"s":""]})]}),pt.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1",children:pt.map(Lt=>a.jsx(et,{variant:"secondary",className:"text-[10px]",children:Lt},`${_e.id}-${Lt}`))})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>T(_e),children:[a.jsx(Ga,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{Se(_e)},children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Duplicate"]}),a.jsx(Z,{type:"button",size:"sm",variant:Ee?"default":"outline",asChild:!0,children:a.jsxs(At,{to:Ze,children:[a.jsx(Zf,{className:"mr-1.5 h-3.5 w-3.5"}),"Edit"]})})]})]})},_e.id)})})]})})]}),ye&&A?a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs(Dt,{className:"text-base",children:["Edit Test Case ·"," ",a.jsx("code",{className:"font-mono text-muted-foreground",children:ye.id})]}),a.jsx(et,{variant:"outline",className:`text-[10px] ${P==="saving"?"border-amber-300 text-amber-700":P==="saved"?"border-emerald-300 text-emerald-700":P==="error"?"border-destructive/40 text-destructive":P==="dirty"?"border-sky-300 text-sky-700":""}`,children:P==="saving"?"Saving...":P==="saved"?"Saved":P==="error"?"Save failed":P==="dirty"?"Unsaved changes":"Ready"})]}),P==="error"&&D&&a.jsx("div",{className:"text-[11px] text-destructive",children:D})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{Se(A,!0)},children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Duplicate"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>T(A),children:[a.jsx(Ga,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete"]})]})]})}),a.jsx(Je,{className:"pt-3",children:a.jsx(VN,{scenarios:[A],agents:c,servers:d,defaultAssistantAgentName:Ye,assistantInitialPromptByScenarioId:q&&A?.id?{[A.id]:q}:void 0,assistantAutoOpenNonceByScenarioId:A?.id&&Y?{[A.id]:Y}:void 0,onChange:_e=>{const Ee=_e[0];Ee&&(E(Ee),De(Ee))},allowAdd:!1})})]}):null,a.jsx(Ps,{open:!!I,onOpenChange:_e=>!_e&&T(null),children:a.jsxs(Qa,{children:[a.jsxs(Ja,{children:[a.jsx(es,{children:"Delete test case?"}),a.jsxs(ts,{children:["This will permanently remove"," ",a.jsx("span",{className:"font-medium",children:I?.name||I?.id})," ","from the library. This action cannot be undone."]})]}),a.jsxs(Za,{children:[a.jsx(rs,{children:"Cancel"}),a.jsx(ns,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{I&&(at(I),T(null))},children:"Delete Test Case"})]})]})})]})},Jbe=()=>{const{source:e}=Dn(),{agents:t,reload:n,loading:r}=Ts(),[s,o]=h.useState(!1),[i,c]=h.useState(!1),[d,f]=h.useState(""),[m,p]=h.useState(""),[v,x]=h.useState("1"),j=h.useMemo(()=>d||t[0]?.name||"",[d,t]),y=h.useCallback(async()=>{o(!0);try{const k=await e.getWorkspaceSettings();f(k?.scenarioAssistantAgentName??""),p(k?.evaluationJudgeAgentName??""),x(String(k?.defaultQueueWorkers??1))}catch(k){f(""),p(""),x("1"),Me({title:"Could not load settings",description:k instanceof Error?k.message:String(k),variant:"destructive"})}finally{o(!1)}},[e]);h.useEffect(()=>{y()},[y]);const b=async k=>{const A=d;f(k),c(!0);try{await e.updateWorkspaceSettings({scenarioAssistantAgentName:k||void 0}),Me({title:"Settings updated",description:k?`Default assistant agent set to ${k}.`:"Default assistant agent cleared (will use first available agent by default)."})}catch(E){f(A),Me({title:"Could not save settings",description:E instanceof Error?E.message:String(E),variant:"destructive"})}finally{c(!1)}},S=async k=>{const A=v;x(k),c(!0);try{await e.updateWorkspaceSettings({defaultQueueWorkers:Number(k)}),Me({title:"Settings updated",description:`Evaluation workers set to ${k}.`})}catch(E){x(A),Me({title:"Could not save settings",description:E instanceof Error?E.message:String(E),variant:"destructive"})}finally{c(!1)}},N=async k=>{const A=m;p(k),c(!0);try{await e.updateWorkspaceSettings({evaluationJudgeAgentName:k||void 0}),Me({title:"Settings updated",description:k?`Default evaluation judge set to ${k}.`:"Default evaluation judge cleared."})}catch(E){p(A),Me({title:"Could not save settings",description:E instanceof Error?E.message:String(E),variant:"destructive"})}finally{c(!1)}},C=async()=>{await Promise.all([n(),y()])};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(hC,{className:"h-6 w-6"}),"Settings"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Workspace-level MCP Lab settings and defaults."})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{C()},disabled:r||s,children:[a.jsx(Ka,{className:"mr-2 h-4 w-4"}),"Refresh"]})]}),a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:"Assistant Defaults"}),a.jsx(Mr,{children:"Default assistant agent used across assistant flows. If unset, MCP Lab uses the first available agent automatically."})]}),a.jsxs(Je,{className:"grid gap-3 md:grid-cols-[1.3fr_auto] md:items-end",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Default Assistant Agent"}),a.jsxs(In,{value:j||"__none__",onValueChange:k=>{b(k==="__none__"?"":k)},disabled:i,children:[a.jsx(An,{className:"h-9 text-sm",children:a.jsx($n,{placeholder:"Select assistant agent"})}),a.jsxs(En,{children:[a.jsx(ut,{value:"__none__",children:"None (use first agent)"}),t.map(k=>a.jsxs(ut,{value:k.id,children:[k.name||k.id," · ",k.model]},k.id))]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Applies to the assistant flows that use the workspace default. MCP Evaluation editors can still override the assistant agent from their evaluation context."})]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"Saved in workspace settings"})]})]}),a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:"Evaluation Judge"}),a.jsx(Mr,{children:"Default judge agent used by semantic agent checks during scenario evaluation runs."})]}),a.jsxs(Je,{className:"grid gap-3 md:grid-cols-[1.3fr_auto] md:items-end",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Default Evaluation Judge"}),a.jsxs(In,{value:m||"__none__",onValueChange:k=>{N(k==="__none__"?"":k)},disabled:i,children:[a.jsx(An,{className:"h-9 text-sm",children:a.jsx($n,{placeholder:"Select evaluation judge"})}),a.jsxs(En,{children:[a.jsx(ut,{value:"__none__",children:"None"}),t.map(k=>a.jsxs(ut,{value:k.id,children:[k.name||k.id," · ",k.model]},k.id))]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Used by agent checks that semantically evaluate the final answer. If unset, runs with agent checks will fail before execution."})]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"Saved in workspace settings"})]})]}),a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:"Evaluation Queue"}),a.jsx(Mr,{children:"Control how many queued evaluation runs may execute in parallel."})]}),a.jsxs(Je,{className:"grid gap-3 md:grid-cols-[1.3fr_auto] md:items-end",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(He,{className:"text-xs",children:"Evaluation workers"}),a.jsxs(In,{value:v,onValueChange:k=>{S(k)},disabled:i,children:[a.jsx(An,{className:"h-9 text-sm",children:a.jsx($n,{placeholder:"Select worker count"})}),a.jsx(En,{children:Array.from({length:8},(k,A)=>String(A+1)).map(k=>a.jsx(ut,{value:k,children:k},k))})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Number of queued evaluation runs that may execute in parallel."})]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"Saved in workspace settings"})]})]})]})},Zbe=Bl("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",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),yl=h.forwardRef(({className:e,variant:t,...n},r)=>a.jsx("div",{ref:r,role:"alert",className:$e(Zbe({variant:t}),e),...n}));yl.displayName="Alert";const bl=h.forwardRef(({className:e,...t},n)=>a.jsx("h5",{ref:n,className:$e("mb-1 font-medium leading-none tracking-tight",e),...t}));bl.displayName="AlertTitle";const wl=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:$e("text-sm [&_p]:leading-relaxed",e),...t}));wl.displayName="AlertDescription";const e0e="127.0.0.1",t0e=3011,n0e="/mcp",r0e=`http://${e0e}:${t0e}${n0e}`;function a0e(e){return navigator.clipboard.writeText(e)}function nU({text:e,label:t}){const[n,r]=h.useState(!1),s=async()=>{try{await a0e(e),r(!0),Me({title:"Copied",description:`${t} copied to clipboard.`}),window.setTimeout(()=>r(!1),1500)}catch(o){Me({title:"Copy failed",description:o instanceof Error?o.message:String(o),variant:"destructive"})}};return a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{s()},children:[a.jsx(Hr,{className:"mr-2 h-3.5 w-3.5"}),n?"Copied":"Copy"]})}function AS({label:e,value:t,copyText:n,valueClassName:r=""}){return a.jsx("div",{className:"rounded-lg border bg-muted/20 p-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:e}),a.jsx("div",{className:`mt-1 break-all text-sm font-medium ${r}`,children:t})]}),n&&a.jsx(nU,{text:n,label:e})]})})}function bD({title:e,description:t,code:n,iconSrc:r}){return a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsxs(Dt,{className:"flex items-center gap-2 text-base",children:[a.jsx("img",{src:r,alt:"","aria-hidden":"true",className:"h-4 w-4"}),e]}),a.jsx(Mr,{children:t})]}),a.jsxs(Je,{className:"space-y-3",children:[a.jsx("pre",{className:"max-h-80 overflow-auto rounded-lg border bg-muted/30 p-3 text-xs whitespace-pre-wrap break-all",children:n}),a.jsx("div",{className:"flex justify-end",children:a.jsx(nU,{text:n,label:e})})]})]})}const s0e=()=>{const{source:e}=Dn(),[t,n]=h.useState(!0),[r,s]=h.useState(null),o=h.useCallback(async()=>{n(!0);try{const p=await e.health();s(p)}catch(p){s(null),Me({title:"Could not load MCP connection info",description:p instanceof Error?p.message:String(p),variant:"destructive"})}finally{n(!1)}},[e]);h.useEffect(()=>{o()},[o]);const i=r?.mcp?.enabled?r.mcp:null,c=i?.directUrl??r0e,d=i?.transport??"streamable-http",f=h.useMemo(()=>JSON.stringify({mcpServers:{mcplab:{command:"npx",args:["mcp-remote",c]}}},null,2),[c]),m=h.useMemo(()=>JSON.stringify({name:"mcplab",transport:d,url:c},null,2),[c,d]);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(VS,{className:"h-6 w-6"}),"MCP Connection Info"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Copy the local MCPLab MCP server details into Claude Desktop or any MCP-capable client."})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{o()},disabled:t,children:[a.jsx(Ka,{className:"mr-2 h-4 w-4"}),"Refresh"]})]}),!i&&a.jsxs(yl,{children:[a.jsx(VS,{className:"h-4 w-4"}),a.jsx(bl,{children:"MCP server not reported"}),a.jsx(wl,{children:"The page is showing the default local connection details. Start MCP Lab in dev mode to see the live runtime endpoint and package version."})]}),a.jsxs("div",{className:"grid gap-6 xl:grid-cols-[1.1fr_0.9fr]",children:[a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:"Connection Details"}),a.jsx(Mr,{children:"The local server is exposed over streamable HTTP."})]}),a.jsx(Je,{className:"space-y-3",children:a.jsxs("div",{className:"grid gap-3",children:[a.jsx(AS,{label:"Direct MCP URL",value:c,copyText:c}),a.jsx(AS,{label:"Transport",value:d}),a.jsx(AS,{label:"Authentication",value:"none"})]})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(bD,{title:"Claude Desktop",description:"Use mcp-remote to bridge Claude Desktop to the local streamable HTTP MCP server.",code:f,iconSrc:"/icons/claude-color.svg"}),a.jsx(bD,{title:"OpenAI / MCP-capable client",description:"Use this endpoint block in any client or adapter that accepts a single MCP-over-HTTP server.",code:m,iconSrc:"/icons/openai.svg"})]})]})]})};function o0e(e,t=[]){let n=[];function r(o,i){const c=h.createContext(i);c.displayName=o+"Context";const d=n.length;n=[...n,i];const f=p=>{const{scope:v,children:x,...j}=p,y=v?.[e]?.[d]||c,b=h.useMemo(()=>j,Object.values(j));return a.jsx(y.Provider,{value:b,children:x})};f.displayName=o+"Provider";function m(p,v){const x=v?.[e]?.[d]||c,j=h.useContext(x);if(j)return j;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[f,m]}const s=()=>{const o=n.map(i=>h.createContext(i));return function(c){const d=c?.[e]||o;return h.useMemo(()=>({[`__scope${e}`]:{...c,[e]:d}}),[c,d])}};return s.scopeName=e,[r,i0e(s,...t)]}function i0e(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((c,{useScope:d,scopeName:f})=>{const p=d(o)[`__scope${f}`];return{...c,...p}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var l0e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],rU=l0e.reduce((e,t)=>{const n=nv(`Primitive.${t}`),r=h.forwardRef((s,o)=>{const{asChild:i,...c}=s,d=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),pk="Progress",hk=100,[c0e]=o0e(pk),[u0e,d0e]=c0e(pk),aU=h.forwardRef((e,t)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:o=f0e,...i}=e;(s||s===0)&&!wD(s)&&console.error(p0e(`${s}`,"Progress"));const c=wD(s)?s:hk;r!==null&&!jD(r,c)&&console.error(h0e(`${r}`,"Progress"));const d=jD(r,c)?r:null,f=Rg(d)?o(d,c):void 0;return a.jsx(u0e,{scope:n,value:d,max:c,children:a.jsx(rU.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":Rg(d)?d:void 0,"aria-valuetext":f,role:"progressbar","data-state":iU(d,c),"data-value":d??void 0,"data-max":c,...i,ref:t})})});aU.displayName=pk;var sU="ProgressIndicator",oU=h.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,s=d0e(sU,n);return a.jsx(rU.div,{"data-state":iU(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:t})});oU.displayName=sU;function f0e(e,t){return`${Math.round(e/t*100)}%`}function iU(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Rg(e){return typeof e=="number"}function wD(e){return Rg(e)&&!isNaN(e)&&e>0}function jD(e,t){return Rg(e)&&!isNaN(e)&&e<=t&&e>=0}function p0e(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${hk}\`.`}function h0e(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
140
+ - a positive number
141
+ - less than the value passed to \`max\` (or ${hk} if no \`max\` prop is set)
142
+ - \`null\` or \`undefined\` if the progress is indeterminate.
143
+
144
+ Defaulting to \`null\`.`}var lU=aU,m0e=oU;const fx=h.forwardRef(({className:e,value:t,...n},r)=>a.jsx(lU,{ref:r,className:$e("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:a.jsx(m0e,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));fx.displayName=lU.displayName;function cU(e){const t=e.toLowerCase();return t.includes("side-effectful prefix")||t.includes("destructive behavior")||t.includes("destructivehint")||t.includes("non-read-only behavior")||t.includes("readonlyhint: false")||t.includes("additive behavior")}function Tg(e){try{return JSON.stringify(e,null,2)}catch{return"[schema not serializable]"}}function g0e(e){return typeof e.type=="string"?e.type:Array.isArray(e.type)?e.type.join(" | "):e.properties&&typeof e.properties=="object"?"object":e.items&&typeof e.items=="object"?"array":"any"}function nf(e,t=new Set){if(!e||typeof e!="object"||Array.isArray(e))return 0;const n=e;if(t.has(n))return 0;const r=new Set(t);r.add(n);const s=n.properties&&typeof n.properties=="object"&&!Array.isArray(n.properties)?n.properties:void 0,o=s?Object.values(s).reduce((d,f)=>d+nf(f,r),0):0,i=nf(n.items,r),c=[...Array.isArray(n.oneOf)?n.oneOf:[],...Array.isArray(n.anyOf)?n.anyOf:[]].reduce((d,f)=>d+nf(f,r),0);return(s?Object.keys(s).length:0)+o+i+c}function rf({name:e,schema:t,required:n=!1,depth:r=0,seen:s=new Set,expandAll:o=null}){const[i,c]=h.useState(r===0);if(h.useEffect(()=>{o!==null&&c(o)},[o]),!t||typeof t!="object"||Array.isArray(t))return a.jsx("div",{className:"text-xs",children:e});const d=t;if(s.has(d))return a.jsxs("div",{className:"text-xs text-muted-foreground",children:[e," (circular)"]});const f=new Set(s);f.add(d);const m=d.properties&&typeof d.properties=="object"&&!Array.isArray(d.properties)?d.properties:void 0,p=new Set(Array.isArray(d.required)?d.required.filter(y=>typeof y=="string"):[]),v=d.items&&typeof d.items=="object"?d.items:void 0,x=[...Array.isArray(d.oneOf)?d.oneOf:[],...Array.isArray(d.anyOf)?d.anyOf:[]],j=m&&Object.keys(m).length>0||!!v||x.length>0;return a.jsxs("div",{className:"min-w-0 space-y-1",style:{marginLeft:r*12},children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5 text-xs",children:[j?a.jsxs("button",{type:"button",className:"inline-flex min-w-0 max-w-full items-center gap-1 text-left font-medium hover:underline","aria-label":`${i?"Collapse":"Expand"} ${e}`,"aria-expanded":i,onClick:()=>c(y=>!y),children:[i?a.jsx(en,{className:"h-3 w-3 shrink-0"}):a.jsx(Fg,{className:"h-3 w-3 shrink-0"}),a.jsx("span",{className:"break-words",children:e})]}):a.jsx("span",{className:"break-words font-medium",children:e}),a.jsx(et,{variant:"outline",className:"text-[10px]",children:g0e(d)}),n&&a.jsx("span",{className:"text-[10px] text-rose-600",children:"required"})]}),typeof d.description=="string"&&a.jsx("div",{className:"max-w-full break-words text-[11px] text-muted-foreground",children:d.description}),Array.isArray(d.enum)&&a.jsxs("div",{className:"max-w-full break-words text-[11px] text-muted-foreground",children:["Enum: ",d.enum.map(y=>String(y)).join(", ")]}),d.default!==void 0&&a.jsxs("div",{className:"max-w-full break-words text-[11px] text-muted-foreground",children:["Default: ",Tg(d.default)]}),i&&j&&a.jsxs("div",{className:"min-w-0 space-y-2 border-l pl-2",children:[m&&Object.keys(m).length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"text-[11px] font-medium text-muted-foreground",children:"Properties"}),Object.entries(m).map(([y,b])=>a.jsx(rf,{name:y,schema:b,required:p.has(y),depth:r+1,seen:f,expandAll:o},y))]}),v&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-[11px] font-medium text-muted-foreground",children:"Items"}),a.jsx(rf,{name:"item",schema:v,depth:r+1,seen:f,expandAll:o})]}),x.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"text-[11px] font-medium text-muted-foreground",children:"Variants"}),x.map((y,b)=>a.jsx(rf,{name:`variant ${b+1}`,schema:y,depth:r+1,seen:f,expandAll:o},b))]})]})]})}function SD({propertyCount:e,onExpandAll:t,onCollapseAll:n}){return a.jsxs("span",{className:"flex flex-wrap items-center gap-1",children:[a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e," Properties"]}),a.jsx("button",{type:"button",className:"rounded border px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground",onClick:t,children:"Expand All"}),a.jsx("button",{type:"button",className:"rounded border px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground",onClick:n,children:"Collapse All"})]})}function Zh({title:e,schema:t,explorerControls:n}){const r=e.toLowerCase(),s=async()=>{try{await navigator.clipboard.writeText(Tg(t)),Me({title:`${e} copied`})}catch(o){Me({title:`Could not copy ${e.toLowerCase()}`,description:o instanceof Error?o.message:String(o),variant:"destructive"})}};return a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:[a.jsx("div",{className:"text-[11px] font-medium text-muted-foreground",children:e}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-1.5",children:[n,a.jsxs("button",{type:"button",className:"inline-flex shrink-0 items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":`Copy ${r} JSON`,title:`Copy ${r} JSON`,onClick:()=>{s()},children:[a.jsx(Hr,{className:"h-3 w-3"}),"Copy JSON"]})]})]})}function uU({inputSchema:e,outputSchema:t,mode:n,onModeChange:r}){const[s,o]=h.useState("explorer"),[i,c]=h.useState(null),[d,f]=h.useState(null),m=n??s,p=v=>{r?.(v),n||o(v)};return e===void 0&&t===void 0?null:a.jsxs("details",{className:"group/schema min-w-0 max-w-full overflow-hidden rounded border bg-muted/10 p-2",onClick:v=>v.stopPropagation(),children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-2 text-xs font-medium",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:["Schemas",e!==void 0&&a.jsx(et,{variant:"outline",className:"border-border text-[10px] text-muted-foreground",children:"input"}),t!==void 0&&a.jsx(et,{variant:"outline",className:"border-border text-[10px] text-muted-foreground",children:"output"})]}),a.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[a.jsx("span",{className:"inline-flex rounded-md border bg-muted p-0.5",role:"tablist","aria-label":"Schema view mode",children:["json","explorer"].map(v=>a.jsx("button",{type:"button",role:"tab","aria-selected":m===v,className:"rounded px-2 py-0.5 text-[11px] font-medium capitalize data-[active=true]:bg-background data-[active=true]:shadow-sm","data-active":m===v,onClick:x=>{x.preventDefault(),x.stopPropagation(),p(v)},children:v.toUpperCase()},v))}),a.jsx(en,{className:"h-4 w-4 text-muted-foreground transition-transform group-open/schema:rotate-180"})]})]}),a.jsxs("div",{className:"mt-2",children:[m==="json"&&a.jsxs("div",{className:"mt-2 space-y-2",children:[e!==void 0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx(Zh,{title:"Input schema",schema:e}),a.jsx("pre",{className:"max-h-52 max-w-full overflow-auto whitespace-pre-wrap break-words rounded border bg-muted/20 p-2 text-[11px]",children:Tg(e)})]}),t!==void 0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx(Zh,{title:"Output schema",schema:t}),a.jsx("pre",{className:"max-h-52 max-w-full overflow-auto whitespace-pre-wrap break-words rounded border bg-muted/20 p-2 text-[11px]",children:Tg(t)})]})]}),m==="explorer"&&a.jsxs("div",{className:"mt-2 min-w-0 space-y-2",children:[e!==void 0&&a.jsxs("div",{className:"min-w-0 space-y-2 rounded border bg-muted/10 p-2",children:[a.jsx(Zh,{title:"Input schema",schema:e,explorerControls:a.jsx(SD,{propertyCount:nf(e),onExpandAll:()=>c(!0),onCollapseAll:()=>c(!1)})}),a.jsx(rf,{name:"root",schema:e,expandAll:i})]}),t!==void 0&&a.jsxs("div",{className:"min-w-0 space-y-2 rounded border bg-muted/10 p-2",children:[a.jsx(Zh,{title:"Output schema",schema:t,explorerControls:a.jsx(SD,{propertyCount:nf(t),onExpandAll:()=>f(!0),onCollapseAll:()=>f(!1)})}),a.jsx(rf,{name:"root",schema:t,expandAll:d})]})]})]})]})}const al=["critical","high","medium","low","info"];function em(e){switch(e){case"critical":return"border-red-300 bg-red-100 text-red-900";case"high":return"border-orange-300 bg-orange-100 text-orange-900";case"medium":return"border-amber-300 bg-amber-100 text-amber-900";case"low":return"border-sky-300 bg-sky-100 text-sky-900";default:return"border-slate-300 bg-slate-100 text-slate-800"}}function v0e(e){switch(e){case"critical":return"border-red-300 bg-background text-red-900";case"high":return"border-orange-300 bg-background text-orange-900";case"medium":return"border-amber-300 bg-background text-amber-900";case"low":return"border-sky-300 bg-background text-sky-900";default:return"border-slate-300 bg-background text-slate-800"}}function ND(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"tool"}async function ES(e,t){const n=typeof t=="string"?t:JSON.stringify(t,null,2);try{await navigator.clipboard.writeText(n),Me({title:`${e} copied`})}catch(r){Me({title:`Could not copy ${e.toLowerCase()}`,description:r instanceof Error?r.message:String(r),variant:"destructive"})}}function PS({text:e}){return a.jsxs("div",{className:"mt-2 rounded-md border px-2.5 py-2 text-[11px] text-slate-800",children:[a.jsxs("div",{className:"mb-1 inline-flex items-center gap-1 font-medium text-slate-700",children:[a.jsx(NW,{className:"h-3.5 w-3.5"}),"Suggested improvement"]}),a.jsx("p",{children:e})]})}function x0e({label:e,reason:t,variantClassName:n}){return a.jsx(Ro,{delayDuration:0,children:a.jsxs(To,{children:[a.jsx(Oo,{asChild:!0,children:a.jsx(et,{variant:"outline",className:n,children:e})}),a.jsx(Gs,{className:"max-w-sm text-xs",children:a.jsx("p",{children:t})})]})})}function mk(e){const t=[],n=(r,s)=>{t.push(`#### ${r}`),t.push("```json");try{t.push(JSON.stringify(s,null,2))}catch{t.push('"[schema not serializable]"')}t.push("```")};if(t.push("# MCP Tool Analysis Report",""),t.push(`- Created: ${e.createdAt}`),t.push(`- Assistant Agent: ${e.assistantAgentName}`),t.push(`- Assistant Model: ${e.assistantAgentModel}`),e.mcpServerVersions&&Object.keys(e.mcpServerVersions).length>0){const r=Object.entries(e.mcpServerVersions).map(([s,o])=>`${s}: ${o??"unknown"}`).join(", ");t.push(`- MCP Server Versions: ${r}`)}t.push(`- Modes: ${[e.modes.metadataReview?"metadata review":null,e.modes.deeperAnalysis?"deeper analysis":null].filter(Boolean).join(" + ")}`),t.push("","## Summary"),t.push(`- Servers analyzed: ${e.summary.serversAnalyzed}`),t.push(`- Tools analyzed: ${e.summary.toolsAnalyzed}`),t.push(`- Tools skipped: ${e.summary.toolsSkipped}`,"");for(const r of e.servers){t.push(`## Server: ${r.serverName}`),r.warnings.length>0&&t.push(...r.warnings.map(s=>`- Warning: ${s}`),"");for(const s of r.tools){if(t.push(`### ${s.publicToolName}`),s.title&&t.push(`- Title: ${s.title}`),t.push(`- Safety: ${s.safetyClassification} (${s.classificationReason})`),s.inputSchema!==void 0&&n("Input schema",s.inputSchema),s.outputSchema!==void 0&&n("Output schema",s.outputSchema),s.metadataReview?.issues.length){t.push("#### Metadata issues");for(const o of s.metadataReview.issues)t.push(` - [${o.severity}] ${o.title}: ${o.detail}`)}if(s.deeperAnalysis)if(!s.deeperAnalysis.attempted)t.push(`- Deeper analysis: skipped (${s.deeperAnalysis.skippedReason??"unknown"})`);else{t.push(`- Deeper analysis sample calls: ${s.deeperAnalysis.sampleCalls.length}`);for(const o of s.deeperAnalysis.sampleCalls){t.push(` - Call ${o.callIndex}: ${o.ok?"ok":"error"}${o.durationMs?` (${o.durationMs}ms)`:""}`),o.error&&t.push(` - Error: ${o.error}`);for(const i of o.observations)t.push(` - ${i}`)}}if(s.overallRecommendations.length>0){t.push("#### Recommendations");for(const o of s.overallRecommendations)t.push(` - ${o}`)}if(s.metadataReview?.evalReadinessNotes.length){t.push("#### Agent/Eval readiness notes");for(const o of s.metadataReview.evalReadinessNotes)t.push(` - ${o}`)}t.push("")}}return`${t.join(`
145
+ `)}
146
+ `}function dU({report:e,schemaMode:t,onSchemaModeChange:n}){const[r,s]=Fo(),[o,i]=h.useState([...al]),[c,d]=h.useState(new Set),[f,m]=h.useState(""),[p,v]=h.useState(!1),[x,j]=h.useState("explorer"),y=t??x,b=z=>{n?.(z),t||j(z)},S=r.get("groupBy")==="severity"?"severity":"tool",N=h.useRef(null),C=f.trim().toLowerCase(),k=h.useMemo(()=>new Set(o),[o]),A=z=>{i(I=>{const T=I.includes(z)?I.filter(V=>V!==z):[...I,z];return T.length===0?[...al]:T})},E=z=>{const I=new URLSearchParams(r);z==="severity"?I.set("groupBy","severity"):I.delete("groupBy"),s(I,{replace:!0})},P=h.useMemo(()=>{const z={critical:[],high:[],medium:[],low:[],info:[]};for(const I of e.servers)for(const T of I.tools){const V=`tool-${ND(`${I.serverName}-${T.publicToolName}`)}`,H=`${I.serverName}::${T.publicToolName}`,M=T.publicToolName.split("::").pop()??T.publicToolName;for(const X of T.metadataReview?.issues??[]){const $=X.severity;z[$].push({key:`${H}-metadata-${X.id}`,toolAnchorId:V,toolLabel:H,toolDisplayName:M,sourceLabel:"Metadata review",issue:{id:X.id,title:X.title,detail:X.detail,severity:$,suggestion:X.suggestion}})}for(const X of T.deeperAnalysis?.sampleCalls??[])for(const $ of X.issues){const F=$.severity;z[F].push({key:`${H}-call-${X.callIndex}-${$.id}`,toolAnchorId:V,toolLabel:H,toolDisplayName:M,sourceLabel:`Sample call ${X.callIndex}`,issue:{id:$.id,title:$.title,detail:$.detail,severity:F,suggestion:$.suggestion}})}}return z},[e.servers]),O=h.useMemo(()=>Array.from(new Set(e.servers.flatMap(z=>z.tools.map(I=>I.publicToolName)).map(z=>z.split("::").pop()??z))).sort((z,I)=>z.localeCompare(I)),[e.servers]),D=z=>C.length===0?!0:(z.toLowerCase().split("::").pop()??z.toLowerCase()).includes(C),K=z=>{if(!N.current)return;N.current.querySelectorAll("details").forEach(T=>{T.open=z})},q=()=>d(new Set(al)),B=()=>d(new Set),Y=z=>{d(I=>{const T=new Set(I);return T.has(z)?T.delete(z):T.add(z),T})};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-6",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Tools analyzed"}),a.jsx("div",{className:"text-2xl font-semibold",children:e.summary.toolsAnalyzed})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-6",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Tools skipped"}),a.jsx("div",{className:"text-2xl font-semibold",children:e.summary.toolsSkipped})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-6",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Findings"}),a.jsx("div",{className:"text-2xl font-semibold",children:e.findings.length})]})})]}),a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:"Analysis Overview"}),a.jsx(Mr,{children:"Visual breakdown of findings by severity. Click badges to filter the report."})]}),a.jsx(Je,{children:a.jsxs("div",{className:"flex flex-wrap gap-2",children:[al.filter(z=>e.summary.issueCounts[z]>0).map(z=>{const I=k.has(z);return a.jsx("button",{type:"button",onClick:()=>A(z),className:"rounded-full","aria-pressed":I,children:a.jsxs(et,{variant:"outline",className:`capitalize font-normal ${I?em(z):v0e(z)} ${I?"ring-1 ring-current":"opacity-70"}`,children:[z,": ",e.summary.issueCounts[z]]})},z)}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>i([...al]),className:"h-7 px-2 text-xs",children:"Reset"})]})})]}),a.jsxs("div",{className:"space-y-0",children:[a.jsx(rx,{value:S,onValueChange:z=>{(z==="tool"||z==="severity")&&E(z)},className:"min-w-0 px-3 pt-1",children:a.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-2 border-b",children:[a.jsxs(Cp,{className:"h-auto justify-start rounded-none bg-transparent p-0",children:[a.jsx(Vs,{value:"tool",className:"-mb-px h-10 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-6 text-sm font-semibold text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"Report by Tool"}),a.jsx(Vs,{value:"severity",className:"-mb-px h-10 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-6 text-sm font-semibold text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"By Severity"})]}),a.jsxs("div",{className:"mb-2 flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"whitespace-nowrap text-xs text-muted-foreground",children:"Filter tools"}),a.jsxs(wi,{open:p,onOpenChange:v,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":p,"aria-controls":"tool-filter-command-list",className:"h-8 w-[320px] max-w-full justify-between text-xs font-normal",children:[a.jsx("span",{className:"truncate text-left",children:f||"All tools"}),a.jsx(en,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(ko,{className:"w-[320px] p-0",align:"end",children:a.jsxs(Ml,{children:[a.jsx(Il,{placeholder:"Search tools..."}),a.jsxs($l,{id:"tool-filter-command-list",children:[a.jsx(Dl,{children:"No tools found."}),a.jsxs(Ll,{children:[a.jsx(Na,{value:"all tools",onSelect:()=>{m(""),v(!1)},children:"All tools"}),O.map(z=>a.jsx(Na,{value:z,onSelect:()=>{m(z),v(!1)},children:z},z))]})]})]})})]}),S==="severity"&&a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:B,children:"Expand all"}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:q,children:"Collapse all"})]}),S==="tool"&&a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>K(!0),children:"Expand all"}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>K(!1),children:"Collapse all"})]})]})]})}),S==="severity"?a.jsx("div",{className:"space-y-4",children:al.filter(z=>k.has(z)).map(z=>{const I=P[z].filter(V=>D(V.toolLabel));if(I.length===0)return null;const T=c.has(z);return a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"text-base capitalize",children:z}),a.jsxs(Mr,{children:[I.length," finding(s)"]})]}),a.jsx("div",{className:"flex gap-2",children:a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>Y(z),children:T?"Expand":"Collapse"})})]})}),!T&&a.jsx(Je,{className:"space-y-2",children:I.map((V,H)=>a.jsxs("div",{className:"rounded border p-2 text-xs",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full border bg-muted px-1 text-[10px] font-semibold text-muted-foreground",children:H+1}),a.jsx("span",{className:"min-w-0 font-bold leading-tight",children:V.issue.title})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${em(V.issue.severity)}`,children:V.issue.severity})]}),a.jsxs("p",{children:[a.jsx("span",{className:"font-bold",children:"Finding:"})," ",V.issue.detail]}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-[11px]",children:[a.jsx(et,{variant:"secondary",className:"font-normal",children:V.sourceLabel}),a.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 font-mono text-[11px]",title:V.toolLabel,onClick:()=>{E("tool"),requestAnimationFrame(()=>{document.getElementById(V.toolAnchorId)?.scrollIntoView({behavior:"smooth",block:"start"})})},children:V.toolDisplayName})]}),V.issue.suggestion&&a.jsx(PS,{text:V.issue.suggestion})]},V.key))})]},z)})}):a.jsx("div",{ref:N,className:"space-y-4",children:e.servers.map(z=>{const I=z.tools.filter(T=>{const V=`${z.serverName}::${T.publicToolName}`;if(!D(V))return!1;const H=[...T.metadataReview?.issues??[],...T.deeperAnalysis?.sampleCalls.flatMap(M=>M.issues)??[]];return H.length===0?o.length===al.length:H.some(M=>k.has(M.severity))});return I.length===0?null:a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:z.serverName}),a.jsxs(Mr,{children:["Discovered ",z.toolCountDiscovered," · Showing ",I.length," of"," ",z.toolCountAnalyzed," analyzed · Skipped ",z.toolCountSkipped]})]}),a.jsxs(Je,{className:"space-y-3",children:[z.warnings.length>0&&a.jsxs(yl,{children:[a.jsx(bl,{children:"Warnings"}),a.jsx(wl,{children:a.jsx("ul",{className:"ml-4 list-disc space-y-1",children:z.warnings.map(T=>a.jsx("li",{children:T},`${z.serverName}-${T}`))})})]}),I.map(T=>{const V=T.publicToolName.split("::").pop()??T.publicToolName,H=cU(T.classificationReason),M=T.safetyClassification==="read_only"?"read-only":H?"write/delete":"unsafe/unknown",X=T.safetyClassification==="read_only"?"border-emerald-200 bg-emerald-50 text-emerald-700":H?"border-amber-300 bg-amber-50 text-amber-800":"border-slate-300 bg-slate-100 text-slate-700";return a.jsxs("details",{id:`tool-${ND(`${z.serverName}-${T.publicToolName}`)}`,className:"group rounded-md border p-3",children:[a.jsx("summary",{className:"cursor-pointer list-none",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("div",{className:"min-w-0 truncate font-mono text-sm",title:T.publicToolName,children:V}),a.jsx(x0e,{label:M,reason:T.classificationReason,variantClassName:X})]}),a.jsx(en,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),T.title&&a.jsx("p",{className:"text-sm text-foreground/85",children:T.title}),T.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:T.description})]})}),a.jsxs("div",{className:"mt-3 space-y-2",children:[a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-[11px]",onClick:()=>{ES("Tool info",{server:z.serverName,name:T.publicToolName,title:T.title,description:T.description})},children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy Tool Info"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-[11px]",onClick:()=>{ES("Schemas",{server:z.serverName,name:T.publicToolName,inputSchema:T.inputSchema,outputSchema:T.outputSchema})},disabled:T.inputSchema===void 0&&T.outputSchema===void 0,children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy Schemas"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-[11px]",onClick:()=>{ES("Metadata review",{server:z.serverName,name:T.publicToolName,metadataReview:T.metadataReview})},disabled:!T.metadataReview,children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy Metadata Review"]})]}),a.jsx(uU,{inputSchema:T.inputSchema,outputSchema:T.outputSchema,mode:y,onModeChange:b}),T.metadataReview&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-medium",children:"Metadata review"}),T.metadataReview.issues.filter($=>k.has($.severity)).length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No metadata issues reported."}):a.jsx("div",{className:"space-y-1",children:T.metadataReview.issues.filter($=>k.has($.severity)).map(($,F)=>a.jsxs("div",{className:"rounded border p-2 text-xs",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full border bg-muted px-1 text-[10px] font-semibold text-muted-foreground",children:F+1}),a.jsx("span",{className:"min-w-0 font-bold leading-tight",children:$.title})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${em($.severity)}`,children:$.severity})]}),a.jsxs("p",{children:[a.jsx("span",{className:"font-bold",children:"Finding:"})," ",$.detail]}),$.suggestion&&a.jsx(PS,{text:$.suggestion})]},$.id))})]}),T.deeperAnalysis&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-medium",children:"Deeper analysis"}),T.deeperAnalysis.attempted?a.jsx("div",{className:"space-y-2",children:T.deeperAnalysis.sampleCalls.map($=>a.jsxs("div",{className:"rounded border p-2 text-xs",children:[a.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[a.jsx(et,{variant:$.ok?"secondary":"destructive",className:"text-[10px]",children:$.ok?"ok":"error"}),a.jsxs("span",{children:["Call ",$.callIndex]}),$.durationMs!==void 0&&a.jsxs("span",{className:"text-muted-foreground",children:[$.durationMs,"ms"]})]}),$.error&&a.jsx("p",{className:"text-destructive",children:$.error}),$.observations.length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"mb-1 inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:"Observations"}),a.jsx("ul",{className:"ml-4 list-disc space-y-1",children:$.observations.map((F,G)=>a.jsx("li",{children:F},`${T.publicToolName}-obs-${$.callIndex}-${G}`))})]}),$.issues.filter(F=>k.has(F.severity)).length>0&&a.jsx("div",{className:"mt-2 space-y-1",children:$.issues.filter(F=>k.has(F.severity)).map((F,G)=>a.jsxs("div",{className:"rounded border p-2",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full border bg-muted px-1 text-[10px] font-semibold text-muted-foreground",children:G+1}),a.jsx("span",{className:"min-w-0 font-bold leading-tight",children:F.title})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${em(F.severity)}`,children:F.severity})]}),a.jsxs("p",{children:[a.jsx("span",{className:"font-bold",children:"Finding:"})," ",F.detail]}),F.suggestion&&a.jsx(PS,{text:F.suggestion})]},`${$.callIndex}-${F.id}`))})]},`${T.publicToolName}-call-${$.callIndex}`))}):a.jsx("p",{className:"text-xs text-muted-foreground",children:T.deeperAnalysis.skippedReason??"Skipped"})]})]})]},T.publicToolName)})]})]},z.serverName)})})]})]})}function fU(e){return{reportId:e.reportId,createdAt:e.createdAt,tools:e.report.servers.flatMap(t=>t.tools.map(n=>({server:t.serverName,name:n.publicToolName,title:n.title,description:n.description,inputSchema:n.inputSchema,outputSchema:n.outputSchema})))}}function y0e(e){const t=e.selectedToolNames?.length?new Set(e.selectedToolNames):null;return{serverName:e.serverName,tools:e.tools.filter(n=>!t||t.has(n.name)).map(n=>({name:n.name,title:n.title,description:n.description,inputSchema:n.inputSchema,outputSchema:n.outputSchema}))}}function CD(e){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function b0e(e,t){const n=["tool-info",CD(e)],r=t?.trim();return r&&n.push(`v${CD(r)}`),`${n.filter(Boolean).join("-")}.json`}function w0e(e){let t=0;const n=new Set,r=new Set;for(const o of e){const i=typeof o.payload?.message=="string"?o.payload.message:"";if(!i)continue;const c=i.match(/\((\d+)\s+selected\s+of\s+\d+\s+discovered\)/i);c&&(t=Math.max(t,Number(c[1])||0));const d=i.match(/^Started\s+(.+)$/);d&&n.add(d[1]);const f=i.match(/^Finished\s+(.+)$/);f&&r.add(f[1])}const s=t>0?Math.max(0,Math.min(100,Math.round(r.size/t*100))):0;return{totalTools:t,startedTools:n.size,finishedTools:r.size,percent:s}}const RS="mcplab.toolAnalysis.activeJobId";function TS(e,t,n){const r=new Blob([t],{type:n}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=e,o.click(),URL.revokeObjectURL(s)}async function j0e(e,t){try{await navigator.clipboard.writeText(t),Me({title:`${e} copied`})}catch(n){Me({title:`Could not copy ${e.toLowerCase()}`,description:n instanceof Error?n.message:String(n),variant:"destructive"})}}function _D({text:e}){return a.jsxs(To,{children:[a.jsx(Oo,{asChild:!0,children:a.jsx("button",{type:"button",className:"inline-flex h-4 w-4 items-center justify-center rounded text-muted-foreground hover:text-foreground",onClick:t=>t.preventDefault(),"aria-label":e,children:a.jsx(vW,{className:"h-3.5 w-3.5"})})}),a.jsx(Gs,{className:"max-w-xs text-xs",children:a.jsx("p",{children:e})})]})}function S0e(e,t){const n=t.toLowerCase();return n.includes("failed to load tools")||n.includes("failed to connect to mcp server")?`Could not load tools from '${e}'. Check that the MCP server is running and reachable, then try Refresh Servers / Discover Tools again.`:t}function N0e({label:e,reason:t,variantClassName:n}){return a.jsx(Ro,{delayDuration:0,children:a.jsxs(To,{children:[a.jsx(Oo,{asChild:!0,children:a.jsx(et,{variant:"outline",className:n,children:e})}),a.jsx(Gs,{className:"max-w-sm text-xs",children:a.jsx("p",{children:t})})]})})}const C0e=()=>{const e=Re=>`tool-analysis-${Date.now()}.${Re}`,{source:t}=Dn(),{servers:n,agents:r,loading:s,reload:o}=Ts(),[i,c]=h.useState(""),[d,f]=h.useState([]),[m,p]=h.useState(!1),[v,x]=h.useState([]),[j,y]=h.useState({}),[b,S]=h.useState(""),[N,C]=h.useState(!0),[k,A]=h.useState(!1),[E,P]=h.useState(2),[O,D]=h.useState(1),[K,q]=h.useState(1e4),[B,Y]=h.useState(null),[z,I]=h.useState([]),[T,V]=h.useState(null),[H,M]=h.useState(null),[X,$]=h.useState(!1),[F,G]=h.useState("configure"),[re,oe]=h.useState("explorer"),[ue,ae]=h.useState("idle"),[ye,se]=h.useState(!1),de=h.useRef(null),De=h.useRef(null),ge=i||r[0]?.name||"",ve=h.useMemo(()=>w0e(z),[z]);h.useEffect(()=>{let Re=!0;return t.getWorkspaceSettings().then(Be=>{!Re||!Be||c(Be.scenarioAssistantAgentName??"")}).catch(()=>{Re&&c("")}),()=>{Re=!1}},[t]),h.useEffect(()=>()=>{de.current?.()},[]),h.useEffect(()=>{const Re=De.current;Re&&requestAnimationFrame(()=>{Re.scrollTop=Re.scrollHeight})},[z.length]);const Se=()=>{try{sessionStorage.removeItem(RS)}catch{}},at=Re=>{try{sessionStorage.setItem(RS,Re)}catch{}},tt=Re=>{de.current?.(),de.current=t.subscribeToolAnalysisJob(Re,Be=>{if(I(qe=>[...qe,Be]),Be.type==="completed")t.getToolAnalysisResult(Re).then(qe=>{V(qe.report),M(qe.savedReportId??null)}).catch(qe=>Me({title:"Could not load analysis report",description:qe instanceof Error?qe.message:String(qe),variant:"destructive"})).finally(()=>{Se(),Y(null),$(!1),ae("idle"),G("run")});else if(Be.type==="error"){const qe=String(Be.payload?.message??"");Se(),ae(qe.toLowerCase().includes("abort")?"stopped":"error"),Y(null),$(!1)}})};h.useEffect(()=>{if(B||T)return;let Re="";try{Re=sessionStorage.getItem(RS)??""}catch{Re=""}if(Re)return G("run"),ae("running"),$(!0),Y(Re),I([]),tt(Re),()=>{}},[t,B,T]);const it=async()=>{if(d.length===0){x([]),y({});return}const Re=d.filter(Be=>n.find(Bt=>Bt.id===Be)?.authType==="oauth2");try{Re.length>0&&(se(!0),await _o({serverNames:Re,source:t,onServerAuthStart:Be=>{Me({title:`OAuth login required for ${Be}`,description:"Complete login in the opened browser tab. Discovery will continue automatically."})}}))}catch(Be){Me({title:"OAuth login failed",description:Be instanceof Error?Be.message:String(Be),variant:"destructive"}),se(!1);return}finally{se(!1)}p(!0);try{const Be=await t.discoverToolsForAnalysis({serverNames:d});x(Be.servers),y(qe=>{const Bt={};for(const Wt of Be.servers){const yt=qe[Wt.serverName]??[],fe=Wt.tools.map(Ge=>Ge.name),Ie=yt.filter(Ge=>fe.includes(Ge));Bt[Wt.serverName]=Ie.length>0?Ie:fe}return Bt})}catch(Be){Me({title:"Could not discover MCP tools",description:Be instanceof Error?Be.message:String(Be),variant:"destructive"})}finally{p(!1)}};h.useEffect(()=>{it()},[d.join("|")]);const kt=h.useMemo(()=>{const Re=b.trim().toLowerCase();return Re?v.map(Be=>({...Be,tools:Be.tools.filter(qe=>qe.name.toLowerCase().includes(Re)||(qe.description||"").toLowerCase().includes(Re))})).filter(Be=>Be.tools.length>0):v},[v,b]),Ye=h.useMemo(()=>Object.values(j).reduce((Re,Be)=>Re+Be.length,0),[j]),_e=d[0]??"",Ee=async()=>{if(!N&&!k){Me({title:"Select at least one mode",variant:"destructive"});return}if(d.length!==1){Me({title:"Select exactly one server",variant:"destructive"});return}if(Ye===0){Me({title:"Select at least one tool",variant:"destructive"});return}$(!0),I([]),V(null),M(null),G("run"),ae("running");try{const Re=d[0];n.find(Bt=>Bt.id===Re)?.authType==="oauth2"&&(se(!0),await _o({serverNames:[Re],source:t,onServerAuthStart:Bt=>{Me({title:`OAuth login required for ${Bt}`,description:"Complete login in the opened browser tab. Analysis will continue automatically."})}}));const{jobId:qe}=await t.startToolAnalysis({serverNames:d,selectedToolsByServer:j,maxParallelTools:E,modes:{metadataReview:N,deeperAnalysis:k},deeperAnalysisOptions:{autoRunPolicy:"read_only_allowlist",sampleCallsPerTool:O,toolCallTimeoutMs:K}});Y(qe),at(qe),tt(qe)}catch(Re){$(!1),ae("error"),G("run"),Me({title:"Could not start tool analysis",description:Re instanceof Error?Re.message:String(Re),variant:"destructive"})}finally{se(!1)}},Ze=()=>{const Re=d[0],Be=v.find(Bt=>Bt.serverName===Re);if(!Re||!Be){Me({title:"No discovered tool info available",description:"Select a server and discover tools before downloading tool info.",variant:"destructive"});return}const qe=y0e({serverName:Be.serverName,tools:Be.tools,selectedToolNames:j[Be.serverName]});TS(b0e(Be.serverName,Be.mcpServerVersion),`${JSON.stringify(qe,null,2)}
147
+ `,"application/json")},pt=async()=>{if(!B)return;const Re=B;try{const Be=await t.stopToolAnalysis(Re);if(Be.status==="completed"){de.current?.(),de.current=null;const qe=await t.getToolAnalysisResult(Re);V(qe.report),M(qe.savedReportId??null),Se(),Y(null),$(!1),ae("idle"),G("run"),Me({title:"Analysis already finished",description:"Showing the result overview."});return}if(Be.status==="stopped"){de.current?.(),de.current=null,Se(),Y(null),$(!1),ae("stopped"),Me({title:"Analysis stopped"});return}if(Be.status==="error"){de.current?.(),de.current=null,Se(),Y(null),$(!1),ae("error"),Me({title:"Analysis already ended with an error",description:"Review the progress log and return to Configure Analysis."});return}Me({title:"Stopping analysis..."})}catch(Be){Me({title:"Could not stop analysis",description:Be instanceof Error?Be.message:String(Be),variant:"destructive"})}},Lt=()=>{G("configure"),ae("idle"),Y(null)},Ut=(Re,Be)=>{f(qe=>Be?[Re]:qe.filter(Bt=>Bt!==Re))},Nt=(Re,Be,qe)=>{y(Bt=>{const Wt=new Set(Bt[Re]??[]);return qe?Wt.add(Be):Wt.delete(Be),{...Bt,[Re]:Array.from(Wt)}})},an=(Re,Be)=>{y(qe=>({...qe,[Re]:Be}))},on=!0,zt=B!==null||z.length>0||ue==="stopped"||ue==="error",sn=!!T,nn=Re=>{if(Re==="configure"&&on){G("configure");return}if(Re==="run"&&zt){G("run");return}Re==="report"&&sn&&G("report")};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(w5,{className:"h-6 w-6"}),"Analyze MCP Tools"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Review MCP tools for schema quality, ergonomics, and agent/eval readiness."})]}),a.jsxs("div",{className:"hidden flex-wrap items-center gap-2 md:flex",children:[a.jsx("button",{type:"button",onClick:()=>nn("configure"),className:"rounded-full","aria-label":"Open Configure Analysis",children:a.jsx(et,{variant:F==="configure"?"default":"outline",className:"cursor-pointer",children:"Configure Analysis"})}),a.jsx("button",{type:"button",onClick:()=>nn("run"),disabled:!zt,className:"rounded-full disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open Run Analysis",children:a.jsx(et,{variant:F==="run"?"default":"outline",className:zt?"cursor-pointer":"cursor-not-allowed",children:"Run Analysis"})}),a.jsx("button",{type:"button",onClick:()=>nn("report"),disabled:!sn,className:"rounded-full disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open Report",children:a.jsx(et,{variant:F==="report"?"default":"outline",className:sn?"cursor-pointer":"cursor-not-allowed",children:"Report"})})]})]}),F==="configure"&&a.jsxs(Qe,{children:[a.jsxs($t,{children:[a.jsx(Dt,{className:"text-base",children:"Run MCP analysis"}),a.jsx(Mr,{children:"Select servers and tools, choose metadata review and/or deeper sample-call analysis, then run the report."})]}),a.jsxs(Je,{className:"space-y-5",children:[!ge&&a.jsxs(yl,{children:[a.jsx(bl,{children:"No assistant agent available"}),a.jsxs(wl,{children:["Add a library agent in"," ",a.jsx(At,{to:"/libraries/agents",className:"underline",children:"Agents"})," ","and optionally set the default Scenario Assistant Agent in"," ",a.jsx(At,{to:"/settings",className:"underline",children:"Settings"}),"."]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(He,{className:"text-xs",children:"Servers"}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{o()},disabled:s||ye,children:[a.jsx(Ka,{className:"mr-2 h-4 w-4"}),"Refresh Servers"]})]}),a.jsx("div",{className:"grid gap-2 rounded-md border p-3 md:grid-cols-2",children:n.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No library servers configured."}):n.map(Re=>{const Be=d.includes(Re.id);return a.jsxs("label",{className:"flex items-start gap-2 rounded-md border p-2 text-sm",children:[a.jsx(wr,{checked:Be,onCheckedChange:qe=>Ut(Re.id,!!qe)}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-medium",children:Re.name||Re.id}),Re.url&&a.jsx("div",{className:"truncate text-xs text-muted-foreground",children:Re.url})]})]},Re.id)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Select exactly one MCP server for analysis."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(He,{className:"text-xs",children:"Filter visible tools"}),a.jsxs("div",{className:"relative",children:[a.jsx(pC,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),a.jsx(_t,{className:"h-9 pl-8",placeholder:"Filter tools by name or description...",value:b,onChange:Re=>S(Re.target.value)})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Filtering only changes what is shown; selected tools remain selected."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(He,{className:"text-xs",children:_e?`Tools for ${_e}`:"Tools"}),a.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:Ze,disabled:m||ye||d.length===0||v.length===0,children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Download Tool Info"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{it()},disabled:m||ye||d.length===0,children:[m&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),"Discover Tools"]})]})]}),a.jsx("div",{className:"space-y-3 rounded-md border p-3",children:d.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a server to discover tools."}):m&&v.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading tools..."}):kt.length===0&&!m?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No discovered tools match the current filters."}):kt.map(Re=>{const Be=new Set(j[Re.serverName]??[]);return a.jsxs("div",{className:"rounded-md border p-3",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[a.jsx("div",{className:"font-medium",children:Re.serverName}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>{j0e("Tool list",`${JSON.stringify({server:Re.serverName,tools:Re.tools.map(qe=>({name:qe.name,title:qe.title,description:qe.description}))},null,2)}
148
+ `)},children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy"]}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>an(Re.serverName,Re.tools.map(qe=>qe.name)),children:"Select all"}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>an(Re.serverName,[]),children:"Clear"})]})]}),Re.warnings.length>0&&a.jsx("div",{className:"mb-2 space-y-1",children:Re.warnings.map(qe=>a.jsx("div",{className:"text-xs text-amber-700",children:S0e(Re.serverName,qe)},`${Re.serverName}-${qe}`))}),a.jsx("div",{className:"grid gap-2",children:Re.tools.map(qe=>{const Bt=cU(qe.classificationReason),Wt=qe.safetyClassification==="read_only"?"read-only":Bt?"write/delete":"unsafe/unknown",yt=qe.safetyClassification==="read_only"?"border-emerald-200 bg-emerald-50 text-emerald-700":Bt?"border-amber-300 bg-amber-50 text-amber-800":"border-slate-300 bg-slate-100 text-slate-700";return a.jsxs("label",{className:"flex items-start gap-2 rounded border p-2",children:[a.jsx(wr,{checked:Be.has(qe.name),onCheckedChange:fe=>Nt(Re.serverName,qe.name,!!fe)}),a.jsxs("div",{className:"min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"font-mono text-xs",children:qe.name}),qe.title&&a.jsx("span",{className:"text-xs text-muted-foreground",children:qe.title}),a.jsx(N0e,{label:Wt,reason:qe.classificationReason,variantClassName:yt}),qe.inputSchema&&a.jsx(et,{variant:"outline",className:"border-border text-[10px] text-muted-foreground",children:"schema: input"}),qe.outputSchema&&a.jsx(et,{variant:"outline",className:"border-border text-[10px] text-muted-foreground",children:"schema: output"})]}),qe.description&&a.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:qe.description}),a.jsx(uU,{inputSchema:qe.inputSchema,outputSchema:qe.outputSchema,mode:re,onModeChange:oe})]})]},`${Re.serverName}-${qe.name}`)})})]},Re.serverName)})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Selected tools: ",Ye]})]}),a.jsxs("div",{className:"space-y-3 rounded-md border p-3",children:[a.jsx("div",{className:"text-sm font-medium",children:"Analysis Modes"}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:N,onCheckedChange:Re=>C(!!Re)}),a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:["Metadata / schema review",a.jsx(_D,{text:"No tool execution. Reviews tool names, descriptions, and schemas only."})]})]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:k,onCheckedChange:Re=>A(!!Re)}),a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:["Deeper analysis",a.jsx(_D,{text:"Runs sample MCP tool calls automatically for read-only tools only (based on the safety allowlist)."})]})]}),a.jsxs("div",{className:"grid gap-3 rounded-md border bg-muted/20 p-3 md:grid-cols-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(He,{className:"text-xs",children:"Max parallel tools"}),a.jsx(_t,{type:"number",min:1,max:8,value:E,onChange:Re=>P(Math.max(1,Math.min(8,Number(Re.target.value)||2))),className:"h-8"})]}),k?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(He,{className:"text-xs",children:"Safety profile"}),a.jsx("div",{className:"text-sm",children:"Read-only allowlist only"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(He,{className:"text-xs",children:"Sample calls per tool"}),a.jsx(_t,{type:"number",min:1,max:5,value:O,onChange:Re=>D(Math.max(1,Math.min(5,Number(Re.target.value)||1))),className:"h-8"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(He,{className:"text-xs",children:"Tool call timeout (ms)"}),a.jsx(_t,{type:"number",min:1e3,max:6e4,step:500,value:K,onChange:Re=>q(Math.max(1e3,Math.min(6e4,Number(Re.target.value)||1e4))),className:"h-8"})]}),a.jsx("div",{className:"md:col-span-3 text-xs text-amber-700",children:"Deeper analysis may execute read-only MCP tools automatically."})]}):a.jsx("div",{className:"md:col-span-2 text-xs text-muted-foreground",children:"Deeper analysis is disabled. Only metadata/schema review will run."})]})]}),a.jsx("div",{className:"flex flex-wrap items-center gap-2",children:a.jsxs(Z,{type:"button",onClick:()=>{Ee()},disabled:X||ye||!!B,children:[(X||!!B)&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),"Analyze Tools"]})})]})]}),F==="run"&&a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"flex items-center gap-2 text-base",children:a.jsx("span",{children:"Progress"})}),a.jsx(Mr,{children:B?"Live tool-analysis job events:":T?"Analysis finished. Review the summary below or open the saved report details.":ue==="stopped"?"Analysis was stopped. You can return to Configure Analysis.":ue==="error"?"Analysis ended with an error. Review the log and go back to Configure Analysis.":"Analysis finished."})]}),B?a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{pt()},children:"Stop Analysis"}):a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:Lt,children:"Back to Configure Analysis"})]})}),a.jsxs(Je,{className:"space-y-2",children:[B&&a.jsxs("div",{className:"inline-flex items-center gap-2 rounded-md border bg-muted/20 px-2.5 py-1 text-xs text-muted-foreground",children:[a.jsx(_r,{className:"h-3.5 w-3.5 animate-spin"}),"Analysis is still running..."]}),(ve.totalTools>0||B)&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:ve.totalTools>0?`${ve.finishedTools}/${ve.totalTools} tools finished`:"Preparing analysis..."}),a.jsx("span",{children:ve.totalTools>0?`${ve.percent}%`:"0%"})]}),a.jsx(fx,{value:ve.totalTools>0?ve.percent:0,className:"h-2"})]}),z.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:B?"Starting analysis...":"No progress events captured."}):a.jsx("div",{ref:De,className:"max-h-64 space-y-1 overflow-auto rounded border bg-muted/20 p-2",children:z.map((Re,Be)=>a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"mr-2 font-mono text-muted-foreground",children:new Date(Re.ts).toLocaleTimeString()}),a.jsx(et,{variant:"outline",className:"mr-2 text-[10px]",children:Re.type}),a.jsx("span",{className:"break-all",children:typeof Re.payload.message=="string"?Re.payload.message:JSON.stringify(Re.payload)})]},`${Re.ts}-${Be}`))}),!B&&T&&a.jsx(Qe,{className:"mt-2 border-green-200 bg-green-50/40 dark:border-green-900/40 dark:bg-green-950/10",children:a.jsxs(Je,{className:"pt-4 space-y-3",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-semibold",children:"Result overview"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[T.summary.toolsAnalyzed," tools analyzed, ",T.summary.toolsSkipped," ","skipped, across ",T.summary.serversAnalyzed," server",T.summary.serversAnalyzed!==1?"s":"","."]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[H&&a.jsx(Z,{asChild:!0,size:"sm",children:a.jsx(At,{to:`/tool-analysis-results/${H}`,children:"Open result details"})}),a.jsx(Z,{asChild:!0,size:"sm",variant:"outline",children:a.jsx(At,{to:"/tool-analysis-results",children:"View all results"})}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>nn("report"),children:"View inline report"})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[T.summary.issueCounts.critical>0&&a.jsxs(et,{className:"bg-red-600 text-white hover:bg-red-600",children:["Critical: ",T.summary.issueCounts.critical]}),T.summary.issueCounts.high>0&&a.jsxs(et,{className:"bg-orange-500 text-white hover:bg-orange-500",children:["High: ",T.summary.issueCounts.high]}),T.summary.issueCounts.medium>0&&a.jsxs(et,{className:"bg-amber-500 text-white hover:bg-amber-500",children:["Medium: ",T.summary.issueCounts.medium]}),T.summary.issueCounts.low>0&&a.jsxs(et,{className:"bg-blue-500 text-white hover:bg-blue-500",children:["Low: ",T.summary.issueCounts.low]}),T.summary.issueCounts.info>0&&a.jsxs(et,{variant:"outline",children:["Info: ",T.summary.issueCounts.info]}),Object.values(T.summary.issueCounts).every(Re=>Re===0)&&a.jsx(et,{className:"bg-green-600 text-white hover:bg-green-600",children:"No findings"})]})]})})]})]}),F==="report"&&T&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-semibold",children:"Report"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[T.summary.toolsAnalyzed," tools analyzed across"," ",T.summary.serversAnalyzed," server",T.summary.serversAnalyzed!==1?"s":"","."]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:Lt,children:"Back to Configure Analysis"}),H&&a.jsxs(a.Fragment,{children:[a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsx(At,{to:`/tool-analysis-results/${H}`,children:"Open saved report"})}),a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsx(At,{to:"/tool-analysis-results",children:"View all reports"})})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>TS(e("json"),`${JSON.stringify(T,null,2)}
149
+ `,"application/json"),children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export JSON"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>TS(e("md"),mk(T),"text/markdown"),children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export Markdown"]})]})]}),a.jsx(dU,{report:T,schemaMode:re,onSchemaModeChange:oe})]})]})};function px(e){const[t,n]=h.useState(0),[r,s]=h.useState(!1),[o,i]=h.useState(0),c=h.useCallback(()=>{n(v=>Math.max(0,v-e))},[e]),d=h.useCallback(()=>{n(v=>v+e)},[e]),f=h.useCallback(()=>n(0),[]),m=h.useCallback(v=>{s(v.has_more),i(v.total_count)},[]),p=h.useCallback(v=>o<=0||v<=0?"Showing 0 of 0":`Showing ${t+1}-${Math.min(t+v,o)} of ${o}`,[t,o]);return h.useMemo(()=>({limit:e,offset:t,hasMore:r,totalCount:o,setOffset:n,setHasMore:s,setTotalCount:i,prev:c,next:d,reset:f,updateMeta:m,rangeLabel:p}),[r,e,d,t,c,p,f,o,m])}function OS(e,t,n){const r=new Blob([t],{type:n}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=e,o.click(),URL.revokeObjectURL(s)}function _0e(){const{source:e}=Dn(),[t,n]=h.useState([]),[r,s]=h.useState(!0),[o,i]=h.useState(null),[c,d]=h.useState(!1),[f,m]=h.useState("all"),[p,v]=h.useState(!1),[x,j]=h.useState([]),y=100,b=px(y),{offset:S,hasMore:N}=b,C=async()=>{s(!0);try{if(e.listToolAnalysisResultsPage){const P=await e.listToolAnalysisResultsPage({limit:y,offset:S,server:f==="all"?void 0:f});n(P.data),b.updateMeta(P)}else n(await e.listToolAnalysisResults({limit:y,offset:S,server:f==="all"?void 0:f}))}catch(P){Me({title:"Could not load tool analysis results",description:P instanceof Error?P.message:String(P),variant:"destructive"})}finally{s(!1)}};h.useEffect(()=>{C()},[S,f]),h.useEffect(()=>{e.listToolAnalysisServers&&e.listToolAnalysisServers().then(P=>j(P)).catch(()=>{j([])})},[e]),h.useEffect(()=>{e.listToolAnalysisServers||j(Array.from(new Set(t.flatMap(P=>P.serverNames))).sort((P,O)=>P.localeCompare(O)))},[t,e]),h.useEffect(()=>{b.reset()},[b.reset,f]);const k=h.useMemo(()=>t.find(P=>P.reportId===o)??null,[t,o]),A=async()=>{if(o){d(!0);try{await e.deleteToolAnalysisSavedResult(o),n(P=>P.filter(O=>O.reportId!==o)),Me({title:"Tool analysis report deleted"}),i(null)}catch(P){Me({title:"Could not delete report",description:P instanceof Error?P.message:String(P),variant:"destructive"})}finally{d(!1)}}},E=async(P,O)=>{try{const D=await e.getToolAnalysisSavedResult(P);O==="json"?OS(`${P}.json`,`${JSON.stringify(D,null,2)}
150
+ `,"application/json"):O==="tool_schemas"?OS(`${P}-tool-schemas.json`,`${JSON.stringify(fU(D),null,2)}
151
+ `,"application/json"):OS(`${P}.md`,mk(D.report),"text/markdown")}catch(D){Me({title:"Could not export saved report",description:D instanceof Error?D.message:String(D),variant:"destructive"})}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(j5,{className:"h-6 w-6"}),"Tool Analysis Results"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Browse persisted Analyze MCP Tools reports."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"MCP server"}),a.jsxs(wi,{open:p,onOpenChange:v,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":p,"aria-controls":"tool-analysis-server-command-list",className:`h-9 w-[240px] justify-between font-normal ${f!=="all"?"border-primary/40":""}`,children:[a.jsx("span",{className:"truncate text-left",children:f==="all"?"All servers":f}),a.jsx(en,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(ko,{className:"w-[240px] p-0",align:"start",children:a.jsxs(Ml,{children:[a.jsx(Il,{placeholder:"Search MCP servers..."}),a.jsxs($l,{id:"tool-analysis-server-command-list",children:[a.jsx(Dl,{children:"No servers found."}),a.jsxs(Ll,{children:[a.jsx(Na,{value:"all servers",onSelect:()=>{m("all"),v(!1)},children:"All servers"}),x.map(P=>a.jsx(Na,{value:P,onSelect:()=>{m(P),v(!1)},children:P},P))]})]})]})})]})]}),a.jsx(Z,{variant:"outline",onClick:()=>{C()},disabled:r,children:r?"Refreshing...":"Refresh"}),a.jsx(Z,{variant:"outline",onClick:b.prev,disabled:r||S===0,children:"Prev"}),a.jsx(Z,{variant:"outline",onClick:b.next,disabled:r||!N,children:"Next"}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(At,{to:"/tool-analysis",children:"Analyze MCP Tools"})})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:b.rangeLabel(t.length)}),a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:r?a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Loading tool analysis results..."}):t.length===0?a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"No saved tool analysis reports yet."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"border-b px-4 py-3",children:a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing ",a.jsx("span",{className:"font-medium text-foreground",children:t.length})," ","reports"]})}),t.length===0?a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"No reports for the selected MCP server."}):a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Vt,{children:[a.jsx(ct,{children:"Report ID"}),a.jsx(ct,{children:"Evaluated"}),a.jsx(ct,{children:"Timestamp"}),a.jsx(ct,{children:"Issues"}),a.jsx(ct,{children:"Modes"}),a.jsx(ct,{className:"w-10"})]})}),a.jsx(ca,{children:t.map(P=>a.jsxs(Vt,{children:[a.jsx(Ue,{children:a.jsxs("div",{className:"space-y-1",children:[a.jsx(At,{to:`/tool-analysis-results/${P.reportId}`,className:"font-mono text-xs text-primary hover:underline",children:P.reportId}),a.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[P.assistantAgentName," · ",P.assistantAgentModel]})]})}),a.jsx(Ue,{className:"text-[11px] text-muted-foreground",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{children:["Servers:"," ",a.jsx("span",{className:"font-medium text-foreground",children:P.serverNames.length})," ","· Tools:"," ",a.jsx("span",{className:"font-medium text-foreground",children:P.summary.toolsAnalyzed})," · ","Skipped:"," ",a.jsx("span",{className:"font-medium text-foreground",children:P.summary.toolsSkipped})]}),a.jsxs("div",{className:"font-mono text-xs text-foreground/80",children:[P.serverNames.slice(0,2).join(", "),P.serverNames.length>2?` +${P.serverNames.length-2}`:""]})]})}),a.jsx(Ue,{className:"text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(P.createdAt).toLocaleString()]})}),a.jsx(Ue,{children:a.jsxs("div",{className:"flex flex-wrap gap-1",children:[["critical","high","medium","low","info"].map(O=>P.summary.issueCounts[O]>0?a.jsxs(et,{variant:"outline",className:"capitalize",children:[O,": ",P.summary.issueCounts[O]]},`${P.reportId}-${O}`):null),Object.values(P.summary.issueCounts).every(O=>O===0)&&a.jsx(et,{variant:"outline",children:"No issues"})]})}),a.jsx(Ue,{children:a.jsxs("div",{className:"flex flex-wrap gap-1",children:[P.modes.metadataReview&&a.jsx(et,{variant:"outline",children:"metadata"}),P.modes.deeperAnalysis&&a.jsx(et,{variant:"outline",children:"deeper"})]})}),a.jsx(Ue,{children:a.jsxs(Sp,{children:[a.jsx(Np,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(zg,{className:"h-4 w-4"})})}),a.jsxs(Uu,{align:"end",children:[a.jsx(Ir,{asChild:!0,children:a.jsx(At,{to:`/tool-analysis-results/${P.reportId}`,children:"View"})}),a.jsxs(Ir,{onSelect:()=>{E(P.reportId,"json")},children:[a.jsx(zr,{className:"mr-2 h-3.5 w-3.5"})," Export JSON"]}),a.jsxs(Ir,{onSelect:()=>{E(P.reportId,"markdown")},children:[a.jsx(zr,{className:"mr-2 h-3.5 w-3.5"})," Export Markdown"]}),a.jsxs(Ir,{className:"text-destructive",onSelect:O=>{O.preventDefault(),i(P.reportId)},children:[a.jsx(Ga,{className:"mr-2 h-3.5 w-3.5"})," Delete"]}),a.jsxs(Ir,{onSelect:()=>{E(P.reportId,"tool_schemas")},children:[a.jsx(zr,{className:"mr-2 h-3.5 w-3.5"})," Export MCP Info"]})]})]})})]},P.reportId))})]})]})})}),a.jsx(Ps,{open:!!o,onOpenChange:P=>!P&&i(null),children:a.jsxs(Qa,{children:[a.jsxs(Ja,{children:[a.jsx(es,{children:"Delete tool analysis report?"}),a.jsx(ts,{children:k?`Delete saved report '${k.reportId}' from disk? This cannot be undone.`:"Delete this saved report from disk? This cannot be undone."})]}),a.jsxs(Za,{children:[a.jsx(rs,{disabled:c,children:"Cancel"}),a.jsx(ns,{onClick:P=>{P.preventDefault(),A()},disabled:c,children:c?"Deleting...":"Delete"})]})]})})]})}function MS(e,t,n){const r=new Blob([t],{type:n}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=e,o.click(),URL.revokeObjectURL(s)}function k0e(){const{id:e=""}=ql(),t=ss(),{source:n}=Dn(),[r,s]=h.useState(null),[o,i]=h.useState(!0),[c,d]=h.useState(!1),[f,m]=h.useState(!1),[p,v]=h.useState(!1);h.useEffect(()=>{let j=!0;return i(!0),d(!1),n.getToolAnalysisSavedResult(e).then(y=>{j&&s(y)}).catch(y=>{if(!j)return;const b=y instanceof Error?y.message:String(y);if(b.includes("(404)")){d(!0),s(null);return}Me({title:"Could not load saved tool analysis report",description:b,variant:"destructive"})}).finally(()=>{j&&i(!1)}),()=>{j=!1}},[e,n]);const x=async()=>{v(!0);try{await n.deleteToolAnalysisSavedResult(e),Me({title:"Tool analysis report deleted"}),t("/tool-analysis-results")}catch(j){Me({title:"Could not delete report",description:j instanceof Error?j.message:String(j),variant:"destructive"})}finally{v(!1),m(!1)}};return o?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading saved tool analysis report..."}):c||!r?a.jsxs("div",{className:"space-y-4",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Tool Analysis Result"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Saved report not found."}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(At,{to:"/tool-analysis-results",children:"Back to Tool Analysis Results"})})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-mono text-xl font-semibold",children:r.reportId}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 align-middle",children:[a.jsx(Ea,{className:"h-3 w-3 shrink-0"}),new Date(r.createdAt).toLocaleString()]})," ","· ",r.serverNames.join(", ")||"—"]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.report.mcpServerVersions&&Object.keys(r.report.mcpServerVersions).length>0&&a.jsxs("span",{className:"inline-flex items-center align-middle rounded-sm border border-border/60 bg-muted/30 px-1.5 py-1 text-[11px] leading-none text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"MCP:"}),a.jsx("span",{className:"ml-1 font-mono",children:Object.entries(r.report.mcpServerVersions).map(([j,y])=>`${j}: ${y??"unknown"}`).join(", ")})]}),a.jsx(Z,{asChild:!0,size:"sm",variant:"outline",children:a.jsx(At,{to:"/tool-analysis-results",children:"Back to results"})}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>MS(`${r.reportId}.json`,`${JSON.stringify(r,null,2)}
152
+ `,"application/json"),children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export JSON"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>MS(`${r.reportId}.md`,mk(r.report),"text/markdown"),children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export Markdown"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>MS(`${r.reportId}-tool-schemas.json`,`${JSON.stringify(fU(r),null,2)}
153
+ `,"application/json"),children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export MCP info"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>m(!0),children:[a.jsx(Ga,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]}),a.jsx(dU,{report:r.report}),a.jsx(Ps,{open:f,onOpenChange:m,children:a.jsxs(Qa,{children:[a.jsxs(Ja,{children:[a.jsx(es,{children:"Delete tool analysis report?"}),a.jsxs(ts,{children:["Delete saved report '",r.reportId,"' from disk? This cannot be undone."]})]}),a.jsxs(Za,{children:[a.jsx(rs,{disabled:p,children:"Cancel"}),a.jsx(ns,{onClick:j=>{j.preventDefault(),x()},disabled:p,children:p?"Deleting...":"Delete"})]})]})})]})}const A0e=[{id:"configure",label:"Configure Debug Session"},{id:"run",label:"Run / Inspect Flow"},{id:"report",label:"Report / Export"}],E0e="resolve_target_metadata",P0e="token_exchange",R0e="resource_probe";function Lr({text:e}){return a.jsx(Ro,{delayDuration:200,children:a.jsxs(To,{children:[a.jsx(Oo,{type:"button",className:"inline-flex shrink-0 items-center",onClick:t=>t.preventDefault(),children:a.jsx(SW,{className:"h-3.5 w-3.5 text-muted-foreground/50 hover:text-muted-foreground"})}),a.jsx(Gs,{className:"max-w-xs text-xs leading-relaxed",children:e})]})})}function kD(e){return navigator.clipboard.writeText(e)}function IS(){return typeof window>"u"?"":window.location.port==="8685"?"http://127.0.0.1:8787":""}function $S(e){if(!e)return"No metadata payload captured.";try{return JSON.stringify(JSON.parse(e),null,2)}catch{return`Non-JSON response body:
154
+ ${e}`}}function T0e(e,t){const n=[];n.push("# OAuth Debugger Report"),n.push(""),n.push(`- Session ID: ${e.id}`),n.push(`- Status: ${e.status}`),n.push(`- Registration method: ${e.registrationMethod}`),n.push(`- Profile: ${e.profile}`),n.push(""),n.push("## Steps");for(const r of e.stepStates)n.push(`- ${r.title}: ${r.status}${r.outcomeSummary?` — ${r.outcomeSummary}`:""}`);if(n.push(""),n.push("## Validation Findings"),e.validations.length===0)n.push("- None");else for(const r of e.validations)n.push(`- [${r.severity}] ${r.title} (${r.stepId})`),n.push(` - ${r.detail}`),r.recommendation&&n.push(` - Recommendation: ${r.recommendation}`);n.push(""),n.push("## Event Log");for(const r of t){const s=typeof r.payload.message=="string"?r.payload.message:JSON.stringify(r.payload);n.push(`- ${new Date(r.ts).toLocaleTimeString()} [${r.type}] ${s}`)}return`${n.join(`
155
+ `)}
156
+ `}function O0e(){const{source:e}=Dn(),{servers:t,reload:n,loading:r}=Ts(),[s,o]=h.useState("configure"),[i,c]=h.useState(""),[d,f]=h.useState("pre_registered"),[m,p]=h.useState("local_callback"),[v,x]=h.useState(!0),[j,y]=h.useState(!0),[b,S]=h.useState(!0),[N,C]=h.useState(""),[k,A]=h.useState(""),[E,P]=h.useState(""),[O,D]=h.useState(""),[K,q]=h.useState("__default__"),[B,Y]=h.useState("{}"),[z,I]=h.useState(""),[T,V]=h.useState(""),[H,M]=h.useState(""),[X,$]=h.useState(""),[F,G]=h.useState(""),[re,oe]=h.useState(""),[ue,ae]=h.useState(""),[ye,se]=h.useState(""),[de,De]=h.useState(null),[ge,ve]=h.useState(null),[Se,at]=h.useState([]),[tt,it]=h.useState(!1),[kt,Ye]=h.useState(!1),[_e,Ee]=h.useState(!1),[Ze,pt]=h.useState("all"),[Lt,Ut]=h.useState("all"),[Nt,an]=h.useState("inspector"),on=h.useRef(null),zt=h.useRef(null),sn=h.useRef(!1),nn=h.useRef(j);h.useEffect(()=>{nn.current=j},[j]),h.useEffect(()=>()=>{on.current?.(),on.current=null},[]),h.useEffect(()=>{zt.current?.scrollIntoView({behavior:"smooth",block:"end"})},[Se.length]);const Re=h.useMemo(()=>t.filter(ee=>ee.authType==="oauth2").slice().sort((ee,Le)=>(ee.name||ee.id).localeCompare(Le.name||Le.id,void 0,{sensitivity:"base"})),[t]),Be=Re.find(ee=>ee.id===i);h.useEffect(()=>{i&&(Re.some(ee=>ee.id===i)||c(""))},[Re,i]),h.useEffect(()=>{Be&&(Be.oauthMode==="dcr"?(f("dcr"),P(""),D("")):(f("pre_registered"),P(Be.oauthClientId??""),D(Be.oauthClientSecret??"")),C(Be.oauthScope??""),$(Be.oauthAuthorizationUrl??""),G(Be.oauthTokenEndpoint??""))},[Be?.id]);const qe=h.useMemo(()=>{const ee=de?.stepStates.length??0,Le=de?.stepStates.filter(Pe=>Pe.status==="completed"||Pe.status==="skipped").length??0,ot=de?.stepStates.filter(Pe=>Pe.status==="failed").length??0,Ht=ee>0?Math.round((Le+ot)/ee*100):0;return{total:ee,completed:Le,failed:ot,percent:Ht}},[de]),Bt=h.useMemo(()=>{const ee=de?.network??[],Le=new Map,ot=[],Ht=Pe=>`${Pe.stepId}::${Pe.label}::${Pe.url}`;for(const Pe of ee){if(Pe.phase==="request"){const Xn=ot.length;ot.push({key:Pe.id,stepId:Pe.stepId,label:Pe.label,method:Pe.method,url:Pe.url,request:Pe});const qn=Ht(Pe),to=Le.get(qn)??[];to.push(Xn),Le.set(qn,to);continue}const Zt=Ht(Pe),Ct=Le.get(Zt),Xt=Ct?.shift();if(typeof Xt=="number"){ot[Xt]={...ot[Xt],response:Pe},Ct&&Ct.length>0?Le.set(Zt,Ct):Le.delete(Zt);continue}ot.push({key:Pe.id,stepId:Pe.stepId,label:Pe.label,method:Pe.method,url:Pe.url,response:Pe})}return ot.filter(Pe=>Ze!=="all"&&Pe.stepId!==Ze?!1:Lt==="error"?typeof Pe.response?.status=="number"&&Pe.response.status>=400:Lt==="ok"?typeof Pe.response?.status=="number"&&Pe.response.status<400:!0)},[de?.network,Ze,Lt]),Wt=!!ge,yt=!!(de&&(de.status==="completed"||de.status==="error"||de.status==="stopped")),fe=h.useMemo(()=>{const ee=new Map;return(de?.stepStates??[]).forEach((Le,ot)=>{ee.set(Le.id,ot+1)}),ee},[de?.stepStates]),Ie=h.useMemo(()=>{const ee=(de?.network??[]).filter(ot=>ot.phase==="response"),Le=ot=>{const Ht=ee.filter(Pe=>Pe.label===ot);return[...Ht].reverse().find(Pe=>typeof Pe.status=="number"&&Pe.status<400)??[...Ht].reverse()[0]};return{resourceMetadata:Le("Protected Resource Metadata"),authorizationServerMetadata:Le("Authorization Server Metadata")}},[de?.network]),Ge=h.useMemo(()=>{const ee=new Map;for(const Le of de?.network??[]){const ot=ee.get(Le.stepId)??{requests:[],responses:[]};Le.phase==="request"&&ot.requests.push(Le),Le.phase==="response"&&ot.responses.push(Le),ee.set(Le.stepId,ot)}return ee},[de?.network]),U=ee=>{if(ee==="configure"||ee==="run"&&Wt||ee==="report"&&yt)return o(ee)},le=()=>{let ee;if(d==="dcr"&&B.trim())try{ee=JSON.parse(B)}catch{throw new Error("DCR metadata JSON is invalid")}if(!Be)throw new Error("Select an MCP server");return{profile:"latest",target:{serverName:Be.id,overrides:{authorizationServerMetadataUrl:H||void 0,authorizationEndpoint:X||void 0,tokenEndpoint:F||void 0,registrationEndpoint:re||void 0,cimdUrl:z||void 0,resourceBaseUrl:ue||void 0}},registrationMethod:d,clientConfig:{preRegistered:d==="pre_registered"?{clientId:E.trim(),clientSecret:O.trim()||void 0,tokenEndpointAuthMethod:K==="__default__"?void 0:K||void 0}:void 0,dcr:d==="dcr"?{metadata:ee,tokenEndpointAuthMethod:K==="__default__"?void 0:K||void 0}:void 0,cimd:d==="cimd"?{cimdUrl:z||void 0,expectedClientId:T||void 0}:void 0},runtime:{redirectMode:m,scopes:N.split(/[,\s]+/).map(Le=>Le.trim()).filter(Boolean),resource:k.trim()||void 0,usePkce:b,codeChallengeMethod:"S256"},display:{showSensitiveValues:v}}},pe=ee=>{on.current?.(),on.current=e.subscribeOAuthDebuggerSession(ee,Le=>{at(Ht=>[...Ht,Le]),(Le.type==="completed"||Le.type==="error"||Le.type==="stopped")&&it(!1),e.getOAuthDebuggerSession(ee).then(Ht=>{De(Ht.session),Ht.session.uiHints.authorizationUrl&&J(`${IS()}/api/oauth-debugger/sessions/${ee}/authorize`),Ht.session.status==="completed"&&o("report")}).catch(()=>{})})},J=ee=>{!nn.current||sn.current||!ee||(sn.current=!0,window.open(ee,"_blank","noopener,noreferrer"))},xe=async()=>{Ye(!0),sn.current=!1;try{const ee=le(),Le=await e.createOAuthDebuggerSession(ee);ve(Le.sessionId),De(Le.session),at([]),o("run"),pe(Le.sessionId);const ot=await e.startOAuthDebuggerSession(Le.sessionId);De(ot.session),it(!0),(ot.session.status==="waiting_for_user"||ot.session.status==="waiting_for_browser_callback")&&(it(!1),ot.session.uiHints.authorizationUrl&&J(`${IS()}/api/oauth-debugger/sessions/${Le.sessionId}/authorize`))}catch(ee){Me({title:"Could not start OAuth Debugger session",description:ee instanceof Error?ee.message:String(ee),variant:"destructive"})}finally{Ye(!1)}},be=async()=>{if(ge)try{Ye(!0);const ee=await e.submitOAuthDebuggerManualCallback(ge,{redirectUrl:ye.trim()||void 0});De(ee.session),se(""),it(!0)}catch(ee){Me({title:"Could not submit callback",description:ee instanceof Error?ee.message:String(ee),variant:"destructive"})}finally{Ye(!1)}},we=async()=>{if(ge){Ee(!0);try{const ee=await e.stopOAuthDebuggerSession(ge);if(it(!1),ee.status!=="running"){const Le=await e.getOAuthDebuggerSession(ge);De(Le.session),Le.session.status==="completed"?o("report"):o("run")}}catch(ee){Me({title:"Could not stop session",description:ee instanceof Error?ee.message:String(ee),variant:"destructive"})}finally{Ee(!1)}}},W=async()=>{on.current?.(),on.current=null,De(null),ve(null),at([]),it(!1),Ee(!1),Ye(!1),se(""),pt("all"),Ut("all"),an("inspector"),o("run"),await xe()},he=async ee=>{if(!(!ge||!de))try{const Le=await e.exportOAuthDebuggerSession(ge,ee);let ot="";const Ht=ee==="json"?"json":ee==="raw"?"txt":"md";typeof Le=="string"?ot=Le:ot=`${JSON.stringify(Le,null,2)}
157
+ `;const Pe=new Blob([ot],{type:"text/plain;charset=utf-8"}),Zt=URL.createObjectURL(Pe),Ct=document.createElement("a");Ct.href=Zt,Ct.download=`oauth-debugger-${ge}.${Ht}`,Ct.click(),URL.revokeObjectURL(Zt)}catch(Le){if(ee==="markdown"){const ot=T0e(de,Se),Ht=new Blob([ot],{type:"text/markdown;charset=utf-8"}),Pe=URL.createObjectURL(Ht),Zt=document.createElement("a");Zt.href=Pe,Zt.download=`oauth-debugger-${de.id}.md`,Zt.click(),URL.revokeObjectURL(Pe);return}Me({title:"Export failed",description:Le instanceof Error?Le.message:String(Le),variant:"destructive"})}},ke=ge?`${IS()}/api/oauth-debugger/sessions/${ge}/authorize`:void 0,Ve=ee=>ee==="error"?"destructive":ee==="warning"?"outline":"secondary";return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:"OAuth Debugger"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Step-by-step OAuth flow debugging for MCP servers (latest MCP authorization draft profile)."})]}),a.jsx("div",{className:"flex flex-wrap items-center gap-2",children:A0e.map(ee=>{const Le=s===ee.id,ot=ee.id==="configure"||ee.id==="run"&&Wt||ee.id==="report"&&yt;return a.jsx("button",{type:"button",onClick:()=>ot&&U(ee.id),disabled:!ot,className:"rounded-full",children:a.jsx(et,{variant:Le?"default":"outline",className:ot?"":"opacity-50",children:ee.label})},ee.id)})})]}),s==="configure"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"text-base",children:"Target MCP Server"}),a.jsx(Mr,{children:"Select one MCP server from Libraries and optionally override endpoints."})]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:()=>{n()},disabled:r,children:[a.jsx(Ka,{className:`mr-2 h-4 w-4 ${r?"animate-spin":""}`}),"Refresh Servers"]})]})}),a.jsx(Je,{className:"space-y-3",children:a.jsxs("div",{className:"max-w-xl space-y-2",children:[a.jsx(He,{children:"MCP Server"}),a.jsxs(In,{value:i,onValueChange:c,children:[a.jsx(An,{children:a.jsx($n,{placeholder:"Select an MCP server"})}),a.jsx(En,{children:Re.map(ee=>a.jsx(ut,{value:ee.id,children:ee.name||ee.id},ee.id))})]}),Re.length===0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["No MCP servers with OAuth configured found. Add OAuth 2.0 auth in"," ",a.jsx("a",{href:"/libraries/servers",className:"underline text-primary",children:"Manage Servers"}),"."]}),Be&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[Be.transport," ·"," ",Be.url||Be.command||"No URL/command"," · ",a.jsxs("span",{className:"text-primary",children:[Be.oauthMode==="dcr"?"DCR":"pre-registered"," fields pre-filled"]})]})]})})]}),a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:"Client Registration Method"}),a.jsx(Mr,{children:"How your OAuth client is identified with the authorization server."})]}),a.jsxs(Je,{className:"space-y-3",children:[a.jsx("div",{className:"grid gap-2 md:grid-cols-3",children:[{id:"pre_registered",label:"Pre-registered client",hint:"You already have a client_id issued by the authorization server."},{id:"dcr",label:"Dynamic Client Registration",hint:"The server issues a client_id automatically at the start of the flow (RFC 7591)."},{id:"cimd",label:"Client ID Metadata Document",hint:"The client identifies itself via a hosted JSON metadata document at a public URL (RFC 9728)."}].map(ee=>a.jsxs("button",{type:"button",onClick:()=>f(ee.id),className:"rounded-md border p-3 text-left",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${d===ee.id?"bg-primary":"bg-muted-foreground/30"}`}),a.jsx("span",{className:"text-sm font-medium",children:ee.label})]}),a.jsx("p",{className:"mt-1 pl-5 text-xs text-muted-foreground",children:ee.hint})]},ee.id))}),a.jsx("div",{className:"grid gap-3 md:grid-cols-1",children:a.jsxs("div",{className:"max-w-md space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["Redirect mode",a.jsx(Lr,{text:"Local callback (recommended): MCP Lab automatically captures the redirect after you log in — no copy-pasting needed. Manual: you complete the browser login and then paste the final redirect URL back here."})]}),a.jsxs(In,{value:m,onValueChange:ee=>p(ee),children:[a.jsx(An,{children:a.jsx($n,{})}),a.jsxs(En,{children:[a.jsx(ut,{value:"local_callback",children:"Local callback (recommended)"}),a.jsx(ut,{value:"manual",children:"Manual paste redirect URL"})]})]})]})}),d==="pre_registered"&&a.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["client_id",a.jsx(Lr,{text:"The unique identifier for your application, issued by the authorization server when you registered the client."})]}),a.jsx(_t,{value:E,onChange:ee=>P(ee.target.value)})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["client_secret",a.jsx(Lr,{text:"Leave empty for public clients (e.g. SPAs or mobile apps). Required for confidential clients that authenticate with the token endpoint."})]}),a.jsx(KN,{value:O,onChange:ee=>D(ee.target.value),placeholder:"optional"})]})]}),d==="cimd"&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["CIMD URL",a.jsx(Lr,{text:"A publicly reachable URL hosting a JSON document that describes this client. The authorization server fetches it to identify the client."})]}),a.jsx(_t,{value:z,onChange:ee=>I(ee.target.value),placeholder:"https://.../client-metadata.json"})]})]})]}),a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:"Runtime OAuth Inputs"}),a.jsx(Mr,{children:"Parameters sent in the authorization request."})]}),a.jsxs(Je,{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(He,{className:"text-xs",children:"Scopes"}),a.jsx(_t,{value:N,onChange:ee=>C(ee.target.value),placeholder:"openid profile email"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Space or comma separated. Leave empty to use scopes auto-discovered from the server metadata."})]}),a.jsxs("div",{className:"flex items-center gap-2 md:col-span-2",children:[a.jsx(wr,{checked:b,onCheckedChange:ee=>S(!!ee)}),a.jsxs(He,{className:"flex items-center gap-1",children:["Use PKCE (S256)",a.jsx(Lr,{text:"Proof Key for Code Exchange — generates a one-time code verifier so the authorization code can't be hijacked. Recommended for all clients; required for public clients."})]})]}),a.jsxs("div",{className:"flex items-center gap-2 md:col-span-2",children:[a.jsx(wr,{checked:j,onCheckedChange:ee=>y(!!ee)}),a.jsx(He,{children:"Auto-open browser when authorization URL is ready"})]})]})]}),a.jsxs("details",{className:"rounded-md border bg-card p-3 shadow-sm",children:[a.jsx("summary",{className:"cursor-pointer text-sm font-medium",children:"Advanced"}),a.jsxs("div",{className:"mt-3 space-y-4",children:[a.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["Token endpoint auth method",a.jsx(Lr,{text:"How your client authenticates when exchanging the authorization code for a token. Choose 'none' for public clients (no secret). Leave as server default if unsure."})]}),a.jsxs(In,{value:K,onValueChange:q,children:[a.jsx(An,{children:a.jsx($n,{placeholder:"Server default (recommended)"})}),a.jsxs(En,{children:[a.jsx(ut,{value:"__default__",children:"Server default (let the server decide)"}),a.jsx(ut,{value:"client_secret_basic",children:"client_secret_basic — credentials in Authorization header"}),a.jsx(ut,{value:"client_secret_post",children:"client_secret_post — credentials in request body"}),a.jsx(ut,{value:"none",children:"none — public client, no secret"}),a.jsx(ut,{value:"private_key_jwt",children:"private_key_jwt — signed JWT assertion"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'Use "server default" unless the server requires a specific method.'})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["Resource / audience",a.jsx(Lr,{text:"Some servers (RFC 8707) require the target API's URI in the token request to scope the token. Only set this if your server explicitly requires it."})]}),a.jsx(_t,{value:k,onChange:ee=>A(ee.target.value),placeholder:"https://api.example.com"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Only needed for servers that use resource indicators."})]})]}),d==="dcr"&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["DCR metadata JSON",a.jsx(Lr,{text:'Extra fields for the dynamic client registration request (RFC 7591), e.g. {"client_name": "My App"}. redirect_uris and grant_types are always added automatically.'})]}),a.jsx(Es,{value:B,onChange:ee=>Y(ee.target.value),className:"min-h-32 font-mono text-xs"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional extra fields for the registration request body."})]}),d==="cimd"&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["Expected client_id",a.jsx(Lr,{text:"If you know what client_id the server should assign from the metadata document, enter it here for verification. Leave blank to accept whatever the server returns."})]}),a.jsx(_t,{value:T,onChange:ee=>V(ee.target.value),placeholder:"optional"})]}),a.jsxs("div",{className:"rounded-md border bg-background p-3",children:[a.jsx("div",{className:"mb-1 text-sm font-medium",children:"Endpoint overrides"}),a.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Override specific endpoints if auto-discovery fails or you want to test against a specific URL. Leave blank to use what the server advertises."}),a.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["Authorization server metadata URL",a.jsx(Lr,{text:"The /.well-known/oauth-authorization-server URL. Override if the server uses a non-standard path."})]}),a.jsx(_t,{value:H,onChange:ee=>M(ee.target.value),placeholder:"https://.../.well-known/oauth-authorization-server"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["Resource server base URL",a.jsx(Lr,{text:"The MCP server's base URL used to look up its /.well-known/oauth-protected-resource metadata. Override if the server uses a different base path."})]}),a.jsx(_t,{value:ue,onChange:ee=>ae(ee.target.value),placeholder:"https://resource.example.com"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["Authorization endpoint",a.jsx(Lr,{text:"The URL where users are redirected to log in and grant consent. Normally discovered automatically from the server metadata."})]}),a.jsx(_t,{value:X,onChange:ee=>$(ee.target.value),placeholder:"https://.../authorize"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["Token endpoint",a.jsx(Lr,{text:"The URL your app calls to exchange the authorization code for an access token. Normally discovered automatically."})]}),a.jsx(_t,{value:F,onChange:ee=>G(ee.target.value),placeholder:"https://.../token"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["Registration endpoint (DCR)",a.jsx(Lr,{text:"The URL used to dynamically register a new client (RFC 7591). Only relevant when using DCR. Override if the server doesn't advertise it in its metadata."})]}),a.jsx(_t,{value:re,onChange:ee=>oe(ee.target.value),placeholder:"https://.../register"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(He,{className:"text-xs flex items-center gap-1",children:["CIMD URL override",a.jsx(Lr,{text:"Override the Client ID Metadata Document URL. Use this if the server doesn't discover it automatically or you want to test with a specific metadata document."})]}),a.jsx(_t,{value:z,onChange:ee=>I(ee.target.value),placeholder:"https://.../client-metadata.json"})]})]})]}),a.jsxs(yl,{children:[a.jsx(Zy,{className:"h-4 w-4"}),a.jsx(bl,{children:"Secrets display"}),a.jsxs(wl,{className:"space-y-2",children:[a.jsx("p",{children:"By default, full tokens and secrets are visible in the network inspector and exports — useful for debugging but not for sharing."}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(wr,{checked:!v,onCheckedChange:ee=>x(ee===!1)}),a.jsx(He,{children:"Hide sensitive values in inspector"})]})]})]})]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(Z,{type:"button",onClick:()=>{xe()},disabled:kt,children:[kt&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),"Start OAuth Debug Session"]})})]}),s==="run"&&a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"grid gap-4 xl:grid-cols-[1.2fr_1fr]",children:[a.jsxs(Qe,{className:"xl:col-span-1 min-w-0",children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"text-base",children:"Progress"}),a.jsx(Mr,{children:"Visual OAuth flow guide with live session events and next-step actions."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[de?.uiHints.authorizationUrl&&ke&&a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsxs("a",{href:ke,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Yc,{className:"mr-2 h-4 w-4"}),"Open Authorization URL"]})}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{W()},disabled:kt,children:[a.jsx(Ka,{className:"mr-2 h-4 w-4"}),"Restart"]}),ge&&a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{we()},disabled:_e||!ge,children:[(_e||tt)&&_e&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),a.jsx(Kd,{className:"mr-2 h-4 w-4"}),"Stop Debug Session"]})]})]})}),a.jsxs(Je,{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{children:[qe.completed+qe.failed,"/",qe.total," steps"]}),a.jsxs("span",{children:[qe.percent,"%"]})]}),a.jsx(fx,{value:qe.percent,className:"h-2"})]}),de?.status==="waiting_for_user"&&a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4 space-y-2",children:[a.jsx("div",{className:"text-sm font-medium",children:"Manual callback required"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Open the authorization URL, complete authentication, then paste the final redirect URL here."}),a.jsx(Es,{value:ye,onChange:ee=>se(ee.target.value),placeholder:"Paste the final redirect URL (with code and state)",className:"min-h-24 text-xs font-mono"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",onClick:()=>{be()},disabled:kt||!ye.trim(),children:[kt&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),"Continue"]}),de.uiHints.authorizationUrl&&ke&&a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsx("a",{href:ke,target:"_blank",rel:"noopener noreferrer",children:"Open Authorization URL"})})]})]})}),de?.status==="waiting_for_browser_callback"&&a.jsxs(yl,{children:[a.jsx(Zy,{className:"h-4 w-4"}),a.jsx(bl,{children:"Waiting for browser callback"}),a.jsxs(wl,{className:"space-y-1",children:[a.jsx("p",{className:"text-xs",children:"Complete the authorization flow in your browser. MCP Lab is listening for the callback at:"}),a.jsx("p",{className:"text-xs font-mono break-all",children:de.uiHints.callbackUrl}),de.uiHints.authorizationUrl&&ke&&a.jsx("div",{className:"pt-2",children:a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsxs("a",{href:ke,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Yc,{className:"mr-2 h-4 w-4"}),"Open Authorization URL"]})})})]})]}),a.jsx("div",{className:"space-y-2",children:de?.stepStates.map(ee=>{const Le=fe.get(ee.id),ot=Ge.get(ee.id),Ht=ee.id===P0e||ee.id===R0e,Pe=!!(ot&&(ot.requests.length>0||ot.responses.length>0)),Zt=Ht&&ee.status!=="pending"&&Pe;return a.jsxs("div",{className:"rounded-md border p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0 flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border bg-muted text-xs font-semibold",children:Le}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"inline-flex items-center gap-1 text-sm font-medium",children:[a.jsx("span",{children:ee.title}),ee.status==="completed"&&a.jsx(Wa,{className:"h-4 w-4 shrink-0 text-emerald-600","aria-hidden":"true"})]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:ee.description})]})]}),a.jsx(et,{variant:ee.status==="failed"?"destructive":ee.status==="completed"?"outline":ee.status==="active"?"secondary":"outline",className:ee.status==="completed"?"border-emerald-300 bg-emerald-50 text-emerald-700":void 0,children:ee.status})]}),ee.outcomeSummary&&a.jsx("p",{className:"mt-2 text-xs text-muted-foreground break-all whitespace-pre-line",children:ee.outcomeSummary}),ee.id===E0e&&a.jsxs("details",{className:"mt-3 rounded-md border bg-muted/20 p-3",children:[a.jsx("summary",{className:"cursor-pointer text-xs font-semibold text-muted-foreground",children:"OAuth Metadata Sources"}),a.jsxs("div",{className:"mt-3 space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-medium",children:"Resource Metadata"}),a.jsxs("p",{className:"text-xs text-muted-foreground break-all",children:["From ",Ie.resourceMetadata?.url??"not captured"]}),a.jsx("pre",{className:"max-h-56 overflow-x-auto rounded-md bg-muted p-2 text-xs",children:$S(Ie.resourceMetadata?.bodyText)})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-medium",children:"Authorization Server Metadata"}),a.jsxs("p",{className:"text-xs text-muted-foreground break-all",children:["From"," ",Ie.authorizationServerMetadata?.url??"not captured"]}),a.jsx("pre",{className:"max-h-56 overflow-x-auto rounded-md bg-muted p-2 text-xs",children:$S(Ie.authorizationServerMetadata?.bodyText)})]})]})]}),Zt&&ot&&a.jsxs("details",{className:"mt-3 rounded-md border bg-muted/20 p-3",children:[a.jsx("summary",{className:"cursor-pointer text-xs font-semibold text-muted-foreground",children:"Captured exchange details"}),a.jsx("div",{className:"mt-3 space-y-3",children:Array.from({length:Math.max(ot.requests.length,ot.responses.length)}).map((Ct,Xt)=>{const Xn=ot.requests[Xt],qn=ot.responses[Xt];return a.jsxs("div",{className:"rounded-md border bg-background p-2",children:[a.jsx("div",{className:"text-xs font-medium",children:Xn?.label??qn?.label??`Exchange ${Xt+1}`}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground break-all",children:[Xn?.method?`${Xn.method} `:"",Xn?.url??qn?.url??"-"]}),typeof qn?.status=="number"&&a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["HTTP ",qn.status]}),Xn?.bodyText&&a.jsx("pre",{className:"mt-2 max-h-40 overflow-auto rounded bg-muted p-2 text-xs",children:Xn.bodyText}),qn?.bodyText&&a.jsx("pre",{className:"mt-2 max-h-48 overflow-auto rounded bg-muted p-2 text-xs",children:$S(qn.bodyText)})]},`${ee.id}-exchange-${Xt}`)})})]})]},ee.id)})||a.jsx("p",{className:"text-sm text-muted-foreground",children:"No steps yet."})})]})]}),a.jsx("div",{className:"space-y-4 xl:col-span-1 min-w-0",children:a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"text-base",children:"Inspect"}),a.jsx(Mr,{children:"Live events and network requests/responses for the OAuth flow."})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{he("raw")},disabled:!ge||!de,children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Copy/Export Raw Trace"]})]})}),a.jsx(Je,{className:"space-y-3",children:a.jsxs(rx,{value:Nt,onValueChange:ee=>an(ee),className:"min-w-0",children:[a.jsxs(Cp,{className:"grid grid-cols-2",children:[a.jsx(Vs,{value:"inspector",children:"Network Inspector"}),a.jsx(Vs,{value:"events",children:"Live Debug"})]}),a.jsx(Yf,{value:"events",className:"mt-3",children:a.jsxs("div",{className:"max-h-64 space-y-1 overflow-auto rounded-md border bg-muted/10 p-3 text-xs",children:[Se.length===0?a.jsx("p",{className:"text-muted-foreground",children:"No events yet."}):Se.map((ee,Le)=>a.jsxs("div",{className:"break-all",children:[a.jsx("span",{className:"mr-2 font-mono text-muted-foreground",children:new Date(ee.ts).toLocaleTimeString()}),a.jsx(et,{variant:"outline",className:"mr-2 text-[10px]",children:ee.type}),typeof ee.payload.message=="string"?ee.payload.message:JSON.stringify(ee.payload)]},`${ee.ts}-${Le}`)),a.jsx("div",{ref:zt})]})}),a.jsxs(Yf,{value:"inspector",className:"space-y-3 mt-3",children:[a.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(He,{className:"text-xs",children:"Filter by step"}),a.jsxs(In,{value:Ze,onValueChange:pt,children:[a.jsx(An,{className:"h-8",children:a.jsx($n,{})}),a.jsxs(En,{children:[a.jsx(ut,{value:"all",children:"All steps"}),(de?.stepStates??[]).map(ee=>a.jsxs(ut,{value:ee.id,children:[fe.get(ee.id),". ",ee.title]},ee.id))]})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(He,{className:"text-xs",children:"Filter by status"}),a.jsxs(In,{value:Lt,onValueChange:Ut,children:[a.jsx(An,{className:"h-8",children:a.jsx($n,{})}),a.jsxs(En,{children:[a.jsx(ut,{value:"all",children:"All"}),a.jsx(ut,{value:"ok",children:"Successful responses"}),a.jsx(ut,{value:"error",children:"Error responses"})]})]})]})]}),a.jsx("div",{className:"max-h-[34rem] min-w-0 space-y-2 overflow-auto",children:Bt.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No network exchanges captured yet."}):Bt.map(ee=>a.jsxs("details",{className:"rounded-md border p-3",children:[a.jsx("summary",{className:"cursor-pointer list-none",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0 flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border bg-muted text-xs font-semibold",children:fe.get(ee.stepId)}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-sm font-medium",children:ee.label}),a.jsxs("div",{className:"text-xs text-muted-foreground break-all",children:[ee.method?`${ee.method} `:"",ee.url]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(et,{variant:"outline",children:"request"}),a.jsx(et,{variant:"outline",children:"response"}),typeof ee.response?.status=="number"&&a.jsx(et,{variant:ee.response.status>=400?"destructive":"secondary",children:ee.response.status})]})]})}),a.jsxs("div",{className:"mt-3 space-y-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"mb-1 text-xs font-medium",children:"Request Headers"}),a.jsx("pre",{className:"max-h-40 max-w-full overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-xs",children:JSON.stringify(ee.request?.headers??{},null,2)})]}),ee.request?.bodyText&&a.jsxs("div",{children:[a.jsx("div",{className:"mb-1 text-xs font-medium",children:"Request Body"}),a.jsx("pre",{className:"max-h-64 max-w-full overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-xs",children:ee.request.bodyText})]}),a.jsxs("div",{children:[a.jsx("div",{className:"mb-1 text-xs font-medium",children:"Response Headers"}),a.jsx("pre",{className:"max-h-40 max-w-full overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-xs",children:JSON.stringify(ee.response?.headers??{},null,2)})]}),ee.response?.bodyText&&a.jsxs("div",{children:[a.jsx("div",{className:"mb-1 text-xs font-medium",children:"Response Body"}),a.jsx("pre",{className:"max-h-64 max-w-full overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-xs",children:ee.response.bodyText})]}),a.jsx("div",{className:"flex gap-2",children:a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{kD(JSON.stringify(ee,null,2))},children:[a.jsx(Hr,{className:"mr-2 h-4 w-4"}),"Copy JSON"]})})]})]},ee.key))})]})]})})]})})]})}),s==="report"&&de&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-semibold",children:"Report / Export"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"OAuth debug session summary, validations, and trace exports."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>o("configure"),children:"Back to Configure"}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{he("json")},children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export JSON"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{he("markdown")},children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export Markdown"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{he("raw")},children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Copy/Export Raw Trace"]})]})]}),a.jsxs(yl,{children:[a.jsx(Zy,{className:"h-4 w-4"}),a.jsx(bl,{children:"Secrets display mode"}),a.jsx(wl,{children:de.summary?.showSensitiveValues?"This session is configured to show full tokens and secrets in network logs/exports.":"Sensitive values are hidden in the inspector for this session."})]}),a.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Status"}),a.jsx("div",{className:"text-lg font-semibold",children:de.status})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Requests"}),a.jsx("div",{className:"text-lg font-semibold",children:de.networkSummary.requestCount})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Network errors"}),a.jsx("div",{className:"text-lg font-semibold",children:de.networkSummary.errorCount})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Validation findings"}),a.jsx("div",{className:"text-lg font-semibold",children:de.validations.length})]})})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Key values"})}),a.jsxs(Je,{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(He,{className:"text-xs",children:"Issuer"}),a.jsx("p",{className:"text-sm break-all",children:de.summary?.issuer||"-"})]}),a.jsxs("div",{children:[a.jsx(He,{className:"text-xs",children:"Client ID"}),a.jsx("p",{className:"text-sm break-all",children:de.summary?.clientId||"-"})]}),a.jsxs("div",{children:[a.jsx(He,{className:"text-xs",children:"Redirect URI"}),a.jsx("p",{className:"text-sm break-all",children:de.summary?.redirectUri||"-"})]}),a.jsxs("div",{children:[a.jsx(He,{className:"text-xs",children:"Token endpoint status"}),a.jsx("p",{className:"text-sm",children:de.summary?.tokenEndpointStatus??"-"})]}),a.jsxs("div",{children:[a.jsx(He,{className:"text-xs",children:"Token type"}),a.jsx("p",{className:"text-sm",children:de.summary?.tokenType||"-"})]}),a.jsxs("div",{children:[a.jsx(He,{className:"text-xs",children:"Scopes granted"}),a.jsx("p",{className:"text-sm break-all",children:(de.summary?.grantedScopes??[]).join(", ")||"-"})]}),a.jsxs("div",{children:[a.jsx(He,{className:"text-xs",children:"Token validity"}),a.jsxs("p",{className:"text-sm",children:[typeof de.summary?.accessTokenValidForSeconds=="number"?`${WN(de.summary.accessTokenValidForSeconds)} remaining`:typeof de.summary?.accessTokenExpiresInSeconds=="number"?`${WN(de.summary.accessTokenExpiresInSeconds)} from issuance`:"No expiry advertised by token endpoint",de.summary?.accessTokenExpiresAt?a.jsxs(a.Fragment,{children:[" (until ",a.jsx("span",{children:new Date(de.summary.accessTokenExpiresAt).toLocaleTimeString()}),")"]}):""]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Source:"," ",de.summary?.accessTokenExpirySource==="expires_in"?"token endpoint expires_in":de.summary?.accessTokenExpirySource==="jwt_exp"?"JWT exp claim":"not available"]})]}),a.jsxs("div",{children:[a.jsx(He,{className:"text-xs",children:"Refresh option"}),a.jsx("p",{className:"text-sm",children:de.summary?.refreshTokenAvailable?"Refresh token available (silent refresh possible)":"No refresh token in response (full login likely required after expiry)"})]}),de.summary?.accessToken&&a.jsxs("div",{className:"md:col-span-2 space-y-1",children:[a.jsx(He,{className:"text-xs",children:"Access token"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("code",{className:"flex-1 truncate rounded bg-muted px-2 py-1 text-xs font-mono text-muted-foreground",children:[de.summary.accessToken.slice(0,48),"…"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"shrink-0 h-7 px-2 text-xs",onClick:()=>{kD(de.summary.accessToken)},children:[a.jsx(Hr,{className:"mr-1 h-3 w-3"}),"Copy token"]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:['Visible because "Hide sensitive values" is off. Use this token with the CLI via'," ",a.jsx("code",{className:"font-mono",children:"--oauth-token"}),"."]})]})]})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Validation findings"})}),a.jsx(Je,{className:"space-y-2",children:de.validations.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No validation findings recorded."}):de.validations.map((ee,Le)=>a.jsxs("div",{className:"rounded-md border p-3",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-full border bg-muted px-1 text-[10px] font-semibold text-muted-foreground",children:Le+1}),a.jsx("span",{className:"font-bold",children:ee.title})]}),a.jsx(et,{variant:Ve(ee.severity),children:ee.severity})]}),a.jsxs("p",{className:"text-sm",children:[a.jsx("span",{className:"font-bold",children:"Finding:"})," ",ee.detail]}),ee.recommendation&&a.jsxs("div",{className:"mt-2 rounded-md border px-2.5 py-2 text-xs",children:[a.jsx("div",{className:"mb-1 font-medium text-muted-foreground",children:"Suggested improvement"}),a.jsx("p",{children:ee.recommendation})]}),a.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Step: ",ee.stepId,ee.specReference&&a.jsxs(a.Fragment,{children:[" · ",a.jsx("a",{href:ee.specReference,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"Spec reference"})]})]})]},ee.id))})]})]})]})}var hx="Switch",[M0e]=kr(hx),[I0e,$0e]=M0e(hx),pU=h.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:o,required:i,disabled:c,value:d="on",onCheckedChange:f,form:m,...p}=e,[v,x]=h.useState(null),j=Tt(t,C=>x(C)),y=h.useRef(!1),b=v?m||!!v.closest("form"):!0,[S,N]=Aa({prop:s,defaultProp:o??!1,onChange:f,caller:hx});return a.jsxs(I0e,{scope:n,checked:S,disabled:c,children:[a.jsx(lt.button,{type:"button",role:"switch","aria-checked":S,"aria-required":i,"data-state":vU(S),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:j,onClick:We(e.onClick,C=>{N(k=>!k),b&&(y.current=C.isPropagationStopped(),y.current||C.stopPropagation())})}),b&&a.jsx(gU,{control:v,bubbles:!y.current,name:r,value:d,checked:S,required:i,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});pU.displayName=hx;var hU="SwitchThumb",mU=h.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=$0e(hU,n);return a.jsx(lt.span,{"data-state":vU(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});mU.displayName=hU;var D0e="SwitchBubbleInput",gU=h.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...s},o)=>{const i=h.useRef(null),c=Tt(i,o),d=Jv(n),f=Hg(t);return h.useEffect(()=>{const m=i.current;if(!m)return;const p=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&x){const j=new Event("click",{bubbles:r});x.call(m,n),m.dispatchEvent(j)}},[d,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});gU.displayName=D0e;function vU(e){return e?"checked":"unchecked"}var xU=pU,L0e=mU;const Og=h.forwardRef(({className:e,...t},n)=>a.jsx(xU,{className:$e("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input 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",e),...t,ref:n,children:a.jsx(L0e,{className:$e("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Og.displayName=xU.displayName;function F0e(e){const t=e.filter(n=>typeof n.sourcePath=="string"&&n.sourcePath.trim().length>0&&typeof n.relativePath=="string"&&n.relativePath.trim().length>0).map(n=>[n.sourcePath,n.relativePath]);return new Map(t)}function z0e(e){const t=e.filter(n=>typeof n.sourcePath=="string"&&n.sourcePath.trim().length>0).map(n=>[n.sourcePath,n.configName?.trim()||n.name]);return new Map(t)}function B0e(e,t){const n=new Map;for(const r of e){if(!r.sourcePath)continue;const s=new Map,o=r.scenarioEntries&&r.scenarioEntries.length>0?r.scenarioEntries:r.scenarios.map(i=>({kind:"inline",scenario:i}));for(const i of o){if(i.kind==="inline"){s.set(i.scenario.id,i.scenario.name?.trim()||i.scenario.id);continue}const c=t.find(d=>d.id===i.ref);s.set(i.ref,c?.name?.trim()||i.ref)}n.set(r.sourcePath,s)}return n}function DS(e,t){const n=t.get(e);if(n)return n;const r=e.replace(/\\/g,"/"),s="/evals/",o=r.lastIndexOf(s);if(o>=0)return r.slice(o+s.length);const i=r.split("/").filter(Boolean);return i.length<=1?r:i.slice(-3).join("/")}function LS(e,t,n){const r=t.get(n);if(!e||e.length===0){if(r&&r.size===1){const o=r.values().next().value;if(o)return o}return"All scenarios"}if(!r)return e.length===1?e[0]:`${e[0]} +${e.length-1}`;const s=e.map(o=>r.get(o)??o);return s.length===1?s[0]:`${s[0]} +${s.length-1}`}const FS="mcplab.runEvaluation.activeJobId";function q0e(e){return e.configName?.trim()||e.name}function U0e(e){if(e.suitePath?.trim())return e.suitePath.trim();if(e.relativePath?.includes("/")){const t=e.relativePath.lastIndexOf("/");return e.relativePath.slice(0,t)}return null}function Gn(){return new Date().toLocaleTimeString()}const W0e=()=>{const[e]=Fo(),[t,n]=h.useState(""),[r,s]=h.useState("1"),[o,i]=h.useState(!1),[c,d]=h.useState(0),[f,m]=h.useState([]),[p,v]=h.useState(!1),[x,j]=h.useState(!1),[y,b]=h.useState(""),[S,N]=h.useState(null),[C,k]=h.useState([]),[A,E]=h.useState([]),[P,O]=h.useState(!1),[D,K]=h.useState([]),[q,B]=h.useState({}),[Y,z]=h.useState({}),[I,T]=h.useState(""),[V,H]=h.useState([]),[M,X]=h.useState([]),[$,F]=h.useState([]),[G,re]=h.useState(!1),[oe,ue]=h.useState(null),ae=h.useRef(null),ye=h.useRef(null),se=h.useRef(!1),{configs:de,reload:De}=up(),{source:ge}=Dn(),{agents:ve,scenarios:Se,servers:at,reload:tt}=Ts(),it=y.trim(),kt=it?`/results/${encodeURIComponent(it)}${t?`?configId=${encodeURIComponent(t)}`:""}`:"/results",Ye=de.find(fe=>fe.id===t),_e=h.useMemo(()=>F0e(de),[de]),Ee=h.useMemo(()=>z0e(de),[de]),Ze=h.useMemo(()=>B0e(de,Se),[de,Se]),pt=M[0]??null,Lt=e.get("configId"),Ut=h.useMemo(()=>{if(!Ye)return[];const fe=new Map,Ie=Ye.agentEntries&&Ye.agentEntries.length>0?Ye.agentEntries:Ye.agents.map(Ge=>({kind:"inline",agent:Ge}));for(const Ge of Ie){if(Ge.kind==="inline"){const le=Ge.agent.id;fe.has(le)||fe.set(le,Ge.agent);continue}const U=ve.find(le=>le.id===Ge.ref);U&&!fe.has(U.id)&&fe.set(U.id,U)}for(const Ge of ve)fe.has(Ge.id)||fe.set(Ge.id,Ge);return Array.from(fe.values())},[Ye,ve]),Nt=h.useMemo(()=>{if(!Ye)return[];const fe=new Map,Ie=Ye.scenarioEntries&&Ye.scenarioEntries.length>0?Ye.scenarioEntries:Ye.scenarios.map(Ge=>({kind:"inline",scenario:Ge}));for(const Ge of Ie){if(Ge.kind==="inline"){fe.has(Ge.scenario.id)||fe.set(Ge.scenario.id,Ge.scenario);continue}const U=Se.find(le=>le.id===Ge.ref);U&&!fe.has(U.id)&&fe.set(U.id,U)}return Array.from(fe.values())},[Ye,Se]),an=h.useMemo(()=>{const fe=new Map;for(const Ie of at)fe.has(Ie.id)||fe.set(Ie.id,{id:Ie.id,name:Ie.name});for(const Ie of Ye?.servers??[])fe.set(Ie.id,{id:Ie.id,name:Ie.name});return Array.from(fe.values()).sort((Ie,Ge)=>Ie.id.localeCompare(Ge.id))},[Ye?.servers,at]);h.useEffect(()=>{Lt&&de.some(fe=>fe.id===Lt)&&n(Lt)},[Lt,de]);const on=h.useRef("");h.useEffect(()=>{const fe=Ye?`${Ye.id}::${Ye.sourcePath??""}`:"";if(fe===on.current)return;if(on.current=fe,!Ye){k([]),E([]),O(!1),K([]),B({}),z({});return}const Ie=BN(Ye);k(Ie.length>0?Ie:Ut.map(Ge=>Ge.id)),E(Nt.map(Ge=>Ge.id)),O(!1),K([]),B({}),z({})},[Ye?.id,Ye?.sourcePath,Ut,Nt]);const zt=async()=>{if(!Ye?.sourcePath){m(we=>[...we,`[${Gn()}] Missing source path for selected config.`]);return}const fe=Ut.filter(we=>C.includes(we.id));if(fe.length===0){m(we=>[...we,`[${Gn()}] Select at least one agent.`]);return}const Ie=Nt.filter(we=>A.includes(we.id)),Ge=new Set(Ie.map(we=>we.id)),U=P||Object.values(q).some(Boolean),le=Object.fromEntries(Object.entries(Y).filter(([we])=>Ge.has(we)&&q[we])),pe=Ie.map(we=>{const W=le[we.id]??(P?D:we.serverIds||[]);return`${we.id}=[${W.join(", ")}]`}).join("; ");if(Ie.length===0){m(we=>[...we,`[${Gn()}] Select at least one test.`]);return}if(P&&D.length===0){m(we=>[...we,`[${Gn()}] Select at least one server for "Override MCP Servers for Selected Tests", or turn that override off.`]);return}const J=Object.entries(le).filter(([,we])=>!Array.isArray(we)||we.length===0).map(([we])=>we);if(J.length>0){m(we=>[...we,`[${Gn()}] Select at least one server for per-scenario overrides on: ${J.join(", ")}, or turn those overrides off.`]);return}const xe=Array.from(new Set(Ie.flatMap(we=>U?le[we.id]?le[we.id]??[]:P?D:we.serverIds||[]:we.serverIds||[]).filter(we=>{const W=(Ye.servers??[]).find(ke=>ke.id===we),he=at.find(ke=>ke.id===we);return(W||he)?.authType==="oauth2"})));try{xe.length>0&&(re(!0),await _o({serverNames:xe,source:ge,onServerAuthStart:we=>{m(W=>[...W,`[${Gn()}] OAuth login required for '${we}'. Complete the browser sign-in flow...`])}}),m(we=>[...we,`[${Gn()}] OAuth login completed for required server(s): ${xe.join(", ")}.`]))}catch(we){const W=we instanceof Error?we.message:String(we);m(he=>[...he,`[${Gn()}] OAuth error: ${W}`]),re(!1);return}finally{re(!1)}i(!0),v(!1),j(!1),b("");const be=(Ye.serverEntries??[]).some(we=>we.kind==="referenced")||(Ye.agentEntries??[]).some(we=>we.kind==="referenced")||(Ye.scenarioEntries??[]).some(we=>we.kind==="referenced")?"refs-composed":"single-file/inline";m([`[${Gn()}] Starting evaluation run...`,`[${Gn()}] Config=${Ye.name} mode=${be} agents=${fe.map(we=>we.name||we.id).join(", ")} tests=${Ie.map(we=>we.id).join(", ")} runs=${Number(r)}${I.trim()?` note=${I.trim()}`:""}`,`[${Gn()}] Effective MCP servers per selected test: ${pe||"(none)"}`]),d(10);try{const{jobId:we}=await ge.startRun({configPath:Ye.sourcePath,runsPerScenario:Number(r),agents:fe.map(W=>W.id),scenarioIds:Ie.map(W=>W.id),...U&&P?{serverOverrideAll:D}:{},...U&&Object.keys(le).length>0?{scenarioServerOverrides:le}:{},runNote:I.trim()?I.trim():void 0});N(we),Be(we),yt(we),qe()}catch(we){const W=we instanceof Error?we.message:String(we),he=W.includes("Anthropic model not found")?" Hint: this usually means the API key works but the model ID is not enabled for that Anthropic account. Change the agent model in Manage Agents (library) or inline config.":"";m(ke=>[...ke,`[${Gn()}] Error: ${W}${he}`]),i(!1),d(0),N(null),re(!1)}},sn=()=>{zt()},nn=()=>{S&&ge.stopRun(S),ye.current?.(),ye.current=null,Re(),N(null),i(!1),v(!1),j(!0),m(fe=>[...fe,`[${Gn()}] Run aborted by user.`]),qe()};h.useEffect(()=>{ae.current&&(ae.current.scrollTop=ae.current.scrollHeight)},[f]),h.useEffect(()=>()=>{ye.current?.()},[]),h.useEffect(()=>{if(S||p)return;let fe="";try{fe=sessionStorage.getItem(FS)??""}catch{fe=""}if(fe)return N(fe),i(!0),v(!1),j(!1),m(Ie=>Ie.length>0?Ie:[`[${Gn()}] Reattached to in-progress evaluation run...`]),yt(fe),()=>{}},[S,p]);const Re=()=>{try{sessionStorage.removeItem(FS)}catch{}},Be=fe=>{try{sessionStorage.setItem(FS,fe)}catch{}},qe=async()=>{try{const fe=await ge.getRunQueue();H(fe.queued),X(fe.active_jobs??(fe.active?[fe.active]:[])),F(fe.admitting_jobs??[]);const Ie=S==null?void 0:fe.queued.find(Ge=>Ge.jobId===S&&Ge.status==="blocked_auth"&&Ge.blockedReason==="oauth_required");Ie&&(Ie.requiredServers??[]).length>0?ue(Ge=>Ge?.jobId===Ie.jobId?Ge:{jobId:Ie.jobId,servers:Ie.requiredServers}):(oe?.jobId&&oe.jobId!==S||S!=null&&!fe.queued.some(Ge=>Ge.jobId===S&&Ge.status==="blocked_auth"&&Ge.blockedReason==="oauth_required"))&&ue(null)}catch{}},Bt=()=>{De(),tt()};h.useEffect(()=>{Bt(),qe();const fe=()=>{Bt(),qe()};return window.addEventListener("focus",fe),()=>{window.removeEventListener("focus",fe)}},[De,tt]);const Wt=async fe=>{try{await ge.removeQueuedRun(fe),H(Ie=>Ie.filter(Ge=>Ge.jobId!==fe))}catch(Ie){const Ge=Ie instanceof Error?Ie.message:String(Ie);if(Ge.includes("Use the /stop endpoint"))try{await ge.stopRun(fe)}catch{}else Me({title:"Could not remove queued run",description:Ge,variant:"destructive"})}qe()},yt=fe=>{S===fe&&ye.current||(ye.current?.(),ye.current=ge.subscribeRunJob(fe,Ie=>{const Ge=new Date(Ie.ts).toLocaleTimeString();if(Ie.type==="queued"){m(U=>{const le=Ie.payload.position?` (position ${Ie.payload.position})`:"",pe=`[${Ge}] Run queued${le}. Waiting for active run to finish...`;return U.includes(pe)?U:[...U,pe]}),d(5);return}if(Ie.type==="oauth_required"){const U=Array.isArray(Ie.payload.servers)?Ie.payload.servers:[],le=String(Ie.payload.jobId??"");ue({jobId:le,servers:U}),m(pe=>{const J=`[${Ge}] OAuth required for server(s): ${U.join(", ")}. Click "Connect & Resume" to authenticate.`;return pe.includes(J)?pe:[...pe,J]});return}if(Ie.type==="started"&&(ue(null),se.current=!1,i(!0),v(!1),j(!1),m(U=>{const le=`[${Ge}] Run started.`;return U.includes(le)?U:[...U,le]}),d(U=>Math.max(U,30)),qe()),Ie.type==="log"){const U=String(Ie.payload.message??"").trim();U&&(m(le=>{const pe=`[${Ge}] ${U}`;return le.includes(pe)?le:[...le,pe]}),d(le=>{const pe=U.toLowerCase();if(pe.startsWith("loading mcp evaluation config"))return Math.max(le,15);if(pe.startsWith("loaded config"))return Math.max(le,20);if(pe.startsWith("selected "))return Math.max(le,30);if(pe.startsWith("using requested agents")||pe.startsWith("using run default agents")||pe.startsWith("using config-declared agents"))return Math.max(le,35);if(pe.startsWith("expanded to "))return Math.max(le,45);if(pe.startsWith("running evaluation"))return Math.max(le,50);const J=pe.match(/^scenario (\d+)\/(\d+) finished:/);if(J){const xe=Number(J[1]),be=Number(J[2]);return Math.max(le,50+Math.round(xe/be*25))}return pe.startsWith("evaluation execution finished")?Math.max(le,78):pe.startsWith("writing results to ")?Math.max(le,94):pe.startsWith("run finished:")?Math.max(le,98):le}))}if(Ie.type==="completed"){const U=String(Ie.payload.runId??"").trim();ue(null),se.current=!1,m(le=>{const pe=`[${Ge}] Run completed.`;return le.includes(pe)?le:[...le,pe]}),d(100),i(!1),v(!0),j(!1),b(U),Re(),N(null),ye.current?.(),ye.current=null,qe()}if(Ie.type==="error"){const U=String(Ie.payload.message??"Unknown error"),le=U.includes("Anthropic model not found")?" Hint: this usually means the API key works but the model ID is not enabled for that Anthropic account. Change the agent model in Manage Agents (library) or inline config.":"";ue(null),se.current=!1,m(pe=>[...pe,`[${Ge}] Error: ${U}${le}`]),i(!1),v(!1),j(!1),d(0),Re(),N(null),ye.current?.(),ye.current=null,qe()}}))};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(Cs,{className:"h-6 w-6"}),"Run Evaluation"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Execute evaluation scenarios against MCP servers"})]}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-6 space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(He,{children:"MCP Evaluation"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(In,{value:t,onValueChange:n,children:[a.jsx(An,{children:a.jsx($n,{placeholder:"Select a config"})}),a.jsx(En,{children:de.map(fe=>{const Ie=U0e(fe);return a.jsxs(ut,{value:fe.id,children:[a.jsx("span",{children:q0e(fe)}),Ie&&a.jsxs("span",{className:"ml-2 text-muted-foreground",children:["(",Ie,")"]})]},fe.id)})})]}),a.jsx(Z,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0",onClick:Bt,"aria-label":"Refresh configs",title:"Refresh configs",children:a.jsx(Ka,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(He,{children:"Variance Runs"}),a.jsx(_t,{type:"number",min:"1",max:"10",value:r,onChange:fe=>s(fe.target.value)})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(He,{htmlFor:"run-note",children:"Run Note"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[I.length,"/500"]})]}),a.jsx(Es,{id:"run-note",value:I,onChange:fe=>T(fe.target.value.slice(0,500)),placeholder:"Optional context for this run (for example: mcp-server v1.8.2 #staging)",rows:2})]}),Ye&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(He,{children:"Agents"}),a.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[a.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>k(Ut.map(fe=>fe.id)),children:"Select all"}),a.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>k([]),children:"Clear"})]})]}),a.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:Ut.map(fe=>{const Ie=C.includes(fe.id);return a.jsxs("label",{className:"flex items-center gap-2 text-sm rounded-md border p-2",children:[a.jsx(wr,{checked:Ie,onCheckedChange:Ge=>{const U=Ge===!0;k(le=>U?[...le,fe.id]:le.filter(pe=>pe!==fe.id))}}),a.jsx("span",{children:fe.name||fe.id})]},fe.id)})}),Ut.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No agents available. Add agents to your workspace library, or define inline agents in this config."})]}),Ye&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(He,{children:"Tests"}),a.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[a.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>E(Nt.map(fe=>fe.id)),children:"Select all"}),a.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>E([]),children:"Clear"})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[A.length," of ",Nt.length," selected"]}),a.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:Nt.map(fe=>{const Ie=A.includes(fe.id),Ge=Y[fe.id],U=!!q[fe.id],le=U&&Array.isArray(Ge),pe=new Set(fe.serverIds||[]);return a.jsxs("div",{className:"flex flex-col gap-2 text-sm rounded-md border p-2 cursor-pointer",onClick:J=>{const xe=J.target;xe&&(xe.closest("button, a, input, select, textarea, [role='button']")||E(be=>Ie?be.filter(we=>we!==fe.id):[...be,fe.id]))},children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(wr,{checked:Ie,onCheckedChange:J=>{const xe=J===!0;E(be=>xe?[...be,fe.id]:be.filter(we=>we!==fe.id))}}),a.jsxs("span",{className:"min-w-0",children:[a.jsxs("span",{className:"block font-medium",children:[fe.name||fe.id," ",le&&a.jsx("span",{className:"rounded bg-primary/10 px-1.5 py-0.5 text-[10px] text-primary",children:"Override"})]}),a.jsx("span",{className:"block font-mono text-xs text-muted-foreground truncate",children:fe.id})]})]}),Ie&&a.jsxs("div",{className:"pl-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(He,{className:"text-[11px] text-muted-foreground",children:'Per-scenario: "Override MCP Servers"'}),a.jsx(Og,{checked:U,onCheckedChange:J=>{if(B(xe=>({...xe,[fe.id]:J})),!J)z(xe=>{const be={...xe};return delete be[fe.id],be});else if(!Y[fe.id]){const xe=P&&D.length>0?[...D]:[...fe.serverIds||[]];z(be=>({...be,[fe.id]:xe}))}}})]}),U&&a.jsx("div",{className:"mt-1 flex flex-wrap gap-1.5",children:an.map(J=>{const xe=J.id,be=(Ge??[]).includes(xe),we=pe.has(xe);return a.jsx(et,{variant:be?"default":"outline",className:`cursor-pointer text-xs ${be?"":"opacity-60 hover:opacity-100"}`,style:!be&&we?{borderColor:"hsl(var(--primary))"}:void 0,onClick:W=>{W.stopPropagation(),z(he=>{const ke=he[fe.id]??[],Ve=ke.includes(xe)?ke.filter(ee=>ee!==xe):[...ke,xe];return{...he,[fe.id]:Ve}})},children:J.name?.trim()?J.name:xe},xe)})})]})]},fe.id)})}),a.jsxs("div",{className:"space-y-1 rounded-md border p-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{children:"Override MCP Servers for selected Tests "}),a.jsx("span",{className:"text-muted-foreground",children:"Selected tests run against the servers you choose here. Applies only to this run."})]}),a.jsx(Og,{checked:P,onCheckedChange:O})]}),P&&a.jsx("div",{className:"flex flex-wrap gap-1.5",children:an.map(fe=>{const Ie=fe.id,Ge=D.includes(Ie);return a.jsx(et,{variant:Ge?"default":"outline",className:`cursor-pointer text-xs ${Ge?"":"opacity-60 hover:opacity-100"}`,onClick:()=>K(U=>U.includes(Ie)?U.filter(le=>le!==Ie):[...U,Ie]),children:fe.name?.trim()?fe.name:Ie},Ie)})})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Z,{onClick:sn,disabled:!t||G||Ut.length>0&&C.length===0||Nt.length>0&&A.length===0,children:[a.jsx(Cs,{className:"mr-2 h-4 w-4"}),pt?"Queue Run":"Run"]}),o&&a.jsxs(Z,{variant:"destructive",onClick:nn,children:[a.jsx(Kd,{className:"mr-2 h-4 w-4"}),"Stop"]})]})]})}),(o||f.length>0)&&a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Dt,{className:"text-base",children:"Progress"}),a.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:[Math.round(c),"%"]})]})}),a.jsxs(Je,{className:"space-y-4",children:[a.jsx(fx,{value:c,className:"h-2"}),oe&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-yellow-500/40 bg-yellow-500/10 px-3 py-2 text-sm",children:[a.jsxs("span",{className:"text-yellow-700 dark:text-yellow-400",children:["OAuth required for: ",a.jsx("strong",{children:oe.servers.join(", ")})]}),a.jsx(Z,{size:"sm",variant:"outline",disabled:G,onClick:()=>{se.current||(se.current=!0,re(!0),_o({serverNames:oe.servers,source:ge,onServerAuthStart:fe=>{m(Ie=>[...Ie,`[${Gn()}] OAuth sign-in opened for '${fe}'...`])}}).then(()=>ge.resumeQueue()).then(()=>{const fe=oe?.jobId;m(Ie=>[...Ie,`[${Gn()}] OAuth complete. Resuming run...`]),fe&&(N(fe),Be(fe),i(!0),v(!1),yt(fe))}).catch(fe=>{const Ie=fe instanceof Error?fe.message:String(fe);m(Ge=>[...Ge,`[${Gn()}] OAuth error: ${Ie}`]),se.current=!1}).finally(()=>{re(!1)}))},children:G?"Connecting...":"Connect & Resume"})]}),a.jsx("div",{ref:ae,className:"h-64 overflow-auto rounded-md border bg-muted/30 p-3 font-mono text-xs space-y-0.5",children:f.map((fe,Ie)=>a.jsx("div",{className:fe.includes("✓")?"text-success":fe.includes("aborted")?"text-destructive":"text-foreground",children:fe},Ie))})]})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(Dt,{className:"inline-flex items-center gap-2 text-base",children:[a.jsx(Ea,{className:"h-4 w-4"}),"Run Queue"]}),a.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>{qe()},children:a.jsx(Ka,{className:"h-3 w-3"})})]})}),a.jsx(Je,{children:!pt&&$.length===0&&V.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No active or queued runs. Start a run above."}):a.jsxs("div",{className:"space-y-2",children:[M.map(fe=>a.jsxs("div",{role:"button",tabIndex:0,className:`flex items-center justify-between rounded-md border border-primary/30 bg-primary/5 p-2 text-sm cursor-pointer hover:bg-primary/10 transition-colors ${S===fe.jobId?"ring-2 ring-primary/40":""}`,onClick:()=>{S!==fe.jobId&&(N(fe.jobId),Be(fe.jobId),i(!0),v(!1),j(!1),m([`[${Gn()}] Attached to running job ${fe.jobId}...`]),d(10),yt(fe.jobId))},onKeyDown:Ie=>{Ie.key!=="Enter"&&Ie.key!==" "||S!==fe.jobId&&(Ie.preventDefault(),N(fe.jobId),Be(fe.jobId),i(!0),v(!1),j(!1),m([`[${Gn()}] Attached to running job ${fe.jobId}...`]),d(10),yt(fe.jobId))},title:"Click to view progress",children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:"Running"}),a.jsx("span",{className:"text-xs font-bold",children:Ee.get(fe.runParams.configPath)||LS(fe.runParams.scenarioIds,Ze,fe.runParams.configPath)}),a.jsx("span",{className:"font-mono text-xs",children:DS(fe.runParams.configPath,_e)}),fe.runParams.agents&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["agents: ",fe.runParams.agents.join(", ")]}),fe.runParams.runNote&&a.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["note: ",fe.runParams.runNote]})]}),a.jsxs(Z,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-destructive hover:text-destructive hover:bg-destructive/10",onClick:Ie=>{Ie.stopPropagation(),ge.stopRun(fe.jobId),qe()},title:"Stop running job",children:[a.jsx(Kd,{className:"mr-1 h-3 w-3"}),"Stop"]})]},fe.jobId)),$.map(fe=>{const Ie=DS(fe.runParams.configPath,_e),Ge=LS(fe.runParams.scenarioIds,Ze,fe.runParams.configPath),U=Ee.get(fe.runParams.configPath)||Ge,le=fe.status==="blocked_auth";return a.jsx("div",{className:`flex items-center justify-between rounded-md border p-2 text-sm ${le?"border-yellow-500/40 bg-yellow-500/5":"border-primary/20 bg-primary/5"}`,children:a.jsxs("div",{className:"min-w-0 flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${le?"bg-yellow-500/15 text-yellow-700 dark:text-yellow-400":"bg-primary/10 text-primary"}`,children:le?"Retrying OAuth":"Starting"}),a.jsx("span",{className:"text-xs font-bold",children:U}),a.jsx("span",{className:"font-mono text-xs",children:Ie}),le&&(fe.requiredServers??[]).length>0&&a.jsxs("span",{className:"text-xs text-yellow-700 dark:text-yellow-400",children:["OAuth: ",fe.requiredServers.join(", ")]})]})},fe.jobId)}),V.map((fe,Ie)=>{const Ge=DS(fe.runParams.configPath,_e),U=LS(fe.runParams.scenarioIds,Ze,fe.runParams.configPath),le=Ee.get(fe.runParams.configPath)||U,pe=fe.status==="blocked_auth";return a.jsxs("div",{className:`flex items-center justify-between rounded-md border p-2 text-sm ${pe?"border-yellow-500/40 bg-yellow-500/5":""}`,children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-2 flex-wrap",children:[pe?a.jsxs("span",{className:"inline-flex items-center rounded-full bg-yellow-500/15 px-2 py-0.5 text-xs font-medium text-yellow-700 dark:text-yellow-400",children:["#",Ie+1," Blocked"]}):a.jsxs("span",{className:"inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:["#",Ie+1," Queued"]}),a.jsx("span",{className:"text-xs font-bold",children:le}),a.jsx("span",{className:"font-mono text-xs",children:Ge}),pe&&(fe.requiredServers??[]).length>0&&a.jsxs("span",{className:"text-xs text-yellow-700 dark:text-yellow-400",children:["OAuth: ",fe.requiredServers.join(", ")]}),!pe&&fe.runParams.agents&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["agents: ",fe.runParams.agents.join(", ")]}),fe.runParams.runNote&&a.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["note: ",fe.runParams.runNote]})]}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[pe&&a.jsx(Z,{size:"sm",variant:"outline",className:"h-7 text-xs border-yellow-500/50 text-yellow-700 dark:text-yellow-400 hover:bg-yellow-500/10",disabled:G,onClick:()=>{if(se.current)return;const J=fe.requiredServers??[];J.length!==0&&(se.current=!0,ue({jobId:fe.jobId,servers:J}),re(!0),_o({serverNames:J,source:ge,onServerAuthStart:xe=>{m(be=>[...be,`[${Gn()}] OAuth sign-in opened for '${xe}'...`])}}).then(()=>ge.resumeQueue()).then(()=>{m(xe=>[...xe,`[${Gn()}] OAuth complete. Resuming run...`]),N(fe.jobId),Be(fe.jobId),i(!0),v(!1),yt(fe.jobId)}).catch(xe=>{const be=xe instanceof Error?xe.message:String(xe);m(we=>[...we,`[${Gn()}] OAuth error: ${be}`]),se.current=!1}).finally(()=>{re(!1)}))},children:G&&oe?.jobId===fe.jobId?"Connecting...":"Connect & Resume"}),a.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",onClick:()=>{Wt(fe.jobId)},title:"Remove from queue",children:a.jsx(ua,{className:"h-4 w-4"})})]})]},fe.jobId)})]})})]}),x&&!o&&!p&&a.jsx(Qe,{className:"border-amber-300/60 bg-amber-50/40",children:a.jsx(Je,{className:"pt-6",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsx(Kd,{className:"h-5 w-5 text-amber-700"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-medium",children:"Run stopped"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"The evaluation was stopped before completion. You can start it again or clear the progress log."})]}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsx(Z,{type:"button",variant:"outline",onClick:()=>{m([]),d(0),j(!1)},children:"Clear Progress"}),a.jsxs(Z,{type:"button",onClick:sn,disabled:!t,children:[a.jsx(Cs,{className:"mr-2 h-4 w-4"}),"Run Again"]})]})]})})}),p&&a.jsx(Qe,{className:"border-success/50",children:a.jsx(Je,{className:"pt-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Wa,{className:"h-6 w-6 text-success"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"Evaluation Complete"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"All scenarios have been evaluated successfully."})]}),a.jsx(Z,{asChild:!0,className:"ml-auto",children:a.jsx(At,{to:kt,children:it?"View Results":"View Runs"})})]})})})]})};function yU({title:e,description:t,expanded:n,onToggleExpanded:r,onHide:s,messages:o,pendingToolCalls:i,loading:c,input:d,onInputChange:f,onSend:m,onCancel:p,inputPlaceholder:v,snippets:x,snippetsLabel:j="Result Assistant Snippets",onSnippetSelect:y,onApproveToolCall:b,onDenyToolCall:S,chatEndRef:N,inputRef:C,renderMessage:k,renderMessageExtras:A,className:E="min-w-0 overflow-hidden xl:flex xl:h-full xl:min-h-0 xl:flex-col",contentClassName:P="flex h-[70vh] min-h-[520px] flex-col p-0 xl:h-auto xl:min-h-0 xl:flex-1"}){return a.jsxs(Qe,{className:E,children:[a.jsx($t,{className:"border-b px-4 py-3",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Dt,{className:"flex items-center gap-2 text-base",children:[a.jsx(oa,{className:"h-4 w-4 text-amber-500"}),e]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:r,children:[n?a.jsx(KS,{className:"h-3.5 w-3.5"}):a.jsx(GS,{className:"h-3.5 w-3.5"}),n?"Compact":"Expand"]}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:s,children:"Hide"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:t})]})}),a.jsxs(Je,{className:P,children:[a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto bg-muted/15 px-4 py-4",children:a.jsxs("div",{className:"space-y-3 pr-2",children:[o.map((O,D)=>{const K=O.role==="user",q=O.role==="assistant",B=O.role==="system",Y=O.role==="tool",z=O.pendingToolCallId?i.find(T=>T.id===O.pendingToolCallId):void 0;return k?k({message:O,index:D,linkedPendingToolCall:z,isUser:K,isAssistant:q,isSystem:B,isTool:Y}):q&&!!O.pendingToolCallId?a.jsxs("div",{className:"rounded-md border bg-background p-3",children:[a.jsx(Va,{text:O.text,className:"text-sm"}),z&&a.jsx(qN,{call:z,loading:c,onApprove:b,onDeny:S,className:"mt-3"})]},`${O.id??`${O.role}-${D}`}-tool`):a.jsx(A8,{message:O},O.id??`${O.role}-${D}`)}),A,c&&a.jsx(E8,{}),a.jsx("div",{ref:N})]})}),a.jsx("div",{className:"border-t bg-background px-4 py-3",children:a.jsx(P8,{input:d,onInputChange:f,onSend:m,onCancel:p,inputPlaceholder:v,snippets:x,snippetsLabel:j,onSnippetSelect:y,loading:c,inputRef:C})})]})]})}function sa(e,t){if(!Number.isFinite(e)||e<=0)return"0ms";if(e<1e3)return`${Math.round(e)}ms`;if(t?.preciseUnderTenSeconds&&e<1e4){const i=e/1e3,c=Math.round(i*10)/10;return`${Number.isInteger(c)?c.toFixed(0):c.toFixed(1)}s`}const n=Math.floor(e/1e3),r=Math.floor(n/3600),s=Math.floor(n%3600/60),o=n%60;return r>0?`${r}h ${s}m ${o}s`:s>0?`${s}m ${o}s`:`${o}s`}function ZN(e){return e.runs.length>0?e.runs.reduce((t,n)=>t+n.duration,0):e.avgDuration}function Mg(e){return e.scenarios.some(n=>n.runs.length>0)?e.scenarios.reduce((n,r)=>n+ZN(r),0):typeof e.totalDurationMs=="number"&&e.totalDurationMs>=0?e.totalDurationMs:null}function eC(e){return e.runs.length>0?e.runs.reduce((t,n)=>t+n.toolCalls.reduce((r,s)=>r+s.duration,0),0):0}function Ig(e){return e.scenarios.some(n=>n.runs.length>0)?e.scenarios.reduce((n,r)=>n+eC(r),0):typeof e.totalToolDurationMs=="number"&&e.totalToolDurationMs>=0?e.totalToolDurationMs:null}const AD="hsl(152, 69%, 40%)",ED="hsl(0, 72%, 51%)",PD="hsl(215, 16%, 47%)";function vo(e,t=0){return e.toLocaleString(void 0,{maximumFractionDigits:t,minimumFractionDigits:t})}function $g({title:e,passed:t,failed:n,notEvaluated:r=0}){const s=[{name:"Passed",value:t,color:AD},{name:"Failed",value:n,color:ED},...r>0?[{name:"Not evaluated",value:r,color:PD}]:[]];return a.jsxs(Qe,{children:[a.jsx($t,{className:"p-2.5 pb-0",children:a.jsx(Dt,{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:e})}),a.jsxs(Je,{className:"flex h-[92px] items-center justify-center gap-2 p-0",children:[a.jsx("div",{className:"h-[82px] w-[82px] shrink-0",children:a.jsx(mf,{width:"100%",height:"100%",children:a.jsxs(ege,{children:[a.jsx(Uo,{data:s,dataKey:"value",nameKey:"name",innerRadius:"55%",outerRadius:"78%",paddingAngle:3,children:s.map(o=>a.jsx(jv,{fill:o.color},o.name))}),a.jsx(aa,{})]})})}),a.jsxs("div",{className:"space-y-0.5 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:AD}}),vo(t)," passed"]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:ED}}),vo(n)," failed"]}),r>0&&a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:PD}}),vo(r)," not evaluated"]})]})]})]})}function H0e({runs:e,loading:t}){const n=h.useMemo(()=>{const r=e.reduce((v,x)=>v+Math.max(0,x.totalRuns),0),s=e.reduce((v,x)=>v+Math.round(Math.max(0,x.totalRuns)*x.overallPassRate),0),o=Math.max(0,r-s),i=e.reduce((v,x)=>v+Math.max(0,x.totalScenarios),0),c=e.reduce((v,x)=>(v.passed+=x.checkCounts?.passed??0,v.failed+=x.checkCounts?.failed??0,v.not_evaluated+=x.checkCounts?.not_evaluated??0,v.total+=x.checkCounts?.total??0,v),{passed:0,failed:0,not_evaluated:0,total:0}),d=v=>r===0?0:e.reduce((x,j)=>x+v(j)*Math.max(0,j.totalRuns),0)/r,f=e.reduce((v,x)=>v+(x.toolTokenUsage?.totalTokens??0),0),m=e.reduce((v,x)=>v+(x.totalDurationMs??0),0),p=e.reduce((v,x)=>v+(x.totalToolDurationMs??0),0);return{totalRuns:r,passedRuns:s,failedRuns:o,checkCounts:c,totalScenarios:i,passRate:r===0?0:s/r,avgToolCalls:d(v=>v.avgToolCalls),avgLatency:d(v=>v.avgLatency),totalTokens:f,totalDurationMs:m,totalToolDurationMs:p}},[e]);return t?a.jsx(Qe,{children:a.jsx(Je,{className:"p-6 text-sm text-muted-foreground",children:"Calculating dashboard…"})}):e.length===0?a.jsx(Qe,{children:a.jsx(Je,{className:"p-6 text-sm text-muted-foreground",children:"No results in the selected range."})}):a.jsx("div",{className:"space-y-2","data-testid":"results-dashboard",children:a.jsxs("div",{className:"grid gap-3 lg:grid-cols-4",children:[a.jsx($g,{title:"Runs Pass / Fail",passed:n.passedRuns,failed:n.failedRuns}),a.jsx($g,{title:"Checks Pass / Fail",passed:n.checkCounts.passed,failed:n.checkCounts.failed,notEvaluated:n.checkCounts.not_evaluated}),a.jsxs("div",{className:"grid self-start content-start gap-3 sm:grid-cols-2 lg:col-span-2 lg:grid-cols-4",children:[a.jsx(nr,{compact:!0,title:"Scenarios",value:vo(n.totalScenarios),icon:mm}),a.jsx(nr,{compact:!0,title:"Total Runs",value:vo(n.totalRuns),icon:cC}),a.jsx(nr,{compact:!0,title:"Pass Rate",value:`${vo(n.passRate*100,1)}%`,icon:jl}),a.jsx(nr,{compact:!0,title:"Avg Tool Calls",value:vo(n.avgToolCalls,1),icon:Wa}),a.jsx(nr,{compact:!0,title:"Avg Latency",value:`${vo(n.avgLatency)}ms`,icon:mC}),a.jsx(nr,{compact:!0,title:"Tool Tokens",value:vo(n.totalTokens),icon:Ba}),n.totalDurationMs>0?a.jsx(nr,{compact:!0,title:"Total Time",value:sa(n.totalDurationMs),icon:Ea}):null,n.totalToolDurationMs>0?a.jsx(nr,{compact:!0,title:"Tool Duration",value:sa(n.totalToolDurationMs),icon:Ea}):null]})]})})}function Fd(e){return e instanceof UC&&e.status===404}function bU(e){const{source:t,open:n,scope:r,runId:s,onSessionSync:o}=e,[i,c]=h.useState(null),[d,f]=h.useState([]),[m,p]=h.useState([]),[v,x]=h.useState(""),[j,y]=h.useState(!1),[b,S]=h.useState(!1),N=h.useRef(null),C=h.useRef(null),k=h.useRef(0),A=h.useRef(t),E=h.useRef(o),P=h.useRef(null),O=h.useRef(null);h.useEffect(()=>{N.current=i},[i]),h.useEffect(()=>{A.current=t},[t]),h.useEffect(()=>{E.current=o},[o]);const D=h.useCallback(()=>{const M=C.current;M&&M.controller.abort()},[]),K=h.useCallback((M,X)=>{c(X??M.id),f($=>$.length>M.messages.length?$:M.messages),p(M.pendingToolCalls),E.current?.(M)},[]),q=h.useCallback(async(M,X)=>{const $=X.session.id||M;K(X.session,$)},[K]),B=h.useCallback(()=>{const M=C.current;M&&(D(),x(M.prompt),y(!1),S(!1))},[D]),Y=h.useCallback(async()=>{const M=v.trim();if(!M||r==="run"&&!s)return;const X=++k.current,$=new AbortController,F=`msg-local-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,G={id:F,role:"user",text:M,createdAt:new Date().toISOString()};C.current={id:X,controller:$,prompt:M},S(!0),x(""),f(re=>[...re,G]),y(!0);try{let re=i;if(!re){const oe=r==="run"&&s?await t.createResultAssistantSession({runId:s,scope:"run"},$.signal):await t.createResultAssistantSession({scope:"all_runs"},$.signal);if($.signal.aborted||C.current?.id!==X)return;re=oe.sessionId||oe.session.id,K(oe.session,re),f(ue=>ue.some(ye=>ye.id===F)?[...oe.session.messages,G]:oe.session.messages)}try{const oe=await t.sendResultAssistantMessage(re,M,$.signal);if($.signal.aborted||C.current?.id!==X)return;await q(re,oe)}catch(oe){if(UN(oe)||$.signal.aborted||C.current?.id!==X)return;if(!Fd(oe))throw oe;const ue=r==="run"&&s?await t.createResultAssistantSession({runId:s,scope:"run"},$.signal):await t.createResultAssistantSession({scope:"all_runs"},$.signal);if($.signal.aborted||C.current?.id!==X)return;const ae=ue.sessionId||ue.session.id;if(K(ue.session,ae),f(se=>se.some(De=>De.id===F)?[...ue.session.messages,G]:ue.session.messages),$.signal.aborted||C.current?.id!==X)return;const ye=await t.sendResultAssistantMessage(ae,M,$.signal);if($.signal.aborted||C.current?.id!==X)return;await q(ae,ye)}}catch(re){if(UN(re)||$.signal.aborted||C.current?.id!==X)return;f(oe=>oe.filter(ue=>ue.id!==F)),Me({title:"MCP Lab Assistant error",description:re instanceof Error?re.message:String(re),variant:"destructive"})}finally{C.current?.id===X&&(C.current=null,y(!1),S(!1))}},[v,r,s,i,t,K,q]),z=h.useCallback(async M=>{if(i){S(!1),y(!0);try{const X=await t.approveResultAssistantToolCall(i,M);await q(i,X)}catch(X){Fd(X)&&(c(null),p([])),Me({title:"Could not approve assistant action",description:Fd(X)?"Assistant session expired. Ask a new question to start a fresh session.":X instanceof Error?X.message:String(X),variant:"destructive"})}finally{y(!1)}}},[i,t,q]),I=h.useCallback(async M=>{if(i){S(!1),y(!0);try{const X=await t.denyResultAssistantToolCall(i,M);await q(i,X)}catch(X){Fd(X)&&(c(null),p([])),Me({title:"Could not deny assistant action",description:Fd(X)?"Assistant session expired. Ask a new question to start a fresh session.":X instanceof Error?X.message:String(X),variant:"destructive"})}finally{y(!1)}}},[i,t,q]),T=h.useCallback(()=>{D();const M=N.current;M&&t.closeResultAssistantSession(M).catch(()=>{}),N.current=null,c(null),f([]),p([]),x(""),S(!1)},[D,t]),V=h.useCallback(M=>{f(X=>X.length>0?X:[{id:`msg-${Date.now()}`,role:"assistant",text:M,createdAt:new Date().toISOString()}])},[]),H=h.useCallback(M=>{x(M),requestAnimationFrame(()=>O.current?.focus())},[]);return h.useEffect(()=>{if(!n)return;const M=window.setTimeout(()=>{P.current?.scrollIntoView({behavior:"smooth",block:"end"})},0);return()=>window.clearTimeout(M)},[n,d.length,j]),h.useEffect(()=>{const M=O.current;if(!M)return;M.style.height="0px";const X=Math.min(M.scrollHeight,160);M.style.height=`${Math.max(40,X)}px`},[v,n]),h.useEffect(()=>{if(!(!n||!i))return A.current.subscribeResultAssistantSessionEvents(i,M=>{K(M.payload.session,M.payload.sessionId)})},[n,i,K]),h.useEffect(()=>()=>{D();const M=N.current;M&&A.current.closeResultAssistantSession(M).catch(()=>{})},[D]),{assistantSessionId:i,assistantMessages:d,assistantPendingToolCalls:m,assistantInput:v,assistantLoading:j,assistantTurnCancelable:b,cancelAssistantTurn:B,assistantChatEndRef:P,assistantInputRef:O,setAssistantInput:x,setAssistantMessages:f,askAssistant:Y,approveResultAssistantToolCall:z,denyResultAssistantToolCall:I,applyResultAssistantSnippet:H,ensureIntroMessage:V,resetAssistantSession:T}}function hm(e){const t=String(e??"").trim();return t&&(t.split("::").pop()??t).replace(/^mcplab__/,"").replace(/^mcplab_/,"").replace(/_/g," ").replace(/\s+/g," ").trim()||"unknown_tool"}async function wU(e,t){const n=t.configPath?.trim();if(!n)throw new Error("This run has no config path in metadata.");const s=await e.getResult(t.id)??t,o=s.rerunAgents&&s.rerunAgents.length>0?s.rerunAgents:Array.from(new Set(s.scenarios.map(i=>i.agentId).filter(Boolean)));await e.startRun({configPath:n,runsPerScenario:1,scenarioIds:s.rerunScenarioIds,agents:o.length>0?o:void 0,runNote:s.runNote,serverOverrideAll:s.rerunServerOverrideAll,scenarioServerOverrides:s.rerunScenarioServerOverrides})}const RD=8,tC="mcplab:results:time-filter",jU="mcplab:results:dashboard-visible",kc=[{value:"15min",label:"Last 15min",durationMs:900*1e3},{value:"30min",label:"Last 30min",durationMs:1800*1e3},{value:"1h",label:"Last hour",durationMs:3600*1e3},{value:"24h",label:"Last 24 hours",durationMs:1440*60*1e3},{value:"7d",label:"Last 7 days",durationMs:10080*60*1e3},{value:"14d",label:"Last 14 days",durationMs:336*60*60*1e3},{value:"30d",label:"Last 30 days",durationMs:720*60*60*1e3}];function hl(e){if(!e.trim())return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t}function tm(e){const t=hl(e);return t?t.toLocaleString():""}function V0e(e){const t=hl(e);if(!t)return e;const n=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0");return`${n}-${r}-${s}`}function K0e(e){const t=hl(e);return t?t.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):"Unknown day"}function SU(e){return e==="all"||e==="last"||e==="custom"}function NU(e){return e==="15min"||e==="30min"||e==="1h"||e==="24h"||e==="7d"||e==="14d"||e==="30d"}function TD(e){const t=e.get("time_filter"),n=e.get("time_preset");return{mode:SU(t)?t:"all",preset:NU(n)?n:"15min",start:e.get("time_start")??"",end:e.get("time_end")??""}}function G0e(e){return e.has("time_filter")||e.has("time_preset")||e.has("time_start")||e.has("time_end")}function Y0e(){try{const e=localStorage.getItem(tC);if(!e)return null;const t=JSON.parse(e),n=SU(typeof t.mode=="string"?t.mode:null)?t.mode:"all",r=NU(typeof t.preset=="string"?t.preset:null)?t.preset:"15min";return{mode:n,preset:r,start:typeof t.start=="string"?t.start:"",end:typeof t.end=="string"?t.end:""}}catch{return null}}function X0e(){try{const e=localStorage.getItem(jU);return e===null?!0:e==="true"}catch{return!0}}const Q0e=[{label:"Summarize Run Trends",description:"Highlight the main changes across the selected runs.",prompt:"Summarize the main trends across these runs. Call out pass-rate changes, latency, and tool usage shifts."},{label:"Explain Failures",description:"Identify the most important failures and likely root causes.",prompt:"Identify the most important failures across these runs and explain likely root causes from the traces."},{label:"Compare Agents",description:"Compare agent behavior, tool use, and answer quality across runs.",prompt:"Compare agent behavior across these runs. Highlight differences in tool use, answer quality, and consistency."},{label:"Spot Anomalies",description:"Find outliers in latency, tool calls, or pass rate.",prompt:"Find unusual runs or outliers in latency, tool calls, or pass rate, and explain why they stand out."}],zd=100,J0e=()=>{const[e,t]=Fo(),{source:n}=Dn(),[r]=h.useState(()=>G0e(e)?TD(e):Y0e()??TD(e)),[s,o]=h.useState([]),[i,c]=h.useState([]),d=h.useRef(0),[f,m]=h.useState(!0),[p,v]=h.useState(X0e),[x,j]=h.useState(!1),[y,b]=h.useState(null),[S,N]=h.useState(!1),[C,k]=h.useState("timestamp"),[A,E]=h.useState("desc"),[P,O]=h.useState("all"),[D,K]=h.useState(!1),[q,B]=h.useState(r.mode),[Y,z]=h.useState(r.preset),[I,T]=h.useState(r.start),[V,H]=h.useState(r.end),[M,X]=h.useState(!1),[$,F]=h.useState(!1),[G,re]=h.useState(!1),{completionVersion:oe}=VL(),ue=px(zd),{offset:ae,totalCount:ye,hasMore:se}=ue,[de,De]=h.useState(null),ge=P==="all"?void 0:P,ve=h.useMemo(()=>{if(q==="all")return{};if(q==="last"){const be=kc.find(he=>he.value===Y)??kc[0],we=new Date;return{since:new Date(we.getTime()-be.durationMs).toISOString(),until:we.toISOString()}}const J=hl(I),xe=hl(V);return J&&xe?J.getTime()<=xe.getTime()?{since:J.toISOString(),until:xe.toISOString()}:{since:xe.toISOString(),until:J.toISOString()}:J?{since:J.toISOString()}:xe?{until:xe.toISOString()}:{}},[V,q,Y,I]),Se=J=>{if(C===J){E(xe=>xe==="asc"?"desc":"asc");return}k(J),E(J==="timestamp"?"desc":"asc")},at=h.useCallback(async()=>{if(!p||!n.listRunSummaries)return;const J=++d.current;m(!0);try{const xe=await n.listRunSummaries({...ve,scenario:ge});d.current===J&&c(xe.map(vi))}catch{d.current===J&&c([])}finally{d.current===J&&m(!1)}},[ge,ve,p,n]),tt=async()=>{j(!0);try{if(n.listRunSummariesPage){const J=await n.listRunSummariesPage({...ve,scenario:ge,limit:zd,offset:ae});ue.updateMeta(J),o(J.data.map(vi))}else if(n.listRunSummaries){const J=await n.listRunSummaries({...ve,scenario:ge,limit:zd,offset:ae});ue.setTotalCount(J.length),ue.setHasMore(!1),o(J.map(vi))}else ue.setTotalCount(0),ue.setHasMore(!1),o(await n.listResults());at()}catch(J){Me({title:"Could not load results",description:J instanceof Error?J.message:String(J),variant:"destructive"})}finally{j(!1)}};h.useEffect(()=>{let J=!0;return j(!0),(n.listRunSummariesPage?n.listRunSummariesPage({...ve,scenario:ge,limit:zd,offset:ae}).then(be=>(J&&ue.updateMeta(be),be.data.map(vi))):n.listRunSummaries?n.listRunSummaries({...ve,scenario:ge,limit:zd,offset:ae}).then(be=>(J&&(ue.setTotalCount(be.length),ue.setHasMore(!1)),be.map(vi))):n.listResults()).then(be=>{J&&o(be)}).catch(be=>{J&&Me({title:"Could not load results",description:be instanceof Error?be.message:String(be),variant:"destructive"})}).finally(()=>{J&&j(!1)}),()=>{J=!1}},[ge,ve,oe,ae,n]),h.useEffect(()=>{try{localStorage.setItem(jU,String(p))}catch{}},[p]),h.useEffect(()=>{at()},[oe,at]),h.useEffect(()=>{if(!(p&&n.listRunSummaries)){if(!p){m(!1);return}c(s),m(!1)}},[p,s,n]);const{assistantMessages:it,assistantPendingToolCalls:kt,assistantInput:Ye,assistantLoading:_e,assistantTurnCancelable:Ee,cancelAssistantTurn:Ze,assistantChatEndRef:pt,assistantInputRef:Lt,setAssistantInput:Ut,askAssistant:Nt,approveResultAssistantToolCall:an,denyResultAssistantToolCall:on,applyResultAssistantSnippet:zt,ensureIntroMessage:sn}=bU({source:n,open:$,scope:"all_runs"}),nn=h.useMemo(()=>{const J=new Map;return s.forEach(xe=>{xe.scenarios.forEach(be=>{const we=String(be.scenarioName??"").trim(),W=String(be.scenarioId??"").trim();if(W){J.set(W,we||W);return}we&&J.set(we,we)})}),Array.from(J.entries()).map(([xe,be])=>({value:xe,label:be})).sort((xe,be)=>xe.label.localeCompare(be.label))},[s]);h.useEffect(()=>{const J=(e.get("scenario")??"").trim();if(J){if(nn.some(xe=>xe.value===J||xe.label===J)){O(J);return}s.length>0&&O("all")}},[e,nn,s.length]),h.useEffect(()=>{const J=new URLSearchParams(e);q==="all"?(J.delete("time_filter"),J.delete("time_preset"),J.delete("time_start"),J.delete("time_end")):q==="last"?(J.set("time_filter","last"),J.set("time_preset",Y),J.delete("time_start"),J.delete("time_end")):(J.set("time_filter","custom"),J.delete("time_preset"),I.trim()?J.set("time_start",I.trim()):J.delete("time_start"),V.trim()?J.set("time_end",V.trim()):J.delete("time_end")),J.toString()!==e.toString()&&t(J,{replace:!0})},[e,t,V,q,Y,I]),h.useEffect(()=>{try{if(q==="all"){localStorage.removeItem(tC);return}const J={mode:q,preset:Y,start:I,end:V};localStorage.setItem(tC,JSON.stringify(J))}catch{}},[V,q,Y,I]);const Re=h.useMemo(()=>{if(n.listRunSummariesPage)return s;const J=P==="all"?s:s.filter(ke=>ke.scenarios.some(Ve=>{const ee=String(Ve.scenarioName??"").trim(),Le=String(Ve.scenarioId??"").trim();return ee===P||Le===P}));if(q==="all")return J;const xe=Date.now();if(q==="last"){const ke=kc.find(ee=>ee.value===Y)??kc[0],Ve=xe-ke.durationMs;return J.filter(ee=>{const Le=new Date(ee.timestamp).getTime();return Le>=Ve&&Le<=xe})}const be=hl(I)?.getTime()??null,we=hl(V)?.getTime()??null,W=be!==null&&we!==null?Math.min(be,we):be??null,he=be!==null&&we!==null?Math.max(be,we):we??null;return J.filter(ke=>{const Ve=new Date(ke.timestamp).getTime();return!(Number.isNaN(Ve)||W!==null&&Ve<W||he!==null&&Ve>he)})},[s,P,n.listRunSummariesPage,V,q,Y,I]);h.useEffect(()=>{ue.reset()},[ge,ve,ue.reset]);const Be=h.useMemo(()=>P==="all"?"All scenarios":nn.find(xe=>xe.value===P||xe.label===P)?.label??P,[P,nn]),qe=h.useMemo(()=>{if(q==="all")return"All time";if(q==="last")return kc.find(be=>be.value===Y)?.label??"Last range";const J=!!I.trim(),xe=!!V.trim();return!J&&!xe?"Custom range":J&&xe?`${tm(I)} - ${tm(V)}`:J?`From ${tm(I)}`:`Until ${tm(V)}`},[V,q,Y,I]),Bt=h.useMemo(()=>{const J=(be,we)=>be===null&&we===null?0:be===null?1:we===null?-1:A==="asc"?be-we:we-be;return[...Re].sort((be,we)=>{if(C==="toolTokens")return J(be.toolTokenUsage?.totalTokens??null,we.toolTokenUsage?.totalTokens??null);let W=0;return C==="id"&&(W=be.id.localeCompare(we.id)),C==="timestamp"&&(W=new Date(be.timestamp).getTime()-new Date(we.timestamp).getTime()),C==="passRate"&&(W=be.overallPassRate-we.overallPassRate),C==="scenarios"&&(W=be.totalScenarios-we.totalScenarios),C==="avgToolCalls"&&(W=be.avgToolCalls-we.avgToolCalls),A==="asc"?W:-W})},[Re,C,A]),Wt=h.useMemo(()=>{const J=[];let xe=null;for(const be of Bt){const we=V0e(be.timestamp);we!==xe&&(J.push({type:"day-separator",dayKey:we,dayLabel:K0e(be.timestamp)}),xe=we),J.push({type:"run",run:be})}return J},[Bt]),yt=J=>C!==J?a.jsx(zc,{className:"h-3.5 w-3.5 text-muted-foreground"}):A==="asc"?a.jsx(Ns,{className:"h-3.5 w-3.5"}):a.jsx(en,{className:"h-3.5 w-3.5"}),fe=J=>{const xe=J.toolTokenUsage?.totalTokens;return typeof xe=="number"?xe.toLocaleString():"n/a"},Ie=()=>{B("all"),z("15min"),T(""),H("")},Ge=h.useMemo(()=>{const J=new Map;for(const xe of Bt){if(xe.scenarios.length>0){J.set(xe.id,U_(xe));continue}const be=xe.configName?.trim()||"",we=xe.configPath?.trim()||"",W=be&&we?`${be} · ${we}`:be||we;J.set(xe.id,{scenarioCount:xe.totalScenarios,agentCount:0,scopePreview:W||"n/a",modelSummary:""})}return J},[Bt]),U=()=>{F(!0),sn("Ask me to compare runs, explain regressions over time, or summarize historical drift patterns.")},le=async J=>{N(!0);try{await n.deleteResult(J),o(xe=>xe.filter(be=>be.id!==J)),c(xe=>xe.filter(be=>be.id!==J)),ue.setTotalCount(xe=>Math.max(0,xe-1)),Me({title:"Run deleted",description:J}),b(null)}catch(xe){Me({title:"Could not delete run",description:xe instanceof Error?xe.message:String(xe),variant:"destructive"})}finally{N(!1)}},pe=async J=>{if(!J.configPath?.trim()){Me({title:"Cannot rerun",description:"This run has no config path in metadata.",variant:"destructive"});return}De(J.id);try{await wU(n,J),Me({title:"Rerun queued",description:`${J.id} queued with previous run settings.`})}catch(be){Me({title:"Could not rerun",description:be instanceof Error?be.message:String(be),variant:"destructive"})}finally{De(be=>be===J.id?null:be)}};return a.jsxs("div",{className:"flex flex-col",children:[a.jsx(Ps,{open:y!==null,onOpenChange:J=>{!J&&!S&&b(null)},children:a.jsxs(Qa,{children:[a.jsxs(Ja,{children:[a.jsx(es,{children:"Delete run?"}),a.jsxs(ts,{children:["This will permanently remove the run artifacts from disk for"," ",a.jsx("span",{className:"font-mono",children:y??""}),"."]})]}),a.jsxs(Za,{children:[a.jsx(rs,{disabled:S,children:"Cancel"}),a.jsx(ns,{disabled:S||!y,onClick:J=>{J.preventDefault(),y&&le(y)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:S?"Deleting...":"Delete run"})]})]})}),a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(jl,{className:"h-6 w-6"}),"Results"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Browse evaluation runs and open detailed results"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs(wi,{open:D,onOpenChange:K,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":D,"aria-controls":"results-scenario-command-list",className:`w-[260px] justify-between font-normal ${P!=="all"?"border-primary/40":""}`,children:[a.jsx("span",{className:"truncate text-left",children:Be}),a.jsx(en,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(ko,{className:"w-[260px] p-0",align:"start",children:a.jsxs(Ml,{children:[a.jsx(Il,{placeholder:"Search scenarios..."}),a.jsxs($l,{id:"results-scenario-command-list",children:[a.jsx(Dl,{children:"No scenarios found."}),a.jsxs(Ll,{children:[a.jsx(Na,{value:"all scenarios",onSelect:()=>{O("all"),K(!1)},children:"All scenarios"}),nn.map(J=>a.jsx(Na,{value:`${J.label} ${J.value}`,onSelect:()=>{O(J.value),K(!1)},children:J.label},J.value))]})]})]})})]}),a.jsxs(wi,{open:M,onOpenChange:X,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":M,"aria-controls":"results-time-command-list",className:`w-[320px] justify-between font-normal ${q!=="all"?"border-primary/40":""}`,children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2 truncate text-left",children:[a.jsx(g5,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:qe})]}),a.jsx(en,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsxs(ko,{className:"w-[360px] p-0",align:"start",children:[a.jsxs("div",{className:"border-b px-3 py-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"Date and time filter"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Filter runs by timestamp."})]}),a.jsxs("div",{id:"results-time-command-list",className:"grid gap-1 p-2",children:[a.jsx(Z,{type:"button",variant:q==="all"?"secondary":"ghost",className:"justify-start",onClick:()=>{Ie(),X(!1)},children:"All time"}),kc.map(J=>a.jsx(Z,{type:"button",variant:q==="last"&&Y===J.value?"secondary":"ghost",className:"justify-start",onClick:()=>{B("last"),z(J.value),X(!1)},children:J.label},J.value)),a.jsx(Z,{type:"button",variant:q==="custom"?"secondary":"ghost",className:"justify-start",onClick:()=>B("custom"),children:"Custom date time range"})]}),q==="custom"&&a.jsxs("div",{className:"space-y-3 border-t p-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(He,{htmlFor:"results-time-filter-start",children:"Start"}),a.jsx(_t,{id:"results-time-filter-start",type:"datetime-local",value:I,onChange:J=>T(J.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(He,{htmlFor:"results-time-filter-end",children:"End"}),a.jsx(_t,{id:"results-time-filter-end",type:"datetime-local",value:V,onChange:J=>H(J.target.value)})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"px-2",onClick:Ie,children:[a.jsx(ua,{className:"mr-1.5 h-3.5 w-3.5"}),"Clear"]}),a.jsx(Z,{type:"button",size:"sm",onClick:()=>X(!1),children:"Done"})]})]})]})]}),a.jsx(Z,{variant:"outline",onClick:()=>{tt()},disabled:x,children:x?"Refreshing...":"Refresh"}),a.jsx(Z,{variant:"outline",onClick:ue.prev,disabled:x||ae===0,children:"Prev"}),a.jsx(Z,{variant:"outline",onClick:ue.next,disabled:x||!se,children:"Next"}),a.jsxs(Z,{type:"button",variant:"outline",className:"gap-1.5",onClick:U,children:[a.jsx(oa,{className:"h-4 w-4 text-amber-500"}),"MCP Lab Assistant"]})]})]}),a.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:ue.rangeLabel(s.length)}),a.jsxs(Z,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 px-2 text-xs text-muted-foreground",onClick:()=>v(J=>!J),"aria-pressed":p,children:[a.jsx(dC,{className:"h-3 w-3"}),p?"Hide dashboard":"Show dashboard"]})]}),p?a.jsx("div",{className:"mt-2",children:a.jsx(H0e,{runs:i,loading:f})}):null,a.jsxs("div",{className:`mt-4 grid gap-6 ${$?G?"xl:grid-cols-[minmax(0,1fr)_52rem]":"xl:grid-cols-[minmax(0,1fr)_30rem]":"grid-cols-1"}`,children:[a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Vt,{children:[a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>Se("id"),children:["Run ID",yt("id")]})}),a.jsx(ct,{children:"Evaluated"}),a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>Se("timestamp"),children:["Timestamp",yt("timestamp")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex w-full items-center justify-end gap-1 hover:text-foreground",onClick:()=>Se("passRate"),children:["Pass Rate",yt("passRate")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>Se("scenarios"),children:["Scenarios",yt("scenarios")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>Se("avgToolCalls"),children:["Avg Tool Calls",yt("avgToolCalls")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>Se("toolTokens"),children:["Tool Tokens",yt("toolTokens")]})}),a.jsx(ct,{className:"w-10"})]})}),a.jsx(ca,{children:Wt.length===0?a.jsx(Vt,{children:a.jsx(Ue,{colSpan:RD,className:"px-4 py-10 text-center text-sm text-muted-foreground",children:q==="all"&&P==="all"?"No runs yet.":"No runs match current filters."})}):Wt.map((J,xe)=>J.type==="day-separator"?a.jsx(Vt,{className:"bg-muted/30 hover:bg-muted/30",children:a.jsx(Ue,{colSpan:RD,className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-px flex-1 bg-border/70"}),a.jsx("span",{className:"shrink-0 rounded-full border border-border bg-background px-2.5 py-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:J.dayLabel}),a.jsx("div",{className:"h-px flex-1 bg-border/70"})]})})},`day-${J.dayKey}-${xe}`):a.jsxs(Vt,{children:[a.jsx(Ue,{children:a.jsxs("div",{className:"space-y-1",children:[a.jsx(At,{to:`/results/${J.run.id}`,className:"font-mono text-xs text-primary hover:underline",children:J.run.id}),J.run.runNote?a.jsxs("div",{className:"text-[11px] text-muted-foreground break-words",children:["Note: ",J.run.runNote]}):null]})}),a.jsx(Ue,{className:"text-[11px] text-muted-foreground",children:(()=>{const be=Ge.get(J.run.id)??{scenarioCount:0,agentCount:0,scopePreview:"n/a",modelSummary:""};return a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{children:["Evaluated: ",be.scenarioCount," scenario",be.scenarioCount===1?"":"s"," · ",be.agentCount," agent",be.agentCount===1?"":"s",be.modelSummary?` · ${be.modelSummary}`:""]}),a.jsx("div",{className:"font-mono text-xs text-foreground/80",children:be.scopePreview})]})})()}),a.jsx(Ue,{className:"text-xs text-muted-foreground",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(J.run.timestamp).toLocaleString()]}),(()=>{const be=Mg(J.run);return be===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Total time: ",sa(be)]})})()]})}),a.jsx(Ue,{className:"text-right",children:a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(zs,{rate:J.run.overallPassRate}),J.run.checkCounts&&J.run.checkCounts.total>0?a.jsxs("span",{className:"font-mono text-[11px] leading-none","aria-label":`${J.run.checkCounts.passed} checks passed, ${J.run.checkCounts.failed} checks failed`,title:`${J.run.checkCounts.passed} passed · ${J.run.checkCounts.failed} failed${J.run.checkCounts.not_evaluated>0?` · ${J.run.checkCounts.not_evaluated} not evaluated`:""}`,children:[a.jsxs("span",{className:"text-success",children:[J.run.checkCounts.passed," ✓"]}),a.jsx("span",{className:"text-muted-foreground",children:" · "}),a.jsxs("span",{className:"text-destructive",children:[J.run.checkCounts.failed," ✕"]})]}):null,a.jsx(YL,{run:J.run})]})}),a.jsx(Ue,{className:"text-right font-mono text-sm",children:J.run.totalScenarios}),a.jsx(Ue,{className:"text-right font-mono text-sm",children:J.run.avgToolCalls.toFixed(0)}),a.jsx(Ue,{className:"text-right",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("div",{className:"font-mono text-sm",children:fe(J.run)}),(()=>{const be=Ig(J.run);return be===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Tool time: ",sa(be)]})})()]})}),a.jsx(Ue,{children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsxs(Z,{size:"sm",variant:"outline",disabled:de===J.run.id,onClick:()=>{pe(J.run)},children:[a.jsx(Cs,{className:"mr-1.5 h-3.5 w-3.5"}),de===J.run.id?"Queueing...":"Rerun"]}),a.jsxs(Sp,{children:[a.jsx(Np,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"More actions",children:a.jsx(zg,{className:"h-4 w-4"})})}),a.jsxs(Uu,{align:"end",children:[a.jsx(Ir,{asChild:!0,children:a.jsxs(At,{to:`/results/${J.run.id}`,children:[a.jsx(x5,{className:"mr-2 h-3.5 w-3.5"}),"View"]})}),Object.entries(J.run.langsmithTraceUrls??{}).map(([be,we])=>a.jsx(Ir,{asChild:!0,children:a.jsxs("a",{href:we,target:"_blank",rel:"noreferrer",children:[a.jsx(Yc,{className:"mr-2 h-3.5 w-3.5"}),"LangSmith trace"]})},be)),a.jsxs(Ir,{children:[a.jsx(zr,{className:"mr-2 h-3.5 w-3.5"}),"Export JSON"]}),a.jsxs(Ir,{className:"text-destructive",onSelect:be=>{be.preventDefault();const we=document.activeElement;we instanceof HTMLElement&&we.blur(),b(J.run.id)},children:[a.jsx(Ga,{className:"mr-2 h-3.5 w-3.5"}),"Delete"]})]})]})]})})]},J.run.id))})]})})}),$&&a.jsx(yU,{title:"MCP Lab Assistant",description:"Analyze historical differences and trends across all result runs.",expanded:G,onToggleExpanded:()=>re(J=>!J),onHide:()=>F(!1),messages:it,pendingToolCalls:kt,loading:_e,onCancel:Ee?Ze:void 0,input:Ye,onInputChange:Ut,onSend:()=>{Nt()},inputPlaceholder:"Ask about historical run differences...",snippets:Q0e,onSnippetSelect:J=>{F(!0),zt(J)},onApproveToolCall:J=>{an(J)},onDenyToolCall:J=>{on(J)},chatEndRef:pt,inputRef:Lt,className:"min-w-0 overflow-hidden xl:flex xl:h-[calc(100vh-14rem)] xl:min-h-0 xl:flex-col",renderMessage:({message:J,index:xe,linkedPendingToolCall:be,isUser:we,isAssistant:W,isSystem:he,isTool:ke})=>{const Ve=W&&!!J.pendingToolCallId;if(ke&&/^(Approved|Denied) tool call\b/i.test(String(J.text??"").trim()))return null;if(Ve){const ee=hm(be?.tool??J.toolRequestName??be?.publicToolName??J.toolRequestPublicName??"unknown_tool");return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("details",{open:!!be,className:"group min-w-0 w-full max-w-[92%] overflow-hidden rounded-md border border-border/60 bg-background",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2",children:[a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ba,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:`Tool call ${ee}`}),a.jsx("span",{className:`shrink-0 whitespace-nowrap rounded px-1.5 py-0.5 text-[10px] font-semibold ${be?"bg-amber-100 text-amber-900":"bg-muted text-muted-foreground"}`,children:be?"Needs approval":"Completed"})]})}),a.jsx(en,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),a.jsx("div",{className:"min-w-0 space-y-2 border-t border-border/50 px-3 py-2",children:a.jsx(Va,{text:J.text,className:"text-sm"})})]})]},`${J.id??`${J.role}-${xe}`}:tool`)}return a.jsxs("div",{className:`flex items-start gap-2 ${we?"justify-end":"justify-start"}`,children:[!we&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:he?a.jsx(fC,{className:"h-3 w-3"}):a.jsx(Wr,{className:"h-3 w-3"})}),a.jsx("div",{className:`min-w-0 max-w-[92%] break-words rounded-md border p-3 text-sm ${we?"border-primary/20 bg-primary/10":he?"border-amber-400/30 bg-amber-50/70":ke?"border-blue-300/30 bg-blue-50/50":"border-border/80 bg-background shadow-sm"}`,children:we?a.jsx("p",{className:"whitespace-pre-wrap",children:J.text}):a.jsx(Va,{text:J.text,className:"text-sm"})}),we&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(Xc,{className:"h-3 w-3"})})]},J.id??`${J.role}-${xe}`)}})]})]})};function Z0e(e){const t=e.scenarios.reduce((c,d)=>c+d.runs.filter(f=>f.passed).length,0),n=e.totalRuns-t,r={};e.scenarios.forEach(c=>c.runs.forEach(d=>d.toolCalls.forEach(f=>{r[f.name]=(r[f.name]||0)+1})));const s=Object.keys(r),o=Object.values(r),i=e.scenarios.map(c=>`
158
+ <div class="scenario-card">
159
+ <div class="scenario-header" onclick="this.parentElement.classList.toggle('open')">
160
+ <span class="chevron">▶</span>
161
+ <span class="scenario-name">${sl(c.scenarioName)}</span>
162
+ <span class="scenario-agent">${sl(c.agentName)}</span>
163
+ <span class="mono">${c.runs.length} runs</span>
164
+ <span class="badge ${c.passRate>=.8?"badge-pass":c.passRate>=.5?"badge-warn":"badge-fail"}">${Math.round(c.passRate*100)}%</span>
165
+ <span class="mono">${c.avgToolCalls.toFixed(1)} avg tools</span>
166
+ </div>
167
+ <div class="scenario-detail">
168
+ ${c.runs.map(d=>`
169
+ <div class="run-row">
170
+ <span class="run-status ${d.passed?"pass":"fail"}">${d.passed?"✓":"✗"}</span>
171
+ <span class="mono run-label">Run #${d.runIndex+1}</span>
172
+ <span class="mono run-duration">${d.duration}ms</span>
173
+ <div class="tool-pills">
174
+ ${d.toolCalls.map(f=>`<span class="pill">${sl(f.name)} <small>${f.duration}ms</small></span>`).join("")}
175
+ </div>
176
+ ${d.failureReasons.length?`<div class="failure-reasons">${d.failureReasons.map(f=>sl(f)).join(", ")}</div>`:""}
177
+ </div>`).join("")}
178
+ </div>
179
+ </div>`).join("");return`<!DOCTYPE html>
180
+ <html lang="en">
181
+ <head>
182
+ <meta charset="UTF-8">
183
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
184
+ <title>MCPLab Report — ${sl(e.id)}</title>
185
+ <script src="https://cdn.jsdelivr.net/npm/chart.js@4"><\/script>
186
+ <style>
187
+ *{box-sizing:border-box;margin:0;padding:0}
188
+ body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#f9fafb;color:#1f2937;padding:2rem;max-width:1100px;margin:0 auto}
189
+ h1{font-size:1.5rem;font-weight:700}
190
+ .mono{font-family:'JetBrains Mono',ui-monospace,monospace;font-size:.8rem}
191
+ .header{display:flex;align-items:center;gap:1rem;margin-bottom:.25rem}
192
+ .sub{font-size:.75rem;color:#6b7280;margin-bottom:1.5rem}
193
+ .stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:1rem;margin-bottom:2rem}
194
+ .stat{background:#fff;border:1px solid #e5e7eb;border-radius:.75rem;padding:1rem}
195
+ .stat-label{font-size:.7rem;color:#6b7280;text-transform:uppercase;letter-spacing:.05em}
196
+ .stat-value{font-size:1.5rem;font-weight:700;margin-top:.25rem}
197
+ .charts{display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-bottom:2rem}
198
+ .chart-card{background:#fff;border:1px solid #e5e7eb;border-radius:.75rem;padding:1rem}
199
+ .chart-card h3{font-size:.85rem;font-weight:600;margin-bottom:.75rem}
200
+ canvas{max-height:220px}
201
+ .scenario-card{background:#fff;border:1px solid #e5e7eb;border-radius:.75rem;margin-bottom:.75rem;overflow:hidden}
202
+ .scenario-header{display:flex;align-items:center;gap:.75rem;padding:.75rem 1rem;cursor:pointer;font-size:.85rem}
203
+ .scenario-header:hover{background:#f9fafb}
204
+ .chevron{font-size:.6rem;transition:transform .15s;color:#9ca3af}
205
+ .scenario-card.open .chevron{transform:rotate(90deg)}
206
+ .scenario-name{font-weight:600;flex:1}
207
+ .scenario-agent{color:#6b7280;font-size:.8rem}
208
+ .scenario-detail{display:none;border-top:1px solid #e5e7eb;padding:.75rem 1rem;background:#fafafa}
209
+ .scenario-card.open .scenario-detail{display:block}
210
+ .run-row{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;padding:.5rem 0;border-bottom:1px solid #f3f4f6;font-size:.8rem}
211
+ .run-row:last-child{border-bottom:none}
212
+ .run-status{font-weight:700;font-size:1rem}
213
+ .run-status.pass{color:#059669}
214
+ .run-status.fail{color:#dc2626}
215
+ .run-duration{color:#6b7280}
216
+ .tool-pills{display:flex;flex-wrap:wrap;gap:.25rem}
217
+ .pill{background:#fef3c7;color:#92400e;padding:2px 8px;border-radius:9999px;font-size:.7rem;font-family:'JetBrains Mono',monospace}
218
+ .pill small{color:#b45309;margin-left:2px}
219
+ .failure-reasons{width:100%;color:#dc2626;font-size:.75rem;margin-top:.25rem}
220
+ .badge{padding:2px 10px;border-radius:9999px;font-size:.75rem;font-weight:600}
221
+ .badge-pass{background:#d1fae5;color:#065f46}
222
+ .badge-warn{background:#fef3c7;color:#92400e}
223
+ .badge-fail{background:#fee2e2;color:#991b1b}
224
+ .footer{text-align:center;color:#9ca3af;font-size:.7rem;margin-top:2rem;padding-top:1rem;border-top:1px solid #e5e7eb}
225
+ </style>
226
+ </head>
227
+ <body>
228
+ <div class="header">
229
+ <h1 class="mono">${sl(e.id)}</h1>
230
+ <span class="badge ${e.overallPassRate>=.8?"badge-pass":e.overallPassRate>=.5?"badge-warn":"badge-fail"}">${Math.round(e.overallPassRate*100)}% pass</span>
231
+ </div>
232
+ <p class="sub">${new Date(e.timestamp).toLocaleString()} · Config hash: <span class="mono">${sl(e.configHash)}</span></p>
233
+
234
+ <div class="stats">
235
+ <div class="stat"><div class="stat-label">Scenarios</div><div class="stat-value">${e.totalScenarios}</div></div>
236
+ <div class="stat"><div class="stat-label">Total Runs</div><div class="stat-value">${e.totalRuns}</div></div>
237
+ <div class="stat"><div class="stat-label">Pass Rate</div><div class="stat-value">${Math.round(e.overallPassRate*100)}%</div></div>
238
+ <div class="stat"><div class="stat-label">Avg Tool Calls</div><div class="stat-value">${e.avgToolCalls.toFixed(1)}</div></div>
239
+ <div class="stat"><div class="stat-label">Avg Latency</div><div class="stat-value">${e.avgLatency}ms</div></div>
240
+ </div>
241
+
242
+ <div class="charts">
243
+ <div class="chart-card"><h3>Pass / Fail</h3><canvas id="pieChart"></canvas></div>
244
+ <div class="chart-card"><h3>Tool Usage</h3><canvas id="barChart"></canvas></div>
245
+ </div>
246
+
247
+ <h2 style="font-size:1rem;font-weight:600;margin-bottom:.75rem">Scenarios</h2>
248
+ ${i}
249
+
250
+ <div class="footer">Generated by MCPLab · ${new Date().toISOString()}</div>
251
+
252
+ <script>
253
+ new Chart(document.getElementById('pieChart'),{type:'doughnut',data:{labels:['Pass','Fail'],datasets:[{data:[${t},${n}],backgroundColor:['#059669','#dc2626'],borderWidth:0}]},options:{cutout:'60%',plugins:{legend:{position:'bottom',labels:{font:{size:11}}}}}});
254
+ new Chart(document.getElementById('barChart'),{type:'bar',data:{labels:${JSON.stringify(s)},datasets:[{data:${JSON.stringify(o)},backgroundColor:'#f59e0b',borderRadius:4}]},options:{indexAxis:'y',plugins:{legend:{display:false}},scales:{x:{grid:{display:false}},y:{grid:{display:false},ticks:{font:{family:'monospace',size:11}}}}}});
255
+ <\/script>
256
+ </body>
257
+ </html>`}function sl(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const ewe="mcplab.resultAssistantScenarioHandoff",twe=[{label:"Summarize Run Results",description:"Highlight failures first, then notable tool usage and extracted values.",prompt:"Summarize the scenario results in this run. Highlight failed scenarios/checks first, then mention notable tool usage and extracted values."},{label:"Compare Agent Answer Quality",description:"Rank agents by completeness, depth, and recommendation quality.",prompt:"Compare the answer quality across all agents for this run. Rank them by completeness, analytical depth, and usefulness of recommendations. Highlight concrete differences in tool usage."},{label:"Explain Key Failures",description:"Use traces and tool outputs to identify likely root causes.",prompt:"Identify the most important failures in this run and explain likely root causes using the trace and tool outputs."},{label:"Compare With Previous Run",description:"Summarize changes in outcomes, tool usage, and extracted values.",prompt:"Compare this run with the previous run and summarize changes in outcomes, tool usage, and extracted values."}];function OD(e){const t=new Date().toISOString().replace(/[:]/g,"-").replace(/\..+/,"");return`mcplab/reports/result-assistant/${e}-${t}.md`}function MD(e){const t=e.toFixed(1);return t.endsWith(".0")?t.slice(0,-2):t}const nwe=()=>{const{id:e}=ql(),t=ss(),[n]=Fo(),{source:r}=Dn(),s=n.get("embed")==="1",{configs:o}=up(),{scenarios:i}=Ts(),[c,d]=h.useState(void 0),[f,m]=h.useState(!0),[p,v]=h.useState(!1),[x,j]=h.useState(""),[y,b]=h.useState(!1),[S,N]=h.useState(new Set),[C,k]=h.useState(new Set),[A,E]=h.useState(""),[P,O]=h.useState(!1),[D,K]=h.useState(!1),[q,B]=h.useState("assistant"),[Y,z]=h.useState(null),[I,T]=h.useState(!1),[V,H]=h.useState(""),[M,X]=h.useState(""),[$,F]=h.useState(!1),[G,re]=h.useState(!1),[oe,ue]=h.useState(!1),[ae,ye]=h.useState([]),[se,de]=h.useState(!1),[De,ge]=h.useState(""),[ve,Se]=h.useState(null),[at,tt]=h.useState(!1),[it,kt]=h.useState(null),[Ye,_e]=h.useState(!1),[Ee,Ze]=h.useState(!1),[pt,Lt]=h.useState(!1),Ut=h.useRef(null),[Nt,an]=h.useState(!1),{assistantMessages:on,assistantPendingToolCalls:zt,assistantInput:sn,assistantLoading:nn,assistantTurnCancelable:Re,cancelAssistantTurn:Be,assistantChatEndRef:qe,assistantInputRef:Bt,setAssistantInput:Wt,askAssistant:yt,approveResultAssistantToolCall:fe,denyResultAssistantToolCall:Ie,applyResultAssistantSnippet:Ge,ensureIntroMessage:U,resetAssistantSession:le}=bU({source:r,open:P,scope:"run",runId:e,onSessionSync:void 0}),pe=h.useCallback(async(ne,Te)=>{de(!0);try{const bt=(await r.listMarkdownReports()).filter(Nn=>{const vn=String(Nn.relativePath??""),fn=String(Nn.name??"");return vn.includes(ne)||fn.includes(ne)});if(ye(bt),Te&&bt.length>0){const Nn=bt.find(vn=>vn.relativePath===Te||vn.path===Te||vn.relativePath.endsWith(Te)||vn.path.endsWith(Te));Nn&&ge(Nn.relativePath)}return bt}catch{return ye([]),[]}finally{de(!1)}},[r]);h.useEffect(()=>{if(!e)return;let ne=!0;return le(),m(!0),r.getResult(e).then(Te=>{ne&&(d(Te),j(Te?.runNote??""),v(!1),m(!1))}),()=>{ne=!1}},[e,r,le]),h.useEffect(()=>{const ne=Ut.current;if(!ne)return;const Te=()=>{an(ne.clientWidth<800)};if(Te(),typeof ResizeObserver<"u"){const gt=new ResizeObserver(()=>Te());return gt.observe(ne),()=>gt.disconnect()}return window.addEventListener("resize",Te),()=>window.removeEventListener("resize",Te)},[f]),h.useEffect(()=>{if(!c?.id){ye([]);return}let ne=!0;return(async()=>{const Te=await pe(c.id)})(),()=>{ne=!1}},[c?.id,pe]),h.useEffect(()=>{if(ae.length===0){ge(""),Se(null),kt(null);return}(!De||!ae.some(ne=>ne.relativePath===De))&&ge(ae[0].relativePath)},[ae,De]),h.useEffect(()=>{if(!P||q!=="reports")return;if(!De){Se(null),kt(null);return}let ne=!0;return tt(!0),kt(null),r.getMarkdownReport(De).then(Te=>{ne&&Se(Te)}).catch(Te=>{ne&&(Se(null),kt(Te instanceof Error?Te.message:String(Te)))}).finally(()=>{ne&&tt(!1)}),()=>{ne=!1}},[P,q,De,r]);const J=n.get("configId")??"",xe=(n.get("agent")??"").trim(),be=h.useMemo(()=>{const ne=J?o.find(pn=>pn.id===J):void 0;if(ne)return ne;if(!c)return;const Te=c.configPath?.trim(),gt=c.configName?.trim(),bt=o.find(pn=>pn.id===c.configId);if(bt)return bt;const Nn=pn=>[pn.relativePath,pn.sourcePath,pn.suitePath],vn=Te?o.find(pn=>Nn(pn).some(Yr=>Yr?.trim()===Te)):void 0;if(vn)return vn;const fn=Te?o.find(pn=>Nn(pn).some(Yr=>Yr?.endsWith(`/${Te}`)===!0)):void 0;return fn||o.find(pn=>gt?pn.name===gt||pn.configName===gt:!1)},[o,J,c]),we=h.useMemo(()=>{const ne=c?.configName?.trim();if(ne)return ne;const Te=c?.configPath?.trim();if(Te)return Te;const gt=be?.relativePath?.trim()||be?.name?.trim();return gt||c?.configId?.trim()||""},[c,be]),W=h.useMemo(()=>{const ne=c?.configName?.trim();return ne||be?.name?.trim()||""},[c,be]),he=h.useMemo(()=>{const ne=c?.configPath?.trim();return ne||be?.relativePath?.trim()||""},[c,be]),ke=h.useMemo(()=>{const ne=new Map;if(be){for(const Te of be.scenarios)ne.set(Te.id,Te),Te.name&&!ne.has(Te.name)&&ne.set(Te.name,Te);for(const Te of be.scenarioEntries??[]){if(Te.kind!=="referenced")continue;const gt=i.find(bt=>bt.id===Te.ref);gt&&(ne.set(gt.id,gt),gt.name&&ne.set(gt.name,gt),ne.has(Te.ref)||ne.set(Te.ref,gt))}}for(const Te of i)ne.has(Te.id)||ne.set(Te.id,Te),Te.name&&!ne.has(Te.name)&&ne.set(Te.name,Te);return ne},[be,i]),Ve=h.useMemo(()=>"",[]);h.useEffect(()=>{if(J&&o.some(ne=>ne.id===J)){E(J);return}Ve&&E(ne=>ne||Ve)},[J,o,Ve]);const{filteredScenarios:ee,filteredTotalRuns:Le,filteredPassCount:ot,displayPassRate:Ht,displayAvgToolCalls:Pe,displayAvgLatency:Zt,displayDurationMs:Ct,displayToolTimeMs:Xt,displayToolTokenUsage:Xn}=h.useMemo(()=>{if(!c)return{filteredScenarios:[],filteredTotalRuns:0,filteredPassCount:0,displayPassRate:0,displayAvgToolCalls:0,displayAvgLatency:0,displayDurationMs:null,displayToolTimeMs:null,displayToolTokenUsage:null};const ne=xe?c.scenarios.filter(fn=>fn.agentId===xe||fn.agentName===xe):c.scenarios,Te=ne.reduce((fn,pn)=>fn+pn.runs.length,0),gt=ne.reduce((fn,pn)=>fn+pn.runs.filter(Yr=>Yr.passed).length,0),bt=ne.reduce((fn,pn)=>fn+pn.runs.reduce((Yr,wt)=>Yr+wt.toolCalls.length,0),0),Nn=Mg({...c,scenarios:ne}),vn=Ig({...c,scenarios:ne});return{filteredScenarios:ne,filteredTotalRuns:Te,filteredPassCount:gt,displayPassRate:Te===0?0:gt/Te,displayAvgToolCalls:Te===0?0:bt/Te,displayAvgLatency:Te===0||Nn===null?0:Math.round(Nn/Te),displayDurationMs:Nn,displayToolTimeMs:vn,displayToolTokenUsage:LQ(ne.map(fn=>fn.toolTokenUsage))}},[c,xe]),qn=h.useMemo(()=>{const ne={};return ee.forEach(Te=>Te.runs.forEach(gt=>gt.toolCalls.forEach(bt=>{ne[bt.name]=(ne[bt.name]||0)+1}))),Object.entries(ne).map(([Te,gt])=>({name:Te,count:gt})).sort((Te,gt)=>gt.count-Te.count)},[ee]);if(f)return a.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Loading result..."});if(!c)return a.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Result not found"});const Li=Object.entries(c.mcpServerVersions??{}).map(([ne,Te])=>`${ne}: ${Te??"unknown"}`).join(", "),no=d1(ee.flatMap(ne=>ne.runs.flatMap(Te=>Te.checkResults??[]))),Fi=ne=>{N(Te=>{const gt=new Set(Te);return gt.has(ne)?gt.delete(ne):gt.add(ne),gt})},Ln=(ne,Te,gt,bt)=>`${ne}:${Te}:${gt}:${bt}`,zi=(ne,Te)=>`${ne}::${Te}`,ls=ne=>{k(Te=>{const gt=new Set(Te);return gt.has(ne)?gt.delete(ne):gt.add(ne),gt})},Ar=ne=>{const Te=!ne.endsWith(":conversation");return C.has(ne)?!Te:Te},Ho=(ne,Te)=>{B("assistant"),O(!0),z(Te?.scenarioId??null),U("Ask me to explain failures, tool usage, or suggest what to inspect next in this result."),ne&&Wt(ne)},jn=zt.filter(ne=>ne.status==="pending"&&!on.some(Te=>Te.pendingToolCallId===ne.id)),Vu=ne=>{B("reports"),O(!0)},Bi=()=>{B("note"),O(!0)},ie=ne=>{if(!c)return;if(!Y){Me({title:"No scenario context",description:"Ask about a specific scenario or run first, then send the suggestion.",variant:"destructive"});return}const Te=i.find(bt=>bt.id===Y)??i.find(bt=>bt.name===Y);if(!Te){Me({title:"Scenario not found in library",description:`Could not find library scenario '${Y}' to open in Scenario Assistant.`,variant:"destructive"});return}const gt=[`I am sending a suggestion from the Result Assistant for scenario '${Y}' based on run '${c.id}'.`,"Please review the suggestion, check it against the current scenario configuration, and propose concrete updates to the Checks and/or Value Capture Rules if appropriate.","","Result Assistant suggestion:",ne].join(`
258
+ `);try{window.sessionStorage.setItem(ewe,JSON.stringify({type:"result-assistant-handoff-v1",runId:c.id,configId:J||c.configId||"",scenarioId:Te.id,prompt:gt,sourceReply:ne})),t(`/libraries/test-cases/${encodeURIComponent(Te.id)}?assistantHandoff=1`)}catch(bt){Me({title:"Could not create handoff",description:bt instanceof Error?bt.message:String(bt),variant:"destructive"})}},nt=ne=>{c&&(ue(!1),H(ne),X(OD(c.id)),F(!1),T(!0))},Qt=()=>{c&&(ue(!0),H(""),X(OD(c.id)),F(!1),T(!0))},Et=async()=>{if(!c)return;if(!V.trim()){Me({title:"No markdown to write",description:"The selected assistant response is empty.",variant:"destructive"});return}re(!0);try{const Te=await r.applyResultAssistantReport({runId:c.id,markdown:V,outputPath:M.trim()||void 0,overwrite:$});Me({title:"Markdown report written",description:typeof Te.path=="string"&&Te.path?Te.path:Te.outputPath}),await pe(c.id,typeof Te.path=="string"&&Te.path||Te.outputPath||void 0),P&&B("reports"),T(!1)}catch(Te){Me({title:"Could not write markdown report",description:Te instanceof Error?Te.message:String(Te),variant:"destructive"})}finally{re(!1)}},Ft=async ne=>{try{await navigator.clipboard.writeText(ne),Me({title:"Copied"})}catch(Te){Me({title:"Could not copy",description:Te instanceof Error?Te.message:String(Te),variant:"destructive"})}},rn=async()=>{if(c){b(!0);try{const ne=x.trim();await r.updateRunNote(c.id,ne||void 0),d(Te=>Te&&{...Te,runNote:ne||void 0}),j(ne),v(!1),Me({title:"Run note saved"})}catch(ne){Me({title:"Could not save run note",description:ne instanceof Error?ne.message:String(ne),variant:"destructive"})}finally{b(!1)}}},sr=async()=>{if(c?.id){Ze(!0);try{await r.deleteResult(c.id),Me({title:"Run deleted",description:c.id}),t("/results")}catch(ne){Me({title:"Could not delete run",description:ne instanceof Error?ne.message:String(ne),variant:"destructive"})}finally{Ze(!1),_e(!1)}}},Sn=async()=>{if(!c?.id)return;if(!he.trim()){Me({title:"Cannot rerun",description:"This run has no config path in metadata.",variant:"destructive"});return}Lt(!0);try{await wU(r,c),Me({title:"Rerun queued",description:`${c.id} queued with previous run settings.`})}catch(Te){Me({title:"Could not rerun",description:Te instanceof Error?Te.message:String(Te),variant:"destructive"})}finally{Lt(!1)}};return a.jsxs("div",{className:`${P?"xl:flex xl:h-[calc(100vh-2rem-48px)] xl:min-h-0 xl:flex-col xl:overflow-hidden":""}`,children:[a.jsx("div",{className:`${P?"xl:shrink-0 xl:pb-6":"mb-6"}`,children:a.jsxs("div",{ref:Ut,className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[!s&&a.jsx(Z,{variant:"ghost",size:"icon",asChild:!0,children:a.jsx(At,{to:"/results",children:a.jsx(Si,{className:"h-4 w-4"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"text-2xl font-bold font-mono",children:c.id}),a.jsx(zs,{rate:Ht})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 align-middle",children:[a.jsx(eP,{className:"h-3 w-3 shrink-0"}),new Date(c.timestamp).toLocaleString()]}),a.jsx("span",{className:"mx-1",children:"·"}),xe?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"inline-flex items-center align-middle",children:["Agent: ",xe]}),a.jsx("span",{className:"mx-1",children:"·"})]}):null,W?a.jsxs("span",{className:"inline-flex items-center align-middle",children:["Eval: ",a.jsx("span",{className:"ml-1 font-medium",children:W})]}):null,W&&he?a.jsx("span",{className:"mx-1",children:"·"}):null,he?a.jsxs("span",{className:"inline-flex items-center align-middle",children:["Path: ",a.jsx("span",{className:"ml-1 font-mono",children:he})]}):null,!W&&!he&&we?a.jsxs("span",{className:"inline-flex items-center align-middle",children:["Config: ",a.jsx("span",{className:"ml-1 font-mono",children:we})]}):null]})]})]}),a.jsxs("div",{className:"flex w-full min-w-0 items-center justify-between gap-2 sm:ml-auto sm:w-auto",children:[Li?a.jsxs("span",{className:"inline-flex max-w-[18rem] min-w-0 items-center rounded-sm border border-border/60 bg-muted/30 px-1.5 py-1 text-[11px] text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"MCP:"}),a.jsx("span",{className:"ml-1 min-w-0 truncate font-mono",children:Li})]}):null,a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-2",children:[Object.entries(c.langsmithTraceUrls??{}).map(([ne,Te])=>a.jsxs("a",{href:Te,target:"_blank",rel:"noreferrer",className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-input bg-background px-3 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground","aria-label":"LangSmith trace",title:"Open LangSmith trace",children:[a.jsx(Yc,{className:"h-3.5 w-3.5"}),!s&&"LangSmith trace"]},ne)),a.jsxs(Z,{variant:"outline",size:"sm",className:`max-w-full gap-1.5 ${s?"px-2":""}`,onClick:()=>{const ne=Z0e(c),Te=new Blob([ne],{type:"text/html"}),gt=URL.createObjectURL(Te),bt=document.createElement("a");bt.href=gt,bt.download=`mcplab-report-${c.id}.html`,bt.click(),URL.revokeObjectURL(gt)},"aria-label":"Download Report",title:"Download Report",children:[a.jsx(zr,{className:"h-3.5 w-3.5"}),!s&&"Download Report"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5",onClick:()=>Vu(),disabled:se,children:[a.jsx(Mc,{className:"h-3.5 w-3.5"}),se?"Reports...":`Reports${ae.length?` (${ae.length})`:""}`]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5","aria-label":"Run Note",onClick:()=>Bi(),children:[a.jsx(Mc,{className:"h-3.5 w-3.5"}),Nt?"Note":"Run Note"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5","aria-label":"MCP Lab Assistant",onClick:()=>Ho(),children:[a.jsx(oa,{className:"h-4 w-4 text-amber-500"}),Nt?"Assistant":"MCP Lab Assistant"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5",onClick:()=>{Sn()},disabled:pt||!he.trim(),children:[a.jsx(Cs,{className:"h-3.5 w-3.5"}),pt?"Queueing...":"Rerun"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5 text-destructive",onClick:()=>_e(!0),disabled:Ee,"aria-label":Ee?"Deleting run":"Delete run",children:[Ee?a.jsx(_r,{className:"h-4 w-4 animate-spin"}):a.jsx(cl,{className:"h-4 w-4"}),Nt?null:Ee?"Deleting...":"Delete"]})]})]})]})}),a.jsxs("div",{className:`grid gap-6 items-start ${P?D?"xl:grid-cols-[minmax(0,1fr)_52rem] xl:flex-1 xl:min-h-0 xl:overflow-hidden":"xl:grid-cols-[minmax(0,1fr)_28rem] xl:flex-1 xl:min-h-0 xl:overflow-hidden":"grid-cols-1"}`,children:[a.jsxs("div",{className:`min-w-0 space-y-6 ${P?"xl:h-full xl:min-h-0 xl:overflow-y-auto xl:pr-2":""}`,children:[a.jsxs("div",{className:`grid gap-4 ${P?"grid-cols-3":"sm:grid-cols-2 lg:grid-cols-8"}`,children:[a.jsx(nr,{title:"Scenarios",value:ee.length,icon:mm}),a.jsx(nr,{title:"Total Runs",value:Le,icon:cC}),a.jsx(nr,{title:"Pass Rate",value:`${Math.round(Ht*100)}%`,icon:jl}),a.jsx(nr,{title:"Avg Tool Calls",value:MD(Pe),icon:Wa}),a.jsx(nr,{title:"Avg Latency",value:`${Zt}ms`,icon:mC}),Ct!==null?a.jsx(nr,{title:"Total Time",value:sa(Ct),icon:Ea}):null,Xt!==null?a.jsx(nr,{title:"Tool Duration",value:sa(Xt),icon:Ea}):null,a.jsx(nr,{title:"Tool Tokens",value:na(Xn?.totalTokens),icon:Ba})]}),a.jsxs("div",{className:"grid gap-4 lg:grid-cols-4",children:[a.jsx($g,{title:"Runs Pass / Fail",passed:ot,failed:Math.max(0,Le-ot)}),a.jsx($g,{title:"Checks Pass / Fail",passed:no.passed,failed:no.failed,notEvaluated:no.not_evaluated}),a.jsxs(Qe,{className:"lg:col-span-2",children:[a.jsx($t,{className:"p-2.5 pb-0",children:a.jsx(Dt,{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Tool Usage"})}),a.jsx(Je,{children:a.jsx(mf,{width:"100%",height:120,children:a.jsxs(Zme,{data:qn,layout:"vertical",children:[a.jsx(_i,{type:"number",tick:{fontSize:11}}),a.jsx(ki,{type:"category",dataKey:"name",tick:{fontSize:11},width:120}),a.jsx(aa,{}),a.jsx(Gl,{dataKey:"count",fill:"hsl(38, 92%, 50%)",radius:[0,4,4,0]})]})})})]})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(Dt,{className:"text-base",children:"Scenarios"}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1.5 px-2 text-xs",onClick:()=>Ho("Summarize the scenario results in this run. Highlight failed scenarios/checks first, then mention notable tool usage and extracted values."),children:[a.jsx(oa,{className:"h-4 w-4 text-amber-500"}),"Ask Assistant"]})]})}),a.jsx(Je,{className:"p-0",children:a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Vt,{children:[a.jsx(ct,{className:"w-8"}),a.jsx(ct,{children:"Scenario"}),a.jsx(ct,{children:"Agent"}),a.jsx(ct,{children:"Runs"}),a.jsx(ct,{children:"Pass Rate"}),a.jsx(ct,{children:"Checks"}),a.jsx(ct,{children:"Total Time"}),a.jsx(ct,{children:"Tool Calls"}),a.jsx(ct,{children:"Tool Tokens"}),a.jsx(ct,{children:"Tool Duration"})]})}),a.jsx(ca,{children:ee.map(ne=>{const Te=zi(ne.scenarioId,ne.agentName),gt=ne.scenarioName||ne.scenarioId,bt=d1(ne.runs.flatMap(wt=>wt.checkResults??[])),Nn=ne.runs.some(wt=>(wt.checkResults?.length??0)>0),vn=be?.id||c?.configId?.trim(),fn=vn?`/mcp-evaluations/${encodeURIComponent(vn)}/scenarios`:null,pn=i.find(wt=>wt.id===ne.scenarioId),Yr=pn?`/libraries/test-cases/${encodeURIComponent(pn.id)}?returnTo=${encodeURIComponent(`/results/${c?.id??e}`)}`:null;return a.jsx(ws,{open:S.has(Te),onOpenChange:()=>Fi(Te),asChild:!0,children:a.jsxs(a.Fragment,{children:[a.jsx(za,{asChild:!0,children:a.jsxs(Vt,{className:"cursor-pointer hover:bg-muted/50",children:[a.jsx(Ue,{children:a.jsx(en,{className:`h-4 w-4 transition-transform ${S.has(Te)?"rotate-180":""}`})}),a.jsx(Ue,{className:"font-medium text-sm",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{children:ne.scenarioName}),fn?a.jsx(At,{to:fn,"aria-label":"Edit scenario",title:"Edit scenario",className:"inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",onClick:wt=>wt.stopPropagation(),children:a.jsx(Zf,{className:"h-3.5 w-3.5"})}):null]})}),a.jsxs(Ue,{className:"text-sm",children:[a.jsx("div",{children:ne.agentName}),(ne.provider||ne.model)&&a.jsx("div",{className:"text-xs text-muted-foreground",children:[ne.provider?kg(ne.provider):null,ne.model].filter(Boolean).join(" · ")})]}),a.jsx(Ue,{className:"font-mono text-sm",children:ne.runs.length}),a.jsx(Ue,{children:a.jsx(zs,{rate:ne.passRate})}),a.jsx(Ue,{className:"font-mono text-sm",children:Nn?a.jsxs("span",{title:`${bt.passed} passed · ${bt.failed} failed${bt.not_evaluated?` · ${bt.not_evaluated} not evaluated`:""}`,"aria-label":`${bt.passed} checks passed, ${bt.failed} checks failed${bt.not_evaluated?`, ${bt.not_evaluated} not evaluated`:""}`,children:[a.jsxs("span",{className:"text-success",children:[bt.passed," ✓"]}),a.jsx("span",{className:"text-muted-foreground",children:" "}),a.jsxs("span",{className:"text-destructive",children:[bt.failed," ✕"]}),bt.not_evaluated>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted-foreground",children:" "}),a.jsxs("span",{children:[bt.not_evaluated," ?"]})]})]}):"—"}),a.jsx(Ue,{className:"font-mono text-sm",children:sa(ZN(ne),{preciseUnderTenSeconds:!0})}),a.jsx(Ue,{className:"font-mono text-sm",children:MD(ne.avgToolCalls)}),a.jsx(Ue,{className:"font-mono text-sm",children:na(ne.toolTokenUsage?.totalTokens)}),a.jsx(Ue,{className:"font-mono text-sm",children:sa(eC(ne),{preciseUnderTenSeconds:!0})})]})}),a.jsx(js,{asChild:!0,children:a.jsx("tr",{children:a.jsx("td",{colSpan:10,className:"p-0",children:a.jsxs("div",{className:"bg-muted/30 p-4 space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border bg-card px-3 py-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs font-semibold",children:"Scenario details"}),a.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[gt," · ",ne.agentName," ·"," ",Math.round(ne.passRate*100),"% pass rate ·"," ",Nn?`Checks ${bt.passed} ✓ · ${bt.failed} ✕ · `:"",na(ne.toolTokenUsage?.totalTokens)," tool tokens ·"," ",sa(ZN(ne),{preciseUnderTenSeconds:!0})," ","total time ·"," ",sa(eC(ne),{preciseUnderTenSeconds:!0})," ","tool time"]})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[Yr?a.jsx(Z,{asChild:!0,type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs text-muted-foreground",children:a.jsxs(At,{to:Yr,"aria-label":"Edit test case",children:[a.jsx(uC,{className:"h-3.5 w-3.5"}),"Edit test case"]})}):null,a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>Ho(`Explain why scenario '${gt}' failed (agent: ${ne.agentName}). Summarize the likely cause from the result details and suggest what to inspect next.`,{scenarioId:ne.scenarioId}),children:[a.jsx(oa,{className:"h-4 w-4 text-amber-500"}),"Ask Assistant"]})]})]}),ne.runs.map(wt=>a.jsxs("div",{className:"flex items-start gap-3 rounded-md border bg-card p-3 text-sm",children:[a.jsx("div",{className:"mt-0.5",children:wt.passed?a.jsx(Wa,{className:"h-4 w-4 text-success"}):a.jsx(cl,{className:"h-4 w-4 text-destructive"})}),a.jsxs("div",{className:"flex-1 space-y-1",children:[(()=>{const Qn=ke.get(ne.scenarioId),Vn=Qn?swe(Qn.evalRules,wt.failureReasons,wt.error,wt.checkResults):[],mr=Vn.filter(Ot=>Ot.status==="failed"),Vo=Vn.filter(Ot=>Ot.status==="passed"),ro=Vn.filter(Ot=>Ot.status==="not_evaluated");return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["Run #",wt.runIndex+1]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[wt.duration,"ms"]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[na(wt.toolTokenUsage?.totalTokens)," ","tool tokens"]}),!wt.passed&&a.jsx(et,{variant:"outline",className:"h-5 border-destructive/30 bg-destructive/10 text-destructive text-[10px]",children:"Failed"})]}),wt.failureReasons.length>0&&a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-2",children:[a.jsxs("p",{className:"mb-1 flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-destructive",children:[a.jsx(cl,{className:"h-3.5 w-3.5"}),"Failure reasons"]}),a.jsx("ul",{className:"space-y-1 text-xs text-destructive",children:wt.failureReasons.map((Ot,Ql)=>a.jsxs("li",{children:["• ",LD(Ot)]},Ql))})]}),Vn.length>0&&a.jsx(ws,{open:Ar(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"checks")),onOpenChange:()=>ls(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"checks")),children:a.jsxs("div",{className:"rounded-md border bg-muted/20 p-2",children:[a.jsx(za,{asChild:!0,children:a.jsxs("button",{type:"button",className:"mb-2 flex w-full flex-wrap items-center gap-2 text-left",children:[a.jsx(en,{className:`h-3.5 w-3.5 transition-transform ${Ar(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"checks"))?"rotate-180":""}`}),a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Checks"}),a.jsxs(et,{variant:"outline",className:"h-5 border-success/30 bg-success/10 text-success text-[10px]",children:[Vo.length," passed"]}),a.jsxs(et,{variant:"outline",className:`h-5 text-[10px] ${mr.length>0?"border-destructive/30 bg-destructive/10 text-destructive":""}`,children:[mr.length," failed"]}),ro.length>0&&a.jsxs(et,{variant:"outline",className:"h-5 border-muted-foreground/30 bg-muted text-[10px] text-muted-foreground",children:[ro.length," not evaluated"]})]})}),a.jsxs(js,{children:[ro.length>0&&a.jsx("p",{className:"mb-2 text-[11px] text-muted-foreground",children:"Checks were not evaluated because this run failed before evaluation."}),a.jsx("div",{className:"space-y-1",children:Vn.map((Ot,Ql)=>a.jsxs("div",{className:`flex items-start justify-between gap-2 rounded-md border px-2 py-1.5 text-xs ${Ot.status==="failed"?"border-destructive/20 bg-destructive/5":Ot.status==="not_evaluated"?"border-muted-foreground/20 bg-muted/40":"border-success/20 bg-success/5"}`,children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[Ot.status==="failed"?a.jsx(cl,{className:"h-3.5 w-3.5 shrink-0 text-destructive"}):Ot.status==="not_evaluated"?a.jsx(eP,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):a.jsx(Wa,{className:"h-3.5 w-3.5 shrink-0 text-success"}),a.jsx("span",{className:"font-medium",children:lx(Ot.rule)})]}),Ot.failureReason&&a.jsx("p",{className:"mt-1 pl-5 text-[11px] text-muted-foreground",children:LD(Ot.failureReason)})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${Ot.status==="failed"?"border-destructive/30 text-destructive":Ot.status==="not_evaluated"?"border-muted-foreground/30 text-muted-foreground":"border-success/30 text-success"}`,children:Ot.status})]},`${Ot.rule.type}-${Ot.rule.value??Ot.rule.path??""}-${Ql}`))})]})]})})]})})(),a.jsx(ws,{open:Ar(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"extracts")),onOpenChange:()=>ls(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"extracts")),children:a.jsxs("div",{className:"rounded-md border border-violet-500/20 bg-violet-500/5 p-2",children:[a.jsx(za,{asChild:!0,children:a.jsxs("button",{type:"button",className:"mb-2 flex w-full flex-wrap items-center justify-between gap-2 text-left",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx(en,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${Ar(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"extracts"))?"rotate-180":""}`}),a.jsxs("p",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(mm,{className:"h-3.5 w-3.5 text-violet-600"}),"Extracted values"]})]}),a.jsxs(et,{variant:"outline",className:"h-5 text-[10px]",children:[Object.keys(wt.extractedValues??{}).length," ","total"]})]})}),a.jsx(js,{children:Object.keys(wt.extractedValues??{}).length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No extracted values captured for this run."}):a.jsx("div",{className:"grid gap-1.5 sm:grid-cols-2",children:Object.entries(wt.extractedValues??{}).map(([Qn,Vn])=>a.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5 text-xs",children:[a.jsx("div",{className:"mb-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:Qn}),a.jsx("div",{className:"font-mono break-all text-foreground",children:Vn===null?"null":String(Vn)})]},Qn))})})]})}),a.jsx(ws,{open:Ar(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"tools")),onOpenChange:()=>ls(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"tools")),children:a.jsxs("div",{className:"rounded-md border border-sky-500/20 bg-sky-500/5 p-2",children:[a.jsx(za,{asChild:!0,children:a.jsxs("button",{type:"button",className:"mb-2 flex w-full flex-wrap items-center justify-between gap-2 text-left",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx(en,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${Ar(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"tools"))?"rotate-180":""}`}),a.jsxs("p",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(Ba,{className:"h-3.5 w-3.5 text-sky-600"}),"Tool call sequence"]})]}),a.jsxs(et,{variant:"outline",className:"h-5 text-[10px]",children:[wt.toolCalls.length," total"]})]})}),a.jsx(js,{children:wt.toolCalls.length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No tool calls captured for this run."}):a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"flex flex-wrap gap-1",children:a.jsx(Ro,{delayDuration:0,children:wt.toolCalls.map((Qn,Vn)=>{const mr=wt.conversation.filter(ro=>ro.kind==="tool_call")[Vn]?.estimatedTokens,Vo=typeof mr?.totalTokens=="number";return a.jsxs(To,{children:[a.jsx(Oo,{asChild:!0,children:a.jsxs(et,{variant:"outline",className:"font-mono text-xs bg-background",children:[a.jsxs("span",{className:"mr-1 text-muted-foreground",children:["#",Vn+1]}),Qn.name,a.jsxs("span",{className:"ml-1 text-muted-foreground",children:[Qn.duration,"ms"]}),Vo&&a.jsxs("span",{className:"ml-1 text-muted-foreground",children:["·"," ",na(mr?.totalTokens),"tok"]})]})}),Vo&&a.jsx(Gs,{className:"text-xs",children:`${Qn.name} · tokens total: ${na(mr?.totalTokens)} · in: ${na(mr?.inputTokens)} · out: ${na(mr?.outputTokens)}`})]},Vn)})})}),a.jsxs("div",{className:"rounded-md border bg-background p-2",children:[a.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Tool token estimate"}),a.jsx(et,{variant:"outline",className:"h-5 text-[10px]",children:"estimated"})]}),Object.keys(wt.toolTokenUsageByTool??{}).length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"n/a"}):a.jsx("div",{className:"grid gap-1.5 sm:grid-cols-2",children:Object.entries(wt.toolTokenUsageByTool??{}).map(([Qn,Vn])=>a.jsxs("div",{className:"rounded border bg-muted/30 px-2 py-1.5 text-xs",children:[a.jsx("div",{className:"font-mono text-[11px]",children:Qn}),a.jsxs("div",{className:"text-muted-foreground",children:["total:"," ",na(Vn.totalTokens)," ","· in:"," ",na(Vn.inputTokens)," ","· out:"," ",na(Vn.outputTokens)]})]},Qn))})]})]})})]})}),a.jsx(ws,{open:Ar(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"final")),onOpenChange:()=>ls(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"final")),children:a.jsxs("div",{className:"rounded-md border border-muted-foreground/20 bg-card p-2",children:[a.jsx(za,{asChild:!0,children:a.jsxs("button",{type:"button",className:"mb-2 flex w-full items-center gap-2 text-left",children:[a.jsx(en,{className:`h-3.5 w-3.5 transition-transform ${Ar(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"final"))?"rotate-180":""}`}),a.jsxs("p",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(Wr,{className:"h-3.5 w-3.5"}),"Final answer"]})]})}),a.jsx(js,{children:a.jsx(nC,{text:wt.finalAnswer||"No final answer captured.",maxLength:1200,className:"text-xs text-foreground"})})]})}),a.jsx(ws,{open:Ar(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"conversation")),onOpenChange:()=>ls(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"conversation")),children:a.jsxs("div",{className:"rounded-md border bg-muted/10 p-2",children:[a.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[a.jsx(za,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2 text-left",children:[a.jsx(en,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${Ar(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"conversation"))?"rotate-180":""}`}),a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Conversation trace"})]})}),a.jsx("div",{className:"flex flex-wrap gap-2",children:a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>Ho(`Explain Run #${wt.runIndex+1} for scenario '${gt}'. It ${wt.passed?"passed":"failed"} in ${wt.duration}ms. Focus on the tool sequence and ${wt.passed?"why it passed":"what caused the failure"}.`,{scenarioId:ne.scenarioId}),children:[a.jsx(oa,{className:"h-4 w-4 text-amber-500"}),"Ask Assistant"]})})]}),a.jsx(js,{children:a.jsx("div",{className:"space-y-2 rounded-md border bg-muted/20 p-2",children:wt.conversation.length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No conversation trace captured."}):wt.conversation.map(Qn=>a.jsx(rwe,{item:Qn,fallbackUserPrompt:ke.get(ne.scenarioId)?.prompt},Qn.id))})}),!Ar(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"conversation"))&&a.jsx("button",{type:"button",className:"text-xs text-muted-foreground underline decoration-dotted underline-offset-2 hover:text-foreground",onClick:()=>ls(Ln(ne.scenarioId,ne.agentName,wt.runIndex,"conversation")),children:"Expand to inspect user/assistant/tool messages for this run."})]})})]})]},wt.runIndex))]})})})})]})},Te)})})]})})]})]}),P&&a.jsxs("div",{className:"min-w-0 space-y-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col",children:[a.jsx(rx,{value:q,onValueChange:ne=>B(ne),className:"min-w-0 -mb-px px-3 pt-1",children:a.jsxs(Cp,{className:"h-auto w-full justify-start rounded-none border-b bg-transparent p-0",children:[a.jsx(Vs,{value:"assistant",className:"-mb-px h-9 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-3 text-xs text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"Assistant"}),a.jsx(Vs,{value:"reports",className:"-mb-px h-9 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-3 text-xs text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"Reports"}),a.jsx(Vs,{value:"note",className:"-mb-px h-9 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-3 text-xs text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"Note"})]})}),q==="assistant"?a.jsx(yU,{title:"MCP Lab Assistant",description:"Ask questions about this run result, failures, and tool usage.",expanded:D,onToggleExpanded:()=>K(ne=>!ne),onHide:()=>O(!1),messages:on,pendingToolCalls:zt,loading:nn,onCancel:Re?Be:void 0,input:sn,onInputChange:Wt,onSend:()=>{yt()},inputPlaceholder:"Ask about this result...",snippets:twe,onSnippetSelect:Ge,onApproveToolCall:ne=>{fe(ne)},onDenyToolCall:ne=>{Ie(ne)},chatEndRef:qe,inputRef:Bt,className:"min-w-0 overflow-hidden rounded-t-none xl:flex xl:h-full xl:min-h-0 xl:flex-col",renderMessage:({message:ne,index:Te,linkedPendingToolCall:gt,isUser:bt,isAssistant:Nn,isSystem:vn,isTool:fn})=>{const pn=Nn&&!!ne.pendingToolCallId;if(fn&&/^(Approved|Denied) tool call\\b/i.test(String(ne.text??"").trim()))return null;const Yr=gt?.tool??ne.toolRequestName,wt=gt?.publicToolName??ne.toolRequestPublicName,Qn=Nn&&!pn&&awe(ne.text,!!Y);if(pn){const mr=gt?.status==="pending",Vo=hm(Yr??wt??"unknown_tool");return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("details",{open:!!gt,className:"group min-w-0 w-full max-w-[92%] overflow-hidden rounded-md border border-border/60 bg-background",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2",children:[a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ba,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:`Tool call ${Vo}`}),a.jsx("span",{className:`shrink-0 whitespace-nowrap rounded px-1.5 py-0.5 text-[10px] font-semibold ${mr?"bg-amber-100 text-amber-900":"bg-muted text-muted-foreground"}`,children:mr?"Needs approval":"Completed"})]})}),a.jsx(en,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),a.jsxs("div",{className:"min-w-0 space-y-2 border-t border-border/50 px-3 py-2",children:[a.jsx(Va,{text:ne.text,className:"text-sm"}),mr&&gt&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"max-h-40 min-w-0 w-full max-w-full overflow-x-auto overflow-y-auto whitespace-pre-wrap break-words rounded border bg-muted/50 p-2 text-xs",children:a.jsx("code",{className:"break-words",children:JSON.stringify(gt.arguments??{},null,2)})}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-xs",disabled:nn,onClick:()=>{Ie(gt.id)},children:"Deny"}),a.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:nn,onClick:()=>{fe(gt.id)},children:"Approve"})]})]})]})]})]},`${ne.id??`${ne.role}-${Te}`}:${gt?"pending":"completed"}`)}const Vn=bt||Nn&&!fn&&!vn;return a.jsxs("div",{className:`flex items-start gap-2 ${bt?"justify-end":"justify-start"}`,children:[!bt&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:vn?a.jsx(fC,{className:"h-3 w-3"}):a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("div",{className:"relative max-w-[92%]",children:[a.jsxs("div",{className:`max-w-full rounded-md border p-3 text-sm ${bt?"border-primary/20 bg-primary/10":vn?"border-amber-400/30 bg-amber-50/70":fn?"border-blue-300/30 bg-blue-50/50":"border-border/80 bg-background shadow-sm"}`,children:[!(bt||vn)&&a.jsx("p",{className:`mb-2 text-[11px] font-semibold text-muted-foreground ${bt?"text-right":""}`,children:fn?"Tool":"Assistant"}),bt?a.jsx("p",{className:"whitespace-pre-wrap",children:ne.text}):a.jsx(Va,{text:ne.text,className:"text-sm"}),Qn&&a.jsxs("div",{className:"mt-3 flex max-w-full flex-wrap justify-end gap-2 overflow-x-auto pb-1",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>ie(ne.text),children:[a.jsx(oa,{className:"h-4 w-4 text-amber-500"}),"Send to Scenario Assistant"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>nt(ne.text),children:[a.jsx(Ba,{className:"h-3.5 w-3.5"}),"Apply: Write Markdown Report"]})]}),!Qn&&Nn&&!pn&&a.jsx("div",{className:"mt-3 flex max-w-full justify-end overflow-x-auto pb-1",children:a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>nt(ne.text),children:[a.jsx(Ba,{className:"h-3.5 w-3.5"}),"Apply: Write Markdown Report"]})})]}),Vn&&a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"absolute -right-8 bottom-1 h-6 w-6 text-muted-foreground",onClick:()=>{Ft(ne.text)},"aria-label":"Copy message",title:"Copy message",children:a.jsx(Hr,{className:"h-3.5 w-3.5"})})]}),bt&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(Xc,{className:"h-3 w-3"})})]},ne.id??`${ne.role}-${Te}`)},renderMessageExtras:jn.length>0?a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Pending actions (approve/deny)"}),jn.map(ne=>a.jsxs("details",{open:!0,className:"group min-w-0 rounded-md border bg-background",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-2 p-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"break-all font-mono text-xs font-semibold",children:hm(ne.publicToolName)}),a.jsxs("p",{className:"break-all text-xs text-muted-foreground",children:[ne.server,"::",hm(ne.tool)]})]}),a.jsx(en,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),a.jsxs("div",{className:"border-t px-3 pb-3 pt-2",children:[a.jsx("pre",{className:"max-h-48 min-w-0 w-full max-w-full overflow-x-auto overflow-y-auto whitespace-pre-wrap break-words rounded border bg-muted/50 p-2 text-xs",children:a.jsx("code",{className:"break-words",children:JSON.stringify(ne.arguments??{},null,2)})}),a.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-xs",disabled:nn,onClick:()=>{Ie(ne.id)},children:"Deny"}),a.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:nn,onClick:()=>{fe(ne.id)},children:"Approve"})]})]})]},ne.id))]}):null}):q==="reports"?a.jsxs(Qe,{className:"min-w-0 overflow-hidden rounded-t-none xl:flex xl:h-full xl:min-h-0 xl:flex-col",children:[a.jsx($t,{className:"border-b px-4 py-3",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Dt,{className:"flex items-center gap-2 text-base",children:[a.jsx(Mc,{className:"h-4 w-4 text-muted-foreground"}),"Reports"]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:()=>K(ne=>!ne),children:[D?a.jsx(KS,{className:"h-3.5 w-3.5"}):a.jsx(GS,{className:"h-3.5 w-3.5"}),D?"Compact":"Expand"]}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>O(!1),children:"Hide"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Review markdown reports for this run while keeping the result visible."})]})}),a.jsxs(Je,{className:"flex h-[70vh] min-h-[520px] flex-col p-0 xl:h-auto xl:min-h-0 xl:flex-1",children:[(se||ae.length===0||ae.length>1)&&a.jsx("div",{className:"border-b px-4 py-3",children:se?a.jsx("p",{className:"text-xs text-muted-foreground",children:"Loading reference reports..."}):ae.length===0?a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No reference reports for this run yet."}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"shrink-0 gap-1.5",onClick:()=>Qt(),children:[a.jsx(Ao,{className:"h-3.5 w-3.5"}),"New Report"]})]}):a.jsx("div",{className:"space-y-2",children:ae.length>1?a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Selected report"}),a.jsxs(In,{value:De,onValueChange:ge,children:[a.jsx(An,{className:"h-8",children:a.jsx($n,{placeholder:"Select a report"})}),a.jsx(En,{children:ae.map(ne=>a.jsx(ut,{value:ne.relativePath,children:ne.name},ne.path))})]})]}):null})}),a.jsx(ck,{className:"min-h-0 flex-1 bg-muted/15 px-4 py-4",children:ae.length===0?a.jsx("div",{className:"text-sm text-muted-foreground",children:"No report selected."}):at?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(_r,{className:"h-4 w-4 animate-spin"}),"Loading report..."]}):it?a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive",children:["Could not load report: ",it]}):ve?a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"rounded-md border bg-background p-3",children:[a.jsx("p",{className:"font-mono text-xs font-semibold",children:ve.name}),a.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:ve.relativePath}),a.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:new Date(ve.mtime).toLocaleString()})]}),a.jsx("div",{className:"rounded-md border bg-background p-3",children:a.jsx(Va,{text:ve.content,className:"text-sm"})})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"Select a report to preview."})})]})]}):a.jsxs(Qe,{className:"min-w-0 overflow-hidden rounded-t-none xl:flex xl:h-full xl:min-h-0 xl:flex-col",children:[a.jsx($t,{className:"border-b px-4 py-3",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Dt,{className:"flex items-center gap-2 text-base",children:[a.jsx(Mc,{className:"h-4 w-4 text-muted-foreground"}),"Run Note"]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:()=>K(ne=>!ne),children:[D?a.jsx(KS,{className:"h-3.5 w-3.5"}):a.jsx(GS,{className:"h-3.5 w-3.5"}),D?"Compact":"Expand"]}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>O(!1),children:"Hide"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Add context for this run, such as server version or environment details."})]})}),a.jsx(Je,{className:"flex h-[70vh] min-h-[520px] flex-col p-4 xl:h-auto xl:min-h-0 xl:flex-1",children:p?a.jsxs("div",{className:"w-full max-w-xl space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"text-xs font-medium",children:"Run note"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.length,"/500"]})]}),a.jsx(Es,{value:x,onChange:ne=>j(ne.target.value.slice(0,500)),placeholder:"Optional context for this run",rows:3,className:"min-h-20 resize"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{size:"sm",onClick:()=>{rn()},disabled:y,children:y?"Saving...":"Save note"}),a.jsx(Z,{size:"sm",variant:"outline",onClick:()=>{j(c.runNote??""),v(!1)},disabled:y,children:"Cancel"})]})]}):a.jsxs("div",{className:"flex w-full max-w-3xl items-center gap-2 rounded-md border bg-muted/20 px-2 py-1 text-xs",children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[a.jsx("span",{className:"text-muted-foreground",children:"Run note:"}),a.jsx("span",{className:`break-words ${c.runNote?"text-foreground":"text-muted-foreground"}`,children:c.runNote||"none"})]}),a.jsx(Z,{size:"sm",variant:"ghost",className:"ml-auto h-6 px-2 text-xs",onClick:()=>v(!0),children:c.runNote?"Edit":"Add note"})]})})]})]}),a.jsx(Ps,{open:I,onOpenChange:ne=>!G&&T(ne),children:a.jsxs(Qa,{className:"max-w-2xl",children:[a.jsxs(Ja,{children:[a.jsx(es,{children:oe?"Create markdown report":"Approve MCP action: write markdown report"}),a.jsx(ts,{children:oe?"Write a custom markdown report and save it to the workspace.":a.jsxs(a.Fragment,{children:["This will call ",a.jsx("code",{children:"mcplab_write_markdown_report"})," via the local MCPLab MCP server."]})})]}),a.jsxs("div",{className:"space-y-3",children:[!oe&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Output path"}),a.jsx(_t,{value:M,onChange:ne=>X(ne.target.value),placeholder:"mcplab/reports/result-assistant/my-report.md",disabled:G})]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:$,onCheckedChange:ne=>F(ne===!0),disabled:G}),a.jsx("span",{children:"Overwrite if file exists"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:oe?"Markdown content":"Markdown preview (to be written)"}),a.jsx(Es,{value:V,onChange:ne=>H(ne.target.value),rows:10,className:"font-mono text-xs",disabled:G})]})]}),a.jsxs(Za,{children:[a.jsx(rs,{disabled:G,children:"Cancel"}),a.jsx(ns,{onClick:ne=>{ne.preventDefault(),Et()},disabled:G,children:G?"Writing...":oe?"Save Report":"Approve & Write"})]})]})}),a.jsx(Ps,{open:Ye,onOpenChange:_e,children:a.jsxs(Qa,{children:[a.jsxs(Ja,{children:[a.jsx(es,{children:"Delete run?"}),a.jsxs(ts,{children:["This will permanently remove run ",a.jsx("span",{className:"font-mono",children:c?.id}),". This action cannot be undone."]})]}),a.jsxs(Za,{children:[a.jsx(rs,{disabled:Ee,children:"Cancel"}),a.jsx(ns,{disabled:Ee||!c?.id,onClick:ne=>{ne.preventDefault(),sr()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Ee?"Deleting...":"Delete"})]})]})})]})]})};function rwe({item:e,fallbackUserPrompt:t}){if(e.kind==="tool_call"){const d=ID(e,"input");return a.jsx(DD,{variant:"call",title:`Tool call · ${e.toolName||"unknown"}${d}`,text:e.text})}if(e.kind==="tool_result"){const d=ID(e,"output"),f=e.ok?a.jsx(Wa,{className:"h-3.5 w-3.5 text-emerald-700 dark:text-emerald-300"}):a.jsx(cl,{className:"h-3.5 w-3.5 text-rose-700 dark:text-rose-300"});return a.jsx(DD,{variant:e.ok?"result_ok":"result_error",title:`Tool result · ${e.toolName||"unknown"} · ${e.ok?"ok":"error"}${typeof e.durationMs=="number"?` · ${e.durationMs}ms`:""}${d}`,text:e.text,icon:f})}const n=e.kind==="user_prompt",r=$D(e.text,e.kind),s=t?$D(t,"user_prompt"):"",o=n&&!r&&s?s:r,i=n?"User prompt":e.kind==="assistant_final"?"Agent final":"Agent",c=n?Xc:Wr;return a.jsxs("div",{className:`flex items-start gap-2 text-xs ${n?"justify-end":"justify-start"}`,children:[!n&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",children:a.jsx(c,{className:"h-3 w-3"})}),a.jsxs("div",{className:`max-w-[90%] rounded-md p-2 ${n?"bg-primary/10":"bg-muted/50"}`,children:[a.jsx("p",{className:`mb-1 text-[11px] font-semibold text-muted-foreground ${n?"text-right":""}`,children:i}),n?a.jsx(nC,{text:o,maxLength:280,className:"text-xs"}):a.jsx(nC,{text:o,maxLength:500,className:"text-xs"})]}),n&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(c,{className:"h-3 w-3"})})]})}function ID(e,t){const n=t==="input"?e.estimatedTokens?.inputTokens:e.estimatedTokens?.outputTokens;return typeof n!="number"?"":` · ${na(n)} tokens`}function $D(e,t){const r=String(e??"").replace(/^\s+/,"");return t==="user_prompt"?r.replace(/^user:\s*/i,""):t==="assistant_final"||t==="assistant_thought"?r.replace(/^assistant:\s*/i,""):r}function awe(e,t){if(!t)return!1;const n=String(e??"").toLowerCase();if(!n.trim())return!1;const r=["check","checks","rule","rules","regex","pattern","value capture","extract rule","update","change","replace","modify","adjust","use ","set "],s=["change ","replace ","update ","use ","set the","suggested","you should","try ","text match failed","text must match pattern"];if(["i can only read","i don't have write access","i cannot directly edit","what happened","summary"].some(m=>n.includes(m))&&!s.some(m=>n.includes(m)))return!1;const i=r.some(m=>n.includes(m)),c=s.some(m=>n.includes(m)),d=/(^|\n)\s*[-*]\s+/.test(e)||/(^|\n)\s*\d+\.\s+/.test(e),f=/["'`][^"'`\n]{2,}["'`]/.test(e);return i&&(c||d||f)}function DD({variant:e,title:t,text:n,icon:r}){const[s,o]=h.useState(!1),i={call:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300",result_ok:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",result_error:"border-rose-500/30 bg-rose-500/10 text-rose-700 dark:text-rose-300"};return a.jsx(ws,{open:s,onOpenChange:o,children:a.jsxs("div",{className:`rounded-md border p-2 text-xs ${i[e]}`,children:[a.jsx(za,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-2 text-left",children:[a.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[11px]",children:[r??a.jsx(Ba,{className:"h-3.5 w-3.5"}),a.jsx("span",{children:t})]}),a.jsx("span",{className:"text-[11px] font-semibold",children:s?"Hide content":"Show content"})]})}),a.jsx(js,{children:a.jsx("p",{className:"mt-2 font-mono whitespace-pre-wrap text-foreground",children:n})})]})})}function nC({text:e,maxLength:t,className:n}){const[r,s]=h.useState(!1),o=e.length>t,i=r||!o?e:`${e.slice(0,t)}...`;return a.jsxs("div",{children:[a.jsx(Va,{text:i,className:n}),o&&a.jsx("button",{type:"button",className:"mt-1 text-[11px] font-medium text-primary hover:underline",onClick:()=>s(c=>!c),children:r?"Show less":"Show all"})]})}function swe(e,t,n,r){return X8({evalRules:e,failureReasons:t,runError:n,checkResults:r})}function LD(e){const t=String(e??"").trim(),n=t.match(/^Regex assertion failed:\s*(.+)$/i);return n?`Text match failed: ${n[1]}`:t}const zS=["hsl(38, 92%, 50%)","hsl(200, 80%, 50%)","hsl(152, 69%, 40%)","hsl(280, 60%, 50%)","hsl(0, 72%, 51%)"],owe=9,FD="mcplab.compare.showDaySeparators",Ac=[{value:"15min",label:"Last 15min",durationMs:900*1e3},{value:"30min",label:"Last 30min",durationMs:1800*1e3},{value:"1h",label:"Last hour",durationMs:3600*1e3},{value:"24h",label:"Last 24 hours",durationMs:1440*60*1e3},{value:"7d",label:"Last 7 days",durationMs:10080*60*1e3},{value:"14d",label:"Last 14 days",durationMs:336*60*60*1e3},{value:"30d",label:"Last 30 days",durationMs:720*60*60*1e3}];function ml(e){if(!e.trim())return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t}function nm(e){const t=ml(e);return t?t.toLocaleString():""}function iwe(e){const t=ml(e);if(!t)return e;const n=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0");return`${n}-${r}-${s}`}function lwe(e){const t=Object.entries(e??{});return t.length===0?"—":t.sort((n,r)=>n[0].localeCompare(r[0])).map(([n,r])=>`${n}@${r??"unknown"}`).join(", ")}function cwe(e){const t=ml(e);return t?t.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):"Unknown day"}function CU({counts:e}){return!e||e.total===0?a.jsx(a.Fragment,{children:"—"}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"text-success",children:[e.passed," ✓"]}),a.jsx("span",{className:"text-muted-foreground",children:" · "}),a.jsxs("span",{className:"text-destructive",children:[e.failed," ✕"]})]})}function uwe(e){const t=e.checkCounts;if(!t||t.total===0)return"—";const n=t.passed+t.failed;return n===0?"—":a.jsxs(a.Fragment,{children:[a.jsx(CU,{counts:t}),a.jsx("span",{className:"text-muted-foreground",children:" · "}),a.jsxs("span",{children:[Math.round(t.passed/n*100),"%"]})]})}function dwe(e){return e==="all"||e==="last"||e==="custom"}function fwe(e){return e==="15min"||e==="30min"||e==="1h"||e==="24h"||e==="7d"||e==="14d"||e==="30d"}function pwe(e){const t=e.get("time_filter"),n=e.get("time_preset");return{mode:dwe(t)?t:"all",preset:fwe(n)?n:"15min",start:e.get("time_start")??"",end:e.get("time_end")??""}}function hwe(e,t){return e.length!==t.length?!1:e.every((n,r)=>n===t[r])}function mwe(e){const t=e.find(n=>n.provider&&n.model)??e.find(n=>n.provider||n.model);return{provider:t?.provider,model:t?.model}}const gwe=()=>{const{source:e}=Dn(),[t,n]=Fo(),r=pwe(t),s=t.get("mode")==="within-run"?"within-run":"runs",[o,i]=h.useState([]),[c,d]=h.useState({}),[f,m]=h.useState(!1),[p,v]=h.useState(new Set),[x,j]=h.useState("timestamp"),[y,b]=h.useState("desc"),[S,N]=h.useState("all"),[C,k]=h.useState(!1),[A,E]=h.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(FD)==="1"}catch{return!1}}),[P,O]=h.useState(r.mode),[D,K]=h.useState(r.preset),[q,B]=h.useState(r.start),[Y,z]=h.useState(r.end),[I,T]=h.useState(!1),V=100,H=px(V),{offset:M,hasMore:X,totalCount:$}=H,F=t.get("runId")??"",G=(t.get("agents")??"").split(",").map(U=>U.trim()).filter(Boolean),re=t.get("scenario")??"all",[oe,ue]=h.useState(F),[ae,ye]=h.useState(G),[se,de]=h.useState(re),[De,ge]=h.useState(!1),ve=h.useRef(0),Se=h.useMemo(()=>{if(P==="all")return{};if(P==="last"){const pe=Ac.find(xe=>xe.value===D)??Ac[0],J=new Date;return{since:new Date(J.getTime()-pe.durationMs).toISOString(),until:J.toISOString()}}const U=ml(q)?.toISOString(),le=ml(Y)?.toISOString();return{since:U,until:le}},[Y,P,D,q]),at=async()=>{const U=ve.current+1;ve.current=U,m(!0);try{if(e.listRunSummariesPage){const le={limit:V,offset:M};S!=="all"&&(le.scenario=S),Se.since&&(le.since=Se.since),Se.until&&(le.until=Se.until);const pe=await e.listRunSummariesPage(le);if(ve.current!==U)return;H.updateMeta(pe),i(pe.data.map(vi))}else{const le=await e.listResults();if(ve.current!==U)return;i(le)}}catch(le){Me({title:"Could not load results",description:le instanceof Error?le.message:String(le),variant:"destructive"})}finally{ve.current===U&&m(!1)}};h.useEffect(()=>{let U=!0;return ve.current+=1,m(!0),(e.listRunSummariesPage?e.listRunSummariesPage({limit:V,offset:M,scenario:S==="all"?void 0:S,since:Se.since,until:Se.until}).then(pe=>(U&&H.updateMeta(pe),pe.data.map(vi))):e.listResults()).then(pe=>{U&&i(pe)}).catch(pe=>{U&&Me({title:"Could not load results",description:pe instanceof Error?pe.message:String(pe),variant:"destructive"})}).finally(()=>{U&&m(!1)}),()=>{U=!1}},[M,S,e,Se]);const tt=U=>{if(x===U){b(le=>le==="asc"?"desc":"asc");return}j(U),b(U==="timestamp"?"desc":"asc")},it=U=>{v(le=>{const pe=new Set(le);return pe.has(U)?pe.delete(U):pe.add(U),pe})},kt=h.useMemo(()=>{const U=new Set;return o.forEach(le=>{le.scenarios.forEach(pe=>{const J=String(pe.scenarioName??"").trim(),xe=String(pe.scenarioId??"").trim(),be=J||xe;be&&U.add(be)})}),Array.from(U).sort((le,pe)=>le.localeCompare(pe))},[o]),Ye=h.useMemo(()=>{const U=S==="all"?o:o.filter(we=>we.scenarios.some(W=>{const he=String(W.scenarioName??"").trim(),ke=String(W.scenarioId??"").trim();return(he||ke)===S}));if(s!=="runs"||P==="all")return U;const le=Date.now();if(P==="last"){const we=Ac.find(he=>he.value===D)??Ac[0],W=le-we.durationMs;return U.filter(he=>{const ke=new Date(he.timestamp).getTime();return ke>=W&&ke<=le})}const pe=ml(q)?.getTime()??null,J=ml(Y)?.getTime()??null,xe=pe!==null&&J!==null?Math.min(pe,J):pe??null,be=pe!==null&&J!==null?Math.max(pe,J):J??null;return U.filter(we=>{const W=new Date(we.timestamp).getTime();return!(Number.isNaN(W)||xe!==null&&W<xe||be!==null&&W>be)})},[s,o,S,Y,P,D,q]),_e=h.useMemo(()=>[...Ye].sort((U,le)=>{let pe=0;return x==="id"&&(pe=U.id.localeCompare(le.id)),x==="timestamp"&&(pe=new Date(U.timestamp).getTime()-new Date(le.timestamp).getTime()),x==="passRate"&&(pe=U.overallPassRate-le.overallPassRate),x==="scenarios"&&(pe=U.totalScenarios-le.totalScenarios),y==="asc"?pe:-pe}),[Ye,x,y]),Ee=h.useMemo(()=>_e.filter(U=>p.has(U.id)).map(U=>c[U.id]??U),[c,_e,p]),Ze=h.useMemo(()=>{if(!A)return _e.map(pe=>({type:"run",run:pe}));const U=[];let le=null;for(const pe of _e){const J=iwe(pe.timestamp);J!==le&&(U.push({type:"day-separator",dayKey:J,dayLabel:cwe(pe.timestamp)}),le=J),U.push({type:"run",run:pe})}return U},[A,_e]);h.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(FD,A?"1":"0")}catch{}},[A]);const pt=U=>x!==U?a.jsx(zc,{className:"h-3.5 w-3.5 text-muted-foreground"}):y==="asc"?a.jsx(Ns,{className:"h-3.5 w-3.5"}):a.jsx(en,{className:"h-3.5 w-3.5"}),Lt=h.useMemo(()=>{const U=new Map;for(const le of _e)U.set(le.id,U_(le));return U},[_e]),Ut=U=>{const le=Array.from(new Set(U.scenarios.map(pe=>pe.agentId).filter(Boolean)));return le.slice(0,Math.min(2,le.length))},Nt=U=>{const le=Ut(U);ue(U.id),ye(le),de("all");const pe=new URLSearchParams(t);pe.set("mode","within-run"),pe.set("runId",U.id),le.length>0?pe.set("agents",le.join(",")):pe.delete("agents"),pe.delete("scenario"),n(pe,{replace:!0})},an=h.useMemo(()=>[...new Set(Ee.flatMap(U=>U.scenarios.map(le=>le.scenarioId)))],[Ee]),on=h.useMemo(()=>{const U=new Map;for(const le of Ee)for(const pe of le.scenarios){const J=String(pe.scenarioId??"").trim();if(!J)continue;const xe=String(pe.scenarioName??"").trim();U.set(J,xe||J)}return U},[Ee]),zt=h.useMemo(()=>c[oe]??o.find(U=>U.id===oe),[c,o,oe]);h.useEffect(()=>{if(typeof e.getResult!="function"||p.size===0&&!oe)return;const U=new Set([...p]);oe&&U.add(oe);for(const le of U)c[le]||e.getResult(le).then(pe=>{pe&&d(J=>J[le]?J:{...J,[le]:pe})})},[c,p,e,oe]),h.useEffect(()=>{H.reset()},[H.reset,S,P,D,q,Y]);const sn=h.useMemo(()=>{if(!zt)return[];const U=new Map;for(const le of zt.scenarios)U.set(le.agentId,le.agentName||le.agentId);return Array.from(U.entries()).map(([le,pe])=>({id:le,name:pe})).sort((le,pe)=>le.name.localeCompare(pe.name))},[zt]),nn=h.useMemo(()=>{if(!zt)return[];const U=new Set;for(const le of zt.scenarios){const pe=String(le.scenarioName??"").trim(),J=String(le.scenarioId??"").trim(),xe=pe||J;xe&&U.add(xe)}return Array.from(U).sort((le,pe)=>le.localeCompare(pe))},[zt]),Re=h.useMemo(()=>ae.join(","),[ae]);h.useEffect(()=>{if(s==="within-run"){const U=t.get("runId")??"",le=(t.get("agents")??"").split(",").map(J=>J.trim()).filter(Boolean),pe=t.get("scenario")??"all";ue(J=>J===U?J:U),ye(J=>hwe(J,le)?J:le),de(J=>J===pe?J:pe)}},[s,t]),h.useEffect(()=>{if(s!=="within-run"||o.length===0)return;let U=oe;(!U||!o.some(W=>W.id===U))&&(U=o[0].id);const le=o.find(W=>W.id===U),pe=(()=>{if(!le)return[];const W=new Map;for(const he of le.scenarios)W.set(he.agentId,he.agentName||he.agentId);return Array.from(W.keys())})(),J=new Set(pe);let xe=Re.split(",").map(W=>W.trim()).filter(W=>!!W).filter(W=>J.has(W));xe.length===0&&pe.length>0&&(xe=pe.slice(0,Math.min(2,pe.length)));const be=(()=>{if(!le)return new Set;const W=new Set;for(const he of le.scenarios){const ke=String(he.scenarioName??"").trim(),Ve=String(he.scenarioId??"").trim(),ee=ke||Ve;ee&&W.add(ee)}return new Set(W)})(),we=se!=="all"&&!be.has(se)?"all":se;U!==oe&&ue(U),xe.join(",")!==Re&&ye(xe),we!==se&&de(we)},[s,o,oe,Re,se]),h.useEffect(()=>{const U=new URLSearchParams(t);s==="within-run"?(U.set("mode","within-run"),oe?U.set("runId",oe):U.delete("runId"),ae.length>0?U.set("agents",ae.join(",")):U.delete("agents"),se!=="all"?U.set("scenario",se):U.delete("scenario"),U.delete("time_filter"),U.delete("time_preset"),U.delete("time_start"),U.delete("time_end")):(U.delete("mode"),U.delete("runId"),U.delete("agents"),U.delete("scenario"),P==="all"?(U.delete("time_filter"),U.delete("time_preset"),U.delete("time_start"),U.delete("time_end")):P==="last"?(U.set("time_filter","last"),U.set("time_preset",D),U.delete("time_start"),U.delete("time_end")):(U.set("time_filter","custom"),U.delete("time_preset"),q.trim()?U.set("time_start",q.trim()):U.delete("time_start"),Y.trim()?U.set("time_end",Y.trim()):U.delete("time_end")));const le=t.toString(),pe=U.toString();le!==pe&&n(U,{replace:!0})},[s,Y,P,D,q,oe,ae,se,t,n]);const Be=h.useMemo(()=>{if(P==="all")return"All time";if(P==="last")return Ac.find(pe=>pe.value===D)?.label??"Last range";const U=!!q.trim(),le=!!Y.trim();return!U&&!le?"Custom range":U&&le?`${nm(q)} - ${nm(Y)}`:U?`From ${nm(q)}`:`Until ${nm(Y)}`},[Y,P,D,q]),qe=()=>{O("all"),K("15min"),B(""),z("")},Bt=h.useMemo(()=>{if(!zt)return[];const U=new Map;for(const pe of zt.scenarios){const J=String(pe.scenarioId??"").trim(),xe=String(pe.scenarioName??"").trim(),be=xe||J;if(!J&&!be)continue;const we=J||be,W=U.get(we);if(W){W.byAgent[pe.agentId]=pe;continue}U.set(we,{scenarioId:J||be,scenarioName:xe,displayLabel:be||J,byAgent:{[pe.agentId]:pe}})}const le=Array.from(U.values()).sort((pe,J)=>{const xe=(pe.displayLabel||pe.scenarioId).toLowerCase(),be=(J.displayLabel||J.scenarioId).toLowerCase();return xe.localeCompare(be)});return se==="all"?le:le.filter(pe=>pe.displayLabel===se)},[zt,se]),Wt=h.useMemo(()=>{const U=new Map(sn.map(le=>[le.id,le]));return ae.map(le=>U.get(le)).filter(le=>!!le)},[ae,sn]),yt=h.useMemo(()=>{if(!zt||Wt.length!==2)return null;const[U,le]=Wt;return{left:U,right:le,link:`/compare/results?left=${encodeURIComponent(zt.id)}&right=${encodeURIComponent(zt.id)}&leftConfig=${encodeURIComponent(zt.configId)}&rightConfig=${encodeURIComponent(zt.configId)}&leftAgent=${encodeURIComponent(U.id)}&rightAgent=${encodeURIComponent(le.id)}`}},[zt,Wt]),fe=h.useMemo(()=>!zt||Wt.length===0?[]:Wt.map(U=>{const le=Bt.map(ke=>ke.byAgent[U.id]).filter(ke=>!!ke),pe=le.flatMap(ke=>ke.runs),J=pe.length,xe=pe.filter(ke=>ke.passed).length,be=pe.reduce((ke,Ve)=>ke+Ve.toolCalls.length,0),we=pe.reduce((ke,Ve)=>ke+Ve.duration,0),{provider:W,model:he}=mwe(le);return{agentId:U.id,agentName:U.name,provider:W,model:he,passRate:J===0?0:xe/J,totalRuns:J,avgToolCalls:J===0?0:be/J,avgLatency:J===0?0:we/J}}),[zt,Wt,Bt]),Ie=U=>{ye(le=>le.includes(U)?le.filter(pe=>pe!==U):[...le,U])},Ge=U=>a.jsxs("div",{className:"min-w-0 rounded border bg-muted/20 px-2 py-1.5",children:[a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"font-mono",children:["#",U.runIndex+1]})," ",a.jsx("span",{className:U.passed?"text-emerald-700":"text-destructive",children:U.passed?"PASS":"FAIL"})," ","· tools: ",U.toolCalls.length," · ",U.duration,"ms"]}),!U.passed&&U.failureReasons.length>0&&a.jsx("div",{className:"mt-1 max-h-16 overflow-y-auto whitespace-pre-wrap break-all pr-1 text-[11px] text-muted-foreground",children:U.failureReasons.join("; ")})]},U.runIndex);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(b5,{className:"h-6 w-6"}),"Compare Runs"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:s==="runs"?"Select 2–5 runs to compare":"Compare agents side-by-side within one run"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[s==="within-run"&&a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{const U=new URLSearchParams(t);U.delete("mode"),U.delete("runId"),U.delete("agents"),U.delete("scenario"),n(U,{replace:!0})},children:[a.jsx(m5,{className:"mr-1.5 h-4 w-4"}),"Back to Compare"]}),s==="runs"&&a.jsxs(a.Fragment,{children:[a.jsxs(wi,{open:C,onOpenChange:k,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":C,"aria-controls":"compare-scenario-command-list",className:`w-[260px] justify-between font-normal ${S!=="all"?"border-primary/40":""}`,children:[a.jsx("span",{className:"truncate text-left",children:S==="all"?"All scenarios":S}),a.jsx(en,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(ko,{className:"w-[260px] p-0",align:"start",children:a.jsxs(Ml,{children:[a.jsx(Il,{placeholder:"Search scenarios..."}),a.jsxs($l,{id:"compare-scenario-command-list",children:[a.jsx(Dl,{children:"No scenarios found."}),a.jsxs(Ll,{children:[a.jsx(Na,{value:"all scenarios",onSelect:()=>{N("all"),k(!1)},children:"All scenarios"}),kt.map(U=>a.jsx(Na,{value:U,onSelect:()=>{N(U),k(!1)},children:U},U))]})]})]})})]}),a.jsxs(wi,{open:I,onOpenChange:T,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":I,"aria-controls":"compare-time-command-list",className:`w-[320px] justify-between font-normal ${P!=="all"?"border-primary/40":""}`,children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2 truncate text-left",children:[a.jsx(g5,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:Be})]}),a.jsx(en,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsxs(ko,{className:"w-[360px] p-0",align:"start",children:[a.jsxs("div",{className:"border-b px-3 py-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"Date and time filter"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Filter runs by timestamp."})]}),a.jsxs("div",{id:"compare-time-command-list",className:"grid gap-1 p-2",children:[a.jsx(Z,{type:"button",variant:P==="all"?"secondary":"ghost",className:"justify-start",onClick:()=>{qe(),T(!1)},children:"All time"}),Ac.map(U=>a.jsx(Z,{type:"button",variant:P==="last"&&D===U.value?"secondary":"ghost",className:"justify-start",onClick:()=>{O("last"),K(U.value),T(!1)},children:U.label},U.value)),a.jsx(Z,{type:"button",variant:P==="custom"?"secondary":"ghost",className:"justify-start",onClick:()=>O("custom"),children:"Custom date time range"})]}),P==="custom"&&a.jsxs("div",{className:"space-y-3 border-t p-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(He,{htmlFor:"compare-time-filter-start",children:"Start"}),a.jsx(_t,{id:"compare-time-filter-start",type:"datetime-local",value:q,onChange:U=>B(U.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(He,{htmlFor:"compare-time-filter-end",children:"End"}),a.jsx(_t,{id:"compare-time-filter-end",type:"datetime-local",value:Y,onChange:U=>z(U.target.value)})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"px-2",onClick:qe,children:[a.jsx(ua,{className:"mr-1.5 h-3.5 w-3.5"}),"Clear"]}),a.jsx(Z,{type:"button",size:"sm",onClick:()=>T(!1),children:"Done"})]})]})]})]})]}),a.jsxs("div",{className:"inline-flex items-center gap-2 rounded-md border px-3 py-2",children:[a.jsx(He,{htmlFor:"compare-day-separators-switch",className:"text-sm font-medium",children:"Group by day"}),a.jsx(Og,{id:"compare-day-separators-switch",checked:A,onCheckedChange:E,"aria-label":"Group by day"})]}),a.jsx(Z,{variant:"outline",onClick:()=>{at()},disabled:f,children:f?"Refreshing...":"Refresh"}),a.jsx(Z,{variant:"outline",onClick:H.prev,disabled:f||M===0,children:"Prev"}),a.jsx(Z,{variant:"outline",onClick:H.next,disabled:f||!X,children:"Next"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:H.rangeLabel(o.length)}),s==="within-run"&&a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Within One Run Controls"})}),a.jsxs(Je,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Run"}),a.jsxs(In,{value:oe,onValueChange:ue,children:[a.jsx(An,{children:a.jsx($n,{placeholder:"Select run"})}),a.jsx(En,{children:o.map(U=>a.jsx(ut,{value:U.id,children:U.id},U.id))})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Scenario filter"}),a.jsxs(wi,{open:De,onOpenChange:ge,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":De,"aria-controls":"compare-within-run-scenario-command-list",className:"w-full justify-between font-normal",children:[a.jsx("span",{className:"truncate text-left",children:se==="all"?"All scenarios":se}),a.jsx(en,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(ko,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:a.jsxs(Ml,{children:[a.jsx(Il,{placeholder:"Search scenarios..."}),a.jsxs($l,{id:"compare-within-run-scenario-command-list",children:[a.jsx(Dl,{children:"No scenarios found."}),a.jsxs(Ll,{children:[a.jsx(Na,{value:"all scenarios",onSelect:()=>{de("all"),ge(!1)},children:"All scenarios"}),nn.map(U=>a.jsx(Na,{value:U,onSelect:()=>{de(U),ge(!1)},children:U},U))]})]})]})})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Agents (select 2+)"}),a.jsxs("div",{className:"flex flex-wrap gap-3 rounded-md border p-3",children:[sn.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No agents available for selected run."}),sn.map(U=>a.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:ae.includes(U.id),onCheckedChange:()=>Ie(U.id)}),a.jsx("span",{children:U.name})]},U.id))]})]})]})]}),s==="runs"&&a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:a.jsxs(ia,{containerClassName:"max-h-[36rem] overflow-auto",children:[a.jsx(la,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Vt,{children:[a.jsx(ct,{className:"w-10"}),a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>tt("id"),children:["Run ID",pt("id")]})}),a.jsx(ct,{children:"Evaluated"}),a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>tt("timestamp"),children:["Timestamp",pt("timestamp")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex w-full items-center justify-end gap-1 hover:text-foreground",onClick:()=>tt("passRate"),children:["Pass Rate",pt("passRate")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>tt("scenarios"),children:["Scenarios",pt("scenarios")]})}),a.jsx(ct,{className:"text-right",children:"Tool Tokens"}),a.jsx(ct,{className:"text-right",children:"Agents"}),a.jsx(ct,{className:"w-[140px] text-right",children:"Action"})]})}),a.jsx(ca,{children:Ze.map((U,le)=>U.type==="day-separator"?a.jsx(Vt,{className:"bg-muted/30 hover:bg-muted/30",children:a.jsx(Ue,{colSpan:owe,className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-px flex-1 bg-border/70"}),a.jsx("span",{className:"shrink-0 rounded-full border border-border bg-background px-2.5 py-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:U.dayLabel}),a.jsx("div",{className:"h-px flex-1 bg-border/70"})]})})},`day-${U.dayKey}-${le}`):a.jsxs(Vt,{children:[a.jsx(Ue,{children:a.jsx(wr,{checked:p.has(U.run.id),onCheckedChange:()=>it(U.run.id),disabled:!p.has(U.run.id)&&p.size>=5})}),a.jsx(Ue,{className:"font-mono text-xs",children:U.run.id}),a.jsx(Ue,{className:"text-[11px] text-muted-foreground",children:(()=>{const pe=Lt.get(U.run.id)??{scenarioCount:0,agentCount:0,scopePreview:"n/a",modelSummary:""};return a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{children:["Evaluated: ",pe.scenarioCount," scenario",pe.scenarioCount===1?"":"s"," · ",pe.agentCount," agent",pe.agentCount===1?"":"s",pe.modelSummary?` · ${pe.modelSummary}`:""]}),a.jsx("div",{className:"font-mono text-xs text-foreground/80",children:pe.scopePreview})]})})()}),a.jsx(Ue,{className:"text-xs text-muted-foreground",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(U.run.timestamp).toLocaleString()]}),(()=>{const pe=Mg(U.run);return pe===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Total time: ",sa(pe)]})})()]})}),a.jsx(Ue,{className:"text-right",children:a.jsx(zs,{rate:U.run.overallPassRate})}),a.jsx(Ue,{className:"text-right font-mono text-sm",children:U.run.totalScenarios}),a.jsx(Ue,{className:"text-right",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("div",{className:"font-mono text-sm",children:na(U.run.toolTokenUsage?.totalTokens)}),(()=>{const pe=Ig(U.run);return pe===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Tool time: ",sa(pe)]})})()]})}),a.jsx(Ue,{className:"text-right font-mono text-sm",children:Lt.get(U.run.id)?.agentCount??0}),a.jsx(Ue,{className:"text-right",children:(Lt.get(U.run.id)?.agentCount??0)>1?a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>Nt(U.run),children:"Compare agents"}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})})]},U.run.id))})]})})}),s==="runs"&&Ee.length<2&&a.jsx(Qe,{children:a.jsxs(Je,{className:"py-12 text-center",children:[a.jsx("p",{className:"text-sm font-medium",children:"No runs selected"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Select 2–5 runs from the table above to start a comparison."})]})}),s==="runs"&&Ee.length>=2&&a.jsxs(a.Fragment,{children:[Ee.length===2&&a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6",children:a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"Need a deeper comparison?"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Open the two selected runs in a dedicated side-by-side full result compare view."})]}),a.jsx(Z,{asChild:!0,size:"sm",children:a.jsx(At,{to:`/compare/results?left=${encodeURIComponent(Ee[0].id)}&right=${encodeURIComponent(Ee[1].id)}&leftConfig=${encodeURIComponent(Ee[0].configId)}&rightConfig=${encodeURIComponent(Ee[1].configId)}`,children:"Compare full results"})})]})})}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Summary Comparison"})}),a.jsx(Je,{className:"max-h-[24rem] overflow-auto p-0",children:a.jsxs(ia,{className:"table-fixed",children:[a.jsx(la,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Vt,{children:[a.jsx(ct,{className:"w-[220px]",children:"Metric"}),Ee.map((U,le)=>a.jsxs(ct,{style:{color:zS[le]},className:"font-mono text-xs",children:[a.jsx("div",{children:U.id}),U.configPath?.trim()?a.jsx("div",{className:"mt-0.5 font-mono text-[10px] font-normal text-muted-foreground",children:U.configPath.trim()}):null]},U.id))]})}),a.jsxs(ca,{children:[a.jsxs(Vt,{children:[a.jsx(Ue,{className:"font-medium",children:"Pass Rate"}),Ee.map(U=>a.jsx(Ue,{children:a.jsx(zs,{rate:U.overallPassRate})},U.id))]}),a.jsxs(Vt,{children:[a.jsx(Ue,{className:"font-medium",children:"Checks Pass Rate"}),Ee.map(U=>a.jsx(Ue,{className:"font-mono",children:uwe(U)},U.id))]}),a.jsxs(Vt,{children:[a.jsx(Ue,{className:"font-medium",children:"Total Runs"}),Ee.map(U=>a.jsx(Ue,{className:"font-mono",children:U.totalRuns},U.id))]}),a.jsxs(Vt,{children:[a.jsx(Ue,{className:"font-medium",children:"Tool Calls"}),Ee.map(U=>a.jsx(Ue,{className:"font-mono",children:U.avgToolCalls.toFixed(1)},U.id))]}),a.jsxs(Vt,{children:[a.jsx(Ue,{className:"font-medium",children:"Avg Latency"}),Ee.map(U=>a.jsxs(Ue,{className:"font-mono",children:[U.avgLatency,"ms"]},U.id))]}),a.jsxs(Vt,{children:[a.jsx(Ue,{className:"font-medium",children:"Total Time"}),Ee.map(U=>a.jsx(Ue,{className:"font-mono",children:(()=>{const le=Mg(U);return le===null?"—":sa(le)})()},U.id))]}),a.jsxs(Vt,{children:[a.jsx(Ue,{className:"font-medium",children:"Tool Time"}),Ee.map(U=>a.jsx(Ue,{className:"font-mono",children:(()=>{const le=Ig(U);return le===null?"—":sa(le)})()},U.id))]})]})]})})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Scenario Breakdown"})}),a.jsx(Je,{className:"max-h-[26rem] overflow-auto p-0",children:a.jsxs(ia,{className:"table-fixed",children:[a.jsx(la,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Vt,{children:[a.jsx(ct,{className:"w-[220px]",children:"Scenario"}),Ee.map((U,le)=>a.jsxs(ct,{style:{color:zS[le]},className:"font-mono text-xs",children:[a.jsx("div",{children:U.id}),U.configPath?.trim()?a.jsx("div",{className:"mt-0.5 font-mono text-[10px] font-normal text-muted-foreground",children:U.configPath.trim()}):null,a.jsxs("div",{className:"mt-0.5 text-[10px] font-normal text-muted-foreground",children:["MCP: ",lwe(U.mcpServerVersions)]})]},U.id))]})}),a.jsx(ca,{children:an.map(U=>a.jsxs(Vt,{children:[a.jsx(Ue,{className:"font-medium text-sm",children:on.get(U)??U}),Ee.map(le=>{const pe=le.scenarios.find(J=>J.scenarioId===U);return a.jsx(Ue,{children:pe?a.jsxs("div",{className:"flex items-center justify-start gap-2",children:[a.jsx(zs,{rate:pe.passRate}),pe.checkCounts?.total?a.jsx("span",{className:"font-mono text-[11px] leading-none",children:a.jsx(CU,{counts:pe.checkCounts})}):null]}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})},le.id)})]},U))})]})})]})]}),s==="runs"&&Ee.length>=2&&a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Pass Rate Trend"})}),a.jsx(Je,{className:"h-72",children:a.jsx(mf,{width:"100%",height:"100%",children:a.jsxs(ON,{data:Ee.map((U,le)=>({idx:le+1,runId:U.id,passRate:Number((U.overallPassRate*100).toFixed(1))})),children:[a.jsx(_i,{dataKey:"idx",tickFormatter:U=>String(U)}),a.jsx(ki,{unit:"%",domain:[0,100]}),a.jsx(aa,{formatter:U=>[`${U}%`,"Pass Rate"],labelFormatter:U=>`Run ${U}`}),a.jsx(gl,{}),a.jsx(Pl,{type:"monotone",dataKey:"passRate",stroke:zS[0],strokeWidth:2.5,dot:!0})]})})})]}),s==="within-run"&&zt&&Wt.length<2&&a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6 text-sm text-muted-foreground",children:"Select at least 2 agents to compare side-by-side within this run."})}),s==="within-run"&&zt&&Wt.length>=2&&a.jsxs(a.Fragment,{children:[a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6",children:a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"Need full result details?"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:yt?"Open a side-by-side full result view filtered by the selected agents.":"Open the complete run result page for all details and trace navigation."})]}),a.jsx(Z,{asChild:!0,size:"sm",children:yt?a.jsx(At,{to:yt.link,children:"Compare full results"}):a.jsx(At,{to:`/results/${encodeURIComponent(zt.id)}${zt.configId?`?configId=${encodeURIComponent(zt.configId)}`:""}`,children:"Open full result"})})]})})}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Agent Summary"})}),a.jsx(Je,{className:"max-h-[24rem] overflow-auto p-0",children:a.jsxs(ia,{children:[a.jsx(la,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Vt,{children:[a.jsx(ct,{children:"Metric"}),fe.map(U=>a.jsxs(ct,{children:[a.jsx("div",{className:"font-medium text-sm",children:U.agentName}),(U.provider||U.model)&&a.jsx("div",{className:"font-mono text-xs font-normal text-muted-foreground",children:[U.provider?kg(U.provider):null,U.model].filter(Boolean).join(" · ")})]},U.agentId))]})}),a.jsxs(ca,{children:[a.jsxs(Vt,{children:[a.jsx(Ue,{className:"font-medium",children:"Pass Rate"}),fe.map(U=>a.jsx(Ue,{children:a.jsx(zs,{rate:U.passRate})},U.agentId))]}),a.jsxs(Vt,{children:[a.jsx(Ue,{className:"font-medium",children:"Total Runs"}),fe.map(U=>a.jsx(Ue,{className:"font-mono",children:U.totalRuns},U.agentId))]}),a.jsxs(Vt,{children:[a.jsx(Ue,{className:"font-medium",children:"Avg Tool Calls"}),fe.map(U=>a.jsx(Ue,{className:"font-mono",children:U.avgToolCalls.toFixed(1)},U.agentId))]}),a.jsxs(Vt,{children:[a.jsx(Ue,{className:"font-medium",children:"Avg Latency"}),fe.map(U=>a.jsxs(Ue,{className:"font-mono",children:[Math.round(U.avgLatency),"ms"]},U.agentId))]})]})]})})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Scenario × Agent Matrix"})}),a.jsx(Je,{className:"max-h-[34rem] overflow-auto p-0",children:a.jsxs(ia,{className:"table-fixed",children:[a.jsx(la,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Vt,{children:[a.jsx(ct,{className:"w-[260px]",children:"Scenario"}),Wt.map(U=>{const le=fe.find(pe=>pe.agentId===U.id);return a.jsxs(ct,{children:[a.jsx("div",{className:"font-medium text-sm",children:U.name}),(le?.provider||le?.model)&&a.jsx("div",{className:"font-mono text-xs font-normal text-muted-foreground",children:[le.provider?kg(le.provider):null,le.model].filter(Boolean).join(" · ")})]},U.id)})]})}),a.jsx(ca,{children:Bt.map(U=>a.jsxs(Vt,{children:[a.jsx(Ue,{className:"font-medium text-sm",children:U.displayLabel}),Wt.map(le=>{const pe=U.byAgent[le.id];return pe?a.jsx(Ue,{className:"min-w-0 align-top",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"text-xs text-muted-foreground",children:[a.jsx(zs,{rate:pe.passRate})," ",a.jsxs("span",{className:"ml-2",children:["runs: ",pe.runs.length]})," · calls:"," ",pe.avgToolCalls.toFixed(1)," · latency:"," ",Math.round(pe.avgDuration),"ms"]}),pe.runs.length>0?a.jsx("div",{className:"space-y-1.5",children:pe.runs.map(J=>Ge(J))}):a.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs captured."})]})},le.id):a.jsx(Ue,{children:a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})},le.id)})]},U.scenarioId))})]})})]})]})]})},zD=(e,t,n)=>{const r=new URLSearchParams;return t&&r.set("configId",t),n&&r.set("agent",n),r.set("embed","1"),`/results/${encodeURIComponent(e)}?${r.toString()}`},BD=(e,t,n)=>{const r=new URLSearchParams;t&&r.set("configId",t),n&&r.set("agent",n);const s=r.toString();return`/results/${encodeURIComponent(e)}${s?`?${s}`:""}`},vwe=()=>{const{source:e}=Dn(),[t]=Fo(),n=t.get("left")??"",r=t.get("right")??"",s=t.get("leftConfig"),o=t.get("rightConfig"),i=t.get("leftAgent"),c=t.get("rightAgent"),d=i?`${n} · ${i}`:n,f=c?`${r} · ${c}`:r,[m,p]=h.useState(null),[v,x]=h.useState(null);return h.useEffect(()=>{if(!n||typeof e.getResult!="function"){p(null);return}let j=!0;return e.getResult(n).then(y=>{j&&p(y??null)}),()=>{j=!1}},[n,e]),h.useEffect(()=>{if(!r||typeof e.getResult!="function"){x(null);return}let j=!0;return e.getResult(r).then(y=>{j&&x(y??null)}),()=>{j=!1}},[r,e]),!n||!r?a.jsxs(Qe,{children:[a.jsx($t,{children:a.jsx(Dt,{className:"text-base",children:"Full Result Compare"})}),a.jsxs(Je,{className:"space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Select exactly two runs in Compare and use the “Compare full results” action."}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(At,{to:"/compare",children:"Back to Compare"})})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Full Result Compare"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:i||c?"Side-by-side Result Detail views for deep inspection, filtered by selected agents.":"Side-by-side Result Detail views for deep inspection."})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(Z,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs(At,{to:"/compare",children:[a.jsx(m5,{className:"mr-1.5 h-4 w-4"}),"Back to Compare"]})}),a.jsx(Z,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs("a",{href:BD(n,s,i),target:"_blank",rel:"noreferrer",children:["Open Left",a.jsx(Yc,{className:"ml-1.5 h-3.5 w-3.5"})]})}),a.jsx(Z,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs("a",{href:BD(r,o,c),target:"_blank",rel:"noreferrer",children:["Open Right",a.jsx(Yc,{className:"ml-1.5 h-3.5 w-3.5"})]})})]})]}),a.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[a.jsxs(Qe,{className:"overflow-hidden",children:[a.jsx($t,{className:"py-3",children:a.jsx(Dt,{className:"text-sm font-mono",children:d})}),a.jsx(Je,{className:"p-0",children:a.jsx("iframe",{title:`Result ${d}`,src:zD(n,s,i),className:"h-[calc(100vh-12rem)] w-full border-0"})})]}),a.jsxs(Qe,{className:"overflow-hidden",children:[a.jsx($t,{className:"py-3",children:a.jsx(Dt,{className:"text-sm font-mono",children:f})}),a.jsx(Je,{className:"p-0",children:a.jsx("iframe",{title:`Result ${f}`,src:zD(r,o,c),className:"h-[calc(100vh-12rem)] w-full border-0"})})]})]})]})};function xwe(e){return e.match(/(?:^|\/)(?:result-assistant|results?)\/([0-9]{8}-[0-9]{6})(?:-|\/)/i)?.[1]??null}function ywe(){const{source:e}=Dn(),[t,n]=h.useState([]),[r,s]=h.useState(!0),[o,i]=h.useState(null),[c,d]=h.useState(!1),f=100,m=px(f),{offset:p,hasMore:v}=m,x=async()=>{s(!0);try{if(e.listMarkdownReportsPage){const S=await e.listMarkdownReportsPage({limit:f,offset:p});n(S.data),m.updateMeta(S)}else n(await e.listMarkdownReports({limit:f,offset:p}))}catch(S){Me({title:"Could not load markdown reports",description:S instanceof Error?S.message:String(S),variant:"destructive"})}finally{s(!1)}};h.useEffect(()=>{x()},[p]);const j=h.useMemo(()=>t[0],[t]),y=h.useMemo(()=>t.find(S=>S.relativePath===o)??null,[t,o]),b=async()=>{if(o){d(!0);try{await e.deleteMarkdownReport(o),n(S=>S.filter(N=>N.relativePath!==o)),Me({title:"Markdown report deleted"}),i(null)}catch(S){Me({title:"Could not delete markdown report",description:S instanceof Error?S.message:String(S),variant:"destructive"})}finally{d(!1)}}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(Mc,{className:"h-6 w-6"}),"Markdown Reports"]}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Browse Markdown files under ",a.jsx("code",{children:"mcplab/reports"}),"."]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{variant:"outline",onClick:()=>{x()},children:"Refresh"}),j?a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(At,{to:`/markdown-reports/view?id=${encodeURIComponent(j.reportId)}`,children:"Open latest"})}):null,a.jsx(Z,{variant:"outline",onClick:m.prev,disabled:r||p===0,children:"Prev"}),a.jsx(Z,{variant:"outline",onClick:m.next,disabled:r||!v,children:"Next"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:m.rangeLabel(t.length)}),a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:r?a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Loading markdown reports..."}):t.length===0?a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"No markdown reports found yet."}):a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Vt,{children:[a.jsx(ct,{children:"Report"}),a.jsx(ct,{children:"Result"}),a.jsx(ct,{children:"Folder"}),a.jsx(ct,{children:"Timestamp"}),a.jsx(ct,{className:"w-10"})]})}),a.jsx(ca,{children:t.map(S=>a.jsxs(Vt,{children:[a.jsx(Ue,{children:a.jsxs("div",{className:"space-y-1",children:[a.jsx(At,{to:`/markdown-reports/view?id=${encodeURIComponent(S.reportId)}`,className:"font-mono text-xs text-primary hover:underline",children:S.name}),a.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:S.relativePath})]})}),a.jsx(Ue,{className:"text-xs text-muted-foreground font-mono",children:(()=>{const N=xwe(S.relativePath);return N?a.jsx(At,{to:`/results/${encodeURIComponent(N)}`,className:"text-primary hover:underline",children:N}):a.jsx("span",{className:"text-muted-foreground",children:"—"})})()}),a.jsx(Ue,{className:"text-xs text-muted-foreground font-mono",children:S.relativePath.includes("/")?S.relativePath.slice(0,S.relativePath.lastIndexOf("/")):"."}),a.jsx(Ue,{className:"text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(S.mtime).toLocaleString()]})}),a.jsx(Ue,{children:a.jsxs(Sp,{children:[a.jsx(Np,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(zg,{className:"h-4 w-4"})})}),a.jsxs(Uu,{align:"end",children:[a.jsx(Ir,{asChild:!0,children:a.jsx(At,{to:`/markdown-reports/view?id=${encodeURIComponent(S.reportId)}`,children:"View"})}),a.jsxs(Ir,{className:"text-destructive",onSelect:N=>{N.preventDefault(),i(S.relativePath)},children:[a.jsx(Ga,{className:"mr-2 h-3.5 w-3.5"})," Delete"]})]})]})})]},S.path))})]})})}),a.jsx(Ps,{open:!!o,onOpenChange:S=>!S&&i(null),children:a.jsxs(Qa,{children:[a.jsxs(Ja,{children:[a.jsx(es,{children:"Delete markdown report?"}),a.jsx(ts,{children:y?`Delete '${y.name}' from disk? This cannot be undone.`:"Delete this report from disk? This cannot be undone."})]}),a.jsxs(Za,{children:[a.jsx(rs,{disabled:c,children:"Cancel"}),a.jsx(ns,{onClick:S=>{S.preventDefault(),b()},disabled:c,children:c?"Deleting...":"Delete"})]})]})})]})}function bwe(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function wwe(e){const t=e.relativePath.match(/(?:^|\/)(?:result-assistant|results?)\/([0-9]{8}-[0-9]{6})(?:-|\/)/i);return t?.[1]?t[1]:(e.content.match(/(?:^|\n)\s*\*\*Run:\*\*\s*`([^`]+)`/i)??e.content.match(/(?:^|\n)\s*Run ID:\s*([^\s]+)/i))?.[1]?.trim()||null}function jwe(){const{source:e}=Dn(),[t]=Fo(),n=(t.get("id")??"").trim(),r=(t.get("path")??"").trim(),[s,o]=h.useState(null),[i,c]=h.useState(!0),[d,f]=h.useState(!1),[m,p]=h.useState(!1);if(h.useEffect(()=>{let x=!0;if(o(null),f(!1),!n&&!r){c(!1);return}return c(!0),(n&&e.getMarkdownReportById?e.getMarkdownReportById(n):e.getMarkdownReport(r)).then(y=>{x&&o(y)}).catch(y=>{if(!x)return;const b=y instanceof Error?y.message:String(y);if(b.includes("(404)")){f(!0);return}Me({title:"Could not load markdown report",description:b,variant:"destructive"})}).finally(()=>{x&&c(!1)}),()=>{x=!1}},[r,n,e]),!n&&!r)return a.jsxs("div",{className:"space-y-4",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Markdown Report"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Missing report identifier."}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(At,{to:"/markdown-reports",children:"Back to Markdown Reports"})})]});if(i)return a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading markdown report..."});if(d||!s)return a.jsxs("div",{className:"space-y-4",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Markdown Report"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Report not found."}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(At,{to:"/markdown-reports",children:"Back to Markdown Reports"})})]});const v=wwe(s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"font-mono text-xl font-semibold",children:s.name}),a.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[a.jsx("span",{className:"font-mono",children:s.relativePath}),a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsxs("span",{className:"inline-flex items-center gap-1 align-middle",children:[a.jsx(Ea,{className:"h-3 w-3 shrink-0"}),new Date(s.mtime).toLocaleString()]}),a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsx("span",{children:bwe(s.sizeBytes)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[v?a.jsxs(a.Fragment,{children:[a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>p(!0),children:"Open Result Panel"}),a.jsx(Z,{asChild:!0,variant:"outline",size:"sm",children:a.jsx(At,{to:`/results/${encodeURIComponent(v)}`,children:"Open Result"})})]}):null,a.jsx(Z,{asChild:!0,variant:"outline",size:"sm",children:a.jsx(At,{to:"/markdown-reports",children:"Back to reports"})})]})]}),a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6",children:a.jsx(Va,{text:s.content,variant:"assistant"})})}),v?a.jsx(mL,{open:m,onOpenChange:p,children:a.jsxs(BC,{side:"right",className:"w-[96vw] max-w-none p-0 sm:max-w-5xl",children:[a.jsx(vL,{className:"border-b px-4 py-3 pr-12",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(xL,{className:"text-base",children:["Result ",v]}),a.jsx(Z,{asChild:!0,variant:"outline",size:"sm",children:a.jsx(At,{to:`/results/${encodeURIComponent(v)}`,target:"_blank",rel:"noreferrer",children:"Open full page"})})]})}),a.jsx("div",{className:"h-[calc(100vh-64px)]",children:a.jsx("iframe",{title:`Result ${v}`,src:`/results/${encodeURIComponent(v)}?embed=1`,className:"h-full w-full border-0"})})]})}):null]})}const Swe=()=>{const e=Kr();return h.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),a.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),a.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})},Nwe=new uG;function Cwe(){const{scenarioId:e}=ql();return a.jsx(I3,{to:e?`/libraries/test-cases/${encodeURIComponent(e)}`:"/libraries/test-cases",replace:!0})}function _we(){return a.jsxs(pY,{children:[a.jsxs(yn,{element:a.jsx(wJ,{}),children:[a.jsx(yn,{path:"/",element:a.jsx(tge,{})}),a.jsx(yn,{path:"/mcp-evaluations",element:a.jsx(wxe,{})}),a.jsx(yn,{path:"/mcp-evaluations/:id",element:a.jsx(cD,{})}),a.jsx(yn,{path:"/mcp-evaluations/:id/:tab",element:a.jsx(cD,{})}),a.jsx(yn,{path:"/tool-analysis",element:a.jsx(C0e,{})}),a.jsx(yn,{path:"/tool-analysis-results",element:a.jsx(_0e,{})}),a.jsx(yn,{path:"/tool-analysis-results/:id",element:a.jsx(k0e,{})}),a.jsx(yn,{path:"/oauth-debugger",element:a.jsx(O0e,{})}),a.jsx(yn,{path:"/libraries/servers",element:a.jsx(zye,{})}),a.jsx(yn,{path:"/libraries/servers/:serverId",element:a.jsx(Bye,{})}),a.jsx(yn,{path:"/libraries/agents",element:a.jsx(qye,{})}),a.jsx(yn,{path:"/libraries/agents/:agentName",element:a.jsx(Qbe,{})}),a.jsx(yn,{path:"/libraries/test-cases",element:a.jsx(yD,{})}),a.jsx(yn,{path:"/libraries/test-cases/:testCaseId",element:a.jsx(yD,{})}),a.jsx(yn,{path:"/libraries/scenarios",element:a.jsx(I3,{to:"/libraries/test-cases",replace:!0})}),a.jsx(yn,{path:"/libraries/scenarios/:scenarioId",element:a.jsx(Cwe,{})}),a.jsx(yn,{path:"/settings",element:a.jsx(Jbe,{})}),a.jsx(yn,{path:"/settings/mcp",element:a.jsx(s0e,{})}),a.jsx(yn,{path:"/run",element:a.jsx(W0e,{})}),a.jsx(yn,{path:"/results",element:a.jsx(J0e,{})}),a.jsx(yn,{path:"/results/:id",element:a.jsx(nwe,{})}),a.jsx(yn,{path:"/markdown-reports",element:a.jsx(ywe,{})}),a.jsx(yn,{path:"/markdown-reports/view",element:a.jsx(jwe,{})}),a.jsx(yn,{path:"/compare",element:a.jsx(gwe,{})}),a.jsx(yn,{path:"/compare/results",element:a.jsx(vwe,{})})]}),a.jsx(yn,{path:"*",element:a.jsx(Swe,{})})]})}const kwe=()=>a.jsx(fG,{client:Nwe,children:a.jsx(Ro,{children:a.jsx(gJ,{children:a.jsx(SJ,{children:a.jsxs(jJ,{children:[a.jsx(hH,{}),a.jsx(VH,{}),a.jsx(LY,{children:a.jsx(_we,{})})]})})})})});f9.createRoot(document.getElementById("root")).render(a.jsx(kwe,{}));