@mastra/deployer-cloud 1.29.0-alpha.0 → 1.29.0-alpha.1
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/CHANGELOG.md +8 -0
- package/dist/studio/assets/{index-CV69fQaz.js → index-B0FGDuOE.js} +1 -1
- package/dist/studio/assets/{index-B2hrd-_b.js → index-B4hldRHY.js} +1 -1
- package/dist/studio/assets/{index-DwPIujMA.js → index-BAIbci1D.js} +1 -1
- package/dist/studio/assets/{index-B-kc6Ug0.js → index-BDR3cjgt.js} +1 -1
- package/dist/studio/assets/{index-C_LW8eZR.js → index-BY9llOIv.js} +1 -1
- package/dist/studio/assets/{index-BJdrZl7A.js → index-BeGnnM9T.js} +1 -1
- package/dist/studio/assets/{index-jdAnP8zL.js → index-Bl_7qW26.js} +1 -1
- package/dist/studio/assets/{index-BDLciS-I.js → index-BlyDIwMn.js} +1 -1
- package/dist/studio/assets/{index-Z0ge7D1k.js → index-BmOni1qQ.js} +1 -1
- package/dist/studio/assets/{index-D4Itb5pT.js → index-CACuXitB.js} +1 -1
- package/dist/studio/assets/{index-C0xtqs3A.js → index-CBeIMEy5.js} +1 -1
- package/dist/studio/assets/{index-wzDIgXIr.js → index-CJSPtnUq.js} +1 -1
- package/dist/studio/assets/{index-CAHAtm4d.js → index-CMJSJfP2.js} +1 -1
- package/dist/studio/assets/{index-BiY2wW_y.js → index-D4RLdPQX.js} +1 -1
- package/dist/studio/assets/{index-BvxNdF_C.js → index-DgsjhlXm.js} +1 -1
- package/dist/studio/assets/{index-yyeH8auD.js → index-L5xMFg-b.js} +1 -1
- package/dist/studio/assets/{index-U_w3DmC7.js → index-QXQVodHO.js} +1 -1
- package/dist/studio/assets/{index-D0uOX4X4.js → index-khE46ZgP.js} +1 -1
- package/dist/studio/assets/{main-DuMxgDor.js → main-NDZxFVBY.js} +6 -6
- package/dist/studio/index.html +1 -1
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-
|
|
2
|
-
import{_ as Ke}from"./index-C0xtqs3A.js";function ZBe(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(n,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var H$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Uo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nU={exports:{}},bj={};var lwe;function Jkt(){if(lwe)return bj;lwe=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,a){var i=null;if(a!==void 0&&(i=""+a),s.key!==void 0&&(i=""+s.key),"key"in s){a={};for(var l in s)l!=="key"&&(a[l]=s[l])}else a=s;return s=a.ref,{$$typeof:e,type:n,key:i,ref:s!==void 0?s:null,props:a}}return bj.Fragment=t,bj.jsx=r,bj.jsxs=r,bj}var cwe;function e_t(){return cwe||(cwe=1,nU.exports=Jkt()),nU.exports}var o=e_t(),sU={exports:{}},mn={},uwe;function t_t(){if(uwe)return mn;uwe=1;var e={env:{}};var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),p=Symbol.iterator;function m(q){return q===null||typeof q!="object"?null:(q=p&&q[p]||q["@@iterator"],typeof q=="function"?q:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,x={};function w(q,D,Q){this.props=q,this.context=D,this.refs=x,this.updater=Q||g}w.prototype.isReactComponent={},w.prototype.setState=function(q,D){if(typeof q!="object"&&typeof q!="function"&&q!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,q,D,"setState")},w.prototype.forceUpdate=function(q){this.updater.enqueueForceUpdate(this,q,"forceUpdate")};function S(){}S.prototype=w.prototype;function k(q,D,Q){this.props=q,this.context=D,this.refs=x,this.updater=Q||g}var _=k.prototype=new S;_.constructor=k,y(_,w.prototype),_.isPureReactComponent=!0;var E=Array.isArray;function T(){}var j={H:null,A:null,T:null,S:null},N=Object.prototype.hasOwnProperty;function I(q,D,Q){var G=Q.ref;return{$$typeof:t,type:q,key:D,ref:G!==void 0?G:null,props:Q}}function P(q,D){return I(q.type,D,q.props)}function R(q){return typeof q=="object"&&q!==null&&q.$$typeof===t}function $(q){var D={"=":"=0",":":"=2"};return"$"+q.replace(/[=:]/g,function(Q){return D[Q]})}var M=/\/+/g;function z(q,D){return typeof q=="object"&&q!==null&&q.key!=null?$(""+q.key):D.toString(36)}function U(q){switch(q.status){case"fulfilled":return q.value;case"rejected":throw q.reason;default:switch(typeof q.status=="string"?q.then(T,T):(q.status="pending",q.then(function(D){q.status==="pending"&&(q.status="fulfilled",q.value=D)},function(D){q.status==="pending"&&(q.status="rejected",q.reason=D)})),q.status){case"fulfilled":return q.value;case"rejected":throw q.reason}}throw q}function B(q,D,Q,G,J){var ae=typeof q;(ae==="undefined"||ae==="boolean")&&(q=null);var re=!1;if(q===null)re=!0;else switch(ae){case"bigint":case"string":case"number":re=!0;break;case"object":switch(q.$$typeof){case t:case r:re=!0;break;case f:return re=q._init,B(re(q._payload),D,Q,G,J)}}if(re)return J=J(q),re=G===""?"."+z(q,0):G,E(J)?(Q="",re!=null&&(Q=re.replace(M,"$&/")+"/"),B(J,D,Q,"",function(he){return he})):J!=null&&(R(J)&&(J=P(J,Q+(J.key==null||q&&q.key===J.key?"":(""+J.key).replace(M,"$&/")+"/")+re)),D.push(J)),1;re=0;var se=G===""?".":G+":";if(E(q))for(var oe=0;oe<q.length;oe++)G=q[oe],ae=se+z(G,oe),re+=B(G,D,Q,ae,J);else if(oe=m(q),typeof oe=="function")for(q=oe.call(q),oe=0;!(G=q.next()).done;)G=G.value,ae=se+z(G,oe++),re+=B(G,D,Q,ae,J);else if(ae==="object"){if(typeof q.then=="function")return B(U(q),D,Q,G,J);throw D=String(q),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(q).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.")}return re}function H(q,D,Q){if(q==null)return q;var G=[],J=0;return B(q,G,"","",function(ae){return D.call(Q,ae,J++)}),G}function W(q){if(q._status===-1){var D=q._result;D=D(),D.then(function(Q){(q._status===0||q._status===-1)&&(q._status=1,q._result=Q)},function(Q){(q._status===0||q._status===-1)&&(q._status=2,q._result=Q)}),q._status===-1&&(q._status=0,q._result=D)}if(q._status===1)return q._result.default;throw q._result}var L=typeof reportError=="function"?reportError:function(q){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var D=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof q=="object"&&q!==null&&typeof q.message=="string"?String(q.message):String(q),error:q});if(!window.dispatchEvent(D))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",q);return}console.error(q)},Y={map:H,forEach:function(q,D,Q){H(q,function(){D.apply(this,arguments)},Q)},count:function(q){var D=0;return H(q,function(){D++}),D},toArray:function(q){return H(q,function(D){return D})||[]},only:function(q){if(!R(q))throw Error("React.Children.only expected to receive a single React element child.");return q}};return mn.Activity=h,mn.Children=Y,mn.Component=w,mn.Fragment=n,mn.Profiler=a,mn.PureComponent=k,mn.StrictMode=s,mn.Suspense=u,mn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,mn.__COMPILER_RUNTIME={__proto__:null,c:function(q){return j.H.useMemoCache(q)}},mn.cache=function(q){return function(){return q.apply(null,arguments)}},mn.cacheSignal=function(){return null},mn.cloneElement=function(q,D,Q){if(q==null)throw Error("The argument must be a React element, but you passed "+q+".");var G=y({},q.props),J=q.key;if(D!=null)for(ae in D.key!==void 0&&(J=""+D.key),D)!N.call(D,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&D.ref===void 0||(G[ae]=D[ae]);var ae=arguments.length-2;if(ae===1)G.children=Q;else if(1<ae){for(var re=Array(ae),se=0;se<ae;se++)re[se]=arguments[se+2];G.children=re}return I(q.type,J,G)},mn.createContext=function(q){return q={$$typeof:l,_currentValue:q,_currentValue2:q,_threadCount:0,Provider:null,Consumer:null},q.Provider=q,q.Consumer={$$typeof:i,_context:q},q},mn.createElement=function(q,D,Q){var G,J={},ae=null;if(D!=null)for(G in D.key!==void 0&&(ae=""+D.key),D)N.call(D,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(J[G]=D[G]);var re=arguments.length-2;if(re===1)J.children=Q;else if(1<re){for(var se=Array(re),oe=0;oe<re;oe++)se[oe]=arguments[oe+2];J.children=se}if(q&&q.defaultProps)for(G in re=q.defaultProps,re)J[G]===void 0&&(J[G]=re[G]);return I(q,ae,J)},mn.createRef=function(){return{current:null}},mn.forwardRef=function(q){return{$$typeof:c,render:q}},mn.isValidElement=R,mn.lazy=function(q){return{$$typeof:f,_payload:{_status:-1,_result:q},_init:W}},mn.memo=function(q,D){return{$$typeof:d,type:q,compare:D===void 0?null:D}},mn.startTransition=function(q){var D=j.T,Q={};j.T=Q;try{var G=q(),J=j.S;J!==null&&J(Q,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(T,L)}catch(ae){L(ae)}finally{D!==null&&Q.types!==null&&(D.types=Q.types),j.T=D}},mn.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},mn.use=function(q){return j.H.use(q)},mn.useActionState=function(q,D,Q){return j.H.useActionState(q,D,Q)},mn.useCallback=function(q,D){return j.H.useCallback(q,D)},mn.useContext=function(q){return j.H.useContext(q)},mn.useDebugValue=function(){},mn.useDeferredValue=function(q,D){return j.H.useDeferredValue(q,D)},mn.useEffect=function(q,D){return j.H.useEffect(q,D)},mn.useEffectEvent=function(q){return j.H.useEffectEvent(q)},mn.useId=function(){return j.H.useId()},mn.useImperativeHandle=function(q,D,Q){return j.H.useImperativeHandle(q,D,Q)},mn.useInsertionEffect=function(q,D){return j.H.useInsertionEffect(q,D)},mn.useLayoutEffect=function(q,D){return j.H.useLayoutEffect(q,D)},mn.useMemo=function(q,D){return j.H.useMemo(q,D)},mn.useOptimistic=function(q,D){return j.H.useOptimistic(q,D)},mn.useReducer=function(q,D,Q){return j.H.useReducer(q,D,Q)},mn.useRef=function(q){return j.H.useRef(q)},mn.useState=function(q){return j.H.useState(q)},mn.useSyncExternalStore=function(q,D,Q){return j.H.useSyncExternalStore(q,D,Q)},mn.useTransition=function(){return j.H.useTransition()},mn.version="19.2.5",mn}var dwe;function _E(){return dwe||(dwe=1,sU.exports=t_t()),sU.exports}var b=_E();const je=Uo(b),t1=ZBe({__proto__:null,default:je},[b]);var aU={exports:{}},xj={},iU={exports:{}},oU={};var fwe;function r_t(){return fwe||(fwe=1,(function(e){function t(U,B){var H=U.length;U.push(B);e:for(;0<H;){var W=H-1>>>1,L=U[W];if(0<s(L,B))U[W]=B,U[H]=L,H=W;else break e}}function r(U){return U.length===0?null:U[0]}function n(U){if(U.length===0)return null;var B=U[0],H=U.pop();if(H!==B){U[0]=H;e:for(var W=0,L=U.length,Y=L>>>1;W<Y;){var q=2*(W+1)-1,D=U[q],Q=q+1,G=U[Q];if(0>s(D,H))Q<L&&0>s(G,D)?(U[W]=G,U[Q]=H,W=Q):(U[W]=D,U[q]=H,W=q);else if(Q<L&&0>s(G,H))U[W]=G,U[Q]=H,W=Q;else break e}}return B}function s(U,B){var H=U.sortIndex-B.sortIndex;return H!==0?H:U.id-B.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,g=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function k(U){for(var B=r(u);B!==null;){if(B.callback===null)n(u);else if(B.startTime<=U)n(u),B.sortIndex=B.expirationTime,t(c,B);else break;B=r(u)}}function _(U){if(g=!1,k(U),!m)if(r(c)!==null)m=!0,E||(E=!0,R());else{var B=r(u);B!==null&&z(_,B.startTime-U)}}var E=!1,T=-1,j=5,N=-1;function I(){return y?!0:!(e.unstable_now()-N<j)}function P(){if(y=!1,E){var U=e.unstable_now();N=U;var B=!0;try{e:{m=!1,g&&(g=!1,w(T),T=-1),p=!0;var H=h;try{t:{for(k(U),f=r(c);f!==null&&!(f.expirationTime>U&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,h=f.priorityLevel;var L=W(f.expirationTime<=U);if(U=e.unstable_now(),typeof L=="function"){f.callback=L,k(U),B=!0;break t}f===r(c)&&n(c),k(U)}else n(c);f=r(c)}if(f!==null)B=!0;else{var Y=r(u);Y!==null&&z(_,Y.startTime-U),B=!1}}break e}finally{f=null,h=H,p=!1}B=void 0}}finally{B?R():E=!1}}}var R;if(typeof S=="function")R=function(){S(P)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,M=$.port2;$.port1.onmessage=P,R=function(){M.postMessage(null)}}else R=function(){x(P,0)};function z(U,B){T=x(function(){U(e.unstable_now())},B)}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(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(U){switch(h){case 1:case 2:case 3:var B=3;break;default:B=h}var H=h;h=B;try{return U()}finally{h=H}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(U,B){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var H=h;h=U;try{return B()}finally{h=H}},e.unstable_scheduleCallback=function(U,B,H){var W=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?W+H:W):H=W,U){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=H+L,U={id:d++,callback:B,priorityLevel:U,startTime:H,expirationTime:L,sortIndex:-1},H>W?(U.sortIndex=H,t(u,U),r(c)===null&&U===r(u)&&(g?(w(T),T=-1):g=!0,z(_,H-W))):(U.sortIndex=L,t(c,U),m||p||(m=!0,E||(E=!0,R()))),U},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(U){var B=h;return function(){var H=h;h=B;try{return U.apply(this,arguments)}finally{h=H}}}})(oU)),oU}var hwe;function n_t(){return hwe||(hwe=1,iU.exports=r_t()),iU.exports}var lU={exports:{}},rc={};var pwe;function s_t(){if(pwe)return rc;pwe=1;var e=_E();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)u+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(c,u,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:f==null?null:""+f,children:c,containerInfo:u,implementation:d}}var i=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return rc.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,rc.createPortal=function(c,u){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return a(c,u,null,d)},rc.flushSync=function(c){var u=i.T,d=n.p;try{if(i.T=null,n.p=2,c)return c()}finally{i.T=u,n.p=d,n.d.f()}},rc.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,n.d.C(c,u))},rc.prefetchDNS=function(c){typeof c=="string"&&n.d.D(c)},rc.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin),h=typeof u.integrity=="string"?u.integrity:void 0,p=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?n.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:f,integrity:h,fetchPriority:p}):d==="script"&&n.d.X(c,{crossOrigin:f,integrity:h,fetchPriority:p,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},rc.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=l(u.as,u.crossOrigin);n.d.M(c,{crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&n.d.M(c)},rc.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin);n.d.L(c,d,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},rc.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=l(u.as,u.crossOrigin);n.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else n.d.m(c)},rc.requestFormReset=function(c){n.d.r(c)},rc.unstable_batchedUpdates=function(c,u){return c(u)},rc.useFormState=function(c,u,d){return i.H.useFormState(c,u,d)},rc.useFormStatus=function(){return i.H.useHostTransitionStatus()},rc.version="19.2.5",rc}var mwe;function YBe(){if(mwe)return lU.exports;mwe=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(),lU.exports=s_t(),lU.exports}var gwe;function a_t(){if(gwe)return xj;gwe=1;var e={env:{}};var t=n_t(),r=_E(),n=YBe();function s(v){var O="https://react.dev/errors/"+v;if(1<arguments.length){O+="?args[]="+encodeURIComponent(arguments[1]);for(var C=2;C<arguments.length;C++)O+="&args[]="+encodeURIComponent(arguments[C])}return"Minified React error #"+v+"; visit "+O+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(v){return!(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)}function i(v){var O=v,C=v;if(v.alternate)for(;O.return;)O=O.return;else{v=O;do O=v,(O.flags&4098)!==0&&(C=O.return),v=O.return;while(v)}return O.tag===3?C:null}function l(v){if(v.tag===13){var O=v.memoizedState;if(O===null&&(v=v.alternate,v!==null&&(O=v.memoizedState)),O!==null)return O.dehydrated}return null}function c(v){if(v.tag===31){var O=v.memoizedState;if(O===null&&(v=v.alternate,v!==null&&(O=v.memoizedState)),O!==null)return O.dehydrated}return null}function u(v){if(i(v)!==v)throw Error(s(188))}function d(v){var O=v.alternate;if(!O){if(O=i(v),O===null)throw Error(s(188));return O!==v?null:v}for(var C=v,A=O;;){var F=C.return;if(F===null)break;var V=F.alternate;if(V===null){if(A=F.return,A!==null){C=A;continue}break}if(F.child===V.child){for(V=F.child;V;){if(V===C)return u(F),v;if(V===A)return u(F),O;V=V.sibling}throw Error(s(188))}if(C.return!==A.return)C=F,A=V;else{for(var ee=!1,ce=F.child;ce;){if(ce===C){ee=!0,C=F,A=V;break}if(ce===A){ee=!0,A=F,C=V;break}ce=ce.sibling}if(!ee){for(ce=V.child;ce;){if(ce===C){ee=!0,C=V,A=F;break}if(ce===A){ee=!0,A=V,C=F;break}ce=ce.sibling}if(!ee)throw Error(s(189))}}if(C.alternate!==A)throw Error(s(190))}if(C.tag!==3)throw Error(s(188));return C.stateNode.current===C?v:O}function f(v){var O=v.tag;if(O===5||O===26||O===27||O===6)return v;for(v=v.child;v!==null;){if(O=f(v),O!==null)return O;v=v.sibling}return null}var h=Object.assign,p=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),k=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),R=Symbol.iterator;function $(v){return v===null||typeof v!="object"?null:(v=R&&v[R]||v["@@iterator"],typeof v=="function"?v:null)}var M=Symbol.for("react.client.reference");function z(v){if(v==null)return null;if(typeof v=="function")return v.$$typeof===M?null:v.displayName||v.name||null;if(typeof v=="string")return v;switch(v){case y:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case E:return"Suspense";case T:return"SuspenseList";case I:return"Activity"}if(typeof v=="object")switch(v.$$typeof){case g:return"Portal";case k:return v.displayName||"Context";case S:return(v._context.displayName||"Context")+".Consumer";case _:var O=v.render;return v=v.displayName,v||(v=O.displayName||O.name||"",v=v!==""?"ForwardRef("+v+")":"ForwardRef"),v;case j:return O=v.displayName||null,O!==null?O:z(v.type)||"Memo";case N:O=v._payload,v=v._init;try{return z(v(O))}catch{}}return null}var U=Array.isArray,B=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},L=[],Y=-1;function q(v){return{current:v}}function D(v){0>Y||(v.current=L[Y],L[Y]=null,Y--)}function Q(v,O){Y++,L[Y]=v.current,v.current=O}var G=q(null),J=q(null),ae=q(null),re=q(null);function se(v,O){switch(Q(ae,O),Q(J,v),Q(G,null),O.nodeType){case 9:case 11:v=(v=O.documentElement)&&(v=v.namespaceURI)?A0e(v):0;break;default:if(v=O.tagName,O=O.namespaceURI)O=A0e(O),v=I0e(O,v);else switch(v){case"svg":v=1;break;case"math":v=2;break;default:v=0}}D(G),Q(G,v)}function oe(){D(G),D(J),D(ae)}function he(v){v.memoizedState!==null&&Q(re,v);var O=G.current,C=I0e(O,v.type);O!==C&&(Q(J,v),Q(G,C))}function X(v){J.current===v&&(D(G),D(J)),re.current===v&&(D(re),mj._currentValue=W)}var te,le;function ve(v){if(te===void 0)try{throw Error()}catch(C){var O=C.stack.trim().match(/\n( *(at )?)/);te=O&&O[1]||"",le=-1<C.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DgsjhlXm.js","./index-CBeIMEy5.js","./index-QXQVodHO.js","./index-BlyDIwMn.js","./index-BDR3cjgt.js","./index-CJSPtnUq.js","./index-BY9llOIv.js","./index-CACuXitB.js","./index-CMJSJfP2.js","./index-BeGnnM9T.js","./index-B4hldRHY.js","./index-D4RLdPQX.js","./index-khE46ZgP.js","./index-B0FGDuOE.js","./index-BmOni1qQ.js","./dockerfile-BKs6k2Af.js","./simple-mode-GW_nhZxv.js","./factor-kuTfRLto.js","./nsis-LdVXkNf5.js","./pug-DeIclll2.js","./javascript-iXu5QeM3.js","./index-Bl_7qW26.js","./index-BAIbci1D.js","./index-L5xMFg-b.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as Ke}from"./index-CBeIMEy5.js";function ZBe(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(n,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var H$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Uo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nU={exports:{}},bj={};var lwe;function Jkt(){if(lwe)return bj;lwe=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,a){var i=null;if(a!==void 0&&(i=""+a),s.key!==void 0&&(i=""+s.key),"key"in s){a={};for(var l in s)l!=="key"&&(a[l]=s[l])}else a=s;return s=a.ref,{$$typeof:e,type:n,key:i,ref:s!==void 0?s:null,props:a}}return bj.Fragment=t,bj.jsx=r,bj.jsxs=r,bj}var cwe;function e_t(){return cwe||(cwe=1,nU.exports=Jkt()),nU.exports}var o=e_t(),sU={exports:{}},mn={},uwe;function t_t(){if(uwe)return mn;uwe=1;var e={env:{}};var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),p=Symbol.iterator;function m(q){return q===null||typeof q!="object"?null:(q=p&&q[p]||q["@@iterator"],typeof q=="function"?q:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,x={};function w(q,D,Q){this.props=q,this.context=D,this.refs=x,this.updater=Q||g}w.prototype.isReactComponent={},w.prototype.setState=function(q,D){if(typeof q!="object"&&typeof q!="function"&&q!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,q,D,"setState")},w.prototype.forceUpdate=function(q){this.updater.enqueueForceUpdate(this,q,"forceUpdate")};function S(){}S.prototype=w.prototype;function k(q,D,Q){this.props=q,this.context=D,this.refs=x,this.updater=Q||g}var _=k.prototype=new S;_.constructor=k,y(_,w.prototype),_.isPureReactComponent=!0;var E=Array.isArray;function T(){}var j={H:null,A:null,T:null,S:null},N=Object.prototype.hasOwnProperty;function I(q,D,Q){var G=Q.ref;return{$$typeof:t,type:q,key:D,ref:G!==void 0?G:null,props:Q}}function P(q,D){return I(q.type,D,q.props)}function R(q){return typeof q=="object"&&q!==null&&q.$$typeof===t}function $(q){var D={"=":"=0",":":"=2"};return"$"+q.replace(/[=:]/g,function(Q){return D[Q]})}var M=/\/+/g;function z(q,D){return typeof q=="object"&&q!==null&&q.key!=null?$(""+q.key):D.toString(36)}function U(q){switch(q.status){case"fulfilled":return q.value;case"rejected":throw q.reason;default:switch(typeof q.status=="string"?q.then(T,T):(q.status="pending",q.then(function(D){q.status==="pending"&&(q.status="fulfilled",q.value=D)},function(D){q.status==="pending"&&(q.status="rejected",q.reason=D)})),q.status){case"fulfilled":return q.value;case"rejected":throw q.reason}}throw q}function B(q,D,Q,G,J){var ae=typeof q;(ae==="undefined"||ae==="boolean")&&(q=null);var re=!1;if(q===null)re=!0;else switch(ae){case"bigint":case"string":case"number":re=!0;break;case"object":switch(q.$$typeof){case t:case r:re=!0;break;case f:return re=q._init,B(re(q._payload),D,Q,G,J)}}if(re)return J=J(q),re=G===""?"."+z(q,0):G,E(J)?(Q="",re!=null&&(Q=re.replace(M,"$&/")+"/"),B(J,D,Q,"",function(he){return he})):J!=null&&(R(J)&&(J=P(J,Q+(J.key==null||q&&q.key===J.key?"":(""+J.key).replace(M,"$&/")+"/")+re)),D.push(J)),1;re=0;var se=G===""?".":G+":";if(E(q))for(var oe=0;oe<q.length;oe++)G=q[oe],ae=se+z(G,oe),re+=B(G,D,Q,ae,J);else if(oe=m(q),typeof oe=="function")for(q=oe.call(q),oe=0;!(G=q.next()).done;)G=G.value,ae=se+z(G,oe++),re+=B(G,D,Q,ae,J);else if(ae==="object"){if(typeof q.then=="function")return B(U(q),D,Q,G,J);throw D=String(q),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(q).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.")}return re}function H(q,D,Q){if(q==null)return q;var G=[],J=0;return B(q,G,"","",function(ae){return D.call(Q,ae,J++)}),G}function W(q){if(q._status===-1){var D=q._result;D=D(),D.then(function(Q){(q._status===0||q._status===-1)&&(q._status=1,q._result=Q)},function(Q){(q._status===0||q._status===-1)&&(q._status=2,q._result=Q)}),q._status===-1&&(q._status=0,q._result=D)}if(q._status===1)return q._result.default;throw q._result}var L=typeof reportError=="function"?reportError:function(q){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var D=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof q=="object"&&q!==null&&typeof q.message=="string"?String(q.message):String(q),error:q});if(!window.dispatchEvent(D))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",q);return}console.error(q)},Y={map:H,forEach:function(q,D,Q){H(q,function(){D.apply(this,arguments)},Q)},count:function(q){var D=0;return H(q,function(){D++}),D},toArray:function(q){return H(q,function(D){return D})||[]},only:function(q){if(!R(q))throw Error("React.Children.only expected to receive a single React element child.");return q}};return mn.Activity=h,mn.Children=Y,mn.Component=w,mn.Fragment=n,mn.Profiler=a,mn.PureComponent=k,mn.StrictMode=s,mn.Suspense=u,mn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,mn.__COMPILER_RUNTIME={__proto__:null,c:function(q){return j.H.useMemoCache(q)}},mn.cache=function(q){return function(){return q.apply(null,arguments)}},mn.cacheSignal=function(){return null},mn.cloneElement=function(q,D,Q){if(q==null)throw Error("The argument must be a React element, but you passed "+q+".");var G=y({},q.props),J=q.key;if(D!=null)for(ae in D.key!==void 0&&(J=""+D.key),D)!N.call(D,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&D.ref===void 0||(G[ae]=D[ae]);var ae=arguments.length-2;if(ae===1)G.children=Q;else if(1<ae){for(var re=Array(ae),se=0;se<ae;se++)re[se]=arguments[se+2];G.children=re}return I(q.type,J,G)},mn.createContext=function(q){return q={$$typeof:l,_currentValue:q,_currentValue2:q,_threadCount:0,Provider:null,Consumer:null},q.Provider=q,q.Consumer={$$typeof:i,_context:q},q},mn.createElement=function(q,D,Q){var G,J={},ae=null;if(D!=null)for(G in D.key!==void 0&&(ae=""+D.key),D)N.call(D,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(J[G]=D[G]);var re=arguments.length-2;if(re===1)J.children=Q;else if(1<re){for(var se=Array(re),oe=0;oe<re;oe++)se[oe]=arguments[oe+2];J.children=se}if(q&&q.defaultProps)for(G in re=q.defaultProps,re)J[G]===void 0&&(J[G]=re[G]);return I(q,ae,J)},mn.createRef=function(){return{current:null}},mn.forwardRef=function(q){return{$$typeof:c,render:q}},mn.isValidElement=R,mn.lazy=function(q){return{$$typeof:f,_payload:{_status:-1,_result:q},_init:W}},mn.memo=function(q,D){return{$$typeof:d,type:q,compare:D===void 0?null:D}},mn.startTransition=function(q){var D=j.T,Q={};j.T=Q;try{var G=q(),J=j.S;J!==null&&J(Q,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(T,L)}catch(ae){L(ae)}finally{D!==null&&Q.types!==null&&(D.types=Q.types),j.T=D}},mn.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},mn.use=function(q){return j.H.use(q)},mn.useActionState=function(q,D,Q){return j.H.useActionState(q,D,Q)},mn.useCallback=function(q,D){return j.H.useCallback(q,D)},mn.useContext=function(q){return j.H.useContext(q)},mn.useDebugValue=function(){},mn.useDeferredValue=function(q,D){return j.H.useDeferredValue(q,D)},mn.useEffect=function(q,D){return j.H.useEffect(q,D)},mn.useEffectEvent=function(q){return j.H.useEffectEvent(q)},mn.useId=function(){return j.H.useId()},mn.useImperativeHandle=function(q,D,Q){return j.H.useImperativeHandle(q,D,Q)},mn.useInsertionEffect=function(q,D){return j.H.useInsertionEffect(q,D)},mn.useLayoutEffect=function(q,D){return j.H.useLayoutEffect(q,D)},mn.useMemo=function(q,D){return j.H.useMemo(q,D)},mn.useOptimistic=function(q,D){return j.H.useOptimistic(q,D)},mn.useReducer=function(q,D,Q){return j.H.useReducer(q,D,Q)},mn.useRef=function(q){return j.H.useRef(q)},mn.useState=function(q){return j.H.useState(q)},mn.useSyncExternalStore=function(q,D,Q){return j.H.useSyncExternalStore(q,D,Q)},mn.useTransition=function(){return j.H.useTransition()},mn.version="19.2.5",mn}var dwe;function _E(){return dwe||(dwe=1,sU.exports=t_t()),sU.exports}var b=_E();const je=Uo(b),t1=ZBe({__proto__:null,default:je},[b]);var aU={exports:{}},xj={},iU={exports:{}},oU={};var fwe;function r_t(){return fwe||(fwe=1,(function(e){function t(U,B){var H=U.length;U.push(B);e:for(;0<H;){var W=H-1>>>1,L=U[W];if(0<s(L,B))U[W]=B,U[H]=L,H=W;else break e}}function r(U){return U.length===0?null:U[0]}function n(U){if(U.length===0)return null;var B=U[0],H=U.pop();if(H!==B){U[0]=H;e:for(var W=0,L=U.length,Y=L>>>1;W<Y;){var q=2*(W+1)-1,D=U[q],Q=q+1,G=U[Q];if(0>s(D,H))Q<L&&0>s(G,D)?(U[W]=G,U[Q]=H,W=Q):(U[W]=D,U[q]=H,W=q);else if(Q<L&&0>s(G,H))U[W]=G,U[Q]=H,W=Q;else break e}}return B}function s(U,B){var H=U.sortIndex-B.sortIndex;return H!==0?H:U.id-B.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,g=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function k(U){for(var B=r(u);B!==null;){if(B.callback===null)n(u);else if(B.startTime<=U)n(u),B.sortIndex=B.expirationTime,t(c,B);else break;B=r(u)}}function _(U){if(g=!1,k(U),!m)if(r(c)!==null)m=!0,E||(E=!0,R());else{var B=r(u);B!==null&&z(_,B.startTime-U)}}var E=!1,T=-1,j=5,N=-1;function I(){return y?!0:!(e.unstable_now()-N<j)}function P(){if(y=!1,E){var U=e.unstable_now();N=U;var B=!0;try{e:{m=!1,g&&(g=!1,w(T),T=-1),p=!0;var H=h;try{t:{for(k(U),f=r(c);f!==null&&!(f.expirationTime>U&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,h=f.priorityLevel;var L=W(f.expirationTime<=U);if(U=e.unstable_now(),typeof L=="function"){f.callback=L,k(U),B=!0;break t}f===r(c)&&n(c),k(U)}else n(c);f=r(c)}if(f!==null)B=!0;else{var Y=r(u);Y!==null&&z(_,Y.startTime-U),B=!1}}break e}finally{f=null,h=H,p=!1}B=void 0}}finally{B?R():E=!1}}}var R;if(typeof S=="function")R=function(){S(P)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,M=$.port2;$.port1.onmessage=P,R=function(){M.postMessage(null)}}else R=function(){x(P,0)};function z(U,B){T=x(function(){U(e.unstable_now())},B)}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(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(U){switch(h){case 1:case 2:case 3:var B=3;break;default:B=h}var H=h;h=B;try{return U()}finally{h=H}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(U,B){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var H=h;h=U;try{return B()}finally{h=H}},e.unstable_scheduleCallback=function(U,B,H){var W=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?W+H:W):H=W,U){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=H+L,U={id:d++,callback:B,priorityLevel:U,startTime:H,expirationTime:L,sortIndex:-1},H>W?(U.sortIndex=H,t(u,U),r(c)===null&&U===r(u)&&(g?(w(T),T=-1):g=!0,z(_,H-W))):(U.sortIndex=L,t(c,U),m||p||(m=!0,E||(E=!0,R()))),U},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(U){var B=h;return function(){var H=h;h=B;try{return U.apply(this,arguments)}finally{h=H}}}})(oU)),oU}var hwe;function n_t(){return hwe||(hwe=1,iU.exports=r_t()),iU.exports}var lU={exports:{}},rc={};var pwe;function s_t(){if(pwe)return rc;pwe=1;var e=_E();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)u+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(c,u,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:f==null?null:""+f,children:c,containerInfo:u,implementation:d}}var i=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return rc.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,rc.createPortal=function(c,u){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return a(c,u,null,d)},rc.flushSync=function(c){var u=i.T,d=n.p;try{if(i.T=null,n.p=2,c)return c()}finally{i.T=u,n.p=d,n.d.f()}},rc.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,n.d.C(c,u))},rc.prefetchDNS=function(c){typeof c=="string"&&n.d.D(c)},rc.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin),h=typeof u.integrity=="string"?u.integrity:void 0,p=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?n.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:f,integrity:h,fetchPriority:p}):d==="script"&&n.d.X(c,{crossOrigin:f,integrity:h,fetchPriority:p,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},rc.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=l(u.as,u.crossOrigin);n.d.M(c,{crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&n.d.M(c)},rc.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin);n.d.L(c,d,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},rc.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=l(u.as,u.crossOrigin);n.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else n.d.m(c)},rc.requestFormReset=function(c){n.d.r(c)},rc.unstable_batchedUpdates=function(c,u){return c(u)},rc.useFormState=function(c,u,d){return i.H.useFormState(c,u,d)},rc.useFormStatus=function(){return i.H.useHostTransitionStatus()},rc.version="19.2.5",rc}var mwe;function YBe(){if(mwe)return lU.exports;mwe=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(),lU.exports=s_t(),lU.exports}var gwe;function a_t(){if(gwe)return xj;gwe=1;var e={env:{}};var t=n_t(),r=_E(),n=YBe();function s(v){var O="https://react.dev/errors/"+v;if(1<arguments.length){O+="?args[]="+encodeURIComponent(arguments[1]);for(var C=2;C<arguments.length;C++)O+="&args[]="+encodeURIComponent(arguments[C])}return"Minified React error #"+v+"; visit "+O+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(v){return!(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)}function i(v){var O=v,C=v;if(v.alternate)for(;O.return;)O=O.return;else{v=O;do O=v,(O.flags&4098)!==0&&(C=O.return),v=O.return;while(v)}return O.tag===3?C:null}function l(v){if(v.tag===13){var O=v.memoizedState;if(O===null&&(v=v.alternate,v!==null&&(O=v.memoizedState)),O!==null)return O.dehydrated}return null}function c(v){if(v.tag===31){var O=v.memoizedState;if(O===null&&(v=v.alternate,v!==null&&(O=v.memoizedState)),O!==null)return O.dehydrated}return null}function u(v){if(i(v)!==v)throw Error(s(188))}function d(v){var O=v.alternate;if(!O){if(O=i(v),O===null)throw Error(s(188));return O!==v?null:v}for(var C=v,A=O;;){var F=C.return;if(F===null)break;var V=F.alternate;if(V===null){if(A=F.return,A!==null){C=A;continue}break}if(F.child===V.child){for(V=F.child;V;){if(V===C)return u(F),v;if(V===A)return u(F),O;V=V.sibling}throw Error(s(188))}if(C.return!==A.return)C=F,A=V;else{for(var ee=!1,ce=F.child;ce;){if(ce===C){ee=!0,C=F,A=V;break}if(ce===A){ee=!0,A=F,C=V;break}ce=ce.sibling}if(!ee){for(ce=V.child;ce;){if(ce===C){ee=!0,C=V,A=F;break}if(ce===A){ee=!0,A=V,C=F;break}ce=ce.sibling}if(!ee)throw Error(s(189))}}if(C.alternate!==A)throw Error(s(190))}if(C.tag!==3)throw Error(s(188));return C.stateNode.current===C?v:O}function f(v){var O=v.tag;if(O===5||O===26||O===27||O===6)return v;for(v=v.child;v!==null;){if(O=f(v),O!==null)return O;v=v.sibling}return null}var h=Object.assign,p=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),k=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),R=Symbol.iterator;function $(v){return v===null||typeof v!="object"?null:(v=R&&v[R]||v["@@iterator"],typeof v=="function"?v:null)}var M=Symbol.for("react.client.reference");function z(v){if(v==null)return null;if(typeof v=="function")return v.$$typeof===M?null:v.displayName||v.name||null;if(typeof v=="string")return v;switch(v){case y:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case E:return"Suspense";case T:return"SuspenseList";case I:return"Activity"}if(typeof v=="object")switch(v.$$typeof){case g:return"Portal";case k:return v.displayName||"Context";case S:return(v._context.displayName||"Context")+".Consumer";case _:var O=v.render;return v=v.displayName,v||(v=O.displayName||O.name||"",v=v!==""?"ForwardRef("+v+")":"ForwardRef"),v;case j:return O=v.displayName||null,O!==null?O:z(v.type)||"Memo";case N:O=v._payload,v=v._init;try{return z(v(O))}catch{}}return null}var U=Array.isArray,B=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},L=[],Y=-1;function q(v){return{current:v}}function D(v){0>Y||(v.current=L[Y],L[Y]=null,Y--)}function Q(v,O){Y++,L[Y]=v.current,v.current=O}var G=q(null),J=q(null),ae=q(null),re=q(null);function se(v,O){switch(Q(ae,O),Q(J,v),Q(G,null),O.nodeType){case 9:case 11:v=(v=O.documentElement)&&(v=v.namespaceURI)?A0e(v):0;break;default:if(v=O.tagName,O=O.namespaceURI)O=A0e(O),v=I0e(O,v);else switch(v){case"svg":v=1;break;case"math":v=2;break;default:v=0}}D(G),Q(G,v)}function oe(){D(G),D(J),D(ae)}function he(v){v.memoizedState!==null&&Q(re,v);var O=G.current,C=I0e(O,v.type);O!==C&&(Q(J,v),Q(G,C))}function X(v){J.current===v&&(D(G),D(J)),re.current===v&&(D(re),mj._currentValue=W)}var te,le;function ve(v){if(te===void 0)try{throw Error()}catch(C){var O=C.stack.trim().match(/\n( *(at )?)/);te=O&&O[1]||"",le=-1<C.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<C.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+te+v+le}var ue=!1;function fe(v,O){if(!v||ue)return"";ue=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var A={DetermineComponentFrameRoot:function(){try{if(O){var ut=function(){throw Error()};if(Object.defineProperty(ut.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ut,[])}catch(et){var Ze=et}Reflect.construct(v,[],ut)}else{try{ut.call()}catch(et){Ze=et}v.call(ut.prototype)}}else{try{throw Error()}catch(et){Ze=et}(ut=v())&&typeof ut.catch=="function"&&ut.catch(function(){})}}catch(et){if(et&&Ze&&typeof et.stack=="string")return[et.stack,Ze.stack]}return[null,null]}};A.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var F=Object.getOwnPropertyDescriptor(A.DetermineComponentFrameRoot,"name");F&&F.configurable&&Object.defineProperty(A.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var V=A.DetermineComponentFrameRoot(),ee=V[0],ce=V[1];if(ee&&ce){var Te=ee.split(`
|
|
5
5
|
`),We=ce.split(`
|
|
@@ -109,7 +109,7 @@ Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}
|
|
|
109
109
|
constructor(\${params}) {
|
|
110
110
|
\${}
|
|
111
111
|
}
|
|
112
|
-
}`,{label:"class",detail:"definition",type:"keyword"}),Eu('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Eu('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],RGe=Pue.concat([Eu("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Eu("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Eu("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Ske=new RHe,PGe=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Mj(e){return(t,r)=>{let n=t.node.getChild("VariableDefinition");return n&&r(n,e),!0}}const gQt=["FunctionDeclaration"],yQt={FunctionDeclaration:Mj("function"),ClassDeclaration:Mj("class"),ClassExpression:()=>!0,EnumDeclaration:Mj("constant"),TypeAliasDeclaration:Mj("type"),NamespaceDeclaration:Mj("namespace"),VariableDefinition(e,t){e.matchContext(gQt)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function MGe(e,t){let r=Ske.get(t);if(r)return r;let n=[],s=!0;function a(i,l){let c=e.sliceString(i.from,i.to);n.push({label:c,type:l})}return t.cursor(Ks.IncludeAnonymous).iterate(i=>{if(s)s=!1;else if(i.name){let l=yQt[i.name];if(l&&l(i,a)||PGe.has(i.name))return!1}else if(i.to-i.from>8192){for(let l of MGe(e,i.node))n.push(l);return!1}}),Ske.set(t,n),n}const q3=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Mue=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function DGe(e){let t=Aa(e.state).resolveInner(e.pos,-1);if(Mue.indexOf(t.name)>-1)return null;let r=t.name=="VariableName"||t.to-t.from<20&&q3.test(e.state.sliceDoc(t.from,t.to));if(!r&&!e.explicit)return null;let n=[];for(let s=t;s;s=s.parent)PGe.has(s.name)&&(n=n.concat(MGe(e.state.doc,s)));return{options:n,from:r?t.from:e.pos,validFor:q3}}function dV(e,t,r){var n;let s=[];for(;;){let a=t.firstChild,i;if(a?.name=="VariableName")return s.push(e(a)),{path:s.reverse(),name:r};if(a?.name=="MemberExpression"&&((n=i=a.lastChild)===null||n===void 0?void 0:n.name)=="PropertyName")s.push(e(i)),t=a;else return null}}function LGe(e){let t=n=>e.state.doc.sliceString(n.from,n.to),r=Aa(e.state).resolveInner(e.pos,-1);return r.name=="PropertyName"?dV(t,r.parent,t(r)):(r.name=="."||r.name=="?.")&&r.parent.name=="MemberExpression"?dV(t,r.parent,""):Mue.indexOf(r.name)>-1?null:r.name=="VariableName"||r.to-r.from<20&&q3.test(t(r))?{path:[],name:t(r)}:r.name=="MemberExpression"?dV(t,r,""):e.explicit?{path:[],name:""}:null}function vQt(e,t){let r=e,n=[],s=new Set;for(let a=0;;a++){for(let l of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(l)||s.has(l))continue;s.add(l);let c;try{c=r[l]}catch{continue}n.push({label:l,type:typeof c=="function"?/^[A-Z]/.test(l)?"class":t?"function":"method":t?"variable":"property",boost:-a})}let i=Object.getPrototypeOf(e);if(!i)return n;e=i}}function bQt(e){let t=new Map;return r=>{let n=LGe(r);if(!n)return null;let s=e;for(let i of n.path)if(s=s[i],!s)return null;let a=t.get(s);return a||t.set(s,a=vQt(s,!n.path.length)),{from:r.pos-n.name.length,options:a,validFor:q3}}}const gh=cS.define({name:"javascript",parser:mQt.configure({props:[d1.add({IfStatement:Uk({except:/^\s*({|else\b)/}),TryStatement:Uk({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:mUt,SwitchBody:e=>{let t=e.textAfter,r=/^\s*\}/.test(t),n=/^\s*(case|default)\b/.test(t);return e.baseIndent+(r?0:n?1:2)*e.unit},Block:pUt({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":Uk({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),f1.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":pue,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name=="JSXSelfClosingTag")return null;let r=e.lastChild;return{from:t.to,to:r.type.isError?e.to:r.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let r=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,n=e.lastChild;return!r||r.type.isError?null:{from:r.to,to:n.type.isError?e.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),$Ge={test:e=>/^JSX/.test(e.name),facet:RF({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Due=gh.configure({dialect:"ts"},"typescript"),Lue=gh.configure({dialect:"jsx",props:[due.add(e=>e.isTop?[$Ge]:void 0)]}),$ue=gh.configure({dialect:"jsx ts",props:[due.add(e=>e.isTop?[$Ge]:void 0)]},"typescript");let FGe=e=>({label:e,type:"keyword"});const zGe="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(FGe),xQt=zGe.concat(["declare","implements","private","protected","public"].map(FGe));function H3(e={}){let t=e.jsx?e.typescript?$ue:Lue:e.typescript?Due:gh,r=e.typescript?RGe.concat(xQt):Pue.concat(zGe);return new dS(t,[gh.data.of({autocomplete:eVt(Mue,MWe(r))}),gh.data.of({autocomplete:DGe}),e.jsx?BGe:[]])}function wQt(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function Oke(e,t,r=e.length){for(let n=t?.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return e.sliceString(n.from,Math.min(n.to,r));return""}const SQt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),BGe=ft.inputHandler.of((e,t,r,n,s)=>{if((SQt?e.composing:e.compositionStarted)||e.state.readOnly||t!=r||n!=">"&&n!="/"||!gh.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,l=i.changeByRange(c=>{var u;let{head:d}=c,f=Aa(i).resolveInner(d-1,-1),h;if(f.name=="JSXStartTag"&&(f=f.parent),!(i.doc.sliceString(d-1,d)!=n||f.name=="JSXAttributeValue"&&f.to>d)){if(n==">"&&f.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:"</>"}};if(n=="/"&&f.name=="JSXStartCloseTag"){let p=f.parent,m=p.parent;if(m&&p.from==d-2&&((h=Oke(i.doc,m.firstChild,d))||((u=m.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let g=`${h}>`;return{range:nt.cursor(d+g.length,-1),changes:{from:d,insert:g}}}}else if(n==">"){let p=wQt(f);if(p&&p.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(h=Oke(i.doc,p,d)))return{range:c,changes:{from:d,insert:`</${h}>`}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([a,i.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function OQt(e,t){return t||(t={parserOptions:{ecmaVersion:2019,sourceType:"module"},env:{browser:!0,node:!0,es6:!0,es2015:!0,es2017:!0,es2020:!0},rules:{}},e.getRules().forEach((r,n)=>{var s;!((s=r.meta.docs)===null||s===void 0)&&s.recommended&&(t.rules[n]=2)})),r=>{let{state:n}=r,s=[];for(let{from:a,to:i}of gh.findRegions(n)){let l=n.doc.lineAt(a),c={line:l.number-1,col:a-l.from,pos:a};for(let u of e.verify(n.sliceDoc(a,i),t))s.push(kQt(u,n.doc,c))}return s}}function kke(e,t,r,n){return r.line(e+n.line).from+t+(e==1?n.col-1:-1)}function kQt(e,t,r){let n=kke(e.line,e.column,t,r),s={from:n,to:e.endLine!=null&&e.endColumn!=1?kke(e.endLine,e.endColumn,t,r):n,message:e.message,source:e.ruleId?"eslint:"+e.ruleId:"eslint",severity:e.severity==1?"warning":"error"};if(e.fix){let{range:a,text:i}=e.fix,l=a[0]+r.pos-n,c=a[1]+r.pos-n;s.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+l,to:d+c,insert:i},scrollIntoView:!0})}}]}return s}const J2=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:BGe,completionPath:LGe,esLint:OQt,javascript:H3,javascriptLanguage:gh,jsxLanguage:Lue,localCompletionSource:DGe,scopeCompletionSource:bQt,snippets:Pue,tsxLanguage:$ue,typescriptLanguage:Due,typescriptSnippets:RGe},Symbol.toStringTag,{value:"Module"})),Dj=["_blank","_self","_top","_parent"],fV=["ascii","utf-8","utf-16","latin1","latin1"],hV=["get","post","put","delete"],pV=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Sd=["true","false"],Dr={},_Qt={a:{attrs:{href:null,ping:null,type:null,media:null,target:Dj,hreflang:null}},abbr:Dr,address:Dr,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Dr,aside:Dr,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Dr,base:{attrs:{href:null,target:Dj}},bdi:Dr,bdo:Dr,blockquote:{attrs:{cite:null}},body:Dr,br:Dr,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:pV,formmethod:hV,formnovalidate:["novalidate"],formtarget:Dj,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Dr,center:Dr,cite:Dr,code:Dr,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Dr,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Dr,div:Dr,dl:Dr,dt:Dr,em:Dr,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Dr,figure:Dr,footer:Dr,form:{attrs:{action:null,name:null,"accept-charset":fV,autocomplete:["on","off"],enctype:pV,method:hV,novalidate:["novalidate"],target:Dj}},h1:Dr,h2:Dr,h3:Dr,h4:Dr,h5:Dr,h6:Dr,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Dr,hgroup:Dr,hr:Dr,html:{attrs:{manifest:null}},i:Dr,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:pV,formmethod:hV,formnovalidate:["novalidate"],formtarget:Dj,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Dr,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Dr,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Dr,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:fV,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Dr,noscript:Dr,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Dr,param:{attrs:{name:null,value:null}},pre:Dr,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Dr,rt:Dr,ruby:Dr,samp:Dr,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:fV}},section:Dr,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Dr,source:{attrs:{src:null,type:null,media:null}},span:Dr,strong:Dr,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Dr,summary:Dr,sup:Dr,table:Dr,tbody:Dr,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Dr,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Dr,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Dr,time:{attrs:{datetime:null}},title:Dr,tr:Dr,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Dr,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Dr},UGe={accesskey:null,class:null,contenteditable:Sd,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Sd,autocorrect:Sd,autocapitalize:Sd,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Sd,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Sd,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Sd,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Sd,"aria-hidden":Sd,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Sd,"aria-multiselectable":Sd,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Sd,"aria-relevant":null,"aria-required":Sd,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},VGe="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of VGe)UGe[e]=null;let TA=class{constructor(t,r){this.tags={..._Qt,...t},this.globalAttrs={...UGe,...r},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};TA.default=new TA;function N_(e,t,r=e.length){if(!t)return"";let n=t.firstChild,s=n&&n.getChild("TagName");return s?e.sliceString(s.from,Math.min(s.to,r)):""}function A_(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function qGe(e,t,r){let n=r.tags[N_(e,A_(t))];return n?.children||r.allTags}function Fue(e,t){let r=[];for(let n=A_(t);n&&!n.type.isTop;n=A_(n.parent)){let s=N_(e,n);if(s&&n.lastChild.name=="CloseTag")break;s&&r.indexOf(s)<0&&(t.name=="EndTag"||t.from>=n.firstChild.to)&&r.push(s)}return r}const HGe=/^[:\-\.\w\u00b7-\uffff]*$/;function _ke(e,t,r,n,s){let a=/\s*>/.test(e.sliceDoc(s,s+5))?"":">",i=A_(r,r.name=="StartTag"||r.name=="TagName");return{from:n,to:s,options:qGe(e.doc,i,t).map(l=>({label:l,type:"type"})).concat(Fue(e.doc,r).map((l,c)=>({label:"/"+l,apply:"/"+l+a,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function Eke(e,t,r,n){let s=/\s*>/.test(e.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:Fue(e.doc,t).map((a,i)=>({label:a,apply:a+s,type:"type",boost:99-i})),validFor:HGe}}function EQt(e,t,r,n){let s=[],a=0;for(let i of qGe(e.doc,r,t))s.push({label:"<"+i,type:"type"});for(let i of Fue(e.doc,r))s.push({label:"</"+i+">",type:"type",boost:99-a++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function CQt(e,t,r,n,s){let a=A_(r),i=a?t.tags[N_(e.doc,a)]:null,l=i&&i.attrs?Object.keys(i.attrs):[],c=i&&i.globalAttrs===!1?l:l.length?l.concat(t.globalAttrNames):t.globalAttrNames;return{from:n,to:s,options:c.map(u=>({label:u,type:"property"})),validFor:HGe}}function jQt(e,t,r,n,s){var a;let i=(a=r.parent)===null||a===void 0?void 0:a.getChild("AttributeName"),l=[],c;if(i){let u=e.sliceDoc(i.from,i.to),d=t.globalAttrs[u];if(!d){let f=A_(r),h=f?t.tags[N_(e.doc,f)]:null;d=h?.attrs&&h.attrs[u]}if(d){let f=e.sliceDoc(n,s).toLowerCase(),h='"',p='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",p=e.sliceDoc(s,s+1)==f[0]?"":f[0],f=f.slice(1),n++):c=/^[^\s<>='"]*$/;for(let m of d)l.push({label:m,apply:h+m+p,type:"constant"})}}return{from:n,to:s,options:l,validFor:c}}function QGe(e,t){let{state:r,pos:n}=t,s=Aa(r).resolveInner(n,-1),a=s.resolve(n);for(let i=n,l;a==s&&(l=s.childBefore(i));){let c=l.lastChild;if(!c||!c.type.isError||c.from<c.to)break;a=s=l,i=c.from}return s.name=="TagName"?s.parent&&/CloseTag$/.test(s.parent.name)?Eke(r,s,s.from,n):_ke(r,e,s,s.from,n):s.name=="StartTag"||s.name=="IncompleteTag"?_ke(r,e,s,n,n):s.name=="StartCloseTag"||s.name=="IncompleteCloseTag"?Eke(r,s,n,n):s.name=="OpenTag"||s.name=="SelfClosingTag"||s.name=="AttributeName"?CQt(r,e,s,s.name=="AttributeName"?s.from:n,n):s.name=="Is"||s.name=="AttributeValue"||s.name=="UnquotedAttributeValue"?jQt(r,e,s,s.name=="Is"?n:s.from,n):t.explicit&&(a.name=="Element"||a.name=="Text"||a.name=="Document")?EQt(r,e,s,n):null}function WGe(e){return QGe(TA.default,e)}function GGe(e){let{extraTags:t,extraGlobalAttributes:r}=e,n=r||t?new TA(t,r):TA.default;return s=>QGe(n,s)}const TQt=gh.parser.configure({top:"SingleExpression"}),ZGe=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:Due.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:Lue.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:$ue.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:TQt},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:gh.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:jA.parser}],YGe=[{name:"style",parser:jA.parser.configure({top:"Styles"})}].concat(VGe.map(e=>({name:e,parser:gh.parser}))),XGe=cS.define({name:"html",parser:sHt.configure({props:[d1.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,r;for(let n=e.node;;){let s=n.lastChild;if(!s||s.name!="Element"||s.to!=n.to)break;t=n=s}return t&&!((r=t.lastChild)&&(r.name=="CloseTag"||r.name=="SelfClosingTag"))?e.lineIndent(t.from)+e.unit:null}}),f1.add({Element(e){let t=e.firstChild,r=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:r.name=="CloseTag"?r.from:e.to}}}),jWe.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),xN=XGe.configure({wrap:OGe(ZGe,YGe)});function KGe(e={}){let t="",r;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(r=OGe((e.nestedLanguages||[]).concat(ZGe),(e.nestedAttributes||[]).concat(YGe)));let n=r?XGe.configure({wrap:r,dialect:t}):t?xN.configure({dialect:t}):xN;return new dS(n,[xN.data.of({autocomplete:GGe(e)}),e.autoCloseTags!==!1?JGe:[],H3().support,AGe().support])}const Cke=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),JGe=ft.inputHandler.of((e,t,r,n,s)=>{if(e.composing||e.state.readOnly||t!=r||n!=">"&&n!="/"||!xN.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,l=i.changeByRange(c=>{var u,d,f;let h=i.doc.sliceString(c.from-1,c.to)==n,{head:p}=c,m=Aa(i).resolveInner(p,-1),g;if(h&&n==">"&&m.name=="EndTag"){let y=m.parent;if(((d=(u=y.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(g=N_(i.doc,y.parent,p))&&!Cke.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`</${g}>`;return{range:c,changes:{from:p,to:x,insert:w}}}}else if(h&&n=="/"&&m.name=="IncompleteCloseTag"){let y=m.parent;if(m.from==p-2&&((f=y.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=N_(i.doc,y,p))&&!Cke.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`${g}>`;return{range:nt.cursor(p+w.length,-1),changes:{from:p,to:x,insert:w}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([a,i.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),NQt=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:JGe,html:KGe,htmlCompletionSource:WGe,htmlCompletionSourceWith:GGe,htmlLanguage:xN},Symbol.toStringTag,{value:"Module"})),eZe=RF({commentTokens:{block:{open:"<!--",close:"-->"}}}),tZe=new hn,rZe=iqt.configure({props:[f1.add(e=>!e.is("Block")||e.is("Document")||ese(e)!=null||AQt(e)?void 0:(t,r)=>({from:r.doc.lineAt(t.from).to,to:t.to})),tZe.add(ese),d1.add({Document:()=>null}),Fb.add({Document:eZe})]});function ese(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function AQt(e){return e.name=="OrderedList"||e.name=="BulletList"}function IQt(e,t){let r=e;for(;;){let n=r.nextSibling,s;if(!n||(s=ese(n.type))!=null&&s<=t)break;r=n}return r.to}const RQt=gWe.of((e,t,r)=>{for(let n=Aa(e).resolveInner(r,-1);n&&!(n.from<t);n=n.parent){let s=n.type.prop(tZe);if(s==null)continue;let a=IQt(n,s);if(a>r)return{from:r,to:a}}return null});function zue(e){return new qd(eZe,e,[],"markdown")}const nZe=zue(rZe),PQt=rZe.configure([yqt,bqt,vqt,xqt,{props:[f1.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),pS=zue(PQt);function MQt(e,t){return r=>{if(r&&e){let n=null;if(r=/\S*/.exec(r)[0],typeof e=="function"?n=e(r):n=Ye.matchLanguageName(e,r,!0),n instanceof Ye)return n.support?n.support.language.parser:uS.getSkippingParser(n.load());if(n)return n.parser}return t?t.parser:null}}class mV{constructor(t,r,n,s,a,i,l){this.node=t,this.from=r,this.to=n,this.spaceBefore=s,this.spaceAfter=a,this.type=i,this.item=l}blank(t,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;n.length<t;)n+=" ";return n}else{for(let s=this.to-this.from-n.length-this.spaceAfter.length;s>0;s--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(t,r){let n=this.node.name=="OrderedList"?String(+aZe(this.item,t)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function sZe(e,t){let r=[],n=[];for(let s=e;s;s=s.parent){if(s.name=="FencedCode")return n;(s.name=="ListItem"||s.name=="Blockquote")&&r.push(s)}for(let s=r.length-1;s>=0;s--){let a=r[s],i,l=t.lineAt(a.from),c=a.from-l.from;if(a.name=="Blockquote"&&(i=/^ *>( ?)/.exec(l.text.slice(c))))n.push(new mV(a,c,c+i[0].length,"",i[1],">",null));else if(a.name=="ListItem"&&a.parent.name=="OrderedList"&&(i=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=i[3],d=i[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),n.push(new mV(a.parent,c,c+d,i[1],u,i[2],a))}else if(a.name=="ListItem"&&a.parent.name=="BulletList"&&(i=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=i[4],d=i[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=i[2];i[3]&&(f+=i[3].replace(/[xX]/," ")),n.push(new mV(a.parent,c,c+d,i[1],u,f,a))}}return n}function aZe(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function gV(e,t,r,n=0){for(let s=-1,a=e;;){if(a.name=="ListItem"){let l=aZe(a,t),c=+l[2];if(s>=0){if(c!=s+1)return;r.push({from:a.from+l[1].length,to:a.from+l[0].length,insert:String(s+2+n)})}s=c}let i=a.nextSibling;if(!i)break;a=i}}function Bue(e,t){let r=/^[ \t]*/.exec(e)[0].length;if(!r||t.facet(BE)!=" ")return e;let n=Ep(e,4,r),s="";for(let a=n;a>0;)a>=4?(s+=" ",a-=4):(s+=" ",a--);return s+e.slice(r)}const iZe=(e={})=>({state:t,dispatch:r})=>{let n=Aa(t),{doc:s}=t,a=null,i=t.changeByRange(l=>{if(!l.empty||!pS.isActiveAt(t,l.from,-1)&&!pS.isActiveAt(t,l.from,1))return a={range:l};let c=l.from,u=s.lineAt(c),d=sZe(n.resolveInner(c,-1),s);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return a={range:l};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return a={range:l};let h=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&h){let x=f.node.firstChild,w=f.node.getChild("ListItem","ListItem");if(x.to>=c||w&&w.to<c||u.from>0&&!/[^\s>]/.test(s.lineAt(u.from-1).text)||e.nonTightLists===!1){let S=d.length>1?d[d.length-2]:null,k,_="";S&&S.item?(k=u.from+S.from,_=S.marker(s,1)):k=u.from+(S?S.to:0);let E=[{from:k,to:c,insert:_}];return f.node.name=="OrderedList"&&gV(f.item,s,E,-2),S&&S.node.name=="OrderedList"&&gV(S.item,s,E),{range:nt.cursor(k+_.length),changes:E}}else{let S=Tke(d,t,u);return{range:nt.cursor(c+S.length+1),changes:{from:u.from,insert:S+t.lineBreak}}}}if(f.node.name=="Blockquote"&&h&&u.from){let x=s.lineAt(u.from-1),w=/>\s*$/.exec(x.text);if(w&&w.index==f.from){let S=t.changes([{from:x.from+w.index,to:x.to},{from:u.from+f.from,to:u.to}]);return{range:l.map(S),changes:S}}}let p=[];f.node.name=="OrderedList"&&gV(f.item,s,p);let m=f.item&&f.item.from<u.from,g="";if(!m||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=f.to)for(let x=0,w=d.length-1;x<=w;x++)g+=x==w&&!m?d[x].marker(s,1):d[x].blank(x<w?Ep(u.text,4,d[x+1].from)-g.length:null);let y=c;for(;y>u.from&&/\s/.test(u.text.charAt(y-u.from-1));)y--;return g=Bue(g,t),DQt(f.node,t.doc)&&(g=Tke(d,t,u)+t.lineBreak+g),p.push({from:y,to:c,insert:t.lineBreak+g}),{range:nt.cursor(y+g.length+1),changes:p}});return a?!1:(r(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0)},oZe=iZe();function jke(e){return e.name=="QuoteMark"||e.name=="ListMark"}function DQt(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let r=e.firstChild,n=e.getChild("ListItem","ListItem");if(!n)return!1;let s=t.lineAt(r.to),a=t.lineAt(n.from),i=/^[\s>]*$/.test(s.text);return s.number+(i?0:1)<a.number}function Tke(e,t,r){let n="";for(let s=0,a=e.length-2;s<=a;s++)n+=e[s].blank(s<a?Ep(r.text,4,e[s+1].from)-n.length:null,s<a);return Bue(n,t)}function LQt(e,t){let r=e.resolveInner(t,-1),n=t;jke(r)&&(n=r.from,r=r.parent);for(let s;s=r.childBefore(n);)if(jke(s))n=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")r=s.lastChild,n=r.to;else break;return r}const lZe=({state:e,dispatch:t})=>{let r=Aa(e),n=null,s=e.changeByRange(a=>{let i=a.from,{doc:l}=e;if(a.empty&&pS.isActiveAt(e,a.from)){let c=l.lineAt(i),u=sZe(LQt(r,i),l);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(i-c.from>f&&!/\S/.test(c.text.slice(f,i-c.from)))return{range:nt.cursor(c.from+f),changes:{from:c.from+f,to:i}};if(i-c.from==f&&(!d.item||c.from<=d.item.from||!/\S/.test(c.text.slice(0,d.to)))){let h=c.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(c.text.slice(d.from,d.to))){let p=d.blank(Ep(c.text,4,d.to)-Ep(c.text,4,d.from));return h==c.from&&(p=Bue(p,e)),{range:nt.cursor(h+p.length),changes:{from:h,to:c.from+d.to,insert:p}}}if(h<i)return{range:nt.cursor(h),changes:{from:h,to:i}}}}}return n={range:a}});return n?!1:(t(e.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},cZe=[{key:"Enter",run:oZe},{key:"Backspace",run:lZe}],uZe=KGe({matchClosingTags:!1});function Uue(e={}){let{codeLanguages:t,defaultCodeLanguage:r,addKeymap:n=!0,base:{parser:s}=nZe,completeHTMLTags:a=!0,pasteURLAsLink:i=!0,htmlTagLanguage:l=uZe}=e;if(!(s instanceof LF))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[l.support,RQt],d;i&&u.push(dZe),r instanceof dS?(u.push(r.support),d=r.language):r&&(d=r);let f=t||d?MQt(t,d):void 0;c.push(lqt({codeParser:f,htmlParser:l.language.parser})),n&&u.push(Lp.high(zE.of(cZe)));let h=zue(s.configure(c));return a&&u.push(h.data.of({autocomplete:$Qt})),new dS(h,u)}function $Qt(e){let{state:t,pos:r}=e,n=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(r-25,r));if(!n)return null;let s=Aa(t).resolveInner(r,-1);for(;s&&!s.type.isTop;){if(s.name=="CodeBlock"||s.name=="FencedCode"||s.name=="ProcessingInstructionBlock"||s.name=="CommentBlock"||s.name=="Link"||s.name=="Image")return null;s=s.parent}return{from:r-n[0].length,to:r,options:FQt(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let yV=null;function FQt(){if(yV)return yV;let e=WGe(new vue(zn.create({extensions:uZe}),0,!0));return yV=e?e.options:[]}const zQt=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,dZe=ft.domEventHandlers({paste:(e,t)=>{var r;let{main:n}=t.state.selection;if(n.empty)return!1;let s=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!pS.isActiveAt(t.state,n.from,1)))return!1;let a=Aa(t.state),i=!1;return a.iterate({from:n.from,to:n.to,enter:l=>{(l.from>n.from||zQt.test(l.name))&&(i=!0)},leave:l=>{l.to<n.to&&(i=!0)}}),i?!1:(t.dispatch({changes:[{from:n.from,insert:"["},{from:n.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),BQt=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:nZe,deleteMarkupBackward:lZe,insertNewlineContinueMarkup:oZe,insertNewlineContinueMarkupCommand:iZe,markdown:Uue,markdownKeymap:cZe,markdownLanguage:pS,pasteURLAsLink:dZe},Symbol.toStringTag,{value:"Module"}));function pt(e){return new dS(mue.define(e))}function nb(e){return Ke(()=>import("./index-BvxNdF_C.js"),__vite__mapDeps([0,1]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const fZe=[Ye.of({name:"C",extensions:["c","h","ino"],load(){return Ke(()=>import("./index-U_w3DmC7.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),Ye.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return Ke(()=>import("./index-U_w3DmC7.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),Ye.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return nb("Cassandra")}}),Ye.of({name:"CSS",extensions:["css"],load(){return Ke(()=>Promise.resolve().then(()=>$Ht),void 0,import.meta.url).then(e=>e.css())}}),Ye.of({name:"Go",extensions:["go"],load(){return Ke(()=>import("./index-BDLciS-I.js"),__vite__mapDeps([3,1]),import.meta.url).then(e=>e.go())}}),Ye.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return Ke(()=>Promise.resolve().then(()=>NQt),void 0,import.meta.url).then(e=>e.html())}}),Ye.of({name:"Java",extensions:["java"],load(){return Ke(()=>import("./index-B-kc6Ug0.js"),__vite__mapDeps([4,1]),import.meta.url).then(e=>e.java())}}),Ye.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return Ke(()=>Promise.resolve().then(()=>J2),void 0,import.meta.url).then(e=>e.javascript())}}),Ye.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return Ke(()=>import("./index-wzDIgXIr.js"),__vite__mapDeps([5,1]),import.meta.url).then(e=>e.jinja())}}),Ye.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return Ke(()=>Promise.resolve().then(()=>KUt),void 0,import.meta.url).then(e=>e.json())}}),Ye.of({name:"JSX",extensions:["jsx"],load(){return Ke(()=>Promise.resolve().then(()=>J2),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ye.of({name:"LESS",extensions:["less"],load(){return Ke(()=>import("./index-C_LW8eZR.js"),__vite__mapDeps([6,1]),import.meta.url).then(e=>e.less())}}),Ye.of({name:"Liquid",extensions:["liquid"],load(){return Ke(()=>import("./index-D4Itb5pT.js"),__vite__mapDeps([7,1]),import.meta.url).then(e=>e.liquid())}}),Ye.of({name:"MariaDB SQL",load(){return nb("MariaSQL")}}),Ye.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return Ke(()=>Promise.resolve().then(()=>BQt),void 0,import.meta.url).then(e=>e.markdown())}}),Ye.of({name:"MS SQL",load(){return nb("MSSQL")}}),Ye.of({name:"MySQL",load(){return nb("MySQL")}}),Ye.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return Ke(()=>import("./index-CAHAtm4d.js"),__vite__mapDeps([8,1]),import.meta.url).then(e=>e.php())}}),Ye.of({name:"PLSQL",extensions:["pls"],load(){return nb("PLSQL")}}),Ye.of({name:"PostgreSQL",load(){return nb("PostgreSQL")}}),Ye.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return Ke(()=>import("./index-BJdrZl7A.js"),__vite__mapDeps([9,1]),import.meta.url).then(e=>e.python())}}),Ye.of({name:"Rust",extensions:["rs"],load(){return Ke(()=>import("./index-B2hrd-_b.js"),__vite__mapDeps([10,1]),import.meta.url).then(e=>e.rust())}}),Ye.of({name:"Sass",extensions:["sass"],load(){return Ke(()=>import("./index-BiY2wW_y.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass({indented:!0}))}}),Ye.of({name:"SCSS",extensions:["scss"],load(){return Ke(()=>import("./index-BiY2wW_y.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass())}}),Ye.of({name:"SQL",extensions:["sql"],load(){return nb("StandardSQL")}}),Ye.of({name:"SQLite",load(){return nb("SQLite")}}),Ye.of({name:"TSX",extensions:["tsx"],load(){return Ke(()=>Promise.resolve().then(()=>J2),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Ye.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return Ke(()=>Promise.resolve().then(()=>J2),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ye.of({name:"WebAssembly",extensions:["wat","wast"],load(){return Ke(()=>import("./index-D0uOX4X4.js"),__vite__mapDeps([12,1]),import.meta.url).then(e=>e.wast())}}),Ye.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return Ke(()=>import("./index-CV69fQaz.js"),__vite__mapDeps([13,1]),import.meta.url).then(e=>e.xml())}}),Ye.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return Ke(()=>import("./index-Z0ge7D1k.js"),__vite__mapDeps([14,1]),import.meta.url).then(e=>e.yaml())}}),Ye.of({name:"APL",extensions:["dyalog","apl"],load(){return Ke(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>pt(e.apl))}}),Ye.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return Ke(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>pt(e.asciiArmor))}}),Ye.of({name:"ASN.1",extensions:["asn","asn1"],load(){return Ke(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>pt(e.asn1({})))}}),Ye.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return Ke(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>pt(e.asterisk))}}),Ye.of({name:"Brainfuck",extensions:["b","bf"],load(){return Ke(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>pt(e.brainfuck))}}),Ye.of({name:"Cobol",extensions:["cob","cpy"],load(){return Ke(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>pt(e.cobol))}}),Ye.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.csharp))}}),Ye.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return Ke(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>pt(e.clojure))}}),Ye.of({name:"ClojureScript",extensions:["cljs"],load(){return Ke(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>pt(e.clojure))}}),Ye.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return Ke(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>pt(e.gss))}}),Ye.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return Ke(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>pt(e.cmake))}}),Ye.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return Ke(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>pt(e.coffeeScript))}}),Ye.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return Ke(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>pt(e.commonLisp))}}),Ye.of({name:"Cypher",extensions:["cyp","cypher"],load(){return Ke(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>pt(e.cypher))}}),Ye.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return Ke(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>pt(e.cython))}}),Ye.of({name:"Crystal",extensions:["cr"],load(){return Ke(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>pt(e.crystal))}}),Ye.of({name:"D",extensions:["d"],load(){return Ke(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>pt(e.d))}}),Ye.of({name:"Dart",extensions:["dart"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.dart))}}),Ye.of({name:"diff",extensions:["diff","patch"],load(){return Ke(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>pt(e.diff))}}),Ye.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return Ke(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([15,16]),import.meta.url).then(e=>pt(e.dockerFile))}}),Ye.of({name:"DTD",extensions:["dtd"],load(){return Ke(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>pt(e.dtd))}}),Ye.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return Ke(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>pt(e.dylan))}}),Ye.of({name:"EBNF",load(){return Ke(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>pt(e.ebnf))}}),Ye.of({name:"ECL",extensions:["ecl"],load(){return Ke(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>pt(e.ecl))}}),Ye.of({name:"edn",extensions:["edn"],load(){return Ke(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>pt(e.clojure))}}),Ye.of({name:"Eiffel",extensions:["e"],load(){return Ke(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>pt(e.eiffel))}}),Ye.of({name:"Elm",extensions:["elm"],load(){return Ke(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>pt(e.elm))}}),Ye.of({name:"Erlang",extensions:["erl"],load(){return Ke(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>pt(e.erlang))}}),Ye.of({name:"Esper",load(){return Ke(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>pt(e.esper))}}),Ye.of({name:"Factor",extensions:["factor"],load(){return Ke(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([17,16]),import.meta.url).then(e=>pt(e.factor))}}),Ye.of({name:"FCL",load(){return Ke(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>pt(e.fcl))}}),Ye.of({name:"Forth",extensions:["forth","fth","4th"],load(){return Ke(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>pt(e.forth))}}),Ye.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return Ke(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>pt(e.fortran))}}),Ye.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return Ke(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>pt(e.fSharp))}}),Ye.of({name:"Gas",extensions:["s"],load(){return Ke(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>pt(e.gas))}}),Ye.of({name:"Gherkin",extensions:["feature"],load(){return Ke(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>pt(e.gherkin))}}),Ye.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return Ke(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>pt(e.groovy))}}),Ye.of({name:"Haskell",extensions:["hs"],load(){return Ke(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>pt(e.haskell))}}),Ye.of({name:"Haxe",extensions:["hx"],load(){return Ke(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>pt(e.haxe))}}),Ye.of({name:"HXML",extensions:["hxml"],load(){return Ke(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>pt(e.hxml))}}),Ye.of({name:"HTTP",load(){return Ke(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>pt(e.http))}}),Ye.of({name:"IDL",extensions:["pro"],load(){return Ke(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>pt(e.idl))}}),Ye.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return Ke(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>pt(e.jsonld))}}),Ye.of({name:"Julia",extensions:["jl"],load(){return Ke(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>pt(e.julia))}}),Ye.of({name:"Kotlin",extensions:["kt","kts"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.kotlin))}}),Ye.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return Ke(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>pt(e.liveScript))}}),Ye.of({name:"Lua",extensions:["lua"],load(){return Ke(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>pt(e.lua))}}),Ye.of({name:"mIRC",extensions:["mrc"],load(){return Ke(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>pt(e.mirc))}}),Ye.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return Ke(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>pt(e.mathematica))}}),Ye.of({name:"Modelica",extensions:["mo"],load(){return Ke(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>pt(e.modelica))}}),Ye.of({name:"MUMPS",extensions:["mps"],load(){return Ke(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>pt(e.mumps))}}),Ye.of({name:"Mbox",extensions:["mbox"],load(){return Ke(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>pt(e.mbox))}}),Ye.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return Ke(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>pt(e.nginx))}}),Ye.of({name:"NSIS",extensions:["nsh","nsi"],load(){return Ke(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([18,16]),import.meta.url).then(e=>pt(e.nsis))}}),Ye.of({name:"NTriples",extensions:["nt","nq"],load(){return Ke(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>pt(e.ntriples))}}),Ye.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.objectiveC))}}),Ye.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.objectiveCpp))}}),Ye.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return Ke(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>pt(e.oCaml))}}),Ye.of({name:"Octave",extensions:["m"],load(){return Ke(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>pt(e.octave))}}),Ye.of({name:"Oz",extensions:["oz"],load(){return Ke(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>pt(e.oz))}}),Ye.of({name:"Pascal",extensions:["p","pas"],load(){return Ke(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>pt(e.pascal))}}),Ye.of({name:"Perl",extensions:["pl","pm"],load(){return Ke(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>pt(e.perl))}}),Ye.of({name:"Pig",extensions:["pig"],load(){return Ke(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>pt(e.pig))}}),Ye.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return Ke(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>pt(e.powerShell))}}),Ye.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return Ke(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>pt(e.properties))}}),Ye.of({name:"ProtoBuf",extensions:["proto"],load(){return Ke(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>pt(e.protobuf))}}),Ye.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return Ke(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([19,20]),import.meta.url).then(e=>pt(e.pug))}}),Ye.of({name:"Puppet",extensions:["pp"],load(){return Ke(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>pt(e.puppet))}}),Ye.of({name:"Q",extensions:["q"],load(){return Ke(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>pt(e.q))}}),Ye.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return Ke(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>pt(e.r))}}),Ye.of({name:"RPM Changes",load(){return Ke(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>pt(e.rpmChanges))}}),Ye.of({name:"RPM Spec",extensions:["spec"],load(){return Ke(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>pt(e.rpmSpec))}}),Ye.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return Ke(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>pt(e.ruby))}}),Ye.of({name:"SAS",extensions:["sas"],load(){return Ke(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>pt(e.sas))}}),Ye.of({name:"Scala",extensions:["scala"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.scala))}}),Ye.of({name:"Scheme",extensions:["scm","ss"],load(){return Ke(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>pt(e.scheme))}}),Ye.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return Ke(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>pt(e.shell))}}),Ye.of({name:"Sieve",extensions:["siv","sieve"],load(){return Ke(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>pt(e.sieve))}}),Ye.of({name:"Smalltalk",extensions:["st"],load(){return Ke(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>pt(e.smalltalk))}}),Ye.of({name:"Solr",load(){return Ke(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>pt(e.solr))}}),Ye.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return Ke(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>pt(e.sml))}}),Ye.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return Ke(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>pt(e.sparql))}}),Ye.of({name:"Spreadsheet",alias:["excel","formula"],load(){return Ke(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>pt(e.spreadsheet))}}),Ye.of({name:"Squirrel",extensions:["nut"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.squirrel))}}),Ye.of({name:"Stylus",extensions:["styl"],load(){return Ke(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>pt(e.stylus))}}),Ye.of({name:"Swift",extensions:["swift"],load(){return Ke(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>pt(e.swift))}}),Ye.of({name:"sTeX",load(){return Ke(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>pt(e.stex))}}),Ye.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return Ke(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>pt(e.stex))}}),Ye.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return Ke(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>pt(e.verilog))}}),Ye.of({name:"Tcl",extensions:["tcl"],load(){return Ke(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>pt(e.tcl))}}),Ye.of({name:"Textile",extensions:["textile"],load(){return Ke(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>pt(e.textile))}}),Ye.of({name:"TiddlyWiki",load(){return Ke(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>pt(e.tiddlyWiki))}}),Ye.of({name:"Tiki wiki",load(){return Ke(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>pt(e.tiki))}}),Ye.of({name:"TOML",extensions:["toml"],load(){return Ke(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>pt(e.toml))}}),Ye.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return Ke(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>pt(e.troff))}}),Ye.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return Ke(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>pt(e.ttcn))}}),Ye.of({name:"TTCN_CFG",extensions:["cfg"],load(){return Ke(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>pt(e.ttcnCfg))}}),Ye.of({name:"Turtle",extensions:["ttl"],load(){return Ke(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>pt(e.turtle))}}),Ye.of({name:"Web IDL",extensions:["webidl"],load(){return Ke(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>pt(e.webIDL))}}),Ye.of({name:"VB.NET",extensions:["vb"],load(){return Ke(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>pt(e.vb))}}),Ye.of({name:"VBScript",extensions:["vbs"],load(){return Ke(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>pt(e.vbScript))}}),Ye.of({name:"Velocity",extensions:["vtl"],load(){return Ke(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>pt(e.velocity))}}),Ye.of({name:"Verilog",extensions:["v"],load(){return Ke(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>pt(e.verilog))}}),Ye.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return Ke(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>pt(e.vhdl))}}),Ye.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return Ke(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>pt(e.xQuery))}}),Ye.of({name:"Yacas",extensions:["ys"],load(){return Ke(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>pt(e.yacas))}}),Ye.of({name:"Z80",extensions:["z80"],load(){return Ke(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>pt(e.z80))}}),Ye.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return Ke(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>pt(e.mscgen))}}),Ye.of({name:"Xù",extensions:["xu"],load(){return Ke(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>pt(e.xu))}}),Ye.of({name:"MsGenny",extensions:["msgenny"],load(){return Ke(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>pt(e.msgenny))}}),Ye.of({name:"Vue",extensions:["vue"],load(){return Ke(()=>import("./index-jdAnP8zL.js"),__vite__mapDeps([21,1]),import.meta.url).then(e=>e.vue())}}),Ye.of({name:"Angular Template",load(){return Ke(()=>import("./index-DwPIujMA.js"),__vite__mapDeps([22,1]),import.meta.url).then(e=>e.angular())}})];function kx(){return kx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},kx.apply(null,arguments)}var UQt=e=>{var{theme:t,settings:r={},styles:n=[]}=e,s={".cm-gutters":{}},a={};r.background&&(a.backgroundColor=r.background),r.backgroundImage&&(a.backgroundImage=r.backgroundImage),r.foreground&&(a.color=r.foreground),r.fontSize&&(a.fontSize=r.fontSize),(r.background||r.foreground)&&(s["&"]=a),r.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:r.fontFamily}),r.gutterBackground&&(s[".cm-gutters"].backgroundColor=r.gutterBackground),r.gutterForeground&&(s[".cm-gutters"].color=r.gutterForeground),r.gutterBorder&&(s[".cm-gutters"].borderRightColor=r.gutterBorder),r.caret&&(s[".cm-content"]={caretColor:r.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:r.caret});var i={};r.gutterActiveForeground&&(i.color=r.gutterActiveForeground),r.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:r.lineHighlight},i.backgroundColor=r.lineHighlight),s[".cm-activeLineGutter"]=i,r.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:r.selection+" !important"}),r.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:r.selectionMatch});var l=ft.theme(s,{dark:t==="dark"}),c=$p.define(n),u=[l,Yx(c)];return u},VQt={background:"#282a36",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"#282a36",gutterForeground:"#6D8A88",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},qQt=[{tag:ne.comment,color:"#6272a4"},{tag:ne.string,color:"#f1fa8c"},{tag:ne.atom,color:"#bd93f9"},{tag:ne.meta,color:"#f8f8f2"},{tag:[ne.keyword,ne.operator,ne.tagName],color:"#ff79c6"},{tag:[ne.function(ne.propertyName),ne.propertyName],color:"#66d9ef"},{tag:[ne.definition(ne.variableName),ne.function(ne.variableName),ne.className,ne.attributeName],color:"#50fa7b"},{tag:ne.atom,color:"#bd93f9"}],VE=e=>{var{theme:t="dark",settings:r={},styles:n=[]}=e||{};return UQt({theme:t,settings:kx({},VQt,r),styles:[...qQt,...n]})};VE();function Vue(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}const HQt=e=>{let{state:t}=e,r=t.doc.lineAt(t.selection.main.from),n=Hue(e.state,r.from);return n.line?QQt(e):n.block?GQt(e):!1};function que(e,t){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let s=e(t,r);return s?(n(r.update(s)),!0):!1}}const QQt=que(XQt,0),WQt=que(hZe,0),GQt=que((e,t)=>hZe(e,t,YQt(t)),0);function Hue(e,t){let r=e.languageDataAt("commentTokens",t,1);return r.length?r[0]:{}}const Lj=50;function ZQt(e,{open:t,close:r},n,s){let a=e.sliceDoc(n-Lj,n),i=e.sliceDoc(s,s+Lj),l=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(i)[0].length,u=a.length-l;if(a.slice(u-t.length,u)==t&&i.slice(c,c+r.length)==r)return{open:{pos:n-l,margin:l&&1},close:{pos:s+c,margin:c&&1}};let d,f;s-n<=2*Lj?d=f=e.sliceDoc(n,s):(d=e.sliceDoc(n,n+Lj),f=e.sliceDoc(s-Lj,s));let h=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(f)[0].length,m=f.length-p-r.length;return d.slice(h,h+t.length)==t&&f.slice(m,m+r.length)==r?{open:{pos:n+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:s-p-r.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function YQt(e){let t=[];for(let r of e.selection.ranges){let n=e.doc.lineAt(r.from),s=r.to<=n.to?n:e.doc.lineAt(r.to);s.from>n.from&&s.from==r.to&&(s=r.to==n.to+1?n:e.doc.lineAt(r.to-1));let a=t.length-1;a>=0&&t[a].to>n.from?t[a].to=s.to:t.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return t}function hZe(e,t,r=t.selection.ranges){let n=r.map(a=>Hue(t,a.from).block);if(!n.every(a=>a))return null;let s=r.map((a,i)=>ZQt(t,n[i],a.from,a.to));if(e!=2&&!s.every(a=>a))return{changes:t.changes(r.map((a,i)=>s[i]?[]:[{from:a.from,insert:n[i].open+" "},{from:a.to,insert:" "+n[i].close}]))};if(e!=1&&s.some(a=>a)){let a=[];for(let i=0,l;i<s.length;i++)if(l=s[i]){let c=n[i],{open:u,close:d}=l;a.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+c.close.length})}return{changes:a}}return null}function XQt(e,t,r=t.selection.ranges){let n=[],s=-1;e:for(let{from:a,to:i}of r){let l=n.length,c=1e9,u;for(let d=a;d<=i;){let f=t.doc.lineAt(d);if(u==null&&(u=Hue(t,f.from).line,!u))continue e;if(f.from>s&&(a==i||i>f.from)){s=f.from;let h=/^\s*/.exec(f.text)[0].length,p=h==f.length,m=f.text.slice(h,h+u.length)==u?h:-1;h<f.text.length&&h<c&&(c=h),n.push({line:f,comment:m,token:u,indent:h,empty:p,single:!1})}d=f.to+1}if(c<1e9)for(let d=l;d<n.length;d++)n[d].indent<n[d].line.text.length&&(n[d].indent=c);n.length==l+1&&(n[l].single=!0)}if(e!=2&&n.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:l,token:c,indent:u,empty:d,single:f}of n)(f||!d)&&a.push({from:l.from+u,insert:c+" "});let i=t.changes(a);return{changes:i,selection:t.selection.map(i,1)}}else if(e!=1&&n.some(a=>a.comment>=0)){let a=[];for(let{line:i,comment:l,token:c}of n)if(l>=0){let u=i.from+l,d=u+c.length;i.text[d-i.from]==" "&&d++,a.push({from:u,to:d})}return{changes:a}}return null}const tse=vg.define(),KQt=vg.define(),JQt=Kt.define(),pZe=Kt.define({combine(e){return bg(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,r)=>(n,s)=>t(n,s)||r(n,s)})}}),mZe=Oo.define({create(){return Pm.empty},update(e,t){let r=t.state.facet(pZe),n=t.annotation(tse);if(n){let c=zu.fromTransaction(t,n.selection),u=n.side,d=u==0?e.undone:e.done;return c?d=Q3(d,d.length,r.minDepth,c):d=vZe(d,t.startState.selection),new Pm(u==0?n.rest:d,u==0?d:n.rest)}let s=t.annotation(KQt);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(Mo.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=zu.fromTransaction(t),i=t.annotation(Mo.time),l=t.annotation(Mo.userEvent);return a?e=e.addChanges(a,i,l,r,t):t.selection&&(e=e.addSelection(t.startState.selection,i,l,r.newGroupDelay)),(s=="full"||s=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new Pm(e.done.map(zu.fromJSON),e.undone.map(zu.fromJSON))}});function eWt(e={}){return[mZe,pZe.of(e),ft.domEventHandlers({beforeinput(t,r){let n=t.inputType=="historyUndo"?gZe:t.inputType=="historyRedo"?rse:null;return n?(t.preventDefault(),n(r)):!1}})]}function $F(e,t){return function({state:r,dispatch:n}){if(!t&&r.readOnly)return!1;let s=r.field(mZe,!1);if(!s)return!1;let a=s.pop(e,r,t);return a?(n(a),!0):!1}}const gZe=$F(0,!1),rse=$F(1,!1),tWt=$F(0,!0),rWt=$F(1,!0);class zu{constructor(t,r,n,s,a){this.changes=t,this.effects=r,this.mapped=n,this.startSelection=s,this.selectionsAfter=a}setSelAfter(t){return new zu(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,r,n;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new zu(t.changes&&Io.fromJSON(t.changes),[],t.mapped&&Wm.fromJSON(t.mapped),t.startSelection&&nt.fromJSON(t.startSelection),t.selectionsAfter.map(nt.fromJSON))}static fromTransaction(t,r){let n=ch;for(let s of t.startState.facet(JQt)){let a=s(t);a.length&&(n=n.concat(a))}return!n.length&&t.changes.empty?null:new zu(t.changes.invert(t.startState.doc),n,void 0,r||t.startState.selection,ch)}static selection(t){return new zu(void 0,ch,void 0,void 0,t)}}function Q3(e,t,r,n){let s=t+1>r+20?t-r-1:0,a=e.slice(s,t);return a.push(n),a}function nWt(e,t){let r=[],n=!1;return e.iterChangedRanges((s,a)=>r.push(s,a)),t.iterChangedRanges((s,a,i,l)=>{for(let c=0;c<r.length;){let u=r[c++],d=r[c++];l>=u&&i<=d&&(n=!0)}}),n}function sWt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((r,n)=>r.empty!=t.ranges[n].empty).length===0}function yZe(e,t){return e.length?t.length?e.concat(t):e:t}const ch=[],aWt=200;function vZe(e,t){if(e.length){let r=e[e.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-aWt));return n.length&&n[n.length-1].eq(t)?e:(n.push(t),Q3(e,e.length-1,1e9,r.setSelAfter(n)))}else return[zu.selection([t])]}function iWt(e){let t=e[e.length-1],r=e.slice();return r[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),r}function vV(e,t){if(!e.length)return e;let r=e.length,n=ch;for(;r;){let s=oWt(e[r-1],t,n);if(s.changes&&!s.changes.empty||s.effects.length){let a=e.slice(0,r);return a[r-1]=s,a}else t=s.mapped,r--,n=s.selectionsAfter}return n.length?[zu.selection(n)]:ch}function oWt(e,t,r){let n=yZe(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):ch,r);if(!e.changes)return zu.selection(n);let s=e.changes.map(t),a=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(a):a;return new zu(s,rn.mapEffects(e.effects,t),i,e.startSelection.map(a),n)}const lWt=/^(input\.type|delete)($|\.)/;class Pm{constructor(t,r,n=0,s=void 0){this.done=t,this.undone=r,this.prevTime=n,this.prevUserEvent=s}isolate(){return this.prevTime?new Pm(this.done,this.undone):this}addChanges(t,r,n,s,a){let i=this.done,l=i[i.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!n||lWt.test(n))&&(!l.selectionsAfter.length&&r-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,nWt(l.changes,t.changes))||n=="input.type.compose")?i=Q3(i,i.length-1,s.minDepth,new zu(t.changes.compose(l.changes),yZe(rn.mapEffects(t.effects,l.changes),l.effects),l.mapped,l.startSelection,ch)):i=Q3(i,i.length,s.minDepth,t),new Pm(i,ch,r,n)}addSelection(t,r,n,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:ch;return a.length>0&&r-this.prevTime<s&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&sWt(a[a.length-1],t)?this:new Pm(vZe(this.done,t),this.undone,r,n)}addMapping(t){return new Pm(vV(this.done,t),vV(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,r,n){let s=t==0?this.done:this.undone;if(s.length==0)return null;let a=s[s.length-1],i=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):r.selection);if(n&&a.selectionsAfter.length)return r.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:tse.of({side:t,rest:iWt(s),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let l=s.length==1?ch:s.slice(0,s.length-1);return a.mapped&&(l=vV(l,a.mapped)),r.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:tse.of({side:t,rest:l,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Pm.empty=new Pm(ch,ch);const cWt=[{key:"Mod-z",run:gZe,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:rse,preventDefault:!0},{linux:"Ctrl-Shift-z",run:rse,preventDefault:!0},{key:"Mod-u",run:tWt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:rWt,preventDefault:!0}];function qE(e,t){return nt.create(e.ranges.map(t),e.mainIndex)}function Fp(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function zp({state:e,dispatch:t},r){let n=qE(e.selection,r);return n.eq(e.selection,!0)?!1:(t(Fp(e,n)),!0)}function FF(e,t){return nt.cursor(t?e.to:e.from)}function bZe(e,t){return zp(e,r=>r.empty?e.moveByChar(r,t):FF(r,t))}function Ec(e){return e.textDirectionAt(e.state.selection.main.head)==Da.LTR}const xZe=e=>bZe(e,!Ec(e)),wZe=e=>bZe(e,Ec(e));function SZe(e,t){return zp(e,r=>r.empty?e.moveByGroup(r,t):FF(r,t))}const uWt=e=>SZe(e,!Ec(e)),dWt=e=>SZe(e,Ec(e));function fWt(e,t,r){if(t.type.prop(r))return!0;let n=t.to-t.from;return n&&(n>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function zF(e,t,r){let n=Aa(e).resolveInner(t.head),s=r?hn.closedBy:hn.openedBy;for(let c=t.head;;){let u=r?n.childAfter(c):n.childBefore(c);if(!u)break;fWt(e,u,s)?n=u:c=r?u.to:u.from}let a=n.type.prop(s),i,l;return a&&(i=r?Rm(e,n.from,1):Rm(e,n.to,-1))&&i.matched?l=r?i.end.to:i.end.from:l=r?n.to:n.from,nt.cursor(l,r?-1:1)}const hWt=e=>zp(e,t=>zF(e.state,t,!Ec(e))),pWt=e=>zp(e,t=>zF(e.state,t,Ec(e)));function OZe(e,t){return zp(e,r=>{if(!r.empty)return FF(r,t);let n=e.moveVertically(r,t);return n.head!=r.head?n:e.moveToLineBoundary(r,t)})}const kZe=e=>OZe(e,!1),_Ze=e=>OZe(e,!0);function EZe(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,n=0,s;if(t){for(let a of e.state.facet(ft.scrollMargins)){let i=a(e);i?.top&&(r=Math.max(i?.top,r)),i?.bottom&&(n=Math.max(i?.bottom,n))}s=e.scrollDOM.clientHeight-r-n}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:n,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function CZe(e,t){let r=EZe(e),{state:n}=e,s=qE(n.selection,i=>i.empty?e.moveVertically(i,t,r.height):FF(i,t));if(s.eq(n.selection))return!1;let a;if(r.selfScroll){let i=e.coordsAtPos(n.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),c=l.top+r.marginTop,u=l.bottom-r.marginBottom;i&&i.top>c&&i.bottom<u&&(a=ft.scrollIntoView(s.main.head,{y:"start",yMargin:i.top-c}))}return e.dispatch(Fp(n,s),{effects:a}),!0}const Nke=e=>CZe(e,!1),nse=e=>CZe(e,!0);function Xx(e,t,r){let n=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,r);if(s.head==t.head&&s.head!=(r?n.to:n.from)&&(s=e.moveToLineBoundary(t,r,!1)),!r&&s.head==n.from&&n.length){let a=/^\s*/.exec(e.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;a&&t.head!=n.from+a&&(s=nt.cursor(n.from+a))}return s}const mWt=e=>zp(e,t=>Xx(e,t,!0)),gWt=e=>zp(e,t=>Xx(e,t,!1)),yWt=e=>zp(e,t=>Xx(e,t,!Ec(e))),vWt=e=>zp(e,t=>Xx(e,t,Ec(e))),bWt=e=>zp(e,t=>nt.cursor(e.lineBlockAt(t.head).from,1)),xWt=e=>zp(e,t=>nt.cursor(e.lineBlockAt(t.head).to,-1));function wWt(e,t,r){let n=!1,s=qE(e.selection,a=>{let i=Rm(e,a.head,-1)||Rm(e,a.head,1)||a.head>0&&Rm(e,a.head-1,1)||a.head<e.doc.length&&Rm(e,a.head+1,-1);if(!i||!i.end)return a;n=!0;let l=i.start.from==a.head?i.end.to:i.end.from;return nt.cursor(l)});return n?(t(Fp(e,s)),!0):!1}const SWt=({state:e,dispatch:t})=>wWt(e,t);function Lh(e,t){let r=qE(e.state.selection,n=>{let s=t(n);return nt.range(n.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(Fp(e.state,r)),!0)}function jZe(e,t){return Lh(e,r=>e.moveByChar(r,t))}const TZe=e=>jZe(e,!Ec(e)),NZe=e=>jZe(e,Ec(e));function AZe(e,t){return Lh(e,r=>e.moveByGroup(r,t))}const OWt=e=>AZe(e,!Ec(e)),kWt=e=>AZe(e,Ec(e)),_Wt=e=>Lh(e,t=>zF(e.state,t,!Ec(e))),EWt=e=>Lh(e,t=>zF(e.state,t,Ec(e)));function IZe(e,t){return Lh(e,r=>e.moveVertically(r,t))}const RZe=e=>IZe(e,!1),PZe=e=>IZe(e,!0);function MZe(e,t){return Lh(e,r=>e.moveVertically(r,t,EZe(e).height))}const Ake=e=>MZe(e,!1),Ike=e=>MZe(e,!0),CWt=e=>Lh(e,t=>Xx(e,t,!0)),jWt=e=>Lh(e,t=>Xx(e,t,!1)),TWt=e=>Lh(e,t=>Xx(e,t,!Ec(e))),NWt=e=>Lh(e,t=>Xx(e,t,Ec(e))),AWt=e=>Lh(e,t=>nt.cursor(e.lineBlockAt(t.head).from)),IWt=e=>Lh(e,t=>nt.cursor(e.lineBlockAt(t.head).to)),Rke=({state:e,dispatch:t})=>(t(Fp(e,{anchor:0})),!0),Pke=({state:e,dispatch:t})=>(t(Fp(e,{anchor:e.doc.length})),!0),Mke=({state:e,dispatch:t})=>(t(Fp(e,{anchor:e.selection.main.anchor,head:0})),!0),Dke=({state:e,dispatch:t})=>(t(Fp(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),RWt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),PWt=({state:e,dispatch:t})=>{let r=BF(e).map(({from:n,to:s})=>nt.range(n,Math.min(s+1,e.doc.length)));return t(e.update({selection:nt.create(r),userEvent:"select"})),!0},MWt=({state:e,dispatch:t})=>{let r=qE(e.selection,n=>{let s=Aa(e),a=s.resolveStack(n.from,1);if(n.empty){let i=s.resolveStack(n.from,-1);i.node.from>=a.node.from&&i.node.to<=a.node.to&&(a=i)}for(let i=a;i;i=i.next){let{node:l}=i;if((l.from<n.from&&l.to>=n.to||l.to>n.to&&l.from<=n.from)&&i.next)return nt.range(l.to,l.from)}return n});return r.eq(e.selection)?!1:(t(Fp(e,r)),!0)};function DZe(e,t){let{state:r}=e,n=r.selection,s=r.selection.ranges.slice();for(let a of r.selection.ranges){let i=r.doc.lineAt(a.head);if(t?i.to<e.state.doc.length:i.from>0)for(let l=a;;){let c=e.moveVertically(l,t);if(c.head<i.from||c.head>i.to){s.some(u=>u.head==c.head)||s.push(c);break}else{if(c.head==l.head)break;l=c}}}return s.length==n.ranges.length?!1:(e.dispatch(Fp(r,nt.create(s,s.length-1))),!0)}const DWt=e=>DZe(e,!1),LWt=e=>DZe(e,!0),$Wt=({state:e,dispatch:t})=>{let r=e.selection,n=null;return r.ranges.length>1?n=nt.create([r.main]):r.main.empty||(n=nt.create([nt.cursor(r.main.head)])),n?(t(Fp(e,n)),!0):!1};function BR(e,t){if(e.state.readOnly)return!1;let r="delete.selection",{state:n}=e,s=n.changeByRange(a=>{let{from:i,to:l}=a;if(i==l){let c=t(a);c<i?(r="delete.backward",c=eD(e,c,!1)):c>i&&(r="delete.forward",c=eD(e,c,!0)),i=Math.min(i,c),l=Math.max(l,c)}else i=eD(e,i,!1),l=eD(e,l,!0);return i==l?{range:a}:{changes:{from:i,to:l},range:nt.cursor(i,i<a.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(n.update(s,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?ft.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function eD(e,t,r){if(e instanceof ft)for(let n of e.state.facet(ft.atomicRanges).map(s=>s(e)))n.between(t,t,(s,a)=>{s<t&&a>t&&(t=r?a:s)});return t}const LZe=(e,t,r)=>BR(e,n=>{let s=n.from,{state:a}=e,i=a.doc.lineAt(s),l,c;if(r&&!t&&s>i.from&&s<i.from+200&&!/[^ \t]/.test(l=i.text.slice(0,s-i.from))){if(l[l.length-1]==" ")return s-1;let u=Ep(l,a.tabSize),d=u%fS(a)||fS(a);for(let f=0;f<d&&l[l.length-1-f]==" ";f++)s--;c=s}else c=bl(i.text,s-i.from,t,t)+i.from,c==s&&i.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(i.text.slice(c-i.from,s-i.from))&&(c=bl(i.text,c-i.from,!1,!1)+i.from);return c}),sse=e=>LZe(e,!1,!0),$Ze=e=>LZe(e,!0,!1),FZe=(e,t)=>BR(e,r=>{let n=r.head,{state:s}=e,a=s.doc.lineAt(n),i=s.charCategorizer(n);for(let l=null;;){if(n==(t?a.to:a.from)){n==r.head&&a.number!=(t?s.doc.lines:1)&&(n+=t?1:-1);break}let c=bl(a.text,n-a.from,t)+a.from,u=a.text.slice(Math.min(n,c)-a.from,Math.max(n,c)-a.from),d=i(u);if(l!=null&&d!=l)break;(u!=" "||n!=r.head)&&(l=d),n=c}return n}),zZe=e=>FZe(e,!1),FWt=e=>FZe(e,!0),zWt=e=>BR(e,t=>{let r=e.lineBlockAt(t.head).to;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),BWt=e=>BR(e,t=>{let r=e.moveToLineBoundary(t,!1).head;return t.head>r?r:Math.max(0,t.head-1)}),UWt=e=>BR(e,t=>{let r=e.moveToLineBoundary(t,!0).head;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),VWt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Fs.of(["",""])},range:nt.cursor(n.from)}));return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},qWt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{if(!n.empty||n.from==0||n.from==e.doc.length)return{range:n};let s=n.from,a=e.doc.lineAt(s),i=s==a.from?s-1:bl(a.text,s-a.from,!1)+a.from,l=s==a.to?s+1:bl(a.text,s-a.from,!0)+a.from;return{changes:{from:i,to:l,insert:e.doc.slice(s,l).append(e.doc.slice(i,s))},range:nt.cursor(l)}});return r.changes.empty?!1:(t(e.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function BF(e){let t=[],r=-1;for(let n of e.selection.ranges){let s=e.doc.lineAt(n.from),a=e.doc.lineAt(n.to);if(!n.empty&&n.to==a.from&&(a=e.doc.lineAt(n.to-1)),r>=s.number){let i=t[t.length-1];i.to=a.to,i.ranges.push(n)}else t.push({from:s.from,to:a.to,ranges:[n]});r=a.number+1}return t}function BZe(e,t,r){if(e.readOnly)return!1;let n=[],s=[];for(let a of BF(e)){if(r?a.to==e.doc.length:a.from==0)continue;let i=e.doc.lineAt(r?a.to+1:a.from-1),l=i.length+1;if(r){n.push({from:a.to,to:i.to},{from:a.from,insert:i.text+e.lineBreak});for(let c of a.ranges)s.push(nt.range(Math.min(e.doc.length,c.anchor+l),Math.min(e.doc.length,c.head+l)))}else{n.push({from:i.from,to:a.from},{from:a.to,insert:e.lineBreak+i.text});for(let c of a.ranges)s.push(nt.range(c.anchor-l,c.head-l))}}return n.length?(t(e.update({changes:n,scrollIntoView:!0,selection:nt.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const HWt=({state:e,dispatch:t})=>BZe(e,t,!1),QWt=({state:e,dispatch:t})=>BZe(e,t,!0);function UZe(e,t,r){if(e.readOnly)return!1;let n=[];for(let a of BF(e))r?n.push({from:a.from,insert:e.doc.slice(a.from,a.to)+e.lineBreak}):n.push({from:a.to,insert:e.lineBreak+e.doc.slice(a.from,a.to)});let s=e.changes(n);return t(e.update({changes:s,selection:e.selection.map(s,r?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const WWt=({state:e,dispatch:t})=>UZe(e,t,!1),GWt=({state:e,dispatch:t})=>UZe(e,t,!0),ZWt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,r=t.changes(BF(t).map(({from:s,to:a})=>(s>0?s--:a<t.doc.length&&a++,{from:s,to:a}))),n=qE(t.selection,s=>{let a;if(e.lineWrapping){let i=e.lineBlockAt(s.head),l=e.coordsAtPos(s.head,s.assoc||1);l&&(a=i.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,a)}).map(r);return e.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function YWt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let r=Aa(e).resolveInner(t),n=r.childBefore(t),s=r.childAfter(t),a;return n&&s&&n.to<=t&&s.from>=t&&(a=n.type.prop(hn.closedBy))&&a.indexOf(s.name)>-1&&e.doc.lineAt(n.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(n.to,s.from))?{from:n.to,to:s.from}:null}const Lke=VZe(!1),XWt=VZe(!0);function VZe(e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let n=t.changeByRange(s=>{let{from:a,to:i}=s,l=t.doc.lineAt(a),c=!e&&a==i&&YWt(t,a);e&&(a=i=(i<=l.to?l:t.doc.lineAt(i)).to);let u=new PF(t,{simulateBreak:a,simulateDoubleBreak:!!c}),d=fue(u,a);for(d==null&&(d=Ep(/^\s*/.exec(t.doc.lineAt(a).text)[0],t.tabSize));i<l.to&&/\s/.test(l.text[i-l.from]);)i++;c?{from:a,to:i}=c:a>l.from&&a<l.from+100&&!/\S/.test(l.text.slice(0,a))&&(a=l.from);let f=["",xA(t,d)];return c&&f.push(xA(t,u.lineIndent(l.from,-1))),{changes:{from:a,to:i,insert:Fs.of(f)},range:nt.cursor(a+1+f[1].length)}});return r(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Que(e,t){let r=-1;return e.changeByRange(n=>{let s=[];for(let i=n.from;i<=n.to;){let l=e.doc.lineAt(i);l.number>r&&(n.empty||n.to>l.from)&&(t(l,s,n),r=l.number),i=l.to+1}let a=e.changes(s);return{changes:s,range:nt.range(a.mapPos(n.anchor,1),a.mapPos(n.head,1))}})}const KWt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Object.create(null),n=new PF(e,{overrideIndentation:a=>{let i=r[a];return i??-1}}),s=Que(e,(a,i,l)=>{let c=fue(n,a.from);if(c==null)return;/\S/.test(a.text)||(c=0);let u=/^\s*/.exec(a.text)[0],d=xA(e,c);(u!=d||l.from<a.from+u.length)&&(r[a.from]=c,i.push({from:a.from,to:a.from+u.length,insert:d}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},qZe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Que(e,(r,n)=>{n.push({from:r.from,insert:e.facet(BE)})}),{userEvent:"input.indent"})),!0),HZe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Que(e,(r,n)=>{let s=/^\s*/.exec(r.text)[0];if(!s)return;let a=Ep(s,e.tabSize),i=0,l=xA(e,Math.max(0,a-fS(e)));for(;i<s.length&&i<l.length&&s.charCodeAt(i)==l.charCodeAt(i);)i++;n.push({from:r.from+i,to:r.from+s.length,insert:l.slice(i)})}),{userEvent:"delete.dedent"})),!0),JWt=e=>(e.setTabFocusMode(),!0),eGt=[{key:"Ctrl-b",run:xZe,shift:TZe,preventDefault:!0},{key:"Ctrl-f",run:wZe,shift:NZe},{key:"Ctrl-p",run:kZe,shift:RZe},{key:"Ctrl-n",run:_Ze,shift:PZe},{key:"Ctrl-a",run:bWt,shift:AWt},{key:"Ctrl-e",run:xWt,shift:IWt},{key:"Ctrl-d",run:$Ze},{key:"Ctrl-h",run:sse},{key:"Ctrl-k",run:zWt},{key:"Ctrl-Alt-h",run:zZe},{key:"Ctrl-o",run:VWt},{key:"Ctrl-t",run:qWt},{key:"Ctrl-v",run:nse}],tGt=[{key:"ArrowLeft",run:xZe,shift:TZe,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:uWt,shift:OWt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:yWt,shift:TWt,preventDefault:!0},{key:"ArrowRight",run:wZe,shift:NZe,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:dWt,shift:kWt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:vWt,shift:NWt,preventDefault:!0},{key:"ArrowUp",run:kZe,shift:RZe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Rke,shift:Mke},{mac:"Ctrl-ArrowUp",run:Nke,shift:Ake},{key:"ArrowDown",run:_Ze,shift:PZe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Pke,shift:Dke},{mac:"Ctrl-ArrowDown",run:nse,shift:Ike},{key:"PageUp",run:Nke,shift:Ake},{key:"PageDown",run:nse,shift:Ike},{key:"Home",run:gWt,shift:jWt,preventDefault:!0},{key:"Mod-Home",run:Rke,shift:Mke},{key:"End",run:mWt,shift:CWt,preventDefault:!0},{key:"Mod-End",run:Pke,shift:Dke},{key:"Enter",run:Lke,shift:Lke},{key:"Mod-a",run:RWt},{key:"Backspace",run:sse,shift:sse,preventDefault:!0},{key:"Delete",run:$Ze,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:zZe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:FWt,preventDefault:!0},{mac:"Mod-Backspace",run:BWt,preventDefault:!0},{mac:"Mod-Delete",run:UWt,preventDefault:!0}].concat(eGt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),rGt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:hWt,shift:_Wt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:pWt,shift:EWt},{key:"Alt-ArrowUp",run:HWt},{key:"Shift-Alt-ArrowUp",run:WWt},{key:"Alt-ArrowDown",run:QWt},{key:"Shift-Alt-ArrowDown",run:GWt},{key:"Mod-Alt-ArrowUp",run:DWt},{key:"Mod-Alt-ArrowDown",run:LWt},{key:"Escape",run:$Wt},{key:"Mod-Enter",run:XWt},{key:"Alt-l",mac:"Ctrl-l",run:PWt},{key:"Mod-i",run:MWt,preventDefault:!0},{key:"Mod-[",run:HZe},{key:"Mod-]",run:qZe},{key:"Mod-Alt-\\",run:KWt},{key:"Shift-Mod-k",run:ZWt},{key:"Shift-Mod-\\",run:SWt},{key:"Mod-/",run:HQt},{key:"Alt-A",run:WQt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:JWt}].concat(tGt),nGt={key:"Tab",run:qZe,shift:HZe},$ke=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class Qy{constructor(t,r,n=0,s=t.length,a,i){this.test=i,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(n,s),this.bufferStart=n,this.normalize=a?l=>a($ke(l)):$ke,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Iu(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let r=Wce(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=Sm(t);let s=this.normalize(r);if(s.length)for(let a=0,i=n;;a++){let l=s.charCodeAt(a),c=this.match(l,i,this.bufferPos+this.bufferStart);if(a==s.length-1){if(c)return this.value=c,this;break}i==n&&a<r.length&&r.charCodeAt(a)==l&&i++}}}match(t,r,n){let s=null;for(let a=0;a<this.matches.length;a+=2){let i=this.matches[a],l=!1;this.query.charCodeAt(i)==t&&(i==this.query.length-1?s={from:this.matches[a+1],to:n}:(this.matches[a]++,l=!0)),l||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?s={from:r,to:n}:this.matches.push(1,r)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(Qy.prototype[Symbol.iterator]=function(){return this});const QZe={from:-1,to:-1,match:/.*/.exec("")},Wue="gm"+(/x/.unicode==null?"":"u");class WZe{constructor(t,r,n,s=0,a=t.length){if(this.text=t,this.to=a,this.curLine="",this.done=!1,this.value=QZe,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new GZe(t,r,n,s,a);this.re=new RegExp(r,Wue+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=t.iter();let i=t.lineAt(s);this.curLineStart=i.from,this.matchPos=W3(t,s),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,s=n+r[0].length;if(this.matchPos=W3(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const bV=new WeakMap;class qk{constructor(t,r){this.from=t,this.text=r}get to(){return this.from+this.text.length}static get(t,r,n){let s=bV.get(t);if(!s||s.from>=n||s.to<=r){let l=new qk(r,t.sliceString(r,n));return bV.set(t,l),l}if(s.from==r&&s.to==n)return s;let{text:a,from:i}=s;return i>r&&(a=t.sliceString(r,i)+a,i=r),s.to<n&&(a+=t.sliceString(s.to,n)),bV.set(t,new qk(i,a)),new qk(r,a.slice(r-i,n-i))}}class GZe{constructor(t,r,n,s,a){this.text=t,this.to=a,this.done=!1,this.value=QZe,this.matchPos=W3(t,s),this.re=new RegExp(r,Wue+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=qk.get(t,s,this.chunkEnd(s+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==t&&(this.re.lastIndex=t+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,s=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this.matchPos=W3(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=qk.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(WZe.prototype[Symbol.iterator]=GZe.prototype[Symbol.iterator]=function(){return this});function sGt(e){try{return new RegExp(e,Wue),!0}catch{return!1}}function W3(e,t){if(t>=e.length)return t;let r=e.lineAt(t),n;for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}const aGt=e=>{let{state:t}=e,r=String(t.doc.lineAt(e.state.selection.main.head).number),{close:n,result:s}=H7t(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:t.phrase("go")});return s.then(a=>{let i=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!i){e.dispatch({effects:n});return}let l=t.doc.lineAt(t.selection.main.head),[,c,u,d,f]=i,h=d?+d.slice(1):0,p=u?+u:l.number;if(u&&f){let y=p/100;c&&(y=y*(c=="-"?-1:1)+l.number/t.doc.lines),p=Math.round(t.doc.lines*y)}else u&&c&&(p=p*(c=="-"?-1:1)+l.number);let m=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),g=nt.cursor(m.from+Math.max(0,Math.min(h,m.length)));e.dispatch({effects:[n,ft.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},iGt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},oGt=Kt.define({combine(e){return bg(e,iGt,{highlightWordAroundCursor:(t,r)=>t||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function lGt(e){return[hGt,fGt]}const cGt=er.mark({class:"cm-selectionMatch"}),uGt=er.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Fke(e,t,r,n){return(r==0||e(t.sliceDoc(r-1,r))!=bi.Word)&&(n==t.doc.length||e(t.sliceDoc(n,n+1))!=bi.Word)}function dGt(e,t,r,n){return e(t.sliceDoc(r,r+1))==bi.Word&&e(t.sliceDoc(n-1,n))==bi.Word}const fGt=Si.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(oGt),{state:r}=e,n=r.selection;if(n.ranges.length>1)return er.none;let s=n.main,a,i=null;if(s.empty){if(!t.highlightWordAroundCursor)return er.none;let c=r.wordAt(s.head);if(!c)return er.none;i=r.charCategorizer(s.head),a=r.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c<t.minSelectionLength||c>200)return er.none;if(t.wholeWords){if(a=r.sliceDoc(s.from,s.to),i=r.charCategorizer(s.head),!(Fke(i,r,s.from,s.to)&&dGt(i,r,s.from,s.to)))return er.none}else if(a=r.sliceDoc(s.from,s.to),!a)return er.none}let l=[];for(let c of e.visibleRanges){let u=new Qy(r.doc,a,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!i||Fke(i,r,d,f))&&(s.empty&&d<=s.from&&f>=s.to?l.push(uGt.range(d,f)):(d>=s.to||f<=s.from)&&l.push(cGt.range(d,f)),l.length>t.maxMatches))return er.none}}return er.set(l)}},{decorations:e=>e.decorations}),hGt=ft.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),pGt=({state:e,dispatch:t})=>{let{selection:r}=e,n=nt.create(r.ranges.map(s=>e.wordAt(s.head)||nt.cursor(s.head)),r.mainIndex);return n.eq(r)?!1:(t(e.update({selection:n})),!0)};function mGt(e,t){let{main:r,ranges:n}=e.selection,s=e.wordAt(r.head),a=s&&s.from==r.from&&s.to==r.to;for(let i=!1,l=new Qy(e.doc,t,n[n.length-1].to);;)if(l.next(),l.done){if(i)return null;l=new Qy(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),i=!0}else{if(i&&n.some(c=>c.from==l.value.from))continue;if(a){let c=e.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const gGt=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(a=>a.from===a.to))return pGt({state:e,dispatch:t});let n=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(a=>e.sliceDoc(a.from,a.to)!=n))return!1;let s=mGt(e,n);return s?(t(e.update({selection:e.selection.addRange(nt.range(s.from,s.to),!1),effects:ft.scrollIntoView(s.to)})),!0):!1},HE=Kt.define({combine(e){return bg(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new NGt(t),scrollToMatch:t=>ft.scrollIntoView(t)})}});class ZZe{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||sGt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord,this.test=t.test}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
|
|
112
|
+
}`,{label:"class",detail:"definition",type:"keyword"}),Eu('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Eu('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],RGe=Pue.concat([Eu("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Eu("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Eu("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Ske=new RHe,PGe=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Mj(e){return(t,r)=>{let n=t.node.getChild("VariableDefinition");return n&&r(n,e),!0}}const gQt=["FunctionDeclaration"],yQt={FunctionDeclaration:Mj("function"),ClassDeclaration:Mj("class"),ClassExpression:()=>!0,EnumDeclaration:Mj("constant"),TypeAliasDeclaration:Mj("type"),NamespaceDeclaration:Mj("namespace"),VariableDefinition(e,t){e.matchContext(gQt)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function MGe(e,t){let r=Ske.get(t);if(r)return r;let n=[],s=!0;function a(i,l){let c=e.sliceString(i.from,i.to);n.push({label:c,type:l})}return t.cursor(Ks.IncludeAnonymous).iterate(i=>{if(s)s=!1;else if(i.name){let l=yQt[i.name];if(l&&l(i,a)||PGe.has(i.name))return!1}else if(i.to-i.from>8192){for(let l of MGe(e,i.node))n.push(l);return!1}}),Ske.set(t,n),n}const q3=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Mue=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function DGe(e){let t=Aa(e.state).resolveInner(e.pos,-1);if(Mue.indexOf(t.name)>-1)return null;let r=t.name=="VariableName"||t.to-t.from<20&&q3.test(e.state.sliceDoc(t.from,t.to));if(!r&&!e.explicit)return null;let n=[];for(let s=t;s;s=s.parent)PGe.has(s.name)&&(n=n.concat(MGe(e.state.doc,s)));return{options:n,from:r?t.from:e.pos,validFor:q3}}function dV(e,t,r){var n;let s=[];for(;;){let a=t.firstChild,i;if(a?.name=="VariableName")return s.push(e(a)),{path:s.reverse(),name:r};if(a?.name=="MemberExpression"&&((n=i=a.lastChild)===null||n===void 0?void 0:n.name)=="PropertyName")s.push(e(i)),t=a;else return null}}function LGe(e){let t=n=>e.state.doc.sliceString(n.from,n.to),r=Aa(e.state).resolveInner(e.pos,-1);return r.name=="PropertyName"?dV(t,r.parent,t(r)):(r.name=="."||r.name=="?.")&&r.parent.name=="MemberExpression"?dV(t,r.parent,""):Mue.indexOf(r.name)>-1?null:r.name=="VariableName"||r.to-r.from<20&&q3.test(t(r))?{path:[],name:t(r)}:r.name=="MemberExpression"?dV(t,r,""):e.explicit?{path:[],name:""}:null}function vQt(e,t){let r=e,n=[],s=new Set;for(let a=0;;a++){for(let l of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(l)||s.has(l))continue;s.add(l);let c;try{c=r[l]}catch{continue}n.push({label:l,type:typeof c=="function"?/^[A-Z]/.test(l)?"class":t?"function":"method":t?"variable":"property",boost:-a})}let i=Object.getPrototypeOf(e);if(!i)return n;e=i}}function bQt(e){let t=new Map;return r=>{let n=LGe(r);if(!n)return null;let s=e;for(let i of n.path)if(s=s[i],!s)return null;let a=t.get(s);return a||t.set(s,a=vQt(s,!n.path.length)),{from:r.pos-n.name.length,options:a,validFor:q3}}}const gh=cS.define({name:"javascript",parser:mQt.configure({props:[d1.add({IfStatement:Uk({except:/^\s*({|else\b)/}),TryStatement:Uk({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:mUt,SwitchBody:e=>{let t=e.textAfter,r=/^\s*\}/.test(t),n=/^\s*(case|default)\b/.test(t);return e.baseIndent+(r?0:n?1:2)*e.unit},Block:pUt({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":Uk({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),f1.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":pue,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name=="JSXSelfClosingTag")return null;let r=e.lastChild;return{from:t.to,to:r.type.isError?e.to:r.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let r=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,n=e.lastChild;return!r||r.type.isError?null:{from:r.to,to:n.type.isError?e.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),$Ge={test:e=>/^JSX/.test(e.name),facet:RF({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Due=gh.configure({dialect:"ts"},"typescript"),Lue=gh.configure({dialect:"jsx",props:[due.add(e=>e.isTop?[$Ge]:void 0)]}),$ue=gh.configure({dialect:"jsx ts",props:[due.add(e=>e.isTop?[$Ge]:void 0)]},"typescript");let FGe=e=>({label:e,type:"keyword"});const zGe="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(FGe),xQt=zGe.concat(["declare","implements","private","protected","public"].map(FGe));function H3(e={}){let t=e.jsx?e.typescript?$ue:Lue:e.typescript?Due:gh,r=e.typescript?RGe.concat(xQt):Pue.concat(zGe);return new dS(t,[gh.data.of({autocomplete:eVt(Mue,MWe(r))}),gh.data.of({autocomplete:DGe}),e.jsx?BGe:[]])}function wQt(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function Oke(e,t,r=e.length){for(let n=t?.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return e.sliceString(n.from,Math.min(n.to,r));return""}const SQt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),BGe=ft.inputHandler.of((e,t,r,n,s)=>{if((SQt?e.composing:e.compositionStarted)||e.state.readOnly||t!=r||n!=">"&&n!="/"||!gh.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,l=i.changeByRange(c=>{var u;let{head:d}=c,f=Aa(i).resolveInner(d-1,-1),h;if(f.name=="JSXStartTag"&&(f=f.parent),!(i.doc.sliceString(d-1,d)!=n||f.name=="JSXAttributeValue"&&f.to>d)){if(n==">"&&f.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:"</>"}};if(n=="/"&&f.name=="JSXStartCloseTag"){let p=f.parent,m=p.parent;if(m&&p.from==d-2&&((h=Oke(i.doc,m.firstChild,d))||((u=m.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let g=`${h}>`;return{range:nt.cursor(d+g.length,-1),changes:{from:d,insert:g}}}}else if(n==">"){let p=wQt(f);if(p&&p.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(h=Oke(i.doc,p,d)))return{range:c,changes:{from:d,insert:`</${h}>`}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([a,i.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function OQt(e,t){return t||(t={parserOptions:{ecmaVersion:2019,sourceType:"module"},env:{browser:!0,node:!0,es6:!0,es2015:!0,es2017:!0,es2020:!0},rules:{}},e.getRules().forEach((r,n)=>{var s;!((s=r.meta.docs)===null||s===void 0)&&s.recommended&&(t.rules[n]=2)})),r=>{let{state:n}=r,s=[];for(let{from:a,to:i}of gh.findRegions(n)){let l=n.doc.lineAt(a),c={line:l.number-1,col:a-l.from,pos:a};for(let u of e.verify(n.sliceDoc(a,i),t))s.push(kQt(u,n.doc,c))}return s}}function kke(e,t,r,n){return r.line(e+n.line).from+t+(e==1?n.col-1:-1)}function kQt(e,t,r){let n=kke(e.line,e.column,t,r),s={from:n,to:e.endLine!=null&&e.endColumn!=1?kke(e.endLine,e.endColumn,t,r):n,message:e.message,source:e.ruleId?"eslint:"+e.ruleId:"eslint",severity:e.severity==1?"warning":"error"};if(e.fix){let{range:a,text:i}=e.fix,l=a[0]+r.pos-n,c=a[1]+r.pos-n;s.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+l,to:d+c,insert:i},scrollIntoView:!0})}}]}return s}const J2=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:BGe,completionPath:LGe,esLint:OQt,javascript:H3,javascriptLanguage:gh,jsxLanguage:Lue,localCompletionSource:DGe,scopeCompletionSource:bQt,snippets:Pue,tsxLanguage:$ue,typescriptLanguage:Due,typescriptSnippets:RGe},Symbol.toStringTag,{value:"Module"})),Dj=["_blank","_self","_top","_parent"],fV=["ascii","utf-8","utf-16","latin1","latin1"],hV=["get","post","put","delete"],pV=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Sd=["true","false"],Dr={},_Qt={a:{attrs:{href:null,ping:null,type:null,media:null,target:Dj,hreflang:null}},abbr:Dr,address:Dr,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Dr,aside:Dr,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Dr,base:{attrs:{href:null,target:Dj}},bdi:Dr,bdo:Dr,blockquote:{attrs:{cite:null}},body:Dr,br:Dr,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:pV,formmethod:hV,formnovalidate:["novalidate"],formtarget:Dj,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Dr,center:Dr,cite:Dr,code:Dr,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Dr,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Dr,div:Dr,dl:Dr,dt:Dr,em:Dr,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Dr,figure:Dr,footer:Dr,form:{attrs:{action:null,name:null,"accept-charset":fV,autocomplete:["on","off"],enctype:pV,method:hV,novalidate:["novalidate"],target:Dj}},h1:Dr,h2:Dr,h3:Dr,h4:Dr,h5:Dr,h6:Dr,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Dr,hgroup:Dr,hr:Dr,html:{attrs:{manifest:null}},i:Dr,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:pV,formmethod:hV,formnovalidate:["novalidate"],formtarget:Dj,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Dr,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Dr,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Dr,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:fV,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Dr,noscript:Dr,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Dr,param:{attrs:{name:null,value:null}},pre:Dr,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Dr,rt:Dr,ruby:Dr,samp:Dr,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:fV}},section:Dr,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Dr,source:{attrs:{src:null,type:null,media:null}},span:Dr,strong:Dr,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Dr,summary:Dr,sup:Dr,table:Dr,tbody:Dr,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Dr,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Dr,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Dr,time:{attrs:{datetime:null}},title:Dr,tr:Dr,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Dr,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Dr},UGe={accesskey:null,class:null,contenteditable:Sd,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Sd,autocorrect:Sd,autocapitalize:Sd,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Sd,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Sd,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Sd,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Sd,"aria-hidden":Sd,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Sd,"aria-multiselectable":Sd,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Sd,"aria-relevant":null,"aria-required":Sd,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},VGe="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of VGe)UGe[e]=null;let TA=class{constructor(t,r){this.tags={..._Qt,...t},this.globalAttrs={...UGe,...r},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};TA.default=new TA;function N_(e,t,r=e.length){if(!t)return"";let n=t.firstChild,s=n&&n.getChild("TagName");return s?e.sliceString(s.from,Math.min(s.to,r)):""}function A_(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function qGe(e,t,r){let n=r.tags[N_(e,A_(t))];return n?.children||r.allTags}function Fue(e,t){let r=[];for(let n=A_(t);n&&!n.type.isTop;n=A_(n.parent)){let s=N_(e,n);if(s&&n.lastChild.name=="CloseTag")break;s&&r.indexOf(s)<0&&(t.name=="EndTag"||t.from>=n.firstChild.to)&&r.push(s)}return r}const HGe=/^[:\-\.\w\u00b7-\uffff]*$/;function _ke(e,t,r,n,s){let a=/\s*>/.test(e.sliceDoc(s,s+5))?"":">",i=A_(r,r.name=="StartTag"||r.name=="TagName");return{from:n,to:s,options:qGe(e.doc,i,t).map(l=>({label:l,type:"type"})).concat(Fue(e.doc,r).map((l,c)=>({label:"/"+l,apply:"/"+l+a,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function Eke(e,t,r,n){let s=/\s*>/.test(e.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:Fue(e.doc,t).map((a,i)=>({label:a,apply:a+s,type:"type",boost:99-i})),validFor:HGe}}function EQt(e,t,r,n){let s=[],a=0;for(let i of qGe(e.doc,r,t))s.push({label:"<"+i,type:"type"});for(let i of Fue(e.doc,r))s.push({label:"</"+i+">",type:"type",boost:99-a++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function CQt(e,t,r,n,s){let a=A_(r),i=a?t.tags[N_(e.doc,a)]:null,l=i&&i.attrs?Object.keys(i.attrs):[],c=i&&i.globalAttrs===!1?l:l.length?l.concat(t.globalAttrNames):t.globalAttrNames;return{from:n,to:s,options:c.map(u=>({label:u,type:"property"})),validFor:HGe}}function jQt(e,t,r,n,s){var a;let i=(a=r.parent)===null||a===void 0?void 0:a.getChild("AttributeName"),l=[],c;if(i){let u=e.sliceDoc(i.from,i.to),d=t.globalAttrs[u];if(!d){let f=A_(r),h=f?t.tags[N_(e.doc,f)]:null;d=h?.attrs&&h.attrs[u]}if(d){let f=e.sliceDoc(n,s).toLowerCase(),h='"',p='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",p=e.sliceDoc(s,s+1)==f[0]?"":f[0],f=f.slice(1),n++):c=/^[^\s<>='"]*$/;for(let m of d)l.push({label:m,apply:h+m+p,type:"constant"})}}return{from:n,to:s,options:l,validFor:c}}function QGe(e,t){let{state:r,pos:n}=t,s=Aa(r).resolveInner(n,-1),a=s.resolve(n);for(let i=n,l;a==s&&(l=s.childBefore(i));){let c=l.lastChild;if(!c||!c.type.isError||c.from<c.to)break;a=s=l,i=c.from}return s.name=="TagName"?s.parent&&/CloseTag$/.test(s.parent.name)?Eke(r,s,s.from,n):_ke(r,e,s,s.from,n):s.name=="StartTag"||s.name=="IncompleteTag"?_ke(r,e,s,n,n):s.name=="StartCloseTag"||s.name=="IncompleteCloseTag"?Eke(r,s,n,n):s.name=="OpenTag"||s.name=="SelfClosingTag"||s.name=="AttributeName"?CQt(r,e,s,s.name=="AttributeName"?s.from:n,n):s.name=="Is"||s.name=="AttributeValue"||s.name=="UnquotedAttributeValue"?jQt(r,e,s,s.name=="Is"?n:s.from,n):t.explicit&&(a.name=="Element"||a.name=="Text"||a.name=="Document")?EQt(r,e,s,n):null}function WGe(e){return QGe(TA.default,e)}function GGe(e){let{extraTags:t,extraGlobalAttributes:r}=e,n=r||t?new TA(t,r):TA.default;return s=>QGe(n,s)}const TQt=gh.parser.configure({top:"SingleExpression"}),ZGe=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:Due.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:Lue.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:$ue.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:TQt},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:gh.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:jA.parser}],YGe=[{name:"style",parser:jA.parser.configure({top:"Styles"})}].concat(VGe.map(e=>({name:e,parser:gh.parser}))),XGe=cS.define({name:"html",parser:sHt.configure({props:[d1.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,r;for(let n=e.node;;){let s=n.lastChild;if(!s||s.name!="Element"||s.to!=n.to)break;t=n=s}return t&&!((r=t.lastChild)&&(r.name=="CloseTag"||r.name=="SelfClosingTag"))?e.lineIndent(t.from)+e.unit:null}}),f1.add({Element(e){let t=e.firstChild,r=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:r.name=="CloseTag"?r.from:e.to}}}),jWe.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),xN=XGe.configure({wrap:OGe(ZGe,YGe)});function KGe(e={}){let t="",r;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(r=OGe((e.nestedLanguages||[]).concat(ZGe),(e.nestedAttributes||[]).concat(YGe)));let n=r?XGe.configure({wrap:r,dialect:t}):t?xN.configure({dialect:t}):xN;return new dS(n,[xN.data.of({autocomplete:GGe(e)}),e.autoCloseTags!==!1?JGe:[],H3().support,AGe().support])}const Cke=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),JGe=ft.inputHandler.of((e,t,r,n,s)=>{if(e.composing||e.state.readOnly||t!=r||n!=">"&&n!="/"||!xN.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,l=i.changeByRange(c=>{var u,d,f;let h=i.doc.sliceString(c.from-1,c.to)==n,{head:p}=c,m=Aa(i).resolveInner(p,-1),g;if(h&&n==">"&&m.name=="EndTag"){let y=m.parent;if(((d=(u=y.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(g=N_(i.doc,y.parent,p))&&!Cke.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`</${g}>`;return{range:c,changes:{from:p,to:x,insert:w}}}}else if(h&&n=="/"&&m.name=="IncompleteCloseTag"){let y=m.parent;if(m.from==p-2&&((f=y.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=N_(i.doc,y,p))&&!Cke.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`${g}>`;return{range:nt.cursor(p+w.length,-1),changes:{from:p,to:x,insert:w}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([a,i.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),NQt=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:JGe,html:KGe,htmlCompletionSource:WGe,htmlCompletionSourceWith:GGe,htmlLanguage:xN},Symbol.toStringTag,{value:"Module"})),eZe=RF({commentTokens:{block:{open:"<!--",close:"-->"}}}),tZe=new hn,rZe=iqt.configure({props:[f1.add(e=>!e.is("Block")||e.is("Document")||ese(e)!=null||AQt(e)?void 0:(t,r)=>({from:r.doc.lineAt(t.from).to,to:t.to})),tZe.add(ese),d1.add({Document:()=>null}),Fb.add({Document:eZe})]});function ese(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function AQt(e){return e.name=="OrderedList"||e.name=="BulletList"}function IQt(e,t){let r=e;for(;;){let n=r.nextSibling,s;if(!n||(s=ese(n.type))!=null&&s<=t)break;r=n}return r.to}const RQt=gWe.of((e,t,r)=>{for(let n=Aa(e).resolveInner(r,-1);n&&!(n.from<t);n=n.parent){let s=n.type.prop(tZe);if(s==null)continue;let a=IQt(n,s);if(a>r)return{from:r,to:a}}return null});function zue(e){return new qd(eZe,e,[],"markdown")}const nZe=zue(rZe),PQt=rZe.configure([yqt,bqt,vqt,xqt,{props:[f1.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),pS=zue(PQt);function MQt(e,t){return r=>{if(r&&e){let n=null;if(r=/\S*/.exec(r)[0],typeof e=="function"?n=e(r):n=Ye.matchLanguageName(e,r,!0),n instanceof Ye)return n.support?n.support.language.parser:uS.getSkippingParser(n.load());if(n)return n.parser}return t?t.parser:null}}class mV{constructor(t,r,n,s,a,i,l){this.node=t,this.from=r,this.to=n,this.spaceBefore=s,this.spaceAfter=a,this.type=i,this.item=l}blank(t,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;n.length<t;)n+=" ";return n}else{for(let s=this.to-this.from-n.length-this.spaceAfter.length;s>0;s--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(t,r){let n=this.node.name=="OrderedList"?String(+aZe(this.item,t)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function sZe(e,t){let r=[],n=[];for(let s=e;s;s=s.parent){if(s.name=="FencedCode")return n;(s.name=="ListItem"||s.name=="Blockquote")&&r.push(s)}for(let s=r.length-1;s>=0;s--){let a=r[s],i,l=t.lineAt(a.from),c=a.from-l.from;if(a.name=="Blockquote"&&(i=/^ *>( ?)/.exec(l.text.slice(c))))n.push(new mV(a,c,c+i[0].length,"",i[1],">",null));else if(a.name=="ListItem"&&a.parent.name=="OrderedList"&&(i=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=i[3],d=i[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),n.push(new mV(a.parent,c,c+d,i[1],u,i[2],a))}else if(a.name=="ListItem"&&a.parent.name=="BulletList"&&(i=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=i[4],d=i[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=i[2];i[3]&&(f+=i[3].replace(/[xX]/," ")),n.push(new mV(a.parent,c,c+d,i[1],u,f,a))}}return n}function aZe(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function gV(e,t,r,n=0){for(let s=-1,a=e;;){if(a.name=="ListItem"){let l=aZe(a,t),c=+l[2];if(s>=0){if(c!=s+1)return;r.push({from:a.from+l[1].length,to:a.from+l[0].length,insert:String(s+2+n)})}s=c}let i=a.nextSibling;if(!i)break;a=i}}function Bue(e,t){let r=/^[ \t]*/.exec(e)[0].length;if(!r||t.facet(BE)!=" ")return e;let n=Ep(e,4,r),s="";for(let a=n;a>0;)a>=4?(s+=" ",a-=4):(s+=" ",a--);return s+e.slice(r)}const iZe=(e={})=>({state:t,dispatch:r})=>{let n=Aa(t),{doc:s}=t,a=null,i=t.changeByRange(l=>{if(!l.empty||!pS.isActiveAt(t,l.from,-1)&&!pS.isActiveAt(t,l.from,1))return a={range:l};let c=l.from,u=s.lineAt(c),d=sZe(n.resolveInner(c,-1),s);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return a={range:l};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return a={range:l};let h=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&h){let x=f.node.firstChild,w=f.node.getChild("ListItem","ListItem");if(x.to>=c||w&&w.to<c||u.from>0&&!/[^\s>]/.test(s.lineAt(u.from-1).text)||e.nonTightLists===!1){let S=d.length>1?d[d.length-2]:null,k,_="";S&&S.item?(k=u.from+S.from,_=S.marker(s,1)):k=u.from+(S?S.to:0);let E=[{from:k,to:c,insert:_}];return f.node.name=="OrderedList"&&gV(f.item,s,E,-2),S&&S.node.name=="OrderedList"&&gV(S.item,s,E),{range:nt.cursor(k+_.length),changes:E}}else{let S=Tke(d,t,u);return{range:nt.cursor(c+S.length+1),changes:{from:u.from,insert:S+t.lineBreak}}}}if(f.node.name=="Blockquote"&&h&&u.from){let x=s.lineAt(u.from-1),w=/>\s*$/.exec(x.text);if(w&&w.index==f.from){let S=t.changes([{from:x.from+w.index,to:x.to},{from:u.from+f.from,to:u.to}]);return{range:l.map(S),changes:S}}}let p=[];f.node.name=="OrderedList"&&gV(f.item,s,p);let m=f.item&&f.item.from<u.from,g="";if(!m||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=f.to)for(let x=0,w=d.length-1;x<=w;x++)g+=x==w&&!m?d[x].marker(s,1):d[x].blank(x<w?Ep(u.text,4,d[x+1].from)-g.length:null);let y=c;for(;y>u.from&&/\s/.test(u.text.charAt(y-u.from-1));)y--;return g=Bue(g,t),DQt(f.node,t.doc)&&(g=Tke(d,t,u)+t.lineBreak+g),p.push({from:y,to:c,insert:t.lineBreak+g}),{range:nt.cursor(y+g.length+1),changes:p}});return a?!1:(r(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0)},oZe=iZe();function jke(e){return e.name=="QuoteMark"||e.name=="ListMark"}function DQt(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let r=e.firstChild,n=e.getChild("ListItem","ListItem");if(!n)return!1;let s=t.lineAt(r.to),a=t.lineAt(n.from),i=/^[\s>]*$/.test(s.text);return s.number+(i?0:1)<a.number}function Tke(e,t,r){let n="";for(let s=0,a=e.length-2;s<=a;s++)n+=e[s].blank(s<a?Ep(r.text,4,e[s+1].from)-n.length:null,s<a);return Bue(n,t)}function LQt(e,t){let r=e.resolveInner(t,-1),n=t;jke(r)&&(n=r.from,r=r.parent);for(let s;s=r.childBefore(n);)if(jke(s))n=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")r=s.lastChild,n=r.to;else break;return r}const lZe=({state:e,dispatch:t})=>{let r=Aa(e),n=null,s=e.changeByRange(a=>{let i=a.from,{doc:l}=e;if(a.empty&&pS.isActiveAt(e,a.from)){let c=l.lineAt(i),u=sZe(LQt(r,i),l);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(i-c.from>f&&!/\S/.test(c.text.slice(f,i-c.from)))return{range:nt.cursor(c.from+f),changes:{from:c.from+f,to:i}};if(i-c.from==f&&(!d.item||c.from<=d.item.from||!/\S/.test(c.text.slice(0,d.to)))){let h=c.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(c.text.slice(d.from,d.to))){let p=d.blank(Ep(c.text,4,d.to)-Ep(c.text,4,d.from));return h==c.from&&(p=Bue(p,e)),{range:nt.cursor(h+p.length),changes:{from:h,to:c.from+d.to,insert:p}}}if(h<i)return{range:nt.cursor(h),changes:{from:h,to:i}}}}}return n={range:a}});return n?!1:(t(e.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},cZe=[{key:"Enter",run:oZe},{key:"Backspace",run:lZe}],uZe=KGe({matchClosingTags:!1});function Uue(e={}){let{codeLanguages:t,defaultCodeLanguage:r,addKeymap:n=!0,base:{parser:s}=nZe,completeHTMLTags:a=!0,pasteURLAsLink:i=!0,htmlTagLanguage:l=uZe}=e;if(!(s instanceof LF))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[l.support,RQt],d;i&&u.push(dZe),r instanceof dS?(u.push(r.support),d=r.language):r&&(d=r);let f=t||d?MQt(t,d):void 0;c.push(lqt({codeParser:f,htmlParser:l.language.parser})),n&&u.push(Lp.high(zE.of(cZe)));let h=zue(s.configure(c));return a&&u.push(h.data.of({autocomplete:$Qt})),new dS(h,u)}function $Qt(e){let{state:t,pos:r}=e,n=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(r-25,r));if(!n)return null;let s=Aa(t).resolveInner(r,-1);for(;s&&!s.type.isTop;){if(s.name=="CodeBlock"||s.name=="FencedCode"||s.name=="ProcessingInstructionBlock"||s.name=="CommentBlock"||s.name=="Link"||s.name=="Image")return null;s=s.parent}return{from:r-n[0].length,to:r,options:FQt(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let yV=null;function FQt(){if(yV)return yV;let e=WGe(new vue(zn.create({extensions:uZe}),0,!0));return yV=e?e.options:[]}const zQt=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,dZe=ft.domEventHandlers({paste:(e,t)=>{var r;let{main:n}=t.state.selection;if(n.empty)return!1;let s=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!pS.isActiveAt(t.state,n.from,1)))return!1;let a=Aa(t.state),i=!1;return a.iterate({from:n.from,to:n.to,enter:l=>{(l.from>n.from||zQt.test(l.name))&&(i=!0)},leave:l=>{l.to<n.to&&(i=!0)}}),i?!1:(t.dispatch({changes:[{from:n.from,insert:"["},{from:n.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),BQt=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:nZe,deleteMarkupBackward:lZe,insertNewlineContinueMarkup:oZe,insertNewlineContinueMarkupCommand:iZe,markdown:Uue,markdownKeymap:cZe,markdownLanguage:pS,pasteURLAsLink:dZe},Symbol.toStringTag,{value:"Module"}));function pt(e){return new dS(mue.define(e))}function nb(e){return Ke(()=>import("./index-DgsjhlXm.js"),__vite__mapDeps([0,1]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const fZe=[Ye.of({name:"C",extensions:["c","h","ino"],load(){return Ke(()=>import("./index-QXQVodHO.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),Ye.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return Ke(()=>import("./index-QXQVodHO.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),Ye.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return nb("Cassandra")}}),Ye.of({name:"CSS",extensions:["css"],load(){return Ke(()=>Promise.resolve().then(()=>$Ht),void 0,import.meta.url).then(e=>e.css())}}),Ye.of({name:"Go",extensions:["go"],load(){return Ke(()=>import("./index-BlyDIwMn.js"),__vite__mapDeps([3,1]),import.meta.url).then(e=>e.go())}}),Ye.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return Ke(()=>Promise.resolve().then(()=>NQt),void 0,import.meta.url).then(e=>e.html())}}),Ye.of({name:"Java",extensions:["java"],load(){return Ke(()=>import("./index-BDR3cjgt.js"),__vite__mapDeps([4,1]),import.meta.url).then(e=>e.java())}}),Ye.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return Ke(()=>Promise.resolve().then(()=>J2),void 0,import.meta.url).then(e=>e.javascript())}}),Ye.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return Ke(()=>import("./index-CJSPtnUq.js"),__vite__mapDeps([5,1]),import.meta.url).then(e=>e.jinja())}}),Ye.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return Ke(()=>Promise.resolve().then(()=>KUt),void 0,import.meta.url).then(e=>e.json())}}),Ye.of({name:"JSX",extensions:["jsx"],load(){return Ke(()=>Promise.resolve().then(()=>J2),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ye.of({name:"LESS",extensions:["less"],load(){return Ke(()=>import("./index-BY9llOIv.js"),__vite__mapDeps([6,1]),import.meta.url).then(e=>e.less())}}),Ye.of({name:"Liquid",extensions:["liquid"],load(){return Ke(()=>import("./index-CACuXitB.js"),__vite__mapDeps([7,1]),import.meta.url).then(e=>e.liquid())}}),Ye.of({name:"MariaDB SQL",load(){return nb("MariaSQL")}}),Ye.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return Ke(()=>Promise.resolve().then(()=>BQt),void 0,import.meta.url).then(e=>e.markdown())}}),Ye.of({name:"MS SQL",load(){return nb("MSSQL")}}),Ye.of({name:"MySQL",load(){return nb("MySQL")}}),Ye.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return Ke(()=>import("./index-CMJSJfP2.js"),__vite__mapDeps([8,1]),import.meta.url).then(e=>e.php())}}),Ye.of({name:"PLSQL",extensions:["pls"],load(){return nb("PLSQL")}}),Ye.of({name:"PostgreSQL",load(){return nb("PostgreSQL")}}),Ye.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return Ke(()=>import("./index-BeGnnM9T.js"),__vite__mapDeps([9,1]),import.meta.url).then(e=>e.python())}}),Ye.of({name:"Rust",extensions:["rs"],load(){return Ke(()=>import("./index-B4hldRHY.js"),__vite__mapDeps([10,1]),import.meta.url).then(e=>e.rust())}}),Ye.of({name:"Sass",extensions:["sass"],load(){return Ke(()=>import("./index-D4RLdPQX.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass({indented:!0}))}}),Ye.of({name:"SCSS",extensions:["scss"],load(){return Ke(()=>import("./index-D4RLdPQX.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass())}}),Ye.of({name:"SQL",extensions:["sql"],load(){return nb("StandardSQL")}}),Ye.of({name:"SQLite",load(){return nb("SQLite")}}),Ye.of({name:"TSX",extensions:["tsx"],load(){return Ke(()=>Promise.resolve().then(()=>J2),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Ye.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return Ke(()=>Promise.resolve().then(()=>J2),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ye.of({name:"WebAssembly",extensions:["wat","wast"],load(){return Ke(()=>import("./index-khE46ZgP.js"),__vite__mapDeps([12,1]),import.meta.url).then(e=>e.wast())}}),Ye.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return Ke(()=>import("./index-B0FGDuOE.js"),__vite__mapDeps([13,1]),import.meta.url).then(e=>e.xml())}}),Ye.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return Ke(()=>import("./index-BmOni1qQ.js"),__vite__mapDeps([14,1]),import.meta.url).then(e=>e.yaml())}}),Ye.of({name:"APL",extensions:["dyalog","apl"],load(){return Ke(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>pt(e.apl))}}),Ye.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return Ke(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>pt(e.asciiArmor))}}),Ye.of({name:"ASN.1",extensions:["asn","asn1"],load(){return Ke(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>pt(e.asn1({})))}}),Ye.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return Ke(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>pt(e.asterisk))}}),Ye.of({name:"Brainfuck",extensions:["b","bf"],load(){return Ke(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>pt(e.brainfuck))}}),Ye.of({name:"Cobol",extensions:["cob","cpy"],load(){return Ke(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>pt(e.cobol))}}),Ye.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.csharp))}}),Ye.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return Ke(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>pt(e.clojure))}}),Ye.of({name:"ClojureScript",extensions:["cljs"],load(){return Ke(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>pt(e.clojure))}}),Ye.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return Ke(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>pt(e.gss))}}),Ye.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return Ke(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>pt(e.cmake))}}),Ye.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return Ke(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>pt(e.coffeeScript))}}),Ye.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return Ke(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>pt(e.commonLisp))}}),Ye.of({name:"Cypher",extensions:["cyp","cypher"],load(){return Ke(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>pt(e.cypher))}}),Ye.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return Ke(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>pt(e.cython))}}),Ye.of({name:"Crystal",extensions:["cr"],load(){return Ke(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>pt(e.crystal))}}),Ye.of({name:"D",extensions:["d"],load(){return Ke(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>pt(e.d))}}),Ye.of({name:"Dart",extensions:["dart"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.dart))}}),Ye.of({name:"diff",extensions:["diff","patch"],load(){return Ke(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>pt(e.diff))}}),Ye.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return Ke(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([15,16]),import.meta.url).then(e=>pt(e.dockerFile))}}),Ye.of({name:"DTD",extensions:["dtd"],load(){return Ke(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>pt(e.dtd))}}),Ye.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return Ke(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>pt(e.dylan))}}),Ye.of({name:"EBNF",load(){return Ke(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>pt(e.ebnf))}}),Ye.of({name:"ECL",extensions:["ecl"],load(){return Ke(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>pt(e.ecl))}}),Ye.of({name:"edn",extensions:["edn"],load(){return Ke(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>pt(e.clojure))}}),Ye.of({name:"Eiffel",extensions:["e"],load(){return Ke(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>pt(e.eiffel))}}),Ye.of({name:"Elm",extensions:["elm"],load(){return Ke(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>pt(e.elm))}}),Ye.of({name:"Erlang",extensions:["erl"],load(){return Ke(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>pt(e.erlang))}}),Ye.of({name:"Esper",load(){return Ke(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>pt(e.esper))}}),Ye.of({name:"Factor",extensions:["factor"],load(){return Ke(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([17,16]),import.meta.url).then(e=>pt(e.factor))}}),Ye.of({name:"FCL",load(){return Ke(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>pt(e.fcl))}}),Ye.of({name:"Forth",extensions:["forth","fth","4th"],load(){return Ke(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>pt(e.forth))}}),Ye.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return Ke(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>pt(e.fortran))}}),Ye.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return Ke(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>pt(e.fSharp))}}),Ye.of({name:"Gas",extensions:["s"],load(){return Ke(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>pt(e.gas))}}),Ye.of({name:"Gherkin",extensions:["feature"],load(){return Ke(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>pt(e.gherkin))}}),Ye.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return Ke(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>pt(e.groovy))}}),Ye.of({name:"Haskell",extensions:["hs"],load(){return Ke(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>pt(e.haskell))}}),Ye.of({name:"Haxe",extensions:["hx"],load(){return Ke(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>pt(e.haxe))}}),Ye.of({name:"HXML",extensions:["hxml"],load(){return Ke(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>pt(e.hxml))}}),Ye.of({name:"HTTP",load(){return Ke(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>pt(e.http))}}),Ye.of({name:"IDL",extensions:["pro"],load(){return Ke(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>pt(e.idl))}}),Ye.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return Ke(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>pt(e.jsonld))}}),Ye.of({name:"Julia",extensions:["jl"],load(){return Ke(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>pt(e.julia))}}),Ye.of({name:"Kotlin",extensions:["kt","kts"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.kotlin))}}),Ye.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return Ke(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>pt(e.liveScript))}}),Ye.of({name:"Lua",extensions:["lua"],load(){return Ke(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>pt(e.lua))}}),Ye.of({name:"mIRC",extensions:["mrc"],load(){return Ke(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>pt(e.mirc))}}),Ye.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return Ke(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>pt(e.mathematica))}}),Ye.of({name:"Modelica",extensions:["mo"],load(){return Ke(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>pt(e.modelica))}}),Ye.of({name:"MUMPS",extensions:["mps"],load(){return Ke(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>pt(e.mumps))}}),Ye.of({name:"Mbox",extensions:["mbox"],load(){return Ke(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>pt(e.mbox))}}),Ye.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return Ke(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>pt(e.nginx))}}),Ye.of({name:"NSIS",extensions:["nsh","nsi"],load(){return Ke(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([18,16]),import.meta.url).then(e=>pt(e.nsis))}}),Ye.of({name:"NTriples",extensions:["nt","nq"],load(){return Ke(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>pt(e.ntriples))}}),Ye.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.objectiveC))}}),Ye.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.objectiveCpp))}}),Ye.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return Ke(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>pt(e.oCaml))}}),Ye.of({name:"Octave",extensions:["m"],load(){return Ke(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>pt(e.octave))}}),Ye.of({name:"Oz",extensions:["oz"],load(){return Ke(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>pt(e.oz))}}),Ye.of({name:"Pascal",extensions:["p","pas"],load(){return Ke(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>pt(e.pascal))}}),Ye.of({name:"Perl",extensions:["pl","pm"],load(){return Ke(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>pt(e.perl))}}),Ye.of({name:"Pig",extensions:["pig"],load(){return Ke(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>pt(e.pig))}}),Ye.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return Ke(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>pt(e.powerShell))}}),Ye.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return Ke(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>pt(e.properties))}}),Ye.of({name:"ProtoBuf",extensions:["proto"],load(){return Ke(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>pt(e.protobuf))}}),Ye.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return Ke(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([19,20]),import.meta.url).then(e=>pt(e.pug))}}),Ye.of({name:"Puppet",extensions:["pp"],load(){return Ke(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>pt(e.puppet))}}),Ye.of({name:"Q",extensions:["q"],load(){return Ke(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>pt(e.q))}}),Ye.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return Ke(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>pt(e.r))}}),Ye.of({name:"RPM Changes",load(){return Ke(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>pt(e.rpmChanges))}}),Ye.of({name:"RPM Spec",extensions:["spec"],load(){return Ke(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>pt(e.rpmSpec))}}),Ye.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return Ke(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>pt(e.ruby))}}),Ye.of({name:"SAS",extensions:["sas"],load(){return Ke(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>pt(e.sas))}}),Ye.of({name:"Scala",extensions:["scala"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.scala))}}),Ye.of({name:"Scheme",extensions:["scm","ss"],load(){return Ke(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>pt(e.scheme))}}),Ye.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return Ke(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>pt(e.shell))}}),Ye.of({name:"Sieve",extensions:["siv","sieve"],load(){return Ke(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>pt(e.sieve))}}),Ye.of({name:"Smalltalk",extensions:["st"],load(){return Ke(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>pt(e.smalltalk))}}),Ye.of({name:"Solr",load(){return Ke(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>pt(e.solr))}}),Ye.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return Ke(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>pt(e.sml))}}),Ye.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return Ke(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>pt(e.sparql))}}),Ye.of({name:"Spreadsheet",alias:["excel","formula"],load(){return Ke(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>pt(e.spreadsheet))}}),Ye.of({name:"Squirrel",extensions:["nut"],load(){return Ke(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.squirrel))}}),Ye.of({name:"Stylus",extensions:["styl"],load(){return Ke(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>pt(e.stylus))}}),Ye.of({name:"Swift",extensions:["swift"],load(){return Ke(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>pt(e.swift))}}),Ye.of({name:"sTeX",load(){return Ke(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>pt(e.stex))}}),Ye.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return Ke(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>pt(e.stex))}}),Ye.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return Ke(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>pt(e.verilog))}}),Ye.of({name:"Tcl",extensions:["tcl"],load(){return Ke(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>pt(e.tcl))}}),Ye.of({name:"Textile",extensions:["textile"],load(){return Ke(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>pt(e.textile))}}),Ye.of({name:"TiddlyWiki",load(){return Ke(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>pt(e.tiddlyWiki))}}),Ye.of({name:"Tiki wiki",load(){return Ke(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>pt(e.tiki))}}),Ye.of({name:"TOML",extensions:["toml"],load(){return Ke(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>pt(e.toml))}}),Ye.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return Ke(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>pt(e.troff))}}),Ye.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return Ke(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>pt(e.ttcn))}}),Ye.of({name:"TTCN_CFG",extensions:["cfg"],load(){return Ke(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>pt(e.ttcnCfg))}}),Ye.of({name:"Turtle",extensions:["ttl"],load(){return Ke(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>pt(e.turtle))}}),Ye.of({name:"Web IDL",extensions:["webidl"],load(){return Ke(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>pt(e.webIDL))}}),Ye.of({name:"VB.NET",extensions:["vb"],load(){return Ke(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>pt(e.vb))}}),Ye.of({name:"VBScript",extensions:["vbs"],load(){return Ke(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>pt(e.vbScript))}}),Ye.of({name:"Velocity",extensions:["vtl"],load(){return Ke(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>pt(e.velocity))}}),Ye.of({name:"Verilog",extensions:["v"],load(){return Ke(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>pt(e.verilog))}}),Ye.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return Ke(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>pt(e.vhdl))}}),Ye.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return Ke(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>pt(e.xQuery))}}),Ye.of({name:"Yacas",extensions:["ys"],load(){return Ke(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>pt(e.yacas))}}),Ye.of({name:"Z80",extensions:["z80"],load(){return Ke(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>pt(e.z80))}}),Ye.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return Ke(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>pt(e.mscgen))}}),Ye.of({name:"Xù",extensions:["xu"],load(){return Ke(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>pt(e.xu))}}),Ye.of({name:"MsGenny",extensions:["msgenny"],load(){return Ke(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>pt(e.msgenny))}}),Ye.of({name:"Vue",extensions:["vue"],load(){return Ke(()=>import("./index-Bl_7qW26.js"),__vite__mapDeps([21,1]),import.meta.url).then(e=>e.vue())}}),Ye.of({name:"Angular Template",load(){return Ke(()=>import("./index-BAIbci1D.js"),__vite__mapDeps([22,1]),import.meta.url).then(e=>e.angular())}})];function kx(){return kx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},kx.apply(null,arguments)}var UQt=e=>{var{theme:t,settings:r={},styles:n=[]}=e,s={".cm-gutters":{}},a={};r.background&&(a.backgroundColor=r.background),r.backgroundImage&&(a.backgroundImage=r.backgroundImage),r.foreground&&(a.color=r.foreground),r.fontSize&&(a.fontSize=r.fontSize),(r.background||r.foreground)&&(s["&"]=a),r.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:r.fontFamily}),r.gutterBackground&&(s[".cm-gutters"].backgroundColor=r.gutterBackground),r.gutterForeground&&(s[".cm-gutters"].color=r.gutterForeground),r.gutterBorder&&(s[".cm-gutters"].borderRightColor=r.gutterBorder),r.caret&&(s[".cm-content"]={caretColor:r.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:r.caret});var i={};r.gutterActiveForeground&&(i.color=r.gutterActiveForeground),r.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:r.lineHighlight},i.backgroundColor=r.lineHighlight),s[".cm-activeLineGutter"]=i,r.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:r.selection+" !important"}),r.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:r.selectionMatch});var l=ft.theme(s,{dark:t==="dark"}),c=$p.define(n),u=[l,Yx(c)];return u},VQt={background:"#282a36",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"#282a36",gutterForeground:"#6D8A88",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},qQt=[{tag:ne.comment,color:"#6272a4"},{tag:ne.string,color:"#f1fa8c"},{tag:ne.atom,color:"#bd93f9"},{tag:ne.meta,color:"#f8f8f2"},{tag:[ne.keyword,ne.operator,ne.tagName],color:"#ff79c6"},{tag:[ne.function(ne.propertyName),ne.propertyName],color:"#66d9ef"},{tag:[ne.definition(ne.variableName),ne.function(ne.variableName),ne.className,ne.attributeName],color:"#50fa7b"},{tag:ne.atom,color:"#bd93f9"}],VE=e=>{var{theme:t="dark",settings:r={},styles:n=[]}=e||{};return UQt({theme:t,settings:kx({},VQt,r),styles:[...qQt,...n]})};VE();function Vue(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}const HQt=e=>{let{state:t}=e,r=t.doc.lineAt(t.selection.main.from),n=Hue(e.state,r.from);return n.line?QQt(e):n.block?GQt(e):!1};function que(e,t){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let s=e(t,r);return s?(n(r.update(s)),!0):!1}}const QQt=que(XQt,0),WQt=que(hZe,0),GQt=que((e,t)=>hZe(e,t,YQt(t)),0);function Hue(e,t){let r=e.languageDataAt("commentTokens",t,1);return r.length?r[0]:{}}const Lj=50;function ZQt(e,{open:t,close:r},n,s){let a=e.sliceDoc(n-Lj,n),i=e.sliceDoc(s,s+Lj),l=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(i)[0].length,u=a.length-l;if(a.slice(u-t.length,u)==t&&i.slice(c,c+r.length)==r)return{open:{pos:n-l,margin:l&&1},close:{pos:s+c,margin:c&&1}};let d,f;s-n<=2*Lj?d=f=e.sliceDoc(n,s):(d=e.sliceDoc(n,n+Lj),f=e.sliceDoc(s-Lj,s));let h=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(f)[0].length,m=f.length-p-r.length;return d.slice(h,h+t.length)==t&&f.slice(m,m+r.length)==r?{open:{pos:n+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:s-p-r.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function YQt(e){let t=[];for(let r of e.selection.ranges){let n=e.doc.lineAt(r.from),s=r.to<=n.to?n:e.doc.lineAt(r.to);s.from>n.from&&s.from==r.to&&(s=r.to==n.to+1?n:e.doc.lineAt(r.to-1));let a=t.length-1;a>=0&&t[a].to>n.from?t[a].to=s.to:t.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return t}function hZe(e,t,r=t.selection.ranges){let n=r.map(a=>Hue(t,a.from).block);if(!n.every(a=>a))return null;let s=r.map((a,i)=>ZQt(t,n[i],a.from,a.to));if(e!=2&&!s.every(a=>a))return{changes:t.changes(r.map((a,i)=>s[i]?[]:[{from:a.from,insert:n[i].open+" "},{from:a.to,insert:" "+n[i].close}]))};if(e!=1&&s.some(a=>a)){let a=[];for(let i=0,l;i<s.length;i++)if(l=s[i]){let c=n[i],{open:u,close:d}=l;a.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+c.close.length})}return{changes:a}}return null}function XQt(e,t,r=t.selection.ranges){let n=[],s=-1;e:for(let{from:a,to:i}of r){let l=n.length,c=1e9,u;for(let d=a;d<=i;){let f=t.doc.lineAt(d);if(u==null&&(u=Hue(t,f.from).line,!u))continue e;if(f.from>s&&(a==i||i>f.from)){s=f.from;let h=/^\s*/.exec(f.text)[0].length,p=h==f.length,m=f.text.slice(h,h+u.length)==u?h:-1;h<f.text.length&&h<c&&(c=h),n.push({line:f,comment:m,token:u,indent:h,empty:p,single:!1})}d=f.to+1}if(c<1e9)for(let d=l;d<n.length;d++)n[d].indent<n[d].line.text.length&&(n[d].indent=c);n.length==l+1&&(n[l].single=!0)}if(e!=2&&n.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:l,token:c,indent:u,empty:d,single:f}of n)(f||!d)&&a.push({from:l.from+u,insert:c+" "});let i=t.changes(a);return{changes:i,selection:t.selection.map(i,1)}}else if(e!=1&&n.some(a=>a.comment>=0)){let a=[];for(let{line:i,comment:l,token:c}of n)if(l>=0){let u=i.from+l,d=u+c.length;i.text[d-i.from]==" "&&d++,a.push({from:u,to:d})}return{changes:a}}return null}const tse=vg.define(),KQt=vg.define(),JQt=Kt.define(),pZe=Kt.define({combine(e){return bg(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,r)=>(n,s)=>t(n,s)||r(n,s)})}}),mZe=Oo.define({create(){return Pm.empty},update(e,t){let r=t.state.facet(pZe),n=t.annotation(tse);if(n){let c=zu.fromTransaction(t,n.selection),u=n.side,d=u==0?e.undone:e.done;return c?d=Q3(d,d.length,r.minDepth,c):d=vZe(d,t.startState.selection),new Pm(u==0?n.rest:d,u==0?d:n.rest)}let s=t.annotation(KQt);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(Mo.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=zu.fromTransaction(t),i=t.annotation(Mo.time),l=t.annotation(Mo.userEvent);return a?e=e.addChanges(a,i,l,r,t):t.selection&&(e=e.addSelection(t.startState.selection,i,l,r.newGroupDelay)),(s=="full"||s=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new Pm(e.done.map(zu.fromJSON),e.undone.map(zu.fromJSON))}});function eWt(e={}){return[mZe,pZe.of(e),ft.domEventHandlers({beforeinput(t,r){let n=t.inputType=="historyUndo"?gZe:t.inputType=="historyRedo"?rse:null;return n?(t.preventDefault(),n(r)):!1}})]}function $F(e,t){return function({state:r,dispatch:n}){if(!t&&r.readOnly)return!1;let s=r.field(mZe,!1);if(!s)return!1;let a=s.pop(e,r,t);return a?(n(a),!0):!1}}const gZe=$F(0,!1),rse=$F(1,!1),tWt=$F(0,!0),rWt=$F(1,!0);class zu{constructor(t,r,n,s,a){this.changes=t,this.effects=r,this.mapped=n,this.startSelection=s,this.selectionsAfter=a}setSelAfter(t){return new zu(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,r,n;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new zu(t.changes&&Io.fromJSON(t.changes),[],t.mapped&&Wm.fromJSON(t.mapped),t.startSelection&&nt.fromJSON(t.startSelection),t.selectionsAfter.map(nt.fromJSON))}static fromTransaction(t,r){let n=ch;for(let s of t.startState.facet(JQt)){let a=s(t);a.length&&(n=n.concat(a))}return!n.length&&t.changes.empty?null:new zu(t.changes.invert(t.startState.doc),n,void 0,r||t.startState.selection,ch)}static selection(t){return new zu(void 0,ch,void 0,void 0,t)}}function Q3(e,t,r,n){let s=t+1>r+20?t-r-1:0,a=e.slice(s,t);return a.push(n),a}function nWt(e,t){let r=[],n=!1;return e.iterChangedRanges((s,a)=>r.push(s,a)),t.iterChangedRanges((s,a,i,l)=>{for(let c=0;c<r.length;){let u=r[c++],d=r[c++];l>=u&&i<=d&&(n=!0)}}),n}function sWt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((r,n)=>r.empty!=t.ranges[n].empty).length===0}function yZe(e,t){return e.length?t.length?e.concat(t):e:t}const ch=[],aWt=200;function vZe(e,t){if(e.length){let r=e[e.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-aWt));return n.length&&n[n.length-1].eq(t)?e:(n.push(t),Q3(e,e.length-1,1e9,r.setSelAfter(n)))}else return[zu.selection([t])]}function iWt(e){let t=e[e.length-1],r=e.slice();return r[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),r}function vV(e,t){if(!e.length)return e;let r=e.length,n=ch;for(;r;){let s=oWt(e[r-1],t,n);if(s.changes&&!s.changes.empty||s.effects.length){let a=e.slice(0,r);return a[r-1]=s,a}else t=s.mapped,r--,n=s.selectionsAfter}return n.length?[zu.selection(n)]:ch}function oWt(e,t,r){let n=yZe(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):ch,r);if(!e.changes)return zu.selection(n);let s=e.changes.map(t),a=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(a):a;return new zu(s,rn.mapEffects(e.effects,t),i,e.startSelection.map(a),n)}const lWt=/^(input\.type|delete)($|\.)/;class Pm{constructor(t,r,n=0,s=void 0){this.done=t,this.undone=r,this.prevTime=n,this.prevUserEvent=s}isolate(){return this.prevTime?new Pm(this.done,this.undone):this}addChanges(t,r,n,s,a){let i=this.done,l=i[i.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!n||lWt.test(n))&&(!l.selectionsAfter.length&&r-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,nWt(l.changes,t.changes))||n=="input.type.compose")?i=Q3(i,i.length-1,s.minDepth,new zu(t.changes.compose(l.changes),yZe(rn.mapEffects(t.effects,l.changes),l.effects),l.mapped,l.startSelection,ch)):i=Q3(i,i.length,s.minDepth,t),new Pm(i,ch,r,n)}addSelection(t,r,n,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:ch;return a.length>0&&r-this.prevTime<s&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&sWt(a[a.length-1],t)?this:new Pm(vZe(this.done,t),this.undone,r,n)}addMapping(t){return new Pm(vV(this.done,t),vV(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,r,n){let s=t==0?this.done:this.undone;if(s.length==0)return null;let a=s[s.length-1],i=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):r.selection);if(n&&a.selectionsAfter.length)return r.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:tse.of({side:t,rest:iWt(s),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let l=s.length==1?ch:s.slice(0,s.length-1);return a.mapped&&(l=vV(l,a.mapped)),r.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:tse.of({side:t,rest:l,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Pm.empty=new Pm(ch,ch);const cWt=[{key:"Mod-z",run:gZe,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:rse,preventDefault:!0},{linux:"Ctrl-Shift-z",run:rse,preventDefault:!0},{key:"Mod-u",run:tWt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:rWt,preventDefault:!0}];function qE(e,t){return nt.create(e.ranges.map(t),e.mainIndex)}function Fp(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function zp({state:e,dispatch:t},r){let n=qE(e.selection,r);return n.eq(e.selection,!0)?!1:(t(Fp(e,n)),!0)}function FF(e,t){return nt.cursor(t?e.to:e.from)}function bZe(e,t){return zp(e,r=>r.empty?e.moveByChar(r,t):FF(r,t))}function Ec(e){return e.textDirectionAt(e.state.selection.main.head)==Da.LTR}const xZe=e=>bZe(e,!Ec(e)),wZe=e=>bZe(e,Ec(e));function SZe(e,t){return zp(e,r=>r.empty?e.moveByGroup(r,t):FF(r,t))}const uWt=e=>SZe(e,!Ec(e)),dWt=e=>SZe(e,Ec(e));function fWt(e,t,r){if(t.type.prop(r))return!0;let n=t.to-t.from;return n&&(n>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function zF(e,t,r){let n=Aa(e).resolveInner(t.head),s=r?hn.closedBy:hn.openedBy;for(let c=t.head;;){let u=r?n.childAfter(c):n.childBefore(c);if(!u)break;fWt(e,u,s)?n=u:c=r?u.to:u.from}let a=n.type.prop(s),i,l;return a&&(i=r?Rm(e,n.from,1):Rm(e,n.to,-1))&&i.matched?l=r?i.end.to:i.end.from:l=r?n.to:n.from,nt.cursor(l,r?-1:1)}const hWt=e=>zp(e,t=>zF(e.state,t,!Ec(e))),pWt=e=>zp(e,t=>zF(e.state,t,Ec(e)));function OZe(e,t){return zp(e,r=>{if(!r.empty)return FF(r,t);let n=e.moveVertically(r,t);return n.head!=r.head?n:e.moveToLineBoundary(r,t)})}const kZe=e=>OZe(e,!1),_Ze=e=>OZe(e,!0);function EZe(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,n=0,s;if(t){for(let a of e.state.facet(ft.scrollMargins)){let i=a(e);i?.top&&(r=Math.max(i?.top,r)),i?.bottom&&(n=Math.max(i?.bottom,n))}s=e.scrollDOM.clientHeight-r-n}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:n,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function CZe(e,t){let r=EZe(e),{state:n}=e,s=qE(n.selection,i=>i.empty?e.moveVertically(i,t,r.height):FF(i,t));if(s.eq(n.selection))return!1;let a;if(r.selfScroll){let i=e.coordsAtPos(n.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),c=l.top+r.marginTop,u=l.bottom-r.marginBottom;i&&i.top>c&&i.bottom<u&&(a=ft.scrollIntoView(s.main.head,{y:"start",yMargin:i.top-c}))}return e.dispatch(Fp(n,s),{effects:a}),!0}const Nke=e=>CZe(e,!1),nse=e=>CZe(e,!0);function Xx(e,t,r){let n=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,r);if(s.head==t.head&&s.head!=(r?n.to:n.from)&&(s=e.moveToLineBoundary(t,r,!1)),!r&&s.head==n.from&&n.length){let a=/^\s*/.exec(e.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;a&&t.head!=n.from+a&&(s=nt.cursor(n.from+a))}return s}const mWt=e=>zp(e,t=>Xx(e,t,!0)),gWt=e=>zp(e,t=>Xx(e,t,!1)),yWt=e=>zp(e,t=>Xx(e,t,!Ec(e))),vWt=e=>zp(e,t=>Xx(e,t,Ec(e))),bWt=e=>zp(e,t=>nt.cursor(e.lineBlockAt(t.head).from,1)),xWt=e=>zp(e,t=>nt.cursor(e.lineBlockAt(t.head).to,-1));function wWt(e,t,r){let n=!1,s=qE(e.selection,a=>{let i=Rm(e,a.head,-1)||Rm(e,a.head,1)||a.head>0&&Rm(e,a.head-1,1)||a.head<e.doc.length&&Rm(e,a.head+1,-1);if(!i||!i.end)return a;n=!0;let l=i.start.from==a.head?i.end.to:i.end.from;return nt.cursor(l)});return n?(t(Fp(e,s)),!0):!1}const SWt=({state:e,dispatch:t})=>wWt(e,t);function Lh(e,t){let r=qE(e.state.selection,n=>{let s=t(n);return nt.range(n.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(Fp(e.state,r)),!0)}function jZe(e,t){return Lh(e,r=>e.moveByChar(r,t))}const TZe=e=>jZe(e,!Ec(e)),NZe=e=>jZe(e,Ec(e));function AZe(e,t){return Lh(e,r=>e.moveByGroup(r,t))}const OWt=e=>AZe(e,!Ec(e)),kWt=e=>AZe(e,Ec(e)),_Wt=e=>Lh(e,t=>zF(e.state,t,!Ec(e))),EWt=e=>Lh(e,t=>zF(e.state,t,Ec(e)));function IZe(e,t){return Lh(e,r=>e.moveVertically(r,t))}const RZe=e=>IZe(e,!1),PZe=e=>IZe(e,!0);function MZe(e,t){return Lh(e,r=>e.moveVertically(r,t,EZe(e).height))}const Ake=e=>MZe(e,!1),Ike=e=>MZe(e,!0),CWt=e=>Lh(e,t=>Xx(e,t,!0)),jWt=e=>Lh(e,t=>Xx(e,t,!1)),TWt=e=>Lh(e,t=>Xx(e,t,!Ec(e))),NWt=e=>Lh(e,t=>Xx(e,t,Ec(e))),AWt=e=>Lh(e,t=>nt.cursor(e.lineBlockAt(t.head).from)),IWt=e=>Lh(e,t=>nt.cursor(e.lineBlockAt(t.head).to)),Rke=({state:e,dispatch:t})=>(t(Fp(e,{anchor:0})),!0),Pke=({state:e,dispatch:t})=>(t(Fp(e,{anchor:e.doc.length})),!0),Mke=({state:e,dispatch:t})=>(t(Fp(e,{anchor:e.selection.main.anchor,head:0})),!0),Dke=({state:e,dispatch:t})=>(t(Fp(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),RWt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),PWt=({state:e,dispatch:t})=>{let r=BF(e).map(({from:n,to:s})=>nt.range(n,Math.min(s+1,e.doc.length)));return t(e.update({selection:nt.create(r),userEvent:"select"})),!0},MWt=({state:e,dispatch:t})=>{let r=qE(e.selection,n=>{let s=Aa(e),a=s.resolveStack(n.from,1);if(n.empty){let i=s.resolveStack(n.from,-1);i.node.from>=a.node.from&&i.node.to<=a.node.to&&(a=i)}for(let i=a;i;i=i.next){let{node:l}=i;if((l.from<n.from&&l.to>=n.to||l.to>n.to&&l.from<=n.from)&&i.next)return nt.range(l.to,l.from)}return n});return r.eq(e.selection)?!1:(t(Fp(e,r)),!0)};function DZe(e,t){let{state:r}=e,n=r.selection,s=r.selection.ranges.slice();for(let a of r.selection.ranges){let i=r.doc.lineAt(a.head);if(t?i.to<e.state.doc.length:i.from>0)for(let l=a;;){let c=e.moveVertically(l,t);if(c.head<i.from||c.head>i.to){s.some(u=>u.head==c.head)||s.push(c);break}else{if(c.head==l.head)break;l=c}}}return s.length==n.ranges.length?!1:(e.dispatch(Fp(r,nt.create(s,s.length-1))),!0)}const DWt=e=>DZe(e,!1),LWt=e=>DZe(e,!0),$Wt=({state:e,dispatch:t})=>{let r=e.selection,n=null;return r.ranges.length>1?n=nt.create([r.main]):r.main.empty||(n=nt.create([nt.cursor(r.main.head)])),n?(t(Fp(e,n)),!0):!1};function BR(e,t){if(e.state.readOnly)return!1;let r="delete.selection",{state:n}=e,s=n.changeByRange(a=>{let{from:i,to:l}=a;if(i==l){let c=t(a);c<i?(r="delete.backward",c=eD(e,c,!1)):c>i&&(r="delete.forward",c=eD(e,c,!0)),i=Math.min(i,c),l=Math.max(l,c)}else i=eD(e,i,!1),l=eD(e,l,!0);return i==l?{range:a}:{changes:{from:i,to:l},range:nt.cursor(i,i<a.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(n.update(s,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?ft.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function eD(e,t,r){if(e instanceof ft)for(let n of e.state.facet(ft.atomicRanges).map(s=>s(e)))n.between(t,t,(s,a)=>{s<t&&a>t&&(t=r?a:s)});return t}const LZe=(e,t,r)=>BR(e,n=>{let s=n.from,{state:a}=e,i=a.doc.lineAt(s),l,c;if(r&&!t&&s>i.from&&s<i.from+200&&!/[^ \t]/.test(l=i.text.slice(0,s-i.from))){if(l[l.length-1]==" ")return s-1;let u=Ep(l,a.tabSize),d=u%fS(a)||fS(a);for(let f=0;f<d&&l[l.length-1-f]==" ";f++)s--;c=s}else c=bl(i.text,s-i.from,t,t)+i.from,c==s&&i.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(i.text.slice(c-i.from,s-i.from))&&(c=bl(i.text,c-i.from,!1,!1)+i.from);return c}),sse=e=>LZe(e,!1,!0),$Ze=e=>LZe(e,!0,!1),FZe=(e,t)=>BR(e,r=>{let n=r.head,{state:s}=e,a=s.doc.lineAt(n),i=s.charCategorizer(n);for(let l=null;;){if(n==(t?a.to:a.from)){n==r.head&&a.number!=(t?s.doc.lines:1)&&(n+=t?1:-1);break}let c=bl(a.text,n-a.from,t)+a.from,u=a.text.slice(Math.min(n,c)-a.from,Math.max(n,c)-a.from),d=i(u);if(l!=null&&d!=l)break;(u!=" "||n!=r.head)&&(l=d),n=c}return n}),zZe=e=>FZe(e,!1),FWt=e=>FZe(e,!0),zWt=e=>BR(e,t=>{let r=e.lineBlockAt(t.head).to;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),BWt=e=>BR(e,t=>{let r=e.moveToLineBoundary(t,!1).head;return t.head>r?r:Math.max(0,t.head-1)}),UWt=e=>BR(e,t=>{let r=e.moveToLineBoundary(t,!0).head;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),VWt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Fs.of(["",""])},range:nt.cursor(n.from)}));return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},qWt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{if(!n.empty||n.from==0||n.from==e.doc.length)return{range:n};let s=n.from,a=e.doc.lineAt(s),i=s==a.from?s-1:bl(a.text,s-a.from,!1)+a.from,l=s==a.to?s+1:bl(a.text,s-a.from,!0)+a.from;return{changes:{from:i,to:l,insert:e.doc.slice(s,l).append(e.doc.slice(i,s))},range:nt.cursor(l)}});return r.changes.empty?!1:(t(e.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function BF(e){let t=[],r=-1;for(let n of e.selection.ranges){let s=e.doc.lineAt(n.from),a=e.doc.lineAt(n.to);if(!n.empty&&n.to==a.from&&(a=e.doc.lineAt(n.to-1)),r>=s.number){let i=t[t.length-1];i.to=a.to,i.ranges.push(n)}else t.push({from:s.from,to:a.to,ranges:[n]});r=a.number+1}return t}function BZe(e,t,r){if(e.readOnly)return!1;let n=[],s=[];for(let a of BF(e)){if(r?a.to==e.doc.length:a.from==0)continue;let i=e.doc.lineAt(r?a.to+1:a.from-1),l=i.length+1;if(r){n.push({from:a.to,to:i.to},{from:a.from,insert:i.text+e.lineBreak});for(let c of a.ranges)s.push(nt.range(Math.min(e.doc.length,c.anchor+l),Math.min(e.doc.length,c.head+l)))}else{n.push({from:i.from,to:a.from},{from:a.to,insert:e.lineBreak+i.text});for(let c of a.ranges)s.push(nt.range(c.anchor-l,c.head-l))}}return n.length?(t(e.update({changes:n,scrollIntoView:!0,selection:nt.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const HWt=({state:e,dispatch:t})=>BZe(e,t,!1),QWt=({state:e,dispatch:t})=>BZe(e,t,!0);function UZe(e,t,r){if(e.readOnly)return!1;let n=[];for(let a of BF(e))r?n.push({from:a.from,insert:e.doc.slice(a.from,a.to)+e.lineBreak}):n.push({from:a.to,insert:e.lineBreak+e.doc.slice(a.from,a.to)});let s=e.changes(n);return t(e.update({changes:s,selection:e.selection.map(s,r?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const WWt=({state:e,dispatch:t})=>UZe(e,t,!1),GWt=({state:e,dispatch:t})=>UZe(e,t,!0),ZWt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,r=t.changes(BF(t).map(({from:s,to:a})=>(s>0?s--:a<t.doc.length&&a++,{from:s,to:a}))),n=qE(t.selection,s=>{let a;if(e.lineWrapping){let i=e.lineBlockAt(s.head),l=e.coordsAtPos(s.head,s.assoc||1);l&&(a=i.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,a)}).map(r);return e.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function YWt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let r=Aa(e).resolveInner(t),n=r.childBefore(t),s=r.childAfter(t),a;return n&&s&&n.to<=t&&s.from>=t&&(a=n.type.prop(hn.closedBy))&&a.indexOf(s.name)>-1&&e.doc.lineAt(n.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(n.to,s.from))?{from:n.to,to:s.from}:null}const Lke=VZe(!1),XWt=VZe(!0);function VZe(e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let n=t.changeByRange(s=>{let{from:a,to:i}=s,l=t.doc.lineAt(a),c=!e&&a==i&&YWt(t,a);e&&(a=i=(i<=l.to?l:t.doc.lineAt(i)).to);let u=new PF(t,{simulateBreak:a,simulateDoubleBreak:!!c}),d=fue(u,a);for(d==null&&(d=Ep(/^\s*/.exec(t.doc.lineAt(a).text)[0],t.tabSize));i<l.to&&/\s/.test(l.text[i-l.from]);)i++;c?{from:a,to:i}=c:a>l.from&&a<l.from+100&&!/\S/.test(l.text.slice(0,a))&&(a=l.from);let f=["",xA(t,d)];return c&&f.push(xA(t,u.lineIndent(l.from,-1))),{changes:{from:a,to:i,insert:Fs.of(f)},range:nt.cursor(a+1+f[1].length)}});return r(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Que(e,t){let r=-1;return e.changeByRange(n=>{let s=[];for(let i=n.from;i<=n.to;){let l=e.doc.lineAt(i);l.number>r&&(n.empty||n.to>l.from)&&(t(l,s,n),r=l.number),i=l.to+1}let a=e.changes(s);return{changes:s,range:nt.range(a.mapPos(n.anchor,1),a.mapPos(n.head,1))}})}const KWt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Object.create(null),n=new PF(e,{overrideIndentation:a=>{let i=r[a];return i??-1}}),s=Que(e,(a,i,l)=>{let c=fue(n,a.from);if(c==null)return;/\S/.test(a.text)||(c=0);let u=/^\s*/.exec(a.text)[0],d=xA(e,c);(u!=d||l.from<a.from+u.length)&&(r[a.from]=c,i.push({from:a.from,to:a.from+u.length,insert:d}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},qZe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Que(e,(r,n)=>{n.push({from:r.from,insert:e.facet(BE)})}),{userEvent:"input.indent"})),!0),HZe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Que(e,(r,n)=>{let s=/^\s*/.exec(r.text)[0];if(!s)return;let a=Ep(s,e.tabSize),i=0,l=xA(e,Math.max(0,a-fS(e)));for(;i<s.length&&i<l.length&&s.charCodeAt(i)==l.charCodeAt(i);)i++;n.push({from:r.from+i,to:r.from+s.length,insert:l.slice(i)})}),{userEvent:"delete.dedent"})),!0),JWt=e=>(e.setTabFocusMode(),!0),eGt=[{key:"Ctrl-b",run:xZe,shift:TZe,preventDefault:!0},{key:"Ctrl-f",run:wZe,shift:NZe},{key:"Ctrl-p",run:kZe,shift:RZe},{key:"Ctrl-n",run:_Ze,shift:PZe},{key:"Ctrl-a",run:bWt,shift:AWt},{key:"Ctrl-e",run:xWt,shift:IWt},{key:"Ctrl-d",run:$Ze},{key:"Ctrl-h",run:sse},{key:"Ctrl-k",run:zWt},{key:"Ctrl-Alt-h",run:zZe},{key:"Ctrl-o",run:VWt},{key:"Ctrl-t",run:qWt},{key:"Ctrl-v",run:nse}],tGt=[{key:"ArrowLeft",run:xZe,shift:TZe,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:uWt,shift:OWt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:yWt,shift:TWt,preventDefault:!0},{key:"ArrowRight",run:wZe,shift:NZe,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:dWt,shift:kWt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:vWt,shift:NWt,preventDefault:!0},{key:"ArrowUp",run:kZe,shift:RZe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Rke,shift:Mke},{mac:"Ctrl-ArrowUp",run:Nke,shift:Ake},{key:"ArrowDown",run:_Ze,shift:PZe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Pke,shift:Dke},{mac:"Ctrl-ArrowDown",run:nse,shift:Ike},{key:"PageUp",run:Nke,shift:Ake},{key:"PageDown",run:nse,shift:Ike},{key:"Home",run:gWt,shift:jWt,preventDefault:!0},{key:"Mod-Home",run:Rke,shift:Mke},{key:"End",run:mWt,shift:CWt,preventDefault:!0},{key:"Mod-End",run:Pke,shift:Dke},{key:"Enter",run:Lke,shift:Lke},{key:"Mod-a",run:RWt},{key:"Backspace",run:sse,shift:sse,preventDefault:!0},{key:"Delete",run:$Ze,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:zZe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:FWt,preventDefault:!0},{mac:"Mod-Backspace",run:BWt,preventDefault:!0},{mac:"Mod-Delete",run:UWt,preventDefault:!0}].concat(eGt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),rGt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:hWt,shift:_Wt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:pWt,shift:EWt},{key:"Alt-ArrowUp",run:HWt},{key:"Shift-Alt-ArrowUp",run:WWt},{key:"Alt-ArrowDown",run:QWt},{key:"Shift-Alt-ArrowDown",run:GWt},{key:"Mod-Alt-ArrowUp",run:DWt},{key:"Mod-Alt-ArrowDown",run:LWt},{key:"Escape",run:$Wt},{key:"Mod-Enter",run:XWt},{key:"Alt-l",mac:"Ctrl-l",run:PWt},{key:"Mod-i",run:MWt,preventDefault:!0},{key:"Mod-[",run:HZe},{key:"Mod-]",run:qZe},{key:"Mod-Alt-\\",run:KWt},{key:"Shift-Mod-k",run:ZWt},{key:"Shift-Mod-\\",run:SWt},{key:"Mod-/",run:HQt},{key:"Alt-A",run:WQt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:JWt}].concat(tGt),nGt={key:"Tab",run:qZe,shift:HZe},$ke=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class Qy{constructor(t,r,n=0,s=t.length,a,i){this.test=i,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(n,s),this.bufferStart=n,this.normalize=a?l=>a($ke(l)):$ke,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Iu(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let r=Wce(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=Sm(t);let s=this.normalize(r);if(s.length)for(let a=0,i=n;;a++){let l=s.charCodeAt(a),c=this.match(l,i,this.bufferPos+this.bufferStart);if(a==s.length-1){if(c)return this.value=c,this;break}i==n&&a<r.length&&r.charCodeAt(a)==l&&i++}}}match(t,r,n){let s=null;for(let a=0;a<this.matches.length;a+=2){let i=this.matches[a],l=!1;this.query.charCodeAt(i)==t&&(i==this.query.length-1?s={from:this.matches[a+1],to:n}:(this.matches[a]++,l=!0)),l||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?s={from:r,to:n}:this.matches.push(1,r)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(Qy.prototype[Symbol.iterator]=function(){return this});const QZe={from:-1,to:-1,match:/.*/.exec("")},Wue="gm"+(/x/.unicode==null?"":"u");class WZe{constructor(t,r,n,s=0,a=t.length){if(this.text=t,this.to=a,this.curLine="",this.done=!1,this.value=QZe,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new GZe(t,r,n,s,a);this.re=new RegExp(r,Wue+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=t.iter();let i=t.lineAt(s);this.curLineStart=i.from,this.matchPos=W3(t,s),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,s=n+r[0].length;if(this.matchPos=W3(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const bV=new WeakMap;class qk{constructor(t,r){this.from=t,this.text=r}get to(){return this.from+this.text.length}static get(t,r,n){let s=bV.get(t);if(!s||s.from>=n||s.to<=r){let l=new qk(r,t.sliceString(r,n));return bV.set(t,l),l}if(s.from==r&&s.to==n)return s;let{text:a,from:i}=s;return i>r&&(a=t.sliceString(r,i)+a,i=r),s.to<n&&(a+=t.sliceString(s.to,n)),bV.set(t,new qk(i,a)),new qk(r,a.slice(r-i,n-i))}}class GZe{constructor(t,r,n,s,a){this.text=t,this.to=a,this.done=!1,this.value=QZe,this.matchPos=W3(t,s),this.re=new RegExp(r,Wue+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=qk.get(t,s,this.chunkEnd(s+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==t&&(this.re.lastIndex=t+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,s=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this.matchPos=W3(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=qk.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(WZe.prototype[Symbol.iterator]=GZe.prototype[Symbol.iterator]=function(){return this});function sGt(e){try{return new RegExp(e,Wue),!0}catch{return!1}}function W3(e,t){if(t>=e.length)return t;let r=e.lineAt(t),n;for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}const aGt=e=>{let{state:t}=e,r=String(t.doc.lineAt(e.state.selection.main.head).number),{close:n,result:s}=H7t(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:t.phrase("go")});return s.then(a=>{let i=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!i){e.dispatch({effects:n});return}let l=t.doc.lineAt(t.selection.main.head),[,c,u,d,f]=i,h=d?+d.slice(1):0,p=u?+u:l.number;if(u&&f){let y=p/100;c&&(y=y*(c=="-"?-1:1)+l.number/t.doc.lines),p=Math.round(t.doc.lines*y)}else u&&c&&(p=p*(c=="-"?-1:1)+l.number);let m=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),g=nt.cursor(m.from+Math.max(0,Math.min(h,m.length)));e.dispatch({effects:[n,ft.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},iGt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},oGt=Kt.define({combine(e){return bg(e,iGt,{highlightWordAroundCursor:(t,r)=>t||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function lGt(e){return[hGt,fGt]}const cGt=er.mark({class:"cm-selectionMatch"}),uGt=er.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Fke(e,t,r,n){return(r==0||e(t.sliceDoc(r-1,r))!=bi.Word)&&(n==t.doc.length||e(t.sliceDoc(n,n+1))!=bi.Word)}function dGt(e,t,r,n){return e(t.sliceDoc(r,r+1))==bi.Word&&e(t.sliceDoc(n-1,n))==bi.Word}const fGt=Si.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(oGt),{state:r}=e,n=r.selection;if(n.ranges.length>1)return er.none;let s=n.main,a,i=null;if(s.empty){if(!t.highlightWordAroundCursor)return er.none;let c=r.wordAt(s.head);if(!c)return er.none;i=r.charCategorizer(s.head),a=r.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c<t.minSelectionLength||c>200)return er.none;if(t.wholeWords){if(a=r.sliceDoc(s.from,s.to),i=r.charCategorizer(s.head),!(Fke(i,r,s.from,s.to)&&dGt(i,r,s.from,s.to)))return er.none}else if(a=r.sliceDoc(s.from,s.to),!a)return er.none}let l=[];for(let c of e.visibleRanges){let u=new Qy(r.doc,a,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!i||Fke(i,r,d,f))&&(s.empty&&d<=s.from&&f>=s.to?l.push(uGt.range(d,f)):(d>=s.to||f<=s.from)&&l.push(cGt.range(d,f)),l.length>t.maxMatches))return er.none}}return er.set(l)}},{decorations:e=>e.decorations}),hGt=ft.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),pGt=({state:e,dispatch:t})=>{let{selection:r}=e,n=nt.create(r.ranges.map(s=>e.wordAt(s.head)||nt.cursor(s.head)),r.mainIndex);return n.eq(r)?!1:(t(e.update({selection:n})),!0)};function mGt(e,t){let{main:r,ranges:n}=e.selection,s=e.wordAt(r.head),a=s&&s.from==r.from&&s.to==r.to;for(let i=!1,l=new Qy(e.doc,t,n[n.length-1].to);;)if(l.next(),l.done){if(i)return null;l=new Qy(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),i=!0}else{if(i&&n.some(c=>c.from==l.value.from))continue;if(a){let c=e.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const gGt=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(a=>a.from===a.to))return pGt({state:e,dispatch:t});let n=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(a=>e.sliceDoc(a.from,a.to)!=n))return!1;let s=mGt(e,n);return s?(t(e.update({selection:e.selection.addRange(nt.range(s.from,s.to),!1),effects:ft.scrollIntoView(s.to)})),!0):!1},HE=Kt.define({combine(e){return bg(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new NGt(t),scrollToMatch:t=>ft.scrollIntoView(t)})}});class ZZe{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||sGt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord,this.test=t.test}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
|
|
113
113
|
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord&&this.test==t.test}create(){return this.regexp?new SGt(this):new bGt(this)}getCursor(t,r=0,n){let s=t.doc?t:zn.create({doc:t});return n==null&&(n=s.doc.length),this.regexp?qO(this,s,r,n):VO(this,s,r,n)}}class YZe{constructor(t){this.spec=t}}function yGt(e,t,r){return(n,s,a,i)=>{if(r&&!r(n,s,a,i))return!1;let l=n>=i&&s<=i+a.length?a.slice(n-i,s-i):t.doc.sliceString(n,s);return e(l,t,n,s)}}function VO(e,t,r,n){let s;return e.wholeWord&&(s=vGt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(s=yGt(e.test,t,s)),new Qy(t.doc,e.unquoted,r,n,e.caseSensitive?void 0:a=>a.toLowerCase(),s)}function vGt(e,t){return(r,n,s,a)=>((a>r||a+s.length<n)&&(a=Math.max(0,r-2),s=e.sliceString(a,Math.min(e.length,n+2))),(t(G3(s,r-a))!=bi.Word||t(Z3(s,r-a))!=bi.Word)&&(t(Z3(s,n-a))!=bi.Word||t(G3(s,n-a))!=bi.Word))}class bGt extends YZe{constructor(t){super(t)}nextMatch(t,r,n){let s=VO(this.spec,t,n,t.doc.length).nextOverlapping();if(s.done){let a=Math.min(t.doc.length,r+this.spec.unquoted.length);s=VO(this.spec,t,0,a).nextOverlapping()}return s.done||s.value.from==r&&s.value.to==n?null:s.value}prevMatchInRange(t,r,n){for(let s=n;;){let a=Math.max(r,s-1e4-this.spec.unquoted.length),i=VO(this.spec,t,a,s),l=null;for(;!i.nextOverlapping().done;)l=i.value;if(l)return l;if(a==r)return null;s-=1e4}}prevMatch(t,r,n){let s=this.prevMatchInRange(t,0,r);return s||(s=this.prevMatchInRange(t,Math.max(0,n-this.spec.unquoted.length),t.doc.length)),s&&(s.from!=r||s.to!=n)?s:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,r){let n=VO(this.spec,t,0,t.doc.length),s=[];for(;!n.next().done;){if(s.length>=r)return null;s.push(n.value)}return s}highlight(t,r,n,s){let a=VO(this.spec,t,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,t.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}function xGt(e,t,r){return(n,s,a)=>(!r||r(n,s,a))&&e(a[0],t,n,s)}function qO(e,t,r,n){let s;return e.wholeWord&&(s=wGt(t.charCategorizer(t.selection.main.head))),e.test&&(s=xGt(e.test,t,s)),new WZe(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:s},r,n)}function G3(e,t){return e.slice(bl(e,t,!1),t)}function Z3(e,t){return e.slice(t,bl(e,t))}function wGt(e){return(t,r,n)=>!n[0].length||(e(G3(n.input,n.index))!=bi.Word||e(Z3(n.input,n.index))!=bi.Word)&&(e(Z3(n.input,n.index+n[0].length))!=bi.Word||e(G3(n.input,n.index+n[0].length))!=bi.Word)}class SGt extends YZe{nextMatch(t,r,n){let s=qO(this.spec,t,n,t.doc.length).next();return s.done&&(s=qO(this.spec,t,0,r).next()),s.done?null:s.value}prevMatchInRange(t,r,n){for(let s=1;;s++){let a=Math.max(r,n-s*1e4),i=qO(this.spec,t,a,n),l=null;for(;!i.next().done;)l=i.value;if(l&&(a==r||l.from>a+10))return l;if(a==r)return null}}prevMatch(t,r,n){return this.prevMatchInRange(t,0,r)||this.prevMatchInRange(t,n,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return t.match[0];if(n=="$")return"$";for(let s=n.length;s>0;s--){let a=+n.slice(0,s);if(a>0&&a<t.match.length)return t.match[a]+n.slice(s)}return r})}matchAll(t,r){let n=qO(this.spec,t,0,t.doc.length),s=[];for(;!n.next().done;){if(s.length>=r)return null;s.push(n.value)}return s}highlight(t,r,n,s){let a=qO(this.spec,t,Math.max(0,r-250),Math.min(n+250,t.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}const NA=rn.define(),Gue=rn.define(),Hb=Oo.define({create(e){return new xV(ase(e).create(),null)},update(e,t){for(let r of t.effects)r.is(NA)?e=new xV(r.value.create(),e.panel):r.is(Gue)&&(e=new xV(e.query,r.value?Zue:null));return e},provide:e=>bA.from(e,t=>t.panel)});class xV{constructor(t,r){this.query=t,this.panel=r}}const OGt=er.mark({class:"cm-searchMatch"}),kGt=er.mark({class:"cm-searchMatch cm-searchMatch-selected"}),_Gt=Si.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Hb))}update(e){let t=e.state.field(Hb);(t!=e.startState.field(Hb)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return er.none;let{view:r}=this,n=new au;for(let s=0,a=r.visibleRanges,i=a.length;s<i;s++){let{from:l,to:c}=a[s];for(;s<i-1&&c>a[s+1].from-500;)c=a[++s].to;e.highlight(r.state,l,c,(u,d)=>{let f=r.state.selection.ranges.some(h=>h.from==u&&h.to==d);n.add(u,d,f?kGt:OGt)})}return n.finish()}},{decorations:e=>e.decorations});function UR(e){return t=>{let r=t.state.field(Hb,!1);return r&&r.query.spec.valid?e(t,r):JZe(t)}}const Y3=UR((e,{query:t})=>{let{to:r}=e.state.selection.main,n=t.nextMatch(e.state,r,r);if(!n)return!1;let s=nt.single(n.from,n.to),a=e.state.facet(HE);return e.dispatch({selection:s,effects:[Yue(e,n),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),KZe(e),!0}),X3=UR((e,{query:t})=>{let{state:r}=e,{from:n}=r.selection.main,s=t.prevMatch(r,n,n);if(!s)return!1;let a=nt.single(s.from,s.to),i=e.state.facet(HE);return e.dispatch({selection:a,effects:[Yue(e,s),i.scrollToMatch(a.main,e)],userEvent:"select.search"}),KZe(e),!0}),EGt=UR((e,{query:t})=>{let r=t.matchAll(e.state,1e3);return!r||!r.length?!1:(e.dispatch({selection:nt.create(r.map(n=>nt.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),CGt=({state:e,dispatch:t})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:s}=r.main,a=[],i=0;for(let l=new Qy(e.doc,e.sliceDoc(n,s));!l.next().done;){if(a.length>1e3)return!1;l.value.from==n&&(i=a.length),a.push(nt.range(l.value.from,l.value.to))}return t(e.update({selection:nt.create(a,i),userEvent:"select.search.matches"})),!0},zke=UR((e,{query:t})=>{let{state:r}=e,{from:n,to:s}=r.selection.main;if(r.readOnly)return!1;let a=t.nextMatch(r,n,n);if(!a)return!1;let i=a,l=[],c,u,d=[];i.from==n&&i.to==s&&(u=r.toText(t.getReplacement(i)),l.push({from:i.from,to:i.to,insert:u}),i=t.nextMatch(r,i.from,i.to),d.push(ft.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+".")));let f=e.state.changes(l);return i&&(c=nt.single(i.from,i.to).map(f),d.push(Yue(e,i)),d.push(r.facet(HE).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),jGt=UR((e,{query:t})=>{if(e.state.readOnly)return!1;let r=t.matchAll(e.state,1e9).map(s=>{let{from:a,to:i}=s;return{from:a,to:i,insert:t.getReplacement(s)}});if(!r.length)return!1;let n=e.state.phrase("replaced $ matches",r.length)+".";return e.dispatch({changes:r,effects:ft.announce.of(n),userEvent:"input.replace.all"}),!0});function Zue(e){return e.state.facet(HE).createPanel(e)}function ase(e,t){var r,n,s,a,i;let l=e.selection.main,c=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!c)return t;let u=e.facet(HE);return new ZZe({search:((r=t?.literal)!==null&&r!==void 0?r:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(n=t?.caseSensitive)!==null&&n!==void 0?n:u.caseSensitive,literal:(s=t?.literal)!==null&&s!==void 0?s:u.literal,regexp:(a=t?.regexp)!==null&&a!==void 0?a:u.regexp,wholeWord:(i=t?.wholeWord)!==null&&i!==void 0?i:u.wholeWord})}function XZe(e){let t=uue(e,Zue);return t&&t.dom.querySelector("[main-field]")}function KZe(e){let t=XZe(e);t&&t==e.root.activeElement&&t.select()}const JZe=e=>{let t=e.state.field(Hb,!1);if(t&&t.panel){let r=XZe(e);if(r&&r!=e.root.activeElement){let n=ase(e.state,t.query.spec);n.valid&&e.dispatch({effects:NA.of(n)}),r.focus(),r.select()}}else e.dispatch({effects:[Gue.of(!0),t?NA.of(ase(e.state,t.query.spec)):rn.appendConfig.of(IGt)]});return!0},eYe=e=>{let t=e.state.field(Hb,!1);if(!t||!t.panel)return!1;let r=uue(e,Zue);return r&&r.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Gue.of(!1)}),!0},TGt=[{key:"Mod-f",run:JZe,scope:"editor search-panel"},{key:"F3",run:Y3,shift:X3,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Y3,shift:X3,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:eYe,scope:"editor search-panel"},{key:"Mod-Shift-l",run:CGt},{key:"Mod-Alt-g",run:aGt},{key:"Mod-d",run:gGt,preventDefault:!0}];class NGt{constructor(t){this.view=t;let r=this.query=t.state.field(Hb).query.spec;this.commit=this.commit.bind(this),this.searchField=_a("input",{value:r.search,placeholder:Od(t,"Find"),"aria-label":Od(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=_a("input",{value:r.replace,placeholder:Od(t,"Replace"),"aria-label":Od(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=_a("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=_a("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=_a("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(s,a,i){return _a("button",{class:"cm-button",name:s,onclick:a,type:"button"},i)}this.dom=_a("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>Y3(t),[Od(t,"next")]),n("prev",()=>X3(t),[Od(t,"previous")]),n("select",()=>EGt(t),[Od(t,"all")]),_a("label",null,[this.caseField,Od(t,"match case")]),_a("label",null,[this.reField,Od(t,"regexp")]),_a("label",null,[this.wordField,Od(t,"by word")]),...t.state.readOnly?[]:[_a("br"),this.replaceField,n("replace",()=>zke(t),[Od(t,"replace")]),n("replaceAll",()=>jGt(t),[Od(t,"replace all")])],_a("button",{name:"close",onclick:()=>eYe(t),"aria-label":Od(t,"close"),type:"button"},["×"])])}commit(){let t=new ZZe({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:NA.of(t)}))}keydown(t){r7t(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?X3:Y3)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),zke(this.view))}update(t){for(let r of t.transactions)for(let n of r.effects)n.is(NA)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(HE).top}}function Od(e,t){return e.state.phrase(t)}const tD=30,rD=/[\s\.,:;?!]/;function Yue(e,{from:t,to:r}){let n=e.state.doc.lineAt(t),s=e.state.doc.lineAt(r).to,a=Math.max(n.from,t-tD),i=Math.min(s,r+tD),l=e.state.sliceDoc(a,i);if(a!=n.from){for(let c=0;c<tD;c++)if(!rD.test(l[c+1])&&rD.test(l[c])){l=l.slice(c);break}}if(i!=s){for(let c=l.length-1;c>l.length-tD;c--)if(!rD.test(l[c-1])&&rD.test(l[c])){l=l.slice(0,c);break}}return ft.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${n.number}.`)}const AGt=ft.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),IGt=[Hb,Lp.low(_Gt),AGt];class Bke{constructor(t,r,n){this.from=t,this.to=r,this.diagnostic=n}}class yw{constructor(t,r,n){this.diagnostics=t,this.panel=r,this.selected=n}static init(t,r,n){let s=n.facet(AA).markerFilter;s&&(t=s(t,n));let a=t.slice().sort((d,f)=>d.from-f.from||d.to-f.to),i=new au,l=[],c=0;for(let d=0;;){let f=d==a.length?null:a[d];if(!f&&!l.length)break;let h,p;for(l.length?(h=c,p=l.reduce((g,y)=>Math.min(g,y.to),f&&f.from>h?f.from:1e8)):(h=f.from,p=f.to,l.push(f),d++);d<a.length;){let g=a[d];if(g.from==h&&(g.to>g.from||g.to==h))l.push(g),d++,p=Math.min(g.to,p);else{p=Math.min(g.from,p);break}}let m=HGt(l);if(l.some(g=>g.from==g.to||g.from==g.to-1&&n.doc.lineAt(g.from).to==g.from))i.add(h,h,er.widget({widget:new BGt(m),diagnostics:l.slice()}));else{let g=l.reduce((y,x)=>x.markClass?y+" "+x.markClass:y,"");i.add(h,p,er.mark({class:"cm-lintRange cm-lintRange-"+m+g,diagnostics:l.slice(),inclusiveEnd:l.some(y=>y.to>p)}))}c=p;for(let g=0;g<l.length;g++)l[g].to<=c&&l.splice(g--,1)}let u=i.finish();return new yw(u,r,I_(u))}}function I_(e,t=null,r=0){let n=null;return e.between(r,1e9,(s,a,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!n)n=new Bke(s,a,t||i.diagnostics[0]);else{if(i.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new Bke(n.from,a,n.diagnostic)}}),n}function RGt(e,t){let r=t.pos,n=t.end||r,s=e.state.facet(AA).hideOn(e,r,n);if(s!=null)return s;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(i=>i.is(tYe))||e.changes.touchesRange(a.from,Math.max(a.to,n)))}function PGt(e,t){return e.field(Hd,!1)?t:t.concat(rn.appendConfig.of(QGt))}const tYe=rn.define(),Xue=rn.define(),rYe=rn.define(),Hd=Oo.define({create(){return new yw(er.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let r=e.diagnostics.map(t.changes),n=null,s=e.panel;if(e.selected){let a=t.changes.mapPos(e.selected.from,1);n=I_(r,e.selected.diagnostic,a)||I_(r,null,a)}!r.size&&s&&t.state.facet(AA).autoPanel&&(s=null),e=new yw(r,s,n)}for(let r of t.effects)if(r.is(tYe)){let n=t.state.facet(AA).autoPanel?r.value.length?IA.open:null:e.panel;e=yw.init(r.value,n,t.state)}else r.is(Xue)?e=new yw(e.diagnostics,r.value?IA.open:null,e.selected):r.is(rYe)&&(e=new yw(e.diagnostics,e.panel,r.value));return e},provide:e=>[bA.from(e,t=>t.panel),ft.decorations.from(e,t=>t.diagnostics)]}),MGt=er.mark({class:"cm-lintRange cm-lintRange-active"});function DGt(e,t,r){let{diagnostics:n}=e.state.field(Hd),s,a=-1,i=-1;n.between(t-(r<0?1:0),t+(r>0?1:0),(c,u,{spec:d})=>{if(t>=c&&t<=u&&(c==u||(t>c||r>0)&&(t<u||r<0)))return s=d.diagnostics,a=c,i=u,!1});let l=e.state.facet(AA).tooltipFilter;return s&&l&&(s=l(s,e.state)),s?{pos:a,end:i,above:e.state.doc.lineAt(a).to<i,create(){return{dom:LGt(e,s)}}}:null}function LGt(e,t){return _a("ul",{class:"cm-tooltip-lint"},t.map(r=>sYe(e,r,!1)))}const $Gt=e=>{let t=e.state.field(Hd,!1);(!t||!t.panel)&&e.dispatch({effects:PGt(e.state,[Xue.of(!0)])});let r=uue(e,IA.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0},Uke=e=>{let t=e.state.field(Hd,!1);return!t||!t.panel?!1:(e.dispatch({effects:Xue.of(!1)}),!0)},FGt=e=>{let t=e.state.field(Hd,!1);if(!t)return!1;let r=e.state.selection.main,n=t.diagnostics.iter(r.to+1);return!n.value&&(n=t.diagnostics.iter(0),!n.value||n.from==r.from&&n.to==r.to)?!1:(e.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},zGt=[{key:"Mod-Shift-m",run:$Gt,preventDefault:!0},{key:"F8",run:FGt}],AA=Kt.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...bg(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Vke,tooltipFilter:Vke,needsRefresh:(t,r)=>t?r?n=>t(n)||r(n):t:r,hideOn:(t,r)=>t?r?(n,s,a)=>t(n,s,a)||r(n,s,a):t:r,autoPanel:(t,r)=>t||r})}}});function Vke(e,t){return e?t?(r,n)=>t(e(r,n),n):e:t}function nYe(e){let t=[];if(e)e:for(let{name:r}of e){for(let n=0;n<r.length;n++){let s=r[n];if(/[a-zA-Z]/.test(s)&&!t.some(a=>a.toLowerCase()==s.toLowerCase())){t.push(s);continue e}}t.push("")}return t}function sYe(e,t,r){var n;let s=r?nYe(t.actions):[];return _a("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},_a("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(n=t.actions)===null||n===void 0?void 0:n.map((a,i)=>{let l=!1,c=p=>{if(p.preventDefault(),l)return;l=!0;let m=I_(e.state.field(Hd).diagnostics,t);m&&a.apply(e,m.from,m.to)},{name:u}=a,d=s[i]?u.indexOf(s[i]):-1,f=d<0?u:[u.slice(0,d),_a("u",u.slice(d,d+1)),u.slice(d+1)],h=a.markClass?" "+a.markClass:"";return _a("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${s[i]})"`}.`},f)}),t.source&&_a("div",{class:"cm-diagnosticSource"},t.source))}class BGt extends Of{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return _a("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class qke{constructor(t,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=sYe(t,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class IA{constructor(t){this.view=t,this.items=[];let r=s=>{if(s.keyCode==27)Uke(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:a}=this.items[this.selectedIndex],i=nYe(a.actions);for(let l=0;l<i.length;l++)if(i[l].toUpperCase().charCodeAt(0)==s.keyCode){let c=I_(this.view.state.field(Hd).diagnostics,a);c&&a.actions[l].apply(t,c.from,c.to)}}else return;s.preventDefault()},n=s=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(s.target)&&this.moveSelection(a)};this.list=_a("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:n}),this.dom=_a("div",{class:"cm-panel-lint"},this.list,_a("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Uke(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Hd).selected;if(!t)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==t.diagnostic)return r;return-1}update(){let{diagnostics:t,selected:r}=this.view.state.field(Hd),n=0,s=!1,a=null,i=new Set;for(t.between(0,this.view.state.doc.length,(l,c,{spec:u})=>{for(let d of u.diagnostics){if(i.has(d))continue;i.add(d);let f=-1,h;for(let p=n;p<this.items.length;p++)if(this.items[p].diagnostic==d){f=p;break}f<0?(h=new qke(this.view,d),this.items.splice(n,0,h),s=!0):(h=this.items[f],f>n&&(this.items.splice(n,f-n),s=!0)),r&&h.diagnostic==r.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),a=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new qke(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),a?(this.list.setAttribute("aria-activedescendant",a.id),this.view.requestMeasure({key:this,read:()=>({sel:a.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{let u=c.height/this.list.offsetHeight;l.top<c.top?this.list.scrollTop-=(c.top-l.top)/u:l.bottom>c.bottom&&(this.list.scrollTop+=(l.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let t=this.list.firstChild;function r(){let n=t;t=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;t!=n.dom;)r();t=n.dom.nextSibling}else this.list.insertBefore(n.dom,t);for(;t;)r()}moveSelection(t){if(this.selectedIndex<0)return;let r=this.view.state.field(Hd),n=I_(r.diagnostics,this.items[t].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:rYe.of(n)})}static open(t){return new IA(t)}}function UGt(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function nD(e){return UGt(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const VGt=ft.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:nD("#d11")},".cm-lintRange-warning":{backgroundImage:nD("orange")},".cm-lintRange-info":{backgroundImage:nD("#999")},".cm-lintRange-hint":{backgroundImage:nD("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function qGt(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function HGt(e){let t="hint",r=1;for(let n of e){let s=qGt(n.severity);s>r&&(r=s,t=n.severity)}return t}const QGt=[Hd,ft.decorations.compute([Hd],e=>{let{selected:t,panel:r}=e.field(Hd);return!t||!r||t.from==t.to?er.none:er.set([MGt.range(t.from,t.to)])}),V7t(DGt,{hideOn:RGt}),VGt];var Hke=function(t){t===void 0&&(t={});var{crosshairCursor:r=!1}=t,n=[];t.closeBracketsKeymap!==!1&&(n=n.concat(zVt)),t.defaultKeymap!==!1&&(n=n.concat(rGt)),t.searchKeymap!==!1&&(n=n.concat(TGt)),t.historyKeymap!==!1&&(n=n.concat(cWt)),t.foldKeymap!==!1&&(n=n.concat(_Ut)),t.completionKeymap!==!1&&(n=n.concat(HWe)),t.lintKeymap!==!1&&(n=n.concat(zGt));var s=[];return t.lineNumbers!==!1&&s.push(tUt()),t.highlightActiveLineGutter!==!1&&s.push(sUt()),t.highlightSpecialChars!==!1&&s.push(v7t()),t.history!==!1&&s.push(eWt()),t.foldGutter!==!1&&s.push(TUt()),t.drawSelection!==!1&&s.push(l7t()),t.dropCursor!==!1&&s.push(h7t()),t.allowMultipleSelections!==!1&&s.push(zn.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&s.push(yUt()),t.syntaxHighlighting!==!1&&s.push(Yx(RUt,{fallback:!0})),t.bracketMatching!==!1&&s.push(zUt()),t.closeBrackets!==!1&&s.push(DVt()),t.autocompletion!==!1&&s.push(qWe()),t.rectangularSelection!==!1&&s.push(I7t()),r!==!1&&s.push(M7t()),t.highlightActiveLine!==!1&&s.push(k7t()),t.highlightSelectionMatches!==!1&&s.push(lGt()),t.tabSize&&typeof t.tabSize=="number"&&s.push(BE.of(" ".repeat(t.tabSize))),s.concat([zE.of(n.flat())]).filter(Boolean)};const WGt="#e5c07b",Qke="#e06c75",GGt="#56b6c2",ZGt="#ffffff",i$="#abb2bf",ise="#7d8799",YGt="#61afef",XGt="#98c379",Wke="#d19a66",KGt="#c678dd",JGt="#21252b",Gke="#2c313a",Zke="#282c34",wV="#353a42",eZt="#3E4451",Yke="#528bff",tZt=ft.theme({"&":{color:i$,backgroundColor:Zke},".cm-content":{caretColor:Yke},".cm-cursor, .cm-dropCursor":{borderLeftColor:Yke},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:eZt},".cm-panels":{backgroundColor:JGt,color:i$},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Zke,color:ise,border:"none"},".cm-activeLineGutter":{backgroundColor:Gke},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:wV},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:wV,borderBottomColor:wV},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Gke,color:i$}}},{dark:!0}),rZt=$p.define([{tag:ne.keyword,color:KGt},{tag:[ne.name,ne.deleted,ne.character,ne.propertyName,ne.macroName],color:Qke},{tag:[ne.function(ne.variableName),ne.labelName],color:YGt},{tag:[ne.color,ne.constant(ne.name),ne.standard(ne.name)],color:Wke},{tag:[ne.definition(ne.name),ne.separator],color:i$},{tag:[ne.typeName,ne.className,ne.number,ne.changed,ne.annotation,ne.modifier,ne.self,ne.namespace],color:WGt},{tag:[ne.operator,ne.operatorKeyword,ne.url,ne.escape,ne.regexp,ne.link,ne.special(ne.string)],color:GGt},{tag:[ne.meta,ne.comment],color:ise},{tag:ne.strong,fontWeight:"bold"},{tag:ne.emphasis,fontStyle:"italic"},{tag:ne.strikethrough,textDecoration:"line-through"},{tag:ne.link,color:ise,textDecoration:"underline"},{tag:ne.heading,fontWeight:"bold",color:Qke},{tag:[ne.atom,ne.bool,ne.special(ne.variableName)],color:Wke},{tag:[ne.processingInstruction,ne.string,ne.inserted],color:XGt},{tag:ne.invalid,color:ZGt}]),nZt=[tZt,Yx(rZt)];var sZt=ft.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),aZt=function(t){t===void 0&&(t={});var{indentWithTab:r=!0,editable:n=!0,readOnly:s=!1,theme:a="light",placeholder:i="",basicSetup:l=!0}=t,c=[];switch(r&&c.unshift(zE.of([nGt])),l&&(typeof l=="boolean"?c.unshift(Hke()):c.unshift(Hke(l))),i&&c.unshift(j7t(i)),a){case"light":c.push(sZt);break;case"dark":c.push(nZt);break;case"none":break;default:c.push(a);break}return n===!1&&c.push(ft.editable.of(!1)),s&&c.push(zn.readOnly.of(!0)),[...c]},iZt=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(t=>!t.empty)});class oZt{constructor(t,r){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=r,this.timeoutMS=r,this.callbacks.push(t)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var t=this.callbacks.slice();this.callbacks.length=0,t.forEach(r=>{try{r()}catch(n){console.error("TimeoutLatch callback error:",n)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}let Xke=class{constructor(){this.interval=null,this.latches=new Set}add(t){this.latches.add(t),this.start()}remove(t){this.latches.delete(t),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(t=>{t.tick(),t.isDone&&this.remove(t)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}};var SV=null,lZt=()=>typeof window>"u"?new Xke:(SV||(SV=new Xke),SV),Kke=vg.define(),cZt=200,uZt=[];function dZt(e){var{value:t,selection:r,onChange:n,onStatistics:s,onCreateEditor:a,onUpdate:i,extensions:l=uZt,autoFocus:c,theme:u="light",height:d=null,minHeight:f=null,maxHeight:h=null,width:p=null,minWidth:m=null,maxWidth:g=null,placeholder:y="",editable:x=!0,readOnly:w=!1,indentWithTab:S=!0,basicSetup:k=!0,root:_,initialState:E}=e,[T,j]=b.useState(),[N,I]=b.useState(),[P,R]=b.useState(),$=b.useState(()=>({current:null}))[0],M=b.useState(()=>({current:null}))[0],z=ft.theme({"&":{height:d,minHeight:f,maxHeight:h,width:p,minWidth:m,maxWidth:g},"& .cm-scroller":{height:"100% !important"}}),U=ft.updateListener.of(W=>{if(W.docChanged&&typeof n=="function"&&!W.transactions.some(q=>q.annotation(Kke))){$.current?$.current.reset():($.current=new oZt(()=>{if(M.current){var q=M.current;M.current=null,q()}$.current=null},cZt),lZt().add($.current));var L=W.state.doc,Y=L.toString();n(Y,W)}s&&s(iZt(W))}),B=aZt({theme:u,editable:x,readOnly:w,placeholder:y,indentWithTab:S,basicSetup:k}),H=[U,z,...B];return i&&typeof i=="function"&&H.push(ft.updateListener.of(i)),H=H.concat(l),b.useLayoutEffect(()=>{if(T&&!P){var W={doc:t,selection:r,extensions:H},L=E?zn.fromJSON(E.json,W,E.fields):zn.create(W);if(R(L),!N){var Y=new ft({state:L,parent:T,root:_});I(Y),a&&a(Y,L)}}return()=>{N&&(R(void 0),I(void 0))}},[T,P]),b.useEffect(()=>{e.container&&j(e.container)},[e.container]),b.useEffect(()=>()=>{N&&(N.destroy(),I(void 0)),$.current&&($.current.cancel(),$.current=null)},[N]),b.useEffect(()=>{c&&N&&N.focus()},[c,N]),b.useEffect(()=>{N&&N.dispatch({effects:rn.reconfigure.of(H)})},[u,l,d,f,h,p,m,g,y,x,w,S,k,n,i]),b.useEffect(()=>{if(t!==void 0){var W=N?N.state.doc.toString():"";if(N&&t!==W){var L=$.current&&!$.current.isDone,Y=()=>{N&&t!==N.state.doc.toString()&&N.dispatch({changes:{from:0,to:N.state.doc.toString().length,insert:t||""},annotations:[Kke.of(!0)]})};L?M.current=Y:Y()}}},[t,N]),{state:P,setState:R,view:N,setView:I,container:T,setContainer:j}}var fZt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],xc=b.forwardRef((e,t)=>{var{className:r,value:n="",selection:s,extensions:a=[],onChange:i,onStatistics:l,onCreateEditor:c,onUpdate:u,autoFocus:d,theme:f="light",height:h,minHeight:p,maxHeight:m,width:g,minWidth:y,maxWidth:x,basicSetup:w,placeholder:S,indentWithTab:k,editable:_,readOnly:E,root:T,initialState:j}=e,N=Vue(e,fZt),I=b.useRef(null),{state:P,view:R,container:$,setContainer:M}=dZt({root:T,value:n,autoFocus:d,theme:f,height:h,minHeight:p,maxHeight:m,width:g,minWidth:y,maxWidth:x,basicSetup:w,placeholder:S,indentWithTab:k,editable:_,readOnly:E,selection:s,onChange:i,onStatistics:l,onCreateEditor:c,onUpdate:u,extensions:a,initialState:j});b.useImperativeHandle(t,()=>({editor:I.current,state:P,view:R}),[I,$,P,R]);var z=b.useCallback(B=>{I.current=B,M(B)},[M]);if(typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var U=typeof f=="string"?"cm-theme-"+f:"cm-theme";return o.jsx("div",kx({ref:z,className:""+U+(r?" "+r:"")},N))});xc.displayName="CodeMirror";function hZt(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const pZt=e=>{switch(e){case"success":return yZt;case"info":return bZt;case"warning":return vZt;case"error":return xZt;default:return null}},mZt=Array(12).fill(0),gZt=({visible:e,className:t})=>je.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},je.createElement("div",{className:"sonner-spinner"},mZt.map((r,n)=>je.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),yZt=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.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"})),vZt=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},je.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"})),bZt=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.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"})),xZt=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.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"})),wZt=je.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"},je.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),je.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),SZt=()=>{const[e,t]=je.useState(document.hidden);return je.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let ose=1;class OZt{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:n,...s}=t,a=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:ose++,i=this.toasts.find(c=>c.id===a),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(c=>c.id===a?(this.publish({...c,...t,id:a,title:n}),{...c,...t,id:a,dismissible:l,title:n}):c):this.addToast({title:n,...s,dismissible:l,id:a}),a},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let a=n!==void 0,i;const l=s.then(async u=>{if(i=["resolve",u],je.isValidElement(u))a=!1,this.create({id:n,type:"default",message:u});else if(_Zt(u)&&!u.ok){a=!1;const f=typeof r.error=="function"?await r.error(`HTTP error! status: ${u.status}`):r.error,h=typeof r.description=="function"?await r.description(`HTTP error! status: ${u.status}`):r.description,m=typeof f=="object"&&!je.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:h,...m})}else if(u instanceof Error){a=!1;const f=typeof r.error=="function"?await r.error(u):r.error,h=typeof r.description=="function"?await r.description(u):r.description,m=typeof f=="object"&&!je.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:h,...m})}else if(r.success!==void 0){a=!1;const f=typeof r.success=="function"?await r.success(u):r.success,h=typeof r.description=="function"?await r.description(u):r.description,m=typeof f=="object"&&!je.isValidElement(f)?f:{message:f};this.create({id:n,type:"success",description:h,...m})}}).catch(async u=>{if(i=["reject",u],r.error!==void 0){a=!1;const d=typeof r.error=="function"?await r.error(u):r.error,f=typeof r.description=="function"?await r.description(u):r.description,p=typeof d=="object"&&!je.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:f,...p})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),c=()=>new Promise((u,d)=>l.then(()=>i[0]==="reject"?d(i[1]):u(i[1])).catch(d));return typeof n!="string"&&typeof n!="number"?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(t,r)=>{const n=r?.id||ose++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const ju=new OZt,kZt=(e,t)=>{const r=t?.id||ose++;return ju.addToast({title:e,...t,id:r}),r},_Zt=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",EZt=kZt,CZt=()=>ju.toasts,jZt=()=>ju.getActiveToasts(),vc=Object.assign(EZt,{success:ju.success,info:ju.info,warning:ju.warning,error:ju.error,custom:ju.custom,message:ju.message,promise:ju.promise,dismiss:ju.dismiss,loading:ju.loading},{getHistory:CZt,getToasts:jZt});hZt("[data-sonner-toaster][dir=ltr],html[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%)}[data-sonner-toaster][dir=rtl],html[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%)}[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:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[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);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[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 rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [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)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [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;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [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);background:var(--normal-bg);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-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[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}[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}[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,0)) translateX(var(--swipe-amount-x,0));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{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{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{from{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-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--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-sonner-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-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-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, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--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-sonner-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-sonner-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]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[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]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[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]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[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]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[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:first-child{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)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{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%)}");function sD(e){return e.label!==void 0}const TZt=3,NZt="24px",AZt="16px",Jke=4e3,IZt=356,RZt=14,PZt=45,MZt=200;function sm(...e){return e.filter(Boolean).join(" ")}function DZt(e){const[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}const LZt=e=>{var t,r,n,s,a,i,l,c,u;const{invert:d,toast:f,unstyled:h,interacting:p,setHeights:m,visibleToasts:g,heights:y,index:x,toasts:w,expanded:S,removeToast:k,defaultRichColors:_,closeButton:E,style:T,cancelButtonStyle:j,actionButtonStyle:N,className:I="",descriptionClassName:P="",duration:R,position:$,gap:M,expandByDefault:z,classNames:U,icons:B,closeButtonAriaLabel:H="Close toast"}=e,[W,L]=je.useState(null),[Y,q]=je.useState(null),[D,Q]=je.useState(!1),[G,J]=je.useState(!1),[ae,re]=je.useState(!1),[se,oe]=je.useState(!1),[he,X]=je.useState(!1),[te,le]=je.useState(0),[ve,ue]=je.useState(0),fe=je.useRef(f.duration||R||Jke),xe=je.useRef(null),Se=je.useRef(null),Ne=x===0,K=x+1<=g,ie=f.type,be=f.dismissible!==!1,Ae=f.className||"",$e=f.descriptionClassName||"",ye=je.useMemo(()=>y.findIndex(tt=>tt.toastId===f.id)||0,[y,f.id]),ke=je.useMemo(()=>{var tt;return(tt=f.closeButton)!=null?tt:E},[f.closeButton,E]),ge=je.useMemo(()=>f.duration||R||Jke,[f.duration,R]),Ee=je.useRef(0),Fe=je.useRef(0),ct=je.useRef(0),wt=je.useRef(null),[or,Ve]=$.split("-"),qe=je.useMemo(()=>y.reduce((tt,Jt,Tr)=>Tr>=ye?tt:tt+Jt.height,0),[y,ye]),Ie=SZt(),Le=f.invert||d,Re=ie==="loading";Fe.current=je.useMemo(()=>ye*M+qe,[ye,qe]),je.useEffect(()=>{fe.current=ge},[ge]),je.useEffect(()=>{Q(!0)},[]),je.useEffect(()=>{const tt=Se.current;if(tt){const Jt=tt.getBoundingClientRect().height;return ue(Jt),m(Tr=>[{toastId:f.id,height:Jt,position:f.position},...Tr]),()=>m(Tr=>Tr.filter(ar=>ar.toastId!==f.id))}},[m,f.id]),je.useLayoutEffect(()=>{if(!D)return;const tt=Se.current,Jt=tt.style.height;tt.style.height="auto";const Tr=tt.getBoundingClientRect().height;tt.style.height=Jt,ue(Tr),m(ar=>ar.find(Ur=>Ur.toastId===f.id)?ar.map(Ur=>Ur.toastId===f.id?{...Ur,height:Tr}:Ur):[{toastId:f.id,height:Tr,position:f.position},...ar])},[D,f.title,f.description,m,f.id,f.jsx,f.action,f.cancel]);const it=je.useCallback(()=>{J(!0),le(Fe.current),m(tt=>tt.filter(Jt=>Jt.toastId!==f.id)),setTimeout(()=>{k(f)},MZt)},[f,k,m,Fe]);je.useEffect(()=>{if(f.promise&&ie==="loading"||f.duration===1/0||f.type==="loading")return;let tt;return S||p||Ie?(()=>{if(ct.current<Ee.current){const ar=new Date().getTime()-Ee.current;fe.current=fe.current-ar}ct.current=new Date().getTime()})():fe.current!==1/0&&(Ee.current=new Date().getTime(),tt=setTimeout(()=>{f.onAutoClose==null||f.onAutoClose.call(f,f),it()},fe.current)),()=>clearTimeout(tt)},[S,p,f,ie,Ie,it]),je.useEffect(()=>{f.delete&&(it(),f.onDismiss==null||f.onDismiss.call(f,f))},[it,f.delete]);function rt(){var tt;if(B?.loading){var Jt;return je.createElement("div",{className:sm(U?.loader,f==null||(Jt=f.classNames)==null?void 0:Jt.loader,"sonner-loader"),"data-visible":ie==="loading"},B.loading)}return je.createElement(gZt,{className:sm(U?.loader,f==null||(tt=f.classNames)==null?void 0:tt.loader),visible:ie==="loading"})}const ht=f.icon||B?.[ie]||pZt(ie);var Ut,$r;return je.createElement("li",{tabIndex:0,ref:Se,className:sm(I,Ae,U?.toast,f==null||(t=f.classNames)==null?void 0:t.toast,U?.default,U?.[ie],f==null||(r=f.classNames)==null?void 0:r[ie]),"data-sonner-toast":"","data-rich-colors":(Ut=f.richColors)!=null?Ut:_,"data-styled":!(f.jsx||f.unstyled||h),"data-mounted":D,"data-promise":!!f.promise,"data-swiped":he,"data-removed":G,"data-visible":K,"data-y-position":or,"data-x-position":Ve,"data-index":x,"data-front":Ne,"data-swiping":ae,"data-dismissible":be,"data-type":ie,"data-invert":Le,"data-swipe-out":se,"data-swipe-direction":Y,"data-expanded":!!(S||z&&D),"data-testid":f.testId,style:{"--index":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":`${G?te:Fe.current}px`,"--initial-height":z?"auto":`${ve}px`,...T,...f.style},onDragEnd:()=>{re(!1),L(null),wt.current=null},onPointerDown:tt=>{tt.button!==2&&(Re||!be||(xe.current=new Date,le(Fe.current),tt.target.setPointerCapture(tt.pointerId),tt.target.tagName!=="BUTTON"&&(re(!0),wt.current={x:tt.clientX,y:tt.clientY})))},onPointerUp:()=>{var tt,Jt,Tr;if(se||!be)return;wt.current=null;const ar=Number(((tt=Se.current)==null?void 0:tt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ln=Number(((Jt=Se.current)==null?void 0:Jt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ur=new Date().getTime()-((Tr=xe.current)==null?void 0:Tr.getTime()),It=W==="x"?ar:Ln,vn=Math.abs(It)/Ur;if(Math.abs(It)>=PZt||vn>.11){le(Fe.current),f.onDismiss==null||f.onDismiss.call(f,f),q(W==="x"?ar>0?"right":"left":Ln>0?"down":"up"),it(),oe(!0);return}else{var Er,Oe;(Er=Se.current)==null||Er.style.setProperty("--swipe-amount-x","0px"),(Oe=Se.current)==null||Oe.style.setProperty("--swipe-amount-y","0px")}X(!1),re(!1),L(null)},onPointerMove:tt=>{var Jt,Tr,ar;if(!wt.current||!be||((Jt=window.getSelection())==null?void 0:Jt.toString().length)>0)return;const Ur=tt.clientY-wt.current.y,It=tt.clientX-wt.current.x;var vn;const Er=(vn=e.swipeDirections)!=null?vn:DZt($);!W&&(Math.abs(It)>1||Math.abs(Ur)>1)&&L(Math.abs(It)>Math.abs(Ur)?"x":"y");let Oe={x:0,y:0};const Me=Ue=>1/(1.5+Math.abs(Ue)/20);if(W==="y"){if(Er.includes("top")||Er.includes("bottom"))if(Er.includes("top")&&Ur<0||Er.includes("bottom")&&Ur>0)Oe.y=Ur;else{const Ue=Ur*Me(Ur);Oe.y=Math.abs(Ue)<Math.abs(Ur)?Ue:Ur}}else if(W==="x"&&(Er.includes("left")||Er.includes("right")))if(Er.includes("left")&&It<0||Er.includes("right")&&It>0)Oe.x=It;else{const Ue=It*Me(It);Oe.x=Math.abs(Ue)<Math.abs(It)?Ue:It}(Math.abs(Oe.x)>0||Math.abs(Oe.y)>0)&&X(!0),(Tr=Se.current)==null||Tr.style.setProperty("--swipe-amount-x",`${Oe.x}px`),(ar=Se.current)==null||ar.style.setProperty("--swipe-amount-y",`${Oe.y}px`)}},ke&&!f.jsx&&ie!=="loading"?je.createElement("button",{"aria-label":H,"data-disabled":Re,"data-close-button":!0,onClick:Re||!be?()=>{}:()=>{it(),f.onDismiss==null||f.onDismiss.call(f,f)},className:sm(U?.closeButton,f==null||(n=f.classNames)==null?void 0:n.closeButton)},($r=B?.close)!=null?$r:wZt):null,(ie||f.icon||f.promise)&&f.icon!==null&&(B?.[ie]!==null||f.icon)?je.createElement("div",{"data-icon":"",className:sm(U?.icon,f==null||(s=f.classNames)==null?void 0:s.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||rt():null,f.type!=="loading"?ht:null):null,je.createElement("div",{"data-content":"",className:sm(U?.content,f==null||(a=f.classNames)==null?void 0:a.content)},je.createElement("div",{"data-title":"",className:sm(U?.title,f==null||(i=f.classNames)==null?void 0:i.title)},f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title),f.description?je.createElement("div",{"data-description":"",className:sm(P,$e,U?.description,f==null||(l=f.classNames)==null?void 0:l.description)},typeof f.description=="function"?f.description():f.description):null),je.isValidElement(f.cancel)?f.cancel:f.cancel&&sD(f.cancel)?je.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||j,onClick:tt=>{sD(f.cancel)&&be&&(f.cancel.onClick==null||f.cancel.onClick.call(f.cancel,tt),it())},className:sm(U?.cancelButton,f==null||(c=f.classNames)==null?void 0:c.cancelButton)},f.cancel.label):null,je.isValidElement(f.action)?f.action:f.action&&sD(f.action)?je.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||N,onClick:tt=>{sD(f.action)&&(f.action.onClick==null||f.action.onClick.call(f.action,tt),!tt.defaultPrevented&&it())},className:sm(U?.actionButton,f==null||(u=f.classNames)==null?void 0:u.actionButton)},f.action.label):null)};function e_e(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function $Zt(e,t){const r={};return[e,t].forEach((n,s)=>{const a=s===1,i=a?"--mobile-offset":"--offset",l=a?AZt:NZt;function c(u){["top","right","bottom","left"].forEach(d=>{r[`${i}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?r[`${i}-${u}`]=l:r[`${i}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):c(l)}),r}const aYe=je.forwardRef(function(t,r){const{id:n,invert:s,position:a="bottom-right",hotkey:i=["altKey","KeyT"],expand:l,closeButton:c,className:u,offset:d,mobileOffset:f,theme:h="light",richColors:p,duration:m,style:g,visibleToasts:y=TZt,toastOptions:x,dir:w=e_e(),gap:S=RZt,icons:k,containerAriaLabel:_="Notifications"}=t,[E,T]=je.useState([]),j=je.useMemo(()=>n?E.filter(D=>D.toasterId===n):E.filter(D=>!D.toasterId),[E,n]),N=je.useMemo(()=>Array.from(new Set([a].concat(j.filter(D=>D.position).map(D=>D.position)))),[j,a]),[I,P]=je.useState([]),[R,$]=je.useState(!1),[M,z]=je.useState(!1),[U,B]=je.useState(h!=="system"?h:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=je.useRef(null),W=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),L=je.useRef(null),Y=je.useRef(!1),q=je.useCallback(D=>{T(Q=>{var G;return(G=Q.find(J=>J.id===D.id))!=null&&G.delete||ju.dismiss(D.id),Q.filter(({id:J})=>J!==D.id)})},[]);return je.useEffect(()=>ju.subscribe(D=>{if(D.dismiss){requestAnimationFrame(()=>{T(Q=>Q.map(G=>G.id===D.id?{...G,delete:!0}:G))});return}setTimeout(()=>{uce.flushSync(()=>{T(Q=>{const G=Q.findIndex(J=>J.id===D.id);return G!==-1?[...Q.slice(0,G),{...Q[G],...D},...Q.slice(G+1)]:[D,...Q]})})})}),[E]),je.useEffect(()=>{if(h!=="system"){B(h);return}if(h==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?B("dark"):B("light")),typeof window>"u")return;const D=window.matchMedia("(prefers-color-scheme: dark)");try{D.addEventListener("change",({matches:Q})=>{B(Q?"dark":"light")})}catch{D.addListener(({matches:G})=>{try{B(G?"dark":"light")}catch(J){console.error(J)}})}},[h]),je.useEffect(()=>{E.length<=1&&$(!1)},[E]),je.useEffect(()=>{const D=Q=>{var G;if(i.every(re=>Q[re]||Q.code===re)){var ae;$(!0),(ae=H.current)==null||ae.focus()}Q.code==="Escape"&&(document.activeElement===H.current||(G=H.current)!=null&&G.contains(document.activeElement))&&$(!1)};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[i]),je.useEffect(()=>{if(H.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,Y.current=!1)}},[H.current]),je.createElement("section",{ref:r,"aria-label":`${_} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},N.map((D,Q)=>{var G;const[J,ae]=D.split("-");return j.length?je.createElement("ol",{key:D,dir:w==="auto"?e_e():w,tabIndex:-1,ref:H,className:u,"data-sonner-toaster":!0,"data-sonner-theme":U,"data-y-position":J,"data-x-position":ae,style:{"--front-toast-height":`${((G=I[0])==null?void 0:G.height)||0}px`,"--width":`${IZt}px`,"--gap":`${S}px`,...g,...$Zt(d,f)},onBlur:re=>{Y.current&&!re.currentTarget.contains(re.relatedTarget)&&(Y.current=!1,L.current&&(L.current.focus({preventScroll:!0}),L.current=null))},onFocus:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||Y.current||(Y.current=!0,L.current=re.relatedTarget)},onMouseEnter:()=>$(!0),onMouseMove:()=>$(!0),onMouseLeave:()=>{M||$(!1)},onDragEnd:()=>$(!1),onPointerDown:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||z(!0)},onPointerUp:()=>z(!1)},j.filter(re=>!re.position&&Q===0||re.position===D).map((re,se)=>{var oe,he;return je.createElement(LZt,{key:re.id,icons:k,index:se,toast:re,defaultRichColors:p,duration:(oe=x?.duration)!=null?oe:m,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:s,visibleToasts:y,closeButton:(he=x?.closeButton)!=null?he:c,interacting:M,position:D,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:q,toasts:j.filter(X=>X.position==re.position),heights:I.filter(X=>X.position==re.position),setHeights:P,expandByDefault:l,gap:S,expanded:R,swipeDirections:t.swipeDirections})})):null}))}),t_e=e=>{let t;const r=new Set,n=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),r.forEach(p=>p(t,h))}},s=()=>t,l={setState:n,getState:s,getInitialState:()=>c,subscribe:u=>(r.add(u),()=>r.delete(u))},c=t=e(n,s,l);return l},FZt=(e=>e?t_e(e):t_e),zZt=e=>e;function BZt(e,t=zZt){const r=je.useSyncExternalStore(e.subscribe,je.useCallback(()=>t(e.getState()),[e,t]),je.useCallback(()=>t(e.getInitialState()),[e,t]));return je.useDebugValue(r),r}const r_e=e=>{const t=FZt(e),r=n=>BZt(t,n);return Object.assign(r,t),r},Kue=(e=>e?r_e(e):r_e);function UZt(e,t){let r;try{r=e()}catch{return}return{getItem:s=>{var a;const i=c=>c===null?null:JSON.parse(c,void 0),l=(a=r.getItem(s))!=null?a:null;return l instanceof Promise?l.then(i):i(l)},setItem:(s,a)=>r.setItem(s,JSON.stringify(a,void 0)),removeItem:s=>r.removeItem(s)}}const lse=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return lse(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return lse(n)(r)}}}},VZt=(e,t)=>(r,n,s)=>{let a={storage:UZt(()=>window.localStorage),partialize:y=>y,version:0,merge:(y,x)=>({...x,...y}),...t},i=!1,l=0;const c=new Set,u=new Set;let d=a.storage;if(!d)return e((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(...y)},n,s);const f=()=>{const y=a.partialize({...n()});return d.setItem(a.name,{state:y,version:a.version})},h=s.setState;s.setState=(y,x)=>(h(y,x),f());const p=e((...y)=>(r(...y),f()),n,s);s.getInitialState=()=>p;let m;const g=()=>{var y,x;if(!d)return;const w=++l;i=!1,c.forEach(k=>{var _;return k((_=n())!=null?_:p)});const S=((x=a.onRehydrateStorage)==null?void 0:x.call(a,(y=n())!=null?y:p))||void 0;return lse(d.getItem.bind(d))(a.name).then(k=>{if(k)if(typeof k.version=="number"&&k.version!==a.version){if(a.migrate){const _=a.migrate(k.state,k.version);return _ instanceof Promise?_.then(E=>[!0,E]):[!0,_]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,k.state];return[!1,void 0]}).then(k=>{var _;if(w!==l)return;const[E,T]=k;if(m=a.merge(T,(_=n())!=null?_:p),r(m,!0),E)return f()}).then(()=>{w===l&&(S?.(n(),void 0),m=n(),i=!0,u.forEach(k=>k(m)))}).catch(k=>{w===l&&S?.(void 0,k)})};return s.persist={setOptions:y=>{a={...a,...y},y.storage&&(d=y.storage)},clearStorage:()=>{d?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>g(),hasHydrated:()=>i,onHydrate:y=>(c.add(y),()=>{c.delete(y)}),onFinishHydration:y=>(u.add(y),()=>{u.delete(y)})},a.skipHydration||g(),m||p},qZt=VZt;var OV="focusScope.autoFocusOnMount",kV="focusScope.autoFocusOnUnmount",n_e={bubbles:!1,cancelable:!0},HZt="FocusScope",VR=b.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...i}=e,[l,c]=b.useState(null),u=vi(s),d=vi(a),f=b.useRef(null),h=Br(t,g=>c(g)),p=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(n){let g=function(S){if(p.paused||!l)return;const k=S.target;l.contains(k)?f.current=k:mb(f.current,{select:!0})},y=function(S){if(p.paused||!l)return;const k=S.relatedTarget;k!==null&&(l.contains(k)||mb(f.current,{select:!0}))},x=function(S){if(document.activeElement===document.body)for(const _ of S)_.removedNodes.length>0&&mb(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const w=new MutationObserver(x);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),w.disconnect()}}},[n,l,p.paused]),b.useEffect(()=>{if(l){a_e.add(p);const g=document.activeElement;if(!l.contains(g)){const x=new CustomEvent(OV,n_e);l.addEventListener(OV,u),l.dispatchEvent(x),x.defaultPrevented||(QZt(XZt(iYe(l)),{select:!0}),document.activeElement===g&&mb(l))}return()=>{l.removeEventListener(OV,u),setTimeout(()=>{const x=new CustomEvent(kV,n_e);l.addEventListener(kV,d),l.dispatchEvent(x),x.defaultPrevented||mb(g??document.body,{select:!0}),l.removeEventListener(kV,d),a_e.remove(p)},0)}}},[l,u,d,p]);const m=b.useCallback(g=>{if(!r&&!n||p.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,x=document.activeElement;if(y&&x){const w=g.currentTarget,[S,k]=WZt(w);S&&k?!g.shiftKey&&x===k?(g.preventDefault(),r&&mb(S,{select:!0})):g.shiftKey&&x===S&&(g.preventDefault(),r&&mb(k,{select:!0})):x===w&&g.preventDefault()}},[r,n,p.paused]);return o.jsx(wr.div,{tabIndex:-1,...i,ref:h,onKeyDown:m})});VR.displayName=HZt;function QZt(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(mb(n,{select:t}),document.activeElement!==r)return}function WZt(e){const t=iYe(e),r=s_e(t,e),n=s_e(t.reverse(),e);return[r,n]}function iYe(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function s_e(e,t){for(const r of e)if(!GZt(r,{upTo:t}))return r}function GZt(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 ZZt(e){return e instanceof HTMLInputElement&&"select"in e}function mb(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&ZZt(e)&&t&&e.select()}}var a_e=YZt();function YZt(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=i_e(e,t),e.unshift(t)},remove(t){e=i_e(e,t),e[0]?.resume()}}}function i_e(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function XZt(e){return e.filter(t=>t.tagName!=="A")}var _V=0;function UF(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??o_e()),document.body.insertAdjacentElement("beforeend",e[1]??o_e()),_V++,()=>{_V===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),_V--}},[])}function o_e(){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 km=function(){return km=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},km.apply(this,arguments)};function oYe(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function KZt(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var o$="right-scroll-bar-position",l$="width-before-scroll-bar",JZt="with-scroll-bars-hidden",eYt="--removed-body-scroll-bar-size";function EV(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function tYt(e,t){var r=b.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=t,r.facade}var rYt=typeof window<"u"?b.useLayoutEffect:b.useEffect,l_e=new WeakMap;function nYt(e,t){var r=tYt(null,function(n){return e.forEach(function(s){return EV(s,n)})});return rYt(function(){var n=l_e.get(r);if(n){var s=new Set(n),a=new Set(e),i=r.current;s.forEach(function(l){a.has(l)||EV(l,null)}),a.forEach(function(l){s.has(l)||EV(l,i)})}l_e.set(r,e)},[e]),r}function sYt(e){return e}function aYt(e,t){t===void 0&&(t=sYt);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var i=t(a,n);return r.push(i),function(){r=r.filter(function(l){return l!==i})}},assignSyncMedium:function(a){for(n=!0;r.length;){var i=r;r=[],i.forEach(a)}r={push:function(l){return a(l)},filter:function(){return r}}},assignMedium:function(a){n=!0;var i=[];if(r.length){var l=r;r=[],l.forEach(a),i=r}var c=function(){var d=i;i=[],d.forEach(a)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){i.push(d),u()},filter:function(d){return i=i.filter(d),r}}}};return s}function iYt(e){e===void 0&&(e={});var t=aYt(null);return t.options=km({async:!0,ssr:!1},e),t}var lYe=function(e){var t=e.sideCar,r=oYe(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return b.createElement(n,km({},r))};lYe.isSideCarExport=!0;function oYt(e,t){return e.useMedium(t),lYe}var cYe=iYt(),CV=function(){},VF=b.forwardRef(function(e,t){var r=b.useRef(null),n=b.useState({onScrollCapture:CV,onWheelCapture:CV,onTouchMoveCapture:CV}),s=n[0],a=n[1],i=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,h=e.sideCar,p=e.noRelative,m=e.noIsolation,g=e.inert,y=e.allowPinchZoom,x=e.as,w=x===void 0?"div":x,S=e.gapMode,k=oYe(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=h,E=nYt([r,t]),T=km(km({},k),s);return b.createElement(b.Fragment,null,d&&b.createElement(_,{sideCar:cYe,removeScrollBar:u,shards:f,noRelative:p,noIsolation:m,inert:g,setCallbacks:a,allowPinchZoom:!!y,lockRef:r,gapMode:S}),i?b.cloneElement(b.Children.only(l),km(km({},T),{ref:E})):b.createElement(w,km({},T,{className:c,ref:E}),l))});VF.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};VF.classNames={fullWidth:l$,zeroRight:o$};var lYt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function cYt(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=lYt();return t&&e.setAttribute("nonce",t),e}function uYt(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function dYt(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var fYt=function(){var e=0,t=null;return{add:function(r){e==0&&(t=cYt())&&(uYt(t,r),dYt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},hYt=function(){var e=fYt();return function(t,r){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},uYe=function(){var e=hYt(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},pYt={left:0,top:0,right:0,gap:0},jV=function(e){return parseInt(e||"",10)||0},mYt=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[jV(r),jV(n),jV(s)]},gYt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return pYt;var t=mYt(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},yYt=uYe(),Hk="data-scroll-locked",vYt=function(e,t,r,n){var s=e.left,a=e.top,i=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
114
114
|
.`.concat(JZt,` {
|
|
115
115
|
overflow: hidden `).concat(n,`;
|
|
@@ -287,7 +287,7 @@ ${J.current.stack}
|
|
|
287
287
|
A`,",",",0,",",",",",",",`
|
|
288
288
|
A`,",",",0,0,",",",",","Z"])),T.x,T.y,a,a,+(d<0),E.x,E.y,n,n,+(N>180),+(d>0),S.x,S.y,a,a,+(d<0),k.x,k.y)}else w+=Hi(KTe||(KTe=Ew(["L",",","Z"])),t,r);return w},q1r={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},hit=e=>{var t=id(e,q1r),{cx:r,cy:n,innerRadius:s,outerRadius:a,cornerRadius:i,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:f}=t;if(a<s||u===d)return null;var h=va("recharts-sector",f),p=a-s,m=Cx(i,p,0,!0),g;return m>0&&Math.abs(u-d)<360?g=V1r({cx:r,cy:n,innerRadius:s,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):g=fit({cx:r,cy:n,innerRadius:s,outerRadius:a,startAngle:u,endAngle:d}),b.createElement("path",Nae({},iu(t),{className:h,d:g}))};function H1r(e,t,r){if(e==="horizontal")return[{x:t.x,y:r.top},{x:t.x,y:r.top+r.height}];if(e==="vertical")return[{x:r.left,y:t.y},{x:r.left+r.width,y:t.y}];if(Xst(t)){if(e==="centric"){var{cx:n,cy:s,innerRadius:a,outerRadius:i,angle:l}=t,c=Hl(n,s,a,l),u=Hl(n,s,i,l);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return dit(t)}}var NH={},AH={},IH={},JTe;function Q1r(){return JTe||(JTe=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=oat();function r(n){return t.isSymbol(n)?NaN:Number(n)}e.toNumber=r})(IH)),IH}var eNe;function W1r(){return eNe||(eNe=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Q1r();function r(n){return n?(n=t.toNumber(n),n===1/0||n===-1/0?(n<0?-1:1)*Number.MAX_VALUE:n===n?n:0):n===0?n:0}e.toFinite=r})(AH)),AH}var tNe;function G1r(){return tNe||(tNe=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=lat(),r=W1r();function n(s,a,i){i&&typeof i!="number"&&t.isIterateeCall(s,a,i)&&(a=i=void 0),s=r.toFinite(s),a===void 0?(a=s,s=0):a=r.toFinite(a),i=i===void 0?s<a?1:-1:r.toFinite(i);const l=Math.max(Math.ceil((a-s)/(i||1)),0),c=new Array(l);for(let u=0;u<l;u++)c[u]=s,s+=i;return c}e.range=n})(NH)),NH}var RH,rNe;function Z1r(){return rNe||(rNe=1,RH=G1r().range),RH}var Y1r=Z1r();const pit=Uo(Y1r);var s0=e=>e.chartData,X1r=Xe([s0],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),_he=(e,t,r,n)=>n?X1r(e):s0(e);function Gm(e){if(Array.isArray(e)&&e.length===2){var[t,r]=e;if(zs(t)&&zs(r))return!0}return!1}function nNe(e,t,r){return r?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function mit(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[r,n]=e,s,a;if(zs(r))s=r;else if(typeof r=="function")return;if(zs(n))a=n;else if(typeof n=="function")return;var i=[s,a];if(Gm(i))return i}}function K1r(e,t,r){if(!(!r&&t==null)){if(typeof e=="function"&&t!=null)try{var n=e(t,r);if(Gm(n))return nNe(n,t,r)}catch{}if(Array.isArray(e)&&e.length===2){var[s,a]=e,i,l;if(s==="auto")t!=null&&(i=Math.min(...t));else if(qr(s))i=s;else if(typeof s=="function")try{t!=null&&(i=s(t?.[0]))}catch{}else if(typeof s=="string"&&Kje.test(s)){var c=Kje.exec(s);if(c==null||c[1]==null||t==null)i=void 0;else{var u=+c[1];i=t[0]-u}}else i=t?.[0];if(a==="auto")t!=null&&(l=Math.max(...t));else if(qr(a))l=a;else if(typeof a=="function")try{t!=null&&(l=a(t?.[1]))}catch{}else if(typeof a=="string"&&Jje.test(a)){var d=Jje.exec(a);if(d==null||d[1]==null||t==null)l=void 0;else{var f=+d[1];l=t[1]+f}}else l=t?.[1];var h=[i,l];if(Gm(h))return t==null?h:nNe(h,t,r)}}}var tC=1e9,J1r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},Che,xi=!0,Ch="[DecimalError] ",qw=Ch+"Invalid argument: ",Ehe=Ch+"Exponent out of range: ",rC=Math.floor,lw=Math.pow,eOr=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Bd,hl=1e7,li=7,git=9007199254740991,t4=rC(git/li),fr={};fr.absoluteValue=fr.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};fr.comparedTo=fr.cmp=function(e){var t,r,n,s,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(n=a.d.length,s=e.d.length,t=0,r=n<s?n:s;t<r;++t)if(a.d[t]!==e.d[t])return a.d[t]>e.d[t]^a.s<0?1:-1;return n===s?0:n>s^a.s<0?1:-1};fr.decimalPlaces=fr.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*li;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};fr.dividedBy=fr.div=function(e){return Dy(this,new this.constructor(e))};fr.dividedToIntegerBy=fr.idiv=function(e){var t=this,r=t.constructor;return La(Dy(t,new r(e),0,1),r.precision)};fr.equals=fr.eq=function(e){return!this.cmp(e)};fr.exponent=function(){return Lo(this)};fr.greaterThan=fr.gt=function(e){return this.cmp(e)>0};fr.greaterThanOrEqualTo=fr.gte=function(e){return this.cmp(e)>=0};fr.isInteger=fr.isint=function(){return this.e>this.d.length-2};fr.isNegative=fr.isneg=function(){return this.s<0};fr.isPositive=fr.ispos=function(){return this.s>0};fr.isZero=function(){return this.s===0};fr.lessThan=fr.lt=function(e){return this.cmp(e)<0};fr.lessThanOrEqualTo=fr.lte=function(e){return this.cmp(e)<1};fr.logarithm=fr.log=function(e){var t,r=this,n=r.constructor,s=n.precision,a=s+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Bd))throw Error(Ch+"NaN");if(r.s<1)throw Error(Ch+(r.s?"NaN":"-Infinity"));return r.eq(Bd)?new n(0):(xi=!1,t=Dy(tI(r,a),tI(e,a),a),xi=!0,La(t,s))};fr.minus=fr.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?bit(t,e):yit(t,(e.s=-e.s,e))};fr.modulo=fr.mod=function(e){var t,r=this,n=r.constructor,s=n.precision;if(e=new n(e),!e.s)throw Error(Ch+"NaN");return r.s?(xi=!1,t=Dy(r,e,0,1).times(e),xi=!0,r.minus(t)):La(new n(r),s)};fr.naturalExponential=fr.exp=function(){return vit(this)};fr.naturalLogarithm=fr.ln=function(){return tI(this)};fr.negated=fr.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};fr.plus=fr.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?yit(t,e):bit(t,(e.s=-e.s,e))};fr.precision=fr.sd=function(e){var t,r,n,s=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(qw+e);if(t=Lo(s)+1,n=s.d.length-1,r=n*li+1,n=s.d[n],n){for(;n%10==0;n/=10)r--;for(n=s.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};fr.squareRoot=fr.sqrt=function(){var e,t,r,n,s,a,i,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Ch+"NaN")}for(e=Lo(l),xi=!1,s=Math.sqrt(+l),s==0||s==1/0?(t=Lm(l.d),(t.length+e)%2==0&&(t+="0"),s=Math.sqrt(t),e=rC((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),n=new c(t)):n=new c(s.toString()),r=c.precision,s=i=r+3;;)if(a=n,n=a.plus(Dy(l,a,i+2)).times(.5),Lm(a.d).slice(0,i)===(t=Lm(n.d)).slice(0,i)){if(t=t.slice(i-3,i+1),s==i&&t=="4999"){if(La(a,r+1,0),a.times(a).eq(l)){n=a;break}}else if(t!="9999")break;i+=4}return xi=!0,La(n,r)};fr.times=fr.mul=function(e){var t,r,n,s,a,i,l,c,u,d=this,f=d.constructor,h=d.d,p=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,r=d.e+e.e,c=h.length,u=p.length,c<u&&(a=h,h=p,p=a,i=c,c=u,u=i),a=[],i=c+u,n=i;n--;)a.push(0);for(n=u;--n>=0;){for(t=0,s=c+n;s>n;)l=a[s]+p[n]*h[s-n-1]+t,a[s--]=l%hl|0,t=l/hl|0;a[s]=(a[s]+t)%hl|0}for(;!a[--i];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,xi?La(e,f.precision):e};fr.toDecimalPlaces=fr.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(ig(e,0,tC),t===void 0?t=n.rounding:ig(t,0,8),La(r,e+Lo(r)+1,t))};fr.toExponential=function(e,t){var r,n=this,s=n.constructor;return e===void 0?r=NS(n,!0):(ig(e,0,tC),t===void 0?t=s.rounding:ig(t,0,8),n=La(new s(n),e+1,t),r=NS(n,!0,e+1)),r};fr.toFixed=function(e,t){var r,n,s=this,a=s.constructor;return e===void 0?NS(s):(ig(e,0,tC),t===void 0?t=a.rounding:ig(t,0,8),n=La(new a(s),e+Lo(s)+1,t),r=NS(n.abs(),!1,e+Lo(n)+1),s.isneg()&&!s.isZero()?"-"+r:r)};fr.toInteger=fr.toint=function(){var e=this,t=e.constructor;return La(new t(e),Lo(e)+1,t.rounding)};fr.toNumber=function(){return+this};fr.toPower=fr.pow=function(e){var t,r,n,s,a,i,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(Bd);if(l=new c(l),!l.s){if(e.s<1)throw Error(Ch+"Infinity");return l}if(l.eq(Bd))return l;if(n=c.precision,e.eq(Bd))return La(l,n);if(t=e.e,r=e.d.length-1,i=t>=r,a=l.s,i){if((r=d<0?-d:d)<=git){for(s=new c(Bd),t=Math.ceil(n/li+4),xi=!1;r%2&&(s=s.times(l),aNe(s.d,t)),r=rC(r/2),r!==0;)l=l.times(l),aNe(l.d,t);return xi=!0,e.s<0?new c(Bd).div(s):La(s,n)}}else if(a<0)throw Error(Ch+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,xi=!1,s=e.times(tI(l,n+u)),xi=!0,s=vit(s),s.s=a,s};fr.toPrecision=function(e,t){var r,n,s=this,a=s.constructor;return e===void 0?(r=Lo(s),n=NS(s,r<=a.toExpNeg||r>=a.toExpPos)):(ig(e,1,tC),t===void 0?t=a.rounding:ig(t,0,8),s=La(new a(s),e,t),r=Lo(s),n=NS(s,e<=r||r<=a.toExpNeg,e)),n};fr.toSignificantDigits=fr.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(ig(e,1,tC),t===void 0?t=n.rounding:ig(t,0,8)),La(new n(r),e,t)};fr.toString=fr.valueOf=fr.val=fr.toJSON=fr[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Lo(e),r=e.constructor;return NS(e,t<=r.toExpNeg||t>=r.toExpPos)};function yit(e,t){var r,n,s,a,i,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),xi?La(t,f):t;if(c=e.d,u=t.d,i=e.e,s=t.e,c=c.slice(),a=i-s,a){for(a<0?(n=c,a=-a,l=u.length):(n=u,s=i,l=c.length),i=Math.ceil(f/li),l=i>l?i+1:l+1,a>l&&(a=l,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(l=c.length,a=u.length,l-a<0&&(a=l,n=u,u=c,c=n),r=0;a;)r=(c[--a]=c[a]+u[a]+r)/hl|0,c[a]%=hl;for(r&&(c.unshift(r),++s),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=s,xi?La(t,f):t}function ig(e,t,r){if(e!==~~e||e<t||e>r)throw Error(qw+e)}function Lm(e){var t,r,n,s=e.length-1,a="",i=e[0];if(s>0){for(a+=i,t=1;t<s;t++)n=e[t]+"",r=li-n.length,r&&(a+=Sb(r)),a+=n;i=e[t],n=i+"",r=li-n.length,r&&(a+=Sb(r))}else if(i===0)return"0";for(;i%10===0;)i/=10;return a+i}var Dy=(function(){function e(n,s){var a,i=0,l=n.length;for(n=n.slice();l--;)a=n[l]*s+i,n[l]=a%hl|0,i=a/hl|0;return i&&n.unshift(i),n}function t(n,s,a,i){var l,c;if(a!=i)c=a>i?1:-1;else for(l=c=0;l<a;l++)if(n[l]!=s[l]){c=n[l]>s[l]?1:-1;break}return c}function r(n,s,a){for(var i=0;a--;)n[a]-=i,i=n[a]<s[a]?1:0,n[a]=i*hl+n[a]-s[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,s,a,i){var l,c,u,d,f,h,p,m,g,y,x,w,S,k,_,E,T,j,N=n.constructor,I=n.s==s.s?1:-1,P=n.d,R=s.d;if(!n.s)return new N(n);if(!s.s)throw Error(Ch+"Division by zero");for(c=n.e-s.e,T=R.length,_=P.length,p=new N(I),m=p.d=[],u=0;R[u]==(P[u]||0);)++u;if(R[u]>(P[u]||0)&&--c,a==null?w=a=N.precision:i?w=a+(Lo(n)-Lo(s))+1:w=a,w<0)return new N(0);if(w=w/li+2|0,u=0,T==1)for(d=0,R=R[0],w++;(u<_||d)&&w--;u++)S=d*hl+(P[u]||0),m[u]=S/R|0,d=S%R|0;else{for(d=hl/(R[0]+1)|0,d>1&&(R=e(R,d),P=e(P,d),T=R.length,_=P.length),k=T,g=P.slice(0,T),y=g.length;y<T;)g[y++]=0;j=R.slice(),j.unshift(0),E=R[0],R[1]>=hl/2&&++E;do d=0,l=t(R,g,T,y),l<0?(x=g[0],T!=y&&(x=x*hl+(g[1]||0)),d=x/E|0,d>1?(d>=hl&&(d=hl-1),f=e(R,d),h=f.length,y=g.length,l=t(f,g,h,y),l==1&&(d--,r(f,T<h?j:R,h))):(d==0&&(l=d=1),f=R.slice()),h=f.length,h<y&&f.unshift(0),r(g,f,y),l==-1&&(y=g.length,l=t(R,g,T,y),l<1&&(d++,r(g,T<y?j:R,y))),y=g.length):l===0&&(d++,g=[0]),m[u++]=d,l&&g[0]?g[y++]=P[k]||0:(g=[P[k]],y=1);while((k++<_||g[0]!==void 0)&&w--)}return m[0]||m.shift(),p.e=c,La(p,i?a+Lo(p)+1:a)}})();function vit(e,t){var r,n,s,a,i,l,c=0,u=0,d=e.constructor,f=d.precision;if(Lo(e)>16)throw Error(Ehe+Lo(e));if(!e.s)return new d(Bd);for(xi=!1,l=f,i=new d(.03125);e.abs().gte(.1);)e=e.times(i),u+=5;for(n=Math.log(lw(2,u))/Math.LN10*2+5|0,l+=n,r=s=a=new d(Bd),d.precision=l;;){if(s=La(s.times(e),l),r=r.times(++c),i=a.plus(Dy(s,r,l)),Lm(i.d).slice(0,l)===Lm(a.d).slice(0,l)){for(;u--;)a=La(a.times(a),l);return d.precision=f,t==null?(xi=!0,La(a,f)):a}a=i}}function Lo(e){for(var t=e.e*li,r=e.d[0];r>=10;r/=10)t++;return t}function PH(e,t,r){if(t>e.LN10.sd())throw xi=!0,r&&(e.precision=r),Error(Ch+"LN10 precision limit exceeded");return La(new e(e.LN10),t)}function Sb(e){for(var t="";e--;)t+="0";return t}function tI(e,t){var r,n,s,a,i,l,c,u,d,f=1,h=10,p=e,m=p.d,g=p.constructor,y=g.precision;if(p.s<1)throw Error(Ch+(p.s?"NaN":"-Infinity"));if(p.eq(Bd))return new g(0);if(t==null?(xi=!1,u=y):u=t,p.eq(10))return t==null&&(xi=!0),PH(g,u);if(u+=h,g.precision=u,r=Lm(m),n=r.charAt(0),a=Lo(p),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)p=p.times(e),r=Lm(p.d),n=r.charAt(0),f++;a=Lo(p),n>1?(p=new g("0."+r),a++):p=new g(n+"."+r.slice(1))}else return c=PH(g,u+2,y).times(a+""),p=tI(new g(n+"."+r.slice(1)),u-h).plus(c),g.precision=y,t==null?(xi=!0,La(p,y)):p;for(l=i=p=Dy(p.minus(Bd),p.plus(Bd),u),d=La(p.times(p),u),s=3;;){if(i=La(i.times(d),u),c=l.plus(Dy(i,new g(s),u)),Lm(c.d).slice(0,u)===Lm(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(PH(g,u+2,y).times(a+""))),l=Dy(l,new g(f),u),g.precision=y,t==null?(xi=!0,La(l,y)):l;l=c,s+=2}}function sNe(e,t){var r,n,s;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(s=t.length;t.charCodeAt(s-1)===48;)--s;if(t=t.slice(n,s),t){if(s-=n,r=r-n-1,e.e=rC(r/li),e.d=[],n=(r+1)%li,r<0&&(n+=li),n<s){for(n&&e.d.push(+t.slice(0,n)),s-=li;n<s;)e.d.push(+t.slice(n,n+=li));t=t.slice(n),n=li-t.length}else n-=s;for(;n--;)t+="0";if(e.d.push(+t),xi&&(e.e>t4||e.e<-t4))throw Error(Ehe+r)}else e.s=0,e.e=0,e.d=[0];return e}function La(e,t,r){var n,s,a,i,l,c,u,d,f=e.d;for(i=1,a=f[0];a>=10;a/=10)i++;if(n=t-i,n<0)n+=li,s=t,u=f[d=0];else{if(d=Math.ceil((n+1)/li),a=f.length,d>=a)return e;for(u=a=f[d],i=1;a>=10;a/=10)i++;n%=li,s=n-li+i}if(r!==void 0&&(a=lw(10,i-s-1),l=u/a%10|0,c=t<0||f[d+1]!==void 0||u%a,c=r<4?(l||c)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(n>0?s>0?u/lw(10,i-s):0:f[d-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return c?(a=Lo(e),f.length=1,t=t-a-1,f[0]=lw(10,(li-t%li)%li),e.e=rC(-t/li)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=d,a=1,d--):(f.length=d+1,a=lw(10,li-n),f[d]=s>0?(u/lw(10,i-s)%lw(10,s)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==hl&&(f[0]=1,++e.e);break}else{if(f[d]+=a,f[d]!=hl)break;f[d--]=0,a=1}for(n=f.length;f[--n]===0;)f.pop();if(xi&&(e.e>t4||e.e<-t4))throw Error(Ehe+Lo(e));return e}function bit(e,t){var r,n,s,a,i,l,c,u,d,f,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),xi?La(t,p):t;if(c=e.d,f=t.d,n=t.e,u=e.e,c=c.slice(),i=u-n,i){for(d=i<0,d?(r=c,i=-i,l=f.length):(r=f,n=u,l=c.length),s=Math.max(Math.ceil(p/li),l)+2,i>s&&(i=s,r.length=1),r.reverse(),s=i;s--;)r.push(0);r.reverse()}else{for(s=c.length,l=f.length,d=s<l,d&&(l=s),s=0;s<l;s++)if(c[s]!=f[s]){d=c[s]<f[s];break}i=0}for(d&&(r=c,c=f,f=r,t.s=-t.s),l=c.length,s=f.length-l;s>0;--s)c[l++]=0;for(s=f.length;s>i;){if(c[--s]<f[s]){for(a=s;a&&c[--a]===0;)c[a]=hl-1;--c[a],c[s]+=hl}c[s]-=f[s]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(t.d=c,t.e=n,xi?La(t,p):t):new h(0)}function NS(e,t,r){var n,s=Lo(e),a=Lm(e.d),i=a.length;return t?(r&&(n=r-i)>0?a=a.charAt(0)+"."+a.slice(1)+Sb(n):i>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(s<0?"e":"e+")+s):s<0?(a="0."+Sb(-s-1)+a,r&&(n=r-i)>0&&(a+=Sb(n))):s>=i?(a+=Sb(s+1-i),r&&(n=r-s-1)>0&&(a=a+"."+Sb(n))):((n=s+1)<i&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-i)>0&&(s+1===i&&(a+="."),a+=Sb(n))),e.s<0?"-"+a:a}function aNe(e,t){if(e.length>t)return e.length=t,!0}function xit(e){var t,r,n;function s(a){var i=this;if(!(i instanceof s))return new s(a);if(i.constructor=s,a instanceof s){i.s=a.s,i.e=a.e,i.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(qw+a);if(a>0)i.s=1;else if(a<0)a=-a,i.s=-1;else{i.s=0,i.e=0,i.d=[0];return}if(a===~~a&&a<1e7){i.e=0,i.d=[a];return}return sNe(i,a.toString())}else if(typeof a!="string")throw Error(qw+a);if(a.charCodeAt(0)===45?(a=a.slice(1),i.s=-1):i.s=1,eOr.test(a))sNe(i,a);else throw Error(qw+a)}if(s.prototype=fr,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=xit,s.config=s.set=tOr,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return s.config(e),s}function tOr(e){if(!e||typeof e!="object")throw Error(Ch+"Object expected");var t,r,n,s=["precision",1,tC,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<s.length;t+=3)if((n=e[r=s[t]])!==void 0)if(rC(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(qw+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(qw+r+": "+n);return this}var Che=xit(J1r);Bd=new Che(1);const bs=Che;function wit(e){var t;return e===0?t=1:t=Math.floor(new bs(e).abs().log(10).toNumber())+1,t}function Sit(e,t,r){for(var n=new bs(e),s=0,a=[];n.lt(t)&&s<1e5;)a.push(n.toNumber()),n=n.add(r),s++;return a}var Oit=e=>{var[t,r]=e,[n,s]=[t,r];return t>r&&([n,s]=[r,t]),[n,s]},jhe=(e,t,r)=>{if(e.lte(0))return new bs(0);var n=wit(e.toNumber()),s=new bs(10).pow(n),a=e.div(s),i=n!==1?.05:.1,l=new bs(Math.ceil(a.div(i).toNumber())).add(r).mul(i),c=l.mul(s);return t?new bs(c.toNumber()):new bs(Math.ceil(c.toNumber()))},kit=(e,t,r)=>{var n;if(e.lte(0))return new bs(0);var s=[1,2,2.5,5],a=e.toNumber(),i=Math.floor(new bs(a).abs().log(10).toNumber()),l=new bs(10).pow(i),c=e.div(l).toNumber(),u=s.findIndex(p=>p>=c-1e-10);if(u===-1&&(l=l.mul(10),u=0),u+=r,u>=s.length){var d=Math.floor(u/s.length);u%=s.length,l=l.mul(new bs(10).pow(d))}var f=(n=s[u])!==null&&n!==void 0?n:1,h=new bs(f).mul(l);return t?h:new bs(Math.ceil(h.toNumber()))},rOr=(e,t,r)=>{var n=new bs(1),s=new bs(e);if(!s.isint()&&r){var a=Math.abs(e);a<1?(n=new bs(10).pow(wit(e)-1),s=new bs(Math.floor(s.div(n).toNumber())).mul(n)):a>1&&(s=new bs(Math.floor(e)))}else e===0?s=new bs(Math.floor((t-1)/2)):r||(s=new bs(Math.floor(e)));for(var i=Math.floor((t-1)/2),l=[],c=0;c<t;c++)l.push(s.add(new bs(c-i).mul(n)).toNumber());return l},_it=function(t,r,n,s){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:jhe;if(!Number.isFinite((r-t)/(n-1)))return{step:new bs(0),tickMin:new bs(0),tickMax:new bs(0)};var l=i(new bs(r).sub(t).div(n-1),s,a),c;t<=0&&r>=0?c=new bs(0):(c=new bs(t).add(r).div(2),c=c.sub(new bs(c).mod(l)));var u=Math.ceil(c.sub(t).div(l).toNumber()),d=Math.ceil(new bs(r).sub(c).div(l).toNumber()),f=u+d+1;return f>n?_it(t,r,n,s,a+1,i):(f<n&&(d=r>0?d+(n-f):d,u=r>0?u:u+(n-f)),{step:l,tickMin:c.sub(new bs(u).mul(l)),tickMax:c.add(new bs(d).mul(l))})},iNe=function(t){var[r,n]=t,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Math.max(s,2),[c,u]=Oit([r,n]);if(c===-1/0||u===1/0){var d=u===1/0?[c,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),u];return r>n?d.reverse():d}if(c===u)return rOr(c,s,a);var f=i==="snap125"?kit:jhe,{step:h,tickMin:p,tickMax:m}=_it(c,u,l,a,0,f),g=Sit(p,m.add(new bs(.1).mul(h)),h);return r>n?g.reverse():g},oNe=function(t,r){var[n,s]=t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",[l,c]=Oit([n,s]);if(l===-1/0||c===1/0)return[n,s];if(l===c)return[l];var u=i==="snap125"?kit:jhe,d=Math.max(r,2),f=u(new bs(c).sub(l).div(d-1),a,0),h=[...Sit(new bs(l),new bs(c),f),c];return a===!1&&(h=h.map(p=>Math.round(p))),n>s?h.reverse():h},nOr=e=>e.rootProps.barCategoryGap,i9=e=>e.rootProps.stackOffset,Eit=e=>e.rootProps.reverseStackOrder,The=e=>e.options.chartName,Nhe=e=>e.rootProps.syncId,Cit=e=>e.rootProps.syncMethod,Ahe=e=>e.options.eventEmitter,Yc={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},F0={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},im={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},o9=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function l9(e,t,r){if(r!=="auto")return r;if(e!=null)return gv(e,t)?"category":"number"}function lNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function r4(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lNe(Object(r),!0).forEach(function(n){sOr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function sOr(e,t,r){return(t=aOr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aOr(e){var t=iOr(e,"string");return typeof t=="symbol"?t:t+""}function iOr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var cNe={allowDataOverflow:F0.allowDataOverflow,allowDecimals:F0.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:F0.angleAxisId,includeHidden:!1,name:void 0,reversed:F0.reversed,scale:F0.scale,tick:F0.tick,tickCount:void 0,ticks:void 0,type:F0.type,unit:void 0,niceTicks:"auto"},uNe={allowDataOverflow:im.allowDataOverflow,allowDecimals:im.allowDecimals,allowDuplicatedCategory:im.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:im.radiusAxisId,includeHidden:im.includeHidden,name:void 0,reversed:im.reversed,scale:im.scale,tick:im.tick,tickCount:im.tickCount,ticks:void 0,type:im.type,unit:void 0,niceTicks:"auto"},oOr=(e,t)=>{if(t!=null)return e.polarAxis.angleAxis[t]},Ihe=Xe([oOr,Zat],(e,t)=>{var r;if(e!=null)return e;var n=(r=l9(t,"angleAxis",cNe.type))!==null&&r!==void 0?r:"category";return r4(r4({},cNe),{},{type:n})}),lOr=(e,t)=>e.polarAxis.radiusAxis[t],Rhe=Xe([lOr,Zat],(e,t)=>{var r;if(e!=null)return e;var n=(r=l9(t,"radiusAxis",uNe.type))!==null&&r!==void 0?r:"category";return r4(r4({},uNe),{},{type:n})}),c9=e=>e.polarOptions,Phe=Xe([yv,vv,ec],D1r),jit=Xe([c9,Phe],(e,t)=>{if(e!=null)return Cx(e.innerRadius,t,0)}),Tit=Xe([c9,Phe],(e,t)=>{if(e!=null)return Cx(e.outerRadius,t,t*.8)}),cOr=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:r}=e;return[t,r]},Nit=Xe([c9],cOr);Xe([Ihe,Nit],o9);var Ait=Xe([Phe,jit,Tit],(e,t,r)=>{if(!(e==null||t==null||r==null))return[t,r]});Xe([Rhe,Ait],o9);var Iit=Xe([$i,c9,jit,Tit,yv,vv],(e,t,r,n,s,a)=>{if(!(e!=="centric"&&e!=="radial"||t==null||r==null||n==null)){var{cx:i,cy:l,startAngle:c,endAngle:u}=t;return{cx:Cx(i,s,s/2),cy:Cx(l,a,a/2),innerRadius:r,outerRadius:n,startAngle:c,endAngle:u,clockWise:!1}}}),El=(e,t)=>t,u9=(e,t,r)=>r;function Rit(e){return e?.id}function Pit(e,t,r){var{chartData:n=[]}=t,{allowDuplicatedCategory:s,dataKey:a}=r,i=new Map;return e.forEach(l=>{var c,u=(c=l.data)!==null&&c!==void 0?c:n;if(!(u==null||u.length===0)){var d=Rit(l);u.forEach((f,h)=>{var p=a==null||s?h:String(Yl(f,a,null)),m=Yl(f,l.dataKey,0),g;i.has(p)?g=i.get(p):g={},Object.assign(g,{[d]:m}),i.set(p,g)})}}),Array.from(i.values())}function Mhe(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var d9=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function f9(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function uOr(e,t){if(e.length===t.length){for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return!1}var Cl=e=>{var t=$i(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},nC=e=>e.tooltip.settings.axisId;function Dhe(e){if(e!=null){var t=e.ticks,r=e.bandwidth,n=e.range(),s=[Math.min(...n),Math.max(...n)];return{domain:()=>e.domain(),range:(function(a){function i(){return a.apply(this,arguments)}return i.toString=function(){return a.toString()},i})(()=>s),rangeMin:()=>s[0],rangeMax:()=>s[1],isInRange(a){var i=s[0],l=s[1];return i<=l?a>=i&&a<=l:a>=l&&a<=i},bandwidth:r?()=>r.call(e):void 0,ticks:t?a=>t.call(e,a):void 0,map:(a,i)=>{var l=e(a);if(l!=null){if(e.bandwidth&&i!==null&&i!==void 0&&i.position){var c=e.bandwidth();switch(i.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}}var dOr=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Gm(t)){for(var r,n,s=0;s<t.length;s++){var a=t[s];zs(a)&&((r===void 0||a<r)&&(r=a),(n===void 0||a>n)&&(n=a))}return r!==void 0&&n!==void 0?[r,n]:void 0}return t}default:return t}};function Xb(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function fOr(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Lhe(e){let t,r,n;e.length!==2?(t=Xb,r=(l,c)=>Xb(e(l),c),n=(l,c)=>e(l)-c):(t=e===Xb||e===fOr?e:hOr,r=e,n=e);function s(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;r(l[f],c)<0?u=f+1:d=f}while(u<d)}return u}function a(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;r(l[f],c)<=0?u=f+1:d=f}while(u<d)}return u}function i(l,c,u=0,d=l.length){const f=s(l,c,u,d-1);return f>u&&n(l[f-1],c)>-n(l[f],c)?f-1:f}return{left:s,center:i,right:a}}function hOr(){return 0}function Mit(e){return e===null?NaN:+e}function*pOr(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const mOr=Lhe(Xb),vP=mOr.right;Lhe(Mit).center;class dNe extends Map{constructor(t,r=vOr){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,s]of t)this.set(n,s)}get(t){return super.get(fNe(this,t))}has(t){return super.has(fNe(this,t))}set(t,r){return super.set(gOr(this,t),r)}delete(t){return super.delete(yOr(this,t))}}function fNe({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function gOr({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function yOr({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function vOr(e){return e!==null&&typeof e=="object"?e.valueOf():e}function bOr(e=Xb){if(e===Xb)return Dit;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function Dit(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const xOr=Math.sqrt(50),wOr=Math.sqrt(10),SOr=Math.sqrt(2);function n4(e,t,r){const n=(t-e)/Math.max(0,r),s=Math.floor(Math.log10(n)),a=n/Math.pow(10,s),i=a>=xOr?10:a>=wOr?5:a>=SOr?2:1;let l,c,u;return s<0?(u=Math.pow(10,-s)/i,l=Math.round(e*u),c=Math.round(t*u),l/u<e&&++l,c/u>t&&--c,u=-u):(u=Math.pow(10,s)*i,l=Math.round(e/u),c=Math.round(t/u),l*u<e&&++l,c*u>t&&--c),c<l&&.5<=r&&r<2?n4(e,t,r*2):[l,c,u]}function Aae(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];const n=t<e,[s,a,i]=n?n4(t,e,r):n4(e,t,r);if(!(a>=s))return[];const l=a-s+1,c=new Array(l);if(n)if(i<0)for(let u=0;u<l;++u)c[u]=(a-u)/-i;else for(let u=0;u<l;++u)c[u]=(a-u)*i;else if(i<0)for(let u=0;u<l;++u)c[u]=(s+u)/-i;else for(let u=0;u<l;++u)c[u]=(s+u)*i;return c}function Iae(e,t,r){return t=+t,e=+e,r=+r,n4(e,t,r)[2]}function Rae(e,t,r){t=+t,e=+e,r=+r;const n=t<e,s=n?Iae(t,e,r):Iae(e,t,r);return(n?-1:1)*(s<0?1/-s:s)}function hNe(e,t){let r;for(const n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function pNe(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function Lit(e,t,r=0,n=1/0,s){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(s=s===void 0?Dit:bOr(s);n>r;){if(n-r>600){const c=n-r+1,u=t-r+1,d=Math.log(c),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),p=Math.max(r,Math.floor(t-u*f/c+h)),m=Math.min(n,Math.floor(t+(c-u)*f/c+h));Lit(e,t,p,m,s)}const a=e[t];let i=r,l=n;for(eT(e,r,t),s(e[n],a)>0&&eT(e,r,n);i<l;){for(eT(e,i,l),++i,--l;s(e[i],a)<0;)++i;for(;s(e[l],a)>0;)--l}s(e[r],a)===0?eT(e,r,l):(++l,eT(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function eT(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function OOr(e,t,r){if(e=Float64Array.from(pOr(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return pNe(e);if(t>=1)return hNe(e);var n,s=(n-1)*t,a=Math.floor(s),i=hNe(Lit(e,a).subarray(0,a+1)),l=pNe(e.subarray(a+1));return i+(l-i)*(s-a)}}function kOr(e,t,r=Mit){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,s=(n-1)*t,a=Math.floor(s),i=+r(e[a],a,e),l=+r(e[a+1],a+1,e);return i+(l-i)*(s-a)}}function _Or(e,t,r){e=+e,t=+t,r=(s=arguments.length)<2?(t=e,e=0,1):s<3?1:+r;for(var n=-1,s=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(s);++n<s;)a[n]=e+n*r;return a}function Fh(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function bv(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 Pae=Symbol("implicit");function $he(){var e=new dNe,t=[],r=[],n=Pae;function s(a){let i=e.get(a);if(i===void 0){if(n!==Pae)return n;e.set(a,i=t.push(a)-1)}return r[i%r.length]}return s.domain=function(a){if(!arguments.length)return t.slice();t=[],e=new dNe;for(const i of a)e.has(i)||e.set(i,t.push(i)-1);return s},s.range=function(a){return arguments.length?(r=Array.from(a),s):r.slice()},s.unknown=function(a){return arguments.length?(n=a,s):n},s.copy=function(){return $he(t,r).unknown(n)},Fh.apply(s,arguments),s}function Fhe(){var e=$he().unknown(void 0),t=e.domain,r=e.range,n=0,s=1,a,i,l=!1,c=0,u=0,d=.5;delete e.unknown;function f(){var h=t().length,p=s<n,m=p?s:n,g=p?n:s;a=(g-m)/Math.max(1,h-c+u*2),l&&(a=Math.floor(a)),m+=(g-m-a*(h-c))*d,i=a*(1-c),l&&(m=Math.round(m),i=Math.round(i));var y=_Or(h).map(function(x){return m+a*x});return r(p?y.reverse():y)}return e.domain=function(h){return arguments.length?(t(h),f()):t()},e.range=function(h){return arguments.length?([n,s]=h,n=+n,s=+s,f()):[n,s]},e.rangeRound=function(h){return[n,s]=h,n=+n,s=+s,l=!0,f()},e.bandwidth=function(){return i},e.step=function(){return a},e.round=function(h){return arguments.length?(l=!!h,f()):l},e.padding=function(h){return arguments.length?(c=Math.min(1,u=+h),f()):c},e.paddingInner=function(h){return arguments.length?(c=Math.min(1,h),f()):c},e.paddingOuter=function(h){return arguments.length?(u=+h,f()):u},e.align=function(h){return arguments.length?(d=Math.max(0,Math.min(1,h)),f()):d},e.copy=function(){return Fhe(t(),[n,s]).round(l).paddingInner(c).paddingOuter(u).align(d)},Fh.apply(f(),arguments)}function $it(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return $it(t())},e}function EOr(){return $it(Fhe.apply(null,arguments).paddingInner(1))}function zhe(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Fit(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function bP(){}var rI=.7,s4=1/rI,Kk="\\s*([+-]?\\d+)\\s*",nI="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Zm="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",COr=/^#([0-9a-f]{3,8})$/,jOr=new RegExp(`^rgb\\(${Kk},${Kk},${Kk}\\)$`),TOr=new RegExp(`^rgb\\(${Zm},${Zm},${Zm}\\)$`),NOr=new RegExp(`^rgba\\(${Kk},${Kk},${Kk},${nI}\\)$`),AOr=new RegExp(`^rgba\\(${Zm},${Zm},${Zm},${nI}\\)$`),IOr=new RegExp(`^hsl\\(${nI},${Zm},${Zm}\\)$`),ROr=new RegExp(`^hsla\\(${nI},${Zm},${Zm},${nI}\\)$`),mNe={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};zhe(bP,AS,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:gNe,formatHex:gNe,formatHex8:POr,formatHsl:MOr,formatRgb:yNe,toString:yNe});function gNe(){return this.rgb().formatHex()}function POr(){return this.rgb().formatHex8()}function MOr(){return zit(this).formatHsl()}function yNe(){return this.rgb().formatRgb()}function AS(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=COr.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?vNe(t):r===3?new Uu(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?LD(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?LD(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=jOr.exec(e))?new Uu(t[1],t[2],t[3],1):(t=TOr.exec(e))?new Uu(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=NOr.exec(e))?LD(t[1],t[2],t[3],t[4]):(t=AOr.exec(e))?LD(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=IOr.exec(e))?wNe(t[1],t[2]/100,t[3]/100,1):(t=ROr.exec(e))?wNe(t[1],t[2]/100,t[3]/100,t[4]):mNe.hasOwnProperty(e)?vNe(mNe[e]):e==="transparent"?new Uu(NaN,NaN,NaN,0):null}function vNe(e){return new Uu(e>>16&255,e>>8&255,e&255,1)}function LD(e,t,r,n){return n<=0&&(e=t=r=NaN),new Uu(e,t,r,n)}function DOr(e){return e instanceof bP||(e=AS(e)),e?(e=e.rgb(),new Uu(e.r,e.g,e.b,e.opacity)):new Uu}function Mae(e,t,r,n){return arguments.length===1?DOr(e):new Uu(e,t,r,n??1)}function Uu(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}zhe(Uu,Mae,Fit(bP,{brighter(e){return e=e==null?s4:Math.pow(s4,e),new Uu(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?rI:Math.pow(rI,e),new Uu(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Uu(Hw(this.r),Hw(this.g),Hw(this.b),a4(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:bNe,formatHex:bNe,formatHex8:LOr,formatRgb:xNe,toString:xNe}));function bNe(){return`#${Cw(this.r)}${Cw(this.g)}${Cw(this.b)}`}function LOr(){return`#${Cw(this.r)}${Cw(this.g)}${Cw(this.b)}${Cw((isNaN(this.opacity)?1:this.opacity)*255)}`}function xNe(){const e=a4(this.opacity);return`${e===1?"rgb(":"rgba("}${Hw(this.r)}, ${Hw(this.g)}, ${Hw(this.b)}${e===1?")":`, ${e})`}`}function a4(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Hw(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Cw(e){return e=Hw(e),(e<16?"0":"")+e.toString(16)}function wNe(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new dp(e,t,r,n)}function zit(e){if(e instanceof dp)return new dp(e.h,e.s,e.l,e.opacity);if(e instanceof bP||(e=AS(e)),!e)return new dp;if(e instanceof dp)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,s=Math.min(t,r,n),a=Math.max(t,r,n),i=NaN,l=a-s,c=(a+s)/2;return l?(t===a?i=(r-n)/l+(r<n)*6:r===a?i=(n-t)/l+2:i=(t-r)/l+4,l/=c<.5?a+s:2-a-s,i*=60):l=c>0&&c<1?0:i,new dp(i,l,c,e.opacity)}function $Or(e,t,r,n){return arguments.length===1?zit(e):new dp(e,t,r,n??1)}function dp(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}zhe(dp,$Or,Fit(bP,{brighter(e){return e=e==null?s4:Math.pow(s4,e),new dp(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?rI:Math.pow(rI,e),new dp(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,r=this.l,n=r+(r<.5?r:1-r)*t,s=2*r-n;return new Uu(MH(e>=240?e-240:e+120,s,n),MH(e,s,n),MH(e<120?e+240:e-120,s,n),this.opacity)},clamp(){return new dp(SNe(this.h),$D(this.s),$D(this.l),a4(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=a4(this.opacity);return`${e===1?"hsl(":"hsla("}${SNe(this.h)}, ${$D(this.s)*100}%, ${$D(this.l)*100}%${e===1?")":`, ${e})`}`}}));function SNe(e){return e=(e||0)%360,e<0?e+360:e}function $D(e){return Math.max(0,Math.min(1,e||0))}function MH(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const Bhe=e=>()=>e;function FOr(e,t){return function(r){return e+r*t}}function zOr(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function BOr(e){return(e=+e)==1?Bit:function(t,r){return r-t?zOr(t,r,e):Bhe(isNaN(t)?r:t)}}function Bit(e,t){var r=t-e;return r?FOr(e,r):Bhe(isNaN(e)?t:e)}const i4=(function e(t){var r=BOr(t);function n(s,a){var i=r((s=Mae(s)).r,(a=Mae(a)).r),l=r(s.g,a.g),c=r(s.b,a.b),u=Bit(s.opacity,a.opacity);return function(d){return s.r=i(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return n.gamma=e,n})(1);function UOr(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),s;return function(a){for(s=0;s<r;++s)n[s]=e[s]*(1-a)+t[s]*a;return n}}function VOr(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function qOr(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,s=new Array(n),a=new Array(r),i;for(i=0;i<n;++i)s[i]=Ly(e[i],t[i]);for(;i<r;++i)a[i]=t[i];return function(l){for(i=0;i<n;++i)a[i]=s[i](l);return a}}function HOr(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function op(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function QOr(e,t){var r={},n={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?r[s]=Ly(e[s],t[s]):n[s]=t[s];return function(a){for(s in r)n[s]=r[s](a);return n}}var Dae=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,DH=new RegExp(Dae.source,"g");function WOr(e){return function(){return e}}function GOr(e){return function(t){return e(t)+""}}function Uit(e,t){var r=Dae.lastIndex=DH.lastIndex=0,n,s,a,i=-1,l=[],c=[];for(e=e+"",t=t+"";(n=Dae.exec(e))&&(s=DH.exec(t));)(a=s.index)>r&&(a=t.slice(r,a),l[i]?l[i]+=a:l[++i]=a),(n=n[0])===(s=s[0])?l[i]?l[i]+=s:l[++i]=s:(l[++i]=null,c.push({i,x:op(n,s)})),r=DH.lastIndex;return r<t.length&&(a=t.slice(r),l[i]?l[i]+=a:l[++i]=a),l.length<2?c[0]?GOr(c[0].x):WOr(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function Ly(e,t){var r=typeof t,n;return t==null||r==="boolean"?Bhe(t):(r==="number"?op:r==="string"?(n=AS(t))?(t=n,i4):Uit:t instanceof AS?i4:t instanceof Date?HOr:VOr(t)?UOr:Array.isArray(t)?qOr:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?QOr:op)(e,t)}function Uhe(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var ONe=180/Math.PI,Lae={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vit(e,t,r,n,s,a){var i,l,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*r+t*n)&&(r-=e*c,n-=t*c),(l=Math.sqrt(r*r+n*n))&&(r/=l,n/=l,c/=l),e*n<t*r&&(e=-e,t=-t,c=-c,i=-i),{translateX:s,translateY:a,rotate:Math.atan2(t,e)*ONe,skewX:Math.atan(c)*ONe,scaleX:i,scaleY:l}}var FD;function ZOr(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Lae:Vit(t.a,t.b,t.c,t.d,t.e,t.f)}function YOr(e){return e==null||(FD||(FD=document.createElementNS("http://www.w3.org/2000/svg","g")),FD.setAttribute("transform",e),!(e=FD.transform.baseVal.consolidate()))?Lae:(e=e.matrix,Vit(e.a,e.b,e.c,e.d,e.e,e.f))}function qit(e,t,r,n){function s(u){return u.length?u.pop()+" ":""}function a(u,d,f,h,p,m){if(u!==f||d!==h){var g=p.push("translate(",null,t,null,r);m.push({i:g-4,x:op(u,f)},{i:g-2,x:op(d,h)})}else(f||h)&&p.push("translate("+f+t+h+r)}function i(u,d,f,h){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(s(f)+"rotate(",null,n)-2,x:op(u,d)})):d&&f.push(s(f)+"rotate("+d+n)}function l(u,d,f,h){u!==d?h.push({i:f.push(s(f)+"skewX(",null,n)-2,x:op(u,d)}):d&&f.push(s(f)+"skewX("+d+n)}function c(u,d,f,h,p,m){if(u!==f||d!==h){var g=p.push(s(p)+"scale(",null,",",null,")");m.push({i:g-4,x:op(u,f)},{i:g-2,x:op(d,h)})}else(f!==1||h!==1)&&p.push(s(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),a(u.translateX,u.translateY,d.translateX,d.translateY,f,h),i(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var m=-1,g=h.length,y;++m<g;)f[(y=h[m]).i]=y.x(p);return f.join("")}}}var XOr=qit(ZOr,"px, ","px)","deg)"),KOr=qit(YOr,", ",")",")"),JOr=1e-12;function kNe(e){return((e=Math.exp(e))+1/e)/2}function ekr(e){return((e=Math.exp(e))-1/e)/2}function tkr(e){return((e=Math.exp(2*e))-1)/(e+1)}const b$=(function e(t,r,n){function s(a,i){var l=a[0],c=a[1],u=a[2],d=i[0],f=i[1],h=i[2],p=d-l,m=f-c,g=p*p+m*m,y,x;if(g<JOr)x=Math.log(h/u)/t,y=function(T){return[l+T*p,c+T*m,u*Math.exp(t*T*x)]};else{var w=Math.sqrt(g),S=(h*h-u*u+n*g)/(2*u*r*w),k=(h*h-u*u-n*g)/(2*h*r*w),_=Math.log(Math.sqrt(S*S+1)-S),E=Math.log(Math.sqrt(k*k+1)-k);x=(E-_)/t,y=function(T){var j=T*x,N=kNe(_),I=u/(r*w)*(N*tkr(t*j+_)-ekr(_));return[l+I*p,c+I*m,u*N/kNe(t*j+_)]}}return y.duration=x*1e3*t/Math.SQRT2,y}return s.rho=function(a){var i=Math.max(.001,+a),l=i*i,c=l*l;return e(i,l,c)},s})(Math.SQRT2,2,4);function rkr(e,t){t===void 0&&(t=e,e=Ly);for(var r=0,n=t.length-1,s=t[0],a=new Array(n<0?0:n);r<n;)a[r]=e(s,s=t[++r]);return function(i){var l=Math.max(0,Math.min(n-1,Math.floor(i*=n)));return a[l](i-l)}}function nkr(e){return function(){return e}}function o4(e){return+e}var _Ne=[0,1];function Xc(e){return e}function $ae(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:nkr(isNaN(t)?NaN:.5)}function skr(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function akr(e,t,r){var n=e[0],s=e[1],a=t[0],i=t[1];return s<n?(n=$ae(s,n),a=r(i,a)):(n=$ae(n,s),a=r(a,i)),function(l){return a(n(l))}}function ikr(e,t,r){var n=Math.min(e.length,t.length)-1,s=new Array(n),a=new Array(n),i=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++i<n;)s[i]=$ae(e[i],e[i+1]),a[i]=r(t[i],t[i+1]);return function(l){var c=vP(e,l,1,n)-1;return a[c](s[c](l))}}function xP(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function h9(){var e=_Ne,t=_Ne,r=Ly,n,s,a,i=Xc,l,c,u;function d(){var h=Math.min(e.length,t.length);return i!==Xc&&(i=skr(e[0],e[h-1])),l=h>2?ikr:akr,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?a:(c||(c=l(e.map(n),t,r)))(n(i(h)))}return f.invert=function(h){return i(s((u||(u=l(t,e.map(n),op)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,o4),d()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),d()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),r=Uhe,d()},f.clamp=function(h){return arguments.length?(i=h?!0:Xc,d()):i!==Xc},f.interpolate=function(h){return arguments.length?(r=h,d()):r},f.unknown=function(h){return arguments.length?(a=h,f):a},function(h,p){return n=h,s=p,d()}}function Vhe(){return h9()(Xc,Xc)}function okr(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function l4(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function W_(e){return e=l4(Math.abs(e)),e?e[1]:NaN}function lkr(e,t){return function(r,n){for(var s=r.length,a=[],i=0,l=e[0],c=0;s>0&&l>0&&(c+l+1>n&&(l=Math.max(1,n-c)),a.push(r.substring(s-=l,s+l)),!((c+=l+1)>n));)l=e[i=(i+1)%e.length];return a.reverse().join(t)}}function ckr(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var ukr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function sI(e){if(!(t=ukr.exec(e)))throw new Error("invalid format: "+e);var t;return new qhe({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]})}sI.prototype=qhe.prototype;function qhe(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+""}qhe.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 dkr(e){e:for(var t=e.length,r=1,n=-1,s;r<t;++r)switch(e[r]){case".":n=s=r;break;case"0":n===0&&(n=r),s=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(s+1):e}var c4;function fkr(e,t){var r=l4(e,t);if(!r)return c4=void 0,e.toPrecision(t);var n=r[0],s=r[1],a=s-(c4=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,i=n.length;return a===i?n:a>i?n+new Array(a-i+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+l4(e,Math.max(0,t+a-1))[0]}function ENe(e,t){var r=l4(e,t);if(!r)return e+"";var n=r[0],s=r[1];return s<0?"0."+new Array(-s).join("0")+n:n.length>s+1?n.slice(0,s+1)+"."+n.slice(s+1):n+new Array(s-n.length+2).join("0")}const CNe={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:okr,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)=>ENe(e*100,t),r:ENe,s:fkr,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function jNe(e){return e}var TNe=Array.prototype.map,NNe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function hkr(e){var t=e.grouping===void 0||e.thousands===void 0?jNe:lkr(TNe.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",s=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?jNe:ckr(TNe.call(e.numerals,String)),i=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,h){f=sI(f);var p=f.fill,m=f.align,g=f.sign,y=f.symbol,x=f.zero,w=f.width,S=f.comma,k=f.precision,_=f.trim,E=f.type;E==="n"?(S=!0,E="g"):CNe[E]||(k===void 0&&(k=12),_=!0,E="g"),(x||p==="0"&&m==="=")&&(x=!0,p="0",m="=");var T=(h&&h.prefix!==void 0?h.prefix:"")+(y==="$"?r:y==="#"&&/[boxX]/.test(E)?"0"+E.toLowerCase():""),j=(y==="$"?n:/[%p]/.test(E)?i:"")+(h&&h.suffix!==void 0?h.suffix:""),N=CNe[E],I=/[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 P(R){var $=T,M=j,z,U,B;if(E==="c")M=N(R)+M,R="";else{R=+R;var H=R<0||1/R<0;if(R=isNaN(R)?c:N(Math.abs(R),k),_&&(R=dkr(R)),H&&+R==0&&g!=="+"&&(H=!1),$=(H?g==="("?g:l:g==="-"||g==="("?"":g)+$,M=(E==="s"&&!isNaN(R)&&c4!==void 0?NNe[8+c4/3]:"")+M+(H&&g==="("?")":""),I){for(z=-1,U=R.length;++z<U;)if(B=R.charCodeAt(z),48>B||B>57){M=(B===46?s+R.slice(z+1):R.slice(z))+M,R=R.slice(0,z);break}}}S&&!x&&(R=t(R,1/0));var W=$.length+R.length+M.length,L=W<w?new Array(w-W+1).join(p):"";switch(S&&x&&(R=t(L+R,L.length?w-M.length:1/0),L=""),m){case"<":R=$+R+M+L;break;case"=":R=$+L+R+M;break;case"^":R=L.slice(0,W=L.length>>1)+$+R+M+L.slice(W);break;default:R=L+$+R+M;break}return a(R)}return P.toString=function(){return f+""},P}function d(f,h){var p=Math.max(-8,Math.min(8,Math.floor(W_(h)/3)))*3,m=Math.pow(10,-p),g=u((f=sI(f),f.type="f",f),{suffix:NNe[8+p/3]});return function(y){return g(m*y)}}return{format:u,formatPrefix:d}}var zD,Hhe,Hit;pkr({thousands:",",grouping:[3],currency:["$",""]});function pkr(e){return zD=hkr(e),Hhe=zD.format,Hit=zD.formatPrefix,zD}function mkr(e){return Math.max(0,-W_(Math.abs(e)))}function gkr(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(W_(t)/3)))*3-W_(Math.abs(e)))}function ykr(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,W_(t)-W_(e))+1}function Qit(e,t,r,n){var s=Rae(e,t,r),a;switch(n=sI(n??",f"),n.type){case"s":{var i=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=gkr(s,i))&&(n.precision=a),Hit(n,i)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=ykr(s,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=mkr(s))&&(n.precision=a-(n.type==="%")*2);break}}return Hhe(n)}function a0(e){var t=e.domain;return e.ticks=function(r){var n=t();return Aae(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var s=t();return Qit(s[0],s[s.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),s=0,a=n.length-1,i=n[s],l=n[a],c,u,d=10;for(l<i&&(u=i,i=l,l=u,u=s,s=a,a=u);d-- >0;){if(u=Iae(i,l,r),u===c)return n[s]=i,n[a]=l,t(n);if(u>0)i=Math.floor(i/u)*u,l=Math.ceil(l/u)*u;else if(u<0)i=Math.ceil(i*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function Wit(){var e=Vhe();return e.copy=function(){return xP(e,Wit())},Fh.apply(e,arguments),a0(e)}function Git(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,o4),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return Git(e).unknown(t)},e=arguments.length?Array.from(e,o4):[0,1],a0(r)}function Zit(e,t){e=e.slice();var r=0,n=e.length-1,s=e[r],a=e[n],i;return a<s&&(i=r,r=n,n=i,i=s,s=a,a=i),e[r]=t.floor(s),e[n]=t.ceil(a),e}function ANe(e){return Math.log(e)}function INe(e){return Math.exp(e)}function vkr(e){return-Math.log(-e)}function bkr(e){return-Math.exp(-e)}function xkr(e){return isFinite(e)?+("1e"+e):e<0?0:e}function wkr(e){return e===10?xkr:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Skr(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 RNe(e){return(t,r)=>-e(-t,r)}function Qhe(e){const t=e(ANe,INe),r=t.domain;let n=10,s,a;function i(){return s=Skr(n),a=wkr(n),r()[0]<0?(s=RNe(s),a=RNe(a),e(vkr,bkr)):e(ANe,INe),t}return t.base=function(l){return arguments.length?(n=+l,i()):n},t.domain=function(l){return arguments.length?(r(l),i()):r()},t.ticks=l=>{const c=r();let u=c[0],d=c[c.length-1];const f=d<u;f&&([u,d]=[d,u]);let h=s(u),p=s(d),m,g;const y=l==null?10:+l;let x=[];if(!(n%1)&&p-h<y){if(h=Math.floor(h),p=Math.ceil(p),u>0){for(;h<=p;++h)for(m=1;m<n;++m)if(g=h<0?m/a(-h):m*a(h),!(g<u)){if(g>d)break;x.push(g)}}else for(;h<=p;++h)for(m=n-1;m>=1;--m)if(g=h>0?m/a(-h):m*a(h),!(g<u)){if(g>d)break;x.push(g)}x.length*2<y&&(x=Aae(u,d,y))}else x=Aae(h,p,Math.min(p-h,y)).map(a);return f?x.reverse():x},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=sI(c)).precision==null&&(c.trim=!0),c=Hhe(c)),l===1/0)return c;const u=Math.max(1,n*l/t.ticks().length);return d=>{let f=d/a(Math.round(s(d)));return f*n<n-.5&&(f*=n),f<=u?c(d):""}},t.nice=()=>r(Zit(r(),{floor:l=>a(Math.floor(s(l))),ceil:l=>a(Math.ceil(s(l)))})),t}function Yit(){const e=Qhe(h9()).domain([1,10]);return e.copy=()=>xP(e,Yit()).base(e.base()),Fh.apply(e,arguments),e}function PNe(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function MNe(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Whe(e){var t=1,r=e(PNe(t),MNe(t));return r.constant=function(n){return arguments.length?e(PNe(t=+n),MNe(t)):t},a0(r)}function Xit(){var e=Whe(h9());return e.copy=function(){return xP(e,Xit()).constant(e.constant())},Fh.apply(e,arguments)}function DNe(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Okr(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function kkr(e){return e<0?-e*e:e*e}function Ghe(e){var t=e(Xc,Xc),r=1;function n(){return r===1?e(Xc,Xc):r===.5?e(Okr,kkr):e(DNe(r),DNe(1/r))}return t.exponent=function(s){return arguments.length?(r=+s,n()):r},a0(t)}function Zhe(){var e=Ghe(h9());return e.copy=function(){return xP(e,Zhe()).exponent(e.exponent())},Fh.apply(e,arguments),e}function _kr(){return Zhe.apply(null,arguments).exponent(.5)}function LNe(e){return Math.sign(e)*e*e}function Ekr(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function Kit(){var e=Vhe(),t=[0,1],r=!1,n;function s(a){var i=Ekr(e(a));return isNaN(i)?n:r?Math.round(i):i}return s.invert=function(a){return e.invert(LNe(a))},s.domain=function(a){return arguments.length?(e.domain(a),s):e.domain()},s.range=function(a){return arguments.length?(e.range((t=Array.from(a,o4)).map(LNe)),s):t.slice()},s.rangeRound=function(a){return s.range(a).round(!0)},s.round=function(a){return arguments.length?(r=!!a,s):r},s.clamp=function(a){return arguments.length?(e.clamp(a),s):e.clamp()},s.unknown=function(a){return arguments.length?(n=a,s):n},s.copy=function(){return Kit(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Fh.apply(s,arguments),a0(s)}function Jit(){var e=[],t=[],r=[],n;function s(){var i=0,l=Math.max(1,t.length);for(r=new Array(l-1);++i<l;)r[i-1]=kOr(e,i/l);return a}function a(i){return i==null||isNaN(i=+i)?n:t[vP(r,i)]}return a.invertExtent=function(i){var l=t.indexOf(i);return l<0?[NaN,NaN]:[l>0?r[l-1]:e[0],l<r.length?r[l]:e[e.length-1]]},a.domain=function(i){if(!arguments.length)return e.slice();e=[];for(let l of i)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(Xb),s()},a.range=function(i){return arguments.length?(t=Array.from(i),s()):t.slice()},a.unknown=function(i){return arguments.length?(n=i,a):n},a.quantiles=function(){return r.slice()},a.copy=function(){return Jit().domain(e).range(t).unknown(n)},Fh.apply(a,arguments)}function eot(){var e=0,t=1,r=1,n=[.5],s=[0,1],a;function i(c){return c!=null&&c<=c?s[vP(n,c,0,r)]:a}function l(){var c=-1;for(n=new Array(r);++c<r;)n[c]=((c+1)*t-(c-r)*e)/(r+1);return i}return i.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,l()):[e,t]},i.range=function(c){return arguments.length?(r=(s=Array.from(c)).length-1,l()):s.slice()},i.invertExtent=function(c){var u=s.indexOf(c);return u<0?[NaN,NaN]:u<1?[e,n[0]]:u>=r?[n[r-1],t]:[n[u-1],n[u]]},i.unknown=function(c){return arguments.length&&(a=c),i},i.thresholds=function(){return n.slice()},i.copy=function(){return eot().domain([e,t]).range(s).unknown(a)},Fh.apply(a0(i),arguments)}function tot(){var e=[.5],t=[0,1],r,n=1;function s(a){return a!=null&&a<=a?t[vP(e,a,0,n)]:r}return s.domain=function(a){return arguments.length?(e=Array.from(a),n=Math.min(e.length,t.length-1),s):e.slice()},s.range=function(a){return arguments.length?(t=Array.from(a),n=Math.min(e.length,t.length-1),s):t.slice()},s.invertExtent=function(a){var i=t.indexOf(a);return[e[i-1],e[i]]},s.unknown=function(a){return arguments.length?(r=a,s):r},s.copy=function(){return tot().domain(e).range(t).unknown(r)},Fh.apply(s,arguments)}const LH=new Date,$H=new Date;function sl(e,t,r,n){function s(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return s.floor=a=>(e(a=new Date(+a)),a),s.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),s.round=a=>{const i=s(a),l=s.ceil(a);return a-i<l-a?i:l},s.offset=(a,i)=>(t(a=new Date(+a),i==null?1:Math.floor(i)),a),s.range=(a,i,l)=>{const c=[];if(a=s.ceil(a),l=l==null?1:Math.floor(l),!(a<i)||!(l>0))return c;let u;do c.push(u=new Date(+a)),t(a,l),e(a);while(u<a&&a<i);return c},s.filter=a=>sl(i=>{if(i>=i)for(;e(i),!a(i);)i.setTime(i-1)},(i,l)=>{if(i>=i)if(l<0)for(;++l<=0;)for(;t(i,-1),!a(i););else for(;--l>=0;)for(;t(i,1),!a(i););}),r&&(s.count=(a,i)=>(LH.setTime(+a),$H.setTime(+i),e(LH),e($H),Math.floor(r(LH,$H))),s.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?s.filter(n?i=>n(i)%a===0:i=>s.count(0,i)%a===0):s)),s}const u4=sl(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);u4.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?sl(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):u4);u4.range;const jy=1e3,hh=jy*60,Ty=hh*60,Xy=Ty*24,Yhe=Xy*7,$Ne=Xy*30,FH=Xy*365,jw=sl(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*jy)},(e,t)=>(t-e)/jy,e=>e.getUTCSeconds());jw.range;const Xhe=sl(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*jy)},(e,t)=>{e.setTime(+e+t*hh)},(e,t)=>(t-e)/hh,e=>e.getMinutes());Xhe.range;const Khe=sl(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*hh)},(e,t)=>(t-e)/hh,e=>e.getUTCMinutes());Khe.range;const Jhe=sl(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*jy-e.getMinutes()*hh)},(e,t)=>{e.setTime(+e+t*Ty)},(e,t)=>(t-e)/Ty,e=>e.getHours());Jhe.range;const epe=sl(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Ty)},(e,t)=>(t-e)/Ty,e=>e.getUTCHours());epe.range;const wP=sl(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*hh)/Xy,e=>e.getDate()-1);wP.range;const p9=sl(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Xy,e=>e.getUTCDate()-1);p9.range;const rot=sl(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Xy,e=>Math.floor(e/Xy));rot.range;function b1(e){return sl(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*hh)/Yhe)}const m9=b1(0),d4=b1(1),Ckr=b1(2),jkr=b1(3),G_=b1(4),Tkr=b1(5),Nkr=b1(6);m9.range;d4.range;Ckr.range;jkr.range;G_.range;Tkr.range;Nkr.range;function x1(e){return sl(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/Yhe)}const g9=x1(0),f4=x1(1),Akr=x1(2),Ikr=x1(3),Z_=x1(4),Rkr=x1(5),Pkr=x1(6);g9.range;f4.range;Akr.range;Ikr.range;Z_.range;Rkr.range;Pkr.range;const tpe=sl(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());tpe.range;const rpe=sl(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());rpe.range;const Ky=sl(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());Ky.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:sl(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});Ky.range;const Jy=sl(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());Jy.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:sl(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});Jy.range;function not(e,t,r,n,s,a){const i=[[jw,1,jy],[jw,5,5*jy],[jw,15,15*jy],[jw,30,30*jy],[a,1,hh],[a,5,5*hh],[a,15,15*hh],[a,30,30*hh],[s,1,Ty],[s,3,3*Ty],[s,6,6*Ty],[s,12,12*Ty],[n,1,Xy],[n,2,2*Xy],[r,1,Yhe],[t,1,$Ne],[t,3,3*$Ne],[e,1,FH]];function l(u,d,f){const h=d<u;h&&([u,d]=[d,u]);const p=f&&typeof f.range=="function"?f:c(u,d,f),m=p?p.range(u,+d+1):[];return h?m.reverse():m}function c(u,d,f){const h=Math.abs(d-u)/f,p=Lhe(([,,y])=>y).right(i,h);if(p===i.length)return e.every(Rae(u/FH,d/FH,f));if(p===0)return u4.every(Math.max(Rae(u,d,f),1));const[m,g]=i[h/i[p-1][2]<i[p][2]/h?p-1:p];return m.every(g)}return[l,c]}const[Mkr,Dkr]=not(Jy,rpe,g9,rot,epe,Khe),[Lkr,$kr]=not(Ky,tpe,m9,wP,Jhe,Xhe);function zH(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 BH(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 tT(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function Fkr(e){var t=e.dateTime,r=e.date,n=e.time,s=e.periods,a=e.days,i=e.shortDays,l=e.months,c=e.shortMonths,u=rT(s),d=nT(s),f=rT(a),h=nT(a),p=rT(i),m=nT(i),g=rT(l),y=nT(l),x=rT(c),w=nT(c),S={a:B,A:H,b:W,B:L,c:null,d:qNe,e:qNe,f:l_r,g:v_r,G:x_r,H:a_r,I:i_r,j:o_r,L:sot,m:c_r,M:u_r,p:Y,q,Q:WNe,s:GNe,S:d_r,u:f_r,U:h_r,V:p_r,w:m_r,W:g_r,x:null,X:null,y:y_r,Y:b_r,Z:w_r,"%":QNe},k={a:D,A:Q,b:G,B:J,c:null,d:HNe,e:HNe,f:__r,g:M_r,G:L_r,H:S_r,I:O_r,j:k_r,L:iot,m:E_r,M:C_r,p:ae,q:re,Q:WNe,s:GNe,S:j_r,u:T_r,U:N_r,V:A_r,w:I_r,W:R_r,x:null,X:null,y:P_r,Y:D_r,Z:$_r,"%":QNe},_={a:I,A:P,b:R,B:$,c:M,d:UNe,e:UNe,f:t_r,g:BNe,G:zNe,H:VNe,I:VNe,j:Xkr,L:e_r,m:Ykr,M:Kkr,p:N,q:Zkr,Q:n_r,s:s_r,S:Jkr,u:qkr,U:Hkr,V:Qkr,w:Vkr,W:Wkr,x:z,X:U,y:BNe,Y:zNe,Z:Gkr,"%":r_r};S.x=E(r,S),S.X=E(n,S),S.c=E(t,S),k.x=E(r,k),k.X=E(n,k),k.c=E(t,k);function E(se,oe){return function(he){var X=[],te=-1,le=0,ve=se.length,ue,fe,xe;for(he instanceof Date||(he=new Date(+he));++te<ve;)se.charCodeAt(te)===37&&(X.push(se.slice(le,te)),(fe=FNe[ue=se.charAt(++te)])!=null?ue=se.charAt(++te):fe=ue==="e"?" ":"0",(xe=oe[ue])&&(ue=xe(he,fe)),X.push(ue),le=te+1);return X.push(se.slice(le,te)),X.join("")}}function T(se,oe){return function(he){var X=tT(1900,void 0,1),te=j(X,se,he+="",0),le,ve;if(te!=he.length)return null;if("Q"in X)return new Date(X.Q);if("s"in X)return new Date(X.s*1e3+("L"in X?X.L:0));if(oe&&!("Z"in X)&&(X.Z=0),"p"in X&&(X.H=X.H%12+X.p*12),X.m===void 0&&(X.m="q"in X?X.q:0),"V"in X){if(X.V<1||X.V>53)return null;"w"in X||(X.w=1),"Z"in X?(le=BH(tT(X.y,0,1)),ve=le.getUTCDay(),le=ve>4||ve===0?f4.ceil(le):f4(le),le=p9.offset(le,(X.V-1)*7),X.y=le.getUTCFullYear(),X.m=le.getUTCMonth(),X.d=le.getUTCDate()+(X.w+6)%7):(le=zH(tT(X.y,0,1)),ve=le.getDay(),le=ve>4||ve===0?d4.ceil(le):d4(le),le=wP.offset(le,(X.V-1)*7),X.y=le.getFullYear(),X.m=le.getMonth(),X.d=le.getDate()+(X.w+6)%7)}else("W"in X||"U"in X)&&("w"in X||(X.w="u"in X?X.u%7:"W"in X?1:0),ve="Z"in X?BH(tT(X.y,0,1)).getUTCDay():zH(tT(X.y,0,1)).getDay(),X.m=0,X.d="W"in X?(X.w+6)%7+X.W*7-(ve+5)%7:X.w+X.U*7-(ve+6)%7);return"Z"in X?(X.H+=X.Z/100|0,X.M+=X.Z%100,BH(X)):zH(X)}}function j(se,oe,he,X){for(var te=0,le=oe.length,ve=he.length,ue,fe;te<le;){if(X>=ve)return-1;if(ue=oe.charCodeAt(te++),ue===37){if(ue=oe.charAt(te++),fe=_[ue in FNe?oe.charAt(te++):ue],!fe||(X=fe(se,he,X))<0)return-1}else if(ue!=he.charCodeAt(X++))return-1}return X}function N(se,oe,he){var X=u.exec(oe.slice(he));return X?(se.p=d.get(X[0].toLowerCase()),he+X[0].length):-1}function I(se,oe,he){var X=p.exec(oe.slice(he));return X?(se.w=m.get(X[0].toLowerCase()),he+X[0].length):-1}function P(se,oe,he){var X=f.exec(oe.slice(he));return X?(se.w=h.get(X[0].toLowerCase()),he+X[0].length):-1}function R(se,oe,he){var X=x.exec(oe.slice(he));return X?(se.m=w.get(X[0].toLowerCase()),he+X[0].length):-1}function $(se,oe,he){var X=g.exec(oe.slice(he));return X?(se.m=y.get(X[0].toLowerCase()),he+X[0].length):-1}function M(se,oe,he){return j(se,t,oe,he)}function z(se,oe,he){return j(se,r,oe,he)}function U(se,oe,he){return j(se,n,oe,he)}function B(se){return i[se.getDay()]}function H(se){return a[se.getDay()]}function W(se){return c[se.getMonth()]}function L(se){return l[se.getMonth()]}function Y(se){return s[+(se.getHours()>=12)]}function q(se){return 1+~~(se.getMonth()/3)}function D(se){return i[se.getUTCDay()]}function Q(se){return a[se.getUTCDay()]}function G(se){return c[se.getUTCMonth()]}function J(se){return l[se.getUTCMonth()]}function ae(se){return s[+(se.getUTCHours()>=12)]}function re(se){return 1+~~(se.getUTCMonth()/3)}return{format:function(se){var oe=E(se+="",S);return oe.toString=function(){return se},oe},parse:function(se){var oe=T(se+="",!1);return oe.toString=function(){return se},oe},utcFormat:function(se){var oe=E(se+="",k);return oe.toString=function(){return se},oe},utcParse:function(se){var oe=T(se+="",!0);return oe.toString=function(){return se},oe}}}var FNe={"-":"",_:" ",0:"0"},jl=/^\s*\d+/,zkr=/^%/,Bkr=/[\\^$*+?|[\]().{}]/g;function Bs(e,t,r){var n=e<0?"-":"",s=(n?-e:e)+"",a=s.length;return n+(a<r?new Array(r-a+1).join(t)+s:s)}function Ukr(e){return e.replace(Bkr,"\\$&")}function rT(e){return new RegExp("^(?:"+e.map(Ukr).join("|")+")","i")}function nT(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function Vkr(e,t,r){var n=jl.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function qkr(e,t,r){var n=jl.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function Hkr(e,t,r){var n=jl.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function Qkr(e,t,r){var n=jl.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function Wkr(e,t,r){var n=jl.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function zNe(e,t,r){var n=jl.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function BNe(e,t,r){var n=jl.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function Gkr(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Zkr(e,t,r){var n=jl.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Ykr(e,t,r){var n=jl.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function UNe(e,t,r){var n=jl.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Xkr(e,t,r){var n=jl.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function VNe(e,t,r){var n=jl.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function Kkr(e,t,r){var n=jl.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function Jkr(e,t,r){var n=jl.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function e_r(e,t,r){var n=jl.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function t_r(e,t,r){var n=jl.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function r_r(e,t,r){var n=zkr.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function n_r(e,t,r){var n=jl.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function s_r(e,t,r){var n=jl.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function qNe(e,t){return Bs(e.getDate(),t,2)}function a_r(e,t){return Bs(e.getHours(),t,2)}function i_r(e,t){return Bs(e.getHours()%12||12,t,2)}function o_r(e,t){return Bs(1+wP.count(Ky(e),e),t,3)}function sot(e,t){return Bs(e.getMilliseconds(),t,3)}function l_r(e,t){return sot(e,t)+"000"}function c_r(e,t){return Bs(e.getMonth()+1,t,2)}function u_r(e,t){return Bs(e.getMinutes(),t,2)}function d_r(e,t){return Bs(e.getSeconds(),t,2)}function f_r(e){var t=e.getDay();return t===0?7:t}function h_r(e,t){return Bs(m9.count(Ky(e)-1,e),t,2)}function aot(e){var t=e.getDay();return t>=4||t===0?G_(e):G_.ceil(e)}function p_r(e,t){return e=aot(e),Bs(G_.count(Ky(e),e)+(Ky(e).getDay()===4),t,2)}function m_r(e){return e.getDay()}function g_r(e,t){return Bs(d4.count(Ky(e)-1,e),t,2)}function y_r(e,t){return Bs(e.getFullYear()%100,t,2)}function v_r(e,t){return e=aot(e),Bs(e.getFullYear()%100,t,2)}function b_r(e,t){return Bs(e.getFullYear()%1e4,t,4)}function x_r(e,t){var r=e.getDay();return e=r>=4||r===0?G_(e):G_.ceil(e),Bs(e.getFullYear()%1e4,t,4)}function w_r(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Bs(t/60|0,"0",2)+Bs(t%60,"0",2)}function HNe(e,t){return Bs(e.getUTCDate(),t,2)}function S_r(e,t){return Bs(e.getUTCHours(),t,2)}function O_r(e,t){return Bs(e.getUTCHours()%12||12,t,2)}function k_r(e,t){return Bs(1+p9.count(Jy(e),e),t,3)}function iot(e,t){return Bs(e.getUTCMilliseconds(),t,3)}function __r(e,t){return iot(e,t)+"000"}function E_r(e,t){return Bs(e.getUTCMonth()+1,t,2)}function C_r(e,t){return Bs(e.getUTCMinutes(),t,2)}function j_r(e,t){return Bs(e.getUTCSeconds(),t,2)}function T_r(e){var t=e.getUTCDay();return t===0?7:t}function N_r(e,t){return Bs(g9.count(Jy(e)-1,e),t,2)}function oot(e){var t=e.getUTCDay();return t>=4||t===0?Z_(e):Z_.ceil(e)}function A_r(e,t){return e=oot(e),Bs(Z_.count(Jy(e),e)+(Jy(e).getUTCDay()===4),t,2)}function I_r(e){return e.getUTCDay()}function R_r(e,t){return Bs(f4.count(Jy(e)-1,e),t,2)}function P_r(e,t){return Bs(e.getUTCFullYear()%100,t,2)}function M_r(e,t){return e=oot(e),Bs(e.getUTCFullYear()%100,t,2)}function D_r(e,t){return Bs(e.getUTCFullYear()%1e4,t,4)}function L_r(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Z_(e):Z_.ceil(e),Bs(e.getUTCFullYear()%1e4,t,4)}function $_r(){return"+0000"}function QNe(){return"%"}function WNe(e){return+e}function GNe(e){return Math.floor(+e/1e3)}var wO,lot,cot;F_r({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 F_r(e){return wO=Fkr(e),lot=wO.format,wO.parse,cot=wO.utcFormat,wO.utcParse,wO}function z_r(e){return new Date(e)}function B_r(e){return e instanceof Date?+e:+new Date(+e)}function npe(e,t,r,n,s,a,i,l,c,u){var d=Vhe(),f=d.invert,h=d.domain,p=u(".%L"),m=u(":%S"),g=u("%I:%M"),y=u("%I %p"),x=u("%a %d"),w=u("%b %d"),S=u("%B"),k=u("%Y");function _(E){return(c(E)<E?p:l(E)<E?m:i(E)<E?g:a(E)<E?y:n(E)<E?s(E)<E?x:w:r(E)<E?S:k)(E)}return d.invert=function(E){return new Date(f(E))},d.domain=function(E){return arguments.length?h(Array.from(E,B_r)):h().map(z_r)},d.ticks=function(E){var T=h();return e(T[0],T[T.length-1],E??10)},d.tickFormat=function(E,T){return T==null?_:u(T)},d.nice=function(E){var T=h();return(!E||typeof E.range!="function")&&(E=t(T[0],T[T.length-1],E??10)),E?h(Zit(T,E)):d},d.copy=function(){return xP(d,npe(e,t,r,n,s,a,i,l,c,u))},d}function U_r(){return Fh.apply(npe(Lkr,$kr,Ky,tpe,m9,wP,Jhe,Xhe,jw,lot).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function V_r(){return Fh.apply(npe(Mkr,Dkr,Jy,rpe,g9,p9,epe,Khe,jw,cot).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function y9(){var e=0,t=1,r,n,s,a,i=Xc,l=!1,c;function u(f){return f==null||isNaN(f=+f)?c:i(s===0?.5:(f=(a(f)-r)*s,l?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([e,t]=f,r=a(e=+e),n=a(t=+t),s=r===n?0:1/(n-r),u):[e,t]},u.clamp=function(f){return arguments.length?(l=!!f,u):l},u.interpolator=function(f){return arguments.length?(i=f,u):i};function d(f){return function(h){var p,m;return arguments.length?([p,m]=h,i=f(p,m),u):[i(0),i(1)]}}return u.range=d(Ly),u.rangeRound=d(Uhe),u.unknown=function(f){return arguments.length?(c=f,u):c},function(f){return a=f,r=f(e),n=f(t),s=r===n?0:1/(n-r),u}}function i0(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function uot(){var e=a0(y9()(Xc));return e.copy=function(){return i0(e,uot())},bv.apply(e,arguments)}function dot(){var e=Qhe(y9()).domain([1,10]);return e.copy=function(){return i0(e,dot()).base(e.base())},bv.apply(e,arguments)}function fot(){var e=Whe(y9());return e.copy=function(){return i0(e,fot()).constant(e.constant())},bv.apply(e,arguments)}function spe(){var e=Ghe(y9());return e.copy=function(){return i0(e,spe()).exponent(e.exponent())},bv.apply(e,arguments)}function q_r(){return spe.apply(null,arguments).exponent(.5)}function hot(){var e=[],t=Xc;function r(n){if(n!=null&&!isNaN(n=+n))return t((vP(e,n,1)-1)/(e.length-1))}return r.domain=function(n){if(!arguments.length)return e.slice();e=[];for(let s of n)s!=null&&!isNaN(s=+s)&&e.push(s);return e.sort(Xb),r},r.interpolator=function(n){return arguments.length?(t=n,r):t},r.range=function(){return e.map((n,s)=>t(s/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(s,a)=>OOr(e,a/n))},r.copy=function(){return hot(t).domain(e)},bv.apply(r,arguments)}function v9(){var e=0,t=.5,r=1,n=1,s,a,i,l,c,u=Xc,d,f=!1,h;function p(g){return isNaN(g=+g)?h:(g=.5+((g=+d(g))-a)*(n*g<n*a?l:c),u(f?Math.max(0,Math.min(1,g)):g))}p.domain=function(g){return arguments.length?([e,t,r]=g,s=d(e=+e),a=d(t=+t),i=d(r=+r),l=s===a?0:.5/(a-s),c=a===i?0:.5/(i-a),n=a<s?-1:1,p):[e,t,r]},p.clamp=function(g){return arguments.length?(f=!!g,p):f},p.interpolator=function(g){return arguments.length?(u=g,p):u};function m(g){return function(y){var x,w,S;return arguments.length?([x,w,S]=y,u=rkr(g,[x,w,S]),p):[u(0),u(.5),u(1)]}}return p.range=m(Ly),p.rangeRound=m(Uhe),p.unknown=function(g){return arguments.length?(h=g,p):h},function(g){return d=g,s=g(e),a=g(t),i=g(r),l=s===a?0:.5/(a-s),c=a===i?0:.5/(i-a),n=a<s?-1:1,p}}function pot(){var e=a0(v9()(Xc));return e.copy=function(){return i0(e,pot())},bv.apply(e,arguments)}function mot(){var e=Qhe(v9()).domain([.1,1,10]);return e.copy=function(){return i0(e,mot()).base(e.base())},bv.apply(e,arguments)}function got(){var e=Whe(v9());return e.copy=function(){return i0(e,got()).constant(e.constant())},bv.apply(e,arguments)}function ape(){var e=Ghe(v9());return e.copy=function(){return i0(e,ape()).exponent(e.exponent())},bv.apply(e,arguments)}function H_r(){return ape.apply(null,arguments).exponent(.5)}const VT=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:Fhe,scaleDiverging:pot,scaleDivergingLog:mot,scaleDivergingPow:ape,scaleDivergingSqrt:H_r,scaleDivergingSymlog:got,scaleIdentity:Git,scaleImplicit:Pae,scaleLinear:Wit,scaleLog:Yit,scaleOrdinal:$he,scalePoint:EOr,scalePow:Zhe,scaleQuantile:Jit,scaleQuantize:eot,scaleRadial:Kit,scaleSequential:uot,scaleSequentialLog:dot,scaleSequentialPow:spe,scaleSequentialQuantile:hot,scaleSequentialSqrt:q_r,scaleSequentialSymlog:fot,scaleSqrt:_kr,scaleSymlog:Xit,scaleThreshold:tot,scaleTime:U_r,scaleUtc:V_r,tickFormat:Qit},Symbol.toStringTag,{value:"Module"}));function Q_r(e){if(e in VT)return VT[e]();var t="scale".concat(dP(e));if(t in VT)return VT[t]()}function ZNe(e,t,r){if(typeof e=="function")return e.copy().domain(t).range(r);if(e!=null){var n=Q_r(e);if(n!=null)return n.domain(t).range(r),n}}function ipe(e,t,r,n){if(!(r==null||n==null))return typeof e.scale=="function"?ZNe(e.scale,r,n):ZNe(t,r,n)}function W_r(e){return"scale".concat(dP(e))}function G_r(e){return W_r(e)in VT}var yot=(e,t,r)=>{if(e!=null){var{scale:n,type:s}=e;if(n==="auto")return s==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!t)?"point":s==="category"?"band":"linear";if(typeof n=="string")return G_r(n)?n:"point"}};function Z_r(e,t){for(var r=0,n=e.length,s=e[0]<e[e.length-1];r<n;){var a=Math.floor((r+n)/2);(s?e[a]<t:e[a]>t)?r=a+1:n=a}return r}function vot(e,t){if(e){var r=t??e.domain(),n=r.map(a=>{var i;return(i=e(a))!==null&&i!==void 0?i:0}),s=e.range();if(!(r.length===0||s.length<2))return a=>{var i,l,c=Z_r(n,a);if(c<=0)return r[0];if(c>=r.length)return r[r.length-1];var u=(i=n[c-1])!==null&&i!==void 0?i:0,d=(l=n[c])!==null&&l!==void 0?l:0;return Math.abs(a-u)<=Math.abs(a-d)?r[c-1]:r[c]}}}function Y_r(e){if(e!=null)return"invert"in e&&typeof e.invert=="function"?e.invert.bind(e):vot(e,void 0)}function YNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function h4(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?YNe(Object(r),!0).forEach(function(n){X_r(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function X_r(e,t,r){return(t=K_r(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function K_r(e){var t=J_r(e,"string");return typeof t=="symbol"?t:t+""}function J_r(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Fae=[0,"auto"],Yo={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0,niceTicks:"auto"},bot=(e,t)=>e.cartesianAxis.xAxis[t],xv=(e,t)=>{var r=bot(e,t);return r??Yo},Xo={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Fae,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:pP},xot=(e,t)=>e.cartesianAxis.yAxis[t],wv=(e,t)=>{var r=xot(e,t);return r??Xo},eEr={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},ope=(e,t)=>{var r=e.cartesianAxis.zAxis[t];return r??eEr},hu=(e,t,r)=>{switch(t){case"xAxis":return xv(e,r);case"yAxis":return wv(e,r);case"zAxis":return ope(e,r);case"angleAxis":return Ihe(e,r);case"radiusAxis":return Rhe(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},tEr=(e,t,r)=>{switch(t){case"xAxis":return xv(e,r);case"yAxis":return wv(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},SP=(e,t,r)=>{switch(t){case"xAxis":return xv(e,r);case"yAxis":return wv(e,r);case"angleAxis":return Ihe(e,r);case"radiusAxis":return Rhe(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},wot=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function Sot(e,t){return r=>{switch(e){case"xAxis":return"xAxisId"in r&&r.xAxisId===t;case"yAxis":return"yAxisId"in r&&r.yAxisId===t;case"zAxis":return"zAxisId"in r&&r.zAxisId===t;case"angleAxis":return"angleAxisId"in r&&r.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in r&&r.radiusAxisId===t;default:return!1}}}var Oot=e=>e.graphicalItems.cartesianItems,rEr=Xe([El,u9],Sot),kot=(e,t,r)=>e.filter(r).filter(n=>t?.includeHidden===!0?!0:!n.hide),OP=Xe([Oot,hu,rEr],kot,{memoizeOptions:{resultEqualityCheck:f9}}),_ot=Xe([OP],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(Mhe)),Eot=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),nEr=Xe([OP],Eot),Cot=e=>e.map(t=>t.data).filter(Boolean).flat(1),sEr=Xe([OP],Cot,{memoizeOptions:{resultEqualityCheck:f9}}),jot=(e,t)=>{var{chartData:r=[],dataStartIndex:n,dataEndIndex:s}=t;return e.length>0?e:r.slice(n,s+1)},lpe=Xe([sEr,_he],jot),Tot=(e,t,r)=>t?.dataKey!=null?e.map(n=>({value:Yl(n,t.dataKey)})):r.length>0?r.map(n=>n.dataKey).flatMap(n=>e.map(s=>({value:Yl(s,n)}))):e.map(n=>({value:n})),kP=Xe([lpe,hu,OP],Tot);function Jk(e){if(sg(e)||e instanceof Date){var t=Number(e);if(zs(t))return t}}function XNe(e){if(Array.isArray(e)){var t=[Jk(e[0]),Jk(e[1])];return Gm(t)?t:void 0}var r=Jk(e);if(r!=null)return[r,r]}function ev(e){return e.map(Jk).filter(Bu)}function aEr(e,t){var r=Jk(e),n=Jk(t);return r==null&&n==null?0:r==null?-1:n==null?1:r-n}var iEr=Xe([kP],e=>e?.map(t=>t.value).sort(aEr));function Not(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function oEr(e,t,r){return!r||typeof t!="number"||Zy(t)?[]:r.length?ev(r.flatMap(n=>{var s=Yl(e,n.dataKey),a,i;if(Array.isArray(s)?[a,i]=s:a=i=s,!(!zs(a)||!zs(i)))return[t-a,t+i]})):[]}var al=e=>{var t=Cl(e),r=nC(e);return SP(e,t,r)},_P=Xe([al],e=>e?.dataKey),lEr=Xe([_ot,_he,al],Pit),Aot=(e,t,r,n)=>{var s={},a=t.reduce((i,l)=>{if(l.stackId==null)return i;var c=i[l.stackId];return c==null&&(c=[]),c.push(l),i[l.stackId]=c,i},s);return Object.fromEntries(Object.entries(a).map(i=>{var[l,c]=i,u=n?[...c].reverse():c,d=u.map(Rit);return[l,{stackedData:Swr(e,d,r),graphicalItems:u}]}))},cEr=Xe([lEr,_ot,i9,Eit],Aot),Iot=(e,t,r,n)=>{var{dataStartIndex:s,dataEndIndex:a}=t;if(n==null&&r!=="zAxis"){var i=_wr(e,s,a);if(!(i!=null&&i[0]===0&&i[1]===0))return i}},uEr=Xe([hu],e=>e.allowDataOverflow),cpe=e=>{var t;if(e==null||!("domain"in e))return Fae;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var r=ev(e.ticks);return[Math.min(...r),Math.max(...r)]}if(e.type==="category")return e.ticks.map(String)}return(t=e?.domain)!==null&&t!==void 0?t:Fae},Rot=Xe([hu],cpe),Pot=Xe([Rot,uEr],mit),dEr=Xe([cEr,s0,El,Pot],Iot,{memoizeOptions:{resultEqualityCheck:d9}}),upe=e=>e.errorBars,fEr=(e,t,r)=>e.flatMap(n=>t[n.id]).filter(Boolean).filter(n=>Not(r,n)),p4=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var s=r.filter(Boolean);if(s.length!==0){var a=s.flat(),i=Math.min(...a),l=Math.max(...a);return[i,l]}},Mot=(e,t,r,n,s)=>{var a,i;if(r.length>0&&e.forEach(l=>{r.forEach(c=>{var u,d,f=(u=n[c.id])===null||u===void 0?void 0:u.filter(x=>Not(s,x)),h=Yl(l,(d=t.dataKey)!==null&&d!==void 0?d:c.dataKey),p=oEr(l,h,f);if(p.length>=2){var m=Math.min(...p),g=Math.max(...p);(a==null||m<a)&&(a=m),(i==null||g>i)&&(i=g)}var y=XNe(h);y!=null&&(a=a==null?y[0]:Math.min(a,y[0]),i=i==null?y[1]:Math.max(i,y[1]))})}),t?.dataKey!=null&&e.forEach(l=>{var c=XNe(Yl(l,t.dataKey));c!=null&&(a=a==null?c[0]:Math.min(a,c[0]),i=i==null?c[1]:Math.max(i,c[1]))}),zs(a)&&zs(i))return[a,i]},hEr=Xe([lpe,hu,nEr,upe,El],Mot,{memoizeOptions:{resultEqualityCheck:d9}});function pEr(e){var{value:t}=e;if(sg(t)||t instanceof Date)return t}var mEr=(e,t,r)=>{var n=e.map(pEr).filter(s=>s!=null);return r&&(t.dataKey==null||t.allowDuplicatedCategory&&Wst(n))?pit(0,e.length):t.allowDuplicatedCategory?n:Array.from(new Set(n))},Dot=e=>e.referenceElements.dots,sC=(e,t,r)=>e.filter(n=>n.ifOverflow==="extendDomain").filter(n=>t==="xAxis"?n.xAxisId===r:n.yAxisId===r),gEr=Xe([Dot,El,u9],sC),Lot=e=>e.referenceElements.areas,yEr=Xe([Lot,El,u9],sC),$ot=e=>e.referenceElements.lines,vEr=Xe([$ot,El,u9],sC),Fot=(e,t)=>{if(e!=null){var r=ev(e.map(n=>t==="xAxis"?n.x:n.y));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},bEr=Xe(gEr,El,Fot),zot=(e,t)=>{if(e!=null){var r=ev(e.flatMap(n=>[t==="xAxis"?n.x1:n.y1,t==="xAxis"?n.x2:n.y2]));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},xEr=Xe([yEr,El],zot);function wEr(e){var t;if(e.x!=null)return ev([e.x]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.x);return r==null||r.length===0?[]:ev(r)}function SEr(e){var t;if(e.y!=null)return ev([e.y]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.y);return r==null||r.length===0?[]:ev(r)}var Bot=(e,t)=>{if(e!=null){var r=e.flatMap(n=>t==="xAxis"?wEr(n):SEr(n));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},OEr=Xe([vEr,El],Bot),kEr=Xe(bEr,OEr,xEr,(e,t,r)=>p4(e,r,t)),Uot=(e,t,r,n,s,a,i,l)=>{if(r!=null)return r;var c=i==="vertical"&&l==="xAxis"||i==="horizontal"&&l==="yAxis",u=c?p4(n,a,s):p4(a,s);return K1r(t,u,e.allowDataOverflow)},_Er=Xe([hu,Rot,Pot,dEr,hEr,kEr,$i,El],Uot,{memoizeOptions:{resultEqualityCheck:d9}}),EEr=[0,1],Vot=(e,t,r,n,s,a,i)=>{if(!((e==null||r==null||r.length===0)&&i===void 0)){var{dataKey:l,type:c}=e,u=gv(t,a);if(u&&l==null){var d;return pit(0,(d=r?.length)!==null&&d!==void 0?d:0)}return c==="category"?mEr(n,e,u):s==="expand"?EEr:i}},dpe=Xe([hu,$i,lpe,kP,i9,El,_Er],Vot),aC=Xe([hu,wot,The],yot),qot=(e,t,r)=>{var{niceTicks:n}=t;if(n!=="none"){var s=cpe(t),a=Array.isArray(s)&&(s[0]==="auto"||s[1]==="auto");if((n==="snap125"||n==="adaptive")&&t!=null&&t.tickCount&&Gm(e)){if(a)return iNe(e,t.tickCount,t.allowDecimals,n);if(t.type==="number")return oNe(e,t.tickCount,t.allowDecimals,n)}if(n==="auto"&&r==="linear"&&t!=null&&t.tickCount){if(a&&Gm(e))return iNe(e,t.tickCount,t.allowDecimals,"adaptive");if(t.type==="number"&&Gm(e))return oNe(e,t.tickCount,t.allowDecimals,"adaptive")}}},fpe=Xe([dpe,SP,aC],qot),Hot=(e,t,r,n)=>{if(n!=="angleAxis"&&e?.type==="number"&&Gm(t)&&Array.isArray(r)&&r.length>0){var s,a,i=t[0],l=(s=r[0])!==null&&s!==void 0?s:0,c=t[1],u=(a=r[r.length-1])!==null&&a!==void 0?a:0;return[Math.min(i,l),Math.max(c,u)]}return t},CEr=Xe([hu,dpe,fpe,El],Hot),jEr=Xe(kP,hu,(e,t)=>{if(!(!t||t.type!=="number")){var r=1/0,n=Array.from(ev(e.map(f=>f.value))).sort((f,h)=>f-h),s=n[0],a=n[n.length-1];if(s==null||a==null)return 1/0;var i=a-s;if(i===0)return 1/0;for(var l=0;l<n.length-1;l++){var c=n[l],u=n[l+1];if(!(c==null||u==null)){var d=u-c;r=Math.min(r,d)}}return r/i}}),Qot=Xe(jEr,$i,nOr,ec,(e,t,r,n,s)=>s,(e,t,r,n,s)=>{if(!zs(e))return 0;var a=t==="vertical"?n.height:n.width;if(s==="gap")return e*a/2;if(s==="no-gap"){var i=Cx(r,e*a),l=e*a/2;return l-i-(l-i)/a*i}return 0}),TEr=(e,t,r)=>{var n=xv(e,t);return n==null||typeof n.padding!="string"?0:Qot(e,"xAxis",t,r,n.padding)},NEr=(e,t,r)=>{var n=wv(e,t);return n==null||typeof n.padding!="string"?0:Qot(e,"yAxis",t,r,n.padding)},AEr=Xe(xv,TEr,(e,t)=>{var r,n;if(e==null)return{left:0,right:0};var{padding:s}=e;return typeof s=="string"?{left:t,right:t}:{left:((r=s.left)!==null&&r!==void 0?r:0)+t,right:((n=s.right)!==null&&n!==void 0?n:0)+t}}),IEr=Xe(wv,NEr,(e,t)=>{var r,n;if(e==null)return{top:0,bottom:0};var{padding:s}=e;return typeof s=="string"?{top:t,bottom:t}:{top:((r=s.top)!==null&&r!==void 0?r:0)+t,bottom:((n=s.bottom)!==null&&n!==void 0?n:0)+t}}),REr=Xe([ec,AEr,e9,Jz,(e,t,r)=>r],(e,t,r,n,s)=>{var{padding:a}=n;return s?[a.left,r.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),PEr=Xe([ec,$i,IEr,e9,Jz,(e,t,r)=>r],(e,t,r,n,s,a)=>{var{padding:i}=s;return a?[n.height-i.bottom,i.top]:t==="horizontal"?[e.top+e.height-r.bottom,e.top+r.top]:[e.top+r.top,e.top+e.height-r.bottom]}),EP=(e,t,r,n)=>{var s;switch(t){case"xAxis":return REr(e,r,n);case"yAxis":return PEr(e,r,n);case"zAxis":return(s=ope(e,r))===null||s===void 0?void 0:s.range;case"angleAxis":return Nit(e);case"radiusAxis":return Ait(e,r);default:return}},Wot=Xe([hu,EP],o9),MEr=Xe([aC,CEr],dOr),hpe=Xe([hu,aC,MEr,Wot],ipe),Got=(e,t,r,n)=>{if(!(r==null||r.dataKey==null)){var{type:s,scale:a}=r,i=gv(e,n);if(i&&(s==="number"||a!=="auto"))return t.map(l=>l.value)}},ppe=Xe([$i,kP,SP,El],Got),b9=Xe([hpe],Dhe);Xe([hpe],Y_r);Xe([hpe,iEr],vot);Xe([OP,upe,El],fEr);function Zot(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var x9=(e,t)=>t,w9=(e,t,r)=>r,DEr=Xe(Xz,x9,w9,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(Zot)),LEr=Xe(Kz,x9,w9,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(Zot)),Yot=(e,t)=>({width:e.width,height:t.height}),$Er=(e,t)=>{var r=typeof t.width=="number"?t.width:pP;return{width:r,height:e.height}},FEr=Xe(ec,xv,Yot),zEr=(e,t,r)=>{switch(t){case"top":return e.top;case"bottom":return r-e.bottom;default:return 0}},BEr=(e,t,r)=>{switch(t){case"left":return e.left;case"right":return r-e.right;default:return 0}},UEr=Xe(vv,ec,DEr,x9,w9,(e,t,r,n,s)=>{var a={},i;return r.forEach(l=>{var c=Yot(t,l);i==null&&(i=zEr(t,n,e));var u=n==="top"&&!s||n==="bottom"&&s;a[l.id]=i-Number(u)*c.height,i+=(u?-1:1)*c.height}),a}),VEr=Xe(yv,ec,LEr,x9,w9,(e,t,r,n,s)=>{var a={},i;return r.forEach(l=>{var c=$Er(t,l);i==null&&(i=BEr(t,n,e));var u=n==="left"&&!s||n==="right"&&s;a[l.id]=i-Number(u)*c.width,i+=(u?-1:1)*c.width}),a}),qEr=(e,t)=>{var r=xv(e,t);if(r!=null)return UEr(e,r.orientation,r.mirror)},HEr=Xe([ec,xv,qEr,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var s=r?.[n];return s==null?{x:e.left,y:0}:{x:e.left,y:s}}}),QEr=(e,t)=>{var r=wv(e,t);if(r!=null)return VEr(e,r.orientation,r.mirror)},WEr=Xe([ec,wv,QEr,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var s=r?.[n];return s==null?{x:0,y:e.top}:{x:s,y:e.top}}}),GEr=Xe(ec,wv,(e,t)=>{var r=typeof t.width=="number"?t.width:pP;return{width:r,height:e.height}}),Xot=(e,t,r,n)=>{if(r!=null){var{allowDuplicatedCategory:s,type:a,dataKey:i}=r,l=gv(e,n),c=t.map(u=>u.value);if(i&&l&&a==="category"&&s&&Wst(c))return c}},mpe=Xe([$i,kP,hu,El],Xot),KNe=Xe([$i,tEr,aC,b9,mpe,ppe,EP,fpe,El],(e,t,r,n,s,a,i,l,c)=>{if(t!=null){var u=gv(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:s,isCategorical:u,niceTicks:l,range:i,realScaleType:r,scale:n}}}),ZEr=(e,t,r,n,s,a,i,l,c)=>{if(!(t==null||n==null)){var u=gv(e,c),{type:d,ticks:f,tickCount:h}=t,p=r==="scaleBand"&&typeof n.bandwidth=="function"?n.bandwidth()/2:2,m=d==="category"&&n.bandwidth?n.bandwidth()/p:0;m=c==="angleAxis"&&a!=null&&a.length>=2?dh(a[0]-a[1])*2*m:m;var g=f||s;return g?g.map((y,x)=>{var w=i?i.indexOf(y):y,S=n.map(w);return zs(S)?{index:x,coordinate:S+m,value:y,offset:m}:null}).filter(Bu):u&&l?l.map((y,x)=>{var w=n.map(y);return zs(w)?{coordinate:w+m,value:y,index:x,offset:m}:null}).filter(Bu):n.ticks?n.ticks(h).map((y,x)=>{var w=n.map(y);return zs(w)?{coordinate:w+m,value:y,index:x,offset:m}:null}).filter(Bu):n.domain().map((y,x)=>{var w=n.map(y);return zs(w)?{coordinate:w+m,value:i?i[y]:y,index:x,offset:m}:null}).filter(Bu)}},Kot=Xe([$i,SP,aC,b9,fpe,EP,mpe,ppe,El],ZEr),YEr=(e,t,r,n,s,a,i)=>{if(!(t==null||r==null||n==null||n[0]===n[1])){var l=gv(e,i),{tickCount:c}=t,u=0;return u=i==="angleAxis"&&n?.length>=2?dh(n[0]-n[1])*2*u:u,l&&a?a.map((d,f)=>{var h=r.map(d);return zs(h)?{coordinate:h+u,value:d,index:f,offset:u}:null}).filter(Bu):r.ticks?r.ticks(c).map((d,f)=>{var h=r.map(d);return zs(h)?{coordinate:h+u,value:d,index:f,offset:u}:null}).filter(Bu):r.domain().map((d,f)=>{var h=r.map(d);return zs(h)?{coordinate:h+u,value:s?s[d]:d,index:f,offset:u}:null}).filter(Bu)}},Jot=Xe([$i,SP,b9,EP,mpe,ppe,El],YEr),elt=Xe(hu,b9,(e,t)=>{if(!(e==null||t==null))return h4(h4({},e),{},{scale:t})}),XEr=Xe([hu,aC,dpe,Wot],ipe),KEr=Xe([XEr],Dhe);Xe((e,t,r)=>ope(e,r),KEr,(e,t)=>{if(!(e==null||t==null))return h4(h4({},e),{},{scale:t})});var JEr=Xe([$i,Xz,Kz],(e,t,r)=>{switch(e){case"horizontal":return t.some(n=>n.reversed)?"right-to-left":"left-to-right";case"vertical":return r.some(n=>n.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),eCr=(e,t,r)=>{var n;return(n=e.renderedTicks[t])===null||n===void 0?void 0:n[r]};Xe([eCr],e=>{if(!(!e||e.length===0))return t=>{var r,n=1/0,s=e[0];for(var a of e){var i=Math.abs(a.coordinate-t);i<n&&(n=i,s=a)}return(r=s)===null||r===void 0?void 0:r.value}});var tlt=e=>e.options.defaultTooltipEventType,rlt=e=>e.options.validateTooltipEventTypes;function nlt(e,t,r){if(e==null)return t;var n=e?"axis":"item";return r==null?t:r.includes(n)?n:t}function gpe(e,t){var r=tlt(e),n=rlt(e);return nlt(t,r,n)}function tCr(e){return en(t=>gpe(t,e))}var slt=(e,t)=>{var r,n=Number(t);if(!(Zy(n)||t==null))return n>=0?e==null||(r=e[n])===null||r===void 0?void 0:r.value:void 0},rCr=e=>e.tooltip.settings,jb={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},nCr={itemInteraction:{click:jb,hover:jb},axisInteraction:{click:jb,hover:jb},keyboardInteraction:jb,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},alt=jc({name:"tooltip",initialState:nCr,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:oi()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:r,next:n}=t.payload,s=fh(e).tooltipItemPayloads.indexOf(r);s>-1&&(e.tooltipItemPayloads[s]=n)},prepare:oi()},removeTooltipEntrySettings:{reducer(e,t){var r=fh(e).tooltipItemPayloads.indexOf(t.payload);r>-1&&e.tooltipItemPayloads.splice(r,1)},prepare:oi()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:sCr,replaceTooltipEntrySettings:aCr,removeTooltipEntrySettings:iCr,setTooltipSettingsState:oCr,setActiveMouseOverItemIndex:lCr,mouseLeaveItem:WRn,mouseLeaveChart:ilt,setActiveClickItemIndex:GRn,setMouseOverAxisIndex:olt,setMouseClickAxisIndex:cCr,setSyncInteraction:zae,setKeyboardInteraction:m4}=alt.actions,uCr=alt.reducer;function JNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function BD(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?JNe(Object(r),!0).forEach(function(n){dCr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):JNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function dCr(e,t,r){return(t=fCr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fCr(e){var t=hCr(e,"string");return typeof t=="symbol"?t:t+""}function hCr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pCr(e,t,r){return t==="axis"?r==="click"?e.axisInteraction.click:e.axisInteraction.hover:r==="click"?e.itemInteraction.click:e.itemInteraction.hover}function mCr(e){return e.index!=null}var llt=(e,t,r,n)=>{if(t==null)return jb;var s=pCr(e,t,r);if(s==null)return jb;if(s.active)return s;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(mCr(s)){if(a)return BD(BD({},s),{},{active:!0})}else if(n!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:n,graphicalItemId:void 0};return BD(BD({},jb),{},{coordinate:s.coordinate})};function gCr(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var r=Number(e);return Number.isFinite(r)?r:void 0}function yCr(e,t){var r=gCr(e),n=t[0],s=t[1];if(r===void 0)return!1;var a=Math.min(n,s),i=Math.max(n,s);return r>=a&&r<=i}function vCr(e,t,r){if(r==null||t==null)return!0;var n=Yl(e,t);return n==null||!Gm(r)?!0:yCr(n,r)}var ype=(e,t,r,n)=>{var s=e?.index;if(s==null)return null;var a=Number(s);if(!zs(a))return s;var i=0,l=1/0;t.length>0&&(l=t.length-1);var c=Math.max(i,Math.min(a,l)),u=t[c];return u==null||vCr(u,r,n)?String(c):null},clt=(e,t,r,n,s,a,i)=>{if(a!=null){var l=i[0],c=l?.getPosition(a);if(c!=null)return c;var u=s?.[Number(a)];if(u)return r==="horizontal"?{x:u.coordinate,y:(n.top+t)/2}:{x:(n.left+e)/2,y:u.coordinate}}},ult=(e,t,r,n)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var s;if(r==="hover"?s=e.itemInteraction.hover.graphicalItemId:s=e.itemInteraction.click.graphicalItemId,e.syncInteraction.active&&s==null)return e.tooltipItemPayloads;if(s==null&&n!=null){var a=e.tooltipItemPayloads[0];return a!=null?[a]:[]}return e.tooltipItemPayloads.filter(i=>{var l;return((l=i.settings)===null||l===void 0?void 0:l.graphicalItemId)===s})},dlt=e=>e.options.tooltipPayloadSearcher,iC=e=>e.tooltip;function eAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function tAe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?eAe(Object(r),!0).forEach(function(n){bCr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):eAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bCr(e,t,r){return(t=xCr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xCr(e){var t=wCr(e,"string");return typeof t=="symbol"?t:t+""}function wCr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function SCr(e){if(typeof e=="string"||typeof e=="number")return e}function OCr(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}function kCr(e){if(typeof e=="string"||typeof e=="number")return e;if(typeof e=="function")return t=>e(t)}function rAe(e){if(typeof e=="string")return e}function _Cr(e){if(!(e==null||typeof e!="object")){var t="name"in e?SCr(e.name):void 0,r="unit"in e?OCr(e.unit):void 0,n="dataKey"in e?kCr(e.dataKey):void 0,s="payload"in e?e.payload:void 0,a="color"in e?rAe(e.color):void 0,i="fill"in e?rAe(e.fill):void 0;return{name:t,unit:r,dataKey:n,payload:s,color:a,fill:i}}}function ECr(e,t){return e??t}var flt=(e,t,r,n,s,a,i)=>{if(!(t==null||a==null)){var{chartData:l,computedData:c,dataStartIndex:u,dataEndIndex:d}=r,f=[];return e.reduce((h,p)=>{var m,{dataDefinedOnItem:g,settings:y}=p,x=ECr(g,l),w=Array.isArray(x)?Dat(x,u,d):x,S=(m=y?.dataKey)!==null&&m!==void 0?m:n,k=y?.nameKey,_;if(n&&Array.isArray(w)&&!Array.isArray(w[0])&&i==="axis"?_=Gst(w,n,s):_=a(w,t,c,k),Array.isArray(_))_.forEach(T=>{var j,N,I=_Cr(T),P=I?.name,R=I?.dataKey,$=I?.payload,M=tAe(tAe({},y),{},{name:P,unit:I?.unit,color:(j=I?.color)!==null&&j!==void 0?j:y?.color,fill:(N=I?.fill)!==null&&N!==void 0?N:y?.fill});h.push(eTe({tooltipEntrySettings:M,dataKey:R,payload:$,value:Yl($,R),name:P==null?void 0:String(P)}))});else{var E;h.push(eTe({tooltipEntrySettings:y,dataKey:S,payload:_,value:Yl(_,S),name:(E=Yl(_,k))!==null&&E!==void 0?E:y?.name}))}return h},f)}},vpe=Xe([al,wot,The],yot),CCr=Xe([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),jCr=Xe([Cl,nC],Sot),oC=Xe([CCr,al,jCr],kot,{memoizeOptions:{resultEqualityCheck:f9}}),TCr=Xe([oC],e=>e.filter(Mhe)),NCr=Xe([oC],Cot,{memoizeOptions:{resultEqualityCheck:f9}}),lC=Xe([NCr,s0],jot),ACr=Xe([TCr,s0,al],Pit),bpe=Xe([lC,al,oC],Tot),hlt=Xe([al],cpe),ICr=Xe([al],e=>e.allowDataOverflow),plt=Xe([hlt,ICr],mit),RCr=Xe([oC],e=>e.filter(Mhe)),PCr=Xe([ACr,RCr,i9,Eit],Aot),MCr=Xe([PCr,s0,Cl,plt],Iot),DCr=Xe([oC],Eot),LCr=Xe([lC,al,DCr,upe,Cl],Mot,{memoizeOptions:{resultEqualityCheck:d9}}),$Cr=Xe([Dot,Cl,nC],sC),FCr=Xe([$Cr,Cl],Fot),zCr=Xe([Lot,Cl,nC],sC),BCr=Xe([zCr,Cl],zot),UCr=Xe([$ot,Cl,nC],sC),VCr=Xe([UCr,Cl],Bot),qCr=Xe([FCr,VCr,BCr],p4),HCr=Xe([al,hlt,plt,MCr,LCr,qCr,$i,Cl],Uot),CP=Xe([al,$i,lC,bpe,i9,Cl,HCr],Vot),QCr=Xe([CP,al,vpe],qot),WCr=Xe([al,CP,QCr,Cl],Hot),mlt=e=>{var t=Cl(e),r=nC(e),n=!1;return EP(e,t,r,n)},glt=Xe([al,mlt],o9),GCr=Xe([al,vpe,WCr,glt],ipe),ylt=Xe([GCr],Dhe),ZCr=Xe([$i,bpe,al,Cl],Xot),YCr=Xe([$i,bpe,al,Cl],Got),XCr=(e,t,r,n,s,a,i,l)=>{if(t){var{type:c}=t,u=gv(e,l);if(n){var d=r==="scaleBand"&&n.bandwidth?n.bandwidth()/2:2,f=c==="category"&&n.bandwidth?n.bandwidth()/d:0;return f=l==="angleAxis"&&s!=null&&s?.length>=2?dh(s[0]-s[1])*2*f:f,u&&i?i.map((h,p)=>{var m=n.map(h);return zs(m)?{coordinate:m+f,value:h,index:p,offset:f}:null}).filter(Bu):n.domain().map((h,p)=>{var m=n.map(h);return zs(m)?{coordinate:m+f,value:a?a[h]:h,index:p,offset:f}:null}).filter(Bu)}}},Sv=Xe([$i,al,vpe,ylt,mlt,ZCr,YCr,Cl],XCr),xpe=Xe([tlt,rlt,rCr],(e,t,r)=>nlt(r.shared,e,t)),vlt=e=>e.tooltip.settings.trigger,wpe=e=>e.tooltip.settings.defaultIndex,jP=Xe([iC,xpe,vlt,wpe],llt),aI=Xe([jP,lC,_P,CP],ype),blt=Xe([Sv,aI],slt),KCr=Xe([jP],e=>{if(e)return e.dataKey}),JCr=Xe([jP],e=>{if(e)return e.graphicalItemId}),xlt=Xe([iC,xpe,vlt,wpe],ult),ejr=Xe([yv,vv,$i,ec,Sv,wpe,xlt],clt),tjr=Xe([jP,ejr],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),rjr=Xe([jP],e=>{var t;return(t=e?.active)!==null&&t!==void 0?t:!1}),njr=Xe([xlt,aI,s0,_P,blt,dlt,xpe],flt),sjr=Xe([njr],e=>{if(e!=null){var t=e.map(r=>r.payload).filter(r=>r!=null);return Array.from(new Set(t))}});function nAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function sAe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nAe(Object(r),!0).forEach(function(n){ajr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ajr(e,t,r){return(t=ijr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ijr(e){var t=ojr(e,"string");return typeof t=="symbol"?t:t+""}function ojr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ljr=()=>en(al),cjr=()=>{var e=ljr(),t=en(Sv),r=en(ylt);return H5(!e||!r?void 0:sAe(sAe({},e),{},{scale:r}),t)};function aAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function SO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?aAe(Object(r),!0).forEach(function(n){ujr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):aAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ujr(e,t,r){return(t=djr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function djr(e){var t=fjr(e,"string");return typeof t=="symbol"?t:t+""}function fjr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var hjr=(e,t,r,n)=>{var s=t.find(a=>a&&a.index===r);if(s){if(e==="horizontal")return{x:s.coordinate,y:n.relativeY};if(e==="vertical")return{x:n.relativeX,y:s.coordinate}}return{x:0,y:0}},pjr=(e,t,r,n)=>{var s=t.find(u=>u&&u.index===r);if(s){if(e==="centric"){var a=s.coordinate,{radius:i}=n;return SO(SO(SO({},n),Hl(n.cx,n.cy,i,a)),{},{angle:a,radius:i})}var l=s.coordinate,{angle:c}=n;return SO(SO(SO({},n),Hl(n.cx,n.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function mjr(e,t){var{relativeX:r,relativeY:n}=e;return r>=t.left&&r<=t.left+t.width&&n>=t.top&&n<=t.top+t.height}var wlt=(e,t,r,n,s)=>{var a,i=(a=t?.length)!==null&&a!==void 0?a:0;if(i<=1||e==null)return 0;if(n==="angleAxis"&&s!=null&&Math.abs(Math.abs(s[1]-s[0])-360)<=1e-6)for(var l=0;l<i;l++){var c,u,d,f,h,p=l>0?(c=r[l-1])===null||c===void 0?void 0:c.coordinate:(u=r[i-1])===null||u===void 0?void 0:u.coordinate,m=(d=r[l])===null||d===void 0?void 0:d.coordinate,g=l>=i-1?(f=r[0])===null||f===void 0?void 0:f.coordinate:(h=r[l+1])===null||h===void 0?void 0:h.coordinate,y=void 0;if(!(p==null||m==null||g==null))if(dh(m-p)!==dh(g-m)){var x=[];if(dh(g-m)===dh(s[1]-s[0])){y=g;var w=m+s[1]-s[0];x[0]=Math.min(w,(w+p)/2),x[1]=Math.max(w,(w+p)/2)}else{y=p;var S=g+s[1]-s[0];x[0]=Math.min(m,(S+m)/2),x[1]=Math.max(m,(S+m)/2)}var k=[Math.min(m,(y+m)/2),Math.max(m,(y+m)/2)];if(e>k[0]&&e<=k[1]||e>=x[0]&&e<=x[1]){var _;return(_=r[l])===null||_===void 0?void 0:_.index}}else{var E=Math.min(p,g),T=Math.max(p,g);if(e>(E+m)/2&&e<=(T+m)/2){var j;return(j=r[l])===null||j===void 0?void 0:j.index}}}else if(t)for(var N=0;N<i;N++){var I=t[N];if(I!=null){var P=t[N+1],R=t[N-1];if(N===0&&P!=null&&e<=(I.coordinate+P.coordinate)/2||N===i-1&&R!=null&&e>(I.coordinate+R.coordinate)/2||N>0&&N<i-1&&R!=null&&P!=null&&e>(I.coordinate+R.coordinate)/2&&e<=(I.coordinate+P.coordinate)/2)return I.index}}return-1},gjr=()=>en(The),Spe=(e,t)=>t,Slt=(e,t,r)=>r,Ope=(e,t,r,n)=>n,yjr=Xe(Sv,e=>Bz(e,t=>t.coordinate)),kpe=Xe([iC,Spe,Slt,Ope],llt),_pe=Xe([kpe,lC,_P,CP],ype),vjr=(e,t,r)=>{if(t!=null){var n=iC(e);return t==="axis"?r==="hover"?n.axisInteraction.hover.dataKey:n.axisInteraction.click.dataKey:r==="hover"?n.itemInteraction.hover.dataKey:n.itemInteraction.click.dataKey}},Olt=Xe([iC,Spe,Slt,Ope],ult),g4=Xe([yv,vv,$i,ec,Sv,Ope,Olt],clt),bjr=Xe([kpe,g4],(e,t)=>{var r;return(r=e.coordinate)!==null&&r!==void 0?r:t}),klt=Xe([Sv,_pe],slt),xjr=Xe([Olt,_pe,s0,_P,klt,dlt,Spe],flt),wjr=Xe([kpe,_pe],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),Sjr=(e,t,r,n,s,a,i)=>{if(!(!e||!r||!n||!s)&&mjr(e,i)){var l=Ewr(e,t),c=wlt(l,a,s,r,n),u=hjr(t,s,c,e);return{activeIndex:String(c),activeCoordinate:u}}},Ojr=(e,t,r,n,s,a,i)=>{if(!(!e||!n||!s||!a||!r)){var l=B1r(e,r);if(l){var c=Cwr(l,t),u=wlt(c,i,a,n,s),d=pjr(t,a,u,l);return{activeIndex:String(u),activeCoordinate:d}}}},kjr=(e,t,r,n,s,a,i,l)=>{if(!(!e||!t||!n||!s||!a))return t==="horizontal"||t==="vertical"?Sjr(e,t,n,s,a,i,l):Ojr(e,t,r,n,s,a,i)},_jr=Xe(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,r)=>r,(e,t,r)=>{if(t!=null){var n=e[t];if(n!=null)return r?n.panoramaElement:n.element}}),Ejr=Xe(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(n=>parseInt(n,10)).concat(Object.values(Yc)),r=Array.from(new Set(t));return r.sort((n,s)=>n-s)},{memoizeOptions:{resultEqualityCheck:uOr}});function iAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function oAe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?iAe(Object(r),!0).forEach(function(n){Cjr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Cjr(e,t,r){return(t=jjr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jjr(e){var t=Tjr(e,"string");return typeof t=="symbol"?t:t+""}function Tjr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Njr={},Ajr={zIndexMap:Object.values(Yc).reduce((e,t)=>oAe(oAe({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),Njr)},Ijr=new Set(Object.values(Yc));function Rjr(e){return Ijr.has(e)}var _lt=jc({name:"zIndex",initialState:Ajr,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]?e.zIndexMap[r].consumers+=1:e.zIndexMap[r]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:oi()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(e.zIndexMap[r].consumers-=1,e.zIndexMap[r].consumers<=0&&!Rjr(r)&&delete e.zIndexMap[r])},prepare:oi()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:r,element:n,isPanorama:s}=t.payload;e.zIndexMap[r]?s?e.zIndexMap[r].panoramaElement=n:e.zIndexMap[r].element=n:e.zIndexMap[r]={consumers:0,element:s?void 0:n,panoramaElement:s?n:void 0}},prepare:oi()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(t.payload.isPanorama?e.zIndexMap[r].panoramaElement=void 0:e.zIndexMap[r].element=void 0)},prepare:oi()}}}),{registerZIndexPortal:Pjr,unregisterZIndexPortal:Mjr,registerZIndexPortalElement:Djr,unregisterZIndexPortalElement:Ljr}=_lt.actions,$jr=_lt.reducer;function Ov(e){var{zIndex:t,children:r}=e,n=iSr(),s=n&&t!==void 0&&t!==0,a=od(),i=Vo();b.useLayoutEffect(()=>s?(i(Pjr({zIndex:t})),()=>{i(Mjr({zIndex:t}))}):v1,[i,t,s]);var l=en(c=>_jr(c,t,a));return s?l?du.createPortal(r,l):null:r}function Bae(){return Bae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Bae.apply(null,arguments)}function lAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function UD(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lAe(Object(r),!0).forEach(function(n){Fjr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Fjr(e,t,r){return(t=zjr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zjr(e){var t=Bjr(e,"string");return typeof t=="symbol"?t:t+""}function Bjr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ujr(e){var{cursor:t,cursorComp:r,cursorProps:n}=e;return b.isValidElement(t)?b.cloneElement(t,n):b.createElement(r,n)}function Vjr(e){var t,{coordinate:r,payload:n,index:s,offset:a,tooltipAxisBandSize:i,layout:l,cursor:c,tooltipEventType:u,chartName:d}=e,f=r,h=n,p=s;if(!c||!f||d!=="ScatterChart"&&u!=="axis")return null;var m,g,y;if(d==="ScatterChart")m=f,g=t1r,y=Yc.cursorLine;else if(d==="BarChart")m=r1r(l,f,a,i),g=uit,y=Yc.cursorRectangle;else if(l==="radial"&&Xst(f)){var{cx:x,cy:w,radius:S,startAngle:k,endAngle:_}=dit(f);m={cx:x,cy:w,startAngle:k,endAngle:_,innerRadius:S,outerRadius:S},g=hit,y=Yc.cursorLine}else m={points:H1r(l,f,a)},g=ait,y=Yc.cursorLine;var E=typeof c=="object"&&"className"in c?c.className:void 0,T=UD(UD(UD(UD({stroke:"#ccc",pointerEvents:"none"},a),m),Dz(c)),{},{payload:h,payloadIndex:p,className:va("recharts-tooltip-cursor",E)});return b.createElement(Ov,{zIndex:(t=e.zIndex)!==null&&t!==void 0?t:y},b.createElement(Ujr,{cursor:c,cursorComp:g,cursorProps:T}))}function qjr(e){var t=cjr(),r=Hat(),n=eC(),s=gjr();return t==null||r==null||n==null||s==null?null:b.createElement(Vjr,Bae({},e,{offset:r,layout:n,tooltipAxisBandSize:t,chartName:s}))}var Elt=b.createContext(null),Hjr=()=>b.useContext(Elt),UH={exports:{}},cAe;function Qjr(){return cAe||(cAe=1,(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function s(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function a(c,u,d,f,h){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new s(d,f||c,h),m=r?r+u:u;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],p]:c._events[m].push(p):(c._events[m]=p,c._eventsCount++),c}function i(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=r?r+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var h=0,p=f.length,m=new Array(p);h<p;h++)m[h]=f[h].fn;return m},l.prototype.listenerCount=function(u){var d=r?r+u:u,f=this._events[d];return f?f.fn?1:f.length:0},l.prototype.emit=function(u,d,f,h,p,m){var g=r?r+u:u;if(!this._events[g])return!1;var y=this._events[g],x=arguments.length,w,S;if(y.fn){switch(y.once&&this.removeListener(u,y.fn,void 0,!0),x){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,d),!0;case 3:return y.fn.call(y.context,d,f),!0;case 4:return y.fn.call(y.context,d,f,h),!0;case 5:return y.fn.call(y.context,d,f,h,p),!0;case 6:return y.fn.call(y.context,d,f,h,p,m),!0}for(S=1,w=new Array(x-1);S<x;S++)w[S-1]=arguments[S];y.fn.apply(y.context,w)}else{var k=y.length,_;for(S=0;S<k;S++)switch(y[S].once&&this.removeListener(u,y[S].fn,void 0,!0),x){case 1:y[S].fn.call(y[S].context);break;case 2:y[S].fn.call(y[S].context,d);break;case 3:y[S].fn.call(y[S].context,d,f);break;case 4:y[S].fn.call(y[S].context,d,f,h);break;default:if(!w)for(_=1,w=new Array(x-1);_<x;_++)w[_-1]=arguments[_];y[S].fn.apply(y[S].context,w)}}return!0},l.prototype.on=function(u,d,f){return a(this,u,d,f,!1)},l.prototype.once=function(u,d,f){return a(this,u,d,f,!0)},l.prototype.removeListener=function(u,d,f,h){var p=r?r+u:u;if(!this._events[p])return this;if(!d)return i(this,p),this;var m=this._events[p];if(m.fn)m.fn===d&&(!h||m.once)&&(!f||m.context===f)&&i(this,p);else{for(var g=0,y=[],x=m.length;g<x;g++)(m[g].fn!==d||h&&!m[g].once||f&&m[g].context!==f)&&y.push(m[g]);y.length?this._events[p]=y.length===1?y[0]:y:i(this,p)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=r?r+u:u,this._events[d]&&i(this,d)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,e.exports=l})(UH)),UH.exports}var Wjr=Qjr();const Gjr=Uo(Wjr);var iI=new Gjr,Uae="recharts.syncEvent.tooltip",uAe="recharts.syncEvent.brush",Zjr=(e,t)=>{if(t&&Array.isArray(e)){var r=Number.parseInt(t,10);if(!Zy(r))return e[r]}},Yjr={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},Clt=jc({name:"options",initialState:Yjr,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),Xjr=Clt.reducer,{createEventEmitter:Kjr}=Clt.actions;function Jjr(e){return e.tooltip.syncInteraction}var eTr={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},jlt=jc({name:"chartData",initialState:eTr,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:r,endIndex:n}=t.payload;r!=null&&(e.dataStartIndex=r),n!=null&&(e.dataEndIndex=n)}}}),{setChartData:dAe,setDataStartEndIndexes:tTr,setComputedData:ZRn}=jlt.actions,rTr=jlt.reducer,nTr=["x","y"];function fAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function OO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fAe(Object(r),!0).forEach(function(n){sTr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function sTr(e,t,r){return(t=aTr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aTr(e){var t=iTr(e,"string");return typeof t=="symbol"?t:t+""}function iTr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oTr(e,t){if(e==null)return{};var r,n,s=lTr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function lTr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function cTr(){var e=en(Nhe),t=en(Ahe),r=Vo(),n=en(Cit),s=en(Sv),a=eC(),i=t9(),l=en(c=>c.rootProps.className);b.useEffect(()=>{if(e==null)return v1;var c=(u,d,f)=>{if(t!==f&&e===u){if(n==="index"){var h;if(i&&d!==null&&d!==void 0&&(h=d.payload)!==null&&h!==void 0&&h.coordinate&&d.payload.sourceViewBox){var p=d.payload.coordinate,{x:m,y:g}=p,y=oTr(p,nTr),{x,y:w,width:S,height:k}=d.payload.sourceViewBox,_=OO(OO({},y),{},{x:i.x+(S?(m-x)/S:0)*i.width,y:i.y+(k?(g-w)/k:0)*i.height});r(OO(OO({},d),{},{payload:OO(OO({},d.payload),{},{coordinate:_})}))}else r(d);return}if(s!=null){var E;if(typeof n=="function"){var T={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},j=n(s,T);E=s[j]}else n==="value"&&(E=s.find(U=>String(U.value)===d.payload.label));var{coordinate:N}=d.payload;if(E==null||d.payload.active===!1||N==null||i==null){r(zae({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:I,y:P}=N,R=Math.min(I,i.x+i.width),$=Math.min(P,i.y+i.height),M={x:a==="horizontal"?E.coordinate:R,y:a==="horizontal"?$:E.coordinate},z=zae({active:d.payload.active,coordinate:M,dataKey:d.payload.dataKey,index:String(E.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});r(z)}}};return iI.on(Uae,c),()=>{iI.off(Uae,c)}},[l,r,t,e,n,s,a,i])}function uTr(){var e=en(Nhe),t=en(Ahe),r=Vo();b.useEffect(()=>{if(e==null)return v1;var n=(s,a,i)=>{t!==i&&e===s&&r(tTr(a))};return iI.on(uAe,n),()=>{iI.off(uAe,n)}},[r,t,e])}function dTr(){var e=Vo();b.useEffect(()=>{e(Kjr())},[e]),cTr(),uTr()}function fTr(e,t,r,n,s,a){var i=en(m=>vjr(m,e,t)),l=en(JCr),c=en(Ahe),u=en(Nhe),d=en(Cit),f=en(Jjr),h=f?.active,p=t9();b.useEffect(()=>{if(!h&&u!=null&&c!=null){var m=zae({active:a,coordinate:r,dataKey:i,index:s,label:typeof n=="number"?String(n):n,sourceViewBox:p,graphicalItemId:l});iI.emit(Uae,u,m,c)}},[h,r,i,l,s,n,c,u,d,a,p])}function hAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function pAe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hAe(Object(r),!0).forEach(function(n){hTr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hTr(e,t,r){return(t=pTr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pTr(e){var t=mTr(e,"string");return typeof t=="symbol"?t:t+""}function mTr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gTr(e){return e.dataKey}function yTr(e,t){return b.isValidElement(e)?b.cloneElement(e,t):typeof e=="function"?b.createElement(e,t):b.createElement(NSr,t)}var mAe=[],vTr={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function bTr(e){var t,r,n=id(e,vTr),{active:s,allowEscapeViewBox:a,animationDuration:i,animationEasing:l,content:c,filterNull:u,isAnimationActive:d,offset:f,payloadUniqBy:h,position:p,reverseDirection:m,useTranslate3d:g,wrapperStyle:y,cursor:x,shared:w,trigger:S,defaultIndex:k,portal:_,axisId:E}=n,T=Vo(),j=typeof k=="number"?String(k):k;b.useEffect(()=>{T(oCr({shared:w,trigger:S,axisId:E,active:s,defaultIndex:j}))},[T,w,S,E,s,j]);var N=t9(),I=sit(),P=tCr(w),{activeIndex:R,isActive:$}=(t=en(re=>wjr(re,P,S,j)))!==null&&t!==void 0?t:{},M=en(re=>xjr(re,P,S,j)),z=en(re=>klt(re,P,S,j)),U=en(re=>bjr(re,P,S,j)),B=M,H=Hjr(),W=(r=s??$)!==null&&r!==void 0?r:!1,[L,Y]=v0r([B,W]),q=P==="axis"?z:void 0;fTr(P,S,U,q,R,W);var D=_??H;if(D==null||N==null||P==null)return null;var Q=B??mAe;W||(Q=mAe),u&&Q.length&&(Q=a0r(Q.filter(re=>re.value!=null&&(re.hide!==!0||n.includeHidden)),h,gTr));var G=Q.length>0,J=pAe(pAe({},n),{},{payload:Q,label:q,active:W,activeIndex:R,coordinate:U,accessibilityLayer:I}),ae=b.createElement(BSr,{allowEscapeViewBox:a,animationDuration:i,animationEasing:l,isAnimationActive:d,active:W,coordinate:U,hasPayload:G,offset:f,position:p,reverseDirection:m,useTranslate3d:g,viewBox:N,wrapperStyle:y,lastBoundingBox:L,innerRef:Y,hasPortalFromProps:!!_},yTr(c,J));return b.createElement(b.Fragment,null,du.createPortal(ae,D),W&&b.createElement(qjr,{cursor:x,tooltipEventType:P,coordinate:U,payload:Q,index:R}))}function xTr(e,t,r){return(t=wTr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wTr(e){var t=STr(e,"string");return typeof t=="symbol"?t:t+""}function STr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class OTr{constructor(t){xTr(this,"cache",new Map),this.maxSize=t}get(t){var r=this.cache.get(t);return r!==void 0&&(this.cache.delete(t),this.cache.set(t,r)),r}set(t,r){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(t,r)}clear(){this.cache.clear()}size(){return this.cache.size}}function gAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function kTr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gAe(Object(r),!0).forEach(function(n){_Tr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _Tr(e,t,r){return(t=ETr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ETr(e){var t=CTr(e,"string");return typeof t=="symbol"?t:t+""}function CTr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var jTr={cacheSize:2e3,enableCache:!0},Tlt=kTr({},jTr),yAe=new OTr(Tlt.cacheSize),TTr={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},vAe="recharts_measurement_span";function NTr(e,t){var r=t.fontSize||"",n=t.fontFamily||"",s=t.fontWeight||"",a=t.fontStyle||"",i=t.letterSpacing||"",l=t.textTransform||"";return"".concat(e,"|").concat(r,"|").concat(n,"|").concat(s,"|").concat(a,"|").concat(i,"|").concat(l)}var bAe=(e,t)=>{try{var r=document.getElementById(vAe);r||(r=document.createElement("span"),r.setAttribute("id",vAe),r.setAttribute("aria-hidden","true"),document.body.appendChild(r)),Object.assign(r.style,TTr,t),r.textContent="".concat(e);var n=r.getBoundingClientRect();return{width:n.width,height:n.height}}catch{return{width:0,height:0}}},jN=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||yP.isSsr)return{width:0,height:0};if(!Tlt.enableCache)return bAe(t,r);var n=NTr(t,r),s=yAe.get(n);if(s)return s;var a=bAe(t,r);return yAe.set(n,a),a},Nlt;function ATr(e,t,r){return(t=ITr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ITr(e){var t=RTr(e,"string");return typeof t=="symbol"?t:t+""}function RTr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var xAe=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,wAe=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,PTr=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,MTr=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,DTr={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},LTr=["cm","mm","pt","pc","in","Q","px"];function $Tr(e){return LTr.includes(e)}var mk="NaN";function FTr(e,t){return e*DTr[t]}class Dl{static parse(t){var r,[,n,s]=(r=MTr.exec(t))!==null&&r!==void 0?r:[];return n==null?Dl.NaN:new Dl(parseFloat(n),s??"")}constructor(t,r){this.num=t,this.unit=r,this.num=t,this.unit=r,Zy(t)&&(this.unit=""),r!==""&&!PTr.test(r)&&(this.num=NaN,this.unit=""),$Tr(r)&&(this.num=FTr(t,r),this.unit="px")}add(t){return this.unit!==t.unit?new Dl(NaN,""):new Dl(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new Dl(NaN,""):new Dl(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Dl(NaN,""):new Dl(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Dl(NaN,""):new Dl(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Zy(this.num)}}Nlt=Dl;ATr(Dl,"NaN",new Nlt(NaN,""));function Alt(e){if(e==null||e.includes(mk))return mk;for(var t=e;t.includes("*")||t.includes("/");){var r,[,n,s,a]=(r=xAe.exec(t))!==null&&r!==void 0?r:[],i=Dl.parse(n??""),l=Dl.parse(a??""),c=s==="*"?i.multiply(l):i.divide(l);if(c.isNaN())return mk;t=t.replace(xAe,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,d,f,h]=(u=wAe.exec(t))!==null&&u!==void 0?u:[],p=Dl.parse(d??""),m=Dl.parse(h??""),g=f==="+"?p.add(m):p.subtract(m);if(g.isNaN())return mk;t=t.replace(wAe,g.toString())}return t}var SAe=/\(([^()]*)\)/;function zTr(e){for(var t=e,r;(r=SAe.exec(t))!=null;){var[,n]=r;t=t.replace(SAe,Alt(n))}return t}function BTr(e){var t=e.replace(/\s+/g,"");return t=zTr(t),t=Alt(t),t}function UTr(e){try{return BTr(e)}catch{return mk}}function VH(e){var t=UTr(e.slice(5,-1));return t===mk?"":t}var VTr=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],qTr=["dx","dy","angle","className","breakAll"];function Vae(){return Vae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Vae.apply(null,arguments)}function OAe(e,t){if(e==null)return{};var r,n,s=HTr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function HTr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Ilt=/[ \f\n\r\t\v\u2028\u2029]+/,Rlt=e=>{var{children:t,breakAll:r,style:n}=e;try{var s=[];kl(t)||(r?s=t.toString().split(""):s=t.toString().split(Ilt));var a=s.map(l=>({word:l,width:jN(l,n).width})),i=r?0:jN(" ",n).width;return{wordsWithComputedWidth:a,spaceWidth:i}}catch{return null}};function Plt(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}function QTr(e){return kl(e)||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}var Mlt=(e,t,r,n)=>e.reduce((s,a)=>{var{word:i,width:l}=a,c=s[s.length-1];if(c&&l!=null&&(t==null||n||c.width+l+r<Number(t)))c.words.push(i),c.width+=l+r;else{var u={words:[i],width:l};s.push(u)}return s},[]),Dlt=e=>e.reduce((t,r)=>t.width>r.width?t:r),WTr="…",kAe=(e,t,r,n,s,a,i,l)=>{var c=e.slice(0,t),u=Rlt({breakAll:r,style:n,children:c+WTr});if(!u)return[!1,[]];var d=Mlt(u.wordsWithComputedWidth,a,i,l),f=d.length>s||Dlt(d).width>Number(a);return[f,d]},GTr=(e,t,r,n,s)=>{var{maxLines:a,children:i,style:l,breakAll:c}=e,u=qr(a),d=String(i),f=Mlt(t,n,r,s);if(!u||s)return f;var h=f.length>a||Dlt(f).width>Number(n);if(!h)return f;for(var p=0,m=d.length-1,g=0,y;p<=m&&g<=d.length-1;){var x=Math.floor((p+m)/2),w=x-1,[S,k]=kAe(d,w,c,l,a,n,r,s),[_]=kAe(d,x,c,l,a,n,r,s);if(!S&&!_&&(p=x+1),S&&_&&(m=x-1),!S&&_){y=k;break}g++}return y||f},_Ae=e=>{var t=kl(e)?[]:e.toString().split(Ilt);return[{words:t,width:void 0}]},ZTr=e=>{var{width:t,scaleToFit:r,children:n,style:s,breakAll:a,maxLines:i}=e;if((t||r)&&!yP.isSsr){var l,c,u=Rlt({breakAll:a,children:n,style:s});if(u){var{wordsWithComputedWidth:d,spaceWidth:f}=u;l=d,c=f}else return _Ae(n);return GTr({breakAll:a,children:n,maxLines:i,style:s},l,c,t,!!r)}return _Ae(n)},Llt="#808080",YTr={angle:0,breakAll:!1,capHeight:"0.71em",fill:Llt,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Epe=b.forwardRef((e,t)=>{var r=id(e,YTr),{x:n,y:s,lineHeight:a,capHeight:i,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=r,f=OAe(r,VTr),h=b.useMemo(()=>ZTr({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:p,dy:m,angle:g,className:y,breakAll:x}=f,w=OAe(f,qTr);if(!sg(n)||!sg(s)||h.length===0)return null;var S=Number(n)+(qr(p)?p:0),k=Number(s)+(qr(m)?m:0);if(!zs(S)||!zs(k))return null;var _;switch(d){case"start":_=VH("calc(".concat(i,")"));break;case"middle":_=VH("calc(".concat((h.length-1)/2," * -").concat(a," + (").concat(i," / 2))"));break;default:_=VH("calc(".concat(h.length-1," * -").concat(a,")"));break}var E=[],T=h[0];if(c&&T!=null){var j=T.width,{width:N}=f;E.push("scale(".concat(qr(N)&&qr(j)?N/j:1,")"))}return g&&E.push("rotate(".concat(g,", ").concat(S,", ").concat(k,")")),E.length&&(w.transform=E.join(" ")),b.createElement("text",Vae({},iu(w),{ref:t,x:S,y:k,className:va("recharts-text",y),textAnchor:u,fill:l.includes("url")?Llt:l}),h.map((I,P)=>{var R=I.words.join(x?"":" ");return b.createElement("tspan",{x:S,dy:P===0?_:a,key:"".concat(R,"-").concat(P)},R)}))});Epe.displayName="Text";function EAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function om(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?EAe(Object(r),!0).forEach(function(n){XTr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function XTr(e,t,r){return(t=KTr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function KTr(e){var t=JTr(e,"string");return typeof t=="symbol"?t:t+""}function JTr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var eNr=e=>{var{viewBox:t,position:r,offset:n=0,parentViewBox:s}=e,{x:a,y:i,height:l,upperWidth:c,lowerWidth:u}=xhe(t),d=a,f=a+(c-u)/2,h=(d+f)/2,p=(c+u)/2,m=d+c/2,g=l>=0?1:-1,y=g*n,x=g>0?"end":"start",w=g>0?"start":"end",S=c>=0?1:-1,k=S*n,_=S>0?"end":"start",E=S>0?"start":"end",T=s;if(r==="top"){var j={x:d+c/2,y:i-y,horizontalAnchor:"middle",verticalAnchor:x};return T&&(j.height=Math.max(i-T.y,0),j.width=c),j}if(r==="bottom"){var N={x:f+u/2,y:i+l+y,horizontalAnchor:"middle",verticalAnchor:w};return T&&(N.height=Math.max(T.y+T.height-(i+l),0),N.width=u),N}if(r==="left"){var I={x:h-k,y:i+l/2,horizontalAnchor:_,verticalAnchor:"middle"};return T&&(I.width=Math.max(I.x-T.x,0),I.height=l),I}if(r==="right"){var P={x:h+p+k,y:i+l/2,horizontalAnchor:E,verticalAnchor:"middle"};return T&&(P.width=Math.max(T.x+T.width-P.x,0),P.height=l),P}var R=T?{width:p,height:l}:{};return r==="insideLeft"?om({x:h+k,y:i+l/2,horizontalAnchor:E,verticalAnchor:"middle"},R):r==="insideRight"?om({x:h+p-k,y:i+l/2,horizontalAnchor:_,verticalAnchor:"middle"},R):r==="insideTop"?om({x:d+c/2,y:i+y,horizontalAnchor:"middle",verticalAnchor:w},R):r==="insideBottom"?om({x:f+u/2,y:i+l-y,horizontalAnchor:"middle",verticalAnchor:x},R):r==="insideTopLeft"?om({x:d+k,y:i+y,horizontalAnchor:E,verticalAnchor:w},R):r==="insideTopRight"?om({x:d+c-k,y:i+y,horizontalAnchor:_,verticalAnchor:w},R):r==="insideBottomLeft"?om({x:f+k,y:i+l-y,horizontalAnchor:E,verticalAnchor:x},R):r==="insideBottomRight"?om({x:f+u-k,y:i+l-y,horizontalAnchor:_,verticalAnchor:x},R):r&&typeof r=="object"&&(qr(r.x)||ES(r.x))&&(qr(r.y)||ES(r.y))?om({x:a+Cx(r.x,p),y:i+Cx(r.y,l),horizontalAnchor:"end",verticalAnchor:"end"},R):om({x:m,y:i+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},R)},tNr=["labelRef"],rNr=["content"];function CAe(e,t){if(e==null)return{};var r,n,s=nNr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function nNr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function jAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function qT(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jAe(Object(r),!0).forEach(function(n){sNr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function sNr(e,t,r){return(t=aNr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aNr(e){var t=iNr(e,"string");return typeof t=="symbol"?t:t+""}function iNr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ky(){return ky=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ky.apply(null,arguments)}var $lt=b.createContext(null),oNr=e=>{var{x:t,y:r,upperWidth:n,lowerWidth:s,width:a,height:i,children:l}=e,c=b.useMemo(()=>({x:t,y:r,upperWidth:n,lowerWidth:s,width:a,height:i}),[t,r,n,s,a,i]);return b.createElement($lt.Provider,{value:c},l)},Flt=()=>{var e=b.useContext($lt),t=t9();return e||(t?xhe(t):void 0)},lNr=b.createContext(null),cNr=()=>{var e=b.useContext(lNr),t=en(Iit);return e||t},uNr=e=>{var{value:t,formatter:r}=e,n=kl(e.children)?t:e.children;return typeof r=="function"?r(n):n},Cpe=e=>e!=null&&typeof e=="function",dNr=(e,t)=>{var r=dh(t-e),n=Math.min(Math.abs(t-e),360);return r*n},fNr=(e,t,r,n,s)=>{var{offset:a,className:i}=e,{cx:l,cy:c,innerRadius:u,outerRadius:d,startAngle:f,endAngle:h,clockWise:p}=s,m=(u+d)/2,g=dNr(f,h),y=g>=0?1:-1,x,w;switch(t){case"insideStart":x=f+y*a,w=p;break;case"insideEnd":x=h-y*a,w=!p;break;case"end":x=h+y*a,w=p;break;default:throw new Error("Unsupported position ".concat(t))}w=g<=0?w:!w;var S=Hl(l,c,m,x),k=Hl(l,c,m,x+(w?1:-1)*359),_="M".concat(S.x,",").concat(S.y,`
|
|
289
289
|
A`).concat(m,",").concat(m,",0,1,").concat(w?0:1,`,
|
|
290
|
-
`).concat(k.x,",").concat(k.y),E=kl(e.id)?WA("recharts-radial-line-"):e.id;return b.createElement("text",ky({},n,{dominantBaseline:"central",className:va("recharts-radial-bar-label",i)}),b.createElement("defs",null,b.createElement("path",{id:E,d:_})),b.createElement("textPath",{xlinkHref:"#".concat(E)},r))},hNr=(e,t,r)=>{var{cx:n,cy:s,innerRadius:a,outerRadius:i,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(r==="outside"){var{x:d,y:f}=Hl(n,s,i+t,u);return{x:d,y:f,textAnchor:d>=n?"start":"end",verticalAnchor:"middle"}}if(r==="center")return{x:n,y:s,textAnchor:"middle",verticalAnchor:"middle"};if(r==="centerTop")return{x:n,y:s,textAnchor:"middle",verticalAnchor:"start"};if(r==="centerBottom")return{x:n,y:s,textAnchor:"middle",verticalAnchor:"end"};var h=(a+i)/2,{x:p,y:m}=Hl(n,s,h,u);return{x:p,y:m,textAnchor:"middle",verticalAnchor:"middle"}},x$=e=>e!=null&&"cx"in e&&qr(e.cx),pNr={angle:0,offset:5,zIndex:Yc.label,position:"middle",textBreakAll:!1};function mNr(e){if(!x$(e))return e;var{cx:t,cy:r,outerRadius:n}=e,s=n*2;return{x:t-n,y:r-n,width:s,upperWidth:s,lowerWidth:s,height:s}}function Ob(e){var t=id(e,pNr),{viewBox:r,parentViewBox:n,position:s,value:a,children:i,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=cNr(),h=Flt(),p=s==="center"?h:f??h,m,g,y;r==null?m=p:x$(r)?m=r:m=xhe(r);var x=mNr(m);if(!m||kl(a)&&kl(i)&&!b.isValidElement(l)&&typeof l!="function")return null;var w=qT(qT({},t),{},{viewBox:m});if(b.isValidElement(l)){var{labelRef:S}=w,k=CAe(w,tNr);return b.cloneElement(l,k)}if(typeof l=="function"){var{content:_}=w,E=CAe(w,rNr);if(g=b.createElement(l,E),b.isValidElement(g))return g}else g=uNr(t);var T=iu(t);if(x$(m)){if(s==="insideStart"||s==="insideEnd"||s==="end")return fNr(t,s,g,T,m);y=hNr(m,t.offset,t.position)}else{if(!x)return null;var j=eNr({viewBox:x,position:s,offset:t.offset,parentViewBox:x$(n)?void 0:n});y=qT(qT({x:j.x,y:j.y,textAnchor:j.horizontalAnchor,verticalAnchor:j.verticalAnchor},j.width!==void 0?{width:j.width}:{}),j.height!==void 0?{height:j.height}:{})}return b.createElement(Ov,{zIndex:t.zIndex},b.createElement(Epe,ky({ref:d,className:va("recharts-label",c)},T,y,{textAnchor:Plt(T.textAnchor)?T.textAnchor:y.textAnchor,breakAll:u}),g))}Ob.displayName="Label";var gNr=(e,t,r)=>{if(!e)return null;var n={viewBox:t,labelRef:r};return e===!0?b.createElement(Ob,ky({key:"label-implicit"},n)):sg(e)?b.createElement(Ob,ky({key:"label-implicit",value:e},n)):b.isValidElement(e)?e.type===Ob?b.cloneElement(e,qT({key:"label-implicit"},n)):b.createElement(Ob,ky({key:"label-implicit",content:e},n)):Cpe(e)?b.createElement(Ob,ky({key:"label-implicit",content:e},n)):e&&typeof e=="object"?b.createElement(Ob,ky({},e,{key:"label-implicit"},n)):null};function yNr(e){var{label:t,labelRef:r}=e,n=Flt();return gNr(t,n,r)||null}var vNr=["valueAccessor"],bNr=["dataKey","clockWise","id","textBreakAll","zIndex"];function y4(){return y4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},y4.apply(null,arguments)}function TAe(e,t){if(e==null)return{};var r,n,s=xNr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function xNr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var wNr=e=>{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(QTr(t))return t},zlt=b.createContext(void 0),SNr=zlt.Provider,Blt=b.createContext(void 0);Blt.Provider;function ONr(){return b.useContext(zlt)}function kNr(){return b.useContext(Blt)}function w$(e){var{valueAccessor:t=wNr}=e,r=TAe(e,vNr),{dataKey:n,clockWise:s,id:a,textBreakAll:i,zIndex:l}=r,c=TAe(r,bNr),u=ONr(),d=kNr(),f=u||d;return!f||!f.length?null:b.createElement(Ov,{zIndex:l??Yc.label},b.createElement(Gy,{className:"recharts-label-list"},f.map((h,p)=>{var m,g=kl(n)?t(h,p):Yl(h.payload,n),y=kl(a)?{}:{id:"".concat(a,"-").concat(p)};return b.createElement(Ob,y4({key:"label-".concat(p)},iu(h),c,y,{fill:(m=r.fill)!==null&&m!==void 0?m:h.fill,parentViewBox:h.parentViewBox,value:g,textBreakAll:i,viewBox:h.viewBox,index:p,zIndex:0}))})))}w$.displayName="LabelList";function _Nr(e){var{label:t}=e;return t?t===!0?b.createElement(w$,{key:"labelList-implicit"}):b.isValidElement(t)||Cpe(t)?b.createElement(w$,{key:"labelList-implicit",content:t}):typeof t=="object"?b.createElement(w$,y4({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function qae(){return qae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qae.apply(null,arguments)}var Ult=e=>{var{cx:t,cy:r,r:n,className:s}=e,a=va("recharts-dot",s);return qr(t)&&qr(r)&&qr(n)?b.createElement("circle",qae({},ng(e),dhe(e),{className:a,cx:t,cy:r,r:n})):null},ENr={radiusAxis:{},angleAxis:{}},Vlt=jc({name:"polarAxis",initialState:ENr,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:YRn,removeRadiusAxis:XRn,addAngleAxis:KRn,removeAngleAxis:JRn}=Vlt.actions,CNr=Vlt.reducer;function jNr(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var qH={exports:{}},Xs={};var NAe;function TNr(){if(NAe)return Xs;NAe=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),i=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),m;m=Symbol.for("react.module.reference");function g(y){if(typeof y=="object"&&y!==null){var x=y.$$typeof;switch(x){case e:switch(y=y.type,y){case r:case s:case n:case u:case d:return y;default:switch(y=y&&y.$$typeof,y){case l:case i:case c:case h:case f:case a:return y;default:return x}}case t:return x}}}return Xs.ContextConsumer=i,Xs.ContextProvider=a,Xs.Element=e,Xs.ForwardRef=c,Xs.Fragment=r,Xs.Lazy=h,Xs.Memo=f,Xs.Portal=t,Xs.Profiler=s,Xs.StrictMode=n,Xs.Suspense=u,Xs.SuspenseList=d,Xs.isAsyncMode=function(){return!1},Xs.isConcurrentMode=function(){return!1},Xs.isContextConsumer=function(y){return g(y)===i},Xs.isContextProvider=function(y){return g(y)===a},Xs.isElement=function(y){return typeof y=="object"&&y!==null&&y.$$typeof===e},Xs.isForwardRef=function(y){return g(y)===c},Xs.isFragment=function(y){return g(y)===r},Xs.isLazy=function(y){return g(y)===h},Xs.isMemo=function(y){return g(y)===f},Xs.isPortal=function(y){return g(y)===t},Xs.isProfiler=function(y){return g(y)===s},Xs.isStrictMode=function(y){return g(y)===n},Xs.isSuspense=function(y){return g(y)===u},Xs.isSuspenseList=function(y){return g(y)===d},Xs.isValidElementType=function(y){return typeof y=="string"||typeof y=="function"||y===r||y===s||y===n||y===u||y===d||y===p||typeof y=="object"&&y!==null&&(y.$$typeof===h||y.$$typeof===f||y.$$typeof===a||y.$$typeof===i||y.$$typeof===c||y.$$typeof===m||y.getModuleId!==void 0)},Xs.typeOf=g,Xs}var AAe;function NNr(){return AAe||(AAe=1,qH.exports=TNr()),qH.exports}NNr();var qlt=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,HH={},IAe;function ANr(){return IAe||(IAe=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){const s=r[Symbol.toStringTag];return s==null||!Object.getOwnPropertyDescriptor(r,Symbol.toStringTag)?.writable?!1:r.toString()===`[object ${s}]`}let n=r;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(r)===n}e.isPlainObject=t})(HH)),HH}var QH,RAe;function INr(){return RAe||(RAe=1,QH=ANr().isPlainObject),QH}var RNr=INr();const PNr=Uo(RNr);var PAe,MAe,DAe,LAe,$Ae;function FAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function zAe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?FAe(Object(r),!0).forEach(function(n){MNr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):FAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function MNr(e,t,r){return(t=DNr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function DNr(e){var t=LNr(e,"string");return typeof t=="symbol"?t:t+""}function LNr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function v4(){return v4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},v4.apply(null,arguments)}function sT(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var BAe=(e,t,r,n,s)=>{var a=r-n,i;return i=Hi(PAe||(PAe=sT(["M ",",",""])),e,t),i+=Hi(MAe||(MAe=sT(["L ",",",""])),e+r,t),i+=Hi(DAe||(DAe=sT(["L ",",",""])),e+r-a/2,t+s),i+=Hi(LAe||(LAe=sT(["L ",",",""])),e+r-a/2-n,t+s),i+=Hi($Ae||($Ae=sT(["L ",","," Z"])),e,t),i},$Nr={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},FNr=e=>{var t=id(e,$Nr),{x:r,y:n,upperWidth:s,lowerWidth:a,height:i,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,h=b.useRef(null),[p,m]=b.useState(-1),g=b.useRef(s),y=b.useRef(a),x=b.useRef(i),w=b.useRef(r),S=b.useRef(n),k=khe(e,"trapezoid-");if(b.useEffect(()=>{if(h.current&&h.current.getTotalLength)try{var M=h.current.getTotalLength();M&&m(M)}catch{}},[]),r!==+r||n!==+n||s!==+s||a!==+a||i!==+i||s===0&&a===0||i===0)return null;var _=va("recharts-trapezoid",l);if(!f)return b.createElement("g",null,b.createElement("path",v4({},iu(t),{className:_,d:BAe(r,n,s,a,i)})));var E=g.current,T=y.current,j=x.current,N=w.current,I=S.current,P="0px ".concat(p===-1?1:p,"px"),R="".concat(p,"px ").concat(p,"px"),$=iit(["strokeDasharray"],u,c);return b.createElement(Ohe,{animationId:k,key:k,canBegin:p>0,duration:u,easing:c,isActive:f,begin:d},M=>{var z=Lu(E,s,M),U=Lu(T,a,M),B=Lu(j,i,M),H=Lu(N,r,M),W=Lu(I,n,M);h.current&&(g.current=z,y.current=U,x.current=B,w.current=H,S.current=W);var L=M>0?{transition:$,strokeDasharray:R}:{strokeDasharray:P};return b.createElement("path",v4({},iu(t),{className:_,d:BAe(H,W,z,U,B),ref:h,style:zAe(zAe({},L),t.style)}))})},zNr=["option","shapeType","activeClassName","inActiveClassName"];function BNr(e,t){if(e==null)return{};var r,n,s=UNr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function UNr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function UAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function b4(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?UAe(Object(r),!0).forEach(function(n){VNr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function VNr(e,t,r){return(t=qNr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qNr(e){var t=HNr(e,"string");return typeof t=="symbol"?t:t+""}function HNr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function QNr(e,t){return b4(b4({},t),e)}function WNr(e,t){return e==="symbols"}function VAe(e){var{shapeType:t,elementProps:r}=e;switch(t){case"rectangle":return b.createElement(uit,r);case"trapezoid":return b.createElement(FNr,r);case"sector":return b.createElement(hit,r);case"symbols":if(WNr(t))return b.createElement(Yst,r);break;case"curve":return b.createElement(ait,r);default:return null}}function GNr(e){return b.isValidElement(e)?e.props:e}function ZNr(e){var{option:t,shapeType:r,activeClassName:n="recharts-active-shape",inActiveClassName:s="recharts-shape"}=e,a=BNr(e,zNr),i;if(b.isValidElement(t))i=b.cloneElement(t,b4(b4({},a),GNr(t)));else if(typeof t=="function")i=t(a,a.index);else if(PNr(t)&&typeof t!="boolean"){var l=QNr(t,a);i=b.createElement(VAe,{shapeType:r,elementProps:l})}else{var c=a;i=b.createElement(VAe,{shapeType:r,elementProps:c})}return a.isActive?b.createElement(Gy,{className:n},i):b.createElement(Gy,{className:s},i)}function YNr(e){var{tooltipEntrySettings:t}=e,r=Vo(),n=od(),s=b.useRef(null);return b.useLayoutEffect(()=>{n||(s.current===null?r(sCr(t)):s.current!==t&&r(aCr({prev:s.current,next:t})),s.current=t)},[t,r,n]),b.useLayoutEffect(()=>()=>{s.current&&(r(iCr(s.current)),s.current=null)},[r]),null}function XNr(e){var{legendPayload:t}=e,r=Vo(),n=od(),s=b.useRef(null);return b.useLayoutEffect(()=>{n||(s.current===null?r(bSr(t)):s.current!==t&&r(xSr({prev:s.current,next:t})),s.current=t)},[r,n,t]),b.useLayoutEffect(()=>()=>{s.current&&(r(wSr(s.current)),s.current=null)},[r]),null}var WH,KNr=()=>{var[e]=b.useState(()=>WA("uid-"));return e},JNr=(WH=t1.useId)!==null&&WH!==void 0?WH:KNr;function eAr(e,t){var r=JNr();return t||(e?"".concat(e,"-").concat(r):r)}var tAr=b.createContext(void 0),rAr=e=>{var{id:t,type:r,children:n}=e,s=eAr("recharts-".concat(r),t);return b.createElement(tAr.Provider,{value:s},n(s))},nAr={cartesianItems:[],polarItems:[]},Hlt=jc({name:"graphicalItems",initialState:nAr,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:oi()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,s=fh(e).cartesianItems.indexOf(r);s>-1&&(e.cartesianItems[s]=n)},prepare:oi()},removeCartesianGraphicalItem:{reducer(e,t){var r=fh(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:oi()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:oi()},removePolarGraphicalItem:{reducer(e,t){var r=fh(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:oi()},replacePolarGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,s=fh(e).polarItems.indexOf(r);s>-1&&(e.polarItems[s]=n)},prepare:oi()}}}),{addCartesianGraphicalItem:sAr,replaceCartesianGraphicalItem:aAr,removeCartesianGraphicalItem:iAr,addPolarGraphicalItem:ePn,removePolarGraphicalItem:tPn,replacePolarGraphicalItem:rPn}=Hlt.actions,oAr=Hlt.reducer,lAr=e=>{var t=Vo(),r=b.useRef(null);return b.useLayoutEffect(()=>{r.current===null?t(sAr(e)):r.current!==e&&t(aAr({prev:r.current,next:e})),r.current=e},[t,e]),b.useLayoutEffect(()=>()=>{r.current&&(t(iAr(r.current)),r.current=null)},[t]),null},cAr=b.memo(lAr),uAr=["points"];function qAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function GH(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qAe(Object(r),!0).forEach(function(n){dAr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function dAr(e,t,r){return(t=fAr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fAr(e){var t=hAr(e,"string");return typeof t=="symbol"?t:t+""}function hAr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function x4(){return x4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},x4.apply(null,arguments)}function pAr(e,t){if(e==null)return{};var r,n,s=mAr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function mAr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function gAr(e){var{option:t,dotProps:r,className:n}=e;if(b.isValidElement(t))return b.cloneElement(t,r);if(typeof t=="function")return t(r);var s=va(n,typeof t!="boolean"?t.className:""),a=r??{},{points:i}=a,l=pAr(a,uAr);return b.createElement(Ult,x4({},l,{className:s}))}function yAr(e,t){return e==null?!1:t?!0:e.length===1}function vAr(e){var{points:t,dot:r,className:n,dotClassName:s,dataKey:a,baseProps:i,needClip:l,clipPathId:c,zIndex:u=Yc.scatter}=e;if(!yAr(t,r))return null;var d=qlt(r),f=Nbr(r),h=t.map((m,g)=>{var y,x,w=GH(GH(GH({r:3},i),f),{},{index:g,cx:(y=m.x)!==null&&y!==void 0?y:void 0,cy:(x=m.y)!==null&&x!==void 0?x:void 0,dataKey:a,value:m.value,payload:m.payload,points:t});return b.createElement(gAr,{key:"dot-".concat(g),option:r,dotProps:w,className:s})}),p={};return l&&c!=null&&(p.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),b.createElement(Ov,{zIndex:u},b.createElement(Gy,x4({className:n},p),h))}function HAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function QAe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?HAe(Object(r),!0).forEach(function(n){bAr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):HAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bAr(e,t,r){return(t=xAr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xAr(e){var t=wAr(e,"string");return typeof t=="symbol"?t:t+""}function wAr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var SAr={xAxis:{},yAxis:{},zAxis:{}},Qlt=jc({name:"cartesianAxis",initialState:SAr,reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:oi()},replaceXAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.xAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.xAxis[r.id],e.xAxis[n.id]=n)},prepare:oi()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:oi()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:oi()},replaceYAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.yAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.yAxis[r.id],e.yAxis[n.id]=n)},prepare:oi()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:oi()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:oi()},replaceZAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.zAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.zAxis[r.id],e.zAxis[n.id]=n)},prepare:oi()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:oi()},updateYAxisWidth(e,t){var{id:r,width:n}=t.payload,s=e.yAxis[r];if(s){var a,i=s.widthHistory||[];if(i.length===3&&i[0]===i[2]&&n===i[1]&&n!==s.width&&Math.abs(n-((a=i[0])!==null&&a!==void 0?a:0))<=1)return;var l=[...i,n].slice(-3);e.yAxis[r]=QAe(QAe({},s),{},{width:n,widthHistory:l})}}}}),{addXAxis:OAr,replaceXAxis:kAr,removeXAxis:_Ar,addYAxis:EAr,replaceYAxis:CAr,removeYAxis:jAr,addZAxis:nPn,replaceZAxis:sPn,removeZAxis:aPn,updateYAxisWidth:TAr}=Qlt.actions,NAr=Qlt.reducer,AAr=Xe([ec],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),IAr=Xe([AAr,yv,vv],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),jpe=()=>en(IAr),RAr=()=>en(sjr);function WAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function ZH(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?WAe(Object(r),!0).forEach(function(n){PAr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function PAr(e,t,r){return(t=MAr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MAr(e){var t=DAr(e,"string");return typeof t=="symbol"?t:t+""}function DAr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var LAr=e=>{var{point:t,childIndex:r,mainColor:n,activeDot:s,dataKey:a,clipPath:i}=e;if(s===!1||t.x==null||t.y==null)return null;var l={index:r,dataKey:a,cx:t.x,cy:t.y,r:4,fill:n??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=ZH(ZH(ZH({},l),Dz(s)),dhe(s)),u;return b.isValidElement(s)?u=b.cloneElement(s,c):typeof s=="function"?u=s(c):u=b.createElement(Ult,c),b.createElement(Gy,{className:"recharts-active-dot",clipPath:i},u)};function $Ar(e){var{points:t,mainColor:r,activeDot:n,itemDataKey:s,clipPath:a,zIndex:i=Yc.activeDot}=e,l=en(aI),c=RAr();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return kl(u)?null:b.createElement(Ov,{zIndex:i},b.createElement(LAr,{point:u,childIndex:Number(l),mainColor:r,dataKey:s,activeDot:n,clipPath:a}))}var FAr=e=>{var{chartData:t}=e,r=Vo(),n=od();return b.useEffect(()=>n?()=>{}:(r(dAe(t)),()=>{r(dAe(void 0))}),[t,r,n]),null},GAe={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},Wlt=jc({name:"brush",initialState:GAe,reducers:{setBrushSettings(e,t){return t.payload==null?GAe:t.payload}}}),{setBrushSettings:iPn}=Wlt.actions,zAr=Wlt.reducer;function BAr(e){return(e%180+180)%180}var UAr=function(t){var{width:r,height:n}=t,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=BAr(s),i=a*Math.PI/180,l=Math.atan(n/r),c=i>l&&i<Math.PI-l?n/Math.sin(i):r/Math.cos(i);return Math.abs(c)},VAr={dots:[],areas:[],lines:[]},Glt=jc({name:"referenceElements",initialState:VAr,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=fh(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=fh(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=fh(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:oPn,removeDot:lPn,addArea:cPn,removeArea:uPn,addLine:dPn,removeLine:fPn}=Glt.actions,qAr=Glt.reducer,HAr=b.createContext(void 0),QAr=e=>{var{children:t}=e,[r]=b.useState("".concat(WA("recharts"),"-clip")),n=jpe();if(n==null)return null;var{x:s,y:a,width:i,height:l}=n;return b.createElement(HAr.Provider,{value:r},b.createElement("defs",null,b.createElement("clipPath",{id:r},b.createElement("rect",{x:s,y:a,height:l,width:i}))),t)};function Zlt(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;n<e.length;n+=t){var s=e[n];s!==void 0&&r.push(s)}return r}function WAr(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return UAr(n,r)}function GAr(e,t,r){var n=r==="width",{x:s,y:a,width:i,height:l}=e;return t===1?{start:n?s:a,end:n?s+i:a+l}:{start:n?s+i:a+l,end:n?s:a}}function oI(e,t,r,n,s){if(e*t<e*n||e*t>e*s)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-s)<=0}function ZAr(e,t){return Zlt(e,t+1)}function YAr(e,t,r,n,s){for(var a=(n||[]).slice(),{start:i,end:l}=t,c=0,u=1,d=i,f=function(){var m=n?.[c];if(m===void 0)return{v:Zlt(n,u)};var g=c,y,x=()=>(y===void 0&&(y=r(m,g)),y),w=m.coordinate,S=c===0||oI(e,w,x,d,l);S||(c=0,d=i,u+=1),S&&(d=w+e*(x()/2+s),c+=u)},h;u<=a.length;)if(h=f(),h)return h.v;return[]}function XAr(e,t,r,n,s){var a=(n||[]).slice(),i=a.length;if(i===0)return[];for(var{start:l,end:c}=t,u=1;u<=i;u++){for(var d=(i-1)%u,f=l,h=!0,p=function(){var k=n[g];if(k==null)return 0;var _=g,E,T=()=>(E===void 0&&(E=r(k,_)),E),j=k.coordinate,N=g===d||oI(e,j,T,f,c);if(!N)return h=!1,1;N&&(f=j+e*(T()/2+s))},m,g=d;g<i&&(m=p(),!(m!==0&&m===1));g+=u);if(h){for(var y=[],x=d;x<i;x+=u){var w=n[x];w!=null&&y.push(w)}return y}}return[]}function ZAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function ic(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ZAe(Object(r),!0).forEach(function(n){KAr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ZAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function KAr(e,t,r){return(t=JAr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function JAr(e){var t=eIr(e,"string");return typeof t=="symbol"?t:t+""}function eIr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tIr(e,t,r,n,s){for(var a=(n||[]).slice(),i=a.length,{start:l}=t,{end:c}=t,u=function(h){var p=a[h];if(p==null)return 1;var m=p,g,y=()=>(g===void 0&&(g=r(p,h)),g);if(h===i-1){var x=e*(m.coordinate+e*y()/2-c);a[h]=m=ic(ic({},m),{},{tickCoord:x>0?m.coordinate-x*e:m.coordinate})}else a[h]=m=ic(ic({},m),{},{tickCoord:m.coordinate});if(m.tickCoord!=null){var w=oI(e,m.tickCoord,y,l,c);w&&(c=m.tickCoord-e*(y()/2+s),a[h]=ic(ic({},m),{},{isShow:!0}))}},d=i-1;d>=0;d--)u(d);return a}function rIr(e,t,r,n,s,a){var i=(n||[]).slice(),l=i.length,{start:c,end:u}=t;if(a){var d=n[l-1];if(d!=null){var f=r(d,l-1),h=e*(d.coordinate+e*f/2-u);if(i[l-1]=d=ic(ic({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate}),d.tickCoord!=null){var p=oI(e,d.tickCoord,()=>f,c,u);p&&(u=d.tickCoord-e*(f/2+s),i[l-1]=ic(ic({},d),{},{isShow:!0}))}}}for(var m=a?l-1:l,g=function(w){var S=i[w];if(S==null)return 1;var k=S,_,E=()=>(_===void 0&&(_=r(S,w)),_);if(w===0){var T=e*(k.coordinate-e*E()/2-c);i[w]=k=ic(ic({},k),{},{tickCoord:T<0?k.coordinate-T*e:k.coordinate})}else i[w]=k=ic(ic({},k),{},{tickCoord:k.coordinate});if(k.tickCoord!=null){var j=oI(e,k.tickCoord,E,c,u);j&&(c=k.tickCoord+e*(E()/2+s),i[w]=ic(ic({},k),{},{isShow:!0}))}},y=0;y<m;y++)g(y);return i}function Tpe(e,t,r){var{tick:n,ticks:s,viewBox:a,minTickGap:i,orientation:l,interval:c,tickFormatter:u,unit:d,angle:f}=e;if(!s||!s.length||!n)return[];if(qr(c)||yP.isSsr){var h;return(h=ZAr(s,qr(c)?c:0))!==null&&h!==void 0?h:[]}var p=[],m=l==="top"||l==="bottom"?"width":"height",g=d&&m==="width"?jN(d,{fontSize:t,letterSpacing:r}):{width:0,height:0},y=(_,E)=>{var T=typeof u=="function"?u(_.value,E):_.value;return m==="width"?WAr(jN(T,{fontSize:t,letterSpacing:r}),g,f):jN(T,{fontSize:t,letterSpacing:r})[m]},x=s[0],w=s[1],S=s.length>=2&&x!=null&&w!=null?dh(w.coordinate-x.coordinate):1,k=GAr(a,S,m);return c==="equidistantPreserveStart"?YAr(S,k,y,s,i):c==="equidistantPreserveEnd"?XAr(S,k,y,s,i):(c==="preserveStart"||c==="preserveStartEnd"?p=rIr(S,k,y,s,i,c==="preserveStartEnd"):p=tIr(S,k,y,s,i),p.filter(_=>_.isShow))}var nIr=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:s=0,tickMargin:a=0}=e,i=0;if(t){Array.from(t).forEach(d=>{if(d){var f=d.getBoundingClientRect();f.width>i&&(i=f.width)}});var l=r?r.getBoundingClientRect().width:0,c=s+a,u=i+c+l+(r?n:0);return Math.round(u)}return 0},sIr={xAxis:{},yAxis:{}},Ylt=jc({name:"renderedTicks",initialState:sIr,reducers:{setRenderedTicks:(e,t)=>{var{axisType:r,axisId:n,ticks:s}=t.payload;e[r][n]=s},removeRenderedTicks:(e,t)=>{var{axisType:r,axisId:n}=t.payload;delete e[r][n]}}}),{setRenderedTicks:aIr,removeRenderedTicks:iIr}=Ylt.actions,oIr=Ylt.reducer,lIr=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function cIr(e,t){if(e==null)return{};var r,n,s=uIr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function uIr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function IS(){return IS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},IS.apply(null,arguments)}function YAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function qi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?YAe(Object(r),!0).forEach(function(n){dIr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function dIr(e,t,r){return(t=fIr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fIr(e){var t=hIr(e,"string");return typeof t=="symbol"?t:t+""}function hIr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $y={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",zIndex:Yc.axis};function pIr(e){var{x:t,y:r,width:n,height:s,orientation:a,mirror:i,axisLine:l,otherSvgProps:c}=e;if(!l)return null;var u=qi(qi(qi({},c),ng(l)),{},{fill:"none"});if(a==="top"||a==="bottom"){var d=+(a==="top"&&!i||a==="bottom"&&i);u=qi(qi({},u),{},{x1:t,y1:r+d*s,x2:t+n,y2:r+d*s})}else{var f=+(a==="left"&&!i||a==="right"&&i);u=qi(qi({},u),{},{x1:t+f*n,y1:r,x2:t+f*n,y2:r+s})}return b.createElement("line",IS({},u,{className:va("recharts-cartesian-axis-line",zz(l,"className"))}))}function mIr(e,t,r,n,s,a,i,l,c){var u,d,f,h,p,m,g=l?-1:1,y=e.tickSize||i,x=qr(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":u=d=e.coordinate,h=r+ +!l*s,f=h-g*y,m=f-g*c,p=x;break;case"left":f=h=e.coordinate,d=t+ +!l*n,u=d-g*y,p=u-g*c,m=x;break;case"right":f=h=e.coordinate,d=t+ +l*n,u=d+g*y,p=u+g*c,m=x;break;default:u=d=e.coordinate,h=r+ +l*s,f=h+g*y,m=f+g*c,p=x;break}return{line:{x1:u,y1:f,x2:d,y2:h},tick:{x:p,y:m}}}function gIr(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function yIr(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function vIr(e){var{option:t,tickProps:r,value:n}=e,s,a=va(r.className,"recharts-cartesian-axis-tick-value");if(b.isValidElement(t))s=b.cloneElement(t,qi(qi({},r),{},{className:a}));else if(typeof t=="function")s=t(qi(qi({},r),{},{className:a}));else{var i="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(i=va(i,jNr(t))),s=b.createElement(Epe,IS({},r,{className:i}),n)}return s}function bIr(e){var{ticks:t,axisType:r,axisId:n}=e,s=Vo();return b.useEffect(()=>{if(n==null||r==null)return v1;var a=t.map(i=>({value:i.value,coordinate:i.coordinate,offset:i.offset,index:i.index}));return s(aIr({ticks:a,axisId:n,axisType:r})),()=>{s(iIr({axisId:n,axisType:r}))}},[s,t,n,r]),null}var xIr=b.forwardRef((e,t)=>{var{ticks:r=[],tick:n,tickLine:s,stroke:a,tickFormatter:i,unit:l,padding:c,tickTextProps:u,orientation:d,mirror:f,x:h,y:p,width:m,height:g,tickSize:y,tickMargin:x,fontSize:w,letterSpacing:S,getTicksConfig:k,events:_,axisType:E,axisId:T}=e,j=Tpe(qi(qi({},k),{},{ticks:r}),w,S),N=ng(k),I=Dz(n),P=Plt(N.textAnchor)?N.textAnchor:gIr(d,f),R=yIr(d,f),$={};typeof s=="object"&&($=s);var M=qi(qi({},N),{},{fill:"none"},$),z=j.map(H=>qi({entry:H},mIr(H,h,p,m,g,d,y,f,x))),U=z.map(H=>{var{entry:W,line:L}=H;return b.createElement(Gy,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(W.value,"-").concat(W.coordinate,"-").concat(W.tickCoord)},s&&b.createElement("line",IS({},M,L,{className:va("recharts-cartesian-axis-tick-line",zz(s,"className"))})))}),B=z.map((H,W)=>{var L,Y,{entry:q,tick:D}=H,Q=qi(qi(qi(qi({verticalAnchor:R},N),{},{textAnchor:P,stroke:"none",fill:a},D),{},{index:W,payload:q,visibleTicksCount:j.length,tickFormatter:i,padding:c},u),{},{angle:(L=(Y=u?.angle)!==null&&Y!==void 0?Y:N.angle)!==null&&L!==void 0?L:0}),G=qi(qi({},Q),I);return b.createElement(Gy,IS({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(q.value,"-").concat(q.coordinate,"-").concat(q.tickCoord)},Pxr(_,q,W)),n&&b.createElement(vIr,{option:n,tickProps:G,value:"".concat(typeof i=="function"?i(q.value,W):q.value).concat(l||"")}))});return b.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(E,"-ticks")},b.createElement(bIr,{ticks:j,axisId:T,axisType:E}),B.length>0&&b.createElement(Ov,{zIndex:Yc.label},b.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(E,"-tick-labels"),ref:t},B)),U.length>0&&b.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(E,"-tick-lines")},U))}),wIr=b.forwardRef((e,t)=>{var{axisLine:r,width:n,height:s,className:a,hide:i,ticks:l,axisType:c,axisId:u}=e,d=cIr(e,lIr),[f,h]=b.useState(""),[p,m]=b.useState(""),g=b.useRef(null);b.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var x;return nIr({ticks:g.current,label:(x=e.labelRef)===null||x===void 0?void 0:x.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var y=b.useCallback(x=>{if(x){var w=x.getElementsByClassName("recharts-cartesian-axis-tick-value");g.current=w;var S=w[0];if(S){var k=window.getComputedStyle(S),_=k.fontSize,E=k.letterSpacing;(_!==f||E!==p)&&(h(_),m(E))}}},[f,p]);return i||n!=null&&n<=0||s!=null&&s<=0?null:b.createElement(Ov,{zIndex:e.zIndex},b.createElement(Gy,{className:va("recharts-cartesian-axis",a)},b.createElement(pIr,{x:e.x,y:e.y,width:n,height:s,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:ng(e)}),b.createElement(xIr,{ref:y,axisType:c,events:d,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:p,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:l,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:u}),b.createElement(oNr,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},b.createElement(yNr,{label:e.label,labelRef:e.labelRef}),e.children)))}),Npe=b.forwardRef((e,t)=>{var r=id(e,$y);return b.createElement(wIr,IS({},r,{ref:t}))});Npe.displayName="CartesianAxis";var SIr=["x1","y1","x2","y2","key"],OIr=["offset"],kIr=["xAxisId","yAxisId"],_Ir=["xAxisId","yAxisId"];function XAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function fc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?XAe(Object(r),!0).forEach(function(n){EIr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):XAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function EIr(e,t,r){return(t=CIr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function CIr(e){var t=jIr(e,"string");return typeof t=="symbol"?t:t+""}function jIr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Tw(){return Tw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Tw.apply(null,arguments)}function w4(e,t){if(e==null)return{};var r,n,s=TIr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function TIr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var NIr=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:s,width:a,height:i,ry:l}=e;return b.createElement("rect",{x:n,y:s,ry:l,width:a,height:i,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function Xlt(e){var{option:t,lineItemProps:r}=e,n;if(b.isValidElement(t))n=b.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var s,{x1:a,y1:i,x2:l,y2:c,key:u}=r,d=w4(r,SIr),f=(s=ng(d))!==null&&s!==void 0?s:{},{offset:h}=f,p=w4(f,OIr);n=b.createElement("line",Tw({},p,{x1:a,y1:i,x2:l,y2:c,fill:"none",key:u}))}return n}function AIr(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:s}=e;if(!n||!s||!s.length)return null;var{xAxisId:a,yAxisId:i}=e,l=w4(e,kIr),c=s.map((u,d)=>{var f=fc(fc({},l),{},{x1:t,y1:u,x2:t+r,y2:u,key:"line-".concat(d),index:d});return b.createElement(Xlt,{key:"line-".concat(d),option:n,lineItemProps:f})});return b.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function IIr(e){var{y:t,height:r,vertical:n=!0,verticalPoints:s}=e;if(!n||!s||!s.length)return null;var{xAxisId:a,yAxisId:i}=e,l=w4(e,_Ir),c=s.map((u,d)=>{var f=fc(fc({},l),{},{x1:u,y1:t,x2:u,y2:t+r,key:"line-".concat(d),index:d});return b.createElement(Xlt,{option:n,lineItemProps:f,key:"line-".concat(d)})});return b.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function RIr(e){var{horizontalFill:t,fillOpacity:r,x:n,y:s,width:a,height:i,horizontalPoints:l,horizontal:c=!0}=e;if(!c||!t||!t.length||l==null)return null;var u=l.map(f=>Math.round(f+s-s)).sort((f,h)=>f-h);s!==u[0]&&u.unshift(0);var d=u.map((f,h)=>{var p=u[h+1],m=p==null,g=m?s+i-f:p-f;if(g<=0)return null;var y=h%t.length;return b.createElement("rect",{key:"react-".concat(h),y:f,x:n,height:g,width:a,stroke:"none",fill:t[y],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return b.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},d)}function PIr(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:s,y:a,width:i,height:l,verticalPoints:c}=e;if(!t||!r||!r.length)return null;var u=c.map(f=>Math.round(f+s-s)).sort((f,h)=>f-h);s!==u[0]&&u.unshift(0);var d=u.map((f,h)=>{var p=u[h+1],m=p==null,g=m?s+i-f:p-f;if(g<=0)return null;var y=h%r.length;return b.createElement("rect",{key:"react-".concat(h),x:f,y:a,width:g,height:l,stroke:"none",fill:r[y],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return b.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},d)}var MIr=(e,t)=>{var{xAxis:r,width:n,height:s,offset:a}=e;return Lat(Tpe(fc(fc(fc({},$y),r),{},{ticks:$at(r),viewBox:{x:0,y:0,width:n,height:s}})),a.left,a.left+a.width,t)},DIr=(e,t)=>{var{yAxis:r,width:n,height:s,offset:a}=e;return Lat(Tpe(fc(fc(fc({},$y),r),{},{ticks:$at(r),viewBox:{x:0,y:0,width:n,height:s}})),a.top,a.top+a.height,t)},LIr={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Yc.grid};function Klt(e){var t=Qat(),r=Wat(),n=Hat(),s=fc(fc({},id(e,LIr)),{},{x:qr(e.x)?e.x:n.left,y:qr(e.y)?e.y:n.top,width:qr(e.width)?e.width:n.width,height:qr(e.height)?e.height:n.height}),{xAxisId:a,yAxisId:i,x:l,y:c,width:u,height:d,syncWithTicks:f,horizontalValues:h,verticalValues:p}=s,m=od(),g=en(N=>KNe(N,"xAxis",a,m)),y=en(N=>KNe(N,"yAxis",i,m));if(!ag(u)||!ag(d)||!qr(l)||!qr(c))return null;var x=s.verticalCoordinatesGenerator||MIr,w=s.horizontalCoordinatesGenerator||DIr,{horizontalPoints:S,verticalPoints:k}=s;if((!S||!S.length)&&typeof w=="function"){var _=h&&h.length,E=w({yAxis:y?fc(fc({},y),{},{ticks:_?h:y.ticks}):void 0,width:t??u,height:r??d,offset:n},_?!0:f);Q5(Array.isArray(E),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof E,"]")),Array.isArray(E)&&(S=E)}if((!k||!k.length)&&typeof x=="function"){var T=p&&p.length,j=x({xAxis:g?fc(fc({},g),{},{ticks:T?p:g.ticks}):void 0,width:t??u,height:r??d,offset:n},T?!0:f);Q5(Array.isArray(j),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof j,"]")),Array.isArray(j)&&(k=j)}return b.createElement(Ov,{zIndex:s.zIndex},b.createElement("g",{className:"recharts-cartesian-grid"},b.createElement(NIr,{fill:s.fill,fillOpacity:s.fillOpacity,x:s.x,y:s.y,width:s.width,height:s.height,ry:s.ry}),b.createElement(RIr,Tw({},s,{horizontalPoints:S})),b.createElement(PIr,Tw({},s,{verticalPoints:k})),b.createElement(AIr,Tw({},s,{offset:n,horizontalPoints:S,xAxis:g,yAxis:y})),b.createElement(IIr,Tw({},s,{offset:n,verticalPoints:k,xAxis:g,yAxis:y}))))}Klt.displayName="CartesianGrid";var $Ir={},Jlt=jc({name:"errorBars",initialState:$Ir,reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:s}=t.payload;e[r]&&(e[r]=e[r].map(a=>a.dataKey===n.dataKey&&a.direction===n.direction?s:a))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(s=>s.dataKey!==n.dataKey||s.direction!==n.direction))}}}),{addErrorBar:hPn,replaceErrorBar:pPn,removeErrorBar:mPn}=Jlt.actions,FIr=Jlt.reducer,zIr=["children"];function BIr(e,t){if(e==null)return{};var r,n,s=UIr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function UIr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var VIr={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},qIr=b.createContext(VIr);function HIr(e){var{children:t}=e,r=BIr(e,zIr);return b.createElement(qIr.Provider,{value:r},t)}function ect(e,t){var r,n,s=en(u=>xv(u,e)),a=en(u=>wv(u,t)),i=(r=s?.allowDataOverflow)!==null&&r!==void 0?r:Yo.allowDataOverflow,l=(n=a?.allowDataOverflow)!==null&&n!==void 0?n:Xo.allowDataOverflow,c=i||l;return{needClip:c,needClipX:i,needClipY:l}}function QIr(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,s=jpe(),{needClipX:a,needClipY:i,needClip:l}=ect(t,r);if(!l||!s)return null;var{x:c,y:u,width:d,height:f}=s;return b.createElement("clipPath",{id:"clipPath-".concat(n)},b.createElement("rect",{x:a?c:c-d/2,y:i?u:u-f/2,width:a?d:d*2,height:i?f:f*2}))}var tct=(e,t,r,n)=>elt(e,"xAxis",t,n),rct=(e,t,r,n)=>Jot(e,"xAxis",t,n),nct=(e,t,r,n)=>elt(e,"yAxis",r,n),sct=(e,t,r,n)=>Jot(e,"yAxis",r,n),WIr=Xe([$i,tct,nct,rct,sct],(e,t,r,n,s)=>gv(e,"xAxis")?H5(t,n,!1):H5(r,s,!1)),GIr=(e,t,r,n,s)=>s;function ZIr(e){return e.type==="line"}var YIr=Xe([Oot,GIr],(e,t)=>e.filter(ZIr).find(r=>r.id===t)),XIr=Xe([$i,tct,nct,rct,sct,YIr,WIr,_he],(e,t,r,n,s,a,i,l)=>{var{chartData:c,dataStartIndex:u,dataEndIndex:d}=l;if(!(a==null||t==null||r==null||n==null||s==null||n.length===0||s.length===0||i==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:f,data:h}=a,p;if(h!=null&&h.length>0?p=h:p=c?.slice(u,d+1),p!=null)return vRr({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:s,dataKey:f,bandSize:i,displayedData:p})}});function KIr(e){var t=Dz(e),r=3,n=2;if(t!=null){var{r:s,strokeWidth:a}=t,i=Number(s),l=Number(a);return(Number.isNaN(i)||i<0)&&(i=r),(Number.isNaN(l)||l<0)&&(l=n),{r:i,strokeWidth:l}}return{r,strokeWidth:n}}var JIr=["id"],eRr=["type","layout","connectNulls","needClip","shape"],tRr=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function lI(){return lI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},lI.apply(null,arguments)}function KAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function vm(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?KAe(Object(r),!0).forEach(function(n){rRr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function rRr(e,t,r){return(t=nRr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nRr(e){var t=sRr(e,"string");return typeof t=="symbol"?t:t+""}function sRr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ape(e,t){if(e==null)return{};var r,n,s=aRr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function aRr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var iRr=e=>{var{dataKey:t,name:r,stroke:n,legendType:s,hide:a}=e;return[{inactive:a,dataKey:t,type:s,color:n,value:Fat(r,t),payload:e}]},oRr=b.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:s,fill:a,name:i,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r,getPosition:v1,settings:{stroke:n,strokeWidth:s,fill:a,dataKey:t,nameKey:void 0,name:Fat(i,t),hide:l,type:u,color:n,unit:c,graphicalItemId:d}};return b.createElement(YNr,{tooltipEntrySettings:f})}),act=(e,t)=>"".concat(t,"px ").concat(e,"px");function lRr(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],s=0;s<t;++s)n.push(...r);return n}var cRr=(e,t,r)=>{var n=r.reduce((h,p)=>h+p,0);if(!n)return act(t,e);for(var s=Math.floor(e/n),a=e%n,i=[],l=0,c=0;l<r.length;c+=(u=r[l])!==null&&u!==void 0?u:0,++l){var u,d=r[l];if(d!=null&&c+d>a){i=[...r.slice(0,l),a-c];break}}var f=i.length%2===0?[0,t]:[t];return[...lRr(r,s),...i,...f].map(h=>"".concat(h,"px")).join(", ")};function uRr(e){var{clipPathId:t,points:r,props:n}=e,{dot:s,dataKey:a,needClip:i}=n,{id:l}=n,c=Ape(n,JIr),u=ng(c);return b.createElement(vAr,{points:r,dot:s,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:u,needClip:i,clipPathId:t})}function dRr(e){var{showLabels:t,children:r,points:n}=e,s=b.useMemo(()=>n?.map(a=>{var i,l,c={x:(i=a.x)!==null&&i!==void 0?i:0,y:(l=a.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return vm(vm({},c),{},{value:a.value,payload:a.payload,viewBox:c,parentViewBox:void 0,fill:void 0})}),[n]);return b.createElement(SNr,{value:t?s:void 0},r)}function JAe(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:s,props:a}=e,{type:i,layout:l,connectNulls:c,needClip:u,shape:d}=a,f=Ape(a,eRr),h=vm(vm({},iu(f)),{},{fill:"none",className:"recharts-line-curve",clipPath:u?"url(#clipPath-".concat(t,")"):void 0,points:n,type:i,layout:l,connectNulls:c,strokeDasharray:s??a.strokeDasharray});return b.createElement(b.Fragment,null,n?.length>1&&b.createElement(ZNr,lI({shapeType:"curve",option:d},h,{pathRef:r})),b.createElement(uRr,{points:n,clipPathId:t,props:a}))}function fRr(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function hRr(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:s,longestAnimatedLengthRef:a}=e,{points:i,strokeDasharray:l,isAnimationActive:c,animationBegin:u,animationDuration:d,animationEasing:f,animateNewValues:h,width:p,height:m,onAnimationEnd:g,onAnimationStart:y}=r,x=s.current,w=khe(i,"recharts-line-"),S=b.useRef(w),[k,_]=b.useState(!1),E=!k,T=b.useCallback(()=>{typeof g=="function"&&g(),_(!1)},[g]),j=b.useCallback(()=>{typeof y=="function"&&y(),_(!0)},[y]),N=fRr(n.current),I=b.useRef(0);S.current!==w&&(I.current=a.current,S.current=w);var P=I.current;return b.createElement(dRr,{points:i,showLabels:E},r.children,b.createElement(Ohe,{animationId:w,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:T,onAnimationStart:j,key:w},R=>{var $=Lu(P,N+P,R),M=Math.min($,N),z;if(c)if(l){var U="".concat(l).split(/[,\s]+/gim).map(W=>parseFloat(W));z=cRr(M,N,U)}else z=act(N,M);else z=l==null?void 0:String(l);if(R>0&&N>0&&(s.current=i,a.current=Math.max(a.current,M)),x){var B=x.length/i.length,H=R===1?i:i.map((W,L)=>{var Y=Math.floor(L*B);if(x[Y]){var q=x[Y];return vm(vm({},W),{},{x:Lu(q.x,W.x,R),y:Lu(q.y,W.y,R)})}return h?vm(vm({},W),{},{x:Lu(p*2,W.x,R),y:Lu(m/2,W.y,R)}):vm(vm({},W),{},{x:W.x,y:W.y})});return s.current=H,b.createElement(JAe,{props:r,points:H,clipPathId:t,pathRef:n,strokeDasharray:z})}return b.createElement(JAe,{props:r,points:i,clipPathId:t,pathRef:n,strokeDasharray:z})}),b.createElement(_Nr,{label:r.label}))}function pRr(e){var{clipPathId:t,props:r}=e,n=b.useRef(null),s=b.useRef(0),a=b.useRef(null);return b.createElement(hRr,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:s,pathRef:a})}var mRr=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:Yl(e.payload,t)}};class gRr extends b.Component{render(){var{hide:t,dot:r,points:n,className:s,xAxisId:a,yAxisId:i,top:l,left:c,width:u,height:d,id:f,needClip:h,zIndex:p}=this.props;if(t)return null;var m=va("recharts-line",s),g=f,{r:y,strokeWidth:x}=KIr(r),w=qlt(r),S=y*2+x,k=h?"url(#clipPath-".concat(w?"":"dots-").concat(g,")"):void 0;return b.createElement(Ov,{zIndex:p},b.createElement(Gy,{className:m},h&&b.createElement("defs",null,b.createElement(QIr,{clipPathId:g,xAxisId:a,yAxisId:i}),!w&&b.createElement("clipPath",{id:"clipPath-dots-".concat(g)},b.createElement("rect",{x:c-S/2,y:l-S/2,width:u+S,height:d+S}))),b.createElement(HIr,{xAxisId:a,yAxisId:i,data:n,dataPointFormatter:mRr,errorBarOffset:0},b.createElement(pRr,{props:this.props,clipPathId:g}))),b.createElement($Ar,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:k}))}}var ict={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Yc.line,type:"linear"};function yRr(e){var t=id(e,ict),{activeDot:r,animateNewValues:n,animationBegin:s,animationDuration:a,animationEasing:i,connectNulls:l,dot:c,hide:u,isAnimationActive:d,label:f,legendType:h,xAxisId:p,yAxisId:m,id:g}=t,y=Ape(t,tRr),{needClip:x}=ect(p,m),w=jpe(),S=eC(),k=od(),_=en(I=>XIr(I,p,m,k,g));if(S!=="horizontal"&&S!=="vertical"||_==null||w==null)return null;var{height:E,width:T,x:j,y:N}=w;return b.createElement(gRr,lI({},y,{id:g,connectNulls:l,dot:c,activeDot:r,animateNewValues:n,animationBegin:s,animationDuration:a,animationEasing:i,isAnimationActive:d,hide:u,label:f,legendType:h,xAxisId:p,yAxisId:m,points:_,layout:S,height:E,width:T,left:j,top:N,needClip:x}))}function vRr(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:s,yAxisTicks:a,dataKey:i,bandSize:l,displayedData:c}=e;return c.map((u,d)=>{var f=Yl(u,i);if(t==="horizontal"){var h=Xje({axis:r,ticks:s,bandSize:l,entry:u,index:d}),p=kl(f)?null:n.scale.map(f);return{x:h,y:p??null,value:f,payload:u}}var m=kl(f)?null:r.scale.map(f),g=Xje({axis:n,ticks:a,bandSize:l,entry:u,index:d});return m==null||g==null?null:{x:m,y:g,value:f,payload:u}}).filter(Boolean)}function bRr(e){var t=id(e,ict),r=od();return b.createElement(rAr,{id:t.id,type:"line"},n=>b.createElement(b.Fragment,null,b.createElement(XNr,{legendPayload:iRr(t)}),b.createElement(oRr,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:n}),b.createElement(cAr,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),b.createElement(yRr,lI({},t,{id:n}))))}var oct=b.memo(bRr,a9);oct.displayName="Line";var xRr=["domain","range"],wRr=["domain","range"];function eIe(e,t){if(e==null)return{};var r,n,s=SRr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function SRr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function tIe(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function lct(e,t){if(e===t)return!0;var{domain:r,range:n}=e,s=eIe(e,xRr),{domain:a,range:i}=t,l=eIe(t,wRr);return!tIe(r,a)||!tIe(n,i)?!1:a9(s,l)}var ORr=["type"],kRr=["dangerouslySetInnerHTML","ticks","scale"],_Rr=["id","scale"];function Hae(){return Hae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Hae.apply(null,arguments)}function rIe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function nIe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?rIe(Object(r),!0).forEach(function(n){ERr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rIe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ERr(e,t,r){return(t=CRr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function CRr(e){var t=jRr(e,"string");return typeof t=="symbol"?t:t+""}function jRr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qae(e,t){if(e==null)return{};var r,n,s=TRr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function TRr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function NRr(e){var t=Vo(),r=b.useRef(null),n=Gat(),{type:s}=e,a=Qae(e,ORr),i=l9(n,"xAxis",s),l=b.useMemo(()=>{if(i!=null)return nIe(nIe({},a),{},{type:i})},[a,i]);return b.useLayoutEffect(()=>{l!=null&&(r.current===null?t(OAr(l)):r.current!==l&&t(kAr({prev:r.current,next:l})),r.current=l)},[l,t]),b.useLayoutEffect(()=>()=>{r.current&&(t(_Ar(r.current)),r.current=null)},[t]),null}var ARr=e=>{var{xAxisId:t,className:r}=e,n=en(Bat),s=od(),a="xAxis",i=en(x=>Kot(x,a,t,s)),l=en(x=>FEr(x,t)),c=en(x=>HEr(x,t)),u=en(x=>bot(x,t));if(l==null||c==null||u==null)return null;var{dangerouslySetInnerHTML:d,ticks:f,scale:h}=e,p=Qae(e,kRr),{id:m,scale:g}=u,y=Qae(u,_Rr);return b.createElement(Npe,Hae({},p,y,{x:c.x,y:c.y,width:l.width,height:l.height,className:va("recharts-".concat(a," ").concat(a),r),viewBox:n,ticks:i,axisType:a,axisId:t}))},IRr={allowDataOverflow:Yo.allowDataOverflow,allowDecimals:Yo.allowDecimals,allowDuplicatedCategory:Yo.allowDuplicatedCategory,angle:Yo.angle,axisLine:$y.axisLine,height:Yo.height,hide:!1,includeHidden:Yo.includeHidden,interval:Yo.interval,label:!1,minTickGap:Yo.minTickGap,mirror:Yo.mirror,orientation:Yo.orientation,padding:Yo.padding,reversed:Yo.reversed,scale:Yo.scale,tick:Yo.tick,tickCount:Yo.tickCount,tickLine:$y.tickLine,tickSize:$y.tickSize,type:Yo.type,niceTicks:Yo.niceTicks,xAxisId:0},RRr=e=>{var t=id(e,IRr);return b.createElement(b.Fragment,null,b.createElement(NRr,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),b.createElement(ARr,t))},cct=b.memo(RRr,lct);cct.displayName="XAxis";var PRr=["type"],MRr=["dangerouslySetInnerHTML","ticks","scale"],DRr=["id","scale"];function Wae(){return Wae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Wae.apply(null,arguments)}function sIe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function aIe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sIe(Object(r),!0).forEach(function(n){LRr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sIe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function LRr(e,t,r){return(t=$Rr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $Rr(e){var t=FRr(e,"string");return typeof t=="symbol"?t:t+""}function FRr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Gae(e,t){if(e==null)return{};var r,n,s=zRr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function zRr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function BRr(e){var t=Vo(),r=b.useRef(null),n=Gat(),{type:s}=e,a=Gae(e,PRr),i=l9(n,"yAxis",s),l=b.useMemo(()=>{if(i!=null)return aIe(aIe({},a),{},{type:i})},[i,a]);return b.useLayoutEffect(()=>{l!=null&&(r.current===null?t(EAr(l)):r.current!==l&&t(CAr({prev:r.current,next:l})),r.current=l)},[l,t]),b.useLayoutEffect(()=>()=>{r.current&&(t(jAr(r.current)),r.current=null)},[t]),null}function URr(e){var{yAxisId:t,className:r,width:n,label:s}=e,a=b.useRef(null),i=b.useRef(null),l=en(Bat),c=od(),u=Vo(),d="yAxis",f=en(E=>GEr(E,t)),h=en(E=>WEr(E,t)),p=en(E=>Kot(E,d,t,c)),m=en(E=>xot(E,t));if(b.useLayoutEffect(()=>{if(!(n!=="auto"||!f||Cpe(s)||b.isValidElement(s)||m==null)){var E=a.current;if(E){var T=E.getCalculatedWidth();Math.round(f.width)!==Math.round(T)&&u(TAr({id:t,width:T}))}}},[p,f,u,s,t,n,m]),f==null||h==null||m==null)return null;var{dangerouslySetInnerHTML:g,ticks:y,scale:x}=e,w=Gae(e,MRr),{id:S,scale:k}=m,_=Gae(m,DRr);return b.createElement(Npe,Wae({},w,_,{ref:a,labelRef:i,x:h.x,y:h.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:f.width,height:f.height,className:va("recharts-".concat(d," ").concat(d),r),viewBox:l,ticks:p,axisType:d,axisId:t}))}var VRr={allowDataOverflow:Xo.allowDataOverflow,allowDecimals:Xo.allowDecimals,allowDuplicatedCategory:Xo.allowDuplicatedCategory,angle:Xo.angle,axisLine:$y.axisLine,hide:!1,includeHidden:Xo.includeHidden,interval:Xo.interval,label:!1,minTickGap:Xo.minTickGap,mirror:Xo.mirror,orientation:Xo.orientation,padding:Xo.padding,reversed:Xo.reversed,scale:Xo.scale,tick:Xo.tick,tickCount:Xo.tickCount,tickLine:$y.tickLine,tickSize:$y.tickSize,type:Xo.type,niceTicks:Xo.niceTicks,width:Xo.width,yAxisId:0},qRr=e=>{var t=id(e,VRr);return b.createElement(b.Fragment,null,b.createElement(BRr,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),b.createElement(URr,t))},uct=b.memo(qRr,lct);uct.displayName="YAxis";var HRr=(e,t)=>t,Ipe=Xe([HRr,$i,Iit,Cl,glt,Sv,yjr,ec],kjr);function QRr(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function Rpe(e){var t=e.currentTarget.getBoundingClientRect(),r,n;if(QRr(e)){var s=e.currentTarget.getBBox();r=s.width>0?t.width/s.width:1,n=s.height>0?t.height/s.height:1}else{var a=e.currentTarget;r=a.offsetWidth>0?t.width/a.offsetWidth:1,n=a.offsetHeight>0?t.height/a.offsetHeight:1}var i=(l,c)=>({relativeX:Math.round((l-t.left)/r),relativeY:Math.round((c-t.top)/n)});return"touches"in e?Array.from(e.touches).map(l=>i(l.clientX,l.clientY)):i(e.clientX,e.clientY)}var dct=uf("mouseClick"),fct=hP();fct.startListening({actionCreator:dct,effect:(e,t)=>{var r=e.payload,n=Ipe(t.getState(),Rpe(r));n?.activeIndex!=null&&t.dispatch(cCr({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Zae=uf("mouseMove"),hct=hP(),kO=null,z0=null,YH=null;hct.startListening({actionCreator:Zae,effect:(e,t)=>{var r=e.payload,n=t.getState(),{throttleDelay:s,throttledEvents:a}=n.eventSettings,i=a==="all"||a?.includes("mousemove");kO!==null&&(cancelAnimationFrame(kO),kO=null),z0!==null&&(typeof s!="number"||!i)&&(clearTimeout(z0),z0=null),YH=Rpe(r);var l=()=>{var c=t.getState(),u=gpe(c,c.tooltip.settings.shared);if(!YH){kO=null,z0=null;return}if(u==="axis"){var d=Ipe(c,YH);d?.activeIndex!=null?t.dispatch(olt({activeIndex:d.activeIndex,activeDataKey:void 0,activeCoordinate:d.activeCoordinate})):t.dispatch(ilt())}kO=null,z0=null};if(!i){l();return}s==="raf"?kO=requestAnimationFrame(l):typeof s=="number"&&z0===null&&(z0=setTimeout(l,s))}});function WRr(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<<CHILDREN>>":t}var iIe={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},pct=jc({name:"rootProps",initialState:iIe,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:iIe.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),GRr=pct.reducer,{updateOptions:ZRr}=pct.actions,YRr=null,XRr={updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)},mct=jc({name:"polarOptions",initialState:YRr,reducers:XRr}),{updatePolarOptions:gPn}=mct.actions,KRr=mct.reducer,gct=uf("keyDown"),yct=uf("focus"),vct=uf("blur"),S9=hP(),_O=null,B0=null,VD=null;S9.startListening({actionCreator:gct,effect:(e,t)=>{VD=e.payload,_O!==null&&(cancelAnimationFrame(_O),_O=null);var r=t.getState(),{throttleDelay:n,throttledEvents:s}=r.eventSettings,a=s==="all"||s.includes("keydown");B0!==null&&(typeof n!="number"||!a)&&(clearTimeout(B0),B0=null);var i=()=>{try{var l=t.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var{keyboardInteraction:u}=l.tooltip,d=VD;if(d!=="ArrowRight"&&d!=="ArrowLeft"&&d!=="Enter")return;var f=ype(u,lC(l),_P(l),CP(l)),h=f==null?-1:Number(f);if(!Number.isFinite(h)||h<0)return;var p=Sv(l);if(d==="Enter"){var m=g4(l,"axis","hover",String(u.index));t.dispatch(m4({active:!u.active,activeIndex:u.index,activeCoordinate:m}));return}var g=JEr(l),y=g==="left-to-right"?1:-1,x=d==="ArrowRight"?1:-1,w=h+x*y;if(p==null||w>=p.length||w<0)return;var S=g4(l,"axis","hover",String(w));t.dispatch(m4({active:!0,activeIndex:w.toString(),activeCoordinate:S}))}finally{_O=null,B0=null}};if(!a){i();return}n==="raf"?_O=requestAnimationFrame(i):typeof n=="number"&&B0===null&&(i(),VD=null,B0=setTimeout(()=>{VD?i():(B0=null,_O=null)},n))}});S9.startListening({actionCreator:yct,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:s}=r.tooltip;if(!s.active&&s.index==null){var a="0",i=g4(r,"axis","hover",String(a));t.dispatch(m4({active:!0,activeIndex:a,activeCoordinate:i}))}}}});S9.startListening({actionCreator:vct,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:s}=r.tooltip;s.active&&t.dispatch(m4({active:!1,activeIndex:s.index,activeCoordinate:s.coordinate}))}}});function bct(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(r,n)=>{if(n==="currentTarget")return t;var s=Reflect.get(r,n);return typeof s=="function"?s.bind(r):s}})}var Yf=uf("externalEvent"),xct=hP(),qD=new Map,aT=new Map,XH=new Map;xct.startListening({actionCreator:Yf,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){var s=n.type,a=bct(n);XH.set(s,{handler:r,reactEvent:a});var i=qD.get(s);i!==void 0&&(cancelAnimationFrame(i),qD.delete(s));var l=t.getState(),{throttleDelay:c,throttledEvents:u}=l.eventSettings,d=u,f=d==="all"||d?.includes(s),h=aT.get(s);h!==void 0&&(typeof c!="number"||!f)&&(clearTimeout(h),aT.delete(s));var p=()=>{var y=XH.get(s);try{if(!y)return;var{handler:x,reactEvent:w}=y,S=t.getState(),k={activeCoordinate:tjr(S),activeDataKey:KCr(S),activeIndex:aI(S),activeLabel:blt(S),activeTooltipIndex:aI(S),isTooltipActive:rjr(S)};x&&x(k,w)}finally{qD.delete(s),aT.delete(s),XH.delete(s)}};if(!f){p();return}if(c==="raf"){var m=requestAnimationFrame(p);qD.set(s,m)}else if(typeof c=="number"){if(!aT.has(s)){p();var g=setTimeout(p,c);aT.set(s,g)}}else p()}}});var JRr=Xe([iC],e=>e.tooltipItemPayloads),ePr=Xe([JRr,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(t!=null){var n=e.find(a=>a.settings.graphicalItemId===r);if(n!=null){var{getPosition:s}=n;if(s!=null)return s(t)}}}),wct=uf("touchMove"),Sct=hP(),U0=null,ib=null,oIe=null,iT=null;Sct.startListening({actionCreator:wct,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){iT=bct(r);var n=t.getState(),{throttleDelay:s,throttledEvents:a}=n.eventSettings,i=a==="all"||a.includes("touchmove");U0!==null&&(cancelAnimationFrame(U0),U0=null),ib!==null&&(typeof s!="number"||!i)&&(clearTimeout(ib),ib=null),oIe=Array.from(r.touches).map(c=>Rpe({clientX:c.clientX,clientY:c.clientY,currentTarget:r.currentTarget}));var l=()=>{if(iT!=null){var c=t.getState(),u=gpe(c,c.tooltip.settings.shared);if(u==="axis"){var d,f=(d=oIe)===null||d===void 0?void 0:d[0];if(f==null){U0=null,ib=null;return}var h=Ipe(c,f);h?.activeIndex!=null&&t.dispatch(olt({activeIndex:h.activeIndex,activeDataKey:void 0,activeCoordinate:h.activeCoordinate}))}else if(u==="item"){var p,m=iT.touches[0];if(document.elementFromPoint==null||m==null)return;var g=document.elementFromPoint(m.clientX,m.clientY);if(!g||!g.getAttribute)return;var y=g.getAttribute(Twr),x=(p=g.getAttribute(Nwr))!==null&&p!==void 0?p:void 0,w=oC(c).find(_=>_.id===x);if(y==null||w==null||x==null)return;var{dataKey:S}=w,k=ePr(c,y,x);t.dispatch(lCr({activeDataKey:S,activeIndex:y,activeCoordinate:k,activeGraphicalItemId:x}))}U0=null,ib=null}};if(!i){l();return}s==="raf"?U0=requestAnimationFrame(l):typeof s=="number"&&ib===null&&(l(),iT=null,ib=setTimeout(()=>{iT?l():(ib=null,U0=null)},s))}}});var Oct={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},kct=jc({name:"eventSettings",initialState:Oct,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),{setEventSettings:tPr}=kct.actions,rPr=kct.reducer,nPr=ent({brush:zAr,cartesianAxis:NAr,chartData:rTr,errorBars:FIr,eventSettings:rPr,graphicalItems:oAr,layout:pwr,legend:SSr,options:Xjr,polarAxis:CNr,polarOptions:KRr,referenceElements:qAr,renderedTicks:oIr,rootProps:GRr,tooltip:uCr,zIndex:$jr}),sPr=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return F0r({reducer:nPr,preloadedState:t,middleware:n=>{var s;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((s="es6")!==null&&s!==void 0?s:"")}).concat([fct.middleware,hct.middleware,S9.middleware,xct.middleware,Sct.middleware])},enhancers:n=>{var s=n;return typeof n=="function"&&(s=n()),s.concat(Oat({type:"raf"}))},devTools:{serialize:{replacer:WRr},name:"recharts-".concat(r)}})};function aPr(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,s=od(),a=b.useRef(null);if(s)return r;a.current==null&&(a.current=sPr(t,n));var i=hhe;return b.createElement(cnt,{context:i,store:a.current},r)}function iPr(e){var{layout:t,margin:r}=e,n=Vo(),s=od();return b.useEffect(()=>{s||(n(dwr(t)),n(uwr(r)))},[n,s,t,r]),null}var oPr=b.memo(iPr,a9);function lPr(e){var t=Vo();return b.useEffect(()=>{t(ZRr(e))},[t,e]),null}var cPr=e=>{var t=Vo();return b.useEffect(()=>{t(tPr(e))},[t,e]),null},uPr=b.memo(cPr,a9);function lIe(e){var{zIndex:t,isPanorama:r}=e,n=b.useRef(null),s=Vo();return b.useLayoutEffect(()=>(n.current&&s(Djr({zIndex:t,element:n.current,isPanorama:r})),()=>{s(Ljr({zIndex:t,isPanorama:r}))}),[s,t,r]),b.createElement("g",{tabIndex:-1,ref:n,className:"recharts-zIndex-layer_".concat(t)})}function cIe(e){var{children:t,isPanorama:r}=e,n=en(Ejr);if(!n||n.length===0)return t;var s=n.filter(i=>i<0),a=n.filter(i=>i>0);return b.createElement(b.Fragment,null,s.map(i=>b.createElement(lIe,{key:i,zIndex:i,isPanorama:r})),t,a.map(i=>b.createElement(lIe,{key:i,zIndex:i,isPanorama:r})))}var dPr=["children"];function fPr(e,t){if(e==null)return{};var r,n,s=hPr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function hPr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function S4(){return S4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},S4.apply(null,arguments)}var pPr={width:"100%",height:"100%",display:"block"},mPr=b.forwardRef((e,t)=>{var r=Qat(),n=Wat(),s=sit();if(!ag(r)||!ag(n))return null;var{children:a,otherAttributes:i,title:l,desc:c}=e,u,d;return i!=null&&(typeof i.tabIndex=="number"?u=i.tabIndex:u=s?0:void 0,typeof i.role=="string"?d=i.role:d=s?"application":void 0),b.createElement(Tst,S4({},i,{title:l,desc:c,role:d,tabIndex:u,width:r,height:n,style:pPr,ref:t}),a)}),gPr=e=>{var{children:t}=e,r=en(e9);if(!r)return null;var{width:n,height:s,y:a,x:i}=r;return b.createElement(Tst,{width:n,height:s,x:i,y:a},t)},uIe=b.forwardRef((e,t)=>{var{children:r}=e,n=fPr(e,dPr),s=od();return s?b.createElement(gPr,null,b.createElement(cIe,{isPanorama:!0},r)):b.createElement(mPr,S4({ref:t},n),b.createElement(cIe,{isPanorama:!1},r))});function yPr(){var e=Vo(),[t,r]=b.useState(null),n=en(jwr);return b.useEffect(()=>{if(t!=null){var s=t.getBoundingClientRect(),a=s.width/t.offsetWidth;zs(a)&&a!==n&&e(hwr(a))}},[t,e,n]),r}function dIe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function vPr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dIe(Object(r),!0).forEach(function(n){bPr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dIe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bPr(e,t,r){return(t=xPr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xPr(e){var t=wPr(e,"string");return typeof t=="symbol"?t:t+""}function wPr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Kb(){return Kb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Kb.apply(null,arguments)}var SPr=()=>(dTr(),null);function O4(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var OPr=b.forwardRef((e,t)=>{var r,n,s=b.useRef(null),[a,i]=b.useState({containerWidth:O4((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:O4((n=e.style)===null||n===void 0?void 0:n.height)}),l=b.useCallback((u,d)=>{i(f=>{var h=Math.round(u),p=Math.round(d);return f.containerWidth===h&&f.containerHeight===p?f:{containerWidth:h,containerHeight:p}})},[]),c=b.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var h=m=>{var g=m[0];if(g!=null){var{width:y,height:x}=g.contentRect;l(y,x)}},p=new ResizeObserver(h);p.observe(u),s.current=p}},[t,l]);return b.useEffect(()=>()=>{var u=s.current;u?.disconnect()},[l]),b.createElement(b.Fragment,null,b.createElement(mP,{width:a.containerWidth,height:a.containerHeight}),b.createElement("div",Kb({ref:c},e)))}),kPr=b.forwardRef((e,t)=>{var{width:r,height:n}=e,[s,a]=b.useState({containerWidth:O4(r),containerHeight:O4(n)}),i=b.useCallback((c,u)=>{a(d=>{var f=Math.round(c),h=Math.round(u);return d.containerWidth===f&&d.containerHeight===h?d:{containerWidth:f,containerHeight:h}})},[]),l=b.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();i(u,d)}},[t,i]);return b.createElement(b.Fragment,null,b.createElement(mP,{width:s.containerWidth,height:s.containerHeight}),b.createElement("div",Kb({ref:l},e)))}),_Pr=b.forwardRef((e,t)=>{var{width:r,height:n}=e;return b.createElement(b.Fragment,null,b.createElement(mP,{width:r,height:n}),b.createElement("div",Kb({ref:t},e)))}),EPr=b.forwardRef((e,t)=>{var{width:r,height:n}=e;return typeof r=="string"||typeof n=="string"?b.createElement(kPr,Kb({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?b.createElement(_Pr,Kb({},e,{width:r,height:n,ref:t})):b.createElement(b.Fragment,null,b.createElement(mP,{width:r,height:n}),b.createElement("div",Kb({ref:t},e)))});function CPr(e){return e?OPr:EPr}var jPr=b.forwardRef((e,t)=>{var{children:r,className:n,height:s,onClick:a,onContextMenu:i,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:h,onTouchEnd:p,onTouchMove:m,onTouchStart:g,style:y,width:x,responsive:w,dispatchTouchEvents:S=!0}=e,k=b.useRef(null),_=Vo(),[E,T]=b.useState(null),[j,N]=b.useState(null),I=yPr(),P=bhe(),R=P?.width>0?P.width:x,$=P?.height>0?P.height:s,M=b.useCallback(oe=>{I(oe),typeof t=="function"&&t(oe),T(oe),N(oe),oe!=null&&(k.current=oe)},[I,t,T,N]),z=b.useCallback(oe=>{_(dct(oe)),_(Yf({handler:a,reactEvent:oe}))},[_,a]),U=b.useCallback(oe=>{_(Zae(oe)),_(Yf({handler:u,reactEvent:oe}))},[_,u]),B=b.useCallback(oe=>{_(ilt()),_(Yf({handler:d,reactEvent:oe}))},[_,d]),H=b.useCallback(oe=>{_(Zae(oe)),_(Yf({handler:f,reactEvent:oe}))},[_,f]),W=b.useCallback(()=>{_(yct())},[_]),L=b.useCallback(()=>{_(vct())},[_]),Y=b.useCallback(oe=>{_(gct(oe.key))},[_]),q=b.useCallback(oe=>{_(Yf({handler:i,reactEvent:oe}))},[_,i]),D=b.useCallback(oe=>{_(Yf({handler:l,reactEvent:oe}))},[_,l]),Q=b.useCallback(oe=>{_(Yf({handler:c,reactEvent:oe}))},[_,c]),G=b.useCallback(oe=>{_(Yf({handler:h,reactEvent:oe}))},[_,h]),J=b.useCallback(oe=>{_(Yf({handler:g,reactEvent:oe}))},[_,g]),ae=b.useCallback(oe=>{S&&_(wct(oe)),_(Yf({handler:m,reactEvent:oe}))},[_,S,m]),re=b.useCallback(oe=>{_(Yf({handler:p,reactEvent:oe}))},[_,p]),se=CPr(w);return b.createElement(Elt.Provider,{value:E},b.createElement(Lbr.Provider,{value:j},b.createElement(se,{width:R??y?.width,height:$??y?.height,className:va("recharts-wrapper",n),style:vPr({position:"relative",cursor:"default",width:R,height:$},y),onClick:z,onContextMenu:q,onDoubleClick:D,onFocus:W,onBlur:L,onKeyDown:Y,onMouseDown:Q,onMouseEnter:U,onMouseLeave:B,onMouseMove:H,onMouseUp:G,onTouchEnd:re,onTouchMove:ae,onTouchStart:J,ref:M},b.createElement(SPr,null),r)))}),TPr=["width","height","responsive","children","className","style","compact","title","desc"];function NPr(e,t){if(e==null)return{};var r,n,s=APr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function APr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var IPr=b.forwardRef((e,t)=>{var{width:r,height:n,responsive:s,children:a,className:i,style:l,compact:c,title:u,desc:d}=e,f=NPr(e,TPr),h=ng(f);return c?b.createElement(b.Fragment,null,b.createElement(mP,{width:r,height:n}),b.createElement(uIe,{otherAttributes:h,title:u,desc:d},a)):b.createElement(jPr,{className:i,style:l,width:r,height:n,responsive:s??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},b.createElement(uIe,{otherAttributes:h,title:u,desc:d,ref:t},b.createElement(QAr,null,a)))});function Yae(){return Yae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yae.apply(null,arguments)}function fIe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function RPr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fIe(Object(r),!0).forEach(function(n){PPr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fIe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function PPr(e,t,r){return(t=MPr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MPr(e){var t=DPr(e,"string");return typeof t=="symbol"?t:t+""}function DPr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var LPr={top:5,right:5,bottom:5,left:5},$Pr=RPr({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:LPr,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Oct),FPr=b.forwardRef(function(t,r){var n,s=id(t.categoricalChartProps,$Pr),{chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,categoricalChartProps:u}=t,d={chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,eventEmitter:void 0};return b.createElement(aPr,{preloadedState:{options:d},reduxStoreName:(n=u.id)!==null&&n!==void 0?n:a},b.createElement(FAr,{chartData:u.data}),b.createElement(oPr,{layout:s.layout,margin:s.margin}),b.createElement(uPr,{throttleDelay:s.throttleDelay,throttledEvents:s.throttledEvents}),b.createElement(lPr,{baseValue:s.baseValue,accessibilityLayer:s.accessibilityLayer,barCategoryGap:s.barCategoryGap,maxBarSize:s.maxBarSize,stackOffset:s.stackOffset,barGap:s.barGap,barSize:s.barSize,syncId:s.syncId,syncMethod:s.syncMethod,className:s.className,reverseStackOrder:s.reverseStackOrder}),b.createElement(IPr,Yae({},s,{ref:r})))}),zPr=["axis"],BPr=b.forwardRef((e,t)=>b.createElement(FPr,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:zPr,tooltipPayloadSearcher:Zjr,categoricalChartProps:e,ref:t}));function UPr(e,t){const r=getComputedStyle(e),n=parseFloat(r.fontSize);return t*n}function VPr(e,t){const r=getComputedStyle(e.ownerDocument.body),n=parseFloat(r.fontSize);return t*n}function qPr(e){return e/100*window.innerHeight}function HPr(e){return e/100*window.innerWidth}function QPr(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function HT({groupSize:e,panelElement:t,styleProp:r}){let n;const[s,a]=QPr(r);switch(a){case"%":{n=s/100*e;break}case"px":{n=s;break}case"rem":{n=VPr(t,s);break}case"em":{n=UPr(t,s);break}case"vh":{n=qPr(s);break}case"vw":{n=HPr(s);break}}return n}function Vu(e){return parseFloat(e.toFixed(3))}function Y_({group:e}){const{orientation:t,panels:r}=e;return r.reduce((n,s)=>(n+=t==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,n),0)}function Xae(e){const{panels:t}=e,r=Y_({group:e});return r===0?t.map(n=>({groupResizeBehavior:n.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:n.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:n.panelConstraints.disabled,minSize:0,maxSize:100,panelId:n.id})):t.map(n=>{const{element:s,panelConstraints:a}=n;let i=0;if(a.collapsedSize!==void 0){const d=HT({groupSize:r,panelElement:s,styleProp:a.collapsedSize});i=Vu(d/r*100)}let l;if(a.defaultSize!==void 0){const d=HT({groupSize:r,panelElement:s,styleProp:a.defaultSize});l=Vu(d/r*100)}let c=0;if(a.minSize!==void 0){const d=HT({groupSize:r,panelElement:s,styleProp:a.minSize});c=Vu(d/r*100)}let u=100;if(a.maxSize!==void 0){const d=HT({groupSize:r,panelElement:s,styleProp:a.maxSize});u=Vu(d/r*100)}return{groupResizeBehavior:a.groupResizeBehavior,collapsedSize:i,collapsible:a.collapsible===!0,defaultSize:l,disabled:a.disabled,minSize:c,maxSize:u,panelId:n.id}})}function Ea(e,t="Assertion error"){if(!e)throw Error(t)}function Kae(e,t){return Array.from(t).sort(e==="horizontal"?WPr:GPr)}function WPr(e,t){const r=e.element.offsetLeft-t.element.offsetLeft;return r!==0?r:e.element.offsetWidth-t.element.offsetWidth}function GPr(e,t){const r=e.element.offsetTop-t.element.offsetTop;return r!==0?r:e.element.offsetHeight-t.element.offsetHeight}function _ct(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Ect(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function ZPr({orientation:e,rects:t,targetRect:r}){const n={x:r.x+r.width/2,y:r.y+r.height/2};let s,a=Number.MAX_VALUE;for(const i of t){const{x:l,y:c}=Ect(n,i),u=e==="horizontal"?l:c;u<a&&(a=u,s=i)}return Ea(s,"No rect found"),s}let HD;function YPr(){return HD===void 0&&(typeof matchMedia=="function"?HD=!!matchMedia("(pointer:coarse)").matches:HD=!1),HD}function Cct(e){const{element:t,orientation:r,panels:n,separators:s}=e,a=Kae(r,Array.from(t.children).filter(_ct).map(m=>({element:m}))).map(({element:m})=>m),i=[];let l=!1,c=!1,u=-1,d=-1,f=0,h,p=[];{let m=-1;for(const g of a)g.hasAttribute("data-panel")&&(m++,g.ariaDisabled===null&&(f++,u===-1&&(u=m),d=m))}if(f>1){let m=-1;for(const g of a)if(g.hasAttribute("data-panel")){m++;const y=n.find(x=>x.element===g);if(y){if(h){const x=h.element.getBoundingClientRect(),w=g.getBoundingClientRect();let S;if(c){const k=r==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),_=r==="horizontal"?new DOMRect(w.left,w.top,0,w.height):new DOMRect(w.left,w.top,w.width,0);switch(p.length){case 0:{S=[k,_];break}case 1:{const E=p[0],T=ZPr({orientation:r,rects:[x,w],targetRect:E.element.getBoundingClientRect()});S=[E,T===x?_:k];break}default:{S=p;break}}}else p.length?S=p:S=[r==="horizontal"?new DOMRect(x.right,w.top,w.left-x.right,w.height):new DOMRect(w.left,x.bottom,w.width,w.top-x.bottom)];for(const k of S){let _="width"in k?k:k.element.getBoundingClientRect();const E=YPr()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(_.width<E){const j=E-_.width;_=new DOMRect(_.x-j/2,_.y,_.width+j,_.height)}if(_.height<E){const j=E-_.height;_=new DOMRect(_.x,_.y-j/2,_.width,_.height+j)}const T=m<=u||m>d;!l&&!T&&i.push({group:e,groupSize:Y_({group:e}),panels:[h,y],separator:"width"in k?void 0:k,rect:_}),l=!1}}c=!1,h=y,p=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(l=!0);const y=s.find(x=>x.element===g);y?p.push(y):(h=void 0,p=[])}else c=!0}return i}let jct=class{#e={};addListener(t,r){const n=this.#e[t];return n===void 0?this.#e[t]=[r]:n.includes(r)||n.push(r),()=>{this.removeListener(t,r)}}emit(t,r){const n=this.#e[t];if(n!==void 0)if(n.length===1)n[0].call(null,r);else{let s=!1,a=null;const i=Array.from(n);for(let l=0;l<i.length;l++){const c=i[l];try{c.call(null,r)}catch(u){a===null&&(s=!0,a=u)}}if(s)throw a}}removeAllListeners(){this.#e={}}removeListener(t,r){const n=this.#e[t];if(n!==void 0){const s=n.indexOf(r);s>=0&&n.splice(s,1)}}},$m=new Map;const Tct=new jct;function XPr(e){$m=new Map($m),$m.delete(e)}function hIe(e,t){for(const[r]of $m)if(r.id===e)return r}function Jb(e,t){for(const[r,n]of $m)if(r.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function w1(){return $m}function Ppe(e,t){return Tct.addListener("groupChange",r=>{r.group.id===e&&t(r)})}function tv(e,t){const r=$m.get(e);$m=new Map($m),$m.set(e,t),Tct.emit("groupChange",{group:e,prev:r,next:t})}function KPr(e,t,r){let n,s={x:1/0,y:1/0};for(const a of t){const i=Ect(r,a.rect);switch(e){case"horizontal":{i.x<=s.x&&(n=a,s=i);break}case"vertical":{i.y<=s.y&&(n=a,s=i);break}}}return n?{distance:s,hitRegion:n}:void 0}function JPr(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function eMr(e,t){if(e===t)throw new Error("Cannot compare node with itself");const r={a:gIe(e),b:gIe(t)};let n;for(;r.a.at(-1)===r.b.at(-1);)n=r.a.pop(),r.b.pop();Ea(n,"Stacking order can only be calculated for elements with a common ancestor");const s={a:mIe(pIe(r.a)),b:mIe(pIe(r.b))};if(s.a===s.b){const a=n.childNodes,i={a:r.a.at(-1),b:r.b.at(-1)};let l=a.length;for(;l--;){const c=a[l];if(c===i.a)return 1;if(c===i.b)return-1}}return Math.sign(s.a-s.b)}const tMr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function rMr(e){const t=getComputedStyle(Nct(e)??e).display;return t==="flex"||t==="inline-flex"}function nMr(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||rMr(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||tMr.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function pIe(e){let t=e.length;for(;t--;){const r=e[t];if(Ea(r,"Missing node"),nMr(r))return r}return null}function mIe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function gIe(e){const t=[];for(;e;)t.push(e),e=Nct(e);return t}function Nct(e){const{parentNode:t}=e;return JPr(t)?t.host:t}function sMr(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function aMr({groupElement:e,hitRegion:t,pointerEventTarget:r}){if(!_ct(r)||r.contains(e)||e.contains(r))return!0;if(eMr(r,e)>0){let n=r;for(;n;){if(n.contains(e))return!0;if(sMr(n.getBoundingClientRect(),t))return!1;n=n.parentElement}}return!0}function Mpe(e,t){const r=[];return t.forEach((n,s)=>{if(s.disabled)return;const a=Cct(s),i=KPr(s.orientation,a,{x:e.clientX,y:e.clientY});i&&i.distance.x<=0&&i.distance.y<=0&&aMr({groupElement:s.element,hitRegion:i.hitRegion.rect,pointerEventTarget:e.target})&&r.push(i.hitRegion)}),r}function iMr(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function Hc(e,t,r=0){return Math.abs(Vu(e)-Vu(t))<=r}function pm(e,t){return Hc(e,t)?0:e>t?1:-1}function gk({overrideDisabledPanels:e,panelConstraints:t,prevSize:r,size:n}){const{collapsedSize:s=0,collapsible:a,disabled:i,maxSize:l=100,minSize:c=0}=t;if(i&&!e)return r;if(pm(n,c)<0)if(a){const u=(s+c)/2;pm(n,u)<0?n=s:n=c}else n=c;return n=Math.min(l,n),n=Vu(n),n}function cI({delta:e,initialLayout:t,panelConstraints:r,pivotIndices:n,prevLayout:s,trigger:a}){if(Hc(e,0))return t;const i=a==="imperative-api",l=Object.values(t),c=Object.values(s),u=[...l],[d,f]=n;Ea(d!=null,"Invalid first pivot index"),Ea(f!=null,"Invalid second pivot index");let h=0;switch(a){case"keyboard":{{const g=e<0?f:d,y=r[g];Ea(y,`Panel constraints not found for index ${g}`);const{collapsedSize:x=0,collapsible:w,minSize:S=0}=y;if(w){const k=l[g];if(Ea(k!=null,`Previous layout not found for panel index ${g}`),Hc(k,x)){const _=S-k;pm(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}{const g=e<0?d:f,y=r[g];Ea(y,`No panel constraints found for index ${g}`);const{collapsedSize:x=0,collapsible:w,minSize:S=0}=y;if(w){const k=l[g];if(Ea(k!=null,`Previous layout not found for panel index ${g}`),Hc(k,S)){const _=k-x;pm(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}break}default:{const g=e<0?f:d,y=r[g];Ea(y,`Panel constraints not found for index ${g}`);const x=l[g],{collapsible:w,collapsedSize:S,minSize:k}=y;if(w&&pm(x,k)<0)if(e>0){const _=k-S,E=_/2,T=x+e;pm(T,k)<0&&(e=pm(e,E)<=0?0:_)}else{const _=k-S,E=100-_/2,T=x-e;pm(T,k)<0&&(e=pm(100+e,E)>0?0:-_)}break}}{const g=e<0?1:-1;let y=e<0?f:d,x=0;for(;;){const S=l[y];Ea(S!=null,`Previous layout not found for panel index ${y}`);const k=gk({overrideDisabledPanels:i,panelConstraints:r[y],prevSize:S,size:100})-S;if(x+=k,y+=g,y<0||y>=r.length)break}const w=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-w:w}{let g=e<0?d:f;for(;g>=0&&g<r.length;){const y=Math.abs(e)-Math.abs(h),x=l[g];Ea(x!=null,`Previous layout not found for panel index ${g}`);const w=x-y,S=gk({overrideDisabledPanels:i,panelConstraints:r[g],prevSize:x,size:w});if(!Hc(x,S)&&(h+=x-S,u[g]=S,h.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(iMr(c,u))return s;{const g=e<0?f:d,y=l[g];Ea(y!=null,`Previous layout not found for panel index ${g}`);const x=y+h,w=gk({overrideDisabledPanels:i,panelConstraints:r[g],prevSize:y,size:x});if(u[g]=w,!Hc(w,x)){let S=x-w,k=e<0?f:d;for(;k>=0&&k<r.length;){const _=u[k];Ea(_!=null,`Previous layout not found for panel index ${k}`);const E=_+S,T=gk({overrideDisabledPanels:i,panelConstraints:r[k],prevSize:_,size:E});if(Hc(_,T)||(S-=T-_,u[k]=T),Hc(S,0))break;e>0?k--:k++}}}const p=Object.values(u).reduce((g,y)=>y+g,0);if(!Hc(p,100,.1))return s;const m=Object.keys(s);return u.reduce((g,y,x)=>(g[m[x]]=y,g),{})}function RS(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(t[r]===void 0||pm(e[r],t[r])!==0)return!1;return!0}function PS({layout:e,panelConstraints:t}){const r=Object.values(e),n=[...r],s=n.reduce((l,c)=>l+c,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(l=>`${l}%`).join(", ")}`);if(!Hc(s,100)&&n.length>0)for(let l=0;l<t.length;l++){const c=n[l];Ea(c!=null,`No layout data found for index ${l}`);const u=100/s*c;n[l]=u}let a=0;for(let l=0;l<t.length;l++){const c=r[l];Ea(c!=null,`No layout data found for index ${l}`);const u=n[l];Ea(u!=null,`No layout data found for index ${l}`);const d=gk({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:c,size:u});u!=d&&(a+=u-d,n[l]=d)}if(!Hc(a,0))for(let l=0;l<t.length;l++){const c=n[l];Ea(c!=null,`No layout data found for index ${l}`);const u=c+a,d=gk({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:c,size:u});if(c!==d&&(a-=d-c,n[l]=d,Hc(a,0)))break}const i=Object.keys(e);return n.reduce((l,c,u)=>(l[i[u]]=c,l),{})}function Act({groupId:e,panelId:t}){const r=()=>{const l=w1();for(const[c,{defaultLayoutDeferred:u,derivedPanelConstraints:d,layout:f,groupSize:h,separatorToPanels:p}]of l)if(c.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:c,groupSize:h,layout:f,separatorToPanels:p};throw Error(`Group ${e} not found`)},n=()=>{const l=r().derivedPanelConstraints.find(c=>c.panelId===t);if(l!==void 0)return l;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{const l=r().group.panels.find(c=>c.id===t);if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},a=()=>{const l=r().layout[t];if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},i=l=>{const c=a();if(l===c)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:f,groupSize:h,layout:p,separatorToPanels:m}=r(),g=f.panels.findIndex(S=>S.id===t),y=g===f.panels.length-1,x=cI({delta:y?c-l:l-c,initialLayout:p,panelConstraints:d,pivotIndices:y?[g-1,g]:[g,g+1],prevLayout:p,trigger:"imperative-api"}),w=PS({layout:x,panelConstraints:d});RS(p,w)||tv(f,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:h,layout:w,separatorToPanels:m})};return{collapse:()=>{const{collapsible:l,collapsedSize:c}=n(),{mutableValues:u}=s(),d=a();l&&d!==c&&(u.expandToSize=d,i(c))},expand:()=>{const{collapsible:l,collapsedSize:c,minSize:u}=n(),{mutableValues:d}=s(),f=a();if(l&&f===c){let h=d.expandToSize??u;h===0&&(h=1),i(h)}},getSize:()=>{const{group:l}=r(),c=a(),{element:u}=s(),d=l.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:c,inPixels:d}},isCollapsed:()=>{const{collapsible:l,collapsedSize:c}=n(),u=a();return l&&Hc(c,u)},resize:l=>{const{group:c}=r(),{element:u}=s(),d=Y_({group:c}),f=HT({groupSize:d,panelElement:u,styleProp:l}),h=Vu(f/d*100);i(h)}}}function yIe(e){if(e.defaultPrevented)return;const t=w1();Mpe(e,t).forEach(r=>{if(r.separator){const n=r.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(n){const s=n.panelConstraints.defaultSize,a=Act({groupId:r.group.id,panelId:n.id});a&&s!==void 0&&(a.resize(s),e.preventDefault())}}})}function S$(e){const t=w1();for(const[r]of t)if(r.separators.some(n=>n.element===e))return r;throw Error("Could not find parent Group for separator element")}function Ict({groupId:e}){const t=()=>{const r=w1();for(const[n,s]of r)if(n.id===e)return{group:n,...s};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:r,layout:n}=t();return r?{}:n},setLayout(r){const{defaultLayoutDeferred:n,derivedPanelConstraints:s,group:a,groupSize:i,layout:l,separatorToPanels:c}=t(),u=PS({layout:r,panelConstraints:s});return n?l:(RS(l,u)||tv(a,{defaultLayoutDeferred:n,derivedPanelConstraints:s,groupSize:i,layout:u,separatorToPanels:c}),u)}}}function V0(e,t){const r=S$(e),n=Jb(r.id,!0),s=r.separators.find(d=>d.element===e);Ea(s,"Matching separator not found");const a=n.separatorToPanels.get(s);Ea(a,"Matching panels not found");const i=a.map(d=>r.panels.indexOf(d)),l=Ict({groupId:r.id}).getLayout(),c=cI({delta:t,initialLayout:l,panelConstraints:n.derivedPanelConstraints,pivotIndices:i,prevLayout:l,trigger:"keyboard"}),u=PS({layout:c,panelConstraints:n.derivedPanelConstraints});RS(l,u)||tv(r,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:u,separatorToPanels:n.separatorToPanels})}function vIe(e){if(e.defaultPrevented)return;const t=e.currentTarget,r=S$(t);if(!r.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),r.orientation==="vertical"&&V0(t,5);break}case"ArrowLeft":{e.preventDefault(),r.orientation==="horizontal"&&V0(t,-5);break}case"ArrowRight":{e.preventDefault(),r.orientation==="horizontal"&&V0(t,5);break}case"ArrowUp":{e.preventDefault(),r.orientation==="vertical"&&V0(t,-5);break}case"End":{e.preventDefault(),V0(t,100);break}case"Enter":{e.preventDefault();const n=S$(t),s=Jb(n.id,!0),{derivedPanelConstraints:a,layout:i,separatorToPanels:l}=s,c=n.separators.find(h=>h.element===t);Ea(c,"Matching separator not found");const u=l.get(c);Ea(u,"Matching panels not found");const d=u[0],f=a.find(h=>h.panelId===d.id);if(Ea(f,"Panel metadata not found"),f.collapsible){const h=i[d.id],p=f.collapsedSize===h?n.mutableState.expandedPanelSizes[d.id]??f.minSize:f.collapsedSize;V0(t,p-h)}break}case"F6":{e.preventDefault();const n=S$(t).separators.map(i=>i.element),s=Array.from(n).findIndex(i=>i===e.currentTarget);Ea(s!==null,"Index not found");const a=e.shiftKey?s>0?s-1:n.length-1:s+1<n.length?s+1:0;n[a].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),V0(t,-100);break}}}let e_={cursorFlags:0,state:"inactive"};const Dpe=new jct;function MS(){return e_}function oMr(e){return Dpe.addListener("change",e)}function lMr(e){const t=e_,r={...e_};r.cursorFlags=e,e_=r,Dpe.emit("change",{prev:t,next:r})}function t_(e){const t=e_;e_=e,Dpe.emit("change",{prev:t,next:e})}function bIe(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=w1(),r=Mpe(e,t),n=new Map;let s=!1;r.forEach(a=>{a.separator&&(s||(s=!0,a.separator.element.focus({preventScroll:!0})));const i=t.get(a.group);i&&n.set(a.group,i.layout)}),t_({cursorFlags:0,hitRegions:r,initialLayoutMap:n,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),r.length&&e.preventDefault()}const cMr=e=>e,KH=()=>{},Rct=1,Pct=2,Mct=4,Dct=8,xIe=3,wIe=12;let QD;function SIe(){return QD===void 0&&(QD=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(QD=!0)),QD}function uMr({cursorFlags:e,groups:t,state:r}){let n=0,s=0;switch(r){case"active":case"hover":t.forEach(a=>{if(!a.mutableState.disableCursor)switch(a.orientation){case"horizontal":{n++;break}case"vertical":{s++;break}}})}if(!(n===0&&s===0)){switch(r){case"active":{if(e&&SIe()){const a=(e&Rct)!==0,i=(e&Pct)!==0,l=(e&Mct)!==0,c=(e&Dct)!==0;if(a)return l?"se-resize":c?"ne-resize":"e-resize";if(i)return l?"sw-resize":c?"nw-resize":"w-resize";if(l)return"s-resize";if(c)return"n-resize"}break}}return SIe()?n>0&&s>0?"move":n>0?"ew-resize":"ns-resize":n>0&&s>0?"grab":n>0?"col-resize":"row-resize"}}const OIe=new WeakMap;function Lpe(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:r}=OIe.get(e)??{};r===void 0&&(r=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(r));const n=MS();switch(n.state){case"active":case"hover":{const s=uMr({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(i=>i.group),state:n.state}),a=`*, *:hover {cursor: ${s} !important; }`;if(t===a)return;t=a,s?r.cssRules.length===0?r.insertRule(a):r.replaceSync(a):r.cssRules.length===1&&r.deleteRule(0);break}case"inactive":{t=void 0,r.cssRules.length===1&&r.deleteRule(0);break}}OIe.set(e,{prevStyle:t,styleSheet:r})}function Lct({document:e,event:t,hitRegions:r,initialLayoutMap:n,mountedGroups:s,pointerDownAtPoint:a,prevCursorFlags:i}){let l=0;r.forEach(u=>{const{group:d,groupSize:f}=u,{orientation:h,panels:p}=d,{disableCursor:m}=d.mutableState;let g=0;a?h==="horizontal"?g=(t.clientX-a.x)/f*100:g=(t.clientY-a.y)/f*100:h==="horizontal"?g=t.clientX<0?-100:100:g=t.clientY<0?-100:100;const y=n.get(d),x=s.get(d);if(!y||!x)return;const{defaultLayoutDeferred:w,derivedPanelConstraints:S,groupSize:k,layout:_,separatorToPanels:E}=x;if(S&&_&&E){const T=cI({delta:g,initialLayout:y,panelConstraints:S,pivotIndices:u.panels.map(j=>p.indexOf(j)),prevLayout:_,trigger:"mouse-or-touch"});if(RS(T,_)){if(g!==0&&!m)switch(h){case"horizontal":{l|=g<0?Rct:Pct;break}case"vertical":{l|=g<0?Mct:Dct;break}}}else tv(u.group,{defaultLayoutDeferred:w,derivedPanelConstraints:S,groupSize:k,layout:T,separatorToPanels:E})}});let c=0;t.movementX===0?c|=i&xIe:c|=l&xIe,t.movementY===0?c|=i&wIe:c|=l&wIe,lMr(c),Lpe(e)}function kIe(e){const t=w1(),r=MS();r.state==="active"&&Lct({document:e.currentTarget,event:e,hitRegions:r.hitRegions,initialLayoutMap:r.initialLayoutMap,mountedGroups:t,prevCursorFlags:r.cursorFlags})}function _Ie(e){if(e.defaultPrevented)return;const t=MS(),r=w1();switch(t.state){case"active":{if(e.buttons===0){t_({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(n=>{const s=Jb(n.group.id,!0);tv(n.group,s)});return}Lct({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:r,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const n=Mpe(e,r);n.length===0?t.state!=="inactive"&&t_({cursorFlags:0,state:"inactive"}):t_({cursorFlags:0,hitRegions:n,state:"hover"}),Lpe(e.currentTarget);break}}}function EIe(e){e.relatedTarget instanceof HTMLIFrameElement&&MS().state==="hover"&&t_({cursorFlags:0,state:"inactive"})}function CIe(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=MS();t.state==="active"&&(t_({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Lpe(e.currentTarget),t.hitRegions.forEach(r=>{const n=Jb(r.group.id,!0);tv(r.group,n)}),e.preventDefault()))}function jIe(e){let t=0,r=0;const n={};for(const a of e)if(a.defaultSize!==void 0){t++;const i=Vu(a.defaultSize);r+=i,n[a.panelId]=i}else n[a.panelId]=void 0;const s=e.length-t;if(s!==0){const a=Vu((100-r)/s);for(const i of e)i.defaultSize===void 0&&(n[i.panelId]=a)}return n}function dMr(e,t,r){if(!r[0])return;const n=e.panels.find(c=>c.element===t);if(!n||!n.onResize)return;const s=Y_({group:e}),a=e.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,i=n.mutableValues.prevSize,l={asPercentage:Vu(a/s*100),inPixels:a};n.mutableValues.prevSize=l,n.onResize(l,n.id,i)}function fMr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function hMr({group:e,nextGroupSize:t,prevGroupSize:r,prevLayout:n}){if(r<=0||t<=0||r===t)return n;let s=0,a=0,i=!1;const l=new Map,c=[];for(const f of e.panels){const h=n[f.id]??0;if(f.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){i=!0;const p=h/100*r,m=Vu(p/t*100);l.set(f.id,m),s+=m}else c.push(f.id),a+=h}if(!i||c.length===0)return n;const u=100-s,d={...n};if(l.forEach((f,h)=>{d[h]=f}),a>0)for(const f of c){const h=n[f]??0;d[f]=Vu(h/a*u)}else{const f=Vu(u/c.length);for(const h of c)d[h]=f}return d}function pMr(e,t){const r=e.map(s=>s.id),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r)if(!n.includes(s))return!1;return!0}const EO=new Map;function mMr(e){let t=!0;Ea(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const r=e.element.ownerDocument.defaultView.ResizeObserver,n=new Set,s=new Set,a=new r(m=>{for(const g of m){const{borderBoxSize:y,target:x}=g;if(x===e.element){if(t){const w=Y_({group:e});if(w===0)return;const S=Jb(e.id);if(!S)return;const k=Xae(e),_=S.defaultLayoutDeferred?jIe(k):S.layout,E=hMr({group:e,nextGroupSize:w,prevGroupSize:S.groupSize,prevLayout:_}),T=PS({layout:E,panelConstraints:k});if(!S.defaultLayoutDeferred&&RS(S.layout,T)&&fMr(S.derivedPanelConstraints,k)&&S.groupSize===w)return;tv(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:k,groupSize:w,layout:T,separatorToPanels:S.separatorToPanels})}}else dMr(e,x,y)}});a.observe(e.element),e.panels.forEach(m=>{Ea(!n.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),n.add(m.id),m.onResize&&a.observe(m.element)});const i=Y_({group:e}),l=Xae(e),c=e.panels.map(({id:m})=>m).join(",");let u=e.mutableState.defaultLayout;u&&(pMr(e.panels,u)||(u=void 0));const d=e.mutableState.layouts[c]??u??jIe(l),f=PS({layout:d,panelConstraints:l}),h=e.element.ownerDocument;EO.set(h,(EO.get(h)??0)+1);const p=new Map;return Cct(e).forEach(m=>{m.separator&&p.set(m.separator,m.panels)}),tv(e,{defaultLayoutDeferred:i===0,derivedPanelConstraints:l,groupSize:i,layout:f,separatorToPanels:p}),e.separators.forEach(m=>{Ea(!s.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),s.add(m.id),m.element.addEventListener("keydown",vIe)}),EO.get(h)===1&&(h.addEventListener("dblclick",yIe,!0),h.addEventListener("pointerdown",bIe,!0),h.addEventListener("pointerleave",kIe),h.addEventListener("pointermove",_Ie),h.addEventListener("pointerout",EIe),h.addEventListener("pointerup",CIe,!0)),function(){t=!1,EO.set(h,Math.max(0,(EO.get(h)??0)-1)),XPr(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",vIe)}),EO.get(h)||(h.removeEventListener("dblclick",yIe,!0),h.removeEventListener("pointerdown",bIe,!0),h.removeEventListener("pointerleave",kIe),h.removeEventListener("pointermove",_Ie),h.removeEventListener("pointerout",EIe),h.removeEventListener("pointerup",CIe,!0)),a.disconnect()}}function gMr(){const[e,t]=b.useState({}),r=b.useCallback(()=>t({}),[]);return[e,r]}function $pe(e){const t=b.useId();return`${e??t}`}const S1=typeof window<"u"?b.useLayoutEffect:b.useEffect;function TN(e){const t=b.useRef(e);return S1(()=>{t.current=e},[e]),b.useCallback((...r)=>t.current?.(...r),[t])}function Fpe(...e){return TN(t=>{e.forEach(r=>{if(r)switch(typeof r){case"function":{r(t);break}case"object":{r.current=t;break}}})})}function zpe(e){const t=b.useRef({...e});return S1(()=>{for(const r in e)t.current[r]=e[r]},[e]),t.current}const $ct=b.createContext(null);function yMr(e,t){const r=b.useRef({getLayout:()=>({}),setLayout:cMr});b.useImperativeHandle(t,()=>r.current,[]),S1(()=>{Object.assign(r.current,Ict({groupId:e}))})}function O9({children:e,className:t,defaultLayout:r,disableCursor:n,disabled:s,elementRef:a,groupRef:i,id:l,onLayoutChange:c,onLayoutChanged:u,orientation:d="horizontal",resizeTargetMinimumSize:f={coarse:20,fine:10},style:h,...p}){const m=b.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=TN(P=>{RS(m.current.onLayoutChange,P)||(m.current.onLayoutChange=P,c?.(P))}),y=TN(P=>{RS(m.current.onLayoutChanged,P)||(m.current.onLayoutChanged=P,u?.(P))}),x=$pe(l),w=b.useRef(null),[S,k]=gMr(),_=b.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:f,separators:[]}),E=Fpe(w,a);yMr(x,i);const T=TN((P,R)=>{const $=MS(),M=hIe(P),z=Jb(P);if(z){let U=!1;return $.state==="active"&&(U=$.hitRegions.some(B=>B.group===M)),{flexGrow:z.layout[R]??1,pointerEvents:U?"none":void 0}}return{flexGrow:r?.[R]??1}}),j=zpe({defaultLayout:r,disableCursor:n}),N=b.useMemo(()=>({get disableCursor(){return!!j.disableCursor},getPanelStyles:T,id:x,orientation:d,registerPanel:P=>{const R=_.current;return R.panels=Kae(d,[...R.panels,P]),k(),()=>{R.panels=R.panels.filter($=>$!==P),k()}},registerSeparator:P=>{const R=_.current;return R.separators=Kae(d,[...R.separators,P]),k(),()=>{R.separators=R.separators.filter($=>$!==P),k()}},togglePanelDisabled:(P,R)=>{const $=_.current.panels.find(U=>U.id===P);$&&($.panelConstraints.disabled=R);const M=hIe(x),z=Jb(x);M&&z&&tv(M,{...z,derivedPanelConstraints:Xae(M)})},toggleSeparatorDisabled:(P,R)=>{const $=_.current.separators.find(M=>M.id===P);$&&($.disabled=R)}}),[T,x,k,d,j]),I=b.useRef(null);return S1(()=>{const P=w.current;if(P===null)return;const R=_.current;let $;if(j.defaultLayout!==void 0&&Object.keys(j.defaultLayout).length===R.panels.length){$={};for(const L of R.panels){const Y=j.defaultLayout[L.id];Y!==void 0&&($[L.id]=Y)}}const M={disabled:!!s,element:P,id:x,mutableState:{defaultLayout:$,disableCursor:!!j.disableCursor,expandedPanelSizes:_.current.lastExpandedPanelSizes,layouts:_.current.layouts},orientation:d,panels:R.panels,resizeTargetMinimumSize:R.resizeTargetMinimumSize,separators:R.separators};I.current=M;const z=mMr(M),{defaultLayoutDeferred:U,derivedPanelConstraints:B,layout:H}=Jb(M.id,!0);!U&&B.length>0&&(g(H),y(H));const W=Ppe(x,L=>{const{defaultLayoutDeferred:Y,derivedPanelConstraints:q,layout:D}=L.next;if(Y||q.length===0)return;const Q=M.panels.map(({id:J})=>J).join(",");M.mutableState.layouts[Q]=D,q.forEach(J=>{if(J.collapsible){const{layout:ae}=L.prev??{};if(ae){const re=Hc(J.collapsedSize,D[J.panelId]),se=Hc(J.collapsedSize,ae[J.panelId]);re&&!se&&(M.mutableState.expandedPanelSizes[J.panelId]=ae[J.panelId])}}});const G=MS().state!=="active";g(D),G&&y(D)});return()=>{I.current=null,z(),W()}},[s,x,y,g,d,S,j]),b.useEffect(()=>{const P=I.current;P&&(P.mutableState.defaultLayout=r,P.mutableState.disableCursor=!!n)}),o.jsx($ct.Provider,{value:N,children:o.jsx("div",{...p,className:t,"data-group":!0,"data-testid":x,id:x,ref:E,style:{height:"100%",width:"100%",overflow:"hidden",...h,display:"flex",flexDirection:d==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:d==="horizontal"?"pan-y":"pan-x"},children:e})})}O9.displayName="Group";function JH(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function Bpe({debounceSaveMs:e=100,panelIds:t,storage:r=localStorage,...n}){const s=t!==void 0,a="id"in n?n.id:n.groupId,i=JH(a,t??[]),l=b.useSyncExternalStore(vMr,()=>r.getItem(i),()=>r.getItem(i)),c=b.useMemo(()=>l?JSON.parse(l):void 0,[l]),u=b.useRef(null),d=b.useCallback(()=>{const p=u.current;p&&(u.current=null,clearTimeout(p))},[]);b.useLayoutEffect(()=>()=>{d()},[d]);const f=b.useCallback(p=>{d();let m;s?m=JH(a,Object.keys(p)):m=JH(a,[]);try{r.setItem(m,JSON.stringify(p))}catch(g){console.error(g)}},[d,s,a,r]),h=b.useCallback(p=>{d(),e===0?f(p):u.current=setTimeout(()=>{f(p)},e)},[d,e,f]);return{defaultLayout:c,onLayoutChange:h,onLayoutChanged:f}}function vMr(){return function(){}}function Upe(){const e=b.useContext($ct);return Ea(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function bMr(e,t){const{id:r}=Upe(),n=b.useRef({collapse:KH,expand:KH,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:KH});b.useImperativeHandle(t,()=>n.current,[]),S1(()=>{Object.assign(n.current,Act({groupId:r,panelId:e}))})}function X_({children:e,className:t,collapsedSize:r="0%",collapsible:n=!1,defaultSize:s,disabled:a,elementRef:i,groupResizeBehavior:l="preserve-relative-size",id:c,maxSize:u="100%",minSize:d="0%",onResize:f,panelRef:h,style:p,...m}){const g=!!c,y=$pe(c),x=zpe({disabled:a}),w=b.useRef(null),S=Fpe(w,i),{getPanelStyles:k,id:_,orientation:E,registerPanel:T,togglePanelDisabled:j}=Upe(),N=f!==null,I=TN((R,$,M)=>{f?.(R,c,M)});S1(()=>{const R=w.current;if(R!==null){const $={element:R,id:y,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:N?I:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:r,collapsible:n,defaultSize:s,disabled:x.disabled,maxSize:u,minSize:d}};return T($)}},[l,r,n,s,N,y,g,u,d,I,T,x]),b.useEffect(()=>{j(y,!!a)},[a,y,j]),bMr(y,h);const P=b.useSyncExternalStore(R=>Ppe(_,R),()=>JSON.stringify(k(_,y)),()=>JSON.stringify(k(_,y)));return o.jsx("div",{...m,"aria-disabled":a||void 0,"data-panel":!0,"data-testid":y,id:y,ref:S,style:{...xMr,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(P)},children:o.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:E==="horizontal"?"pan-y":"pan-x"},children:e})})}X_.displayName="Panel";const xMr={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function wMr(){return b.useRef(null)}function SMr({layout:e,panelConstraints:t,panelId:r,panelIndex:n}){let s,a;const i=e[r],l=t.find(c=>c.panelId===r);if(l){const c=l.maxSize,u=l.collapsible?l.collapsedSize:l.minSize,d=[n,n+1];a=PS({layout:cI({delta:u-i,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[r],s=PS({layout:cI({delta:c-i,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[r]}return{valueControls:r,valueMax:s,valueMin:a,valueNow:i}}function Fct({children:e,className:t,disabled:r,elementRef:n,id:s,style:a,...i}){const l=$pe(s),c=zpe({disabled:r}),[u,d]=b.useState({}),[f,h]=b.useState("inactive"),p=b.useRef(null),m=Fpe(p,n),{disableCursor:g,id:y,orientation:x,registerSeparator:w,toggleSeparatorDisabled:S}=Upe(),k=x==="horizontal"?"vertical":"horizontal";S1(()=>{const E=p.current;if(E!==null){const T={disabled:c.disabled,element:E,id:l},j=w(T),N=oMr(P=>{h(P.next.state!=="inactive"&&P.next.hitRegions.some(R=>R.separator===T)?P.next.state:"inactive")}),I=Ppe(y,P=>{const{derivedPanelConstraints:R,layout:$,separatorToPanels:M}=P.next,z=M.get(T);if(z){const U=z[0],B=z.indexOf(U);d(SMr({layout:$,panelConstraints:R,panelId:U.id,panelIndex:B}))}});return()=>{N(),I(),j()}}},[y,l,w,c]),b.useEffect(()=>{S(l,!!r)},[r,l,S]);let _;return r&&!g&&(_="not-allowed"),o.jsx("div",{...i,"aria-controls":u.valueControls,"aria-disabled":r||void 0,"aria-orientation":k,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":r?"disabled":f,"data-testid":l,id:l,ref:m,role:"separator",style:{flexBasis:"auto",cursor:_,...a,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:r?void 0:0})}Fct.displayName="Separator";var O1=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(){}},OMr={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},kMr=class{#e=OMr;#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)}},Nw=new kMr;function _Mr(e){setTimeout(e,0)}var DS=typeof window>"u"||"Deno"in globalThis;function uc(){}function EMr(e,t){return typeof e=="function"?e(t):e}function Jae(e){return typeof e=="number"&&e>=0&&e!==1/0}function zct(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ex(e,t){return typeof e=="function"?e(t):e}function Jf(e,t){return typeof e=="function"?e(t):e}function TIe(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:a,queryKey:i,stale:l}=e;if(i){if(n){if(t.queryHash!==Vpe(i,t.options))return!1}else if(!uI(t.queryKey,i))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||a&&!a(t))}function NIe(e,t){const{exact:r,status:n,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(LS(t.options.mutationKey)!==LS(a))return!1}else if(!uI(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Vpe(e,t){return(t?.queryKeyHashFn||LS)(e)}function LS(e){return JSON.stringify(e,(t,r)=>eie(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function uI(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>uI(e[r],t[r])):!1}var CMr=Object.prototype.hasOwnProperty;function qpe(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=AIe(e)&&AIe(t);if(!n&&!(eie(e)&&eie(t)))return t;const a=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),l=i.length,c=n?new Array(l):{};let u=0;for(let d=0;d<l;d++){const f=n?d:i[d],h=e[f],p=t[f];if(h===p){c[f]=h,(n?d<a:CMr.call(e,f))&&u++;continue}if(h===null||p===null||typeof h!="object"||typeof p!="object"){c[f]=p;continue}const m=qpe(h,p,r+1);c[f]=m,m===h&&u++}return a===l&&u===a?e:c}function dI(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function AIe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function eie(e){if(!IIe(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!IIe(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function IIe(e){return Object.prototype.toString.call(e)==="[object Object]"}function jMr(e){return new Promise(t=>{Nw.setTimeout(t,e)})}function tie(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?qpe(e,t):t}function TMr(e){return e}function NMr(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function AMr(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Hpe=Symbol();function Bct(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Hpe?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Qpe(e,t){return typeof e=="function"?e(...t):!!e}function IMr(e,t,r){let n=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),n||(n=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),e}var RMr=class extends O1{#e;#t;#r;constructor(){super(),this.#r=e=>{if(!DS&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=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"}},Wpe=new RMr;function rie(){let e,t;const r=new Promise((s,a)=>{e=s,t=a});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var PMr=_Mr;function MMr(){let e=[],t=0,r=l=>{l()},n=l=>{l()},s=PMr;const a=l=>{t?e.push(l):s(()=>{r(l)})},i=()=>{const l=e;e=[],l.length&&s(()=>{n(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||i()}return c},batchCalls:l=>(...c)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var Gi=MMr(),DMr=class extends O1{#e=!0;#t;#r;constructor(){super(),this.#r=e=>{if(!DS&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#e}},k4=new DMr;function LMr(e){return Math.min(1e3*2**e,3e4)}function Uct(e){return(e??"online")==="online"?k4.isOnline():!0}var nie=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Vct(e){let t=!1,r=0,n;const s=rie(),a=()=>s.status!=="pending",i=g=>{if(!a()){const y=new nie(g);h(y),e.onCancel?.(y)}},l=()=>{t=!0},c=()=>{t=!1},u=()=>Wpe.isFocused()&&(e.networkMode==="always"||k4.isOnline())&&e.canRun(),d=()=>Uct(e.networkMode)&&e.canRun(),f=g=>{a()||(n?.(),s.resolve(g))},h=g=>{a()||(n?.(),s.reject(g))},p=()=>new Promise(g=>{n=y=>{(a()||u())&&g(y)},e.onPause?.()}).then(()=>{n=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let g;const y=r===0?e.initialPromise:void 0;try{g=y??e.fn()}catch(x){g=Promise.reject(x)}Promise.resolve(g).then(f).catch(x=>{if(a())return;const w=e.retry??(DS?0:3),S=e.retryDelay??LMr,k=typeof S=="function"?S(r,x):S,_=w===!0||typeof w=="number"&&r<w||typeof w=="function"&&w(r,x);if(t||!_){h(x);return}r++,e.onFail?.(r,x),jMr(k).then(()=>u()?void 0:p()).then(()=>{t?h(x):m()})})};return{promise:s,status:()=>s.status,cancel:i,continue:()=>(n?.(),s),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?m():p().then(m),s)}}var qct=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Jae(this.gcTime)&&(this.#e=Nw.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(DS?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Nw.clearTimeout(this.#e),this.#e=void 0)}},$Mr=class extends qct{#e;#t;#r;#s;#n;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#r=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=PIe(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=PIe(this.options);t.data!==void 0&&(this.setState(RIe(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const r=tie(this.state.data,e,this.options);return this.#i({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#i({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#n?.promise;return this.#n?.cancel(e),t?t.then(uc).catch(uc):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Jf(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Hpe||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ex(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:!zct(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.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.#n&&(this.#o?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(e&&this.setOptions(e),!this.options.queryFn){const l=this.observers.find(c=>c.options.queryFn);l&&this.setOptions(l.options)}const r=new AbortController,n=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(this.#o=!0,r.signal)})},s=()=>{const l=Bct(this.options,t),u=(()=>{const d={client:this.#s,queryKey:this.queryKey,meta:this.meta};return n(d),d})();return this.#o=!1,this.options.persister?this.options.persister(l,u,this):l(u)},i=(()=>{const l={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:s};return n(l),l})();this.options.behavior?.onFetch(i,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#i({type:"fetch",meta:i.fetchOptions?.meta}),this.#n=Vct({initialPromise:t?.initialPromise,fn:i.fetchFn,onCancel:l=>{l instanceof nie&&l.revert&&this.setState({...this.#t,fetchStatus:"idle"}),r.abort()},onFail:(l,c)=>{this.#i({type:"failed",failureCount:l,error:c})},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 l=await this.#n.start();if(l===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(l),this.#r.config.onSuccess?.(l,this),this.#r.config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof nie){if(l.silent)return this.#n.promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw this.#i({type:"error",error:l}),this.#r.config.onError?.(l,this),this.#r.config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc()}}#i(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Hct(r.data,this.options),fetchMeta:e.meta??null};case"success":const n={...r,...RIe(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),Gi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function Hct(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Uct(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function RIe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function PIe(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var k9=class extends O1{constructor(e,t){super(),this.options=t,this.#e=e,this.#i=null,this.#o=rie(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#r=void 0;#s=void 0;#n;#a;#o;#i;#p;#d;#f;#c;#u;#l;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),MIe(this.#t,this.options)?this.#m():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return sie(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return sie(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,r=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Jf(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!dI(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const n=this.hasListeners();n&&DIe(this.#t,r,this.options,t)&&this.#m(),this.updateResult(),n&&(this.#t!==r||Jf(this.options.enabled,this.#t)!==Jf(t.enabled,this.#t)||ex(this.options.staleTime,this.#t)!==ex(t.staleTime,this.#t))&&this.#g();const s=this.#y();n&&(this.#t!==r||Jf(this.options.enabled,this.#t)!==Jf(t.enabled,this.#t)||s!==this.#l)&&this.#v(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(t,e);return zMr(this,r)&&(this.#s=r,this.#a=this.options,this.#n=this.#t.state),r}getCurrentResult(){return this.#s}trackResult(e,t){return new Proxy(e,{get:(r,n)=>(this.trackProp(n),t?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,n))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(uc)),t}#g(){this.#x();const e=ex(this.options.staleTime,this.#t);if(DS||this.#s.isStale||!Jae(e))return;const r=zct(this.#s.dataUpdatedAt,e)+1;this.#c=Nw.setTimeout(()=>{this.#s.isStale||this.updateResult()},r)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#w(),this.#l=e,!(DS||Jf(this.options.enabled,this.#t)===!1||!Jae(this.#l)||this.#l===0)&&(this.#u=Nw.setInterval(()=>{(this.options.refetchIntervalInBackground||Wpe.isFocused())&&this.#m()},this.#l))}#b(){this.#g(),this.#v(this.#y())}#x(){this.#c&&(Nw.clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(Nw.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const r=this.#t,n=this.options,s=this.#s,a=this.#n,i=this.#a,c=e!==r?e.state:this.#r,{state:u}=e;let d={...u},f=!1,h;if(t._optimisticResults){const j=this.hasListeners(),N=!j&&MIe(e,t),I=j&&DIe(e,r,t,n);(N||I)&&(d={...d,...Hct(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:m,status:g}=d;h=d.data;let y=!1;if(t.placeholderData!==void 0&&h===void 0&&g==="pending"){let j;s?.isPlaceholderData&&t.placeholderData===i?.placeholderData?(j=s.data,y=!0):j=typeof t.placeholderData=="function"?t.placeholderData(this.#f?.state.data,this.#f):t.placeholderData,j!==void 0&&(g="success",h=tie(s?.data,j,t),f=!0)}if(t.select&&h!==void 0&&!y)if(s&&h===a?.data&&t.select===this.#p)h=this.#d;else try{this.#p=t.select,h=t.select(h),h=tie(s?.data,h,t),this.#d=h,this.#i=null}catch(j){this.#i=j}this.#i&&(p=this.#i,h=this.#d,m=Date.now(),g="error");const x=d.fetchStatus==="fetching",w=g==="pending",S=g==="error",k=w&&x,_=h!==void 0,T={status:g,fetchStatus:d.fetchStatus,isPending:w,isSuccess:g==="success",isError:S,isInitialLoading:k,isLoading:k,data:h,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:x,isRefetching:x&&!w,isLoadingError:S&&!_,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:S&&_,isStale:Gpe(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Jf(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const j=T.data!==void 0,N=T.status==="error"&&!j,I=$=>{N?$.reject(T.error):j&&$.resolve(T.data)},P=()=>{const $=this.#o=T.promise=rie();I($)},R=this.#o;switch(R.status){case"pending":e.queryHash===r.queryHash&&I(R);break;case"fulfilled":(N||T.data!==R.value)&&P();break;case"rejected":(!N||T.error!==R.reason)&&P();break}}return T}updateResult(){const e=this.#s,t=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#a=this.options,this.#n.data!==void 0&&(this.#f=this.#t),dI(t,e))return;this.#s=t;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!this.#h.size)return!0;const a=new Set(s??this.#h);return this.options.throwOnError&&a.add("error"),Object.keys(this.#s).some(i=>{const l=i;return this.#s[l]!==e[l]&&a.has(l)})};this.#O({listeners:r()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#r=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#O(e){Gi.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function FMr(e,t){return Jf(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function MIe(e,t){return FMr(e,t)||e.state.data!==void 0&&sie(e,t,t.refetchOnMount)}function sie(e,t,r){if(Jf(t.enabled,e)!==!1&&ex(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Gpe(e,t)}return!1}function DIe(e,t,r,n){return(e!==t||Jf(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Gpe(e,r)}function Gpe(e,t){return Jf(t.enabled,e)!==!1&&e.isStaleByTime(ex(t.staleTime,e))}function zMr(e,t){return!dI(e.getCurrentResult(),t)}function _4(e){return{onFetch:(t,r)=>{const n=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],i=t.state.data?.pageParams||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let d=!1;const f=m=>{IMr(m,()=>t.signal,()=>d=!0)},h=Bct(t.options,t.fetchOptions),p=async(m,g,y)=>{if(d)return Promise.reject();if(g==null&&m.pages.length)return Promise.resolve(m);const w=(()=>{const E={client:t.client,queryKey:t.queryKey,pageParam:g,direction:y?"backward":"forward",meta:t.options.meta};return f(E),E})(),S=await h(w),{maxPages:k}=t.options,_=y?AMr:NMr;return{pages:_(m.pages,S,k),pageParams:_(m.pageParams,g,k)}};if(s&&a.length){const m=s==="backward",g=m?Qct:aie,y={pages:a,pageParams:i},x=g(n,y);l=await p(y,x,m)}else{const m=e??a.length;do{const g=c===0?i[0]??n.initialPageParam:aie(n,l);if(c>0&&g==null)break;l=await p(l,g),c++}while(c<m)}return l};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function aie(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Qct(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}function BMr(e,t){return t?aie(e,t)!=null:!1}function UMr(e,t){return!t||!e.getPreviousPageParam?!1:Qct(e,t)!=null}var VMr=class extends k9{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:_4()})}getOptimisticResult(e){return e.behavior=_4(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:r}=e,n=super.createResult(e,t),{isFetching:s,isRefetching:a,isError:i,isRefetchError:l}=n,c=r.fetchMeta?.fetchMore?.direction,u=i&&c==="forward",d=s&&c==="forward",f=i&&c==="backward",h=s&&c==="backward";return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:BMr(t,r.data),hasPreviousPage:UMr(t,r.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:h,isRefetchError:l&&!u&&!f,isRefetching:a&&!d&&!h}}},qMr=class extends qct{#e;#t;#r;#s;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||Wct(),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.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#r.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#n({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#s=Vct({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(a,i)=>{this.#n({type:"failed",failureCount:a,error:i})},onPause:()=>{this.#n({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});const n=this.state.status==="pending",s=!this.#s.canStart();try{if(n)t();else{this.#n({type:"pending",variables:e,isPaused:s}),this.#r.config.onMutate&&await this.#r.config.onMutate(e,this,r);const i=await this.options.onMutate?.(e,r);i!==this.state.context&&this.#n({type:"pending",context:i,variables:e,isPaused:s})}const a=await this.#s.start();return await this.#r.config.onSuccess?.(a,e,this.state.context,this,r),await this.options.onSuccess?.(a,e,this.state.context,r),await this.#r.config.onSettled?.(a,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(a,null,e,this.state.context,r),this.#n({type:"success",data:a}),a}catch(a){try{await this.#r.config.onError?.(a,e,this.state.context,this,r)}catch(i){Promise.reject(i)}try{await this.options.onError?.(a,e,this.state.context,r)}catch(i){Promise.reject(i)}try{await this.#r.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,r)}catch(i){Promise.reject(i)}try{await this.options.onSettled?.(void 0,a,e,this.state.context,r)}catch(i){Promise.reject(i)}throw this.#n({type:"error",error:a}),a}finally{this.#r.runNext(this)}}#n(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,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{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Gi.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function Wct(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var HMr=class extends O1{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#r=0}#e;#t;#r;build(e,t,r){const n=new qMr({client:e,mutationCache:this,mutationId:++this.#r,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#e.add(e);const t=WD(e);if(typeof t=="string"){const r=this.#t.get(t);r?r.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=WD(e);if(typeof t=="string"){const r=this.#t.get(t);if(r)if(r.length>1){const n=r.indexOf(e);n!==-1&&r.splice(n,1)}else r[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=WD(e);if(typeof t=="string"){const n=this.#t.get(t)?.find(s=>s.state.status==="pending");return!n||n===e}else return!0}runNext(e){const t=WD(e);return typeof t=="string"?this.#t.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Gi.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(r=>NIe(t,r))}findAll(e={}){return this.getAll().filter(t=>NIe(e,t))}notify(e){Gi.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Gi.batch(()=>Promise.all(e.map(t=>t.continue().catch(uc))))}};function WD(e){return e.options.scope?.id}var QMr=class extends O1{#e;#t=void 0;#r;#s;constructor(t,r){super(),this.#e=t,this.setOptions(r),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const r=this.options;this.options=this.#e.defaultMutationOptions(t),dI(this.options,r)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),r?.mutationKey&&this.options.mutationKey&&LS(r.mutationKey)!==LS(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(t){this.#n(),this.#a(t)}getCurrentResult(){return this.#t}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#n(),this.#a()}mutate(t,r){return this.#s=r,this.#r?.removeObserver(this),this.#r=this.#e.getMutationCache().build(this.#e,this.options),this.#r.addObserver(this),this.#r.execute(t)}#n(){const t=this.#r?.state??Wct();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#a(t){Gi.batch(()=>{if(this.#s&&this.hasListeners()){const r=this.#t.variables,n=this.#t.context,s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#s.onSuccess?.(t.data,r,n,s)}catch(a){Promise.reject(a)}try{this.#s.onSettled?.(t.data,null,r,n,s)}catch(a){Promise.reject(a)}}else if(t?.type==="error"){try{this.#s.onError?.(t.error,r,n,s)}catch(a){Promise.reject(a)}try{this.#s.onSettled?.(void 0,t.error,r,n,s)}catch(a){Promise.reject(a)}}}this.listeners.forEach(r=>{r(this.#t)})})}};function LIe(e,t){const r=new Set(t);return e.filter(n=>!r.has(n))}function WMr(e,t,r){const n=e.slice(0);return n[t]=r,n}var GMr=class extends O1{#e;#t;#r;#s;#n;#a;#o;#i;#p;#d=[];constructor(e,t,r){super(),this.#e=e,this.#s=r,this.#r=[],this.#n=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#n.forEach(e=>{e.subscribe(t=>{this.#l(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#n.forEach(e=>{e.destroy()})}setQueries(e,t){this.#r=e,this.#s=t,Gi.batch(()=>{const r=this.#n,n=this.#u(this.#r);n.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const s=n.map(d=>d.observer),a=s.map(d=>d.getCurrentResult()),i=r.length!==s.length,l=s.some((d,f)=>d!==r[f]),c=i||l,u=c?!0:a.some((d,f)=>{const h=this.#t[f];return!h||!dI(d,h)});!c&&!u||(c&&(this.#d=n,this.#n=s),this.#t=a,this.hasListeners()&&(c&&(LIe(r,s).forEach(d=>{d.destroy()}),LIe(s,r).forEach(d=>{d.subscribe(f=>{this.#l(d,f)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#n.map(e=>e.getCurrentQuery())}getObservers(){return this.#n}getOptimisticResult(e,t){const r=this.#u(e),n=r.map(a=>a.observer.getOptimisticResult(a.defaultedQueryOptions)),s=r.map(a=>a.defaultedQueryOptions.queryHash);return[n,a=>this.#c(a??n,t,s),()=>this.#f(n,r)]}#f(e,t){return t.map((r,n)=>{const s=e[n];return r.defaultedQueryOptions.notifyOnChangeProps?s:r.observer.trackResult(s,a=>{t.forEach(i=>{i.observer.trackProp(a)})})})}#c(e,t,r){if(t){const n=this.#p,s=r!==void 0&&n!==void 0&&(n.length!==r.length||r.some((a,i)=>a!==n[i]));return(!this.#a||this.#t!==this.#i||s||t!==this.#o)&&(this.#o=t,this.#i=this.#t,r!==void 0&&(this.#p=r),this.#a=qpe(this.#a,t(e))),this.#a}return e}#u(e){const t=new Map;this.#n.forEach(n=>{const s=n.options.queryHash;if(!s)return;const a=t.get(s);a?a.push(n):t.set(s,[n])});const r=[];return e.forEach(n=>{const s=this.#e.defaultQueryOptions(n),i=t.get(s.queryHash)?.shift()??new k9(this.#e,s);r.push({defaultedQueryOptions:s,observer:i})}),r}#l(e,t){const r=this.#n.indexOf(e);r!==-1&&(this.#t=WMr(this.#t,r,t),this.#h())}#h(){if(this.hasListeners()){const e=this.#a,t=this.#f(this.#t,this.#d),r=this.#c(t,this.#s?.combine);e!==r&&Gi.batch(()=>{this.listeners.forEach(n=>{n(this.#t)})})}}},ZMr=class extends O1{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){const n=t.queryKey,s=t.queryHash??Vpe(n,t);let a=this.get(s);return a||(a=new $Mr({client:e,queryKey:n,queryHash:s,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(a)),a}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(){Gi.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(r=>TIe(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>TIe(e,r)):t}notify(e){Gi.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Gi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Gi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},YMr=class{#e;#t;#r;#s;#n;#a;#o;#i;constructor(e={}){this.#e=e.queryCache||new ZMr,this.#t=e.mutationCache||new HMr,this.#r=e.defaultOptions||{},this.#s=new Map,this.#n=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Wpe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=k4.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#i?.(),this.#i=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),r=this.#e.build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(ex(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),a=this.#e.get(n.queryHash)?.state.data,i=EMr(t,a);if(i!==void 0)return this.#e.build(this,n).setData(i,{...r,manual:!0})}setQueriesData(e,t,r){return Gi.batch(()=>this.#e.findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;Gi.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#e;return Gi.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=Gi.batch(()=>this.#e.findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(uc).catch(uc)}invalidateQueries(e,t={}){return Gi.batch(()=>(this.#e.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=Gi.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,r);return r.throwOnError||(a=a.catch(uc)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(uc)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#e.build(this,t);return r.isStaleByTime(ex(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(uc).catch(uc)}fetchInfiniteQuery(e){return e.behavior=_4(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(uc).catch(uc)}ensureInfiniteQueryData(e){return e.behavior=_4(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return k4.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#r}setDefaultOptions(e){this.#r=e}setQueryDefaults(e,t){this.#s.set(LS(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#s.values()],r={};return t.forEach(n=>{uI(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#n.set(LS(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#n.values()],r={};return t.forEach(n=>{uI(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#r.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Vpe(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===Hpe&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#r.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Gct=b.createContext(void 0),ba=e=>{const t=b.useContext(Gct);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},XMr=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(Gct.Provider,{value:e,children:t})),Zct=b.createContext(!1),Yct=()=>b.useContext(Zct);Zct.Provider;function KMr(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var JMr=b.createContext(KMr()),Xct=()=>b.useContext(JMr),Kct=(e,t,r)=>{const n=r?.state.error&&typeof e.throwOnError=="function"?Qpe(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Jct=e=>{b.useEffect(()=>{e.clearReset()},[e])},eut=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Qpe(r,[e.error,n])),tut=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},e2r=(e,t)=>e.isLoading&&e.isFetching&&!t,iie=(e,t)=>e?.suspense&&t.isPending,oie=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function t2r({queries:e,...t},r){const n=ba(),s=Yct(),a=Xct(),i=b.useMemo(()=>e.map(g=>{const y=n.defaultQueryOptions(g);return y._optimisticResults=s?"isRestoring":"optimistic",y}),[e,n,s]);i.forEach(g=>{tut(g);const y=n.getQueryCache().get(g.queryHash);Kct(g,a,y)}),Jct(a);const[l]=b.useState(()=>new GMr(n,i,t)),[c,u,d]=l.getOptimisticResult(i,t.combine),f=!s&&t.subscribed!==!1;b.useSyncExternalStore(b.useCallback(g=>f?l.subscribe(Gi.batchCalls(g)):uc,[l,f]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),b.useEffect(()=>{l.setQueries(i,t)},[i,t,l]);const p=c.some((g,y)=>iie(i[y],g))?c.flatMap((g,y)=>{const x=i[y];if(x&&iie(x,g)){const w=new k9(n,x);return oie(x,w,a)}return[]}):[];if(p.length>0)throw Promise.all(p);const m=c.find((g,y)=>{const x=i[y];return x&&eut({result:g,errorResetBoundary:a,throwOnError:x.throwOnError,query:n.getQueryCache().get(x.queryHash),suspense:x.suspense})});if(m?.error)throw m.error;return u(d())}function rut(e,t,r){const n=Yct(),s=Xct(),a=ba(),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i);const l=a.getQueryCache().get(i.queryHash);i._optimisticResults=n?"isRestoring":"optimistic",tut(i),Kct(i,s,l),Jct(s);const c=!a.getQueryCache().get(i.queryHash),[u]=b.useState(()=>new t(a,i)),d=u.getOptimisticResult(i),f=!n&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(h=>{const p=f?u.subscribe(Gi.batchCalls(h)):uc;return u.updateResult(),p},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),b.useEffect(()=>{u.setOptions(i)},[i,u]),iie(i,d))throw oie(i,u,s);if(eut({result:d,errorResetBoundary:s,throwOnError:i.throwOnError,query:l,suspense:i.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,d),i.experimental_prefetchInRender&&!DS&&e2r(d,n)&&(c?oie(i,u,s):l?.promise)?.catch(uc).finally(()=>{u.updateResult()}),i.notifyOnChangeProps?d:u.trackResult(d)}function kt(e,t){return rut(e,k9)}function Kr(e,t){const r=ba(),[n]=b.useState(()=>new QMr(r,e));b.useEffect(()=>{n.setOptions(e)},[n,e]);const s=b.useSyncExternalStore(b.useCallback(i=>n.subscribe(Gi.batchCalls(i)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=b.useCallback((i,l)=>{n.mutate(i,l).catch(uc)},[n]);if(s.error&&Qpe(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}function o0(e,t){return rut(e,VMr)}var Do=(e=>(e.AGENT="agent",e.SCORER="scorer",e.RAG_INGESTION="rag_ingestion",e.TRAJECTORY="trajectory",e.INPUT_PROCESSOR="input_processor",e.INPUT_STEP_PROCESSOR="input_step_processor",e.OUTPUT_PROCESSOR="output_processor",e.OUTPUT_STEP_PROCESSOR="output_step_processor",e.WORKFLOW_STEP="workflow_step",e.TOOL="tool",e.WORKFLOW_RUN="workflow_run",e.MEMORY="memory",e))(Do||{});n1().describe("Database record creation time");var r2r=n1().describe("Database record last update time");r2r.nullable();var _9=_e({page:Xwe().int().min(0).optional().default(0).describe("Zero-indexed page number"),perPage:Xwe().int().min(1).max(100).optional().default(10).describe("Number of items per page")}).describe("Pagination options for list queries"),E9=_e({total:St().describe("Total number of items available"),page:St().describe("Current page"),perPage:Hr([St(),zt(!1)]).describe("Number of items per page, or false if pagination is disabled"),hasMore:yo().describe("True if more pages are available")}),n2r=_e({start:Kwe().optional().describe("Start of date range (inclusive by default)"),end:Kwe().optional().describe("End of date range (inclusive by default)"),startExclusive:yo().optional().describe("When true, excludes the start date from results (uses > instead of >=)"),endExclusive:yo().optional().describe("When true, excludes the end date from results (uses < instead of <=)")}).describe("Date range filter for timestamps"),C9=So(["ASC","DESC"]).describe("Sort direction: 'ASC' | 'DESC'"),kg=So(["sum","avg","min","max","count","last"]).describe("Aggregation function"),k1=So(["1m","5m","15m","1h","1d"]).describe("Time bucket interval"),Zpe=So(["previous_period","previous_day","previous_week"]).describe("Comparison period for aggregate queries"),_1=Et(de()).min(1).describe("Fields to group by"),Ype=Et(St().min(0).max(1)).min(1).describe("Percentile values (0-1)"),Xpe={value:St().nullable().describe("Aggregated value"),previousValue:St().nullable().optional().describe("Value from comparison period"),changePercent:St().nullable().optional().describe("Percentage change from comparison period")},Kpe=Qs(de(),de().nullable()).describe("Dimension values for this group"),cC=St().describe("Aggregated value"),uC=n1().describe("Bucket timestamp"),Jpe=St().describe("Percentile value"),eme=St().describe("Percentile value at this bucket"),dC=Gle(Do).describe("Entity type (e.g., 'agent' | 'processor' | 'tool' | 'workflow')"),s2r=de().describe('ID of the entity (e.g., "weatherAgent", "orderWorkflow")'),nut=de().describe("Name of the entity"),sut=de().describe("Human end-user who triggered execution"),aut=de().describe("Multi-tenant organization/account"),iut=de().describe("Broader resource context (Mastra memory compatibility)"),out=de().describe("Unique execution run identifier"),lut=de().describe("Session identifier for grouping traces"),cut=de().describe("Conversation thread identifier"),uut=de().describe("HTTP request ID for log correlation"),dut=de().describe('Environment (e.g., "production" | "staging" | "development")'),a2r=de().describe('Source of execution (e.g., "local" | "cloud" | "ci")'),fut=de().describe('Source of execution (e.g., "local" | "cloud" | "ci")'),hut=de().describe("Name of the service"),put=Gle(Do).describe("Entity type of the parent entity"),i2r=de().describe("ID of the parent entity"),mut=de().describe("Name of the parent entity"),gut=Gle(Do).describe("Entity type of the root entity"),o2r=de().describe("ID of the root entity"),yut=de().describe("Name of the root entity"),vut=de().describe("Version ID of the entity that produced this signal (e.g., agent version, workflow version)"),but=de().describe("Version ID of the parent entity that produced this signal"),xut=de().describe("Version ID of the root entity that produced this signal"),j9=de().describe("Experiment or eval run identifier"),l2r=Qs(de(),Na()).describe('Arbitrary package/app version info (e.g., {"core": "1.0.0", "memory": "1.0.0", "gitSha": "abcd1234"})'),wut=Qs(de(),Na()).describe("User-defined metadata for custom filtering"),Sut=Et(de()).describe("Labels for filtering"),c2r={entityType:dC.nullish(),entityId:s2r.nullish(),entityName:nut.nullish(),parentEntityType:put.nullish(),parentEntityId:i2r.nullish(),parentEntityName:mut.nullish(),rootEntityType:gut.nullish(),rootEntityId:o2r.nullish(),rootEntityName:yut.nullish(),userId:sut.nullish(),organizationId:aut.nullish(),resourceId:iut.nullish(),runId:out.nullish(),sessionId:lut.nullish(),threadId:cut.nullish(),requestId:uut.nullish(),environment:dut.nullish(),serviceName:hut.nullish(),scope:l2r.nullish(),entityVersionId:vut.nullish(),parentEntityVersionId:but.nullish(),rootEntityVersionId:xut.nullish(),experimentId:j9.nullish()},T9={...c2r,executionSource:fut.nullish(),tags:Sut.nullish()};a2r.nullish();var N9={timestamp:n2r.optional().describe("Filter by timestamp range"),traceId:de().optional().describe("Filter by trace ID"),spanId:de().optional().describe("Filter by span ID"),entityType:dC.optional(),entityName:nut.optional(),entityVersionId:vut.optional(),parentEntityVersionId:but.optional(),rootEntityVersionId:xut.optional(),userId:sut.optional(),organizationId:aut.optional(),experimentId:j9.optional(),serviceName:hut.optional(),environment:dut.optional(),parentEntityType:put.optional(),parentEntityName:mut.optional(),rootEntityType:gut.optional(),rootEntityName:yut.optional(),resourceId:iut.optional(),runId:out.optional(),sessionId:lut.optional(),threadId:cut.optional(),requestId:uut.optional(),executionSource:fut.optional(),tags:Et(de()).optional().describe("Filter by tags (must have all specified tags)")},A9=de().describe("Unique trace identifier"),I9=de().describe("Unique span identifier within a trace"),E4=So(["debug","info","warn","error","fatal"]),Out=de().describe("Log message"),kut=Qs(de(),Na()).describe("Structured data attached to the log"),_ut=_e({logId:de().nullish().describe("Unique id for this log event"),timestamp:n1().describe("When the log was created"),level:E4.describe("Log severity level"),message:Out,data:kut.nullish(),traceId:A9.nullish(),spanId:I9.nullish(),...T9,source:de().nullish().describe("Execution source"),metadata:wut.nullish()}).describe("Log record as stored in the database");_e({level:E4,message:Out,data:kut.optional(),tags:Sut.optional()}).describe("User-provided log input");var u2r=_ut;_e({logs:Et(u2r)}).describe("Arguments for batch creating logs");var d2r=_e({...N9,source:de().optional().describe("Filter by execution source"),level:Hr([E4,Et(E4)]).optional().describe("Filter by log level(s)")}).describe("Filters for querying logs"),f2r=So(["timestamp"]).describe("Field to order by: 'timestamp'"),h2r=_e({field:f2r.default("timestamp").describe("Field to order by"),direction:C9.default("DESC").describe("Sort direction")}).describe("Order by configuration");_e({filters:d2r.optional().describe("Optional filters to apply"),pagination:_9.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:h2r.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing logs");_e({pagination:E9,logs:Et(_ut)});var fC=de().describe("Identifier of the scorer (e.g., relevance, accuracy)"),Eut=de().describe("Display name of the scorer"),Cut=de().describe("Version of the scorer"),og=de().describe("How the score was produced (e.g., manual, automated, experiment)"),jut=St().describe("Score value (range defined by scorer)"),Tut=de().describe("Explanation for the score"),Nut=_e({scoreId:de().nullish().describe("Unique id for this score event"),timestamp:n1().describe("When the score was recorded"),traceId:A9.nullish().describe("Trace that anchors the scored target when available"),spanId:I9.nullish().describe("Span ID this score applies to"),scorerId:fC,scorerName:Eut.nullish(),scorerVersion:Cut.nullish(),scoreSource:og.nullish(),source:og.nullish(),score:jut,reason:Tut.nullish(),...T9,scoreTraceId:de().nullish().describe("Trace ID of the scoring run for debugging score generation"),metadata:Qs(de(),Na()).nullish().describe("User-defined metadata")}).describe("Score record as stored in the database");_e({scorerId:fC,scorerName:Eut.optional(),scorerVersion:Cut.optional(),scoreSource:og.optional(),source:og.optional(),score:jut,reason:Tut.optional(),metadata:Qs(de(),Na()).optional().describe("Additional scorer-specific metadata"),experimentId:j9.optional(),scoreTraceId:de().optional().describe("Trace ID of the scoring run for debugging score generation"),targetEntityType:dC.optional().describe("Entity type the scorer evaluated when known")}).describe("User-provided score input");var tme=Nut;_e({score:tme}).describe("Arguments for creating a score");_e({score:tme.omit({timestamp:!0})}).describe("Arguments for creating a score");_e({success:yo()}).describe("Response from creating a score");_e({scores:Et(tme)}).describe("Arguments for batch recording scores");var TP=_e({...N9,scorerId:Hr([de(),Et(de())]).optional().describe("Filter by scorer ID(s)"),scoreSource:og.optional().describe("Filter by how the score was produced"),source:og.optional().describe("Filter by how the score was produced")}).describe("Filters for querying scores"),p2r=So(["timestamp","score"]).describe("Field to order by: 'timestamp' | 'score'"),m2r=_e({field:p2r.default("timestamp").describe("Field to order by"),direction:C9.default("DESC").describe("Sort direction")}).describe("Order by configuration");_e({filters:TP.optional(),pagination:_9.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:m2r.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing scores");_e({pagination:E9,scores:Et(Nut)});_e({scorerId:fC,scoreSource:og.optional(),aggregation:kg,filters:TP.optional(),comparePeriod:Zpe.optional()}).describe("Arguments for getting a score aggregate");_e(Xpe);_e({scorerId:fC,scoreSource:og.optional(),groupBy:_1,aggregation:kg,filters:TP.optional()}).describe("Arguments for getting a score breakdown");_e({groups:Et(_e({dimensions:Kpe,value:cC}))});_e({scorerId:fC,scoreSource:og.optional(),interval:k1,aggregation:kg,filters:TP.optional(),groupBy:_1.optional()}).describe("Arguments for getting score time series");_e({series:Et(_e({name:de().describe("Series name (scorer ID or group key)"),points:Et(_e({timestamp:uC,value:cC}))}))});_e({scorerId:fC,scoreSource:og.optional(),percentiles:Ype,interval:k1,filters:TP.optional()}).describe("Arguments for getting score percentiles");_e({series:Et(_e({percentile:Jpe,points:Et(_e({timestamp:uC,value:eme}))}))});var lg=de().describe("Source of feedback (e.g., 'user', 'system', 'manual')"),hC=de().describe("Type of feedback (e.g., 'thumbs', 'rating', 'correction')"),Aut=Hr([St(),de()]).describe("Feedback value (rating number or correction text)"),Iut=de().describe("Additional comment or context"),C4=de().describe("User who provided the feedback");function rme(e){if(!e||typeof e!="object"||Array.isArray(e))return e;const t={...e};return typeof t.userId=="string"&&t.feedbackUserId==null&&(t.feedbackUserId=t.userId,delete t.userId),t}var R9=_e({feedbackId:de().nullish().describe("Unique id for this feedback event"),timestamp:n1().describe("When the feedback was recorded"),traceId:A9.nullish().describe("Trace that anchors the feedback target when available"),spanId:I9.nullish().describe("Span ID this feedback applies to"),feedbackSource:lg.nullish(),source:lg.nullish(),feedbackType:hC,value:Aut,comment:Iut.nullish(),feedbackUserId:C4.nullish(),...T9,sourceId:de().nullish().describe("ID of the source record this feedback is linked to (e.g. experiment result ID)"),metadata:Qs(de(),Na()).nullish().describe("User-defined metadata")}),g2r=_e(R9.shape).describe("Feedback record as stored in the database"),y2r=_e({feedbackSource:lg.optional(),source:lg.optional(),feedbackType:hC,value:Aut,comment:Iut.optional(),feedbackUserId:C4.optional(),userId:C4.optional(),metadata:Qs(de(),Na()).optional().describe("Additional feedback-specific metadata"),experimentId:j9.optional(),sourceId:de().optional().describe("ID of the source record this feedback is linked to")});_e(y2r.shape).describe("User-provided feedback input");_e({feedback:Kle(rme,R9)}).describe("Arguments for creating feedback");_e({feedback:R9.omit({timestamp:!0})}).describe("Arguments for creating feedback");_e({success:yo()}).describe("Response from creating feedback");_e({feedbacks:Et(Kle(rme,R9))}).describe("Arguments for batch recording feedback");var Rut=_e({...N9,feedbackType:Hr([de(),Et(de())]).optional().describe("Filter by feedback type(s)"),feedbackSource:lg.optional(),source:lg.optional(),feedbackUserId:C4.optional()}),P9=_e(Rut.shape).describe("Filters for querying feedback"),v2r=So(["timestamp"]).describe("Field to order by: 'timestamp'"),b2r=_e({field:v2r.default("timestamp").describe("Field to order by"),direction:C9.default("DESC").describe("Sort direction")}).describe("Order by configuration");_e({filters:Kle(rme,Rut).optional().describe("Optional filters to apply"),pagination:_9.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:b2r.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing feedback");_e({pagination:E9,feedback:Et(g2r)});_e({feedbackType:hC,feedbackSource:lg.optional(),aggregation:kg,filters:P9.optional(),comparePeriod:Zpe.optional()}).describe("Arguments for getting a feedback aggregate over numeric values");_e(Xpe);_e({feedbackType:hC,feedbackSource:lg.optional(),groupBy:_1,aggregation:kg,filters:P9.optional()}).describe("Arguments for getting a feedback breakdown over numeric values");_e({groups:Et(_e({dimensions:Kpe,value:cC}))});_e({feedbackType:hC,feedbackSource:lg.optional(),interval:k1,aggregation:kg,filters:P9.optional(),groupBy:_1.optional()}).describe("Arguments for getting feedback time series over numeric values");_e({series:Et(_e({name:de().describe("Series name (feedback type or group key)"),points:Et(_e({timestamp:uC,value:cC}))}))});_e({feedbackType:hC,feedbackSource:lg.optional(),percentiles:Ype,interval:k1,filters:P9.optional()}).describe("Arguments for getting feedback percentiles over numeric values");_e({series:Et(_e({percentile:Jpe,points:Et(_e({timestamp:uC,value:eme}))}))});So(["counter","gauge","histogram"]);var Put=de().describe("Metric name (e.g., mastra_agent_duration_ms)"),Mut=St().describe("Metric value"),Dut=Qs(de(),de()).describe("Metric labels for dimensional filtering"),Lut=de().describe("Model provider"),$ut=de().describe("Model"),x2r=St().describe("Estimated cost"),Fut=de().describe("Unit for the estimated cost (e.g., usd)"),w2r=Qs(de(),Na()).nullish().describe("Structured costing metadata"),zut=_e({metricId:de().nullish().describe("Unique id for this metric event"),timestamp:n1().describe("When the metric was recorded"),name:Put,value:Mut,traceId:A9.nullish(),spanId:I9.nullish(),...T9,source:de().nullish().describe("Execution source"),provider:Lut.nullish(),model:$ut.nullish(),estimatedCost:x2r.nullish(),costUnit:Fut.nullish(),costMetadata:w2r.nullish(),labels:Dut.default({}),metadata:wut.nullish()}).describe("Metric record as stored in the database");_e({name:Put,value:Mut,labels:Dut.optional()}).describe("User-provided metric input");var S2r=zut;_e({metrics:Et(S2r)}).describe("Arguments for batch recording metrics");_e({type:kg,interval:k1.optional(),groupBy:_1.optional()}).describe("Metrics aggregation configuration");var NP=_e({...N9,name:Et(de()).nonempty().optional().describe("Filter by metric name(s)"),source:de().optional().describe("Filter by execution source"),provider:Lut.optional(),model:$ut.optional(),costUnit:Fut.optional(),labels:Qs(de(),de()).optional().describe("Exact match on label key-value pairs")}).describe("Filters for querying metrics"),O2r=So(["timestamp"]).describe("Field to order by: 'timestamp'"),k2r=_e({field:O2r.default("timestamp").describe("Field to order by"),direction:C9.default("DESC").describe("Sort direction")}).describe("Order by configuration");_e({filters:NP.optional(),pagination:_9.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:k2r.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing metrics");_e({pagination:E9,metrics:Et(zut)});_e({name:Et(de()).nonempty().describe("Metric name(s) to aggregate"),aggregation:kg,filters:NP.optional(),comparePeriod:Zpe.optional()}).describe("Arguments for getting a metric aggregate");_e({...Xpe,estimatedCost:St().nullable().optional().describe("Aggregated estimated cost from the same filtered row set"),costUnit:de().nullable().optional().describe("Shared cost unit for the aggregated rows, or null when mixed/unknown"),previousEstimatedCost:St().nullable().optional().describe("Aggregated estimated cost from the comparison period"),costChangePercent:St().nullable().optional().describe("Percentage change in estimated cost from comparison period")});_e({name:Et(de()).nonempty().describe("Metric name(s) to break down"),groupBy:_1,aggregation:kg,filters:NP.optional()}).describe("Arguments for getting a metric breakdown");_e({groups:Et(_e({dimensions:Kpe,value:cC,estimatedCost:St().nullable().optional().describe("Summed estimated cost for this group"),costUnit:de().nullable().optional().describe("Shared cost unit for this group, or null when mixed/unknown")}))});_e({name:Et(de()).nonempty().describe("Metric name(s)"),interval:k1,aggregation:kg,filters:NP.optional(),groupBy:_1.optional()}).describe("Arguments for getting metric time series");_e({series:Et(_e({name:de().describe("Series name (metric name or group key)"),costUnit:de().nullable().optional().describe("Shared cost unit for this series, or null when mixed/unknown"),points:Et(_e({timestamp:uC,value:cC,estimatedCost:St().nullable().optional().describe("Summed estimated cost in this bucket")}))}))});_e({name:de().describe("Metric name"),percentiles:Ype,interval:k1,filters:NP.optional()}).describe("Arguments for getting metric percentiles");_e({series:Et(_e({percentile:Jpe,points:Et(_e({timestamp:uC,value:eme}))}))});_e({prefix:de().optional().describe("Filter metric names by prefix"),limit:St().int().min(1).optional().describe("Maximum number of names to return")}).describe("Arguments for getting metric names");_e({names:Et(de()).describe("Distinct metric names")});_e({metricName:de().describe("Metric name to get label keys for")}).describe("Arguments for getting metric label keys");_e({keys:Et(de()).describe("Distinct label keys for the metric")});_e({metricName:de().describe("Metric name"),labelKey:de().describe("Label key to get values for"),prefix:de().optional().describe("Filter values by prefix"),limit:St().int().min(1).optional().describe("Maximum number of values to return")}).describe("Arguments for getting label values");_e({values:Et(de()).describe("Distinct label values")});_e({}).describe("Arguments for getting entity types");_e({entityTypes:Et(dC).describe("Distinct entity types")});_e({entityType:dC.optional().describe("Optional entity type filter")}).describe("Arguments for getting entity names");_e({names:Et(de()).describe("Distinct entity names")});_e({}).describe("Arguments for getting service names");_e({serviceNames:Et(de()).describe("Distinct service names")});_e({}).describe("Arguments for getting environments");_e({environments:Et(de()).describe("Distinct environments")});_e({entityType:dC.optional().describe("Optional entity type filter")}).describe("Arguments for getting tags");_e({tags:Et(de()).describe("Distinct tags")});const Ql={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},AP="focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",_2r="focus-within:outline-hidden focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",E2r="rounded-md",nme="bg-surface2 border-2 border-border1 text-neutral5 hover:text-neutral6 hover:border-border2 rounded-lg",sme="outline-hidden focus-visible:outline-hidden focus-visible:border-accent1 focus-visible:ring-1 focus-visible:ring-accent1/40",ame="disabled:opacity-50 disabled:cursor-not-allowed";function But(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=But(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Uut(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=But(e))&&(n&&(n+=" "),n+=t);return n}const C2r=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},j2r=(e,t)=>({classGroupId:e,validator:t}),Vut=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),j4="-",$Ie=[],T2r="arbitrary..",N2r=e=>{const t=I2r(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return A2r(i);const l=i.split(j4),c=l[0]===""&&l.length>1?1:0;return qut(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=n[i],u=r[i];return c?u?C2r(u,c):c:u||$Ie}return r[i]||$Ie}}},qut=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],a=r.nextPart.get(s);if(a){const u=qut(e,t+1,a);if(u)return u}const i=r.validators;if(i===null)return;const l=t===0?e.join(j4):e.slice(t).join(j4),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},A2r=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?T2r+n:void 0})(),I2r=e=>{const{theme:t,classGroups:r}=e;return R2r(r,t)},R2r=(e,t)=>{const r=Vut();for(const n in e){const s=e[n];ime(s,r,n,t)}return r},ime=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];P2r(i,t,r,n)}},P2r=(e,t,r,n)=>{if(typeof e=="string"){M2r(e,t,r);return}if(typeof e=="function"){D2r(e,t,r,n);return}L2r(e,t,r,n)},M2r=(e,t,r)=>{const n=e===""?t:Hut(t,e);n.classGroupId=r},D2r=(e,t,r,n)=>{if($2r(e)){ime(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(j2r(r,e))},L2r=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[l,c]=s[i];ime(c,Hut(t,l),r,n)}},Hut=(e,t)=>{let r=e;const n=t.split(j4),s=n.length;for(let a=0;a<s;a++){const i=n[a];let l=r.nextPart.get(i);l||(l=Vut(),r.nextPart.set(i,l)),r=l}return r},$2r=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,F2r=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,i)=>{r[a]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let i=r[a];if(i!==void 0)return i;if((i=n[a])!==void 0)return s(a,i),i},set(a,i){a in r?r[a]=i:s(a,i)}}},lie="!",FIe=":",z2r=[],zIe=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),B2r=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let i=0,l=0,c=0,u;const d=s.length;for(let g=0;g<d;g++){const y=s[g];if(i===0&&l===0){if(y===FIe){a.push(s.slice(c,g)),c=g+1;continue}if(y==="/"){u=g;continue}}y==="["?i++:y==="]"?i--:y==="("?l++:y===")"&&l--}const f=a.length===0?s:s.slice(c);let h=f,p=!1;f.endsWith(lie)?(h=f.slice(0,-1),p=!0):f.startsWith(lie)&&(h=f.slice(1),p=!0);const m=u&&u>c?u-c:void 0;return zIe(a,p,h,m)};if(t){const s=t+FIe,a=n;n=i=>i.startsWith(s)?a(i.slice(s.length)):zIe(z2r,!1,i,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},U2r=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a<r.length;a++){const i=r[a],l=i[0]==="[",c=t.has(i);l||c?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(i)):s.push(i)}return s.length>0&&(s.sort(),n.push(...s)),n}},V2r=e=>({cache:F2r(e.cacheSize),parseClassName:B2r(e),sortModifiers:U2r(e),...N2r(e)}),q2r=/\s+/,H2r=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],l=e.trim().split(q2r);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=r(d);if(f){c=d+(c.length>0?" "+c:c);continue}let y=!!g,x=n(y?m.substring(0,g):m);if(!x){if(!y){c=d+(c.length>0?" "+c:c);continue}if(x=n(m),!x){c=d+(c.length>0?" "+c:c);continue}y=!1}const w=h.length===0?"":h.length===1?h[0]:a(h).join(":"),S=p?w+lie:w,k=S+x;if(i.indexOf(k)>-1)continue;i.push(k);const _=s(x,y);for(let E=0;E<_.length;++E){const T=_[E];i.push(S+T)}c=d+(c.length>0?" "+c:c)}return c},Q2r=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=Qut(r))&&(s&&(s+=" "),s+=n);return s},Qut=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Qut(e[n]))&&(r&&(r+=" "),r+=t);return r},BIe=(e,...t)=>{let r,n,s,a;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return r=V2r(u),n=r.cache.get,s=r.cache.set,a=l,l(c)},l=c=>{const u=n(c);if(u)return u;const d=H2r(c,r);return s(c,d),d};return a=i,(...c)=>a(Q2r(...c))},W2r=[],Go=e=>{const t=r=>r[e]||W2r;return t.isThemeGetter=!0,t},Wut=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Gut=/^\((?:(\w[\w-]*):)?(.+)\)$/i,G2r=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Z2r=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Y2r=/\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$/,X2r=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,K2r=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,J2r=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ob=e=>G2r.test(e),Vn=e=>!!e&&!Number.isNaN(Number(e)),lb=e=>!!e&&Number.isInteger(Number(e)),eQ=e=>e.endsWith("%")&&Vn(e.slice(0,-1)),ry=e=>Z2r.test(e),Zut=()=>!0,eDr=e=>Y2r.test(e)&&!X2r.test(e),ome=()=>!1,tDr=e=>K2r.test(e),rDr=e=>J2r.test(e),nDr=e=>!vr(e)&&!kr(e),sDr=e=>l0(e,Kut,ome),vr=e=>Wut.test(e),q0=e=>l0(e,Jut,eDr),UIe=e=>l0(e,fDr,Vn),aDr=e=>l0(e,tdt,Zut),iDr=e=>l0(e,edt,ome),VIe=e=>l0(e,Yut,ome),oDr=e=>l0(e,Xut,rDr),GD=e=>l0(e,rdt,tDr),kr=e=>Gut.test(e),oT=e=>E1(e,Jut),lDr=e=>E1(e,edt),qIe=e=>E1(e,Yut),cDr=e=>E1(e,Kut),uDr=e=>E1(e,Xut),ZD=e=>E1(e,rdt,!0),dDr=e=>E1(e,tdt,!0),l0=(e,t,r)=>{const n=Wut.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},E1=(e,t,r=!1)=>{const n=Gut.exec(e);return n?n[1]?t(n[1]):r:!1},Yut=e=>e==="position"||e==="percentage",Xut=e=>e==="image"||e==="url",Kut=e=>e==="length"||e==="size"||e==="bg-size",Jut=e=>e==="length",fDr=e=>e==="number",edt=e=>e==="family-name",tdt=e=>e==="number"||e==="weight",rdt=e=>e==="shadow",HIe=()=>{const e=Go("color"),t=Go("font"),r=Go("text"),n=Go("font-weight"),s=Go("tracking"),a=Go("leading"),i=Go("breakpoint"),l=Go("container"),c=Go("spacing"),u=Go("radius"),d=Go("shadow"),f=Go("inset-shadow"),h=Go("text-shadow"),p=Go("drop-shadow"),m=Go("blur"),g=Go("perspective"),y=Go("aspect"),x=Go("ease"),w=Go("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...k(),kr,vr],E=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],j=()=>[kr,vr,c],N=()=>[ob,"full","auto",...j()],I=()=>[lb,"none","subgrid",kr,vr],P=()=>["auto",{span:["full",lb,kr,vr]},lb,kr,vr],R=()=>[lb,"auto",kr,vr],$=()=>["auto","min","max","fr",kr,vr],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...j()],B=()=>[ob,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],H=()=>[ob,"screen","full","dvw","lvw","svw","min","max","fit",...j()],W=()=>[ob,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],L=()=>[e,kr,vr],Y=()=>[...k(),qIe,VIe,{position:[kr,vr]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",cDr,sDr,{size:[kr,vr]}],Q=()=>[eQ,oT,q0],G=()=>["","none","full",u,kr,vr],J=()=>["",Vn,oT,q0],ae=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[Vn,eQ,qIe,VIe],oe=()=>["","none",m,kr,vr],he=()=>["none",Vn,kr,vr],X=()=>["none",Vn,kr,vr],te=()=>[Vn,kr,vr],le=()=>[ob,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ry],breakpoint:[ry],color:[Zut],container:[ry],"drop-shadow":[ry],ease:["in","out","in-out"],font:[nDr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ry],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ry],shadow:[ry],spacing:["px",Vn],text:[ry],"text-shadow":[ry],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ob,vr,kr,y]}],container:["container"],columns:[{columns:[Vn,vr,kr,l]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[lb,"auto",kr,vr]}],basis:[{basis:[ob,"full","auto",l,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Vn,ob,"auto","initial","none",vr]}],grow:[{grow:["",Vn,kr,vr]}],shrink:[{shrink:["",Vn,kr,vr]}],order:[{order:[lb,"first","last","none",kr,vr]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":$()}],"auto-rows":[{"auto-rows":$()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[l,"screen",...B()]}],"min-w":[{"min-w":[l,"screen","none",...B()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",r,oT,q0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,dDr,aDr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",eQ,vr]}],"font-family":[{font:[lDr,iDr,t]}],"font-features":[{"font-features":[vr]}],"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:[s,kr,vr]}],"line-clamp":[{"line-clamp":[Vn,"none",kr,UIe]}],leading:[{leading:[a,...j()]}],"list-image":[{"list-image":["none",kr,vr]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",kr,vr]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[Vn,"from-font","auto",kr,q0]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[Vn,"auto",kr,vr]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",kr,vr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",kr,vr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},lb,kr,vr],radial:["",kr,vr],conic:[lb,kr,vr]},uDr,oDr]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Vn,kr,vr]}],"outline-w":[{outline:["",Vn,oT,q0]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",d,ZD,GD]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",f,ZD,GD]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[Vn,q0]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",h,ZD,GD]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[Vn,kr,vr]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Vn]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[kr,vr]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[Vn]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",kr,vr]}],filter:[{filter:["","none",kr,vr]}],blur:[{blur:oe()}],brightness:[{brightness:[Vn,kr,vr]}],contrast:[{contrast:[Vn,kr,vr]}],"drop-shadow":[{"drop-shadow":["","none",p,ZD,GD]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",Vn,kr,vr]}],"hue-rotate":[{"hue-rotate":[Vn,kr,vr]}],invert:[{invert:["",Vn,kr,vr]}],saturate:[{saturate:[Vn,kr,vr]}],sepia:[{sepia:["",Vn,kr,vr]}],"backdrop-filter":[{"backdrop-filter":["","none",kr,vr]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[Vn,kr,vr]}],"backdrop-contrast":[{"backdrop-contrast":[Vn,kr,vr]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Vn,kr,vr]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Vn,kr,vr]}],"backdrop-invert":[{"backdrop-invert":["",Vn,kr,vr]}],"backdrop-opacity":[{"backdrop-opacity":[Vn,kr,vr]}],"backdrop-saturate":[{"backdrop-saturate":[Vn,kr,vr]}],"backdrop-sepia":[{"backdrop-sepia":["",Vn,kr,vr]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",kr,vr]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Vn,"initial",kr,vr]}],ease:[{ease:["linear","initial",x,kr,vr]}],delay:[{delay:[Vn,kr,vr]}],animate:[{animate:["none",w,kr,vr]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,kr,vr]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:te()}],"skew-x":[{"skew-x":te()}],"skew-y":[{"skew-y":te()}],transform:[{transform:[kr,vr,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",kr,vr]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",kr,vr]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[Vn,oT,q0,UIe]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","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-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},hDr=(e,{cacheSize:t,prefix:r,experimentalParseClassName:n,extend:s={},override:a={}})=>(QT(e,"cacheSize",t),QT(e,"prefix",r),QT(e,"experimentalParseClassName",n),YD(e.theme,a.theme),YD(e.classGroups,a.classGroups),YD(e.conflictingClassGroups,a.conflictingClassGroups),YD(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),QT(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),XD(e.theme,s.theme),XD(e.classGroups,s.classGroups),XD(e.conflictingClassGroups,s.conflictingClassGroups),XD(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),ndt(e,s,"orderSensitiveModifiers"),e),QT=(e,t,r)=>{r!==void 0&&(e[t]=r)},YD=(e,t)=>{if(t)for(const r in t)QT(e,r,t[r])},XD=(e,t)=>{if(t)for(const r in t)ndt(e,t,r)},ndt=(e,t,r)=>{const n=t[r];n!==void 0&&(e[r]=e[r]?e[r].concat(n):n)},pDr=(e,...t)=>typeof e=="function"?BIe(HIe,e,...t):BIe(()=>hDr(HIe(),e),...t),mDr=Object.keys({...Lb,...d9t}),gDr=Object.keys(y9t),yDr=Object.keys(f9t),vDr=Object.keys(h9t),bDr=Object.keys(u9t),H0=Object.keys(g9t),xDr=Object.keys(p9t).concat(Object.keys(m9t)),wDr=pDr({extend:{theme:{color:mDr,spacing:gDr,radius:bDr,leading:vDr,shadow:xDr},classGroups:{"font-size":[{text:yDr}],h:[{h:H0}],w:[{w:H0}],size:[{size:H0}],"min-h":[{"min-h":H0}],"min-w":[{"min-w":H0}],"max-h":[{"max-h":H0}],"max-w":[{"max-w":H0}]}}});function Z(...e){return wDr(Uut(e))}const SDr={sm:`${Ql.sm} text-ui-sm px-[.75em]`,md:`${Ql.md} text-ui-md px-[.75em]`,default:`${Ql.default} text-ui-md px-[.85em] `,lg:`${Ql.lg} text-ui-lg px-[1em] `},ODr={default:"bg-surface3 border-2 border-border1 hover:text-neutral6 hover:bg-surface4 active:bg-surface5 text-neutral5",primary:"bg-surface4 border-2 border-border2 hover:text-neutral6 hover:bg-surface5 active:bg-surface6 text-neutral6",cta:"bg-accent1/50 hover:bg-accent1/80 text-neutral5 font-semibold",ghost:"bg-transparent border-2 border-transparent hover:text-neutral6 hover:bg-surface4 active:bg-surface5 text-neutral4",inputLike:nme,light:"",outline:"",link:"inline-flex justify-start rounded-none h-auto px-0 bg-transparent text-neutral3 hover:text-neutral4 gap-1 [&>svg]:mx-0 w-auto [&>svg]:opacity-70"},kDr=Z("flex items-center justify-center gap-[.75em] leading-0 transition-colors duration-200 ease-out-custom rounded-lg","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mx-[-.3em]","[&>svg]:opacity-50 [&:hover>svg]:opacity-100",ame,sme),_Dr={light:"default",outline:"default"};function EDr(e){return _Dr[e]??e}function pC(e){const t=EDr(e?.variant||"default"),r=e?.size||"default";return Z(kDr,SDr[r],ODr[t],e?.iconOnly&&"[&>svg]:opacity-75")}function sdt(e){const t=[];return je.Children.forEach(e,r=>{je.isValidElement(r)&&r.type===je.Fragment?t.push(...sdt(r.props.children)):t.push(r)}),t}function CDr(e){const t=sdt(e);return t.length>0&&t.every(r=>je.isValidElement(r))}const pe=je.forwardRef(({className:e,as:t,size:r="default",variant:n="default",disabled:s,children:a,...i},l)=>{const c=t||"button",u=CDr(a);return o.jsx(c,{ref:l,disabled:s,className:Z(pC({variant:n,size:r,iconOnly:u}),e),...i,children:a})});pe.displayName="Button";const ld=M3t,Yr=D3t,Xr=L3t,Wr=b.forwardRef(({className:e,sideOffset:t=4,children:r,...n},s)=>o.jsx($3t,{children:o.jsxs(_qe,{ref:s,sideOffset:t,className:Z("z-50 overflow-hidden rounded-md bg-surface3 px-3 py-1.5 text-xs text-neutral4 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,children:[r,o.jsx(F3t,{className:"fill-surface3"})]})}));Wr.displayName=_qe.displayName;const Cn=je.forwardRef(({tooltipContent:e,...t},r)=>o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(pe,{ref:r,...t})}),e&&o.jsx(Wr,{children:e})]}));Cn.displayName="ButtonWithTooltip";const jDr={sm:"[&>svg]:h-icon-sm [&>svg]:w-icon-sm",default:"[&>svg]:h-icon-default [&>svg]:w-icon-default",lg:"[&>svg]:h-icon-lg [&>svg]:w-icon-lg"},Ce=({children:e,className:t,size:r="default",...n})=>o.jsx("span",{className:Z("block",jDr[r],t),...n,children:e}),sn={colors:"transition-colors duration-normal ease-out-custom",all:"transition-all duration-normal ease-out-custom",opacity:"transition-opacity duration-normal ease-out-custom",allSlow:"transition-all duration-slow ease-out-custom"},c0={visible:"focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},adt=({children:e})=>o.jsx("nav",{className:"bg-surface2 min-h-full overflow-hidden",children:e}),T4=({children:e,as:t="a",href:r,className:n,prefetch:s,to:a})=>o.jsx(t,{href:r,prefetch:s,to:a,className:Z("text-ui-sm flex h-full w-full flex-col justify-center font-medium cursor-pointer",sn.colors,n),children:e}),idt=({children:e})=>o.jsx("ol",{"data-testid":"thread-list",children:e}),N4=({children:e,isActive:t,className:r})=>o.jsx("li",{className:Z("border-b border-border1 group flex h-[54px] items-center justify-between gap-2 px-3 py-2",sn.colors,"hover:bg-surface3",t&&"bg-accent1Dark",r),children:e}),odt=({onClick:e})=>o.jsx(pe,{variant:"ghost",className:Z("shrink-0 opacity-0",sn.all,"group-focus-within:opacity-100 group-hover:opacity-100","hover:bg-surface4 hover:text-accent2"),onClick:e,children:o.jsx(Ce,{children:o.jsx(Xl,{"aria-label":"delete thread",className:"text-neutral3 hover:text-accent2 transition-colors"})})}),TDr={"ui-xs":"text-ui-xs leading-ui-xs","ui-sm":"text-ui-sm leading-ui-sm","ui-smd":"text-ui-smd leading-ui-smd","ui-md":"text-ui-md leading-ui-md","ui-lg":"text-ui-lg leading-ui-lg","header-xs":"text-header-xs leading-header-xs","header-sm":"text-header-sm leading-header-sm","header-md":"text-header-md leading-header-md","header-lg":"text-header-lg leading-header-lg","header-xl":"text-header-xl leading-header-xl"},NDr={mono:"font-mono"},me=({as:e="p",className:t,variant:r="ui-md",font:n,...s})=>o.jsx(e,{className:Z(TDr[r],n&&NDr[n],t),...s}),pa=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 15C10.3565 15 12.137 14.2625 13.4497 12.9497C14.7625 11.637 15.5 9.85652 15.5 8C15.5 6.14348 14.7625 4.36301 13.4497 3.05025C12.137 1.7375 10.3565 1 8.5 1C6.64348 1 4.86301 1.7375 3.55025 3.05025C2.2375 4.36301 1.5 6.14348 1.5 8C1.5 9.85652 2.2375 11.637 3.55025 12.9497C4.86301 14.2625 6.64348 15 8.5 15ZM5.621 10.879L4.611 11.889C3.84179 11.1198 3.31794 10.1398 3.1057 9.07291C2.89346 8.00601 3.00236 6.90013 3.41864 5.89512C3.83491 4.89012 4.53986 4.03112 5.44434 3.42676C6.34881 2.8224 7.41219 2.49983 8.5 2.49983C9.58781 2.49983 10.6512 2.8224 11.5557 3.42676C12.4601 4.03112 13.1651 4.89012 13.5814 5.89512C13.9976 6.90013 14.1065 8.00601 13.8943 9.07291C13.6821 10.1398 13.1582 11.1198 12.389 11.889L11.379 10.879C11.1004 10.6003 10.7696 10.3792 10.4055 10.2284C10.0414 10.0776 9.6511 9.99995 9.257 10H7.743C7.3489 9.99995 6.95865 10.0776 6.59455 10.2284C6.23045 10.3792 5.89963 10.6003 5.621 10.879Z",fill:"currentColor"}),o.jsx("path",{d:"M8.5 4C7.96957 4 7.46086 4.21071 7.08579 4.58579C6.71071 4.96086 6.5 5.46957 6.5 6V6.5C6.5 7.03043 6.71071 7.53914 7.08579 7.91421C7.46086 8.28929 7.96957 8.5 8.5 8.5C9.03043 8.5 9.53914 8.28929 9.91421 7.91421C10.2893 7.53914 10.5 7.03043 10.5 6.5V6C10.5 5.46957 10.2893 4.96086 9.91421 4.58579C9.53914 4.21071 9.03043 4 8.5 4Z",fill:"currentColor"})]}),ADr=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M11.0313 7.97578C11.0313 9.34436 9.92183 10.4538 8.55324 10.4538C7.18466 10.4538 6.0752 9.34436 6.0752 7.97578C6.0752 6.60719 7.18466 5.49773 8.55324 5.49773C9.92183 5.49773 11.0313 6.60719 11.0313 7.97578ZM11.0313 7.97578H14.573",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"}),o.jsx("path",{d:"M12.967 4.46154C11.9273 3.14431 10.3165 2.29883 8.50814 2.29883C5.37277 2.29883 2.83105 4.84055 2.83105 7.97591C2.83105 11.1113 5.37277 13.653 8.50814 13.653C10.3165 13.653 11.9273 12.8075 12.967 11.4903",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"})]}),lme=e=>o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.97865 4.57004C8.22604 4.75795 8.27426 5.11082 8.08635 5.35821L6.05486 8.03279C5.94873 8.17251 5.78348 8.25471 5.60803 8.25505C5.43257 8.2554 5.267 8.17385 5.16032 8.03454L3.80937 6.27034C3.6205 6.02369 3.66733 5.67063 3.91398 5.48176C4.16063 5.29288 4.51369 5.33972 4.70257 5.58637L5.6051 6.76498L7.19048 4.67774C7.37839 4.43036 7.73126 4.38213 7.97865 4.57004Z",fill:"currentColor"})]}),cme=e=>o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.89741 4.10293C8.11707 4.32261 8.11706 4.67877 7.89738 4.89843L6.79517 6.00058L7.8962 7.10155C8.11588 7.32122 8.11589 7.67737 7.89623 7.89705C7.67656 8.11673 7.32041 8.11674 7.10073 7.89707L5.99965 6.79605L4.89856 7.89707C4.67889 8.11673 4.32273 8.11672 4.10307 7.89704C3.88341 7.67737 3.88342 7.32121 4.10309 7.10155L5.20413 6.00058L4.10191 4.89843C3.88224 4.67877 3.88223 4.32262 4.10189 4.10294C4.32155 3.88326 4.67771 3.88325 4.89738 4.10292L5.99965 5.20511L7.10191 4.10291C7.32159 3.88325 7.67774 3.88326 7.89741 4.10293Z",fill:"currentColor"})]}),u0=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.1747 3.18598L7.02554 1.95209C7.11557 1.89207 7.31087 1.87106 7.41016 1.90924L12.4139 3.83377C12.4683 3.85467 12.546 3.96798 12.546 4.03118V13.0167C12.546 13.265 12.7473 13.4663 12.9956 13.4663C13.2439 13.4663 13.4452 13.265 13.4452 13.0167V4.03118C13.4452 3.59605 13.1384 3.14906 12.7367 2.99456L7.73293 1.07004C7.36225 0.927472 6.86056 0.981451 6.52679 1.20396L4.20445 2.75219L3.90419 2.95236L3.90647 2.95824C3.69329 3.05449 3.55469 3.27599 3.55469 3.57581V11.7119C3.55469 12.2084 3.93067 12.7499 4.39251 12.9206L9.89804 14.955C10.3608 15.126 10.7359 14.8596 10.7359 14.3659V5.83295C10.7359 5.33662 10.3498 4.81289 9.88389 4.66643L5.1747 3.18598Z",fill:"currentColor"})}),ldt=e=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:o.jsx("path",{d:"M7.5 0.75C3.6325 0.75 0.5 3.8825 0.5 7.75C0.5 10.8475 2.50375 13.4637 5.28625 14.3912C5.63625 14.4525 5.7675 14.2425 5.7675 14.0587C5.7675 13.8925 5.75875 13.3412 5.75875 12.755C4 13.0787 3.545 12.3262 3.405 11.9325C3.32625 11.7312 2.985 11.11 2.6875 10.9437C2.4425 10.8125 2.0925 10.4887 2.67875 10.48C3.23 10.4712 3.62375 10.9875 3.755 11.1975C4.385 12.2562 5.39125 11.9587 5.79375 11.775C5.855 11.32 6.03875 11.0137 6.24 10.8387C4.6825 10.6637 3.055 10.06 3.055 7.3825C3.055 6.62125 3.32625 5.99125 3.7725 5.50125C3.7025 5.32625 3.4575 4.60875 3.8425 3.64625C3.8425 3.64625 4.42875 3.4625 5.7675 4.36375C6.3275 4.20625 6.9225 4.1275 7.5175 4.1275C8.1125 4.1275 8.7075 4.20625 9.2675 4.36375C10.6062 3.45375 11.1925 3.64625 11.1925 3.64625C11.5775 4.60875 11.3325 5.32625 11.2625 5.50125C11.7087 5.99125 11.98 6.6125 11.98 7.3825C11.98 10.0687 10.3438 10.6637 8.78625 10.8387C9.04 11.0575 9.25875 11.4775 9.25875 12.1337C9.25875 13.07 9.25 13.8225 9.25 14.0587C9.25 14.2425 9.38125 14.4612 9.73125 14.3912C11.1209 13.9221 12.3284 13.029 13.1839 11.8377C14.0393 10.6463 14.4996 9.21668 14.5 7.75C14.5 3.8825 11.3675 0.75 7.5 0.75Z",fill:"currentColor"})}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21999_22095",children:o.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),cdt=e=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[o.jsx("path",{d:"M13.5037 7.54867C13.5037 7.1144 13.4648 6.69683 13.3924 6.29596H7.62436V8.66776H10.9204C10.7756 9.43052 10.3413 10.0764 9.68994 10.5106V12.0529H11.6776C12.8356 10.9839 13.5037 9.41382 13.5037 7.54867Z",fill:"#4285F4"}),o.jsx("path",{d:"M7.62415 13.5339C9.27773 13.5339 10.6643 12.9882 11.6776 12.0529L9.68994 10.5106C9.14431 10.8781 8.44816 11.1009 7.62415 11.1009C6.03182 11.1009 4.67889 10.0263 4.19451 8.57877H2.15677V10.16C3.1645 12.1587 5.23008 13.5339 7.62415 13.5339Z",fill:"#34A853"}),o.jsx("path",{d:"M4.19472 8.57315C4.07223 8.20569 3.99985 7.81595 3.99985 7.40952C3.99985 7.00308 4.07223 6.61335 4.19472 6.24589V4.66469H2.15698C1.73941 5.4887 1.5 6.41849 1.5 7.40952C1.5 8.40055 1.73941 9.33034 2.15698 10.1543L3.74374 8.91834L4.19472 8.57315Z",fill:"#FBBC05"}),o.jsx("path",{d:"M7.62415 3.72376C8.5261 3.72376 9.32783 4.03555 9.96811 4.63685L11.7219 2.88306C10.6585 1.89202 9.27773 1.28516 7.62415 1.28516C5.23008 1.28516 3.16471 2.66036 2.15698 4.66469L4.19472 6.24589C4.6791 4.79832 6.03182 3.72376 7.62415 3.72376Z",fill:"#EA4335"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21999_20513",children:o.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),IDr=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M4.31445 3.16083C3.78402 3.16083 3.27531 3.37154 2.90024 3.74661C2.52517 4.12169 2.31445 4.63039 2.31445 5.16083V5.66083C2.31445 6.19126 2.52517 6.69997 2.90024 7.07504C3.27531 7.45011 3.78402 7.66083 4.31445 7.66083C4.84489 7.66083 5.35359 7.45011 5.72867 7.07504C6.10374 6.69997 6.31445 6.19126 6.31445 5.66083V5.16083C6.31445 4.63039 6.10374 4.12169 5.72867 3.74661C5.35359 3.37154 4.84489 3.16083 4.31445 3.16083Z",fill:"currentColor"}),o.jsx("path",{d:"M6.76666 9.50235C6.57678 9.28532 6.30244 9.16083 6.01407 9.16083H4.50201C4.10791 9.16078 3.71766 9.23838 3.35356 9.38921C3.11733 9.48706 2.8951 9.6145 2.69205 9.76806C2.48056 9.928 2.38001 10.1888 2.38001 10.454V13.0642C2.38001 13.6165 2.82773 14.0642 3.38001 14.0642H8.55436C9.4135 14.0642 9.87269 13.0523 9.30695 12.4057L6.76666 9.50235Z",fill:"currentColor"}),o.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),o.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),o.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),M9=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M3.8674 9.19968L4.14554 10.8649C4.23965 11.4283 4.75254 11.8237 5.32137 11.7713L5.58252 11.7472C6.56555 11.6567 7.43309 12.3868 7.51181 13.3708L7.59308 14.3867C7.60422 14.5259 7.71868 14.6342 7.85825 14.6376L9.91053 14.6876C10.1066 14.6924 10.2434 14.4948 10.17 14.3129L8.90452 11.1782C8.80956 10.9429 8.65085 10.7389 8.44626 10.5889L7.90134 10.1895C7.70604 10.0464 7.55223 9.85411 7.45759 9.63124C7.15011 8.90712 6.6579 7.71234 6.37054 6.88944C6.19204 6.3783 5.79931 6.29158 5.45492 6.21553C4.98179 6.11106 4.5999 6.02673 4.99001 4.88985C5.66408 2.92541 8.06015 2.07904 10.6601 3.33088C12.6488 4.2884 13.1187 6.35416 13.0328 7.58237C13.0297 7.62768 13.0214 7.67186 13.0094 7.71566C12.8829 8.17534 12.368 8.40491 11.9415 8.19169L10.3022 7.37201C10.2069 7.32439 10.0927 7.33657 10.0096 7.40322L8.64809 8.49559C8.55405 8.57104 8.52072 8.69931 8.56615 8.811L10.8995 14.5478C10.9404 14.6483 11.0369 14.715 11.1454 14.7177L12.0572 14.7399C12.2581 14.7448 12.3951 14.5382 12.3124 14.3551L11.8681 13.3706C11.4211 12.3803 11.6047 11.2192 12.3354 10.4151L13.4616 9.17575C13.7473 8.86125 13.9224 8.46187 13.9599 8.03858L13.9763 7.85359C14.2866 4.35298 11.377 1.41272 7.87336 1.68639C6.03919 1.82965 4.45399 3.02228 3.80807 4.74492L3.70275 5.02579C3.5828 5.34571 3.62741 5.70411 3.82213 5.98485L3.88946 6.08192C4.12183 6.41695 4.0958 6.86726 3.82637 7.17328L3.06705 8.03572C2.96261 8.15435 2.98058 8.33664 3.10617 8.43259L3.66059 8.85617C3.77064 8.94026 3.84458 9.06307 3.8674 9.19968Z",fill:"currentColor"})}),ume=e=>o.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.40864 11.9983C7.58064 11.9733 6.84164 11.6153 6.31564 11.0563C6.31464 11.0563 6.31464 11.0553 6.31464 11.0553C5.78864 10.4963 5.47564 9.73633 5.50064 8.90833C5.52564 8.08033 5.88464 7.34133 6.44364 6.81533C7.00264 6.28833 7.76264 5.97633 8.59064 6.00133C9.41864 6.02633 10.1576 6.38433 10.6836 6.94333H10.6846C11.2106 7.50333 11.5236 8.26233 11.4986 9.09033C11.4726 9.91833 11.1146 10.6583 10.5556 11.1843C9.99664 11.7103 9.23664 12.0233 8.40864 11.9983ZM16.1266 8.15033L14.3606 7.74033C14.2316 7.14133 14.0146 6.57633 13.7216 6.05733L14.7726 4.57933C14.9116 4.38533 14.8926 4.12033 14.7296 3.94633L13.9206 3.08733C13.7576 2.91333 13.4946 2.87933 13.2916 3.00533L11.7526 3.96533C11.2526 3.64133 10.7016 3.39033 10.1116 3.22633L9.80964 1.43833C9.76964 1.20333 9.56964 1.02833 9.33164 1.02133L8.15264 0.985326C7.91364 0.978326 7.70364 1.14033 7.64964 1.37233L7.24064 3.13933C6.64164 3.26733 6.07664 3.48433 5.55664 3.77733L4.07864 2.72633C3.88464 2.58833 3.61964 2.60633 3.44664 2.76933L2.58664 3.57833C2.41364 3.74133 2.37964 4.00533 2.50564 4.20733L3.46564 5.74633C3.14164 6.24633 2.89064 6.79833 2.72564 7.38833L0.937635 7.68933C0.702635 7.72933 0.528635 7.92933 0.520635 8.16733L0.485635 9.34733C0.477635 9.58533 0.639635 9.79533 0.872635 9.84933L2.63864 10.2583C2.76764 10.8573 2.98464 11.4233 3.27764 11.9423L2.22564 13.4203C2.08764 13.6143 2.10564 13.8793 2.26964 14.0523L3.07864 14.9123C3.24164 15.0853 3.50464 15.1203 3.70664 14.9933L5.24564 14.0333C5.74663 14.3583 6.29764 14.6093 6.88764 14.7733L7.18964 16.5613C7.22864 16.7963 7.42864 16.9713 7.66764 16.9783L8.84663 17.0143C9.08564 17.0213 9.29564 16.8593 9.34964 16.6273L9.75864 14.8603C10.3576 14.7323 10.9226 14.5153 11.4416 14.2213L12.9206 15.2733C13.1146 15.4113 13.3786 15.3933 13.5526 15.2293L14.4116 14.4213C14.5856 14.2573 14.6196 13.9943 14.4936 13.7923L13.5336 12.2533C13.8576 11.7523 14.1086 11.2013 14.2726 10.6113L16.0616 10.3103C16.2966 10.2703 16.4706 10.0703 16.4776 9.83233L16.5136 8.65233C16.5206 8.41433 16.3586 8.20433 16.1266 8.15033Z",fill:"currentColor"})}),RDr=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),Pi=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.5605 1.42351C8.0791 0.904904 8.92215 0.906157 9.4395 1.42351L10.6922 2.67617C11.2108 3.19477 11.2095 4.03782 10.6922 4.55517L9.4395 5.80783C8.9209 6.32643 8.07785 6.32518 7.5605 5.80783L6.30784 4.55517C5.78923 4.03656 5.79049 3.19352 6.30784 2.67617L7.5605 1.42351ZM3.17618 5.80783C3.69478 5.28923 4.53782 5.29048 5.05517 5.80783L6.30784 7.0605C6.82644 7.5791 6.82519 8.42214 6.30784 8.93949L5.05517 10.1922C4.53657 10.7108 3.69353 10.7095 3.17618 10.1922L1.92351 8.93949C1.40491 8.42089 1.40616 7.57785 1.92351 7.0605L3.17618 5.80783ZM11.9448 5.80783C12.4634 5.28923 13.3065 5.29048 13.8238 5.80783L15.0765 7.0605C15.5951 7.5791 15.5938 8.42214 15.0765 8.93949L13.8238 10.1922C13.3052 10.7108 12.4622 10.7095 11.9448 10.1922L10.6922 8.93949C10.1736 8.42089 10.1748 7.57785 10.6922 7.0605L11.9448 5.80783ZM7.5605 10.1922C8.0791 9.67355 8.92215 9.67481 9.4395 10.1922L10.6922 11.4448C11.2108 11.9634 11.2095 12.8065 10.6922 13.3238L9.4395 14.5765C8.9209 15.0951 8.07785 15.0938 7.5605 14.5765L6.30784 13.3238C5.78923 12.8052 5.79049 11.9622 6.30784 11.4448L7.5605 10.1922Z",fill:"currentColor"})}),mC=e=>o.jsx(l9t,{...e}),Mi=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.24388 2.4018C6.24388 2.0394 6.53767 1.74561 6.90008 1.74561H10.0991C10.4614 1.74561 10.7553 2.0394 10.7553 2.4018V4.57546C10.7553 4.93787 10.4614 5.23166 10.0991 5.23166H9.31982V7.35469L10.0033 9.22664C9.90442 9.20146 9.80035 9.1761 9.6915 9.14986L9.62652 9.13422C9.30473 9.05687 8.92256 8.96501 8.61993 8.84491C8.5819 8.82981 8.54147 8.81292 8.49957 8.79391C8.45767 8.81292 8.41724 8.82981 8.3792 8.84491C8.07657 8.96501 7.6944 9.05687 7.37261 9.13422L7.30763 9.14986C7.19879 9.1761 7.09471 9.20146 6.99577 9.22664L7.67932 7.35469V5.23166H6.90008C6.53767 5.23166 6.24388 4.93787 6.24388 4.57546V2.4018ZM6.99577 9.22664C6.99577 9.22664 6.99578 9.22664 6.99577 9.22664L6.43283 10.7683H6.81806C7.18047 10.7683 7.47426 11.0622 7.47426 11.4245V13.5982C7.47426 13.9606 7.18047 14.2544 6.81806 14.2544H3.61909C3.25668 14.2544 2.96289 13.9606 2.96289 13.5982V11.4245C2.96289 11.0622 3.25668 10.7683 3.61909 10.7683H4.26617C4.2921 10.4663 4.32783 10.1494 4.37744 9.85171C4.43762 9.49063 4.52982 9.08135 4.68998 8.76102C4.93975 8.2615 5.44743 8.01751 5.7771 7.88788C6.14684 7.74249 6.57537 7.63889 6.92317 7.55505C7.24707 7.47696 7.49576 7.41679 7.67932 7.35469L6.99577 9.22664ZM6.43283 10.7683L6.99577 9.22664C6.75846 9.28705 6.55067 9.34646 6.37745 9.41458C6.22784 9.47341 6.1623 9.51712 6.14023 9.53254C6.09752 9.63631 6.04409 9.83055 5.99562 10.1214C5.96201 10.3231 5.93498 10.5439 5.91341 10.7683H6.43283ZM10.0033 9.22664L9.31982 7.35469C9.50338 7.41679 9.75206 7.47696 10.076 7.55505C10.4238 7.63889 10.8523 7.74249 11.2221 7.88788C11.5517 8.01751 12.0594 8.2615 12.3091 8.76102C12.4693 9.08135 12.5615 9.49063 12.6217 9.85171C12.6713 10.1494 12.707 10.4663 12.733 10.7683H13.38C13.7424 10.7683 14.0362 11.0622 14.0362 11.4245V13.5982C14.0362 13.9606 13.7424 14.2544 13.38 14.2544H10.1811C9.81867 14.2544 9.52488 13.9606 9.52488 13.5982V11.4245C9.52488 11.0622 9.81867 10.7683 10.1811 10.7683H10.5663L10.0033 9.22664ZM10.0033 9.22664L10.5663 10.7683H11.0857C11.0642 10.5439 11.0372 10.3231 11.0035 10.1214C10.9551 9.83055 10.9016 9.63631 10.8589 9.53254C10.8369 9.51712 10.7713 9.47341 10.6217 9.41458C10.4485 9.34646 10.2407 9.28705 10.0033 9.22664Z",fill:"currentColor"})}),vl=e=>o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M6.53918 9.32122C6.34324 9.51508 6.02724 9.51338 5.83338 9.31744C5.63952 9.1215 5.6412 8.80551 5.83713 8.61164L10.1958 4.29931C10.7996 3.70186 10.8017 2.72852 10.2041 2.12839L10.1899 2.11428C9.58767 1.52481 8.62251 1.53208 8.0292 2.13052L2.29396 7.91536C2.0999 8.1111 1.78388 8.11246 1.58813 7.9184C1.39239 7.72433 1.39103 7.40831 1.58509 7.21257L7.32036 1.42774C8.30005 0.439581 9.89369 0.427613 10.8881 1.40094L10.9116 1.42425C11.4942 2.00929 11.7316 2.80913 11.6232 3.56922C12.389 3.44866 13.1999 3.67918 13.7961 4.26273C14.804 5.24929 14.8147 6.86824 13.82 7.86808L8.5531 13.1619C8.50045 13.2148 8.50024 13.3002 8.55263 13.3534L9.65448 14.4717C9.84794 14.668 9.8456 14.984 9.64925 15.1775C9.45291 15.3709 9.13691 15.3686 8.94345 15.1723L7.84163 14.054C7.40505 13.6109 7.40677 12.8988 7.8455 12.4579L13.1124 7.16405C13.7161 6.55727 13.7095 5.57478 13.0979 4.97606C12.4925 4.38347 11.4942 4.40725 10.8978 5.00886L6.53918 9.32122Z",fill:"currentColor"}),o.jsx("path",{d:"M8.84622 2.75411C9.04697 2.56188 9.36555 2.56381 9.56395 2.76076C9.76234 2.95771 9.76658 3.27625 9.57582 3.4784L9.56661 3.48794L5.25912 7.82701C4.67023 8.42022 4.672 9.37798 5.26305 9.96904C5.85624 10.5622 6.81818 10.5615 7.41052 9.9675L11.6299 5.73599L11.6395 5.72671C11.8406 5.53493 12.1592 5.53756 12.3572 5.73496C12.5583 5.93548 12.5587 6.26104 12.3582 6.46214L8.13877 10.6937C7.14498 11.6903 5.53105 11.6915 4.53584 10.6963C3.5442 9.70461 3.54127 8.09774 4.52928 7.10248L8.83677 2.76342L8.84622 2.75411Z",fill:"currentColor"})]}),D9=e=>o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M1.5 8.5V8C1.5 7.60218 1.65804 7.22064 1.93934 6.93934C2.22064 6.65804 2.60218 6.5 3 6.5H13C13.3978 6.5 13.7794 6.65804 14.0607 6.93934C14.342 7.22064 14.5 7.60218 14.5 8V8.5M8.70667 4.20667L7.29333 2.79333C7.20048 2.70037 7.09022 2.62661 6.96886 2.57628C6.84749 2.52595 6.71739 2.50003 6.586 2.5H3C2.60218 2.5 2.22064 2.65804 1.93934 2.93934C1.65804 3.22064 1.5 3.60218 1.5 4V12C1.5 12.3978 1.65804 12.7794 1.93934 13.0607C2.22064 13.342 2.60218 13.5 3 13.5H13C13.3978 13.5 13.7794 13.342 14.0607 13.0607C14.342 12.7794 14.5 12.3978 14.5 12V6C14.5 5.60218 14.342 5.22064 14.0607 4.93934C13.7794 4.65804 13.3978 4.5 13 4.5H9.414C9.14887 4.49977 8.89402 4.39426 8.70667 4.20667Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});function fp(e){return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),o.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),o.jsx("path",{d:"M15 2v2"}),o.jsx("path",{d:"M15 20v2"}),o.jsx("path",{d:"M2 15h2"}),o.jsx("path",{d:"M2 9h2"}),o.jsx("path",{d:"M20 15h2"}),o.jsx("path",{d:"M20 9h2"}),o.jsx("path",{d:"M9 2v2"}),o.jsx("path",{d:"M9 20v2"})]})}const udt=e=>o.jsxs("svg",{className:"h-3 w-3",width:"16",height:"16",viewBox:"0 0 181 108",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsxs("g",{clipPath:"url(#clip0_1480_1723)",children:[o.jsx("path",{d:"M51.2203 39.3158C51.2203 41.5066 51.4572 43.2829 51.8717 44.5856C52.3453 45.8882 52.9374 47.3093 53.7664 48.8487C54.0624 49.3224 54.1809 49.7961 54.1809 50.2106C54.1809 50.8027 53.8256 51.3948 53.0559 51.9869L49.3256 54.4737C48.7927 54.829 48.2598 55.0066 47.7861 55.0066C47.194 55.0066 46.6019 54.7106 46.0098 54.1777C45.1809 53.2895 44.4703 52.3422 43.8782 51.3948C43.2861 50.3882 42.694 49.2632 42.0427 47.9014C37.4243 53.3487 31.6217 56.0724 24.6348 56.0724C19.6611 56.0724 15.694 54.6514 12.7927 51.8093C9.8914 48.9672 8.41113 45.1777 8.41113 40.4408C8.41113 35.4079 10.1874 31.3224 13.7993 28.2435C17.4111 25.1645 22.2072 23.6251 28.3059 23.6251C30.319 23.6251 32.3914 23.8027 34.5822 24.0987C36.773 24.3948 39.023 24.8685 41.3914 25.4014V21.079C41.3914 16.579 40.444 13.4408 38.6085 11.6053C36.7138 9.76979 33.5164 8.88163 28.9572 8.88163C26.8848 8.88163 24.7532 9.11847 22.5624 9.65137C20.3717 10.1843 18.2401 10.8356 16.1677 11.6645C15.2203 12.079 14.5098 12.3158 14.0953 12.4343C13.6809 12.5527 13.3848 12.6119 13.148 12.6119C12.319 12.6119 11.9046 12.0198 11.9046 10.7764V7.87505C11.9046 6.92768 12.023 6.21716 12.319 5.80268C12.6151 5.38821 13.148 4.97374 13.9769 4.55926C16.0493 3.49347 18.5361 2.60531 21.4374 1.89479C24.3388 1.12505 27.4177 0.769788 30.6743 0.769788C37.7203 0.769788 42.8717 2.36847 46.1875 5.56584C49.444 8.76321 51.1019 13.6185 51.1019 20.1316V39.3158H51.2203ZM27.1809 48.3158C29.1348 48.3158 31.148 47.9606 33.2796 47.2501C35.4111 46.5395 37.3059 45.2369 38.9046 43.4606C39.8519 42.3356 40.5625 41.0922 40.9177 39.6711C41.273 38.2501 41.5098 36.5329 41.5098 34.5198V32.0329C39.7927 31.6185 37.9572 31.2632 36.0624 31.0264C34.1677 30.7895 32.3322 30.6711 30.4967 30.6711C26.5296 30.6711 23.6282 31.4408 21.6743 33.0395C19.7203 34.6382 18.773 36.8882 18.773 39.8487C18.773 42.6316 19.4835 44.704 20.9638 46.1251C22.3848 47.6053 24.4572 48.3158 27.1809 48.3158ZM74.7269 54.7106C73.6611 54.7106 72.9506 54.5329 72.4769 54.1185C72.0032 53.7632 71.5888 52.9343 71.2335 51.8093L57.319 6.03953C56.9638 4.85531 56.7861 4.08558 56.7861 3.6711C56.7861 2.72374 57.2598 2.19084 58.2072 2.19084H64.0098C65.1348 2.19084 65.9046 2.36847 66.319 2.78295C66.7927 3.13821 67.148 3.96716 67.5032 5.09216L77.4506 44.2895L86.6874 5.09216C86.9835 3.90795 87.3388 3.13821 87.8124 2.78295C88.2861 2.42768 89.1151 2.19084 90.1809 2.19084H94.9177C96.0427 2.19084 96.8124 2.36847 97.2861 2.78295C97.7598 3.13821 98.1743 3.96716 98.4111 5.09216L107.766 44.7632L118.01 5.09216C118.365 3.90795 118.78 3.13821 119.194 2.78295C119.668 2.42768 120.437 2.19084 121.503 2.19084H127.01C127.957 2.19084 128.49 2.66453 128.49 3.6711C128.49 3.96716 128.431 4.26321 128.372 4.61847C128.312 4.97374 128.194 5.44742 127.957 6.09874L113.687 51.8685C113.332 53.0527 112.918 53.8224 112.444 54.1777C111.97 54.5329 111.201 54.7698 110.194 54.7698H105.102C103.977 54.7698 103.207 54.5922 102.733 54.1777C102.26 53.7632 101.845 52.9935 101.608 51.8093L92.4309 13.6185L83.3125 51.7501C83.0164 52.9343 82.6611 53.704 82.1874 54.1185C81.7138 54.5329 80.8848 54.7106 79.819 54.7106H74.7269ZM150.812 56.3093C147.734 56.3093 144.655 55.954 141.694 55.2435C138.733 54.5329 136.424 53.7632 134.885 52.8751C133.937 52.3422 133.286 51.7501 133.049 51.2172C132.812 50.6843 132.694 50.0922 132.694 49.5593V46.5395C132.694 45.2961 133.168 44.704 134.056 44.704C134.411 44.704 134.766 44.7632 135.122 44.8816C135.477 45.0001 136.01 45.2369 136.602 45.4737C138.615 46.3619 140.806 47.0724 143.115 47.5461C145.484 48.0198 147.793 48.2566 150.161 48.2566C153.891 48.2566 156.793 47.6053 158.806 46.3027C160.819 45 161.885 43.1053 161.885 40.6777C161.885 39.0198 161.352 37.6579 160.286 36.5329C159.22 35.4079 157.207 34.4014 154.306 33.454L145.72 30.7895C141.398 29.4277 138.201 27.4145 136.247 24.7501C134.293 22.1448 133.286 19.2435 133.286 16.1645C133.286 13.6777 133.819 11.4869 134.885 9.59216C135.951 7.69742 137.372 6.03953 139.148 4.73689C140.924 3.37505 142.937 2.36847 145.306 1.65795C147.674 0.94742 150.161 0.651367 152.766 0.651367C154.069 0.651367 155.431 0.710578 156.734 0.888209C158.095 1.06584 159.339 1.30268 160.582 1.53953C161.766 1.83558 162.891 2.13163 163.957 2.48689C165.023 2.84216 165.852 3.19742 166.444 3.55268C167.273 4.02637 167.865 4.50005 168.22 5.03295C168.576 5.50663 168.753 6.15795 168.753 6.98689V9.76979C168.753 11.0132 168.28 11.6645 167.391 11.6645C166.918 11.6645 166.148 11.4277 165.141 10.954C161.766 9.41453 157.977 8.64479 153.773 8.64479C150.398 8.64479 147.734 9.17768 145.898 10.3027C144.062 11.4277 143.115 13.1448 143.115 15.5724C143.115 17.2303 143.707 18.6514 144.891 19.7764C146.076 20.9014 148.266 22.0264 151.405 23.0329L159.812 25.6974C164.076 27.0593 167.155 28.954 168.99 31.3816C170.826 33.8093 171.714 36.5922 171.714 39.6711C171.714 42.2172 171.181 44.5264 170.174 46.5395C169.108 48.5527 167.687 50.329 165.852 51.7501C164.016 53.2303 161.826 54.2961 159.28 55.0658C156.615 55.8948 153.832 56.3093 150.812 56.3093Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M162.004 85.0856C142.524 99.4738 114.221 107.112 89.8855 107.112C55.7803 107.112 25.05 94.5001 1.83948 73.5396C0.00394917 71.8817 1.66184 69.6317 3.85263 70.9343C28.9579 85.5001 59.925 94.3225 91.9579 94.3225C113.57 94.3225 137.313 89.8225 159.162 80.5856C162.418 79.1054 165.201 82.7172 162.004 85.0856Z",fill:"#FF9900"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M170.115 75.8487C167.628 72.6513 153.654 74.3092 147.319 75.079C145.424 75.3158 145.128 73.6579 146.845 72.4145C157.976 64.5987 176.272 66.8487 178.404 69.454C180.536 72.1184 177.812 90.4145 167.391 99.1776C165.792 100.539 164.253 99.8289 164.963 98.0526C167.332 92.1908 172.601 78.9868 170.115 75.8487Z",fill:"#FF9900"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_1480_1723",children:o.jsx("rect",{width:"180",height:"107.763",fill:"white",transform:"translate(0.0625)"})})})]}),PDr=e=>o.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 320 320",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...e,children:o.jsx("path",{d:"m297.06 130.97c7.26-21.79 4.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13 22.48-76.91 55.82-22.51 4.61-41.94 18.7-53.31 38.67-17.59 30.32-13.58 68.54 9.92 94.54-7.26 21.79-4.76 45.66 6.85 65.48 17.46 30.4 52.56 46.04 86.84 38.68 15.24 17.18 37.16 26.95 60.13 26.8 35.06.09 66.16-22.49 76.94-55.86 22.51-4.61 41.94-18.7 53.31-38.67 17.57-30.32 13.55-68.51-9.94-94.51zm-120.28 168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26 1.34-.73 1.89-1.07l63.72-36.8c3.26-1.85 5.26-5.32 5.24-9.07v-89.83l26.93 15.55c.29.14.48.42.52.74v74.39c-.04 33.08-26.83 59.9-59.91 59.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28 1.3.79 1.89 1.13l63.72 36.8c3.23 1.89 7.23 1.89 10.47 0l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41 37.19c-28.69 16.52-65.33 6.7-81.92-21.95zm-16.77-139.09c7-12.16 18.05-21.46 31.21-26.29 0 .55-.03 1.52-.03 2.2v73.61c-.02 3.74 1.98 7.21 5.23 9.06l77.79 44.91-26.93 15.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26 51.49-77.79-44.92 26.93-15.54c.27-.18.61-.21.91-.08l64.42 37.19c28.68 16.57 38.51 53.26 21.94 81.94-7.01 12.14-18.05 21.44-31.2 26.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47 0l-77.79 44.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55 65.37-6.7 81.91 22 6.99 12.12 9.52 26.31 7.15 40.1zm-168.51 55.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12 26.89-59.96 60.01-59.94 14.01 0 27.57 4.92 38.34 13.88-.49.26-1.33.73-1.89 1.07l-63.72 36.8c-3.26 1.85-5.26 5.31-5.24 9.06l-.04 89.79zm14.63-31.54 34.65-20.01 34.65 20v40.01l-34.65 20-34.65-20z"})}),MDr=e=>o.jsx("svg",{className:"h-3 w-3",fill:"white",height:"78",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"78",style:{color:"currentcolor"},...e,children:o.jsx("g",{transform:"translate(0,2)",children:o.jsx("path",{d:"M11.375 0h-2.411L13.352 11.13h2.411L11.375 0ZM4.4 0 0 11.13h2.46l0.9-2.336h4.604l0.9 2.336h2.46L6.924 0H4.4Zm-0.244 6.723 1.506-3.909 1.506 3.909H4.156Z",fill:"currentColor"})})}),ddt=e=>o.jsx("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",...e,children:o.jsx("path",{d:"M7.402 13.8777C9.45763 13.4674 11.1555 13.128 11.175 13.1233L11.2104 13.1148L9.2697 10.507C8.2023 9.07276 7.32898 7.8937 7.32898 7.88691C7.32898 7.87404 9.33293 1.63997 9.3442 1.61779C9.34797 1.61037 10.7117 4.27017 12.65 8.06532C14.4647 11.6184 15.9608 14.5479 15.9747 14.5754L16 14.6253L9.83224 14.6244L3.66449 14.6235L7.402 13.8777ZM0 13.0824C0 13.0787 0.914457 11.2855 2.03212 9.09735L4.06425 5.11896L6.43245 2.87384C7.73497 1.63902 8.80417 0.627201 8.80845 0.625356C8.81274 0.623511 8.79561 0.672228 8.77038 0.733617C8.74515 0.795006 7.58796 3.59893 6.19884 6.96455L3.67317 13.0839L1.83659 13.0865C0.826464 13.0879 0 13.0861 0 13.0824Z",fill:"#0089D6",style:{fill:"#0089D6",fillOpacity:1}})}),DDr=e=>o.jsxs("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"17",height:"18",fill:"none",...e,children:[o.jsx("mask",{id:"mask0_174_2406",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"17",height:"18",children:o.jsx("path",{d:"M17 0.5H0V17.5H17V0.5Z",fill:"white"})}),o.jsxs("g",{mask:"url(#mask0_174_2406)",children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.50773 10.6219C5.9653 10.6219 6.8755 10.5968 8.13362 10.0788C9.59973 9.47518 12.5166 8.37942 14.6208 7.2539C16.0924 6.46668 16.7375 5.42553 16.7375 4.02344C16.7375 2.07751 15.16 0.5 13.2141 0.5H5.06095C2.26586 0.5 0 2.76586 0 5.56095C0 8.35604 2.12151 10.6219 5.50773 10.6219Z",fill:"#39594D"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.88672 14.107C6.88672 12.7369 7.71155 11.5016 8.97699 10.9764L11.5446 9.9108C14.1417 8.83294 17.0003 10.7415 17.0003 13.5535C17.0003 15.732 15.2339 17.4979 13.0553 17.4973L10.2754 17.4966C8.40372 17.4961 6.88672 15.9787 6.88672 14.107Z",fill:"#D18EE2"}),o.jsx("path",{d:"M2.91749 11.2891C1.30623 11.2891 0 12.5952 0 14.2065V14.5844C0 16.1956 1.30618 17.5018 2.91744 17.5018C4.5287 17.5018 5.83493 16.1956 5.83493 14.5844V14.2065C5.83493 12.5952 4.52875 11.2891 2.91749 11.2891Z",fill:"#FF7759"})]})]}),LDr=e=>o.jsxs("svg",{className:"h-3 w-3","data-testid":"geist-icon",height:"78",strokeLinejoin:"round",viewBox:"0 0 160 59",width:"104",style:{color:"currentcolor"},...e,children:[o.jsx("mask",{id:"mask0_4345_1846",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"160",height:"59",style:{maskType:"luminance"},children:o.jsx("path",{d:"M0.273438 0.219727H159.216V58.1817H0.273438V0.219727Z",fill:"white"})}),o.jsx("g",{mask:"url(#mask0_4345_1846)",children:o.jsx("path",{d:"M95.4635 0.314595C84.4822 0.314595 75.5599 9.19525 75.5599 20.1677C75.5599 31.1402 84.4632 40.0208 95.4635 40.0208C106.464 40.0208 115.367 31.1402 115.367 20.1677C115.348 9.21427 106.445 0.333611 95.4635 0.314595ZM95.4635 32.5664C88.6002 32.5664 83.0333 27.0136 83.0333 20.1677C83.0333 13.3218 88.6002 7.76902 95.4635 7.76902C102.327 7.76902 107.894 13.3218 107.894 20.1677C107.894 27.0136 102.327 32.5664 95.4635 32.5664ZM67.9912 0.39066C67.3049 0.314595 66.6376 0.276562 65.9513 0.276562C65.6081 0.276562 65.284 0.276562 64.9599 0.295578C64.6358 0.314595 64.2926 0.333611 63.9685 0.352628C62.634 0.44771 61.2995 0.675906 60.0031 1.03722C57.3531 1.74082 54.8556 2.99591 52.7013 4.68836C50.4898 6.43787 48.7358 8.68181 47.5347 11.23C46.9437 12.5041 46.5052 13.8543 46.2193 15.2234C46.0858 15.908 45.9905 16.5926 45.9142 17.2772C45.8952 17.6195 45.857 17.9618 45.857 18.3041L45.838 18.8175V19.293L45.8761 32.5854L45.9142 39.2221H53.3685L53.4067 32.5854L53.4448 19.293V18.5893C53.4448 18.3802 53.4829 18.171 53.4829 17.9618C53.5211 17.5434 53.5973 17.1441 53.6736 16.7257C53.8452 15.9271 54.093 15.1474 54.4362 14.4057C55.1225 12.9225 56.152 11.6293 57.4293 10.6025C58.7639 9.53755 60.3081 8.75787 61.9477 8.3205C62.7865 8.0923 63.6635 7.94017 64.5405 7.8641C64.7693 7.84509 64.979 7.82607 65.2078 7.82607C65.4365 7.82607 65.6653 7.80705 65.875 7.80705C66.2944 7.80705 66.7329 7.82607 67.1524 7.8641C68.8491 8.03525 70.4887 8.54869 71.9948 9.38541L75.7124 2.93886C73.3484 1.56968 70.7175 0.694923 67.9912 0.39066ZM20.3484 0.219513C9.36711 0.124431 0.36855 8.92902 0.273226 19.8825C0.177902 30.8359 9.00488 39.8116 19.9862 39.9067H26.8876V32.4713H20.3484C13.4851 32.5474 7.84193 27.0707 7.76567 20.2057C7.68941 13.3408 13.1801 7.73099 20.0624 7.65492H20.3484C27.2117 7.65492 32.7786 13.2077 32.8167 20.0536V38.3284C32.8167 45.1172 27.2689 50.651 20.4819 50.7271C17.2218 50.708 14.1142 49.3959 11.8265 47.0949L6.54553 52.3625C10.206 56.0326 15.1628 58.1244 20.3484 58.1625H20.6153C31.4632 58.0103 40.1757 49.2248 40.2329 38.4044V19.5592C39.966 8.81492 31.1391 0.238529 20.3484 0.219513ZM139.389 0.314595C128.407 0.314595 119.485 9.19525 119.504 20.1677C119.504 31.1212 128.407 40.0018 139.389 40.0018H146.195V32.5664H139.389C132.525 32.5664 126.958 27.0136 126.958 20.1677C126.958 13.3218 132.525 7.76902 139.389 7.76902C145.833 7.76902 151.209 12.6943 151.781 19.1028H151.762V57.2116H159.216V20.1677C159.216 9.21427 150.351 0.314595 139.389 0.314595Z",fill:"currentColor"})})]}),$Dr=e=>o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 34 21",fill:"none",...e,children:o.jsx("path",{d:"M4.49805 11.6934C6.98237 11.6934 8.99609 13.7081 8.99609 16.1924C8.9959 18.6765 6.98225 20.6904 4.49805 20.6904C2.01394 20.6903 0.000196352 18.6765 0 16.1924C0 13.7081 2.01382 11.6935 4.49805 11.6934ZM10.3867 0C12.8709 0 14.8846 2.01388 14.8848 4.49805C14.8848 4.8377 14.847 5.16846 14.7755 5.48643C14.4618 6.88139 14.1953 8.4633 14.9928 9.65L16.2575 11.5319C16.3363 11.6491 16.4727 11.7115 16.6137 11.703C16.7369 11.6957 16.8525 11.6343 16.9214 11.5318L18.1876 9.64717C18.9772 8.47198 18.7236 6.90783 18.4205 5.52484C18.3523 5.21392 18.3164 4.89094 18.3164 4.55957C18.3167 2.07546 20.3313 0.0615234 22.8154 0.0615234C25.2994 0.0617476 27.3132 2.0756 27.3135 4.55957C27.3135 4.93883 27.2665 5.30712 27.178 5.65896C26.8547 6.94441 26.5817 8.37932 27.2446 9.52714L28.459 11.6301C28.4819 11.6697 28.5245 11.6934 28.5703 11.6934C31.0545 11.6935 33.0684 13.7081 33.0684 16.1924C33.0682 18.6765 31.0544 20.6903 28.5703 20.6904C26.0861 20.6904 24.0725 18.6765 24.0723 16.1924C24.0723 15.8049 24.1212 15.4288 24.2133 15.0701C24.5458 13.7746 24.8298 12.3251 24.1609 11.1668L23.0044 9.16384C22.9656 9.09659 22.8931 9.05859 22.8154 9.05859C22.7983 9.05859 22.7824 9.06614 22.7728 9.08033L21.4896 10.9895C20.686 12.1851 20.9622 13.781 21.284 15.1851C21.3582 15.5089 21.3975 15.8461 21.3975 16.1924C21.3973 18.6764 19.3834 20.6902 16.8994 20.6904C14.4152 20.6904 12.4006 18.6765 12.4004 16.1924C12.4004 15.932 12.4226 15.6768 12.4651 15.4286C12.6859 14.14 12.8459 12.7122 12.1167 11.6271L11.2419 10.3253C10.6829 9.49347 9.71913 9.05932 8.78286 8.70188C7.0906 8.05584 5.88867 6.41734 5.88867 4.49805C5.88886 2.0139 7.90254 3.29835e-05 10.3867 0Z",fill:e.fill||"currentColor"})}),FDr=e=>o.jsxs("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"176",height:"162",viewBox:"0 0 176 162",fill:"none",...e,children:[o.jsx("rect",{x:"15",y:"1",width:"32",height:"32",fill:"#FFCD00",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"1",width:"32",height:"32",fill:"#FFCD00",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"47",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"111",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"47",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"79",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"111",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"79",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"129",width:"32",height:"32",fill:"#FF0006",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"129",width:"32",height:"32",fill:"#FF0006",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{y:"1",width:"16",height:"160",fill:"black"}),o.jsx("rect",{x:"63",y:"97",width:"16",height:"32",fill:"black"}),o.jsx("rect",{x:"95",y:"33",width:"16",height:"32",fill:"black"}),o.jsx("rect",{x:"127",y:"1",width:"16",height:"32",fill:"black"}),o.jsx("rect",{x:"127",y:"97",width:"16",height:"64",fill:"black"})]}),zDr=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"128",height:"113",viewBox:"0 0 128 113",children:[o.jsxs("g",{clipPath:"url(#clip0_236_138)",...e,children:[o.jsx("path",{d:"M34.593 94.0509H33.3844L27.3514 88.0179V86.8094L36.5743 77.5866H42.9639L43.8158 78.4385V84.8281L34.593 94.0509Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M27.3514 25.816V24.6074L33.3844 18.5744H34.593L43.8158 27.7972V34.1868L42.9639 35.0388H36.5743L27.3514 25.816Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M80.4594 74.6047H71.6824L70.9493 73.8717V53.3259C70.9493 49.6705 69.5129 46.8372 65.1046 46.7382C62.836 46.6787 60.2405 46.7382 57.4668 46.8471L57.0507 47.2731V73.8618L56.3176 74.5948H47.5406L46.8075 73.8618V38.7636L47.5406 38.0305H67.2939C74.9713 38.0305 81.1925 44.2517 81.1925 51.9291V73.8717L80.4594 74.6047Z",fill:e.fill||"#014847"}),o.jsx("path",{d:"M35.8412 61.4491H0.73307L0 60.716V51.9192L0.73307 51.1861H35.8412L36.5743 51.9192V60.716L35.8412 61.4491Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M127.277 61.4491H92.1687L91.4356 60.716V51.9192L92.1687 51.1861H127.277L128.01 51.9192V60.716L127.277 61.4491Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M58.9428 27.0642V0.73307L59.6759 0H68.4727L69.2058 0.73307V27.0642L68.4727 27.7972H59.6759L58.9428 27.0642Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M58.9428 111.902V85.5711L59.6759 84.838H68.4727L69.2058 85.5711V111.902L68.4727 112.635H59.6759L58.9428 111.902Z",fill:e.fill||"#05BDBA"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_236_138",children:o.jsx("rect",{width:"128",height:"112.635",fill:"white"})})})]}),QIe=e=>o.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 320 320",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...e,children:o.jsx("path",{d:"m297.06 130.97c7.26-21.79 4.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13 22.48-76.91 55.82-22.51 4.61-41.94 18.7-53.31 38.67-17.59 30.32-13.58 68.54 9.92 94.54-7.26 21.79-4.76 45.66 6.85 65.48 17.46 30.4 52.56 46.04 86.84 38.68 15.24 17.18 37.16 26.95 60.13 26.8 35.06.09 66.16-22.49 76.94-55.86 22.51-4.61 41.94-18.7 53.31-38.67 17.57-30.32 13.55-68.51-9.94-94.51zm-120.28 168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26 1.34-.73 1.89-1.07l63.72-36.8c3.26-1.85 5.26-5.32 5.24-9.07v-89.83l26.93 15.55c.29.14.48.42.52.74v74.39c-.04 33.08-26.83 59.9-59.91 59.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28 1.3.79 1.89 1.13l63.72 36.8c3.23 1.89 7.23 1.89 10.47 0l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41 37.19c-28.69 16.52-65.33 6.7-81.92-21.95zm-16.77-139.09c7-12.16 18.05-21.46 31.21-26.29 0 .55-.03 1.52-.03 2.2v73.61c-.02 3.74 1.98 7.21 5.23 9.06l77.79 44.91-26.93 15.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26 51.49-77.79-44.92 26.93-15.54c.27-.18.61-.21.91-.08l64.42 37.19c28.68 16.57 38.51 53.26 21.94 81.94-7.01 12.14-18.05 21.44-31.2 26.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47 0l-77.79 44.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55 65.37-6.7 81.91 22 6.99 12.12 9.52 26.31 7.15 40.1zm-168.51 55.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12 26.89-59.96 60.01-59.94 14.01 0 27.57 4.92 38.34 13.88-.49.26-1.33.73-1.89 1.07l-63.72 36.8c-3.26 1.85-5.26 5.31-5.24 9.06l-.04 89.79zm14.63-31.54 34.65-20.01 34.65 20v40.01l-34.65 20-34.65-20z"})}),BDr=e=>o.jsx("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1000 1000",width:"78",height:"78",style:{color:"currentcolor"},...e,children:o.jsxs("g",{children:[o.jsx("polygon",{fill:"currentColor",points:"226.83 411.15 501.31 803.15 623.31 803.15 348.82 411.15 226.83 411.15"}),o.jsx("polygon",{fill:"currentColor",points:"348.72 628.87 226.69 803.15 348.77 803.15 409.76 716.05 348.72 628.87"}),o.jsx("polygon",{fill:"currentColor",points:"651.23 196.85 440.28 498.12 501.32 585.29 773.31 196.85 651.23 196.85"}),o.jsx("polygon",{fill:"currentColor",points:"673.31 383.25 673.31 803.15 773.31 803.15 773.31 240.44 673.31 383.25"})]})}),UDr={warning:"bg-accent6Darker border-accent6/30 text-accent6",destructive:"bg-accent2Darker border-accent2/30 text-accent2",info:"bg-accent5Darker border-accent5/30 text-accent5"},VDr={warning:LE,destructive:_F,info:MR},Bl=({children:e,variant:t="destructive",className:r})=>{const n=VDr[t];return o.jsx("div",{className:Z(UDr[t],"p-3 rounded-md border shadow-sm",sn.all,"animate-in fade-in-0 slide-in-from-top-2 duration-200",r),children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(Ce,{className:"mt-0.5 shrink-0",children:o.jsx(n,{})}),o.jsx("div",{className:"text-neutral4",children:e})]})})},Ul=({children:e,as:t="h5"})=>o.jsx(me,{as:t,variant:"ui-md",className:"font-semibold",children:e}),$u=({children:e,as:t="p"})=>o.jsx(me,{as:t,variant:"ui-sm",children:e}),qDr={sm:"h-avatar-sm w-avatar-sm",md:"h-avatar-md w-avatar-md",lg:"h-avatar-lg w-avatar-lg"},fdt=({src:e,name:t,size:r="sm",interactive:n=!1})=>o.jsx("div",{className:Z(qDr[r],"border border-border1 bg-surface3 shrink-0 overflow-hidden rounded-full flex items-center justify-center",sn.all,n&&"cursor-pointer hover:scale-105 hover:border-neutral2 hover:shadow-sm"),children:e?o.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover"}):o.jsx(me,{variant:"ui-md",className:"text-center text-neutral4",children:t[0].toUpperCase()})}),HDr={default:"text-neutral3 bg-surface4",success:"text-accent1 bg-accent1Dark",error:"text-accent2 bg-accent2Dark",info:"text-accent5 bg-accent5Dark",warning:"text-accent6 bg-accent6Dark"},QDr={default:"text-neutral3",success:"text-accent1",error:"text-accent2",info:"text-accent5",warning:"text-accent6"},gt=({icon:e,variant:t="default",className:r,children:n,...s})=>o.jsxs("div",{className:Z("font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border border-border1 shrink-0",sn.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":HDr[t],r),...s,children:[e&&o.jsx("span",{className:QDr[t],children:o.jsx(Ce,{children:e})}),n]}),Za=({children:e,label:t})=>o.jsx("nav",{"aria-label":t,children:o.jsx("ol",{className:"gap-0.5 flex items-center",children:e})}),jr=({className:e,as:t,isCurrent:r,action:n,...s})=>{const a=t||"span";return o.jsxs(o.Fragment,{children:[o.jsxs("li",{className:"flex h-full shrink-0 items-center gap-1",children:[o.jsx(a,{"aria-current":r?"page":void 0,className:Z("text-ui-md leading-ui-md flex items-center gap-2",sn.colors,r?"text-white":"text-neutral3 hover:text-neutral5",e),...s}),n]}),!r&&o.jsx("li",{role:"separator",className:"flex h-full items-center",children:o.jsx(Ce,{className:Z("text-neutral2",sn.colors),children:o.jsx(RDr,{})})})]})};function WDr(e,t=5){if(!e?.properties)return[];const r=[];function n(s,a,i){if(i>t)return;const l=Array.isArray(s.type)?s.type.join(" | "):s.type;if(r.push({path:a,label:a,description:s.description??s.title,type:l}),s.properties)for(const[c,u]of Object.entries(s.properties))n(u,`${a}.${c}`,i+1);if(s.items?.properties)for(const[c,u]of Object.entries(s.items.properties))n(u,`${a}[].${c}`,i+1)}for(const[s,a]of Object.entries(e.properties))n(a,s,1);return r}function GDr(e){const t=WDr(e);return qWe({override:[ZDr(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function ZDr(e){return t=>{const n=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!n)return null;const s=n[1]??"",a=t.pos-s.length,i=s?e.filter(c=>c.path.toLowerCase().startsWith(s.toLowerCase())):e;if(i.length===0)return null;const l=i.map(c=>({label:c.path,displayLabel:c.path,detail:c.type,info:c.description,apply:(u,d,f,h)=>{const g=u.state.sliceDoc(h,h+2)==="}}"?d.label:`${d.label}}}`;u.dispatch({changes:{from:f,to:h,insert:g},selection:{anchor:f+g.length}})}}));return{from:a,options:l,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const YDr=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,XDr=er.mark({class:"cm-variable-highlight"}),WIe=new sWe({regexp:YDr,decoration:()=>XDr}),KDr=Si.fromClass(class{decorations;constructor(e){this.decorations=WIe.createDeco(e)}update(e){this.decorations=WIe.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),JDr=KDr,eLr={duration:5e3,cancel:{label:o.jsx(Ce,{children:o.jsx(Xl,{})}),onClick:()=>{}},unstyled:!0,classNames:{toast:"bg-surface3 w-full h-auto rounded-xl gap-2 border border-border1 px-3 py-2 flex items-center justify-between pointer-events-auto shadow-card :data-content:flex-1",title:"text-xs font-medium text-neutral5",description:"text-xs text-neutral3",cancelButton:"bg-transparent! hover:bg-surface2! border-none! rounded-md! p-1.5! m-0! text-neutral3! hover:text-neutral6! shrink-0 transition-all",actionButton:"bg-white! flex items-center justify-center font-medium text-black! order-last hover:opacity-80"}};function rf(e){const{classNames:t,...r}=eLr,{classNames:n,...s}=e||{};return{...r,classNames:{...t,title:Z(t?.title,n?.title),toast:Z(t?.toast,n?.toast),cancelButton:Z(t?.cancelButton,n?.cancelButton),actionButton:Z(t?.actionButton,n?.actionButton),description:Z(t?.description,n?.description)},...s}}const ze=(e,t={})=>{if(Array.isArray(e))return e.forEach(r=>vc(r,rf(t)));if(je.isValidElement(e))return vc(e,rf(t));if(typeof e=="string")return vc(e,rf(t));throw new Error("Invalid message type")};ze.success=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent1 shrink-0",children:o.jsx(KFt,{})}),classNames:{...t.classNames,toast:Z("bg-accent1Darker border-accent1/30 border-l-[3px] border-l-accent1",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return vc.success(e,rf(r));case"object":return e.forEach(n=>vc.success(n,rf(r)))}};ze.error=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent2 shrink-0",children:o.jsx(OHe,{})}),classNames:{...t.classNames,toast:Z("bg-accent2Darker border-accent2/30 border-l-[3px] border-l-accent2",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return vc.error(e,rf(r));case"object":return e.forEach(n=>vc.error(n,rf(r)))}};ze.warning=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent6 shrink-0",children:o.jsx(_F,{})}),classNames:{...t.classNames,toast:Z("bg-accent6Darker border-accent6/30 border-l-[3px] border-l-accent6",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return vc.warning(e,rf(r));case"object":return e.forEach(n=>vc.warning(n,rf(r)))}};ze.info=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent3 shrink-0",children:o.jsx(MR,{})}),classNames:{...t.classNames,toast:Z("bg-accent3Darker border-accent3/30 border-l-[3px] border-l-accent3",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return vc.info(e,rf(r));case"object":return e.forEach(n=>vc.info(n,rf(r)))}};ze.custom=(e,t={})=>vc(e,rf(t));ze.dismiss=e=>{e&&vc.dismiss(e)};ze.promise=({myPromise:e,loadingMessage:t,successMessage:r,errorMessage:n,onSuccess:s,onError:a,options:i={}})=>vc.promise(e,{loading:t??"Loading...",success:l=>(s?.(l),r),error:l=>(a?.(l),n||l?.message||"Error..."),...rf(i)});function ff({text:e,copyMessage:t="Copied to clipboard!"}){const[r,n]=b.useState(!1),s=b.useRef(null),a=b.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{ze.success(t),n(!0),s.current&&(clearTimeout(s.current),s.current=null),s.current=setTimeout(()=>{n(!1)},2e3)}).catch(()=>{ze.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:r,handleCopy:a}}function Xa({content:e,copyMessage:t,tooltip:r="Copy to clipboard",size:n="sm",className:s}){const[a,i]=b.useState(!1),{handleCopy:l}=ff({text:e,copyMessage:t}),c=()=>{l(),i(!0),setTimeout(()=>i(!1),2e3)};return o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(pe,{onClick:c,type:"button",size:n,className:s,"aria-label":a?"Copied!":r,children:a?o.jsx(dv,{}):o.jsx(_He,{})})}),o.jsx(Wr,{children:a?"Copied!":r})]})}const Qn=Kue()(qZt(e=>({requestContext:{},theme:"dark",setRequestContext:t=>e({requestContext:t}),setTheme:t=>e({theme:t})}),{name:"mastra-playground-store"})),cie=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;function tLr(e){return cie?.addEventListener("change",e),()=>cie?.removeEventListener("change",e)}function rLr(){return cie?.matches??!0}function IP(){const e=Qn(r=>r.theme),t=b.useSyncExternalStore(tLr,rLr,()=>!0);return e==="system"?t:e==="dark"}function nLr(){const e=VE({settings:{fontFamily:"var(--geist-mono)",fontSize:"0.8rem",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"var(--neutral2)",background:"transparent",foreground:"var(--neutral6)",caret:"var(--neutral6)"},styles:[{tag:[ne.className,ne.propertyName],color:"var(--neutral6)"},{tag:ne.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[ne.heading1,ne.heading2,ne.heading3,ne.heading4,ne.heading5,ne.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:ne.emphasis,fontStyle:"italic",color:"var(--neutral6)"},{tag:ne.strong,fontWeight:"bold",color:"var(--neutral6)"},{tag:ne.link,color:"var(--accent3)",textDecoration:"underline"},{tag:ne.url,color:"var(--accent3)"},{tag:ne.monospace,color:"var(--neutral6)"},{tag:ne.strikethrough,textDecoration:"line-through"},{tag:ne.quote,fontStyle:"italic",color:"var(--neutral2)"}]}),t=ft.theme({".cm-editor":{backgroundColor:"transparent"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-lineNumbers .cm-gutterElement":{color:"var(--neutral2)"},".cm-activeLineGutter":{color:"var(--neutral3)"},".cm-cursor":{borderLeftColor:"var(--neutral6)"},".cm-selectionBackground, .cm-content ::selection":{backgroundColor:"color-mix(in srgb, var(--accent3) 22%, transparent)"},".cm-tooltip-autocomplete":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.2)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"var(--neutral6)"},".cm-completionDetail":{color:"var(--neutral3)",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",color:"var(--neutral3)",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"var(--surface4)",color:"var(--neutral6)"},".cm-line .cm-variable-highlight":{color:"var(--accent6) !important",fontWeight:"500"}});return[e,t]}function sLr(){const e=ft.theme({"&":{backgroundColor:"transparent",color:"var(--neutral6)",fontSize:"0.8rem"},"&.cm-editor .cm-scroller":{fontFamily:"var(--geist-mono)"},".cm-gutters":{backgroundColor:"transparent",color:"var(--neutral2)",borderRight:"none"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-activeLine":{backgroundColor:"transparent"},".cm-lineNumbers .cm-gutterElement":{color:"var(--neutral2)"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"var(--neutral3)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--neutral6)"},"&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection":{background:"color-mix(in srgb, var(--accent3) 22%, transparent) !important"},".cm-tooltip-autocomplete":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.2)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"var(--neutral6)"},".cm-completionDetail":{color:"var(--neutral3)",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",color:"var(--neutral3)",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"var(--surface4)",color:"var(--neutral6)"},".cm-line .cm-variable-highlight":{color:"var(--accent6) !important",fontWeight:"500"}}),t=$p.define([{tag:[ne.comment,ne.bracket],color:"var(--neutral2)"},{tag:[ne.string,ne.meta,ne.regexp],color:"var(--accent1)"},{tag:[ne.atom,ne.bool,ne.special(ne.variableName)],color:"var(--accent6)"},{tag:[ne.keyword,ne.operator,ne.tagName],color:"var(--accent2)"},{tag:[ne.function(ne.propertyName),ne.propertyName],color:"var(--accent5)"},{tag:[ne.definition(ne.variableName),ne.function(ne.variableName),ne.className,ne.attributeName],color:"var(--accent3)"},{tag:[ne.variableName,ne.number],color:"var(--accent5)"},{tag:[ne.name,ne.quote],color:"var(--accent1)"},{tag:ne.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[ne.heading1,ne.heading2,ne.heading3,ne.heading4,ne.heading5,ne.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:[ne.emphasis],fontStyle:"italic",color:"var(--neutral6)"},{tag:[ne.strong],fontWeight:"bold",color:"var(--neutral6)"},{tag:ne.link,color:"var(--accent3)",textDecoration:"underline"},{tag:ne.url,color:"var(--accent3)"},{tag:ne.monospace,color:"var(--neutral6)"},{tag:ne.strikethrough,textDecoration:"line-through"},{tag:[ne.deleted],color:"var(--accent2)"},{tag:ne.invalid,color:"var(--error)"},{tag:[ne.standard(ne.tagName)],color:"var(--accent1)"}]);return[e,Yx(t)]}const kv=()=>{const e=IP();return b.useMemo(()=>e?nLr():sLr(),[e])},hs=b.forwardRef(({data:e,value:t,onChange:r,showCopyButton:n=!0,className:s,language:a="json",highlightVariables:i=!1,placeholder:l,schema:c,autoFocus:u,lineNumbers:d=!0,editable:f,...h},p)=>{const m=kv(),g=e?JSON.stringify(e,null,2):t??"",y=b.useMemo(()=>{const x=[];return a==="json"?x.push(Xd):a==="markdown"&&(x.push(Uue({base:pS,codeLanguages:fZe})),x.push(ft.lineWrapping)),i&&a==="markdown"&&x.push(JDr),c&&a==="markdown"&&x.push(GDr(c)),f===!1&&x.push(zn.readOnly.of(!0)),x},[a,i,c,f]);return o.jsxs("div",{className:Z("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",s),...h,children:[n&&o.jsx(Xa,{content:g,className:"absolute top-2 right-2 z-20"}),o.jsx(xc,{ref:p,value:g,theme:m,extensions:y,onChange:r,editable:f,"aria-label":"Code editor",placeholder:l,height:"100%",style:{height:"100%"},autoFocus:u,basicSetup:{lineNumbers:d}})]})});async function aLr(e,t){const{codeToTokens:r,bundledLanguages:n}=await Ke(async()=>{const{codeToTokens:a,bundledLanguages:i}=await import("./index-yyeH8auD.js");return{codeToTokens:a,bundledLanguages:i}},__vite__mapDeps([23,1]),import.meta.url);if(!(t in n))return null;const{tokens:s}=await r(e,{lang:t,defaultColor:!1,themes:{light:"github-light",dark:"github-dark"}});return s}function Ka({iconSlot:e,titleSlot:t,descriptionSlot:r,actionSlot:n,className:s,as:a="h3"}){return o.jsxs("div",{className:Z("flex flex-col items-center justify-center text-center py-10 px-6","transition-opacity duration-normal ease-out-custom",s),children:[e&&o.jsx("div",{className:"mb-4",children:e}),o.jsx(a,{className:"font-medium text-neutral5 text-ui-md",children:t}),r&&o.jsx("p",{className:"mt-1.5 text-neutral3 text-ui-sm max-w-md",children:r}),n&&o.jsx("div",{className:"mt-5",children:n})]})}const kf=({children:e,className:t,onClick:r})=>o.jsx("div",{tabIndex:r?0:void 0,onKeyDown:n=>{r&&(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),r?.())},className:Z("flex gap-3 group/entity bg-surface3 rounded-xl border border-border1 py-3 px-4",r&&"cursor-pointer hover:bg-surface4 transition-all",t),onClick:r,children:e}),hdt=({children:e,className:t,style:r})=>o.jsx(Ce,{size:"lg",className:Z("text-neutral3 mt-1 shrink-0",t),style:r,children:e}),_f=({children:e,className:t})=>o.jsx(me,{as:"p",variant:"ui-lg",className:Z("text-neutral6 font-medium",t),children:e}),Ef=({children:e,className:t})=>o.jsx(me,{as:"div",variant:"ui-sm",className:Z("text-neutral3",t),children:e}),Cf=({children:e,className:t})=>o.jsx("div",{className:Z("flex-1 w-full",t),children:e});function Gs({resource:e,title:t,description:r,actionSlot:n,className:s}){const a="Permission Denied",i=e?`You don't have permission to access ${e}. Contact your administrator for access.`:"You don't have permission to access this resource. Contact your administrator for access.";return o.jsx(Ka,{className:s,iconSlot:o.jsx(Ce,{size:"lg",className:"text-neutral3",children:o.jsx(Gzt,{})}),titleSlot:t??a,descriptionSlot:r??i,actionSlot:n})}function na({title:e,description:t,className:r}){const[n,s]=b.useState(!1),a=Ge(),i=b.useCallback(async()=>{try{s(!0);const{baseUrl:l="",apiPrefix:c}=a.options||{},u=(c||"/api").trim(),d=(u.startsWith("/")?u:`/${u}`).replace(/\/$/,""),f=new URLSearchParams({redirect_uri:window.location.href}),h=`${l}${d}/auth/sso/login?${f}`,p=await fetch(h,{credentials:"include",headers:{"Content-Type":"application/json"}});if(p.ok){const m=await p.json();window.location.href=m.url}}finally{s(!1)}},[a]);return o.jsx(Ka,{className:r,iconSlot:o.jsx(Ce,{size:"lg",className:"text-neutral3",children:o.jsx(Bzt,{})}),titleSlot:e??"Session Expired",descriptionSlot:t??"Your session has expired. Please log in again to continue.",actionSlot:o.jsx(pe,{variant:"default",onClick:i,disabled:n,children:n?"Redirecting...":"Log in"})})}const En=({children:e,border:t=!0,className:r})=>o.jsx("header",{className:Z("h-header-default z-50 flex w-full items-center gap-4 bg-transparent px-3",{"border-b border-border1":t},r),children:e}),Zu=({children:e})=>o.jsx(me,{as:"h1",variant:"ui-md",className:"text-neutral6 flex items-center gap-2",children:e}),pu=({children:e})=>o.jsx("div",{className:"ml-auto flex items-center gap-3",children:e}),iLr=({children:e})=>o.jsx("div",{className:"gap-2 flex items-center",children:e}),tx=e=>o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 34 21",fill:"none",...e,children:o.jsx("path",{d:"M4.49805 11.6934C6.98237 11.6934 8.99609 13.7081 8.99609 16.1924C8.9959 18.6765 6.98225 20.6904 4.49805 20.6904C2.01394 20.6903 0.000196352 18.6765 0 16.1924C0 13.7081 2.01382 11.6935 4.49805 11.6934ZM10.3867 0C12.8709 0 14.8846 2.01388 14.8848 4.49805C14.8848 4.8377 14.847 5.16846 14.7755 5.48643C14.4618 6.88139 14.1953 8.4633 14.9928 9.65L16.2575 11.5319C16.3363 11.6491 16.4727 11.7115 16.6137 11.703C16.7369 11.6957 16.8525 11.6343 16.9214 11.5318L18.1876 9.64717C18.9772 8.47198 18.7236 6.90783 18.4205 5.52484C18.3523 5.21392 18.3164 4.89094 18.3164 4.55957C18.3167 2.07546 20.3313 0.0615234 22.8154 0.0615234C25.2994 0.0617476 27.3132 2.0756 27.3135 4.55957C27.3135 4.93883 27.2665 5.30712 27.178 5.65896C26.8547 6.94441 26.5817 8.37932 27.2446 9.52714L28.459 11.6301C28.4819 11.6697 28.5245 11.6934 28.5703 11.6934C31.0545 11.6935 33.0684 13.7081 33.0684 16.1924C33.0682 18.6765 31.0544 20.6903 28.5703 20.6904C26.0861 20.6904 24.0725 18.6765 24.0723 16.1924C24.0723 15.8049 24.1212 15.4288 24.2133 15.0701C24.5458 13.7746 24.8298 12.3251 24.1609 11.1668L23.0044 9.16384C22.9656 9.09659 22.8931 9.05859 22.8154 9.05859C22.7983 9.05859 22.7824 9.06614 22.7728 9.08033L21.4896 10.9895C20.686 12.1851 20.9622 13.781 21.284 15.1851C21.3582 15.5089 21.3975 15.8461 21.3975 16.1924C21.3973 18.6764 19.3834 20.6902 16.8994 20.6904C14.4152 20.6904 12.4006 18.6765 12.4004 16.1924C12.4004 15.932 12.4226 15.6768 12.4651 15.4286C12.6859 14.14 12.8459 12.7122 12.1167 11.6271L11.2419 10.3253C10.6829 9.49347 9.71913 9.05932 8.78286 8.70188C7.0906 8.05584 5.88867 6.41734 5.88867 4.49805C5.88886 2.0139 7.90254 3.29835e-05 10.3867 0Z",fill:"currentColor"})}),oLr={default:"[&>tbody>tr]:h-table-row",small:"[&>tbody>tr]:h-table-row-small"},lLr=({className:e,children:t,size:r="default",style:n})=>o.jsx("table",{className:Z("w-full",oLr[r],e),style:n,children:t}),cLr=({className:e,children:t})=>o.jsx("thead",{children:o.jsx("tr",{className:Z("h-table-header border-b border-border1 bg-surface2/80",e),children:t})}),uLr=({className:e,children:t,...r})=>o.jsx("th",{className:Z("text-neutral2 text-ui-xs h-full whitespace-nowrap text-left font-medium uppercase tracking-wide first:pl-3 last:pr-3",e),...r,children:t}),dLr=({className:e,children:t,...r})=>o.jsx("tbody",{className:Z("",e),...r,children:t}),fLr=b.forwardRef(({className:e,children:t,selected:r=!1,style:n,onClick:s,isActive:a=!1,...i},l)=>{const c=b.useRef(null);b.useEffect(()=>{l&&(typeof l=="function"?l(c.current):l.current=c.current)},[l]),b.useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.scrollIntoView({block:"nearest"}))},[a]);const u=d=>{d.key==="Enter"&&s&&s()};return o.jsx("tr",{className:Z("border-b border-border1","transition-colors duration-normal ease-out-custom","hover:bg-surface3","focus:bg-surface3 focus:outline-hidden focus:ring-1 focus:ring-inset focus:ring-accent1/50",r&&"bg-surface4",s&&"cursor-pointer",e),style:n,onClick:s,ref:c,tabIndex:s?0:void 0,onKeyDown:u,"data-active":a||void 0,...i,children:t})}),hLr=({className:e,children:t,...r})=>o.jsx("td",{className:Z("text-neutral5 first:pl-3 last:pr-3",e),...r,children:o.jsx("div",{className:Z("flex h-full w-full shrink-0 items-center"),children:t})}),GIe=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ZIe=Uut,gC=(e,t)=>r=>{var n;if(t?.variants==null)return ZIe(e,r?.class,r?.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(u=>{const d=r?.[u],f=a?.[u];if(d===null)return null;const h=GIe(d)||GIe(f);return s[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(m=>{let[g,y]=m;return Array.isArray(y)?y.includes({...a,...l}[g]):{...a,...l}[g]===y})?[...u,f,h]:u},[]);return ZIe(e,i,c,r?.class,r?.className)},pLr=gC(Z("flex w-full text-neutral6 border bg-transparent","transition-all duration-normal ease-out-custom","placeholder:text-neutral2 placeholder:transition-opacity placeholder:duration-normal","focus:placeholder:opacity-70","min-h-[80px] resize-y"),{variants:{variant:{default:Z(nme,sme,ame),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:"px-2 py-1.5 text-ui-sm",md:"px-3 py-2 text-ui-sm",default:"px-3 py-2 text-ui-md",lg:"px-4 py-3 text-ui-sm"}},defaultVariants:{variant:"default",size:"default"}}),bc=b.forwardRef(({className:e,size:t,testId:r,variant:n,error:s,...a},i)=>o.jsx("textarea",{className:Z(pLr({variant:n,size:t}),s&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":r,ref:i,"aria-invalid":s,...a}));bc.displayName="Textarea";const mLr=rXt,gLr=nXt,pdt=sXt;function Bt({open:e,onOpenChange:t,children:r}){return o.jsx(mLr,{open:e,onOpenChange:t,children:r})}const dme=b.forwardRef(({className:e,...t},r)=>o.jsx(QYe,{className:Z("fixed inset-0 z-50 bg-overlay backdrop-blur-sm","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:duration-200","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:duration-150",e),...t,ref:r}));dme.displayName=QYe.displayName;const mdt=b.forwardRef(({className:e,...t},r)=>o.jsxs(pdt,{children:[o.jsx(dme,{}),o.jsx(WYe,{ref:r,className:Z("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border1 bg-surface3 p-6 shadow-dialog rounded-md","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] data-[state=open]:duration-200","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=closed]:duration-150",e),...t})]}));mdt.displayName=WYe.displayName;const gdt=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col space-y-2 text-center sm:text-left",e),...t});gdt.displayName="AlertDialogHeader";const ydt=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ydt.displayName="AlertDialogFooter";const vdt=b.forwardRef(({className:e,...t},r)=>o.jsx(YYe,{ref:r,className:Z("text-lg font-semibold",e),...t}));vdt.displayName=YYe.displayName;const bdt=b.forwardRef(({className:e,...t},r)=>o.jsx(XYe,{ref:r,className:Z("text-sm text-neutral3",e),...t}));bdt.displayName=XYe.displayName;const xdt=b.forwardRef(({className:e,...t},r)=>o.jsx(GYe,{ref:r,className:Z(pC({variant:"primary",size:"default"}),e),...t}));xdt.displayName=GYe.displayName;const wdt=b.forwardRef(({className:e,...t},r)=>o.jsx(ZYe,{ref:r,className:Z(pC({variant:"default",size:"default"}),"mt-2 sm:mt-0",e),...t}));wdt.displayName=ZYe.displayName;Bt.Trigger=gLr;Bt.Portal=pdt;Bt.Overlay=dme;Bt.Content=mdt;Bt.Header=gdt;Bt.Footer=ydt;Bt.Title=vdt;Bt.Description=bdt;Bt.Action=xdt;Bt.Cancel=wdt;const di=b.forwardRef(({className:e,...t},r)=>o.jsx(nde,{ref:r,className:Z("peer h-4 w-4 shrink-0 rounded-sm border border-neutral3","shadow-sm",sn.all,"hover:border-neutral5 hover:shadow-md",AP,"disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-neutral3 disabled:hover:shadow-sm","data-[state=checked]:bg-accent1 data-[state=checked]:border-accent1 data-[state=checked]:text-surface1","data-[state=checked]:shadow-glow-accent1",e),...t,children:o.jsx(tXe,{className:Z("flex items-center justify-center text-current","data-[state=checked]:animate-in data-[state=checked]:zoom-in-50 data-[state=checked]:duration-150"),children:o.jsx(dv,{className:"h-3.5 w-3.5 stroke-3"})})}));di.displayName=nde.displayName;const Ap=fXt,jh=je.forwardRef(({className:e,children:t,...r},n)=>o.jsx(ade,{ref:n,className:Z("-outline-offset-2",sn.colors,c0.visible,"hover:text-neutral5","[&>svg]:transition-transform [&>svg]:duration-normal [&>svg]:ease-out-custom","[&[data-state=open]>svg]:rotate-90",e),...r,children:t}));jh.displayName=ade.displayName;const Th=je.forwardRef(({className:e,children:t,...r},n)=>o.jsx(ode,{ref:n,className:Z("overflow-hidden","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-top-1","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-1","duration-normal ease-out-custom",e),...r,children:t}));Th.displayName=ode.displayName;const gn={root:"flex flex-col gap-1.5",trigger:"w-full min-w-32 justify-between",triggerError:"border-accent2",chevron:"ml-2 h-4 w-4 shrink-0 opacity-50",placeholder:"text-neutral3",popup:Z("min-w-(--anchor-width) w-max max-w-[500px] rounded-md bg-surface3 text-neutral5","shadow-elevated","origin-(--transform-origin)","transition-[transform,scale,opacity] duration-150 ease-out","data-starting-style:scale-95 data-starting-style:opacity-0","data-ending-style:scale-95 data-ending-style:opacity-0"),positioner:"z-50 pointer-events-auto",searchContainer:Z("flex items-center border-b border-border1 px-3 py-2",sn.colors),searchIcon:Z("mr-2 h-4 w-4 shrink-0 text-neutral3",sn.colors),searchInput:Z("flex h-8 w-full rounded-md bg-transparent py-1 text-sm","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-hidden",sn.colors),empty:"not-empty:block hidden py-6 text-center text-sm text-neutral3",list:"max-h-dropdown-max-height overflow-y-auto overflow-x-hidden p-1",item:Z("relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm",sn.colors,"data-highlighted:bg-surface5 data-highlighted:text-neutral5"),itemSelected:"data-selected:bg-accent1Dark data-selected:text-accent1",checkContainer:"mr-2 flex h-4 w-4 shrink-0 items-center justify-center",checkIcon:Z("h-4 w-4 text-accent1",sn.opacity),checkbox:"mr-2 flex h-4 w-4 shrink-0 items-center justify-center rounded border",checkboxSelected:"bg-accent1 border-accent1",checkboxUnselected:"border-border1",checkboxIcon:"h-3 w-3 text-white",optionContent:"flex items-center gap-2 w-full min-w-0",optionText:"flex flex-col gap-0.5 min-w-0",optionLabel:"truncate",optionDescription:"text-xs text-neutral3 truncate",optionEnd:"ml-auto",error:"text-xs text-accent2"};function Kl({options:e,value:t,onValueChange:r,placeholder:n="Select option...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:l=!1,variant:c="inputLike",size:u="default",open:d,onOpenChange:f,container:h,error:p}){const m=e.find(y=>y.value===t)??null,g=y=>{y&&r?.(y.value)};return o.jsxs("div",{className:gn.root,children:[o.jsxs(sKe,{items:e,value:m,onValueChange:g,disabled:l,open:d,onOpenChange:f,children:[o.jsxs(fKe,{className:Z(pC({variant:c,size:u}),gn.trigger,p&&gn.triggerError,i),children:[o.jsxs("span",{className:"truncate flex items-center gap-2",children:[m?.start,o.jsx(VJt,{placeholder:n})]}),o.jsx(kF,{className:gn.chevron})]}),o.jsx(gKe,{container:h,children:o.jsx(bKe,{align:"start",sideOffset:4,className:gn.positioner,children:o.jsxs(xKe,{className:gn.popup,children:[o.jsxs("div",{className:gn.searchContainer,children:[o.jsx(w_,{className:gn.searchIcon}),o.jsx(dKe,{className:gn.searchInput,placeholder:s})]}),o.jsx(_Ke,{className:gn.empty,children:a}),o.jsx(pKe,{className:gn.list,children:y=>o.jsxs(kKe,{value:y,className:Z(gn.item,gn.itemSelected),children:[o.jsx("span",{className:gn.checkContainer,children:o.jsx(Ner,{children:o.jsx(dv,{className:gn.checkIcon})})}),o.jsxs("span",{className:gn.optionContent,children:[y.start,o.jsxs("span",{className:gn.optionText,children:[o.jsx("span",{className:gn.optionLabel,children:y.label}),y.description&&o.jsx("span",{className:gn.optionDescription,children:y.description})]}),y.end?o.jsx("div",{className:gn.optionEnd,children:y.end}):null]})]},y.value)})]})})})]}),p&&o.jsx("span",{className:gn.error,children:p})]})}function Sdt({options:e,value:t=[],onValueChange:r,placeholder:n="Select options...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:l=!1,variant:c="default",size:u="md",open:d,onOpenChange:f,container:h,error:p}){const m=e.filter(x=>t.includes(x.value)),g=x=>{x&&r?.(x.map(w=>w.value))},y=m.length===0?n:`${m.length} selected`;return o.jsxs("div",{className:gn.root,children:[o.jsxs(sKe,{multiple:!0,items:e,value:m,onValueChange:g,disabled:l,open:d,onOpenChange:f,children:[o.jsxs(fKe,{className:Z(pC({variant:c,size:u}),gn.trigger,p&&gn.triggerError,i),children:[o.jsx("span",{className:Z("truncate",m.length===0&&gn.placeholder),children:y}),o.jsx(kF,{className:gn.chevron})]}),o.jsx(gKe,{container:h,children:o.jsx(bKe,{align:"start",sideOffset:4,className:gn.positioner,children:o.jsxs(xKe,{className:gn.popup,children:[o.jsxs("div",{className:gn.searchContainer,children:[o.jsx(w_,{className:gn.searchIcon}),o.jsx(dKe,{className:gn.searchInput,placeholder:s})]}),o.jsx(_Ke,{className:gn.empty,children:a}),o.jsx(pKe,{className:gn.list,children:x=>{const w=t.includes(x.value);return o.jsxs(kKe,{value:x,className:gn.item,children:[o.jsx("span",{className:Z(gn.checkbox,w?gn.checkboxSelected:gn.checkboxUnselected),children:w&&o.jsx(dv,{className:gn.checkboxIcon})}),o.jsxs("span",{className:gn.optionContent,children:[x.start,o.jsxs("span",{className:gn.optionText,children:[o.jsx("span",{className:gn.optionLabel,children:x.label}),x.description&&o.jsx("span",{className:gn.optionDescription,children:x.description})]}),x.end?o.jsx("div",{className:gn.optionEnd,children:x.end}):null]})]},x.value)}})]})})})]}),p&&o.jsx("span",{className:gn.error,children:p})]})}const kn=QF,Odt=IYe,yLr=WF,vLr=WR,kdt=b.forwardRef(({className:e,...t},r)=>o.jsx(HR,{ref:r,className:Z("fixed inset-0 z-50 bg-overlay backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));kdt.displayName=HR.displayName;const xn=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(yLr,{children:[o.jsx(kdt,{}),o.jsxs(QR,{ref:n,className:Z("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]","gap-4 border border-border1 bg-surface3 py-6 shadow-dialog rounded-lg","duration-slow","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-bottom-4","data-[state=open]:slide-in-from-bottom-4",e),...r,children:[t,o.jsxs(WR,{className:Z("absolute right-4 top-4 rounded-md p-1","text-neutral3 hover:text-neutral6 hover:bg-surface4","transition-all duration-normal ease-out-custom","focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring","disabled:pointer-events-none"),children:[o.jsx(Xl,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));xn.displayName=QR.displayName;const _n=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col space-y-1.5 text-center sm:text-left border-b border-border1 pb-4 px-6",e),...t});_n.displayName="DialogHeader";const hf=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});hf.displayName="DialogFooter";const qn=({className:e,...t})=>o.jsx("div",{className:Z("overflow-y-auto px-6 max-h-[50vh]",e),...t});qn.displayName="DialogBody";const wn=b.forwardRef(({className:e,...t},r)=>o.jsx(GF,{ref:r,className:Z("text-ui-md font-medium",e),...t}));wn.displayName=GF.displayName;const Js=b.forwardRef(({className:e,...t},r)=>o.jsx(ZF,{ref:r,className:Z("sr-only",e),...t}));Js.displayName=ZF.displayName;const _dt=b.forwardRef(({className:e,...t},r)=>o.jsx(ad,{ref:r,className:Z("flex h-full w-full flex-col overflow-hidden rounded-md bg-surface3 text-neutral5",e),...t}));_dt.displayName=ad.displayName;const bLr=({children:e,title:t="Command Palette",description:r="Search for commands and actions",...n})=>{const s=b.useCallback((i,l)=>{const c=i.toLowerCase();return l.toLowerCase().split(/\s+/).filter(Boolean).every(h=>c.includes(h))?1:0},[]),a=b.useCallback(i=>{i.stopPropagation()},[]);return o.jsx(kn,{...n,children:o.jsxs(xn,{className:"overflow-hidden p-0",children:[o.jsx(wn,{className:"sr-only",children:t}),o.jsx(Js,{className:"sr-only",children:r}),o.jsx(_dt,{filter:s,onKeyDown:a,className:Z("**:[[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-neutral3","[&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 **:[[cmdk-group]]:px-2","[&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5","**:[[cmdk-input]]:h-12","**:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3","[&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5"),children:e})]})})},Edt=b.forwardRef(({className:e,...t},r)=>o.jsxs("div",{className:Z("flex items-center border-b border-border1 px-3",sn.colors),"cmdk-input-wrapper":"",children:[o.jsx(w_,{className:Z("mr-2 h-4 w-4 shrink-0 text-neutral3",sn.colors)}),o.jsx(ad.Input,{ref:r,className:Z("flex h-10 w-full rounded-md bg-transparent py-3 text-sm","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-hidden",sn.colors,e),...t})]}));Edt.displayName=ad.Input.displayName;const Cdt=b.forwardRef(({className:e,...t},r)=>o.jsx(ad.List,{ref:r,className:Z("max-h-dropdown-max-height overflow-y-auto overflow-x-hidden",e),...t}));Cdt.displayName=ad.List.displayName;const jdt=b.forwardRef((e,t)=>o.jsx(ad.Empty,{ref:t,className:"py-6 text-center text-sm text-neutral3",...e}));jdt.displayName=ad.Empty.displayName;const gb=b.forwardRef(({className:e,...t},r)=>o.jsx(ad.Group,{ref:r,className:Z("overflow-hidden p-1 text-neutral5","**:[[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-neutral3",e),...t}));gb.displayName=ad.Group.displayName;const cw=b.forwardRef(({className:e,...t},r)=>o.jsx(ad.Separator,{ref:r,className:Z("-mx-1 h-px bg-border1",e),...t}));cw.displayName=ad.Separator.displayName;const Zo=b.forwardRef(({className:e,...t},r)=>o.jsx(ad.Item,{ref:r,className:Z("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden",sn.colors,"data-[selected=true]:bg-surface5 data-[selected=true]:text-neutral5","data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Zo.displayName=ad.Item.displayName;const Tdt=({className:e,...t})=>o.jsx("span",{className:Z("ml-auto text-xs tracking-widest text-neutral3",e),...t});Tdt.displayName="CommandShortcut";function Ndt({children:e,className:t}){return o.jsx("div",{className:Z("border border-border1 rounded-lg p-6 bg-surface2",t),children:e})}const xLr=Crr,wLr=jrr,SLr=rP,OLr=Arr,kLr=Trr,fme=Z("relative flex cursor-pointer select-none items-center gap-3 rounded-lg px-3 py-1.5 text-sm transition-colors text-neutral4 dark:hover:text-white dark:focus:text-white hover:text-neutral6 focus:text-neutral6 hover:bg-surface4 focus:bg-surface4 active:bg-surface5 data-disabled:pointer-events-none data-disabled:opacity-50 [&>span]:truncate [&_svg]:size-4 [&_svg]:shrink-0 focus-visible:outline-hidden focus-visible:ring-0","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:opacity-50 [&>svg]:mx-[-.25em] [&:hover>svg]:opacity-100"),Adt=b.forwardRef(({className:e,children:t,...r},n)=>o.jsx(jJe,{ref:n,className:Z("cursor-pointer",e),...r,children:t}));Adt.displayName=jJe.displayName;const Idt=b.forwardRef(({className:e,inset:t,children:r,...n},s)=>o.jsxs(MJe,{ref:s,className:Z(fme,"data-[state=open]:bg-surface4",t&&"pl-8",e),...n,children:[r,o.jsx("span",{className:"ml-auto pl-2",children:o.jsx(Lce,{className:"-rotate-90 opacity-50"})})]}));Idt.displayName=MJe.displayName;const Rdt=b.forwardRef(({className:e,...t},r)=>o.jsx(rP,{children:o.jsx(lz,{ref:r,className:Z("bg-surface3 backdrop-blur-xl data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 z-50 min-w-44 max-h-[min(20rem,var(--radix-dropdown-menu-content-available-height))] overflow-x-hidden overflow-y-auto rounded-xl border-2 border-border1/50 p-1 shadow-md",e),...t})}));Rdt.displayName=lz.displayName;const Pdt=b.forwardRef(({className:e,container:t,sideOffset:r=8,...n},s)=>o.jsx(rP,{container:t,children:o.jsx(TJe,{ref:s,sideOffset:r,className:Z("bg-surface3 data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 backdrop-blur-xl text-neutral4 z-50 min-w-44 max-h-[min(20rem,var(--radix-dropdown-menu-content-available-height))] overflow-x-hidden overflow-y-auto rounded-xl border-2 border-border1/50 p-1 shadow-md",e),...n})}));Pdt.displayName=TJe.displayName;const Mdt=b.forwardRef(({className:e,...t},r)=>o.jsx(AJe,{ref:r,className:Z(fme,e),...t}));Mdt.displayName=AJe.displayName;const Ddt=b.forwardRef(({className:e,children:t,checked:r,...n},s)=>o.jsxs(IJe,{ref:s,className:Z(fme,"w-full gap-4 px-2",e),checked:r,...n,children:[o.jsx("div",{className:"border dark:border-white/20 border-black/20 flex h-4 w-4 items-center justify-center rounded-sm",children:r&&o.jsx(dv,{})}),t]}));Ddt.displayName=IJe.displayName;const Ldt=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(RJe,{ref:n,className:Z("relative flex cursor-pointer select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm transition-colors text-neutral4 dark:hover:text-white dark:focus:text-white hover:text-neutral6 focus:text-neutral6 hover:bg-surface4 focus:bg-surface4 active:bg-surface5 data-disabled:pointer-events-none data-disabled:opacity-50 focus-visible:outline-hidden focus-visible:ring-0",e),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(Nrr,{children:o.jsx(kHe,{className:"h-2 w-2 fill-current"})})}),t]}));Ldt.displayName=RJe.displayName;const $dt=b.forwardRef(({className:e,inset:t,...r},n)=>o.jsx(NJe,{ref:n,className:Z("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));$dt.displayName=NJe.displayName;const Fdt=b.forwardRef(({className:e,...t},r)=>o.jsx(PJe,{ref:r,className:Z("bg-border1/50 -mx-1.5 my-1 h-0.5",e),...t}));Fdt.displayName=PJe.displayName;const zdt=({className:e,...t})=>o.jsx("span",{className:Z("ml-auto text-xs tracking-widest opacity-60",e),...t});zdt.displayName="DropdownMenuShortcut";function vt({open:e,onOpenChange:t,children:r,modal:n}){return o.jsx(xLr,{modal:n,open:e,onOpenChange:t,children:r})}vt.Trigger=Adt;vt.Content=Pdt;vt.Group=wLr;vt.Portal=SLr;vt.Item=Mdt;vt.CheckboxItem=Ddt;vt.RadioItem=Ldt;vt.Label=$dt;vt.Separator=Fdt;vt.Shortcut=zdt;vt.Sub=OLr;vt.SubContent=Rdt;vt.SubTrigger=Idt;vt.RadioGroup=kLr;const KD=({label:e,children:t})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(me,{as:"p",variant:"ui-md",className:"text-neutral3",children:e}),t]});function Mn({className:e,...t}){return o.jsx("div",{className:Z("rounded-md bg-surface4 relative overflow-hidden","before:absolute before:inset-0","before:-translate-x-full","before:animate-[shimmer_2s_infinite]","before:bg-linear-to-r before:from-transparent before:via-surface5/20 before:to-transparent",e),...t})}const Bdt=({icon:e,title:t,isLoading:r,children:n})=>o.jsxs("div",{className:"p-5 w-full overflow-x-hidden",children:[o.jsxs("div",{className:"text-neutral6 flex items-center gap-2",children:[o.jsx(Ce,{size:"lg",className:"bg-surface4 rounded-md p-1",children:e}),r?o.jsx(Mn,{className:"h-3 w-1/3"}):o.jsx("div",{className:"flex min-w-0 items-center gap-4",children:o.jsx(me,{variant:"header-md",as:"h2",className:"truncate font-medium",children:t})})]}),n&&o.jsx("div",{className:"pt-2",children:n})]});function _Lr({children:e,className:t}){return o.jsx("div",{className:Z("grid gap-2 text-neutral4",t),children:e})}function ELr({children:e}){return o.jsxs("p",{className:Z("text-ui-sm text-neutral4 flex items-center gap-2","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-70 [&>svg]:text-red-400"),children:[o.jsx(LE,{})," ",e]})}function CLr({children:e}){return o.jsx("p",{className:"text-neutral3 text-ui-sm",children:e})}function jLr({children:e,name:t,required:r,size:n="default",className:s}){return o.jsxs("label",{htmlFor:`input-${t}`,className:Z("text-ui-smd text-neutral3 flex justify-between items-center ","in-[.horizontal-field-block]:grid in-[.horizontal-field-block]:content-start",{"text-ui-md":n==="bigger"},s),children:[e,r&&o.jsx("i",{className:"text-neutral2 text-xs",children:"(required)"})]})}function TLr({children:e,className:t,layout:r="vertical",labelColumnWidth:n}){return o.jsx("div",{className:Z("grid gap-2 text-neutral4",{"horizontal-field-block grid-cols-[auto_1fr] items-baseline":r==="horizontal"},t),style:r==="horizontal"&&n?{gridTemplateColumns:`${n} 1fr`}:void 0,children:e})}const mo=Object.assign({},{Layout:TLr,Column:_Lr,Label:jLr,HelpText:CLr,ErrorMsg:ELr});function NLr({children:e,className:t}){return o.jsx("div",{className:Z("grid gap-6 content-start",t),children:e})}function ALr({children:e,className:t,columns:r=1,gap:n}){return o.jsx("div",{className:Z("grid",{"grid-cols-1":r===1,"grid-cols-2":r===2},n??"gap-6",t),children:e})}Object.assign(ALr,{Column:NLr});const ILr=gC(Z("flex w-full text-neutral6 border bg-transparent","transition-all duration-normal ease-out-custom","placeholder:text-neutral2 placeholder:transition-opacity placeholder:duration-normal","focus:placeholder:opacity-70"),{variants:{variant:{default:Z(nme,sme,ame),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:`${Ql.sm} text-ui-sm px-[.75em]`,md:`${Ql.md} text-ui-md px-[.75em]`,default:`${Ql.default} text-ui-md px-[.85em]`,lg:`${Ql.lg} text-ui-lg px-[.85em]`}},defaultVariants:{variant:"default",size:"default"}}),sr=b.forwardRef(({className:e,size:t,testId:r,variant:n,type:s,error:a,...i},l)=>o.jsx("input",{type:s,className:Z(ILr({variant:n,size:t}),a&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":r,ref:l,"aria-invalid":a,...i}));sr.displayName="Input";function jx({name:e,value:t,label:r,labelIsHidden:n=!1,labelColumnWidth:s,helpText:a,errorMsg:i,required:l=!1,disabled:c=!1,labelSize:u,layout:d="vertical",placeholder:f,size:h="default",testId:p,className:m,...g}){return o.jsxs(mo.Layout,{layout:d,labelColumnWidth:s,className:m,children:[d==="horizontal"?o.jsx(mo.Column,{children:o.jsx(mo.Label,{name:e,required:l,size:u||"bigger",children:n?o.jsx(Ku,{children:r}):r})}):null,o.jsxs(mo.Column,{children:[!n&&d==="vertical"?o.jsx(mo.Label,{name:e,required:l,size:u||"default",children:r}):null,o.jsx(sr,{name:e,disabled:c,required:l,value:t,placeholder:f,"data-testid":p,size:h,...g}),a&&o.jsx(mo.HelpText,{children:a}),i&&o.jsx(mo.ErrorMsg,{children:i})]})]})}function Tx({name:e,helpText:t,errorMsg:r,required:n=!1,disabled:s=!1,value:a,label:i,labelIsHidden:l=!1,layout:c="vertical",placeholder:u="Search...",onChange:d,onReset:f,className:h,size:p,isMinimized:m,onMinimizedChange:g}){const y=b.useRef(null);return b.useEffect(()=>{m===!1&&y.current?.focus()},[m]),m?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(pe,{size:p||"sm","aria-label":i||"Search",disabled:s,onClick:()=>g?.(!1),children:o.jsx(w_,{})})}),o.jsx(Wr,{children:i||"Search"})]}):o.jsxs(mo.Layout,{layout:c,className:h,children:[c==="horizontal"?o.jsx(mo.Column,{children:o.jsx(mo.Label,{name:e,required:n,children:l?o.jsx(Ku,{children:i}):i})}):null,o.jsxs(mo.Column,{children:[c==="vertical"&&i&&!l?o.jsx(mo.Label,{name:e,required:n,children:i}):null,o.jsxs("div",{className:"relative group",children:[o.jsx(sr,{ref:y,name:e,disabled:s,value:a,placeholder:u,onChange:d,size:p,className:Z(p==="sm"&&"pl-8 pr-8",p==="md"&&"pl-9 pr-9",(!p||p==="default")&&"pl-10 pr-10",p==="lg"&&"pl-11 pr-11")}),o.jsx(w_,{"aria-hidden":"true",className:Z("text-neutral4 opacity-50 group-has-focus:opacity-100 absolute left-3 top-1/2 -translate-y-1/2",p==="sm"&&"w-3.5 h-3.5",p==="md"&&"w-4 h-4",(!p||p==="default")&&"w-[1.125rem] h-[1.125rem]",p==="lg"&&"w-5 h-5")}),f&&(a||m===!1)&&o.jsx(pe,{variant:"ghost",size:p||"default","aria-label":"Clear search",onClick:()=>{a&&f(),m===!1&&g?.(!0)},className:"absolute top-1/2 right-0 -translate-y-1/2",children:o.jsx(Xl,{})})]}),t&&o.jsx(mo.HelpText,{children:t}),r&&o.jsx(mo.ErrorMsg,{children:r})]})]})}const fi=inr,hi=onr,Ja=b.forwardRef(({className:e,children:t,variant:r="inputLike",size:n="default",...s},a)=>o.jsxs(iet,{ref:a,className:Z(pC({variant:r,size:n}),"justify-between [&>svg]:opacity-100",e),...s,children:[t,o.jsx(lnr,{asChild:!0,children:o.jsx(Lce,{className:Z("h-4 w-4 text-neutral3",sn.colors)})})]}));Ja.displayName=iet.displayName;const ei=b.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>o.jsx(cnr,{children:o.jsx(oet,{ref:s,className:Z("relative z-50 min-w-32 max-h-dropdown-max-height overflow-y-auto overflow-x-hidden rounded-md border border-border1 bg-surface3 text-neutral5 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",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:o.jsx(unr,{className:Z("p-1",r==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)"),children:t})})}));ei.displayName=oet.displayName;const ns=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(cet,{ref:n,className:Z("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-neutral5 text-sm",sn.colors,"hover:bg-surface5 hover:text-neutral5","focus:bg-surface5 focus:text-neutral5","data-[state=checked]:bg-accent1Dark data-[state=checked]:text-accent1","data-disabled:pointer-events-none data-disabled:opacity-50",e),...r,children:[o.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(fnr,{children:o.jsx(dv,{className:"h-4 w-4 text-accent1"})})}),o.jsx(dnr,{children:t})]}));ns.displayName=cet.displayName;function $o({name:e,helpText:t,errorMsg:r,required:n=!1,disabled:s=!1,size:a="default",value:i,label:l,labelIsHidden:c=!1,layout:u="vertical",labelColumnWidth:d,options:f,placeholder:h="Select an option",onValueChange:p,className:m}){return o.jsxs(mo.Layout,{layout:u,labelColumnWidth:d,className:m,children:[u==="horizontal"?o.jsx(mo.Column,{children:o.jsx(mo.Label,{name:e,required:n,children:c?o.jsx(Ku,{children:l}):l})}):null,o.jsxs(mo.Column,{children:[u==="vertical"&&l&&!c?o.jsx(mo.Label,{name:e,required:n,children:l}):null,o.jsxs(fi,{"aria-label":c?l:void 0,name:e,value:i,onValueChange:p,disabled:s,children:[o.jsx(Ja,{size:a,children:o.jsx(hi,{placeholder:h})}),o.jsx(ei,{children:f.map(g=>o.jsx(ns,{value:g.value,children:g.label},g.value))})]}),t&&o.jsx(mo.HelpText,{children:t}),r&&o.jsx(mo.ErrorMsg,{children:r})]})]})}const RLr={sm:`${Ql.sm} w-form-sm`,md:`${Ql.md} w-form-md`,lg:`${Ql.lg} w-form-lg`,default:`${Ql.default}`},PLr={sm:"sm",md:"default",lg:"lg",default:"default"},MLr={default:"bg-surface2 hover:bg-surface4 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",light:"bg-surface3 hover:bg-surface5 text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",outline:"bg-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",ghost:"bg-transparent border-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-accent1 hover:bg-accent1/90 text-surface1 font-medium hover:shadow-glow-accent1 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-none"},DLr="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",Dn=je.forwardRef(({className:e,children:t,tooltip:r,size:n="md",variant:s="default",disabled:a,...i},l)=>o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("button",{ref:l,disabled:a,"aria-label":typeof r=="string"?r:void 0,className:Z(DLr,AP,MLr[s],RLr[n],a&&"active:scale-100",e),...i,children:o.jsx(Ce,{size:PLr[n],children:t})})}),o.jsx(Wr,{children:r})]}));Dn.displayName="IconButton";const LLr=gC("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xt=b.forwardRef(({className:e,...t},r)=>o.jsx(det,{ref:r,className:Z(LLr(),e),...t}));xt.displayName=det.displayName;function K_({children:e}){const t=e.replace(/\\n/g,`
|
|
290
|
+
`).concat(k.x,",").concat(k.y),E=kl(e.id)?WA("recharts-radial-line-"):e.id;return b.createElement("text",ky({},n,{dominantBaseline:"central",className:va("recharts-radial-bar-label",i)}),b.createElement("defs",null,b.createElement("path",{id:E,d:_})),b.createElement("textPath",{xlinkHref:"#".concat(E)},r))},hNr=(e,t,r)=>{var{cx:n,cy:s,innerRadius:a,outerRadius:i,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(r==="outside"){var{x:d,y:f}=Hl(n,s,i+t,u);return{x:d,y:f,textAnchor:d>=n?"start":"end",verticalAnchor:"middle"}}if(r==="center")return{x:n,y:s,textAnchor:"middle",verticalAnchor:"middle"};if(r==="centerTop")return{x:n,y:s,textAnchor:"middle",verticalAnchor:"start"};if(r==="centerBottom")return{x:n,y:s,textAnchor:"middle",verticalAnchor:"end"};var h=(a+i)/2,{x:p,y:m}=Hl(n,s,h,u);return{x:p,y:m,textAnchor:"middle",verticalAnchor:"middle"}},x$=e=>e!=null&&"cx"in e&&qr(e.cx),pNr={angle:0,offset:5,zIndex:Yc.label,position:"middle",textBreakAll:!1};function mNr(e){if(!x$(e))return e;var{cx:t,cy:r,outerRadius:n}=e,s=n*2;return{x:t-n,y:r-n,width:s,upperWidth:s,lowerWidth:s,height:s}}function Ob(e){var t=id(e,pNr),{viewBox:r,parentViewBox:n,position:s,value:a,children:i,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=cNr(),h=Flt(),p=s==="center"?h:f??h,m,g,y;r==null?m=p:x$(r)?m=r:m=xhe(r);var x=mNr(m);if(!m||kl(a)&&kl(i)&&!b.isValidElement(l)&&typeof l!="function")return null;var w=qT(qT({},t),{},{viewBox:m});if(b.isValidElement(l)){var{labelRef:S}=w,k=CAe(w,tNr);return b.cloneElement(l,k)}if(typeof l=="function"){var{content:_}=w,E=CAe(w,rNr);if(g=b.createElement(l,E),b.isValidElement(g))return g}else g=uNr(t);var T=iu(t);if(x$(m)){if(s==="insideStart"||s==="insideEnd"||s==="end")return fNr(t,s,g,T,m);y=hNr(m,t.offset,t.position)}else{if(!x)return null;var j=eNr({viewBox:x,position:s,offset:t.offset,parentViewBox:x$(n)?void 0:n});y=qT(qT({x:j.x,y:j.y,textAnchor:j.horizontalAnchor,verticalAnchor:j.verticalAnchor},j.width!==void 0?{width:j.width}:{}),j.height!==void 0?{height:j.height}:{})}return b.createElement(Ov,{zIndex:t.zIndex},b.createElement(Epe,ky({ref:d,className:va("recharts-label",c)},T,y,{textAnchor:Plt(T.textAnchor)?T.textAnchor:y.textAnchor,breakAll:u}),g))}Ob.displayName="Label";var gNr=(e,t,r)=>{if(!e)return null;var n={viewBox:t,labelRef:r};return e===!0?b.createElement(Ob,ky({key:"label-implicit"},n)):sg(e)?b.createElement(Ob,ky({key:"label-implicit",value:e},n)):b.isValidElement(e)?e.type===Ob?b.cloneElement(e,qT({key:"label-implicit"},n)):b.createElement(Ob,ky({key:"label-implicit",content:e},n)):Cpe(e)?b.createElement(Ob,ky({key:"label-implicit",content:e},n)):e&&typeof e=="object"?b.createElement(Ob,ky({},e,{key:"label-implicit"},n)):null};function yNr(e){var{label:t,labelRef:r}=e,n=Flt();return gNr(t,n,r)||null}var vNr=["valueAccessor"],bNr=["dataKey","clockWise","id","textBreakAll","zIndex"];function y4(){return y4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},y4.apply(null,arguments)}function TAe(e,t){if(e==null)return{};var r,n,s=xNr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function xNr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var wNr=e=>{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(QTr(t))return t},zlt=b.createContext(void 0),SNr=zlt.Provider,Blt=b.createContext(void 0);Blt.Provider;function ONr(){return b.useContext(zlt)}function kNr(){return b.useContext(Blt)}function w$(e){var{valueAccessor:t=wNr}=e,r=TAe(e,vNr),{dataKey:n,clockWise:s,id:a,textBreakAll:i,zIndex:l}=r,c=TAe(r,bNr),u=ONr(),d=kNr(),f=u||d;return!f||!f.length?null:b.createElement(Ov,{zIndex:l??Yc.label},b.createElement(Gy,{className:"recharts-label-list"},f.map((h,p)=>{var m,g=kl(n)?t(h,p):Yl(h.payload,n),y=kl(a)?{}:{id:"".concat(a,"-").concat(p)};return b.createElement(Ob,y4({key:"label-".concat(p)},iu(h),c,y,{fill:(m=r.fill)!==null&&m!==void 0?m:h.fill,parentViewBox:h.parentViewBox,value:g,textBreakAll:i,viewBox:h.viewBox,index:p,zIndex:0}))})))}w$.displayName="LabelList";function _Nr(e){var{label:t}=e;return t?t===!0?b.createElement(w$,{key:"labelList-implicit"}):b.isValidElement(t)||Cpe(t)?b.createElement(w$,{key:"labelList-implicit",content:t}):typeof t=="object"?b.createElement(w$,y4({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function qae(){return qae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qae.apply(null,arguments)}var Ult=e=>{var{cx:t,cy:r,r:n,className:s}=e,a=va("recharts-dot",s);return qr(t)&&qr(r)&&qr(n)?b.createElement("circle",qae({},ng(e),dhe(e),{className:a,cx:t,cy:r,r:n})):null},ENr={radiusAxis:{},angleAxis:{}},Vlt=jc({name:"polarAxis",initialState:ENr,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:YRn,removeRadiusAxis:XRn,addAngleAxis:KRn,removeAngleAxis:JRn}=Vlt.actions,CNr=Vlt.reducer;function jNr(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var qH={exports:{}},Xs={};var NAe;function TNr(){if(NAe)return Xs;NAe=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),i=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),m;m=Symbol.for("react.module.reference");function g(y){if(typeof y=="object"&&y!==null){var x=y.$$typeof;switch(x){case e:switch(y=y.type,y){case r:case s:case n:case u:case d:return y;default:switch(y=y&&y.$$typeof,y){case l:case i:case c:case h:case f:case a:return y;default:return x}}case t:return x}}}return Xs.ContextConsumer=i,Xs.ContextProvider=a,Xs.Element=e,Xs.ForwardRef=c,Xs.Fragment=r,Xs.Lazy=h,Xs.Memo=f,Xs.Portal=t,Xs.Profiler=s,Xs.StrictMode=n,Xs.Suspense=u,Xs.SuspenseList=d,Xs.isAsyncMode=function(){return!1},Xs.isConcurrentMode=function(){return!1},Xs.isContextConsumer=function(y){return g(y)===i},Xs.isContextProvider=function(y){return g(y)===a},Xs.isElement=function(y){return typeof y=="object"&&y!==null&&y.$$typeof===e},Xs.isForwardRef=function(y){return g(y)===c},Xs.isFragment=function(y){return g(y)===r},Xs.isLazy=function(y){return g(y)===h},Xs.isMemo=function(y){return g(y)===f},Xs.isPortal=function(y){return g(y)===t},Xs.isProfiler=function(y){return g(y)===s},Xs.isStrictMode=function(y){return g(y)===n},Xs.isSuspense=function(y){return g(y)===u},Xs.isSuspenseList=function(y){return g(y)===d},Xs.isValidElementType=function(y){return typeof y=="string"||typeof y=="function"||y===r||y===s||y===n||y===u||y===d||y===p||typeof y=="object"&&y!==null&&(y.$$typeof===h||y.$$typeof===f||y.$$typeof===a||y.$$typeof===i||y.$$typeof===c||y.$$typeof===m||y.getModuleId!==void 0)},Xs.typeOf=g,Xs}var AAe;function NNr(){return AAe||(AAe=1,qH.exports=TNr()),qH.exports}NNr();var qlt=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,HH={},IAe;function ANr(){return IAe||(IAe=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){const s=r[Symbol.toStringTag];return s==null||!Object.getOwnPropertyDescriptor(r,Symbol.toStringTag)?.writable?!1:r.toString()===`[object ${s}]`}let n=r;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(r)===n}e.isPlainObject=t})(HH)),HH}var QH,RAe;function INr(){return RAe||(RAe=1,QH=ANr().isPlainObject),QH}var RNr=INr();const PNr=Uo(RNr);var PAe,MAe,DAe,LAe,$Ae;function FAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function zAe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?FAe(Object(r),!0).forEach(function(n){MNr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):FAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function MNr(e,t,r){return(t=DNr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function DNr(e){var t=LNr(e,"string");return typeof t=="symbol"?t:t+""}function LNr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function v4(){return v4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},v4.apply(null,arguments)}function sT(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var BAe=(e,t,r,n,s)=>{var a=r-n,i;return i=Hi(PAe||(PAe=sT(["M ",",",""])),e,t),i+=Hi(MAe||(MAe=sT(["L ",",",""])),e+r,t),i+=Hi(DAe||(DAe=sT(["L ",",",""])),e+r-a/2,t+s),i+=Hi(LAe||(LAe=sT(["L ",",",""])),e+r-a/2-n,t+s),i+=Hi($Ae||($Ae=sT(["L ",","," Z"])),e,t),i},$Nr={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},FNr=e=>{var t=id(e,$Nr),{x:r,y:n,upperWidth:s,lowerWidth:a,height:i,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,h=b.useRef(null),[p,m]=b.useState(-1),g=b.useRef(s),y=b.useRef(a),x=b.useRef(i),w=b.useRef(r),S=b.useRef(n),k=khe(e,"trapezoid-");if(b.useEffect(()=>{if(h.current&&h.current.getTotalLength)try{var M=h.current.getTotalLength();M&&m(M)}catch{}},[]),r!==+r||n!==+n||s!==+s||a!==+a||i!==+i||s===0&&a===0||i===0)return null;var _=va("recharts-trapezoid",l);if(!f)return b.createElement("g",null,b.createElement("path",v4({},iu(t),{className:_,d:BAe(r,n,s,a,i)})));var E=g.current,T=y.current,j=x.current,N=w.current,I=S.current,P="0px ".concat(p===-1?1:p,"px"),R="".concat(p,"px ").concat(p,"px"),$=iit(["strokeDasharray"],u,c);return b.createElement(Ohe,{animationId:k,key:k,canBegin:p>0,duration:u,easing:c,isActive:f,begin:d},M=>{var z=Lu(E,s,M),U=Lu(T,a,M),B=Lu(j,i,M),H=Lu(N,r,M),W=Lu(I,n,M);h.current&&(g.current=z,y.current=U,x.current=B,w.current=H,S.current=W);var L=M>0?{transition:$,strokeDasharray:R}:{strokeDasharray:P};return b.createElement("path",v4({},iu(t),{className:_,d:BAe(H,W,z,U,B),ref:h,style:zAe(zAe({},L),t.style)}))})},zNr=["option","shapeType","activeClassName","inActiveClassName"];function BNr(e,t){if(e==null)return{};var r,n,s=UNr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function UNr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function UAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function b4(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?UAe(Object(r),!0).forEach(function(n){VNr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function VNr(e,t,r){return(t=qNr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qNr(e){var t=HNr(e,"string");return typeof t=="symbol"?t:t+""}function HNr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function QNr(e,t){return b4(b4({},t),e)}function WNr(e,t){return e==="symbols"}function VAe(e){var{shapeType:t,elementProps:r}=e;switch(t){case"rectangle":return b.createElement(uit,r);case"trapezoid":return b.createElement(FNr,r);case"sector":return b.createElement(hit,r);case"symbols":if(WNr(t))return b.createElement(Yst,r);break;case"curve":return b.createElement(ait,r);default:return null}}function GNr(e){return b.isValidElement(e)?e.props:e}function ZNr(e){var{option:t,shapeType:r,activeClassName:n="recharts-active-shape",inActiveClassName:s="recharts-shape"}=e,a=BNr(e,zNr),i;if(b.isValidElement(t))i=b.cloneElement(t,b4(b4({},a),GNr(t)));else if(typeof t=="function")i=t(a,a.index);else if(PNr(t)&&typeof t!="boolean"){var l=QNr(t,a);i=b.createElement(VAe,{shapeType:r,elementProps:l})}else{var c=a;i=b.createElement(VAe,{shapeType:r,elementProps:c})}return a.isActive?b.createElement(Gy,{className:n},i):b.createElement(Gy,{className:s},i)}function YNr(e){var{tooltipEntrySettings:t}=e,r=Vo(),n=od(),s=b.useRef(null);return b.useLayoutEffect(()=>{n||(s.current===null?r(sCr(t)):s.current!==t&&r(aCr({prev:s.current,next:t})),s.current=t)},[t,r,n]),b.useLayoutEffect(()=>()=>{s.current&&(r(iCr(s.current)),s.current=null)},[r]),null}function XNr(e){var{legendPayload:t}=e,r=Vo(),n=od(),s=b.useRef(null);return b.useLayoutEffect(()=>{n||(s.current===null?r(bSr(t)):s.current!==t&&r(xSr({prev:s.current,next:t})),s.current=t)},[r,n,t]),b.useLayoutEffect(()=>()=>{s.current&&(r(wSr(s.current)),s.current=null)},[r]),null}var WH,KNr=()=>{var[e]=b.useState(()=>WA("uid-"));return e},JNr=(WH=t1.useId)!==null&&WH!==void 0?WH:KNr;function eAr(e,t){var r=JNr();return t||(e?"".concat(e,"-").concat(r):r)}var tAr=b.createContext(void 0),rAr=e=>{var{id:t,type:r,children:n}=e,s=eAr("recharts-".concat(r),t);return b.createElement(tAr.Provider,{value:s},n(s))},nAr={cartesianItems:[],polarItems:[]},Hlt=jc({name:"graphicalItems",initialState:nAr,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:oi()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,s=fh(e).cartesianItems.indexOf(r);s>-1&&(e.cartesianItems[s]=n)},prepare:oi()},removeCartesianGraphicalItem:{reducer(e,t){var r=fh(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:oi()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:oi()},removePolarGraphicalItem:{reducer(e,t){var r=fh(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:oi()},replacePolarGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,s=fh(e).polarItems.indexOf(r);s>-1&&(e.polarItems[s]=n)},prepare:oi()}}}),{addCartesianGraphicalItem:sAr,replaceCartesianGraphicalItem:aAr,removeCartesianGraphicalItem:iAr,addPolarGraphicalItem:ePn,removePolarGraphicalItem:tPn,replacePolarGraphicalItem:rPn}=Hlt.actions,oAr=Hlt.reducer,lAr=e=>{var t=Vo(),r=b.useRef(null);return b.useLayoutEffect(()=>{r.current===null?t(sAr(e)):r.current!==e&&t(aAr({prev:r.current,next:e})),r.current=e},[t,e]),b.useLayoutEffect(()=>()=>{r.current&&(t(iAr(r.current)),r.current=null)},[t]),null},cAr=b.memo(lAr),uAr=["points"];function qAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function GH(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qAe(Object(r),!0).forEach(function(n){dAr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function dAr(e,t,r){return(t=fAr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fAr(e){var t=hAr(e,"string");return typeof t=="symbol"?t:t+""}function hAr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function x4(){return x4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},x4.apply(null,arguments)}function pAr(e,t){if(e==null)return{};var r,n,s=mAr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function mAr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function gAr(e){var{option:t,dotProps:r,className:n}=e;if(b.isValidElement(t))return b.cloneElement(t,r);if(typeof t=="function")return t(r);var s=va(n,typeof t!="boolean"?t.className:""),a=r??{},{points:i}=a,l=pAr(a,uAr);return b.createElement(Ult,x4({},l,{className:s}))}function yAr(e,t){return e==null?!1:t?!0:e.length===1}function vAr(e){var{points:t,dot:r,className:n,dotClassName:s,dataKey:a,baseProps:i,needClip:l,clipPathId:c,zIndex:u=Yc.scatter}=e;if(!yAr(t,r))return null;var d=qlt(r),f=Nbr(r),h=t.map((m,g)=>{var y,x,w=GH(GH(GH({r:3},i),f),{},{index:g,cx:(y=m.x)!==null&&y!==void 0?y:void 0,cy:(x=m.y)!==null&&x!==void 0?x:void 0,dataKey:a,value:m.value,payload:m.payload,points:t});return b.createElement(gAr,{key:"dot-".concat(g),option:r,dotProps:w,className:s})}),p={};return l&&c!=null&&(p.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),b.createElement(Ov,{zIndex:u},b.createElement(Gy,x4({className:n},p),h))}function HAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function QAe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?HAe(Object(r),!0).forEach(function(n){bAr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):HAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bAr(e,t,r){return(t=xAr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xAr(e){var t=wAr(e,"string");return typeof t=="symbol"?t:t+""}function wAr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var SAr={xAxis:{},yAxis:{},zAxis:{}},Qlt=jc({name:"cartesianAxis",initialState:SAr,reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:oi()},replaceXAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.xAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.xAxis[r.id],e.xAxis[n.id]=n)},prepare:oi()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:oi()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:oi()},replaceYAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.yAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.yAxis[r.id],e.yAxis[n.id]=n)},prepare:oi()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:oi()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:oi()},replaceZAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.zAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.zAxis[r.id],e.zAxis[n.id]=n)},prepare:oi()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:oi()},updateYAxisWidth(e,t){var{id:r,width:n}=t.payload,s=e.yAxis[r];if(s){var a,i=s.widthHistory||[];if(i.length===3&&i[0]===i[2]&&n===i[1]&&n!==s.width&&Math.abs(n-((a=i[0])!==null&&a!==void 0?a:0))<=1)return;var l=[...i,n].slice(-3);e.yAxis[r]=QAe(QAe({},s),{},{width:n,widthHistory:l})}}}}),{addXAxis:OAr,replaceXAxis:kAr,removeXAxis:_Ar,addYAxis:EAr,replaceYAxis:CAr,removeYAxis:jAr,addZAxis:nPn,replaceZAxis:sPn,removeZAxis:aPn,updateYAxisWidth:TAr}=Qlt.actions,NAr=Qlt.reducer,AAr=Xe([ec],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),IAr=Xe([AAr,yv,vv],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),jpe=()=>en(IAr),RAr=()=>en(sjr);function WAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function ZH(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?WAe(Object(r),!0).forEach(function(n){PAr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function PAr(e,t,r){return(t=MAr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MAr(e){var t=DAr(e,"string");return typeof t=="symbol"?t:t+""}function DAr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var LAr=e=>{var{point:t,childIndex:r,mainColor:n,activeDot:s,dataKey:a,clipPath:i}=e;if(s===!1||t.x==null||t.y==null)return null;var l={index:r,dataKey:a,cx:t.x,cy:t.y,r:4,fill:n??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=ZH(ZH(ZH({},l),Dz(s)),dhe(s)),u;return b.isValidElement(s)?u=b.cloneElement(s,c):typeof s=="function"?u=s(c):u=b.createElement(Ult,c),b.createElement(Gy,{className:"recharts-active-dot",clipPath:i},u)};function $Ar(e){var{points:t,mainColor:r,activeDot:n,itemDataKey:s,clipPath:a,zIndex:i=Yc.activeDot}=e,l=en(aI),c=RAr();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return kl(u)?null:b.createElement(Ov,{zIndex:i},b.createElement(LAr,{point:u,childIndex:Number(l),mainColor:r,dataKey:s,activeDot:n,clipPath:a}))}var FAr=e=>{var{chartData:t}=e,r=Vo(),n=od();return b.useEffect(()=>n?()=>{}:(r(dAe(t)),()=>{r(dAe(void 0))}),[t,r,n]),null},GAe={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},Wlt=jc({name:"brush",initialState:GAe,reducers:{setBrushSettings(e,t){return t.payload==null?GAe:t.payload}}}),{setBrushSettings:iPn}=Wlt.actions,zAr=Wlt.reducer;function BAr(e){return(e%180+180)%180}var UAr=function(t){var{width:r,height:n}=t,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=BAr(s),i=a*Math.PI/180,l=Math.atan(n/r),c=i>l&&i<Math.PI-l?n/Math.sin(i):r/Math.cos(i);return Math.abs(c)},VAr={dots:[],areas:[],lines:[]},Glt=jc({name:"referenceElements",initialState:VAr,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=fh(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=fh(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=fh(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:oPn,removeDot:lPn,addArea:cPn,removeArea:uPn,addLine:dPn,removeLine:fPn}=Glt.actions,qAr=Glt.reducer,HAr=b.createContext(void 0),QAr=e=>{var{children:t}=e,[r]=b.useState("".concat(WA("recharts"),"-clip")),n=jpe();if(n==null)return null;var{x:s,y:a,width:i,height:l}=n;return b.createElement(HAr.Provider,{value:r},b.createElement("defs",null,b.createElement("clipPath",{id:r},b.createElement("rect",{x:s,y:a,height:l,width:i}))),t)};function Zlt(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;n<e.length;n+=t){var s=e[n];s!==void 0&&r.push(s)}return r}function WAr(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return UAr(n,r)}function GAr(e,t,r){var n=r==="width",{x:s,y:a,width:i,height:l}=e;return t===1?{start:n?s:a,end:n?s+i:a+l}:{start:n?s+i:a+l,end:n?s:a}}function oI(e,t,r,n,s){if(e*t<e*n||e*t>e*s)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-s)<=0}function ZAr(e,t){return Zlt(e,t+1)}function YAr(e,t,r,n,s){for(var a=(n||[]).slice(),{start:i,end:l}=t,c=0,u=1,d=i,f=function(){var m=n?.[c];if(m===void 0)return{v:Zlt(n,u)};var g=c,y,x=()=>(y===void 0&&(y=r(m,g)),y),w=m.coordinate,S=c===0||oI(e,w,x,d,l);S||(c=0,d=i,u+=1),S&&(d=w+e*(x()/2+s),c+=u)},h;u<=a.length;)if(h=f(),h)return h.v;return[]}function XAr(e,t,r,n,s){var a=(n||[]).slice(),i=a.length;if(i===0)return[];for(var{start:l,end:c}=t,u=1;u<=i;u++){for(var d=(i-1)%u,f=l,h=!0,p=function(){var k=n[g];if(k==null)return 0;var _=g,E,T=()=>(E===void 0&&(E=r(k,_)),E),j=k.coordinate,N=g===d||oI(e,j,T,f,c);if(!N)return h=!1,1;N&&(f=j+e*(T()/2+s))},m,g=d;g<i&&(m=p(),!(m!==0&&m===1));g+=u);if(h){for(var y=[],x=d;x<i;x+=u){var w=n[x];w!=null&&y.push(w)}return y}}return[]}function ZAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function ic(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ZAe(Object(r),!0).forEach(function(n){KAr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ZAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function KAr(e,t,r){return(t=JAr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function JAr(e){var t=eIr(e,"string");return typeof t=="symbol"?t:t+""}function eIr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tIr(e,t,r,n,s){for(var a=(n||[]).slice(),i=a.length,{start:l}=t,{end:c}=t,u=function(h){var p=a[h];if(p==null)return 1;var m=p,g,y=()=>(g===void 0&&(g=r(p,h)),g);if(h===i-1){var x=e*(m.coordinate+e*y()/2-c);a[h]=m=ic(ic({},m),{},{tickCoord:x>0?m.coordinate-x*e:m.coordinate})}else a[h]=m=ic(ic({},m),{},{tickCoord:m.coordinate});if(m.tickCoord!=null){var w=oI(e,m.tickCoord,y,l,c);w&&(c=m.tickCoord-e*(y()/2+s),a[h]=ic(ic({},m),{},{isShow:!0}))}},d=i-1;d>=0;d--)u(d);return a}function rIr(e,t,r,n,s,a){var i=(n||[]).slice(),l=i.length,{start:c,end:u}=t;if(a){var d=n[l-1];if(d!=null){var f=r(d,l-1),h=e*(d.coordinate+e*f/2-u);if(i[l-1]=d=ic(ic({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate}),d.tickCoord!=null){var p=oI(e,d.tickCoord,()=>f,c,u);p&&(u=d.tickCoord-e*(f/2+s),i[l-1]=ic(ic({},d),{},{isShow:!0}))}}}for(var m=a?l-1:l,g=function(w){var S=i[w];if(S==null)return 1;var k=S,_,E=()=>(_===void 0&&(_=r(S,w)),_);if(w===0){var T=e*(k.coordinate-e*E()/2-c);i[w]=k=ic(ic({},k),{},{tickCoord:T<0?k.coordinate-T*e:k.coordinate})}else i[w]=k=ic(ic({},k),{},{tickCoord:k.coordinate});if(k.tickCoord!=null){var j=oI(e,k.tickCoord,E,c,u);j&&(c=k.tickCoord+e*(E()/2+s),i[w]=ic(ic({},k),{},{isShow:!0}))}},y=0;y<m;y++)g(y);return i}function Tpe(e,t,r){var{tick:n,ticks:s,viewBox:a,minTickGap:i,orientation:l,interval:c,tickFormatter:u,unit:d,angle:f}=e;if(!s||!s.length||!n)return[];if(qr(c)||yP.isSsr){var h;return(h=ZAr(s,qr(c)?c:0))!==null&&h!==void 0?h:[]}var p=[],m=l==="top"||l==="bottom"?"width":"height",g=d&&m==="width"?jN(d,{fontSize:t,letterSpacing:r}):{width:0,height:0},y=(_,E)=>{var T=typeof u=="function"?u(_.value,E):_.value;return m==="width"?WAr(jN(T,{fontSize:t,letterSpacing:r}),g,f):jN(T,{fontSize:t,letterSpacing:r})[m]},x=s[0],w=s[1],S=s.length>=2&&x!=null&&w!=null?dh(w.coordinate-x.coordinate):1,k=GAr(a,S,m);return c==="equidistantPreserveStart"?YAr(S,k,y,s,i):c==="equidistantPreserveEnd"?XAr(S,k,y,s,i):(c==="preserveStart"||c==="preserveStartEnd"?p=rIr(S,k,y,s,i,c==="preserveStartEnd"):p=tIr(S,k,y,s,i),p.filter(_=>_.isShow))}var nIr=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:s=0,tickMargin:a=0}=e,i=0;if(t){Array.from(t).forEach(d=>{if(d){var f=d.getBoundingClientRect();f.width>i&&(i=f.width)}});var l=r?r.getBoundingClientRect().width:0,c=s+a,u=i+c+l+(r?n:0);return Math.round(u)}return 0},sIr={xAxis:{},yAxis:{}},Ylt=jc({name:"renderedTicks",initialState:sIr,reducers:{setRenderedTicks:(e,t)=>{var{axisType:r,axisId:n,ticks:s}=t.payload;e[r][n]=s},removeRenderedTicks:(e,t)=>{var{axisType:r,axisId:n}=t.payload;delete e[r][n]}}}),{setRenderedTicks:aIr,removeRenderedTicks:iIr}=Ylt.actions,oIr=Ylt.reducer,lIr=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function cIr(e,t){if(e==null)return{};var r,n,s=uIr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function uIr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function IS(){return IS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},IS.apply(null,arguments)}function YAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function qi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?YAe(Object(r),!0).forEach(function(n){dIr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function dIr(e,t,r){return(t=fIr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fIr(e){var t=hIr(e,"string");return typeof t=="symbol"?t:t+""}function hIr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $y={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",zIndex:Yc.axis};function pIr(e){var{x:t,y:r,width:n,height:s,orientation:a,mirror:i,axisLine:l,otherSvgProps:c}=e;if(!l)return null;var u=qi(qi(qi({},c),ng(l)),{},{fill:"none"});if(a==="top"||a==="bottom"){var d=+(a==="top"&&!i||a==="bottom"&&i);u=qi(qi({},u),{},{x1:t,y1:r+d*s,x2:t+n,y2:r+d*s})}else{var f=+(a==="left"&&!i||a==="right"&&i);u=qi(qi({},u),{},{x1:t+f*n,y1:r,x2:t+f*n,y2:r+s})}return b.createElement("line",IS({},u,{className:va("recharts-cartesian-axis-line",zz(l,"className"))}))}function mIr(e,t,r,n,s,a,i,l,c){var u,d,f,h,p,m,g=l?-1:1,y=e.tickSize||i,x=qr(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":u=d=e.coordinate,h=r+ +!l*s,f=h-g*y,m=f-g*c,p=x;break;case"left":f=h=e.coordinate,d=t+ +!l*n,u=d-g*y,p=u-g*c,m=x;break;case"right":f=h=e.coordinate,d=t+ +l*n,u=d+g*y,p=u+g*c,m=x;break;default:u=d=e.coordinate,h=r+ +l*s,f=h+g*y,m=f+g*c,p=x;break}return{line:{x1:u,y1:f,x2:d,y2:h},tick:{x:p,y:m}}}function gIr(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function yIr(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function vIr(e){var{option:t,tickProps:r,value:n}=e,s,a=va(r.className,"recharts-cartesian-axis-tick-value");if(b.isValidElement(t))s=b.cloneElement(t,qi(qi({},r),{},{className:a}));else if(typeof t=="function")s=t(qi(qi({},r),{},{className:a}));else{var i="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(i=va(i,jNr(t))),s=b.createElement(Epe,IS({},r,{className:i}),n)}return s}function bIr(e){var{ticks:t,axisType:r,axisId:n}=e,s=Vo();return b.useEffect(()=>{if(n==null||r==null)return v1;var a=t.map(i=>({value:i.value,coordinate:i.coordinate,offset:i.offset,index:i.index}));return s(aIr({ticks:a,axisId:n,axisType:r})),()=>{s(iIr({axisId:n,axisType:r}))}},[s,t,n,r]),null}var xIr=b.forwardRef((e,t)=>{var{ticks:r=[],tick:n,tickLine:s,stroke:a,tickFormatter:i,unit:l,padding:c,tickTextProps:u,orientation:d,mirror:f,x:h,y:p,width:m,height:g,tickSize:y,tickMargin:x,fontSize:w,letterSpacing:S,getTicksConfig:k,events:_,axisType:E,axisId:T}=e,j=Tpe(qi(qi({},k),{},{ticks:r}),w,S),N=ng(k),I=Dz(n),P=Plt(N.textAnchor)?N.textAnchor:gIr(d,f),R=yIr(d,f),$={};typeof s=="object"&&($=s);var M=qi(qi({},N),{},{fill:"none"},$),z=j.map(H=>qi({entry:H},mIr(H,h,p,m,g,d,y,f,x))),U=z.map(H=>{var{entry:W,line:L}=H;return b.createElement(Gy,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(W.value,"-").concat(W.coordinate,"-").concat(W.tickCoord)},s&&b.createElement("line",IS({},M,L,{className:va("recharts-cartesian-axis-tick-line",zz(s,"className"))})))}),B=z.map((H,W)=>{var L,Y,{entry:q,tick:D}=H,Q=qi(qi(qi(qi({verticalAnchor:R},N),{},{textAnchor:P,stroke:"none",fill:a},D),{},{index:W,payload:q,visibleTicksCount:j.length,tickFormatter:i,padding:c},u),{},{angle:(L=(Y=u?.angle)!==null&&Y!==void 0?Y:N.angle)!==null&&L!==void 0?L:0}),G=qi(qi({},Q),I);return b.createElement(Gy,IS({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(q.value,"-").concat(q.coordinate,"-").concat(q.tickCoord)},Pxr(_,q,W)),n&&b.createElement(vIr,{option:n,tickProps:G,value:"".concat(typeof i=="function"?i(q.value,W):q.value).concat(l||"")}))});return b.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(E,"-ticks")},b.createElement(bIr,{ticks:j,axisId:T,axisType:E}),B.length>0&&b.createElement(Ov,{zIndex:Yc.label},b.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(E,"-tick-labels"),ref:t},B)),U.length>0&&b.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(E,"-tick-lines")},U))}),wIr=b.forwardRef((e,t)=>{var{axisLine:r,width:n,height:s,className:a,hide:i,ticks:l,axisType:c,axisId:u}=e,d=cIr(e,lIr),[f,h]=b.useState(""),[p,m]=b.useState(""),g=b.useRef(null);b.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var x;return nIr({ticks:g.current,label:(x=e.labelRef)===null||x===void 0?void 0:x.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var y=b.useCallback(x=>{if(x){var w=x.getElementsByClassName("recharts-cartesian-axis-tick-value");g.current=w;var S=w[0];if(S){var k=window.getComputedStyle(S),_=k.fontSize,E=k.letterSpacing;(_!==f||E!==p)&&(h(_),m(E))}}},[f,p]);return i||n!=null&&n<=0||s!=null&&s<=0?null:b.createElement(Ov,{zIndex:e.zIndex},b.createElement(Gy,{className:va("recharts-cartesian-axis",a)},b.createElement(pIr,{x:e.x,y:e.y,width:n,height:s,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:ng(e)}),b.createElement(xIr,{ref:y,axisType:c,events:d,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:p,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:l,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:u}),b.createElement(oNr,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},b.createElement(yNr,{label:e.label,labelRef:e.labelRef}),e.children)))}),Npe=b.forwardRef((e,t)=>{var r=id(e,$y);return b.createElement(wIr,IS({},r,{ref:t}))});Npe.displayName="CartesianAxis";var SIr=["x1","y1","x2","y2","key"],OIr=["offset"],kIr=["xAxisId","yAxisId"],_Ir=["xAxisId","yAxisId"];function XAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function fc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?XAe(Object(r),!0).forEach(function(n){EIr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):XAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function EIr(e,t,r){return(t=CIr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function CIr(e){var t=jIr(e,"string");return typeof t=="symbol"?t:t+""}function jIr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Tw(){return Tw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Tw.apply(null,arguments)}function w4(e,t){if(e==null)return{};var r,n,s=TIr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function TIr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var NIr=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:s,width:a,height:i,ry:l}=e;return b.createElement("rect",{x:n,y:s,ry:l,width:a,height:i,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function Xlt(e){var{option:t,lineItemProps:r}=e,n;if(b.isValidElement(t))n=b.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var s,{x1:a,y1:i,x2:l,y2:c,key:u}=r,d=w4(r,SIr),f=(s=ng(d))!==null&&s!==void 0?s:{},{offset:h}=f,p=w4(f,OIr);n=b.createElement("line",Tw({},p,{x1:a,y1:i,x2:l,y2:c,fill:"none",key:u}))}return n}function AIr(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:s}=e;if(!n||!s||!s.length)return null;var{xAxisId:a,yAxisId:i}=e,l=w4(e,kIr),c=s.map((u,d)=>{var f=fc(fc({},l),{},{x1:t,y1:u,x2:t+r,y2:u,key:"line-".concat(d),index:d});return b.createElement(Xlt,{key:"line-".concat(d),option:n,lineItemProps:f})});return b.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function IIr(e){var{y:t,height:r,vertical:n=!0,verticalPoints:s}=e;if(!n||!s||!s.length)return null;var{xAxisId:a,yAxisId:i}=e,l=w4(e,_Ir),c=s.map((u,d)=>{var f=fc(fc({},l),{},{x1:u,y1:t,x2:u,y2:t+r,key:"line-".concat(d),index:d});return b.createElement(Xlt,{option:n,lineItemProps:f,key:"line-".concat(d)})});return b.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function RIr(e){var{horizontalFill:t,fillOpacity:r,x:n,y:s,width:a,height:i,horizontalPoints:l,horizontal:c=!0}=e;if(!c||!t||!t.length||l==null)return null;var u=l.map(f=>Math.round(f+s-s)).sort((f,h)=>f-h);s!==u[0]&&u.unshift(0);var d=u.map((f,h)=>{var p=u[h+1],m=p==null,g=m?s+i-f:p-f;if(g<=0)return null;var y=h%t.length;return b.createElement("rect",{key:"react-".concat(h),y:f,x:n,height:g,width:a,stroke:"none",fill:t[y],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return b.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},d)}function PIr(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:s,y:a,width:i,height:l,verticalPoints:c}=e;if(!t||!r||!r.length)return null;var u=c.map(f=>Math.round(f+s-s)).sort((f,h)=>f-h);s!==u[0]&&u.unshift(0);var d=u.map((f,h)=>{var p=u[h+1],m=p==null,g=m?s+i-f:p-f;if(g<=0)return null;var y=h%r.length;return b.createElement("rect",{key:"react-".concat(h),x:f,y:a,width:g,height:l,stroke:"none",fill:r[y],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return b.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},d)}var MIr=(e,t)=>{var{xAxis:r,width:n,height:s,offset:a}=e;return Lat(Tpe(fc(fc(fc({},$y),r),{},{ticks:$at(r),viewBox:{x:0,y:0,width:n,height:s}})),a.left,a.left+a.width,t)},DIr=(e,t)=>{var{yAxis:r,width:n,height:s,offset:a}=e;return Lat(Tpe(fc(fc(fc({},$y),r),{},{ticks:$at(r),viewBox:{x:0,y:0,width:n,height:s}})),a.top,a.top+a.height,t)},LIr={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Yc.grid};function Klt(e){var t=Qat(),r=Wat(),n=Hat(),s=fc(fc({},id(e,LIr)),{},{x:qr(e.x)?e.x:n.left,y:qr(e.y)?e.y:n.top,width:qr(e.width)?e.width:n.width,height:qr(e.height)?e.height:n.height}),{xAxisId:a,yAxisId:i,x:l,y:c,width:u,height:d,syncWithTicks:f,horizontalValues:h,verticalValues:p}=s,m=od(),g=en(N=>KNe(N,"xAxis",a,m)),y=en(N=>KNe(N,"yAxis",i,m));if(!ag(u)||!ag(d)||!qr(l)||!qr(c))return null;var x=s.verticalCoordinatesGenerator||MIr,w=s.horizontalCoordinatesGenerator||DIr,{horizontalPoints:S,verticalPoints:k}=s;if((!S||!S.length)&&typeof w=="function"){var _=h&&h.length,E=w({yAxis:y?fc(fc({},y),{},{ticks:_?h:y.ticks}):void 0,width:t??u,height:r??d,offset:n},_?!0:f);Q5(Array.isArray(E),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof E,"]")),Array.isArray(E)&&(S=E)}if((!k||!k.length)&&typeof x=="function"){var T=p&&p.length,j=x({xAxis:g?fc(fc({},g),{},{ticks:T?p:g.ticks}):void 0,width:t??u,height:r??d,offset:n},T?!0:f);Q5(Array.isArray(j),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof j,"]")),Array.isArray(j)&&(k=j)}return b.createElement(Ov,{zIndex:s.zIndex},b.createElement("g",{className:"recharts-cartesian-grid"},b.createElement(NIr,{fill:s.fill,fillOpacity:s.fillOpacity,x:s.x,y:s.y,width:s.width,height:s.height,ry:s.ry}),b.createElement(RIr,Tw({},s,{horizontalPoints:S})),b.createElement(PIr,Tw({},s,{verticalPoints:k})),b.createElement(AIr,Tw({},s,{offset:n,horizontalPoints:S,xAxis:g,yAxis:y})),b.createElement(IIr,Tw({},s,{offset:n,verticalPoints:k,xAxis:g,yAxis:y}))))}Klt.displayName="CartesianGrid";var $Ir={},Jlt=jc({name:"errorBars",initialState:$Ir,reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:s}=t.payload;e[r]&&(e[r]=e[r].map(a=>a.dataKey===n.dataKey&&a.direction===n.direction?s:a))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(s=>s.dataKey!==n.dataKey||s.direction!==n.direction))}}}),{addErrorBar:hPn,replaceErrorBar:pPn,removeErrorBar:mPn}=Jlt.actions,FIr=Jlt.reducer,zIr=["children"];function BIr(e,t){if(e==null)return{};var r,n,s=UIr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function UIr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var VIr={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},qIr=b.createContext(VIr);function HIr(e){var{children:t}=e,r=BIr(e,zIr);return b.createElement(qIr.Provider,{value:r},t)}function ect(e,t){var r,n,s=en(u=>xv(u,e)),a=en(u=>wv(u,t)),i=(r=s?.allowDataOverflow)!==null&&r!==void 0?r:Yo.allowDataOverflow,l=(n=a?.allowDataOverflow)!==null&&n!==void 0?n:Xo.allowDataOverflow,c=i||l;return{needClip:c,needClipX:i,needClipY:l}}function QIr(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,s=jpe(),{needClipX:a,needClipY:i,needClip:l}=ect(t,r);if(!l||!s)return null;var{x:c,y:u,width:d,height:f}=s;return b.createElement("clipPath",{id:"clipPath-".concat(n)},b.createElement("rect",{x:a?c:c-d/2,y:i?u:u-f/2,width:a?d:d*2,height:i?f:f*2}))}var tct=(e,t,r,n)=>elt(e,"xAxis",t,n),rct=(e,t,r,n)=>Jot(e,"xAxis",t,n),nct=(e,t,r,n)=>elt(e,"yAxis",r,n),sct=(e,t,r,n)=>Jot(e,"yAxis",r,n),WIr=Xe([$i,tct,nct,rct,sct],(e,t,r,n,s)=>gv(e,"xAxis")?H5(t,n,!1):H5(r,s,!1)),GIr=(e,t,r,n,s)=>s;function ZIr(e){return e.type==="line"}var YIr=Xe([Oot,GIr],(e,t)=>e.filter(ZIr).find(r=>r.id===t)),XIr=Xe([$i,tct,nct,rct,sct,YIr,WIr,_he],(e,t,r,n,s,a,i,l)=>{var{chartData:c,dataStartIndex:u,dataEndIndex:d}=l;if(!(a==null||t==null||r==null||n==null||s==null||n.length===0||s.length===0||i==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:f,data:h}=a,p;if(h!=null&&h.length>0?p=h:p=c?.slice(u,d+1),p!=null)return vRr({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:s,dataKey:f,bandSize:i,displayedData:p})}});function KIr(e){var t=Dz(e),r=3,n=2;if(t!=null){var{r:s,strokeWidth:a}=t,i=Number(s),l=Number(a);return(Number.isNaN(i)||i<0)&&(i=r),(Number.isNaN(l)||l<0)&&(l=n),{r:i,strokeWidth:l}}return{r,strokeWidth:n}}var JIr=["id"],eRr=["type","layout","connectNulls","needClip","shape"],tRr=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function lI(){return lI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},lI.apply(null,arguments)}function KAe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function vm(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?KAe(Object(r),!0).forEach(function(n){rRr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KAe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function rRr(e,t,r){return(t=nRr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nRr(e){var t=sRr(e,"string");return typeof t=="symbol"?t:t+""}function sRr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ape(e,t){if(e==null)return{};var r,n,s=aRr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function aRr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var iRr=e=>{var{dataKey:t,name:r,stroke:n,legendType:s,hide:a}=e;return[{inactive:a,dataKey:t,type:s,color:n,value:Fat(r,t),payload:e}]},oRr=b.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:s,fill:a,name:i,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r,getPosition:v1,settings:{stroke:n,strokeWidth:s,fill:a,dataKey:t,nameKey:void 0,name:Fat(i,t),hide:l,type:u,color:n,unit:c,graphicalItemId:d}};return b.createElement(YNr,{tooltipEntrySettings:f})}),act=(e,t)=>"".concat(t,"px ").concat(e,"px");function lRr(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],s=0;s<t;++s)n.push(...r);return n}var cRr=(e,t,r)=>{var n=r.reduce((h,p)=>h+p,0);if(!n)return act(t,e);for(var s=Math.floor(e/n),a=e%n,i=[],l=0,c=0;l<r.length;c+=(u=r[l])!==null&&u!==void 0?u:0,++l){var u,d=r[l];if(d!=null&&c+d>a){i=[...r.slice(0,l),a-c];break}}var f=i.length%2===0?[0,t]:[t];return[...lRr(r,s),...i,...f].map(h=>"".concat(h,"px")).join(", ")};function uRr(e){var{clipPathId:t,points:r,props:n}=e,{dot:s,dataKey:a,needClip:i}=n,{id:l}=n,c=Ape(n,JIr),u=ng(c);return b.createElement(vAr,{points:r,dot:s,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:u,needClip:i,clipPathId:t})}function dRr(e){var{showLabels:t,children:r,points:n}=e,s=b.useMemo(()=>n?.map(a=>{var i,l,c={x:(i=a.x)!==null&&i!==void 0?i:0,y:(l=a.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return vm(vm({},c),{},{value:a.value,payload:a.payload,viewBox:c,parentViewBox:void 0,fill:void 0})}),[n]);return b.createElement(SNr,{value:t?s:void 0},r)}function JAe(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:s,props:a}=e,{type:i,layout:l,connectNulls:c,needClip:u,shape:d}=a,f=Ape(a,eRr),h=vm(vm({},iu(f)),{},{fill:"none",className:"recharts-line-curve",clipPath:u?"url(#clipPath-".concat(t,")"):void 0,points:n,type:i,layout:l,connectNulls:c,strokeDasharray:s??a.strokeDasharray});return b.createElement(b.Fragment,null,n?.length>1&&b.createElement(ZNr,lI({shapeType:"curve",option:d},h,{pathRef:r})),b.createElement(uRr,{points:n,clipPathId:t,props:a}))}function fRr(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function hRr(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:s,longestAnimatedLengthRef:a}=e,{points:i,strokeDasharray:l,isAnimationActive:c,animationBegin:u,animationDuration:d,animationEasing:f,animateNewValues:h,width:p,height:m,onAnimationEnd:g,onAnimationStart:y}=r,x=s.current,w=khe(i,"recharts-line-"),S=b.useRef(w),[k,_]=b.useState(!1),E=!k,T=b.useCallback(()=>{typeof g=="function"&&g(),_(!1)},[g]),j=b.useCallback(()=>{typeof y=="function"&&y(),_(!0)},[y]),N=fRr(n.current),I=b.useRef(0);S.current!==w&&(I.current=a.current,S.current=w);var P=I.current;return b.createElement(dRr,{points:i,showLabels:E},r.children,b.createElement(Ohe,{animationId:w,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:T,onAnimationStart:j,key:w},R=>{var $=Lu(P,N+P,R),M=Math.min($,N),z;if(c)if(l){var U="".concat(l).split(/[,\s]+/gim).map(W=>parseFloat(W));z=cRr(M,N,U)}else z=act(N,M);else z=l==null?void 0:String(l);if(R>0&&N>0&&(s.current=i,a.current=Math.max(a.current,M)),x){var B=x.length/i.length,H=R===1?i:i.map((W,L)=>{var Y=Math.floor(L*B);if(x[Y]){var q=x[Y];return vm(vm({},W),{},{x:Lu(q.x,W.x,R),y:Lu(q.y,W.y,R)})}return h?vm(vm({},W),{},{x:Lu(p*2,W.x,R),y:Lu(m/2,W.y,R)}):vm(vm({},W),{},{x:W.x,y:W.y})});return s.current=H,b.createElement(JAe,{props:r,points:H,clipPathId:t,pathRef:n,strokeDasharray:z})}return b.createElement(JAe,{props:r,points:i,clipPathId:t,pathRef:n,strokeDasharray:z})}),b.createElement(_Nr,{label:r.label}))}function pRr(e){var{clipPathId:t,props:r}=e,n=b.useRef(null),s=b.useRef(0),a=b.useRef(null);return b.createElement(hRr,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:s,pathRef:a})}var mRr=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:Yl(e.payload,t)}};class gRr extends b.Component{render(){var{hide:t,dot:r,points:n,className:s,xAxisId:a,yAxisId:i,top:l,left:c,width:u,height:d,id:f,needClip:h,zIndex:p}=this.props;if(t)return null;var m=va("recharts-line",s),g=f,{r:y,strokeWidth:x}=KIr(r),w=qlt(r),S=y*2+x,k=h?"url(#clipPath-".concat(w?"":"dots-").concat(g,")"):void 0;return b.createElement(Ov,{zIndex:p},b.createElement(Gy,{className:m},h&&b.createElement("defs",null,b.createElement(QIr,{clipPathId:g,xAxisId:a,yAxisId:i}),!w&&b.createElement("clipPath",{id:"clipPath-dots-".concat(g)},b.createElement("rect",{x:c-S/2,y:l-S/2,width:u+S,height:d+S}))),b.createElement(HIr,{xAxisId:a,yAxisId:i,data:n,dataPointFormatter:mRr,errorBarOffset:0},b.createElement(pRr,{props:this.props,clipPathId:g}))),b.createElement($Ar,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:k}))}}var ict={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Yc.line,type:"linear"};function yRr(e){var t=id(e,ict),{activeDot:r,animateNewValues:n,animationBegin:s,animationDuration:a,animationEasing:i,connectNulls:l,dot:c,hide:u,isAnimationActive:d,label:f,legendType:h,xAxisId:p,yAxisId:m,id:g}=t,y=Ape(t,tRr),{needClip:x}=ect(p,m),w=jpe(),S=eC(),k=od(),_=en(I=>XIr(I,p,m,k,g));if(S!=="horizontal"&&S!=="vertical"||_==null||w==null)return null;var{height:E,width:T,x:j,y:N}=w;return b.createElement(gRr,lI({},y,{id:g,connectNulls:l,dot:c,activeDot:r,animateNewValues:n,animationBegin:s,animationDuration:a,animationEasing:i,isAnimationActive:d,hide:u,label:f,legendType:h,xAxisId:p,yAxisId:m,points:_,layout:S,height:E,width:T,left:j,top:N,needClip:x}))}function vRr(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:s,yAxisTicks:a,dataKey:i,bandSize:l,displayedData:c}=e;return c.map((u,d)=>{var f=Yl(u,i);if(t==="horizontal"){var h=Xje({axis:r,ticks:s,bandSize:l,entry:u,index:d}),p=kl(f)?null:n.scale.map(f);return{x:h,y:p??null,value:f,payload:u}}var m=kl(f)?null:r.scale.map(f),g=Xje({axis:n,ticks:a,bandSize:l,entry:u,index:d});return m==null||g==null?null:{x:m,y:g,value:f,payload:u}}).filter(Boolean)}function bRr(e){var t=id(e,ict),r=od();return b.createElement(rAr,{id:t.id,type:"line"},n=>b.createElement(b.Fragment,null,b.createElement(XNr,{legendPayload:iRr(t)}),b.createElement(oRr,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:n}),b.createElement(cAr,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),b.createElement(yRr,lI({},t,{id:n}))))}var oct=b.memo(bRr,a9);oct.displayName="Line";var xRr=["domain","range"],wRr=["domain","range"];function eIe(e,t){if(e==null)return{};var r,n,s=SRr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function SRr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function tIe(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function lct(e,t){if(e===t)return!0;var{domain:r,range:n}=e,s=eIe(e,xRr),{domain:a,range:i}=t,l=eIe(t,wRr);return!tIe(r,a)||!tIe(n,i)?!1:a9(s,l)}var ORr=["type"],kRr=["dangerouslySetInnerHTML","ticks","scale"],_Rr=["id","scale"];function Hae(){return Hae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Hae.apply(null,arguments)}function rIe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function nIe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?rIe(Object(r),!0).forEach(function(n){ERr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rIe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ERr(e,t,r){return(t=CRr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function CRr(e){var t=jRr(e,"string");return typeof t=="symbol"?t:t+""}function jRr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qae(e,t){if(e==null)return{};var r,n,s=TRr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function TRr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function NRr(e){var t=Vo(),r=b.useRef(null),n=Gat(),{type:s}=e,a=Qae(e,ORr),i=l9(n,"xAxis",s),l=b.useMemo(()=>{if(i!=null)return nIe(nIe({},a),{},{type:i})},[a,i]);return b.useLayoutEffect(()=>{l!=null&&(r.current===null?t(OAr(l)):r.current!==l&&t(kAr({prev:r.current,next:l})),r.current=l)},[l,t]),b.useLayoutEffect(()=>()=>{r.current&&(t(_Ar(r.current)),r.current=null)},[t]),null}var ARr=e=>{var{xAxisId:t,className:r}=e,n=en(Bat),s=od(),a="xAxis",i=en(x=>Kot(x,a,t,s)),l=en(x=>FEr(x,t)),c=en(x=>HEr(x,t)),u=en(x=>bot(x,t));if(l==null||c==null||u==null)return null;var{dangerouslySetInnerHTML:d,ticks:f,scale:h}=e,p=Qae(e,kRr),{id:m,scale:g}=u,y=Qae(u,_Rr);return b.createElement(Npe,Hae({},p,y,{x:c.x,y:c.y,width:l.width,height:l.height,className:va("recharts-".concat(a," ").concat(a),r),viewBox:n,ticks:i,axisType:a,axisId:t}))},IRr={allowDataOverflow:Yo.allowDataOverflow,allowDecimals:Yo.allowDecimals,allowDuplicatedCategory:Yo.allowDuplicatedCategory,angle:Yo.angle,axisLine:$y.axisLine,height:Yo.height,hide:!1,includeHidden:Yo.includeHidden,interval:Yo.interval,label:!1,minTickGap:Yo.minTickGap,mirror:Yo.mirror,orientation:Yo.orientation,padding:Yo.padding,reversed:Yo.reversed,scale:Yo.scale,tick:Yo.tick,tickCount:Yo.tickCount,tickLine:$y.tickLine,tickSize:$y.tickSize,type:Yo.type,niceTicks:Yo.niceTicks,xAxisId:0},RRr=e=>{var t=id(e,IRr);return b.createElement(b.Fragment,null,b.createElement(NRr,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),b.createElement(ARr,t))},cct=b.memo(RRr,lct);cct.displayName="XAxis";var PRr=["type"],MRr=["dangerouslySetInnerHTML","ticks","scale"],DRr=["id","scale"];function Wae(){return Wae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Wae.apply(null,arguments)}function sIe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function aIe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sIe(Object(r),!0).forEach(function(n){LRr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sIe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function LRr(e,t,r){return(t=$Rr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $Rr(e){var t=FRr(e,"string");return typeof t=="symbol"?t:t+""}function FRr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Gae(e,t){if(e==null)return{};var r,n,s=zRr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function zRr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function BRr(e){var t=Vo(),r=b.useRef(null),n=Gat(),{type:s}=e,a=Gae(e,PRr),i=l9(n,"yAxis",s),l=b.useMemo(()=>{if(i!=null)return aIe(aIe({},a),{},{type:i})},[i,a]);return b.useLayoutEffect(()=>{l!=null&&(r.current===null?t(EAr(l)):r.current!==l&&t(CAr({prev:r.current,next:l})),r.current=l)},[l,t]),b.useLayoutEffect(()=>()=>{r.current&&(t(jAr(r.current)),r.current=null)},[t]),null}function URr(e){var{yAxisId:t,className:r,width:n,label:s}=e,a=b.useRef(null),i=b.useRef(null),l=en(Bat),c=od(),u=Vo(),d="yAxis",f=en(E=>GEr(E,t)),h=en(E=>WEr(E,t)),p=en(E=>Kot(E,d,t,c)),m=en(E=>xot(E,t));if(b.useLayoutEffect(()=>{if(!(n!=="auto"||!f||Cpe(s)||b.isValidElement(s)||m==null)){var E=a.current;if(E){var T=E.getCalculatedWidth();Math.round(f.width)!==Math.round(T)&&u(TAr({id:t,width:T}))}}},[p,f,u,s,t,n,m]),f==null||h==null||m==null)return null;var{dangerouslySetInnerHTML:g,ticks:y,scale:x}=e,w=Gae(e,MRr),{id:S,scale:k}=m,_=Gae(m,DRr);return b.createElement(Npe,Wae({},w,_,{ref:a,labelRef:i,x:h.x,y:h.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:f.width,height:f.height,className:va("recharts-".concat(d," ").concat(d),r),viewBox:l,ticks:p,axisType:d,axisId:t}))}var VRr={allowDataOverflow:Xo.allowDataOverflow,allowDecimals:Xo.allowDecimals,allowDuplicatedCategory:Xo.allowDuplicatedCategory,angle:Xo.angle,axisLine:$y.axisLine,hide:!1,includeHidden:Xo.includeHidden,interval:Xo.interval,label:!1,minTickGap:Xo.minTickGap,mirror:Xo.mirror,orientation:Xo.orientation,padding:Xo.padding,reversed:Xo.reversed,scale:Xo.scale,tick:Xo.tick,tickCount:Xo.tickCount,tickLine:$y.tickLine,tickSize:$y.tickSize,type:Xo.type,niceTicks:Xo.niceTicks,width:Xo.width,yAxisId:0},qRr=e=>{var t=id(e,VRr);return b.createElement(b.Fragment,null,b.createElement(BRr,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),b.createElement(URr,t))},uct=b.memo(qRr,lct);uct.displayName="YAxis";var HRr=(e,t)=>t,Ipe=Xe([HRr,$i,Iit,Cl,glt,Sv,yjr,ec],kjr);function QRr(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function Rpe(e){var t=e.currentTarget.getBoundingClientRect(),r,n;if(QRr(e)){var s=e.currentTarget.getBBox();r=s.width>0?t.width/s.width:1,n=s.height>0?t.height/s.height:1}else{var a=e.currentTarget;r=a.offsetWidth>0?t.width/a.offsetWidth:1,n=a.offsetHeight>0?t.height/a.offsetHeight:1}var i=(l,c)=>({relativeX:Math.round((l-t.left)/r),relativeY:Math.round((c-t.top)/n)});return"touches"in e?Array.from(e.touches).map(l=>i(l.clientX,l.clientY)):i(e.clientX,e.clientY)}var dct=uf("mouseClick"),fct=hP();fct.startListening({actionCreator:dct,effect:(e,t)=>{var r=e.payload,n=Ipe(t.getState(),Rpe(r));n?.activeIndex!=null&&t.dispatch(cCr({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Zae=uf("mouseMove"),hct=hP(),kO=null,z0=null,YH=null;hct.startListening({actionCreator:Zae,effect:(e,t)=>{var r=e.payload,n=t.getState(),{throttleDelay:s,throttledEvents:a}=n.eventSettings,i=a==="all"||a?.includes("mousemove");kO!==null&&(cancelAnimationFrame(kO),kO=null),z0!==null&&(typeof s!="number"||!i)&&(clearTimeout(z0),z0=null),YH=Rpe(r);var l=()=>{var c=t.getState(),u=gpe(c,c.tooltip.settings.shared);if(!YH){kO=null,z0=null;return}if(u==="axis"){var d=Ipe(c,YH);d?.activeIndex!=null?t.dispatch(olt({activeIndex:d.activeIndex,activeDataKey:void 0,activeCoordinate:d.activeCoordinate})):t.dispatch(ilt())}kO=null,z0=null};if(!i){l();return}s==="raf"?kO=requestAnimationFrame(l):typeof s=="number"&&z0===null&&(z0=setTimeout(l,s))}});function WRr(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<<CHILDREN>>":t}var iIe={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},pct=jc({name:"rootProps",initialState:iIe,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:iIe.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),GRr=pct.reducer,{updateOptions:ZRr}=pct.actions,YRr=null,XRr={updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)},mct=jc({name:"polarOptions",initialState:YRr,reducers:XRr}),{updatePolarOptions:gPn}=mct.actions,KRr=mct.reducer,gct=uf("keyDown"),yct=uf("focus"),vct=uf("blur"),S9=hP(),_O=null,B0=null,VD=null;S9.startListening({actionCreator:gct,effect:(e,t)=>{VD=e.payload,_O!==null&&(cancelAnimationFrame(_O),_O=null);var r=t.getState(),{throttleDelay:n,throttledEvents:s}=r.eventSettings,a=s==="all"||s.includes("keydown");B0!==null&&(typeof n!="number"||!a)&&(clearTimeout(B0),B0=null);var i=()=>{try{var l=t.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var{keyboardInteraction:u}=l.tooltip,d=VD;if(d!=="ArrowRight"&&d!=="ArrowLeft"&&d!=="Enter")return;var f=ype(u,lC(l),_P(l),CP(l)),h=f==null?-1:Number(f);if(!Number.isFinite(h)||h<0)return;var p=Sv(l);if(d==="Enter"){var m=g4(l,"axis","hover",String(u.index));t.dispatch(m4({active:!u.active,activeIndex:u.index,activeCoordinate:m}));return}var g=JEr(l),y=g==="left-to-right"?1:-1,x=d==="ArrowRight"?1:-1,w=h+x*y;if(p==null||w>=p.length||w<0)return;var S=g4(l,"axis","hover",String(w));t.dispatch(m4({active:!0,activeIndex:w.toString(),activeCoordinate:S}))}finally{_O=null,B0=null}};if(!a){i();return}n==="raf"?_O=requestAnimationFrame(i):typeof n=="number"&&B0===null&&(i(),VD=null,B0=setTimeout(()=>{VD?i():(B0=null,_O=null)},n))}});S9.startListening({actionCreator:yct,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:s}=r.tooltip;if(!s.active&&s.index==null){var a="0",i=g4(r,"axis","hover",String(a));t.dispatch(m4({active:!0,activeIndex:a,activeCoordinate:i}))}}}});S9.startListening({actionCreator:vct,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:s}=r.tooltip;s.active&&t.dispatch(m4({active:!1,activeIndex:s.index,activeCoordinate:s.coordinate}))}}});function bct(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(r,n)=>{if(n==="currentTarget")return t;var s=Reflect.get(r,n);return typeof s=="function"?s.bind(r):s}})}var Yf=uf("externalEvent"),xct=hP(),qD=new Map,aT=new Map,XH=new Map;xct.startListening({actionCreator:Yf,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){var s=n.type,a=bct(n);XH.set(s,{handler:r,reactEvent:a});var i=qD.get(s);i!==void 0&&(cancelAnimationFrame(i),qD.delete(s));var l=t.getState(),{throttleDelay:c,throttledEvents:u}=l.eventSettings,d=u,f=d==="all"||d?.includes(s),h=aT.get(s);h!==void 0&&(typeof c!="number"||!f)&&(clearTimeout(h),aT.delete(s));var p=()=>{var y=XH.get(s);try{if(!y)return;var{handler:x,reactEvent:w}=y,S=t.getState(),k={activeCoordinate:tjr(S),activeDataKey:KCr(S),activeIndex:aI(S),activeLabel:blt(S),activeTooltipIndex:aI(S),isTooltipActive:rjr(S)};x&&x(k,w)}finally{qD.delete(s),aT.delete(s),XH.delete(s)}};if(!f){p();return}if(c==="raf"){var m=requestAnimationFrame(p);qD.set(s,m)}else if(typeof c=="number"){if(!aT.has(s)){p();var g=setTimeout(p,c);aT.set(s,g)}}else p()}}});var JRr=Xe([iC],e=>e.tooltipItemPayloads),ePr=Xe([JRr,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(t!=null){var n=e.find(a=>a.settings.graphicalItemId===r);if(n!=null){var{getPosition:s}=n;if(s!=null)return s(t)}}}),wct=uf("touchMove"),Sct=hP(),U0=null,ib=null,oIe=null,iT=null;Sct.startListening({actionCreator:wct,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){iT=bct(r);var n=t.getState(),{throttleDelay:s,throttledEvents:a}=n.eventSettings,i=a==="all"||a.includes("touchmove");U0!==null&&(cancelAnimationFrame(U0),U0=null),ib!==null&&(typeof s!="number"||!i)&&(clearTimeout(ib),ib=null),oIe=Array.from(r.touches).map(c=>Rpe({clientX:c.clientX,clientY:c.clientY,currentTarget:r.currentTarget}));var l=()=>{if(iT!=null){var c=t.getState(),u=gpe(c,c.tooltip.settings.shared);if(u==="axis"){var d,f=(d=oIe)===null||d===void 0?void 0:d[0];if(f==null){U0=null,ib=null;return}var h=Ipe(c,f);h?.activeIndex!=null&&t.dispatch(olt({activeIndex:h.activeIndex,activeDataKey:void 0,activeCoordinate:h.activeCoordinate}))}else if(u==="item"){var p,m=iT.touches[0];if(document.elementFromPoint==null||m==null)return;var g=document.elementFromPoint(m.clientX,m.clientY);if(!g||!g.getAttribute)return;var y=g.getAttribute(Twr),x=(p=g.getAttribute(Nwr))!==null&&p!==void 0?p:void 0,w=oC(c).find(_=>_.id===x);if(y==null||w==null||x==null)return;var{dataKey:S}=w,k=ePr(c,y,x);t.dispatch(lCr({activeDataKey:S,activeIndex:y,activeCoordinate:k,activeGraphicalItemId:x}))}U0=null,ib=null}};if(!i){l();return}s==="raf"?U0=requestAnimationFrame(l):typeof s=="number"&&ib===null&&(l(),iT=null,ib=setTimeout(()=>{iT?l():(ib=null,U0=null)},s))}}});var Oct={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},kct=jc({name:"eventSettings",initialState:Oct,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),{setEventSettings:tPr}=kct.actions,rPr=kct.reducer,nPr=ent({brush:zAr,cartesianAxis:NAr,chartData:rTr,errorBars:FIr,eventSettings:rPr,graphicalItems:oAr,layout:pwr,legend:SSr,options:Xjr,polarAxis:CNr,polarOptions:KRr,referenceElements:qAr,renderedTicks:oIr,rootProps:GRr,tooltip:uCr,zIndex:$jr}),sPr=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return F0r({reducer:nPr,preloadedState:t,middleware:n=>{var s;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((s="es6")!==null&&s!==void 0?s:"")}).concat([fct.middleware,hct.middleware,S9.middleware,xct.middleware,Sct.middleware])},enhancers:n=>{var s=n;return typeof n=="function"&&(s=n()),s.concat(Oat({type:"raf"}))},devTools:{serialize:{replacer:WRr},name:"recharts-".concat(r)}})};function aPr(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,s=od(),a=b.useRef(null);if(s)return r;a.current==null&&(a.current=sPr(t,n));var i=hhe;return b.createElement(cnt,{context:i,store:a.current},r)}function iPr(e){var{layout:t,margin:r}=e,n=Vo(),s=od();return b.useEffect(()=>{s||(n(dwr(t)),n(uwr(r)))},[n,s,t,r]),null}var oPr=b.memo(iPr,a9);function lPr(e){var t=Vo();return b.useEffect(()=>{t(ZRr(e))},[t,e]),null}var cPr=e=>{var t=Vo();return b.useEffect(()=>{t(tPr(e))},[t,e]),null},uPr=b.memo(cPr,a9);function lIe(e){var{zIndex:t,isPanorama:r}=e,n=b.useRef(null),s=Vo();return b.useLayoutEffect(()=>(n.current&&s(Djr({zIndex:t,element:n.current,isPanorama:r})),()=>{s(Ljr({zIndex:t,isPanorama:r}))}),[s,t,r]),b.createElement("g",{tabIndex:-1,ref:n,className:"recharts-zIndex-layer_".concat(t)})}function cIe(e){var{children:t,isPanorama:r}=e,n=en(Ejr);if(!n||n.length===0)return t;var s=n.filter(i=>i<0),a=n.filter(i=>i>0);return b.createElement(b.Fragment,null,s.map(i=>b.createElement(lIe,{key:i,zIndex:i,isPanorama:r})),t,a.map(i=>b.createElement(lIe,{key:i,zIndex:i,isPanorama:r})))}var dPr=["children"];function fPr(e,t){if(e==null)return{};var r,n,s=hPr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function hPr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function S4(){return S4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},S4.apply(null,arguments)}var pPr={width:"100%",height:"100%",display:"block"},mPr=b.forwardRef((e,t)=>{var r=Qat(),n=Wat(),s=sit();if(!ag(r)||!ag(n))return null;var{children:a,otherAttributes:i,title:l,desc:c}=e,u,d;return i!=null&&(typeof i.tabIndex=="number"?u=i.tabIndex:u=s?0:void 0,typeof i.role=="string"?d=i.role:d=s?"application":void 0),b.createElement(Tst,S4({},i,{title:l,desc:c,role:d,tabIndex:u,width:r,height:n,style:pPr,ref:t}),a)}),gPr=e=>{var{children:t}=e,r=en(e9);if(!r)return null;var{width:n,height:s,y:a,x:i}=r;return b.createElement(Tst,{width:n,height:s,x:i,y:a},t)},uIe=b.forwardRef((e,t)=>{var{children:r}=e,n=fPr(e,dPr),s=od();return s?b.createElement(gPr,null,b.createElement(cIe,{isPanorama:!0},r)):b.createElement(mPr,S4({ref:t},n),b.createElement(cIe,{isPanorama:!1},r))});function yPr(){var e=Vo(),[t,r]=b.useState(null),n=en(jwr);return b.useEffect(()=>{if(t!=null){var s=t.getBoundingClientRect(),a=s.width/t.offsetWidth;zs(a)&&a!==n&&e(hwr(a))}},[t,e,n]),r}function dIe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function vPr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dIe(Object(r),!0).forEach(function(n){bPr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dIe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bPr(e,t,r){return(t=xPr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xPr(e){var t=wPr(e,"string");return typeof t=="symbol"?t:t+""}function wPr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Kb(){return Kb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Kb.apply(null,arguments)}var SPr=()=>(dTr(),null);function O4(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var OPr=b.forwardRef((e,t)=>{var r,n,s=b.useRef(null),[a,i]=b.useState({containerWidth:O4((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:O4((n=e.style)===null||n===void 0?void 0:n.height)}),l=b.useCallback((u,d)=>{i(f=>{var h=Math.round(u),p=Math.round(d);return f.containerWidth===h&&f.containerHeight===p?f:{containerWidth:h,containerHeight:p}})},[]),c=b.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var h=m=>{var g=m[0];if(g!=null){var{width:y,height:x}=g.contentRect;l(y,x)}},p=new ResizeObserver(h);p.observe(u),s.current=p}},[t,l]);return b.useEffect(()=>()=>{var u=s.current;u?.disconnect()},[l]),b.createElement(b.Fragment,null,b.createElement(mP,{width:a.containerWidth,height:a.containerHeight}),b.createElement("div",Kb({ref:c},e)))}),kPr=b.forwardRef((e,t)=>{var{width:r,height:n}=e,[s,a]=b.useState({containerWidth:O4(r),containerHeight:O4(n)}),i=b.useCallback((c,u)=>{a(d=>{var f=Math.round(c),h=Math.round(u);return d.containerWidth===f&&d.containerHeight===h?d:{containerWidth:f,containerHeight:h}})},[]),l=b.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();i(u,d)}},[t,i]);return b.createElement(b.Fragment,null,b.createElement(mP,{width:s.containerWidth,height:s.containerHeight}),b.createElement("div",Kb({ref:l},e)))}),_Pr=b.forwardRef((e,t)=>{var{width:r,height:n}=e;return b.createElement(b.Fragment,null,b.createElement(mP,{width:r,height:n}),b.createElement("div",Kb({ref:t},e)))}),EPr=b.forwardRef((e,t)=>{var{width:r,height:n}=e;return typeof r=="string"||typeof n=="string"?b.createElement(kPr,Kb({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?b.createElement(_Pr,Kb({},e,{width:r,height:n,ref:t})):b.createElement(b.Fragment,null,b.createElement(mP,{width:r,height:n}),b.createElement("div",Kb({ref:t},e)))});function CPr(e){return e?OPr:EPr}var jPr=b.forwardRef((e,t)=>{var{children:r,className:n,height:s,onClick:a,onContextMenu:i,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:h,onTouchEnd:p,onTouchMove:m,onTouchStart:g,style:y,width:x,responsive:w,dispatchTouchEvents:S=!0}=e,k=b.useRef(null),_=Vo(),[E,T]=b.useState(null),[j,N]=b.useState(null),I=yPr(),P=bhe(),R=P?.width>0?P.width:x,$=P?.height>0?P.height:s,M=b.useCallback(oe=>{I(oe),typeof t=="function"&&t(oe),T(oe),N(oe),oe!=null&&(k.current=oe)},[I,t,T,N]),z=b.useCallback(oe=>{_(dct(oe)),_(Yf({handler:a,reactEvent:oe}))},[_,a]),U=b.useCallback(oe=>{_(Zae(oe)),_(Yf({handler:u,reactEvent:oe}))},[_,u]),B=b.useCallback(oe=>{_(ilt()),_(Yf({handler:d,reactEvent:oe}))},[_,d]),H=b.useCallback(oe=>{_(Zae(oe)),_(Yf({handler:f,reactEvent:oe}))},[_,f]),W=b.useCallback(()=>{_(yct())},[_]),L=b.useCallback(()=>{_(vct())},[_]),Y=b.useCallback(oe=>{_(gct(oe.key))},[_]),q=b.useCallback(oe=>{_(Yf({handler:i,reactEvent:oe}))},[_,i]),D=b.useCallback(oe=>{_(Yf({handler:l,reactEvent:oe}))},[_,l]),Q=b.useCallback(oe=>{_(Yf({handler:c,reactEvent:oe}))},[_,c]),G=b.useCallback(oe=>{_(Yf({handler:h,reactEvent:oe}))},[_,h]),J=b.useCallback(oe=>{_(Yf({handler:g,reactEvent:oe}))},[_,g]),ae=b.useCallback(oe=>{S&&_(wct(oe)),_(Yf({handler:m,reactEvent:oe}))},[_,S,m]),re=b.useCallback(oe=>{_(Yf({handler:p,reactEvent:oe}))},[_,p]),se=CPr(w);return b.createElement(Elt.Provider,{value:E},b.createElement(Lbr.Provider,{value:j},b.createElement(se,{width:R??y?.width,height:$??y?.height,className:va("recharts-wrapper",n),style:vPr({position:"relative",cursor:"default",width:R,height:$},y),onClick:z,onContextMenu:q,onDoubleClick:D,onFocus:W,onBlur:L,onKeyDown:Y,onMouseDown:Q,onMouseEnter:U,onMouseLeave:B,onMouseMove:H,onMouseUp:G,onTouchEnd:re,onTouchMove:ae,onTouchStart:J,ref:M},b.createElement(SPr,null),r)))}),TPr=["width","height","responsive","children","className","style","compact","title","desc"];function NPr(e,t){if(e==null)return{};var r,n,s=APr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function APr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var IPr=b.forwardRef((e,t)=>{var{width:r,height:n,responsive:s,children:a,className:i,style:l,compact:c,title:u,desc:d}=e,f=NPr(e,TPr),h=ng(f);return c?b.createElement(b.Fragment,null,b.createElement(mP,{width:r,height:n}),b.createElement(uIe,{otherAttributes:h,title:u,desc:d},a)):b.createElement(jPr,{className:i,style:l,width:r,height:n,responsive:s??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},b.createElement(uIe,{otherAttributes:h,title:u,desc:d,ref:t},b.createElement(QAr,null,a)))});function Yae(){return Yae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yae.apply(null,arguments)}function fIe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function RPr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fIe(Object(r),!0).forEach(function(n){PPr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fIe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function PPr(e,t,r){return(t=MPr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MPr(e){var t=DPr(e,"string");return typeof t=="symbol"?t:t+""}function DPr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var LPr={top:5,right:5,bottom:5,left:5},$Pr=RPr({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:LPr,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Oct),FPr=b.forwardRef(function(t,r){var n,s=id(t.categoricalChartProps,$Pr),{chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,categoricalChartProps:u}=t,d={chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,eventEmitter:void 0};return b.createElement(aPr,{preloadedState:{options:d},reduxStoreName:(n=u.id)!==null&&n!==void 0?n:a},b.createElement(FAr,{chartData:u.data}),b.createElement(oPr,{layout:s.layout,margin:s.margin}),b.createElement(uPr,{throttleDelay:s.throttleDelay,throttledEvents:s.throttledEvents}),b.createElement(lPr,{baseValue:s.baseValue,accessibilityLayer:s.accessibilityLayer,barCategoryGap:s.barCategoryGap,maxBarSize:s.maxBarSize,stackOffset:s.stackOffset,barGap:s.barGap,barSize:s.barSize,syncId:s.syncId,syncMethod:s.syncMethod,className:s.className,reverseStackOrder:s.reverseStackOrder}),b.createElement(IPr,Yae({},s,{ref:r})))}),zPr=["axis"],BPr=b.forwardRef((e,t)=>b.createElement(FPr,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:zPr,tooltipPayloadSearcher:Zjr,categoricalChartProps:e,ref:t}));function UPr(e,t){const r=getComputedStyle(e),n=parseFloat(r.fontSize);return t*n}function VPr(e,t){const r=getComputedStyle(e.ownerDocument.body),n=parseFloat(r.fontSize);return t*n}function qPr(e){return e/100*window.innerHeight}function HPr(e){return e/100*window.innerWidth}function QPr(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function HT({groupSize:e,panelElement:t,styleProp:r}){let n;const[s,a]=QPr(r);switch(a){case"%":{n=s/100*e;break}case"px":{n=s;break}case"rem":{n=VPr(t,s);break}case"em":{n=UPr(t,s);break}case"vh":{n=qPr(s);break}case"vw":{n=HPr(s);break}}return n}function Vu(e){return parseFloat(e.toFixed(3))}function Y_({group:e}){const{orientation:t,panels:r}=e;return r.reduce((n,s)=>(n+=t==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,n),0)}function Xae(e){const{panels:t}=e,r=Y_({group:e});return r===0?t.map(n=>({groupResizeBehavior:n.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:n.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:n.panelConstraints.disabled,minSize:0,maxSize:100,panelId:n.id})):t.map(n=>{const{element:s,panelConstraints:a}=n;let i=0;if(a.collapsedSize!==void 0){const d=HT({groupSize:r,panelElement:s,styleProp:a.collapsedSize});i=Vu(d/r*100)}let l;if(a.defaultSize!==void 0){const d=HT({groupSize:r,panelElement:s,styleProp:a.defaultSize});l=Vu(d/r*100)}let c=0;if(a.minSize!==void 0){const d=HT({groupSize:r,panelElement:s,styleProp:a.minSize});c=Vu(d/r*100)}let u=100;if(a.maxSize!==void 0){const d=HT({groupSize:r,panelElement:s,styleProp:a.maxSize});u=Vu(d/r*100)}return{groupResizeBehavior:a.groupResizeBehavior,collapsedSize:i,collapsible:a.collapsible===!0,defaultSize:l,disabled:a.disabled,minSize:c,maxSize:u,panelId:n.id}})}function Ea(e,t="Assertion error"){if(!e)throw Error(t)}function Kae(e,t){return Array.from(t).sort(e==="horizontal"?WPr:GPr)}function WPr(e,t){const r=e.element.offsetLeft-t.element.offsetLeft;return r!==0?r:e.element.offsetWidth-t.element.offsetWidth}function GPr(e,t){const r=e.element.offsetTop-t.element.offsetTop;return r!==0?r:e.element.offsetHeight-t.element.offsetHeight}function _ct(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Ect(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function ZPr({orientation:e,rects:t,targetRect:r}){const n={x:r.x+r.width/2,y:r.y+r.height/2};let s,a=Number.MAX_VALUE;for(const i of t){const{x:l,y:c}=Ect(n,i),u=e==="horizontal"?l:c;u<a&&(a=u,s=i)}return Ea(s,"No rect found"),s}let HD;function YPr(){return HD===void 0&&(typeof matchMedia=="function"?HD=!!matchMedia("(pointer:coarse)").matches:HD=!1),HD}function Cct(e){const{element:t,orientation:r,panels:n,separators:s}=e,a=Kae(r,Array.from(t.children).filter(_ct).map(m=>({element:m}))).map(({element:m})=>m),i=[];let l=!1,c=!1,u=-1,d=-1,f=0,h,p=[];{let m=-1;for(const g of a)g.hasAttribute("data-panel")&&(m++,g.ariaDisabled===null&&(f++,u===-1&&(u=m),d=m))}if(f>1){let m=-1;for(const g of a)if(g.hasAttribute("data-panel")){m++;const y=n.find(x=>x.element===g);if(y){if(h){const x=h.element.getBoundingClientRect(),w=g.getBoundingClientRect();let S;if(c){const k=r==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),_=r==="horizontal"?new DOMRect(w.left,w.top,0,w.height):new DOMRect(w.left,w.top,w.width,0);switch(p.length){case 0:{S=[k,_];break}case 1:{const E=p[0],T=ZPr({orientation:r,rects:[x,w],targetRect:E.element.getBoundingClientRect()});S=[E,T===x?_:k];break}default:{S=p;break}}}else p.length?S=p:S=[r==="horizontal"?new DOMRect(x.right,w.top,w.left-x.right,w.height):new DOMRect(w.left,x.bottom,w.width,w.top-x.bottom)];for(const k of S){let _="width"in k?k:k.element.getBoundingClientRect();const E=YPr()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(_.width<E){const j=E-_.width;_=new DOMRect(_.x-j/2,_.y,_.width+j,_.height)}if(_.height<E){const j=E-_.height;_=new DOMRect(_.x,_.y-j/2,_.width,_.height+j)}const T=m<=u||m>d;!l&&!T&&i.push({group:e,groupSize:Y_({group:e}),panels:[h,y],separator:"width"in k?void 0:k,rect:_}),l=!1}}c=!1,h=y,p=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(l=!0);const y=s.find(x=>x.element===g);y?p.push(y):(h=void 0,p=[])}else c=!0}return i}let jct=class{#e={};addListener(t,r){const n=this.#e[t];return n===void 0?this.#e[t]=[r]:n.includes(r)||n.push(r),()=>{this.removeListener(t,r)}}emit(t,r){const n=this.#e[t];if(n!==void 0)if(n.length===1)n[0].call(null,r);else{let s=!1,a=null;const i=Array.from(n);for(let l=0;l<i.length;l++){const c=i[l];try{c.call(null,r)}catch(u){a===null&&(s=!0,a=u)}}if(s)throw a}}removeAllListeners(){this.#e={}}removeListener(t,r){const n=this.#e[t];if(n!==void 0){const s=n.indexOf(r);s>=0&&n.splice(s,1)}}},$m=new Map;const Tct=new jct;function XPr(e){$m=new Map($m),$m.delete(e)}function hIe(e,t){for(const[r]of $m)if(r.id===e)return r}function Jb(e,t){for(const[r,n]of $m)if(r.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function w1(){return $m}function Ppe(e,t){return Tct.addListener("groupChange",r=>{r.group.id===e&&t(r)})}function tv(e,t){const r=$m.get(e);$m=new Map($m),$m.set(e,t),Tct.emit("groupChange",{group:e,prev:r,next:t})}function KPr(e,t,r){let n,s={x:1/0,y:1/0};for(const a of t){const i=Ect(r,a.rect);switch(e){case"horizontal":{i.x<=s.x&&(n=a,s=i);break}case"vertical":{i.y<=s.y&&(n=a,s=i);break}}}return n?{distance:s,hitRegion:n}:void 0}function JPr(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function eMr(e,t){if(e===t)throw new Error("Cannot compare node with itself");const r={a:gIe(e),b:gIe(t)};let n;for(;r.a.at(-1)===r.b.at(-1);)n=r.a.pop(),r.b.pop();Ea(n,"Stacking order can only be calculated for elements with a common ancestor");const s={a:mIe(pIe(r.a)),b:mIe(pIe(r.b))};if(s.a===s.b){const a=n.childNodes,i={a:r.a.at(-1),b:r.b.at(-1)};let l=a.length;for(;l--;){const c=a[l];if(c===i.a)return 1;if(c===i.b)return-1}}return Math.sign(s.a-s.b)}const tMr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function rMr(e){const t=getComputedStyle(Nct(e)??e).display;return t==="flex"||t==="inline-flex"}function nMr(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||rMr(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||tMr.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function pIe(e){let t=e.length;for(;t--;){const r=e[t];if(Ea(r,"Missing node"),nMr(r))return r}return null}function mIe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function gIe(e){const t=[];for(;e;)t.push(e),e=Nct(e);return t}function Nct(e){const{parentNode:t}=e;return JPr(t)?t.host:t}function sMr(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function aMr({groupElement:e,hitRegion:t,pointerEventTarget:r}){if(!_ct(r)||r.contains(e)||e.contains(r))return!0;if(eMr(r,e)>0){let n=r;for(;n;){if(n.contains(e))return!0;if(sMr(n.getBoundingClientRect(),t))return!1;n=n.parentElement}}return!0}function Mpe(e,t){const r=[];return t.forEach((n,s)=>{if(s.disabled)return;const a=Cct(s),i=KPr(s.orientation,a,{x:e.clientX,y:e.clientY});i&&i.distance.x<=0&&i.distance.y<=0&&aMr({groupElement:s.element,hitRegion:i.hitRegion.rect,pointerEventTarget:e.target})&&r.push(i.hitRegion)}),r}function iMr(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function Hc(e,t,r=0){return Math.abs(Vu(e)-Vu(t))<=r}function pm(e,t){return Hc(e,t)?0:e>t?1:-1}function gk({overrideDisabledPanels:e,panelConstraints:t,prevSize:r,size:n}){const{collapsedSize:s=0,collapsible:a,disabled:i,maxSize:l=100,minSize:c=0}=t;if(i&&!e)return r;if(pm(n,c)<0)if(a){const u=(s+c)/2;pm(n,u)<0?n=s:n=c}else n=c;return n=Math.min(l,n),n=Vu(n),n}function cI({delta:e,initialLayout:t,panelConstraints:r,pivotIndices:n,prevLayout:s,trigger:a}){if(Hc(e,0))return t;const i=a==="imperative-api",l=Object.values(t),c=Object.values(s),u=[...l],[d,f]=n;Ea(d!=null,"Invalid first pivot index"),Ea(f!=null,"Invalid second pivot index");let h=0;switch(a){case"keyboard":{{const g=e<0?f:d,y=r[g];Ea(y,`Panel constraints not found for index ${g}`);const{collapsedSize:x=0,collapsible:w,minSize:S=0}=y;if(w){const k=l[g];if(Ea(k!=null,`Previous layout not found for panel index ${g}`),Hc(k,x)){const _=S-k;pm(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}{const g=e<0?d:f,y=r[g];Ea(y,`No panel constraints found for index ${g}`);const{collapsedSize:x=0,collapsible:w,minSize:S=0}=y;if(w){const k=l[g];if(Ea(k!=null,`Previous layout not found for panel index ${g}`),Hc(k,S)){const _=k-x;pm(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}break}default:{const g=e<0?f:d,y=r[g];Ea(y,`Panel constraints not found for index ${g}`);const x=l[g],{collapsible:w,collapsedSize:S,minSize:k}=y;if(w&&pm(x,k)<0)if(e>0){const _=k-S,E=_/2,T=x+e;pm(T,k)<0&&(e=pm(e,E)<=0?0:_)}else{const _=k-S,E=100-_/2,T=x-e;pm(T,k)<0&&(e=pm(100+e,E)>0?0:-_)}break}}{const g=e<0?1:-1;let y=e<0?f:d,x=0;for(;;){const S=l[y];Ea(S!=null,`Previous layout not found for panel index ${y}`);const k=gk({overrideDisabledPanels:i,panelConstraints:r[y],prevSize:S,size:100})-S;if(x+=k,y+=g,y<0||y>=r.length)break}const w=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-w:w}{let g=e<0?d:f;for(;g>=0&&g<r.length;){const y=Math.abs(e)-Math.abs(h),x=l[g];Ea(x!=null,`Previous layout not found for panel index ${g}`);const w=x-y,S=gk({overrideDisabledPanels:i,panelConstraints:r[g],prevSize:x,size:w});if(!Hc(x,S)&&(h+=x-S,u[g]=S,h.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(iMr(c,u))return s;{const g=e<0?f:d,y=l[g];Ea(y!=null,`Previous layout not found for panel index ${g}`);const x=y+h,w=gk({overrideDisabledPanels:i,panelConstraints:r[g],prevSize:y,size:x});if(u[g]=w,!Hc(w,x)){let S=x-w,k=e<0?f:d;for(;k>=0&&k<r.length;){const _=u[k];Ea(_!=null,`Previous layout not found for panel index ${k}`);const E=_+S,T=gk({overrideDisabledPanels:i,panelConstraints:r[k],prevSize:_,size:E});if(Hc(_,T)||(S-=T-_,u[k]=T),Hc(S,0))break;e>0?k--:k++}}}const p=Object.values(u).reduce((g,y)=>y+g,0);if(!Hc(p,100,.1))return s;const m=Object.keys(s);return u.reduce((g,y,x)=>(g[m[x]]=y,g),{})}function RS(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(t[r]===void 0||pm(e[r],t[r])!==0)return!1;return!0}function PS({layout:e,panelConstraints:t}){const r=Object.values(e),n=[...r],s=n.reduce((l,c)=>l+c,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(l=>`${l}%`).join(", ")}`);if(!Hc(s,100)&&n.length>0)for(let l=0;l<t.length;l++){const c=n[l];Ea(c!=null,`No layout data found for index ${l}`);const u=100/s*c;n[l]=u}let a=0;for(let l=0;l<t.length;l++){const c=r[l];Ea(c!=null,`No layout data found for index ${l}`);const u=n[l];Ea(u!=null,`No layout data found for index ${l}`);const d=gk({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:c,size:u});u!=d&&(a+=u-d,n[l]=d)}if(!Hc(a,0))for(let l=0;l<t.length;l++){const c=n[l];Ea(c!=null,`No layout data found for index ${l}`);const u=c+a,d=gk({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:c,size:u});if(c!==d&&(a-=d-c,n[l]=d,Hc(a,0)))break}const i=Object.keys(e);return n.reduce((l,c,u)=>(l[i[u]]=c,l),{})}function Act({groupId:e,panelId:t}){const r=()=>{const l=w1();for(const[c,{defaultLayoutDeferred:u,derivedPanelConstraints:d,layout:f,groupSize:h,separatorToPanels:p}]of l)if(c.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:c,groupSize:h,layout:f,separatorToPanels:p};throw Error(`Group ${e} not found`)},n=()=>{const l=r().derivedPanelConstraints.find(c=>c.panelId===t);if(l!==void 0)return l;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{const l=r().group.panels.find(c=>c.id===t);if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},a=()=>{const l=r().layout[t];if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},i=l=>{const c=a();if(l===c)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:f,groupSize:h,layout:p,separatorToPanels:m}=r(),g=f.panels.findIndex(S=>S.id===t),y=g===f.panels.length-1,x=cI({delta:y?c-l:l-c,initialLayout:p,panelConstraints:d,pivotIndices:y?[g-1,g]:[g,g+1],prevLayout:p,trigger:"imperative-api"}),w=PS({layout:x,panelConstraints:d});RS(p,w)||tv(f,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:h,layout:w,separatorToPanels:m})};return{collapse:()=>{const{collapsible:l,collapsedSize:c}=n(),{mutableValues:u}=s(),d=a();l&&d!==c&&(u.expandToSize=d,i(c))},expand:()=>{const{collapsible:l,collapsedSize:c,minSize:u}=n(),{mutableValues:d}=s(),f=a();if(l&&f===c){let h=d.expandToSize??u;h===0&&(h=1),i(h)}},getSize:()=>{const{group:l}=r(),c=a(),{element:u}=s(),d=l.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:c,inPixels:d}},isCollapsed:()=>{const{collapsible:l,collapsedSize:c}=n(),u=a();return l&&Hc(c,u)},resize:l=>{const{group:c}=r(),{element:u}=s(),d=Y_({group:c}),f=HT({groupSize:d,panelElement:u,styleProp:l}),h=Vu(f/d*100);i(h)}}}function yIe(e){if(e.defaultPrevented)return;const t=w1();Mpe(e,t).forEach(r=>{if(r.separator){const n=r.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(n){const s=n.panelConstraints.defaultSize,a=Act({groupId:r.group.id,panelId:n.id});a&&s!==void 0&&(a.resize(s),e.preventDefault())}}})}function S$(e){const t=w1();for(const[r]of t)if(r.separators.some(n=>n.element===e))return r;throw Error("Could not find parent Group for separator element")}function Ict({groupId:e}){const t=()=>{const r=w1();for(const[n,s]of r)if(n.id===e)return{group:n,...s};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:r,layout:n}=t();return r?{}:n},setLayout(r){const{defaultLayoutDeferred:n,derivedPanelConstraints:s,group:a,groupSize:i,layout:l,separatorToPanels:c}=t(),u=PS({layout:r,panelConstraints:s});return n?l:(RS(l,u)||tv(a,{defaultLayoutDeferred:n,derivedPanelConstraints:s,groupSize:i,layout:u,separatorToPanels:c}),u)}}}function V0(e,t){const r=S$(e),n=Jb(r.id,!0),s=r.separators.find(d=>d.element===e);Ea(s,"Matching separator not found");const a=n.separatorToPanels.get(s);Ea(a,"Matching panels not found");const i=a.map(d=>r.panels.indexOf(d)),l=Ict({groupId:r.id}).getLayout(),c=cI({delta:t,initialLayout:l,panelConstraints:n.derivedPanelConstraints,pivotIndices:i,prevLayout:l,trigger:"keyboard"}),u=PS({layout:c,panelConstraints:n.derivedPanelConstraints});RS(l,u)||tv(r,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:u,separatorToPanels:n.separatorToPanels})}function vIe(e){if(e.defaultPrevented)return;const t=e.currentTarget,r=S$(t);if(!r.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),r.orientation==="vertical"&&V0(t,5);break}case"ArrowLeft":{e.preventDefault(),r.orientation==="horizontal"&&V0(t,-5);break}case"ArrowRight":{e.preventDefault(),r.orientation==="horizontal"&&V0(t,5);break}case"ArrowUp":{e.preventDefault(),r.orientation==="vertical"&&V0(t,-5);break}case"End":{e.preventDefault(),V0(t,100);break}case"Enter":{e.preventDefault();const n=S$(t),s=Jb(n.id,!0),{derivedPanelConstraints:a,layout:i,separatorToPanels:l}=s,c=n.separators.find(h=>h.element===t);Ea(c,"Matching separator not found");const u=l.get(c);Ea(u,"Matching panels not found");const d=u[0],f=a.find(h=>h.panelId===d.id);if(Ea(f,"Panel metadata not found"),f.collapsible){const h=i[d.id],p=f.collapsedSize===h?n.mutableState.expandedPanelSizes[d.id]??f.minSize:f.collapsedSize;V0(t,p-h)}break}case"F6":{e.preventDefault();const n=S$(t).separators.map(i=>i.element),s=Array.from(n).findIndex(i=>i===e.currentTarget);Ea(s!==null,"Index not found");const a=e.shiftKey?s>0?s-1:n.length-1:s+1<n.length?s+1:0;n[a].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),V0(t,-100);break}}}let e_={cursorFlags:0,state:"inactive"};const Dpe=new jct;function MS(){return e_}function oMr(e){return Dpe.addListener("change",e)}function lMr(e){const t=e_,r={...e_};r.cursorFlags=e,e_=r,Dpe.emit("change",{prev:t,next:r})}function t_(e){const t=e_;e_=e,Dpe.emit("change",{prev:t,next:e})}function bIe(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=w1(),r=Mpe(e,t),n=new Map;let s=!1;r.forEach(a=>{a.separator&&(s||(s=!0,a.separator.element.focus({preventScroll:!0})));const i=t.get(a.group);i&&n.set(a.group,i.layout)}),t_({cursorFlags:0,hitRegions:r,initialLayoutMap:n,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),r.length&&e.preventDefault()}const cMr=e=>e,KH=()=>{},Rct=1,Pct=2,Mct=4,Dct=8,xIe=3,wIe=12;let QD;function SIe(){return QD===void 0&&(QD=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(QD=!0)),QD}function uMr({cursorFlags:e,groups:t,state:r}){let n=0,s=0;switch(r){case"active":case"hover":t.forEach(a=>{if(!a.mutableState.disableCursor)switch(a.orientation){case"horizontal":{n++;break}case"vertical":{s++;break}}})}if(!(n===0&&s===0)){switch(r){case"active":{if(e&&SIe()){const a=(e&Rct)!==0,i=(e&Pct)!==0,l=(e&Mct)!==0,c=(e&Dct)!==0;if(a)return l?"se-resize":c?"ne-resize":"e-resize";if(i)return l?"sw-resize":c?"nw-resize":"w-resize";if(l)return"s-resize";if(c)return"n-resize"}break}}return SIe()?n>0&&s>0?"move":n>0?"ew-resize":"ns-resize":n>0&&s>0?"grab":n>0?"col-resize":"row-resize"}}const OIe=new WeakMap;function Lpe(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:r}=OIe.get(e)??{};r===void 0&&(r=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(r));const n=MS();switch(n.state){case"active":case"hover":{const s=uMr({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(i=>i.group),state:n.state}),a=`*, *:hover {cursor: ${s} !important; }`;if(t===a)return;t=a,s?r.cssRules.length===0?r.insertRule(a):r.replaceSync(a):r.cssRules.length===1&&r.deleteRule(0);break}case"inactive":{t=void 0,r.cssRules.length===1&&r.deleteRule(0);break}}OIe.set(e,{prevStyle:t,styleSheet:r})}function Lct({document:e,event:t,hitRegions:r,initialLayoutMap:n,mountedGroups:s,pointerDownAtPoint:a,prevCursorFlags:i}){let l=0;r.forEach(u=>{const{group:d,groupSize:f}=u,{orientation:h,panels:p}=d,{disableCursor:m}=d.mutableState;let g=0;a?h==="horizontal"?g=(t.clientX-a.x)/f*100:g=(t.clientY-a.y)/f*100:h==="horizontal"?g=t.clientX<0?-100:100:g=t.clientY<0?-100:100;const y=n.get(d),x=s.get(d);if(!y||!x)return;const{defaultLayoutDeferred:w,derivedPanelConstraints:S,groupSize:k,layout:_,separatorToPanels:E}=x;if(S&&_&&E){const T=cI({delta:g,initialLayout:y,panelConstraints:S,pivotIndices:u.panels.map(j=>p.indexOf(j)),prevLayout:_,trigger:"mouse-or-touch"});if(RS(T,_)){if(g!==0&&!m)switch(h){case"horizontal":{l|=g<0?Rct:Pct;break}case"vertical":{l|=g<0?Mct:Dct;break}}}else tv(u.group,{defaultLayoutDeferred:w,derivedPanelConstraints:S,groupSize:k,layout:T,separatorToPanels:E})}});let c=0;t.movementX===0?c|=i&xIe:c|=l&xIe,t.movementY===0?c|=i&wIe:c|=l&wIe,lMr(c),Lpe(e)}function kIe(e){const t=w1(),r=MS();r.state==="active"&&Lct({document:e.currentTarget,event:e,hitRegions:r.hitRegions,initialLayoutMap:r.initialLayoutMap,mountedGroups:t,prevCursorFlags:r.cursorFlags})}function _Ie(e){if(e.defaultPrevented)return;const t=MS(),r=w1();switch(t.state){case"active":{if(e.buttons===0){t_({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(n=>{const s=Jb(n.group.id,!0);tv(n.group,s)});return}Lct({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:r,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const n=Mpe(e,r);n.length===0?t.state!=="inactive"&&t_({cursorFlags:0,state:"inactive"}):t_({cursorFlags:0,hitRegions:n,state:"hover"}),Lpe(e.currentTarget);break}}}function EIe(e){e.relatedTarget instanceof HTMLIFrameElement&&MS().state==="hover"&&t_({cursorFlags:0,state:"inactive"})}function CIe(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=MS();t.state==="active"&&(t_({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Lpe(e.currentTarget),t.hitRegions.forEach(r=>{const n=Jb(r.group.id,!0);tv(r.group,n)}),e.preventDefault()))}function jIe(e){let t=0,r=0;const n={};for(const a of e)if(a.defaultSize!==void 0){t++;const i=Vu(a.defaultSize);r+=i,n[a.panelId]=i}else n[a.panelId]=void 0;const s=e.length-t;if(s!==0){const a=Vu((100-r)/s);for(const i of e)i.defaultSize===void 0&&(n[i.panelId]=a)}return n}function dMr(e,t,r){if(!r[0])return;const n=e.panels.find(c=>c.element===t);if(!n||!n.onResize)return;const s=Y_({group:e}),a=e.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,i=n.mutableValues.prevSize,l={asPercentage:Vu(a/s*100),inPixels:a};n.mutableValues.prevSize=l,n.onResize(l,n.id,i)}function fMr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function hMr({group:e,nextGroupSize:t,prevGroupSize:r,prevLayout:n}){if(r<=0||t<=0||r===t)return n;let s=0,a=0,i=!1;const l=new Map,c=[];for(const f of e.panels){const h=n[f.id]??0;if(f.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){i=!0;const p=h/100*r,m=Vu(p/t*100);l.set(f.id,m),s+=m}else c.push(f.id),a+=h}if(!i||c.length===0)return n;const u=100-s,d={...n};if(l.forEach((f,h)=>{d[h]=f}),a>0)for(const f of c){const h=n[f]??0;d[f]=Vu(h/a*u)}else{const f=Vu(u/c.length);for(const h of c)d[h]=f}return d}function pMr(e,t){const r=e.map(s=>s.id),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r)if(!n.includes(s))return!1;return!0}const EO=new Map;function mMr(e){let t=!0;Ea(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const r=e.element.ownerDocument.defaultView.ResizeObserver,n=new Set,s=new Set,a=new r(m=>{for(const g of m){const{borderBoxSize:y,target:x}=g;if(x===e.element){if(t){const w=Y_({group:e});if(w===0)return;const S=Jb(e.id);if(!S)return;const k=Xae(e),_=S.defaultLayoutDeferred?jIe(k):S.layout,E=hMr({group:e,nextGroupSize:w,prevGroupSize:S.groupSize,prevLayout:_}),T=PS({layout:E,panelConstraints:k});if(!S.defaultLayoutDeferred&&RS(S.layout,T)&&fMr(S.derivedPanelConstraints,k)&&S.groupSize===w)return;tv(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:k,groupSize:w,layout:T,separatorToPanels:S.separatorToPanels})}}else dMr(e,x,y)}});a.observe(e.element),e.panels.forEach(m=>{Ea(!n.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),n.add(m.id),m.onResize&&a.observe(m.element)});const i=Y_({group:e}),l=Xae(e),c=e.panels.map(({id:m})=>m).join(",");let u=e.mutableState.defaultLayout;u&&(pMr(e.panels,u)||(u=void 0));const d=e.mutableState.layouts[c]??u??jIe(l),f=PS({layout:d,panelConstraints:l}),h=e.element.ownerDocument;EO.set(h,(EO.get(h)??0)+1);const p=new Map;return Cct(e).forEach(m=>{m.separator&&p.set(m.separator,m.panels)}),tv(e,{defaultLayoutDeferred:i===0,derivedPanelConstraints:l,groupSize:i,layout:f,separatorToPanels:p}),e.separators.forEach(m=>{Ea(!s.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),s.add(m.id),m.element.addEventListener("keydown",vIe)}),EO.get(h)===1&&(h.addEventListener("dblclick",yIe,!0),h.addEventListener("pointerdown",bIe,!0),h.addEventListener("pointerleave",kIe),h.addEventListener("pointermove",_Ie),h.addEventListener("pointerout",EIe),h.addEventListener("pointerup",CIe,!0)),function(){t=!1,EO.set(h,Math.max(0,(EO.get(h)??0)-1)),XPr(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",vIe)}),EO.get(h)||(h.removeEventListener("dblclick",yIe,!0),h.removeEventListener("pointerdown",bIe,!0),h.removeEventListener("pointerleave",kIe),h.removeEventListener("pointermove",_Ie),h.removeEventListener("pointerout",EIe),h.removeEventListener("pointerup",CIe,!0)),a.disconnect()}}function gMr(){const[e,t]=b.useState({}),r=b.useCallback(()=>t({}),[]);return[e,r]}function $pe(e){const t=b.useId();return`${e??t}`}const S1=typeof window<"u"?b.useLayoutEffect:b.useEffect;function TN(e){const t=b.useRef(e);return S1(()=>{t.current=e},[e]),b.useCallback((...r)=>t.current?.(...r),[t])}function Fpe(...e){return TN(t=>{e.forEach(r=>{if(r)switch(typeof r){case"function":{r(t);break}case"object":{r.current=t;break}}})})}function zpe(e){const t=b.useRef({...e});return S1(()=>{for(const r in e)t.current[r]=e[r]},[e]),t.current}const $ct=b.createContext(null);function yMr(e,t){const r=b.useRef({getLayout:()=>({}),setLayout:cMr});b.useImperativeHandle(t,()=>r.current,[]),S1(()=>{Object.assign(r.current,Ict({groupId:e}))})}function O9({children:e,className:t,defaultLayout:r,disableCursor:n,disabled:s,elementRef:a,groupRef:i,id:l,onLayoutChange:c,onLayoutChanged:u,orientation:d="horizontal",resizeTargetMinimumSize:f={coarse:20,fine:10},style:h,...p}){const m=b.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=TN(P=>{RS(m.current.onLayoutChange,P)||(m.current.onLayoutChange=P,c?.(P))}),y=TN(P=>{RS(m.current.onLayoutChanged,P)||(m.current.onLayoutChanged=P,u?.(P))}),x=$pe(l),w=b.useRef(null),[S,k]=gMr(),_=b.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:f,separators:[]}),E=Fpe(w,a);yMr(x,i);const T=TN((P,R)=>{const $=MS(),M=hIe(P),z=Jb(P);if(z){let U=!1;return $.state==="active"&&(U=$.hitRegions.some(B=>B.group===M)),{flexGrow:z.layout[R]??1,pointerEvents:U?"none":void 0}}return{flexGrow:r?.[R]??1}}),j=zpe({defaultLayout:r,disableCursor:n}),N=b.useMemo(()=>({get disableCursor(){return!!j.disableCursor},getPanelStyles:T,id:x,orientation:d,registerPanel:P=>{const R=_.current;return R.panels=Kae(d,[...R.panels,P]),k(),()=>{R.panels=R.panels.filter($=>$!==P),k()}},registerSeparator:P=>{const R=_.current;return R.separators=Kae(d,[...R.separators,P]),k(),()=>{R.separators=R.separators.filter($=>$!==P),k()}},togglePanelDisabled:(P,R)=>{const $=_.current.panels.find(U=>U.id===P);$&&($.panelConstraints.disabled=R);const M=hIe(x),z=Jb(x);M&&z&&tv(M,{...z,derivedPanelConstraints:Xae(M)})},toggleSeparatorDisabled:(P,R)=>{const $=_.current.separators.find(M=>M.id===P);$&&($.disabled=R)}}),[T,x,k,d,j]),I=b.useRef(null);return S1(()=>{const P=w.current;if(P===null)return;const R=_.current;let $;if(j.defaultLayout!==void 0&&Object.keys(j.defaultLayout).length===R.panels.length){$={};for(const L of R.panels){const Y=j.defaultLayout[L.id];Y!==void 0&&($[L.id]=Y)}}const M={disabled:!!s,element:P,id:x,mutableState:{defaultLayout:$,disableCursor:!!j.disableCursor,expandedPanelSizes:_.current.lastExpandedPanelSizes,layouts:_.current.layouts},orientation:d,panels:R.panels,resizeTargetMinimumSize:R.resizeTargetMinimumSize,separators:R.separators};I.current=M;const z=mMr(M),{defaultLayoutDeferred:U,derivedPanelConstraints:B,layout:H}=Jb(M.id,!0);!U&&B.length>0&&(g(H),y(H));const W=Ppe(x,L=>{const{defaultLayoutDeferred:Y,derivedPanelConstraints:q,layout:D}=L.next;if(Y||q.length===0)return;const Q=M.panels.map(({id:J})=>J).join(",");M.mutableState.layouts[Q]=D,q.forEach(J=>{if(J.collapsible){const{layout:ae}=L.prev??{};if(ae){const re=Hc(J.collapsedSize,D[J.panelId]),se=Hc(J.collapsedSize,ae[J.panelId]);re&&!se&&(M.mutableState.expandedPanelSizes[J.panelId]=ae[J.panelId])}}});const G=MS().state!=="active";g(D),G&&y(D)});return()=>{I.current=null,z(),W()}},[s,x,y,g,d,S,j]),b.useEffect(()=>{const P=I.current;P&&(P.mutableState.defaultLayout=r,P.mutableState.disableCursor=!!n)}),o.jsx($ct.Provider,{value:N,children:o.jsx("div",{...p,className:t,"data-group":!0,"data-testid":x,id:x,ref:E,style:{height:"100%",width:"100%",overflow:"hidden",...h,display:"flex",flexDirection:d==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:d==="horizontal"?"pan-y":"pan-x"},children:e})})}O9.displayName="Group";function JH(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function Bpe({debounceSaveMs:e=100,panelIds:t,storage:r=localStorage,...n}){const s=t!==void 0,a="id"in n?n.id:n.groupId,i=JH(a,t??[]),l=b.useSyncExternalStore(vMr,()=>r.getItem(i),()=>r.getItem(i)),c=b.useMemo(()=>l?JSON.parse(l):void 0,[l]),u=b.useRef(null),d=b.useCallback(()=>{const p=u.current;p&&(u.current=null,clearTimeout(p))},[]);b.useLayoutEffect(()=>()=>{d()},[d]);const f=b.useCallback(p=>{d();let m;s?m=JH(a,Object.keys(p)):m=JH(a,[]);try{r.setItem(m,JSON.stringify(p))}catch(g){console.error(g)}},[d,s,a,r]),h=b.useCallback(p=>{d(),e===0?f(p):u.current=setTimeout(()=>{f(p)},e)},[d,e,f]);return{defaultLayout:c,onLayoutChange:h,onLayoutChanged:f}}function vMr(){return function(){}}function Upe(){const e=b.useContext($ct);return Ea(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function bMr(e,t){const{id:r}=Upe(),n=b.useRef({collapse:KH,expand:KH,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:KH});b.useImperativeHandle(t,()=>n.current,[]),S1(()=>{Object.assign(n.current,Act({groupId:r,panelId:e}))})}function X_({children:e,className:t,collapsedSize:r="0%",collapsible:n=!1,defaultSize:s,disabled:a,elementRef:i,groupResizeBehavior:l="preserve-relative-size",id:c,maxSize:u="100%",minSize:d="0%",onResize:f,panelRef:h,style:p,...m}){const g=!!c,y=$pe(c),x=zpe({disabled:a}),w=b.useRef(null),S=Fpe(w,i),{getPanelStyles:k,id:_,orientation:E,registerPanel:T,togglePanelDisabled:j}=Upe(),N=f!==null,I=TN((R,$,M)=>{f?.(R,c,M)});S1(()=>{const R=w.current;if(R!==null){const $={element:R,id:y,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:N?I:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:r,collapsible:n,defaultSize:s,disabled:x.disabled,maxSize:u,minSize:d}};return T($)}},[l,r,n,s,N,y,g,u,d,I,T,x]),b.useEffect(()=>{j(y,!!a)},[a,y,j]),bMr(y,h);const P=b.useSyncExternalStore(R=>Ppe(_,R),()=>JSON.stringify(k(_,y)),()=>JSON.stringify(k(_,y)));return o.jsx("div",{...m,"aria-disabled":a||void 0,"data-panel":!0,"data-testid":y,id:y,ref:S,style:{...xMr,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(P)},children:o.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:E==="horizontal"?"pan-y":"pan-x"},children:e})})}X_.displayName="Panel";const xMr={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function wMr(){return b.useRef(null)}function SMr({layout:e,panelConstraints:t,panelId:r,panelIndex:n}){let s,a;const i=e[r],l=t.find(c=>c.panelId===r);if(l){const c=l.maxSize,u=l.collapsible?l.collapsedSize:l.minSize,d=[n,n+1];a=PS({layout:cI({delta:u-i,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[r],s=PS({layout:cI({delta:c-i,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[r]}return{valueControls:r,valueMax:s,valueMin:a,valueNow:i}}function Fct({children:e,className:t,disabled:r,elementRef:n,id:s,style:a,...i}){const l=$pe(s),c=zpe({disabled:r}),[u,d]=b.useState({}),[f,h]=b.useState("inactive"),p=b.useRef(null),m=Fpe(p,n),{disableCursor:g,id:y,orientation:x,registerSeparator:w,toggleSeparatorDisabled:S}=Upe(),k=x==="horizontal"?"vertical":"horizontal";S1(()=>{const E=p.current;if(E!==null){const T={disabled:c.disabled,element:E,id:l},j=w(T),N=oMr(P=>{h(P.next.state!=="inactive"&&P.next.hitRegions.some(R=>R.separator===T)?P.next.state:"inactive")}),I=Ppe(y,P=>{const{derivedPanelConstraints:R,layout:$,separatorToPanels:M}=P.next,z=M.get(T);if(z){const U=z[0],B=z.indexOf(U);d(SMr({layout:$,panelConstraints:R,panelId:U.id,panelIndex:B}))}});return()=>{N(),I(),j()}}},[y,l,w,c]),b.useEffect(()=>{S(l,!!r)},[r,l,S]);let _;return r&&!g&&(_="not-allowed"),o.jsx("div",{...i,"aria-controls":u.valueControls,"aria-disabled":r||void 0,"aria-orientation":k,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":r?"disabled":f,"data-testid":l,id:l,ref:m,role:"separator",style:{flexBasis:"auto",cursor:_,...a,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:r?void 0:0})}Fct.displayName="Separator";var O1=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(){}},OMr={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},kMr=class{#e=OMr;#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)}},Nw=new kMr;function _Mr(e){setTimeout(e,0)}var DS=typeof window>"u"||"Deno"in globalThis;function uc(){}function EMr(e,t){return typeof e=="function"?e(t):e}function Jae(e){return typeof e=="number"&&e>=0&&e!==1/0}function zct(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ex(e,t){return typeof e=="function"?e(t):e}function Jf(e,t){return typeof e=="function"?e(t):e}function TIe(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:a,queryKey:i,stale:l}=e;if(i){if(n){if(t.queryHash!==Vpe(i,t.options))return!1}else if(!uI(t.queryKey,i))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||a&&!a(t))}function NIe(e,t){const{exact:r,status:n,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(LS(t.options.mutationKey)!==LS(a))return!1}else if(!uI(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Vpe(e,t){return(t?.queryKeyHashFn||LS)(e)}function LS(e){return JSON.stringify(e,(t,r)=>eie(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function uI(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>uI(e[r],t[r])):!1}var CMr=Object.prototype.hasOwnProperty;function qpe(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=AIe(e)&&AIe(t);if(!n&&!(eie(e)&&eie(t)))return t;const a=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),l=i.length,c=n?new Array(l):{};let u=0;for(let d=0;d<l;d++){const f=n?d:i[d],h=e[f],p=t[f];if(h===p){c[f]=h,(n?d<a:CMr.call(e,f))&&u++;continue}if(h===null||p===null||typeof h!="object"||typeof p!="object"){c[f]=p;continue}const m=qpe(h,p,r+1);c[f]=m,m===h&&u++}return a===l&&u===a?e:c}function dI(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function AIe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function eie(e){if(!IIe(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!IIe(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function IIe(e){return Object.prototype.toString.call(e)==="[object Object]"}function jMr(e){return new Promise(t=>{Nw.setTimeout(t,e)})}function tie(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?qpe(e,t):t}function TMr(e){return e}function NMr(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function AMr(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Hpe=Symbol();function Bct(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Hpe?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Qpe(e,t){return typeof e=="function"?e(...t):!!e}function IMr(e,t,r){let n=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),n||(n=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),e}var RMr=class extends O1{#e;#t;#r;constructor(){super(),this.#r=e=>{if(!DS&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=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"}},Wpe=new RMr;function rie(){let e,t;const r=new Promise((s,a)=>{e=s,t=a});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var PMr=_Mr;function MMr(){let e=[],t=0,r=l=>{l()},n=l=>{l()},s=PMr;const a=l=>{t?e.push(l):s(()=>{r(l)})},i=()=>{const l=e;e=[],l.length&&s(()=>{n(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||i()}return c},batchCalls:l=>(...c)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var Gi=MMr(),DMr=class extends O1{#e=!0;#t;#r;constructor(){super(),this.#r=e=>{if(!DS&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#e}},k4=new DMr;function LMr(e){return Math.min(1e3*2**e,3e4)}function Uct(e){return(e??"online")==="online"?k4.isOnline():!0}var nie=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Vct(e){let t=!1,r=0,n;const s=rie(),a=()=>s.status!=="pending",i=g=>{if(!a()){const y=new nie(g);h(y),e.onCancel?.(y)}},l=()=>{t=!0},c=()=>{t=!1},u=()=>Wpe.isFocused()&&(e.networkMode==="always"||k4.isOnline())&&e.canRun(),d=()=>Uct(e.networkMode)&&e.canRun(),f=g=>{a()||(n?.(),s.resolve(g))},h=g=>{a()||(n?.(),s.reject(g))},p=()=>new Promise(g=>{n=y=>{(a()||u())&&g(y)},e.onPause?.()}).then(()=>{n=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let g;const y=r===0?e.initialPromise:void 0;try{g=y??e.fn()}catch(x){g=Promise.reject(x)}Promise.resolve(g).then(f).catch(x=>{if(a())return;const w=e.retry??(DS?0:3),S=e.retryDelay??LMr,k=typeof S=="function"?S(r,x):S,_=w===!0||typeof w=="number"&&r<w||typeof w=="function"&&w(r,x);if(t||!_){h(x);return}r++,e.onFail?.(r,x),jMr(k).then(()=>u()?void 0:p()).then(()=>{t?h(x):m()})})};return{promise:s,status:()=>s.status,cancel:i,continue:()=>(n?.(),s),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?m():p().then(m),s)}}var qct=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Jae(this.gcTime)&&(this.#e=Nw.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(DS?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Nw.clearTimeout(this.#e),this.#e=void 0)}},$Mr=class extends qct{#e;#t;#r;#s;#n;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#r=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=PIe(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=PIe(this.options);t.data!==void 0&&(this.setState(RIe(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const r=tie(this.state.data,e,this.options);return this.#i({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#i({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#n?.promise;return this.#n?.cancel(e),t?t.then(uc).catch(uc):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Jf(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Hpe||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ex(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:!zct(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.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.#n&&(this.#o?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(e&&this.setOptions(e),!this.options.queryFn){const l=this.observers.find(c=>c.options.queryFn);l&&this.setOptions(l.options)}const r=new AbortController,n=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(this.#o=!0,r.signal)})},s=()=>{const l=Bct(this.options,t),u=(()=>{const d={client:this.#s,queryKey:this.queryKey,meta:this.meta};return n(d),d})();return this.#o=!1,this.options.persister?this.options.persister(l,u,this):l(u)},i=(()=>{const l={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:s};return n(l),l})();this.options.behavior?.onFetch(i,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#i({type:"fetch",meta:i.fetchOptions?.meta}),this.#n=Vct({initialPromise:t?.initialPromise,fn:i.fetchFn,onCancel:l=>{l instanceof nie&&l.revert&&this.setState({...this.#t,fetchStatus:"idle"}),r.abort()},onFail:(l,c)=>{this.#i({type:"failed",failureCount:l,error:c})},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 l=await this.#n.start();if(l===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(l),this.#r.config.onSuccess?.(l,this),this.#r.config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof nie){if(l.silent)return this.#n.promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw this.#i({type:"error",error:l}),this.#r.config.onError?.(l,this),this.#r.config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc()}}#i(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Hct(r.data,this.options),fetchMeta:e.meta??null};case"success":const n={...r,...RIe(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),Gi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function Hct(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Uct(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function RIe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function PIe(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var k9=class extends O1{constructor(e,t){super(),this.options=t,this.#e=e,this.#i=null,this.#o=rie(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#r=void 0;#s=void 0;#n;#a;#o;#i;#p;#d;#f;#c;#u;#l;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),MIe(this.#t,this.options)?this.#m():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return sie(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return sie(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,r=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Jf(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!dI(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const n=this.hasListeners();n&&DIe(this.#t,r,this.options,t)&&this.#m(),this.updateResult(),n&&(this.#t!==r||Jf(this.options.enabled,this.#t)!==Jf(t.enabled,this.#t)||ex(this.options.staleTime,this.#t)!==ex(t.staleTime,this.#t))&&this.#g();const s=this.#y();n&&(this.#t!==r||Jf(this.options.enabled,this.#t)!==Jf(t.enabled,this.#t)||s!==this.#l)&&this.#v(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(t,e);return zMr(this,r)&&(this.#s=r,this.#a=this.options,this.#n=this.#t.state),r}getCurrentResult(){return this.#s}trackResult(e,t){return new Proxy(e,{get:(r,n)=>(this.trackProp(n),t?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,n))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(uc)),t}#g(){this.#x();const e=ex(this.options.staleTime,this.#t);if(DS||this.#s.isStale||!Jae(e))return;const r=zct(this.#s.dataUpdatedAt,e)+1;this.#c=Nw.setTimeout(()=>{this.#s.isStale||this.updateResult()},r)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#w(),this.#l=e,!(DS||Jf(this.options.enabled,this.#t)===!1||!Jae(this.#l)||this.#l===0)&&(this.#u=Nw.setInterval(()=>{(this.options.refetchIntervalInBackground||Wpe.isFocused())&&this.#m()},this.#l))}#b(){this.#g(),this.#v(this.#y())}#x(){this.#c&&(Nw.clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(Nw.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const r=this.#t,n=this.options,s=this.#s,a=this.#n,i=this.#a,c=e!==r?e.state:this.#r,{state:u}=e;let d={...u},f=!1,h;if(t._optimisticResults){const j=this.hasListeners(),N=!j&&MIe(e,t),I=j&&DIe(e,r,t,n);(N||I)&&(d={...d,...Hct(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:m,status:g}=d;h=d.data;let y=!1;if(t.placeholderData!==void 0&&h===void 0&&g==="pending"){let j;s?.isPlaceholderData&&t.placeholderData===i?.placeholderData?(j=s.data,y=!0):j=typeof t.placeholderData=="function"?t.placeholderData(this.#f?.state.data,this.#f):t.placeholderData,j!==void 0&&(g="success",h=tie(s?.data,j,t),f=!0)}if(t.select&&h!==void 0&&!y)if(s&&h===a?.data&&t.select===this.#p)h=this.#d;else try{this.#p=t.select,h=t.select(h),h=tie(s?.data,h,t),this.#d=h,this.#i=null}catch(j){this.#i=j}this.#i&&(p=this.#i,h=this.#d,m=Date.now(),g="error");const x=d.fetchStatus==="fetching",w=g==="pending",S=g==="error",k=w&&x,_=h!==void 0,T={status:g,fetchStatus:d.fetchStatus,isPending:w,isSuccess:g==="success",isError:S,isInitialLoading:k,isLoading:k,data:h,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:x,isRefetching:x&&!w,isLoadingError:S&&!_,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:S&&_,isStale:Gpe(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Jf(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const j=T.data!==void 0,N=T.status==="error"&&!j,I=$=>{N?$.reject(T.error):j&&$.resolve(T.data)},P=()=>{const $=this.#o=T.promise=rie();I($)},R=this.#o;switch(R.status){case"pending":e.queryHash===r.queryHash&&I(R);break;case"fulfilled":(N||T.data!==R.value)&&P();break;case"rejected":(!N||T.error!==R.reason)&&P();break}}return T}updateResult(){const e=this.#s,t=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#a=this.options,this.#n.data!==void 0&&(this.#f=this.#t),dI(t,e))return;this.#s=t;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!this.#h.size)return!0;const a=new Set(s??this.#h);return this.options.throwOnError&&a.add("error"),Object.keys(this.#s).some(i=>{const l=i;return this.#s[l]!==e[l]&&a.has(l)})};this.#O({listeners:r()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#r=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#O(e){Gi.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function FMr(e,t){return Jf(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function MIe(e,t){return FMr(e,t)||e.state.data!==void 0&&sie(e,t,t.refetchOnMount)}function sie(e,t,r){if(Jf(t.enabled,e)!==!1&&ex(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Gpe(e,t)}return!1}function DIe(e,t,r,n){return(e!==t||Jf(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Gpe(e,r)}function Gpe(e,t){return Jf(t.enabled,e)!==!1&&e.isStaleByTime(ex(t.staleTime,e))}function zMr(e,t){return!dI(e.getCurrentResult(),t)}function _4(e){return{onFetch:(t,r)=>{const n=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],i=t.state.data?.pageParams||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let d=!1;const f=m=>{IMr(m,()=>t.signal,()=>d=!0)},h=Bct(t.options,t.fetchOptions),p=async(m,g,y)=>{if(d)return Promise.reject();if(g==null&&m.pages.length)return Promise.resolve(m);const w=(()=>{const E={client:t.client,queryKey:t.queryKey,pageParam:g,direction:y?"backward":"forward",meta:t.options.meta};return f(E),E})(),S=await h(w),{maxPages:k}=t.options,_=y?AMr:NMr;return{pages:_(m.pages,S,k),pageParams:_(m.pageParams,g,k)}};if(s&&a.length){const m=s==="backward",g=m?Qct:aie,y={pages:a,pageParams:i},x=g(n,y);l=await p(y,x,m)}else{const m=e??a.length;do{const g=c===0?i[0]??n.initialPageParam:aie(n,l);if(c>0&&g==null)break;l=await p(l,g),c++}while(c<m)}return l};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function aie(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Qct(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}function BMr(e,t){return t?aie(e,t)!=null:!1}function UMr(e,t){return!t||!e.getPreviousPageParam?!1:Qct(e,t)!=null}var VMr=class extends k9{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:_4()})}getOptimisticResult(e){return e.behavior=_4(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:r}=e,n=super.createResult(e,t),{isFetching:s,isRefetching:a,isError:i,isRefetchError:l}=n,c=r.fetchMeta?.fetchMore?.direction,u=i&&c==="forward",d=s&&c==="forward",f=i&&c==="backward",h=s&&c==="backward";return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:BMr(t,r.data),hasPreviousPage:UMr(t,r.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:h,isRefetchError:l&&!u&&!f,isRefetching:a&&!d&&!h}}},qMr=class extends qct{#e;#t;#r;#s;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||Wct(),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.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#r.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#n({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#s=Vct({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(a,i)=>{this.#n({type:"failed",failureCount:a,error:i})},onPause:()=>{this.#n({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});const n=this.state.status==="pending",s=!this.#s.canStart();try{if(n)t();else{this.#n({type:"pending",variables:e,isPaused:s}),this.#r.config.onMutate&&await this.#r.config.onMutate(e,this,r);const i=await this.options.onMutate?.(e,r);i!==this.state.context&&this.#n({type:"pending",context:i,variables:e,isPaused:s})}const a=await this.#s.start();return await this.#r.config.onSuccess?.(a,e,this.state.context,this,r),await this.options.onSuccess?.(a,e,this.state.context,r),await this.#r.config.onSettled?.(a,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(a,null,e,this.state.context,r),this.#n({type:"success",data:a}),a}catch(a){try{await this.#r.config.onError?.(a,e,this.state.context,this,r)}catch(i){Promise.reject(i)}try{await this.options.onError?.(a,e,this.state.context,r)}catch(i){Promise.reject(i)}try{await this.#r.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,r)}catch(i){Promise.reject(i)}try{await this.options.onSettled?.(void 0,a,e,this.state.context,r)}catch(i){Promise.reject(i)}throw this.#n({type:"error",error:a}),a}finally{this.#r.runNext(this)}}#n(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,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{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Gi.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function Wct(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var HMr=class extends O1{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#r=0}#e;#t;#r;build(e,t,r){const n=new qMr({client:e,mutationCache:this,mutationId:++this.#r,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#e.add(e);const t=WD(e);if(typeof t=="string"){const r=this.#t.get(t);r?r.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=WD(e);if(typeof t=="string"){const r=this.#t.get(t);if(r)if(r.length>1){const n=r.indexOf(e);n!==-1&&r.splice(n,1)}else r[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=WD(e);if(typeof t=="string"){const n=this.#t.get(t)?.find(s=>s.state.status==="pending");return!n||n===e}else return!0}runNext(e){const t=WD(e);return typeof t=="string"?this.#t.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Gi.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(r=>NIe(t,r))}findAll(e={}){return this.getAll().filter(t=>NIe(e,t))}notify(e){Gi.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Gi.batch(()=>Promise.all(e.map(t=>t.continue().catch(uc))))}};function WD(e){return e.options.scope?.id}var QMr=class extends O1{#e;#t=void 0;#r;#s;constructor(t,r){super(),this.#e=t,this.setOptions(r),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const r=this.options;this.options=this.#e.defaultMutationOptions(t),dI(this.options,r)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),r?.mutationKey&&this.options.mutationKey&&LS(r.mutationKey)!==LS(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(t){this.#n(),this.#a(t)}getCurrentResult(){return this.#t}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#n(),this.#a()}mutate(t,r){return this.#s=r,this.#r?.removeObserver(this),this.#r=this.#e.getMutationCache().build(this.#e,this.options),this.#r.addObserver(this),this.#r.execute(t)}#n(){const t=this.#r?.state??Wct();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#a(t){Gi.batch(()=>{if(this.#s&&this.hasListeners()){const r=this.#t.variables,n=this.#t.context,s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#s.onSuccess?.(t.data,r,n,s)}catch(a){Promise.reject(a)}try{this.#s.onSettled?.(t.data,null,r,n,s)}catch(a){Promise.reject(a)}}else if(t?.type==="error"){try{this.#s.onError?.(t.error,r,n,s)}catch(a){Promise.reject(a)}try{this.#s.onSettled?.(void 0,t.error,r,n,s)}catch(a){Promise.reject(a)}}}this.listeners.forEach(r=>{r(this.#t)})})}};function LIe(e,t){const r=new Set(t);return e.filter(n=>!r.has(n))}function WMr(e,t,r){const n=e.slice(0);return n[t]=r,n}var GMr=class extends O1{#e;#t;#r;#s;#n;#a;#o;#i;#p;#d=[];constructor(e,t,r){super(),this.#e=e,this.#s=r,this.#r=[],this.#n=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#n.forEach(e=>{e.subscribe(t=>{this.#l(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#n.forEach(e=>{e.destroy()})}setQueries(e,t){this.#r=e,this.#s=t,Gi.batch(()=>{const r=this.#n,n=this.#u(this.#r);n.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const s=n.map(d=>d.observer),a=s.map(d=>d.getCurrentResult()),i=r.length!==s.length,l=s.some((d,f)=>d!==r[f]),c=i||l,u=c?!0:a.some((d,f)=>{const h=this.#t[f];return!h||!dI(d,h)});!c&&!u||(c&&(this.#d=n,this.#n=s),this.#t=a,this.hasListeners()&&(c&&(LIe(r,s).forEach(d=>{d.destroy()}),LIe(s,r).forEach(d=>{d.subscribe(f=>{this.#l(d,f)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#n.map(e=>e.getCurrentQuery())}getObservers(){return this.#n}getOptimisticResult(e,t){const r=this.#u(e),n=r.map(a=>a.observer.getOptimisticResult(a.defaultedQueryOptions)),s=r.map(a=>a.defaultedQueryOptions.queryHash);return[n,a=>this.#c(a??n,t,s),()=>this.#f(n,r)]}#f(e,t){return t.map((r,n)=>{const s=e[n];return r.defaultedQueryOptions.notifyOnChangeProps?s:r.observer.trackResult(s,a=>{t.forEach(i=>{i.observer.trackProp(a)})})})}#c(e,t,r){if(t){const n=this.#p,s=r!==void 0&&n!==void 0&&(n.length!==r.length||r.some((a,i)=>a!==n[i]));return(!this.#a||this.#t!==this.#i||s||t!==this.#o)&&(this.#o=t,this.#i=this.#t,r!==void 0&&(this.#p=r),this.#a=qpe(this.#a,t(e))),this.#a}return e}#u(e){const t=new Map;this.#n.forEach(n=>{const s=n.options.queryHash;if(!s)return;const a=t.get(s);a?a.push(n):t.set(s,[n])});const r=[];return e.forEach(n=>{const s=this.#e.defaultQueryOptions(n),i=t.get(s.queryHash)?.shift()??new k9(this.#e,s);r.push({defaultedQueryOptions:s,observer:i})}),r}#l(e,t){const r=this.#n.indexOf(e);r!==-1&&(this.#t=WMr(this.#t,r,t),this.#h())}#h(){if(this.hasListeners()){const e=this.#a,t=this.#f(this.#t,this.#d),r=this.#c(t,this.#s?.combine);e!==r&&Gi.batch(()=>{this.listeners.forEach(n=>{n(this.#t)})})}}},ZMr=class extends O1{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){const n=t.queryKey,s=t.queryHash??Vpe(n,t);let a=this.get(s);return a||(a=new $Mr({client:e,queryKey:n,queryHash:s,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(a)),a}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(){Gi.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(r=>TIe(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>TIe(e,r)):t}notify(e){Gi.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Gi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Gi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},YMr=class{#e;#t;#r;#s;#n;#a;#o;#i;constructor(e={}){this.#e=e.queryCache||new ZMr,this.#t=e.mutationCache||new HMr,this.#r=e.defaultOptions||{},this.#s=new Map,this.#n=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Wpe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=k4.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#i?.(),this.#i=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),r=this.#e.build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(ex(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),a=this.#e.get(n.queryHash)?.state.data,i=EMr(t,a);if(i!==void 0)return this.#e.build(this,n).setData(i,{...r,manual:!0})}setQueriesData(e,t,r){return Gi.batch(()=>this.#e.findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;Gi.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#e;return Gi.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=Gi.batch(()=>this.#e.findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(uc).catch(uc)}invalidateQueries(e,t={}){return Gi.batch(()=>(this.#e.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=Gi.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,r);return r.throwOnError||(a=a.catch(uc)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(uc)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#e.build(this,t);return r.isStaleByTime(ex(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(uc).catch(uc)}fetchInfiniteQuery(e){return e.behavior=_4(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(uc).catch(uc)}ensureInfiniteQueryData(e){return e.behavior=_4(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return k4.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#r}setDefaultOptions(e){this.#r=e}setQueryDefaults(e,t){this.#s.set(LS(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#s.values()],r={};return t.forEach(n=>{uI(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#n.set(LS(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#n.values()],r={};return t.forEach(n=>{uI(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#r.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Vpe(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===Hpe&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#r.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Gct=b.createContext(void 0),ba=e=>{const t=b.useContext(Gct);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},XMr=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(Gct.Provider,{value:e,children:t})),Zct=b.createContext(!1),Yct=()=>b.useContext(Zct);Zct.Provider;function KMr(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var JMr=b.createContext(KMr()),Xct=()=>b.useContext(JMr),Kct=(e,t,r)=>{const n=r?.state.error&&typeof e.throwOnError=="function"?Qpe(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Jct=e=>{b.useEffect(()=>{e.clearReset()},[e])},eut=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Qpe(r,[e.error,n])),tut=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},e2r=(e,t)=>e.isLoading&&e.isFetching&&!t,iie=(e,t)=>e?.suspense&&t.isPending,oie=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function t2r({queries:e,...t},r){const n=ba(),s=Yct(),a=Xct(),i=b.useMemo(()=>e.map(g=>{const y=n.defaultQueryOptions(g);return y._optimisticResults=s?"isRestoring":"optimistic",y}),[e,n,s]);i.forEach(g=>{tut(g);const y=n.getQueryCache().get(g.queryHash);Kct(g,a,y)}),Jct(a);const[l]=b.useState(()=>new GMr(n,i,t)),[c,u,d]=l.getOptimisticResult(i,t.combine),f=!s&&t.subscribed!==!1;b.useSyncExternalStore(b.useCallback(g=>f?l.subscribe(Gi.batchCalls(g)):uc,[l,f]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),b.useEffect(()=>{l.setQueries(i,t)},[i,t,l]);const p=c.some((g,y)=>iie(i[y],g))?c.flatMap((g,y)=>{const x=i[y];if(x&&iie(x,g)){const w=new k9(n,x);return oie(x,w,a)}return[]}):[];if(p.length>0)throw Promise.all(p);const m=c.find((g,y)=>{const x=i[y];return x&&eut({result:g,errorResetBoundary:a,throwOnError:x.throwOnError,query:n.getQueryCache().get(x.queryHash),suspense:x.suspense})});if(m?.error)throw m.error;return u(d())}function rut(e,t,r){const n=Yct(),s=Xct(),a=ba(),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i);const l=a.getQueryCache().get(i.queryHash);i._optimisticResults=n?"isRestoring":"optimistic",tut(i),Kct(i,s,l),Jct(s);const c=!a.getQueryCache().get(i.queryHash),[u]=b.useState(()=>new t(a,i)),d=u.getOptimisticResult(i),f=!n&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(h=>{const p=f?u.subscribe(Gi.batchCalls(h)):uc;return u.updateResult(),p},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),b.useEffect(()=>{u.setOptions(i)},[i,u]),iie(i,d))throw oie(i,u,s);if(eut({result:d,errorResetBoundary:s,throwOnError:i.throwOnError,query:l,suspense:i.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,d),i.experimental_prefetchInRender&&!DS&&e2r(d,n)&&(c?oie(i,u,s):l?.promise)?.catch(uc).finally(()=>{u.updateResult()}),i.notifyOnChangeProps?d:u.trackResult(d)}function kt(e,t){return rut(e,k9)}function Kr(e,t){const r=ba(),[n]=b.useState(()=>new QMr(r,e));b.useEffect(()=>{n.setOptions(e)},[n,e]);const s=b.useSyncExternalStore(b.useCallback(i=>n.subscribe(Gi.batchCalls(i)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=b.useCallback((i,l)=>{n.mutate(i,l).catch(uc)},[n]);if(s.error&&Qpe(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}function o0(e,t){return rut(e,VMr)}var Do=(e=>(e.AGENT="agent",e.SCORER="scorer",e.RAG_INGESTION="rag_ingestion",e.TRAJECTORY="trajectory",e.INPUT_PROCESSOR="input_processor",e.INPUT_STEP_PROCESSOR="input_step_processor",e.OUTPUT_PROCESSOR="output_processor",e.OUTPUT_STEP_PROCESSOR="output_step_processor",e.WORKFLOW_STEP="workflow_step",e.TOOL="tool",e.WORKFLOW_RUN="workflow_run",e.MEMORY="memory",e))(Do||{});n1().describe("Database record creation time");var r2r=n1().describe("Database record last update time");r2r.nullable();var _9=_e({page:Xwe().int().min(0).optional().default(0).describe("Zero-indexed page number"),perPage:Xwe().int().min(1).max(100).optional().default(10).describe("Number of items per page")}).describe("Pagination options for list queries"),E9=_e({total:St().describe("Total number of items available"),page:St().describe("Current page"),perPage:Hr([St(),zt(!1)]).describe("Number of items per page, or false if pagination is disabled"),hasMore:yo().describe("True if more pages are available")}),n2r=_e({start:Kwe().optional().describe("Start of date range (inclusive by default)"),end:Kwe().optional().describe("End of date range (inclusive by default)"),startExclusive:yo().optional().describe("When true, excludes the start date from results (uses > instead of >=)"),endExclusive:yo().optional().describe("When true, excludes the end date from results (uses < instead of <=)")}).describe("Date range filter for timestamps"),C9=So(["ASC","DESC"]).describe("Sort direction: 'ASC' | 'DESC'"),kg=So(["sum","avg","min","max","count","last"]).describe("Aggregation function"),k1=So(["1m","5m","15m","1h","1d"]).describe("Time bucket interval"),Zpe=So(["previous_period","previous_day","previous_week"]).describe("Comparison period for aggregate queries"),_1=Et(de()).min(1).describe("Fields to group by"),Ype=Et(St().min(0).max(1)).min(1).describe("Percentile values (0-1)"),Xpe={value:St().nullable().describe("Aggregated value"),previousValue:St().nullable().optional().describe("Value from comparison period"),changePercent:St().nullable().optional().describe("Percentage change from comparison period")},Kpe=Qs(de(),de().nullable()).describe("Dimension values for this group"),cC=St().describe("Aggregated value"),uC=n1().describe("Bucket timestamp"),Jpe=St().describe("Percentile value"),eme=St().describe("Percentile value at this bucket"),dC=Gle(Do).describe("Entity type (e.g., 'agent' | 'processor' | 'tool' | 'workflow')"),s2r=de().describe('ID of the entity (e.g., "weatherAgent", "orderWorkflow")'),nut=de().describe("Name of the entity"),sut=de().describe("Human end-user who triggered execution"),aut=de().describe("Multi-tenant organization/account"),iut=de().describe("Broader resource context (Mastra memory compatibility)"),out=de().describe("Unique execution run identifier"),lut=de().describe("Session identifier for grouping traces"),cut=de().describe("Conversation thread identifier"),uut=de().describe("HTTP request ID for log correlation"),dut=de().describe('Environment (e.g., "production" | "staging" | "development")'),a2r=de().describe('Source of execution (e.g., "local" | "cloud" | "ci")'),fut=de().describe('Source of execution (e.g., "local" | "cloud" | "ci")'),hut=de().describe("Name of the service"),put=Gle(Do).describe("Entity type of the parent entity"),i2r=de().describe("ID of the parent entity"),mut=de().describe("Name of the parent entity"),gut=Gle(Do).describe("Entity type of the root entity"),o2r=de().describe("ID of the root entity"),yut=de().describe("Name of the root entity"),vut=de().describe("Version ID of the entity that produced this signal (e.g., agent version, workflow version)"),but=de().describe("Version ID of the parent entity that produced this signal"),xut=de().describe("Version ID of the root entity that produced this signal"),j9=de().describe("Experiment or eval run identifier"),l2r=Qs(de(),Na()).describe('Arbitrary package/app version info (e.g., {"core": "1.0.0", "memory": "1.0.0", "gitSha": "abcd1234"})'),wut=Qs(de(),Na()).describe("User-defined metadata for custom filtering"),Sut=Et(de()).describe("Labels for filtering"),c2r={entityType:dC.nullish(),entityId:s2r.nullish(),entityName:nut.nullish(),parentEntityType:put.nullish(),parentEntityId:i2r.nullish(),parentEntityName:mut.nullish(),rootEntityType:gut.nullish(),rootEntityId:o2r.nullish(),rootEntityName:yut.nullish(),userId:sut.nullish(),organizationId:aut.nullish(),resourceId:iut.nullish(),runId:out.nullish(),sessionId:lut.nullish(),threadId:cut.nullish(),requestId:uut.nullish(),environment:dut.nullish(),serviceName:hut.nullish(),scope:l2r.nullish(),entityVersionId:vut.nullish(),parentEntityVersionId:but.nullish(),rootEntityVersionId:xut.nullish(),experimentId:j9.nullish()},T9={...c2r,executionSource:fut.nullish(),tags:Sut.nullish()};a2r.nullish();var N9={timestamp:n2r.optional().describe("Filter by timestamp range"),traceId:de().optional().describe("Filter by trace ID"),spanId:de().optional().describe("Filter by span ID"),entityType:dC.optional(),entityName:nut.optional(),entityVersionId:vut.optional(),parentEntityVersionId:but.optional(),rootEntityVersionId:xut.optional(),userId:sut.optional(),organizationId:aut.optional(),experimentId:j9.optional(),serviceName:hut.optional(),environment:dut.optional(),parentEntityType:put.optional(),parentEntityName:mut.optional(),rootEntityType:gut.optional(),rootEntityName:yut.optional(),resourceId:iut.optional(),runId:out.optional(),sessionId:lut.optional(),threadId:cut.optional(),requestId:uut.optional(),executionSource:fut.optional(),tags:Et(de()).optional().describe("Filter by tags (must have all specified tags)")},A9=de().describe("Unique trace identifier"),I9=de().describe("Unique span identifier within a trace"),E4=So(["debug","info","warn","error","fatal"]),Out=de().describe("Log message"),kut=Qs(de(),Na()).describe("Structured data attached to the log"),_ut=_e({logId:de().nullish().describe("Unique id for this log event"),timestamp:n1().describe("When the log was created"),level:E4.describe("Log severity level"),message:Out,data:kut.nullish(),traceId:A9.nullish(),spanId:I9.nullish(),...T9,source:de().nullish().describe("Execution source"),metadata:wut.nullish()}).describe("Log record as stored in the database");_e({level:E4,message:Out,data:kut.optional(),tags:Sut.optional()}).describe("User-provided log input");var u2r=_ut;_e({logs:Et(u2r)}).describe("Arguments for batch creating logs");var d2r=_e({...N9,source:de().optional().describe("Filter by execution source"),level:Hr([E4,Et(E4)]).optional().describe("Filter by log level(s)")}).describe("Filters for querying logs"),f2r=So(["timestamp"]).describe("Field to order by: 'timestamp'"),h2r=_e({field:f2r.default("timestamp").describe("Field to order by"),direction:C9.default("DESC").describe("Sort direction")}).describe("Order by configuration");_e({filters:d2r.optional().describe("Optional filters to apply"),pagination:_9.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:h2r.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing logs");_e({pagination:E9,logs:Et(_ut)});var fC=de().describe("Identifier of the scorer (e.g., relevance, accuracy)"),Eut=de().describe("Display name of the scorer"),Cut=de().describe("Version of the scorer"),og=de().describe("How the score was produced (e.g., manual, automated, experiment)"),jut=St().describe("Score value (range defined by scorer)"),Tut=de().describe("Explanation for the score"),Nut=_e({scoreId:de().nullish().describe("Unique id for this score event"),timestamp:n1().describe("When the score was recorded"),traceId:A9.nullish().describe("Trace that anchors the scored target when available"),spanId:I9.nullish().describe("Span ID this score applies to"),scorerId:fC,scorerName:Eut.nullish(),scorerVersion:Cut.nullish(),scoreSource:og.nullish(),source:og.nullish(),score:jut,reason:Tut.nullish(),...T9,scoreTraceId:de().nullish().describe("Trace ID of the scoring run for debugging score generation"),metadata:Qs(de(),Na()).nullish().describe("User-defined metadata")}).describe("Score record as stored in the database");_e({scorerId:fC,scorerName:Eut.optional(),scorerVersion:Cut.optional(),scoreSource:og.optional(),source:og.optional(),score:jut,reason:Tut.optional(),metadata:Qs(de(),Na()).optional().describe("Additional scorer-specific metadata"),experimentId:j9.optional(),scoreTraceId:de().optional().describe("Trace ID of the scoring run for debugging score generation"),targetEntityType:dC.optional().describe("Entity type the scorer evaluated when known")}).describe("User-provided score input");var tme=Nut;_e({score:tme}).describe("Arguments for creating a score");_e({score:tme.omit({timestamp:!0})}).describe("Arguments for creating a score");_e({success:yo()}).describe("Response from creating a score");_e({scores:Et(tme)}).describe("Arguments for batch recording scores");var TP=_e({...N9,scorerId:Hr([de(),Et(de())]).optional().describe("Filter by scorer ID(s)"),scoreSource:og.optional().describe("Filter by how the score was produced"),source:og.optional().describe("Filter by how the score was produced")}).describe("Filters for querying scores"),p2r=So(["timestamp","score"]).describe("Field to order by: 'timestamp' | 'score'"),m2r=_e({field:p2r.default("timestamp").describe("Field to order by"),direction:C9.default("DESC").describe("Sort direction")}).describe("Order by configuration");_e({filters:TP.optional(),pagination:_9.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:m2r.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing scores");_e({pagination:E9,scores:Et(Nut)});_e({scorerId:fC,scoreSource:og.optional(),aggregation:kg,filters:TP.optional(),comparePeriod:Zpe.optional()}).describe("Arguments for getting a score aggregate");_e(Xpe);_e({scorerId:fC,scoreSource:og.optional(),groupBy:_1,aggregation:kg,filters:TP.optional()}).describe("Arguments for getting a score breakdown");_e({groups:Et(_e({dimensions:Kpe,value:cC}))});_e({scorerId:fC,scoreSource:og.optional(),interval:k1,aggregation:kg,filters:TP.optional(),groupBy:_1.optional()}).describe("Arguments for getting score time series");_e({series:Et(_e({name:de().describe("Series name (scorer ID or group key)"),points:Et(_e({timestamp:uC,value:cC}))}))});_e({scorerId:fC,scoreSource:og.optional(),percentiles:Ype,interval:k1,filters:TP.optional()}).describe("Arguments for getting score percentiles");_e({series:Et(_e({percentile:Jpe,points:Et(_e({timestamp:uC,value:eme}))}))});var lg=de().describe("Source of feedback (e.g., 'user', 'system', 'manual')"),hC=de().describe("Type of feedback (e.g., 'thumbs', 'rating', 'correction')"),Aut=Hr([St(),de()]).describe("Feedback value (rating number or correction text)"),Iut=de().describe("Additional comment or context"),C4=de().describe("User who provided the feedback");function rme(e){if(!e||typeof e!="object"||Array.isArray(e))return e;const t={...e};return typeof t.userId=="string"&&t.feedbackUserId==null&&(t.feedbackUserId=t.userId,delete t.userId),t}var R9=_e({feedbackId:de().nullish().describe("Unique id for this feedback event"),timestamp:n1().describe("When the feedback was recorded"),traceId:A9.nullish().describe("Trace that anchors the feedback target when available"),spanId:I9.nullish().describe("Span ID this feedback applies to"),feedbackSource:lg.nullish(),source:lg.nullish(),feedbackType:hC,value:Aut,comment:Iut.nullish(),feedbackUserId:C4.nullish(),...T9,sourceId:de().nullish().describe("ID of the source record this feedback is linked to (e.g. experiment result ID)"),metadata:Qs(de(),Na()).nullish().describe("User-defined metadata")}),g2r=_e(R9.shape).describe("Feedback record as stored in the database"),y2r=_e({feedbackSource:lg.optional(),source:lg.optional(),feedbackType:hC,value:Aut,comment:Iut.optional(),feedbackUserId:C4.optional(),userId:C4.optional(),metadata:Qs(de(),Na()).optional().describe("Additional feedback-specific metadata"),experimentId:j9.optional(),sourceId:de().optional().describe("ID of the source record this feedback is linked to")});_e(y2r.shape).describe("User-provided feedback input");_e({feedback:Kle(rme,R9)}).describe("Arguments for creating feedback");_e({feedback:R9.omit({timestamp:!0})}).describe("Arguments for creating feedback");_e({success:yo()}).describe("Response from creating feedback");_e({feedbacks:Et(Kle(rme,R9))}).describe("Arguments for batch recording feedback");var Rut=_e({...N9,feedbackType:Hr([de(),Et(de())]).optional().describe("Filter by feedback type(s)"),feedbackSource:lg.optional(),source:lg.optional(),feedbackUserId:C4.optional()}),P9=_e(Rut.shape).describe("Filters for querying feedback"),v2r=So(["timestamp"]).describe("Field to order by: 'timestamp'"),b2r=_e({field:v2r.default("timestamp").describe("Field to order by"),direction:C9.default("DESC").describe("Sort direction")}).describe("Order by configuration");_e({filters:Kle(rme,Rut).optional().describe("Optional filters to apply"),pagination:_9.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:b2r.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing feedback");_e({pagination:E9,feedback:Et(g2r)});_e({feedbackType:hC,feedbackSource:lg.optional(),aggregation:kg,filters:P9.optional(),comparePeriod:Zpe.optional()}).describe("Arguments for getting a feedback aggregate over numeric values");_e(Xpe);_e({feedbackType:hC,feedbackSource:lg.optional(),groupBy:_1,aggregation:kg,filters:P9.optional()}).describe("Arguments for getting a feedback breakdown over numeric values");_e({groups:Et(_e({dimensions:Kpe,value:cC}))});_e({feedbackType:hC,feedbackSource:lg.optional(),interval:k1,aggregation:kg,filters:P9.optional(),groupBy:_1.optional()}).describe("Arguments for getting feedback time series over numeric values");_e({series:Et(_e({name:de().describe("Series name (feedback type or group key)"),points:Et(_e({timestamp:uC,value:cC}))}))});_e({feedbackType:hC,feedbackSource:lg.optional(),percentiles:Ype,interval:k1,filters:P9.optional()}).describe("Arguments for getting feedback percentiles over numeric values");_e({series:Et(_e({percentile:Jpe,points:Et(_e({timestamp:uC,value:eme}))}))});So(["counter","gauge","histogram"]);var Put=de().describe("Metric name (e.g., mastra_agent_duration_ms)"),Mut=St().describe("Metric value"),Dut=Qs(de(),de()).describe("Metric labels for dimensional filtering"),Lut=de().describe("Model provider"),$ut=de().describe("Model"),x2r=St().describe("Estimated cost"),Fut=de().describe("Unit for the estimated cost (e.g., usd)"),w2r=Qs(de(),Na()).nullish().describe("Structured costing metadata"),zut=_e({metricId:de().nullish().describe("Unique id for this metric event"),timestamp:n1().describe("When the metric was recorded"),name:Put,value:Mut,traceId:A9.nullish(),spanId:I9.nullish(),...T9,source:de().nullish().describe("Execution source"),provider:Lut.nullish(),model:$ut.nullish(),estimatedCost:x2r.nullish(),costUnit:Fut.nullish(),costMetadata:w2r.nullish(),labels:Dut.default({}),metadata:wut.nullish()}).describe("Metric record as stored in the database");_e({name:Put,value:Mut,labels:Dut.optional()}).describe("User-provided metric input");var S2r=zut;_e({metrics:Et(S2r)}).describe("Arguments for batch recording metrics");_e({type:kg,interval:k1.optional(),groupBy:_1.optional()}).describe("Metrics aggregation configuration");var NP=_e({...N9,name:Et(de()).nonempty().optional().describe("Filter by metric name(s)"),source:de().optional().describe("Filter by execution source"),provider:Lut.optional(),model:$ut.optional(),costUnit:Fut.optional(),labels:Qs(de(),de()).optional().describe("Exact match on label key-value pairs")}).describe("Filters for querying metrics"),O2r=So(["timestamp"]).describe("Field to order by: 'timestamp'"),k2r=_e({field:O2r.default("timestamp").describe("Field to order by"),direction:C9.default("DESC").describe("Sort direction")}).describe("Order by configuration");_e({filters:NP.optional(),pagination:_9.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:k2r.default({field:"timestamp",direction:"DESC"}).describe("Ordering configuration (defaults to timestamp desc)")}).describe("Arguments for listing metrics");_e({pagination:E9,metrics:Et(zut)});_e({name:Et(de()).nonempty().describe("Metric name(s) to aggregate"),aggregation:kg,filters:NP.optional(),comparePeriod:Zpe.optional()}).describe("Arguments for getting a metric aggregate");_e({...Xpe,estimatedCost:St().nullable().optional().describe("Aggregated estimated cost from the same filtered row set"),costUnit:de().nullable().optional().describe("Shared cost unit for the aggregated rows, or null when mixed/unknown"),previousEstimatedCost:St().nullable().optional().describe("Aggregated estimated cost from the comparison period"),costChangePercent:St().nullable().optional().describe("Percentage change in estimated cost from comparison period")});_e({name:Et(de()).nonempty().describe("Metric name(s) to break down"),groupBy:_1,aggregation:kg,filters:NP.optional()}).describe("Arguments for getting a metric breakdown");_e({groups:Et(_e({dimensions:Kpe,value:cC,estimatedCost:St().nullable().optional().describe("Summed estimated cost for this group"),costUnit:de().nullable().optional().describe("Shared cost unit for this group, or null when mixed/unknown")}))});_e({name:Et(de()).nonempty().describe("Metric name(s)"),interval:k1,aggregation:kg,filters:NP.optional(),groupBy:_1.optional()}).describe("Arguments for getting metric time series");_e({series:Et(_e({name:de().describe("Series name (metric name or group key)"),costUnit:de().nullable().optional().describe("Shared cost unit for this series, or null when mixed/unknown"),points:Et(_e({timestamp:uC,value:cC,estimatedCost:St().nullable().optional().describe("Summed estimated cost in this bucket")}))}))});_e({name:de().describe("Metric name"),percentiles:Ype,interval:k1,filters:NP.optional()}).describe("Arguments for getting metric percentiles");_e({series:Et(_e({percentile:Jpe,points:Et(_e({timestamp:uC,value:eme}))}))});_e({prefix:de().optional().describe("Filter metric names by prefix"),limit:St().int().min(1).optional().describe("Maximum number of names to return")}).describe("Arguments for getting metric names");_e({names:Et(de()).describe("Distinct metric names")});_e({metricName:de().describe("Metric name to get label keys for")}).describe("Arguments for getting metric label keys");_e({keys:Et(de()).describe("Distinct label keys for the metric")});_e({metricName:de().describe("Metric name"),labelKey:de().describe("Label key to get values for"),prefix:de().optional().describe("Filter values by prefix"),limit:St().int().min(1).optional().describe("Maximum number of values to return")}).describe("Arguments for getting label values");_e({values:Et(de()).describe("Distinct label values")});_e({}).describe("Arguments for getting entity types");_e({entityTypes:Et(dC).describe("Distinct entity types")});_e({entityType:dC.optional().describe("Optional entity type filter")}).describe("Arguments for getting entity names");_e({names:Et(de()).describe("Distinct entity names")});_e({}).describe("Arguments for getting service names");_e({serviceNames:Et(de()).describe("Distinct service names")});_e({}).describe("Arguments for getting environments");_e({environments:Et(de()).describe("Distinct environments")});_e({entityType:dC.optional().describe("Optional entity type filter")}).describe("Arguments for getting tags");_e({tags:Et(de()).describe("Distinct tags")});const Ql={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},AP="focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",_2r="focus-within:outline-hidden focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",E2r="rounded-md",nme="bg-surface2 border-2 border-border1 text-neutral5 hover:text-neutral6 hover:border-border2 rounded-lg",sme="outline-hidden focus-visible:outline-hidden focus-visible:border-accent1 focus-visible:ring-1 focus-visible:ring-accent1/40",ame="disabled:opacity-50 disabled:cursor-not-allowed";function But(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=But(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Uut(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=But(e))&&(n&&(n+=" "),n+=t);return n}const C2r=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},j2r=(e,t)=>({classGroupId:e,validator:t}),Vut=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),j4="-",$Ie=[],T2r="arbitrary..",N2r=e=>{const t=I2r(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return A2r(i);const l=i.split(j4),c=l[0]===""&&l.length>1?1:0;return qut(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=n[i],u=r[i];return c?u?C2r(u,c):c:u||$Ie}return r[i]||$Ie}}},qut=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],a=r.nextPart.get(s);if(a){const u=qut(e,t+1,a);if(u)return u}const i=r.validators;if(i===null)return;const l=t===0?e.join(j4):e.slice(t).join(j4),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},A2r=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?T2r+n:void 0})(),I2r=e=>{const{theme:t,classGroups:r}=e;return R2r(r,t)},R2r=(e,t)=>{const r=Vut();for(const n in e){const s=e[n];ime(s,r,n,t)}return r},ime=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];P2r(i,t,r,n)}},P2r=(e,t,r,n)=>{if(typeof e=="string"){M2r(e,t,r);return}if(typeof e=="function"){D2r(e,t,r,n);return}L2r(e,t,r,n)},M2r=(e,t,r)=>{const n=e===""?t:Hut(t,e);n.classGroupId=r},D2r=(e,t,r,n)=>{if($2r(e)){ime(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(j2r(r,e))},L2r=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[l,c]=s[i];ime(c,Hut(t,l),r,n)}},Hut=(e,t)=>{let r=e;const n=t.split(j4),s=n.length;for(let a=0;a<s;a++){const i=n[a];let l=r.nextPart.get(i);l||(l=Vut(),r.nextPart.set(i,l)),r=l}return r},$2r=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,F2r=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,i)=>{r[a]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let i=r[a];if(i!==void 0)return i;if((i=n[a])!==void 0)return s(a,i),i},set(a,i){a in r?r[a]=i:s(a,i)}}},lie="!",FIe=":",z2r=[],zIe=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),B2r=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let i=0,l=0,c=0,u;const d=s.length;for(let g=0;g<d;g++){const y=s[g];if(i===0&&l===0){if(y===FIe){a.push(s.slice(c,g)),c=g+1;continue}if(y==="/"){u=g;continue}}y==="["?i++:y==="]"?i--:y==="("?l++:y===")"&&l--}const f=a.length===0?s:s.slice(c);let h=f,p=!1;f.endsWith(lie)?(h=f.slice(0,-1),p=!0):f.startsWith(lie)&&(h=f.slice(1),p=!0);const m=u&&u>c?u-c:void 0;return zIe(a,p,h,m)};if(t){const s=t+FIe,a=n;n=i=>i.startsWith(s)?a(i.slice(s.length)):zIe(z2r,!1,i,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},U2r=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a<r.length;a++){const i=r[a],l=i[0]==="[",c=t.has(i);l||c?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(i)):s.push(i)}return s.length>0&&(s.sort(),n.push(...s)),n}},V2r=e=>({cache:F2r(e.cacheSize),parseClassName:B2r(e),sortModifiers:U2r(e),...N2r(e)}),q2r=/\s+/,H2r=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],l=e.trim().split(q2r);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=r(d);if(f){c=d+(c.length>0?" "+c:c);continue}let y=!!g,x=n(y?m.substring(0,g):m);if(!x){if(!y){c=d+(c.length>0?" "+c:c);continue}if(x=n(m),!x){c=d+(c.length>0?" "+c:c);continue}y=!1}const w=h.length===0?"":h.length===1?h[0]:a(h).join(":"),S=p?w+lie:w,k=S+x;if(i.indexOf(k)>-1)continue;i.push(k);const _=s(x,y);for(let E=0;E<_.length;++E){const T=_[E];i.push(S+T)}c=d+(c.length>0?" "+c:c)}return c},Q2r=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=Qut(r))&&(s&&(s+=" "),s+=n);return s},Qut=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Qut(e[n]))&&(r&&(r+=" "),r+=t);return r},BIe=(e,...t)=>{let r,n,s,a;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return r=V2r(u),n=r.cache.get,s=r.cache.set,a=l,l(c)},l=c=>{const u=n(c);if(u)return u;const d=H2r(c,r);return s(c,d),d};return a=i,(...c)=>a(Q2r(...c))},W2r=[],Go=e=>{const t=r=>r[e]||W2r;return t.isThemeGetter=!0,t},Wut=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Gut=/^\((?:(\w[\w-]*):)?(.+)\)$/i,G2r=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Z2r=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Y2r=/\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$/,X2r=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,K2r=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,J2r=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ob=e=>G2r.test(e),Vn=e=>!!e&&!Number.isNaN(Number(e)),lb=e=>!!e&&Number.isInteger(Number(e)),eQ=e=>e.endsWith("%")&&Vn(e.slice(0,-1)),ry=e=>Z2r.test(e),Zut=()=>!0,eDr=e=>Y2r.test(e)&&!X2r.test(e),ome=()=>!1,tDr=e=>K2r.test(e),rDr=e=>J2r.test(e),nDr=e=>!vr(e)&&!kr(e),sDr=e=>l0(e,Kut,ome),vr=e=>Wut.test(e),q0=e=>l0(e,Jut,eDr),UIe=e=>l0(e,fDr,Vn),aDr=e=>l0(e,tdt,Zut),iDr=e=>l0(e,edt,ome),VIe=e=>l0(e,Yut,ome),oDr=e=>l0(e,Xut,rDr),GD=e=>l0(e,rdt,tDr),kr=e=>Gut.test(e),oT=e=>E1(e,Jut),lDr=e=>E1(e,edt),qIe=e=>E1(e,Yut),cDr=e=>E1(e,Kut),uDr=e=>E1(e,Xut),ZD=e=>E1(e,rdt,!0),dDr=e=>E1(e,tdt,!0),l0=(e,t,r)=>{const n=Wut.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},E1=(e,t,r=!1)=>{const n=Gut.exec(e);return n?n[1]?t(n[1]):r:!1},Yut=e=>e==="position"||e==="percentage",Xut=e=>e==="image"||e==="url",Kut=e=>e==="length"||e==="size"||e==="bg-size",Jut=e=>e==="length",fDr=e=>e==="number",edt=e=>e==="family-name",tdt=e=>e==="number"||e==="weight",rdt=e=>e==="shadow",HIe=()=>{const e=Go("color"),t=Go("font"),r=Go("text"),n=Go("font-weight"),s=Go("tracking"),a=Go("leading"),i=Go("breakpoint"),l=Go("container"),c=Go("spacing"),u=Go("radius"),d=Go("shadow"),f=Go("inset-shadow"),h=Go("text-shadow"),p=Go("drop-shadow"),m=Go("blur"),g=Go("perspective"),y=Go("aspect"),x=Go("ease"),w=Go("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...k(),kr,vr],E=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],j=()=>[kr,vr,c],N=()=>[ob,"full","auto",...j()],I=()=>[lb,"none","subgrid",kr,vr],P=()=>["auto",{span:["full",lb,kr,vr]},lb,kr,vr],R=()=>[lb,"auto",kr,vr],$=()=>["auto","min","max","fr",kr,vr],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...j()],B=()=>[ob,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],H=()=>[ob,"screen","full","dvw","lvw","svw","min","max","fit",...j()],W=()=>[ob,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],L=()=>[e,kr,vr],Y=()=>[...k(),qIe,VIe,{position:[kr,vr]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",cDr,sDr,{size:[kr,vr]}],Q=()=>[eQ,oT,q0],G=()=>["","none","full",u,kr,vr],J=()=>["",Vn,oT,q0],ae=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[Vn,eQ,qIe,VIe],oe=()=>["","none",m,kr,vr],he=()=>["none",Vn,kr,vr],X=()=>["none",Vn,kr,vr],te=()=>[Vn,kr,vr],le=()=>[ob,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ry],breakpoint:[ry],color:[Zut],container:[ry],"drop-shadow":[ry],ease:["in","out","in-out"],font:[nDr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ry],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ry],shadow:[ry],spacing:["px",Vn],text:[ry],"text-shadow":[ry],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ob,vr,kr,y]}],container:["container"],columns:[{columns:[Vn,vr,kr,l]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[lb,"auto",kr,vr]}],basis:[{basis:[ob,"full","auto",l,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Vn,ob,"auto","initial","none",vr]}],grow:[{grow:["",Vn,kr,vr]}],shrink:[{shrink:["",Vn,kr,vr]}],order:[{order:[lb,"first","last","none",kr,vr]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":$()}],"auto-rows":[{"auto-rows":$()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[l,"screen",...B()]}],"min-w":[{"min-w":[l,"screen","none",...B()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",r,oT,q0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,dDr,aDr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",eQ,vr]}],"font-family":[{font:[lDr,iDr,t]}],"font-features":[{"font-features":[vr]}],"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:[s,kr,vr]}],"line-clamp":[{"line-clamp":[Vn,"none",kr,UIe]}],leading:[{leading:[a,...j()]}],"list-image":[{"list-image":["none",kr,vr]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",kr,vr]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[Vn,"from-font","auto",kr,q0]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[Vn,"auto",kr,vr]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",kr,vr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",kr,vr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},lb,kr,vr],radial:["",kr,vr],conic:[lb,kr,vr]},uDr,oDr]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Vn,kr,vr]}],"outline-w":[{outline:["",Vn,oT,q0]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",d,ZD,GD]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",f,ZD,GD]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[Vn,q0]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",h,ZD,GD]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[Vn,kr,vr]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Vn]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[kr,vr]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[Vn]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",kr,vr]}],filter:[{filter:["","none",kr,vr]}],blur:[{blur:oe()}],brightness:[{brightness:[Vn,kr,vr]}],contrast:[{contrast:[Vn,kr,vr]}],"drop-shadow":[{"drop-shadow":["","none",p,ZD,GD]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",Vn,kr,vr]}],"hue-rotate":[{"hue-rotate":[Vn,kr,vr]}],invert:[{invert:["",Vn,kr,vr]}],saturate:[{saturate:[Vn,kr,vr]}],sepia:[{sepia:["",Vn,kr,vr]}],"backdrop-filter":[{"backdrop-filter":["","none",kr,vr]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[Vn,kr,vr]}],"backdrop-contrast":[{"backdrop-contrast":[Vn,kr,vr]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Vn,kr,vr]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Vn,kr,vr]}],"backdrop-invert":[{"backdrop-invert":["",Vn,kr,vr]}],"backdrop-opacity":[{"backdrop-opacity":[Vn,kr,vr]}],"backdrop-saturate":[{"backdrop-saturate":[Vn,kr,vr]}],"backdrop-sepia":[{"backdrop-sepia":["",Vn,kr,vr]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",kr,vr]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Vn,"initial",kr,vr]}],ease:[{ease:["linear","initial",x,kr,vr]}],delay:[{delay:[Vn,kr,vr]}],animate:[{animate:["none",w,kr,vr]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,kr,vr]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:te()}],"skew-x":[{"skew-x":te()}],"skew-y":[{"skew-y":te()}],transform:[{transform:[kr,vr,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",kr,vr]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",kr,vr]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[Vn,oT,q0,UIe]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","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-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},hDr=(e,{cacheSize:t,prefix:r,experimentalParseClassName:n,extend:s={},override:a={}})=>(QT(e,"cacheSize",t),QT(e,"prefix",r),QT(e,"experimentalParseClassName",n),YD(e.theme,a.theme),YD(e.classGroups,a.classGroups),YD(e.conflictingClassGroups,a.conflictingClassGroups),YD(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),QT(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),XD(e.theme,s.theme),XD(e.classGroups,s.classGroups),XD(e.conflictingClassGroups,s.conflictingClassGroups),XD(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),ndt(e,s,"orderSensitiveModifiers"),e),QT=(e,t,r)=>{r!==void 0&&(e[t]=r)},YD=(e,t)=>{if(t)for(const r in t)QT(e,r,t[r])},XD=(e,t)=>{if(t)for(const r in t)ndt(e,t,r)},ndt=(e,t,r)=>{const n=t[r];n!==void 0&&(e[r]=e[r]?e[r].concat(n):n)},pDr=(e,...t)=>typeof e=="function"?BIe(HIe,e,...t):BIe(()=>hDr(HIe(),e),...t),mDr=Object.keys({...Lb,...d9t}),gDr=Object.keys(y9t),yDr=Object.keys(f9t),vDr=Object.keys(h9t),bDr=Object.keys(u9t),H0=Object.keys(g9t),xDr=Object.keys(p9t).concat(Object.keys(m9t)),wDr=pDr({extend:{theme:{color:mDr,spacing:gDr,radius:bDr,leading:vDr,shadow:xDr},classGroups:{"font-size":[{text:yDr}],h:[{h:H0}],w:[{w:H0}],size:[{size:H0}],"min-h":[{"min-h":H0}],"min-w":[{"min-w":H0}],"max-h":[{"max-h":H0}],"max-w":[{"max-w":H0}]}}});function Z(...e){return wDr(Uut(e))}const SDr={sm:`${Ql.sm} text-ui-sm px-[.75em]`,md:`${Ql.md} text-ui-md px-[.75em]`,default:`${Ql.default} text-ui-md px-[.85em] `,lg:`${Ql.lg} text-ui-lg px-[1em] `},ODr={default:"bg-surface3 border-2 border-border1 hover:text-neutral6 hover:bg-surface4 active:bg-surface5 text-neutral5",primary:"bg-surface4 border-2 border-border2 hover:text-neutral6 hover:bg-surface5 active:bg-surface6 text-neutral6",cta:"bg-accent1/50 hover:bg-accent1/80 text-neutral5 font-semibold",ghost:"bg-transparent border-2 border-transparent hover:text-neutral6 hover:bg-surface4 active:bg-surface5 text-neutral4",inputLike:nme,light:"",outline:"",link:"inline-flex justify-start rounded-none h-auto px-0 bg-transparent text-neutral3 hover:text-neutral4 gap-1 [&>svg]:mx-0 w-auto [&>svg]:opacity-70"},kDr=Z("flex items-center justify-center gap-[.75em] leading-0 transition-colors duration-200 ease-out-custom rounded-lg","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mx-[-.3em]","[&>svg]:opacity-50 [&:hover>svg]:opacity-100",ame,sme),_Dr={light:"default",outline:"default"};function EDr(e){return _Dr[e]??e}function pC(e){const t=EDr(e?.variant||"default"),r=e?.size||"default";return Z(kDr,SDr[r],ODr[t],e?.iconOnly&&"[&>svg]:opacity-75")}function sdt(e){const t=[];return je.Children.forEach(e,r=>{je.isValidElement(r)&&r.type===je.Fragment?t.push(...sdt(r.props.children)):t.push(r)}),t}function CDr(e){const t=sdt(e);return t.length>0&&t.every(r=>je.isValidElement(r))}const pe=je.forwardRef(({className:e,as:t,size:r="default",variant:n="default",disabled:s,children:a,...i},l)=>{const c=t||"button",u=CDr(a);return o.jsx(c,{ref:l,disabled:s,className:Z(pC({variant:n,size:r,iconOnly:u}),e),...i,children:a})});pe.displayName="Button";const ld=M3t,Yr=D3t,Xr=L3t,Wr=b.forwardRef(({className:e,sideOffset:t=4,children:r,...n},s)=>o.jsx($3t,{children:o.jsxs(_qe,{ref:s,sideOffset:t,className:Z("z-50 overflow-hidden rounded-md bg-surface3 px-3 py-1.5 text-xs text-neutral4 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,children:[r,o.jsx(F3t,{className:"fill-surface3"})]})}));Wr.displayName=_qe.displayName;const Cn=je.forwardRef(({tooltipContent:e,...t},r)=>o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(pe,{ref:r,...t})}),e&&o.jsx(Wr,{children:e})]}));Cn.displayName="ButtonWithTooltip";const jDr={sm:"[&>svg]:h-icon-sm [&>svg]:w-icon-sm",default:"[&>svg]:h-icon-default [&>svg]:w-icon-default",lg:"[&>svg]:h-icon-lg [&>svg]:w-icon-lg"},Ce=({children:e,className:t,size:r="default",...n})=>o.jsx("span",{className:Z("block",jDr[r],t),...n,children:e}),sn={colors:"transition-colors duration-normal ease-out-custom",all:"transition-all duration-normal ease-out-custom",opacity:"transition-opacity duration-normal ease-out-custom",allSlow:"transition-all duration-slow ease-out-custom"},c0={visible:"focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},adt=({children:e})=>o.jsx("nav",{className:"bg-surface2 min-h-full overflow-hidden",children:e}),T4=({children:e,as:t="a",href:r,className:n,prefetch:s,to:a})=>o.jsx(t,{href:r,prefetch:s,to:a,className:Z("text-ui-sm flex h-full w-full flex-col justify-center font-medium cursor-pointer",sn.colors,n),children:e}),idt=({children:e})=>o.jsx("ol",{"data-testid":"thread-list",children:e}),N4=({children:e,isActive:t,className:r})=>o.jsx("li",{className:Z("border-b border-border1 group flex h-[54px] items-center justify-between gap-2 px-3 py-2",sn.colors,"hover:bg-surface3",t&&"bg-accent1Dark",r),children:e}),odt=({onClick:e})=>o.jsx(pe,{variant:"ghost",className:Z("shrink-0 opacity-0",sn.all,"group-focus-within:opacity-100 group-hover:opacity-100","hover:bg-surface4 hover:text-accent2"),onClick:e,children:o.jsx(Ce,{children:o.jsx(Xl,{"aria-label":"delete thread",className:"text-neutral3 hover:text-accent2 transition-colors"})})}),TDr={"ui-xs":"text-ui-xs leading-ui-xs","ui-sm":"text-ui-sm leading-ui-sm","ui-smd":"text-ui-smd leading-ui-smd","ui-md":"text-ui-md leading-ui-md","ui-lg":"text-ui-lg leading-ui-lg","header-xs":"text-header-xs leading-header-xs","header-sm":"text-header-sm leading-header-sm","header-md":"text-header-md leading-header-md","header-lg":"text-header-lg leading-header-lg","header-xl":"text-header-xl leading-header-xl"},NDr={mono:"font-mono"},me=({as:e="p",className:t,variant:r="ui-md",font:n,...s})=>o.jsx(e,{className:Z(TDr[r],n&&NDr[n],t),...s}),pa=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 15C10.3565 15 12.137 14.2625 13.4497 12.9497C14.7625 11.637 15.5 9.85652 15.5 8C15.5 6.14348 14.7625 4.36301 13.4497 3.05025C12.137 1.7375 10.3565 1 8.5 1C6.64348 1 4.86301 1.7375 3.55025 3.05025C2.2375 4.36301 1.5 6.14348 1.5 8C1.5 9.85652 2.2375 11.637 3.55025 12.9497C4.86301 14.2625 6.64348 15 8.5 15ZM5.621 10.879L4.611 11.889C3.84179 11.1198 3.31794 10.1398 3.1057 9.07291C2.89346 8.00601 3.00236 6.90013 3.41864 5.89512C3.83491 4.89012 4.53986 4.03112 5.44434 3.42676C6.34881 2.8224 7.41219 2.49983 8.5 2.49983C9.58781 2.49983 10.6512 2.8224 11.5557 3.42676C12.4601 4.03112 13.1651 4.89012 13.5814 5.89512C13.9976 6.90013 14.1065 8.00601 13.8943 9.07291C13.6821 10.1398 13.1582 11.1198 12.389 11.889L11.379 10.879C11.1004 10.6003 10.7696 10.3792 10.4055 10.2284C10.0414 10.0776 9.6511 9.99995 9.257 10H7.743C7.3489 9.99995 6.95865 10.0776 6.59455 10.2284C6.23045 10.3792 5.89963 10.6003 5.621 10.879Z",fill:"currentColor"}),o.jsx("path",{d:"M8.5 4C7.96957 4 7.46086 4.21071 7.08579 4.58579C6.71071 4.96086 6.5 5.46957 6.5 6V6.5C6.5 7.03043 6.71071 7.53914 7.08579 7.91421C7.46086 8.28929 7.96957 8.5 8.5 8.5C9.03043 8.5 9.53914 8.28929 9.91421 7.91421C10.2893 7.53914 10.5 7.03043 10.5 6.5V6C10.5 5.46957 10.2893 4.96086 9.91421 4.58579C9.53914 4.21071 9.03043 4 8.5 4Z",fill:"currentColor"})]}),ADr=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M11.0313 7.97578C11.0313 9.34436 9.92183 10.4538 8.55324 10.4538C7.18466 10.4538 6.0752 9.34436 6.0752 7.97578C6.0752 6.60719 7.18466 5.49773 8.55324 5.49773C9.92183 5.49773 11.0313 6.60719 11.0313 7.97578ZM11.0313 7.97578H14.573",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"}),o.jsx("path",{d:"M12.967 4.46154C11.9273 3.14431 10.3165 2.29883 8.50814 2.29883C5.37277 2.29883 2.83105 4.84055 2.83105 7.97591C2.83105 11.1113 5.37277 13.653 8.50814 13.653C10.3165 13.653 11.9273 12.8075 12.967 11.4903",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"})]}),lme=e=>o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.97865 4.57004C8.22604 4.75795 8.27426 5.11082 8.08635 5.35821L6.05486 8.03279C5.94873 8.17251 5.78348 8.25471 5.60803 8.25505C5.43257 8.2554 5.267 8.17385 5.16032 8.03454L3.80937 6.27034C3.6205 6.02369 3.66733 5.67063 3.91398 5.48176C4.16063 5.29288 4.51369 5.33972 4.70257 5.58637L5.6051 6.76498L7.19048 4.67774C7.37839 4.43036 7.73126 4.38213 7.97865 4.57004Z",fill:"currentColor"})]}),cme=e=>o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.89741 4.10293C8.11707 4.32261 8.11706 4.67877 7.89738 4.89843L6.79517 6.00058L7.8962 7.10155C8.11588 7.32122 8.11589 7.67737 7.89623 7.89705C7.67656 8.11673 7.32041 8.11674 7.10073 7.89707L5.99965 6.79605L4.89856 7.89707C4.67889 8.11673 4.32273 8.11672 4.10307 7.89704C3.88341 7.67737 3.88342 7.32121 4.10309 7.10155L5.20413 6.00058L4.10191 4.89843C3.88224 4.67877 3.88223 4.32262 4.10189 4.10294C4.32155 3.88326 4.67771 3.88325 4.89738 4.10292L5.99965 5.20511L7.10191 4.10291C7.32159 3.88325 7.67774 3.88326 7.89741 4.10293Z",fill:"currentColor"})]}),u0=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.1747 3.18598L7.02554 1.95209C7.11557 1.89207 7.31087 1.87106 7.41016 1.90924L12.4139 3.83377C12.4683 3.85467 12.546 3.96798 12.546 4.03118V13.0167C12.546 13.265 12.7473 13.4663 12.9956 13.4663C13.2439 13.4663 13.4452 13.265 13.4452 13.0167V4.03118C13.4452 3.59605 13.1384 3.14906 12.7367 2.99456L7.73293 1.07004C7.36225 0.927472 6.86056 0.981451 6.52679 1.20396L4.20445 2.75219L3.90419 2.95236L3.90647 2.95824C3.69329 3.05449 3.55469 3.27599 3.55469 3.57581V11.7119C3.55469 12.2084 3.93067 12.7499 4.39251 12.9206L9.89804 14.955C10.3608 15.126 10.7359 14.8596 10.7359 14.3659V5.83295C10.7359 5.33662 10.3498 4.81289 9.88389 4.66643L5.1747 3.18598Z",fill:"currentColor"})}),ldt=e=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:o.jsx("path",{d:"M7.5 0.75C3.6325 0.75 0.5 3.8825 0.5 7.75C0.5 10.8475 2.50375 13.4637 5.28625 14.3912C5.63625 14.4525 5.7675 14.2425 5.7675 14.0587C5.7675 13.8925 5.75875 13.3412 5.75875 12.755C4 13.0787 3.545 12.3262 3.405 11.9325C3.32625 11.7312 2.985 11.11 2.6875 10.9437C2.4425 10.8125 2.0925 10.4887 2.67875 10.48C3.23 10.4712 3.62375 10.9875 3.755 11.1975C4.385 12.2562 5.39125 11.9587 5.79375 11.775C5.855 11.32 6.03875 11.0137 6.24 10.8387C4.6825 10.6637 3.055 10.06 3.055 7.3825C3.055 6.62125 3.32625 5.99125 3.7725 5.50125C3.7025 5.32625 3.4575 4.60875 3.8425 3.64625C3.8425 3.64625 4.42875 3.4625 5.7675 4.36375C6.3275 4.20625 6.9225 4.1275 7.5175 4.1275C8.1125 4.1275 8.7075 4.20625 9.2675 4.36375C10.6062 3.45375 11.1925 3.64625 11.1925 3.64625C11.5775 4.60875 11.3325 5.32625 11.2625 5.50125C11.7087 5.99125 11.98 6.6125 11.98 7.3825C11.98 10.0687 10.3438 10.6637 8.78625 10.8387C9.04 11.0575 9.25875 11.4775 9.25875 12.1337C9.25875 13.07 9.25 13.8225 9.25 14.0587C9.25 14.2425 9.38125 14.4612 9.73125 14.3912C11.1209 13.9221 12.3284 13.029 13.1839 11.8377C14.0393 10.6463 14.4996 9.21668 14.5 7.75C14.5 3.8825 11.3675 0.75 7.5 0.75Z",fill:"currentColor"})}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21999_22095",children:o.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),cdt=e=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[o.jsx("path",{d:"M13.5037 7.54867C13.5037 7.1144 13.4648 6.69683 13.3924 6.29596H7.62436V8.66776H10.9204C10.7756 9.43052 10.3413 10.0764 9.68994 10.5106V12.0529H11.6776C12.8356 10.9839 13.5037 9.41382 13.5037 7.54867Z",fill:"#4285F4"}),o.jsx("path",{d:"M7.62415 13.5339C9.27773 13.5339 10.6643 12.9882 11.6776 12.0529L9.68994 10.5106C9.14431 10.8781 8.44816 11.1009 7.62415 11.1009C6.03182 11.1009 4.67889 10.0263 4.19451 8.57877H2.15677V10.16C3.1645 12.1587 5.23008 13.5339 7.62415 13.5339Z",fill:"#34A853"}),o.jsx("path",{d:"M4.19472 8.57315C4.07223 8.20569 3.99985 7.81595 3.99985 7.40952C3.99985 7.00308 4.07223 6.61335 4.19472 6.24589V4.66469H2.15698C1.73941 5.4887 1.5 6.41849 1.5 7.40952C1.5 8.40055 1.73941 9.33034 2.15698 10.1543L3.74374 8.91834L4.19472 8.57315Z",fill:"#FBBC05"}),o.jsx("path",{d:"M7.62415 3.72376C8.5261 3.72376 9.32783 4.03555 9.96811 4.63685L11.7219 2.88306C10.6585 1.89202 9.27773 1.28516 7.62415 1.28516C5.23008 1.28516 3.16471 2.66036 2.15698 4.66469L4.19472 6.24589C4.6791 4.79832 6.03182 3.72376 7.62415 3.72376Z",fill:"#EA4335"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21999_20513",children:o.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),IDr=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M4.31445 3.16083C3.78402 3.16083 3.27531 3.37154 2.90024 3.74661C2.52517 4.12169 2.31445 4.63039 2.31445 5.16083V5.66083C2.31445 6.19126 2.52517 6.69997 2.90024 7.07504C3.27531 7.45011 3.78402 7.66083 4.31445 7.66083C4.84489 7.66083 5.35359 7.45011 5.72867 7.07504C6.10374 6.69997 6.31445 6.19126 6.31445 5.66083V5.16083C6.31445 4.63039 6.10374 4.12169 5.72867 3.74661C5.35359 3.37154 4.84489 3.16083 4.31445 3.16083Z",fill:"currentColor"}),o.jsx("path",{d:"M6.76666 9.50235C6.57678 9.28532 6.30244 9.16083 6.01407 9.16083H4.50201C4.10791 9.16078 3.71766 9.23838 3.35356 9.38921C3.11733 9.48706 2.8951 9.6145 2.69205 9.76806C2.48056 9.928 2.38001 10.1888 2.38001 10.454V13.0642C2.38001 13.6165 2.82773 14.0642 3.38001 14.0642H8.55436C9.4135 14.0642 9.87269 13.0523 9.30695 12.4057L6.76666 9.50235Z",fill:"currentColor"}),o.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),o.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),o.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),M9=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M3.8674 9.19968L4.14554 10.8649C4.23965 11.4283 4.75254 11.8237 5.32137 11.7713L5.58252 11.7472C6.56555 11.6567 7.43309 12.3868 7.51181 13.3708L7.59308 14.3867C7.60422 14.5259 7.71868 14.6342 7.85825 14.6376L9.91053 14.6876C10.1066 14.6924 10.2434 14.4948 10.17 14.3129L8.90452 11.1782C8.80956 10.9429 8.65085 10.7389 8.44626 10.5889L7.90134 10.1895C7.70604 10.0464 7.55223 9.85411 7.45759 9.63124C7.15011 8.90712 6.6579 7.71234 6.37054 6.88944C6.19204 6.3783 5.79931 6.29158 5.45492 6.21553C4.98179 6.11106 4.5999 6.02673 4.99001 4.88985C5.66408 2.92541 8.06015 2.07904 10.6601 3.33088C12.6488 4.2884 13.1187 6.35416 13.0328 7.58237C13.0297 7.62768 13.0214 7.67186 13.0094 7.71566C12.8829 8.17534 12.368 8.40491 11.9415 8.19169L10.3022 7.37201C10.2069 7.32439 10.0927 7.33657 10.0096 7.40322L8.64809 8.49559C8.55405 8.57104 8.52072 8.69931 8.56615 8.811L10.8995 14.5478C10.9404 14.6483 11.0369 14.715 11.1454 14.7177L12.0572 14.7399C12.2581 14.7448 12.3951 14.5382 12.3124 14.3551L11.8681 13.3706C11.4211 12.3803 11.6047 11.2192 12.3354 10.4151L13.4616 9.17575C13.7473 8.86125 13.9224 8.46187 13.9599 8.03858L13.9763 7.85359C14.2866 4.35298 11.377 1.41272 7.87336 1.68639C6.03919 1.82965 4.45399 3.02228 3.80807 4.74492L3.70275 5.02579C3.5828 5.34571 3.62741 5.70411 3.82213 5.98485L3.88946 6.08192C4.12183 6.41695 4.0958 6.86726 3.82637 7.17328L3.06705 8.03572C2.96261 8.15435 2.98058 8.33664 3.10617 8.43259L3.66059 8.85617C3.77064 8.94026 3.84458 9.06307 3.8674 9.19968Z",fill:"currentColor"})}),ume=e=>o.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.40864 11.9983C7.58064 11.9733 6.84164 11.6153 6.31564 11.0563C6.31464 11.0563 6.31464 11.0553 6.31464 11.0553C5.78864 10.4963 5.47564 9.73633 5.50064 8.90833C5.52564 8.08033 5.88464 7.34133 6.44364 6.81533C7.00264 6.28833 7.76264 5.97633 8.59064 6.00133C9.41864 6.02633 10.1576 6.38433 10.6836 6.94333H10.6846C11.2106 7.50333 11.5236 8.26233 11.4986 9.09033C11.4726 9.91833 11.1146 10.6583 10.5556 11.1843C9.99664 11.7103 9.23664 12.0233 8.40864 11.9983ZM16.1266 8.15033L14.3606 7.74033C14.2316 7.14133 14.0146 6.57633 13.7216 6.05733L14.7726 4.57933C14.9116 4.38533 14.8926 4.12033 14.7296 3.94633L13.9206 3.08733C13.7576 2.91333 13.4946 2.87933 13.2916 3.00533L11.7526 3.96533C11.2526 3.64133 10.7016 3.39033 10.1116 3.22633L9.80964 1.43833C9.76964 1.20333 9.56964 1.02833 9.33164 1.02133L8.15264 0.985326C7.91364 0.978326 7.70364 1.14033 7.64964 1.37233L7.24064 3.13933C6.64164 3.26733 6.07664 3.48433 5.55664 3.77733L4.07864 2.72633C3.88464 2.58833 3.61964 2.60633 3.44664 2.76933L2.58664 3.57833C2.41364 3.74133 2.37964 4.00533 2.50564 4.20733L3.46564 5.74633C3.14164 6.24633 2.89064 6.79833 2.72564 7.38833L0.937635 7.68933C0.702635 7.72933 0.528635 7.92933 0.520635 8.16733L0.485635 9.34733C0.477635 9.58533 0.639635 9.79533 0.872635 9.84933L2.63864 10.2583C2.76764 10.8573 2.98464 11.4233 3.27764 11.9423L2.22564 13.4203C2.08764 13.6143 2.10564 13.8793 2.26964 14.0523L3.07864 14.9123C3.24164 15.0853 3.50464 15.1203 3.70664 14.9933L5.24564 14.0333C5.74663 14.3583 6.29764 14.6093 6.88764 14.7733L7.18964 16.5613C7.22864 16.7963 7.42864 16.9713 7.66764 16.9783L8.84663 17.0143C9.08564 17.0213 9.29564 16.8593 9.34964 16.6273L9.75864 14.8603C10.3576 14.7323 10.9226 14.5153 11.4416 14.2213L12.9206 15.2733C13.1146 15.4113 13.3786 15.3933 13.5526 15.2293L14.4116 14.4213C14.5856 14.2573 14.6196 13.9943 14.4936 13.7923L13.5336 12.2533C13.8576 11.7523 14.1086 11.2013 14.2726 10.6113L16.0616 10.3103C16.2966 10.2703 16.4706 10.0703 16.4776 9.83233L16.5136 8.65233C16.5206 8.41433 16.3586 8.20433 16.1266 8.15033Z",fill:"currentColor"})}),RDr=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),Pi=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.5605 1.42351C8.0791 0.904904 8.92215 0.906157 9.4395 1.42351L10.6922 2.67617C11.2108 3.19477 11.2095 4.03782 10.6922 4.55517L9.4395 5.80783C8.9209 6.32643 8.07785 6.32518 7.5605 5.80783L6.30784 4.55517C5.78923 4.03656 5.79049 3.19352 6.30784 2.67617L7.5605 1.42351ZM3.17618 5.80783C3.69478 5.28923 4.53782 5.29048 5.05517 5.80783L6.30784 7.0605C6.82644 7.5791 6.82519 8.42214 6.30784 8.93949L5.05517 10.1922C4.53657 10.7108 3.69353 10.7095 3.17618 10.1922L1.92351 8.93949C1.40491 8.42089 1.40616 7.57785 1.92351 7.0605L3.17618 5.80783ZM11.9448 5.80783C12.4634 5.28923 13.3065 5.29048 13.8238 5.80783L15.0765 7.0605C15.5951 7.5791 15.5938 8.42214 15.0765 8.93949L13.8238 10.1922C13.3052 10.7108 12.4622 10.7095 11.9448 10.1922L10.6922 8.93949C10.1736 8.42089 10.1748 7.57785 10.6922 7.0605L11.9448 5.80783ZM7.5605 10.1922C8.0791 9.67355 8.92215 9.67481 9.4395 10.1922L10.6922 11.4448C11.2108 11.9634 11.2095 12.8065 10.6922 13.3238L9.4395 14.5765C8.9209 15.0951 8.07785 15.0938 7.5605 14.5765L6.30784 13.3238C5.78923 12.8052 5.79049 11.9622 6.30784 11.4448L7.5605 10.1922Z",fill:"currentColor"})}),mC=e=>o.jsx(l9t,{...e}),Mi=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.24388 2.4018C6.24388 2.0394 6.53767 1.74561 6.90008 1.74561H10.0991C10.4614 1.74561 10.7553 2.0394 10.7553 2.4018V4.57546C10.7553 4.93787 10.4614 5.23166 10.0991 5.23166H9.31982V7.35469L10.0033 9.22664C9.90442 9.20146 9.80035 9.1761 9.6915 9.14986L9.62652 9.13422C9.30473 9.05687 8.92256 8.96501 8.61993 8.84491C8.5819 8.82981 8.54147 8.81292 8.49957 8.79391C8.45767 8.81292 8.41724 8.82981 8.3792 8.84491C8.07657 8.96501 7.6944 9.05687 7.37261 9.13422L7.30763 9.14986C7.19879 9.1761 7.09471 9.20146 6.99577 9.22664L7.67932 7.35469V5.23166H6.90008C6.53767 5.23166 6.24388 4.93787 6.24388 4.57546V2.4018ZM6.99577 9.22664C6.99577 9.22664 6.99578 9.22664 6.99577 9.22664L6.43283 10.7683H6.81806C7.18047 10.7683 7.47426 11.0622 7.47426 11.4245V13.5982C7.47426 13.9606 7.18047 14.2544 6.81806 14.2544H3.61909C3.25668 14.2544 2.96289 13.9606 2.96289 13.5982V11.4245C2.96289 11.0622 3.25668 10.7683 3.61909 10.7683H4.26617C4.2921 10.4663 4.32783 10.1494 4.37744 9.85171C4.43762 9.49063 4.52982 9.08135 4.68998 8.76102C4.93975 8.2615 5.44743 8.01751 5.7771 7.88788C6.14684 7.74249 6.57537 7.63889 6.92317 7.55505C7.24707 7.47696 7.49576 7.41679 7.67932 7.35469L6.99577 9.22664ZM6.43283 10.7683L6.99577 9.22664C6.75846 9.28705 6.55067 9.34646 6.37745 9.41458C6.22784 9.47341 6.1623 9.51712 6.14023 9.53254C6.09752 9.63631 6.04409 9.83055 5.99562 10.1214C5.96201 10.3231 5.93498 10.5439 5.91341 10.7683H6.43283ZM10.0033 9.22664L9.31982 7.35469C9.50338 7.41679 9.75206 7.47696 10.076 7.55505C10.4238 7.63889 10.8523 7.74249 11.2221 7.88788C11.5517 8.01751 12.0594 8.2615 12.3091 8.76102C12.4693 9.08135 12.5615 9.49063 12.6217 9.85171C12.6713 10.1494 12.707 10.4663 12.733 10.7683H13.38C13.7424 10.7683 14.0362 11.0622 14.0362 11.4245V13.5982C14.0362 13.9606 13.7424 14.2544 13.38 14.2544H10.1811C9.81867 14.2544 9.52488 13.9606 9.52488 13.5982V11.4245C9.52488 11.0622 9.81867 10.7683 10.1811 10.7683H10.5663L10.0033 9.22664ZM10.0033 9.22664L10.5663 10.7683H11.0857C11.0642 10.5439 11.0372 10.3231 11.0035 10.1214C10.9551 9.83055 10.9016 9.63631 10.8589 9.53254C10.8369 9.51712 10.7713 9.47341 10.6217 9.41458C10.4485 9.34646 10.2407 9.28705 10.0033 9.22664Z",fill:"currentColor"})}),vl=e=>o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M6.53918 9.32122C6.34324 9.51508 6.02724 9.51338 5.83338 9.31744C5.63952 9.1215 5.6412 8.80551 5.83713 8.61164L10.1958 4.29931C10.7996 3.70186 10.8017 2.72852 10.2041 2.12839L10.1899 2.11428C9.58767 1.52481 8.62251 1.53208 8.0292 2.13052L2.29396 7.91536C2.0999 8.1111 1.78388 8.11246 1.58813 7.9184C1.39239 7.72433 1.39103 7.40831 1.58509 7.21257L7.32036 1.42774C8.30005 0.439581 9.89369 0.427613 10.8881 1.40094L10.9116 1.42425C11.4942 2.00929 11.7316 2.80913 11.6232 3.56922C12.389 3.44866 13.1999 3.67918 13.7961 4.26273C14.804 5.24929 14.8147 6.86824 13.82 7.86808L8.5531 13.1619C8.50045 13.2148 8.50024 13.3002 8.55263 13.3534L9.65448 14.4717C9.84794 14.668 9.8456 14.984 9.64925 15.1775C9.45291 15.3709 9.13691 15.3686 8.94345 15.1723L7.84163 14.054C7.40505 13.6109 7.40677 12.8988 7.8455 12.4579L13.1124 7.16405C13.7161 6.55727 13.7095 5.57478 13.0979 4.97606C12.4925 4.38347 11.4942 4.40725 10.8978 5.00886L6.53918 9.32122Z",fill:"currentColor"}),o.jsx("path",{d:"M8.84622 2.75411C9.04697 2.56188 9.36555 2.56381 9.56395 2.76076C9.76234 2.95771 9.76658 3.27625 9.57582 3.4784L9.56661 3.48794L5.25912 7.82701C4.67023 8.42022 4.672 9.37798 5.26305 9.96904C5.85624 10.5622 6.81818 10.5615 7.41052 9.9675L11.6299 5.73599L11.6395 5.72671C11.8406 5.53493 12.1592 5.53756 12.3572 5.73496C12.5583 5.93548 12.5587 6.26104 12.3582 6.46214L8.13877 10.6937C7.14498 11.6903 5.53105 11.6915 4.53584 10.6963C3.5442 9.70461 3.54127 8.09774 4.52928 7.10248L8.83677 2.76342L8.84622 2.75411Z",fill:"currentColor"})]}),D9=e=>o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M1.5 8.5V8C1.5 7.60218 1.65804 7.22064 1.93934 6.93934C2.22064 6.65804 2.60218 6.5 3 6.5H13C13.3978 6.5 13.7794 6.65804 14.0607 6.93934C14.342 7.22064 14.5 7.60218 14.5 8V8.5M8.70667 4.20667L7.29333 2.79333C7.20048 2.70037 7.09022 2.62661 6.96886 2.57628C6.84749 2.52595 6.71739 2.50003 6.586 2.5H3C2.60218 2.5 2.22064 2.65804 1.93934 2.93934C1.65804 3.22064 1.5 3.60218 1.5 4V12C1.5 12.3978 1.65804 12.7794 1.93934 13.0607C2.22064 13.342 2.60218 13.5 3 13.5H13C13.3978 13.5 13.7794 13.342 14.0607 13.0607C14.342 12.7794 14.5 12.3978 14.5 12V6C14.5 5.60218 14.342 5.22064 14.0607 4.93934C13.7794 4.65804 13.3978 4.5 13 4.5H9.414C9.14887 4.49977 8.89402 4.39426 8.70667 4.20667Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});function fp(e){return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),o.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),o.jsx("path",{d:"M15 2v2"}),o.jsx("path",{d:"M15 20v2"}),o.jsx("path",{d:"M2 15h2"}),o.jsx("path",{d:"M2 9h2"}),o.jsx("path",{d:"M20 15h2"}),o.jsx("path",{d:"M20 9h2"}),o.jsx("path",{d:"M9 2v2"}),o.jsx("path",{d:"M9 20v2"})]})}const udt=e=>o.jsxs("svg",{className:"h-3 w-3",width:"16",height:"16",viewBox:"0 0 181 108",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsxs("g",{clipPath:"url(#clip0_1480_1723)",children:[o.jsx("path",{d:"M51.2203 39.3158C51.2203 41.5066 51.4572 43.2829 51.8717 44.5856C52.3453 45.8882 52.9374 47.3093 53.7664 48.8487C54.0624 49.3224 54.1809 49.7961 54.1809 50.2106C54.1809 50.8027 53.8256 51.3948 53.0559 51.9869L49.3256 54.4737C48.7927 54.829 48.2598 55.0066 47.7861 55.0066C47.194 55.0066 46.6019 54.7106 46.0098 54.1777C45.1809 53.2895 44.4703 52.3422 43.8782 51.3948C43.2861 50.3882 42.694 49.2632 42.0427 47.9014C37.4243 53.3487 31.6217 56.0724 24.6348 56.0724C19.6611 56.0724 15.694 54.6514 12.7927 51.8093C9.8914 48.9672 8.41113 45.1777 8.41113 40.4408C8.41113 35.4079 10.1874 31.3224 13.7993 28.2435C17.4111 25.1645 22.2072 23.6251 28.3059 23.6251C30.319 23.6251 32.3914 23.8027 34.5822 24.0987C36.773 24.3948 39.023 24.8685 41.3914 25.4014V21.079C41.3914 16.579 40.444 13.4408 38.6085 11.6053C36.7138 9.76979 33.5164 8.88163 28.9572 8.88163C26.8848 8.88163 24.7532 9.11847 22.5624 9.65137C20.3717 10.1843 18.2401 10.8356 16.1677 11.6645C15.2203 12.079 14.5098 12.3158 14.0953 12.4343C13.6809 12.5527 13.3848 12.6119 13.148 12.6119C12.319 12.6119 11.9046 12.0198 11.9046 10.7764V7.87505C11.9046 6.92768 12.023 6.21716 12.319 5.80268C12.6151 5.38821 13.148 4.97374 13.9769 4.55926C16.0493 3.49347 18.5361 2.60531 21.4374 1.89479C24.3388 1.12505 27.4177 0.769788 30.6743 0.769788C37.7203 0.769788 42.8717 2.36847 46.1875 5.56584C49.444 8.76321 51.1019 13.6185 51.1019 20.1316V39.3158H51.2203ZM27.1809 48.3158C29.1348 48.3158 31.148 47.9606 33.2796 47.2501C35.4111 46.5395 37.3059 45.2369 38.9046 43.4606C39.8519 42.3356 40.5625 41.0922 40.9177 39.6711C41.273 38.2501 41.5098 36.5329 41.5098 34.5198V32.0329C39.7927 31.6185 37.9572 31.2632 36.0624 31.0264C34.1677 30.7895 32.3322 30.6711 30.4967 30.6711C26.5296 30.6711 23.6282 31.4408 21.6743 33.0395C19.7203 34.6382 18.773 36.8882 18.773 39.8487C18.773 42.6316 19.4835 44.704 20.9638 46.1251C22.3848 47.6053 24.4572 48.3158 27.1809 48.3158ZM74.7269 54.7106C73.6611 54.7106 72.9506 54.5329 72.4769 54.1185C72.0032 53.7632 71.5888 52.9343 71.2335 51.8093L57.319 6.03953C56.9638 4.85531 56.7861 4.08558 56.7861 3.6711C56.7861 2.72374 57.2598 2.19084 58.2072 2.19084H64.0098C65.1348 2.19084 65.9046 2.36847 66.319 2.78295C66.7927 3.13821 67.148 3.96716 67.5032 5.09216L77.4506 44.2895L86.6874 5.09216C86.9835 3.90795 87.3388 3.13821 87.8124 2.78295C88.2861 2.42768 89.1151 2.19084 90.1809 2.19084H94.9177C96.0427 2.19084 96.8124 2.36847 97.2861 2.78295C97.7598 3.13821 98.1743 3.96716 98.4111 5.09216L107.766 44.7632L118.01 5.09216C118.365 3.90795 118.78 3.13821 119.194 2.78295C119.668 2.42768 120.437 2.19084 121.503 2.19084H127.01C127.957 2.19084 128.49 2.66453 128.49 3.6711C128.49 3.96716 128.431 4.26321 128.372 4.61847C128.312 4.97374 128.194 5.44742 127.957 6.09874L113.687 51.8685C113.332 53.0527 112.918 53.8224 112.444 54.1777C111.97 54.5329 111.201 54.7698 110.194 54.7698H105.102C103.977 54.7698 103.207 54.5922 102.733 54.1777C102.26 53.7632 101.845 52.9935 101.608 51.8093L92.4309 13.6185L83.3125 51.7501C83.0164 52.9343 82.6611 53.704 82.1874 54.1185C81.7138 54.5329 80.8848 54.7106 79.819 54.7106H74.7269ZM150.812 56.3093C147.734 56.3093 144.655 55.954 141.694 55.2435C138.733 54.5329 136.424 53.7632 134.885 52.8751C133.937 52.3422 133.286 51.7501 133.049 51.2172C132.812 50.6843 132.694 50.0922 132.694 49.5593V46.5395C132.694 45.2961 133.168 44.704 134.056 44.704C134.411 44.704 134.766 44.7632 135.122 44.8816C135.477 45.0001 136.01 45.2369 136.602 45.4737C138.615 46.3619 140.806 47.0724 143.115 47.5461C145.484 48.0198 147.793 48.2566 150.161 48.2566C153.891 48.2566 156.793 47.6053 158.806 46.3027C160.819 45 161.885 43.1053 161.885 40.6777C161.885 39.0198 161.352 37.6579 160.286 36.5329C159.22 35.4079 157.207 34.4014 154.306 33.454L145.72 30.7895C141.398 29.4277 138.201 27.4145 136.247 24.7501C134.293 22.1448 133.286 19.2435 133.286 16.1645C133.286 13.6777 133.819 11.4869 134.885 9.59216C135.951 7.69742 137.372 6.03953 139.148 4.73689C140.924 3.37505 142.937 2.36847 145.306 1.65795C147.674 0.94742 150.161 0.651367 152.766 0.651367C154.069 0.651367 155.431 0.710578 156.734 0.888209C158.095 1.06584 159.339 1.30268 160.582 1.53953C161.766 1.83558 162.891 2.13163 163.957 2.48689C165.023 2.84216 165.852 3.19742 166.444 3.55268C167.273 4.02637 167.865 4.50005 168.22 5.03295C168.576 5.50663 168.753 6.15795 168.753 6.98689V9.76979C168.753 11.0132 168.28 11.6645 167.391 11.6645C166.918 11.6645 166.148 11.4277 165.141 10.954C161.766 9.41453 157.977 8.64479 153.773 8.64479C150.398 8.64479 147.734 9.17768 145.898 10.3027C144.062 11.4277 143.115 13.1448 143.115 15.5724C143.115 17.2303 143.707 18.6514 144.891 19.7764C146.076 20.9014 148.266 22.0264 151.405 23.0329L159.812 25.6974C164.076 27.0593 167.155 28.954 168.99 31.3816C170.826 33.8093 171.714 36.5922 171.714 39.6711C171.714 42.2172 171.181 44.5264 170.174 46.5395C169.108 48.5527 167.687 50.329 165.852 51.7501C164.016 53.2303 161.826 54.2961 159.28 55.0658C156.615 55.8948 153.832 56.3093 150.812 56.3093Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M162.004 85.0856C142.524 99.4738 114.221 107.112 89.8855 107.112C55.7803 107.112 25.05 94.5001 1.83948 73.5396C0.00394917 71.8817 1.66184 69.6317 3.85263 70.9343C28.9579 85.5001 59.925 94.3225 91.9579 94.3225C113.57 94.3225 137.313 89.8225 159.162 80.5856C162.418 79.1054 165.201 82.7172 162.004 85.0856Z",fill:"#FF9900"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M170.115 75.8487C167.628 72.6513 153.654 74.3092 147.319 75.079C145.424 75.3158 145.128 73.6579 146.845 72.4145C157.976 64.5987 176.272 66.8487 178.404 69.454C180.536 72.1184 177.812 90.4145 167.391 99.1776C165.792 100.539 164.253 99.8289 164.963 98.0526C167.332 92.1908 172.601 78.9868 170.115 75.8487Z",fill:"#FF9900"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_1480_1723",children:o.jsx("rect",{width:"180",height:"107.763",fill:"white",transform:"translate(0.0625)"})})})]}),PDr=e=>o.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 320 320",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...e,children:o.jsx("path",{d:"m297.06 130.97c7.26-21.79 4.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13 22.48-76.91 55.82-22.51 4.61-41.94 18.7-53.31 38.67-17.59 30.32-13.58 68.54 9.92 94.54-7.26 21.79-4.76 45.66 6.85 65.48 17.46 30.4 52.56 46.04 86.84 38.68 15.24 17.18 37.16 26.95 60.13 26.8 35.06.09 66.16-22.49 76.94-55.86 22.51-4.61 41.94-18.7 53.31-38.67 17.57-30.32 13.55-68.51-9.94-94.51zm-120.28 168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26 1.34-.73 1.89-1.07l63.72-36.8c3.26-1.85 5.26-5.32 5.24-9.07v-89.83l26.93 15.55c.29.14.48.42.52.74v74.39c-.04 33.08-26.83 59.9-59.91 59.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28 1.3.79 1.89 1.13l63.72 36.8c3.23 1.89 7.23 1.89 10.47 0l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41 37.19c-28.69 16.52-65.33 6.7-81.92-21.95zm-16.77-139.09c7-12.16 18.05-21.46 31.21-26.29 0 .55-.03 1.52-.03 2.2v73.61c-.02 3.74 1.98 7.21 5.23 9.06l77.79 44.91-26.93 15.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26 51.49-77.79-44.92 26.93-15.54c.27-.18.61-.21.91-.08l64.42 37.19c28.68 16.57 38.51 53.26 21.94 81.94-7.01 12.14-18.05 21.44-31.2 26.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47 0l-77.79 44.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55 65.37-6.7 81.91 22 6.99 12.12 9.52 26.31 7.15 40.1zm-168.51 55.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12 26.89-59.96 60.01-59.94 14.01 0 27.57 4.92 38.34 13.88-.49.26-1.33.73-1.89 1.07l-63.72 36.8c-3.26 1.85-5.26 5.31-5.24 9.06l-.04 89.79zm14.63-31.54 34.65-20.01 34.65 20v40.01l-34.65 20-34.65-20z"})}),MDr=e=>o.jsx("svg",{className:"h-3 w-3",fill:"white",height:"78",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"78",style:{color:"currentcolor"},...e,children:o.jsx("g",{transform:"translate(0,2)",children:o.jsx("path",{d:"M11.375 0h-2.411L13.352 11.13h2.411L11.375 0ZM4.4 0 0 11.13h2.46l0.9-2.336h4.604l0.9 2.336h2.46L6.924 0H4.4Zm-0.244 6.723 1.506-3.909 1.506 3.909H4.156Z",fill:"currentColor"})})}),ddt=e=>o.jsx("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",...e,children:o.jsx("path",{d:"M7.402 13.8777C9.45763 13.4674 11.1555 13.128 11.175 13.1233L11.2104 13.1148L9.2697 10.507C8.2023 9.07276 7.32898 7.8937 7.32898 7.88691C7.32898 7.87404 9.33293 1.63997 9.3442 1.61779C9.34797 1.61037 10.7117 4.27017 12.65 8.06532C14.4647 11.6184 15.9608 14.5479 15.9747 14.5754L16 14.6253L9.83224 14.6244L3.66449 14.6235L7.402 13.8777ZM0 13.0824C0 13.0787 0.914457 11.2855 2.03212 9.09735L4.06425 5.11896L6.43245 2.87384C7.73497 1.63902 8.80417 0.627201 8.80845 0.625356C8.81274 0.623511 8.79561 0.672228 8.77038 0.733617C8.74515 0.795006 7.58796 3.59893 6.19884 6.96455L3.67317 13.0839L1.83659 13.0865C0.826464 13.0879 0 13.0861 0 13.0824Z",fill:"#0089D6",style:{fill:"#0089D6",fillOpacity:1}})}),DDr=e=>o.jsxs("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"17",height:"18",fill:"none",...e,children:[o.jsx("mask",{id:"mask0_174_2406",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"17",height:"18",children:o.jsx("path",{d:"M17 0.5H0V17.5H17V0.5Z",fill:"white"})}),o.jsxs("g",{mask:"url(#mask0_174_2406)",children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.50773 10.6219C5.9653 10.6219 6.8755 10.5968 8.13362 10.0788C9.59973 9.47518 12.5166 8.37942 14.6208 7.2539C16.0924 6.46668 16.7375 5.42553 16.7375 4.02344C16.7375 2.07751 15.16 0.5 13.2141 0.5H5.06095C2.26586 0.5 0 2.76586 0 5.56095C0 8.35604 2.12151 10.6219 5.50773 10.6219Z",fill:"#39594D"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.88672 14.107C6.88672 12.7369 7.71155 11.5016 8.97699 10.9764L11.5446 9.9108C14.1417 8.83294 17.0003 10.7415 17.0003 13.5535C17.0003 15.732 15.2339 17.4979 13.0553 17.4973L10.2754 17.4966C8.40372 17.4961 6.88672 15.9787 6.88672 14.107Z",fill:"#D18EE2"}),o.jsx("path",{d:"M2.91749 11.2891C1.30623 11.2891 0 12.5952 0 14.2065V14.5844C0 16.1956 1.30618 17.5018 2.91744 17.5018C4.5287 17.5018 5.83493 16.1956 5.83493 14.5844V14.2065C5.83493 12.5952 4.52875 11.2891 2.91749 11.2891Z",fill:"#FF7759"})]})]}),LDr=e=>o.jsxs("svg",{className:"h-3 w-3","data-testid":"geist-icon",height:"78",strokeLinejoin:"round",viewBox:"0 0 160 59",width:"104",style:{color:"currentcolor"},...e,children:[o.jsx("mask",{id:"mask0_4345_1846",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"160",height:"59",style:{maskType:"luminance"},children:o.jsx("path",{d:"M0.273438 0.219727H159.216V58.1817H0.273438V0.219727Z",fill:"white"})}),o.jsx("g",{mask:"url(#mask0_4345_1846)",children:o.jsx("path",{d:"M95.4635 0.314595C84.4822 0.314595 75.5599 9.19525 75.5599 20.1677C75.5599 31.1402 84.4632 40.0208 95.4635 40.0208C106.464 40.0208 115.367 31.1402 115.367 20.1677C115.348 9.21427 106.445 0.333611 95.4635 0.314595ZM95.4635 32.5664C88.6002 32.5664 83.0333 27.0136 83.0333 20.1677C83.0333 13.3218 88.6002 7.76902 95.4635 7.76902C102.327 7.76902 107.894 13.3218 107.894 20.1677C107.894 27.0136 102.327 32.5664 95.4635 32.5664ZM67.9912 0.39066C67.3049 0.314595 66.6376 0.276562 65.9513 0.276562C65.6081 0.276562 65.284 0.276562 64.9599 0.295578C64.6358 0.314595 64.2926 0.333611 63.9685 0.352628C62.634 0.44771 61.2995 0.675906 60.0031 1.03722C57.3531 1.74082 54.8556 2.99591 52.7013 4.68836C50.4898 6.43787 48.7358 8.68181 47.5347 11.23C46.9437 12.5041 46.5052 13.8543 46.2193 15.2234C46.0858 15.908 45.9905 16.5926 45.9142 17.2772C45.8952 17.6195 45.857 17.9618 45.857 18.3041L45.838 18.8175V19.293L45.8761 32.5854L45.9142 39.2221H53.3685L53.4067 32.5854L53.4448 19.293V18.5893C53.4448 18.3802 53.4829 18.171 53.4829 17.9618C53.5211 17.5434 53.5973 17.1441 53.6736 16.7257C53.8452 15.9271 54.093 15.1474 54.4362 14.4057C55.1225 12.9225 56.152 11.6293 57.4293 10.6025C58.7639 9.53755 60.3081 8.75787 61.9477 8.3205C62.7865 8.0923 63.6635 7.94017 64.5405 7.8641C64.7693 7.84509 64.979 7.82607 65.2078 7.82607C65.4365 7.82607 65.6653 7.80705 65.875 7.80705C66.2944 7.80705 66.7329 7.82607 67.1524 7.8641C68.8491 8.03525 70.4887 8.54869 71.9948 9.38541L75.7124 2.93886C73.3484 1.56968 70.7175 0.694923 67.9912 0.39066ZM20.3484 0.219513C9.36711 0.124431 0.36855 8.92902 0.273226 19.8825C0.177902 30.8359 9.00488 39.8116 19.9862 39.9067H26.8876V32.4713H20.3484C13.4851 32.5474 7.84193 27.0707 7.76567 20.2057C7.68941 13.3408 13.1801 7.73099 20.0624 7.65492H20.3484C27.2117 7.65492 32.7786 13.2077 32.8167 20.0536V38.3284C32.8167 45.1172 27.2689 50.651 20.4819 50.7271C17.2218 50.708 14.1142 49.3959 11.8265 47.0949L6.54553 52.3625C10.206 56.0326 15.1628 58.1244 20.3484 58.1625H20.6153C31.4632 58.0103 40.1757 49.2248 40.2329 38.4044V19.5592C39.966 8.81492 31.1391 0.238529 20.3484 0.219513ZM139.389 0.314595C128.407 0.314595 119.485 9.19525 119.504 20.1677C119.504 31.1212 128.407 40.0018 139.389 40.0018H146.195V32.5664H139.389C132.525 32.5664 126.958 27.0136 126.958 20.1677C126.958 13.3218 132.525 7.76902 139.389 7.76902C145.833 7.76902 151.209 12.6943 151.781 19.1028H151.762V57.2116H159.216V20.1677C159.216 9.21427 150.351 0.314595 139.389 0.314595Z",fill:"currentColor"})})]}),$Dr=e=>o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 34 21",fill:"none",...e,children:o.jsx("path",{d:"M4.49805 11.6934C6.98237 11.6934 8.99609 13.7081 8.99609 16.1924C8.9959 18.6765 6.98225 20.6904 4.49805 20.6904C2.01394 20.6903 0.000196352 18.6765 0 16.1924C0 13.7081 2.01382 11.6935 4.49805 11.6934ZM10.3867 0C12.8709 0 14.8846 2.01388 14.8848 4.49805C14.8848 4.8377 14.847 5.16846 14.7755 5.48643C14.4618 6.88139 14.1953 8.4633 14.9928 9.65L16.2575 11.5319C16.3363 11.6491 16.4727 11.7115 16.6137 11.703C16.7369 11.6957 16.8525 11.6343 16.9214 11.5318L18.1876 9.64717C18.9772 8.47198 18.7236 6.90783 18.4205 5.52484C18.3523 5.21392 18.3164 4.89094 18.3164 4.55957C18.3167 2.07546 20.3313 0.0615234 22.8154 0.0615234C25.2994 0.0617476 27.3132 2.0756 27.3135 4.55957C27.3135 4.93883 27.2665 5.30712 27.178 5.65896C26.8547 6.94441 26.5817 8.37932 27.2446 9.52714L28.459 11.6301C28.4819 11.6697 28.5245 11.6934 28.5703 11.6934C31.0545 11.6935 33.0684 13.7081 33.0684 16.1924C33.0682 18.6765 31.0544 20.6903 28.5703 20.6904C26.0861 20.6904 24.0725 18.6765 24.0723 16.1924C24.0723 15.8049 24.1212 15.4288 24.2133 15.0701C24.5458 13.7746 24.8298 12.3251 24.1609 11.1668L23.0044 9.16384C22.9656 9.09659 22.8931 9.05859 22.8154 9.05859C22.7983 9.05859 22.7824 9.06614 22.7728 9.08033L21.4896 10.9895C20.686 12.1851 20.9622 13.781 21.284 15.1851C21.3582 15.5089 21.3975 15.8461 21.3975 16.1924C21.3973 18.6764 19.3834 20.6902 16.8994 20.6904C14.4152 20.6904 12.4006 18.6765 12.4004 16.1924C12.4004 15.932 12.4226 15.6768 12.4651 15.4286C12.6859 14.14 12.8459 12.7122 12.1167 11.6271L11.2419 10.3253C10.6829 9.49347 9.71913 9.05932 8.78286 8.70188C7.0906 8.05584 5.88867 6.41734 5.88867 4.49805C5.88886 2.0139 7.90254 3.29835e-05 10.3867 0Z",fill:e.fill||"currentColor"})}),FDr=e=>o.jsxs("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"176",height:"162",viewBox:"0 0 176 162",fill:"none",...e,children:[o.jsx("rect",{x:"15",y:"1",width:"32",height:"32",fill:"#FFCD00",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"1",width:"32",height:"32",fill:"#FFCD00",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"47",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"111",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"47",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"79",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"111",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"79",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"129",width:"32",height:"32",fill:"#FF0006",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"129",width:"32",height:"32",fill:"#FF0006",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{y:"1",width:"16",height:"160",fill:"black"}),o.jsx("rect",{x:"63",y:"97",width:"16",height:"32",fill:"black"}),o.jsx("rect",{x:"95",y:"33",width:"16",height:"32",fill:"black"}),o.jsx("rect",{x:"127",y:"1",width:"16",height:"32",fill:"black"}),o.jsx("rect",{x:"127",y:"97",width:"16",height:"64",fill:"black"})]}),zDr=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"128",height:"113",viewBox:"0 0 128 113",children:[o.jsxs("g",{clipPath:"url(#clip0_236_138)",...e,children:[o.jsx("path",{d:"M34.593 94.0509H33.3844L27.3514 88.0179V86.8094L36.5743 77.5866H42.9639L43.8158 78.4385V84.8281L34.593 94.0509Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M27.3514 25.816V24.6074L33.3844 18.5744H34.593L43.8158 27.7972V34.1868L42.9639 35.0388H36.5743L27.3514 25.816Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M80.4594 74.6047H71.6824L70.9493 73.8717V53.3259C70.9493 49.6705 69.5129 46.8372 65.1046 46.7382C62.836 46.6787 60.2405 46.7382 57.4668 46.8471L57.0507 47.2731V73.8618L56.3176 74.5948H47.5406L46.8075 73.8618V38.7636L47.5406 38.0305H67.2939C74.9713 38.0305 81.1925 44.2517 81.1925 51.9291V73.8717L80.4594 74.6047Z",fill:e.fill||"#014847"}),o.jsx("path",{d:"M35.8412 61.4491H0.73307L0 60.716V51.9192L0.73307 51.1861H35.8412L36.5743 51.9192V60.716L35.8412 61.4491Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M127.277 61.4491H92.1687L91.4356 60.716V51.9192L92.1687 51.1861H127.277L128.01 51.9192V60.716L127.277 61.4491Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M58.9428 27.0642V0.73307L59.6759 0H68.4727L69.2058 0.73307V27.0642L68.4727 27.7972H59.6759L58.9428 27.0642Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M58.9428 111.902V85.5711L59.6759 84.838H68.4727L69.2058 85.5711V111.902L68.4727 112.635H59.6759L58.9428 111.902Z",fill:e.fill||"#05BDBA"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_236_138",children:o.jsx("rect",{width:"128",height:"112.635",fill:"white"})})})]}),QIe=e=>o.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 320 320",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...e,children:o.jsx("path",{d:"m297.06 130.97c7.26-21.79 4.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13 22.48-76.91 55.82-22.51 4.61-41.94 18.7-53.31 38.67-17.59 30.32-13.58 68.54 9.92 94.54-7.26 21.79-4.76 45.66 6.85 65.48 17.46 30.4 52.56 46.04 86.84 38.68 15.24 17.18 37.16 26.95 60.13 26.8 35.06.09 66.16-22.49 76.94-55.86 22.51-4.61 41.94-18.7 53.31-38.67 17.57-30.32 13.55-68.51-9.94-94.51zm-120.28 168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26 1.34-.73 1.89-1.07l63.72-36.8c3.26-1.85 5.26-5.32 5.24-9.07v-89.83l26.93 15.55c.29.14.48.42.52.74v74.39c-.04 33.08-26.83 59.9-59.91 59.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28 1.3.79 1.89 1.13l63.72 36.8c3.23 1.89 7.23 1.89 10.47 0l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41 37.19c-28.69 16.52-65.33 6.7-81.92-21.95zm-16.77-139.09c7-12.16 18.05-21.46 31.21-26.29 0 .55-.03 1.52-.03 2.2v73.61c-.02 3.74 1.98 7.21 5.23 9.06l77.79 44.91-26.93 15.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26 51.49-77.79-44.92 26.93-15.54c.27-.18.61-.21.91-.08l64.42 37.19c28.68 16.57 38.51 53.26 21.94 81.94-7.01 12.14-18.05 21.44-31.2 26.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47 0l-77.79 44.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55 65.37-6.7 81.91 22 6.99 12.12 9.52 26.31 7.15 40.1zm-168.51 55.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12 26.89-59.96 60.01-59.94 14.01 0 27.57 4.92 38.34 13.88-.49.26-1.33.73-1.89 1.07l-63.72 36.8c-3.26 1.85-5.26 5.31-5.24 9.06l-.04 89.79zm14.63-31.54 34.65-20.01 34.65 20v40.01l-34.65 20-34.65-20z"})}),BDr=e=>o.jsx("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1000 1000",width:"78",height:"78",style:{color:"currentcolor"},...e,children:o.jsxs("g",{children:[o.jsx("polygon",{fill:"currentColor",points:"226.83 411.15 501.31 803.15 623.31 803.15 348.82 411.15 226.83 411.15"}),o.jsx("polygon",{fill:"currentColor",points:"348.72 628.87 226.69 803.15 348.77 803.15 409.76 716.05 348.72 628.87"}),o.jsx("polygon",{fill:"currentColor",points:"651.23 196.85 440.28 498.12 501.32 585.29 773.31 196.85 651.23 196.85"}),o.jsx("polygon",{fill:"currentColor",points:"673.31 383.25 673.31 803.15 773.31 803.15 773.31 240.44 673.31 383.25"})]})}),UDr={warning:"bg-accent6Darker border-accent6/30 text-accent6",destructive:"bg-accent2Darker border-accent2/30 text-accent2",info:"bg-accent5Darker border-accent5/30 text-accent5"},VDr={warning:LE,destructive:_F,info:MR},Bl=({children:e,variant:t="destructive",className:r})=>{const n=VDr[t];return o.jsx("div",{className:Z(UDr[t],"p-3 rounded-md border shadow-sm",sn.all,"animate-in fade-in-0 slide-in-from-top-2 duration-200",r),children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(Ce,{className:"mt-0.5 shrink-0",children:o.jsx(n,{})}),o.jsx("div",{className:"text-neutral4",children:e})]})})},Ul=({children:e,as:t="h5"})=>o.jsx(me,{as:t,variant:"ui-md",className:"font-semibold",children:e}),$u=({children:e,as:t="p"})=>o.jsx(me,{as:t,variant:"ui-sm",children:e}),qDr={sm:"h-avatar-sm w-avatar-sm",md:"h-avatar-md w-avatar-md",lg:"h-avatar-lg w-avatar-lg"},fdt=({src:e,name:t,size:r="sm",interactive:n=!1})=>o.jsx("div",{className:Z(qDr[r],"border border-border1 bg-surface3 shrink-0 overflow-hidden rounded-full flex items-center justify-center",sn.all,n&&"cursor-pointer hover:scale-105 hover:border-neutral2 hover:shadow-sm"),children:e?o.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover"}):o.jsx(me,{variant:"ui-md",className:"text-center text-neutral4",children:t[0].toUpperCase()})}),HDr={default:"text-neutral3 bg-surface4",success:"text-accent1 bg-accent1Dark",error:"text-accent2 bg-accent2Dark",info:"text-accent5 bg-accent5Dark",warning:"text-accent6 bg-accent6Dark"},QDr={default:"text-neutral3",success:"text-accent1",error:"text-accent2",info:"text-accent5",warning:"text-accent6"},gt=({icon:e,variant:t="default",className:r,children:n,...s})=>o.jsxs("div",{className:Z("font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border border-border1 shrink-0",sn.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":HDr[t],r),...s,children:[e&&o.jsx("span",{className:QDr[t],children:o.jsx(Ce,{children:e})}),n]}),Za=({children:e,label:t})=>o.jsx("nav",{"aria-label":t,children:o.jsx("ol",{className:"gap-0.5 flex items-center",children:e})}),jr=({className:e,as:t,isCurrent:r,action:n,...s})=>{const a=t||"span";return o.jsxs(o.Fragment,{children:[o.jsxs("li",{className:"flex h-full shrink-0 items-center gap-1",children:[o.jsx(a,{"aria-current":r?"page":void 0,className:Z("text-ui-md leading-ui-md flex items-center gap-2",sn.colors,r?"text-white":"text-neutral3 hover:text-neutral5",e),...s}),n]}),!r&&o.jsx("li",{role:"separator",className:"flex h-full items-center",children:o.jsx(Ce,{className:Z("text-neutral2",sn.colors),children:o.jsx(RDr,{})})})]})};function WDr(e,t=5){if(!e?.properties)return[];const r=[];function n(s,a,i){if(i>t)return;const l=Array.isArray(s.type)?s.type.join(" | "):s.type;if(r.push({path:a,label:a,description:s.description??s.title,type:l}),s.properties)for(const[c,u]of Object.entries(s.properties))n(u,`${a}.${c}`,i+1);if(s.items?.properties)for(const[c,u]of Object.entries(s.items.properties))n(u,`${a}[].${c}`,i+1)}for(const[s,a]of Object.entries(e.properties))n(a,s,1);return r}function GDr(e){const t=WDr(e);return qWe({override:[ZDr(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function ZDr(e){return t=>{const n=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!n)return null;const s=n[1]??"",a=t.pos-s.length,i=s?e.filter(c=>c.path.toLowerCase().startsWith(s.toLowerCase())):e;if(i.length===0)return null;const l=i.map(c=>({label:c.path,displayLabel:c.path,detail:c.type,info:c.description,apply:(u,d,f,h)=>{const g=u.state.sliceDoc(h,h+2)==="}}"?d.label:`${d.label}}}`;u.dispatch({changes:{from:f,to:h,insert:g},selection:{anchor:f+g.length}})}}));return{from:a,options:l,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const YDr=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,XDr=er.mark({class:"cm-variable-highlight"}),WIe=new sWe({regexp:YDr,decoration:()=>XDr}),KDr=Si.fromClass(class{decorations;constructor(e){this.decorations=WIe.createDeco(e)}update(e){this.decorations=WIe.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),JDr=KDr,eLr={duration:5e3,cancel:{label:o.jsx(Ce,{children:o.jsx(Xl,{})}),onClick:()=>{}},unstyled:!0,classNames:{toast:"bg-surface3 w-full h-auto rounded-xl gap-2 border border-border1 px-3 py-2 flex items-center justify-between pointer-events-auto shadow-card :data-content:flex-1",title:"text-xs font-medium text-neutral5",description:"text-xs text-neutral3",cancelButton:"bg-transparent! hover:bg-surface2! border-none! rounded-md! p-1.5! m-0! text-neutral3! hover:text-neutral6! shrink-0 transition-all",actionButton:"bg-white! flex items-center justify-center font-medium text-black! order-last hover:opacity-80"}};function rf(e){const{classNames:t,...r}=eLr,{classNames:n,...s}=e||{};return{...r,classNames:{...t,title:Z(t?.title,n?.title),toast:Z(t?.toast,n?.toast),cancelButton:Z(t?.cancelButton,n?.cancelButton),actionButton:Z(t?.actionButton,n?.actionButton),description:Z(t?.description,n?.description)},...s}}const ze=(e,t={})=>{if(Array.isArray(e))return e.forEach(r=>vc(r,rf(t)));if(je.isValidElement(e))return vc(e,rf(t));if(typeof e=="string")return vc(e,rf(t));throw new Error("Invalid message type")};ze.success=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent1 shrink-0",children:o.jsx(KFt,{})}),classNames:{...t.classNames,toast:Z("bg-accent1Darker border-accent1/30 border-l-[3px] border-l-accent1",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return vc.success(e,rf(r));case"object":return e.forEach(n=>vc.success(n,rf(r)))}};ze.error=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent2 shrink-0",children:o.jsx(OHe,{})}),classNames:{...t.classNames,toast:Z("bg-accent2Darker border-accent2/30 border-l-[3px] border-l-accent2",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return vc.error(e,rf(r));case"object":return e.forEach(n=>vc.error(n,rf(r)))}};ze.warning=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent6 shrink-0",children:o.jsx(_F,{})}),classNames:{...t.classNames,toast:Z("bg-accent6Darker border-accent6/30 border-l-[3px] border-l-accent6",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return vc.warning(e,rf(r));case"object":return e.forEach(n=>vc.warning(n,rf(r)))}};ze.info=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent3 shrink-0",children:o.jsx(MR,{})}),classNames:{...t.classNames,toast:Z("bg-accent3Darker border-accent3/30 border-l-[3px] border-l-accent3",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return vc.info(e,rf(r));case"object":return e.forEach(n=>vc.info(n,rf(r)))}};ze.custom=(e,t={})=>vc(e,rf(t));ze.dismiss=e=>{e&&vc.dismiss(e)};ze.promise=({myPromise:e,loadingMessage:t,successMessage:r,errorMessage:n,onSuccess:s,onError:a,options:i={}})=>vc.promise(e,{loading:t??"Loading...",success:l=>(s?.(l),r),error:l=>(a?.(l),n||l?.message||"Error..."),...rf(i)});function ff({text:e,copyMessage:t="Copied to clipboard!"}){const[r,n]=b.useState(!1),s=b.useRef(null),a=b.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{ze.success(t),n(!0),s.current&&(clearTimeout(s.current),s.current=null),s.current=setTimeout(()=>{n(!1)},2e3)}).catch(()=>{ze.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:r,handleCopy:a}}function Xa({content:e,copyMessage:t,tooltip:r="Copy to clipboard",size:n="sm",className:s}){const[a,i]=b.useState(!1),{handleCopy:l}=ff({text:e,copyMessage:t}),c=()=>{l(),i(!0),setTimeout(()=>i(!1),2e3)};return o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(pe,{onClick:c,type:"button",size:n,className:s,"aria-label":a?"Copied!":r,children:a?o.jsx(dv,{}):o.jsx(_He,{})})}),o.jsx(Wr,{children:a?"Copied!":r})]})}const Qn=Kue()(qZt(e=>({requestContext:{},theme:"dark",setRequestContext:t=>e({requestContext:t}),setTheme:t=>e({theme:t})}),{name:"mastra-playground-store"})),cie=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;function tLr(e){return cie?.addEventListener("change",e),()=>cie?.removeEventListener("change",e)}function rLr(){return cie?.matches??!0}function IP(){const e=Qn(r=>r.theme),t=b.useSyncExternalStore(tLr,rLr,()=>!0);return e==="system"?t:e==="dark"}function nLr(){const e=VE({settings:{fontFamily:"var(--geist-mono)",fontSize:"0.8rem",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"var(--neutral2)",background:"transparent",foreground:"var(--neutral6)",caret:"var(--neutral6)"},styles:[{tag:[ne.className,ne.propertyName],color:"var(--neutral6)"},{tag:ne.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[ne.heading1,ne.heading2,ne.heading3,ne.heading4,ne.heading5,ne.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:ne.emphasis,fontStyle:"italic",color:"var(--neutral6)"},{tag:ne.strong,fontWeight:"bold",color:"var(--neutral6)"},{tag:ne.link,color:"var(--accent3)",textDecoration:"underline"},{tag:ne.url,color:"var(--accent3)"},{tag:ne.monospace,color:"var(--neutral6)"},{tag:ne.strikethrough,textDecoration:"line-through"},{tag:ne.quote,fontStyle:"italic",color:"var(--neutral2)"}]}),t=ft.theme({".cm-editor":{backgroundColor:"transparent"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-lineNumbers .cm-gutterElement":{color:"var(--neutral2)"},".cm-activeLineGutter":{color:"var(--neutral3)"},".cm-cursor":{borderLeftColor:"var(--neutral6)"},".cm-selectionBackground, .cm-content ::selection":{backgroundColor:"color-mix(in srgb, var(--accent3) 22%, transparent)"},".cm-tooltip-autocomplete":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.2)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"var(--neutral6)"},".cm-completionDetail":{color:"var(--neutral3)",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",color:"var(--neutral3)",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"var(--surface4)",color:"var(--neutral6)"},".cm-line .cm-variable-highlight":{color:"var(--accent6) !important",fontWeight:"500"}});return[e,t]}function sLr(){const e=ft.theme({"&":{backgroundColor:"transparent",color:"var(--neutral6)",fontSize:"0.8rem"},"&.cm-editor .cm-scroller":{fontFamily:"var(--geist-mono)"},".cm-gutters":{backgroundColor:"transparent",color:"var(--neutral2)",borderRight:"none"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-activeLine":{backgroundColor:"transparent"},".cm-lineNumbers .cm-gutterElement":{color:"var(--neutral2)"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"var(--neutral3)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--neutral6)"},"&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection":{background:"color-mix(in srgb, var(--accent3) 22%, transparent) !important"},".cm-tooltip-autocomplete":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.2)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"var(--neutral6)"},".cm-completionDetail":{color:"var(--neutral3)",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",color:"var(--neutral3)",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"var(--surface4)",color:"var(--neutral6)"},".cm-line .cm-variable-highlight":{color:"var(--accent6) !important",fontWeight:"500"}}),t=$p.define([{tag:[ne.comment,ne.bracket],color:"var(--neutral2)"},{tag:[ne.string,ne.meta,ne.regexp],color:"var(--accent1)"},{tag:[ne.atom,ne.bool,ne.special(ne.variableName)],color:"var(--accent6)"},{tag:[ne.keyword,ne.operator,ne.tagName],color:"var(--accent2)"},{tag:[ne.function(ne.propertyName),ne.propertyName],color:"var(--accent5)"},{tag:[ne.definition(ne.variableName),ne.function(ne.variableName),ne.className,ne.attributeName],color:"var(--accent3)"},{tag:[ne.variableName,ne.number],color:"var(--accent5)"},{tag:[ne.name,ne.quote],color:"var(--accent1)"},{tag:ne.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[ne.heading1,ne.heading2,ne.heading3,ne.heading4,ne.heading5,ne.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:[ne.emphasis],fontStyle:"italic",color:"var(--neutral6)"},{tag:[ne.strong],fontWeight:"bold",color:"var(--neutral6)"},{tag:ne.link,color:"var(--accent3)",textDecoration:"underline"},{tag:ne.url,color:"var(--accent3)"},{tag:ne.monospace,color:"var(--neutral6)"},{tag:ne.strikethrough,textDecoration:"line-through"},{tag:[ne.deleted],color:"var(--accent2)"},{tag:ne.invalid,color:"var(--error)"},{tag:[ne.standard(ne.tagName)],color:"var(--accent1)"}]);return[e,Yx(t)]}const kv=()=>{const e=IP();return b.useMemo(()=>e?nLr():sLr(),[e])},hs=b.forwardRef(({data:e,value:t,onChange:r,showCopyButton:n=!0,className:s,language:a="json",highlightVariables:i=!1,placeholder:l,schema:c,autoFocus:u,lineNumbers:d=!0,editable:f,...h},p)=>{const m=kv(),g=e?JSON.stringify(e,null,2):t??"",y=b.useMemo(()=>{const x=[];return a==="json"?x.push(Xd):a==="markdown"&&(x.push(Uue({base:pS,codeLanguages:fZe})),x.push(ft.lineWrapping)),i&&a==="markdown"&&x.push(JDr),c&&a==="markdown"&&x.push(GDr(c)),f===!1&&x.push(zn.readOnly.of(!0)),x},[a,i,c,f]);return o.jsxs("div",{className:Z("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",s),...h,children:[n&&o.jsx(Xa,{content:g,className:"absolute top-2 right-2 z-20"}),o.jsx(xc,{ref:p,value:g,theme:m,extensions:y,onChange:r,editable:f,"aria-label":"Code editor",placeholder:l,height:"100%",style:{height:"100%"},autoFocus:u,basicSetup:{lineNumbers:d}})]})});async function aLr(e,t){const{codeToTokens:r,bundledLanguages:n}=await Ke(async()=>{const{codeToTokens:a,bundledLanguages:i}=await import("./index-L5xMFg-b.js");return{codeToTokens:a,bundledLanguages:i}},__vite__mapDeps([23,1]),import.meta.url);if(!(t in n))return null;const{tokens:s}=await r(e,{lang:t,defaultColor:!1,themes:{light:"github-light",dark:"github-dark"}});return s}function Ka({iconSlot:e,titleSlot:t,descriptionSlot:r,actionSlot:n,className:s,as:a="h3"}){return o.jsxs("div",{className:Z("flex flex-col items-center justify-center text-center py-10 px-6","transition-opacity duration-normal ease-out-custom",s),children:[e&&o.jsx("div",{className:"mb-4",children:e}),o.jsx(a,{className:"font-medium text-neutral5 text-ui-md",children:t}),r&&o.jsx("p",{className:"mt-1.5 text-neutral3 text-ui-sm max-w-md",children:r}),n&&o.jsx("div",{className:"mt-5",children:n})]})}const kf=({children:e,className:t,onClick:r})=>o.jsx("div",{tabIndex:r?0:void 0,onKeyDown:n=>{r&&(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),r?.())},className:Z("flex gap-3 group/entity bg-surface3 rounded-xl border border-border1 py-3 px-4",r&&"cursor-pointer hover:bg-surface4 transition-all",t),onClick:r,children:e}),hdt=({children:e,className:t,style:r})=>o.jsx(Ce,{size:"lg",className:Z("text-neutral3 mt-1 shrink-0",t),style:r,children:e}),_f=({children:e,className:t})=>o.jsx(me,{as:"p",variant:"ui-lg",className:Z("text-neutral6 font-medium",t),children:e}),Ef=({children:e,className:t})=>o.jsx(me,{as:"div",variant:"ui-sm",className:Z("text-neutral3",t),children:e}),Cf=({children:e,className:t})=>o.jsx("div",{className:Z("flex-1 w-full",t),children:e});function Gs({resource:e,title:t,description:r,actionSlot:n,className:s}){const a="Permission Denied",i=e?`You don't have permission to access ${e}. Contact your administrator for access.`:"You don't have permission to access this resource. Contact your administrator for access.";return o.jsx(Ka,{className:s,iconSlot:o.jsx(Ce,{size:"lg",className:"text-neutral3",children:o.jsx(Gzt,{})}),titleSlot:t??a,descriptionSlot:r??i,actionSlot:n})}function na({title:e,description:t,className:r}){const[n,s]=b.useState(!1),a=Ge(),i=b.useCallback(async()=>{try{s(!0);const{baseUrl:l="",apiPrefix:c}=a.options||{},u=(c||"/api").trim(),d=(u.startsWith("/")?u:`/${u}`).replace(/\/$/,""),f=new URLSearchParams({redirect_uri:window.location.href}),h=`${l}${d}/auth/sso/login?${f}`,p=await fetch(h,{credentials:"include",headers:{"Content-Type":"application/json"}});if(p.ok){const m=await p.json();window.location.href=m.url}}finally{s(!1)}},[a]);return o.jsx(Ka,{className:r,iconSlot:o.jsx(Ce,{size:"lg",className:"text-neutral3",children:o.jsx(Bzt,{})}),titleSlot:e??"Session Expired",descriptionSlot:t??"Your session has expired. Please log in again to continue.",actionSlot:o.jsx(pe,{variant:"default",onClick:i,disabled:n,children:n?"Redirecting...":"Log in"})})}const En=({children:e,border:t=!0,className:r})=>o.jsx("header",{className:Z("h-header-default z-50 flex w-full items-center gap-4 bg-transparent px-3",{"border-b border-border1":t},r),children:e}),Zu=({children:e})=>o.jsx(me,{as:"h1",variant:"ui-md",className:"text-neutral6 flex items-center gap-2",children:e}),pu=({children:e})=>o.jsx("div",{className:"ml-auto flex items-center gap-3",children:e}),iLr=({children:e})=>o.jsx("div",{className:"gap-2 flex items-center",children:e}),tx=e=>o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 34 21",fill:"none",...e,children:o.jsx("path",{d:"M4.49805 11.6934C6.98237 11.6934 8.99609 13.7081 8.99609 16.1924C8.9959 18.6765 6.98225 20.6904 4.49805 20.6904C2.01394 20.6903 0.000196352 18.6765 0 16.1924C0 13.7081 2.01382 11.6935 4.49805 11.6934ZM10.3867 0C12.8709 0 14.8846 2.01388 14.8848 4.49805C14.8848 4.8377 14.847 5.16846 14.7755 5.48643C14.4618 6.88139 14.1953 8.4633 14.9928 9.65L16.2575 11.5319C16.3363 11.6491 16.4727 11.7115 16.6137 11.703C16.7369 11.6957 16.8525 11.6343 16.9214 11.5318L18.1876 9.64717C18.9772 8.47198 18.7236 6.90783 18.4205 5.52484C18.3523 5.21392 18.3164 4.89094 18.3164 4.55957C18.3167 2.07546 20.3313 0.0615234 22.8154 0.0615234C25.2994 0.0617476 27.3132 2.0756 27.3135 4.55957C27.3135 4.93883 27.2665 5.30712 27.178 5.65896C26.8547 6.94441 26.5817 8.37932 27.2446 9.52714L28.459 11.6301C28.4819 11.6697 28.5245 11.6934 28.5703 11.6934C31.0545 11.6935 33.0684 13.7081 33.0684 16.1924C33.0682 18.6765 31.0544 20.6903 28.5703 20.6904C26.0861 20.6904 24.0725 18.6765 24.0723 16.1924C24.0723 15.8049 24.1212 15.4288 24.2133 15.0701C24.5458 13.7746 24.8298 12.3251 24.1609 11.1668L23.0044 9.16384C22.9656 9.09659 22.8931 9.05859 22.8154 9.05859C22.7983 9.05859 22.7824 9.06614 22.7728 9.08033L21.4896 10.9895C20.686 12.1851 20.9622 13.781 21.284 15.1851C21.3582 15.5089 21.3975 15.8461 21.3975 16.1924C21.3973 18.6764 19.3834 20.6902 16.8994 20.6904C14.4152 20.6904 12.4006 18.6765 12.4004 16.1924C12.4004 15.932 12.4226 15.6768 12.4651 15.4286C12.6859 14.14 12.8459 12.7122 12.1167 11.6271L11.2419 10.3253C10.6829 9.49347 9.71913 9.05932 8.78286 8.70188C7.0906 8.05584 5.88867 6.41734 5.88867 4.49805C5.88886 2.0139 7.90254 3.29835e-05 10.3867 0Z",fill:"currentColor"})}),oLr={default:"[&>tbody>tr]:h-table-row",small:"[&>tbody>tr]:h-table-row-small"},lLr=({className:e,children:t,size:r="default",style:n})=>o.jsx("table",{className:Z("w-full",oLr[r],e),style:n,children:t}),cLr=({className:e,children:t})=>o.jsx("thead",{children:o.jsx("tr",{className:Z("h-table-header border-b border-border1 bg-surface2/80",e),children:t})}),uLr=({className:e,children:t,...r})=>o.jsx("th",{className:Z("text-neutral2 text-ui-xs h-full whitespace-nowrap text-left font-medium uppercase tracking-wide first:pl-3 last:pr-3",e),...r,children:t}),dLr=({className:e,children:t,...r})=>o.jsx("tbody",{className:Z("",e),...r,children:t}),fLr=b.forwardRef(({className:e,children:t,selected:r=!1,style:n,onClick:s,isActive:a=!1,...i},l)=>{const c=b.useRef(null);b.useEffect(()=>{l&&(typeof l=="function"?l(c.current):l.current=c.current)},[l]),b.useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.scrollIntoView({block:"nearest"}))},[a]);const u=d=>{d.key==="Enter"&&s&&s()};return o.jsx("tr",{className:Z("border-b border-border1","transition-colors duration-normal ease-out-custom","hover:bg-surface3","focus:bg-surface3 focus:outline-hidden focus:ring-1 focus:ring-inset focus:ring-accent1/50",r&&"bg-surface4",s&&"cursor-pointer",e),style:n,onClick:s,ref:c,tabIndex:s?0:void 0,onKeyDown:u,"data-active":a||void 0,...i,children:t})}),hLr=({className:e,children:t,...r})=>o.jsx("td",{className:Z("text-neutral5 first:pl-3 last:pr-3",e),...r,children:o.jsx("div",{className:Z("flex h-full w-full shrink-0 items-center"),children:t})}),GIe=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ZIe=Uut,gC=(e,t)=>r=>{var n;if(t?.variants==null)return ZIe(e,r?.class,r?.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(u=>{const d=r?.[u],f=a?.[u];if(d===null)return null;const h=GIe(d)||GIe(f);return s[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(m=>{let[g,y]=m;return Array.isArray(y)?y.includes({...a,...l}[g]):{...a,...l}[g]===y})?[...u,f,h]:u},[]);return ZIe(e,i,c,r?.class,r?.className)},pLr=gC(Z("flex w-full text-neutral6 border bg-transparent","transition-all duration-normal ease-out-custom","placeholder:text-neutral2 placeholder:transition-opacity placeholder:duration-normal","focus:placeholder:opacity-70","min-h-[80px] resize-y"),{variants:{variant:{default:Z(nme,sme,ame),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:"px-2 py-1.5 text-ui-sm",md:"px-3 py-2 text-ui-sm",default:"px-3 py-2 text-ui-md",lg:"px-4 py-3 text-ui-sm"}},defaultVariants:{variant:"default",size:"default"}}),bc=b.forwardRef(({className:e,size:t,testId:r,variant:n,error:s,...a},i)=>o.jsx("textarea",{className:Z(pLr({variant:n,size:t}),s&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":r,ref:i,"aria-invalid":s,...a}));bc.displayName="Textarea";const mLr=rXt,gLr=nXt,pdt=sXt;function Bt({open:e,onOpenChange:t,children:r}){return o.jsx(mLr,{open:e,onOpenChange:t,children:r})}const dme=b.forwardRef(({className:e,...t},r)=>o.jsx(QYe,{className:Z("fixed inset-0 z-50 bg-overlay backdrop-blur-sm","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:duration-200","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:duration-150",e),...t,ref:r}));dme.displayName=QYe.displayName;const mdt=b.forwardRef(({className:e,...t},r)=>o.jsxs(pdt,{children:[o.jsx(dme,{}),o.jsx(WYe,{ref:r,className:Z("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border1 bg-surface3 p-6 shadow-dialog rounded-md","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] data-[state=open]:duration-200","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=closed]:duration-150",e),...t})]}));mdt.displayName=WYe.displayName;const gdt=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col space-y-2 text-center sm:text-left",e),...t});gdt.displayName="AlertDialogHeader";const ydt=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ydt.displayName="AlertDialogFooter";const vdt=b.forwardRef(({className:e,...t},r)=>o.jsx(YYe,{ref:r,className:Z("text-lg font-semibold",e),...t}));vdt.displayName=YYe.displayName;const bdt=b.forwardRef(({className:e,...t},r)=>o.jsx(XYe,{ref:r,className:Z("text-sm text-neutral3",e),...t}));bdt.displayName=XYe.displayName;const xdt=b.forwardRef(({className:e,...t},r)=>o.jsx(GYe,{ref:r,className:Z(pC({variant:"primary",size:"default"}),e),...t}));xdt.displayName=GYe.displayName;const wdt=b.forwardRef(({className:e,...t},r)=>o.jsx(ZYe,{ref:r,className:Z(pC({variant:"default",size:"default"}),"mt-2 sm:mt-0",e),...t}));wdt.displayName=ZYe.displayName;Bt.Trigger=gLr;Bt.Portal=pdt;Bt.Overlay=dme;Bt.Content=mdt;Bt.Header=gdt;Bt.Footer=ydt;Bt.Title=vdt;Bt.Description=bdt;Bt.Action=xdt;Bt.Cancel=wdt;const di=b.forwardRef(({className:e,...t},r)=>o.jsx(nde,{ref:r,className:Z("peer h-4 w-4 shrink-0 rounded-sm border border-neutral3","shadow-sm",sn.all,"hover:border-neutral5 hover:shadow-md",AP,"disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-neutral3 disabled:hover:shadow-sm","data-[state=checked]:bg-accent1 data-[state=checked]:border-accent1 data-[state=checked]:text-surface1","data-[state=checked]:shadow-glow-accent1",e),...t,children:o.jsx(tXe,{className:Z("flex items-center justify-center text-current","data-[state=checked]:animate-in data-[state=checked]:zoom-in-50 data-[state=checked]:duration-150"),children:o.jsx(dv,{className:"h-3.5 w-3.5 stroke-3"})})}));di.displayName=nde.displayName;const Ap=fXt,jh=je.forwardRef(({className:e,children:t,...r},n)=>o.jsx(ade,{ref:n,className:Z("-outline-offset-2",sn.colors,c0.visible,"hover:text-neutral5","[&>svg]:transition-transform [&>svg]:duration-normal [&>svg]:ease-out-custom","[&[data-state=open]>svg]:rotate-90",e),...r,children:t}));jh.displayName=ade.displayName;const Th=je.forwardRef(({className:e,children:t,...r},n)=>o.jsx(ode,{ref:n,className:Z("overflow-hidden","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-top-1","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-1","duration-normal ease-out-custom",e),...r,children:t}));Th.displayName=ode.displayName;const gn={root:"flex flex-col gap-1.5",trigger:"w-full min-w-32 justify-between",triggerError:"border-accent2",chevron:"ml-2 h-4 w-4 shrink-0 opacity-50",placeholder:"text-neutral3",popup:Z("min-w-(--anchor-width) w-max max-w-[500px] rounded-md bg-surface3 text-neutral5","shadow-elevated","origin-(--transform-origin)","transition-[transform,scale,opacity] duration-150 ease-out","data-starting-style:scale-95 data-starting-style:opacity-0","data-ending-style:scale-95 data-ending-style:opacity-0"),positioner:"z-50 pointer-events-auto",searchContainer:Z("flex items-center border-b border-border1 px-3 py-2",sn.colors),searchIcon:Z("mr-2 h-4 w-4 shrink-0 text-neutral3",sn.colors),searchInput:Z("flex h-8 w-full rounded-md bg-transparent py-1 text-sm","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-hidden",sn.colors),empty:"not-empty:block hidden py-6 text-center text-sm text-neutral3",list:"max-h-dropdown-max-height overflow-y-auto overflow-x-hidden p-1",item:Z("relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm",sn.colors,"data-highlighted:bg-surface5 data-highlighted:text-neutral5"),itemSelected:"data-selected:bg-accent1Dark data-selected:text-accent1",checkContainer:"mr-2 flex h-4 w-4 shrink-0 items-center justify-center",checkIcon:Z("h-4 w-4 text-accent1",sn.opacity),checkbox:"mr-2 flex h-4 w-4 shrink-0 items-center justify-center rounded border",checkboxSelected:"bg-accent1 border-accent1",checkboxUnselected:"border-border1",checkboxIcon:"h-3 w-3 text-white",optionContent:"flex items-center gap-2 w-full min-w-0",optionText:"flex flex-col gap-0.5 min-w-0",optionLabel:"truncate",optionDescription:"text-xs text-neutral3 truncate",optionEnd:"ml-auto",error:"text-xs text-accent2"};function Kl({options:e,value:t,onValueChange:r,placeholder:n="Select option...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:l=!1,variant:c="inputLike",size:u="default",open:d,onOpenChange:f,container:h,error:p}){const m=e.find(y=>y.value===t)??null,g=y=>{y&&r?.(y.value)};return o.jsxs("div",{className:gn.root,children:[o.jsxs(sKe,{items:e,value:m,onValueChange:g,disabled:l,open:d,onOpenChange:f,children:[o.jsxs(fKe,{className:Z(pC({variant:c,size:u}),gn.trigger,p&&gn.triggerError,i),children:[o.jsxs("span",{className:"truncate flex items-center gap-2",children:[m?.start,o.jsx(VJt,{placeholder:n})]}),o.jsx(kF,{className:gn.chevron})]}),o.jsx(gKe,{container:h,children:o.jsx(bKe,{align:"start",sideOffset:4,className:gn.positioner,children:o.jsxs(xKe,{className:gn.popup,children:[o.jsxs("div",{className:gn.searchContainer,children:[o.jsx(w_,{className:gn.searchIcon}),o.jsx(dKe,{className:gn.searchInput,placeholder:s})]}),o.jsx(_Ke,{className:gn.empty,children:a}),o.jsx(pKe,{className:gn.list,children:y=>o.jsxs(kKe,{value:y,className:Z(gn.item,gn.itemSelected),children:[o.jsx("span",{className:gn.checkContainer,children:o.jsx(Ner,{children:o.jsx(dv,{className:gn.checkIcon})})}),o.jsxs("span",{className:gn.optionContent,children:[y.start,o.jsxs("span",{className:gn.optionText,children:[o.jsx("span",{className:gn.optionLabel,children:y.label}),y.description&&o.jsx("span",{className:gn.optionDescription,children:y.description})]}),y.end?o.jsx("div",{className:gn.optionEnd,children:y.end}):null]})]},y.value)})]})})})]}),p&&o.jsx("span",{className:gn.error,children:p})]})}function Sdt({options:e,value:t=[],onValueChange:r,placeholder:n="Select options...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:l=!1,variant:c="default",size:u="md",open:d,onOpenChange:f,container:h,error:p}){const m=e.filter(x=>t.includes(x.value)),g=x=>{x&&r?.(x.map(w=>w.value))},y=m.length===0?n:`${m.length} selected`;return o.jsxs("div",{className:gn.root,children:[o.jsxs(sKe,{multiple:!0,items:e,value:m,onValueChange:g,disabled:l,open:d,onOpenChange:f,children:[o.jsxs(fKe,{className:Z(pC({variant:c,size:u}),gn.trigger,p&&gn.triggerError,i),children:[o.jsx("span",{className:Z("truncate",m.length===0&&gn.placeholder),children:y}),o.jsx(kF,{className:gn.chevron})]}),o.jsx(gKe,{container:h,children:o.jsx(bKe,{align:"start",sideOffset:4,className:gn.positioner,children:o.jsxs(xKe,{className:gn.popup,children:[o.jsxs("div",{className:gn.searchContainer,children:[o.jsx(w_,{className:gn.searchIcon}),o.jsx(dKe,{className:gn.searchInput,placeholder:s})]}),o.jsx(_Ke,{className:gn.empty,children:a}),o.jsx(pKe,{className:gn.list,children:x=>{const w=t.includes(x.value);return o.jsxs(kKe,{value:x,className:gn.item,children:[o.jsx("span",{className:Z(gn.checkbox,w?gn.checkboxSelected:gn.checkboxUnselected),children:w&&o.jsx(dv,{className:gn.checkboxIcon})}),o.jsxs("span",{className:gn.optionContent,children:[x.start,o.jsxs("span",{className:gn.optionText,children:[o.jsx("span",{className:gn.optionLabel,children:x.label}),x.description&&o.jsx("span",{className:gn.optionDescription,children:x.description})]}),x.end?o.jsx("div",{className:gn.optionEnd,children:x.end}):null]})]},x.value)}})]})})})]}),p&&o.jsx("span",{className:gn.error,children:p})]})}const kn=QF,Odt=IYe,yLr=WF,vLr=WR,kdt=b.forwardRef(({className:e,...t},r)=>o.jsx(HR,{ref:r,className:Z("fixed inset-0 z-50 bg-overlay backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));kdt.displayName=HR.displayName;const xn=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(yLr,{children:[o.jsx(kdt,{}),o.jsxs(QR,{ref:n,className:Z("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]","gap-4 border border-border1 bg-surface3 py-6 shadow-dialog rounded-lg","duration-slow","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-bottom-4","data-[state=open]:slide-in-from-bottom-4",e),...r,children:[t,o.jsxs(WR,{className:Z("absolute right-4 top-4 rounded-md p-1","text-neutral3 hover:text-neutral6 hover:bg-surface4","transition-all duration-normal ease-out-custom","focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring","disabled:pointer-events-none"),children:[o.jsx(Xl,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));xn.displayName=QR.displayName;const _n=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col space-y-1.5 text-center sm:text-left border-b border-border1 pb-4 px-6",e),...t});_n.displayName="DialogHeader";const hf=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});hf.displayName="DialogFooter";const qn=({className:e,...t})=>o.jsx("div",{className:Z("overflow-y-auto px-6 max-h-[50vh]",e),...t});qn.displayName="DialogBody";const wn=b.forwardRef(({className:e,...t},r)=>o.jsx(GF,{ref:r,className:Z("text-ui-md font-medium",e),...t}));wn.displayName=GF.displayName;const Js=b.forwardRef(({className:e,...t},r)=>o.jsx(ZF,{ref:r,className:Z("sr-only",e),...t}));Js.displayName=ZF.displayName;const _dt=b.forwardRef(({className:e,...t},r)=>o.jsx(ad,{ref:r,className:Z("flex h-full w-full flex-col overflow-hidden rounded-md bg-surface3 text-neutral5",e),...t}));_dt.displayName=ad.displayName;const bLr=({children:e,title:t="Command Palette",description:r="Search for commands and actions",...n})=>{const s=b.useCallback((i,l)=>{const c=i.toLowerCase();return l.toLowerCase().split(/\s+/).filter(Boolean).every(h=>c.includes(h))?1:0},[]),a=b.useCallback(i=>{i.stopPropagation()},[]);return o.jsx(kn,{...n,children:o.jsxs(xn,{className:"overflow-hidden p-0",children:[o.jsx(wn,{className:"sr-only",children:t}),o.jsx(Js,{className:"sr-only",children:r}),o.jsx(_dt,{filter:s,onKeyDown:a,className:Z("**:[[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-neutral3","[&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 **:[[cmdk-group]]:px-2","[&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5","**:[[cmdk-input]]:h-12","**:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3","[&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5"),children:e})]})})},Edt=b.forwardRef(({className:e,...t},r)=>o.jsxs("div",{className:Z("flex items-center border-b border-border1 px-3",sn.colors),"cmdk-input-wrapper":"",children:[o.jsx(w_,{className:Z("mr-2 h-4 w-4 shrink-0 text-neutral3",sn.colors)}),o.jsx(ad.Input,{ref:r,className:Z("flex h-10 w-full rounded-md bg-transparent py-3 text-sm","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-hidden",sn.colors,e),...t})]}));Edt.displayName=ad.Input.displayName;const Cdt=b.forwardRef(({className:e,...t},r)=>o.jsx(ad.List,{ref:r,className:Z("max-h-dropdown-max-height overflow-y-auto overflow-x-hidden",e),...t}));Cdt.displayName=ad.List.displayName;const jdt=b.forwardRef((e,t)=>o.jsx(ad.Empty,{ref:t,className:"py-6 text-center text-sm text-neutral3",...e}));jdt.displayName=ad.Empty.displayName;const gb=b.forwardRef(({className:e,...t},r)=>o.jsx(ad.Group,{ref:r,className:Z("overflow-hidden p-1 text-neutral5","**:[[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-neutral3",e),...t}));gb.displayName=ad.Group.displayName;const cw=b.forwardRef(({className:e,...t},r)=>o.jsx(ad.Separator,{ref:r,className:Z("-mx-1 h-px bg-border1",e),...t}));cw.displayName=ad.Separator.displayName;const Zo=b.forwardRef(({className:e,...t},r)=>o.jsx(ad.Item,{ref:r,className:Z("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden",sn.colors,"data-[selected=true]:bg-surface5 data-[selected=true]:text-neutral5","data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Zo.displayName=ad.Item.displayName;const Tdt=({className:e,...t})=>o.jsx("span",{className:Z("ml-auto text-xs tracking-widest text-neutral3",e),...t});Tdt.displayName="CommandShortcut";function Ndt({children:e,className:t}){return o.jsx("div",{className:Z("border border-border1 rounded-lg p-6 bg-surface2",t),children:e})}const xLr=Crr,wLr=jrr,SLr=rP,OLr=Arr,kLr=Trr,fme=Z("relative flex cursor-pointer select-none items-center gap-3 rounded-lg px-3 py-1.5 text-sm transition-colors text-neutral4 dark:hover:text-white dark:focus:text-white hover:text-neutral6 focus:text-neutral6 hover:bg-surface4 focus:bg-surface4 active:bg-surface5 data-disabled:pointer-events-none data-disabled:opacity-50 [&>span]:truncate [&_svg]:size-4 [&_svg]:shrink-0 focus-visible:outline-hidden focus-visible:ring-0","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:opacity-50 [&>svg]:mx-[-.25em] [&:hover>svg]:opacity-100"),Adt=b.forwardRef(({className:e,children:t,...r},n)=>o.jsx(jJe,{ref:n,className:Z("cursor-pointer",e),...r,children:t}));Adt.displayName=jJe.displayName;const Idt=b.forwardRef(({className:e,inset:t,children:r,...n},s)=>o.jsxs(MJe,{ref:s,className:Z(fme,"data-[state=open]:bg-surface4",t&&"pl-8",e),...n,children:[r,o.jsx("span",{className:"ml-auto pl-2",children:o.jsx(Lce,{className:"-rotate-90 opacity-50"})})]}));Idt.displayName=MJe.displayName;const Rdt=b.forwardRef(({className:e,...t},r)=>o.jsx(rP,{children:o.jsx(lz,{ref:r,className:Z("bg-surface3 backdrop-blur-xl data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 z-50 min-w-44 max-h-[min(20rem,var(--radix-dropdown-menu-content-available-height))] overflow-x-hidden overflow-y-auto rounded-xl border-2 border-border1/50 p-1 shadow-md",e),...t})}));Rdt.displayName=lz.displayName;const Pdt=b.forwardRef(({className:e,container:t,sideOffset:r=8,...n},s)=>o.jsx(rP,{container:t,children:o.jsx(TJe,{ref:s,sideOffset:r,className:Z("bg-surface3 data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 backdrop-blur-xl text-neutral4 z-50 min-w-44 max-h-[min(20rem,var(--radix-dropdown-menu-content-available-height))] overflow-x-hidden overflow-y-auto rounded-xl border-2 border-border1/50 p-1 shadow-md",e),...n})}));Pdt.displayName=TJe.displayName;const Mdt=b.forwardRef(({className:e,...t},r)=>o.jsx(AJe,{ref:r,className:Z(fme,e),...t}));Mdt.displayName=AJe.displayName;const Ddt=b.forwardRef(({className:e,children:t,checked:r,...n},s)=>o.jsxs(IJe,{ref:s,className:Z(fme,"w-full gap-4 px-2",e),checked:r,...n,children:[o.jsx("div",{className:"border dark:border-white/20 border-black/20 flex h-4 w-4 items-center justify-center rounded-sm",children:r&&o.jsx(dv,{})}),t]}));Ddt.displayName=IJe.displayName;const Ldt=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(RJe,{ref:n,className:Z("relative flex cursor-pointer select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm transition-colors text-neutral4 dark:hover:text-white dark:focus:text-white hover:text-neutral6 focus:text-neutral6 hover:bg-surface4 focus:bg-surface4 active:bg-surface5 data-disabled:pointer-events-none data-disabled:opacity-50 focus-visible:outline-hidden focus-visible:ring-0",e),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(Nrr,{children:o.jsx(kHe,{className:"h-2 w-2 fill-current"})})}),t]}));Ldt.displayName=RJe.displayName;const $dt=b.forwardRef(({className:e,inset:t,...r},n)=>o.jsx(NJe,{ref:n,className:Z("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));$dt.displayName=NJe.displayName;const Fdt=b.forwardRef(({className:e,...t},r)=>o.jsx(PJe,{ref:r,className:Z("bg-border1/50 -mx-1.5 my-1 h-0.5",e),...t}));Fdt.displayName=PJe.displayName;const zdt=({className:e,...t})=>o.jsx("span",{className:Z("ml-auto text-xs tracking-widest opacity-60",e),...t});zdt.displayName="DropdownMenuShortcut";function vt({open:e,onOpenChange:t,children:r,modal:n}){return o.jsx(xLr,{modal:n,open:e,onOpenChange:t,children:r})}vt.Trigger=Adt;vt.Content=Pdt;vt.Group=wLr;vt.Portal=SLr;vt.Item=Mdt;vt.CheckboxItem=Ddt;vt.RadioItem=Ldt;vt.Label=$dt;vt.Separator=Fdt;vt.Shortcut=zdt;vt.Sub=OLr;vt.SubContent=Rdt;vt.SubTrigger=Idt;vt.RadioGroup=kLr;const KD=({label:e,children:t})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(me,{as:"p",variant:"ui-md",className:"text-neutral3",children:e}),t]});function Mn({className:e,...t}){return o.jsx("div",{className:Z("rounded-md bg-surface4 relative overflow-hidden","before:absolute before:inset-0","before:-translate-x-full","before:animate-[shimmer_2s_infinite]","before:bg-linear-to-r before:from-transparent before:via-surface5/20 before:to-transparent",e),...t})}const Bdt=({icon:e,title:t,isLoading:r,children:n})=>o.jsxs("div",{className:"p-5 w-full overflow-x-hidden",children:[o.jsxs("div",{className:"text-neutral6 flex items-center gap-2",children:[o.jsx(Ce,{size:"lg",className:"bg-surface4 rounded-md p-1",children:e}),r?o.jsx(Mn,{className:"h-3 w-1/3"}):o.jsx("div",{className:"flex min-w-0 items-center gap-4",children:o.jsx(me,{variant:"header-md",as:"h2",className:"truncate font-medium",children:t})})]}),n&&o.jsx("div",{className:"pt-2",children:n})]});function _Lr({children:e,className:t}){return o.jsx("div",{className:Z("grid gap-2 text-neutral4",t),children:e})}function ELr({children:e}){return o.jsxs("p",{className:Z("text-ui-sm text-neutral4 flex items-center gap-2","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-70 [&>svg]:text-red-400"),children:[o.jsx(LE,{})," ",e]})}function CLr({children:e}){return o.jsx("p",{className:"text-neutral3 text-ui-sm",children:e})}function jLr({children:e,name:t,required:r,size:n="default",className:s}){return o.jsxs("label",{htmlFor:`input-${t}`,className:Z("text-ui-smd text-neutral3 flex justify-between items-center ","in-[.horizontal-field-block]:grid in-[.horizontal-field-block]:content-start",{"text-ui-md":n==="bigger"},s),children:[e,r&&o.jsx("i",{className:"text-neutral2 text-xs",children:"(required)"})]})}function TLr({children:e,className:t,layout:r="vertical",labelColumnWidth:n}){return o.jsx("div",{className:Z("grid gap-2 text-neutral4",{"horizontal-field-block grid-cols-[auto_1fr] items-baseline":r==="horizontal"},t),style:r==="horizontal"&&n?{gridTemplateColumns:`${n} 1fr`}:void 0,children:e})}const mo=Object.assign({},{Layout:TLr,Column:_Lr,Label:jLr,HelpText:CLr,ErrorMsg:ELr});function NLr({children:e,className:t}){return o.jsx("div",{className:Z("grid gap-6 content-start",t),children:e})}function ALr({children:e,className:t,columns:r=1,gap:n}){return o.jsx("div",{className:Z("grid",{"grid-cols-1":r===1,"grid-cols-2":r===2},n??"gap-6",t),children:e})}Object.assign(ALr,{Column:NLr});const ILr=gC(Z("flex w-full text-neutral6 border bg-transparent","transition-all duration-normal ease-out-custom","placeholder:text-neutral2 placeholder:transition-opacity placeholder:duration-normal","focus:placeholder:opacity-70"),{variants:{variant:{default:Z(nme,sme,ame),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:`${Ql.sm} text-ui-sm px-[.75em]`,md:`${Ql.md} text-ui-md px-[.75em]`,default:`${Ql.default} text-ui-md px-[.85em]`,lg:`${Ql.lg} text-ui-lg px-[.85em]`}},defaultVariants:{variant:"default",size:"default"}}),sr=b.forwardRef(({className:e,size:t,testId:r,variant:n,type:s,error:a,...i},l)=>o.jsx("input",{type:s,className:Z(ILr({variant:n,size:t}),a&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":r,ref:l,"aria-invalid":a,...i}));sr.displayName="Input";function jx({name:e,value:t,label:r,labelIsHidden:n=!1,labelColumnWidth:s,helpText:a,errorMsg:i,required:l=!1,disabled:c=!1,labelSize:u,layout:d="vertical",placeholder:f,size:h="default",testId:p,className:m,...g}){return o.jsxs(mo.Layout,{layout:d,labelColumnWidth:s,className:m,children:[d==="horizontal"?o.jsx(mo.Column,{children:o.jsx(mo.Label,{name:e,required:l,size:u||"bigger",children:n?o.jsx(Ku,{children:r}):r})}):null,o.jsxs(mo.Column,{children:[!n&&d==="vertical"?o.jsx(mo.Label,{name:e,required:l,size:u||"default",children:r}):null,o.jsx(sr,{name:e,disabled:c,required:l,value:t,placeholder:f,"data-testid":p,size:h,...g}),a&&o.jsx(mo.HelpText,{children:a}),i&&o.jsx(mo.ErrorMsg,{children:i})]})]})}function Tx({name:e,helpText:t,errorMsg:r,required:n=!1,disabled:s=!1,value:a,label:i,labelIsHidden:l=!1,layout:c="vertical",placeholder:u="Search...",onChange:d,onReset:f,className:h,size:p,isMinimized:m,onMinimizedChange:g}){const y=b.useRef(null);return b.useEffect(()=>{m===!1&&y.current?.focus()},[m]),m?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(pe,{size:p||"sm","aria-label":i||"Search",disabled:s,onClick:()=>g?.(!1),children:o.jsx(w_,{})})}),o.jsx(Wr,{children:i||"Search"})]}):o.jsxs(mo.Layout,{layout:c,className:h,children:[c==="horizontal"?o.jsx(mo.Column,{children:o.jsx(mo.Label,{name:e,required:n,children:l?o.jsx(Ku,{children:i}):i})}):null,o.jsxs(mo.Column,{children:[c==="vertical"&&i&&!l?o.jsx(mo.Label,{name:e,required:n,children:i}):null,o.jsxs("div",{className:"relative group",children:[o.jsx(sr,{ref:y,name:e,disabled:s,value:a,placeholder:u,onChange:d,size:p,className:Z(p==="sm"&&"pl-8 pr-8",p==="md"&&"pl-9 pr-9",(!p||p==="default")&&"pl-10 pr-10",p==="lg"&&"pl-11 pr-11")}),o.jsx(w_,{"aria-hidden":"true",className:Z("text-neutral4 opacity-50 group-has-focus:opacity-100 absolute left-3 top-1/2 -translate-y-1/2",p==="sm"&&"w-3.5 h-3.5",p==="md"&&"w-4 h-4",(!p||p==="default")&&"w-[1.125rem] h-[1.125rem]",p==="lg"&&"w-5 h-5")}),f&&(a||m===!1)&&o.jsx(pe,{variant:"ghost",size:p||"default","aria-label":"Clear search",onClick:()=>{a&&f(),m===!1&&g?.(!0)},className:"absolute top-1/2 right-0 -translate-y-1/2",children:o.jsx(Xl,{})})]}),t&&o.jsx(mo.HelpText,{children:t}),r&&o.jsx(mo.ErrorMsg,{children:r})]})]})}const fi=inr,hi=onr,Ja=b.forwardRef(({className:e,children:t,variant:r="inputLike",size:n="default",...s},a)=>o.jsxs(iet,{ref:a,className:Z(pC({variant:r,size:n}),"justify-between [&>svg]:opacity-100",e),...s,children:[t,o.jsx(lnr,{asChild:!0,children:o.jsx(Lce,{className:Z("h-4 w-4 text-neutral3",sn.colors)})})]}));Ja.displayName=iet.displayName;const ei=b.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>o.jsx(cnr,{children:o.jsx(oet,{ref:s,className:Z("relative z-50 min-w-32 max-h-dropdown-max-height overflow-y-auto overflow-x-hidden rounded-md border border-border1 bg-surface3 text-neutral5 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",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:o.jsx(unr,{className:Z("p-1",r==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)"),children:t})})}));ei.displayName=oet.displayName;const ns=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(cet,{ref:n,className:Z("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-neutral5 text-sm",sn.colors,"hover:bg-surface5 hover:text-neutral5","focus:bg-surface5 focus:text-neutral5","data-[state=checked]:bg-accent1Dark data-[state=checked]:text-accent1","data-disabled:pointer-events-none data-disabled:opacity-50",e),...r,children:[o.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(fnr,{children:o.jsx(dv,{className:"h-4 w-4 text-accent1"})})}),o.jsx(dnr,{children:t})]}));ns.displayName=cet.displayName;function $o({name:e,helpText:t,errorMsg:r,required:n=!1,disabled:s=!1,size:a="default",value:i,label:l,labelIsHidden:c=!1,layout:u="vertical",labelColumnWidth:d,options:f,placeholder:h="Select an option",onValueChange:p,className:m}){return o.jsxs(mo.Layout,{layout:u,labelColumnWidth:d,className:m,children:[u==="horizontal"?o.jsx(mo.Column,{children:o.jsx(mo.Label,{name:e,required:n,children:c?o.jsx(Ku,{children:l}):l})}):null,o.jsxs(mo.Column,{children:[u==="vertical"&&l&&!c?o.jsx(mo.Label,{name:e,required:n,children:l}):null,o.jsxs(fi,{"aria-label":c?l:void 0,name:e,value:i,onValueChange:p,disabled:s,children:[o.jsx(Ja,{size:a,children:o.jsx(hi,{placeholder:h})}),o.jsx(ei,{children:f.map(g=>o.jsx(ns,{value:g.value,children:g.label},g.value))})]}),t&&o.jsx(mo.HelpText,{children:t}),r&&o.jsx(mo.ErrorMsg,{children:r})]})]})}const RLr={sm:`${Ql.sm} w-form-sm`,md:`${Ql.md} w-form-md`,lg:`${Ql.lg} w-form-lg`,default:`${Ql.default}`},PLr={sm:"sm",md:"default",lg:"lg",default:"default"},MLr={default:"bg-surface2 hover:bg-surface4 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",light:"bg-surface3 hover:bg-surface5 text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",outline:"bg-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",ghost:"bg-transparent border-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-accent1 hover:bg-accent1/90 text-surface1 font-medium hover:shadow-glow-accent1 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-none"},DLr="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",Dn=je.forwardRef(({className:e,children:t,tooltip:r,size:n="md",variant:s="default",disabled:a,...i},l)=>o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("button",{ref:l,disabled:a,"aria-label":typeof r=="string"?r:void 0,className:Z(DLr,AP,MLr[s],RLr[n],a&&"active:scale-100",e),...i,children:o.jsx(Ce,{size:PLr[n],children:t})})}),o.jsx(Wr,{children:r})]}));Dn.displayName="IconButton";const LLr=gC("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xt=b.forwardRef(({className:e,...t},r)=>o.jsx(det,{ref:r,className:Z(LLr(),e),...t}));xt.displayName=det.displayName;function K_({children:e}){const t=e.replace(/\\n/g,`
|
|
291
291
|
`);return o.jsx($et,{remarkPlugins:[ltt],components:FLr,className:"space-y-3",children:t})}const Udt=je.memo(({children:e,language:t,...r})=>{const[n,s]=b.useState([]);return b.useEffect(()=>{aLr(e,t).then(a=>{a&&s(a)})},[e,t]),n.length?o.jsx("pre",{...r,children:o.jsx("code",{children:n.map((a,i)=>o.jsxs(o.Fragment,{children:[o.jsx("span",{children:a.map((l,c)=>{const u=typeof l.htmlStyle=="string"?void 0:l.htmlStyle;return o.jsx("span",{className:"text-shiki-light bg-shiki-light-bg dark:text-shiki-dark dark:bg-shiki-dark-bg",style:u,children:l.content},c)})},i),i!==n.length-1&&`
|
|
292
292
|
`]}))})}):o.jsx("pre",{...r,children:e})});Udt.displayName="HighlightedCode";const $Lr=({children:e,className:t,language:r,...n})=>{const s=typeof e=="string"?e:uie(e),a=Z("overflow-x-scroll rounded-md border bg-surface1/50 p-4 font-mono text-sm [scrollbar-width:none]",t);return o.jsxs("div",{className:"group/code relative mb-4",children:[o.jsx(b.Suspense,{fallback:o.jsx("pre",{className:a,...n,children:e}),children:o.jsx(Udt,{language:r,className:a,children:s})}),o.jsx("div",{className:"invisible absolute right-2 top-2 flex space-x-1 rounded-lg p-1 opacity-0 transition-all duration-200 group-hover/code:visible group-hover/code:opacity-100",children:o.jsx(Xa,{content:s,copyMessage:"Copied code to clipboard"})})]})};function uie(e){if(typeof e=="string")return e;if(e?.props?.children){let t=e.props.children;return Array.isArray(t)?t.map(r=>uie(r)).join(""):uie(t)}return""}const FLr={h1:({children:e,...t})=>o.jsx("h1",{className:"text-2xl font-semibold",...t,children:e}),h2:({children:e,...t})=>o.jsx("h2",{className:"font-semibold text-xl",...t,children:e}),h3:({children:e,...t})=>o.jsx("h3",{className:"font-semibold text-lg",...t,children:e}),h4:({children:e,...t})=>o.jsx("h4",{className:"font-semibold text-base",...t,children:e}),h5:({children:e,...t})=>o.jsx("h5",{className:"font-medium",...t,children:e}),strong:({children:e,...t})=>o.jsx("strong",{className:"font-semibold",...t,children:e}),a:({children:e,...t})=>o.jsx("a",{className:"underline underline-offset-2",...t,children:e}),blockquote:({children:e,...t})=>o.jsx("blockquote",{className:"border-l-2 border-neutral6 pl-4",...t,children:e}),code:({children:e,className:t,...r})=>{const n=/language-(\w+)/.exec(t||"");return n?o.jsx($Lr,{className:t,language:n[1],...r,children:e}):o.jsx("code",{className:Z("font-mono [:not(pre)>&]:rounded-md [:not(pre)>&]:bg-surface1/50 [:not(pre)>&]:px-1 [:not(pre)>&]:py-0.5"),...r,children:e})},pre:({children:e})=>e,ol:({children:e,...t})=>o.jsx("ol",{className:"list-decimal space-y-2 pl-6",...t,children:e}),ul:({children:e,...t})=>o.jsx("ul",{className:"list-disc space-y-2 pl-6",...t,children:e}),li:({children:e,...t})=>o.jsx("li",{className:"my-1.5",...t,children:e}),table:({children:e,...t})=>o.jsx("table",{className:"w-full border-collapse overflow-y-auto rounded-md border border-neutral6/20",...t,children:e}),th:({children:e,...t})=>o.jsx("th",{className:"border border-neutral6/20 px-4 py-2 text-left font-bold [[align=center]]:text-center [[align=right]]:text-right",...t,children:e}),td:({children:e,...t})=>o.jsx("td",{className:"border border-neutral6/20 px-4 py-2 text-left [[align=center]]:text-center [[align=right]]:text-right",...t,children:e}),tr:({children:e,...t})=>o.jsx("tr",{className:"m-0 border-t p-0 even:bg-surface4",...t,children:e}),p:({children:e,...t})=>o.jsx("p",{className:"whitespace-pre-wrap leading-relaxed",...t,children:e}),hr:({...e})=>o.jsx("hr",{className:"border-neutral6/20",...e})};function zLr({children:e,className:t}){return o.jsx("div",{className:Z("overflow-x-auto ",t),children:e})}function Vdt({children:e,className:t}){return o.jsx("p",{className:Z("text-ui-md text-neutral2 leading-tight mt-0.5",t),children:e})}function BLr({message:e="Failed to load data",className:t}){return o.jsx("div",{className:Z("flex flex-col gap-3 items-center justify-center",t),children:o.jsx("p",{className:"text-ui-sm text-accent2",children:e})})}const ULr={sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"};function Mt({color:e,className:t,size:r="md"}){return o.jsx("svg",{className:Z("animate-spin",ULr[r],t),style:{animationDuration:"800ms",animationTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)"},xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",stroke:e||"currentColor",className:"text-accent1"})})}function VLr({className:e}){return o.jsx("div",{className:Z("flex items-center justify-center",e),children:o.jsx(Mt,{size:"md",color:Lb.neutral1})})}function qLr({message:e="No data yet",className:t}){return o.jsx("div",{className:Z("flex items-center justify-center h-full",t),children:o.jsx("p",{className:"text-neutral1 text-sm",children:e})})}function YIe({children:e,className:t}){return o.jsx(Ndt,{className:Z("flex-1 grid grid-rows-[4rem_1fr] min-h-72 gap-2 min-w-80 md:min-w-[22rem] lg:min-w-[24rem] xl:min-w-[26rem] 2xl:min-w-[30rem]",t),children:e})}function HLr({value:e,label:t,className:r}){return o.jsxs("div",{className:Z("grid justify-end content-start text-right gap-1",r),children:[o.jsx("span",{className:"text-ui-lg font-semibold text-neutral4 leading-none",children:e}),t&&o.jsx("span",{className:"text-ui-md text-neutral2",children:t})]})}function qdt({children:e,className:t,as:r="h2"}){return o.jsx(r,{className:Z("text-ui-md font-normal text-neutral4",t),children:e})}function QLr(e){if("children"in e)return o.jsx("div",{className:e.className,children:e.children});const{title:t,description:r,titleAs:n}=e;return o.jsxs("div",{className:e.className,children:[o.jsx(qdt,{as:n,children:t}),r&&o.jsx(Vdt,{children:r})]})}function WLr({children:e,className:t}){return o.jsx("div",{className:Z("grid grid-cols-[1fr_auto] gap-4",t),children:e})}function GLr({changePct:e,prevValue:t,lowerIsBetter:r,className:n}){const s=r?e<0:e>=0;return o.jsxs("div",{className:Z("flex items-center gap-1 text-sm text-neutral1 flex-wrap",n),children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:Z("[&>svg]:w-4 [&>svg]:h-4",s?"text-green-600":"text-red-600"),children:e>=0?o.jsx(s9t,{}):o.jsx(r9t,{})}),o.jsx("span",{className:Z(s?"text-green-600":"text-red-600"),children:`${e>=0?"+":"-"}${Math.abs(e).toFixed(1)}%`})]}),t&&o.jsxs("div",{children:["vs previous ",o.jsx("b",{className:"text-neutral2 font-semibold",children:t})]})]})}function ZLr({message:e="Failed to load data",className:t}){return o.jsx("span",{className:Z("text-ui-sm text-accent2",t),children:e})}function YLr({children:e,className:t}){return o.jsx("span",{className:Z("text-ui-md text-neutral3 leading-relaxed",t),children:e})}function XLr({className:e}){return o.jsx("span",{className:Z("text-sm",e),children:o.jsx(Mt,{size:"md",color:Lb.neutral1})})}function KLr({message:e="No previous value to compare",className:t}){return o.jsx("span",{className:Z("text-sm text-neutral1",t),children:e})}function JLr({message:e="No data yet",className:t}){return o.jsx("span",{className:Z("text-sm text-neutral1",t),children:e})}function e$r({children:e,className:t}){return o.jsx(Ndt,{className:Z("flex-1 min-w-60",t),children:o.jsx("div",{className:"grid gap-1",children:e})})}function t$r({children:e,className:t}){return o.jsx("strong",{className:Z("text-header-lg text-neutral4 font-semibold",t),children:e})}const On=Object.assign(e$r,{Label:YLr,Value:t$r,Change:GLr,NoChange:KLr,NoData:JLr,Error:ZLr,Loading:XLr}),Ht=Object.assign(YIe,{Root:YIe,Kpi:On,TopBar:WLr,TitleAndDescription:QLr,Title:qdt,Description:Vdt,Summary:HLr,Loading:VLr,Error:BLr,Content:zLr,NoData:qLr});function die({children:e,className:t}){return o.jsx("div",{className:Z("flex flex-wrap gap-8",t),children:e})}const jf=rcr,cd=ncr,mu=b.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>o.jsx(scr,{children:o.jsx(btt,{ref:s,align:t,sideOffset:r,className:Z("z-50 w-72 rounded-xl border-2 border-border1/50 bg-surface3 text-neutral5 shadow-md focus-visible:outline-hidden 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&&/\bp[trblxy]?-\S+/.test(e)?!1:"py-3.5 px-3",e),...n})}));mu.displayName=btt.displayName;function Hdt({children:e,...t}){const[r,n]=b.useState(!1),s=b.useRef(void 0),a=b.useCallback(()=>{clearTimeout(s.current),n(!0)},[]),i=b.useCallback(()=>{s.current=setTimeout(()=>n(!1),150)},[]);return b.useEffect(()=>()=>clearTimeout(s.current),[]),o.jsx(jf,{open:r,onOpenChange:n,...t,children:o.jsx("span",{onMouseEnter:a,onMouseLeave:i,onFocusCapture:a,onBlurCapture:i,style:{display:"contents"},children:e})})}function Qdt({disabled:e,onClear:t,onRemoveAll:r,onSave:n,onRemoveSaved:s}){const a=!!(r||n||s),i=!!t;return!i&&!a?null:o.jsxs("div",{className:"flex items-center gap-2",children:[i&&o.jsxs(pe,{disabled:e,size:"md",onClick:()=>t(),children:[o.jsx(Xl,{}),"Clear"]}),a&&o.jsxs(vt,{children:[o.jsx(vt.Trigger,{asChild:!0,children:o.jsx(pe,{disabled:e,size:"md","aria-label":"More filter actions",children:o.jsx(hzt,{})})}),o.jsxs(vt.Content,{align:"end",children:[r&&o.jsxs(vt.Item,{onSelect:()=>r(),children:[o.jsx(Xl,{}),"Remove all filters"]}),r&&(n||s)&&o.jsx(vt.Separator,{}),n&&o.jsxs(vt.Item,{onSelect:()=>n(),children:[o.jsx(CHe,{}),"Save filters for next time"]}),s&&o.jsxs(vt.Item,{onSelect:()=>s(),children:[o.jsx(jHe,{}),"Remove saved filters"]})]})]})]})}const yC=b.forwardRef(({className:e,...t},r)=>o.jsx(Itt,{className:Z("grid gap-2",e),...t,ref:r}));yC.displayName=Itt.displayName;const Kc=b.forwardRef(({className:e,...t},r)=>o.jsx(Rtt,{ref:r,className:Z("aspect-square h-4 w-4 rounded-full border border-neutral3 text-neutral6","shadow-sm",sn.all,"hover:border-neutral5 hover:shadow-md",AP,"disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-neutral3 disabled:hover:shadow-sm","data-[state=checked]:border-accent1 data-[state=checked]:shadow-glow-accent1",e),...t,children:o.jsx(pcr,{className:Z("flex items-center justify-center","data-[state=checked]:animate-in data-[state=checked]:zoom-in-50 data-[state=checked]:duration-150"),children:o.jsx(kHe,{className:"h-2 w-2 fill-accent1 text-accent1"})})}));Kc.displayName=Rtt.displayName;function Wdt({field:e,tokens:t,onChange:r}){const[n,s]=b.useState(""),a=b.useMemo(()=>{const u=n.trim().toLowerCase();return u?e.options.filter(d=>d.label.toLowerCase().includes(u)):e.options},[e.options,n]),i=b.useMemo(()=>t.find(u=>u.fieldId===e.id),[t,e.id]),l=typeof i?.value=="string"?i.value:void 0,c=b.useMemo(()=>Array.isArray(i?.value)?i.value:typeof i?.value=="string"?[i.value]:[],[i]);return o.jsxs(o.Fragment,{children:[e.searchable!==!1&&o.jsx(sr,{size:"sm",value:n,onChange:u=>s(u.target.value),placeholder:`Search ${e.label.toLowerCase()}...`,className:"mb-2",onKeyDown:u=>{if(u.key!=="ArrowDown")return;const f=u.currentTarget.closest("[data-pick-multi-panel]")?.querySelector("[data-pick-multi-item]:not([disabled])");f&&(u.preventDefault(),u.stopPropagation(),f.focus())}}),e.isLoading?o.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 text-ui-sm text-neutral3",children:[o.jsx(Mt,{size:"sm",className:"w-3 h-3",color:"var(--neutral3)"}),"Loading options…"]}):a.length===0?o.jsx("div",{className:"px-2 py-1.5 text-ui-sm text-neutral3",children:e.emptyText??"No option found."}):e.multi?o.jsx("div",{className:"max-h-[80dvh] overflow-auto",children:a.map(u=>{const d=c.includes(u.value);return o.jsxs("label",{title:u.label,className:"flex items-center gap-2 rounded-md px-2 py-1.5 text-ui-md text-neutral4 hover:bg-surface4 hover:text-neutral6 cursor-pointer focus-within:bg-surface4 focus-within:text-neutral6 min-w-0",children:[o.jsx(di,{"data-pick-multi-item":"",checked:d,onCheckedChange:f=>{const p=f===!0?c.includes(u.value)?c:[...c,u.value]:c.filter(m=>m!==u.value);r(e.id,p)},className:"shrink-0"}),o.jsx("span",{className:"truncate min-w-0 flex-1",children:u.label})]},u.value)})}):o.jsxs(yC,{value:l??"",onValueChange:u=>r(e.id,u),className:"max-h-[80dvh] gap-0 overflow-auto",children:[a.map(u=>o.jsxs("label",{title:u.label,className:"flex items-center gap-2 rounded-md px-2 py-1.5 text-ui-md text-neutral4 hover:bg-surface4 hover:text-neutral6 cursor-pointer focus-within:bg-surface4 focus-within:text-neutral6 min-w-0",children:[o.jsx(Kc,{"data-pick-multi-item":"",value:u.value,className:"shrink-0"}),o.jsx("span",{className:"truncate min-w-0 flex-1",children:u.label})]},u.value)),o.jsxs("label",{title:"Any",className:"flex items-center gap-2 rounded-md px-2 py-1.5 text-ui-md text-neutral4 hover:bg-surface4 hover:text-neutral6 cursor-pointer focus-within:bg-surface4 focus-within:text-neutral6 min-w-0",children:[o.jsx(Kc,{"data-pick-multi-item":"",value:"Any",className:"shrink-0"}),o.jsx("span",{className:"truncate min-w-0 flex-1",children:"Any"})]})]})]})}function Gdt(e){return Array.isArray(e)?e.length===0?"Any":e.join(", "):e}const hme="inline-flex",Zdt=`${Ql.md} border-y-2 border-border1 px-[.75em] text-neutral3 whitespace-nowrap flex items-center`,pme=`${Zdt} text-ui-md rounded-l-lg border-l-2 border-r-1`,mme=`${Zdt} text-ui-md `,gme="rounded-tl-none rounded-bl-none border-l-transparent",r$r="rounded-none",n$r="rounded-none";function s$r({field:e,value:t,onChange:r,onRemove:n,disabled:s,autoFocus:a}){const[i,l]=b.useState(t),c=b.useRef(null);return b.useEffect(()=>{i.trim()!==t&&l(t)},[t]),b.useEffect(()=>{a&&c.current?.focus()},[a]),o.jsxs("div",{className:hme,children:[o.jsx("span",{className:pme,children:e.label}),o.jsx("span",{className:mme,children:"is"}),o.jsx(sr,{ref:c,size:"md",disabled:s,value:i,placeholder:e.placeholder??`Enter ${e.label}`,className:r$r,onChange:u=>{const d=u.target.value;l(d),d.trim()!==t&&r(d)},onKeyDown:u=>{if(u.key==="Enter"){u.preventDefault();const d=i.trim();d!==t&&r(d)}else u.key==="Escape"&&(u.preventDefault(),l(t),u.target.blur())}}),o.jsx(pe,{type:"button",disabled:s,"aria-label":`Remove ${e.label} filter`,className:gme,size:"md",onMouseDown:u=>u.preventDefault(),onClick:n,children:o.jsx(Xl,{})})]})}function a$r({field:e,token:t,tokens:r,onChange:n,onRemove:s,disabled:a}){const[i,l]=b.useState(!1);return o.jsxs("div",{className:hme,children:[o.jsx("span",{className:pme,children:e.label}),o.jsx("span",{className:mme,children:"is"}),o.jsxs(jf,{open:i,onOpenChange:l,children:[o.jsx(cd,{asChild:!0,children:o.jsx(pe,{type:"button",disabled:a,size:"md",className:n$r,children:Gdt(t.value)})}),o.jsx(mu,{align:"start",sideOffset:8,className:"w-64 p-2","data-pick-multi-panel":!0,children:o.jsx(Wdt,{field:e,tokens:r,onChange:n})})]}),o.jsx(pe,{type:"button",disabled:a,"aria-label":`Remove ${e.label} filter`,className:gme,size:"md",onClick:s,children:o.jsx(Xl,{})})]})}function Ydt({fields:e,tokens:t,onTokensChange:r,disabled:n,autoFocusFieldId:s}){if(t.length===0)return null;const a=(l,c)=>{const u=[...t];u[l]=c,r(u)},i=l=>{r(t.filter((c,u)=>u!==l))};return o.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:t.map((l,c)=>{const u=e.find(d=>d.id===l.fieldId);return u?u.kind==="text"&&typeof l.value=="string"?o.jsx(s$r,{field:u,value:l.value,disabled:n,autoFocus:s===l.fieldId,onChange:d=>a(c,{fieldId:l.fieldId,value:d}),onRemove:()=>i(c)},`${l.fieldId}-${c}`):u.kind==="pick-multi"?o.jsx(a$r,{field:u,token:l,tokens:t,disabled:n,onChange:(d,f)=>{if(f===void 0){i(c);return}a(c,{fieldId:d,value:f})},onRemove:()=>i(c)},`${l.fieldId}-${c}`):o.jsxs("div",{className:hme,children:[o.jsx("span",{className:pme,children:u.label}),o.jsx("span",{className:mme,children:"is"}),o.jsx("span",{className:"px-2.5 py-1.5 max-w-[20rem] truncate",children:Gdt(l.value)}),o.jsx(pe,{type:"button",disabled:n,size:"md","aria-label":`Remove ${u.label} filter`,className:gme,onClick:()=>i(c),children:o.jsx(Xl,{})})]},`${l.fieldId}-${c}`):null})})}function Xdt({fields:e,tokens:t,onTokensChange:r,label:n="Add Filter",disabled:s,size:a,onStartTextFilter:i}){const[l,c]=b.useState(!1),[u,d]=b.useState(),[f,h]=b.useState(""),[p,m]=b.useState([]),[g,y]=b.useState(),[x,w]=b.useState(),S=b.useRef(null),k=b.useRef(!1),_=b.useCallback(R=>{w($=>$===R?void 0:R)},[]),E=b.useCallback(()=>w(void 0),[]);b.useEffect(()=>{l||w(void 0)},[l]);const T=b.useMemo(()=>e.find(R=>R.id===u),[e,u]),j=b.useMemo(()=>{const R=new Set;for(const $ of t){const M=e.find(z=>z.id===$.fieldId);M&&M.kind!=="pick-multi"&&R.add($.fieldId)}return R},[t,e]),N=b.useCallback(()=>{d(void 0),h(""),m([]),y(void 0)},[]);b.useEffect(()=>{l||N()},[l,N]),b.useEffect(()=>{l&&T?.kind==="text"&&S.current?.focus()},[l,T]);const I=b.useCallback((R,$)=>{const M=t.findIndex(B=>B.fieldId===R);if($===void 0||Array.isArray($)&&$.length===0){if(M===-1)return;r(t.filter((B,H)=>H!==M));return}if(M===-1){r([...t,{fieldId:R,value:$}]);return}const U=[...t];U[M]={fieldId:R,value:$},r(U)},[r,t]),P=b.useCallback(()=>{if(!T){y("Choose a property first.");return}if(j.has(T.id)){y(`Remove the existing ${T.label} filter before adding another.`);return}if(T.kind==="text"&&!f.trim()){y(`Enter a value for ${T.label}.`);return}if(T.kind==="multi-select"&&p.length===0){y(`Choose at least one ${T.label.toLowerCase()} value.`);return}const R=T.kind==="multi-select"?{fieldId:T.id,value:p}:{fieldId:T.id,value:f.trim()};r([...t,R]),c(!1)},[p,r,T,j,f,t]);return o.jsxs(jf,{open:l,onOpenChange:c,children:[o.jsx(cd,{asChild:!0,children:o.jsxs(pe,{variant:"outline",size:a,disabled:s,children:[o.jsx(Dzt,{}),n]})}),o.jsx(mu,{align:"end",className:"p-3 w-64",onOpenAutoFocus:R=>R.preventDefault(),onCloseAutoFocus:R=>{k.current&&(k.current=!1,R.preventDefault())},children:o.jsxs("div",{className:"grid gap-3",children:[T&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{type:"button","aria-label":"Back to properties",className:"text-neutral3 hover:text-neutral6 transition-colors",onClick:()=>{d(void 0),h(""),m([]),y(void 0)},children:o.jsx(DE,{className:"h-4 w-4"})}),o.jsx(Czt,{className:"h-4 w-4 shrink-0 text-neutral3"}),o.jsx("span",{className:"text-ui-sm text-neutral3",children:`${T.label} · is`})]}),!T&&o.jsx("div",{role:"menu",className:"max-h-[80dvh] overflow-auto",onKeyDown:R=>{if(R.key!=="ArrowDown"&&R.key!=="ArrowUp"&&R.key!=="Home"&&R.key!=="End")return;const $=Array.from(R.currentTarget.querySelectorAll("[data-filter-item]:not([disabled])"));if($.length===0)return;R.preventDefault();const M=document.activeElement,z=$.findIndex(B=>B===M);let U;R.key==="Home"?U=0:R.key==="End"?U=$.length-1:R.key==="ArrowDown"?U=z<0?0:(z+1)%$.length:U=z<=0?$.length-1:z-1,$[U]?.focus()},children:e.length>0?e.map(R=>{const $=j.has(R.id);return R.kind==="pick-multi"?o.jsx(i$r,{field:R,tokens:t,onChange:I,open:x===R.id,onToggle:_,onClose:E},R.id):o.jsxs("button",{type:"button",role:"menuitem","data-filter-item":"",className:Z("group flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-ui-md transition-colors","focus:bg-surface4 focus:text-neutral6 focus:outline-none",$?"cursor-not-allowed text-neutral2 opacity-70":"text-neutral4 hover:bg-surface4 hover:text-neutral6"),disabled:$,onClick:()=>{if(y(void 0),R.kind==="text"){r([...t,{fieldId:R.id,value:""}]),i?.(R.id),k.current=!0,c(!1);return}d(R.id)},children:[o.jsx("span",{className:"truncate",children:R.label}),$?o.jsx("span",{className:"ml-auto text-neutral3",children:"In use"}):o.jsx(Bce,{className:"ml-auto h-4 w-4 text-neutral3 opacity-0 transition-opacity group-hover:opacity-100 group-focus:opacity-100"})]},R.id)}):o.jsx("div",{className:"px-2 py-1.5 text-ui-sm text-neutral3",children:"No matching property."})}),T&&T.kind==="text"&&o.jsx(sr,{ref:S,size:"md",value:f,onChange:R=>{h(R.target.value),y(void 0)},placeholder:T.placeholder??`Enter ${T.label}`,onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),P())}}),T&&T.kind==="multi-select"&&o.jsx(Sdt,{options:T.options??[],value:p,onValueChange:R=>{m(R),y(void 0)},placeholder:T.placeholder??`Choose ${T.label}`,searchPlaceholder:`Search ${T.label.toLowerCase()}...`,emptyText:T.emptyText??"No option found.",size:"md"}),g&&o.jsx("div",{className:"text-ui-sm text-red-500",children:g}),T&&T.kind!=="pick-multi"&&o.jsxs("div",{className:"flex items-center justify-end gap-2",children:[o.jsx(pe,{variant:"ghost",size:"md",onClick:()=>c(!1),children:"Cancel"}),o.jsx(pe,{variant:"outline",size:"md",onClick:P,children:"Add filter"})]})]})})]})}function i$r({field:e,tokens:t,onChange:r,open:n,onToggle:s,onClose:a}){const i=b.useRef(null);return o.jsxs(jf,{open:n,onOpenChange:l=>{l?s(e.id):a()},children:[o.jsx(cd,{asChild:!0,children:o.jsxs("button",{type:"button",role:"menuitem","data-filter-item":"",className:Z("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-ui-md text-neutral4 hover:bg-surface4 hover:text-neutral6 transition-colors","focus:bg-surface4 focus:text-neutral6 focus:outline-none"),onKeyDown:l=>{l.key!=="ArrowRight"&&l.key!=="ArrowLeft"||(n||s(e.id),l.preventDefault(),requestAnimationFrame(()=>{i.current?.querySelector('input, button, [tabindex]:not([tabindex="-1"])')?.focus()}))},children:[n&&o.jsx($ce,{className:"h-4 w-4 text-neutral3 shrink-0"}),o.jsx("span",{className:"truncate",children:e.label}),!n&&o.jsx(x_,{className:"h-4 w-4 ml-auto text-neutral3 shrink-0"})]})}),o.jsx(mu,{ref:i,side:"right",align:"start",sideOffset:8,className:"w-64 p-2",onOpenAutoFocus:l=>l.preventDefault(),onKeyDown:l=>{if(l.key!=="ArrowDown"&&l.key!=="ArrowUp"&&l.key!=="Home"&&l.key!=="End")return;const c=Array.from(l.currentTarget.querySelectorAll("[data-pick-multi-item]:not([disabled])"));if(c.length===0)return;l.preventDefault(),l.stopPropagation();const u=document.activeElement,d=c.findIndex(h=>h===u);let f;l.key==="Home"?f=0:l.key==="End"?f=c.length-1:l.key==="ArrowDown"?f=d<0?0:(d+1)%c.length:f=d<=0?c.length-1:d-1,c[f]?.focus()},"data-pick-multi-panel":!0,children:o.jsx(Wdt,{field:e,tokens:t,onChange:r})})]})}const Kdt=(e,{enabled:t=!0})=>{const r=b.useRef(t);je.useEffect(()=>{if(!t||!e?.current)return;const n=e.current,s=new MutationObserver(()=>{r.current&&n.scrollTo({top:n.scrollHeight,behavior:"smooth"})});s.observe(n,{childList:!0,subtree:!0,characterData:!0});const a=i=>{const l=i.target,c=l.scrollTop+l.clientHeight,u=l.scrollHeight;c>=u-1?r.current=!0:r.current=!1};return n.addEventListener("scroll",a),()=>{n.removeEventListener("scroll",a),s.disconnect()}},[t,e])},Ms=b.forwardRef(({className:e,children:t,viewPortClassName:r,maxHeight:n,autoScroll:s=!1,orientation:a="vertical",...i},l)=>{const c=b.useRef(null);return Kdt(c,{enabled:s}),o.jsxs(Qtt,{ref:l,className:Z("relative overflow-hidden",e),...i,children:[o.jsx(Ecr,{ref:c,className:Z("h-full w-full rounded-[inherit] [&>div]:block!",r),style:n?{maxHeight:n}:void 0,children:t}),(a==="vertical"||a==="both")&&o.jsx(fie,{orientation:"vertical"}),(a==="horizontal"||a==="both")&&o.jsx(fie,{orientation:"horizontal"}),a==="both"&&o.jsx(Ccr,{})]})});Ms.displayName=Qtt.displayName;const fie=b.forwardRef(({className:e,orientation:t="vertical",...r},n)=>o.jsx(Xde,{ref:n,orientation:t,className:Z("flex touch-none select-none transition-all duration-normal ease-out-custom","opacity-0 hover:opacity-100 data-[state=visible]:opacity-100",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-px",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-px",e),...r,children:o.jsx(Btt,{className:"relative flex-1 rounded-full bg-neutral2 hover:bg-neutral3 transition-colors duration-normal"})}));fie.displayName=Xde.displayName;const XIe={sm:Ql.sm,md:Ql.md,lg:Ql.lg,default:Ql.default},jm=({onSearch:e,label:t,placeholder:r,debounceMs:n=300,size:s="md"})=>{const a=b.useId(),i=b.useRef(null),l=g1(u=>{e(u)},n);b.useEffect(()=>()=>{l.cancel()},[l]),b.useEffect(()=>{const u=i.current;if(!u)return;const d=f=>{f.key.toLowerCase()==="f"&&f.shiftKey&&(f.ctrlKey||f.metaKey)&&(f.preventDefault(),u.focus())};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}},[]);const c=u=>{l(u.target.value)};return o.jsxs("div",{className:Z("border border-border1 flex w-full items-center gap-2 overflow-hidden pl-2 pr-1",E2r,_2r,sn.all,"hover:border-neutral2",XIe[s]),children:[o.jsx(w_,{className:Z("text-neutral3 h-4 w-4",sn.colors)}),o.jsxs("div",{className:"flex-1",children:[o.jsx("label",{htmlFor:a,className:"sr-only",children:t}),o.jsx("input",{id:a,type:"text",placeholder:r,className:Z("bg-transparent text-ui-md placeholder:text-neutral3 block w-full px-2 outline-hidden",XIe[s]),name:a,ref:i,onChange:c})]})]})},o$r=({children:e})=>o.jsx("div",{className:"px-3 py-2.5 border-b border-border1",children:e}),A4=b.forwardRef(({className:e,...t},r)=>o.jsxs(lrt,{ref:r,className:Z("relative flex w-full touch-none select-none items-center group",e),...t,children:[o.jsx(Hcr,{className:Z("relative h-1.5 w-full grow overflow-hidden rounded-full bg-neutral2",sn.colors),children:o.jsx(Qcr,{className:Z("absolute h-full bg-accent1",sn.all)})}),o.jsx(Wcr,{className:Z("block h-4 w-4 rounded-full border-2 border-accent1 bg-white shadow-md","transition-all duration-normal ease-out-custom",AP,"hover:scale-110 hover:shadow-lg","active:scale-95","disabled:pointer-events-none disabled:opacity-50")})]}));A4.displayName=lrt.displayName;const wc=b.forwardRef(({className:e,...t},r)=>o.jsx(prt,{className:Z("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent",sn.all,AP,"hover:brightness-110","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:brightness-100","data-[state=checked]:bg-accent1 data-[state=checked]:shadow-glow-accent1","data-[state=unchecked]:bg-neutral2",e),...t,ref:r,children:o.jsx(Kcr,{className:Z("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-md","transition-all duration-normal ease-out-custom","data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0","data-[state=checked]:shadow-lg")})}));wc.displayName=prt.displayName;function l$r({children:e,untilChar:t,charCount:r,copy:n,withTooltip:s=!0,className:a,as:i="span",...l}){const c=e;let u=c,d=!1;if(t!==void 0){const h=c.indexOf(t);h!==-1&&(u=c.slice(0,h),d=!0)}else r!==void 0&&c.length>r&&(u=c.slice(0,r),d=!0);if(!d)return o.jsx(me,{as:i,className:a,...l,children:c});const f=o.jsxs(me,{as:"span",className:"cursor-default",variant:l.variant,font:l.font,children:[u,"..."]});return o.jsxs(me,{as:i,className:Z("group inline-flex items-center gap-1",a),...l,children:[s?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:f}),o.jsx(Wr,{children:c})]}):f,n&&o.jsx(Xa,{content:c,className:"opacity-0 group-hover:opacity-100 transition-opacity"})]})}function ps({children:e,className:t,spacing:r="default"}){return o.jsx("div",{className:Z("flex gap-2 items-center ",{"gap-[2px] [&>*:not(:last-child)]:rounded-r-none [&>*:not(:first-child)]:rounded-l-none":r==="close"},t),children:e})}function zr({children:e,className:t,style:r}){const n=Jdt("MainContentLayout");return o.jsx("main",{className:Z("grid grid-rows-[auto_1fr] h-full items-start content-start",t),style:{...r,...n?{border:"3px dotted red"}:{}},children:e})}function pf({children:e,className:t,isCentered:r=!1,isDivided:n=!1,hasLeftServiceColumn:s=!1,style:a}){const i=Jdt("MainContentContent"),l=yme({isCentered:r,isDivided:n,hasLeftServiceColumn:s,className:t});return o.jsx("div",{className:l,style:{...a,...i?{border:"3px dotted orange"}:{}},children:e})}const yme=({isCentered:e,isDivided:t,hasLeftServiceColumn:r,className:n})=>Z("grid overflow-y-auto h-full ","overflow-x-auto min-w-min",{"items-start content-start":!e&&!t&&!r,"grid place-items-center":e,"grid-cols-[1fr_1fr]":t&&!r,"grid-cols-[12rem_1fr_1fr]":t&&r,"grid-cols-[auto_1fr]":!t&&r},n);function Jdt(e){try{const t=localStorage.getItem("add-dev-style-to-components");return t?t.split(",").map(n=>n.trim()).filter(Boolean).includes(e):!1}catch(t){return console.error("Error reading or parsing localStorage:",t),!1}}function c$r({children:e,className:t}){return o.jsx("div",{className:Z("grid content-start",t),children:e})}function u$r({children:e,isLoading:t}){return o.jsx("p",{className:Z("text-neutral3 text-sm max-w-[35rem] flex flex-wrap gap-x-4 gap-y-1 mt-1 first-of-type:mt-3 ml-1",{"bg-surface4 w-[40rem] max-w-[80%] rounded-md animate-pulse":t}),children:t?o.jsx(o.Fragment,{children:" "}):o.jsx(o.Fragment,{children:e})})}function d$r({children:e,title:t,description:r,icon:n,className:s,withMargins:a=!0}){const i=t==="loading",l=r==="loading";return e?o.jsx("header",{className:Z("grid grid-cols-[1fr_auto] gap-16 w-full ",{"mt-[6vh] mb-[4vh]":a},s),children:e}):o.jsxs("header",{className:Z("grid gap-2 pt-8 pb-8 ",s),children:[o.jsx("h1",{className:Z("text-neutral6 text-xl font-normal flex items-center gap-2","[&>svg]:w-6 [&>svg]:h-6 [&>svg]:text-neutral3",{"bg-surface4 w-60 max-w-[50%] rounded-md animate-pulse":i}),children:i?o.jsx(o.Fragment,{children:" "}):o.jsxs(o.Fragment,{children:[n&&n," ",t]})}),r&&o.jsx("p",{className:Z("text-neutral4 text-sm m-0",{"bg-surface4 w-[40rem] max-w-[80%] rounded-md animate-pulse":l}),children:l?o.jsx(o.Fragment,{children:" "}):r})]})}function f$r({children:e,isLoading:t,size:r="default"}){return o.jsx("h1",{className:Z("text-neutral5 text-xl font-normal gap-2 flex items-center","[&>svg]:w-[1.25em] [&>svg]:h-[1.25em] [&>svg]:opacity-50",{"bg-surface4 w-60 max-w-[50%] rounded-md animate-pulse":t,"text-md":r==="smaller"}),children:t?o.jsx(o.Fragment,{children:" "}):o.jsx(o.Fragment,{children:e})})}const Ir=Object.assign(d$r,{Title:f$r,Description:u$r,Column:c$r});function $S({children:e,className:t}){return o.jsx("div",{className:Z("grid gap-12",t),children:e})}const eft=({className:e,children:t})=>o.jsx("div",{className:Z("flex items-center text-ui-sm border border-border1 rounded-lg overflow-hidden","[&>button]:border-0 [&>button:not(:first-child)]:border-l [&>button:not(:first-child)]:border-border1","[&>button]:rounded-none [&>button:first-child]:rounded-l-lg [&>button:last-child]:rounded-r-lg",e),children:t});function I4({className:e,classNames:t,showOutsideDays:r=!0,...n}){return o.jsx(Phr,{showOutsideDays:r,className:Z("p-3",e),classNames:{months:"flex flex-col space-y-4 sm:space-y-0 ",month:"space-y-4 text-ui-sm ",caption:"flex justify-between pt-1 items-center pl-2",caption_label:"text-text font-medium ",nav:"flex items-center",nav_button_previous:Z("flex justify-center items-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_next:Z("flex justify-center items-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),dropdown_month:"w-full border-collapse space-y-1",weeknumber:"flex",day:Z("relative p-0 text-center focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-surface5 [&:has([aria-selected].day-outside)]:bg-surface5/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",n.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md","h-8 w-8 p-0 hover:bg-lightGray-7/50 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start rounded-l-md",day_range_end:"day-range-end rounded-r-md",day_selected:Z("bg-accent1! text-white! hover:bg-accent1/80! focus:bg-accent1/80! focus:text-white!",n.mode!=="range"&&"rounded-md"),day_today:"bg-neutral6/10 text-neutral5",day_outside:"day-outside text-neutral3 opacity-50 aria-selected:bg-surface5/50 aria-selected:text-neutral3 aria-selected:opacity-30",day_disabled:"text-neutral3 opacity-50",day_range_middle:"aria-selected:bg-surface5 aria-selected:text-neutral5",day_hidden:"invisible",head_cell:"text-ui-xs text-neutral3",...t},...n})}const tQ=["12","1","2","3","4","5","6","7","8","9","10","11"],JD=["00","15","30","45","59"],eL=["AM","PM"];function hie({defaultValue:e,onValueChange:t,className:r}){const[n,s]=b.useState("12"),[a,i]=b.useState("00"),[l,c]=b.useState("AM");b.useEffect(()=>{if(e){const h=/^(\d{1,2}):(\d{2})(?::\d{2})?\s*(AM|PM|am|pm)?$/,p=e.match(h);if(p){let m=parseInt(p[1],10);const g=parseInt(p[2],10),y=p[3]?.toUpperCase();m>=1&&m<=12&&g>=0&&g<=59&&(s(m.toString()),i(g===0?"00":g.toString()),c(y||"AM"))}}},[e]);const u=h=>{s(h),t(`${tQ[+h]}:${a} ${l}`.trim())},d=h=>{i(JD[+h]),t(`${n}:${JD[+h]} ${l}`.trim())},f=h=>{c(eL[+h]),t(`${n}:${a} ${eL[+h]}`.trim())};return o.jsxs("div",{className:Z("flex gap-2 items-center",r),children:[o.jsxs(fi,{name:"hour",value:tQ.indexOf(n).toString(),onValueChange:u,children:[o.jsx(Ja,{size:"sm",children:o.jsx(hi,{placeholder:"Select..."})}),o.jsx(ei,{children:tQ.map((h,p)=>o.jsx(ns,{value:`${p}`,children:h},h))})]}),":",o.jsxs(fi,{name:"minute",value:JD.indexOf(a).toString(),onValueChange:d,children:[o.jsx(Ja,{size:"sm",children:o.jsx(hi,{placeholder:"Select..."})}),o.jsx(ei,{children:JD.map((h,p)=>o.jsx(ns,{value:`${p}`,children:h},h))})]}),o.jsxs(fi,{name:"period",value:eL.indexOf(l).toString(),onValueChange:f,children:[o.jsx(Ja,{size:"sm",children:o.jsx(hi,{placeholder:"Select..."})}),o.jsx(ei,{children:eL.map((h,p)=>o.jsx(ns,{value:`${p}`,children:h},h))})]})]})}const KIe=({value:e,minValue:t,maxValue:r,defaultTimeStrValue:n,onValueChange:s,children:a,className:i,placeholder:l,...c})=>{const[u,d]=b.useState(!1);return o.jsxs(jf,{open:u,onOpenChange:d,children:[o.jsx(cd,{asChild:!0,children:a||o.jsx(p$r,{value:e,placeholder:l,className:i,"data-testid":"datepicker-button"})}),o.jsx(mu,{className:"backdrop-blur-4xl w-auto p-0! bg-surface4 max-w-[16.5rem]",align:"start","data-testid":"datepicker-calendar",children:o.jsx(h$r,{value:e,minValue:t,maxValue:r,onValueChange:s,setOpenPopover:d,defaultTimeStrValue:n,...c})})]})};function tL({date:e,timeStr:t=""}){if(!Cy(e))return null;if(t){const r=ur(e,"yyyy-MM-dd"),n=new Date(`${r} ${t}`);if(Cy(n))return n}return e}const h$r=({value:e,minValue:t,maxValue:r,onValueChange:n,setOpenPopover:s,placeholder:a,className:i,defaultTimeStrValue:l,...c})=>{const[u,d]=b.useState(null),[f,h]=b.useState(e?ur(tL({date:e,timeStr:l})||"","PP p"):""),[p,m]=b.useState(l||""),[g,y]=b.useState(e?new Date(e):void 0),x=g1($=>{Cy($)&&(y($),n?.($),s?.(!1))},500),w=$=>{h($.currentTarget.value);const M=new Date($.currentTarget.value);x(M)},S=$=>{Cy($)?r&&$>r?(d(`The selected date should be before ${ur(r,"PP p")}`),h("")):t&&$<t?(d(`The selected date should be after ${ur(t,"PP p")}`),h("")):(h(ur($,"PP p")),d("")):(h(""),d(""))},k=new Date(f),_=Cy(k),E=_&&k.getTime()!==e?.getTime(),T=$=>{if(y($),$){const M=tL({date:$,timeStr:p});S(M||"")}else S("")},j=$=>{if(y($),$){const M=tL({date:$,timeStr:p});S(M||"")}else S("")},N=$=>{if(m($),_){const M=tL({date:k,timeStr:$});S(M||"")}},I=()=>{s?.(!1)},P=()=>{Cy(k)&&n(k),s?.(!1)},R=()=>{n(void 0),y(void 0),h(""),m(""),s?.(!1)};return o.jsxs("div",{"aria-label":"Choose date",className:Z("relative flex flex-col",i),onKeyDown:$=>{$.stopPropagation(),$.key==="Escape"&&s?.(!1)},children:[o.jsx(jx,{name:"date-range",type:"text",value:f,onChange:w,placeholder:a,className:"m-4 mb-0 w-auto!"}),u&&o.jsxs("div",{className:Z("text-ui-md m-4 mb-0 text-neutral3","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mt-0.5 [&>svg]:text-red-500 [&>svg]:float-left [&>svg]:mr-2"),children:[o.jsx(_F,{})," ",u]}),o.jsx(I4,{mode:"single",month:g,selected:g,onMonthChange:j,onSelect:T,...c}),o.jsx(hie,{onValueChange:N,className:"m-4 mt-0 w-auto",defaultValue:e?ur(new Date(e),"hh:mm a"):l}),o.jsxs("div",{className:"grid grid-cols-[1fr_2fr] gap-2 m-4 mt-0",children:[E&&o.jsx(pe,{tabIndex:0,size:"md",onClick:R,type:"button",children:"Clear"}),o.jsx(pe,{tabIndex:0,type:"button",size:"md",variant:E?"primary":"default",onClick:()=>{_?P():I()},children:E?"Apply":"Cancel"})]})]})},p$r=b.forwardRef(({value:e,placeholder:t,className:r,...n},s)=>o.jsxs(pe,{ref:s,className:Z("justify-start",r),variant:"inputLike",...n,children:[o.jsx(ene,{className:"h-4 w-4"}),e?o.jsx("span",{className:"text-white",children:ur(e,"PP p")}):o.jsx("span",{className:"text-gray",children:t??"Pick a date"})]}));function tft({children:e}){return o.jsx("ul",{className:"grid bg-surface3 overflow-y-auto",children:e})}function rft(e){return!e||e.length===0?"":e?.map(t=>t.size).join(" ")}function nft({entry:e,isSelected:t,onClick:r,children:n,columns:s}){const a=()=>{r?.(e?.id)};return o.jsx("li",{className:Z("border-t text-neutral5 border-border1 last:border-b-0 text-ui-md","[&:last-child>button]:rounded-b-lg",sn.colors,{"bg-accent1Dark":t}),children:o.jsx("button",{onClick:a,className:Z("grid w-full px-6 gap-6 text-left items-center min-h-12",sn.colors,c0.visible,{"hover:bg-surface4":e&&!t}),style:{gridTemplateColumns:rft(s)},disabled:!e,children:n})})}function m$r({children:e,isLoading:t}){return o.jsx("div",{className:"text-neutral4 text-ui-md truncate ",children:t?o.jsx("div",{className:"bg-surface4 rounded-md animate-pulse text-transparent h-4 select-none"}):e})}function g$r({status:e}){return o.jsxs("div",{className:Z("flex justify-center items-center w-full relative"),children:[e?o.jsx("div",{className:Z("w-[0.6rem] h-[0.6rem] rounded-full",{"bg-green-600":e==="success","bg-red-700":e==="failed"})}):o.jsx("div",{className:"text-neutral2 text-ui-sm leading-none",children:"-"}),o.jsxs(Ku,{children:["Status: ",e||"not provided"]})]})}function sft({columns:e}){return o.jsx("div",{className:Z("sticky top-0 bg-surface4 z-10 rounded-t-lg px-6"),children:o.jsx("div",{className:Z("grid gap-6 text-left uppercase py-3 text-neutral3 text-ui-sm"),style:{gridTemplateColumns:rft(e)},children:e?.map(t=>o.jsx("span",{children:t.label||t.name},t.name))})})}function y$r({children:e,message:t,className:r,type:n}){return!e&&!t?null:o.jsx("div",{className:Z("grid border-t border-border1",r),children:t?o.jsxs("p",{className:Z("text-neutral3 text-ui-md text-center grid p-8 justify-center justify-items-center gap-2","[&>svg]:w-[1.5em] [&>svg]:h-[1.5em] [&>svg]:opacity-75",{"[&>svg]:text-red-500":n==="error"}),children:[n==="error"?o.jsx(LE,{}):o.jsx(MR,{})," ",t]}):e})}function v$r({isLoading:e,hasMore:t,setEndOfListElement:r,loadingText:n="Loading more data...",noMoreDataText:s="No more data to load"}){return r?o.jsxs("div",{ref:r,className:"text-ui-md text-neutral3 opacity-50 flex mt-8 justify-center",children:[e&&n,!t&&!e&&s]}):null}function b$r({currentPage:e,hasMore:t,onNextPage:r,onPrevPage:n}){const s=typeof e=="number"&&e>0||t;return o.jsxs("div",{className:Z("flex pt-6 items-center justify-center text-neutral3 text-ui-md gap-8"),children:[o.jsxs("span",{children:["Page ",o.jsx("b",{children:e?e+1:"1"})]}),s&&o.jsxs("div",{className:Z("flex gap-4","[&>button]:flex [&>button]:items-center [&>button]:gap-2 [&>button]:text-neutral4 [&>button:hover]:text-neutral5 [&>button]:transition-colors [&>button]:border [&>button]:border-border1 [&>button]:p-1 [&>button]:px-2 [&>button]:rounded-md","[&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:text-neutral3"),children:[typeof e=="number"&&e>0&&o.jsxs("button",{onClick:n,children:[o.jsx(DE,{}),"Previous"]}),t&&o.jsxs("button",{onClick:r,children:["Next",o.jsx(Qm,{})]})]})]})}function x$r({children:e}){return o.jsx("div",{className:"grid",children:e})}function aft({children:e}){return o.jsx("div",{className:Z("rounded-lg border border-border1 overflow-clip"),children:e})}const po=Object.assign(x$r,{Header:sft,Trim:aft,Entries:tft,Entry:nft,Message:y$r,NextPageLoading:v$r,Pagination:b$r,EntryText:m$r,EntryStatus:g$r}),JIe=["75%","50%","65%","90%","60%","80%"];function w$r({columns:e,numberOfRows:t=3}){const r=(n,s)=>{const a=(n+s+(e?.length||0)+(t||0))%JIe.length;return JIe[a]};return o.jsx(tft,{children:Array.from({length:t}).map((n,s)=>o.jsx(nft,{columns:e,children:(e||[]).map((a,i)=>{const l=`${a.name}-${i}`;return o.jsx("div",{className:"bg-surface4 rounded-md animate-pulse text-transparent h-4 select-none",style:{width:`${r(s,i)}`}},l)})},s))})}function S$r({columns:e,numberOfRows:t}){return o.jsx(po,{children:o.jsxs(aft,{children:[o.jsx(sft,{columns:e}),o.jsx(w$r,{columns:e,numberOfRows:t})]})})}function ift({entries:e,id:t,update:r}){const n=e.findIndex(a=>a.id===t);if(n<e.length-1)return()=>{const a=e[n+1];r(a.id)}}function oft({entries:e,id:t,update:r}){const n=e.findIndex(a=>a.id===t);if(n>0)return()=>{const a=e[n-1];r(a.id)}}function lft({name:e,value:t,label:r,labelIsHidden:n=!1,className:s,required:a,disabled:i,helpMsg:l,options:c,onValueChange:u,placeholder:d="Select an option",size:f="default"}){const h=({children:p})=>n?o.jsx(Ku,{children:p}):p;return o.jsxs("div",{className:Z("flex gap-2 items-center",{"grid-rows-[auto_1fr]":r,"grid-rows-[auto_1fr_auto]":l},s),children:[o.jsx(h,{children:o.jsxs("label",{className:Z("text-ui-sm text-neutral3 flex justify-between items-center shrink-0"),children:[r,a&&o.jsx("i",{className:"text-neutral2",children:"(required)"})]})}),o.jsxs(fi,{name:e,value:t,onValueChange:u,disabled:i,children:[o.jsx(Ja,{id:`select-${e}`,size:f,className:"grid grid-cols-[1fr_auto] [&>span]:truncate w-full",children:o.jsx(hi,{placeholder:d})}),o.jsx(ei,{children:c.map(p=>o.jsx(ns,{value:p.value,disabled:p.disabled,children:o.jsxs("span",{className:"whitespace-nowrap truncate flex items-center gap-2",children:[p.icon,p.label]})},p.value))})]}),l&&o.jsx("p",{className:"text-neutral3 text-ui-sm",children:l})]})}const cft=b.createContext(null);function O$r({children:e,value:t}){return o.jsx(cft.Provider,{value:t,children:e})}function L9(){const e=b.useContext(cft);if(!e)throw new Error("useJSONSchemaForm must be used within a JSONSchemaForm.Root");return e}let k$r=0;function $9(e={}){return{id:`field-${Date.now()}-${k$r++}`,name:"",type:"string",nullable:!1,optional:!1,...e}}function _$r(e){return e==="text"?"string":e}function uft(e){const t=_$r(e.type),n={type:e.nullable?[t,"null"]:t};if(e.description&&(n.description=e.description),e.type==="object"&&e.properties&&e.properties.length>0){const{properties:s,required:a}=dft(e.properties);n.properties=s,a.length>0&&(n.required=a)}return e.type==="array"&&e.items&&(n.items=uft(e.items)),n}function dft(e){const t={},r=[];for(const n of e)n.name.trim()&&(t[n.name]=uft(n),n.optional||r.push(n.name));return{properties:t,required:r}}function E$r(e){const{properties:t,required:r}=dft(e),n={type:"object",properties:t};return r.length>0&&(n.required=r),n}function fft(e){if(Array.isArray(e)){const t=e.includes("null");return{type:e.find(n=>n!=="null")||"string",nullable:t}}return{type:e||"string",nullable:!1}}function hft(e){return["string","number","boolean","object","array"].includes(e)?e:"string"}function pft(e){const{type:t,nullable:r}=fft(e.type);return $9({name:"",type:hft(t),description:e.description,nullable:r,optional:!1,properties:e.properties?F9({properties:e.properties,required:e.required}):void 0,items:e.items?pft(e.items):void 0})}function F9(e){if(!e?.properties)return[];const t=new Set(e.required||[]);return Object.entries(e.properties).map(([r,n])=>{const{type:s,nullable:a}=fft(n.type);return $9({name:r,type:hft(s),description:n.description,nullable:a,optional:!t.has(r),properties:n.properties?F9({properties:n.properties,required:n.required}):void 0,items:n.items?pft(n.items):void 0})})}function pie(e,t,r,n){if(t.length===0)return e.map(i=>i.id===r?{...i,...n}:i);const[s,...a]=t;return e.map(i=>i.id!==s?i:i.type==="object"?{...i,properties:pie(i.properties||[],a,r,n)}:i.type==="array"&&i.items?{...i,items:{...i.items,properties:pie(i.items.properties||[],a,r,n)}}:i)}function mie(e,t,r){if(t.length===0)return[...e,r];const[n,...s]=t;return e.map(a=>a.id!==n?a:a.type==="object"?{...a,properties:mie(a.properties||[],s,r)}:a.type==="array"&&a.items?{...a,items:{...a.items,properties:mie(a.items.properties||[],s,r)}}:a)}function gie(e,t,r){if(t.length===0)return e.filter(a=>a.id!==r);const[n,...s]=t;return e.map(a=>a.id!==n?a:a.type==="object"?{...a,properties:gie(a.properties||[],s,r)}:a.type==="array"&&a.items?{...a,items:{...a.items,properties:gie(a.items.properties||[],s,r)}}:a)}function C$r({onChange:e,onFieldsChange:t,defaultValue:r,maxDepth:n=5,className:s,children:a}){const[i,l]=b.useState(()=>r||[]),c=b.useRef("");b.useEffect(()=>{const p=E$r(i),m=JSON.stringify(p);m!==c.current&&(c.current=m,e?.(p))},[i,e]),b.useEffect(()=>{t?.(i)},[i,t]);const u=b.useCallback(p=>{const m=$9();l(g=>mie(g,p,m))},[]),d=b.useCallback((p,m)=>{l(g=>gie(g,p,m))},[]),f=b.useCallback((p,m,g)=>{l(y=>pie(y,p,m,g))},[]),h=b.useMemo(()=>({fields:i,addField:u,removeField:d,updateField:f,maxDepth:n}),[i,u,d,f,n]);return o.jsx(O$r,{value:h,children:o.jsx("div",{className:Z(s),children:a})})}const mft=b.createContext(null);function j$r({children:e,value:t}){return o.jsx(mft.Provider,{value:t,children:e})}function vC(){const e=b.useContext(mft);if(!e)throw new Error("useJSONSchemaFormField must be used within a JSONSchemaForm.Field");return e}function T$r({field:e,parentPath:t=[],depth:r=0,className:n,children:s}){const{updateField:a,removeField:i}=L9(),l=b.useCallback(d=>{a(t,e.id,d)},[a,t,e.id]),c=b.useCallback(()=>{i(t,e.id)},[i,t,e.id]),u=b.useMemo(()=>({field:e,parentPath:t,depth:r,update:l,remove:c}),[e,t,r,l,c]);return o.jsx(j$r,{value:u,children:o.jsx("div",{className:Z(n),children:s})})}const gft=b.createContext(null);function N$r({children:e,value:t}){return o.jsx(gft.Provider,{value:t,children:e})}function yft(){return b.useContext(gft)}function A$r({className:e,children:t}){const{fields:r}=L9(),n=yft(),s=n?n.fields:r,a=n?n.parentPath:[],i=n?n.depth:0;return s.length===0?null:o.jsx("div",{className:e,children:s.map((l,c)=>t(l,c,{parentPath:a,depth:i}))})}function I$r(e){const{field:t,update:r}=vC(),n=b.useCallback(s=>{r({name:s.target.value})},[r]);return o.jsx(jx,{...e,size:"md",labelIsHidden:!0,name:`field-name-${t.id}`,value:t.name,onChange:n})}const R$r=[{value:"string",label:"String",icon:o.jsx(Ce,{size:"sm",children:o.jsx(Vce,{})})},{value:"number",label:"Number",icon:o.jsx(Ce,{size:"sm",children:o.jsx(Fce,{})})},{value:"boolean",label:"Boolean",icon:o.jsx(Ce,{size:"sm",children:o.jsx(Uce,{})})},{value:"text",label:"Text",icon:o.jsx(Ce,{size:"sm",children:o.jsx(cA,{})})},{value:"object",label:"Object",icon:o.jsx(Ce,{size:"sm",children:o.jsx(Db,{})})},{value:"array",label:"Array",icon:o.jsx(Ce,{size:"sm",children:o.jsx(zce,{})})}];function P$r({className:e,...t}){const{field:r,update:n}=vC(),s=b.useCallback(a=>{n({type:a})},[n]);return o.jsx($o,{className:Z("w-28 shrink-0",e),name:`field-type-${r.id}`,label:"Select type",labelIsHidden:!0,value:r.type,onValueChange:s,options:R$r,size:"md",...t})}function M$r({label:e="Optional",labelClassName:t,className:r,...n}){const{field:s,update:a}=vC(),i=b.useCallback(l=>{a({optional:l===!0})},[a]);return o.jsxs("label",{className:Z("flex items-center gap-2 text-ui-sm text-neutral3 cursor-pointer",t),children:[o.jsx(di,{...n,className:r,checked:s.optional,onCheckedChange:i}),e]})}function D$r({label:e="Nullable",labelClassName:t,className:r,...n}){const{field:s,update:a}=vC(),i=b.useCallback(l=>{a({nullable:l===!0})},[a]);return o.jsxs("label",{className:Z("flex items-center gap-2 text-ui-sm text-neutral3 cursor-pointer",t),children:[o.jsx(di,{...n,className:r,checked:s.nullable,onCheckedChange:i}),e]})}function L$r({children:e,tooltip:t="Remove field",...r}){const{remove:n}=vC();return o.jsx(Cn,{tooltipContent:t,onClick:n,size:"md",...r,children:e||o.jsx(jHe,{})})}function $$r({className:e,children:t}){const{maxDepth:r,updateField:n}=L9(),{field:s,parentPath:a,depth:i}=vC(),l=s.type==="object"||s.type==="array",c=i>=r;if(b.useEffect(()=>{s.type==="object"&&!s.properties&&n(a,s.id,{properties:[]}),s.type==="array"&&!s.items&&n(a,s.id,{items:$9({name:"items",type:"object",properties:[]})})},[s.type,s.properties,s.items,s.id,a,n]),!l||c)return null;const u=[...a,s.id],d=i+1,f=s.type==="object"?s.properties||[]:s.type==="array"&&s.items?s.items.properties||[]:[];return o.jsx(N$r,{value:{parentPath:u,depth:d,fields:f},children:o.jsx("div",{className:Z("pl-4 border-l border-border1 mt-2",e),children:t})})}function F$r({children:e,...t}){const{addField:r}=L9(),n=yft(),s=n?n.parentPath:[],a=b.useCallback(()=>{r(s)},[r,s]);return o.jsx(pe,{type:"button",...t,onClick:a,children:e||"Add field"})}const yi={Root:C$r,Field:T$r,FieldList:A$r,FieldName:I$r,FieldType:P$r,FieldOptional:M$r,FieldNullable:D$r,FieldRemove:L$r,NestedFields:$$r,AddField:F$r};function bC({data:e,className:t,labelsAreHidden:r,isLoading:n,LinkComponent:s}){const a=({children:i})=>r?o.jsx(Ku,{children:i}):i;return!e||e.length===0?null:o.jsx("dl",{className:Z("grid grid-cols-[auto_1fr] gap-x-4 items-start content-start",t),children:e.map(({label:i,value:l,icon:c,separator:u},d)=>{const f=Array.isArray(l);return o.jsxs(je.Fragment,{children:[o.jsxs("dt",{className:Z("text-neutral3 text-ui-md flex items-center gap-8 justify-between min-h-9"),children:[o.jsxs("span",{className:Z("flex items-center gap-2","[&>svg]:w-[1.4em] [&>svg]:h-[1.4em] [&>svg]:text-neutral3 [&>svg]:opacity-50",{"[&>svg]:opacity-20":n}),children:[c," ",o.jsx(a,{children:i})]}),!r&&o.jsx("span",{className:Z("text-neutral3","[&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:text-neutral3"),children:u})]}),o.jsx("dd",{className:Z("flex flex-wrap gap-2 py-1 min-h-9 text-ui-md items-center text-neutral5 text-wrap","[&>a]:text-neutral5 [&>a]:max-w-full [&>a]:w-auto truncate [&>a]:bg-surface4 [&>a]:transition-colors [&>a]:flex [&>a]:items-center [&>a]:gap-2 [&>a]:pt-0.5 [&>a]:pb-0.5 [&>a]:px-2 [&>a]:rounded-md [&>a]:text-ui-md [&>a]:min-h-7 [&>a]:leading-none","[&>a:hover]:text-neutral6 [&>a:hover]:bg-surface6","[&>a>svg]:w-[1em] [&>a>svg]:h-[1em] [&>a>svg]:text-neutral3 [&>a>svg]:ml-[-0.5em]"),children:n?o.jsx("span",{className:Z("bg-surface4 rounded-e-lg w-full"),style:{width:`${Math.floor(Math.random()*61)+50}%`},children:" "}):f?l?.map(h=>h.path&&s?o.jsx(eRe,{description:h.description,children:o.jsxs(s,{href:h.path,children:[h?.name," ",o.jsx(x_,{})]})},h.id):h.path?o.jsx(eRe,{description:h.description,children:o.jsxs("a",{href:h.path,children:[h?.name," ",o.jsx(x_,{})]})},h.id):o.jsx("span",{children:h?.name},h.id)):o.jsx(o.Fragment,{children:l||o.jsx("span",{className:"text-neutral3 text-ui-sm",children:"n/a"})})})]},i+d)})})}function eRe({description:e,children:t}){return e?o.jsxs(Sfe,{openDelay:250,children:[o.jsx(Ofe,{asChild:!0,children:t}),o.jsx(kfe,{children:o.jsxs(_fe,{className:"z-50 w-auto max-w-60 rounded-md bg-surface5 p-2 px-4 text-ui-sm text-neutral5 text-center",sideOffset:5,side:"top",children:[e,o.jsx(Efe,{className:"fill-surface5"})]})})]}):t}function z$r({children:e,className:t}){return o.jsx("div",{className:Z("mt-auto",t),children:e})}function B$r({children:e,className:t}){return o.jsx("nav",{className:Z("",t),children:e})}function vft({className:e}){return o.jsx("div",{className:Z("min-h-5 relative",'[&:after]:content-[""] [&:after]:block [&:after]:absolute [&:after]:h-0 [&:after]:border-border1 [&:after]:border-t [&:after]:top-1/2 [&:after]:left-3 [&:after]:right-3',e)})}function U$r({children:e,className:t,state:r="default",href:n,isActive:s,LinkComponent:a}){const i=r==="default",l=i?e:o.jsx(Ku,{children:e});return o.jsxs("div",{className:Z("grid grid-cols-[auto_1fr] items-center min-h-11",t),children:[o.jsx("header",{className:Z("text-ui-xs uppercase tracking-widest",{"pl-3":i,"text-black dark:text-white font-semibold":s,"text-neutral3/75":!s}),children:n&&i&&a?o.jsx(a,{href:n,className:Z("transition-colors duration-normal",{"hover:text-neutral5":!s,"text-black dark:text-white":s}),children:l}):l}),o.jsx(vft,{})]})}function V$r({link:e,state:t="default",children:r,isActive:n,className:s,LinkComponent:a}){const i=t==="collapsed",l=e?.variant==="featured",u=e?.url?.startsWith("http")?{target:"_blank",rel:"noreferrer"}:{};return o.jsx("li",{className:Z("flex relative","[&>a]:flex [&>a]:items-center [&>a]:min-h-8 [&>a]:gap-2.5 [&>a]:text-ui-md [&>a]:text-neutral3 [&>a]:py-1.5 [&>a]:px-3 [&>a]:w-full [&>a]:rounded-lg [&>a]:justify-center","[&>a]:transition-all [&>a]:duration-normal [&>a]:ease-out-custom","[&_svg]:w-4 [&_svg]:h-4 [&_svg]:text-neutral3/60 [&_svg]:transition-colors [&_svg]:duration-normal","[&>a:hover]:bg-surface4 [&>a:hover]:text-neutral5 [&>a:hover_svg]:text-neutral3",{"[&>a]:text-neutral5 [&>a]:bg-surface3":n,"[&_svg]:text-neutral5":n,"before:absolute before:left-0 before:top-1/2 before:-translate-y-1/2 before:w-0.5 before:h-5 before:bg-black dark:before:bg-white before:rounded-r-full before:transition-all before:duration-normal":n&&!i,"[&>a]:justify-start":!i,"[&_svg]:text-neutral3":i,"[&>a]:rounded-md [&>a]:my-2 [&>a]:bg-accent1Dark [&>a:hover]:bg-accent1Darker [&>a]:text-accent1 [&>a:hover]:text-accent1 [&>a]:border [&>a]:border-accent1/30":l,"dark:[&>a]:bg-accent1 dark:[&>a:hover]:bg-accent1/90 dark:[&>a]:text-black dark:[&>a:hover]:text-black dark:[&>a]:border-transparent":l,"[&_svg]:text-accent1 [&>a:hover_svg]:text-accent1 dark:[&_svg]:text-black/75 dark:[&>a:hover_svg]:text-black":l,"[&>a]:pl-7 [&>a]:text-ui-sm":e?.indent&&!i},s),children:e?o.jsx(o.Fragment,{children:i||e.tooltipMsg?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsxs(a,{href:e.url,...u,children:[e.icon&&e.icon,i?o.jsx(Ku,{children:e.name}):e.name," ",r]})}),o.jsx(Wr,{side:"right",align:"center",className:"ml-4",children:e.tooltipMsg?o.jsxs(o.Fragment,{children:[i&&`${e.name} | `," ",e.tooltipMsg]}):e.name})]}):o.jsxs(a,{href:e.url,...u,children:[e.icon&&e.icon,i?o.jsx(Ku,{children:e.name}):e.name," ",r,e.isExperimental&&o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(_F,{className:"ml-auto stroke-accent5"})}),o.jsx(Wr,{side:"right",align:"center",className:"ml-4",children:"Experimental Feature"})]})]})}):r})}function q$r({children:e,className:t}){return o.jsx("ul",{className:Z("grid gap-1 items-start content-center",t),children:e})}function H$r({children:e,className:t}){return o.jsx("section",{className:Z("grid items-start content-center relative",t),children:e})}const bft="sidebar:state",vme=je.createContext(null);function bme(){const e=je.useContext(vme);if(!e)throw new Error("useMainSidebar must be used within a MainSidebarProvider.");return e}function Q$r(){return je.useContext(vme)}const W$r=e=>{window.localStorage.setItem(bft,e.toString())};function G$r({children:e}){const[t,r]=je.useState(()=>"default");je.useLayoutEffect(()=>{const a=window.localStorage.getItem(bft);(a==="collapsed"||a==="default")&&r(a)},[]);const n=je.useCallback(()=>{W$r(t==="default"?"collapsed":"default"),r(t==="default"?"collapsed":"default")},[t]),s=je.useMemo(()=>({state:t,toggleSidebar:n}),[t,n]);return o.jsx(vme.Provider,{value:s,children:e})}function Z$r({children:e,className:t}){const{state:r,toggleSidebar:n}=bme(),s=r==="collapsed";return o.jsxs("div",{className:Z("flex flex-col h-full px-4 relative overflow-y-auto","transition-all duration-slow ease-out-custom",{"lg:min-w-52 xl:min-w-56 2xl:min-w-60 3xl:min-w-64 4xl:min-w-72":!s},t),children:[e,o.jsx("button",{onClick:n,className:Z("w-[.75rem] h-full right-0 top-0 absolute opacity-10",{"cursor-w-resize":!s,"cursor-e-resize":s}),"aria-label":"Toggle sidebar"})]})}function Y$r({className:e}){const{state:t,toggleSidebar:r}=bme(),n=t==="collapsed";return b.useEffect(()=>{const s=a=>{a.ctrlKey&&a.key==="b"&&(a.preventDefault(),r())};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[r]),o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("button",{onClick:r,className:Z("inline-flex w-auto items-center text-neutral3 h-8 px-3 rounded-md","hover:bg-surface4 hover:text-neutral5","transition-all duration-normal ease-out-custom","focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring","[&_svg]:w-4 [&_svg]:h-4 [&_svg]:text-neutral3 [&_svg]:transition-transform [&_svg]:duration-normal",e),"aria-label":"Toggle sidebar",children:o.jsx(Vzt,{className:Z({"rotate-180":n})})})}),o.jsxs(Wr,{children:["Toggle Sidebar",o.jsxs("div",{className:"flex items-center gap-1 [&>svg]:w-[1em] [&>svg]:h-[1em]",children:[o.jsx(Rzt,{})," Ctrl+B"]})]})]})}const Gh=Object.assign(Z$r,{Bottom:z$r,Nav:B$r,NavSection:H$r,NavLink:V$r,NavHeader:U$r,NavList:q$r,NavSeparator:vft,Trigger:Y$r});function rQ({children:e,className:t,isVisible:r,autoDismiss:n=!0,dismissTime:s=5e3,dismissible:a=!0,type:i="info"}){const[l,c]=b.useState(r),[u,d]=b.useState(!1);b.useEffect(()=>{if(a&&n&&r){const m=setTimeout(()=>{f()},s);return()=>clearTimeout(m)}},[n,r,s,a]),b.useEffect(()=>{r&&(d(!1),c(!0))},[r]);const f=()=>{d(!0),setTimeout(()=>{c(!1),d(!1)},200)};if(!l)return null;const h={info:"bg-surface4 border-border1",error:"bg-accent2Darker border-accent2/20",success:"bg-accent1Darker border-accent1/30",warning:"bg-accent6Darker border-accent6/30"},p={info:"text-accent5",error:"text-accent2",success:"text-accent1",warning:"text-accent6"};return o.jsxs("div",{className:Z("grid grid-cols-[auto_1fr_auto] gap-3 rounded-xl border py-2.5 px-3.5 text-ui-md text-neutral4 items-start","shadow-card",sn.all,u?"animate-out fade-out-0 slide-out-to-right-2 duration-200":"animate-in fade-in-0 slide-in-from-right-2 duration-300",h[i],t),children:[o.jsx("div",{className:Z("shrink-0 mt-0.5",p[i]),children:i==="error"||i==="warning"?o.jsx(LE,{className:"h-4 w-4"}):o.jsx(MR,{className:"h-4 w-4"})}),o.jsx("div",{className:"flex gap-2 items-start min-w-0",children:e}),a&&o.jsxs(pe,{variant:"ghost",className:Z("h-6 w-6 p-0 shrink-0",sn.colors,"hover:bg-surface5"),onClick:f,children:[o.jsx(Xl,{className:"h-4 w-4"}),o.jsx(Ku,{children:"Dismiss"})]})]})}function xft({children:e,isLoading:t}){return o.jsx("p",{className:Z("text-neutral2 text-sm max-w-[35rem] flex flex-wrap gap-x-4 gap-y-1 mt-1",{"bg-surface4 w-[40rem] max-w-[80%] rounded-md animate-pulse":t}),children:t?o.jsx(o.Fragment,{children:" "}):o.jsx(o.Fragment,{children:e})})}function wft({children:e,isLoading:t,size:r="default"}){return o.jsx("h1",{className:Z("text-neutral5 text-xl font-normal gap-2 flex items-center","[&>svg]:w-[1.25em] [&>svg]:h-[1.25em] [&>svg]:opacity-50",{"bg-surface4 w-60 max-w-[50%] rounded-md animate-pulse":t,"text-md":r==="smaller"}),children:t?o.jsx(o.Fragment,{children:" "}):o.jsx(o.Fragment,{children:e})})}function X$r({children:e,className:t,title:r,description:n,icon:s,isLoading:a}){const i=e===void 0&&r!==void 0;return o.jsx("header",{className:Z("w-full grid",t),children:i?o.jsxs(o.Fragment,{children:[o.jsxs(wft,{isLoading:a,children:[s," ",r]}),n!==void 0&&o.jsx(xft,{isLoading:a,children:n})]}):e})}const yn=Object.assign(X$r,{Title:wft,Description:xft});function K$r({children:e,className:t}){return o.jsx("header",{className:Z("grid items-center grid-cols-[1fr_auto]",t),children:e})}function J$r({headingLevel:e="h2",children:t,className:r}){const n=e;return o.jsx(n,{className:Z("flex items-center gap-2 text-ui-lg font-bold text-neutral4","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",r),children:t})}function Sft({children:e,className:t}){return o.jsx("section",{className:Z("grid gap-4",t),children:e})}function C1({children:e,className:t}){return o.jsx("section",{className:Z("grid gap-2",t),children:e})}const ml=Object.assign(Sft,{Header:K$r,Heading:J$r});function e3r(){return VE({settings:{fontFamily:"var(--geist-mono)",fontSize:"0.8125rem",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#939393",background:"transparent"},styles:[{tag:[ne.className,ne.propertyName]}]})}function t3r(){const e=ft.theme({"&":{backgroundColor:"transparent",color:"var(--neutral6)",fontSize:"0.8125rem"},"&.cm-editor .cm-scroller":{fontFamily:"var(--geist-mono)"},".cm-gutters":{backgroundColor:"transparent",color:"var(--neutral2)",borderRight:"none"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-activeLine":{backgroundColor:"transparent"},".cm-activeLineGutter":{backgroundColor:"transparent"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--neutral6)"}}),t=$p.define([{tag:[ne.comment,ne.bracket],color:"var(--neutral2)"},{tag:[ne.string,ne.meta,ne.regexp],color:"var(--accent1)"},{tag:[ne.atom,ne.bool,ne.special(ne.variableName)],color:"var(--accent6)"},{tag:[ne.keyword,ne.operator,ne.tagName],color:"var(--accent2)"},{tag:[ne.function(ne.propertyName),ne.propertyName],color:"var(--accent5)"},{tag:[ne.definition(ne.variableName),ne.function(ne.variableName),ne.className,ne.attributeName],color:"var(--accent3)"},{tag:[ne.variableName,ne.number],color:"var(--accent5)"},{tag:[ne.name,ne.quote],color:"var(--accent1)"}]);return[e,Yx(t)]}const r3r=()=>{const e=IP();return b.useMemo(()=>e?e3r():t3r(),[e])};function n3r({codeStr:e="",title:t,icon:r,simplified:n=!1}){const s=r3r(),[a,i]=b.useState(!1),l=b.useMemo(()=>{try{const u=JSON.parse(e);return yie(u||"")}catch{return!1}},[e]),c=a?e?.replace(/\\n/g,`
|
|
293
293
|
`):e;return o.jsxs(ml,{children:[o.jsxs(ml.Header,{children:[o.jsxs(ml.Heading,{children:[r,t]}),o.jsxs(ps,{children:[o.jsx(Xa,{content:e||"No content"}),l&&o.jsx(pe,{onClick:()=>i(!a),children:a?o.jsx(cA,{}):o.jsx(w3,{})})]})]}),e&&o.jsx("div",{className:"dark:bg-black/20 bg-surface3 p-4 overflow-hidden rounded-xl border dark:border-white/10 border-border1 text-neutral4 text-ui-md break-all max-h-[30vh] overflow-y-auto",children:n?o.jsx("div",{className:"text-neutral4 font-mono break-all px-2",children:o.jsx("pre",{className:"text-wrap",children:e})}):o.jsx(xc,{extensions:[j_(),ft.lineWrapping],theme:s,value:c})})]})}function yie(e){if(typeof e=="string"){const t=e.indexOf(`
|
|
@@ -493,7 +493,7 @@ Error message: ${Ybt(r)}`,cause:r}),this[axt]=!0,this.value=t}static isInstance(
|
|
|
493
493
|
`:`[${n[c]}\r
|
|
494
494
|
]`;continue}s+=n[c],n[c]==="\\"?a=!0:i&&n[c]==="]"?i=!1:!i&&n[c]==="["&&(i=!0)}return s}function fxt(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===Pe.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,s)=>({...n,[s]:Hs(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",s]})??td(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};const r={type:"object",additionalProperties:Hs(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===Pe.ZodString&&e.keyType._def.checks?.length){const{type:n,...s}=dxt(e.keyType._def,t);return{...r,propertyNames:s}}else{if(e.keyType?._def.typeName===Pe.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===Pe.ZodBranded&&e.keyType._def.type._def.typeName===Pe.ZodString&&e.keyType._def.type._def.checks?.length){const{type:n,...s}=cxt(e.keyType._def,t);return{...r,propertyNames:s}}}return r}function Dan(e,t){if(t.mapStrategy==="record")return fxt(e,t);const r=Hs(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||td(t),n=Hs(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||td(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Lan(e){const t=e.values,n=Object.keys(e.values).filter(a=>typeof t[t[a]]!="number").map(a=>t[a]),s=Array.from(new Set(n.map(a=>typeof a)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}function $an(e){return e.target==="openAi"?void 0:{not:td({...e,currentPath:[...e.currentPath,"not"]})}}function Fan(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var R6={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function zan(e,t){if(t.target==="openApi3")return GLe(e,t);const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in R6&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((s,a)=>{const i=R6[a._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((s,a)=>{const i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(a._def.value===null)return[...s,"null"];default:return s}},[]);if(n.length===r.length){const s=n.filter((a,i,l)=>l.indexOf(a)===i);return{type:s.length>1?s:s[0],enum:r.reduce((a,i)=>a.includes(i._def.value)?a:[...a,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(a=>!n.includes(a))],[])};return GLe(e,t)}var GLe=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,s)=>Hs(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${s}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Ban(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:R6[e.innerType._def.typeName],nullable:!0}:{type:[R6[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){const n=Hs(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const r=Hs(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Uan(e,t){const r={type:"number"};if(!e.checks)return r;for(const n of e.checks)switch(n.kind){case"int":r.type="integer",oxt(r,"type",n.message,t);break;case"min":t.target==="jsonSchema7"?n.inclusive?ha(r,"minimum",n.value,n.message,t):ha(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),ha(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?ha(r,"maximum",n.value,n.message,t):ha(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),ha(r,"maximum",n.value,n.message,t));break;case"multipleOf":ha(r,"multipleOf",n.value,n.message,t);break}return r}function Van(e,t){const r=t.target==="openAi",n={type:"object",properties:{}},s=[],a=e.shape();for(const l in a){let c=a[l];if(c===void 0||c._def===void 0)continue;let u=Han(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);const d=Hs(c._def,{...t,currentPath:[...t.currentPath,"properties",l],propertyPath:[...t.currentPath,"properties",l]});d!==void 0&&(n.properties[l]=d,u||s.push(l))}s.length&&(n.required=s);const i=qan(e,t);return i!==void 0&&(n.additionalProperties=i),n}function qan(e,t){if(e.catchall._def.typeName!=="ZodNever")return Hs(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function Han(e){try{return e.isOptional()}catch{return!0}}var Qan=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Hs(e.innerType._def,t);const r=Hs(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:td(t)},r]}:td(t)},Wan=(e,t)=>{if(t.pipeStrategy==="input")return Hs(e.in._def,t);if(t.pipeStrategy==="output")return Hs(e.out._def,t);const r=Hs(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=Hs(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}};function Gan(e,t){return Hs(e.type._def,t)}function Zan(e,t){const n={type:"array",uniqueItems:!0,items:Hs(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&ha(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&ha(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}function Yan(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>Hs(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Hs(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>Hs(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Xan(e){return{not:td(e)}}function Kan(e){return td(e)}var Jan=(e,t)=>Hs(e.innerType._def,t),ein=(e,t,r)=>{switch(t){case Pe.ZodString:return dxt(e,r);case Pe.ZodNumber:return Uan(e,r);case Pe.ZodObject:return Van(e,r);case Pe.ZodBigInt:return kan(e,r);case Pe.ZodBoolean:return _an();case Pe.ZodDate:return uxt(e,r);case Pe.ZodUndefined:return Xan(r);case Pe.ZodNull:return Fan(r);case Pe.ZodArray:return Oan(e,r);case Pe.ZodUnion:case Pe.ZodDiscriminatedUnion:return zan(e,r);case Pe.ZodIntersection:return Ian(e,r);case Pe.ZodTuple:return Yan(e,r);case Pe.ZodRecord:return fxt(e,r);case Pe.ZodLiteral:return Ran(e,r);case Pe.ZodEnum:return Nan(e);case Pe.ZodNativeEnum:return Lan(e);case Pe.ZodNullable:return Ban(e,r);case Pe.ZodOptional:return Qan(e,r);case Pe.ZodMap:return Dan(e,r);case Pe.ZodSet:return Zan(e,r);case Pe.ZodLazy:return()=>e.getter()._def;case Pe.ZodPromise:return Gan(e,r);case Pe.ZodNaN:case Pe.ZodNever:return $an(r);case Pe.ZodEffects:return Tan(e,r);case Pe.ZodAny:return td(r);case Pe.ZodUnknown:return Kan(r);case Pe.ZodDefault:return jan(e,r);case Pe.ZodBranded:return cxt(e,r);case Pe.ZodReadonly:return Jan(e,r);case Pe.ZodCatch:return Ean(e,r);case Pe.ZodPipeline:return Wan(e,r);case Pe.ZodFunction:case Pe.ZodVoid:case Pe.ZodSymbol:return;default:return(n=>{})()}};function Hs(e,t,r=!1){const n=t.seen.get(e);if(t.override){const l=t.override?.(e,t,n,r);if(l!==xan)return l}if(n&&!r){const l=tin(n,t);if(l!==void 0)return l}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const a=ein(e,e.typeName,t),i=typeof a=="function"?Hs(a(),t):a;if(i&&rin(e,t,i),t.postProcess){const l=t.postProcess(i,e,t);return s.jsonSchema=i,l}return s.jsonSchema=i,i}var tin=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:lxt(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),td(t)):t.$refStrategy==="seen"?td(t):void 0}},rin=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r),nin=(e,t)=>{const r=San(t);let n=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,d])=>({...c,[u]:Hs(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??td(r)}),{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,a=Hs(e._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1)??td(r),i=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;i!==void 0&&(a.title=i),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const l=s===void 0?n?{...a,[r.definitionPath]:n}:a:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...n,[s]:a}};return r.target==="jsonSchema7"?l.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(l.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in l||"oneOf"in l||"allOf"in l||"type"in l&&Array.isArray(l.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),l},sin=nin;function ain(e){const t=["ROOT"];let r=-1,n=null;function s(c,u,d){switch(c){case'"':{r=u,t.pop(),t.push(d),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{r=u,n=u,t.pop(),t.push(d),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(d),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{r=u,t.pop(),t.push(d),t.push("INSIDE_NUMBER");break}case"{":{r=u,t.pop(),t.push(d),t.push("INSIDE_OBJECT_START");break}case"[":{r=u,t.pop(),t.push(d),t.push("INSIDE_ARRAY_START");break}}}function a(c,u){switch(c){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{r=u,t.pop();break}}}function i(c,u){switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=u,t.pop();break}}}for(let c=0;c<e.length;c++){const u=e[c];switch(t[t.length-1]){case"ROOT":s(u,c,"FINISH");break;case"INSIDE_OBJECT_START":{switch(u){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{r=c,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{u==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{u==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{u===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{s(u,c,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{a(u,c);break}case"INSIDE_STRING":{switch(u){case'"':{t.pop(),r=c;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:r=c}break}case"INSIDE_ARRAY_START":{u==="]"?(r=c,t.pop()):(r=c,s(u,c,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(u){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=c,t.pop();break}default:{r=c;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{s(u,c,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),r=c;break}case"INSIDE_NUMBER":{switch(u){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{r=c;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(u,c),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(u,c);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(u,c);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(u,c);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const f=e.substring(n,c+1);!"false".startsWith(f)&&!"true".startsWith(f)&&!"null".startsWith(f)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(u,c):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(u,c)):r=c;break}}}let l=e.slice(0,r+1);for(let c=t.length-1;c>=0;c--)switch(t[c]){case"INSIDE_STRING":{l+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{l+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{l+="]";break}case"INSIDE_LITERAL":{const d=e.substring(n,e.length);"true".startsWith(d)?l+="true".slice(d.length):"false".startsWith(d)?l+="false".slice(d.length):"null".startsWith(d)&&(l+="null".slice(d.length))}}return l}function iin(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=rle({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=rle({text:ain(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var oin={code:"0",name:"text",parse:e=>{if(typeof e!="string")throw new Error('"text" parts expect a string value.');return{type:"text",value:e}}},lin={code:"2",name:"data",parse:e=>{if(!Array.isArray(e))throw new Error('"data" parts expect an array value.');return{type:"data",value:e}}},cin={code:"3",name:"error",parse:e=>{if(typeof e!="string")throw new Error('"error" parts expect a string value.');return{type:"error",value:e}}},uin={code:"8",name:"message_annotations",parse:e=>{if(!Array.isArray(e))throw new Error('"message_annotations" parts expect an array value.');return{type:"message_annotations",value:e}}},din={code:"9",name:"tool_call",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("toolName"in e)||typeof e.toolName!="string"||!("args"in e)||typeof e.args!="object")throw new Error('"tool_call" parts expect an object with a "toolCallId", "toolName", and "args" property.');return{type:"tool_call",value:e}}},fin={code:"a",name:"tool_result",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("result"in e))throw new Error('"tool_result" parts expect an object with a "toolCallId" and a "result" property.');return{type:"tool_result",value:e}}},hin={code:"b",name:"tool_call_streaming_start",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("toolName"in e)||typeof e.toolName!="string")throw new Error('"tool_call_streaming_start" parts expect an object with a "toolCallId" and "toolName" property.');return{type:"tool_call_streaming_start",value:e}}},pin={code:"c",name:"tool_call_delta",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("argsTextDelta"in e)||typeof e.argsTextDelta!="string")throw new Error('"tool_call_delta" parts expect an object with a "toolCallId" and "argsTextDelta" property.');return{type:"tool_call_delta",value:e}}},min={code:"d",name:"finish_message",parse:e=>{if(e==null||typeof e!="object"||!("finishReason"in e)||typeof e.finishReason!="string")throw new Error('"finish_message" parts expect an object with a "finishReason" property.');const t={finishReason:e.finishReason};return"usage"in e&&e.usage!=null&&typeof e.usage=="object"&&"promptTokens"in e.usage&&"completionTokens"in e.usage&&(t.usage={promptTokens:typeof e.usage.promptTokens=="number"?e.usage.promptTokens:Number.NaN,completionTokens:typeof e.usage.completionTokens=="number"?e.usage.completionTokens:Number.NaN}),{type:"finish_message",value:t}}},gin={code:"e",name:"finish_step",parse:e=>{if(e==null||typeof e!="object"||!("finishReason"in e)||typeof e.finishReason!="string")throw new Error('"finish_step" parts expect an object with a "finishReason" property.');const t={finishReason:e.finishReason,isContinued:!1};return"usage"in e&&e.usage!=null&&typeof e.usage=="object"&&"promptTokens"in e.usage&&"completionTokens"in e.usage&&(t.usage={promptTokens:typeof e.usage.promptTokens=="number"?e.usage.promptTokens:Number.NaN,completionTokens:typeof e.usage.completionTokens=="number"?e.usage.completionTokens:Number.NaN}),"isContinued"in e&&typeof e.isContinued=="boolean"&&(t.isContinued=e.isContinued),{type:"finish_step",value:t}}},yin={code:"f",name:"start_step",parse:e=>{if(e==null||typeof e!="object"||!("messageId"in e)||typeof e.messageId!="string")throw new Error('"start_step" parts expect an object with an "id" property.');return{type:"start_step",value:{messageId:e.messageId}}}},vin={code:"g",name:"reasoning",parse:e=>{if(typeof e!="string")throw new Error('"reasoning" parts expect a string value.');return{type:"reasoning",value:e}}},bin={code:"h",name:"source",parse:e=>{if(e==null||typeof e!="object")throw new Error('"source" parts expect a Source object.');return{type:"source",value:e}}},xin={code:"i",name:"redacted_reasoning",parse:e=>{if(e==null||typeof e!="object"||!("data"in e)||typeof e.data!="string")throw new Error('"redacted_reasoning" parts expect an object with a "data" property.');return{type:"redacted_reasoning",value:{data:e.data}}}},win={code:"j",name:"reasoning_signature",parse:e=>{if(e==null||typeof e!="object"||!("signature"in e)||typeof e.signature!="string")throw new Error('"reasoning_signature" parts expect an object with a "signature" property.');return{type:"reasoning_signature",value:{signature:e.signature}}}},Sin={code:"k",name:"file",parse:e=>{if(e==null||typeof e!="object"||!("data"in e)||typeof e.data!="string"||!("mimeType"in e)||typeof e.mimeType!="string")throw new Error('"file" parts expect an object with a "data" and "mimeType" property.');return{type:"file",value:e}}},tye=[oin,lin,cin,uin,din,fin,hin,pin,min,gin,yin,vin,bin,xin,win,Sin];Object.fromEntries(tye.map(e=>[e.code,e]));Object.fromEntries(tye.map(e=>[e.name,e.code]));function hxt(e,t){const r=tye.find(n=>n.name===e);if(!r)throw new Error(`Invalid stream part type: ${e}`);return`${r.code}:${JSON.stringify(t)}
|
|
495
495
|
`}function Oin(e,t){var r;const n=(r=void 0)!=null?r:!1;return kin(sin(e,{$refStrategy:n?"root":"none",target:"jsonSchema7"}),{validate:s=>{const a=e.safeParse(s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}var nle=Symbol.for("vercel.ai.schema");function kin(e,{validate:t}={}){return{[nle]:!0,_type:void 0,[I6]:!0,jsonSchema:e,validate:t}}function _in(e){return typeof e=="object"&&e!==null&&nle in e&&e[nle]===!0&&"jsonSchema"in e&&"validate"in e}function Ein(e){return _in(e)?e:Oin(e)}var Cin=typeof globalThis=="object"?globalThis:global,Lw="1.9.0",ZLe=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function jin(e){var t=new Set([e]),r=new Set,n=e.match(ZLe);if(!n)return function(){return!1};var s={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(s.prerelease!=null)return function(c){return c===e};function a(l){return r.add(l),!1}function i(l){return t.add(l),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;var u=c.match(ZLe);if(!u)return a(c);var d={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};return d.prerelease!=null||s.major!==d.major?a(c):s.major===0?s.minor===d.minor&&s.patch<=d.patch?i(c):a(c):s.minor<=d.minor?i(c):a(c)}}var Tin=jin(Lw),Nin=Lw.split(".")[0],oR=Symbol.for("opentelemetry.js.api."+Nin),lR=Cin;function rye(e,t,r,n){var s;n===void 0&&(n=!1);var a=lR[oR]=(s=lR[oR])!==null&&s!==void 0?s:{version:Lw};if(!n&&a[e]){var i=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(i.stack||i.message),!1}if(a.version!==Lw){var i=new Error("@opentelemetry/api: Registration of version v"+a.version+" for "+e+" does not match previously registered API v"+Lw);return r.error(i.stack||i.message),!1}return a[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+Lw+"."),!0}function cR(e){var t,r,n=(t=lR[oR])===null||t===void 0?void 0:t.version;if(!(!n||!Tin(n)))return(r=lR[oR])===null||r===void 0?void 0:r[e]}function nye(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+Lw+".");var r=lR[oR];r&&delete r[e]}var Ain=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),s,a=[],i;try{for(;!(s=n.next()).done;)a.push(s.value)}catch(l){i={error:l}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return a},Iin=function(e,t,r){if(arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},Rin=(function(){function e(t){this._namespace=t.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return kT("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return kT("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return kT("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return kT("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return kT("verbose",this._namespace,t)},e})();function kT(e,t,r){var n=cR("diag");if(n)return r.unshift(t),n[e].apply(n,Iin([],Ain(r),!1))}var Rd;(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(Rd||(Rd={}));function Pin(e,t){e<Rd.NONE?e=Rd.NONE:e>Rd.ALL&&(e=Rd.ALL),t=t||{};function r(n,s){var a=t[n];return typeof a=="function"&&e>=s?a.bind(t):function(){}}return{error:r("error",Rd.ERROR),warn:r("warn",Rd.WARN),info:r("info",Rd.INFO),debug:r("debug",Rd.DEBUG),verbose:r("verbose",Rd.VERBOSE)}}var Min=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),s,a=[],i;try{for(;!(s=n.next()).done;)a.push(s.value)}catch(l){i={error:l}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return a},Din=function(e,t,r){if(arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},Lin="diag",P6=(function(){function e(){function t(s){return function(){for(var a=[],i=0;i<arguments.length;i++)a[i]=arguments[i];var l=cR("diag");if(l)return l[s].apply(l,Din([],Min(a),!1))}}var r=this,n=function(s,a){var i,l,c;if(a===void 0&&(a={logLevel:Rd.INFO}),s===r){var u=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((i=u.stack)!==null&&i!==void 0?i:u.message),!1}typeof a=="number"&&(a={logLevel:a});var d=cR("diag"),f=Pin((l=a.logLevel)!==null&&l!==void 0?l:Rd.INFO,s);if(d&&!a.suppressOverrideMessage){var h=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";d.warn("Current logger will be overwritten from "+h),f.warn("Current logger will overwrite one already registered from "+h)}return rye("diag",f,r,!0)};r.setLogger=n,r.disable=function(){nye(Lin,r)},r.createComponentLogger=function(s){return new Rin(s)},r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e})();function $in(e){return Symbol.for(e)}var Fin=(function(){function e(t){var r=this;r._currentContext=t?new Map(t):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,s){var a=new e(r._currentContext);return a._currentContext.set(n,s),a},r.deleteValue=function(n){var s=new e(r._currentContext);return s._currentContext.delete(n),s}}return e})(),zin=new Fin,Bin=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),s,a=[],i;try{for(;!(s=n.next()).done;)a.push(s.value)}catch(l){i={error:l}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return a},Uin=function(e,t,r){if(arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},Vin=(function(){function e(){}return e.prototype.active=function(){return zin},e.prototype.with=function(t,r,n){for(var s=[],a=3;a<arguments.length;a++)s[a-3]=arguments[a];return r.call.apply(r,Uin([n],Bin(s),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})(),qin=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),s,a=[],i;try{for(;!(s=n.next()).done;)a.push(s.value)}catch(l){i={error:l}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return a},Hin=function(e,t,r){if(arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},uG="context",Qin=new Vin,pxt=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(t){return rye(uG,t,P6.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(t,r,n){for(var s,a=[],i=3;i<arguments.length;i++)a[i-3]=arguments[i];return(s=this._getContextManager()).with.apply(s,Hin([t,r,n],qin(a),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return cR(uG)||Qin},e.prototype.disable=function(){this._getContextManager().disable(),nye(uG,P6.instance())},e})(),sle;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(sle||(sle={}));var mxt="0000000000000000",gxt="00000000000000000000000000000000",Win={traceId:gxt,spanId:mxt,traceFlags:sle.NONE},FN=(function(){function e(t){t===void 0&&(t=Win),this._spanContext=t}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(t,r){return this},e.prototype.setAttributes=function(t){return this},e.prototype.addEvent=function(t,r){return this},e.prototype.addLink=function(t){return this},e.prototype.addLinks=function(t){return this},e.prototype.setStatus=function(t){return this},e.prototype.updateName=function(t){return this},e.prototype.end=function(t){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(t,r){},e})(),sye=$in("OpenTelemetry Context Key SPAN");function aye(e){return e.getValue(sye)||void 0}function Gin(){return aye(pxt.getInstance().active())}function iye(e,t){return e.setValue(sye,t)}function Zin(e){return e.deleteValue(sye)}function Yin(e,t){return iye(e,new FN(t))}function yxt(e){var t;return(t=aye(e))===null||t===void 0?void 0:t.spanContext()}var Xin=/^([0-9a-f]{32})$/i,Kin=/^[0-9a-f]{16}$/i;function Jin(e){return Xin.test(e)&&e!==gxt}function eon(e){return Kin.test(e)&&e!==mxt}function vxt(e){return Jin(e.traceId)&&eon(e.spanId)}function ton(e){return new FN(e)}var dG=pxt.getInstance(),bxt=(function(){function e(){}return e.prototype.startSpan=function(t,r,n){n===void 0&&(n=dG.active());var s=!!r?.root;if(s)return new FN;var a=n&&yxt(n);return ron(a)&&vxt(a)?new FN(a):new FN},e.prototype.startActiveSpan=function(t,r,n,s){var a,i,l;if(!(arguments.length<2)){arguments.length===2?l=r:arguments.length===3?(a=r,l=n):(a=r,i=n,l=s);var c=i??dG.active(),u=this.startSpan(t,a,c),d=iye(c,u);return dG.with(d,l,void 0,u)}},e})();function ron(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var non=new bxt,son=(function(){function e(t,r,n,s){this._provider=t,this.name=r,this.version=n,this.options=s}return e.prototype.startSpan=function(t,r,n){return this._getTracer().startSpan(t,r,n)},e.prototype.startActiveSpan=function(t,r,n,s){var a=this._getTracer();return Reflect.apply(a.startActiveSpan,a,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):non},e})(),aon=(function(){function e(){}return e.prototype.getTracer=function(t,r,n){return new bxt},e})(),ion=new aon,YLe=(function(){function e(){}return e.prototype.getTracer=function(t,r,n){var s;return(s=this.getDelegateTracer(t,r,n))!==null&&s!==void 0?s:new son(this,t,r,n)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:ion},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateTracer=function(t,r,n){var s;return(s=this._delegate)===null||s===void 0?void 0:s.getTracer(t,r,n)},e})(),XLe;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(XLe||(XLe={}));var fG="trace",oon=(function(){function e(){this._proxyTracerProvider=new YLe,this.wrapSpanContext=ton,this.isSpanContextValid=vxt,this.deleteSpan=Zin,this.getSpan=aye,this.getActiveSpan=Gin,this.getSpanContext=yxt,this.setSpan=iye,this.setSpanContext=Yin}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(t){var r=rye(fG,this._proxyTracerProvider,P6.instance());return r&&this._proxyTracerProvider.setDelegate(t),r},e.prototype.getTracerProvider=function(){return cR(fG)||this._proxyTracerProvider},e.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},e.prototype.disable=function(){nye(fG,P6.instance()),this._proxyTracerProvider=new YLe},e})();oon.getInstance();var lon=Object.defineProperty,oye=(e,t)=>{for(var r in t)lon(e,r,{get:t[r],enumerable:!0})};function xxt(e,{contentType:t,dataStreamVersion:r}){const n=new Headers(e??{});return n.has("Content-Type")||n.set("Content-Type",t),n.set("X-Vercel-AI-Data-Stream",r),n}var wxt="AI_NoObjectGeneratedError",Sxt=`vercel.ai.error.${wxt}`,con=Symbol.for(Sxt),Oxt,KLe=class extends Rh{constructor({message:e="No object generated.",cause:t,text:r,response:n,usage:s,finishReason:a}){super({name:wxt,message:e,cause:t}),this[Oxt]=!0,this.text=r,this.response=n,this.usage=s,this.finishReason=a}static isInstance(e){return Rh.hasMarker(e,Sxt)}};Oxt=con;var kxt="AI_InvalidDataContentError",_xt=`vercel.ai.error.${kxt}`,uon=Symbol.for(_xt),Ext,JLe=class extends Rh{constructor({content:e,cause:t,message:r=`Invalid data content. Expected a base64 string, Uint8Array, ArrayBuffer, or Buffer, but got ${typeof e}.`}){super({name:kxt,message:r,cause:t}),this[Ext]=!0,this.content=e}static isInstance(e){return Rh.hasMarker(e,_xt)}};Ext=uon;var Cxt=Hr([de(),Sh(Uint8Array),Sh(ArrayBuffer),Xle(e=>{var t,r;return(r=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?r:!1},{message:"Must be a Buffer"})]);function e$e(e){if(e instanceof Uint8Array)return e;if(typeof e=="string")try{return ban(e)}catch(t){throw new JLe({message:"Invalid data content. Content string is not a base64-encoded media.",content:e,cause:t})}if(e instanceof ArrayBuffer)return new Uint8Array(e);throw new JLe({content:e})}function don(e){try{return new TextDecoder().decode(e)}catch{throw new Error("Error decoding Uint8Array to text")}}function t$e(e){var t,r,n;const s=[];for(const a of e){let i;try{i=new URL(a.url)}catch{throw new Error(`Invalid URL: ${a.url}`)}switch(i.protocol){case"http:":case"https:":{if((t=a.contentType)!=null&&t.startsWith("image/"))s.push({type:"image",image:i});else{if(!a.contentType)throw new Error("If the attachment is not an image, it must specify a content type");s.push({type:"file",data:i,mimeType:a.contentType})}break}case"data:":{let l,c,u;try{[l,c]=a.url.split(","),u=l.split(";")[0].split(":")[1]}catch{throw new Error(`Error processing data URL: ${a.url}`)}if(u==null||c==null)throw new Error(`Invalid data URL format: ${a.url}`);if((r=a.contentType)!=null&&r.startsWith("image/"))s.push({type:"image",image:e$e(c)});else if((n=a.contentType)!=null&&n.startsWith("text/"))s.push({type:"text",text:don(e$e(c))});else{if(!a.contentType)throw new Error("If the attachment is not an image or text, it must specify a content type");s.push({type:"file",data:c,mimeType:a.contentType})}break}default:throw new Error(`Unsupported URL protocol: ${i.protocol}`)}}return s}var jxt="AI_MessageConversionError",Txt=`vercel.ai.error.${jxt}`,fon=Symbol.for(Txt),Nxt,hG=class extends Rh{constructor({originalMessage:e,message:t}){super({name:jxt,message:t}),this[Nxt]=!0,this.originalMessage=e}static isInstance(e){return Rh.hasMarker(e,Txt)}};Nxt=fon;function hon(e,t){var r,n;const s=(r=void 0)!=null?r:{},a=[];for(let i=0;i<e.length;i++){const l=e[i],c=i===e.length-1,{role:u,content:d,experimental_attachments:f}=l;switch(u){case"system":{a.push({role:"system",content:d});break}case"user":{if(l.parts==null)a.push({role:"user",content:f?[{type:"text",text:d},...t$e(f)]:d});else{const h=l.parts.filter(p=>p.type==="text").map(p=>({type:"text",text:p.text}));a.push({role:"user",content:f?[...h,...t$e(f)]:h})}break}case"assistant":{if(l.parts!=null){let m=function(){const w=[];for(const k of x)switch(k.type){case"file":case"text":{w.push(k);break}case"reasoning":{for(const _ of k.details)switch(_.type){case"text":w.push({type:"reasoning",text:_.text,signature:_.signature});break;case"redacted":w.push({type:"redacted-reasoning",data:_.data});break}break}case"tool-invocation":w.push({type:"tool-call",toolCallId:k.toolInvocation.toolCallId,toolName:k.toolInvocation.toolName,args:k.toolInvocation.args});break;default:{const _=k;throw new Error(`Unsupported part: ${_}`)}}a.push({role:"assistant",content:w});const S=x.filter(k=>k.type==="tool-invocation").map(k=>k.toolInvocation);S.length>0&&a.push({role:"tool",content:S.map(k=>{if(!("result"in k))throw new hG({originalMessage:l,message:"ToolInvocation must have a result: "+JSON.stringify(k)});const{toolCallId:_,toolName:E,result:T}=k,j=s[E];return j?.experimental_toToolResultContent!=null?{type:"tool-result",toolCallId:_,toolName:E,result:j.experimental_toToolResultContent(T),experimental_content:j.experimental_toToolResultContent(T)}:{type:"tool-result",toolCallId:_,toolName:E,result:T}})}),x=[],y=!1,g++},g=0,y=!1,x=[];for(const w of l.parts)switch(w.type){case"text":{y&&m(),x.push(w);break}case"file":case"reasoning":{x.push(w);break}case"tool-invocation":{((n=w.toolInvocation.step)!=null?n:0)!==g&&m(),x.push(w),y=!0;break}}m();break}const h=l.toolInvocations;if(h==null||h.length===0){a.push({role:"assistant",content:d});break}const p=h.reduce((m,g)=>{var y;return Math.max(m,(y=g.step)!=null?y:0)},0);for(let m=0;m<=p;m++){const g=h.filter(y=>{var x;return((x=y.step)!=null?x:0)===m});g.length!==0&&(a.push({role:"assistant",content:[...c&&d&&m===0?[{type:"text",text:d}]:[],...g.map(({toolCallId:y,toolName:x,args:w})=>({type:"tool-call",toolCallId:y,toolName:x,args:w}))]}),a.push({role:"tool",content:g.map(y=>{if(!("result"in y))throw new hG({originalMessage:l,message:"ToolInvocation must have a result: "+JSON.stringify(y)});const{toolCallId:x,toolName:w,result:S}=y,k=s[w];return k?.experimental_toToolResultContent!=null?{type:"tool-result",toolCallId:x,toolName:w,result:k.experimental_toToolResultContent(S),experimental_content:k.experimental_toToolResultContent(S)}:{type:"tool-result",toolCallId:x,toolName:w,result:S}})}))}d&&!c&&a.push({role:"assistant",content:d});break}case"data":break;default:{const h=u;throw new hG({originalMessage:l,message:`Unsupported role: ${h}`})}}}return a}var ale=Zle(()=>Hr([Wle(),de(),St(),yo(),Qs(de(),ale),Et(ale)])),ro=Qs(de(),Qs(de(),ale)),pon=Et(Hr([_e({type:zt("text"),text:de()}),_e({type:zt("image"),data:de(),mimeType:de().optional()})])),Axt=_e({type:zt("text"),text:de(),providerOptions:ro.optional(),experimental_providerMetadata:ro.optional()}),mon=_e({type:zt("image"),image:Hr([Cxt,Sh(URL)]),mimeType:de().optional(),providerOptions:ro.optional(),experimental_providerMetadata:ro.optional()}),Ixt=_e({type:zt("file"),data:Hr([Cxt,Sh(URL)]),filename:de().optional(),mimeType:de(),providerOptions:ro.optional(),experimental_providerMetadata:ro.optional()}),gon=_e({type:zt("reasoning"),text:de(),providerOptions:ro.optional(),experimental_providerMetadata:ro.optional()}),yon=_e({type:zt("redacted-reasoning"),data:de(),providerOptions:ro.optional(),experimental_providerMetadata:ro.optional()}),von=_e({type:zt("tool-call"),toolCallId:de(),toolName:de(),args:Na(),providerOptions:ro.optional(),experimental_providerMetadata:ro.optional()}),bon=_e({type:zt("tool-result"),toolCallId:de(),toolName:de(),result:Na(),content:pon.optional(),isError:yo().optional(),providerOptions:ro.optional(),experimental_providerMetadata:ro.optional()}),xon=_e({role:zt("system"),content:de(),providerOptions:ro.optional(),experimental_providerMetadata:ro.optional()}),won=_e({role:zt("user"),content:Hr([de(),Et(Hr([Axt,mon,Ixt]))]),providerOptions:ro.optional(),experimental_providerMetadata:ro.optional()}),Son=_e({role:zt("assistant"),content:Hr([de(),Et(Hr([Axt,Ixt,gon,yon,von]))]),providerOptions:ro.optional(),experimental_providerMetadata:ro.optional()}),Oon=_e({role:zt("tool"),content:Et(bon),providerOptions:ro.optional(),experimental_providerMetadata:ro.optional()});Hr([xon,won,Son,Oon]);var kon="JSON schema:",_on="You MUST answer with a JSON object that matches the JSON schema above.",Eon="You MUST answer with JSON.";function Con({prompt:e,schema:t,schemaPrefix:r=t!=null?kon:void 0,schemaSuffix:n=t!=null?_on:Eon}){return[e!=null&&e.length>0?e:void 0,e!=null&&e.length>0?"":void 0,r,t!=null?JSON.stringify(t):void 0,n].filter(s=>s!=null).join(`
|
|
496
|
-
`)}T1({prefix:"aiobj",size:24});T1({prefix:"aiobj",size:24});T1({prefix:"aitxt",size:24});T1({prefix:"msg",size:24});var jon={};oye(jon,{object:()=>Non,text:()=>Ton});var Ton=()=>({type:"text",responseFormat:()=>({type:"text"}),injectIntoSystemPrompt({system:e}){return e},parsePartial({text:e}){return{partial:e}},parseOutput({text:e}){return e}}),Non=({schema:e})=>{const t=Ein(e);return{type:"object",responseFormat:({model:r})=>({type:"json",schema:r.supportsStructuredOutputs?t.jsonSchema:void 0}),injectIntoSystemPrompt({system:r,model:n}){return n.supportsStructuredOutputs?r:Con({prompt:r,schema:t.jsonSchema})},parsePartial({text:r}){const n=iin(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:n.value};default:{const s=n.state;throw new Error(`Unsupported parse state: ${s}`)}}},parseOutput({text:r},n){const s=rle({text:r});if(!s.success)throw new KLe({message:"No object generated: could not parse the response.",cause:s.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});const a=ixt({value:s.value,schema:t});if(!a.success)throw new KLe({message:"No object generated: response did not match schema.",cause:a.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});return a.value}}};function Rxt(e,t){const r=e.getReader(),n=t.getReader();let s,a,i=!1,l=!1;async function c(d){try{s==null&&(s=r.read());const f=await s;s=void 0,f.done?d.close():d.enqueue(f.value)}catch(f){d.error(f)}}async function u(d){try{a==null&&(a=n.read());const f=await a;a=void 0,f.done?d.close():d.enqueue(f.value)}catch(f){d.error(f)}}return new ReadableStream({async pull(d){try{if(i){await u(d);return}if(l){await c(d);return}s==null&&(s=r.read()),a==null&&(a=n.read());const{result:f,reader:h}=await Promise.race([s.then(p=>({result:p,reader:r})),a.then(p=>({result:p,reader:n}))]);f.done||d.enqueue(f.value),h===r?(s=void 0,f.done&&(await u(d),i=!0)):(a=void 0,f.done&&(l=!0,await c(d)))}catch(f){d.error(f)}},cancel(){r.cancel(),n.cancel()}})}T1({prefix:"aitxt",size:24});T1({prefix:"msg",size:24});var Aon=_e({name:de(),version:de()}).passthrough(),lye=_e({_meta:Ao(_e({}).passthrough())}).passthrough(),uR=lye,Ion=_e({method:de(),params:Ao(lye)}),Ron=_e({experimental:Ao(_e({}).passthrough()),logging:Ao(_e({}).passthrough()),prompts:Ao(_e({listChanged:Ao(yo())}).passthrough()),resources:Ao(_e({subscribe:Ao(yo()),listChanged:Ao(yo())}).passthrough()),tools:Ao(_e({listChanged:Ao(yo())}).passthrough())}).passthrough();uR.extend({protocolVersion:de(),capabilities:Ron,serverInfo:Aon,instructions:Ao(de())});var Pon=uR.extend({nextCursor:Ao(de())}),Mon=_e({name:de(),description:Ao(de()),inputSchema:_e({type:zt("object"),properties:Ao(_e({}).passthrough())}).passthrough()}).passthrough();Pon.extend({tools:Et(Mon)});var Don=_e({type:zt("text"),text:de()}).passthrough(),Lon=_e({type:zt("image"),data:de().base64(),mimeType:de()}).passthrough(),Pxt=_e({uri:de(),mimeType:Ao(de())}).passthrough(),$on=Pxt.extend({text:de()}),Fon=Pxt.extend({blob:de().base64()}),zon=_e({type:zt("resource"),resource:Hr([$on,Fon])}).passthrough();uR.extend({content:Et(Hr([Don,Lon,zon])),isError:yo().default(!1).optional()}).or(uR.extend({toolResult:Na()}));var _8="2.0",Bon=_e({jsonrpc:zt(_8),id:Hr([de(),St().int()])}).merge(Ion).strict(),Uon=_e({jsonrpc:zt(_8),id:Hr([de(),St().int()]),result:uR}).strict(),Von=_e({jsonrpc:zt(_8),id:Hr([de(),St().int()]),error:_e({code:St().int(),message:de(),data:Ao(Na())})}).strict(),qon=_e({jsonrpc:zt(_8)}).merge(_e({method:de(),params:Ao(lye)})).strict();Hr([Bon,qon,Uon,Von]);var Hon={};oye(Hon,{mergeIntoDataStream:()=>Gon,toDataStream:()=>Qon,toDataStreamResponse:()=>Won});function Mxt(e={}){const t=new TextEncoder;let r="";return new TransformStream({async start(){e.onStart&&await e.onStart()},async transform(n,s){s.enqueue(t.encode(n)),r+=n,e.onToken&&await e.onToken(n),e.onText&&typeof n=="string"&&await e.onText(n)},async flush(){e.onCompletion&&await e.onCompletion(r),e.onFinal&&await e.onFinal(r)}})}function cye(e,t){return e.pipeThrough(new TransformStream({transform:async(r,n)=>{var s;if(typeof r=="string"){n.enqueue(r);return}if("event"in r){r.event==="on_chat_model_stream"&&r$e((s=r.data)==null?void 0:s.chunk,n);return}r$e(r,n)}})).pipeThrough(Mxt(t)).pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({transform:async(r,n)=>{n.enqueue(hxt("text",r))}}))}function Qon(e,t){return cye(e,t).pipeThrough(new TextEncoderStream)}function Won(e,t){var r;const n=cye(e,t?.callbacks).pipeThrough(new TextEncoderStream),s=t?.data,a=t?.init,i=s?Rxt(s.stream,n):n;return new Response(i,{status:(r=a?.status)!=null?r:200,statusText:a?.statusText,headers:xxt(a?.headers,{contentType:"text/plain; charset=utf-8",dataStreamVersion:"v1"})})}function Gon(e,t){t.dataStream.merge(cye(e,t.callbacks))}function r$e(e,t){if(typeof e.content=="string")t.enqueue(e.content);else{const r=e.content;for(const n of r)n.type==="text"&&t.enqueue(n.text)}}var Zon={};oye(Zon,{mergeIntoDataStream:()=>Kon,toDataStream:()=>Yon,toDataStreamResponse:()=>Xon});function uye(e,t){const r=Jon();return han(e[Symbol.asyncIterator]()).pipeThrough(new TransformStream({async transform(n,s){s.enqueue(r(n.delta))}})).pipeThrough(Mxt(t)).pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({transform:async(n,s)=>{s.enqueue(hxt("text",n))}}))}function Yon(e,t){return uye(e,t).pipeThrough(new TextEncoderStream)}function Xon(e,t={}){var r;const{init:n,data:s,callbacks:a}=t,i=uye(e,a).pipeThrough(new TextEncoderStream),l=s?Rxt(s.stream,i):i;return new Response(l,{status:(r=n?.status)!=null?r:200,statusText:n?.statusText,headers:xxt(n?.headers,{contentType:"text/plain; charset=utf-8",dataStreamVersion:"v1"})})}function Kon(e,t){t.dataStream.merge(uye(e,t.callbacks))}function Jon(){let e=!0;return t=>(e&&(t=t.trimStart(),t&&(e=!1)),t)}var Dxt="vercel.ai.error",eln=Symbol.for(Dxt),n$e,s$e,a$e=class Lxt extends(s$e=Error,n$e=eln,s$e){constructor({name:t,message:r,cause:n}){super(r),this[n$e]=!0,this.name=t,this.cause=n}static isInstance(t){return Lxt.hasMarker(t,Dxt)}static hasMarker(t,r){const n=Symbol.for(r);return t!=null&&typeof t=="object"&&n in t&&typeof t[n]=="boolean"&&t[n]===!0}},$xt="AI_InvalidArgumentError",Fxt=`vercel.ai.error.${$xt}`,tln=Symbol.for(Fxt),i$e,o$e,rln=class extends(o$e=a$e,i$e=tln,o$e){constructor({message:e,cause:t,argument:r}){super({name:$xt,message:e,cause:t}),this[i$e]=!0,this.argument=r}static isInstance(e){return a$e.hasMarker(e,Fxt)}},nln=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{const s=()=>{const a=r.length,i=new Array(t);for(let l=0;l<t;l++)i[l]=r[Math.random()*a|0];return i.join("")};if(e==null)return s;if(r.includes(n))throw new rln({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${r}".`});return()=>`${e}${n}${s()}`};nln();function sln({mediaType:e,url:t,supportedUrls:r}){return t=t.toLowerCase(),e=e.toLowerCase(),Object.entries(r).map(([n,s])=>{const a=n.toLowerCase();return a==="*"||a==="*/*"?{mediaTypePrefix:"",regexes:s}:{mediaTypePrefix:a.replace(/\*/,""),regexes:s}}).filter(({mediaTypePrefix:n})=>e.startsWith(n)).flatMap(({regexes:n})=>n).some(n=>n.test(t))}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var{btoa:aln,atob:iln}=globalThis;function zxt(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=iln(t);return Uint8Array.from(r,n=>n.codePointAt(0))}function ile(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return aln(t)}var da=class co{static isMastraDBMessage(t){return!!("content"in t&&t.content&&!Array.isArray(t.content)&&typeof t.content!="string"&&"format"in t.content&&t.content.format===2)}static isMastraMessageV1(t){return!co.isMastraDBMessage(t)&&("threadId"in t||"resourceId"in t)}static isMastraMessage(t){return co.isMastraDBMessage(t)||co.isMastraMessageV1(t)}static isAIV4UIMessage(t){return!co.isMastraMessage(t)&&!co.isAIV4CoreMessage(t)&&"parts"in t&&!co.hasAIV5UIMessageCharacteristics(t)}static isAIV6UIMessage(t){return!co.isMastraMessage(t)&&!co.isAIV4CoreMessage(t)&&"parts"in t&&co.hasAIV6UIMessageCharacteristics(t)}static isAIV5UIMessage(t){return!co.isMastraMessage(t)&&!co.isAIV6UIMessage(t)&&!co.isAIV5CoreMessage(t)&&"parts"in t&&co.hasAIV5UIMessageCharacteristics(t)}static isAIV4CoreMessage(t){return!co.isMastraMessage(t)&&!("parts"in t)&&"content"in t&&!co.hasAIV5CoreMessageCharacteristics(t)}static isAIV6CoreMessage(t){return!co.isMastraMessage(t)&&!("parts"in t)&&"content"in t&&co.hasAIV6CoreMessageCharacteristics(t)}static isAIV5CoreMessage(t){return!co.isMastraMessage(t)&&!co.isAIV6CoreMessage(t)&&!("parts"in t)&&"content"in t&&co.hasAIV5CoreMessageCharacteristics(t)}static hasAIV6UIMessageCharacteristics(t){if(!("parts"in t)||!t.parts)return!1;for(const r of t.parts)if(r.type==="source-document"||"toolCallId"in r&&"state"in r&&(r.state==="approval-requested"||r.state==="approval-responded"||r.state==="output-denied"))return!0;return!1}static hasAIV5UIMessageCharacteristics(t){if("toolInvocations"in t||"reasoning"in t||"experimental_attachments"in t||"data"in t||"annotations"in t||!t.parts)return!1;for(const r of t.parts){if("metadata"in r)return!0;if("toolInvocation"in r)return!1;if("toolCallId"in r)return!0;if(r.type==="source")return!1;if(r.type==="source-url")return!0;if(r.type==="reasoning"){if("state"in r||"text"in r)return!0;if("reasoning"in r||"details"in r)return!1}if(r.type==="file"&&"mediaType"in r)return!0}return!1}static hasAIV6CoreMessageCharacteristics(t){return"parts"in t||typeof t.content=="string"?!1:t.content.some(r=>r.type==="tool-approval-request"||r.type==="tool-approval-response")}static hasAIV5CoreMessageCharacteristics(t){if("experimental_providerMetadata"in t)return!1;if(typeof t.content=="string")return!0;for(const r of t.content){if(r.type==="tool-result"&&"output"in r||r.type==="tool-call"&&"input"in r)return!0;if(r.type==="tool-result"&&"result"in r||r.type==="tool-call"&&"args"in r)return!1;if("mediaType"in r)return!0;if("mimeType"in r||"experimental_providerMetadata"in r||r.type==="reasoning"&&"signature"in r||r.type==="redacted-reasoning")return!1}return!0}static getRole(t){if(t.role==="assistant"||t.role==="tool")return"assistant";if(t.role==="user")return"user";if(t.role==="system")return"system";throw new Error(`BUG: add handling for message role ${t.role} in message ${JSON.stringify(t,null,2)}`)}};function xE(e){return typeof e=="string"?e:e instanceof ArrayBuffer?ile(new Uint8Array(e)):ile(e)}function M6(e){if(!e.startsWith("data:"))return{isDataUri:!1,base64Content:e};const t=e.indexOf(",");if(t===-1)return{isDataUri:!0,base64Content:e};const r=e.substring(5,t),n=e.substring(t+1),s=r.indexOf(";");return{isDataUri:!0,mimeType:(s!==-1?r.substring(0,s):r)||void 0,base64Content:n}}function E8(e,t="application/octet-stream"){return e.startsWith("data:")?e:`data:${t};base64,${e}`}function oln(e,t){return typeof e=="string"?e:e instanceof URL?e.toString():e instanceof Uint8Array||e instanceof ArrayBuffer||globalThis.Buffer&&Buffer.isBuffer(e)?xE(e):String(e)}function l$e(e){return e instanceof URL?e.toString():typeof e=="string"?e.length:e instanceof Uint8Array||e instanceof ArrayBuffer?e.byteLength:e}function lln(e){try{return new URL(e),!0}catch{if(e.startsWith("//"))try{return new URL(`https:${e}`),!0}catch{return!1}return!1}}function dR(e,t){const r=M6(e),n=r.isDataUri&&r.mimeType?r.mimeType:t;return r.isDataUri?{type:"dataUri",mimeType:n,data:e}:lln(e)?{type:"url",mimeType:n,data:e}:{type:"raw",mimeType:n,data:e}}function OL(e,t){const r=[...e],n=r.findIndex(s=>s.role!=="system");return n===-1?r.length>0&&t?.warn("No user or assistant messages in the request. Some providers (e.g. Gemini) require at least one user message to generate a response."):r[n]?.role==="assistant"&&r.splice(n,0,{role:"user",content:"."}),r}function cln(e,t){return e.map(r=>uln(r,t))}function uln(e,t){return e.role!=="tool"||!Array.isArray(e.content)?e:{...e,content:e.content.map(r=>r.type==="tool-result"?{...r,input:dye(t,r.toolCallId)}:r)}}function dye(e,t){for(let r=e.length-1;r>=0;r--){const n=e[r];if(!(!n||n.role!=="assistant")){if(n.content.parts){const s=n.content.parts.find(a=>a.type==="tool-invocation"&&a.toolInvocation.toolCallId===t);if(s&&s.type==="tool-invocation")return s.toolInvocation.args||{}}if(n.content.toolInvocations){const s=n.content.toolInvocations.find(a=>a.toolCallId===t);if(s)return s.args||{}}}}return{}}function c$e(e){return e.some(r=>!(r.type==="text"&&r.text===""))?e.filter(r=>r.type==="text"?r.text!=="":!0):e}var To=class{static toUIMessage(e){const t=e.content.experimental_attachments?[...e.content.experimental_attachments]:[],r=typeof e.content.content=="string"&&e.content.content!==""?e.content.content:(e.content.parts??[]).reduce((l,c)=>c.type==="text"?c.text:l,""),n=[],s=e.content.parts??[];if(s.length)for(const l of s)if(l.type==="file"){let c;typeof l.data=="string"&&dR(l.data,l.mimeType).type==="raw"?c=E8(l.data,l.mimeType||"application/octet-stream"):c=l.data,t.push({contentType:l.mimeType,url:c})}else{if(l.type==="tool-invocation"&&(l.toolInvocation.state==="call"||l.toolInvocation.state==="partial-call"))continue;if(l.type==="tool-invocation"){const c={...l.toolInvocation};let u=-1,d=-1;for(const f of s)if(f.type==="step-start"&&u++,f.type==="tool-invocation"&&f.toolInvocation.toolCallId===l.toolInvocation.toolCallId){d=u;break}if(d>=0){const f={step:d,...c};n.push({type:"tool-invocation",toolInvocation:f})}else n.push({type:"tool-invocation",toolInvocation:c})}else n.push(l)}n.length===0&&t.length>0&&n.push({type:"text",text:""});const a=n;if(e.role==="user"){const l={id:e.id,role:e.role,content:e.content.content||r,createdAt:e.createdAt,parts:a,experimental_attachments:t};return e.content.metadata&&(l.metadata=e.content.metadata),l}else if(e.role==="assistant"){const l=Array.isArray(e.content.content)&&e.content.content.length===1&&e.content.content[0].type==="text",c={id:e.id,role:e.role,content:l?r:e.content.content||r,createdAt:e.createdAt,parts:a,reasoning:void 0,toolInvocations:"toolInvocations"in e.content?e.content.toolInvocations?.filter(u=>u.state==="result"):void 0};return e.content.metadata&&(c.metadata=e.content.metadata),c}const i={id:e.id,role:e.role,content:e.content.content||r,createdAt:e.createdAt,parts:a,experimental_attachments:t};return e.content.metadata&&(i.metadata=e.content.metadata),i}static systemToV4Core(e){if(e.role!=="system"||!e.content.content)throw new tS({id:"INVALID_SYSTEM_MESSAGE_FORMAT",domain:"AGENT",category:"USER",text:"Invalid system message format. System messages must include 'role' and 'content' properties. The content should be a string.",details:{receivedMessage:JSON.stringify(e,null,2)}});const t={role:"system",content:e.content.content};return e.content.providerMetadata&&(t.experimental_providerMetadata=e.content.providerMetadata),t}static fromUIMessage(e,t,r){const s={format:2,parts:e.parts?c$e(e.parts):[]};return e.toolInvocations&&(s.toolInvocations=e.toolInvocations),e.reasoning&&(s.reasoning=e.reasoning),e.annotations&&(s.annotations=e.annotations),e.experimental_attachments&&(s.experimental_attachments=e.experimental_attachments),"metadata"in e&&e.metadata!==null&&e.metadata!==void 0&&(s.metadata=e.metadata),{id:e.id||t.newMessageId(),role:da.getRole(e),createdAt:t.generateCreatedAt(r,e.createdAt),threadId:t.memoryInfo?.threadId,resourceId:t.memoryInfo?.resourceId,content:s}}static fromCoreMessage(e,t,r){const n="id"in e?e.id:t.newMessageId(),s=[],a=[],i=[],l=r==="response"&&Array.isArray(e.content)&&e.content.length===1&&e.content[0]&&e.content[0].type==="text"&&"text"in e.content[0]&&e.content[0].text;if(l&&r==="response"&&(e.content=l),typeof e.content=="string")s.push({type:"text",text:e.content});else if(Array.isArray(e.content))for(const f of e.content)switch(f.type){case"text":{const h=s.at(-1);e.role==="assistant"&&h&&h.type==="tool-invocation"&&s.push({type:"step-start"});const p={type:"text",text:f.text};f.providerOptions&&(p.providerMetadata=f.providerOptions),s.push(p);break}case"tool-call":{const h={type:"tool-invocation",toolInvocation:{state:"call",toolCallId:f.toolCallId,toolName:f.toolName,args:f.args}};f.providerOptions&&(h.providerMetadata=f.providerOptions),s.push(h);break}case"tool-result":{let h={};const p=e.content.find(y=>y.type==="tool-call"&&y.toolCallId===f.toolCallId);p&&p.type==="tool-call"&&(h=p.args),Object.keys(h).length===0&&t.dbMessages&&(h=dye(t.dbMessages,f.toolCallId));const m={state:"result",toolCallId:f.toolCallId,toolName:f.toolName,result:f.result??"",args:h},g={type:"tool-invocation",toolInvocation:m};f.providerOptions&&(g.providerMetadata=f.providerOptions),s.push(g),i.push(m)}break;case"reasoning":{const h={type:"reasoning",reasoning:"",details:[{type:"text",text:f.text,signature:f.signature}]};f.providerOptions&&(h.providerMetadata=f.providerOptions),s.push(h)}break;case"redacted-reasoning":{const h={type:"reasoning",reasoning:"",details:[{type:"redacted",data:f.data}]};f.providerOptions&&(h.providerMetadata=f.providerOptions),s.push(h)}break;case"image":{const h={type:"file",data:oln(f.image),mimeType:f.mimeType};f.providerOptions&&(h.providerMetadata=f.providerOptions),s.push(h);break}case"file":{if(f.data instanceof URL){const h={type:"file",data:f.data.toString(),mimeType:f.mimeType};f.providerOptions&&(h.providerMetadata=f.providerOptions),f.filename&&(h.filename=f.filename),s.push(h)}else if(typeof f.data=="string"){const h=dR(f.data,f.mimeType);if(h.type==="url"||h.type==="dataUri"){const p={type:"file",data:f.data,mimeType:h.mimeType||"image/png"};f.providerOptions&&(p.providerMetadata=f.providerOptions),f.filename&&(p.filename=f.filename),s.push(p)}else try{const p={type:"file",mimeType:h.mimeType||"image/png",data:xE(f.data)};f.providerOptions&&(p.providerMetadata=f.providerOptions),f.filename&&(p.filename=f.filename),s.push(p)}catch(p){console.error(`Failed to convert binary data to base64 in CoreMessage file part: ${p}`,p)}}else try{const h={type:"file",mimeType:f.mimeType,data:xE(f.data)};f.providerOptions&&(h.providerMetadata=f.providerOptions),f.filename&&(h.filename=f.filename),s.push(h)}catch(h){console.error(`Failed to convert binary data to base64 in CoreMessage file part: ${h}`,h)}break}}const u={format:2,parts:c$e(s)};i.length&&(u.toolInvocations=i),typeof e.content=="string"&&(u.content=e.content),a.length&&(u.experimental_attachments=a),e.providerOptions?u.providerMetadata=e.providerOptions:"experimental_providerMetadata"in e&&e.experimental_providerMetadata&&(u.providerMetadata=e.experimental_providerMetadata),"metadata"in e&&e.metadata!==null&&e.metadata!==void 0&&(u.metadata=e.metadata);const d="metadata"in e&&e.metadata&&typeof e.metadata=="object"&&"createdAt"in e.metadata?e.metadata.createdAt:void 0;return{id:n,role:da.getRole(e),createdAt:t.generateCreatedAt(r,d),threadId:t.memoryInfo?.threadId,resourceId:t.memoryInfo?.resourceId,content:u}}},dln=/^[a-zA-Z0-9_-]+$/,u$e="unknown_tool";function Wl(e){return typeof e!="string"?u$e:dln.test(e)?e:u$e}function d$e(e){return e.some(r=>!(r.type==="text"&&r.text===""))?e.filter(r=>r.type==="text"?r.text!=="":!0):e}function f$e(e){return typeof e=="object"&&e&&"type"in e&&(e=e.type),typeof e!="string"?Wl(e):e==="dynamic-tool"?"dynamic-tool":e.startsWith("tool-")?Wl(e.slice(5)):Wl(e)}function K0(e,t){return t==null?e:{...e||{},mastra:{...(e||{}).mastra||{},createdAt:t}}}function Ed(e){const t=e?.mastra;if(!t||typeof t!="object")return;const r=t.createdAt;return typeof r=="number"?r:void 0}var Wc=class{static toUIMessage(e){const t=[],r={...e.content.metadata||{}};e.createdAt&&(r.createdAt=e.createdAt),e.threadId&&(r.threadId=e.threadId),e.resourceId&&(r.resourceId=e.resourceId),e.content.providerMetadata&&(r.providerMetadata=e.content.providerMetadata);const n=e.content.parts?.some(c=>c.type==="tool-invocation");if(e.content.toolInvocations&&!n)for(const c of e.content.toolInvocations)c.state==="result"?t.push({type:`tool-${c.toolName}`,toolCallId:c.toolCallId,state:"output-available",input:c.args,output:c.result}):t.push({type:`tool-${c.toolName}`,toolCallId:c.toolCallId,state:c.state==="call"?"input-available":"input-streaming",input:c.args});const s=e.content.parts?.some(c=>c.type==="reasoning"),a=e.content.parts?.some(c=>c.type==="file");e.content.reasoning&&!s&&t.push({type:"reasoning",text:e.content.reasoning});const i=new Set;if(e.content.experimental_attachments&&!a)for(const c of e.content.experimental_attachments)i.add(c.url),t.push({type:"file",url:c.url,mediaType:c.contentType||"unknown"});let l=!1;if(e.content.parts)for(const c of e.content.parts){if(c.type==="tool-invocation"&&c.toolInvocation){const u=c.toolInvocation;u.state==="result"?t.push({type:`tool-${u.toolName}`,toolCallId:u.toolCallId,input:u.args,output:u.result,state:"output-available",callProviderMetadata:K0(c.providerMetadata,c.createdAt),providerExecuted:c.providerExecuted}):t.push({type:`tool-${u.toolName}`,toolCallId:u.toolCallId,input:u.args,state:"input-available",callProviderMetadata:K0(c.providerMetadata,c.createdAt),providerExecuted:c.providerExecuted});continue}if(c.type==="reasoning"){const u=c.reasoning||(c.details?.reduce((d,f)=>f.type==="text"&&f.text?d+f.text:d,"")??"");if(u||c.details?.length){const d={type:"reasoning",text:u||"",state:"done"};d.providerMetadata=K0(c.providerMetadata,c.createdAt),t.push(d)}continue}if(!(c.type==="tool-invocation"||c.type.startsWith("tool-")))if(c.type==="file"){if(typeof c.data=="string"&&i.has(c.data))continue;const u=typeof c.data=="string"?dR(c.data,c.mimeType):{type:"raw",mimeType:c.mimeType};if(u.type==="url"&&typeof c.data=="string"){const d={type:"file",url:c.data,mediaType:u.mimeType||"image/png"};d.providerMetadata=K0(c.providerMetadata,c.createdAt),t.push(d)}else{let d,f=c.mimeType;if(typeof c.data=="string"){const g=M6(c.data);g.isDataUri?(d=g.base64Content,g.mimeType&&(f=f||g.mimeType)):d=c.data}else d=c.data;const h=f||"image/png";let p;typeof d=="string"&&d.startsWith("data:")?p=d:p=E8(d,h);const m={type:"file",url:p,mediaType:h};m.providerMetadata=K0(c.providerMetadata,c.createdAt),t.push(m)}}else if(c.type==="source"){const u={type:"source-url",url:c.source.url,sourceId:c.source.id,title:c.source.title};u.providerMetadata=K0(c.providerMetadata,c.createdAt),t.push(u)}else{if(c.type==="source-document")continue;if(c.type==="text"){const u={type:"text",text:c.text};u.providerMetadata=K0(c.providerMetadata,c.createdAt),t.push(u),l=!0}else t.push(c),l=!0}}return e.content.content&&!l&&t.push({type:"text",text:e.content.content}),{id:e.id,role:e.role,metadata:r,parts:t}}static fromUIMessage(e){const{parts:t,metadata:r}=e,n=r||{},s=n.createdAt,a=s?typeof s=="string"?new Date(s):s instanceof Date?s:new Date:new Date,i=n.threadId,l=n.resourceId,c={...n};delete c.createdAt,delete c.threadId,delete c.resourceId;const u=t.filter(S=>of(S)),d=t.filter(S=>S.type==="reasoning"),f=t.filter(S=>S.type==="file"),h=t.filter(S=>S.type==="text");let p;u.length>0&&(p=u.map(S=>{const k=f$e(S);return S.state==="output-available"?{args:S.input,result:typeof S.output=="object"&&S.output&&"value"in S.output?S.output.value:S.output,toolCallId:S.toolCallId,toolName:k,state:"result"}:{args:S.input,toolCallId:S.toolCallId,toolName:k,state:"call"}}));let m;d.length>0&&(m=d.map(S=>S.text).join(`
|
|
496
|
+
`)}T1({prefix:"aiobj",size:24});T1({prefix:"aiobj",size:24});T1({prefix:"aitxt",size:24});T1({prefix:"msg",size:24});var jon={};oye(jon,{object:()=>Non,text:()=>Ton});var Ton=()=>({type:"text",responseFormat:()=>({type:"text"}),injectIntoSystemPrompt({system:e}){return e},parsePartial({text:e}){return{partial:e}},parseOutput({text:e}){return e}}),Non=({schema:e})=>{const t=Ein(e);return{type:"object",responseFormat:({model:r})=>({type:"json",schema:r.supportsStructuredOutputs?t.jsonSchema:void 0}),injectIntoSystemPrompt({system:r,model:n}){return n.supportsStructuredOutputs?r:Con({prompt:r,schema:t.jsonSchema})},parsePartial({text:r}){const n=iin(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:n.value};default:{const s=n.state;throw new Error(`Unsupported parse state: ${s}`)}}},parseOutput({text:r},n){const s=rle({text:r});if(!s.success)throw new KLe({message:"No object generated: could not parse the response.",cause:s.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});const a=ixt({value:s.value,schema:t});if(!a.success)throw new KLe({message:"No object generated: response did not match schema.",cause:a.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});return a.value}}};function Rxt(e,t){const r=e.getReader(),n=t.getReader();let s,a,i=!1,l=!1;async function c(d){try{s==null&&(s=r.read());const f=await s;s=void 0,f.done?d.close():d.enqueue(f.value)}catch(f){d.error(f)}}async function u(d){try{a==null&&(a=n.read());const f=await a;a=void 0,f.done?d.close():d.enqueue(f.value)}catch(f){d.error(f)}}return new ReadableStream({async pull(d){try{if(i){await u(d);return}if(l){await c(d);return}s==null&&(s=r.read()),a==null&&(a=n.read());const{result:f,reader:h}=await Promise.race([s.then(p=>({result:p,reader:r})),a.then(p=>({result:p,reader:n}))]);f.done||d.enqueue(f.value),h===r?(s=void 0,f.done&&(await u(d),i=!0)):(a=void 0,f.done&&(l=!0,await c(d)))}catch(f){d.error(f)}},cancel(){r.cancel(),n.cancel()}})}T1({prefix:"aitxt",size:24});T1({prefix:"msg",size:24});var Aon=_e({name:de(),version:de()}).passthrough(),lye=_e({_meta:Ao(_e({}).passthrough())}).passthrough(),uR=lye,Ion=_e({method:de(),params:Ao(lye)}),Ron=_e({experimental:Ao(_e({}).passthrough()),logging:Ao(_e({}).passthrough()),prompts:Ao(_e({listChanged:Ao(yo())}).passthrough()),resources:Ao(_e({subscribe:Ao(yo()),listChanged:Ao(yo())}).passthrough()),tools:Ao(_e({listChanged:Ao(yo())}).passthrough())}).passthrough();uR.extend({protocolVersion:de(),capabilities:Ron,serverInfo:Aon,instructions:Ao(de())});var Pon=uR.extend({nextCursor:Ao(de())}),Mon=_e({name:de(),description:Ao(de()),inputSchema:_e({type:zt("object"),properties:Ao(_e({}).passthrough())}).passthrough()}).passthrough();Pon.extend({tools:Et(Mon)});var Don=_e({type:zt("text"),text:de()}).passthrough(),Lon=_e({type:zt("image"),data:de().base64(),mimeType:de()}).passthrough(),Pxt=_e({uri:de(),mimeType:Ao(de())}).passthrough(),$on=Pxt.extend({text:de()}),Fon=Pxt.extend({blob:de().base64()}),zon=_e({type:zt("resource"),resource:Hr([$on,Fon])}).passthrough();uR.extend({content:Et(Hr([Don,Lon,zon])),isError:yo().default(!1).optional()}).or(uR.extend({toolResult:Na()}));var _8="2.0",Bon=_e({jsonrpc:zt(_8),id:Hr([de(),St().int()])}).merge(Ion).strict(),Uon=_e({jsonrpc:zt(_8),id:Hr([de(),St().int()]),result:uR}).strict(),Von=_e({jsonrpc:zt(_8),id:Hr([de(),St().int()]),error:_e({code:St().int(),message:de(),data:Ao(Na())})}).strict(),qon=_e({jsonrpc:zt(_8)}).merge(_e({method:de(),params:Ao(lye)})).strict();Hr([Bon,qon,Uon,Von]);var Hon={};oye(Hon,{mergeIntoDataStream:()=>Gon,toDataStream:()=>Qon,toDataStreamResponse:()=>Won});function Mxt(e={}){const t=new TextEncoder;let r="";return new TransformStream({async start(){e.onStart&&await e.onStart()},async transform(n,s){s.enqueue(t.encode(n)),r+=n,e.onToken&&await e.onToken(n),e.onText&&typeof n=="string"&&await e.onText(n)},async flush(){e.onCompletion&&await e.onCompletion(r),e.onFinal&&await e.onFinal(r)}})}function cye(e,t){return e.pipeThrough(new TransformStream({transform:async(r,n)=>{var s;if(typeof r=="string"){n.enqueue(r);return}if("event"in r){r.event==="on_chat_model_stream"&&r$e((s=r.data)==null?void 0:s.chunk,n);return}r$e(r,n)}})).pipeThrough(Mxt(t)).pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({transform:async(r,n)=>{n.enqueue(hxt("text",r))}}))}function Qon(e,t){return cye(e,t).pipeThrough(new TextEncoderStream)}function Won(e,t){var r;const n=cye(e,t?.callbacks).pipeThrough(new TextEncoderStream),s=t?.data,a=t?.init,i=s?Rxt(s.stream,n):n;return new Response(i,{status:(r=a?.status)!=null?r:200,statusText:a?.statusText,headers:xxt(a?.headers,{contentType:"text/plain; charset=utf-8",dataStreamVersion:"v1"})})}function Gon(e,t){t.dataStream.merge(cye(e,t.callbacks))}function r$e(e,t){if(typeof e.content=="string")t.enqueue(e.content);else{const r=e.content;for(const n of r)n.type==="text"&&t.enqueue(n.text)}}var Zon={};oye(Zon,{mergeIntoDataStream:()=>Kon,toDataStream:()=>Yon,toDataStreamResponse:()=>Xon});function uye(e,t){const r=Jon();return han(e[Symbol.asyncIterator]()).pipeThrough(new TransformStream({async transform(n,s){s.enqueue(r(n.delta))}})).pipeThrough(Mxt(t)).pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({transform:async(n,s)=>{s.enqueue(hxt("text",n))}}))}function Yon(e,t){return uye(e,t).pipeThrough(new TextEncoderStream)}function Xon(e,t={}){var r;const{init:n,data:s,callbacks:a}=t,i=uye(e,a).pipeThrough(new TextEncoderStream),l=s?Rxt(s.stream,i):i;return new Response(l,{status:(r=n?.status)!=null?r:200,statusText:n?.statusText,headers:xxt(n?.headers,{contentType:"text/plain; charset=utf-8",dataStreamVersion:"v1"})})}function Kon(e,t){t.dataStream.merge(uye(e,t.callbacks))}function Jon(){let e=!0;return t=>(e&&(t=t.trimStart(),t&&(e=!1)),t)}var Dxt="vercel.ai.error",eln=Symbol.for(Dxt),n$e,s$e,a$e=class Lxt extends(s$e=Error,n$e=eln,s$e){constructor({name:t,message:r,cause:n}){super(r),this[n$e]=!0,this.name=t,this.cause=n}static isInstance(t){return Lxt.hasMarker(t,Dxt)}static hasMarker(t,r){const n=Symbol.for(r);return t!=null&&typeof t=="object"&&n in t&&typeof t[n]=="boolean"&&t[n]===!0}},$xt="AI_InvalidArgumentError",Fxt=`vercel.ai.error.${$xt}`,tln=Symbol.for(Fxt),i$e,o$e,rln=class extends(o$e=a$e,i$e=tln,o$e){constructor({message:e,cause:t,argument:r}){super({name:$xt,message:e,cause:t}),this[i$e]=!0,this.argument=r}static isInstance(e){return a$e.hasMarker(e,Fxt)}},nln=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{const s=()=>{const a=r.length,i=new Array(t);for(let l=0;l<t;l++)i[l]=r[Math.random()*a|0];return i.join("")};if(e==null)return s;if(r.includes(n))throw new rln({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${r}".`});return()=>`${e}${n}${s()}`};nln();function sln({mediaType:e,url:t,supportedUrls:r}){return t=t.toLowerCase(),e=e.toLowerCase(),Object.entries(r).map(([n,s])=>{const a=n.toLowerCase();return a==="*"||a==="*/*"?{mediaTypePrefix:"",regexes:s}:{mediaTypePrefix:a.replace(/\*/,""),regexes:s}}).filter(({mediaTypePrefix:n})=>e.startsWith(n)).flatMap(({regexes:n})=>n).some(n=>n.test(t))}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var{btoa:aln,atob:iln}=globalThis;function zxt(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=iln(t);return Uint8Array.from(r,n=>n.codePointAt(0))}function ile(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return aln(t)}var da=class co{static isMastraDBMessage(t){return!!("content"in t&&t.content&&!Array.isArray(t.content)&&typeof t.content!="string"&&"format"in t.content&&t.content.format===2)}static isMastraMessageV1(t){return!co.isMastraDBMessage(t)&&("threadId"in t||"resourceId"in t)}static isMastraMessage(t){return co.isMastraDBMessage(t)||co.isMastraMessageV1(t)}static isAIV4UIMessage(t){return!co.isMastraMessage(t)&&!co.isAIV4CoreMessage(t)&&"parts"in t&&!co.hasAIV5UIMessageCharacteristics(t)}static isAIV6UIMessage(t){return!co.isMastraMessage(t)&&!co.isAIV4CoreMessage(t)&&"parts"in t&&co.hasAIV6UIMessageCharacteristics(t)}static isAIV5UIMessage(t){return!co.isMastraMessage(t)&&!co.isAIV6UIMessage(t)&&!co.isAIV5CoreMessage(t)&&"parts"in t&&co.hasAIV5UIMessageCharacteristics(t)}static isAIV4CoreMessage(t){return!co.isMastraMessage(t)&&!("parts"in t)&&"content"in t&&!co.hasAIV5CoreMessageCharacteristics(t)}static isAIV6CoreMessage(t){return!co.isMastraMessage(t)&&!("parts"in t)&&"content"in t&&co.hasAIV6CoreMessageCharacteristics(t)}static isAIV5CoreMessage(t){return!co.isMastraMessage(t)&&!co.isAIV6CoreMessage(t)&&!("parts"in t)&&"content"in t&&co.hasAIV5CoreMessageCharacteristics(t)}static hasAIV6UIMessageCharacteristics(t){if(!("parts"in t)||!t.parts)return!1;for(const r of t.parts)if(r.type==="source-document"||"toolCallId"in r&&"state"in r&&(r.state==="approval-requested"||r.state==="approval-responded"||r.state==="output-denied"))return!0;return!1}static hasAIV5UIMessageCharacteristics(t){if("toolInvocations"in t||"reasoning"in t||"experimental_attachments"in t||"data"in t||"annotations"in t||!t.parts)return!1;for(const r of t.parts){if("metadata"in r)return!0;if("toolInvocation"in r)return!1;if("toolCallId"in r)return!0;if(r.type==="source")return!1;if(r.type==="source-url")return!0;if(r.type==="reasoning"){if("state"in r||"text"in r)return!0;if("reasoning"in r||"details"in r)return!1}if(r.type==="file"&&"mediaType"in r)return!0}return!1}static hasAIV6CoreMessageCharacteristics(t){return"parts"in t||typeof t.content=="string"?!1:t.content.some(r=>r.type==="tool-approval-request"||r.type==="tool-approval-response")}static hasAIV5CoreMessageCharacteristics(t){if("experimental_providerMetadata"in t)return!1;if(typeof t.content=="string")return!0;for(const r of t.content){if(r.type==="tool-result"&&"output"in r||r.type==="tool-call"&&"input"in r)return!0;if(r.type==="tool-result"&&"result"in r||r.type==="tool-call"&&"args"in r)return!1;if("mediaType"in r)return!0;if("mimeType"in r||"experimental_providerMetadata"in r||r.type==="reasoning"&&"signature"in r||r.type==="redacted-reasoning")return!1}return!0}static getRole(t){if(t.role==="assistant"||t.role==="tool")return"assistant";if(t.role==="user")return"user";if(t.role==="system")return"system";throw new Error(`BUG: add handling for message role ${t.role} in message ${JSON.stringify(t,null,2)}`)}};function xE(e){return typeof e=="string"?e:e instanceof ArrayBuffer?ile(new Uint8Array(e)):ile(e)}function M6(e){if(!e.startsWith("data:"))return{isDataUri:!1,base64Content:e};const t=e.indexOf(",");if(t===-1)return{isDataUri:!0,base64Content:e};const r=e.substring(5,t),n=e.substring(t+1),s=r.indexOf(";");return{isDataUri:!0,mimeType:(s!==-1?r.substring(0,s):r)||void 0,base64Content:n}}function E8(e,t="application/octet-stream"){return e.startsWith("data:")?e:`data:${t};base64,${e}`}function oln(e,t){return typeof e=="string"?e:e instanceof URL?e.toString():e instanceof Uint8Array||e instanceof ArrayBuffer||globalThis.Buffer&&Buffer.isBuffer(e)?xE(e):String(e)}function l$e(e){return e instanceof URL?e.toString():typeof e=="string"?e.length:e instanceof Uint8Array||e instanceof ArrayBuffer?e.byteLength:e}function lln(e){try{return new URL(e),!0}catch{if(e.startsWith("//"))try{return new URL(`https:${e}`),!0}catch{return!1}return!1}}function dR(e,t){const r=M6(e),n=r.isDataUri&&r.mimeType?r.mimeType:t;return r.isDataUri?{type:"dataUri",mimeType:n,data:e}:lln(e)?{type:"url",mimeType:n,data:e}:{type:"raw",mimeType:n,data:e}}function OL(e,t){const r=[...e],n=r.findIndex(s=>s.role!=="system");return n===-1?r.length>0&&t?.warn("No user or assistant messages in the request. Some providers (e.g. Gemini) require at least one user message to generate a response."):r[n]?.role==="assistant"&&r.splice(n,0,{role:"user",content:"."}),r}function cln(e,t){return e.map(r=>uln(r,t))}function uln(e,t){return e.role!=="tool"||!Array.isArray(e.content)?e:{...e,content:e.content.map(r=>r.type==="tool-result"?{...r,input:dye(t,r.toolCallId)}:r)}}function dye(e,t){for(let r=e.length-1;r>=0;r--){const n=e[r];if(!(!n||n.role!=="assistant")){if(n.content.parts){const s=n.content.parts.find(a=>a.type==="tool-invocation"&&a.toolInvocation.toolCallId===t);if(s&&s.type==="tool-invocation")return s.toolInvocation.args||{}}if(n.content.toolInvocations){const s=n.content.toolInvocations.find(a=>a.toolCallId===t);if(s)return s.args||{}}}}return{}}function c$e(e){return e.some(r=>!(r.type==="text"&&r.text===""))?e.filter(r=>r.type==="text"?r.text!=="":!0):e}var To=class{static toUIMessage(e){const t=e.content.experimental_attachments?[...e.content.experimental_attachments]:[],r=typeof e.content.content=="string"&&e.content.content!==""?e.content.content:(e.content.parts??[]).reduce((l,c)=>c.type==="text"?c.text:l,""),n=[],s=e.content.parts??[];if(s.length)for(const l of s)if(l.type==="file"){let c;typeof l.data=="string"&&dR(l.data,l.mimeType).type==="raw"?c=E8(l.data,l.mimeType||"application/octet-stream"):c=l.data,t.push({contentType:l.mimeType,url:c})}else{if(l.type==="tool-invocation"&&(l.toolInvocation.state==="call"||l.toolInvocation.state==="partial-call"))continue;if(l.type==="tool-invocation"){const c={...l.toolInvocation};let u=-1,d=-1;for(const f of s)if(f.type==="step-start"&&u++,f.type==="tool-invocation"&&f.toolInvocation.toolCallId===l.toolInvocation.toolCallId){d=u;break}if(d>=0){const f={step:d,...c};n.push({type:"tool-invocation",toolInvocation:f})}else n.push({type:"tool-invocation",toolInvocation:c})}else n.push(l)}n.length===0&&t.length>0&&n.push({type:"text",text:""});const a=n;if(e.role==="user"){const l={id:e.id,role:e.role,content:e.content.content||r,createdAt:e.createdAt,parts:a,experimental_attachments:t};return e.content.metadata&&(l.metadata=e.content.metadata),l}else if(e.role==="assistant"){const l=Array.isArray(e.content.content)&&e.content.content.length===1&&e.content.content[0].type==="text",c={id:e.id,role:e.role,content:l?r:e.content.content||r,createdAt:e.createdAt,parts:a,reasoning:void 0,toolInvocations:"toolInvocations"in e.content?e.content.toolInvocations?.filter(u=>u.state==="result"):void 0};return e.content.metadata&&(c.metadata=e.content.metadata),c}const i={id:e.id,role:e.role,content:e.content.content||r,createdAt:e.createdAt,parts:a,experimental_attachments:t};return e.content.metadata&&(i.metadata=e.content.metadata),i}static systemToV4Core(e){if(e.role!=="system"||!e.content.content)throw new tS({id:"INVALID_SYSTEM_MESSAGE_FORMAT",domain:"AGENT",category:"USER",text:"Invalid system message format. System messages must include 'role' and 'content' properties. The content should be a string.",details:{receivedMessage:JSON.stringify(e,null,2)}});const t={role:"system",content:e.content.content};return e.content.providerMetadata&&(t.experimental_providerMetadata=e.content.providerMetadata),t}static fromUIMessage(e,t,r){const s={format:2,parts:e.parts?c$e(e.parts):[]};return e.toolInvocations&&(s.toolInvocations=e.toolInvocations),e.reasoning&&(s.reasoning=e.reasoning),e.annotations&&(s.annotations=e.annotations),e.experimental_attachments&&(s.experimental_attachments=e.experimental_attachments),"metadata"in e&&e.metadata!==null&&e.metadata!==void 0&&(s.metadata=e.metadata),{id:e.id||t.newMessageId(),role:da.getRole(e),createdAt:t.generateCreatedAt(r,e.createdAt),threadId:t.memoryInfo?.threadId,resourceId:t.memoryInfo?.resourceId,content:s}}static fromCoreMessage(e,t,r){const n="id"in e?e.id:t.newMessageId(),s=[],a=[],i=[],l=r==="response"&&Array.isArray(e.content)&&e.content.length===1&&e.content[0]&&e.content[0].type==="text"&&"text"in e.content[0]&&e.content[0].text;if(l&&r==="response"&&(e.content=l),typeof e.content=="string")s.push({type:"text",text:e.content});else if(Array.isArray(e.content))for(const f of e.content)switch(f.type){case"text":{const h=s.at(-1);e.role==="assistant"&&h&&h.type==="tool-invocation"&&s.push({type:"step-start"});const p={type:"text",text:f.text};f.providerOptions&&(p.providerMetadata=f.providerOptions),s.push(p);break}case"tool-call":{const h={type:"tool-invocation",toolInvocation:{state:"call",toolCallId:f.toolCallId,toolName:f.toolName,args:f.args}};f.providerOptions&&(h.providerMetadata=f.providerOptions),s.push(h);break}case"tool-result":{let h={};const p=e.content.find(y=>y.type==="tool-call"&&y.toolCallId===f.toolCallId);p&&p.type==="tool-call"&&(h=p.args),Object.keys(h).length===0&&t.dbMessages&&(h=dye(t.dbMessages,f.toolCallId));const m={state:"result",toolCallId:f.toolCallId,toolName:f.toolName,result:f.result??"",args:h},g={type:"tool-invocation",toolInvocation:m};f.providerOptions&&(g.providerMetadata=f.providerOptions),s.push(g),i.push(m)}break;case"reasoning":{const h={type:"reasoning",reasoning:"",details:[{type:"text",text:f.text,signature:f.signature}]};f.providerOptions&&(h.providerMetadata=f.providerOptions),s.push(h)}break;case"redacted-reasoning":{const h={type:"reasoning",reasoning:"",details:[{type:"redacted",data:f.data}]};f.providerOptions&&(h.providerMetadata=f.providerOptions),s.push(h)}break;case"image":{const h={type:"file",data:oln(f.image),mimeType:f.mimeType};f.providerOptions&&(h.providerMetadata=f.providerOptions),s.push(h);break}case"file":{if(f.data instanceof URL){const h={type:"file",data:f.data.toString(),mimeType:f.mimeType};f.providerOptions&&(h.providerMetadata=f.providerOptions),f.filename&&(h.filename=f.filename),s.push(h)}else if(typeof f.data=="string"){const h=dR(f.data,f.mimeType);if(h.type==="url"||h.type==="dataUri"){const p={type:"file",data:f.data,mimeType:h.mimeType||"image/png"};f.providerOptions&&(p.providerMetadata=f.providerOptions),f.filename&&(p.filename=f.filename),s.push(p)}else try{const p={type:"file",mimeType:h.mimeType||"image/png",data:xE(f.data)};f.providerOptions&&(p.providerMetadata=f.providerOptions),f.filename&&(p.filename=f.filename),s.push(p)}catch(p){console.error(`Failed to convert binary data to base64 in CoreMessage file part: ${p}`,p)}}else try{const h={type:"file",mimeType:f.mimeType,data:xE(f.data)};f.providerOptions&&(h.providerMetadata=f.providerOptions),f.filename&&(h.filename=f.filename),s.push(h)}catch(h){console.error(`Failed to convert binary data to base64 in CoreMessage file part: ${h}`,h)}break}}const u={format:2,parts:c$e(s)};i.length&&(u.toolInvocations=i),typeof e.content=="string"&&(u.content=e.content),a.length&&(u.experimental_attachments=a),e.providerOptions?u.providerMetadata=e.providerOptions:"experimental_providerMetadata"in e&&e.experimental_providerMetadata&&(u.providerMetadata=e.experimental_providerMetadata),"metadata"in e&&e.metadata!==null&&e.metadata!==void 0&&(u.metadata=e.metadata);const d="metadata"in e&&e.metadata&&typeof e.metadata=="object"&&"createdAt"in e.metadata?e.metadata.createdAt:void 0;return{id:n,role:da.getRole(e),createdAt:t.generateCreatedAt(r,d),threadId:t.memoryInfo?.threadId,resourceId:t.memoryInfo?.resourceId,content:u}}},dln=/^[a-zA-Z0-9_-]+$/,u$e="unknown_tool";function Wl(e){return typeof e!="string"?u$e:dln.test(e)?e:u$e}function d$e(e){return e.some(r=>!(r.type==="text"&&r.text===""))?e.filter(r=>r.type==="text"?r.text!=="":!0):e}function f$e(e){return typeof e=="object"&&e&&"type"in e&&(e=e.type),typeof e!="string"?Wl(e):e==="dynamic-tool"?"dynamic-tool":e.startsWith("tool-")?Wl(e.slice(5)):Wl(e)}function K0(e,t){return t==null?e:{...e||{},mastra:{...(e||{}).mastra||{},createdAt:t}}}function Ed(e){const t=e?.mastra;if(!t||typeof t!="object")return;const r=t.createdAt;return typeof r=="number"?r:void 0}var Wc=class{static toUIMessage(e){const t=[],r={...e.content.metadata||{}};e.createdAt&&(r.createdAt=e.createdAt),e.threadId&&(r.threadId=e.threadId),e.resourceId&&(r.resourceId=e.resourceId),e.content.providerMetadata&&(r.providerMetadata=e.content.providerMetadata);const n=e.content.parts?.some(h=>h.type==="tool-invocation");if(e.content.toolInvocations&&!n)for(const h of e.content.toolInvocations)h.state==="result"?t.push({type:`tool-${h.toolName}`,toolCallId:h.toolCallId,state:"output-available",input:h.args,output:h.result}):t.push({type:`tool-${h.toolName}`,toolCallId:h.toolCallId,state:h.state==="call"?"input-available":"input-streaming",input:h.args});const s=e.content.parts?.some(h=>h.type==="reasoning"),a=e.content.parts?.some(h=>h.type==="file");e.content.reasoning&&!s&&t.push({type:"reasoning",text:e.content.reasoning});const i=new Set;if(e.content.experimental_attachments&&!a)for(const h of e.content.experimental_attachments)i.add(h.url),t.push({type:"file",url:h.url,mediaType:h.contentType||"unknown"});let l=!1;if(e.content.parts)for(const h of e.content.parts){if(h.type==="tool-invocation"&&h.toolInvocation){const p=h.toolInvocation;p.state==="result"?t.push({type:`tool-${p.toolName}`,toolCallId:p.toolCallId,input:p.args,output:p.result,state:"output-available",callProviderMetadata:K0(h.providerMetadata,h.createdAt),providerExecuted:h.providerExecuted}):t.push({type:`tool-${p.toolName}`,toolCallId:p.toolCallId,input:p.args,state:"input-available",callProviderMetadata:K0(h.providerMetadata,h.createdAt),providerExecuted:h.providerExecuted});continue}if(h.type==="reasoning"){const p=h.reasoning||(h.details?.reduce((m,g)=>g.type==="text"&&g.text?m+g.text:m,"")??"");if(p||h.details?.length){const m={type:"reasoning",text:p||"",state:"done"};m.providerMetadata=K0(h.providerMetadata,h.createdAt),t.push(m)}continue}if(!(h.type==="tool-invocation"||h.type.startsWith("tool-")))if(h.type==="file"){if(typeof h.data=="string"&&i.has(h.data))continue;const p=typeof h.data=="string"?dR(h.data,h.mimeType):{type:"raw",mimeType:h.mimeType};if(p.type==="url"&&typeof h.data=="string"){const m={type:"file",url:h.data,mediaType:p.mimeType||"image/png"};m.providerMetadata=K0(h.providerMetadata,h.createdAt),t.push(m)}else{let m,g=h.mimeType;if(typeof h.data=="string"){const S=M6(h.data);S.isDataUri?(m=S.base64Content,S.mimeType&&(g=g||S.mimeType)):m=h.data}else m=h.data;const y=g||"image/png";let x;typeof m=="string"&&m.startsWith("data:")?x=m:x=E8(m,y);const w={type:"file",url:x,mediaType:y};w.providerMetadata=K0(h.providerMetadata,h.createdAt),t.push(w)}}else if(h.type==="source"){const p={type:"source-url",url:h.source.url,sourceId:h.source.id,title:h.source.title};p.providerMetadata=K0(h.providerMetadata,h.createdAt),t.push(p)}else{if(h.type==="source-document")continue;if(h.type==="text"){const p={type:"text",text:h.text};p.providerMetadata=K0(h.providerMetadata,h.createdAt),t.push(p),l=!0}else t.push(h),l=!0}}e.content.content&&!l&&t.push({type:"text",text:e.content.content});const c=new Set(t.filter(h=>h.type==="data-tool-call-suspended"||h.type==="data-tool-call-approval").map(h=>{const p=h.data;return typeof p?.toolCallId=="string"?p.toolCallId:void 0}).filter(h=>typeof h=="string")),u=(h,p)=>{const m=t.findIndex(g=>g.type.startsWith("tool-")&&g.toolCallId===h);if(m===-1){t.push(p);return}t.splice(m+1,0,p)},d=r.suspendedTools;if(d&&typeof d=="object")for(const h of Object.values(d)){if(!h||typeof h!="object")continue;const p="toolCallId"in h?h.toolCallId:void 0;typeof p!="string"||c.has(p)||(u(p,{type:"data-tool-call-suspended",data:h}),c.add(p))}const f=r.pendingToolApprovals;if(f&&typeof f=="object")for(const h of Object.values(f)){if(!h||typeof h!="object")continue;const p="toolCallId"in h?h.toolCallId:void 0;typeof p!="string"||c.has(p)||(u(p,{type:"data-tool-call-approval",data:h}),c.add(p))}return{id:e.id,role:e.role,metadata:r,parts:t}}static fromUIMessage(e){const{parts:t,metadata:r}=e,n=r||{},s=n.createdAt,a=s?typeof s=="string"?new Date(s):s instanceof Date?s:new Date:new Date,i=n.threadId,l=n.resourceId,c={...n};delete c.createdAt,delete c.threadId,delete c.resourceId;const u=t.filter(S=>of(S)),d=t.filter(S=>S.type==="reasoning"),f=t.filter(S=>S.type==="file"),h=t.filter(S=>S.type==="text");let p;u.length>0&&(p=u.map(S=>{const k=f$e(S);return S.state==="output-available"?{args:S.input,result:typeof S.output=="object"&&S.output&&"value"in S.output?S.output.value:S.output,toolCallId:S.toolCallId,toolName:k,state:"result"}:{args:S.input,toolCallId:S.toolCallId,toolName:k,state:"call"}}));let m;d.length>0&&(m=d.map(S=>S.text).join(`
|
|
497
497
|
`));let g;f.length>0&&(g=f.map(S=>({url:S.url||"",contentType:S.mediaType})));let y;h.length>0&&(y=h.map(S=>S.text).join(""));const x=t.map(S=>{if(of(S)){const k=f$e(S),_="callProviderMetadata"in S?S.callProviderMetadata:void 0;return S.state==="output-available"?{type:"tool-invocation",toolInvocation:{toolCallId:S.toolCallId,toolName:k,args:S.input,result:typeof S.output=="object"&&S.output&&"value"in S.output?S.output.value:S.output,state:"result"},providerMetadata:_,createdAt:Ed(_)}:{type:"tool-invocation",toolInvocation:{toolCallId:S.toolCallId,toolName:k,args:S.input,state:"call"},providerMetadata:_,createdAt:Ed(_)}}return S.type==="reasoning"?{type:"reasoning",reasoning:"",details:[{type:"text",text:S.text}],providerMetadata:S.providerMetadata,createdAt:Ed(S.providerMetadata)}:S.type==="file"?{type:"file",mimeType:S.mediaType,data:S.url||"",providerMetadata:S.providerMetadata,createdAt:Ed(S.providerMetadata),...S.filename?{filename:S.filename}:{}}:S.type==="source-url"?{type:"source",source:{url:S.url,sourceType:"url",id:S.url,providerMetadata:S.providerMetadata},providerMetadata:S.providerMetadata,createdAt:Ed(S.providerMetadata)}:S.type==="text"?{type:"text",text:S.text,providerMetadata:S.providerMetadata,createdAt:Ed(S.providerMetadata)}:S.type==="step-start"?S:typeof S.type=="string"&&S.type.startsWith("data-")?{type:S.type,data:"data"in S?S.data:void 0}:null}).filter(S=>S!==null),w=d$e(x);return{id:e.id,role:e.role,createdAt:a,threadId:i,resourceId:l,content:{format:2,parts:w,toolInvocations:p,reasoning:m,experimental_attachments:g,content:y,metadata:Object.keys(c).length>0?c:void 0}}}static getDataStringFromAIV5DataPart(e){let t,r;if("data"in e)t=e.mediaType||"application/octet-stream",r=e.data;else if("image"in e)t=e.mediaType||"image/jpeg",r=e.image;else{if("url"in e&&typeof e.url=="string")return e.url;throw new tS({id:"MASTRA_AIV5_DATA_PART_INVALID",domain:"AGENT",category:"USER",text:"Invalid AIV5 data part in getDataStringFromAIV5DataPart",details:{part:e}})}if(r instanceof URL)return r.toString();if(r instanceof Buffer){const n=r.toString("base64");return`data:${t};base64,${n}`}else{if(typeof r=="string")return r.startsWith("data:")||r.startsWith("http")?r:`data:${t};base64,${r}`;if(r instanceof Uint8Array){const n=Buffer.from(r).toString("base64");return`data:${t};base64,${n}`}else if(r instanceof ArrayBuffer){const n=Buffer.from(r).toString("base64");return`data:${t};base64,${n}`}else return""}}static fromModelMessage(e,t){const r=Array.isArray(e.content)?e.content:[{type:"text",text:e.content}],n=[],s=[],a=[],i=[];for(const h of r)if(h.type==="text"){const p={type:"text",text:h.text};h.providerOptions&&(p.providerMetadata=h.providerOptions,p.createdAt=Ed(h.providerOptions)),n.push(p)}else if(h.type==="tool-call"){const p=h,m={type:"tool-invocation",toolInvocation:{toolCallId:p.toolCallId,toolName:Wl(p.toolName),args:p.input,state:"call"}};h.providerOptions&&(m.providerMetadata=h.providerOptions,m.createdAt=Ed(h.providerOptions)),n.push(m),s.push({toolCallId:p.toolCallId,toolName:Wl(p.toolName),args:p.input,state:"call"})}else if(h.type==="tool-result"){const p=h,m=s.find(x=>x.toolCallId===p.toolCallId),g=n.find(x=>x.type==="tool-invocation"&&"toolInvocation"in x&&x.toolInvocation.toolCallId===p.toolCallId),y=(x,w)=>{w.state="result",w.result=typeof x.output=="object"&&x.output&&"value"in x.output?x.output.value:x.output};if(m)y(p,m);else{const x={state:"call",toolCallId:p.toolCallId,toolName:Wl(p.toolName),args:{}};y(p,x),s.push(x)}if(g&&g.type==="tool-invocation")y(p,g.toolInvocation),p.providerOptions&&(g.providerMetadata=p.providerOptions,g.createdAt=Ed(p.providerOptions)??g.createdAt);else{const x={type:"tool-invocation",toolInvocation:{toolCallId:p.toolCallId,toolName:Wl(p.toolName),args:{},state:"call"}};y(p,x.toolInvocation),p.providerOptions&&(x.providerMetadata=p.providerOptions,x.createdAt=Ed(p.providerOptions)),n.push(x)}}else if(h.type==="reasoning"){const p={type:"reasoning",reasoning:"",details:[{type:"text",text:h.text}]};h.providerOptions&&(p.providerMetadata=h.providerOptions,p.createdAt=Ed(h.providerOptions)),n.push(p),a.push(h.text)}else if(h.type==="image"){const p=h,m=p.mediaType||"image/jpeg",g=this.getDataStringFromAIV5DataPart(p),y={type:"file",data:g,mimeType:m};h.providerOptions&&(y.providerMetadata=h.providerOptions,y.createdAt=Ed(h.providerOptions)),n.push(y),i.push({url:g,contentType:m})}else if(h.type==="file"){const p=h,m=p.mediaType||"application/octet-stream",g=this.getDataStringFromAIV5DataPart(p),y={type:"file",data:g,mimeType:m};h.providerOptions&&(y.providerMetadata=h.providerOptions,y.createdAt=Ed(h.providerOptions)),p.filename&&(y.filename=p.filename),n.push(y),i.push({url:g,contentType:m})}const l=d$e(n),c=l.filter(h=>h.type==="text").map(h=>h.text).join(`
|
|
498
498
|
`),u="metadata"in e&&e.metadata!==null&&e.metadata!==void 0?e.metadata:{},f={id:"id"in e&&typeof e.id=="string"?e.id:`msg-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,role:e.role==="tool"?"assistant":e.role,createdAt:new Date,content:{format:2,parts:l,toolInvocations:s.length>0?s:void 0,reasoning:a.length>0?a.join(`
|
|
499
499
|
`):void 0,experimental_attachments:i.length>0?i:void 0,content:c||void 0,metadata:Object.keys(u).length>0?u:void 0}};return e.providerOptions&&(f.content.providerMetadata=e.providerOptions),f}};function Bc(e,t){for(const[r,n]of Object.entries(t))n!==void 0&&(e[r]=n);return e}function fln(e){return e.startsWith("tool-")?Wl(e.slice(5)):Wl(e)}function h$e(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{}}function ole(e){return e==="approval-requested"||e==="approval-responded"||e==="output-denied"}function hln(e){if(e)return{id:e.id,approved:"approved"in e?e.approved:void 0,reason:"reason"in e?e.reason:void 0}}function pln(e){return e.type==="dynamic-tool"?Wl(e.toolName):fln(e.type)}function mln(e){return e.type==="dynamic-tool"&&!ole(e.state)?{...e,type:`tool-${Wl(e.toolName)}`}:e}function pG({toolCallId:e,toolName:t,args:r,state:n,approval:s,result:a,errorText:i,rawInput:l,providerMetadata:c,providerExecuted:u,title:d,preliminary:f}){return Bc({type:"tool-invocation",toolInvocation:Bc({toolCallId:e,toolName:t,args:r,state:n},{approval:s,result:a,errorText:i,rawInput:l})},{providerMetadata:c,providerExecuted:u,title:d,preliminary:f})}function gln(e,t){for(const r of e)if(r.type==="tool-invocation"&&r.toolInvocation.toolCallId===t)return r}function yln(e,t){if(e){for(const r of[...e].reverse())for(const n of[...r.content.parts||[]].reverse())if(n.type==="tool-invocation"&&n.toolInvocation.approval?.id===t&&n.toolInvocation.state==="approval-requested")return n}}var mm=class pw{static toUIMessage(t){const r=Wc.toUIMessage(t),n=r.metadata||{},s=[],a=t.content.parts||[],i=a.some(d=>d.type==="tool-invocation"),l=a.some(d=>d.type==="reasoning"),c=a.some(d=>d.type==="file"),u=a.some(d=>d.type==="text");for(const d of a)s.push(pw.toUIPart(d));if(!i||!l||!c||!u)for(const d of r.parts){if(of(d)){i||s.push(pw.toUIPartFromV5(d));continue}if(d.type==="reasoning"){l||s.push(pw.toUIPartFromV5(d));continue}if(d.type==="file"){c||s.push(pw.toUIPartFromV5(d));continue}d.type==="text"&&!u&&s.push(pw.toUIPartFromV5(d))}return{id:t.id,role:t.role,metadata:Object.keys(n).length>0?n:void 0,parts:s}}static fromUIMessage(t){const r=t.parts.filter(l=>!(l.type==="source-document"||VLe(l)&&ole(l.state))),n=Wc.fromUIMessage({...t,parts:r.map(l=>mln(l))}),s=n.content.parts||[],a=[];let i=0;for(const l of t.parts){if(l.type==="source-document"){a.push(Bc({type:"source-document",sourceId:l.sourceId,mediaType:l.mediaType,title:l.title},{filename:l.filename,providerMetadata:l.providerMetadata}));continue}if(!VLe(l)||!ole(l.state)){const c=s[i++];c&&a.push(c);continue}a.push(pG({toolCallId:l.toolCallId,toolName:pln(l),args:h$e(l.input),state:l.state,approval:hln(l.approval),providerMetadata:"callProviderMetadata"in l?l.callProviderMetadata:void 0,providerExecuted:l.providerExecuted,title:l.title,preliminary:"preliminary"in l?l.preliminary:void 0}))}return{...n,content:{...n.content,parts:a}}}static fromModelMessage(t,r,n={}){const s=Array.isArray(t.content)?t.content:[{type:"text",text:t.content}],a=s.filter(c=>c.type!=="tool-approval-request"&&c.type!=="tool-approval-response"),i=Wc.fromModelMessage({...t,content:a},r),l=[...i.content.parts];if(t.role==="assistant"){const c=new Map;for(const u of s){if(u.type==="tool-call"){c.set(u.toolCallId,{toolName:Wl(u.toolName),args:h$e(u.input)});continue}if(u.type!=="tool-approval-request")continue;const d=c.get(u.toolCallId),f=gln(l,u.toolCallId);if(f){f.toolInvocation.state="approval-requested",f.toolInvocation.approval={id:u.approvalId};continue}l.push(pG({toolCallId:u.toolCallId,toolName:d?.toolName||"unknown",args:d?.args||{},state:"approval-requested",approval:{id:u.approvalId}}))}}else if(t.role==="tool")for(const c of s){if(c.type!=="tool-approval-response")continue;const u=yln(n.dbMessages,c.approvalId);u&&l.push(pG({toolCallId:u.toolInvocation.toolCallId,toolName:u.toolInvocation.toolName,args:u.toolInvocation.args,state:"approval-responded",approval:{id:c.approvalId,approved:c.approved,reason:c.reason},providerMetadata:u.providerMetadata,providerExecuted:u.providerExecuted,title:u.title}))}return{...i,content:{...i.content,parts:l}}}static toUIPart(t){if(t.type==="tool-invocation"){const r=Bc({type:`tool-${Wl(t.toolInvocation.toolName)}`,toolCallId:t.toolInvocation.toolCallId,providerExecuted:t.providerExecuted},{callProviderMetadata:t.providerMetadata,title:t.title});switch(t.toolInvocation.state){case"partial-call":return{...r,state:"input-streaming",input:t.toolInvocation.args};case"call":return{...r,state:"input-available",input:t.toolInvocation.args};case"approval-requested":return{...r,state:"approval-requested",input:t.toolInvocation.args,approval:{id:t.toolInvocation.approval?.id||t.toolInvocation.toolCallId}};case"approval-responded":return{...r,state:"approval-responded",input:t.toolInvocation.args,approval:{id:t.toolInvocation.approval?.id||t.toolInvocation.toolCallId,approved:t.toolInvocation.approval?.approved??!1,reason:t.toolInvocation.approval?.reason}};case"output-error":return Bc({...r,state:"output-error",input:t.toolInvocation.args,errorText:t.toolInvocation.errorText||""},{rawInput:t.toolInvocation.rawInput,approval:t.toolInvocation.approval?.approved===!0?{id:t.toolInvocation.approval.id,approved:!0,reason:t.toolInvocation.approval.reason}:void 0});case"output-denied":return{...r,state:"output-denied",input:t.toolInvocation.args,approval:{id:t.toolInvocation.approval?.id||t.toolInvocation.toolCallId,approved:!1,reason:t.toolInvocation.approval?.reason}};case"result":return Bc({...r,state:"output-available",input:t.toolInvocation.args,output:t.toolInvocation.result},{preliminary:t.preliminary,approval:t.toolInvocation.approval?.approved===!0?{id:t.toolInvocation.approval.id,approved:!0,reason:t.toolInvocation.approval.reason}:void 0});default:throw new Error(`Unhandled toolInvocation.state: ${String(t.toolInvocation.state)}`)}}return t.type==="source-document"?Bc({type:"source-document",sourceId:t.sourceId,mediaType:t.mediaType,title:t.title},{filename:t.filename,providerMetadata:t.providerMetadata}):pw.toUIPartFromV5(Wc.toUIMessage({id:"tmp",role:"assistant",createdAt:new Date,content:{format:2,parts:[t]}}).parts[0])}static toUIPartFromV5(t){if(of(t)){const r={type:t.type,toolCallId:t.toolCallId,providerExecuted:t.providerExecuted};switch(t.state){case"input-streaming":return Bc({...r,state:"input-streaming",input:t.input},{callProviderMetadata:"callProviderMetadata"in t?t.callProviderMetadata:void 0,title:"title"in t?t.title:void 0});case"input-available":return Bc({...r,state:"input-available",input:t.input},{callProviderMetadata:"callProviderMetadata"in t?t.callProviderMetadata:void 0,title:"title"in t?t.title:void 0});case"output-available":return Bc({...r,state:"output-available",input:t.input,output:t.output},{callProviderMetadata:"callProviderMetadata"in t?t.callProviderMetadata:void 0,preliminary:"preliminary"in t?t.preliminary:void 0,title:"title"in t?t.title:void 0});case"output-error":return Bc({...r,state:"output-error",input:t.input,errorText:t.errorText},{rawInput:"rawInput"in t?t.rawInput:void 0,callProviderMetadata:"callProviderMetadata"in t?t.callProviderMetadata:void 0,title:"title"in t?t.title:void 0})}}switch(t.type){case"text":return Bc({type:"text",text:t.text},{providerMetadata:t.providerMetadata});case"reasoning":return Bc({type:"reasoning",text:t.text,state:t.state},{providerMetadata:t.providerMetadata});case"file":return Bc({type:"file",url:t.url,mediaType:t.mediaType},{filename:"filename"in t?t.filename:void 0,providerMetadata:t.providerMetadata});case"source-url":return Bc({type:"source-url",sourceId:t.sourceId,url:t.url},{title:t.title,providerMetadata:t.providerMetadata});case"step-start":return{type:"step-start"};default:return typeof t.type=="string"&&t.type.startsWith("data-")?{type:t.type,data:"data"in t?t.data:void 0}:t}}},Vi=class lle{static fromAIV4Parts(t){let r="";for(const n of t)r+=n.type,r+=lle.fromAIV4Part(n);return r}static fromAIV4Part(t){let r="";if(t.type==="text"&&(r+=t.text),t.type==="tool-invocation"&&(r+=t.toolInvocation.toolCallId,r+=t.toolInvocation.state),t.type==="reasoning"){r+=t.reasoning,r+=t.details.reduce((s,a)=>a.type==="text"?s+a.text.length+(a.signature?.length||0):s,0);const n=t;if(n&&Object.hasOwn(n,"providerMetadata")&&n.providerMetadata&&Object.hasOwn(n.providerMetadata,"openai")&&n.providerMetadata.openai&&Object.hasOwn(n.providerMetadata.openai,"itemId")){const s=n.providerMetadata.openai.itemId;r+=`|${s}`}}return t.type==="file"&&(r+=t.data,r+=t.mimeType),r}static fromDBParts(t){let r="";for(const n of t)if(r+=n.type,n.type.startsWith("data-")){const s=n.data;r+=JSON.stringify(s)}else r+=lle.fromAIV4Part(n);return r}static fromAIV4CoreMessageContent(t){if(typeof t=="string")return t;let r="";for(const n of t)r+=n.type,n.type==="text"&&(r+=n.text.length),n.type==="reasoning"&&(r+=n.text.length),n.type==="tool-call"&&(r+=n.toolCallId,r+=n.toolName),n.type==="tool-result"&&(r+=n.toolCallId,r+=n.toolName),n.type==="file"&&(r+=n.filename,r+=n.mimeType),n.type==="image"&&(r+=l$e(n.image),r+=n.mimeType),n.type==="redacted-reasoning"&&(r+=n.data.length);return r}static fromAIV5Parts(t){let r="";for(const n of t)r+=n.type,n.type==="text"&&(r+=n.text),(of(n)||n.type==="dynamic-tool")&&(r+=n.toolCallId,r+=n.state),n.type==="reasoning"&&(r+=n.text),n.type==="file"&&(r+=n.url.length,r+=n.mediaType,r+=n.filename||"");return r}static fromAIV5ModelMessageContent(t){if(typeof t=="string")return t;let r="";for(const n of t)r+=n.type,n.type==="text"&&(r+=n.text.length),n.type==="reasoning"&&(r+=n.text.length),n.type==="tool-call"&&(r+=n.toolCallId,r+=n.toolName),n.type==="tool-result"&&(r+=n.toolCallId,r+=n.toolName),n.type==="file"&&(r+=n.filename,r+=n.mediaType),n.type==="image"&&(r+=l$e(n.image),r+=n.mediaType);return r}};function vln(e){if(e.role==="system")return e;if(typeof e.content=="string"&&(e.role==="assistant"||e.role==="user"))return{...e,content:[{type:"text",text:e.content}]};if(typeof e.content=="string")throw new Error(`Saw text content for input CoreMessage, but the role is ${e.role}. This is only allowed for "system", "assistant", and "user" roles.`);const t={user:[],assistant:[],tool:[]},r=e.role;for(const n of e.content){const s=`Saw incompatible message content part type ${n.type} for message role ${r}`;switch(n.type){case"text":{if(r==="tool")throw new Error(s);t[r].push(n);break}case"redacted-reasoning":case"reasoning":{if(r!=="assistant")throw new Error(s);t[r].push(n);break}case"tool-call":{if(r==="tool"||r==="user")throw new Error(s);t[r].push({...n,toolName:Wl(n.toolName)});break}case"tool-result":{if(r==="assistant"||r==="user")throw new Error(s);t[r].push({...n,toolName:Wl(n.toolName)});break}case"image":{if(r==="tool"||r==="assistant")throw new Error(s);let a;if(n.image instanceof URL||n.image instanceof Uint8Array)a=n.image;else if(Buffer.isBuffer(n.image)||n.image instanceof ArrayBuffer)a=new Uint8Array(n.image);else if(dR(n.image,n.mimeType).type==="raw"){const l=E8(n.image,n.mimeType||"image/png");a=new URL(l)}else a=new URL(n.image);t[r].push({...n,image:a});break}case"file":{if(r==="tool")throw new Error(s);t[r].push({...n,data:n.data instanceof URL||typeof n.data=="string"?n.data:xE(n.data)});break}}}if(r==="tool")return{...e,content:t[r]};if(r==="user")return{...e,content:t[r]};if(r==="assistant")return{...e,content:t[r]};throw new Error(`Encountered unknown role ${r} when converting V4 CoreMessage -> V4 LanguageModelV1Prompt, input message: ${JSON.stringify(e,null,2)}`)}function bln(e){if(e.role==="system")return e;if(typeof e.content=="string"&&(e.role==="assistant"||e.role==="user"))return{role:e.role,content:[{type:"text",text:e.content}],providerOptions:e.providerOptions};if(typeof e.content=="string")throw new Error(`Saw text content for input ModelMessage, but the role is ${e.role}. This is only allowed for "system", "assistant", and "user" roles.`);const t={user:[],assistant:[],tool:[]},r=e.role;for(const n of e.content){const s=`Saw incompatible message content part type ${n.type} for message role ${r}`;switch(n.type){case"text":{if(r==="tool")throw new Error(s);t[r].push(n);break}case"reasoning":{if(r==="tool"||r==="user")throw new Error(s);t[r].push(n);break}case"tool-call":{if(r!=="assistant")throw new Error(s);t[r].push({...n,toolName:Wl(n.toolName)});break}case"tool-result":{if(r==="user")throw new Error(s);t[r].push({...n,toolName:Wl(n.toolName)});break}case"file":{if(r==="tool")throw new Error(s);t[r].push({...n,data:n.data instanceof ArrayBuffer?new Uint8Array(n.data):n.data});break}case"image":{if(r==="tool")throw new Error(s);t[r].push({...n,mediaType:n.mediaType||"image/unknown",type:"file",data:n.image instanceof ArrayBuffer?new Uint8Array(n.image):n.image});break}}}if(r==="tool")return{...e,content:t[r]};if(r==="user")return{...e,content:t[r]};if(r==="assistant")return{...e,content:t[r]};throw new Error(`Encountered unknown role ${r} when converting V5 ModelMessage -> V5 LanguageModelV2Message, input message: ${JSON.stringify(e,null,2)}`)}function xln(e){return typeof e=="string"?e:e.reduce((t,r)=>(r.type==="text"&&(t+=r.text),t),"")}function mG(e,t){const r=da.isAIV4UIMessage(e)&&e,n=da.isAIV4UIMessage(t)&&t;if(r&&!n)return!1;if(r&&n)return Vi.fromAIV4Parts(e.parts)===Vi.fromAIV4Parts(t.parts);const s=da.isAIV4CoreMessage(e)&&e,a=da.isAIV4CoreMessage(t)&&t;if(s&&!a)return!1;if(s&&a)return Vi.fromAIV4CoreMessageContent(s.content)===Vi.fromAIV4CoreMessageContent(a.content);const i=da.isMastraMessageV1(e)&&e,l=da.isMastraMessageV1(t)&&t;if(i&&!l)return!1;if(i&&l)return i.id===l.id&&Vi.fromAIV4CoreMessageContent(i.content)===Vi.fromAIV4CoreMessageContent(l.content);const c=da.isMastraDBMessage(e)&&e,u=da.isMastraDBMessage(t)&&t;if(c&&!u)return!1;if(c&&u)return c.id===u.id&&Vi.fromDBParts(c.content.parts)===Vi.fromDBParts(u.content.parts);const d=da.isAIV5UIMessage(e)&&e,f=da.isAIV5UIMessage(t)&&t;if(d&&!f)return!1;if(d&&f)return Vi.fromAIV5Parts(e.parts)===Vi.fromAIV5Parts(t.parts);const h=da.isAIV5CoreMessage(e)&&e,p=da.isAIV5CoreMessage(t)&&t;return h&&!p?!1:h&&p?Vi.fromAIV5ModelMessageContent(h.content)===Vi.fromAIV5ModelMessageContent(p.content):!0}function fye(e){return e.createdAt==null&&(e.createdAt=Date.now()),e}function MO(e,t){return t==="memory"||!Array.isArray(e.content.parts)||(e.content.parts=e.content.parts.map(r=>fye(r))),e}function wln(e,t,r){if(t!=="memory"&&"threadId"in e&&e.threadId&&r.memoryInfo&&e.threadId!==r.memoryInfo.threadId)throw new Error(`Received input message with wrong threadId. Input ${e.threadId}, expected ${r.memoryInfo.threadId}`);if("resourceId"in e&&e.resourceId&&r.memoryInfo?.resourceId&&e.resourceId!==r.memoryInfo.resourceId)throw new Error(`Received input message with wrong resourceId. Input ${e.resourceId}, expected ${r.memoryInfo.resourceId}`);if(da.isMastraMessageV1(e))return MO(Sln(e,t,r),t);if(da.isMastraDBMessage(e))return MO(Oln(e,r),t);if(da.isAIV4CoreMessage(e))return MO(To.fromCoreMessage(e,r,t),t);if(da.isAIV4UIMessage(e))return MO(To.fromUIMessage(e,r,t),t);const s="id"in e&&typeof e.id=="string"?e.id:r.newMessageId();if(da.isAIV6CoreMessage(e)){const a=mm.fromModelMessage(e,t,r),i="metadata"in e&&e.metadata&&typeof e.metadata=="object"&&"createdAt"in e.metadata?e.metadata.createdAt:void 0;return{...a,id:s,createdAt:r.generateCreatedAt(t,i),threadId:r.memoryInfo?.threadId,resourceId:r.memoryInfo?.resourceId}}if(da.isAIV6UIMessage(e)){const a=mm.fromUIMessage(e),i="createdAt"in e?e.createdAt:void 0;return{...a,id:s,createdAt:r.generateCreatedAt(t,i),threadId:r.memoryInfo?.threadId,resourceId:r.memoryInfo?.resourceId}}if(da.isAIV5CoreMessage(e)){const a=Wc.fromModelMessage(e,t),i="metadata"in e&&e.metadata&&typeof e.metadata=="object"&&"createdAt"in e.metadata?e.metadata.createdAt:void 0;return MO({...a,id:s,createdAt:r.generateCreatedAt(t,i),threadId:r.memoryInfo?.threadId,resourceId:r.memoryInfo?.resourceId},t)}if(da.isAIV5UIMessage(e)){const a=Wc.fromUIMessage(e),i="createdAt"in e?e.createdAt:void 0;return MO({...a,id:s,createdAt:r.generateCreatedAt(t,i),threadId:r.memoryInfo?.threadId,resourceId:r.memoryInfo?.resourceId},t)}throw new Error(`Found unhandled message ${JSON.stringify(e)}`)}function Sln(e,t,r){const n=To.fromCoreMessage({content:e.content,role:e.role},r,t);return{id:e.id,role:n.role,createdAt:r.generateCreatedAt(t,e.createdAt),threadId:e.threadId,resourceId:e.resourceId,content:n.content}}function Oln(e,t){return e.id||(e.id=t.newMessageId()),e.createdAt instanceof Date||(e.createdAt=new Date(e.createdAt)),e.content.toolInvocations&&e.content.parts&&(e.content.toolInvocations=e.content.toolInvocations.map(r=>{if(!r.args||Object.keys(r.args).length===0){const n=e.content.parts.find(s=>s.type==="tool-invocation"&&s.toolInvocation&&s.toolInvocation.toolCallId===r.toolCallId&&s.toolInvocation.args&&Object.keys(s.toolInvocation.args).length>0);if(n&&n.type==="tool-invocation")return{...r,args:n.toolInvocation.args}}return r})),!e.threadId&&t.memoryInfo?.threadId&&(e.threadId=t.memoryInfo.threadId,!e.resourceId&&t.memoryInfo?.resourceId&&(e.resourceId=t.memoryInfo.resourceId)),e}function kln(e){const t=[];for(const r of e){if(r.type!=="text"){t.push(r);continue}const n=r,s=n.providerMetadata?.openai?.itemId;if(!s){t.push(r);continue}const a=t.findIndex(i=>i.type!=="text"?!1:i.providerMetadata?.openai?.itemId===s);if(a!==-1){const i=t[a];t[a]={...i,text:i.text+n.text}}else t.push(r)}return t}function _ln(e){return e.map(r=>{if(r.parts.length===0)return!1;const n=r.parts.filter(a=>a.type!=="tool-invocation"||a.toolInvocation.state!=="call"&&a.toolInvocation.state!=="partial-call");if(!n.length)return!1;const s={...r,parts:n};return"toolInvocations"in r&&r.toolInvocations&&(s.toolInvocations=r.toolInvocations.filter(a=>a.state==="result")),s}).filter(r=>!!r)}function Bxt(e,t=!1){return e.map(n=>{if(n.parts.length===0)return!1;const s=n.parts.filter(l=>typeof l.type=="string"&&l.type.startsWith("data-")||l.type==="text"&&(!("text"in l)||l.text===""||l.text?.trim()==="")&&(n.role==="user"||n.parts.some(u=>!(u.type==="text"&&(!("text"in u)||u.text===""||u.text?.trim()===""))))?!1:of(l)?t?!!(l.state==="output-available"||l.state==="output-error"||l.state==="input-available"&&l.providerExecuted):l.state!=="input-streaming":!0);if(!s.length)return!1;const a=kln(s);return{...n,parts:a.map(l=>of(l)&&l.state==="output-available"?{...l,output:typeof l.output=="object"&&l.output&&"value"in l.output?l.output.value:l.output}:l)}}).filter(n=>!!n)}function Eln(e){for(const t of e)if(t.role==="assistant")for(const[r,n]of t.parts.entries()){if(!of(n))continue;const s=t.parts.at(r+1);s&&s.type!=="step-start"&&!of(s)&&t.parts.splice(r+1,0,{type:"step-start"}),s&&of(s)&&!n.providerExecuted&&s.providerExecuted&&(s.state==="output-available"||s.state==="output-error")&&t.parts.splice(r+1,0,{type:"step-start"})}return e}function Wf(e){return hon(_ln(e))}function Cln(e,t){const r=[];for(const s of t)if(s.role==="assistant")for(const a of s.parts)a.type==="file"&&r.push(a.providerMetadata??void 0);if(r.length===0||r.every(s=>s==null))return e;let n=0;return e.map(s=>{if(s.role!=="assistant"||typeof s.content=="string")return s;let a=!1;const i=s.content.map(l=>{if(l.type!=="file"||n>=r.length)return l;const c=r[n++];return l.providerOptions||!c?l:(a=!0,{...l,providerOptions:c})});return a?{...s,content:i}:s})}function dm(e,t,r=!1){const n=Bxt(e,r),s=Eln(n),i=Cln(Yvt(s),s).map((l,c)=>{const u=s[c];return u?.metadata&&typeof u.metadata=="object"&&"providerMetadata"in u.metadata&&u.metadata.providerMetadata?{...l,providerOptions:u.metadata.providerMetadata}:l});return cln(i,t)}function p$e(e,t,r,n){return dm(e.map(s=>To.fromCoreMessage(s,r,t)).map(s=>Wc.toUIMessage(s)),n)}function jln(e){if(typeof e=="string")return{role:"system",content:e};if(da.isAIV6CoreMessage(e)){const t=mm.fromModelMessage(e,"system");return To.systemToV4Core(t)}if(da.isAIV5CoreMessage(e)){const t=Wc.fromModelMessage(e,"system");return To.systemToV4Core(t)}return da.isMastraDBMessage(e)?To.systemToV4Core(e):e}var Tln=class{base64Data;uint8ArrayData;mediaType;constructor({data:e,mediaType:t}){const r=e instanceof Uint8Array;this.base64Data=r?void 0:e,this.uint8ArrayData=r?e:void 0,this.mediaType=t}get base64(){return this.base64Data==null&&(this.base64Data=ile(this.uint8ArrayData)),this.base64Data}get uint8Array(){return this.uint8ArrayData==null&&(this.uint8ArrayData=zxt(this.base64Data)),this.uint8ArrayData}},m$e=class extends Tln{type="file";constructor(e){super(e)}},g$e=class gy{static extractStepContent(t,r,n){const s=t.flatMap(i=>i.parts),a=[];return s.forEach((i,l)=>{i.type==="step-start"&&a.push(l)}),r===-1?gy.extractLastStep(s,a,n):r===1?gy.extractFirstStep(s,a,n):gy.extractMiddleStep(s,a,r,n)}static extractLastStep(t,r,n){const s=t.filter(u=>u.type?.startsWith("tool-")),a=r.length>0;if(!a&&s.length>0){const u=s[s.length-1];if(!u)return[];const d=t.indexOf(u),f=s[s.length-2],p=(f?t.indexOf(f):-1)+1,m=t.slice(p,d+1);return gy.convertPartsToContent(m,"last-step",n)}if(r.length+1===1&&!a)return gy.convertPartsToContent(t,"last-step",n);const l=r[r.length-1];if(l===void 0)return[];const c=t.slice(l+1);return c.length===0?[]:gy.convertPartsToContent(c,"last-step",n)}static extractFirstStep(t,r,n){const s=r[0]??t.length;if(s===0)return[];const a=t.slice(0,s);return gy.convertPartsToContent(a,"step-1",n)}static extractMiddleStep(t,r,n,s){const a=n-2;if(a<0||a>=r.length)return[];const i=(r[a]??0)+1,l=r[a+1]??t.length;if(i>=l)return[];const c=t.slice(i,l);return gy.convertPartsToContent(c,`step-${n}`,s)}static convertPartsToContent(t,r,n){return Yvt(Bxt([{id:r,role:"assistant",parts:t}])).flatMap(n)}static convertToStepContent(t,r,n){const s=t||n();return s?typeof s.content=="string"?[{type:"text",text:s.content}]:s.content.map(a=>a.type==="tool-result"?{type:"tool-result",input:dye(r,a.toolCallId),output:a.output,toolCallId:a.toolCallId,toolName:a.toolName}:a.type==="file"?{type:"file",file:new m$e({data:typeof a.data=="string"?M6(a.data).base64Content:a.data instanceof URL?a.data.toString():xE(a.data),mediaType:a.mediaType})}:a.type==="image"?{type:"file",file:new m$e({data:typeof a.image=="string"?M6(a.image).base64Content:a.image instanceof URL?a.image.toString():xE(a.image),mediaType:a.mediaType||"unknown"})}:{...a}):[]}},cy=class aN{static isSealed(t){return t.content?.metadata?.mastra?.sealed===!0}static shouldMerge(t,r,n,s,a=!1){if(!t||aN.isSealed(t)||r.content.metadata?.completionResult||t.content.metadata?.completionResult||r.content.metadata?.isTaskCompleteResult||t.content.metadata?.isTaskCompleteResult)return!1;const i=t.content?.parts??[];return i.length>0&&i.every(d=>d.type.startsWith("data-"))&&t.id!==r.id?!1:t.role==="assistant"&&r.role==="assistant"&&t.threadId===r.threadId&&n!=="memory"&&(a?!s:!0)}static merge(t,r){t.createdAt=r.createdAt||t.createdAt,r.content.metadata&&(t.content.metadata={...t.content.metadata??{},...r.content.metadata});const n=new Map,s=new Map;for(const[a,i]of r.content.parts.entries())if(i.type==="tool-invocation"){const l=[...t.content.parts].reverse().find(u=>u.type==="tool-invocation"&&u.toolInvocation.toolCallId===i.toolInvocation.toolCallId);if(!!l&&l.type==="tool-invocation"){if(i.toolInvocation.state==="result"){l.toolInvocation={...l.toolInvocation,step:i.toolInvocation.step,state:"result",result:i.toolInvocation.result,args:{...l.toolInvocation.args,...i.toolInvocation.args}},i.providerMetadata&&(l.providerMetadata={...l.providerMetadata,...i.providerMetadata}),t.content.toolInvocations||(t.content.toolInvocations=[]);const d=t.content.toolInvocations.findIndex(f=>f.toolCallId===l.toolInvocation.toolCallId);d===-1?t.content.toolInvocations.push(l.toolInvocation):t.content.toolInvocations[d]=l.toolInvocation}else(i.toolInvocation.state==="approval-requested"||i.toolInvocation.state==="approval-responded"||i.toolInvocation.state==="output-denied"||i.toolInvocation.state==="output-error")&&(l.toolInvocation={...l.toolInvocation,state:i.toolInvocation.state,approval:i.toolInvocation.approval,errorText:i.toolInvocation.errorText,rawInput:i.toolInvocation.rawInput,args:{...l.toolInvocation.args,...i.toolInvocation.args}},i.providerMetadata&&(l.providerMetadata={...l.providerMetadata,...i.providerMetadata}),"providerExecuted"in i&&i.providerExecuted!==void 0&&(l.providerExecuted=i.providerExecuted),"title"in i&&i.title!==void 0&&(l.title=i.title),"preliminary"in i&&i.preliminary!==void 0&&(l.preliminary=i.preliminary));const u=t.content.parts.findIndex(d=>d===l);n.set(a,u)}else s.set(a,i)}else s.set(a,i);aN.addPartsToMessage({latestMessage:t,incomingMessage:r,anchorMap:n,partsToAdd:s}),t.createdAt.getTime()<r.createdAt.getTime()&&(t.createdAt=r.createdAt),!t.content.content&&r.content.content&&(t.content.content=r.content.content),t.content.content&&r.content.content&&t.content.content!==r.content.content&&(t.content.content=r.content.content)}static addPartsToMessage({latestMessage:t,incomingMessage:r,anchorMap:n,partsToAdd:s}){for(let a=0;a<r.content.parts.length;++a){const i=r.content.parts[a];if(!i)continue;const l=Vi.fromDBParts([i]),c=s.get(a);if(!(!l||!c))if(n.size>0){if(n.has(a))continue;const u=[...n.keys()].filter(g=>g<a).pop()??-1,d=[...n.keys()].find(g=>g>a)??-1,f=u!==-1?n.get(u):0,h=u===-1?a:a-u,p=f+h,m=d!==-1?n.get(d):t.content.parts.length;if(p>=0&&p<=m&&!t.content.parts.slice(p,m).some(g=>Vi.fromDBParts([g])===Vi.fromDBParts([i]))){aN.pushNewPart({latestMessage:t,newMessage:r,part:i,insertAt:p});for(const[g,y]of n.entries())y>=p&&n.set(g,y+1)}}else aN.pushNewPart({latestMessage:t,newMessage:r,part:i})}}static pushNewPart({latestMessage:t,newMessage:r,part:n,insertAt:s}){const a=Vi.fromDBParts([n]),i=t.content.parts.filter(c=>Vi.fromDBParts([c])===a).length,l=r.content.parts.filter(c=>Vi.fromDBParts([c])===a).length;if(i<l){const c=r.content.parts.indexOf(n),u=c>0&&r.content.parts[c-1]?.type==="step-start",d=t.role==="assistant"&&n.type==="text"&&!u&&t.content.parts.length>0&&t.content.parts.at(-1)?.type==="tool-invocation",f=[...t.content.parts].reverse().find(p=>p.type==="step-start"),h=f?.model?fye({type:"step-start",model:f.model}):{type:"step-start"};typeof s=="number"?d?(t.content.parts.splice(s,0,h),t.content.parts.splice(s+1,0,n)):t.content.parts.splice(s,0,n):(d&&t.content.parts.push(h),t.content.parts.push(n))}}};function Nln(e){try{const[t,r]=e.split(",");return{mediaType:t?.split(";")[0]?.split(":")[1],base64Content:r}}catch{return{mediaType:void 0,base64Content:void 0}}}function Aln(e){if(e instanceof Uint8Array)return{data:e,mediaType:void 0};if(e instanceof ArrayBuffer)return{data:new Uint8Array(e),mediaType:void 0};if(typeof e=="string")try{e=new URL(e)}catch{}if(e instanceof URL&&e.protocol==="data:"){const{mediaType:t,base64Content:r}=Nln(e.toString());if(t==null||r==null)throw new tS({id:"INVALID_DATA_URL_FORMAT",text:`Invalid data URL format in content ${e.toString()}`,domain:"LLM",category:"USER"});return{data:r,mediaType:t}}return{data:e,mediaType:void 0}}var Iln=[{mediaType:"image/gif",bytesPrefix:[71,73,70],base64Prefix:"R0lG"},{mediaType:"image/png",bytesPrefix:[137,80,78,71],base64Prefix:"iVBORw"},{mediaType:"image/jpeg",bytesPrefix:[255,216],base64Prefix:"/9j/"},{mediaType:"image/webp",bytesPrefix:[82,73,70,70],base64Prefix:"UklGRg"},{mediaType:"image/bmp",bytesPrefix:[66,77],base64Prefix:"Qk"},{mediaType:"image/tiff",bytesPrefix:[73,73,42,0],base64Prefix:"SUkqAA"},{mediaType:"image/tiff",bytesPrefix:[77,77,0,42],base64Prefix:"TU0AKg"},{mediaType:"image/avif",bytesPrefix:[0,0,0,32,102,116,121,112,97,118,105,102],base64Prefix:"AAAAIGZ0eXBhdmlm"},{mediaType:"image/heic",bytesPrefix:[0,0,0,32,102,116,121,112,104,101,105,99],base64Prefix:"AAAAIGZ0eXBoZWlj"}],Rln=e=>{const t=typeof e=="string"?zxt(e):e,r=(t[6]&127)<<21|(t[7]&127)<<14|(t[8]&127)<<7|t[9]&127;return t.slice(r+10)};function Pln(e){return typeof e=="string"&&e.startsWith("SUQz")||typeof e!="string"&&e.length>10&&e[0]===73&&e[1]===68&&e[2]===51?Rln(e):e}function Mln({data:e,signatures:t}){const r=Pln(e);for(const n of t)if(typeof r=="string"?r.startsWith(n.base64Prefix):r.length>=n.bytesPrefix.length&&n.bytesPrefix.every((s,a)=>r[a]===s))return n.mediaType}function y$e(e,t){let r;const n=e.type;switch(n){case"image":r=e.image;break;case"file":r=e.data;break;default:throw new Error(`Unsupported part type: ${n}`)}const{data:s,mediaType:a}=Aln(r);let i=a??e.mediaType,l=s;if(l instanceof URL&&t){const c=t[l.toString()];c&&(l=c.data,i??=c.mediaType)}switch(n){case"image":return(l instanceof Uint8Array||typeof l=="string")&&(i=Mln({data:l,signatures:Iln})??i),{type:"file",mediaType:i??"image/*",filename:void 0,data:l,providerOptions:e.providerOptions};case"file":{if(i==null)throw new Error("Media type is missing for file part");return{type:"file",mediaType:i,filename:e.filename,data:l,providerOptions:e.providerOptions}}}}function v$e(e){const t=[];for(const r of e){const n=dR(r.url,r.contentType);let s=r.url;n.type==="raw"&&(s=E8(r.url,r.contentType||"application/octet-stream"));let a;try{a=new URL(s)}catch{throw new Error(`Invalid URL: ${r.url}`)}switch(a.protocol){case"http:":case"https:":case"gs:":case"s3:":{if(r.contentType?.startsWith("image/"))t.push({type:"image",image:a.toString(),mimeType:r.contentType});else{if(!r.contentType)throw new Error("If the attachment is not an image, it must specify a content type");t.push({type:"file",data:a.toString(),mimeType:r.contentType})}break}case"data:":{if(r.contentType?.startsWith("image/"))t.push({type:"image",image:s,mimeType:r.contentType});else if(r.contentType?.startsWith("text/"))t.push({type:"file",data:s,mimeType:r.contentType});else{if(!r.contentType)throw new Error("If the attachment is not an image or text, it must specify a content type");t.push({type:"file",data:s,mimeType:r.contentType})}break}default:throw new Error(`Unsupported URL protocol: ${a.protocol}`)}}return t}var Dln=e=>{const t=new Map,r=/__split-\d+$/;return n=>{const s=e.at(-1);if(n.role===s?.role&&Array.isArray(s.content)&&Array.isArray(n.content)&&(n.role!=="assistant"||n.role==="assistant"&&n.content.at(-1)?.type!=="tool-call"))for(const a of n.content)s.content.push(a);else{let a=n.id;if(r.test(a)){e.push(n);return}const l=t.get(a)||0;l>0&&(n.id=`${a}__split-${l}`),t.set(a,l+1),e.push(n)}}};function DO(e){const t=[],r=Dln(t);for(let n=0;n<e.length;n++){const s=e[n],a=n===e.length-1;if(!s?.content)continue;const{content:i,experimental_attachments:l=[],parts:c}=s.content,{role:u}=s,d={id:s.id,createdAt:s.createdAt,resourceId:s.resourceId,threadId:s.threadId},f=[...l],h=[];for(const p of c)p.type==="file"?f.push({url:p.data,contentType:p.mimeType}):h.push(p);switch(u){case"user":{if(h==null){const p=f?[{type:"text",text:i||""},...v$e(f)]:{type:"text",text:i||""};r({role:"user",...d,type:"text",content:p})}else{const p=s.content.parts.filter(g=>g.type==="text").map(g=>({type:"text",text:g.text})),m=f?[...p,...v$e(f)]:p;r({role:"user",...d,type:"text",content:Array.isArray(m)&&m.length===1&&m[0]?.type==="text"&&typeof i<"u"?i:m})}break}case"assistant":{if(s.content.parts!=null){let g=function(){const k=[];for(const T of w)switch(T.type){case"file":case"text":{k.push(T);break}case"reasoning":{for(const j of T.details)switch(j.type){case"text":k.push({type:"reasoning",text:j.text,signature:j.signature});break;case"redacted":k.push({type:"redacted-reasoning",data:j.data});break}break}case"tool-invocation":T.toolInvocation.toolName!=="updateWorkingMemory"&&k.push({type:"tool-call",toolCallId:T.toolInvocation.toolCallId,toolName:T.toolInvocation.toolName,args:T.toolInvocation.args});break}r({role:"assistant",...d,type:k.some(T=>T.type==="tool-call")?"tool-call":"text",content:typeof k!="string"&&Array.isArray(k)&&k.length===1&&k[0]?.type==="text"?k[0].text:k});const E=w.filter(T=>"type"in T&&T.type==="tool-invocation").map(T=>T.toolInvocation).filter(T=>T.toolName!=="updateWorkingMemory").filter(T=>T.state==="result"&&"result"in T);E.length>0&&r({role:"tool",...d,type:"tool-result",content:E.map(T=>{const{toolCallId:j,toolName:N,result:I}=T;return{type:"tool-result",toolCallId:j,toolName:N,result:I}})}),w=[],x=!1,y++},y=0,x=!1,w=[];for(const k of s.content.parts)switch(k.type){case"text":{x&&g(),w.push(k);break}case"file":case"reasoning":{w.push(k);break}case"tool-invocation":{(w.some(E=>E.type==="text"||E.type==="file"||E.type==="reasoning")||(k.toolInvocation.step??0)!==y)&&g(),w.push(k),x=!0;break}}g();const S=s.content.toolInvocations;if(S&&S.length>0){const k=new Set;for(const E of s.content.parts)E.type==="tool-invocation"&&E.toolInvocation.toolCallId&&k.add(E.toolInvocation.toolCallId);const _=S.filter(E=>!k.has(E.toolCallId)&&E.toolName!=="updateWorkingMemory");if(_.length>0){const E=new Map;for(const j of _){const N=j.step??0;E.has(N)||E.set(N,[]),E.get(N).push(j)}const T=Array.from(E.keys()).sort((j,N)=>j-N);for(const j of T){const N=E.get(j);r({role:"assistant",...d,type:"tool-call",content:[...N.map(({toolCallId:P,toolName:R,args:$})=>({type:"tool-call",toolCallId:P,toolName:R,args:$}))]});const I=N.filter(P=>P.state==="result"&&"result"in P);I.length>0&&r({role:"tool",...d,type:"tool-result",content:I.map(P=>{const{toolCallId:R,toolName:$,result:M}=P;return{type:"tool-result",toolCallId:R,toolName:$,result:M}})})}}}break}const p=s.content.toolInvocations;if(p==null||p.length===0){r({role:"assistant",...d,content:i||"",type:"text"});break}const m=p.reduce((g,y)=>Math.max(g,y.step??0),0);for(let g=0;g<=m;g++){const y=p.filter(w=>(w.step??0)===g&&w.toolName!=="updateWorkingMemory");if(y.length===0)continue;r({role:"assistant",...d,type:"tool-call",content:[...a&&i&&g===0?[{type:"text",text:i}]:[],...y.map(({toolCallId:w,toolName:S,args:k})=>({type:"tool-call",toolCallId:w,toolName:S,args:k}))]});const x=y.filter(w=>w.state==="result"&&"result"in w);x.length>0&&r({role:"tool",...d,type:"tool-result",content:x.map(w=>{const{toolCallId:S,toolName:k,result:_}=w;return{type:"tool-result",toolCallId:S,toolName:k,result:_}})})}i&&!a&&r({role:"assistant",...d,type:"text",content:i||""});break}}}return t}async function Lln(e,t={},r=3){let n=0,s=null;for(;n<r;)try{const a=await fetch(e,t);if(!a.ok){if(a.status>=400&&a.status<500)throw new Error(`Request failed with status: ${a.status} ${a.statusText}`);if(s=new Error(`Request failed with status: ${a.status} ${a.statusText}`),n++,n>=r)throw s;const i=Math.min(1e3*Math.pow(2,n),1e4);await new Promise(l=>setTimeout(l,i));continue}return a}catch(a){if(s=a instanceof Error?a:new Error(String(a)),s.message.includes("status: 4"))throw s;if(n++,n>=r)break;const i=Math.min(1e3*Math.pow(2,n),1e4);await new Promise(l=>setTimeout(l,i))}throw s||new Error("Request failed after multiple retry attempts")}var $ln=async({url:e,downloadRetries:t})=>{const r=e.toString();try{const n=await Lln(r,{method:"GET"},t);if(!n.ok)throw new tS({id:"DOWNLOAD_ASSETS_FAILED",text:"Failed to download asset",domain:"LLM",category:"USER"});return{data:new Uint8Array(await n.arrayBuffer()),mediaType:n.headers.get("content-type")??void 0}}catch(n){throw new tS({id:"DOWNLOAD_ASSETS_FAILED",text:"Failed to download asset",domain:"LLM",category:"USER"},n)}};async function Fln({messages:e,downloadConcurrency:t=10,downloadRetries:r=3,supportedUrls:n}){const s=(await Ke(async()=>{const{default:c}=await import("./index-yUiD89B4.js");return{default:c}},[],import.meta.url)).default,a=e.filter(c=>c.role==="user").map(c=>c.content).filter(c=>Array.isArray(c)).flat().filter(c=>c.type==="image"||c.type==="file").map(c=>{const u=c.mediaType??(c.type==="image"?"image/*":void 0);let d=c.type==="image"?c.image:c.data;if(typeof d=="string")try{d=new URL(d)}catch{}return{mediaType:u,data:d}}).filter(c=>c.data instanceof URL).map(c=>({url:c.data,isUrlSupportedByModel:c.mediaType!=null&&sln({url:c.data.toString(),mediaType:c.mediaType,supportedUrls:n??{}})})),l=(await s(a,async c=>c.isUrlSupportedByModel?null:{url:c.url.toString(),...await $ln({url:c.url,downloadRetries:r})},{concurrency:t})).filter(c=>c?.data!=null).map(({url:c,data:u,mediaType:d})=>[c,{data:u,mediaType:d}]);return Object.fromEntries(l)}function zln(e){return{...e,createdAt:e.createdAt.toISOString()}}function Bln(e){return{...e,createdAt:new Date(e.createdAt)}}function Uln(e){return e.map(zln)}function Vln(e){return e.map(Bln)}var qln=class{memoryMessages=new Set;newUserMessages=new Set;newResponseMessages=new Set;userContextMessages=new Set;memoryMessagesPersisted=new Set;newUserMessagesPersisted=new Set;newResponseMessagesPersisted=new Set;userContextMessagesPersisted=new Set;addToSource(e,t){switch(t){case"memory":this.memoryMessages.add(e),this.memoryMessagesPersisted.add(e);break;case"response":this.newResponseMessages.add(e),this.newResponseMessagesPersisted.add(e),this.newUserMessages.has(e)&&this.newUserMessages.delete(e);break;case"input":case"user":this.newUserMessages.add(e),this.newUserMessagesPersisted.add(e);break;case"context":this.userContextMessages.add(e),this.userContextMessagesPersisted.add(e);break;default:throw new Error(`Missing message source for message ${e}`)}}isMemoryMessage(e){return this.memoryMessages.has(e)}isUserMessage(e){return this.newUserMessages.has(e)}isResponseMessage(e){return this.newResponseMessages.has(e)}isContextMessage(e){return this.userContextMessages.has(e)}getMemoryMessages(){return this.memoryMessages}getUserMessages(){return this.newUserMessages}getResponseMessages(){return this.newResponseMessages}getContextMessages(){return this.userContextMessages}getMemoryMessagesPersisted(){return this.memoryMessagesPersisted}getUserMessagesPersisted(){return this.newUserMessagesPersisted}getResponseMessagesPersisted(){return this.newResponseMessagesPersisted}getContextMessagesPersisted(){return this.userContextMessagesPersisted}removeMessage(e){this.memoryMessages.delete(e),this.newUserMessages.delete(e),this.newResponseMessages.delete(e),this.userContextMessages.delete(e)}clearUserMessages(){this.newUserMessages.clear()}clearResponseMessages(){this.newResponseMessages.clear()}clearContextMessages(){this.userContextMessages.clear()}clearAll(){this.newUserMessages.clear(),this.newResponseMessages.clear(),this.userContextMessages.clear()}createSourceChecker(){const e={memory:new Set(Array.from(this.memoryMessages.values()).map(t=>t.id)),output:new Set(Array.from(this.newResponseMessages.values()).map(t=>t.id)),input:new Set(Array.from(this.newUserMessages.values()).map(t=>t.id)),context:new Set(Array.from(this.userContextMessages.values()).map(t=>t.id))};return{...e,getSource:t=>e.memory.has(t.id)?"memory":e.input.has(t.id)?"input":e.output.has(t.id)?"response":e.context.has(t.id)?"context":null}}isNewMessage(e){const t=typeof e=="string"?e:e.id;return typeof e!="string"&&(this.newUserMessages.has(e)||this.newResponseMessages.has(e))?!0:Array.from(this.newUserMessages).some(r=>r.id===t)||Array.from(this.newResponseMessages).some(r=>r.id===t)}serializeSourceTracking(){const e=t=>Array.from(t).map(r=>r.id);return{memoryMessages:e(this.memoryMessages),newUserMessages:e(this.newUserMessages),newResponseMessages:e(this.newResponseMessages),userContextMessages:e(this.userContextMessages),memoryMessagesPersisted:e(this.memoryMessagesPersisted),newUserMessagesPersisted:e(this.newUserMessagesPersisted),newResponseMessagesPersisted:e(this.newResponseMessagesPersisted),userContextMessagesPersisted:e(this.userContextMessagesPersisted)}}deserializeSourceTracking(e,t){const r=n=>new Set(n.map(s=>t.find(a=>a.id===s)).filter(Boolean));this.memoryMessages=r(e.memoryMessages),this.newUserMessages=r(e.newUserMessages),this.newResponseMessages=r(e.newResponseMessages),this.userContextMessages=r(e.userContextMessages),this.memoryMessagesPersisted=r(e.memoryMessagesPersisted),this.newUserMessagesPersisted=r(e.newUserMessagesPersisted),this.newResponseMessagesPersisted=r(e.newResponseMessagesPersisted),this.userContextMessagesPersisted=r(e.userContextMessagesPersisted)}serializeAll(e){return{messages:Uln(e.messages),systemMessages:e.systemMessages,taggedSystemMessages:e.taggedSystemMessages,memoryInfo:e.memoryInfo,_agentNetworkAppend:e.agentNetworkAppend,...this.serializeSourceTracking()}}deserializeAll(e){const t=Vln(e.messages);return this.deserializeSourceTracking({memoryMessages:e.memoryMessages,newUserMessages:e.newUserMessages,newResponseMessages:e.newResponseMessages,userContextMessages:e.userContextMessages,memoryMessagesPersisted:e.memoryMessagesPersisted,newUserMessagesPersisted:e.newUserMessagesPersisted,newResponseMessagesPersisted:e.newResponseMessagesPersisted,userContextMessagesPersisted:e.userContextMessagesPersisted},t),{messages:t,systemMessages:e.systemMessages,taggedSystemMessages:e.taggedSystemMessages,memoryInfo:e.memoryInfo,agentNetworkAppend:e._agentNetworkAppend}}},Uxt=class{messages=[];systemMessages=[];taggedSystemMessages={};memoryInfo=null;stateManager=new qln;get memoryMessages(){return this.stateManager.getMemoryMessages()}get newUserMessages(){return this.stateManager.getUserMessages()}get newResponseMessages(){return this.stateManager.getResponseMessages()}get userContextMessages(){return this.stateManager.getContextMessages()}get memoryMessagesPersisted(){return this.stateManager.getMemoryMessagesPersisted()}get newUserMessagesPersisted(){return this.stateManager.getUserMessagesPersisted()}get newResponseMessagesPersisted(){return this.stateManager.getResponseMessagesPersisted()}get userContextMessagesPersisted(){return this.stateManager.getContextMessagesPersisted()}generateMessageId;_agentNetworkAppend=!1;filterIncompleteToolCalls;logger;isRecording=!1;recordedEvents=[];constructor({threadId:e,resourceId:t,generateMessageId:r,logger:n,filterIncompleteToolCalls:s,_agentNetworkAppend:a}={}){e&&(this.memoryInfo={threadId:e,resourceId:t}),this.generateMessageId=r,this.logger=n,this.filterIncompleteToolCalls=s??!0,this._agentNetworkAppend=a||!1}startRecording(){this.isRecording=!0,this.recordedEvents=[]}hasRecordedEvents(){return this.recordedEvents.length>0}getRecordedEvents(){return[...this.recordedEvents]}stopRecording(){this.isRecording=!1;const e=this.getRecordedEvents();return this.recordedEvents=[],e}add(e,t){if(t==="user"&&(t="input"),!e)return this;const r=Array.isArray(e)?e:[e];this.isRecording&&this.recordedEvents.push({type:"add",source:t,count:r.length});for(const n of r)this.addOne(typeof n=="string"?{role:"user",content:n}:n,t);return this}serialize(){return this.stateManager.serializeAll({messages:this.messages,systemMessages:this.systemMessages,taggedSystemMessages:this.taggedSystemMessages,memoryInfo:this.memoryInfo,agentNetworkAppend:this._agentNetworkAppend})}serializeForSpan(){return{messages:this.all.aiV4.core().map(t=>({role:t.role,content:t.content})),systemMessages:[...this.systemMessages.map(t=>({role:t.role,content:t.content})),...Object.entries(this.taggedSystemMessages).flatMap(([t,r])=>r.map(n=>({role:n.role,content:n.content,tag:t})))]}}deserialize(e){const t=this.stateManager.deserializeAll(e);return this.messages=t.messages,this.systemMessages=t.systemMessages,this.taggedSystemMessages=t.taggedSystemMessages,this.memoryInfo=t.memoryInfo,this._agentNetworkAppend=t.agentNetworkAppend,this}makeMessageSourceChecker(){return this.stateManager.createSourceChecker()}getLatestUserContent(){const t=this.all.core().filter(r=>r.role==="user").at(-1)?.content;return t?xln(t):null}get get(){return{all:this.all,remembered:this.remembered,input:this.input,response:this.response}}get getPersisted(){return{remembered:this.rememberedPersisted,input:this.inputPersisted,taggedSystemMessages:this.taggedSystemMessages,response:this.responsePersisted}}get clear(){return{all:{db:()=>{const e=[...this.messages];return this.messages=[],this.stateManager.clearAll(),this.isRecording&&e.length>0&&this.recordedEvents.push({type:"clear",count:e.length}),e}},input:{db:()=>{const e=Array.from(this.stateManager.getUserMessages());return this.messages=this.messages.filter(t=>!this.stateManager.isUserMessage(t)),this.stateManager.clearUserMessages(),this.isRecording&&e.length>0&&this.recordedEvents.push({type:"clear",source:"input",count:e.length}),e}},response:{db:()=>{const e=Array.from(this.stateManager.getResponseMessages());return this.messages=this.messages.filter(t=>!this.stateManager.isResponseMessage(t)),this.stateManager.clearResponseMessages(),this.isRecording&&e.length>0&&this.recordedEvents.push({type:"clear",source:"response",count:e.length}),e}}}}removeByIds(e){const t=new Set(e),r=[];return this.messages=this.messages.filter(n=>t.has(n.id)?(r.push(n),this.stateManager.removeMessage(n),!1):!0),this.isRecording&&r.length>0&&this.recordedEvents.push({type:"removeByIds",ids:e,count:r.length}),r}all={db:()=>this.messages,v1:()=>DO(this.all.db()),aiV5:{model:()=>dm(this.all.aiV5.ui(),this.messages),ui:()=>this.all.db().map(Wc.toUIMessage),prompt:()=>{const e=p$e([...this.systemMessages,...Object.values(this.taggedSystemMessages).flat()],"system",this.createAdapterContext(),this.messages),t=dm(this.all.aiV5.ui(),this.messages,this.filterIncompleteToolCalls),r=[...e,...t];return OL(r,this.logger)},llmPrompt:async(e={downloadConcurrency:10,downloadRetries:3})=>{const t=dm(this.all.aiV5.ui(),this.messages,this.filterIncompleteToolCalls),r=new Map;for(const l of this.messages)if(!(l.content?.format!==2||!l.content.parts))for(const c of l.content.parts)c.type==="tool-invocation"&&c.toolInvocation?.state==="result"&&c.providerMetadata?.mastra&&typeof c.providerMetadata.mastra=="object"&&"modelOutput"in c.providerMetadata.mastra&&r.set(c.toolInvocation.toolCallId,c.providerMetadata.mastra.modelOutput);if(r.size>0){for(const l of t)if(!(l.role!=="tool"||!Array.isArray(l.content)))for(let c=0;c<l.content.length;c++){const u=l.content[c];u.type==="tool-result"&&r.has(u.toolCallId)&&(l.content[c]={...u,output:r.get(u.toolCallId)})}}const n=p$e([...this.systemMessages,...Object.values(this.taggedSystemMessages).flat()],"system",this.createAdapterContext(),this.messages),s=await Fln({messages:t,downloadConcurrency:e?.downloadConcurrency,downloadRetries:e?.downloadRetries,supportedUrls:e?.supportedUrls});let a=[...n,...t];return t.some(l=>(l.role==="user"||l.role==="assistant")&&typeof l.content!="string"&&l.content.some(c=>c.type==="image"||c.type==="file"))&&(a=a.map(l=>{if(l.role==="user")return typeof l.content=="string"?{role:"user",content:[{type:"text",text:l.content}],providerOptions:l.providerOptions}:{role:"user",content:l.content.map(u=>u.type==="image"||u.type==="file"?y$e(u,s):u).filter(u=>u.type!=="text"||u.text!==""),providerOptions:l.providerOptions};if(l.role==="assistant"&&typeof l.content!="string"){const c=l.content.map(u=>u.type==="file"?y$e(u,s):u);return{...l,content:c}}return l})),a=OL(a,this.logger),a.map(bln).filter(l=>l.role==="system"||typeof l.content=="string"||l.content.length>0)}},aiV6:{ui:()=>this.all.db().map(mm.toUIMessage)},prompt:()=>this.all.aiV4.prompt(),ui:()=>this.all.db().map(To.toUIMessage),core:()=>Wf(this.all.aiV4.ui()),aiV4:{ui:()=>this.all.db().map(To.toUIMessage),core:()=>Wf(this.all.aiV4.ui()),prompt:()=>{const e=this.all.aiV4.core(),t=[...this.systemMessages,...Object.values(this.taggedSystemMessages).flat(),...e];return OL(t,this.logger)},llmPrompt:()=>{const e=this.all.aiV4.core();let r=[...[...this.systemMessages,...Object.values(this.taggedSystemMessages).flat()],...e];return r=OL(r,this.logger),r.map(vln)}}};remembered={db:()=>this.messages.filter(e=>this.memoryMessages.has(e)),v1:()=>DO(this.remembered.db()),aiV5:{model:()=>dm(this.remembered.aiV5.ui(),this.messages),ui:()=>this.remembered.db().map(Wc.toUIMessage)},aiV6:{ui:()=>this.remembered.db().map(mm.toUIMessage)},ui:()=>this.remembered.db().map(To.toUIMessage),core:()=>Wf(this.all.aiV4.ui()),aiV4:{ui:()=>this.remembered.db().map(To.toUIMessage),core:()=>Wf(this.all.aiV4.ui())}};rememberedPersisted={db:()=>this.all.db().filter(e=>this.memoryMessagesPersisted.has(e)),v1:()=>DO(this.rememberedPersisted.db()),aiV5:{model:()=>dm(this.rememberedPersisted.aiV5.ui(),this.messages),ui:()=>this.rememberedPersisted.db().map(Wc.toUIMessage)},aiV6:{ui:()=>this.rememberedPersisted.db().map(mm.toUIMessage)},ui:()=>this.rememberedPersisted.db().map(To.toUIMessage),core:()=>Wf(this.rememberedPersisted.ui()),aiV4:{ui:()=>this.rememberedPersisted.db().map(To.toUIMessage),core:()=>Wf(this.rememberedPersisted.aiV4.ui())}};input={db:()=>this.messages.filter(e=>this.newUserMessages.has(e)),v1:()=>DO(this.input.db()),aiV5:{model:()=>dm(this.input.aiV5.ui(),this.messages),ui:()=>this.input.db().map(Wc.toUIMessage)},aiV6:{ui:()=>this.input.db().map(mm.toUIMessage)},ui:()=>this.input.db().map(To.toUIMessage),core:()=>Wf(this.input.ui()),aiV4:{ui:()=>this.input.db().map(To.toUIMessage),core:()=>Wf(this.input.aiV4.ui())}};inputPersisted={db:()=>this.messages.filter(e=>this.newUserMessagesPersisted.has(e)),v1:()=>DO(this.inputPersisted.db()),aiV5:{model:()=>dm(this.inputPersisted.aiV5.ui(),this.messages),ui:()=>this.inputPersisted.db().map(Wc.toUIMessage)},aiV6:{ui:()=>this.inputPersisted.db().map(mm.toUIMessage)},ui:()=>this.inputPersisted.db().map(To.toUIMessage),core:()=>Wf(this.inputPersisted.ui()),aiV4:{ui:()=>this.inputPersisted.db().map(To.toUIMessage),core:()=>Wf(this.inputPersisted.aiV4.ui())}};response={db:()=>this.messages.filter(e=>this.newResponseMessages.has(e)),v1:()=>DO(this.response.db()),aiV5:{ui:()=>this.response.db().map(Wc.toUIMessage),model:()=>dm(this.response.aiV5.ui(),this.messages).filter(e=>e.role==="tool"||e.role==="assistant"),modelContent:e=>typeof e=="number"?g$e.extractStepContent(this.response.aiV5.ui(),e,this.response.aiV5.stepContent):this.response.aiV5.model().map(this.response.aiV5.stepContent).flat(),stepContent:e=>g$e.convertToStepContent(e,this.messages,()=>this.response.aiV5.model().at(-1))},aiV6:{ui:()=>this.response.db().map(mm.toUIMessage)},aiV4:{ui:()=>this.response.db().map(To.toUIMessage),core:()=>Wf(this.response.aiV4.ui())}};responsePersisted={db:()=>this.messages.filter(e=>this.newResponseMessagesPersisted.has(e)),aiV5:{model:()=>dm(this.responsePersisted.aiV5.ui(),this.messages),ui:()=>this.responsePersisted.db().map(Wc.toUIMessage)},aiV6:{ui:()=>this.responsePersisted.db().map(mm.toUIMessage)},ui:()=>this.responsePersisted.db().map(To.toUIMessage),aiV4:{ui:()=>this.responsePersisted.db().map(To.toUIMessage),core:()=>Wf(this.responsePersisted.aiV4.ui())}};drainUnsavedMessages(){const e=this.messages.filter(t=>this.newUserMessages.has(t)||this.newResponseMessages.has(t));return this.newUserMessages.clear(),this.newResponseMessages.clear(),e}getEarliestUnsavedMessageTimestamp(){const e=this.messages.filter(t=>this.newUserMessages.has(t)||this.newResponseMessages.has(t));if(e.length!==0)return Math.min(...e.map(t=>new Date(t.createdAt).getTime()))}isNewMessage(e){return this.stateManager.isNewMessage(e)}updateToolInvocation(e){if(!e.toolInvocation?.toolCallId)return!1;const t=e.toolInvocation.toolCallId;for(let r=this.messages.length-1;r>=0;r--){const n=this.messages[r];if(!(n.role!=="assistant"||!n.content?.parts))for(let s=0;s<n.content.parts.length;s++){const a=n.content.parts[s];if(a?.type==="tool-invocation"&&a.toolInvocation?.toolCallId===t){const i=a,l=e;return n.content.parts[s]={...e,toolInvocation:{...e.toolInvocation,args:a.toolInvocation.args},...i.providerExecuted!==void 0&&l.providerExecuted===void 0?{providerExecuted:i.providerExecuted}:{},...i.providerMetadata!==void 0&&l.providerMetadata===void 0?{providerMetadata:i.providerMetadata}:{}},this.stateManager.isResponseMessage(n)||(this.stateManager.removeMessage(n),this.stateManager.addToSource(n,"response")),!0}}}return this.logger?.warn(`updateToolInvocation: no matching tool call found for toolCallId=${t}`),!1}stepStart(){const e=this.messages[this.messages.length-1];return!e||e.role!=="assistant"||!e.content?.parts||cy.isSealed(e)||e.content.parts[e.content.parts.length-1]?.type==="step-start"?!1:(e.content.parts.push(fye({type:"step-start"})),this.stateManager.isResponseMessage(e)||(this.stateManager.removeMessage(e),this.stateManager.addToSource(e,"response")),!0)}enrichLastStepStart(e){const t=this.messages[this.messages.length-1];if(!t||t.role!=="assistant"||!t.content?.parts||cy.isSealed(t))return!1;for(let r=t.content.parts.length-1;r>=0;r--){const n=t.content.parts[r];if(n?.type==="step-start")return n.model?!1:(n.model=e,this.stateManager.isResponseMessage(t)||(this.stateManager.removeMessage(t),this.stateManager.addToSource(t,"response")),!0)}return!1}getSystemMessages(e){return e?this.taggedSystemMessages[e]||[]:this.systemMessages}getAllSystemMessages(){return[...this.systemMessages,...Object.values(this.taggedSystemMessages).flat()]}clearSystemMessages(e){return e?delete this.taggedSystemMessages[e]:this.systemMessages=[],this}replaceAllSystemMessages(e){this.systemMessages=[],this.taggedSystemMessages={};for(const t of e)t.role==="system"&&this.systemMessages.push(t);return this}addSystem(e,t){if(!e)return this;for(const r of Array.isArray(e)?e:[e])this.addOneSystem(r,t);return this}addOneSystem(e,t){const r=jln(e);if(r.role!=="system")throw new Error(`Expected role "system" but saw ${r.role} for message ${JSON.stringify(r,null,2)}`);t&&!this.isDuplicateSystem(r,t)?(this.taggedSystemMessages[t]||=[],this.taggedSystemMessages[t].push(r),this.isRecording&&this.recordedEvents.push({type:"addSystem",tag:t,message:r})):!t&&!this.isDuplicateSystem(r)&&(this.systemMessages.push(r),this.isRecording&&this.recordedEvents.push({type:"addSystem",message:r}))}isDuplicateSystem(e,t){return t?this.taggedSystemMessages[t]?this.taggedSystemMessages[t].some(r=>Vi.fromAIV4CoreMessageContent(r.content)===Vi.fromAIV4CoreMessageContent(e.content)):!1:this.systemMessages.some(r=>Vi.fromAIV4CoreMessageContent(r.content)===Vi.fromAIV4CoreMessageContent(e.content))}getMessageById(e){return this.messages.find(t=>t.id===e)}shouldReplaceMessage(e){if(!this.messages.length)return{exists:!1};if(!("id"in e)||!e?.id)return{exists:!1};const t=this.getMessageById(e.id);return t?{exists:!0,shouldReplace:!mG(t,e),id:t.id}:{exists:!1}}addOne(e,t){if((!("content"in e)||!e.content&&typeof e.content!="string")&&(!("parts"in e)||!e.parts))throw new tS({id:"INVALID_MESSAGE_CONTENT",domain:"AGENT",category:"USER",text:`Message with role "${e.role}" must have either a 'content' property (string or array) or a 'parts' property (array) that is not empty, null, or undefined. Received message: ${JSON.stringify(e,null,2)}`,details:{role:e.role,messageSource:t,hasContent:"content"in e,hasParts:"parts"in e}});if(e.role==="system"){if(t==="memory")return null;if(da.isAIV4CoreMessage(e)||da.isAIV6CoreMessage(e)||da.isAIV5CoreMessage(e)||da.isMastraDBMessage(e))return this.addSystem(e);throw new tS({id:"INVALID_SYSTEM_MESSAGE_FORMAT",domain:"AGENT",category:"USER",text:"Invalid system message format. System messages must be CoreMessage format with 'role' and 'content' properties. The content should be a string or valid content array.",details:{messageSource:t,receivedMessage:JSON.stringify(e,null,2)}})}const r=wln(e,t,this.createAdapterContext()),{exists:n,shouldReplace:s,id:a}=this.shouldReplaceMessage(r),i=this.messages.findLastIndex(m=>cy.isSealed(m)),l=this.messages.at(-1),c=this.messages.length-1,u=i===-1||c>i;if(t==="memory"){for(const m of this.messages)if(mG(m,r))return}const d=n&&a?this.messages.find(m=>m.id===a):void 0,f=!!d&&cy.isSealed(d),h=l?this.memoryMessages.has(l):!1;if(u&&!f&&cy.shouldMerge(l,r,t,h,this._agentNetworkAppend)&&l)cy.merge(l,r),this.pushMessageToSource(l,t);else{let m=-1;s&&(m=this.messages.findIndex(y=>y.id===a));const g=m!==-1&&this.messages[m];if(s&&g){const y=i!==-1&&m<=i;if(cy.isSealed(g)){const x=g.content?.parts||[];let w=0;for(let _=x.length-1;_>=0;_--)if(x[_]?.metadata?.mastra?.sealedAt){w=_+1;break}w===0&&(w=x.length);const S=r.content.parts;let k;if(S.length<=w){if(mG(g,r))return this;k=S}else k=S.slice(w);k.length>0&&(r.id=this.generateMessageId?.({idType:"message",source:"memory"})??Xi(),r.content.parts=k,r.createdAt<=g.createdAt&&(r.createdAt=new Date(g.createdAt.getTime()+1)),this.messages.push(r))}else if(y)r.id=this.generateMessageId?.({idType:"message",source:"memory"})??Xi(),r.createdAt<=g.createdAt&&(r.createdAt=new Date(g.createdAt.getTime()+1)),this.messages.push(r);else{const x=this.memoryMessages.has(g);if(cy.shouldMerge(g,r,t,x,this._agentNetworkAppend))return cy.merge(g,r),this.pushMessageToSource(g,t),this.messages.sort((S,k)=>S.createdAt.getTime()-k.createdAt.getTime()),this;this.messages[m]=r}}else n||this.messages.push(r);this.pushMessageToSource(r,t)}return this.messages.sort((m,g)=>m.createdAt.getTime()-g.createdAt.getTime()),this}pushMessageToSource(e,t){this.stateManager.addToSource(e,t)}lastCreatedAt;generateCreatedAt(e,t){const r=t instanceof Date?t:typeof t=="string"||typeof t=="number"?new Date(t):void 0;if(r&&!this.lastCreatedAt)return this.lastCreatedAt=r.getTime(),r;if(r&&e==="memory")return r;const n=new Date,s=r?.getTime()||n.getTime(),a=this.messages.reduce((i,l)=>l.createdAt.getTime()>i?l.createdAt.getTime():i,this.lastCreatedAt||0);if(s<=a){const i=new Date(a+1);return this.lastCreatedAt=i.getTime(),i}return this.lastCreatedAt=s,n}newMessageId(e){return this.generateMessageId?this.generateMessageId({idType:"message",source:"agent",threadId:this.memoryInfo?.threadId,resourceId:this.memoryInfo?.resourceId,role:e}):Xi()}createAdapterContext(){return{memoryInfo:this.memoryInfo,newMessageId:()=>this.newMessageId(),generateCreatedAt:(e,t)=>this.generateCreatedAt(e,t),dbMessages:this.messages}}};function Hln(e){return e.metadata?.systemReminder||e.metadata?.dynamicAgentsMdReminder?!0:e.role!=="user"?!1:Array.isArray(e.parts)?e.parts.some(t=>t.type==="text"&&typeof t.text=="string"&&t.text.includes("<system-reminder")):typeof e.content=="string"&&e.content.includes("<system-reminder")}function D6(e){return e.filter(t=>!Hln(t))}function Qln(e,t={}){const r=new Uxt().add(e,"memory");return t.version==="v6"?D6(r.get.all.aiV6.ui()):D6(r.get.all.aiV5.ui())}function Vxt(e){return D6(Qln(e))}function Wln(e){return D6(new Uxt().add(e,"memory").get.all.aiV4.ui())}const b$e={modelSettings:{maxRetries:2,maxSteps:5,chatWithGenerateLegacy:!1,chatWithGenerate:!1}};function Gln({agentId:e,defaultSettings:t}){const[r,n]=b.useState(t),s=`mastra-agent-store-${e}`;return b.useEffect(()=>{try{const l=localStorage.getItem(s),c=l?JSON.parse(l):{},u={...c,modelSettings:{...b$e.modelSettings,...c?.modelSettings??{},...t?.modelSettings??{}}};n(u)}catch{}},[s,t]),{settings:r,setSettings:l=>{n(c=>({...c,...l})),localStorage.setItem(s,JSON.stringify({...l,agentId:e}))},resetAll:()=>{const l={modelSettings:{...b$e.modelSettings,...t?.modelSettings??{}}};n(l),localStorage.removeItem(s)}}}const qxt=b.createContext({});function hye({children:e,agentId:t,defaultSettings:r}){const{settings:n,setSettings:s,resetAll:a}=Gln({agentId:t,defaultSettings:r});return o.jsx(qxt.Provider,{value:{settings:n,setSettings:s,resetAll:a},children:e})}const pye=()=>b.useContext(qxt);function Zln(e){const t=[];for(const r of e.effectTasks)try{r()}catch(n){t.push(n)}if(t.length>0){if(t.length===1)throw t[0];for(const r of t)console.error(r);throw new AggregateError(t,"Errors during commit")}}function Yln(e){const t=[];for(const r of e.cells)if(r?.type==="effect"&&(r.deps=null,r.cleanup))try{r.cleanup?.()}catch(n){t.push(n)}finally{r.cleanup=void 0}if(t.length>0){if(t.length===1)throw t[0];for(const r of t)console.error(r);throw new AggregateError(t,"Errors during cleanup")}}let zN=null;function Xln(e,t){e.currentIndex=0;const r=zN;zN=e;try{if(t(),e.isFirstRender=!1,e.cells.length!==e.currentIndex)throw new Error(`Rendered ${e.currentIndex} hooks but expected ${e.cells.length}. Hooks must be called in the exact same order in every render.`)}finally{zN=r}}function KS(){if(!zN)throw new Error("No resource fiber available");return zN}function Kln(e){return null}function Jln(e,t){const r=e[Hxt];if(!r)throw new Error("ResourceElement.type is not a valid Resource");return r(t)}const Hxt=Symbol("fnSymbol");function fR(e,t,r=void 0,n=Kln()){return{type:e,root:t,markDirty:r,devStrictMode:n,cells:[],currentIndex:0,renderContext:void 0,isFirstRender:!0,isMounted:!1,isNeverMounted:!0}}function l_(e){if(!e.isMounted)throw new Error("Tried to unmount a fiber that is already unmounted");e.isMounted=!1,Yln(e)}function ix(e,t){const r={effectTasks:[],props:t,output:void 0};return Xln(e,()=>{e.renderContext=r;try{r.output=Jln(e.type,t)}finally{e.renderContext=void 0}}),r}function wE(e,t){e.isMounted=!0,e.isNeverMounted=!1,Zln(t)}const Qxt=e=>({version:0,committedVersion:0,dispatchUpdate:e,changelog:[],dirtyCells:[]}),L6=e=>{for(const t of e.dirtyCells)t.dirty=!1,t.queue.clear(),t.current=t.workInProgress;e.committedVersion=e.version,e.changelog.length=0,e.dirtyCells.length=0},BN=(e,t)=>{const r=e.version>t;if(e.version=t,r){for(const n of e.dirtyCells)n.dirty=!1,n.queue.clear(),n.workInProgress=n.current;if(e.dirtyCells.length=0,t===e.committedVersion)e.changelog.length=0;else{if(e.committedVersion>t)throw new Error("Version is less than committed version");for(;e.committedVersion+e.changelog.length>t;)e.changelog.pop();e.changelog.forEach(n=>n()),L6(e)}}},x$e=(e,t)=>{t.dirty||(t.dirty=!0,e.markDirty?.(),e.root.dirtyCells.push(t))},ecn=()=>null;function tcn(e){const t=b.useMemo(()=>Qxt(l=>n(l)),[]),[r,n]=b.useReducer((l,c)=>(BN(t,l),l+(c()?1:0)),0);BN(t,r);const s=ecn(),a=b.useMemo(()=>(e.key,fR(e.type,t,void 0,s)),[e.type,e.key,t,s]),i=ix(a,e.props);return b.useLayoutEffect(()=>()=>l_(a),[a]),b.useLayoutEffect(()=>{L6(t),wE(a,i)}),i.output}function Ys(e){const t=r=>({type:t,props:r});return t[Hxt]=e,t}function iv(e,t){return{...t,key:e}}const Wxt=(e,t)=>{const r=KS(),n=r.currentIndex++;if(!r.isFirstRender&&n>=r.cells.length)throw new Error("Rendered more hooks than during the previous render. Hooks must be called in the exact same order in every render.");let s=r.cells[n];if(s||(s=t(),r.cells[n]=s),s.type!==e)throw new Error("Hook order changed between renders");return s},rcn=e=>{KS().renderContext.effectTasks.push(e)},ncn=(e,t)=>{if(e.renderContext)throw new Error("Resource updated during render");if(e.isNeverMounted)throw new Error("Resource updated before mount");e.root.dispatchUpdate(()=>{const r=t();return r?(r(),e.root.changelog.push(r),!0):!1})};function Gxt(e,t,r,n){const s=Wxt("reducer",()=>{const l=KS(),c=n?n(r):r;return{type:"reducer",queue:new Set,dirty:!1,workInProgress:c,current:c,reducer:e,dispatch:u=>{const d={action:u,hasEagerState:!1,eagerState:void 0};ncn(l,()=>l.root.dirtyCells.length===0&&!d.hasEagerState&&(d.eagerState=e(s.workInProgress,u),d.hasEagerState=!0,Object.is(s.current,d.eagerState))?null:()=>{x$e(l,s),s.queue.add(d)})}}}),a=KS(),i=e===s.reducer;s.reducer=e;for(const l of s.queue)(!l.hasEagerState||!i)&&(l.eagerState=e(s.workInProgress,l.action),l.hasEagerState=!0),s.workInProgress=l.eagerState;if(s.queue.clear(),t){const l=t(s.workInProgress);Object.is(l,s.workInProgress)||(x$e(a,s),s.workInProgress=l)}return[s.workInProgress,s.dispatch]}function scn(e,t,r){return Gxt(e,void 0,t,r)}function acn(e,t,r,n){return Gxt(e,t,r,n)}const icn=(e,t)=>typeof t=="function"?t(e):t,ocn=e=>typeof e=="function"?e():e;function mg(e){return scn(icn,e,ocn)}const Zxt=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Object.is(e[r],t[r]))return!1;return!0},lcn=()=>({type:"effect",cleanup:void 0,deps:null});function Jl(e,t){const r=Wxt("effect",lcn);if(!(t&&r.deps&&Zxt(r.deps,t))){if(r.deps!==null&&!!t!=!!r.deps)throw new Error("tapEffect called with and without dependencies across re-renders");rcn(()=>{const n=[];try{r.cleanup?.()}catch(s){n.push(s)}finally{r.cleanup=void 0}try{const s=e();if(s!==void 0&&typeof s!="function")throw new Error(`An effect function must either return a cleanup function or nothing. Received: ${typeof s}`);r.cleanup=s}catch(s){n.push(s)}if(r.deps=t,n.length>0){if(n.length===1)throw n[0];for(const s of n)console.error(s);throw new AggregateError(n,"Errors during commit")}})}}function ox(e){const[t]=mg(()=>({current:e}));return t}function Xw(e,t){const[r]=mg(e);return r}const ccn=()=>{throw new Error("Memo reducer should not be called")},Ns=(e,t)=>{KS();const[r]=acn(ccn,n=>n&&Zxt(n.deps,t)?n:{value:e(),deps:t},null);return r.value},mye=(e,t)=>Ns(()=>e,t);function gye(e){const t=ox(e);return Jl(()=>{t.current=e}),t.current}function vf(e,t){const r=KS(),n=ox(0),s=Ns(()=>(e.key,fR(e.type,r.root,()=>{n.current++,r.markDirty?.()})),[e.type,e.key,r]),a=t?Ns(()=>ix(s,e.props),[s,...t,n.current]):ix(s,e.props);return Jl(()=>()=>l_(s),[s]),Jl(()=>{wE(s,a)},[s,a]),a.output}function yye(e,t){const r=ox(0),n=r.current,s=Xw(KS),a=Xw(()=>()=>{r.current++,s.markDirty?.()}),i=Xw(()=>new Map),l=t?mye(e,t):e,c=Ns(()=>{const u=l(),d=new Set,f=[];let h=0;for(let p=0;p<u.length;p++){const m=u[p],g=m.key;if(g===void 0)throw new Error(`tapResources did not provide a key for array at index ${p}`);if(d.has(g))throw new Error(`Duplicate key ${g} in tapResources`);d.add(g);let y=i.get(g);if(y)if(y.fiber.type!==m.type){const x=fR(m.type,s.root,a),w=ix(x,m.props);y.next=[x,w],f.push(w.output)}else y.next=ix(y.fiber,m.props),f.push(y.next.output);else{const x=fR(m.type,s.root,a),w=ix(x,m.props);y={fiber:x,next:w},h++,i.set(g,y),f.push(w.output)}}if(i.size>f.length-h)for(const p of i.keys())d.has(p)||(i.get(p).next="delete");return f},[l,n]);return Jl(()=>()=>{for(const u of i.keys()){const d=i.get(u).fiber;l_(d)}},[]),Jl(()=>{for(const[u,d]of i.entries())d.next==="delete"?(d.fiber.isMounted&&l_(d.fiber),i.delete(u)):Array.isArray(d.next)?(l_(d.fiber),d.fiber=d.next[0],wE(d.fiber,d.next[1])):wE(d.fiber,d.next)},[c]),c}const ucn=50;let Vm={schedulers:new Set([]),isScheduled:!1};class dcn{_task;_isDirty=!1;constructor(t){this._task=t}get isDirty(){return this._isDirty}markDirty(){this._isDirty=!0,Vm.schedulers.add(this),fcn()}runTask(){this._isDirty=!1,this._task()}}const fcn=()=>{Vm.isScheduled||(Vm.isScheduled=!0,hcn())},cle=()=>{try{const e=[];let t=0;for(const r of Vm.schedulers)if(Vm.schedulers.delete(r),!!r.isDirty){if(t++,t>ucn)throw new Error("Maximum update depth exceeded. This can happen when a resource repeatedly calls setState inside tapEffect.");try{r.runTask()}catch(n){e.push(n)}}if(e.length>0){if(e.length===1)throw e[0];for(const r of e)console.error(r);throw new AggregateError(e,"Errors occurred during flushSync")}}finally{Vm.schedulers.clear(),Vm.isScheduled=!1}},hcn=(()=>{if(typeof MessageChannel<"u"){const e=new MessageChannel;return e.port1.onmessage=cle,()=>e.port2.postMessage(null)}return()=>setTimeout(cle,0)})(),pcn=e=>{const t=Vm;Vm={schedulers:new Set([]),isScheduled:!0};try{const r=e();return cle(),r}finally{Vm=t}},mcn=e=>{const t=Xw(()=>new dcn(()=>u(null))),r=Xw(()=>[]),n=Ns(()=>(e.key,fR(e.type,Qxt(d=>{!t.isDirty&&!d()||(r.push(d),t.markDirty())}))),[e.type,e.key]);BN(n.root,n.root.committedVersion);const s=ix(n,e.props),a=ox(!1),i=ox(e.props),l=ox(s.output),c=Xw(()=>new Set),u=gye(d=>{if(d===null&&(BN(n.root,2),BN(n.root,1),r.forEach(f=>{f()}),d=ix(n,i.current)),t.isDirty)throw new Error("Scheduler is dirty, this should never happen");L6(n.root),r.length=0,a.current&&wE(n,d),!(t.isDirty||l.current===d.output)&&(l.current=d.output,c.forEach(f=>f()))});return Jl(()=>(a.current=!0,()=>{a.current=!1,l_(n)}),[n]),Jl(()=>{i.current=s.props,L6(n.root),wE(n,s),!(t.isDirty||l.current===s.output)&&(l.current=s.output,c.forEach(d=>d()))}),Ns(()=>({getValue:()=>l.current,subscribe:d=>(c.add(d),()=>c.delete(d))}),[])},UN=Symbol("tap.Context"),Yxt=e=>({[UN]:e}),Xxt=(e,t,r)=>{const n=e[UN];e[UN]=t;try{return r()}finally{e[UN]=n}},Kxt=e=>e[UN],ule=Symbol("assistant-ui.store.clientIndex"),gcn=e=>e[ule],Jxt=Yxt([]),vye=()=>Kxt(Jxt),ycn=(e,t)=>{const r=vye(),n=Ns(()=>[...r,e],[r,e]);return Xxt(Jxt,n,t)},vcn=new Set(["$$typeof","nodeType","then"]),C8=(e,t)=>{if(e===Symbol.toStringTag)return t;if(typeof e!="symbol"){if(e==="toJSON")return()=>t;if(!vcn.has(e))return!1}};class bye{getOwnPropertyDescriptor(t,r){const n=this.get(t,r);if(n!==void 0)return{value:n,writable:!1,enumerable:!0,configurable:!1}}set(){return!1}setPrototypeOf(){return!1}defineProperty(){return!1}deleteProperty(){return!1}preventExtensions(){return!1}}const e0t=e=>{const t=Ys(e);return r=>{const n=t(r);return r.key===void 0?n:iv(r.key,n)}},$6=Symbol("assistant-ui.store.getValue"),bcn=e=>{const t=e[$6];if(!t)throw new Error("Client scope contains a non-client resource. Ensure your Derived get() returns a client created with tapClientResource(), not a plain resource.");return t.getState?.()},w$e=new Map;function xcn(e){let t=w$e.get(e);return t||(t=function(...r){if(!this||typeof this!="object")throw new Error(`Method "${String(e)}" called without proper context. This may indicate the function was called incorrectly.`);const n=this[$6];if(!n)throw new Error(`Method "${String(e)}" called on invalid client proxy. Ensure you are calling this method on a valid client instance.`);const s=n[e];if(!s)throw new Error(`Method "${String(e)}" is not implemented.`);if(typeof s!="function")throw new Error(`"${String(e)}" is not a function.`);return s(...r)},w$e.set(e,t)),t}class wcn extends bye{outputRef;index;boundFns;cachedReceiver;constructor(t,r){super(),this.outputRef=t,this.index=r}get(t,r,n){if(r===$6)return this.outputRef.current;if(r===ule)return this.index;const s=C8(r,"ClientProxy");if(s!==!1)return s;const a=this.outputRef.current[r];if(typeof a=="function"){this.cachedReceiver!==n&&(this.boundFns=new Map,this.cachedReceiver=n);let i=this.boundFns.get(r);return i||(i=xcn(r).bind(n),this.boundFns.set(r,i)),i}return a}ownKeys(){return Object.keys(this.outputRef.current)}has(t,r){return r===$6||r===ule?!0:r in this.outputRef.current}}const t0t=e0t(e=>{const t=ox(null),r=vye().length,n=Ns(()=>new Proxy({},new wcn(t,r)),[r]),s=ycn(n,()=>vf(e));t.current||(t.current=s),Jl(()=>{t.current=s});const a=s.getState?.();return{methods:n,state:a,key:e.key}}),j8=e=>vf(t0t(e)),VN=Symbol("assistant-ui.store.proxiedAssistantState"),gG=e=>e==="on"||e==="subscribe"||typeof e=="symbol",r0t=e=>{class t extends bye{get(n,s){const a=C8(s,"AssistantState");if(a!==!1)return a;const i=s;if(!gG(i))return bcn(e[i]())}ownKeys(){return Object.keys(e).filter(n=>!gG(n))}has(n,s){return!gG(s)&&s in e}}return new Proxy({},new t)},Scn=e=>e[VN],S$e=()=>()=>{},n0t=e=>{const t=(()=>{throw new Error(e)});return t.source=null,t.query=null,t};class Ocn extends bye{get(t,r){if(r==="subscribe"||r==="on")return S$e;if(r===VN)return kcn;const n=C8(r,"DefaultAssistantClient");return n!==!1?n:n0t("You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.")}ownKeys(){return["subscribe","on",VN]}has(t,r){return r==="subscribe"||r==="on"||r===VN}}const T8=new Proxy({},new Ocn),kcn=r0t(T8),_cn=()=>new Proxy({},{get(e,t){const r=C8(t,"AssistantClient");return r!==!1?r:n0t(`The current scope does not have a "${String(t)}" property.`)}}),s0t=b.createContext(T8),Ecn=()=>b.useContext(s0t),EC=({value:e,children:t})=>o.jsx(s0t.Provider,{value:e,children:t}),Fy=Ys(e=>null),dle=Symbol("assistant-ui.transform-scopes");function a0t(e,t){const r=e;if(r[dle])throw new Error("transformScopes is already attached to this resource");r[dle]=t}function Ccn(e){return e[dle]}function jcn(e,t){const r={...e},n=new Set;let s=!0;for(;s;){s=!1;for(const l of Object.values(r)){if(l.type===Fy||n.has(l.type))continue;n.add(l.type);const c=Ccn(l.type);if(c){c(r,t),s=!0;break}}}const a={},i={};for(const[l,c]of Object.entries(r))c.type===Fy?i[l]=c:a[l]=c;return{rootClients:a,derivedClients:i}}const O$e=e=>Ns(()=>e,[...Object.entries(e).flat()]),Tcn=(e,t)=>{const{rootClients:r,derivedClients:n}=jcn(e,t);return{rootClients:O$e(r),derivedClients:O$e(n)}},i0t=e=>typeof e=="string"?{scope:e.split(".")[0],event:e}:{scope:e.scope,event:e.event},Ncn=Ys(()=>Xw(()=>{const e=new Map,t=new Set,r=new Set;return{on(n,s){const a=s;if(n==="*")return t.add(a),()=>t.delete(a);let i=e.get(n);return i||(i=new Set,e.set(n,i)),i.add(a),()=>{i.delete(a),i.size===0&&e.delete(n)}},emit(n,s,a){const i=e.get(n);!i&&t.size===0||queueMicrotask(()=>{const l=[];if(i)for(const c of i)try{c(s,a)}catch(u){l.push(u)}if(t.size>0){const c={event:n,payload:s};for(const u of t)try{u(c,a)}catch(d){l.push(d)}}if(l.length>0){if(l.length===1)throw l[0];for(const c of l)console.error(c);throw new AggregateError(l,"Errors occurred during event emission")}})},subscribe(n){return r.add(n),()=>r.delete(n)},notifySubscribers(){for(const n of r)try{n()}catch(s){console.error("NotificationManager: subscriber callback error",s)}}}})),o0t=Yxt(null),Acn=(e,t)=>Xxt(o0t,e,t),l0t=()=>{const e=Kxt(o0t);if(!e)throw new Error("AssistantTapContext is not available");return e},c0t=()=>l0t().clientRef,xye=()=>{const{emit:e}=l0t(),t=vye();return gye((r,n)=>{e(r,n,t)})},u0t=e=>Ns(()=>e,e),Icn=Ys(({element:e,emit:t,clientRef:r})=>{const{methods:n,state:s}=Acn({clientRef:r,emit:t},()=>j8(e));return Ns(()=>({state:s,methods:n}),[n,s])}),Rcn=Ys(({element:e,notifications:t,clientRef:r,name:n})=>{const s=mcn(Icn({element:e,emit:t.emit,clientRef:r}));return Jl(()=>s.subscribe(t.notifySubscribers),[s,t]),Ns(()=>{const a=()=>s.getValue().methods;return Object.defineProperties(a,{source:{value:"root",writable:!1},query:{value:{},writable:!1},name:{value:n,configurable:!0}}),a},[s,n])}),Pcn=Ys(()=>Ns(()=>({clients:[],subscribe:void 0,on:void 0}),[])),Mcn=Ys(({clients:e,clientRef:t})=>{const r=vf(Ncn());Jl(()=>t.parent.subscribe(r.notifySubscribers),[t,r]);const n=u0t(yye(()=>Object.keys(e).map(s=>iv(s,Rcn({element:e[s],notifications:r,clientRef:t,name:s}))),[e,r,t]));return Ns(()=>({clients:n,subscribe:r.subscribe,on:function(s,a){if(!this)throw new Error("const { on } = useAui() is not supported. Use aui.on() instead.");const{scope:i,event:l}=i0t(s);if(i!=="*"&&this[i].source===null)throw new Error(`Scope "${i}" is not available. Use { scope: "*", event: "${l}" } to listen globally.`);const c=r.on(l,(d,f)=>{if(i==="*"){a(d);return}const h=this[i](),p=gcn(h);h===f[p]&&a(d)});if(i!=="*"&&t.parent[i].source===null)return c;const u=t.parent.on(s,a);return()=>{c(),u()}}}),[n,r,t])}),k$e=(e,t,r)=>{if("source"in e&&"query"in e)return e;if(r.dep===e)return r.meta;const n=e.getMeta(t.current);return r.meta=n,r.dep=e,n},Dcn=Ys(({element:e,clientRef:t,name:r})=>{const n=gye(()=>e.props);return Ns(()=>{const s=()=>n().get(t.current),a={};return Object.defineProperties(s,{source:{get:()=>k$e(n(),t,a).source},query:{get:()=>k$e(n(),t,a).query},name:{value:r,configurable:!0}}),s},[t,r])}),Lcn=Ys(({clients:e,clientRef:t})=>u0t(yye(()=>Object.keys(e).map(r=>iv(r,Dcn({element:e[r],clientRef:t,name:r}))),[e,t]))),$cn=Ys(({parent:e,clients:t})=>{const{rootClients:r,derivedClients:n}=Tcn(t,e),s=ox({parent:e,current:null}).current;Jl(()=>{s.current=l});const a=vf(Object.keys(r).length>0?Mcn({clients:r,clientRef:s}):Pcn()),i=vf(Lcn({clients:n,clientRef:s})),l=Ns(()=>{const c=e===T8?_cn():e,u=Object.create(c);Object.assign(u,{subscribe:a.subscribe??e.subscribe,on:a.on??e.on,[VN]:r0t(u)});for(const d of a.clients)u[d.name]=d;for(const d of i)u[d.name]=d;return u},[e,a,i]);return s.current===null&&(s.current=l),l});function ti(e,{parent:t}={parent:Ecn()}){if(e)return tcn($cn({parent:t??T8,clients:e}));if(t===null)throw new Error("received null parent, this usage is not allowed");return t}const an=e=>{const t=ti(),r=Scn(t),n=b.useSyncExternalStore(t.subscribe,()=>e(r),()=>e(r));if(n===r)throw new Error("You tried to return the entire AssistantState. This is not supported due to technical limitations.");return b.useDebugValue(n),n},Fcn=je.createContext(!0);function _$e(){throw new Error("A function wrapped in useEffectEvent can't be called during rendering.")}const zcn="use"in je?()=>{try{return je.use(Fcn)}catch{return!1}}:()=>!1;function Bcn(e){const t=je.useRef(_$e);return je.useInsertionEffect(()=>{t.current=e},[e]),(...r)=>{zcn()&&_$e();const n=t.current;return n(...r)}}const yG=(e,t)=>{const r=ti(),n=Bcn(t),{scope:s,event:a}=i0t(e);b.useEffect(()=>r.on({scope:s,event:a},n),[r,s,a,n])},Ucn=e=>{const t=ti(),r=b.useRef(void 0);return an(()=>(r.current===void 0&&(r.current=e(t)),r.current)),()=>(r.current=void 0,e(t))},Vcn=Object.freeze({});function wye({getItemState:e,children:t}){const r=Ucn(e);return qcn(t(r))}const qcn=e=>{const t=typeof e=="object"&&e!=null&&"type"in e?e:null,r=t?.type,n=t?.key,s=typeof t?.props=="object"&&t.props!=null&&Object.entries(t.props).length===0?Vcn:t?.props;return b.useMemo(()=>t,[r,n,s])??e},Hcn=e0t(e=>{if(e.key===void 0)throw new Error("tapClientResource: Element has no key");return vf(t0t(e))});function SE(e,t){const r=yye(()=>e().map(i=>Hcn(i)),t),n=Ns(()=>Object.keys(r),[r]),s=Ns(()=>r.reduce((i,l,c)=>(i[l.key]=c,i),{}),[r]);return{state:Ns(()=>r.map(i=>i.state),[r]),get:i=>{if("index"in i){if(i.index<0||i.index>=n.length)throw new Error(`tapClientLookup: Index ${i.index} out of bounds (length: ${n.length})`);return r[i.index].methods}const l=s[i.key];if(l===void 0)throw new Error(`tapClientLookup: Key "${i.key}" not found`);return r[l].methods}}}var J0={exports:{}},E$e;function Qcn(){if(E$e)return J0.exports;E$e=1;const e=typeof Buffer<"u",t=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,r=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function n(l,c,u){u==null&&c!==null&&typeof c=="object"&&(u=c,c=void 0),e&&Buffer.isBuffer(l)&&(l=l.toString()),l&&l.charCodeAt(0)===65279&&(l=l.slice(1));const d=JSON.parse(l,c);if(d===null||typeof d!="object")return d;const f=u&&u.protoAction||"error",h=u&&u.constructorAction||"error";if(f==="ignore"&&h==="ignore")return d;if(f!=="ignore"&&h!=="ignore"){if(t.test(l)===!1&&r.test(l)===!1)return d}else if(f!=="ignore"&&h==="ignore"){if(t.test(l)===!1)return d}else if(r.test(l)===!1)return d;return s(d,{protoAction:f,constructorAction:h,safe:u&&u.safe})}function s(l,{protoAction:c="error",constructorAction:u="error",safe:d}={}){let f=[l];for(;f.length;){const h=f;f=[];for(const p of h){if(c!=="ignore"&&Object.prototype.hasOwnProperty.call(p,"__proto__")){if(d===!0)return null;if(c==="error")throw new SyntaxError("Object contains forbidden prototype property");delete p.__proto__}if(u!=="ignore"&&Object.prototype.hasOwnProperty.call(p,"constructor")&&p.constructor!==null&&typeof p.constructor=="object"&&Object.prototype.hasOwnProperty.call(p.constructor,"prototype")){if(d===!0)return null;if(u==="error")throw new SyntaxError("Object contains forbidden prototype property");delete p.constructor}for(const m in p){const g=p[m];g&&typeof g=="object"&&f.push(g)}}}return l}function a(l,c,u){const{stackTraceLimit:d}=Error;Error.stackTraceLimit=0;try{return n(l,c,u)}finally{Error.stackTraceLimit=d}}function i(l,c){const{stackTraceLimit:u}=Error;Error.stackTraceLimit=0;try{return n(l,c,{safe:!0})}catch{return}finally{Error.stackTraceLimit=u}}return J0.exports=a,J0.exports.default=a,J0.exports.parse=a,J0.exports.safeParse=i,J0.exports.scan=s,J0.exports}var Wcn=Qcn();const C$e=Uo(Wcn);function Gcn(e){const t=["ROOT"];let r=-1,n=null;const s=[];let a;function i(){a!==void 0&&(s.push(JSON.parse(`"${a}"`)),a=void 0)}function l(f,h,p){switch(f){case'"':{r=h,t.pop(),t.push(p),t.push("INSIDE_STRING"),i();break}case"f":case"t":case"n":{r=h,n=h,t.pop(),t.push(p),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(p),t.push("INSIDE_NUMBER"),i();break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{r=h,t.pop(),t.push(p),t.push("INSIDE_NUMBER"),i();break}case"{":{r=h,t.pop(),t.push(p),t.push("INSIDE_OBJECT_START"),i();break}case"[":{r=h,t.pop(),t.push(p),t.push("INSIDE_ARRAY_START"),i();break}}}function c(f,h){switch(f){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{r=h,t.pop(),a=s.pop();break}}}function u(f,h){switch(f){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA"),a=(Number(a)+1).toString();break}case"]":{r=h,t.pop(),a=s.pop();break}}}for(let f=0;f<e.length;f++){const h=e[f];switch(t[t.length-1]){case"ROOT":l(h,f,"FINISH");break;case"INSIDE_OBJECT_START":{switch(h){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY"),a="";break}case"}":{r=f,t.pop(),a=s.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{h==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"),a="");break}case"INSIDE_OBJECT_KEY":{switch(h){case'"':{t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break}case"\\":{t.push("INSIDE_STRING_ESCAPE"),a+=h;break}default:{a+=h;break}}break}case"INSIDE_OBJECT_AFTER_KEY":{h===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{l(h,f,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{c(h,f);break}case"INSIDE_STRING":{switch(h){case'"':{t.pop(),r=f,a=s.pop();break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:r=f}break}case"INSIDE_ARRAY_START":{h==="]"?(r=f,t.pop(),a=s.pop()):(r=f,a="0",l(h,f,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(h){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA"),a=(Number(a)+1).toString();break}case"]":{r=f,t.pop(),a=s.pop();break}default:{r=f;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{l(h,f,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),t[t.length-1]==="INSIDE_STRING"?r=f:t[t.length-1]==="INSIDE_OBJECT_KEY"&&(a+=h);break}case"INSIDE_NUMBER":{switch(h){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{r=f;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),a=s.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,f),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&c(h,f);break}case"}":{t.pop(),a=s.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&c(h,f);break}case"]":{t.pop(),a=s.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,f);break}default:{t.pop(),a=s.pop();break}}break}case"INSIDE_LITERAL":{const m=e.substring(n,f+1);!"false".startsWith(m)&&!"true".startsWith(m)&&!"null".startsWith(m)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?c(h,f):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,f)):r=f;break}}}let d=e.slice(0,r+1);for(let f=t.length-1;f>=0;f--)switch(t[f]){case"INSIDE_STRING":{d+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{d+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{d+="]";break}case"INSIDE_LITERAL":{const p=e.substring(n,e.length);"true".startsWith(p)?d+="true".slice(p.length):"false".startsWith(p)?d+="false".slice(p.length):"null".startsWith(p)&&(d+="null".slice(p.length))}}return[d,s]}const vG=Symbol("aui.parse-partial-json-object.meta"),Zcn=e=>{if(e.length===0)return{[vG]:{state:"partial",partialPath:[]}};try{const t=C$e.parse(e);if(typeof t!="object"||t===null)throw new Error("argsText is expected to be an object");return t[vG]={state:"complete",partialPath:[]},t}catch{try{const[t,r]=Gcn(e),n=C$e.parse(t);if(typeof n!="object"||n===null)throw new Error("argsText is expected to be an object");return n[vG]={state:"partial",partialPath:r},n}catch{return}}};let Ycn=(e,t=21)=>(r=t)=>{let n="",s=r|0;for(;s--;)n+=e[Math.random()*e.length|0];return n};const Xcn=Ys(e=>({getState:()=>e})),Kcn=Ys(e=>{const[t]=mg(()=>({suggestions:(e??[]).map(s=>typeof s=="string"?{title:s,label:"",prompt:s}:{title:s.title,label:s.label,prompt:s.prompt})})),r=SE(()=>t.suggestions.map((n,s)=>iv(s,Xcn(n))),[t.suggestions]);return{getState:()=>t,suggestion:({index:n})=>r.get({index:n})}}),Jcn=Kcn,eun=Object.freeze({type:"complete"}),tun=Ys(({parts:e,getMessagePart:t})=>{const[r,n]=mg(!0),s=Ns(()=>e[e.length-1]?.status??eun,[e]),a=Ns(()=>({parts:e,collapsed:r,status:s}),[e,r,s]);return{getState:()=>a,setCollapsed:n,part:t}}),run=e=>Array.from(e).map(r=>r.getModelContext()).sort((r,n)=>(n.priority??0)-(r.priority??0)).reduce((r,n)=>{if(n.system&&(r.system?r.system+=`
|
|
@@ -554,7 +554,7 @@ Token usage: ${r} input + ${n} output = ${s} total`:`The model stopped generatin
|
|
|
554
554
|
"groundTruth": "Expected result (optional)",
|
|
555
555
|
"metadata": { "key": "value" } // optional
|
|
556
556
|
}
|
|
557
|
-
]`})]})]})}function dTn({errors:e,maxErrors:t=5}){if(e.length===0)return null;const r=e.slice(0,t),n=e.length-t;return o.jsxs("div",{className:"bg-accent2/10 border border-accent2/30 rounded-md p-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-accent2 mb-2",children:[o.jsx(Ce,{children:o.jsx(kh,{className:"w-4 h-4"})}),o.jsxs("span",{className:"font-medium text-sm",children:[e.length," validation error",e.length!==1?"s":""]})]}),o.jsx("ul",{className:"text-sm text-accent2/80 space-y-1",children:r.map((s,a)=>o.jsxs("li",{className:"flex gap-2",children:[o.jsx("span",{className:"shrink-0",children:"•"}),o.jsx("span",{children:s.message})]},a))}),n>0&&o.jsxs("div",{className:"text-xs text-accent2/60 mt-2",children:["+",n," more error",n!==1?"s":""]})]})}function fTn({datasetId:e,open:t,onOpenChange:r,onSuccess:n}){const[s,a]=b.useState("upload"),[i,l]=b.useState(null),[c,u]=b.useState({current:0,total:0}),[d,f]=b.useState(null),[h,p]=b.useState(!1),{parseFile:m,isParsing:g,error:y}=yjn(),{batchInsertItems:x}=ri(),w=b.useCallback(async I=>{try{const P=await m(I);l(P),a("preview")}catch{}},[m]),S=b.useCallback(async()=>{if(!i||i.items.length===0)return;a("importing"),p(!0);const{items:I}=i;u({current:0,total:I.length});try{await x.mutateAsync({datasetId:e,items:I.map(P=>({input:P.input,groundTruth:P.groundTruth,metadata:P.metadata}))}),f({success:I.length,errors:0})}catch{f({success:0,errors:I.length})}u({current:I.length,total:I.length}),p(!1),a("complete")},[i,x,e]),k=b.useCallback(()=>{r(!1),n?.(),d&&d.success>0&&ze.success(`Imported ${d.success} item${d.success!==1?"s":""}`),setTimeout(()=>{a("upload"),l(null),u({current:0,total:0}),f(null)},150)},[r,n,d]),_=b.useCallback(()=>{h||(r(!1),setTimeout(()=>{a("upload"),l(null),u({current:0,total:0}),f(null)},150))},[h,r]),E=i&&i.items.length>0&&i.errors.length===0,T=()=>{switch(s){case"upload":return o.jsx(uTn,{onFileSelect:w,isParsing:g,error:y?.message});case"preview":return i?o.jsx("div",{className:"flex flex-col gap-4",children:i.errors.length>0?o.jsxs(o.Fragment,{children:[o.jsx(dTn,{errors:i.errors}),o.jsx("div",{className:"text-sm text-neutral4",children:"Please fix the errors in your JSON file and try again."})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"text-sm text-neutral4",children:["Found ",i.items.length," valid item",i.items.length!==1?"s":""," to import."]}),o.jsx(cTn,{items:i.items,maxRows:5})]})}):null;case"importing":return o.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[o.jsx(Mt,{size:"lg"}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-lg font-medium text-neutral1",children:"Importing items..."}),o.jsxs("div",{className:"text-sm text-neutral4 mt-1",children:[c.current," of ",c.total]})]})]});case"complete":return o.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[o.jsx("div",{className:"text-4xl",children:d&&d.errors===0?"✓":"⚠"}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-lg font-medium text-neutral1",children:"Import Complete"}),o.jsxs("div",{className:"text-sm text-neutral4 mt-1",children:[d?.success??0," item",d?.success!==1?"s":""," imported",d&&d.errors>0&&o.jsxs("span",{className:"text-accent2",children:[" ","(",d.errors," error",d.errors!==1?"s":"",")"]})]})]})]})}},j=()=>{switch(s){case"upload":return o.jsx(pe,{onClick:_,children:"Cancel"});case"preview":return o.jsxs(o.Fragment,{children:[o.jsx(pe,{onClick:()=>a("upload"),children:"Back"}),o.jsxs(pe,{variant:"primary",onClick:S,disabled:!E,children:["Import ",i?.items.length??0," Item",i?.items.length!==1?"s":""]})]});case"importing":return null;case"complete":return o.jsx(pe,{variant:"primary",onClick:k,children:"Done"})}},N={upload:"Import JSON",preview:"Preview Data",importing:"Importing",complete:"Import Complete"};return o.jsx(kn,{open:t,onOpenChange:_,children:o.jsxs(xn,{className:"max-w-2xl max-h-[90vh]",children:[o.jsxs(_n,{children:[o.jsx(wn,{children:N[s]}),o.jsx(Js,{children:"Import dataset items from a JSON file."})]}),o.jsx(qn,{className:"min-h-[200px] max-h-[50vh] overflow-y-auto",children:T()}),o.jsx(hf,{className:"px-6 pt-4 flex justify-end gap-2",children:j()})]})})}function hTn({dataset:e,isLoading:t=!1,onEditClick:r,onDuplicateClick:n,onDeleteClick:s,experimentTriggerSlot:a,disableExperimentTrigger:i=!1,onExperimentClick:l,className:c}){return o.jsxs(Ir,{className:c,children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{isLoading:t,children:[o.jsx(ja,{})," ",e?.name]}),o.jsx(Ir.Description,{isLoading:t,children:e?.description}),o.jsxs(Ir.Description,{isLoading:t,children:[o.jsxs(fs,{children:[o.jsx(g_,{})," Created at ",e?.createdAt?ur(new Date(e.createdAt),"MMM d, yyyy"):""]}),o.jsxs(fs,{children:[o.jsx(Qx,{})," Latest version v",e?.version??""]})]})]}),o.jsx(Ir.Column,{children:o.jsxs(ps,{children:[a?i?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{className:"cursor-not-allowed",children:o.jsx("div",{className:"pointer-events-none opacity-50",inert:!0,"aria-disabled":"true",children:a})})}),o.jsx(Wr,{children:"Add items to the dataset before running an experiment"})]}):a:l?i?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{className:"cursor-not-allowed",children:o.jsxs(pe,{disabled:!0,tabIndex:-1,children:[o.jsx(gx,{}),"Run Experiment"]})})}),o.jsx(Wr,{children:"Add items to the dataset before running an experiment"})]}):o.jsxs(pe,{onClick:l,children:[o.jsx(gx,{}),"Run Experiment"]}):null,o.jsxs(vt,{children:[o.jsx(vt.Trigger,{asChild:!0,children:o.jsx(pe,{size:"default","aria-label":"Dataset actions menu",children:o.jsx(fVe,{})})}),o.jsxs(vt.Content,{align:"end",className:"w-48",children:[o.jsxs(vt.Item,{onSelect:r,children:[o.jsx(lv,{})," Edit Dataset"]}),o.jsxs(vt.Item,{onSelect:n,children:[o.jsx(ru,{})," Duplicate Dataset"]}),o.jsxs(vt.Item,{onSelect:s,className:"text-red-500 focus:text-red-400",children:[o.jsx(nd,{})," Delete Dataset"]})]})]})]})})]})}const E1t=e=>{const t=Ge(),{data:r}=vR(e),n=r?.experiments;return kt({queryKey:["dataset-review-items",e,n?.map(s=>s.id)],queryFn:async()=>!n||n.length===0?[]:(await Promise.all(n.map(async a=>{if(!a.datasetId)return[];try{const{results:i}=await t.listDatasetExperimentResults(a.datasetId,a.id);return i.filter(l=>l.status==="needs-review").map(l=>({id:l.id,input:l.input,output:l.output,error:l.error,itemId:l.itemId,experimentId:l.experimentId,datasetId:a.datasetId??void 0,traceId:l.traceId??void 0,scores:l.scores?Object.fromEntries(l.scores.map(c=>[c.scorerId,c.score??0])):{},tags:l.tags??[],comment:""}))}catch{return[]}}))).flat(),enabled:!!e&&!!n&&n.length>0,refetchOnWindowFocus:!1})},pTn=e=>{const t=Ge(),{data:r}=vR(e),n=r?.experiments;return kt({queryKey:["dataset-completed-items",e,n?.map(s=>s.id)],queryFn:async()=>!n||n.length===0?[]:(await Promise.all(n.map(async a=>{if(!a.datasetId)return[];try{const{results:i}=await t.listDatasetExperimentResults(a.datasetId,a.id);return i.filter(l=>l.status==="complete").map(l=>({id:l.id,input:l.input,output:l.output,error:l.error,itemId:l.itemId,experimentId:l.experimentId,datasetId:a.datasetId??void 0,traceId:l.traceId??void 0,scores:l.scores?Object.fromEntries(l.scores.map(c=>[c.scorerId,c.score??0])):{},tags:l.tags??[],comment:""}))}catch{return[]}}))).flat(),enabled:!!e&&!!n&&n.length>0,refetchOnWindowFocus:!1})};function mTn(e,t){if(typeof e=="string")return e.length>t?e.slice(0,t)+"...":e;try{const r=JSON.stringify(e);return r.length>t?r.slice(0,t)+"...":r}catch{return String(e)}}const gTn=Z("bg-surface5 backdrop-blur-xl z-50 min-w-32 overflow-auto rounded-lg p-2 shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95");function NBe({className:e,children:t,...r}){return o.jsx(rP,{children:o.jsx(lz,{className:Z(gTn,e),...r,children:t})})}function yTn({datasetId:e}){const t=Ge(),{data:r}=Ig(e),{data:n,isLoading:s}=E1t(e),{data:a,isLoading:i}=pTn(e),{updateExperimentResult:l}=ri(),[c,u]=b.useState(null),[d,f]=b.useState(null),[h,p]=b.useState(new Set),[m,g]=b.useState(!1),[y,x]=b.useState(!1),[w,S]=b.useState(!1),[k,_]=b.useState(""),[E,T]=b.useState(""),[j,N]=b.useState(""),[I,P]=b.useState([]),[R,$]=b.useState(!1),[M,z]=b.useState(null),U=M??n??[];b.useEffect(()=>{n&&M===null&&z(n)},[n]);const B=b.useMemo(()=>{const ge=new Set;if(r?.tags)for(const Ee of r.tags)ge.add(Ee);for(const Ee of U)for(const Fe of Ee.tags)ge.add(Fe);return[...ge].sort()},[r,U]),H=b.useCallback(ge=>{!r||!e||(r.tags??[]).includes(ge)},[r,e]),W=b.useMemo(()=>d?d==="__untagged__"?U.filter(ge=>ge.tags.length===0):U.filter(ge=>ge.tags.includes(d)):U,[U,d]),L=b.useMemo(()=>{const ge=new Map;for(const Ee of U)for(const Fe of Ee.tags)ge.set(Fe,(ge.get(Fe)??0)+1);return[...ge.entries()].sort((Ee,Fe)=>Fe[1]-Ee[1])},[U]),Y=b.useMemo(()=>U.filter(ge=>ge.tags.length===0).length,[U]),q=b.useMemo(()=>{let ge=0;return d&&ge++,m&&ge++,ge},[d,m]),D=b.useCallback((ge,Ee)=>{z(ct=>(ct??[]).map(wt=>wt.id===ge?{...wt,tags:Ee}:wt));const Fe=U.find(ct=>ct.id===ge);Fe?.experimentId&&Fe?.datasetId&&l.mutate({datasetId:Fe.datasetId,experimentId:Fe.experimentId,resultId:Fe.id,tags:Ee})},[U,l]),Q=b.useCallback((ge,Ee)=>{const Fe=U.find(ct=>ct.id===ge);Fe?.traceId&&Ee!==void 0&&t.createFeedback({feedback:{traceId:Fe.traceId,source:"studio",feedbackSource:"studio",feedbackType:"rating",value:Ee==="positive"?1:-1,experimentId:Fe.experimentId??void 0,sourceId:Fe.id}}).catch(()=>{}),z(ct=>(ct??[]).map(wt=>wt.id===ge?{...wt,rating:Ee}:wt))},[U,t]),G=b.useCallback((ge,Ee)=>{const Fe=U.find(ct=>ct.id===ge);Fe?.traceId&&t.createFeedback({feedback:{traceId:Fe.traceId,source:"studio",feedbackSource:"studio",feedbackType:"comment",value:Ee,comment:Ee,experimentId:Fe.experimentId??void 0,sourceId:Fe.id}}).catch(()=>{}),z(ct=>(ct??[]).map(wt=>wt.id===ge?{...wt,comment:Ee}:wt))},[U,t]),J=b.useCallback(ge=>{const Ee=U.find(Fe=>Fe.id===ge);z(Fe=>(Fe??[]).filter(ct=>ct.id!==ge)),p(Fe=>{const ct=new Set(Fe);return ct.delete(ge),ct}),c===ge&&u(null),Ee?.experimentId&&Ee?.datasetId&&l.mutate({datasetId:Ee.datasetId,experimentId:Ee.experimentId,resultId:Ee.id,status:null})},[U,l,c]),ae=b.useCallback(ge=>{const Ee=U.find(Fe=>Fe.id===ge);z(Fe=>(Fe??[]).filter(ct=>ct.id!==ge)),p(Fe=>{const ct=new Set(Fe);return ct.delete(ge),ct}),c===ge&&u(null),Ee?.experimentId&&Ee?.datasetId&&l.mutate({datasetId:Ee.datasetId,experimentId:Ee.experimentId,resultId:Ee.id,status:"complete"})},[U,l,c]),re=b.useMemo(()=>{const ge=m?a??[]:W;return!m||!d?ge:d==="__untagged__"?ge.filter(Ee=>Ee.tags.length===0):ge.filter(Ee=>Ee.tags.includes(d))},[m,a,W,d]),se=m?i:!1,oe=b.useMemo(()=>new Set(re.map(ge=>ge.id)),[re]),he=b.useMemo(()=>[...h].filter(ge=>oe.has(ge)).length,[h,oe]),X=re.length>0&&he===re.length,te=he>0&&!X,le=b.useCallback(ge=>{p(Ee=>{const Fe=new Set(Ee);return Fe.has(ge)?Fe.delete(ge):Fe.add(ge),Fe})},[]),ve=b.useCallback(()=>{p(X?new Set:new Set(re.map(ge=>ge.id)))},[X,re]),ue=b.useCallback(ge=>{for(const Ee of h){const Fe=U.find(ct=>ct.id===Ee);Fe&&!Fe.tags.includes(ge)&&D(Ee,[...Fe.tags,ge])}},[U,h,D]),fe=b.useCallback(ge=>{for(const Ee of h){const Fe=U.find(ct=>ct.id===Ee);Fe&&Fe.tags.includes(ge)&&D(Ee,Fe.tags.filter(ct=>ct!==ge))}},[U,h,D]),xe=b.useCallback(()=>{for(const ge of h)ae(ge);p(new Set)},[h,ae]),Se=b.useCallback(()=>{for(const ge of h)J(ge);p(new Set)},[h,J]),Ne=b.useCallback(()=>{_(""),S(!0)},[]),K=b.useCallback(async()=>{if(!(!E||!j)){x(!0),S(!1);try{const ge=U.filter(Fe=>h.has(Fe.id));if(ge.length===0){x(!1);return}const Ee=await t.clusterFailures({modelId:`${E}/${j}`,items:ge.map(Fe=>({id:Fe.id,input:Fe.input,output:Fe.output??void 0,error:typeof Fe.error=="string"?Fe.error:Fe.error?String(Fe.error):void 0,scores:Fe.scores,existingTags:Fe.tags.length>0?Fe.tags:void 0})),availableTags:B.length>0?B:void 0,prompt:k||void 0});Ee.proposedTags&&Ee.proposedTags.length>0&&(P(Ee.proposedTags.map(Fe=>({...Fe,accepted:!0}))),$(!0))}catch(ge){console.error("Analysis failed:",ge)}finally{x(!1)}}},[E,j,U,h,t,B,k]),ie=b.useCallback(()=>{for(const ge of I){if(!ge.accepted)continue;const Ee=U.find(Fe=>Fe.id===ge.itemId);if(Ee){const Fe=[...new Set([...Ee.tags,...ge.tags])];D(Ee.id,Fe)}}$(!1)},[I,U,D]),be=b.useCallback(ge=>{u(Ee=>Ee===ge?null:ge)},[]),Ae=b.useMemo(()=>c?re.find(ge=>ge.id===c)??null:null,[c,re]),$e=b.useCallback(()=>{if(!c||re.length===0)return;const ge=re.findIndex(Ee=>Ee.id===c);ge<re.length-1&&u(re[ge+1].id)},[c,re]),ye=b.useCallback(()=>{if(!c||re.length===0)return;const ge=re.findIndex(Ee=>Ee.id===c);ge>0&&u(re[ge-1].id)},[c,re]),ke=Ae?"2rem 1fr 10rem 8rem":"2rem 1fr 10rem 8rem 6rem 6rem";return s?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Mt,{className:"w-6 h-6"})}):o.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[o.jsx(kn,{open:w,onOpenChange:S,children:o.jsxs(xn,{children:[o.jsxs(_n,{children:[o.jsx(wn,{children:"Analyze Items"}),o.jsx(Js,{children:"Use an LLM to automatically suggest tags for the selected items."})]}),o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx(xt,{className:"text-xs mb-1 block",children:"Provider"}),o.jsx(Rg,{value:E,onValueChange:T})]}),o.jsxs("div",{children:[o.jsx(xt,{className:"text-xs mb-1 block",children:"Model"}),o.jsx(Pg,{llmId:E,value:j,onValueChange:N})]})]}),o.jsxs(me,{variant:"ui-xs",className:"text-neutral3",children:[h.size," item",h.size!==1?"s":""," will be analyzed"]}),o.jsxs("div",{children:[o.jsx(xt,{className:"text-xs",children:"Instructions (optional)"}),o.jsx(bc,{value:k,onChange:ge=>_(ge.target.value),placeholder:"E.g., Focus on safety issues and factual errors...",rows:3,className:"text-xs mt-1"})]})]}),o.jsxs(hf,{children:[o.jsx(pe,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),o.jsxs(pe,{onClick:K,disabled:!E||!j||y,children:[y?o.jsx(Mt,{className:"w-4 h-4 mr-1"}):null,"Analyze"]})]})]})}),o.jsx(kn,{open:R,onOpenChange:$,children:o.jsxs(xn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(_n,{children:[o.jsx(wn,{children:"Review Proposed Tags"}),o.jsxs(Js,{children:[I.filter(ge=>ge.accepted).length," of ",I.length," proposals selected"]})]}),o.jsx("div",{className:"space-y-3 py-2",children:I.map((ge,Ee)=>{const Fe=U.find(ct=>ct.id===ge.itemId);return o.jsx("div",{className:Z("p-3 border rounded-lg",!ge.accepted&&"opacity-50"),children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(di,{checked:ge.accepted,onCheckedChange:ct=>P(wt=>wt.map((or,Ve)=>Ve===Ee?{...or,accepted:!!ct}:or))}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx(me,{variant:"ui-xs",className:"text-neutral4 truncate block",children:Fe?typeof Fe.input=="string"?Fe.input.slice(0,100):JSON.stringify(Fe.input).slice(0,100):ge.itemId}),o.jsx("div",{className:"flex gap-1 flex-wrap mt-1.5",children:ge.tags.map((ct,wt)=>o.jsx(v1t,{tag:ct,onRename:or=>P(Ve=>Ve.map((qe,Ie)=>Ie===Ee?{...qe,tags:qe.tags.map((Le,Re)=>Re===wt?or:Le)}:qe)),onRemove:()=>P(or=>or.map((Ve,qe)=>qe===Ee?{...Ve,tags:Ve.tags.filter((Ie,Le)=>Le!==wt)}:Ve))},`${ct}-${wt}`))}),ge.reason&&o.jsx(me,{variant:"ui-xs",className:"text-neutral3 mt-1 block italic",children:ge.reason})]})]})},ge.itemId)})}),o.jsxs(hf,{children:[o.jsx(pe,{variant:"outline",onClick:()=>$(!1),children:"Cancel"}),o.jsxs(pe,{onClick:ie,disabled:I.filter(ge=>ge.accepted).length===0,children:["Accept ",I.filter(ge=>ge.accepted).length," proposals"]})]})]})}),o.jsxs(sf,{className:Ae?"grid-cols-[1fr_1fr]":"",children:[o.jsxs(mr,{children:[o.jsxs(mr.Toolbar,{children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(vt,{children:[o.jsx(vt.Trigger,{asChild:!0,children:o.jsxs(pe,{variant:"outline",size:"md",children:[o.jsx(hVe,{}),"Filter",q>0&&o.jsx("span",{className:Z("ml-0.5 inline-flex items-center justify-center rounded-full bg-accent1/50 text-neutral5 text-ui-sm w-5 h-5"),children:q})]})}),o.jsxs(vt.Content,{align:"start",className:Z("min-w-48"),children:[o.jsxs(vt.Sub,{children:[o.jsxs(vt.SubTrigger,{children:["Status",m&&o.jsx("span",{className:Z("ml-auto text-ui-sm text-accent1"),children:"1"})]}),o.jsxs(NBe,{children:[o.jsx(vt.CheckboxItem,{checked:!m,onCheckedChange:()=>{g(!1),u(null)},onSelect:ge=>ge.preventDefault(),children:"Review Queue"}),o.jsx(vt.CheckboxItem,{checked:m,onCheckedChange:()=>{g(!0),u(null)},onSelect:ge=>ge.preventDefault(),children:"Completed"})]})]}),o.jsxs(vt.Sub,{children:[o.jsxs(vt.SubTrigger,{children:["Tags",d&&o.jsx("span",{className:Z("ml-auto text-ui-sm text-accent1"),children:"1"})]}),o.jsxs(NBe,{children:[o.jsx(vt.CheckboxItem,{checked:!d,onCheckedChange:()=>f(null),onSelect:ge=>ge.preventDefault(),children:"All"}),Y>0&&o.jsx(vt.CheckboxItem,{checked:d==="__untagged__",onCheckedChange:()=>f(d==="__untagged__"?null:"__untagged__"),onSelect:ge=>ge.preventDefault(),children:"Untagged"}),L.length>0&&o.jsx(vt.Separator,{}),L.map(([ge])=>o.jsx(vt.CheckboxItem,{checked:d===ge,onCheckedChange:()=>f(d===ge?null:ge),onSelect:Ee=>Ee.preventDefault(),children:ge},ge))]})]}),q>0&&o.jsxs(o.Fragment,{children:[o.jsx(vt.Separator,{}),o.jsxs(vt.Item,{onSelect:()=>{f(null),g(!1),u(null)},children:[o.jsx(Nn,{}),"Clear all filters"]})]})]})]}),q>0&&o.jsxs(pe,{variant:"outline",size:"md",onClick:()=>{f(null),g(!1),u(null)},children:[o.jsx(Nn,{}),"Reset"]})]}),!m&&h.size>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(y1t,{selectedCount:h.size,vocabulary:B,onApplyTag:ue,onRemoveTag:fe,onNewTag:ge=>ue(ge)}),o.jsxs(vt,{children:[o.jsx(vt.Trigger,{asChild:!0,children:o.jsxs(pe,{disabled:y,children:[y?o.jsx(Mt,{className:"w-4 h-4"}):o.jsx(Ce,{size:"sm",children:o.jsx(ss,{})}),"Actions"]})}),o.jsxs(vt.Content,{align:"end",children:[o.jsxs(vt.Item,{onSelect:xe,children:[o.jsx(Ce,{size:"sm",children:o.jsx(hx,{})}),"Complete"]}),o.jsxs(vt.Item,{onSelect:Se,children:[o.jsx(Ce,{size:"sm",children:o.jsx(nd,{})}),"Remove"]}),o.jsx(vt.Separator,{}),o.jsxs(vt.Item,{onSelect:Ne,children:[o.jsx(Ce,{size:"sm",children:o.jsx(y_,{})}),"Analyze"]})]})]})]})]}),se?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Mt,{className:"w-6 h-6"})}):re.length===0?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"text-center px-8",children:[o.jsx(me,{variant:"ui-sm",className:"text-neutral3 block",children:m?"No completed reviews yet":"No items to review"}),o.jsx(me,{variant:"ui-xs",className:"text-neutral3 mt-2 block",children:m?"Items marked as complete will appear here for auditing.":"When experiment results are flagged for review, they will appear here."})]})}):o.jsxs(we,{columns:ke,children:[o.jsxs(we.Top,{children:[!m&&o.jsx(we.TopCell,{children:o.jsx(di,{checked:X?!0:te?"indeterminate":!1,onCheckedChange:()=>ve(),"aria-label":"Select all"})}),m&&o.jsx(we.TopCell,{children:" "}),o.jsx(we.TopCell,{children:"Input"}),o.jsx(we.TopCell,{children:"Comment"}),o.jsx(we.TopCell,{children:"Tags"}),!Ae&&o.jsx(we.TopCell,{children:"Rating"}),!Ae&&o.jsx(we.TopCell,{children:"Scores"})]}),o.jsx(we.Rows,{children:re.map(ge=>{const Ee=ge.scores?Object.entries(ge.scores):[];return o.jsxs(we.Row,{onClick:()=>be(ge.id),selected:c===ge.id,children:[o.jsx(we.Cell,{children:m?ge.error?o.jsx("div",{className:"w-2 h-2 rounded-full bg-red-700",title:"Error"}):o.jsx("div",{className:"w-2 h-2 rounded-full bg-green-600",title:"Success"}):o.jsx(di,{checked:h.has(ge.id),onCheckedChange:()=>le(ge.id),onClick:Fe=>Fe.stopPropagation(),"aria-label":`Select item ${ge.id}`})}),o.jsx(we.NameCell,{children:mTn(ge.input,80)}),o.jsx(we.Cell,{children:ge.comment?o.jsx(me,{variant:"ui-xs",className:"text-neutral3 truncate",children:ge.comment}):o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})}),o.jsx(we.Cell,{children:ge.tags.length>0?o.jsx(me,{variant:"ui-xs",className:"text-neutral4 truncate",children:ge.tags.join(", ")}):o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})}),!Ae&&o.jsxs(we.Cell,{children:[ge.rating==="positive"&&o.jsx(Ce,{size:"sm",className:"text-positive1",children:o.jsx(oce,{})}),ge.rating==="negative"&&o.jsx(Ce,{size:"sm",className:"text-negative1",children:o.jsx(ice,{})}),!ge.rating&&o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})]}),!Ae&&o.jsx(we.Cell,{children:Ee.length>0?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ce,{size:"sm",className:"text-neutral3",children:o.jsx(Ma,{})}),o.jsx(me,{variant:"ui-xs",className:"text-neutral4 font-mono",children:Ee[0][1].toFixed(2)}),Ee.length>1&&o.jsxs(gt,{variant:"default",children:["+",Ee.length-1]})]}):o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})})]},ge.id)})})]})]}),Ae&&o.jsx(g1t,{item:Ae,isCompleted:m,tagVocabulary:B,onRate:ge=>Q(Ae.id,ge),onSetTags:ge=>{D(Ae.id,ge);for(const Ee of ge)B.includes(Ee)||H(Ee)},onComment:ge=>G(Ae.id,ge),onRemove:()=>J(Ae.id),onComplete:m?void 0:()=>ae(Ae.id),onPrevious:ye,onNext:$e,onClose:()=>u(null)})]})]})}function vTn({datasetId:e,onExperimentClick:t,onEditClick:r,onDeleteClick:n,onAddItemClick:s,experimentTriggerSlot:a,onNavigateToDataset:i,activeDatasetVersion:l,onVersionSelect:c,initialTab:u,onTabChange:d}){const{navigate:f}=ir(),[h,p]=b.useState(u??"items"),m=Ut=>{p(Ut),d?.(Ut)},[g,y]=b.useState(!1),[x,w]=b.useState(!1),[S,k]=b.useState(!1),[_,E]=b.useState([]),[T,j]=b.useState(!1),[N,I]=b.useState([]),[P,R]=b.useState(!1),[$,M]=b.useState([]),[z,U]=b.useState(!1),[B,H]=b.useState(0),[W,L]=b.useState(null),[Y,q]=b.useState(""),[D]=Tcr(Y,300),[Q,G]=b.useState(null),ae=l!==void 0?l:Q,{data:re,isLoading:se}=Ig(e),{data:oe=[],total:he,isLoading:X,setEndOfListElement:te,isFetchingNextPage:le,hasNextPage:ve}=kE(e,D||void 0,ae),{data:ue=[],total:fe,isLoading:xe}=kE(e,void 0,ae),[Se,Ne]=b.useState({}),{data:K,isLoading:ie}=vR(e,void 0,Se),{data:be}=vR(e),{deleteItems:Ae}=ri(),$e=K?.experiments??[],ye=be?.experiments??[],ke=Mjn({hasSearchQuery:!!D,filteredItemsLength:oe.length,unfilteredItemsTotal:fe,itemsTotal:he}),{data:ge}=E1t(e),Ee=ge?.length??0,Fe=Ut=>{L(Ut)},ct=()=>{L(null)},wt=Ut=>{const $r=Ut.isCurrent?null:Ut;c?c($r):G(Ut.isCurrent?null:Ut.version)},or=Ut=>{E(Ut),k(!0)},Ve=Ut=>{I(Ut),j(!0)},qe=Ut=>{j(Ut),Ut||(I([]),H($r=>$r+1))},Ie=Ut=>{f(`/datasets/${e}/items?items=${Ut.join(",")}`)},Le=Ut=>{f(`/datasets/${e}/versions?ids=${Ut.join(",")}`)},Re=Ut=>{M(Ut),R(!0)},it=async()=>{await Ae.mutateAsync({datasetId:e,itemIds:$}),ze.success(`Deleted ${$.length} items`),R(!1),M([]),H(Ut=>Ut+1)},rt=Ut=>{k(!1),E([]),H($r=>$r+1),i?.(Ut)},ht=Ut=>{k(Ut),Ut||(E([]),H($r=>$r+1))};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsx("div",{className:Z("h-full w-full",sn.allSlow),children:o.jsxs("div",{className:Z("grid grid-rows-[auto_1fr] mx-auto h-full w-full m-auto",W?"max-w-[120rem]":"max-w-[90rem]"),children:[o.jsx(hTn,{dataset:re,isLoading:se,onEditClick:r,onDuplicateClick:()=>U(!0),onDeleteClick:n,experimentTriggerSlot:a,disableExperimentTrigger:!xe&&ue.length===0,onExperimentClick:t}),o.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:o.jsxs(Tf,{defaultTab:"items",value:h,onValueChange:m,className:"grid grid-rows-[auto_1fr] h-full",children:[o.jsxs(Nf,{children:[o.jsxs(ws,{value:"items",children:["Items ",o.jsx($a,{color:"gray",children:ke})]}),o.jsxs(ws,{value:"experiments",children:["Experiments",o.jsx($a,{color:"gray",children:$e.length})]}),o.jsxs(ws,{value:"review",children:["Review",Ee>0&&o.jsx($a,{color:"orange",children:Ee})]})]}),o.jsx(Rs,{value:"items",className:"grid overflow-auto mt-5",children:o.jsx(lTn,{datasetId:e,items:oe,isLoading:X,featuredItemId:W,onItemSelect:Fe,onItemClose:ct,onAddClick:s??(()=>{}),onImportClick:()=>y(!0),onImportJsonClick:()=>w(!0),onBulkDeleteClick:Re,onCreateDatasetClick:or,onAddToDatasetClick:Ve,onCompareItemsClick:Ie,datasetName:re?.name,clearSelectionTrigger:B,setEndOfListElement:te,isFetchingNextPage:le,hasNextPage:ve,searchQuery:Y,onSearchChange:q,activeDatasetVersion:ae,currentDatasetVersion:re?.version,onVersionSelect:wt,onCompareVersionsClick:Le})}),o.jsx(Rs,{value:"experiments",className:"grid overflow-auto mt-5",children:o.jsx(Xjn,{experiments:$e,allExperiments:ye,isLoading:ie,datasetId:e,filters:Se,onFiltersChange:Ne})}),o.jsx(Rs,{value:"review",className:"overflow-auto mt-0",children:o.jsx(yTn,{datasetId:e})})]})})]})})}),o.jsx(Vjn,{datasetId:e,open:g,onOpenChange:y}),o.jsx(fTn,{datasetId:e,open:x,onOpenChange:w}),o.jsx(Tjn,{open:S,onOpenChange:ht,items:_,onSuccess:rt}),o.jsx(Njn,{open:T,onOpenChange:qe,items:N,currentDatasetId:e}),o.jsx(Ajn,{open:z,onOpenChange:U,sourceDatasetId:e,sourceDatasetName:re?.name||"",sourceDatasetDescription:re?.description,onSuccess:i}),o.jsx(Bt,{open:P,onOpenChange:R,children:o.jsxs(Bt.Content,{children:[o.jsxs(Bt.Header,{children:[o.jsx(Bt.Title,{children:"Delete Items"}),o.jsxs(Bt.Description,{children:["Are you sure you want to delete ",$.length," item",$.length!==1?"s":"","? This action cannot be undone."]})]}),o.jsxs(Bt.Footer,{children:[o.jsx(Bt.Cancel,{children:"Cancel"}),o.jsx(Bt.Action,{onClick:it,children:Ae.isPending?"Deleting...":"Delete"})]})]})})]})}function bTn(e){if(!(e instanceof Error))return null;const t=e.message.match(/- ({.*})$/);if(!t)return null;try{const r=JSON.parse(t[1]);if(r.field&&Array.isArray(r.errors))return{field:r.field,errors:r.errors}}catch{}return null}function ABe({field:e,errors:t}){return t.length?o.jsx("div",{className:"mt-2 space-y-1",children:t.map((r,n)=>o.jsxs("p",{className:"text-xs text-destructive",children:[o.jsxs("code",{className:"bg-destructive/10 px-1 rounded",children:[e,r.path!=="/"?r.path:""]}),": ",r.message]},n))}):null}function xTn({datasetId:e,open:t,onOpenChange:r,onSuccess:n}){const[s,a]=b.useState("{}"),[i,l]=b.useState(""),[c,u]=b.useState(""),[d,f]=b.useState(null),{addItem:h}=ri(),p=async x=>{x.preventDefault();let w;try{w=JSON.parse(s)}catch{ze.error("Input must be valid JSON");return}let S;if(i.trim())try{S=JSON.parse(i)}catch{ze.error("Ground Truth must be valid JSON");return}let k;if(c.trim())try{k=JSON.parse(c)}catch{ze.error("Expected Trajectory must be valid JSON");return}try{await h.mutateAsync({datasetId:e,input:w,groundTruth:S,expectedTrajectory:k}),ze.success("Item added successfully"),f(null),a("{}"),l(""),u(""),r(!1),n?.()}catch(_){const E=bTn(_);E?f(E):ze.error(`Failed to add item: ${_ instanceof Error?_.message:"Unknown error"}`)}},m=x=>{a(x),d?.field==="input"&&f(null)},g=x=>{l(x),d?.field==="groundTruth"&&f(null)},y=()=>{a("{}"),l(""),u(""),f(null),r(!1)};return o.jsx(kn,{open:t,onOpenChange:r,children:o.jsxs(xn,{className:"max-w-lg",children:[o.jsx(_n,{children:o.jsx(wn,{children:"Add Item"})}),o.jsx(qn,{children:o.jsxs("form",{onSubmit:p,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(xt,{htmlFor:"item-input",children:"Input (JSON) *"}),o.jsx(hs,{value:s,onChange:m,showCopyButton:!1,className:"min-h-[120px]"}),d?.field==="input"&&o.jsx(ABe,{field:"input",errors:d.errors})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(xt,{htmlFor:"item-ground-truth",children:"Ground Truth (JSON, optional)"}),o.jsx(hs,{value:i,onChange:g,showCopyButton:!1,className:"min-h-[80px]"}),d?.field==="groundTruth"&&o.jsx(ABe,{field:"groundTruth",errors:d.errors})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(xt,{htmlFor:"item-trajectory",children:"Expected Trajectory (JSON, optional)"}),o.jsx(hs,{value:c,onChange:u,showCopyButton:!1,className:"min-h-[80px]"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[o.jsx(pe,{type:"button",onClick:y,children:"Cancel"}),o.jsx(pe,{type:"submit",variant:"primary",disabled:h.isPending,children:h.isPending?"Adding...":"Add Item"})]})]})})]})})}function wTn({selectedScorers:e,setSelectedScorers:t,disabled:r=!1,container:n}){const{data:s,isLoading:a}=fd(),i=b.useMemo(()=>s?Object.entries(s).map(([l,c])=>({value:l,label:c.scorer?.config?.name||l,description:c.scorer?.config?.description||""})):[],[s]);return o.jsxs("div",{className:"grid gap-2",children:[o.jsx(xt,{children:"Scorers (Optional)"}),o.jsx(Sdt,{options:i,value:e,onValueChange:t,placeholder:"Select scorers...",searchPlaceholder:"Search scorers...",emptyText:"No scorers available",disabled:r||a,container:n})]})}const STn=[{value:"agent",label:"Agent"},{value:"workflow",label:"Workflow"},{value:"scorer",label:"Scorer"}];function OTn({targetType:e,setTargetType:t,targetId:r,setTargetId:n,container:s}){const{data:a,isLoading:i}=Tg(),{data:l,isLoading:c}=d0(),{data:u,isLoading:d}=fd(),f=e==="agent"?Object.entries(a??{}).map(([g,y])=>({value:g,label:y.name??g})):e==="workflow"?Object.entries(l??{}).map(([g,y])=>({value:g,label:y.name??g})):e==="scorer"?Object.entries(u??{}).map(([g,y])=>({value:g,label:y.scorer?.config?.name??g})):[],h=e==="agent"&&i||e==="workflow"&&c||e==="scorer"&&d,p=g=>{t(g),n("")},m=e==="agent"?"Agent":e==="workflow"?"Workflow":"Scorer";return o.jsxs("div",{className:"grid gap-6",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(xt,{children:"Target Type"}),o.jsx(Kl,{options:STn,value:e,onValueChange:p,placeholder:"Select target type",searchPlaceholder:"Search types...",emptyText:"No types available",container:s})]}),e&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx(xt,{children:m}),o.jsx(Kl,{options:f,value:r,onValueChange:n,placeholder:`Select ${e}`,searchPlaceholder:"Search...",emptyText:"No targets available",disabled:h,container:s})]})]})}function kTn({datasetId:e,version:t,open:r,onOpenChange:n,onSuccess:s}){const a=b.useRef(null),[i,l]=b.useState(""),[c,u]=b.useState(""),[d,f]=b.useState([]),{triggerExperiment:h}=ri(),p=i&&c,m=h.isPending,g=async()=>{if(p)try{const x=await h.mutateAsync({datasetId:e,targetType:i,targetId:c,scorerIds:d.length>0?d:void 0,version:t});vc.success("Experiment triggered successfully"),n(!1),s?.(x.experimentId),l(""),u(""),f([])}catch(x){const w=x instanceof Error?x.message:"Failed to trigger experiment";vc.error(w)}},y=()=>{m||(n(!1),l(""),u(""),f([]))};return o.jsx(kn,{open:r,onOpenChange:y,children:o.jsxs(xn,{ref:a,children:[o.jsxs(_n,{children:[o.jsx(wn,{children:"Run Experiment"}),o.jsx(Js,{children:t?`Execute items from ${ur(new Date(t),"MMM d, yyyy")} version against a target.`:"Execute all items in this dataset against a target."})]}),o.jsxs(qn,{className:"grid gap-6",children:[o.jsx(OTn,{targetType:i,setTargetType:l,targetId:c,setTargetId:u,container:a}),i&&i!=="scorer"&&o.jsx(wTn,{selectedScorers:d,setSelectedScorers:f,disabled:m,container:a})]}),o.jsxs(hf,{className:"px-6 pt-4",children:[o.jsx(pe,{onClick:y,disabled:m,children:"Cancel"}),o.jsx(pe,{variant:"primary",onClick:g,disabled:!p||m,children:m?o.jsxs(o.Fragment,{children:[o.jsx(Mt,{className:"w-4 h-4"}),"Running..."]}):"Run"})]})]})})}const C1t=e=>{const t=Ge();return kt({queryKey:["experiment-trace-light",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return t.getTraceLight(e)},enabled:!!e})},IBe=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"score",label:"Score",size:"1fr"}];function _Tn({result:e,scores:t,onPrevious:r,onNext:n,onClose:s,onShowTrace:a,onScoreClick:i,featuredScoreId:l}){const c=!!e?.error,u=ere(e?.input),d=ere(e?.output);return o.jsxs(o.Fragment,{children:[o.jsxs(mr.Toolbar,{children:[o.jsx(wC,{onPrevious:r,onNext:n,previousAriaLabel:"View previous result details",nextAriaLabel:"View next result details"}),o.jsxs(ps,{children:[o.jsxs(pe,{onClick:a,disabled:!e.traceId,children:[o.jsx(ace,{}),"Show Trace"]}),o.jsx(pe,{onClick:s,"aria-label":"Close result details panel",children:o.jsx(Nn,{})})]})]}),o.jsxs(mr.Content,{children:[o.jsx(Ir,{withMargins:!1,children:o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{size:"smaller",children:[o.jsx(gx,{})," ",e.id]}),o.jsx(Ir.Description,{children:o.jsxs(fs,{children:[o.jsx(px,{})," ",e.itemId]})})]})}),c&&o.jsxs(gl,{variant:"destructive",children:[o.jsx(X2t,{}),o.jsxs(gl.Message,{children:[o.jsx("strong",{children:"Error: "}),ere(e?.error&&typeof e.error=="object"?e.error.message:e?.error)]})]}),t&&t.length>0&&o.jsxs(Pt,{className:"grid-rows-[auto_auto] overflow-visible",children:[o.jsxs(Pt.Header,{columns:IBe,children:[o.jsx(Pt.HeaderCol,{children:"Scorer"}),o.jsx(Pt.HeaderCol,{children:"Score"})]}),o.jsx(Pt.Items,{children:t.map(f=>o.jsx(Pt.Row,{children:o.jsxs(Pt.RowButton,{item:{id:f.id},columns:IBe,isFeatured:l===f.id,onClick:i,children:[o.jsx(Pt.TextCell,{children:f.scorerId}),o.jsx(Pt.TextCell,{className:"font-mono",children:f.score.toFixed(3)})]})},f.id))})]}),(e.status||Array.isArray(e.tags)&&e.tags.length>0)&&o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("h4",{className:"text-sm font-medium text-neutral5 flex items-center gap-2",children:[o.jsx(AE,{className:"w-4 h-4"})," Review Status"]}),o.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[e.status&&o.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${e.status==="needs-review"?"bg-warning/10 text-warning":e.status==="complete"?"bg-accent1/10 text-accent1":"bg-neutral3/10 text-neutral4"}`,children:e.status}),Array.isArray(e.tags)&&e.tags.length>0&&e.tags.map(f=>o.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-surface4 text-neutral4",children:f},f))]})]}),o.jsx(Xt.CodeSection,{title:"Input",icon:o.jsx(px,{}),codeStr:u}),o.jsx(Xt.CodeSection,{title:"Output",icon:o.jsx(Zd,{}),codeStr:d}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("h4",{className:"text-sm font-medium text-neutral5 flex items-center gap-2",children:[o.jsx(g_,{className:"w-4 h-4"})," Created"]}),o.jsx("p",{className:"text-sm text-neutral4",children:ur(new Date(e.createdAt),"MMM d, yyyy 'at' h:mm a")})]})]})]})}function ere(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function ETn({span:e}){return e?o.jsxs(o.Fragment,{children:[o.jsx(Xt.CodeSection,{title:"Input",icon:o.jsx(mx,{}),codeStr:JSON.stringify(e.input||null,null,2)}),o.jsx(Xt.CodeSection,{title:"Output",icon:o.jsx(Zd,{}),codeStr:JSON.stringify(e.output||null,null,2)}),o.jsx(Xt.CodeSection,{title:"Metadata",icon:o.jsx(Oh,{}),codeStr:JSON.stringify(e.metadata||null,null,2)}),o.jsx(Xt.CodeSection,{title:"Attributes",icon:o.jsx(Oh,{}),codeStr:JSON.stringify(e.attributes||null,null,2)})]}):null}function CTn({traceId:e,spanId:t,onNext:r,onPrevious:n,onClose:s}){const{data:a}=FS(e,t),i=a?.span;return o.jsxs(o.Fragment,{children:[o.jsxs(mr.Toolbar,{children:[o.jsx(wC,{onPrevious:n,onNext:r,previousAriaLabel:"View previous span details",nextAriaLabel:"View next span details"}),o.jsx(pe,{onClick:s,"aria-label":"Close span details",children:o.jsx(Nn,{})})]}),o.jsxs(mr.Content,{children:[o.jsx(Ir,{withMargins:!1,children:o.jsx(Ir.Column,{children:o.jsxs(Ir.Title,{size:"smaller",children:[o.jsx(Oh,{})," Span ",nf(t)]})})}),o.jsx(ETn,{span:i})]})]})}const jTn=e=>{if(!e||e.length===0)return[];const t=e.reduce((l,c)=>{const u=c?.endedAt?new Date(c.endedAt):void 0;return u&&(!l||u>l)?u:l},null),r=new Map,n=[];e.forEach(l=>{const c=new Date(l.startedAt),u=l.endedAt?new Date(l.endedAt):void 0,d={id:l.spanId,name:l.name,type:l.spanType,latency:u?u.getTime()-c.getTime():0,startTime:c.toISOString(),endTime:u?u.toISOString():void 0,spans:[],parentSpanId:l.parentSpanId};r.set(l.spanId,d)}),e.forEach(l=>{const c=r.get(l.spanId);if(l?.parentSpanId==null){if(t&&c.endTime&&t>new Date(c.endTime)){c.endTime=t.toISOString();const u=new Date(t).getTime(),d=new Date(c.startTime).getTime();c.latency=u-d}n.push(c)}else{const u=r.get(l.parentSpanId);u?u.spans.push(c):n.push(c)}});const s=l=>l.sort((c,u)=>new Date(c.startTime).getTime()-new Date(u.startTime).getTime()),a=s(n),i=l=>{l.forEach(c=>{c.spans&&c.spans.length>0&&(c.spans=s(c.spans),i(c.spans))})};return i(a),a};function j1t(e){if(!e.spans||e.spans.length===0)return[];const t=[];return e.spans.forEach(r=>{t.push(r.id),t.push(...j1t(r))}),t}const RBe=["agent","workflow","model","mcp","tool","workspace","other"];function T1t(e){const t=e?.toLowerCase().split("_")[0],r={agent:{icon:o.jsx(pa,{}),color:"oklch(0.75 0.15 250)",label:"Agent",bgColor:"bg-oklch(0.75 0.15 250 / 0.1)",typePrefix:"agent"},workflow:{icon:o.jsx(Mi,{}),color:"oklch(0.75 0.15 200)",label:"Workflow",bgColor:"bg-oklch(0.75 0.15 200 / 0.1)",typePrefix:"workflow"},model:{icon:o.jsx(Nm,{}),color:"oklch(0.75 0.15 320)",label:"Model",bgColor:"bg-oklch(0.75 0.15 320 / 0.1)",typePrefix:"model"},mcp:{icon:o.jsx(vl,{}),color:"oklch(0.75 0.15 160)",label:"MCP",bgColor:"bg-oklch(0.75 0.15 160 / 0.1)",typePrefix:"mcp"},tool:{icon:o.jsx(Pi,{}),color:"oklch(0.75 0.15 100)",label:"Tool",bgColor:"bg-oklch(0.75 0.15 100 / 0.1)",typePrefix:"tool"},workspace:{icon:o.jsx(D9,{}),color:"oklch(0.75 0.15 40)",label:"Workspace",bgColor:"bg-oklch(0.75 0.15 40 / 0.1)",typePrefix:"workspace"}};return t in r?r[t]:{typePrefix:"other"}}function TTn({isSelected:e,isFaded:t,isExpanded:r,toggleChildren:n,expandAllDescendants:s,totalDescendants:a=0,allDescendantsExpanded:i,numOfChildren:l}){return o.jsx("div",{className:Z("flex items-center justify-end h-full px-3",{"opacity-30 [&:hover]:opacity-60":t,"bg-surface4":e}),children:l&&l>0?o.jsxs("div",{className:"flex gap-1",children:[o.jsxs(PBe,{onClick:()=>n?.(),children:[i?a:l," ",r?i?o.jsx(rVe,{}):o.jsx(Hx,{}):o.jsx(ss,{})]}),a>(l??0)&&!i&&o.jsxs(PBe,{onClick:()=>s?.(),children:[a," ",o.jsx(tVe,{})]})]}):null})}function PBe({onClick:e,children:t,className:r}){return o.jsx("button",{onClick:e,className:Z("h-full",r),children:o.jsx("div",{className:Z("flex items-center gap-[0.1rem] text-ui-sm text-neutral5 border border-border1 pl-2 pr-1 rounded-lg transition-all","hover:text-yellow-500","[&>svg]:shrink-0 [&>svg]:opacity-80 [&>svg]:w-4 [&>svg]:h-4 [&>svg]:transition-all"),children:t})})}function NTn({isLastChild:e,hasChildren:t=!1,expanded:r=!1}){return o.jsx("div",{className:Z("w-12 h-[2.8rem] relative opacity-100",'after:content-[""] after:absolute after:left-[-1px] after:top-0 after:bottom-0 after:w-0 after:border-l after:border-neutral3 after:border-dashed ','before:content-[""] before:absolute before:left-0 before:top-[50%] before:w-full before:h-0 before:border-b before:border-neutral3 before:border-dashed',"[&_svg]:transition-all","[&:hover_svg]:text-yellow-500 [&:hover_svg]:scale-[1.3] [&:hover_svg]:opacity-100",{"after:bottom-[50%]":e}),children:t&&o.jsx("span",{className:Z("flex absolute left-[50%] top-[50%] translate-y-[-50%] translate-x-[-50%] items-center justify-center bg-surface2 p-1","[&>svg]:shrink-0 [&>svg]:opacity-60 [&>svg]:w-[0.8rem] [&>svg]:h-[0.8rem]"),children:r?o.jsx(aVe,{}):o.jsx(sVe,{})})})}function ATn({span:e,spanUI:t,isFaded:r,depth:n=0,onSpanClick:s,selectedSpanId:a,isLastChild:i,hasChildren:l,isRootSpan:c,isExpanded:u,toggleChildren:d}){return o.jsxs("div",{className:"flex overflow-x-auto",style:{paddingLeft:`${n*1.5}rem`},children:[!c&&o.jsx("button",{onClick:()=>d?.(),disabled:!l,className:Z({"cursor-default":!l,"cursor-pointer":l}),children:o.jsx(NTn,{isLastChild:i,hasChildren:!!l,expanded:u})}),o.jsx("button",{className:"truncate",onClick:()=>s?.(e.id),children:e.name})]})}function N1t({span:e,depth:t=0,onSpanClick:r,selectedSpanId:n,isLastChild:s,overallLatency:a,overallStartTime:i,overallEndTime:l,fadedTypes:c,searchPhrase:u,featuredSpanIds:d,expandedSpanIds:f,setExpandedSpanIds:h}){const p=e.spans&&e.spans.length>0,m=e.spans?e.spans.length:0,g=j1t(e),y=g.length,x=t===0,w=T1t(e?.type),S=f?f.includes(e.id):!1,k=d&&d.length>0?!d.includes(e.id):!1,E=(c&&c.length>0?c.includes(w?.typePrefix||""):!1)||k;b.useEffect(()=>{x&&h?.([e.id])},[x,e.id,h]),b.useEffect(()=>{if(!d||!e.spans||e.spans.length===0)return;const I=e.spans.some(P=>d.includes(P.id));!S&&I&&T()},[d,e.spans,e.id,S,h,f]);const T=()=>{if(!(!h||!f))if(S){const I=[e.id,...g];h(f.filter(P=>!I.includes(P)))}else h([...f,e.id])},j=()=>{!h||!f||h([...f,e.id,...g])},N=g.every(I=>f?.includes(I));return o.jsxs(o.Fragment,{children:[o.jsx(ATn,{span:e,spanUI:w,isFaded:E,depth:t,onSpanClick:r,selectedSpanId:n,isLastChild:s,hasChildren:p,isRootSpan:x,isExpanded:S,toggleChildren:T}),o.jsx(TTn,{isSelected:n===e.id,isFaded:E,isExpanded:S,toggleChildren:T,expandAllDescendants:j,totalDescendants:y,allDescendantsExpanded:N,numOfChildren:m}),p&&S&&e.spans?.map((I,P,R)=>{const $=P===R.length-1;return o.jsx(N1t,{span:I,depth:t+1,onSpanClick:r,selectedSpanId:n,isLastChild:$,overallLatency:a,overallStartTime:i,fadedTypes:c,searchPhrase:u,expandedSpanIds:f,setExpandedSpanIds:h,featuredSpanIds:d},I.id)})]})}function ITn({hierarchicalSpans:e=[],onSpanClick:t,selectedSpanId:r,isLoading:n,fadedTypes:s,expandedSpanIds:a,setExpandedSpanIds:i,featuredSpanIds:l}){const c=e?.[0]?.latency||0,u=e?.[0]?.startTime||"",d=e?.[0]?.endTime||"";return o.jsx(o.Fragment,{children:n?o.jsxs("div",{className:Z("flex items-center text-ui-md gap-4 bg-surface3/50 rounded-md p-6 justify-center text-neutral3","[&_svg]:w-[1.25em] [&_svg]:h-[1.25em] [&_svg]:opacity-50"),children:[o.jsx(Mt,{})," Loading Trace Timeline ..."]}):o.jsx("div",{className:"grid grid-cols-[1fr_auto]",children:e?.map(f=>o.jsx(N1t,{span:f,onSpanClick:t,selectedSpanId:r,overallLatency:c,overallStartTime:u,overallEndTime:d,fadedTypes:s,featuredSpanIds:l,expandedSpanIds:a,setExpandedSpanIds:i},f.id))})})}function RTn({spans:e=[],fadedTypes:t,onLegendClick:r,onLegendReset:n,onSearchPhraseChange:s,traceId:a}){const[i,l]=b.useState("");b.useEffect(()=>{l("")},[a]);const c=RBe.filter(h=>e.some(p=>p?.spanType?.startsWith(h)))||[],u=e.some(h=>!RBe.some(m=>h?.spanType?.startsWith(m))),d=h=>{r?.(h)};b.useEffect(()=>{f(i)},[i,s]);const f=Wtt(h=>{s?.(h)},1e3);return o.jsxs("div",{className:"flex gap-3 items-center justify-between",children:[o.jsx("div",{className:"flex",children:o.jsx(Tx,{name:"search-spans",label:"Find span by name",labelIsHidden:!0,placeholder:"Look for span name",value:i,onChange:h=>{l(h.target.value)},onReset:()=>l("")})}),o.jsxs(eft,{children:[c.map(h=>{const p=T1t(h),m=t?.includes(h);return o.jsx(b.Fragment,{children:o.jsxs(pe,{onClick:()=>d(h),className:m?"opacity-40":"",style:{color:m?void 0:p?.color,backgroundColor:p?.bgColor},children:[p?.icon&&o.jsx(Ce,{children:p.icon}),p?.label]})},h)}),u&&o.jsxs(pe,{onClick:()=>d("other"),className:t?.includes("other")?"opacity-40":"",children:[o.jsx(Ce,{children:o.jsx(rF,{})}),"Other"]}),o.jsx(pe,{onClick:n,disabled:t?.length===0,children:o.jsx(Ce,{children:o.jsx(Nn,{})})})]})]})}function PTn({traceId:e,selectedSpanId:t,onSpanSelect:r,onClose:n}){const{data:s,isLoading:a}=C1t(e),i=s?.spans??[],[l,c]=b.useState(""),[u,d]=b.useState([]),[f,h]=b.useState([]),[p,m]=b.useState([]),g=b.useMemo(()=>jTn(i),[i]);b.useEffect(()=>{if(l.trim()===""){h([]);return}const S=l.toLowerCase(),k=i.filter(_=>_.name.toLowerCase().includes(S)).map(_=>_.spanId);h(k)},[l,i]),b.useEffect(()=>{c(""),d([]),h([]),m([])},[e]);const y=S=>{r?.(t===S?void 0:S)},x=S=>{d(k=>k.includes(S)?k.filter(_=>_!==S):[...k,S])},w=()=>{d([])};return o.jsxs(o.Fragment,{children:[o.jsx(mr.Toolbar,{children:o.jsx(pe,{onClick:n,"aria-label":"Close trace panel",children:o.jsx(Nn,{})})}),o.jsxs(mr.Content,{children:[o.jsx(Ir,{withMargins:!1,children:o.jsx(Ir.Column,{children:o.jsxs(Ir.Title,{size:"smaller",children:[o.jsx(xo,{})," Trace ",nf(e)]})})}),o.jsx(RTn,{spans:i,fadedTypes:u,onLegendClick:x,onLegendReset:w,searchPhrase:l,onSearchPhraseChange:c,traceId:e}),o.jsx(ITn,{hierarchicalSpans:g,onSpanClick:y,selectedSpanId:t,isLoading:a,fadedTypes:u,expandedSpanIds:p,setExpandedSpanIds:m,featuredSpanIds:f})]})]})}function MTn({results:e,isLoading:t,featuredResultId:r,onResultClick:n,columns:s,scoresByItemId:a,scorerIds:i,setEndOfListElement:l,isFetchingNextPage:c,hasNextPage:u}){const d=s.map(f=>f.size).join(" ");return t?o.jsxs(we,{columns:d,children:[o.jsx(we.Top,{children:s.map(f=>o.jsx(we.TopCell,{children:f.label},f.name))}),o.jsx("div",{className:"flex items-center justify-center py-20 col-span-full",children:o.jsx(Mt,{})})]}):e.length===0?o.jsxs(we,{columns:d,children:[o.jsx(we.Top,{children:s.map(f=>o.jsx(we.TopCell,{children:f.label},f.name))}),o.jsx(we.NoMatch,{message:"No results yet"})]}):o.jsxs(we,{columns:d,children:[o.jsx(we.Top,{children:s.map(f=>o.jsx(we.TopCell,{children:f.label},f.name))}),o.jsxs(we.Rows,{children:[e.map(f=>{const h=!!f.error,p=f.id===r;return o.jsxs(we.Row,{onClick:()=>n(f.id),selected:p,children:[o.jsx(we.TextCell,{children:o.jsx("span",{className:"truncate block font-mono",children:f.itemId})}),o.jsx(we.Cell,{children:o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("div",{className:"flex items-center justify-center w-10 relative bg-transparent h-full",children:o.jsx("div",{className:Z("w-2 h-2 rounded-full",h?"bg-red-700":"bg-green-600")})})}),o.jsx(Wr,{children:h?"Error":"Success"})]})}),s.some(m=>m.name==="input")&&o.jsx(we.TextCell,{children:o.jsx("span",{className:"truncate block font-mono",children:LTn(DTn(f.input),200)})}),i?.map(m=>{const y=a?.[f.itemId]?.find(x=>x.scorerId===m);return o.jsx(we.TextCell,{children:o.jsx("span",{className:"font-mono",children:y!=null?y.score.toFixed(3):"-"})},m)})]},f.id)}),o.jsxs("div",{ref:l,className:"h-1 col-span-full",children:[c&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(Mt,{})}),!u&&e.length>0&&o.jsx(me,{variant:"ui-xs",className:"text-icon3 text-center py-4 block",children:"All results loaded"})]})]})]})}function DTn(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function LTn(e,t){return e.length<=t?e:e.slice(0,t-1)+"..."}function $Tn(e){const t=e.scorer;return t?.hasJudge===!1?!0:t?.hasJudge===!0?!1:!e.preprocessPrompt&&!e.analyzePrompt&&!e.generateScorePrompt&&!e.generateReasonPrompt}function FTn({score:e,onNext:t,onPrevious:r,onClose:n}){const s=$Tn(e),a=s?"N/A — code-based scorer":"N/A — step not configured";return o.jsxs(o.Fragment,{children:[o.jsxs(mr.Toolbar,{children:[o.jsx(wC,{onPrevious:r,onNext:t,previousAriaLabel:"View previous score details",nextAriaLabel:"View next score details"}),o.jsx(pe,{onClick:n,"aria-label":"Close score details",children:o.jsx(Nn,{})})]}),o.jsxs(mr.Content,{children:[o.jsx(Ir,{withMargins:!1,children:o.jsx(Ir.Column,{children:o.jsxs(Ir.Title,{size:"smaller",children:[o.jsx(Ma,{})," ",e.scorerId]})})}),o.jsxs($S,{children:[o.jsx(Xt.CodeSection,{title:`Score: ${e.score}`,icon:o.jsx(Ma,{}),codeStr:e.reason||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Input",icon:o.jsx(px,{}),codeStr:JSON.stringify(e.input??null,null,2)}),o.jsx(Xt.CodeSection,{title:"Output",icon:o.jsx(Zd,{}),codeStr:JSON.stringify(e.output??null,null,2)}),!s&&o.jsxs(o.Fragment,{children:[o.jsx(Xt.CodeSection,{title:"Preprocess Prompt",icon:o.jsx(lc,{}),codeStr:e.preprocessPrompt||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Analyze Prompt",icon:o.jsx(lc,{}),codeStr:e.analyzePrompt||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Generate Score Prompt",icon:o.jsx(lc,{}),codeStr:e.generateScorePrompt||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Generate Reason Prompt",icon:o.jsx(lc,{}),codeStr:e.generateReasonPrompt||a,simplified:!0})]})]})]})]})}const MBe=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"avg",label:"Avg Score",size:"1fr"},{name:"count",label:"Items Scored",size:"1fr"}];function zTn({scoresByItemId:e,experimentStatus:t}){const r=b.useMemo(()=>{if(!e)return[];const n={};for(const s of Object.values(e))for(const a of s)n[a.scorerId]||(n[a.scorerId]={sum:0,count:0}),n[a.scorerId].sum+=a.score,n[a.scorerId].count++;return Object.entries(n).map(([s,{sum:a,count:i}])=>({scorerId:s,avg:a/i,count:i})).sort((s,a)=>s.scorerId.localeCompare(a.scorerId))},[e]);if(r.length===0){const n=t==="running"||t==="pending",s=e!==void 0;let a,i;return n?(a="Experiment in progress",i="Summary metrics will appear here once the experiment completes."):s?(a="No scorers configured",i="Add scorers when triggering an experiment to evaluate results and see summary metrics here."):(a="Loading scores",i="Fetching scorer results…"),o.jsx("div",{className:"flex h-full items-center justify-center py-12",children:o.jsx(Ka,{iconSlot:o.jsx(Ma,{className:"w-8 h-8 text-neutral3"}),titleSlot:a,descriptionSlot:i})})}return o.jsxs(Pt,{children:[o.jsxs(Pt.Header,{columns:MBe,children:[o.jsx(Pt.HeaderCol,{children:"Scorer"}),o.jsx(Pt.HeaderCol,{children:"Avg Score"}),o.jsx(Pt.HeaderCol,{children:"Items Scored"})]}),o.jsx(Pt.Scroller,{children:o.jsx(Pt.Items,{children:r.map(({scorerId:n,avg:s,count:a})=>o.jsxs(Pt.Row,{columns:MBe,children:[o.jsx(Pt.TextCell,{children:n}),o.jsx(Pt.TextCell,{className:"font-mono",children:s.toFixed(3)}),o.jsx(Pt.TextCell,{className:"font-mono",children:a})]},n))})})]})}function A1t({experimentId:e,experimentStatus:t,results:r,isLoading:n,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i}){const[l,c]=b.useState(null),[u,d]=b.useState(null),[f,h]=b.useState(void 0),[p,m]=b.useState(null),g=r.find(B=>B.id===l)??null,{data:y}=o1t(e,t),x=b.useMemo(()=>{if(!y)return[];const B=new Set;for(const H of Object.values(y))for(const W of H)B.add(W.scorerId);return[...B].sort()},[y]),{data:w}=C1t(u),S=w?.spans??[],k=()=>{if(!f)return;const B=S.findIndex(H=>H.spanId===f);if(B>=0&&B<S.length-1)return()=>h(S[B+1].spanId)},_=()=>{if(!f)return;const B=S.findIndex(H=>H.spanId===f);if(B>0)return()=>h(S[B-1].spanId)},E=B=>{c(B),d(null),h(void 0),m(null)},T=B=>{E(B===l?null:B)},j=()=>{E(null)},N=()=>{if(!g)return;const B=r.findIndex(H=>H.id===g.id);if(B>=0&&B<r.length-1)return()=>E(r[B+1].id)},I=()=>{if(!g)return;const B=r.findIndex(H=>H.id===g.id);if(B>0)return()=>E(r[B-1].id)},P=g?y?.[g.itemId]:void 0,R=P?.find(B=>B.id===p)??null,$=B=>{m(B===p?null:B),d(null),h(void 0)},M=()=>{if(!p||!P)return;const B=P.findIndex(H=>H.id===p);if(B>=0&&B<P.length-1)return()=>m(P[B+1].id)},z=()=>{if(!p||!P)return;const B=P.findIndex(H=>H.id===p);if(B>0)return()=>m(P[B-1].id)},U=b.useMemo(()=>[{name:"itemId",label:"Item ID",size:"5rem"},{name:"status",label:"Status",size:"3rem"},{name:"input",label:"Input",size:"1fr"},...l?[]:x.map(B=>({name:B,label:B,size:"1fr"}))],[l,x]);return o.jsxs(Tf,{defaultTab:"summary",className:"grid grid-rows-[auto_1fr] h-full overflow-hidden",children:[o.jsxs(Nf,{children:[o.jsx(ws,{value:"summary",children:"Summary"}),o.jsx(ws,{value:"results",children:"Results"})]}),o.jsx(Rs,{value:"summary",className:"overflow-y-auto mt-5",children:o.jsx(zTn,{scoresByItemId:y,experimentStatus:t})}),o.jsx(Rs,{value:"results",className:"grid overflow-hidden mt-5",children:o.jsxs(sf,{className:g?"grid-cols-[1fr_2fr]":void 0,children:[o.jsx(mr,{children:o.jsx(MTn,{results:r,isLoading:n,featuredResultId:l,onResultClick:T,columns:U,scoresByItemId:y,scorerIds:l?void 0:x,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i})}),g&&o.jsxs(b3r,{numOfColumns:1+(!u&&p?1:0)+(u?1:0)+(f?1:0),minColumnWidth:"35rem",children:[g&&o.jsx(mr,{withLeftSeparator:!0,children:o.jsx(_Tn,{result:g,scores:P,onPrevious:I(),onNext:N(),onClose:j,onScoreClick:$,featuredScoreId:p,onShowTrace:()=>{d(g.traceId??null),h(void 0),m(null)}})}),g&&!u&&R&&o.jsx(mr,{withLeftSeparator:!0,children:o.jsx(FTn,{score:R,onNext:M(),onPrevious:z(),onClose:()=>m(null)})}),g&&u&&o.jsx(mr,{withLeftSeparator:!0,children:o.jsx(PTn,{traceId:u,selectedSpanId:f,onSpanSelect:h,onClose:()=>{d(null),h(void 0)}})}),g&&u&&f&&o.jsx(mr,{withLeftSeparator:!0,children:o.jsx(CTn,{traceId:u,spanId:f,onNext:k(),onPrevious:_(),onClose:()=>h(void 0)})})]})]})})]})}const BTn={pending:o.jsx(CE,{}),running:o.jsx(f3,{}),completed:o.jsx(ta,{}),failed:o.jsx(Nn,{})};function UTn({experiment:e,className:t}){const r=e.status,n=e.totalItems-e.succeededCount-e.failedCount;return o.jsxs("div",{className:Z("grid justify-items-end gap-3",t),children:[o.jsxs("div",{className:"flex p-1 px-3 text-ui-lg capitalize text-neutral4 gap-2 items-center bg-surface5 rounded-lg ",children:[o.jsx("span",{className:Z("w-5 h-5 flex items-center justify-center rounded-full text-black","[&>svg]:w-4 [&>svg]:h-4",{"bg-green-700":r==="completed","bg-red-700":r==="failed","bg-cyan-600":r==="running","bg-yellow-600":r==="pending"}),children:BTn[r]}),e.status]}),o.jsxs("div",{className:Z("flex items-center gap-3 text-neutral3 text-ui-md ","[&>span]:flex [&>span]:gap-1 [&>span]:items-center ","[&_b]:text-neutral4 [&_b]:font-semibold"),children:[o.jsxs("span",{children:["Total: ",o.jsx("b",{children:e.totalItems})]}),o.jsxs("span",{children:["Succeeded: ",o.jsx("b",{children:e.succeededCount})]}),o.jsxs("span",{children:["Failed: ",o.jsx("b",{children:e.failedCount})]}),(r==="pending"||r==="running")&&o.jsxs("span",{children:["Pending: ",o.jsx("b",{children:n})]})]})]})}function I1t({experimentId:e,experiment:t}){const{Link:r,paths:n}=ir(),{data:s}=Tg(),{data:a}=d0(),{data:i}=fd(),l=()=>{switch(t.targetType){case"agent":return n.agentLink(t.targetId);case"workflow":return n.workflowLink(t.targetId);case"scorer":return n.scorerLink(t.targetId);default:return"#"}},c=()=>{const u=t.targetId;if(!u)return u;switch(t.targetType){case"agent":return s?.[u]?.name??u;case"workflow":return a?.[u]?.name??u;case"scorer":return i?.[u]?.scorer?.config?.name??u;default:return u}};return o.jsxs(Ir,{children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{children:[o.jsx(oVe,{}),e," ",e&&o.jsx(Xa,{content:e})]}),o.jsxs(Ir.Description,{children:[o.jsxs(fs,{children:[o.jsx(g_,{})," Created at ",ur(new Date(t.createdAt),"MMM d, yyyy 'at' h:mm a")]}),t.completedAt&&o.jsxs(fs,{children:[o.jsx(g_,{})," Completed at ",ur(new Date(t.completedAt),"MMM d, yyyy 'at' h:mm a")]})]}),o.jsxs(Ir.Description,{children:[o.jsxs(fs,{children:[o.jsx(_Mt,{})," Target",o.jsx(r,{href:l(),children:c()})]}),t.agentVersion&&o.jsxs(fs,{children:[o.jsx(sF,{})," Version",t.targetType==="agent"&&t.targetId?o.jsx(r,{href:`${n.agentLink(t.targetId)}/editor?version=${encodeURIComponent(t.agentVersion)}`,className:"font-mono text-xs underline hover:text-accent1",children:t.agentVersion}):o.jsx("span",{className:"font-mono text-xs",children:t.agentVersion}),o.jsx(Xa,{content:t.agentVersion})]})]})]}),o.jsx(Ir.Column,{children:o.jsx(UTn,{experiment:t})})]})}function jve({delta:e}){const t=e>0?o.jsx($a,{size:"small",color:"green",intensity:"muted",children:o.jsx(Jle,{})}):e<0?o.jsx($a,{size:"small",color:"red",intensity:"muted",children:o.jsx(KUe,{})}):null;return o.jsxs("span",{className:Z("font-mono text-sm text-neutral4 min-w-20"),children:[o.jsx("span",{className:"w-3 inline-block",children:e>0?"+ ":e<0?"- ":""}),Math.abs(e).toFixed(2)," ",t]})}function DL(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function VTn({item:e,baselineId:t,contenderId:r,baselineVersion:n,contenderVersion:s,onPrevious:a,onNext:i,onClose:l}){const c=e.results[t],u=e.results[r],d=!!(c&&u),f=new Set;if(c)for(const p of Object.keys(c.scores))f.add(p);if(u)for(const p of Object.keys(u.scores))f.add(p);const h=[...f].sort();return o.jsxs(mr,{withLeftSeparator:!0,children:[o.jsxs(mr.Toolbar,{children:[o.jsx(wC,{onPrevious:a,onNext:i,previousAriaLabel:"Previous comparison item",nextAriaLabel:"Next comparison item"}),o.jsx(ps,{children:o.jsx(pe,{onClick:l,"aria-label":"Close comparison detail panel",children:o.jsx(Nn,{})})})]}),o.jsxs(mr.Content,{className:"pb-6",children:[o.jsx(Ir,{withMargins:!1,children:o.jsx(Ir.Column,{children:o.jsxs(Ir.Title,{size:"smaller",children:[o.jsx(px,{})," ",e.itemId]})})}),d?o.jsx(o.Fragment,{children:o.jsxs($S,{children:[h.length>0&&o.jsxs("div",{className:"grid gap-3",children:[o.jsx("h4",{className:"text-sm font-medium text-neutral5",children:"Scores"}),o.jsx("div",{className:"grid gap-2",children:h.map(p=>{const m=c?.scores[p]??null,g=u?.scores[p]??null,y=m!=null&&g!=null?g-m:null;return o.jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2 rounded-lg bg-surface2",children:[o.jsx("span",{className:"text-sm text-neutral5 font-medium",children:p}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("span",{className:"text-sm text-neutral3",children:[m!=null?m.toFixed(3):"-"," →"," ",g!=null?g.toFixed(3):"-"]}),y!=null&&o.jsx(jve,{delta:y})]})]},p)})})]}),o.jsx(Xt.CodeSection,{title:o.jsxs(o.Fragment,{children:[o.jsx($a,{color:"purple",children:"Baseline "})," Experiment Output"]}),icon:o.jsx(Zd,{}),codeStr:DL(c?.output)}),o.jsx(Xt.CodeSection,{title:o.jsxs(o.Fragment,{children:[o.jsx($a,{color:"cyan",children:"Contender "})," Experiment Output"]}),icon:o.jsx(Zd,{}),codeStr:DL(u?.output)}),o.jsx(Xt.CodeSection,{title:"Item Input",icon:o.jsx(mx,{}),codeStr:DL(e.input)}),o.jsx(Xt.CodeSection,{title:"Item Ground Truth",icon:o.jsx(OVe,{}),codeStr:DL(e.groundTruth)})]})}):o.jsxs(gl,{variant:"warning",children:[o.jsx(kh,{}),o.jsx(gl.Message,{children:(()=>{const p=c?"Contender":"Baseline",m=c?s:n;return o.jsxs(o.Fragment,{children:["The ",p," experiment was run against dataset",m!=null?` v. ${m}`:"",", which does not contain this item. Comparison is not available."]})})()})]})]})]})}function qTn({items:e,baselineId:t,contenderId:r,scorerIds:n,featuredItemId:s,columns:a,onItemClick:i}){return o.jsx(mr,{children:o.jsxs(Pt,{children:[o.jsxs(Pt.Header,{columns:a,children:[o.jsx(Pt.HeaderCol,{children:"Item ID"}),!s&&n.map(l=>o.jsx(Pt.HeaderCol,{className:"flex justify-center",children:l},l))]}),o.jsx(Pt.Scroller,{children:o.jsx(Pt.Items,{children:e.map(l=>{const c=l.results[t],u=l.results[r],d=!!(c&&u);return o.jsx(Pt.Row,{children:o.jsxs(Pt.RowButton,{item:{id:l.itemId},columns:a,isFeatured:s===l.itemId,onClick:i,children:[o.jsx(Pt.IdCell,{id:l.itemId,className:d?"":"text-neutral1"}),!s&&o.jsx(o.Fragment,{children:n.map(f=>{const h=c?.scores[f]??null,p=u?.scores[f]??null,m=h!=null&&p!=null?p-h:null;return o.jsx(Pt.Cell,{className:"flex items-center gap-5 justify-center font-mono",children:m!=null?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"flex items-center text-neutral2 min-w-24",children:[h?.toFixed(2)," → ",p?.toFixed(2)]}),o.jsx(jve,{delta:m})]}):o.jsx("span",{className:"text-neutral1",children:"-"})},f)})})]})},l.itemId)})})})]})})}const HTn={baseline:{label:"Baseline",color:"purple",customStyle:"items-end justify-items-end [&>div]:justify-end border-r-0 rounded-r-none"},contender:{label:"Contender",color:"cyan",customStyle:"items-start justify-items-start [&>div]:justify-start border-l-0 rounded-l-none"}};function DBe({datasetId:e,experiment:t,type:r}){const{Link:n}=ir(),{label:s,color:a,customStyle:i}=HTn[r];if(!t)return null;const l=t.createdAt?new Date(t.createdAt):null;return o.jsxs("div",{className:`grid border-2 border-border1 rounded-lg p-5 gap-3 ${i}`,children:[o.jsxs("div",{className:"flex items-center gap-3 w-full overflow-clip",children:[r==="contender"&&o.jsxs($a,{size:"small",color:a,children:[s,o.jsx(Fw,{})]}),o.jsx(pe,{as:n,href:`/datasets/${e}/experiments/${t.id}`,children:o.jsx("span",{className:"truncate min-w-0",children:t.id})}),r==="baseline"&&o.jsxs($a,{size:"small",color:a,children:[o.jsx(_p,{})," ",s]})]}),o.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-ui-sm text-neutral3",children:[o.jsxs(fs,{children:[o.jsx(OVe,{})," ",t.targetType," / ",t.targetId]}),o.jsxs(fs,{children:[o.jsx(pVe,{})," v",t.datasetVersion??"—"]}),l&&o.jsxs(fs,{children:[o.jsx(JUe,{})," ",ur(l,"MMM d, yyyy HH:mm")]})]})]})}function QTn({datasetId:e,experimentIdA:t,experimentIdB:r,onSwap:n}){const[s,a]=b.useState(null),{data:i,isLoading:l,error:c}=ojn(e,t,r),{data:u}=V6(e,t),{data:d}=V6(e,r),f=u&&d&&u.datasetVersion!==d.datasetVersion,h=b.useMemo(()=>{if(!i)return[];const T=new Set;for(const j of i.items)for(const N of Object.values(j.results))if(N)for(const I of Object.keys(N.scores))T.add(I);return[...T].sort()},[i]),p=b.useMemo(()=>{if(!i||h.length===0)return[];const T=i.baselineId,j=t===T?r:t;return h.map(N=>{let I=0,P=0,R=0,$=0;for(const B of i.items){const H=B.results[T]?.scores[N],W=B.results[j]?.scores[N];H!=null&&(I+=H,R++),W!=null&&(P+=W,$++)}const M=R>0?I/R:null,z=$>0?P/$:null,U=M!=null&&z!=null?z-M:null;return{scorerId:N,avgA:M,avgB:z,delta:U}})},[i,h,t,r]),m=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"baselineAvg",label:"Baseline Avg",size:"1fr"},{name:"comparisonAvg",label:"Comparison Avg",size:"1fr"},{name:"delta",label:"Delta",size:"1fr"}],g=b.useMemo(()=>[{name:"itemId",label:"Item ID",size:"8rem"},...s?[]:h.map(T=>({name:T,label:T,size:"1fr"}))],[h,s]),y=i?.items.find(T=>T.itemId===s)??null,x=T=>{a(T===s?null:T)},w=()=>{a(null)},S=()=>{if(!i||!s)return;const T=i.items.findIndex(j=>j.itemId===s);if(T>=0&&T<i.items.length-1)return()=>a(i.items[T+1].itemId)},k=()=>{if(!i||!s)return;const T=i.items.findIndex(j=>j.itemId===s);if(T>0)return()=>a(i.items[T-1].itemId)};if(l)return o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx(Mt,{})});if(c)return o.jsxs(gl,{variant:"warning",children:[o.jsx(kh,{}),o.jsxs(gl.Column,{children:[o.jsx(gl.Title,{children:"Error loading comparison"}),o.jsx(gl.Message,{children:c instanceof Error?c.message:"Unknown error"})]})]});if(!i||i.items.length===0)return o.jsx("div",{className:"text-neutral4 text-sm text-center py-8",children:"No comparison data"});const _=i.baselineId,E=t===_?r:t;return o.jsxs("div",{className:"grid gap-10",children:[u&&d&&o.jsxs("div",{className:Z("relative grid xl:grid-cols-[1fr_auto_1fr] gap-4 xl:gap-0"),children:[o.jsx(DBe,{datasetId:e,experiment:u,type:"baseline"}),o.jsx("div",{className:"relative flex items-center justify-center px-[2vw] before:absolute before:inset-y-0 before:left-1/2 before:-translate-x-1/2 before:w-[2px] before:bg-border1",children:o.jsx("div",{className:"relative z-1 bg-surface2 rounded-lg p-2",children:o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(pe,{onClick:n,children:"VS"})}),o.jsx(Wr,{children:"Switch the order"})]})})}),o.jsx(DBe,{datasetId:e,experiment:d,type:"contender"})]}),f&&o.jsxs(gl,{variant:"warning",children:[o.jsx(kh,{}),o.jsxs(gl.Message,{children:[o.jsx("strong",{children:"Version mismatch!"})," These experiments used different dataset versions (v",u.datasetVersion," vs v",d.datasetVersion,"). Results may not be directly comparable."]})]}),p.length>0&&o.jsxs(Pt,{children:[o.jsxs(Pt.Header,{columns:m,children:[o.jsx(Pt.HeaderCol,{children:"Scorer"}),o.jsx(Pt.HeaderCol,{className:"flex justify-center",children:o.jsxs(nRe,{children:[o.jsx($a,{color:"purple",size:"small",intensity:"muted",children:"Baseline"}),o.jsx($a,{color:"purple",size:"small",children:"Avg"})]})}),o.jsx(Pt.HeaderCol,{className:"flex justify-center",children:o.jsxs(nRe,{children:[o.jsx($a,{color:"cyan",size:"small",intensity:"muted",children:"Contender"}),o.jsx($a,{color:"cyan",size:"small",children:"Avg"})]})}),o.jsx(Pt.HeaderCol,{className:"flex justify-center",children:"Delta"})]}),o.jsx(Pt.Scroller,{children:o.jsx(Pt.Items,{children:p.map(({scorerId:T,avgA:j,avgB:N,delta:I})=>o.jsxs(Pt.Row,{columns:m,children:[o.jsx(Pt.TextCell,{children:T}),o.jsx(Pt.TextCell,{className:"text-center font-mono",children:j!=null?j.toFixed(3):"-"}),o.jsx(Pt.TextCell,{className:"text-center font-mono",children:N!=null?N.toFixed(3):"-"}),o.jsx(Pt.TextCell,{className:"flex justify-center",children:I!=null?o.jsx(jve,{delta:I}):"-"})]},T))})})]}),o.jsxs(sf,{className:Z({"grid-cols-[1fr_2fr]":!!y}),children:[o.jsx(qTn,{items:i.items,baselineId:_,contenderId:E,scorerIds:h,featuredItemId:s,columns:g,onItemClick:x}),!!y&&o.jsx(VTn,{item:y,baselineId:_,contenderId:E,baselineVersion:u?.datasetVersion,contenderVersion:d?.datasetVersion,onPrevious:k(),onNext:S(),onClose:w})]})]})}function WTn({datasetId:e,itemId:t,onVersionSelect:r,onCompareVersionsClick:n,activeVersion:s}){const{data:a,isLoading:i}=Cve(e,t),[l,c]=b.useState(!1),[u,d]=b.useState(new Set),f=x=>{r?.(x)},h=x=>s==null?x.isLatest:x.datasetVersion===s,p=x=>{d(w=>{const S=new Set(w);if(S.has(x))S.delete(x);else if(S.size>=2){const[k]=Array.from(S);return new Set([k,x])}else S.add(x);return S})},m=()=>{c(!1),d(new Set)},g=()=>{c(!0)},y=()=>{u.size===2&&n?.([...u])};return o.jsxs(mr,{className:"min-w-56",children:[l?o.jsx(mr.Toolbar,{className:"grid justify-stretch gap-3 w-full",children:o.jsxs(ps,{children:[o.jsx(pe,{onClick:m,children:"Cancel"}),o.jsx(Cn,{variant:"primary",disabled:u.size!==2,onClick:y,tooltipContent:u.size!==2?"Check 2 versions to compare":void 0,className:"grow",children:"Compare"})]})}):o.jsx(o.Fragment,{children:(a||[]).length>1&&o.jsx(mr.Toolbar,{children:o.jsxs(pe,{onClick:g,className:"w-full",children:[o.jsx(qm,{})," Compare Ver."]})})}),i?o.jsx(GTn,{}):o.jsxs(Pt,{children:[o.jsx(Pt.Header,{children:o.jsx(Pt.HeaderCol,{children:"Item Version History"})}),o.jsx(Pt.Scroller,{children:o.jsx(Pt.Items,{children:a?.map(x=>{const w=String(x.datasetVersion),S=typeof x.updatedAt=="string"?new Date(x.updatedAt):x.updatedAt;return o.jsxs(Pt.Row,{isSelected:l&&u.has(w),children:[l&&o.jsx(Pt.LabelCell,{children:o.jsx(di,{checked:u.has(w),disabled:x.isDeleted,onCheckedChange:()=>{},onClick:k=>{k.stopPropagation(),x.isDeleted||p(w)},"aria-label":`Select version ${x.datasetVersion}`})}),o.jsx(Pt.RowButton,{item:x,columns:[{name:"version",label:"Item Version History",size:"1fr"}],isFeatured:h(x),onClick:()=>f(x),className:"py-2",children:o.jsx(Pt.VersionCell,{version:x.datasetVersion,date:S,isLatest:x.isLatest,isDeleted:x.isDeleted})})]},String(x.datasetVersion))})})})]})]})}function GTn(){return o.jsxs(Pt,{children:[o.jsx(Pt.Header,{columns:[{name:"version",label:"Item Version History",size:"1fr"}],children:o.jsx(Pt.HeaderCol,{children:"Item Version History"})}),o.jsx(Pt.Items,{children:Array.from({length:3}).map((e,t)=>o.jsx(Pt.Row,{children:o.jsx(Pt.RowButton,{columns:[{name:"version",label:"Item Version History",size:"1fr"}],children:o.jsx(Pt.TextCell,{isLoading:!0,children:"Loading..."})})},t))})]})}function ZTn(e,t){if(t){const r=typeof t=="string"?new Date(t):t;return`v${e} ${ur(r,"MMM dd 'at' H:mm:ss a")}`}return`v${e}`}function YTn({datasetId:e,versionA:t,versionB:r,onVersionChange:n}){const{data:s}=_ve(e),a=(s??[]).map(i=>({value:String(i.version),label:`${ZTn(i.version,i.createdAt)}${i.isCurrent?" (current)":""}`}));return o.jsxs(mr.Toolbar,{className:"grid grid-cols-[1fr_1fr_1fr_10rem] gap-4 w-full",children:[o.jsx("div",{}),o.jsx($o,{label:"Version A",labelIsHidden:!0,name:"version-a",placeholder:"Select version",options:a,value:t??"",onValueChange:i=>n?.(i,r??"")}),o.jsx($o,{label:"Version B",labelIsHidden:!0,name:"version-b",options:a,value:r??"",onValueChange:i=>n?.(t??"",i)}),o.jsx("div",{})]})}const XTn=[{name:"id",label:"ID",size:"1fr"},{name:"versionA",label:"Version A",size:"1fr"},{name:"versionB",label:"Version B",size:"1fr"},{name:"compare",label:"Compare",size:"10rem"}],KTn={added:{color:"blue",borderColor:"border-blue-900",icon:o.jsx(cs,{}),tooltip:"Added in this version"},changed:{color:"orange",borderColor:"border-yellow-900",icon:o.jsx(SVe,{}),tooltip:"Changed in this version"},same:{color:"green",borderColor:"border-green-900",icon:o.jsx(DMt,{}),tooltip:"Same in both versions"}};function tre({red:e=!1,tooltip:t}){return o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(mPt,{className:Z("text-neutral3/40 w-5 h-5 ",{"text-red-900":e})})}),t&&o.jsx(Wr,{children:t})]})}function rw({variant:e,version:t}){if(!e)return o.jsxs("span",{className:"text-ui-md text-neutral4",children:["v. ",t]});const{color:r,icon:n,tooltip:s}=KTn[e];return o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsxs("div",{className:"grid grid-cols-[1fr_auto]",children:[t!==void 0&&o.jsxs("span",{className:"pr-3 text-ui-md text-neutral4 min-w-16 flex justify-end",children:["v. ",t]}),o.jsx($a,{color:r,size:"small",children:n})]})}),o.jsx(Wr,{children:s})]})}function JTn(e,t){return e&&t&&e.datasetVersion===t.datasetVersion?"same":e&&t&&e.datasetVersion!==t.datasetVersion?"changed":e?"added":"removed"}function eNn({datasetId:e,versionA:t,versionB:r,allItems:n,itemsAMap:s,itemsBMap:a}){const{Link:i}=ir(),l=t>r;return o.jsx(Pt,{children:o.jsx(Pt.Scroller,{children:o.jsx(Pt.Items,{children:n.map(({id:c})=>{const u=s.get(c),d=a.get(c),f=JTn(u,d);return o.jsxs(Pt.Row,{columns:XTn,children:[o.jsx(Pt.IdCell,{id:c,isShortened:!1}),f!=="same"?o.jsxs(o.Fragment,{children:[u?.datasetVersion?o.jsx(Pt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"gap-2",children:!d&&l?o.jsx(rw,{variant:"added",version:u.datasetVersion}):f==="changed"&&l?o.jsx(rw,{variant:"changed",version:u.datasetVersion}):o.jsx(rw,{version:u.datasetVersion})}):o.jsx(Pt.Cell,{className:"justify-center flex items-center",children:o.jsx(tre,{red:l,tooltip:l?"Deleted in this version":"Not present in this version"})}),d?.datasetVersion?o.jsx(Pt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"gap-2",children:!u&&!l?o.jsx(rw,{variant:"added",version:d.datasetVersion}):f==="changed"&&!l?o.jsx(rw,{variant:"changed",version:d.datasetVersion}):o.jsx(rw,{version:d.datasetVersion})}):o.jsx(Pt.Cell,{className:"justify-center flex items-center",children:o.jsx(tre,{red:!l,tooltip:l?"Not present in this version":"Deleted in this version"})})]}):o.jsx(Pt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"col-span-2 gap-2",children:o.jsx(rw,{variant:"same",version:d?.datasetVersion})}),f==="changed"?o.jsx(Pt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}/versions?ids=${u?.datasetVersion},${d?.datasetVersion}`,children:"Compare"}):o.jsx(Pt.Cell,{children:o.jsx(tre,{tooltip:o.jsxs(o.Fragment,{children:["Comparing is available",o.jsx("br",{})," only for changed items"]})})})]},c)})})})})}const LBe={needsReview:"#facc15",complete:"#22c55e"},tNn=[{label:"Needs Review",color:LBe.needsReview},{label:"Reviewed",color:LBe.complete}];function rNn({reviewSummary:e,experiments:t,datasets:r,isLoading:n,isError:s}){const{data:a,maxVal:i,totalInPipeline:l}=b.useMemo(()=>{if(!e?.counts||!t)return{data:[],maxVal:0,totalInPipeline:0};const u=new Map;for(const m of t)u.set(m.id,m);const d=new Map;if(r)for(const m of r)d.set(m.id,m.name);let f=0,h=0;const p=[];for(const m of e.counts){const g=m.needsReview+m.complete;if(g===0)continue;h+=g,g>f&&(f=g);const y=u.get(m.experimentId),x=y?.datasetId?d.get(y.datasetId):void 0,w=x?`${x} · ${m.experimentId.slice(0,8)}`:m.experimentId.slice(0,8);p.push({name:w,values:[m.needsReview,m.complete]})}return{data:p,maxVal:f,totalInPipeline:h}},[e,t,r]),c=a.length>0;return o.jsxs(Ht,{children:[o.jsxs(Ht.TopBar,{children:[o.jsx(Ht.TitleAndDescription,{title:"Review Pipeline",description:"Items in review across experiments."}),c&&o.jsx(Ht.Summary,{value:String(l),label:"Items in pipeline"})]}),n?o.jsx(Ht.Loading,{}):s?o.jsx(Ht.Error,{message:"Failed to load review data"}):o.jsx(Ht.Content,{children:c?o.jsx(J_,{data:a,segments:tNn,maxVal:i,fmt:u=>String(u)}):o.jsx(Ht.NoData,{message:"No items have been sent to review yet"})})]})}function Tve(){const e=Ge();return kt({queryKey:["experiment-review-summary"],queryFn:()=>e.getExperimentReviewSummary()})}function R1t(e){const t=new Map;if(!e?.counts)return t;for(const r of e.counts)t.set(r.experimentId,{needsReview:r.needsReview,complete:r.complete,total:r.total});return t}function nNn(e,t){const r=new Map,n=R1t(e);if(!n.size||!t)return r;for(const s of t){const a=n.get(s.id);if(!a||!s.datasetId||a.needsReview+a.complete===0)continue;const l=r.get(s.datasetId)??{needsReview:0,complete:0};l.needsReview+=a.needsReview,l.complete+=a.complete,r.set(s.datasetId,l)}return r}function sNn(e){return e?.counts?e.counts.reduce((t,r)=>({needsReview:t.needsReview+r.needsReview,complete:t.complete+r.complete,inPipeline:t.inPipeline+r.needsReview+r.complete}),{needsReview:0,complete:0,inPipeline:0}):{needsReview:0,complete:0,inPipeline:0}}const aNn=10;function iNn(){const[e,t]=b.useState(!1),[r,n]=b.useState(""),[s,a]=b.useState("all"),[i,l]=b.useState("all"),[c,u]=b.useState("all"),[d,f]=b.useState(0),{data:h,isLoading:p,error:m}=zh({page:d,perPage:aNn}),{data:g,isLoading:y,error:x}=K8(),{data:w}=Tve(),S=b.useMemo(()=>h?.datasets??[],[h?.datasets]),k=h?.pagination?.hasMore??!1,_=b.useMemo(()=>g?.experiments??[],[g?.experiments]),E=b.useMemo(()=>_jn(S),[S]),T=b.useMemo(()=>nNn(w,_),[w,_]),j=p||y,N=m||x,I=()=>t(!0),P=b.useCallback(()=>f(W=>W+1),[]),R=b.useCallback(()=>f(W=>Math.max(0,W-1)),[]),$=b.useCallback(W=>{n(W),f(0)},[]),M=b.useCallback(W=>{a(W),f(0)},[]),z=b.useCallback(W=>{l(W),f(0)},[]),U=b.useCallback(W=>{u(W),f(0)},[]);if(N&&Ps(N))return o.jsx(Jr,{title:"Datasets",icon:o.jsx(ja,{}),children:o.jsx(na,{})});if(N&&ks(N))return o.jsx(Jr,{title:"Datasets",icon:o.jsx(ja,{}),children:o.jsx(Gs,{resource:"datasets"})});if(N)return o.jsx(Jr,{title:"Datasets",icon:o.jsx(ja,{}),children:o.jsx(gu,{title:"Failed to load datasets",message:N.message})});if(S.length===0&&!j&&d===0)return o.jsxs(o.Fragment,{children:[o.jsx(Jr,{title:"Datasets",icon:o.jsx(ja,{}),children:o.jsx(Ejn,{onCreateClick:I})}),o.jsx(Tle,{open:e,onOpenChange:t})]});const B=s!=="all"||i!=="all"||c!=="all"||r!=="",H=()=>{n(""),a("all"),l("all"),u("all"),f(0)};return o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:j,children:[o.jsx(ja,{})," Datasets"]})})}),o.jsxs(bt.Column,{className:"flex justify-end gap-2",children:[o.jsx(Cn,{onClick:I,tooltipContent:"Create a dataset",children:o.jsx(cs,{})}),o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/evals/datasets/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Datasets documentation",children:o.jsx(Di,{})})]})]}),o.jsx(jjn,{search:r,onSearchChange:$,targetFilter:s,onTargetFilterChange:M,experimentFilter:i,onExperimentFilterChange:z,tagFilter:c,onTagFilterChange:U,tagOptions:E,onReset:H,hasActiveFilters:B})]}),o.jsx(Sjn,{datasets:S,experiments:_,reviewByDataset:T,isLoading:j,search:r,targetFilter:s,experimentFilter:i,tagFilter:c,currentPage:d,hasMore:k,onNextPage:P,onPrevPage:R}),o.jsx(Tle,{open:e,onOpenChange:t})]})}const oNn=new Set(["items","experiments","review"]);function lNn(){const{datasetId:e}=ra(),t=fu(),[r,n]=so(),s=r.get("tab"),a=s&&oNn.has(s)?s:"items",i=E=>{n(E==="items"?{}:{tab:E},{replace:!0})},[l,c]=b.useState(!1),[u,d]=b.useState(!1),[f,h]=b.useState(!1),[p,m]=b.useState(!1),[g,y]=b.useState(null),{data:x,error:w}=Ig(e??"");if(!e)return o.jsx(zr,{children:o.jsx(pf,{children:o.jsx("div",{className:"text-neutral3 p-4",children:"Dataset not found"})})});if(w&&Ps(w))return o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})});if(w&&ks(w))return o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})});const S=E=>{t(`/datasets/${e}/experiments/${E}`)},k=()=>{t("/datasets")},_=E=>{y(E?.version??null)};return o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:o.jsx(Pjn,{value:e,variant:"ghost"})})]})}),o.jsxs(pf,{className:"content-stretch",children:[o.jsx(vTn,{datasetId:e,onAddItemClick:()=>d(!0),onEditClick:()=>h(!0),onDeleteClick:()=>m(!0),activeDatasetVersion:g,onVersionSelect:_,initialTab:a,onTabChange:i,experimentTriggerSlot:o.jsxs(pe,{variant:"primary",onClick:()=>c(!0),children:[o.jsx(gx,{}),g!=null?`Run on v${g}`:"Run Experiment"]})}),o.jsx(kTn,{datasetId:e,version:g??void 0,open:l,onOpenChange:c,onSuccess:S}),o.jsx(xTn,{datasetId:e,open:u,onOpenChange:d}),x&&o.jsx(Ijn,{open:f,onOpenChange:h,dataset:{id:x.id,name:x.name,description:x?.description||"",inputSchema:x.inputSchema,groundTruthSchema:x.groundTruthSchema}}),x&&o.jsx(Rjn,{open:p,onOpenChange:m,datasetId:x.id,datasetName:x.name,onSuccess:k})]})]})}function cNn(){const{datasetId:e,experimentId:t}=ra(),{data:r}=Ig(e??""),{data:n,isLoading:s,error:a}=V6(e,t),{data:i,isLoading:l,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d}=X8({datasetId:e,experimentId:t,experimentStatus:n?.status});return!e||!t?null:s?o.jsx(zr,{children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(Mt,{})})}):a&&Ps(a)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):a&&ks(a)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})}):a||!n?o.jsx(zr,{children:o.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",a instanceof Error?a.message:"Unknown error"]})}):o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:dr,to:`/datasets/${e}`,children:r?.name}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Experiment"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsx(I1t,{experimentId:t,experiment:n}),o.jsx(A1t,{experimentId:t,experimentStatus:n?.status,results:i??[],isLoading:l,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d})]})})]})}function uNn(){const{datasetId:e}=ra(),[t,r]=so(),{data:n,error:s}=Ig(e??""),a=t.get("baseline")??"",i=t.get("contender")??"";return s&&Ps(s)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):s&&ks(s)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})}):!e||!a||!i?o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsxs(jr,{isCurrent:!0,as:"span",children:[o.jsx(Ce,{children:o.jsx(qm,{})}),"Compare Experiments"]})]})}),o.jsx(pf,{children:o.jsxs("div",{className:"text-neutral4 text-center py-8",children:[o.jsx("p",{children:"Select two experiments to compare."}),o.jsxs("p",{className:"text-sm mt-2",children:["Use the URL format: /datasets/","{datasetId}","/experiments?baseline=","{experimentIdA}","&contender=","{experimentIdB}"]})]})})]}):o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:dr,to:`/datasets/${e}`,children:n?.name??e?.slice(0,8)}),o.jsxs(jr,{isCurrent:!0,as:"span",children:[o.jsx(Ce,{children:o.jsx(qm,{})}),"Experiments Comparison"]})]})}),o.jsx(pf,{children:o.jsxs("div",{className:"max-w-[100rem] w-full px-12 mx-auto grid content-start ",children:[o.jsxs(Ir,{children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{children:[o.jsx(qm,{})," Dataset Experiments Comparison"]}),o.jsxs(Ir.Description,{children:["Comparing"," ",o.jsx(dr,{to:`/datasets/${e}/experiments/${a}`,children:a.slice(0,8)})," vs"," ",o.jsx(dr,{to:`/datasets/${e}/experiments/${i}`,children:i.slice(0,8)})]})]}),o.jsx(Ir.Column,{children:o.jsxs(pe,{as:dr,to:`/datasets/${e}`,children:[o.jsx(_p,{}),"Back to Dataset"]})})]}),o.jsx(QTn,{datasetId:e,experimentIdA:a,experimentIdB:i,onSwap:()=>{r({baseline:i,contender:a})}})]})})]})}function dNn(){const{datasetId:e,itemId:t}=ra(),{Link:r}=ir(),n=fu(),{data:s,isLoading:a,error:i}=Cve(e??"",t??""),{updateItem:l,deleteItem:c}=ri(),{data:u}=Ig(e??""),d=s?.[0]??null,f=d?.isDeleted??!1,[h,p]=b.useState(null),m=b.useMemo(()=>!d||f?{input:"",groundTruth:"",metadata:""}:{input:JSON.stringify(d.input,null,2),groundTruth:d.groundTruth?JSON.stringify(d.groundTruth,null,2):"",metadata:d.metadata?JSON.stringify(d.metadata,null,2):""},[d,f]),g=d?.datasetVersion??0,[y,x]=b.useState(!1),[w,S]=b.useState(m.input),[k,_]=b.useState(m.groundTruth),[E,T]=b.useState(m.metadata),[j,N]=b.useState(g);g!==j&&(N(g),S(m.input),_(m.groundTruth),T(m.metadata));const[I,P]=b.useState(!1),R=q=>{p(f?q:q.isLatest?null:q)},$=()=>{p(null)},M=!f&&h!=null,z=()=>{M||x(!0)},U=()=>{M||P(!0)},B=async()=>{if(!e||!t)return;let q;try{q=JSON.parse(w)}catch{ze.error("Input must be valid JSON");return}let D;if(k.trim())try{D=JSON.parse(k)}catch{ze.error("Ground Truth must be valid JSON");return}let Q;if(E.trim())try{Q=JSON.parse(E)}catch{ze.error("Metadata must be valid JSON");return}try{await l.mutateAsync({datasetId:e,itemId:t,input:q,groundTruth:D,metadata:Q}),ze.success("Item updated successfully"),x(!1)}catch(G){ze.error(`Failed to update item: ${G instanceof Error?G.message:"Unknown error"}`)}},H=()=>{d&&(S(JSON.stringify(d.input,null,2)),_(d.groundTruth?JSON.stringify(d.groundTruth,null,2):""),T(d.metadata?JSON.stringify(d.metadata,null,2):"")),x(!1)},W=async()=>{if(!(!e||!t))try{await c.mutateAsync({datasetId:e,itemId:t}),ze.success("Item deleted successfully"),P(!1),n(`/datasets/${e}`)}catch(q){ze.error(`Failed to delete item: ${q instanceof Error?q.message:"Unknown error"}`)}},L=h??d,Y=L?{id:t??"",datasetId:e??"",datasetVersion:L.datasetVersion,input:L.input,groundTruth:L.groundTruth,metadata:L.metadata,createdAt:L.createdAt,updatedAt:L.updatedAt}:null;return i&&Ps(i)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):i&&ks(i)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})}):a?null:!e||!t||!s||s.length===0?o.jsx(zr,{children:o.jsx(pf,{children:o.jsx("div",{className:"text-neutral3 p-4",children:"Item not found"})})}):o.jsxs(o.Fragment,{children:[o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:dr,to:`/datasets/${e}`,children:u?.name}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Item"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-6 pb-4",children:o.jsxs("div",{className:"grid gap-6 max-w-[60rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsxs(Ir,{children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{children:[o.jsx(px,{}),t," ",o.jsx(Xa,{content:t})]}),o.jsx(Ir.Description,{children:o.jsxs(fs,{children:["Item of ",o.jsx(ja,{})," ",u?.name]})}),o.jsxs(Ir.Description,{children:[o.jsxs(fs,{children:[o.jsx(g_,{})," Created at"," ",d?.createdAt?ur(new Date(d.createdAt),"MMM d, yyyy"):""]}),o.jsxs(fs,{children:[o.jsx(Qx,{})," Latest version v",d?.datasetVersion??""]})]})]}),o.jsx(Ir.Column,{children:!y&&!f&&o.jsxs(ps,{children:[o.jsxs(pe,{onClick:z,disabled:M,title:M?"Return to latest version to edit":void 0,children:[o.jsx(SVe,{})," Edit"]}),o.jsxs(pe,{onClick:U,disabled:M,title:M?"Return to latest version to delete":void 0,children:[o.jsx(nd,{})," Delete"]})]})})]}),o.jsxs(sf,{className:y?"grid-cols-1":"grid-cols-[1fr_auto]",children:[o.jsxs(mr,{withRightSeparator:!y,children:[f&&d&&o.jsxs(gl,{variant:"destructive",children:[o.jsx(kh,{}),o.jsxs(gl.Message,{children:["This item was deleted at version v",d.datasetVersion]})]}),!f&&M&&h&&o.jsx(o.Fragment,{children:o.jsxs(gl,{variant:"warning",children:[o.jsx(kh,{}),o.jsxs(gl.Message,{children:["Viewing version v",h.datasetVersion]}),o.jsxs(gl.Button,{onClick:$,children:[o.jsx(mw,{})," Return to the latest version"]})]})}),y?o.jsx(k1t,{inputValue:w,setInputValue:S,groundTruthValue:k,setGroundTruthValue:_,metadataValue:E,setMetadataValue:T,validationErrors:null,onSave:B,onCancel:H,isSaving:l.isPending}):Y?o.jsx(J8,{item:Y,Link:r}):o.jsx("div",{className:"text-neutral4 text-sm",children:"Item data not available"})]}),!y&&o.jsx(mr,{children:o.jsx(WTn,{datasetId:e,itemId:t,onClose:()=>{},onVersionSelect:R,onCompareVersionsClick:q=>{n(`/datasets/${e}/items/${t}/versions?ids=${q.join(",")}`)},activeVersion:h?.datasetVersion??null})})]})]})})]}),o.jsx(Bt,{open:I,onOpenChange:P,children:o.jsxs(Bt.Content,{children:[o.jsxs(Bt.Header,{children:[o.jsx(Bt.Title,{children:"Delete Item"}),o.jsx(Bt.Description,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),o.jsxs(Bt.Footer,{children:[o.jsx(Bt.Cancel,{children:"Cancel"}),o.jsx(Bt.Action,{onClick:W,children:c.isPending?"Deleting...":"Delete"})]})]})})]})}function $Be(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function fNn(){const{datasetId:e}=ra(),[t,r]=so(),n=t.get("items")?.split(",").filter(Boolean)??[],{data:s,error:a}=Ig(e??""),{Link:i}=ir(),[l,c]=b.useState(!1),{data:u}=Ele(e??"",n[0]??""),{data:d}=Ele(e??"",n[1]??"");return a&&Ps(a)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):a&&ks(a)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})}):!e||n.length<2?o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Compare Items"})]})}),o.jsx(pf,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two items to compare."})})})]}):o.jsxs(zr,{children:[o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:dr,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Compare Items"})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:`/datasets/${e}`,variant:"outline",children:[o.jsx(Ce,{children:o.jsx(_p,{})}),"Back to Dataset"]})})]}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:Z("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":l}),children:[o.jsxs(Ir,{children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{children:[o.jsx(qm,{}),"Compare Dataset Items"]}),o.jsx(Ir.Description,{children:o.jsxs(fs,{children:["Comparing ",n.length," items of"," ",o.jsx(dr,{to:`/datasets/${e}`,className:"text-info1 hover:underline",children:s?.name||e?.slice(0,8)})]})})]}),o.jsx(Ir.Column,{children:o.jsxs(ps,{children:[o.jsxs(pe,{as:dr,to:`/datasets/${e}`,children:[o.jsx(_p,{}),"Back to Dataset"]}),o.jsx(pe,{variant:"primary",onClick:()=>c(f=>!f),children:l?o.jsxs(o.Fragment,{children:[o.jsx(dVe,{})," Default View"]}):o.jsxs(o.Fragment,{children:[o.jsx(jMt,{})," Diff View"]})})]})})]}),o.jsx(sf,{className:"grid-cols-[1fr_3vw_1fr]",children:n.map((f,h)=>o.jsxs(b.Fragment,{children:[o.jsx(hNn,{datasetId:e,itemId:f,Link:i,idx:h,itemIds:n,showContent:!l,onItemChange:p=>{const m=[...n];m[h]=p,r({items:m.join(",")})}}),h==0&&o.jsx("div",{className:Z("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},f))}),l&&u&&d&&o.jsx(kft,{codeA:$Be(u),codeB:$Be(d)})]})})]})}function hNn({datasetId:e,itemId:t,Link:r,idx:n,itemIds:s,onItemChange:a,showContent:i=!0}){const{data:l,isLoading:c}=Ele(e,t),{data:u}=kE(e),d=new Set(s.filter((h,p)=>p!==n)),f=(u??[]).map(h=>({value:h.id,label:h.id,disabled:d.has(h.id)}));return o.jsxs(mr,{children:[o.jsxs(mr.Toolbar,{className:"flex gap-4",children:[o.jsx(ege,{label:"Item",name:`compare-item-${n}`,value:t,onValueChange:a,options:f,placeholder:"Select item",labelIsHidden:!0}),o.jsxs(pe,{as:r,to:`/datasets/${e}/items/${t}`,children:[o.jsx(Qx,{}),"Versions"]})]}),i&&o.jsx(mr.Content,{children:c?o.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):l?o.jsxs(o.Fragment,{children:[o.jsx(_1t,{item:l}),o.jsx(J8,{item:l,Link:r})]}):o.jsxs("div",{className:"text-neutral4 text-sm",children:["Item ",t.slice(0,8)," not found"]})})]})}function FBe(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function pNn(){const{datasetId:e,itemId:t}=ra(),[r,n]=so(),[s,a]=b.useState(!1),i=r.get("ids")?.split(",").map(Number).filter(p=>!isNaN(p)&&p>0)??[],{data:l,error:c}=Ig(e??""),{Link:u}=ir(),{data:d}=Cve(e??"",t??""),{data:f}=Ale(e??"",t??"",i[0]??0,l?.version),{data:h}=Ale(e??"",t??"",i[1]??0,l?.version);return c&&Ps(c)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):c&&ks(c)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})}):!e||!t||i.length<2?o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),o.jsx(pf,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two versions to compare."})})})]}):o.jsxs(zr,{children:[o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:dr,to:`/datasets/${e}`,children:l?.name}),o.jsx(jr,{as:dr,to:`/datasets/${e}/items/${t}`,children:"Item"}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Compare Versions"})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:`/datasets/${e}/items/${t}`,variant:"outline",children:[o.jsx(Ce,{children:o.jsx(_p,{})}),"Back to Item"]})})]}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:Z("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":s}),children:[o.jsxs(Ir,{children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{children:[o.jsx(qm,{}),"Compare Dataset Item Versions"]}),o.jsx(Ir.Description,{children:o.jsxs(fs,{children:["Comparing ",i.length," versions of"," ",o.jsx(dr,{to:`/datasets/${e}/items/${t}`,className:"text-info1 hover:underline",children:t})]})})]}),o.jsx(Ir.Column,{children:o.jsxs(ps,{children:[o.jsxs(pe,{as:dr,to:`/datasets/${e}/items/${t}`,children:[o.jsx(_p,{}),"Back to Item"]}),o.jsx(pe,{variant:"primary",onClick:()=>a(p=>!p),children:s?o.jsxs(o.Fragment,{children:[o.jsx(dVe,{})," Default View"]}):o.jsxs(o.Fragment,{children:[o.jsx(d2t,{})," Diff View"]})})]})})]}),o.jsx(sf,{className:"grid-cols-[1fr_3vw_1fr]",children:i.map((p,m)=>o.jsxs(b.Fragment,{children:[o.jsx(mNn,{datasetId:e,itemId:t,datasetVersion:p,latestVersion:l?.version,allVersions:d??[],versionNumbers:i,Link:u,idx:m,showContent:!s,onVersionChange:g=>{const y=[...i];y[m]=g,n({ids:y.join(",")})}}),m===0&&o.jsx("div",{className:Z("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},p))}),s&&f&&h&&o.jsx(kft,{codeA:FBe(f),codeB:FBe(h)})]})})]})}function mNn({datasetId:e,itemId:t,datasetVersion:r,latestVersion:n,allVersions:s,versionNumbers:a,Link:i,idx:l,showContent:c=!0,onVersionChange:u}){const{data:d,isLoading:f}=Ale(e,t,r,n),h=new Set(a.filter((g,y)=>y!==l)),p=s.map(g=>{const y=typeof g.updatedAt=="string"?new Date(g.updatedAt):g.updatedAt;return{value:String(g.datasetVersion),label:o.jsxs(o.Fragment,{children:[o.jsxs("b",{children:["v. ",g.datasetVersion]})," - ",ur(y,"MMM d, yyyy h:mm a"),g.isLatest?o.jsx($a,{color:"blue",size:"small",children:"Latest"}):null]}),disabled:h.has(g.datasetVersion)}}),m=d?{id:d.id,datasetId:e,datasetVersion:d.datasetVersion,input:d.input,groundTruth:d.groundTruth,metadata:d.metadata,createdAt:d.createdAt,updatedAt:d.updatedAt}:null;return o.jsxs(mr,{children:[o.jsxs(mr.Toolbar,{className:"grid gap-4 grid-cols-[auto_1fr]",children:[o.jsx(Qx,{className:"w-6 h-6 opacity-50"}),o.jsx(ege,{label:"Version",name:`compare-version-${l}`,value:String(r),onValueChange:g=>u(Number(g)),options:p,placeholder:"Select version",labelIsHidden:!0,className:"w-full"})]}),c&&o.jsx(mr.Content,{children:f?o.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):!d||!m?o.jsxs("div",{className:"text-neutral4 text-sm",children:["Version ",r," not found"]}):o.jsx(J8,{item:m,Link:i})})]})}function gNn(){const{datasetId:e}=ra(),[t]=so(),r=t.get("ids")?.split(",").map(Number).filter(g=>!isNaN(g)&&g>0)??[],n=fu(),{data:s,error:a}=Ig(e??""),i=kE(e??"",void 0,r[0]??null),l=kE(e??"",void 0,r[1]??null),c=b.useMemo(()=>i.data??[],[i.data]),u=b.useMemo(()=>l.data??[],[l.data]),d=b.useMemo(()=>{const g=new Map;for(const y of[...c,...u])g.has(y.id)||g.set(y.id,{id:y.id,createdAt:new Date(y.createdAt)});return[...g.values()].sort((y,x)=>x.createdAt.getTime()-y.createdAt.getTime())},[c,u]),f=b.useMemo(()=>new Map(c.map(g=>[g.id,g])),[c]),h=b.useMemo(()=>new Map(u.map(g=>[g.id,g])),[u]);if(a&&Ps(a))return o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})});if(a&&ks(a))return o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})});if(!e||r.length<2)return o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),o.jsx(pf,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two versions to compare."})})})]});const p=(g,y,x)=>{n(`/datasets/${e}/items/${g}/versions?ids=${y?.datasetVersion??""},${x?.datasetVersion??""}`)},m=(g,y)=>{n(`/datasets/${e}/versions?ids=${g},${y}`,{replace:!0})};return o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:dr,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),o.jsxs(jr,{isCurrent:!0,as:"span",children:[o.jsx(Ce,{children:o.jsx(lSe,{})}),"Compare Versions"]})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsxs(Ir,{children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{children:[o.jsx(lSe,{})," Compare Dataset Versions"]}),o.jsx(Ir.Description,{children:o.jsxs(fs,{children:[o.jsx(Qx,{})," Comparing ",r.length," versions of"," ",s?.name||e?.slice(0,8)]})})]}),o.jsx(Ir.Column,{children:o.jsxs(pe,{as:dr,to:`/datasets/${e}`,children:[o.jsx(_p,{}),"Back to Dataset"]})})]}),o.jsx(sf,{children:o.jsxs(mr,{children:[o.jsx(YTn,{datasetId:e,versionA:String(r[0]),versionB:String(r[1]),onVersionChange:m}),o.jsx(eNn,{datasetId:e,versionA:r[0],versionB:r[1],allItems:d,itemsAMap:f,itemsBMap:h,onItemClick:p})]})})]})})]})}function yNn(e){if(!e||e.length<2)return null;const t=[...e].sort((i,l)=>new Date(i.createdAt).getTime()-new Date(l.createdAt).getTime()),r=Math.floor(t.length/2),n=r,s=t.length-r;if(n===0)return null;const a=(s-n)/n*100;return{changePct:Math.round(a*10)/10,prevValue:String(n)}}function vNn({scorers:e,datasets:t,experiments:r,avgScore:n,prevAvgScore:s,totalNeedsReview:a,isLoadingScorers:i,isLoadingDatasets:l,isLoadingExperiments:c,isLoadingScores:u,isLoadingReview:d}){const f=e?Object.keys(e).length:void 0,h=t?.length,p=r?.length,m=n!=null&&s!=null&&s!==0?{changePct:Math.round((n-s)/s*100*10)/10,prevValue:String(s)}:null,g=yNn(r);return o.jsxs(o.Fragment,{children:[o.jsxs(On,{children:[o.jsx(On.Label,{children:"Total Scorers"}),i?o.jsx(On.Loading,{}):f!=null?o.jsxs(o.Fragment,{children:[o.jsx(On.Value,{children:String(f)}),o.jsx(On.NoChange,{message:"Static count"})]}):o.jsx(On.NoData,{})]}),o.jsxs(On,{children:[o.jsx(On.Label,{children:"Total Datasets"}),l?o.jsx(On.Loading,{}):h!=null?o.jsxs(o.Fragment,{children:[o.jsx(On.Value,{children:String(h)}),o.jsx(On.NoChange,{message:"Static count"})]}):o.jsx(On.NoData,{})]}),o.jsxs(On,{children:[o.jsx(On.Label,{children:"Avg Score"}),u?o.jsx(On.Loading,{}):n!=null?o.jsxs(o.Fragment,{children:[o.jsx(On.Value,{children:String(n)}),m?o.jsx(On.Change,{changePct:m.changePct,prevValue:m.prevValue}):o.jsx(On.NoChange,{})]}):o.jsx(On.NoData,{})]}),o.jsxs(On,{children:[o.jsx(On.Label,{children:"Total Experiments"}),c?o.jsx(On.Loading,{}):p!=null?o.jsxs(o.Fragment,{children:[o.jsx(On.Value,{children:String(p)}),g?o.jsx(On.Change,{changePct:g.changePct,prevValue:g.prevValue}):o.jsx(On.NoChange,{})]}):o.jsx(On.NoData,{})]}),o.jsxs(On,{children:[o.jsx(On.Label,{children:"Needs Review"}),d?o.jsx(On.Loading,{}):a!=null?o.jsxs(o.Fragment,{children:[o.jsx(On.Value,{children:String(a)}),a>0?o.jsx(On.NoChange,{message:"items pending review"}):o.jsx(On.NoChange,{message:"All caught up"})]}):o.jsx(On.NoData,{})]})]})}const bNn=[{value:"all",label:"All statuses"},{value:"completed",label:"Completed"},{value:"running",label:"Running"},{value:"failed",label:"Failed"},{value:"pending",label:"Pending"}],zBe="auto 1fr auto auto auto auto auto auto auto";function xNn(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}const wNn={completed:"success",running:"warning",failed:"error",pending:"neutral"};function SNn({experiments:e,datasets:t,reviewByExperiment:r,isLoading:n,search:s="",statusFilter:a="all",datasetFilter:i="all"}){const{paths:l,Link:c}=ir(),u=b.useMemo(()=>{const h=new Map;return t?.forEach(p=>h.set(p.id,p.name)),h},[t]),d=b.useMemo(()=>[...e].sort((h,p)=>{const m=h.createdAt?new Date(h.createdAt).getTime():0;return(p.createdAt?new Date(p.createdAt).getTime():0)-m}),[e]),f=b.useMemo(()=>{const h=s.toLowerCase();return d.filter(p=>{const m=p.datasetId?u.get(p.datasetId)??"":"",g=!h||p.id.toLowerCase().includes(h)||m.toLowerCase().includes(h)||(p.targetId??"").toLowerCase().includes(h),y=a==="all"||p.status===a,x=i==="all"||p.datasetId===i;return g&&y&&x})},[d,s,u,a,i]);return n?o.jsx(bh,{columns:zBe}):o.jsxs(we,{columns:zBe,children:[o.jsxs(we.Top,{children:[o.jsx(we.TopCell,{children:"Experiment"}),o.jsx(we.TopCell,{children:"Dataset"}),o.jsx(we.TopCell,{children:"Target"}),o.jsx(we.TopCell,{children:"Status"}),o.jsx(we.TopCell,{className:"text-center",children:"Items"}),o.jsx(we.TopCell,{className:"text-center",children:"Succeeded"}),o.jsx(we.TopCell,{className:"text-center",children:"Failed"}),o.jsx(we.TopCell,{className:"text-center",children:"Review"}),o.jsx(we.TopCell,{children:"Date"})]}),f.map(h=>{const p=h.datasetId?u.get(h.datasetId)??h.datasetId.slice(0,8):"—",m=h.status??"pending",g=h.succeededCount??0,y=h.failedCount??0,x=h.totalItems??0,w=x>0?Math.round(g/x*100):0;return o.jsxs(we.RowLink,{to:l.experimentLink(h.id),LinkComponent:c,children:[o.jsx(we.NameCell,{className:"font-mono",children:h.id.slice(0,8)}),o.jsx(we.TextCell,{children:p}),o.jsx(we.Cell,{children:o.jsxs("span",{className:"truncate",children:[h.targetType," ",h.targetId]})}),o.jsx(we.Cell,{children:o.jsx(MP,{variant:wNn[m]??"neutral",withDot:!0,children:m})}),o.jsx(we.TextCell,{className:"text-center",children:x}),o.jsx(we.TextCell,{className:"text-center",children:o.jsxs("span",{className:g>0?"text-accent1":"",children:[g," (",w,"%)"]})}),o.jsx(we.TextCell,{className:"text-center",children:o.jsx("span",{className:y>0?"text-accent2":"",children:y})}),o.jsx(we.Cell,{className:"text-center",children:(()=>{const S=r?.get(h.id);if(!S)return o.jsx("span",{className:"text-neutral2",children:"—"});const k=S.needsReview+S.complete;return k===0?o.jsx("span",{className:"text-neutral2",children:"—"}):S.needsReview>0?o.jsxs(gt,{variant:"warning",children:[S.needsReview," pending"]}):o.jsxs(gt,{variant:"success",children:[S.complete,"/",k," reviewed"]})})()}),o.jsx(we.TextCell,{children:xNn(h.createdAt)})]},h.id)})]})}function ONn(e){return[{value:"all",label:"All datasets"},...(e??[]).map(t=>({value:t.id,label:t.name}))]}const LL={completed:"#22c55e",running:"#facc15",pending:"#fb923c",failed:"#f87171"},kNn=[{label:"Completed",color:LL.completed},{label:"Running",color:LL.running},{label:"Pending",color:LL.pending},{label:"Failed",color:LL.failed}];function _Nn({experiments:e,datasets:t,isLoading:r,isError:n}){const{data:s,maxVal:a}=b.useMemo(()=>{if(!e||e.length===0)return{data:[],maxVal:0};const l=new Map;if(t)for(const f of t)l.set(f.id,f.name);const c=new Map;for(const f of e){const h=f.datasetId??"unknown";c.has(h)||c.set(h,{completed:0,running:0,pending:0,failed:0});const p=c.get(h),m=f.status;m in p&&p[m]++}let u=0;return{data:Array.from(c.entries()).map(([f,h])=>{const p=h.completed+h.running+h.pending+h.failed;return p>u&&(u=p),{name:l.get(f)??f.slice(0,12),values:[h.completed,h.running,h.pending,h.failed]}}),maxVal:u}},[e,t]),i=s.length>0;return o.jsxs(Ht,{children:[o.jsxs(Ht.TopBar,{children:[o.jsx(Ht.TitleAndDescription,{title:"Experiments by Dataset",description:"Experiment status breakdown per dataset."}),i&&o.jsx(Ht.Summary,{value:String(e?.length??0),label:"Total experiments"})]}),r?o.jsx(Ht.Loading,{}):n?o.jsx(Ht.Error,{message:"Failed to load experiments data"}):o.jsx(Ht.Content,{children:i?o.jsx(J_,{data:s,segments:kNn,maxVal:a,fmt:l=>String(l)}):o.jsx(Ht.NoData,{message:"No experiments have been run yet"})})]})}const ENn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(xf,{}),titleSlot:"No Experiments yet",descriptionSlot:o.jsxs(o.Fragment,{children:["Run an experiment from a dataset to evaluate ",o.jsx("br",{}),"your agents and workflows."]}),actionSlot:o.jsx("div",{className:"flex flex-col items-center gap-2",children:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/evals/datasets/running-experiments",target:"_blank",rel:"noopener noreferrer",children:["Experiments Documentation ",o.jsx(ya,{})]})})})});function CNn({search:e,onSearchChange:t,statusFilter:r,onStatusFilterChange:n,datasetFilter:s,onDatasetFilterChange:a,datasetOptions:i,onReset:l,hasActiveFilters:c}){return o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(_g,{label:"Search experiments",placeholder:"Filter by experiment, dataset, or target",value:e,onSearch:t}),o.jsxs(ps,{children:[o.jsx($o,{label:"Status",labelIsHidden:!0,name:"filter-status",options:[...bNn],value:r,onValueChange:n,className:"whitespace-nowrap"}),o.jsx($o,{label:"Dataset",labelIsHidden:!0,name:"filter-dataset",options:i,value:s,onValueChange:a,className:"whitespace-nowrap"}),l&&c&&o.jsxs(pe,{onClick:l,size:"sm",variant:"light",children:[o.jsx(Nn,{className:"size-3"})," Reset"]})]})]})}function jNn(){const{data:e,isLoading:t,error:r}=fd(),{data:n,isLoading:s,error:a}=zh(),{data:i,isLoading:l,error:c}=K8(),{data:u,isLoading:d,isError:f,error:h}=P1n(),{data:p,isLoading:m,isError:g,error:y}=Tve(),x=n?.datasets,w=i?.experiments,S=b.useMemo(()=>sNn(p),[p]),k=r||a||c||h||y;return k&&Ps(k)?o.jsx(Jr,{title:"Evaluation",icon:o.jsx(Au,{}),children:o.jsx(na,{})}):k&&ks(k)?o.jsx(Jr,{title:"Evaluation",icon:o.jsx(Au,{}),children:o.jsx(Gs,{resource:"evaluation"})}):k?o.jsx(Jr,{title:"Evaluation",icon:o.jsx(Au,{}),children:o.jsx(gu,{title:"Failed to load evaluation data",message:k.message})}):o.jsxs(bt,{width:"wide",height:"full",children:[o.jsx(bt.TopArea,{className:"sticky top-0 z-100 bg-surface1 ",children:o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{children:[o.jsx(Au,{})," Evaluation"]})})}),o.jsx(bt.Column,{className:"flex justify-end gap-2",children:o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Evaluation documentation",children:o.jsx(Di,{})})})]})}),o.jsxs("div",{className:"flex flex-col gap-6 pt-4",children:[o.jsx(die,{children:o.jsx(vNn,{scorers:e,datasets:x,experiments:w,avgScore:u?.avgScore??null,prevAvgScore:u?.prevAvgScore??null,totalNeedsReview:S.needsReview,isLoadingScorers:t,isLoadingDatasets:s,isLoadingExperiments:l,isLoadingScores:d,isLoadingReview:m})}),o.jsx(O1n,{summaryData:u?.summaryData??[],overTimeData:u?.overTimeData??[],scorerNames:u?.scorerNames??[],avgScore:u?.avgScore??null,isLoading:d,isError:f}),o.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[o.jsx(Cjn,{experiments:w,isLoading:l,isError:!!c}),o.jsx(_Nn,{experiments:w,datasets:x,isLoading:l,isError:!!c})]}),o.jsx(rNn,{reviewSummary:p,experiments:w,datasets:x,isLoading:m,isError:!!g})]})]})}function TNn(){const[e,t]=b.useState(""),[r,n]=b.useState("all"),[s,a]=b.useState("all"),{data:i,isLoading:l,error:c}=zh(),{data:u,isLoading:d,error:f}=K8(),{data:h}=Tve(),p=b.useMemo(()=>i?.datasets??[],[i?.datasets]),m=b.useMemo(()=>u?.experiments??[],[u?.experiments]),g=b.useMemo(()=>ONn(p),[p]),y=b.useMemo(()=>R1t(h),[h]),x=l||d,w=f||c;if(w&&Ps(w))return o.jsx(Jr,{title:"Experiments",icon:o.jsx(Au,{}),children:o.jsx(na,{})});if(f&&ks(f))return o.jsx(Jr,{title:"Experiments",icon:o.jsx(Au,{}),children:o.jsx(Gs,{resource:"experiments"})});if(c&&ks(c))return o.jsx(Jr,{title:"Experiments",icon:o.jsx(Au,{}),children:o.jsx(Gs,{resource:"datasets"})});if(w)return o.jsx(Jr,{title:"Experiments",icon:o.jsx(Au,{}),children:o.jsx(gu,{title:"Failed to load experiments",message:w.message})});if(m.length===0&&!x)return o.jsx(Jr,{title:"Experiments",icon:o.jsx(Au,{}),children:o.jsx(ENn,{})});const S=r!=="all"||s!=="all"||e!=="",k=()=>{t(""),n("all"),a("all")};return o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:x,children:[o.jsx(Au,{})," Experiments"]})})}),o.jsx(bt.Column,{className:"flex justify-end gap-2",children:o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/evals/datasets/running-experiments",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Experiments documentation",children:o.jsx(Di,{})})})]}),o.jsx(CNn,{search:e,onSearchChange:t,statusFilter:r,onStatusFilterChange:n,datasetFilter:s,onDatasetFilterChange:a,datasetOptions:g,onReset:k,hasActiveFilters:S})]}),o.jsx(SNn,{experiments:m,datasets:p,reviewByExperiment:y,isLoading:x,search:e,statusFilter:r,datasetFilter:s})]})}function NNn(){const{experimentId:e}=ra(),{data:t,isLoading:r}=K8(),s=t?.experiments?.find(p=>p.id===e)?.datasetId??"",{data:a,isLoading:i,error:l}=V6(s,e??""),{data:c,isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h}=X8({datasetId:s,experimentId:e??"",experimentStatus:a?.status});return e?r||i||!s?o.jsx(zr,{children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(Mt,{})})}):l&&Ps(l)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):l&&ks(l)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})}):l||!a?o.jsx(zr,{children:o.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",l instanceof Error?l.message:"Unknown error"]})}):o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/experiments",children:[o.jsx(Ce,{children:o.jsx(Au,{})}),"Experiments"]}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Experiment"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsx(I1t,{experimentId:e,experiment:a}),o.jsx(A1t,{experimentId:e,experimentStatus:a?.status,results:c??[],isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h})]})})]}):null}function P1t({redirectUri:e,onSuccess:t,initialMode:r="signin",errorMessage:n}){const{data:s,isLoading:a}=SC(),{mutate:i,isPending:l,error:c}=DCn(),{mutate:u,isPending:d,error:f}=LCn(),{mutate:h,isPending:p}=w1t(),[m,g]=b.useState(r),[y,x]=b.useState(""),[w,S]=b.useState(""),[k,_]=b.useState("");if(a)return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:o.jsx("div",{className:"text-neutral3",children:"Loading..."})});if(!s?.enabled||!s?.login)return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:o.jsx("div",{className:"text-neutral3",children:"Authentication is not configured"})});const{login:E}=s,T=E.type==="sso"||E.type==="both",j=E.type==="credentials"||E.type==="both",N=E.sso,I=E.signUpEnabled!==!1,P=m==="signin"||!I,R=P?l:d,$=P?c:f,M=()=>{t?t():e?window.location.href=e:window.location.href="/"},z=H=>{H.preventDefault(),P?i({email:w,password:k},{onSuccess:M}):u({email:w,password:k,name:y||void 0},{onSuccess:M})},U=()=>{h({redirectUri:e},{onSuccess:H=>{window.location.href=H.url}})},B=()=>{g(P?"signup":"signin")};return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:o.jsxs("div",{className:"w-full max-w-sm space-y-6 rounded-lg border border-border1 bg-surface2 p-8",children:[o.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[o.jsx(tx,{className:"h-10 w-10"}),o.jsx("h1",{className:"text-xl font-semibold text-neutral6",children:P?"Sign in to Mastra Studio":"Create your account"})]}),n&&o.jsx("div",{className:"rounded-md bg-red-500/10 p-3 text-sm text-red-400",children:n}),j&&o.jsxs("form",{onSubmit:z,className:"space-y-4",children:[!P&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{htmlFor:"name",className:"block text-sm text-neutral4",children:"Name"}),o.jsx(sr,{id:"name",type:"text",value:y,onChange:H=>x(H.target.value),placeholder:"Your name",variant:"default",size:"lg"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{htmlFor:"email",className:"block text-sm text-neutral4",children:"Email"}),o.jsx(sr,{id:"email",type:"email",value:w,onChange:H=>S(H.target.value),placeholder:"you@example.com",required:!0,variant:"default",size:"lg"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{htmlFor:"password",className:"block text-sm text-neutral4",children:"Password"}),o.jsx(sr,{id:"password",type:"password",value:k,onChange:H=>_(H.target.value),placeholder:P?"Enter your password":"Create a password",required:!0,variant:"default",size:"lg"})]}),$&&o.jsx("div",{className:"rounded-md bg-red-500/10 p-3 text-sm text-red-400",children:$.message}),o.jsx(pe,{type:"submit",disabled:R,className:"w-full",size:"lg",children:R?P?"Signing in...":"Creating account...":P?"Sign in":"Create account"}),I&&o.jsxs("div",{className:"text-center text-sm",children:[o.jsx("span",{className:"text-neutral3",children:P?"Don't have an account? ":"Already have an account? "}),o.jsx("button",{type:"button",onClick:B,className:"text-neutral6 hover:underline",children:P?"Sign up":"Sign in"})]})]}),T&&j&&o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("div",{className:"w-full border-t border-border1"})}),o.jsx("div",{className:"relative flex justify-center text-sm",children:o.jsx("span",{className:"bg-surface2 px-2 text-neutral3",children:"or continue with"})})]}),T&&N&&o.jsxs(pe,{onClick:U,disabled:p,className:"w-full",size:"lg",variant:"outline",children:[N.icon&&o.jsx("span",{className:"mr-2",children:N.icon}),p?"Redirecting...":N.text||"Sign in"]})]})})}function ANn(){const[e]=so(),t=fu(),r=e.get("redirect")||"/",s=e.get("mode")==="signup"?"signup":"signin",a=e.get("error_description")||e.get("error")||null,i=()=>{r.startsWith("http")?window.location.href=r:t(r,{replace:!0})};return o.jsx(P1t,{redirectUri:r,onSuccess:i,initialMode:s,errorMessage:a})}function INn(){const[e,t]=so(),r=JFr(e,t),n=rzr(e,t),[s,a]=b.useState(),[i,l]=b.useState(!1),{data:c=[],isPending:u}=hht(),{data:d=[],isPending:f}=pht({entityType:r.selectedEntityOption?.entityType,rootOnly:!0}),{data:h=[],isPending:p}=mht(),{data:m=[],isPending:g}=ght(),y=b.useMemo(()=>QFr({availableTags:c,availableRootEntityNames:d,availableServiceNames:m,availableEnvironments:h,loading:{tags:u,entityNames:f,serviceNames:g,environments:p}}),[c,d,m,h,u,f,g,p]),x=b.useMemo(()=>YFr({rootEntityType:r.selectedEntityOption?.entityType,dateFrom:r.selectedDateFrom,dateTo:r.selectedDateTo,tokens:r.filterTokens}),[r.filterTokens,r.selectedDateFrom,r.selectedDateTo,r.selectedEntityOption]),{data:w=[],isLoading:S,error:k,isFetchingNextPage:_,hasNextPage:E,setEndOfListElement:T}=zFr({filters:x}),{logIdMap:j,featuredLog:N,handleLogClick:I,handlePreviousLog:P,handleNextLog:R}=azr(w,r.featuredLogId,r.handleFeaturedChange,r.featuredTraceId),{data:$,isLoading:M}=Ame(r.featuredTraceId??null),{data:z,isLoading:U}=FS(r.featuredTraceId??"",r.featuredSpanId??""),B=b.useCallback(()=>r.applyFilterTokens(XFr(y,r.filterTokens)),[y,r]),H=b.useCallback(()=>r.handleFeaturedChange({logId:null}),[r]),W=b.useCallback(G=>r.handleFeaturedChange({traceId:G,spanId:null}),[r]),L=b.useCallback((G,J)=>r.handleFeaturedChange({traceId:G,spanId:J}),[r]),Y=b.useCallback(()=>{r.handleFeaturedChange({traceId:null,spanId:null}),l(!1)},[r]),q=b.useCallback(()=>r.handleFeaturedChange({spanId:null}),[r]),D=b.useCallback(G=>r.handleFeaturedChange({spanId:G??null}),[r]);if(k)return o.jsx(Jr,{title:"Logs",icon:o.jsx(HL,{}),children:o.jsx(AFr,{error:k,resource:"logs",errorTitle:"Failed to load logs"})});const Q=r.filterTokens.length>0||r.datePreset!=="last-24h"||!!r.selectedDateTo;return w.length===0&&!S&&!Q?o.jsx(Jr,{title:"Logs",icon:o.jsx(HL,{}),children:o.jsx(DFr,{})}):o.jsxs(bt,{width:"wide",height:"full",children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:S,children:[o.jsx(HL,{})," Logs"]})})}),o.jsxs(bt.Column,{className:"flex justify-end items-center gap-2",children:[o.jsx(Wft,{preset:r.datePreset,onPresetChange:r.handleDatePresetChange,dateFrom:r.selectedDateFrom,dateTo:r.selectedDateTo,onDateChange:r.handleDateChange,disabled:S,presets:["last-24h","last-3d","last-7d","last-14d","last-30d","custom"]}),o.jsx(Xdt,{fields:y,tokens:r.filterTokens,onTokensChange:r.handleFilterTokensChange,disabled:S,onStartTextFilter:a}),o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/observability/logs/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Logs documentation",tooltipContent:"Go to Logs documentation",children:o.jsx(Di,{})})]})]}),o.jsx(PFr,{isLoading:S,filterFields:y,filterTokens:r.filterTokens,onFilterTokensChange:r.handleFilterTokensChange,onClear:B,onRemoveAll:r.handleRemoveAll,onSave:n.handleSave,onRemoveSaved:n.hasSavedFilters?n.handleRemoveSaved:void 0,autoFocusFilterFieldId:s})]}),o.jsx(IFr,{logCollapsed:i,listSlot:o.jsx(RFr,{logs:w,isLoading:S,isFetchingNextPage:_,hasNextPage:E,setEndOfListElement:T,logIdMap:j,featuredLogId:r.featuredLogId,onLogClick:I}),logPanelSlot:N?o.jsx(NFr,{log:N,onClose:H,onTraceClick:W,onSpanClick:L,onPrevious:P,onNext:R,collapsed:i,onCollapsedChange:l}):null,tracePanelSlot:r.featuredTraceId?o.jsx(eFr,{traceId:r.featuredTraceId,spans:$?.spans,isLoading:M,onClose:Y,onSpanSelect:D,selectedSpanId:r.featuredSpanId}):null,spanPanelSlot:r.featuredTraceId&&r.featuredSpanId?o.jsx(J6r,{spanId:r.featuredSpanId,span:z?.span,isLoading:U,onClose:q}):null})]})}const M1t=e=>{const t=Ge();return kt({queryKey:["mcpserver-tools",e?.id],queryFn:async()=>{const n=(await t.getMcpServerTools(e?.id)).tools,s={};return n.forEach(a=>{s[a.id]=a}),s},retry:!1,refetchOnWindowFocus:!1})};function RNn({server:e}){const{paths:t,Link:r}=ir(),s=Ge().options.baseUrl,a=s?`${s}/api/mcp/${e.id}/sse`:"",{data:i}=M1t(e),l=Object.values(i||{}),c=l.length,u=l.filter(h=>h.toolType==="agent").length,d=l.filter(h=>h.toolType==="workflow").length,f=Nh(e.name,50);return o.jsxs(we.RowLink,{to:t.mcpServerLink(e.id),LinkComponent:r,children:[o.jsx(we.NameCell,{children:f}),o.jsx(we.DescriptionCell,{children:a}),o.jsx(we.TextCell,{className:"text-center",children:u||""}),o.jsx(we.TextCell,{className:"text-center",children:c||""}),o.jsx(we.TextCell,{className:"text-center",children:d||""})]})}function PNn({mcpServers:e,isLoading:t,search:r=""}){const n=b.useMemo(()=>{const s=r.toLowerCase();return e.filter(a=>a.name?.toLowerCase().includes(s)||a.id?.toLowerCase().includes(s))},[e,r]);return t?o.jsx(bh,{columns:"auto 1fr auto auto auto"}):o.jsxs(we,{columns:"auto 1fr auto auto auto",children:[o.jsxs(we.Top,{children:[o.jsx(we.TopCell,{children:"Name"}),o.jsx(we.TopCell,{children:"URL"}),o.jsx(we.TopCellSmart,{long:"Agents",short:o.jsx(pa,{}),tooltip:"Agent Tools",className:"text-center"}),o.jsx(we.TopCellSmart,{long:"Tools",short:o.jsx(Pi,{}),tooltip:"Tools",className:"text-center"}),o.jsx(we.TopCellSmart,{long:"Workflows",short:o.jsx(Mi,{}),tooltip:"Workflow Tools",className:"text-center"})]}),n.length===0&&r?o.jsx(we.NoMatch,{message:"No MCP Servers match your search"}):null,n.map(s=>o.jsx(RNn,{server:s},s.id))]})}const MNn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(xf,{}),titleSlot:"No MCP Servers yet",descriptionSlot:o.jsxs(o.Fragment,{children:["MCP servers are not configured yet. ",o.jsx("br",{}),"More information in the documentation."]}),actionSlot:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",children:["MCP Documentation ",o.jsx(ya,{})]})})}),DNn=()=>{const{data:e=[],isLoading:t,error:r}=cM(),[n,s]=b.useState("");return r&&Ps(r)?o.jsx(Jr,{title:"MCP Servers",icon:o.jsx(vl,{}),children:o.jsx(na,{})}):r&&ks(r)?o.jsx(Jr,{title:"MCP Servers",icon:o.jsx(vl,{}),children:o.jsx(Gs,{resource:"MCP servers"})}):r?o.jsx(Jr,{title:"MCP Servers",icon:o.jsx(vl,{}),children:o.jsx(gu,{title:"Failed to load MCP servers",message:r.message})}):e.length===0&&!t?o.jsx(Jr,{title:"MCP Servers",icon:o.jsx(vl,{}),children:o.jsx(MNn,{})}):o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:t,children:[o.jsx(vl,{})," MCP Servers"]})})}),o.jsx(bt.Column,{className:"flex justify-end gap-2",children:o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to MCP documentation",children:o.jsx(Di,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(_g,{onSearch:s,label:"Filter MCP servers",placeholder:"Filter by name"})})]}),o.jsx(PNn,{mcpServers:e,isLoading:t,search:n})]})},LNn=(e,t)=>{const r=new Map,n=Object.keys(t);for(const s of n){const a=t[s],i=a.tools,l=Object.keys(i);for(const c of l){const u=i[c];r.has(u.id)||r.set(u.id,{...u,agents:[]}),r.get(u.id).agents.push({...a,id:s})}}for(const[s,a]of Object.entries(e))r.has(a.id)||r.set(a.id,{...a,agents:[]});return Array.from(r.values())};function $Nn({tools:e,agents:t,isLoading:r,search:n=""}){const{paths:s,Link:a}=ir(),i=b.useMemo(()=>LNn(e,t),[e,t]),l=b.useMemo(()=>i.filter(c=>c.id.toLowerCase().includes(n.toLowerCase())),[i,n]);return r?o.jsx(bh,{columns:"auto 1fr auto"}):o.jsxs(we,{columns:"auto 1fr auto",children:[o.jsxs(we.Top,{children:[o.jsx(we.TopCell,{children:"Name"}),o.jsx(we.TopCell,{children:"Description"}),o.jsx(we.TopCellSmart,{long:"Agents",short:o.jsx(pa,{}),tooltip:"Attached Agents",className:"text-center"})]}),l.length===0&&n?o.jsx(we.NoMatch,{message:"No Tools match your search"}):null,l.map(c=>{const u=Nh(c.id,50),d=Nh(c.description??"",200),f=c.agents.length;return o.jsxs(we.RowLink,{to:s.toolLink(c.id),LinkComponent:a,children:[o.jsx(we.NameCell,{children:u}),o.jsx(we.DescriptionCell,{children:d}),o.jsx(we.TextCell,{className:"text-center",children:f||""})]},c.id)})]})}const FNn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(xf,{}),titleSlot:"No Tools yet",descriptionSlot:o.jsxs(o.Fragment,{children:["Mastra tools are not configured yet. ",o.jsx("br",{}),"More information in the documentation."]}),actionSlot:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",children:["Tools Documentation ",o.jsx(ya,{})]})})}),zNn=()=>{const e=Ge();return Kr({mutationFn:async({toolId:t,input:r,requestContext:n})=>{const s=new m_;Object.entries(n??{}).forEach(([a,i])=>{s.set(a,i)});try{return await e.getTool(t).execute({data:r,requestContext:s})}catch(a){throw ze.error("Error executing dev tool"),console.error("Error executing dev tool:",a),a}}})},BNn=({toolId:e})=>{const{canExecute:t}=Ev(),r=t("tools"),{data:n={}}=Tg(),s=b.useMemo(()=>{for(const g of Object.values(n))if(g.tools){const y=Object.values(g.tools).find(x=>x.id===e);if(y)return y}return null},[n,e]),{data:a,isLoading:i,error:l}=akn(e,{enabled:!s}),c=s||a,{mutateAsync:u,isPending:d,data:f}=zNn(),{requestContext:h}=Qn();b.useEffect(()=>{if(l){const g=l instanceof Error?l.message:"Failed to load tool";ze.error(`Error loading tool: ${g}`)}},[l]);const p=async(g,y)=>{if(!c)return;const x={...h??{},...y??{}};return u({toolId:c.id,input:g,requestContext:x})},m=c?.inputSchema?fg(cg(rv(c?.inputSchema))):Zn({});return i?o.jsxs("div",{className:"p-6",children:[o.jsx(Mn,{className:"h-8 w-48 mb-4"}),o.jsx(Mn,{className:"h-32 w-full"})]}):l?null:c?r?o.jsx(mve,{executionResult:f,isExecutingTool:d,zodInputSchema:m,handleExecuteTool:p,toolDescription:c.description,toolId:c.id,requestContextSchema:c.requestContextSchema}):o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"You don't have permission to execute tools."})}):o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Tool not found"})})};function UNn({value:e,onValueChange:t,placeholder:r="Select a tool...",searchPlaceholder:n="Search tools...",emptyText:s="No tools found.",className:a,disabled:i=!1,variant:l="inputLike"}){const{data:c={},isLoading:u,isError:d,error:f}=Z8(),{data:h={},isLoading:p,isError:m,error:g}=Tg(),{navigate:y,paths:x}=ir();b.useEffect(()=>{if(d){const _=f instanceof Error?f.message:"Failed to load tools";ze.error(`Error loading tools: ${_}`)}},[d,f]),b.useEffect(()=>{if(m){const _=g instanceof Error?g.message:"Failed to load agents";ze.error(`Error loading agents: ${_}`)}},[m,g]);const w=new Map;Object.values(h).forEach(_=>{_.tools&&Object.values(_.tools).forEach(E=>{w.has(E.id)||w.set(E.id,E)})}),Object.values(c).forEach(_=>{w.has(_.id)||w.set(_.id,_)});const S=Array.from(w.values()).map(_=>({label:_.id,value:_.id})),k=_=>{t?t(_):_&&_!==e&&y(x.toolLink(_))};return o.jsx(Kl,{options:S,value:e,onValueChange:k,placeholder:u||p?"Loading tools...":r,searchPlaceholder:n,emptyText:s,className:a,disabled:i||u||p||d||m,variant:l})}const VNn=({isLoading:e,server:t})=>{const[{sseUrl:r,httpStreamUrl:n},s]=b.useState({sseUrl:"",httpStreamUrl:""});if(b.useEffect(()=>{if(!t)return;const i=window.MASTRA_SERVER_HOST,l=window.MASTRA_SERVER_PORT;let c=null;i&&l&&(c=`http://${i}:${l}`);const u=c||"http://localhost:4111",d=`${u}/api/mcp/${t.id}/sse`,f=`${u}/api/mcp/${t.id}/mcp`;s({sseUrl:d,httpStreamUrl:f})},[t]),e)return null;if(!t)return o.jsx(pf,{children:o.jsx(me,{as:"h1",variant:"header-md",className:"text-neutral3 font-medium py-20 text-center",children:"Server not found"})});const a=`npx -y mcp-remote ${r}`;return o.jsxs(pf,{isDivided:!0,children:[o.jsxs("div",{className:"px-8 py-12 mx-auto max-w-2xl w-full",children:[o.jsx(me,{as:"h1",variant:"header-md",className:"text-neutral6 font-medium pb-4",children:t.name}),o.jsxs("div",{className:"flex items-center gap-1 pb-6",children:[o.jsx(gt,{icon:o.jsx(D9,{className:"text-neutral6"}),className:"rounded-r-sm text-neutral4!",children:"Version"}),o.jsx(gt,{className:"rounded-l-sm text-neutral4!",children:t.version_detail.version})]}),o.jsx(me,{className:"text-neutral3 pb-4",children:"This MCP server can be accessed through multiple transport methods. Choose the one that best fits your use case."}),o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[o.jsx(gt,{icon:o.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"HTTP"}),children:"Regular HTTP Endpoint"}),o.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for stateless HTTP transport with streamable responses."}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:n}),o.jsx("div",{className:"pt-1",children:o.jsx(Xa,{tooltip:"Copy HTTP Stream URL",content:n})})]})]}),o.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[o.jsx(gt,{icon:o.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"SSE"}),children:"Server-Sent Events"}),o.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for real-time communication via SSE."}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:r}),o.jsx("div",{className:"pt-1",children:o.jsx(Xa,{tooltip:"Copy SSE URL",content:r})})]})]}),o.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[o.jsx(gt,{icon:o.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"CLI"}),children:"Command Line"}),o.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for local command-line access via npx and mcp-remote."}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:a}),o.jsx("div",{className:"pt-1",children:o.jsx(Xa,{tooltip:"Copy Command Line Config",content:a})})]})]})]})]}),o.jsx("div",{className:"h-full overflow-y-scroll border-l border-border1",children:o.jsx(qNn,{server:t})})]})},qNn=({server:e})=>{const{data:t={},isLoading:r}=M1t(e);if(r)return null;const n=Object.keys(t);return o.jsxs("div",{className:"p-5 overflow-y-scroll",children:[o.jsxs("div",{className:"text-neutral6 flex gap-2 items-center",children:[o.jsx(Ce,{size:"lg",className:"bg-surface4 rounded-md p-1",children:o.jsx(vl,{})}),o.jsx(me,{variant:"header-md",as:"h2",className:"font-medium",children:"Available Tools"})]}),o.jsx("div",{className:"flex flex-col gap-2 pt-6",children:n.map(s=>{const a=t[s];return o.jsx(HNn,{tool:a,serverId:e.id},s)})})]})},HNn=({tool:e,serverId:t})=>{const r=b.useRef(null),{Link:n,paths:s}=ir(),a=OSt[e.toolType||"tool"];return o.jsxs(kf,{onClick:()=>r.current?.click(),children:[o.jsx(hdt,{children:o.jsx(a,{className:"group-hover/entity:text-accent6"})}),o.jsxs(Cf,{children:[o.jsx(_f,{children:o.jsx(n,{ref:r,href:s.mcpServerToolLink(t,e.id),children:e.id})}),o.jsx(Ef,{children:e.description})]})]})},QNn=()=>{const{serverId:e}=ra(),{data:t=[],isLoading:r}=cM(),n=t.find(s=>s.id===e);return o.jsxs(zr,{children:[o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/mcps",children:[o.jsx(Ce,{children:o.jsx(vl,{})}),"MCP Servers"]}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:o.jsx(zSt,{value:e,variant:"ghost"})})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(u0,{}),"MCP documentation"]})})]}),o.jsx(VNn,{isLoading:r,server:n})]})},D1t=(e,t)=>{const{requestContext:r}=Qn(),n=Ge();return kt({queryKey:["mcp-server-tool",e,t],queryFn:()=>n.getMcpServerTool(e,t).details(r)})},WNn=(e,t)=>{const{requestContext:r}=Qn(),n=Ge();return Kr({mutationFn:s=>n.getMcpServerTool(e,t).execute({data:s,requestContext:r})})},GNn=({toolId:e,serverId:t})=>{const{canExecute:r}=Ev(),n=r("tools"),{data:s,isLoading:a,error:i}=D1t(t,e),{mutateAsync:l,isPending:c,data:u}=WNn(t,e);b.useEffect(()=>{if(i){const h=i instanceof Error?i.message:"Failed to load tool";ze.error(`Error loading tool: ${h}`)}},[i]);const d=async h=>{if(s)return await l(h)};if(a)return o.jsxs("div",{className:"p-6",children:[o.jsx(Mn,{className:"h-8 w-48 mb-4"}),o.jsx(Mn,{className:"h-32 w-full"})]});if(i)return null;if(!s)return o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Tool not found"})});if(!n)return o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"You don't have permission to execute tools."})});let f;try{f=fg(cg(s.inputSchema))}catch(h){console.error("Error processing input schema:",h),ze.error("Failed to process tool input schema."),f=Zn({})}return o.jsx(mve,{executionResult:u,isExecutingTool:c,zodInputSchema:f,handleExecuteTool:d,toolDescription:s.description||"",toolId:s.id})},ZNn=()=>{const{data:e}=cM(),{serverId:t,toolId:r}=ra(),{data:n,isLoading:s}=D1t(t,r),a=e?.find(c=>c.id===t),i=n?.name,l=a?.name||"";return s||!n?null:o.jsxs("div",{className:"h-full w-full bg-surface2 overflow-y-hidden",children:[o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/mcps",children:[o.jsx(Ce,{children:o.jsx(vl,{})}),"MCP Servers"]}),o.jsx(jr,{as:dr,to:`/mcps/${t}`,children:l}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:i})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(u0,{}),"MCP documentation"]})})]}),o.jsx(GNn,{toolId:r,serverId:t})]})};function YNn(){const{data:e,isLoading:t,isError:r}=P6r();return o.jsx(O6r,{data:e,isLoading:t,isError:r})}function XNn(){const{data:e,isLoading:t,isError:r}=aht();return o.jsx(Q9,{label:"Total Agent Runs",value:e?.value!=null?e.value.toLocaleString():null,prevValue:e?.previousValue!=null?e.previousValue.toLocaleString():void 0,changePct:e?.changePercent??null,isLoading:t,isError:r})}function KNn(){const{data:e,isLoading:t,isError:r}=A6r();return o.jsx(Q9,{label:"Total Model Cost",value:e?.cost!=null?Qw(e.cost,e.costUnit):null,prevValue:e?.previousCost!=null?Qw(e.previousCost,e.costUnit):void 0,changePct:e?.costChangePercent??null,isLoading:t,isError:r})}function JNn(){const{data:e,isLoading:t,isError:r}=I6r();return o.jsx(Q9,{label:"Total Tokens",value:e?.value!=null?Fm(e.value):null,prevValue:e?.previousValue!=null?Fm(e.previousValue):void 0,changePct:e?.changePercent??null,isLoading:t,isError:r})}function eAn(){const{data:e,isLoading:t,isError:r}=N6r();return o.jsx(Q9,{label:"Avg Score",value:e?.value!=null?String(e.value):null,prevValue:e?.previousValue!=null?String(e.previousValue):void 0,changePct:e?.changePercent??null,isLoading:t,isError:r})}function tAn(){const{data:e,isLoading:t,isError:r}=R6r();return o.jsx(k6r,{rows:e,isLoading:t,isError:r})}function rAn(){const{data:e,isLoading:t,isError:r}=D6r();return o.jsx(_6r,{data:e,isLoading:t,isError:r})}function nAn(){const{data:e,isLoading:t,isError:r}=L6r();return o.jsx(C6r,{data:e,isLoading:t,isError:r})}function sAn(){const{data:e,isLoading:t,isError:r}=M6r();return o.jsx(j6r,{data:e,isLoading:t,isError:r})}const aAn=new Set(["ObservabilityStorageClickhouseVNext","ObservabilityStorageDuckDB","ObservabilityInMemory"]),rre="period";function iAn(){const[e,t]=so(),r=e.get(rre),n=rht(r)?r:"24h",s=b.useCallback(a=>{t(i=>{const l=new URLSearchParams(i);return a==="24h"?l.delete(rre):l.set(rre,a),l},{replace:!0})},[t]);return o.jsx(x6r,{initialPreset:n,onPresetChange:s,children:o.jsx(oAn,{})})}function oAn(){const{error:e}=aht(),{data:t,isLoading:r}=U8(),n=t?.observabilityStorageType,s=n?aAn.has(n):!1,a=n==="ObservabilityInMemory";return e&&Ps(e)?o.jsx(Jr,{title:"Metrics",icon:o.jsx(ik,{}),children:o.jsx(na,{})}):e&&ks(e)?o.jsx(Jr,{title:"Metrics",icon:o.jsx(ik,{}),children:o.jsx(Gs,{resource:"metrics"})}):e?o.jsx(Jr,{title:"Metrics",icon:o.jsx(ik,{}),children:o.jsx(gu,{title:"Failed to load metrics",message:e.message})}):o.jsxs(bt,{width:"wide",height:"full",children:[o.jsx(bt.TopArea,{className:"sticky top-0 z-100 bg-surface1 ",children:o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{children:[o.jsx(ik,{})," Metrics"]})})}),o.jsxs(bt.Column,{className:"flex justify-end gap-2",children:[o.jsx(w6r,{}),o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/observability/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Metrics documentation",children:o.jsx(Di,{})})]})]})}),r?null:s?o.jsxs("div",{className:"grid gap-8 content-start pb-10",children:[a&&o.jsxs(Bl,{variant:"info",children:[o.jsx(Ul,{children:"Metrics are not persisted"}),o.jsx($u,{as:"p",children:"This project uses in-memory storage for observability. Metrics will be lost on every server restart. For persistent metrics, switch the observability storage to ClickHouse or DuckDB."})]}),o.jsxs(die,{children:[o.jsx(XNn,{}),o.jsx(KNn,{}),o.jsx(JNn,{}),o.jsx(eAn,{})]}),o.jsxs(die,{children:[o.jsx(tAn,{}),o.jsx(nAn,{}),o.jsx(rAn,{}),o.jsx(sAn,{}),o.jsx(YNn,{})]})]}):o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(xf,{}),titleSlot:"Metrics are not available with your current storage",descriptionSlot:"Metrics require ClickHouse, DuckDB, or in-memory storage for observability. Relational databases (PostgreSQL, LibSQL) do not support metrics collection. To enable metrics on an existing project, switch the observability storage in the Mastra configuration.",actionSlot:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/observability/metrics/overview",target:"_blank",rel:"noopener noreferrer",children:["Metrics Documentation ",o.jsx(ya,{})]})})})]})}const lAn=[{title:"Metrics",description:"View system performance metrics, request latencies, and throughput across your agents and workflows.",icon:ik,href:"/metrics"},{title:"Traces",description:"Explore distributed traces to debug and understand the execution flow of your AI operations.",icon:xo,href:"/observability"}];function cAn(){return o.jsxs(yk,{children:[o.jsx(yk.Top,{children:o.jsx(Ir,{withMargins:!1,children:o.jsx(Ir.Column,{children:o.jsxs(Ir.Title,{children:[o.jsx(xo,{})," Observability"]})})})}),o.jsx("div",{className:"px-6 pt-6 overflow-y-auto",children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:lAn.map(e=>o.jsxs(dr,{to:e.href,className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}const uAn=[{title:"Agents",description:"Create and manage AI agents with tools, memory, and custom instructions.",icon:pa,href:"/agents"},{title:"Prompts",description:"Design and version reusable prompt templates for your agents.",icon:Zi,href:"/prompts"},{title:"Workflows",description:"Build step-based execution flows with suspend, resume, and branching.",icon:Mi,href:"/workflows"},{title:"Processors",description:"Configure data processors for transforming and routing information.",icon:nS,href:"/processors"},{title:"MCP Servers",description:"Connect to Model Context Protocol servers for external tool access.",icon:vl,href:"/mcps"},{title:"Tools",description:"Browse and test the tools available to your agents and workflows.",icon:Pi,href:"/tools"},{title:"Workspaces",description:"Organize your projects and resources into isolated workspaces.",icon:oc,href:"/workspaces"},{title:"Request Context",description:"Inspect request-scoped context propagation for dynamic configuration.",icon:TE,href:"/request-context"}];function dAn(){return o.jsxs(bt,{width:"narrow",children:[o.jsx(bt.TopArea,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{children:[o.jsx(v2t,{})," Primitives"]})})}),o.jsx(bt.MainArea,{children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:uAn.map(e=>o.jsxs(dr,{to:e.href,className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function fAn(){const{paths:e}=ir(),{data:t,isLoading:r,error:n}=TSt(),{isCmsAvailable:s}=lM(),[a,i]=b.useState(""),l=t?.promptBlocks??[];return n&&Ps(n)?o.jsx(Jr,{title:"Prompts",icon:o.jsx(Zi,{}),children:o.jsx(na,{})}):n&&ks(n)?o.jsx(Jr,{title:"Prompts",icon:o.jsx(Zi,{}),children:o.jsx(Gs,{resource:"prompt blocks"})}):n?o.jsx(Jr,{title:"Prompts",icon:o.jsx(Zi,{}),children:o.jsx(gu,{title:"Failed to load prompt blocks",message:n.message})}):l.length===0&&!r?o.jsx(Jr,{title:"Prompts",icon:o.jsx(Zi,{}),children:o.jsx(ZOn,{})}):o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:r,children:[o.jsx(Zi,{})," Prompts"]})})}),o.jsxs(bt.Column,{className:"flex justify-end gap-2",children:[o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/agents/agent-instructions#prompt-blocks",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Prompts documentation",children:o.jsx(Di,{})}),s&&o.jsxs(pe,{as:dr,to:e.cmsPromptBlockCreateLink(),variant:"primary",children:[o.jsx(cs,{}),"Create Prompt"]})]})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(_g,{onSearch:i,label:"Filter prompts",placeholder:"Filter by name or description"})})]}),o.jsx(GOn,{promptBlocks:l,isLoading:r,search:a})]})}function hAn(){return o.jsxs(bt,{width:"narrow",children:[o.jsx(bt.TopArea,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{children:[o.jsx(TE,{})," Request Context"]})})}),o.jsx(bt.MainArea,{children:o.jsx(fSn,{children:o.jsx(oSt,{})})})]})}const pAn=[{title:"Mastra APIs",description:"Explore and test the available REST API endpoints with the interactive Swagger UI.",icon:RMt,href:"/swagger-ui",external:!1},{title:"Documentation",description:"Read the official Mastra documentation for guides, references, and tutorials.",icon:Di,href:"https://mastra.ai/en/docs",external:!0},{title:"Github",description:"Browse the source code, report issues, and contribute to the Mastra project.",icon:ya,href:"https://github.com/mastra-ai/mastra",external:!0},{title:"Community",description:"Join the Mastra Discord community for help, discussion, and collaboration.",icon:nce,href:"https://discord.gg/BTYqqHKUrf",external:!0},{title:"Share with your team",description:"Running Mastra Studio locally? Deploy to the cloud so your team can collaborate.",icon:uVe,href:"https://mastra.ai/cloud",external:!0},{title:"Talk to our Sales team",description:"Get a custom demo, discuss on-prem deployments, and how we can help you accelerate getting agents into production.",icon:CPt,href:"https://mastra.ai/contact?ref=studio",external:!0}];function mAn(){return o.jsxs(bt,{width:"narrow",children:[o.jsx(bt.TopArea,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{children:[o.jsx(Di,{})," Resources"]})})}),o.jsx(bt.MainArea,{children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:pAn.map(e=>o.jsxs("a",{href:e.href,...e.external?{target:"_blank",rel:"noreferrer"}:{},className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title}),e.external&&o.jsx(ya,{className:"h-3.5 w-3.5 text-icon3 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function gAn(){const{data:e={},isLoading:t,error:r}=fd(),[n,s]=b.useState(""),[a,i]=b.useState("all");if(r&&Ps(r))return o.jsx(Jr,{title:"Scorers",icon:o.jsx(Ma,{}),children:o.jsx(na,{})});if(r&&ks(r))return o.jsx(Jr,{title:"Scorers",icon:o.jsx(Ma,{}),children:o.jsx(Gs,{resource:"scorers"})});if(r)return o.jsx(Jr,{title:"Scorers",icon:o.jsx(Ma,{}),children:o.jsx(gu,{title:"Failed to load scorers",message:r.message})});if(Object.keys(e).length===0&&!t)return o.jsx(Jr,{title:"Scorers",icon:o.jsx(Ma,{}),children:o.jsx(_1n,{})});const l=a!=="all"||n!=="",c=()=>{s(""),i("all")};return o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:t,children:[o.jsx(Ma,{})," Scorers"]})})}),o.jsx(bt.Column,{className:"flex justify-end gap-2",children:o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Scorers documentation",children:o.jsx(Di,{})})})]}),o.jsx(C1n,{search:n,onSearchChange:s,sourceFilter:a,onSourceFilterChange:i,onReset:c,hasActiveFilters:l})]}),o.jsx(k1n,{scorers:e,isLoading:t,search:n,sourceFilter:a})]})}function yAn(){const{scorerId:e}=ra(),[t,r]=so(),n=t.get("scoreId")??void 0,[s,a]=b.useState(n),[i,l]=b.useState({value:"all",label:"All Entities",type:"ALL"}),{scorer:c,isLoading:u,error:d}=w1n(e),{data:f={},isLoading:h,error:p}=Tg(),{isLoading:m,error:g}=d0(),{data:y=[],isLoading:x,error:w,isFetchingNextPage:S,hasNextPage:k,setEndOfListElement:_}=x1n({scorerId:e,entityId:i?.value==="all"?void 0:i?.value,entityType:i?.type==="ALL"?void 0:i?.type}),E=b.useMemo(()=>c?.agentIds?.filter(L=>f[L]).map(L=>({value:L,label:f[L].name,type:"AGENT"}))||[],[c?.agentIds,f]),T=b.useMemo(()=>c?.workflowIds?.map(L=>({value:L,label:L,type:"WORKFLOW"}))||[],[c?.workflowIds]),j=b.useMemo(()=>[{value:"all",label:"All Entities",type:"ALL"},...E,...T],[E,T]),N=t.get("entity")??"all",I=j.find(L=>L.value===N);I&&I.value!==i?.value&&l(I),b.useEffect(()=>{if(d){const L=d instanceof Error?d.message:"Failed to load scorer";ze.error(`Error loading scorer: ${L}`)}},[d]),b.useEffect(()=>{if(p){const L=p instanceof Error?p.message:"Failed to load agents";ze.error(`Error loading agents: ${L}`)}},[p]),b.useEffect(()=>{if(g){const L=g instanceof Error?g.message:"Failed to load workflows";ze.error(`Error loading workflows: ${L}`)}},[g]);const P=L=>{L?.value&&r(Y=>{const q=new URLSearchParams(Y);return q.set("entity",L.value),q})};b.useEffect(()=>{const L=t.get("scoreId")??void 0;if(L===s)return;if(!L){a(void 0);return}y.find(q=>q.id===L)&&a(L)},[t,y]);const R=b.useCallback(L=>{a(L||void 0),r(Y=>{const q=new URLSearchParams(Y);return L?q.set("scoreId",L):q.delete("scoreId"),q})},[r]);if(!c)return null;const $=Ps(d)||Ps(p)||Ps(g),M=d&&ks(d),z=!$&&!M&&(d||p||g),U=!x&&y.length===0,B=i?.value!=="all",H=o.jsxs(o.Fragment,{children:[o.jsxs(Za,{children:[o.jsx(jr,{as:dr,to:"/scorers",children:"Scorers"}),o.jsx(S1n,{value:e,variant:"link"})]}),o.jsxs(bt.Row,{children:[o.jsxs(yn,{children:[o.jsxs(yn.Title,{isLoading:u,children:[o.jsx(Ma,{})," ",c?.scorer?.config?.name||e]}),(u||c?.scorer?.config?.description)&&o.jsx(yn.Description,{isLoading:u,children:c?.scorer?.config?.description})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Scorers documentation",tooltipContent:"Go to Scorers documentation",children:o.jsx(Di,{})}),c?.scorer?.source==="stored"&&o.jsxs(pe,{variant:"light",as:dr,to:`/cms/scorers/${e}/edit`,children:[o.jsx(lv,{})," Edit"]})]})]})]});if($||M||z||U&&!B){const L=(d instanceof Error?d.message:void 0)??(p instanceof Error?p.message:void 0)??(g instanceof Error?g.message:void 0)??"An unexpected error occurred";return o.jsxs(bt,{width:"wide",height:"full",children:[o.jsx(bt.TopArea,{children:H}),o.jsx(bt.MainArea,{isCentered:!0,children:$?o.jsx(na,{}):M?o.jsx(Gs,{resource:"scorers"}):z?o.jsx(gu,{title:"Failed to load scorer",message:L}):o.jsx(h1n,{})})]})}return o.jsxs(bt,{width:"wide",children:[o.jsxs(bt.TopArea,{children:[H,o.jsx(g1n,{selectedEntity:i,entityOptions:j,onEntityChange:P,onReset:()=>{r(L=>{const Y=new URLSearchParams(L);return Y.set("entity","all"),Y})},isLoading:x||h||m})]}),o.jsx(f1n,{scores:y,isLoading:x,selectedScoreId:s,isFetchingNextPage:S,hasNextPage:k,setEndOfListElement:_,onScoreClick:R,errorMsg:w?.message})]})}const vAn=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}],bAn=()=>{const{baseUrl:e,headers:t,apiPrefix:r}=sve(),{theme:n,setTheme:s}=Qn(),[a,i]=b.useState(n),l=b.useRef(n);return b.useEffect(()=>{i(n),l.current=n},[n]),o.jsxs(bt,{width:"narrow",children:[o.jsx(bt.TopArea,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{children:[o.jsx(ume,{})," Settings"]})})}),o.jsxs(bt.MainArea,{className:"grid gap-8 mt-6",children:[o.jsx("section",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsx("h2",{className:"text-icon6 font-medium",children:"Theme"}),o.jsx(lft,{name:"theme",label:"Theme mode",value:a,onValueChange:c=>{const u=c;l.current=u,i(u)},options:vAn.map(c=>({...c}))})]})}),o.jsx(uSt,{initialConfig:{baseUrl:e,headers:t,apiPrefix:r},onSave:()=>{s(l.current)}})]})]})};function xAn(){const[e]=so(),t=fu(),r=e.get("redirect")||"/",n=()=>{r.startsWith("http")?window.location.href=r:t(r,{replace:!0})};return o.jsx(P1t,{redirectUri:r,onSuccess:n,initialMode:"signup"})}function wAn(e){return e.replace(/\/$/,"").split("/").pop()}function eB({children:e,className:t}){return o.jsx("div",{className:Z("border border-border1 rounded-lg mt-12 py-8 lg:min-h-[25rem] transition-height px-4 lg:px-12",t),children:e})}function SAn({templates:e,linkComponent:t,className:r,isLoading:n}){const s=t||"a";return n?o.jsx("div",{className:Z("grid gap-y-4",r),children:Array.from({length:5}).map((a,i)=>o.jsx("div",{className:"h-16 bg-surface3 animate-pulse rounded-lg"},i))}):o.jsx("div",{className:Z("grid gap-y-4",r),children:e.map(a=>{const i=a?.agents||a?.tools||a?.networks||a?.workflows||a?.mcp;return o.jsxs("article",{className:Z("border border-border1 rounded-lg overflow-hidden w-full grid grid-cols-[1fr_auto] bg-surface3 transition-colors hover:bg-surface4"),children:[o.jsxs(s,{to:`/templates/${a.slug}`,className:Z("grid [&:hover_p]:text-neutral5",{"grid-cols-[8rem_1fr] lg:grid-cols-[12rem_1fr]":a.imageURL}),children:[a.imageURL&&o.jsx("div",{className:Z("overflow-hidden"),children:o.jsx("div",{className:"w-full h-full bg-cover thumb transition-scale duration-150",style:{backgroundImage:`url(${a.imageURL})`}})}),o.jsxs("div",{className:Z("grid py-3 px-6 w-full gap-0.5","[&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:text-neutral3"),children:[o.jsx("h2",{className:"text-ui-lg text-neutral5",children:a.title}),o.jsx("p",{className:"text-ui-md text-neutral4 transition-colors duration-500",children:a.description}),o.jsxs("div",{className:"hidden 2xl:flex text-neutral3 text-ui-md flex-wrap items-center gap-4 mt-3",children:[i&&o.jsxs("ul",{className:Z("flex gap-4 text-ui-md text-neutral3 m-0 p-0 list-none","[&>li]:flex [&>li]:items-center [&>li]:gap-0.5 text-neutral4"),children:[a?.agents&&a.agents.length>0&&o.jsxs("li",{children:[o.jsx(pa,{})," ",a.agents.length]}),a?.tools&&a.tools.length>0&&o.jsxs("li",{children:[o.jsx(Pi,{})," ",a.tools.length]}),a?.networks&&a.networks.length>0&&o.jsxs("li",{children:[o.jsx(vVe,{})," ",a.networks.length]}),a?.workflows&&a.workflows.length>0&&o.jsxs("li",{children:[o.jsx(lF,{})," ",a.workflows.length]}),a?.mcp&&a.mcp.length>0&&o.jsxs("li",{children:[o.jsx(vl,{})," ",a.mcp.length]})]}),i&&a.supportedProviders&&o.jsx("small",{children:"|"}),o.jsx("div",{className:"flex items-center text-neutral3 gap-4",children:a.supportedProviders.map(l=>o.jsx("span",{className:"",children:l},l))})]})]})]}),o.jsx("a",{href:a.githubUrl,className:Z("group items-center gap-2 text-ui-md ml-auto pr-4 hidden","lg:flex"),target:"_blank",rel:"noopener noreferrer",children:o.jsxs("span",{className:"flex items-center gap-2 px-2 py-1 rounded bg-surface1 group-hover:bg-surface2 text-neutral3 transition-colors group-hover:text-neutral5",children:[o.jsx(ldt,{})," ",wAn(a.githubUrl)]})})]},a.slug)})})}function OAn({tagOptions:e,selectedTag:t,providerOptions:r,selectedProvider:n,onTagChange:s,onProviderChange:a,searchTerm:i,onSearchChange:l,onReset:c,className:u,isLoading:d}){return d?o.jsxs("div",{className:Z("h-[6.5rem] flex items-center gap-8","[&>div]:bg-surface3 [&>div]:w-48 [&>div]:h-8 [&>div]:animate-pulse",u),children:[o.jsx("div",{})," ",o.jsx("div",{})," ",o.jsx("div",{})]}):o.jsxs("div",{className:Z("flex flex-wrap mx-auto sticky top-0 gap-4 bg-surface2 py-8",u),children:[o.jsx(Tx,{name:"search-templates",label:"Search templates",labelIsHidden:!0,value:i,onChange:f=>l?.(f.target.value),placeholder:"Search Template"}),o.jsx($o,{label:"Filter by tag",labelIsHidden:!0,name:"filter-tag",value:t,onValueChange:s,options:e}),o.jsx($o,{label:"Filter by provider",labelIsHidden:!0,name:"filter-provider",value:n,onValueChange:a,options:r}),c&&o.jsxs(pe,{onClick:c,children:["Reset ",o.jsx(Nn,{})]})]})}function kAn(){const{data:e,isLoading:t}=hzr(),{templates:r,tags:n,providers:s}=e??{templates:[],tags:[],providers:[]},[a,i]=b.useState("all"),[l,c]=b.useState("all"),[u,d]=b.useState(""),f=[{value:"all",label:"Any tag"}];(n||[]).forEach(w=>{f.push({value:w,label:w})});const h=[{value:"all",label:"Any provider"}];(s||[]).forEach(w=>{h.push({value:w,label:w})});const p=(w,S)=>{S==="tag"?i(w):S==="provider"&&c(w)},m=w=>{d(w)},g=()=>{i("all"),c("all"),d("")},y=r.filter(w=>!(u&&!w.title.toLowerCase().includes(u)&&!w.description.toLowerCase().includes(u)||a!=="all"&&!w.tags.includes(a)||l!=="all"&&!w.supportedProviders.includes(l))),x=u||a!=="all"||l!=="all";return o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Zu,{children:[o.jsx(Ce,{children:o.jsx(qb,{})}),"Templates"]})}),o.jsxs("div",{className:Z("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[o.jsx(OAn,{selectedTag:a,onTagChange:w=>p(w,"tag"),tagOptions:f,selectedProvider:l,onProviderChange:w=>p(w,"provider"),providerOptions:h,searchTerm:u,onSearchChange:m,onReset:x?g:void 0,className:"max-w-[80rem]",isLoading:t}),o.jsx(SAn,{templates:y,linkComponent:dr,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const _An="1.29.0-alpha.0";function EAn({errorMsg:e,validationErrors:t}){const r=typeof e=="string"?e:e!=null?String(e):void 0,n=r?.includes("Invalid schema for function"),s=r?.includes("validation issue")||t&&t.length>0,a=()=>s?"Template installation completed but some validation issues remain. The template may still be functional, but you should review and fix these issues.":n?"There was an issue with the AI model configuration. This may be related to the selected model or AI SDK version compatibility.":"An unexpected error occurred during template installation.",i=()=>s?{icon:o.jsx(kh,{className:"text-yellow-500"}),title:"Template Installed with Warnings"}:{icon:o.jsx(i2t,{}),title:"Template Installation Failed"},{icon:l,title:c}=i();return o.jsxs(eB,{className:"space-y-4 text-neutral3 mb-8 content-center",children:[o.jsxs("div",{className:Z("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[l,o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("p",{className:"text-ui-md font-medium text-neutral5",children:c}),o.jsx("p",{className:"text-ui-md text-neutral3",children:a()})]})]}),t&&t.length>0&&o.jsxs("details",{className:"text-xs",children:[o.jsxs("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:["Show Validation Issues (",t.length,")"]}),o.jsx("div",{className:"mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto max-h-60 text-left space-y-2",children:t.map((u,d)=>o.jsxs("div",{className:"border-l-2 border-red-400 pl-2",children:[o.jsx("div",{className:"font-medium text-red-600 dark:text-red-400",children:u.type==="typescript"?"🔴 TypeScript Error":"⚠️ Lint Error"}),o.jsx("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-300 mt-1 whitespace-pre-wrap wrap-break-word",children:u.message})]},d))})]}),r&&!s&&o.jsxs("details",{className:"text-xs",children:[o.jsx("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:"Show Details"}),o.jsx("div",{className:"mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded text-xs font-mono overflow-auto max-h-60 text-left",children:o.jsx("div",{className:"whitespace-pre-wrap wrap-break-word",children:r})})]})]})}function CAn({providerOptions:e,selectedProvider:t,onProviderChange:r,variables:n,errors:s,handleInstallTemplate:a,handleVariableChange:i,isLoadingEnvVars:l,isInstalling:c,defaultModelProvider:u,defaultModelId:d,onModelUpdate:f}){return o.jsx(eB,{children:o.jsxs("div",{className:"max-w-[40rem] my-4 p-4 lg:p-8 mx-auto gap-8 grid",children:[o.jsxs("h2",{className:Z("text-neutral4 text-header-sm font-semibold flex items-center gap-2","[&>svg]:w-[1.2em] [&_svg]:h-[1.2em] [&_svg]:opacity-70"),children:["Install Template ",o.jsx(bVe,{})]}),o.jsx($o,{name:"template-provider",options:e,label:"Template AI Model Provider",onValueChange:r,value:t,placeholder:"Select",layout:"horizontal"}),t&&Object.entries(n||{}).length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"text-neutral3 text-ui-md",children:"Set required Environmental Variables"}),o.jsx("div",{className:"grid grid-cols-[1fr_1fr] gap-4 items-start",children:l?o.jsxs("div",{className:Z("flex items-center justify-center col-span-2 text-neutral3 text-ui-sm gap-4","[&_svg]:opacity-50 [&_svg]:w-[1.1em] [&_svg]:h-[1.1em]","animate-in fade-in duration-300"),children:[o.jsx(Mt,{})," Loading variables..."]}):Object.entries(n).map(([h,p])=>o.jsxs(b.Fragment,{children:[o.jsx(jx,{name:`env-${h}`,labelIsHidden:!0,label:"Key",value:h,disabled:!0,className:"w-full"}),o.jsx(jx,{name:h,labelIsHidden:!0,label:"Value",value:p,onChange:i,errorMsg:s.includes(h)?"Value is required.":"",autoComplete:"off",className:"w-full"})]},h))}),o.jsxs("div",{className:"border-t border-border1 pt-12 mt-3.5 relative",children:[o.jsx("div",{className:"absolute w-8 h-8 rounded-full bg-surface2 top-0 left-1/2 -translate-x-1/2 -translate-y-4 text-ui-sm text-neutral3 flex items-center justify-center",children:"And"}),o.jsx("h3",{className:"text-neutral4 text-ui-lg",children:"Set AI Model for Template Installation"}),o.jsx("p",{className:"text-neutral3 text-ui-md mt-2 mb-8",children:"This model will be used by the workflow to process and install the template"}),o.jsx(lSt,{defaultProvider:u||"",defaultModel:d||"",updateModel:f||(()=>Promise.resolve({message:"Updated"})),closeEditor:()=>{},autoSave:!0,selectProviderPlaceholder:"Provider"})]})]}),t&&!l&&o.jsx(pe,{className:Z("flex items-center gap-2 mt-4 justify-center text-ui-md w-full bg-surface5 min-h-10 rounded-lg text-neutral5 hover:bg-surface6 transition-colors","[&>svg]:w-[1.1em] [&_svg]:h-[1.1em] [&_svg]:text-neutral5"),onClick:a,disabled:!t||!u||!d||s.length>0||c,children:c?o.jsxs(o.Fragment,{children:[o.jsx(Mt,{className:"w-4 h-4"})," Installing..."]}):o.jsxs(o.Fragment,{children:["Install ",o.jsx(Fw,{})]})})]})})}function jAn({title:e,description:t,githubUrl:r,isLoading:n,infoData:s,templateSlug:a}){const i=a?`feat/install-template-${a}`:"feat/install-template-[slug]";return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:Z("grid mt-8 items-center"),children:o.jsxs("div",{className:Z("text-header-lg flex items-center gap-3","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",{"[&>svg]:opacity-20":n}),children:[o.jsx(qb,{}),o.jsx("h2",{className:Z({"bg-surface4 flex rounded-lg min-w-[50%]":n}),children:n?o.jsx(o.Fragment,{children:" "}):e})]})}),o.jsxs("div",{className:"grid lg:grid-cols-[1fr_1fr] gap-x-24",children:[o.jsxs("div",{className:"grid",children:[o.jsx("p",{className:Z("mb-4 text-ui-md text-neutral4 mt-2 leading-7",{"bg-surface4 rounded-lg ":n}),children:n?o.jsx(o.Fragment,{children:" "}):t}),!n&&a&&o.jsxs("div",{className:Z("bg-surface2 border border-surface4 rounded-lg p-4 mb-4","flex items-start gap-3"),children:[o.jsx("div",{className:"shrink-0 mt-0.5",children:o.jsx(Uy,{className:"w-[1.1em] h-[1.1em] text-blue-500"})}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(sF,{className:"w-[1em] h-[1em] text-neutral4"}),o.jsx("span",{className:"text-ui-md font-medium text-neutral5",children:"A new Git branch will be created"})]}),o.jsxs("div",{className:"text-ui-sm text-neutral4 space-y-1",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-medium",children:"Branch name:"})," ",o.jsx("code",{className:"bg-surface3 px-1.5 py-0.5 rounded text-ui-sm font-mono",children:i})]}),o.jsx("div",{children:"This ensures safe installation with easy rollback if needed. Your main branch remains unchanged."})]})]})]}),r&&o.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 mt-auto text-neutral3 text-ui-md hover:text-neutral5",children:[o.jsx(ldt,{}),r?.split("/")?.pop()]})]}),s&&o.jsx(bC,{data:s,labelsAreHidden:!0,isLoading:n})]})]})}function TAn({name:e,streamResult:t,workflowInfo:r}){const n=t?.phase||"initializing",s=t?.payload?.workflowState,a=t?.payload?.currentStep,i=t?.error,l=s?.steps||{},c=Object.keys(l).length>0,u=m=>m==="input"||m.endsWith(".input")||m.startsWith("Mapping_")&&/[0-9a-f]{8}/.test(m)||/[0-9a-f]{8,}/.test(m)?!1:r?.allSteps?m in r.allSteps:!0,d=Object.entries(l).filter(([m,g])=>u(m)),f=d.length,h=()=>{switch(n){case"initializing":return"Preparing template installation...";case"processing":return`Installing ${e} template`;case"completed":return"Template installation completed!";case"error":return"Template installation failed";default:return"Installing template..."}},p=d.map(([m,g])=>({id:m,status:g?.status,description:g?.description,title:m.charAt(0).toUpperCase()+m.slice(1).replace(/-/g," "),isActive:a?.id===m}));return o.jsxs(eB,{className:"space-y-6 text-neutral3 mb-8 content-center",children:[o.jsxs("div",{className:"text-center",children:[o.jsx("h3",{className:"text-lg font-semibold text-neutral5",children:h()}),t?.runId&&o.jsxs("div",{className:"mt-2 text-ui-sm text-neutral3",children:["Run ID: ",t.runId]})]}),c&&f>0&&!["error"].includes(n)&&o.jsx("div",{className:"max-w-[30rem] w-full mx-auto px-6",children:o.jsx(h3r,{steps:p})}),i&&n==="error"&&o.jsxs("div",{className:Z("rounded-lg text-neutral5 p-6 flex items-center gap-3 text-ui-md bg-red-500/10","[&>svg]:w-6 [&>svg]:h-6 [&>svg]:opacity-70 [&>svg]:text-red-500"),children:[o.jsx(J2t,{}),i||"Something went wrong"]}),c&&o.jsx(f3r,{steps:p,currentStep:a,className:"pb-4"}),!c&&n==="initializing"&&o.jsxs("div",{className:"text-center text-sm text-neutral3 grid gap-4 justify-items-center",children:[o.jsx(Mt,{}),o.jsx("p",{children:"This may take some time..."})]})]})}function NAn({name:e,installedEntities:t}){return o.jsxs(eB,{className:Z("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[o.jsx(bVe,{}),o.jsx("h2",{className:"text-header-md",children:"Done!"}),o.jsxs("p",{className:"text-ui-md text-center text-neutral3 ",children:["The ",o.jsx("b",{className:"text-neutral4",children:e})," template has been successfully installed.",t&&t.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("br",{})," Installed entities are listed below."]})]}),t&&t.length>0&&o.jsx(bC,{data:t})]})}function AAn(){const{templateSlug:e}=ra(),[t,r]=so(),[n,s]=b.useState(""),[a,i]=b.useState(""),[l,c]=b.useState(""),[u,d]=b.useState({}),[f,h]=b.useState([]),[p,m]=b.useState(null),[g,y]=b.useState(!1),[x,w]=b.useState(""),[S,k]=b.useState(!1),[_,E]=b.useState(!1),[T,j]=b.useState([]),{data:N,isLoading:I}=pzr({repoOrSlug:e,owner:"mastra-ai"}),R=_An?.includes("beta")??!1?"beta":"main",{data:$,isLoading:M}=mzr({repo:N?.githubUrl?new URL(N.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:R}),{data:z,isLoading:U}=gzr(),{mutateAsync:B,isPending:H}=yzr(),{mutateAsync:W}=vzr(),{streamInstall:L,streamResult:Y,isStreaming:q}=xzr(z),{observeInstall:D,streamResult:Q,isStreaming:G}=wzr(z);b.useEffect(()=>{const te=t.get("runId");te&&!g&&!p&&!q&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:te}),w(te),W({runId:te}).then(le=>{const ve=le.snapshot;if(ve?.status==="success"&&ve?.result?.success)y(!0);else if(ve?.result?.success===!1)if(ve?.result?.validationResults&&!ve?.result?.validationResults?.valid&&ve?.result?.validationResults?.remainingErrors>0){const{remainingErrors:fe,errors:xe}=ve.result.validationResults,Se=`Template installation completed but ${fe} validation issue${fe>1?"s":""} remain unresolved.`;m(Se),j(xe||[])}else{const fe=ve?.result?.message||ve?.result?.error||"Template installation failed";m(typeof fe=="string"?fe:String(fe))}}).catch(le=>{console.error("❌ Failed to fetch run details:",le),m("Failed to retrieve installation status after reload")}))},[t,g,p,q,G,W]),b.useEffect(()=>{const te=t.get("runId"),le=t.get("resume"),ve=t.get("provider");if(te&&le==="true"&&ve&&!q&&!G&&!S&&!_&&z){w(te),k(!0);try{W({runId:te}).then(ue=>{if(ue.snapshot?.status==="running")return D.mutateAsync({runId:te})}).then(()=>{r(ue=>{const fe=new URLSearchParams(ue);return fe.delete("resume"),fe})}).catch(ue=>{console.error("❌ Failed to resume template installation:",ue),ue.message?.includes("404")||ue.message?.includes("not found")?m("Template installation run not found. It may have expired or been completed."):m("Failed to resume template installation. Please try again.")})}catch(ue){console.error("❌ Auto-resume failed with error:",ue),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,q,G,S,_,z,W,D,r]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],ae=[{key:"tools",label:"Tools",value:N?.tools?.length?N.tools.map(te=>te).join(", "):"n/a",icon:o.jsx(Pi,{})},{key:"agents",label:"Agents",value:N?.agents?.length?N.agents.map(te=>te).join(", "):"n/a",icon:o.jsx(pa,{})},{key:"workflows",label:"Workflows",value:N?.workflows?.length?N.workflows.map(te=>te).join(", "):"n/a",icon:o.jsx(lF,{})},{key:"providers",label:"Providers",value:N?.supportedProviders?.length?N.supportedProviders.join(", "):"n/a",icon:o.jsx(Nm,{})},{key:"tags",label:"Tags",value:N?.tags?.length?N.tags.join(", "):"n/a",icon:o.jsx(AE,{})}],re=[{...ae[0]},{...ae[1]},{...ae[2]}].filter(te=>te.value!=="n/a");b.useEffect(()=>{$&&d($)},[$]),b.useEffect(()=>{const te=Y||Q;te?.phase==="error"&&te?.error&&m(typeof te.error=="string"?te.error:String(te.error))},[Y?.phase,Y?.error,Q?.phase,Q?.error]);const se=te=>{s(te)},oe=async te=>(i(te.provider),c(te.modelId),{message:"Model updated successfully"}),he=async()=>{const te=Object.entries(u).reduce((le,[ve,ue])=>(ue===""&&le.push(ve),le),[]);if(te.length>0){h(te);return}if(N){m(null),y(!1),w(""),E(!0);try{const ve={repo:N.githubUrl||`https://github.com/mastra-ai/template-${N.slug}`,ref:R,slug:N.slug,variables:u},{runId:ue}=await B({});w(ue),r(fe=>{const xe=new URLSearchParams(fe);return xe.set("runId",ue),xe.set("resume","true"),xe.set("provider",n||"openai"),xe}),await L.mutateAsync({inputData:ve,selectedModel:{provider:a,modelId:l},runId:ue})}catch(le){E(!1),m(le?.message||"Template installation failed"),console.error("Template installation failed",le)}}},X=te=>{const{name:le,value:ve}=te.target;ve.trim()===""?h(ue=>[...ue,le]):h(ue=>ue.filter(fe=>fe!==le)),d(ue=>({...ue,[le]:ve}))};return o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/templates",children:[o.jsx(Ce,{children:o.jsx(qb,{})}),"Templates"]}),o.jsx(jr,{as:dr,to:`/templates/${N?.slug}`,isCurrent:!0,children:N?.title&&N.title})]})}),o.jsx("div",{className:Z("w-full lg:px-12 h-full overflow-y-scroll"),children:o.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[o.jsx(jAn,{isLoading:I,title:N?.title,description:N?.longDescription,imageURL:N?.imageURL,githubUrl:N?.githubUrl,infoData:ae,templateSlug:e}),N&&o.jsxs(o.Fragment,{children:[(q||G)&&o.jsx(TAn,{name:N.title,streamResult:G?Q:Y,runId:x,workflowInfo:z}),g&&o.jsx(NAn,{name:N.title,installedEntities:re,linkComponent:dr}),p&&o.jsx(EAn,{errorMsg:p,validationErrors:T.length>0?T:Y?.validationResults?.errors||Q?.validationResults?.errors}),!q&&!G&&!g&&!p&&o.jsx(CAn,{providerOptions:J,selectedProvider:n,onProviderChange:se,variables:u,setVariables:d,errors:f,setErrors:h,handleInstallTemplate:he,handleVariableChange:X,isLoadingEnvVars:M||U,isInstalling:H,defaultModelProvider:a,defaultModelId:l,onModelUpdate:oe})]})]})})]})}const IAn=()=>{const{toolId:e,agentId:t}=ra();return o.jsxs(zr,{children:[o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/agents",children:[o.jsx(Ce,{children:o.jsx(pa,{})}),"Agents"]}),o.jsx(jr,{as:dr,to:`/agents/${t}/chat`,children:t}),o.jsx(jr,{as:dr,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[o.jsx(Ce,{children:o.jsx(u0,{})}),"Tools documentation"]})})]}),o.jsx(eOn,{toolId:e,agentId:t})]})},RAn=()=>{const{toolId:e}=ra();return o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/tools",children:[o.jsx(Ce,{children:o.jsx(Pi,{})}),"Tools"]}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:o.jsx(UNn,{value:e,variant:"ghost"})})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(u0,{}),"Tools documentation"]})})]}),o.jsx(BNn,{toolId:e})]})},BBe="auto auto auto auto 1fr";function L1t({scoresData:e,isLoadingScoresData:t,onPageChange:r,onScoreSelect:n}){return t?o.jsx(H9,{columns:BBe}):o.jsxs("div",{className:"grid gap-2",children:[o.jsxs(Rc,{columns:BBe,className:"min-w-0",children:[o.jsxs(Rc.Top,{children:[o.jsx(Rc.TopCell,{children:"ID"}),o.jsx(Rc.TopCell,{children:"Date"}),o.jsx(Rc.TopCell,{children:"Time"}),o.jsx(Rc.TopCell,{children:"Score"}),o.jsx(Rc.TopCell,{children:"Scorer"})]}),e?.scores&&e.scores.length>0?e.scores.map(s=>{const a=new Date(s.createdAt),i=mv(a);return o.jsxs(Rc.RowButton,{onClick:()=>n?.(s),children:[o.jsx(Rc.Cell,{height:"compact",className:"font-mono text-neutral3 text-ui-smd",children:nf(s?.id)||"n/a"}),o.jsx(Rc.Cell,{height:"compact",className:"text-neutral2 text-ui-smd",children:i?"Today":ur(a,"MMM dd")}),o.jsx(Rc.Cell,{height:"compact",className:"font-mono text-neutral3 text-ui-smd",children:ur(a,"h:mm:ss aaa")}),o.jsx(Rc.Cell,{height:"compact",className:"text-ui-smd",children:String(s?.score??"")}),o.jsx(Rc.Cell,{height:"compact",className:"text-ui-smd",children:String(s?.scorer?.name||s?.scorer?.id||"")})]},s.id)}):o.jsx(Rc.NoMatch,{message:"No scores found"})]}),o.jsx(Rc.Pagination,{currentPage:e?.pagination?.page||0,hasMore:e?.pagination?.hasMore,onNextPage:()=>r?.((e?.pagination?.page||0)+1),onPrevPage:()=>r?.((e?.pagination?.page||0)-1)})]})}function PAn(){const[e,t]=so(),[r,n]=b.useState(!1),s=_Fr(e,t,{onRemoveAll:()=>n(!1)}),[a,i]=b.useState(),[l,c]=b.useState(0),[u,d]=b.useState(!1),[f,h]=b.useState(null);b.useEffect(()=>c(0),[s.traceIdParam,s.spanIdParam]);const{data:p,isLoading:m}=fd(),{data:g,isLoading:y}=hve({traceId:s.traceIdParam,spanId:s.spanIdParam,page:l}),{data:x,isLoading:w}=Ame(s.traceIdParam??null),S=b.useMemo(()=>x?.spans,[x?.spans]),{data:k,isLoading:_}=FS(s.traceIdParam??"",s.spanIdParam??""),E=s.scoreIdParam?g?.scores?.find(te=>te.id===s.scoreIdParam):void 0,{data:T=[],isPending:j}=hht(),{data:N=[],isPending:I}=pht({entityType:s.selectedEntityOption?.entityType,rootOnly:!0}),{data:P=[],isPending:R}=mht(),{data:$=[],isPending:M}=ght(),z=b.useMemo(()=>yFr({availableTags:T,availableRootEntityNames:N,availableServiceNames:$,availableEnvironments:P,loading:{tags:j,entityNames:I,serviceNames:M,environments:R}}),[T,N,$,P,j,I,M,R]),U=b.useMemo(()=>wFr({rootEntityType:s.selectedEntityOption?.entityType,status:s.selectedStatus,dateFrom:s.selectedDateFrom,dateTo:s.selectedDateTo,tokens:s.filterTokens}),[s.filterTokens,s.selectedDateFrom,s.selectedDateTo,s.selectedEntityOption,s.selectedStatus]),{data:B,isLoading:H,isFetchingNextPage:W,hasNextPage:L,setEndOfListElement:Y,error:q}=uFr({filters:U}),D=b.useMemo(()=>B?.spans??[],[B?.spans]),Q=B?.threadTitles??{},{handlePreviousSpan:G,handleNextSpan:J}=yht(S,s.spanIdParam??null,te=>s.handleSpanChange(te)),ae=jFr(e,t),re=b.useCallback(()=>s.applyFilterTokens(SFr(z,s.filterTokens)),[z,s]),{handlePreviousTrace:se,handleNextTrace:oe}=OFr(D,s.traceIdParam,s.handleTraceClick),he=b.useCallback(()=>{const te=S?.find(le=>le.parentSpanId==null);te&&(s.handleSpanChange(te.spanId),s.handleSpanTabChange("scoring"))},[S,s]);if(q)return o.jsx(Jr,{title:"Traces",icon:o.jsx(xo,{}),children:o.jsx(fht,{error:q,resource:"traces",errorTitle:"Failed to load traces"})});const X=!!s.selectedEntityOption||!!s.selectedStatus||s.filterTokens.length>0||s.datePreset!=="last-24h"||!!s.selectedDateTo;return o.jsxs(bt,{width:"wide",height:"full",children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:H,children:[o.jsx(xo,{})," Traces"]})})}),o.jsxs(bt.Column,{className:"flex justify-end items-center gap-2",children:[o.jsx(Wft,{preset:s.datePreset,onPresetChange:s.handleDatePresetChange,dateFrom:s.selectedDateFrom,dateTo:s.selectedDateTo,onDateChange:s.handleDateChange,disabled:H,presets:["last-24h","last-3d","last-7d","last-14d","last-30d","custom"]}),o.jsx(Xdt,{fields:z,tokens:s.filterTokens,onTokensChange:s.handleFilterTokensChange,disabled:H,onStartTextFilter:i}),o.jsx(Cn,{disabled:H,"aria-pressed":r,"aria-label":r?"Ungroup traces":"Group traces by thread",tooltipContent:r?"Ungroup traces":"Group traces by thread",onClick:()=>n(te=>!te),children:r?o.jsx(d3,{}):o.jsx(mVe,{})}),o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/observability/tracing/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Traces documentation",tooltipContent:"Go to Traces documentation",children:o.jsx(Di,{})})]})]}),o.jsx(W6r,{isLoading:H,filterFields:z,filterTokens:s.filterTokens,onFilterTokensChange:s.handleFilterTokensChange,onClear:re,onRemoveAll:s.handleRemoveAll,onSave:ae.handleSave,onRemoveSaved:ae.hasSavedFilters?ae.handleRemoveSaved:void 0,autoFocusFilterFieldId:a})]}),o.jsx(tFr,{traceCollapsed:u,listSlot:o.jsx(nFr,{traces:D,isLoading:H,isFetchingNextPage:W,hasNextPage:L,setEndOfListElement:Y,filtersApplied:X,featuredTraceId:s.traceIdParam,onTraceClick:te=>s.handleTraceClick(s.traceIdParam===te.traceId?"":te.traceId),groupByThread:r,threadTitles:Q}),tracePanelSlot:s.traceIdParam?o.jsx(uht,{traceId:s.traceIdParam,spans:S,isLoading:w,onClose:s.handleTraceClose,onSpanSelect:te=>s.handleSpanChange(te??null),onEvaluateTrace:he,onSaveAsDatasetItem:te=>h(te),initialSpanId:s.spanIdParam,onPrevious:se,onNext:oe,collapsed:u,onCollapsedChange:d,placement:"traces-list",LinkComponent:S8,traceHref:`/traces/${s.traceIdParam}`}):null,spanPanelSlot:s.traceIdParam&&s.spanIdParam?o.jsx(dht,{traceId:s.traceIdParam,spanId:s.spanIdParam,span:k?.span,isLoading:_,onClose:s.handleSpanClose,onPrevious:G,onNext:J,activeTab:s.spanTabParam??"details",onTabChange:te=>s.handleSpanTabChange(te),scoringTabBadge:g?.pagination?.total??void 0,scoringTabSlot:({span:te,traceId:le,spanId:ve})=>o.jsxs("div",{className:"grid gap-6",children:[o.jsx(Sve,{traceId:le,isTopLevelSpan:!te.parentSpanId,spanId:ve,entityType:te.attributes?.agentId||te.entityType===Do.AGENT?"Agent":te.attributes?.workflowId||te.entityType===Do.WORKFLOW_RUN?"Workflow":void 0,scorers:p,isLoadingScorers:m}),o.jsx(L1t,{scoresData:g,onPageChange:c,isLoadingScoresData:y,onScoreSelect:ue=>s.handleScoreChange(ue.id)})]})}):null,scorePanelSlot:E?o.jsx(dve,{score:E,onClose:()=>s.handleScoreChange(null)}):null}),f&&o.jsx(Ove,{rootSpanId:f.rootSpanId,traceId:f.traceId,isOpen:!0,onClose:()=>h(null)})]})}function MAn(){const{traceId:e}=ra(),[t,r]=so(),n=fu(),s=t.get("spanId")||void 0,a=t.get("tab"),i=a==="scoring"?"scoring":"details",l=t.get("scoreId")||void 0,[c,u]=b.useState(s??null),[d,f]=b.useState(),[h,p]=b.useState(i),[m,g]=b.useState(0),[y,x]=b.useState(!1),{data:w,isLoading:S,error:k}=Ame(e),_=b.useMemo(()=>w?.spans??[],[w?.spans]),E=b.useMemo(()=>_.find(G=>G.parentSpanId==null),[_]),{data:T,isLoading:j}=FS(e,c??"");b.useEffect(()=>g(0),[e,c]);const{data:N,isLoading:I}=fd(),{data:P,isLoading:R}=hve({traceId:e,spanId:c??void 0,page:m});b.useEffect(()=>{if(l&&P?.scores&&!d){const G=P.scores.find(J=>J.id===l);G&&f(G)}},[l,P?.scores,d]);const $=b.useCallback(G=>{const J=new URLSearchParams(t);for(const[ae,re]of Object.entries(G))re===null||re===""?J.delete(ae):J.set(ae,re);r(J,{replace:!0})},[t,r]),M=b.useCallback(G=>{const J=G??null,ae=J===c;u(J),ae||(f(void 0),p("details"),$({spanId:J,tab:null,scoreId:null}))},[c,$]),z=b.useCallback(()=>{u(null),f(void 0),p("details"),$({spanId:null,tab:null,scoreId:null})},[$]),U=b.useCallback(G=>{u(G),f(void 0),p("details"),$({spanId:G,tab:null,scoreId:null})},[$]),{handlePreviousSpan:B,handleNextSpan:H}=yht(_,c,U),W=b.useCallback(G=>{const J=G;p(J),f(void 0),$({tab:J==="details"?null:J,scoreId:null})},[$]),L=b.useCallback(G=>{f(G),$({scoreId:G.id})},[$]),Y=b.useCallback(()=>{f(void 0),$({scoreId:null})},[$]),q=b.useCallback(()=>{n("/observability")},[n]),D=b.useCallback(()=>{p("scoring"),E&&c!==E.spanId?(u(E.spanId),f(void 0),$({spanId:E.spanId,tab:"scoring",scoreId:null})):$({tab:"scoring"})},[E,c,$]),Q=o.jsxs(o.Fragment,{children:[o.jsxs(pe,{as:S8,href:"/observability",variant:"link",size:"md",className:"text-neutral2",children:[o.jsx(_p,{}),"Back to Traces"]}),o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:S,children:[o.jsx(xo,{})," Trace ",o.jsx("span",{className:"text-neutral3",children:e})]})})}),o.jsx(bt.Column,{children:o.jsxs(ps,{children:[o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/observability/tracing/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Traces documentation",tooltipContent:"Go to Traces documentation",children:o.jsx(Di,{})}),E&&o.jsxs(o.Fragment,{children:[o.jsxs(Cn,{tooltipContent:"Evaluate Trace","aria-label":"Evaluate Trace",onClick:D,children:[o.jsx(c3,{}),"Evaluate"]}),o.jsxs(Cn,{tooltipContent:"Save as Dataset Item","aria-label":"Save as Dataset Item",onClick:()=>x(!0),children:[o.jsx(nu,{}),"Save"]})]})]})})]}),E&&o.jsx(bt.Row,{children:o.jsx(bt.Column,{children:o.jsx(oht,{rootSpan:E,numOfCol:3})})})]});return k?o.jsxs(bt,{height:"full",children:[o.jsx(bt.TopArea,{children:Q}),o.jsx(bt.MainArea,{isCentered:!0,children:o.jsx(fht,{error:k,resource:"traces",errorTitle:"Failed to load trace"})})]}):o.jsxs(bt,{children:[o.jsx(bt.TopArea,{children:Q}),o.jsx(Ove,{rootSpanId:E?.spanId,traceId:e,isOpen:y,onClose:()=>x(!1)}),o.jsxs("div",{className:Z("grid h-full min-h-0 gap-4 overflow-hidden items-start mt-4",c?"grid-cols-[2fr_3fr]":"grid-cols-[1fr]"),children:[o.jsx(uht,{traceId:e,spans:_,isLoading:S,onClose:q,onSpanSelect:M,onEvaluateTrace:D,initialSpanId:c,placement:"trace-page",timelineChartWidth:c?"default":"wide"}),c&&!S&&o.jsxs("div",{className:Z("grid gap-4 max-h-full min-h-0 overflow-auto",d?"grid-rows-[1fr_1fr]":"grid-rows-[1fr]"),children:[o.jsx(dht,{traceId:e,spanId:c,span:T?.span,isLoading:j,onClose:z,onPrevious:B,onNext:H,activeTab:h,onTabChange:W,scoringTabBadge:P?.pagination?.total??void 0,scoringTabSlot:({span:G,traceId:J,spanId:ae})=>o.jsxs("div",{className:"grid gap-6",children:[o.jsx(Sve,{traceId:J,isTopLevelSpan:!G.parentSpanId,spanId:ae,entityType:G.attributes?.agentId||G.entityType===Do.AGENT?"Agent":G.attributes?.workflowId||G.entityType===Do.WORKFLOW_RUN?"Workflow":void 0,scorers:N,isLoadingScorers:I}),o.jsx(L1t,{scoresData:P,onPageChange:g,isLoadingScoresData:R,onScoreSelect:L})]})}),d&&o.jsx(dve,{score:d,onClose:Y})]})]})]})}function DAn(){const{data:e,isLoading:t,error:r}=d0(),[n,s]=b.useState("");return r&&Ps(r)?o.jsx(Jr,{title:"Workflows",icon:o.jsx(Mi,{}),children:o.jsx(na,{})}):r&&ks(r)?o.jsx(Jr,{title:"Workflows",icon:o.jsx(Mi,{}),children:o.jsx(Gs,{resource:"workflows"})}):r?o.jsx(Jr,{title:"Workflows",icon:o.jsx(Mi,{}),children:o.jsx(gu,{title:"Failed to load workflows",message:r.message})}):Object.keys(e||{}).length===0&&!t?o.jsx(Jr,{title:"Workflows",icon:o.jsx(Mi,{}),children:o.jsx(Ehn,{})}):o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:t,children:[o.jsx(Mi,{})," Workflows"]})})}),o.jsx(bt.Column,{className:"flex justify-end gap-2",children:o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workflows documentation",children:o.jsx(Di,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(_g,{onSearch:s,label:"Filter workflows",placeholder:"Filter by name or description"})})]}),o.jsx(_hn,{workflows:e||{},isLoading:t,search:n})]})}const UBe=()=>{const{workflowId:e}=ra(),{data:t,isLoading:r,error:n}=FP(e);return n&&Ps(n)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})}):n&&ks(n)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"workflows"})}):o.jsx(ywt,{workflowId:e,workflow:t??void 0,isLoading:r})};function LAn(e){if(!e)return null;switch(e.icon||e.provider){case"aws-s3":case"s3":return o.jsx(udt,{className:"h-4 w-4 text-[#FF9900]"});case"google-cloud":case"google-cloud-storage":case"gcs":return o.jsx(cdt,{className:"h-4 w-4"});case"azure-blob":case"azure":return o.jsx(ddt,{className:"h-4 w-4 text-[#0078D4]"});case"cloudflare":case"cloudflare-r2":case"r2":return o.jsx(mU,{className:"h-4 w-4 text-[#F38020]"});case"minio":return o.jsx(Dre,{className:"h-4 w-4 text-red-400"});case"database":return o.jsx(ja,{className:"h-4 w-4 text-emerald-400"});case"local":case"folder":return o.jsx(oc,{className:"h-4 w-4 text-amber-400"});case"hard-drive":return o.jsx(Dre,{className:"h-4 w-4 text-slate-400"});case"cloud":return o.jsx(mU,{className:"h-4 w-4 text-sky-400"});default:return o.jsx(mU,{className:"h-4 w-4 text-neutral4"})}}function $1t(e,t=!1){const{name:r,type:n,mount:s}=e;if(n==="directory")return s?LAn(s):t?o.jsx(jE,{className:"h-4 w-4 text-amber-400"}):o.jsx(oc,{className:"h-4 w-4 text-amber-400"});switch(r.split(".").pop()?.toLowerCase()){case"ts":case"tsx":case"js":case"jsx":return o.jsx(px,{className:"h-4 w-4 text-blue-400"});case"json":return o.jsx(SR,{className:"h-4 w-4 text-yellow-400"});case"md":case"mdx":return o.jsx(Zi,{className:"h-4 w-4 text-neutral4"});case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return o.jsx(rce,{className:"h-4 w-4 text-purple-400"});default:return o.jsx(ece,{className:"h-4 w-4 text-neutral4"})}}function F1t(e){if(e==null||Number.isNaN(e))return"";if(e<0)return"-"+F1t(-e);if(e===0)return"0 B";const t=1024,r=["B","KB","MB","GB","TB"],n=Math.min(Math.floor(Math.log(e)/Math.log(t)),r.length-1);return parseFloat((e/Math.pow(t,n)).toFixed(1))+" "+r[n]}function $An(e){if("body"in e&&e.body&&typeof e.body=="object"){const n=e.body;if(typeof n.error=="string")return n.error;if(typeof n.message=="string")return n.message}const t=e.message,r=t.lastIndexOf(" - {");if(r!==-1)try{const n=t.slice(r+3),s=JSON.parse(n);if(s.error)return s.error;if(s.message)return s.message}catch{}return t.includes("status: 404")?"Directory not found":t}function z1t(e){return e==="."||e===""}function FAn({path:e,onNavigate:t}){const n=z1t(e)?[]:e.split("/").filter(Boolean);return o.jsxs("div",{className:"flex items-center gap-1 text-sm overflow-x-auto",children:[o.jsx("button",{onClick:()=>t("."),className:"p-1 rounded hover:bg-surface4 text-neutral5 hover:text-neutral6 transition-colors","aria-label":"Workspace root",children:o.jsx(jE,{className:"h-4 w-4"})}),n.map((s,a)=>{const i=n.slice(0,a+1).join("/");return o.jsxs("div",{className:"flex items-center",children:[o.jsx(Vs,{className:"h-4 w-4 text-neutral3"}),o.jsx("button",{onClick:()=>t(i),className:"px-2 py-1 rounded hover:bg-surface4 text-neutral5 hover:text-neutral6 transition-colors truncate max-w-[150px]",title:s,children:s})]},i)})]})}function zAn({entries:e,currentPath:t,isLoading:r,error:n,onNavigate:s,onFileSelect:a,onRefresh:i,onUpload:l,onCreateDirectory:c,onDelete:u,isCreatingDirectory:d,isDeleting:f}){const[h,p]=b.useState(null),m=[...e].sort((w,S)=>w.type==="directory"&&S.type!=="directory"?-1:w.type!=="directory"&&S.type==="directory"?1:w.name.localeCompare(S.name)),g=z1t(t),y=w=>{const S=g?w.name:`${t}/${w.name}`;w.type==="directory"?s(S):a?.(S)},x=w=>{const S=g?w.name:`${t}/${w.name}`;p(S)};return o.jsxs("div",{className:"rounded-lg border border-border1 overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-surface3 border-b border-border1",children:[o.jsx(FAn,{path:t,onNavigate:s}),o.jsxs("div",{className:"flex items-center gap-1",children:[i&&o.jsx(pe,{variant:"ghost",size:"md",onClick:i,disabled:r,"aria-label":"Refresh files",children:o.jsx(OR,{className:`h-4 w-4 ${r?"animate-spin":""}`})}),c&&o.jsx(pe,{variant:"ghost",size:"md",disabled:d,"aria-label":"Create directory",onClick:()=>{const w=prompt("Directory name:");if(w){const S=g?w:`${t}/${w}`;c(S)}},children:d?o.jsx(Ta,{className:"h-4 w-4 animate-spin"}):o.jsx(nF,{className:"h-4 w-4"})}),l&&o.jsx(pe,{variant:"ghost",size:"md",onClick:l,"aria-label":"Upload files",children:o.jsx(oF,{className:"h-4 w-4"})})]})]}),o.jsx("div",{className:"max-h-[400px] overflow-auto",children:r?o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(Ta,{className:"h-6 w-6 animate-spin text-neutral3"})}):n?o.jsxs("div",{className:"py-12 px-4 text-center",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-red-500/10 mb-4",children:o.jsx(tA,{className:"h-6 w-6 text-red-400"})}),o.jsx("p",{className:"text-sm text-neutral6 font-medium mb-1",children:"Failed to load directory"}),o.jsx("p",{className:"text-xs text-neutral4 max-w-sm mx-auto",children:$An(n)})]}):m.length===0?o.jsx("div",{className:"py-12 text-center text-neutral4 text-sm",children:g?"Workspace is empty":"Directory is empty"}):o.jsx(ld,{children:o.jsxs("ul",{children:[!g&&o.jsx("li",{children:o.jsxs("button",{onClick:()=>{const w=t.split("/").slice(0,-1).join("/")||".";s(w)},className:"w-full flex items-center gap-3 px-4 py-2 hover:bg-surface4 transition-colors text-left",children:[o.jsx(jE,{className:"h-4 w-4 text-amber-400"}),o.jsx("span",{className:"text-sm text-neutral5",children:".."})]})}),m.map(w=>{const S=w.mount?.displayName||w.mount?.provider,k=w.mount?.status==="error";return o.jsx("li",{className:"group",children:o.jsxs("div",{className:"flex items-center hover:bg-surface4 transition-colors",children:[o.jsxs("button",{onClick:()=>y(w),className:"flex-1 flex items-center gap-3 px-4 py-2 text-left",children:[$1t(w),o.jsx("span",{className:"text-sm text-neutral6 flex-1 truncate",children:w.name}),w.mount&&k&&o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{tabIndex:0,className:"flex items-center",children:o.jsx(tA,{className:"h-4 w-4 text-red-400"})})}),o.jsxs(Wr,{className:"max-w-xs",children:[o.jsx("span",{className:"text-red-400",children:"Error:"})," ",w.mount.error||"Failed to connect to this filesystem"]})]}),w.mount&&S&&(w.mount.description?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{tabIndex:0,className:`text-xs px-1.5 py-0.5 rounded ${k?"text-red-400 bg-red-400/10":"text-neutral3 bg-surface4"}`,children:S})}),o.jsx(Wr,{children:w.mount.description})]}):o.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${k?"text-red-400 bg-red-400/10":"text-neutral3 bg-surface4"}`,children:S})),w.type==="file"&&w.size!==void 0&&o.jsx("span",{className:"text-xs text-neutral3 tabular-nums",children:F1t(w.size)})]}),u&&!w.mount&&o.jsx("button",{onClick:()=>x(w),"aria-label":`Delete ${w.name}`,className:"p-2 opacity-0 group-hover:opacity-100 hover:text-red-400 text-neutral3 transition-all",children:o.jsx(nd,{className:"h-3.5 w-3.5"})})]})},w.name)})]})})}),o.jsx(Bt,{open:!!h,onOpenChange:w=>!f&&!w&&p(null),children:o.jsxs(Bt.Content,{children:[o.jsxs(Bt.Header,{children:[o.jsx(Bt.Title,{children:"Delete Item"}),o.jsxs(Bt.Description,{children:['Are you sure you want to delete "',h,'"? This action cannot be undone.']})]}),o.jsxs(Bt.Footer,{children:[o.jsx(Bt.Cancel,{disabled:f,children:"Cancel"}),o.jsxs(Bt.Action,{disabled:f,onClick:async()=>{try{h&&u&&await u(h)}finally{p(null)}},children:[f?o.jsx(Ta,{className:"h-4 w-4 animate-spin mr-2"}):null,"Delete"]})]})]})})]})}function BAn(e){return e&&{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",json:"json",md:"markdown",mdx:"mdx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",css:"css",scss:"scss",less:"less",html:"html",xml:"xml",yaml:"yaml",yml:"yaml",toml:"toml",sh:"bash",bash:"bash",zsh:"bash",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"dockerfile",makefile:"makefile",vue:"vue",svelte:"svelte"}[e.toLowerCase()]||null}function UAn({content:e,language:t}){return o.jsx(Jye,{language:t,style:eve.coldarkDark,customStyle:{margin:0,padding:"1rem",backgroundColor:"transparent",fontSize:"0.875rem"},codeTagProps:{style:{fontFamily:"var(--geist-mono), ui-monospace, monospace"}},children:e})}function VAn({path:e,content:t,isLoading:r,mimeType:n,onClose:s}){const a=e.split("/").pop()||e,i=a.split(".").pop()?.toLowerCase(),l=n?.startsWith("image/")||["png","jpg","jpeg","gif","svg","webp"].includes(i||""),c=BAn(i);return o.jsxs("div",{className:"rounded-lg border border-border1 overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-surface3 border-b border-border1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[$1t({name:a,type:"file"}),o.jsx("span",{className:"text-sm font-medium text-neutral6",children:a})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Xa,{content:t,copyMessage:"Copied file content"}),s&&o.jsx(pe,{variant:"ghost",size:"md",onClick:s,children:"Close"})]})]}),o.jsx("div",{className:"max-h-[500px] overflow-auto h-full",style:{backgroundColor:"black"},children:r?o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(Ta,{className:"h-6 w-6 animate-spin text-neutral3"})}):l?o.jsx("div",{className:"p-4 flex items-center justify-center",children:o.jsx("img",{src:`data:${n||"image/png"};base64,${btoa(t)}`,alt:a,className:"max-w-full max-h-[400px] object-contain"})}):c?o.jsx(UAn,{content:t,language:c}):o.jsx("pre",{className:"p-4 text-sm text-neutral5 whitespace-pre-wrap font-mono overflow-x-auto",children:t})})]})}const qAn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(xf,{}),titleSlot:"No Workspaces yet",descriptionSlot:o.jsxs(o.Fragment,{children:["Add a workspace to your Mastra configuration to ",o.jsx("br",{}),"manage files, skills, and enable semantic search."]}),actionSlot:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",o.jsx(ya,{})]})})}),HAn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(gMt,{}),titleSlot:"Workspace Not Configured",descriptionSlot:o.jsxs(o.Fragment,{children:["No workspace is configured. Add a workspace to your ",o.jsx("br",{}),"Mastra configuration to manage files, skills, and enable semantic search."]}),actionSlot:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",o.jsx(ya,{})]})})}),QAn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(tA,{}),titleSlot:"Workspace Not Supported",descriptionSlot:o.jsxs(o.Fragment,{children:["The workspace feature requires a newer version of ",o.jsx("code",{className:"text-neutral5",children:"@mastra/core"}),".",o.jsx("br",{}),"Please upgrade your dependencies to enable workspace functionality."]}),actionSlot:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",o.jsx(ya,{})]})})}),nre={bm25:{label:"Keyword",icon:o.jsx(Zi,{className:"h-3.5 w-3.5"}),color:"bg-blue-500/10 text-blue-400 border-blue-500/30"},vector:{label:"Semantic",icon:o.jsx(y_,{className:"h-3.5 w-3.5"}),color:"bg-purple-500/10 text-purple-400 border-purple-500/30"},hybrid:{label:"Hybrid",icon:o.jsx(rLt,{className:"h-3.5 w-3.5"}),color:"bg-amber-500/10 text-amber-400 border-amber-500/30"}};function B1t(e){return e.id.replace(/#chunk-\d+$/,"")}function WAn({onSearch:e,isSearching:t,searchResults:r,canBM25:n,canVector:s,onViewResult:a}){const[i,l]=b.useState(""),[c,u]=b.useState(5),d=()=>n&&s?"hybrid":n?"bm25":s?"vector":"bm25",[f,h]=b.useState(d()),p=g=>{g.preventDefault(),i.trim()&&e({query:i.trim(),topK:c,mode:f})},m=[...n?["bm25"]:[],...s?["vector"]:[],...n&&s?["hybrid"]:[]];return o.jsxs("div",{className:"rounded-lg bg-surface4",children:[o.jsxs("form",{onSubmit:p,className:"p-4",children:[o.jsxs("div",{className:"flex gap-3 items-center",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(NE,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-neutral3"}),o.jsx(sr,{value:i,onChange:g=>l(g.target.value),placeholder:"Search workspace files...",className:"pl-9 h-10 bg-surface2 border-border1"})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-xs text-neutral4",children:"Top"}),o.jsx(sr,{type:"number",min:1,max:50,value:c,onChange:g=>u(parseInt(g.target.value)||5),className:"w-14 h-10 text-center bg-surface2 border-border1",title:"Number of results"})]}),o.jsx(pe,{type:"submit",disabled:t||!i.trim(),size:"lg",className:"h-10 px-4",children:t?o.jsx(Ta,{className:"h-4 w-4 animate-spin"}):"Search"})]}),m.length>0&&o.jsx("div",{className:"flex gap-2 mt-3",children:m.map(g=>{const y=nre[g],x=f===g;return o.jsxs("button",{type:"button",onClick:()=>h(g),className:`
|
|
557
|
+
]`})]})]})}function dTn({errors:e,maxErrors:t=5}){if(e.length===0)return null;const r=e.slice(0,t),n=e.length-t;return o.jsxs("div",{className:"bg-accent2/10 border border-accent2/30 rounded-md p-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-accent2 mb-2",children:[o.jsx(Ce,{children:o.jsx(kh,{className:"w-4 h-4"})}),o.jsxs("span",{className:"font-medium text-sm",children:[e.length," validation error",e.length!==1?"s":""]})]}),o.jsx("ul",{className:"text-sm text-accent2/80 space-y-1",children:r.map((s,a)=>o.jsxs("li",{className:"flex gap-2",children:[o.jsx("span",{className:"shrink-0",children:"•"}),o.jsx("span",{children:s.message})]},a))}),n>0&&o.jsxs("div",{className:"text-xs text-accent2/60 mt-2",children:["+",n," more error",n!==1?"s":""]})]})}function fTn({datasetId:e,open:t,onOpenChange:r,onSuccess:n}){const[s,a]=b.useState("upload"),[i,l]=b.useState(null),[c,u]=b.useState({current:0,total:0}),[d,f]=b.useState(null),[h,p]=b.useState(!1),{parseFile:m,isParsing:g,error:y}=yjn(),{batchInsertItems:x}=ri(),w=b.useCallback(async I=>{try{const P=await m(I);l(P),a("preview")}catch{}},[m]),S=b.useCallback(async()=>{if(!i||i.items.length===0)return;a("importing"),p(!0);const{items:I}=i;u({current:0,total:I.length});try{await x.mutateAsync({datasetId:e,items:I.map(P=>({input:P.input,groundTruth:P.groundTruth,metadata:P.metadata}))}),f({success:I.length,errors:0})}catch{f({success:0,errors:I.length})}u({current:I.length,total:I.length}),p(!1),a("complete")},[i,x,e]),k=b.useCallback(()=>{r(!1),n?.(),d&&d.success>0&&ze.success(`Imported ${d.success} item${d.success!==1?"s":""}`),setTimeout(()=>{a("upload"),l(null),u({current:0,total:0}),f(null)},150)},[r,n,d]),_=b.useCallback(()=>{h||(r(!1),setTimeout(()=>{a("upload"),l(null),u({current:0,total:0}),f(null)},150))},[h,r]),E=i&&i.items.length>0&&i.errors.length===0,T=()=>{switch(s){case"upload":return o.jsx(uTn,{onFileSelect:w,isParsing:g,error:y?.message});case"preview":return i?o.jsx("div",{className:"flex flex-col gap-4",children:i.errors.length>0?o.jsxs(o.Fragment,{children:[o.jsx(dTn,{errors:i.errors}),o.jsx("div",{className:"text-sm text-neutral4",children:"Please fix the errors in your JSON file and try again."})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"text-sm text-neutral4",children:["Found ",i.items.length," valid item",i.items.length!==1?"s":""," to import."]}),o.jsx(cTn,{items:i.items,maxRows:5})]})}):null;case"importing":return o.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[o.jsx(Mt,{size:"lg"}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-lg font-medium text-neutral1",children:"Importing items..."}),o.jsxs("div",{className:"text-sm text-neutral4 mt-1",children:[c.current," of ",c.total]})]})]});case"complete":return o.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[o.jsx("div",{className:"text-4xl",children:d&&d.errors===0?"✓":"⚠"}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-lg font-medium text-neutral1",children:"Import Complete"}),o.jsxs("div",{className:"text-sm text-neutral4 mt-1",children:[d?.success??0," item",d?.success!==1?"s":""," imported",d&&d.errors>0&&o.jsxs("span",{className:"text-accent2",children:[" ","(",d.errors," error",d.errors!==1?"s":"",")"]})]})]})]})}},j=()=>{switch(s){case"upload":return o.jsx(pe,{onClick:_,children:"Cancel"});case"preview":return o.jsxs(o.Fragment,{children:[o.jsx(pe,{onClick:()=>a("upload"),children:"Back"}),o.jsxs(pe,{variant:"primary",onClick:S,disabled:!E,children:["Import ",i?.items.length??0," Item",i?.items.length!==1?"s":""]})]});case"importing":return null;case"complete":return o.jsx(pe,{variant:"primary",onClick:k,children:"Done"})}},N={upload:"Import JSON",preview:"Preview Data",importing:"Importing",complete:"Import Complete"};return o.jsx(kn,{open:t,onOpenChange:_,children:o.jsxs(xn,{className:"max-w-2xl max-h-[90vh]",children:[o.jsxs(_n,{children:[o.jsx(wn,{children:N[s]}),o.jsx(Js,{children:"Import dataset items from a JSON file."})]}),o.jsx(qn,{className:"min-h-[200px] max-h-[50vh] overflow-y-auto",children:T()}),o.jsx(hf,{className:"px-6 pt-4 flex justify-end gap-2",children:j()})]})})}function hTn({dataset:e,isLoading:t=!1,onEditClick:r,onDuplicateClick:n,onDeleteClick:s,experimentTriggerSlot:a,disableExperimentTrigger:i=!1,onExperimentClick:l,className:c}){return o.jsxs(Ir,{className:c,children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{isLoading:t,children:[o.jsx(ja,{})," ",e?.name]}),o.jsx(Ir.Description,{isLoading:t,children:e?.description}),o.jsxs(Ir.Description,{isLoading:t,children:[o.jsxs(fs,{children:[o.jsx(g_,{})," Created at ",e?.createdAt?ur(new Date(e.createdAt),"MMM d, yyyy"):""]}),o.jsxs(fs,{children:[o.jsx(Qx,{})," Latest version v",e?.version??""]})]})]}),o.jsx(Ir.Column,{children:o.jsxs(ps,{children:[a?i?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{className:"cursor-not-allowed",children:o.jsx("div",{className:"pointer-events-none opacity-50",inert:!0,"aria-disabled":"true",children:a})})}),o.jsx(Wr,{children:"Add items to the dataset before running an experiment"})]}):a:l?i?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{className:"cursor-not-allowed",children:o.jsxs(pe,{disabled:!0,tabIndex:-1,children:[o.jsx(gx,{}),"Run Experiment"]})})}),o.jsx(Wr,{children:"Add items to the dataset before running an experiment"})]}):o.jsxs(pe,{onClick:l,children:[o.jsx(gx,{}),"Run Experiment"]}):null,o.jsxs(vt,{children:[o.jsx(vt.Trigger,{asChild:!0,children:o.jsx(pe,{size:"default","aria-label":"Dataset actions menu",children:o.jsx(fVe,{})})}),o.jsxs(vt.Content,{align:"end",className:"w-48",children:[o.jsxs(vt.Item,{onSelect:r,children:[o.jsx(lv,{})," Edit Dataset"]}),o.jsxs(vt.Item,{onSelect:n,children:[o.jsx(ru,{})," Duplicate Dataset"]}),o.jsxs(vt.Item,{onSelect:s,className:"text-red-500 focus:text-red-400",children:[o.jsx(nd,{})," Delete Dataset"]})]})]})]})})]})}const E1t=e=>{const t=Ge(),{data:r}=vR(e),n=r?.experiments;return kt({queryKey:["dataset-review-items",e,n?.map(s=>s.id)],queryFn:async()=>!n||n.length===0?[]:(await Promise.all(n.map(async a=>{if(!a.datasetId)return[];try{const{results:i}=await t.listDatasetExperimentResults(a.datasetId,a.id);return i.filter(l=>l.status==="needs-review").map(l=>({id:l.id,input:l.input,output:l.output,error:l.error,itemId:l.itemId,experimentId:l.experimentId,datasetId:a.datasetId??void 0,traceId:l.traceId??void 0,scores:l.scores?Object.fromEntries(l.scores.map(c=>[c.scorerId,c.score??0])):{},tags:l.tags??[],comment:""}))}catch{return[]}}))).flat(),enabled:!!e&&!!n&&n.length>0,refetchOnWindowFocus:!1})},pTn=e=>{const t=Ge(),{data:r}=vR(e),n=r?.experiments;return kt({queryKey:["dataset-completed-items",e,n?.map(s=>s.id)],queryFn:async()=>!n||n.length===0?[]:(await Promise.all(n.map(async a=>{if(!a.datasetId)return[];try{const{results:i}=await t.listDatasetExperimentResults(a.datasetId,a.id);return i.filter(l=>l.status==="complete").map(l=>({id:l.id,input:l.input,output:l.output,error:l.error,itemId:l.itemId,experimentId:l.experimentId,datasetId:a.datasetId??void 0,traceId:l.traceId??void 0,scores:l.scores?Object.fromEntries(l.scores.map(c=>[c.scorerId,c.score??0])):{},tags:l.tags??[],comment:""}))}catch{return[]}}))).flat(),enabled:!!e&&!!n&&n.length>0,refetchOnWindowFocus:!1})};function mTn(e,t){if(typeof e=="string")return e.length>t?e.slice(0,t)+"...":e;try{const r=JSON.stringify(e);return r.length>t?r.slice(0,t)+"...":r}catch{return String(e)}}const gTn=Z("bg-surface5 backdrop-blur-xl z-50 min-w-32 overflow-auto rounded-lg p-2 shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95");function NBe({className:e,children:t,...r}){return o.jsx(rP,{children:o.jsx(lz,{className:Z(gTn,e),...r,children:t})})}function yTn({datasetId:e}){const t=Ge(),{data:r}=Ig(e),{data:n,isLoading:s}=E1t(e),{data:a,isLoading:i}=pTn(e),{updateExperimentResult:l}=ri(),[c,u]=b.useState(null),[d,f]=b.useState(null),[h,p]=b.useState(new Set),[m,g]=b.useState(!1),[y,x]=b.useState(!1),[w,S]=b.useState(!1),[k,_]=b.useState(""),[E,T]=b.useState(""),[j,N]=b.useState(""),[I,P]=b.useState([]),[R,$]=b.useState(!1),[M,z]=b.useState(null),U=M??n??[];b.useEffect(()=>{n&&M===null&&z(n)},[n]);const B=b.useMemo(()=>{const ge=new Set;if(r?.tags)for(const Ee of r.tags)ge.add(Ee);for(const Ee of U)for(const Fe of Ee.tags)ge.add(Fe);return[...ge].sort()},[r,U]),H=b.useCallback(ge=>{!r||!e||(r.tags??[]).includes(ge)},[r,e]),W=b.useMemo(()=>d?d==="__untagged__"?U.filter(ge=>ge.tags.length===0):U.filter(ge=>ge.tags.includes(d)):U,[U,d]),L=b.useMemo(()=>{const ge=new Map;for(const Ee of U)for(const Fe of Ee.tags)ge.set(Fe,(ge.get(Fe)??0)+1);return[...ge.entries()].sort((Ee,Fe)=>Fe[1]-Ee[1])},[U]),Y=b.useMemo(()=>U.filter(ge=>ge.tags.length===0).length,[U]),q=b.useMemo(()=>{let ge=0;return d&&ge++,m&&ge++,ge},[d,m]),D=b.useCallback((ge,Ee)=>{z(ct=>(ct??[]).map(wt=>wt.id===ge?{...wt,tags:Ee}:wt));const Fe=U.find(ct=>ct.id===ge);Fe?.experimentId&&Fe?.datasetId&&l.mutate({datasetId:Fe.datasetId,experimentId:Fe.experimentId,resultId:Fe.id,tags:Ee})},[U,l]),Q=b.useCallback((ge,Ee)=>{const Fe=U.find(ct=>ct.id===ge);Fe?.traceId&&Ee!==void 0&&t.createFeedback({feedback:{traceId:Fe.traceId,source:"studio",feedbackSource:"studio",feedbackType:"rating",value:Ee==="positive"?1:-1,experimentId:Fe.experimentId??void 0,sourceId:Fe.id}}).catch(()=>{}),z(ct=>(ct??[]).map(wt=>wt.id===ge?{...wt,rating:Ee}:wt))},[U,t]),G=b.useCallback((ge,Ee)=>{const Fe=U.find(ct=>ct.id===ge);Fe?.traceId&&t.createFeedback({feedback:{traceId:Fe.traceId,source:"studio",feedbackSource:"studio",feedbackType:"comment",value:Ee,comment:Ee,experimentId:Fe.experimentId??void 0,sourceId:Fe.id}}).catch(()=>{}),z(ct=>(ct??[]).map(wt=>wt.id===ge?{...wt,comment:Ee}:wt))},[U,t]),J=b.useCallback(ge=>{const Ee=U.find(Fe=>Fe.id===ge);z(Fe=>(Fe??[]).filter(ct=>ct.id!==ge)),p(Fe=>{const ct=new Set(Fe);return ct.delete(ge),ct}),c===ge&&u(null),Ee?.experimentId&&Ee?.datasetId&&l.mutate({datasetId:Ee.datasetId,experimentId:Ee.experimentId,resultId:Ee.id,status:null})},[U,l,c]),ae=b.useCallback(ge=>{const Ee=U.find(Fe=>Fe.id===ge);z(Fe=>(Fe??[]).filter(ct=>ct.id!==ge)),p(Fe=>{const ct=new Set(Fe);return ct.delete(ge),ct}),c===ge&&u(null),Ee?.experimentId&&Ee?.datasetId&&l.mutate({datasetId:Ee.datasetId,experimentId:Ee.experimentId,resultId:Ee.id,status:"complete"})},[U,l,c]),re=b.useMemo(()=>{const ge=m?a??[]:W;return!m||!d?ge:d==="__untagged__"?ge.filter(Ee=>Ee.tags.length===0):ge.filter(Ee=>Ee.tags.includes(d))},[m,a,W,d]),se=m?i:!1,oe=b.useMemo(()=>new Set(re.map(ge=>ge.id)),[re]),he=b.useMemo(()=>[...h].filter(ge=>oe.has(ge)).length,[h,oe]),X=re.length>0&&he===re.length,te=he>0&&!X,le=b.useCallback(ge=>{p(Ee=>{const Fe=new Set(Ee);return Fe.has(ge)?Fe.delete(ge):Fe.add(ge),Fe})},[]),ve=b.useCallback(()=>{p(X?new Set:new Set(re.map(ge=>ge.id)))},[X,re]),ue=b.useCallback(ge=>{for(const Ee of h){const Fe=U.find(ct=>ct.id===Ee);Fe&&!Fe.tags.includes(ge)&&D(Ee,[...Fe.tags,ge])}},[U,h,D]),fe=b.useCallback(ge=>{for(const Ee of h){const Fe=U.find(ct=>ct.id===Ee);Fe&&Fe.tags.includes(ge)&&D(Ee,Fe.tags.filter(ct=>ct!==ge))}},[U,h,D]),xe=b.useCallback(()=>{for(const ge of h)ae(ge);p(new Set)},[h,ae]),Se=b.useCallback(()=>{for(const ge of h)J(ge);p(new Set)},[h,J]),Ne=b.useCallback(()=>{_(""),S(!0)},[]),K=b.useCallback(async()=>{if(!(!E||!j)){x(!0),S(!1);try{const ge=U.filter(Fe=>h.has(Fe.id));if(ge.length===0){x(!1);return}const Ee=await t.clusterFailures({modelId:`${E}/${j}`,items:ge.map(Fe=>({id:Fe.id,input:Fe.input,output:Fe.output??void 0,error:typeof Fe.error=="string"?Fe.error:Fe.error?String(Fe.error):void 0,scores:Fe.scores,existingTags:Fe.tags.length>0?Fe.tags:void 0})),availableTags:B.length>0?B:void 0,prompt:k||void 0});Ee.proposedTags&&Ee.proposedTags.length>0&&(P(Ee.proposedTags.map(Fe=>({...Fe,accepted:!0}))),$(!0))}catch(ge){console.error("Analysis failed:",ge)}finally{x(!1)}}},[E,j,U,h,t,B,k]),ie=b.useCallback(()=>{for(const ge of I){if(!ge.accepted)continue;const Ee=U.find(Fe=>Fe.id===ge.itemId);if(Ee){const Fe=[...new Set([...Ee.tags,...ge.tags])];D(Ee.id,Fe)}}$(!1)},[I,U,D]),be=b.useCallback(ge=>{u(Ee=>Ee===ge?null:ge)},[]),Ae=b.useMemo(()=>c?re.find(ge=>ge.id===c)??null:null,[c,re]),$e=b.useCallback(()=>{if(!c||re.length===0)return;const ge=re.findIndex(Ee=>Ee.id===c);ge<re.length-1&&u(re[ge+1].id)},[c,re]),ye=b.useCallback(()=>{if(!c||re.length===0)return;const ge=re.findIndex(Ee=>Ee.id===c);ge>0&&u(re[ge-1].id)},[c,re]),ke=Ae?"2rem 1fr 10rem 8rem":"2rem 1fr 10rem 8rem 6rem 6rem";return s?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Mt,{className:"w-6 h-6"})}):o.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[o.jsx(kn,{open:w,onOpenChange:S,children:o.jsxs(xn,{children:[o.jsxs(_n,{children:[o.jsx(wn,{children:"Analyze Items"}),o.jsx(Js,{children:"Use an LLM to automatically suggest tags for the selected items."})]}),o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx(xt,{className:"text-xs mb-1 block",children:"Provider"}),o.jsx(Rg,{value:E,onValueChange:T})]}),o.jsxs("div",{children:[o.jsx(xt,{className:"text-xs mb-1 block",children:"Model"}),o.jsx(Pg,{llmId:E,value:j,onValueChange:N})]})]}),o.jsxs(me,{variant:"ui-xs",className:"text-neutral3",children:[h.size," item",h.size!==1?"s":""," will be analyzed"]}),o.jsxs("div",{children:[o.jsx(xt,{className:"text-xs",children:"Instructions (optional)"}),o.jsx(bc,{value:k,onChange:ge=>_(ge.target.value),placeholder:"E.g., Focus on safety issues and factual errors...",rows:3,className:"text-xs mt-1"})]})]}),o.jsxs(hf,{children:[o.jsx(pe,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),o.jsxs(pe,{onClick:K,disabled:!E||!j||y,children:[y?o.jsx(Mt,{className:"w-4 h-4 mr-1"}):null,"Analyze"]})]})]})}),o.jsx(kn,{open:R,onOpenChange:$,children:o.jsxs(xn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(_n,{children:[o.jsx(wn,{children:"Review Proposed Tags"}),o.jsxs(Js,{children:[I.filter(ge=>ge.accepted).length," of ",I.length," proposals selected"]})]}),o.jsx("div",{className:"space-y-3 py-2",children:I.map((ge,Ee)=>{const Fe=U.find(ct=>ct.id===ge.itemId);return o.jsx("div",{className:Z("p-3 border rounded-lg",!ge.accepted&&"opacity-50"),children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(di,{checked:ge.accepted,onCheckedChange:ct=>P(wt=>wt.map((or,Ve)=>Ve===Ee?{...or,accepted:!!ct}:or))}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx(me,{variant:"ui-xs",className:"text-neutral4 truncate block",children:Fe?typeof Fe.input=="string"?Fe.input.slice(0,100):JSON.stringify(Fe.input).slice(0,100):ge.itemId}),o.jsx("div",{className:"flex gap-1 flex-wrap mt-1.5",children:ge.tags.map((ct,wt)=>o.jsx(v1t,{tag:ct,onRename:or=>P(Ve=>Ve.map((qe,Ie)=>Ie===Ee?{...qe,tags:qe.tags.map((Le,Re)=>Re===wt?or:Le)}:qe)),onRemove:()=>P(or=>or.map((Ve,qe)=>qe===Ee?{...Ve,tags:Ve.tags.filter((Ie,Le)=>Le!==wt)}:Ve))},`${ct}-${wt}`))}),ge.reason&&o.jsx(me,{variant:"ui-xs",className:"text-neutral3 mt-1 block italic",children:ge.reason})]})]})},ge.itemId)})}),o.jsxs(hf,{children:[o.jsx(pe,{variant:"outline",onClick:()=>$(!1),children:"Cancel"}),o.jsxs(pe,{onClick:ie,disabled:I.filter(ge=>ge.accepted).length===0,children:["Accept ",I.filter(ge=>ge.accepted).length," proposals"]})]})]})}),o.jsxs(sf,{className:Ae?"grid-cols-[1fr_1fr]":"",children:[o.jsxs(mr,{children:[o.jsxs(mr.Toolbar,{children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(vt,{children:[o.jsx(vt.Trigger,{asChild:!0,children:o.jsxs(pe,{variant:"outline",size:"md",children:[o.jsx(hVe,{}),"Filter",q>0&&o.jsx("span",{className:Z("ml-0.5 inline-flex items-center justify-center rounded-full bg-accent1/50 text-neutral5 text-ui-sm w-5 h-5"),children:q})]})}),o.jsxs(vt.Content,{align:"start",className:Z("min-w-48"),children:[o.jsxs(vt.Sub,{children:[o.jsxs(vt.SubTrigger,{children:["Status",m&&o.jsx("span",{className:Z("ml-auto text-ui-sm text-accent1"),children:"1"})]}),o.jsxs(NBe,{children:[o.jsx(vt.CheckboxItem,{checked:!m,onCheckedChange:()=>{g(!1),u(null)},onSelect:ge=>ge.preventDefault(),children:"Review Queue"}),o.jsx(vt.CheckboxItem,{checked:m,onCheckedChange:()=>{g(!0),u(null)},onSelect:ge=>ge.preventDefault(),children:"Completed"})]})]}),o.jsxs(vt.Sub,{children:[o.jsxs(vt.SubTrigger,{children:["Tags",d&&o.jsx("span",{className:Z("ml-auto text-ui-sm text-accent1"),children:"1"})]}),o.jsxs(NBe,{children:[o.jsx(vt.CheckboxItem,{checked:!d,onCheckedChange:()=>f(null),onSelect:ge=>ge.preventDefault(),children:"All"}),Y>0&&o.jsx(vt.CheckboxItem,{checked:d==="__untagged__",onCheckedChange:()=>f(d==="__untagged__"?null:"__untagged__"),onSelect:ge=>ge.preventDefault(),children:"Untagged"}),L.length>0&&o.jsx(vt.Separator,{}),L.map(([ge])=>o.jsx(vt.CheckboxItem,{checked:d===ge,onCheckedChange:()=>f(d===ge?null:ge),onSelect:Ee=>Ee.preventDefault(),children:ge},ge))]})]}),q>0&&o.jsxs(o.Fragment,{children:[o.jsx(vt.Separator,{}),o.jsxs(vt.Item,{onSelect:()=>{f(null),g(!1),u(null)},children:[o.jsx(Nn,{}),"Clear all filters"]})]})]})]}),q>0&&o.jsxs(pe,{variant:"outline",size:"md",onClick:()=>{f(null),g(!1),u(null)},children:[o.jsx(Nn,{}),"Reset"]})]}),!m&&h.size>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(y1t,{selectedCount:h.size,vocabulary:B,onApplyTag:ue,onRemoveTag:fe,onNewTag:ge=>ue(ge)}),o.jsxs(vt,{children:[o.jsx(vt.Trigger,{asChild:!0,children:o.jsxs(pe,{disabled:y,children:[y?o.jsx(Mt,{className:"w-4 h-4"}):o.jsx(Ce,{size:"sm",children:o.jsx(ss,{})}),"Actions"]})}),o.jsxs(vt.Content,{align:"end",children:[o.jsxs(vt.Item,{onSelect:xe,children:[o.jsx(Ce,{size:"sm",children:o.jsx(hx,{})}),"Complete"]}),o.jsxs(vt.Item,{onSelect:Se,children:[o.jsx(Ce,{size:"sm",children:o.jsx(nd,{})}),"Remove"]}),o.jsx(vt.Separator,{}),o.jsxs(vt.Item,{onSelect:Ne,children:[o.jsx(Ce,{size:"sm",children:o.jsx(y_,{})}),"Analyze"]})]})]})]})]}),se?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Mt,{className:"w-6 h-6"})}):re.length===0?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"text-center px-8",children:[o.jsx(me,{variant:"ui-sm",className:"text-neutral3 block",children:m?"No completed reviews yet":"No items to review"}),o.jsx(me,{variant:"ui-xs",className:"text-neutral3 mt-2 block",children:m?"Items marked as complete will appear here for auditing.":"When experiment results are flagged for review, they will appear here."})]})}):o.jsxs(we,{columns:ke,children:[o.jsxs(we.Top,{children:[!m&&o.jsx(we.TopCell,{children:o.jsx(di,{checked:X?!0:te?"indeterminate":!1,onCheckedChange:()=>ve(),"aria-label":"Select all"})}),m&&o.jsx(we.TopCell,{children:" "}),o.jsx(we.TopCell,{children:"Input"}),o.jsx(we.TopCell,{children:"Comment"}),o.jsx(we.TopCell,{children:"Tags"}),!Ae&&o.jsx(we.TopCell,{children:"Rating"}),!Ae&&o.jsx(we.TopCell,{children:"Scores"})]}),o.jsx(we.Rows,{children:re.map(ge=>{const Ee=ge.scores?Object.entries(ge.scores):[];return o.jsxs(we.Row,{onClick:()=>be(ge.id),selected:c===ge.id,children:[o.jsx(we.Cell,{children:m?ge.error?o.jsx("div",{className:"w-2 h-2 rounded-full bg-red-700",title:"Error"}):o.jsx("div",{className:"w-2 h-2 rounded-full bg-green-600",title:"Success"}):o.jsx(di,{checked:h.has(ge.id),onCheckedChange:()=>le(ge.id),onClick:Fe=>Fe.stopPropagation(),"aria-label":`Select item ${ge.id}`})}),o.jsx(we.NameCell,{children:mTn(ge.input,80)}),o.jsx(we.Cell,{children:ge.comment?o.jsx(me,{variant:"ui-xs",className:"text-neutral3 truncate",children:ge.comment}):o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})}),o.jsx(we.Cell,{children:ge.tags.length>0?o.jsx(me,{variant:"ui-xs",className:"text-neutral4 truncate",children:ge.tags.join(", ")}):o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})}),!Ae&&o.jsxs(we.Cell,{children:[ge.rating==="positive"&&o.jsx(Ce,{size:"sm",className:"text-positive1",children:o.jsx(oce,{})}),ge.rating==="negative"&&o.jsx(Ce,{size:"sm",className:"text-negative1",children:o.jsx(ice,{})}),!ge.rating&&o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})]}),!Ae&&o.jsx(we.Cell,{children:Ee.length>0?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ce,{size:"sm",className:"text-neutral3",children:o.jsx(Ma,{})}),o.jsx(me,{variant:"ui-xs",className:"text-neutral4 font-mono",children:Ee[0][1].toFixed(2)}),Ee.length>1&&o.jsxs(gt,{variant:"default",children:["+",Ee.length-1]})]}):o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})})]},ge.id)})})]})]}),Ae&&o.jsx(g1t,{item:Ae,isCompleted:m,tagVocabulary:B,onRate:ge=>Q(Ae.id,ge),onSetTags:ge=>{D(Ae.id,ge);for(const Ee of ge)B.includes(Ee)||H(Ee)},onComment:ge=>G(Ae.id,ge),onRemove:()=>J(Ae.id),onComplete:m?void 0:()=>ae(Ae.id),onPrevious:ye,onNext:$e,onClose:()=>u(null)})]})]})}function vTn({datasetId:e,onExperimentClick:t,onEditClick:r,onDeleteClick:n,onAddItemClick:s,experimentTriggerSlot:a,onNavigateToDataset:i,activeDatasetVersion:l,onVersionSelect:c,initialTab:u,onTabChange:d}){const{navigate:f}=ir(),[h,p]=b.useState(u??"items"),m=Ut=>{p(Ut),d?.(Ut)},[g,y]=b.useState(!1),[x,w]=b.useState(!1),[S,k]=b.useState(!1),[_,E]=b.useState([]),[T,j]=b.useState(!1),[N,I]=b.useState([]),[P,R]=b.useState(!1),[$,M]=b.useState([]),[z,U]=b.useState(!1),[B,H]=b.useState(0),[W,L]=b.useState(null),[Y,q]=b.useState(""),[D]=Tcr(Y,300),[Q,G]=b.useState(null),ae=l!==void 0?l:Q,{data:re,isLoading:se}=Ig(e),{data:oe=[],total:he,isLoading:X,setEndOfListElement:te,isFetchingNextPage:le,hasNextPage:ve}=kE(e,D||void 0,ae),{data:ue=[],total:fe,isLoading:xe}=kE(e,void 0,ae),[Se,Ne]=b.useState({}),{data:K,isLoading:ie}=vR(e,void 0,Se),{data:be}=vR(e),{deleteItems:Ae}=ri(),$e=K?.experiments??[],ye=be?.experiments??[],ke=Mjn({hasSearchQuery:!!D,filteredItemsLength:oe.length,unfilteredItemsTotal:fe,itemsTotal:he}),{data:ge}=E1t(e),Ee=ge?.length??0,Fe=Ut=>{L(Ut)},ct=()=>{L(null)},wt=Ut=>{const $r=Ut.isCurrent?null:Ut;c?c($r):G(Ut.isCurrent?null:Ut.version)},or=Ut=>{E(Ut),k(!0)},Ve=Ut=>{I(Ut),j(!0)},qe=Ut=>{j(Ut),Ut||(I([]),H($r=>$r+1))},Ie=Ut=>{f(`/datasets/${e}/items?items=${Ut.join(",")}`)},Le=Ut=>{f(`/datasets/${e}/versions?ids=${Ut.join(",")}`)},Re=Ut=>{M(Ut),R(!0)},it=async()=>{await Ae.mutateAsync({datasetId:e,itemIds:$}),ze.success(`Deleted ${$.length} items`),R(!1),M([]),H(Ut=>Ut+1)},rt=Ut=>{k(!1),E([]),H($r=>$r+1),i?.(Ut)},ht=Ut=>{k(Ut),Ut||(E([]),H($r=>$r+1))};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsx("div",{className:Z("h-full w-full",sn.allSlow),children:o.jsxs("div",{className:Z("grid grid-rows-[auto_1fr] mx-auto h-full w-full m-auto",W?"max-w-[120rem]":"max-w-[90rem]"),children:[o.jsx(hTn,{dataset:re,isLoading:se,onEditClick:r,onDuplicateClick:()=>U(!0),onDeleteClick:n,experimentTriggerSlot:a,disableExperimentTrigger:!xe&&ue.length===0,onExperimentClick:t}),o.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:o.jsxs(Tf,{defaultTab:"items",value:h,onValueChange:m,className:"grid grid-rows-[auto_1fr] h-full",children:[o.jsxs(Nf,{children:[o.jsxs(ws,{value:"items",children:["Items ",o.jsx($a,{color:"gray",children:ke})]}),o.jsxs(ws,{value:"experiments",children:["Experiments",o.jsx($a,{color:"gray",children:$e.length})]}),o.jsxs(ws,{value:"review",children:["Review",Ee>0&&o.jsx($a,{color:"orange",children:Ee})]})]}),o.jsx(Rs,{value:"items",className:"grid overflow-auto mt-5",children:o.jsx(lTn,{datasetId:e,items:oe,isLoading:X,featuredItemId:W,onItemSelect:Fe,onItemClose:ct,onAddClick:s??(()=>{}),onImportClick:()=>y(!0),onImportJsonClick:()=>w(!0),onBulkDeleteClick:Re,onCreateDatasetClick:or,onAddToDatasetClick:Ve,onCompareItemsClick:Ie,datasetName:re?.name,clearSelectionTrigger:B,setEndOfListElement:te,isFetchingNextPage:le,hasNextPage:ve,searchQuery:Y,onSearchChange:q,activeDatasetVersion:ae,currentDatasetVersion:re?.version,onVersionSelect:wt,onCompareVersionsClick:Le})}),o.jsx(Rs,{value:"experiments",className:"grid overflow-auto mt-5",children:o.jsx(Xjn,{experiments:$e,allExperiments:ye,isLoading:ie,datasetId:e,filters:Se,onFiltersChange:Ne})}),o.jsx(Rs,{value:"review",className:"overflow-auto mt-0",children:o.jsx(yTn,{datasetId:e})})]})})]})})}),o.jsx(Vjn,{datasetId:e,open:g,onOpenChange:y}),o.jsx(fTn,{datasetId:e,open:x,onOpenChange:w}),o.jsx(Tjn,{open:S,onOpenChange:ht,items:_,onSuccess:rt}),o.jsx(Njn,{open:T,onOpenChange:qe,items:N,currentDatasetId:e}),o.jsx(Ajn,{open:z,onOpenChange:U,sourceDatasetId:e,sourceDatasetName:re?.name||"",sourceDatasetDescription:re?.description,onSuccess:i}),o.jsx(Bt,{open:P,onOpenChange:R,children:o.jsxs(Bt.Content,{children:[o.jsxs(Bt.Header,{children:[o.jsx(Bt.Title,{children:"Delete Items"}),o.jsxs(Bt.Description,{children:["Are you sure you want to delete ",$.length," item",$.length!==1?"s":"","? This action cannot be undone."]})]}),o.jsxs(Bt.Footer,{children:[o.jsx(Bt.Cancel,{children:"Cancel"}),o.jsx(Bt.Action,{onClick:it,children:Ae.isPending?"Deleting...":"Delete"})]})]})})]})}function bTn(e){if(!(e instanceof Error))return null;const t=e.message.match(/- ({.*})$/);if(!t)return null;try{const r=JSON.parse(t[1]);if(r.field&&Array.isArray(r.errors))return{field:r.field,errors:r.errors}}catch{}return null}function ABe({field:e,errors:t}){return t.length?o.jsx("div",{className:"mt-2 space-y-1",children:t.map((r,n)=>o.jsxs("p",{className:"text-xs text-destructive",children:[o.jsxs("code",{className:"bg-destructive/10 px-1 rounded",children:[e,r.path!=="/"?r.path:""]}),": ",r.message]},n))}):null}function xTn({datasetId:e,open:t,onOpenChange:r,onSuccess:n}){const[s,a]=b.useState("{}"),[i,l]=b.useState(""),[c,u]=b.useState(""),[d,f]=b.useState(null),{addItem:h}=ri(),p=async x=>{x.preventDefault();let w;try{w=JSON.parse(s)}catch{ze.error("Input must be valid JSON");return}let S;if(i.trim())try{S=JSON.parse(i)}catch{ze.error("Ground Truth must be valid JSON");return}let k;if(c.trim())try{k=JSON.parse(c)}catch{ze.error("Expected Trajectory must be valid JSON");return}try{await h.mutateAsync({datasetId:e,input:w,groundTruth:S,expectedTrajectory:k}),ze.success("Item added successfully"),f(null),a("{}"),l(""),u(""),r(!1),n?.()}catch(_){const E=bTn(_);E?f(E):ze.error(`Failed to add item: ${_ instanceof Error?_.message:"Unknown error"}`)}},m=x=>{a(x),d?.field==="input"&&f(null)},g=x=>{l(x),d?.field==="groundTruth"&&f(null)},y=()=>{a("{}"),l(""),u(""),f(null),r(!1)};return o.jsx(kn,{open:t,onOpenChange:r,children:o.jsxs(xn,{className:"max-w-lg",children:[o.jsx(_n,{children:o.jsx(wn,{children:"Add Item"})}),o.jsx(qn,{children:o.jsxs("form",{onSubmit:p,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(xt,{htmlFor:"item-input",children:"Input (JSON) *"}),o.jsx(hs,{value:s,onChange:m,showCopyButton:!1,className:"min-h-[120px]"}),d?.field==="input"&&o.jsx(ABe,{field:"input",errors:d.errors})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(xt,{htmlFor:"item-ground-truth",children:"Ground Truth (JSON, optional)"}),o.jsx(hs,{value:i,onChange:g,showCopyButton:!1,className:"min-h-[80px]"}),d?.field==="groundTruth"&&o.jsx(ABe,{field:"groundTruth",errors:d.errors})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(xt,{htmlFor:"item-trajectory",children:"Expected Trajectory (JSON, optional)"}),o.jsx(hs,{value:c,onChange:u,showCopyButton:!1,className:"min-h-[80px]"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[o.jsx(pe,{type:"button",onClick:y,children:"Cancel"}),o.jsx(pe,{type:"submit",variant:"primary",disabled:h.isPending,children:h.isPending?"Adding...":"Add Item"})]})]})})]})})}function wTn({selectedScorers:e,setSelectedScorers:t,disabled:r=!1,container:n}){const{data:s,isLoading:a}=fd(),i=b.useMemo(()=>s?Object.entries(s).map(([l,c])=>({value:l,label:c.scorer?.config?.name||l,description:c.scorer?.config?.description||""})):[],[s]);return o.jsxs("div",{className:"grid gap-2",children:[o.jsx(xt,{children:"Scorers (Optional)"}),o.jsx(Sdt,{options:i,value:e,onValueChange:t,placeholder:"Select scorers...",searchPlaceholder:"Search scorers...",emptyText:"No scorers available",disabled:r||a,container:n})]})}const STn=[{value:"agent",label:"Agent"},{value:"workflow",label:"Workflow"},{value:"scorer",label:"Scorer"}];function OTn({targetType:e,setTargetType:t,targetId:r,setTargetId:n,container:s}){const{data:a,isLoading:i}=Tg(),{data:l,isLoading:c}=d0(),{data:u,isLoading:d}=fd(),f=e==="agent"?Object.entries(a??{}).map(([g,y])=>({value:g,label:y.name??g})):e==="workflow"?Object.entries(l??{}).map(([g,y])=>({value:g,label:y.name??g})):e==="scorer"?Object.entries(u??{}).map(([g,y])=>({value:g,label:y.scorer?.config?.name??g})):[],h=e==="agent"&&i||e==="workflow"&&c||e==="scorer"&&d,p=g=>{t(g),n("")},m=e==="agent"?"Agent":e==="workflow"?"Workflow":"Scorer";return o.jsxs("div",{className:"grid gap-6",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(xt,{children:"Target Type"}),o.jsx(Kl,{options:STn,value:e,onValueChange:p,placeholder:"Select target type",searchPlaceholder:"Search types...",emptyText:"No types available",container:s})]}),e&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx(xt,{children:m}),o.jsx(Kl,{options:f,value:r,onValueChange:n,placeholder:`Select ${e}`,searchPlaceholder:"Search...",emptyText:"No targets available",disabled:h,container:s})]})]})}function kTn({datasetId:e,version:t,open:r,onOpenChange:n,onSuccess:s}){const a=b.useRef(null),[i,l]=b.useState(""),[c,u]=b.useState(""),[d,f]=b.useState([]),{triggerExperiment:h}=ri(),p=i&&c,m=h.isPending,g=async()=>{if(p)try{const x=await h.mutateAsync({datasetId:e,targetType:i,targetId:c,scorerIds:d.length>0?d:void 0,version:t});vc.success("Experiment triggered successfully"),n(!1),s?.(x.experimentId),l(""),u(""),f([])}catch(x){const w=x instanceof Error?x.message:"Failed to trigger experiment";vc.error(w)}},y=()=>{m||(n(!1),l(""),u(""),f([]))};return o.jsx(kn,{open:r,onOpenChange:y,children:o.jsxs(xn,{ref:a,children:[o.jsxs(_n,{children:[o.jsx(wn,{children:"Run Experiment"}),o.jsx(Js,{children:t?`Execute items from ${ur(new Date(t),"MMM d, yyyy")} version against a target.`:"Execute all items in this dataset against a target."})]}),o.jsxs(qn,{className:"grid gap-6",children:[o.jsx(OTn,{targetType:i,setTargetType:l,targetId:c,setTargetId:u,container:a}),i&&i!=="scorer"&&o.jsx(wTn,{selectedScorers:d,setSelectedScorers:f,disabled:m,container:a})]}),o.jsxs(hf,{className:"px-6 pt-4",children:[o.jsx(pe,{onClick:y,disabled:m,children:"Cancel"}),o.jsx(pe,{variant:"primary",onClick:g,disabled:!p||m,children:m?o.jsxs(o.Fragment,{children:[o.jsx(Mt,{className:"w-4 h-4"}),"Running..."]}):"Run"})]})]})})}const C1t=e=>{const t=Ge();return kt({queryKey:["experiment-trace-light",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return t.getTraceLight(e)},enabled:!!e})},IBe=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"score",label:"Score",size:"1fr"}];function _Tn({result:e,scores:t,onPrevious:r,onNext:n,onClose:s,onShowTrace:a,onScoreClick:i,featuredScoreId:l}){const c=!!e?.error,u=ere(e?.input),d=ere(e?.output);return o.jsxs(o.Fragment,{children:[o.jsxs(mr.Toolbar,{children:[o.jsx(wC,{onPrevious:r,onNext:n,previousAriaLabel:"View previous result details",nextAriaLabel:"View next result details"}),o.jsxs(ps,{children:[o.jsxs(pe,{onClick:a,disabled:!e.traceId,children:[o.jsx(ace,{}),"Show Trace"]}),o.jsx(pe,{onClick:s,"aria-label":"Close result details panel",children:o.jsx(Nn,{})})]})]}),o.jsxs(mr.Content,{children:[o.jsx(Ir,{withMargins:!1,children:o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{size:"smaller",children:[o.jsx(gx,{})," ",e.id]}),o.jsx(Ir.Description,{children:o.jsxs(fs,{children:[o.jsx(px,{})," ",e.itemId]})})]})}),c&&o.jsxs(gl,{variant:"destructive",children:[o.jsx(X2t,{}),o.jsxs(gl.Message,{children:[o.jsx("strong",{children:"Error: "}),ere(e?.error&&typeof e.error=="object"?e.error.message:e?.error)]})]}),t&&t.length>0&&o.jsxs(Pt,{className:"grid-rows-[auto_auto] overflow-visible",children:[o.jsxs(Pt.Header,{columns:IBe,children:[o.jsx(Pt.HeaderCol,{children:"Scorer"}),o.jsx(Pt.HeaderCol,{children:"Score"})]}),o.jsx(Pt.Items,{children:t.map(f=>o.jsx(Pt.Row,{children:o.jsxs(Pt.RowButton,{item:{id:f.id},columns:IBe,isFeatured:l===f.id,onClick:i,children:[o.jsx(Pt.TextCell,{children:f.scorerId}),o.jsx(Pt.TextCell,{className:"font-mono",children:f.score.toFixed(3)})]})},f.id))})]}),(e.status||Array.isArray(e.tags)&&e.tags.length>0)&&o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("h4",{className:"text-sm font-medium text-neutral5 flex items-center gap-2",children:[o.jsx(AE,{className:"w-4 h-4"})," Review Status"]}),o.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[e.status&&o.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${e.status==="needs-review"?"bg-warning/10 text-warning":e.status==="complete"?"bg-accent1/10 text-accent1":"bg-neutral3/10 text-neutral4"}`,children:e.status}),Array.isArray(e.tags)&&e.tags.length>0&&e.tags.map(f=>o.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-surface4 text-neutral4",children:f},f))]})]}),o.jsx(Xt.CodeSection,{title:"Input",icon:o.jsx(px,{}),codeStr:u}),o.jsx(Xt.CodeSection,{title:"Output",icon:o.jsx(Zd,{}),codeStr:d}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("h4",{className:"text-sm font-medium text-neutral5 flex items-center gap-2",children:[o.jsx(g_,{className:"w-4 h-4"})," Created"]}),o.jsx("p",{className:"text-sm text-neutral4",children:ur(new Date(e.createdAt),"MMM d, yyyy 'at' h:mm a")})]})]})]})}function ere(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function ETn({span:e}){return e?o.jsxs(o.Fragment,{children:[o.jsx(Xt.CodeSection,{title:"Input",icon:o.jsx(mx,{}),codeStr:JSON.stringify(e.input||null,null,2)}),o.jsx(Xt.CodeSection,{title:"Output",icon:o.jsx(Zd,{}),codeStr:JSON.stringify(e.output||null,null,2)}),o.jsx(Xt.CodeSection,{title:"Metadata",icon:o.jsx(Oh,{}),codeStr:JSON.stringify(e.metadata||null,null,2)}),o.jsx(Xt.CodeSection,{title:"Attributes",icon:o.jsx(Oh,{}),codeStr:JSON.stringify(e.attributes||null,null,2)})]}):null}function CTn({traceId:e,spanId:t,onNext:r,onPrevious:n,onClose:s}){const{data:a}=FS(e,t),i=a?.span;return o.jsxs(o.Fragment,{children:[o.jsxs(mr.Toolbar,{children:[o.jsx(wC,{onPrevious:n,onNext:r,previousAriaLabel:"View previous span details",nextAriaLabel:"View next span details"}),o.jsx(pe,{onClick:s,"aria-label":"Close span details",children:o.jsx(Nn,{})})]}),o.jsxs(mr.Content,{children:[o.jsx(Ir,{withMargins:!1,children:o.jsx(Ir.Column,{children:o.jsxs(Ir.Title,{size:"smaller",children:[o.jsx(Oh,{})," Span ",nf(t)]})})}),o.jsx(ETn,{span:i})]})]})}const jTn=e=>{if(!e||e.length===0)return[];const t=e.reduce((l,c)=>{const u=c?.endedAt?new Date(c.endedAt):void 0;return u&&(!l||u>l)?u:l},null),r=new Map,n=[];e.forEach(l=>{const c=new Date(l.startedAt),u=l.endedAt?new Date(l.endedAt):void 0,d={id:l.spanId,name:l.name,type:l.spanType,latency:u?u.getTime()-c.getTime():0,startTime:c.toISOString(),endTime:u?u.toISOString():void 0,spans:[],parentSpanId:l.parentSpanId};r.set(l.spanId,d)}),e.forEach(l=>{const c=r.get(l.spanId);if(l?.parentSpanId==null){if(t&&c.endTime&&t>new Date(c.endTime)){c.endTime=t.toISOString();const u=new Date(t).getTime(),d=new Date(c.startTime).getTime();c.latency=u-d}n.push(c)}else{const u=r.get(l.parentSpanId);u?u.spans.push(c):n.push(c)}});const s=l=>l.sort((c,u)=>new Date(c.startTime).getTime()-new Date(u.startTime).getTime()),a=s(n),i=l=>{l.forEach(c=>{c.spans&&c.spans.length>0&&(c.spans=s(c.spans),i(c.spans))})};return i(a),a};function j1t(e){if(!e.spans||e.spans.length===0)return[];const t=[];return e.spans.forEach(r=>{t.push(r.id),t.push(...j1t(r))}),t}const RBe=["agent","workflow","model","mcp","tool","workspace","other"];function T1t(e){const t=e?.toLowerCase().split("_")[0],r={agent:{icon:o.jsx(pa,{}),color:"oklch(0.75 0.15 250)",label:"Agent",bgColor:"bg-oklch(0.75 0.15 250 / 0.1)",typePrefix:"agent"},workflow:{icon:o.jsx(Mi,{}),color:"oklch(0.75 0.15 200)",label:"Workflow",bgColor:"bg-oklch(0.75 0.15 200 / 0.1)",typePrefix:"workflow"},model:{icon:o.jsx(Nm,{}),color:"oklch(0.75 0.15 320)",label:"Model",bgColor:"bg-oklch(0.75 0.15 320 / 0.1)",typePrefix:"model"},mcp:{icon:o.jsx(vl,{}),color:"oklch(0.75 0.15 160)",label:"MCP",bgColor:"bg-oklch(0.75 0.15 160 / 0.1)",typePrefix:"mcp"},tool:{icon:o.jsx(Pi,{}),color:"oklch(0.75 0.15 100)",label:"Tool",bgColor:"bg-oklch(0.75 0.15 100 / 0.1)",typePrefix:"tool"},workspace:{icon:o.jsx(D9,{}),color:"oklch(0.75 0.15 40)",label:"Workspace",bgColor:"bg-oklch(0.75 0.15 40 / 0.1)",typePrefix:"workspace"}};return t in r?r[t]:{typePrefix:"other"}}function TTn({isSelected:e,isFaded:t,isExpanded:r,toggleChildren:n,expandAllDescendants:s,totalDescendants:a=0,allDescendantsExpanded:i,numOfChildren:l}){return o.jsx("div",{className:Z("flex items-center justify-end h-full px-3",{"opacity-30 [&:hover]:opacity-60":t,"bg-surface4":e}),children:l&&l>0?o.jsxs("div",{className:"flex gap-1",children:[o.jsxs(PBe,{onClick:()=>n?.(),children:[i?a:l," ",r?i?o.jsx(rVe,{}):o.jsx(Hx,{}):o.jsx(ss,{})]}),a>(l??0)&&!i&&o.jsxs(PBe,{onClick:()=>s?.(),children:[a," ",o.jsx(tVe,{})]})]}):null})}function PBe({onClick:e,children:t,className:r}){return o.jsx("button",{onClick:e,className:Z("h-full",r),children:o.jsx("div",{className:Z("flex items-center gap-[0.1rem] text-ui-sm text-neutral5 border border-border1 pl-2 pr-1 rounded-lg transition-all","hover:text-yellow-500","[&>svg]:shrink-0 [&>svg]:opacity-80 [&>svg]:w-4 [&>svg]:h-4 [&>svg]:transition-all"),children:t})})}function NTn({isLastChild:e,hasChildren:t=!1,expanded:r=!1}){return o.jsx("div",{className:Z("w-12 h-[2.8rem] relative opacity-100",'after:content-[""] after:absolute after:left-[-1px] after:top-0 after:bottom-0 after:w-0 after:border-l after:border-neutral3 after:border-dashed ','before:content-[""] before:absolute before:left-0 before:top-[50%] before:w-full before:h-0 before:border-b before:border-neutral3 before:border-dashed',"[&_svg]:transition-all","[&:hover_svg]:text-yellow-500 [&:hover_svg]:scale-[1.3] [&:hover_svg]:opacity-100",{"after:bottom-[50%]":e}),children:t&&o.jsx("span",{className:Z("flex absolute left-[50%] top-[50%] translate-y-[-50%] translate-x-[-50%] items-center justify-center bg-surface2 p-1","[&>svg]:shrink-0 [&>svg]:opacity-60 [&>svg]:w-[0.8rem] [&>svg]:h-[0.8rem]"),children:r?o.jsx(aVe,{}):o.jsx(sVe,{})})})}function ATn({span:e,spanUI:t,isFaded:r,depth:n=0,onSpanClick:s,selectedSpanId:a,isLastChild:i,hasChildren:l,isRootSpan:c,isExpanded:u,toggleChildren:d}){return o.jsxs("div",{className:"flex overflow-x-auto",style:{paddingLeft:`${n*1.5}rem`},children:[!c&&o.jsx("button",{onClick:()=>d?.(),disabled:!l,className:Z({"cursor-default":!l,"cursor-pointer":l}),children:o.jsx(NTn,{isLastChild:i,hasChildren:!!l,expanded:u})}),o.jsx("button",{className:"truncate",onClick:()=>s?.(e.id),children:e.name})]})}function N1t({span:e,depth:t=0,onSpanClick:r,selectedSpanId:n,isLastChild:s,overallLatency:a,overallStartTime:i,overallEndTime:l,fadedTypes:c,searchPhrase:u,featuredSpanIds:d,expandedSpanIds:f,setExpandedSpanIds:h}){const p=e.spans&&e.spans.length>0,m=e.spans?e.spans.length:0,g=j1t(e),y=g.length,x=t===0,w=T1t(e?.type),S=f?f.includes(e.id):!1,k=d&&d.length>0?!d.includes(e.id):!1,E=(c&&c.length>0?c.includes(w?.typePrefix||""):!1)||k;b.useEffect(()=>{x&&h?.([e.id])},[x,e.id,h]),b.useEffect(()=>{if(!d||!e.spans||e.spans.length===0)return;const I=e.spans.some(P=>d.includes(P.id));!S&&I&&T()},[d,e.spans,e.id,S,h,f]);const T=()=>{if(!(!h||!f))if(S){const I=[e.id,...g];h(f.filter(P=>!I.includes(P)))}else h([...f,e.id])},j=()=>{!h||!f||h([...f,e.id,...g])},N=g.every(I=>f?.includes(I));return o.jsxs(o.Fragment,{children:[o.jsx(ATn,{span:e,spanUI:w,isFaded:E,depth:t,onSpanClick:r,selectedSpanId:n,isLastChild:s,hasChildren:p,isRootSpan:x,isExpanded:S,toggleChildren:T}),o.jsx(TTn,{isSelected:n===e.id,isFaded:E,isExpanded:S,toggleChildren:T,expandAllDescendants:j,totalDescendants:y,allDescendantsExpanded:N,numOfChildren:m}),p&&S&&e.spans?.map((I,P,R)=>{const $=P===R.length-1;return o.jsx(N1t,{span:I,depth:t+1,onSpanClick:r,selectedSpanId:n,isLastChild:$,overallLatency:a,overallStartTime:i,fadedTypes:c,searchPhrase:u,expandedSpanIds:f,setExpandedSpanIds:h,featuredSpanIds:d},I.id)})]})}function ITn({hierarchicalSpans:e=[],onSpanClick:t,selectedSpanId:r,isLoading:n,fadedTypes:s,expandedSpanIds:a,setExpandedSpanIds:i,featuredSpanIds:l}){const c=e?.[0]?.latency||0,u=e?.[0]?.startTime||"",d=e?.[0]?.endTime||"";return o.jsx(o.Fragment,{children:n?o.jsxs("div",{className:Z("flex items-center text-ui-md gap-4 bg-surface3/50 rounded-md p-6 justify-center text-neutral3","[&_svg]:w-[1.25em] [&_svg]:h-[1.25em] [&_svg]:opacity-50"),children:[o.jsx(Mt,{})," Loading Trace Timeline ..."]}):o.jsx("div",{className:"grid grid-cols-[1fr_auto]",children:e?.map(f=>o.jsx(N1t,{span:f,onSpanClick:t,selectedSpanId:r,overallLatency:c,overallStartTime:u,overallEndTime:d,fadedTypes:s,featuredSpanIds:l,expandedSpanIds:a,setExpandedSpanIds:i},f.id))})})}function RTn({spans:e=[],fadedTypes:t,onLegendClick:r,onLegendReset:n,onSearchPhraseChange:s,traceId:a}){const[i,l]=b.useState("");b.useEffect(()=>{l("")},[a]);const c=RBe.filter(h=>e.some(p=>p?.spanType?.startsWith(h)))||[],u=e.some(h=>!RBe.some(m=>h?.spanType?.startsWith(m))),d=h=>{r?.(h)};b.useEffect(()=>{f(i)},[i,s]);const f=Wtt(h=>{s?.(h)},1e3);return o.jsxs("div",{className:"flex gap-3 items-center justify-between",children:[o.jsx("div",{className:"flex",children:o.jsx(Tx,{name:"search-spans",label:"Find span by name",labelIsHidden:!0,placeholder:"Look for span name",value:i,onChange:h=>{l(h.target.value)},onReset:()=>l("")})}),o.jsxs(eft,{children:[c.map(h=>{const p=T1t(h),m=t?.includes(h);return o.jsx(b.Fragment,{children:o.jsxs(pe,{onClick:()=>d(h),className:m?"opacity-40":"",style:{color:m?void 0:p?.color,backgroundColor:p?.bgColor},children:[p?.icon&&o.jsx(Ce,{children:p.icon}),p?.label]})},h)}),u&&o.jsxs(pe,{onClick:()=>d("other"),className:t?.includes("other")?"opacity-40":"",children:[o.jsx(Ce,{children:o.jsx(rF,{})}),"Other"]}),o.jsx(pe,{onClick:n,disabled:t?.length===0,children:o.jsx(Ce,{children:o.jsx(Nn,{})})})]})]})}function PTn({traceId:e,selectedSpanId:t,onSpanSelect:r,onClose:n}){const{data:s,isLoading:a}=C1t(e),i=s?.spans??[],[l,c]=b.useState(""),[u,d]=b.useState([]),[f,h]=b.useState([]),[p,m]=b.useState([]),g=b.useMemo(()=>jTn(i),[i]);b.useEffect(()=>{if(l.trim()===""){h([]);return}const S=l.toLowerCase(),k=i.filter(_=>_.name.toLowerCase().includes(S)).map(_=>_.spanId);h(k)},[l,i]),b.useEffect(()=>{c(""),d([]),h([]),m([])},[e]);const y=S=>{r?.(t===S?void 0:S)},x=S=>{d(k=>k.includes(S)?k.filter(_=>_!==S):[...k,S])},w=()=>{d([])};return o.jsxs(o.Fragment,{children:[o.jsx(mr.Toolbar,{children:o.jsx(pe,{onClick:n,"aria-label":"Close trace panel",children:o.jsx(Nn,{})})}),o.jsxs(mr.Content,{children:[o.jsx(Ir,{withMargins:!1,children:o.jsx(Ir.Column,{children:o.jsxs(Ir.Title,{size:"smaller",children:[o.jsx(xo,{})," Trace ",nf(e)]})})}),o.jsx(RTn,{spans:i,fadedTypes:u,onLegendClick:x,onLegendReset:w,searchPhrase:l,onSearchPhraseChange:c,traceId:e}),o.jsx(ITn,{hierarchicalSpans:g,onSpanClick:y,selectedSpanId:t,isLoading:a,fadedTypes:u,expandedSpanIds:p,setExpandedSpanIds:m,featuredSpanIds:f})]})]})}function MTn({results:e,isLoading:t,featuredResultId:r,onResultClick:n,columns:s,scoresByItemId:a,scorerIds:i,setEndOfListElement:l,isFetchingNextPage:c,hasNextPage:u}){const d=s.map(f=>f.size).join(" ");return t?o.jsxs(we,{columns:d,children:[o.jsx(we.Top,{children:s.map(f=>o.jsx(we.TopCell,{children:f.label},f.name))}),o.jsx("div",{className:"flex items-center justify-center py-20 col-span-full",children:o.jsx(Mt,{})})]}):e.length===0?o.jsxs(we,{columns:d,children:[o.jsx(we.Top,{children:s.map(f=>o.jsx(we.TopCell,{children:f.label},f.name))}),o.jsx(we.NoMatch,{message:"No results yet"})]}):o.jsxs(we,{columns:d,children:[o.jsx(we.Top,{children:s.map(f=>o.jsx(we.TopCell,{children:f.label},f.name))}),o.jsxs(we.Rows,{children:[e.map(f=>{const h=!!f.error,p=f.id===r;return o.jsxs(we.Row,{onClick:()=>n(f.id),selected:p,children:[o.jsx(we.TextCell,{children:o.jsx("span",{className:"truncate block font-mono",children:f.itemId})}),o.jsx(we.Cell,{children:o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("div",{className:"flex items-center justify-center w-10 relative bg-transparent h-full",children:o.jsx("div",{className:Z("w-2 h-2 rounded-full",h?"bg-red-700":"bg-green-600")})})}),o.jsx(Wr,{children:h?"Error":"Success"})]})}),s.some(m=>m.name==="input")&&o.jsx(we.TextCell,{children:o.jsx("span",{className:"truncate block font-mono",children:LTn(DTn(f.input),200)})}),i?.map(m=>{const y=a?.[f.itemId]?.find(x=>x.scorerId===m);return o.jsx(we.TextCell,{children:o.jsx("span",{className:"font-mono",children:y!=null?y.score.toFixed(3):"-"})},m)})]},f.id)}),o.jsxs("div",{ref:l,className:"h-1 col-span-full",children:[c&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(Mt,{})}),!u&&e.length>0&&o.jsx(me,{variant:"ui-xs",className:"text-icon3 text-center py-4 block",children:"All results loaded"})]})]})]})}function DTn(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function LTn(e,t){return e.length<=t?e:e.slice(0,t-1)+"..."}function $Tn(e){const t=e.scorer;return t?.hasJudge===!1?!0:t?.hasJudge===!0?!1:!e.preprocessPrompt&&!e.analyzePrompt&&!e.generateScorePrompt&&!e.generateReasonPrompt}function FTn({score:e,onNext:t,onPrevious:r,onClose:n}){const s=$Tn(e),a=s?"N/A — code-based scorer":"N/A — step not configured";return o.jsxs(o.Fragment,{children:[o.jsxs(mr.Toolbar,{children:[o.jsx(wC,{onPrevious:r,onNext:t,previousAriaLabel:"View previous score details",nextAriaLabel:"View next score details"}),o.jsx(pe,{onClick:n,"aria-label":"Close score details",children:o.jsx(Nn,{})})]}),o.jsxs(mr.Content,{children:[o.jsx(Ir,{withMargins:!1,children:o.jsx(Ir.Column,{children:o.jsxs(Ir.Title,{size:"smaller",children:[o.jsx(Ma,{})," ",e.scorerId]})})}),o.jsxs($S,{children:[o.jsx(Xt.CodeSection,{title:`Score: ${e.score}`,icon:o.jsx(Ma,{}),codeStr:e.reason||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Input",icon:o.jsx(px,{}),codeStr:JSON.stringify(e.input??null,null,2)}),o.jsx(Xt.CodeSection,{title:"Output",icon:o.jsx(Zd,{}),codeStr:JSON.stringify(e.output??null,null,2)}),!s&&o.jsxs(o.Fragment,{children:[o.jsx(Xt.CodeSection,{title:"Preprocess Prompt",icon:o.jsx(lc,{}),codeStr:e.preprocessPrompt||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Analyze Prompt",icon:o.jsx(lc,{}),codeStr:e.analyzePrompt||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Generate Score Prompt",icon:o.jsx(lc,{}),codeStr:e.generateScorePrompt||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Generate Reason Prompt",icon:o.jsx(lc,{}),codeStr:e.generateReasonPrompt||a,simplified:!0})]})]})]})]})}const MBe=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"avg",label:"Avg Score",size:"1fr"},{name:"count",label:"Items Scored",size:"1fr"}];function zTn({scoresByItemId:e,experimentStatus:t}){const r=b.useMemo(()=>{if(!e)return[];const n={};for(const s of Object.values(e))for(const a of s)n[a.scorerId]||(n[a.scorerId]={sum:0,count:0}),n[a.scorerId].sum+=a.score,n[a.scorerId].count++;return Object.entries(n).map(([s,{sum:a,count:i}])=>({scorerId:s,avg:a/i,count:i})).sort((s,a)=>s.scorerId.localeCompare(a.scorerId))},[e]);if(r.length===0){const n=t==="running"||t==="pending",s=e!==void 0;let a,i;return n?(a="Experiment in progress",i="Summary metrics will appear here once the experiment completes."):s?(a="No scorers configured",i="Add scorers when triggering an experiment to evaluate results and see summary metrics here."):(a="Loading scores",i="Fetching scorer results…"),o.jsx("div",{className:"flex h-full items-center justify-center py-12",children:o.jsx(Ka,{iconSlot:o.jsx(Ma,{className:"w-8 h-8 text-neutral3"}),titleSlot:a,descriptionSlot:i})})}return o.jsxs(Pt,{children:[o.jsxs(Pt.Header,{columns:MBe,children:[o.jsx(Pt.HeaderCol,{children:"Scorer"}),o.jsx(Pt.HeaderCol,{children:"Avg Score"}),o.jsx(Pt.HeaderCol,{children:"Items Scored"})]}),o.jsx(Pt.Scroller,{children:o.jsx(Pt.Items,{children:r.map(({scorerId:n,avg:s,count:a})=>o.jsxs(Pt.Row,{columns:MBe,children:[o.jsx(Pt.TextCell,{children:n}),o.jsx(Pt.TextCell,{className:"font-mono",children:s.toFixed(3)}),o.jsx(Pt.TextCell,{className:"font-mono",children:a})]},n))})})]})}function A1t({experimentId:e,experimentStatus:t,results:r,isLoading:n,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i}){const[l,c]=b.useState(null),[u,d]=b.useState(null),[f,h]=b.useState(void 0),[p,m]=b.useState(null),g=r.find(B=>B.id===l)??null,{data:y}=o1t(e,t),x=b.useMemo(()=>{if(!y)return[];const B=new Set;for(const H of Object.values(y))for(const W of H)B.add(W.scorerId);return[...B].sort()},[y]),{data:w}=C1t(u),S=w?.spans??[],k=()=>{if(!f)return;const B=S.findIndex(H=>H.spanId===f);if(B>=0&&B<S.length-1)return()=>h(S[B+1].spanId)},_=()=>{if(!f)return;const B=S.findIndex(H=>H.spanId===f);if(B>0)return()=>h(S[B-1].spanId)},E=B=>{c(B),d(null),h(void 0),m(null)},T=B=>{E(B===l?null:B)},j=()=>{E(null)},N=()=>{if(!g)return;const B=r.findIndex(H=>H.id===g.id);if(B>=0&&B<r.length-1)return()=>E(r[B+1].id)},I=()=>{if(!g)return;const B=r.findIndex(H=>H.id===g.id);if(B>0)return()=>E(r[B-1].id)},P=g?y?.[g.itemId]:void 0,R=P?.find(B=>B.id===p)??null,$=B=>{m(B===p?null:B),d(null),h(void 0)},M=()=>{if(!p||!P)return;const B=P.findIndex(H=>H.id===p);if(B>=0&&B<P.length-1)return()=>m(P[B+1].id)},z=()=>{if(!p||!P)return;const B=P.findIndex(H=>H.id===p);if(B>0)return()=>m(P[B-1].id)},U=b.useMemo(()=>[{name:"itemId",label:"Item ID",size:"5rem"},{name:"status",label:"Status",size:"3rem"},{name:"input",label:"Input",size:"1fr"},...l?[]:x.map(B=>({name:B,label:B,size:"1fr"}))],[l,x]);return o.jsxs(Tf,{defaultTab:"summary",className:"grid grid-rows-[auto_1fr] h-full overflow-hidden",children:[o.jsxs(Nf,{children:[o.jsx(ws,{value:"summary",children:"Summary"}),o.jsx(ws,{value:"results",children:"Results"})]}),o.jsx(Rs,{value:"summary",className:"overflow-y-auto mt-5",children:o.jsx(zTn,{scoresByItemId:y,experimentStatus:t})}),o.jsx(Rs,{value:"results",className:"grid overflow-hidden mt-5",children:o.jsxs(sf,{className:g?"grid-cols-[1fr_2fr]":void 0,children:[o.jsx(mr,{children:o.jsx(MTn,{results:r,isLoading:n,featuredResultId:l,onResultClick:T,columns:U,scoresByItemId:y,scorerIds:l?void 0:x,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i})}),g&&o.jsxs(b3r,{numOfColumns:1+(!u&&p?1:0)+(u?1:0)+(f?1:0),minColumnWidth:"35rem",children:[g&&o.jsx(mr,{withLeftSeparator:!0,children:o.jsx(_Tn,{result:g,scores:P,onPrevious:I(),onNext:N(),onClose:j,onScoreClick:$,featuredScoreId:p,onShowTrace:()=>{d(g.traceId??null),h(void 0),m(null)}})}),g&&!u&&R&&o.jsx(mr,{withLeftSeparator:!0,children:o.jsx(FTn,{score:R,onNext:M(),onPrevious:z(),onClose:()=>m(null)})}),g&&u&&o.jsx(mr,{withLeftSeparator:!0,children:o.jsx(PTn,{traceId:u,selectedSpanId:f,onSpanSelect:h,onClose:()=>{d(null),h(void 0)}})}),g&&u&&f&&o.jsx(mr,{withLeftSeparator:!0,children:o.jsx(CTn,{traceId:u,spanId:f,onNext:k(),onPrevious:_(),onClose:()=>h(void 0)})})]})]})})]})}const BTn={pending:o.jsx(CE,{}),running:o.jsx(f3,{}),completed:o.jsx(ta,{}),failed:o.jsx(Nn,{})};function UTn({experiment:e,className:t}){const r=e.status,n=e.totalItems-e.succeededCount-e.failedCount;return o.jsxs("div",{className:Z("grid justify-items-end gap-3",t),children:[o.jsxs("div",{className:"flex p-1 px-3 text-ui-lg capitalize text-neutral4 gap-2 items-center bg-surface5 rounded-lg ",children:[o.jsx("span",{className:Z("w-5 h-5 flex items-center justify-center rounded-full text-black","[&>svg]:w-4 [&>svg]:h-4",{"bg-green-700":r==="completed","bg-red-700":r==="failed","bg-cyan-600":r==="running","bg-yellow-600":r==="pending"}),children:BTn[r]}),e.status]}),o.jsxs("div",{className:Z("flex items-center gap-3 text-neutral3 text-ui-md ","[&>span]:flex [&>span]:gap-1 [&>span]:items-center ","[&_b]:text-neutral4 [&_b]:font-semibold"),children:[o.jsxs("span",{children:["Total: ",o.jsx("b",{children:e.totalItems})]}),o.jsxs("span",{children:["Succeeded: ",o.jsx("b",{children:e.succeededCount})]}),o.jsxs("span",{children:["Failed: ",o.jsx("b",{children:e.failedCount})]}),(r==="pending"||r==="running")&&o.jsxs("span",{children:["Pending: ",o.jsx("b",{children:n})]})]})]})}function I1t({experimentId:e,experiment:t}){const{Link:r,paths:n}=ir(),{data:s}=Tg(),{data:a}=d0(),{data:i}=fd(),l=()=>{switch(t.targetType){case"agent":return n.agentLink(t.targetId);case"workflow":return n.workflowLink(t.targetId);case"scorer":return n.scorerLink(t.targetId);default:return"#"}},c=()=>{const u=t.targetId;if(!u)return u;switch(t.targetType){case"agent":return s?.[u]?.name??u;case"workflow":return a?.[u]?.name??u;case"scorer":return i?.[u]?.scorer?.config?.name??u;default:return u}};return o.jsxs(Ir,{children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{children:[o.jsx(oVe,{}),e," ",e&&o.jsx(Xa,{content:e})]}),o.jsxs(Ir.Description,{children:[o.jsxs(fs,{children:[o.jsx(g_,{})," Created at ",ur(new Date(t.createdAt),"MMM d, yyyy 'at' h:mm a")]}),t.completedAt&&o.jsxs(fs,{children:[o.jsx(g_,{})," Completed at ",ur(new Date(t.completedAt),"MMM d, yyyy 'at' h:mm a")]})]}),o.jsxs(Ir.Description,{children:[o.jsxs(fs,{children:[o.jsx(_Mt,{})," Target",o.jsx(r,{href:l(),children:c()})]}),t.agentVersion&&o.jsxs(fs,{children:[o.jsx(sF,{})," Version",t.targetType==="agent"&&t.targetId?o.jsx(r,{href:`${n.agentLink(t.targetId)}/editor?version=${encodeURIComponent(t.agentVersion)}`,className:"font-mono text-xs underline hover:text-accent1",children:t.agentVersion}):o.jsx("span",{className:"font-mono text-xs",children:t.agentVersion}),o.jsx(Xa,{content:t.agentVersion})]})]})]}),o.jsx(Ir.Column,{children:o.jsx(UTn,{experiment:t})})]})}function jve({delta:e}){const t=e>0?o.jsx($a,{size:"small",color:"green",intensity:"muted",children:o.jsx(Jle,{})}):e<0?o.jsx($a,{size:"small",color:"red",intensity:"muted",children:o.jsx(KUe,{})}):null;return o.jsxs("span",{className:Z("font-mono text-sm text-neutral4 min-w-20"),children:[o.jsx("span",{className:"w-3 inline-block",children:e>0?"+ ":e<0?"- ":""}),Math.abs(e).toFixed(2)," ",t]})}function DL(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function VTn({item:e,baselineId:t,contenderId:r,baselineVersion:n,contenderVersion:s,onPrevious:a,onNext:i,onClose:l}){const c=e.results[t],u=e.results[r],d=!!(c&&u),f=new Set;if(c)for(const p of Object.keys(c.scores))f.add(p);if(u)for(const p of Object.keys(u.scores))f.add(p);const h=[...f].sort();return o.jsxs(mr,{withLeftSeparator:!0,children:[o.jsxs(mr.Toolbar,{children:[o.jsx(wC,{onPrevious:a,onNext:i,previousAriaLabel:"Previous comparison item",nextAriaLabel:"Next comparison item"}),o.jsx(ps,{children:o.jsx(pe,{onClick:l,"aria-label":"Close comparison detail panel",children:o.jsx(Nn,{})})})]}),o.jsxs(mr.Content,{className:"pb-6",children:[o.jsx(Ir,{withMargins:!1,children:o.jsx(Ir.Column,{children:o.jsxs(Ir.Title,{size:"smaller",children:[o.jsx(px,{})," ",e.itemId]})})}),d?o.jsx(o.Fragment,{children:o.jsxs($S,{children:[h.length>0&&o.jsxs("div",{className:"grid gap-3",children:[o.jsx("h4",{className:"text-sm font-medium text-neutral5",children:"Scores"}),o.jsx("div",{className:"grid gap-2",children:h.map(p=>{const m=c?.scores[p]??null,g=u?.scores[p]??null,y=m!=null&&g!=null?g-m:null;return o.jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2 rounded-lg bg-surface2",children:[o.jsx("span",{className:"text-sm text-neutral5 font-medium",children:p}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("span",{className:"text-sm text-neutral3",children:[m!=null?m.toFixed(3):"-"," →"," ",g!=null?g.toFixed(3):"-"]}),y!=null&&o.jsx(jve,{delta:y})]})]},p)})})]}),o.jsx(Xt.CodeSection,{title:o.jsxs(o.Fragment,{children:[o.jsx($a,{color:"purple",children:"Baseline "})," Experiment Output"]}),icon:o.jsx(Zd,{}),codeStr:DL(c?.output)}),o.jsx(Xt.CodeSection,{title:o.jsxs(o.Fragment,{children:[o.jsx($a,{color:"cyan",children:"Contender "})," Experiment Output"]}),icon:o.jsx(Zd,{}),codeStr:DL(u?.output)}),o.jsx(Xt.CodeSection,{title:"Item Input",icon:o.jsx(mx,{}),codeStr:DL(e.input)}),o.jsx(Xt.CodeSection,{title:"Item Ground Truth",icon:o.jsx(OVe,{}),codeStr:DL(e.groundTruth)})]})}):o.jsxs(gl,{variant:"warning",children:[o.jsx(kh,{}),o.jsx(gl.Message,{children:(()=>{const p=c?"Contender":"Baseline",m=c?s:n;return o.jsxs(o.Fragment,{children:["The ",p," experiment was run against dataset",m!=null?` v. ${m}`:"",", which does not contain this item. Comparison is not available."]})})()})]})]})]})}function qTn({items:e,baselineId:t,contenderId:r,scorerIds:n,featuredItemId:s,columns:a,onItemClick:i}){return o.jsx(mr,{children:o.jsxs(Pt,{children:[o.jsxs(Pt.Header,{columns:a,children:[o.jsx(Pt.HeaderCol,{children:"Item ID"}),!s&&n.map(l=>o.jsx(Pt.HeaderCol,{className:"flex justify-center",children:l},l))]}),o.jsx(Pt.Scroller,{children:o.jsx(Pt.Items,{children:e.map(l=>{const c=l.results[t],u=l.results[r],d=!!(c&&u);return o.jsx(Pt.Row,{children:o.jsxs(Pt.RowButton,{item:{id:l.itemId},columns:a,isFeatured:s===l.itemId,onClick:i,children:[o.jsx(Pt.IdCell,{id:l.itemId,className:d?"":"text-neutral1"}),!s&&o.jsx(o.Fragment,{children:n.map(f=>{const h=c?.scores[f]??null,p=u?.scores[f]??null,m=h!=null&&p!=null?p-h:null;return o.jsx(Pt.Cell,{className:"flex items-center gap-5 justify-center font-mono",children:m!=null?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"flex items-center text-neutral2 min-w-24",children:[h?.toFixed(2)," → ",p?.toFixed(2)]}),o.jsx(jve,{delta:m})]}):o.jsx("span",{className:"text-neutral1",children:"-"})},f)})})]})},l.itemId)})})})]})})}const HTn={baseline:{label:"Baseline",color:"purple",customStyle:"items-end justify-items-end [&>div]:justify-end border-r-0 rounded-r-none"},contender:{label:"Contender",color:"cyan",customStyle:"items-start justify-items-start [&>div]:justify-start border-l-0 rounded-l-none"}};function DBe({datasetId:e,experiment:t,type:r}){const{Link:n}=ir(),{label:s,color:a,customStyle:i}=HTn[r];if(!t)return null;const l=t.createdAt?new Date(t.createdAt):null;return o.jsxs("div",{className:`grid border-2 border-border1 rounded-lg p-5 gap-3 ${i}`,children:[o.jsxs("div",{className:"flex items-center gap-3 w-full overflow-clip",children:[r==="contender"&&o.jsxs($a,{size:"small",color:a,children:[s,o.jsx(Fw,{})]}),o.jsx(pe,{as:n,href:`/datasets/${e}/experiments/${t.id}`,children:o.jsx("span",{className:"truncate min-w-0",children:t.id})}),r==="baseline"&&o.jsxs($a,{size:"small",color:a,children:[o.jsx(_p,{})," ",s]})]}),o.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-ui-sm text-neutral3",children:[o.jsxs(fs,{children:[o.jsx(OVe,{})," ",t.targetType," / ",t.targetId]}),o.jsxs(fs,{children:[o.jsx(pVe,{})," v",t.datasetVersion??"—"]}),l&&o.jsxs(fs,{children:[o.jsx(JUe,{})," ",ur(l,"MMM d, yyyy HH:mm")]})]})]})}function QTn({datasetId:e,experimentIdA:t,experimentIdB:r,onSwap:n}){const[s,a]=b.useState(null),{data:i,isLoading:l,error:c}=ojn(e,t,r),{data:u}=V6(e,t),{data:d}=V6(e,r),f=u&&d&&u.datasetVersion!==d.datasetVersion,h=b.useMemo(()=>{if(!i)return[];const T=new Set;for(const j of i.items)for(const N of Object.values(j.results))if(N)for(const I of Object.keys(N.scores))T.add(I);return[...T].sort()},[i]),p=b.useMemo(()=>{if(!i||h.length===0)return[];const T=i.baselineId,j=t===T?r:t;return h.map(N=>{let I=0,P=0,R=0,$=0;for(const B of i.items){const H=B.results[T]?.scores[N],W=B.results[j]?.scores[N];H!=null&&(I+=H,R++),W!=null&&(P+=W,$++)}const M=R>0?I/R:null,z=$>0?P/$:null,U=M!=null&&z!=null?z-M:null;return{scorerId:N,avgA:M,avgB:z,delta:U}})},[i,h,t,r]),m=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"baselineAvg",label:"Baseline Avg",size:"1fr"},{name:"comparisonAvg",label:"Comparison Avg",size:"1fr"},{name:"delta",label:"Delta",size:"1fr"}],g=b.useMemo(()=>[{name:"itemId",label:"Item ID",size:"8rem"},...s?[]:h.map(T=>({name:T,label:T,size:"1fr"}))],[h,s]),y=i?.items.find(T=>T.itemId===s)??null,x=T=>{a(T===s?null:T)},w=()=>{a(null)},S=()=>{if(!i||!s)return;const T=i.items.findIndex(j=>j.itemId===s);if(T>=0&&T<i.items.length-1)return()=>a(i.items[T+1].itemId)},k=()=>{if(!i||!s)return;const T=i.items.findIndex(j=>j.itemId===s);if(T>0)return()=>a(i.items[T-1].itemId)};if(l)return o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx(Mt,{})});if(c)return o.jsxs(gl,{variant:"warning",children:[o.jsx(kh,{}),o.jsxs(gl.Column,{children:[o.jsx(gl.Title,{children:"Error loading comparison"}),o.jsx(gl.Message,{children:c instanceof Error?c.message:"Unknown error"})]})]});if(!i||i.items.length===0)return o.jsx("div",{className:"text-neutral4 text-sm text-center py-8",children:"No comparison data"});const _=i.baselineId,E=t===_?r:t;return o.jsxs("div",{className:"grid gap-10",children:[u&&d&&o.jsxs("div",{className:Z("relative grid xl:grid-cols-[1fr_auto_1fr] gap-4 xl:gap-0"),children:[o.jsx(DBe,{datasetId:e,experiment:u,type:"baseline"}),o.jsx("div",{className:"relative flex items-center justify-center px-[2vw] before:absolute before:inset-y-0 before:left-1/2 before:-translate-x-1/2 before:w-[2px] before:bg-border1",children:o.jsx("div",{className:"relative z-1 bg-surface2 rounded-lg p-2",children:o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(pe,{onClick:n,children:"VS"})}),o.jsx(Wr,{children:"Switch the order"})]})})}),o.jsx(DBe,{datasetId:e,experiment:d,type:"contender"})]}),f&&o.jsxs(gl,{variant:"warning",children:[o.jsx(kh,{}),o.jsxs(gl.Message,{children:[o.jsx("strong",{children:"Version mismatch!"})," These experiments used different dataset versions (v",u.datasetVersion," vs v",d.datasetVersion,"). Results may not be directly comparable."]})]}),p.length>0&&o.jsxs(Pt,{children:[o.jsxs(Pt.Header,{columns:m,children:[o.jsx(Pt.HeaderCol,{children:"Scorer"}),o.jsx(Pt.HeaderCol,{className:"flex justify-center",children:o.jsxs(nRe,{children:[o.jsx($a,{color:"purple",size:"small",intensity:"muted",children:"Baseline"}),o.jsx($a,{color:"purple",size:"small",children:"Avg"})]})}),o.jsx(Pt.HeaderCol,{className:"flex justify-center",children:o.jsxs(nRe,{children:[o.jsx($a,{color:"cyan",size:"small",intensity:"muted",children:"Contender"}),o.jsx($a,{color:"cyan",size:"small",children:"Avg"})]})}),o.jsx(Pt.HeaderCol,{className:"flex justify-center",children:"Delta"})]}),o.jsx(Pt.Scroller,{children:o.jsx(Pt.Items,{children:p.map(({scorerId:T,avgA:j,avgB:N,delta:I})=>o.jsxs(Pt.Row,{columns:m,children:[o.jsx(Pt.TextCell,{children:T}),o.jsx(Pt.TextCell,{className:"text-center font-mono",children:j!=null?j.toFixed(3):"-"}),o.jsx(Pt.TextCell,{className:"text-center font-mono",children:N!=null?N.toFixed(3):"-"}),o.jsx(Pt.TextCell,{className:"flex justify-center",children:I!=null?o.jsx(jve,{delta:I}):"-"})]},T))})})]}),o.jsxs(sf,{className:Z({"grid-cols-[1fr_2fr]":!!y}),children:[o.jsx(qTn,{items:i.items,baselineId:_,contenderId:E,scorerIds:h,featuredItemId:s,columns:g,onItemClick:x}),!!y&&o.jsx(VTn,{item:y,baselineId:_,contenderId:E,baselineVersion:u?.datasetVersion,contenderVersion:d?.datasetVersion,onPrevious:k(),onNext:S(),onClose:w})]})]})}function WTn({datasetId:e,itemId:t,onVersionSelect:r,onCompareVersionsClick:n,activeVersion:s}){const{data:a,isLoading:i}=Cve(e,t),[l,c]=b.useState(!1),[u,d]=b.useState(new Set),f=x=>{r?.(x)},h=x=>s==null?x.isLatest:x.datasetVersion===s,p=x=>{d(w=>{const S=new Set(w);if(S.has(x))S.delete(x);else if(S.size>=2){const[k]=Array.from(S);return new Set([k,x])}else S.add(x);return S})},m=()=>{c(!1),d(new Set)},g=()=>{c(!0)},y=()=>{u.size===2&&n?.([...u])};return o.jsxs(mr,{className:"min-w-56",children:[l?o.jsx(mr.Toolbar,{className:"grid justify-stretch gap-3 w-full",children:o.jsxs(ps,{children:[o.jsx(pe,{onClick:m,children:"Cancel"}),o.jsx(Cn,{variant:"primary",disabled:u.size!==2,onClick:y,tooltipContent:u.size!==2?"Check 2 versions to compare":void 0,className:"grow",children:"Compare"})]})}):o.jsx(o.Fragment,{children:(a||[]).length>1&&o.jsx(mr.Toolbar,{children:o.jsxs(pe,{onClick:g,className:"w-full",children:[o.jsx(qm,{})," Compare Ver."]})})}),i?o.jsx(GTn,{}):o.jsxs(Pt,{children:[o.jsx(Pt.Header,{children:o.jsx(Pt.HeaderCol,{children:"Item Version History"})}),o.jsx(Pt.Scroller,{children:o.jsx(Pt.Items,{children:a?.map(x=>{const w=String(x.datasetVersion),S=typeof x.updatedAt=="string"?new Date(x.updatedAt):x.updatedAt;return o.jsxs(Pt.Row,{isSelected:l&&u.has(w),children:[l&&o.jsx(Pt.LabelCell,{children:o.jsx(di,{checked:u.has(w),disabled:x.isDeleted,onCheckedChange:()=>{},onClick:k=>{k.stopPropagation(),x.isDeleted||p(w)},"aria-label":`Select version ${x.datasetVersion}`})}),o.jsx(Pt.RowButton,{item:x,columns:[{name:"version",label:"Item Version History",size:"1fr"}],isFeatured:h(x),onClick:()=>f(x),className:"py-2",children:o.jsx(Pt.VersionCell,{version:x.datasetVersion,date:S,isLatest:x.isLatest,isDeleted:x.isDeleted})})]},String(x.datasetVersion))})})})]})]})}function GTn(){return o.jsxs(Pt,{children:[o.jsx(Pt.Header,{columns:[{name:"version",label:"Item Version History",size:"1fr"}],children:o.jsx(Pt.HeaderCol,{children:"Item Version History"})}),o.jsx(Pt.Items,{children:Array.from({length:3}).map((e,t)=>o.jsx(Pt.Row,{children:o.jsx(Pt.RowButton,{columns:[{name:"version",label:"Item Version History",size:"1fr"}],children:o.jsx(Pt.TextCell,{isLoading:!0,children:"Loading..."})})},t))})]})}function ZTn(e,t){if(t){const r=typeof t=="string"?new Date(t):t;return`v${e} ${ur(r,"MMM dd 'at' H:mm:ss a")}`}return`v${e}`}function YTn({datasetId:e,versionA:t,versionB:r,onVersionChange:n}){const{data:s}=_ve(e),a=(s??[]).map(i=>({value:String(i.version),label:`${ZTn(i.version,i.createdAt)}${i.isCurrent?" (current)":""}`}));return o.jsxs(mr.Toolbar,{className:"grid grid-cols-[1fr_1fr_1fr_10rem] gap-4 w-full",children:[o.jsx("div",{}),o.jsx($o,{label:"Version A",labelIsHidden:!0,name:"version-a",placeholder:"Select version",options:a,value:t??"",onValueChange:i=>n?.(i,r??"")}),o.jsx($o,{label:"Version B",labelIsHidden:!0,name:"version-b",options:a,value:r??"",onValueChange:i=>n?.(t??"",i)}),o.jsx("div",{})]})}const XTn=[{name:"id",label:"ID",size:"1fr"},{name:"versionA",label:"Version A",size:"1fr"},{name:"versionB",label:"Version B",size:"1fr"},{name:"compare",label:"Compare",size:"10rem"}],KTn={added:{color:"blue",borderColor:"border-blue-900",icon:o.jsx(cs,{}),tooltip:"Added in this version"},changed:{color:"orange",borderColor:"border-yellow-900",icon:o.jsx(SVe,{}),tooltip:"Changed in this version"},same:{color:"green",borderColor:"border-green-900",icon:o.jsx(DMt,{}),tooltip:"Same in both versions"}};function tre({red:e=!1,tooltip:t}){return o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(mPt,{className:Z("text-neutral3/40 w-5 h-5 ",{"text-red-900":e})})}),t&&o.jsx(Wr,{children:t})]})}function rw({variant:e,version:t}){if(!e)return o.jsxs("span",{className:"text-ui-md text-neutral4",children:["v. ",t]});const{color:r,icon:n,tooltip:s}=KTn[e];return o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsxs("div",{className:"grid grid-cols-[1fr_auto]",children:[t!==void 0&&o.jsxs("span",{className:"pr-3 text-ui-md text-neutral4 min-w-16 flex justify-end",children:["v. ",t]}),o.jsx($a,{color:r,size:"small",children:n})]})}),o.jsx(Wr,{children:s})]})}function JTn(e,t){return e&&t&&e.datasetVersion===t.datasetVersion?"same":e&&t&&e.datasetVersion!==t.datasetVersion?"changed":e?"added":"removed"}function eNn({datasetId:e,versionA:t,versionB:r,allItems:n,itemsAMap:s,itemsBMap:a}){const{Link:i}=ir(),l=t>r;return o.jsx(Pt,{children:o.jsx(Pt.Scroller,{children:o.jsx(Pt.Items,{children:n.map(({id:c})=>{const u=s.get(c),d=a.get(c),f=JTn(u,d);return o.jsxs(Pt.Row,{columns:XTn,children:[o.jsx(Pt.IdCell,{id:c,isShortened:!1}),f!=="same"?o.jsxs(o.Fragment,{children:[u?.datasetVersion?o.jsx(Pt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"gap-2",children:!d&&l?o.jsx(rw,{variant:"added",version:u.datasetVersion}):f==="changed"&&l?o.jsx(rw,{variant:"changed",version:u.datasetVersion}):o.jsx(rw,{version:u.datasetVersion})}):o.jsx(Pt.Cell,{className:"justify-center flex items-center",children:o.jsx(tre,{red:l,tooltip:l?"Deleted in this version":"Not present in this version"})}),d?.datasetVersion?o.jsx(Pt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"gap-2",children:!u&&!l?o.jsx(rw,{variant:"added",version:d.datasetVersion}):f==="changed"&&!l?o.jsx(rw,{variant:"changed",version:d.datasetVersion}):o.jsx(rw,{version:d.datasetVersion})}):o.jsx(Pt.Cell,{className:"justify-center flex items-center",children:o.jsx(tre,{red:!l,tooltip:l?"Not present in this version":"Deleted in this version"})})]}):o.jsx(Pt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"col-span-2 gap-2",children:o.jsx(rw,{variant:"same",version:d?.datasetVersion})}),f==="changed"?o.jsx(Pt.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}/versions?ids=${u?.datasetVersion},${d?.datasetVersion}`,children:"Compare"}):o.jsx(Pt.Cell,{children:o.jsx(tre,{tooltip:o.jsxs(o.Fragment,{children:["Comparing is available",o.jsx("br",{})," only for changed items"]})})})]},c)})})})})}const LBe={needsReview:"#facc15",complete:"#22c55e"},tNn=[{label:"Needs Review",color:LBe.needsReview},{label:"Reviewed",color:LBe.complete}];function rNn({reviewSummary:e,experiments:t,datasets:r,isLoading:n,isError:s}){const{data:a,maxVal:i,totalInPipeline:l}=b.useMemo(()=>{if(!e?.counts||!t)return{data:[],maxVal:0,totalInPipeline:0};const u=new Map;for(const m of t)u.set(m.id,m);const d=new Map;if(r)for(const m of r)d.set(m.id,m.name);let f=0,h=0;const p=[];for(const m of e.counts){const g=m.needsReview+m.complete;if(g===0)continue;h+=g,g>f&&(f=g);const y=u.get(m.experimentId),x=y?.datasetId?d.get(y.datasetId):void 0,w=x?`${x} · ${m.experimentId.slice(0,8)}`:m.experimentId.slice(0,8);p.push({name:w,values:[m.needsReview,m.complete]})}return{data:p,maxVal:f,totalInPipeline:h}},[e,t,r]),c=a.length>0;return o.jsxs(Ht,{children:[o.jsxs(Ht.TopBar,{children:[o.jsx(Ht.TitleAndDescription,{title:"Review Pipeline",description:"Items in review across experiments."}),c&&o.jsx(Ht.Summary,{value:String(l),label:"Items in pipeline"})]}),n?o.jsx(Ht.Loading,{}):s?o.jsx(Ht.Error,{message:"Failed to load review data"}):o.jsx(Ht.Content,{children:c?o.jsx(J_,{data:a,segments:tNn,maxVal:i,fmt:u=>String(u)}):o.jsx(Ht.NoData,{message:"No items have been sent to review yet"})})]})}function Tve(){const e=Ge();return kt({queryKey:["experiment-review-summary"],queryFn:()=>e.getExperimentReviewSummary()})}function R1t(e){const t=new Map;if(!e?.counts)return t;for(const r of e.counts)t.set(r.experimentId,{needsReview:r.needsReview,complete:r.complete,total:r.total});return t}function nNn(e,t){const r=new Map,n=R1t(e);if(!n.size||!t)return r;for(const s of t){const a=n.get(s.id);if(!a||!s.datasetId||a.needsReview+a.complete===0)continue;const l=r.get(s.datasetId)??{needsReview:0,complete:0};l.needsReview+=a.needsReview,l.complete+=a.complete,r.set(s.datasetId,l)}return r}function sNn(e){return e?.counts?e.counts.reduce((t,r)=>({needsReview:t.needsReview+r.needsReview,complete:t.complete+r.complete,inPipeline:t.inPipeline+r.needsReview+r.complete}),{needsReview:0,complete:0,inPipeline:0}):{needsReview:0,complete:0,inPipeline:0}}const aNn=10;function iNn(){const[e,t]=b.useState(!1),[r,n]=b.useState(""),[s,a]=b.useState("all"),[i,l]=b.useState("all"),[c,u]=b.useState("all"),[d,f]=b.useState(0),{data:h,isLoading:p,error:m}=zh({page:d,perPage:aNn}),{data:g,isLoading:y,error:x}=K8(),{data:w}=Tve(),S=b.useMemo(()=>h?.datasets??[],[h?.datasets]),k=h?.pagination?.hasMore??!1,_=b.useMemo(()=>g?.experiments??[],[g?.experiments]),E=b.useMemo(()=>_jn(S),[S]),T=b.useMemo(()=>nNn(w,_),[w,_]),j=p||y,N=m||x,I=()=>t(!0),P=b.useCallback(()=>f(W=>W+1),[]),R=b.useCallback(()=>f(W=>Math.max(0,W-1)),[]),$=b.useCallback(W=>{n(W),f(0)},[]),M=b.useCallback(W=>{a(W),f(0)},[]),z=b.useCallback(W=>{l(W),f(0)},[]),U=b.useCallback(W=>{u(W),f(0)},[]);if(N&&Ps(N))return o.jsx(Jr,{title:"Datasets",icon:o.jsx(ja,{}),children:o.jsx(na,{})});if(N&&ks(N))return o.jsx(Jr,{title:"Datasets",icon:o.jsx(ja,{}),children:o.jsx(Gs,{resource:"datasets"})});if(N)return o.jsx(Jr,{title:"Datasets",icon:o.jsx(ja,{}),children:o.jsx(gu,{title:"Failed to load datasets",message:N.message})});if(S.length===0&&!j&&d===0)return o.jsxs(o.Fragment,{children:[o.jsx(Jr,{title:"Datasets",icon:o.jsx(ja,{}),children:o.jsx(Ejn,{onCreateClick:I})}),o.jsx(Tle,{open:e,onOpenChange:t})]});const B=s!=="all"||i!=="all"||c!=="all"||r!=="",H=()=>{n(""),a("all"),l("all"),u("all"),f(0)};return o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:j,children:[o.jsx(ja,{})," Datasets"]})})}),o.jsxs(bt.Column,{className:"flex justify-end gap-2",children:[o.jsx(Cn,{onClick:I,tooltipContent:"Create a dataset",children:o.jsx(cs,{})}),o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/evals/datasets/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Datasets documentation",children:o.jsx(Di,{})})]})]}),o.jsx(jjn,{search:r,onSearchChange:$,targetFilter:s,onTargetFilterChange:M,experimentFilter:i,onExperimentFilterChange:z,tagFilter:c,onTagFilterChange:U,tagOptions:E,onReset:H,hasActiveFilters:B})]}),o.jsx(Sjn,{datasets:S,experiments:_,reviewByDataset:T,isLoading:j,search:r,targetFilter:s,experimentFilter:i,tagFilter:c,currentPage:d,hasMore:k,onNextPage:P,onPrevPage:R}),o.jsx(Tle,{open:e,onOpenChange:t})]})}const oNn=new Set(["items","experiments","review"]);function lNn(){const{datasetId:e}=ra(),t=fu(),[r,n]=so(),s=r.get("tab"),a=s&&oNn.has(s)?s:"items",i=E=>{n(E==="items"?{}:{tab:E},{replace:!0})},[l,c]=b.useState(!1),[u,d]=b.useState(!1),[f,h]=b.useState(!1),[p,m]=b.useState(!1),[g,y]=b.useState(null),{data:x,error:w}=Ig(e??"");if(!e)return o.jsx(zr,{children:o.jsx(pf,{children:o.jsx("div",{className:"text-neutral3 p-4",children:"Dataset not found"})})});if(w&&Ps(w))return o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})});if(w&&ks(w))return o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})});const S=E=>{t(`/datasets/${e}/experiments/${E}`)},k=()=>{t("/datasets")},_=E=>{y(E?.version??null)};return o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:o.jsx(Pjn,{value:e,variant:"ghost"})})]})}),o.jsxs(pf,{className:"content-stretch",children:[o.jsx(vTn,{datasetId:e,onAddItemClick:()=>d(!0),onEditClick:()=>h(!0),onDeleteClick:()=>m(!0),activeDatasetVersion:g,onVersionSelect:_,initialTab:a,onTabChange:i,experimentTriggerSlot:o.jsxs(pe,{variant:"primary",onClick:()=>c(!0),children:[o.jsx(gx,{}),g!=null?`Run on v${g}`:"Run Experiment"]})}),o.jsx(kTn,{datasetId:e,version:g??void 0,open:l,onOpenChange:c,onSuccess:S}),o.jsx(xTn,{datasetId:e,open:u,onOpenChange:d}),x&&o.jsx(Ijn,{open:f,onOpenChange:h,dataset:{id:x.id,name:x.name,description:x?.description||"",inputSchema:x.inputSchema,groundTruthSchema:x.groundTruthSchema}}),x&&o.jsx(Rjn,{open:p,onOpenChange:m,datasetId:x.id,datasetName:x.name,onSuccess:k})]})]})}function cNn(){const{datasetId:e,experimentId:t}=ra(),{data:r}=Ig(e??""),{data:n,isLoading:s,error:a}=V6(e,t),{data:i,isLoading:l,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d}=X8({datasetId:e,experimentId:t,experimentStatus:n?.status});return!e||!t?null:s?o.jsx(zr,{children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(Mt,{})})}):a&&Ps(a)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):a&&ks(a)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})}):a||!n?o.jsx(zr,{children:o.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",a instanceof Error?a.message:"Unknown error"]})}):o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:dr,to:`/datasets/${e}`,children:r?.name}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Experiment"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsx(I1t,{experimentId:t,experiment:n}),o.jsx(A1t,{experimentId:t,experimentStatus:n?.status,results:i??[],isLoading:l,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d})]})})]})}function uNn(){const{datasetId:e}=ra(),[t,r]=so(),{data:n,error:s}=Ig(e??""),a=t.get("baseline")??"",i=t.get("contender")??"";return s&&Ps(s)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):s&&ks(s)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})}):!e||!a||!i?o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsxs(jr,{isCurrent:!0,as:"span",children:[o.jsx(Ce,{children:o.jsx(qm,{})}),"Compare Experiments"]})]})}),o.jsx(pf,{children:o.jsxs("div",{className:"text-neutral4 text-center py-8",children:[o.jsx("p",{children:"Select two experiments to compare."}),o.jsxs("p",{className:"text-sm mt-2",children:["Use the URL format: /datasets/","{datasetId}","/experiments?baseline=","{experimentIdA}","&contender=","{experimentIdB}"]})]})})]}):o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:dr,to:`/datasets/${e}`,children:n?.name??e?.slice(0,8)}),o.jsxs(jr,{isCurrent:!0,as:"span",children:[o.jsx(Ce,{children:o.jsx(qm,{})}),"Experiments Comparison"]})]})}),o.jsx(pf,{children:o.jsxs("div",{className:"max-w-[100rem] w-full px-12 mx-auto grid content-start ",children:[o.jsxs(Ir,{children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{children:[o.jsx(qm,{})," Dataset Experiments Comparison"]}),o.jsxs(Ir.Description,{children:["Comparing"," ",o.jsx(dr,{to:`/datasets/${e}/experiments/${a}`,children:a.slice(0,8)})," vs"," ",o.jsx(dr,{to:`/datasets/${e}/experiments/${i}`,children:i.slice(0,8)})]})]}),o.jsx(Ir.Column,{children:o.jsxs(pe,{as:dr,to:`/datasets/${e}`,children:[o.jsx(_p,{}),"Back to Dataset"]})})]}),o.jsx(QTn,{datasetId:e,experimentIdA:a,experimentIdB:i,onSwap:()=>{r({baseline:i,contender:a})}})]})})]})}function dNn(){const{datasetId:e,itemId:t}=ra(),{Link:r}=ir(),n=fu(),{data:s,isLoading:a,error:i}=Cve(e??"",t??""),{updateItem:l,deleteItem:c}=ri(),{data:u}=Ig(e??""),d=s?.[0]??null,f=d?.isDeleted??!1,[h,p]=b.useState(null),m=b.useMemo(()=>!d||f?{input:"",groundTruth:"",metadata:""}:{input:JSON.stringify(d.input,null,2),groundTruth:d.groundTruth?JSON.stringify(d.groundTruth,null,2):"",metadata:d.metadata?JSON.stringify(d.metadata,null,2):""},[d,f]),g=d?.datasetVersion??0,[y,x]=b.useState(!1),[w,S]=b.useState(m.input),[k,_]=b.useState(m.groundTruth),[E,T]=b.useState(m.metadata),[j,N]=b.useState(g);g!==j&&(N(g),S(m.input),_(m.groundTruth),T(m.metadata));const[I,P]=b.useState(!1),R=q=>{p(f?q:q.isLatest?null:q)},$=()=>{p(null)},M=!f&&h!=null,z=()=>{M||x(!0)},U=()=>{M||P(!0)},B=async()=>{if(!e||!t)return;let q;try{q=JSON.parse(w)}catch{ze.error("Input must be valid JSON");return}let D;if(k.trim())try{D=JSON.parse(k)}catch{ze.error("Ground Truth must be valid JSON");return}let Q;if(E.trim())try{Q=JSON.parse(E)}catch{ze.error("Metadata must be valid JSON");return}try{await l.mutateAsync({datasetId:e,itemId:t,input:q,groundTruth:D,metadata:Q}),ze.success("Item updated successfully"),x(!1)}catch(G){ze.error(`Failed to update item: ${G instanceof Error?G.message:"Unknown error"}`)}},H=()=>{d&&(S(JSON.stringify(d.input,null,2)),_(d.groundTruth?JSON.stringify(d.groundTruth,null,2):""),T(d.metadata?JSON.stringify(d.metadata,null,2):"")),x(!1)},W=async()=>{if(!(!e||!t))try{await c.mutateAsync({datasetId:e,itemId:t}),ze.success("Item deleted successfully"),P(!1),n(`/datasets/${e}`)}catch(q){ze.error(`Failed to delete item: ${q instanceof Error?q.message:"Unknown error"}`)}},L=h??d,Y=L?{id:t??"",datasetId:e??"",datasetVersion:L.datasetVersion,input:L.input,groundTruth:L.groundTruth,metadata:L.metadata,createdAt:L.createdAt,updatedAt:L.updatedAt}:null;return i&&Ps(i)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):i&&ks(i)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})}):a?null:!e||!t||!s||s.length===0?o.jsx(zr,{children:o.jsx(pf,{children:o.jsx("div",{className:"text-neutral3 p-4",children:"Item not found"})})}):o.jsxs(o.Fragment,{children:[o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:dr,to:`/datasets/${e}`,children:u?.name}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Item"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-6 pb-4",children:o.jsxs("div",{className:"grid gap-6 max-w-[60rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsxs(Ir,{children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{children:[o.jsx(px,{}),t," ",o.jsx(Xa,{content:t})]}),o.jsx(Ir.Description,{children:o.jsxs(fs,{children:["Item of ",o.jsx(ja,{})," ",u?.name]})}),o.jsxs(Ir.Description,{children:[o.jsxs(fs,{children:[o.jsx(g_,{})," Created at"," ",d?.createdAt?ur(new Date(d.createdAt),"MMM d, yyyy"):""]}),o.jsxs(fs,{children:[o.jsx(Qx,{})," Latest version v",d?.datasetVersion??""]})]})]}),o.jsx(Ir.Column,{children:!y&&!f&&o.jsxs(ps,{children:[o.jsxs(pe,{onClick:z,disabled:M,title:M?"Return to latest version to edit":void 0,children:[o.jsx(SVe,{})," Edit"]}),o.jsxs(pe,{onClick:U,disabled:M,title:M?"Return to latest version to delete":void 0,children:[o.jsx(nd,{})," Delete"]})]})})]}),o.jsxs(sf,{className:y?"grid-cols-1":"grid-cols-[1fr_auto]",children:[o.jsxs(mr,{withRightSeparator:!y,children:[f&&d&&o.jsxs(gl,{variant:"destructive",children:[o.jsx(kh,{}),o.jsxs(gl.Message,{children:["This item was deleted at version v",d.datasetVersion]})]}),!f&&M&&h&&o.jsx(o.Fragment,{children:o.jsxs(gl,{variant:"warning",children:[o.jsx(kh,{}),o.jsxs(gl.Message,{children:["Viewing version v",h.datasetVersion]}),o.jsxs(gl.Button,{onClick:$,children:[o.jsx(mw,{})," Return to the latest version"]})]})}),y?o.jsx(k1t,{inputValue:w,setInputValue:S,groundTruthValue:k,setGroundTruthValue:_,metadataValue:E,setMetadataValue:T,validationErrors:null,onSave:B,onCancel:H,isSaving:l.isPending}):Y?o.jsx(J8,{item:Y,Link:r}):o.jsx("div",{className:"text-neutral4 text-sm",children:"Item data not available"})]}),!y&&o.jsx(mr,{children:o.jsx(WTn,{datasetId:e,itemId:t,onClose:()=>{},onVersionSelect:R,onCompareVersionsClick:q=>{n(`/datasets/${e}/items/${t}/versions?ids=${q.join(",")}`)},activeVersion:h?.datasetVersion??null})})]})]})})]}),o.jsx(Bt,{open:I,onOpenChange:P,children:o.jsxs(Bt.Content,{children:[o.jsxs(Bt.Header,{children:[o.jsx(Bt.Title,{children:"Delete Item"}),o.jsx(Bt.Description,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),o.jsxs(Bt.Footer,{children:[o.jsx(Bt.Cancel,{children:"Cancel"}),o.jsx(Bt.Action,{onClick:W,children:c.isPending?"Deleting...":"Delete"})]})]})})]})}function $Be(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function fNn(){const{datasetId:e}=ra(),[t,r]=so(),n=t.get("items")?.split(",").filter(Boolean)??[],{data:s,error:a}=Ig(e??""),{Link:i}=ir(),[l,c]=b.useState(!1),{data:u}=Ele(e??"",n[0]??""),{data:d}=Ele(e??"",n[1]??"");return a&&Ps(a)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):a&&ks(a)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})}):!e||n.length<2?o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Compare Items"})]})}),o.jsx(pf,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two items to compare."})})})]}):o.jsxs(zr,{children:[o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:dr,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Compare Items"})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:`/datasets/${e}`,variant:"outline",children:[o.jsx(Ce,{children:o.jsx(_p,{})}),"Back to Dataset"]})})]}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:Z("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":l}),children:[o.jsxs(Ir,{children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{children:[o.jsx(qm,{}),"Compare Dataset Items"]}),o.jsx(Ir.Description,{children:o.jsxs(fs,{children:["Comparing ",n.length," items of"," ",o.jsx(dr,{to:`/datasets/${e}`,className:"text-info1 hover:underline",children:s?.name||e?.slice(0,8)})]})})]}),o.jsx(Ir.Column,{children:o.jsxs(ps,{children:[o.jsxs(pe,{as:dr,to:`/datasets/${e}`,children:[o.jsx(_p,{}),"Back to Dataset"]}),o.jsx(pe,{variant:"primary",onClick:()=>c(f=>!f),children:l?o.jsxs(o.Fragment,{children:[o.jsx(dVe,{})," Default View"]}):o.jsxs(o.Fragment,{children:[o.jsx(jMt,{})," Diff View"]})})]})})]}),o.jsx(sf,{className:"grid-cols-[1fr_3vw_1fr]",children:n.map((f,h)=>o.jsxs(b.Fragment,{children:[o.jsx(hNn,{datasetId:e,itemId:f,Link:i,idx:h,itemIds:n,showContent:!l,onItemChange:p=>{const m=[...n];m[h]=p,r({items:m.join(",")})}}),h==0&&o.jsx("div",{className:Z("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},f))}),l&&u&&d&&o.jsx(kft,{codeA:$Be(u),codeB:$Be(d)})]})})]})}function hNn({datasetId:e,itemId:t,Link:r,idx:n,itemIds:s,onItemChange:a,showContent:i=!0}){const{data:l,isLoading:c}=Ele(e,t),{data:u}=kE(e),d=new Set(s.filter((h,p)=>p!==n)),f=(u??[]).map(h=>({value:h.id,label:h.id,disabled:d.has(h.id)}));return o.jsxs(mr,{children:[o.jsxs(mr.Toolbar,{className:"flex gap-4",children:[o.jsx(ege,{label:"Item",name:`compare-item-${n}`,value:t,onValueChange:a,options:f,placeholder:"Select item",labelIsHidden:!0}),o.jsxs(pe,{as:r,to:`/datasets/${e}/items/${t}`,children:[o.jsx(Qx,{}),"Versions"]})]}),i&&o.jsx(mr.Content,{children:c?o.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):l?o.jsxs(o.Fragment,{children:[o.jsx(_1t,{item:l}),o.jsx(J8,{item:l,Link:r})]}):o.jsxs("div",{className:"text-neutral4 text-sm",children:["Item ",t.slice(0,8)," not found"]})})]})}function FBe(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function pNn(){const{datasetId:e,itemId:t}=ra(),[r,n]=so(),[s,a]=b.useState(!1),i=r.get("ids")?.split(",").map(Number).filter(p=>!isNaN(p)&&p>0)??[],{data:l,error:c}=Ig(e??""),{Link:u}=ir(),{data:d}=Cve(e??"",t??""),{data:f}=Ale(e??"",t??"",i[0]??0,l?.version),{data:h}=Ale(e??"",t??"",i[1]??0,l?.version);return c&&Ps(c)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):c&&ks(c)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})}):!e||!t||i.length<2?o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),o.jsx(pf,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two versions to compare."})})})]}):o.jsxs(zr,{children:[o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:dr,to:`/datasets/${e}`,children:l?.name}),o.jsx(jr,{as:dr,to:`/datasets/${e}/items/${t}`,children:"Item"}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Compare Versions"})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:`/datasets/${e}/items/${t}`,variant:"outline",children:[o.jsx(Ce,{children:o.jsx(_p,{})}),"Back to Item"]})})]}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:Z("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":s}),children:[o.jsxs(Ir,{children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{children:[o.jsx(qm,{}),"Compare Dataset Item Versions"]}),o.jsx(Ir.Description,{children:o.jsxs(fs,{children:["Comparing ",i.length," versions of"," ",o.jsx(dr,{to:`/datasets/${e}/items/${t}`,className:"text-info1 hover:underline",children:t})]})})]}),o.jsx(Ir.Column,{children:o.jsxs(ps,{children:[o.jsxs(pe,{as:dr,to:`/datasets/${e}/items/${t}`,children:[o.jsx(_p,{}),"Back to Item"]}),o.jsx(pe,{variant:"primary",onClick:()=>a(p=>!p),children:s?o.jsxs(o.Fragment,{children:[o.jsx(dVe,{})," Default View"]}):o.jsxs(o.Fragment,{children:[o.jsx(d2t,{})," Diff View"]})})]})})]}),o.jsx(sf,{className:"grid-cols-[1fr_3vw_1fr]",children:i.map((p,m)=>o.jsxs(b.Fragment,{children:[o.jsx(mNn,{datasetId:e,itemId:t,datasetVersion:p,latestVersion:l?.version,allVersions:d??[],versionNumbers:i,Link:u,idx:m,showContent:!s,onVersionChange:g=>{const y=[...i];y[m]=g,n({ids:y.join(",")})}}),m===0&&o.jsx("div",{className:Z("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},p))}),s&&f&&h&&o.jsx(kft,{codeA:FBe(f),codeB:FBe(h)})]})})]})}function mNn({datasetId:e,itemId:t,datasetVersion:r,latestVersion:n,allVersions:s,versionNumbers:a,Link:i,idx:l,showContent:c=!0,onVersionChange:u}){const{data:d,isLoading:f}=Ale(e,t,r,n),h=new Set(a.filter((g,y)=>y!==l)),p=s.map(g=>{const y=typeof g.updatedAt=="string"?new Date(g.updatedAt):g.updatedAt;return{value:String(g.datasetVersion),label:o.jsxs(o.Fragment,{children:[o.jsxs("b",{children:["v. ",g.datasetVersion]})," - ",ur(y,"MMM d, yyyy h:mm a"),g.isLatest?o.jsx($a,{color:"blue",size:"small",children:"Latest"}):null]}),disabled:h.has(g.datasetVersion)}}),m=d?{id:d.id,datasetId:e,datasetVersion:d.datasetVersion,input:d.input,groundTruth:d.groundTruth,metadata:d.metadata,createdAt:d.createdAt,updatedAt:d.updatedAt}:null;return o.jsxs(mr,{children:[o.jsxs(mr.Toolbar,{className:"grid gap-4 grid-cols-[auto_1fr]",children:[o.jsx(Qx,{className:"w-6 h-6 opacity-50"}),o.jsx(ege,{label:"Version",name:`compare-version-${l}`,value:String(r),onValueChange:g=>u(Number(g)),options:p,placeholder:"Select version",labelIsHidden:!0,className:"w-full"})]}),c&&o.jsx(mr.Content,{children:f?o.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):!d||!m?o.jsxs("div",{className:"text-neutral4 text-sm",children:["Version ",r," not found"]}):o.jsx(J8,{item:m,Link:i})})]})}function gNn(){const{datasetId:e}=ra(),[t]=so(),r=t.get("ids")?.split(",").map(Number).filter(g=>!isNaN(g)&&g>0)??[],n=fu(),{data:s,error:a}=Ig(e??""),i=kE(e??"",void 0,r[0]??null),l=kE(e??"",void 0,r[1]??null),c=b.useMemo(()=>i.data??[],[i.data]),u=b.useMemo(()=>l.data??[],[l.data]),d=b.useMemo(()=>{const g=new Map;for(const y of[...c,...u])g.has(y.id)||g.set(y.id,{id:y.id,createdAt:new Date(y.createdAt)});return[...g.values()].sort((y,x)=>x.createdAt.getTime()-y.createdAt.getTime())},[c,u]),f=b.useMemo(()=>new Map(c.map(g=>[g.id,g])),[c]),h=b.useMemo(()=>new Map(u.map(g=>[g.id,g])),[u]);if(a&&Ps(a))return o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})});if(a&&ks(a))return o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})});if(!e||r.length<2)return o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),o.jsx(pf,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two versions to compare."})})})]});const p=(g,y,x)=>{n(`/datasets/${e}/items/${g}/versions?ids=${y?.datasetVersion??""},${x?.datasetVersion??""}`)},m=(g,y)=>{n(`/datasets/${e}/versions?ids=${g},${y}`,{replace:!0})};return o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(ja,{})}),"Datasets"]}),o.jsx(jr,{as:dr,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),o.jsxs(jr,{isCurrent:!0,as:"span",children:[o.jsx(Ce,{children:o.jsx(lSe,{})}),"Compare Versions"]})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsxs(Ir,{children:[o.jsxs(Ir.Column,{children:[o.jsxs(Ir.Title,{children:[o.jsx(lSe,{})," Compare Dataset Versions"]}),o.jsx(Ir.Description,{children:o.jsxs(fs,{children:[o.jsx(Qx,{})," Comparing ",r.length," versions of"," ",s?.name||e?.slice(0,8)]})})]}),o.jsx(Ir.Column,{children:o.jsxs(pe,{as:dr,to:`/datasets/${e}`,children:[o.jsx(_p,{}),"Back to Dataset"]})})]}),o.jsx(sf,{children:o.jsxs(mr,{children:[o.jsx(YTn,{datasetId:e,versionA:String(r[0]),versionB:String(r[1]),onVersionChange:m}),o.jsx(eNn,{datasetId:e,versionA:r[0],versionB:r[1],allItems:d,itemsAMap:f,itemsBMap:h,onItemClick:p})]})})]})})]})}function yNn(e){if(!e||e.length<2)return null;const t=[...e].sort((i,l)=>new Date(i.createdAt).getTime()-new Date(l.createdAt).getTime()),r=Math.floor(t.length/2),n=r,s=t.length-r;if(n===0)return null;const a=(s-n)/n*100;return{changePct:Math.round(a*10)/10,prevValue:String(n)}}function vNn({scorers:e,datasets:t,experiments:r,avgScore:n,prevAvgScore:s,totalNeedsReview:a,isLoadingScorers:i,isLoadingDatasets:l,isLoadingExperiments:c,isLoadingScores:u,isLoadingReview:d}){const f=e?Object.keys(e).length:void 0,h=t?.length,p=r?.length,m=n!=null&&s!=null&&s!==0?{changePct:Math.round((n-s)/s*100*10)/10,prevValue:String(s)}:null,g=yNn(r);return o.jsxs(o.Fragment,{children:[o.jsxs(On,{children:[o.jsx(On.Label,{children:"Total Scorers"}),i?o.jsx(On.Loading,{}):f!=null?o.jsxs(o.Fragment,{children:[o.jsx(On.Value,{children:String(f)}),o.jsx(On.NoChange,{message:"Static count"})]}):o.jsx(On.NoData,{})]}),o.jsxs(On,{children:[o.jsx(On.Label,{children:"Total Datasets"}),l?o.jsx(On.Loading,{}):h!=null?o.jsxs(o.Fragment,{children:[o.jsx(On.Value,{children:String(h)}),o.jsx(On.NoChange,{message:"Static count"})]}):o.jsx(On.NoData,{})]}),o.jsxs(On,{children:[o.jsx(On.Label,{children:"Avg Score"}),u?o.jsx(On.Loading,{}):n!=null?o.jsxs(o.Fragment,{children:[o.jsx(On.Value,{children:String(n)}),m?o.jsx(On.Change,{changePct:m.changePct,prevValue:m.prevValue}):o.jsx(On.NoChange,{})]}):o.jsx(On.NoData,{})]}),o.jsxs(On,{children:[o.jsx(On.Label,{children:"Total Experiments"}),c?o.jsx(On.Loading,{}):p!=null?o.jsxs(o.Fragment,{children:[o.jsx(On.Value,{children:String(p)}),g?o.jsx(On.Change,{changePct:g.changePct,prevValue:g.prevValue}):o.jsx(On.NoChange,{})]}):o.jsx(On.NoData,{})]}),o.jsxs(On,{children:[o.jsx(On.Label,{children:"Needs Review"}),d?o.jsx(On.Loading,{}):a!=null?o.jsxs(o.Fragment,{children:[o.jsx(On.Value,{children:String(a)}),a>0?o.jsx(On.NoChange,{message:"items pending review"}):o.jsx(On.NoChange,{message:"All caught up"})]}):o.jsx(On.NoData,{})]})]})}const bNn=[{value:"all",label:"All statuses"},{value:"completed",label:"Completed"},{value:"running",label:"Running"},{value:"failed",label:"Failed"},{value:"pending",label:"Pending"}],zBe="auto 1fr auto auto auto auto auto auto auto";function xNn(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}const wNn={completed:"success",running:"warning",failed:"error",pending:"neutral"};function SNn({experiments:e,datasets:t,reviewByExperiment:r,isLoading:n,search:s="",statusFilter:a="all",datasetFilter:i="all"}){const{paths:l,Link:c}=ir(),u=b.useMemo(()=>{const h=new Map;return t?.forEach(p=>h.set(p.id,p.name)),h},[t]),d=b.useMemo(()=>[...e].sort((h,p)=>{const m=h.createdAt?new Date(h.createdAt).getTime():0;return(p.createdAt?new Date(p.createdAt).getTime():0)-m}),[e]),f=b.useMemo(()=>{const h=s.toLowerCase();return d.filter(p=>{const m=p.datasetId?u.get(p.datasetId)??"":"",g=!h||p.id.toLowerCase().includes(h)||m.toLowerCase().includes(h)||(p.targetId??"").toLowerCase().includes(h),y=a==="all"||p.status===a,x=i==="all"||p.datasetId===i;return g&&y&&x})},[d,s,u,a,i]);return n?o.jsx(bh,{columns:zBe}):o.jsxs(we,{columns:zBe,children:[o.jsxs(we.Top,{children:[o.jsx(we.TopCell,{children:"Experiment"}),o.jsx(we.TopCell,{children:"Dataset"}),o.jsx(we.TopCell,{children:"Target"}),o.jsx(we.TopCell,{children:"Status"}),o.jsx(we.TopCell,{className:"text-center",children:"Items"}),o.jsx(we.TopCell,{className:"text-center",children:"Succeeded"}),o.jsx(we.TopCell,{className:"text-center",children:"Failed"}),o.jsx(we.TopCell,{className:"text-center",children:"Review"}),o.jsx(we.TopCell,{children:"Date"})]}),f.map(h=>{const p=h.datasetId?u.get(h.datasetId)??h.datasetId.slice(0,8):"—",m=h.status??"pending",g=h.succeededCount??0,y=h.failedCount??0,x=h.totalItems??0,w=x>0?Math.round(g/x*100):0;return o.jsxs(we.RowLink,{to:l.experimentLink(h.id),LinkComponent:c,children:[o.jsx(we.NameCell,{className:"font-mono",children:h.id.slice(0,8)}),o.jsx(we.TextCell,{children:p}),o.jsx(we.Cell,{children:o.jsxs("span",{className:"truncate",children:[h.targetType," ",h.targetId]})}),o.jsx(we.Cell,{children:o.jsx(MP,{variant:wNn[m]??"neutral",withDot:!0,children:m})}),o.jsx(we.TextCell,{className:"text-center",children:x}),o.jsx(we.TextCell,{className:"text-center",children:o.jsxs("span",{className:g>0?"text-accent1":"",children:[g," (",w,"%)"]})}),o.jsx(we.TextCell,{className:"text-center",children:o.jsx("span",{className:y>0?"text-accent2":"",children:y})}),o.jsx(we.Cell,{className:"text-center",children:(()=>{const S=r?.get(h.id);if(!S)return o.jsx("span",{className:"text-neutral2",children:"—"});const k=S.needsReview+S.complete;return k===0?o.jsx("span",{className:"text-neutral2",children:"—"}):S.needsReview>0?o.jsxs(gt,{variant:"warning",children:[S.needsReview," pending"]}):o.jsxs(gt,{variant:"success",children:[S.complete,"/",k," reviewed"]})})()}),o.jsx(we.TextCell,{children:xNn(h.createdAt)})]},h.id)})]})}function ONn(e){return[{value:"all",label:"All datasets"},...(e??[]).map(t=>({value:t.id,label:t.name}))]}const LL={completed:"#22c55e",running:"#facc15",pending:"#fb923c",failed:"#f87171"},kNn=[{label:"Completed",color:LL.completed},{label:"Running",color:LL.running},{label:"Pending",color:LL.pending},{label:"Failed",color:LL.failed}];function _Nn({experiments:e,datasets:t,isLoading:r,isError:n}){const{data:s,maxVal:a}=b.useMemo(()=>{if(!e||e.length===0)return{data:[],maxVal:0};const l=new Map;if(t)for(const f of t)l.set(f.id,f.name);const c=new Map;for(const f of e){const h=f.datasetId??"unknown";c.has(h)||c.set(h,{completed:0,running:0,pending:0,failed:0});const p=c.get(h),m=f.status;m in p&&p[m]++}let u=0;return{data:Array.from(c.entries()).map(([f,h])=>{const p=h.completed+h.running+h.pending+h.failed;return p>u&&(u=p),{name:l.get(f)??f.slice(0,12),values:[h.completed,h.running,h.pending,h.failed]}}),maxVal:u}},[e,t]),i=s.length>0;return o.jsxs(Ht,{children:[o.jsxs(Ht.TopBar,{children:[o.jsx(Ht.TitleAndDescription,{title:"Experiments by Dataset",description:"Experiment status breakdown per dataset."}),i&&o.jsx(Ht.Summary,{value:String(e?.length??0),label:"Total experiments"})]}),r?o.jsx(Ht.Loading,{}):n?o.jsx(Ht.Error,{message:"Failed to load experiments data"}):o.jsx(Ht.Content,{children:i?o.jsx(J_,{data:s,segments:kNn,maxVal:a,fmt:l=>String(l)}):o.jsx(Ht.NoData,{message:"No experiments have been run yet"})})]})}const ENn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(xf,{}),titleSlot:"No Experiments yet",descriptionSlot:o.jsxs(o.Fragment,{children:["Run an experiment from a dataset to evaluate ",o.jsx("br",{}),"your agents and workflows."]}),actionSlot:o.jsx("div",{className:"flex flex-col items-center gap-2",children:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/evals/datasets/running-experiments",target:"_blank",rel:"noopener noreferrer",children:["Experiments Documentation ",o.jsx(ya,{})]})})})});function CNn({search:e,onSearchChange:t,statusFilter:r,onStatusFilterChange:n,datasetFilter:s,onDatasetFilterChange:a,datasetOptions:i,onReset:l,hasActiveFilters:c}){return o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(_g,{label:"Search experiments",placeholder:"Filter by experiment, dataset, or target",value:e,onSearch:t}),o.jsxs(ps,{children:[o.jsx($o,{label:"Status",labelIsHidden:!0,name:"filter-status",options:[...bNn],value:r,onValueChange:n,className:"whitespace-nowrap"}),o.jsx($o,{label:"Dataset",labelIsHidden:!0,name:"filter-dataset",options:i,value:s,onValueChange:a,className:"whitespace-nowrap"}),l&&c&&o.jsxs(pe,{onClick:l,size:"sm",variant:"light",children:[o.jsx(Nn,{className:"size-3"})," Reset"]})]})]})}function jNn(){const{data:e,isLoading:t,error:r}=fd(),{data:n,isLoading:s,error:a}=zh(),{data:i,isLoading:l,error:c}=K8(),{data:u,isLoading:d,isError:f,error:h}=P1n(),{data:p,isLoading:m,isError:g,error:y}=Tve(),x=n?.datasets,w=i?.experiments,S=b.useMemo(()=>sNn(p),[p]),k=r||a||c||h||y;return k&&Ps(k)?o.jsx(Jr,{title:"Evaluation",icon:o.jsx(Au,{}),children:o.jsx(na,{})}):k&&ks(k)?o.jsx(Jr,{title:"Evaluation",icon:o.jsx(Au,{}),children:o.jsx(Gs,{resource:"evaluation"})}):k?o.jsx(Jr,{title:"Evaluation",icon:o.jsx(Au,{}),children:o.jsx(gu,{title:"Failed to load evaluation data",message:k.message})}):o.jsxs(bt,{width:"wide",height:"full",children:[o.jsx(bt.TopArea,{className:"sticky top-0 z-100 bg-surface1 ",children:o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{children:[o.jsx(Au,{})," Evaluation"]})})}),o.jsx(bt.Column,{className:"flex justify-end gap-2",children:o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Evaluation documentation",children:o.jsx(Di,{})})})]})}),o.jsxs("div",{className:"flex flex-col gap-6 pt-4",children:[o.jsx(die,{children:o.jsx(vNn,{scorers:e,datasets:x,experiments:w,avgScore:u?.avgScore??null,prevAvgScore:u?.prevAvgScore??null,totalNeedsReview:S.needsReview,isLoadingScorers:t,isLoadingDatasets:s,isLoadingExperiments:l,isLoadingScores:d,isLoadingReview:m})}),o.jsx(O1n,{summaryData:u?.summaryData??[],overTimeData:u?.overTimeData??[],scorerNames:u?.scorerNames??[],avgScore:u?.avgScore??null,isLoading:d,isError:f}),o.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[o.jsx(Cjn,{experiments:w,isLoading:l,isError:!!c}),o.jsx(_Nn,{experiments:w,datasets:x,isLoading:l,isError:!!c})]}),o.jsx(rNn,{reviewSummary:p,experiments:w,datasets:x,isLoading:m,isError:!!g})]})]})}function TNn(){const[e,t]=b.useState(""),[r,n]=b.useState("all"),[s,a]=b.useState("all"),{data:i,isLoading:l,error:c}=zh(),{data:u,isLoading:d,error:f}=K8(),{data:h}=Tve(),p=b.useMemo(()=>i?.datasets??[],[i?.datasets]),m=b.useMemo(()=>u?.experiments??[],[u?.experiments]),g=b.useMemo(()=>ONn(p),[p]),y=b.useMemo(()=>R1t(h),[h]),x=l||d,w=f||c;if(w&&Ps(w))return o.jsx(Jr,{title:"Experiments",icon:o.jsx(Au,{}),children:o.jsx(na,{})});if(f&&ks(f))return o.jsx(Jr,{title:"Experiments",icon:o.jsx(Au,{}),children:o.jsx(Gs,{resource:"experiments"})});if(c&&ks(c))return o.jsx(Jr,{title:"Experiments",icon:o.jsx(Au,{}),children:o.jsx(Gs,{resource:"datasets"})});if(w)return o.jsx(Jr,{title:"Experiments",icon:o.jsx(Au,{}),children:o.jsx(gu,{title:"Failed to load experiments",message:w.message})});if(m.length===0&&!x)return o.jsx(Jr,{title:"Experiments",icon:o.jsx(Au,{}),children:o.jsx(ENn,{})});const S=r!=="all"||s!=="all"||e!=="",k=()=>{t(""),n("all"),a("all")};return o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:x,children:[o.jsx(Au,{})," Experiments"]})})}),o.jsx(bt.Column,{className:"flex justify-end gap-2",children:o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/evals/datasets/running-experiments",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Experiments documentation",children:o.jsx(Di,{})})})]}),o.jsx(CNn,{search:e,onSearchChange:t,statusFilter:r,onStatusFilterChange:n,datasetFilter:s,onDatasetFilterChange:a,datasetOptions:g,onReset:k,hasActiveFilters:S})]}),o.jsx(SNn,{experiments:m,datasets:p,reviewByExperiment:y,isLoading:x,search:e,statusFilter:r,datasetFilter:s})]})}function NNn(){const{experimentId:e}=ra(),{data:t,isLoading:r}=K8(),s=t?.experiments?.find(p=>p.id===e)?.datasetId??"",{data:a,isLoading:i,error:l}=V6(s,e??""),{data:c,isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h}=X8({datasetId:s,experimentId:e??"",experimentStatus:a?.status});return e?r||i||!s?o.jsx(zr,{children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(Mt,{})})}):l&&Ps(l)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):l&&ks(l)?o.jsx(zr,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"datasets"})})}):l||!a?o.jsx(zr,{children:o.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",l instanceof Error?l.message:"Unknown error"]})}):o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/experiments",children:[o.jsx(Ce,{children:o.jsx(Au,{})}),"Experiments"]}),o.jsx(jr,{isCurrent:!0,as:"span",children:"Experiment"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsx(I1t,{experimentId:e,experiment:a}),o.jsx(A1t,{experimentId:e,experimentStatus:a?.status,results:c??[],isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h})]})})]}):null}function P1t({redirectUri:e,onSuccess:t,initialMode:r="signin",errorMessage:n}){const{data:s,isLoading:a}=SC(),{mutate:i,isPending:l,error:c}=DCn(),{mutate:u,isPending:d,error:f}=LCn(),{mutate:h,isPending:p}=w1t(),[m,g]=b.useState(r),[y,x]=b.useState(""),[w,S]=b.useState(""),[k,_]=b.useState("");if(a)return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:o.jsx("div",{className:"text-neutral3",children:"Loading..."})});if(!s?.enabled||!s?.login)return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:o.jsx("div",{className:"text-neutral3",children:"Authentication is not configured"})});const{login:E}=s,T=E.type==="sso"||E.type==="both",j=E.type==="credentials"||E.type==="both",N=E.sso,I=E.signUpEnabled!==!1,P=m==="signin"||!I,R=P?l:d,$=P?c:f,M=()=>{t?t():e?window.location.href=e:window.location.href="/"},z=H=>{H.preventDefault(),P?i({email:w,password:k},{onSuccess:M}):u({email:w,password:k,name:y||void 0},{onSuccess:M})},U=()=>{h({redirectUri:e},{onSuccess:H=>{window.location.href=H.url}})},B=()=>{g(P?"signup":"signin")};return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:o.jsxs("div",{className:"w-full max-w-sm space-y-6 rounded-lg border border-border1 bg-surface2 p-8",children:[o.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[o.jsx(tx,{className:"h-10 w-10"}),o.jsx("h1",{className:"text-xl font-semibold text-neutral6",children:P?"Sign in to Mastra Studio":"Create your account"})]}),n&&o.jsx("div",{className:"rounded-md bg-red-500/10 p-3 text-sm text-red-400",children:n}),j&&o.jsxs("form",{onSubmit:z,className:"space-y-4",children:[!P&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{htmlFor:"name",className:"block text-sm text-neutral4",children:"Name"}),o.jsx(sr,{id:"name",type:"text",value:y,onChange:H=>x(H.target.value),placeholder:"Your name",variant:"default",size:"lg"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{htmlFor:"email",className:"block text-sm text-neutral4",children:"Email"}),o.jsx(sr,{id:"email",type:"email",value:w,onChange:H=>S(H.target.value),placeholder:"you@example.com",required:!0,variant:"default",size:"lg"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{htmlFor:"password",className:"block text-sm text-neutral4",children:"Password"}),o.jsx(sr,{id:"password",type:"password",value:k,onChange:H=>_(H.target.value),placeholder:P?"Enter your password":"Create a password",required:!0,variant:"default",size:"lg"})]}),$&&o.jsx("div",{className:"rounded-md bg-red-500/10 p-3 text-sm text-red-400",children:$.message}),o.jsx(pe,{type:"submit",disabled:R,className:"w-full",size:"lg",children:R?P?"Signing in...":"Creating account...":P?"Sign in":"Create account"}),I&&o.jsxs("div",{className:"text-center text-sm",children:[o.jsx("span",{className:"text-neutral3",children:P?"Don't have an account? ":"Already have an account? "}),o.jsx("button",{type:"button",onClick:B,className:"text-neutral6 hover:underline",children:P?"Sign up":"Sign in"})]})]}),T&&j&&o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("div",{className:"w-full border-t border-border1"})}),o.jsx("div",{className:"relative flex justify-center text-sm",children:o.jsx("span",{className:"bg-surface2 px-2 text-neutral3",children:"or continue with"})})]}),T&&N&&o.jsxs(pe,{onClick:U,disabled:p,className:"w-full",size:"lg",variant:"outline",children:[N.icon&&o.jsx("span",{className:"mr-2",children:N.icon}),p?"Redirecting...":N.text||"Sign in"]})]})})}function ANn(){const[e]=so(),t=fu(),r=e.get("redirect")||"/",s=e.get("mode")==="signup"?"signup":"signin",a=e.get("error_description")||e.get("error")||null,i=()=>{r.startsWith("http")?window.location.href=r:t(r,{replace:!0})};return o.jsx(P1t,{redirectUri:r,onSuccess:i,initialMode:s,errorMessage:a})}function INn(){const[e,t]=so(),r=JFr(e,t),n=rzr(e,t),[s,a]=b.useState(),[i,l]=b.useState(!1),{data:c=[],isPending:u}=hht(),{data:d=[],isPending:f}=pht({entityType:r.selectedEntityOption?.entityType,rootOnly:!0}),{data:h=[],isPending:p}=mht(),{data:m=[],isPending:g}=ght(),y=b.useMemo(()=>QFr({availableTags:c,availableRootEntityNames:d,availableServiceNames:m,availableEnvironments:h,loading:{tags:u,entityNames:f,serviceNames:g,environments:p}}),[c,d,m,h,u,f,g,p]),x=b.useMemo(()=>YFr({rootEntityType:r.selectedEntityOption?.entityType,dateFrom:r.selectedDateFrom,dateTo:r.selectedDateTo,tokens:r.filterTokens}),[r.filterTokens,r.selectedDateFrom,r.selectedDateTo,r.selectedEntityOption]),{data:w=[],isLoading:S,error:k,isFetchingNextPage:_,hasNextPage:E,setEndOfListElement:T}=zFr({filters:x}),{logIdMap:j,featuredLog:N,handleLogClick:I,handlePreviousLog:P,handleNextLog:R}=azr(w,r.featuredLogId,r.handleFeaturedChange,r.featuredTraceId),{data:$,isLoading:M}=Ame(r.featuredTraceId??null),{data:z,isLoading:U}=FS(r.featuredTraceId??"",r.featuredSpanId??""),B=b.useCallback(()=>r.applyFilterTokens(XFr(y,r.filterTokens)),[y,r]),H=b.useCallback(()=>r.handleFeaturedChange({logId:null}),[r]),W=b.useCallback(G=>r.handleFeaturedChange({traceId:G,spanId:null}),[r]),L=b.useCallback((G,J)=>r.handleFeaturedChange({traceId:G,spanId:J}),[r]),Y=b.useCallback(()=>{r.handleFeaturedChange({traceId:null,spanId:null}),l(!1)},[r]),q=b.useCallback(()=>r.handleFeaturedChange({spanId:null}),[r]),D=b.useCallback(G=>r.handleFeaturedChange({spanId:G??null}),[r]);if(k)return o.jsx(Jr,{title:"Logs",icon:o.jsx(HL,{}),children:o.jsx(AFr,{error:k,resource:"logs",errorTitle:"Failed to load logs"})});const Q=r.filterTokens.length>0||r.datePreset!=="last-24h"||!!r.selectedDateTo;return w.length===0&&!S&&!Q?o.jsx(Jr,{title:"Logs",icon:o.jsx(HL,{}),children:o.jsx(DFr,{})}):o.jsxs(bt,{width:"wide",height:"full",children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:S,children:[o.jsx(HL,{})," Logs"]})})}),o.jsxs(bt.Column,{className:"flex justify-end items-center gap-2",children:[o.jsx(Wft,{preset:r.datePreset,onPresetChange:r.handleDatePresetChange,dateFrom:r.selectedDateFrom,dateTo:r.selectedDateTo,onDateChange:r.handleDateChange,disabled:S,presets:["last-24h","last-3d","last-7d","last-14d","last-30d","custom"]}),o.jsx(Xdt,{fields:y,tokens:r.filterTokens,onTokensChange:r.handleFilterTokensChange,disabled:S,onStartTextFilter:a}),o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/observability/logs/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Logs documentation",tooltipContent:"Go to Logs documentation",children:o.jsx(Di,{})})]})]}),o.jsx(PFr,{isLoading:S,filterFields:y,filterTokens:r.filterTokens,onFilterTokensChange:r.handleFilterTokensChange,onClear:B,onRemoveAll:r.handleRemoveAll,onSave:n.handleSave,onRemoveSaved:n.hasSavedFilters?n.handleRemoveSaved:void 0,autoFocusFilterFieldId:s})]}),o.jsx(IFr,{logCollapsed:i,listSlot:o.jsx(RFr,{logs:w,isLoading:S,isFetchingNextPage:_,hasNextPage:E,setEndOfListElement:T,logIdMap:j,featuredLogId:r.featuredLogId,onLogClick:I}),logPanelSlot:N?o.jsx(NFr,{log:N,onClose:H,onTraceClick:W,onSpanClick:L,onPrevious:P,onNext:R,collapsed:i,onCollapsedChange:l}):null,tracePanelSlot:r.featuredTraceId?o.jsx(eFr,{traceId:r.featuredTraceId,spans:$?.spans,isLoading:M,onClose:Y,onSpanSelect:D,selectedSpanId:r.featuredSpanId}):null,spanPanelSlot:r.featuredTraceId&&r.featuredSpanId?o.jsx(J6r,{spanId:r.featuredSpanId,span:z?.span,isLoading:U,onClose:q}):null})]})}const M1t=e=>{const t=Ge();return kt({queryKey:["mcpserver-tools",e?.id],queryFn:async()=>{const n=(await t.getMcpServerTools(e?.id)).tools,s={};return n.forEach(a=>{s[a.id]=a}),s},retry:!1,refetchOnWindowFocus:!1})};function RNn({server:e}){const{paths:t,Link:r}=ir(),s=Ge().options.baseUrl,a=s?`${s}/api/mcp/${e.id}/sse`:"",{data:i}=M1t(e),l=Object.values(i||{}),c=l.length,u=l.filter(h=>h.toolType==="agent").length,d=l.filter(h=>h.toolType==="workflow").length,f=Nh(e.name,50);return o.jsxs(we.RowLink,{to:t.mcpServerLink(e.id),LinkComponent:r,children:[o.jsx(we.NameCell,{children:f}),o.jsx(we.DescriptionCell,{children:a}),o.jsx(we.TextCell,{className:"text-center",children:u||""}),o.jsx(we.TextCell,{className:"text-center",children:c||""}),o.jsx(we.TextCell,{className:"text-center",children:d||""})]})}function PNn({mcpServers:e,isLoading:t,search:r=""}){const n=b.useMemo(()=>{const s=r.toLowerCase();return e.filter(a=>a.name?.toLowerCase().includes(s)||a.id?.toLowerCase().includes(s))},[e,r]);return t?o.jsx(bh,{columns:"auto 1fr auto auto auto"}):o.jsxs(we,{columns:"auto 1fr auto auto auto",children:[o.jsxs(we.Top,{children:[o.jsx(we.TopCell,{children:"Name"}),o.jsx(we.TopCell,{children:"URL"}),o.jsx(we.TopCellSmart,{long:"Agents",short:o.jsx(pa,{}),tooltip:"Agent Tools",className:"text-center"}),o.jsx(we.TopCellSmart,{long:"Tools",short:o.jsx(Pi,{}),tooltip:"Tools",className:"text-center"}),o.jsx(we.TopCellSmart,{long:"Workflows",short:o.jsx(Mi,{}),tooltip:"Workflow Tools",className:"text-center"})]}),n.length===0&&r?o.jsx(we.NoMatch,{message:"No MCP Servers match your search"}):null,n.map(s=>o.jsx(RNn,{server:s},s.id))]})}const MNn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(xf,{}),titleSlot:"No MCP Servers yet",descriptionSlot:o.jsxs(o.Fragment,{children:["MCP servers are not configured yet. ",o.jsx("br",{}),"More information in the documentation."]}),actionSlot:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",children:["MCP Documentation ",o.jsx(ya,{})]})})}),DNn=()=>{const{data:e=[],isLoading:t,error:r}=cM(),[n,s]=b.useState("");return r&&Ps(r)?o.jsx(Jr,{title:"MCP Servers",icon:o.jsx(vl,{}),children:o.jsx(na,{})}):r&&ks(r)?o.jsx(Jr,{title:"MCP Servers",icon:o.jsx(vl,{}),children:o.jsx(Gs,{resource:"MCP servers"})}):r?o.jsx(Jr,{title:"MCP Servers",icon:o.jsx(vl,{}),children:o.jsx(gu,{title:"Failed to load MCP servers",message:r.message})}):e.length===0&&!t?o.jsx(Jr,{title:"MCP Servers",icon:o.jsx(vl,{}),children:o.jsx(MNn,{})}):o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:t,children:[o.jsx(vl,{})," MCP Servers"]})})}),o.jsx(bt.Column,{className:"flex justify-end gap-2",children:o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to MCP documentation",children:o.jsx(Di,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(_g,{onSearch:s,label:"Filter MCP servers",placeholder:"Filter by name"})})]}),o.jsx(PNn,{mcpServers:e,isLoading:t,search:n})]})},LNn=(e,t)=>{const r=new Map,n=Object.keys(t);for(const s of n){const a=t[s],i=a.tools,l=Object.keys(i);for(const c of l){const u=i[c];r.has(u.id)||r.set(u.id,{...u,agents:[]}),r.get(u.id).agents.push({...a,id:s})}}for(const[s,a]of Object.entries(e))r.has(a.id)||r.set(a.id,{...a,agents:[]});return Array.from(r.values())};function $Nn({tools:e,agents:t,isLoading:r,search:n=""}){const{paths:s,Link:a}=ir(),i=b.useMemo(()=>LNn(e,t),[e,t]),l=b.useMemo(()=>i.filter(c=>c.id.toLowerCase().includes(n.toLowerCase())),[i,n]);return r?o.jsx(bh,{columns:"auto 1fr auto"}):o.jsxs(we,{columns:"auto 1fr auto",children:[o.jsxs(we.Top,{children:[o.jsx(we.TopCell,{children:"Name"}),o.jsx(we.TopCell,{children:"Description"}),o.jsx(we.TopCellSmart,{long:"Agents",short:o.jsx(pa,{}),tooltip:"Attached Agents",className:"text-center"})]}),l.length===0&&n?o.jsx(we.NoMatch,{message:"No Tools match your search"}):null,l.map(c=>{const u=Nh(c.id,50),d=Nh(c.description??"",200),f=c.agents.length;return o.jsxs(we.RowLink,{to:s.toolLink(c.id),LinkComponent:a,children:[o.jsx(we.NameCell,{children:u}),o.jsx(we.DescriptionCell,{children:d}),o.jsx(we.TextCell,{className:"text-center",children:f||""})]},c.id)})]})}const FNn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(xf,{}),titleSlot:"No Tools yet",descriptionSlot:o.jsxs(o.Fragment,{children:["Mastra tools are not configured yet. ",o.jsx("br",{}),"More information in the documentation."]}),actionSlot:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",children:["Tools Documentation ",o.jsx(ya,{})]})})}),zNn=()=>{const e=Ge();return Kr({mutationFn:async({toolId:t,input:r,requestContext:n})=>{const s=new m_;Object.entries(n??{}).forEach(([a,i])=>{s.set(a,i)});try{return await e.getTool(t).execute({data:r,requestContext:s})}catch(a){throw ze.error("Error executing dev tool"),console.error("Error executing dev tool:",a),a}}})},BNn=({toolId:e})=>{const{canExecute:t}=Ev(),r=t("tools"),{data:n={}}=Tg(),s=b.useMemo(()=>{for(const g of Object.values(n))if(g.tools){const y=Object.values(g.tools).find(x=>x.id===e);if(y)return y}return null},[n,e]),{data:a,isLoading:i,error:l}=akn(e,{enabled:!s}),c=s||a,{mutateAsync:u,isPending:d,data:f}=zNn(),{requestContext:h}=Qn();b.useEffect(()=>{if(l){const g=l instanceof Error?l.message:"Failed to load tool";ze.error(`Error loading tool: ${g}`)}},[l]);const p=async(g,y)=>{if(!c)return;const x={...h??{},...y??{}};return u({toolId:c.id,input:g,requestContext:x})},m=c?.inputSchema?fg(cg(rv(c?.inputSchema))):Zn({});return i?o.jsxs("div",{className:"p-6",children:[o.jsx(Mn,{className:"h-8 w-48 mb-4"}),o.jsx(Mn,{className:"h-32 w-full"})]}):l?null:c?r?o.jsx(mve,{executionResult:f,isExecutingTool:d,zodInputSchema:m,handleExecuteTool:p,toolDescription:c.description,toolId:c.id,requestContextSchema:c.requestContextSchema}):o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"You don't have permission to execute tools."})}):o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Tool not found"})})};function UNn({value:e,onValueChange:t,placeholder:r="Select a tool...",searchPlaceholder:n="Search tools...",emptyText:s="No tools found.",className:a,disabled:i=!1,variant:l="inputLike"}){const{data:c={},isLoading:u,isError:d,error:f}=Z8(),{data:h={},isLoading:p,isError:m,error:g}=Tg(),{navigate:y,paths:x}=ir();b.useEffect(()=>{if(d){const _=f instanceof Error?f.message:"Failed to load tools";ze.error(`Error loading tools: ${_}`)}},[d,f]),b.useEffect(()=>{if(m){const _=g instanceof Error?g.message:"Failed to load agents";ze.error(`Error loading agents: ${_}`)}},[m,g]);const w=new Map;Object.values(h).forEach(_=>{_.tools&&Object.values(_.tools).forEach(E=>{w.has(E.id)||w.set(E.id,E)})}),Object.values(c).forEach(_=>{w.has(_.id)||w.set(_.id,_)});const S=Array.from(w.values()).map(_=>({label:_.id,value:_.id})),k=_=>{t?t(_):_&&_!==e&&y(x.toolLink(_))};return o.jsx(Kl,{options:S,value:e,onValueChange:k,placeholder:u||p?"Loading tools...":r,searchPlaceholder:n,emptyText:s,className:a,disabled:i||u||p||d||m,variant:l})}const VNn=({isLoading:e,server:t})=>{const[{sseUrl:r,httpStreamUrl:n},s]=b.useState({sseUrl:"",httpStreamUrl:""});if(b.useEffect(()=>{if(!t)return;const i=window.MASTRA_SERVER_HOST,l=window.MASTRA_SERVER_PORT;let c=null;i&&l&&(c=`http://${i}:${l}`);const u=c||"http://localhost:4111",d=`${u}/api/mcp/${t.id}/sse`,f=`${u}/api/mcp/${t.id}/mcp`;s({sseUrl:d,httpStreamUrl:f})},[t]),e)return null;if(!t)return o.jsx(pf,{children:o.jsx(me,{as:"h1",variant:"header-md",className:"text-neutral3 font-medium py-20 text-center",children:"Server not found"})});const a=`npx -y mcp-remote ${r}`;return o.jsxs(pf,{isDivided:!0,children:[o.jsxs("div",{className:"px-8 py-12 mx-auto max-w-2xl w-full",children:[o.jsx(me,{as:"h1",variant:"header-md",className:"text-neutral6 font-medium pb-4",children:t.name}),o.jsxs("div",{className:"flex items-center gap-1 pb-6",children:[o.jsx(gt,{icon:o.jsx(D9,{className:"text-neutral6"}),className:"rounded-r-sm text-neutral4!",children:"Version"}),o.jsx(gt,{className:"rounded-l-sm text-neutral4!",children:t.version_detail.version})]}),o.jsx(me,{className:"text-neutral3 pb-4",children:"This MCP server can be accessed through multiple transport methods. Choose the one that best fits your use case."}),o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[o.jsx(gt,{icon:o.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"HTTP"}),children:"Regular HTTP Endpoint"}),o.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for stateless HTTP transport with streamable responses."}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:n}),o.jsx("div",{className:"pt-1",children:o.jsx(Xa,{tooltip:"Copy HTTP Stream URL",content:n})})]})]}),o.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[o.jsx(gt,{icon:o.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"SSE"}),children:"Server-Sent Events"}),o.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for real-time communication via SSE."}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:r}),o.jsx("div",{className:"pt-1",children:o.jsx(Xa,{tooltip:"Copy SSE URL",content:r})})]})]}),o.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[o.jsx(gt,{icon:o.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"CLI"}),children:"Command Line"}),o.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for local command-line access via npx and mcp-remote."}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:a}),o.jsx("div",{className:"pt-1",children:o.jsx(Xa,{tooltip:"Copy Command Line Config",content:a})})]})]})]})]}),o.jsx("div",{className:"h-full overflow-y-scroll border-l border-border1",children:o.jsx(qNn,{server:t})})]})},qNn=({server:e})=>{const{data:t={},isLoading:r}=M1t(e);if(r)return null;const n=Object.keys(t);return o.jsxs("div",{className:"p-5 overflow-y-scroll",children:[o.jsxs("div",{className:"text-neutral6 flex gap-2 items-center",children:[o.jsx(Ce,{size:"lg",className:"bg-surface4 rounded-md p-1",children:o.jsx(vl,{})}),o.jsx(me,{variant:"header-md",as:"h2",className:"font-medium",children:"Available Tools"})]}),o.jsx("div",{className:"flex flex-col gap-2 pt-6",children:n.map(s=>{const a=t[s];return o.jsx(HNn,{tool:a,serverId:e.id},s)})})]})},HNn=({tool:e,serverId:t})=>{const r=b.useRef(null),{Link:n,paths:s}=ir(),a=OSt[e.toolType||"tool"];return o.jsxs(kf,{onClick:()=>r.current?.click(),children:[o.jsx(hdt,{children:o.jsx(a,{className:"group-hover/entity:text-accent6"})}),o.jsxs(Cf,{children:[o.jsx(_f,{children:o.jsx(n,{ref:r,href:s.mcpServerToolLink(t,e.id),children:e.id})}),o.jsx(Ef,{children:e.description})]})]})},QNn=()=>{const{serverId:e}=ra(),{data:t=[],isLoading:r}=cM(),n=t.find(s=>s.id===e);return o.jsxs(zr,{children:[o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/mcps",children:[o.jsx(Ce,{children:o.jsx(vl,{})}),"MCP Servers"]}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:o.jsx(zSt,{value:e,variant:"ghost"})})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(u0,{}),"MCP documentation"]})})]}),o.jsx(VNn,{isLoading:r,server:n})]})},D1t=(e,t)=>{const{requestContext:r}=Qn(),n=Ge();return kt({queryKey:["mcp-server-tool",e,t],queryFn:()=>n.getMcpServerTool(e,t).details(r)})},WNn=(e,t)=>{const{requestContext:r}=Qn(),n=Ge();return Kr({mutationFn:s=>n.getMcpServerTool(e,t).execute({data:s,requestContext:r})})},GNn=({toolId:e,serverId:t})=>{const{canExecute:r}=Ev(),n=r("tools"),{data:s,isLoading:a,error:i}=D1t(t,e),{mutateAsync:l,isPending:c,data:u}=WNn(t,e);b.useEffect(()=>{if(i){const h=i instanceof Error?i.message:"Failed to load tool";ze.error(`Error loading tool: ${h}`)}},[i]);const d=async h=>{if(s)return await l(h)};if(a)return o.jsxs("div",{className:"p-6",children:[o.jsx(Mn,{className:"h-8 w-48 mb-4"}),o.jsx(Mn,{className:"h-32 w-full"})]});if(i)return null;if(!s)return o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Tool not found"})});if(!n)return o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"You don't have permission to execute tools."})});let f;try{f=fg(cg(s.inputSchema))}catch(h){console.error("Error processing input schema:",h),ze.error("Failed to process tool input schema."),f=Zn({})}return o.jsx(mve,{executionResult:u,isExecutingTool:c,zodInputSchema:f,handleExecuteTool:d,toolDescription:s.description||"",toolId:s.id})},ZNn=()=>{const{data:e}=cM(),{serverId:t,toolId:r}=ra(),{data:n,isLoading:s}=D1t(t,r),a=e?.find(c=>c.id===t),i=n?.name,l=a?.name||"";return s||!n?null:o.jsxs("div",{className:"h-full w-full bg-surface2 overflow-y-hidden",children:[o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/mcps",children:[o.jsx(Ce,{children:o.jsx(vl,{})}),"MCP Servers"]}),o.jsx(jr,{as:dr,to:`/mcps/${t}`,children:l}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:i})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(u0,{}),"MCP documentation"]})})]}),o.jsx(GNn,{toolId:r,serverId:t})]})};function YNn(){const{data:e,isLoading:t,isError:r}=P6r();return o.jsx(O6r,{data:e,isLoading:t,isError:r})}function XNn(){const{data:e,isLoading:t,isError:r}=aht();return o.jsx(Q9,{label:"Total Agent Runs",value:e?.value!=null?e.value.toLocaleString():null,prevValue:e?.previousValue!=null?e.previousValue.toLocaleString():void 0,changePct:e?.changePercent??null,isLoading:t,isError:r})}function KNn(){const{data:e,isLoading:t,isError:r}=A6r();return o.jsx(Q9,{label:"Total Model Cost",value:e?.cost!=null?Qw(e.cost,e.costUnit):null,prevValue:e?.previousCost!=null?Qw(e.previousCost,e.costUnit):void 0,changePct:e?.costChangePercent??null,isLoading:t,isError:r})}function JNn(){const{data:e,isLoading:t,isError:r}=I6r();return o.jsx(Q9,{label:"Total Tokens",value:e?.value!=null?Fm(e.value):null,prevValue:e?.previousValue!=null?Fm(e.previousValue):void 0,changePct:e?.changePercent??null,isLoading:t,isError:r})}function eAn(){const{data:e,isLoading:t,isError:r}=N6r();return o.jsx(Q9,{label:"Avg Score",value:e?.value!=null?String(e.value):null,prevValue:e?.previousValue!=null?String(e.previousValue):void 0,changePct:e?.changePercent??null,isLoading:t,isError:r})}function tAn(){const{data:e,isLoading:t,isError:r}=R6r();return o.jsx(k6r,{rows:e,isLoading:t,isError:r})}function rAn(){const{data:e,isLoading:t,isError:r}=D6r();return o.jsx(_6r,{data:e,isLoading:t,isError:r})}function nAn(){const{data:e,isLoading:t,isError:r}=L6r();return o.jsx(C6r,{data:e,isLoading:t,isError:r})}function sAn(){const{data:e,isLoading:t,isError:r}=M6r();return o.jsx(j6r,{data:e,isLoading:t,isError:r})}const aAn=new Set(["ObservabilityStorageClickhouseVNext","ObservabilityStorageDuckDB","ObservabilityInMemory"]),rre="period";function iAn(){const[e,t]=so(),r=e.get(rre),n=rht(r)?r:"24h",s=b.useCallback(a=>{t(i=>{const l=new URLSearchParams(i);return a==="24h"?l.delete(rre):l.set(rre,a),l},{replace:!0})},[t]);return o.jsx(x6r,{initialPreset:n,onPresetChange:s,children:o.jsx(oAn,{})})}function oAn(){const{error:e}=aht(),{data:t,isLoading:r}=U8(),n=t?.observabilityStorageType,s=n?aAn.has(n):!1,a=n==="ObservabilityInMemory";return e&&Ps(e)?o.jsx(Jr,{title:"Metrics",icon:o.jsx(ik,{}),children:o.jsx(na,{})}):e&&ks(e)?o.jsx(Jr,{title:"Metrics",icon:o.jsx(ik,{}),children:o.jsx(Gs,{resource:"metrics"})}):e?o.jsx(Jr,{title:"Metrics",icon:o.jsx(ik,{}),children:o.jsx(gu,{title:"Failed to load metrics",message:e.message})}):o.jsxs(bt,{width:"wide",height:"full",children:[o.jsx(bt.TopArea,{className:"sticky top-0 z-100 bg-surface1 ",children:o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{children:[o.jsx(ik,{})," Metrics"]})})}),o.jsxs(bt.Column,{className:"flex justify-end gap-2",children:[o.jsx(w6r,{}),o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/observability/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Metrics documentation",children:o.jsx(Di,{})})]})]})}),r?null:s?o.jsxs("div",{className:"grid gap-8 content-start pb-10",children:[a&&o.jsxs(Bl,{variant:"info",children:[o.jsx(Ul,{children:"Metrics are not persisted"}),o.jsx($u,{as:"p",children:"This project uses in-memory storage for observability. Metrics will be lost on every server restart. For persistent metrics, switch the observability storage to ClickHouse or DuckDB."})]}),o.jsxs(die,{children:[o.jsx(XNn,{}),o.jsx(KNn,{}),o.jsx(JNn,{}),o.jsx(eAn,{})]}),o.jsxs(die,{children:[o.jsx(tAn,{}),o.jsx(nAn,{}),o.jsx(rAn,{}),o.jsx(sAn,{}),o.jsx(YNn,{})]})]}):o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(xf,{}),titleSlot:"Metrics are not available with your current storage",descriptionSlot:"Metrics require ClickHouse, DuckDB, or in-memory storage for observability. Relational databases (PostgreSQL, LibSQL) do not support metrics collection. To enable metrics on an existing project, switch the observability storage in the Mastra configuration.",actionSlot:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/observability/metrics/overview",target:"_blank",rel:"noopener noreferrer",children:["Metrics Documentation ",o.jsx(ya,{})]})})})]})}const lAn=[{title:"Metrics",description:"View system performance metrics, request latencies, and throughput across your agents and workflows.",icon:ik,href:"/metrics"},{title:"Traces",description:"Explore distributed traces to debug and understand the execution flow of your AI operations.",icon:xo,href:"/observability"}];function cAn(){return o.jsxs(yk,{children:[o.jsx(yk.Top,{children:o.jsx(Ir,{withMargins:!1,children:o.jsx(Ir.Column,{children:o.jsxs(Ir.Title,{children:[o.jsx(xo,{})," Observability"]})})})}),o.jsx("div",{className:"px-6 pt-6 overflow-y-auto",children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:lAn.map(e=>o.jsxs(dr,{to:e.href,className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}const uAn=[{title:"Agents",description:"Create and manage AI agents with tools, memory, and custom instructions.",icon:pa,href:"/agents"},{title:"Prompts",description:"Design and version reusable prompt templates for your agents.",icon:Zi,href:"/prompts"},{title:"Workflows",description:"Build step-based execution flows with suspend, resume, and branching.",icon:Mi,href:"/workflows"},{title:"Processors",description:"Configure data processors for transforming and routing information.",icon:nS,href:"/processors"},{title:"MCP Servers",description:"Connect to Model Context Protocol servers for external tool access.",icon:vl,href:"/mcps"},{title:"Tools",description:"Browse and test the tools available to your agents and workflows.",icon:Pi,href:"/tools"},{title:"Workspaces",description:"Organize your projects and resources into isolated workspaces.",icon:oc,href:"/workspaces"},{title:"Request Context",description:"Inspect request-scoped context propagation for dynamic configuration.",icon:TE,href:"/request-context"}];function dAn(){return o.jsxs(bt,{width:"narrow",children:[o.jsx(bt.TopArea,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{children:[o.jsx(v2t,{})," Primitives"]})})}),o.jsx(bt.MainArea,{children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:uAn.map(e=>o.jsxs(dr,{to:e.href,className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function fAn(){const{paths:e}=ir(),{data:t,isLoading:r,error:n}=TSt(),{isCmsAvailable:s}=lM(),[a,i]=b.useState(""),l=t?.promptBlocks??[];return n&&Ps(n)?o.jsx(Jr,{title:"Prompts",icon:o.jsx(Zi,{}),children:o.jsx(na,{})}):n&&ks(n)?o.jsx(Jr,{title:"Prompts",icon:o.jsx(Zi,{}),children:o.jsx(Gs,{resource:"prompt blocks"})}):n?o.jsx(Jr,{title:"Prompts",icon:o.jsx(Zi,{}),children:o.jsx(gu,{title:"Failed to load prompt blocks",message:n.message})}):l.length===0&&!r?o.jsx(Jr,{title:"Prompts",icon:o.jsx(Zi,{}),children:o.jsx(ZOn,{})}):o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:r,children:[o.jsx(Zi,{})," Prompts"]})})}),o.jsxs(bt.Column,{className:"flex justify-end gap-2",children:[o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/agents/agent-instructions#prompt-blocks",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Prompts documentation",children:o.jsx(Di,{})}),s&&o.jsxs(pe,{as:dr,to:e.cmsPromptBlockCreateLink(),variant:"primary",children:[o.jsx(cs,{}),"Create Prompt"]})]})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(_g,{onSearch:i,label:"Filter prompts",placeholder:"Filter by name or description"})})]}),o.jsx(GOn,{promptBlocks:l,isLoading:r,search:a})]})}function hAn(){return o.jsxs(bt,{width:"narrow",children:[o.jsx(bt.TopArea,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{children:[o.jsx(TE,{})," Request Context"]})})}),o.jsx(bt.MainArea,{children:o.jsx(fSn,{children:o.jsx(oSt,{})})})]})}const pAn=[{title:"Mastra APIs",description:"Explore and test the available REST API endpoints with the interactive Swagger UI.",icon:RMt,href:"/swagger-ui",external:!1},{title:"Documentation",description:"Read the official Mastra documentation for guides, references, and tutorials.",icon:Di,href:"https://mastra.ai/en/docs",external:!0},{title:"Github",description:"Browse the source code, report issues, and contribute to the Mastra project.",icon:ya,href:"https://github.com/mastra-ai/mastra",external:!0},{title:"Community",description:"Join the Mastra Discord community for help, discussion, and collaboration.",icon:nce,href:"https://discord.gg/BTYqqHKUrf",external:!0},{title:"Share with your team",description:"Running Mastra Studio locally? Deploy to the cloud so your team can collaborate.",icon:uVe,href:"https://mastra.ai/cloud",external:!0},{title:"Talk to our Sales team",description:"Get a custom demo, discuss on-prem deployments, and how we can help you accelerate getting agents into production.",icon:CPt,href:"https://mastra.ai/contact?ref=studio",external:!0}];function mAn(){return o.jsxs(bt,{width:"narrow",children:[o.jsx(bt.TopArea,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{children:[o.jsx(Di,{})," Resources"]})})}),o.jsx(bt.MainArea,{children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:pAn.map(e=>o.jsxs("a",{href:e.href,...e.external?{target:"_blank",rel:"noreferrer"}:{},className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title}),e.external&&o.jsx(ya,{className:"h-3.5 w-3.5 text-icon3 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function gAn(){const{data:e={},isLoading:t,error:r}=fd(),[n,s]=b.useState(""),[a,i]=b.useState("all");if(r&&Ps(r))return o.jsx(Jr,{title:"Scorers",icon:o.jsx(Ma,{}),children:o.jsx(na,{})});if(r&&ks(r))return o.jsx(Jr,{title:"Scorers",icon:o.jsx(Ma,{}),children:o.jsx(Gs,{resource:"scorers"})});if(r)return o.jsx(Jr,{title:"Scorers",icon:o.jsx(Ma,{}),children:o.jsx(gu,{title:"Failed to load scorers",message:r.message})});if(Object.keys(e).length===0&&!t)return o.jsx(Jr,{title:"Scorers",icon:o.jsx(Ma,{}),children:o.jsx(_1n,{})});const l=a!=="all"||n!=="",c=()=>{s(""),i("all")};return o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:t,children:[o.jsx(Ma,{})," Scorers"]})})}),o.jsx(bt.Column,{className:"flex justify-end gap-2",children:o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Scorers documentation",children:o.jsx(Di,{})})})]}),o.jsx(C1n,{search:n,onSearchChange:s,sourceFilter:a,onSourceFilterChange:i,onReset:c,hasActiveFilters:l})]}),o.jsx(k1n,{scorers:e,isLoading:t,search:n,sourceFilter:a})]})}function yAn(){const{scorerId:e}=ra(),[t,r]=so(),n=t.get("scoreId")??void 0,[s,a]=b.useState(n),[i,l]=b.useState({value:"all",label:"All Entities",type:"ALL"}),{scorer:c,isLoading:u,error:d}=w1n(e),{data:f={},isLoading:h,error:p}=Tg(),{isLoading:m,error:g}=d0(),{data:y=[],isLoading:x,error:w,isFetchingNextPage:S,hasNextPage:k,setEndOfListElement:_}=x1n({scorerId:e,entityId:i?.value==="all"?void 0:i?.value,entityType:i?.type==="ALL"?void 0:i?.type}),E=b.useMemo(()=>c?.agentIds?.filter(L=>f[L]).map(L=>({value:L,label:f[L].name,type:"AGENT"}))||[],[c?.agentIds,f]),T=b.useMemo(()=>c?.workflowIds?.map(L=>({value:L,label:L,type:"WORKFLOW"}))||[],[c?.workflowIds]),j=b.useMemo(()=>[{value:"all",label:"All Entities",type:"ALL"},...E,...T],[E,T]),N=t.get("entity")??"all",I=j.find(L=>L.value===N);I&&I.value!==i?.value&&l(I),b.useEffect(()=>{if(d){const L=d instanceof Error?d.message:"Failed to load scorer";ze.error(`Error loading scorer: ${L}`)}},[d]),b.useEffect(()=>{if(p){const L=p instanceof Error?p.message:"Failed to load agents";ze.error(`Error loading agents: ${L}`)}},[p]),b.useEffect(()=>{if(g){const L=g instanceof Error?g.message:"Failed to load workflows";ze.error(`Error loading workflows: ${L}`)}},[g]);const P=L=>{L?.value&&r(Y=>{const q=new URLSearchParams(Y);return q.set("entity",L.value),q})};b.useEffect(()=>{const L=t.get("scoreId")??void 0;if(L===s)return;if(!L){a(void 0);return}y.find(q=>q.id===L)&&a(L)},[t,y]);const R=b.useCallback(L=>{a(L||void 0),r(Y=>{const q=new URLSearchParams(Y);return L?q.set("scoreId",L):q.delete("scoreId"),q})},[r]);if(!c)return null;const $=Ps(d)||Ps(p)||Ps(g),M=d&&ks(d),z=!$&&!M&&(d||p||g),U=!x&&y.length===0,B=i?.value!=="all",H=o.jsxs(o.Fragment,{children:[o.jsxs(Za,{children:[o.jsx(jr,{as:dr,to:"/scorers",children:"Scorers"}),o.jsx(S1n,{value:e,variant:"link"})]}),o.jsxs(bt.Row,{children:[o.jsxs(yn,{children:[o.jsxs(yn.Title,{isLoading:u,children:[o.jsx(Ma,{})," ",c?.scorer?.config?.name||e]}),(u||c?.scorer?.config?.description)&&o.jsx(yn.Description,{isLoading:u,children:c?.scorer?.config?.description})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Scorers documentation",tooltipContent:"Go to Scorers documentation",children:o.jsx(Di,{})}),c?.scorer?.source==="stored"&&o.jsxs(pe,{variant:"light",as:dr,to:`/cms/scorers/${e}/edit`,children:[o.jsx(lv,{})," Edit"]})]})]})]});if($||M||z||U&&!B){const L=(d instanceof Error?d.message:void 0)??(p instanceof Error?p.message:void 0)??(g instanceof Error?g.message:void 0)??"An unexpected error occurred";return o.jsxs(bt,{width:"wide",height:"full",children:[o.jsx(bt.TopArea,{children:H}),o.jsx(bt.MainArea,{isCentered:!0,children:$?o.jsx(na,{}):M?o.jsx(Gs,{resource:"scorers"}):z?o.jsx(gu,{title:"Failed to load scorer",message:L}):o.jsx(h1n,{})})]})}return o.jsxs(bt,{width:"wide",children:[o.jsxs(bt.TopArea,{children:[H,o.jsx(g1n,{selectedEntity:i,entityOptions:j,onEntityChange:P,onReset:()=>{r(L=>{const Y=new URLSearchParams(L);return Y.set("entity","all"),Y})},isLoading:x||h||m})]}),o.jsx(f1n,{scores:y,isLoading:x,selectedScoreId:s,isFetchingNextPage:S,hasNextPage:k,setEndOfListElement:_,onScoreClick:R,errorMsg:w?.message})]})}const vAn=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}],bAn=()=>{const{baseUrl:e,headers:t,apiPrefix:r}=sve(),{theme:n,setTheme:s}=Qn(),[a,i]=b.useState(n),l=b.useRef(n);return b.useEffect(()=>{i(n),l.current=n},[n]),o.jsxs(bt,{width:"narrow",children:[o.jsx(bt.TopArea,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{children:[o.jsx(ume,{})," Settings"]})})}),o.jsxs(bt.MainArea,{className:"grid gap-8 mt-6",children:[o.jsx("section",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsx("h2",{className:"text-icon6 font-medium",children:"Theme"}),o.jsx(lft,{name:"theme",label:"Theme mode",value:a,onValueChange:c=>{const u=c;l.current=u,i(u)},options:vAn.map(c=>({...c}))})]})}),o.jsx(uSt,{initialConfig:{baseUrl:e,headers:t,apiPrefix:r},onSave:()=>{s(l.current)}})]})]})};function xAn(){const[e]=so(),t=fu(),r=e.get("redirect")||"/",n=()=>{r.startsWith("http")?window.location.href=r:t(r,{replace:!0})};return o.jsx(P1t,{redirectUri:r,onSuccess:n,initialMode:"signup"})}function wAn(e){return e.replace(/\/$/,"").split("/").pop()}function eB({children:e,className:t}){return o.jsx("div",{className:Z("border border-border1 rounded-lg mt-12 py-8 lg:min-h-[25rem] transition-height px-4 lg:px-12",t),children:e})}function SAn({templates:e,linkComponent:t,className:r,isLoading:n}){const s=t||"a";return n?o.jsx("div",{className:Z("grid gap-y-4",r),children:Array.from({length:5}).map((a,i)=>o.jsx("div",{className:"h-16 bg-surface3 animate-pulse rounded-lg"},i))}):o.jsx("div",{className:Z("grid gap-y-4",r),children:e.map(a=>{const i=a?.agents||a?.tools||a?.networks||a?.workflows||a?.mcp;return o.jsxs("article",{className:Z("border border-border1 rounded-lg overflow-hidden w-full grid grid-cols-[1fr_auto] bg-surface3 transition-colors hover:bg-surface4"),children:[o.jsxs(s,{to:`/templates/${a.slug}`,className:Z("grid [&:hover_p]:text-neutral5",{"grid-cols-[8rem_1fr] lg:grid-cols-[12rem_1fr]":a.imageURL}),children:[a.imageURL&&o.jsx("div",{className:Z("overflow-hidden"),children:o.jsx("div",{className:"w-full h-full bg-cover thumb transition-scale duration-150",style:{backgroundImage:`url(${a.imageURL})`}})}),o.jsxs("div",{className:Z("grid py-3 px-6 w-full gap-0.5","[&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:text-neutral3"),children:[o.jsx("h2",{className:"text-ui-lg text-neutral5",children:a.title}),o.jsx("p",{className:"text-ui-md text-neutral4 transition-colors duration-500",children:a.description}),o.jsxs("div",{className:"hidden 2xl:flex text-neutral3 text-ui-md flex-wrap items-center gap-4 mt-3",children:[i&&o.jsxs("ul",{className:Z("flex gap-4 text-ui-md text-neutral3 m-0 p-0 list-none","[&>li]:flex [&>li]:items-center [&>li]:gap-0.5 text-neutral4"),children:[a?.agents&&a.agents.length>0&&o.jsxs("li",{children:[o.jsx(pa,{})," ",a.agents.length]}),a?.tools&&a.tools.length>0&&o.jsxs("li",{children:[o.jsx(Pi,{})," ",a.tools.length]}),a?.networks&&a.networks.length>0&&o.jsxs("li",{children:[o.jsx(vVe,{})," ",a.networks.length]}),a?.workflows&&a.workflows.length>0&&o.jsxs("li",{children:[o.jsx(lF,{})," ",a.workflows.length]}),a?.mcp&&a.mcp.length>0&&o.jsxs("li",{children:[o.jsx(vl,{})," ",a.mcp.length]})]}),i&&a.supportedProviders&&o.jsx("small",{children:"|"}),o.jsx("div",{className:"flex items-center text-neutral3 gap-4",children:a.supportedProviders.map(l=>o.jsx("span",{className:"",children:l},l))})]})]})]}),o.jsx("a",{href:a.githubUrl,className:Z("group items-center gap-2 text-ui-md ml-auto pr-4 hidden","lg:flex"),target:"_blank",rel:"noopener noreferrer",children:o.jsxs("span",{className:"flex items-center gap-2 px-2 py-1 rounded bg-surface1 group-hover:bg-surface2 text-neutral3 transition-colors group-hover:text-neutral5",children:[o.jsx(ldt,{})," ",wAn(a.githubUrl)]})})]},a.slug)})})}function OAn({tagOptions:e,selectedTag:t,providerOptions:r,selectedProvider:n,onTagChange:s,onProviderChange:a,searchTerm:i,onSearchChange:l,onReset:c,className:u,isLoading:d}){return d?o.jsxs("div",{className:Z("h-[6.5rem] flex items-center gap-8","[&>div]:bg-surface3 [&>div]:w-48 [&>div]:h-8 [&>div]:animate-pulse",u),children:[o.jsx("div",{})," ",o.jsx("div",{})," ",o.jsx("div",{})]}):o.jsxs("div",{className:Z("flex flex-wrap mx-auto sticky top-0 gap-4 bg-surface2 py-8",u),children:[o.jsx(Tx,{name:"search-templates",label:"Search templates",labelIsHidden:!0,value:i,onChange:f=>l?.(f.target.value),placeholder:"Search Template"}),o.jsx($o,{label:"Filter by tag",labelIsHidden:!0,name:"filter-tag",value:t,onValueChange:s,options:e}),o.jsx($o,{label:"Filter by provider",labelIsHidden:!0,name:"filter-provider",value:n,onValueChange:a,options:r}),c&&o.jsxs(pe,{onClick:c,children:["Reset ",o.jsx(Nn,{})]})]})}function kAn(){const{data:e,isLoading:t}=hzr(),{templates:r,tags:n,providers:s}=e??{templates:[],tags:[],providers:[]},[a,i]=b.useState("all"),[l,c]=b.useState("all"),[u,d]=b.useState(""),f=[{value:"all",label:"Any tag"}];(n||[]).forEach(w=>{f.push({value:w,label:w})});const h=[{value:"all",label:"Any provider"}];(s||[]).forEach(w=>{h.push({value:w,label:w})});const p=(w,S)=>{S==="tag"?i(w):S==="provider"&&c(w)},m=w=>{d(w)},g=()=>{i("all"),c("all"),d("")},y=r.filter(w=>!(u&&!w.title.toLowerCase().includes(u)&&!w.description.toLowerCase().includes(u)||a!=="all"&&!w.tags.includes(a)||l!=="all"&&!w.supportedProviders.includes(l))),x=u||a!=="all"||l!=="all";return o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Zu,{children:[o.jsx(Ce,{children:o.jsx(qb,{})}),"Templates"]})}),o.jsxs("div",{className:Z("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[o.jsx(OAn,{selectedTag:a,onTagChange:w=>p(w,"tag"),tagOptions:f,selectedProvider:l,onProviderChange:w=>p(w,"provider"),providerOptions:h,searchTerm:u,onSearchChange:m,onReset:x?g:void 0,className:"max-w-[80rem]",isLoading:t}),o.jsx(SAn,{templates:y,linkComponent:dr,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const _An="1.29.0-alpha.1";function EAn({errorMsg:e,validationErrors:t}){const r=typeof e=="string"?e:e!=null?String(e):void 0,n=r?.includes("Invalid schema for function"),s=r?.includes("validation issue")||t&&t.length>0,a=()=>s?"Template installation completed but some validation issues remain. The template may still be functional, but you should review and fix these issues.":n?"There was an issue with the AI model configuration. This may be related to the selected model or AI SDK version compatibility.":"An unexpected error occurred during template installation.",i=()=>s?{icon:o.jsx(kh,{className:"text-yellow-500"}),title:"Template Installed with Warnings"}:{icon:o.jsx(i2t,{}),title:"Template Installation Failed"},{icon:l,title:c}=i();return o.jsxs(eB,{className:"space-y-4 text-neutral3 mb-8 content-center",children:[o.jsxs("div",{className:Z("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[l,o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("p",{className:"text-ui-md font-medium text-neutral5",children:c}),o.jsx("p",{className:"text-ui-md text-neutral3",children:a()})]})]}),t&&t.length>0&&o.jsxs("details",{className:"text-xs",children:[o.jsxs("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:["Show Validation Issues (",t.length,")"]}),o.jsx("div",{className:"mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto max-h-60 text-left space-y-2",children:t.map((u,d)=>o.jsxs("div",{className:"border-l-2 border-red-400 pl-2",children:[o.jsx("div",{className:"font-medium text-red-600 dark:text-red-400",children:u.type==="typescript"?"🔴 TypeScript Error":"⚠️ Lint Error"}),o.jsx("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-300 mt-1 whitespace-pre-wrap wrap-break-word",children:u.message})]},d))})]}),r&&!s&&o.jsxs("details",{className:"text-xs",children:[o.jsx("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:"Show Details"}),o.jsx("div",{className:"mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded text-xs font-mono overflow-auto max-h-60 text-left",children:o.jsx("div",{className:"whitespace-pre-wrap wrap-break-word",children:r})})]})]})}function CAn({providerOptions:e,selectedProvider:t,onProviderChange:r,variables:n,errors:s,handleInstallTemplate:a,handleVariableChange:i,isLoadingEnvVars:l,isInstalling:c,defaultModelProvider:u,defaultModelId:d,onModelUpdate:f}){return o.jsx(eB,{children:o.jsxs("div",{className:"max-w-[40rem] my-4 p-4 lg:p-8 mx-auto gap-8 grid",children:[o.jsxs("h2",{className:Z("text-neutral4 text-header-sm font-semibold flex items-center gap-2","[&>svg]:w-[1.2em] [&_svg]:h-[1.2em] [&_svg]:opacity-70"),children:["Install Template ",o.jsx(bVe,{})]}),o.jsx($o,{name:"template-provider",options:e,label:"Template AI Model Provider",onValueChange:r,value:t,placeholder:"Select",layout:"horizontal"}),t&&Object.entries(n||{}).length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"text-neutral3 text-ui-md",children:"Set required Environmental Variables"}),o.jsx("div",{className:"grid grid-cols-[1fr_1fr] gap-4 items-start",children:l?o.jsxs("div",{className:Z("flex items-center justify-center col-span-2 text-neutral3 text-ui-sm gap-4","[&_svg]:opacity-50 [&_svg]:w-[1.1em] [&_svg]:h-[1.1em]","animate-in fade-in duration-300"),children:[o.jsx(Mt,{})," Loading variables..."]}):Object.entries(n).map(([h,p])=>o.jsxs(b.Fragment,{children:[o.jsx(jx,{name:`env-${h}`,labelIsHidden:!0,label:"Key",value:h,disabled:!0,className:"w-full"}),o.jsx(jx,{name:h,labelIsHidden:!0,label:"Value",value:p,onChange:i,errorMsg:s.includes(h)?"Value is required.":"",autoComplete:"off",className:"w-full"})]},h))}),o.jsxs("div",{className:"border-t border-border1 pt-12 mt-3.5 relative",children:[o.jsx("div",{className:"absolute w-8 h-8 rounded-full bg-surface2 top-0 left-1/2 -translate-x-1/2 -translate-y-4 text-ui-sm text-neutral3 flex items-center justify-center",children:"And"}),o.jsx("h3",{className:"text-neutral4 text-ui-lg",children:"Set AI Model for Template Installation"}),o.jsx("p",{className:"text-neutral3 text-ui-md mt-2 mb-8",children:"This model will be used by the workflow to process and install the template"}),o.jsx(lSt,{defaultProvider:u||"",defaultModel:d||"",updateModel:f||(()=>Promise.resolve({message:"Updated"})),closeEditor:()=>{},autoSave:!0,selectProviderPlaceholder:"Provider"})]})]}),t&&!l&&o.jsx(pe,{className:Z("flex items-center gap-2 mt-4 justify-center text-ui-md w-full bg-surface5 min-h-10 rounded-lg text-neutral5 hover:bg-surface6 transition-colors","[&>svg]:w-[1.1em] [&_svg]:h-[1.1em] [&_svg]:text-neutral5"),onClick:a,disabled:!t||!u||!d||s.length>0||c,children:c?o.jsxs(o.Fragment,{children:[o.jsx(Mt,{className:"w-4 h-4"})," Installing..."]}):o.jsxs(o.Fragment,{children:["Install ",o.jsx(Fw,{})]})})]})})}function jAn({title:e,description:t,githubUrl:r,isLoading:n,infoData:s,templateSlug:a}){const i=a?`feat/install-template-${a}`:"feat/install-template-[slug]";return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:Z("grid mt-8 items-center"),children:o.jsxs("div",{className:Z("text-header-lg flex items-center gap-3","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",{"[&>svg]:opacity-20":n}),children:[o.jsx(qb,{}),o.jsx("h2",{className:Z({"bg-surface4 flex rounded-lg min-w-[50%]":n}),children:n?o.jsx(o.Fragment,{children:" "}):e})]})}),o.jsxs("div",{className:"grid lg:grid-cols-[1fr_1fr] gap-x-24",children:[o.jsxs("div",{className:"grid",children:[o.jsx("p",{className:Z("mb-4 text-ui-md text-neutral4 mt-2 leading-7",{"bg-surface4 rounded-lg ":n}),children:n?o.jsx(o.Fragment,{children:" "}):t}),!n&&a&&o.jsxs("div",{className:Z("bg-surface2 border border-surface4 rounded-lg p-4 mb-4","flex items-start gap-3"),children:[o.jsx("div",{className:"shrink-0 mt-0.5",children:o.jsx(Uy,{className:"w-[1.1em] h-[1.1em] text-blue-500"})}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(sF,{className:"w-[1em] h-[1em] text-neutral4"}),o.jsx("span",{className:"text-ui-md font-medium text-neutral5",children:"A new Git branch will be created"})]}),o.jsxs("div",{className:"text-ui-sm text-neutral4 space-y-1",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-medium",children:"Branch name:"})," ",o.jsx("code",{className:"bg-surface3 px-1.5 py-0.5 rounded text-ui-sm font-mono",children:i})]}),o.jsx("div",{children:"This ensures safe installation with easy rollback if needed. Your main branch remains unchanged."})]})]})]}),r&&o.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 mt-auto text-neutral3 text-ui-md hover:text-neutral5",children:[o.jsx(ldt,{}),r?.split("/")?.pop()]})]}),s&&o.jsx(bC,{data:s,labelsAreHidden:!0,isLoading:n})]})]})}function TAn({name:e,streamResult:t,workflowInfo:r}){const n=t?.phase||"initializing",s=t?.payload?.workflowState,a=t?.payload?.currentStep,i=t?.error,l=s?.steps||{},c=Object.keys(l).length>0,u=m=>m==="input"||m.endsWith(".input")||m.startsWith("Mapping_")&&/[0-9a-f]{8}/.test(m)||/[0-9a-f]{8,}/.test(m)?!1:r?.allSteps?m in r.allSteps:!0,d=Object.entries(l).filter(([m,g])=>u(m)),f=d.length,h=()=>{switch(n){case"initializing":return"Preparing template installation...";case"processing":return`Installing ${e} template`;case"completed":return"Template installation completed!";case"error":return"Template installation failed";default:return"Installing template..."}},p=d.map(([m,g])=>({id:m,status:g?.status,description:g?.description,title:m.charAt(0).toUpperCase()+m.slice(1).replace(/-/g," "),isActive:a?.id===m}));return o.jsxs(eB,{className:"space-y-6 text-neutral3 mb-8 content-center",children:[o.jsxs("div",{className:"text-center",children:[o.jsx("h3",{className:"text-lg font-semibold text-neutral5",children:h()}),t?.runId&&o.jsxs("div",{className:"mt-2 text-ui-sm text-neutral3",children:["Run ID: ",t.runId]})]}),c&&f>0&&!["error"].includes(n)&&o.jsx("div",{className:"max-w-[30rem] w-full mx-auto px-6",children:o.jsx(h3r,{steps:p})}),i&&n==="error"&&o.jsxs("div",{className:Z("rounded-lg text-neutral5 p-6 flex items-center gap-3 text-ui-md bg-red-500/10","[&>svg]:w-6 [&>svg]:h-6 [&>svg]:opacity-70 [&>svg]:text-red-500"),children:[o.jsx(J2t,{}),i||"Something went wrong"]}),c&&o.jsx(f3r,{steps:p,currentStep:a,className:"pb-4"}),!c&&n==="initializing"&&o.jsxs("div",{className:"text-center text-sm text-neutral3 grid gap-4 justify-items-center",children:[o.jsx(Mt,{}),o.jsx("p",{children:"This may take some time..."})]})]})}function NAn({name:e,installedEntities:t}){return o.jsxs(eB,{className:Z("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[o.jsx(bVe,{}),o.jsx("h2",{className:"text-header-md",children:"Done!"}),o.jsxs("p",{className:"text-ui-md text-center text-neutral3 ",children:["The ",o.jsx("b",{className:"text-neutral4",children:e})," template has been successfully installed.",t&&t.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("br",{})," Installed entities are listed below."]})]}),t&&t.length>0&&o.jsx(bC,{data:t})]})}function AAn(){const{templateSlug:e}=ra(),[t,r]=so(),[n,s]=b.useState(""),[a,i]=b.useState(""),[l,c]=b.useState(""),[u,d]=b.useState({}),[f,h]=b.useState([]),[p,m]=b.useState(null),[g,y]=b.useState(!1),[x,w]=b.useState(""),[S,k]=b.useState(!1),[_,E]=b.useState(!1),[T,j]=b.useState([]),{data:N,isLoading:I}=pzr({repoOrSlug:e,owner:"mastra-ai"}),R=_An?.includes("beta")??!1?"beta":"main",{data:$,isLoading:M}=mzr({repo:N?.githubUrl?new URL(N.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:R}),{data:z,isLoading:U}=gzr(),{mutateAsync:B,isPending:H}=yzr(),{mutateAsync:W}=vzr(),{streamInstall:L,streamResult:Y,isStreaming:q}=xzr(z),{observeInstall:D,streamResult:Q,isStreaming:G}=wzr(z);b.useEffect(()=>{const te=t.get("runId");te&&!g&&!p&&!q&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:te}),w(te),W({runId:te}).then(le=>{const ve=le.snapshot;if(ve?.status==="success"&&ve?.result?.success)y(!0);else if(ve?.result?.success===!1)if(ve?.result?.validationResults&&!ve?.result?.validationResults?.valid&&ve?.result?.validationResults?.remainingErrors>0){const{remainingErrors:fe,errors:xe}=ve.result.validationResults,Se=`Template installation completed but ${fe} validation issue${fe>1?"s":""} remain unresolved.`;m(Se),j(xe||[])}else{const fe=ve?.result?.message||ve?.result?.error||"Template installation failed";m(typeof fe=="string"?fe:String(fe))}}).catch(le=>{console.error("❌ Failed to fetch run details:",le),m("Failed to retrieve installation status after reload")}))},[t,g,p,q,G,W]),b.useEffect(()=>{const te=t.get("runId"),le=t.get("resume"),ve=t.get("provider");if(te&&le==="true"&&ve&&!q&&!G&&!S&&!_&&z){w(te),k(!0);try{W({runId:te}).then(ue=>{if(ue.snapshot?.status==="running")return D.mutateAsync({runId:te})}).then(()=>{r(ue=>{const fe=new URLSearchParams(ue);return fe.delete("resume"),fe})}).catch(ue=>{console.error("❌ Failed to resume template installation:",ue),ue.message?.includes("404")||ue.message?.includes("not found")?m("Template installation run not found. It may have expired or been completed."):m("Failed to resume template installation. Please try again.")})}catch(ue){console.error("❌ Auto-resume failed with error:",ue),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,q,G,S,_,z,W,D,r]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],ae=[{key:"tools",label:"Tools",value:N?.tools?.length?N.tools.map(te=>te).join(", "):"n/a",icon:o.jsx(Pi,{})},{key:"agents",label:"Agents",value:N?.agents?.length?N.agents.map(te=>te).join(", "):"n/a",icon:o.jsx(pa,{})},{key:"workflows",label:"Workflows",value:N?.workflows?.length?N.workflows.map(te=>te).join(", "):"n/a",icon:o.jsx(lF,{})},{key:"providers",label:"Providers",value:N?.supportedProviders?.length?N.supportedProviders.join(", "):"n/a",icon:o.jsx(Nm,{})},{key:"tags",label:"Tags",value:N?.tags?.length?N.tags.join(", "):"n/a",icon:o.jsx(AE,{})}],re=[{...ae[0]},{...ae[1]},{...ae[2]}].filter(te=>te.value!=="n/a");b.useEffect(()=>{$&&d($)},[$]),b.useEffect(()=>{const te=Y||Q;te?.phase==="error"&&te?.error&&m(typeof te.error=="string"?te.error:String(te.error))},[Y?.phase,Y?.error,Q?.phase,Q?.error]);const se=te=>{s(te)},oe=async te=>(i(te.provider),c(te.modelId),{message:"Model updated successfully"}),he=async()=>{const te=Object.entries(u).reduce((le,[ve,ue])=>(ue===""&&le.push(ve),le),[]);if(te.length>0){h(te);return}if(N){m(null),y(!1),w(""),E(!0);try{const ve={repo:N.githubUrl||`https://github.com/mastra-ai/template-${N.slug}`,ref:R,slug:N.slug,variables:u},{runId:ue}=await B({});w(ue),r(fe=>{const xe=new URLSearchParams(fe);return xe.set("runId",ue),xe.set("resume","true"),xe.set("provider",n||"openai"),xe}),await L.mutateAsync({inputData:ve,selectedModel:{provider:a,modelId:l},runId:ue})}catch(le){E(!1),m(le?.message||"Template installation failed"),console.error("Template installation failed",le)}}},X=te=>{const{name:le,value:ve}=te.target;ve.trim()===""?h(ue=>[...ue,le]):h(ue=>ue.filter(fe=>fe!==le)),d(ue=>({...ue,[le]:ve}))};return o.jsxs(zr,{children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/templates",children:[o.jsx(Ce,{children:o.jsx(qb,{})}),"Templates"]}),o.jsx(jr,{as:dr,to:`/templates/${N?.slug}`,isCurrent:!0,children:N?.title&&N.title})]})}),o.jsx("div",{className:Z("w-full lg:px-12 h-full overflow-y-scroll"),children:o.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[o.jsx(jAn,{isLoading:I,title:N?.title,description:N?.longDescription,imageURL:N?.imageURL,githubUrl:N?.githubUrl,infoData:ae,templateSlug:e}),N&&o.jsxs(o.Fragment,{children:[(q||G)&&o.jsx(TAn,{name:N.title,streamResult:G?Q:Y,runId:x,workflowInfo:z}),g&&o.jsx(NAn,{name:N.title,installedEntities:re,linkComponent:dr}),p&&o.jsx(EAn,{errorMsg:p,validationErrors:T.length>0?T:Y?.validationResults?.errors||Q?.validationResults?.errors}),!q&&!G&&!g&&!p&&o.jsx(CAn,{providerOptions:J,selectedProvider:n,onProviderChange:se,variables:u,setVariables:d,errors:f,setErrors:h,handleInstallTemplate:he,handleVariableChange:X,isLoadingEnvVars:M||U,isInstalling:H,defaultModelProvider:a,defaultModelId:l,onModelUpdate:oe})]})]})})]})}const IAn=()=>{const{toolId:e,agentId:t}=ra();return o.jsxs(zr,{children:[o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/agents",children:[o.jsx(Ce,{children:o.jsx(pa,{})}),"Agents"]}),o.jsx(jr,{as:dr,to:`/agents/${t}/chat`,children:t}),o.jsx(jr,{as:dr,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[o.jsx(Ce,{children:o.jsx(u0,{})}),"Tools documentation"]})})]}),o.jsx(eOn,{toolId:e,agentId:t})]})},RAn=()=>{const{toolId:e}=ra();return o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/tools",children:[o.jsx(Ce,{children:o.jsx(Pi,{})}),"Tools"]}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:o.jsx(UNn,{value:e,variant:"ghost"})})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(u0,{}),"Tools documentation"]})})]}),o.jsx(BNn,{toolId:e})]})},BBe="auto auto auto auto 1fr";function L1t({scoresData:e,isLoadingScoresData:t,onPageChange:r,onScoreSelect:n}){return t?o.jsx(H9,{columns:BBe}):o.jsxs("div",{className:"grid gap-2",children:[o.jsxs(Rc,{columns:BBe,className:"min-w-0",children:[o.jsxs(Rc.Top,{children:[o.jsx(Rc.TopCell,{children:"ID"}),o.jsx(Rc.TopCell,{children:"Date"}),o.jsx(Rc.TopCell,{children:"Time"}),o.jsx(Rc.TopCell,{children:"Score"}),o.jsx(Rc.TopCell,{children:"Scorer"})]}),e?.scores&&e.scores.length>0?e.scores.map(s=>{const a=new Date(s.createdAt),i=mv(a);return o.jsxs(Rc.RowButton,{onClick:()=>n?.(s),children:[o.jsx(Rc.Cell,{height:"compact",className:"font-mono text-neutral3 text-ui-smd",children:nf(s?.id)||"n/a"}),o.jsx(Rc.Cell,{height:"compact",className:"text-neutral2 text-ui-smd",children:i?"Today":ur(a,"MMM dd")}),o.jsx(Rc.Cell,{height:"compact",className:"font-mono text-neutral3 text-ui-smd",children:ur(a,"h:mm:ss aaa")}),o.jsx(Rc.Cell,{height:"compact",className:"text-ui-smd",children:String(s?.score??"")}),o.jsx(Rc.Cell,{height:"compact",className:"text-ui-smd",children:String(s?.scorer?.name||s?.scorer?.id||"")})]},s.id)}):o.jsx(Rc.NoMatch,{message:"No scores found"})]}),o.jsx(Rc.Pagination,{currentPage:e?.pagination?.page||0,hasMore:e?.pagination?.hasMore,onNextPage:()=>r?.((e?.pagination?.page||0)+1),onPrevPage:()=>r?.((e?.pagination?.page||0)-1)})]})}function PAn(){const[e,t]=so(),[r,n]=b.useState(!1),s=_Fr(e,t,{onRemoveAll:()=>n(!1)}),[a,i]=b.useState(),[l,c]=b.useState(0),[u,d]=b.useState(!1),[f,h]=b.useState(null);b.useEffect(()=>c(0),[s.traceIdParam,s.spanIdParam]);const{data:p,isLoading:m}=fd(),{data:g,isLoading:y}=hve({traceId:s.traceIdParam,spanId:s.spanIdParam,page:l}),{data:x,isLoading:w}=Ame(s.traceIdParam??null),S=b.useMemo(()=>x?.spans,[x?.spans]),{data:k,isLoading:_}=FS(s.traceIdParam??"",s.spanIdParam??""),E=s.scoreIdParam?g?.scores?.find(te=>te.id===s.scoreIdParam):void 0,{data:T=[],isPending:j}=hht(),{data:N=[],isPending:I}=pht({entityType:s.selectedEntityOption?.entityType,rootOnly:!0}),{data:P=[],isPending:R}=mht(),{data:$=[],isPending:M}=ght(),z=b.useMemo(()=>yFr({availableTags:T,availableRootEntityNames:N,availableServiceNames:$,availableEnvironments:P,loading:{tags:j,entityNames:I,serviceNames:M,environments:R}}),[T,N,$,P,j,I,M,R]),U=b.useMemo(()=>wFr({rootEntityType:s.selectedEntityOption?.entityType,status:s.selectedStatus,dateFrom:s.selectedDateFrom,dateTo:s.selectedDateTo,tokens:s.filterTokens}),[s.filterTokens,s.selectedDateFrom,s.selectedDateTo,s.selectedEntityOption,s.selectedStatus]),{data:B,isLoading:H,isFetchingNextPage:W,hasNextPage:L,setEndOfListElement:Y,error:q}=uFr({filters:U}),D=b.useMemo(()=>B?.spans??[],[B?.spans]),Q=B?.threadTitles??{},{handlePreviousSpan:G,handleNextSpan:J}=yht(S,s.spanIdParam??null,te=>s.handleSpanChange(te)),ae=jFr(e,t),re=b.useCallback(()=>s.applyFilterTokens(SFr(z,s.filterTokens)),[z,s]),{handlePreviousTrace:se,handleNextTrace:oe}=OFr(D,s.traceIdParam,s.handleTraceClick),he=b.useCallback(()=>{const te=S?.find(le=>le.parentSpanId==null);te&&(s.handleSpanChange(te.spanId),s.handleSpanTabChange("scoring"))},[S,s]);if(q)return o.jsx(Jr,{title:"Traces",icon:o.jsx(xo,{}),children:o.jsx(fht,{error:q,resource:"traces",errorTitle:"Failed to load traces"})});const X=!!s.selectedEntityOption||!!s.selectedStatus||s.filterTokens.length>0||s.datePreset!=="last-24h"||!!s.selectedDateTo;return o.jsxs(bt,{width:"wide",height:"full",children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:H,children:[o.jsx(xo,{})," Traces"]})})}),o.jsxs(bt.Column,{className:"flex justify-end items-center gap-2",children:[o.jsx(Wft,{preset:s.datePreset,onPresetChange:s.handleDatePresetChange,dateFrom:s.selectedDateFrom,dateTo:s.selectedDateTo,onDateChange:s.handleDateChange,disabled:H,presets:["last-24h","last-3d","last-7d","last-14d","last-30d","custom"]}),o.jsx(Xdt,{fields:z,tokens:s.filterTokens,onTokensChange:s.handleFilterTokensChange,disabled:H,onStartTextFilter:i}),o.jsx(Cn,{disabled:H,"aria-pressed":r,"aria-label":r?"Ungroup traces":"Group traces by thread",tooltipContent:r?"Ungroup traces":"Group traces by thread",onClick:()=>n(te=>!te),children:r?o.jsx(d3,{}):o.jsx(mVe,{})}),o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/observability/tracing/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Traces documentation",tooltipContent:"Go to Traces documentation",children:o.jsx(Di,{})})]})]}),o.jsx(W6r,{isLoading:H,filterFields:z,filterTokens:s.filterTokens,onFilterTokensChange:s.handleFilterTokensChange,onClear:re,onRemoveAll:s.handleRemoveAll,onSave:ae.handleSave,onRemoveSaved:ae.hasSavedFilters?ae.handleRemoveSaved:void 0,autoFocusFilterFieldId:a})]}),o.jsx(tFr,{traceCollapsed:u,listSlot:o.jsx(nFr,{traces:D,isLoading:H,isFetchingNextPage:W,hasNextPage:L,setEndOfListElement:Y,filtersApplied:X,featuredTraceId:s.traceIdParam,onTraceClick:te=>s.handleTraceClick(s.traceIdParam===te.traceId?"":te.traceId),groupByThread:r,threadTitles:Q}),tracePanelSlot:s.traceIdParam?o.jsx(uht,{traceId:s.traceIdParam,spans:S,isLoading:w,onClose:s.handleTraceClose,onSpanSelect:te=>s.handleSpanChange(te??null),onEvaluateTrace:he,onSaveAsDatasetItem:te=>h(te),initialSpanId:s.spanIdParam,onPrevious:se,onNext:oe,collapsed:u,onCollapsedChange:d,placement:"traces-list",LinkComponent:S8,traceHref:`/traces/${s.traceIdParam}`}):null,spanPanelSlot:s.traceIdParam&&s.spanIdParam?o.jsx(dht,{traceId:s.traceIdParam,spanId:s.spanIdParam,span:k?.span,isLoading:_,onClose:s.handleSpanClose,onPrevious:G,onNext:J,activeTab:s.spanTabParam??"details",onTabChange:te=>s.handleSpanTabChange(te),scoringTabBadge:g?.pagination?.total??void 0,scoringTabSlot:({span:te,traceId:le,spanId:ve})=>o.jsxs("div",{className:"grid gap-6",children:[o.jsx(Sve,{traceId:le,isTopLevelSpan:!te.parentSpanId,spanId:ve,entityType:te.attributes?.agentId||te.entityType===Do.AGENT?"Agent":te.attributes?.workflowId||te.entityType===Do.WORKFLOW_RUN?"Workflow":void 0,scorers:p,isLoadingScorers:m}),o.jsx(L1t,{scoresData:g,onPageChange:c,isLoadingScoresData:y,onScoreSelect:ue=>s.handleScoreChange(ue.id)})]})}):null,scorePanelSlot:E?o.jsx(dve,{score:E,onClose:()=>s.handleScoreChange(null)}):null}),f&&o.jsx(Ove,{rootSpanId:f.rootSpanId,traceId:f.traceId,isOpen:!0,onClose:()=>h(null)})]})}function MAn(){const{traceId:e}=ra(),[t,r]=so(),n=fu(),s=t.get("spanId")||void 0,a=t.get("tab"),i=a==="scoring"?"scoring":"details",l=t.get("scoreId")||void 0,[c,u]=b.useState(s??null),[d,f]=b.useState(),[h,p]=b.useState(i),[m,g]=b.useState(0),[y,x]=b.useState(!1),{data:w,isLoading:S,error:k}=Ame(e),_=b.useMemo(()=>w?.spans??[],[w?.spans]),E=b.useMemo(()=>_.find(G=>G.parentSpanId==null),[_]),{data:T,isLoading:j}=FS(e,c??"");b.useEffect(()=>g(0),[e,c]);const{data:N,isLoading:I}=fd(),{data:P,isLoading:R}=hve({traceId:e,spanId:c??void 0,page:m});b.useEffect(()=>{if(l&&P?.scores&&!d){const G=P.scores.find(J=>J.id===l);G&&f(G)}},[l,P?.scores,d]);const $=b.useCallback(G=>{const J=new URLSearchParams(t);for(const[ae,re]of Object.entries(G))re===null||re===""?J.delete(ae):J.set(ae,re);r(J,{replace:!0})},[t,r]),M=b.useCallback(G=>{const J=G??null,ae=J===c;u(J),ae||(f(void 0),p("details"),$({spanId:J,tab:null,scoreId:null}))},[c,$]),z=b.useCallback(()=>{u(null),f(void 0),p("details"),$({spanId:null,tab:null,scoreId:null})},[$]),U=b.useCallback(G=>{u(G),f(void 0),p("details"),$({spanId:G,tab:null,scoreId:null})},[$]),{handlePreviousSpan:B,handleNextSpan:H}=yht(_,c,U),W=b.useCallback(G=>{const J=G;p(J),f(void 0),$({tab:J==="details"?null:J,scoreId:null})},[$]),L=b.useCallback(G=>{f(G),$({scoreId:G.id})},[$]),Y=b.useCallback(()=>{f(void 0),$({scoreId:null})},[$]),q=b.useCallback(()=>{n("/observability")},[n]),D=b.useCallback(()=>{p("scoring"),E&&c!==E.spanId?(u(E.spanId),f(void 0),$({spanId:E.spanId,tab:"scoring",scoreId:null})):$({tab:"scoring"})},[E,c,$]),Q=o.jsxs(o.Fragment,{children:[o.jsxs(pe,{as:S8,href:"/observability",variant:"link",size:"md",className:"text-neutral2",children:[o.jsx(_p,{}),"Back to Traces"]}),o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:S,children:[o.jsx(xo,{})," Trace ",o.jsx("span",{className:"text-neutral3",children:e})]})})}),o.jsx(bt.Column,{children:o.jsxs(ps,{children:[o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/observability/tracing/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Traces documentation",tooltipContent:"Go to Traces documentation",children:o.jsx(Di,{})}),E&&o.jsxs(o.Fragment,{children:[o.jsxs(Cn,{tooltipContent:"Evaluate Trace","aria-label":"Evaluate Trace",onClick:D,children:[o.jsx(c3,{}),"Evaluate"]}),o.jsxs(Cn,{tooltipContent:"Save as Dataset Item","aria-label":"Save as Dataset Item",onClick:()=>x(!0),children:[o.jsx(nu,{}),"Save"]})]})]})})]}),E&&o.jsx(bt.Row,{children:o.jsx(bt.Column,{children:o.jsx(oht,{rootSpan:E,numOfCol:3})})})]});return k?o.jsxs(bt,{height:"full",children:[o.jsx(bt.TopArea,{children:Q}),o.jsx(bt.MainArea,{isCentered:!0,children:o.jsx(fht,{error:k,resource:"traces",errorTitle:"Failed to load trace"})})]}):o.jsxs(bt,{children:[o.jsx(bt.TopArea,{children:Q}),o.jsx(Ove,{rootSpanId:E?.spanId,traceId:e,isOpen:y,onClose:()=>x(!1)}),o.jsxs("div",{className:Z("grid h-full min-h-0 gap-4 overflow-hidden items-start mt-4",c?"grid-cols-[2fr_3fr]":"grid-cols-[1fr]"),children:[o.jsx(uht,{traceId:e,spans:_,isLoading:S,onClose:q,onSpanSelect:M,onEvaluateTrace:D,initialSpanId:c,placement:"trace-page",timelineChartWidth:c?"default":"wide"}),c&&!S&&o.jsxs("div",{className:Z("grid gap-4 max-h-full min-h-0 overflow-auto",d?"grid-rows-[1fr_1fr]":"grid-rows-[1fr]"),children:[o.jsx(dht,{traceId:e,spanId:c,span:T?.span,isLoading:j,onClose:z,onPrevious:B,onNext:H,activeTab:h,onTabChange:W,scoringTabBadge:P?.pagination?.total??void 0,scoringTabSlot:({span:G,traceId:J,spanId:ae})=>o.jsxs("div",{className:"grid gap-6",children:[o.jsx(Sve,{traceId:J,isTopLevelSpan:!G.parentSpanId,spanId:ae,entityType:G.attributes?.agentId||G.entityType===Do.AGENT?"Agent":G.attributes?.workflowId||G.entityType===Do.WORKFLOW_RUN?"Workflow":void 0,scorers:N,isLoadingScorers:I}),o.jsx(L1t,{scoresData:P,onPageChange:g,isLoadingScoresData:R,onScoreSelect:L})]})}),d&&o.jsx(dve,{score:d,onClose:Y})]})]})]})}function DAn(){const{data:e,isLoading:t,error:r}=d0(),[n,s]=b.useState("");return r&&Ps(r)?o.jsx(Jr,{title:"Workflows",icon:o.jsx(Mi,{}),children:o.jsx(na,{})}):r&&ks(r)?o.jsx(Jr,{title:"Workflows",icon:o.jsx(Mi,{}),children:o.jsx(Gs,{resource:"workflows"})}):r?o.jsx(Jr,{title:"Workflows",icon:o.jsx(Mi,{}),children:o.jsx(gu,{title:"Failed to load workflows",message:r.message})}):Object.keys(e||{}).length===0&&!t?o.jsx(Jr,{title:"Workflows",icon:o.jsx(Mi,{}),children:o.jsx(Ehn,{})}):o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:t,children:[o.jsx(Mi,{})," Workflows"]})})}),o.jsx(bt.Column,{className:"flex justify-end gap-2",children:o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workflows documentation",children:o.jsx(Di,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(_g,{onSearch:s,label:"Filter workflows",placeholder:"Filter by name or description"})})]}),o.jsx(_hn,{workflows:e||{},isLoading:t,search:n})]})}const UBe=()=>{const{workflowId:e}=ra(),{data:t,isLoading:r,error:n}=FP(e);return n&&Ps(n)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})}):n&&ks(n)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"workflows"})}):o.jsx(ywt,{workflowId:e,workflow:t??void 0,isLoading:r})};function LAn(e){if(!e)return null;switch(e.icon||e.provider){case"aws-s3":case"s3":return o.jsx(udt,{className:"h-4 w-4 text-[#FF9900]"});case"google-cloud":case"google-cloud-storage":case"gcs":return o.jsx(cdt,{className:"h-4 w-4"});case"azure-blob":case"azure":return o.jsx(ddt,{className:"h-4 w-4 text-[#0078D4]"});case"cloudflare":case"cloudflare-r2":case"r2":return o.jsx(mU,{className:"h-4 w-4 text-[#F38020]"});case"minio":return o.jsx(Dre,{className:"h-4 w-4 text-red-400"});case"database":return o.jsx(ja,{className:"h-4 w-4 text-emerald-400"});case"local":case"folder":return o.jsx(oc,{className:"h-4 w-4 text-amber-400"});case"hard-drive":return o.jsx(Dre,{className:"h-4 w-4 text-slate-400"});case"cloud":return o.jsx(mU,{className:"h-4 w-4 text-sky-400"});default:return o.jsx(mU,{className:"h-4 w-4 text-neutral4"})}}function $1t(e,t=!1){const{name:r,type:n,mount:s}=e;if(n==="directory")return s?LAn(s):t?o.jsx(jE,{className:"h-4 w-4 text-amber-400"}):o.jsx(oc,{className:"h-4 w-4 text-amber-400"});switch(r.split(".").pop()?.toLowerCase()){case"ts":case"tsx":case"js":case"jsx":return o.jsx(px,{className:"h-4 w-4 text-blue-400"});case"json":return o.jsx(SR,{className:"h-4 w-4 text-yellow-400"});case"md":case"mdx":return o.jsx(Zi,{className:"h-4 w-4 text-neutral4"});case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return o.jsx(rce,{className:"h-4 w-4 text-purple-400"});default:return o.jsx(ece,{className:"h-4 w-4 text-neutral4"})}}function F1t(e){if(e==null||Number.isNaN(e))return"";if(e<0)return"-"+F1t(-e);if(e===0)return"0 B";const t=1024,r=["B","KB","MB","GB","TB"],n=Math.min(Math.floor(Math.log(e)/Math.log(t)),r.length-1);return parseFloat((e/Math.pow(t,n)).toFixed(1))+" "+r[n]}function $An(e){if("body"in e&&e.body&&typeof e.body=="object"){const n=e.body;if(typeof n.error=="string")return n.error;if(typeof n.message=="string")return n.message}const t=e.message,r=t.lastIndexOf(" - {");if(r!==-1)try{const n=t.slice(r+3),s=JSON.parse(n);if(s.error)return s.error;if(s.message)return s.message}catch{}return t.includes("status: 404")?"Directory not found":t}function z1t(e){return e==="."||e===""}function FAn({path:e,onNavigate:t}){const n=z1t(e)?[]:e.split("/").filter(Boolean);return o.jsxs("div",{className:"flex items-center gap-1 text-sm overflow-x-auto",children:[o.jsx("button",{onClick:()=>t("."),className:"p-1 rounded hover:bg-surface4 text-neutral5 hover:text-neutral6 transition-colors","aria-label":"Workspace root",children:o.jsx(jE,{className:"h-4 w-4"})}),n.map((s,a)=>{const i=n.slice(0,a+1).join("/");return o.jsxs("div",{className:"flex items-center",children:[o.jsx(Vs,{className:"h-4 w-4 text-neutral3"}),o.jsx("button",{onClick:()=>t(i),className:"px-2 py-1 rounded hover:bg-surface4 text-neutral5 hover:text-neutral6 transition-colors truncate max-w-[150px]",title:s,children:s})]},i)})]})}function zAn({entries:e,currentPath:t,isLoading:r,error:n,onNavigate:s,onFileSelect:a,onRefresh:i,onUpload:l,onCreateDirectory:c,onDelete:u,isCreatingDirectory:d,isDeleting:f}){const[h,p]=b.useState(null),m=[...e].sort((w,S)=>w.type==="directory"&&S.type!=="directory"?-1:w.type!=="directory"&&S.type==="directory"?1:w.name.localeCompare(S.name)),g=z1t(t),y=w=>{const S=g?w.name:`${t}/${w.name}`;w.type==="directory"?s(S):a?.(S)},x=w=>{const S=g?w.name:`${t}/${w.name}`;p(S)};return o.jsxs("div",{className:"rounded-lg border border-border1 overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-surface3 border-b border-border1",children:[o.jsx(FAn,{path:t,onNavigate:s}),o.jsxs("div",{className:"flex items-center gap-1",children:[i&&o.jsx(pe,{variant:"ghost",size:"md",onClick:i,disabled:r,"aria-label":"Refresh files",children:o.jsx(OR,{className:`h-4 w-4 ${r?"animate-spin":""}`})}),c&&o.jsx(pe,{variant:"ghost",size:"md",disabled:d,"aria-label":"Create directory",onClick:()=>{const w=prompt("Directory name:");if(w){const S=g?w:`${t}/${w}`;c(S)}},children:d?o.jsx(Ta,{className:"h-4 w-4 animate-spin"}):o.jsx(nF,{className:"h-4 w-4"})}),l&&o.jsx(pe,{variant:"ghost",size:"md",onClick:l,"aria-label":"Upload files",children:o.jsx(oF,{className:"h-4 w-4"})})]})]}),o.jsx("div",{className:"max-h-[400px] overflow-auto",children:r?o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(Ta,{className:"h-6 w-6 animate-spin text-neutral3"})}):n?o.jsxs("div",{className:"py-12 px-4 text-center",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-red-500/10 mb-4",children:o.jsx(tA,{className:"h-6 w-6 text-red-400"})}),o.jsx("p",{className:"text-sm text-neutral6 font-medium mb-1",children:"Failed to load directory"}),o.jsx("p",{className:"text-xs text-neutral4 max-w-sm mx-auto",children:$An(n)})]}):m.length===0?o.jsx("div",{className:"py-12 text-center text-neutral4 text-sm",children:g?"Workspace is empty":"Directory is empty"}):o.jsx(ld,{children:o.jsxs("ul",{children:[!g&&o.jsx("li",{children:o.jsxs("button",{onClick:()=>{const w=t.split("/").slice(0,-1).join("/")||".";s(w)},className:"w-full flex items-center gap-3 px-4 py-2 hover:bg-surface4 transition-colors text-left",children:[o.jsx(jE,{className:"h-4 w-4 text-amber-400"}),o.jsx("span",{className:"text-sm text-neutral5",children:".."})]})}),m.map(w=>{const S=w.mount?.displayName||w.mount?.provider,k=w.mount?.status==="error";return o.jsx("li",{className:"group",children:o.jsxs("div",{className:"flex items-center hover:bg-surface4 transition-colors",children:[o.jsxs("button",{onClick:()=>y(w),className:"flex-1 flex items-center gap-3 px-4 py-2 text-left",children:[$1t(w),o.jsx("span",{className:"text-sm text-neutral6 flex-1 truncate",children:w.name}),w.mount&&k&&o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{tabIndex:0,className:"flex items-center",children:o.jsx(tA,{className:"h-4 w-4 text-red-400"})})}),o.jsxs(Wr,{className:"max-w-xs",children:[o.jsx("span",{className:"text-red-400",children:"Error:"})," ",w.mount.error||"Failed to connect to this filesystem"]})]}),w.mount&&S&&(w.mount.description?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{tabIndex:0,className:`text-xs px-1.5 py-0.5 rounded ${k?"text-red-400 bg-red-400/10":"text-neutral3 bg-surface4"}`,children:S})}),o.jsx(Wr,{children:w.mount.description})]}):o.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${k?"text-red-400 bg-red-400/10":"text-neutral3 bg-surface4"}`,children:S})),w.type==="file"&&w.size!==void 0&&o.jsx("span",{className:"text-xs text-neutral3 tabular-nums",children:F1t(w.size)})]}),u&&!w.mount&&o.jsx("button",{onClick:()=>x(w),"aria-label":`Delete ${w.name}`,className:"p-2 opacity-0 group-hover:opacity-100 hover:text-red-400 text-neutral3 transition-all",children:o.jsx(nd,{className:"h-3.5 w-3.5"})})]})},w.name)})]})})}),o.jsx(Bt,{open:!!h,onOpenChange:w=>!f&&!w&&p(null),children:o.jsxs(Bt.Content,{children:[o.jsxs(Bt.Header,{children:[o.jsx(Bt.Title,{children:"Delete Item"}),o.jsxs(Bt.Description,{children:['Are you sure you want to delete "',h,'"? This action cannot be undone.']})]}),o.jsxs(Bt.Footer,{children:[o.jsx(Bt.Cancel,{disabled:f,children:"Cancel"}),o.jsxs(Bt.Action,{disabled:f,onClick:async()=>{try{h&&u&&await u(h)}finally{p(null)}},children:[f?o.jsx(Ta,{className:"h-4 w-4 animate-spin mr-2"}):null,"Delete"]})]})]})})]})}function BAn(e){return e&&{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",json:"json",md:"markdown",mdx:"mdx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",css:"css",scss:"scss",less:"less",html:"html",xml:"xml",yaml:"yaml",yml:"yaml",toml:"toml",sh:"bash",bash:"bash",zsh:"bash",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"dockerfile",makefile:"makefile",vue:"vue",svelte:"svelte"}[e.toLowerCase()]||null}function UAn({content:e,language:t}){return o.jsx(Jye,{language:t,style:eve.coldarkDark,customStyle:{margin:0,padding:"1rem",backgroundColor:"transparent",fontSize:"0.875rem"},codeTagProps:{style:{fontFamily:"var(--geist-mono), ui-monospace, monospace"}},children:e})}function VAn({path:e,content:t,isLoading:r,mimeType:n,onClose:s}){const a=e.split("/").pop()||e,i=a.split(".").pop()?.toLowerCase(),l=n?.startsWith("image/")||["png","jpg","jpeg","gif","svg","webp"].includes(i||""),c=BAn(i);return o.jsxs("div",{className:"rounded-lg border border-border1 overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-surface3 border-b border-border1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[$1t({name:a,type:"file"}),o.jsx("span",{className:"text-sm font-medium text-neutral6",children:a})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Xa,{content:t,copyMessage:"Copied file content"}),s&&o.jsx(pe,{variant:"ghost",size:"md",onClick:s,children:"Close"})]})]}),o.jsx("div",{className:"max-h-[500px] overflow-auto h-full",style:{backgroundColor:"black"},children:r?o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(Ta,{className:"h-6 w-6 animate-spin text-neutral3"})}):l?o.jsx("div",{className:"p-4 flex items-center justify-center",children:o.jsx("img",{src:`data:${n||"image/png"};base64,${btoa(t)}`,alt:a,className:"max-w-full max-h-[400px] object-contain"})}):c?o.jsx(UAn,{content:t,language:c}):o.jsx("pre",{className:"p-4 text-sm text-neutral5 whitespace-pre-wrap font-mono overflow-x-auto",children:t})})]})}const qAn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(xf,{}),titleSlot:"No Workspaces yet",descriptionSlot:o.jsxs(o.Fragment,{children:["Add a workspace to your Mastra configuration to ",o.jsx("br",{}),"manage files, skills, and enable semantic search."]}),actionSlot:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",o.jsx(ya,{})]})})}),HAn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(gMt,{}),titleSlot:"Workspace Not Configured",descriptionSlot:o.jsxs(o.Fragment,{children:["No workspace is configured. Add a workspace to your ",o.jsx("br",{}),"Mastra configuration to manage files, skills, and enable semantic search."]}),actionSlot:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",o.jsx(ya,{})]})})}),QAn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(tA,{}),titleSlot:"Workspace Not Supported",descriptionSlot:o.jsxs(o.Fragment,{children:["The workspace feature requires a newer version of ",o.jsx("code",{className:"text-neutral5",children:"@mastra/core"}),".",o.jsx("br",{}),"Please upgrade your dependencies to enable workspace functionality."]}),actionSlot:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",o.jsx(ya,{})]})})}),nre={bm25:{label:"Keyword",icon:o.jsx(Zi,{className:"h-3.5 w-3.5"}),color:"bg-blue-500/10 text-blue-400 border-blue-500/30"},vector:{label:"Semantic",icon:o.jsx(y_,{className:"h-3.5 w-3.5"}),color:"bg-purple-500/10 text-purple-400 border-purple-500/30"},hybrid:{label:"Hybrid",icon:o.jsx(rLt,{className:"h-3.5 w-3.5"}),color:"bg-amber-500/10 text-amber-400 border-amber-500/30"}};function B1t(e){return e.id.replace(/#chunk-\d+$/,"")}function WAn({onSearch:e,isSearching:t,searchResults:r,canBM25:n,canVector:s,onViewResult:a}){const[i,l]=b.useState(""),[c,u]=b.useState(5),d=()=>n&&s?"hybrid":n?"bm25":s?"vector":"bm25",[f,h]=b.useState(d()),p=g=>{g.preventDefault(),i.trim()&&e({query:i.trim(),topK:c,mode:f})},m=[...n?["bm25"]:[],...s?["vector"]:[],...n&&s?["hybrid"]:[]];return o.jsxs("div",{className:"rounded-lg bg-surface4",children:[o.jsxs("form",{onSubmit:p,className:"p-4",children:[o.jsxs("div",{className:"flex gap-3 items-center",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(NE,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-neutral3"}),o.jsx(sr,{value:i,onChange:g=>l(g.target.value),placeholder:"Search workspace files...",className:"pl-9 h-10 bg-surface2 border-border1"})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-xs text-neutral4",children:"Top"}),o.jsx(sr,{type:"number",min:1,max:50,value:c,onChange:g=>u(parseInt(g.target.value)||5),className:"w-14 h-10 text-center bg-surface2 border-border1",title:"Number of results"})]}),o.jsx(pe,{type:"submit",disabled:t||!i.trim(),size:"lg",className:"h-10 px-4",children:t?o.jsx(Ta,{className:"h-4 w-4 animate-spin"}):"Search"})]}),m.length>0&&o.jsx("div",{className:"flex gap-2 mt-3",children:m.map(g=>{const y=nre[g],x=f===g;return o.jsxs("button",{type:"button",onClick:()=>h(g),className:`
|
|
558
558
|
inline-flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium border transition-colors
|
|
559
559
|
${x?y.color:"bg-surface2 text-neutral4 border-transparent hover:bg-surface3"}
|
|
560
560
|
`,children:[y.icon,y.label]},g)})})]}),r&&o.jsxs("div",{className:"border-t border-border1",children:[o.jsxs("div",{className:"px-4 py-2 flex items-center justify-between text-xs",children:[o.jsxs("span",{className:"text-neutral4",children:[r.results.length," result",r.results.length!==1?"s":"",' for "',o.jsx("span",{className:"text-neutral6",children:r.query}),'"']}),o.jsx("span",{className:`px-1.5 py-0.5 rounded ${nre[r.mode].color}`,children:nre[r.mode].label})]}),r.results.length===0?o.jsx("div",{className:"px-4 py-8 text-center text-neutral4 text-sm",children:"No results found. Try a different query."}):o.jsx("ul",{className:"max-h-[320px] overflow-auto",children:r.results.map((g,y)=>o.jsx(GAn,{result:g,rank:y+1,onClick:()=>a?.(B1t(g))},`${g.id}-${y}`))})]})]})}function GAn({result:e,rank:t,onClick:r}){const n=Math.min(100,Math.max(0,e.score*100)),s=B1t(e);return o.jsx("li",{className:"border-t border-border1 first:border-t-0",children:o.jsxs("button",{onClick:r,className:"w-full px-4 py-3 text-left hover:bg-surface5 transition-colors flex gap-3",children:[o.jsx("span",{className:"text-xs text-neutral3 tabular-nums w-4 shrink-0",children:t}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx(jE,{className:"h-3.5 w-3.5 text-neutral4 shrink-0"}),o.jsx("span",{className:"font-mono text-sm text-neutral6 truncate",children:s}),o.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[o.jsx("div",{className:"w-12 h-1 rounded-full bg-surface2 overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full bg-accent1",style:{width:`${n}%`}})}),o.jsx("span",{className:"text-ui-xs text-neutral3 tabular-nums",children:e.score.toFixed(2)})]})]}),o.jsx("p",{className:"text-xs text-neutral4 line-clamp-2",children:e.content}),e.lineRange&&o.jsxs("p",{className:"text-xs text-neutral3 mt-1",children:["Lines ",e.lineRange.start,"–",e.lineRange.end]})]})]})})}function ZAn({onSearch:e,results:t,isSearching:r,onResultClick:n}){const[s,a]=b.useState(""),[i,l]=b.useState(5),[c,u]=b.useState(!0),d=f=>{f.preventDefault(),s.trim()&&e({query:s.trim(),topK:i,includeReferences:c})};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("form",{onSubmit:d,className:"space-y-3",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(NE,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-neutral3"}),o.jsx("input",{type:"text",value:s,onChange:f=>a(f.target.value),placeholder:"Search across skills...",className:"w-full pl-10 pr-4 py-2 rounded-lg bg-surface3 border border-border1 text-sm text-neutral6 placeholder:text-neutral3 focus:outline-hidden focus:ring-2 focus:ring-accent1"})]}),o.jsx(pe,{type:"submit",disabled:!s.trim()||r,children:r?o.jsx(Ta,{className:"h-4 w-4 animate-spin"}):"Search"})]}),o.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[o.jsxs("label",{className:"flex items-center gap-2 text-neutral4",children:[o.jsx("span",{children:"Results:"}),o.jsxs("select",{value:i,onChange:f=>l(Number(f.target.value)),className:"px-2 py-1 rounded bg-surface3 border border-border1 text-neutral5",children:[o.jsx("option",{value:3,children:"3"}),o.jsx("option",{value:5,children:"5"}),o.jsx("option",{value:10,children:"10"}),o.jsx("option",{value:20,children:"20"})]})]}),o.jsxs("label",{className:"flex items-center gap-2 text-neutral4 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:c,onChange:f=>u(f.target.checked),className:"rounded border-border1 bg-surface3"}),o.jsx("span",{children:"Include references"})]})]})]}),t.length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("h3",{className:"text-sm font-medium text-neutral5",children:["Found ",t.length," result",t.length!==1?"s":""]}),o.jsx("div",{className:"space-y-2",children:t.map((f,h)=>o.jsx(YAn,{result:f,onClick:()=>n?.(f)},`${f.skillName}-${f.source}-${h}`))})]})]})}function YAn({result:e,onClick:t}){const r=e.source!=="SKILL.md";return o.jsx("button",{onClick:t,className:"w-full p-4 rounded-lg bg-surface3 border border-border1 hover:border-accent1/50 text-left transition-colors",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"p-1.5 rounded bg-surface5 shrink-0 mt-0.5",children:r?o.jsx(Zi,{className:"h-3.5 w-3.5 text-neutral4"}):o.jsx(mC,{className:"h-3.5 w-3.5 text-neutral4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("span",{className:"font-medium text-neutral6",children:e.skillName}),o.jsx("span",{className:"text-xs text-neutral3",children:e.source}),o.jsxs("span",{className:"ml-auto text-xs text-neutral3",children:["Score: ",e.score.toFixed(3)]})]}),o.jsxs("p",{className:"text-sm text-neutral4 line-clamp-3 whitespace-pre-wrap",children:[e.content.slice(0,300),e.content.length>300&&"..."]}),e.lineRange&&o.jsxs("p",{className:"text-xs text-neutral3 mt-2",children:["Lines ",e.lineRange.start,"–",e.lineRange.end]})]})]})})}function XAn({skillName:e,onUpdate:t,isUpdating:r}){return o.jsx(Dn,{variant:"light",size:"sm",disabled:r,tooltip:`Update ${e}`,onClick:t,children:r?o.jsx(Ta,{className:"h-4 w-4 animate-spin"}):o.jsx(Ik,{className:"h-4 w-4"})})}function KAn({skillName:e,onRemove:t,isRemoving:r}){return o.jsxs(Bt,{children:[o.jsx(Bt.Trigger,{asChild:!0,children:o.jsx(Dn,{variant:"light",size:"sm",disabled:r,tooltip:`Remove ${e}`,children:r?o.jsx(Ta,{className:"h-4 w-4 animate-spin"}):o.jsx(nd,{className:"h-4 w-4"})})}),o.jsxs(Bt.Content,{children:[o.jsxs(Bt.Header,{children:[o.jsx(Bt.Title,{children:"Remove Skill"}),o.jsxs(Bt.Description,{children:['Are you sure you want to remove the skill "',e,'"? This action cannot be undone.']})]}),o.jsxs(Bt.Footer,{children:[o.jsx(Bt.Cancel,{children:"Cancel"}),o.jsx(Bt.Action,{onClick:t,children:"Remove"})]})]})]})}const JAn=".agents/skills/",Nve=[{name:"name",label:"Skill",size:"1fr"},{name:"description",label:"Description",size:"2fr"}],U1t=[...Nve,{name:"actions",label:"",size:"48px"}];function eIn(e,t){if(!e||!t||t.length===0)return null;for(const r of t)if(e.startsWith(r+"/")||e===r)return r;return null}function tIn({skills:e,isLoading:t,isSkillsConfigured:r=!0,hasUndiscoveredAgentSkills:n=!1,basePath:s="/workspace/skills",onAddSkill:a,onUpdateSkill:i,onRemoveSkill:l,updatingSkillName:c,removingSkillName:u,mountPaths:d}){const{navigate:f}=ir(),h=d&&d.length>0,p=w=>w.path?.includes(JAn)??!1,m=e.some(p),g=!!l||!!i,y=g&&m,x=y?U1t:Nve;return!r&&!t?o.jsx(nIn,{onAddSkill:a}):t?o.jsx(rIn,{hasRowActions:g}):o.jsxs("div",{className:"space-y-4",children:[a&&o.jsx("div",{className:"flex items-center gap-4",children:o.jsxs(pe,{variant:"default",size:"sm",onClick:a,children:[o.jsx(Ce,{children:o.jsx(cs,{className:"h-4 w-4"})}),"Add Skill"]})}),n&&o.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[o.jsx(kh,{className:"h-5 w-5 text-amber-500 shrink-0 mt-0.5"}),o.jsxs("div",{className:"text-sm",children:[o.jsx("p",{className:"font-medium text-amber-500",children:"Skills installed but not discovered"}),o.jsxs("p",{className:"text-neutral4 mt-1",children:["You have skills in ",o.jsx("code",{className:"px-1 py-0.5 rounded bg-surface4 text-xs",children:".agents/skills"})," that aren't being discovered. Add this path to your workspace skills configuration to see them."]})]})]}),o.jsx(po,{children:o.jsxs(po.Trim,{children:[o.jsx(po.Header,{columns:x}),e.length>0?o.jsx(po.Entries,{children:e.map(w=>{const S={id:w.path,name:w.name,description:w.description||"—"},k=h?eIn(w.path,d):null;return o.jsxs(po.Entry,{entry:S,columns:x,onClick:()=>{const _=`${s}/${encodeURIComponent(w.name)}?path=${encodeURIComponent(w.path)}`;f(_)},children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"p-1.5 rounded bg-surface5",children:o.jsx(mC,{className:"h-3.5 w-3.5 text-neutral4"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("span",{className:"font-medium text-neutral6",children:w.name}),w.path&&o.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[k&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral3 shrink-0",children:k}),o.jsx("span",{className:"text-[11px] text-neutral3 truncate",title:w.path,children:w.path})]})]})]}),o.jsx(po.EntryText,{children:w.description||"—"}),y&&o.jsx("div",{className:"flex justify-end gap-1",onClick:_=>_.stopPropagation(),children:p(w)&&o.jsxs(o.Fragment,{children:[i&&o.jsx(XAn,{skillName:w.name,onUpdate:()=>i(w.name),isUpdating:c===w.name}),l&&o.jsx(KAn,{skillName:w.name,onRemove:()=>l(w.name),isRemoving:u===w.name})]})})]},w.path)})}):o.jsx(po.Message,{message:a?'No skills discovered. Click "Add Skill" to install from skills.sh.':"No skills discovered. Add SKILL.md files to your skills directory."})]})})]})}function rIn({hasRowActions:e}){const t=e?U1t:Nve;return o.jsx(po,{children:o.jsxs(po.Trim,{children:[o.jsx(po.Header,{columns:t}),o.jsx(po.Entries,{children:Array.from({length:3}).map((r,n)=>o.jsxs(po.Entry,{columns:t,isLoading:!0,children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"h-7 w-7 rounded bg-surface4 animate-pulse"}),o.jsxs("div",{children:[o.jsx("div",{className:"h-4 w-32 rounded bg-surface4 animate-pulse"}),o.jsx("div",{className:"h-3 w-40 rounded bg-surface4 animate-pulse mt-1"})]})]}),o.jsx("div",{className:"h-4 w-48 rounded bg-surface4 animate-pulse"}),e&&o.jsx("div",{className:"h-4 w-6 rounded bg-surface4 animate-pulse"})]},n))})]})})}function nIn({onAddSkill:e}){return o.jsx("div",{className:"grid place-items-center py-16",children:o.jsxs("div",{className:"flex flex-col items-center text-center max-w-md",children:[o.jsx("div",{className:"p-4 rounded-full bg-surface4 mb-4",children:o.jsx(mC,{className:"h-8 w-8 text-neutral3"})}),o.jsx("h2",{className:"text-lg font-medium text-neutral6 mb-2",children:"Skills Not Configured"}),o.jsx("p",{className:"text-sm text-neutral4 mb-6",children:"No skills are configured in the workspace. Add SKILL.md files to your skills directory to discover and manage agent skills."}),o.jsxs("div",{className:"flex gap-3",children:[e&&o.jsxs(pe,{size:"lg",variant:"default",onClick:e,children:[o.jsx(Ce,{children:o.jsx(cs,{className:"h-4 w-4"})}),"Add Skill from skills.sh"]}),o.jsxs(pe,{size:"lg",variant:"light",as:"a",href:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[o.jsx(Ce,{children:o.jsx(yPt,{className:"h-4 w-4"})}),"Learn about Skills"]})]})]})})}function sIn(e){switch(e.type){case"external":return{icon:o.jsx(qb,{className:"h-3.5 w-3.5"}),label:"External Package",path:e.packagePath};case"local":return{icon:o.jsx(k2t,{className:"h-3.5 w-3.5"}),label:"Local Project",path:e.projectPath};case"managed":return{icon:o.jsx(QL,{className:"h-3.5 w-3.5"}),label:"Managed",path:e.mastraPath}}}function aIn({skill:e,rawSkillMd:t,onReferenceClick:r}){const[n,s]=b.useState(new Set(["instructions"])),[a,i]=b.useState(!1),l=sIn(e.source),c=u=>{s(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})};return o.jsxs("div",{className:"space-y-6 min-w-0 overflow-hidden",children:[o.jsxs("div",{className:"flex items-start gap-4",children:[o.jsx("div",{className:"p-3 rounded-lg bg-surface5",children:o.jsx(mC,{className:"h-6 w-6 text-neutral4"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h1",{className:"text-xl font-semibold text-neutral6",children:e.name}),o.jsx("p",{className:"text-sm text-neutral4 mt-1",children:e.description})]})]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[o.jsx(CT,{label:"Source",value:l.label,icon:l.icon}),o.jsx(CT,{label:"Path",value:e.path,icon:o.jsx(jE,{className:"h-3.5 w-3.5"})}),e.license&&o.jsx(CT,{label:"License",value:e.license}),e.compatibility!=null&&o.jsx(CT,{label:"Compatibility",value:e.compatibility}),o.jsx(CT,{label:"References",value:`${e.references.length} files`,icon:o.jsx(Zi,{className:"h-3.5 w-3.5"})})]}),o.jsx($L,{title:"Instructions",isExpanded:n.has("instructions"),onToggle:()=>c("instructions"),headerAction:o.jsxs("button",{onClick:u=>{u.stopPropagation(),i(!a)},className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs text-neutral4 hover:text-neutral5 hover:bg-surface4 transition-colors",title:a?"Show rendered":"Show source",children:[a?o.jsx(xo,{className:"h-3.5 w-3.5"}):o.jsx(UMt,{className:"h-3.5 w-3.5"}),a?"Rendered":"Source"]}),children:a?o.jsx("div",{style:{backgroundColor:"black"},className:"rounded-lg overflow-x-auto w-0 min-w-full",children:o.jsx(Jye,{language:"markdown",style:eve.coldarkDark,customStyle:{margin:0,padding:"1rem",backgroundColor:"transparent",fontSize:"0.875rem"},children:t??e.instructions})}):o.jsx(K_,{children:e.instructions})}),e.references.length>0&&o.jsx($L,{title:`References (${e.references.length})`,isExpanded:n.has("references"),onToggle:()=>c("references"),children:o.jsx("div",{className:"space-y-1",children:e.references.map(u=>o.jsxs("button",{onClick:()=>r?.(u),className:"flex items-center gap-2 w-full px-3 py-2 rounded hover:bg-surface4 text-left transition-colors",children:[o.jsx(Zi,{className:"h-4 w-4 text-neutral3"}),o.jsx("span",{className:"text-sm text-neutral5",children:u})]},u))})}),e.scripts.length>0&&o.jsx($L,{title:`Scripts (${e.scripts.length})`,isExpanded:n.has("scripts"),onToggle:()=>c("scripts"),children:o.jsx("div",{className:"space-y-1",children:e.scripts.map(u=>o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded bg-surface3",children:[o.jsx(pMt,{className:"h-4 w-4 text-neutral3"}),o.jsx("span",{className:"text-sm text-neutral5",children:u})]},u))})}),e.assets.length>0&&o.jsx($L,{title:`Assets (${e.assets.length})`,isExpanded:n.has("assets"),onToggle:()=>c("assets"),children:o.jsx("div",{className:"space-y-1",children:e.assets.map(u=>o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded bg-surface3",children:[o.jsx(rce,{className:"h-4 w-4 text-neutral3"}),o.jsx("span",{className:"text-sm text-neutral5",children:u})]},u))})}),o.jsx("div",{className:"pt-4 border-t border-border1",children:o.jsxs("p",{className:"text-xs text-neutral3",children:["Path: ",o.jsx("code",{className:"px-1 py-0.5 rounded bg-surface4",children:e.path})]})})]})}function V1t(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>typeof t=="string"?t:JSON.stringify(t)).join(", ");if(typeof e=="object"&&e!==null){const t=Object.keys(e);if(t.length===0)return"{}";if(t.length===1){const r=t[0],n=e[r];return Array.isArray(n)?`${r}: ${n.join(", ")}`:`${r}: ${V1t(n)}`}return`{${t.join(", ")}}`}return String(e)}function CT({label:e,value:t,icon:r}){const n=V1t(t);return o.jsxs("div",{className:"p-3 rounded-lg bg-surface3",children:[o.jsx("p",{className:"text-xs text-neutral3 mb-1",children:e}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[r&&o.jsx("span",{className:"text-neutral4",children:r}),o.jsx("p",{className:"text-sm font-medium text-neutral5 truncate",title:n,children:n})]})]})}function $L({title:e,isExpanded:t,onToggle:r,headerAction:n,children:s}){return o.jsxs("div",{className:"border border-border1 rounded-lg overflow-hidden min-w-0",children:[o.jsxs("div",{className:"flex items-center bg-surface3 hover:bg-surface4 transition-colors",children:[o.jsxs("button",{onClick:r,className:"flex items-center gap-2 flex-1 px-4 py-3",children:[t?o.jsx(ss,{className:"h-4 w-4 text-neutral3"}):o.jsx(Vs,{className:"h-4 w-4 text-neutral3"}),o.jsx("span",{className:"text-sm font-medium text-neutral5",children:e})]}),n&&o.jsx("div",{className:"pr-3",children:n})]}),t&&o.jsx("div",{className:"p-4 bg-surface2 overflow-x-auto w-0 min-w-full",children:s})]})}function iIn({open:e,onOpenChange:t,skillName:r,referencePath:n,content:s,isLoading:a,error:i}){const{isCopied:l,copyToClipboard:c}=P8({copiedDuration:2e3});if(!e)return null;const u=()=>{s&&c(s)};return o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[o.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>t(!1)}),o.jsxs("div",{className:"relative w-full max-w-4xl max-h-[85vh] mx-4 bg-surface2 rounded-xl border border-border1 shadow-2xl flex flex-col overflow-hidden",role:"dialog","aria-modal":"true","aria-labelledby":"reference-viewer-title",onKeyDown:d=>{d.key==="Escape"&&t(!1)},children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border1 bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"p-1.5 rounded bg-surface5",children:o.jsx(Zi,{className:"h-4 w-4 text-neutral4"})}),o.jsxs("div",{children:[o.jsx("h2",{id:"reference-viewer-title",className:"text-base font-medium text-neutral6",children:n}),o.jsxs("p",{className:"text-xs text-neutral3",children:["from ",r]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(pe,{size:"md",variant:"light",onClick:u,disabled:!s||a,children:[o.jsx(Ce,{children:l?o.jsx(ta,{className:"h-3.5 w-3.5 text-green-400"}):o.jsx(ru,{className:"h-3.5 w-3.5"})}),l?"Copied!":"Copy"]}),o.jsx("button",{onClick:()=>t(!1),"aria-label":"Close reference viewer",className:"p-2 rounded-lg hover:bg-surface4 text-neutral3 hover:text-neutral5 transition-colors",children:o.jsx(Nn,{className:"h-4 w-4"})})]})]}),o.jsx("div",{className:"flex-1 overflow-auto p-6",children:a?o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx("div",{className:"h-6 w-6 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})}):i?o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[o.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load reference"}),o.jsx("p",{className:"text-sm text-neutral3",children:i})]}):s?o.jsx("pre",{className:"whitespace-pre-wrap text-sm text-neutral5 font-mono bg-surface3 p-4 rounded-lg overflow-auto",children:s}):o.jsx("div",{className:"flex items-center justify-center py-12 text-neutral3",children:"No content available"})})]})]})}function VBe(e){return`${e.topSource}/${e.name}`}function qBe(e){const t=KSt(e.topSource,e.name);return t?`${t.owner}/${t.repo}/${e.name}`:null}function oIn({open:e,onOpenChange:t,workspaceId:r,onInstall:n,isInstalling:s,installedSkillIds:a=[],installedSkillNames:i=[],writableMounts:l,installedSkillPaths:c}){const[u,d]=b.useState(""),[f,h]=b.useState(null),[p,m]=b.useState(l&&l.length>0?l[0]?.path:void 0),{data:g,isLoading:y}=h_n(r),x=f_n(r),w=b.useMemo(()=>f?.topSource?KSt(f.topSource,f.name):null,[f]),S=b.useMemo(()=>!w||!f?null:`https://skills.sh/${w.owner}/${w.repo}/${f.name}`,[w,f]),{data:k,isLoading:_}=p_n(r,w?.owner,w?.repo,f?.name,{enabled:!!w&&!!f}),E=g1(M=>{M.trim().length>=2&&x.mutate(M)},300),T=b.useCallback(M=>{d(M),E(M)},[E]),j=b.useMemo(()=>u.trim().length>=2?x.data?.skills??[]:g?.skills??[],[u,x.data,g]),N=x.isPending,I=u.trim().length>=2,P=b.useMemo(()=>{if(!f)return!1;const M=qBe(f);return!!(M&&a.includes(M)||i.includes(f.name))},[f,a,i]),R=b.useCallback(()=>{!f||!w||n({repository:`${w.owner}/${w.repo}`,skillName:f.name,mount:l&&l.length>1?p:void 0})},[f,w,n,l,p]),$=b.useCallback(M=>{M||(d(""),h(null),m(l?.[0]?.path)),t(M)},[t,l]);return o.jsx(kn,{open:e,onOpenChange:$,children:o.jsxs(xn,{className:"max-w-4xl h-[80vh] flex flex-col",children:[o.jsxs(_n,{children:[o.jsx(wn,{children:"Add Skill"}),o.jsx(Js,{children:"Search and install skills from the community registry"})]}),o.jsxs(qn,{className:"flex-1 flex flex-col gap-4 overflow-hidden max-h-none",children:[o.jsxs("div",{className:"relative",children:[o.jsx(NE,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-neutral3"}),o.jsx(sr,{placeholder:"Search skills...",value:u,onChange:M=>T(M.target.value),className:"pl-9"})]}),o.jsxs("div",{className:"flex flex-1 gap-4 min-h-0",children:[o.jsxs("div",{className:"w-1/2 flex flex-col min-h-0",children:[o.jsx("div",{className:"text-xs font-medium text-neutral4 uppercase tracking-wide mb-2",children:I?"Search Results":"Popular Skills"}),o.jsx(Ms,{className:"flex-1 border border-border1 rounded-lg",children:y||N?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(Ta,{className:"h-6 w-6 animate-spin text-neutral3"})}):j.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-neutral4",children:[o.jsx(qb,{className:"h-8 w-8 mb-2"}),o.jsx("p",{className:"text-sm",children:I?"No skills found":"No skills available"})]}):o.jsx("div",{className:"p-2 space-y-1",children:j.map(M=>{const z=VBe(M),U=qBe(M),B=U&&a.includes(U)||i.includes(M.name),H=f?VBe(f):null;return o.jsx("button",{onClick:()=>h(M),className:Z("w-full text-left px-3 py-2 rounded-md transition-colors","hover:bg-surface4",H===z&&"bg-surface5 border border-accent1"),children:o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-medium text-sm text-neutral6 truncate",children:M.name}),B&&o.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-accent1/20 text-accent1",children:[o.jsx(ta,{className:"h-2.5 w-2.5"}),"Installed"]})]}),o.jsx("div",{className:"text-xs text-neutral4 truncate",children:M.topSource})]}),o.jsxs("div",{className:"flex items-center gap-1 text-xs text-neutral3 shrink-0",children:[o.jsx(Ik,{className:"h-3 w-3"}),o.jsx("span",{children:M.installs.toLocaleString()})]})]})},z)})})})]}),o.jsxs("div",{className:"w-1/2 flex flex-col min-h-0",children:[o.jsx("div",{className:"text-xs font-medium text-neutral4 uppercase tracking-wide mb-2",children:"Preview"}),o.jsx("div",{className:"flex-1 border border-border1 rounded-lg overflow-hidden flex flex-col",children:f?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"p-4 border-b border-border1 bg-surface3",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"p-2 rounded-lg bg-surface5",children:o.jsx(mC,{className:"h-5 w-5 text-neutral4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h3",{className:"font-semibold text-neutral6 truncate",children:f.name}),o.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-neutral4",children:[o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(p2t,{className:"h-3 w-3"}),f.topSource]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(Ik,{className:"h-3 w-3"}),f.installs.toLocaleString()," installs"]})]})]}),w&&o.jsx("a",{href:`https://github.com/${w.owner}/${w.repo}`,target:"_blank",rel:"noopener noreferrer",className:"text-neutral4 hover:text-neutral5 transition-colors",title:"View on GitHub",children:o.jsx(ya,{className:"h-4 w-4"})})]})}),_?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ta,{className:"h-6 w-6 animate-spin text-neutral3"})}):k?o.jsx(Ms,{className:"flex-1",children:o.jsx("div",{className:"p-4",children:o.jsx(K_,{children:k})})}):o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral4",children:[o.jsx(qb,{className:"h-8 w-8 mb-2"}),o.jsx("p",{className:"text-sm",children:"Preview unavailable"}),S&&o.jsxs("a",{href:S,target:"_blank",rel:"noopener noreferrer",className:"text-xs mt-2 text-accent1 hover:underline flex items-center gap-1",children:["View on skills.sh ",o.jsx(ya,{className:"h-3 w-3"})]})]})]}):o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-neutral4",children:[o.jsx(qb,{className:"h-8 w-8 mb-2"}),o.jsx("p",{className:"text-sm",children:"Select a skill to preview"})]})})]})]}),f&&o.jsxs("div",{className:"flex flex-col gap-3 pt-4 border-t border-border1",children:[l&&l.length>1&&o.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-surface3 border border-border1",children:[o.jsx(oc,{className:"h-4 w-4 text-icon4 shrink-0"}),o.jsx("label",{htmlFor:"mount-select",className:"text-sm text-icon5 whitespace-nowrap font-medium",children:"Install to"}),o.jsx("select",{id:"mount-select",value:p??"",onChange:M=>m(M.target.value),className:"flex-1 text-sm px-3 py-1.5 rounded-md border border-border1 bg-surface2 text-icon6",children:l.map(M=>{const z=M.displayName??M.name??M.provider??"unknown";return o.jsxs("option",{value:M.path,children:[z," (",M.path,")"]},M.path)})})]}),o.jsxs("div",{className:"flex items-center justify-end gap-2",children:[P&&l&&l.length>1&&f&&c?.[f.name]&&(()=>{const M=c[f.name],z=l.find(U=>M.startsWith(U.path+"/")||M===U.path);return z?o.jsxs("span",{className:"text-xs text-icon4",children:["Installed at ",z.path]}):null})(),o.jsx(pe,{variant:"light",onClick:()=>$(!1),children:"Cancel"}),o.jsx(pe,{variant:"primary",onClick:R,disabled:!w||s||P,"data-testid":"install-skill-button",children:s?o.jsxs(o.Fragment,{children:[o.jsx(Ta,{className:"h-4 w-4 mr-2 animate-spin"}),"Installing..."]}):P?o.jsxs(o.Fragment,{children:[o.jsx(ta,{className:"h-4 w-4 mr-2"}),"Already Installed"]}):o.jsxs(o.Fragment,{children:[o.jsx(Ik,{className:"h-4 w-4 mr-2"}),"Install"]})})]})]})]})]})})}function HBe(){const{workspaceId:e}=ra(),[t,r]=so(),n=fu(),[s,a]=b.useState(!1),[i,l]=b.useState(!1),[c,u]=b.useState(!1),[d,f]=b.useState(null),[h,p]=b.useState(null),[m,g]=b.useState(!1),y=t.get("file"),x=t.get("tab"),{data:w,error:S,isLoading:k}=YSt(),_=w?.workspaces??[],E=e??_[0]?.id,{data:T,isLoading:j,error:N}=r_n(E),I=Ps(S)||Ps(N),P=ks(S)||ks(N),R=t.get("path")||".",$=Sle(S)||Sle(N),M=E?_.find(Re=>Re.id===E):void 0,z=Re=>{const it=new URLSearchParams(t);for(const[rt,ht]of Object.entries(Re))ht===null?it.delete(rt):it.set(rt,ht);r(it)},U=Re=>{g(!1),a(!1),n(`/workspaces/${Re}`)},B=Re=>{z({path:Re==="."||Re===""?null:Re,file:null})},H=Re=>{z({file:Re})},W=Re=>{z({tab:Re})},L=R,Y=y,{data:q,isLoading:D,error:Q,refetch:G}=n_n(L,{enabled:T?.isWorkspaceConfigured&&T?.capabilities?.hasFilesystem,workspaceId:E}),J=a_n(),ae=i_n(),{data:re,isLoading:se}=XSt(Y??"",{enabled:!!Y,workspaceId:E}),{data:oe,isLoading:he,refetch:X}=l_n({workspaceId:E}),te=m_n(),le=g_n(),ve=y_n(),ue=T?.isWorkspaceConfigured??!1,fe=T?.capabilities?.hasFilesystem??!1,xe=T?.capabilities?.hasSkills??!1,Se=T?.capabilities?.canBM25??!1,Ne=T?.capabilities?.canVector??!1,K=M?.safety?.readOnly??!1,ie=fe&&!K,be=T?.mounts,Ae=be?.filter(Re=>!Re.readOnly).map(Re=>({path:Re.path,displayName:Re.displayName,icon:Re.icon,provider:Re.provider,name:Re.name})),$e=be&&be.length>1?be.map(Re=>Re.path):void 0,ye=b.useCallback(Re=>{E&&te.mutate({...Re,workspaceId:E},{onSuccess:async it=>{if(it.success){u(!1);const{data:rt,error:ht}=await X();if(ht||!rt){ze.success(`Skill "${it.skillName}" installed successfully (${it.filesWritten} files)`);return}rt.skills.some($r=>$r.name===it.skillName)?ze.success(`Skill "${it.skillName}" installed successfully (${it.filesWritten} files)`):(g(!0),ze.warning(`Skill "${it.skillName}" installed to .agents/skills but not discovered. Add .agents/skills to your workspace skills paths.`))}else ze.error("Failed to install skill")},onError:it=>{ze.error(`Failed to install skill: ${it instanceof Error?it.message:"Unknown error"}`)}})},[E,te,X]),ke=b.useCallback(Re=>{E&&(p(Re),le.mutate({workspaceId:E,skillName:Re},{onSuccess:it=>{if(p(null),it.updated.length>0){const rt=it.updated[0];rt.success?(ze.success(`Skill "${Re}" updated successfully (${rt.filesWritten} files)`),X()):ze.error(`Failed to update skill: ${rt.error??"Unknown error"}`)}else ze.error("Failed to update skill: No update result returned")},onError:it=>{p(null),ze.error(`Failed to update skill: ${it instanceof Error?it.message:"Unknown error"}`)}}))},[E,le,X]),ge=b.useCallback(Re=>{E&&(f(Re),ve.mutate({workspaceId:E,skillName:Re},{onSuccess:it=>{f(null),it.success?(ze.success(`Skill "${it.skillName}" removed successfully`),X()):ze.error(`Failed to remove skill "${it.skillName}"`)},onError:it=>{f(null),ze.error(`Failed to remove skill: ${it instanceof Error?it.message:"Unknown error"}`)}}))},[E,ve,X]),Fe=x==="files"&&fe?"files":x==="skills"&&xe?"skills":fe?"files":xe?"skills":"files",ct=oe?.skills??[],wt=oe?.isSkillsConfigured??!1,or=q?.entries??[],Ve=fe&&(Se||Ne),qe=xe&&wt&&ct.length>0,Ie=Ve||qe;if(k)return o.jsx(Jr,{title:"Workspace",icon:o.jsx(oc,{}),children:o.jsx(Mt,{})});if(I)return o.jsx(Jr,{title:"Workspace",icon:o.jsx(oc,{}),children:o.jsx(na,{})});if(P)return o.jsx(Jr,{title:"Workspace",icon:o.jsx(oc,{}),children:o.jsx(Gs,{resource:"workspaces"})});if($)return o.jsx(Jr,{title:"Workspace",icon:o.jsx(oc,{}),children:o.jsx(QAn,{})});const Le=S||N;return Le?o.jsx(Jr,{title:"Workspace",icon:o.jsx(oc,{}),children:o.jsx(gu,{title:"Failed to load workspace",message:Le.message})}):!k&&_.length===0?o.jsx(Jr,{title:"Workspace",icon:o.jsx(oc,{}),children:o.jsx(qAn,{})}):!j&&!k&&!ue?o.jsx(Jr,{title:"Workspace",icon:o.jsx(oc,{}),children:o.jsx(HAn,{})}):o.jsxs(bt,{children:[o.jsx(bt.TopArea,{children:o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsxs(yn,{children:[o.jsxs(yn.Title,{children:[o.jsx(oc,{})," Workspace"]}),o.jsx(yn.Description,{children:"Manage files, skills, and search your workspace"})]})}),o.jsxs(bt.Column,{className:"flex justify-end gap-2",children:[Ie&&o.jsx(Cn,{onClick:()=>a(!s),tooltipContent:"Search workspace","aria-label":"Search workspace",children:o.jsx(NE,{})}),o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workspaces documentation","aria-label":"Workspaces documentation",children:o.jsx(Di,{})})]})]})}),o.jsxs(bt.MainArea,{className:"grid content-start gap-6",children:[_.length>1&&o.jsxs("div",{className:"relative",children:[o.jsxs("button",{onClick:()=>l(!i),className:"flex items-center gap-2 px-3 py-2 text-sm border border-border1 rounded-lg bg-surface2 hover:bg-surface3 transition-colors w-full max-w-md",children:[M?.source==="agent"?o.jsx(qL,{className:"h-4 w-4 text-accent1"}):o.jsx(QL,{className:"h-4 w-4 text-neutral4"}),o.jsxs("span",{className:"flex-1 text-left truncate",children:[M?.name??"Select workspace",M?.source==="agent"&&M.agentName&&o.jsxs("span",{className:"text-neutral4 ml-1",children:["(",M.agentName,")"]})]}),o.jsx(ss,{className:`h-4 w-4 text-neutral4 transition-transform ${i?"rotate-180":""}`})]}),i&&o.jsx("div",{className:"absolute z-50 mt-1 w-full max-w-md bg-surface2 border border-border1 rounded-lg shadow-lg overflow-hidden",children:_.map(Re=>o.jsxs("button",{onClick:()=>{U(Re.id),l(!1)},className:`flex items-center gap-3 px-3 py-2 w-full text-left hover:bg-surface3 transition-colors ${M?.id===Re.id?"bg-surface3":""}`,children:[Re.source==="agent"?o.jsx(qL,{className:"h-4 w-4 text-accent1 shrink-0"}):o.jsx(QL,{className:"h-4 w-4 text-neutral4 shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-sm font-medium text-neutral6 truncate",children:Re.name}),o.jsx("div",{className:"text-xs text-neutral4 truncate",children:Re.source==="agent"?`Agent: ${Re.agentName}`:"Global workspace"})]}),o.jsxs("div",{className:"flex gap-1 shrink-0",children:[Re.safety?.readOnly&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"}),Re.capabilities.hasFilesystem&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"FS"}),Re.capabilities.hasSandbox&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Sandbox"}),Re.capabilities.hasSkills&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Skills"})]})]},Re.id))})]}),_.length===1&&M&&o.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral4",children:[M.source==="agent"?o.jsx(qL,{className:"h-4 w-4 text-accent1"}):o.jsx(QL,{className:"h-4 w-4"}),o.jsx("span",{children:M.name}),M.source==="agent"&&M.agentName&&o.jsxs("span",{className:"text-neutral3",children:["(",M.agentName,")"]}),K&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"})]}),s&&Ie&&E&&o.jsx(lIn,{workspaceId:E,canSearchFiles:Ve,canSearchSkills:qe,canBM25:Se,canVector:Ne,showInitWarning:!j&&T?.status!=="ready",onViewFileResult:Re=>{z({file:Re,tab:"files"})},onViewSkillResult:(Re,it)=>{E&&n(`/workspaces/${E}/skills/${encodeURIComponent(Re)}?path=${encodeURIComponent(it)}`)}},E),o.jsxs("div",{className:"flex gap-2 border-b border-border1",children:[fe&&o.jsxs("button",{onClick:()=>W("files"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Fe==="files"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[o.jsx(Zi,{className:"h-4 w-4"}),"Files"]}),xe&&o.jsxs("button",{onClick:()=>W("skills"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Fe==="skills"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[o.jsx(h3,{className:"h-4 w-4"}),"Skills",wt&&ct.length>0&&o.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:ct.length})]})]}),o.jsxs("div",{className:"pb-8",children:[Fe==="files"&&fe&&o.jsx("div",{className:"space-y-4",children:o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[o.jsx(zAn,{entries:or,currentPath:L,isLoading:D,error:Q,onNavigate:B,onFileSelect:H,onRefresh:()=>G(),onCreateDirectory:K?void 0:Re=>ae.mutate({path:Re,workspaceId:E}),onDelete:K?void 0:Re=>J.mutate({path:Re,recursive:!0,force:!0,workspaceId:E})}),Y&&o.jsx(VAn,{path:Y,content:re?.content??"",isLoading:se,mimeType:re?.mimeType,onClose:()=>H(null)})]})}),Fe==="skills"&&xe&&o.jsx(tIn,{skills:ct,isLoading:he,isSkillsConfigured:wt,hasUndiscoveredAgentSkills:m,basePath:E?`/workspaces/${E}/skills`:"/workspaces",onAddSkill:ie?()=>u(!0):void 0,onUpdateSkill:ie?ke:void 0,onRemoveSkill:ie?ge:void 0,updatingSkillName:h??void 0,removingSkillName:d??void 0,mountPaths:$e}),!fe&&!xe&&!j&&o.jsx("div",{className:"py-12 text-center text-neutral4",children:o.jsx("p",{children:"No workspace capabilities are configured."})})]})]}),E&&ie&&o.jsx(oIn,{open:c,onOpenChange:u,workspaceId:E,onInstall:ye,isInstalling:te.isPending,installedSkillIds:ct.filter(Re=>Re.skillsShSource).map(Re=>`${Re.skillsShSource.owner}/${Re.skillsShSource.repo}/${Re.name}`),installedSkillNames:ct.filter(Re=>!Re.skillsShSource).map(Re=>Re.name),writableMounts:Ae,installedSkillPaths:Object.fromEntries(ct.filter(Re=>Re.path).map(Re=>[Re.name,Re.path]))})]})}function lIn({workspaceId:e,canSearchFiles:t,canSearchSkills:r,canBM25:n,canVector:s,showInitWarning:a,onViewFileResult:i,onViewSkillResult:l}){const c=o_n(),u=d_n();return o.jsxs("div",{className:"border border-border1 rounded-lg p-4 bg-surface2 space-y-4",children:[t&&o.jsxs("div",{children:[o.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[o.jsx(Zi,{className:"h-4 w-4"}),"Search Indexed Files"]}),a&&o.jsxs("p",{className:"text-xs text-amber-400 mb-3",children:["File search requires ",o.jsx("code",{className:"text-amber-300",children:"workspace.init()"})," to index files from your configured ",o.jsx("code",{className:"text-amber-300",children:"autoIndexPaths"}),"."]}),o.jsx(WAn,{onSearch:d=>c.mutate({...d,workspaceId:e}),isSearching:c.isPending,searchResults:c.data?{...c.data,results:c.data.results.filter(d=>!d.id.startsWith("skill:"))}:void 0,canBM25:n,canVector:s,onViewResult:i})]}),r&&o.jsxs("div",{children:[o.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[o.jsx(h3,{className:"h-4 w-4"}),"Search Skills"]}),o.jsx(ZAn,{onSearch:d=>u.mutate({...d,workspaceId:e}),results:u.data?.results??[],isSearching:u.isPending,onResultClick:d=>l(d.skillName,d.skillPath)})]})]})}function cIn(e,t){return e==null||t==null?null:e in t?e:null}function uIn(){const{skillName:e,workspaceId:t}=ra(),[r]=so(),n=ba(),s=e?decodeURIComponent(e):"",a=r.get("path"),i=a?decodeURIComponent(a):void 0,l=r.get("agentId"),c=l?decodeURIComponent(l):null,d=n.getQueriesData({queryKey:["agents"]})?.[0]?.[1]??null,f=cIn(c,d),h=f?`/agents/${f}`:t?`/workspaces/${t}?tab=skills`:"/workspaces",[p,m]=b.useState(null),{data:g,isLoading:y,error:x}=c_n(s,{workspaceId:t,path:i}),{data:w}=XSt(g?.path?`${g.path}/SKILL.md`:"",{enabled:!!g?.path,workspaceId:t}),{data:S,isLoading:k}=u_n(s,p??"",{enabled:!!p,workspaceId:t,path:i}),_=E=>f?o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:h,children:[o.jsx(Ce,{children:o.jsx(qL,{className:"h-4 w-4"})}),f]}),o.jsxs(jr,{as:"span",to:"",isCurrent:!0,children:[o.jsx(Ce,{children:o.jsx(h3,{className:"h-4 w-4"})}),E]})]}):o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:h,children:[o.jsx(Ce,{children:o.jsx(oc,{className:"h-4 w-4"})}),"Workspace"]}),o.jsxs(jr,{as:dr,to:h,children:[o.jsx(Ce,{children:o.jsx(h3,{className:"h-4 w-4"})}),"Skills"]}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:E})]});return y?o.jsxs(zr,{children:[o.jsx(En,{children:_("Loading...")}),o.jsx("div",{className:"grid place-items-center h-full",children:o.jsx("div",{className:"h-8 w-8 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})})]}):x&&Ps(x)?o.jsxs(zr,{children:[o.jsx(En,{children:_("Session Expired")}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})]}):x&&ks(x)?o.jsxs(zr,{children:[o.jsx(En,{children:_("Permission Denied")}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"workspaces"})})]}):x||!g?o.jsxs(zr,{children:[o.jsx(En,{children:_("Error")}),o.jsx("div",{className:"grid place-items-center h-full",children:o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load skill"}),o.jsx("p",{className:"text-sm text-neutral3",children:x?.message??"Skill not found"})]})})]}):o.jsxs(zr,{children:[o.jsxs(En,{children:[_(g.name),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[o.jsx(Ce,{children:o.jsx(u0,{})}),"Documentation"]})})]}),o.jsx("div",{className:"grid overflow-y-auto overflow-x-hidden h-full",children:o.jsx("div",{className:"max-w-[100rem] px-[3rem] mx-auto py-8 h-full w-full overflow-x-hidden",children:o.jsx(aIn,{skill:g,rawSkillMd:w?.content,onReferenceClick:m})})}),o.jsx(iIn,{open:!!p,onOpenChange:E=>!E&&m(null),skillName:g.name,referencePath:p??"",content:S?.content,isLoading:k})]})}const q1t=()=>{const e=window.MASTRA_CLOUD_API_ENDPOINT;return{isMastraPlatform:!!e,mastraPlatformEndpoint:e}},dIn=[{key:"primitives",title:"Primitives",href:"/primitives",links:[{name:"Agents",url:"/agents",icon:o.jsx(pa,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"agents:read"},{name:"Prompts",url:"/prompts",icon:o.jsx(Zi,{}),isOnMastraPlatform:!0,indent:!0},{name:"Workflows",url:"/workflows",icon:o.jsx(Mi,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workflows:read"},{name:"Processors",url:"/processors",icon:o.jsx(nS,{}),isOnMastraPlatform:!1,indent:!0,requiredPermission:"processors:read"},{name:"MCP Servers",url:"/mcps",icon:o.jsx(vl,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"mcps:read"},{name:"Tools",url:"/tools",icon:o.jsx(Pi,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"tools:read"},{name:"Workspaces",url:"/workspaces",icon:o.jsx(oc,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workspaces:read"},{name:"Request Context",url:"/request-context",icon:o.jsx(TE,{}),isOnMastraPlatform:!0,indent:!0}]},{key:"evaluation",title:"Evaluation",href:"/evaluation",links:[{name:"Scorers",url:"/scorers",icon:o.jsx(Ma,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"scorers:read"},{name:"Datasets",url:"/datasets",icon:o.jsx(ja,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]},{name:"Experiments",url:"/experiments",icon:o.jsx(Au,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]}]},{key:"observability",title:"Observability",href:"/observability-overview",links:[{name:"Metrics",url:"/metrics",icon:o.jsx(ik,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Traces",url:"/observability",activePaths:["/traces"],icon:o.jsx(xo,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Logs",url:"/logs",icon:o.jsx(HL,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"}]},{key:"bottom",separator:!0,links:[{name:"Settings",url:"/settings",icon:o.jsx(ume,{}),isOnMastraPlatform:!1},{name:"Resources",url:"/resources",icon:o.jsx(Di,{}),isOnMastraPlatform:!0}]}];function QBe(e,t){const r=n=>t===n||t.startsWith(n+"/");return r(e.url)?!0:e.activePaths?.some(r)??!1}function fIn(){const{Link:e}=ir(),{state:t}=bme(),n=_c().pathname,{isMastraPlatform:s}=q1t(),{data:a}=SC(),{isCmsAvailable:i,isLoading:l}=lM(),{hasPermission:c,hasAnyPermission:u,rbacEnabled:d,isAuthenticated:f,isLoading:h}=Ev(),p=a&&qP(a),m=new Set(["/prompts"]),g=y=>m.has(y.url)&&!i&&!l||s&&!y.isOnMastraPlatform?!1:d&&f&&h?!0:!(y.requiredPermission&&!c(y.requiredPermission)||y.requiredAnyPermission&&!u(y.requiredAnyPermission));return o.jsxs(Gh,{children:[o.jsx("div",{className:"pt-3 mb-4 -ml-0.5 sticky top-0 bg-surface1 z-10",children:t==="collapsed"?o.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[o.jsx(tx,{className:"h-[1.5rem] w-[1.5rem] shrink-0 ml-3"}),p&&o.jsx(Nle,{})]}):p?o.jsxs("span",{className:"flex items-center justify-between pl-3 pr-2",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(tx,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),o.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]}),o.jsx(Nle,{})]}):o.jsxs("span",{className:"flex items-center gap-2 pl-3",children:[o.jsx(tx,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),o.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]})}),o.jsx(Gh.Nav,{children:dIn.map(y=>{const x=y.links.filter(g),w=x.length>0&&y?.separator,S=x.some(_=>QBe(_,n)),k=!!(y.href&&n===y.href&&!S);return o.jsxs(Gh.NavSection,{children:[y?.title?o.jsx(Gh.NavHeader,{LinkComponent:e,state:t,href:y.href,isActive:k,children:y.title}):o.jsx(o.Fragment,{children:w&&o.jsx(Gh.NavSeparator,{})}),o.jsx(Gh.NavList,{children:x.map(_=>{const E=QBe(_,n);return o.jsx(Gh.NavLink,{LinkComponent:e,state:t,link:_,isActive:E},_.name)})})]},y.key)})}),o.jsxs(Gh.Bottom,{children:[t!=="collapsed"&&o.jsxs(o.Fragment,{children:[o.jsx(Gh.NavSeparator,{}),o.jsx(n1n,{collapsed:!1})]}),o.jsx(Gh.NavSeparator,{}),o.jsx("div",{className:"flex justify-end pb-3",children:o.jsx(Gh.Trigger,{})})]})]})}const hIn=b.createContext({theme:"dark",setTheme:()=>null}),pIn=e=>e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";function H1t({children:e}){const t=Qn(s=>s.theme),r=Qn(s=>s.setTheme),n=t==="light"||t==="system"?t:"dark";return b.useEffect(()=>{const s=window.document.documentElement,a=c=>{const u=pIn(c);s.classList.remove("light","dark"),s.classList.add(u)};if(a(n),n!=="system")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>a("system");return i.addEventListener("change",l),()=>{i.removeEventListener("change",l)}},[n]),o.jsx(hIn.Provider,{value:{theme:n,setTheme:r},children:e})}function Q1t({children:e,loginUrl:t="/login",signupUrl:r="/signup"}){const{data:n,isLoading:s}=SC();if(s)return o.jsx(o.Fragment,{children:e});if(!n?.enabled)return o.jsx(o.Fragment,{children:e});if(qP(n))return o.jsx(o.Fragment,{children:e});const a=typeof window<"u"?window.location.href:void 0;if(!n.login)return o.jsx("div",{className:"flex h-full w-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center space-y-6 text-center",children:[o.jsx(tx,{className:"h-16 w-16 opacity-50"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-xl font-semibold text-neutral6",children:"Authentication Required"}),o.jsx("p",{className:"max-w-sm text-neutral3",children:"This page requires authentication, but no login method is configured. Please contact your administrator."})]})]})});const i=()=>{const l=new URL(r,window.location.origin);a&&l.searchParams.set("redirect",a),window.location.href=l.toString()};return o.jsx("div",{className:"flex h-full w-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center space-y-6 text-center",children:[o.jsx(tx,{className:"h-16 w-16 opacity-50"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-xl font-semibold text-neutral6",children:"Sign in to continue"}),o.jsx("p",{className:"max-w-sm text-neutral3",children:"You need to sign in to access this page."})]}),o.jsx(S1t,{config:n.login,redirectUri:a,loginUrl:t}),(n.login.type==="credentials"||n.login.type==="both")&&n.login.signUpEnabled!==!1&&o.jsxs("div",{className:"text-sm",children:[o.jsx("span",{className:"text-neutral3",children:"Don't have an account? "}),o.jsx("button",{type:"button",onClick:i,className:"text-neutral6 hover:underline",children:"Sign up"})]})]})})}const W1t="experimental-ui:",G1t="current",mIn=je.createContext(null);function gIn(e,t){const r=window.localStorage.getItem(W1t+e);return r&&t.has(r)?r:G1t}function yIn({experiments:e,children:t}){const r=je.useMemo(()=>new Map(e.map(c=>[c.key,new Set(c.variants.map(u=>u.value))])),[e]),[n,s]=je.useState({});je.useLayoutEffect(()=>{const c={};for(const u of e){const d=r.get(u.key);c[u.key]=gIn(u.key,d)}s(c)},[e,r]);const a=je.useCallback(c=>n[c]??G1t,[n]),i=je.useCallback((c,u)=>{window.localStorage.setItem(W1t+c,u),s(d=>({...d,[c]:u}))},[]),l=je.useMemo(()=>({experiments:e,getVariant:a,setVariant:i}),[e,a,i]);return o.jsx(mIn.Provider,{value:l,children:t})}const vIn=[{key:"entity-list-page",name:"Entity List page UI",path:["/agents","/prompts","/tools","/datasets","/scorers","/mcps","/workflows","/processors"],variants:[{value:"current",label:"Current state"},{value:"new-proposal",label:"New proposal"}]}],bIn=()=>({experimentalUIEnabled:typeof window<"u"&&window.MASTRA_EXPERIMENTAL_UI==="true"}),xIn=()=>{const[e,t]=b.useState(!1),r=b.useCallback(()=>{t(n=>!n)},[]);return b.useEffect(()=>{const n=s=>{s.key==="k"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),r())};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[r]),{open:e,setOpen:t,toggle:r}},Ave=()=>{const{requestContext:e}=Qn(),t=Ge();return kt({queryKey:["processors"],queryFn:()=>t.listProcessors(e)})},Z1t=(e,t)=>{const r=Ge(),{requestContext:n}=Qn();return kt({queryKey:["processor",e],queryFn:()=>r.getProcessor(e).details(n),enabled:!!e})},wIn=()=>{const e=Ge(),{requestContext:t}=Qn();return Kr({mutationFn:async({processorId:r,phase:n,messages:s,agentId:a})=>e.getProcessor(r).execute({phase:n,messages:s,agentId:a,requestContext:t})})},SIn=()=>{const{open:e,setOpen:t}=xIn(),{navigate:r,paths:n}=ir(),{isMastraPlatform:s}=q1t(),a=Q$r(),{data:i={}}=Tg(),{data:l={}}=d0(),{data:c={}}=Z8(),{data:u={}}=Ave(),{data:d=[]}=cM(),{data:f={}}=fd(),h=w=>{r(w),t(!1)},p=Object.entries(i),m=Object.entries(l),g=Object.entries(c),y=Object.values(u).filter(w=>w.phases&&w.phases.length>0),x=Object.entries(f);return o.jsxs(bLr,{open:e,onOpenChange:t,title:"Navigation",description:"Search and navigate to any entity",children:[o.jsx(Edt,{placeholder:"Search or navigate..."}),o.jsxs(Cdt,{children:[o.jsx(jdt,{children:"No results found."}),o.jsxs(gb,{heading:"Navigation",children:[a&&o.jsxs(Zo,{value:"toggle sidebar collapse expand",onSelect:()=>{a.toggleSidebar(),t(!1)},children:[o.jsx(xVe,{className:"text-neutral3"}),o.jsx("span",{children:"Toggle Sidebar"}),o.jsx(Tdt,{children:"Ctrl+B"})]}),o.jsxs(Zo,{value:"all agents",onSelect:()=>h("/agents"),children:[o.jsx(pa,{className:"text-neutral3"}),o.jsx("span",{children:"All Agents"})]}),o.jsxs(Zo,{value:"all workflows",onSelect:()=>h("/workflows"),children:[o.jsx(Mi,{className:"text-neutral3"}),o.jsx("span",{children:"All Workflows"})]}),o.jsxs(Zo,{value:"all tools",onSelect:()=>h("/tools"),children:[o.jsx(Pi,{className:"text-neutral3"}),o.jsx("span",{children:"All Tools"})]}),o.jsxs(Zo,{value:"all scorers",onSelect:()=>h("/scorers"),children:[o.jsx(Ma,{className:"text-neutral3"}),o.jsx("span",{children:"All Scorers"})]}),o.jsxs(Zo,{value:"all processors",onSelect:()=>h("/processors"),children:[o.jsx(nS,{className:"text-neutral3"}),o.jsx("span",{children:"All Processors"})]}),o.jsxs(Zo,{value:"all mcp servers",onSelect:()=>h("/mcps"),children:[o.jsx(vl,{className:"text-neutral3"}),o.jsx("span",{children:"All MCP Servers"})]}),o.jsxs(Zo,{value:"observability traces",onSelect:()=>h("/observability"),children:[o.jsx(xo,{className:"text-neutral3"}),o.jsx("span",{children:"Observability"})]}),!s&&o.jsxs(o.Fragment,{children:[o.jsxs(Zo,{value:"settings",onSelect:()=>h("/settings"),children:[o.jsx(ume,{className:"text-neutral3"}),o.jsx("span",{children:"Settings"})]}),o.jsxs(Zo,{value:"templates",onSelect:()=>h("/templates"),children:[o.jsx(qb,{className:"text-neutral3"}),o.jsx("span",{children:"Templates"})]})]})]}),p.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(cw,{}),o.jsx(gb,{heading:"Agents",children:p.map(([w,S])=>o.jsxs(je.Fragment,{children:[o.jsxs(Zo,{value:`${S.name} chat agent`,onSelect:()=>h(n.agentLink(w)),children:[o.jsx(pa,{className:"text-neutral3"}),o.jsxs("span",{children:[S.name,": Chat"]})]}),o.jsxs(Zo,{value:`${S.name} traces agent observability`,onSelect:()=>h(`/observability?entity=${w}`),children:[o.jsx(xo,{className:"text-neutral3"}),o.jsxs("span",{children:[S.name,": Traces"]})]})]},w))})]}),m.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(cw,{}),o.jsx(gb,{heading:"Workflows",children:m.map(([w,S])=>o.jsxs(je.Fragment,{children:[o.jsxs(Zo,{value:`${S.name} graph workflow view`,onSelect:()=>h(n.workflowLink(w)),children:[o.jsx(Mi,{className:"text-neutral3"}),o.jsxs("span",{children:[S.name,": Graph"]})]}),o.jsxs(Zo,{value:`${S.name} traces workflow observability`,onSelect:()=>h(`/observability?entity=${S.name}`),children:[o.jsx(xo,{className:"text-neutral3"}),o.jsxs("span",{children:[S.name,": Traces"]})]})]},w))})]}),g.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(cw,{}),o.jsx(gb,{heading:"Tools",children:g.map(([w,S])=>o.jsxs(Zo,{value:`tool ${S.id}`,onSelect:()=>h(n.toolLink(w)),children:[o.jsx(Pi,{className:"text-neutral3"}),o.jsx("span",{children:S.id})]},w))})]}),x.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(cw,{}),o.jsx(gb,{heading:"Scorers",children:x.map(([w,S])=>{const k=S.scorer?.config?.name||S.scorer?.config?.id||w;return o.jsxs(Zo,{value:`scorer ${k}`,onSelect:()=>h(n.scorerLink(w)),children:[o.jsx(Ma,{className:"text-neutral3"}),o.jsx("span",{children:k})]},w)})})]}),y.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(cw,{}),o.jsx(gb,{heading:"Processors",children:y.map(w=>{const S=w.name||w.id,k=w.isWorkflow?n.workflowLink(w.id)+"/graph":n.processorLink(w.id);return o.jsxs(Zo,{value:`processor ${S}`,onSelect:()=>h(k),children:[o.jsx(nS,{className:"text-neutral3"}),o.jsx("span",{children:S})]},w.id)})})]}),d.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(cw,{}),o.jsx(gb,{heading:"MCP Servers",children:d.map(w=>o.jsxs(Zo,{value:`mcp server ${w.name}`,onSelect:()=>h(n.mcpServerLink(w.id)),children:[o.jsx(vl,{className:"text-neutral3"}),o.jsx("span",{children:w.name})]},w.id))})]})]})]})};function OIn({children:e}){const{data:t,isFetched:r}=SC(),{pathname:n}=_c(),s=r&&t?.enabled&&!qP(t),a=r&&!s;return o.jsxs(o.Fragment,{children:[o.jsx(SIn,{}),o.jsxs("div",{className:a?"grid h-full grid-cols-[auto_1fr]":"h-full",children:[a&&o.jsx(fIn,{}),o.jsx("div",{className:Z("bg-transparent overflow-y-auto",{"h-[calc(100%-1.5rem)]":s}),children:o.jsx(Q1t,{children:o.jsx(Q5r,{resetKeys:[n],children:e})})})]})]})}const kIn=({children:e})=>{const{experimentalUIEnabled:t}=bIn();return o.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[o.jsx(aYe,{position:"bottom-right"}),o.jsx(H1t,{defaultTheme:"dark",attribute:"class",children:o.jsx(ld,{delayDuration:0,children:o.jsx(yIn,{experiments:t?vIn:[],children:o.jsx(G$r,{children:o.jsx(OIn,{children:e})})})})})]})},_In=({children:e})=>o.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[o.jsx(aYe,{position:"bottom-right"}),o.jsx(H1t,{defaultTheme:"dark",attribute:"class",children:o.jsx(ld,{delayDuration:0,children:o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsx(Q1t,{children:e})})})})]});function EIn({agentId:e}){return o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/agents",children:[o.jsx(Ce,{children:o.jsx(pa,{})}),"Agents"]}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:o.jsx(G1n,{value:e,variant:"ghost"})})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(u0,{}),"Agents documentation"]})})]})}const CIn=({children:e})=>{const{agentId:t}=ra(),r=_c(),{isCmsAvailable:n}=lM(),{hasObservability:s}=o1n(),a=Ile.has("datasets"),i=n&&a,l=s&&a,{data:c}=Rf(t),u=eu(c?.provider??""),d=c?.modelId??"",f=c?.requestContextSchema,h=r.pathname.includes("/editor")?"versions":r.pathname.includes("/evaluate")?"evaluate":r.pathname.includes("/review")?"review":r.pathname.includes("/traces")?"traces":"chat",p=(h==="versions"||h==="evaluate"||h==="review")&&(i||l),m=o.jsxs(zr,{className:"grid-rows-[auto_auto_1fr]",children:[o.jsx(EIn,{agentId:t}),o.jsx(YEn,{agentId:t,activeTab:h,showPlayground:i,showObservability:l,rightSlot:p?o.jsx(XEn,{requestContextSchema:f}):void 0}),e]});return o.jsx($P,{children:o.jsx(aSn,{defaultProvider:u,defaultModel:d,children:o.jsx(LEn,{children:o.jsx(iSn,{children:m})})})})},jIn=({children:e,options:t})=>{const r=new YMr({...t,defaultOptions:{...t?.defaultOptions,queries:{retry:Z4r,...t?.defaultOptions?.queries}}});return o.jsx(XMr,{client:r,children:e})},TIn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ka,{iconSlot:o.jsx(xf,{}),titleSlot:"No Processors yet",descriptionSlot:"Configure processors. Add input or output processors to your agents to transform messages.",actionSlot:o.jsxs(pe,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",children:["Processors Documentation ",o.jsx(ya,{})]})})}),NIn=["input","inputStep","outputStep","outputStream","outputResult"];function AIn({processors:e,isLoading:t,search:r=""}){const{paths:n,Link:s}=ir(),a=b.useMemo(()=>Object.values(e??{}).filter(l=>l.phases&&l.phases.length>0),[e]),i=b.useMemo(()=>{const l=r.toLowerCase();return a.filter(c=>c.id.toLowerCase().includes(l)||(c.name||"").toLowerCase().includes(l))},[a,r]);return t?o.jsx(bh,{columns:"auto 1fr auto auto auto auto auto auto"}):o.jsxs(we,{columns:"auto 1fr auto auto auto auto auto auto",children:[o.jsxs(we.Top,{children:[o.jsx(we.TopCell,{children:"Name"}),o.jsx(we.TopCell,{children:"Description"}),o.jsx(we.TopCellSmart,{long:"Input",short:"Input",tooltip:"Contains Input phase",className:"text-center"}),o.jsx(we.TopCellSmart,{long:"Input Step",short:o.jsxs(o.Fragment,{children:[o.jsx(mx,{})," Step"]}),tooltip:"Contains Input Step phase",className:"text-center"}),o.jsx(we.TopCellSmart,{long:"Output Step",short:o.jsxs(o.Fragment,{children:[o.jsx(Zd,{})," Step"]}),tooltip:"Contains Output Step phase",className:"text-center"}),o.jsx(we.TopCellSmart,{long:"Output Stream",short:o.jsxs(o.Fragment,{children:[o.jsx(Zd,{})," Stream"]}),tooltip:"Contains Output Stream phase",className:"text-center"}),o.jsx(we.TopCellSmart,{long:"Output Result",short:o.jsxs(o.Fragment,{children:[o.jsx(Zd,{})," Result"]}),tooltip:"Contains Output Result phase",className:"text-center"}),o.jsx(we.TopCellSmart,{short:"Used by",long:"Used by Agents",className:"text-center"})]}),i.length===0&&r?o.jsx(we.NoMatch,{message:"No Processors match your search"}):null,i.map(l=>{const c=Nh(l.name||l.id,50),u=Nh(l.description??"",200),d=l.agentIds?.length??0,f=new Set(l.phases||[]),h=l.isWorkflow?n.workflowLink(l.id)+"/graph":n.processorLink(l.id);return o.jsxs(we.RowLink,{to:h,LinkComponent:s,children:[o.jsx(we.NameCell,{children:c}),o.jsx(we.DescriptionCell,{children:u}),NIn.map(p=>o.jsx(we.TextCell,{className:"text-center",children:f.has(p)&&o.jsx(ta,{className:"size-4 mx-auto"})},p)),o.jsx(we.TextCell,{className:"text-center",children:d||""})]},l.id)})]})}function IIn(){const{data:e={},isLoading:t,error:r}=Ave(),[n,s]=b.useState("");return r&&Ps(r)?o.jsx(Jr,{title:"Processors",icon:o.jsx(fp,{}),children:o.jsx(na,{})}):r&&ks(r)?o.jsx(Jr,{title:"Processors",icon:o.jsx(fp,{}),children:o.jsx(Gs,{resource:"processors"})}):r?o.jsx(Jr,{title:"Processors",icon:o.jsx(fp,{}),children:o.jsx(gu,{title:"Failed to load processors",message:r.message})}):Object.keys(e).length===0&&!t?o.jsx(Jr,{title:"Processors",icon:o.jsx(fp,{}),children:o.jsx(TIn,{})}):o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:t,children:[o.jsx(fp,{})," Processors"]})})}),o.jsx(bt.Column,{className:"flex justify-end gap-2",children:o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Processors documentation",children:o.jsx(Di,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(_g,{onSearch:s,label:"Filter processors",placeholder:"Filter by name"})})]}),o.jsx(AIn,{processors:e,isLoading:t,search:n})]})}function RIn({value:e,onValueChange:t,placeholder:r="Select a processor...",searchPlaceholder:n="Search processors...",emptyText:s="No processors found.",className:a,disabled:i=!1,variant:l="inputLike"}){const{data:c={},isLoading:u,isError:d,error:f}=Ave(),{navigate:h,paths:p}=ir();b.useEffect(()=>{if(d){const y=f instanceof Error?f.message:"Failed to load processors";ze.error(`Error loading processors: ${y}`)}},[d,f]);const m=Object.keys(c).filter(y=>{const x=c[y];return x?.phases&&x.phases.length>0}).map(y=>({label:c[y]?.name||y,value:y})),g=y=>{t?t(y):y&&y!==e&&(c[y]?.isWorkflow?h(p.workflowLink(y)+"/graph"):h(p.processorLink(y)))};return o.jsx(Kl,{options:m,value:e,onValueChange:g,placeholder:u?"Loading processors...":r,searchPlaceholder:n,emptyText:s,className:a,disabled:i||u||d,variant:l})}const PIn={input:"Input - Process input messages before LLM (once at start)",inputStep:"Input Step - Process at each agentic loop step",outputStream:"Output Stream - Process streaming chunks",outputResult:"Output Result - Process complete output after streaming",outputStep:"Output Step - Process after each LLM response (before tools)"};function MIn({processorId:e}){const{data:t,isLoading:r,error:n}=Z1t(e);return b.useEffect(()=>{if(n){const s=n instanceof Error?n.message:"Failed to load processor";ze.error(`Error loading processor: ${s}`)}},[n]),r?o.jsxs("div",{className:"p-6",children:[o.jsx(Mn,{className:"h-8 w-48 mb-4"}),o.jsx(Mn,{className:"h-32 w-full"})]}):n?null:t?o.jsx(DIn,{processor:t}):o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Processor not found"})})}function DIn({processor:e}){const t=kv(),r=b.useId(),[n,s]=b.useState(e.phases[0]||"input"),[a,i]=b.useState(e.configurations[0]?.agentId||""),[l,c]=b.useState("Hello, this is a test message."),[u,d]=b.useState(null),[f,h]=b.useState(),p=wIn(),m=async()=>{h(void 0),d(null);const x=n==="outputStep"||n==="outputResult"?"assistant":"user",w=[{id:crypto.randomUUID(),role:x,createdAt:new Date,content:{format:2,parts:[{type:"text",text:l}]}}];try{const S=await p.mutateAsync({processorId:e.id,phase:n,messages:w,agentId:a||void 0});d(S),!S.success&&S.error&&h(S.error)}catch(S){h(S.message||"An error occurred")}},g=u?JSON.stringify(u,null,2):"{}";return o.jsxs(pf,{hasLeftServiceColumn:!0,className:"relative",children:[o.jsxs("div",{className:"bg-surface2 border-r border-border1 w-[22rem] overflow-y-auto",children:[o.jsx(LIn,{processor:e}),o.jsxs("div",{className:"p-5 space-y-5",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(me,{as:"label",variant:"ui-sm",className:"text-neutral3",children:"Phase"}),o.jsxs(fi,{value:n,onValueChange:y=>s(y),children:[o.jsx(Ja,{className:"w-full",children:o.jsx(hi,{placeholder:"Select phase"})}),o.jsx(ei,{children:e.phases.map(y=>o.jsx(ns,{value:y,children:y},y))})]}),o.jsx(me,{variant:"ui-xs",className:"text-neutral4",children:PIn[n]})]}),e.configurations.length>1&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(me,{as:"label",variant:"ui-sm",className:"text-neutral3",children:"Agent Configuration"}),o.jsxs(fi,{value:a,onValueChange:i,children:[o.jsx(Ja,{className:"w-full",children:o.jsx(hi,{placeholder:"Select agent"})}),o.jsx(ei,{children:e.configurations.map(y=>o.jsxs(ns,{value:y.agentId,children:[y.agentName," (",y.type,")"]},y.agentId))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(me,{as:"label",htmlFor:r,variant:"ui-sm",className:"text-neutral3",children:"Test Message"}),o.jsx("textarea",{id:r,value:l,onChange:y=>c(y.target.value),placeholder:"Enter a test message...",rows:4,className:"w-full bg-transparent border border-border1 rounded-md p-3 text-ui-sm text-neutral6 placeholder:text-neutral3 focus:outline-hidden focus:ring-2 focus:ring-accent1"})]}),o.jsx(pe,{onClick:m,disabled:p.isPending||n==="outputStream",className:"w-full",children:p.isPending?"Running...":"Run Processor"}),n==="outputStream"&&o.jsx(me,{variant:"ui-xs",className:"text-accent6",children:"Output Stream phase cannot be executed directly. Use streaming instead."}),u&&o.jsxs("div",{className:"space-y-2 pt-4 border-t border-border1",children:[o.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"Status"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(gt,{variant:u.success?"success":"error",children:u.success?"Success":"Failed"}),u.tripwire?.triggered&&o.jsx(gt,{variant:"info",children:"Tripwire Triggered"})]}),u.tripwire?.triggered&&u.tripwire.reason&&o.jsxs("div",{className:"mt-2 p-3 bg-accent6Dark rounded-md border border-accent6/20",children:[o.jsx(me,{variant:"ui-sm",className:"text-accent6 font-medium",children:"Tripwire Reason"}),o.jsx(me,{variant:"ui-sm",className:"text-neutral3 mt-1",children:u.tripwire.reason})]})]})]})]}),o.jsx("div",{className:"absolute top-4 right-4 z-10",children:o.jsx(Xa,{content:g,tooltip:"Copy JSON result to clipboard"})}),o.jsx("div",{className:"p-5 h-full relative overflow-x-auto overflow-y-auto",children:o.jsx(xc,{value:f||g,editable:!0,theme:t,extensions:[Xd]})})]})}function LIn({processor:e}){return o.jsxs("div",{className:"px-5 pt-5 pb-4 border-b border-border1",children:[o.jsx(me,{variant:"header-md",className:"text-neutral1 mb-2",children:e.name||e.id}),e.name&&e.name!==e.id&&o.jsx(me,{variant:"ui-sm",className:"text-neutral4 mb-3",children:e.id}),o.jsx("div",{className:"flex flex-wrap gap-1 mt-3",children:e.phases.map(t=>o.jsx(gt,{variant:"default",children:t},t))}),o.jsx("div",{className:"mt-3",children:o.jsxs(me,{variant:"ui-xs",className:"text-neutral4",children:["Attached to ",e.configurations.length," agent",e.configurations.length!==1?"s":""]})})]})}function $In(){const{processorId:e}=ra(),{data:t,isLoading:r,error:n}=Z1t(e);return n&&Ps(n)?o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/processors",children:[o.jsx(Ce,{children:o.jsx(fp,{})}),"Processors"]}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:e})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})]}):n&&ks(n)?o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/processors",children:[o.jsx(Ce,{children:o.jsx(fp,{})}),"Processors"]}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:e})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Gs,{resource:"processors"})})]}):!r&&t?.isWorkflow?o.jsx(D6t,{to:`/workflows/${e}/graph`,replace:!0}):r?o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsx(En,{children:o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/processors",children:[o.jsx(Ce,{children:o.jsx(fp,{})}),"Processors"]}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:o.jsx(Mn,{className:"h-6 w-32"})})]})}),o.jsxs("div",{className:"p-6",children:[o.jsx(Mn,{className:"h-8 w-48 mb-4"}),o.jsx(Mn,{className:"h-32 w-full"})]})]}):o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsxs(En,{children:[o.jsxs(Za,{children:[o.jsxs(jr,{as:dr,to:"/processors",children:[o.jsx(Ce,{children:o.jsx(fp,{})}),"Processors"]}),o.jsx(jr,{as:"span",to:"",isCurrent:!0,children:o.jsx(RIn,{value:e,variant:"ghost"})})]}),o.jsx(pu,{children:o.jsxs(pe,{as:dr,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:[o.jsx(u0,{}),"Processors documentation"]})})]}),o.jsx(MIn,{processorId:e})]})}function FIn(){const{data:e={},isLoading:t,error:r}=Tg(),{data:n={},isLoading:s,error:a}=Z8(),[i,l]=b.useState(""),c=t||s,u=a||r;return u&&Ps(u)?o.jsx(Jr,{title:"Tools",icon:o.jsx(Pi,{}),children:o.jsx(na,{})}):u&&ks(u)?o.jsx(Jr,{title:"Tools",icon:o.jsx(Pi,{}),children:o.jsx(Gs,{resource:"tools"})}):u?o.jsx(Jr,{title:"Tools",icon:o.jsx(Pi,{}),children:o.jsx(gu,{title:"Failed to load tools",message:u.message})}):Object.keys(n).length===0&&!c?o.jsx(Jr,{title:"Tools",icon:o.jsx(Pi,{}),children:o.jsx(FNn,{})}):o.jsxs(bt,{children:[o.jsxs(bt.TopArea,{children:[o.jsxs(bt.Row,{children:[o.jsx(bt.Column,{children:o.jsx(yn,{children:o.jsxs(yn.Title,{isLoading:c,children:[o.jsx(Pi,{})," Tools"]})})}),o.jsx(bt.Column,{className:"flex justify-end gap-2",children:o.jsx(Cn,{as:"a",href:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Tools documentation",children:o.jsx(Di,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(_g,{onSearch:l,label:"Filter tools",placeholder:"Filter by name"})})]}),o.jsx($Nn,{tools:n,agents:e,isLoading:c,search:i})]})}const Y1t={agentLink:e=>`/agents/${e}/chat/new`,agentToolLink:(e,t)=>`/agents/${e}/tools/${t}`,agentSkillLink:(e,t,r,n)=>n?`/workspaces/${n}/skills/${encodeURIComponent(t)}?agentId=${encodeURIComponent(e)}${r?`&path=${encodeURIComponent(r)}`:""}`:"/workspaces",agentsLink:()=>"/agents",agentNewThreadLink:e=>`/agents/${e}/chat/new`,agentThreadLink:(e,t,r)=>r?`/agents/${e}/chat/${t}?messageId=${r}`:`/agents/${e}/chat/${t}`,workflowsLink:()=>"/workflows",workflowLink:e=>`/workflows/${e}`,networkLink:e=>`/networks/v-next/${e}/chat`,networkNewThreadLink:e=>`/networks/v-next/${e}/chat/${Xi()}`,networkThreadLink:(e,t)=>`/networks/v-next/${e}/chat/${t}`,scorerLink:e=>`/scorers/${e}`,cmsScorersCreateLink:()=>"/cms/scorers/create",cmsScorerEditLink:e=>`/cms/scorers/${e}/edit`,cmsAgentCreateLink:()=>"/cms/agents/create",cmsAgentEditLink:e=>`/cms/agents/${e}/edit`,promptBlockLink:e=>`/prompts/${e}`,promptBlocksLink:()=>"/prompts",cmsPromptBlockCreateLink:()=>"/cms/prompts/create",cmsPromptBlockEditLink:e=>`/cms/prompts/${e}/edit`,toolLink:e=>`/tools/${e}`,skillLink:(e,t,r)=>r?`/workspaces/${r}/skills/${encodeURIComponent(e)}${t?`?path=${encodeURIComponent(t)}`:""}`:"/workspaces",workspaceLink:e=>e?`/workspaces/${e}`:"/workspaces",workspaceSkillLink:(e,t,r)=>r?`/workspaces/${r}/skills/${encodeURIComponent(e)}${t?`?path=${encodeURIComponent(t)}`:""}`:"/workspaces",workspacesLink:()=>"/workspaces",processorsLink:()=>"/processors",processorLink:e=>`/processors/${e}`,mcpServerLink:e=>`/mcps/${e}`,mcpServerToolLink:(e,t)=>`/mcps/${e}/tools/${t}`,workflowRunLink:(e,t)=>`/workflows/${e}/graph/${t}`,datasetLink:e=>`/datasets/${e}`,datasetItemLink:(e,t)=>`/datasets/${e}/items/${t}`,datasetExperimentLink:(e,t)=>`/datasets/${e}/experiments/${t}`,experimentLink:e=>`/experiments/${e}`},zIn=()=>{const e=fu(),t=r=>e(r,{viewTransition:!0});return o.jsx(xht,{Link:S8,navigate:t,paths:Y1t,children:o.jsx(kIn,{children:o.jsx(b_,{})})})},BIn=()=>{const e=fu(),t=r=>e(r,{viewTransition:!0});return o.jsx(xht,{Link:S8,navigate:t,paths:Y1t,children:o.jsx(_In,{children:o.jsx(b_,{})})})},UIn=!!window.MASTRA_CLOUD_API_ENDPOINT,WBe=Ile.has("datasets"),GBe=[{index:!0,element:o.jsx(WCn,{})},{path:"instruction-blocks",element:o.jsx(GCn,{})},{path:"tools",element:o.jsx(KCn,{})},{path:"agents",element:o.jsx(qCn,{})},{path:"scorers",element:o.jsx(YCn,{})},{path:"workflows",element:o.jsx(ejn,{})},{path:"skills",element:o.jsx(XCn,{})},{path:"memory",element:o.jsx(ZCn,{})},{path:"variables",element:o.jsx(JCn,{})}],VIn=[{path:"/login",element:o.jsx(ANn,{})},{path:"/signup",element:o.jsx(xAn,{})},{element:o.jsx(BIn,{}),children:[{path:"/agents/:agentId/session",element:o.jsx(gBe,{})},{path:"/agents/:agentId/session/:threadId",element:o.jsx(gBe,{})}]},{element:o.jsx(zIn,{}),children:[...UIn?[]:[{path:"/settings",element:o.jsx(bAn,{})},{path:"/templates",element:o.jsx(kAn,{})},{path:"/templates/:templateSlug",element:o.jsx(AAn,{})}],{path:"/logs",element:o.jsx(INn,{})},{path:"/primitives",element:o.jsx(dAn,{})},{path:"/evaluation",element:o.jsx(jNn,{})},{path:"/scorers",element:o.jsx(gAn,{})},{path:"/scorers/:scorerId",element:o.jsx(yAn,{})},{path:"/metrics",element:o.jsx(iAn,{})},{path:"/observability-overview",element:o.jsx(cAn,{})},{path:"/observability",element:o.jsx(PAn,{})},{path:"/traces/:traceId",element:o.jsx(MAn,{})},{path:"/resources",element:o.jsx(mAn,{})},{path:"/agents",element:o.jsx(eKr,{})},{path:"/cms/agents/create",element:o.jsx(HCn,{}),children:GBe},{path:"/cms/agents/:agentId/edit",element:o.jsx(QCn,{}),children:GBe},{path:"/cms/scorers/create",element:o.jsx(sjn,{})},{path:"/cms/scorers/:scorerId/edit",element:o.jsx(ijn,{})},{path:"/prompts",element:o.jsx(fAn,{})},{path:"/cms/prompts/create",element:o.jsx(tjn,{})},{path:"/cms/prompts/:promptBlockId/edit",element:o.jsx(njn,{})},{path:"/agents/:agentId/tools/:toolId",element:o.jsx(IAn,{})},{path:"/agents/:agentId",element:o.jsx(CIn,{children:o.jsx(b_,{})}),children:[{index:!0,loader:({params:e})=>EU(`/agents/${e.agentId}/chat`)},{path:"chat",element:o.jsx(pBe,{})},{path:"chat/:threadId",element:o.jsx(pBe,{})},...WBe?[{path:"editor",element:o.jsx(BCn,{})},{path:"evaluate",element:o.jsx(zCn,{})},{path:"review",element:o.jsx(UCn,{})}]:[],{path:"traces",element:o.jsx(VCn,{})}]},{path:"/tools",element:o.jsx(FIn,{})},{path:"/tools/:toolId",element:o.jsx(RAn,{})},{path:"/processors",element:o.jsx(IIn,{})},{path:"/processors/:processorId",element:o.jsx($In,{})},{path:"/mcps",element:o.jsx(DNn,{})},{path:"/mcps/:serverId",element:o.jsx(QNn,{})},{path:"/mcps/:serverId/tools/:toolId",element:o.jsx(ZNn,{})},{path:"/workspaces",element:o.jsx(HBe,{})},{path:"/workspaces/:workspaceId",element:o.jsx(HBe,{})},{path:"/workspaces/:workspaceId/skills/:skillName",element:o.jsx(uIn,{})},{path:"/workflows",element:o.jsx(DAn,{})},{path:"/workflows/:workflowId",element:o.jsx(DZr,{children:o.jsx(b_,{})}),children:[{index:!0,loader:({params:e})=>EU(`/workflows/${e.workflowId}/graph`)},{path:"graph",element:o.jsx(UBe,{})},{path:"graph/:runId",element:o.jsx(UBe,{})}]},...WBe?[{path:"/datasets",element:o.jsx(iNn,{})},{path:"/datasets/:datasetId",element:o.jsx(lNn,{})},{path:"/datasets/:datasetId/items/:itemId",element:o.jsx(dNn,{})},{path:"/datasets/:datasetId/items/:itemId/versions",element:o.jsx(pNn,{})},{path:"/datasets/:datasetId/experiments/:experimentId",element:o.jsx(cNn,{})},{path:"/experiments",element:o.jsx(TNn,{})},{path:"/experiments/:experimentId",element:o.jsx(NNn,{})},{path:"/datasets/:datasetId/experiments",element:o.jsx(uNn,{})},{path:"/datasets/:datasetId/items",element:o.jsx(fNn,{})},{path:"/datasets/:datasetId/versions",element:o.jsx(gNn,{})}]:[],{index:!0,loader:()=>EU("/agents")},{path:"/request-context",element:o.jsx(hAn,{})}]}];function qIn(){const e=window.MASTRA_STUDIO_BASE_PATH||"",{baseUrl:t,headers:r,apiPrefix:n,isLoading:s}=sve(),a=b.useMemo(()=>t?ICn(t,n):void 0,[t,n]);if(s)return null;if(!t)return o.jsx(i1n,{});const i=lFt(VIn,{basename:e});return o.jsx(P5t,{baseUrl:t,headers:r,apiPrefix:n,customFetch:a,children:o.jsx(QXr,{children:o.jsx(R6t,{router:i})})})}function HIn(){const e=window.MASTRA_SERVER_PROTOCOL||"http",t=window.MASTRA_SERVER_HOST||"localhost",r=window.MASTRA_SERVER_PORT||4111,n=window.MASTRA_API_PREFIX||"/api",s=window.MASTRA_CLOUD_API_ENDPOINT||"",a=window.MASTRA_AUTO_DETECT_URL==="true",i=s||(a?window.location.origin:`${e}://${t}:${r}`);return o.jsx(jIn,{children:o.jsx(_Sn,{endpoint:i,defaultApiPrefix:n,children:o.jsx(qIn,{})})})}o_t.createRoot(document.getElementById("root")).render(o.jsx(b.StrictMode,{children:o.jsx(HIn,{})}));const qPn=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{PHe as A,TGe as B,DHe as C,jWe as D,Sf as E,gh as F,qPn as G,Ks as I,cS as L,RHe as N,z3t as a,r5t as b,VPn as c,$Se as d,dS as e,K3t as f,Uk as g,t5t as h,d1 as i,f1 as j,u1 as k,eVt as l,MWe as m,aS as n,Aa as o,mUt as p,pUt as q,pue as r,Sce as s,ne as t,_3 as u,Eu as v,H3t as w,ft as x,nt as y,KGe as z};
|