@inspectr/mcplab 1.28.0 → 1.28.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/assets/index-Bug5M-yX.js +258 -0
- package/dist/app/index.html +1 -1
- package/dist/app-server/mastra-scenario-assistant.d.ts +61 -0
- package/dist/app-server/mastra-scenario-assistant.d.ts.map +1 -0
- package/dist/app-server/mastra-scenario-assistant.js +88 -0
- package/dist/app-server/mastra-scenario-assistant.js.map +1 -0
- package/dist/app-server/mastra-scenario-tools.d.ts +97 -0
- package/dist/app-server/mastra-scenario-tools.d.ts.map +1 -0
- package/dist/app-server/mastra-scenario-tools.js +76 -0
- package/dist/app-server/mastra-scenario-tools.js.map +1 -0
- package/dist/app-server/oauth-debugger-domain.d.ts +1 -1
- package/dist/app-server/oauth-debugger-domain.d.ts.map +1 -1
- package/dist/app-server/oauth-debugger-domain.js +7 -2
- package/dist/app-server/oauth-debugger-domain.js.map +1 -1
- package/dist/app-server/oauth-runtime-domain.d.ts.map +1 -1
- package/dist/app-server/oauth-runtime-domain.js +12 -3
- package/dist/app-server/oauth-runtime-domain.js.map +1 -1
- package/dist/app-server/router.d.ts.map +1 -1
- package/dist/app-server/router.js +4 -2
- package/dist/app-server/router.js.map +1 -1
- package/dist/app-server/scenario-assistant-runtime.d.ts +5 -0
- package/dist/app-server/scenario-assistant-runtime.d.ts.map +1 -0
- package/dist/app-server/scenario-assistant-runtime.js +7 -0
- package/dist/app-server/scenario-assistant-runtime.js.map +1 -0
- package/dist/cli-branding.d.ts +1 -0
- package/dist/cli-branding.d.ts.map +1 -1
- package/dist/cli-branding.js +4 -2
- package/dist/cli-branding.js.map +1 -1
- package/package.json +4 -4
- package/dist/app/assets/index-C73rVN95.js +0 -258
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
function s9(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:{}},en={};var LE;function o9(){if(LE)return en;LE=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 U($){var F={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(G){return F[G]})}var B=/\/+/g;function Y($,F){return typeof $=="object"&&$!==null&&$.key!=null?U(""+$.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 en.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 $}},en.Component=b,en.Fragment=n,en.Profiler=s,en.PureComponent=N,en.StrictMode=r,en.Suspense=d,en.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=M,en.act=X,en.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}},en.createContext=function($){return $={$$typeof:i,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:o,_context:$},$.Consumer=$},en.createElement=O,en.createFactory=function($){var F=O.bind(null,$);return F.type=$,F},en.createRef=function(){return{current:null}},en.forwardRef=function($){return{$$typeof:c,render:$}},en.isValidElement=K,en.lazy=function($){return{$$typeof:m,_payload:{_status:-1,_result:$},_init:T}},en.memo=function($,F){return{$$typeof:f,type:$,compare:F===void 0?null:F}},en.startTransition=function($){var F=H.transition;H.transition={};try{$()}finally{H.transition=F}},en.unstable_act=X,en.useCallback=function($,F){return V.current.useCallback($,F)},en.useContext=function($){return V.current.useContext($)},en.useDebugValue=function(){},en.useDeferredValue=function($){return V.current.useDeferredValue($)},en.useEffect=function($,F){return V.current.useEffect($,F)},en.useId=function(){return V.current.useId()},en.useImperativeHandle=function($,F,G){return V.current.useImperativeHandle($,F,G)},en.useInsertionEffect=function($,F){return V.current.useInsertionEffect($,F)},en.useLayoutEffect=function($,F){return V.current.useLayoutEffect($,F)},en.useMemo=function($,F){return V.current.useMemo($,F)},en.useReducer=function($,F,G){return V.current.useReducer($,F,G)},en.useRef=function($){return V.current.useRef($)},en.useState=function($){return V.current.useState($)},en.useSyncExternalStore=function($,F,G){return V.current.useSyncExternalStore($,F,G)},en.useTransition=function(){return V.current.useTransition()},en.version="18.3.1",en}var FE;function aC(){return FE||(FE=1,Vy.exports=o9()),Vy.exports}var zE;function i9(){if(zE)return Nd;zE=1;var e=aC(),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 BE;function l9(){return BE||(BE=1,Hy.exports=i9()),Hy.exports}var a=l9(),Eh={},Ky={exports:{}},ta={},Gy={exports:{}},Yy={};var qE;function c9(){return qE||(qE=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&&!U());){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 U(){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=U,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 UE;function u9(){return UE||(UE=1,Gy.exports=c9()),Gy.exports}var WE;function d9(){if(WE)return ta;WE=1;var e=aC(),t=u9();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"),U=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 U: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")?Ge(l,u.type,g):u.hasOwnProperty("defaultValue")&&Ge(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 Ge(l,u,g){(u!=="number"||ve(l.ownerDocument)!==l)&&(g==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+g&&(l.defaultValue=""+g))}var ke=Array.isArray;function Pe(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 et(l,u){if(u.dangerouslySetInnerHTML!=null)throw Error(n(91));return X({},u,{value:void 0,defaultValue:void 0,children:""+l._wrapperState.initialValue})}function ht(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(ke(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 zt(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 Bt(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 sn,Ut=(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(sn=sn||document.createElement("div"),sn.innerHTML="<svg>"+u.valueOf().toString()+"</svg>",u=sn.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;u.firstChild;)l.appendChild(u.firstChild)}});function nn(l,u){if(u){var g=l.firstChild;if(g&&g===l.lastChild&&g.nodeType===3){g.nodeValue=u;return}}l.textContent=u}var rn={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},on=["Webkit","ms","Moz","O"];Object.keys(rn).forEach(function(l){on.forEach(function(u){u=u+l.charAt(0).toUpperCase()+l.substring(1),rn[u]=rn[l]})});function _e(l,u,g){return u==null||typeof u=="boolean"||u===""?"":g||typeof u!="number"||u===0||rn.hasOwnProperty(l)&&rn[l]?(""+u).trim():u+"px"}function Be(l,u){l=l.style;for(var g in u)if(u.hasOwnProperty(g)){var w=g.indexOf("--")===0,_=_e(g,u[g],w);g==="float"&&(g="cssFloat"),w?l.setProperty(g,_):l[g]=_}}var Ye=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 Et(l,u){if(u){if(Ye[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 ft(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 Oe(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var Ke=null,q=null,le=null;function pe(l){if(l=cd(l)){if(typeof Ke!="function")throw Error(n(280));var u=l.stateNode;u&&(u=Up(u),Ke(l.stateNode,l.type,u))}}function J(l){q?le?le.push(l):le=[l]:q=l}function xe(){if(q){var l=q,u=le;if(le=q=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,(q!==null||le!==null)&&(we(),xe())}}function Ae(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 He=!1;if(c)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){He=!0}}),window.addEventListener("test",ee,ee),window.removeEventListener("test",ee,ee)}catch{He=!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,Wt=null,Re=!1,Jt=null,Ct={onError:function(l){ot=!0,Wt=l}};function Yt(l,u,g,w,_,R,L,te,ce){ot=!1,Wt=null,Le.apply(Ct,arguments)}function Xn(l,u,g,w,_,R,L,te,ce){if(Yt.apply(this,arguments),ot){if(ot){var Ce=Wt;ot=!1,Wt=null}else throw Error(n(198));Re||(Re=!0,Jt=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,Xt=t.unstable_LowPriority,Pt=t.unstable_IdlePriority,Ft=null,tn=null;function sr(l){if(tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(Ft,l,void 0,(l.current.flags&128)===128)}catch{}}var Sn=Math.clz32?Math.clz32:vt,ne=Math.log,Te=Math.LN2;function vt(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 Mt=0;function Ql(l){return l&=-l,1<l?4<l?(l&268435455)!==0?16:536870912:4:1}var vk,mx,xk,yk,bk,gx=!1,Ap=[],Ko=null,Go=null,Yo=null,Ku=new Map,Gu=new Map,Xo=[],kU="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 wk(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 AU(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 jk(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,bk(l.priority,function(){xk(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 Sk(l,u,g){Ep(l)&&g.delete(u)}function EU(){gx=!1,Ko!==null&&Ep(Ko)&&(Ko=null),Go!==null&&Ep(Go)&&(Go=null),Yo!==null&&Ep(Yo)&&(Yo=null),Ku.forEach(Sk),Gu.forEach(Sk)}function Xu(l,u){l.blockedOn===u&&(l.blockedOn=null,gx||(gx=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,EU)))}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);)jk(g),g.blockedOn===null&&Xo.shift()}var Jl=k.ReactCurrentBatchConfig,Pp=!0;function PU(l,u,g,w){var _=Mt,R=Jl.transition;Jl.transition=null;try{Mt=1,vx(l,u,g,w)}finally{Mt=_,Jl.transition=R}}function RU(l,u,g,w){var _=Mt,R=Jl.transition;Jl.transition=null;try{Mt=4,vx(l,u,g,w)}finally{Mt=_,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),wk(l,w);else if(AU(_,l,u,g,w))w.stopPropagation();else if(wk(l,w),u&4&&-1<kU.indexOf(l)){for(;_!==null;){var R=cd(_);if(R!==null&&vk(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=Oe(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 Nk(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 Xt:return 16;case Pt:return 536870912;default:return 16}default:return 16}}var Qo=null,yx=null,Tp=null;function Ck(){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 _k(){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:_k,this.isPropagationStopped=_k,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}),TU=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}}),kk=ha(Ip),OU=X({},Ip,{dataTransfer:0}),MU=ha(OU),IU=X({},Ju,{relatedTarget:0}),Sx=ha(IU),$U=X({},Zl,{animationName:0,elapsedTime:0,pseudoElement:0}),DU=ha($U),LU=X({},Zl,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),FU=ha(LU),zU=X({},Zl,{data:0}),Ak=ha(zU),BU={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qU={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"},UU={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function WU(l){var u=this.nativeEvent;return u.getModifierState?u.getModifierState(l):(l=UU[l])?!!u[l]:!1}function Nx(){return WU}var HU=X({},Ju,{key:function(l){if(l.key){var u=BU[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"?qU[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}}),VU=ha(HU),KU=X({},Ip,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ek=ha(KU),GU=X({},Ju,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nx}),YU=ha(GU),XU=X({},Zl,{propertyName:0,elapsedTime:0,pseudoElement:0}),QU=ha(XU),JU=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}),ZU=ha(JU),e7=[9,13,27,32],Cx=c&&"CompositionEvent"in window,ed=null;c&&"documentMode"in document&&(ed=document.documentMode);var t7=c&&"TextEvent"in window&&!ed,Pk=c&&(!Cx||ed&&8<ed&&11>=ed),Rk=" ",Tk=!1;function Ok(l,u){switch(l){case"keyup":return e7.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mk(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ec=!1;function n7(l,u){switch(l){case"compositionend":return Mk(u);case"keypress":return u.which!==32?null:(Tk=!0,Rk);case"textInput":return l=u.data,l===Rk&&Tk?null:l;default:return null}}function r7(l,u){if(ec)return l==="compositionend"||!Cx&&Ok(l,u)?(l=Ck(),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 Pk&&u.locale!=="ko"?null:u.data;default:return null}}var a7={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 Ik(l){var u=l&&l.nodeName&&l.nodeName.toLowerCase();return u==="input"?!!a7[l.type]:u==="textarea"}function $k(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 s7(l){eA(l,0)}function $p(l){var u=sc(l);if(ge(u))return l}function o7(l,u){if(l==="change")return u}var Dk=!1;if(c){var _x;if(c){var kx="oninput"in document;if(!kx){var Lk=document.createElement("div");Lk.setAttribute("oninput","return;"),kx=typeof Lk.oninput=="function"}_x=kx}else _x=!1;Dk=_x&&(!document.documentMode||9<document.documentMode)}function Fk(){td&&(td.detachEvent("onpropertychange",zk),nd=td=null)}function zk(l){if(l.propertyName==="value"&&$p(nd)){var u=[];$k(u,nd,l,Oe(l)),he(s7,u)}}function i7(l,u,g){l==="focusin"?(Fk(),td=u,nd=g,td.attachEvent("onpropertychange",zk)):l==="focusout"&&Fk()}function l7(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return $p(nd)}function c7(l,u){if(l==="click")return $p(u)}function u7(l,u){if(l==="input"||l==="change")return $p(u)}function d7(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var cs=typeof Object.is=="function"?Object.is:d7;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 Bk(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function qk(l,u){var g=Bk(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=Bk(g)}}function Uk(l,u){return l&&u?l===u?!0:l&&l.nodeType===3?!1:u&&u.nodeType===3?Uk(l,u.parentNode):"contains"in l?l.contains(u):l.compareDocumentPosition?!!(l.compareDocumentPosition(u)&16):!1:!1}function Wk(){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 f7(l){var u=Wk(),g=l.focusedElem,w=l.selectionRange;if(u!==g&&g&&g.ownerDocument&&Uk(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=_),_=qk(g,R);var L=qk(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 p7=c&&"documentMode"in document&&11>=document.documentMode,tc=null,Ex=null,ad=null,Px=!1;function Hk(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={},Vk={};c&&(Vk=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 Vk)return Rx[l]=u[g];return l}var Kk=Lp("animationend"),Gk=Lp("animationiteration"),Yk=Lp("animationstart"),Xk=Lp("transitionend"),Qk=new Map,Jk="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){Qk.set(l,u),o(u,[l])}for(var Tx=0;Tx<Jk.length;Tx++){var Ox=Jk[Tx],h7=Ox.toLowerCase(),m7=Ox[0].toUpperCase()+Ox.slice(1);Jo(h7,"on"+m7)}Jo(Kk,"onAnimationEnd"),Jo(Gk,"onAnimationIteration"),Jo(Yk,"onAnimationStart"),Jo("dblclick","onDoubleClick"),Jo("focusin","onFocus"),Jo("focusout","onBlur"),Jo(Xk,"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(" "),g7=new Set("cancel close invalid load scroll toggle".split(" ").concat(sd));function Zk(l,u,g){var w=l.type||"unknown-event";l.currentTarget=g,Xn(w,u,void 0,l),l.currentTarget=null}function eA(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;Zk(_,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;Zk(_,te,Ce),R=ce}}}if(Re)throw l=Jt,Re=!1,Jt=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)||(tA(u,l,2,!1),g.add(w))}function Mx(l,u,g){var w=0;u&&(w|=4),tA(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"&&(g7.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 tA(l,u,g,w){switch(Nk(u)){case 1:var _=PU;break;case 4:_=RU;break;default:_=vx}g=_.bind(null,u,g,l),_=void 0,!He||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=Oe(g),Ve=[];e:{var Fe=Qk.get(l);if(Fe!==void 0){var dt=bx,xt=l;switch(l){case"keypress":if(Op(g)===0)break e;case"keydown":case"keyup":dt=VU;break;case"focusin":xt="focus",dt=Sx;break;case"focusout":xt="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=kk;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":dt=MU;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":dt=YU;break;case Kk:case Gk:case Yk:dt=DU;break;case Xk:dt=QU;break;case"scroll":dt=TU;break;case"wheel":dt=ZU;break;case"copy":case"cut":case"paste":dt=FU;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":dt=Ek}var yt=(u&4)!==0,Jn=!yt&&l==="scroll",je=yt?Fe!==null?Fe+"Capture":null:Fe;yt=[];for(var me=Ce,Ne;me!==null;){Ne=me;var Xe=Ne.stateNode;if(Ne.tag===5&&Xe!==null&&(Ne=Xe,je!==null&&(Xe=Ae(me,je),Xe!=null&&yt.push(id(me,Xe,Ne)))),Jn)break;me=me.return}0<yt.length&&(Fe=new dt(Fe,xt,null,g,ze),Ve.push({event:Fe,listeners:yt}))}}if((u&7)===0){e:{if(Fe=l==="mouseover"||l==="pointerover",dt=l==="mouseout"||l==="pointerout",Fe&&g!==fe&&(xt=g.relatedTarget||g.fromElement)&&(qi(xt)||xt[ao]))break e;if((dt||Fe)&&(Fe=ze.window===ze?ze:(Fe=ze.ownerDocument)?Fe.defaultView||Fe.parentWindow:window,dt?(xt=g.relatedTarget||g.toElement,dt=Ce,xt=xt?qi(xt):null,xt!==null&&(Jn=qn(xt),xt!==Jn||xt.tag!==5&&xt.tag!==6)&&(xt=null)):(dt=null,xt=Ce),dt!==xt)){if(yt=kk,Xe="onMouseLeave",je="onMouseEnter",me="mouse",(l==="pointerout"||l==="pointerover")&&(yt=Ek,Xe="onPointerLeave",je="onPointerEnter",me="pointer"),Jn=dt==null?Fe:sc(dt),Ne=xt==null?Fe:sc(xt),Fe=new yt(Xe,me+"leave",dt,g,ze),Fe.target=Jn,Fe.relatedTarget=Ne,Xe=null,qi(ze)===Ce&&(yt=new yt(je,me+"enter",xt,g,ze),yt.target=Ne,yt.relatedTarget=Jn,Xe=yt),Jn=Xe,dt&&xt)t:{for(yt=dt,je=xt,me=0,Ne=yt;Ne;Ne=rc(Ne))me++;for(Ne=0,Xe=je;Xe;Xe=rc(Xe))Ne++;for(;0<me-Ne;)yt=rc(yt),me--;for(;0<Ne-me;)je=rc(je),Ne--;for(;me--;){if(yt===je||je!==null&&yt===je.alternate)break t;yt=rc(yt),je=rc(je)}yt=null}else yt=null;dt!==null&&nA(Ve,Fe,dt,yt,!1),xt!==null&&Jn!==null&&nA(Ve,Jn,xt,yt,!0)}}e:{if(Fe=Ce?sc(Ce):window,dt=Fe.nodeName&&Fe.nodeName.toLowerCase(),dt==="select"||dt==="input"&&Fe.type==="file")var jt=o7;else if(Ik(Fe))if(Dk)jt=u7;else{jt=l7;var Rt=i7}else(dt=Fe.nodeName)&&dt.toLowerCase()==="input"&&(Fe.type==="checkbox"||Fe.type==="radio")&&(jt=c7);if(jt&&(jt=jt(l,Ce))){$k(Ve,jt,g,ze);break e}Rt&&Rt(l,Fe,Ce),l==="focusout"&&(Rt=Fe._wrapperState)&&Rt.controlled&&Fe.type==="number"&&Ge(Fe,"number",Fe.value)}switch(Rt=Ce?sc(Ce):window,l){case"focusin":(Ik(Rt)||Rt.contentEditable==="true")&&(tc=Rt,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,Hk(Ve,g,ze);break;case"selectionchange":if(p7)break;case"keydown":case"keyup":Hk(Ve,g,ze)}var Tt;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?Ok(l,g)&&(qt="onCompositionEnd"):l==="keydown"&&g.keyCode===229&&(qt="onCompositionStart");qt&&(Pk&&g.locale!=="ko"&&(ec||qt!=="onCompositionStart"?qt==="onCompositionEnd"&&ec&&(Tt=Ck()):(Qo=ze,yx="value"in Qo?Qo.value:Qo.textContent,ec=!0)),Rt=zp(Ce,qt),0<Rt.length&&(qt=new Ak(qt,l,null,g,ze),Ve.push({event:qt,listeners:Rt}),Tt?qt.data=Tt:(Tt=Mk(g),Tt!==null&&(qt.data=Tt)))),(Tt=t7?n7(l,g):r7(l,g))&&(Ce=zp(Ce,"onBeforeInput"),0<Ce.length&&(ze=new Ak("onBeforeInput","beforeinput",null,g,ze),Ve.push({event:ze,listeners:Ce}),ze.data=Tt))}eA(Ve,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=Ae(l,g),R!=null&&w.unshift(id(l,R,_)),R=Ae(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 nA(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=Ae(g,R),ce!=null&&L.unshift(id(g,ce,te))):_||(ce=Ae(g,R),ce!=null&&L.push(id(g,ce,te)))),g=g.return}L.length!==0&&l.push({event:u,listeners:L})}var v7=/\r\n?/g,x7=/\u0000|\uFFFD/g;function rA(l){return(typeof l=="string"?l:""+l).replace(v7,`
|
|
6
|
-
`).replace(x7,"")}function Bp(l,u,g){if(u=rA(u),rA(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,y7=typeof clearTimeout=="function"?clearTimeout:void 0,aA=typeof Promise=="function"?Promise:void 0,b7=typeof queueMicrotask=="function"?queueMicrotask:typeof aA<"u"?function(l){return aA.resolve(null).then(l).catch(w7)}:Fx;function w7(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 sA(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,j7="__reactListeners$"+ac,S7="__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=sA(l);l!==null;){if(g=l[Ms])return g;l=sA(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 oA(l,u,g){if(Er.current!==ti)throw Error(n(168));Cn(Er,u),Cn(Xr,g)}function iA(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 lA(l,u,g){var w=l.stateNode;if(!w)throw Error(n(169));g?(l=iA(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 cA(l){so===null?so=[l]:so.push(l)}function N7(l){Vp=!0,cA(l)}function ni(){if(!Ux&&so!==null){Ux=!0;var l=0,u=Mt;try{var g=so;for(Mt=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{Mt=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 uA(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),uA(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 dA(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 fA(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(!fA(l,u)){if(Vx(l))throw Error(n(418));u=Zo(g.nextSibling);var w=ma;u&&fA(l,u)?dA(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 pA(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 pA(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 hA(),Error(n(418));for(;u;)dA(l,u),u=Zo(u.nextSibling)}if(pA(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 hA(){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 C7=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 mA(l){var u=l._init;return u(l._payload)}function gA(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&&mA(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 Ve(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 Ve(je,Xe(me._payload),Ne)}if(ke(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(ke(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 Rt=Xe._init;return dt(je,me,Ne,Rt(Xe._payload),jt)}if(ke(Xe)||M(Xe))return je=je.get(Ne)||null,ze(me,je,Xe,jt,null);Xp(me,Xe)}return null}function xt(je,me,Ne,Xe){for(var jt=null,Rt=null,Tt=me,qt=me=0,xr=null;Tt!==null&&qt<Ne.length;qt++){Tt.index>qt?(xr=Tt,Tt=null):xr=Tt.sibling;var cn=Fe(je,Tt,Ne[qt],Xe);if(cn===null){Tt===null&&(Tt=xr);break}l&&Tt&&cn.alternate===null&&u(je,Tt),me=R(cn,me,qt),Rt===null?jt=cn:Rt.sibling=cn,Rt=cn,Tt=xr}if(qt===Ne.length)return g(je,Tt),Fn&&Hi(je,qt),jt;if(Tt===null){for(;qt<Ne.length;qt++)Tt=Ve(je,Ne[qt],Xe),Tt!==null&&(me=R(Tt,me,qt),Rt===null?jt=Tt:Rt.sibling=Tt,Rt=Tt);return Fn&&Hi(je,qt),jt}for(Tt=w(je,Tt);qt<Ne.length;qt++)xr=dt(Tt,je,qt,Ne[qt],Xe),xr!==null&&(l&&xr.alternate!==null&&Tt.delete(xr.key===null?qt:xr.key),me=R(xr,me,qt),Rt===null?jt=xr:Rt.sibling=xr,Rt=xr);return l&&Tt.forEach(function(di){return u(je,di)}),Fn&&Hi(je,qt),jt}function yt(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 Rt=jt=null,Tt=me,qt=me=0,xr=null,cn=Ne.next();Tt!==null&&!cn.done;qt++,cn=Ne.next()){Tt.index>qt?(xr=Tt,Tt=null):xr=Tt.sibling;var di=Fe(je,Tt,cn.value,Xe);if(di===null){Tt===null&&(Tt=xr);break}l&&Tt&&di.alternate===null&&u(je,Tt),me=R(di,me,qt),Rt===null?jt=di:Rt.sibling=di,Rt=di,Tt=xr}if(cn.done)return g(je,Tt),Fn&&Hi(je,qt),jt;if(Tt===null){for(;!cn.done;qt++,cn=Ne.next())cn=Ve(je,cn.value,Xe),cn!==null&&(me=R(cn,me,qt),Rt===null?jt=cn:Rt.sibling=cn,Rt=cn);return Fn&&Hi(je,qt),jt}for(Tt=w(je,Tt);!cn.done;qt++,cn=Ne.next())cn=dt(Tt,je,qt,cn.value,Xe),cn!==null&&(l&&cn.alternate!==null&&Tt.delete(cn.key===null?qt:cn.key),me=R(cn,me,qt),Rt===null?jt=cn:Rt.sibling=cn,Rt=cn);return l&&Tt.forEach(function(a9){return u(je,a9)}),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,Rt=me;Rt!==null;){if(Rt.key===jt){if(jt=Ne.type,jt===P){if(Rt.tag===7){g(je,Rt.sibling),me=_(Rt,Ne.props.children),me.return=je,je=me;break e}}else if(Rt.elementType===jt||typeof jt=="object"&&jt!==null&&jt.$$typeof===T&&mA(jt)===Rt.type){g(je,Rt.sibling),me=_(Rt,Ne.props),me.ref=ud(je,Rt,Ne),me.return=je,je=me;break e}g(je,Rt);break}else u(je,Rt);Rt=Rt.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(Rt=Ne.key;me!==null;){if(me.key===Rt)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 Rt=Ne._init,Jn(je,me,Rt(Ne._payload),Xe)}if(ke(Ne))return xt(je,me,Ne,Xe);if(M(Ne))return yt(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=gA(!0),vA=gA(!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 xA(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 yA(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 bA(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 Ve=_.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 xt=l,yt=te;switch(Fe=u,dt=g,yt.tag){case 1:if(xt=yt.payload,typeof xt=="function"){Ve=xt.call(dt,Ve,Fe);break e}Ve=xt;break e;case 3:xt.flags=xt.flags&-65537|128;case 0:if(xt=yt.payload,Fe=typeof xt=="function"?xt.call(dt,Ve,Fe):xt,Fe==null)break e;Ve=X({},Ve,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=Ve):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=Ve),_.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=Ve}}function wA(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 jA(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,_7=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?P7:R7,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=T7,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 Ve={lane:ze,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null};ce===null?(te=ce=Ve,L=w):ce=ce.next=Ve,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 SA(){}function NA(l,u){var g=Wn,w=Ma(),_=u(),R=!cs(w.memoizedState,_);if(R&&(w.memoizedState=_,Jr=!0),w=w.queue,dy(kA.bind(null,g,w,l),[l]),w.getSnapshot!==u||R||gr!==null&&gr.memoizedState.tag&1){if(g.flags|=2048,vd(9,_A.bind(null,g,w,_,u),void 0,null),vr===null)throw Error(n(349));(Gi&30)!==0||CA(g,u,_)}return _}function CA(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 _A(l,u,g,w){u.value=g,u.getSnapshot=w,AA(u)&&EA(l)}function kA(l,u,g){return g(function(){AA(u)&&EA(l)})}function AA(l){var u=l.getSnapshot;l=l.value;try{var g=u();return!cs(l,g)}catch{return!0}}function EA(l){var u=lo(l,1);u!==null&&hs(u,l,1,-1)}function PA(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=E7.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 RA(){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 TA(l,u){return ah(8390656,8,l,u)}function dy(l,u){return sh(2048,8,l,u)}function OA(l,u){return sh(4,2,l,u)}function MA(l,u){return sh(4,4,l,u)}function IA(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 $A(l,u,g){return g=g!=null?g.concat([l]):null,sh(4,4,IA.bind(null,u,l),g)}function fy(){}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]:(g.memoizedState=[l,u],l)}function LA(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 FA(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 k7(l,u){var g=Mt;Mt=g!==0&&4>g?g:4,l(!0);var w=sy.transition;sy.transition={};try{l(!1),u()}finally{Mt=g,sy.transition=w}}function zA(){return Ma().memoizedState}function A7(l,u,g){var w=li(l);if(g={lane:w,action:g,hasEagerState:!1,eagerState:null,next:null},BA(l))qA(u,g);else if(g=xA(l,u,g,w),g!==null){var _=Dr();hs(g,l,w,_),UA(g,u,w)}}function E7(l,u,g){var w=li(l),_={lane:w,action:g,hasEagerState:!1,eagerState:null,next:null};if(BA(l))qA(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=xA(l,u,_,w),g!==null&&(_=Dr(),hs(g,l,w,_),UA(g,u,w))}}function BA(l){var u=l.alternate;return l===Wn||u!==null&&u===Wn}function qA(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 UA(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},P7={readContext:Oa,useCallback:function(l,u){return $s().memoizedState=[l,u===void 0?null:u],l},useContext:Oa,useEffect:TA,useImperativeHandle:function(l,u,g){return g=g!=null?g.concat([l]):null,ah(4194308,4,IA.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=A7.bind(null,Wn,l),[w.memoizedState,l]},useRef:function(l){var u=$s();return l={current:l},u.memoizedState=l},useState:PA,useDebugValue:fy,useDeferredValue:function(l){return $s().memoizedState=l},useTransition:function(){var l=PA(!1),u=l[0];return l=k7.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||CA(w,u,g)}_.memoizedState=g;var R={value:g,getSnapshot:u};return _.queue=R,TA(kA.bind(null,w,R,l),[l]),w.flags|=2048,vd(9,_A.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=_7++,u=":"+u+"r"+g.toString(32)+":";return l.memoizedState=u},unstable_isNewReconciler:!1},R7={readContext:Oa,useCallback:DA,useContext:Oa,useEffect:dy,useImperativeHandle:$A,useInsertionEffect:OA,useLayoutEffect:MA,useMemo:LA,useReducer:cy,useRef:RA,useState:function(){return cy(gd)},useDebugValue:fy,useDeferredValue:function(l){var u=Ma();return FA(u,or.memoizedState,l)},useTransition:function(){var l=cy(gd)[0],u=Ma().memoizedState;return[l,u]},useMutableSource:SA,useSyncExternalStore:NA,useId:zA,unstable_isNewReconciler:!1},T7={readContext:Oa,useCallback:DA,useContext:Oa,useEffect:dy,useImperativeHandle:$A,useInsertionEffect:OA,useLayoutEffect:MA,useMemo:LA,useReducer:uy,useRef:RA,useState:function(){return uy(gd)},useDebugValue:fy,useDeferredValue:function(l){var u=Ma();return or===null?u.memoizedState=l:FA(u,or.memoizedState,l)},useTransition:function(){var l=uy(gd)[0],u=Ma().memoizedState;return[l,u]},useMutableSource:SA,useSyncExternalStore:NA,useId:zA,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 WA(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 HA(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 VA(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 O7=typeof WeakMap=="function"?WeakMap:Map;function KA(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 GA(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 YA(l,u,g){var w=l.pingCache;if(w===null){w=l.pingCache=new O7;var _=new Set;w.set(u,_)}else _=w.get(u),_===void 0&&(_=new Set,w.set(u,_));_.has(g)||(_.add(g),l=K7.bind(null,l,u,g),u.then(l,l))}function XA(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 QA(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 M7=k.ReactCurrentOwner,Jr=!1;function $r(l,u,g,w){u.child=l===null?vA(u,null,g,w):dc(u,l.child,g,w)}function JA(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 ZA(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,eE(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 eE(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 tE(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 nE(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 rE(l,u,g,w,_){if(Qr(g)){var R=!0;Hp(u)}else R=!1;if(pc(u,_),u.stateNode===null)ch(l,u),HA(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,Ve=typeof ze=="function"||typeof L.getSnapshotBeforeUpdate=="function";Ve||typeof L.UNSAFE_componentWillReceiveProps!="function"&&typeof L.componentWillReceiveProps!="function"||(te!==w||ce!==Ce)&&VA(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||WA(u,g,te,w,Fe,ce,Ce))?(Ve||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,yA(l,u),te=u.memoizedProps,Ce=u.type===u.elementType?te:ds(u.type,te),L.props=Ce,Ve=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!==Ve||Fe!==ce)&&VA(u,L,w,ce),ri=!1,Fe=u.memoizedState,L.state=Fe,eh(u,w,L,_);var xt=u.memoizedState;te!==Ve||Fe!==xt||Xr.current||ri?(typeof dt=="function"&&(py(u,g,dt,w),xt=u.memoizedState),(Ce=ri||WA(u,g,Ce,w,Fe,xt,ce)||!1)?(ze||typeof L.UNSAFE_componentWillUpdate!="function"&&typeof L.componentWillUpdate!="function"||(typeof L.componentWillUpdate=="function"&&L.componentWillUpdate(w,xt,ce),typeof L.UNSAFE_componentWillUpdate=="function"&&L.UNSAFE_componentWillUpdate(w,xt,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=xt),L.props=w,L.state=xt,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){nE(l,u);var L=(u.flags&128)!==0;if(!w&&!L)return _&&lA(u,g,!1),uo(l,u,R);w=u.stateNode,M7.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,_&&lA(u,g,!0),u.child}function aE(l){var u=l.stateNode;u.pendingContext?oA(l,u.pendingContext,u.pendingContext!==u.context):u.context&&oA(l,u.context,!1),ty(l,u.containerInfo)}function sE(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 oE(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 I7(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 I7(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=G7.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 iE(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 lE(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&&iE(l,g,u);else if(l.tag===19)iE(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 $7(l,u,g){switch(u.tag){case 3:aE(u),uc();break;case 5:jA(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?oE(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 lE(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,tE(l,u,g)}return uo(l,u,g)}var cE,Sy,uE,dE;cE=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(){},uE=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":_=et(l,_),w=et(l,w),R=[];break;default:typeof _.onClick!="function"&&typeof w.onClick=="function"&&(l.onclick=qp)}Et(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)}},dE=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 D7(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)uE(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":ht(w,R),Rn("invalid",w)}Et(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),Bt(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,cE(l,u,!1,!1),u.stateNode=l;e:{switch(L=ft(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":ht(l,w),_=et(l,w),Rn("invalid",l);break;default:_=w}Et(g,_),te=_;for(R in te)if(te.hasOwnProperty(R)){var ce=te[R];R==="style"?Be(l,ce):R==="dangerouslySetInnerHTML"?(ce=ce?ce.__html:void 0,ce!=null&&Ut(l,ce)):R==="children"?typeof ce=="string"?(g!=="textarea"||ce!=="")&&nn(l,ce):typeof ce=="number"&&nn(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),Bt(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?Pe(l,!!w.multiple,R,!1):w.defaultValue!=null&&Pe(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)dE(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)hA(),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 L7(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,F7=typeof WeakSet=="function"?WeakSet:Set,mt=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 fE=!1;function z7(l,u){if($x=Pp,l=Wk(),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,Ve=l,Fe=null;t:for(;;){for(var dt;Ve!==g||_!==0&&Ve.nodeType!==3||(te=L+_),Ve!==R||w!==0&&Ve.nodeType!==3||(ce=L+w),Ve.nodeType===3&&(L+=Ve.nodeValue.length),(dt=Ve.firstChild)!==null;)Fe=Ve,Ve=dt;for(;;){if(Ve===l)break t;if(Fe===g&&++Ce===_&&(te=L),Fe===R&&++ze===w&&(ce=L),(dt=Ve.nextSibling)!==null)break;Ve=Fe,Fe=Ve.parentNode}Ve=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,mt=u;mt!==null;)if(u=mt,l=u.child,(u.subtreeFlags&1028)!==0&&l!==null)l.return=u,mt=l;else for(;mt!==null;){u=mt;try{var xt=u.alternate;if((u.flags&1024)!==0)switch(u.tag){case 0:case 11:case 15:break;case 1:if(xt!==null){var yt=xt.memoizedProps,Jn=xt.memoizedState,je=u.stateNode,me=je.getSnapshotBeforeUpdate(u.elementType===u.type?yt:ds(u.type,yt),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,mt=l;break}mt=u.return}return xt=fE,fE=!1,xt}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 pE(l){var u=l.alternate;u!==null&&(l.alternate=null,pE(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[j7],delete u[S7])),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 hE(l){return l.tag===5||l.tag===3||l.tag===4}function mE(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||hE(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;)gE(l,u,g),g=g.sibling}function gE(l,u,g){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.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 vE(l){var u=l.updateQueue;if(u!==null){l.updateQueue=null;var g=l.stateNode;g===null&&(g=l.stateNode=new F7),u.forEach(function(w){var _=Y7.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));gE(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;)xE(u,l),u=u.sibling}function xE(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(yt){Kn(l,l.return,yt)}try{yd(5,l,l.return)}catch(yt){Kn(l,l.return,yt)}}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{nn(_,"")}catch(yt){Kn(l,l.return,yt)}}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),ft(te,L);var Ce=ft(te,R);for(L=0;L<ce.length;L+=2){var ze=ce[L],Ve=ce[L+1];ze==="style"?Be(_,Ve):ze==="dangerouslySetInnerHTML"?Ut(_,Ve):ze==="children"?nn(_,Ve):C(_,ze,Ve,Ce)}switch(te){case"input":it(_,R);break;case"textarea":zt(_,R);break;case"select":var Fe=_._wrapperState.wasMultiple;_._wrapperState.wasMultiple=!!R.multiple;var dt=R.value;dt!=null?Pe(_,!!R.multiple,dt,!1):Fe!==!!R.multiple&&(R.defaultValue!=null?Pe(_,!!R.multiple,R.defaultValue,!0):Pe(_,!!R.multiple,R.multiple?[]:"",!1))}_[ld]=R}catch(yt){Kn(l,l.return,yt)}}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(yt){Kn(l,l.return,yt)}}break;case 3:if(ps(u,l),Ds(l),w&4&&g!==null&&g.memoizedState.isDehydrated)try{Qu(u.containerInfo)}catch(yt){Kn(l,l.return,yt)}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&&vE(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(mt=l,ze=l.child;ze!==null;){for(Ve=mt=ze;mt!==null;){switch(Fe=mt,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 xt=Fe.stateNode;if(typeof xt.componentWillUnmount=="function"){w=Fe,g=Fe.return;try{u=w,xt.props=u.memoizedProps,xt.state=u.memoizedState,xt.componentWillUnmount()}catch(yt){Kn(w,g,yt)}}break;case 5:gc(Fe,Fe.return);break;case 22:if(Fe.memoizedState!==null){wE(Ve);continue}}dt!==null?(dt.return=Fe,mt=dt):wE(Ve)}ze=ze.sibling}e:for(ze=null,Ve=l;;){if(Ve.tag===5){if(ze===null){ze=Ve;try{_=Ve.stateNode,Ce?(R=_.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none"):(te=Ve.stateNode,ce=Ve.memoizedProps.style,L=ce!=null&&ce.hasOwnProperty("display")?ce.display:null,te.style.display=_e("display",L))}catch(yt){Kn(l,l.return,yt)}}}else if(Ve.tag===6){if(ze===null)try{Ve.stateNode.nodeValue=Ce?"":Ve.memoizedProps}catch(yt){Kn(l,l.return,yt)}}else if((Ve.tag!==22&&Ve.tag!==23||Ve.memoizedState===null||Ve===l)&&Ve.child!==null){Ve.child.return=Ve,Ve=Ve.child;continue}if(Ve===l)break e;for(;Ve.sibling===null;){if(Ve.return===null||Ve.return===l)break e;ze===Ve&&(ze=null),Ve=Ve.return}ze===Ve&&(ze=null),Ve.sibling.return=Ve.return,Ve=Ve.sibling}}break;case 19:ps(u,l),Ds(l),w&4&&vE(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(hE(g)){var w=g;break e}g=g.return}throw Error(n(160))}switch(w.tag){case 5:var _=w.stateNode;w.flags&32&&(nn(_,""),w.flags&=-33);var R=mE(l);ky(l,R,_);break;case 3:case 4:var L=w.stateNode.containerInfo,te=mE(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 B7(l,u,g){mt=l,yE(l)}function yE(l,u,g){for(var w=(l.mode&1)!==0;mt!==null;){var _=mt,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(mt=_;mt!==null;)L=mt,ce=L.child,L.tag===22&&L.memoizedState!==null?jE(_):ce!==null?(ce.return=L,mt=ce):jE(_);for(;R!==null;)mt=R,yE(R),R=R.sibling;mt=_,uh=te,Tr=Ce}bE(l)}else(_.subtreeFlags&8772)!==0&&R!==null?(R.return=_,mt=R):bE(l)}}function bE(l){for(;mt!==null;){var u=mt;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&&wA(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}wA(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 Ve=ze.dehydrated;Ve!==null&&Qu(Ve)}}}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){mt=null;break}if(g=u.sibling,g!==null){g.return=u.return,mt=g;break}mt=u.return}}function wE(l){for(;mt!==null;){var u=mt;if(u===l){mt=null;break}var g=u.sibling;if(g!==null){g.return=u.return,mt=g;break}mt=u.return}}function jE(l){for(;mt!==null;){var u=mt;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){mt=null;break}var te=u.sibling;if(te!==null){te.return=u.return,mt=te;break}mt=u.return}}var q7=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:C7.transition!==null?(xh===0&&(xh=Qn()),xh):(l=Mt,l!==0||(l=window.event,l=l===void 0?16:Nk(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?N7(NE.bind(null,l)):cA(NE.bind(null,l)),b7(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=Pt;break;default:g=nt}g=TE(g,SE.bind(null,l))}l.callbackPriority=u,l.callbackNode=g}}function SE(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=_E();(vr!==l||Nr!==u)&&(fo=null,xc=jn()+500,Qi(l,u));do try{H7();break}catch(te){CE(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&&!U7(_)&&(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*q7(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?SE.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 U7(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 NE(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=Mt;try{if(Ia.transition=null,Mt=1,l)return l()}finally{Mt=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,y7(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 CE(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,Ve=ze.tag;if((ze.mode&1)===0&&(Ve===0||Ve===11||Ve===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=XA(L);if(dt!==null){dt.flags&=-257,QA(dt,L,te,R,u),dt.mode&1&&YA(R,Ce,u),u=dt,ce=Ce;var xt=u.updateQueue;if(xt===null){var yt=new Set;yt.add(ce),u.updateQueue=yt}else xt.add(ce);break e}else{if((u&1)===0){YA(R,Ce,u),Dy();break e}ce=Error(n(426))}}else if(Fn&&te.mode&1){var Jn=XA(L);if(Jn!==null){(Jn.flags&65536)===0&&(Jn.flags|=256),QA(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=KA(R,ce,u);bA(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=GA(R,te,u);bA(R,Xe);break e}}R=R.return}while(R!==null)}AE(g)}catch(jt){u=jt,er===g&&g!==null&&(er=g=g.return);continue}break}while(!0)}function _E(){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=_E();(vr!==l||Nr!==u)&&(fo=null,Qi(l,u));do try{W7();break}catch(_){CE(l,_)}while(!0);if(Xx(),ln=g,fh.current=w,er!==null)throw Error(n(261));return vr=null,Nr=0,ir}function W7(){for(;er!==null;)kE(er)}function H7(){for(;er!==null&&!Ar();)kE(er)}function kE(l){var u=RE(l.alternate,l,va);l.memoizedProps=l.pendingProps,u===null?AE(l):er=u,Ay.current=null}function AE(l){var u=l;do{var g=u.alternate;if(l=u.return,(u.flags&32768)===0){if(g=D7(g,u,va),g!==null){er=g;return}}else{if(g=L7(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=Mt,_=Ia.transition;try{Ia.transition=null,Mt=1,V7(l,u,g,w)}finally{Ia.transition=_,Mt=w}return null}function V7(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,TE(nt,function(){return yc(),null})),R=(g.flags&15990)!==0,(g.subtreeFlags&15990)!==0||R){R=Ia.transition,Ia.transition=null;var L=Mt;Mt=1;var te=ln;ln|=4,Ay.current=null,z7(l,g),xE(g,l),f7(Dx),Pp=!!$x,Dx=$x=null,l.current=g,B7(g),Ho(),ln=te,Mt=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=Mt;try{if(Ia.transition=null,Mt=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,mt=l.current;mt!==null;){var R=mt,L=R.child;if((mt.flags&16)!==0){var te=R.deletions;if(te!==null){for(var ce=0;ce<te.length;ce++){var Ce=te[ce];for(mt=Ce;mt!==null;){var ze=mt;switch(ze.tag){case 0:case 11:case 15:yd(8,ze,R)}var Ve=ze.child;if(Ve!==null)Ve.return=ze,mt=Ve;else for(;mt!==null;){ze=mt;var Fe=ze.sibling,dt=ze.return;if(pE(ze),ze===Ce){mt=null;break}if(Fe!==null){Fe.return=dt,mt=Fe;break}mt=dt}}}var xt=R.alternate;if(xt!==null){var yt=xt.child;if(yt!==null){xt.child=null;do{var Jn=yt.sibling;yt.sibling=null,yt=Jn}while(yt!==null)}}mt=R}}if((R.subtreeFlags&2064)!==0&&L!==null)L.return=R,mt=L;else e:for(;mt!==null;){if(R=mt,(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,mt=je;break e}mt=R.return}}var me=l.current;for(mt=me;mt!==null;){L=mt;var Ne=L.child;if((L.subtreeFlags&2064)!==0&&Ne!==null)Ne.return=L,mt=Ne;else e:for(L=me;mt!==null;){if(te=mt,(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){mt=null;break e}var Xe=te.sibling;if(Xe!==null){Xe.return=te.return,mt=Xe;break e}mt=te.return}}if(ln=_,ni(),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(Ft,l)}catch{}w=!0}return w}finally{Mt=g,Ia.transition=u}}return!1}function EE(l,u,g){u=mc(g,u),u=KA(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)EE(l,l,g);else for(;u!==null;){if(u.tag===3){EE(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=GA(u,l,1),u=ai(u,l,1),l=Dr(),u!==null&&(mr(u,1,l),ea(u,l));break}}u=u.return}}function K7(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 PE(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 G7(l){var u=l.memoizedState,g=0;u!==null&&(g=u.retryLane),PE(l,g)}function Y7(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),PE(l,g)}var RE;RE=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,$7(l,u,g);Jr=(l.flags&131072)!==0}else Jr=!1,Fn&&(u.flags&1048576)!==0&&uA(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=Q7(w),l=ds(w,l),_){case 0:u=vy(null,u,w,l,g);break e;case 1:u=rE(null,u,w,l,g);break e;case 11:u=JA(null,u,w,l,g);break e;case 14:u=ZA(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,_),rE(l,u,w,_,g);case 3:e:{if(aE(u),l===null)throw Error(n(387));w=u.pendingProps,R=u.memoizedState,_=R.element,yA(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=sE(l,u,w,g,_);break e}else if(w!==_){_=mc(Error(n(424)),u),u=sE(l,u,w,g,_);break e}else for(ga=Zo(u.stateNode.containerInfo.firstChild),ma=u,Fn=!0,us=null,g=vA(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 jA(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),nE(l,u),$r(l,u,L,g),u.child;case 6:return l===null&&Kx(u),null;case 13:return oE(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,_),JA(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,_),ZA(l,u,w,_,g);case 15:return eE(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),HA(u,w,_),hy(u,w,_,g),xy(null,u,w,!0,l,g);case 19:return lE(l,u,g);case 22:return tE(l,u,g)}throw Error(n(156,u.tag))};function TE(l,u){return zi(l,u)}function X7(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 X7(l,u,g,w)}function Ly(l){return l=l.prototype,!(!l||!l.isReactComponent)}function Q7(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 U: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 J7(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 J7(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 Z7(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 OE(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 iA(l,g,u)}return u}function ME(l,u,g,w,_,R,L,te,ce){return l=By(g,w,!0,l,_,R,L,te,ce),l.context=OE(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=OE(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 IE(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){IE(l,u),(l=l.alternate)&&IE(l,u)}function e9(){return null}var $E=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=yk();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&&jk(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 DE(){}function t9(l,u,g,w,_){if(_){if(typeof w=="function"){var R=w;w=function(){var Ce=Sh(L);R.call(Ce)}}var L=ME(u,w,l,0,null,!1,!1,"",DE);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,"",DE);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=t9(g,u,l,_,w);return Sh(L)}vk=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)}},xk=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)}},yk=function(){return Mt},bk=function(l,u){var g=Mt;try{return Mt=l,u()}finally{Mt=g}},Ke=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":zt(l,g);break;case"select":u=g.value,u!=null&&Pe(l,!!g.multiple,u,!1)}},be=Iy,we=Xi;var n9={usingClientEntryPoint:!1,Events:[cd,sc,Up,J,xe,Iy]},Sd={findFiberByHostInstance:qi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},r9={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||e9,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(r9),tn=kh}catch{}}return ta.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=n9,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 Z7(l,u,null,g)},ta.createRoot=function(l,u){if(!Wy(l))throw Error(n(299));var g=!1,w="",_=$E;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=$E;if(g!=null&&(g.unstable_strictMode===!0&&(_=!0),g.identifierPrefix!==void 0&&(R=g.identifierPrefix),g.onRecoverableError!==void 0&&(L=g.onRecoverableError)),u=ME(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 HE;function UD(){if(HE)return Ky.exports;HE=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=d9(),Ky.exports}var VE;function f9(){if(VE)return Eh;VE=1;var e=UD();return Eh.createRoot=e.createRoot,Eh.hydrateRoot=e.hydrateRoot,Eh}var p9=f9(),h=aC();const Q=xn(h),sC=s9({__proto__:null,default:Q},[h]),h9=1,m9=1e6;let Xy=0;function g9(){return Xy=(Xy+1)%Number.MAX_SAFE_INTEGER,Xy.toString()}const Qy=new Map,KE=e=>{if(Qy.has(e))return;const t=setTimeout(()=>{Qy.delete(e),Vd({type:"REMOVE_TOAST",toastId:e})},m9);Qy.set(e,t)},v9=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,h9)};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?KE(n):e.toasts.forEach(r=>{KE(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=v9(am,e),rm.forEach(t=>{t(am)})}function Ie({...e}){const t=g9(),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 x9(){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:Ie,dismiss:n=>Vd({type:"DISMISS_TOAST",toastId:n})}}var _u=UD();const WD=xn(_u);function Ue(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}function GE(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=GE(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():GE(e[s],null)}}}}function Ot(...e){return h.useCallback(Vr(...e),e)}function y9(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,b9(s,...t)]}function b9(...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 YE(e){const t=w9(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),d=c.find(S9);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 w9(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=C9(s),c=N9(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 j9=Symbol("radix.slottable");function S9(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===j9}function N9(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 C9(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=YE(c),f=Q.forwardRef((y,b)=>{const{scope:S,children:N}=y,C=o(c,S),k=Ot(b,C.collectionRef);return a.jsx(d,{ref:k,children:N})});f.displayName=c;const m=e+"CollectionItemSlot",p="data-radix-collection-item",v=YE(m),x=Q.forwardRef((y,b)=>{const{scope:S,children:N,...C}=y,k=Q.useRef(null),A=Ot(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 _9(e){const t=k9(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),d=c.find(E9);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 k9(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=R9(s),c=P9(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 A9=Symbol("radix.slottable");function E9(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===A9}function P9(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 R9(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 T9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lt=T9.reduce((e,t)=>{const n=_9(`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 oC(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 O9(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 M9="DismissableLayer",qS="dismissableLayer.update",I9="dismissableLayer.pointerDownOutside",$9="dismissableLayer.focusOutside",XE,HD=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(HD),[m,p]=h.useState(null),v=m?.ownerDocument??globalThis?.document,[,x]=h.useState({}),j=Ot(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=L9(P=>{const O=P.target,D=[...f.branches].some(K=>K.contains(O));!k||D||(s?.(P),i?.(P),P.defaultPrevented||c?.())},v),E=F9(P=>{const O=P.target;[...f.branches].some(K=>K.contains(O))||(o?.(P),i?.(P),P.defaultPrevented||c?.())},v);return O9(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&&(XE=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(m)),f.layers.add(m),QE(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=XE)}},[m,v,n,f]),h.useEffect(()=>()=>{m&&(f.layers.delete(m),f.layersWithOutsidePointerEventsDisabled.delete(m),QE())},[m,f]),h.useEffect(()=>{const P=()=>x({});return document.addEventListener(qS,P),()=>document.removeEventListener(qS,P)},[]),a.jsx(lt.div,{...d,ref:j,style:{pointerEvents:C?k?"auto":"none":void 0,...e.style},onFocusCapture:Ue(e.onFocusCapture,E.onFocusCapture),onBlurCapture:Ue(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Ue(e.onPointerDownCapture,A.onPointerDownCapture)})});Fl.displayName=M9;var D9="DismissableLayerBranch",VD=h.forwardRef((e,t)=>{const n=h.useContext(HD),r=h.useRef(null),s=Ot(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})});VD.displayName=D9;function L9(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(){KD(I9,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 F9(e,t=globalThis?.document){const n=Zn(e),r=h.useRef(!1);return h.useEffect(()=>{const s=o=>{o.target&&!r.current&&KD($9,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 QE(){const e=new CustomEvent(qS);document.dispatchEvent(e)}function KD(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?oC(s,o):s.dispatchEvent(o)}var z9=Fl,B9=VD,pr=globalThis?.document?h.useLayoutEffect:()=>{},q9="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?WD.createPortal(a.jsx(lt.div,{...r,ref:t}),i):null});zl.displayName=q9;function U9(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var ar=e=>{const{present:t,children:n}=e,r=W9(t),s=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),o=Ot(r.ref,H9(s));return typeof n=="function"||r.isPresent?h.cloneElement(s,{ref:o}):null};ar.displayName="Presence";function W9(e){const[t,n]=h.useState(),r=h.useRef(null),s=h.useRef(e),o=h.useRef("none"),i=e?"mounted":"unmounted",[c,d]=U9(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 H9(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 V9=sC[" useInsertionEffect ".trim().toString()]||pr;function Aa({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=K9({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=G9(m)?m(e):m;p!==e&&i.current?.(p)}else o(m)},[c,e,o,i]);return[d,f]}function K9({defaultProp:e,onChange:t}){const[n,r]=h.useState(e),s=h.useRef(n),o=h.useRef(t);return V9(()=>{o.current=t},[t]),h.useEffect(()=>{s.current!==n&&(o.current?.(n),s.current=n)},[n,s]),[n,r,o]}function G9(e){return typeof e=="function"}var GD=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"}),Y9="VisuallyHidden",Dg=h.forwardRef((e,t)=>a.jsx(lt.span,{...e,ref:t,style:{...GD,...e.style}}));Dg.displayName=Y9;var X9=Dg,iC="ToastProvider",[lC,Q9,J9]=Qf("Toast"),[YD]=kr("Toast",[J9]),[Z9,Lg]=YD(iC),XD=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 \`${iC}\`. Expected non-empty \`string\`.`),a.jsx(lC.Provider,{scope:t,children:a.jsx(Z9,{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})})};XD.displayName=iC;var QD="ToastViewport",eW=["F8"],US="toast.viewportPause",WS="toast.viewportResume",JD=h.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=eW,label:s="Notifications ({hotkey})",...o}=e,i=Lg(QD,n),c=Q9(n),d=h.useRef(null),f=h.useRef(null),m=h.useRef(null),p=h.useRef(null),v=Ot(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(US);S.dispatchEvent(E),i.isClosePausedRef.current=!0}},C=()=>{if(i.isClosePausedRef.current){const E=new CustomEvent(WS);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,...pW(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(U=>U===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(B9,{ref:d,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:j?void 0:"none"},children:[j&&a.jsx(HS,{ref:f,onFocusFromOutsideViewport:()=>{const b=y({tabbingDirection:"forwards"});Jy(b)}}),a.jsx(lC.Slot,{scope:n,children:a.jsx(lt.ol,{tabIndex:-1,...o,ref:v})}),j&&a.jsx(HS,{ref:m,onFocusFromOutsideViewport:()=>{const b=y({tabbingDirection:"backwards"});Jy(b)}})]})});JD.displayName=QD;var ZD="ToastFocusProxy",HS=h.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,o=Lg(ZD,n);return a.jsx(Dg,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{const c=i.relatedTarget;!o.viewport?.contains(c)&&r()}})});HS.displayName=ZD;var Jf="Toast",tW="toast.swipeStart",nW="toast.swipeMove",rW="toast.swipeCancel",aW="toast.swipeEnd",e5=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(iW,{open:c,...i,ref:t,onClose:()=>d(!1),onPause:Zn(e.onPause),onResume:Zn(e.onResume),onSwipeStart:Ue(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ue(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:Ue(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:Ue(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)})})})});e5.displayName=Jf;var[sW,oW]=YD(Jf,{onClose(){}}),iW=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=Ot(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,U=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(U,z))},[U]);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(US,T),z.addEventListener(WS,I),()=>{z.removeEventListener(US,T),z.removeEventListener(WS,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?i5(b):null,[b]);return y.viewport?a.jsxs(a.Fragment,{children:[Y&&a.jsx(lW,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:Y}),a.jsx(sW,{scope:n,onClose:U,children:_u.createPortal(a.jsx(lC.ItemSlot,{scope:n,children:a.jsx(z9,{asChild:!0,onEscapeKeyDown:Ue(c,()=>{y.isFocusedToastEscapeKeyDownRef.current||U(),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:Ue(e.onKeyDown,z=>{z.key==="Escape"&&(c?.(z.nativeEvent),z.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,U()))}),onPointerDown:Ue(e.onPointerDown,z=>{z.button===0&&(C.current={x:z.clientX,y:z.clientY})}),onPointerMove:Ue(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(nW,p,re,{discrete:!1})):JE(G,y.swipeDirection,F)?(k.current=G,Rh(tW,m,re,{discrete:!1}),z.target.setPointerCapture(z.pointerId)):(Math.abs(I)>F||Math.abs(T)>F)&&(C.current=null)}),onPointerUp:Ue(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};JE(I,y.swipeDirection,y.swipeThreshold)?Rh(aW,x,H,{discrete:!0}):Rh(rW,v,H,{discrete:!0}),V.addEventListener("click",M=>M.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),lW=e=>{const{__scopeToast:t,children:n,...r}=e,s=Lg(Jf,t),[o,i]=h.useState(!1),[c,d]=h.useState(!1);return dW(()=>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]})})})},cW="ToastTitle",t5=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(lt.div,{...r,ref:t})});t5.displayName=cW;var uW="ToastDescription",n5=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(lt.div,{...r,ref:t})});n5.displayName=uW;var r5="ToastAction",a5=h.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?a.jsx(o5,{altText:n,asChild:!0,children:a.jsx(cC,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${r5}\`. Expected non-empty \`string\`.`),null)});a5.displayName=r5;var s5="ToastClose",cC=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=oW(s5,n);return a.jsx(o5,{asChild:!0,children:a.jsx(lt.button,{type:"button",...r,ref:t,onClick:Ue(e.onClick,s.onClose)})})});cC.displayName=s5;var o5=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 i5(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),fW(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(...i5(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?oC(s,o):s.dispatchEvent(o)}var JE=(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 dW(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 fW(e){return e.nodeType===e.ELEMENT_NODE}function pW(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 hW=XD,l5=JD,c5=e5,u5=t5,d5=n5,f5=a5,p5=cC;function h5(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=h5(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Gt(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=h5(e))&&(r&&(r+=" "),r+=t);return r}const ZE=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,eP=Gt,Bl=(e,t)=>n=>{var r;if(t?.variants==null)return eP(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=ZE(m)||ZE(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 eP(e,i,d,n?.class,n?.className)};const mW=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),m5=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();var gW={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 vW=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,...gW,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:m5("lucide",s),...c},[...i.map(([f,m])=>h.createElement(f,m)),...Array.isArray(o)?o:[o]]));const pt=(e,t)=>{const n=h.forwardRef(({className:r,...s},o)=>h.createElement(vW,{ref:o,iconNode:t,className:m5(`lucide-${mW(e)}`,r),...s}));return n.displayName=`${e}`,n};const uC=pt("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 g5=pt("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=pt("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Wr=pt("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 v5=pt("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=pt("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=pt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Zt=pt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Fg=pt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const Ns=pt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const zc=pt("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);const Zy=pt("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=pt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const xW=pt("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=pt("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 yW=pt("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const tP=pt("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);const Ea=pt("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const Hr=pt("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 x5=pt("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=pt("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=pt("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=pt("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 bW=pt("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 y5=pt("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 dC=pt("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 VS=pt("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 b5=pt("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 wW=pt("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 w5=pt("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 jW=pt("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 SW=pt("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 NW=pt("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=pt("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 fC=pt("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 CW=pt("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 KS=pt("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 _W=pt("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=pt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const j5=pt("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 kW=pt("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 S5=pt("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=pt("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 AW=pt("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);const GS=pt("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 YS=pt("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 nP=pt("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=pt("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=pt("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const Ao=pt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const pC=pt("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=pt("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 EW=pt("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 hC=pt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const PW=pt("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 mC=pt("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 RW=pt("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=pt("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 TW=pt("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=pt("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const gC=pt("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=pt("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=pt("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 OW=pt("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=pt("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 N5=pt("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=pt("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=pt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),vC="-",MW=e=>{const t=$W(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const c=i.split(vC);return c[0]===""&&c.length!==1&&c.shift(),C5(c,t)||IW(i)},getConflictingClassGroupIds:(i,c)=>{const d=n[i]||[];return c&&r[i]?[...d,...r[i]]:d}}},C5=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?C5(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(vC);return t.validators.find(({validator:i})=>i(o))?.classGroupId},rP=/^\[(.+)\]$/,IW=e=>{if(rP.test(e)){const t=rP.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},$W=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return LW(Object.entries(e.classGroups),n).forEach(([o,i])=>{XS(i,r,o,t)}),r},XS=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:aP(t,s);o.classGroupId=n;return}if(typeof s=="function"){if(DW(s)){XS(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([o,i])=>{XS(i,aP(t,o),n,r)})})},aP=(e,t)=>{let n=e;return t.split(vC).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},DW=e=>e.isThemeGetter,LW=(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,FW=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)}}},_5="!",zW=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(_5),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},BW=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},qW=e=>({cache:FW(e.cacheSize),parseClassName:zW(e),...MW(e)}),UW=/\s+/,WW=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(UW);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=BW(m).join(":"),S=p?b+_5: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 HW(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=k5(t))&&(r&&(r+=" "),r+=n);return r}const k5=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=k5(e[r]))&&(n&&(n+=" "),n+=t);return n};function VW(e,...t){let n,r,s,o=i;function i(d){const f=t.reduce((m,p)=>p(m),e());return n=qW(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=WW(d,n);return s(d,m),m}return function(){return o(HW.apply(null,arguments))}}const On=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},A5=/^\[(?:([a-z-]+):)?(.+)\]$/i,KW=/^\d+\/\d+$/,GW=new Set(["px","full","screen"]),YW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,XW=/\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$/,QW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,JW=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ZW=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,po=e=>Bc(e)||GW.has(e)||KW.test(e),fi=e=>ku(e,"length",iH),Bc=e=>!!e&&!Number.isNaN(Number(e)),eb=e=>ku(e,"number",Bc),Cd=e=>!!e&&Number.isInteger(Number(e)),eH=e=>e.endsWith("%")&&Bc(e.slice(0,-1)),Qt=e=>A5.test(e),pi=e=>YW.test(e),tH=new Set(["length","size","percentage"]),nH=e=>ku(e,tH,E5),rH=e=>ku(e,"position",E5),aH=new Set(["image","url"]),sH=e=>ku(e,aH,cH),oH=e=>ku(e,"",lH),_d=()=>!0,ku=(e,t,n)=>{const r=A5.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},iH=e=>XW.test(e)&&!QW.test(e),E5=()=>!1,lH=e=>JW.test(e),cH=e=>ZW.test(e),uH=()=>{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"],U=()=>["auto",Qt,t],B=()=>[Qt,t],Y=()=>["",po,fi],z=()=>["auto",Bc,Qt],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",Qt],X=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>[Bc,Qt];return{cacheSize:500,separator:":",theme:{colors:[_d],spacing:[po,fi],blur:["none","",pi,Qt],brightness:$(),borderColor:[e],borderRadius:["none","","full",pi,Qt],borderSpacing:B(),borderWidth:Y(),contrast:$(),grayscale:M(),hueRotate:$(),invert:M(),gap:B(),gradientColorStops:[e],gradientColorStopPositions:[eH,fi],inset:U(),margin:U(),opacity:$(),padding:B(),saturate:$(),scale:$(),sepia:M(),skew:$(),space:B(),translate:B()},classGroups:{aspect:[{aspect:["auto","square","video",Qt]}],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(),Qt]}],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,Qt]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Qt]}],grow:[{grow:M()}],shrink:[{shrink:M()}],order:[{order:["first","last","none",Cd,Qt]}],"grid-cols":[{"grid-cols":[_d]}],"col-start-end":[{col:["auto",{span:["full",Cd,Qt]},Qt]}],"col-start":[{"col-start":z()}],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":[_d]}],"row-start-end":[{row:["auto",{span:[Cd,Qt]},Qt]}],"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",Qt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Qt]}],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",Qt,t]}],"min-w":[{"min-w":[Qt,t,"min","max","fit"]}],"max-w":[{"max-w":[Qt,t,"none","full","min","max","fit","prose",{screen:[pi]},pi]}],h:[{h:[Qt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Qt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Qt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Qt,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",Qt]}],"line-clamp":[{"line-clamp":["none",Bc,eb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",po,Qt]}],"list-image":[{"list-image":["none",Qt]}],"list-style-type":[{list:["none","disc","decimal",Qt]}],"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,Qt]}],"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",Qt]}],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",Qt]}],"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(),rH]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",nH]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},sH]}],"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,Qt]}],"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,oH]}],"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,Qt]}],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",Qt]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",Qt]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",Qt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[Cd,Qt]}],"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",Qt]}],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",Qt]}],"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",Qt]}],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"]}}},dH=VW(uH);function $e(...e){return dH(Gt(e))}function Hn(e,t=""){return typeof e=="string"&&e.trim().length>0?e.trim():t}const fH=hW,P5=h.forwardRef(({className:e,...t},n)=>a.jsx(l5,{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}));P5.displayName=l5.displayName;const pH=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"}}),R5=h.forwardRef(({className:e,variant:t,...n},r)=>a.jsx(c5,{ref:r,className:$e(pH({variant:t}),e),...n}));R5.displayName=c5.displayName;const hH=h.forwardRef(({className:e,...t},n)=>a.jsx(f5,{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}));hH.displayName=f5.displayName;const T5=h.forwardRef(({className:e,...t},n)=>a.jsx(p5,{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"})}));T5.displayName=p5.displayName;const O5=h.forwardRef(({className:e,...t},n)=>a.jsx(u5,{ref:n,className:$e("text-sm font-semibold",e),...t}));O5.displayName=u5.displayName;const M5=h.forwardRef(({className:e,...t},n)=>a.jsx(d5,{ref:n,className:$e("text-sm opacity-90",e),...t}));M5.displayName=d5.displayName;function mH(){const{toasts:e}=x9();return a.jsxs(fH,{children:[e.map(function({id:t,title:n,description:r,action:s,...o}){return a.jsxs(R5,{...o,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(O5,{children:n}),r&&a.jsx(M5,{children:r})]}),s,a.jsx(T5,{})]},t)}),a.jsx(P5,{})]})}var sP=["light","dark"],gH="(prefers-color-scheme: dark)",vH=h.createContext(void 0),xH={setTheme:e=>{},themes:[]},yH=()=>{var e;return(e=h.useContext(vH))!=null?e:xH};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?sP.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&&sP.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='${gH}',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 bH=e=>{switch(e){case"success":return SH;case"info":return CH;case"warning":return NH;case"error":return _H;default:return null}},wH=Array(12).fill(0),jH=({visible:e,className:t})=>Q.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Q.createElement("div",{className:"sonner-spinner"},wH.map((n,r)=>Q.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),SH=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"})),NH=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"})),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-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"})),_H=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"})),kH=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"})),AH=()=>{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},QS=1,EH=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:QS++,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(RH(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||QS++;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 EH,PH=(e,t)=>{let n=t?.id||QS++;return ra.addToast({title:e,...t,id:n}),n},RH=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",TH=PH,OH=()=>ra.toasts,MH=()=>ra.getActiveToasts();Object.assign(TH,{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:OH,getToasts:MH});function IH(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))}IH(`: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 $H=3,DH="32px",LH="16px",oP=4e3,FH=356,zH=14,BH=20,qH=200;function ms(...e){return e.filter(Boolean).join(" ")}function UH(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var WH=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:U,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),[Ge,ke]=Q.useState(0),Pe=Q.useRef(x.duration||z||oP),et=Q.useRef(null),ht=Q.useRef(null),zt=C===0,Bt=C+1<=S,Nt=x.type,an=x.dismissible!==!1,sn=x.className||"",Ut=x.descriptionClassName||"",nn=Q.useMemo(()=>N.findIndex(xe=>xe.toastId===x.id)||0,[N,x.id]),rn=Q.useMemo(()=>{var xe;return(xe=x.closeButton)!=null?xe:O},[x.closeButton,O]),on=Q.useMemo(()=>x.duration||z||oP,[x.duration,z]),_e=Q.useRef(0),Be=Q.useRef(0),Ye=Q.useRef(0),Et=Q.useRef(null),[ft,fe]=I.split("-"),Oe=Q.useMemo(()=>N.reduce((xe,be,we)=>we>=nn?xe:xe+be.height,0),[N,nn]),Ke=AH(),q=x.invert||v,le=Nt==="loading";Be.current=Q.useMemo(()=>nn*T+Oe,[nn,Oe]),Q.useEffect(()=>{Pe.current=on},[on]),Q.useEffect(()=>{ye(!0)},[]),Q.useEffect(()=>{let xe=ht.current;if(xe){let be=xe.getBoundingClientRect().height;return ke(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=ht.current,be=xe.style.height;xe.style.height="auto";let we=xe.getBoundingClientRect().height;xe.style.height=be,ke(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(Be.current),b(xe=>xe.filter(be=>be.toastId!==x.id)),setTimeout(()=>{E(x)},qH)},[x,E,b,Be]);Q.useEffect(()=>{if(x.promise&&Nt==="loading"||x.duration===1/0||x.type==="loading")return;let xe;return A||y||F&&Ke?(()=>{if(Ye.current<_e.current){let be=new Date().getTime()-_e.current;Pe.current=Pe.current-be}Ye.current=new Date().getTime()})():Pe.current!==1/0&&(_e.current=new Date().getTime(),xe=setTimeout(()=>{var be;(be=x.onAutoClose)==null||be.call(x,x),pe()},Pe.current)),()=>clearTimeout(xe)},[A,y,x,Nt,F,Ke,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(jH,{className:ms(M?.loader,(we=x?.classNames)==null?void 0:we.loader),visible:Nt==="loading"})}return Q.createElement("li",{tabIndex:0,ref:ht,className:ms(B,sn,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":Bt,"data-y-position":ft,"data-x-position":fe,"data-index":C,"data-front":zt,"data-swiping":De,"data-dismissible":an,"data-type":Nt,"data-invert":q,"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:Be.current}px`,"--initial-height":H?"auto":`${Ge}px`,...D,...x.style},onDragEnd:()=>{ge(!1),re(null),Et.current=null},onPointerDown:xe=>{le||!an||(et.current=new Date,kt(Be.current),xe.target.setPointerCapture(xe.pointerId),xe.target.tagName!=="BUTTON"&&(ge(!0),Et.current={x:xe.clientX,y:xe.clientY}))},onPointerUp:()=>{var xe,be,we,W;if(ve||!an)return;Et.current=null;let he=Number(((xe=ht.current)==null?void 0:xe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ae=Number(((be=ht.current)==null?void 0:be.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),He=new Date().getTime()-((we=et.current)==null?void 0:we.getTime()),ee=G==="x"?he:Ae,Le=Math.abs(ee)/He;if(Math.abs(ee)>=BH||Le>.11){kt(Be.current),(W=x.onDismiss)==null||W.call(x,x),ue(G==="x"?he>0?"right":"left":Ae>0?"down":"up"),pe(),Se(!0),tt(!1);return}ge(!1),re(null)},onPointerMove:xe=>{var be,we,W,he;if(!Et.current||!an||((be=window.getSelection())==null?void 0:be.toString().length)>0)return;let Ae=xe.clientY-Et.current.y,He=xe.clientX-Et.current.x,ee=(we=e.swipeDirections)!=null?we:UH(I);!G&&(Math.abs(He)>1||Math.abs(Ae)>1)&&re(Math.abs(He)>Math.abs(Ae)?"x":"y");let Le={x:0,y:0};G==="y"?(ee.includes("top")||ee.includes("bottom"))&&(ee.includes("top")&&Ae<0||ee.includes("bottom")&&Ae>0)&&(Le.y=Ae):G==="x"&&(ee.includes("left")||ee.includes("right"))&&(ee.includes("left")&&He<0||ee.includes("right")&&He>0)&&(Le.x=He),(Math.abs(Le.x)>0||Math.abs(Le.y)>0)&&tt(!0),(W=ht.current)==null||W.style.setProperty("--swipe-amount-x",`${Le.x}px`),(he=ht.current)==null||he.style.setProperty("--swipe-amount-y",`${Le.y}px`)}},rn&&!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:kH):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]||bH(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,Ut,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||U,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 iP(){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 HH(e,t){let n={};return[e,t].forEach((r,s)=>{let o=s===1,i=o?"--mobile-offset":"--offset",c=o?LH:DH;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 VH=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=$H,toastOptions:y,dir:b=iP(),gap:S=zH,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([]),[U,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(()=>{WD.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"?iP():b,tabIndex:-1,ref:V,className:c,"data-sonner-toaster":!0,"data-theme":I,"data-y-position":oe,"data-lifted":U&&E.length>1&&!o,"data-x-position":ue,style:{"--front-toast-height":`${((re=D[0])==null?void 0:re.height)||0}px`,"--width":`${FH}px`,"--gap":`${S}px`,...x,...HH(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(WH,{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:U,pauseWhenPageIsHidden:A,swipeDirections:e.swipeDirections})})):null}))});const KH=({...e})=>{const{theme:t="system"}=yH();return a.jsx(VH,{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 GH=sC[" useId ".trim().toString()]||(()=>{}),YH=0;function fr(e){const[t,n]=h.useState(GH());return pr(()=>{n(r=>r??String(YH++))},[e]),e||(t?`radix-${t}`:"")}const XH=["top","right","bottom","left"],Ni=Math.min,wa=Math.max,gm=Math.round,Oh=Math.floor,Us=e=>({x:e,y:e}),QH={left:"right",right:"left",bottom:"top",top:"bottom"},JH={start:"end",end:"start"};function JS(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 xC(e){return e==="x"?"y":"x"}function yC(e){return e==="y"?"height":"width"}const ZH=new Set(["top","bottom"]);function Bs(e){return ZH.has(Po(e))?"y":"x"}function bC(e){return xC(Bs(e))}function eV(e,t,n){n===void 0&&(n=!1);const r=Au(e),s=bC(e),o=yC(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 tV(e){const t=vm(e);return[ZS(e),t,ZS(t)]}function ZS(e){return e.replace(/start|end/g,t=>JH[t])}const lP=["left","right"],cP=["right","left"],nV=["top","bottom"],rV=["bottom","top"];function aV(e,t,n){switch(e){case"top":case"bottom":return n?t?cP:lP:t?lP:cP;case"left":case"right":return t?nV:rV;default:return[]}}function sV(e,t,n,r){const s=Au(e);let o=aV(Po(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(ZS)))),o}function vm(e){return e.replace(/left|right|bottom|top/g,t=>QH[t])}function oV(e){return{top:0,right:0,bottom:0,left:0,...e}}function I5(e){return typeof e!="number"?oV(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 uP(e,t,n){let{reference:r,floating:s}=e;const o=Bs(t),i=bC(t),c=yC(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 iV(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=I5(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 lV=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}=uP(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:iV},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}=uP(f,v,d)),b=-1)}return{x:m,y:p,placement:v,strategy:s,middlewareData:x}},cV=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=I5(m),v={x:n,y:r},x=bC(s),j=yC(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),U=Ni(p[N],D),B=K,Y=P-y[j]-U,z=P/2-y[j]/2+O,I=JS(B,z,Y),T=!d.arrow&&Au(s)!=null&&z!==I&&o.reference[j]/2-(z<B?K:U)-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}}}),uV=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)]:tV(c)),E=j!=="none";!v&&E&&A.push(...sV(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=eV(s,i,k);D.push(O[z[0]],O[z[1]])}if(K=[...K,{placement:s,overflows:D}],!D.every(z=>z<=0)){var U,B;const z=(((U=o.flip)==null?void 0:U.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 dP(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fP(e){return XH.some(t=>e[t]>=0)}const dV=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=dP(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:fP(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...o,altBoundary:!0}),c=dP(i,n.floating);return{data:{escapedOffsets:c,escaped:fP(c)}}}default:return{}}}}},$5=new Set(["left","top"]);async function fV(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=$5.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 pV=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 fV(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}}}}},hV=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=xC(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=JS(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=JS(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}}}}}},mV=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=xC(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=$5.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}}}},gV=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),U=wa(m.right,0),B=wa(m.top,0),Y=wa(m.bottom,0);x?O=j-2*(K!==0||U!==0?K+U: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 D5(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=(D5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function D5(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 pP(e){return!Bg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ca(e).ShadowRoot}const vV=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)&&!vV.has(s)}const xV=new Set(["table","td","th"]);function yV(e){return xV.has(Eu(e))}const bV=[":popover-open",":modal"];function qg(e){return bV.some(t=>{try{return e.matches(t)}catch{return!1}})}const wV=["transform","translate","scale","rotate","perspective"],jV=["transform","translate","scale","rotate","perspective","filter"],SV=["paint","layout","strict","content"];function wC(e){const t=jC(),n=ks(e)?As(e):e;return wV.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)||jV.some(r=>(n.willChange||"").includes(r))||SV.some(r=>(n.contain||"").includes(r))}function NV(e){let t=Ci(e);for(;Ks(t)&&!Qc(t);){if(wC(t))return t;if(qg(t))return null;t=Ci(t)}return null}function jC(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const CV=new Set(["html","body","#document"]);function Qc(e){return CV.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||pP(e)&&e.host||Qs(e);return pP(t)?t.host:t}function L5(e){const t=Ci(e);return Qc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ks(t)&&ep(t)?t:L5(t)}function af(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=L5(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Ca(s);if(o){const c=e1(i);return t.concat(i,i.visualViewport||[],ep(s)?s:[],c&&n?af(c):[])}return t.concat(s,af(s,[],n))}function e1(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function F5(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 SC(e){return ks(e)?e:e.contextElement}function qc(e){const t=SC(e);if(!Ks(t))return Us(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=F5(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 _V=Us(0);function z5(e){const t=Ca(e);return!jC()||!t.visualViewport?_V:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kV(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=SC(e);let i=Us(1);t&&(r?ks(r)&&(i=qc(r)):i=qc(e));const c=kV(o,n,r)?z5(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=e1(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=e1(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 B5(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 AV(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?B5(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 EV(e){return Array.from(e.getClientRects())}function PV(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 hP=25;function RV(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=jC();(!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<=hP&&(o-=j)}else f<=hP&&(o+=f);return{width:o,height:i,x:c,y:d}}const TV=new Set(["absolute","fixed"]);function OV(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 mP(e,t,n){let r;if(t==="viewport")r=RV(e,n);else if(t==="document")r=PV(Qs(e));else if(ks(t))r=OV(t,n);else{const s=z5(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return xm(r)}function q5(e,t){const n=Ci(e);return n===t||!ks(n)||Qc(n)?!1:As(n).position==="fixed"||q5(n,t)}function MV(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=wC(i);!d&&c.position==="fixed"&&(s=null),(o?!d&&!s:!d&&c.position==="static"&&!!s&&TV.has(s.position)||ep(i)&&!d&&q5(e,i))?r=r.filter(m=>m!==i):s=c,i=Ci(i)}return t.set(e,r),r}function IV(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?qg(t)?[]:MV(t,this._c):[].concat(n),r],c=i[0],d=i.reduce((f,m)=>{const p=mP(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},mP(t,c,s));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function $V(e){const{width:t,height:n}=F5(e);return{width:t,height:n}}function DV(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?B5(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 gP(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 U5(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=gP(e,t);for(;r&&yV(r)&&tb(r);)r=gP(r,t);return r&&Qc(r)&&tb(r)&&!wC(r)?n:r||NV(e)||n}const LV=async function(e){const t=this.getOffsetParent||U5,n=this.getDimensions,r=await n(e.floating);return{reference:DV(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function FV(e){return As(e).direction==="rtl"}const zV={convertOffsetParentRelativeRectToViewportRelativeRect:AV,getDocumentElement:Qs,getClippingRect:IV,getOffsetParent:U5,getElementRects:LV,getClientRects:EV,getDimensions:$V,getScale:qc,isElement:ks,isRTL:FV};function W5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function BV(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&&!W5(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 qV(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=SC(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?BV(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&&!W5(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 UV=pV,WV=hV,HV=uV,VV=gV,KV=dV,vP=cV,GV=mV,YV=(e,t,n)=>{const r=new Map,s={platform:zV,...n},o={...s.platform,_c:r};return lV(e,t,{...s,platform:o})};var XV=typeof document<"u",QV=function(){},om=XV?h.useLayoutEffect:QV;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 H5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xP(e,t){const n=H5(e);return Math.round(t*n)/n}function nb(e){const t=h.useRef(e);return om(()=>{t.current=e}),t}function JV(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),U=nb(s),B=nb(f),Y=h.useCallback(()=>{if(!E.current||!P.current)return;const H={placement:t,strategy:n,middleware:v};U.current&&(H.platform=U.current),YV(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,U,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=xP(T.floating,m.x),X=xP(T.floating,m.y);return c?{...H,transform:"translate("+M+"px, "+X+"px)",...H5(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 ZV=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?vP({element:r.current,padding:s}).fn(n):{}:r?vP({element:r,padding:s}).fn(n):{}}}},eK=(e,t)=>({...UV(e),options:[e,t]}),tK=(e,t)=>({...WV(e),options:[e,t]}),nK=(e,t)=>({...GV(e),options:[e,t]}),rK=(e,t)=>({...HV(e),options:[e,t]}),aK=(e,t)=>({...VV(e),options:[e,t]}),sK=(e,t)=>({...KV(e),options:[e,t]}),oK=(e,t)=>({...ZV(e),options:[e,t]});var iK="Arrow",V5=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"})})});V5.displayName=iK;var lK=V5;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 NC="Popper",[K5,Ei]=kr(NC),[cK,G5]=K5(NC),Y5=e=>{const{__scopePopper:t,children:n}=e,[r,s]=h.useState(null);return a.jsx(cK,{scope:t,anchor:r,onAnchorChange:s,children:n})};Y5.displayName=NC;var X5="PopperAnchor",Q5=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=G5(X5,n),i=h.useRef(null),c=Ot(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})});Q5.displayName=X5;var CC="PopperContent",[uK,dK]=K5(CC),J5=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=G5(CC,n),[S,N]=h.useState(null),C=Ot(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},U=Array.isArray(f)?f:[f],B=U.length>0,Y={padding:K,boundary:U.filter(pK),altBoundary:B},{refs:z,floatingStyles:I,placement:T,isPositioned:V,middlewareData:H}=JV({strategy:"fixed",placement:D,whileElementsMounted:(...ae)=>qV(...ae,{animationFrame:x==="always"}),elements:{reference:b.anchor},middleware:[eK({mainAxis:s+O,alignmentAxis:i}),d&&tK({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?nK():void 0,...Y}),d&&rK({...Y}),aK({...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&&oK({element:k,padding:c}),hK({arrowWidth:P,arrowHeight:O}),v&&sK({strategy:"referenceHidden",...Y})]}),[M,X]=t3(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(uK,{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"}})})})});J5.displayName=CC;var Z5="PopperArrow",fK={top:"bottom",right:"left",bottom:"top",left:"right"},e3=h.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=dK(Z5,r),i=fK[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(lK,{...s,ref:n,style:{...s.style,display:"block"}})})});e3.displayName=Z5;function pK(e){return e!==null}var hK=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]=t3(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 t3(e){const[t,n="center"]=e.split("-");return[t,n]}var Vg=Y5,tp=Q5,Kg=J5,Gg=e3,mK=Symbol("radix.slottable");function gK(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=mK,t}var[Yg]=kr("Tooltip",[Ei]),Xg=Ei(),n3="TooltipProvider",vK=700,t1="tooltip.open",[xK,_C]=Yg(n3),r3=e=>{const{__scopeTooltip:t,delayDuration:n=vK,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(xK,{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})};r3.displayName=n3;var sf="Tooltip",[yK,np]=Yg(sf),a3=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:i,delayDuration:c}=e,d=_C(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(t1))):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(yK,{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})})};a3.displayName=sf;var n1="TooltipTrigger",s3=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=np(n1,n),o=_C(n1,n),i=Xg(n),c=h.useRef(null),d=Ot(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:Ue(e.onPointerMove,v=>{v.pointerType!=="touch"&&!m.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:Ue(e.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:Ue(e.onPointerDown,()=>{s.open&&s.onClose(),f.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Ue(e.onFocus,()=>{f.current||s.onOpen()}),onBlur:Ue(e.onBlur,s.onClose),onClick:Ue(e.onClick,s.onClose)})})});s3.displayName=n1;var kC="TooltipPortal",[bK,wK]=Yg(kC,{forceMount:void 0}),o3=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,o=np(kC,t);return a.jsx(bK,{scope:t,forceMount:n,children:a.jsx(ar,{present:n||o.open,children:a.jsx(zl,{asChild:!0,container:s,children:r})})})};o3.displayName=kC;var Jc="TooltipContent",i3=h.forwardRef((e,t)=>{const n=wK(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(l3,{side:s,...o,ref:t}):a.jsx(jK,{side:s,...o,ref:t})})}),jK=h.forwardRef((e,t)=>{const n=np(Jc,e.__scopeTooltip),r=_C(Jc,e.__scopeTooltip),s=h.useRef(null),o=Ot(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=kK(S,b.getBoundingClientRect()),C=AK(S,N),k=EK(y.getBoundingClientRect()),A=RK([...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=!PK(S,i);N?v():C&&(v(),f())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[d,m,i,f,v]),a.jsx(l3,{...e,ref:o})}),[SK,NK]=Yg(sf,{isInside:!1}),CK=gK("TooltipContent"),l3=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(t1,m),()=>document.removeEventListener(t1,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(CK,{children:r}),a.jsx(SK,{scope:n,isInside:!0,children:a.jsx(X9,{id:d.contentId,role:"tooltip",children:s||r})})]})})});i3.displayName=Jc;var c3="TooltipArrow",_K=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Xg(n);return NK(c3,n).isInside?null:a.jsx(Gg,{...s,...r,ref:t})});_K.displayName=c3;function kK(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 AK(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 EK(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 PK(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 RK(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),TK(t)}function TK(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 OK=r3,MK=a3,IK=s3,$K=o3,u3=i3;const Ro=OK,To=MK,Oo=IK,Gs=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx($K,{children:a.jsx(u3,{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=u3.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(){}},DK=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"}},d3=new DK,LK={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},FK=class{#e=LK;#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)}},r1=new FK;function zK(e){setTimeout(e,0)}var BK=typeof window>"u"||"Deno"in globalThis;function xs(){}function qK(e,t){return typeof e=="function"?e(t):e}function UK(e){return typeof e=="number"&&e>=0&&e!==1/0}function WK(e,t){return Math.max(e+(t||0)-Date.now(),0)}function a1(e,t){return typeof e=="function"?e(t):e}function HK(e,t){return typeof e=="function"?e(t):e}function yP(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:o,queryKey:i,stale:c}=e;if(i){if(r){if(t.queryHash!==AC(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 bP(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 AC(e,t){return(t?.queryKeyHashFn||of)(e)}function of(e){return JSON.stringify(e,(t,n)=>s1(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 VK=Object.prototype.hasOwnProperty;function f3(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=wP(e)&&wP(t);if(!r&&!(s1(e)&&s1(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:VK.call(e,p))&&f++;continue}if(v===null||x===null||typeof v!="object"||typeof x!="object"){d[p]=x;continue}const j=f3(v,x,n+1);d[p]=j,j===v&&f++}return o===c&&f===o?e:d}function wP(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function s1(e){if(!jP(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!jP(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function jP(e){return Object.prototype.toString.call(e)==="[object Object]"}function KK(e){return new Promise(t=>{r1.setTimeout(t,e)})}function GK(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?f3(e,t):t}function YK(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function XK(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var EC=Symbol();function p3(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===EC?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function QK(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 h3=(()=>{let e=()=>BK;return{isServer(){return e()},setIsServer(t){e=t}}})();function JK(){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 ZK=zK;function eG(){let e=[],t=0,n=c=>{c()},r=c=>{c()},s=ZK;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=eG(),tG=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 tG;function nG(e){return Math.min(1e3*2**e,3e4)}function m3(e){return(e??"online")==="online"?bm.isOnline():!0}var o1=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function g3(e){let t=!1,n=0,r;const s=JK(),o=()=>s.status!=="pending",i=y=>{if(!o()){const b=new o1(y);v(b),e.onCancel?.(b)}},c=()=>{t=!0},d=()=>{t=!1},f=()=>d3.isFocused()&&(e.networkMode==="always"||bm.isOnline())&&e.canRun(),m=()=>m3(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??(h3.isServer()?0:3),C=e.retryDelay??nG,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),KK(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 v3=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),UK(this.gcTime)&&(this.#e=r1.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(h3.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(r1.clearTimeout(this.#e),this.#e=void 0)}};function rG(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=>{QK(j,()=>t.signal,()=>m=!0)},v=p3(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?XK:YK;return{pages:A(j.pages,C,k),pageParams:A(j.pageParams,y,k)}};if(s&&o.length){const j=s==="backward",y=j?aG:SP,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:SP(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 SP(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 aG(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var sG=class extends v3{#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=CP(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=CP(this.options);t.data!==void 0&&(this.setState(NP(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#a.remove(this)}setData(e,t){const n=GK(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=>HK(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===EC||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>a1(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:!WK(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=p3(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"?rG(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=g3({initialPromise:t?.initialPromise,fn:i.fetchFn,onCancel:d=>{d instanceof o1&&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 o1){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,...oG(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...NP(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 oG(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:m3(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function NP(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function CP(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 iG=class extends v3{#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||lG(),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=g3({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 lG(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var cG=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 iG({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=>bP(t,n))}findAll(e={}){return this.getAll().filter(t=>bP(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 uG=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??AC(r,t);let o=this.get(s);return o||(o=new sG({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=>yP(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>yP(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()})})}},dG=class{#e;#t;#n;#a;#s;#r;#l;#o;constructor(e={}){this.#e=e.queryCache||new uG,this.#t=e.mutationCache||new cG,this.#n=e.defaultOptions||{},this.#a=new Map,this.#s=new Map,this.#r=0}mount(){this.#r++,this.#r===1&&(this.#l=d3.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(a1(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=qK(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(a1(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=AC(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===EC&&(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()}},fG=h.createContext(void 0),pG=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(fG.Provider,{value:e,children:t}));var PC=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,x3=/^[\\/]{2}/;function hG(e,t){return t+e.replace(/\\/g,"/")}var _P="popstate";function kP(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function mG(e={}){function t(r,s){let o=s.state?.masked,{pathname:i,search:c,hash:d}=o||r.location;return i1("",{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 vG(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 gG(){return Math.random().toString(36).substring(2,10)}function AP(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 i1(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||gG(),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 vG(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=kP(b)?b:i1(y.location,b,S);f=m()+1;let C=AP(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=kP(b)?b:i1(y.location,b,S);f=m();let C=AP(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 xG(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(_P,p),d=b,()=>{s.removeEventListener(_P,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 xG(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&&x3.test(s)&&(s=r+s),new URL(s,r)}function y3(e,t,n="/"){return yG(e,t,n,!1)}function yG(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=bG(e),d=null,f=RG(i);for(let m=0;d==null&&m<c.length;++m)d=PG(c[m],f,r);return d}function bG(e){let t=b3(e);return wG(t),t}function b3(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}".`),b3(i.children,t,v,p,d)),!(i.path==null&&!i.index)&&t.push({path:p,score:AG(p,i.index),routesMeta:v.map((x,j)=>{let[y,b]=S3(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 w3(i.path))o(i,c,!0,d)}),t}function w3(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=w3(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 wG(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:EG(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var jG=/^:[\w-]+$/,SG=3,NG=2,CG=1,_G=10,kG=-2,EP=e=>e==="*";function AG(e,t){let n=e.split("/"),r=n.length;return n.some(EP)&&(r+=kG),t&&(r+=NG),n.filter(s=>!EP(s)).reduce((s,o)=>s+(jG.test(o)?SG:o===""?CG:_G),r)}function EG(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 PG(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?j3(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:MG(_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]=S3(e.path,e.caseSensitive,e.end);return j3(e,t,n,r)}function j3(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 S3(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 RG(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 TG(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Pu(e):e,o;return n?(n=N3(n),n.startsWith("/")?o=PP(n.substring(1),"/"):o=PP(n,t)):o=t,{pathname:o,search:IG(r),hash:$G(s)}}function PP(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 OG(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function RC(e){let t=OG(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=TG(s,c),f=i&&i!=="/"&&i.endsWith("/"),m=(o||i===".")&&n.endsWith("/");return!d.pathname.endsWith("/")&&(f||m)&&(d.pathname+="/"),d}var N3=e=>e.replace(/[\\/]{2,}/g,"/"),_s=e=>N3(e.join("/")),wm=e=>e.replace(/\/+$/,""),MG=e=>wm(e).replace(/^\/*/,"/"),IG=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,$G=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,DG=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 LG(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function FG(e){let t=e.map(n=>n.route.path).filter(Boolean);return _s(t)||"/"}var C3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _3(e,t){let n=e;if(typeof n!="string"||!PC.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(C3)try{let o=new URL(window.location.href),i=x3.test(n)?new URL(hG(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 k3=["POST","PUT","PATCH","DELETE"];new Set(k3);var zG=["GET",...k3];new Set(zG);var BG=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function qG(e){try{return BG.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 A3=h.createContext(!1);function UG(){return h.useContext(A3)}var E3=h.createContext({isTransitioning:!1});E3.displayName="ViewTransition";var WG=h.createContext(new Map);WG.displayName="Fetchers";var HG=h.createContext(null);HG.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 TC=h.createContext(null);TC.displayName="RouteError";var P3="REACT_ROUTER_ERROR",VG="REDIRECT",KG="ROUTE_ERROR_RESPONSE";function GG(e){if(e.startsWith(`${P3}:${VG}:{`))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 YG(e){if(e.startsWith(`${P3}:${KG}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new DG(t.status,t.statusText,t.data)}catch{}}function XG(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 R3="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function T3(e){h.useContext(Pa).static||h.useLayoutEffect(e)}function ss(){let{isDataRoute:e}=h.useContext(as);return e?dY():QG()}function QG(){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(RC(r)),i=h.useRef(!1);return T3(()=>{i.current=!0}),h.useCallback((d,f={})=>{if(Ya(i.current,R3),!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 JG=h.createContext(null);function ZG(e){let t=h.useContext(as).outlet;return h.useMemo(()=>t&&h.createElement(JG.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(RC(n));return h.useMemo(()=>Jg(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function eY(e,t){return O3(e,t)}function O3(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||"";I3(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})):y3(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=sY(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 tY(){let e=uY(),t=LG(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 nY=h.createElement(tY,null),M3=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=YG(e.digest);n&&(e=n)}let t=e!==void 0?h.createElement(as.Provider,{value:this.props.routeContext},h.createElement(TC.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?h.createElement(rY,{error:e},t):t}};M3.contextType=A3;var ab=new WeakMap;function rY({children:e,error:t}){let{basename:n}=h.useContext(Pa);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=GG(t.digest);if(r){let s=ab.get(t);if(s)throw s;let o=_3(r.location,n),i=o.absoluteURL||o.to;if(qG(i))throw new Error("Invalid redirect location");if(C3&&!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 aY({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 sY(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:FG(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||nY,i&&(c<0&&v===0?(I3("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(aY,{match:p,routeContext:{outlet:m,matches:S,isDataRoute:r!=null},children:C})};return r&&(p.route.ErrorBoundary||p.route.errorElement||v===0)?h.createElement(M3,{location:r.location,revalidation:r.revalidation,component:y,error:x,children:N(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:f}):N()},null)}function OC(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function oY(e){let t=h.useContext(Ru);return Bn(t,OC(e)),t}function iY(e){let t=h.useContext(Zg);return Bn(t,OC(e)),t}function lY(e){let t=h.useContext(as);return Bn(t,OC(e)),t}function MC(e){let t=lY(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 cY(){return MC("useRouteId")}function uY(){let e=h.useContext(TC),t=iY("useRouteError"),n=MC("useRouteError");return e!==void 0?e:t.errors?.[n]}function dY(){let{router:e}=oY("useNavigate"),t=MC("useNavigate"),n=h.useRef(!1);return T3(()=>{n.current=!0}),h.useCallback(async(s,o={})=>{Ya(n.current,R3),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var RP={};function I3(e,t,n){!t&&!RP[e]&&(RP[e]=!0,Ya(!1,n))}h.memo(fY);function fY({routes:e,manifest:t,future:n,state:r,isStatic:s,onError:o}){return O3(e,void 0,{manifest:t,state:r,isStatic:s,onError:o})}function $3({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,RC(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 TP(e){return ZG(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 pY({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 hY({children:e,location:t}){return eY(l1(e),t)}function l1(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,l1(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=l1(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 mY(e){return ev(e)&&e.tagName.toLowerCase()==="button"}function gY(e){return ev(e)&&e.tagName.toLowerCase()==="form"}function vY(e){return ev(e)&&e.tagName.toLowerCase()==="input"}function xY(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function yY(e,t){return e.button===0&&(!t||t==="_self")&&!xY(e)}function c1(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 bY(e,t){let n=c1(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var Ih=null;function wY(){if(Ih===null)try{new FormData(document.createElement("form"),0),Ih=!1}catch{Ih=!0}return Ih}var jY=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function sb(e){return e!=null&&!jY.has(e)?(Ya(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${lm}"`),null):e}function SY(e,t){let n,r,s,o,i;if(gY(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(mY(e)||vY(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),!wY()){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 IC(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function D3(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 NY(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 CY(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 _Y(e,t,n){let r=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let i=await NY(o,n);return i.links?i.links():[]}return[]}));return PY(r.flat(1).filter(CY).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function OP(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 kY(e,t,{includeHydrateFallback:n}={}){return AY(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 AY(e){return[...new Set(e)]}function EY(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function PY(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let o=JSON.stringify(EY(s));return n.has(o)||(n.add(o),r.push({key:o,link:s})),r},[])}function $C(){let e=h.useContext(Ru);return IC(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function RY(){let e=h.useContext(Zg);return IC(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var DC=h.createContext(void 0);DC.displayName="FrameworkContext";function tv(){let e=h.useContext(DC);return IC(e,"You must render this element inside a <HydratedRouter> element"),e}function TY(e,t){let n=h.useContext(DC),[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 OY({page:e,...t}){let n=UG(),{nonce:r}=tv(),{router:s}=$C(),o=h.useMemo(()=>y3(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?(t.nonce==null&&r&&(t={...t,nonce:r}),n?h.createElement(IY,{page:e,matches:o,...t}):h.createElement($Y,{page:e,matches:o,...t})):null}function MY(e){let{manifest:t,routeModules:n}=tv(),[r,s]=h.useState([]);return h.useEffect(()=>{let o=!1;return _Y(e,t,n).then(i=>{o||s(i)}),()=>{o=!0}},[e,t,n]),r}function IY({page:e,matches:t,...n}){let r=Kr(),{future:s}=tv(),{basename:o}=$C(),i=h.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let c=D3(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 $Y({page:e,matches:t,...n}){let r=Kr(),{future:s,manifest:o,routeModules:i}=tv(),{basename:c}=$C(),{loaderData:d,matches:f}=RY(),m=h.useMemo(()=>OP(e,t,f,o,r,"data"),[e,t,f,o,r]),p=h.useMemo(()=>OP(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=D3(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(()=>kY(p,o),[p,o]),j=MY(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 DY(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var LY=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{LY&&(window.__reactRouterVersion="7.18.2")}catch{}function FY({basename:e,children:t,useTransitions:n,window:r}){let s=h.useRef();s.current==null&&(s.current=mG({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(pY,{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"&&PC.test(m),k=_3(m,b);m=k.to;let A=XG(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]=TY(r,j),U=qY(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||U(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:DY(y,D),target:f,"data-discover":!C&&n==="render"?"true":void 0});return O&&!C?h.createElement(h.Fragment,null,z,h.createElement(OY,{page:A})):z});At.displayName="Link";var L3=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&&KY(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)});L3.displayName="NavLink";var zY=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=HY(),S=VY(c,{relative:f}),N=i.toLowerCase()==="get"?"get":"post",C=typeof c=="string"&&PC.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})});zY.displayName="Form";function BY(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function F3(e){let t=h.useContext(Ru);return Bn(t,BY(e)),t}function qY(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(yY(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(c1(e)),n=h.useRef(!1),r=Kr(),s=h.useMemo(()=>bY(r.search,n.current?null:t.current),[r.search]),o=ss(),i=h.useCallback((c,d)=>{const f=c1(typeof c=="function"?c(new URLSearchParams(s)):c);n.current=!0,o("?"+f,d)},[o,s]);return[s,i]}var UY=0,WY=()=>`__${String(++UY)}__`;function HY(){let{router:e}=F3("useSubmit"),{basename:t}=h.useContext(Pa),n=cY(),r=e.fetch,s=e.navigate;return h.useCallback(async(o,i={})=>{let{action:c,method:d,encType:f,formData:m,body:p}=SY(o,t);if(i.navigate===!1){let v=i.fetcherKey||WY();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 VY(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 KY(e,{relative:t}={}){let n=h.useContext(E3);Bn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=F3("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 GY=Symbol.for("react.lazy"),jm=sC[" use ".trim().toString()];function YY(e){return typeof e=="object"&&e!==null&&"then"in e}function z3(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===GY&&"_payload"in e&&YY(e._payload)}function nv(e){const t=XY(e),n=h.forwardRef((r,s)=>{let{children:o,...i}=r;z3(o)&&typeof jm=="function"&&(o=jm(o._payload));const c=h.Children.toArray(o),d=c.find(JY);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 XY(e){const t=h.forwardRef((n,r)=>{let{children:s,...o}=n;if(z3(s)&&typeof jm=="function"&&(s=jm(s._payload)),h.isValidElement(s)){const i=eX(s),c=ZY(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 QY=Symbol("radix.slottable");function JY(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===QY}function ZY(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 eX(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 tX(){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 LC=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(LC({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 nX=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],rX=nX.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}},{}),aX="Separator",MP="horizontal",sX=["horizontal","vertical"],B3=h.forwardRef((e,t)=>{const{decorative:n,orientation:r=MP,...s}=e,o=oX(r)?r:MP,c=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return a.jsx(rX.div,{"data-orientation":o,...c,...s,ref:t})});B3.displayName=aX;function oX(e){return sX.includes(e)}var q3=B3;const U3=h.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},s)=>a.jsx(q3,{ref:s,decorative:n,orientation:t,className:$e("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));U3.displayName=q3.displayName;var ib="focusScope.autoFocusOnMount",lb="focusScope.autoFocusOnUnmount",IP={bubbles:!1,cancelable:!0},iX="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=Ot(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){DP.add(x);const y=document.activeElement;if(!c.contains(y)){const S=new CustomEvent(ib,IP);c.addEventListener(ib,f),c.dispatchEvent(S),S.defaultPrevented||(lX(pX(W3(c)),{select:!0}),document.activeElement===y&&mi(c))}return()=>{c.removeEventListener(ib,f),setTimeout(()=>{const S=new CustomEvent(lb,IP);c.addEventListener(lb,m),c.dispatchEvent(S),S.defaultPrevented||mi(y??document.body,{select:!0}),c.removeEventListener(lb,m),DP.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]=cX(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=iX;function lX(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(mi(r,{select:t}),document.activeElement!==n)return}function cX(e){const t=W3(e),n=$P(t,e),r=$P(t.reverse(),e);return[n,r]}function W3(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 $P(e,t){for(const n of e)if(!uX(n,{upTo:t}))return n}function uX(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 dX(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&&dX(e)&&t&&e.select()}}var DP=fX();function fX(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=LP(e,t),e.unshift(t)},remove(t){e=LP(e,t),e[0]?.resume()}}}function LP(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function pX(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]??FP()),document.body.insertAdjacentElement("beforeend",e[1]??FP()),cb++,()=>{cb===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),cb--}},[])}function FP(){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 H3(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 hX(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",mX="with-scroll-bars-hidden",gX="--removed-body-scroll-bar-size";function ub(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function vX(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 xX=typeof window<"u"?h.useLayoutEffect:h.useEffect,zP=new WeakMap;function yX(e,t){var n=vX(null,function(r){return e.forEach(function(s){return ub(s,r)})});return xX(function(){var r=zP.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)})}zP.set(n,e)},[e]),n}function bX(e){return e}function wX(e,t){t===void 0&&(t=bX);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 jX(e){e===void 0&&(e={});var t=wX(null);return t.options=Ls({async:!0,ssr:!1},e),t}var V3=function(e){var t=e.sideCar,n=H3(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))};V3.isSideCarExport=!0;function SX(e,t){return e.useMedium(t),V3}var K3=jX(),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=H3(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=v,E=yX([n,t]),P=Ls(Ls({},k),s);return h.createElement(h.Fragment,null,m&&h.createElement(A,{sideCar:K3,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 NX=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function CX(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=NX();return t&&e.setAttribute("nonce",t),e}function _X(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function kX(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var AX=function(){var e=0,t=null;return{add:function(n){e==0&&(t=CX())&&(_X(t,n),kX(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},EX=function(){var e=AX();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},G3=function(){var e=EX(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},PX={left:0,top:0,right:0,gap:0},fb=function(e){return parseInt(e||"",10)||0},RX=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)]},TX=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return PX;var t=RX(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])}},OX=G3(),Uc="data-scroll-locked",MX=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(mX,` {
|
|
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(gX,": ").concat(c,`px;
|
|
47
|
-
}
|
|
48
|
-
`)},BP=function(){var e=parseInt(document.body.getAttribute(Uc)||"0",10);return isFinite(e)?e:0},IX=function(){h.useEffect(function(){return document.body.setAttribute(Uc,(BP()+1).toString()),function(){var e=BP()-1;e<=0?document.body.removeAttribute(Uc):document.body.setAttribute(Uc,e.toString())}},[])},$X=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;IX();var o=h.useMemo(function(){return TX(s)},[s]);return h.createElement(OX,{styles:MX(o,!t,s,n?"":"!important")})},u1=!1;if(typeof window<"u")try{var $h=Object.defineProperty({},"passive",{get:function(){return u1=!0,!0}});window.addEventListener("test",$h,$h),window.removeEventListener("test",$h,$h)}catch{u1=!1}var bc=u1?{passive:!1}:!1,DX=function(e){return e.tagName==="TEXTAREA"},Y3=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!DX(e)&&n[t]==="visible")},LX=function(e){return Y3(e,"overflowY")},FX=function(e){return Y3(e,"overflowX")},qP=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=X3(e,r);if(s){var o=Q3(e,r),i=o[1],c=o[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},zX=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},BX=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},X3=function(e,t){return e==="v"?LX(t):FX(t)},Q3=function(e,t){return e==="v"?zX(t):BX(t)},qX=function(e,t){return e==="h"&&t==="rtl"?-1:1},UX=function(e,t,n,r,s){var o=qX(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=Q3(e,c),j=x[0],y=x[1],b=x[2],S=y-b-o*j;(j||S)&&X3(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]},UP=function(e){return[e.deltaX,e.deltaY]},WP=function(e){return e&&"current"in e?e.current:e},WX=function(e,t){return e[0]===t[0]&&e[1]===t[1]},HX=function(e){return`
|
|
49
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
50
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
51
|
-
`)},VX=0,wc=[];function KX(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),s=h.useState(VX++)[0],o=h.useState(G3)[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=hX([e.lockRef.current],(e.shards||[]).map(WP),!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 U=qP(P,E);if(!U)return!0;if(U?A=P:(A=P==="v"?"h":"v",U=qP(P,E)),!U)return!1;if(!r.current&&"changedTouches"in y&&(C||k)&&(r.current=A),!A)return!0;var B=r.current||A;return UX(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?UP(b):Dh(b),N=t.current.filter(function(A){return A.name===b.type&&(A.target===b.target||b.target===A.shadowParent)&&WX(A.delta,S)})[0];if(N&&N.should){b.cancelable&&b.preventDefault();return}if(!N){var C=(i.current.shards||[]).map(WP).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:GX(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,UP(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:HX(s)}):null,x?h.createElement($X,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function GX(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const YX=SX(K3,KX);var op=h.forwardRef(function(e,t){return h.createElement(av,Ls({},e,{ref:t,sideCar:YX}))});op.classNames=av.classNames;var XX=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,J3=function(e){return e&&(e.host||J3(e.parentNode))},QX=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=J3(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})},JX=function(e,t,n,r){var s=QX(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=XX(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),JX(r,s,n,"aria-hidden")):function(){return null}};function ZX(e){const t=eQ(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),d=c.find(nQ);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 eQ(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=aQ(s),c=rQ(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 tQ=Symbol("radix.slottable");function nQ(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tQ}function rQ(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 aQ(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",[Z3,eL]=kr(ov),[sQ,Rs]=Z3(ov),tL=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(sQ,{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})};tL.displayName=ov;var nL="DialogTrigger",rL=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Rs(nL,n),o=Ot(t,s.triggerRef);return a.jsx(lt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":BC(s.open),...r,ref:o,onClick:Ue(e.onClick,s.onOpenToggle)})});rL.displayName=nL;var FC="DialogPortal",[oQ,aL]=Z3(FC,{forceMount:void 0}),sL=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=Rs(FC,t);return a.jsx(oQ,{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})}))})};sL.displayName=FC;var Sm="DialogOverlay",oL=h.forwardRef((e,t)=>{const n=aL(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(lQ,{...s,ref:t})}):null});oL.displayName=Sm;var iQ=ZX("DialogOverlay.RemoveScroll"),lQ=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Rs(Sm,n);return a.jsx(op,{as:iQ,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(lt.div,{"data-state":BC(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Nl="DialogContent",iL=h.forwardRef((e,t)=>{const n=aL(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(cQ,{...s,ref:t}):a.jsx(uQ,{...s,ref:t})})});iL.displayName=Nl;var cQ=h.forwardRef((e,t)=>{const n=Rs(Nl,e.__scopeDialog),r=h.useRef(null),s=Ot(t,n.contentRef,r);return h.useEffect(()=>{const o=r.current;if(o)return sv(o)},[]),a.jsx(lL,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ue(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ue(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&o.preventDefault()}),onFocusOutside:Ue(e.onFocusOutside,o=>o.preventDefault())})}),uQ=h.forwardRef((e,t)=>{const n=Rs(Nl,e.__scopeDialog),r=h.useRef(!1),s=h.useRef(!1);return a.jsx(lL,{...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()}})}),lL=h.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,c=Rs(Nl,n),d=h.useRef(null),f=Ot(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":BC(c.open),...i,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(fQ,{titleId:c.titleId}),a.jsx(hQ,{contentRef:d,descriptionId:c.descriptionId})]})]})}),zC="DialogTitle",cL=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Rs(zC,n);return a.jsx(lt.h2,{id:s.titleId,...r,ref:t})});cL.displayName=zC;var uL="DialogDescription",dL=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Rs(uL,n);return a.jsx(lt.p,{id:s.descriptionId,...r,ref:t})});dL.displayName=uL;var fL="DialogClose",pL=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Rs(fL,n);return a.jsx(lt.button,{type:"button",...r,ref:t,onClick:Ue(e.onClick,()=>s.onOpenChange(!1))})});pL.displayName=fL;function BC(e){return e?"open":"closed"}var hL="DialogTitleWarning",[dQ,mL]=y9(hL,{contentName:Nl,titleName:zC,docsSlug:"dialog"}),fQ=({titleId:e})=>{const t=mL(hL),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},pQ="DialogDescriptionWarning",hQ=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${mL(pQ).contentName}}.`;return h.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},iv=tL,mQ=rL,lv=sL,Ou=oL,Mu=iL,ip=cL,lp=dL,cv=pL;const gL=iv,gQ=lv,vL=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}));vL.displayName=Ou.displayName;const vQ=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"}}),qC=h.forwardRef(({side:e="right",className:t,children:n,...r},s)=>a.jsxs(gQ,{children:[a.jsx(vL,{}),a.jsxs(Mu,{ref:s,className:$e(vQ({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"})]})]})]}));qC.displayName=Mu.displayName;const xL=({className:e,...t})=>a.jsx("div",{className:$e("flex flex-col space-y-2 text-center sm:text-left",e),...t});xL.displayName="SheetHeader";const yL=h.forwardRef(({className:e,...t},n)=>a.jsx(ip,{ref:n,className:$e("text-lg font-semibold text-foreground",e),...t}));yL.displayName=ip.displayName;const xQ=h.forwardRef(({className:e,...t},n)=>a.jsx(lp,{ref:n,className:$e("text-sm text-muted-foreground",e),...t}));xQ.displayName=lp.displayName;function HP({className:e,...t}){return a.jsx("div",{className:$e("animate-pulse rounded-md bg-muted",e),...t})}const yQ="sidebar:state",bQ=3600*24*7,wQ="16rem",jQ="18rem",SQ="3rem",NQ="b",bL=h.createContext(null);function cp(){const e=h.useContext(bL);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const wL=h.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:s,children:o,...i},c)=>{const d=tX(),[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=`${yQ}=${C}; path=/; max-age=${bQ}`},[n,x]),y=h.useCallback(()=>d?m(N=>!N):j(N=>!N),[d,j,m]);h.useEffect(()=>{const N=C=>{C.key===NQ&&(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(bL.Provider,{value:S,children:a.jsx(Ro,{delayDuration:0,children:a.jsx("div",{style:{"--sidebar-width":wQ,"--sidebar-width-icon":SQ,...s},className:$e("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",r),ref:c,...i,children:o})})})});wL.displayName="SidebarProvider";const jL=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(gL,{open:f,onOpenChange:m,...o,children:a.jsx(qC,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":jQ},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})})]})});jL.displayName="Sidebar";const SL=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(AW,{}),a.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});SL.displayName="SidebarTrigger";const CQ=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})});CQ.displayName="SidebarRail";const _Q=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}));_Q.displayName="SidebarInset";const kQ=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}));kQ.displayName="SidebarInput";const NL=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}));NL.displayName="SidebarHeader";const CL=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}));CL.displayName="SidebarFooter";const d1=h.forwardRef(({className:e,...t},n)=>a.jsx(U3,{ref:n,"data-sidebar":"separator",className:$e("mx-2 w-auto bg-sidebar-border",e),...t}));d1.displayName="SidebarSeparator";const _L=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}));_L.displayName="SidebarContent";const kL=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}));kL.displayName="SidebarGroup";const AL=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})});AL.displayName="SidebarGroupLabel";const AQ=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})});AQ.displayName="SidebarGroupAction";const EL=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,"data-sidebar":"group-content",className:$e("w-full text-sm",e),...t}));EL.displayName="SidebarGroupContent";const PL=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}));PL.displayName="SidebarMenu";const RL=h.forwardRef(({className:e,...t},n)=>a.jsx("li",{ref:n,"data-sidebar":"menu-item",className:$e("group/menu-item relative",e),...t}));RL.displayName="SidebarMenuItem";const EQ=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"}}),TL=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(EQ({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});TL.displayName="SidebarMenuButton";const PQ=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})});PQ.displayName="SidebarMenuAction";const RQ=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}));RQ.displayName="SidebarMenuBadge";const TQ=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(HP,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),a.jsx(HP,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":s}})]})});TQ.displayName="SidebarMenuSkeleton";const OQ=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}));OQ.displayName="SidebarMenuSub";const MQ=h.forwardRef(({...e},t)=>a.jsx("li",{ref:t,...e}));MQ.displayName="SidebarMenuSubItem";const IQ=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})});IQ.displayName="SidebarMenuSubButton";const OL=h.forwardRef(({className:e,activeClassName:t,pendingClassName:n,to:r,...s},o)=>a.jsx(L3,{ref:o,to:r,className:({isActive:i,isPending:c})=>$e(e,i&&t,c&&n),...s}));OL.displayName="NavLink";function $Q({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 DQ=[{title:"Home",items:[{title:"Dashboard",url:"/",icon:fC}]},{title:"Lab",items:[{title:"MCP Evaluations",url:"/mcp-evaluations",icon:b5},{title:"Analyze MCP",url:"/tool-analysis",icon:j5},{title:"OAuth Debugger",url:"/oauth-debugger",icon:RW}]},{title:"Libraries",items:[{title:"Test Cases",url:"/libraries/test-cases",icon:dC},{title:"MCP servers",url:"/libraries/servers",icon:x5},{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:w5},{title:"MCP Analysis Results",url:"/tool-analysis-results",icon:S5},{title:"Custom Reports",url:"/markdown-reports",icon:Mc}]},{title:"Workspace",items:[{title:"Settings",url:"/settings",icon:mC},{title:"MCPLab MCP server",url:"/settings/mcp",icon:KS}]}];function LQ(e={version:null}){const t=e.version??null,{state:n}=cp(),r=n==="collapsed",s=Kr(),o=h.useMemo(()=>DQ,[]);return a.jsxs(jL,{collapsible:"icon",children:[a.jsx(NL,{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($Q,{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(_L,{children:o.map((i,c)=>a.jsxs("div",{children:[c>0&&!r&&a.jsx(d1,{className:"my-1.5"}),a.jsxs(kL,{className:r?"px-2":"px-3 py-2",children:[!r&&a.jsx(AL,{className:"px-1 pb-1.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/90",children:i.title}),a.jsx(EL,{children:a.jsx(PL,{children:i.items.map(d=>a.jsx(RL,{children:a.jsx(TL,{asChild:!0,isActive:d.url==="/"?s.pathname==="/":d.url==="/settings"?s.pathname==="/settings":s.pathname.startsWith(d.url),tooltip:d.title,children:a.jsxs(OL,{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(CL,{className:r?"px-2 py-2":"px-3 py-3",children:[a.jsx(d1,{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(jW,{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 ML=h.forwardRef(({...e},t)=>a.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));ML.displayName="Breadcrumb";const IL=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}));IL.displayName="BreadcrumbList";const $L=h.forwardRef(({className:e,...t},n)=>a.jsx("li",{ref:n,className:$e("inline-flex items-center gap-1.5",e),...t}));$L.displayName="BreadcrumbItem";const DL=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})});DL.displayName="BreadcrumbLink";const LL=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}));LL.displayName="BreadcrumbPage";const FL=({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,{})});FL.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 FQ(e){const t=Fs();for(const n of e)Ec(t,n);return xo(t)}const zQ={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 BQ(e){return e.startsWith("image/")?"image":"document"}function qQ(e){return e?.split(".").pop()?.toLowerCase()??""}function UQ(e){if(e.media_type)return e.media_type;if(e.path)return zQ[qQ(e.path)]}function f1(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 WQ{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 HQ{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 Ee{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+Ee.version}static addUnaryOp(t){return Ee.max_unop_len=Math.max(t.length,Ee.max_unop_len),Ee.unary_ops[t]=1,Ee}static addBinaryOp(t,n,r){return Ee.max_binop_len=Math.max(t.length,Ee.max_binop_len),Ee.binary_ops[t]=n,r?Ee.right_associative.add(t):Ee.right_associative.delete(t),Ee}static addIdentifierChar(t){return Ee.additional_identifier_chars.add(t),Ee}static addLiteral(t,n){return Ee.literals[t]=n,Ee}static removeUnaryOp(t){return delete Ee.unary_ops[t],t.length===Ee.max_unop_len&&(Ee.max_unop_len=Ee.getMaxKeyLen(Ee.unary_ops)),Ee}static removeAllUnaryOps(){return Ee.unary_ops={},Ee.max_unop_len=0,Ee}static removeIdentifierChar(t){return Ee.additional_identifier_chars.delete(t),Ee}static removeBinaryOp(t){return delete Ee.binary_ops[t],t.length===Ee.max_binop_len&&(Ee.max_binop_len=Ee.getMaxKeyLen(Ee.binary_ops)),Ee.right_associative.delete(t),Ee}static removeAllBinaryOps(){return Ee.binary_ops={},Ee.max_binop_len=0,Ee}static removeLiteral(t){return delete Ee.literals[t],Ee}static removeAllLiterals(){return Ee.literals={},Ee}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 Ee(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 Ee.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!Ee.binary_ops[String.fromCharCode(t)]||Ee.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return Ee.isIdentifierStart(t)||Ee.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(Ee.hooks[t]){const r={context:this,node:n};return Ee.hooks.run(t,r),r.node}return n}searchHook(t){if(Ee.hooks[t]){const n={context:this};return Ee.hooks[t].find(function(r){return r.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===Ee.SPACE_CODE||t===Ee.TAB_CODE||t===Ee.LF_CODE||t===Ee.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:Ee.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===Ee.SEMCOL_CODE||r===Ee.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,Ee.max_binop_len),n=t.length;for(;n>0;){if(Ee.binary_ops.hasOwnProperty(t)&&(!Ee.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!Ee.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:Ee.binaryPrecedence(n),right_a:Ee.right_associative.has(n)},c=this.gobbleToken(),c||this.throwError("Expected expression after "+n),s=[i,o,c];n=this.gobbleBinaryOp();){if(r=Ee.binaryPrecedence(n),r===0){this.index-=n.length;break}o={value:n,prec:r,right_a:Ee.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:Ee.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:Ee.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,Ee.isDecimalDigit(t)||t===Ee.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===Ee.SQUOTE_CODE||t===Ee.DQUOTE_CODE)s=this.gobbleStringLiteral();else if(t===Ee.OBRACK_CODE)s=this.gobbleArray();else{for(n=this.expr.substr(this.index,Ee.max_unop_len),r=n.length;r>0;){if(Ee.unary_ops.hasOwnProperty(n)&&(!Ee.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!Ee.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:Ee.UNARY_EXP,operator:n,argument:o,prefix:!0})}n=n.substr(0,--r)}Ee.isIdentifierStart(t)?(s=this.gobbleIdentifier(),Ee.literals.hasOwnProperty(s.name)?s={type:Ee.LITERAL,value:Ee.literals[s.name],raw:s.name}:s.name===Ee.this_str&&(s={type:Ee.THIS_EXP})):t===Ee.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===Ee.PERIOD_CODE||n===Ee.OBRACK_CODE||n===Ee.OPAREN_CODE||n===Ee.QUMARK_CODE;){let r;if(n===Ee.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==Ee.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===Ee.OBRACK_CODE?(t={type:Ee.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),n=this.code,n!==Ee.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===Ee.OPAREN_CODE?t={type:Ee.CALL_EXP,arguments:this.gobbleArguments(Ee.CPAREN_CODE),callee:t}:(n===Ee.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),t={type:Ee.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(;Ee.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===Ee.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);Ee.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++));Ee.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);Ee.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return r=this.code,Ee.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(r===Ee.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===Ee.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:Ee.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:Ee.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let t=this.code,n=this.index;for(Ee.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,Ee.isIdentifierPart(t));)this.index++;return{type:Ee.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===Ee.CPAREN_CODE&&s&&s>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(o===Ee.COMMA_CODE){if(this.index++,s++,s!==n.length){if(t===Ee.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===Ee.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===Ee.COMPOUND)&&this.throwError("Expected comma"),n.push(i)}}return r||this.throwError("Expected "+String.fromCharCode(t)),n}gobbleGroup(){this.index++;let t=this.gobbleExpressions(Ee.CPAREN_CODE);if(this.code===Ee.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:Ee.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:Ee.ARRAY_EXP,elements:this.gobbleArguments(Ee.CBRACK_CODE)}}}const VQ=new WQ;Object.assign(Ee,{hooks:VQ,plugins:new HQ(Ee),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"});Ee.max_unop_len=Ee.getMaxKeyLen(Ee.unary_ops);Ee.max_binop_len=Ee.getMaxKeyLen(Ee.binary_ops);const Io=e=>new Ee(e).parse(),KQ=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(Ee).filter(e=>!KQ.includes(e)&&Io[e]===void 0).forEach(e=>{Io[e]=Ee[e]});Io.Jsep=Ee;const GQ="ConditionalExpression";var YQ={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:GQ,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(YQ);const VP=47,XQ=92;var QQ={name:"regex",init(e){e.hooks.add("gobble-token",function(n){if(this.code===VP){const r=++this.index;let s=!1;for(;this.index<this.expr.length;){if(this.code===VP&&!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===XQ?2:1}this.throwError("Unclosed Regex")}})}};const hb=43,JQ=45,Pc={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[hb,JQ],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(QQ,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 ZQ(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"&&ZQ(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 zL(e){return e.length>0?`Tool sequence · ${e.join(" -> ")}`:"Tool sequence"}function go(e){return e==null?void 0:String(e)}function eJ(e,t){return`${e}-${t+1}`}function Gd(e){return Hn(e)||void 0}function UC(e){return e!==void 0?{temperature:e}:{}}function tJ(e){const t=e.media_type??UQ(e)??"application/octet-stream";return{type:BQ(t),media_type:t,data:e.data??"",...e.url?{url:e.url}:{},...e.name?{name:e.name}:{}}}function nJ(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 rJ(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 aJ(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 sJ(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=>aJ(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 oJ(e){if(e.length!==0)return e.map(t=>({name:t.name,from:"final_text",regex:t.pattern}))}function BL(e,t){const n=sJ(e.evalRules,e.agentContext),r=oJ(e.extractRules);return{id:e.id,name:Gd(e.name),mcp_servers:t,prompt:e.prompt,attachments:e.attachments,eval:n,extract:r}}function KP(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,...UC(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=KP(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(nJ(b));for(const b of p.eval?.tool_input_assertions??[])x.push(rJ(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||eJ("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=KP(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(tJ),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 iJ(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 GP(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,...UC(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 BL(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 lJ(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,...UC(r.temperature),max_tokens:r.maxTokens,max_turns:r.maxTurns,system:r.systemPrompt}]));return{servers:t,agents:n,scenarios:e.scenarios.map(r=>BL(r,r.serverIds.length>0?r.serverIds.map(s=>({ref:s})):void 0))}}function cJ(e,t){if(e)return`${e}::${t??""}`}function gb(e){return e.type==="text"}function qL(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 UL(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:YP(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:YP(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 YP(e){try{return JSON.stringify(e)}catch{return String(e)}}function XP(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 WL(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;XP(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}XP(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 HL(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 uJ(e){return f1(e.flatMap(t=>t.checkResults??[]))}function QP(e,t=[]){const n=new Map;for(const c of t){const d=cJ(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=WL(C);return{runIndex:S.run_index,passed:S.pass,error:S.error,toolCalls:qL(S,C),assistantTokenUsage:k.assistant,toolTokenUsage:k.tool,toolTokenUsageByTool:k.perTool,finalAnswer:S.final_text,conversation:UL(C),duration:HL(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:uJ(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 dJ(e,t){const n=WL(t??void 0);return{runIndex:e.run_index,passed:e.pass,error:e.error,toolCalls:qL(e,t??void 0),assistantTokenUsage:n.assistant,toolTokenUsage:n.tool,toolTokenUsageByTool:n.perTool,finalAnswer:e.final_text,conversation:UL(t??void 0),duration:HL(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 fJ(){return typeof window>"u"?"":window.location.port==="8685"?"http://127.0.0.1:8787":""}const yo=fJ();class WC 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 WC(n.status,`Request failed (${n.status}): ${r}`)}return await n.json()}async function pJ(e,t){const n=await fetch(`${yo}${e}`,{...t,headers:{}});if(!n.ok){const r=await n.text();throw new WC(n.status,`Request failed (${n.status}): ${r}`)}return n.text()}function JP(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)=>JP(`/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)=>JP(`/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`):pJ(`/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 hJ(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 mJ(e){return e||`config-${Date.now()}`}const gJ={async health(){return st.health()},async listConfigs(){return(await st.listConfigs()).map(dm)},async createConfig(e){const t=await st.createConfig(hJ(e),GP(e));return dm(t)},async updateConfig(e){const t=await st.updateConfig(e.id,GP(e),mJ(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 QP(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 QP(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:dJ(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 iJ(e)},async saveLibraries(e){await st.saveLibraries(lJ(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)}},VL=h.createContext(null);function vJ({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(()=>gJ,[]);return a.jsx(VL.Provider,{value:{mode:t,connection:n,version:s,source:i},children:e})}function Dn(){const e=h.useContext(VL);if(!e)throw new Error("useDataSource must be used within DataSourceProvider");return e}const xJ=5,yJ=2e3;function bJ(e){return e.filter(t=>t.status==="blocked_auth"&&t.blockedReason==="oauth_required").length}function ZP(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 KL(){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=ZP(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=ZP(O),K=new Set([...D.active_jobs,...D.admitting_jobs,...D.queued].map(B=>B.jobId)),U=[...p.current].filter(B=>!K.has(B)).length;U>0&&i(B=>B+U),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>=xJ){s("disconnected"),f.current="disconnected";return}x+=1,s("connecting"),f.current="connecting";const D=yJ*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=bJ(t.queued);return{isRunning:v,runningCount:x,completionVersion:o,queuedCount:j,oauthBlockedCount:y,streamStatus:r,reconnectStream:()=>{d(b=>b+1)}}},[t,r])}const wJ=(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 jJ(){const e=Kr(),t=new URLSearchParams(e.search).get("embed")==="1",n=wJ(e.pathname,e.search),{version:r}=Dn(),{isRunning:s,runningCount:o,queuedCount:i,oauthBlockedCount:c,streamStatus:d,reconnectStream:f}=KL(),m=i+o;return t?a.jsx("main",{className:"min-h-screen overflow-auto bg-background p-4",children:a.jsx(TP,{})}):a.jsx(wL,{children:a.jsxs("div",{className:"flex min-h-screen w-full",children:[a.jsx(LQ,{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(SL,{}),a.jsx(ML,{children:a.jsx(IL,{children:n.map((p,v)=>{const x=v===n.length-1;return a.jsxs(h.Fragment,{children:[a.jsx($L,{children:p.to&&!x?a.jsx(DL,{asChild:!0,children:a.jsx(At,{to:p.to,children:p.label})}):a.jsx(LL,{children:p.label})}),!x&&a.jsx(FL,{})]},`${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(TP,{})})]})]})})}const GL=h.createContext(null);function SJ({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(GL.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(GL);if(!e)throw new Error("useConfigs must be used within ConfigProvider");return e}const YL=h.createContext(null);function NJ({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(YL.Provider,{value:d,children:e})}function Ts(){const e=h.useContext(YL);if(!e)throw new Error("useLibraries must be used within LibraryProvider");return e}const Je=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}));Je.displayName="Card";const Dt=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:$e("flex flex-col space-y-1.5 p-6",e),...t}));Dt.displayName="CardHeader";const Lt=h.forwardRef(({className:e,...t},n)=>a.jsx("h3",{ref:n,className:$e("text-2xl font-semibold leading-none tracking-tight",e),...t}));Lt.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 Ze=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:$e("p-6 pt-0",e),...t}));Ze.displayName="CardContent";const CJ=h.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:$e("flex items-center p-6 pt-0",e),...t}));CJ.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 _J=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}));_J.displayName="TableFooter";const Ht=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}));Ht.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 qe=h.forwardRef(({className:e,...t},n)=>a.jsx("td",{ref:n,className:$e("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));qe.displayName="TableCell";const kJ=h.forwardRef(({className:e,...t},n)=>a.jsx("caption",{ref:n,className:$e("mt-4 text-sm text-muted-foreground",e),...t}));kJ.displayName="TableCaption";function nr({title:e,value:t,subtitle:n,icon:r,trend:s,compact:o=!1}){return a.jsx(Je,{className:o?"h-fit self-start":void 0,children:a.jsx(Ze,{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 AJ=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"}}),Qe=h.forwardRef(({className:e,variant:t,asChild:n,...r},s)=>{const o=n?Pi:"div";return a.jsx(o,{ref:s,className:$e(AJ({variant:t}),e),...r})});Qe.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(Qe,{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 EJ(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 PJ(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 RJ(e){return e==="auth"?"Auth error":e==="rate_limit"?"Rate limited":"Infra error"}function TJ(e){const t=EJ(e),n=["auth","rate_limit","infra"];for(const r of n){const s=t.find(o=>PJ(o)===r);if(s)return{kind:r,label:RJ(r),detail:s}}return null}function OJ(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 XL({run:e}){const t=TJ(e);return t?a.jsx(Ro,{delayDuration:0,children:a.jsxs(To,{children:[a.jsx(Oo,{asChild:!0,children:a.jsx(Qe,{variant:"outline",className:`h-5 text-[10px] ${OJ(t.kind)}`,children:t.label})}),a.jsx(Gs,{className:"max-w-sm text-xs",children:a.jsx("p",{children:t.detail})})]})}):null}var bb,eR;function fa(){if(eR)return bb;eR=1;var e=Array.isArray;return bb=e,bb}var wb,tR;function QL(){if(tR)return wb;tR=1;var e=typeof Ah=="object"&&Ah&&Ah.Object===Object&&Ah;return wb=e,wb}var jb,nR;function Js(){if(nR)return jb;nR=1;var e=QL(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return jb=n,jb}var Sb,rR;function dp(){if(rR)return Sb;rR=1;var e=Js(),t=e.Symbol;return Sb=t,Sb}var Nb,aR;function MJ(){if(aR)return Nb;aR=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,sR;function IJ(){if(sR)return Cb;sR=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Cb=n,Cb}var _b,oR;function zo(){if(oR)return _b;oR=1;var e=dp(),t=MJ(),n=IJ(),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,iR;function Bo(){if(iR)return kb;iR=1;function e(t){return t!=null&&typeof t=="object"}return kb=e,kb}var Ab,lR;function Iu(){if(lR)return Ab;lR=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,cR;function HC(){if(cR)return Eb;cR=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,uR;function Ri(){if(uR)return Pb;uR=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Pb=e,Pb}var Rb,dR;function VC(){if(dR)return Rb;dR=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,fR;function $J(){if(fR)return Tb;fR=1;var e=Js(),t=e["__core-js_shared__"];return Tb=t,Tb}var Ob,pR;function DJ(){if(pR)return Ob;pR=1;var e=$J(),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,hR;function JL(){if(hR)return Mb;hR=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,mR;function LJ(){if(mR)return Ib;mR=1;var e=VC(),t=DJ(),n=Ri(),r=JL(),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,gR;function FJ(){if(gR)return $b;gR=1;function e(t,n){return t?.[n]}return $b=e,$b}var Db,vR;function Ul(){if(vR)return Db;vR=1;var e=LJ(),t=FJ();function n(r,s){var o=t(r,s);return e(o)?o:void 0}return Db=n,Db}var Lb,xR;function uv(){if(xR)return Lb;xR=1;var e=Ul(),t=e(Object,"create");return Lb=t,Lb}var Fb,yR;function zJ(){if(yR)return Fb;yR=1;var e=uv();function t(){this.__data__=e?e(null):{},this.size=0}return Fb=t,Fb}var zb,bR;function BJ(){if(bR)return zb;bR=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,wR;function qJ(){if(wR)return Bb;wR=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,jR;function UJ(){if(jR)return qb;jR=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,SR;function WJ(){if(SR)return Ub;SR=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,NR;function HJ(){if(NR)return Wb;NR=1;var e=zJ(),t=BJ(),n=qJ(),r=UJ(),s=WJ();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,CR;function VJ(){if(CR)return Hb;CR=1;function e(){this.__data__=[],this.size=0}return Hb=e,Hb}var Vb,_R;function KC(){if(_R)return Vb;_R=1;function e(t,n){return t===n||t!==t&&n!==n}return Vb=e,Vb}var Kb,kR;function dv(){if(kR)return Kb;kR=1;var e=KC();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,AR;function KJ(){if(AR)return Gb;AR=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,ER;function GJ(){if(ER)return Yb;ER=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,PR;function YJ(){if(PR)return Xb;PR=1;var e=dv();function t(n){return e(this.__data__,n)>-1}return Xb=t,Xb}var Qb,RR;function XJ(){if(RR)return Qb;RR=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,TR;function fv(){if(TR)return Jb;TR=1;var e=VJ(),t=KJ(),n=GJ(),r=YJ(),s=XJ();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,OR;function GC(){if(OR)return Zb;OR=1;var e=Ul(),t=Js(),n=e(t,"Map");return Zb=n,Zb}var e0,MR;function QJ(){if(MR)return e0;MR=1;var e=HJ(),t=fv(),n=GC();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return e0=r,e0}var t0,IR;function JJ(){if(IR)return t0;IR=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,$R;function pv(){if($R)return n0;$R=1;var e=JJ();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,DR;function ZJ(){if(DR)return r0;DR=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,LR;function eZ(){if(LR)return a0;LR=1;var e=pv();function t(n){return e(this,n).get(n)}return a0=t,a0}var s0,FR;function tZ(){if(FR)return s0;FR=1;var e=pv();function t(n){return e(this,n).has(n)}return s0=t,s0}var o0,zR;function nZ(){if(zR)return o0;zR=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,BR;function YC(){if(BR)return i0;BR=1;var e=QJ(),t=ZJ(),n=eZ(),r=tZ(),s=nZ();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,qR;function ZL(){if(qR)return l0;qR=1;var e=YC(),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,UR;function rZ(){if(UR)return c0;UR=1;var e=ZL(),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,WR;function aZ(){if(WR)return u0;WR=1;var e=rZ(),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,HR;function XC(){if(HR)return d0;HR=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,VR;function sZ(){if(VR)return f0;VR=1;var e=dp(),t=XC(),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,KR;function e4(){if(KR)return p0;KR=1;var e=sZ();function t(n){return n==null?"":e(n)}return p0=t,p0}var h0,GR;function t4(){if(GR)return h0;GR=1;var e=fa(),t=HC(),n=aZ(),r=e4();function s(o,i){return e(o)?o:t(o,i)?[o]:n(r(o))}return h0=s,h0}var m0,YR;function hv(){if(YR)return m0;YR=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,XR;function QC(){if(XR)return g0;XR=1;var e=t4(),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,QR;function n4(){if(QR)return v0;QR=1;var e=QC();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 oZ=n4();const _a=xn(oZ);var x0,JR;function iZ(){if(JR)return x0;JR=1;function e(t){return t==null}return x0=e,x0}var lZ=iZ();const Kt=xn(lZ);var y0,ZR;function cZ(){if(ZR)return y0;ZR=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 uZ=cZ();const Cl=xn(uZ);var dZ=VC();const Vt=xn(dZ);var fZ=Ri();const $u=xn(fZ);var b0={exports:{}},hn={};var eT;function pZ(){if(eT)return hn;eT=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 tT;function hZ(){return tT||(tT=1,b0.exports=pZ()),b0.exports}var mZ=hZ(),w0,nT;function r4(){if(nT)return w0;nT=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,rT;function gZ(){if(rT)return j0;rT=1;var e=r4();function t(n){return e(n)&&n!=+n}return j0=t,j0}var vZ=gZ();const fp=xn(vZ);var xZ=r4();const yZ=xn(xZ);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 yZ(t)&&!fp(t)},bZ=function(t){return Kt(t)},dr=function(t){return rt(t)||Cl(t)},wZ=0,Du=function(t){var n=++wZ;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},jZ=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 SZ=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 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 NZ=["viewBox","children"],CZ=["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"],aT=["points","pathLength"],S0={svg:NZ,polygon:aT,polyline:aT},JC=["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){JC.includes(o)&&(s[o]=n||function(i){return r[o](r,i)})}),s},_Z=function(t,n,r){return function(s){return t(n,r,s),null}},_l=function(t,n,r){if(!$u(t)||p1(t)!=="object")return null;var s=null;return Object.keys(t).forEach(function(o){var i=t[o];JC.includes(o)&&typeof i=="function"&&(s||(s={}),s[o]=_Z(i,n,r))}),s},kZ=["children"],AZ=["children"];function sT(e,t){if(e==null)return{};var n=EZ(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 EZ(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 h1(e){"@babel/helpers - typeof";return h1=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},h1(e)}var oT={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":""},iT=null,N0=null,ZC=function e(t){if(t===iT&&Array.isArray(N0))return N0;var n=[];return h.Children.forEach(t,function(r){Kt(r)||(mZ.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),N0=n,iT=t,n};function ka(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(s){return jo(s)}):r=[jo(t)],ZC(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 lT=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)},PZ=["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"],RZ=function(t){return t&&t.type&&Cl(t.type)&&PZ.indexOf(t.type)>=0},TZ=function(t){return t&&h1(t)==="object"&&"clipDot"in t},OZ=function(t,n,r,s){var o,i=(o=S0?.[s])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!Vt(t)&&(s&&i.includes(n)||CZ.includes(n))||r&&JC.includes(n)},It=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;OZ((c=s)===null||c===void 0?void 0:c[i],i,n,r)&&(o[i]=s[i])}),o},m1=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 cT(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(!cT(o,i))return!1}return!0},cT=function(t,n){if(Kt(t)&&Kt(n))return!0;if(!Kt(t)&&!Kt(n)){var r=t.props||{},s=r.children,o=sT(r,kZ),i=n.props||{},c=i.children,d=sT(i,AZ);return s&&c?Wc(o,d)&&m1(s,c):!s&&!c?Wc(o,d):!1}return!1},uT=function(t,n){var r=[],s={};return ZC(t).forEach(function(o,i){if(RZ(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},MZ=function(t){var n=t&&t.type;return n&&oT[n]?oT[n]:null},IZ=function(t,n){return ZC(n).indexOf(t)},$Z=["children","width","height","viewBox","className","style","title","desc"];function g1(){return g1=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},g1.apply(this,arguments)}function DZ(e,t){if(e==null)return{};var n=LZ(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 LZ(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 v1(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=DZ(e,$Z),m=s||{width:n,height:r,x:0,y:0},p=Gt("recharts-surface",o);return Q.createElement("svg",g1({},It(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 FZ=["children","className"];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 zZ(e,t){if(e==null)return{};var n=BZ(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 BZ(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=zZ(e,FZ),o=Gt("recharts-layer",r);return Q.createElement("g",x1({className:o},It(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,dT;function qZ(){if(dT)return C0;dT=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,fT;function UZ(){if(fT)return _0;fT=1;var e=qZ();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,pT;function a4(){if(pT)return k0;pT=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,hT;function WZ(){if(hT)return A0;hT=1;function e(t){return t.split("")}return A0=e,A0}var E0,mT;function HZ(){if(mT)return E0;mT=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,gT;function VZ(){if(gT)return P0;gT=1;var e=WZ(),t=a4(),n=HZ();function r(s){return t(s)?n(s):e(s)}return P0=r,P0}var R0,vT;function KZ(){if(vT)return R0;vT=1;var e=UZ(),t=a4(),n=VZ(),r=e4();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,xT;function GZ(){if(xT)return T0;xT=1;var e=KZ(),t=e("toUpperCase");return T0=t,T0}var YZ=GZ();const mv=xn(YZ);function kn(e){return function(){return e}}const s4=Math.cos,_m=Math.sin,Os=Math.sqrt,km=Math.PI,gv=2*km,y1=Math.PI,b1=2*y1,ol=1e-6,XZ=b1-ol;function o4(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function QZ(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return o4;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 JZ{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?o4:QZ(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((y1-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%b1+b1),v>XZ?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>=y1)},${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 e_(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 JZ(t)}function t_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function i4(e){this._context=e}i4.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 i4(e)}function l4(e){return e[0]}function c4(e){return e[1]}function u4(e,t){var n=kn(!0),r=null,s=vv,o=null,i=e_(c);e=typeof e=="function"?e:e===void 0?l4:kn(e),t=typeof t=="function"?t:t===void 0?c4:kn(t);function c(d){var f,m=(d=t_(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=e_(f);e=typeof e=="function"?e:e===void 0?l4:kn(+e),t=typeof t=="function"?t:kn(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?c4:kn(+n);function f(p){var v,x,j,y=(p=t_(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 u4().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 d4{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 ZZ(e){return new d4(e,!0)}function eee(e){return new d4(e,!1)}const n_={draw(e,t){const n=Os(t/km);e.moveTo(n,0),e.arc(0,0,n,0,gv)}},tee={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()}},f4=Os(1/3),nee=f4*2,ree={draw(e,t){const n=Os(t/nee),r=n*f4;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},aee={draw(e,t){const n=Os(t),r=-n/2;e.rect(r,r,n,n)}},see=.8908130915292852,p4=_m(km/10)/_m(7*km/10),oee=_m(gv/10)*p4,iee=-s4(gv/10)*p4,lee={draw(e,t){const n=Os(t*see),r=oee*n,s=iee*n;e.moveTo(0,-n),e.lineTo(r,s);for(let o=1;o<5;++o){const i=gv*o/5,c=s4(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),cee={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,w1=1/Os(12),uee=(w1/2+1)*3,dee={draw(e,t){const n=Os(t/uee),r=n/2,s=n*w1,o=r,i=n*w1+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 fee(e,t){let n=null,r=e_(s);e=typeof e=="function"?e:kn(e||n_),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 h4(e){this._context=e}h4.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 pee(e){return new h4(e)}function m4(e){this._context=e}m4.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 hee(e){return new m4(e)}function g4(e){this._context=e}g4.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 mee(e){return new g4(e)}function v4(e){this._context=e}v4.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 gee(e){return new v4(e)}function yT(e){return e<0?-1:1}function bT(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(yT(o)+yT(i))*Math.min(Math.abs(o),Math.abs(i),.5*Math.abs(c))||0}function wT(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,wT(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,wT(this,n=bT(this,e,t)),n);break;default:M0(this,this._t0,n=bT(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function x4(e){this._context=new y4(e)}(x4.prototype=Object.create(Pm.prototype)).point=function(e,t){Pm.prototype.point.call(this,t,e)};function y4(e){this._context=e}y4.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 vee(e){return new Pm(e)}function xee(e){return new x4(e)}function b4(e){this._context=e}b4.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=jT(e),s=jT(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 jT(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 yee(e){return new b4(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 bee(e){return new xv(e,.5)}function wee(e){return new xv(e,0)}function jee(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 j1(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function See(e,t){return e[t]}function Nee(e){const t=[];return t.key=e,t}function Cee(){var e=kn([]),t=j1,n=Zc,r=See;function s(o){var i=Array.from(e.apply(this,arguments),Nee),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=t_(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?j1:typeof o=="function"?o:kn(Array.from(o)),s):t},s.offset=function(o){return arguments.length?(n=o??Zc,s):n},s}function _ee(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 kee(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 Aee(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 Eee=["type","size","sizeType"];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 ST(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 NT(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ST(Object(n),!0).forEach(function(r){Pee(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ST(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Pee(e,t,n){return t=Ree(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ree(e){var t=Tee(e,"string");return uf(t)=="symbol"?t:t+""}function Tee(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 Oee(e,t){if(e==null)return{};var n=Mee(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 Mee(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 w4={symbolCircle:n_,symbolCross:tee,symbolDiamond:ree,symbolSquare:aee,symbolStar:lee,symbolTriangle:cee,symbolWye:dee},Iee=Math.PI/180,$ee=function(t){var n="symbol".concat(mv(t));return w4[n]||n_},Dee=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*Iee;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}},Lee=function(t,n){w4["symbol".concat(mv(t))]=n},r_=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=Oee(t,Eee),f=NT(NT({},d),{},{type:r,size:o,sizeType:c}),m=function(){var b=$ee(r),S=fee().type(b).size(Dee(o,c,r));return S()},p=f.className,v=f.cx,x=f.cy,j=It(f,!0);return v===+v&&x===+x&&o===+o?Q.createElement("path",S1({},j,{className:Gt("recharts-symbols",p),transform:"translate(".concat(v,", ").concat(x,")"),d:m()})):null};r_.registerSymbol=Lee;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 N1(){return N1=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},N1.apply(this,arguments)}function CT(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 Fee(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?CT(Object(n),!0).forEach(function(r){df(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bee(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,S4(r.key),r)}}function qee(e,t,n){return t&&Bee(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Uee(e,t,n){return t=Rm(t),Wee(e,j4()?Reflect.construct(t,n||[],Rm(e).constructor):t.apply(e,n))}function Wee(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 Hee(e)}function Hee(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(j4=function(){return!!e})()}function Rm(e){return Rm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Rm(e)}function Vee(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 df(e,t,n){return t=S4(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S4(e){var t=Kee(e,"string");return eu(t)=="symbol"?t:t+""}function Kee(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,a_=(function(e){function t(){return zee(this,t),Uee(this,t,arguments)}return Vee(t,e),qee(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=Fee({},r);return delete f.legendIcon,Q.cloneElement(r.legendIcon,f)}return Q.createElement(r_,{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=Gt(df(df({"recharts-legend-item":!0},"legend-item-".concat(j),!0),"inactive",x.inactive));if(x.type==="none")return null;var S=Vt(x.value)?null:x.value;So(!Vt(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",N1({className:b,style:p,key:"legend-item-".concat(j)},_l(r.props,x,j)),Q.createElement(v1,{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(a_,"displayName","Legend");df(a_,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var I0,_T;function Gee(){if(_T)return I0;_T=1;var e=fv();function t(){this.__data__=new e,this.size=0}return I0=t,I0}var $0,kT;function Yee(){if(kT)return $0;kT=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return $0=e,$0}var D0,AT;function Xee(){if(AT)return D0;AT=1;function e(t){return this.__data__.get(t)}return D0=e,D0}var L0,ET;function Qee(){if(ET)return L0;ET=1;function e(t){return this.__data__.has(t)}return L0=e,L0}var F0,PT;function Jee(){if(PT)return F0;PT=1;var e=fv(),t=GC(),n=YC(),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,RT;function N4(){if(RT)return z0;RT=1;var e=fv(),t=Gee(),n=Yee(),r=Xee(),s=Qee(),o=Jee();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,TT;function Zee(){if(TT)return B0;TT=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return B0=t,B0}var q0,OT;function ete(){if(OT)return q0;OT=1;function e(t){return this.__data__.has(t)}return q0=e,q0}var U0,MT;function C4(){if(MT)return U0;MT=1;var e=YC(),t=Zee(),n=ete();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,IT;function _4(){if(IT)return W0;IT=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,$T;function k4(){if($T)return H0;$T=1;function e(t,n){return t.has(n)}return H0=e,H0}var V0,DT;function A4(){if(DT)return V0;DT=1;var e=C4(),t=_4(),n=k4(),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,LT;function tte(){if(LT)return K0;LT=1;var e=Js(),t=e.Uint8Array;return K0=t,K0}var G0,FT;function nte(){if(FT)return G0;FT=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,zT;function s_(){if(zT)return Y0;zT=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,BT;function rte(){if(BT)return X0;BT=1;var e=dp(),t=tte(),n=KC(),r=A4(),s=nte(),o=s_(),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,U,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||!U(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,U,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,qT;function E4(){if(qT)return Q0;qT=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,UT;function ate(){if(UT)return J0;UT=1;var e=E4(),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,WT;function ste(){if(WT)return Z0;WT=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,HT;function ote(){if(HT)return ew;HT=1;function e(){return[]}return ew=e,ew}var tw,VT;function ite(){if(VT)return tw;VT=1;var e=ste(),t=ote(),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,KT;function lte(){if(KT)return nw;KT=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,GT;function cte(){if(GT)return rw;GT=1;var e=zo(),t=Bo(),n="[object Arguments]";function r(s){return t(s)&&e(s)==n}return rw=r,rw}var aw,YT;function o_(){if(YT)return aw;YT=1;var e=cte(),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,XT;function ute(){if(XT)return sw;XT=1;function e(){return!1}return sw=e,sw}Bd.exports;var QT;function P4(){return QT||(QT=1,(function(e,t){var n=Js(),r=ute(),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,JT;function i_(){if(JT)return ow;JT=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,ZT;function l_(){if(ZT)return iw;ZT=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return iw=t,iw}var lw,eO;function dte(){if(eO)return lw;eO=1;var e=zo(),t=l_(),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]",U={};U[N]=U[C]=U[k]=U[A]=U[E]=U[P]=U[O]=U[D]=U[K]=!0,U[r]=U[s]=U[b]=U[o]=U[S]=U[i]=U[c]=U[d]=U[f]=U[m]=U[p]=U[v]=U[x]=U[j]=U[y]=!1;function B(Y){return n(Y)&&t(Y.length)&&!!U[e(Y)]}return lw=B,lw}var cw,tO;function R4(){if(tO)return cw;tO=1;function e(t){return function(n){return t(n)}}return cw=e,cw}var qd={exports:{}};qd.exports;var nO;function fte(){return nO||(nO=1,(function(e,t){var n=QL(),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,rO;function T4(){if(rO)return uw;rO=1;var e=dte(),t=R4(),n=fte(),r=n&&n.isTypedArray,s=r?t(r):e;return uw=s,uw}var dw,aO;function pte(){if(aO)return dw;aO=1;var e=lte(),t=o_(),n=fa(),r=P4(),s=i_(),o=T4(),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,sO;function hte(){if(sO)return fw;sO=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,oO;function O4(){if(oO)return pw;oO=1;function e(t,n){return function(r){return t(n(r))}}return pw=e,pw}var hw,iO;function mte(){if(iO)return hw;iO=1;var e=O4(),t=e(Object.keys,Object);return hw=t,hw}var mw,lO;function gte(){if(lO)return mw;lO=1;var e=hte(),t=mte(),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,cO;function pp(){if(cO)return gw;cO=1;var e=VC(),t=l_();function n(r){return r!=null&&t(r.length)&&!e(r)}return gw=n,gw}var vw,uO;function yv(){if(uO)return vw;uO=1;var e=pte(),t=gte(),n=pp();function r(s){return n(s)?e(s):t(s)}return vw=r,vw}var xw,dO;function vte(){if(dO)return xw;dO=1;var e=ate(),t=ite(),n=yv();function r(s){return e(s,n,t)}return xw=r,xw}var yw,fO;function xte(){if(fO)return yw;fO=1;var e=vte(),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,pO;function yte(){if(pO)return bw;pO=1;var e=Ul(),t=Js(),n=e(t,"DataView");return bw=n,bw}var ww,hO;function bte(){if(hO)return ww;hO=1;var e=Ul(),t=Js(),n=e(t,"Promise");return ww=n,ww}var jw,mO;function M4(){if(mO)return jw;mO=1;var e=Ul(),t=Js(),n=e(t,"Set");return jw=n,jw}var Sw,gO;function wte(){if(gO)return Sw;gO=1;var e=Ul(),t=Js(),n=e(t,"WeakMap");return Sw=n,Sw}var Nw,vO;function jte(){if(vO)return Nw;vO=1;var e=yte(),t=GC(),n=bte(),r=M4(),s=wte(),o=zo(),i=JL(),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,xO;function Ste(){if(xO)return Cw;xO=1;var e=N4(),t=A4(),n=rte(),r=xte(),s=jte(),o=fa(),i=P4(),c=T4(),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,U=P==O;if(U&&i(y)){if(!i(b))return!1;A=!0,D=!1}if(U&&!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 U?(k||(k=new e),r(y,b,S,N,C,k)):!1}return Cw=j,Cw}var _w,yO;function c_(){if(yO)return _w;yO=1;var e=Ste(),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,bO;function Nte(){if(bO)return kw;bO=1;var e=N4(),t=c_(),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,wO;function I4(){if(wO)return Aw;wO=1;var e=Ri();function t(n){return n===n&&!e(n)}return Aw=t,Aw}var Ew,jO;function Cte(){if(jO)return Ew;jO=1;var e=I4(),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,SO;function $4(){if(SO)return Pw;SO=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,NO;function _te(){if(NO)return Rw;NO=1;var e=Nte(),t=Cte(),n=$4();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,CO;function kte(){if(CO)return Tw;CO=1;function e(t,n){return t!=null&&n in Object(t)}return Tw=e,Tw}var Ow,_O;function Ate(){if(_O)return Ow;_O=1;var e=t4(),t=o_(),n=fa(),r=i_(),s=l_(),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,kO;function Ete(){if(kO)return Mw;kO=1;var e=kte(),t=Ate();function n(r,s){return r!=null&&t(r,s,e)}return Mw=n,Mw}var Iw,AO;function Pte(){if(AO)return Iw;AO=1;var e=c_(),t=n4(),n=Ete(),r=HC(),s=I4(),o=$4(),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,EO;function Lu(){if(EO)return $w;EO=1;function e(t){return t}return $w=e,$w}var Dw,PO;function Rte(){if(PO)return Dw;PO=1;function e(t){return function(n){return n?.[t]}}return Dw=e,Dw}var Lw,RO;function Tte(){if(RO)return Lw;RO=1;var e=QC();function t(n){return function(r){return e(r,n)}}return Lw=t,Lw}var Fw,TO;function Ote(){if(TO)return Fw;TO=1;var e=Rte(),t=Tte(),n=HC(),r=hv();function s(o){return n(o)?e(r(o)):t(o)}return Fw=s,Fw}var zw,OO;function Zs(){if(OO)return zw;OO=1;var e=_te(),t=Pte(),n=Lu(),r=fa(),s=Ote();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,MO;function D4(){if(MO)return Bw;MO=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,IO;function Mte(){if(IO)return qw;IO=1;function e(t){return t!==t}return qw=e,qw}var Uw,$O;function Ite(){if($O)return Uw;$O=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,DO;function $te(){if(DO)return Ww;DO=1;var e=D4(),t=Mte(),n=Ite();function r(s,o,i){return o===o?n(s,o,i):e(s,t,i)}return Ww=r,Ww}var Hw,LO;function Dte(){if(LO)return Hw;LO=1;var e=$te();function t(n,r){var s=n==null?0:n.length;return!!s&&e(n,r,0)>-1}return Hw=t,Hw}var Vw,FO;function Lte(){if(FO)return Vw;FO=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,zO;function Fte(){if(zO)return Kw;zO=1;function e(){}return Kw=e,Kw}var Gw,BO;function zte(){if(BO)return Gw;BO=1;var e=M4(),t=Fte(),n=s_(),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,qO;function Bte(){if(qO)return Yw;qO=1;var e=C4(),t=Dte(),n=Lte(),r=k4(),s=zte(),o=s_(),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,UO;function qte(){if(UO)return Xw;UO=1;var e=Zs(),t=Bte();function n(r,s){return r&&r.length?t(r,e(s,2)):[]}return Xw=n,Xw}var Ute=qte();const WO=xn(Ute);function L4(e,t,n){return t===!0?WO(e,n):Vt(t)?WO(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 Wte=["ref"];function HO(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?HO(Object(n),!0).forEach(function(r){bv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):HO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Hte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VO(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,z4(r.key),r)}}function Vte(e,t,n){return t&&VO(e.prototype,t),n&&VO(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kte(e,t,n){return t=Tm(t),Gte(e,F4()?Reflect.construct(t,n||[],Tm(e).constructor):t.apply(e,n))}function Gte(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 Yte(e)}function Yte(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(F4=function(){return!!e})()}function Tm(e){return Tm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Tm(e)}function Xte(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&&_1(e,t)}function _1(e,t){return _1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},_1(e,t)}function bv(e,t,n){return t=z4(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z4(e){var t=Qte(e,"string");return tu(t)=="symbol"?t:t+""}function Qte(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 Jte(e,t){if(e==null)return{};var n=Zte(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 Zte(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 ene(e){return e.value}function tne(e,t){if(Q.isValidElement(e))return Q.cloneElement(e,t);if(typeof e=="function")return Q.createElement(e,t);t.ref;var n=Jte(t,Wte);return Q.createElement(a_,n)}var KO=1,gl=(function(e){function t(){var n;Hte(this,t);for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return n=Kte(this,t,[].concat(s)),bv(n,"lastBoundingBox",{width:-1,height:-1}),n}return Xte(t,e),Vte(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)>KO||Math.abs(s.height-this.lastBoundingBox.height)>KO)&&(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}},tne(o,ho(ho({},this.props),{},{payload:L4(m,f,ene)})))}}],[{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,GO;function nne(){if(GO)return Qw;GO=1;var e=dp(),t=o_(),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,YO;function B4(){if(YO)return Jw;YO=1;var e=E4(),t=nne();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,XO;function rne(){if(XO)return Zw;XO=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,QO;function ane(){if(QO)return ej;QO=1;var e=rne(),t=e();return ej=t,ej}var tj,JO;function q4(){if(JO)return tj;JO=1;var e=ane(),t=yv();function n(r,s){return r&&e(r,s,t)}return tj=n,tj}var nj,ZO;function sne(){if(ZO)return nj;ZO=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,e2;function u_(){if(e2)return rj;e2=1;var e=q4(),t=sne(),n=t(e);return rj=n,rj}var aj,t2;function U4(){if(t2)return aj;t2=1;var e=u_(),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,n2;function one(){if(n2)return sj;n2=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,r2;function ine(){if(r2)return oj;r2=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,a2;function lne(){if(a2)return ij;a2=1;var e=ine();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,s2;function cne(){if(s2)return lj;s2=1;var e=XC(),t=QC(),n=Zs(),r=U4(),s=one(),o=R4(),i=lne(),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,o2;function une(){if(o2)return cj;o2=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,i2;function dne(){if(i2)return uj;i2=1;var e=une(),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,l2;function fne(){if(l2)return dj;l2=1;function e(t){return function(){return t}}return dj=e,dj}var fj,c2;function W4(){if(c2)return fj;c2=1;var e=Ul(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return fj=t,fj}var pj,u2;function pne(){if(u2)return pj;u2=1;var e=fne(),t=W4(),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,d2;function hne(){if(d2)return hj;d2=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,f2;function mne(){if(f2)return mj;f2=1;var e=pne(),t=hne(),n=t(e);return mj=n,mj}var gj,p2;function gne(){if(p2)return gj;p2=1;var e=Lu(),t=dne(),n=mne();function r(s,o){return n(t(s,o,e),s+"")}return gj=r,gj}var vj,h2;function wv(){if(h2)return vj;h2=1;var e=KC(),t=pp(),n=i_(),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,m2;function vne(){if(m2)return xj;m2=1;var e=B4(),t=cne(),n=gne(),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 xne=vne();const d_=xn(xne);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 k1(){return k1=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},k1.apply(this,arguments)}function yne(e,t){return Sne(e)||jne(e,t)||wne(e,t)||bne()}function bne(){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 wne(e,t){if(e){if(typeof e=="string")return g2(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 g2(e,t)}}function g2(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 jne(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 Sne(e){if(Array.isArray(e))return e}function v2(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?v2(Object(n),!0).forEach(function(r){Nne(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nne(e,t,n){return t=Cne(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cne(e){var t=_ne(e,"string");return ff(t)=="symbol"?t:t+""}function _ne(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 kne(e){return Array.isArray(e)&&dr(e[0])&&dr(e[1])?e.join(" ~ "):e}var Ane=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?d_(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||kne,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=yne(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=!Kt(y),P=E?y:"",O=Gt("recharts-default-tooltip",x),D=Gt("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",k1({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=Ene(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ene(e){var t=Pne(e,"string");return pf(t)=="symbol"?t:t+""}function Pne(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",Rne={visibility:"hidden"};function Tne(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return Gt(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 x2(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 One(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 Mne(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=x2({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:s,reverseDirection:o,tooltipDimension:i.width,viewBox:d,viewBoxDimension:d.width}),p=x2({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:s,reverseDirection:o,tooltipDimension:i.height,viewBox:d,viewBoxDimension:d.height}),f=One({translateX:m,translateY:p,useTranslate3d:c})):f=Rne,{cssProperties:f,cssClasses:Tne({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 y2(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 b2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?y2(Object(n),!0).forEach(function(r){E1(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ine(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $ne(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,V4(r.key),r)}}function Dne(e,t,n){return t&&$ne(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lne(e,t,n){return t=Om(t),Fne(e,H4()?Reflect.construct(t,n||[],Om(e).constructor):t.apply(e,n))}function Fne(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 zne(e)}function zne(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function H4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(H4=function(){return!!e})()}function Om(e){return Om=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Om(e)}function Bne(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&&A1(e,t)}function A1(e,t){return A1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},A1(e,t)}function E1(e,t,n){return t=V4(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V4(e){var t=qne(e,"string");return nu(t)=="symbol"?t:t+""}function qne(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 w2=1,Une=(function(e){function t(){var n;Ine(this,t);for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return n=Lne(this,t,[].concat(s)),E1(n,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),E1(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 Bne(t,e),Dne(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();(Math.abs(r.width-this.state.lastBoundingBox.width)>w2||Math.abs(r.height-this.state.lastBoundingBox.height)>w2)&&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=Mne({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=b2(b2({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),Wne=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Wl={isSsr:Wne()};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 j2(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 S2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?j2(Object(n),!0).forEach(function(r){f_(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Hne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vne(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,G4(r.key),r)}}function Kne(e,t,n){return t&&Vne(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Gne(e,t,n){return t=Mm(t),Yne(e,K4()?Reflect.construct(t,n||[],Mm(e).constructor):t.apply(e,n))}function Yne(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 Xne(e)}function Xne(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(K4=function(){return!!e})()}function Mm(e){return Mm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Mm(e)}function Qne(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&&P1(e,t)}function P1(e,t){return P1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},P1(e,t)}function f_(e,t,n){return t=G4(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function G4(e){var t=Jne(e,"string");return ru(t)=="symbol"?t:t+""}function Jne(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 Zne(e){return e.dataKey}function ere(e,t){return Q.isValidElement(e)?Q.cloneElement(e,t):typeof e=="function"?Q.createElement(e,t):Q.createElement(Ane,t)}var aa=(function(e){function t(){return Hne(this,t),Gne(this,t,arguments)}return Qne(t,e),Kne(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=L4(j.filter(function(P){return P.value!=null&&(P.hide!==!0||r.props.includeHidden)}),y,Zne));var E=A.length>0;return Q.createElement(Une,{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},ere(f,S2(S2({},this.props),{},{payload:A})))}}])})(h.PureComponent);f_(aa,"displayName","Tooltip");f_(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,N2;function tre(){if(N2)return bj;N2=1;var e=Js(),t=function(){return e.Date.now()};return bj=t,bj}var wj,C2;function nre(){if(C2)return wj;C2=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,_2;function rre(){if(_2)return jj;_2=1;var e=nre(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return jj=n,jj}var Sj,k2;function Y4(){if(k2)return Sj;k2=1;var e=rre(),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,A2;function are(){if(A2)return Nj;A2=1;var e=Ri(),t=tre(),n=Y4(),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 U(){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=U,B}return Nj=i,Nj}var Cj,E2;function sre(){if(E2)return Cj;E2=1;var e=are(),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 ore=sre();const X4=xn(ore);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 P2(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?P2(Object(n),!0).forEach(function(r){ire(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ire(e,t,n){return t=lre(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lre(e){var t=cre(e,"string");return hf(t)=="symbol"?t:t+""}function cre(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 ure(e,t){return hre(e)||pre(e,t)||fre(e,t)||dre()}function dre(){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 fre(e,t){if(e){if(typeof e=="string")return R2(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 R2(e,t)}}function R2(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 pre(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 hre(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=ure(P,2),D=O[0],K=O[1],U=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;U(F,G),(X=E.current)===null||X===void 0||X.call(E,F,G)};y>0&&(Y=X4(Y,y,{trailing:!0,leading:!1}));var z=new ResizeObserver(Y),I=A.current.getBoundingClientRect(),T=I.width,V=I.height;return U(T,V),z.observe(A.current),function(){z.disconnect()}},[U,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:Gt("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 T2(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 R1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?T2(Object(n),!0).forEach(function(r){mre(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function mre(e,t,n){return t=gre(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gre(e){var t=vre(e,"string");return gf(t)=="symbol"?t:t+""}function vre(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},xre=2e3,yre={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},O2="recharts_measurement_span";function bre(e){var t=R1({},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=bre(n),s=JSON.stringify({text:t,copyStyle:r});if(Sc.widthCache[s])return Sc.widthCache[s];try{var o=document.getElementById(O2);o||(o=document.createElement("span"),o.setAttribute("id",O2),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var i=R1(R1({},yre),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>xre&&(Sc.cacheCount=0,Sc.widthCache={}),d}catch{return{width:0,height:0}}},wre=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 Cre(e)||Nre(e,t)||Sre(e,t)||jre()}function jre(){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 Sre(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 Nre(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 Cre(e){if(Array.isArray(e))return e}function _re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I2(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,Are(r.key),r)}}function kre(e,t,n){return t&&I2(e.prototype,t),n&&I2(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Are(e){var t=Ere(e,"string");return vf(t)=="symbol"?t:t+""}function Ere(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 $2=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,D2=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Pre=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Rre=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Q4={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},Tre=Object.keys(Q4),Ic="NaN";function Ore(e,t){return e*Q4[t]}var Uh=(function(){function e(t,n){_re(this,e),this.num=t,this.unit=n,this.num=t,this.unit=n,Number.isNaN(t)&&(this.unit=""),n!==""&&!Pre.test(n)&&(this.num=NaN,this.unit=""),Tre.includes(n)&&(this.num=Ore(t,n),this.unit="px")}return kre(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=Rre.exec(n))!==null&&r!==void 0?r:[],o=Im(s,3),i=o[1],c=o[2];return new e(parseFloat(i),c??"")}}])})();function J4(e){if(e.includes(Ic))return Ic;for(var t=e;t.includes("*")||t.includes("/");){var n,r=(n=$2.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($2,m.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var p,v=(p=D2.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(D2,C.toString())}return t}var L2=/\(([^()]*)\)/;function Mre(e){for(var t=e;t.includes("(");){var n=L2.exec(t),r=Im(n,2),s=r[1];t=t.replace(L2,J4(s))}return t}function Ire(e){var t=e.replace(/\s+/g,"");return t=Mre(t),t=J4(t),t}function $re(e){try{return Ire(e)}catch{return Ic}}function _j(e){var t=$re(e.slice(5,-1));return t===Ic?"":t}var Dre=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],Lre=["dx","dy","angle","className","breakAll"];function T1(){return T1=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},T1.apply(this,arguments)}function F2(e,t){if(e==null)return{};var n=Fre(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 Fre(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 z2(e,t){return Ure(e)||qre(e,t)||Bre(e,t)||zre()}function zre(){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 Bre(e,t){if(e){if(typeof e=="string")return B2(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 B2(e,t)}}function B2(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 qre(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 Ure(e){if(Array.isArray(e))return e}var Z4=/[ \f\n\r\t\v\u2028\u2029]+/,eF=function(t){var n=t.children,r=t.breakAll,s=t.style;try{var o=[];Kt(n)||(r?o=n.toString().split(""):o=n.toString().split(Z4));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}},Wre=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=eF({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=z2(P,2),D=O[0],K=O[1],U=b(A),B=z2(U,1),Y=B[0];if(!D&&!Y&&(S=A+1),D&&Y&&(N=A-1),!D&&Y){k=K;break}C++}return k||x},q2=function(t){var n=Kt(t)?[]:t.toString().split(Z4);return[{words:n}]},Hre=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=eF({breakAll:i,children:s,style:o});if(m){var p=m.wordsWithComputedWidth,v=m.spaceWidth;d=p,f=v}else return q2(s);return Wre({breakAll:i,children:s,maxLines:c,style:o},d,f,n,r)}return q2(s)},U2="#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?U2:b,N=F2(t,Dre),C=h.useMemo(function(){return Hre({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=F2(N,Lre);if(!dr(r)||!dr(o))return null;var K=r+(rt(k)?k:0),U=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(U,")")),Y.length&&(D.transform=Y.join(" ")),Q.createElement("text",T1({},It(D,!0),{x:K,y:U,className:Gt("recharts-text",P),textAnchor:x,fill:S.includes("url")?U2: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 Vre(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function p_(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===Vre?e:Kre,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 Kre(){return 0}function tF(e){return e===null?NaN:+e}function*Gre(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const Yre=p_(yi),hp=Yre.right;p_(tF).center;class W2 extends Map{constructor(t,n=Jre){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(H2(this,t))}has(t){return super.has(H2(this,t))}set(t,n){return super.set(Xre(this,t),n)}delete(t){return super.delete(Qre(this,t))}}function H2({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Xre({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Qre({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Jre(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Zre(e=yi){if(e===yi)return nF;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 nF(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const eae=Math.sqrt(50),tae=Math.sqrt(10),nae=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>=eae?10:o>=tae?5:o>=nae?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 O1(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 M1(e,t,n){return t=+t,e=+e,n=+n,$m(e,t,n)[2]}function I1(e,t,n){t=+t,e=+e,n=+n;const r=t<e,s=r?M1(t,e,n):M1(e,t,n);return(r?-1:1)*(s<0?1/-s:s)}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 K2(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function rF(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?nF:Zre(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));rF(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 rae(e,t,n){if(e=Float64Array.from(Gre(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return K2(e);if(t>=1)return V2(e);var r,s=(r-1)*t,o=Math.floor(s),i=V2(rF(e,o).subarray(0,o+1)),c=K2(e.subarray(o+1));return i+(c-i)*(s-o)}}function aae(e,t,n=tF){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 sae(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 $1=Symbol("implicit");function h_(){var e=new W2,t=[],n=[],r=$1;function s(o){let i=e.get(o);if(i===void 0){if(r!==$1)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 W2;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 h_(t,n).unknown(r)},os.apply(s,arguments),s}function xf(){var e=h_().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=sae(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 aF(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return aF(t())},e}function Xd(){return aF(xf.apply(null,arguments).paddingInner(1))}function m_(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function sF(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*",oae=/^#([0-9a-f]{3,8})$/,iae=new RegExp(`^rgb\\(${Hc},${Hc},${Hc}\\)$`),lae=new RegExp(`^rgb\\(${Ws},${Ws},${Ws}\\)$`),cae=new RegExp(`^rgba\\(${Hc},${Hc},${Hc},${bf}\\)$`),uae=new RegExp(`^rgba\\(${Ws},${Ws},${Ws},${bf}\\)$`),dae=new RegExp(`^hsl\\(${bf},${Ws},${Ws}\\)$`),fae=new RegExp(`^hsla\\(${bf},${Ws},${Ws},${bf}\\)$`),G2={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};m_(mp,wf,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Y2,formatHex:Y2,formatHex8:pae,formatHsl:hae,formatRgb:X2,toString:X2});function Y2(){return this.rgb().formatHex()}function pae(){return this.rgb().formatHex8()}function hae(){return oF(this).formatHsl()}function X2(){return this.rgb().formatRgb()}function wf(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=oae.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Q2(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=iae.exec(e))?new da(t[1],t[2],t[3],1):(t=lae.exec(e))?new da(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=cae.exec(e))?Wh(t[1],t[2],t[3],t[4]):(t=uae.exec(e))?Wh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=dae.exec(e))?eM(t[1],t[2]/100,t[3]/100,1):(t=fae.exec(e))?eM(t[1],t[2]/100,t[3]/100,t[4]):G2.hasOwnProperty(e)?Q2(G2[e]):e==="transparent"?new da(NaN,NaN,NaN,0):null}function Q2(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 mae(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 D1(e,t,n,r){return arguments.length===1?mae(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}m_(da,D1,sF(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:J2,formatHex:J2,formatHex8:gae,formatRgb:Z2,toString:Z2}));function J2(){return`#${dl(this.r)}${dl(this.g)}${dl(this.b)}`}function gae(){return`#${dl(this.r)}${dl(this.g)}${dl(this.b)}${dl((isNaN(this.opacity)?1:this.opacity)*255)}`}function Z2(){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 eM(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 oF(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 vae(e,t,n,r){return arguments.length===1?oF(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}m_(Ss,vae,sF(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(tM(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("}${tM(this.h)}, ${Hh(this.s)*100}%, ${Hh(this.l)*100}%${e===1?")":`, ${e})`}`}}));function tM(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 g_=e=>()=>e;function xae(e,t){return function(n){return e+n*t}}function yae(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 bae(e){return(e=+e)==1?iF:function(t,n){return n-t?yae(t,n,e):g_(isNaN(t)?n:t)}}function iF(e,t){var n=t-e;return n?xae(e,n):g_(isNaN(e)?t:e)}const nM=(function e(t){var n=bae(t);function r(s,o){var i=n((s=D1(s)).r,(o=D1(o)).r),c=n(s.g,o.g),d=n(s.b,o.b),f=iF(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 wae(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 jae(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Sae(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 Nae(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 Cae(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 L1=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Aj=new RegExp(L1.source,"g");function _ae(e){return function(){return e}}function kae(e){return function(t){return e(t)+""}}function Aae(e,t){var n=L1.lastIndex=Aj.lastIndex=0,r,s,o,i=-1,c=[],d=[];for(e=e+"",t=t+"";(r=L1.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]?kae(d[0].x):_ae(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"?g_(t):(n==="number"?Fm:n==="string"?(r=wf(t))?(t=r,nM):Aae:t instanceof wf?nM:t instanceof Date?Nae:jae(t)?wae:Array.isArray(t)?Sae:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Cae:Fm)(e,t)}function v_(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function Eae(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 Pae(e){return function(){return e}}function zm(e){return+e}var rM=[0,1];function Ur(e){return e}function F1(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Pae(isNaN(t)?NaN:.5)}function Rae(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Tae(e,t,n){var r=e[0],s=e[1],o=t[0],i=t[1];return s<r?(r=F1(s,r),o=n(i,o)):(r=F1(r,s),o=n(o,i)),function(c){return o(r(c))}}function Oae(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]=F1(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=rM,t=rM,n=Fu,r,s,o,i=Ur,c,d,f;function m(){var v=Math.min(e.length,t.length);return i!==Ur&&(i=Rae(e[0],e[v-1])),c=v>2?Oae:Tae,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=v_,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 x_(){return Sv()(Ur,Ur)}function Mae(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 Iae(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 $ae(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Dae=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function jf(e){if(!(t=Dae.exec(e)))throw new Error("invalid format: "+e);var t;return new y_({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=y_.prototype;function y_(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+""}y_.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 Lae(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 Fae(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 aM(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 sM={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Mae,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)=>aM(e*100,t),r:aM,s:Fae,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function oM(e){return e}var iM=Array.prototype.map,lM=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function zae(e){var t=e.grouping===void 0||e.thousands===void 0?oM:Iae(iM.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?oM:$ae(iM.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"):sM[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=sM[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 U(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=Lae(B)),H&&+B==0&&y!=="+"&&(H=!1),Y=(H?y==="("?y:c:y==="-"||y==="("?"":y)+Y,z=(E==="s"&&!isNaN(B)&&qm!==void 0?lM[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 U.toString=function(){return p+""},U}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:lM[8+x/3]});return function(b){return y(j*b)}}return{format:f,formatPrefix:m}}var Vh,b_,lF;Bae({thousands:",",grouping:[3],currency:["$",""]});function Bae(e){return Vh=zae(e),b_=Vh.format,lF=Vh.formatPrefix,Vh}function qae(e){return Math.max(0,-au(Math.abs(e)))}function Uae(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(au(t)/3)))*3-au(Math.abs(e)))}function Wae(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,au(t)-au(e))+1}function cF(e,t,n,r){var s=I1(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=Uae(s,i))&&(r.precision=o),lF(r,i)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=Wae(s,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=qae(s))&&(r.precision=o-(r.type==="%")*2);break}}return b_(r)}function Ti(e){var t=e.domain;return e.ticks=function(n){var r=t();return O1(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var s=t();return cF(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=M1(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=x_();return e.copy=function(){return gp(e,Um())},os.apply(e,arguments),Ti(e)}function uF(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 uF(e).unknown(t)},e=arguments.length?Array.from(e,zm):[0,1],Ti(n)}function dF(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 cM(e){return Math.log(e)}function uM(e){return Math.exp(e)}function Hae(e){return-Math.log(-e)}function Vae(e){return-Math.exp(-e)}function Kae(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Gae(e){return e===10?Kae:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Yae(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 dM(e){return(t,n)=>-e(-t,n)}function w_(e){const t=e(cM,uM),n=t.domain;let r=10,s,o;function i(){return s=Yae(r),o=Gae(r),n()[0]<0?(s=dM(s),o=dM(o),e(Hae,Vae)):e(cM,uM),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=O1(f,m,b))}else S=O1(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=b_(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(dF(n(),{floor:c=>o(Math.floor(s(c))),ceil:c=>o(Math.ceil(s(c)))})),t}function fF(){const e=w_(Sv()).domain([1,10]);return e.copy=()=>gp(e,fF()).base(e.base()),os.apply(e,arguments),e}function fM(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function pM(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function j_(e){var t=1,n=e(fM(t),pM(t));return n.constant=function(r){return arguments.length?e(fM(t=+r),pM(t)):t},Ti(n)}function pF(){var e=j_(Sv());return e.copy=function(){return gp(e,pF()).constant(e.constant())},os.apply(e,arguments)}function hM(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Xae(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Qae(e){return e<0?-e*e:e*e}function S_(e){var t=e(Ur,Ur),n=1;function r(){return n===1?e(Ur,Ur):n===.5?e(Xae,Qae):e(hM(n),hM(1/n))}return t.exponent=function(s){return arguments.length?(n=+s,r()):n},Ti(t)}function N_(){var e=S_(Sv());return e.copy=function(){return gp(e,N_()).exponent(e.exponent())},os.apply(e,arguments),e}function Jae(){return N_.apply(null,arguments).exponent(.5)}function mM(e){return Math.sign(e)*e*e}function Zae(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function hF(){var e=x_(),t=[0,1],n=!1,r;function s(o){var i=Zae(e(o));return isNaN(i)?r:n?Math.round(i):i}return s.invert=function(o){return e.invert(mM(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(mM)),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 hF(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},os.apply(s,arguments),Ti(s)}function mF(){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]=aae(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 mF().domain(e).range(t).unknown(r)},os.apply(o,arguments)}function gF(){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 gF().domain([e,t]).range(s).unknown(o)},os.apply(Ti(i),arguments)}function vF(){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 vF().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,C_=$o*7,gM=$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 __=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());__.range;const k_=hr(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ua)},(e,t)=>(t-e)/Ua,e=>e.getUTCMinutes());k_.range;const A_=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());A_.range;const E_=hr(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*wo)},(e,t)=>(t-e)/wo,e=>e.getUTCHours());E_.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 xF=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));xF.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)/C_)}const Cv=Hl(0),Hm=Hl(1),ese=Hl(2),tse=Hl(3),su=Hl(4),nse=Hl(5),rse=Hl(6);Cv.range;Hm.range;ese.range;tse.range;su.range;nse.range;rse.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)/C_)}const _v=Vl(0),Vm=Vl(1),ase=Vl(2),sse=Vl(3),ou=Vl(4),ose=Vl(5),ise=Vl(6);_v.range;Vm.range;ase.range;sse.range;ou.range;ose.range;ise.range;const P_=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());P_.range;const R_=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());R_.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 yF(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,C_],[t,1,gM],[t,3,3*gM],[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=p_(([,,b])=>b).right(i,v);if(x===i.length)return e.every(I1(f/Rj,m/Rj,p));if(x===0)return Wm.every(Math.max(I1(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[lse,cse]=yF(Lo,R_,_v,xF,E_,k_),[use,dse]=yF(Do,P_,Cv,vp,A_,__);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 fse(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:jM,e:jM,f:Ise,g:Hse,G:Kse,H:Tse,I:Ose,j:Mse,L:bF,m:$se,M:Dse,p:$,q:F,Q:CM,s:_M,S:Lse,u:Fse,U:zse,V:Bse,w:qse,W:Use,x:null,X:null,y:Wse,Y:Vse,Z:Gse,"%":NM},k={a:G,A:re,b:oe,B:ue,c:null,d:SM,e:SM,f:Jse,g:loe,G:uoe,H:Yse,I:Xse,j:Qse,L:jF,m:Zse,M:eoe,p:ae,q:ye,Q:CM,s:_M,S:toe,u:noe,U:roe,V:aoe,w:soe,W:ooe,x:null,X:null,y:ioe,Y:coe,Z:doe,"%":NM},A={a:K,A:U,b:B,B:Y,c:z,d:bM,e:bM,f:Ase,g:yM,G:xM,H:wM,I:wM,j:Nse,L:kse,m:Sse,M:Cse,p:D,q:jse,Q:Pse,s:Rse,S:_se,u:vse,U:xse,V:yse,w:gse,W:bse,x:I,X:T,y:yM,Y:xM,Z:wse,"%":Ese};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=vM[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 vM?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 U(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 vM={"-":"",_:" ",0:"0"},jr=/^\s*\d+/,pse=/^%/,hse=/[\\^$*+?|[\]().{}]/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 mse(e){return e.replace(hse,"\\$&")}function Td(e){return new RegExp("^(?:"+e.map(mse).join("|")+")","i")}function Od(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function gse(e,t,n){var r=jr.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function vse(e,t,n){var r=jr.exec(t.slice(n,n+1));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.U=+r[0],n+r[0].length):-1}function yse(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function bse(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function xM(e,t,n){var r=jr.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function yM(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 wse(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 jse(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 Sse(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 bM(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Nse(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 wM(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Cse(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function _se(e,t,n){var r=jr.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function kse(e,t,n){var r=jr.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Ase(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 Ese(e,t,n){var r=pse.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Pse(e,t,n){var r=jr.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Rse(e,t,n){var r=jr.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function jM(e,t){return dn(e.getDate(),t,2)}function Tse(e,t){return dn(e.getHours(),t,2)}function Ose(e,t){return dn(e.getHours()%12||12,t,2)}function Mse(e,t){return dn(1+vp.count(Do(e),e),t,3)}function bF(e,t){return dn(e.getMilliseconds(),t,3)}function Ise(e,t){return bF(e,t)+"000"}function $se(e,t){return dn(e.getMonth()+1,t,2)}function Dse(e,t){return dn(e.getMinutes(),t,2)}function Lse(e,t){return dn(e.getSeconds(),t,2)}function Fse(e){var t=e.getDay();return t===0?7:t}function zse(e,t){return dn(Cv.count(Do(e)-1,e),t,2)}function wF(e){var t=e.getDay();return t>=4||t===0?su(e):su.ceil(e)}function Bse(e,t){return e=wF(e),dn(su.count(Do(e),e)+(Do(e).getDay()===4),t,2)}function qse(e){return e.getDay()}function Use(e,t){return dn(Hm.count(Do(e)-1,e),t,2)}function Wse(e,t){return dn(e.getFullYear()%100,t,2)}function Hse(e,t){return e=wF(e),dn(e.getFullYear()%100,t,2)}function Vse(e,t){return dn(e.getFullYear()%1e4,t,4)}function Kse(e,t){var n=e.getDay();return e=n>=4||n===0?su(e):su.ceil(e),dn(e.getFullYear()%1e4,t,4)}function Gse(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+dn(t/60|0,"0",2)+dn(t%60,"0",2)}function SM(e,t){return dn(e.getUTCDate(),t,2)}function Yse(e,t){return dn(e.getUTCHours(),t,2)}function Xse(e,t){return dn(e.getUTCHours()%12||12,t,2)}function Qse(e,t){return dn(1+Nv.count(Lo(e),e),t,3)}function jF(e,t){return dn(e.getUTCMilliseconds(),t,3)}function Jse(e,t){return jF(e,t)+"000"}function Zse(e,t){return dn(e.getUTCMonth()+1,t,2)}function eoe(e,t){return dn(e.getUTCMinutes(),t,2)}function toe(e,t){return dn(e.getUTCSeconds(),t,2)}function noe(e){var t=e.getUTCDay();return t===0?7:t}function roe(e,t){return dn(_v.count(Lo(e)-1,e),t,2)}function SF(e){var t=e.getUTCDay();return t>=4||t===0?ou(e):ou.ceil(e)}function aoe(e,t){return e=SF(e),dn(ou.count(Lo(e),e)+(Lo(e).getUTCDay()===4),t,2)}function soe(e){return e.getUTCDay()}function ooe(e,t){return dn(Vm.count(Lo(e)-1,e),t,2)}function ioe(e,t){return dn(e.getUTCFullYear()%100,t,2)}function loe(e,t){return e=SF(e),dn(e.getUTCFullYear()%100,t,2)}function coe(e,t){return dn(e.getUTCFullYear()%1e4,t,4)}function uoe(e,t){var n=e.getUTCDay();return e=n>=4||n===0?ou(e):ou.ceil(e),dn(e.getUTCFullYear()%1e4,t,4)}function doe(){return"+0000"}function NM(){return"%"}function CM(e){return+e}function _M(e){return Math.floor(+e/1e3)}var Nc,NF,CF;foe({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 foe(e){return Nc=fse(e),NF=Nc.format,Nc.parse,CF=Nc.utcFormat,Nc.utcParse,Nc}function poe(e){return new Date(e)}function hoe(e){return e instanceof Date?+e:+new Date(+e)}function T_(e,t,n,r,s,o,i,c,d,f){var m=x_(),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,hoe)):v().map(poe)},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(dF(P,E)):m},m.copy=function(){return gp(m,T_(e,t,n,r,s,o,i,c,d,f))},m}function moe(){return os.apply(T_(use,dse,Do,P_,Cv,vp,A_,__,fl,NF).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function goe(){return os.apply(T_(lse,cse,Lo,R_,_v,Nv,E_,k_,fl,CF).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(v_),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 _F(){var e=Ti(kv()(Ur));return e.copy=function(){return Oi(e,_F())},qo.apply(e,arguments)}function kF(){var e=w_(kv()).domain([1,10]);return e.copy=function(){return Oi(e,kF()).base(e.base())},qo.apply(e,arguments)}function AF(){var e=j_(kv());return e.copy=function(){return Oi(e,AF()).constant(e.constant())},qo.apply(e,arguments)}function O_(){var e=S_(kv());return e.copy=function(){return Oi(e,O_()).exponent(e.exponent())},qo.apply(e,arguments)}function voe(){return O_.apply(null,arguments).exponent(.5)}function EF(){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)=>rae(e,o/r))},n.copy=function(){return EF(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=Eae(y,[S,N,C]),x):[f(0),f(.5),f(1)]}}return x.range=j(Fu),x.rangeRound=j(v_),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 PF(){var e=Ti(Av()(Ur));return e.copy=function(){return Oi(e,PF())},qo.apply(e,arguments)}function RF(){var e=w_(Av()).domain([.1,1,10]);return e.copy=function(){return Oi(e,RF()).base(e.base())},qo.apply(e,arguments)}function TF(){var e=j_(Av());return e.copy=function(){return Oi(e,TF()).constant(e.constant())},qo.apply(e,arguments)}function M_(){var e=S_(Av());return e.copy=function(){return Oi(e,M_()).exponent(e.exponent())},qo.apply(e,arguments)}function xoe(){return M_.apply(null,arguments).exponent(.5)}const kM=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:xf,scaleDiverging:PF,scaleDivergingLog:RF,scaleDivergingPow:M_,scaleDivergingSqrt:xoe,scaleDivergingSymlog:TF,scaleIdentity:uF,scaleImplicit:$1,scaleLinear:Um,scaleLog:fF,scaleOrdinal:h_,scalePoint:Xd,scalePow:N_,scaleQuantile:mF,scaleQuantize:gF,scaleRadial:hF,scaleSequential:_F,scaleSequentialLog:kF,scaleSequentialPow:O_,scaleSequentialQuantile:EF,scaleSequentialSqrt:voe,scaleSequentialSymlog:AF,scaleSqrt:Jae,scaleSymlog:pF,scaleThreshold:vF,scaleTime:moe,scaleUtc:goe,tickFormat:cF},Symbol.toStringTag,{value:"Module"}));var Mj,AM;function Ev(){if(AM)return Mj;AM=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,EM;function OF(){if(EM)return Ij;EM=1;function e(t,n){return t>n}return Ij=e,Ij}var $j,PM;function yoe(){if(PM)return $j;PM=1;var e=Ev(),t=OF(),n=Lu();function r(s){return s&&s.length?e(s,n,t):void 0}return $j=r,$j}var boe=yoe();const Pv=xn(boe);var Dj,RM;function MF(){if(RM)return Dj;RM=1;function e(t,n){return t<n}return Dj=e,Dj}var Lj,TM;function woe(){if(TM)return Lj;TM=1;var e=Ev(),t=MF(),n=Lu();function r(s){return s&&s.length?e(s,n,t):void 0}return Lj=r,Lj}var joe=woe();const Rv=xn(joe);var Fj,OM;function Soe(){if(OM)return Fj;OM=1;var e=XC(),t=Zs(),n=U4(),r=fa();function s(o,i){var c=r(o)?e:n;return c(o,t(i,3))}return Fj=s,Fj}var zj,MM;function Noe(){if(MM)return zj;MM=1;var e=B4(),t=Soe();function n(r,s){return e(t(r,s),1)}return zj=n,zj}var Coe=Noe();const _oe=xn(Coe);var Bj,IM;function koe(){if(IM)return Bj;IM=1;var e=c_();function t(n,r){return e(n,r)}return Bj=t,Bj}var Aoe=koe();const xp=xn(Aoe);var zu=1e9,Eoe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},$_,zn=!0,Xa="[DecimalError] ",xl=Xa+"Invalid argument: ",I_=Xa+"Exponent out of range: ",Bu=Math.floor,il=Math.pow,Poe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Sa,yr=1e7,Mn=7,IF=9007199254740991,Km=Bu(IF/Mn),gt={};gt.absoluteValue=gt.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};gt.comparedTo=gt.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};gt.decimalPlaces=gt.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};gt.dividedBy=gt.div=function(e){return No(this,new this.constructor(e))};gt.dividedToIntegerBy=gt.idiv=function(e){var t=this,n=t.constructor;return wn(No(t,new n(e),0,1),n.precision)};gt.equals=gt.eq=function(e){return!this.cmp(e)};gt.exponent=function(){return rr(this)};gt.greaterThan=gt.gt=function(e){return this.cmp(e)>0};gt.greaterThanOrEqualTo=gt.gte=function(e){return this.cmp(e)>=0};gt.isInteger=gt.isint=function(){return this.e>this.d.length-2};gt.isNegative=gt.isneg=function(){return this.s<0};gt.isPositive=gt.ispos=function(){return this.s>0};gt.isZero=function(){return this.s===0};gt.lessThan=gt.lt=function(e){return this.cmp(e)<0};gt.lessThanOrEqualTo=gt.lte=function(e){return this.cmp(e)<1};gt.logarithm=gt.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))};gt.minus=gt.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?LF(t,e):$F(t,(e.s=-e.s,e))};gt.modulo=gt.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)};gt.naturalExponential=gt.exp=function(){return DF(this)};gt.naturalLogarithm=gt.ln=function(){return Sf(this)};gt.negated=gt.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};gt.plus=gt.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?$F(t,e):LF(t,(e.s=-e.s,e))};gt.precision=gt.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};gt.squareRoot=gt.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)};gt.times=gt.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};gt.toDecimalPlaces=gt.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))};gt.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};gt.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)};gt.toInteger=gt.toint=function(){var e=this,t=e.constructor;return wn(new t(e),rr(e)+1,t.rounding)};gt.toNumber=function(){return+this};gt.toPower=gt.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)<=IF){for(s=new d(Sa),t=Math.ceil(r/Mn+4),zn=!1;n%2&&(s=s.times(c),DM(s.d,t)),n=Bu(n/2),n!==0;)c=c.times(c),DM(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=DF(s),s.s=o,s};gt.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};gt.toSignificantDigits=gt.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)};gt.toString=gt.valueOf=gt.val=gt.toJSON=gt[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 $F(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,U=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=U.length,x=new D(K),j=x.d=[],f=0;B[f]==(U[f]||0);)++f;if(B[f]>(U[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+(U[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),U=e(U,m),P=B.length,A=U.length),k=P,y=U.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++]=U[k]||0:(y=[U[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 DF(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(I_+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 $M(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(I_+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(I_+rr(e));return e}function LF(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 DM(e,t){if(e.length>t)return e.length=t,!0}function FF(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 $M(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,Poe.test(o))$M(i,o);else throw Error(xl+o)}if(s.prototype=gt,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=FF,s.config=s.set=Roe,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 Roe(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 $_=FF(Eoe);Sa=new $_(1);const bn=$_;function Toe(e){return $oe(e)||Ioe(e)||Moe(e)||Ooe()}function Ooe(){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 Moe(e,t){if(e){if(typeof e=="string")return z1(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 z1(e,t)}}function Ioe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function $oe(e){if(Array.isArray(e))return z1(e)}function z1(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 Doe=function(t){return t},zF={},BF=function(t){return t===zF},LM=function(t){return function n(){return arguments.length===0||arguments.length===1&&BF(arguments.length<=0?void 0:arguments[0])?n:t.apply(void 0,arguments)}},Loe=function e(t,n){return t===1?n:LM(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!==zF}).length;return i>=t?n.apply(void 0,s):e(t-i,LM(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 BF(p)?d.shift():p});return n.apply(void 0,Toe(m).concat(d))}))})},Tv=function(t){return Loe(t.length,t)},B1=function(t,n){for(var r=[],s=t;s<n;++s)r[s-t]=s;return r},Foe=Tv(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(n){return t[n]}).map(e)}),zoe=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(!n.length)return Doe;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))}},q1=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},qF=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 Boe(e){var t;return e===0?t=1:t=Math.floor(new bn(e).abs().log(10).toNumber())+1,t}function qoe(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 Uoe=Tv(function(e,t,n){var r=+e,s=+t;return r+n*(s-r)}),Woe=Tv(function(e,t,n){var r=t-+e;return r=r||1/0,(n-e)/r}),Hoe=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:qoe,getDigitCount:Boe,interpolateNumber:Uoe,uninterpolateNumber:Woe,uninterpolateTruncation:Hoe};function U1(e){return Goe(e)||Koe(e)||UF(e)||Voe()}function Voe(){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 Koe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Goe(e){if(Array.isArray(e))return W1(e)}function Nf(e,t){return Qoe(e)||Xoe(e,t)||UF(e,t)||Yoe()}function Yoe(){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 UF(e,t){if(e){if(typeof e=="string")return W1(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 W1(e,t)}}function W1(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 Xoe(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 Qoe(e){if(Array.isArray(e))return e}function WF(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 HF(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 Joe(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=zoe(Foe(function(d){return s.add(new bn(d-i).mul(r)).toNumber()}),B1);return c(0,t)}function VF(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=HF(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?VF(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 Zoe(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=WF([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(U1(B1(0,s-1).map(function(){return 1/0}))):[].concat(U1(B1(0,s-1).map(function(){return-1/0})),[m]);return n>r?q1(p):p}if(f===m)return Joe(f,s,o);var v=VF(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?q1(b):b}function eie(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=WF([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=HF(new bn(f).sub(d).div(m-1),o,0),v=[].concat(U1(Ov.rangeStep(new bn(d),new bn(f).sub(new bn(.99).mul(p)),p)),[f]);return r>s?q1(v):v}var tie=qF(Zoe),nie=qF(eie),rie="Invariant failed";function El(e,t){throw new Error(rie)}var aie=["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 sie(e,t){return cie(e)||lie(e,t)||iie(e,t)||oie()}function oie(){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 iie(e,t){if(e){if(typeof e=="string")return FM(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 FM(e,t)}}function FM(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 lie(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 cie(e){if(Array.isArray(e))return e}function uie(e,t){if(e==null)return{};var n=die(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 die(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 fie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pie(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,YF(r.key),r)}}function hie(e,t,n){return t&&pie(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mie(e,t,n){return t=Ym(t),gie(e,KF()?Reflect.construct(t,n||[],Ym(e).constructor):t.apply(e,n))}function gie(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 vie(e)}function vie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function KF(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(KF=function(){return!!e})()}function Ym(e){return Ym=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ym(e)}function xie(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&&H1(e,t)}function H1(e,t){return H1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},H1(e,t)}function GF(e,t,n){return t=YF(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function YF(e){var t=yie(e,"string");return iu(t)=="symbol"?t:t+""}function yie(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 fie(this,t),mie(this,t,arguments)}return xie(t,e),hie(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=uie(r,aie),x=It(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=sie(k,2);E=O[0],P=O[1]}else E=P=k;if(o==="vertical"){var D=m.scale,K=N+s,U=K+i,B=K-i,Y=D(C-E),z=D(C+P);A.push({x1:z,y1:U,x2:z,y2:B}),A.push({x1:Y,y1:K,x2:z,y2:K}),A.push({x1:Y,y1:U,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);GF(yp,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});GF(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 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 el(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){bie(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 bie(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=jie(e,"string");return Cf(t)=="symbol"?t:t+""}function jie(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 XF=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:D_(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 BM(e){return _ie(e)||Cie(e)||Nie(e)||Sie()}function Sie(){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 Nie(e,t){if(e){if(typeof e=="string")return V1(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 V1(e,t)}}function Cie(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _ie(e){if(Array.isArray(e))return V1(e)}function V1(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 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 Yn(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){Vc(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 Vc(e,t,n){return t=kie(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kie(e){var t=Aie(e,"string");return _f(t)=="symbol"?t:t+""}function Aie(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 Kt(e)||Kt(t)?n:dr(t)?_a(e,t,n):Vt(t)?t(e):n}function Qd(e,t,n,r){var s=_oe(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!Kt(c)}):s;return i.map(function(c){return dr(c)||c instanceof Date?c:""})}var Eie=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},D_=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},Pie=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=Kt(k)?n:k;i[A].push({item:S[0],stackList:S.slice(1),barSize:Kt(E)?void 0:qr(E,r,0)})}}return i},Rie=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(BM(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(BM(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},Tie=function(t,n,r,s){var o=r.children,i=r.width,c=r.margin,d=i-(c.left||0)-(c.right||0),f=XF({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},Oie=function(t,n,r){return Kt(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},QF=function(t,n,r,s,o){var i=n.props.children,c=ka(i,yp).filter(function(f){return Oie(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(Kt(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},Mie=function(t,n,r,s,o){var i=n.map(function(c){return QF(t,c,r,o,s)}).filter(function(c){return!Kt(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},JF=function(t,n,r,s,o){var i=n.map(function(d){var f=d.props.dataKey;return r==="number"&&f&&QF(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},[])},ZF=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},ez=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:(kM[d]||Xd)(),realScaleType:kM[d]?d:"point"}}return Vt(s)?{scale:s}:{scale:Xd(),realScaleType:"point"}},UM=1e-4,tz=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])-UM,i=Math.max(s[0],s[1])+UM,c=t(n[0]),d=t(n[r-1]);(c<o||c>i||d<o||d>i)&&t.domain([n[0],n[r-1]])}},Iie=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},$ie=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},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,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])}},Lie=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)}},Fie={sign:Die,expand:_ee,none:Zc,silhouette:kee,wiggle:Aee,positive:Lie},zie=function(t,n,r){var s=n.map(function(c){return c.props.dataKey}),o=Fie[r],i=Cee().keys(s).value(function(c,d){return+ur(c,d,0)}).order(j1).offset(o);return i(t)},Bie=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:zie(t,S.items,o)}))},j)}return Yn(Yn({},p),{},Vc({},v,x))},m)},nz=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=tie(f,o,c);return t.domain([Rv(m),Pv(m)]),{niceTicks:m}}if(o&&s==="number"){var p=t.domain(),v=nie(p,o,c);return{niceTicks:v}}return null};function WM(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&&!Kt(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,Kt(i)?t.dataKey:i);return Kt(d)?null:t.scale(d)}var HM=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 Kt(d)?null:n.scale(d)-o/2+s},qie=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]},Uie=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},Wie=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])},rz=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=Wie(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})},VM=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,KM=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,K1=function(t,n,r){if(Vt(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(VM.test(t[0])){var o=+VM.exec(t[0])[1];s[0]=n[0]-o}else Vt(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(KM.test(t[1])){var i=+KM.exec(t[1])[1];s[1]=n[1]+i}else Vt(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=d_(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},GM=function(t,n,r){return!t||!t.length||xp(t,_a(r,"type.defaultProps.domain"))?n:t},az=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({},It(t,!1)),{},{dataKey:s,unit:i,formatter:c,name:o||s,color:D_(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 YM(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?YM(Object(n),!0).forEach(function(r){sz(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):YM(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sz(e,t,n){return t=Hie(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hie(e){var t=Vie(e,"string");return kf(t)=="symbol"?t:t+""}function Vie(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 Kie(e,t){return Qie(e)||Xie(e,t)||Yie(e,t)||Gie()}function Gie(){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 Yie(e,t){if(e){if(typeof e=="string")return XM(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 XM(e,t)}}function XM(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 Xie(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 Qie(e){if(Array.isArray(e))return e}var Qm=Math.PI/180,Jie=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}},oz=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},Zie=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=oz(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(Kt(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=Kie(E,2);d=P[0],f=P[1]}var O=ez(N,o),D=O.realScaleType,K=O.scale;K.domain(C).range(A),tz(K);var U=nz(K,mo(mo({},N),{},{realScaleType:D})),B=mo(mo(mo({},N),U),{},{range:A,radius:j,realScaleType:D,scale:K,cx:m,cy:p,innerRadius:x,outerRadius:j,startAngle:d,endAngle:f});return mo(mo({},b),{},sz({},S,B))},{})},ele=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))},tle=function(t,n){var r=t.x,s=t.y,o=n.cx,i=n.cy,c=ele({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:Jie(f),angleInRadian:f}},nle=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}},rle=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},QM=function(t,n){var r=t.x,s=t.y,o=tle({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=nle(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:rle(x,n)}):null},iz=function(t){return!h.isValidElement(t)&&!Vt(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 ale=["offset"];function sle(e){return cle(e)||lle(e)||ile(e)||ole()}function ole(){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 ile(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 lle(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function cle(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 ule(e,t){if(e==null)return{};var n=dle(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 dle(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 JM(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?JM(Object(n),!0).forEach(function(r){fle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):JM(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function fle(e,t,n){return t=ple(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ple(e){var t=hle(e,"string");return Af(t)=="symbol"?t:t+""}function hle(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 mle=function(t){var n=t.value,r=t.formatter,s=Kt(t.children)?n:t.children;return Vt(r)?r(s):s},gle=function(t,n){var r=Br(n-t),s=Math.min(Math.abs(n-t),360);return r*s},vle=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=gle(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=Kt(t.id)?Du("recharts-radial-line-"):t.id;return Q.createElement("text",Ef({},r,{dominantBaseline:"central",className:Gt("recharts-radial-bar-label",c)}),Q.createElement("defs",null,Q.createElement("path",{id:O,d:P})),Q.createElement("textPath",{xlinkHref:"#".concat(O)},n))},xle=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"}},yle=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)},ble=function(t){return"cx"in t&&rt(t.cx)};function br(e){var t=e.offset,n=t===void 0?5:t,r=ule(e,ale),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||Kt(c)&&Kt(d)&&!h.isValidElement(f)&&!Vt(f))return null;if(h.isValidElement(f))return h.cloneElement(f,s);var x;if(Vt(f)){if(x=h.createElement(f,s),h.isValidElement(x))return x}else x=mle(s);var j=ble(o),y=It(s,!0);if(j&&(i==="insideStart"||i==="insideEnd"||i==="end"))return vle(s,x,y);var b=j?xle(s):yle(s);return Q.createElement(kl,Ef({className:Gt("recharts-label",p)},y,b,{breakAll:v}),x)}br.displayName="Label";var lz=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:{}},wle=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}):Vt(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},jle=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=lz(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=wle(t.label,n||o);return[c].concat(sle(i))};br.parseViewBox=lz;br.renderCallByParent=jle;var Wj,ZM;function Sle(){if(ZM)return Wj;ZM=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Wj=e,Wj}var Nle=Sle();const Cle=xn(Nle);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 _le=["valueAccessor"],kle=["data","dataKey","clockWise","id","textBreakAll"];function Ale(e){return Tle(e)||Rle(e)||Ple(e)||Ele()}function Ele(){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 Ple(e,t){if(e){if(typeof e=="string")return Y1(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 Y1(e,t)}}function Rle(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Tle(e){if(Array.isArray(e))return Y1(e)}function Y1(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 eI(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 tI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?eI(Object(n),!0).forEach(function(r){Ole(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ole(e,t,n){return t=Mle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mle(e){var t=Ile(e,"string");return Pf(t)=="symbol"?t:t+""}function Ile(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 nI(e,t){if(e==null)return{};var n=$le(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 $le(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 Dle=function(t){return Array.isArray(t.value)?Cle(t.value):t.value};function Co(e){var t=e.valueAccessor,n=t===void 0?Dle:t,r=nI(e,_le),s=r.data,o=r.dataKey,i=r.clockWise,c=r.id,d=r.textBreakAll,f=nI(r,kle);return!s||!s.length?null:Q.createElement(un,{className:"recharts-label-list"},s.map(function(m,p){var v=Kt(o)?n(m,p):ur(m&&m.payload,o),x=Kt(c)?{}:{id:"".concat(c,"-").concat(p)};return Q.createElement(br,Jm({},It(m,!0),f,x,{parentViewBox:m.parentViewBox,value:v,textBreakAll:d,viewBox:br.parseViewBox(Kt(i)?m:tI(tI({},m),{},{clockWise:i})),key:"label-".concat(p),index:p}))}))}Co.displayName="LabelList";function Lle(e,t){return e?e===!0?Q.createElement(Co,{key:"labelList-implicit",data:t}):Q.isValidElement(e)||Vt(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 Fle(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=Lle(e.label,t);return[o].concat(Ale(s))}Co.renderCallByParent=Fle;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 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 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 aI(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){zle(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 zle(e,t,n){return t=Ble(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ble(e){var t=qle(e,"string");return Rf(t)=="symbol"?t:t+""}function qle(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 Ule=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}},cz=function(t){var n=t.cx,r=t.cy,s=t.innerRadius,o=t.outerRadius,i=t.startAngle,c=t.endAngle,d=Ule(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},Wle=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
|
-
`):cz({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}),U=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(U.x,",").concat(U.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},Hle={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},uz=function(t){var n=aI(aI({},Hle),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=Gt("recharts-sector",v),j=i-o,y=qr(c,j,0,!0),b;return y>0&&Math.abs(m-p)<360?b=Wle({cx:r,cy:s,innerRadius:o,outerRadius:i,cornerRadius:Math.min(y,j/2),forceCornerRadius:d,cornerIsExternal:f,startAngle:m,endAngle:p}):b=cz({cx:r,cy:s,innerRadius:o,outerRadius:i,startAngle:m,endAngle:p}),Q.createElement("path",X1({},It(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 Q1(){return Q1=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},Q1.apply(this,arguments)}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 oI(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){Vle(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 Vle(e,t,n){return t=Kle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kle(e){var t=Gle(e,"string");return Tf(t)=="symbol"?t:t+""}function Gle(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 iI={curveBasisClosed:hee,curveBasisOpen:mee,curveBasis:pee,curveBumpX:ZZ,curveBumpY:eee,curveLinearClosed:gee,curveLinear:vv,curveMonotoneX:vee,curveMonotoneY:xee,curveNatural:yee,curveStep:bee,curveStepAfter:jee,curveStepBefore:wee},Yh=function(t){return t.x===+t.x&&t.y===+t.y},Md=function(t){return t.x},Id=function(t){return t.y},Yle=function(t,n){if(Vt(t))return t;var r="curve".concat(mv(t));return(r==="curveMonotone"||r==="curveBump")&&n?iI["".concat(r).concat(n==="vertical"?"Y":"X")]:iI[r]||vv},Xle=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=Yle(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 oI(oI({},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=u4().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?Xle(t):s;return h.createElement("path",Q1({},It(t,!1),Cm(t),{className:Gt("recharts-curve",n),d:i,ref:o}))},Hj={exports:{}},Vj,lI;function Qle(){if(lI)return Vj;lI=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Vj=e,Vj}var Kj,cI;function Jle(){if(cI)return Kj;cI=1;var e=Qle();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 uI;function Zle(){return uI||(uI=1,Hj.exports=Jle()()),Hj.exports}var ece=Zle();const mn=xn(ece),{getOwnPropertyNames:tce,getOwnPropertySymbols:nce}=Object,{hasOwnProperty:rce}=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 ace(e){return e?.[Symbol.toStringTag]}function dI(e){return tce(e).concat(nce(e))}const sce=Object.hasOwn||((e,t)=>rce.call(e,t));function Kl(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const oce="__v",ice="__o",lce="_owner",{getOwnPropertyDescriptor:fI,keys:pI}=Object;function cce(e,t){return e.byteLength===t.byteLength&&eg(new Uint8Array(e),new Uint8Array(t))}function uce(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 dce(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 fce(e,t){return Kl(e.getTime(),t.getTime())}function pce(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function hce(e,t){return e===t}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.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 mce=Kl;function gce(e,t,n){const r=pI(e);let s=r.length;if(pI(t).length!==s)return!1;for(;s-- >0;)if(!dz(e,t,n,r[s]))return!1;return!0}function $d(e,t,n){const r=dI(e);let s=r.length;if(dI(t).length!==s)return!1;let o,i,c;for(;s-- >0;)if(o=r[s],!dz(e,t,n,o)||(i=fI(e,o),c=fI(t,o),(i||c)&&(!i||!c||i.configurable!==c.configurable||i.enumerable!==c.enumerable||i.writable!==c.writable)))return!1;return!0}function vce(e,t){return Kl(e.valueOf(),t.valueOf())}function xce(e,t){return e.source===t.source&&e.flags===t.flags}function mI(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 yce(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 dz(e,t,n,r){return(r===lce||r===ice||r===oce)&&(e.$$typeof||t.$$typeof)?!0:sce(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const bce="[object ArrayBuffer]",wce="[object Arguments]",jce="[object Boolean]",Sce="[object DataView]",Nce="[object Date]",Cce="[object Error]",_ce="[object Map]",kce="[object Number]",Ace="[object Object]",Ece="[object RegExp]",Pce="[object Set]",Rce="[object String]",Tce={"[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},Oce="[object URL]",Mce=Object.prototype.toString;function Ice({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=Mce.call(b);if(A===Nce)return r(b,S,N);if(A===Ece)return m(b,S,N);if(A===_ce)return i(b,S,N);if(A===Pce)return p(b,S,N);if(A===Ace)return typeof b.then!="function"&&typeof S.then!="function"&&d(b,S,N);if(A===Oce)return x(b,S,N);if(A===Cce)return s(b,S,N);if(A===wce)return d(b,S,N);if(Tce[A])return v(b,S,N);if(A===bce)return e(b,S,N);if(A===Sce)return n(b,S,N);if(A===jce||A===kce||A===Rce)return f(b,S,N);if(j){let E=j[A];if(!E){const P=ace(b);P&&(E=j[P])}if(E)return E(b,S,N)}return!1}}function $ce({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:cce,areArraysEqual:n?$d:uce,areDataViewsEqual:dce,areDatesEqual:fce,areErrorsEqual:pce,areFunctionsEqual:hce,areMapsEqual:n?Gj(hI,$d):hI,areNumbersEqual:mce,areObjectsEqual:n?$d:gce,arePrimitiveWrappersEqual:vce,areRegExpsEqual:xce,areSetsEqual:n?Gj(mI,$d):mI,areTypedArraysEqual:n?Gj(eg,$d):eg,areUrlsEqual:yce,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 Dce(e){return function(t,n,r,s,o,i,c){return e(t,n,c)}}function Lce({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 Fce=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=$ce(e),i=Ice(o),c=n?n(i):Dce(i);return Lce({circular:t,comparator:i,createState:r,equals:c,strict:s})}function zce(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function gI(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):zce(s)};requestAnimationFrame(r)}function J1(e){"@babel/helpers - typeof";return J1=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},J1(e)}function Bce(e){return Hce(e)||Wce(e)||Uce(e)||qce()}function qce(){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 Uce(e,t){if(e){if(typeof e=="string")return vI(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 vI(e,t)}}function vI(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 Wce(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Hce(e){if(Array.isArray(e))return e}function Vce(){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=Bce(i),d=c[0],f=c.slice(1);if(typeof d=="number"){gI(s.bind(null,f),d);return}s(d),gI(s.bind(null,f));return}J1(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 xI(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 yI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xI(Object(n),!0).forEach(function(r){fz(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function fz(e,t,n){return t=Kce(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kce(e){var t=Gce(e,"string");return Of(t)==="symbol"?t:String(t)}function Gce(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 Yce=function(t,n){return[Object.keys(t),Object.keys(n)].reduce(function(r,s){return r.filter(function(o){return s.includes(o)})})},Xce=function(t){return t},Qce=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 yI(yI({},r),{},fz({},s,t(s,n[s])))},{})},bI=function(t,n,r){return t.map(function(s){return"".concat(Qce(s)," ").concat(n,"ms ").concat(r)}).join(",")};function Jce(e,t){return tue(e)||eue(e,t)||pz(e,t)||Zce()}function Zce(){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 eue(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 tue(e){if(Array.isArray(e))return e}function nue(e){return sue(e)||aue(e)||pz(e)||rue()}function rue(){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 pz(e,t){if(e){if(typeof e=="string")return Z1(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 Z1(e,t)}}function aue(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function sue(e){if(Array.isArray(e))return Z1(e)}function Z1(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,hz=function(t,n){return[0,3*t,3*n-6*t,3*t-3*n+1]},mz=function(t,n){return t.map(function(r,s){return r*Math.pow(n,s)}).reduce(function(r,s){return r+s})},wI=function(t,n){return function(r){var s=hz(t,n);return mz(s,r)}},oue=function(t,n){return function(r){var s=hz(t,n),o=[].concat(nue(s.map(function(i,c){return i*c}).slice(1)),[0]);return mz(o,r)}},jI=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=Jce(f,4);s=m[0],o=m[1],i=m[2],c=m[3]}}}var p=wI(s,i),v=wI(o,c),x=oue(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},iue=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},lue=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 jI(s);case"spring":return iue();default:if(s.split("(")[0]==="cubic-bezier")return jI(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 SI(e){return due(e)||uue(e)||gz(e)||cue()}function cue(){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 uue(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function due(e){if(Array.isArray(e))return tN(e)}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 Cr(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){eN(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 eN(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=pue(e,"string");return Mf(t)==="symbol"?t:String(t)}function pue(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 hue(e,t){return vue(e)||gue(e,t)||gz(e,t)||mue()}function mue(){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 gz(e,t){if(e){if(typeof e=="string")return tN(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 tN(e,t)}}function tN(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 gue(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 vue(e){if(Array.isArray(e))return e}var ng=function(t,n,r){return t+(n-t)*r},nN=function(t){var n=t.from,r=t.to;return n!==r},xue=function e(t,n,r){var s=Jd(function(o,i){if(nN(i)){var c=t(i.from,i.to,i.velocity),d=hue(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 nN(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 yue=(function(e,t,n,r,s){var o=Yce(e,t),i=o.reduce(function(b,S){return Cr(Cr({},b),{},eN({},S,[e[S],t[S]]))},{}),c=o.reduce(function(b,S){return Cr(Cr({},b),{},eN({},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(nN).length},j=function(S){f||(f=S);var N=S-f,C=N/n.dt;c=xue(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,SI(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,SI(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 bue=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function wue(e,t){if(e==null)return{};var n=jue(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 jue(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 _ue(e)||Cue(e)||Nue(e)||Sue()}function Sue(){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 Nue(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 Cue(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _ue(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 CI(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?CI(Object(n),!0).forEach(function(r){Ud(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ud(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 kue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Aue(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 Eue(e,t,n){return t&&Aue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function vz(e){var t=Pue(e,"string");return lu(t)==="symbol"?t:String(t)}function Pue(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 Rue(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&&aN(e,t)}function aN(e,t){return aN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},aN(e,t)}function Tue(e){var t=Oue();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 sN(this,s)}}function sN(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 oN(e)}function oN(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Oue(){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){Rue(n,e);var t=Tue(n);function n(r,s){var o;kue(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(oN(o)),o.changeStyle=o.changeStyle.bind(oN(o)),!c||x<=0)return o.state={style:{}},typeof v=="function"&&(o.state={style:m}),sN(o);if(p&&p.length)o.state={style:p[0].style};else if(f){if(typeof v=="function")return o.state={style:f},sN(o);o.state={style:d?Ud({},d,f):f}}else o.state={style:{}};return o}return Eue(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(!(Fce(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=yue(i,c,lue(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=bI(D,N,k),U=gs(gs(gs({},O.style),A),{},{transition:K});return[].concat(Yj(y),[U,N,P]).filter(Xce)};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=Vce());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=bI(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=wue(s,bue),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 Mue(e,t){return Lue(e)||Due(e,t)||$ue(e,t)||Iue()}function Iue(){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 $ue(e,t){if(e){if(typeof e=="string")return _I(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 _I(e,t)}}function _I(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 Due(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 Lue(e){if(Array.isArray(e))return e}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 AI(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){Fue(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 Fue(e,t,n){return t=zue(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zue(e){var t=Bue(e,"string");return If(t)=="symbol"?t:t+""}function Bue(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 EI=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},que=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},Uue={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},L_=function(t){var n=AI(AI({},Uue),t),r=h.useRef(),s=h.useState(-1),o=Mue(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=Gt("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({},It(n,!0),{className:C,d:EI(P,O,A,E,v),ref:r})))}):Q.createElement("path",ag({},It(n,!0),{className:C,d:EI(d,f,m,p,v)}))},Wue=["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 Hue(e,t){if(e==null)return{};var n=Vue(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 Vue(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 PI(e){return Xue(e)||Yue(e)||Gue(e)||Kue()}function Kue(){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 Gue(e,t){if(e){if(typeof e=="string")return iN(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 iN(e,t)}}function Yue(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Xue(e){if(Array.isArray(e))return iN(e)}function iN(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 RI=function(t){return t&&t.x===+t.x&&t.y===+t.y},Que=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(r){RI(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),RI(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=Que(t);n&&(r=[r.reduce(function(o,i){return[].concat(PI(o),PI(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},Jue=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))},Zue=function(t){var n=t.points,r=t.className,s=t.baseLinePoints,o=t.connectNulls,i=Hue(t,Wue);if(!n||!n.length)return null;var c=Gt("recharts-polygon",r);if(s&&s.length){var d=i.stroke&&i.stroke!=="none",f=Jue(n,s,o);return Q.createElement("g",{className:c},Q.createElement("path",$c({},It(i,!0),{fill:f.slice(-1)==="Z"?i.fill:"none",stroke:"none",d:f})),d?Q.createElement("path",$c({},It(i,!0),{fill:"none",d:Zd(n,o)})):null,d?Q.createElement("path",$c({},It(i,!0),{fill:"none",d:Zd(s,o)})):null)}var m=Zd(n,o);return Q.createElement("path",$c({},It(i,!0),{fill:m.slice(-1)==="Z"?i.fill:"none",className:c,d:m}))};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)}var Mv=function(t){var n=t.cx,r=t.cy,s=t.r,o=t.className,i=Gt("recharts-dot",o);return n===+n&&r===+r&&s===+s?h.createElement("circle",lN({},It(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 ede=["x","y","top","left","width","height","className"];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 TI(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 tde(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?TI(Object(n),!0).forEach(function(r){nde(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):TI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nde(e,t,n){return t=rde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rde(e){var t=ade(e,"string");return $f(t)=="symbol"?t:t+""}function ade(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 sde(e,t){if(e==null)return{};var n=ode(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 ode(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 ide=function(t,n,r,s,o,i){return"M".concat(t,",").concat(o,"v").concat(s,"M").concat(i,",").concat(n,"h").concat(r)},lde=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=sde(t,ede),b=tde({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",cN({},It(b,!0),{className:Gt("recharts-cross",j),d:ide(r,o,p,x,c,f)}))},Xj,OI;function cde(){if(OI)return Xj;OI=1;var e=Ev(),t=OF(),n=Zs();function r(s,o){return s&&s.length?e(s,n(o,2),t):void 0}return Xj=r,Xj}var ude=cde();const dde=xn(ude);var Qj,MI;function fde(){if(MI)return Qj;MI=1;var e=Ev(),t=Zs(),n=MF();function r(s,o){return s&&s.length?e(s,t(o,2),n):void 0}return Qj=r,Qj}var pde=fde();const hde=xn(pde);var mde=["cx","cy","angle","ticks","axisLine"],gde=["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 II(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?II(Object(n),!0).forEach(function(r){Iv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):II(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function $I(e,t){if(e==null)return{};var n=vde(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 vde(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 xde(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function DI(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,yz(r.key),r)}}function yde(e,t,n){return t&&DI(e.prototype,t),n&&DI(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function bde(e,t,n){return t=sg(t),wde(e,xz()?Reflect.construct(t,n||[],sg(e).constructor):t.apply(e,n))}function wde(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 jde(e)}function jde(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xz=function(){return!!e})()}function sg(e){return sg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},sg(e)}function Sde(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 Iv(e,t,n){return t=yz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yz(e){var t=Nde(e,"string");return cu(t)=="symbol"?t:t+""}function Nde(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 xde(this,t),bde(this,t,arguments)}return Sde(t,e),yde(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=dde(c,function(m){return m.coordinate||0}),f=hde(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=$I(r,mde),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({},It(f,!1)),{},{fill:"none"},It(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=$I(s,gde),p=this.getTickTextAnchor(),v=It(m,!1),x=It(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:Gt("recharts-polar-radius-axis-tick",iz(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:Gt("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):Vt(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 LI(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?LI(Object(n),!0).forEach(function(r){Dv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Cde(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FI(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,wz(r.key),r)}}function _de(e,t,n){return t&&FI(e.prototype,t),n&&FI(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function kde(e,t,n){return t=og(t),Ade(e,bz()?Reflect.construct(t,n||[],og(e).constructor):t.apply(e,n))}function Ade(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 Ede(e)}function Ede(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bz=function(){return!!e})()}function og(e){return og=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},og(e)}function Pde(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 Dv(e,t,n){return t=wz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wz(e){var t=Rde(e,"string");return uu(t)=="symbol"?t:t+""}function Rde(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 Tde=Math.PI/180,zI=1e-5,Lv=(function(e){function t(){return Cde(this,t),kde(this,t,arguments)}return Pde(t,e),_de(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*Tde),i;return o>zI?i=s==="outer"?"start":"end":o<-zI?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({},It(this.props,!1)),{},{fill:"none"},It(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(Zue,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=It(this.props,!1),p=It(i,!1),v=nl(nl({},m),{},{fill:"none"},It(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:Gt("recharts-polar-angle-axis-tick",iz(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:Gt("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):Vt(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,BI;function Ode(){if(BI)return Jj;BI=1;var e=O4(),t=e(Object.getPrototypeOf,Object);return Jj=t,Jj}var Zj,qI;function Mde(){if(qI)return Zj;qI=1;var e=zo(),t=Ode(),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 Ide=Mde();const $de=xn(Ide);var eS,UI;function Dde(){if(UI)return eS;UI=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 Lde=Dde();const Fde=xn(Lde);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 zde(e,t){return Wde(e)||Ude(e,t)||qde(e,t)||Bde()}function Bde(){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 qde(e,t){if(e){if(typeof e=="string")return WI(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 WI(e,t)}}function WI(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 Ude(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 Wde(e){if(Array.isArray(e))return e}function HI(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 VI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?HI(Object(n),!0).forEach(function(r){Hde(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):HI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Hde(e,t,n){return t=Vde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vde(e){var t=Kde(e,"string");return Df(t)=="symbol"?t:t+""}function Kde(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 KI=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},Gde={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Yde=function(t){var n=VI(VI({},Gde),t),r=h.useRef(),s=h.useState(-1),o=zde(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=Gt("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({},It(n,!0),{className:N,d:KI(P,O,k,A,E),ref:r})))}):Q.createElement("g",null,Q.createElement("path",ig({},It(n,!0),{className:N,d:KI(d,f,m,p,v)})))},Xde=["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 Qde(e,t){if(e==null)return{};var n=Jde(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 Jde(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 GI(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?GI(Object(n),!0).forEach(function(r){Zde(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Zde(e,t,n){return t=efe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function efe(e){var t=tfe(e,"string");return Lf(t)=="symbol"?t:t+""}function tfe(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 nfe(e,t){return lg(lg({},t),e)}function rfe(e,t){return e==="symbols"}function YI(e){var t=e.shapeType,n=e.elementProps;switch(t){case"rectangle":return Q.createElement(L_,n);case"trapezoid":return Q.createElement(Yde,n);case"sector":return Q.createElement(uz,n);case"symbols":if(rfe(t))return Q.createElement(r_,n);break;default:return null}}function afe(e){return h.isValidElement(e)?e.props:e}function jz(e){var t=e.option,n=e.shapeType,r=e.propTransformer,s=r===void 0?nfe:r,o=e.activeClassName,i=o===void 0?"recharts-active-shape":o,c=e.isActive,d=Qde(e,Xde),f;if(h.isValidElement(t))f=h.cloneElement(t,lg(lg({},d),afe(t)));else if(Vt(t))f=t(d);else if($de(t)&&!Fde(t)){var m=s(t,d);f=Q.createElement(YI,{shapeType:n,elementProps:m})}else{var p=d;f=Q.createElement(YI,{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 sfe(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 ofe(e,t){var n=e.endAngle===t.endAngle,r=e.startAngle===t.startAngle;return n&&r}function ife(e,t){var n=e.x===t.x,r=e.y===t.y,s=e.z===t.z;return n&&r&&s}function lfe(e,t){var n;return Fv(e,t)?n=sfe:zv(e,t)?n=ofe:Ff(e,t)&&(n=ife),n}function cfe(e,t){var n;return Fv(e,t)?n="trapezoids":zv(e,t)?n="sectors":Ff(e,t)&&(n="points"),n}function ufe(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 dfe(e){var t=e.activeTooltipItem,n=e.graphicalItem,r=e.itemData,s=cfe(n,t),o=ufe(n,t),i=r.filter(function(d,f){var m=xp(o,d),p=n.props[s].filter(function(j){var y=lfe(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 XI(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?XI(Object(n),!0).forEach(function(r){qa(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XI(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ffe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function QI(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,Nz(r.key),r)}}function pfe(e,t,n){return t&&QI(e.prototype,t),n&&QI(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function hfe(e,t,n){return t=cg(t),mfe(e,Sz()?Reflect.construct(t,n||[],cg(e).constructor):t.apply(e,n))}function mfe(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 gfe(e)}function gfe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Sz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Sz=function(){return!!e})()}function cg(e){return cg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},cg(e)}function vfe(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 qa(e,t,n){return t=Nz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nz(e){var t=xfe(e,"string");return du(t)=="symbol"?t:t+""}function xfe(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 ffe(this,t),r=hfe(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}),Vt(s)&&s()}),qa(r,"handleAnimationStart",function(){var s=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),Vt(s)&&s()}),r.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},r}return vfe(t,e),pfe(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=It(this.props,!1),p=It(i,!1),v=It(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 Kt(d)&&Kt(f)?A="value":Kt(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(jz,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,U=ja(0,D-K),B=U(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=Gt("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(Vt(r))return r(s);var i=Gt("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(Vt(r)&&(i=r(s),Q.isValidElement(i)))return i;var c=Gt("recharts-pie-label-text",typeof r!="boolean"&&!Vt(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=It(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=oz(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;Kt(f)&&Kt(p)?(So(!1,`Use "dataKey" to specify the value of pie,
|
|
117
|
-
the props "valueKey" will be deprecated in 1.1.0`),S="value"):Kt(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),U=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:U,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:U,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,JI;function yfe(){if(JI)return tS;JI=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,ZI;function Cz(){if(ZI)return nS;ZI=1;var e=Y4(),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,e$;function bfe(){if(e$)return rS;e$=1;var e=yfe(),t=wv(),n=Cz();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,t$;function wfe(){if(t$)return aS;t$=1;var e=bfe(),t=e();return aS=t,aS}var jfe=wfe();const ug=xn(jfe);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 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 r$(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){_z(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 _z(e,t,n){return t=Sfe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sfe(e){var t=Nfe(e,"string");return zf(t)=="symbol"?t:t+""}function Nfe(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 Cfe=["Webkit","Moz","O","ms"],_fe=function(t,n){var r=t.replace(/(\w)/,function(o){return o.toUpperCase()}),s=Cfe.reduce(function(o,i){return r$(r$({},o),{},_z({},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 a$(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?a$(Object(n),!0).forEach(function(r){ya(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function kfe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s$(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,Az(r.key),r)}}function Afe(e,t,n){return t&&s$(e.prototype,t),n&&s$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Efe(e,t,n){return t=fg(t),Pfe(e,kz()?Reflect.construct(t,n||[],fg(e).constructor):t.apply(e,n))}function Pfe(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 Rfe(e)}function Rfe(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 fg(e){return fg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},fg(e)}function Tfe(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 ya(e,t,n){return t=Az(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Az(e){var t=Ofe(e,"string");return fu(t)=="symbol"?t:t+""}function Ofe(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 Mfe=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}},o$=function(t){return t.changedTouches&&!!t.changedTouches.length},pu=(function(e){function t(n){var r;return kfe(this,t),r=Efe(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=o$(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 Tfe(t,e),Afe(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 Vt(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=o$(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({},It(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=Gt("recharts-brush",o),k=Q.Children.count(i)===1,A=_fe("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):Vt(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?Mfe({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,i$;function Ife(){if(i$)return oS;i$=1;var e=u_();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,l$;function $fe(){if(l$)return iS;l$=1;var e=_4(),t=Zs(),n=Ife(),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 Dfe=$fe();const Lfe=xn(Dfe);var Hs=function(t,n){var r=t.alwaysShow,s=t.ifOverflow;return r&&(s="extendDomain"),s===n},lS,c$;function Ffe(){if(c$)return lS;c$=1;var e=W4();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,u$;function zfe(){if(u$)return cS;u$=1;var e=Ffe(),t=q4(),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 Bfe=zfe();const qfe=xn(Bfe);var uS,d$;function Ufe(){if(d$)return uS;d$=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,f$;function Wfe(){if(f$)return dS;f$=1;var e=u_();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,p$;function Hfe(){if(p$)return fS;p$=1;var e=Ufe(),t=Wfe(),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 Vfe=Hfe();const Kfe=xn(Vfe);var Gfe=["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 hN(){return hN=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},hN.apply(this,arguments)}function h$(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?h$(Object(n),!0).forEach(function(r){Yfe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Yfe(e,t,n){return t=Xfe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xfe(e){var t=Qfe(e,"string");return Bf(t)=="symbol"?t:t+""}function Qfe(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 Jfe(e,t){if(e==null)return{};var n=Zfe(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 Zfe(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 epe(e,t){var n=e.x,r=e.y,s=Jfe(e,Gfe),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 m$(e){return Q.createElement(jz,hN({shapeType:"rectangle",propTransformer:epe,activeClassName:"recharts-active-bar"},e))}var tpe=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)||bZ(r);return o?t(r,s):(o||El(),n)}},npe=["value","background"],Ez;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 rpe(e,t){if(e==null)return{};var n=ape(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 ape(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 g$(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?g$(Object(n),!0).forEach(function(r){xi(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function spe(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 ope(e,t,n){return t&&v$(e.prototype,t),n&&v$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ipe(e,t,n){return t=hg(t),lpe(e,Pz()?Reflect.construct(t,n||[],hg(e).constructor):t.apply(e,n))}function lpe(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 cpe(e)}function cpe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Pz=function(){return!!e})()}function hg(e){return hg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},hg(e)}function upe(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 xi(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=dpe(e,"string");return hu(t)=="symbol"?t:t+""}function dpe(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;spe(this,t);for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return n=ipe(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 upe(t,e),ope(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=It(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(m$,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=It(this.props.background,!1);return o.map(function(f,m){f.value;var p=f.background,v=rpe(f,npe);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(m$,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=Gt("recharts-bar",i),N=c&&c.allowDataOverflow,C=d&&d.allowDataOverflow,k=N||C,A=Kt(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);Ez=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=Iie(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=qie({numericAxis:k}),P=ka(N,jv),O=p.map(function(D,K){var U,B,Y,z,I,T;f?U=$ie(f[m+K],A):(U=ur(D,S),Array.isArray(U)||(U=[E,U]));var V=tpe(C,Ez.defaultProps.minPointSize)(U[1],K);if(j==="horizontal"){var H,M=[i.scale(U[0]),i.scale(U[1])],X=M[0],$=M[1];B=HM({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(U[0]),o.scale(U[1])],oe=re[0],ue=re[1];if(B=oe,Y=HM({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?U:U[1],payload:D,background:T},P&&P[K]&&P[K].props),{},{tooltipPayload:[az(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 fpe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x$(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,Tz(r.key),r)}}function ppe(e,t,n){return t&&x$(e.prototype,t),n&&x$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function y$(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?y$(Object(n),!0).forEach(function(r){Bv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Bv(e,t,n){return t=Tz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tz(e){var t=hpe(e,"string");return qf(t)=="symbol"?t:t+""}function hpe(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 Oz=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,U;if(y.type==="number"&&(y.padding==="gap"||y.padding==="no-gap")){var B=S[1]-S[0],Y=1/0,z=y.categoricalDomain.sort(SZ);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=ez(y,o,v),X=M.scale,$=M.realScaleType;X.domain(S).range(O),tz(X);var F=nz(X,ys(ys({},y),{},{realScaleType:$}));s==="xAxis"?(U=b==="top"&&!k||b==="bottom"&&k,D=r.left,K=p[E]-U*y.height):s==="yAxis"&&(U=b==="left"&&!k||b==="right"&&k,D=p[E]-U*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]+=(U?-1:1)*G.height:y.hide||(p[E]+=(U?-1:1)*G.width),ys(ys({},x),{},Bv({},j,G))},{})},Mz=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)}},mpe=function(t){var n=t.x1,r=t.y1,s=t.x2,o=t.y2;return Mz({x:n,y:r},{x:s,y:o})},Iz=(function(){function e(t){fpe(this,e),this.scale=t}return ppe(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(Iz,"EPS",1e-4);var F_=function(t){var n=Object.keys(t).reduce(function(r,s){return ys(ys({},r),{},Bv({},s,Iz.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 qfe(s,function(d,f){return n[f].apply(d,{bandAware:i,position:c})})},isInRange:function(s){return Kfe(s,function(o,i){return n[i].isInRange(o)})}})};function gpe(e){return(e%180+180)%180}var vpe=function(t){var n=t.width,r=t.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=gpe(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,b$;function xpe(){if(b$)return pS;b$=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,w$;function ype(){if(w$)return hS;w$=1;var e=Cz();function t(n){var r=e(n),s=r%1;return r===r?s?r-s:r:0}return hS=t,hS}var mS,j$;function bpe(){if(j$)return mS;j$=1;var e=D4(),t=Zs(),n=ype(),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,S$;function wpe(){if(S$)return gS;S$=1;var e=xpe(),t=bpe(),n=e(t);return gS=n,gS}wpe();var jpe=ZL();const Spe=xn(jpe);var Npe=Spe(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("")}),$z=h.createContext(void 0),Dz=h.createContext(void 0),Lz=h.createContext(void 0),Cpe=h.createContext({}),Fz=h.createContext(void 0),zz=h.createContext(0),Bz=h.createContext(0),N$=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=Npe(o);return Q.createElement($z.Provider,{value:r},Q.createElement(Dz.Provider,{value:s},Q.createElement(Cpe.Provider,{value:o},Q.createElement(Lz.Provider,{value:m},Q.createElement(Fz.Provider,{value:i},Q.createElement(zz.Provider,{value:f},Q.createElement(Bz.Provider,{value:d},c)))))))},_pe=function(){return h.useContext(Fz)},qz=function(t){var n=h.useContext($z);n==null&&El();var r=n[t];return r==null&&El(),r},Uz=function(t){var n=h.useContext(Dz);n==null&&El();var r=n[t];return r==null&&El(),r},kpe=function(){var t=h.useContext(Lz);return t},Wz=function(){return h.useContext(Bz)},Hz=function(){return h.useContext(zz)};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 Ape(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Epe(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 Ppe(e,t,n){return t&&Epe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Rpe(e,t,n){return t=mg(t),Tpe(e,Vz()?Reflect.construct(t,n||[],mg(e).constructor):t.apply(e,n))}function Tpe(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 Ope(e)}function Ope(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 mg(e){return mg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},mg(e)}function Mpe(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&&gN(e,t)}function gN(e,t){return gN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},gN(e,t)}function C$(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 _$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?C$(Object(n),!0).forEach(function(r){z_(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function z_(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=Ipe(e,"string");return mu(t)=="symbol"?t:t+""}function Ipe(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 $pe(e,t){return zpe(e)||Fpe(e,t)||Lpe(e,t)||Dpe()}function Dpe(){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 Lpe(e,t){if(e){if(typeof e=="string")return k$(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 k$(e,t)}}function k$(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 Fpe(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 zpe(e){if(Array.isArray(e))return e}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)}var Bpe=function(t,n){var r;return Q.isValidElement(t)?r=Q.cloneElement(t,n):Vt(t)?r=t(n):r=Q.createElement("line",vN({},n,{className:"recharts-reference-line-line"})),r},qpe=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")&&Lfe(A,function(E){return!t.isInRange(E)})?null:A}return null};function Upe(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=_pe(),m=qz(s),p=Uz(o),v=kpe();if(!f||!v)return null;So(d===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var x=F_({x:m.scale,y:p.scale}),j=dr(t),y=dr(n),b=r&&r.length===2,S=qpe(x,j,y,b,v,e.position,m.orientation,p.orientation,e);if(!S)return null;var N=$pe(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=_$(_$({clipPath:D},It(e,!0)),{},{x1:k,y1:A,x2:P,y2:O});return Q.createElement(un,{className:Gt("recharts-reference-line",c)},Bpe(i,K),br.renderCallByParent(e,mpe({x1:k,y1:A,x2:P,y2:O})))}var B_=(function(e){function t(){return Ape(this,t),Rpe(this,t,arguments)}return Mpe(t,e),Ppe(t,[{key:"render",value:function(){return Q.createElement(Upe,this.props)}}])})(Q.Component);z_(B_,"displayName","ReferenceLine");z_(B_,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function xN(){return xN=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},xN.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 A$(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 E$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?A$(Object(n),!0).forEach(function(r){qv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Wpe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hpe(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,Yz(r.key),r)}}function Vpe(e,t,n){return t&&Hpe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kpe(e,t,n){return t=gg(t),Gpe(e,Gz()?Reflect.construct(t,n||[],gg(e).constructor):t.apply(e,n))}function Gpe(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 Ype(e)}function Ype(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Gz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Gz=function(){return!!e})()}function gg(e){return gg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},gg(e)}function Xpe(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&&yN(e,t)}function yN(e,t){return yN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},yN(e,t)}function qv(e,t,n){return t=Yz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yz(e){var t=Qpe(e,"string");return gu(t)=="symbol"?t:t+""}function Qpe(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 Jpe=function(t){var n=t.x,r=t.y,s=t.xAxis,o=t.yAxis,i=F_({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 Wpe(this,t),Kpe(this,t,arguments)}return Xpe(t,e),Vpe(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=Jpe(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=E$(E$({clipPath:S},It(this.props,!0)),{},{cx:v,cy:x});return Q.createElement(un,{className:Gt("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):Vt(e)?n=e(t):n=Q.createElement(Mv,xN({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),n});function bN(){return bN=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},bN.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 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 R$(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){Wv(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 Zpe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ehe(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,Qz(r.key),r)}}function the(e,t,n){return t&&ehe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function nhe(e,t,n){return t=vg(t),rhe(e,Xz()?Reflect.construct(t,n||[],vg(e).constructor):t.apply(e,n))}function rhe(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 ahe(e)}function ahe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Xz=function(){return!!e})()}function vg(e){return vg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},vg(e)}function she(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 Wv(e,t,n){return t=Qz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qz(e){var t=ohe(e,"string");return vu(t)=="symbol"?t:t+""}function ohe(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 ihe=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=F_({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:Mz(x,j)},Hv=(function(e){function t(){return Zpe(this,t),nhe(this,t,arguments)}return she(t,e),the(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=ihe(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:Gt("recharts-reference-area",d)},t.renderRect(y,R$(R$({clipPath:S},It(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):Vt(e)?n=e(t):n=Q.createElement(L_,bN({},t,{className:"recharts-reference-area-rect"})),n});function Jz(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 lhe(e,t,n){var r={width:e.width+t.width,height:e.height+t.height};return vpe(r,n)}function che(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 uhe(e,t){return Jz(e,t+1)}function dhe(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:Jz(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 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 Or(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){fhe(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 fhe(e,t,n){return t=phe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function phe(e){var t=hhe(e,"string");return Uf(t)=="symbol"?t:t+""}function hhe(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 mhe(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 ghe(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 vhe(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 uhe(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=Vt(f)?f(C.value,k):C.value;return x==="width"?lhe(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=che(o,b,x);return d==="equidistantPreserveStart"?dhe(b,S,y,s,i):(d==="preserveStart"||d==="preserveStartEnd"?v=ghe(b,S,y,s,i,d==="preserveStartEnd"):v=mhe(b,S,y,s,i),v.filter(function(N){return N.isShow}))}var xhe=["viewBox"],yhe=["viewBox"],bhe=["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 O$(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?O$(Object(n),!0).forEach(function(r){q_(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O$(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=whe(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 whe(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 jhe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M$(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,eB(r.key),r)}}function She(e,t,n){return t&&M$(e.prototype,t),n&&M$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Nhe(e,t,n){return t=yg(t),Che(e,Zz()?Reflect.construct(t,n||[],yg(e).constructor):t.apply(e,n))}function Che(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 _he(e)}function _he(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Zz=function(){return!!e})()}function yg(e){return yg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},yg(e)}function khe(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&&jN(e,t)}function jN(e,t){return jN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},jN(e,t)}function q_(e,t,n){return t=eB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eB(e){var t=Ahe(e,"string");return xu(t)=="symbol"?t:t+""}function Ahe(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 jhe(this,t),r=Nhe(this,t,[n]),r.state={fontSize:"",letterSpacing:""},r}return khe(t,e),She(t,[{key:"shouldComponentUpdate",value:function(r,s){var o=r.viewBox,i=vS(r,xhe),c=this.props,d=c.viewBox,f=vS(c,yhe);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({},It(this.props,!1)),It(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:Gt("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=vhe(lr(lr({},this.props),{},{ticks:r}),s,o),j=this.getTickTextAnchor(),y=this.getTickVerticalAnchor(),b=It(this.props,!1),S=It(m,!1),N=lr(lr({},b),{},{fill:"none"},It(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:Gt("recharts-cartesian-axis-tick-line",_a(d,"className"))})),m&&t.renderTickItem(m,D,"".concat(Vt(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,bhe),j=v;return Vt(d)&&(j=v&&v.length>0?d(this.props):d(x)),i<=0||c<=0||!j||!j.length?null:Q.createElement(un,{className:Gt("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=Gt(s.className,"recharts-cartesian-axis-tick-value");return Q.isValidElement(r)?i=Q.cloneElement(r,lr(lr({},s),{},{className:c})):Vt(r)?i=r(lr(lr({},s),{},{className:c})):i=Q.createElement(kl,Lc({},s,{className:"recharts-cartesian-axis-tick-value"}),o),i}}])})(h.Component);q_(Vv,"displayName","CartesianAxis");q_(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 Ehe=["type","layout","connectNulls","ref"],Phe=["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 I$(e,t){if(e==null)return{};var n=Rhe(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 Rhe(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 $$(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?$$(Object(n),!0).forEach(function(r){bs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Cc(e){return Ihe(e)||Mhe(e)||Ohe(e)||The()}function The(){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 Ohe(e,t){if(e){if(typeof e=="string")return SN(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 SN(e,t)}}function Mhe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Ihe(e){if(Array.isArray(e))return SN(e)}function SN(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 $he(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D$(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,nB(r.key),r)}}function Dhe(e,t,n){return t&&D$(e.prototype,t),n&&D$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lhe(e,t,n){return t=bg(t),Fhe(e,tB()?Reflect.construct(t,n||[],bg(e).constructor):t.apply(e,n))}function Fhe(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 zhe(e)}function zhe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tB=function(){return!!e})()}function bg(e){return bg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},bg(e)}function Bhe(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 bs(e,t,n){return t=nB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nB(e){var t=qhe(e,"string");return yu(t)=="symbol"?t:t+""}function qhe(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;$he(this,t);for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return n=Lhe(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 Bhe(t,e),Dhe(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=It(this.props,!1),v=It(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=I$(c,Ehe),v=xa(xa(xa({},It(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 U="".concat(d).split(/[,\s]+/gim).map(function(B){return parseFloat(B)});K=o.getStrokeDasharray(D,C,U)}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=Gt("recharts-line",d),k=f&&f.allowDataOverflow,A=m&&m.allowDataOverflow,E=k||A,P=Kt(b)?this.id:b,O=(r=It(i,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},D=O.r,K=D===void 0?3:D,U=O.strokeWidth,B=U===void 0?2:U,Y=TZ(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(Vt(r))o=r(s);else{var i=s.key,c=I$(s,Phe),d=Gt("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:WM({axis:n,ticks:s,bandSize:c,entry:v,index:x}),y:Kt(j)?null:r.scale(j),value:j,payload:v}:{x:Kt(j)?null:n.scale(j),y:WM({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 Uhe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Whe(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,sB(r.key),r)}}function Hhe(e,t,n){return t&&Whe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vhe(e,t,n){return t=wg(t),Khe(e,rB()?Reflect.construct(t,n||[],wg(e).constructor):t.apply(e,n))}function Khe(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 Ghe(e)}function Ghe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rB=function(){return!!e})()}function wg(e){return wg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},wg(e)}function Yhe(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 aB(e,t,n){return t=sB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sB(e){var t=Xhe(e,"string");return bu(t)=="symbol"?t:t+""}function Xhe(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 _N(){return _N=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},_N.apply(this,arguments)}function Qhe(e){var t=e.xAxisId,n=Wz(),r=Hz(),s=qz(t);return s==null?null:h.createElement(Vv,_N({},s,{className:Gt("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 Uhe(this,t),Vhe(this,t,arguments)}return Yhe(t,e),Hhe(t,[{key:"render",value:function(){return h.createElement(Qhe,this.props)}}])})(h.Component);aB(_i,"displayName","XAxis");aB(_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 Jhe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zhe(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 eme(e,t,n){return t&&Zhe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function tme(e,t,n){return t=jg(t),nme(e,oB()?Reflect.construct(t,n||[],jg(e).constructor):t.apply(e,n))}function nme(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 rme(e)}function rme(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function oB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(oB=function(){return!!e})()}function jg(e){return jg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},jg(e)}function ame(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&&kN(e,t)}function kN(e,t){return kN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},kN(e,t)}function iB(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=sme(e,"string");return wu(t)=="symbol"?t:t+""}function sme(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 AN(){return AN=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},AN.apply(this,arguments)}var ome=function(t){var n=t.yAxisId,r=Wz(),s=Hz(),o=Uz(n);return o==null?null:h.createElement(Vv,AN({},o,{className:Gt("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 Jhe(this,t),tme(this,t,arguments)}return ame(t,e),eme(t,[{key:"render",value:function(){return h.createElement(ome,this.props)}}])})(h.Component);iB(ki,"displayName","YAxis");iB(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 L$(e){return ume(e)||cme(e)||lme(e)||ime()}function ime(){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 lme(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 cme(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ume(e){if(Array.isArray(e))return EN(e)}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}var PN=function(t,n,r,s,o){var i=ka(t,B_),c=ka(t,Uv),d=[].concat(L$(i),L$(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:{}},F$;function dme(){return F$||(F$=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 fme=dme();const pme=xn(fme);var yS=new pme,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 hme(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mme(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,cB(r.key),r)}}function gme(e,t,n){return t&&mme(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function wS(e,t,n){return t=cB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cB(e){var t=vme(e,"string");return Wf(t)=="symbol"?t:t+""}function vme(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 xme=(function(){function e(){hme(this,e),wS(this,"activeIndex",0),wS(this,"coordinateList",[]),wS(this,"layout","horizontal")}return gme(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 yme(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 bme(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 uB(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 wme(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 uB(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 z$(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?z$(Object(n),!0).forEach(function(r){jme(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function jme(e,t,n){return t=Sme(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sme(e){var t=Nme(e,"string");return Hf(t)=="symbol"?t:t+""}function Nme(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 Cme(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=lde;else if(v==="BarChart")j=bme(p,i,d,m),y=L_;else if(p==="radial"){var b=uB(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=uz}else j={points:wme(p,i,d)},y=Zm;var E=Qh(Qh(Qh(Qh({stroke:"#ccc",pointerEvents:"none"},d),j),It(x,!1)),{},{payload:c,payloadIndex:f,className:Gt("recharts-tooltip-cursor",x.className)});return h.isValidElement(x)?h.cloneElement(x,E):h.createElement(y,E)}var _me=["item"],kme=["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 B$(e,t){return Pme(e)||Eme(e,t)||fB(e,t)||Ame()}function Ame(){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 Eme(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 Pme(e){if(Array.isArray(e))return e}function q$(e,t){if(e==null)return{};var n=Rme(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 Rme(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 Tme(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ome(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,pB(r.key),r)}}function Mme(e,t,n){return t&&Ome(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ime(e,t,n){return t=Sg(t),$me(e,dB()?Reflect.construct(t,n||[],Sg(e).constructor):t.apply(e,n))}function $me(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 Dme(e)}function Dme(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dB=function(){return!!e})()}function Sg(e){return Sg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Sg(e)}function Lme(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 Su(e){return Bme(e)||zme(e)||fB(e)||Fme()}function Fme(){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 fB(e,t){if(e){if(typeof e=="string")return TN(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 TN(e,t)}}function zme(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Bme(e){if(Array.isArray(e))return TN(e)}function TN(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 U$(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 Me(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?U$(Object(n),!0).forEach(function(r){$t(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function $t(e,t,n){return t=pB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pB(e){var t=qme(e,"string");return ju(t)=="symbol"?t:t+""}function qme(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 Ume={xAxis:["bottom","top"],yAxis:["left","right"]},Wme={width:"100%",height:"100%"},hB={x:0,y:0};function Jh(e){return e}var Hme=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},Vme=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 Me(Me(Me({},s),Pn(s.cx,s.cy,c,i)),{},{angle:i,radius:c})}var d=o.coordinate,f=s.angle;return Me(Me(Me({},s),Pn(s.cx,s.cy,d,f)),{},{angle:f,radius:d})}return hB},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 mB(e){return e==="number"?[0,"auto"]:void 0}var ON=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),[az(f,v)]):d},[])},W$=function(t,n,r,s){var o=s||{x:t.chartX,y:t.chartY},i=Hme(o,r),c=t.orderedTooltipTicks,d=t.tooltipAxis,f=t.tooltipTicks,m=Eie(i,c,f,d);if(m>=0&&f){var p=f[m]&&f[m].value,v=ON(t,n,m,p),x=Vme(r,c,m,o);return{activeTooltipIndex:m,activeLabel:p,activePayload:v,activeCoordinate:x}}return null},Kme=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=ZF(m,o);return r.reduce(function(j,y){var b,S=y.type.defaultProps!==void 0?Me(Me({},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}),U=K.length,B,Y,z;yme(S.domain,k,N)&&(B=K1(S.domain,null,k),x&&(N==="number"||E!=="auto")&&(z=Qd(K,C,"category")));var I=mB(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=jZ(B);A&&H?(Y=B,B=ug(0,U)):A||(B=GM(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!==""&&!Kt(F)}):B=GM(V,B,y).reduce(function(F,G){return F.indexOf(G)>=0||G===""||Kt(G)?F:[].concat(Su(F),[G])},[]);else if(N==="number"){var M=Mie(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,U):c&&c[D]&&c[D].hasStack&&N==="number"?B=v==="expand"?[0,1]:rz(c[D].stackGroups,d,f):B=JF(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=PN(p,B,D,o,P),V&&(B=K1(V,B,k));else if(N==="category"&&V){var X=V,$=B.every(function(F){return X.indexOf(F)>=0});$&&(B=X)}}return Me(Me({},j),{},$t({},D,Me(Me({},S),{},{axisType:o,domain:B,categoricalDomain:z,duplicateDomain:Y,originalDomain:(b=S.domain)!==null&&b!==void 0?b:I,isCategorical:x,layout:m})))},{})},Gme=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=ZF(m,o),y=-1;return r.reduce(function(b,S){var N=S.type.defaultProps!==void 0?Me(Me({},S.type.defaultProps),S.props):S.props,C=N[i],k=mB("number");if(!b[C]){y++;var A;return j?A=ug(0,x):c&&c[C]&&c[C].hasStack?(A=rz(c[C].stackGroups,d,f),A=PN(p,A,C,o)):(A=K1(k,JF(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=PN(p,A,C,o)),Me(Me({},b),{},$t({},C,Me(Me({axisType:o},s.defaultProps),{},{hide:!0,orientation:_a(Ume,"".concat(o,".").concat(y%2),null),domain:A,originalDomain:k,isCategorical:j,layout:m})))}return b},{})},Yme=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=Kme(t,{axes:v,graphicalItems:i,axisType:s,axisIdKey:p,stackGroups:c,dataStartIndex:d,dataEndIndex:f}):i&&i.length&&(x=Gme(t,{Axis:o,graphicalItems:i,axisType:s,axisIdKey:p,stackGroups:c,dataStartIndex:d,dataEndIndex:f})),x},Xme=function(t){var n=Rc(t),r=pl(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:d_(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Xm(n,r)}},H$=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}},Qme=function(t){return!t||!t.length?!1:t.some(function(n){var r=jo(n&&n.type);return r&&r.indexOf("Bar")>=0})},V$=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"}},Jme=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?Me(Me({},A),{},$t({},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?Me(Me({},A),{},$t({},O,_a(A,"".concat(O))+P.height)):A},{top:v.top||0,bottom:v.bottom||0}),S=Me(Me({},b),y),N=S.bottom;x&&(S.bottom+=x.props.height||pu.defaultProps.height),j&&n&&(S=Tie(S,s,r,n));var C=f-S.left-S.right,k=m-S.top-S.bottom;return Me(Me({brushBottom:N},S),{},{width:Math.max(C,0),height:Math.max(k,0)})},Zme=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},U_=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,U=S.barGap,B=S.barCategoryGap,Y=S.maxBarSize,z=V$(K),I=z.numericAxisName,T=z.cateAxisName,V=Qme(C),H=[];return C.forEach(function(M,X){var $=Kv(S.data,{graphicalItems:[M],dataStartIndex:P,dataEndIndex:O}),F=M.type.defaultProps!==void 0?Me(Me({},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(Pe,et){var ht=N["".concat(et.axisType,"Map")],zt=F["".concat(et.axisType,"Id")];ht&&ht[zt]||et.axisType==="zAxis"||El();var Bt=ht[zt];return Me(Me({},Pe),{},$t($t({},et.axisType,Bt),"".concat(et.axisType,"Ticks"),pl(Bt)))},ae),se=ye[T],de=ye["".concat(T,"Ticks")],De=k&&k[oe]&&k[oe].hasStack&&Uie(M,k[oe].stackGroups),ge=jo(M.type).indexOf("Bar")>=0,ve=Xm(se,de),Se=[],at=V&&Pie({barSize:D,stackGroups:k,totalSize:Zme(ye,T)});if(ge){var tt,it,kt=Kt(re)?Y:re,Ge=(tt=(it=Xm(se,de,!0))!==null&&it!==void 0?it:kt)!==null&&tt!==void 0?tt:0;Se=Rie({barGap:U,barCategoryGap:B,bandSize:Ge!==ve?Ge:ve,sizeList:at[ue],maxBarSize:kt}),Ge!==ve&&(Se=Se.map(function(Pe){return Me(Me({},Pe),{},{position:Me(Me({},Pe.position),{},{offset:Pe.position.offset-Ge/2})})}))}var ke=M&&M.type&&M.type.getComposedData;ke&&H.push({props:Me(Me({},ke(Me(Me({},ye),{},{displayedData:$,props:S,dataKey:G,item:M,bandSize:ve,barPosition:Se,offset:A,stackedData:De,layout:K,dataStartIndex:P,dataEndIndex:O}))),{},$t($t($t({key:M.key||"item-".concat(X)},I,ye[I]),T,ye[T]),"animationId",E)),childIndex:IZ(M,S.children),item:M})}),H},x=function(S,N){var C=S.props,k=S.dataStartIndex,A=S.dataEndIndex,E=S.updateId;if(!lT({props:C}))return null;var P=C.children,O=C.layout,D=C.stackOffset,K=C.data,U=C.reverseStackOrder,B=V$(O),Y=B.numericAxisName,z=B.cateAxisName,I=ka(P,r),T=Bie(K,I,"".concat(Y,"Id"),"".concat(z,"Id"),D,U),V=d.reduce(function(F,G){var re="".concat(G.axisType,"Map");return Me(Me({},F),{},$t({},re,Yme(C,Me(Me({},G),{},{graphicalItems:I,stackGroups:G.axisType===Y&&T,dataStartIndex:k,dataEndIndex:A}))))},{}),H=Jme(Me(Me({},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=Xme(M),$=v(C,Me(Me({},V),{},{dataStartIndex:k,dataEndIndex:A,updateId:E,graphicalItems:I,stackGroups:T,offset:H}));return Me(Me({formattedGraphicalItems:$,graphicalItems:I,offset:H,stackGroups:T},X),V)},j=(function(b){function S(N){var C,k,A;return Tme(this,S),A=Ime(this,S,[N]),$t(A,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),$t(A,"accessibilityManager",new xme),$t(A,"handleLegendBBoxUpdate",function(E){if(E){var P=A.state,O=P.dataStartIndex,D=P.dataEndIndex,K=P.updateId;A.setState(Me({legendBBox:E},x({props:A.props,dataStartIndex:O,dataEndIndex:D,updateId:K},Me(Me({},A.state),{},{legendBBox:E}))))}}),$t(A,"handleReceiveSyncEvent",function(E,P,O){if(A.props.syncId===E){if(O===A.eventEmitterSymbol&&typeof A.props.syncMethod!="function")return;A.applySyncEvent(P)}}),$t(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 Me({dataStartIndex:P,dataEndIndex:O},x({props:A.props,dataStartIndex:P,dataEndIndex:O,updateId:D},A.state))}),A.triggerSyncEvent({dataStartIndex:P,dataEndIndex:O})}}),$t(A,"handleMouseEnter",function(E){var P=A.getMouseInfo(E);if(P){var O=Me(Me({},P),{},{isTooltipActive:!0});A.setState(O),A.triggerSyncEvent(O);var D=A.props.onMouseEnter;Vt(D)&&D(O,E)}}),$t(A,"triggeredAfterMouseMove",function(E){var P=A.getMouseInfo(E),O=P?Me(Me({},P),{},{isTooltipActive:!0}):{isTooltipActive:!1};A.setState(O),A.triggerSyncEvent(O);var D=A.props.onMouseMove;Vt(D)&&D(O,E)}),$t(A,"handleItemMouseEnter",function(E){A.setState(function(){return{isTooltipActive:!0,activeItem:E,activePayload:E.tooltipPayload,activeCoordinate:E.tooltipPosition||{x:E.cx,y:E.cy}}})}),$t(A,"handleItemMouseLeave",function(){A.setState(function(){return{isTooltipActive:!1}})}),$t(A,"handleMouseMove",function(E){E.persist(),A.throttleTriggeredAfterMouseMove(E)}),$t(A,"handleMouseLeave",function(E){A.throttleTriggeredAfterMouseMove.cancel();var P={isTooltipActive:!1};A.setState(P),A.triggerSyncEvent(P);var O=A.props.onMouseLeave;Vt(O)&&O(P,E)}),$t(A,"handleOuterEvent",function(E){var P=MZ(E),O=_a(A.props,"".concat(P));if(P&&Vt(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)}}),$t(A,"handleClick",function(E){var P=A.getMouseInfo(E);if(P){var O=Me(Me({},P),{},{isTooltipActive:!0});A.setState(O),A.triggerSyncEvent(O);var D=A.props.onClick;Vt(D)&&D(O,E)}}),$t(A,"handleMouseDown",function(E){var P=A.props.onMouseDown;if(Vt(P)){var O=A.getMouseInfo(E);P(O,E)}}),$t(A,"handleMouseUp",function(E){var P=A.props.onMouseUp;if(Vt(P)){var O=A.getMouseInfo(E);P(O,E)}}),$t(A,"handleTouchMove",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&A.throttleTriggeredAfterMouseMove(E.changedTouches[0])}),$t(A,"handleTouchStart",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&A.handleMouseDown(E.changedTouches[0])}),$t(A,"handleTouchEnd",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&A.handleMouseUp(E.changedTouches[0])}),$t(A,"handleDoubleClick",function(E){var P=A.props.onDoubleClick;if(Vt(P)){var O=A.getMouseInfo(E);P(O,E)}}),$t(A,"handleContextMenu",function(E){var P=A.props.onContextMenu;if(Vt(P)){var O=A.getMouseInfo(E);P(O,E)}}),$t(A,"triggerSyncEvent",function(E){A.props.syncId!==void 0&&yS.emit(bS,A.props.syncId,E,A.eventEmitterSymbol)}),$t(A,"applySyncEvent",function(E){var P=A.props,O=P.layout,D=P.syncMethod,K=A.state.updateId,U=E.dataStartIndex,B=E.dataEndIndex;if(E.dataStartIndex!==void 0||E.dataEndIndex!==void 0)A.setState(Me({dataStartIndex:U,dataEndIndex:B},x({props:A.props,dataStartIndex:U,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=Me(Me({},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=ON(A.state,A.props.data,I),oe=H[I]?{x:O==="horizontal"?H[I].coordinate:$,y:O==="horizontal"?F:H[I].coordinate}:hB;A.setState(Me(Me({},E),{},{activeLabel:G,activeCoordinate:oe,activePayload:re,activeTooltipIndex:I}))}else A.setState(E)}),$t(A,"renderCursor",function(E){var P,O=A.state,D=O.isTooltipActive,K=O.activeCoordinate,U=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(Cme,{key:H,activeCoordinate:K,activePayload:U,activeTooltipIndex:Y,chartName:n,element:E,isActive:T,layout:V,offset:B,tooltipAxisBandSize:z,tooltipEventType:I})}),$t(A,"renderPolarAxis",function(E,P,O){var D=_a(E,"type.axisType"),K=_a(A.state,"".concat(D,"Map")),U=E.type.defaultProps,B=U!==void 0?Me(Me({},U),E.props):E.props,Y=K&&K[B["".concat(D,"Id")]];return h.cloneElement(E,Me(Me({},Y),{},{className:Gt(D,Y.className),key:E.key||"".concat(P,"-").concat(O),ticks:pl(Y,!0)}))}),$t(A,"renderPolarGrid",function(E){var P=E.props,O=P.radialLines,D=P.polarAngles,K=P.polarRadius,U=A.state,B=U.radiusAxisMap,Y=U.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})}),$t(A,"renderLegend",function(){var E=A.state.formattedGraphicalItems,P=A.props,O=P.children,D=P.width,K=P.height,U=A.props.margin||{},B=D-(U.left||0)-(U.right||0),Y=XF({children:O,formattedGraphicalItems:E,legendWidth:B,legendContent:f});if(!Y)return null;var z=Y.item,I=q$(Y,_me);return h.cloneElement(z,Me(Me({},I),{},{chartWidth:D,chartHeight:K,margin:U,onBBoxUpdate:A.handleLegendBBoxUpdate}))}),$t(A,"renderTooltip",function(){var E,P=A.props,O=P.children,D=P.accessibilityLayer,K=ba(O,aa);if(!K)return null;var U=A.state,B=U.isTooltipActive,Y=U.activeCoordinate,z=U.activePayload,I=U.activeLabel,T=U.offset,V=(E=K.props.active)!==null&&E!==void 0?E:B;return h.cloneElement(K,{viewBox:Me(Me({},T),{},{x:T.left,y:T.top}),active:V,label:I,payload:V?z:[],coordinate:Y,accessibilityLayer:D})}),$t(A,"renderBrush",function(E){var P=A.props,O=P.margin,D=P.data,K=A.state,U=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:U.left,y:rt(E.props.y)?E.props.y:U.top+U.height+U.brushBottom-(O.bottom||0),width:rt(E.props.width)?E.props.width:U.width,startIndex:B,endIndex:Y,updateId:"brush-".concat(z)})}),$t(A,"renderReferenceElement",function(E,P,O){if(!E)return null;var D=A,K=D.clipPathId,U=A.state,B=U.xAxisMap,Y=U.yAxisMap,z=U.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})}),$t(A,"renderActivePoints",function(E){var P=E.item,O=E.activePoint,D=E.basePoint,K=E.childIndex,U=E.isRange,B=[],Y=P.props.key,z=P.item.type.defaultProps!==void 0?Me(Me({},P.item.type.defaultProps),P.item.props):P.item.props,I=z.activeDot,T=z.dataKey,V=Me(Me({index:K,dataKey:T,cx:O.x,cy:O.y,r:4,fill:D_(P.item),strokeWidth:2,stroke:"#fff",payload:O.payload,value:O.value},It(I,!1)),Cm(I));return B.push(S.renderActiveDot(I,V,"".concat(Y,"-activePoint-").concat(K))),D?B.push(S.renderActiveDot(I,Me(Me({},V),{},{cx:D.x,cy:D.y}),"".concat(Y,"-basePoint-").concat(K))):U&&B.push(null),B}),$t(A,"renderGraphicChild",function(E,P,O){var D=A.filterFormatItem(E,P,O);if(!D)return null;var K=A.getTooltipEventType(),U=A.state,B=U.isTooltipActive,Y=U.tooltipAxis,z=U.activeTooltipIndex,I=U.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?Me(Me({},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,Me(Me({},D.props),ye));function de(et){return typeof Y.dataKey=="function"?Y.dataKey(et.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,Me(Me(Me({},D.props),ye),{},{activeIndex:Se})),null,null]}if(!Kt(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,Ge=kt===void 0?E:kt,ke=it.childIndex,Pe=Me(Me(Me({},D.props),ye),{},{activeIndex:ke});return[h.cloneElement(Ge,Pe),null,null]}return X?[se,null,null]:[se,null]}),$t(A,"renderCustomized",function(E,P,O){return h.cloneElement(E,Me(Me({key:"recharts-customized-".concat(O)},A.props),A.state))}),$t(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=X4(A.triggeredAfterMouseMove,(k=N.throttleDelay)!==null&&k!==void 0?k:1e3/60),A.state={},A}return Lme(S,b),Mme(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,U=ON(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=Me(Me({},I),T.props.points[D].tooltipPosition),U=T.props.points[D].tooltipPayload);var V={activeTooltipIndex:D,isTooltipActive:!0,activeLabel:K,activePayload:U,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){m1([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=wre(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,U=K.xAxisMap,B=K.yAxisMap,Y=this.getTooltipEventType(),z=W$(this.state,this.props.data,this.props.layout,D);if(Y!=="axis"&&U&&B){var I=Rc(U).scale,T=Rc(B).scale,V=I&&I.invert?I.invert(P.chartX):null,H=T&&T.invert?T.invert(P.chartY):null;return Me(Me({},P),{},{xValue:V,yValue:H},z)}return z?Me(Me({},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 U=this.state,B=U.angleAxisMap,Y=U.radiusAxisMap;if(B&&Y){var z=Rc(B);return QM({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 Me(Me({},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=B$(A,2),P=E[0],O=E[1];return Me(Me({},k),{},$t({},P,O.scale))},{}):null}},{key:"getYScales",value:function(){var C=this.state.yAxisMap;return C?Object.entries(C).reduce(function(k,A){var E=B$(A,2),P=E[0],O=E[1];return Me(Me({},k),{},$t({},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,U=D.item,B=U.type.defaultProps!==void 0?Me(Me({},U.type.defaultProps),U.props):U.props,Y=jo(U.type);if(Y==="Bar"){var z=(K.data||[]).find(function(H){return que(C,H)});if(z)return{graphicalItem:D,payload:z}}else if(Y==="RadialBar"){var I=(K.data||[]).find(function(H){return QM(C,H)});if(I)return{graphicalItem:D,payload:I}}else if(Fv(D,E)||zv(D,E)||Ff(D,E)){var T=dfe({graphicalItem:D,activeTooltipItem:E,itemData:B.data}),V=B.activeIndex===void 0?T:B.activeIndex;return{graphicalItem:Me(Me({},D),{},{childIndex:V}),payload:Ff(D,E)?B.data[T]:D.props.data[T]}}}return null}},{key:"render",value:function(){var C=this;if(!lT(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,U=k.title,B=k.desc,Y=q$(k,kme),z=It(Y,!1);if(K)return Q.createElement(N$,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},Q.createElement(v1,Fc({},z,{width:P,height:O,title:U,desc:B}),this.renderClipPath(),uT(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(N$,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},Q.createElement("div",Fc({className:Gt("recharts-wrapper",E),style:Me({position:"relative",cursor:"default",width:P,height:O},D)},V,{ref:function(M){C.container=M}}),Q.createElement(v1,Fc({},z,{width:P,height:O,title:U,desc:B,style:Wme}),this.renderClipPath(),uT(A,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(h.Component);$t(j,"displayName",n),$t(j,"defaultProps",Me({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},p)),$t(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,U=S.dataEndIndex;if(S.updateId===void 0){var B=H$(b);return Me(Me(Me({},B),{},{updateId:0},x(Me(Me({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=H$(b),z={chartX:S.chartX,chartY:S.chartY,isTooltipActive:S.isTooltipActive},I=Me(Me({},W$(S,C,P)),{},{updateId:S.updateId+1}),T=Me(Me(Me({},Y),z),I);return Me(Me(Me({},T),x(Me({props:b},T),S)),{},{prevDataKey:N,prevData:C,prevWidth:A,prevHeight:E,prevLayout:P,prevStackOffset:O,prevMargin:D,prevChildren:k})}if(!m1(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:U,re=F!==K||G!==U,oe=!Kt(C),ue=oe&&!re?S.updateId:S.updateId+1;return Me(Me({updateId:ue},x(Me(Me({props:b},S),{},{updateId:ue,dataStartIndex:F,dataEndIndex:G}),S)),{},{prevChildren:k,dataStartIndex:F,dataEndIndex:G})}return null}),$t(j,"renderActiveDot",function(b,S,N){var C;return h.isValidElement(b)?C=h.cloneElement(b,S):Vt(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},MN=U_({chartName:"LineChart",GraphicalChild:Pl,axisComponents:[{axisType:"xAxis",AxisComp:_i},{axisType:"yAxis",AxisComp:ki}],formatAxisMap:Oz}),ege=U_({chartName:"BarChart",GraphicalChild:Gl,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:_i},{axisType:"yAxis",AxisComp:ki}],formatAxisMap:Oz}),tge=U_({chartName:"PieChart",GraphicalChild:Uo,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Lv},{axisType:"radiusAxis",AxisComp:$v}],formatAxisMap:Zie,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function W_(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 K$=10080*60*1e3;function G$(e){return e.length===0?0:e.reduce((t,n)=>t+n,0)/e.length}function Y$(e,t=0){const n=Number(e.toFixed(t));return`${n>0?"+":""}${n.toFixed(t)}`}const nge=()=>{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-K$,X=M-K$,$=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=G$(d.map(T=>T.overallPassRate)),k=G$(d.map(T=>T.avgLatency)),A=(S-C)*100,E=N-k,P=d.length>0,O=P?`${Y$(A,1)}% from last week`:"No prior-week baseline",D=P?`${Y$(E,0)}ms from last week`:"No prior-week baseline",K=P?A>0?"up":A<0?"down":"neutral":"neutral",U=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(fC,{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(mC,{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:uC,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:gC,subtitle:n?"Loading...":D,trend:n?"neutral":U})]}),a.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[a.jsxs(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsx(Lt,{className:"text-base",children:"Pass Rate Trend"})}),a.jsx(Ze,{children:a.jsx(mf,{width:"100%",height:200,children:a.jsxs(MN,{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(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsx(Lt,{className:"text-base",children:"Recent Tool Latency (ms)"})}),a.jsx(Ze,{children:a.jsx(mf,{width:"100%",height:200,children:a.jsxs(MN,{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(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsx(Lt,{className:"text-base",children:"Recent Runs"})}),a.jsxs(Ze,{className:"p-0",children:[a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Ht,{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(Zt,{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(Zt,{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(Zt,{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(Ht,{children:a.jsx(qe,{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(Ht,{className:"cursor-pointer",children:[a.jsx(qe,{children:a.jsx(At,{to:`/results/${T.id}`,className:"font-mono text-xs text-primary hover:underline",children:T.id})}),a.jsx(qe,{className:"text-[11px] text-muted-foreground",children:(()=>{const V=W_(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(qe,{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(qe,{className:"text-right",children:a.jsxs("div",{className:"flex flex-col items-end gap-1",children:[a.jsx(zs,{rate:T.overallPassRate}),a.jsx(XL,{run:T})]})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:T.totalScenarios}),a.jsx(qe,{className:"text-right font-mono text-sm",children:T.avgToolCalls.toFixed(0)}),a.jsx(qe,{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 H_({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 rge=h.createContext(void 0);function qu(e){const t=h.useContext(rge);return e||t||"ltr"}var jS="rovingFocusGroup.onEntryFocus",age={bubbles:!1,cancelable:!0},bp="RovingFocusGroup",[IN,gB,sge]=Qf(bp),[oge,Gv]=kr(bp,[sge]),[ige,lge]=oge(bp),vB=h.forwardRef((e,t)=>a.jsx(IN.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(IN.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(cge,{...e,ref:t})})}));vB.displayName=bp;var cge=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=Ot(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=gB(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(ige,{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:Ue(e.onMouseDown,()=>{A.current=!0}),onFocus:Ue(e.onFocus,O=>{const D=!A.current;if(O.target===O.currentTarget&&D&&!S){const K=new CustomEvent(jS,age);if(O.currentTarget.dispatchEvent(K),!K.defaultPrevented){const U=k().filter(T=>T.focusable),B=U.find(T=>T.active),Y=U.find(T=>T.id===y),I=[B,Y,...U].filter(Boolean).map(T=>T.ref.current);bB(I,m)}}A.current=!1}),onBlur:Ue(e.onBlur,()=>N(!1))})})}),xB="RovingFocusGroupItem",yB=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=lge(xB,n),p=m.currentTabStopId===f,v=gB(n),{onFocusableItemAdd:x,onFocusableItemRemove:j,currentTabStopId:y}=m;return h.useEffect(()=>{if(r)return x(),()=>j()},[r,x,j]),a.jsx(IN.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:Ue(e.onMouseDown,b=>{r?m.onItemFocus(f):b.preventDefault()}),onFocus:Ue(e.onFocus,()=>m.onItemFocus(f)),onKeyDown:Ue(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){m.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const S=fge(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?pge(C,k+1):C.slice(k+1)}setTimeout(()=>bB(C))}}),children:typeof i=="function"?i({isCurrentTabStop:p,hasTabStop:y!=null}):i})})});yB.displayName=xB;var uge={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function dge(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function fge(e,t,n){const r=dge(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return uge[r]}function bB(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function pge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var wB=vB,jB=yB;function hge(e){const t=mge(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),d=c.find(vge);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 mge(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=yge(s),c=xge(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 gge=Symbol("radix.slottable");function vge(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===gge}function xge(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 yge(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 $N=["Enter"," "],bge=["ArrowDown","PageUp","Home"],SB=["ArrowUp","PageDown","End"],wge=[...bge,...SB],jge={ltr:[...$N,"ArrowRight"],rtl:[...$N,"ArrowLeft"]},Sge={ltr:["ArrowLeft"],rtl:["ArrowRight"]},wp="Menu",[Vf,Nge,Cge]=Qf(wp),[Yl,NB]=kr(wp,[Cge,Ei,Gv]),Yv=Ei(),CB=Gv(),[_ge,Xl]=Yl(wp),[kge,jp]=Yl(wp),_B=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(_ge,{scope:t,open:n,onOpenChange:p,content:d,onContentChange:f,children:a.jsx(kge,{scope:t,onClose:h.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:v,modal:i,children:r})})})};_B.displayName=wp;var Age="MenuAnchor",V_=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Yv(n);return a.jsx(tp,{...s,...r,ref:t})});V_.displayName=Age;var K_="MenuPortal",[Ege,kB]=Yl(K_,{forceMount:void 0}),AB=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=Xl(K_,t);return a.jsx(Ege,{scope:t,forceMount:n,children:a.jsx(ar,{present:n||o.open,children:a.jsx(zl,{asChild:!0,container:s,children:r})})})};AB.displayName=K_;var Ha="MenuContent",[Pge,G_]=Yl(Ha),EB=h.forwardRef((e,t)=>{const n=kB(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(Rge,{...s,ref:t}):a.jsx(Tge,{...s,ref:t})})})})}),Rge=h.forwardRef((e,t)=>{const n=Xl(Ha,e.__scopeMenu),r=h.useRef(null),s=Ot(t,r);return h.useEffect(()=>{const o=r.current;if(o)return sv(o)},[]),a.jsx(Y_,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ue(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Tge=h.forwardRef((e,t)=>{const n=Xl(Ha,e.__scopeMenu);return a.jsx(Y_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Oge=hge("MenuContent.ScrollLock"),Y_=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=CB(n),k=Nge(n),[A,E]=h.useState(null),P=h.useRef(null),O=Ot(t,P,b.onContentChange),D=h.useRef(0),K=h.useRef(""),U=h.useRef(0),B=h.useRef(null),Y=h.useRef("right"),z=h.useRef(0),I=j?op:h.Fragment,T=j?{as:Oge,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=Hge(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&&Kge(M,B.current?.area),[]);return a.jsx(Pge,{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:U,onPointerGraceIntentChange:h.useCallback(M=>{B.current=M},[]),children:a.jsx(I,{...T,children:a.jsx(sp,{asChild:!0,trapped:s,onMountAutoFocus:Ue(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(wB,{asChild:!0,...C,dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:E,onEntryFocus:Ue(d,M=>{S.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(Kg,{role:"menu","aria-orientation":"vertical","data-state":HB(b.open),"data-radix-menu-content":"",dir:S.dir,...N,...y,ref:O,style:{outline:"none",...y.style},onKeyDown:Ue(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||!wge.includes(M.key))return;M.preventDefault();const ue=k().filter(ae=>!ae.disabled).map(ae=>ae.ref.current);SB.includes(M.key)&&ue.reverse(),Uge(ue)}),onBlur:Ue(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(D.current),K.current="")}),onPointerMove:Ue(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}}))})})})})})})});EB.displayName=Ha;var Mge="MenuGroup",X_=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(lt.div,{role:"group",...r,ref:t})});X_.displayName=Mge;var Ige="MenuLabel",PB=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(lt.div,{...r,ref:t})});PB.displayName=Ige;var Ng="MenuItem",X$="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=G_(Ng,e.__scopeMenu),d=Ot(t,o),f=h.useRef(!1),m=()=>{const p=o.current;if(!n&&p){const v=new CustomEvent(X$,{bubbles:!0,cancelable:!0});p.addEventListener(X$,x=>r?.(x),{once:!0}),oC(p,v),v.defaultPrevented?f.current=!1:i.onClose()}};return a.jsx(RB,{...s,ref:d,disabled:n,onClick:Ue(e.onClick,m),onPointerDown:p=>{e.onPointerDown?.(p),f.current=!0},onPointerUp:Ue(e.onPointerUp,p=>{f.current||p.currentTarget?.click()}),onKeyDown:Ue(e.onKeyDown,p=>{const v=c.searchRef.current!=="";n||v&&p.key===" "||$N.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Xv.displayName=Ng;var RB=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,i=G_(Ng,n),c=CB(n),d=h.useRef(null),f=Ot(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(jB,{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:Ue(e.onPointerMove,Kf(j=>{r?i.onItemLeave(j):(i.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ue(e.onPointerLeave,Kf(j=>i.onItemLeave(j))),onFocus:Ue(e.onFocus,()=>p(!0)),onBlur:Ue(e.onBlur,()=>p(!1))})})})}),$ge="MenuCheckboxItem",TB=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return a.jsx(DB,{scope:e.__scopeMenu,checked:n,children:a.jsx(Xv,{role:"menuitemcheckbox","aria-checked":Cg(n)?"mixed":n,...s,ref:t,"data-state":J_(n),onSelect:Ue(s.onSelect,()=>r?.(Cg(n)?!0:!n),{checkForDefaultPrevented:!1})})})});TB.displayName=$ge;var OB="MenuRadioGroup",[Dge,Lge]=Yl(OB,{value:void 0,onValueChange:()=>{}}),MB=h.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=Zn(r);return a.jsx(Dge,{scope:e.__scopeMenu,value:n,onValueChange:o,children:a.jsx(X_,{...s,ref:t})})});MB.displayName=OB;var IB="MenuRadioItem",$B=h.forwardRef((e,t)=>{const{value:n,...r}=e,s=Lge(IB,e.__scopeMenu),o=n===s.value;return a.jsx(DB,{scope:e.__scopeMenu,checked:o,children:a.jsx(Xv,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":J_(o),onSelect:Ue(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});$B.displayName=IB;var Q_="MenuItemIndicator",[DB,Fge]=Yl(Q_,{checked:!1}),LB=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=Fge(Q_,n);return a.jsx(ar,{present:r||Cg(o.checked)||o.checked===!0,children:a.jsx(lt.span,{...s,ref:t,"data-state":J_(o.checked)})})});LB.displayName=Q_;var zge="MenuSeparator",FB=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(lt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});FB.displayName=zge;var Bge="MenuArrow",zB=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Yv(n);return a.jsx(Gg,{...s,...r,ref:t})});zB.displayName=Bge;var qge="MenuSub",[Rwe,BB]=Yl(qge),Wd="MenuSubTrigger",qB=h.forwardRef((e,t)=>{const n=Xl(Wd,e.__scopeMenu),r=jp(Wd,e.__scopeMenu),s=BB(Wd,e.__scopeMenu),o=G_(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(V_,{asChild:!0,...f,children:a.jsx(RB,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":HB(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:Ue(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:Ue(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:Ue(e.onKeyDown,p=>{const v=o.searchRef.current!=="";e.disabled||v&&p.key===" "||jge[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});qB.displayName=Wd;var UB="MenuSubContent",WB=h.forwardRef((e,t)=>{const n=kB(Ha,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Xl(Ha,e.__scopeMenu),i=jp(Ha,e.__scopeMenu),c=BB(UB,e.__scopeMenu),d=h.useRef(null),f=Ot(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(Y_,{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:Ue(e.onFocusOutside,m=>{m.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Ue(e.onEscapeKeyDown,m=>{i.onClose(),m.preventDefault()}),onKeyDown:Ue(e.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),v=Sge[i.dir].includes(m.key);p&&v&&(o.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});WB.displayName=UB;function HB(e){return e?"open":"closed"}function Cg(e){return e==="indeterminate"}function J_(e){return Cg(e)?"indeterminate":e?"checked":"unchecked"}function Uge(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Wge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Hge(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=Wge(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 Vge(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 Kge(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Vge(n,t)}function Kf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Gge=_B,Yge=V_,Xge=AB,Qge=EB,Jge=X_,Zge=PB,eve=Xv,tve=TB,nve=MB,rve=$B,ave=LB,sve=FB,ove=zB,ive=qB,lve=WB,Qv="DropdownMenu",[cve]=kr(Qv,[NB]),Gr=NB(),[uve,VB]=cve(Qv),KB=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(uve,{scope:t,triggerId:fr(),triggerRef:f,contentId:fr(),open:m,onOpenChange:p,onOpenToggle:h.useCallback(()=>p(v=>!v),[p]),modal:c,children:a.jsx(Gge,{...d,open:m,onOpenChange:p,dir:r,modal:c,children:n})})};KB.displayName=Qv;var GB="DropdownMenuTrigger",YB=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=VB(GB,n),i=Gr(n);return a.jsx(Yge,{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:Ue(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(o.onOpenToggle(),o.open||c.preventDefault())}),onKeyDown:Ue(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&o.onOpenToggle(),c.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});YB.displayName=GB;var dve="DropdownMenuPortal",XB=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Gr(t);return a.jsx(Xge,{...r,...n})};XB.displayName=dve;var QB="DropdownMenuContent",JB=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=VB(QB,n),o=Gr(n),i=h.useRef(!1);return a.jsx(Qge,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:t,onCloseAutoFocus:Ue(e.onCloseAutoFocus,c=>{i.current||s.triggerRef.current?.focus(),i.current=!1,c.preventDefault()}),onInteractOutside:Ue(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)"}})});JB.displayName=QB;var fve="DropdownMenuGroup",pve=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(Jge,{...s,...r,ref:t})});pve.displayName=fve;var hve="DropdownMenuLabel",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="DropdownMenuItem",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="DropdownMenuCheckboxItem",t6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(tve,{...s,...r,ref:t})});t6.displayName=gve;var vve="DropdownMenuRadioGroup",xve=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(nve,{...s,...r,ref:t})});xve.displayName=vve;var yve="DropdownMenuRadioItem",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="DropdownMenuItemIndicator",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="DropdownMenuSeparator",a6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(sve,{...s,...r,ref:t})});a6.displayName=wve;var jve="DropdownMenuArrow",Sve=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(ove,{...s,...r,ref:t})});Sve.displayName=jve;var Nve="DropdownMenuSubTrigger",s6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(ive,{...s,...r,ref:t})});s6.displayName=Nve;var Cve="DropdownMenuSubContent",o6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(lve,{...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)"}})});o6.displayName=Cve;var _ve=KB,kve=YB,Ave=XB,i6=JB,l6=ZB,c6=e6,u6=t6,d6=n6,f6=r6,p6=a6,h6=s6,m6=o6;const Sp=_ve,Np=kve,Eve=h.forwardRef(({className:e,inset:t,children:n,...r},s)=>a.jsxs(h6,{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"})]}));Eve.displayName=h6.displayName;const Pve=h.forwardRef(({className:e,...t},n)=>a.jsx(m6,{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}));Pve.displayName=m6.displayName;const Uu=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(Ave,{children:a.jsx(i6,{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=i6.displayName;const Ir=h.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(c6,{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=c6.displayName;const Rve=h.forwardRef(({className:e,children:t,checked:n,...r},s)=>a.jsxs(u6,{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(f6,{children:a.jsx(Gc,{className:"h-4 w-4"})})}),t]}));Rve.displayName=u6.displayName;const Tve=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(d6,{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(f6,{children:a.jsx(yW,{className:"h-2 w-2 fill-current"})})}),t]}));Tve.displayName=d6.displayName;const g6=h.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(l6,{ref:r,className:$e("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));g6.displayName=l6.displayName;const v6=h.forwardRef(({className:e,...t},n)=>a.jsx(p6,{ref:n,className:$e("-mx-1 my-1 h-px bg-muted",e),...t}));v6.displayName=p6.displayName;function Gf(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ove(e){const t=Mve(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),d=c.find($ve);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 Mve(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=Lve(s),c=Dve(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 Ive=Symbol("radix.slottable");function $ve(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ive}function Dve(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 Lve(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 Fve=[" ","Enter","ArrowUp","ArrowDown"],zve=[" ","Enter"],Rl="Select",[Zv,ex,Bve]=Qf(Rl),[Wu]=kr(Rl,[Bve,Ei]),tx=Ei(),[qve,Ii]=Wu(Rl),[Uve,Wve]=Wu(Rl),x6=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}),U=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(qve,{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:U,disabled:v,children:[a.jsx(Zv.Provider,{scope:t,children:a.jsx(Uve,{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(q6,{"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]})})};x6.displayName=Rl;var y6="SelectTrigger",b6=h.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,o=tx(n),i=Ii(y6,n),c=i.disabled||r,d=Ot(t,i.onTriggerChange),f=ex(n),m=h.useRef("touch"),[p,v,x]=W6(y=>{const b=f().filter(C=>!C.disabled),S=b.find(C=>C.value===i.value),N=H6(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":U6(i.value)?"":void 0,...s,ref:d,onClick:Ue(s.onClick,y=>{y.currentTarget.focus(),m.current!=="mouse"&&j(y)}),onPointerDown:Ue(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:Ue(s.onKeyDown,y=>{const b=p.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&v(y.key),!(b&&y.key===" ")&&Fve.includes(y.key)&&(j(),y.preventDefault())})})})});b6.displayName=y6;var w6="SelectValue",j6=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:o,placeholder:i="",...c}=e,d=Ii(w6,n),{onValueNodeHasChildrenChange:f}=d,m=o!==void 0,p=Ot(t,d.onValueNodeChange);return pr(()=>{f(m)},[f,m]),a.jsx(lt.span,{...c,ref:p,style:{pointerEvents:"none"},children:U6(d.value)?a.jsx(a.Fragment,{children:i}):o})});j6.displayName=w6;var Hve="SelectIcon",S6=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return a.jsx(lt.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});S6.displayName=Hve;var Vve="SelectPortal",N6=e=>a.jsx(zl,{asChild:!0,...e});N6.displayName=Vve;var Tl="SelectContent",C6=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(_6,{scope:e.__scopeSelect,children:a.jsx(Zv.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),o):null}return a.jsx(k6,{...e,ref:t})});C6.displayName=Tl;var vs=10,[_6,$i]=Wu(Tl),Kve="SelectContentImpl",Gve=Ove("SelectContent.RemoveScroll"),k6=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=Ot(t,ae=>k(ae)),[O,D]=h.useState(null),[K,U]=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,$]=W6(ae=>{const ye=B().filter(De=>!De.disabled),se=ye.find(De=>De.ref.current===document.activeElement),de=H6(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)&&U(ae)},[N.value]),oe=r==="popper"?DN:A6,ue=oe===DN?{side:c,sideOffset:d,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:v,collisionPadding:x,sticky:j,hideWhenDetached:y,avoidCollisions:b}:{};return a.jsx(_6,{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:Gve,allowPinchZoom:!0,children:a.jsx(sp,{asChild:!0,trapped:N.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:Ue(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:Ue(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()}})})})})})})});k6.displayName=Kve;var Yve="SelectItemAlignedPosition",A6=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=Ot(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 U=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=U.length>0&&b===U[U.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=U.length>0&&b===U[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(Qve,{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}})})})});A6.displayName=Yve;var Xve="SelectPopperPosition",DN=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)"}})});DN.displayName=Xve;var[Qve,Z_]=Wu(Tl,{}),LN="SelectViewport",E6=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,o=$i(LN,n),i=Z_(LN,n),c=Ot(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:Ue(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})})})]})});E6.displayName=LN;var P6="SelectGroup",[Jve,Zve]=Wu(P6),exe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=fr();return a.jsx(Jve,{scope:n,id:s,children:a.jsx(lt.div,{role:"group","aria-labelledby":s,...r,ref:t})})});exe.displayName=P6;var R6="SelectLabel",T6=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Zve(R6,n);return a.jsx(lt.div,{id:s.id,...r,ref:t})});T6.displayName=R6;var _g="SelectItem",[txe,O6]=Wu(_g),M6=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=Ot(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(txe,{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:Ue(i.onFocus,()=>x(!0)),onBlur:Ue(i.onBlur,()=>x(!1)),onClick:Ue(i.onClick,()=>{b.current!=="mouse"&&S()}),onPointerUp:Ue(i.onPointerUp,()=>{b.current==="mouse"&&S()}),onPointerDown:Ue(i.onPointerDown,N=>{b.current=N.pointerType}),onPointerMove:Ue(i.onPointerMove,N=>{b.current=N.pointerType,s?d.onItemLeave?.():b.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ue(i.onPointerLeave,N=>{N.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Ue(i.onKeyDown,N=>{d.searchRef?.current!==""&&N.key===" "||(zve.includes(N.key)&&S(),N.key===" "&&N.preventDefault())})})})})});M6.displayName=_g;var Hd="SelectItemText",I6=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...o}=e,i=Ii(Hd,n),c=$i(Hd,n),d=O6(Hd,n),f=Wve(Hd,n),[m,p]=h.useState(null),v=Ot(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]})});I6.displayName=Hd;var $6="SelectItemIndicator",D6=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return O6($6,n).isSelected?a.jsx(lt.span,{"aria-hidden":!0,...r,ref:t}):null});D6.displayName=$6;var FN="SelectScrollUpButton",L6=h.forwardRef((e,t)=>{const n=$i(FN,e.__scopeSelect),r=Z_(FN,e.__scopeSelect),[s,o]=h.useState(!1),i=Ot(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(z6,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null});L6.displayName=FN;var zN="SelectScrollDownButton",F6=h.forwardRef((e,t)=>{const n=$i(zN,e.__scopeSelect),r=Z_(zN,e.__scopeSelect),[s,o]=h.useState(!1),i=Ot(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(z6,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null});F6.displayName=zN;var z6=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:Ue(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:Ue(s.onPointerMove,()=>{o.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:Ue(s.onPointerLeave,()=>{d()})})}),nxe="SelectSeparator",B6=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(lt.div,{"aria-hidden":!0,...r,ref:t})});B6.displayName=nxe;var BN="SelectArrow",rxe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=tx(n),o=Ii(BN,n),i=$i(BN,n);return o.open&&i.position==="popper"?a.jsx(Gg,{...s,...r,ref:t}):null});rxe.displayName=BN;var axe="SelectBubbleInput",q6=h.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=h.useRef(null),o=Ot(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:{...GD,...n.style},ref:o,defaultValue:t})});q6.displayName=axe;function U6(e){return e===""||e===void 0}function W6(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 H6(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=sxe(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 sxe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var oxe=x6,V6=b6,ixe=j6,lxe=S6,cxe=N6,K6=C6,uxe=E6,G6=T6,Y6=M6,dxe=I6,fxe=D6,X6=L6,Q6=F6,J6=B6;const In=oxe,$n=ixe,An=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(V6,{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(lxe,{asChild:!0,children:a.jsx(Zt,{className:"h-4 w-4 opacity-50"})})]}));An.displayName=V6.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(Ns,{className:"h-4 w-4"})}));Z6.displayName=X6.displayName;const e8=h.forwardRef(({className:e,...t},n)=>a.jsx(Q6,{ref:n,className:$e("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Zt,{className:"h-4 w-4"})}));e8.displayName=Q6.displayName;const En=h.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>a.jsx(cxe,{children:a.jsxs(K6,{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(Z6,{}),a.jsx(uxe,{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(e8,{})]})}));En.displayName=K6.displayName;const pxe=h.forwardRef(({className:e,...t},n)=>a.jsx(G6,{ref:n,className:$e("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));pxe.displayName=G6.displayName;const ut=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(Y6,{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(fxe,{children:a.jsx(Gc,{className:"h-4 w-4"})})}),a.jsx(dxe,{children:t})]}));ut.displayName=Y6.displayName;const hxe=h.forwardRef(({className:e,...t},n)=>a.jsx(J6,{ref:n,className:$e("-mx-1 my-1 h-px bg-muted",e),...t}));hxe.displayName=J6.displayName;function qN(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,mxe="(root)",t8="__ROOT__",Q$="mcplab.configurations.collapsedSuites",SS=e=>e.suitePath&&e.suitePath.trim().length>0?e.suitePath.trim():null,rl=e=>e??mxe,NS=e=>e===null?t8:`suite:${e}`,gxe=e=>e===t8?null:e.startsWith("suite:")?e.slice(6):null,vxe=(e,t)=>t===null?e===null:e===null?!1:e===t||e.startsWith(`${t}/`),xxe=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},yxe=e=>xxe([e]),bxe=e=>{const t=yxe(e);return t?{href:`/results?scenario=${encodeURIComponent(t)}`,tooltipLabel:`Open results filtered by scenario ${t}`}:{href:"/results",tooltipLabel:"Open results"}},J$=["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 wxe(e){if(e===null)return"bg-slate-400";const t=e.split("").reduce((n,r)=>(n+r.charCodeAt(0))%J$.length,0);return J$[t]??"bg-slate-400"}const jxe=()=>{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(Q$);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 U=async(G,re)=>{await t(G),Ie({title:"Deleted",description:`"${re}" has been removed.`})},B=async G=>{const re=await n(G);Ie({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:gxe(x),ue=rl(re);return oe!==void 0&&!vxe(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(Zt,{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?qN(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),Ie({title:"Queued",description:`"${oe}" added to run queue.`})}catch(ye){Ie({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(Q$,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){Ie({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=qN(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;Ie({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){Ie({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(b5,{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(H_,{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(OW,{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(Je,{children:a.jsx(Ze,{className:"p-0",children:a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Ht,{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(Ht,{className:"bg-muted/40 hover:bg-muted/40",children:a.jsx(qe,{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 ${wxe(G)}`,"aria-hidden":"true"}),G===null?a.jsx(SW,{className:"h-3.5 w-3.5 text-muted-foreground","aria-hidden":"true"}):a.jsx(wW,{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=bxe(se);return a.jsxs(Ht,{children:[a.jsx(qe,{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(Qe,{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(qe,{className:"text-right font-mono text-sm",children:z(se)}),a.jsx(qe,{className:"text-right font-mono text-sm",children:Y(se)}),a.jsx(qe,{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(qe,{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(qe,{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:()=>{U(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(_W,{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(Ht,{children:a.jsx(qe,{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(Ht,{children:a.jsx(qe,{colSpan:6,className:"text-center py-12 text-muted-foreground",children:"No MCP evaluations match this filter."})}),r&&a.jsx(Ht,{children:a.jsx(qe,{colSpan:6,className:"text-center py-12 text-muted-foreground",children:"Loading MCP evaluations..."})})]})]})})})]})};var Sxe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Nxe=Sxe.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}},{}),Cxe="Label",n8=h.forwardRef((e,t)=>a.jsx(Nxe.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));n8.displayName=Cxe;var r8=n8;const _xe=Bl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),We=h.forwardRef(({className:e,...t},n)=>a.jsx(r8,{ref:n,className:$e(_xe(),e),...t}));We.displayName=r8.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",[kxe]=kr(nx,[Gv]),a8=Gv(),[Axe,ek]=kxe(nx),s8=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(Axe,{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})})});s8.displayName=nx;var o8="TabsList",i8=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=ek(o8,n),i=a8(n);return a.jsx(wB,{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})})});i8.displayName=o8;var l8="TabsTrigger",c8=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,i=ek(l8,n),c=a8(n),d=f8(i.baseId,r),f=p8(i.baseId,r),m=r===i.value;return a.jsx(jB,{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:Ue(e.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?i.onValueChange(r):p.preventDefault()}),onKeyDown:Ue(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(r)}),onFocus:Ue(e.onFocus,()=>{const p=i.activationMode!=="manual";!m&&!s&&p&&i.onValueChange(r)})})})});c8.displayName=l8;var u8="TabsContent",d8=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...i}=e,c=ek(u8,n),d=f8(c.baseId,r),f=p8(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})})});d8.displayName=u8;function f8(e,t){return`${e}-trigger-${t}`}function p8(e,t){return`${e}-content-${t}`}var Exe=s8,h8=i8,m8=c8,g8=d8;const rx=Exe,Cp=h.forwardRef(({className:e,...t},n)=>a.jsx(h8,{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=h8.displayName;const Vs=h.forwardRef(({className:e,...t},n)=>a.jsx(m8,{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=m8.displayName;const Yf=h.forwardRef(({className:e,...t},n)=>a.jsx(g8,{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=g8.displayName;const Pxe={openai:"OpenAI",anthropic:"Anthropic",azure:"Azure OpenAI",azure_openai:"Azure OpenAI",google:"Google"};function kg(e){return Pxe[e]??e}const Z$={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 v8({provider:e}){return a.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${Z$[e]??Z$.custom}`,children:kg(e)})}var ax="Checkbox",[Rxe]=kr(ax),[Txe,tk]=Rxe(ax);function Oxe(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(Txe,{scope:t,...k,children:Mxe(p)?p(k):r})}var x8="CheckboxTrigger",y8=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}=tk(x8,e),y=Ot(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":N8(d),"data-disabled":c?"":void 0,disabled:c,value:i,...r,ref:y,onKeyDown:Ue(t,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Ue(n,S=>{p(N=>bi(N)?!0:!N),j&&x&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})})});y8.displayName=x8;var nk=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(Oxe,{__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(y8,{...p,ref:t,__scopeCheckbox:n}),v&&a.jsx(S8,{__scopeCheckbox:n})]})})});nk.displayName=ax;var b8="CheckboxIndicator",w8=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,o=tk(b8,n);return a.jsx(ar,{present:r||bi(o.checked)||o.checked===!0,children:a.jsx(lt.span,{"data-state":N8(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});w8.displayName=b8;var j8="CheckboxBubbleInput",S8=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}=tk(j8,e),j=Ot(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%)"}})});S8.displayName=j8;function Mxe(e){return typeof e=="function"}function bi(e){return e==="indeterminate"}function N8(e){return bi(e)?"indeterminate":e?"checked":"unchecked"}const wr=h.forwardRef(({className:e,...t},n)=>a.jsx(nk,{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(w8,{className:$e("flex items-center justify-center text-current"),children:a.jsx(Gc,{className:"h-4 w-4"})})}));wr.displayName=nk.displayName;var sx="Collapsible",[Ixe]=kr(sx),[$xe,rk]=Ixe(sx),C8=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($xe,{scope:n,disabled:o,contentId:fr(),open:d,onOpenToggle:h.useCallback(()=>f(m=>!m),[f]),children:a.jsx(lt.div,{"data-state":sk(d),"data-disabled":o?"":void 0,...c,ref:t})})});C8.displayName=sx;var _8="CollapsibleTrigger",k8=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=rk(_8,n);return a.jsx(lt.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":sk(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:Ue(e.onClick,s.onOpenToggle)})});k8.displayName=_8;var ak="CollapsibleContent",A8=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=rk(ak,e.__scopeCollapsible);return a.jsx(ar,{present:n||s.open,children:({present:o})=>a.jsx(Dxe,{...r,ref:t,present:o})})});A8.displayName=ak;var Dxe=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=e,i=rk(ak,n),[c,d]=h.useState(r),f=h.useRef(null),m=Ot(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":sk(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 sk(e){return e?"open":"closed"}var Lxe=C8;const ws=Lxe,za=k8,js=A8;function Fxe(e){return e.length>0?`Tool sequence · ${e.join(" -> ")}`:"Tool sequence"}function Va({text:e,variant:t="assistant",className:n}){const r=zxe(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:Bxe(s,o,t)},`md-${o}`))})}function zxe(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(eD(t,r)){const v=tD(t[r]);r+=2;const x=[];for(;r<t.length&&t[r].includes("|")&&!s(t[r]);)x.push(tD(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(">")||eD(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 eD(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 tD(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(t=>t.trim())}function Bxe(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 E8({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(pC,{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 UN({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(Zt,{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 P8(){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 qxe({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(Zt,{className:"h-3 w-3"})]})}),a.jsxs(Uu,{align:"start",className:s,children:[a.jsx(g6,{children:t}),a.jsx(v6,{}),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 R8({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(qxe,{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(PW,{className:"h-4 w-4"})})]})]})}const Uxe=iv,Wxe=lv,T8=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}));T8.displayName=Ou.displayName;const O8=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(Wxe,{children:[a.jsx(T8,{}),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"})]})]})]}));O8.displayName=Mu.displayName;const M8=({className:e,...t})=>a.jsx("div",{className:$e("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});M8.displayName="DialogHeader";const I8=h.forwardRef(({className:e,...t},n)=>a.jsx(ip,{ref:n,className:$e("text-lg font-semibold leading-none tracking-tight",e),...t}));I8.displayName=ip.displayName;const $8=h.forwardRef(({className:e,...t},n)=>a.jsx(lp,{ref:n,className:$e("text-sm text-muted-foreground",e),...t}));$8.displayName=lp.displayName;function Hxe(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var ok="ScrollArea",[D8]=kr(ok),[Vxe,is]=D8(ok),L8=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=Ot(t,U=>d(U)),K=qu(s);return a.jsx(Vxe,{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}})})});L8.displayName=ok;var F8="ScrollAreaViewport",z8=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:s,...o}=e,i=is(F8,n),c=h.useRef(null),d=Ot(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})})]})});z8.displayName=F8;var eo="ScrollAreaScrollbar",ik=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(Kxe,{...r,ref:t,forceMount:n}):s.type==="scroll"?a.jsx(Gxe,{...r,ref:t,forceMount:n}):s.type==="auto"?a.jsx(B8,{...r,ref:t,forceMount:n}):s.type==="always"?a.jsx(lk,{...r,ref:t}):null});ik.displayName=eo;var Kxe=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(B8,{"data-state":o?"visible":"hidden",...r,ref:t})})}),Gxe=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]=Hxe("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(lk,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Ue(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Ue(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),B8=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(lk,{"data-state":o?"visible":"hidden",...s,ref:t})})}),lk=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=V8(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 eye(v,i.current,c,x)}return n==="horizontal"?a.jsx(Yxe,{...m,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const v=s.viewport.scrollLeft,x=nD(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(Xxe,{...m,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const v=s.viewport.scrollTop,x=nD(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}),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=Ot(t,d,o.onScrollbarXChange);return h.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(U8,{"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),G8(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)}})}})}),Xxe=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=Ot(t,d,o.onScrollbarYChange);return h.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(U8,{"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),G8(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)}})}})}),[Qxe,q8]=D8(eo),U8=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=Ot(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,U=D.clientY-S.current.top;f({x:K,y:U})}}return h.useEffect(()=>{const D=K=>{const U=K.target;j?.contains(U)&&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(Qxe,{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:Ue(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:Ue(e.onPointerMove,O),onPointerUp:Ue(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",W8=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=q8(Ag,e.__scopeScrollArea);return a.jsx(ar,{present:n||s.hasThumb,children:a.jsx(Jxe,{ref:t,...r})})}),Jxe=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...s}=e,o=is(Ag,n),i=q8(Ag,n),{onThumbPositionChange:c}=i,d=Ot(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=tye(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:Ue(e.onPointerDownCapture,p=>{const x=p.target.getBoundingClientRect(),j=p.clientX-x.left,y=p.clientY-x.top;i.onThumbPointerDown({x:j,y})}),onPointerUp:Ue(e.onPointerUp,i.onThumbPointerUp)})});W8.displayName=Ag;var ck="ScrollAreaCorner",H8=h.forwardRef((e,t)=>{const n=is(ck,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(Zxe,{...e,ref:t}):null});H8.displayName=ck;var Zxe=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,s=is(ck,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 V8(e,t){const n=e/t;return isNaN(n)?0:n}function ox(e){const t=V8(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function eye(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 K8([d,f],p)(e)}function nD(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 K8([0,i],[0,c])(f)}function K8(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 G8(e,t){return e>0&&e<t}var tye=(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 Y8=L8,nye=z8,rye=H8;const uk=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(Y8,{ref:r,className:$e("relative overflow-hidden",e),...n,children:[a.jsx(nye,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(X8,{}),a.jsx(rye,{})]}));uk.displayName=Y8.displayName;const X8=h.forwardRef(({className:e,orientation:t="vertical",...n},r)=>a.jsx(ik,{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(W8,{className:"relative flex-1 rounded-full bg-border"})}));X8.displayName=ik.displayName;function WN(e){return e instanceof Error&&e.name==="AbortError"||typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError"}function aye(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 Q8({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=aye(o,r,lx);return{rule:o,status:i?.status??"not_evaluated",failureReason:i?.reason}}):e.map(o=>{const i=oye(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 zL(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 sye(e){return zL(e).replace(/^Tool sequence · /,"")}function oye(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: ${sye(e.sequence??[])}`)||o.startsWith("Required tool in sequence not used:")):t.find(o=>o.startsWith(r))}async function iye(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 lye=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 iye({sessionId:x,source:n,serverName:v.serverName,onLaunchUrl:j,timeoutMs:Math.max(1e4,c-Date.now())})}await new Promise(v=>{window.setTimeout(v,lye)})}throw new Error("OAuth login timed out before all required servers were authorized.")}const cye=[{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 J8(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 uye(e){const t=[];let n=0;for(const r of e){if(r.type==="tool_sequence"){const s=J8(r);s.length>0?t.push({type:"tool_sequence",sequence:s}):n+=1;continue}t.push(r)}return{rules:t,skippedToolSequences:n}}function dye(e){if(e.type==="tool_sequence"){const t=J8(e);return t.length>0?`Tool sequence · ${t.join(" -> ")}`:"Tool sequence · No tool steps"}return lx(e)}function fye({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),U=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(Ge=>Ge.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||Ie({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=++U.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(Ge=>Ge&&{...Ge,messages:[...Ge.messages,kt]}),b(""),N(!0);try{const Ge=await m.sendScenarioAssistantMessage(p,Se,tt.signal);if(tt.signal.aborted||K.current?.id!==at)return;H(Ge.session)}catch(Ge){if(WN(Ge)||tt.signal.aborted||K.current?.id!==at)return;j(ke=>ke&&{...ke,messages:ke.messages.filter(Pe=>Pe.id!==it)}),b(ke=>ke.trim()?ke:Se),Ie({title:"Scenario Assistant error",description:Ge instanceof Error?Ge.message:String(Ge),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){Ie({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){Ie({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){Ie({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 Ge=uye(tt??Se.evalRules.replacement);f({evalRules:it==="append"?[...s.evalRules,...Ge.rules]:Ge.rules}),Ge.skippedToolSequences>0&&Ie({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 Ge=`${ve}:${at}`;E(ke=>new Set([...ke,Ge]))}Ie({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]))}Ie({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(Uxe,{open:e,onOpenChange:de,children:a.jsxs(O8,{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(kW,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Minimize"})]}),a.jsx(M8,{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(I8,{className:"flex items-center gap-2",children:[a.jsx(oa,{className:"h-4 w-4"}),"Scenario Assistant"]}),a.jsx($8,{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(We,{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(uk,{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(ke=>(x?.pendingToolCalls??[]).find(Pe=>Pe.id===ke)).filter(ke=>!!ke),tt=Se.map(ke=>x.pendingToolCalls.find(Pe=>Pe.id===ke)??x.pendingToolCalls.find(Pe=>Pe.id===ke)).filter(Boolean);if(!(ve.role==="assistant"&&Se.length>0))return a.jsx("div",{className:"space-y-2",children:a.jsx(gye,{message:ve})});const kt=at.length,Ge=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:[Ge," 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((ke,Pe)=>a.jsx(UN,{call:ke,loading:S,description:Pe===0?ve.text:void 0,onApprove:et=>{re(et)},onDeny:et=>{oe(et)}},ke.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(pye,{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(hye,{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(mye,{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(UN,{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(P8,{}),a.jsx("div",{ref:P})]})}),a.jsx(R8,{input:y,onInputChange:b,onSend:()=>{F(y)},onCancel:p&&C?M:void 0,inputPlaceholder:"Get assistance with creating or refining this scenario ...",snippets:cye,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 pye({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 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:"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=dye(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 mye({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 gye({message:e}){const t=async s=>{try{await navigator.clipboard.writeText(s),Ie({title:"Copied"})}catch(o){Ie({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(E8,{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 HN(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 vye({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(Zt,{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(VN,{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(Zt,{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(Qe,{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(xye,{item:i,fallbackUserPrompt:t},i.id))})})]})})]})}function xye({item:e,fallbackUserPrompt:t}){if(e.kind==="tool_call"){const d=rD(e,"input");return a.jsx(sD,{variant:"call",title:`Tool call · ${e.toolName||"unknown"}${d}`,text:e.text})}if(e.kind==="tool_result"){const d=rD(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(sD,{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=aD(e.text,e.kind),s=t?aD(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(VN,{text:o,maxLength:280,className:"text-xs"}):a.jsx(VN,{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 rD(e,t){const n=t==="input"?e.estimatedTokens?.inputTokens:e.estimatedTokens?.outputTokens;return typeof n!="number"?"":` · estimated ${na(n)} tokens`}function aD(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 sD({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 VN({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 Z8=["image/jpeg","image/png","image/gif","image/webp"],eq=["application/pdf","text/plain","text/markdown","text/csv"];function yye(e){return Z8.includes(e)||eq.includes(e)}function oD({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 bye=()=>({id:`scn-${Date.now()}`,name:"",serverIds:[],prompt:"",evalRules:[],extractRules:[]});function tq(e){return Fxe(e).replace(/^Tool sequence · /,"")}function pm(e){return e.startsWith("tool_input_")}function iD(e){const t=e.trim();if(t)return t==="true"?!0:t==="false"?!1:Number.isNaN(Number(t))?t:Number(t)}function KN({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,bye()]),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(wye,{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 wye({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,U]=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,Ge]=h.useState(null),[ke,Pe]=h.useState(""),[et,ht]=h.useState(""),[zt,Bt]=h.useState(!1),[Nt,an]=h.useState(f||o[0]?.id||""),[sn,Ut]=h.useState(!1),[nn,rn]=h.useState(null),[on,_e]=h.useState(""),Be=h.useRef(null);function Ye(ie){if(!ie)return;const nt=Array.from(ie),Xt=new Array(nt.length).fill(null);let Pt=0,Ft=0;const tn=()=>{const sr=Xt.filter(Sn=>Sn!==null);sr.length>0?(x({attachments:[...e.attachments??[],...sr]}),Ft>0&&Ie({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&&Ie({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,vt=Te.indexOf(","),bt=vt>=0?Te.slice(vt+1):"";if(bt){const vn=Te.slice(0,vt).replace("data:","").replace(";base64",""),fn=vn.startsWith("image/");yye(vn)?Xt[Sn]={type:fn?"image":"document",media_type:vn,data:bt,name:sr.name}:Ft++}++Pt===nt.length&&tn()},ne.onerror=()=>{++Pt===nt.length&&tn()},ne.readAsDataURL(sr)})}function Et(ie){x({attachments:(e.attachments??[]).filter((nt,Xt)=>Xt!==ie)})}const[ft,fe]=h.useState(null),[Oe,Ke]=h.useState(!S),q=ie=>{const nt=ie.target;nt&&(nt.closest("button, a, input, select, textarea, [role='button']")||Ke(Xt=>!Xt))},le=ie=>ie?e.evalRules.findIndex(nt=>nt===ie):-1,pe=()=>{if(pm(k)){const Pt=O.trim();if(!Pt)return;let Ft;if(k==="tool_input_jsonpath"){const Sn=K.trim();if(!Sn)return;const ne=iD(B);Ft={type:k,tool:Pt,path:Sn,...ne!==void 0?{equals:ne}:{}}}else{const Sn=E.trim();if(!Sn)return;Ft={type:k,tool:Pt,value:Sn}}const tn=[...e.evalRules],sr=le(de);sr>=0?tn[sr]=Ft:tn.push(Ft),x({evalRules:tn}),D(""),U(""),P(""),Y(""),De(null),A("required_tool");return}if(k==="response_jsonpath"||k==="response_jsonpath_exists"||k==="response_jsonpath_not_exists"){const Pt=K.trim();if(!Pt)return;if(k==="response_jsonpath"){const Ft=iD(B);x({evalRules:[...e.evalRules,{type:k,path:Pt,...Ft!==void 0?{equals:Ft}:{}}]})}else x({evalRules:[...e.evalRules,{type:k,path:Pt}]});U(""),Y("");return}if(k==="agent_check"){const Pt=z.trim(),Ft=T.trim();if(!Pt||!Ft)return;const tn=[...e.evalRules],sr={type:"agent_check",label:Pt,prompt:Ft},Sn=le(ue);Sn>=0?tn[Sn]=sr:tn.push(sr),x({evalRules:tn}),I(""),V(""),ae(null),se(!1),A("required_tool");return}if(k==="tool_sequence"){const Pt=X.map(Ft=>Ft.trim()).filter(Ft=>typeof Ft=="string"&&Ft.length>0);if(Pt.length===0)return;He(Pt);return}if(!E.trim())return;const ie=[...e.evalRules],nt={type:k,value:E.trim()},Xt=le(de);Xt>=0?ie[Xt]=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 Xt=ie+nt;$(Pt=>{if(Xt<0||Xt>=Pt.length)return Pt;const Ft=[...Pt],[tn]=Ft.splice(ie,1);return Ft.splice(Xt,0,tn),Ft})},be=ie=>{$(nt=>nt.filter((Xt,Pt)=>Pt!==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??[]:[],Ae=we>=0,He=ie=>{const nt=[...e.evalRules],Xt=ie.length>0?{type:"tool_sequence",sequence:ie}:null,Pt=le(re),Ft=Pt>=0?Pt:we;Ft>=0?Xt?nt[Ft]=Xt:nt.splice(Ft,1):Xt&&nt.push(Xt),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((Pt,Ft)=>Ft!==ie),Xt=nt.some(Pt=>Pt.type==="agent_check");x({evalRules:nt,agentContext:Xt?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=()=>{!ke.trim()||!et.trim()||(x({extractRules:[...e.extractRules,{name:ke.trim(),pattern:et.trim()}]}),Pe(""),ht(""))},Wt=ie=>{x({extractRules:e.extractRules.filter((nt,Xt)=>Xt!==ie)})},Re=ie=>{const nt=e.serverIds.includes(ie)?e.serverIds.filter(Xt=>Xt!==ie):[...e.serverIds,ie];x({serverIds:nt})},Jt={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"},Yt=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&&(Bt(!0),ls(ie))},[m,zi]),h.useEffect(()=>{p&&p!==Ar&&(Bt(!0),Ho(p))},[p,Ar]),h.useEffect(()=>{at(null),Ge(null),ve("")},[e.serverIds.join("|")]),h.useEffect(()=>{ve(""),U(""),Y(""),M("")},[k]),h.useEffect(()=>{Nt&&Fi.includes(Nt)||an(f||o[0]?.id||"")},[Nt,f,o,Fi]);const jn=async()=>{if(Nt){Ut(!0),rn(null);try{const ie=e.serverIds.filter(Xt=>i.find(Ft=>Ft.id===Xt)?.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){rn(ie instanceof Error?ie.message:String(ie))}finally{Ut(!1)}}},Vu=()=>{if(!ft)return;const ie=lD(e.evalRules,ft.run.failureReasons,ft.run.checkResults),nt=ie.length?ie.map(tn=>`${tn.status.toUpperCase()} - ${jye(tn.rule)}${tn.failureReason?` (${tn.failureReason})`:""}`).join(`
|
|
130
|
-
`):"No checks configured.",Xt=Object.keys(ft.run.extractedValues).length>0?Object.entries(ft.run.extractedValues).map(([tn,sr])=>`${tn}: ${String(sr)}`).join(`
|
|
131
|
-
`):"No extracted values.",Pt=ft.run.toolCalls.length>0?ft.run.toolCalls.map((tn,sr)=>`${sr+1}. ${tn.name} (${tn.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: ${ft.runId}`,`Agent: ${ft.agentName}`,`Outcome: ${ft.run.passed?"passed":"failed"}`,`Duration: ${ft.run.duration}ms`,"","Current check outcomes:",nt,"","Tool sequence:",Pt,"","Extracted values:",Xt,"","Final answer:",ft.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
|
-
`);_e(Ft),Bt(!0)},Bi=async()=>{if(!(!Ln||S)){it(!0),Ge(null);try{const ie=no.filter(Xt=>i.find(Ft=>Ft.id===Xt)?.authType==="oauth2");await _o({serverNames:ie,source:C});const nt=new Set;for(const Xt of no){const Pt=await C.discoverToolsForAnalysis({serverNames:[Xt]});for(const Ft of Pt.servers)for(const tn of Ft.tools)nt.add(tn.name)}at(Array.from(nt).sort((Xt,Pt)=>Xt.localeCompare(Pt)))}catch(ie){Ge(ie instanceof Error?ie.message:"Failed to load tools")}finally{it(!1)}}};return a.jsx(ws,{open:Oe,onOpenChange:Ke,children:a.jsxs(Je,{className:S?"rounded-md border shadow-none":"border-dashed",children:[a.jsxs(Dt,{className:`${S?"px-3 py-3":"pb-3"} flex-row items-center justify-between space-y-0 cursor-pointer`,onClick:q,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(Zt,{className:`h-3.5 w-3.5 transition-transform ${Oe?"rotate-0":"-rotate-90"}`})})}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[r+1,"."]}),a.jsx(Lt,{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(Qe,{variant:t==="inline"?"secondary":"outline",children:t==="referenced"?"Referenced":"Inline"}),n&&a.jsx(Qe,{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":Oe?"Collapse scenario details":"Expand scenario details",children:a.jsx(Zt,{className:`h-4 w-4 transition-transform ${Oe?"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:()=>Bt(!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(Zt,{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(Ze,{className:"space-y-3",children:[a.jsx(fye,{open:zt,onOpenChange:ie=>{Bt(ie),ie||_e("")},configId:c,configPath:d,scenario:e,agents:o,servers:i,defaultAssistantAgentName:f,initialUserMessage:on||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(We,{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(We,{className:"text-xs",children:"Servers"}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.map(ie=>a.jsx(Qe,{variant:e.serverIds.includes(ie.id)?"default":"outline",className:`cursor-pointer text-xs ${e.serverIds.includes(ie.id)?"":"opacity-50"}`,onClick:()=>!S&&Re(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(Je,{className:"border bg-card",children:[a.jsxs(Dt,{className:"pb-2",children:[a.jsx(Lt,{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(Ze,{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:Be,type:"file",accept:[...Z8,...eq,".md"].join(","),multiple:!0,className:"hidden",onChange:ie=>Ye(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(VS,{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:()=>Et(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:()=>Be.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(nP,{className:"h-4 w-4"})})]}):!S&&a.jsxs("button",{type:"button",onClick:()=>Be.current?.click(),className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",children:[a.jsx(nP,{className:"h-3.5 w-3.5"}),"Attach file"]})]})]})]}),!S&&a.jsxs(Je,{className:"border bg-muted/20",children:[a.jsxs(Dt,{className:"pb-2",children:[a.jsx(Lt,{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(Ze,{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(We,{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:sn||!Nt||!e.prompt.trim()||e.serverIds.length===0,children:sn?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."}),nn&&a.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:nn}),ft&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[a.jsx(Qe,{variant:ft.run.passed?"default":"destructive",children:ft.run.passed?"Passed":"Failed"}),a.jsxs(Qe,{variant:"outline",children:[ft.run.duration,"ms"]}),a.jsxs(Qe,{variant:"outline",children:[ft.run.toolCalls.length," tool calls"]}),a.jsx(Qe,{variant:"outline",className:"font-mono",children:ft.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=lD(e.evalRules,ft.run.failureReasons,ft.run.checkResults),nt=ie.filter(Pt=>Pt.status==="passed"),Xt=ie.filter(Pt=>Pt.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(Qe,{variant:"outline",className:"h-5 border-success/30 bg-success/10 text-success text-[10px]",children:[nt.length," passed"]}),a.jsxs(Qe,{variant:"outline",className:`h-5 text-[10px] ${Xt.length>0?"border-destructive/30 bg-destructive/10 text-destructive":""}`,children:[Xt.length," failed"]})]}),a.jsx("div",{className:"space-y-1",children:ie.map((Pt,Ft)=>a.jsxs("div",{className:`flex items-start justify-between gap-2 rounded-md border px-2 py-1.5 text-xs ${Pt.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:[Pt.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:Sye(Pt.rule)})]}),Pt.failureReason&&a.jsx("p",{className:"mt-1 pl-5 text-[11px] text-muted-foreground",children:Nye(Pt.failureReason)})]}),a.jsx(Qe,{variant:"outline",className:`shrink-0 text-[10px] ${Pt.status==="failed"?"border-destructive/30 text-destructive":"border-success/30 text-success"}`,children:Pt.status})]},`${e.id}-preview-check-${Ft}`))})]})})(),ft.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:ft.run.failureReasons.map((ie,nt)=>a.jsx("li",{children:ie},`${ft.runId}-failure-${nt}`))})]}),Object.keys(ft.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(ft.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(vye,{run:ft.run,fallbackUserPrompt:e.prompt})]})]})]}),a.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[a.jsxs(Je,{className:"border bg-muted/20",children:[a.jsx(Dt,{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(Lt,{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:()=>Bt(!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(Ze,{className:"space-y-2",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{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:Jt[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:tq(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??""),U(ie.path??""),Y(ie.equals!==void 0?String(ie.equals):"")},"aria-label":`Edit check ${nt+1}`,children:a.jsx(TW,{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(oD,{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(oD,{value:k,onValueChange:A,className:"h-8 w-[14.5rem] shrink-0 text-xs",hideToolSequence:Ae&&k!=="tool_sequence"}),qn?a.jsxs(a.Fragment,{children:[a.jsx(_t,{value:K,onChange:ie=>U(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=>U(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(We,{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:()=>He(X),children:Ae?"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(Zt,{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}`))})]}),Yt&&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(We,{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(Je,{className:"border bg-muted/10",children:[a.jsx(Dt,{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(Lt,{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:()=>Bt(!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(Ze,{className:"space-y-2",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{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:()=>Wt(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:ke,onChange:ie=>Pe(ie.target.value),placeholder:"Field name",className:"h-8 text-xs w-36"}),a.jsx(_t,{value:et,onChange:ie=>ht(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(Je,{className:"border bg-muted/10",children:[a.jsx(Dt,{className:"pb-2",children:a.jsxs("div",{className:"min-w-0",children:[a.jsx(Lt,{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(Ze,{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(We,{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(We,{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(We,{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 lD(e,t,n){return Q8({evalRules:e,failureReasons:t,checkResults:n})}function jye(e){return e.type==="agent_check"?`${e.type}: ${e.label??""} — ${e.prompt??""}`:e.type==="tool_sequence"?`${e.type}: ${tq(e.sequence??[])}`:pm(e.type)?`${e.type}: ${e.tool??""}: ${cD(e)}`:e.path?`${e.type}: ${cD(e)}`:`${e.type}: ${e.value??""}`}function cD(e){return e.path?e.equals!==void 0?`${e.path} == ${String(e.equals)}`:e.path:String(e.value??"")}const Sye=lx;function Nye(e){const t=String(e??"").trim(),n=t.match(/^Regex assertion failed:\s*(.+)$/i);return n?`Text match failed: ${n[1]}`:t}function nq(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 Cye=()=>({id:`cfg-${Date.now()}`,name:"",configName:"",description:"",servers:[],serverEntries:[],agents:[],agentEntries:[],scenarios:[],scenarioEntries:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),uD=()=>{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):Cye()),[A,E]=h.useState(""),[P,O]=h.useState(""),[D,K]=h.useState({}),[U,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()){Ie({title:"Validation Error",description:"Config ID is required.",variant:"destructive"});return}const W=H.map(Re=>Re.kind==="referenced"?{kind:"referenced",ref:p.find(Ct=>Ct.id===Re.ref)?.id||Re.ref}:Re),he=$.map(Re=>Re.kind==="referenced"?{kind:"referenced",ref:v.find(Ct=>Ct.id===Re.ref)?.id||Re.ref}:Re),Ae=M.map(Re=>{if(Re.kind==="referenced"){const Jt=x.find(Yt=>Yt.id===Re.ref),Ct=(Re.mcpServers??[]).map(Yt=>Yt.kind==="referenced"?{kind:"referenced",ref:p.find(qn=>qn.id===Yt.ref)?.id||Yt.ref}:Yt);return{kind:"referenced",ref:Jt?.id||Re.ref,...Re.mcpServers!==void 0?{mcpServers:Ct}:{}}}return Re}),He=W.filter(Re=>Re.kind==="inline").map(Re=>({server:Re.server,error:nq(Re.server)})).find(Re=>!!Re.error);if(He?.error){Ie({title:"Validation Error",description:He.error,variant:"destructive"});return}if(Ae.filter(Re=>Re.kind==="inline").some(Re=>!Re.scenario.name?.trim())){Ie({title:"Validation Error",description:"Inline scenarios must have a name before saving.",variant:"destructive"});return}const Le=new Set(he.map(Re=>Re.kind==="inline"?Re.agent.id:Re.ref)),ot=(C.runDefaults?.selectedAgentNames??[]).filter(Re=>Le.has(Re)),Wt={...C,serverEntries:W,servers:W.filter(Re=>Re.kind==="inline").map(Re=>Re.server),agentEntries:he,agents:he.filter(Re=>Re.kind==="inline").map(Re=>Re.agent),scenarioEntries:Ae,scenarios:Ae.filter(Re=>Re.kind==="inline").map(Re=>Re.scenario),runDefaults:ot.length>0?{...C.runDefaults??{},selectedAgentNames:ot}:void 0,updatedAt:new Date().toISOString()};if(j){const Re=await c(Wt);k(Re);const Jt=Hn(Re.configName,Hn(Re.name,Re.id));Ie({title:"MCP Evaluation Created",description:`"${Jt}" has been saved.`}),r(`/mcp-evaluations/${Re.id}`)}else{const Re=await d(C.id,Wt);k(Re);const Jt=Hn(Re.configName,Hn(Re.name,Re.id));Ie({title:"MCP Evaluation Updated",description:`"${Jt}" has been updated.`}),N(!1),r(`/mcp-evaluations/${Re.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 Ae=he?Array.from(new Set([...re,W])):re.filter(He=>He!==W);V({runDefaults:{...C.runDefaults??{},selectedAgentNames:Ae}})},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))]),Ae=`${W}-custom`;let He=Ae,ee=2;for(;he.has(He);)He=`${Ae}-${ee}`,ee+=1;return He},ve=()=>{const he={id:`agt-${Date.now()}`,name:"",provider:"openai",model:"gpt-4o",temperature:Pg,maxTokens:4096};F([{kind:"inline",agent:he},...$]),K(Ae=>({...Ae,[he.id]:!0}))},Se=()=>{const W=v.find(He=>He.id===P);if(!W)return;const he=W.id;new Set($.filter(He=>He.kind==="referenced").map(He=>He.ref)).has(he)||F([...$,{kind:"referenced",ref:he}]),O("")},at=()=>{const W=new Set($.filter(Ae=>Ae.kind==="referenced").map(Ae=>Ae.ref)),he=v.filter(Ae=>!W.has(Ae.id)).map(Ae=>({kind:"referenced",ref:Ae.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),Ae=ge(he),He={...structuredClone(W),id:`agt-${Date.now()}`,name:Ae};F([...$,{kind:"inline",agent:He}]),K(ee=>({...ee,[He.id]:!0})),O(""),Ie({title:"Imported agent as inline",description:Ae})},it=W=>{const he=$[W];if(!he)return;const Ae=he.kind==="inline"?he.agent.id:he.ref,He=re.filter(ee=>ee!==Ae);V({runDefaults:{...C.runDefaults??{},selectedAgentNames:He}}),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 Ae=W+he;if(Ae<0||Ae>=$.length)return;const He=[...$],[ee]=He.splice(W,1);He.splice(Ae,0,ee),F(He)},Ge=W=>{const he=$[W];if(!he||he.kind!=="referenced")return;const Ae=an(he.ref);if(!Ae){Ie({title:"Referenced agent not found",variant:"destructive"});return}const He=Hn(Ae.name,Ae.id),ee=ge(He),Le={...structuredClone(Ae),id:`agt-${Date.now()}`,name:ee},ot=[...$];if(ot[W]={kind:"inline",agent:Le},F(ot),re.includes(he.ref)){const Wt=re.map(Re=>Re===he.ref?Le.id:Re);V({runDefaults:{...C.runDefaults??{},selectedAgentNames:Array.from(new Set(Wt))}})}K(Wt=>({...Wt,[Le.id]:!0})),Ie({title:"Referenced agent converted to inline",description:ee})},ke=()=>{const W=x.find(Ae=>Ae.id===A);if(!W)return;const he={...structuredClone(W),id:`scn-${Date.now()}`,serverIds:[...W.serverIds]};X([...M,{kind:"inline",scenario:he}]),z(Ae=>({...Ae,[he.id]:!0})),E("")},Pe=()=>{const he={id:`scn-${Date.now()}`,name:"",serverIds:[],prompt:"",evalRules:[],extractRules:[]};X([{kind:"inline",scenario:he},...M]),z(Ae=>({...Ae,[he.id]:!0}))},et=()=>{const W=x.find(He=>He.id===A);if(!W)return;const he=W.id;new Set(M.filter(He=>He.kind==="referenced").map(He=>He.ref)).has(he)||X([...M,{kind:"referenced",ref:he}]),E("")},ht=W=>{const he=M[W];he?.kind==="inline"&&z(Ae=>{const He={...Ae};return delete He[he.scenario.id],He}),X(M.filter((Ae,He)=>He!==W))},zt=(W,he)=>{const Ae=W+he;if(Ae<0||Ae>=M.length)return;const He=[...M],[ee]=He.splice(W,1);He.splice(Ae,0,ee),X(He)},Bt=W=>{const he=M[W];if(!he||he.kind!=="referenced")return;const Ae=sn(he.ref);if(!Ae){Ie({title:"Referenced scenario not found",variant:"destructive"});return}const He=new Set(M.filter(Ct=>Ct.kind==="inline").map(Ct=>Ct.scenario.name?.trim().toLowerCase()).filter(Boolean)),ee=`${Hn(Ae.name,Ae.id)}-custom`;let Le=ee,ot=2;for(;He.has(Le.toLowerCase());)Le=`${ee}-${ot}`,ot+=1;const Wt=Date.now(),Re={...structuredClone(Ae),id:`scn-${Wt}`,name:Le,serverIds:he.mcpServers&&he.mcpServers.length>0?he.mcpServers.map(Ct=>Ct.kind==="referenced"?Ct.ref:Ct.server.id):[...Ae.serverIds]},Jt=[...M];Jt[W]={kind:"inline",scenario:Re},X(Jt),z(Ct=>({...Ct,[Re.id]:!0})),Ie({title:"Referenced scenario converted to inline",description:Le})},Nt=W=>p.find(he=>he.id===W),an=W=>v.find(he=>he.id===W),sn=W=>x.find(he=>he.id===W),Ut=H.filter(W=>W.kind==="referenced").map(W=>W.ref),nn=Ut.map(Nt).filter(W=>!!W),rn=$.filter(W=>W.kind==="referenced").map(W=>W.ref),on=rn.map(an).filter(W=>!!W);$.filter(W=>W.kind==="inline");const _e=$.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}]}),Be=M.filter(W=>W.kind==="referenced").map(W=>W.ref),Ye=M.flatMap(W=>{if(W.kind==="referenced"){const he=sn(W.ref);if(!he)return[];if(W.mcpServers===void 0)return[{scenario:he,origin:"referenced",hasMcpServerOverride:!1}];const Ae=W.mcpServers.flatMap(He=>He.kind==="referenced"?[He.ref]:[He.server.id]);return[{scenario:{...he,serverIds:Ae},origin:"referenced",hasMcpServerOverride:!0}]}return[{scenario:W.scenario,origin:"inline",hasMcpServerOverride:!1}]}),Et=Array.from(new Map([...v,...C.agents,...on].map(W=>[W.id,W])).values()),ft=Array.from(new Map([...p,...C.servers??[],...nn].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)),Oe=Array.from(new Set([...Ut,...fe].filter(W=>!Nt(W)))),Ke=rn.filter(W=>!an(W)),q=Be.filter(W=>!sn(W));new Set(Oe);const le=new Set(q),pe=$.length,J=M.length,xe=[...p],be=(W,he)=>{const Ae=M[W];if(!Ae||Ae.kind!=="referenced")return;const He=[...M];He[W]={kind:"referenced",ref:Ae.ref,mcpServers:he.map(ee=>({kind:"referenced",ref:ee}))},X(He)},we=W=>{const he=M[W];if(!he||he.kind!=="referenced")return;const Ae=[...M];Ae[W]={kind:"referenced",ref:he.ref},X(Ae)};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(Qe,{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(EW,{className:"mr-1.5 h-3.5 w-3.5"}),"Save"]})]})]})]}),se&&!S&&a.jsx(Je,{className:"border-destructive/40",children:a.jsxs(Ze,{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})]}),(Oe.length>0||Ke.length>0||q.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"}),Oe.length>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Servers:"," ",a.jsx("span",{className:"text-destructive",children:Oe.join(", ")})]}),Ke.length>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Agents: ",a.jsx("span",{className:"text-destructive",children:Ke.join(", ")})]}),q.length>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Scenarios:"," ",a.jsx("span",{className:"text-destructive",children:q.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(Je,{className:"border-amber-500/30",children:a.jsxs(Ze,{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(Qe,{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(VS,{className:"h-3 w-3"}),J," scenario",J!==1?"s":""]})}),a.jsx(Qe,{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(Je,{children:a.jsx(Ze,{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(We,{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(We,{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(We,{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(VS,{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(Je,{className:"mb-4",children:a.jsxs(Ze,{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 Ae=W.kind==="referenced"?an(W.ref):null,He=W.kind==="inline"?Hn(W.agent.name,W.agent.id):Hn(Ae?.name,W.ref),ee=W.kind==="inline"?W.agent.model:Ae?.model||"unknown",Le=W.kind==="inline"?W.agent.id:W.ref,ot=W.kind==="referenced"&&!Ae,Wt=W.kind==="inline"?W.agent.id:W.ref,Re=re.includes(Wt),Jt=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(Zt,{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:He}),a.jsx(Qe,{variant:W.kind==="inline"?"secondary":"outline",children:W.kind==="inline"?"Inline":"Referenced"}),a.jsx(Qe,{variant:"outline",className:"font-mono text-[10px]",children:ee}),Re&&a.jsx(Qe,{variant:"outline",className:"text-xs border-emerald-300 text-emerald-700 bg-emerald-50",children:"Default"}),ot&&a.jsx(Qe,{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:Re,onChange:Ct=>De(Wt,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:Jt?"Collapse":"Expand"}),W.kind==="referenced"&&a.jsx(a.Fragment,{children:a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>Ge(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"&&Jt&&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(We,{className:"text-xs",children:"Name"}),a.jsx(_t,{value:W.agent.name,onChange:Ct=>{const Yt=[...$];Yt[he]={kind:"inline",agent:{...W.agent,name:Ct.target.value}},F(Yt)},placeholder:"e.g. GPT-5 Mini custom"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Provider"}),a.jsxs(In,{value:W.agent.provider,onValueChange:Ct=>{const Yt=[...$];Yt[he]={kind:"inline",agent:{...W.agent,provider:Ct}},F(Yt)},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(We,{className:"text-xs",children:"Model"}),a.jsx(_t,{value:W.agent.model,onChange:Ct=>{const Yt=[...$];Yt[he]={kind:"inline",agent:{...W.agent,model:Ct.target.value}},F(Yt)},className:"font-mono text-xs"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Max Tokens"}),a.jsx(_t,{type:"number",min:1,max:128e3,value:W.agent.maxTokens,onChange:Ct=>{const Yt=[...$];Yt[he]={kind:"inline",agent:{...W.agent,maxTokens:parseInt(Ct.target.value)||0}},F(Yt)},className:"font-mono text-xs"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Temperature"}),a.jsx(_t,{type:"number",min:0,max:2,step:.01,value:Xf(W.agent.temperature),onChange:Ct=>{const Yt=[...$];Yt[he]={kind:"inline",agent:{...W.agent,temperature:Number(Ct.target.value)||Pg}},F(Yt)},className:"font-mono text-xs"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"System Prompt"}),a.jsx(Es,{value:W.agent.systemPrompt||"",onChange:Ct=>{const Yt=[...$];Yt[he]={kind:"inline",agent:{...W.agent,systemPrompt:Ct.target.value}},F(Yt)},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."})]}),Ke.length>0&&a.jsxs("p",{className:"text-xs text-destructive",children:["Missing agent refs: ",Ke.join(", ")]})]})}),G?a.jsx(Je,{children:a.jsx(Ze,{className:"pt-4",children:a.jsxs("div",{className:"space-y-2",children:[_e.map((W,he)=>{const Ae=Hn(W.agent.name,W.agent.id),He=re.includes(W.origin==="inline"?W.agent.id:W.ref||W.agent.id),ee=W.ref??W.agent.id,Le=!!U[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:Ae})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[He&&a.jsx(Qe,{variant:"outline",className:"text-xs border-emerald-300 text-emerald-700 bg-emerald-50",children:"Default"}),a.jsx(Qe,{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(Zt,{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(v8,{provider:W.agent.provider}),a.jsx(Qe,{variant:"outline",className:"text-xs font-mono",children:W.agent.model}),a.jsxs(Qe,{variant:"outline",className:"text-xs font-mono",children:["max_tokens: ",W.agent.maxTokens]}),a.jsxs(Qe,{variant:"outline",className:"text-xs font-mono",children:["temperature: ",Xf(W.agent.temperature)]})]})]},`agent-view-${he}-${W.ref??W.agent.id}`)}),_e.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(Je,{className:"mb-4",children:a.jsxs(Ze,{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:et,children:"Add Ref"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:!A,onClick:ke,children:"Import Inline"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",onClick:Pe,children:"Add scenario"})]})]}),a.jsxs("div",{className:"space-y-2",children:[M.map((W,he)=>{const Ae=W.kind==="referenced"?sn(W.ref):null,He=W.kind==="inline"?Hn(W.scenario.name,W.scenario.id):Hn(Ae?.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),Wt=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:()=>zt(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:()=>zt(he,1),disabled:he===M.length-1,"aria-label":"Move scenario down",children:a.jsx(Zt,{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:He}),a.jsx(Qe,{variant:W.kind==="inline"?"secondary":"outline",children:W.kind==="inline"?"Inline":"Referenced"}),ot&&a.jsx(Qe,{variant:"secondary",children:"Override"}),ee&&a.jsx(Qe,{variant:"destructive",children:"Name required"}),Le&&a.jsx(Qe,{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(Re=>({...Re,[W.scenario.id]:!Re[W.scenario.id]})),"aria-label":Wt?"Collapse scenario details":"Expand scenario details",children:a.jsx(Zt,{className:`h-3.5 w-3.5 transition-transform ${Wt?"rotate-180":""}`})}),W.kind==="referenced"&&a.jsx(a.Fragment,{children:a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>Bt(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:()=>ht(he),"aria-label":"Remove scenario entry",children:a.jsx(Ga,{className:"h-3.5 w-3.5"})})]})]}),W.kind==="inline"&&Wt&&a.jsx("div",{className:"border-t px-3 py-3",children:a.jsx(KN,{scenarios:[W.scenario],scenarioOrigins:["inline"],agents:[...C.agents,...on],servers:[...C.servers??[],...nn],configId:C.id,configPath:C.sourcePath,defaultAssistantAgentName:C.runDefaults?.selectedAgentNames?.[0],onChange:Re=>{const Jt=Re[0];if(!Jt)return;const Ct=[...M];Ct[he]={kind:"inline",scenario:Jt},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(Re=>{const Jt=(W.mcpServers??[]).some(Ct=>Ct.kind==="referenced"&&Ct.ref===Re.id);return a.jsx(Z,{type:"button",size:"sm",variant:Jt?"default":"outline",className:`h-7 text-xs ${Jt?"":"opacity-70"}`,onClick:()=>{const Ct=(W.mcpServers??[]).filter(Xn=>Xn.kind==="referenced").map(Xn=>Xn.ref),Yt=Ct.includes(Re.id)?Ct.filter(Xn=>Xn!==Re.id):[...Ct,Re.id];be(he,Yt)},children:Hn(Re.name,Re.id)},`${W.ref}-override-server-${Re.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."})]}),q.length>0&&a.jsxs("p",{className:"text-xs text-destructive",children:["Missing scenario refs: ",q.join(", ")]})]})}),G?a.jsx(Je,{children:a.jsx(Ze,{className:"pt-4",children:a.jsx(KN,{scenarios:Ye.map(W=>W.scenario),scenarioOrigins:Ye.map(W=>W.origin),scenarioOverrides:Ye.map(W=>W.hasMcpServerOverride),agents:Et,servers:ft,configId:C.id,configPath:C.sourcePath,defaultAssistantAgentName:C.runDefaults?.selectedAgentNames?.[0],testCaseReturnToPath:T,onChange:()=>{},readOnly:!0})})}):null]})]})]})};var _ye=Symbol("radix.slottable");function kye(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=_ye,t}var rq="AlertDialog",[Aye]=kr(rq,[eL]),Wo=eL(),aq=e=>{const{__scopeAlertDialog:t,...n}=e,r=Wo(t);return a.jsx(iv,{...r,...n,modal:!0})};aq.displayName=rq;var Eye="AlertDialogTrigger",Pye=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Wo(n);return a.jsx(mQ,{...s,...r,ref:t})});Pye.displayName=Eye;var Rye="AlertDialogPortal",sq=e=>{const{__scopeAlertDialog:t,...n}=e,r=Wo(t);return a.jsx(lv,{...r,...n})};sq.displayName=Rye;var Tye="AlertDialogOverlay",oq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Wo(n);return a.jsx(Ou,{...s,...r,ref:t})});oq.displayName=Tye;var Kc="AlertDialogContent",[Oye,Mye]=Aye(Kc),Iye=kye("AlertDialogContent"),iq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,o=Wo(n),i=h.useRef(null),c=Ot(t,i),d=h.useRef(null);return a.jsx(dQ,{contentName:Kc,titleName:lq,docsSlug:"alert-dialog",children:a.jsx(Oye,{scope:n,cancelRef:d,children:a.jsxs(Mu,{role:"alertdialog",...o,...s,ref:c,onOpenAutoFocus:Ue(s.onOpenAutoFocus,f=>{f.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[a.jsx(Iye,{children:r}),a.jsx(Dye,{contentRef:i})]})})})});iq.displayName=Kc;var lq="AlertDialogTitle",cq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Wo(n);return a.jsx(ip,{...s,...r,ref:t})});cq.displayName=lq;var uq="AlertDialogDescription",dq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Wo(n);return a.jsx(lp,{...s,...r,ref:t})});dq.displayName=uq;var $ye="AlertDialogAction",fq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Wo(n);return a.jsx(cv,{...s,...r,ref:t})});fq.displayName=$ye;var pq="AlertDialogCancel",hq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=Mye(pq,n),o=Wo(n),i=Ot(t,s);return a.jsx(cv,{...o,...r,ref:i})});hq.displayName=pq;var Dye=({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 \`${uq}\` 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},Lye=aq,Fye=sq,mq=oq,gq=iq,vq=fq,xq=hq,yq=cq,bq=dq;const Ps=Lye,zye=Fye,wq=h.forwardRef(({className:e,...t},n)=>a.jsx(mq,{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}));wq.displayName=mq.displayName;const Qa=h.forwardRef(({className:e,...t},n)=>a.jsxs(zye,{children:[a.jsx(wq,{}),a.jsx(gq,{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=gq.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(yq,{ref:n,className:$e("text-lg font-semibold",e),...t}));es.displayName=yq.displayName;const ts=h.forwardRef(({className:e,...t},n)=>a.jsx(bq,{ref:n,className:$e("text-sm text-muted-foreground",e),...t}));ts.displayName=bq.displayName;const ns=h.forwardRef(({className:e,...t},n)=>a.jsx(vq,{ref:n,className:$e(LC(),e),...t}));ns.displayName=vq.displayName;const rs=h.forwardRef(({className:e,...t},n)=>a.jsx(xq,{ref:n,className:$e(LC({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));rs.displayName=xq.displayName;const Bye=()=>{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]),Ie({title:"Server duplicated",description:`Created ${S}.`})},v=async y=>{await t(e.filter(b=>b.id!==y.id)),Ie({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(x5,{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(H_,{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(Je,{children:a.jsx(Ze,{className:"p-0",children:a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Ht,{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(Ht,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>s(`/libraries/servers/${encodeURIComponent(y.id)}`),children:[a.jsx(qe,{className:"font-medium",children:m(y)}),a.jsx(qe,{children:a.jsx(Qe,{variant:"secondary",className:"font-mono text-xs",children:y.transport})}),a.jsx(qe,{children:a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:x(y)})}),a.jsx(qe,{children:!y.authType||y.authType==="none"?a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}):a.jsx(Qe,{variant:"outline",className:"text-xs",children:y.authType})}),a.jsx(qe,{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 GN({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(bW,{className:"h-4 w-4"}):a.jsx(y5,{className:"h-4 w-4"})})]})}const dD={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"},fD=()=>({id:`srv-${Date.now()}`,name:"",transport:"stdio",authType:"none"}),qye=()=>{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??fD()),[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(fD()),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}}))},U=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 ${HN(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()){Ie({title:"Name is required",variant:"destructive"});return}const I=nq(f);if(I){Ie({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]),Ie({title:"Server created"}),t(`/libraries/servers/${encodeURIComponent(T.id)}`);else{const V=n.map(H=>H.id===c?.id?T:H);await r(V),Ie({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),Ie({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:()=>{U()},disabled:y.status==="loading"||C,children:[a.jsx(N5,{className:"mr-2 h-4 w-4"}),"Test Connection"]})]}),S&&a.jsxs(Je,{children:[a.jsxs(Dt,{className:"flex-row items-center justify-between space-y-0",children:[a.jsx(Lt,{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(Ze,{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]}),dD[f.transport]&&a.jsxs("p",{className:"rounded-md bg-muted px-3 py-2 text-xs text-muted-foreground",children:["Hint: ",dD[f.transport]]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Tested at ",new Date(y.testedAt).toLocaleString()]})]})]})]}),a.jsxs(Je,{children:[a.jsx(Dt,{children:a.jsx(Lt,{className:"text-base",children:"Configuration"})}),a.jsxs(Ze,{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(We,{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(We,{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(We,{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(We,{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(We,{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(We,{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(We,{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(We,{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(We,{className:"text-xs",children:"Value"}),a.jsx(GN,{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(We,{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(We,{className:"text-xs",children:"Client Secret (optional)"}),a.jsx(GN,{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(We,{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(We,{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(We,{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"})]})]})})]})},Uye=()=>{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]),Ie({title:"Agent duplicated",description:`Created ${y}.`})},v=async x=>{await t(e.filter(j=>j.id!==x.id)),Ie({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(H_,{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(Je,{children:a.jsx(Ze,{className:"p-0",children:a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Ht,{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(Ht,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>s(`/libraries/agents/${encodeURIComponent(x.id)}`),children:[a.jsx(qe,{className:"font-medium",children:x.name}),a.jsx(qe,{children:a.jsx(v8,{provider:x.provider})}),a.jsx(qe,{children:a.jsx("span",{className:"font-mono text-xs",children:x.model})}),a.jsx(qe,{className:"font-mono text-xs",children:x.maxTokens}),a.jsx(qe,{className:"font-mono text-xs",children:Xf(x.temperature).toFixed(2)}),a.jsx(qe,{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 jq=["PageUp","PageDown"],Sq=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Nq={"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",[YN,Wye,Hye]=Qf(Hu),[Cq]=kr(Hu,[Hye]),[Vye,cx]=Cq(Hu),_q=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"?Kye:Gye,[k=[],A]=Aa({prop:m,defaultProp:f,onChange:U=>{[...b.current][S.current]?.focus(),p(U)}}),E=h.useRef(k);function P(U){const B=Zye(k,U);K(U,B)}function O(U){K(U,S.current)}function D(){const U=E.current[S.current];k[S.current]!==U&&v(k)}function K(U,B,{commit:Y}={commit:!1}){const z=rbe(o),I=abe(Math.round((U-r)/o)*o+r,z),T=Gf(I,[r,s]);A((V=[])=>{const H=Qye(V,T,B);if(nbe(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(Vye,{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(YN.Provider,{scope:e.__scopeSlider,children:a.jsx(YN.Slot,{scope:e.__scopeSlider,children:a.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...y,ref:t,onPointerDown:Ue(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:U,direction:B})=>{if(!c){const I=jq.includes(U.key)||U.shiftKey&&Sq.includes(U.key)?10:1,T=S.current,V=k[T],H=o*I*B;K(V+H,T,{commit:!0})}}})})})})});_q.displayName=Hu;var[kq,Aq]=Cq(Hu,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Kye=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=Ot(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=dk(A,S?[n,r]:[r,n]);return j.current=k,P(C-k.left)}return a.jsx(kq,{scope:e.__scopeSlider,startEdge:S?"left":"right",endEdge:S?"right":"left",direction:S?1:-1,size:"width",children:a.jsx(Eq,{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=Nq[S?"from-left":"from-right"].includes(C.key);f?.({event:C,direction:A?-1:1})}})})}),Gye=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=Ot(t,m),v=h.useRef(void 0),x=!s;function j(y){const b=v.current||m.current.getBoundingClientRect(),S=[0,b.height],C=dk(S,x?[r,n]:[n,r]);return v.current=b,C(y-b.top)}return a.jsx(kq,{scope:e.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:a.jsx(Eq,{"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=Nq[x?"from-bottom":"from-top"].includes(y.key);d?.({event:y,direction:S?-1:1})}})})}),Eq=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:Ue(e.onKeyDown,p=>{p.key==="Home"?(i(p),p.preventDefault()):p.key==="End"?(c(p),p.preventDefault()):jq.concat(Sq).includes(p.key)&&(d(p),p.preventDefault())}),onPointerDown:Ue(e.onPointerDown,p=>{const v=p.target;v.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(v)?v.focus():r(p)}),onPointerMove:Ue(e.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&s(p)}),onPointerUp:Ue(e.onPointerUp,p=>{const v=p.target;v.hasPointerCapture(p.pointerId)&&(v.releasePointerCapture(p.pointerId),o(p))})})}),Pq="SliderTrack",Rq=h.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=cx(Pq,n);return a.jsx(lt.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:t})});Rq.displayName=Pq;var XN="SliderRange",Tq=h.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=cx(XN,n),o=Aq(XN,n),i=h.useRef(null),c=Ot(t,i),d=s.values.length,f=s.values.map(v=>Iq(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+"%"}})});Tq.displayName=XN;var QN="SliderThumb",Oq=h.forwardRef((e,t)=>{const n=Wye(e.__scopeSlider),[r,s]=h.useState(null),o=Ot(t,c=>s(c)),i=h.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(Yye,{...e,ref:o,index:i})}),Yye=h.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:s,...o}=e,i=cx(QN,n),c=Aq(QN,n),[d,f]=h.useState(null),m=Ot(t,N=>f(N)),p=d?i.form||!!d.closest("form"):!0,v=Hg(d),x=i.values[r],j=x===void 0?0:Iq(x,i.min,i.max),y=Jye(r,i.values.length),b=v?.[c.size],S=b?ebe(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(YN.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:Ue(e.onFocus,()=>{i.valueIndexToChangeRef.current=r})})}),p&&a.jsx(Mq,{name:s??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:x},r)]})});Oq.displayName=QN;var Xye="RadioBubbleInput",Mq=h.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const s=h.useRef(null),o=Ot(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})});Mq.displayName=Xye;function Qye(e=[],t,n){const r=[...e];return r[n]=t,r.sort((s,o)=>s-o)}function Iq(e,t,n){const o=100/(n-t)*(e-t);return Gf(o,[0,100])}function Jye(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Zye(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 ebe(e,t,n){const r=e/2,o=dk([0,50],[0,r]);return(r-o(t)*n)*n}function tbe(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function nbe(e,t){if(t>0){const n=tbe(e);return Math.min(...n)>=t}return!0}function dk(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 rbe(e){return(String(e).split(".")[1]||"").length}function abe(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var $q=_q,sbe=Rq,obe=Tq,ibe=Oq;const Dq=h.forwardRef(({className:e,...t},n)=>a.jsxs($q,{ref:n,className:$e("relative flex w-full touch-none select-none items-center",e),...t,children:[a.jsx(sbe,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(obe,{className:"absolute h-full bg-primary"})}),a.jsx(ibe,{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"})]}));Dq.displayName=$q.displayName;function lbe(e){const t=cbe(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),d=c.find(dbe);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 cbe(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=pbe(s),c=fbe(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 ube=Symbol("radix.slottable");function dbe(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ube}function fbe(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 pbe(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",[Lq]=kr(ux,[Ei]),_p=Ei(),[hbe,Di]=Lq(ux),Fq=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(hbe,{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})})};Fq.displayName=ux;var zq="PopoverAnchor",mbe=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Di(zq,n),o=_p(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:c}=s;return h.useEffect(()=>(i(),()=>c()),[i,c]),a.jsx(tp,{...o,...r,ref:t})});mbe.displayName=zq;var Bq="PopoverTrigger",qq=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Di(Bq,n),o=_p(n),i=Ot(t,s.triggerRef),c=a.jsx(lt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Kq(s.open),...r,ref:i,onClick:Ue(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:a.jsx(tp,{asChild:!0,...o,children:c})});qq.displayName=Bq;var fk="PopoverPortal",[gbe,vbe]=Lq(fk,{forceMount:void 0}),Uq=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,o=Di(fk,t);return a.jsx(gbe,{scope:t,forceMount:n,children:a.jsx(ar,{present:n||o.open,children:a.jsx(zl,{asChild:!0,container:s,children:r})})})};Uq.displayName=fk;var Cu="PopoverContent",Wq=h.forwardRef((e,t)=>{const n=vbe(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(ybe,{...s,ref:t}):a.jsx(bbe,{...s,ref:t})})});Wq.displayName=Cu;var xbe=lbe("PopoverContent.RemoveScroll"),ybe=h.forwardRef((e,t)=>{const n=Di(Cu,e.__scopePopover),r=h.useRef(null),s=Ot(t,r),o=h.useRef(!1);return h.useEffect(()=>{const i=r.current;if(i)return sv(i)},[]),a.jsx(op,{as:xbe,allowPinchZoom:!0,children:a.jsx(Hq,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ue(e.onCloseAutoFocus,i=>{i.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Ue(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:Ue(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),bbe=h.forwardRef((e,t)=>{const n=Di(Cu,e.__scopePopover),r=h.useRef(!1),s=h.useRef(!1);return a.jsx(Hq,{...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()}})}),Hq=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":Kq(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)"}})})})}),Vq="PopoverClose",wbe=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Di(Vq,n);return a.jsx(lt.button,{type:"button",...r,ref:t,onClick:Ue(e.onClick,()=>s.onOpenChange(!1))})});wbe.displayName=Vq;var jbe="PopoverArrow",Sbe=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=_p(n);return a.jsx(Gg,{...s,...r,ref:t})});Sbe.displayName=jbe;function Kq(e){return e?"open":"closed"}var Nbe=Fq,Cbe=qq,_be=Uq,Gq=Wq;const wi=Nbe,ji=Cbe,ko=h.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>a.jsx(_be,{children:a.jsx(Gq,{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=Gq.displayName;var pD=1,kbe=.9,Abe=.8,Ebe=.17,CS=.1,_S=.999,Pbe=.9999,Rbe=.99,Tbe=/[\\\/_+.#"@\[\(\{&]/,Obe=/[\\\/_+.#"@\[\(\{&]/g,Mbe=/[\s-]/,Yq=/[\s-]/g;function JN(e,t,n,r,s,o,i){if(o===t.length)return s===e.length?pD:Rbe;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=JN(e,t,n,r,f+1,o+1,i),p>m&&(f===s?p*=pD:Tbe.test(e.charAt(f-1))?(p*=Abe,x=e.slice(s,f-1).match(Obe),x&&s>0&&(p*=Math.pow(_S,x.length))):Mbe.test(e.charAt(f-1))?(p*=kbe,j=e.slice(s,f-1).match(Yq),j&&s>0&&(p*=Math.pow(_S,j.length))):(p*=Ebe,s>0&&(p*=Math.pow(_S,f-s))),e.charAt(f)!==t.charAt(o)&&(p*=Pbe)),(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=JN(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 hD(e){return e.toLowerCase().replace(Yq," ")}function Ibe(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,JN(e,t,hD(e),hD(t),0,0,{})}var Ld='[cmdk-group=""]',kS='[cmdk-group-items=""]',$be='[cmdk-group-heading=""]',Xq='[cmdk-item=""]',mD=`${Xq}:not([aria-disabled="true"])`,ZN="cmdk-item-select",Tc="data-value",Dbe=(e,t,n)=>Ibe(e,t,n),Qq=h.createContext(void 0),kp=()=>h.useContext(Qq),Jq=h.createContext(void 0),pk=()=>h.useContext(Jq),Zq=h.createContext(void 0),eU=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=tU(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=Gbe();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,U);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||U(),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&&U(),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:Dbe;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 U(){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($be))==null||re.scrollIntoView({block:"nearest"})),oe.scrollIntoView({block:"nearest"}))}function z(){var F;return(F=A.current)==null?void 0:F.querySelector(`${Xq}[aria-selected="true"]`)}function I(){var F;return Array.from(((F=A.current)==null?void 0:F.querySelectorAll(mD))||[])}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?Vbe(re,Ld):Kbe(re,Ld),oe=re?.querySelector(mD);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(ZN);oe.dispatchEvent(ue)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:O.inputId,id:O.labelId,style:Xbe},d),dx(e,F=>h.createElement(Jq.Provider,{value:P},h.createElement(Qq.Provider,{value:O},F))))}),Lbe=h.forwardRef((e,t)=>{var n,r;let s=fr(),o=h.useRef(null),i=h.useContext(Zq),c=kp(),d=tU(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=nU(s,o,[e.value,e.children,o],e.keywords),p=pk(),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(ZN,j),()=>E.removeEventListener(ZN,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)}),Fbe=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),[]),nU(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(Zq.Provider,{value:v},x))))}),zbe=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"})}),Bbe=h.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,o=pk(),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)}})}),qbe=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)))}),Ube=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(eU,{ref:t,...c}))))}),Wbe=h.forwardRef((e,t)=>Ai(n=>n.filtered.count===0)?h.createElement(lt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Hbe=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(eU,{List:qbe,Item:Lbe,Input:Bbe,Group:Fbe,Separator:zbe,Dialog:Ube,Empty:Wbe,Loading:Hbe});function Vbe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Kbe(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function tU(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=pk(),n=()=>e(t.snapshot());return h.useSyncExternalStore(t.subscribe,n,n)}function nU(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 Gbe=()=>{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 Ybe(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(Ybe(t),{ref:t.ref},n(t.props.children)):n(t)}var Xbe={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(hC,{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 Qbe=h.forwardRef(({className:e,...t},n)=>a.jsx(pa.Separator,{ref:n,className:$e("-mx-1 h-px bg-border",e),...t}));Qbe.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 gD={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:[]},vD={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"},xD=()=>({id:`agt-${Date.now()}`,name:"",provider:"openai",model:"gpt-4o",temperature:Pg,maxTokens:4096}),Jbe=()=>{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??xD()),[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(xD()),K.current=M;return}c&&(f(c),K.current=M)}},[o,i,c]);const U=d.provider==="anthropic"||d.provider==="openai"||d.provider==="azure",B=Array.from(new Set([...gD[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(!U){Ie({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),Ie({title:M.kind==="deployments"?"Deployments loaded":"Models loaded",description:`${M.items.length} ${M.kind} from ${M.source}`})}catch(M){Ie({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()){Ie({title:"Name is required",variant:"destructive"});return}x(!0);try{if(o)await r([...n,d]),Ie({title:"Agent created"}),t(`/libraries/agents/${encodeURIComponent(d.id)}`);else{const M=n.map(X=>X.id===c?.id?d:X);await r(M),Ie({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),Ie({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(N5,{className:"mr-2 h-4 w-4"}),"Test Connection"]})]}),b&&a.jsxs(Je,{children:[a.jsxs(Dt,{className:"flex-row items-center justify-between space-y-0",children:[a.jsx(Lt,{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(Ze,{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]}),vD[d.provider]&&a.jsxs("p",{className:"rounded-md bg-muted px-3 py-2 text-xs text-muted-foreground",children:["Hint: ",vD[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(Je,{children:[a.jsx(Dt,{children:a.jsx(Lt,{className:"text-base",children:"Configuration"})}),a.jsxs(Ze,{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(We,{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(We,{children:"Provider"}),a.jsxs(In,{value:d.provider,onValueChange:M=>f(X=>({...X,provider:M,model:gD[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(We,{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(Zt,{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..."})})]})]})]})})]}),U&&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(We,{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(We,{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(We,{children:"Temperature"}),a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:Xf(d.temperature).toFixed(2)})]}),a.jsx(Dq,{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(We,{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"})]})]})})]})},yD="mcplab.resultAssistantScenarioHandoff",bD=()=>{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(""),[U,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(ke=>ke.id===re):-1,ye=ae>=0?o[ae]:void 0,se=async ke=>{if(!ye||ae<0||!ke)return;const Pe=[...o];Pe[ae]=ke,await i(Pe)},de=async()=>{const ke=X.current;if(!ke||!ye)return;if(H.current){M.current=!0;return}H.current=!0,M.current=!1;const Pe=++$.current;O("saving"),K("");try{await se(ke),Pe===$.current&&O("saved")}catch(et){const ht=et instanceof Error?et.message:String(et);Pe===$.current&&(O("error"),K(ht)),Ie({title:"Could not save scenario",description:ht,variant:"destructive"})}finally{H.current=!1,M.current&&(M.current=!1,de())}},De=ke=>{X.current=ke,O("dirty"),K(""),V.current&&window.clearTimeout(V.current),V.current=window.setTimeout(()=>{V.current=null,de()},700)},ge=async()=>{const ke=`scn-${Date.now()}`;let Pe=ke,et=1;for(;o.some(zt=>zt.id===Pe);)Pe=`${ke}-${et}`,et+=1;const ht={id:Pe,name:"",serverIds:[],prompt:"",evalRules:[],extractRules:[]};await i([...o,ht]),r(`/libraries/test-cases/${encodeURIComponent(Pe)}`),Ie({title:"Test case created",description:`Opened ${Pe} for editing.`})},ve=ke=>{const Pe=(ke||`scn-${Date.now()}`).trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9_-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")||`scn-${Date.now()}`;let et=Pe,ht=1;for(;o.some(zt=>zt.id===et);)et=`${Pe}-${ht}`,ht+=1;return et},Se=async(ke,Pe=!1)=>{const et=ve(`${ke.id}-copy`),ht={...structuredClone(ke),id:et,name:ke.name?`${ke.name} (Copy)`:""};await i([...o,ht]),Ie({title:"Test case duplicated",description:`Created ${ht.id}.`}),Pe&&r(`/libraries/test-cases/${encodeURIComponent(ht.id)}`)},at=async ke=>{V.current&&(window.clearTimeout(V.current),V.current=null);const Pe=o.filter(et=>et.id!==ke.id);await i(Pe),Ie({title:"Test case deleted",description:`${ke.id} was removed.`}),ye?.id===ke.id&&(E(null),X.current=null,O("idle"),K(""),r("/libraries/test-cases"))},tt=ke=>ke.map(Pe=>d.find(et=>et.id===Pe)).filter(Boolean).map(Pe=>Pe?.name||Pe?.id).filter(Boolean),it=h.useMemo(()=>{const ke=new Set;for(const Pe of o)for(const et of tt(Pe.serverIds))ke.add(et);return Array.from(ke).sort((Pe,et)=>Pe.localeCompare(et))},[o,d]),kt=h.useMemo(()=>{const ke=p.trim().toLowerCase(),Pe=o.filter(et=>{const ht=(et.name||"").toLowerCase(),zt=et.id.toLowerCase(),Bt=(et.prompt||"").toLowerCase(),Nt=tt(et.serverIds);return x!=="all"&&!Nt.includes(x)?!1:ke?ht.includes(ke)||zt.includes(ke)||Bt.includes(ke)||Nt.some(an=>an.toLowerCase().includes(ke)):!0});return Pe.sort((et,ht)=>{const zt=tt(et.serverIds),Bt=tt(ht.serverIds);let Nt=0;switch(y){case"id":Nt=et.id.localeCompare(ht.id);break;case"servers":Nt=zt.length-Bt.length;break;case"evalRules":Nt=et.evalRules.length-ht.evalRules.length;break;case"extractRules":Nt=et.extractRules.length-ht.extractRules.length;break;default:Nt=(et.name||et.id).localeCompare(ht.name||ht.id);break}return Nt===0&&(Nt=et.id.localeCompare(ht.id)),S==="asc"?Nt:-Nt}),Pe},[o,p,x,y,S,d]);h.useEffect(()=>{let ke=!0;return s.getWorkspaceSettings().then(Pe=>{!ke||!Pe||k(Pe.scenarioAssistantAgentName??"")}).catch(()=>{ke&&k("")}),()=>{ke=!1}},[s]),h.useEffect(()=>{if(re&&t.get("assistantHandoff")==="1")try{const ke=window.sessionStorage.getItem(yD);if(!ke)return;const Pe=JSON.parse(ke);if(!Pe||Pe.scenarioId!==re||!Pe.prompt)return;B(String(Pe.prompt)),z(Date.now()),window.sessionStorage.removeItem(yD);const et=new URLSearchParams(t);et.delete("assistantHandoff"),n(et,{replace:!0}),Ie({title:"Suggestion sent to Scenario Assistant",description:"Review the suggestion and apply changes in the scenario editor."})}catch{}},[re,t,n]),h.useEffect(()=>{const ke=V.current!==null||H.current,Pe=X.current;if(ye&&Pe?.id===ye.id&&ke)return;if(!!Pe&&Pe.id!==ye?.id&&(V.current!==null||M.current)){V.current!==null&&(window.clearTimeout(V.current),V.current=null),M.current=!1;const ht=F.current,zt=ht.findIndex(Bt=>Bt.id===Pe.id);if(zt>=0){const Bt=[...ht];Bt[zt]=Pe,G.current(Bt)}}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 Ge=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(dC,{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(We,{className:"text-xs",children:"Search"}),a.jsxs("div",{className:"relative",children:[a.jsx(hC,{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:ke=>v(ke.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(We,{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(ke=>a.jsx(ut,{value:ke,children:ke},ke))]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Sort By"}),a.jsxs(In,{value:y,onValueChange:ke=>b(ke),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(We,{className:"text-xs",children:"Direction"}),a.jsxs(In,{value:S,onValueChange:ke=>N(ke),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(Je,{children:a.jsxs(Ze,{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(ke=>{const Pe=re===ke.id,et=`/libraries/test-cases/${encodeURIComponent(ke.id)}`,ht=tt(ke.serverIds);return a.jsx("div",{className:`rounded-lg border p-3 ${Pe?"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:et,className:"font-medium truncate hover:underline",children:ke.name||ke.id}),a.jsx(Qe,{variant:"outline",className:"font-mono text-[10px]",children:ke.id}),Pe&&a.jsx(Qe,{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:[ht.length," server",ht.length!==1?"s":""]}),a.jsxs("span",{children:[ke.evalRules.length," eval rule",ke.evalRules.length!==1?"s":""]}),a.jsxs("span",{children:[ke.extractRules.length," extract rule",ke.extractRules.length!==1?"s":""]})]}),ht.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1",children:ht.map(zt=>a.jsx(Qe,{variant:"secondary",className:"text-[10px]",children:zt},`${ke.id}-${zt}`))})]}),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(ke),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(ke)},children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Duplicate"]}),a.jsx(Z,{type:"button",size:"sm",variant:Pe?"default":"outline",asChild:!0,children:a.jsxs(At,{to:et,children:[a.jsx(Zf,{className:"mr-1.5 h-3.5 w-3.5"}),"Edit"]})})]})]})},ke.id)})})]})})]}),ye&&A?a.jsxs(Je,{children:[a.jsx(Dt,{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(Lt,{className:"text-base",children:["Edit Test Case ·"," ",a.jsx("code",{className:"font-mono text-muted-foreground",children:ye.id})]}),a.jsx(Qe,{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(Ze,{className:"pt-3",children:a.jsx(KN,{scenarios:[A],agents:c,servers:d,defaultAssistantAgentName:Ge,assistantInitialPromptByScenarioId:U&&A?.id?{[A.id]:U}:void 0,assistantAutoOpenNonceByScenarioId:A?.id&&Y?{[A.id]:Y}:void 0,onChange:ke=>{const Pe=ke[0];Pe&&(E(Pe),De(Pe))},allowAdd:!1})})]}):null,a.jsx(Ps,{open:!!I,onOpenChange:ke=>!ke&&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"})]})]})})]})},Zbe=()=>{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"),Ie({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}),Ie({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),Ie({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)}),Ie({title:"Settings updated",description:`Evaluation workers set to ${k}.`})}catch(E){x(A),Ie({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}),Ie({title:"Settings updated",description:k?`Default evaluation judge set to ${k}.`:"Default evaluation judge cleared."})}catch(E){p(A),Ie({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(mC,{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(Je,{children:[a.jsxs(Dt,{className:"pb-3",children:[a.jsx(Lt,{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(Ze,{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(We,{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(Je,{children:[a.jsxs(Dt,{className:"pb-3",children:[a.jsx(Lt,{className:"text-base",children:"Evaluation Judge"}),a.jsx(Mr,{children:"Default judge agent used by semantic agent checks during scenario evaluation runs."})]}),a.jsxs(Ze,{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(We,{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(Je,{children:[a.jsxs(Dt,{className:"pb-3",children:[a.jsx(Lt,{className:"text-base",children:"Evaluation Queue"}),a.jsx(Mr,{children:"Control how many queued evaluation runs may execute in parallel."})]}),a.jsxs(Ze,{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(We,{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"})]})]})]})},e0e=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(e0e({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 t0e="127.0.0.1",n0e=3011,r0e="/mcp",a0e=`http://${t0e}:${n0e}${r0e}`;function s0e(e){return navigator.clipboard.writeText(e)}function rU({text:e,label:t}){const[n,r]=h.useState(!1),s=async()=>{try{await s0e(e),r(!0),Ie({title:"Copied",description:`${t} copied to clipboard.`}),window.setTimeout(()=>r(!1),1500)}catch(o){Ie({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(rU,{text:n,label:e})]})})}function wD({title:e,description:t,code:n,iconSrc:r}){return a.jsxs(Je,{children:[a.jsxs(Dt,{className:"pb-3",children:[a.jsxs(Lt,{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(Ze,{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(rU,{text:n,label:e})})]})]})}const o0e=()=>{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),Ie({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??a0e,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(KS,{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(KS,{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(Je,{children:[a.jsxs(Dt,{className:"pb-3",children:[a.jsx(Lt,{className:"text-base",children:"Connection Details"}),a.jsx(Mr,{children:"The local server is exposed over streamable HTTP."})]}),a.jsx(Ze,{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(wD,{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(wD,{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 i0e(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,l0e(s,...t)]}function l0e(...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 c0e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],aU=c0e.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}},{}),hk="Progress",mk=100,[u0e]=i0e(hk),[d0e,f0e]=u0e(hk),sU=h.forwardRef((e,t)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:o=p0e,...i}=e;(s||s===0)&&!jD(s)&&console.error(h0e(`${s}`,"Progress"));const c=jD(s)?s:mk;r!==null&&!SD(r,c)&&console.error(m0e(`${r}`,"Progress"));const d=SD(r,c)?r:null,f=Rg(d)?o(d,c):void 0;return a.jsx(d0e,{scope:n,value:d,max:c,children:a.jsx(aU.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":Rg(d)?d:void 0,"aria-valuetext":f,role:"progressbar","data-state":lU(d,c),"data-value":d??void 0,"data-max":c,...i,ref:t})})});sU.displayName=hk;var oU="ProgressIndicator",iU=h.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,s=f0e(oU,n);return a.jsx(aU.div,{"data-state":lU(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:t})});iU.displayName=oU;function p0e(e,t){return`${Math.round(e/t*100)}%`}function lU(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Rg(e){return typeof e=="number"}function jD(e){return Rg(e)&&!isNaN(e)&&e>0}function SD(e,t){return Rg(e)&&!isNaN(e)&&e<=t&&e>=0}function h0e(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${mk}\`.`}function m0e(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 ${mk} if no \`max\` prop is set)
|
|
142
|
-
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
143
|
-
|
|
144
|
-
Defaulting to \`null\`.`}var cU=sU,g0e=iU;const fx=h.forwardRef(({className:e,value:t,...n},r)=>a.jsx(cU,{ref:r,className:$e("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:a.jsx(g0e,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));fx.displayName=cU.displayName;function uU(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 v0e(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(Zt,{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(Qe,{variant:"outline",className:"text-[10px]",children:v0e(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 ND({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)),Ie({title:`${e} copied`})}catch(o){Ie({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 dU({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(Qe,{variant:"outline",className:"border-border text-[10px] text-muted-foreground",children:"input"}),t!==void 0&&a.jsx(Qe,{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(Zt,{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(ND,{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(ND,{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 x0e(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 CD(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),Ie({title:`${e} copied`})}catch(r){Ie({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(CW,{className:"h-3.5 w-3.5"}),"Suggested improvement"]}),a.jsx("p",{children:e})]})}function y0e({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(Qe,{variant:"outline",className:n,children:e})}),a.jsx(Gs,{className:"max-w-sm text-xs",children:a.jsx("p",{children:t})})]})})}function gk(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 fU({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-${CD(`${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})},U=()=>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(Je,{children:a.jsxs(Ze,{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(Je,{children:a.jsxs(Ze,{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(Je,{children:a.jsxs(Ze,{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(Je,{children:[a.jsxs(Dt,{className:"pb-3",children:[a.jsx(Lt,{className:"text-base",children:"Analysis Overview"}),a.jsx(Mr,{children:"Visual breakdown of findings by severity. Click badges to filter the report."})]}),a.jsx(Ze,{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(Qe,{variant:"outline",className:`capitalize font-normal ${I?em(z):x0e(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(Zt,{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:U,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(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx(Lt,{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(Ze,{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(Qe,{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(Qe,{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(Je,{children:[a.jsxs(Dt,{className:"pb-3",children:[a.jsx(Lt,{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(Ze,{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=uU(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-${CD(`${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(y0e,{label:M,reason:T.classificationReason,variantClassName:X})]}),a.jsx(Zt,{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(dU,{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(Qe,{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(Qe,{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(Qe,{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 pU(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 b0e(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 _D(e){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function w0e(e,t){const n=["tool-info",_D(e)],r=t?.trim();return r&&n.push(`v${_D(r)}`),`${n.filter(Boolean).join("-")}.json`}function RS(e,t){const n=typeof navigator<"u"?navigator.language:void 0;return e.toLocaleString(n)}function j0e(e,t){let n=0,r=!1;for(const s of e){const o=s.tokenEstimate;if(!o)continue;r=!0;const i=new Set(t[s.serverName]??[]);n+=o.tools.filter(c=>i.has(c.name)).reduce((c,d)=>c+d.total,0)}return r?n:void 0}function S0e(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 TS="mcplab.toolAnalysis.activeJobId";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)}async function N0e(e,t){try{await navigator.clipboard.writeText(t),Ie({title:`${e} copied`})}catch(n){Ie({title:`Could not copy ${e.toLowerCase()}`,description:n instanceof Error?n.message:String(n),variant:"destructive"})}}function kD({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(xW,{className:"h-3.5 w-3.5"})})}),a.jsx(Gs,{className:"max-w-xs text-xs",children:a.jsx("p",{children:e})})]})}function C0e(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 _0e({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(Qe,{variant:"outline",className:n,children:e})}),a.jsx(Gs,{className:"max-w-sm text-xs",children:a.jsx("p",{children:t})})]})})}const k0e=()=>{const e=_e=>`tool-analysis-${Date.now()}.${_e}`,{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,U]=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(()=>S0e(z),[z]);h.useEffect(()=>{let _e=!0;return t.getWorkspaceSettings().then(Be=>{!_e||!Be||c(Be.scenarioAssistantAgentName??"")}).catch(()=>{_e&&c("")}),()=>{_e=!1}},[t]),h.useEffect(()=>()=>{de.current?.()},[]),h.useEffect(()=>{const _e=De.current;_e&&requestAnimationFrame(()=>{_e.scrollTop=_e.scrollHeight})},[z.length]);const Se=()=>{try{sessionStorage.removeItem(TS)}catch{}},at=_e=>{try{sessionStorage.setItem(TS,_e)}catch{}},tt=_e=>{de.current?.(),de.current=t.subscribeToolAnalysisJob(_e,Be=>{if(I(Ye=>[...Ye,Be]),Be.type==="completed")t.getToolAnalysisResult(_e).then(Ye=>{V(Ye.report),M(Ye.savedReportId??null)}).catch(Ye=>Ie({title:"Could not load analysis report",description:Ye instanceof Error?Ye.message:String(Ye),variant:"destructive"})).finally(()=>{Se(),Y(null),$(!1),ae("idle"),G("run")});else if(Be.type==="error"){const Ye=String(Be.payload?.message??"");Se(),ae(Ye.toLowerCase().includes("abort")?"stopped":"error"),Y(null),$(!1)}})};h.useEffect(()=>{if(B||T)return;let _e="";try{_e=sessionStorage.getItem(TS)??""}catch{_e=""}if(_e)return G("run"),ae("running"),$(!0),Y(_e),I([]),tt(_e),()=>{}},[t,B,T]);const it=async()=>{if(d.length===0){x([]),y({});return}const _e=d.filter(Be=>n.find(Et=>Et.id===Be)?.authType==="oauth2");try{_e.length>0&&(se(!0),await _o({serverNames:_e,source:t,onServerAuthStart:Be=>{Ie({title:`OAuth login required for ${Be}`,description:"Complete login in the opened browser tab. Discovery will continue automatically."})}}))}catch(Be){Ie({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(Ye=>{const Et={};for(const ft of Be.servers){const fe=Ye[ft.serverName]??[],Oe=ft.tools.map(q=>q.name),Ke=fe.filter(q=>Oe.includes(q));Et[ft.serverName]=Ke.length>0?Ke:Oe}return Et})}catch(Be){Ie({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 _e=b.trim().toLowerCase();return _e?v.map(Be=>({...Be,tools:Be.tools.filter(Ye=>Ye.name.toLowerCase().includes(_e)||(Ye.description||"").toLowerCase().includes(_e))})).filter(Be=>Be.tools.length>0):v},[v,b]),Ge=h.useMemo(()=>Object.values(j).reduce((_e,Be)=>_e+Be.length,0),[j]),ke=h.useMemo(()=>j0e(v,j),[v,j]),Pe=d[0]??"",et=async()=>{if(!N&&!k){Ie({title:"Select at least one mode",variant:"destructive"});return}if(d.length!==1){Ie({title:"Select exactly one server",variant:"destructive"});return}if(Ge===0){Ie({title:"Select at least one tool",variant:"destructive"});return}$(!0),I([]),V(null),M(null),G("run"),ae("running");try{const _e=d[0];n.find(Et=>Et.id===_e)?.authType==="oauth2"&&(se(!0),await _o({serverNames:[_e],source:t,onServerAuthStart:Et=>{Ie({title:`OAuth login required for ${Et}`,description:"Complete login in the opened browser tab. Analysis will continue automatically."})}}));const{jobId:Ye}=await t.startToolAnalysis({serverNames:d,selectedToolsByServer:j,maxParallelTools:E,modes:{metadataReview:N,deeperAnalysis:k},deeperAnalysisOptions:{autoRunPolicy:"read_only_allowlist",sampleCallsPerTool:O,toolCallTimeoutMs:K}});Y(Ye),at(Ye),tt(Ye)}catch(_e){$(!1),ae("error"),G("run"),Ie({title:"Could not start tool analysis",description:_e instanceof Error?_e.message:String(_e),variant:"destructive"})}finally{se(!1)}},ht=()=>{const _e=d[0],Be=v.find(Et=>Et.serverName===_e);if(!_e||!Be){Ie({title:"No discovered tool info available",description:"Select a server and discover tools before downloading tool info.",variant:"destructive"});return}const Ye=b0e({serverName:Be.serverName,tools:Be.tools,selectedToolNames:j[Be.serverName]});OS(w0e(Be.serverName,Be.mcpServerVersion),`${JSON.stringify(Ye,null,2)}
|
|
147
|
-
`,"application/json")},zt=async()=>{if(!B)return;const _e=B;try{const Be=await t.stopToolAnalysis(_e);if(Be.status==="completed"){de.current?.(),de.current=null;const Ye=await t.getToolAnalysisResult(_e);V(Ye.report),M(Ye.savedReportId??null),Se(),Y(null),$(!1),ae("idle"),G("run"),Ie({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"),Ie({title:"Analysis stopped"});return}if(Be.status==="error"){de.current?.(),de.current=null,Se(),Y(null),$(!1),ae("error"),Ie({title:"Analysis already ended with an error",description:"Review the progress log and return to Configure Analysis."});return}Ie({title:"Stopping analysis..."})}catch(Be){Ie({title:"Could not stop analysis",description:Be instanceof Error?Be.message:String(Be),variant:"destructive"})}},Bt=()=>{G("configure"),ae("idle"),Y(null)},Nt=(_e,Be)=>{f(Ye=>Be?[_e]:Ye.filter(Et=>Et!==_e))},an=(_e,Be,Ye)=>{y(Et=>{const ft=new Set(Et[_e]??[]);return Ye?ft.add(Be):ft.delete(Be),{...Et,[_e]:Array.from(ft)}})},sn=(_e,Be)=>{y(Ye=>({...Ye,[_e]:Be}))},Ut=!0,nn=B!==null||z.length>0||ue==="stopped"||ue==="error",rn=!!T,on=_e=>{if(_e==="configure"&&Ut){G("configure");return}if(_e==="run"&&nn){G("run");return}_e==="report"&&rn&&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(j5,{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:()=>on("configure"),className:"rounded-full","aria-label":"Open Configure Analysis",children:a.jsx(Qe,{variant:F==="configure"?"default":"outline",className:"cursor-pointer",children:"Configure Analysis"})}),a.jsx("button",{type:"button",onClick:()=>on("run"),disabled:!nn,className:"rounded-full disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open Run Analysis",children:a.jsx(Qe,{variant:F==="run"?"default":"outline",className:nn?"cursor-pointer":"cursor-not-allowed",children:"Run Analysis"})}),a.jsx("button",{type:"button",onClick:()=>on("report"),disabled:!rn,className:"rounded-full disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open Report",children:a.jsx(Qe,{variant:F==="report"?"default":"outline",className:rn?"cursor-pointer":"cursor-not-allowed",children:"Report"})})]})]}),F==="configure"&&a.jsxs(Je,{children:[a.jsxs(Dt,{children:[a.jsx(Lt,{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(Ze,{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(We,{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(_e=>{const Be=d.includes(_e.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:Ye=>Nt(_e.id,!!Ye)}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-medium",children:_e.name||_e.id}),_e.url&&a.jsx("div",{className:"truncate text-xs text-muted-foreground",children:_e.url})]})]},_e.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(We,{className:"text-xs",children:"Filter visible tools"}),a.jsxs("div",{className:"relative",children:[a.jsx(hC,{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:_e=>S(_e.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(We,{className:"text-xs",children:Pe?`Tools for ${Pe}`:"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:ht,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(_e=>{const Be=new Set(j[_e.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.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("div",{className:"font-medium",children:_e.serverName}),_e.tokenEstimate&&a.jsxs(Qe,{variant:"outline",className:"bg-background font-mono text-xs font-normal",title:"Estimated tokens for all discovered tool definitions and their schemas",children:["~",RS(_e.tokenEstimate.total),"tok"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>{N0e("Tool list",`${JSON.stringify({server:_e.serverName,tools:_e.tools.map(Ye=>({name:Ye.name,title:Ye.title,description:Ye.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:()=>sn(_e.serverName,_e.tools.map(Ye=>Ye.name)),children:"Select all"}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>sn(_e.serverName,[]),children:"Clear"})]})]}),_e.warnings.length>0&&a.jsx("div",{className:"mb-2 space-y-1",children:_e.warnings.map(Ye=>a.jsx("div",{className:"text-xs text-amber-700",children:C0e(_e.serverName,Ye)},`${_e.serverName}-${Ye}`))}),a.jsx("div",{className:"grid gap-2",children:_e.tools.map(Ye=>{const Et=_e.tokenEstimate?.tools.find(Ke=>Ke.name===Ye.name),ft=uU(Ye.classificationReason),fe=Ye.safetyClassification==="read_only"?"read-only":ft?"write/delete":"unsafe/unknown",Oe=Ye.safetyClassification==="read_only"?"border-emerald-200 bg-emerald-50 text-emerald-700":ft?"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(Ye.name),onCheckedChange:Ke=>an(_e.serverName,Ye.name,!!Ke)}),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:Ye.name}),Ye.title&&a.jsx("span",{className:"text-xs text-muted-foreground",children:Ye.title}),a.jsx(_0e,{label:fe,reason:Ye.classificationReason,variantClassName:Oe}),Ye.inputSchema&&a.jsx(Qe,{variant:"outline",className:"border-border text-[10px] text-muted-foreground",children:"schema: input"}),Ye.outputSchema&&a.jsx(Qe,{variant:"outline",className:"border-border text-[10px] text-muted-foreground",children:"schema: output"}),Et&&a.jsxs(Qe,{variant:"outline",className:"bg-background font-mono text-[10px] font-normal",title:"Estimated tokens for this tool definition and its schemas",children:["~",RS(Et.total),"tok"]})]}),Ye.description&&a.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:Ye.description}),a.jsx(dU,{inputSchema:Ye.inputSchema,outputSchema:Ye.outputSchema,mode:re,onModeChange:oe})]})]},`${_e.serverName}-${Ye.name}`)})})]},_e.serverName)})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Selected tools: ",Ge,ke!==void 0&&` · estimated context: ~${RS(ke)} tokens`]})]}),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:_e=>C(!!_e)}),a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:["Metadata / schema review",a.jsx(kD,{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:_e=>A(!!_e)}),a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:["Deeper analysis",a.jsx(kD,{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(We,{className:"text-xs",children:"Max parallel tools"}),a.jsx(_t,{type:"number",min:1,max:8,value:E,onChange:_e=>P(Math.max(1,Math.min(8,Number(_e.target.value)||2))),className:"h-8"})]}),k?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{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(We,{className:"text-xs",children:"Sample calls per tool"}),a.jsx(_t,{type:"number",min:1,max:5,value:O,onChange:_e=>D(Math.max(1,Math.min(5,Number(_e.target.value)||1))),className:"h-8"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Tool call timeout (ms)"}),a.jsx(_t,{type:"number",min:1e3,max:6e4,step:500,value:K,onChange:_e=>U(Math.max(1e3,Math.min(6e4,Number(_e.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:()=>{et()},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(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Lt,{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:()=>{zt()},children:"Stop Analysis"}):a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:Bt,children:"Back to Configure Analysis"})]})}),a.jsxs(Ze,{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((_e,Be)=>a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"mr-2 font-mono text-muted-foreground",children:new Date(_e.ts).toLocaleTimeString()}),a.jsx(Qe,{variant:"outline",className:"mr-2 text-[10px]",children:_e.type}),a.jsx("span",{className:"break-all",children:typeof _e.payload.message=="string"?_e.payload.message:JSON.stringify(_e.payload)})]},`${_e.ts}-${Be}`))}),!B&&T&&a.jsx(Je,{className:"mt-2 border-green-200 bg-green-50/40 dark:border-green-900/40 dark:bg-green-950/10",children:a.jsxs(Ze,{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:()=>on("report"),children:"View inline report"})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[T.summary.issueCounts.critical>0&&a.jsxs(Qe,{className:"bg-red-600 text-white hover:bg-red-600",children:["Critical: ",T.summary.issueCounts.critical]}),T.summary.issueCounts.high>0&&a.jsxs(Qe,{className:"bg-orange-500 text-white hover:bg-orange-500",children:["High: ",T.summary.issueCounts.high]}),T.summary.issueCounts.medium>0&&a.jsxs(Qe,{className:"bg-amber-500 text-white hover:bg-amber-500",children:["Medium: ",T.summary.issueCounts.medium]}),T.summary.issueCounts.low>0&&a.jsxs(Qe,{className:"bg-blue-500 text-white hover:bg-blue-500",children:["Low: ",T.summary.issueCounts.low]}),T.summary.issueCounts.info>0&&a.jsxs(Qe,{variant:"outline",children:["Info: ",T.summary.issueCounts.info]}),Object.values(T.summary.issueCounts).every(_e=>_e===0)&&a.jsx(Qe,{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:Bt,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:()=>OS(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:()=>OS(e("md"),gk(T),"text/markdown"),children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export Markdown"]})]})]}),a.jsx(fU,{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 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 A0e(){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){Ie({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)),Ie({title:"Tool analysis report deleted"}),i(null)}catch(P){Ie({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"?MS(`${P}.json`,`${JSON.stringify(D,null,2)}
|
|
150
|
-
`,"application/json"):O==="tool_schemas"?MS(`${P}-tool-schemas.json`,`${JSON.stringify(pU(D),null,2)}
|
|
151
|
-
`,"application/json"):MS(`${P}.md`,gk(D.report),"text/markdown")}catch(D){Ie({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(S5,{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(Zt,{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(Je,{children:a.jsx(Ze,{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(Ht,{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(Ht,{children:[a.jsx(qe,{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(qe,{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(qe,{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(qe,{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(Qe,{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(Qe,{variant:"outline",children:"No issues"})]})}),a.jsx(qe,{children:a.jsxs("div",{className:"flex flex-wrap gap-1",children:[P.modes.metadataReview&&a.jsx(Qe,{variant:"outline",children:"metadata"}),P.modes.deeperAnalysis&&a.jsx(Qe,{variant:"outline",children:"deeper"})]})}),a.jsx(qe,{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 IS(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 E0e(){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}Ie({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),Ie({title:"Tool analysis report deleted"}),t("/tool-analysis-results")}catch(j){Ie({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:()=>IS(`${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:()=>IS(`${r.reportId}.md`,gk(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:()=>IS(`${r.reportId}-tool-schemas.json`,`${JSON.stringify(pU(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(fU,{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 P0e=[{id:"configure",label:"Configure Debug Session"},{id:"run",label:"Run / Inspect Flow"},{id:"report",label:"Report / Export"}],R0e="resolve_target_metadata",T0e="token_exchange",O0e="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(NW,{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 AD(e){return navigator.clipboard.writeText(e)}function $S(){return typeof window>"u"?"":window.location.port==="8685"?"http://127.0.0.1:8787":""}function DS(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 M0e(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 I0e(){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,U]=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,Ge]=h.useState(!1),[ke,Pe]=h.useState(!1),[et,ht]=h.useState("all"),[zt,Bt]=h.useState("all"),[Nt,an]=h.useState("inspector"),sn=h.useRef(null),Ut=h.useRef(null),nn=h.useRef(!1),rn=h.useRef(j);h.useEffect(()=>{rn.current=j},[j]),h.useEffect(()=>()=>{sn.current?.(),sn.current=null},[]),h.useEffect(()=>{Ut.current?.scrollIntoView({behavior:"smooth",block:"end"})},[Se.length]);const on=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]),_e=on.find(ee=>ee.id===i);h.useEffect(()=>{i&&(on.some(ee=>ee.id===i)||c(""))},[on,i]),h.useEffect(()=>{_e&&(_e.oauthMode==="dcr"?(f("dcr"),P(""),D("")):(f("pre_registered"),P(_e.oauthClientId??""),D(_e.oauthClientSecret??"")),C(_e.oauthScope??""),$(_e.oauthAuthorizationUrl??""),G(_e.oauthTokenEndpoint??""))},[_e?.id]);const Be=h.useMemo(()=>{const ee=de?.stepStates.length??0,Le=de?.stepStates.filter(Re=>Re.status==="completed"||Re.status==="skipped").length??0,ot=de?.stepStates.filter(Re=>Re.status==="failed").length??0,Wt=ee>0?Math.round((Le+ot)/ee*100):0;return{total:ee,completed:Le,failed:ot,percent:Wt}},[de]),Ye=h.useMemo(()=>{const ee=de?.network??[],Le=new Map,ot=[],Wt=Re=>`${Re.stepId}::${Re.label}::${Re.url}`;for(const Re of ee){if(Re.phase==="request"){const Xn=ot.length;ot.push({key:Re.id,stepId:Re.stepId,label:Re.label,method:Re.method,url:Re.url,request:Re});const qn=Wt(Re),to=Le.get(qn)??[];to.push(Xn),Le.set(qn,to);continue}const Jt=Wt(Re),Ct=Le.get(Jt),Yt=Ct?.shift();if(typeof Yt=="number"){ot[Yt]={...ot[Yt],response:Re},Ct&&Ct.length>0?Le.set(Jt,Ct):Le.delete(Jt);continue}ot.push({key:Re.id,stepId:Re.stepId,label:Re.label,method:Re.method,url:Re.url,response:Re})}return ot.filter(Re=>et!=="all"&&Re.stepId!==et?!1:zt==="error"?typeof Re.response?.status=="number"&&Re.response.status>=400:zt==="ok"?typeof Re.response?.status=="number"&&Re.response.status<400:!0)},[de?.network,et,zt]),Et=!!ge,ft=!!(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]),Oe=h.useMemo(()=>{const ee=(de?.network??[]).filter(ot=>ot.phase==="response"),Le=ot=>{const Wt=ee.filter(Re=>Re.label===ot);return[...Wt].reverse().find(Re=>typeof Re.status=="number"&&Re.status<400)??[...Wt].reverse()[0]};return{resourceMetadata:Le("Protected Resource Metadata"),authorizationServerMetadata:Le("Authorization Server Metadata")}},[de?.network]),Ke=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]),q=ee=>{if(ee==="configure"||ee==="run"&&Et||ee==="report"&&ft)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(!_e)throw new Error("Select an MCP server");return{profile:"latest",target:{serverName:_e.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=>{sn.current?.(),sn.current=e.subscribeOAuthDebuggerSession(ee,Le=>{at(Wt=>[...Wt,Le]),(Le.type==="completed"||Le.type==="error"||Le.type==="stopped")&&it(!1),e.getOAuthDebuggerSession(ee).then(Wt=>{De(Wt.session),Wt.session.uiHints.authorizationUrl&&J(`${$S()}/api/oauth-debugger/sessions/${ee}/authorize`),Wt.session.status==="completed"&&o("report")}).catch(()=>{})})},J=ee=>{!rn.current||nn.current||!ee||(nn.current=!0,window.open(ee,"_blank","noopener,noreferrer"))},xe=async()=>{Ge(!0),nn.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(`${$S()}/api/oauth-debugger/sessions/${Le.sessionId}/authorize`))}catch(ee){Ie({title:"Could not start OAuth Debugger session",description:ee instanceof Error?ee.message:String(ee),variant:"destructive"})}finally{Ge(!1)}},be=async()=>{if(ge)try{Ge(!0);const ee=await e.submitOAuthDebuggerManualCallback(ge,{redirectUrl:ye.trim()||void 0});De(ee.session),se(""),it(!0)}catch(ee){Ie({title:"Could not submit callback",description:ee instanceof Error?ee.message:String(ee),variant:"destructive"})}finally{Ge(!1)}},we=async()=>{if(ge){Pe(!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){Ie({title:"Could not stop session",description:ee instanceof Error?ee.message:String(ee),variant:"destructive"})}finally{Pe(!1)}}},W=async()=>{sn.current?.(),sn.current=null,De(null),ve(null),at([]),it(!1),Pe(!1),Ge(!1),se(""),ht("all"),Bt("all"),an("inspector"),o("run"),await xe()},he=async ee=>{if(!(!ge||!de))try{const Le=await e.exportOAuthDebuggerSession(ge,ee);let ot="";const Wt=ee==="json"?"json":ee==="raw"?"txt":"md";typeof Le=="string"?ot=Le:ot=`${JSON.stringify(Le,null,2)}
|
|
157
|
-
`;const Re=new Blob([ot],{type:"text/plain;charset=utf-8"}),Jt=URL.createObjectURL(Re),Ct=document.createElement("a");Ct.href=Jt,Ct.download=`oauth-debugger-${ge}.${Wt}`,Ct.click(),URL.revokeObjectURL(Jt)}catch(Le){if(ee==="markdown"){const ot=M0e(de,Se),Wt=new Blob([ot],{type:"text/markdown;charset=utf-8"}),Re=URL.createObjectURL(Wt),Jt=document.createElement("a");Jt.href=Re,Jt.download=`oauth-debugger-${de.id}.md`,Jt.click(),URL.revokeObjectURL(Re);return}Ie({title:"Export failed",description:Le instanceof Error?Le.message:String(Le),variant:"destructive"})}},Ae=ge?`${$S()}/api/oauth-debugger/sessions/${ge}/authorize`:void 0,He=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:P0e.map(ee=>{const Le=s===ee.id,ot=ee.id==="configure"||ee.id==="run"&&Et||ee.id==="report"&&ft;return a.jsx("button",{type:"button",onClick:()=>ot&&q(ee.id),disabled:!ot,className:"rounded-full",children:a.jsx(Qe,{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(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Lt,{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(Ze,{className:"space-y-3",children:a.jsxs("div",{className:"max-w-xl space-y-2",children:[a.jsx(We,{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:on.map(ee=>a.jsx(ut,{value:ee.id,children:ee.name||ee.id},ee.id))})]}),on.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"}),"."]}),_e&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[_e.transport," ·"," ",_e.url||_e.command||"No URL/command"," · ",a.jsxs("span",{className:"text-primary",children:[_e.oauthMode==="dcr"?"DCR":"pre-registered"," fields pre-filled"]})]})]})})]}),a.jsxs(Je,{children:[a.jsxs(Dt,{className:"pb-3",children:[a.jsx(Lt,{className:"text-base",children:"Client Registration Method"}),a.jsx(Mr,{children:"How your OAuth client is identified with the authorization server."})]}),a.jsxs(Ze,{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(We,{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(We,{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(We,{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(GN,{value:O,onChange:ee=>D(ee.target.value),placeholder:"optional"})]})]}),d==="cimd"&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{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(Je,{children:[a.jsxs(Dt,{className:"pb-3",children:[a.jsx(Lt,{className:"text-base",children:"Runtime OAuth Inputs"}),a.jsx(Mr,{children:"Parameters sent in the authorization request."})]}),a.jsxs(Ze,{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{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(We,{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(We,{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(We,{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:U,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(We,{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(We,{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(We,{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(We,{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(We,{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(We,{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(We,{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(We,{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(We,{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(We,{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(Je,{className:"xl:col-span-1 min-w-0",children:[a.jsx(Dt,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Lt,{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&&Ae&&a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsxs("a",{href:Ae,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:ke||!ge,children:[(ke||tt)&&ke&&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(Ze,{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:[Be.completed+Be.failed,"/",Be.total," steps"]}),a.jsxs("span",{children:[Be.percent,"%"]})]}),a.jsx(fx,{value:Be.percent,className:"h-2"})]}),de?.status==="waiting_for_user"&&a.jsx(Je,{children:a.jsxs(Ze,{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&&Ae&&a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsx("a",{href:Ae,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&&Ae&&a.jsx("div",{className:"pt-2",children:a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsxs("a",{href:Ae,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=Ke.get(ee.id),Wt=ee.id===T0e||ee.id===O0e,Re=!!(ot&&(ot.requests.length>0||ot.responses.length>0)),Jt=Wt&&ee.status!=="pending"&ℜ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(Qe,{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===R0e&&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 ",Oe.resourceMetadata?.url??"not captured"]}),a.jsx("pre",{className:"max-h-56 overflow-x-auto rounded-md bg-muted p-2 text-xs",children:DS(Oe.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"," ",Oe.authorizationServerMetadata?.url??"not captured"]}),a.jsx("pre",{className:"max-h-56 overflow-x-auto rounded-md bg-muted p-2 text-xs",children:DS(Oe.authorizationServerMetadata?.bodyText)})]})]})]}),Jt&&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,Yt)=>{const Xn=ot.requests[Yt],qn=ot.responses[Yt];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 ${Yt+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:DS(qn.bodyText)})]},`${ee.id}-exchange-${Yt}`)})})]})]},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(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Lt,{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(Ze,{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(Qe,{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:Ut})]})}),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(We,{className:"text-xs",children:"Filter by step"}),a.jsxs(In,{value:et,onValueChange:ht,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(We,{className:"text-xs",children:"Filter by status"}),a.jsxs(In,{value:zt,onValueChange:Bt,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:Ye.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No network exchanges captured yet."}):Ye.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(Qe,{variant:"outline",children:"request"}),a.jsx(Qe,{variant:"outline",children:"response"}),typeof ee.response?.status=="number"&&a.jsx(Qe,{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:()=>{AD(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(Je,{children:a.jsxs(Ze,{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(Je,{children:a.jsxs(Ze,{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(Je,{children:a.jsxs(Ze,{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(Je,{children:a.jsxs(Ze,{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(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsx(Lt,{className:"text-base",children:"Key values"})}),a.jsxs(Ze,{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Issuer"}),a.jsx("p",{className:"text-sm break-all",children:de.summary?.issuer||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Client ID"}),a.jsx("p",{className:"text-sm break-all",children:de.summary?.clientId||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Redirect URI"}),a.jsx("p",{className:"text-sm break-all",children:de.summary?.redirectUri||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Token endpoint status"}),a.jsx("p",{className:"text-sm",children:de.summary?.tokenEndpointStatus??"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Token type"}),a.jsx("p",{className:"text-sm",children:de.summary?.tokenType||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{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(We,{className:"text-xs",children:"Token validity"}),a.jsxs("p",{className:"text-sm",children:[typeof de.summary?.accessTokenValidForSeconds=="number"?`${HN(de.summary.accessTokenValidForSeconds)} remaining`:typeof de.summary?.accessTokenExpiresInSeconds=="number"?`${HN(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(We,{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(We,{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:()=>{AD(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(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsx(Lt,{className:"text-base",children:"Validation findings"})}),a.jsx(Ze,{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(Qe,{variant:He(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",[$0e]=kr(hx),[D0e,L0e]=$0e(hx),hU=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=Ot(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(D0e,{scope:n,checked:S,disabled:c,children:[a.jsx(lt.button,{type:"button",role:"switch","aria-checked":S,"aria-required":i,"data-state":xU(S),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:j,onClick:Ue(e.onClick,C=>{N(k=>!k),b&&(y.current=C.isPropagationStopped(),y.current||C.stopPropagation())})}),b&&a.jsx(vU,{control:v,bubbles:!y.current,name:r,value:d,checked:S,required:i,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});hU.displayName=hx;var mU="SwitchThumb",gU=h.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=L0e(mU,n);return a.jsx(lt.span,{"data-state":xU(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});gU.displayName=mU;var F0e="SwitchBubbleInput",vU=h.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...s},o)=>{const i=h.useRef(null),c=Ot(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}})});vU.displayName=F0e;function xU(e){return e?"checked":"unchecked"}var yU=hU,z0e=gU;const Og=h.forwardRef(({className:e,...t},n)=>a.jsx(yU,{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(z0e,{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=yU.displayName;function B0e(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 q0e(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 U0e(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 LS(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 FS(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 zS="mcplab.runEvaluation.activeJobId";function W0e(e){return e.configName?.trim()||e.name}function H0e(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 V0e=()=>{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([]),[U,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",Ge=de.find(fe=>fe.id===t),ke=h.useMemo(()=>B0e(de),[de]),Pe=h.useMemo(()=>q0e(de),[de]),et=h.useMemo(()=>U0e(de,Se),[de,Se]),ht=M[0]??null,zt=e.get("configId"),Bt=h.useMemo(()=>{if(!Ge)return[];const fe=new Map,Oe=Ge.agentEntries&&Ge.agentEntries.length>0?Ge.agentEntries:Ge.agents.map(Ke=>({kind:"inline",agent:Ke}));for(const Ke of Oe){if(Ke.kind==="inline"){const le=Ke.agent.id;fe.has(le)||fe.set(le,Ke.agent);continue}const q=ve.find(le=>le.id===Ke.ref);q&&!fe.has(q.id)&&fe.set(q.id,q)}for(const Ke of ve)fe.has(Ke.id)||fe.set(Ke.id,Ke);return Array.from(fe.values())},[Ge,ve]),Nt=h.useMemo(()=>{if(!Ge)return[];const fe=new Map,Oe=Ge.scenarioEntries&&Ge.scenarioEntries.length>0?Ge.scenarioEntries:Ge.scenarios.map(Ke=>({kind:"inline",scenario:Ke}));for(const Ke of Oe){if(Ke.kind==="inline"){fe.has(Ke.scenario.id)||fe.set(Ke.scenario.id,Ke.scenario);continue}const q=Se.find(le=>le.id===Ke.ref);q&&!fe.has(q.id)&&fe.set(q.id,q)}return Array.from(fe.values())},[Ge,Se]),an=h.useMemo(()=>{const fe=new Map;for(const Oe of at)fe.has(Oe.id)||fe.set(Oe.id,{id:Oe.id,name:Oe.name});for(const Oe of Ge?.servers??[])fe.set(Oe.id,{id:Oe.id,name:Oe.name});return Array.from(fe.values()).sort((Oe,Ke)=>Oe.id.localeCompare(Ke.id))},[Ge?.servers,at]);h.useEffect(()=>{zt&&de.some(fe=>fe.id===zt)&&n(zt)},[zt,de]);const sn=h.useRef("");h.useEffect(()=>{const fe=Ge?`${Ge.id}::${Ge.sourcePath??""}`:"";if(fe===sn.current)return;if(sn.current=fe,!Ge){k([]),E([]),O(!1),K([]),B({}),z({});return}const Oe=qN(Ge);k(Oe.length>0?Oe:Bt.map(Ke=>Ke.id)),E(Nt.map(Ke=>Ke.id)),O(!1),K([]),B({}),z({})},[Ge?.id,Ge?.sourcePath,Bt,Nt]);const Ut=async()=>{if(!Ge?.sourcePath){m(we=>[...we,`[${Gn()}] Missing source path for selected config.`]);return}const fe=Bt.filter(we=>C.includes(we.id));if(fe.length===0){m(we=>[...we,`[${Gn()}] Select at least one agent.`]);return}const Oe=Nt.filter(we=>A.includes(we.id)),Ke=new Set(Oe.map(we=>we.id)),q=P||Object.values(U).some(Boolean),le=Object.fromEntries(Object.entries(Y).filter(([we])=>Ke.has(we)&&U[we])),pe=Oe.map(we=>{const W=le[we.id]??(P?D:we.serverIds||[]);return`${we.id}=[${W.join(", ")}]`}).join("; ");if(Oe.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(Oe.flatMap(we=>q?le[we.id]?le[we.id]??[]:P?D:we.serverIds||[]:we.serverIds||[]).filter(we=>{const W=(Ge.servers??[]).find(Ae=>Ae.id===we),he=at.find(Ae=>Ae.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=(Ge.serverEntries??[]).some(we=>we.kind==="referenced")||(Ge.agentEntries??[]).some(we=>we.kind==="referenced")||(Ge.scenarioEntries??[]).some(we=>we.kind==="referenced")?"refs-composed":"single-file/inline";m([`[${Gn()}] Starting evaluation run...`,`[${Gn()}] Config=${Ge.name} mode=${be} agents=${fe.map(we=>we.name||we.id).join(", ")} tests=${Oe.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:Ge.sourcePath,runsPerScenario:Number(r),agents:fe.map(W=>W.id),scenarioIds:Oe.map(W=>W.id),...q&&P?{serverOverrideAll:D}:{},...q&&Object.keys(le).length>0?{scenarioServerOverrides:le}:{},runNote:I.trim()?I.trim():void 0});N(we),_e(we),ft(we),Be()}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(Ae=>[...Ae,`[${Gn()}] Error: ${W}${he}`]),i(!1),d(0),N(null),re(!1)}},nn=()=>{Ut()},rn=()=>{S&&ge.stopRun(S),ye.current?.(),ye.current=null,on(),N(null),i(!1),v(!1),j(!0),m(fe=>[...fe,`[${Gn()}] Run aborted by user.`]),Be()};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(zS)??""}catch{fe=""}if(fe)return N(fe),i(!0),v(!1),j(!1),m(Oe=>Oe.length>0?Oe:[`[${Gn()}] Reattached to in-progress evaluation run...`]),ft(fe),()=>{}},[S,p]);const on=()=>{try{sessionStorage.removeItem(zS)}catch{}},_e=fe=>{try{sessionStorage.setItem(zS,fe)}catch{}},Be=async()=>{try{const fe=await ge.getRunQueue();H(fe.queued),X(fe.active_jobs??(fe.active?[fe.active]:[])),F(fe.admitting_jobs??[]);const Oe=S==null?void 0:fe.queued.find(Ke=>Ke.jobId===S&&Ke.status==="blocked_auth"&&Ke.blockedReason==="oauth_required");Oe&&(Oe.requiredServers??[]).length>0?ue(Ke=>Ke?.jobId===Oe.jobId?Ke:{jobId:Oe.jobId,servers:Oe.requiredServers}):(oe?.jobId&&oe.jobId!==S||S!=null&&!fe.queued.some(Ke=>Ke.jobId===S&&Ke.status==="blocked_auth"&&Ke.blockedReason==="oauth_required"))&&ue(null)}catch{}},Ye=()=>{De(),tt()};h.useEffect(()=>{Ye(),Be();const fe=()=>{Ye(),Be()};return window.addEventListener("focus",fe),()=>{window.removeEventListener("focus",fe)}},[De,tt]);const Et=async fe=>{try{await ge.removeQueuedRun(fe),H(Oe=>Oe.filter(Ke=>Ke.jobId!==fe))}catch(Oe){const Ke=Oe instanceof Error?Oe.message:String(Oe);if(Ke.includes("Use the /stop endpoint"))try{await ge.stopRun(fe)}catch{}else Ie({title:"Could not remove queued run",description:Ke,variant:"destructive"})}Be()},ft=fe=>{S===fe&&ye.current||(ye.current?.(),ye.current=ge.subscribeRunJob(fe,Oe=>{const Ke=new Date(Oe.ts).toLocaleTimeString();if(Oe.type==="queued"){m(q=>{const le=Oe.payload.position?` (position ${Oe.payload.position})`:"",pe=`[${Ke}] Run queued${le}. Waiting for active run to finish...`;return q.includes(pe)?q:[...q,pe]}),d(5);return}if(Oe.type==="oauth_required"){const q=Array.isArray(Oe.payload.servers)?Oe.payload.servers:[],le=String(Oe.payload.jobId??"");ue({jobId:le,servers:q}),m(pe=>{const J=`[${Ke}] OAuth required for server(s): ${q.join(", ")}. Click "Connect & Resume" to authenticate.`;return pe.includes(J)?pe:[...pe,J]});return}if(Oe.type==="started"&&(ue(null),se.current=!1,i(!0),v(!1),j(!1),m(q=>{const le=`[${Ke}] Run started.`;return q.includes(le)?q:[...q,le]}),d(q=>Math.max(q,30)),Be()),Oe.type==="log"){const q=String(Oe.payload.message??"").trim();q&&(m(le=>{const pe=`[${Ke}] ${q}`;return le.includes(pe)?le:[...le,pe]}),d(le=>{const pe=q.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(Oe.type==="completed"){const q=String(Oe.payload.runId??"").trim();ue(null),se.current=!1,m(le=>{const pe=`[${Ke}] Run completed.`;return le.includes(pe)?le:[...le,pe]}),d(100),i(!1),v(!0),j(!1),b(q),on(),N(null),ye.current?.(),ye.current=null,Be()}if(Oe.type==="error"){const q=String(Oe.payload.message??"Unknown error"),le=q.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,`[${Ke}] Error: ${q}${le}`]),i(!1),v(!1),j(!1),d(0),on(),N(null),ye.current?.(),ye.current=null,Be()}}))};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(Je,{children:a.jsxs(Ze,{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(We,{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 Oe=H0e(fe);return a.jsxs(ut,{value:fe.id,children:[a.jsx("span",{children:W0e(fe)}),Oe&&a.jsxs("span",{className:"ml-2 text-muted-foreground",children:["(",Oe,")"]})]},fe.id)})})]}),a.jsx(Z,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0",onClick:Ye,"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(We,{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(We,{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})]}),Ge&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(We,{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(Bt.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:Bt.map(fe=>{const Oe=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:Oe,onCheckedChange:Ke=>{const q=Ke===!0;k(le=>q?[...le,fe.id]:le.filter(pe=>pe!==fe.id))}}),a.jsx("span",{children:fe.name||fe.id})]},fe.id)})}),Bt.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."})]}),Ge&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(We,{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 Oe=A.includes(fe.id),Ke=Y[fe.id],q=!!U[fe.id],le=q&&Array.isArray(Ke),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=>Oe?be.filter(we=>we!==fe.id):[...be,fe.id]))},children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(wr,{checked:Oe,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})]})]}),Oe&&a.jsxs("div",{className:"pl-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(We,{className:"text-[11px] text-muted-foreground",children:'Per-scenario: "Override MCP Servers"'}),a.jsx(Og,{checked:q,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}))}}})]}),q&&a.jsx("div",{className:"mt-1 flex flex-wrap gap-1.5",children:an.map(J=>{const xe=J.id,be=(Ke??[]).includes(xe),we=pe.has(xe);return a.jsx(Qe,{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 Ae=he[fe.id]??[],He=Ae.includes(xe)?Ae.filter(ee=>ee!==xe):[...Ae,xe];return{...he,[fe.id]:He}})},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 Oe=fe.id,Ke=D.includes(Oe);return a.jsx(Qe,{variant:Ke?"default":"outline",className:`cursor-pointer text-xs ${Ke?"":"opacity-60 hover:opacity-100"}`,onClick:()=>K(q=>q.includes(Oe)?q.filter(le=>le!==Oe):[...q,Oe]),children:fe.name?.trim()?fe.name:Oe},Oe)})})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Z,{onClick:nn,disabled:!t||G||Bt.length>0&&C.length===0||Nt.length>0&&A.length===0,children:[a.jsx(Cs,{className:"mr-2 h-4 w-4"}),ht?"Queue Run":"Run"]}),o&&a.jsxs(Z,{variant:"destructive",onClick:rn,children:[a.jsx(Kd,{className:"mr-2 h-4 w-4"}),"Stop"]})]})]})}),(o||f.length>0)&&a.jsxs(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Lt,{className:"text-base",children:"Progress"}),a.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:[Math.round(c),"%"]})]})}),a.jsxs(Ze,{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(Oe=>[...Oe,`[${Gn()}] OAuth sign-in opened for '${fe}'...`])}}).then(()=>ge.resumeQueue()).then(()=>{const fe=oe?.jobId;m(Oe=>[...Oe,`[${Gn()}] OAuth complete. Resuming run...`]),fe&&(N(fe),_e(fe),i(!0),v(!1),ft(fe))}).catch(fe=>{const Oe=fe instanceof Error?fe.message:String(fe);m(Ke=>[...Ke,`[${Gn()}] OAuth error: ${Oe}`]),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,Oe)=>a.jsx("div",{className:fe.includes("✓")?"text-success":fe.includes("aborted")?"text-destructive":"text-foreground",children:fe},Oe))})]})]}),a.jsxs(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(Lt,{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:()=>{Be()},children:a.jsx(Ka,{className:"h-3 w-3"})})]})}),a.jsx(Ze,{children:!ht&&$.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),_e(fe.jobId),i(!0),v(!1),j(!1),m([`[${Gn()}] Attached to running job ${fe.jobId}...`]),d(10),ft(fe.jobId))},onKeyDown:Oe=>{Oe.key!=="Enter"&&Oe.key!==" "||S!==fe.jobId&&(Oe.preventDefault(),N(fe.jobId),_e(fe.jobId),i(!0),v(!1),j(!1),m([`[${Gn()}] Attached to running job ${fe.jobId}...`]),d(10),ft(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:Pe.get(fe.runParams.configPath)||FS(fe.runParams.scenarioIds,et,fe.runParams.configPath)}),a.jsx("span",{className:"font-mono text-xs",children:LS(fe.runParams.configPath,ke)}),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:Oe=>{Oe.stopPropagation(),ge.stopRun(fe.jobId),Be()},title:"Stop running job",children:[a.jsx(Kd,{className:"mr-1 h-3 w-3"}),"Stop"]})]},fe.jobId)),$.map(fe=>{const Oe=LS(fe.runParams.configPath,ke),Ke=FS(fe.runParams.scenarioIds,et,fe.runParams.configPath),q=Pe.get(fe.runParams.configPath)||Ke,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:q}),a.jsx("span",{className:"font-mono text-xs",children:Oe}),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,Oe)=>{const Ke=LS(fe.runParams.configPath,ke),q=FS(fe.runParams.scenarioIds,et,fe.runParams.configPath),le=Pe.get(fe.runParams.configPath)||q,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:["#",Oe+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:["#",Oe+1," Queued"]}),a.jsx("span",{className:"text-xs font-bold",children:le}),a.jsx("span",{className:"font-mono text-xs",children:Ke}),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),_e(fe.jobId),i(!0),v(!1),ft(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:()=>{Et(fe.jobId)},title:"Remove from queue",children:a.jsx(ua,{className:"h-4 w-4"})})]})]},fe.jobId)})]})})]}),x&&!o&&!p&&a.jsx(Je,{className:"border-amber-300/60 bg-amber-50/40",children:a.jsx(Ze,{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:nn,disabled:!t,children:[a.jsx(Cs,{className:"mr-2 h-4 w-4"}),"Run Again"]})]})]})})}),p&&a.jsx(Je,{className:"border-success/50",children:a.jsx(Ze,{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 bU({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(Je,{className:E,children:[a.jsx(Dt,{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(Lt,{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(GS,{className:"h-3.5 w-3.5"}):a.jsx(YS,{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(Ze,{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",U=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:U,isSystem:B,isTool:Y}):U&&!!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(UN,{call:z,loading:c,onApprove:b,onDeny:S,className:"mt-3"})]},`${O.id??`${O.role}-${D}`}-tool`):a.jsx(E8,{message:O},O.id??`${O.role}-${D}`)}),A,c&&a.jsx(P8,{}),a.jsx("div",{ref:N})]})}),a.jsx("div",{className:"border-t bg-background px-4 py-3",children:a.jsx(R8,{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 eC(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+eC(r),0):typeof e.totalDurationMs=="number"&&e.totalDurationMs>=0?e.totalDurationMs:null}function tC(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+tC(r),0):typeof e.totalToolDurationMs=="number"&&e.totalToolDurationMs>=0?e.totalToolDurationMs:null}const ED="hsl(152, 69%, 40%)",PD="hsl(0, 72%, 51%)",RD="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:ED},{name:"Failed",value:n,color:PD},...r>0?[{name:"Not evaluated",value:r,color:RD}]:[]];return a.jsxs(Je,{children:[a.jsx(Dt,{className:"p-2.5 pb-0",children:a.jsx(Lt,{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:e})}),a.jsxs(Ze,{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(tge,{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:ED}}),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:PD}}),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:RD}}),vo(r)," not evaluated"]})]})]})]})}function K0e({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(Je,{children:a.jsx(Ze,{className:"p-6 text-sm text-muted-foreground",children:"Calculating dashboard…"})}):e.length===0?a.jsx(Je,{children:a.jsx(Ze,{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:uC}),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:gC}),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 WC&&e.status===404}function wU(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)},[]),U=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 U(re,oe)}catch(oe){if(WN(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 U(ae,ye)}}catch(re){if(WN(re)||$.signal.aborted||C.current?.id!==X)return;f(oe=>oe.filter(ue=>ue.id!==F)),Ie({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,U]),z=h.useCallback(async M=>{if(i){S(!1),y(!0);try{const X=await t.approveResultAssistantToolCall(i,M);await U(i,X)}catch(X){Fd(X)&&(c(null),p([])),Ie({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,U]),I=h.useCallback(async M=>{if(i){S(!1),y(!0);try{const X=await t.denyResultAssistantToolCall(i,M);await U(i,X)}catch(X){Fd(X)&&(c(null),p([])),Ie({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,U]),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 jU(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 TD=8,nC="mcplab:results:time-filter",SU="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 G0e(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 Y0e(e){const t=hl(e);return t?t.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):"Unknown day"}function NU(e){return e==="all"||e==="last"||e==="custom"}function CU(e){return e==="15min"||e==="30min"||e==="1h"||e==="24h"||e==="7d"||e==="14d"||e==="30d"}function OD(e){const t=e.get("time_filter"),n=e.get("time_preset");return{mode:NU(t)?t:"all",preset:CU(n)?n:"15min",start:e.get("time_start")??"",end:e.get("time_end")??""}}function X0e(e){return e.has("time_filter")||e.has("time_preset")||e.has("time_start")||e.has("time_end")}function Q0e(){try{const e=localStorage.getItem(nC);if(!e)return null;const t=JSON.parse(e),n=NU(typeof t.mode=="string"?t.mode:null)?t.mode:"all",r=CU(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 J0e(){try{const e=localStorage.getItem(SU);return e===null?!0:e==="true"}catch{return!0}}const Z0e=[{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,ewe=()=>{const[e,t]=Fo(),{source:n}=Dn(),[r]=h.useState(()=>X0e(e)?OD(e):Q0e()??OD(e)),[s,o]=h.useState([]),[i,c]=h.useState([]),d=h.useRef(0),[f,m]=h.useState(!0),[p,v]=h.useState(J0e),[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),[U,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}=KL(),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(U==="all")return{};if(U==="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,U,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){Ie({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&&Ie({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(SU,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:Ge,assistantLoading:ke,assistantTurnCancelable:Pe,cancelAssistantTurn:et,assistantChatEndRef:ht,assistantInputRef:zt,setAssistantInput:Bt,askAssistant:Nt,approveResultAssistantToolCall:an,denyResultAssistantToolCall:sn,applyResultAssistantSnippet:Ut,ensureIntroMessage:nn}=wU({source:n,open:$,scope:"all_runs"}),rn=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(rn.some(xe=>xe.value===J||xe.label===J)){O(J);return}s.length>0&&O("all")}},[e,rn,s.length]),h.useEffect(()=>{const J=new URLSearchParams(e);U==="all"?(J.delete("time_filter"),J.delete("time_preset"),J.delete("time_start"),J.delete("time_end")):U==="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,U,Y,I]),h.useEffect(()=>{try{if(U==="all"){localStorage.removeItem(nC);return}const J={mode:U,preset:Y,start:I,end:V};localStorage.setItem(nC,JSON.stringify(J))}catch{}},[V,U,Y,I]);const on=h.useMemo(()=>{if(n.listRunSummariesPage)return s;const J=P==="all"?s:s.filter(Ae=>Ae.scenarios.some(He=>{const ee=String(He.scenarioName??"").trim(),Le=String(He.scenarioId??"").trim();return ee===P||Le===P}));if(U==="all")return J;const xe=Date.now();if(U==="last"){const Ae=kc.find(ee=>ee.value===Y)??kc[0],He=xe-Ae.durationMs;return J.filter(ee=>{const Le=new Date(ee.timestamp).getTime();return Le>=He&&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(Ae=>{const He=new Date(Ae.timestamp).getTime();return!(Number.isNaN(He)||W!==null&&He<W||he!==null&&He>he)})},[s,P,n.listRunSummariesPage,V,U,Y,I]);h.useEffect(()=>{ue.reset()},[ge,ve,ue.reset]);const _e=h.useMemo(()=>P==="all"?"All scenarios":rn.find(xe=>xe.value===P||xe.label===P)?.label??P,[P,rn]),Be=h.useMemo(()=>{if(U==="all")return"All time";if(U==="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,U,Y,I]),Ye=h.useMemo(()=>{const J=(be,we)=>be===null&&we===null?0:be===null?1:we===null?-1:A==="asc"?be-we:we-be;return[...on].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})},[on,C,A]),Et=h.useMemo(()=>{const J=[];let xe=null;for(const be of Ye){const we=G0e(be.timestamp);we!==xe&&(J.push({type:"day-separator",dayKey:we,dayLabel:Y0e(be.timestamp)}),xe=we),J.push({type:"run",run:be})}return J},[Ye]),ft=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(Zt,{className:"h-3.5 w-3.5"}),fe=J=>{const xe=J.toolTokenUsage?.totalTokens;return typeof xe=="number"?xe.toLocaleString():"n/a"},Oe=()=>{B("all"),z("15min"),T(""),H("")},Ke=h.useMemo(()=>{const J=new Map;for(const xe of Ye){if(xe.scenarios.length>0){J.set(xe.id,W_(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},[Ye]),q=()=>{F(!0),nn("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)),Ie({title:"Run deleted",description:J}),b(null)}catch(xe){Ie({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()){Ie({title:"Cannot rerun",description:"This run has no config path in metadata.",variant:"destructive"});return}De(J.id);try{await jU(n,J),Ie({title:"Rerun queued",description:`${J.id} queued with previous run settings.`})}catch(be){Ie({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:_e}),a.jsx(Zt,{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"}),rn.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 ${U!=="all"?"border-primary/40":""}`,children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2 truncate text-left",children:[a.jsx(v5,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:Be})]}),a.jsx(Zt,{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:U==="all"?"secondary":"ghost",className:"justify-start",onClick:()=>{Oe(),X(!1)},children:"All time"}),kc.map(J=>a.jsx(Z,{type:"button",variant:U==="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:U==="custom"?"secondary":"ghost",className:"justify-start",onClick:()=>B("custom"),children:"Custom date time range"})]}),U==="custom"&&a.jsxs("div",{className:"space-y-3 border-t p-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{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(We,{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:Oe,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:q,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(fC,{className:"h-3 w-3"}),p?"Hide dashboard":"Show dashboard"]})]}),p?a.jsx("div",{className:"mt-2",children:a.jsx(K0e,{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(Je,{children:a.jsx(Ze,{className:"p-0",children:a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Ht,{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",ft("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",ft("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",ft("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",ft("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",ft("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",ft("toolTokens")]})}),a.jsx(ct,{className:"w-10"})]})}),a.jsx(ca,{children:Et.length===0?a.jsx(Ht,{children:a.jsx(qe,{colSpan:TD,className:"px-4 py-10 text-center text-sm text-muted-foreground",children:U==="all"&&P==="all"?"No runs yet.":"No runs match current filters."})}):Et.map((J,xe)=>J.type==="day-separator"?a.jsx(Ht,{className:"bg-muted/30 hover:bg-muted/30",children:a.jsx(qe,{colSpan:TD,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(Ht,{children:[a.jsx(qe,{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(qe,{className:"text-[11px] text-muted-foreground",children:(()=>{const be=Ke.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(qe,{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(qe,{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(XL,{run:J.run})]})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:J.run.totalScenarios}),a.jsx(qe,{className:"text-right font-mono text-sm",children:J.run.avgToolCalls.toFixed(0)}),a.jsx(qe,{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(qe,{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(y5,{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(bU,{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:ke,onCancel:Pe?et:void 0,input:Ge,onInputChange:Bt,onSend:()=>{Nt()},inputPlaceholder:"Ask about historical run differences...",snippets:Z0e,onSnippetSelect:J=>{F(!0),Ut(J)},onApproveToolCall:J=>{an(J)},onDenyToolCall:J=>{sn(J)},chatEndRef:ht,inputRef:zt,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:Ae})=>{const He=W&&!!J.pendingToolCallId;if(Ae&&/^(Approved|Denied) tool call\b/i.test(String(J.text??"").trim()))return null;if(He){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(Zt,{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(pC,{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":Ae?"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 twe(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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const nwe="mcplab.resultAssistantScenarioHandoff",rwe=[{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 MD(e){const t=new Date().toISOString().replace(/[:]/g,"-").replace(/\..+/,"");return`mcplab/reports/result-assistant/${e}-${t}.md`}function ID(e){const t=e.toFixed(1);return t.endsWith(".0")?t.slice(0,-2):t}const awe=()=>{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),[U,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),[Ge,ke]=h.useState(!1),[Pe,et]=h.useState(!1),[ht,zt]=h.useState(!1),Bt=h.useRef(null),[Nt,an]=h.useState(!1),{assistantMessages:sn,assistantPendingToolCalls:Ut,assistantInput:nn,assistantLoading:rn,assistantTurnCancelable:on,cancelAssistantTurn:_e,assistantChatEndRef:Be,assistantInputRef:Ye,setAssistantInput:Et,askAssistant:ft,approveResultAssistantToolCall:fe,denyResultAssistantToolCall:Oe,applyResultAssistantSnippet:Ke,ensureIntroMessage:q,resetAssistantSession:le}=wU({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=Bt.current;if(!ne)return;const Te=()=>{an(ne.clientWidth<800)};if(Te(),typeof ResizeObserver<"u"){const vt=new ResizeObserver(()=>Te());return vt.observe(ne),()=>vt.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||U!=="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,U,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(),vt=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=>vt?pn.name===vt||pn.configName===vt:!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 vt=be?.relativePath?.trim()||be?.name?.trim();return vt||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]),Ae=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 vt=i.find(bt=>bt.id===Te.ref);vt&&(ne.set(vt.id,vt),vt.name&&ne.set(vt.name,vt),ne.has(Te.ref)||ne.set(Te.ref,vt))}}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]),He=h.useMemo(()=>"",[]);h.useEffect(()=>{if(J&&o.some(ne=>ne.id===J)){E(J);return}He&&E(ne=>ne||He)},[J,o,He]);const{filteredScenarios:ee,filteredTotalRuns:Le,filteredPassCount:ot,displayPassRate:Wt,displayAvgToolCalls:Re,displayAvgLatency:Jt,displayDurationMs:Ct,displayToolTimeMs:Yt,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),vt=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:vt,displayPassRate:Te===0?0:vt/Te,displayAvgToolCalls:Te===0?0:bt/Te,displayAvgLatency:Te===0||Nn===null?0:Math.round(Nn/Te),displayDurationMs:Nn,displayToolTimeMs:vn,displayToolTokenUsage:FQ(ne.map(fn=>fn.toolTokenUsage))}},[c,xe]),qn=h.useMemo(()=>{const ne={};return ee.forEach(Te=>Te.runs.forEach(vt=>vt.toolCalls.forEach(bt=>{ne[bt.name]=(ne[bt.name]||0)+1}))),Object.entries(ne).map(([Te,vt])=>({name:Te,count:vt})).sort((Te,vt)=>vt.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=f1(ee.flatMap(ne=>ne.runs.flatMap(Te=>Te.checkResults??[]))),Fi=ne=>{N(Te=>{const vt=new Set(Te);return vt.has(ne)?vt.delete(ne):vt.add(ne),vt})},Ln=(ne,Te,vt,bt)=>`${ne}:${Te}:${vt}:${bt}`,zi=(ne,Te)=>`${ne}::${Te}`,ls=ne=>{k(Te=>{const vt=new Set(Te);return vt.has(ne)?vt.delete(ne):vt.add(ne),vt})},Ar=ne=>{const Te=!ne.endsWith(":conversation");return C.has(ne)?!Te:Te},Ho=(ne,Te)=>{B("assistant"),O(!0),z(Te?.scenarioId??null),q("Ask me to explain failures, tool usage, or suggest what to inspect next in this result."),ne&&Et(ne)},jn=Ut.filter(ne=>ne.status==="pending"&&!sn.some(Te=>Te.pendingToolCallId===ne.id)),Vu=ne=>{B("reports"),O(!0)},Bi=()=>{B("note"),O(!0)},ie=ne=>{if(!c)return;if(!Y){Ie({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){Ie({title:"Scenario not found in library",description:`Could not find library scenario '${Y}' to open in Scenario Assistant.`,variant:"destructive"});return}const vt=[`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(nwe,JSON.stringify({type:"result-assistant-handoff-v1",runId:c.id,configId:J||c.configId||"",scenarioId:Te.id,prompt:vt,sourceReply:ne})),t(`/libraries/test-cases/${encodeURIComponent(Te.id)}?assistantHandoff=1`)}catch(bt){Ie({title:"Could not create handoff",description:bt instanceof Error?bt.message:String(bt),variant:"destructive"})}},nt=ne=>{c&&(ue(!1),H(ne),X(MD(c.id)),F(!1),T(!0))},Xt=()=>{c&&(ue(!0),H(""),X(MD(c.id)),F(!1),T(!0))},Pt=async()=>{if(!c)return;if(!V.trim()){Ie({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:$});Ie({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){Ie({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),Ie({title:"Copied"})}catch(Te){Ie({title:"Could not copy",description:Te instanceof Error?Te.message:String(Te),variant:"destructive"})}},tn=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),Ie({title:"Run note saved"})}catch(ne){Ie({title:"Could not save run note",description:ne instanceof Error?ne.message:String(ne),variant:"destructive"})}finally{b(!1)}}},sr=async()=>{if(c?.id){et(!0);try{await r.deleteResult(c.id),Ie({title:"Run deleted",description:c.id}),t("/results")}catch(ne){Ie({title:"Could not delete run",description:ne instanceof Error?ne.message:String(ne),variant:"destructive"})}finally{et(!1),ke(!1)}}},Sn=async()=>{if(!c?.id)return;if(!he.trim()){Ie({title:"Cannot rerun",description:"This run has no config path in metadata.",variant:"destructive"});return}zt(!0);try{await jU(r,c),Ie({title:"Rerun queued",description:`${c.id} queued with previous run settings.`})}catch(Te){Ie({title:"Could not rerun",description:Te instanceof Error?Te.message:String(Te),variant:"destructive"})}finally{zt(!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:Bt,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:Wt})]}),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(tP,{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=twe(c),Te=new Blob([ne],{type:"text/html"}),vt=URL.createObjectURL(Te),bt=document.createElement("a");bt.href=vt,bt.download=`mcplab-report-${c.id}.html`,bt.click(),URL.revokeObjectURL(vt)},"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:ht||!he.trim(),children:[a.jsx(Cs,{className:"h-3.5 w-3.5"}),ht?"Queueing...":"Rerun"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5 text-destructive",onClick:()=>ke(!0),disabled:Pe,"aria-label":Pe?"Deleting run":"Delete run",children:[Pe?a.jsx(_r,{className:"h-4 w-4 animate-spin"}):a.jsx(cl,{className:"h-4 w-4"}),Nt?null:Pe?"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:uC}),a.jsx(nr,{title:"Pass Rate",value:`${Math.round(Wt*100)}%`,icon:jl}),a.jsx(nr,{title:"Avg Tool Calls",value:ID(Re),icon:Wa}),a.jsx(nr,{title:"Avg Latency",value:`${Jt}ms`,icon:gC}),Ct!==null?a.jsx(nr,{title:"Total Time",value:sa(Ct),icon:Ea}):null,Yt!==null?a.jsx(nr,{title:"Tool Duration",value:sa(Yt),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(Je,{className:"lg:col-span-2",children:[a.jsx(Dt,{className:"p-2.5 pb-0",children:a.jsx(Lt,{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Tool Usage"})}),a.jsx(Ze,{children:a.jsx(mf,{width:"100%",height:120,children:a.jsxs(ege,{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(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(Lt,{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(Ze,{className:"p-0",children:a.jsxs(ia,{children:[a.jsx(la,{children:a.jsxs(Ht,{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),vt=ne.scenarioName||ne.scenarioId,bt=f1(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(Ht,{className:"cursor-pointer hover:bg-muted/50",children:[a.jsx(qe,{children:a.jsx(Zt,{className:`h-4 w-4 transition-transform ${S.has(Te)?"rotate-180":""}`})}),a.jsx(qe,{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(qe,{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(qe,{className:"font-mono text-sm",children:ne.runs.length}),a.jsx(qe,{children:a.jsx(zs,{rate:ne.passRate})}),a.jsx(qe,{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(qe,{className:"font-mono text-sm",children:sa(eC(ne),{preciseUnderTenSeconds:!0})}),a.jsx(qe,{className:"font-mono text-sm",children:ID(ne.avgToolCalls)}),a.jsx(qe,{className:"font-mono text-sm",children:na(ne.toolTokenUsage?.totalTokens)}),a.jsx(qe,{className:"font-mono text-sm",children:sa(tC(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:[vt," · ",ne.agentName," ·"," ",Math.round(ne.passRate*100),"% pass rate ·"," ",Nn?`Checks ${bt.passed} ✓ · ${bt.failed} ✕ · `:"",na(ne.toolTokenUsage?.totalTokens)," tool tokens ·"," ",sa(eC(ne),{preciseUnderTenSeconds:!0})," ","total time ·"," ",sa(tC(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(dC,{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 '${vt}' 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=Ae.get(ne.scenarioId),Vn=Qn?iwe(Qn.evalRules,wt.failureReasons,wt.error,wt.checkResults):[],mr=Vn.filter(Mt=>Mt.status==="failed"),Vo=Vn.filter(Mt=>Mt.status==="passed"),ro=Vn.filter(Mt=>Mt.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(Qe,{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((Mt,Ql)=>a.jsxs("li",{children:["• ",FD(Mt)]},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(Zt,{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(Qe,{variant:"outline",className:"h-5 border-success/30 bg-success/10 text-success text-[10px]",children:[Vo.length," passed"]}),a.jsxs(Qe,{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(Qe,{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((Mt,Ql)=>a.jsxs("div",{className:`flex items-start justify-between gap-2 rounded-md border px-2 py-1.5 text-xs ${Mt.status==="failed"?"border-destructive/20 bg-destructive/5":Mt.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:[Mt.status==="failed"?a.jsx(cl,{className:"h-3.5 w-3.5 shrink-0 text-destructive"}):Mt.status==="not_evaluated"?a.jsx(tP,{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(Mt.rule)})]}),Mt.failureReason&&a.jsx("p",{className:"mt-1 pl-5 text-[11px] text-muted-foreground",children:FD(Mt.failureReason)})]}),a.jsx(Qe,{variant:"outline",className:`shrink-0 text-[10px] ${Mt.status==="failed"?"border-destructive/30 text-destructive":Mt.status==="not_evaluated"?"border-muted-foreground/30 text-muted-foreground":"border-success/30 text-success"}`,children:Mt.status})]},`${Mt.rule.type}-${Mt.rule.value??Mt.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(Zt,{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(Qe,{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(Zt,{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(Qe,{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(Qe,{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(Qe,{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(Zt,{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(rC,{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(Zt,{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 '${vt}'. 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(swe,{item:Qn,fallbackUserPrompt:Ae.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:U,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"})]})}),U==="assistant"?a.jsx(bU,{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:sn,pendingToolCalls:Ut,loading:rn,onCancel:on?_e:void 0,input:nn,onInputChange:Et,onSend:()=>{ft()},inputPlaceholder:"Ask about this result...",snippets:rwe,onSnippetSelect:Ke,onApproveToolCall:ne=>{fe(ne)},onDenyToolCall:ne=>{Oe(ne)},chatEndRef:Be,inputRef:Ye,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:vt,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=vt?.tool??ne.toolRequestName,wt=vt?.publicToolName??ne.toolRequestPublicName,Qn=Nn&&!pn&&owe(ne.text,!!Y);if(pn){const mr=vt?.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:!!vt,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(Zt,{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&&vt&&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(vt.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:rn,onClick:()=>{Oe(vt.id)},children:"Deny"}),a.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:rn,onClick:()=>{fe(vt.id)},children:"Approve"})]})]})]})]})]},`${ne.id??`${ne.role}-${Te}`}:${vt?"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(pC,{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(Zt,{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:rn,onClick:()=>{Oe(ne.id)},children:"Deny"}),a.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:rn,onClick:()=>{fe(ne.id)},children:"Approve"})]})]})]},ne.id))]}):null}):U==="reports"?a.jsxs(Je,{className:"min-w-0 overflow-hidden rounded-t-none xl:flex xl:h-full xl:min-h-0 xl:flex-col",children:[a.jsx(Dt,{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(Lt,{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(GS,{className:"h-3.5 w-3.5"}):a.jsx(YS,{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(Ze,{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:()=>Xt(),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(uk,{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(Je,{className:"min-w-0 overflow-hidden rounded-t-none xl:flex xl:h-full xl:min-h-0 xl:flex-col",children:[a.jsx(Dt,{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(Lt,{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(GS,{className:"h-3.5 w-3.5"}):a.jsx(YS,{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(Ze,{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:()=>{tn()},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(),Pt()},disabled:G,children:G?"Writing...":oe?"Save Report":"Approve & Write"})]})]})}),a.jsx(Ps,{open:Ge,onOpenChange:ke,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:Pe,children:"Cancel"}),a.jsx(ns,{disabled:Pe||!c?.id,onClick:ne=>{ne.preventDefault(),sr()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Pe?"Deleting...":"Delete"})]})]})})]})]})};function swe({item:e,fallbackUserPrompt:t}){if(e.kind==="tool_call"){const d=$D(e,"input");return a.jsx(LD,{variant:"call",title:`Tool call · ${e.toolName||"unknown"}${d}`,text:e.text})}if(e.kind==="tool_result"){const d=$D(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(LD,{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=DD(e.text,e.kind),s=t?DD(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(rC,{text:o,maxLength:280,className:"text-xs"}):a.jsx(rC,{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 $D(e,t){const n=t==="input"?e.estimatedTokens?.inputTokens:e.estimatedTokens?.outputTokens;return typeof n!="number"?"":` · ${na(n)} tokens`}function DD(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 owe(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 LD({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 rC({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 iwe(e,t,n,r){return Q8({evalRules:e,failureReasons:t,runError:n,checkResults:r})}function FD(e){const t=String(e??"").trim(),n=t.match(/^Regex assertion failed:\s*(.+)$/i);return n?`Text match failed: ${n[1]}`:t}const BS=["hsl(38, 92%, 50%)","hsl(200, 80%, 50%)","hsl(152, 69%, 40%)","hsl(280, 60%, 50%)","hsl(0, 72%, 51%)"],lwe=9,zD="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 cwe(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 uwe(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 dwe(e){const t=ml(e);return t?t.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):"Unknown day"}function _U({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 fwe(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(_U,{counts:t}),a.jsx("span",{className:"text-muted-foreground",children:" · "}),a.jsxs("span",{children:[Math.round(t.passed/n*100),"%"]})]})}function pwe(e){return e==="all"||e==="last"||e==="custom"}function hwe(e){return e==="15min"||e==="30min"||e==="1h"||e==="24h"||e==="7d"||e==="14d"||e==="30d"}function mwe(e){const t=e.get("time_filter"),n=e.get("time_preset");return{mode:pwe(t)?t:"all",preset:hwe(n)?n:"15min",start:e.get("time_start")??"",end:e.get("time_end")??""}}function gwe(e,t){return e.length!==t.length?!1:e.every((n,r)=>n===t[r])}function vwe(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 xwe=()=>{const{source:e}=Dn(),[t,n]=Fo(),r=mwe(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(zD)==="1"}catch{return!1}}),[P,O]=h.useState(r.mode),[D,K]=h.useState(r.preset),[U,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(q=>q.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 q=ml(U)?.toISOString(),le=ml(Y)?.toISOString();return{since:q,until:le}},[Y,P,D,U]),at=async()=>{const q=ve.current+1;ve.current=q,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!==q)return;H.updateMeta(pe),i(pe.data.map(vi))}else{const le=await e.listResults();if(ve.current!==q)return;i(le)}}catch(le){Ie({title:"Could not load results",description:le instanceof Error?le.message:String(le),variant:"destructive"})}finally{ve.current===q&&m(!1)}};h.useEffect(()=>{let q=!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=>(q&&H.updateMeta(pe),pe.data.map(vi))):e.listResults()).then(pe=>{q&&i(pe)}).catch(pe=>{q&&Ie({title:"Could not load results",description:pe instanceof Error?pe.message:String(pe),variant:"destructive"})}).finally(()=>{q&&m(!1)}),()=>{q=!1}},[M,S,e,Se]);const tt=q=>{if(x===q){b(le=>le==="asc"?"desc":"asc");return}j(q),b(q==="timestamp"?"desc":"asc")},it=q=>{v(le=>{const pe=new Set(le);return pe.has(q)?pe.delete(q):pe.add(q),pe})},kt=h.useMemo(()=>{const q=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&&q.add(be)})}),Array.from(q).sort((le,pe)=>le.localeCompare(pe))},[o]),Ge=h.useMemo(()=>{const q=S==="all"?o:o.filter(we=>we.scenarios.some(W=>{const he=String(W.scenarioName??"").trim(),Ae=String(W.scenarioId??"").trim();return(he||Ae)===S}));if(s!=="runs"||P==="all")return q;const le=Date.now();if(P==="last"){const we=Ac.find(he=>he.value===D)??Ac[0],W=le-we.durationMs;return q.filter(he=>{const Ae=new Date(he.timestamp).getTime();return Ae>=W&&Ae<=le})}const pe=ml(U)?.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 q.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,U]),ke=h.useMemo(()=>[...Ge].sort((q,le)=>{let pe=0;return x==="id"&&(pe=q.id.localeCompare(le.id)),x==="timestamp"&&(pe=new Date(q.timestamp).getTime()-new Date(le.timestamp).getTime()),x==="passRate"&&(pe=q.overallPassRate-le.overallPassRate),x==="scenarios"&&(pe=q.totalScenarios-le.totalScenarios),y==="asc"?pe:-pe}),[Ge,x,y]),Pe=h.useMemo(()=>ke.filter(q=>p.has(q.id)).map(q=>c[q.id]??q),[c,ke,p]),et=h.useMemo(()=>{if(!A)return ke.map(pe=>({type:"run",run:pe}));const q=[];let le=null;for(const pe of ke){const J=cwe(pe.timestamp);J!==le&&(q.push({type:"day-separator",dayKey:J,dayLabel:dwe(pe.timestamp)}),le=J),q.push({type:"run",run:pe})}return q},[A,ke]);h.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(zD,A?"1":"0")}catch{}},[A]);const ht=q=>x!==q?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(Zt,{className:"h-3.5 w-3.5"}),zt=h.useMemo(()=>{const q=new Map;for(const le of ke)q.set(le.id,W_(le));return q},[ke]),Bt=q=>{const le=Array.from(new Set(q.scenarios.map(pe=>pe.agentId).filter(Boolean)));return le.slice(0,Math.min(2,le.length))},Nt=q=>{const le=Bt(q);ue(q.id),ye(le),de("all");const pe=new URLSearchParams(t);pe.set("mode","within-run"),pe.set("runId",q.id),le.length>0?pe.set("agents",le.join(",")):pe.delete("agents"),pe.delete("scenario"),n(pe,{replace:!0})},an=h.useMemo(()=>[...new Set(Pe.flatMap(q=>q.scenarios.map(le=>le.scenarioId)))],[Pe]),sn=h.useMemo(()=>{const q=new Map;for(const le of Pe)for(const pe of le.scenarios){const J=String(pe.scenarioId??"").trim();if(!J)continue;const xe=String(pe.scenarioName??"").trim();q.set(J,xe||J)}return q},[Pe]),Ut=h.useMemo(()=>c[oe]??o.find(q=>q.id===oe),[c,o,oe]);h.useEffect(()=>{if(typeof e.getResult!="function"||p.size===0&&!oe)return;const q=new Set([...p]);oe&&q.add(oe);for(const le of q)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,U,Y]);const nn=h.useMemo(()=>{if(!Ut)return[];const q=new Map;for(const le of Ut.scenarios)q.set(le.agentId,le.agentName||le.agentId);return Array.from(q.entries()).map(([le,pe])=>({id:le,name:pe})).sort((le,pe)=>le.name.localeCompare(pe.name))},[Ut]),rn=h.useMemo(()=>{if(!Ut)return[];const q=new Set;for(const le of Ut.scenarios){const pe=String(le.scenarioName??"").trim(),J=String(le.scenarioId??"").trim(),xe=pe||J;xe&&q.add(xe)}return Array.from(q).sort((le,pe)=>le.localeCompare(pe))},[Ut]),on=h.useMemo(()=>ae.join(","),[ae]);h.useEffect(()=>{if(s==="within-run"){const q=t.get("runId")??"",le=(t.get("agents")??"").split(",").map(J=>J.trim()).filter(Boolean),pe=t.get("scenario")??"all";ue(J=>J===q?J:q),ye(J=>gwe(J,le)?J:le),de(J=>J===pe?J:pe)}},[s,t]),h.useEffect(()=>{if(s!=="within-run"||o.length===0)return;let q=oe;(!q||!o.some(W=>W.id===q))&&(q=o[0].id);const le=o.find(W=>W.id===q),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=on.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 Ae=String(he.scenarioName??"").trim(),He=String(he.scenarioId??"").trim(),ee=Ae||He;ee&&W.add(ee)}return new Set(W)})(),we=se!=="all"&&!be.has(se)?"all":se;q!==oe&&ue(q),xe.join(",")!==on&&ye(xe),we!==se&&de(we)},[s,o,oe,on,se]),h.useEffect(()=>{const q=new URLSearchParams(t);s==="within-run"?(q.set("mode","within-run"),oe?q.set("runId",oe):q.delete("runId"),ae.length>0?q.set("agents",ae.join(",")):q.delete("agents"),se!=="all"?q.set("scenario",se):q.delete("scenario"),q.delete("time_filter"),q.delete("time_preset"),q.delete("time_start"),q.delete("time_end")):(q.delete("mode"),q.delete("runId"),q.delete("agents"),q.delete("scenario"),P==="all"?(q.delete("time_filter"),q.delete("time_preset"),q.delete("time_start"),q.delete("time_end")):P==="last"?(q.set("time_filter","last"),q.set("time_preset",D),q.delete("time_start"),q.delete("time_end")):(q.set("time_filter","custom"),q.delete("time_preset"),U.trim()?q.set("time_start",U.trim()):q.delete("time_start"),Y.trim()?q.set("time_end",Y.trim()):q.delete("time_end")));const le=t.toString(),pe=q.toString();le!==pe&&n(q,{replace:!0})},[s,Y,P,D,U,oe,ae,se,t,n]);const _e=h.useMemo(()=>{if(P==="all")return"All time";if(P==="last")return Ac.find(pe=>pe.value===D)?.label??"Last range";const q=!!U.trim(),le=!!Y.trim();return!q&&!le?"Custom range":q&&le?`${nm(U)} - ${nm(Y)}`:q?`From ${nm(U)}`:`Until ${nm(Y)}`},[Y,P,D,U]),Be=()=>{O("all"),K("15min"),B(""),z("")},Ye=h.useMemo(()=>{if(!Ut)return[];const q=new Map;for(const pe of Ut.scenarios){const J=String(pe.scenarioId??"").trim(),xe=String(pe.scenarioName??"").trim(),be=xe||J;if(!J&&!be)continue;const we=J||be,W=q.get(we);if(W){W.byAgent[pe.agentId]=pe;continue}q.set(we,{scenarioId:J||be,scenarioName:xe,displayLabel:be||J,byAgent:{[pe.agentId]:pe}})}const le=Array.from(q.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)},[Ut,se]),Et=h.useMemo(()=>{const q=new Map(nn.map(le=>[le.id,le]));return ae.map(le=>q.get(le)).filter(le=>!!le)},[ae,nn]),ft=h.useMemo(()=>{if(!Ut||Et.length!==2)return null;const[q,le]=Et;return{left:q,right:le,link:`/compare/results?left=${encodeURIComponent(Ut.id)}&right=${encodeURIComponent(Ut.id)}&leftConfig=${encodeURIComponent(Ut.configId)}&rightConfig=${encodeURIComponent(Ut.configId)}&leftAgent=${encodeURIComponent(q.id)}&rightAgent=${encodeURIComponent(le.id)}`}},[Ut,Et]),fe=h.useMemo(()=>!Ut||Et.length===0?[]:Et.map(q=>{const le=Ye.map(Ae=>Ae.byAgent[q.id]).filter(Ae=>!!Ae),pe=le.flatMap(Ae=>Ae.runs),J=pe.length,xe=pe.filter(Ae=>Ae.passed).length,be=pe.reduce((Ae,He)=>Ae+He.toolCalls.length,0),we=pe.reduce((Ae,He)=>Ae+He.duration,0),{provider:W,model:he}=vwe(le);return{agentId:q.id,agentName:q.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}}),[Ut,Et,Ye]),Oe=q=>{ye(le=>le.includes(q)?le.filter(pe=>pe!==q):[...le,q])},Ke=q=>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:["#",q.runIndex+1]})," ",a.jsx("span",{className:q.passed?"text-emerald-700":"text-destructive",children:q.passed?"PASS":"FAIL"})," ","· tools: ",q.toolCalls.length," · ",q.duration,"ms"]}),!q.passed&&q.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:q.failureReasons.join("; ")})]},q.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(w5,{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 q=new URLSearchParams(t);q.delete("mode"),q.delete("runId"),q.delete("agents"),q.delete("scenario"),n(q,{replace:!0})},children:[a.jsx(g5,{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(Zt,{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(q=>a.jsx(Na,{value:q,onSelect:()=>{N(q),k(!1)},children:q},q))]})]})]})})]}),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(v5,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:_e})]}),a.jsx(Zt,{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:()=>{Be(),T(!1)},children:"All time"}),Ac.map(q=>a.jsx(Z,{type:"button",variant:P==="last"&&D===q.value?"secondary":"ghost",className:"justify-start",onClick:()=>{O("last"),K(q.value),T(!1)},children:q.label},q.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(We,{htmlFor:"compare-time-filter-start",children:"Start"}),a.jsx(_t,{id:"compare-time-filter-start",type:"datetime-local",value:U,onChange:q=>B(q.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{htmlFor:"compare-time-filter-end",children:"End"}),a.jsx(_t,{id:"compare-time-filter-end",type:"datetime-local",value:Y,onChange:q=>z(q.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:Be,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(We,{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(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsx(Lt,{className:"text-base",children:"Within One Run Controls"})}),a.jsxs(Ze,{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(q=>a.jsx(ut,{value:q.id,children:q.id},q.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(Zt,{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"}),rn.map(q=>a.jsx(Na,{value:q,onSelect:()=>{de(q),ge(!1)},children:q},q))]})]})]})})]})]})]}),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:[nn.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No agents available for selected run."}),nn.map(q=>a.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[a.jsx(wr,{checked:ae.includes(q.id),onCheckedChange:()=>Oe(q.id)}),a.jsx("span",{children:q.name})]},q.id))]})]})]})]}),s==="runs"&&a.jsx(Je,{children:a.jsx(Ze,{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(Ht,{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",ht("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",ht("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",ht("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",ht("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:et.map((q,le)=>q.type==="day-separator"?a.jsx(Ht,{className:"bg-muted/30 hover:bg-muted/30",children:a.jsx(qe,{colSpan:lwe,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:q.dayLabel}),a.jsx("div",{className:"h-px flex-1 bg-border/70"})]})})},`day-${q.dayKey}-${le}`):a.jsxs(Ht,{children:[a.jsx(qe,{children:a.jsx(wr,{checked:p.has(q.run.id),onCheckedChange:()=>it(q.run.id),disabled:!p.has(q.run.id)&&p.size>=5})}),a.jsx(qe,{className:"font-mono text-xs",children:q.run.id}),a.jsx(qe,{className:"text-[11px] text-muted-foreground",children:(()=>{const pe=zt.get(q.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(qe,{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(q.run.timestamp).toLocaleString()]}),(()=>{const pe=Mg(q.run);return pe===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Total time: ",sa(pe)]})})()]})}),a.jsx(qe,{className:"text-right",children:a.jsx(zs,{rate:q.run.overallPassRate})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:q.run.totalScenarios}),a.jsx(qe,{className:"text-right",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("div",{className:"font-mono text-sm",children:na(q.run.toolTokenUsage?.totalTokens)}),(()=>{const pe=Ig(q.run);return pe===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Tool time: ",sa(pe)]})})()]})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:zt.get(q.run.id)?.agentCount??0}),a.jsx(qe,{className:"text-right",children:(zt.get(q.run.id)?.agentCount??0)>1?a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>Nt(q.run),children:"Compare agents"}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})})]},q.run.id))})]})})}),s==="runs"&&Pe.length<2&&a.jsx(Je,{children:a.jsxs(Ze,{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"&&Pe.length>=2&&a.jsxs(a.Fragment,{children:[Pe.length===2&&a.jsx(Je,{children:a.jsx(Ze,{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(Pe[0].id)}&right=${encodeURIComponent(Pe[1].id)}&leftConfig=${encodeURIComponent(Pe[0].configId)}&rightConfig=${encodeURIComponent(Pe[1].configId)}`,children:"Compare full results"})})]})})}),a.jsxs(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsx(Lt,{className:"text-base",children:"Summary Comparison"})}),a.jsx(Ze,{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(Ht,{children:[a.jsx(ct,{className:"w-[220px]",children:"Metric"}),Pe.map((q,le)=>a.jsxs(ct,{style:{color:BS[le]},className:"font-mono text-xs",children:[a.jsx("div",{children:q.id}),q.configPath?.trim()?a.jsx("div",{className:"mt-0.5 font-mono text-[10px] font-normal text-muted-foreground",children:q.configPath.trim()}):null]},q.id))]})}),a.jsxs(ca,{children:[a.jsxs(Ht,{children:[a.jsx(qe,{className:"font-medium",children:"Pass Rate"}),Pe.map(q=>a.jsx(qe,{children:a.jsx(zs,{rate:q.overallPassRate})},q.id))]}),a.jsxs(Ht,{children:[a.jsx(qe,{className:"font-medium",children:"Checks Pass Rate"}),Pe.map(q=>a.jsx(qe,{className:"font-mono",children:fwe(q)},q.id))]}),a.jsxs(Ht,{children:[a.jsx(qe,{className:"font-medium",children:"Total Runs"}),Pe.map(q=>a.jsx(qe,{className:"font-mono",children:q.totalRuns},q.id))]}),a.jsxs(Ht,{children:[a.jsx(qe,{className:"font-medium",children:"Tool Calls"}),Pe.map(q=>a.jsx(qe,{className:"font-mono",children:q.avgToolCalls.toFixed(1)},q.id))]}),a.jsxs(Ht,{children:[a.jsx(qe,{className:"font-medium",children:"Avg Latency"}),Pe.map(q=>a.jsxs(qe,{className:"font-mono",children:[q.avgLatency,"ms"]},q.id))]}),a.jsxs(Ht,{children:[a.jsx(qe,{className:"font-medium",children:"Total Time"}),Pe.map(q=>a.jsx(qe,{className:"font-mono",children:(()=>{const le=Mg(q);return le===null?"—":sa(le)})()},q.id))]}),a.jsxs(Ht,{children:[a.jsx(qe,{className:"font-medium",children:"Tool Time"}),Pe.map(q=>a.jsx(qe,{className:"font-mono",children:(()=>{const le=Ig(q);return le===null?"—":sa(le)})()},q.id))]})]})]})})]}),a.jsxs(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsx(Lt,{className:"text-base",children:"Scenario Breakdown"})}),a.jsx(Ze,{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(Ht,{children:[a.jsx(ct,{className:"w-[220px]",children:"Scenario"}),Pe.map((q,le)=>a.jsxs(ct,{style:{color:BS[le]},className:"font-mono text-xs",children:[a.jsx("div",{children:q.id}),q.configPath?.trim()?a.jsx("div",{className:"mt-0.5 font-mono text-[10px] font-normal text-muted-foreground",children:q.configPath.trim()}):null,a.jsxs("div",{className:"mt-0.5 text-[10px] font-normal text-muted-foreground",children:["MCP: ",uwe(q.mcpServerVersions)]})]},q.id))]})}),a.jsx(ca,{children:an.map(q=>a.jsxs(Ht,{children:[a.jsx(qe,{className:"font-medium text-sm",children:sn.get(q)??q}),Pe.map(le=>{const pe=le.scenarios.find(J=>J.scenarioId===q);return a.jsx(qe,{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(_U,{counts:pe.checkCounts})}):null]}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})},le.id)})]},q))})]})})]})]}),s==="runs"&&Pe.length>=2&&a.jsxs(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsx(Lt,{className:"text-base",children:"Pass Rate Trend"})}),a.jsx(Ze,{className:"h-72",children:a.jsx(mf,{width:"100%",height:"100%",children:a.jsxs(MN,{data:Pe.map((q,le)=>({idx:le+1,runId:q.id,passRate:Number((q.overallPassRate*100).toFixed(1))})),children:[a.jsx(_i,{dataKey:"idx",tickFormatter:q=>String(q)}),a.jsx(ki,{unit:"%",domain:[0,100]}),a.jsx(aa,{formatter:q=>[`${q}%`,"Pass Rate"],labelFormatter:q=>`Run ${q}`}),a.jsx(gl,{}),a.jsx(Pl,{type:"monotone",dataKey:"passRate",stroke:BS[0],strokeWidth:2.5,dot:!0})]})})})]}),s==="within-run"&&Ut&&Et.length<2&&a.jsx(Je,{children:a.jsx(Ze,{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"&&Ut&&Et.length>=2&&a.jsxs(a.Fragment,{children:[a.jsx(Je,{children:a.jsx(Ze,{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:ft?"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:ft?a.jsx(At,{to:ft.link,children:"Compare full results"}):a.jsx(At,{to:`/results/${encodeURIComponent(Ut.id)}${Ut.configId?`?configId=${encodeURIComponent(Ut.configId)}`:""}`,children:"Open full result"})})]})})}),a.jsxs(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsx(Lt,{className:"text-base",children:"Agent Summary"})}),a.jsx(Ze,{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(Ht,{children:[a.jsx(ct,{children:"Metric"}),fe.map(q=>a.jsxs(ct,{children:[a.jsx("div",{className:"font-medium text-sm",children:q.agentName}),(q.provider||q.model)&&a.jsx("div",{className:"font-mono text-xs font-normal text-muted-foreground",children:[q.provider?kg(q.provider):null,q.model].filter(Boolean).join(" · ")})]},q.agentId))]})}),a.jsxs(ca,{children:[a.jsxs(Ht,{children:[a.jsx(qe,{className:"font-medium",children:"Pass Rate"}),fe.map(q=>a.jsx(qe,{children:a.jsx(zs,{rate:q.passRate})},q.agentId))]}),a.jsxs(Ht,{children:[a.jsx(qe,{className:"font-medium",children:"Total Runs"}),fe.map(q=>a.jsx(qe,{className:"font-mono",children:q.totalRuns},q.agentId))]}),a.jsxs(Ht,{children:[a.jsx(qe,{className:"font-medium",children:"Avg Tool Calls"}),fe.map(q=>a.jsx(qe,{className:"font-mono",children:q.avgToolCalls.toFixed(1)},q.agentId))]}),a.jsxs(Ht,{children:[a.jsx(qe,{className:"font-medium",children:"Avg Latency"}),fe.map(q=>a.jsxs(qe,{className:"font-mono",children:[Math.round(q.avgLatency),"ms"]},q.agentId))]})]})]})})]}),a.jsxs(Je,{children:[a.jsx(Dt,{className:"pb-3",children:a.jsx(Lt,{className:"text-base",children:"Scenario × Agent Matrix"})}),a.jsx(Ze,{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(Ht,{children:[a.jsx(ct,{className:"w-[260px]",children:"Scenario"}),Et.map(q=>{const le=fe.find(pe=>pe.agentId===q.id);return a.jsxs(ct,{children:[a.jsx("div",{className:"font-medium text-sm",children:q.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(" · ")})]},q.id)})]})}),a.jsx(ca,{children:Ye.map(q=>a.jsxs(Ht,{children:[a.jsx(qe,{className:"font-medium text-sm",children:q.displayLabel}),Et.map(le=>{const pe=q.byAgent[le.id];return pe?a.jsx(qe,{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=>Ke(J))}):a.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs captured."})]})},le.id):a.jsx(qe,{children:a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})},le.id)})]},q.scenarioId))})]})})]})]})]})},BD=(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()}`},qD=(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}`:""}`},ywe=()=>{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(Je,{children:[a.jsx(Dt,{children:a.jsx(Lt,{className:"text-base",children:"Full Result Compare"})}),a.jsxs(Ze,{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(g5,{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:qD(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:qD(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(Je,{className:"overflow-hidden",children:[a.jsx(Dt,{className:"py-3",children:a.jsx(Lt,{className:"text-sm font-mono",children:d})}),a.jsx(Ze,{className:"p-0",children:a.jsx("iframe",{title:`Result ${d}`,src:BD(n,s,i),className:"h-[calc(100vh-12rem)] w-full border-0"})})]}),a.jsxs(Je,{className:"overflow-hidden",children:[a.jsx(Dt,{className:"py-3",children:a.jsx(Lt,{className:"text-sm font-mono",children:f})}),a.jsx(Ze,{className:"p-0",children:a.jsx("iframe",{title:`Result ${f}`,src:BD(r,o,c),className:"h-[calc(100vh-12rem)] w-full border-0"})})]})]})]})};function bwe(e){return e.match(/(?:^|\/)(?:result-assistant|results?)\/([0-9]{8}-[0-9]{6})(?:-|\/)/i)?.[1]??null}function wwe(){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){Ie({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)),Ie({title:"Markdown report deleted"}),i(null)}catch(S){Ie({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(Je,{children:a.jsx(Ze,{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(Ht,{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(Ht,{children:[a.jsx(qe,{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(qe,{className:"text-xs text-muted-foreground font-mono",children:(()=>{const N=bwe(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(qe,{className:"text-xs text-muted-foreground font-mono",children:S.relativePath.includes("/")?S.relativePath.slice(0,S.relativePath.lastIndexOf("/")):"."}),a.jsx(qe,{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(qe,{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 jwe(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Swe(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 Nwe(){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}Ie({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=Swe(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:jwe(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(Je,{children:a.jsx(Ze,{className:"pt-6",children:a.jsx(Va,{text:s.content,variant:"assistant"})})}),v?a.jsx(gL,{open:m,onOpenChange:p,children:a.jsxs(qC,{side:"right",className:"w-[96vw] max-w-none p-0 sm:max-w-5xl",children:[a.jsx(xL,{className:"border-b px-4 py-3 pr-12",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(yL,{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 Cwe=()=>{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"})]})})},_we=new dG;function kwe(){const{scenarioId:e}=ql();return a.jsx($3,{to:e?`/libraries/test-cases/${encodeURIComponent(e)}`:"/libraries/test-cases",replace:!0})}function Awe(){return a.jsxs(hY,{children:[a.jsxs(yn,{element:a.jsx(jJ,{}),children:[a.jsx(yn,{path:"/",element:a.jsx(nge,{})}),a.jsx(yn,{path:"/mcp-evaluations",element:a.jsx(jxe,{})}),a.jsx(yn,{path:"/mcp-evaluations/:id",element:a.jsx(uD,{})}),a.jsx(yn,{path:"/mcp-evaluations/:id/:tab",element:a.jsx(uD,{})}),a.jsx(yn,{path:"/tool-analysis",element:a.jsx(k0e,{})}),a.jsx(yn,{path:"/tool-analysis-results",element:a.jsx(A0e,{})}),a.jsx(yn,{path:"/tool-analysis-results/:id",element:a.jsx(E0e,{})}),a.jsx(yn,{path:"/oauth-debugger",element:a.jsx(I0e,{})}),a.jsx(yn,{path:"/libraries/servers",element:a.jsx(Bye,{})}),a.jsx(yn,{path:"/libraries/servers/:serverId",element:a.jsx(qye,{})}),a.jsx(yn,{path:"/libraries/agents",element:a.jsx(Uye,{})}),a.jsx(yn,{path:"/libraries/agents/:agentName",element:a.jsx(Jbe,{})}),a.jsx(yn,{path:"/libraries/test-cases",element:a.jsx(bD,{})}),a.jsx(yn,{path:"/libraries/test-cases/:testCaseId",element:a.jsx(bD,{})}),a.jsx(yn,{path:"/libraries/scenarios",element:a.jsx($3,{to:"/libraries/test-cases",replace:!0})}),a.jsx(yn,{path:"/libraries/scenarios/:scenarioId",element:a.jsx(kwe,{})}),a.jsx(yn,{path:"/settings",element:a.jsx(Zbe,{})}),a.jsx(yn,{path:"/settings/mcp",element:a.jsx(o0e,{})}),a.jsx(yn,{path:"/run",element:a.jsx(V0e,{})}),a.jsx(yn,{path:"/results",element:a.jsx(ewe,{})}),a.jsx(yn,{path:"/results/:id",element:a.jsx(awe,{})}),a.jsx(yn,{path:"/markdown-reports",element:a.jsx(wwe,{})}),a.jsx(yn,{path:"/markdown-reports/view",element:a.jsx(Nwe,{})}),a.jsx(yn,{path:"/compare",element:a.jsx(xwe,{})}),a.jsx(yn,{path:"/compare/results",element:a.jsx(ywe,{})})]}),a.jsx(yn,{path:"*",element:a.jsx(Cwe,{})})]})}const Ewe=()=>a.jsx(pG,{client:_we,children:a.jsx(Ro,{children:a.jsx(vJ,{children:a.jsx(NJ,{children:a.jsxs(SJ,{children:[a.jsx(mH,{}),a.jsx(KH,{}),a.jsx(FY,{children:a.jsx(Awe,{})})]})})})})});p9.createRoot(document.getElementById("root")).render(a.jsx(Ewe,{}));
|