vskill 0.5.95 → 0.5.96
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/agents.json +1 -1
- package/dist/eval-server/api-routes.js +12 -1
- package/dist/eval-server/api-routes.js.map +1 -1
- package/dist/eval-ui/assets/{CommandPalette-DQ77TboB.js → CommandPalette-BX_VfD47.js} +1 -1
- package/dist/eval-ui/assets/{UpdateDropdown-BThJVKcK.js → UpdateDropdown-BMVgsBm3.js} +1 -1
- package/dist/eval-ui/assets/{index-DcuiIV_0.js → index-nuDPWu3X.js} +32 -32
- package/dist/eval-ui/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-BMVgsBm3.js","assets/fonts-i7Lkz2zN.css","assets/CommandPalette-BX_VfD47.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
/* empty css */(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))o(u);new MutationObserver(u=>{for(const p of u)if(p.type==="childList")for(const f of p.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function i(u){const p={};return u.integrity&&(p.integrity=u.integrity),u.referrerPolicy&&(p.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?p.credentials="include":u.crossOrigin==="anonymous"?p.credentials="omit":p.credentials="same-origin",p}function o(u){if(u.ep)return;u.ep=!0;const p=i(u);fetch(u.href,p)}})();function cv(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var _u={exports:{}},ds={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -7,7 +7,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var
|
|
10
|
+
*/var $h;function H1(){if($h)return ds;$h=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(o,u,p){var f=null;if(p!==void 0&&(f=""+p),u.key!==void 0&&(f=""+u.key),"key"in u){p={};for(var h in u)h!=="key"&&(p[h]=u[h])}else p=u;return u=p.ref,{$$typeof:a,type:o,key:f,ref:u!==void 0?u:null,props:p}}return ds.Fragment=r,ds.jsx=i,ds.jsxs=i,ds}var Gh;function U1(){return Gh||(Gh=1,_u.exports=H1()),_u.exports}var n=U1(),Ou={exports:{}},De={};/**
|
|
11
11
|
* @license React
|
|
12
12
|
* react.production.js
|
|
13
13
|
*
|
|
@@ -15,7 +15,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var
|
|
18
|
+
*/var Ph;function V1(){if(Ph)return De;Ph=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),p=Symbol.for("react.consumer"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),j=Symbol.iterator;function S(_){return _===null||typeof _!="object"?null:(_=j&&_[j]||_["@@iterator"],typeof _=="function"?_:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,T={};function k(_,W,oe){this.props=_,this.context=W,this.refs=T,this.updater=oe||N}k.prototype.isReactComponent={},k.prototype.setState=function(_,W){if(typeof _!="object"&&typeof _!="function"&&_!=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,_,W,"setState")},k.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function M(){}M.prototype=k.prototype;function O(_,W,oe){this.props=_,this.context=W,this.refs=T,this.updater=oe||N}var V=O.prototype=new M;V.constructor=O,L(V,k.prototype),V.isPureReactComponent=!0;var A=Array.isArray;function U(){}var w={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function R(_,W,oe){var fe=oe.ref;return{$$typeof:a,type:_,key:W,ref:fe!==void 0?fe:null,props:oe}}function I(_,W){return R(_.type,W,_.props)}function G(_){return typeof _=="object"&&_!==null&&_.$$typeof===a}function q(_){var W={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(oe){return W[oe]})}var te=/\/+/g;function Q(_,W){return typeof _=="object"&&_!==null&&_.key!=null?q(""+_.key):W.toString(36)}function z(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(U,U):(_.status="pending",_.then(function(W){_.status==="pending"&&(_.status="fulfilled",_.value=W)},function(W){_.status==="pending"&&(_.status="rejected",_.reason=W)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function E(_,W,oe,fe,he){var xe=typeof _;(xe==="undefined"||xe==="boolean")&&(_=null);var ke=!1;if(_===null)ke=!0;else switch(xe){case"bigint":case"string":case"number":ke=!0;break;case"object":switch(_.$$typeof){case a:case r:ke=!0;break;case y:return ke=_._init,E(ke(_._payload),W,oe,fe,he)}}if(ke)return he=he(_),ke=fe===""?"."+Q(_,0):fe,A(he)?(oe="",ke!=null&&(oe=ke.replace(te,"$&/")+"/"),E(he,W,oe,"",function(Ue){return Ue})):he!=null&&(G(he)&&(he=I(he,oe+(he.key==null||_&&_.key===he.key?"":(""+he.key).replace(te,"$&/")+"/")+ke)),W.push(he)),1;ke=0;var ce=fe===""?".":fe+":";if(A(_))for(var je=0;je<_.length;je++)fe=_[je],xe=ce+Q(fe,je),ke+=E(fe,W,oe,xe,he);else if(je=S(_),typeof je=="function")for(_=je.call(_),je=0;!(fe=_.next()).done;)fe=fe.value,xe=ce+Q(fe,je++),ke+=E(fe,W,oe,xe,he);else if(xe==="object"){if(typeof _.then=="function")return E(z(_),W,oe,fe,he);throw W=String(_),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return ke}function B(_,W,oe){if(_==null)return _;var fe=[],he=0;return E(_,fe,"","",function(xe){return W.call(oe,xe,he++)}),fe}function ne(_){if(_._status===-1){var W=_._result;W=W(),W.then(function(oe){(_._status===0||_._status===-1)&&(_._status=1,_._result=oe)},function(oe){(_._status===0||_._status===-1)&&(_._status=2,_._result=oe)}),_._status===-1&&(_._status=0,_._result=W)}if(_._status===1)return _._result.default;throw _._result}var Y=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},me={map:B,forEach:function(_,W,oe){B(_,function(){W.apply(this,arguments)},oe)},count:function(_){var W=0;return B(_,function(){W++}),W},toArray:function(_){return B(_,function(W){return W})||[]},only:function(_){if(!G(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return De.Activity=g,De.Children=me,De.Component=k,De.Fragment=i,De.Profiler=u,De.PureComponent=O,De.StrictMode=o,De.Suspense=x,De.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,De.__COMPILER_RUNTIME={__proto__:null,c:function(_){return w.H.useMemoCache(_)}},De.cache=function(_){return function(){return _.apply(null,arguments)}},De.cacheSignal=function(){return null},De.cloneElement=function(_,W,oe){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var fe=L({},_.props),he=_.key;if(W!=null)for(xe in W.key!==void 0&&(he=""+W.key),W)!D.call(W,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&W.ref===void 0||(fe[xe]=W[xe]);var xe=arguments.length-2;if(xe===1)fe.children=oe;else if(1<xe){for(var ke=Array(xe),ce=0;ce<xe;ce++)ke[ce]=arguments[ce+2];fe.children=ke}return R(_.type,he,fe)},De.createContext=function(_){return _={$$typeof:f,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:p,_context:_},_},De.createElement=function(_,W,oe){var fe,he={},xe=null;if(W!=null)for(fe in W.key!==void 0&&(xe=""+W.key),W)D.call(W,fe)&&fe!=="key"&&fe!=="__self"&&fe!=="__source"&&(he[fe]=W[fe]);var ke=arguments.length-2;if(ke===1)he.children=oe;else if(1<ke){for(var ce=Array(ke),je=0;je<ke;je++)ce[je]=arguments[je+2];he.children=ce}if(_&&_.defaultProps)for(fe in ke=_.defaultProps,ke)he[fe]===void 0&&(he[fe]=ke[fe]);return R(_,xe,he)},De.createRef=function(){return{current:null}},De.forwardRef=function(_){return{$$typeof:h,render:_}},De.isValidElement=G,De.lazy=function(_){return{$$typeof:y,_payload:{_status:-1,_result:_},_init:ne}},De.memo=function(_,W){return{$$typeof:m,type:_,compare:W===void 0?null:W}},De.startTransition=function(_){var W=w.T,oe={};w.T=oe;try{var fe=_(),he=w.S;he!==null&&he(oe,fe),typeof fe=="object"&&fe!==null&&typeof fe.then=="function"&&fe.then(U,Y)}catch(xe){Y(xe)}finally{W!==null&&oe.types!==null&&(W.types=oe.types),w.T=W}},De.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},De.use=function(_){return w.H.use(_)},De.useActionState=function(_,W,oe){return w.H.useActionState(_,W,oe)},De.useCallback=function(_,W){return w.H.useCallback(_,W)},De.useContext=function(_){return w.H.useContext(_)},De.useDebugValue=function(){},De.useDeferredValue=function(_,W){return w.H.useDeferredValue(_,W)},De.useEffect=function(_,W){return w.H.useEffect(_,W)},De.useEffectEvent=function(_){return w.H.useEffectEvent(_)},De.useId=function(){return w.H.useId()},De.useImperativeHandle=function(_,W,oe){return w.H.useImperativeHandle(_,W,oe)},De.useInsertionEffect=function(_,W){return w.H.useInsertionEffect(_,W)},De.useLayoutEffect=function(_,W){return w.H.useLayoutEffect(_,W)},De.useMemo=function(_,W){return w.H.useMemo(_,W)},De.useOptimistic=function(_,W){return w.H.useOptimistic(_,W)},De.useReducer=function(_,W,oe){return w.H.useReducer(_,W,oe)},De.useRef=function(_){return w.H.useRef(_)},De.useState=function(_){return w.H.useState(_)},De.useSyncExternalStore=function(_,W,oe){return w.H.useSyncExternalStore(_,W,oe)},De.useTransition=function(){return w.H.useTransition()},De.version="19.2.4",De}var qh;function Cd(){return qh||(qh=1,Ou.exports=V1()),Ou.exports}var v=Cd();const we=cv(v);var Bu={exports:{}},fs={},Iu={exports:{}},Hu={};/**
|
|
19
19
|
* @license React
|
|
20
20
|
* scheduler.production.js
|
|
21
21
|
*
|
|
@@ -23,7 +23,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the MIT license found in the
|
|
25
25
|
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var
|
|
26
|
+
*/var Yh;function $1(){return Yh||(Yh=1,(function(a){function r(E,B){var ne=E.length;E.push(B);e:for(;0<ne;){var Y=ne-1>>>1,me=E[Y];if(0<u(me,B))E[Y]=B,E[ne]=me,ne=Y;else break e}}function i(E){return E.length===0?null:E[0]}function o(E){if(E.length===0)return null;var B=E[0],ne=E.pop();if(ne!==B){E[0]=ne;e:for(var Y=0,me=E.length,_=me>>>1;Y<_;){var W=2*(Y+1)-1,oe=E[W],fe=W+1,he=E[fe];if(0>u(oe,ne))fe<me&&0>u(he,oe)?(E[Y]=he,E[fe]=ne,Y=fe):(E[Y]=oe,E[W]=ne,Y=W);else if(fe<me&&0>u(he,ne))E[Y]=he,E[fe]=ne,Y=fe;else break e}}return B}function u(E,B){var ne=E.sortIndex-B.sortIndex;return ne!==0?ne:E.id-B.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var p=performance;a.unstable_now=function(){return p.now()}}else{var f=Date,h=f.now();a.unstable_now=function(){return f.now()-h}}var x=[],m=[],y=1,g=null,j=3,S=!1,N=!1,L=!1,T=!1,k=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function V(E){for(var B=i(m);B!==null;){if(B.callback===null)o(m);else if(B.startTime<=E)o(m),B.sortIndex=B.expirationTime,r(x,B);else break;B=i(m)}}function A(E){if(L=!1,V(E),!N)if(i(x)!==null)N=!0,U||(U=!0,q());else{var B=i(m);B!==null&&z(A,B.startTime-E)}}var U=!1,w=-1,D=5,R=-1;function I(){return T?!0:!(a.unstable_now()-R<D)}function G(){if(T=!1,U){var E=a.unstable_now();R=E;var B=!0;try{e:{N=!1,L&&(L=!1,M(w),w=-1),S=!0;var ne=j;try{t:{for(V(E),g=i(x);g!==null&&!(g.expirationTime>E&&I());){var Y=g.callback;if(typeof Y=="function"){g.callback=null,j=g.priorityLevel;var me=Y(g.expirationTime<=E);if(E=a.unstable_now(),typeof me=="function"){g.callback=me,V(E),B=!0;break t}g===i(x)&&o(x),V(E)}else o(x);g=i(x)}if(g!==null)B=!0;else{var _=i(m);_!==null&&z(A,_.startTime-E),B=!1}}break e}finally{g=null,j=ne,S=!1}B=void 0}}finally{B?q():U=!1}}}var q;if(typeof O=="function")q=function(){O(G)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,Q=te.port2;te.port1.onmessage=G,q=function(){Q.postMessage(null)}}else q=function(){k(G,0)};function z(E,B){w=k(function(){E(a.unstable_now())},B)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(E){E.callback=null},a.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<E?Math.floor(1e3/E):5},a.unstable_getCurrentPriorityLevel=function(){return j},a.unstable_next=function(E){switch(j){case 1:case 2:case 3:var B=3;break;default:B=j}var ne=j;j=B;try{return E()}finally{j=ne}},a.unstable_requestPaint=function(){T=!0},a.unstable_runWithPriority=function(E,B){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var ne=j;j=E;try{return B()}finally{j=ne}},a.unstable_scheduleCallback=function(E,B,ne){var Y=a.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?Y+ne:Y):ne=Y,E){case 1:var me=-1;break;case 2:me=250;break;case 5:me=1073741823;break;case 4:me=1e4;break;default:me=5e3}return me=ne+me,E={id:y++,callback:B,priorityLevel:E,startTime:ne,expirationTime:me,sortIndex:-1},ne>Y?(E.sortIndex=ne,r(m,E),i(x)===null&&E===i(m)&&(L?(M(w),w=-1):L=!0,z(A,ne-Y))):(E.sortIndex=me,r(x,E),N||S||(N=!0,U||(U=!0,q()))),E},a.unstable_shouldYield=I,a.unstable_wrapCallback=function(E){var B=j;return function(){var ne=j;j=B;try{return E.apply(this,arguments)}finally{j=ne}}}})(Hu)),Hu}var Fh;function G1(){return Fh||(Fh=1,Iu.exports=$1()),Iu.exports}var Uu={exports:{}},Kt={};/**
|
|
27
27
|
* @license React
|
|
28
28
|
* react-dom.production.js
|
|
29
29
|
*
|
|
@@ -31,7 +31,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
31
31
|
*
|
|
32
32
|
* This source code is licensed under the MIT license found in the
|
|
33
33
|
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var
|
|
34
|
+
*/var Wh;function P1(){if(Wh)return Kt;Wh=1;var a=Cd();function r(x){var m="https://react.dev/errors/"+x;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+x+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var o={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},u=Symbol.for("react.portal");function p(x,m,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:g==null?null:""+g,children:x,containerInfo:m,implementation:y}}var f=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(x,m){if(x==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Kt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Kt.createPortal=function(x,m){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(r(299));return p(x,m,null,y)},Kt.flushSync=function(x){var m=f.T,y=o.p;try{if(f.T=null,o.p=2,x)return x()}finally{f.T=m,o.p=y,o.d.f()}},Kt.preconnect=function(x,m){typeof x=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,o.d.C(x,m))},Kt.prefetchDNS=function(x){typeof x=="string"&&o.d.D(x)},Kt.preinit=function(x,m){if(typeof x=="string"&&m&&typeof m.as=="string"){var y=m.as,g=h(y,m.crossOrigin),j=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?o.d.S(x,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:j,fetchPriority:S}):y==="script"&&o.d.X(x,{crossOrigin:g,integrity:j,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Kt.preinitModule=function(x,m){if(typeof x=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=h(m.as,m.crossOrigin);o.d.M(x,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&o.d.M(x)},Kt.preload=function(x,m){if(typeof x=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,g=h(y,m.crossOrigin);o.d.L(x,y,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Kt.preloadModule=function(x,m){if(typeof x=="string")if(m){var y=h(m.as,m.crossOrigin);o.d.m(x,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else o.d.m(x)},Kt.requestFormReset=function(x){o.d.r(x)},Kt.unstable_batchedUpdates=function(x,m){return x(m)},Kt.useFormState=function(x,m,y){return f.H.useFormState(x,m,y)},Kt.useFormStatus=function(){return f.H.useHostTransitionStatus()},Kt.version="19.2.4",Kt}var Kh;function uv(){if(Kh)return Uu.exports;Kh=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}return a(),Uu.exports=P1(),Uu.exports}/**
|
|
35
35
|
* @license React
|
|
36
36
|
* react-dom-client.production.js
|
|
37
37
|
*
|
|
@@ -39,52 +39,52 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
39
39
|
*
|
|
40
40
|
* This source code is licensed under the MIT license found in the
|
|
41
41
|
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/var
|
|
42
|
+
*/var Xh;function q1(){if(Xh)return fs;Xh=1;var a=G1(),r=Cd(),i=uv();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function p(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function f(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function x(e){if(p(e)!==e)throw Error(o(188))}function m(e){var t=e.alternate;if(!t){if(t=p(e),t===null)throw Error(o(188));return t!==e?null:e}for(var l=e,s=t;;){var c=l.return;if(c===null)break;var d=c.alternate;if(d===null){if(s=c.return,s!==null){l=s;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===l)return x(c),e;if(d===s)return x(c),t;d=d.sibling}throw Error(o(188))}if(l.return!==s.return)l=c,s=d;else{for(var b=!1,C=c.child;C;){if(C===l){b=!0,l=c,s=d;break}if(C===s){b=!0,s=c,l=d;break}C=C.sibling}if(!b){for(C=d.child;C;){if(C===l){b=!0,l=d,s=c;break}if(C===s){b=!0,s=d,l=c;break}C=C.sibling}if(!b)throw Error(o(189))}}if(l.alternate!==s)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var g=Object.assign,j=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),O=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function q(e){return e===null||typeof e!="object"?null:(e=G&&e[G]||e["@@iterator"],typeof e=="function"?e:null)}var te=Symbol.for("react.client.reference");function Q(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case L:return"Fragment";case k:return"Profiler";case T:return"StrictMode";case A:return"Suspense";case U:return"SuspenseList";case R:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case O:return e.displayName||"Context";case M:return(e._context.displayName||"Context")+".Consumer";case V:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case w:return t=e.displayName||null,t!==null?t:Q(e.type)||"Memo";case D:t=e._payload,e=e._init;try{return Q(e(t))}catch{}}return null}var z=Array.isArray,E=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},Y=[],me=-1;function _(e){return{current:e}}function W(e){0>me||(e.current=Y[me],Y[me]=null,me--)}function oe(e,t){me++,Y[me]=e.current,e.current=t}var fe=_(null),he=_(null),xe=_(null),ke=_(null);function ce(e,t){switch(oe(xe,t),oe(he,e),oe(fe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?dh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=dh(t),e=fh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}W(fe),oe(fe,e)}function je(){W(fe),W(he),W(xe)}function Ue(e){e.memoizedState!==null&&oe(ke,e);var t=fe.current,l=fh(t,e.type);t!==l&&(oe(he,e),oe(fe,l))}function Le(e){he.current===e&&(W(fe),W(he)),ke.current===e&&(W(ke),is._currentValue=ne)}var ae,Z;function se(e){if(ae===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);ae=t&&t[1]||"",Z=-1<l.stack.indexOf(`
|
|
43
43
|
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
-
`+ae+e+Z}var ue=!1;function ge(e,t){if(!e||ue)return"";ue=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(ee){var
|
|
45
|
-
`),
|
|
46
|
-
`);for(c=s=0;s<H.length&&!H[s].includes("DetermineComponentFrameRoot");)s++;for(;c<
|
|
44
|
+
`+ae+e+Z}var ue=!1;function ge(e,t){if(!e||ue)return"";ue=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(ee){var X=ee}Reflect.construct(e,[],ie)}else{try{ie.call()}catch(ee){X=ee}e.call(ie.prototype)}}else{try{throw Error()}catch(ee){X=ee}(ie=e())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(ee){if(ee&&X&&typeof ee.stack=="string")return[ee.stack,X.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=s.DetermineComponentFrameRoot(),b=d[0],C=d[1];if(b&&C){var H=b.split(`
|
|
45
|
+
`),K=C.split(`
|
|
46
|
+
`);for(c=s=0;s<H.length&&!H[s].includes("DetermineComponentFrameRoot");)s++;for(;c<K.length&&!K[c].includes("DetermineComponentFrameRoot");)c++;if(s===H.length||c===K.length)for(s=H.length-1,c=K.length-1;1<=s&&0<=c&&H[s]!==K[c];)c--;for(;1<=s&&0<=c;s--,c--)if(H[s]!==K[c]){if(s!==1||c!==1)do if(s--,c--,0>c||H[s]!==K[c]){var le=`
|
|
47
47
|
`+H[s].replace(" at new "," at ");return e.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",e.displayName)),le}while(1<=s&&0<=c);break}}}finally{ue=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?se(l):""}function Oe(e,t){switch(e.tag){case 26:case 27:case 5:return se(e.type);case 16:return se("Lazy");case 13:return e.child!==t&&t!==null?se("Suspense Fallback"):se("Suspense");case 19:return se("SuspenseList");case 0:case 15:return ge(e.type,!1);case 11:return ge(e.type.render,!1);case 1:return ge(e.type,!0);case 31:return se("Activity");default:return""}}function Me(e){try{var t="",l=null;do t+=Oe(e,l),l=e,e=e.return;while(e);return t}catch(s){return`
|
|
48
48
|
Error generating stack: `+s.message+`
|
|
49
|
-
`+s.stack}}var dt=Object.prototype.hasOwnProperty,Zt=a.unstable_scheduleCallback,ct=a.unstable_cancelCallback,Vt=a.unstable_shouldYield,$t=a.unstable_requestPaint,tt=a.unstable_now,jt=a.unstable_getCurrentPriorityLevel,ve=a.unstable_ImmediatePriority,Rt=a.unstable_UserBlockingPriority,ze=a.unstable_NormalPriority,xt=a.unstable_LowPriority,Wt=a.unstable_IdlePriority,nt=a.log,Qa=a.unstable_setDisableYieldValue,Zn=null,Ct=null;function St(e){if(typeof nt=="function"&&Qa(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Zn,e)}catch{}}var bt=Math.clz32?Math.clz32:In,Bn=Math.log,Za=Math.LN2;function In(e){return e>>>=0,e===0?32:31-(Bn(e)/Za|0)|0}var Ve=256,It=262144,Jn=4194304;function Nt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function br(e,t,l){var s=e.pendingLanes;if(s===0)return 0;var c=0,d=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var C=s&134217727;return C!==0?(s=C&~d,s!==0?c=Nt(s):(b&=C,b!==0?c=Nt(b):l||(l=C&~e,l!==0&&(c=Nt(l))))):(C=s&~d,C!==0?c=Nt(C):b!==0?c=Nt(b):l||(l=s&~e,l!==0&&(c=Nt(l)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,l=t&-t,d>=l||d===32&&(l&4194048)!==0)?t:c}function wn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function So(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pd(){var e=Jn;return Jn<<=1,(Jn&62914560)===0&&(Jn=4194304),e}function ko(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function jr(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Eg(e,t,l,s,c,d){var b=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var C=e.entanglements,H=e.expirationTimes,X=e.hiddenUpdates;for(l=b&~l;0<l;){var le=31-bt(l),ie=1<<le;C[le]=0,H[le]=-1;var Q=X[le];if(Q!==null)for(X[le]=null,le=0;le<Q.length;le++){var ee=Q[le];ee!==null&&(ee.lane&=-536870913)}l&=~ie}s!==0&&qd(e,s,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(b&~t))}function qd(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-bt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|l&261930}function Yd(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var s=31-bt(l),c=1<<s;c&t|e[s]&t&&(e[s]|=t),l&=~c}}function Fd(e,t){var l=t&-t;return l=(l&42)!==0?1:wo(l),(l&(e.suspendedLanes|t))!==0?0:l}function wo(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Co(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Wd(){var e=B.p;return e!==0?e:(e=window.event,e===void 0?32:Dh(e.type))}function Kd(e,t){var l=B.p;try{return B.p=e,t()}finally{B.p=l}}var ba=Math.random().toString(36).slice(2),Gt="__reactFiber$"+ba,ln="__reactProps$"+ba,kl="__reactContainer$"+ba,No="__reactEvents$"+ba,Tg="__reactListeners$"+ba,Rg="__reactHandles$"+ba,Xd="__reactResources$"+ba,Sr="__reactMarker$"+ba;function Eo(e){delete e[Gt],delete e[ln],delete e[No],delete e[Tg],delete e[Rg]}function wl(e){var t=e[Gt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[kl]||l[Gt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=gh(e);e!==null;){if(l=e[Gt])return l;e=gh(e)}return t}e=l,l=e.parentNode}return null}function Cl(e){if(e=e[Gt]||e[kl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function kr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Nl(e){var t=e[Xd];return t||(t=e[Xd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ht(e){e[Sr]=!0}var Qd=new Set,Zd={};function Ja(e,t){El(e,t),El(e+"Capture",t)}function El(e,t){for(Zd[e]=t,e=0;e<t.length;e++)Qd.add(t[e])}var Ag=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Jd={},ef={};function Mg(e){return dt.call(ef,e)?!0:dt.call(Jd,e)?!1:Ag.test(e)?ef[e]=!0:(Jd[e]=!0,!1)}function _s(e,t,l){if(Mg(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function Os(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function ea(e,t,l,s){if(s===null)e.removeAttribute(l);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+s)}}function Cn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function tf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function zg(e,t,l){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,d=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(b){l=""+b,d.call(this,b)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function To(e){if(!e._valueTracker){var t=tf(e)?"checked":"value";e._valueTracker=zg(e,t,""+e[t])}}function nf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),s="";return e&&(s=tf(e)?e.checked?"true":"false":e.value),e=s,e!==l?(t.setValue(e),!0):!1}function Bs(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Lg=/[\n"\\]/g;function Nn(e){return e.replace(Lg,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ro(e,t,l,s,c,d,b,C){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Cn(t)):e.value!==""+Cn(t)&&(e.value=""+Cn(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?Ao(e,b,Cn(t)):l!=null?Ao(e,b,Cn(l)):s!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?e.name=""+Cn(C):e.removeAttribute("name")}function af(e,t,l,s,c,d,b,C){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||l!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){To(e);return}l=l!=null?""+Cn(l):"",t=t!=null?""+Cn(t):l,C||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=C?e.checked:!!s,e.defaultChecked=!!s,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),To(e)}function Ao(e,t,l){t==="number"&&Bs(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Tl(e,t,l,s){if(e=e.options,t){t={};for(var c=0;c<l.length;c++)t["$"+l[c]]=!0;for(l=0;l<e.length;l++)c=t.hasOwnProperty("$"+e[l].value),e[l].selected!==c&&(e[l].selected=c),c&&s&&(e[l].defaultSelected=!0)}else{for(l=""+Cn(l),t=null,c=0;c<e.length;c++){if(e[c].value===l){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function lf(e,t,l){if(t!=null&&(t=""+Cn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Cn(l):""}function rf(e,t,l,s){if(t==null){if(s!=null){if(l!=null)throw Error(o(92));if(_(s)){if(1<s.length)throw Error(o(93));s=s[0]}l=s}l==null&&(l=""),t=l}l=Cn(t),e.defaultValue=l,s=e.textContent,s===l&&s!==""&&s!==null&&(e.value=s),To(e)}function Rl(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var Dg=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function sf(e,t,l){var s=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,l):typeof l!="number"||l===0||Dg.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function of(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var s in l)!l.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var c in t)s=t[c],t.hasOwnProperty(c)&&l[c]!==s&&sf(e,c,s)}else for(var d in t)t.hasOwnProperty(d)&&sf(e,d,t[d])}function Mo(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var _g=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Og=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Is(e){return Og.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ta(){}var zo=null;function Lo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Al=null,Ml=null;function cf(e){var t=Cl(e);if(t&&(e=t.stateNode)){var l=e[ln]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ro(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Nn(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var s=l[t];if(s!==e&&s.form===e.form){var c=s[ln]||null;if(!c)throw Error(o(90));Ro(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<l.length;t++)s=l[t],s.form===e.form&&nf(s)}break e;case"textarea":lf(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Tl(e,!!l.multiple,t,!1)}}}var Do=!1;function uf(e,t,l){if(Do)return e(t,l);Do=!0;try{var s=e(t);return s}finally{if(Do=!1,(Al!==null||Ml!==null)&&(Ci(),Al&&(t=Al,e=Ml,Ml=Al=null,cf(t),e)))for(t=0;t<e.length;t++)cf(e[t])}}function wr(e,t){var l=e.stateNode;if(l===null)return null;var s=l[ln]||null;if(s===null)return null;l=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var na=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_o=!1;if(na)try{var Cr={};Object.defineProperty(Cr,"passive",{get:function(){_o=!0}}),window.addEventListener("test",Cr,Cr),window.removeEventListener("test",Cr,Cr)}catch{_o=!1}var ja=null,Oo=null,Hs=null;function df(){if(Hs)return Hs;var e,t=Oo,l=t.length,s,c="value"in ja?ja.value:ja.textContent,d=c.length;for(e=0;e<l&&t[e]===c[e];e++);var b=l-e;for(s=1;s<=b&&t[l-s]===c[d-s];s++);return Hs=c.slice(e,1<s?1-s:void 0)}function Us(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Vs(){return!0}function ff(){return!1}function rn(e){function t(l,s,c,d,b){this._reactName=l,this._targetInst=c,this.type=s,this.nativeEvent=d,this.target=b,this.currentTarget=null;for(var C in e)e.hasOwnProperty(C)&&(l=e[C],this[C]=l?l(d):d[C]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Vs:ff,this.isPropagationStopped=ff,this}return g(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Vs)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Vs)},persist:function(){},isPersistent:Vs}),t}var el={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$s=rn(el),Nr=g({},el,{view:0,detail:0}),Bg=rn(Nr),Bo,Io,Er,Gs=g({},Nr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uo,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Er&&(Er&&e.type==="mousemove"?(Bo=e.screenX-Er.screenX,Io=e.screenY-Er.screenY):Io=Bo=0,Er=e),Bo)},movementY:function(e){return"movementY"in e?e.movementY:Io}}),pf=rn(Gs),Ig=g({},Gs,{dataTransfer:0}),Hg=rn(Ig),Ug=g({},Nr,{relatedTarget:0}),Ho=rn(Ug),Vg=g({},el,{animationName:0,elapsedTime:0,pseudoElement:0}),$g=rn(Vg),Gg=g({},el,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Pg=rn(Gg),qg=g({},el,{data:0}),mf=rn(qg),Yg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Fg={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Wg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Kg(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Wg[e])?!!t[e]:!1}function Uo(){return Kg}var Xg=g({},Nr,{key:function(e){if(e.key){var t=Yg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Us(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Fg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uo,charCode:function(e){return e.type==="keypress"?Us(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Us(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qg=rn(Xg),Zg=g({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hf=rn(Zg),Jg=g({},Nr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uo}),ey=rn(Jg),ty=g({},el,{propertyName:0,elapsedTime:0,pseudoElement:0}),ny=rn(ty),ay=g({},Gs,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),ly=rn(ay),ry=g({},el,{newState:0,oldState:0}),sy=rn(ry),iy=[9,13,27,32],Vo=na&&"CompositionEvent"in window,Tr=null;na&&"documentMode"in document&&(Tr=document.documentMode);var oy=na&&"TextEvent"in window&&!Tr,xf=na&&(!Vo||Tr&&8<Tr&&11>=Tr),vf=" ",gf=!1;function yf(e,t){switch(e){case"keyup":return iy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var zl=!1;function cy(e,t){switch(e){case"compositionend":return bf(t);case"keypress":return t.which!==32?null:(gf=!0,vf);case"textInput":return e=t.data,e===vf&&gf?null:e;default:return null}}function uy(e,t){if(zl)return e==="compositionend"||!Vo&&yf(e,t)?(e=df(),Hs=Oo=ja=null,zl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return xf&&t.locale!=="ko"?null:t.data;default:return null}}var dy={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function jf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!dy[e.type]:t==="textarea"}function Sf(e,t,l,s){Al?Ml?Ml.push(s):Ml=[s]:Al=s,t=zi(t,"onChange"),0<t.length&&(l=new $s("onChange","change",null,l,s),e.push({event:l,listeners:t}))}var Rr=null,Ar=null;function fy(e){lh(e,0)}function Ps(e){var t=kr(e);if(nf(t))return e}function kf(e,t){if(e==="change")return t}var wf=!1;if(na){var $o;if(na){var Go="oninput"in document;if(!Go){var Cf=document.createElement("div");Cf.setAttribute("oninput","return;"),Go=typeof Cf.oninput=="function"}$o=Go}else $o=!1;wf=$o&&(!document.documentMode||9<document.documentMode)}function Nf(){Rr&&(Rr.detachEvent("onpropertychange",Ef),Ar=Rr=null)}function Ef(e){if(e.propertyName==="value"&&Ps(Ar)){var t=[];Sf(t,Ar,e,Lo(e)),uf(fy,t)}}function py(e,t,l){e==="focusin"?(Nf(),Rr=t,Ar=l,Rr.attachEvent("onpropertychange",Ef)):e==="focusout"&&Nf()}function my(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ps(Ar)}function hy(e,t){if(e==="click")return Ps(t)}function xy(e,t){if(e==="input"||e==="change")return Ps(t)}function vy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fn=typeof Object.is=="function"?Object.is:vy;function Mr(e,t){if(fn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),s=Object.keys(t);if(l.length!==s.length)return!1;for(s=0;s<l.length;s++){var c=l[s];if(!dt.call(t,c)||!fn(e[c],t[c]))return!1}return!0}function Tf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Rf(e,t){var l=Tf(e);e=0;for(var s;l;){if(l.nodeType===3){if(s=e+l.textContent.length,e<=t&&s>=t)return{node:l,offset:t-e};e=s}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Tf(l)}}function Af(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Af(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Mf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bs(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=Bs(e.document)}return t}function Po(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var gy=na&&"documentMode"in document&&11>=document.documentMode,Ll=null,qo=null,zr=null,Yo=!1;function zf(e,t,l){var s=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Yo||Ll==null||Ll!==Bs(s)||(s=Ll,"selectionStart"in s&&Po(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),zr&&Mr(zr,s)||(zr=s,s=zi(qo,"onSelect"),0<s.length&&(t=new $s("onSelect","select",null,t,l),e.push({event:t,listeners:s}),t.target=Ll)))}function tl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Dl={animationend:tl("Animation","AnimationEnd"),animationiteration:tl("Animation","AnimationIteration"),animationstart:tl("Animation","AnimationStart"),transitionrun:tl("Transition","TransitionRun"),transitionstart:tl("Transition","TransitionStart"),transitioncancel:tl("Transition","TransitionCancel"),transitionend:tl("Transition","TransitionEnd")},Fo={},Lf={};na&&(Lf=document.createElement("div").style,"AnimationEvent"in window||(delete Dl.animationend.animation,delete Dl.animationiteration.animation,delete Dl.animationstart.animation),"TransitionEvent"in window||delete Dl.transitionend.transition);function nl(e){if(Fo[e])return Fo[e];if(!Dl[e])return e;var t=Dl[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Lf)return Fo[e]=t[l];return e}var Df=nl("animationend"),_f=nl("animationiteration"),Of=nl("animationstart"),yy=nl("transitionrun"),by=nl("transitionstart"),jy=nl("transitioncancel"),Bf=nl("transitionend"),If=new Map,Wo="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Wo.push("scrollEnd");function Hn(e,t){If.set(e,t),Ja(t,[e])}var qs=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},En=[],_l=0,Ko=0;function Ys(){for(var e=_l,t=Ko=_l=0;t<e;){var l=En[t];En[t++]=null;var s=En[t];En[t++]=null;var c=En[t];En[t++]=null;var d=En[t];if(En[t++]=null,s!==null&&c!==null){var b=s.pending;b===null?c.next=c:(c.next=b.next,b.next=c),s.pending=c}d!==0&&Hf(l,c,d)}}function Fs(e,t,l,s){En[_l++]=e,En[_l++]=t,En[_l++]=l,En[_l++]=s,Ko|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Xo(e,t,l,s){return Fs(e,t,l,s),Ws(e)}function al(e,t){return Fs(e,null,null,t),Ws(e)}function Hf(e,t,l){e.lanes|=l;var s=e.alternate;s!==null&&(s.lanes|=l);for(var c=!1,d=e.return;d!==null;)d.childLanes|=l,s=d.alternate,s!==null&&(s.childLanes|=l),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-bt(l),e=d.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=l|536870912),d):null}function Ws(e){if(50<es)throw es=0,ru=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ol={};function Sy(e,t,l,s){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pn(e,t,l,s){return new Sy(e,t,l,s)}function Qo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function aa(e,t){var l=e.alternate;return l===null?(l=pn(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Uf(e,t){e.flags&=65011714;var l=e.alternate;return l===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ks(e,t,l,s,c,d){var b=0;if(s=e,typeof e=="function")Qo(e)&&(b=1);else if(typeof e=="string")b=E1(e,l,fe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case R:return e=pn(31,l,t,c),e.elementType=R,e.lanes=d,e;case z:return ll(l.children,c,d,t);case T:b=8,c|=24;break;case k:return e=pn(12,l,t,c|2),e.elementType=k,e.lanes=d,e;case A:return e=pn(13,l,t,c),e.elementType=A,e.lanes=d,e;case U:return e=pn(19,l,t,c),e.elementType=U,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O:b=10;break e;case M:b=9;break e;case V:b=11;break e;case w:b=14;break e;case L:b=16,s=null;break e}b=29,l=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=pn(b,l,t,c),t.elementType=e,t.type=s,t.lanes=d,t}function ll(e,t,l,s){return e=pn(7,e,s,t),e.lanes=l,e}function Zo(e,t,l){return e=pn(6,e,null,t),e.lanes=l,e}function Vf(e){var t=pn(18,null,null,0);return t.stateNode=e,t}function Jo(e,t,l){return t=pn(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var $f=new WeakMap;function Tn(e,t){if(typeof e=="object"&&e!==null){var l=$f.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Me(t)},$f.set(e,t),t)}return{value:e,source:t,stack:Me(t)}}var Bl=[],Il=0,Xs=null,Lr=0,Rn=[],An=0,Sa=null,Pn=1,qn="";function la(e,t){Bl[Il++]=Lr,Bl[Il++]=Xs,Xs=e,Lr=t}function Gf(e,t,l){Rn[An++]=Pn,Rn[An++]=qn,Rn[An++]=Sa,Sa=e;var s=Pn;e=qn;var c=32-bt(s)-1;s&=~(1<<c),l+=1;var d=32-bt(t)+c;if(30<d){var b=c-c%5;d=(s&(1<<b)-1).toString(32),s>>=b,c-=b,Pn=1<<32-bt(t)+c|l<<c|s,qn=d+e}else Pn=1<<d|l<<c|s,qn=e}function ec(e){e.return!==null&&(la(e,1),Gf(e,1,0))}function tc(e){for(;e===Xs;)Xs=Bl[--Il],Bl[Il]=null,Lr=Bl[--Il],Bl[Il]=null;for(;e===Sa;)Sa=Rn[--An],Rn[An]=null,qn=Rn[--An],Rn[An]=null,Pn=Rn[--An],Rn[An]=null}function Pf(e,t){Rn[An++]=Pn,Rn[An++]=qn,Rn[An++]=Sa,Pn=t.id,qn=t.overflow,Sa=e}var Pt=null,ft=null,We=!1,ka=null,Mn=!1,nc=Error(o(519));function wa(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Dr(Tn(t,e)),nc}function qf(e){var t=e.stateNode,l=e.type,s=e.memoizedProps;switch(t[Gt]=e,t[ln]=s,l){case"dialog":qe("cancel",t),qe("close",t);break;case"iframe":case"object":case"embed":qe("load",t);break;case"video":case"audio":for(l=0;l<ns.length;l++)qe(ns[l],t);break;case"source":qe("error",t);break;case"img":case"image":case"link":qe("error",t),qe("load",t);break;case"details":qe("toggle",t);break;case"input":qe("invalid",t),af(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":qe("invalid",t);break;case"textarea":qe("invalid",t),rf(t,s.value,s.defaultValue,s.children)}l=s.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||s.suppressHydrationWarning===!0||oh(t.textContent,l)?(s.popover!=null&&(qe("beforetoggle",t),qe("toggle",t)),s.onScroll!=null&&qe("scroll",t),s.onScrollEnd!=null&&qe("scrollend",t),s.onClick!=null&&(t.onclick=ta),t=!0):t=!1,t||wa(e,!0)}function Yf(e){for(Pt=e.return;Pt;)switch(Pt.tag){case 5:case 31:case 13:Mn=!1;return;case 27:case 3:Mn=!0;return;default:Pt=Pt.return}}function Hl(e){if(e!==Pt)return!1;if(!We)return Yf(e),We=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||bu(e.type,e.memoizedProps)),l=!l),l&&ft&&wa(e),Yf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=vh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=vh(e)}else t===27?(t=ft,Ia(e.type)?(e=Cu,Cu=null,ft=e):ft=t):ft=Pt?Ln(e.stateNode.nextSibling):null;return!0}function rl(){ft=Pt=null,We=!1}function ac(){var e=ka;return e!==null&&(un===null?un=e:un.push.apply(un,e),ka=null),e}function Dr(e){ka===null?ka=[e]:ka.push(e)}var lc=D(null),sl=null,ra=null;function Ca(e,t,l){oe(lc,t._currentValue),t._currentValue=l}function sa(e){e._currentValue=lc.current,K(lc)}function rc(e,t,l){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===l)break;e=e.return}}function sc(e,t,l,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var b=c.child;d=d.firstContext;e:for(;d!==null;){var C=d;d=c;for(var H=0;H<t.length;H++)if(C.context===t[H]){d.lanes|=l,C=d.alternate,C!==null&&(C.lanes|=l),rc(d.return,l,e),s||(b=null);break e}d=C.next}}else if(c.tag===18){if(b=c.return,b===null)throw Error(o(341));b.lanes|=l,d=b.alternate,d!==null&&(d.lanes|=l),rc(b,l,e),b=null}else b=c.child;if(b!==null)b.return=c;else for(b=c;b!==null;){if(b===e){b=null;break}if(c=b.sibling,c!==null){c.return=b.return,b=c;break}b=b.return}c=b}}function Ul(e,t,l,s){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var b=c.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var C=c.type;fn(c.pendingProps.value,b.value)||(e!==null?e.push(C):e=[C])}}else if(c===ke.current){if(b=c.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(is):e=[is])}c=c.return}e!==null&&sc(t,e,l,s),t.flags|=262144}function Qs(e){for(e=e.firstContext;e!==null;){if(!fn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function il(e){sl=e,ra=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function qt(e){return Ff(sl,e)}function Zs(e,t){return sl===null&&il(e),Ff(e,t)}function Ff(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},ra===null){if(e===null)throw Error(o(308));ra=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ra=ra.next=t;return l}var ky=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},wy=a.unstable_scheduleCallback,Cy=a.unstable_NormalPriority,At={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ic(){return{controller:new ky,data:new Map,refCount:0}}function _r(e){e.refCount--,e.refCount===0&&wy(Cy,function(){e.controller.abort()})}var Or=null,oc=0,Vl=0,$l=null;function Ny(e,t){if(Or===null){var l=Or=[];oc=0,Vl=du(),$l={status:"pending",value:void 0,then:function(s){l.push(s)}}}return oc++,t.then(Wf,Wf),t}function Wf(){if(--oc===0&&Or!==null){$l!==null&&($l.status="fulfilled");var e=Or;Or=null,Vl=0,$l=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ey(e,t){var l=[],s={status:"pending",value:null,reason:null,then:function(c){l.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<l.length;c++)(0,l[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<l.length;c++)(0,l[c])(void 0)}),s}var Kf=E.S;E.S=function(e,t){zm=tt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Ny(e,t),Kf!==null&&Kf(e,t)};var ol=D(null);function cc(){var e=ol.current;return e!==null?e:ut.pooledCache}function Js(e,t){t===null?oe(ol,ol.current):oe(ol,t.pool)}function Xf(){var e=cc();return e===null?null:{parent:At._currentValue,pool:e}}var Gl=Error(o(460)),uc=Error(o(474)),ei=Error(o(542)),ti={then:function(){}};function Qf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Zf(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(ta,ta),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ep(e),e;default:if(typeof t.status=="string")t.then(ta,ta);else{if(e=ut,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=s}},function(s){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ep(e),e}throw ul=t,Gl}}function cl(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ul=l,Gl):l}}var ul=null;function Jf(){if(ul===null)throw Error(o(459));var e=ul;return ul=null,e}function ep(e){if(e===Gl||e===ei)throw Error(o(483))}var Pl=null,Br=0;function ni(e){var t=Br;return Br+=1,Pl===null&&(Pl=[]),Zf(Pl,e,t)}function Ir(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ai(e,t){throw t.$$typeof===j?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function tp(e){function t(P,$){if(e){var W=P.deletions;W===null?(P.deletions=[$],P.flags|=16):W.push($)}}function l(P,$){if(!e)return null;for(;$!==null;)t(P,$),$=$.sibling;return null}function s(P){for(var $=new Map;P!==null;)P.key!==null?$.set(P.key,P):$.set(P.index,P),P=P.sibling;return $}function c(P,$){return P=aa(P,$),P.index=0,P.sibling=null,P}function d(P,$,W){return P.index=W,e?(W=P.alternate,W!==null?(W=W.index,W<$?(P.flags|=67108866,$):W):(P.flags|=67108866,$)):(P.flags|=1048576,$)}function b(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function C(P,$,W,re){return $===null||$.tag!==6?($=Zo(W,P.mode,re),$.return=P,$):($=c($,W),$.return=P,$)}function H(P,$,W,re){var Ee=W.type;return Ee===z?le(P,$,W.props.children,re,W.key):$!==null&&($.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===L&&cl(Ee)===$.type)?($=c($,W.props),Ir($,W),$.return=P,$):($=Ks(W.type,W.key,W.props,null,P.mode,re),Ir($,W),$.return=P,$)}function X(P,$,W,re){return $===null||$.tag!==4||$.stateNode.containerInfo!==W.containerInfo||$.stateNode.implementation!==W.implementation?($=Jo(W,P.mode,re),$.return=P,$):($=c($,W.children||[]),$.return=P,$)}function le(P,$,W,re,Ee){return $===null||$.tag!==7?($=ll(W,P.mode,re,Ee),$.return=P,$):($=c($,W),$.return=P,$)}function ie(P,$,W){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=Zo(""+$,P.mode,W),$.return=P,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case S:return W=Ks($.type,$.key,$.props,null,P.mode,W),Ir(W,$),W.return=P,W;case N:return $=Jo($,P.mode,W),$.return=P,$;case L:return $=cl($),ie(P,$,W)}if(_($)||Y($))return $=ll($,P.mode,W,null),$.return=P,$;if(typeof $.then=="function")return ie(P,ni($),W);if($.$$typeof===O)return ie(P,Zs(P,$),W);ai(P,$)}return null}function Q(P,$,W,re){var Ee=$!==null?$.key:null;if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return Ee!==null?null:C(P,$,""+W,re);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case S:return W.key===Ee?H(P,$,W,re):null;case N:return W.key===Ee?X(P,$,W,re):null;case L:return W=cl(W),Q(P,$,W,re)}if(_(W)||Y(W))return Ee!==null?null:le(P,$,W,re,null);if(typeof W.then=="function")return Q(P,$,ni(W),re);if(W.$$typeof===O)return Q(P,$,Zs(P,W),re);ai(P,W)}return null}function ee(P,$,W,re,Ee){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return P=P.get(W)||null,C($,P,""+re,Ee);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case S:return P=P.get(re.key===null?W:re.key)||null,H($,P,re,Ee);case N:return P=P.get(re.key===null?W:re.key)||null,X($,P,re,Ee);case L:return re=cl(re),ee(P,$,W,re,Ee)}if(_(re)||Y(re))return P=P.get(W)||null,le($,P,re,Ee,null);if(typeof re.then=="function")return ee(P,$,W,ni(re),Ee);if(re.$$typeof===O)return ee(P,$,W,Zs($,re),Ee);ai($,re)}return null}function be(P,$,W,re){for(var Ee=null,Xe=null,Se=$,Ie=$=0,Fe=null;Se!==null&&Ie<W.length;Ie++){Se.index>Ie?(Fe=Se,Se=null):Fe=Se.sibling;var Qe=Q(P,Se,W[Ie],re);if(Qe===null){Se===null&&(Se=Fe);break}e&&Se&&Qe.alternate===null&&t(P,Se),$=d(Qe,$,Ie),Xe===null?Ee=Qe:Xe.sibling=Qe,Xe=Qe,Se=Fe}if(Ie===W.length)return l(P,Se),We&&la(P,Ie),Ee;if(Se===null){for(;Ie<W.length;Ie++)Se=ie(P,W[Ie],re),Se!==null&&($=d(Se,$,Ie),Xe===null?Ee=Se:Xe.sibling=Se,Xe=Se);return We&&la(P,Ie),Ee}for(Se=s(Se);Ie<W.length;Ie++)Fe=ee(Se,P,Ie,W[Ie],re),Fe!==null&&(e&&Fe.alternate!==null&&Se.delete(Fe.key===null?Ie:Fe.key),$=d(Fe,$,Ie),Xe===null?Ee=Fe:Xe.sibling=Fe,Xe=Fe);return e&&Se.forEach(function(Ga){return t(P,Ga)}),We&&la(P,Ie),Ee}function Te(P,$,W,re){if(W==null)throw Error(o(151));for(var Ee=null,Xe=null,Se=$,Ie=$=0,Fe=null,Qe=W.next();Se!==null&&!Qe.done;Ie++,Qe=W.next()){Se.index>Ie?(Fe=Se,Se=null):Fe=Se.sibling;var Ga=Q(P,Se,Qe.value,re);if(Ga===null){Se===null&&(Se=Fe);break}e&&Se&&Ga.alternate===null&&t(P,Se),$=d(Ga,$,Ie),Xe===null?Ee=Ga:Xe.sibling=Ga,Xe=Ga,Se=Fe}if(Qe.done)return l(P,Se),We&&la(P,Ie),Ee;if(Se===null){for(;!Qe.done;Ie++,Qe=W.next())Qe=ie(P,Qe.value,re),Qe!==null&&($=d(Qe,$,Ie),Xe===null?Ee=Qe:Xe.sibling=Qe,Xe=Qe);return We&&la(P,Ie),Ee}for(Se=s(Se);!Qe.done;Ie++,Qe=W.next())Qe=ee(Se,P,Ie,Qe.value,re),Qe!==null&&(e&&Qe.alternate!==null&&Se.delete(Qe.key===null?Ie:Qe.key),$=d(Qe,$,Ie),Xe===null?Ee=Qe:Xe.sibling=Qe,Xe=Qe);return e&&Se.forEach(function(I1){return t(P,I1)}),We&&la(P,Ie),Ee}function it(P,$,W,re){if(typeof W=="object"&&W!==null&&W.type===z&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case S:e:{for(var Ee=W.key;$!==null;){if($.key===Ee){if(Ee=W.type,Ee===z){if($.tag===7){l(P,$.sibling),re=c($,W.props.children),re.return=P,P=re;break e}}else if($.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===L&&cl(Ee)===$.type){l(P,$.sibling),re=c($,W.props),Ir(re,W),re.return=P,P=re;break e}l(P,$);break}else t(P,$);$=$.sibling}W.type===z?(re=ll(W.props.children,P.mode,re,W.key),re.return=P,P=re):(re=Ks(W.type,W.key,W.props,null,P.mode,re),Ir(re,W),re.return=P,P=re)}return b(P);case N:e:{for(Ee=W.key;$!==null;){if($.key===Ee)if($.tag===4&&$.stateNode.containerInfo===W.containerInfo&&$.stateNode.implementation===W.implementation){l(P,$.sibling),re=c($,W.children||[]),re.return=P,P=re;break e}else{l(P,$);break}else t(P,$);$=$.sibling}re=Jo(W,P.mode,re),re.return=P,P=re}return b(P);case L:return W=cl(W),it(P,$,W,re)}if(_(W))return be(P,$,W,re);if(Y(W)){if(Ee=Y(W),typeof Ee!="function")throw Error(o(150));return W=Ee.call(W),Te(P,$,W,re)}if(typeof W.then=="function")return it(P,$,ni(W),re);if(W.$$typeof===O)return it(P,$,Zs(P,W),re);ai(P,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,$!==null&&$.tag===6?(l(P,$.sibling),re=c($,W),re.return=P,P=re):(l(P,$),re=Zo(W,P.mode,re),re.return=P,P=re),b(P)):l(P,$)}return function(P,$,W,re){try{Br=0;var Ee=it(P,$,W,re);return Pl=null,Ee}catch(Se){if(Se===Gl||Se===ei)throw Se;var Xe=pn(29,Se,null,P.mode);return Xe.lanes=re,Xe.return=P,Xe}finally{}}}var dl=tp(!0),np=tp(!1),Na=!1;function dc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function fc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ea(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ta(e,t,l){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Je&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=Ws(e),Hf(e,null,l),t}return Fs(e,s,t,l),Ws(e)}function Hr(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,Yd(e,l)}}function pc(e,t){var l=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,l===s)){var c=null,d=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};d===null?c=d=b:d=d.next=b,l=l.next}while(l!==null);d===null?c=d=t:d=d.next=t}else c=d=t;l={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:s.shared,callbacks:s.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var mc=!1;function Ur(){if(mc){var e=$l;if(e!==null)throw e}}function Vr(e,t,l,s){mc=!1;var c=e.updateQueue;Na=!1;var d=c.firstBaseUpdate,b=c.lastBaseUpdate,C=c.shared.pending;if(C!==null){c.shared.pending=null;var H=C,X=H.next;H.next=null,b===null?d=X:b.next=X,b=H;var le=e.alternate;le!==null&&(le=le.updateQueue,C=le.lastBaseUpdate,C!==b&&(C===null?le.firstBaseUpdate=X:C.next=X,le.lastBaseUpdate=H))}if(d!==null){var ie=c.baseState;b=0,le=X=H=null,C=d;do{var Q=C.lane&-536870913,ee=Q!==C.lane;if(ee?(Ye&Q)===Q:(s&Q)===Q){Q!==0&&Q===Vl&&(mc=!0),le!==null&&(le=le.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var be=e,Te=C;Q=t;var it=l;switch(Te.tag){case 1:if(be=Te.payload,typeof be=="function"){ie=be.call(it,ie,Q);break e}ie=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Te.payload,Q=typeof be=="function"?be.call(it,ie,Q):be,Q==null)break e;ie=g({},ie,Q);break e;case 2:Na=!0}}Q=C.callback,Q!==null&&(e.flags|=64,ee&&(e.flags|=8192),ee=c.callbacks,ee===null?c.callbacks=[Q]:ee.push(Q))}else ee={lane:Q,tag:C.tag,payload:C.payload,callback:C.callback,next:null},le===null?(X=le=ee,H=ie):le=le.next=ee,b|=Q;if(C=C.next,C===null){if(C=c.shared.pending,C===null)break;ee=C,C=ee.next,ee.next=null,c.lastBaseUpdate=ee,c.shared.pending=null}}while(!0);le===null&&(H=ie),c.baseState=H,c.firstBaseUpdate=X,c.lastBaseUpdate=le,d===null&&(c.shared.lanes=0),La|=b,e.lanes=b,e.memoizedState=ie}}function ap(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function lp(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)ap(l[e],t)}var ql=D(null),li=D(0);function rp(e,t){e=ha,oe(li,e),oe(ql,t),ha=e|t.baseLanes}function hc(){oe(li,ha),oe(ql,ql.current)}function xc(){ha=li.current,K(ql),K(li)}var mn=D(null),zn=null;function Ra(e){var t=e.alternate;oe(Et,Et.current&1),oe(mn,e),zn===null&&(t===null||ql.current!==null||t.memoizedState!==null)&&(zn=e)}function vc(e){oe(Et,Et.current),oe(mn,e),zn===null&&(zn=e)}function sp(e){e.tag===22?(oe(Et,Et.current),oe(mn,e),zn===null&&(zn=e)):Aa()}function Aa(){oe(Et,Et.current),oe(mn,mn.current)}function hn(e){K(mn),zn===e&&(zn=null),K(Et)}var Et=D(0);function ri(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||ku(l)||wu(l)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ia=0,Be=null,rt=null,Mt=null,si=!1,Yl=!1,fl=!1,ii=0,$r=0,Fl=null,Ty=0;function kt(){throw Error(o(321))}function gc(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!fn(e[l],t[l]))return!1;return!0}function yc(e,t,l,s,c,d){return ia=d,Be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?Gp:Dc,fl=!1,d=l(s,c),fl=!1,Yl&&(d=op(t,l,s,c)),ip(e),d}function ip(e){E.H=qr;var t=rt!==null&&rt.next!==null;if(ia=0,Mt=rt=Be=null,si=!1,$r=0,Fl=null,t)throw Error(o(300));e===null||zt||(e=e.dependencies,e!==null&&Qs(e)&&(zt=!0))}function op(e,t,l,s){Be=e;var c=0;do{if(Yl&&(Fl=null),$r=0,Yl=!1,25<=c)throw Error(o(301));if(c+=1,Mt=rt=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}E.H=Pp,d=t(l,s)}while(Yl);return d}function Ry(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?Gr(t):t,e=e.useState()[0],(rt!==null?rt.memoizedState:null)!==e&&(Be.flags|=1024),t}function bc(){var e=ii!==0;return ii=0,e}function jc(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Sc(e){if(si){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}si=!1}ia=0,Mt=rt=Be=null,Yl=!1,$r=ii=0,Fl=null}function Jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?Be.memoizedState=Mt=e:Mt=Mt.next=e,Mt}function Tt(){if(rt===null){var e=Be.alternate;e=e!==null?e.memoizedState:null}else e=rt.next;var t=Mt===null?Be.memoizedState:Mt.next;if(t!==null)Mt=t,rt=e;else{if(e===null)throw Be.alternate===null?Error(o(467)):Error(o(310));rt=e,e={memoizedState:rt.memoizedState,baseState:rt.baseState,baseQueue:rt.baseQueue,queue:rt.queue,next:null},Mt===null?Be.memoizedState=Mt=e:Mt=Mt.next=e}return Mt}function oi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gr(e){var t=$r;return $r+=1,Fl===null&&(Fl=[]),e=Zf(Fl,e,t),t=Be,(Mt===null?t.memoizedState:Mt.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?Gp:Dc),e}function ci(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Gr(e);if(e.$$typeof===O)return qt(e)}throw Error(o(438,String(e)))}function kc(e){var t=null,l=Be.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var s=Be.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=oi(),Be.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),s=0;s<e;s++)l[s]=I;return t.index++,l}function oa(e,t){return typeof t=="function"?t(e):t}function ui(e){var t=Tt();return wc(t,rt,e)}function wc(e,t,l){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=l;var c=e.baseQueue,d=s.pending;if(d!==null){if(c!==null){var b=c.next;c.next=d.next,d.next=b}t.baseQueue=c=d,s.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var C=b=null,H=null,X=t,le=!1;do{var ie=X.lane&-536870913;if(ie!==X.lane?(Ye&ie)===ie:(ia&ie)===ie){var Q=X.revertLane;if(Q===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null}),ie===Vl&&(le=!0);else if((ia&Q)===Q){X=X.next,Q===Vl&&(le=!0);continue}else ie={lane:0,revertLane:X.revertLane,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},H===null?(C=H=ie,b=d):H=H.next=ie,Be.lanes|=Q,La|=Q;ie=X.action,fl&&l(d,ie),d=X.hasEagerState?X.eagerState:l(d,ie)}else Q={lane:ie,revertLane:X.revertLane,gesture:X.gesture,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},H===null?(C=H=Q,b=d):H=H.next=Q,Be.lanes|=ie,La|=ie;X=X.next}while(X!==null&&X!==t);if(H===null?b=d:H.next=C,!fn(d,e.memoizedState)&&(zt=!0,le&&(l=$l,l!==null)))throw l;e.memoizedState=d,e.baseState=b,e.baseQueue=H,s.lastRenderedState=d}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Cc(e){var t=Tt(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var s=l.dispatch,c=l.pending,d=t.memoizedState;if(c!==null){l.pending=null;var b=c=c.next;do d=e(d,b.action),b=b.next;while(b!==c);fn(d,t.memoizedState)||(zt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),l.lastRenderedState=d}return[d,s]}function cp(e,t,l){var s=Be,c=Tt(),d=We;if(d){if(l===void 0)throw Error(o(407));l=l()}else l=t();var b=!fn((rt||c).memoizedState,l);if(b&&(c.memoizedState=l,zt=!0),c=c.queue,Tc(fp.bind(null,s,c,e),[e]),c.getSnapshot!==t||b||Mt!==null&&Mt.memoizedState.tag&1){if(s.flags|=2048,Wl(9,{destroy:void 0},dp.bind(null,s,c,l,t),null),ut===null)throw Error(o(349));d||(ia&127)!==0||up(s,t,l)}return l}function up(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Be.updateQueue,t===null?(t=oi(),Be.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function dp(e,t,l,s){t.value=l,t.getSnapshot=s,pp(t)&&mp(e)}function fp(e,t,l){return l(function(){pp(t)&&mp(e)})}function pp(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!fn(e,l)}catch{return!0}}function mp(e){var t=al(e,2);t!==null&&dn(t,e,2)}function Nc(e){var t=Jt();if(typeof e=="function"){var l=e;if(e=l(),fl){St(!0);try{l()}finally{St(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oa,lastRenderedState:e},t}function hp(e,t,l,s){return e.baseState=l,wc(e,rt,typeof s=="function"?s:oa)}function Ay(e,t,l,s,c){if(pi(e))throw Error(o(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){d.listeners.push(b)}};E.T!==null?l(!0):d.isTransition=!1,s(d),l=t.pending,l===null?(d.next=t.pending=d,xp(t,d)):(d.next=l.next,t.pending=l.next=d)}}function xp(e,t){var l=t.action,s=t.payload,c=e.state;if(t.isTransition){var d=E.T,b={};E.T=b;try{var C=l(c,s),H=E.S;H!==null&&H(b,C),vp(e,t,C)}catch(X){Ec(e,t,X)}finally{d!==null&&b.types!==null&&(d.types=b.types),E.T=d}}else try{d=l(c,s),vp(e,t,d)}catch(X){Ec(e,t,X)}}function vp(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(s){gp(e,t,s)},function(s){return Ec(e,t,s)}):gp(e,t,l)}function gp(e,t,l){t.status="fulfilled",t.value=l,yp(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,xp(e,l)))}function Ec(e,t,l){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=l,yp(t),t=t.next;while(t!==s)}e.action=null}function yp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function bp(e,t){return t}function jp(e,t){if(We){var l=ut.formState;if(l!==null){e:{var s=Be;if(We){if(ft){t:{for(var c=ft,d=Mn;c.nodeType!==8;){if(!d){c=null;break t}if(c=Ln(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){ft=Ln(c.nextSibling),s=c.data==="F!";break e}}wa(s)}s=!1}s&&(t=l[0])}}return l=Jt(),l.memoizedState=l.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bp,lastRenderedState:t},l.queue=s,l=Up.bind(null,Be,s),s.dispatch=l,s=Nc(!1),d=Lc.bind(null,Be,!1,s.queue),s=Jt(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,l=Ay.bind(null,Be,c,d,l),c.dispatch=l,s.memoizedState=e,[t,l,!1]}function Sp(e){var t=Tt();return kp(t,rt,e)}function kp(e,t,l){if(t=wc(e,t,bp)[0],e=ui(oa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Gr(t)}catch(b){throw b===Gl?ei:b}else s=t;t=Tt();var c=t.queue,d=c.dispatch;return l!==t.memoizedState&&(Be.flags|=2048,Wl(9,{destroy:void 0},My.bind(null,c,l),null)),[s,d,e]}function My(e,t){e.action=t}function wp(e){var t=Tt(),l=rt;if(l!==null)return kp(t,l,e);Tt(),t=t.memoizedState,l=Tt();var s=l.queue.dispatch;return l.memoizedState=e,[t,s,!1]}function Wl(e,t,l,s){return e={tag:e,create:l,deps:s,inst:t,next:null},t=Be.updateQueue,t===null&&(t=oi(),Be.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(s=l.next,l.next=e,e.next=s,t.lastEffect=e),e}function Cp(){return Tt().memoizedState}function di(e,t,l,s){var c=Jt();Be.flags|=e,c.memoizedState=Wl(1|t,{destroy:void 0},l,s===void 0?null:s)}function fi(e,t,l,s){var c=Tt();s=s===void 0?null:s;var d=c.memoizedState.inst;rt!==null&&s!==null&&gc(s,rt.memoizedState.deps)?c.memoizedState=Wl(t,d,l,s):(Be.flags|=e,c.memoizedState=Wl(1|t,d,l,s))}function Np(e,t){di(8390656,8,e,t)}function Tc(e,t){fi(2048,8,e,t)}function zy(e){Be.flags|=4;var t=Be.updateQueue;if(t===null)t=oi(),Be.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function Ep(e){var t=Tt().memoizedState;return zy({ref:t,nextImpl:e}),function(){if((Je&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Tp(e,t){return fi(4,2,e,t)}function Rp(e,t){return fi(4,4,e,t)}function Ap(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Mp(e,t,l){l=l!=null?l.concat([e]):null,fi(4,4,Ap.bind(null,t,e),l)}function Rc(){}function zp(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;return t!==null&&gc(t,s[1])?s[0]:(l.memoizedState=[e,t],e)}function Lp(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;if(t!==null&&gc(t,s[1]))return s[0];if(s=e(),fl){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[s,t],s}function Ac(e,t,l){return l===void 0||(ia&1073741824)!==0&&(Ye&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=Dm(),Be.lanes|=e,La|=e,l)}function Dp(e,t,l,s){return fn(l,t)?l:ql.current!==null?(e=Ac(e,l,s),fn(e,t)||(zt=!0),e):(ia&42)===0||(ia&1073741824)!==0&&(Ye&261930)===0?(zt=!0,e.memoizedState=l):(e=Dm(),Be.lanes|=e,La|=e,t)}function _p(e,t,l,s,c){var d=B.p;B.p=d!==0&&8>d?d:8;var b=E.T,C={};E.T=C,Lc(e,!1,t,l);try{var H=c(),X=E.S;if(X!==null&&X(C,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var le=Ey(H,s);Pr(e,t,le,gn(e))}else Pr(e,t,s,gn(e))}catch(ie){Pr(e,t,{then:function(){},status:"rejected",reason:ie},gn())}finally{B.p=d,b!==null&&C.types!==null&&(b.types=C.types),E.T=b}}function Ly(){}function Mc(e,t,l,s){if(e.tag!==5)throw Error(o(476));var c=Op(e).queue;_p(e,c,t,ne,l===null?Ly:function(){return Bp(e),l(s)})}function Op(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:oa,lastRenderedState:ne},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:oa,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Bp(e){var t=Op(e);t.next===null&&(t=e.alternate.memoizedState),Pr(e,t.next.queue,{},gn())}function zc(){return qt(is)}function Ip(){return Tt().memoizedState}function Hp(){return Tt().memoizedState}function Dy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=gn();e=Ea(l);var s=Ta(t,e,l);s!==null&&(dn(s,t,l),Hr(s,t,l)),t={cache:ic()},e.payload=t;return}t=t.return}}function _y(e,t,l){var s=gn();l={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},pi(e)?Vp(t,l):(l=Xo(e,t,l,s),l!==null&&(dn(l,e,s),$p(l,t,s)))}function Up(e,t,l){var s=gn();Pr(e,t,l,s)}function Pr(e,t,l,s){var c={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(pi(e))Vp(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var b=t.lastRenderedState,C=d(b,l);if(c.hasEagerState=!0,c.eagerState=C,fn(C,b))return Fs(e,t,c,0),ut===null&&Ys(),!1}catch{}finally{}if(l=Xo(e,t,c,s),l!==null)return dn(l,e,s),$p(l,t,s),!0}return!1}function Lc(e,t,l,s){if(s={lane:2,revertLane:du(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},pi(e)){if(t)throw Error(o(479))}else t=Xo(e,l,s,2),t!==null&&dn(t,e,2)}function pi(e){var t=e.alternate;return e===Be||t!==null&&t===Be}function Vp(e,t){Yl=si=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function $p(e,t,l){if((l&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,Yd(e,l)}}var qr={readContext:qt,use:ci,useCallback:kt,useContext:kt,useEffect:kt,useImperativeHandle:kt,useLayoutEffect:kt,useInsertionEffect:kt,useMemo:kt,useReducer:kt,useRef:kt,useState:kt,useDebugValue:kt,useDeferredValue:kt,useTransition:kt,useSyncExternalStore:kt,useId:kt,useHostTransitionStatus:kt,useFormState:kt,useActionState:kt,useOptimistic:kt,useMemoCache:kt,useCacheRefresh:kt};qr.useEffectEvent=kt;var Gp={readContext:qt,use:ci,useCallback:function(e,t){return Jt().memoizedState=[e,t===void 0?null:t],e},useContext:qt,useEffect:Np,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,di(4194308,4,Ap.bind(null,t,e),l)},useLayoutEffect:function(e,t){return di(4194308,4,e,t)},useInsertionEffect:function(e,t){di(4,2,e,t)},useMemo:function(e,t){var l=Jt();t=t===void 0?null:t;var s=e();if(fl){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[s,t],s},useReducer:function(e,t,l){var s=Jt();if(l!==void 0){var c=l(t);if(fl){St(!0);try{l(t)}finally{St(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=_y.bind(null,Be,e),[s.memoizedState,e]},useRef:function(e){var t=Jt();return e={current:e},t.memoizedState=e},useState:function(e){e=Nc(e);var t=e.queue,l=Up.bind(null,Be,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Rc,useDeferredValue:function(e,t){var l=Jt();return Ac(l,e,t)},useTransition:function(){var e=Nc(!1);return e=_p.bind(null,Be,e.queue,!0,!1),Jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var s=Be,c=Jt();if(We){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),ut===null)throw Error(o(349));(Ye&127)!==0||up(s,t,l)}c.memoizedState=l;var d={value:l,getSnapshot:t};return c.queue=d,Np(fp.bind(null,s,d,e),[e]),s.flags|=2048,Wl(9,{destroy:void 0},dp.bind(null,s,d,l,t),null),l},useId:function(){var e=Jt(),t=ut.identifierPrefix;if(We){var l=qn,s=Pn;l=(s&~(1<<32-bt(s)-1)).toString(32)+l,t="_"+t+"R_"+l,l=ii++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=Ty++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:zc,useFormState:jp,useActionState:jp,useOptimistic:function(e){var t=Jt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Lc.bind(null,Be,!0,l),l.dispatch=t,[e,t]},useMemoCache:kc,useCacheRefresh:function(){return Jt().memoizedState=Dy.bind(null,Be)},useEffectEvent:function(e){var t=Jt(),l={impl:e};return t.memoizedState=l,function(){if((Je&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},Dc={readContext:qt,use:ci,useCallback:zp,useContext:qt,useEffect:Tc,useImperativeHandle:Mp,useInsertionEffect:Tp,useLayoutEffect:Rp,useMemo:Lp,useReducer:ui,useRef:Cp,useState:function(){return ui(oa)},useDebugValue:Rc,useDeferredValue:function(e,t){var l=Tt();return Dp(l,rt.memoizedState,e,t)},useTransition:function(){var e=ui(oa)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:cp,useId:Ip,useHostTransitionStatus:zc,useFormState:Sp,useActionState:Sp,useOptimistic:function(e,t){var l=Tt();return hp(l,rt,e,t)},useMemoCache:kc,useCacheRefresh:Hp};Dc.useEffectEvent=Ep;var Pp={readContext:qt,use:ci,useCallback:zp,useContext:qt,useEffect:Tc,useImperativeHandle:Mp,useInsertionEffect:Tp,useLayoutEffect:Rp,useMemo:Lp,useReducer:Cc,useRef:Cp,useState:function(){return Cc(oa)},useDebugValue:Rc,useDeferredValue:function(e,t){var l=Tt();return rt===null?Ac(l,e,t):Dp(l,rt.memoizedState,e,t)},useTransition:function(){var e=Cc(oa)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:cp,useId:Ip,useHostTransitionStatus:zc,useFormState:wp,useActionState:wp,useOptimistic:function(e,t){var l=Tt();return rt!==null?hp(l,rt,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:kc,useCacheRefresh:Hp};Pp.useEffectEvent=Ep;function _c(e,t,l,s){t=e.memoizedState,l=l(s,t),l=l==null?t:g({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Oc={enqueueSetState:function(e,t,l){e=e._reactInternals;var s=gn(),c=Ea(s);c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(dn(t,e,s),Hr(t,e,s))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var s=gn(),c=Ea(s);c.tag=1,c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(dn(t,e,s),Hr(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=gn(),s=Ea(l);s.tag=2,t!=null&&(s.callback=t),t=Ta(e,s,l),t!==null&&(dn(t,e,l),Hr(t,e,l))}};function qp(e,t,l,s,c,d,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,d,b):t.prototype&&t.prototype.isPureReactComponent?!Mr(l,s)||!Mr(c,d):!0}function Yp(e,t,l,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,s),t.state!==e&&Oc.enqueueReplaceState(t,t.state,null)}function pl(e,t){var l=t;if("ref"in t){l={};for(var s in t)s!=="ref"&&(l[s]=t[s])}if(e=e.defaultProps){l===t&&(l=g({},l));for(var c in e)l[c]===void 0&&(l[c]=e[c])}return l}function Fp(e){qs(e)}function Wp(e){console.error(e)}function Kp(e){qs(e)}function mi(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Xp(e,t,l){try{var s=e.onCaughtError;s(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function Bc(e,t,l){return l=Ea(l),l.tag=3,l.payload={element:null},l.callback=function(){mi(e,t)},l}function Qp(e){return e=Ea(e),e.tag=3,e}function Zp(e,t,l,s){var c=l.type.getDerivedStateFromError;if(typeof c=="function"){var d=s.value;e.payload=function(){return c(d)},e.callback=function(){Xp(t,l,s)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Xp(t,l,s),typeof c!="function"&&(Da===null?Da=new Set([this]):Da.add(this));var C=s.stack;this.componentDidCatch(s.value,{componentStack:C!==null?C:""})})}function Oy(e,t,l,s,c){if(l.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=l.alternate,t!==null&&Ul(t,l,c,!0),l=mn.current,l!==null){switch(l.tag){case 31:case 13:return zn===null?Ni():l.alternate===null&&wt===0&&(wt=3),l.flags&=-257,l.flags|=65536,l.lanes=c,s===ti?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([s]):t.add(s),ou(e,s,c)),!1;case 22:return l.flags|=65536,s===ti?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([s]):l.add(s)),ou(e,s,c)),!1}throw Error(o(435,l.tag))}return ou(e,s,c),Ni(),!1}if(We)return t=mn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==nc&&(e=Error(o(422),{cause:s}),Dr(Tn(e,l)))):(s!==nc&&(t=Error(o(423),{cause:s}),Dr(Tn(t,l))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Tn(s,l),c=Bc(e.stateNode,s,c),pc(e,c),wt!==4&&(wt=2)),!1;var d=Error(o(520),{cause:s});if(d=Tn(d,l),Jr===null?Jr=[d]:Jr.push(d),wt!==4&&(wt=2),t===null)return!0;s=Tn(s,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=c&-c,l.lanes|=e,e=Bc(l.stateNode,s,e),pc(l,e),!1;case 1:if(t=l.type,d=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(Da===null||!Da.has(d))))return l.flags|=65536,c&=-c,l.lanes|=c,c=Qp(c),Zp(c,e,l,s),pc(l,c),!1}l=l.return}while(l!==null);return!1}var Ic=Error(o(461)),zt=!1;function Yt(e,t,l,s){t.child=e===null?np(t,null,l,s):dl(t,e.child,l,s)}function Jp(e,t,l,s,c){l=l.render;var d=t.ref;if("ref"in s){var b={};for(var C in s)C!=="ref"&&(b[C]=s[C])}else b=s;return il(t),s=yc(e,t,l,b,d,c),C=bc(),e!==null&&!zt?(jc(e,t,c),ca(e,t,c)):(We&&C&&ec(t),t.flags|=1,Yt(e,t,s,c),t.child)}function em(e,t,l,s,c){if(e===null){var d=l.type;return typeof d=="function"&&!Qo(d)&&d.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=d,tm(e,t,d,s,c)):(e=Ks(l.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Yc(e,c)){var b=d.memoizedProps;if(l=l.compare,l=l!==null?l:Mr,l(b,s)&&e.ref===t.ref)return ca(e,t,c)}return t.flags|=1,e=aa(d,s),e.ref=t.ref,e.return=t,t.child=e}function tm(e,t,l,s,c){if(e!==null){var d=e.memoizedProps;if(Mr(d,s)&&e.ref===t.ref)if(zt=!1,t.pendingProps=s=d,Yc(e,c))(e.flags&131072)!==0&&(zt=!0);else return t.lanes=e.lanes,ca(e,t,c)}return Hc(e,t,l,s,c)}function nm(e,t,l,s){var c=s.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|l:l,e!==null){for(s=t.child=e.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~d}else s=0,t.child=null;return am(e,t,d,l,s)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Js(t,d!==null?d.cachePool:null),d!==null?rp(t,d):hc(),sp(t);else return s=t.lanes=536870912,am(e,t,d!==null?d.baseLanes|l:l,l,s)}else d!==null?(Js(t,d.cachePool),rp(t,d),Aa(),t.memoizedState=null):(e!==null&&Js(t,null),hc(),Aa());return Yt(e,t,c,l),t.child}function Yr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function am(e,t,l,s,c){var d=cc();return d=d===null?null:{parent:At._currentValue,pool:d},t.memoizedState={baseLanes:l,cachePool:d},e!==null&&Js(t,null),hc(),sp(t),e!==null&&Ul(e,t,s,!0),t.childLanes=c,null}function hi(e,t){return t=vi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function lm(e,t,l){return dl(t,e.child,null,l),e=hi(t,t.pendingProps),e.flags|=2,hn(t),t.memoizedState=null,e}function By(e,t,l){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(We){if(s.mode==="hidden")return e=hi(t,s),t.lanes=536870912,Yr(null,e);if(vc(t),(e=ft)?(e=xh(e,Mn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:Pn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=Vf(e),l.return=t,t.child=l,Pt=t,ft=null)):e=null,e===null)throw wa(t);return t.lanes=536870912,null}return hi(t,s)}var d=e.memoizedState;if(d!==null){var b=d.dehydrated;if(vc(t),c)if(t.flags&256)t.flags&=-257,t=lm(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(zt||Ul(e,t,l,!1),c=(l&e.childLanes)!==0,zt||c){if(s=ut,s!==null&&(b=Fd(s,l),b!==0&&b!==d.retryLane))throw d.retryLane=b,al(e,b),dn(s,e,b),Ic;Ni(),t=lm(e,t,l)}else e=d.treeContext,ft=Ln(b.nextSibling),Pt=t,We=!0,ka=null,Mn=!1,e!==null&&Pf(t,e),t=hi(t,s),t.flags|=4096;return t}return e=aa(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function xi(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Hc(e,t,l,s,c){return il(t),l=yc(e,t,l,s,void 0,c),s=bc(),e!==null&&!zt?(jc(e,t,c),ca(e,t,c)):(We&&s&&ec(t),t.flags|=1,Yt(e,t,l,c),t.child)}function rm(e,t,l,s,c,d){return il(t),t.updateQueue=null,l=op(t,s,l,c),ip(e),s=bc(),e!==null&&!zt?(jc(e,t,d),ca(e,t,d)):(We&&s&&ec(t),t.flags|=1,Yt(e,t,l,d),t.child)}function sm(e,t,l,s,c){if(il(t),t.stateNode===null){var d=Ol,b=l.contextType;typeof b=="object"&&b!==null&&(d=qt(b)),d=new l(s,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Oc,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=s,d.state=t.memoizedState,d.refs={},dc(t),b=l.contextType,d.context=typeof b=="object"&&b!==null?qt(b):Ol,d.state=t.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(_c(t,l,b,s),d.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(b=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),b!==d.state&&Oc.enqueueReplaceState(d,d.state,null),Vr(t,s,d,c),Ur(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){d=t.stateNode;var C=t.memoizedProps,H=pl(l,C);d.props=H;var X=d.context,le=l.contextType;b=Ol,typeof le=="object"&&le!==null&&(b=qt(le));var ie=l.getDerivedStateFromProps;le=typeof ie=="function"||typeof d.getSnapshotBeforeUpdate=="function",C=t.pendingProps!==C,le||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(C||X!==b)&&Yp(t,d,s,b),Na=!1;var Q=t.memoizedState;d.state=Q,Vr(t,s,d,c),Ur(),X=t.memoizedState,C||Q!==X||Na?(typeof ie=="function"&&(_c(t,l,ie,s),X=t.memoizedState),(H=Na||qp(t,l,H,s,Q,X,b))?(le||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=X),d.props=s,d.state=X,d.context=b,s=H):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{d=t.stateNode,fc(e,t),b=t.memoizedProps,le=pl(l,b),d.props=le,ie=t.pendingProps,Q=d.context,X=l.contextType,H=Ol,typeof X=="object"&&X!==null&&(H=qt(X)),C=l.getDerivedStateFromProps,(X=typeof C=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b!==ie||Q!==H)&&Yp(t,d,s,H),Na=!1,Q=t.memoizedState,d.state=Q,Vr(t,s,d,c),Ur();var ee=t.memoizedState;b!==ie||Q!==ee||Na||e!==null&&e.dependencies!==null&&Qs(e.dependencies)?(typeof C=="function"&&(_c(t,l,C,s),ee=t.memoizedState),(le=Na||qp(t,l,le,s,Q,ee,H)||e!==null&&e.dependencies!==null&&Qs(e.dependencies))?(X||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(s,ee,H),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(s,ee,H)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=ee),d.props=s,d.state=ee,d.context=H,s=le):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=1024),s=!1)}return d=s,xi(e,t),s=(t.flags&128)!==0,d||s?(d=t.stateNode,l=s&&typeof l.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&s?(t.child=dl(t,e.child,null,c),t.child=dl(t,null,l,c)):Yt(e,t,l,c),t.memoizedState=d.state,e=t.child):e=ca(e,t,c),e}function im(e,t,l,s){return rl(),t.flags|=256,Yt(e,t,l,s),t.child}var Uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vc(e){return{baseLanes:e,cachePool:Xf()}}function $c(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=vn),e}function om(e,t,l){var s=t.pendingProps,c=!1,d=(t.flags&128)!==0,b;if((b=d)||(b=e!==null&&e.memoizedState===null?!1:(Et.current&2)!==0),b&&(c=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(We){if(c?Ra(t):Aa(),(e=ft)?(e=xh(e,Mn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:Pn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=Vf(e),l.return=t,t.child=l,Pt=t,ft=null)):e=null,e===null)throw wa(t);return wu(e)?t.lanes=32:t.lanes=536870912,null}var C=s.children;return s=s.fallback,c?(Aa(),c=t.mode,C=vi({mode:"hidden",children:C},c),s=ll(s,c,l,null),C.return=t,s.return=t,C.sibling=s,t.child=C,s=t.child,s.memoizedState=Vc(l),s.childLanes=$c(e,b,l),t.memoizedState=Uc,Yr(null,s)):(Ra(t),Gc(t,C))}var H=e.memoizedState;if(H!==null&&(C=H.dehydrated,C!==null)){if(d)t.flags&256?(Ra(t),t.flags&=-257,t=Pc(e,t,l)):t.memoizedState!==null?(Aa(),t.child=e.child,t.flags|=128,t=null):(Aa(),C=s.fallback,c=t.mode,s=vi({mode:"visible",children:s.children},c),C=ll(C,c,l,null),C.flags|=2,s.return=t,C.return=t,s.sibling=C,t.child=s,dl(t,e.child,null,l),s=t.child,s.memoizedState=Vc(l),s.childLanes=$c(e,b,l),t.memoizedState=Uc,t=Yr(null,s));else if(Ra(t),wu(C)){if(b=C.nextSibling&&C.nextSibling.dataset,b)var X=b.dgst;b=X,s=Error(o(419)),s.stack="",s.digest=b,Dr({value:s,source:null,stack:null}),t=Pc(e,t,l)}else if(zt||Ul(e,t,l,!1),b=(l&e.childLanes)!==0,zt||b){if(b=ut,b!==null&&(s=Fd(b,l),s!==0&&s!==H.retryLane))throw H.retryLane=s,al(e,s),dn(b,e,s),Ic;ku(C)||Ni(),t=Pc(e,t,l)}else ku(C)?(t.flags|=192,t.child=e.child,t=null):(e=H.treeContext,ft=Ln(C.nextSibling),Pt=t,We=!0,ka=null,Mn=!1,e!==null&&Pf(t,e),t=Gc(t,s.children),t.flags|=4096);return t}return c?(Aa(),C=s.fallback,c=t.mode,H=e.child,X=H.sibling,s=aa(H,{mode:"hidden",children:s.children}),s.subtreeFlags=H.subtreeFlags&65011712,X!==null?C=aa(X,C):(C=ll(C,c,l,null),C.flags|=2),C.return=t,s.return=t,s.sibling=C,t.child=s,Yr(null,s),s=t.child,C=e.child.memoizedState,C===null?C=Vc(l):(c=C.cachePool,c!==null?(H=At._currentValue,c=c.parent!==H?{parent:H,pool:H}:c):c=Xf(),C={baseLanes:C.baseLanes|l,cachePool:c}),s.memoizedState=C,s.childLanes=$c(e,b,l),t.memoizedState=Uc,Yr(e.child,s)):(Ra(t),l=e.child,e=l.sibling,l=aa(l,{mode:"visible",children:s.children}),l.return=t,l.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=l,t.memoizedState=null,l)}function Gc(e,t){return t=vi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function vi(e,t){return e=pn(22,e,null,t),e.lanes=0,e}function Pc(e,t,l){return dl(t,e.child,null,l),e=Gc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function cm(e,t,l){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),rc(e.return,t,l)}function qc(e,t,l,s,c,d){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:l,tailMode:c,treeForkCount:d}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=s,b.tail=l,b.tailMode=c,b.treeForkCount=d)}function um(e,t,l){var s=t.pendingProps,c=s.revealOrder,d=s.tail;s=s.children;var b=Et.current,C=(b&2)!==0;if(C?(b=b&1|2,t.flags|=128):b&=1,oe(Et,b),Yt(e,t,s,l),s=We?Lr:0,!C&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&cm(e,l,t);else if(e.tag===19)cm(e,l,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(l=t.child,c=null;l!==null;)e=l.alternate,e!==null&&ri(e)===null&&(c=l),l=l.sibling;l=c,l===null?(c=t.child,t.child=null):(c=l.sibling,l.sibling=null),qc(t,!1,c,l,d,s);break;case"backwards":case"unstable_legacy-backwards":for(l=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&ri(e)===null){t.child=c;break}e=c.sibling,c.sibling=l,l=c,c=e}qc(t,!0,l,null,d,s);break;case"together":qc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function ca(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),La|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Ul(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,l=aa(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=aa(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Yc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Qs(e)))}function Iy(e,t,l){switch(t.tag){case 3:ce(t,t.stateNode.containerInfo),Ca(t,At,e.memoizedState.cache),rl();break;case 27:case 5:Ue(t);break;case 4:ce(t,t.stateNode.containerInfo);break;case 10:Ca(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,vc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Ra(t),t.flags|=128,null):(l&t.child.childLanes)!==0?om(e,t,l):(Ra(t),e=ca(e,t,l),e!==null?e.sibling:null);Ra(t);break;case 19:var c=(e.flags&128)!==0;if(s=(l&t.childLanes)!==0,s||(Ul(e,t,l,!1),s=(l&t.childLanes)!==0),c){if(s)return um(e,t,l);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),oe(Et,Et.current),s)break;return null;case 22:return t.lanes=0,nm(e,t,l,t.pendingProps);case 24:Ca(t,At,e.memoizedState.cache)}return ca(e,t,l)}function dm(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)zt=!0;else{if(!Yc(e,l)&&(t.flags&128)===0)return zt=!1,Iy(e,t,l);zt=(e.flags&131072)!==0}else zt=!1,We&&(t.flags&1048576)!==0&&Gf(t,Lr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=cl(t.elementType),t.type=e,typeof e=="function")Qo(e)?(s=pl(e,s),t.tag=1,t=sm(null,t,e,s,l)):(t.tag=0,t=Hc(null,t,e,s,l));else{if(e!=null){var c=e.$$typeof;if(c===V){t.tag=11,t=Jp(null,t,e,s,l);break e}else if(c===w){t.tag=14,t=em(null,t,e,s,l);break e}}throw t=q(e)||e,Error(o(306,t,""))}}return t;case 0:return Hc(e,t,t.type,t.pendingProps,l);case 1:return s=t.type,c=pl(s,t.pendingProps),sm(e,t,s,c,l);case 3:e:{if(ce(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var d=t.memoizedState;c=d.element,fc(e,t),Vr(t,s,null,l);var b=t.memoizedState;if(s=b.cache,Ca(t,At,s),s!==d.cache&&sc(t,[At],l,!0),Ur(),s=b.element,d.isDehydrated)if(d={element:s,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=im(e,t,s,l);break e}else if(s!==c){c=Tn(Error(o(424)),t),Dr(c),t=im(e,t,s,l);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ft=Ln(e.firstChild),Pt=t,We=!0,ka=null,Mn=!0,l=np(t,null,s,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(rl(),s===c){t=ca(e,t,l);break e}Yt(e,t,s,l)}t=t.child}return t;case 26:return xi(e,t),e===null?(l=Sh(t.type,null,t.pendingProps,null))?t.memoizedState=l:We||(l=t.type,e=t.pendingProps,s=Li(xe.current).createElement(l),s[Gt]=t,s[ln]=e,Ft(s,l,e),Ht(s),t.stateNode=s):t.memoizedState=Sh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ue(t),e===null&&We&&(s=t.stateNode=yh(t.type,t.pendingProps,xe.current),Pt=t,Mn=!0,c=ft,Ia(t.type)?(Cu=c,ft=Ln(s.firstChild)):ft=c),Yt(e,t,t.pendingProps.children,l),xi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&We&&((c=s=ft)&&(s=m1(s,t.type,t.pendingProps,Mn),s!==null?(t.stateNode=s,Pt=t,ft=Ln(s.firstChild),Mn=!1,c=!0):c=!1),c||wa(t)),Ue(t),c=t.type,d=t.pendingProps,b=e!==null?e.memoizedProps:null,s=d.children,bu(c,d)?s=null:b!==null&&bu(c,b)&&(t.flags|=32),t.memoizedState!==null&&(c=yc(e,t,Ry,null,null,l),is._currentValue=c),xi(e,t),Yt(e,t,s,l),t.child;case 6:return e===null&&We&&((e=l=ft)&&(l=h1(l,t.pendingProps,Mn),l!==null?(t.stateNode=l,Pt=t,ft=null,e=!0):e=!1),e||wa(t)),null;case 13:return om(e,t,l);case 4:return ce(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=dl(t,null,s,l):Yt(e,t,s,l),t.child;case 11:return Jp(e,t,t.type,t.pendingProps,l);case 7:return Yt(e,t,t.pendingProps,l),t.child;case 8:return Yt(e,t,t.pendingProps.children,l),t.child;case 12:return Yt(e,t,t.pendingProps.children,l),t.child;case 10:return s=t.pendingProps,Ca(t,t.type,s.value),Yt(e,t,s.children,l),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,il(t),c=qt(c),s=s(c),t.flags|=1,Yt(e,t,s,l),t.child;case 14:return em(e,t,t.type,t.pendingProps,l);case 15:return tm(e,t,t.type,t.pendingProps,l);case 19:return um(e,t,l);case 31:return By(e,t,l);case 22:return nm(e,t,l,t.pendingProps);case 24:return il(t),s=qt(At),e===null?(c=cc(),c===null&&(c=ut,d=ic(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=l),c=d),t.memoizedState={parent:s,cache:c},dc(t),Ca(t,At,c)):((e.lanes&l)!==0&&(fc(e,t),Vr(t,null,null,l),Ur()),c=e.memoizedState,d=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Ca(t,At,s)):(s=d.cache,Ca(t,At,s),s!==c.cache&&sc(t,[At],l,!0))),Yt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ua(e){e.flags|=4}function Fc(e,t,l,s,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Im())e.flags|=8192;else throw ul=ti,uc}else e.flags&=-16777217}function fm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Eh(t))if(Im())e.flags|=8192;else throw ul=ti,uc}function gi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Pd():536870912,e.lanes|=t,Zl|=t)}function Fr(e,t){if(!We)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var s=null;l!==null;)l.alternate!==null&&(s=l),l=l.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function pt(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,s=0;if(t)for(var c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags&65011712,s|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=s,e.childLanes=l,t}function Hy(e,t,l){var s=t.pendingProps;switch(tc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pt(t),null;case 1:return pt(t),null;case 3:return l=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),sa(At),je(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Hl(t)?ua(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,ac())),pt(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(ua(t),d!==null?(pt(t),fm(t,d)):(pt(t),Fc(t,c,null,s,l))):d?d!==e.memoizedState?(ua(t),pt(t),fm(t,d)):(pt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&ua(t),pt(t),Fc(t,c,e,s,l)),null;case 27:if(Le(t),l=xe.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ua(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}e=fe.current,Hl(t)?qf(t):(e=yh(c,s,l),t.stateNode=e,ua(t))}return pt(t),null;case 5:if(Le(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ua(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}if(d=fe.current,Hl(t))qf(t);else{var b=Li(xe.current);switch(d){case 1:d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=b.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof s.is=="string"?b.createElement("select",{is:s.is}):b.createElement("select"),s.multiple?d.multiple=!0:s.size&&(d.size=s.size);break;default:d=typeof s.is=="string"?b.createElement(c,{is:s.is}):b.createElement(c)}}d[Gt]=t,d[ln]=s;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)d.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=d;e:switch(Ft(d,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&ua(t)}}return pt(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&ua(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=xe.current,Hl(t)){if(e=t.stateNode,l=t.memoizedProps,s=null,c=Pt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[Gt]=t,e=!!(e.nodeValue===l||s!==null&&s.suppressHydrationWarning===!0||oh(e.nodeValue,l)),e||wa(t,!0)}else e=Li(e).createTextNode(s),e[Gt]=t,t.stateNode=e}return pt(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(s=Hl(t),l!==null){if(e===null){if(!s)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),e=!1}else l=ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(hn(t),t):(hn(t),null);if((t.flags&128)!==0)throw Error(o(558))}return pt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Hl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),c=!1}else c=ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(hn(t),t):(hn(t),null)}return hn(t),(t.flags&128)!==0?(t.lanes=l,t):(l=s!==null,e=e!==null&&e.memoizedState!==null,l&&(s=t.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),gi(t,t.updateQueue),pt(t),null);case 4:return je(),e===null&&hu(t.stateNode.containerInfo),pt(t),null;case 10:return sa(t.type),pt(t),null;case 19:if(K(Et),s=t.memoizedState,s===null)return pt(t),null;if(c=(t.flags&128)!==0,d=s.rendering,d===null)if(c)Fr(s,!1);else{if(wt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=ri(e),d!==null){for(t.flags|=128,Fr(s,!1),e=d.updateQueue,t.updateQueue=e,gi(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Uf(l,e),l=l.sibling;return oe(Et,Et.current&1|2),We&&la(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&tt()>ki&&(t.flags|=128,c=!0,Fr(s,!1),t.lanes=4194304)}else{if(!c)if(e=ri(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,gi(t,e),Fr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!We)return pt(t),null}else 2*tt()-s.renderingStartTime>ki&&l!==536870912&&(t.flags|=128,c=!0,Fr(s,!1),t.lanes=4194304);s.isBackwards?(d.sibling=t.child,t.child=d):(e=s.last,e!==null?e.sibling=d:t.child=d,s.last=d)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=tt(),e.sibling=null,l=Et.current,oe(Et,c?l&1|2:l&1),We&&la(t,s.treeForkCount),e):(pt(t),null);case 22:case 23:return hn(t),xc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(l&536870912)!==0&&(t.flags&128)===0&&(pt(t),t.subtreeFlags&6&&(t.flags|=8192)):pt(t),l=t.updateQueue,l!==null&&gi(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==l&&(t.flags|=2048),e!==null&&K(ol),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),sa(At),pt(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Uy(e,t){switch(tc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return sa(At),je(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Le(t),null;case 31:if(t.memoizedState!==null){if(hn(t),t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(hn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return K(Et),null;case 4:return je(),null;case 10:return sa(t.type),null;case 22:case 23:return hn(t),xc(),e!==null&&K(ol),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return sa(At),null;case 25:return null;default:return null}}function pm(e,t){switch(tc(t),t.tag){case 3:sa(At),je();break;case 26:case 27:case 5:Le(t);break;case 4:je();break;case 31:t.memoizedState!==null&&hn(t);break;case 13:hn(t);break;case 19:K(Et);break;case 10:sa(t.type);break;case 22:case 23:hn(t),xc(),e!==null&&K(ol);break;case 24:sa(At)}}function Wr(e,t){try{var l=t.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var c=s.next;l=c;do{if((l.tag&e)===e){s=void 0;var d=l.create,b=l.inst;s=d(),b.destroy=s}l=l.next}while(l!==c)}}catch(C){lt(t,t.return,C)}}function Ma(e,t,l){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var d=c.next;s=d;do{if((s.tag&e)===e){var b=s.inst,C=b.destroy;if(C!==void 0){b.destroy=void 0,c=t;var H=l,X=C;try{X()}catch(le){lt(c,H,le)}}}s=s.next}while(s!==d)}}catch(le){lt(t,t.return,le)}}function mm(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{lp(t,l)}catch(s){lt(e,e.return,s)}}}function hm(e,t,l){l.props=pl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(s){lt(e,t,s)}}function Kr(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof l=="function"?e.refCleanup=l(s):l.current=s}}catch(c){lt(e,t,c)}}function Yn(e,t){var l=e.ref,s=e.refCleanup;if(l!==null)if(typeof s=="function")try{s()}catch(c){lt(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(c){lt(e,t,c)}else l.current=null}function xm(e){var t=e.type,l=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&s.focus();break e;case"img":l.src?s.src=l.src:l.srcSet&&(s.srcset=l.srcSet)}}catch(c){lt(e,e.return,c)}}function Wc(e,t,l){try{var s=e.stateNode;o1(s,e.type,l,t),s[ln]=t}catch(c){lt(e,e.return,c)}}function vm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ia(e.type)||e.tag===4}function Kc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ia(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Xc(e,t,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=ta));else if(s!==4&&(s===27&&Ia(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Xc(e,t,l),e=e.sibling;e!==null;)Xc(e,t,l),e=e.sibling}function yi(e,t,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(s!==4&&(s===27&&Ia(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(yi(e,t,l),e=e.sibling;e!==null;)yi(e,t,l),e=e.sibling}function gm(e){var t=e.stateNode,l=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Ft(t,s,l),t[Gt]=e,t[ln]=l}catch(d){lt(e,e.return,d)}}var da=!1,Lt=!1,Qc=!1,ym=typeof WeakSet=="function"?WeakSet:Set,Ut=null;function Vy(e,t){if(e=e.containerInfo,gu=Ui,e=Mf(e),Po(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var s=l.getSelection&&l.getSelection();if(s&&s.rangeCount!==0){l=s.anchorNode;var c=s.anchorOffset,d=s.focusNode;s=s.focusOffset;try{l.nodeType,d.nodeType}catch{l=null;break e}var b=0,C=-1,H=-1,X=0,le=0,ie=e,Q=null;t:for(;;){for(var ee;ie!==l||c!==0&&ie.nodeType!==3||(C=b+c),ie!==d||s!==0&&ie.nodeType!==3||(H=b+s),ie.nodeType===3&&(b+=ie.nodeValue.length),(ee=ie.firstChild)!==null;)Q=ie,ie=ee;for(;;){if(ie===e)break t;if(Q===l&&++X===c&&(C=b),Q===d&&++le===s&&(H=b),(ee=ie.nextSibling)!==null)break;ie=Q,Q=ie.parentNode}ie=ee}l=C===-1||H===-1?null:{start:C,end:H}}else l=null}l=l||{start:0,end:0}}else l=null;for(yu={focusedElem:e,selectionRange:l},Ui=!1,Ut=t;Ut!==null;)if(t=Ut,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ut=e;else for(;Ut!==null;){switch(t=Ut,d=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)c=e[l],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,l=t,c=d.memoizedProps,d=d.memoizedState,s=l.stateNode;try{var be=pl(l.type,c);e=s.getSnapshotBeforeUpdate(be,d),s.__reactInternalSnapshotBeforeUpdate=e}catch(Te){lt(l,l.return,Te)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Su(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Su(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,Ut=e;break}Ut=t.return}}function bm(e,t,l){var s=l.flags;switch(l.tag){case 0:case 11:case 15:pa(e,l),s&4&&Wr(5,l);break;case 1:if(pa(e,l),s&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(b){lt(l,l.return,b)}else{var c=pl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){lt(l,l.return,b)}}s&64&&mm(l),s&512&&Kr(l,l.return);break;case 3:if(pa(e,l),s&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{lp(e,t)}catch(b){lt(l,l.return,b)}}break;case 27:t===null&&s&4&&gm(l);case 26:case 5:pa(e,l),t===null&&s&4&&xm(l),s&512&&Kr(l,l.return);break;case 12:pa(e,l);break;case 31:pa(e,l),s&4&&km(e,l);break;case 13:pa(e,l),s&4&&wm(e,l),s&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Xy.bind(null,l),x1(e,l))));break;case 22:if(s=l.memoizedState!==null||da,!s){t=t!==null&&t.memoizedState!==null||Lt,c=da;var d=Lt;da=s,(Lt=t)&&!d?ma(e,l,(l.subtreeFlags&8772)!==0):pa(e,l),da=c,Lt=d}break;case 30:break;default:pa(e,l)}}function jm(e){var t=e.alternate;t!==null&&(e.alternate=null,jm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Eo(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var vt=null,sn=!1;function fa(e,t,l){for(l=l.child;l!==null;)Sm(e,t,l),l=l.sibling}function Sm(e,t,l){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(Zn,l)}catch{}switch(l.tag){case 26:Lt||Yn(l,t),fa(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Lt||Yn(l,t);var s=vt,c=sn;Ia(l.type)&&(vt=l.stateNode,sn=!1),fa(e,t,l),ls(l.stateNode),vt=s,sn=c;break;case 5:Lt||Yn(l,t);case 6:if(s=vt,c=sn,vt=null,fa(e,t,l),vt=s,sn=c,vt!==null)if(sn)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(l.stateNode)}catch(d){lt(l,t,d)}else try{vt.removeChild(l.stateNode)}catch(d){lt(l,t,d)}break;case 18:vt!==null&&(sn?(e=vt,mh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),sr(e)):mh(vt,l.stateNode));break;case 4:s=vt,c=sn,vt=l.stateNode.containerInfo,sn=!0,fa(e,t,l),vt=s,sn=c;break;case 0:case 11:case 14:case 15:Ma(2,l,t),Lt||Ma(4,l,t),fa(e,t,l);break;case 1:Lt||(Yn(l,t),s=l.stateNode,typeof s.componentWillUnmount=="function"&&hm(l,t,s)),fa(e,t,l);break;case 21:fa(e,t,l);break;case 22:Lt=(s=Lt)||l.memoizedState!==null,fa(e,t,l),Lt=s;break;default:fa(e,t,l)}}function km(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{sr(e)}catch(l){lt(t,t.return,l)}}}function wm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{sr(e)}catch(l){lt(t,t.return,l)}}function $y(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ym),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ym),t;default:throw Error(o(435,e.tag))}}function bi(e,t){var l=$y(e);t.forEach(function(s){if(!l.has(s)){l.add(s);var c=Qy.bind(null,e,s);s.then(c,c)}})}function on(e,t){var l=t.deletions;if(l!==null)for(var s=0;s<l.length;s++){var c=l[s],d=e,b=t,C=b;e:for(;C!==null;){switch(C.tag){case 27:if(Ia(C.type)){vt=C.stateNode,sn=!1;break e}break;case 5:vt=C.stateNode,sn=!1;break e;case 3:case 4:vt=C.stateNode.containerInfo,sn=!0;break e}C=C.return}if(vt===null)throw Error(o(160));Sm(d,b,c),vt=null,sn=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Cm(t,e),t=t.sibling}var Un=null;function Cm(e,t){var l=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:on(t,e),cn(e),s&4&&(Ma(3,e,e.return),Wr(3,e),Ma(5,e,e.return));break;case 1:on(t,e),cn(e),s&512&&(Lt||l===null||Yn(l,l.return)),s&64&&da&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?s:l.concat(s))));break;case 26:var c=Un;if(on(t,e),cn(e),s&512&&(Lt||l===null||Yn(l,l.return)),s&4){var d=l!==null?l.memoizedState:null;if(s=e.memoizedState,l===null)if(s===null)if(e.stateNode===null){e:{s=e.type,l=e.memoizedProps,c=c.ownerDocument||c;t:switch(s){case"title":d=c.getElementsByTagName("title")[0],(!d||d[Sr]||d[Gt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(s),c.head.insertBefore(d,c.querySelector("head > title"))),Ft(d,s,l),d[Gt]=e,Ht(d),s=d;break e;case"link":var b=Ch("link","href",c).get(s+(l.href||""));if(b){for(var C=0;C<b.length;C++)if(d=b[C],d.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&d.getAttribute("rel")===(l.rel==null?null:l.rel)&&d.getAttribute("title")===(l.title==null?null:l.title)&&d.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){b.splice(C,1);break t}}d=c.createElement(s),Ft(d,s,l),c.head.appendChild(d);break;case"meta":if(b=Ch("meta","content",c).get(s+(l.content||""))){for(C=0;C<b.length;C++)if(d=b[C],d.getAttribute("content")===(l.content==null?null:""+l.content)&&d.getAttribute("name")===(l.name==null?null:l.name)&&d.getAttribute("property")===(l.property==null?null:l.property)&&d.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&d.getAttribute("charset")===(l.charSet==null?null:l.charSet)){b.splice(C,1);break t}}d=c.createElement(s),Ft(d,s,l),c.head.appendChild(d);break;default:throw Error(o(468,s))}d[Gt]=e,Ht(d),s=d}e.stateNode=s}else Nh(c,e.type,e.stateNode);else e.stateNode=wh(c,s,e.memoizedProps);else d!==s?(d===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):d.count--,s===null?Nh(c,e.type,e.stateNode):wh(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,l.memoizedProps)}break;case 27:on(t,e),cn(e),s&512&&(Lt||l===null||Yn(l,l.return)),l!==null&&s&4&&Wc(e,e.memoizedProps,l.memoizedProps);break;case 5:if(on(t,e),cn(e),s&512&&(Lt||l===null||Yn(l,l.return)),e.flags&32){c=e.stateNode;try{Rl(c,"")}catch(be){lt(e,e.return,be)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Wc(e,c,l!==null?l.memoizedProps:c)),s&1024&&(Qc=!0);break;case 6:if(on(t,e),cn(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,l=e.stateNode;try{l.nodeValue=s}catch(be){lt(e,e.return,be)}}break;case 3:if(Oi=null,c=Un,Un=Di(t.containerInfo),on(t,e),Un=c,cn(e),s&4&&l!==null&&l.memoizedState.isDehydrated)try{sr(t.containerInfo)}catch(be){lt(e,e.return,be)}Qc&&(Qc=!1,Nm(e));break;case 4:s=Un,Un=Di(e.stateNode.containerInfo),on(t,e),cn(e),Un=s;break;case 12:on(t,e),cn(e);break;case 31:on(t,e),cn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 13:on(t,e),cn(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Si=tt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 22:c=e.memoizedState!==null;var H=l!==null&&l.memoizedState!==null,X=da,le=Lt;if(da=X||c,Lt=le||H,on(t,e),Lt=le,da=X,cn(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(l===null||H||da||Lt||ml(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){H=l=t;try{if(d=H.stateNode,c)b=d.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{C=H.stateNode;var ie=H.memoizedProps.style,Q=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;C.style.display=Q==null||typeof Q=="boolean"?"":(""+Q).trim()}}catch(be){lt(H,H.return,be)}}}else if(t.tag===6){if(l===null){H=t;try{H.stateNode.nodeValue=c?"":H.memoizedProps}catch(be){lt(H,H.return,be)}}}else if(t.tag===18){if(l===null){H=t;try{var ee=H.stateNode;c?hh(ee,!0):hh(H.stateNode,!1)}catch(be){lt(H,H.return,be)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(l=s.retryQueue,l!==null&&(s.retryQueue=null,bi(e,l))));break;case 19:on(t,e),cn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 30:break;case 21:break;default:on(t,e),cn(e)}}function cn(e){var t=e.flags;if(t&2){try{for(var l,s=e.return;s!==null;){if(vm(s)){l=s;break}s=s.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var c=l.stateNode,d=Kc(e);yi(e,d,c);break;case 5:var b=l.stateNode;l.flags&32&&(Rl(b,""),l.flags&=-33);var C=Kc(e);yi(e,C,b);break;case 3:case 4:var H=l.stateNode.containerInfo,X=Kc(e);Xc(e,X,H);break;default:throw Error(o(161))}}catch(le){lt(e,e.return,le)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Nm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Nm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function pa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)bm(e,t.alternate,t),t=t.sibling}function ml(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ma(4,t,t.return),ml(t);break;case 1:Yn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&hm(t,t.return,l),ml(t);break;case 27:ls(t.stateNode);case 26:case 5:Yn(t,t.return),ml(t);break;case 22:t.memoizedState===null&&ml(t);break;case 30:ml(t);break;default:ml(t)}e=e.sibling}}function ma(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,d=t,b=d.flags;switch(d.tag){case 0:case 11:case 15:ma(c,d,l),Wr(4,d);break;case 1:if(ma(c,d,l),s=d,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(X){lt(s,s.return,X)}if(s=d,c=s.updateQueue,c!==null){var C=s.stateNode;try{var H=c.shared.hiddenCallbacks;if(H!==null)for(c.shared.hiddenCallbacks=null,c=0;c<H.length;c++)ap(H[c],C)}catch(X){lt(s,s.return,X)}}l&&b&64&&mm(d),Kr(d,d.return);break;case 27:gm(d);case 26:case 5:ma(c,d,l),l&&s===null&&b&4&&xm(d),Kr(d,d.return);break;case 12:ma(c,d,l);break;case 31:ma(c,d,l),l&&b&4&&km(c,d);break;case 13:ma(c,d,l),l&&b&4&&wm(c,d);break;case 22:d.memoizedState===null&&ma(c,d,l),Kr(d,d.return);break;case 30:break;default:ma(c,d,l)}t=t.sibling}}function Zc(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&_r(l))}function Jc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_r(e))}function Vn(e,t,l,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Em(e,t,l,s),t=t.sibling}function Em(e,t,l,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Vn(e,t,l,s),c&2048&&Wr(9,t);break;case 1:Vn(e,t,l,s);break;case 3:Vn(e,t,l,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_r(e)));break;case 12:if(c&2048){Vn(e,t,l,s),e=t.stateNode;try{var d=t.memoizedProps,b=d.id,C=d.onPostCommit;typeof C=="function"&&C(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(H){lt(t,t.return,H)}}else Vn(e,t,l,s);break;case 31:Vn(e,t,l,s);break;case 13:Vn(e,t,l,s);break;case 23:break;case 22:d=t.stateNode,b=t.alternate,t.memoizedState!==null?d._visibility&2?Vn(e,t,l,s):Xr(e,t):d._visibility&2?Vn(e,t,l,s):(d._visibility|=2,Kl(e,t,l,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Zc(b,t);break;case 24:Vn(e,t,l,s),c&2048&&Jc(t.alternate,t);break;default:Vn(e,t,l,s)}}function Kl(e,t,l,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,b=t,C=l,H=s,X=b.flags;switch(b.tag){case 0:case 11:case 15:Kl(d,b,C,H,c),Wr(8,b);break;case 23:break;case 22:var le=b.stateNode;b.memoizedState!==null?le._visibility&2?Kl(d,b,C,H,c):Xr(d,b):(le._visibility|=2,Kl(d,b,C,H,c)),c&&X&2048&&Zc(b.alternate,b);break;case 24:Kl(d,b,C,H,c),c&&X&2048&&Jc(b.alternate,b);break;default:Kl(d,b,C,H,c)}t=t.sibling}}function Xr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,s=t,c=s.flags;switch(s.tag){case 22:Xr(l,s),c&2048&&Zc(s.alternate,s);break;case 24:Xr(l,s),c&2048&&Jc(s.alternate,s);break;default:Xr(l,s)}t=t.sibling}}var Qr=8192;function Xl(e,t,l){if(e.subtreeFlags&Qr)for(e=e.child;e!==null;)Tm(e,t,l),e=e.sibling}function Tm(e,t,l){switch(e.tag){case 26:Xl(e,t,l),e.flags&Qr&&e.memoizedState!==null&&T1(l,Un,e.memoizedState,e.memoizedProps);break;case 5:Xl(e,t,l);break;case 3:case 4:var s=Un;Un=Di(e.stateNode.containerInfo),Xl(e,t,l),Un=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Qr,Qr=16777216,Xl(e,t,l),Qr=s):Xl(e,t,l));break;default:Xl(e,t,l)}}function Rm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Zr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];Ut=s,Mm(s,e)}Rm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Am(e),e=e.sibling}function Am(e){switch(e.tag){case 0:case 11:case 15:Zr(e),e.flags&2048&&Ma(9,e,e.return);break;case 3:Zr(e);break;case 12:Zr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ji(e)):Zr(e);break;default:Zr(e)}}function ji(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];Ut=s,Mm(s,e)}Rm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ma(8,t,t.return),ji(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,ji(t));break;default:ji(t)}e=e.sibling}}function Mm(e,t){for(;Ut!==null;){var l=Ut;switch(l.tag){case 0:case 11:case 15:Ma(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var s=l.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:_r(l.memoizedState.cache)}if(s=l.child,s!==null)s.return=l,Ut=s;else e:for(l=e;Ut!==null;){s=Ut;var c=s.sibling,d=s.return;if(jm(s),s===l){Ut=null;break e}if(c!==null){c.return=d,Ut=c;break e}Ut=d}}}var Gy={getCacheForType:function(e){var t=qt(At),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return qt(At).controller.signal}},Py=typeof WeakMap=="function"?WeakMap:Map,Je=0,ut=null,Pe=null,Ye=0,at=0,xn=null,za=!1,Ql=!1,eu=!1,ha=0,wt=0,La=0,hl=0,tu=0,vn=0,Zl=0,Jr=null,un=null,nu=!1,Si=0,zm=0,ki=1/0,wi=null,Da=null,_t=0,_a=null,Jl=null,xa=0,au=0,lu=null,Lm=null,es=0,ru=null;function gn(){return(Je&2)!==0&&Ye!==0?Ye&-Ye:E.T!==null?du():Wd()}function Dm(){if(vn===0)if((Ye&536870912)===0||We){var e=It;It<<=1,(It&3932160)===0&&(It=262144),vn=e}else vn=536870912;return e=mn.current,e!==null&&(e.flags|=32),vn}function dn(e,t,l){(e===ut&&(at===2||at===9)||e.cancelPendingCommit!==null)&&(er(e,0),Oa(e,Ye,vn,!1)),jr(e,l),((Je&2)===0||e!==ut)&&(e===ut&&((Je&2)===0&&(hl|=l),wt===4&&Oa(e,Ye,vn,!1)),Fn(e))}function _m(e,t,l){if((Je&6)!==0)throw Error(o(327));var s=!l&&(t&127)===0&&(t&e.expiredLanes)===0||wn(e,t),c=s?Fy(e,t):iu(e,t,!0),d=s;do{if(c===0){Ql&&!s&&Oa(e,t,0,!1);break}else{if(l=e.current.alternate,d&&!qy(l)){c=iu(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var C=e;c=Jr;var H=C.current.memoizedState.isDehydrated;if(H&&(er(C,b).flags|=256),b=iu(C,b,!1),b!==2){if(eu&&!H){C.errorRecoveryDisabledLanes|=d,hl|=d,c=4;break e}d=un,un=c,d!==null&&(un===null?un=d:un.push.apply(un,d))}c=b}if(d=!1,c!==2)continue}}if(c===1){er(e,0),Oa(e,t,0,!0);break}e:{switch(s=e,d=c,d){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:Oa(s,t,vn,!za);break e;case 2:un=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=Si+300-tt(),10<c)){if(Oa(s,t,vn,!za),br(s,0,!0)!==0)break e;xa=t,s.timeoutHandle=fh(Om.bind(null,s,l,un,wi,nu,t,vn,hl,Zl,za,d,"Throttled",-0,0),c);break e}Om(s,l,un,wi,nu,t,vn,hl,Zl,za,d,null,-0,0)}}break}while(!0);Fn(e)}function Om(e,t,l,s,c,d,b,C,H,X,le,ie,Q,ee){if(e.timeoutHandle=-1,ie=t.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ta},Tm(t,d,ie);var be=(d&62914560)===d?Si-tt():(d&4194048)===d?zm-tt():0;if(be=R1(ie,be),be!==null){xa=d,e.cancelPendingCommit=be(Pm.bind(null,e,t,d,l,s,c,b,C,H,le,ie,null,Q,ee)),Oa(e,d,b,!X);return}}Pm(e,t,d,l,s,c,b,C,H)}function qy(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var s=0;s<l.length;s++){var c=l[s],d=c.getSnapshot;c=c.value;try{if(!fn(d(),c))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Oa(e,t,l,s){t&=~tu,t&=~hl,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var d=31-bt(c),b=1<<d;s[d]=-1,c&=~b}l!==0&&qd(e,l,t)}function Ci(){return(Je&6)===0?(ts(0),!1):!0}function su(){if(Pe!==null){if(at===0)var e=Pe.return;else e=Pe,ra=sl=null,Sc(e),Pl=null,Br=0,e=Pe;for(;e!==null;)pm(e.alternate,e),e=e.return;Pe=null}}function er(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,d1(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),xa=0,su(),ut=e,Pe=l=aa(e.current,null),Ye=t,at=0,xn=null,za=!1,Ql=wn(e,t),eu=!1,Zl=vn=tu=hl=La=wt=0,un=Jr=null,nu=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var c=31-bt(s),d=1<<c;t|=e[c],s&=~d}return ha=t,Ys(),l}function Bm(e,t){Be=null,E.H=qr,t===Gl||t===ei?(t=Jf(),at=3):t===uc?(t=Jf(),at=4):at=t===Ic?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,xn=t,Pe===null&&(wt=1,mi(e,Tn(t,e.current)))}function Im(){var e=mn.current;return e===null?!0:(Ye&4194048)===Ye?zn===null:(Ye&62914560)===Ye||(Ye&536870912)!==0?e===zn:!1}function Hm(){var e=E.H;return E.H=qr,e===null?qr:e}function Um(){var e=E.A;return E.A=Gy,e}function Ni(){wt=4,za||(Ye&4194048)!==Ye&&mn.current!==null||(Ql=!0),(La&134217727)===0&&(hl&134217727)===0||ut===null||Oa(ut,Ye,vn,!1)}function iu(e,t,l){var s=Je;Je|=2;var c=Hm(),d=Um();(ut!==e||Ye!==t)&&(wi=null,er(e,t)),t=!1;var b=wt;e:do try{if(at!==0&&Pe!==null){var C=Pe,H=xn;switch(at){case 8:su(),b=6;break e;case 3:case 2:case 9:case 6:mn.current===null&&(t=!0);var X=at;if(at=0,xn=null,tr(e,C,H,X),l&&Ql){b=0;break e}break;default:X=at,at=0,xn=null,tr(e,C,H,X)}}Yy(),b=wt;break}catch(le){Bm(e,le)}while(!0);return t&&e.shellSuspendCounter++,ra=sl=null,Je=s,E.H=c,E.A=d,Pe===null&&(ut=null,Ye=0,Ys()),b}function Yy(){for(;Pe!==null;)Vm(Pe)}function Fy(e,t){var l=Je;Je|=2;var s=Hm(),c=Um();ut!==e||Ye!==t?(wi=null,ki=tt()+500,er(e,t)):Ql=wn(e,t);e:do try{if(at!==0&&Pe!==null){t=Pe;var d=xn;t:switch(at){case 1:at=0,xn=null,tr(e,t,d,1);break;case 2:case 9:if(Qf(d)){at=0,xn=null,$m(t);break}t=function(){at!==2&&at!==9||ut!==e||(at=7),Fn(e)},d.then(t,t);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:Qf(d)?(at=0,xn=null,$m(t)):(at=0,xn=null,tr(e,t,d,7));break;case 5:var b=null;switch(Pe.tag){case 26:b=Pe.memoizedState;case 5:case 27:var C=Pe;if(b?Eh(b):C.stateNode.complete){at=0,xn=null;var H=C.sibling;if(H!==null)Pe=H;else{var X=C.return;X!==null?(Pe=X,Ei(X)):Pe=null}break t}}at=0,xn=null,tr(e,t,d,5);break;case 6:at=0,xn=null,tr(e,t,d,6);break;case 8:su(),wt=6;break e;default:throw Error(o(462))}}Wy();break}catch(le){Bm(e,le)}while(!0);return ra=sl=null,E.H=s,E.A=c,Je=l,Pe!==null?0:(ut=null,Ye=0,Ys(),wt)}function Wy(){for(;Pe!==null&&!Vt();)Vm(Pe)}function Vm(e){var t=dm(e.alternate,e,ha);e.memoizedProps=e.pendingProps,t===null?Ei(e):Pe=t}function $m(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=rm(l,t,t.pendingProps,t.type,void 0,Ye);break;case 11:t=rm(l,t,t.pendingProps,t.type.render,t.ref,Ye);break;case 5:Sc(t);default:pm(l,t),t=Pe=Uf(t,ha),t=dm(l,t,ha)}e.memoizedProps=e.pendingProps,t===null?Ei(e):Pe=t}function tr(e,t,l,s){ra=sl=null,Sc(t),Pl=null,Br=0;var c=t.return;try{if(Oy(e,c,t,l,Ye)){wt=1,mi(e,Tn(l,e.current)),Pe=null;return}}catch(d){if(c!==null)throw Pe=c,d;wt=1,mi(e,Tn(l,e.current)),Pe=null;return}t.flags&32768?(We||s===1?e=!0:Ql||(Ye&536870912)!==0?e=!1:(za=e=!0,(s===2||s===9||s===3||s===6)&&(s=mn.current,s!==null&&s.tag===13&&(s.flags|=16384))),Gm(t,e)):Ei(t)}function Ei(e){var t=e;do{if((t.flags&32768)!==0){Gm(t,za);return}e=t.return;var l=Hy(t.alternate,t,ha);if(l!==null){Pe=l;return}if(t=t.sibling,t!==null){Pe=t;return}Pe=t=e}while(t!==null);wt===0&&(wt=5)}function Gm(e,t){do{var l=Uy(e.alternate,e);if(l!==null){l.flags&=32767,Pe=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){Pe=e;return}Pe=e=l}while(e!==null);wt=6,Pe=null}function Pm(e,t,l,s,c,d,b,C,H){e.cancelPendingCommit=null;do Ti();while(_t!==0);if((Je&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(d=t.lanes|t.childLanes,d|=Ko,Eg(e,l,d,b,C,H),e===ut&&(Pe=ut=null,Ye=0),Jl=t,_a=e,xa=l,au=d,lu=c,Lm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Zy(ze,function(){return Km(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=E.T,E.T=null,c=B.p,B.p=2,b=Je,Je|=4;try{Vy(e,t,l)}finally{Je=b,B.p=c,E.T=s}}_t=1,qm(),Ym(),Fm()}}function qm(){if(_t===1){_t=0;var e=_a,t=Jl,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=E.T,E.T=null;var s=B.p;B.p=2;var c=Je;Je|=4;try{Cm(t,e);var d=yu,b=Mf(e.containerInfo),C=d.focusedElem,H=d.selectionRange;if(b!==C&&C&&C.ownerDocument&&Af(C.ownerDocument.documentElement,C)){if(H!==null&&Po(C)){var X=H.start,le=H.end;if(le===void 0&&(le=X),"selectionStart"in C)C.selectionStart=X,C.selectionEnd=Math.min(le,C.value.length);else{var ie=C.ownerDocument||document,Q=ie&&ie.defaultView||window;if(Q.getSelection){var ee=Q.getSelection(),be=C.textContent.length,Te=Math.min(H.start,be),it=H.end===void 0?Te:Math.min(H.end,be);!ee.extend&&Te>it&&(b=it,it=Te,Te=b);var P=Rf(C,Te),$=Rf(C,it);if(P&&$&&(ee.rangeCount!==1||ee.anchorNode!==P.node||ee.anchorOffset!==P.offset||ee.focusNode!==$.node||ee.focusOffset!==$.offset)){var W=ie.createRange();W.setStart(P.node,P.offset),ee.removeAllRanges(),Te>it?(ee.addRange(W),ee.extend($.node,$.offset)):(W.setEnd($.node,$.offset),ee.addRange(W))}}}}for(ie=[],ee=C;ee=ee.parentNode;)ee.nodeType===1&&ie.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<ie.length;C++){var re=ie[C];re.element.scrollLeft=re.left,re.element.scrollTop=re.top}}Ui=!!gu,yu=gu=null}finally{Je=c,B.p=s,E.T=l}}e.current=t,_t=2}}function Ym(){if(_t===2){_t=0;var e=_a,t=Jl,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=E.T,E.T=null;var s=B.p;B.p=2;var c=Je;Je|=4;try{bm(e,t.alternate,t)}finally{Je=c,B.p=s,E.T=l}}_t=3}}function Fm(){if(_t===4||_t===3){_t=0,$t();var e=_a,t=Jl,l=xa,s=Lm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?_t=5:(_t=0,Jl=_a=null,Wm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Da=null),Co(l),t=t.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(Zn,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=E.T,c=B.p,B.p=2,E.T=null;try{for(var d=e.onRecoverableError,b=0;b<s.length;b++){var C=s[b];d(C.value,{componentStack:C.stack})}}finally{E.T=t,B.p=c}}(xa&3)!==0&&Ti(),Fn(e),c=e.pendingLanes,(l&261930)!==0&&(c&42)!==0?e===ru?es++:(es=0,ru=e):es=0,ts(0)}}function Wm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,_r(t)))}function Ti(){return qm(),Ym(),Fm(),Km()}function Km(){if(_t!==5)return!1;var e=_a,t=au;au=0;var l=Co(xa),s=E.T,c=B.p;try{B.p=32>l?32:l,E.T=null,l=lu,lu=null;var d=_a,b=xa;if(_t=0,Jl=_a=null,xa=0,(Je&6)!==0)throw Error(o(331));var C=Je;if(Je|=4,Am(d.current),Em(d,d.current,b,l),Je=C,ts(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Zn,d)}catch{}return!0}finally{B.p=c,E.T=s,Wm(e,t)}}function Xm(e,t,l){t=Tn(l,t),t=Bc(e.stateNode,t,2),e=Ta(e,t,2),e!==null&&(jr(e,2),Fn(e))}function lt(e,t,l){if(e.tag===3)Xm(e,e,l);else for(;t!==null;){if(t.tag===3){Xm(t,e,l);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Da===null||!Da.has(s))){e=Tn(l,e),l=Qp(2),s=Ta(t,l,2),s!==null&&(Zp(l,s,t,e),jr(s,2),Fn(s));break}}t=t.return}}function ou(e,t,l){var s=e.pingCache;if(s===null){s=e.pingCache=new Py;var c=new Set;s.set(t,c)}else c=s.get(t),c===void 0&&(c=new Set,s.set(t,c));c.has(l)||(eu=!0,c.add(l),e=Ky.bind(null,e,t,l),t.then(e,e))}function Ky(e,t,l){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,ut===e&&(Ye&l)===l&&(wt===4||wt===3&&(Ye&62914560)===Ye&&300>tt()-Si?(Je&2)===0&&er(e,0):tu|=l,Zl===Ye&&(Zl=0)),Fn(e)}function Qm(e,t){t===0&&(t=Pd()),e=al(e,t),e!==null&&(jr(e,t),Fn(e))}function Xy(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Qm(e,l)}function Qy(e,t){var l=0;switch(e.tag){case 31:case 13:var s=e.stateNode,c=e.memoizedState;c!==null&&(l=c.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(o(314))}s!==null&&s.delete(t),Qm(e,l)}function Zy(e,t){return Zt(e,t)}var Ri=null,nr=null,cu=!1,Ai=!1,uu=!1,Ba=0;function Fn(e){e!==nr&&e.next===null&&(nr===null?Ri=nr=e:nr=nr.next=e),Ai=!0,cu||(cu=!0,e1())}function ts(e,t){if(!uu&&Ai){uu=!0;do for(var l=!1,s=Ri;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var d=0;else{var b=s.suspendedLanes,C=s.pingedLanes;d=(1<<31-bt(42|e)+1)-1,d&=c&~(b&~C),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(l=!0,th(s,d))}else d=Ye,d=br(s,s===ut?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||wn(s,d)||(l=!0,th(s,d));s=s.next}while(l);uu=!1}}function Jy(){Zm()}function Zm(){Ai=cu=!1;var e=0;Ba!==0&&u1()&&(e=Ba);for(var t=tt(),l=null,s=Ri;s!==null;){var c=s.next,d=Jm(s,t);d===0?(s.next=null,l===null?Ri=c:l.next=c,c===null&&(nr=l)):(l=s,(e!==0||(d&3)!==0)&&(Ai=!0)),s=c}_t!==0&&_t!==5||ts(e),Ba!==0&&(Ba=0)}function Jm(e,t){for(var l=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var b=31-bt(d),C=1<<b,H=c[b];H===-1?((C&l)===0||(C&s)!==0)&&(c[b]=So(C,t)):H<=t&&(e.expiredLanes|=C),d&=~C}if(t=ut,l=Ye,l=br(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,l===0||e===t&&(at===2||at===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&ct(s),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||wn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(s!==null&&ct(s),Co(l)){case 2:case 8:l=Rt;break;case 32:l=ze;break;case 268435456:l=Wt;break;default:l=ze}return s=eh.bind(null,e),l=Zt(l,s),e.callbackPriority=t,e.callbackNode=l,t}return s!==null&&s!==null&&ct(s),e.callbackPriority=2,e.callbackNode=null,2}function eh(e,t){if(_t!==0&&_t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Ti()&&e.callbackNode!==l)return null;var s=Ye;return s=br(e,e===ut?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(_m(e,s,t),Jm(e,tt()),e.callbackNode!=null&&e.callbackNode===l?eh.bind(null,e):null)}function th(e,t){if(Ti())return null;_m(e,t,!0)}function e1(){f1(function(){(Je&6)!==0?Zt(ve,Jy):Zm()})}function du(){if(Ba===0){var e=Vl;e===0&&(e=Ve,Ve<<=1,(Ve&261888)===0&&(Ve=256)),Ba=e}return Ba}function nh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Is(""+e)}function ah(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function t1(e,t,l,s,c){if(t==="submit"&&l&&l.stateNode===c){var d=nh((c[ln]||null).action),b=s.submitter;b&&(t=(t=b[ln]||null)?nh(t.formAction):b.getAttribute("formAction"),t!==null&&(d=t,b=null));var C=new $s("action","action",null,s,c);e.push({event:C,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ba!==0){var H=b?ah(c,b):new FormData(c);Mc(l,{pending:!0,data:H,method:c.method,action:d},null,H)}}else typeof d=="function"&&(C.preventDefault(),H=b?ah(c,b):new FormData(c),Mc(l,{pending:!0,data:H,method:c.method,action:d},d,H))},currentTarget:c}]})}}for(var fu=0;fu<Wo.length;fu++){var pu=Wo[fu],n1=pu.toLowerCase(),a1=pu[0].toUpperCase()+pu.slice(1);Hn(n1,"on"+a1)}Hn(Df,"onAnimationEnd"),Hn(_f,"onAnimationIteration"),Hn(Of,"onAnimationStart"),Hn("dblclick","onDoubleClick"),Hn("focusin","onFocus"),Hn("focusout","onBlur"),Hn(yy,"onTransitionRun"),Hn(by,"onTransitionStart"),Hn(jy,"onTransitionCancel"),Hn(Bf,"onTransitionEnd"),El("onMouseEnter",["mouseout","mouseover"]),El("onMouseLeave",["mouseout","mouseover"]),El("onPointerEnter",["pointerout","pointerover"]),El("onPointerLeave",["pointerout","pointerover"]),Ja("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ja("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ja("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ja("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ns="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),l1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ns));function lh(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var s=e[l],c=s.event;s=s.listeners;e:{var d=void 0;if(t)for(var b=s.length-1;0<=b;b--){var C=s[b],H=C.instance,X=C.currentTarget;if(C=C.listener,H!==d&&c.isPropagationStopped())break e;d=C,c.currentTarget=X;try{d(c)}catch(le){qs(le)}c.currentTarget=null,d=H}else for(b=0;b<s.length;b++){if(C=s[b],H=C.instance,X=C.currentTarget,C=C.listener,H!==d&&c.isPropagationStopped())break e;d=C,c.currentTarget=X;try{d(c)}catch(le){qs(le)}c.currentTarget=null,d=H}}}}function qe(e,t){var l=t[No];l===void 0&&(l=t[No]=new Set);var s=e+"__bubble";l.has(s)||(rh(t,e,2,!1),l.add(s))}function mu(e,t,l){var s=0;t&&(s|=4),rh(l,e,s,t)}var Mi="_reactListening"+Math.random().toString(36).slice(2);function hu(e){if(!e[Mi]){e[Mi]=!0,Qd.forEach(function(l){l!=="selectionchange"&&(l1.has(l)||mu(l,!1,e),mu(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Mi]||(t[Mi]=!0,mu("selectionchange",!1,t))}}function rh(e,t,l,s){switch(Dh(t)){case 2:var c=z1;break;case 8:c=L1;break;default:c=Au}l=c.bind(null,t,l,e),c=void 0,!_o||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),s?c!==void 0?e.addEventListener(t,l,{capture:!0,passive:c}):e.addEventListener(t,l,!0):c!==void 0?e.addEventListener(t,l,{passive:c}):e.addEventListener(t,l,!1)}function xu(e,t,l,s,c){var d=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var b=s.tag;if(b===3||b===4){var C=s.stateNode.containerInfo;if(C===c)break;if(b===4)for(b=s.return;b!==null;){var H=b.tag;if((H===3||H===4)&&b.stateNode.containerInfo===c)return;b=b.return}for(;C!==null;){if(b=wl(C),b===null)return;if(H=b.tag,H===5||H===6||H===26||H===27){s=d=b;continue e}C=C.parentNode}}s=s.return}uf(function(){var X=d,le=Lo(l),ie=[];e:{var Q=If.get(e);if(Q!==void 0){var ee=$s,be=e;switch(e){case"keypress":if(Us(l)===0)break e;case"keydown":case"keyup":ee=Qg;break;case"focusin":be="focus",ee=Ho;break;case"focusout":be="blur",ee=Ho;break;case"beforeblur":case"afterblur":ee=Ho;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ee=pf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=Hg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=ey;break;case Df:case _f:case Of:ee=$g;break;case Bf:ee=ny;break;case"scroll":case"scrollend":ee=Bg;break;case"wheel":ee=ly;break;case"copy":case"cut":case"paste":ee=Pg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=hf;break;case"toggle":case"beforetoggle":ee=sy}var Te=(t&4)!==0,it=!Te&&(e==="scroll"||e==="scrollend"),P=Te?Q!==null?Q+"Capture":null:Q;Te=[];for(var $=X,W;$!==null;){var re=$;if(W=re.stateNode,re=re.tag,re!==5&&re!==26&&re!==27||W===null||P===null||(re=wr($,P),re!=null&&Te.push(as($,re,W))),it)break;$=$.return}0<Te.length&&(Q=new ee(Q,be,null,l,le),ie.push({event:Q,listeners:Te}))}}if((t&7)===0){e:{if(Q=e==="mouseover"||e==="pointerover",ee=e==="mouseout"||e==="pointerout",Q&&l!==zo&&(be=l.relatedTarget||l.fromElement)&&(wl(be)||be[kl]))break e;if((ee||Q)&&(Q=le.window===le?le:(Q=le.ownerDocument)?Q.defaultView||Q.parentWindow:window,ee?(be=l.relatedTarget||l.toElement,ee=X,be=be?wl(be):null,be!==null&&(it=p(be),Te=be.tag,be!==it||Te!==5&&Te!==27&&Te!==6)&&(be=null)):(ee=null,be=X),ee!==be)){if(Te=pf,re="onMouseLeave",P="onMouseEnter",$="mouse",(e==="pointerout"||e==="pointerover")&&(Te=hf,re="onPointerLeave",P="onPointerEnter",$="pointer"),it=ee==null?Q:kr(ee),W=be==null?Q:kr(be),Q=new Te(re,$+"leave",ee,l,le),Q.target=it,Q.relatedTarget=W,re=null,wl(le)===X&&(Te=new Te(P,$+"enter",be,l,le),Te.target=W,Te.relatedTarget=it,re=Te),it=re,ee&&be)t:{for(Te=r1,P=ee,$=be,W=0,re=P;re;re=Te(re))W++;re=0;for(var Ee=$;Ee;Ee=Te(Ee))re++;for(;0<W-re;)P=Te(P),W--;for(;0<re-W;)$=Te($),re--;for(;W--;){if(P===$||$!==null&&P===$.alternate){Te=P;break t}P=Te(P),$=Te($)}Te=null}else Te=null;ee!==null&&sh(ie,Q,ee,Te,!1),be!==null&&it!==null&&sh(ie,it,be,Te,!0)}}e:{if(Q=X?kr(X):window,ee=Q.nodeName&&Q.nodeName.toLowerCase(),ee==="select"||ee==="input"&&Q.type==="file")var Xe=kf;else if(jf(Q))if(wf)Xe=xy;else{Xe=my;var Se=py}else ee=Q.nodeName,!ee||ee.toLowerCase()!=="input"||Q.type!=="checkbox"&&Q.type!=="radio"?X&&Mo(X.elementType)&&(Xe=kf):Xe=hy;if(Xe&&(Xe=Xe(e,X))){Sf(ie,Xe,l,le);break e}Se&&Se(e,Q,X),e==="focusout"&&X&&Q.type==="number"&&X.memoizedProps.value!=null&&Ao(Q,"number",Q.value)}switch(Se=X?kr(X):window,e){case"focusin":(jf(Se)||Se.contentEditable==="true")&&(Ll=Se,qo=X,zr=null);break;case"focusout":zr=qo=Ll=null;break;case"mousedown":Yo=!0;break;case"contextmenu":case"mouseup":case"dragend":Yo=!1,zf(ie,l,le);break;case"selectionchange":if(gy)break;case"keydown":case"keyup":zf(ie,l,le)}var Ie;if(Vo)e:{switch(e){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else zl?yf(e,l)&&(Fe="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Fe="onCompositionStart");Fe&&(xf&&l.locale!=="ko"&&(zl||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&zl&&(Ie=df()):(ja=le,Oo="value"in ja?ja.value:ja.textContent,zl=!0)),Se=zi(X,Fe),0<Se.length&&(Fe=new mf(Fe,e,null,l,le),ie.push({event:Fe,listeners:Se}),Ie?Fe.data=Ie:(Ie=bf(l),Ie!==null&&(Fe.data=Ie)))),(Ie=oy?cy(e,l):uy(e,l))&&(Fe=zi(X,"onBeforeInput"),0<Fe.length&&(Se=new mf("onBeforeInput","beforeinput",null,l,le),ie.push({event:Se,listeners:Fe}),Se.data=Ie)),t1(ie,e,X,l,le)}lh(ie,t)})}function as(e,t,l){return{instance:e,listener:t,currentTarget:l}}function zi(e,t){for(var l=t+"Capture",s=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=wr(e,l),c!=null&&s.unshift(as(e,c,d)),c=wr(e,t),c!=null&&s.push(as(e,c,d))),e.tag===3)return s;e=e.return}return[]}function r1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function sh(e,t,l,s,c){for(var d=t._reactName,b=[];l!==null&&l!==s;){var C=l,H=C.alternate,X=C.stateNode;if(C=C.tag,H!==null&&H===s)break;C!==5&&C!==26&&C!==27||X===null||(H=X,c?(X=wr(l,d),X!=null&&b.unshift(as(l,X,H))):c||(X=wr(l,d),X!=null&&b.push(as(l,X,H)))),l=l.return}b.length!==0&&e.push({event:t,listeners:b})}var s1=/\r\n?/g,i1=/\u0000|\uFFFD/g;function ih(e){return(typeof e=="string"?e:""+e).replace(s1,`
|
|
50
|
-
`).replace(i1,"")}function oh(e,t){return t=ih(t),ih(e)===t}function st(e,t,l,s,c,d){switch(l){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Rl(e,""+s);break;case"className":Os(e,"class",s);break;case"tabIndex":Os(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Os(e,l,s);break;case"style":of(e,s,d);break;case"data":if(t!=="object"){Os(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Is(""+s),e.setAttribute(l,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof d=="function"&&(l==="formAction"?(t!=="input"&&st(e,t,"name",c.name,c,null),st(e,t,"formEncType",c.formEncType,c,null),st(e,t,"formMethod",c.formMethod,c,null),st(e,t,"formTarget",c.formTarget,c,null)):(st(e,t,"encType",c.encType,c,null),st(e,t,"method",c.method,c,null),st(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Is(""+s),e.setAttribute(l,s);break;case"onClick":s!=null&&(e.onclick=ta);break;case"onScroll":s!=null&&qe("scroll",e);break;case"onScrollEnd":s!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}l=Is(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""+s):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":s===!0?e.setAttribute(l,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,s):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(l,s):e.removeAttribute(l);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(l):e.setAttribute(l,s);break;case"popover":qe("beforetoggle",e),qe("toggle",e),_s(e,"popover",s);break;case"xlinkActuate":ea(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":ea(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":ea(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":ea(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":ea(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":ea(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":ea(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":ea(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":ea(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":_s(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=_g.get(l)||l,_s(e,l,s))}}function vu(e,t,l,s,c,d){switch(l){case"style":of(e,s,d);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof s=="string"?Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&Rl(e,""+s);break;case"onScroll":s!=null&&qe("scroll",e);break;case"onScrollEnd":s!=null&&qe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=ta);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zd.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(c=l.endsWith("Capture"),t=l.slice(2,c?l.length-7:void 0),d=e[ln]||null,d=d!=null?d[l]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof s=="function")){typeof d!="function"&&d!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,s,c);break e}l in e?e[l]=s:s===!0?e.setAttribute(l,""):_s(e,l,s)}}}function Ft(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var s=!1,c=!1,d;for(d in l)if(l.hasOwnProperty(d)){var b=l[d];if(b!=null)switch(d){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,d,b,l,null)}}c&&st(e,t,"srcSet",l.srcSet,l,null),s&&st(e,t,"src",l.src,l,null);return;case"input":qe("invalid",e);var C=d=b=c=null,H=null,X=null;for(s in l)if(l.hasOwnProperty(s)){var le=l[s];if(le!=null)switch(s){case"name":c=le;break;case"type":b=le;break;case"checked":H=le;break;case"defaultChecked":X=le;break;case"value":d=le;break;case"defaultValue":C=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(o(137,t));break;default:st(e,t,s,le,l,null)}}af(e,d,C,H,X,b,c,!1);return;case"select":qe("invalid",e),s=b=d=null;for(c in l)if(l.hasOwnProperty(c)&&(C=l[c],C!=null))switch(c){case"value":d=C;break;case"defaultValue":b=C;break;case"multiple":s=C;default:st(e,t,c,C,l,null)}t=d,l=b,e.multiple=!!s,t!=null?Tl(e,!!s,t,!1):l!=null&&Tl(e,!!s,l,!0);return;case"textarea":qe("invalid",e),d=c=s=null;for(b in l)if(l.hasOwnProperty(b)&&(C=l[b],C!=null))switch(b){case"value":s=C;break;case"defaultValue":c=C;break;case"children":d=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(o(91));break;default:st(e,t,b,C,l,null)}rf(e,s,c,d);return;case"option":for(H in l)if(l.hasOwnProperty(H)&&(s=l[H],s!=null))switch(H){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:st(e,t,H,s,l,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(s=0;s<ns.length;s++)qe(ns[s],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(X in l)if(l.hasOwnProperty(X)&&(s=l[X],s!=null))switch(X){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,X,s,l,null)}return;default:if(Mo(t)){for(le in l)l.hasOwnProperty(le)&&(s=l[le],s!==void 0&&vu(e,t,le,s,l,void 0));return}}for(C in l)l.hasOwnProperty(C)&&(s=l[C],s!=null&&st(e,t,C,s,l,null))}function o1(e,t,l,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,b=null,C=null,H=null,X=null,le=null;for(ee in l){var ie=l[ee];if(l.hasOwnProperty(ee)&&ie!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":H=ie;default:s.hasOwnProperty(ee)||st(e,t,ee,null,s,ie)}}for(var Q in s){var ee=s[Q];if(ie=l[Q],s.hasOwnProperty(Q)&&(ee!=null||ie!=null))switch(Q){case"type":d=ee;break;case"name":c=ee;break;case"checked":X=ee;break;case"defaultChecked":le=ee;break;case"value":b=ee;break;case"defaultValue":C=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(o(137,t));break;default:ee!==ie&&st(e,t,Q,ee,s,ie)}}Ro(e,b,C,H,X,le,d,c);return;case"select":ee=b=C=Q=null;for(d in l)if(H=l[d],l.hasOwnProperty(d)&&H!=null)switch(d){case"value":break;case"multiple":ee=H;default:s.hasOwnProperty(d)||st(e,t,d,null,s,H)}for(c in s)if(d=s[c],H=l[c],s.hasOwnProperty(c)&&(d!=null||H!=null))switch(c){case"value":Q=d;break;case"defaultValue":C=d;break;case"multiple":b=d;default:d!==H&&st(e,t,c,d,s,H)}t=C,l=b,s=ee,Q!=null?Tl(e,!!l,Q,!1):!!s!=!!l&&(t!=null?Tl(e,!!l,t,!0):Tl(e,!!l,l?[]:"",!1));return;case"textarea":ee=Q=null;for(C in l)if(c=l[C],l.hasOwnProperty(C)&&c!=null&&!s.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:st(e,t,C,null,s,c)}for(b in s)if(c=s[b],d=l[b],s.hasOwnProperty(b)&&(c!=null||d!=null))switch(b){case"value":Q=c;break;case"defaultValue":ee=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==d&&st(e,t,b,c,s,d)}lf(e,Q,ee);return;case"option":for(var be in l)if(Q=l[be],l.hasOwnProperty(be)&&Q!=null&&!s.hasOwnProperty(be))switch(be){case"selected":e.selected=!1;break;default:st(e,t,be,null,s,Q)}for(H in s)if(Q=s[H],ee=l[H],s.hasOwnProperty(H)&&Q!==ee&&(Q!=null||ee!=null))switch(H){case"selected":e.selected=Q&&typeof Q!="function"&&typeof Q!="symbol";break;default:st(e,t,H,Q,s,ee)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Te in l)Q=l[Te],l.hasOwnProperty(Te)&&Q!=null&&!s.hasOwnProperty(Te)&&st(e,t,Te,null,s,Q);for(X in s)if(Q=s[X],ee=l[X],s.hasOwnProperty(X)&&Q!==ee&&(Q!=null||ee!=null))switch(X){case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(o(137,t));break;default:st(e,t,X,Q,s,ee)}return;default:if(Mo(t)){for(var it in l)Q=l[it],l.hasOwnProperty(it)&&Q!==void 0&&!s.hasOwnProperty(it)&&vu(e,t,it,void 0,s,Q);for(le in s)Q=s[le],ee=l[le],!s.hasOwnProperty(le)||Q===ee||Q===void 0&&ee===void 0||vu(e,t,le,Q,s,ee);return}}for(var P in l)Q=l[P],l.hasOwnProperty(P)&&Q!=null&&!s.hasOwnProperty(P)&&st(e,t,P,null,s,Q);for(ie in s)Q=s[ie],ee=l[ie],!s.hasOwnProperty(ie)||Q===ee||Q==null&&ee==null||st(e,t,ie,Q,s,ee)}function ch(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function c1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),s=0;s<l.length;s++){var c=l[s],d=c.transferSize,b=c.initiatorType,C=c.duration;if(d&&C&&ch(b)){for(b=0,C=c.responseEnd,s+=1;s<l.length;s++){var H=l[s],X=H.startTime;if(X>C)break;var le=H.transferSize,ie=H.initiatorType;le&&ch(ie)&&(H=H.responseEnd,b+=le*(H<C?1:(C-X)/(H-X)))}if(--s,t+=8*(d+b)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var gu=null,yu=null;function Li(e){return e.nodeType===9?e:e.ownerDocument}function uh(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function dh(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function bu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ju=null;function u1(){var e=window.event;return e&&e.type==="popstate"?e===ju?!1:(ju=e,!0):(ju=null,!1)}var fh=typeof setTimeout=="function"?setTimeout:void 0,d1=typeof clearTimeout=="function"?clearTimeout:void 0,ph=typeof Promise=="function"?Promise:void 0,f1=typeof queueMicrotask=="function"?queueMicrotask:typeof ph<"u"?function(e){return ph.resolve(null).then(e).catch(p1)}:fh;function p1(e){setTimeout(function(){throw e})}function Ia(e){return e==="head"}function mh(e,t){var l=t,s=0;do{var c=l.nextSibling;if(e.removeChild(l),c&&c.nodeType===8)if(l=c.data,l==="/$"||l==="/&"){if(s===0){e.removeChild(c),sr(t);return}s--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")s++;else if(l==="html")ls(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,ls(l);for(var d=l.firstChild;d;){var b=d.nextSibling,C=d.nodeName;d[Sr]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&d.rel.toLowerCase()==="stylesheet"||l.removeChild(d),d=b}}else l==="body"&&ls(e.ownerDocument.body);l=c}while(l);sr(t)}function hh(e,t){var l=e;e=0;do{var s=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),s&&s.nodeType===8)if(l=s.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=s}while(l)}function Su(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Su(l),Eo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function m1(e,t,l,s){for(;e.nodeType===1;){var c=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[Sr])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=Ln(e.nextSibling),e===null)break}return null}function h1(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Ln(e.nextSibling),e===null))return null;return e}function xh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ln(e.nextSibling),e===null))return null;return e}function ku(e){return e.data==="$?"||e.data==="$~"}function wu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function x1(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var s=function(){t(),l.removeEventListener("DOMContentLoaded",s)};l.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function Ln(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Cu=null;function vh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Ln(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function gh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function yh(e,t,l){switch(t=Li(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function ls(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Eo(e)}var Dn=new Map,bh=new Set;function Di(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var va=B.d;B.d={f:v1,r:g1,D:y1,C:b1,L:j1,m:S1,X:w1,S:k1,M:C1};function v1(){var e=va.f(),t=Ci();return e||t}function g1(e){var t=Cl(e);t!==null&&t.tag===5&&t.type==="form"?Bp(t):va.r(e)}var ar=typeof document>"u"?null:document;function jh(e,t,l){var s=ar;if(s&&typeof t=="string"&&t){var c=Nn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof l=="string"&&(c+='[crossorigin="'+l+'"]'),bh.has(c)||(bh.add(c),e={rel:e,crossOrigin:l,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),Ft(t,"link",e),Ht(t),s.head.appendChild(t)))}}function y1(e){va.D(e),jh("dns-prefetch",e,null)}function b1(e,t){va.C(e,t),jh("preconnect",e,t)}function j1(e,t,l){va.L(e,t,l);var s=ar;if(s&&e&&t){var c='link[rel="preload"][as="'+Nn(t)+'"]';t==="image"&&l&&l.imageSrcSet?(c+='[imagesrcset="'+Nn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(c+='[imagesizes="'+Nn(l.imageSizes)+'"]')):c+='[href="'+Nn(e)+'"]';var d=c;switch(t){case"style":d=lr(e);break;case"script":d=rr(e)}Dn.has(d)||(e=g({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Dn.set(d,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(rs(d))||t==="script"&&s.querySelector(ss(d))||(t=s.createElement("link"),Ft(t,"link",e),Ht(t),s.head.appendChild(t)))}}function S1(e,t){va.m(e,t);var l=ar;if(l&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Nn(s)+'"][href="'+Nn(e)+'"]',d=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=rr(e)}if(!Dn.has(d)&&(e=g({rel:"modulepreload",href:e},t),Dn.set(d,e),l.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ss(d)))return}s=l.createElement("link"),Ft(s,"link",e),Ht(s),l.head.appendChild(s)}}}function k1(e,t,l){va.S(e,t,l);var s=ar;if(s&&e){var c=Nl(s).hoistableStyles,d=lr(e);t=t||"default";var b=c.get(d);if(!b){var C={loading:0,preload:null};if(b=s.querySelector(rs(d)))C.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Dn.get(d))&&Nu(e,l);var H=b=s.createElement("link");Ht(H),Ft(H,"link",e),H._p=new Promise(function(X,le){H.onload=X,H.onerror=le}),H.addEventListener("load",function(){C.loading|=1}),H.addEventListener("error",function(){C.loading|=2}),C.loading|=4,_i(b,t,s)}b={type:"stylesheet",instance:b,count:1,state:C},c.set(d,b)}}}function w1(e,t){va.X(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),d=s.get(c);d||(d=l.querySelector(ss(c)),d||(e=g({src:e,async:!0},t),(t=Dn.get(c))&&Eu(e,t),d=l.createElement("script"),Ht(d),Ft(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function C1(e,t){va.M(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),d=s.get(c);d||(d=l.querySelector(ss(c)),d||(e=g({src:e,async:!0,type:"module"},t),(t=Dn.get(c))&&Eu(e,t),d=l.createElement("script"),Ht(d),Ft(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function Sh(e,t,l,s){var c=(c=xe.current)?Di(c):null;if(!c)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=lr(l.href),l=Nl(c).hoistableStyles,s=l.get(t),s||(s={type:"style",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=lr(l.href);var d=Nl(c).hoistableStyles,b=d.get(e);if(b||(c=c.ownerDocument||c,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,b),(d=c.querySelector(rs(e)))&&!d._p&&(b.instance=d,b.state.loading=5),Dn.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Dn.set(e,l),d||N1(c,e,l,b.state))),t&&s===null)throw Error(o(528,""));return b}if(t&&s!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=rr(l),l=Nl(c).hoistableScripts,s=l.get(t),s||(s={type:"script",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function lr(e){return'href="'+Nn(e)+'"'}function rs(e){return'link[rel="stylesheet"]['+e+"]"}function kh(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function N1(e,t,l,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Ft(t,"link",l),Ht(t),e.head.appendChild(t))}function rr(e){return'[src="'+Nn(e)+'"]'}function ss(e){return"script[async]"+e}function wh(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Nn(l.href)+'"]');if(s)return t.instance=s,Ht(s),s;var c=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Ht(s),Ft(s,"style",c),_i(s,l.precedence,e),t.instance=s;case"stylesheet":c=lr(l.href);var d=e.querySelector(rs(c));if(d)return t.state.loading|=4,t.instance=d,Ht(d),d;s=kh(l),(c=Dn.get(c))&&Nu(s,c),d=(e.ownerDocument||e).createElement("link"),Ht(d);var b=d;return b._p=new Promise(function(C,H){b.onload=C,b.onerror=H}),Ft(d,"link",s),t.state.loading|=4,_i(d,l.precedence,e),t.instance=d;case"script":return d=rr(l.src),(c=e.querySelector(ss(d)))?(t.instance=c,Ht(c),c):(s=l,(c=Dn.get(d))&&(s=g({},l),Eu(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),Ht(c),Ft(c,"link",s),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,_i(s,l.precedence,e));return t.instance}function _i(e,t,l){for(var s=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,d=c,b=0;b<s.length;b++){var C=s[b];if(C.dataset.precedence===t)d=C;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Nu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Eu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Oi=null;function Ch(e,t,l){if(Oi===null){var s=new Map,c=Oi=new Map;c.set(l,s)}else c=Oi,s=c.get(l),s||(s=new Map,c.set(l,s));if(s.has(e))return s;for(s.set(e,null),l=l.getElementsByTagName(e),c=0;c<l.length;c++){var d=l[c];if(!(d[Sr]||d[Gt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var b=d.getAttribute(t)||"";b=e+b;var C=s.get(b);C?C.push(d):s.set(b,[d])}}return s}function Nh(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function E1(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Eh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function T1(e,t,l,s){if(l.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var c=lr(s.href),d=t.querySelector(rs(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Bi.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=d,Ht(d);return}d=t.ownerDocument||t,s=kh(s),(c=Dn.get(c))&&Nu(s,c),d=d.createElement("link"),Ht(d);var b=d;b._p=new Promise(function(C,H){b.onload=C,b.onerror=H}),Ft(d,"link",s),l.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Bi.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Tu=0;function R1(e,t){return e.stylesheets&&e.count===0&&Hi(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var s=setTimeout(function(){if(e.stylesheets&&Hi(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Tu===0&&(Tu=62500*c1());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Hi(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Tu?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Bi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hi(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ii=null;function Hi(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ii=new Map,t.forEach(A1,e),Ii=null,Bi.call(e))}function A1(e,t){if(!(t.state.loading&4)){var l=Ii.get(e);if(l)var s=l.get(null);else{l=new Map,Ii.set(e,l);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var b=c[d];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),s=b)}s&&l.set(null,s)}c=t.instance,b=c.getAttribute("data-precedence"),d=l.get(b)||s,d===s&&l.set(null,c),l.set(b,c),this.count++,s=Bi.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var is={$$typeof:O,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function M1(e,t,l,s,c,d,b,C,H){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ko(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ko(0),this.hiddenUpdates=ko(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function Th(e,t,l,s,c,d,b,C,H,X,le,ie){return e=new M1(e,t,l,b,H,X,le,ie,C),t=1,d===!0&&(t|=24),d=pn(3,null,null,t),e.current=d,d.stateNode=e,t=ic(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:s,isDehydrated:l,cache:t},dc(d),e}function Rh(e){return e?(e=Ol,e):Ol}function Ah(e,t,l,s,c,d){c=Rh(c),s.context===null?s.context=c:s.pendingContext=c,s=Ea(t),s.payload={element:l},d=d===void 0?null:d,d!==null&&(s.callback=d),l=Ta(e,s,t),l!==null&&(dn(l,e,t),Hr(l,e,t))}function Mh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Ru(e,t){Mh(e,t),(e=e.alternate)&&Mh(e,t)}function zh(e){if(e.tag===13||e.tag===31){var t=al(e,67108864);t!==null&&dn(t,e,67108864),Ru(e,67108864)}}function Lh(e){if(e.tag===13||e.tag===31){var t=gn();t=wo(t);var l=al(e,t);l!==null&&dn(l,e,t),Ru(e,t)}}var Ui=!0;function z1(e,t,l,s){var c=E.T;E.T=null;var d=B.p;try{B.p=2,Au(e,t,l,s)}finally{B.p=d,E.T=c}}function L1(e,t,l,s){var c=E.T;E.T=null;var d=B.p;try{B.p=8,Au(e,t,l,s)}finally{B.p=d,E.T=c}}function Au(e,t,l,s){if(Ui){var c=Mu(s);if(c===null)xu(e,t,s,Vi,l),_h(e,s);else if(_1(c,e,t,l,s))s.stopPropagation();else if(_h(e,s),t&4&&-1<D1.indexOf(e)){for(;c!==null;){var d=Cl(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var b=Nt(d.pendingLanes);if(b!==0){var C=d;for(C.pendingLanes|=2,C.entangledLanes|=2;b;){var H=1<<31-bt(b);C.entanglements[1]|=H,b&=~H}Fn(d),(Je&6)===0&&(ki=tt()+500,ts(0))}}break;case 31:case 13:C=al(d,2),C!==null&&dn(C,d,2),Ci(),Ru(d,2)}if(d=Mu(s),d===null&&xu(e,t,s,Vi,l),d===c)break;c=d}c!==null&&s.stopPropagation()}else xu(e,t,s,null,l)}}function Mu(e){return e=Lo(e),zu(e)}var Vi=null;function zu(e){if(Vi=null,e=wl(e),e!==null){var t=p(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=f(t),e!==null)return e;e=null}else if(l===31){if(e=h(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Vi=e,null}function Dh(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(jt()){case ve:return 2;case Rt:return 8;case ze:case xt:return 32;case Wt:return 268435456;default:return 32}default:return 32}}var Lu=!1,Ha=null,Ua=null,Va=null,os=new Map,cs=new Map,$a=[],D1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function _h(e,t){switch(e){case"focusin":case"focusout":Ha=null;break;case"dragenter":case"dragleave":Ua=null;break;case"mouseover":case"mouseout":Va=null;break;case"pointerover":case"pointerout":os.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":cs.delete(t.pointerId)}}function us(e,t,l,s,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:l,eventSystemFlags:s,nativeEvent:d,targetContainers:[c]},t!==null&&(t=Cl(t),t!==null&&zh(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function _1(e,t,l,s,c){switch(t){case"focusin":return Ha=us(Ha,e,t,l,s,c),!0;case"dragenter":return Ua=us(Ua,e,t,l,s,c),!0;case"mouseover":return Va=us(Va,e,t,l,s,c),!0;case"pointerover":var d=c.pointerId;return os.set(d,us(os.get(d)||null,e,t,l,s,c)),!0;case"gotpointercapture":return d=c.pointerId,cs.set(d,us(cs.get(d)||null,e,t,l,s,c)),!0}return!1}function Oh(e){var t=wl(e.target);if(t!==null){var l=p(t);if(l!==null){if(t=l.tag,t===13){if(t=f(l),t!==null){e.blockedOn=t,Kd(e.priority,function(){Lh(l)});return}}else if(t===31){if(t=h(l),t!==null){e.blockedOn=t,Kd(e.priority,function(){Lh(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function $i(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Mu(e.nativeEvent);if(l===null){l=e.nativeEvent;var s=new l.constructor(l.type,l);zo=s,l.target.dispatchEvent(s),zo=null}else return t=Cl(l),t!==null&&zh(t),e.blockedOn=l,!1;t.shift()}return!0}function Bh(e,t,l){$i(e)&&l.delete(t)}function O1(){Lu=!1,Ha!==null&&$i(Ha)&&(Ha=null),Ua!==null&&$i(Ua)&&(Ua=null),Va!==null&&$i(Va)&&(Va=null),os.forEach(Bh),cs.forEach(Bh)}function Gi(e,t){e.blockedOn===t&&(e.blockedOn=null,Lu||(Lu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,O1)))}var Pi=null;function Ih(e){Pi!==e&&(Pi=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Pi===e&&(Pi=null);for(var t=0;t<e.length;t+=3){var l=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(zu(s||l)===null)continue;break}var d=Cl(l);d!==null&&(e.splice(t,3),t-=3,Mc(d,{pending:!0,data:c,method:l.method,action:s},s,c))}}))}function sr(e){function t(H){return Gi(H,e)}Ha!==null&&Gi(Ha,e),Ua!==null&&Gi(Ua,e),Va!==null&&Gi(Va,e),os.forEach(t),cs.forEach(t);for(var l=0;l<$a.length;l++){var s=$a[l];s.blockedOn===e&&(s.blockedOn=null)}for(;0<$a.length&&(l=$a[0],l.blockedOn===null);)Oh(l),l.blockedOn===null&&$a.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(s=0;s<l.length;s+=3){var c=l[s],d=l[s+1],b=c[ln]||null;if(typeof d=="function")b||Ih(l);else if(b){var C=null;if(d&&d.hasAttribute("formAction")){if(c=d,b=d[ln]||null)C=b.formAction;else if(zu(c)!==null)continue}else C=b.action;typeof C=="function"?l[s+1]=C:(l.splice(s,3),s-=3),Ih(l)}}}function Hh(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(b){return c=b})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(l,20)}function l(){if(!s&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Du(e){this._internalRoot=e}qi.prototype.render=Du.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,s=gn();Ah(l,s,e,t,null,null)},qi.prototype.unmount=Du.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ah(e.current,2,null,e,null,null),Ci(),t[kl]=null}};function qi(e){this._internalRoot=e}qi.prototype.unstable_scheduleHydration=function(e){if(e){var t=Wd();e={blockedOn:null,target:e,priority:t};for(var l=0;l<$a.length&&t!==0&&t<$a[l].priority;l++);$a.splice(l,0,e),l===0&&Oh(e)}};var Uh=r.version;if(Uh!=="19.2.4")throw Error(o(527,Uh,"19.2.4"));B.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=m(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var B1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yi.isDisabled&&Yi.supportsFiber)try{Zn=Yi.inject(B1),Ct=Yi}catch{}}return fs.createRoot=function(e,t){if(!u(e))throw Error(o(299));var l=!1,s="",c=Fp,d=Wp,b=Kp;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=Th(e,1,!1,null,null,l,s,null,c,d,b,Hh),e[kl]=t.current,hu(e),new Du(t)},fs.hydrateRoot=function(e,t,l){if(!u(e))throw Error(o(299));var s=!1,c="",d=Fp,b=Wp,C=Kp,H=null;return l!=null&&(l.unstable_strictMode===!0&&(s=!0),l.identifierPrefix!==void 0&&(c=l.identifierPrefix),l.onUncaughtError!==void 0&&(d=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(C=l.onRecoverableError),l.formState!==void 0&&(H=l.formState)),t=Th(e,1,!0,t,l??null,s,c,H,d,b,C,Hh),t.context=Rh(null),l=t.current,s=gn(),s=wo(s),c=Ea(s),c.callback=null,Ta(l,c,s),l=s,t.current.lanes=l,jr(t,l),Fn(t),e[kl]=t.current,hu(e),new qi(t)},fs.version="19.2.4",fs}var Xh;function Y1(){if(Xh)return Bu.exports;Xh=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}return a(),Bu.exports=q1(),Bu.exports}var F1=Y1();const W1="modulepreload",K1=function(a){return"/"+a},Qh={},Cd=function(r,i,o){let u=Promise.resolve();if(i&&i.length>0){let f=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),x=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));u=f(i.map(m=>{if(m=K1(m),m in Qh)return;Qh[m]=!0;const y=m.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const j=document.createElement("link");if(j.rel=y?"stylesheet":W1,y||(j.as="script"),j.crossOrigin="",j.href=m,x&&j.setAttribute("nonce",x),document.head.appendChild(j),y)return new Promise((S,N)=>{j.addEventListener("load",S),j.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${m}`)))})}))}function p(f){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=f,window.dispatchEvent(h),!h.defaultPrevented)throw f}return u.then(f=>{for(const h of f||[])h.status==="rejected"&&p(h.reason);return r().catch(p)})},Zh={own:"authoring-project",installed:"available-project",global:"available-personal"},cd=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function X1(a){if(typeof a=="string"){if(cd.has(a))return a;if(Object.prototype.hasOwnProperty.call(Zh,a))return Zh[a]}return"authoring-project"}function Q1(a){return a.startsWith("available-")?"available":"authoring"}function Z1(a){const r=a.indexOf("-");return a.slice(r+1)}const Ya="";class gs extends Error{constructor(r,i){super(r),this.name="ApiError",this.status=i}}async function Ge(a,r){const i=await fetch(`${Ya}${a}`,r);if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new gs(o.error||`HTTP ${i.status}`,i.status)}return i.json()}function en(a){return typeof a=="string"&&a.length>0?a:null}function J1(a){return typeof a=="number"&&Number.isFinite(a)?a:null}function Vu(a){if(!Array.isArray(a))return null;const r=a.filter(i=>typeof i=="string"&&i.length>0);return r.length>0?r:null}function eb(a){const r=a??{};let i;r.origin==="source"||r.origin==="installed"?i=r.origin:(i="source",console.warn(`[api.getSkills] skill ${String(r.plugin)}/${String(r.skill)} has invalid origin=${JSON.stringify(r.origin)}; defaulting to 'source'`));let o;r.scope==="own"||r.scope==="installed"||r.scope==="global"?o=r.scope:o=i==="installed"?"installed":"own";let u;r.installMethod==="authored"||r.installMethod==="copied"||r.installMethod==="symlinked"?u=r.installMethod:u=o==="own"?"authored":"copied";const p=typeof r.scopeV2=="string"&&cd.has(r.scopeV2)?r.scopeV2:X1(r.scope),f=Q1(p),h=Z1(p),x=typeof r.precedenceRank=="number"?r.precedenceRank:void 0;let m;r.shadowedBy===null?m=null:typeof r.shadowedBy=="string"&&cd.has(r.shadowedBy)?m=r.shadowedBy:m=void 0;const y={plugin:typeof r.plugin=="string"?r.plugin:"",skill:typeof r.skill=="string"?r.skill:"",dir:typeof r.dir=="string"?r.dir:"",hasEvals:!!r.hasEvals,hasBenchmark:!!r.hasBenchmark,evalCount:typeof r.evalCount=="number"?r.evalCount:0,assertionCount:typeof r.assertionCount=="number"?r.assertionCount:0,benchmarkStatus:r.benchmarkStatus==="pass"||r.benchmarkStatus==="fail"||r.benchmarkStatus==="pending"||r.benchmarkStatus==="stale"||r.benchmarkStatus==="missing"?r.benchmarkStatus:"missing",lastBenchmark:typeof r.lastBenchmark=="string"?r.lastBenchmark:null,origin:i,scope:o,isSymlink:typeof r.isSymlink=="boolean"?r.isSymlink:!1,symlinkTarget:en(r.symlinkTarget),installMethod:u,scopeV2:p,group:f,source:h,pluginName:en(r.pluginName),pluginNamespace:en(r.pluginNamespace),pluginMarketplace:en(r.pluginMarketplace),pluginManifestPath:en(r.pluginManifestPath),pluginVersion:en(r.pluginVersion),precedenceRank:x,shadowedBy:m,description:en(r.description),version:en(r.version),category:en(r.category),author:en(r.author),license:en(r.license),homepage:en(r.homepage),tags:Vu(r.tags),deps:Vu(r.deps),mcpDeps:Vu(r.mcpDeps),entryPoint:en(r.entryPoint),lastModified:en(r.lastModified),sizeBytes:J1(r.sizeBytes),sourceAgent:en(r.sourceAgent)};if(r.provenance&&typeof r.provenance=="object"){const g=r.provenance;(g.promotedFrom==="installed"||g.promotedFrom==="global")&&typeof g.sourcePath=="string"&&typeof g.promotedAt=="number"?y.provenance={promotedFrom:g.promotedFrom,sourcePath:g.sourcePath,promotedAt:g.promotedAt,sourceSkillVersion:typeof g.sourceSkillVersion=="string"?g.sourceSkillVersion:void 0}:y.provenance=null}else r.provenance===null&&(y.provenance=null);return typeof r.updateAvailable=="boolean"&&(y.updateAvailable=r.updateAvailable),typeof r.currentVersion=="string"&&(y.currentVersion=r.currentVersion),typeof r.latestVersion=="string"&&(y.latestVersion=r.latestVersion),typeof r.pinnedVersion=="string"&&(y.pinnedVersion=r.pinnedVersion),y}const Ne={getConfig(){return Ge("/api/config")},setConfig(a,r){return Ge("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a,model:r})})},async getSkills(a){const r=new URLSearchParams;a!=null&&a.scope&&r.set("scope",a.scope),a!=null&&a.agent&&r.set("agent",a.agent);const i=r.toString(),o=await Ge(`/api/skills${i?"?"+i:""}`);return Array.isArray(o)?o.map(eb):[]},getAgents(){return Ge("/api/agents")},getSkillDetail(a,r){return Ge(`/api/skills/${a}/${r}`)},getEvals(a,r){return Ge(`/api/skills/${a}/${r}/evals`)},saveEvals(a,r,i){return Ge(`/api/skills/${a}/${r}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},generateEvals(a,r){return Ge(`/api/skills/${a}/${r}/generate-evals`,{method:"POST"})},async getLatestBenchmark(a,r){const i=await fetch(`${Ya}/api/skills/${a}/${r}/benchmark/latest`);if(i.status===404)return null;if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new gs(o.error||`HTTP ${i.status}`,i.status)}return i.json()},getHistory(a,r,i){const o=new URLSearchParams;i!=null&&i.model&&o.set("model",i.model),i!=null&&i.type&&o.set("type",i.type),i!=null&&i.from&&o.set("from",i.from),i!=null&&i.to&&o.set("to",i.to);const u=o.toString();return Ge(`/api/skills/${a}/${r}/history${u?"?"+u:""}`)},getHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`)},compareRuns(a,r,i,o){return Ge(`/api/skills/${a}/${r}/history-compare?a=${encodeURIComponent(i)}&b=${encodeURIComponent(o)}`)},getCaseHistory(a,r,i,o){const u=new URLSearchParams;o&&u.set("model",o);const p=u.toString();return Ge(`/api/skills/${a}/${r}/history/case/${i}${p?"?"+p:""}`)},deleteHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`,{method:"DELETE"})},deleteSkill(a,r){return Ge(`/api/skills/${a}/${r}`,{method:"DELETE"})},improveSkill(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},instructEdit(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...i})})},applyImprovement(a,r,i){return Ge(`/api/skills/${a}/${r}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})})},getStats(a,r){return Ge(`/api/skills/${a}/${r}/stats`)},getDependencies(a,r){return Ge(`/api/skills/${a}/${r}/dependencies`)},getProjectLayout(){return Ge("/api/project-layout")},createSkill(a){return Ge("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},saveDraft(a){return Ge("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillCreatorStatus(){return Ge("/api/skill-creator-status")},generateSkill(a){return Ge("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillFiles(a,r){return Ge(`/api/skills/${a}/${r}/files`)},getSkillFile(a,r,i){return Ge(`/api/skills/${a}/${r}/file?path=${encodeURIComponent(i)}`)},saveSkillFile(a,r,i,o){return Ge(`/api/skills/${a}/${r}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:o})})},getLeaderboard(a,r){return Ge(`/api/skills/${a}/${r}/leaderboard`)},getLeaderboardEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/leaderboard/${encodeURIComponent(i)}`)},startSweep(a,r,i){const o=`${Ya}/api/skills/${a}/${r}/sweep`,u=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(i)}),u},getCredentials(a,r){return Ge(`/api/credentials/${a}/${r}`)},setCredential(a,r,i,o){return Ge(`/api/credentials/${a}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,value:o})})},getParams(a,r){return Ge(`/api/credentials/${a}/${r}/params`)},getParamsRevealed(a,r,i){const o=i?`reveal=true&key=${encodeURIComponent(i)}`:"reveal=true";return Ge(`/api/credentials/${a}/${r}/params?${o}`)},searchModels(){return Ge("/api/openrouter/models")},getSkillVersions(a,r){return Ge(`/api/skills/${a}/${r}/versions`)},getVersionDiff(a,r,i,o){return Ge(`/api/skills/${a}/${r}/versions/diff?from=${i}&to=${o}`)},startBatchUpdate(a){const r=`${Ya}/api/skills/batch-update`,i=new EventSource(r);return fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:a})}),i},startSkillUpdate(a,r){const i=`${Ya}/api/skills/${a}/${r}/update`,o=new EventSource(i);return fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),o},async getSkillUpdates(){try{const a=await fetch(`${Ya}/api/skills/updates`);return a.ok?await a.json():[]}catch{return[]}},promoteSkill(a,r,i){const o=i!=null&&i.overwrite?"?overwrite=true":"";return $u(`/api/skills/${a}/${r}/promote${o}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},testInstallSkill(a,r,i){const o=new URLSearchParams;(i==null?void 0:i.dest)==="global"&&o.set("dest","global"),i!=null&&i.overwrite&&o.set("overwrite","true");const u=o.toString();return $u(`/api/skills/${a}/${r}/test-install${u?"?"+u:""}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},revertSkill(a,r,i){return $u(`/api/skills/${a}/${r}/revert`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},listStudioOps(a){const r=new URLSearchParams;(a==null?void 0:a.before)!=null&&r.set("before",String(a.before)),(a==null?void 0:a.limit)!=null&&r.set("limit",String(a.limit));const i=r.toString();return Ge(`/api/studio/ops${i?"?"+i:""}`)},deleteStudioOp(a){return Ge(`/api/studio/ops/${encodeURIComponent(a)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${Ya}/api/studio/ops/stream`)}};async function $u(a,r,i){const o=await fetch(`${Ya}${a}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},signal:i});if(!o.ok||!o.body){let y=`HTTP ${o.status}`,g;try{const S=await o.json();S.error&&(y=S.error),typeof S.code=="string"&&(g=S.code)}catch{}const j=new gs(y,o.status);throw g&&(j.code=g),j}const u=o.body.getReader(),p=new TextDecoder;let f="",h="",x=null,m=null;for(;;){const{done:y,value:g}=await u.read();if(y)break;f+=p.decode(g,{stream:!0});const j=f.split(`
|
|
51
|
-
`);f=j.pop()??"";for(const S of j)if(S.startsWith("event: "))h=S.slice(7).trim();else if(S.startsWith("data: ")){let N={};try{N=JSON.parse(S.slice(6))}catch{h="";continue}if(h==="started"||h==="copied"||h==="deleted"||h==="indexed"||h==="done"||h==="error"){const z={type:h,...N};r==null||r(z),z.type==="done"&&(x=z),z.type==="error"&&(m=z)}h=""}}if(m){const y=new gs(m.message,500);throw y.code=m.code,y}if(!x)throw new gs("Transfer stream ended without 'done' event",500);return x}function tb(a,r){if(!r.length)return a;const i=new Map;for(const o of r){const u=o.name.split("/").pop()||o.name;i.set(u,o)}return a.map(o=>{const u=i.get(o.skill);return u?{...o,updateAvailable:u.updateAvailable,currentVersion:u.installed,latestVersion:u.latest??void 0}:o})}function nb(a){const[r,i]=v.useState(()=>typeof window>"u"?!1:window.matchMedia(a).matches);return v.useEffect(()=>{const o=window.matchMedia(a);i(o.matches);const u=p=>i(p.matches);return o.addEventListener("change",u),()=>o.removeEventListener("change",u)},[a]),r}const ab=3e5,lb=500,rb=15e3,sb=6e4;function ib(a){const r=new Map;for(const i of a){const o=i.name.split("/").pop()||i.name;r.set(o,i)}return r}function ob(a){let r=0;for(const i of a)i.updateAvailable&&r++;return r}function cb(a){a()}function ub(a){const r=ab,i=lb,o=rb,u=sb,[p,f]=v.useState([]),[h,x]=v.useState(()=>new Map),[m,y]=v.useState(0),[g,j]=v.useState(!1),[S,N]=v.useState(null),[z,T]=v.useState(null),k=v.useRef(null),M=v.useRef(null),O=v.useRef(null),V=v.useRef(null),A=v.useRef(!0),U=v.useCallback(async()=>{j(!0);const I=new AbortController,G=setTimeout(()=>I.abort(),o);try{const Y=await Promise.race([Ne.getSkillUpdates(),new Promise((te,q)=>{I.signal.addEventListener("abort",()=>{q(new Error("TIMEOUT"))})})]);if(Y==="TIMEOUT")throw new Error("TIMEOUT");if(!A.current)return;f(Y),x(ib(Y)),y(ob(Y)),M.current=Date.now(),N(M.current),T(null)}catch(Y){if(!A.current)return;T(Y instanceof Error?Y:new Error(String(Y)))}finally{clearTimeout(G),A.current&&j(!1)}},[o]),w=v.useCallback(()=>{if(k.current)return k.current;const I=U().finally(()=>{k.current=null});return k.current=I,I},[U]),L=v.useCallback(()=>{O.current==null&&(O.current=setInterval(()=>{w()},r))},[r,w]),R=v.useCallback(()=>{O.current!=null&&(clearInterval(O.current),O.current=null)},[]);return v.useEffect(()=>{A.current=!0,(M.current==null||Date.now()-M.current>u)&&cb(()=>void w()),(typeof document>"u"||document.visibilityState!=="hidden")&&L();const Y=()=>{if(V.current&&(clearTimeout(V.current),V.current=null),document.visibilityState==="hidden"){R();return}V.current=setTimeout(()=>{V.current=null,(M.current==null||Date.now()-M.current>u)&&w(),L()},i)};return typeof document<"u"&&document.addEventListener("visibilitychange",Y),()=>{A.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",Y),V.current&&clearTimeout(V.current),R()}},[]),{updates:p,updatesMap:h,updateCount:m,isRefreshing:g,lastFetchAt:S,error:z,refresh:w}}const db={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1};function fb(a,r){switch(r.type){case"SELECT_SKILL":return{...a,selectedSkill:r.skill,mode:"browse",mobileView:a.isMobile?"detail":a.mobileView};case"CLEAR_SELECTION":return{...a,selectedSkill:null};case"SET_MODE":return{...a,mode:r.mode,selectedSkill:r.mode==="create"?null:a.selectedSkill};case"SET_SEARCH":return{...a,searchQuery:r.query};case"SET_SKILLS":return{...a,skills:r.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...a,skillsError:r.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...a,skillsLoading:r.loading};case"SET_MOBILE":return{...a,isMobile:r.isMobile};case"SET_MOBILE_VIEW":return{...a,mobileView:r.view};case"DISMISS_UPDATE_NOTIFICATION":return{...a,updateNotificationDismissed:!0};default:return a}}const dv=v.createContext(null);function ya(){const a=v.useContext(dv);if(!a)throw new Error("useStudio must be used within StudioProvider");return a}function pb({children:a}){const[r,i]=v.useReducer(fb,db),o=nb("(max-width: 767px)");v.useEffect(()=>{i({type:"SET_MOBILE",isMobile:o})},[o]);const[u,p]=v.useState(()=>{try{const A=window.localStorage.getItem("vskill.studio.prefs");if(!A)return null;const U=JSON.parse(A);return typeof U.activeAgent=="string"?U.activeAgent:null}catch{return null}});v.useEffect(()=>{function A(U){if(!(U instanceof CustomEvent))return;const w=U.detail;w!=null&&w.agentId&&p(w.agentId)}return window.addEventListener("studio:agent-changed",A),()=>window.removeEventListener("studio:agent-changed",A)},[]);const f=v.useCallback(()=>{i({type:"SET_SKILLS_LOADING",loading:!0});const A=u?{agent:u}:void 0;Ne.getSkills(A).then(U=>{i({type:"SET_SKILLS",skills:U});const L=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(L){const[,R,I]=L,G=U.find(Y=>Y.plugin===R&&Y.skill===I);G&&i({type:"SELECT_SKILL",skill:{plugin:R,skill:I,origin:G.origin}})}}).catch(U=>i({type:"SET_SKILLS_ERROR",error:U.message}))},[u]);v.useEffect(()=>{f()},[f]);const h=v.useCallback(A=>{i({type:"SELECT_SKILL",skill:A}),window.location.hash=`/skills/${A.plugin}/${A.skill}`},[]),x=v.useCallback(()=>{i({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),m=v.useCallback(A=>{i({type:"SET_MODE",mode:A})},[]),y=v.useCallback(A=>{i({type:"SET_SEARCH",query:A})},[]),g=v.useCallback(A=>{i({type:"SET_MOBILE_VIEW",view:A})},[]),j=v.useCallback(()=>{i({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),S=ub(),N=v.useMemo(()=>{const A=r.skills.map(U=>{if(!U.updateAvailable&&U.latestVersion===void 0)return U;const w={...U};return delete w.updateAvailable,delete w.currentVersion,delete w.latestVersion,w});return tb(A,S.updates)},[r.skills,S.updates]),z=v.useMemo(()=>{const A={source:0,installed:0};for(const U of N)U.updateAvailable&&(A[U.origin]+=1);return A},[N]),T=v.useMemo(()=>({...r,skills:N}),[r,N]),k=S.updateCount,M=S.refresh,O=S.isRefreshing,V=v.useMemo(()=>({state:T,selectSkill:h,clearSelection:x,setMode:m,setSearch:y,setMobileView:g,refreshSkills:f,updateCount:k,dismissUpdateNotification:j,updates:S.updates,outdatedByOrigin:z,isRefreshingUpdates:O,refreshUpdates:M}),[T,h,x,m,y,g,f,k,j,S.updates,z,O,M]);return n.jsx(dv.Provider,{value:V,children:a})}const mb={config:null,loading:!0};function hb(a,r){switch(r.type){case"SET_CONFIG":return{config:r.config,loading:!1};case"SET_LOADING":return{...a,loading:!0};default:return a}}const fv=v.createContext(null);function bl(){const a=v.useContext(fv);if(!a)throw new Error("useConfig must be used within ConfigProvider");return a}function xb({children:a}){const[r,i]=v.useReducer(hb,mb),o=v.useCallback(()=>{Ne.getConfig().then(f=>i({type:"SET_CONFIG",config:f})).catch(()=>{})},[]);v.useEffect(()=>{o()},[o]);const u=v.useCallback(async(f,h)=>{const x=await Ne.setConfig(f,h);return i({type:"SET_CONFIG",config:x}),x},[]),p=v.useMemo(()=>({config:r.config,loading:r.loading,updateConfig:u,refreshConfig:o}),[r,u,o]);return n.jsx(fv.Provider,{value:p,children:a})}function vb({topRail:a,sidebar:r,main:i,statusBar:o,resizeHandle:u,banner:p,liveMessage:f,sidebarWidth:h=320,sidebarHidden:x=!1}){const m={"--top-rail-height":"48px","--status-bar-height":"28px","--sidebar-width":`${h}px`,display:"grid",gridTemplateRows:"var(--top-rail-height) 1fr var(--status-bar-height)",height:"100vh",overflow:"hidden",background:"var(--bg-canvas)",color:"var(--text-primary)"},y={display:"grid",gridTemplateColumns:x?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return n.jsxs("div",{className:"studio-shell",style:m,children:[p,n.jsx("header",{style:{borderBottom:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:a}),n.jsxs("div",{style:y,children:[!x&&n.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:u?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:r}),!x&&u,n.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:i})]}),n.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),n.jsx("div",{"aria-live":"polite",role:"status",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},children:f??""})]})}var mo=uv();const gb=cv(mo),Jh=["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],yb={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},bb={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},jb={"claude-cli":"cli-install",anthropic:"api-key",openrouter:"api-key",cursor:"cli-install","codex-cli":"cli-install","gemini-cli":"cli-install",copilot:"cli-install",zed:"cli-install",ollama:"start-service","lm-studio":"start-service"},Sb={"claude-cli":"subscription",anthropic:"per-token",openrouter:"per-token",cursor:"subscription","codex-cli":"subscription","gemini-cli":"subscription",copilot:"subscription",zed:"subscription",ollama:"free","lm-studio":"free"};function kb(a,r){var h,x;const i=yb[a.id]??null,o=bb[a.id]??null,u=i?!!((h=r==null?void 0:r.wrapperFolders)!=null&&h[i]):!1,p=o?!!((x=r==null?void 0:r.binaries)!=null&&x[o]):!0,f=a.models.map(m=>({id:m.id,displayName:m.label,billingMode:Sb[a.id]??"per-token"}));return{id:a.id,displayName:wb(a.id,a.label),wrapperFolder:i,wrapperFolderPresent:u,binaryAvailable:p,endpointReachable:a.id==="ollama"||a.id==="lm-studio"?a.available:null,available:a.available,ctaType:a.available?null:jb[a.id]??null,models:f}}function wb(a,r){return{"claude-cli":"Claude Code",anthropic:"Anthropic API",openrouter:"OpenRouter",cursor:"Cursor","codex-cli":"Codex CLI","gemini-cli":"Gemini CLI",copilot:"GitHub Copilot",zed:"Zed",ollama:"Ollama","lm-studio":"LM Studio"}[a]??r}function Cb(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of Jh){const u=r.get(o);u&&i.push(u)}for(const o of a)Jh.includes(o.id)||i.push(o);return i}function Nb(a){const[r,i]=v.useState(null),[o,u]=v.useState("loading"),[p,f]=v.useState(null),h=v.useRef(null),x=v.useRef(0),m=v.useCallback(async()=>{try{const N=await fetch("/api/config");if(!N.ok)throw new Error(`/api/config returned ${N.status}`);const z=await N.json(),T=Cb((z.providers||[]).map(k=>kb(k,z.detection)));i({agents:T,activeAgent:z.provider??null,activeModel:z.model??null}),u("ready"),f(null)}catch(N){u("error"),f(N.message)}},[]);v.useEffect(()=>{m()},[m]);const y=v.useCallback(async()=>{const N=Date.now();if(!(N-x.current<5*6e4))try{const z=await fetch("/api/openrouter/models");if(!z.ok)return;const T=await z.json();x.current=N,i(k=>{if(!k)return k;const M=k.agents.map(O=>{if(O.id!=="openrouter")return O;const V=T.models.map(U=>({id:U.id,displayName:U.name,contextWindow:U.contextWindow,pricing:U.pricing,billingMode:"per-token"}));return{...O,models:V,catalogAgeMs:T.ageSec?T.ageSec*1e3:0,cacheStale:!!T.stale}});return{...k,agents:M}}),T.stale&&(a!=null&&a.onStaleCatalog)&&a.onStaleCatalog("openrouter",(T.ageSec??0)*1e3)}catch{}},[a]),g=v.useCallback(N=>{h.current=N,N==="openrouter"&&y()},[y]),j=v.useCallback(()=>{x.current=0,m()},[m]),S=v.useCallback(async(N,z)=>{(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:N,model:z})})).ok&&i(k=>k&&{...k,activeAgent:N,activeModel:z})},[]);return{status:o,catalog:r,error:p,focusAgent:g,refresh:j,activeAgentId:(r==null?void 0:r.activeAgent)??null,activeModelId:(r==null?void 0:r.activeModel)??null,setActive:S}}function Gu({variant:a,label:r,onActivate:i,installUrl:o}){function u(f){if(f.stopPropagation(),a==="cli-install"&&o){window.open(o,"_blank","noopener,noreferrer");return}i()}function p(f){(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),u(f))}return n.jsx("button",{type:"button","data-testid":`locked-cta-${a}`,onClick:u,onKeyDown:p,className:"inline-flex items-center gap-1.5 px-0 py-0 text-[11px] font-medium",style:{color:"var(--accent, var(--text-primary))",background:"transparent",border:"none",cursor:"pointer"},"aria-label":r,children:r})}function ud({unlocked:a=!1,size:r=10}){return a?n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const Eb={sectionOwn:"Own",sectionInstalled:"Installed",searchPlaceholder:"Search skills",searchShortcutHint:"Press / to search",emptyOwnHeadline:"No skills yet.",emptyOwnBody:"Run vskill new <name> to create one.",emptyInstalledHeadline:"No installed skills.",emptyInstalledBody:"Run vskill install <plugin> to add one.",emptyFilteredHeadline:"No matches in this section.",emptyFilteredBody:"Clear the search or try another query.",loadErrorHeadline:"Couldn't load skills.",loadErrorRetry:"Retry",duplicateBadge:"synced from Own",updateAvailableBadge:"Update available",countBadgeFiltered:(a,r)=>`${a} of ${r}`},Tb={appTitle:"Skill Studio",commandPaletteButtonLabel:"Open command palette",commandPaletteHint:"⌘K",themeToggleLight:"Switch to light theme",themeToggleDark:"Switch to dark theme",themeToggleAuto:"Switch to auto theme",projectPathLabel:"Project",modelLabel:"Model",healthLabel:"Health"},Rb={tabOverview:"Overview",tabVersions:"Versions",tabBenchmark:"Benchmark",emptyHeadline:"Select a skill to see details.",emptyBody:"Pick one from the sidebar.",loadErrorHeadline:a=>`Couldn't load SKILL.md for ${a}.`,loadErrorBody:"Check the file path and your workspace permissions.",openInEditor:"Open in editor",copyPath:"Copy path",copyConfigSnippet:"Copy config snippet",depNotInstalledTooltip:"Not installed",missingValue:"—",announceViewingOwn:a=>`Viewing ${a} (Own)`,announceViewingInstalled:a=>`Viewing ${a} (Installed)`,moreFields:"More fields",sourceAgent:"Source agent",noMcpDependencies:"No MCP dependencies.",filesystemGroup:"Filesystem",benchmarkGroup:"Benchmark",metadataGroup:"Frontmatter"},Ab={open:"Open",copyPath:"Copy Path",revealInEditor:"Reveal in Editor",edit:"Edit",duplicate:"Duplicate",runBenchmark:"Run Benchmark",update:"Update",uninstall:"Uninstall",retry:"Retry",editPlaceholder:"Edit lands with 0675. Open the file in your editor."},Mb={inputPlaceholder:"Type a command or search",emptyResults:"No matches. Try a different query.",groupNavigation:"Navigation",groupActions:"Actions",groupTheme:"Theme",actionSelectSkill:"Select skill",actionRunBenchmark:"Run benchmark",actionSwitchTheme:"Switch theme",actionNewSkill:"New skill",closeLabel:"Close palette"},zb={title:"Keyboard shortcuts",closeLabel:"Close shortcuts",groupNavigation:"Navigation",groupActions:"Actions",groupTheme:"Theme",search:"Focus search",moveDown:"Move selection down",moveUp:"Move selection up",openSelected:"Open selected skill",openPalette:"Open command palette",openShortcuts:"Open this cheatsheet",toggleSidebar:"Toggle sidebar",toggleTheme:"Toggle theme"},Lb={pathCopied:"Path copied.",configCopied:"Config copied.",skillDuplicated:"Skill duplicated.",benchmarkQueued:"Benchmark queued.",themeUpdated:"Theme updated.",skillUpdated:"Skill updated.",actionFailed:"Action failed. Retry or check logs.",networkError:"Network error. Check your connection.",permissionDenied:"Permission denied. Check file access.",unknownError:"Something went wrong. Retry or check logs."},Db={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},_b={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},Ob={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},Bb={triggerLabel:"Agent and model",popoverTitle:"Select agent and model",footerHint:"↑↓ navigate · Enter select · Esc close",settingsButton:"Settings",keyboardShortcut:"⌘K",noModelsYet:"No models yet.",searchPlaceholder:"Search 300+ models…",noMatches:a=>`No models match "${a}"`,clearSearch:"Clear",currentlyActive:"Currently active"},Ib={claudeCli:{name:"Claude Code",caption:"Delegates to the `claude` CLI — your existing Claude Code session handles quota.",missingBinary:"Claude Code not found. Install it: `npm install -g @anthropic-ai/claude-code`. Or choose a provider with an API key.",installCta:"Install Claude Code →",installUrl:"https://docs.claude.com/en/docs/claude-code"},anthropic:{name:"Anthropic API",caption:"Direct access via your Anthropic API key.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.claude.com/settings/keys",keyPrefix:"sk-ant-"},openrouter:{name:"OpenRouter",caption:"300+ models from every major vendor.",addKeyCta:"Add API key →",emptyCardBody:"Add your OpenRouter API key to browse 300+ models",keyIssuanceUrl:"https://openrouter.ai/settings/keys",keyPrefix:"sk-or-"},cursor:{name:"Cursor",caption:"Cursor IDE composer.",installCta:"Install Cursor →"},codexCli:{name:"Codex CLI",caption:"OpenAI Codex CLI.",installCta:"Install Codex CLI →"},geminiCli:{name:"Gemini CLI",caption:"Google Gemini CLI.",installCta:"Install Gemini CLI →"},copilot:{name:"GitHub Copilot",caption:"GitHub Copilot CLI.",installCta:"Install Copilot →"},zed:{name:"Zed",caption:"Zed editor.",installCta:"Install Zed →"},ollama:{name:"Ollama",caption:"Local models, free.",startServiceCta:"Start service →"},lmStudio:{name:"LM Studio",caption:"Local models, free.",startServiceCta:"Start service →"}},Hb={subscriptionBilling:"· subscription",free:"· free"},Ub={title:"Settings",sectionApiKeys:"API Keys",sectionStorage:"Storage",banner:"Keys are stored locally on this device only. Never synced, never committed to git, never transmitted off-device except to the provider's own API.",storageBrowser:"Browser storage (default)",storageKeychain:"macOS Keychain (recommended)",storageDarwinOnly:"macOS Keychain is only available on macOS",show:"Show",hide:"Hide",paste:"Paste",save:"Save",remove:"Remove",removeConfirm:a=>`Remove ${a} API key?`,keyStoredAt:a=>`Key stored locally — updated ${a}`,noKey:"No key stored",enterNonEmpty:"Enter a non-empty key",prefixWarn:a=>`This doesn't look like a typical ${a} key. Save anyway?`,keySaved:a=>`${a} API key saved (local only, never synced)`,keyRemoved:a=>`${a} API key removed`},Vb={providersLabel:"Providers",providerSummary:(a,r)=>`${a}/${r} providers`,locked:a=>`${a} — locked. Click to add a key.`,lockedCli:a=>`${a} — locked. Click for install instructions.`,unlocked:a=>`${a} — unlocked.`},$b={triggerAriaLabel:"Choose active agent for the sidebar",popoverTitle:"Choose active agent",statsInstalled:"Installed",statsGlobal:"Global",statsLastSync:"Last sync",statsHealthOk:"Fresh",statsHealthStale:"Updates available",statsHealthMissing:"Not detected",switchCta:"Switch for this studio session",notDetectedSubheading:"Not detected",setUpCta:a=>`Set up ${a}`,sharedFolderBanner:a=>`Shared folder — consumed by ${a}`},Gb={ownLabel:"Own",installedLabel:"Installed",globalLabel:"Global",emptyOwn:"No authored skills — run vskill new.",emptyInstalled:a=>`No skills installed for ${a} in this project — run vskill install.`,emptyGlobal:a=>`No global skills for ${a} — run vskill install --global.`},Pb={compactLabel:"Covered by Max/Pro · overflow billed at API rates",tooltip:"Your Claude Code CLI usage runs under your Pro/Max subscription quota. If you've enabled extra usage in your account settings, excess usage continues at standard API rates. Run /usage in Claude Code or visit claude.com Settings → Usage to see remaining quota — vskill can't display it directly.",firstUseBanner:"Claude Code uses your Pro/Max subscription. No API key needed — vskill just runs the official claude binary on your behalf.",learnMore:"Learn more"},qb={title:a=>`Set up ${a}`,close:"Close",copy:"Copy",copied:"Copied",requiredEnv:"Required env vars",getKey:"Get a key",installRun:"Install & run",learnMore:"Learn more",fallbackTitle:"No setup guide available",fallbackBody:"We don't ship a setup guide for this provider yet."},Yb={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},Fb={anthropic:{name:"Anthropic API",description:"Direct API access to Claude via your Anthropic API key. Pay-per-token billing.",envVars:["ANTHROPIC_API_KEY"],keyUrl:"https://platform.claude.com/settings/keys",learnMoreUrl:"https://docs.claude.com/en/docs/get-started"},openai:{name:"OpenAI",description:"Access to GPT-4, GPT-5 and the o-series reasoning models via your OpenAI API key.",envVars:["OPENAI_API_KEY"],keyUrl:"https://platform.openai.com/api-keys",learnMoreUrl:"https://platform.openai.com/docs"},openrouter:{name:"OpenRouter",description:"One API key, 300+ models from Anthropic, OpenAI, Google, Meta, and more.",envVars:["OPENROUTER_API_KEY"],keyUrl:"https://openrouter.ai/keys",learnMoreUrl:"https://openrouter.ai/docs"},gemini:{name:"Gemini",description:"Google Gemini models (2.5 Pro, Flash) via Google AI Studio. Free tier available.",envVars:["GEMINI_API_KEY"],keyUrl:"https://aistudio.google.com/apikey",learnMoreUrl:"https://ai.google.dev/gemini-api/docs"},ollama:{name:"Ollama",description:"Local models on your own machine. Zero external calls, zero cost after download.",envVars:["OLLAMA_HOST"],installCmd:"curl -fsSL https://ollama.com/install.sh | sh",startCmd:"ollama serve",pullExample:"ollama pull llama3.2",learnMoreUrl:"https://ollama.com/download"},lmStudio:{name:"LM Studio",description:"Desktop app + local server for running open models with a GUI. Compatible with the OpenAI API.",envVars:["LM_STUDIO_BASE_URL"],installCmd:"Download from https://lmstudio.ai and launch the app, then start the local server.",startCmd:"# In LM Studio: Developer → Start Server (default port 1234)",pullExample:"# In LM Studio: Discover → download any GGUF model",learnMoreUrl:"https://lmstudio.ai/docs"},claudeCode:{name:"Claude Code",description:"No API key needed if you're logged into Claude Code. vskill just runs the official claude binary on your behalf under your Pro/Max subscription.",loginHint:"If you're not logged in, run claude in your terminal and authenticate with your Pro/Max account.",learnMoreUrl:"https://docs.claude.com/en/docs/claude-code"}},J={sidebar:Eb,shell:Tb,detail:Rb,actions:Ab,palette:Mb,shortcuts:zb,toasts:Lb,connection:Db,forms:_b,errors:Ob,picker:Bb,providers:Ib,models:Hb,settings:Ub,statusBar:Vb,scopePicker:$b,scopeSection:Gb,claudeCodeLabel:Pb,setupDrawer:qb,setupProviders:Fb,scopeLabels:Yb},ex=new Set(["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function Wb({agents:a,activeAgentId:r,focusedAgentId:i,onFocus:o,onSelect:u,onOpenSettings:p}){const f=a.filter(x=>ex.has(x.id)),h=a.filter(x=>!ex.has(x.id));return n.jsxs("div",{role:"listbox","aria-label":"Agent","data-testid":"agent-list",style:{width:240,borderRight:"1px solid var(--border-default, var(--border-subtle))",display:"flex",flexDirection:"column",overflowY:"auto"},children:[f.map(x=>n.jsx(tx,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:u,onOpenSettings:p},x.id)),h.length>0&&n.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),h.map(x=>n.jsx(tx,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:u,onOpenSettings:p},x.id))]})}function tx({agent:a,isActive:r,isFocused:i,onFocus:o,onSelect:u,onOpenSettings:p}){const{providers:f}=J,h={"claude-cli":f.claudeCli.caption,anthropic:f.anthropic.caption,openrouter:f.openrouter.caption},x={"claude-cli":{label:f.claudeCli.installCta,url:f.claudeCli.installUrl},cursor:{label:f.cursor.installCta},"codex-cli":{label:f.codexCli.installCta},"gemini-cli":{label:f.geminiCli.installCta},copilot:{label:f.copilot.installCta},zed:{label:f.zed.installCta}},m=a.id==="claude-cli"||a.id==="claude-code",y={minHeight:36,height:m?"auto":36,padding:m?"6px 12px":"0 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",position:"relative",background:i?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:r?500:400,color:"var(--text-primary)"};return r&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),n.jsxs("div",{role:"option","aria-selected":r,"data-testid":`agent-row-${a.id}`,"data-focused":i||void 0,tabIndex:i?0:-1,onMouseEnter:()=>o(a.id),onFocus:()=>o(a.id),onClick:()=>u(a.id),style:y,children:[a.wrapperFolder&&n.jsx("span",{"data-testid":`wrapper-dot-${a.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:a.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:a.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!a.wrapperFolder&&n.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),n.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.displayName}),(a.id==="claude-cli"||a.id==="claude-code")&&n.jsx("span",{"data-testid":"claude-code-billing-label",title:J.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:J.claudeCodeLabel.compactLabel})]}),n.jsx("span",{"aria-label":a.available?"available":"locked",style:{color:a.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:a.available?n.jsx(ud,{unlocked:!0,size:10}):n.jsx(ud,{size:10})}),r&&n.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${a.id}`,children:J.picker.currentlyActive}),!a.available&&a.ctaType==="api-key"&&n.jsx(Gu,{variant:"api-key",label:a.id==="anthropic"?f.anthropic.addKeyCta:f.openrouter.addKeyCta,onActivate:()=>p(a.id)}),!a.available&&a.ctaType==="cli-install"&&x[a.id]&&n.jsx(Gu,{variant:"cli-install",label:x[a.id].label,installUrl:x[a.id].url,onActivate:()=>{}}),!a.available&&a.ctaType==="start-service"&&n.jsx(Gu,{variant:"start-service",label:a.id==="ollama"?f.ollama.startServiceCta:f.lmStudio.startServiceCta,onActivate:()=>p(a.id)}),h[a.id]&&n.jsx("span",{className:"sr-only","data-testid":`caption-${a.id}`,children:h[a.id]})]})}function Kb(a,r,i,o){const f=a>=80,h=v.useRef(null),[x,m]=v.useState(0),y=v.useCallback(S=>{m(S.currentTarget.scrollTop)},[]),{visibleStart:g,visibleEnd:j}=v.useMemo(()=>{if(!f)return{visibleStart:0,visibleEnd:a};const S=Math.max(0,Math.floor(x/r)-4),N=Math.ceil(i/r)+8,z=Math.min(a,S+N);return{visibleStart:S,visibleEnd:z}},[f,x,r,i,a,4]);return{visibleStart:g,visibleEnd:j,totalHeight:a*r,offsetTop:g*r,virtualised:f,containerProps:{onScroll:y,ref:h,style:{overflowY:"auto",maxHeight:i,willChange:f?"transform":void 0}}}}const pv=44,Xb=352,Qb=60;function Zb(a){var p,f;const r=a.contextWindow?a.contextWindow>=1e6?`${Math.round(a.contextWindow/1e6)}M`:a.contextWindow>=1e3?`${Math.round(a.contextWindow/1e3)}k`:String(a.contextWindow):null;if(a.billingMode==="subscription")return r?`${r} ctx ${J.models.subscriptionBilling}`:J.models.subscriptionBilling.trim();if(a.billingMode==="free")return r?`local · ${r} ctx · free`:"local · free";const i=((p=a.pricing)==null?void 0:p.prompt)??0,o=((f=a.pricing)==null?void 0:f.completion)??0,u=`$${i.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return r?`${r} ctx · ${u}`:u}function Jb(a,r){if(!r)return a;const i=r.toLowerCase();return a.filter(u=>u.displayName.toLowerCase().includes(i)).sort((u,p)=>{const f=u.displayName.toLowerCase().indexOf(i),h=p.displayName.toLowerCase().indexOf(i);return f!==h?f-h:u.displayName.length-p.displayName.length})}function e0({agent:a,activeModelId:r,onSelect:i,onOpenSettings:o}){const[u,p]=v.useState(""),[f,h]=v.useState(""),x=v.useRef(null);if(v.useEffect(()=>{const g=setTimeout(()=>h(u),Qb);return()=>clearTimeout(g)},[u]),v.useEffect(()=>{a.id==="openrouter"&&a.available&&x.current&&x.current.focus()},[a.id,a.available]),a.id==="openrouter"&&!a.available)return n.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:360,padding:20,display:"flex",flexDirection:"column",gap:12},children:[n.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:J.providers.openrouter.emptyCardBody}),n.jsx("button",{type:"button",onClick:()=>o("openrouter"),style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:6,background:"var(--accent, var(--color-accent))",color:"var(--bg-surface, white)",border:"none",fontSize:12,fontWeight:500,cursor:"pointer"},children:J.providers.openrouter.addKeyCta})]});const m=v.useMemo(()=>Jb(a.models,f),[a.models,f]),y=Kb(m.length,pv,Xb);return n.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:360,display:"flex",flexDirection:"column"},children:[a.id==="openrouter"&&n.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:n.jsx("input",{ref:x,type:"text",placeholder:J.picker.searchPlaceholder,value:u,onChange:g=>p(g.target.value),"data-testid":"model-search-input","aria-label":J.picker.searchPlaceholder,style:{width:"100%",padding:"6px 8px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"}})}),m.length===0&&f?n.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[n.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:J.picker.noMatches(f)}),n.jsx("button",{type:"button",onClick:()=>p(""),style:{padding:"4px 8px",background:"transparent",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:J.picker.clearSearch})]}):m.length===0?n.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:J.picker.noModelsYet}):n.jsx("div",{...y.containerProps,children:n.jsx("div",{style:{height:y.virtualised?y.totalHeight:"auto",position:"relative"},children:n.jsx("div",{style:{transform:y.virtualised?`translateY(${y.offsetTop}px)`:void 0},children:m.slice(y.visibleStart,y.visibleEnd).map(g=>n.jsx(t0,{model:g,isActive:g.id===r,onSelect:()=>i(g.id)},g.id))})})})]})}function t0({model:a,isActive:r,onSelect:i}){const o=Zb(a);return n.jsxs("button",{type:"button",role:"option","aria-selected":r,"data-testid":`model-row-${a.id}`,onClick:i,title:a.id,style:{width:"100%",height:pv,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:r?"color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",textAlign:"left"},children:[n.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:o})]})}const nx={anthropic:{stored:!1,updatedAt:null,tier:"browser"},openrouter:{stored:!1,updatedAt:null,tier:"browser"}};function n0(){const[a,r]=v.useState(null),[i,o]=v.useState(!0),[u,p]=v.useState(null),f=v.useCallback(async()=>{o(!0);try{const m=await fetch("/api/settings/keys");if(!m.ok)throw new Error(`GET /api/settings/keys returned ${m.status}`);const y=await m.json();r({...nx,...y}),p(null)}catch(m){p(m.message),r(nx)}finally{o(!1)}},[]);v.useEffect(()=>{f()},[f]);const h=v.useCallback(async(m,y,g="browser")=>{const j=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:m,key:y,tier:g})});if(!j.ok){const N=await j.json().catch(()=>({error:j.statusText}));throw new Error(N.error||`POST /api/settings/keys returned ${j.status}`)}const S=await j.json();return await f(),S},[f]),x=v.useCallback(async m=>{const y=await fetch(`/api/settings/keys/${m}`,{method:"DELETE"});if(!y.ok)throw new Error(`DELETE /api/settings/keys/${m} returned ${y.status}`);await f()},[f]);return{state:a,loading:i,error:u,save:h,remove:x,refresh:f}}const a0=[{id:"anthropic",name:J.providers.anthropic.name,keyIssuanceUrl:J.providers.anthropic.keyIssuanceUrl,prefix:J.providers.anthropic.keyPrefix},{id:"openrouter",name:J.providers.openrouter.name,keyIssuanceUrl:J.providers.openrouter.keyIssuanceUrl,prefix:J.providers.openrouter.keyPrefix}];function l0(){return typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform)}function r0(a){const r=Date.now()-new Date(a).getTime();return r<6e4?"just now":r<36e5?`${Math.round(r/6e4)}m ago`:r<864e5?`${Math.round(r/36e5)}h ago`:new Date(a).toLocaleString()}function s0({open:a,onClose:r,initialProvider:i,onToast:o}){const{state:u,save:p,remove:f}=n0(),[h,x]=v.useState("browser"),m=v.useRef(null),y=v.useRef(null),[g,j]=v.useState(i??"anthropic");if(v.useEffect(()=>{if(!a)return;const N=document.activeElement,z=setTimeout(()=>{var M;const T=i?`input[data-provider="${i}"]`:"input[data-provider]",k=(M=m.current)==null?void 0:M.querySelector(T);k==null||k.focus()},0);return()=>{var T;clearTimeout(z),(T=N==null?void 0:N.focus)==null||T.call(N)}},[a,i]),v.useEffect(()=>{if(!a)return;const N=z=>{if(z.key==="Escape"){z.preventDefault(),r();return}if(z.key==="Tab"&&m.current){const T=m.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(T.length===0)return;const k=T[0],M=T[T.length-1];z.shiftKey&&document.activeElement===k?(z.preventDefault(),M.focus()):!z.shiftKey&&document.activeElement===M&&(z.preventDefault(),k.focus())}};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[a,r]),!a)return null;const S=l0();return n.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title","data-testid":"settings-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, black 40%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:N=>{N.target===N.currentTarget&&r()},children:n.jsxs("div",{ref:m,style:{background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,width:560,maxHeight:"80vh",overflowY:"auto",padding:20,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",color:"var(--text-primary)"},onClick:N=>N.stopPropagation(),children:[n.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:J.settings.title}),n.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:J.settings.banner}),n.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[n.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionApiKeys}),a0.map(N=>n.jsx(i0,{providerId:N.id,providerName:N.name,keyIssuanceUrl:N.keyIssuanceUrl,prefix:N.prefix,metadata:u==null?void 0:u[N.id],tier:h,onSave:async z=>{const T=await p(N.id,z,h);return o==null||o(J.settings.keySaved(N.name)),T},onRemove:async()=>{await f(N.id),o==null||o(J.settings.keyRemoved(N.name))},inputRef:N.id===(i??"anthropic")?y:void 0},N.id))]}),n.jsxs("section",{"aria-labelledby":"settings-storage-title",children:[n.jsx("h3",{id:"settings-storage-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionStorage}),S?n.jsxs("fieldset",{style:{border:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:6},children:[n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"browser",checked:h==="browser",onChange:()=>x("browser")}),J.settings.storageBrowser]}),n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"keychain",checked:h==="keychain",onChange:()=>x("keychain")}),J.settings.storageKeychain]})]}):n.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, var(--text-tertiary))"},children:[J.settings.storageBrowser,n.jsxs("span",{title:J.settings.storageDarwinOnly,style:{marginLeft:8},children:["(",J.settings.storageDarwinOnly,")"]})]})]}),n.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:n.jsx("button",{type:"button",onClick:r,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})})}function i0({providerId:a,providerName:r,keyIssuanceUrl:i,prefix:o,metadata:u,onSave:p,onRemove:f,inputRef:h}){const[x,m]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState(!1),[N,z]=v.useState(!1),[T,k]=v.useState(null),M=x.trim(),O=M.length===0,V=M.length>0&&!M.startsWith(o),A=v.useCallback(async()=>{if(!O){S(!0);try{const L=await p(M);L.warning?k(L.warning):k(null),m("")}finally{S(!1)}}},[O,p,M]),U=v.useCallback(async()=>{var L;try{if(!((L=navigator.clipboard)!=null&&L.readText))return;const R=await navigator.clipboard.readText();m(R)}catch{}},[]),w=v.useCallback(async()=>{z(!1),await f()},[f]);return n.jsxs("div",{"data-testid":`provider-row-${a}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n.jsx("strong",{style:{fontSize:13},children:r}),n.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),n.jsxs("div",{style:{display:"flex",gap:6},children:[n.jsx("input",{ref:h,type:y?"text":"password",value:x,onChange:L=>{m(L.target.value),k(null)},"data-provider":a,placeholder:`Paste ${r} key`,style:{flex:1,padding:"6px 8px",border:"1px solid var(--border-subtle)",borderRadius:4,background:"var(--surface-2, var(--bg-surface))",color:"var(--text-primary)",fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"}}),n.jsx("button",{type:"button",onClick:()=>g(!y),style:ir,children:y?J.settings.hide:J.settings.show}),n.jsx("button",{type:"button",onClick:U,style:ir,children:J.settings.paste})]}),O&&x.length>0&&n.jsx("div",{role:"status",style:o0,children:J.settings.enterNonEmpty}),V&&n.jsx("div",{role:"status","data-testid":`prefix-warn-${a}`,style:ax,children:J.settings.prefixWarn(r)}),T&&n.jsx("div",{role:"status",style:ax,children:T}),n.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[n.jsx("button",{type:"button",onClick:A,disabled:O||j,"data-testid":`save-${a}`,style:{...ir,background:O?"var(--surface-2)":"var(--accent, var(--color-accent))",color:O?"var(--text-muted)":"white",cursor:O?"not-allowed":"pointer"},children:J.settings.save}),(u==null?void 0:u.stored)&&n.jsx(n.Fragment,{children:N?n.jsxs(n.Fragment,{children:[n.jsx("span",{style:{fontSize:12},children:J.settings.removeConfirm(r)}),n.jsx("button",{type:"button",onClick:w,"data-testid":`remove-confirm-${a}`,style:{...ir,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),n.jsx("button",{type:"button",onClick:()=>z(!1),style:ir,children:"Cancel"})]}):n.jsx("button",{type:"button",onClick:()=>z(!0),"data-testid":`remove-${a}`,style:{...ir,color:"var(--text-muted)"},children:J.settings.remove})}),n.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${a}`,children:u!=null&&u.stored&&u.updatedAt?J.settings.keyStoredAt(r0(u.updatedAt)):J.settings.noKey})]})]})}const ir={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},o0={fontSize:11,color:"var(--danger, #b33)"},ax={fontSize:11,color:"var(--warning, var(--text-muted))"};function c0(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function u0({onToast:a}){const{status:r,catalog:i,focusAgent:o,setActive:u}=Nb({onStaleCatalog:(L,R)=>{const I=Math.round(R/6e4);a==null||a(`Using cached ${L} catalog (${I} min old)`)}}),[p,f]=v.useState(!1),[h,x]=v.useState(!1),[m,y]=v.useState(),[g,j]=v.useState(null),[S,N]=v.useState("agents"),z=v.useRef(null);v.useRef(null),v.useEffect(()=>{var L;i&&!g&&j(i.activeAgent??((L=i.agents[0])==null?void 0:L.id)??null)},[i,g]);const T=(i==null?void 0:i.agents)??[],k=v.useMemo(()=>T.find(L=>L.id===g)??T[0],[T,g]),M=v.useCallback(()=>{var L;f(!0),N("agents"),j((i==null?void 0:i.activeAgent)??((L=T[0])==null?void 0:L.id)??null)},[i,T]),O=v.useCallback(()=>{var L;f(!1),(L=z.current)==null||L.focus()},[]);v.useEffect(()=>{const L=R=>{var G;if(!(R.metaKey||R.ctrlKey)||R.key.toLowerCase()!=="k")return;const I=(G=document.activeElement)==null?void 0:G.tagName;I==="INPUT"||I==="TEXTAREA"||(R.preventDefault(),f(Y=>!Y))};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[]),v.useEffect(()=>{if(!p)return;const L=I=>{if(I.key==="Escape"){I.preventDefault(),O();return}if(I.key==="ArrowDown"){I.preventDefault(),R(1);return}if(I.key==="ArrowUp"){I.preventDefault(),R(-1);return}if(I.key==="ArrowRight"&&S==="agents"){I.preventDefault(),N("models");return}if(I.key==="ArrowLeft"&&S==="models"){I.preventDefault(),N("agents");return}if(I.key==="Enter"){I.preventDefault(),S==="agents"&&k?N("models"):S==="models"&&k&&k.models[0]&&(u(k.id,k.models[0].id),O());return}};function R(I){if(S==="agents"){const G=T.findIndex(te=>te.id===g),Y=T[Math.max(0,Math.min(T.length-1,G+I))];Y&&(j(Y.id),o(Y.id))}}return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[p,S,T,g,k,O,o,u]);const V=v.useCallback(L=>{y(L==="anthropic"||L==="openrouter"?L:void 0),x(!0),f(!1)},[]),A=T.find(L=>L.id===(i==null?void 0:i.activeAgent)),U=A==null?void 0:A.models.find(L=>L.id===(i==null?void 0:i.activeModel)),w=v.useMemo(()=>{if(r!=="ready"||!i)return"Loading…";const L=(A==null?void 0:A.displayName)??"Agent",R=(U==null?void 0:U.displayName)??i.activeModel??"Model";return`${L} · ${R}`},[r,i,A,U]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:z,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>p?O():M(),"aria-haspopup":"listbox","aria-expanded":p,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:A!=null&&A.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),n.jsx("span",{children:w})]}),p&&typeof document<"u"&&mo.createPortal(n.jsxs(d0,{reducedMotion:c0(),onClickOutside:O,children:[n.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[n.jsx(Wb,{agents:T,activeAgentId:(i==null?void 0:i.activeAgent)??null,focusedAgentId:g,onFocus:L=>{j(L),o(L)},onSelect:L=>{j(L),o(L),N("models")},onOpenSettings:V}),k&&n.jsx(e0,{agent:k,activeModelId:(i==null?void 0:i.activeModel)??null,onSelect:L=>{u(k.id,L),O()},onOpenSettings:V})]}),n.jsxs("div",{style:{height:32,borderTop:"1px solid var(--border-default, var(--border-subtle))",padding:"0 12px",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},children:[n.jsx("button",{type:"button",onClick:()=>V(),"data-testid":"picker-footer-settings",style:{background:"transparent",border:"none",color:"var(--text-primary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.picker.settingsButton}),n.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:J.picker.footerHint})]})]}),document.body),n.jsx(s0,{open:h,onClose:()=>x(!1),initialProvider:m,onToast:a})]})}function d0({children:a,reducedMotion:r,onClickOutside:i}){const o=v.useRef(null);return v.useEffect(()=>{const u=p=>{o.current&&!o.current.contains(p.target)&&i()};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]),n.jsxs("div",{ref:o,"data-testid":"agent-model-picker-popover",role:"dialog","aria-label":"Select agent and model",style:{position:"fixed",top:56,left:"50%",transform:"translateX(-50%)",width:600,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,overflow:"hidden",zIndex:90,animation:r?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[a,n.jsx("style",{children:`@keyframes agentPickerFadeIn {
|
|
49
|
+
`+s.stack}}var dt=Object.prototype.hasOwnProperty,Zt=a.unstable_scheduleCallback,ct=a.unstable_cancelCallback,Vt=a.unstable_shouldYield,$t=a.unstable_requestPaint,tt=a.unstable_now,jt=a.unstable_getCurrentPriorityLevel,ve=a.unstable_ImmediatePriority,Rt=a.unstable_UserBlockingPriority,ze=a.unstable_NormalPriority,xt=a.unstable_LowPriority,Wt=a.unstable_IdlePriority,nt=a.log,Qa=a.unstable_setDisableYieldValue,Zn=null,Ct=null;function St(e){if(typeof nt=="function"&&Qa(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Zn,e)}catch{}}var bt=Math.clz32?Math.clz32:In,Bn=Math.log,Za=Math.LN2;function In(e){return e>>>=0,e===0?32:31-(Bn(e)/Za|0)|0}var Ve=256,It=262144,Jn=4194304;function Nt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function br(e,t,l){var s=e.pendingLanes;if(s===0)return 0;var c=0,d=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var C=s&134217727;return C!==0?(s=C&~d,s!==0?c=Nt(s):(b&=C,b!==0?c=Nt(b):l||(l=C&~e,l!==0&&(c=Nt(l))))):(C=s&~d,C!==0?c=Nt(C):b!==0?c=Nt(b):l||(l=s&~e,l!==0&&(c=Nt(l)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,l=t&-t,d>=l||d===32&&(l&4194048)!==0)?t:c}function wn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function So(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qd(){var e=Jn;return Jn<<=1,(Jn&62914560)===0&&(Jn=4194304),e}function ko(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function jr(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Eg(e,t,l,s,c,d){var b=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var C=e.entanglements,H=e.expirationTimes,K=e.hiddenUpdates;for(l=b&~l;0<l;){var le=31-bt(l),ie=1<<le;C[le]=0,H[le]=-1;var X=K[le];if(X!==null)for(K[le]=null,le=0;le<X.length;le++){var ee=X[le];ee!==null&&(ee.lane&=-536870913)}l&=~ie}s!==0&&Yd(e,s,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(b&~t))}function Yd(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-bt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|l&261930}function Fd(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var s=31-bt(l),c=1<<s;c&t|e[s]&t&&(e[s]|=t),l&=~c}}function Wd(e,t){var l=t&-t;return l=(l&42)!==0?1:wo(l),(l&(e.suspendedLanes|t))!==0?0:l}function wo(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Co(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Kd(){var e=B.p;return e!==0?e:(e=window.event,e===void 0?32:_h(e.type))}function Xd(e,t){var l=B.p;try{return B.p=e,t()}finally{B.p=l}}var ba=Math.random().toString(36).slice(2),Gt="__reactFiber$"+ba,ln="__reactProps$"+ba,kl="__reactContainer$"+ba,No="__reactEvents$"+ba,Tg="__reactListeners$"+ba,Rg="__reactHandles$"+ba,Qd="__reactResources$"+ba,Sr="__reactMarker$"+ba;function Eo(e){delete e[Gt],delete e[ln],delete e[No],delete e[Tg],delete e[Rg]}function wl(e){var t=e[Gt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[kl]||l[Gt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=yh(e);e!==null;){if(l=e[Gt])return l;e=yh(e)}return t}e=l,l=e.parentNode}return null}function Cl(e){if(e=e[Gt]||e[kl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function kr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Nl(e){var t=e[Qd];return t||(t=e[Qd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ht(e){e[Sr]=!0}var Zd=new Set,Jd={};function Ja(e,t){El(e,t),El(e+"Capture",t)}function El(e,t){for(Jd[e]=t,e=0;e<t.length;e++)Zd.add(t[e])}var Ag=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),ef={},tf={};function Mg(e){return dt.call(tf,e)?!0:dt.call(ef,e)?!1:Ag.test(e)?tf[e]=!0:(ef[e]=!0,!1)}function _s(e,t,l){if(Mg(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function Os(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function ea(e,t,l,s){if(s===null)e.removeAttribute(l);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+s)}}function Cn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function nf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function zg(e,t,l){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,d=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(b){l=""+b,d.call(this,b)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function To(e){if(!e._valueTracker){var t=nf(e)?"checked":"value";e._valueTracker=zg(e,t,""+e[t])}}function af(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),s="";return e&&(s=nf(e)?e.checked?"true":"false":e.value),e=s,e!==l?(t.setValue(e),!0):!1}function Bs(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Lg=/[\n"\\]/g;function Nn(e){return e.replace(Lg,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ro(e,t,l,s,c,d,b,C){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Cn(t)):e.value!==""+Cn(t)&&(e.value=""+Cn(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?Ao(e,b,Cn(t)):l!=null?Ao(e,b,Cn(l)):s!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?e.name=""+Cn(C):e.removeAttribute("name")}function lf(e,t,l,s,c,d,b,C){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||l!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){To(e);return}l=l!=null?""+Cn(l):"",t=t!=null?""+Cn(t):l,C||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=C?e.checked:!!s,e.defaultChecked=!!s,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),To(e)}function Ao(e,t,l){t==="number"&&Bs(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Tl(e,t,l,s){if(e=e.options,t){t={};for(var c=0;c<l.length;c++)t["$"+l[c]]=!0;for(l=0;l<e.length;l++)c=t.hasOwnProperty("$"+e[l].value),e[l].selected!==c&&(e[l].selected=c),c&&s&&(e[l].defaultSelected=!0)}else{for(l=""+Cn(l),t=null,c=0;c<e.length;c++){if(e[c].value===l){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function rf(e,t,l){if(t!=null&&(t=""+Cn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Cn(l):""}function sf(e,t,l,s){if(t==null){if(s!=null){if(l!=null)throw Error(o(92));if(z(s)){if(1<s.length)throw Error(o(93));s=s[0]}l=s}l==null&&(l=""),t=l}l=Cn(t),e.defaultValue=l,s=e.textContent,s===l&&s!==""&&s!==null&&(e.value=s),To(e)}function Rl(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var Dg=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function of(e,t,l){var s=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,l):typeof l!="number"||l===0||Dg.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function cf(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var s in l)!l.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var c in t)s=t[c],t.hasOwnProperty(c)&&l[c]!==s&&of(e,c,s)}else for(var d in t)t.hasOwnProperty(d)&&of(e,d,t[d])}function Mo(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var _g=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Og=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Is(e){return Og.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ta(){}var zo=null;function Lo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Al=null,Ml=null;function uf(e){var t=Cl(e);if(t&&(e=t.stateNode)){var l=e[ln]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ro(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Nn(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var s=l[t];if(s!==e&&s.form===e.form){var c=s[ln]||null;if(!c)throw Error(o(90));Ro(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<l.length;t++)s=l[t],s.form===e.form&&af(s)}break e;case"textarea":rf(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Tl(e,!!l.multiple,t,!1)}}}var Do=!1;function df(e,t,l){if(Do)return e(t,l);Do=!0;try{var s=e(t);return s}finally{if(Do=!1,(Al!==null||Ml!==null)&&(Ci(),Al&&(t=Al,e=Ml,Ml=Al=null,uf(t),e)))for(t=0;t<e.length;t++)uf(e[t])}}function wr(e,t){var l=e.stateNode;if(l===null)return null;var s=l[ln]||null;if(s===null)return null;l=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var na=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_o=!1;if(na)try{var Cr={};Object.defineProperty(Cr,"passive",{get:function(){_o=!0}}),window.addEventListener("test",Cr,Cr),window.removeEventListener("test",Cr,Cr)}catch{_o=!1}var ja=null,Oo=null,Hs=null;function ff(){if(Hs)return Hs;var e,t=Oo,l=t.length,s,c="value"in ja?ja.value:ja.textContent,d=c.length;for(e=0;e<l&&t[e]===c[e];e++);var b=l-e;for(s=1;s<=b&&t[l-s]===c[d-s];s++);return Hs=c.slice(e,1<s?1-s:void 0)}function Us(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Vs(){return!0}function pf(){return!1}function rn(e){function t(l,s,c,d,b){this._reactName=l,this._targetInst=c,this.type=s,this.nativeEvent=d,this.target=b,this.currentTarget=null;for(var C in e)e.hasOwnProperty(C)&&(l=e[C],this[C]=l?l(d):d[C]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Vs:pf,this.isPropagationStopped=pf,this}return g(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Vs)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Vs)},persist:function(){},isPersistent:Vs}),t}var el={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$s=rn(el),Nr=g({},el,{view:0,detail:0}),Bg=rn(Nr),Bo,Io,Er,Gs=g({},Nr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uo,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Er&&(Er&&e.type==="mousemove"?(Bo=e.screenX-Er.screenX,Io=e.screenY-Er.screenY):Io=Bo=0,Er=e),Bo)},movementY:function(e){return"movementY"in e?e.movementY:Io}}),mf=rn(Gs),Ig=g({},Gs,{dataTransfer:0}),Hg=rn(Ig),Ug=g({},Nr,{relatedTarget:0}),Ho=rn(Ug),Vg=g({},el,{animationName:0,elapsedTime:0,pseudoElement:0}),$g=rn(Vg),Gg=g({},el,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Pg=rn(Gg),qg=g({},el,{data:0}),hf=rn(qg),Yg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Fg={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Wg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Kg(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Wg[e])?!!t[e]:!1}function Uo(){return Kg}var Xg=g({},Nr,{key:function(e){if(e.key){var t=Yg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Us(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Fg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uo,charCode:function(e){return e.type==="keypress"?Us(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Us(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qg=rn(Xg),Zg=g({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),xf=rn(Zg),Jg=g({},Nr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uo}),ey=rn(Jg),ty=g({},el,{propertyName:0,elapsedTime:0,pseudoElement:0}),ny=rn(ty),ay=g({},Gs,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),ly=rn(ay),ry=g({},el,{newState:0,oldState:0}),sy=rn(ry),iy=[9,13,27,32],Vo=na&&"CompositionEvent"in window,Tr=null;na&&"documentMode"in document&&(Tr=document.documentMode);var oy=na&&"TextEvent"in window&&!Tr,vf=na&&(!Vo||Tr&&8<Tr&&11>=Tr),gf=" ",yf=!1;function bf(e,t){switch(e){case"keyup":return iy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var zl=!1;function cy(e,t){switch(e){case"compositionend":return jf(t);case"keypress":return t.which!==32?null:(yf=!0,gf);case"textInput":return e=t.data,e===gf&&yf?null:e;default:return null}}function uy(e,t){if(zl)return e==="compositionend"||!Vo&&bf(e,t)?(e=ff(),Hs=Oo=ja=null,zl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return vf&&t.locale!=="ko"?null:t.data;default:return null}}var dy={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Sf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!dy[e.type]:t==="textarea"}function kf(e,t,l,s){Al?Ml?Ml.push(s):Ml=[s]:Al=s,t=zi(t,"onChange"),0<t.length&&(l=new $s("onChange","change",null,l,s),e.push({event:l,listeners:t}))}var Rr=null,Ar=null;function fy(e){rh(e,0)}function Ps(e){var t=kr(e);if(af(t))return e}function wf(e,t){if(e==="change")return t}var Cf=!1;if(na){var $o;if(na){var Go="oninput"in document;if(!Go){var Nf=document.createElement("div");Nf.setAttribute("oninput","return;"),Go=typeof Nf.oninput=="function"}$o=Go}else $o=!1;Cf=$o&&(!document.documentMode||9<document.documentMode)}function Ef(){Rr&&(Rr.detachEvent("onpropertychange",Tf),Ar=Rr=null)}function Tf(e){if(e.propertyName==="value"&&Ps(Ar)){var t=[];kf(t,Ar,e,Lo(e)),df(fy,t)}}function py(e,t,l){e==="focusin"?(Ef(),Rr=t,Ar=l,Rr.attachEvent("onpropertychange",Tf)):e==="focusout"&&Ef()}function my(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ps(Ar)}function hy(e,t){if(e==="click")return Ps(t)}function xy(e,t){if(e==="input"||e==="change")return Ps(t)}function vy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fn=typeof Object.is=="function"?Object.is:vy;function Mr(e,t){if(fn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),s=Object.keys(t);if(l.length!==s.length)return!1;for(s=0;s<l.length;s++){var c=l[s];if(!dt.call(t,c)||!fn(e[c],t[c]))return!1}return!0}function Rf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Af(e,t){var l=Rf(e);e=0;for(var s;l;){if(l.nodeType===3){if(s=e+l.textContent.length,e<=t&&s>=t)return{node:l,offset:t-e};e=s}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Rf(l)}}function Mf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bs(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=Bs(e.document)}return t}function Po(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var gy=na&&"documentMode"in document&&11>=document.documentMode,Ll=null,qo=null,zr=null,Yo=!1;function Lf(e,t,l){var s=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Yo||Ll==null||Ll!==Bs(s)||(s=Ll,"selectionStart"in s&&Po(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),zr&&Mr(zr,s)||(zr=s,s=zi(qo,"onSelect"),0<s.length&&(t=new $s("onSelect","select",null,t,l),e.push({event:t,listeners:s}),t.target=Ll)))}function tl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Dl={animationend:tl("Animation","AnimationEnd"),animationiteration:tl("Animation","AnimationIteration"),animationstart:tl("Animation","AnimationStart"),transitionrun:tl("Transition","TransitionRun"),transitionstart:tl("Transition","TransitionStart"),transitioncancel:tl("Transition","TransitionCancel"),transitionend:tl("Transition","TransitionEnd")},Fo={},Df={};na&&(Df=document.createElement("div").style,"AnimationEvent"in window||(delete Dl.animationend.animation,delete Dl.animationiteration.animation,delete Dl.animationstart.animation),"TransitionEvent"in window||delete Dl.transitionend.transition);function nl(e){if(Fo[e])return Fo[e];if(!Dl[e])return e;var t=Dl[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Df)return Fo[e]=t[l];return e}var _f=nl("animationend"),Of=nl("animationiteration"),Bf=nl("animationstart"),yy=nl("transitionrun"),by=nl("transitionstart"),jy=nl("transitioncancel"),If=nl("transitionend"),Hf=new Map,Wo="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Wo.push("scrollEnd");function Hn(e,t){Hf.set(e,t),Ja(t,[e])}var qs=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},En=[],_l=0,Ko=0;function Ys(){for(var e=_l,t=Ko=_l=0;t<e;){var l=En[t];En[t++]=null;var s=En[t];En[t++]=null;var c=En[t];En[t++]=null;var d=En[t];if(En[t++]=null,s!==null&&c!==null){var b=s.pending;b===null?c.next=c:(c.next=b.next,b.next=c),s.pending=c}d!==0&&Uf(l,c,d)}}function Fs(e,t,l,s){En[_l++]=e,En[_l++]=t,En[_l++]=l,En[_l++]=s,Ko|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Xo(e,t,l,s){return Fs(e,t,l,s),Ws(e)}function al(e,t){return Fs(e,null,null,t),Ws(e)}function Uf(e,t,l){e.lanes|=l;var s=e.alternate;s!==null&&(s.lanes|=l);for(var c=!1,d=e.return;d!==null;)d.childLanes|=l,s=d.alternate,s!==null&&(s.childLanes|=l),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-bt(l),e=d.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=l|536870912),d):null}function Ws(e){if(50<es)throw es=0,ru=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ol={};function Sy(e,t,l,s){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pn(e,t,l,s){return new Sy(e,t,l,s)}function Qo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function aa(e,t){var l=e.alternate;return l===null?(l=pn(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Vf(e,t){e.flags&=65011714;var l=e.alternate;return l===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ks(e,t,l,s,c,d){var b=0;if(s=e,typeof e=="function")Qo(e)&&(b=1);else if(typeof e=="string")b=E1(e,l,fe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case R:return e=pn(31,l,t,c),e.elementType=R,e.lanes=d,e;case L:return ll(l.children,c,d,t);case T:b=8,c|=24;break;case k:return e=pn(12,l,t,c|2),e.elementType=k,e.lanes=d,e;case A:return e=pn(13,l,t,c),e.elementType=A,e.lanes=d,e;case U:return e=pn(19,l,t,c),e.elementType=U,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O:b=10;break e;case M:b=9;break e;case V:b=11;break e;case w:b=14;break e;case D:b=16,s=null;break e}b=29,l=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=pn(b,l,t,c),t.elementType=e,t.type=s,t.lanes=d,t}function ll(e,t,l,s){return e=pn(7,e,s,t),e.lanes=l,e}function Zo(e,t,l){return e=pn(6,e,null,t),e.lanes=l,e}function $f(e){var t=pn(18,null,null,0);return t.stateNode=e,t}function Jo(e,t,l){return t=pn(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Gf=new WeakMap;function Tn(e,t){if(typeof e=="object"&&e!==null){var l=Gf.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Me(t)},Gf.set(e,t),t)}return{value:e,source:t,stack:Me(t)}}var Bl=[],Il=0,Xs=null,Lr=0,Rn=[],An=0,Sa=null,Pn=1,qn="";function la(e,t){Bl[Il++]=Lr,Bl[Il++]=Xs,Xs=e,Lr=t}function Pf(e,t,l){Rn[An++]=Pn,Rn[An++]=qn,Rn[An++]=Sa,Sa=e;var s=Pn;e=qn;var c=32-bt(s)-1;s&=~(1<<c),l+=1;var d=32-bt(t)+c;if(30<d){var b=c-c%5;d=(s&(1<<b)-1).toString(32),s>>=b,c-=b,Pn=1<<32-bt(t)+c|l<<c|s,qn=d+e}else Pn=1<<d|l<<c|s,qn=e}function ec(e){e.return!==null&&(la(e,1),Pf(e,1,0))}function tc(e){for(;e===Xs;)Xs=Bl[--Il],Bl[Il]=null,Lr=Bl[--Il],Bl[Il]=null;for(;e===Sa;)Sa=Rn[--An],Rn[An]=null,qn=Rn[--An],Rn[An]=null,Pn=Rn[--An],Rn[An]=null}function qf(e,t){Rn[An++]=Pn,Rn[An++]=qn,Rn[An++]=Sa,Pn=t.id,qn=t.overflow,Sa=e}var Pt=null,ft=null,We=!1,ka=null,Mn=!1,nc=Error(o(519));function wa(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Dr(Tn(t,e)),nc}function Yf(e){var t=e.stateNode,l=e.type,s=e.memoizedProps;switch(t[Gt]=e,t[ln]=s,l){case"dialog":qe("cancel",t),qe("close",t);break;case"iframe":case"object":case"embed":qe("load",t);break;case"video":case"audio":for(l=0;l<ns.length;l++)qe(ns[l],t);break;case"source":qe("error",t);break;case"img":case"image":case"link":qe("error",t),qe("load",t);break;case"details":qe("toggle",t);break;case"input":qe("invalid",t),lf(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":qe("invalid",t);break;case"textarea":qe("invalid",t),sf(t,s.value,s.defaultValue,s.children)}l=s.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||s.suppressHydrationWarning===!0||ch(t.textContent,l)?(s.popover!=null&&(qe("beforetoggle",t),qe("toggle",t)),s.onScroll!=null&&qe("scroll",t),s.onScrollEnd!=null&&qe("scrollend",t),s.onClick!=null&&(t.onclick=ta),t=!0):t=!1,t||wa(e,!0)}function Ff(e){for(Pt=e.return;Pt;)switch(Pt.tag){case 5:case 31:case 13:Mn=!1;return;case 27:case 3:Mn=!0;return;default:Pt=Pt.return}}function Hl(e){if(e!==Pt)return!1;if(!We)return Ff(e),We=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||bu(e.type,e.memoizedProps)),l=!l),l&&ft&&wa(e),Ff(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=gh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=gh(e)}else t===27?(t=ft,Ia(e.type)?(e=Cu,Cu=null,ft=e):ft=t):ft=Pt?Ln(e.stateNode.nextSibling):null;return!0}function rl(){ft=Pt=null,We=!1}function ac(){var e=ka;return e!==null&&(un===null?un=e:un.push.apply(un,e),ka=null),e}function Dr(e){ka===null?ka=[e]:ka.push(e)}var lc=_(null),sl=null,ra=null;function Ca(e,t,l){oe(lc,t._currentValue),t._currentValue=l}function sa(e){e._currentValue=lc.current,W(lc)}function rc(e,t,l){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===l)break;e=e.return}}function sc(e,t,l,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var b=c.child;d=d.firstContext;e:for(;d!==null;){var C=d;d=c;for(var H=0;H<t.length;H++)if(C.context===t[H]){d.lanes|=l,C=d.alternate,C!==null&&(C.lanes|=l),rc(d.return,l,e),s||(b=null);break e}d=C.next}}else if(c.tag===18){if(b=c.return,b===null)throw Error(o(341));b.lanes|=l,d=b.alternate,d!==null&&(d.lanes|=l),rc(b,l,e),b=null}else b=c.child;if(b!==null)b.return=c;else for(b=c;b!==null;){if(b===e){b=null;break}if(c=b.sibling,c!==null){c.return=b.return,b=c;break}b=b.return}c=b}}function Ul(e,t,l,s){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var b=c.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var C=c.type;fn(c.pendingProps.value,b.value)||(e!==null?e.push(C):e=[C])}}else if(c===ke.current){if(b=c.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(is):e=[is])}c=c.return}e!==null&&sc(t,e,l,s),t.flags|=262144}function Qs(e){for(e=e.firstContext;e!==null;){if(!fn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function il(e){sl=e,ra=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function qt(e){return Wf(sl,e)}function Zs(e,t){return sl===null&&il(e),Wf(e,t)}function Wf(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},ra===null){if(e===null)throw Error(o(308));ra=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ra=ra.next=t;return l}var ky=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},wy=a.unstable_scheduleCallback,Cy=a.unstable_NormalPriority,At={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ic(){return{controller:new ky,data:new Map,refCount:0}}function _r(e){e.refCount--,e.refCount===0&&wy(Cy,function(){e.controller.abort()})}var Or=null,oc=0,Vl=0,$l=null;function Ny(e,t){if(Or===null){var l=Or=[];oc=0,Vl=du(),$l={status:"pending",value:void 0,then:function(s){l.push(s)}}}return oc++,t.then(Kf,Kf),t}function Kf(){if(--oc===0&&Or!==null){$l!==null&&($l.status="fulfilled");var e=Or;Or=null,Vl=0,$l=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ey(e,t){var l=[],s={status:"pending",value:null,reason:null,then:function(c){l.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<l.length;c++)(0,l[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<l.length;c++)(0,l[c])(void 0)}),s}var Xf=E.S;E.S=function(e,t){Lm=tt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Ny(e,t),Xf!==null&&Xf(e,t)};var ol=_(null);function cc(){var e=ol.current;return e!==null?e:ut.pooledCache}function Js(e,t){t===null?oe(ol,ol.current):oe(ol,t.pool)}function Qf(){var e=cc();return e===null?null:{parent:At._currentValue,pool:e}}var Gl=Error(o(460)),uc=Error(o(474)),ei=Error(o(542)),ti={then:function(){}};function Zf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Jf(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(ta,ta),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,tp(e),e;default:if(typeof t.status=="string")t.then(ta,ta);else{if(e=ut,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=s}},function(s){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,tp(e),e}throw ul=t,Gl}}function cl(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ul=l,Gl):l}}var ul=null;function ep(){if(ul===null)throw Error(o(459));var e=ul;return ul=null,e}function tp(e){if(e===Gl||e===ei)throw Error(o(483))}var Pl=null,Br=0;function ni(e){var t=Br;return Br+=1,Pl===null&&(Pl=[]),Jf(Pl,e,t)}function Ir(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ai(e,t){throw t.$$typeof===j?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function np(e){function t(P,$){if(e){var F=P.deletions;F===null?(P.deletions=[$],P.flags|=16):F.push($)}}function l(P,$){if(!e)return null;for(;$!==null;)t(P,$),$=$.sibling;return null}function s(P){for(var $=new Map;P!==null;)P.key!==null?$.set(P.key,P):$.set(P.index,P),P=P.sibling;return $}function c(P,$){return P=aa(P,$),P.index=0,P.sibling=null,P}function d(P,$,F){return P.index=F,e?(F=P.alternate,F!==null?(F=F.index,F<$?(P.flags|=67108866,$):F):(P.flags|=67108866,$)):(P.flags|=1048576,$)}function b(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function C(P,$,F,re){return $===null||$.tag!==6?($=Zo(F,P.mode,re),$.return=P,$):($=c($,F),$.return=P,$)}function H(P,$,F,re){var Ee=F.type;return Ee===L?le(P,$,F.props.children,re,F.key):$!==null&&($.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===D&&cl(Ee)===$.type)?($=c($,F.props),Ir($,F),$.return=P,$):($=Ks(F.type,F.key,F.props,null,P.mode,re),Ir($,F),$.return=P,$)}function K(P,$,F,re){return $===null||$.tag!==4||$.stateNode.containerInfo!==F.containerInfo||$.stateNode.implementation!==F.implementation?($=Jo(F,P.mode,re),$.return=P,$):($=c($,F.children||[]),$.return=P,$)}function le(P,$,F,re,Ee){return $===null||$.tag!==7?($=ll(F,P.mode,re,Ee),$.return=P,$):($=c($,F),$.return=P,$)}function ie(P,$,F){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=Zo(""+$,P.mode,F),$.return=P,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case S:return F=Ks($.type,$.key,$.props,null,P.mode,F),Ir(F,$),F.return=P,F;case N:return $=Jo($,P.mode,F),$.return=P,$;case D:return $=cl($),ie(P,$,F)}if(z($)||q($))return $=ll($,P.mode,F,null),$.return=P,$;if(typeof $.then=="function")return ie(P,ni($),F);if($.$$typeof===O)return ie(P,Zs(P,$),F);ai(P,$)}return null}function X(P,$,F,re){var Ee=$!==null?$.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return Ee!==null?null:C(P,$,""+F,re);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case S:return F.key===Ee?H(P,$,F,re):null;case N:return F.key===Ee?K(P,$,F,re):null;case D:return F=cl(F),X(P,$,F,re)}if(z(F)||q(F))return Ee!==null?null:le(P,$,F,re,null);if(typeof F.then=="function")return X(P,$,ni(F),re);if(F.$$typeof===O)return X(P,$,Zs(P,F),re);ai(P,F)}return null}function ee(P,$,F,re,Ee){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return P=P.get(F)||null,C($,P,""+re,Ee);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case S:return P=P.get(re.key===null?F:re.key)||null,H($,P,re,Ee);case N:return P=P.get(re.key===null?F:re.key)||null,K($,P,re,Ee);case D:return re=cl(re),ee(P,$,F,re,Ee)}if(z(re)||q(re))return P=P.get(F)||null,le($,P,re,Ee,null);if(typeof re.then=="function")return ee(P,$,F,ni(re),Ee);if(re.$$typeof===O)return ee(P,$,F,Zs($,re),Ee);ai($,re)}return null}function be(P,$,F,re){for(var Ee=null,Xe=null,Se=$,Ie=$=0,Fe=null;Se!==null&&Ie<F.length;Ie++){Se.index>Ie?(Fe=Se,Se=null):Fe=Se.sibling;var Qe=X(P,Se,F[Ie],re);if(Qe===null){Se===null&&(Se=Fe);break}e&&Se&&Qe.alternate===null&&t(P,Se),$=d(Qe,$,Ie),Xe===null?Ee=Qe:Xe.sibling=Qe,Xe=Qe,Se=Fe}if(Ie===F.length)return l(P,Se),We&&la(P,Ie),Ee;if(Se===null){for(;Ie<F.length;Ie++)Se=ie(P,F[Ie],re),Se!==null&&($=d(Se,$,Ie),Xe===null?Ee=Se:Xe.sibling=Se,Xe=Se);return We&&la(P,Ie),Ee}for(Se=s(Se);Ie<F.length;Ie++)Fe=ee(Se,P,Ie,F[Ie],re),Fe!==null&&(e&&Fe.alternate!==null&&Se.delete(Fe.key===null?Ie:Fe.key),$=d(Fe,$,Ie),Xe===null?Ee=Fe:Xe.sibling=Fe,Xe=Fe);return e&&Se.forEach(function(Ga){return t(P,Ga)}),We&&la(P,Ie),Ee}function Te(P,$,F,re){if(F==null)throw Error(o(151));for(var Ee=null,Xe=null,Se=$,Ie=$=0,Fe=null,Qe=F.next();Se!==null&&!Qe.done;Ie++,Qe=F.next()){Se.index>Ie?(Fe=Se,Se=null):Fe=Se.sibling;var Ga=X(P,Se,Qe.value,re);if(Ga===null){Se===null&&(Se=Fe);break}e&&Se&&Ga.alternate===null&&t(P,Se),$=d(Ga,$,Ie),Xe===null?Ee=Ga:Xe.sibling=Ga,Xe=Ga,Se=Fe}if(Qe.done)return l(P,Se),We&&la(P,Ie),Ee;if(Se===null){for(;!Qe.done;Ie++,Qe=F.next())Qe=ie(P,Qe.value,re),Qe!==null&&($=d(Qe,$,Ie),Xe===null?Ee=Qe:Xe.sibling=Qe,Xe=Qe);return We&&la(P,Ie),Ee}for(Se=s(Se);!Qe.done;Ie++,Qe=F.next())Qe=ee(Se,P,Ie,Qe.value,re),Qe!==null&&(e&&Qe.alternate!==null&&Se.delete(Qe.key===null?Ie:Qe.key),$=d(Qe,$,Ie),Xe===null?Ee=Qe:Xe.sibling=Qe,Xe=Qe);return e&&Se.forEach(function(I1){return t(P,I1)}),We&&la(P,Ie),Ee}function it(P,$,F,re){if(typeof F=="object"&&F!==null&&F.type===L&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case S:e:{for(var Ee=F.key;$!==null;){if($.key===Ee){if(Ee=F.type,Ee===L){if($.tag===7){l(P,$.sibling),re=c($,F.props.children),re.return=P,P=re;break e}}else if($.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===D&&cl(Ee)===$.type){l(P,$.sibling),re=c($,F.props),Ir(re,F),re.return=P,P=re;break e}l(P,$);break}else t(P,$);$=$.sibling}F.type===L?(re=ll(F.props.children,P.mode,re,F.key),re.return=P,P=re):(re=Ks(F.type,F.key,F.props,null,P.mode,re),Ir(re,F),re.return=P,P=re)}return b(P);case N:e:{for(Ee=F.key;$!==null;){if($.key===Ee)if($.tag===4&&$.stateNode.containerInfo===F.containerInfo&&$.stateNode.implementation===F.implementation){l(P,$.sibling),re=c($,F.children||[]),re.return=P,P=re;break e}else{l(P,$);break}else t(P,$);$=$.sibling}re=Jo(F,P.mode,re),re.return=P,P=re}return b(P);case D:return F=cl(F),it(P,$,F,re)}if(z(F))return be(P,$,F,re);if(q(F)){if(Ee=q(F),typeof Ee!="function")throw Error(o(150));return F=Ee.call(F),Te(P,$,F,re)}if(typeof F.then=="function")return it(P,$,ni(F),re);if(F.$$typeof===O)return it(P,$,Zs(P,F),re);ai(P,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,$!==null&&$.tag===6?(l(P,$.sibling),re=c($,F),re.return=P,P=re):(l(P,$),re=Zo(F,P.mode,re),re.return=P,P=re),b(P)):l(P,$)}return function(P,$,F,re){try{Br=0;var Ee=it(P,$,F,re);return Pl=null,Ee}catch(Se){if(Se===Gl||Se===ei)throw Se;var Xe=pn(29,Se,null,P.mode);return Xe.lanes=re,Xe.return=P,Xe}finally{}}}var dl=np(!0),ap=np(!1),Na=!1;function dc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function fc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ea(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ta(e,t,l){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Je&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=Ws(e),Uf(e,null,l),t}return Fs(e,s,t,l),Ws(e)}function Hr(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,Fd(e,l)}}function pc(e,t){var l=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,l===s)){var c=null,d=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};d===null?c=d=b:d=d.next=b,l=l.next}while(l!==null);d===null?c=d=t:d=d.next=t}else c=d=t;l={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:s.shared,callbacks:s.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var mc=!1;function Ur(){if(mc){var e=$l;if(e!==null)throw e}}function Vr(e,t,l,s){mc=!1;var c=e.updateQueue;Na=!1;var d=c.firstBaseUpdate,b=c.lastBaseUpdate,C=c.shared.pending;if(C!==null){c.shared.pending=null;var H=C,K=H.next;H.next=null,b===null?d=K:b.next=K,b=H;var le=e.alternate;le!==null&&(le=le.updateQueue,C=le.lastBaseUpdate,C!==b&&(C===null?le.firstBaseUpdate=K:C.next=K,le.lastBaseUpdate=H))}if(d!==null){var ie=c.baseState;b=0,le=K=H=null,C=d;do{var X=C.lane&-536870913,ee=X!==C.lane;if(ee?(Ye&X)===X:(s&X)===X){X!==0&&X===Vl&&(mc=!0),le!==null&&(le=le.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var be=e,Te=C;X=t;var it=l;switch(Te.tag){case 1:if(be=Te.payload,typeof be=="function"){ie=be.call(it,ie,X);break e}ie=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Te.payload,X=typeof be=="function"?be.call(it,ie,X):be,X==null)break e;ie=g({},ie,X);break e;case 2:Na=!0}}X=C.callback,X!==null&&(e.flags|=64,ee&&(e.flags|=8192),ee=c.callbacks,ee===null?c.callbacks=[X]:ee.push(X))}else ee={lane:X,tag:C.tag,payload:C.payload,callback:C.callback,next:null},le===null?(K=le=ee,H=ie):le=le.next=ee,b|=X;if(C=C.next,C===null){if(C=c.shared.pending,C===null)break;ee=C,C=ee.next,ee.next=null,c.lastBaseUpdate=ee,c.shared.pending=null}}while(!0);le===null&&(H=ie),c.baseState=H,c.firstBaseUpdate=K,c.lastBaseUpdate=le,d===null&&(c.shared.lanes=0),La|=b,e.lanes=b,e.memoizedState=ie}}function lp(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function rp(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)lp(l[e],t)}var ql=_(null),li=_(0);function sp(e,t){e=ha,oe(li,e),oe(ql,t),ha=e|t.baseLanes}function hc(){oe(li,ha),oe(ql,ql.current)}function xc(){ha=li.current,W(ql),W(li)}var mn=_(null),zn=null;function Ra(e){var t=e.alternate;oe(Et,Et.current&1),oe(mn,e),zn===null&&(t===null||ql.current!==null||t.memoizedState!==null)&&(zn=e)}function vc(e){oe(Et,Et.current),oe(mn,e),zn===null&&(zn=e)}function ip(e){e.tag===22?(oe(Et,Et.current),oe(mn,e),zn===null&&(zn=e)):Aa()}function Aa(){oe(Et,Et.current),oe(mn,mn.current)}function hn(e){W(mn),zn===e&&(zn=null),W(Et)}var Et=_(0);function ri(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||ku(l)||wu(l)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ia=0,Be=null,rt=null,Mt=null,si=!1,Yl=!1,fl=!1,ii=0,$r=0,Fl=null,Ty=0;function kt(){throw Error(o(321))}function gc(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!fn(e[l],t[l]))return!1;return!0}function yc(e,t,l,s,c,d){return ia=d,Be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?Pp:Dc,fl=!1,d=l(s,c),fl=!1,Yl&&(d=cp(t,l,s,c)),op(e),d}function op(e){E.H=qr;var t=rt!==null&&rt.next!==null;if(ia=0,Mt=rt=Be=null,si=!1,$r=0,Fl=null,t)throw Error(o(300));e===null||zt||(e=e.dependencies,e!==null&&Qs(e)&&(zt=!0))}function cp(e,t,l,s){Be=e;var c=0;do{if(Yl&&(Fl=null),$r=0,Yl=!1,25<=c)throw Error(o(301));if(c+=1,Mt=rt=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}E.H=qp,d=t(l,s)}while(Yl);return d}function Ry(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?Gr(t):t,e=e.useState()[0],(rt!==null?rt.memoizedState:null)!==e&&(Be.flags|=1024),t}function bc(){var e=ii!==0;return ii=0,e}function jc(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Sc(e){if(si){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}si=!1}ia=0,Mt=rt=Be=null,Yl=!1,$r=ii=0,Fl=null}function Jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?Be.memoizedState=Mt=e:Mt=Mt.next=e,Mt}function Tt(){if(rt===null){var e=Be.alternate;e=e!==null?e.memoizedState:null}else e=rt.next;var t=Mt===null?Be.memoizedState:Mt.next;if(t!==null)Mt=t,rt=e;else{if(e===null)throw Be.alternate===null?Error(o(467)):Error(o(310));rt=e,e={memoizedState:rt.memoizedState,baseState:rt.baseState,baseQueue:rt.baseQueue,queue:rt.queue,next:null},Mt===null?Be.memoizedState=Mt=e:Mt=Mt.next=e}return Mt}function oi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gr(e){var t=$r;return $r+=1,Fl===null&&(Fl=[]),e=Jf(Fl,e,t),t=Be,(Mt===null?t.memoizedState:Mt.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?Pp:Dc),e}function ci(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Gr(e);if(e.$$typeof===O)return qt(e)}throw Error(o(438,String(e)))}function kc(e){var t=null,l=Be.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var s=Be.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=oi(),Be.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),s=0;s<e;s++)l[s]=I;return t.index++,l}function oa(e,t){return typeof t=="function"?t(e):t}function ui(e){var t=Tt();return wc(t,rt,e)}function wc(e,t,l){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=l;var c=e.baseQueue,d=s.pending;if(d!==null){if(c!==null){var b=c.next;c.next=d.next,d.next=b}t.baseQueue=c=d,s.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var C=b=null,H=null,K=t,le=!1;do{var ie=K.lane&-536870913;if(ie!==K.lane?(Ye&ie)===ie:(ia&ie)===ie){var X=K.revertLane;if(X===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),ie===Vl&&(le=!0);else if((ia&X)===X){K=K.next,X===Vl&&(le=!0);continue}else ie={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(C=H=ie,b=d):H=H.next=ie,Be.lanes|=X,La|=X;ie=K.action,fl&&l(d,ie),d=K.hasEagerState?K.eagerState:l(d,ie)}else X={lane:ie,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(C=H=X,b=d):H=H.next=X,Be.lanes|=ie,La|=ie;K=K.next}while(K!==null&&K!==t);if(H===null?b=d:H.next=C,!fn(d,e.memoizedState)&&(zt=!0,le&&(l=$l,l!==null)))throw l;e.memoizedState=d,e.baseState=b,e.baseQueue=H,s.lastRenderedState=d}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Cc(e){var t=Tt(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var s=l.dispatch,c=l.pending,d=t.memoizedState;if(c!==null){l.pending=null;var b=c=c.next;do d=e(d,b.action),b=b.next;while(b!==c);fn(d,t.memoizedState)||(zt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),l.lastRenderedState=d}return[d,s]}function up(e,t,l){var s=Be,c=Tt(),d=We;if(d){if(l===void 0)throw Error(o(407));l=l()}else l=t();var b=!fn((rt||c).memoizedState,l);if(b&&(c.memoizedState=l,zt=!0),c=c.queue,Tc(pp.bind(null,s,c,e),[e]),c.getSnapshot!==t||b||Mt!==null&&Mt.memoizedState.tag&1){if(s.flags|=2048,Wl(9,{destroy:void 0},fp.bind(null,s,c,l,t),null),ut===null)throw Error(o(349));d||(ia&127)!==0||dp(s,t,l)}return l}function dp(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Be.updateQueue,t===null?(t=oi(),Be.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function fp(e,t,l,s){t.value=l,t.getSnapshot=s,mp(t)&&hp(e)}function pp(e,t,l){return l(function(){mp(t)&&hp(e)})}function mp(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!fn(e,l)}catch{return!0}}function hp(e){var t=al(e,2);t!==null&&dn(t,e,2)}function Nc(e){var t=Jt();if(typeof e=="function"){var l=e;if(e=l(),fl){St(!0);try{l()}finally{St(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oa,lastRenderedState:e},t}function xp(e,t,l,s){return e.baseState=l,wc(e,rt,typeof s=="function"?s:oa)}function Ay(e,t,l,s,c){if(pi(e))throw Error(o(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){d.listeners.push(b)}};E.T!==null?l(!0):d.isTransition=!1,s(d),l=t.pending,l===null?(d.next=t.pending=d,vp(t,d)):(d.next=l.next,t.pending=l.next=d)}}function vp(e,t){var l=t.action,s=t.payload,c=e.state;if(t.isTransition){var d=E.T,b={};E.T=b;try{var C=l(c,s),H=E.S;H!==null&&H(b,C),gp(e,t,C)}catch(K){Ec(e,t,K)}finally{d!==null&&b.types!==null&&(d.types=b.types),E.T=d}}else try{d=l(c,s),gp(e,t,d)}catch(K){Ec(e,t,K)}}function gp(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(s){yp(e,t,s)},function(s){return Ec(e,t,s)}):yp(e,t,l)}function yp(e,t,l){t.status="fulfilled",t.value=l,bp(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,vp(e,l)))}function Ec(e,t,l){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=l,bp(t),t=t.next;while(t!==s)}e.action=null}function bp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function jp(e,t){return t}function Sp(e,t){if(We){var l=ut.formState;if(l!==null){e:{var s=Be;if(We){if(ft){t:{for(var c=ft,d=Mn;c.nodeType!==8;){if(!d){c=null;break t}if(c=Ln(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){ft=Ln(c.nextSibling),s=c.data==="F!";break e}}wa(s)}s=!1}s&&(t=l[0])}}return l=Jt(),l.memoizedState=l.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jp,lastRenderedState:t},l.queue=s,l=Vp.bind(null,Be,s),s.dispatch=l,s=Nc(!1),d=Lc.bind(null,Be,!1,s.queue),s=Jt(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,l=Ay.bind(null,Be,c,d,l),c.dispatch=l,s.memoizedState=e,[t,l,!1]}function kp(e){var t=Tt();return wp(t,rt,e)}function wp(e,t,l){if(t=wc(e,t,jp)[0],e=ui(oa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Gr(t)}catch(b){throw b===Gl?ei:b}else s=t;t=Tt();var c=t.queue,d=c.dispatch;return l!==t.memoizedState&&(Be.flags|=2048,Wl(9,{destroy:void 0},My.bind(null,c,l),null)),[s,d,e]}function My(e,t){e.action=t}function Cp(e){var t=Tt(),l=rt;if(l!==null)return wp(t,l,e);Tt(),t=t.memoizedState,l=Tt();var s=l.queue.dispatch;return l.memoizedState=e,[t,s,!1]}function Wl(e,t,l,s){return e={tag:e,create:l,deps:s,inst:t,next:null},t=Be.updateQueue,t===null&&(t=oi(),Be.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(s=l.next,l.next=e,e.next=s,t.lastEffect=e),e}function Np(){return Tt().memoizedState}function di(e,t,l,s){var c=Jt();Be.flags|=e,c.memoizedState=Wl(1|t,{destroy:void 0},l,s===void 0?null:s)}function fi(e,t,l,s){var c=Tt();s=s===void 0?null:s;var d=c.memoizedState.inst;rt!==null&&s!==null&&gc(s,rt.memoizedState.deps)?c.memoizedState=Wl(t,d,l,s):(Be.flags|=e,c.memoizedState=Wl(1|t,d,l,s))}function Ep(e,t){di(8390656,8,e,t)}function Tc(e,t){fi(2048,8,e,t)}function zy(e){Be.flags|=4;var t=Be.updateQueue;if(t===null)t=oi(),Be.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function Tp(e){var t=Tt().memoizedState;return zy({ref:t,nextImpl:e}),function(){if((Je&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Rp(e,t){return fi(4,2,e,t)}function Ap(e,t){return fi(4,4,e,t)}function Mp(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function zp(e,t,l){l=l!=null?l.concat([e]):null,fi(4,4,Mp.bind(null,t,e),l)}function Rc(){}function Lp(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;return t!==null&&gc(t,s[1])?s[0]:(l.memoizedState=[e,t],e)}function Dp(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;if(t!==null&&gc(t,s[1]))return s[0];if(s=e(),fl){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[s,t],s}function Ac(e,t,l){return l===void 0||(ia&1073741824)!==0&&(Ye&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=_m(),Be.lanes|=e,La|=e,l)}function _p(e,t,l,s){return fn(l,t)?l:ql.current!==null?(e=Ac(e,l,s),fn(e,t)||(zt=!0),e):(ia&42)===0||(ia&1073741824)!==0&&(Ye&261930)===0?(zt=!0,e.memoizedState=l):(e=_m(),Be.lanes|=e,La|=e,t)}function Op(e,t,l,s,c){var d=B.p;B.p=d!==0&&8>d?d:8;var b=E.T,C={};E.T=C,Lc(e,!1,t,l);try{var H=c(),K=E.S;if(K!==null&&K(C,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var le=Ey(H,s);Pr(e,t,le,gn(e))}else Pr(e,t,s,gn(e))}catch(ie){Pr(e,t,{then:function(){},status:"rejected",reason:ie},gn())}finally{B.p=d,b!==null&&C.types!==null&&(b.types=C.types),E.T=b}}function Ly(){}function Mc(e,t,l,s){if(e.tag!==5)throw Error(o(476));var c=Bp(e).queue;Op(e,c,t,ne,l===null?Ly:function(){return Ip(e),l(s)})}function Bp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:oa,lastRenderedState:ne},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:oa,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ip(e){var t=Bp(e);t.next===null&&(t=e.alternate.memoizedState),Pr(e,t.next.queue,{},gn())}function zc(){return qt(is)}function Hp(){return Tt().memoizedState}function Up(){return Tt().memoizedState}function Dy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=gn();e=Ea(l);var s=Ta(t,e,l);s!==null&&(dn(s,t,l),Hr(s,t,l)),t={cache:ic()},e.payload=t;return}t=t.return}}function _y(e,t,l){var s=gn();l={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},pi(e)?$p(t,l):(l=Xo(e,t,l,s),l!==null&&(dn(l,e,s),Gp(l,t,s)))}function Vp(e,t,l){var s=gn();Pr(e,t,l,s)}function Pr(e,t,l,s){var c={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(pi(e))$p(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var b=t.lastRenderedState,C=d(b,l);if(c.hasEagerState=!0,c.eagerState=C,fn(C,b))return Fs(e,t,c,0),ut===null&&Ys(),!1}catch{}finally{}if(l=Xo(e,t,c,s),l!==null)return dn(l,e,s),Gp(l,t,s),!0}return!1}function Lc(e,t,l,s){if(s={lane:2,revertLane:du(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},pi(e)){if(t)throw Error(o(479))}else t=Xo(e,l,s,2),t!==null&&dn(t,e,2)}function pi(e){var t=e.alternate;return e===Be||t!==null&&t===Be}function $p(e,t){Yl=si=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Gp(e,t,l){if((l&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,Fd(e,l)}}var qr={readContext:qt,use:ci,useCallback:kt,useContext:kt,useEffect:kt,useImperativeHandle:kt,useLayoutEffect:kt,useInsertionEffect:kt,useMemo:kt,useReducer:kt,useRef:kt,useState:kt,useDebugValue:kt,useDeferredValue:kt,useTransition:kt,useSyncExternalStore:kt,useId:kt,useHostTransitionStatus:kt,useFormState:kt,useActionState:kt,useOptimistic:kt,useMemoCache:kt,useCacheRefresh:kt};qr.useEffectEvent=kt;var Pp={readContext:qt,use:ci,useCallback:function(e,t){return Jt().memoizedState=[e,t===void 0?null:t],e},useContext:qt,useEffect:Ep,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,di(4194308,4,Mp.bind(null,t,e),l)},useLayoutEffect:function(e,t){return di(4194308,4,e,t)},useInsertionEffect:function(e,t){di(4,2,e,t)},useMemo:function(e,t){var l=Jt();t=t===void 0?null:t;var s=e();if(fl){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[s,t],s},useReducer:function(e,t,l){var s=Jt();if(l!==void 0){var c=l(t);if(fl){St(!0);try{l(t)}finally{St(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=_y.bind(null,Be,e),[s.memoizedState,e]},useRef:function(e){var t=Jt();return e={current:e},t.memoizedState=e},useState:function(e){e=Nc(e);var t=e.queue,l=Vp.bind(null,Be,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Rc,useDeferredValue:function(e,t){var l=Jt();return Ac(l,e,t)},useTransition:function(){var e=Nc(!1);return e=Op.bind(null,Be,e.queue,!0,!1),Jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var s=Be,c=Jt();if(We){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),ut===null)throw Error(o(349));(Ye&127)!==0||dp(s,t,l)}c.memoizedState=l;var d={value:l,getSnapshot:t};return c.queue=d,Ep(pp.bind(null,s,d,e),[e]),s.flags|=2048,Wl(9,{destroy:void 0},fp.bind(null,s,d,l,t),null),l},useId:function(){var e=Jt(),t=ut.identifierPrefix;if(We){var l=qn,s=Pn;l=(s&~(1<<32-bt(s)-1)).toString(32)+l,t="_"+t+"R_"+l,l=ii++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=Ty++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:zc,useFormState:Sp,useActionState:Sp,useOptimistic:function(e){var t=Jt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Lc.bind(null,Be,!0,l),l.dispatch=t,[e,t]},useMemoCache:kc,useCacheRefresh:function(){return Jt().memoizedState=Dy.bind(null,Be)},useEffectEvent:function(e){var t=Jt(),l={impl:e};return t.memoizedState=l,function(){if((Je&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},Dc={readContext:qt,use:ci,useCallback:Lp,useContext:qt,useEffect:Tc,useImperativeHandle:zp,useInsertionEffect:Rp,useLayoutEffect:Ap,useMemo:Dp,useReducer:ui,useRef:Np,useState:function(){return ui(oa)},useDebugValue:Rc,useDeferredValue:function(e,t){var l=Tt();return _p(l,rt.memoizedState,e,t)},useTransition:function(){var e=ui(oa)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:up,useId:Hp,useHostTransitionStatus:zc,useFormState:kp,useActionState:kp,useOptimistic:function(e,t){var l=Tt();return xp(l,rt,e,t)},useMemoCache:kc,useCacheRefresh:Up};Dc.useEffectEvent=Tp;var qp={readContext:qt,use:ci,useCallback:Lp,useContext:qt,useEffect:Tc,useImperativeHandle:zp,useInsertionEffect:Rp,useLayoutEffect:Ap,useMemo:Dp,useReducer:Cc,useRef:Np,useState:function(){return Cc(oa)},useDebugValue:Rc,useDeferredValue:function(e,t){var l=Tt();return rt===null?Ac(l,e,t):_p(l,rt.memoizedState,e,t)},useTransition:function(){var e=Cc(oa)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:up,useId:Hp,useHostTransitionStatus:zc,useFormState:Cp,useActionState:Cp,useOptimistic:function(e,t){var l=Tt();return rt!==null?xp(l,rt,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:kc,useCacheRefresh:Up};qp.useEffectEvent=Tp;function _c(e,t,l,s){t=e.memoizedState,l=l(s,t),l=l==null?t:g({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Oc={enqueueSetState:function(e,t,l){e=e._reactInternals;var s=gn(),c=Ea(s);c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(dn(t,e,s),Hr(t,e,s))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var s=gn(),c=Ea(s);c.tag=1,c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(dn(t,e,s),Hr(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=gn(),s=Ea(l);s.tag=2,t!=null&&(s.callback=t),t=Ta(e,s,l),t!==null&&(dn(t,e,l),Hr(t,e,l))}};function Yp(e,t,l,s,c,d,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,d,b):t.prototype&&t.prototype.isPureReactComponent?!Mr(l,s)||!Mr(c,d):!0}function Fp(e,t,l,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,s),t.state!==e&&Oc.enqueueReplaceState(t,t.state,null)}function pl(e,t){var l=t;if("ref"in t){l={};for(var s in t)s!=="ref"&&(l[s]=t[s])}if(e=e.defaultProps){l===t&&(l=g({},l));for(var c in e)l[c]===void 0&&(l[c]=e[c])}return l}function Wp(e){qs(e)}function Kp(e){console.error(e)}function Xp(e){qs(e)}function mi(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Qp(e,t,l){try{var s=e.onCaughtError;s(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function Bc(e,t,l){return l=Ea(l),l.tag=3,l.payload={element:null},l.callback=function(){mi(e,t)},l}function Zp(e){return e=Ea(e),e.tag=3,e}function Jp(e,t,l,s){var c=l.type.getDerivedStateFromError;if(typeof c=="function"){var d=s.value;e.payload=function(){return c(d)},e.callback=function(){Qp(t,l,s)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Qp(t,l,s),typeof c!="function"&&(Da===null?Da=new Set([this]):Da.add(this));var C=s.stack;this.componentDidCatch(s.value,{componentStack:C!==null?C:""})})}function Oy(e,t,l,s,c){if(l.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=l.alternate,t!==null&&Ul(t,l,c,!0),l=mn.current,l!==null){switch(l.tag){case 31:case 13:return zn===null?Ni():l.alternate===null&&wt===0&&(wt=3),l.flags&=-257,l.flags|=65536,l.lanes=c,s===ti?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([s]):t.add(s),ou(e,s,c)),!1;case 22:return l.flags|=65536,s===ti?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([s]):l.add(s)),ou(e,s,c)),!1}throw Error(o(435,l.tag))}return ou(e,s,c),Ni(),!1}if(We)return t=mn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==nc&&(e=Error(o(422),{cause:s}),Dr(Tn(e,l)))):(s!==nc&&(t=Error(o(423),{cause:s}),Dr(Tn(t,l))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Tn(s,l),c=Bc(e.stateNode,s,c),pc(e,c),wt!==4&&(wt=2)),!1;var d=Error(o(520),{cause:s});if(d=Tn(d,l),Jr===null?Jr=[d]:Jr.push(d),wt!==4&&(wt=2),t===null)return!0;s=Tn(s,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=c&-c,l.lanes|=e,e=Bc(l.stateNode,s,e),pc(l,e),!1;case 1:if(t=l.type,d=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(Da===null||!Da.has(d))))return l.flags|=65536,c&=-c,l.lanes|=c,c=Zp(c),Jp(c,e,l,s),pc(l,c),!1}l=l.return}while(l!==null);return!1}var Ic=Error(o(461)),zt=!1;function Yt(e,t,l,s){t.child=e===null?ap(t,null,l,s):dl(t,e.child,l,s)}function em(e,t,l,s,c){l=l.render;var d=t.ref;if("ref"in s){var b={};for(var C in s)C!=="ref"&&(b[C]=s[C])}else b=s;return il(t),s=yc(e,t,l,b,d,c),C=bc(),e!==null&&!zt?(jc(e,t,c),ca(e,t,c)):(We&&C&&ec(t),t.flags|=1,Yt(e,t,s,c),t.child)}function tm(e,t,l,s,c){if(e===null){var d=l.type;return typeof d=="function"&&!Qo(d)&&d.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=d,nm(e,t,d,s,c)):(e=Ks(l.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Yc(e,c)){var b=d.memoizedProps;if(l=l.compare,l=l!==null?l:Mr,l(b,s)&&e.ref===t.ref)return ca(e,t,c)}return t.flags|=1,e=aa(d,s),e.ref=t.ref,e.return=t,t.child=e}function nm(e,t,l,s,c){if(e!==null){var d=e.memoizedProps;if(Mr(d,s)&&e.ref===t.ref)if(zt=!1,t.pendingProps=s=d,Yc(e,c))(e.flags&131072)!==0&&(zt=!0);else return t.lanes=e.lanes,ca(e,t,c)}return Hc(e,t,l,s,c)}function am(e,t,l,s){var c=s.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|l:l,e!==null){for(s=t.child=e.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~d}else s=0,t.child=null;return lm(e,t,d,l,s)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Js(t,d!==null?d.cachePool:null),d!==null?sp(t,d):hc(),ip(t);else return s=t.lanes=536870912,lm(e,t,d!==null?d.baseLanes|l:l,l,s)}else d!==null?(Js(t,d.cachePool),sp(t,d),Aa(),t.memoizedState=null):(e!==null&&Js(t,null),hc(),Aa());return Yt(e,t,c,l),t.child}function Yr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function lm(e,t,l,s,c){var d=cc();return d=d===null?null:{parent:At._currentValue,pool:d},t.memoizedState={baseLanes:l,cachePool:d},e!==null&&Js(t,null),hc(),ip(t),e!==null&&Ul(e,t,s,!0),t.childLanes=c,null}function hi(e,t){return t=vi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function rm(e,t,l){return dl(t,e.child,null,l),e=hi(t,t.pendingProps),e.flags|=2,hn(t),t.memoizedState=null,e}function By(e,t,l){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(We){if(s.mode==="hidden")return e=hi(t,s),t.lanes=536870912,Yr(null,e);if(vc(t),(e=ft)?(e=vh(e,Mn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:Pn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=$f(e),l.return=t,t.child=l,Pt=t,ft=null)):e=null,e===null)throw wa(t);return t.lanes=536870912,null}return hi(t,s)}var d=e.memoizedState;if(d!==null){var b=d.dehydrated;if(vc(t),c)if(t.flags&256)t.flags&=-257,t=rm(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(zt||Ul(e,t,l,!1),c=(l&e.childLanes)!==0,zt||c){if(s=ut,s!==null&&(b=Wd(s,l),b!==0&&b!==d.retryLane))throw d.retryLane=b,al(e,b),dn(s,e,b),Ic;Ni(),t=rm(e,t,l)}else e=d.treeContext,ft=Ln(b.nextSibling),Pt=t,We=!0,ka=null,Mn=!1,e!==null&&qf(t,e),t=hi(t,s),t.flags|=4096;return t}return e=aa(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function xi(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Hc(e,t,l,s,c){return il(t),l=yc(e,t,l,s,void 0,c),s=bc(),e!==null&&!zt?(jc(e,t,c),ca(e,t,c)):(We&&s&&ec(t),t.flags|=1,Yt(e,t,l,c),t.child)}function sm(e,t,l,s,c,d){return il(t),t.updateQueue=null,l=cp(t,s,l,c),op(e),s=bc(),e!==null&&!zt?(jc(e,t,d),ca(e,t,d)):(We&&s&&ec(t),t.flags|=1,Yt(e,t,l,d),t.child)}function im(e,t,l,s,c){if(il(t),t.stateNode===null){var d=Ol,b=l.contextType;typeof b=="object"&&b!==null&&(d=qt(b)),d=new l(s,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Oc,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=s,d.state=t.memoizedState,d.refs={},dc(t),b=l.contextType,d.context=typeof b=="object"&&b!==null?qt(b):Ol,d.state=t.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(_c(t,l,b,s),d.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(b=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),b!==d.state&&Oc.enqueueReplaceState(d,d.state,null),Vr(t,s,d,c),Ur(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){d=t.stateNode;var C=t.memoizedProps,H=pl(l,C);d.props=H;var K=d.context,le=l.contextType;b=Ol,typeof le=="object"&&le!==null&&(b=qt(le));var ie=l.getDerivedStateFromProps;le=typeof ie=="function"||typeof d.getSnapshotBeforeUpdate=="function",C=t.pendingProps!==C,le||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(C||K!==b)&&Fp(t,d,s,b),Na=!1;var X=t.memoizedState;d.state=X,Vr(t,s,d,c),Ur(),K=t.memoizedState,C||X!==K||Na?(typeof ie=="function"&&(_c(t,l,ie,s),K=t.memoizedState),(H=Na||Yp(t,l,H,s,X,K,b))?(le||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=K),d.props=s,d.state=K,d.context=b,s=H):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{d=t.stateNode,fc(e,t),b=t.memoizedProps,le=pl(l,b),d.props=le,ie=t.pendingProps,X=d.context,K=l.contextType,H=Ol,typeof K=="object"&&K!==null&&(H=qt(K)),C=l.getDerivedStateFromProps,(K=typeof C=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b!==ie||X!==H)&&Fp(t,d,s,H),Na=!1,X=t.memoizedState,d.state=X,Vr(t,s,d,c),Ur();var ee=t.memoizedState;b!==ie||X!==ee||Na||e!==null&&e.dependencies!==null&&Qs(e.dependencies)?(typeof C=="function"&&(_c(t,l,C,s),ee=t.memoizedState),(le=Na||Yp(t,l,le,s,X,ee,H)||e!==null&&e.dependencies!==null&&Qs(e.dependencies))?(K||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(s,ee,H),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(s,ee,H)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&X===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&X===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=ee),d.props=s,d.state=ee,d.context=H,s=le):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&X===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&X===e.memoizedState||(t.flags|=1024),s=!1)}return d=s,xi(e,t),s=(t.flags&128)!==0,d||s?(d=t.stateNode,l=s&&typeof l.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&s?(t.child=dl(t,e.child,null,c),t.child=dl(t,null,l,c)):Yt(e,t,l,c),t.memoizedState=d.state,e=t.child):e=ca(e,t,c),e}function om(e,t,l,s){return rl(),t.flags|=256,Yt(e,t,l,s),t.child}var Uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vc(e){return{baseLanes:e,cachePool:Qf()}}function $c(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=vn),e}function cm(e,t,l){var s=t.pendingProps,c=!1,d=(t.flags&128)!==0,b;if((b=d)||(b=e!==null&&e.memoizedState===null?!1:(Et.current&2)!==0),b&&(c=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(We){if(c?Ra(t):Aa(),(e=ft)?(e=vh(e,Mn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:Pn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=$f(e),l.return=t,t.child=l,Pt=t,ft=null)):e=null,e===null)throw wa(t);return wu(e)?t.lanes=32:t.lanes=536870912,null}var C=s.children;return s=s.fallback,c?(Aa(),c=t.mode,C=vi({mode:"hidden",children:C},c),s=ll(s,c,l,null),C.return=t,s.return=t,C.sibling=s,t.child=C,s=t.child,s.memoizedState=Vc(l),s.childLanes=$c(e,b,l),t.memoizedState=Uc,Yr(null,s)):(Ra(t),Gc(t,C))}var H=e.memoizedState;if(H!==null&&(C=H.dehydrated,C!==null)){if(d)t.flags&256?(Ra(t),t.flags&=-257,t=Pc(e,t,l)):t.memoizedState!==null?(Aa(),t.child=e.child,t.flags|=128,t=null):(Aa(),C=s.fallback,c=t.mode,s=vi({mode:"visible",children:s.children},c),C=ll(C,c,l,null),C.flags|=2,s.return=t,C.return=t,s.sibling=C,t.child=s,dl(t,e.child,null,l),s=t.child,s.memoizedState=Vc(l),s.childLanes=$c(e,b,l),t.memoizedState=Uc,t=Yr(null,s));else if(Ra(t),wu(C)){if(b=C.nextSibling&&C.nextSibling.dataset,b)var K=b.dgst;b=K,s=Error(o(419)),s.stack="",s.digest=b,Dr({value:s,source:null,stack:null}),t=Pc(e,t,l)}else if(zt||Ul(e,t,l,!1),b=(l&e.childLanes)!==0,zt||b){if(b=ut,b!==null&&(s=Wd(b,l),s!==0&&s!==H.retryLane))throw H.retryLane=s,al(e,s),dn(b,e,s),Ic;ku(C)||Ni(),t=Pc(e,t,l)}else ku(C)?(t.flags|=192,t.child=e.child,t=null):(e=H.treeContext,ft=Ln(C.nextSibling),Pt=t,We=!0,ka=null,Mn=!1,e!==null&&qf(t,e),t=Gc(t,s.children),t.flags|=4096);return t}return c?(Aa(),C=s.fallback,c=t.mode,H=e.child,K=H.sibling,s=aa(H,{mode:"hidden",children:s.children}),s.subtreeFlags=H.subtreeFlags&65011712,K!==null?C=aa(K,C):(C=ll(C,c,l,null),C.flags|=2),C.return=t,s.return=t,s.sibling=C,t.child=s,Yr(null,s),s=t.child,C=e.child.memoizedState,C===null?C=Vc(l):(c=C.cachePool,c!==null?(H=At._currentValue,c=c.parent!==H?{parent:H,pool:H}:c):c=Qf(),C={baseLanes:C.baseLanes|l,cachePool:c}),s.memoizedState=C,s.childLanes=$c(e,b,l),t.memoizedState=Uc,Yr(e.child,s)):(Ra(t),l=e.child,e=l.sibling,l=aa(l,{mode:"visible",children:s.children}),l.return=t,l.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=l,t.memoizedState=null,l)}function Gc(e,t){return t=vi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function vi(e,t){return e=pn(22,e,null,t),e.lanes=0,e}function Pc(e,t,l){return dl(t,e.child,null,l),e=Gc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function um(e,t,l){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),rc(e.return,t,l)}function qc(e,t,l,s,c,d){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:l,tailMode:c,treeForkCount:d}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=s,b.tail=l,b.tailMode=c,b.treeForkCount=d)}function dm(e,t,l){var s=t.pendingProps,c=s.revealOrder,d=s.tail;s=s.children;var b=Et.current,C=(b&2)!==0;if(C?(b=b&1|2,t.flags|=128):b&=1,oe(Et,b),Yt(e,t,s,l),s=We?Lr:0,!C&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&um(e,l,t);else if(e.tag===19)um(e,l,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(l=t.child,c=null;l!==null;)e=l.alternate,e!==null&&ri(e)===null&&(c=l),l=l.sibling;l=c,l===null?(c=t.child,t.child=null):(c=l.sibling,l.sibling=null),qc(t,!1,c,l,d,s);break;case"backwards":case"unstable_legacy-backwards":for(l=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&ri(e)===null){t.child=c;break}e=c.sibling,c.sibling=l,l=c,c=e}qc(t,!0,l,null,d,s);break;case"together":qc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function ca(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),La|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Ul(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,l=aa(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=aa(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Yc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Qs(e)))}function Iy(e,t,l){switch(t.tag){case 3:ce(t,t.stateNode.containerInfo),Ca(t,At,e.memoizedState.cache),rl();break;case 27:case 5:Ue(t);break;case 4:ce(t,t.stateNode.containerInfo);break;case 10:Ca(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,vc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Ra(t),t.flags|=128,null):(l&t.child.childLanes)!==0?cm(e,t,l):(Ra(t),e=ca(e,t,l),e!==null?e.sibling:null);Ra(t);break;case 19:var c=(e.flags&128)!==0;if(s=(l&t.childLanes)!==0,s||(Ul(e,t,l,!1),s=(l&t.childLanes)!==0),c){if(s)return dm(e,t,l);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),oe(Et,Et.current),s)break;return null;case 22:return t.lanes=0,am(e,t,l,t.pendingProps);case 24:Ca(t,At,e.memoizedState.cache)}return ca(e,t,l)}function fm(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)zt=!0;else{if(!Yc(e,l)&&(t.flags&128)===0)return zt=!1,Iy(e,t,l);zt=(e.flags&131072)!==0}else zt=!1,We&&(t.flags&1048576)!==0&&Pf(t,Lr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=cl(t.elementType),t.type=e,typeof e=="function")Qo(e)?(s=pl(e,s),t.tag=1,t=im(null,t,e,s,l)):(t.tag=0,t=Hc(null,t,e,s,l));else{if(e!=null){var c=e.$$typeof;if(c===V){t.tag=11,t=em(null,t,e,s,l);break e}else if(c===w){t.tag=14,t=tm(null,t,e,s,l);break e}}throw t=Q(e)||e,Error(o(306,t,""))}}return t;case 0:return Hc(e,t,t.type,t.pendingProps,l);case 1:return s=t.type,c=pl(s,t.pendingProps),im(e,t,s,c,l);case 3:e:{if(ce(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var d=t.memoizedState;c=d.element,fc(e,t),Vr(t,s,null,l);var b=t.memoizedState;if(s=b.cache,Ca(t,At,s),s!==d.cache&&sc(t,[At],l,!0),Ur(),s=b.element,d.isDehydrated)if(d={element:s,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=om(e,t,s,l);break e}else if(s!==c){c=Tn(Error(o(424)),t),Dr(c),t=om(e,t,s,l);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ft=Ln(e.firstChild),Pt=t,We=!0,ka=null,Mn=!0,l=ap(t,null,s,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(rl(),s===c){t=ca(e,t,l);break e}Yt(e,t,s,l)}t=t.child}return t;case 26:return xi(e,t),e===null?(l=kh(t.type,null,t.pendingProps,null))?t.memoizedState=l:We||(l=t.type,e=t.pendingProps,s=Li(xe.current).createElement(l),s[Gt]=t,s[ln]=e,Ft(s,l,e),Ht(s),t.stateNode=s):t.memoizedState=kh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ue(t),e===null&&We&&(s=t.stateNode=bh(t.type,t.pendingProps,xe.current),Pt=t,Mn=!0,c=ft,Ia(t.type)?(Cu=c,ft=Ln(s.firstChild)):ft=c),Yt(e,t,t.pendingProps.children,l),xi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&We&&((c=s=ft)&&(s=m1(s,t.type,t.pendingProps,Mn),s!==null?(t.stateNode=s,Pt=t,ft=Ln(s.firstChild),Mn=!1,c=!0):c=!1),c||wa(t)),Ue(t),c=t.type,d=t.pendingProps,b=e!==null?e.memoizedProps:null,s=d.children,bu(c,d)?s=null:b!==null&&bu(c,b)&&(t.flags|=32),t.memoizedState!==null&&(c=yc(e,t,Ry,null,null,l),is._currentValue=c),xi(e,t),Yt(e,t,s,l),t.child;case 6:return e===null&&We&&((e=l=ft)&&(l=h1(l,t.pendingProps,Mn),l!==null?(t.stateNode=l,Pt=t,ft=null,e=!0):e=!1),e||wa(t)),null;case 13:return cm(e,t,l);case 4:return ce(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=dl(t,null,s,l):Yt(e,t,s,l),t.child;case 11:return em(e,t,t.type,t.pendingProps,l);case 7:return Yt(e,t,t.pendingProps,l),t.child;case 8:return Yt(e,t,t.pendingProps.children,l),t.child;case 12:return Yt(e,t,t.pendingProps.children,l),t.child;case 10:return s=t.pendingProps,Ca(t,t.type,s.value),Yt(e,t,s.children,l),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,il(t),c=qt(c),s=s(c),t.flags|=1,Yt(e,t,s,l),t.child;case 14:return tm(e,t,t.type,t.pendingProps,l);case 15:return nm(e,t,t.type,t.pendingProps,l);case 19:return dm(e,t,l);case 31:return By(e,t,l);case 22:return am(e,t,l,t.pendingProps);case 24:return il(t),s=qt(At),e===null?(c=cc(),c===null&&(c=ut,d=ic(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=l),c=d),t.memoizedState={parent:s,cache:c},dc(t),Ca(t,At,c)):((e.lanes&l)!==0&&(fc(e,t),Vr(t,null,null,l),Ur()),c=e.memoizedState,d=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Ca(t,At,s)):(s=d.cache,Ca(t,At,s),s!==c.cache&&sc(t,[At],l,!0))),Yt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ua(e){e.flags|=4}function Fc(e,t,l,s,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Hm())e.flags|=8192;else throw ul=ti,uc}else e.flags&=-16777217}function pm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Th(t))if(Hm())e.flags|=8192;else throw ul=ti,uc}function gi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?qd():536870912,e.lanes|=t,Zl|=t)}function Fr(e,t){if(!We)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var s=null;l!==null;)l.alternate!==null&&(s=l),l=l.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function pt(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,s=0;if(t)for(var c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags&65011712,s|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=s,e.childLanes=l,t}function Hy(e,t,l){var s=t.pendingProps;switch(tc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pt(t),null;case 1:return pt(t),null;case 3:return l=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),sa(At),je(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Hl(t)?ua(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,ac())),pt(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(ua(t),d!==null?(pt(t),pm(t,d)):(pt(t),Fc(t,c,null,s,l))):d?d!==e.memoizedState?(ua(t),pt(t),pm(t,d)):(pt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&ua(t),pt(t),Fc(t,c,e,s,l)),null;case 27:if(Le(t),l=xe.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ua(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}e=fe.current,Hl(t)?Yf(t):(e=bh(c,s,l),t.stateNode=e,ua(t))}return pt(t),null;case 5:if(Le(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ua(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}if(d=fe.current,Hl(t))Yf(t);else{var b=Li(xe.current);switch(d){case 1:d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=b.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof s.is=="string"?b.createElement("select",{is:s.is}):b.createElement("select"),s.multiple?d.multiple=!0:s.size&&(d.size=s.size);break;default:d=typeof s.is=="string"?b.createElement(c,{is:s.is}):b.createElement(c)}}d[Gt]=t,d[ln]=s;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)d.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=d;e:switch(Ft(d,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&ua(t)}}return pt(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&ua(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=xe.current,Hl(t)){if(e=t.stateNode,l=t.memoizedProps,s=null,c=Pt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[Gt]=t,e=!!(e.nodeValue===l||s!==null&&s.suppressHydrationWarning===!0||ch(e.nodeValue,l)),e||wa(t,!0)}else e=Li(e).createTextNode(s),e[Gt]=t,t.stateNode=e}return pt(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(s=Hl(t),l!==null){if(e===null){if(!s)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),e=!1}else l=ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(hn(t),t):(hn(t),null);if((t.flags&128)!==0)throw Error(o(558))}return pt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Hl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),c=!1}else c=ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(hn(t),t):(hn(t),null)}return hn(t),(t.flags&128)!==0?(t.lanes=l,t):(l=s!==null,e=e!==null&&e.memoizedState!==null,l&&(s=t.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),gi(t,t.updateQueue),pt(t),null);case 4:return je(),e===null&&hu(t.stateNode.containerInfo),pt(t),null;case 10:return sa(t.type),pt(t),null;case 19:if(W(Et),s=t.memoizedState,s===null)return pt(t),null;if(c=(t.flags&128)!==0,d=s.rendering,d===null)if(c)Fr(s,!1);else{if(wt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=ri(e),d!==null){for(t.flags|=128,Fr(s,!1),e=d.updateQueue,t.updateQueue=e,gi(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Vf(l,e),l=l.sibling;return oe(Et,Et.current&1|2),We&&la(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&tt()>ki&&(t.flags|=128,c=!0,Fr(s,!1),t.lanes=4194304)}else{if(!c)if(e=ri(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,gi(t,e),Fr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!We)return pt(t),null}else 2*tt()-s.renderingStartTime>ki&&l!==536870912&&(t.flags|=128,c=!0,Fr(s,!1),t.lanes=4194304);s.isBackwards?(d.sibling=t.child,t.child=d):(e=s.last,e!==null?e.sibling=d:t.child=d,s.last=d)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=tt(),e.sibling=null,l=Et.current,oe(Et,c?l&1|2:l&1),We&&la(t,s.treeForkCount),e):(pt(t),null);case 22:case 23:return hn(t),xc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(l&536870912)!==0&&(t.flags&128)===0&&(pt(t),t.subtreeFlags&6&&(t.flags|=8192)):pt(t),l=t.updateQueue,l!==null&&gi(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==l&&(t.flags|=2048),e!==null&&W(ol),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),sa(At),pt(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Uy(e,t){switch(tc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return sa(At),je(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Le(t),null;case 31:if(t.memoizedState!==null){if(hn(t),t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(hn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return W(Et),null;case 4:return je(),null;case 10:return sa(t.type),null;case 22:case 23:return hn(t),xc(),e!==null&&W(ol),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return sa(At),null;case 25:return null;default:return null}}function mm(e,t){switch(tc(t),t.tag){case 3:sa(At),je();break;case 26:case 27:case 5:Le(t);break;case 4:je();break;case 31:t.memoizedState!==null&&hn(t);break;case 13:hn(t);break;case 19:W(Et);break;case 10:sa(t.type);break;case 22:case 23:hn(t),xc(),e!==null&&W(ol);break;case 24:sa(At)}}function Wr(e,t){try{var l=t.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var c=s.next;l=c;do{if((l.tag&e)===e){s=void 0;var d=l.create,b=l.inst;s=d(),b.destroy=s}l=l.next}while(l!==c)}}catch(C){lt(t,t.return,C)}}function Ma(e,t,l){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var d=c.next;s=d;do{if((s.tag&e)===e){var b=s.inst,C=b.destroy;if(C!==void 0){b.destroy=void 0,c=t;var H=l,K=C;try{K()}catch(le){lt(c,H,le)}}}s=s.next}while(s!==d)}}catch(le){lt(t,t.return,le)}}function hm(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{rp(t,l)}catch(s){lt(e,e.return,s)}}}function xm(e,t,l){l.props=pl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(s){lt(e,t,s)}}function Kr(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof l=="function"?e.refCleanup=l(s):l.current=s}}catch(c){lt(e,t,c)}}function Yn(e,t){var l=e.ref,s=e.refCleanup;if(l!==null)if(typeof s=="function")try{s()}catch(c){lt(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(c){lt(e,t,c)}else l.current=null}function vm(e){var t=e.type,l=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&s.focus();break e;case"img":l.src?s.src=l.src:l.srcSet&&(s.srcset=l.srcSet)}}catch(c){lt(e,e.return,c)}}function Wc(e,t,l){try{var s=e.stateNode;o1(s,e.type,l,t),s[ln]=t}catch(c){lt(e,e.return,c)}}function gm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ia(e.type)||e.tag===4}function Kc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||gm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ia(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Xc(e,t,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=ta));else if(s!==4&&(s===27&&Ia(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Xc(e,t,l),e=e.sibling;e!==null;)Xc(e,t,l),e=e.sibling}function yi(e,t,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(s!==4&&(s===27&&Ia(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(yi(e,t,l),e=e.sibling;e!==null;)yi(e,t,l),e=e.sibling}function ym(e){var t=e.stateNode,l=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Ft(t,s,l),t[Gt]=e,t[ln]=l}catch(d){lt(e,e.return,d)}}var da=!1,Lt=!1,Qc=!1,bm=typeof WeakSet=="function"?WeakSet:Set,Ut=null;function Vy(e,t){if(e=e.containerInfo,gu=Ui,e=zf(e),Po(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var s=l.getSelection&&l.getSelection();if(s&&s.rangeCount!==0){l=s.anchorNode;var c=s.anchorOffset,d=s.focusNode;s=s.focusOffset;try{l.nodeType,d.nodeType}catch{l=null;break e}var b=0,C=-1,H=-1,K=0,le=0,ie=e,X=null;t:for(;;){for(var ee;ie!==l||c!==0&&ie.nodeType!==3||(C=b+c),ie!==d||s!==0&&ie.nodeType!==3||(H=b+s),ie.nodeType===3&&(b+=ie.nodeValue.length),(ee=ie.firstChild)!==null;)X=ie,ie=ee;for(;;){if(ie===e)break t;if(X===l&&++K===c&&(C=b),X===d&&++le===s&&(H=b),(ee=ie.nextSibling)!==null)break;ie=X,X=ie.parentNode}ie=ee}l=C===-1||H===-1?null:{start:C,end:H}}else l=null}l=l||{start:0,end:0}}else l=null;for(yu={focusedElem:e,selectionRange:l},Ui=!1,Ut=t;Ut!==null;)if(t=Ut,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ut=e;else for(;Ut!==null;){switch(t=Ut,d=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)c=e[l],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,l=t,c=d.memoizedProps,d=d.memoizedState,s=l.stateNode;try{var be=pl(l.type,c);e=s.getSnapshotBeforeUpdate(be,d),s.__reactInternalSnapshotBeforeUpdate=e}catch(Te){lt(l,l.return,Te)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Su(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Su(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,Ut=e;break}Ut=t.return}}function jm(e,t,l){var s=l.flags;switch(l.tag){case 0:case 11:case 15:pa(e,l),s&4&&Wr(5,l);break;case 1:if(pa(e,l),s&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(b){lt(l,l.return,b)}else{var c=pl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){lt(l,l.return,b)}}s&64&&hm(l),s&512&&Kr(l,l.return);break;case 3:if(pa(e,l),s&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{rp(e,t)}catch(b){lt(l,l.return,b)}}break;case 27:t===null&&s&4&&ym(l);case 26:case 5:pa(e,l),t===null&&s&4&&vm(l),s&512&&Kr(l,l.return);break;case 12:pa(e,l);break;case 31:pa(e,l),s&4&&wm(e,l);break;case 13:pa(e,l),s&4&&Cm(e,l),s&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Xy.bind(null,l),x1(e,l))));break;case 22:if(s=l.memoizedState!==null||da,!s){t=t!==null&&t.memoizedState!==null||Lt,c=da;var d=Lt;da=s,(Lt=t)&&!d?ma(e,l,(l.subtreeFlags&8772)!==0):pa(e,l),da=c,Lt=d}break;case 30:break;default:pa(e,l)}}function Sm(e){var t=e.alternate;t!==null&&(e.alternate=null,Sm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Eo(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var vt=null,sn=!1;function fa(e,t,l){for(l=l.child;l!==null;)km(e,t,l),l=l.sibling}function km(e,t,l){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(Zn,l)}catch{}switch(l.tag){case 26:Lt||Yn(l,t),fa(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Lt||Yn(l,t);var s=vt,c=sn;Ia(l.type)&&(vt=l.stateNode,sn=!1),fa(e,t,l),ls(l.stateNode),vt=s,sn=c;break;case 5:Lt||Yn(l,t);case 6:if(s=vt,c=sn,vt=null,fa(e,t,l),vt=s,sn=c,vt!==null)if(sn)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(l.stateNode)}catch(d){lt(l,t,d)}else try{vt.removeChild(l.stateNode)}catch(d){lt(l,t,d)}break;case 18:vt!==null&&(sn?(e=vt,hh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),sr(e)):hh(vt,l.stateNode));break;case 4:s=vt,c=sn,vt=l.stateNode.containerInfo,sn=!0,fa(e,t,l),vt=s,sn=c;break;case 0:case 11:case 14:case 15:Ma(2,l,t),Lt||Ma(4,l,t),fa(e,t,l);break;case 1:Lt||(Yn(l,t),s=l.stateNode,typeof s.componentWillUnmount=="function"&&xm(l,t,s)),fa(e,t,l);break;case 21:fa(e,t,l);break;case 22:Lt=(s=Lt)||l.memoizedState!==null,fa(e,t,l),Lt=s;break;default:fa(e,t,l)}}function wm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{sr(e)}catch(l){lt(t,t.return,l)}}}function Cm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{sr(e)}catch(l){lt(t,t.return,l)}}function $y(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new bm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new bm),t;default:throw Error(o(435,e.tag))}}function bi(e,t){var l=$y(e);t.forEach(function(s){if(!l.has(s)){l.add(s);var c=Qy.bind(null,e,s);s.then(c,c)}})}function on(e,t){var l=t.deletions;if(l!==null)for(var s=0;s<l.length;s++){var c=l[s],d=e,b=t,C=b;e:for(;C!==null;){switch(C.tag){case 27:if(Ia(C.type)){vt=C.stateNode,sn=!1;break e}break;case 5:vt=C.stateNode,sn=!1;break e;case 3:case 4:vt=C.stateNode.containerInfo,sn=!0;break e}C=C.return}if(vt===null)throw Error(o(160));km(d,b,c),vt=null,sn=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Nm(t,e),t=t.sibling}var Un=null;function Nm(e,t){var l=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:on(t,e),cn(e),s&4&&(Ma(3,e,e.return),Wr(3,e),Ma(5,e,e.return));break;case 1:on(t,e),cn(e),s&512&&(Lt||l===null||Yn(l,l.return)),s&64&&da&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?s:l.concat(s))));break;case 26:var c=Un;if(on(t,e),cn(e),s&512&&(Lt||l===null||Yn(l,l.return)),s&4){var d=l!==null?l.memoizedState:null;if(s=e.memoizedState,l===null)if(s===null)if(e.stateNode===null){e:{s=e.type,l=e.memoizedProps,c=c.ownerDocument||c;t:switch(s){case"title":d=c.getElementsByTagName("title")[0],(!d||d[Sr]||d[Gt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(s),c.head.insertBefore(d,c.querySelector("head > title"))),Ft(d,s,l),d[Gt]=e,Ht(d),s=d;break e;case"link":var b=Nh("link","href",c).get(s+(l.href||""));if(b){for(var C=0;C<b.length;C++)if(d=b[C],d.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&d.getAttribute("rel")===(l.rel==null?null:l.rel)&&d.getAttribute("title")===(l.title==null?null:l.title)&&d.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){b.splice(C,1);break t}}d=c.createElement(s),Ft(d,s,l),c.head.appendChild(d);break;case"meta":if(b=Nh("meta","content",c).get(s+(l.content||""))){for(C=0;C<b.length;C++)if(d=b[C],d.getAttribute("content")===(l.content==null?null:""+l.content)&&d.getAttribute("name")===(l.name==null?null:l.name)&&d.getAttribute("property")===(l.property==null?null:l.property)&&d.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&d.getAttribute("charset")===(l.charSet==null?null:l.charSet)){b.splice(C,1);break t}}d=c.createElement(s),Ft(d,s,l),c.head.appendChild(d);break;default:throw Error(o(468,s))}d[Gt]=e,Ht(d),s=d}e.stateNode=s}else Eh(c,e.type,e.stateNode);else e.stateNode=Ch(c,s,e.memoizedProps);else d!==s?(d===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):d.count--,s===null?Eh(c,e.type,e.stateNode):Ch(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,l.memoizedProps)}break;case 27:on(t,e),cn(e),s&512&&(Lt||l===null||Yn(l,l.return)),l!==null&&s&4&&Wc(e,e.memoizedProps,l.memoizedProps);break;case 5:if(on(t,e),cn(e),s&512&&(Lt||l===null||Yn(l,l.return)),e.flags&32){c=e.stateNode;try{Rl(c,"")}catch(be){lt(e,e.return,be)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Wc(e,c,l!==null?l.memoizedProps:c)),s&1024&&(Qc=!0);break;case 6:if(on(t,e),cn(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,l=e.stateNode;try{l.nodeValue=s}catch(be){lt(e,e.return,be)}}break;case 3:if(Oi=null,c=Un,Un=Di(t.containerInfo),on(t,e),Un=c,cn(e),s&4&&l!==null&&l.memoizedState.isDehydrated)try{sr(t.containerInfo)}catch(be){lt(e,e.return,be)}Qc&&(Qc=!1,Em(e));break;case 4:s=Un,Un=Di(e.stateNode.containerInfo),on(t,e),cn(e),Un=s;break;case 12:on(t,e),cn(e);break;case 31:on(t,e),cn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 13:on(t,e),cn(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Si=tt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 22:c=e.memoizedState!==null;var H=l!==null&&l.memoizedState!==null,K=da,le=Lt;if(da=K||c,Lt=le||H,on(t,e),Lt=le,da=K,cn(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(l===null||H||da||Lt||ml(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){H=l=t;try{if(d=H.stateNode,c)b=d.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{C=H.stateNode;var ie=H.memoizedProps.style,X=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;C.style.display=X==null||typeof X=="boolean"?"":(""+X).trim()}}catch(be){lt(H,H.return,be)}}}else if(t.tag===6){if(l===null){H=t;try{H.stateNode.nodeValue=c?"":H.memoizedProps}catch(be){lt(H,H.return,be)}}}else if(t.tag===18){if(l===null){H=t;try{var ee=H.stateNode;c?xh(ee,!0):xh(H.stateNode,!1)}catch(be){lt(H,H.return,be)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(l=s.retryQueue,l!==null&&(s.retryQueue=null,bi(e,l))));break;case 19:on(t,e),cn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 30:break;case 21:break;default:on(t,e),cn(e)}}function cn(e){var t=e.flags;if(t&2){try{for(var l,s=e.return;s!==null;){if(gm(s)){l=s;break}s=s.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var c=l.stateNode,d=Kc(e);yi(e,d,c);break;case 5:var b=l.stateNode;l.flags&32&&(Rl(b,""),l.flags&=-33);var C=Kc(e);yi(e,C,b);break;case 3:case 4:var H=l.stateNode.containerInfo,K=Kc(e);Xc(e,K,H);break;default:throw Error(o(161))}}catch(le){lt(e,e.return,le)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Em(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Em(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function pa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)jm(e,t.alternate,t),t=t.sibling}function ml(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ma(4,t,t.return),ml(t);break;case 1:Yn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&xm(t,t.return,l),ml(t);break;case 27:ls(t.stateNode);case 26:case 5:Yn(t,t.return),ml(t);break;case 22:t.memoizedState===null&&ml(t);break;case 30:ml(t);break;default:ml(t)}e=e.sibling}}function ma(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,d=t,b=d.flags;switch(d.tag){case 0:case 11:case 15:ma(c,d,l),Wr(4,d);break;case 1:if(ma(c,d,l),s=d,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(K){lt(s,s.return,K)}if(s=d,c=s.updateQueue,c!==null){var C=s.stateNode;try{var H=c.shared.hiddenCallbacks;if(H!==null)for(c.shared.hiddenCallbacks=null,c=0;c<H.length;c++)lp(H[c],C)}catch(K){lt(s,s.return,K)}}l&&b&64&&hm(d),Kr(d,d.return);break;case 27:ym(d);case 26:case 5:ma(c,d,l),l&&s===null&&b&4&&vm(d),Kr(d,d.return);break;case 12:ma(c,d,l);break;case 31:ma(c,d,l),l&&b&4&&wm(c,d);break;case 13:ma(c,d,l),l&&b&4&&Cm(c,d);break;case 22:d.memoizedState===null&&ma(c,d,l),Kr(d,d.return);break;case 30:break;default:ma(c,d,l)}t=t.sibling}}function Zc(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&_r(l))}function Jc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_r(e))}function Vn(e,t,l,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Tm(e,t,l,s),t=t.sibling}function Tm(e,t,l,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Vn(e,t,l,s),c&2048&&Wr(9,t);break;case 1:Vn(e,t,l,s);break;case 3:Vn(e,t,l,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_r(e)));break;case 12:if(c&2048){Vn(e,t,l,s),e=t.stateNode;try{var d=t.memoizedProps,b=d.id,C=d.onPostCommit;typeof C=="function"&&C(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(H){lt(t,t.return,H)}}else Vn(e,t,l,s);break;case 31:Vn(e,t,l,s);break;case 13:Vn(e,t,l,s);break;case 23:break;case 22:d=t.stateNode,b=t.alternate,t.memoizedState!==null?d._visibility&2?Vn(e,t,l,s):Xr(e,t):d._visibility&2?Vn(e,t,l,s):(d._visibility|=2,Kl(e,t,l,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Zc(b,t);break;case 24:Vn(e,t,l,s),c&2048&&Jc(t.alternate,t);break;default:Vn(e,t,l,s)}}function Kl(e,t,l,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,b=t,C=l,H=s,K=b.flags;switch(b.tag){case 0:case 11:case 15:Kl(d,b,C,H,c),Wr(8,b);break;case 23:break;case 22:var le=b.stateNode;b.memoizedState!==null?le._visibility&2?Kl(d,b,C,H,c):Xr(d,b):(le._visibility|=2,Kl(d,b,C,H,c)),c&&K&2048&&Zc(b.alternate,b);break;case 24:Kl(d,b,C,H,c),c&&K&2048&&Jc(b.alternate,b);break;default:Kl(d,b,C,H,c)}t=t.sibling}}function Xr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,s=t,c=s.flags;switch(s.tag){case 22:Xr(l,s),c&2048&&Zc(s.alternate,s);break;case 24:Xr(l,s),c&2048&&Jc(s.alternate,s);break;default:Xr(l,s)}t=t.sibling}}var Qr=8192;function Xl(e,t,l){if(e.subtreeFlags&Qr)for(e=e.child;e!==null;)Rm(e,t,l),e=e.sibling}function Rm(e,t,l){switch(e.tag){case 26:Xl(e,t,l),e.flags&Qr&&e.memoizedState!==null&&T1(l,Un,e.memoizedState,e.memoizedProps);break;case 5:Xl(e,t,l);break;case 3:case 4:var s=Un;Un=Di(e.stateNode.containerInfo),Xl(e,t,l),Un=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Qr,Qr=16777216,Xl(e,t,l),Qr=s):Xl(e,t,l));break;default:Xl(e,t,l)}}function Am(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Zr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];Ut=s,zm(s,e)}Am(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Mm(e),e=e.sibling}function Mm(e){switch(e.tag){case 0:case 11:case 15:Zr(e),e.flags&2048&&Ma(9,e,e.return);break;case 3:Zr(e);break;case 12:Zr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ji(e)):Zr(e);break;default:Zr(e)}}function ji(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];Ut=s,zm(s,e)}Am(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ma(8,t,t.return),ji(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,ji(t));break;default:ji(t)}e=e.sibling}}function zm(e,t){for(;Ut!==null;){var l=Ut;switch(l.tag){case 0:case 11:case 15:Ma(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var s=l.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:_r(l.memoizedState.cache)}if(s=l.child,s!==null)s.return=l,Ut=s;else e:for(l=e;Ut!==null;){s=Ut;var c=s.sibling,d=s.return;if(Sm(s),s===l){Ut=null;break e}if(c!==null){c.return=d,Ut=c;break e}Ut=d}}}var Gy={getCacheForType:function(e){var t=qt(At),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return qt(At).controller.signal}},Py=typeof WeakMap=="function"?WeakMap:Map,Je=0,ut=null,Pe=null,Ye=0,at=0,xn=null,za=!1,Ql=!1,eu=!1,ha=0,wt=0,La=0,hl=0,tu=0,vn=0,Zl=0,Jr=null,un=null,nu=!1,Si=0,Lm=0,ki=1/0,wi=null,Da=null,_t=0,_a=null,Jl=null,xa=0,au=0,lu=null,Dm=null,es=0,ru=null;function gn(){return(Je&2)!==0&&Ye!==0?Ye&-Ye:E.T!==null?du():Kd()}function _m(){if(vn===0)if((Ye&536870912)===0||We){var e=It;It<<=1,(It&3932160)===0&&(It=262144),vn=e}else vn=536870912;return e=mn.current,e!==null&&(e.flags|=32),vn}function dn(e,t,l){(e===ut&&(at===2||at===9)||e.cancelPendingCommit!==null)&&(er(e,0),Oa(e,Ye,vn,!1)),jr(e,l),((Je&2)===0||e!==ut)&&(e===ut&&((Je&2)===0&&(hl|=l),wt===4&&Oa(e,Ye,vn,!1)),Fn(e))}function Om(e,t,l){if((Je&6)!==0)throw Error(o(327));var s=!l&&(t&127)===0&&(t&e.expiredLanes)===0||wn(e,t),c=s?Fy(e,t):iu(e,t,!0),d=s;do{if(c===0){Ql&&!s&&Oa(e,t,0,!1);break}else{if(l=e.current.alternate,d&&!qy(l)){c=iu(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var C=e;c=Jr;var H=C.current.memoizedState.isDehydrated;if(H&&(er(C,b).flags|=256),b=iu(C,b,!1),b!==2){if(eu&&!H){C.errorRecoveryDisabledLanes|=d,hl|=d,c=4;break e}d=un,un=c,d!==null&&(un===null?un=d:un.push.apply(un,d))}c=b}if(d=!1,c!==2)continue}}if(c===1){er(e,0),Oa(e,t,0,!0);break}e:{switch(s=e,d=c,d){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:Oa(s,t,vn,!za);break e;case 2:un=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=Si+300-tt(),10<c)){if(Oa(s,t,vn,!za),br(s,0,!0)!==0)break e;xa=t,s.timeoutHandle=ph(Bm.bind(null,s,l,un,wi,nu,t,vn,hl,Zl,za,d,"Throttled",-0,0),c);break e}Bm(s,l,un,wi,nu,t,vn,hl,Zl,za,d,null,-0,0)}}break}while(!0);Fn(e)}function Bm(e,t,l,s,c,d,b,C,H,K,le,ie,X,ee){if(e.timeoutHandle=-1,ie=t.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ta},Rm(t,d,ie);var be=(d&62914560)===d?Si-tt():(d&4194048)===d?Lm-tt():0;if(be=R1(ie,be),be!==null){xa=d,e.cancelPendingCommit=be(qm.bind(null,e,t,d,l,s,c,b,C,H,le,ie,null,X,ee)),Oa(e,d,b,!K);return}}qm(e,t,d,l,s,c,b,C,H)}function qy(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var s=0;s<l.length;s++){var c=l[s],d=c.getSnapshot;c=c.value;try{if(!fn(d(),c))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Oa(e,t,l,s){t&=~tu,t&=~hl,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var d=31-bt(c),b=1<<d;s[d]=-1,c&=~b}l!==0&&Yd(e,l,t)}function Ci(){return(Je&6)===0?(ts(0),!1):!0}function su(){if(Pe!==null){if(at===0)var e=Pe.return;else e=Pe,ra=sl=null,Sc(e),Pl=null,Br=0,e=Pe;for(;e!==null;)mm(e.alternate,e),e=e.return;Pe=null}}function er(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,d1(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),xa=0,su(),ut=e,Pe=l=aa(e.current,null),Ye=t,at=0,xn=null,za=!1,Ql=wn(e,t),eu=!1,Zl=vn=tu=hl=La=wt=0,un=Jr=null,nu=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var c=31-bt(s),d=1<<c;t|=e[c],s&=~d}return ha=t,Ys(),l}function Im(e,t){Be=null,E.H=qr,t===Gl||t===ei?(t=ep(),at=3):t===uc?(t=ep(),at=4):at=t===Ic?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,xn=t,Pe===null&&(wt=1,mi(e,Tn(t,e.current)))}function Hm(){var e=mn.current;return e===null?!0:(Ye&4194048)===Ye?zn===null:(Ye&62914560)===Ye||(Ye&536870912)!==0?e===zn:!1}function Um(){var e=E.H;return E.H=qr,e===null?qr:e}function Vm(){var e=E.A;return E.A=Gy,e}function Ni(){wt=4,za||(Ye&4194048)!==Ye&&mn.current!==null||(Ql=!0),(La&134217727)===0&&(hl&134217727)===0||ut===null||Oa(ut,Ye,vn,!1)}function iu(e,t,l){var s=Je;Je|=2;var c=Um(),d=Vm();(ut!==e||Ye!==t)&&(wi=null,er(e,t)),t=!1;var b=wt;e:do try{if(at!==0&&Pe!==null){var C=Pe,H=xn;switch(at){case 8:su(),b=6;break e;case 3:case 2:case 9:case 6:mn.current===null&&(t=!0);var K=at;if(at=0,xn=null,tr(e,C,H,K),l&&Ql){b=0;break e}break;default:K=at,at=0,xn=null,tr(e,C,H,K)}}Yy(),b=wt;break}catch(le){Im(e,le)}while(!0);return t&&e.shellSuspendCounter++,ra=sl=null,Je=s,E.H=c,E.A=d,Pe===null&&(ut=null,Ye=0,Ys()),b}function Yy(){for(;Pe!==null;)$m(Pe)}function Fy(e,t){var l=Je;Je|=2;var s=Um(),c=Vm();ut!==e||Ye!==t?(wi=null,ki=tt()+500,er(e,t)):Ql=wn(e,t);e:do try{if(at!==0&&Pe!==null){t=Pe;var d=xn;t:switch(at){case 1:at=0,xn=null,tr(e,t,d,1);break;case 2:case 9:if(Zf(d)){at=0,xn=null,Gm(t);break}t=function(){at!==2&&at!==9||ut!==e||(at=7),Fn(e)},d.then(t,t);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:Zf(d)?(at=0,xn=null,Gm(t)):(at=0,xn=null,tr(e,t,d,7));break;case 5:var b=null;switch(Pe.tag){case 26:b=Pe.memoizedState;case 5:case 27:var C=Pe;if(b?Th(b):C.stateNode.complete){at=0,xn=null;var H=C.sibling;if(H!==null)Pe=H;else{var K=C.return;K!==null?(Pe=K,Ei(K)):Pe=null}break t}}at=0,xn=null,tr(e,t,d,5);break;case 6:at=0,xn=null,tr(e,t,d,6);break;case 8:su(),wt=6;break e;default:throw Error(o(462))}}Wy();break}catch(le){Im(e,le)}while(!0);return ra=sl=null,E.H=s,E.A=c,Je=l,Pe!==null?0:(ut=null,Ye=0,Ys(),wt)}function Wy(){for(;Pe!==null&&!Vt();)$m(Pe)}function $m(e){var t=fm(e.alternate,e,ha);e.memoizedProps=e.pendingProps,t===null?Ei(e):Pe=t}function Gm(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=sm(l,t,t.pendingProps,t.type,void 0,Ye);break;case 11:t=sm(l,t,t.pendingProps,t.type.render,t.ref,Ye);break;case 5:Sc(t);default:mm(l,t),t=Pe=Vf(t,ha),t=fm(l,t,ha)}e.memoizedProps=e.pendingProps,t===null?Ei(e):Pe=t}function tr(e,t,l,s){ra=sl=null,Sc(t),Pl=null,Br=0;var c=t.return;try{if(Oy(e,c,t,l,Ye)){wt=1,mi(e,Tn(l,e.current)),Pe=null;return}}catch(d){if(c!==null)throw Pe=c,d;wt=1,mi(e,Tn(l,e.current)),Pe=null;return}t.flags&32768?(We||s===1?e=!0:Ql||(Ye&536870912)!==0?e=!1:(za=e=!0,(s===2||s===9||s===3||s===6)&&(s=mn.current,s!==null&&s.tag===13&&(s.flags|=16384))),Pm(t,e)):Ei(t)}function Ei(e){var t=e;do{if((t.flags&32768)!==0){Pm(t,za);return}e=t.return;var l=Hy(t.alternate,t,ha);if(l!==null){Pe=l;return}if(t=t.sibling,t!==null){Pe=t;return}Pe=t=e}while(t!==null);wt===0&&(wt=5)}function Pm(e,t){do{var l=Uy(e.alternate,e);if(l!==null){l.flags&=32767,Pe=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){Pe=e;return}Pe=e=l}while(e!==null);wt=6,Pe=null}function qm(e,t,l,s,c,d,b,C,H){e.cancelPendingCommit=null;do Ti();while(_t!==0);if((Je&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(d=t.lanes|t.childLanes,d|=Ko,Eg(e,l,d,b,C,H),e===ut&&(Pe=ut=null,Ye=0),Jl=t,_a=e,xa=l,au=d,lu=c,Dm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Zy(ze,function(){return Xm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=E.T,E.T=null,c=B.p,B.p=2,b=Je,Je|=4;try{Vy(e,t,l)}finally{Je=b,B.p=c,E.T=s}}_t=1,Ym(),Fm(),Wm()}}function Ym(){if(_t===1){_t=0;var e=_a,t=Jl,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=E.T,E.T=null;var s=B.p;B.p=2;var c=Je;Je|=4;try{Nm(t,e);var d=yu,b=zf(e.containerInfo),C=d.focusedElem,H=d.selectionRange;if(b!==C&&C&&C.ownerDocument&&Mf(C.ownerDocument.documentElement,C)){if(H!==null&&Po(C)){var K=H.start,le=H.end;if(le===void 0&&(le=K),"selectionStart"in C)C.selectionStart=K,C.selectionEnd=Math.min(le,C.value.length);else{var ie=C.ownerDocument||document,X=ie&&ie.defaultView||window;if(X.getSelection){var ee=X.getSelection(),be=C.textContent.length,Te=Math.min(H.start,be),it=H.end===void 0?Te:Math.min(H.end,be);!ee.extend&&Te>it&&(b=it,it=Te,Te=b);var P=Af(C,Te),$=Af(C,it);if(P&&$&&(ee.rangeCount!==1||ee.anchorNode!==P.node||ee.anchorOffset!==P.offset||ee.focusNode!==$.node||ee.focusOffset!==$.offset)){var F=ie.createRange();F.setStart(P.node,P.offset),ee.removeAllRanges(),Te>it?(ee.addRange(F),ee.extend($.node,$.offset)):(F.setEnd($.node,$.offset),ee.addRange(F))}}}}for(ie=[],ee=C;ee=ee.parentNode;)ee.nodeType===1&&ie.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<ie.length;C++){var re=ie[C];re.element.scrollLeft=re.left,re.element.scrollTop=re.top}}Ui=!!gu,yu=gu=null}finally{Je=c,B.p=s,E.T=l}}e.current=t,_t=2}}function Fm(){if(_t===2){_t=0;var e=_a,t=Jl,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=E.T,E.T=null;var s=B.p;B.p=2;var c=Je;Je|=4;try{jm(e,t.alternate,t)}finally{Je=c,B.p=s,E.T=l}}_t=3}}function Wm(){if(_t===4||_t===3){_t=0,$t();var e=_a,t=Jl,l=xa,s=Dm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?_t=5:(_t=0,Jl=_a=null,Km(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Da=null),Co(l),t=t.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(Zn,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=E.T,c=B.p,B.p=2,E.T=null;try{for(var d=e.onRecoverableError,b=0;b<s.length;b++){var C=s[b];d(C.value,{componentStack:C.stack})}}finally{E.T=t,B.p=c}}(xa&3)!==0&&Ti(),Fn(e),c=e.pendingLanes,(l&261930)!==0&&(c&42)!==0?e===ru?es++:(es=0,ru=e):es=0,ts(0)}}function Km(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,_r(t)))}function Ti(){return Ym(),Fm(),Wm(),Xm()}function Xm(){if(_t!==5)return!1;var e=_a,t=au;au=0;var l=Co(xa),s=E.T,c=B.p;try{B.p=32>l?32:l,E.T=null,l=lu,lu=null;var d=_a,b=xa;if(_t=0,Jl=_a=null,xa=0,(Je&6)!==0)throw Error(o(331));var C=Je;if(Je|=4,Mm(d.current),Tm(d,d.current,b,l),Je=C,ts(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Zn,d)}catch{}return!0}finally{B.p=c,E.T=s,Km(e,t)}}function Qm(e,t,l){t=Tn(l,t),t=Bc(e.stateNode,t,2),e=Ta(e,t,2),e!==null&&(jr(e,2),Fn(e))}function lt(e,t,l){if(e.tag===3)Qm(e,e,l);else for(;t!==null;){if(t.tag===3){Qm(t,e,l);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Da===null||!Da.has(s))){e=Tn(l,e),l=Zp(2),s=Ta(t,l,2),s!==null&&(Jp(l,s,t,e),jr(s,2),Fn(s));break}}t=t.return}}function ou(e,t,l){var s=e.pingCache;if(s===null){s=e.pingCache=new Py;var c=new Set;s.set(t,c)}else c=s.get(t),c===void 0&&(c=new Set,s.set(t,c));c.has(l)||(eu=!0,c.add(l),e=Ky.bind(null,e,t,l),t.then(e,e))}function Ky(e,t,l){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,ut===e&&(Ye&l)===l&&(wt===4||wt===3&&(Ye&62914560)===Ye&&300>tt()-Si?(Je&2)===0&&er(e,0):tu|=l,Zl===Ye&&(Zl=0)),Fn(e)}function Zm(e,t){t===0&&(t=qd()),e=al(e,t),e!==null&&(jr(e,t),Fn(e))}function Xy(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Zm(e,l)}function Qy(e,t){var l=0;switch(e.tag){case 31:case 13:var s=e.stateNode,c=e.memoizedState;c!==null&&(l=c.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(o(314))}s!==null&&s.delete(t),Zm(e,l)}function Zy(e,t){return Zt(e,t)}var Ri=null,nr=null,cu=!1,Ai=!1,uu=!1,Ba=0;function Fn(e){e!==nr&&e.next===null&&(nr===null?Ri=nr=e:nr=nr.next=e),Ai=!0,cu||(cu=!0,e1())}function ts(e,t){if(!uu&&Ai){uu=!0;do for(var l=!1,s=Ri;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var d=0;else{var b=s.suspendedLanes,C=s.pingedLanes;d=(1<<31-bt(42|e)+1)-1,d&=c&~(b&~C),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(l=!0,nh(s,d))}else d=Ye,d=br(s,s===ut?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||wn(s,d)||(l=!0,nh(s,d));s=s.next}while(l);uu=!1}}function Jy(){Jm()}function Jm(){Ai=cu=!1;var e=0;Ba!==0&&u1()&&(e=Ba);for(var t=tt(),l=null,s=Ri;s!==null;){var c=s.next,d=eh(s,t);d===0?(s.next=null,l===null?Ri=c:l.next=c,c===null&&(nr=l)):(l=s,(e!==0||(d&3)!==0)&&(Ai=!0)),s=c}_t!==0&&_t!==5||ts(e),Ba!==0&&(Ba=0)}function eh(e,t){for(var l=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var b=31-bt(d),C=1<<b,H=c[b];H===-1?((C&l)===0||(C&s)!==0)&&(c[b]=So(C,t)):H<=t&&(e.expiredLanes|=C),d&=~C}if(t=ut,l=Ye,l=br(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,l===0||e===t&&(at===2||at===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&ct(s),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||wn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(s!==null&&ct(s),Co(l)){case 2:case 8:l=Rt;break;case 32:l=ze;break;case 268435456:l=Wt;break;default:l=ze}return s=th.bind(null,e),l=Zt(l,s),e.callbackPriority=t,e.callbackNode=l,t}return s!==null&&s!==null&&ct(s),e.callbackPriority=2,e.callbackNode=null,2}function th(e,t){if(_t!==0&&_t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Ti()&&e.callbackNode!==l)return null;var s=Ye;return s=br(e,e===ut?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Om(e,s,t),eh(e,tt()),e.callbackNode!=null&&e.callbackNode===l?th.bind(null,e):null)}function nh(e,t){if(Ti())return null;Om(e,t,!0)}function e1(){f1(function(){(Je&6)!==0?Zt(ve,Jy):Jm()})}function du(){if(Ba===0){var e=Vl;e===0&&(e=Ve,Ve<<=1,(Ve&261888)===0&&(Ve=256)),Ba=e}return Ba}function ah(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Is(""+e)}function lh(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function t1(e,t,l,s,c){if(t==="submit"&&l&&l.stateNode===c){var d=ah((c[ln]||null).action),b=s.submitter;b&&(t=(t=b[ln]||null)?ah(t.formAction):b.getAttribute("formAction"),t!==null&&(d=t,b=null));var C=new $s("action","action",null,s,c);e.push({event:C,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ba!==0){var H=b?lh(c,b):new FormData(c);Mc(l,{pending:!0,data:H,method:c.method,action:d},null,H)}}else typeof d=="function"&&(C.preventDefault(),H=b?lh(c,b):new FormData(c),Mc(l,{pending:!0,data:H,method:c.method,action:d},d,H))},currentTarget:c}]})}}for(var fu=0;fu<Wo.length;fu++){var pu=Wo[fu],n1=pu.toLowerCase(),a1=pu[0].toUpperCase()+pu.slice(1);Hn(n1,"on"+a1)}Hn(_f,"onAnimationEnd"),Hn(Of,"onAnimationIteration"),Hn(Bf,"onAnimationStart"),Hn("dblclick","onDoubleClick"),Hn("focusin","onFocus"),Hn("focusout","onBlur"),Hn(yy,"onTransitionRun"),Hn(by,"onTransitionStart"),Hn(jy,"onTransitionCancel"),Hn(If,"onTransitionEnd"),El("onMouseEnter",["mouseout","mouseover"]),El("onMouseLeave",["mouseout","mouseover"]),El("onPointerEnter",["pointerout","pointerover"]),El("onPointerLeave",["pointerout","pointerover"]),Ja("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ja("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ja("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ja("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ns="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),l1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ns));function rh(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var s=e[l],c=s.event;s=s.listeners;e:{var d=void 0;if(t)for(var b=s.length-1;0<=b;b--){var C=s[b],H=C.instance,K=C.currentTarget;if(C=C.listener,H!==d&&c.isPropagationStopped())break e;d=C,c.currentTarget=K;try{d(c)}catch(le){qs(le)}c.currentTarget=null,d=H}else for(b=0;b<s.length;b++){if(C=s[b],H=C.instance,K=C.currentTarget,C=C.listener,H!==d&&c.isPropagationStopped())break e;d=C,c.currentTarget=K;try{d(c)}catch(le){qs(le)}c.currentTarget=null,d=H}}}}function qe(e,t){var l=t[No];l===void 0&&(l=t[No]=new Set);var s=e+"__bubble";l.has(s)||(sh(t,e,2,!1),l.add(s))}function mu(e,t,l){var s=0;t&&(s|=4),sh(l,e,s,t)}var Mi="_reactListening"+Math.random().toString(36).slice(2);function hu(e){if(!e[Mi]){e[Mi]=!0,Zd.forEach(function(l){l!=="selectionchange"&&(l1.has(l)||mu(l,!1,e),mu(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Mi]||(t[Mi]=!0,mu("selectionchange",!1,t))}}function sh(e,t,l,s){switch(_h(t)){case 2:var c=z1;break;case 8:c=L1;break;default:c=Au}l=c.bind(null,t,l,e),c=void 0,!_o||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),s?c!==void 0?e.addEventListener(t,l,{capture:!0,passive:c}):e.addEventListener(t,l,!0):c!==void 0?e.addEventListener(t,l,{passive:c}):e.addEventListener(t,l,!1)}function xu(e,t,l,s,c){var d=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var b=s.tag;if(b===3||b===4){var C=s.stateNode.containerInfo;if(C===c)break;if(b===4)for(b=s.return;b!==null;){var H=b.tag;if((H===3||H===4)&&b.stateNode.containerInfo===c)return;b=b.return}for(;C!==null;){if(b=wl(C),b===null)return;if(H=b.tag,H===5||H===6||H===26||H===27){s=d=b;continue e}C=C.parentNode}}s=s.return}df(function(){var K=d,le=Lo(l),ie=[];e:{var X=Hf.get(e);if(X!==void 0){var ee=$s,be=e;switch(e){case"keypress":if(Us(l)===0)break e;case"keydown":case"keyup":ee=Qg;break;case"focusin":be="focus",ee=Ho;break;case"focusout":be="blur",ee=Ho;break;case"beforeblur":case"afterblur":ee=Ho;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ee=mf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=Hg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=ey;break;case _f:case Of:case Bf:ee=$g;break;case If:ee=ny;break;case"scroll":case"scrollend":ee=Bg;break;case"wheel":ee=ly;break;case"copy":case"cut":case"paste":ee=Pg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=xf;break;case"toggle":case"beforetoggle":ee=sy}var Te=(t&4)!==0,it=!Te&&(e==="scroll"||e==="scrollend"),P=Te?X!==null?X+"Capture":null:X;Te=[];for(var $=K,F;$!==null;){var re=$;if(F=re.stateNode,re=re.tag,re!==5&&re!==26&&re!==27||F===null||P===null||(re=wr($,P),re!=null&&Te.push(as($,re,F))),it)break;$=$.return}0<Te.length&&(X=new ee(X,be,null,l,le),ie.push({event:X,listeners:Te}))}}if((t&7)===0){e:{if(X=e==="mouseover"||e==="pointerover",ee=e==="mouseout"||e==="pointerout",X&&l!==zo&&(be=l.relatedTarget||l.fromElement)&&(wl(be)||be[kl]))break e;if((ee||X)&&(X=le.window===le?le:(X=le.ownerDocument)?X.defaultView||X.parentWindow:window,ee?(be=l.relatedTarget||l.toElement,ee=K,be=be?wl(be):null,be!==null&&(it=p(be),Te=be.tag,be!==it||Te!==5&&Te!==27&&Te!==6)&&(be=null)):(ee=null,be=K),ee!==be)){if(Te=mf,re="onMouseLeave",P="onMouseEnter",$="mouse",(e==="pointerout"||e==="pointerover")&&(Te=xf,re="onPointerLeave",P="onPointerEnter",$="pointer"),it=ee==null?X:kr(ee),F=be==null?X:kr(be),X=new Te(re,$+"leave",ee,l,le),X.target=it,X.relatedTarget=F,re=null,wl(le)===K&&(Te=new Te(P,$+"enter",be,l,le),Te.target=F,Te.relatedTarget=it,re=Te),it=re,ee&&be)t:{for(Te=r1,P=ee,$=be,F=0,re=P;re;re=Te(re))F++;re=0;for(var Ee=$;Ee;Ee=Te(Ee))re++;for(;0<F-re;)P=Te(P),F--;for(;0<re-F;)$=Te($),re--;for(;F--;){if(P===$||$!==null&&P===$.alternate){Te=P;break t}P=Te(P),$=Te($)}Te=null}else Te=null;ee!==null&&ih(ie,X,ee,Te,!1),be!==null&&it!==null&&ih(ie,it,be,Te,!0)}}e:{if(X=K?kr(K):window,ee=X.nodeName&&X.nodeName.toLowerCase(),ee==="select"||ee==="input"&&X.type==="file")var Xe=wf;else if(Sf(X))if(Cf)Xe=xy;else{Xe=my;var Se=py}else ee=X.nodeName,!ee||ee.toLowerCase()!=="input"||X.type!=="checkbox"&&X.type!=="radio"?K&&Mo(K.elementType)&&(Xe=wf):Xe=hy;if(Xe&&(Xe=Xe(e,K))){kf(ie,Xe,l,le);break e}Se&&Se(e,X,K),e==="focusout"&&K&&X.type==="number"&&K.memoizedProps.value!=null&&Ao(X,"number",X.value)}switch(Se=K?kr(K):window,e){case"focusin":(Sf(Se)||Se.contentEditable==="true")&&(Ll=Se,qo=K,zr=null);break;case"focusout":zr=qo=Ll=null;break;case"mousedown":Yo=!0;break;case"contextmenu":case"mouseup":case"dragend":Yo=!1,Lf(ie,l,le);break;case"selectionchange":if(gy)break;case"keydown":case"keyup":Lf(ie,l,le)}var Ie;if(Vo)e:{switch(e){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else zl?bf(e,l)&&(Fe="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Fe="onCompositionStart");Fe&&(vf&&l.locale!=="ko"&&(zl||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&zl&&(Ie=ff()):(ja=le,Oo="value"in ja?ja.value:ja.textContent,zl=!0)),Se=zi(K,Fe),0<Se.length&&(Fe=new hf(Fe,e,null,l,le),ie.push({event:Fe,listeners:Se}),Ie?Fe.data=Ie:(Ie=jf(l),Ie!==null&&(Fe.data=Ie)))),(Ie=oy?cy(e,l):uy(e,l))&&(Fe=zi(K,"onBeforeInput"),0<Fe.length&&(Se=new hf("onBeforeInput","beforeinput",null,l,le),ie.push({event:Se,listeners:Fe}),Se.data=Ie)),t1(ie,e,K,l,le)}rh(ie,t)})}function as(e,t,l){return{instance:e,listener:t,currentTarget:l}}function zi(e,t){for(var l=t+"Capture",s=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=wr(e,l),c!=null&&s.unshift(as(e,c,d)),c=wr(e,t),c!=null&&s.push(as(e,c,d))),e.tag===3)return s;e=e.return}return[]}function r1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ih(e,t,l,s,c){for(var d=t._reactName,b=[];l!==null&&l!==s;){var C=l,H=C.alternate,K=C.stateNode;if(C=C.tag,H!==null&&H===s)break;C!==5&&C!==26&&C!==27||K===null||(H=K,c?(K=wr(l,d),K!=null&&b.unshift(as(l,K,H))):c||(K=wr(l,d),K!=null&&b.push(as(l,K,H)))),l=l.return}b.length!==0&&e.push({event:t,listeners:b})}var s1=/\r\n?/g,i1=/\u0000|\uFFFD/g;function oh(e){return(typeof e=="string"?e:""+e).replace(s1,`
|
|
50
|
+
`).replace(i1,"")}function ch(e,t){return t=oh(t),oh(e)===t}function st(e,t,l,s,c,d){switch(l){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Rl(e,""+s);break;case"className":Os(e,"class",s);break;case"tabIndex":Os(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Os(e,l,s);break;case"style":cf(e,s,d);break;case"data":if(t!=="object"){Os(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Is(""+s),e.setAttribute(l,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof d=="function"&&(l==="formAction"?(t!=="input"&&st(e,t,"name",c.name,c,null),st(e,t,"formEncType",c.formEncType,c,null),st(e,t,"formMethod",c.formMethod,c,null),st(e,t,"formTarget",c.formTarget,c,null)):(st(e,t,"encType",c.encType,c,null),st(e,t,"method",c.method,c,null),st(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Is(""+s),e.setAttribute(l,s);break;case"onClick":s!=null&&(e.onclick=ta);break;case"onScroll":s!=null&&qe("scroll",e);break;case"onScrollEnd":s!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}l=Is(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""+s):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":s===!0?e.setAttribute(l,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,s):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(l,s):e.removeAttribute(l);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(l):e.setAttribute(l,s);break;case"popover":qe("beforetoggle",e),qe("toggle",e),_s(e,"popover",s);break;case"xlinkActuate":ea(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":ea(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":ea(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":ea(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":ea(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":ea(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":ea(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":ea(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":ea(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":_s(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=_g.get(l)||l,_s(e,l,s))}}function vu(e,t,l,s,c,d){switch(l){case"style":cf(e,s,d);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof s=="string"?Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&Rl(e,""+s);break;case"onScroll":s!=null&&qe("scroll",e);break;case"onScrollEnd":s!=null&&qe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=ta);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Jd.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(c=l.endsWith("Capture"),t=l.slice(2,c?l.length-7:void 0),d=e[ln]||null,d=d!=null?d[l]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof s=="function")){typeof d!="function"&&d!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,s,c);break e}l in e?e[l]=s:s===!0?e.setAttribute(l,""):_s(e,l,s)}}}function Ft(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var s=!1,c=!1,d;for(d in l)if(l.hasOwnProperty(d)){var b=l[d];if(b!=null)switch(d){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,d,b,l,null)}}c&&st(e,t,"srcSet",l.srcSet,l,null),s&&st(e,t,"src",l.src,l,null);return;case"input":qe("invalid",e);var C=d=b=c=null,H=null,K=null;for(s in l)if(l.hasOwnProperty(s)){var le=l[s];if(le!=null)switch(s){case"name":c=le;break;case"type":b=le;break;case"checked":H=le;break;case"defaultChecked":K=le;break;case"value":d=le;break;case"defaultValue":C=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(o(137,t));break;default:st(e,t,s,le,l,null)}}lf(e,d,C,H,K,b,c,!1);return;case"select":qe("invalid",e),s=b=d=null;for(c in l)if(l.hasOwnProperty(c)&&(C=l[c],C!=null))switch(c){case"value":d=C;break;case"defaultValue":b=C;break;case"multiple":s=C;default:st(e,t,c,C,l,null)}t=d,l=b,e.multiple=!!s,t!=null?Tl(e,!!s,t,!1):l!=null&&Tl(e,!!s,l,!0);return;case"textarea":qe("invalid",e),d=c=s=null;for(b in l)if(l.hasOwnProperty(b)&&(C=l[b],C!=null))switch(b){case"value":s=C;break;case"defaultValue":c=C;break;case"children":d=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(o(91));break;default:st(e,t,b,C,l,null)}sf(e,s,c,d);return;case"option":for(H in l)if(l.hasOwnProperty(H)&&(s=l[H],s!=null))switch(H){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:st(e,t,H,s,l,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(s=0;s<ns.length;s++)qe(ns[s],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in l)if(l.hasOwnProperty(K)&&(s=l[K],s!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,K,s,l,null)}return;default:if(Mo(t)){for(le in l)l.hasOwnProperty(le)&&(s=l[le],s!==void 0&&vu(e,t,le,s,l,void 0));return}}for(C in l)l.hasOwnProperty(C)&&(s=l[C],s!=null&&st(e,t,C,s,l,null))}function o1(e,t,l,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,b=null,C=null,H=null,K=null,le=null;for(ee in l){var ie=l[ee];if(l.hasOwnProperty(ee)&&ie!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":H=ie;default:s.hasOwnProperty(ee)||st(e,t,ee,null,s,ie)}}for(var X in s){var ee=s[X];if(ie=l[X],s.hasOwnProperty(X)&&(ee!=null||ie!=null))switch(X){case"type":d=ee;break;case"name":c=ee;break;case"checked":K=ee;break;case"defaultChecked":le=ee;break;case"value":b=ee;break;case"defaultValue":C=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(o(137,t));break;default:ee!==ie&&st(e,t,X,ee,s,ie)}}Ro(e,b,C,H,K,le,d,c);return;case"select":ee=b=C=X=null;for(d in l)if(H=l[d],l.hasOwnProperty(d)&&H!=null)switch(d){case"value":break;case"multiple":ee=H;default:s.hasOwnProperty(d)||st(e,t,d,null,s,H)}for(c in s)if(d=s[c],H=l[c],s.hasOwnProperty(c)&&(d!=null||H!=null))switch(c){case"value":X=d;break;case"defaultValue":C=d;break;case"multiple":b=d;default:d!==H&&st(e,t,c,d,s,H)}t=C,l=b,s=ee,X!=null?Tl(e,!!l,X,!1):!!s!=!!l&&(t!=null?Tl(e,!!l,t,!0):Tl(e,!!l,l?[]:"",!1));return;case"textarea":ee=X=null;for(C in l)if(c=l[C],l.hasOwnProperty(C)&&c!=null&&!s.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:st(e,t,C,null,s,c)}for(b in s)if(c=s[b],d=l[b],s.hasOwnProperty(b)&&(c!=null||d!=null))switch(b){case"value":X=c;break;case"defaultValue":ee=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==d&&st(e,t,b,c,s,d)}rf(e,X,ee);return;case"option":for(var be in l)if(X=l[be],l.hasOwnProperty(be)&&X!=null&&!s.hasOwnProperty(be))switch(be){case"selected":e.selected=!1;break;default:st(e,t,be,null,s,X)}for(H in s)if(X=s[H],ee=l[H],s.hasOwnProperty(H)&&X!==ee&&(X!=null||ee!=null))switch(H){case"selected":e.selected=X&&typeof X!="function"&&typeof X!="symbol";break;default:st(e,t,H,X,s,ee)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Te in l)X=l[Te],l.hasOwnProperty(Te)&&X!=null&&!s.hasOwnProperty(Te)&&st(e,t,Te,null,s,X);for(K in s)if(X=s[K],ee=l[K],s.hasOwnProperty(K)&&X!==ee&&(X!=null||ee!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(o(137,t));break;default:st(e,t,K,X,s,ee)}return;default:if(Mo(t)){for(var it in l)X=l[it],l.hasOwnProperty(it)&&X!==void 0&&!s.hasOwnProperty(it)&&vu(e,t,it,void 0,s,X);for(le in s)X=s[le],ee=l[le],!s.hasOwnProperty(le)||X===ee||X===void 0&&ee===void 0||vu(e,t,le,X,s,ee);return}}for(var P in l)X=l[P],l.hasOwnProperty(P)&&X!=null&&!s.hasOwnProperty(P)&&st(e,t,P,null,s,X);for(ie in s)X=s[ie],ee=l[ie],!s.hasOwnProperty(ie)||X===ee||X==null&&ee==null||st(e,t,ie,X,s,ee)}function uh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function c1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),s=0;s<l.length;s++){var c=l[s],d=c.transferSize,b=c.initiatorType,C=c.duration;if(d&&C&&uh(b)){for(b=0,C=c.responseEnd,s+=1;s<l.length;s++){var H=l[s],K=H.startTime;if(K>C)break;var le=H.transferSize,ie=H.initiatorType;le&&uh(ie)&&(H=H.responseEnd,b+=le*(H<C?1:(C-K)/(H-K)))}if(--s,t+=8*(d+b)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var gu=null,yu=null;function Li(e){return e.nodeType===9?e:e.ownerDocument}function dh(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function fh(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function bu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ju=null;function u1(){var e=window.event;return e&&e.type==="popstate"?e===ju?!1:(ju=e,!0):(ju=null,!1)}var ph=typeof setTimeout=="function"?setTimeout:void 0,d1=typeof clearTimeout=="function"?clearTimeout:void 0,mh=typeof Promise=="function"?Promise:void 0,f1=typeof queueMicrotask=="function"?queueMicrotask:typeof mh<"u"?function(e){return mh.resolve(null).then(e).catch(p1)}:ph;function p1(e){setTimeout(function(){throw e})}function Ia(e){return e==="head"}function hh(e,t){var l=t,s=0;do{var c=l.nextSibling;if(e.removeChild(l),c&&c.nodeType===8)if(l=c.data,l==="/$"||l==="/&"){if(s===0){e.removeChild(c),sr(t);return}s--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")s++;else if(l==="html")ls(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,ls(l);for(var d=l.firstChild;d;){var b=d.nextSibling,C=d.nodeName;d[Sr]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&d.rel.toLowerCase()==="stylesheet"||l.removeChild(d),d=b}}else l==="body"&&ls(e.ownerDocument.body);l=c}while(l);sr(t)}function xh(e,t){var l=e;e=0;do{var s=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),s&&s.nodeType===8)if(l=s.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=s}while(l)}function Su(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Su(l),Eo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function m1(e,t,l,s){for(;e.nodeType===1;){var c=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[Sr])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=Ln(e.nextSibling),e===null)break}return null}function h1(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Ln(e.nextSibling),e===null))return null;return e}function vh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ln(e.nextSibling),e===null))return null;return e}function ku(e){return e.data==="$?"||e.data==="$~"}function wu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function x1(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var s=function(){t(),l.removeEventListener("DOMContentLoaded",s)};l.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function Ln(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Cu=null;function gh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Ln(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function yh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function bh(e,t,l){switch(t=Li(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function ls(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Eo(e)}var Dn=new Map,jh=new Set;function Di(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var va=B.d;B.d={f:v1,r:g1,D:y1,C:b1,L:j1,m:S1,X:w1,S:k1,M:C1};function v1(){var e=va.f(),t=Ci();return e||t}function g1(e){var t=Cl(e);t!==null&&t.tag===5&&t.type==="form"?Ip(t):va.r(e)}var ar=typeof document>"u"?null:document;function Sh(e,t,l){var s=ar;if(s&&typeof t=="string"&&t){var c=Nn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof l=="string"&&(c+='[crossorigin="'+l+'"]'),jh.has(c)||(jh.add(c),e={rel:e,crossOrigin:l,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),Ft(t,"link",e),Ht(t),s.head.appendChild(t)))}}function y1(e){va.D(e),Sh("dns-prefetch",e,null)}function b1(e,t){va.C(e,t),Sh("preconnect",e,t)}function j1(e,t,l){va.L(e,t,l);var s=ar;if(s&&e&&t){var c='link[rel="preload"][as="'+Nn(t)+'"]';t==="image"&&l&&l.imageSrcSet?(c+='[imagesrcset="'+Nn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(c+='[imagesizes="'+Nn(l.imageSizes)+'"]')):c+='[href="'+Nn(e)+'"]';var d=c;switch(t){case"style":d=lr(e);break;case"script":d=rr(e)}Dn.has(d)||(e=g({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Dn.set(d,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(rs(d))||t==="script"&&s.querySelector(ss(d))||(t=s.createElement("link"),Ft(t,"link",e),Ht(t),s.head.appendChild(t)))}}function S1(e,t){va.m(e,t);var l=ar;if(l&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Nn(s)+'"][href="'+Nn(e)+'"]',d=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=rr(e)}if(!Dn.has(d)&&(e=g({rel:"modulepreload",href:e},t),Dn.set(d,e),l.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ss(d)))return}s=l.createElement("link"),Ft(s,"link",e),Ht(s),l.head.appendChild(s)}}}function k1(e,t,l){va.S(e,t,l);var s=ar;if(s&&e){var c=Nl(s).hoistableStyles,d=lr(e);t=t||"default";var b=c.get(d);if(!b){var C={loading:0,preload:null};if(b=s.querySelector(rs(d)))C.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Dn.get(d))&&Nu(e,l);var H=b=s.createElement("link");Ht(H),Ft(H,"link",e),H._p=new Promise(function(K,le){H.onload=K,H.onerror=le}),H.addEventListener("load",function(){C.loading|=1}),H.addEventListener("error",function(){C.loading|=2}),C.loading|=4,_i(b,t,s)}b={type:"stylesheet",instance:b,count:1,state:C},c.set(d,b)}}}function w1(e,t){va.X(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),d=s.get(c);d||(d=l.querySelector(ss(c)),d||(e=g({src:e,async:!0},t),(t=Dn.get(c))&&Eu(e,t),d=l.createElement("script"),Ht(d),Ft(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function C1(e,t){va.M(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),d=s.get(c);d||(d=l.querySelector(ss(c)),d||(e=g({src:e,async:!0,type:"module"},t),(t=Dn.get(c))&&Eu(e,t),d=l.createElement("script"),Ht(d),Ft(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function kh(e,t,l,s){var c=(c=xe.current)?Di(c):null;if(!c)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=lr(l.href),l=Nl(c).hoistableStyles,s=l.get(t),s||(s={type:"style",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=lr(l.href);var d=Nl(c).hoistableStyles,b=d.get(e);if(b||(c=c.ownerDocument||c,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,b),(d=c.querySelector(rs(e)))&&!d._p&&(b.instance=d,b.state.loading=5),Dn.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Dn.set(e,l),d||N1(c,e,l,b.state))),t&&s===null)throw Error(o(528,""));return b}if(t&&s!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=rr(l),l=Nl(c).hoistableScripts,s=l.get(t),s||(s={type:"script",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function lr(e){return'href="'+Nn(e)+'"'}function rs(e){return'link[rel="stylesheet"]['+e+"]"}function wh(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function N1(e,t,l,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Ft(t,"link",l),Ht(t),e.head.appendChild(t))}function rr(e){return'[src="'+Nn(e)+'"]'}function ss(e){return"script[async]"+e}function Ch(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Nn(l.href)+'"]');if(s)return t.instance=s,Ht(s),s;var c=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Ht(s),Ft(s,"style",c),_i(s,l.precedence,e),t.instance=s;case"stylesheet":c=lr(l.href);var d=e.querySelector(rs(c));if(d)return t.state.loading|=4,t.instance=d,Ht(d),d;s=wh(l),(c=Dn.get(c))&&Nu(s,c),d=(e.ownerDocument||e).createElement("link"),Ht(d);var b=d;return b._p=new Promise(function(C,H){b.onload=C,b.onerror=H}),Ft(d,"link",s),t.state.loading|=4,_i(d,l.precedence,e),t.instance=d;case"script":return d=rr(l.src),(c=e.querySelector(ss(d)))?(t.instance=c,Ht(c),c):(s=l,(c=Dn.get(d))&&(s=g({},l),Eu(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),Ht(c),Ft(c,"link",s),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,_i(s,l.precedence,e));return t.instance}function _i(e,t,l){for(var s=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,d=c,b=0;b<s.length;b++){var C=s[b];if(C.dataset.precedence===t)d=C;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Nu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Eu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Oi=null;function Nh(e,t,l){if(Oi===null){var s=new Map,c=Oi=new Map;c.set(l,s)}else c=Oi,s=c.get(l),s||(s=new Map,c.set(l,s));if(s.has(e))return s;for(s.set(e,null),l=l.getElementsByTagName(e),c=0;c<l.length;c++){var d=l[c];if(!(d[Sr]||d[Gt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var b=d.getAttribute(t)||"";b=e+b;var C=s.get(b);C?C.push(d):s.set(b,[d])}}return s}function Eh(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function E1(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Th(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function T1(e,t,l,s){if(l.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var c=lr(s.href),d=t.querySelector(rs(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Bi.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=d,Ht(d);return}d=t.ownerDocument||t,s=wh(s),(c=Dn.get(c))&&Nu(s,c),d=d.createElement("link"),Ht(d);var b=d;b._p=new Promise(function(C,H){b.onload=C,b.onerror=H}),Ft(d,"link",s),l.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Bi.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Tu=0;function R1(e,t){return e.stylesheets&&e.count===0&&Hi(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var s=setTimeout(function(){if(e.stylesheets&&Hi(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Tu===0&&(Tu=62500*c1());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Hi(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Tu?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Bi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hi(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ii=null;function Hi(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ii=new Map,t.forEach(A1,e),Ii=null,Bi.call(e))}function A1(e,t){if(!(t.state.loading&4)){var l=Ii.get(e);if(l)var s=l.get(null);else{l=new Map,Ii.set(e,l);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var b=c[d];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),s=b)}s&&l.set(null,s)}c=t.instance,b=c.getAttribute("data-precedence"),d=l.get(b)||s,d===s&&l.set(null,c),l.set(b,c),this.count++,s=Bi.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var is={$$typeof:O,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function M1(e,t,l,s,c,d,b,C,H){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ko(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ko(0),this.hiddenUpdates=ko(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function Rh(e,t,l,s,c,d,b,C,H,K,le,ie){return e=new M1(e,t,l,b,H,K,le,ie,C),t=1,d===!0&&(t|=24),d=pn(3,null,null,t),e.current=d,d.stateNode=e,t=ic(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:s,isDehydrated:l,cache:t},dc(d),e}function Ah(e){return e?(e=Ol,e):Ol}function Mh(e,t,l,s,c,d){c=Ah(c),s.context===null?s.context=c:s.pendingContext=c,s=Ea(t),s.payload={element:l},d=d===void 0?null:d,d!==null&&(s.callback=d),l=Ta(e,s,t),l!==null&&(dn(l,e,t),Hr(l,e,t))}function zh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Ru(e,t){zh(e,t),(e=e.alternate)&&zh(e,t)}function Lh(e){if(e.tag===13||e.tag===31){var t=al(e,67108864);t!==null&&dn(t,e,67108864),Ru(e,67108864)}}function Dh(e){if(e.tag===13||e.tag===31){var t=gn();t=wo(t);var l=al(e,t);l!==null&&dn(l,e,t),Ru(e,t)}}var Ui=!0;function z1(e,t,l,s){var c=E.T;E.T=null;var d=B.p;try{B.p=2,Au(e,t,l,s)}finally{B.p=d,E.T=c}}function L1(e,t,l,s){var c=E.T;E.T=null;var d=B.p;try{B.p=8,Au(e,t,l,s)}finally{B.p=d,E.T=c}}function Au(e,t,l,s){if(Ui){var c=Mu(s);if(c===null)xu(e,t,s,Vi,l),Oh(e,s);else if(_1(c,e,t,l,s))s.stopPropagation();else if(Oh(e,s),t&4&&-1<D1.indexOf(e)){for(;c!==null;){var d=Cl(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var b=Nt(d.pendingLanes);if(b!==0){var C=d;for(C.pendingLanes|=2,C.entangledLanes|=2;b;){var H=1<<31-bt(b);C.entanglements[1]|=H,b&=~H}Fn(d),(Je&6)===0&&(ki=tt()+500,ts(0))}}break;case 31:case 13:C=al(d,2),C!==null&&dn(C,d,2),Ci(),Ru(d,2)}if(d=Mu(s),d===null&&xu(e,t,s,Vi,l),d===c)break;c=d}c!==null&&s.stopPropagation()}else xu(e,t,s,null,l)}}function Mu(e){return e=Lo(e),zu(e)}var Vi=null;function zu(e){if(Vi=null,e=wl(e),e!==null){var t=p(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=f(t),e!==null)return e;e=null}else if(l===31){if(e=h(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Vi=e,null}function _h(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(jt()){case ve:return 2;case Rt:return 8;case ze:case xt:return 32;case Wt:return 268435456;default:return 32}default:return 32}}var Lu=!1,Ha=null,Ua=null,Va=null,os=new Map,cs=new Map,$a=[],D1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Oh(e,t){switch(e){case"focusin":case"focusout":Ha=null;break;case"dragenter":case"dragleave":Ua=null;break;case"mouseover":case"mouseout":Va=null;break;case"pointerover":case"pointerout":os.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":cs.delete(t.pointerId)}}function us(e,t,l,s,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:l,eventSystemFlags:s,nativeEvent:d,targetContainers:[c]},t!==null&&(t=Cl(t),t!==null&&Lh(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function _1(e,t,l,s,c){switch(t){case"focusin":return Ha=us(Ha,e,t,l,s,c),!0;case"dragenter":return Ua=us(Ua,e,t,l,s,c),!0;case"mouseover":return Va=us(Va,e,t,l,s,c),!0;case"pointerover":var d=c.pointerId;return os.set(d,us(os.get(d)||null,e,t,l,s,c)),!0;case"gotpointercapture":return d=c.pointerId,cs.set(d,us(cs.get(d)||null,e,t,l,s,c)),!0}return!1}function Bh(e){var t=wl(e.target);if(t!==null){var l=p(t);if(l!==null){if(t=l.tag,t===13){if(t=f(l),t!==null){e.blockedOn=t,Xd(e.priority,function(){Dh(l)});return}}else if(t===31){if(t=h(l),t!==null){e.blockedOn=t,Xd(e.priority,function(){Dh(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function $i(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Mu(e.nativeEvent);if(l===null){l=e.nativeEvent;var s=new l.constructor(l.type,l);zo=s,l.target.dispatchEvent(s),zo=null}else return t=Cl(l),t!==null&&Lh(t),e.blockedOn=l,!1;t.shift()}return!0}function Ih(e,t,l){$i(e)&&l.delete(t)}function O1(){Lu=!1,Ha!==null&&$i(Ha)&&(Ha=null),Ua!==null&&$i(Ua)&&(Ua=null),Va!==null&&$i(Va)&&(Va=null),os.forEach(Ih),cs.forEach(Ih)}function Gi(e,t){e.blockedOn===t&&(e.blockedOn=null,Lu||(Lu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,O1)))}var Pi=null;function Hh(e){Pi!==e&&(Pi=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Pi===e&&(Pi=null);for(var t=0;t<e.length;t+=3){var l=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(zu(s||l)===null)continue;break}var d=Cl(l);d!==null&&(e.splice(t,3),t-=3,Mc(d,{pending:!0,data:c,method:l.method,action:s},s,c))}}))}function sr(e){function t(H){return Gi(H,e)}Ha!==null&&Gi(Ha,e),Ua!==null&&Gi(Ua,e),Va!==null&&Gi(Va,e),os.forEach(t),cs.forEach(t);for(var l=0;l<$a.length;l++){var s=$a[l];s.blockedOn===e&&(s.blockedOn=null)}for(;0<$a.length&&(l=$a[0],l.blockedOn===null);)Bh(l),l.blockedOn===null&&$a.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(s=0;s<l.length;s+=3){var c=l[s],d=l[s+1],b=c[ln]||null;if(typeof d=="function")b||Hh(l);else if(b){var C=null;if(d&&d.hasAttribute("formAction")){if(c=d,b=d[ln]||null)C=b.formAction;else if(zu(c)!==null)continue}else C=b.action;typeof C=="function"?l[s+1]=C:(l.splice(s,3),s-=3),Hh(l)}}}function Uh(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(b){return c=b})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(l,20)}function l(){if(!s&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Du(e){this._internalRoot=e}qi.prototype.render=Du.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,s=gn();Mh(l,s,e,t,null,null)},qi.prototype.unmount=Du.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Mh(e.current,2,null,e,null,null),Ci(),t[kl]=null}};function qi(e){this._internalRoot=e}qi.prototype.unstable_scheduleHydration=function(e){if(e){var t=Kd();e={blockedOn:null,target:e,priority:t};for(var l=0;l<$a.length&&t!==0&&t<$a[l].priority;l++);$a.splice(l,0,e),l===0&&Bh(e)}};var Vh=r.version;if(Vh!=="19.2.4")throw Error(o(527,Vh,"19.2.4"));B.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=m(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var B1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yi.isDisabled&&Yi.supportsFiber)try{Zn=Yi.inject(B1),Ct=Yi}catch{}}return fs.createRoot=function(e,t){if(!u(e))throw Error(o(299));var l=!1,s="",c=Wp,d=Kp,b=Xp;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=Rh(e,1,!1,null,null,l,s,null,c,d,b,Uh),e[kl]=t.current,hu(e),new Du(t)},fs.hydrateRoot=function(e,t,l){if(!u(e))throw Error(o(299));var s=!1,c="",d=Wp,b=Kp,C=Xp,H=null;return l!=null&&(l.unstable_strictMode===!0&&(s=!0),l.identifierPrefix!==void 0&&(c=l.identifierPrefix),l.onUncaughtError!==void 0&&(d=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(C=l.onRecoverableError),l.formState!==void 0&&(H=l.formState)),t=Rh(e,1,!0,t,l??null,s,c,H,d,b,C,Uh),t.context=Ah(null),l=t.current,s=gn(),s=wo(s),c=Ea(s),c.callback=null,Ta(l,c,s),l=s,t.current.lanes=l,jr(t,l),Fn(t),e[kl]=t.current,hu(e),new qi(t)},fs.version="19.2.4",fs}var Qh;function Y1(){if(Qh)return Bu.exports;Qh=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}return a(),Bu.exports=q1(),Bu.exports}var F1=Y1();const W1="modulepreload",K1=function(a){return"/"+a},Zh={},Nd=function(r,i,o){let u=Promise.resolve();if(i&&i.length>0){let f=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),x=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));u=f(i.map(m=>{if(m=K1(m),m in Zh)return;Zh[m]=!0;const y=m.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const j=document.createElement("link");if(j.rel=y?"stylesheet":W1,y||(j.as="script"),j.crossOrigin="",j.href=m,x&&j.setAttribute("nonce",x),document.head.appendChild(j),y)return new Promise((S,N)=>{j.addEventListener("load",S),j.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${m}`)))})}))}function p(f){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=f,window.dispatchEvent(h),!h.defaultPrevented)throw f}return u.then(f=>{for(const h of f||[])h.status==="rejected"&&p(h.reason);return r().catch(p)})},Jh={own:"authoring-project",installed:"available-project",global:"available-personal"},ud=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function X1(a){if(typeof a=="string"){if(ud.has(a))return a;if(Object.prototype.hasOwnProperty.call(Jh,a))return Jh[a]}return"authoring-project"}function Q1(a){return a.startsWith("available-")?"available":"authoring"}function Z1(a){const r=a.indexOf("-");return a.slice(r+1)}const Ya="";class gs extends Error{constructor(r,i){super(r),this.name="ApiError",this.status=i}}async function Ge(a,r){const i=await fetch(`${Ya}${a}`,r);if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new gs(o.error||`HTTP ${i.status}`,i.status)}return i.json()}function en(a){return typeof a=="string"&&a.length>0?a:null}function J1(a){return typeof a=="number"&&Number.isFinite(a)?a:null}function Vu(a){if(!Array.isArray(a))return null;const r=a.filter(i=>typeof i=="string"&&i.length>0);return r.length>0?r:null}function eb(a){const r=a??{};let i;r.origin==="source"||r.origin==="installed"?i=r.origin:(i="source",console.warn(`[api.getSkills] skill ${String(r.plugin)}/${String(r.skill)} has invalid origin=${JSON.stringify(r.origin)}; defaulting to 'source'`));let o;r.scope==="own"||r.scope==="installed"||r.scope==="global"?o=r.scope:o=i==="installed"?"installed":"own";let u;r.installMethod==="authored"||r.installMethod==="copied"||r.installMethod==="symlinked"?u=r.installMethod:u=o==="own"?"authored":"copied";const p=typeof r.scopeV2=="string"&&ud.has(r.scopeV2)?r.scopeV2:X1(r.scope),f=Q1(p),h=Z1(p),x=typeof r.precedenceRank=="number"?r.precedenceRank:void 0;let m;r.shadowedBy===null?m=null:typeof r.shadowedBy=="string"&&ud.has(r.shadowedBy)?m=r.shadowedBy:m=void 0;const y={plugin:typeof r.plugin=="string"?r.plugin:"",skill:typeof r.skill=="string"?r.skill:"",dir:typeof r.dir=="string"?r.dir:"",hasEvals:!!r.hasEvals,hasBenchmark:!!r.hasBenchmark,evalCount:typeof r.evalCount=="number"?r.evalCount:0,assertionCount:typeof r.assertionCount=="number"?r.assertionCount:0,benchmarkStatus:r.benchmarkStatus==="pass"||r.benchmarkStatus==="fail"||r.benchmarkStatus==="pending"||r.benchmarkStatus==="stale"||r.benchmarkStatus==="missing"?r.benchmarkStatus:"missing",lastBenchmark:typeof r.lastBenchmark=="string"?r.lastBenchmark:null,origin:i,scope:o,isSymlink:typeof r.isSymlink=="boolean"?r.isSymlink:!1,symlinkTarget:en(r.symlinkTarget),installMethod:u,scopeV2:p,group:f,source:h,pluginName:en(r.pluginName),pluginNamespace:en(r.pluginNamespace),pluginMarketplace:en(r.pluginMarketplace),pluginManifestPath:en(r.pluginManifestPath),pluginVersion:en(r.pluginVersion),precedenceRank:x,shadowedBy:m,description:en(r.description),version:en(r.version),category:en(r.category),author:en(r.author),license:en(r.license),homepage:en(r.homepage),tags:Vu(r.tags),deps:Vu(r.deps),mcpDeps:Vu(r.mcpDeps),entryPoint:en(r.entryPoint),lastModified:en(r.lastModified),sizeBytes:J1(r.sizeBytes),sourceAgent:en(r.sourceAgent)};if(r.provenance&&typeof r.provenance=="object"){const g=r.provenance;(g.promotedFrom==="installed"||g.promotedFrom==="global")&&typeof g.sourcePath=="string"&&typeof g.promotedAt=="number"?y.provenance={promotedFrom:g.promotedFrom,sourcePath:g.sourcePath,promotedAt:g.promotedAt,sourceSkillVersion:typeof g.sourceSkillVersion=="string"?g.sourceSkillVersion:void 0}:y.provenance=null}else r.provenance===null&&(y.provenance=null);return typeof r.updateAvailable=="boolean"&&(y.updateAvailable=r.updateAvailable),typeof r.currentVersion=="string"&&(y.currentVersion=r.currentVersion),typeof r.latestVersion=="string"&&(y.latestVersion=r.latestVersion),typeof r.pinnedVersion=="string"&&(y.pinnedVersion=r.pinnedVersion),y}const Ne={getConfig(){return Ge("/api/config")},setConfig(a,r){return Ge("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a,model:r})})},async getSkills(a){const r=new URLSearchParams;a!=null&&a.scope&&r.set("scope",a.scope),a!=null&&a.agent&&r.set("agent",a.agent);const i=r.toString(),o=await Ge(`/api/skills${i?"?"+i:""}`);return Array.isArray(o)?o.map(eb):[]},getAgents(){return Ge("/api/agents")},getSkillDetail(a,r){return Ge(`/api/skills/${a}/${r}`)},getEvals(a,r){return Ge(`/api/skills/${a}/${r}/evals`)},saveEvals(a,r,i){return Ge(`/api/skills/${a}/${r}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},generateEvals(a,r){return Ge(`/api/skills/${a}/${r}/generate-evals`,{method:"POST"})},async getLatestBenchmark(a,r){const i=await fetch(`${Ya}/api/skills/${a}/${r}/benchmark/latest`);if(i.status===404)return null;if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new gs(o.error||`HTTP ${i.status}`,i.status)}return i.json()},getHistory(a,r,i){const o=new URLSearchParams;i!=null&&i.model&&o.set("model",i.model),i!=null&&i.type&&o.set("type",i.type),i!=null&&i.from&&o.set("from",i.from),i!=null&&i.to&&o.set("to",i.to);const u=o.toString();return Ge(`/api/skills/${a}/${r}/history${u?"?"+u:""}`)},getHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`)},compareRuns(a,r,i,o){return Ge(`/api/skills/${a}/${r}/history-compare?a=${encodeURIComponent(i)}&b=${encodeURIComponent(o)}`)},getCaseHistory(a,r,i,o){const u=new URLSearchParams;o&&u.set("model",o);const p=u.toString();return Ge(`/api/skills/${a}/${r}/history/case/${i}${p?"?"+p:""}`)},deleteHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`,{method:"DELETE"})},deleteSkill(a,r){return Ge(`/api/skills/${a}/${r}`,{method:"DELETE"})},improveSkill(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},instructEdit(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...i})})},applyImprovement(a,r,i){return Ge(`/api/skills/${a}/${r}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})})},getStats(a,r){return Ge(`/api/skills/${a}/${r}/stats`)},getDependencies(a,r){return Ge(`/api/skills/${a}/${r}/dependencies`)},getProjectLayout(){return Ge("/api/project-layout")},createSkill(a){return Ge("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},saveDraft(a){return Ge("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillCreatorStatus(){return Ge("/api/skill-creator-status")},generateSkill(a){return Ge("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillFiles(a,r){return Ge(`/api/skills/${a}/${r}/files`)},getSkillFile(a,r,i){return Ge(`/api/skills/${a}/${r}/file?path=${encodeURIComponent(i)}`)},saveSkillFile(a,r,i,o){return Ge(`/api/skills/${a}/${r}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:o})})},getLeaderboard(a,r){return Ge(`/api/skills/${a}/${r}/leaderboard`)},getLeaderboardEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/leaderboard/${encodeURIComponent(i)}`)},startSweep(a,r,i){const o=`${Ya}/api/skills/${a}/${r}/sweep`,u=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(i)}),u},getCredentials(a,r){return Ge(`/api/credentials/${a}/${r}`)},setCredential(a,r,i,o){return Ge(`/api/credentials/${a}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,value:o})})},getParams(a,r){return Ge(`/api/credentials/${a}/${r}/params`)},getParamsRevealed(a,r,i){const o=i?`reveal=true&key=${encodeURIComponent(i)}`:"reveal=true";return Ge(`/api/credentials/${a}/${r}/params?${o}`)},searchModels(){return Ge("/api/openrouter/models")},getSkillVersions(a,r){return Ge(`/api/skills/${a}/${r}/versions`)},getVersionDiff(a,r,i,o){return Ge(`/api/skills/${a}/${r}/versions/diff?from=${i}&to=${o}`)},startBatchUpdate(a){const r=`${Ya}/api/skills/batch-update`,i=new EventSource(r);return fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:a})}),i},startSkillUpdate(a,r){const i=`${Ya}/api/skills/${a}/${r}/update`,o=new EventSource(i);return fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),o},async getSkillUpdates(){try{const a=await fetch(`${Ya}/api/skills/updates`);return a.ok?await a.json():[]}catch{return[]}},promoteSkill(a,r,i){const o=i!=null&&i.overwrite?"?overwrite=true":"";return $u(`/api/skills/${a}/${r}/promote${o}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},testInstallSkill(a,r,i){const o=new URLSearchParams;(i==null?void 0:i.dest)==="global"&&o.set("dest","global"),i!=null&&i.overwrite&&o.set("overwrite","true");const u=o.toString();return $u(`/api/skills/${a}/${r}/test-install${u?"?"+u:""}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},revertSkill(a,r,i){return $u(`/api/skills/${a}/${r}/revert`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},listStudioOps(a){const r=new URLSearchParams;(a==null?void 0:a.before)!=null&&r.set("before",String(a.before)),(a==null?void 0:a.limit)!=null&&r.set("limit",String(a.limit));const i=r.toString();return Ge(`/api/studio/ops${i?"?"+i:""}`)},deleteStudioOp(a){return Ge(`/api/studio/ops/${encodeURIComponent(a)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${Ya}/api/studio/ops/stream`)}};async function $u(a,r,i){const o=await fetch(`${Ya}${a}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},signal:i});if(!o.ok||!o.body){let y=`HTTP ${o.status}`,g;try{const S=await o.json();S.error&&(y=S.error),typeof S.code=="string"&&(g=S.code)}catch{}const j=new gs(y,o.status);throw g&&(j.code=g),j}const u=o.body.getReader(),p=new TextDecoder;let f="",h="",x=null,m=null;for(;;){const{done:y,value:g}=await u.read();if(y)break;f+=p.decode(g,{stream:!0});const j=f.split(`
|
|
51
|
+
`);f=j.pop()??"";for(const S of j)if(S.startsWith("event: "))h=S.slice(7).trim();else if(S.startsWith("data: ")){let N={};try{N=JSON.parse(S.slice(6))}catch{h="";continue}if(h==="started"||h==="copied"||h==="deleted"||h==="indexed"||h==="done"||h==="error"){const L={type:h,...N};r==null||r(L),L.type==="done"&&(x=L),L.type==="error"&&(m=L)}h=""}}if(m){const y=new gs(m.message,500);throw y.code=m.code,y}if(!x)throw new gs("Transfer stream ended without 'done' event",500);return x}function tb(a,r){if(!r.length)return a;const i=new Map;for(const o of r){const u=o.name.split("/").pop()||o.name;i.set(u,o)}return a.map(o=>{const u=i.get(o.skill);return u?{...o,updateAvailable:u.updateAvailable,currentVersion:u.installed,latestVersion:u.latest??void 0}:o})}function nb(a){const[r,i]=v.useState(()=>typeof window>"u"?!1:window.matchMedia(a).matches);return v.useEffect(()=>{const o=window.matchMedia(a);i(o.matches);const u=p=>i(p.matches);return o.addEventListener("change",u),()=>o.removeEventListener("change",u)},[a]),r}const ab=3e5,lb=500,rb=15e3,sb=6e4;function ib(a){const r=new Map;for(const i of a){const o=i.name.split("/").pop()||i.name;r.set(o,i)}return r}function ob(a){let r=0;for(const i of a)i.updateAvailable&&r++;return r}function cb(a){a()}function ub(a){const r=ab,i=lb,o=rb,u=sb,[p,f]=v.useState([]),[h,x]=v.useState(()=>new Map),[m,y]=v.useState(0),[g,j]=v.useState(!1),[S,N]=v.useState(null),[L,T]=v.useState(null),k=v.useRef(null),M=v.useRef(null),O=v.useRef(null),V=v.useRef(null),A=v.useRef(!0),U=v.useCallback(async()=>{j(!0);const I=new AbortController,G=setTimeout(()=>I.abort(),o);try{const q=await Promise.race([Ne.getSkillUpdates(),new Promise((te,Q)=>{I.signal.addEventListener("abort",()=>{Q(new Error("TIMEOUT"))})})]);if(q==="TIMEOUT")throw new Error("TIMEOUT");if(!A.current)return;f(q),x(ib(q)),y(ob(q)),M.current=Date.now(),N(M.current),T(null)}catch(q){if(!A.current)return;T(q instanceof Error?q:new Error(String(q)))}finally{clearTimeout(G),A.current&&j(!1)}},[o]),w=v.useCallback(()=>{if(k.current)return k.current;const I=U().finally(()=>{k.current=null});return k.current=I,I},[U]),D=v.useCallback(()=>{O.current==null&&(O.current=setInterval(()=>{w()},r))},[r,w]),R=v.useCallback(()=>{O.current!=null&&(clearInterval(O.current),O.current=null)},[]);return v.useEffect(()=>{A.current=!0,(M.current==null||Date.now()-M.current>u)&&cb(()=>void w()),(typeof document>"u"||document.visibilityState!=="hidden")&&D();const q=()=>{if(V.current&&(clearTimeout(V.current),V.current=null),document.visibilityState==="hidden"){R();return}V.current=setTimeout(()=>{V.current=null,(M.current==null||Date.now()-M.current>u)&&w(),D()},i)};return typeof document<"u"&&document.addEventListener("visibilitychange",q),()=>{A.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",q),V.current&&clearTimeout(V.current),R()}},[]),{updates:p,updatesMap:h,updateCount:m,isRefreshing:g,lastFetchAt:S,error:L,refresh:w}}const db={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1};function fb(a,r){switch(r.type){case"SELECT_SKILL":return{...a,selectedSkill:r.skill,mode:"browse",mobileView:a.isMobile?"detail":a.mobileView};case"CLEAR_SELECTION":return{...a,selectedSkill:null};case"SET_MODE":return{...a,mode:r.mode,selectedSkill:r.mode==="create"?null:a.selectedSkill};case"SET_SEARCH":return{...a,searchQuery:r.query};case"SET_SKILLS":return{...a,skills:r.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...a,skillsError:r.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...a,skillsLoading:r.loading};case"SET_MOBILE":return{...a,isMobile:r.isMobile};case"SET_MOBILE_VIEW":return{...a,mobileView:r.view};case"DISMISS_UPDATE_NOTIFICATION":return{...a,updateNotificationDismissed:!0};default:return a}}const dv=v.createContext(null);function ya(){const a=v.useContext(dv);if(!a)throw new Error("useStudio must be used within StudioProvider");return a}function pb({children:a}){const[r,i]=v.useReducer(fb,db),o=nb("(max-width: 767px)");v.useEffect(()=>{i({type:"SET_MOBILE",isMobile:o})},[o]);const[u,p]=v.useState(()=>{try{const A=window.localStorage.getItem("vskill.studio.prefs");if(!A)return null;const U=JSON.parse(A);return typeof U.activeAgent=="string"?U.activeAgent:null}catch{return null}});v.useEffect(()=>{function A(U){if(!(U instanceof CustomEvent))return;const w=U.detail;w!=null&&w.agentId&&p(w.agentId)}return window.addEventListener("studio:agent-changed",A),()=>window.removeEventListener("studio:agent-changed",A)},[]);const f=v.useCallback(()=>{i({type:"SET_SKILLS_LOADING",loading:!0});const A=u?{agent:u}:void 0;Ne.getSkills(A).then(U=>{i({type:"SET_SKILLS",skills:U});const D=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(D){const[,R,I]=D,G=U.find(q=>q.plugin===R&&q.skill===I);G&&i({type:"SELECT_SKILL",skill:{plugin:R,skill:I,origin:G.origin}})}}).catch(U=>i({type:"SET_SKILLS_ERROR",error:U.message}))},[u]);v.useEffect(()=>{f()},[f]);const h=v.useCallback(A=>{i({type:"SELECT_SKILL",skill:A}),window.location.hash=`/skills/${A.plugin}/${A.skill}`},[]),x=v.useCallback(()=>{i({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),m=v.useCallback(A=>{i({type:"SET_MODE",mode:A})},[]),y=v.useCallback(A=>{i({type:"SET_SEARCH",query:A})},[]),g=v.useCallback(A=>{i({type:"SET_MOBILE_VIEW",view:A})},[]),j=v.useCallback(()=>{i({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),S=ub(),N=v.useMemo(()=>{const A=r.skills.map(U=>{if(!U.updateAvailable&&U.latestVersion===void 0)return U;const w={...U};return delete w.updateAvailable,delete w.currentVersion,delete w.latestVersion,w});return tb(A,S.updates)},[r.skills,S.updates]),L=v.useMemo(()=>{const A={source:0,installed:0};for(const U of N)U.updateAvailable&&(A[U.origin]+=1);return A},[N]),T=v.useMemo(()=>({...r,skills:N}),[r,N]),k=S.updateCount,M=S.refresh,O=S.isRefreshing,V=v.useMemo(()=>({state:T,selectSkill:h,clearSelection:x,setMode:m,setSearch:y,setMobileView:g,refreshSkills:f,updateCount:k,dismissUpdateNotification:j,updates:S.updates,outdatedByOrigin:L,isRefreshingUpdates:O,refreshUpdates:M}),[T,h,x,m,y,g,f,k,j,S.updates,L,O,M]);return n.jsx(dv.Provider,{value:V,children:a})}const mb={config:null,loading:!0};function hb(a,r){switch(r.type){case"SET_CONFIG":return{config:r.config,loading:!1};case"SET_LOADING":return{...a,loading:!0};default:return a}}const fv=v.createContext(null);function bl(){const a=v.useContext(fv);if(!a)throw new Error("useConfig must be used within ConfigProvider");return a}function xb({children:a}){const[r,i]=v.useReducer(hb,mb),o=v.useCallback(()=>{Ne.getConfig().then(f=>i({type:"SET_CONFIG",config:f})).catch(()=>{})},[]);v.useEffect(()=>{o()},[o]);const u=v.useCallback(async(f,h)=>{const x=await Ne.setConfig(f,h);return i({type:"SET_CONFIG",config:x}),x},[]),p=v.useMemo(()=>({config:r.config,loading:r.loading,updateConfig:u,refreshConfig:o}),[r,u,o]);return n.jsx(fv.Provider,{value:p,children:a})}function vb({topRail:a,sidebar:r,main:i,statusBar:o,resizeHandle:u,banner:p,liveMessage:f,sidebarWidth:h=320,sidebarHidden:x=!1}){const m={"--top-rail-height":"48px","--status-bar-height":"28px","--sidebar-width":`${h}px`,display:"grid",gridTemplateRows:"var(--top-rail-height) 1fr var(--status-bar-height)",height:"100vh",overflow:"hidden",background:"var(--bg-canvas)",color:"var(--text-primary)"},y={display:"grid",gridTemplateColumns:x?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return n.jsxs("div",{className:"studio-shell",style:m,children:[p,n.jsx("header",{style:{borderBottom:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:a}),n.jsxs("div",{style:y,children:[!x&&n.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:u?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:r}),!x&&u,n.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:i})]}),n.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),n.jsx("div",{"aria-live":"polite",role:"status",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},children:f??""})]})}var mo=uv();const gb=cv(mo),ex=["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],yb={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},bb={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},jb={"claude-cli":"cli-install",anthropic:"api-key",openrouter:"api-key",cursor:"cli-install","codex-cli":"cli-install","gemini-cli":"cli-install",copilot:"cli-install",zed:"cli-install",ollama:"start-service","lm-studio":"start-service"},Sb={"claude-cli":"subscription",anthropic:"per-token",openrouter:"per-token",cursor:"subscription","codex-cli":"subscription","gemini-cli":"subscription",copilot:"subscription",zed:"subscription",ollama:"free","lm-studio":"free"};function kb(a,r){var h,x;const i=yb[a.id]??null,o=bb[a.id]??null,u=i?!!((h=r==null?void 0:r.wrapperFolders)!=null&&h[i]):!1,p=o?!!((x=r==null?void 0:r.binaries)!=null&&x[o]):!0,f=a.models.map(m=>({id:m.id,displayName:m.label,billingMode:Sb[a.id]??"per-token"}));return{id:a.id,displayName:wb(a.id,a.label),wrapperFolder:i,wrapperFolderPresent:u,binaryAvailable:p,endpointReachable:a.id==="ollama"||a.id==="lm-studio"?a.available:null,available:a.available,ctaType:a.available?null:jb[a.id]??null,models:f}}function wb(a,r){return{"claude-cli":"Claude Code",anthropic:"Anthropic API",openrouter:"OpenRouter",cursor:"Cursor","codex-cli":"Codex CLI","gemini-cli":"Gemini CLI",copilot:"GitHub Copilot",zed:"Zed",ollama:"Ollama","lm-studio":"LM Studio"}[a]??r}function Cb(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of ex){const u=r.get(o);u&&i.push(u)}for(const o of a)ex.includes(o.id)||i.push(o);return i}function Nb(a){const[r,i]=v.useState(null),[o,u]=v.useState("loading"),[p,f]=v.useState(null),h=v.useRef(null),x=v.useRef(0),m=v.useCallback(async()=>{try{const N=await fetch("/api/config");if(!N.ok)throw new Error(`/api/config returned ${N.status}`);const L=await N.json(),T=Cb((L.providers||[]).map(k=>kb(k,L.detection)));i({agents:T,activeAgent:L.provider??null,activeModel:L.model??null}),u("ready"),f(null)}catch(N){u("error"),f(N.message)}},[]);v.useEffect(()=>{m()},[m]);const y=v.useCallback(async()=>{const N=Date.now();if(!(N-x.current<5*6e4))try{const L=await fetch("/api/openrouter/models");if(!L.ok)return;const T=await L.json();x.current=N,i(k=>{if(!k)return k;const M=k.agents.map(O=>{if(O.id!=="openrouter")return O;const V=T.models.map(U=>({id:U.id,displayName:U.name,contextWindow:U.contextWindow,pricing:U.pricing,billingMode:"per-token"}));return{...O,models:V,catalogAgeMs:T.ageSec?T.ageSec*1e3:0,cacheStale:!!T.stale}});return{...k,agents:M}}),T.stale&&(a!=null&&a.onStaleCatalog)&&a.onStaleCatalog("openrouter",(T.ageSec??0)*1e3)}catch{}},[a]),g=v.useCallback(N=>{h.current=N,N==="openrouter"&&y()},[y]),j=v.useCallback(()=>{x.current=0,m()},[m]),S=v.useCallback(async(N,L)=>{(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:N,model:L})})).ok&&i(k=>k&&{...k,activeAgent:N,activeModel:L})},[]);return{status:o,catalog:r,error:p,focusAgent:g,refresh:j,activeAgentId:(r==null?void 0:r.activeAgent)??null,activeModelId:(r==null?void 0:r.activeModel)??null,setActive:S}}function Gu({variant:a,label:r,onActivate:i,installUrl:o}){function u(f){if(f.stopPropagation(),a==="cli-install"&&o){window.open(o,"_blank","noopener,noreferrer");return}i()}function p(f){(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),u(f))}return n.jsx("button",{type:"button","data-testid":`locked-cta-${a}`,onClick:u,onKeyDown:p,className:"inline-flex items-center gap-1.5 px-0 py-0 text-[11px] font-medium",style:{color:"var(--accent, var(--text-primary))",background:"transparent",border:"none",cursor:"pointer"},"aria-label":r,children:r})}function dd({unlocked:a=!1,size:r=10}){return a?n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const Eb={sectionOwn:"Own",sectionInstalled:"Installed",searchPlaceholder:"Search skills",searchShortcutHint:"Press / to search",emptyOwnHeadline:"No skills yet.",emptyOwnBody:"Run vskill new <name> to create one.",emptyInstalledHeadline:"No installed skills.",emptyInstalledBody:"Run vskill install <plugin> to add one.",emptyFilteredHeadline:"No matches in this section.",emptyFilteredBody:"Clear the search or try another query.",loadErrorHeadline:"Couldn't load skills.",loadErrorRetry:"Retry",duplicateBadge:"synced from Own",updateAvailableBadge:"Update available",countBadgeFiltered:(a,r)=>`${a} of ${r}`},Tb={appTitle:"Skill Studio",commandPaletteButtonLabel:"Open command palette",commandPaletteHint:"⌘K",themeToggleLight:"Switch to light theme",themeToggleDark:"Switch to dark theme",themeToggleAuto:"Switch to auto theme",projectPathLabel:"Project",modelLabel:"Model",healthLabel:"Health"},Rb={tabOverview:"Overview",tabVersions:"Versions",tabBenchmark:"Benchmark",emptyHeadline:"Select a skill to see details.",emptyBody:"Pick one from the sidebar.",loadErrorHeadline:a=>`Couldn't load SKILL.md for ${a}.`,loadErrorBody:"Check the file path and your workspace permissions.",openInEditor:"Open in editor",copyPath:"Copy path",copyConfigSnippet:"Copy config snippet",depNotInstalledTooltip:"Not installed",missingValue:"—",announceViewingOwn:a=>`Viewing ${a} (Own)`,announceViewingInstalled:a=>`Viewing ${a} (Installed)`,moreFields:"More fields",sourceAgent:"Source agent",noMcpDependencies:"No MCP dependencies.",filesystemGroup:"Filesystem",benchmarkGroup:"Benchmark",metadataGroup:"Frontmatter"},Ab={open:"Open",copyPath:"Copy Path",revealInEditor:"Reveal in Editor",edit:"Edit",duplicate:"Duplicate",runBenchmark:"Run Benchmark",update:"Update",uninstall:"Uninstall",retry:"Retry",editPlaceholder:"Edit lands with 0675. Open the file in your editor."},Mb={inputPlaceholder:"Type a command or search",emptyResults:"No matches. Try a different query.",groupNavigation:"Navigation",groupActions:"Actions",groupTheme:"Theme",actionSelectSkill:"Select skill",actionRunBenchmark:"Run benchmark",actionSwitchTheme:"Switch theme",actionNewSkill:"New skill",closeLabel:"Close palette"},zb={title:"Keyboard shortcuts",closeLabel:"Close shortcuts",groupNavigation:"Navigation",groupActions:"Actions",groupTheme:"Theme",search:"Focus search",moveDown:"Move selection down",moveUp:"Move selection up",openSelected:"Open selected skill",openPalette:"Open command palette",openShortcuts:"Open this cheatsheet",toggleSidebar:"Toggle sidebar",toggleTheme:"Toggle theme"},Lb={pathCopied:"Path copied.",configCopied:"Config copied.",skillDuplicated:"Skill duplicated.",benchmarkQueued:"Benchmark queued.",themeUpdated:"Theme updated.",skillUpdated:"Skill updated.",actionFailed:"Action failed. Retry or check logs.",networkError:"Network error. Check your connection.",permissionDenied:"Permission denied. Check file access.",unknownError:"Something went wrong. Retry or check logs."},Db={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},_b={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},Ob={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},Bb={triggerLabel:"Agent and model",popoverTitle:"Select agent and model",footerHint:"↑↓ navigate · Enter select · Esc close",settingsButton:"Settings",keyboardShortcut:"⌘K",noModelsYet:"No models yet.",searchPlaceholder:"Search 300+ models…",noMatches:a=>`No models match "${a}"`,clearSearch:"Clear",currentlyActive:"Currently active"},Ib={claudeCli:{name:"Claude Code",caption:"Delegates to the `claude` CLI — your existing Claude Code session handles quota.",missingBinary:"Claude Code not found. Install it: `npm install -g @anthropic-ai/claude-code`. Or choose a provider with an API key.",installCta:"Install Claude Code →",installUrl:"https://docs.claude.com/en/docs/claude-code"},anthropic:{name:"Anthropic API",caption:"Direct access via your Anthropic API key.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.claude.com/settings/keys",keyPrefix:"sk-ant-"},openrouter:{name:"OpenRouter",caption:"300+ models from every major vendor.",addKeyCta:"Add API key →",emptyCardBody:"Add your OpenRouter API key to browse 300+ models",keyIssuanceUrl:"https://openrouter.ai/settings/keys",keyPrefix:"sk-or-"},cursor:{name:"Cursor",caption:"Cursor IDE composer.",installCta:"Install Cursor →"},codexCli:{name:"Codex CLI",caption:"OpenAI Codex CLI.",installCta:"Install Codex CLI →"},geminiCli:{name:"Gemini CLI",caption:"Google Gemini CLI.",installCta:"Install Gemini CLI →"},copilot:{name:"GitHub Copilot",caption:"GitHub Copilot CLI.",installCta:"Install Copilot →"},zed:{name:"Zed",caption:"Zed editor.",installCta:"Install Zed →"},ollama:{name:"Ollama",caption:"Local models, free.",startServiceCta:"Start service →"},lmStudio:{name:"LM Studio",caption:"Local models, free.",startServiceCta:"Start service →"}},Hb={subscriptionBilling:"· subscription",free:"· free"},Ub={title:"Settings",sectionApiKeys:"API Keys",sectionStorage:"Storage",banner:"Keys are stored locally on this device only. Never synced, never committed to git, never transmitted off-device except to the provider's own API.",storageBrowser:"Browser storage (default)",storageKeychain:"macOS Keychain (recommended)",storageDarwinOnly:"macOS Keychain is only available on macOS",show:"Show",hide:"Hide",paste:"Paste",save:"Save",remove:"Remove",removeConfirm:a=>`Remove ${a} API key?`,keyStoredAt:a=>`Key stored locally — updated ${a}`,noKey:"No key stored",enterNonEmpty:"Enter a non-empty key",prefixWarn:a=>`This doesn't look like a typical ${a} key. Save anyway?`,keySaved:a=>`${a} API key saved (local only, never synced)`,keyRemoved:a=>`${a} API key removed`},Vb={providersLabel:"Providers",providerSummary:(a,r)=>`${a}/${r} providers`,locked:a=>`${a} — locked. Click to add a key.`,lockedCli:a=>`${a} — locked. Click for install instructions.`,unlocked:a=>`${a} — unlocked.`},$b={triggerAriaLabel:"Choose active agent for the sidebar",popoverTitle:"Choose active agent",statsInstalled:"Installed",statsGlobal:"Global",statsLastSync:"Last sync",statsHealthOk:"Fresh",statsHealthStale:"Updates available",statsHealthMissing:"Not detected",switchCta:"Switch for this studio session",notDetectedSubheading:"Not detected",setUpCta:a=>`Set up ${a}`,sharedFolderBanner:a=>`Shared folder — consumed by ${a}`},Gb={ownLabel:"Own",installedLabel:"Installed",globalLabel:"Global",emptyOwn:"No authored skills — run vskill new.",emptyInstalled:a=>`No skills installed for ${a} in this project — run vskill install.`,emptyGlobal:a=>`No global skills for ${a} — run vskill install --global.`},Pb={compactLabel:"Covered by Max/Pro · overflow billed at API rates",tooltip:"Your Claude Code CLI usage runs under your Pro/Max subscription quota. If you've enabled extra usage in your account settings, excess usage continues at standard API rates. Run /usage in Claude Code or visit claude.com Settings → Usage to see remaining quota — vskill can't display it directly.",firstUseBanner:"Claude Code uses your Pro/Max subscription. No API key needed — vskill just runs the official claude binary on your behalf.",learnMore:"Learn more"},qb={title:a=>`Set up ${a}`,close:"Close",copy:"Copy",copied:"Copied",requiredEnv:"Required env vars",getKey:"Get a key",installRun:"Install & run",learnMore:"Learn more",fallbackTitle:"No setup guide available",fallbackBody:"We don't ship a setup guide for this provider yet."},Yb={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},Fb={anthropic:{name:"Anthropic API",description:"Direct API access to Claude via your Anthropic API key. Pay-per-token billing.",envVars:["ANTHROPIC_API_KEY"],keyUrl:"https://platform.claude.com/settings/keys",learnMoreUrl:"https://docs.claude.com/en/docs/get-started"},openai:{name:"OpenAI",description:"Access to GPT-4, GPT-5 and the o-series reasoning models via your OpenAI API key.",envVars:["OPENAI_API_KEY"],keyUrl:"https://platform.openai.com/api-keys",learnMoreUrl:"https://platform.openai.com/docs"},openrouter:{name:"OpenRouter",description:"One API key, 300+ models from Anthropic, OpenAI, Google, Meta, and more.",envVars:["OPENROUTER_API_KEY"],keyUrl:"https://openrouter.ai/keys",learnMoreUrl:"https://openrouter.ai/docs"},gemini:{name:"Gemini",description:"Google Gemini models (2.5 Pro, Flash) via Google AI Studio. Free tier available.",envVars:["GEMINI_API_KEY"],keyUrl:"https://aistudio.google.com/apikey",learnMoreUrl:"https://ai.google.dev/gemini-api/docs"},ollama:{name:"Ollama",description:"Local models on your own machine. Zero external calls, zero cost after download.",envVars:["OLLAMA_HOST"],installCmd:"curl -fsSL https://ollama.com/install.sh | sh",startCmd:"ollama serve",pullExample:"ollama pull llama3.2",learnMoreUrl:"https://ollama.com/download"},lmStudio:{name:"LM Studio",description:"Desktop app + local server for running open models with a GUI. Compatible with the OpenAI API.",envVars:["LM_STUDIO_BASE_URL"],installCmd:"Download from https://lmstudio.ai and launch the app, then start the local server.",startCmd:"# In LM Studio: Developer → Start Server (default port 1234)",pullExample:"# In LM Studio: Discover → download any GGUF model",learnMoreUrl:"https://lmstudio.ai/docs"},claudeCode:{name:"Claude Code",description:"No API key needed if you're logged into Claude Code. vskill just runs the official claude binary on your behalf under your Pro/Max subscription.",loginHint:"If you're not logged in, run claude in your terminal and authenticate with your Pro/Max account.",learnMoreUrl:"https://docs.claude.com/en/docs/claude-code"}},J={sidebar:Eb,shell:Tb,detail:Rb,actions:Ab,palette:Mb,shortcuts:zb,toasts:Lb,connection:Db,forms:_b,errors:Ob,picker:Bb,providers:Ib,models:Hb,settings:Ub,statusBar:Vb,scopePicker:$b,scopeSection:Gb,claudeCodeLabel:Pb,setupDrawer:qb,setupProviders:Fb,scopeLabels:Yb},tx=new Set(["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function Wb({agents:a,activeAgentId:r,focusedAgentId:i,onFocus:o,onSelect:u,onOpenSettings:p}){const f=a.filter(x=>tx.has(x.id)),h=a.filter(x=>!tx.has(x.id));return n.jsxs("div",{role:"listbox","aria-label":"Agent","data-testid":"agent-list",style:{width:240,borderRight:"1px solid var(--border-default, var(--border-subtle))",display:"flex",flexDirection:"column",overflowY:"auto"},children:[f.map(x=>n.jsx(nx,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:u,onOpenSettings:p},x.id)),h.length>0&&n.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),h.map(x=>n.jsx(nx,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:u,onOpenSettings:p},x.id))]})}function nx({agent:a,isActive:r,isFocused:i,onFocus:o,onSelect:u,onOpenSettings:p}){const{providers:f}=J,h={"claude-cli":f.claudeCli.caption,anthropic:f.anthropic.caption,openrouter:f.openrouter.caption},x={"claude-cli":{label:f.claudeCli.installCta,url:f.claudeCli.installUrl},cursor:{label:f.cursor.installCta},"codex-cli":{label:f.codexCli.installCta},"gemini-cli":{label:f.geminiCli.installCta},copilot:{label:f.copilot.installCta},zed:{label:f.zed.installCta}},m=a.id==="claude-cli"||a.id==="claude-code",y={minHeight:36,height:m?"auto":36,padding:m?"6px 12px":"0 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",position:"relative",background:i?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:r?500:400,color:"var(--text-primary)"};return r&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),n.jsxs("div",{role:"option","aria-selected":r,"data-testid":`agent-row-${a.id}`,"data-focused":i||void 0,tabIndex:i?0:-1,onMouseEnter:()=>o(a.id),onFocus:()=>o(a.id),onClick:()=>u(a.id),style:y,children:[a.wrapperFolder&&n.jsx("span",{"data-testid":`wrapper-dot-${a.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:a.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:a.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!a.wrapperFolder&&n.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),n.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.displayName}),(a.id==="claude-cli"||a.id==="claude-code")&&n.jsx("span",{"data-testid":"claude-code-billing-label",title:J.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:J.claudeCodeLabel.compactLabel})]}),n.jsx("span",{"aria-label":a.available?"available":"locked",style:{color:a.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:a.available?n.jsx(dd,{unlocked:!0,size:10}):n.jsx(dd,{size:10})}),r&&n.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${a.id}`,children:J.picker.currentlyActive}),!a.available&&a.ctaType==="api-key"&&n.jsx(Gu,{variant:"api-key",label:a.id==="anthropic"?f.anthropic.addKeyCta:f.openrouter.addKeyCta,onActivate:()=>p(a.id)}),!a.available&&a.ctaType==="cli-install"&&x[a.id]&&n.jsx(Gu,{variant:"cli-install",label:x[a.id].label,installUrl:x[a.id].url,onActivate:()=>{}}),!a.available&&a.ctaType==="start-service"&&n.jsx(Gu,{variant:"start-service",label:a.id==="ollama"?f.ollama.startServiceCta:f.lmStudio.startServiceCta,onActivate:()=>p(a.id)}),h[a.id]&&n.jsx("span",{className:"sr-only","data-testid":`caption-${a.id}`,children:h[a.id]})]})}function Kb(a,r,i,o){const f=a>=80,h=v.useRef(null),[x,m]=v.useState(0),y=v.useCallback(S=>{m(S.currentTarget.scrollTop)},[]),{visibleStart:g,visibleEnd:j}=v.useMemo(()=>{if(!f)return{visibleStart:0,visibleEnd:a};const S=Math.max(0,Math.floor(x/r)-4),N=Math.ceil(i/r)+8,L=Math.min(a,S+N);return{visibleStart:S,visibleEnd:L}},[f,x,r,i,a,4]);return{visibleStart:g,visibleEnd:j,totalHeight:a*r,offsetTop:g*r,virtualised:f,containerProps:{onScroll:y,ref:h,style:{overflowY:"auto",maxHeight:i,willChange:f?"transform":void 0}}}}const pv=44,Xb=352,Qb=60;function Zb(a){var p,f;const r=a.contextWindow?a.contextWindow>=1e6?`${Math.round(a.contextWindow/1e6)}M`:a.contextWindow>=1e3?`${Math.round(a.contextWindow/1e3)}k`:String(a.contextWindow):null;if(a.billingMode==="subscription")return r?`${r} ctx ${J.models.subscriptionBilling}`:J.models.subscriptionBilling.trim();if(a.billingMode==="free")return r?`local · ${r} ctx · free`:"local · free";const i=((p=a.pricing)==null?void 0:p.prompt)??0,o=((f=a.pricing)==null?void 0:f.completion)??0,u=`$${i.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return r?`${r} ctx · ${u}`:u}function Jb(a,r){if(!r)return a;const i=r.toLowerCase();return a.filter(u=>u.displayName.toLowerCase().includes(i)).sort((u,p)=>{const f=u.displayName.toLowerCase().indexOf(i),h=p.displayName.toLowerCase().indexOf(i);return f!==h?f-h:u.displayName.length-p.displayName.length})}function e0({agent:a,activeModelId:r,onSelect:i,onOpenSettings:o}){const[u,p]=v.useState(""),[f,h]=v.useState(""),x=v.useRef(null);if(v.useEffect(()=>{const g=setTimeout(()=>h(u),Qb);return()=>clearTimeout(g)},[u]),v.useEffect(()=>{a.id==="openrouter"&&a.available&&x.current&&x.current.focus()},[a.id,a.available]),a.id==="openrouter"&&!a.available)return n.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:360,padding:20,display:"flex",flexDirection:"column",gap:12},children:[n.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:J.providers.openrouter.emptyCardBody}),n.jsx("button",{type:"button",onClick:()=>o("openrouter"),style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:6,background:"var(--accent, var(--color-accent))",color:"var(--bg-surface, white)",border:"none",fontSize:12,fontWeight:500,cursor:"pointer"},children:J.providers.openrouter.addKeyCta})]});const m=v.useMemo(()=>Jb(a.models,f),[a.models,f]),y=Kb(m.length,pv,Xb);return n.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:360,display:"flex",flexDirection:"column"},children:[a.id==="openrouter"&&n.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:n.jsx("input",{ref:x,type:"text",placeholder:J.picker.searchPlaceholder,value:u,onChange:g=>p(g.target.value),"data-testid":"model-search-input","aria-label":J.picker.searchPlaceholder,style:{width:"100%",padding:"6px 8px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"}})}),m.length===0&&f?n.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[n.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:J.picker.noMatches(f)}),n.jsx("button",{type:"button",onClick:()=>p(""),style:{padding:"4px 8px",background:"transparent",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:J.picker.clearSearch})]}):m.length===0?n.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:J.picker.noModelsYet}):n.jsx("div",{...y.containerProps,children:n.jsx("div",{style:{height:y.virtualised?y.totalHeight:"auto",position:"relative"},children:n.jsx("div",{style:{transform:y.virtualised?`translateY(${y.offsetTop}px)`:void 0},children:m.slice(y.visibleStart,y.visibleEnd).map(g=>n.jsx(t0,{model:g,isActive:g.id===r,onSelect:()=>i(g.id)},g.id))})})})]})}function t0({model:a,isActive:r,onSelect:i}){const o=Zb(a);return n.jsxs("button",{type:"button",role:"option","aria-selected":r,"data-testid":`model-row-${a.id}`,onClick:i,title:a.id,style:{width:"100%",height:pv,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:r?"color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",textAlign:"left"},children:[n.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:o})]})}const ax={anthropic:{stored:!1,updatedAt:null,tier:"browser"},openrouter:{stored:!1,updatedAt:null,tier:"browser"}};function n0(){const[a,r]=v.useState(null),[i,o]=v.useState(!0),[u,p]=v.useState(null),f=v.useCallback(async()=>{o(!0);try{const m=await fetch("/api/settings/keys");if(!m.ok)throw new Error(`GET /api/settings/keys returned ${m.status}`);const y=await m.json();r({...ax,...y}),p(null)}catch(m){p(m.message),r(ax)}finally{o(!1)}},[]);v.useEffect(()=>{f()},[f]);const h=v.useCallback(async(m,y,g="browser")=>{const j=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:m,key:y,tier:g})});if(!j.ok){const N=await j.json().catch(()=>({error:j.statusText}));throw new Error(N.error||`POST /api/settings/keys returned ${j.status}`)}const S=await j.json();return await f(),S},[f]),x=v.useCallback(async m=>{const y=await fetch(`/api/settings/keys/${m}`,{method:"DELETE"});if(!y.ok)throw new Error(`DELETE /api/settings/keys/${m} returned ${y.status}`);await f()},[f]);return{state:a,loading:i,error:u,save:h,remove:x,refresh:f}}const a0=[{id:"anthropic",name:J.providers.anthropic.name,keyIssuanceUrl:J.providers.anthropic.keyIssuanceUrl,prefix:J.providers.anthropic.keyPrefix},{id:"openrouter",name:J.providers.openrouter.name,keyIssuanceUrl:J.providers.openrouter.keyIssuanceUrl,prefix:J.providers.openrouter.keyPrefix}];function l0(){return typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform)}function r0(a){const r=Date.now()-new Date(a).getTime();return r<6e4?"just now":r<36e5?`${Math.round(r/6e4)}m ago`:r<864e5?`${Math.round(r/36e5)}h ago`:new Date(a).toLocaleString()}function s0({open:a,onClose:r,initialProvider:i,onToast:o}){const{state:u,save:p,remove:f}=n0(),[h,x]=v.useState("browser"),m=v.useRef(null),y=v.useRef(null),[g,j]=v.useState(i??"anthropic");if(v.useEffect(()=>{if(!a)return;const N=document.activeElement,L=setTimeout(()=>{var M;const T=i?`input[data-provider="${i}"]`:"input[data-provider]",k=(M=m.current)==null?void 0:M.querySelector(T);k==null||k.focus()},0);return()=>{var T;clearTimeout(L),(T=N==null?void 0:N.focus)==null||T.call(N)}},[a,i]),v.useEffect(()=>{if(!a)return;const N=L=>{if(L.key==="Escape"){L.preventDefault(),r();return}if(L.key==="Tab"&&m.current){const T=m.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(T.length===0)return;const k=T[0],M=T[T.length-1];L.shiftKey&&document.activeElement===k?(L.preventDefault(),M.focus()):!L.shiftKey&&document.activeElement===M&&(L.preventDefault(),k.focus())}};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[a,r]),!a)return null;const S=l0();return n.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title","data-testid":"settings-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, black 40%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:N=>{N.target===N.currentTarget&&r()},children:n.jsxs("div",{ref:m,style:{background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,width:560,maxHeight:"80vh",overflowY:"auto",padding:20,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",color:"var(--text-primary)"},onClick:N=>N.stopPropagation(),children:[n.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:J.settings.title}),n.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:J.settings.banner}),n.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[n.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionApiKeys}),a0.map(N=>n.jsx(i0,{providerId:N.id,providerName:N.name,keyIssuanceUrl:N.keyIssuanceUrl,prefix:N.prefix,metadata:u==null?void 0:u[N.id],tier:h,onSave:async L=>{const T=await p(N.id,L,h);return o==null||o(J.settings.keySaved(N.name)),T},onRemove:async()=>{await f(N.id),o==null||o(J.settings.keyRemoved(N.name))},inputRef:N.id===(i??"anthropic")?y:void 0},N.id))]}),n.jsxs("section",{"aria-labelledby":"settings-storage-title",children:[n.jsx("h3",{id:"settings-storage-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionStorage}),S?n.jsxs("fieldset",{style:{border:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:6},children:[n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"browser",checked:h==="browser",onChange:()=>x("browser")}),J.settings.storageBrowser]}),n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"keychain",checked:h==="keychain",onChange:()=>x("keychain")}),J.settings.storageKeychain]})]}):n.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, var(--text-tertiary))"},children:[J.settings.storageBrowser,n.jsxs("span",{title:J.settings.storageDarwinOnly,style:{marginLeft:8},children:["(",J.settings.storageDarwinOnly,")"]})]})]}),n.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:n.jsx("button",{type:"button",onClick:r,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})})}function i0({providerId:a,providerName:r,keyIssuanceUrl:i,prefix:o,metadata:u,onSave:p,onRemove:f,inputRef:h}){const[x,m]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState(!1),[N,L]=v.useState(!1),[T,k]=v.useState(null),M=x.trim(),O=M.length===0,V=M.length>0&&!M.startsWith(o),A=v.useCallback(async()=>{if(!O){S(!0);try{const D=await p(M);D.warning?k(D.warning):k(null),m("")}finally{S(!1)}}},[O,p,M]),U=v.useCallback(async()=>{var D;try{if(!((D=navigator.clipboard)!=null&&D.readText))return;const R=await navigator.clipboard.readText();m(R)}catch{}},[]),w=v.useCallback(async()=>{L(!1),await f()},[f]);return n.jsxs("div",{"data-testid":`provider-row-${a}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n.jsx("strong",{style:{fontSize:13},children:r}),n.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),n.jsxs("div",{style:{display:"flex",gap:6},children:[n.jsx("input",{ref:h,type:y?"text":"password",value:x,onChange:D=>{m(D.target.value),k(null)},"data-provider":a,placeholder:`Paste ${r} key`,style:{flex:1,padding:"6px 8px",border:"1px solid var(--border-subtle)",borderRadius:4,background:"var(--surface-2, var(--bg-surface))",color:"var(--text-primary)",fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"}}),n.jsx("button",{type:"button",onClick:()=>g(!y),style:ir,children:y?J.settings.hide:J.settings.show}),n.jsx("button",{type:"button",onClick:U,style:ir,children:J.settings.paste})]}),O&&x.length>0&&n.jsx("div",{role:"status",style:o0,children:J.settings.enterNonEmpty}),V&&n.jsx("div",{role:"status","data-testid":`prefix-warn-${a}`,style:lx,children:J.settings.prefixWarn(r)}),T&&n.jsx("div",{role:"status",style:lx,children:T}),n.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[n.jsx("button",{type:"button",onClick:A,disabled:O||j,"data-testid":`save-${a}`,style:{...ir,background:O?"var(--surface-2)":"var(--accent, var(--color-accent))",color:O?"var(--text-muted)":"white",cursor:O?"not-allowed":"pointer"},children:J.settings.save}),(u==null?void 0:u.stored)&&n.jsx(n.Fragment,{children:N?n.jsxs(n.Fragment,{children:[n.jsx("span",{style:{fontSize:12},children:J.settings.removeConfirm(r)}),n.jsx("button",{type:"button",onClick:w,"data-testid":`remove-confirm-${a}`,style:{...ir,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),n.jsx("button",{type:"button",onClick:()=>L(!1),style:ir,children:"Cancel"})]}):n.jsx("button",{type:"button",onClick:()=>L(!0),"data-testid":`remove-${a}`,style:{...ir,color:"var(--text-muted)"},children:J.settings.remove})}),n.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${a}`,children:u!=null&&u.stored&&u.updatedAt?J.settings.keyStoredAt(r0(u.updatedAt)):J.settings.noKey})]})]})}const ir={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},o0={fontSize:11,color:"var(--danger, #b33)"},lx={fontSize:11,color:"var(--warning, var(--text-muted))"};function c0(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function u0({onToast:a}){const{status:r,catalog:i,focusAgent:o,setActive:u}=Nb({onStaleCatalog:(D,R)=>{const I=Math.round(R/6e4);a==null||a(`Using cached ${D} catalog (${I} min old)`)}}),[p,f]=v.useState(!1),[h,x]=v.useState(!1),[m,y]=v.useState(),[g,j]=v.useState(null),[S,N]=v.useState("agents"),L=v.useRef(null);v.useRef(null),v.useEffect(()=>{var D;i&&!g&&j(i.activeAgent??((D=i.agents[0])==null?void 0:D.id)??null)},[i,g]);const T=(i==null?void 0:i.agents)??[],k=v.useMemo(()=>T.find(D=>D.id===g)??T[0],[T,g]),M=v.useCallback(()=>{var D;f(!0),N("agents"),j((i==null?void 0:i.activeAgent)??((D=T[0])==null?void 0:D.id)??null)},[i,T]),O=v.useCallback(()=>{var D;f(!1),(D=L.current)==null||D.focus()},[]);v.useEffect(()=>{const D=R=>{var G;if(!(R.metaKey||R.ctrlKey)||R.key.toLowerCase()!=="k")return;const I=(G=document.activeElement)==null?void 0:G.tagName;I==="INPUT"||I==="TEXTAREA"||(R.preventDefault(),f(q=>!q))};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]),v.useEffect(()=>{if(!p)return;const D=I=>{if(I.key==="Escape"){I.preventDefault(),O();return}if(I.key==="ArrowDown"){I.preventDefault(),R(1);return}if(I.key==="ArrowUp"){I.preventDefault(),R(-1);return}if(I.key==="ArrowRight"&&S==="agents"){I.preventDefault(),N("models");return}if(I.key==="ArrowLeft"&&S==="models"){I.preventDefault(),N("agents");return}if(I.key==="Enter"){I.preventDefault(),S==="agents"&&k?N("models"):S==="models"&&k&&k.models[0]&&(u(k.id,k.models[0].id),O());return}};function R(I){if(S==="agents"){const G=T.findIndex(te=>te.id===g),q=T[Math.max(0,Math.min(T.length-1,G+I))];q&&(j(q.id),o(q.id))}}return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[p,S,T,g,k,O,o,u]);const V=v.useCallback(D=>{y(D==="anthropic"||D==="openrouter"?D:void 0),x(!0),f(!1)},[]),A=T.find(D=>D.id===(i==null?void 0:i.activeAgent)),U=A==null?void 0:A.models.find(D=>D.id===(i==null?void 0:i.activeModel)),w=v.useMemo(()=>{if(r!=="ready"||!i)return"Loading…";const D=(A==null?void 0:A.displayName)??"Agent",R=(U==null?void 0:U.displayName)??i.activeModel??"Model";return`${D} · ${R}`},[r,i,A,U]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:L,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>p?O():M(),"aria-haspopup":"listbox","aria-expanded":p,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:A!=null&&A.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),n.jsx("span",{children:w})]}),p&&typeof document<"u"&&mo.createPortal(n.jsxs(d0,{reducedMotion:c0(),onClickOutside:O,children:[n.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[n.jsx(Wb,{agents:T,activeAgentId:(i==null?void 0:i.activeAgent)??null,focusedAgentId:g,onFocus:D=>{j(D),o(D)},onSelect:D=>{j(D),o(D),N("models")},onOpenSettings:V}),k&&n.jsx(e0,{agent:k,activeModelId:(i==null?void 0:i.activeModel)??null,onSelect:D=>{u(k.id,D),O()},onOpenSettings:V})]}),n.jsxs("div",{style:{height:32,borderTop:"1px solid var(--border-default, var(--border-subtle))",padding:"0 12px",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},children:[n.jsx("button",{type:"button",onClick:()=>V(),"data-testid":"picker-footer-settings",style:{background:"transparent",border:"none",color:"var(--text-primary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.picker.settingsButton}),n.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:J.picker.footerHint})]})]}),document.body),n.jsx(s0,{open:h,onClose:()=>x(!1),initialProvider:m,onToast:a})]})}function d0({children:a,reducedMotion:r,onClickOutside:i}){const o=v.useRef(null);return v.useEffect(()=>{const u=p=>{o.current&&!o.current.contains(p.target)&&i()};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]),n.jsxs("div",{ref:o,"data-testid":"agent-model-picker-popover",role:"dialog","aria-label":"Select agent and model",style:{position:"fixed",top:56,left:"50%",transform:"translateX(-50%)",width:600,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,overflow:"hidden",zIndex:90,animation:r?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[a,n.jsx("style",{children:`@keyframes agentPickerFadeIn {
|
|
52
52
|
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
53
53
|
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
54
|
-
}`})]})}function lx(){typeof window>"u"||(window.location.hash="#/")}function f0({onHome:a}){const[r,i]=v.useState(!1),[o,u]=v.useState(!1),p=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),lx(),a==null||a())},f=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),lx(),a==null||a())};return n.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:p,onKeyDown:f,onFocus:()=>i(!0),onBlur:()=>i(!1),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0,padding:"4px 6px",margin:"-4px -6px",borderRadius:6,textDecoration:"none",color:"inherit",cursor:"pointer",outline:r?"2px solid var(--border-focus)":"none",outlineOffset:2,background:o?"color-mix(in srgb, var(--text-primary) 4%, transparent)":"transparent",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,background:"color-mix(in srgb, var(--accent-surface) 20%, transparent)"},children:n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-surface)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),n.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const p0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='1.75'%20stroke-linecap='round'%20stroke-linejoin='round'%20aria-hidden='true'%20focusable='false'%3e%3cpath%20d='M5.5%2017h11l-1.2-1.8a2%202%200%200%201-.3-1.1V10a4%204%200%201%200-8%200v4.1a2%202%200%200%201-.3%201.1L5.5%2017Z'%20/%3e%3cpath%20d='M10%2020a2%202%200%200%200%204%200'%20/%3e%3ccircle%20cx='17'%20cy='7'%20r='2.2'%20fill='currentColor'%20stroke='none'%20/%3e%3c/svg%3e",m0=v.lazy(()=>Cd(()=>import("./UpdateDropdown-BThJVKcK.js"),__vite__mapDeps([0,1])));function h0(){const{updateCount:a,updates:r,isRefreshingUpdates:i,refreshUpdates:o,selectSkill:u}=ya(),[p,f]=v.useState(!1),h=v.useRef(null),x=v.useCallback(()=>f(!1),[]),m=a>0?"var(--text-primary)":"var(--text-secondary)",y=a>9?"9+":String(a),g=a===0?"No updates available":`${a} updates available, open summary`;return n.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[n.jsxs("button",{ref:h,type:"button","data-testid":"update-bell","aria-label":g,"aria-haspopup":"dialog","aria-expanded":p,onClick:()=>f(j=>!j),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:26,width:26,padding:0,borderRadius:4,border:"1px solid transparent",background:"transparent",color:m,cursor:"pointer"},children:[n.jsx("img",{src:p0,alt:"",width:18,height:18,style:{display:"block",opacity:a>0?1:.75}}),a>0&&n.jsx("span",{"data-testid":"update-bell-badge","aria-hidden":"true",style:{position:"absolute",top:-2,right:-2,minWidth:14,height:14,padding:"0 3px",borderRadius:999,background:"var(--color-own)",color:"var(--color-paper)",fontSize:9,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:600,lineHeight:1},children:y})]}),p&&n.jsx(v.Suspense,{fallback:n.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:n.jsx(m0,{updates:r,isRefreshing:i,onRefresh:()=>o(),onSelectSkill:j=>{const S=j.name.split("/"),N=S.length>=2?S[S.length-2]:S[0],z=S[S.length-1];u({plugin:N,skill:z,origin:"installed"}),x()},onViewAll:()=>{window.location.hash="#/updates",x()},onClose:x,anchorRef:h})})]})}function rx(a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:a}))}function x0({projectName:a,selected:r,onOpenPalette:i,onHome:o,projectPickerSlot:u,onRequestCreateSkill:p}){const f=r?r.origin==="installed"?"Installed":"Own":null;return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[n.jsx(f0,{onHome:o}),u?n.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:u}):a&&n.jsx("span",{title:a,style:{fontSize:12,color:"var(--text-secondary)",borderLeft:"1px solid var(--border-default)",paddingLeft:10,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a})]}),n.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:r&&f&&n.jsxs(n.Fragment,{children:[n.jsx(sx,{segment:"origin",onClick:()=>rx({scope:"origin",origin:r.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:r.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:f}),n.jsx(ix,{}),n.jsx(sx,{segment:"plugin",onClick:()=>rx({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),n.jsx(ix,{}),n.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.skill})]})}),n.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[p&&n.jsxs("button",{type:"button","data-slot":"create-skill-button",onClick:p,"aria-label":"Create a new skill",title:"Create a new skill",style:{display:"inline-flex",alignItems:"center",gap:6,height:28,padding:"0 12px",borderRadius:6,border:"none",background:"var(--color-accent, #2f6f8f)",color:"var(--color-paper, #fff)",fontSize:12,fontWeight:600,fontFamily:"var(--font-sans)",cursor:"pointer",letterSpacing:"0.01em"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]}),n.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:n.jsx(u0,{})}),n.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:n.jsx(h0,{})}),n.jsx("button",{type:"button",onClick:i,"aria-label":"Open command palette",title:"Command palette (⌘K)",style:{display:"inline-flex",alignItems:"center",gap:6,height:26,padding:"0 10px",borderRadius:4,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:"pointer"},children:n.jsx("span",{children:"⌘K"})})]})]})}function sx({segment:a,onClick:r,style:i,children:o}){return n.jsx("button",{type:"button","data-breadcrumb-segment":a,onClick:r,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...i},onMouseEnter:u=>{u.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:u=>{const p=(i==null?void 0:i.color)??"var(--text-secondary)";u.currentTarget.style.color=p},children:o})}function ix(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const ho="vskill-theme";function mv(a){return a==="light"||a==="dark"||a==="auto"?a:"auto"}function v0(a,r){return a==="light"||a==="dark"?a:r?"dark":"light"}function g0(a){try{const r=a.getItem(ho);return mv(r)}catch{return"auto"}}function y0(a,r){try{a.setItem(ho,r)}catch{}}function b0(a,r,i){a.dataset.theme=i,a.dataset.themeMode=r}function j0(a){if(!a)return!1;try{return a("(prefers-color-scheme: dark)").matches}catch{return!1}}const hv=v.createContext(null);function S0({storage:a,matchMedia:r,target:i,children:o}){const u=a??(typeof window<"u"?window.localStorage:void 0),p=r??(typeof window<"u"?window.matchMedia.bind(window):void 0),f=i??(typeof document<"u"?document.documentElement:void 0),[h,x]=v.useState(()=>u?g0(u):"auto"),[m,y]=v.useState(()=>j0(p)),g=v.useMemo(()=>v0(h,m),[h,m]);v.useEffect(()=>{f&&b0(f,h,g)},[f,h,g]),v.useEffect(()=>{if(!p)return;const N=p("(prefers-color-scheme: dark)"),z=k=>y(k.matches);if(typeof N.addEventListener=="function")return N.addEventListener("change",z),()=>N.removeEventListener("change",z);const T=N;return T.addListener(z),()=>T.removeListener(z)},[p]),v.useEffect(()=>{if(typeof window>"u")return;const N=z=>{z.key===ho&&x(mv(z.newValue))};return window.addEventListener("storage",N),()=>window.removeEventListener("storage",N)},[]),v.useEffect(()=>{if(!p||!f)return;let N;try{N=p("(prefers-contrast: more)")}catch{return}const z=M=>{M?f.dataset.contrast="more":f.dataset.contrast==="more"&&delete f.dataset.contrast};z(N.matches);const T=M=>z(M.matches);if(typeof N.addEventListener=="function")return N.addEventListener("change",T),()=>N.removeEventListener("change",T);const k=N;return k.addListener(T),()=>k.removeListener(T)},[p,f]);const j=v.useCallback(N=>{x(N),u&&y0(u,N)},[u]),S=v.useMemo(()=>({mode:h,resolvedTheme:g,setTheme:j}),[h,g,j]);return n.jsx(hv.Provider,{value:S,children:o})}function xv(){const a=v.useContext(hv);if(!a)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return a}const ox=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function k0(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of ox){const u=r.get(o);u&&i.push(u)}for(const o of a)ox.includes(o.id)||i.push(o);return i}function w0(a){const[r,i]=v.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${a}px)`).matches);return v.useEffect(()=>{var p;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${a}px)`),u=()=>i(o.matches);return(p=o.addEventListener)==null||p.call(o,"change",u),()=>{var f;return(f=o.removeEventListener)==null?void 0:f.call(o,"change",u)}},[a]),r}function C0({providers:a,onOpenSettings:r,onOpenInstallHelp:i}){const o=k0(a),u=w0(640),[p,f]=v.useState(!1),h=v.useCallback(x=>{x.available||x.kind==="api-key"?r==null||r(x.id):i==null||i(x.id)},[r,i]);if(u){const x=o.filter(m=>m.available).length;return n.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[n.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>f(!p),"aria-label":J.statusBar.providerSummary(x,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.statusBar.providerSummary(x,o.length)}),p&&n.jsx("div",{role:"menu",style:{position:"absolute",bottom:"120%",right:0,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,padding:6,minWidth:180,display:"flex",flexDirection:"column",gap:2,zIndex:80},children:o.map(m=>n.jsx(cx,{p:m,onClick:h},m.id))})]})}return n.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(x=>n.jsx(cx,{p:x,onClick:h,compact:!0},x.id))})}function cx({p:a,onClick:r,compact:i}){const o=a.available?J.statusBar.unlocked(a.label):a.kind==="cli-install"?J.statusBar.lockedCli(a.label):J.statusBar.locked(a.label);return n.jsxs("button",{type:"button","data-testid":`provider-glyph-${a.id}`,"data-available":a.available,"aria-label":o,title:o,onClick:()=>r(a),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:a.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:i?"2px":"4px 6px",fontSize:11},children:[n.jsx(ud,{unlocked:a.available,size:10}),!i&&n.jsx("span",{children:a.label})]})}function N0(){try{return typeof localStorage>"u"?null:localStorage.getItem(ho)}catch{return null}}function E0({projectPath:a,modelName:r,health:i="ok",onPathClick:o,providers:u,onOpenProviderSettings:p,onOpenProviderInstallHelp:f}){const{mode:h,resolvedTheme:x,setTheme:m}=xv(),g=N0()==="auto",j=T0(h,x,g),S=i==="down"||i==="degraded"?"var(--status-own)":"var(--status-installed)";return n.jsxs("div",{role:"contentinfo",style:{display:"flex",alignItems:"center",gap:12,height:"100%",width:"100%",padding:"0 12px",fontSize:11,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[n.jsx("span",{title:r??"",style:{fontFamily:"var(--font-mono)"},children:r??"—"}),n.jsx(ux,{}),n.jsxs("span",{"aria-label":`Health: ${i}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.jsx(R0,{color:S}),n.jsx("span",{style:{textTransform:"capitalize"},children:i})]}),u&&u.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(ux,{}),n.jsx(C0,{providers:u,onOpenSettings:p,onOpenInstallHelp:f})]}),n.jsx("div",{style:{flex:1}}),n.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>m(j),"aria-label":`Switch to ${j} theme`,title:`Theme: ${h} — click for ${j}`,style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"1px solid var(--border-default)",padding:"2px 8px",borderRadius:4,color:"var(--text-secondary)",cursor:"pointer",fontSize:11,height:20},children:[n.jsx(A0,{mode:h}),n.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function T0(a,r,i){return a==="light"?"dark":a==="dark"?"auto":i?"light":r==="light"?"dark":"light"}function R0({color:a}){return n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:a,display:"inline-block",flexShrink:0}})}function ux(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function A0({mode:a}){return a==="dark"?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):a==="light"?n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"4"}),n.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"9"}),n.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const xo=0,Wa=1,xr=2,vv=4;function dx(a){return()=>a}function M0(a){a()}function gv(a,r){return i=>a(r(i))}function fx(a,r){return()=>a(r)}function z0(a,r){return i=>a(r,i)}function Nd(a){return a!==void 0}function L0(...a){return()=>{a.map(M0)}}function vr(){}function vo(a,r){return r(a),a}function D0(a,r){return r(a)}function ht(...a){return a}function et(a,r){return a(Wa,r)}function He(a,r){a(xo,r)}function Ed(a){a(xr)}function yt(a){return a(vv)}function Ce(a,r){return et(a,z0(r,xo))}function $n(a,r){const i=a(Wa,o=>{i(),r(o)});return i}function px(a){let r,i;return o=>u=>{r=u,i&&clearTimeout(i),i=setTimeout(()=>{o(r)},a)}}function yv(a,r){return a===r}function mt(a=yv){let r;return i=>o=>{a(r,o)||(r=o,i(o))}}function Ae(a){return r=>i=>{a(i)&&r(i)}}function ye(a){return r=>gv(r,a)}function Wn(a){return r=>()=>{r(a)}}function de(a,...r){const i=_0(...r);return((o,u)=>{switch(o){case xr:Ed(a);return;case Wa:return et(a,i(u))}})}function Kn(a,r){return i=>o=>{i(r=a(r,o))}}function yl(a){return r=>i=>{a>0?a--:r(i)}}function ga(a){let r=null,i;return o=>u=>{r=u,!i&&(i=setTimeout(()=>{i=void 0,o(r)},a))}}function $e(...a){const r=new Array(a.length);let i=0,o=null;const u=2**a.length-1;return a.forEach((p,f)=>{const h=2**f;et(p,x=>{const m=i;i|=h,r[f]=x,m!==u&&i===u&&o&&(o(),o=null)})}),p=>f=>{const h=()=>{p([f].concat(r))};i===u?h():o=h}}function _0(...a){return r=>a.reduceRight(D0,r)}function O0(a){let r,i;const o=()=>r==null?void 0:r();return function(u,p){switch(u){case Wa:return p?i===p?void 0:(o(),i=p,r=et(a,p),r):(o(),vr);case xr:o(),i=null;return}}}function pe(a){let r=a;const i=Ke();return((o,u)=>{switch(o){case xo:r=u;break;case Wa:{u(r);break}case vv:return r}return i(o,u)})}function Qt(a,r){return vo(pe(r),i=>Ce(a,i))}function Ke(){const a=[];return((r,i)=>{switch(r){case xo:a.slice().forEach(o=>{o(i)});return;case xr:a.splice(0,a.length);return;case Wa:return a.push(i),()=>{const o=a.indexOf(i);o>-1&&a.splice(o,1)}}})}function jn(a){return vo(Ke(),r=>Ce(a,r))}function Ze(a,r=[],{singleton:i}={singleton:!0}){return{constructor:a,dependencies:r,id:B0(),singleton:i}}const B0=()=>Symbol();function I0(a){const r=new Map,i=({constructor:o,dependencies:u,id:p,singleton:f})=>{if(f&&r.has(p))return r.get(p);const h=o(u.map(x=>i(x)));return f&&r.set(p,h),h};return i(a)}function Dt(...a){const r=Ke(),i=new Array(a.length);let o=0;const u=2**a.length-1;return a.forEach((p,f)=>{const h=2**f;et(p,x=>{i[f]=x,o|=h,o===u&&He(r,i)})}),function(p,f){switch(p){case xr:{Ed(r);return}case Wa:return o===u&&f(i),et(r,f)}}}function Re(a,r=yv){return de(a,mt(r))}function dd(...a){return function(r,i){switch(r){case xr:return;case Wa:return L0(...a.map(o=>et(o,i)))}}}const Bt={DEBUG:0,INFO:1,WARN:2,ERROR:3},H0={[Bt.DEBUG]:"debug",[Bt.ERROR]:"error",[Bt.INFO]:"log",[Bt.WARN]:"warn"},U0=()=>typeof globalThis>"u"?window:globalThis,Ka=Ze(()=>{const a=pe(Bt.ERROR);return{log:pe((r,i,o=Bt.INFO)=>{const u=U0().VIRTUOSO_LOG_LEVEL??yt(a);o>=u&&console[H0[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,i)}),logLevel:a}},[],{singleton:!0});function jl(a,r,i){return Td(a,r,i).callbackRef}function Td(a,r,i){const o=we.useRef(null);let u=f=>{};const p=we.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(f=>{const h=()=>{const x=f[0].target;x.offsetParent!==null&&a(x)};i?h():requestAnimationFrame(h)}):null,[a,i]);return u=f=>{f&&r?(p==null||p.observe(f),o.current=f):(o.current&&(p==null||p.unobserve(o.current)),o.current=null)},{callbackRef:u,ref:o}}function V0(a,r,i,o,u,p,f,h,x){const m=we.useCallback(y=>{const g=$0(y.children,r,h?"offsetWidth":"offsetHeight",u);let j=y.parentElement;for(;j.dataset.virtuosoScroller===void 0;)j=j.parentElement;const S=j.lastElementChild.dataset.viewportType==="window";let N;S&&(N=j.ownerDocument.defaultView);const z=f?h?f.scrollLeft:f.scrollTop:S?h?N.scrollX||N.document.documentElement.scrollLeft:N.scrollY||N.document.documentElement.scrollTop:h?j.scrollLeft:j.scrollTop,T=f?h?f.scrollWidth:f.scrollHeight:S?h?N.document.documentElement.scrollWidth:N.document.documentElement.scrollHeight:h?j.scrollWidth:j.scrollHeight,k=f?h?f.offsetWidth:f.offsetHeight:S?h?N.innerWidth:N.innerHeight:h?j.offsetWidth:j.offsetHeight;o({scrollHeight:T,scrollTop:Math.max(z,0),viewportHeight:k}),p==null||p(h?mx("column-gap",getComputedStyle(y).columnGap,u):mx("row-gap",getComputedStyle(y).rowGap,u)),g!==null&&a(g)},[a,r,u,p,f,o,h]);return Td(m,i,x)}function $0(a,r,i,o){const u=a.length;if(u===0)return null;const p=[];for(let f=0;f<u;f++){const h=a.item(f);if(h.dataset.index===void 0)continue;const x=parseInt(h.dataset.index),m=parseFloat(h.dataset.knownSize),y=r(h,i);if(y===0&&o("Zero-sized element, this should not happen",{child:h},Bt.ERROR),y===m)continue;const g=p[p.length-1];p.length===0||g.size!==y||g.endIndex!==x-1?p.push({endIndex:x,size:y,startIndex:x}):p[p.length-1].endIndex++}return p}function mx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,Bt.WARN),r==="normal"?0:parseInt(r??"0",10)}function bv(a,r,i){const o=we.useRef(null),u=we.useCallback(x=>{if(!(x!=null&&x.offsetParent))return;const m=x.getBoundingClientRect(),y=m.width;let g,j;if(r){const S=r.getBoundingClientRect(),N=m.top-S.top;j=S.height-Math.max(0,N),g=N+r.scrollTop}else{const S=f.current.ownerDocument.defaultView;j=S.innerHeight-Math.max(0,m.top),g=m.top+S.scrollY}o.current={listHeight:m.height,offsetTop:g,visibleHeight:j,visibleWidth:y},a(o.current)},[a,r]),{callbackRef:p,ref:f}=Td(u,!0,i),h=we.useCallback(()=>{u(f.current)},[u,f]);return we.useEffect(()=>{var m;if(r){r.addEventListener("scroll",h);const y=new ResizeObserver(()=>{requestAnimationFrame(h)});return y.observe(r),()=>{r.removeEventListener("scroll",h),y.unobserve(r)}}const x=(m=f.current)==null?void 0:m.ownerDocument.defaultView;return x==null||x.addEventListener("scroll",h),x==null||x.addEventListener("resize",h),()=>{x==null||x.removeEventListener("scroll",h),x==null||x.removeEventListener("resize",h)}},[h,r,f]),p}const an=Ze(()=>{const a=Ke(),r=Ke(),i=pe(0),o=Ke(),u=pe(0),p=Ke(),f=Ke(),h=pe(0),x=pe(0),m=pe(0),y=pe(0),g=Ke(),j=Ke(),S=pe(!1),N=pe(!1),z=pe(!1);return Ce(de(a,ye(({scrollTop:T})=>T)),r),Ce(de(a,ye(({scrollHeight:T})=>T)),f),Ce(r,u),{deviation:i,fixedFooterHeight:m,fixedHeaderHeight:x,footerHeight:y,headerHeight:h,horizontalDirection:N,scrollBy:j,scrollContainerState:a,scrollHeight:f,scrollingInProgress:S,scrollTo:g,scrollTop:r,skipAnimationFrameInResizeObserver:z,smoothScrollTargetReached:o,statefulScrollTop:u,viewportHeight:p}},[],{singleton:!0}),Ss={lvl:0};function jv(a,r){const i=a.length;if(i===0)return[];let{index:o,value:u}=r(a[0]);const p=[];for(let f=1;f<i;f++){const{index:h,value:x}=r(a[f]);p.push({end:h-1,start:o,value:u}),o=h,u=x}return p.push({end:1/0,start:o,value:u}),p}function ot(a){return a===Ss}function ks(a,r){if(!ot(a))return r===a.k?a.v:r<a.k?ks(a.l,r):ks(a.r,r)}function Gn(a,r,i="k"){if(ot(a))return[-1/0,void 0];if(Number(a[i])===r)return[a.k,a.v];if(Number(a[i])<r){const o=Gn(a.r,r,i);return o[0]===-1/0?[a.k,a.v]:o}return Gn(a.l,r,i)}function yn(a,r,i){return ot(a)?wv(r,i,1):r===a.k?Ot(a,{k:r,v:i}):r<a.k?hx(Ot(a,{l:yn(a.l,r,i)})):hx(Ot(a,{r:yn(a.r,r,i)}))}function ur(){return Ss}function dr(a,r,i){if(ot(a))return[];const o=Gn(a,r)[0];return G0(pd(a,o,i))}function fd(a,r){if(ot(a))return Ss;const{k:i,l:o,r:u}=a;if(r===i){if(ot(o))return u;if(ot(u))return o;const[p,f]=kv(o);return ao(Ot(a,{k:p,l:Sv(o),v:f}))}return r<i?ao(Ot(a,{l:fd(o,r)})):ao(Ot(a,{r:fd(u,r)}))}function gl(a){return ot(a)?[]:[...gl(a.l),{k:a.k,v:a.v},...gl(a.r)]}function pd(a,r,i){if(ot(a))return[];const{k:o,l:u,r:p,v:f}=a;let h=[];return o>r&&(h=h.concat(pd(u,r,i))),o>=r&&o<=i&&h.push({k:o,v:f}),o<=i&&(h=h.concat(pd(p,r,i))),h}function ao(a){const{l:r,lvl:i,r:o}=a;if(o.lvl>=i-1&&r.lvl>=i-1)return a;if(i>o.lvl+1){if(Pu(r))return Cv(Ot(a,{lvl:i-1}));if(!ot(r)&&!ot(r.r))return Ot(r.r,{l:Ot(r,{r:r.r.l}),lvl:i,r:Ot(a,{l:r.r.r,lvl:i-1})});throw new Error("Unexpected empty nodes")}if(Pu(a))return md(Ot(a,{lvl:i-1}));if(!ot(o)&&!ot(o.l)){const u=o.l,p=Pu(u)?o.lvl-1:o.lvl;return Ot(u,{l:Ot(a,{lvl:i-1,r:u.l}),lvl:u.lvl+1,r:md(Ot(o,{l:u.r,lvl:p}))})}throw new Error("Unexpected empty nodes")}function Ot(a,r){return wv(r.k!==void 0?r.k:a.k,r.v!==void 0?r.v:a.v,r.lvl!==void 0?r.lvl:a.lvl,r.l!==void 0?r.l:a.l,r.r!==void 0?r.r:a.r)}function Sv(a){return ot(a.r)?a.l:ao(Ot(a,{r:Sv(a.r)}))}function Pu(a){return ot(a)||a.lvl>a.r.lvl}function kv(a){return ot(a.r)?[a.k,a.v]:kv(a.r)}function wv(a,r,i,o=Ss,u=Ss){return{k:a,l:o,lvl:i,r:u,v:r}}function hx(a){return md(Cv(a))}function Cv(a){const{l:r}=a;return!ot(r)&&r.lvl===a.lvl?Ot(r,{r:Ot(a,{l:r.r})}):a}function md(a){const{lvl:r,r:i}=a;return!ot(i)&&!ot(i.r)&&i.lvl===r&&i.r.lvl===r?Ot(i,{l:Ot(a,{r:i.l}),lvl:r+1}):a}function G0(a){return jv(a,({k:r,v:i})=>({index:r,value:i}))}function Nv(a,r){return!!(a&&a.startIndex===r.startIndex&&a.endIndex===r.endIndex)}function ws(a,r){return!!(a&&a[0]===r[0]&&a[1]===r[1])}const Rd=Ze(()=>({recalcInProgress:pe(!1)}),[],{singleton:!0});function Ev(a,r,i){return a[oo(a,r,i)]}function oo(a,r,i,o=0){let u=a.length-1;for(;o<=u;){const p=Math.floor((o+u)/2),f=a[p],h=i(f,r);if(h===0)return p;if(h===-1){if(u-o<2)return p-1;u=p-1}else{if(u===o)return p;o=p+1}}throw new Error(`Failed binary finding record in array - ${a.join(",")}, searched for ${r}`)}function P0(a,r,i,o){const u=oo(a,r,o),p=oo(a,i,o,u);return a.slice(u,p+1)}function Fa(a,r){return Math.round(a.getBoundingClientRect()[r])}function go(a){return!ot(a.groupOffsetTree)}function Ad({index:a},r){return r===a?0:r<a?-1:1}function q0(){return{groupIndices:[],groupOffsetTree:ur(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:ur()}}function Y0(a,r){let i=ot(a)?0:1/0;for(const o of r){const{endIndex:u,size:p,startIndex:f}=o;if(i=Math.min(i,f),ot(a)){a=yn(a,0,p);continue}const h=dr(a,f-1,u+1);if(h.some(J0(o)))continue;let x=!1,m=!1;for(const{end:y,start:g,value:j}of h)x?(u>=g||p===j)&&(a=fd(a,g)):(m=j!==p,x=!0),y>u&&u>=g&&j!==p&&(a=yn(a,u+1,j));m&&(a=yn(a,f,p))}return[a,i]}function F0(a){return typeof a.groupIndex<"u"}function W0({offset:a},r){return r===a?0:r<a?-1:1}function Cs(a,r,i){if(r.length===0)return 0;const{index:o,offset:u,size:p}=Ev(r,a,Ad),f=a-o,h=p*f+(f-1)*i+u;return h>0?h+i:h}function Tv(a,r){if(!go(r))return a;let i=0;for(;r.groupIndices[i]<=a+i;)i++;return a+i}function Rv(a,r,i){if(F0(a))return r.groupIndices[a.groupIndex]+1;const o=a.index==="LAST"?i:a.index;let u=Tv(o,r);return u=Math.max(0,u,Math.min(i,u)),u}function K0(a,r,i,o=0){return o>0&&(r=Math.max(r,Ev(a,o,Ad).offset)),jv(P0(a,r,i,W0),Z0)}function X0(a,[r,i,o,u]){r.length>0&&o("received item sizes",r,Bt.DEBUG);const p=a.sizeTree;let f=p,h=0;if(i.length>0&&ot(p)&&r.length===2){const j=r[0].size,S=r[1].size;f=i.reduce((N,z)=>yn(yn(N,z,j),z+1,S),f)}else[f,h]=Y0(f,r);if(f===p)return a;const{lastIndex:x,lastOffset:m,lastSize:y,offsetTree:g}=hd(a.offsetTree,h,f,u);return{groupIndices:i,groupOffsetTree:i.reduce((j,S)=>yn(j,S,Cs(S,g,u)),ur()),lastIndex:x,lastOffset:m,lastSize:y,offsetTree:g,sizeTree:f}}function Q0(a){return gl(a).map(({k:r,v:i},o,u)=>{const p=u[o+1];return{endIndex:p!==void 0?p.k-1:1/0,size:i,startIndex:r}})}function xx(a,r){let i=0,o=0;for(;i<a;)i+=r[o+1]-r[o]-1,o++;return o-(i===a?0:1)}function hd(a,r,i,o){let u=a,p=0,f=0,h=0,x=0;if(r!==0){x=oo(u,r-1,Ad),h=u[x].offset;const m=Gn(i,r-1);p=m[0],f=m[1],u.length&&u[x].size===Gn(i,r)[1]&&(x-=1),u=u.slice(0,x+1)}else u=[];for(const{start:m,value:y}of dr(i,r,1/0)){const g=m-p,j=g*f+h+g*o;u.push({index:m,offset:j,size:y}),p=m,h=j,f=y}return{lastIndex:p,lastOffset:h,lastSize:f,offsetTree:u}}function Z0(a){return{index:a.index,value:a}}function J0(a){const{endIndex:r,size:i,startIndex:o}=a;return u=>u.start===o&&(u.end===r||u.end===1/0)&&u.value===i}const ej={offsetHeight:"height",offsetWidth:"width"},Qn=Ze(([{log:a},{recalcInProgress:r}])=>{const i=Ke(),o=Ke(),u=Qt(o,0),p=Ke(),f=Ke(),h=pe(0),x=pe([]),m=pe(void 0),y=pe(void 0),g=pe(void 0),j=pe(void 0),S=pe((w,L)=>Fa(w,ej[L])),N=pe(void 0),z=pe(0),T=q0(),k=Qt(de(i,$e(x,a,z),Kn(X0,T),mt()),T),M=Qt(de(x,mt(),Kn((w,L)=>({current:L,prev:w.current}),{current:[],prev:[]}),ye(({prev:w})=>w)),[]);Ce(de(x,Ae(w=>w.length>0),$e(k,z),ye(([w,L,R])=>{const I=w.reduce((G,Y,te)=>yn(G,Y,Cs(Y,L.offsetTree,R)||te),ur());return{...L,groupIndices:w,groupOffsetTree:I}})),k),Ce(de(o,$e(k),Ae(([w,{lastIndex:L}])=>w<L),ye(([w,{lastIndex:L,lastSize:R}])=>[{endIndex:L,size:R,startIndex:w}])),i),Ce(m,y);const O=Qt(de(m,ye(w=>w===void 0)),!0);Ce(de(y,Ae(w=>w!==void 0&&ot(yt(k).sizeTree)),ye(w=>{const L=yt(g),R=yt(x).length>0;return L!==void 0&&L!==0?R?[{endIndex:0,size:L,startIndex:0},{endIndex:1,size:w,startIndex:1}]:[]:[{endIndex:0,size:w,startIndex:0}]})),i),Ce(de(j,Ae(w=>w!==void 0&&w.length>0&&ot(yt(k).sizeTree)),ye(w=>{const L=[];let R=w[0],I=0;for(let G=1;G<w.length;G++){const Y=w[G];Y!==R&&(L.push({endIndex:G-1,size:R,startIndex:I}),R=Y,I=G)}return L.push({endIndex:w.length-1,size:R,startIndex:I}),L})),i),Ce(de(x,$e(g,y),Ae(([,w,L])=>w!==void 0&&L!==void 0),ye(([w,L,R])=>{const I=[];for(let G=0;G<w.length;G++){const Y=w[G],te=w[G+1];I.push({startIndex:Y,endIndex:Y,size:L}),te!==void 0&&I.push({startIndex:Y+1,endIndex:te-1,size:R})}return I})),i);const V=jn(de(i,$e(k),Kn(({sizes:w},[L,R])=>({changed:R!==w,sizes:R}),{changed:!1,sizes:T}),ye(w=>w.changed)));et(de(h,Kn((w,L)=>({diff:w.prev-L,prev:L}),{diff:0,prev:0}),ye(w=>w.diff)),w=>{const{groupIndices:L}=yt(k);if(w>0)He(r,!0),He(p,w+xx(w,L));else if(w<0){const R=yt(M);R.length>0&&(w-=xx(-w,R)),He(f,w)}}),et(de(h,$e(a)),([w,L])=>{w<0&&L("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:h},Bt.ERROR)});const A=jn(p);Ce(de(p,$e(k),ye(([w,L])=>{const R=L.groupIndices.length>0,I=[],G=L.lastSize;if(R){const Y=ks(L.sizeTree,0);let te=0,q=0;for(;te<w;){const E=L.groupIndices[q],B=L.groupIndices.length===q+1?1/0:L.groupIndices[q+1]-E-1;I.push({endIndex:E,size:Y,startIndex:E}),I.push({endIndex:E+1+B-1,size:G,startIndex:E+1}),q++,te+=B+1}const _=gl(L.sizeTree);return te!==w&&_.shift(),_.reduce((E,{k:B,v:ne})=>{let F=E.ranges;return E.prevSize!==0&&(F=[...E.ranges,{endIndex:B+w-1,size:E.prevSize,startIndex:E.prevIndex}]),{prevIndex:B+w,prevSize:ne,ranges:F}},{prevIndex:w,prevSize:0,ranges:I}).ranges}return gl(L.sizeTree).reduce((Y,{k:te,v:q})=>({prevIndex:te+w,prevSize:q,ranges:[...Y.ranges,{endIndex:te+w-1,size:Y.prevSize,startIndex:Y.prevIndex}]}),{prevIndex:0,prevSize:G,ranges:[]}).ranges})),i);const U=jn(de(f,$e(k,z),ye(([w,{offsetTree:L},R])=>{const I=-w;return Cs(I,L,R)})));return Ce(de(f,$e(k,z),ye(([w,L,R])=>{if(L.groupIndices.length>0){if(ot(L.sizeTree))return L;let G=ur();const Y=yt(M);let te=0,q=0,_=0;for(;te<-w;){_=Y[q];const E=Y[q+1]-_-1;q++,te+=E+1}if(G=gl(L.sizeTree).reduce((E,{k:B,v:ne})=>yn(E,Math.max(0,B+w),ne),G),te!==-w){const E=ks(L.sizeTree,_);G=yn(G,0,E);const B=Gn(L.sizeTree,-w+1)[1];G=yn(G,1,B)}return{...L,sizeTree:G,...hd(L.offsetTree,0,G,R)}}const I=gl(L.sizeTree).reduce((G,{k:Y,v:te})=>yn(G,Math.max(0,Y+w),te),ur());return{...L,sizeTree:I,...hd(L.offsetTree,0,I,R)}})),k),{beforeUnshiftWith:A,data:N,defaultItemSize:y,firstItemIndex:h,fixedItemSize:m,fixedGroupSize:g,gap:z,groupIndices:x,heightEstimates:j,itemSize:S,listRefresh:V,shiftWith:f,shiftWithOffset:U,sizeRanges:i,sizes:k,statefulTotalCount:u,totalCount:o,trackItemSizes:O,unshiftWith:p}},ht(Ka,Rd),{singleton:!0});function tj(a){return a.reduce((r,i)=>(r.groupIndices.push(r.totalCount),r.totalCount+=i+1,r),{groupIndices:[],totalCount:0})}const Av=Ze(([{groupIndices:a,sizes:r,totalCount:i},{headerHeight:o,scrollTop:u}])=>{const p=Ke(),f=Ke(),h=jn(de(p,ye(tj)));return Ce(de(h,ye(x=>x.totalCount)),i),Ce(de(h,ye(x=>x.groupIndices)),a),Ce(de(Dt(u,r,o),Ae(([x,m])=>go(m)),ye(([x,m,y])=>Gn(m.groupOffsetTree,Math.max(x-y,0),"v")[0]),mt(),ye(x=>[x])),f),{groupCounts:p,topItemsIndexes:f}},ht(Qn,an)),Xa=Ze(([{log:a}])=>{const r=pe(!1),i=jn(de(r,Ae(o=>o),mt()));return et(r,o=>{o&&yt(a)("props updated",{},Bt.DEBUG)}),{didMount:i,propsReady:r}},ht(Ka),{singleton:!0}),nj=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Mv(a){const r=typeof a=="number"?{index:a}:a;return r.align||(r.align="start"),(!r.behavior||!nj)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const Rs=Ze(([{gap:a,listRefresh:r,sizes:i,totalCount:o},{fixedFooterHeight:u,fixedHeaderHeight:p,footerHeight:f,headerHeight:h,scrollingInProgress:x,scrollTo:m,smoothScrollTargetReached:y,viewportHeight:g},{log:j}])=>{const S=Ke(),N=Ke(),z=pe(0);let T=null,k=null,M=null;function O(){T!==null&&(T(),T=null),M!==null&&(M(),M=null),k&&(clearTimeout(k),k=null),He(x,!1)}return Ce(de(S,$e(i,g,o,z,h,f,j),$e(a,p,u),ye(([[V,A,U,w,L,R,I,G],Y,te,q])=>{const _=Mv(V),{align:E,behavior:B,offset:ne}=_,F=w-1,me=Rv(_,A,F);let D=Cs(me,A.offsetTree,Y)+R;E==="end"?(D+=te+Gn(A.sizeTree,me)[1]-U+q,me===F&&(D+=I)):E==="center"?D+=(te+Gn(A.sizeTree,me)[1]-U+q)/2:D-=L,ne!==void 0&&ne!==0&&(D+=ne);const K=oe=>{O(),oe?(G("retrying to scroll to",{location:V},Bt.DEBUG),He(S,V)):(He(N,!0),G("list did not change, scroll successful",{},Bt.DEBUG))};if(O(),B==="smooth"){let oe=!1;M=et(r,fe=>{oe=oe||fe}),T=$n(y,()=>{K(oe)})}else T=$n(de(r,aj(150)),K);return k=setTimeout(()=>{O()},1200),He(x,!0),G("scrolling from index to",{behavior:B,index:me,top:D},Bt.DEBUG),{behavior:B,top:D}})),m),{scrollTargetReached:N,scrollToIndex:S,topListHeight:z}},ht(Qn,an,Ka),{singleton:!0});function aj(a){return r=>{const i=setTimeout(()=>{r(!1)},a);return o=>{o&&(r(!0),clearTimeout(i))}}}function Md(a,r){a===0?r():requestAnimationFrame(()=>{Md(a-1,r)})}function zd(a,r){const i=r-1;return typeof a=="number"?a:a.index==="LAST"?i:a.index}const As=Ze(([{defaultItemSize:a,listRefresh:r,sizes:i},{scrollTop:o},{scrollTargetReached:u,scrollToIndex:p},{didMount:f}])=>{const h=pe(!0),x=pe(0),m=pe(!0);return Ce(de(f,$e(x),Ae(([y,g])=>g!==0),Wn(!1)),h),Ce(de(f,$e(x),Ae(([y,g])=>g!==0),Wn(!1)),m),et(de(Dt(r,f),$e(h,i,a,m),Ae(([[,y],g,{sizeTree:j},S,N])=>y&&(!ot(j)||Nd(S))&&!g&&!N),$e(x)),([,y])=>{$n(u,()=>{He(m,!0)}),Md(4,()=>{$n(o,()=>{He(h,!0)}),He(p,y)})}),{initialItemFinalLocationReached:m,initialTopMostItemIndex:x,scrolledToInitialItem:h}},ht(Qn,an,Rs,Xa),{singleton:!0});function zv(a,r){return Math.abs(a-r)<1.01}const Ns="up",ys="down",lj="none",rj={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},sj=0,Ms=Ze(([{footerHeight:a,headerHeight:r,scrollBy:i,scrollContainerState:o,scrollTop:u,viewportHeight:p}])=>{const f=pe(!1),h=pe(!0),x=Ke(),m=Ke(),y=pe(4),g=pe(sj),j=Qt(de(dd(de(Re(u),yl(1),Wn(!0)),de(Re(u),yl(1),Wn(!1),px(100))),mt()),!1),S=Qt(de(dd(de(i,Wn(!0)),de(i,Wn(!1),px(200))),mt()),!1);Ce(de(Dt(Re(u),Re(g)),ye(([M,O])=>M<=O),mt()),h),Ce(de(h,ga(50)),m);const N=jn(de(Dt(o,Re(p),Re(r),Re(a),Re(y)),Kn((M,[{scrollHeight:O,scrollTop:V},A,U,w,L])=>{const R=V+A-O>-L,I={scrollHeight:O,scrollTop:V,viewportHeight:A};if(R){let Y,te;return V>M.state.scrollTop?(Y="SCROLLED_DOWN",te=M.state.scrollTop-V):(Y="SIZE_DECREASED",te=M.state.scrollTop-V||M.scrollTopDelta),{atBottom:!0,atBottomBecause:Y,scrollTopDelta:te,state:I}}let G;return I.scrollHeight>M.state.scrollHeight?G="SIZE_INCREASED":A<M.state.viewportHeight?G="VIEWPORT_HEIGHT_DECREASING":V<M.state.scrollTop?G="SCROLLING_UPWARDS":G="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:G,state:I}},rj),mt((M,O)=>M!==void 0&&M.atBottom===O.atBottom))),z=Qt(de(o,Kn((M,{scrollHeight:O,scrollTop:V,viewportHeight:A})=>{if(!zv(M.scrollHeight,O)){const U=O-(V+A)<1;return M.scrollTop!==V&&U?{changed:!0,jump:M.scrollTop-V,scrollHeight:O,scrollTop:V}:{changed:!0,jump:0,scrollHeight:O,scrollTop:V}}return{changed:!1,jump:0,scrollHeight:O,scrollTop:V}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Ae(M=>M.changed),ye(M=>M.jump)),0);Ce(de(N,ye(M=>M.atBottom)),f),Ce(de(f,ga(50)),x);const T=pe(ys);Ce(de(o,ye(({scrollTop:M})=>M),mt(),Kn((M,O)=>yt(S)?{direction:M.direction,prevScrollTop:O}:{direction:O<M.prevScrollTop?Ns:ys,prevScrollTop:O},{direction:ys,prevScrollTop:0}),ye(M=>M.direction)),T),Ce(de(o,ga(50),Wn(lj)),T);const k=pe(0);return Ce(de(j,Ae(M=>!M),Wn(0)),k),Ce(de(u,ga(100),$e(j),Ae(([M,O])=>O),Kn(([M,O],[V])=>[O,V],[0,0]),ye(([M,O])=>O-M)),k),{atBottomState:N,atBottomStateChange:x,atBottomThreshold:y,atTopStateChange:m,atTopThreshold:g,isAtBottom:f,isAtTop:h,isScrolling:j,lastJumpDueToItemResize:z,scrollDirection:T,scrollVelocity:k}},ht(an)),Es="top",Ts="bottom",vx="none";function gx(a,r,i){return typeof a=="number"?i===Ns&&r===Es||i===ys&&r===Ts?a:0:i===Ns?r===Es?a.main:a.reverse:r===Ts?a.main:a.reverse}function yx(a,r){return typeof a=="number"?a:a[r]??0}const Ld=Ze(([{deviation:a,fixedHeaderHeight:r,headerHeight:i,scrollTop:o,viewportHeight:u}])=>{const p=Ke(),f=pe(0),h=pe(0),x=pe(0),m=Qt(de(Dt(Re(o),Re(u),Re(i),Re(p,ws),Re(x),Re(f),Re(r),Re(a),Re(h)),ye(([y,g,j,[S,N],z,T,k,M,O])=>{const V=y-M,A=T+k,U=Math.max(j-V,0);let w=vx;const L=yx(O,Es),R=yx(O,Ts);return S-=M,S+=j+k,N+=j+k,N-=M,S>y+A-L&&(w=Ns),N<y-U+g+R&&(w=ys),w!==vx?[Math.max(V-j-gx(z,Es,w)-L,0),V-U-k+g+gx(z,Ts,w)+R]:null}),Ae(y=>y!==null),mt(ws)),[0,0]);return{increaseViewportBy:h,listBoundary:p,overscan:x,topListHeight:f,visibleRange:m}},ht(an),{singleton:!0});function ij(a,r,i){if(go(r)){const o=Tv(a,r);return[{index:Gn(r.groupOffsetTree,o)[0],offset:0,size:0},{data:i==null?void 0:i[0],index:o,offset:0,size:0}]}return[{data:i==null?void 0:i[0],index:a,offset:0,size:0}]}const qu={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function lo(a,r,i,o,u,p){const{lastIndex:f,lastOffset:h,lastSize:x}=u;let m=0,y=0;if(a.length>0){m=a[0].offset;const z=a[a.length-1];y=z.offset+z.size}const g=i-f,j=h+g*x+(g-1)*o,S=m,N=j-y;return{bottom:y,firstItemIndex:p,items:bx(a,u,p),offsetBottom:N,offsetTop:m,top:S,topItems:bx(r,u,p),topListHeight:r.reduce((z,T)=>T.size+z,0),totalCount:i}}function Lv(a,r,i,o,u,p){let f=0;if(i.groupIndices.length>0)for(const y of i.groupIndices){if(y-f>=a)break;f++}const h=a+f,x=zd(r,h),m=Array.from({length:h}).map((y,g)=>({data:p[g+x],index:g+x,offset:0,size:0}));return lo(m,[],h,u,i,o)}function bx(a,r,i){if(a.length===0)return[];if(!go(r))return a.map(m=>({...m,index:m.index+i,originalIndex:m.index}));const o=a[0].index,u=a[a.length-1].index,p=[],f=dr(r.groupOffsetTree,o,u);let h,x=0;for(const m of a){(!h||h.end<m.index)&&(h=f.shift(),x=r.groupIndices.indexOf(h.start));let y;m.index===h.start?y={index:x,type:"group"}:y={groupIndex:x,index:m.index-(x+1)+i},p.push({...y,data:m.data,offset:m.offset,originalIndex:m.index,size:m.size})}return p}function jx(a,r){return a===void 0?0:typeof a=="number"?a:a[r]??0}const Sl=Ze(([{data:a,firstItemIndex:r,gap:i,sizes:o,totalCount:u},p,{listBoundary:f,topListHeight:h,visibleRange:x},{initialTopMostItemIndex:m,scrolledToInitialItem:y},{topListHeight:g},j,{didMount:S},{recalcInProgress:N}])=>{const z=pe([]),T=pe(0),k=Ke(),M=pe(0);Ce(p.topItemsIndexes,z);const O=Qt(de(Dt(S,N,Re(x,ws),Re(u),Re(o),Re(m),y,Re(z),Re(r),Re(i),Re(M),a),Ae(([w,L,,R,,,,,,,,I])=>{const G=I!==void 0&&I.length!==R;return w&&!L&&!G}),ye(([,,[w,L],R,I,G,Y,te,q,_,E,B])=>{var je,Ue;const ne=I,{offsetTree:F,sizeTree:me}=ne,D=yt(T);if(R===0)return{...qu,totalCount:R};if(w===0&&L===0)return D===0?{...qu,totalCount:R}:Lv(D,G,I,q,_,B||[]);if(ot(me))return D>0?null:lo(ij(zd(G,R),ne,B),[],R,_,ne,q);const K=[];if(te.length>0){const Le=te[0],ae=te[te.length-1];let Z=0;for(const se of dr(me,Le,ae)){const ue=se.value,ge=Math.max(se.start,Le),Oe=Math.min(se.end,ae);for(let Me=ge;Me<=Oe;Me++)K.push({data:B==null?void 0:B[Me],index:Me,offset:Z,size:ue}),Z+=ue}}if(!Y)return lo([],K,R,_,ne,q);const oe=te.length>0?te[te.length-1]+1:0,fe=K0(F,w,L,oe);if(fe.length===0)return null;const he=R-1,xe=vo([],Le=>{for(const ae of fe){const Z=ae.value;let se=Z.offset,ue=ae.start;const ge=Z.size;if(Z.offset<w){ue+=Math.floor((w-Z.offset+_)/(ge+_));const Me=ue-ae.start;se+=Me*ge+Me*_}ue<oe&&(se+=(oe-ue)*ge,ue=oe);const Oe=Math.min(ae.end,he);for(let Me=ue;Me<=Oe&&!(se>=L);Me++)Le.push({data:B==null?void 0:B[Me],index:Me,offset:se,size:ge}),se+=ge+_}}),ke=jx(E,Es),ce=jx(E,Ts);if(xe.length>0&&(ke>0||ce>0)){const Le=xe[0],ae=xe[xe.length-1];if(ke>0&&Le.index>oe){const Z=Math.min(ke,Le.index-oe),se=[];let ue=Le.offset;for(let ge=Le.index-1;ge>=Le.index-Z;ge--){const Oe=((je=dr(me,ge,ge)[0])==null?void 0:je.value)??Le.size;ue-=Oe+_,se.unshift({data:B==null?void 0:B[ge],index:ge,offset:ue,size:Oe})}xe.unshift(...se)}if(ce>0&&ae.index<he){const Z=Math.min(ce,he-ae.index);let se=ae.offset+ae.size+_;for(let ue=ae.index+1;ue<=ae.index+Z;ue++){const ge=((Ue=dr(me,ue,ue)[0])==null?void 0:Ue.value)??ae.size;xe.push({data:B==null?void 0:B[ue],index:ue,offset:se,size:ge}),se+=ge+_}}}return lo(xe,K,R,_,ne,q)}),Ae(w=>w!==null),mt()),qu);Ce(de(a,Ae(Nd),ye(w=>w==null?void 0:w.length)),u),Ce(de(O,ye(w=>w.topListHeight)),g),Ce(g,h),Ce(de(O,ye(w=>[w.top,w.bottom])),f),Ce(de(O,ye(w=>w.items)),k);const V=jn(de(O,Ae(({items:w})=>w.length>0),$e(u,a),Ae(([{items:w},L])=>w[w.length-1].originalIndex===L-1),ye(([,w,L])=>[w-1,L]),mt(ws),ye(([w])=>w))),A=jn(de(O,ga(200),Ae(({items:w,topItems:L})=>w.length>0&&w[0].originalIndex===L.length),ye(({items:w})=>w[0].index),mt())),U=jn(de(O,Ae(({items:w})=>w.length>0),ye(({items:w})=>{let L=0,R=w.length-1;for(;w[L].type==="group"&&L<R;)L++;for(;w[R].type==="group"&&R>L;)R--;return{endIndex:w[R].index,startIndex:w[L].index}}),mt(Nv)));return{endReached:V,initialItemCount:T,itemsRendered:k,listState:O,minOverscanItemCount:M,rangeChanged:U,startReached:A,topItemsIndexes:z,...j}},ht(Qn,Av,Ld,As,Rs,Ms,Xa,Rd),{singleton:!0}),Dv=Ze(([{fixedFooterHeight:a,fixedHeaderHeight:r,footerHeight:i,headerHeight:o},{listState:u}])=>{const p=Ke(),f=Qt(de(Dt(i,a,o,r,u),ye(([h,x,m,y,g])=>h+x+m+y+g.offsetBottom+g.bottom)),0);return Ce(Re(f),p),{totalListHeight:f,totalListHeightChanged:p}},ht(an,Sl),{singleton:!0}),oj=Ze(([{viewportHeight:a},{totalListHeight:r}])=>{const i=pe(!1),o=Qt(de(Dt(i,a,r),Ae(([u])=>u),ye(([,u,p])=>Math.max(0,u-p)),ga(0),mt()),0);return{alignToBottom:i,paddingTopAddition:o}},ht(an,Dv),{singleton:!0}),_v=Ze(()=>({context:pe(null)})),cj=({itemBottom:a,itemTop:r,locationParams:{align:i,behavior:o,...u},viewportBottom:p,viewportTop:f})=>r<f?{...u,align:i??"start",...o!==void 0?{behavior:o}:{}}:a>p?{...u,align:i??"end",...o!==void 0?{behavior:o}:{}}:null,Ov=Ze(([{gap:a,sizes:r,totalCount:i},{fixedFooterHeight:o,fixedHeaderHeight:u,headerHeight:p,scrollingInProgress:f,scrollTop:h,viewportHeight:x},{scrollToIndex:m}])=>{const y=Ke();return Ce(de(y,$e(r,x,i,p,u,o,h),$e(a),ye(([[g,j,S,N,z,T,k,M],O])=>{const{calculateViewLocation:V=cj,done:A,...U}=g,w=Rv(g,j,N-1),L=Cs(w,j.offsetTree,O)+z+T,R=L+Gn(j.sizeTree,w)[1],I=M+T,G=M+S-k,Y=V({itemBottom:R,itemTop:L,locationParams:U,viewportBottom:G,viewportTop:I});return Y!==null?A&&$n(de(f,Ae(te=>!te),yl(yt(f)?1:2)),A):A==null||A(),Y}),Ae(g=>g!==null)),m),{scrollIntoView:y}},ht(Qn,an,Rs,Sl,Ka),{singleton:!0});function Sx(a){return a===!1?!1:a==="smooth"?"smooth":"auto"}const uj=(a,r)=>typeof a=="function"?Sx(a(r)):r&&Sx(a),dj=Ze(([{listRefresh:a,totalCount:r,fixedItemSize:i,data:o},{atBottomState:u,isAtBottom:p},{scrollToIndex:f},{scrolledToInitialItem:h},{didMount:x,propsReady:m},{log:y},{scrollingInProgress:g},{context:j},{scrollIntoView:S}])=>{const N=pe(!1),z=Ke();let T=null;function k(A){He(f,{align:"end",behavior:A,index:"LAST"})}et(de(Dt(de(Re(r),yl(1)),x),$e(Re(N),p,h,g),ye(([[A,U],w,L,R,I])=>{let G=U&&R,Y="auto";return G&&(Y=uj(w,L||I),G=G&&Y!==!1),{followOutputBehavior:Y,shouldFollow:G,totalCount:A}}),Ae(({shouldFollow:A})=>A)),({followOutputBehavior:A,totalCount:U})=>{T!==null&&(T(),T=null),yt(i)!==void 0?requestAnimationFrame(()=>{yt(y)("following output to ",{totalCount:U},Bt.DEBUG),k(A)}):T=$n(a,()=>{yt(y)("following output to ",{totalCount:U},Bt.DEBUG),k(A),T=null})});function M(A){const U=$n(u,w=>{A&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&T===null&&(yt(y)("scrolling to bottom due to increased size",{},Bt.DEBUG),k("auto"))});setTimeout(U,100)}et(de(Dt(Re(N),r,m),Ae(([A,,U])=>A!==!1&&U),Kn(({value:A},[,U])=>({refreshed:A===U,value:U}),{refreshed:!1,value:0}),Ae(({refreshed:A})=>A),$e(N,r)),([,A])=>{yt(h)&&M(A!==!1)}),et(z,()=>{M(yt(N)!==!1)}),et(Dt(Re(N),u),([A,U])=>{A!==!1&&!U.atBottom&&U.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&k("auto")});const O=pe(null),V=Ke();return Ce(dd(de(Re(o),ye(A=>(A==null?void 0:A.length)??0)),de(Re(r))),V),et(de(Dt(de(V,yl(1)),x),$e(Re(O),h,g,j),ye(([[A,U],w,L,R,I])=>U&&L&&(w==null?void 0:w({context:I,totalCount:A,scrollingInProgress:R}))),Ae(A=>!!A),ga(0)),A=>{T!==null&&(T(),T=null),yt(i)!==void 0?requestAnimationFrame(()=>{yt(y)("scrolling into view",{}),He(S,A)}):T=$n(a,()=>{yt(y)("scrolling into view",{}),He(S,A),T=null})}),{autoscrollToBottom:z,followOutput:N,scrollIntoViewOnChange:O}},ht(Qn,Ms,Rs,As,Xa,Ka,an,_v,Ov)),fj=Ze(([{data:a,firstItemIndex:r,gap:i,sizes:o},{initialTopMostItemIndex:u},{initialItemCount:p,listState:f},{didMount:h}])=>(Ce(de(h,$e(p),Ae(([,x])=>x!==0),$e(u,o,r,i,a),ye(([[,x],m,y,g,j,S=[]])=>Lv(x,m,y,g,j,S))),f),{}),ht(Qn,As,Sl,Xa),{singleton:!0}),pj=Ze(([{didMount:a},{scrollTo:r},{listState:i}])=>{const o=pe(0);return et(de(a,$e(o),Ae(([,u])=>u!==0),ye(([,u])=>({top:u}))),u=>{$n(de(i,yl(1),Ae(p=>p.items.length>1)),()=>{requestAnimationFrame(()=>{He(r,u)})})}),{initialScrollTop:o}},ht(Xa,an,Sl),{singleton:!0}),Bv=Ze(([{scrollVelocity:a}])=>{const r=pe(!1),i=Ke(),o=pe(!1);return Ce(de(a,$e(o,r,i),Ae(([u,p])=>p!==!1&&p!==void 0),ye(([u,p,f,h])=>{const{enter:x,exit:m}=p;if(f){if(m(u,h))return!1}else if(x(u,h))return!0;return f}),mt()),r),et(de(Dt(r,a,i),$e(o)),([[u,p,f],h])=>{u&&h!==!1&&h!==void 0&&h.change&&h.change(p,f)}),{isSeeking:r,scrollSeekConfiguration:o,scrollSeekRangeChanged:i,scrollVelocity:a}},ht(Ms),{singleton:!0}),Dd=Ze(([{scrollContainerState:a,scrollTo:r}])=>{const i=Ke(),o=Ke(),u=Ke(),p=pe(!1),f=pe(void 0);return Ce(de(Dt(i,o),ye(([{scrollTop:h,viewportHeight:x},{offsetTop:m,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-m),viewportHeight:x}))),a),Ce(de(r,$e(o),ye(([h,{offsetTop:x}])=>({...h,top:h.top+x}))),u),{customScrollParent:f,useWindowScroll:p,windowScrollContainerState:i,windowScrollTo:u,windowViewportRect:o}},ht(an)),mj=Ze(([{sizeRanges:a,sizes:r},{headerHeight:i,scrollTop:o},{initialTopMostItemIndex:u},{didMount:p},{useWindowScroll:f,windowScrollContainerState:h,windowViewportRect:x}])=>{const m=Ke(),y=pe(void 0),g=pe(null),j=pe(null);return Ce(h,g),Ce(x,j),et(de(m,$e(r,o,f,g,j,i)),([S,N,z,T,k,M,O])=>{const V=Q0(N.sizeTree);T&&k!==null&&M!==null&&(z=k.scrollTop-M.offsetTop),z-=O,S({ranges:V,scrollTop:z})}),Ce(de(y,Ae(Nd),ye(hj)),u),Ce(de(p,$e(y),Ae(([,S])=>S!==void 0),mt(),ye(([,S])=>S.ranges)),a),{getState:m,restoreStateFrom:y}},ht(Qn,an,As,Xa,Dd));function hj(a){return{align:"start",index:0,offset:a.scrollTop}}const xj=Ze(([{topItemsIndexes:a}])=>{const r=pe(0);return Ce(de(r,Ae(i=>i>=0),ye(i=>Array.from({length:i}).map((o,u)=>u))),a),{topItemCount:r}},ht(Sl));function Iv(a){let r=!1,i;return(()=>(r||(r=!0,i=a()),i))}const vj=Iv(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),gj=Ze(([{deviation:a,scrollBy:r,scrollingInProgress:i,scrollTop:o},{isAtBottom:u,isScrolling:p,lastJumpDueToItemResize:f,scrollDirection:h},{listState:x},{beforeUnshiftWith:m,gap:y,shiftWithOffset:g,sizes:j},{log:S},{recalcInProgress:N}])=>{const z=jn(de(x,$e(f),Kn(([,k,M,O],[{bottom:V,items:A,offsetBottom:U,totalCount:w},L])=>{const R=V+U;let I=0;return M===w&&k.length>0&&A.length>0&&(A[0].originalIndex===0&&k[0].originalIndex===0||(I=R-O,I!==0&&(I+=L))),[I,A,w,R]},[0,[],0,0]),Ae(([k])=>k!==0),$e(o,h,i,u,S,N),Ae(([,k,M,O,,,V])=>!V&&!O&&k!==0&&M===Ns),ye(([[k],,,,,M])=>(M("Upward scrolling compensation",{amount:k},Bt.DEBUG),k))));function T(k){k>0?(He(r,{behavior:"auto",top:-k}),He(a,0)):(He(a,0),He(r,{behavior:"auto",top:-k}))}return et(de(z,$e(a,p)),([k,M,O])=>{O&&vj()?He(a,M-k):T(-k)}),et(de(Dt(Qt(p,!1),a,N),Ae(([k,M,O])=>!k&&!O&&M!==0),ye(([k,M])=>M),ga(1)),T),Ce(de(g,ye(k=>({top:-k}))),r),et(de(m,$e(j,y),ye(([k,{groupIndices:M,lastSize:O,sizeTree:V},A])=>{function U(G){return G*(O+A)}if(M.length===0)return U(k);let w=0;const L=ks(V,0);let R=0,I=0;for(;R<k;){R++,w+=L;let G=M.length===I+1?1/0:M[I+1]-M[I]-1;R+G>k&&(w-=L,G=k-R+1),R+=G,w+=U(G),I++}return w})),k=>{He(a,k),requestAnimationFrame(()=>{He(r,{top:k}),requestAnimationFrame(()=>{He(a,0),He(N,!1)})})}),{deviation:a}},ht(an,Ms,Sl,Qn,Ka,Rd)),yj=Ze(([a,r,i,o,u,p,f,h,x,m,y])=>({...a,...r,...i,...o,...u,...p,...f,...h,...x,...m,...y}),ht(Ld,fj,Xa,Bv,Dv,pj,oj,Dd,Ov,Ka,_v)),Hv=Ze(([{data:a,defaultItemSize:r,firstItemIndex:i,fixedItemSize:o,fixedGroupSize:u,gap:p,groupIndices:f,heightEstimates:h,itemSize:x,sizeRanges:m,sizes:y,statefulTotalCount:g,totalCount:j,trackItemSizes:S},{initialItemFinalLocationReached:N,initialTopMostItemIndex:z,scrolledToInitialItem:T},k,M,O,V,{scrollToIndex:A},U,{topItemCount:w},{groupCounts:L},R])=>{const{listState:I,minOverscanItemCount:G,topItemsIndexes:Y,rangeChanged:te,...q}=V;return Ce(te,R.scrollSeekRangeChanged),Ce(de(R.windowViewportRect,ye(_=>_.visibleHeight)),k.viewportHeight),{data:a,defaultItemHeight:r,firstItemIndex:i,fixedItemHeight:o,fixedGroupHeight:u,gap:p,groupCounts:L,heightEstimates:h,initialItemFinalLocationReached:N,initialTopMostItemIndex:z,scrolledToInitialItem:T,sizeRanges:m,topItemCount:w,topItemsIndexes:Y,totalCount:j,...O,groupIndices:f,itemSize:x,listState:I,minOverscanItemCount:G,scrollToIndex:A,statefulTotalCount:g,trackItemSizes:S,rangeChanged:te,...q,...R,...k,sizes:y,...M}},ht(Qn,As,an,mj,dj,Sl,Rs,gj,xj,Av,yj));function bj(a,r){const i={},o={};let u=0;const p=a.length;for(;u<p;)o[a[u]]=1,u+=1;for(const f in r)Object.hasOwn(o,f)||(i[f]=r[f]);return i}const Fi=typeof document<"u"?we.useLayoutEffect:we.useEffect;function Uv(a,r,i){const o=Object.keys(r.required||{}),u=Object.keys(r.optional||{}),p=Object.keys(r.methods||{}),f=Object.keys(r.events||{}),h=we.createContext({});function x(T,k){T.propsReady!==void 0&&He(T.propsReady,!1);for(const M of o){const O=T[r.required[M]];He(O,k[M])}for(const M of u)if(M in k){const O=T[r.optional[M]];He(O,k[M])}T.propsReady!==void 0&&He(T.propsReady,!0)}function m(T){return p.reduce((k,M)=>(k[M]=O=>{const V=T[r.methods[M]];He(V,O)},k),{})}function y(T){return f.reduce((k,M)=>(k[M]=O0(T[r.events[M]]),k),{})}const g=we.forwardRef(function(T,k){const{children:M,...O}=T,[V]=we.useState(()=>vo(I0(a),w=>{x(w,O)})),[A]=we.useState(fx(y,V));Fi(()=>{for(const w of f)w in O&&et(A[w],O[w]);return()=>{Object.values(A).map(Ed)}},[O,A,V]),Fi(()=>{x(V,O)}),we.useImperativeHandle(k,dx(m(V)));const U=i;return n.jsx(h.Provider,{value:V,children:i!==void 0?n.jsx(U,{...bj([...o,...u,...f],O),children:M}):M})}),j=T=>{const k=we.useContext(h);return we.useCallback(M=>{He(k[T],M)},[k,T])},S=T=>{const k=we.useContext(h)[T],M=we.useCallback(O=>et(k,O),[k]);return we.useSyncExternalStore(M,()=>yt(k),()=>yt(k))},N=T=>{const k=we.useContext(h)[T],[M,O]=we.useState(fx(yt,k));return Fi(()=>et(k,V=>{V!==M&&O(dx(V))}),[k,M]),M},z=parseInt(we.version)>=18?S:N;return{Component:g,useEmitter:(T,k)=>{const M=we.useContext(h)[T];Fi(()=>et(M,k),[k,M])},useEmitterValue:z,usePublisher:j}}const Vv=we.createContext(void 0),$v=we.createContext(void 0),Yu="-webkit-sticky",kx="sticky",_d=Iv(()=>{if(typeof document>"u")return kx;const a=document.createElement("div");return a.style.position=Yu,a.style.position===Yu?Yu:kx}),Gv=typeof document<"u"?we.useLayoutEffect:we.useEffect;function Fu(a){return"self"in a}function jj(a){return"body"in a}function Pv(a,r,i,o=vr,u,p){const f=we.useRef(null),h=we.useRef(null),x=we.useRef(null),m=we.useCallback(j=>{let S,N,z;const T=j.target;if(jj(T)||Fu(T)){const M=Fu(T)?T:T.defaultView;z=p===!0?M.scrollX:M.scrollY,S=p===!0?M.document.documentElement.scrollWidth:M.document.documentElement.scrollHeight,N=p===!0?M.innerWidth:M.innerHeight}else z=p===!0?T.scrollLeft:T.scrollTop,S=p===!0?T.scrollWidth:T.scrollHeight,N=p===!0?T.offsetWidth:T.offsetHeight;const k=()=>{a({scrollHeight:S,scrollTop:Math.max(z,0),viewportHeight:N})};j.suppressFlushSync===!0?k():gb.flushSync(k),h.current!==null&&(z===h.current||z<=0||z===S-N)&&(h.current=null,r(!0),x.current&&(clearTimeout(x.current),x.current=null))},[a,r,p]);we.useEffect(()=>{const j=u||f.current;return o(u||f.current),m({suppressFlushSync:!0,target:j}),j.addEventListener("scroll",m,{passive:!0}),()=>{o(null),j.removeEventListener("scroll",m)}},[f,m,i,o,u]);function y(j){const S=f.current;if(!S||(p===!0?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const N=j.behavior==="smooth";let z,T,k;Fu(S)?(T=Math.max(Fa(S.document.documentElement,p===!0?"width":"height"),p===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),z=p===!0?S.innerWidth:S.innerHeight,k=p===!0?window.scrollX:window.scrollY):(T=S[p===!0?"scrollWidth":"scrollHeight"],z=Fa(S,p===!0?"width":"height"),k=S[p===!0?"scrollLeft":"scrollTop"]);const M=T-z;if(j.top=Math.ceil(Math.max(Math.min(M,j.top),0)),zv(z,T)||j.top===k){a({scrollHeight:T,scrollTop:k,viewportHeight:z}),N&&r(!0);return}N?(h.current=j.top,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,h.current=null,r(!0)},1e3)):h.current=null,p===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},left:j.top}),S.scrollTo(j)}function g(j){p===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},...j.top!==void 0?{left:j.top}:{}}),f.current.scrollBy(j)}return{scrollByCallback:g,scrollerRef:f,scrollToCallback:y}}function Od(a){return a}const Sj=Ze(()=>{const a=pe(h=>`Item ${h}`),r=pe(h=>`Group ${h}`),i=pe({}),o=pe(Od),u=pe("div"),p=pe(vr),f=(h,x=null)=>Qt(de(i,ye(m=>m[h]),mt()),x);return{components:i,computeItemKey:o,EmptyPlaceholder:f("EmptyPlaceholder"),FooterComponent:f("Footer"),GroupComponent:f("Group","div"),groupContent:r,HeaderComponent:f("Header"),HeaderFooterTag:u,ItemComponent:f("Item","div"),itemContent:a,ListComponent:f("List","div"),ScrollerComponent:f("Scroller","div"),scrollerRef:p,ScrollSeekPlaceholder:f("ScrollSeekPlaceholder"),TopItemListComponent:f("TopItemList")}}),kj=Ze(([a,r])=>({...a,...r}),ht(Hv,Sj)),wj=({height:a})=>n.jsx("div",{style:{height:a}}),Cj={overflowAnchor:"none",position:_d(),zIndex:1},qv={overflowAnchor:"none"},Nj={...qv,display:"inline-block",height:"100%"},wx=we.memo(function({showTopList:a=!1}){const r=_e("listState"),i=_n("sizeRanges"),o=_e("useWindowScroll"),u=_e("customScrollParent"),p=_n("windowScrollContainerState"),f=_n("scrollContainerState"),h=u||o?p:f,x=_e("itemContent"),m=_e("context"),y=_e("groupContent"),g=_e("trackItemSizes"),j=_e("itemSize"),S=_e("log"),N=_n("gap"),z=_e("horizontalDirection"),{callbackRef:T}=V0(i,j,g,a?vr:h,S,N,u,z,_e("skipAnimationFrameInResizeObserver")),[k,M]=we.useState(0);Bd("deviation",q=>{k!==q&&M(q)});const O=_e("EmptyPlaceholder"),V=_e("ScrollSeekPlaceholder")??wj,A=_e("ListComponent"),U=_e("ItemComponent"),w=_e("GroupComponent"),L=_e("computeItemKey"),R=_e("isSeeking"),I=_e("groupIndices").length>0,G=_e("alignToBottom"),Y=_e("initialItemFinalLocationReached"),te=a?{}:{boxSizing:"border-box",...z?{display:"inline-block",height:"100%",marginLeft:k!==0?k:G?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:k!==0?k:G?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...Y?{}:{visibility:"hidden"}};return!a&&r.totalCount===0&&O!==null&&O!==void 0?n.jsx(O,{...Xt(O,m)}):n.jsx(A,{...Xt(A,m),"data-testid":a?"virtuoso-top-item-list":"virtuoso-item-list",ref:T,style:te,children:(a?r.topItems:r.items).map(q=>{const _=q.originalIndex,E=L(_+r.firstItemIndex,q.data,m);return R?v.createElement(V,{...Xt(V,m),height:q.size,index:q.index,key:E,type:q.type||"item",...q.type==="group"?{}:{groupIndex:q.groupIndex}}):q.type==="group"?v.createElement(w,{...Xt(w,m),"data-index":_,"data-item-index":q.index,"data-known-size":q.size,key:E,style:Cj},y(q.index,m)):v.createElement(U,{...Xt(U,m),...Aj(U,q.data),"data-index":_,"data-item-group-index":q.groupIndex,"data-item-index":q.index,"data-known-size":q.size,key:E,style:z?Nj:qv},I?x(q.index,q.groupIndex,q.data,m):x(q.index,q.data,m))})})}),Ej={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Tj={outline:"none",overflowX:"auto",position:"relative"},yo=a=>({height:"100%",position:"absolute",top:0,width:"100%",...a?{display:"flex",flexDirection:"column"}:void 0}),Rj={position:_d(),top:0,width:"100%",zIndex:1};function Xt(a,r){if(typeof a!="string")return{context:r}}function Aj(a,r){return{item:typeof a=="string"?void 0:r}}const Mj=we.memo(function(){const a=_e("HeaderComponent"),r=_n("headerHeight"),i=_e("HeaderFooterTag"),o=jl(we.useMemo(()=>p=>{r(Fa(p,"height"))},[r]),!0,_e("skipAnimationFrameInResizeObserver")),u=_e("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Xt(a,u)})}):null}),zj=we.memo(function(){const a=_e("FooterComponent"),r=_n("footerHeight"),i=_e("HeaderFooterTag"),o=jl(we.useMemo(()=>p=>{r(Fa(p,"height"))},[r]),!0,_e("skipAnimationFrameInResizeObserver")),u=_e("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Xt(a,u)})}):null});function Yv({useEmitter:a,useEmitterValue:r,usePublisher:i}){return we.memo(function({children:o,style:u,context:p,...f}){const h=i("scrollContainerState"),x=r("ScrollerComponent"),m=i("smoothScrollTargetReached"),y=r("scrollerRef"),g=r("horizontalDirection")||!1,{scrollByCallback:j,scrollerRef:S,scrollToCallback:N}=Pv(h,m,x,y,void 0,g);return a("scrollTo",N),a("scrollBy",j),n.jsx(x,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...g?Tj:Ej,...u},tabIndex:0,...f,...Xt(x,p),children:o})})}function Fv({useEmitter:a,useEmitterValue:r,usePublisher:i}){return we.memo(function({children:o,style:u,context:p,...f}){const h=i("windowScrollContainerState"),x=r("ScrollerComponent"),m=i("smoothScrollTargetReached"),y=r("totalListHeight"),g=r("deviation"),j=r("customScrollParent"),S=we.useRef(null),N=r("scrollerRef"),{scrollByCallback:z,scrollerRef:T,scrollToCallback:k}=Pv(h,m,x,N,j);return Gv(()=>{var M;return T.current=j||((M=S.current)==null?void 0:M.ownerDocument.defaultView),()=>{T.current=null}},[T,j]),a("windowScrollTo",k),a("scrollBy",z),n.jsx(x,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...u,...y!==0?{height:y+g}:void 0},...f,...Xt(x,p),children:o})})}const Lj=({children:a})=>{const r=we.useContext(Vv),i=_n("viewportHeight"),o=_n("fixedItemHeight"),u=_e("alignToBottom"),p=_e("horizontalDirection"),f=we.useMemo(()=>gv(i,x=>Fa(x,p?"width":"height")),[i,p]),h=jl(f,!0,_e("skipAnimationFrameInResizeObserver"));return we.useEffect(()=>{r&&(i(r.viewportHeight),o(r.itemHeight))},[r,i,o]),n.jsx("div",{"data-viewport-type":"element",ref:h,style:yo(u),children:a})},Dj=({children:a})=>{const r=we.useContext(Vv),i=_n("windowViewportRect"),o=_n("fixedItemHeight"),u=_e("customScrollParent"),p=bv(i,u,_e("skipAnimationFrameInResizeObserver")),f=_e("alignToBottom");return we.useEffect(()=>{r&&(o(r.itemHeight),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:100}))},[r,i,o]),n.jsx("div",{"data-viewport-type":"window",ref:p,style:yo(f),children:a})},_j=({children:a})=>{const r=_e("TopItemListComponent")??"div",i=_e("headerHeight"),o={...Rj,marginTop:`${i}px`},u=_e("context");return n.jsx(r,{style:o,...Xt(r,u),children:a})},Oj=we.memo(function(a){const r=_e("useWindowScroll"),i=_e("topItemsIndexes").length>0,o=_e("customScrollParent"),u=_e("context");return n.jsxs(o||r?Hj:Ij,{...a,context:u,children:[i&&n.jsx(_j,{children:n.jsx(wx,{showTopList:!0})}),n.jsxs(o||r?Dj:Lj,{children:[n.jsx(Mj,{}),n.jsx(wx,{}),n.jsx(zj,{})]})]})}),{Component:Bj,useEmitter:Bd,useEmitterValue:_e,usePublisher:_n}=Uv(kj,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Oj),Ij=Yv({useEmitter:Bd,useEmitterValue:_e,usePublisher:_n}),Hj=Fv({useEmitter:Bd,useEmitterValue:_e,usePublisher:_n}),Uj=Bj,Vj=Ze(()=>{const a=pe(m=>n.jsxs("td",{children:["Item $",m]})),r=pe(null),i=pe(m=>n.jsxs("td",{colSpan:1e3,children:["Group ",m]})),o=pe(null),u=pe(null),p=pe({}),f=pe(Od),h=pe(vr),x=(m,y=null)=>Qt(de(p,ye(g=>g[m]),mt()),y);return{components:p,computeItemKey:f,context:r,EmptyPlaceholder:x("EmptyPlaceholder"),FillerRow:x("FillerRow"),fixedFooterContent:u,fixedHeaderContent:o,itemContent:a,groupContent:i,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder"),TableBodyComponent:x("TableBody","tbody"),TableComponent:x("Table","table"),TableFooterComponent:x("TableFoot","tfoot"),TableHeadComponent:x("TableHead","thead"),TableRowComponent:x("TableRow","tr"),GroupComponent:x("Group","tr")}});ht(Hv,Vj);_d();const Cx={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},$j={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Nx,floor:co,max:bs,min:Wu,round:Ex}=Math;function Tx(a,r,i){return Array.from({length:r-a+1}).map((o,u)=>({data:i===null?null:i[u+a],index:u+a}))}function Gj(a){return{...$j,items:a}}function Wi(a,r){return a!==void 0&&a.width===r.width&&a.height===r.height}function Pj(a,r){return a!==void 0&&a.column===r.column&&a.row===r.row}const qj=Ze(([{increaseViewportBy:a,listBoundary:r,overscan:i,visibleRange:o},{footerHeight:u,headerHeight:p,scrollBy:f,scrollContainerState:h,scrollTo:x,scrollTop:m,smoothScrollTargetReached:y,viewportHeight:g},j,S,{didMount:N,propsReady:z},{customScrollParent:T,useWindowScroll:k,windowScrollContainerState:M,windowScrollTo:O,windowViewportRect:V},A])=>{const U=pe(0),w=pe(0),L=pe(Cx),R=pe({height:0,width:0}),I=pe({height:0,width:0}),G=Ke(),Y=Ke(),te=pe(0),q=pe(null),_=pe({column:0,row:0}),E=Ke(),B=Ke(),ne=pe(!1),F=pe(0),me=pe(!0),D=pe(!1),K=pe(!1);et(de(N,$e(F),Ae(([ce,je])=>je!==0)),()=>{He(me,!1)}),et(de(Dt(N,me,I,R,F,D),Ae(([ce,je,Ue,Le,,ae])=>ce&&!je&&Ue.height!==0&&Le.height!==0&&!ae)),([,,,,ce])=>{He(D,!0),Md(1,()=>{He(G,ce)}),$n(de(m),()=>{He(r,[0,0]),He(me,!0)})}),Ce(de(B,Ae(ce=>ce!=null&&ce.scrollTop>0),Wn(0)),w),et(de(N,$e(B),Ae(([,ce])=>ce!=null)),([,ce])=>{ce&&(He(R,ce.viewport),He(I,ce.item),He(_,ce.gap),ce.scrollTop>0&&(He(ne,!0),$n(de(m,yl(1)),je=>{He(ne,!1)}),He(x,{top:ce.scrollTop})))}),Ce(de(R,ye(({height:ce})=>ce)),g),Ce(de(Dt(Re(R,Wi),Re(I,Wi),Re(_,(ce,je)=>ce!==void 0&&ce.column===je.column&&ce.row===je.row),Re(m)),ye(([ce,je,Ue,Le])=>({gap:Ue,item:je,scrollTop:Le,viewport:ce}))),E),Ce(de(Dt(Re(U),o,Re(_,Pj),Re(I,Wi),Re(R,Wi),Re(q),Re(w),Re(ne),Re(me),Re(F)),Ae(([,,,,,,,ce])=>!ce),ye(([ce,[je,Ue],Le,ae,Z,se,ue,,ge,Oe])=>{const{column:Me,row:dt}=Le,{height:Zt,width:ct}=ae,{width:Vt}=Z;if(ue===0&&(ce===0||Vt===0))return Cx;if(ct===0){const nt=zd(Oe,ce),Qa=nt+Math.max(ue-1,0);return Gj(Tx(nt,Qa,se))}const $t=Wv(Vt,ct,Me);let tt,jt;ge?je===0&&Ue===0&&ue>0?(tt=0,jt=ue-1):(tt=$t*co((je+dt)/(Zt+dt)),jt=$t*Nx((Ue+dt)/(Zt+dt))-1,jt=Wu(ce-1,bs(jt,$t-1)),tt=Wu(jt,bs(0,tt))):(tt=0,jt=-1);const ve=Tx(tt,jt,se),{bottom:Rt,top:ze}=Rx(Z,Le,ae,ve),xt=Nx(ce/$t),Wt=xt*Zt+(xt-1)*dt-Rt;return{bottom:Rt,itemHeight:Zt,items:ve,itemWidth:ct,offsetBottom:Wt,offsetTop:ze,top:ze}})),L),Ce(de(q,Ae(ce=>ce!==null),ye(ce=>ce.length)),U),Ce(de(Dt(R,I,L,_),Ae(([ce,je,{items:Ue}])=>Ue.length>0&&je.height!==0&&ce.height!==0),ye(([ce,je,{items:Ue},Le])=>{const{bottom:ae,top:Z}=Rx(ce,Le,je,Ue);return[Z,ae]}),mt(ws)),r);const oe=pe(!1);Ce(de(m,$e(oe),ye(([ce,je])=>je||ce!==0)),oe);const fe=jn(de(Dt(L,U),Ae(([{items:ce}])=>ce.length>0),$e(oe),Ae(([[ce,je],Ue])=>{const Le=ce.items[ce.items.length-1].index===je-1;return(Ue||ce.bottom>0&&ce.itemHeight>0&&ce.offsetBottom===0&&ce.items.length===je)&&Le}),ye(([[,ce]])=>ce-1),mt())),he=jn(de(Re(L),Ae(({items:ce})=>ce.length>0&&ce[0].index===0),Wn(0),mt())),xe=jn(de(Re(L),$e(ne),Ae(([{items:ce},je])=>ce.length>0&&!je),ye(([{items:ce}])=>({endIndex:ce[ce.length-1].index,startIndex:ce[0].index})),mt(Nv),ga(0)));Ce(xe,S.scrollSeekRangeChanged),Ce(de(G,$e(R,I,U,_),ye(([ce,je,Ue,Le,ae])=>{const Z=Mv(ce),{align:se,behavior:ue,offset:ge}=Z;let Oe=Z.index;Oe==="LAST"&&(Oe=Le-1),Oe=bs(0,Oe,Wu(Le-1,Oe));let Me=xd(je,ae,Ue,Oe);return se==="end"?Me=Ex(Me-je.height+Ue.height):se==="center"&&(Me=Ex(Me-je.height/2+Ue.height/2)),ge!==void 0&&ge!==0&&(Me+=ge),{behavior:ue,top:Me}})),x);const ke=Qt(de(L,ye(ce=>ce.offsetBottom+ce.bottom)),0);return Ce(de(V,ye(ce=>({height:ce.visibleHeight,width:ce.visibleWidth}))),R),{customScrollParent:T,data:q,deviation:te,footerHeight:u,gap:_,headerHeight:p,increaseViewportBy:a,initialItemCount:w,itemDimensions:I,overscan:i,restoreStateFrom:B,scrollBy:f,scrollContainerState:h,scrollHeight:Y,scrollTo:x,scrollToIndex:G,scrollTop:m,smoothScrollTargetReached:y,totalCount:U,useWindowScroll:k,viewportDimensions:R,windowScrollContainerState:M,windowScrollTo:O,windowViewportRect:V,...S,gridState:L,horizontalDirection:K,initialTopMostItemIndex:F,totalListHeight:ke,...j,endReached:fe,propsReady:z,rangeChanged:xe,startReached:he,stateChanged:E,stateRestoreInProgress:ne,...A}},ht(Ld,an,Ms,Bv,Xa,Dd,Ka));function Wv(a,r,i){return bs(1,co((a+i)/(co(r)+i)))}function Rx(a,r,i,o){const{height:u}=i;if(u===void 0||o.length===0)return{bottom:0,top:0};const p=xd(a,r,i,o[0].index);return{bottom:xd(a,r,i,o[o.length-1].index)+u,top:p}}function xd(a,r,i,o){const u=Wv(a.width,i.width,r.column),p=co(o/u),f=p*i.height+bs(0,p-1)*r.row;return f>0?f+r.row:f}const Yj=Ze(()=>{const a=pe(g=>`Item ${g}`),r=pe({}),i=pe(null),o=pe("virtuoso-grid-item"),u=pe("virtuoso-grid-list"),p=pe(Od),f=pe("div"),h=pe(vr),x=(g,j=null)=>Qt(de(r,ye(S=>S[g]),mt()),j),m=pe(!1),y=pe(!1);return Ce(Re(y),m),{components:r,computeItemKey:p,context:i,FooterComponent:x("Footer"),HeaderComponent:x("Header"),headerFooterTag:f,itemClassName:o,ItemComponent:x("Item","div"),itemContent:a,listClassName:u,ListComponent:x("List","div"),readyStateChanged:m,reportReadyState:y,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder","div")}}),Fj=Ze(([a,r])=>({...a,...r}),ht(qj,Yj)),Wj=we.memo(function(){const a=gt("gridState"),r=gt("listClassName"),i=gt("itemClassName"),o=gt("itemContent"),u=gt("computeItemKey"),p=gt("isSeeking"),f=On("scrollHeight"),h=gt("ItemComponent"),x=gt("ListComponent"),m=gt("ScrollSeekPlaceholder"),y=gt("context"),g=On("itemDimensions"),j=On("gap"),S=gt("log"),N=gt("stateRestoreInProgress"),z=On("reportReadyState"),T=jl(we.useMemo(()=>k=>{const M=k.parentElement.parentElement.scrollHeight;f(M);const O=k.firstChild;if(O!==null){const{height:V,width:A}=O.getBoundingClientRect();g({height:V,width:A})}j({column:Ax("column-gap",getComputedStyle(k).columnGap,S),row:Ax("row-gap",getComputedStyle(k).rowGap,S)})},[f,g,j,S]),!0,!1);return Gv(()=>{a.itemHeight>0&&a.itemWidth>0&&z(!0)},[a]),N?null:n.jsx(x,{className:r,ref:T,...Xt(x,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},children:a.items.map(k=>{const M=u(k.index,k.data,y);return p?n.jsx(m,{...Xt(m,y),height:a.itemHeight,index:k.index,width:a.itemWidth},M):v.createElement(h,{...Xt(h,y),className:i,"data-index":k.index,key:M},o(k.index,k.data,y))})})}),Kj=we.memo(function(){const a=gt("HeaderComponent"),r=On("headerHeight"),i=gt("headerFooterTag"),o=jl(we.useMemo(()=>p=>{r(Fa(p,"height"))},[r]),!0,!1),u=gt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Xt(a,u)})}):null}),Xj=we.memo(function(){const a=gt("FooterComponent"),r=On("footerHeight"),i=gt("headerFooterTag"),o=jl(we.useMemo(()=>p=>{r(Fa(p,"height"))},[r]),!0,!1),u=gt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Xt(a,u)})}):null}),Qj=({children:a})=>{const r=we.useContext($v),i=On("itemDimensions"),o=On("viewportDimensions"),u=jl(we.useMemo(()=>p=>{o(p.getBoundingClientRect())},[o]),!0,!1);return we.useEffect(()=>{r&&(o({height:r.viewportHeight,width:r.viewportWidth}),i({height:r.itemHeight,width:r.itemWidth}))},[r,o,i]),n.jsx("div",{ref:u,style:yo(!1),children:a})},Zj=({children:a})=>{const r=we.useContext($v),i=On("windowViewportRect"),o=On("itemDimensions"),u=gt("customScrollParent"),p=bv(i,u,!1);return we.useEffect(()=>{r&&(o({height:r.itemHeight,width:r.itemWidth}),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:r.viewportWidth}))},[r,i,o]),n.jsx("div",{ref:p,style:yo(!1),children:a})},Jj=we.memo(function({...a}){const r=gt("useWindowScroll"),i=gt("customScrollParent"),o=i||r?t2:e2,u=i||r?Zj:Qj,p=gt("context");return n.jsx(o,{...a,...Xt(o,p),children:n.jsxs(u,{children:[n.jsx(Kj,{}),n.jsx(Wj,{}),n.jsx(Xj,{})]})})}),{useEmitter:Kv,useEmitterValue:gt,usePublisher:On}=Uv(Fj,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Jj),e2=Yv({useEmitter:Kv,useEmitterValue:gt,usePublisher:On}),t2=Fv({useEmitter:Kv,useEmitterValue:gt,usePublisher:On});function Ax(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,Bt.WARN),r==="normal"?0:parseInt(r??"0",10)}const n2={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},Xv={source:"Own",installed:"Installed"};function a2(a){try{const r=localStorage.getItem(a);if(r!=null)return r==="true"}catch{}try{if(typeof sessionStorage<"u"){const r=sessionStorage.getItem(a);if(r!=null)return r==="true"}}catch{}return!1}function l2(a,r){const i=r?"true":"false";try{localStorage.setItem(a,i)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(a,i)}catch{}}function Mx({origin:a,count:r,filteredCount:i,updateCount:o,children:u}){const p=n2[a],[f,h]=v.useState(()=>a2(p)),x=v.useCallback(()=>{h(j=>{const S=!j;return l2(p,S),S})},[p]),m=Xv[a],y=`sidebar-section-${a}-header`,g=`sidebar-section-${a}-group`;return n.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!f,"aria-controls":g,onClick:x,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 12px 6px 14px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx(s2,{collapsed:f}),n.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:m}),n.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:i!=null&&i!==r?`(${i} of ${r})`:`(${r})`}),o!=null&&o>0&&n.jsx(r2,{origin:a,updateCount:o})]}),!f&&n.jsx("div",{id:g,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:u})]})}function r2({origin:a,updateCount:r}){const[i,o]=v.useState(!1),u=Xv[a].toLowerCase(),p=`${r} updates available in ${u} section, view all`;return n.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":p,onClick:f=>{f.stopPropagation(),window.location.hash="#/updates"},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),f.stopPropagation(),window.location.hash="#/updates")},onFocus:()=>o(!0),onBlur:()=>o(!1),style:{display:"inline-flex",alignItems:"center",gap:2,fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3,outline:i?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[r," updates",n.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function s2({collapsed:a}){return n.jsx("svg",{"aria-hidden":"true",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Id(a,r){const i=r.trim().toLowerCase();return i?a.skill.toLowerCase().includes(i)||a.plugin.toLowerCase().includes(i)||a.dir.toLowerCase().includes(i):!0}function i2({value:a,onChange:r,placeholder:i="Filter skills…",validationPattern:o,validationMessage:u="Invalid filter expression"}){const p=v.useRef(null),f=v.useId(),h=!!o&&a.trim()!==""&&!o.test(a);return v.useEffect(()=>{function x(m){var j;if(m.key!=="/")return;const y=m.target;if(!y)return;const g=y.tagName;g==="INPUT"||g==="TEXTAREA"||y.isContentEditable||(m.preventDefault(),(j=p.current)==null||j.focus())}return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]),n.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("svg",{"aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[n.jsx("circle",{cx:"11",cy:"11",r:"8"}),n.jsx("path",{d:"M21 21l-4.35-4.35"})]}),n.jsx("input",{ref:p,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?f:void 0,value:a,placeholder:i,onChange:x=>r(x.currentTarget.value),onKeyDown:x=>{x.key==="Escape"&&(r(""),x.currentTarget.blur())},style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12,padding:"2px 0"}}),h&&n.jsx("span",{id:f,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:u}),n.jsx("kbd",{"aria-hidden":"true",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",border:"1px solid var(--border-default)",padding:"1px 5px",borderRadius:3,display:a?"none":"inline-block"},children:"/"})]})}function o2({target:a}){const r=typeof a=="string"&&a.length>0,i=r?`symlinked → ${a}`:"symlinked — cycle detected or target unresolved",o=r?`symlinked from ${a}`:"symlinked, target unresolved";return n.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:i,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:n.jsxs("svg",{"data-testid":"symlink-glyph",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})}function c2({skill:a}){if(!a.updateAvailable)return null;const r=a.currentVersion??"",i=a.latestVersion,o=i?`Update available: ${r} → ${i}`.trim():"Update available";return n.jsx("span",{"data-testid":"skill-row-update-glyph",title:o,"aria-label":"Update available",style:{color:"var(--color-own)",display:"inline-flex",flexShrink:0},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 19V5"}),n.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function u2({skill:a,isSelected:r,onSelect:i,onContextMenu:o}){const u=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("button",{type:"button",onClick:i,onContextMenu:o?p=>{p.preventDefault(),o(p,a)}:void 0,"aria-current":r?"true":void 0,"aria-selected":!!r,"data-testid":"skill-row","data-selected":r,"data-origin":a.origin,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:r?"inset 2px 0 0 var(--color-accent, var(--accent-surface))":"none",border:"none",borderRadius:0,color:"var(--text-primary)",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,textAlign:"left",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease), box-shadow var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),n.jsx("span",{title:a.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.skill}),a.version&&n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",flexShrink:0},children:a.version}),a.isSymlink&&n.jsx(o2,{target:a.symlinkTarget??null}),n.jsx(c2,{skill:a})]})}const uo=v.memo(u2);function d2({plugin:a,skills:r,selectedKey:i,onSelect:o,onContextMenu:u}){const p=[...r].sort((f,h)=>f.skill.localeCompare(h.skill));return n.jsxs("div",{role:"group","aria-label":`${a} (${r.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a,children:a}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",r.length,")"]})]}),n.jsx("div",{role:"list",children:p.map(f=>{const h=!!i&&i.plugin===f.plugin&&i.skill===f.skill;return n.jsx("div",{role:"listitem",children:n.jsx(uo,{skill:f,isSelected:h,onSelect:()=>o(f),onContextMenu:u})},`${f.plugin}/${f.skill}`)})})]})}function f2(a,r){if(!a||typeof window>"u")return r;try{const i=window.localStorage.getItem(a);return i===null?r:i==="true"}catch{return r}}function zx({skills:a,pluginName:r,initialCollapsed:i=!1,persistKey:o,renderSkill:u}){var y;const p=r??((y=a[0])==null?void 0:y.pluginName)??"unknown-plugin",[f,h]=v.useState(()=>f2(o,i)),x=v.useCallback(()=>{h(g=>{const j=!g;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(j))}catch{}return j})},[o]),m=f?"▸":"▾";return n.jsxs("div",{"data-vskill-plugin-tree":p,role:"group","aria-label":`${p} (${a.length})`,children:[n.jsxs("button",{type:"button",onClick:x,"aria-expanded":!f,style:{display:"flex",alignItems:"center",gap:6,width:"100%",padding:"4px 10px 4px 18px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",color:"var(--text-primary)",fontSize:12,fontWeight:500},children:[n.jsx("span",{"aria-hidden":!0,className:"vskill-chevron tabular-nums",style:{width:12,display:"inline-block",textAlign:"center",fontSize:10,color:"var(--text-secondary)"},children:m}),n.jsx("span",{className:"vskill-plugin-name",style:{fontFamily:"var(--font-mono)"},children:p}),n.jsxs("span",{className:"vskill-plugin-count tabular-nums",style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["(",a.length,")"]})]}),!f&&n.jsx("div",{className:"vskill-plugin-tree-children",style:{paddingLeft:36,borderLeft:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",marginLeft:24},children:a.map(g=>n.jsx("div",{"data-vskill-plugin-skill":g.pluginNamespace??g.skill,children:u(g)},`${g.pluginNamespace??g.skill}`))})]})}function Lx({name:a,count:r,className:i,variant:o,collapsed:u,onToggle:p,action:f}){const h=o==="authoring"?"var(--color-own, #f59e0b)":"var(--color-accent, #2f6f8f)",x=o==="authoring"?"color-mix(in oklch, var(--color-own, #f59e0b) 10%, var(--color-paper, #fff))":"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))",m=typeof p=="function",y={position:"sticky",top:0,zIndex:4,backdropFilter:"saturate(1.4) blur(10px)",WebkitBackdropFilter:"saturate(1.4) blur(10px)",background:x,borderLeft:`3px solid ${h}`,borderBottom:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",padding:"7px 10px 7px 9px",fontFamily:"var(--font-serif, ui-serif)",fontSize:13,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-primary)",display:"flex",alignItems:"center",gap:8,width:"100%",cursor:m?"pointer":"default",border:"none",textAlign:"left"},g=u?"▸":"▾",j=n.jsxs(n.Fragment,{children:[m&&n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-secondary)",width:10,display:"inline-block",letterSpacing:0,textTransform:"none"},children:g}),n.jsx("span",{className:"vskill-group-header-name",children:a}),n.jsxs("span",{className:"vskill-group-header-count tabular-nums",style:{fontFamily:"var(--font-mono)",fontSize:11,fontWeight:500,color:"var(--text-secondary)",letterSpacing:0,textTransform:"none"},children:["(",r,")"]}),f&&n.jsx("span",{style:{marginLeft:"auto"},children:n.jsx(p2,{label:f.label,title:f.title,icon:f.icon,onClick:f.onClick,accent:h})})]});return m?n.jsx("button",{type:"button","data-vskill-group-header":a,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:y,onClick:()=>p(!u),"aria-expanded":!u,children:j}):n.jsx("div",{"data-vskill-group-header":a,role:"heading","aria-level":3,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:y,children:j})}function p2({label:a,title:r,icon:i,onClick:o,accent:u}){return n.jsxs("button",{type:"button","aria-label":a,title:r??a,onClick:p=>{p.stopPropagation(),o()},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,height:22,padding:"0 7px",border:`1px solid ${u}`,background:"transparent",color:u,borderRadius:4,fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",cursor:"pointer",fontFamily:"inherit"},onMouseEnter:p=>{p.currentTarget.style.background=`color-mix(in oklch, ${u} 15%, transparent)`},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[i,a]})}function m2(){return n.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[n.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),n.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function h2(a){const r=a.key.split("+").map(h=>h.trim()).filter(Boolean);let i=!!a.meta,o=!!a.ctrl,u=!!a.shift,p=!!a.alt,f=a.key;if(r.length>1){for(const h of r.slice(0,-1)){const x=h.toLowerCase();x==="cmd"||x==="meta"||x==="⌘"?i=!0:x==="ctrl"||x==="control"?o=!0:x==="shift"?u=!0:(x==="alt"||x==="option")&&(p=!0)}f=r[r.length-1]}return{key:f.length===1?f.toLowerCase():f,meta:i,ctrl:o,shift:u,alt:p,allowInInputs:!!a.allowInInputs,handler:a.handler}}function x2(a){if(!a||!(a instanceof HTMLElement))return!1;const r=a.tagName;if(r==="INPUT"||r==="TEXTAREA"||a.isContentEditable)return!0;const i=a.getAttribute("contenteditable");return i!=null&&i!=="false"||a.getAttribute("role")==="textbox"}function v2(a,r){const i=!!a.metaKey,o=!!a.ctrlKey,u=!!a.shiftKey,p=!!a.altKey;return i!==r.meta||o!==r.ctrl||u!==r.shift||p!==r.alt?!1:(a.key.length===1?a.key.toLowerCase():a.key)===r.key}function vd(a,r={}){const{enabled:i=!0,target:o}=r,u=v.useRef([]),p=Array.isArray(a)?a:[a];u.current=p.map(h2),v.useEffect(()=>{if(!i)return;const f=o??(typeof window<"u"?window:void 0);if(!f)return;function h(x){const m=x,y=x2(m.target);for(const g of u.current){if(!v2(m,g))continue;const j=g.meta||g.ctrl||g.alt;if(!(y&&!g.allowInInputs&&!j)){g.handler(m);return}}}return f.addEventListener("keydown",h),()=>{f.removeEventListener("keydown",h)}},[i,o])}const g2=200;function y2(a){return a.scope==="own"||a.scope==="installed"||a.scope==="global"?a.scope:a.origin==="installed"?"installed":"own"}function b2(a,r){const i={availableProject:[],availablePersonal:[],availablePlugin:[],authoringProject:[],authoringPlugin:[]};for(const u of a){const p=u.scopeV2??(u.scope==="installed"?"available-project":u.scope==="global"?"available-personal":"authoring-project");p==="available-project"?i.availableProject.push(u):p==="available-personal"?i.availablePersonal.push(u):p==="available-plugin"?i.availablePlugin.push(u):p==="authoring-plugin"?i.authoringPlugin.push(u):i.authoringProject.push(u)}function o(u){const p=u.filter(x=>Id(x,r)),f={};for(const x of p){const m=x.pluginName??x.plugin;(f[m]||(f[m]=[])).push(x)}const h=Object.entries(f).sort((x,m)=>x[0].localeCompare(m[0]));return{total:u.length,filtered:p.length,byPlugin:h}}return{availableProject:o(i.availableProject),availablePersonal:o(i.availablePersonal),availablePlugin:o(i.availablePlugin),authoringProject:o(i.authoringProject),authoringPlugin:o(i.authoringPlugin)}}function j2(a,r){const i=[],o=[],u=[];for(const f of a){const h=y2(f);h==="global"?u.push(f):h==="installed"?o.push(f):i.push(f)}function p(f){var y;const h=f.filter(g=>Id(g,r)),x={};for(const g of h)(x[y=g.plugin]||(x[y]=[])).push(g);const m=Object.entries(x).sort((g,j)=>g[0].localeCompare(j[0]));return{total:f.length,filtered:h.length,byPlugin:m}}return{own:p(i),installed:p(o),global:p(u)}}function S2(a,r){const i=[],o=[];for(const p of a)(p.origin==="installed"?o:i).push(p);function u(p){var m;const f=p.filter(y=>Id(y,r)),h={};for(const y of f)(h[m=y.plugin]||(h[m]=[])).push(y);const x=Object.entries(h).sort((y,g)=>y[0].localeCompare(g[0]));return{total:p.length,filtered:f.length,byPlugin:x}}return{own:u(i),installed:u(o)}}function k2({skills:a,selectedKey:r,onSelect:i,isLoading:o,error:u,onRetry:p,onContextMenu:f,outdatedByOrigin:h,activeAgentId:x,outdatedByScope:m,topSlot:y}){const g=!!x||a.some(E=>E.scope!==void 0&&E.scope!==null),j=x??"claude-cli",[S,N]=v.useState(""),z=v.useDeferredValue(S),T=v.useMemo(()=>j2(a,z),[a,z]),k=v.useMemo(()=>b2(a,z),[a,z]),M=j==="claude-code",[O,V]=v.useState(()=>gd(`vskill-sidebar-${j}-group-available-collapsed`)),[A,U]=v.useState(()=>gd(`vskill-sidebar-${j}-group-authoring-collapsed`)),w=v.useCallback(E=>{V(E);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-available-collapsed`,String(E))}catch{}},[j]),L=v.useCallback(E=>{U(E);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-authoring-collapsed`,String(E))}catch{}},[j]),{own:R,installed:I}=v.useMemo(()=>S2(a,z),[a,z]),Y=T.own.filtered+T.installed.filtered+T.global.filtered>=g2,te=v.useMemo(()=>{const E=B=>{const ne=[];for(const[,F]of B){const me=[...F].sort((D,K)=>D.skill.localeCompare(K.skill));ne.push(...me)}return ne};return g?[...E(T.own.byPlugin),...E(T.installed.byPlugin),...E(T.global.byPlugin)]:[...E(R.byPlugin),...E(I.byPlugin)]},[g,T.own.byPlugin,T.installed.byPlugin,T.global.byPlugin,R.byPlugin,I.byPlugin]),q=v.useMemo(()=>r?te.findIndex(E=>E.plugin===r.plugin&&E.skill===r.skill):-1,[te,r]),_=v.useCallback(E=>{if(te.length===0)return;const B=q<0?E>0?0:te.length-1:Math.min(Math.max(q+E,0),te.length-1);i(te[B])},[te,q,i]);return vd([{key:"j",handler:()=>_(1)},{key:"k",handler:()=>_(-1)},{key:"Enter",handler:()=>{q>=0&&i(te[q])}}],{enabled:!o&&!u}),n.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,n.jsx(i2,{value:S,onChange:N}),o&&n.jsx(T2,{}),!o&&u&&n.jsx(R2,{error:u,onRetry:p}),!o&&!u&&g&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Lx,{name:J.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:O,onToggle:w,count:k.availableProject.total+k.availablePersonal.total+k.availablePlugin.total}),!O&&n.jsxs(n.Fragment,{children:[n.jsx(ps,{label:J.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${j}-available-project-collapsed`,count:k.availableProject.total,filteredCount:S?k.availableProject.filtered:null,updateCount:(m==null?void 0:m.installed)??(h==null?void 0:h.installed),children:k.availableProject.filtered===0?n.jsx(_x,{queryActive:!!S,agentId:j}):n.jsx(ms,{items:k.availableProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Y})}),n.jsx(ps,{label:J.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${j}-available-personal-collapsed`,count:k.availablePersonal.total,filteredCount:S?k.availablePersonal.filtered:null,updateCount:m==null?void 0:m.global,children:k.availablePersonal.filtered===0?n.jsx(C2,{queryActive:!!S,agentId:j}):n.jsx(ms,{items:k.availablePersonal.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Y})}),M&&n.jsx(ps,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-available-plugin-collapsed`,count:k.availablePlugin.total,filteredCount:S?k.availablePlugin.filtered:null,children:k.availablePlugin.filtered===0?n.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin skills installed — run ",n.jsx("code",{children:"/plugin install"})," in Claude Code."]}):k.availablePlugin.byPlugin.map(([E,B])=>n.jsx(zx,{pluginName:E,skills:B,persistKey:`vskill-plugin-available-${E}-collapsed`,renderSkill:ne=>n.jsx(uo,{skill:ne,isSelected:(r==null?void 0:r.plugin)===ne.plugin&&(r==null?void 0:r.skill)===ne.skill,onSelect:()=>i(ne),onContextMenu:f})},`available-${E}`))})]}),n.jsx(E2,{}),n.jsx(Lx,{name:J.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:A,onToggle:L,count:k.authoringProject.total+k.authoringPlugin.total,action:{label:"New",title:"Create a new skill (standalone or plugin)",icon:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),onClick:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:request-create-skill",{detail:{mode:"standalone"}}))}}}),!A&&n.jsxs(n.Fragment,{children:[n.jsx(ps,{label:J.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${j}-authoring-project-collapsed`,count:k.authoringProject.total,filteredCount:S?k.authoringProject.filtered:null,updateCount:(m==null?void 0:m.own)??(h==null?void 0:h.source),children:k.authoringProject.filtered===0?n.jsx(Dx,{queryActive:!!S}):n.jsx(ms,{items:k.authoringProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Y})}),M&&n.jsx(ps,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-authoring-plugin-collapsed`,count:k.authoringPlugin.total,filteredCount:S?k.authoringPlugin.filtered:null,children:k.authoringPlugin.filtered===0?n.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",n.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):k.authoringPlugin.byPlugin.map(([E,B])=>n.jsx(zx,{pluginName:E,skills:B,persistKey:`vskill-plugin-authoring-${E}-collapsed`,renderSkill:ne=>n.jsx(uo,{skill:ne,isSelected:(r==null?void 0:r.plugin)===ne.plugin&&(r==null?void 0:r.skill)===ne.skill,onSelect:()=>i(ne),onContextMenu:f})},`authoring-${E}`))})]})]}),!o&&!u&&!g&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Mx,{origin:"source",count:R.total,filteredCount:S?R.filtered:null,updateCount:h==null?void 0:h.source,children:R.filtered===0?n.jsx(Dx,{queryActive:!!S}):n.jsx(ms,{items:R.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Y})}),n.jsx(N2,{}),n.jsx(Mx,{origin:"installed",count:I.total,filteredCount:S?I.filtered:null,updateCount:h==null?void 0:h.installed,children:I.filtered===0?n.jsx(_x,{queryActive:!!S}):n.jsx(ms,{items:I.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Y})})]})]})}function gd(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(a)==="true"}catch{return!1}}function ps({label:a,storageKey:r,count:i,filteredCount:o,updateCount:u,children:p}){const[f,h]=v.useState(()=>gd(r)),x=v.useCallback(()=>{h(y=>{const g=!y;if(typeof window<"u")try{window.localStorage.setItem(r,String(g))}catch{}return g})},[r]),m=o!=null&&o!==i?`${o} of ${i}`:String(i);return n.jsxs("section",{"data-vskill-named-scope":a,children:[n.jsxs("button",{type:"button",onClick:x,"aria-expanded":!f,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",background:"transparent",border:"none",cursor:"pointer",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-secondary)",width:10,display:"inline-block"},children:f?"▸":"▾"}),n.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:a}),n.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",m,")"]}),u!=null&&u>0&&n.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[u," update",u!==1?"s":""]})]}),!f&&n.jsx("div",{children:p})]})}function w2(a){const r=[];for(const[i,o]of a){const u=[...o].sort((p,f)=>p.skill.localeCompare(f.skill));r.push({kind:"header",plugin:i,count:u.length});for(const p of u)r.push({kind:"row",skill:p})}return r}function ms({items:a,selectedKey:r,onSelect:i,onContextMenu:o,useVirtual:u}){if(u){const p=w2(a);return n.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:n.jsx(Uj,{overscan:4,totalCount:p.length,itemContent:f=>{const h=p[f];if(!h)return null;if(h.kind==="header")return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const x=h.skill,m=!!r&&r.plugin===x.plugin&&r.skill===x.skill;return n.jsx(uo,{skill:x,isSelected:m,onSelect:()=>i(x),onContextMenu:o})}})})}return n.jsx("div",{"data-virtualized":"false",children:a.map(([p,f])=>n.jsx(d2,{plugin:p,skills:f,selectedKey:r,onSelect:i,onContextMenu:o},p))})}function Dx({queryActive:a}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:"No skills yet.",body:n.jsxs(n.Fragment,{children:["Create one with ",n.jsx(Hd,{children:"vskill new"})," or the"," ",n.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function _x({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:r?`No skills installed for ${r} in this project.`:"No installed skills.",body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(Hd,{children:"vskill install <plugin>"})," to add one."]})})}function C2({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:`No global skills for ${r}.`,body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(Hd,{children:"vskill install --global <plugin>"})," to add one."]})})}function pr({headline:a,body:r}){return n.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[n.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:a}),n.jsx("div",{children:r})]})}function Hd({children:a}){return n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-primary)",background:"color-mix(in srgb, var(--border-default) 45%, transparent)",padding:"1px 4px",borderRadius:3},children:a})}function N2(){return n.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function E2(){return n.jsx("div",{"aria-hidden":"true","data-testid":"scope-bold-divider",style:{height:3,background:"var(--color-rule)",boxShadow:"inset 0 1px 0 color-mix(in srgb, var(--color-rule) 50%, transparent)",margin:"12px 0"}})}function T2(){return n.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(a=>n.jsx(m2,{},a))})}function R2({error:a,onRetry:r}){return n.jsxs("div",{role:"alert",style:{margin:"12px 14px",padding:12,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-canvas)",color:"var(--text-primary)",fontSize:12},children:[n.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),n.jsxs("details",{children:[n.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:A2(a)}),n.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:a})]}),r&&n.jsx("button",{type:"button",onClick:r,style:{marginTop:8,background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"4px 10px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry"})]})}function A2(a){const r=a.split(`
|
|
55
|
-
`)[0]??a;return r.length>80?r.slice(0,77)+"…":r}const Qv=240,Zv=480,Jv="vskill-sidebar-width",js=320;function
|
|
56
|
-
`);M=U.pop()||"";for(const w of U)if(w.startsWith("event: "))O=w.slice(7).trim();else if(w.startsWith("data: ")){try{const
|
|
57
|
-
`);M=U.pop()||"";for(const w of U)if(w.startsWith("event: "))O=w.slice(7).trim();else if(w.startsWith("data: ")){try{const L=JSON.parse(w.slice(6)),R={event:O,data:L};r.current.onEvent(m,R)}catch{}O=""}}r.current.onDone(m)}catch(N){N.name!=="AbortError"&&r.current.onError(m,N.message)}finally{o(N=>{const z=new Set(N);return z.delete(m),z}),u.current.delete(m)}},[]),f=v.useCallback(m=>{var y;(y=u.current.get(m))==null||y.abort()},[]),h=v.useCallback(()=>{for(const m of u.current.values())m.abort()},[]),x=i.size>0;return{runningSet:i,startCase:p,stopCase:f,stopAll:h,isAnyCaseRunning:x}}const O2={plugin:"",skill:"",skillContent:"",savedContent:"",isDirty:!1,evals:null,evalsError:null,activePanel:"tests",selectedCaseId:null,caseRunStates:new Map,bulkRunActive:!1,runMode:null,latestBenchmark:null,inlineResults:new Map,improveTarget:null,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null,generateEvalsLoading:!1,generateEvalsProgress:[],generateEvalsError:null,regressions:[],iterationCount:0,activationPrompts:"",activationResults:[],activationSummary:null,activationRunning:!1,activationError:null,activationTotalPrompts:0,activationStartedAt:null,activationClassifyingStatus:null,generatingPrompts:!1,generatingPromptsError:null,activationHistory:null,activationHistoryLoading:!1,loading:!0,error:null};function B2(a,r){var i,o;switch(r.type){case"SET_LOADING":return{...a,loading:r.loading};case"SET_ERROR":return{...a,error:r.error};case"INIT_DATA":{const u=new Map;if(r.benchmark)for(const f of r.benchmark.cases)u.set(f.eval_id,{status:f.status,passRate:f.pass_rate,errorMessage:f.error_message||void 0,durationMs:f.durationMs,tokens:f.tokens,output:f.output,assertions:f.assertions.map(h=>({assertion_id:h.id,text:h.text,pass:h.pass,reasoning:h.reasoning}))});const p=((o=(i=r.evals)==null?void 0:i.evals[0])==null?void 0:o.id)??null;return{...a,skillContent:r.skillContent,savedContent:r.skillContent,isDirty:!1,evals:r.evals,evalsError:r.evalsError??null,latestBenchmark:r.benchmark,inlineResults:u,selectedCaseId:p,loading:!1,error:null}}case"SET_PANEL":return{...a,activePanel:r.panel};case"SET_CONTENT":return{...a,skillContent:r.content,isDirty:r.content!==a.savedContent};case"CONTENT_SAVED":return{...a,savedContent:a.skillContent,isDirty:!1};case"SET_EVALS":return{...a,evals:r.evals};case"SELECT_CASE":return{...a,selectedCaseId:r.caseId};case"CASE_RUN_START":{const u=new Map(a.caseRunStates);return u.set(r.caseId,{status:"running",startedAt:Date.now(),mode:r.mode}),{...a,caseRunStates:u,runMode:r.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const u=new Map(a.caseRunStates),p=u.get(r.caseId);u.set(r.caseId,{status:"complete",mode:p==null?void 0:p.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,r.result),{...a,caseRunStates:u,inlineResults:f}}case"CASE_RUN_ERROR":{const u=new Map(a.caseRunStates),p=u.get(r.caseId);u.set(r.caseId,{status:"error",mode:p==null?void 0:p.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,{status:"error",errorMessage:r.error,assertions:[]}),{...a,caseRunStates:u,inlineResults:f}}case"CASE_RUN_CANCEL":{const u=new Map(a.caseRunStates),p=u.get(r.caseId);return u.set(r.caseId,{status:"cancelled",mode:p==null?void 0:p.mode}),{...a,caseRunStates:u}}case"BULK_RUN_START":{const u=new Map(a.caseRunStates);for(const p of r.caseIds)u.set(p,{status:"queued",mode:r.mode});return{...a,caseRunStates:u,bulkRunActive:!0,runMode:r.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...a,bulkRunActive:!1,latestBenchmark:r.benchmark??a.latestBenchmark,iterationCount:a.iterationCount+1};case"CANCEL_ALL":{const u=new Map(a.caseRunStates);for(const[p,f]of u)(f.status==="running"||f.status==="queued")&&u.set(p,{status:"cancelled"});return{...a,caseRunStates:u,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const u=new Map(a.inlineResults);return u.set(r.evalId,r.result),{...a,inlineResults:u}}case"OPEN_IMPROVE":return{...a,improveTarget:r.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...a,improveTarget:null};case"OPEN_AI_EDIT":return{...a,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...a,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...a,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...a,aiEditProgress:[...a.aiEditProgress,r.entry]};case"AI_EDIT_RESULT":{const u=r.evalChanges??[],p=new Map;for(let f=0;f<u.length;f++)p.set(f,!0);return{...a,aiEditLoading:!1,aiEditResult:{improved:r.improved,reasoning:r.reasoning,evalChanges:u},aiEditEvalChanges:u,aiEditEvalSelections:p}}case"AI_EDIT_ERROR":return{...a,aiEditLoading:!1,aiEditError:r.message,aiEditClassifiedError:r.classified??null};case"GENERATE_EVALS_START":return{...a,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...a,generateEvalsProgress:[...a.generateEvalsProgress,r.entry]};case"GENERATE_EVALS_DONE":return{...a,generateEvalsLoading:!1,evals:r.evals};case"GENERATE_EVALS_ERROR":return{...a,generateEvalsLoading:!1,generateEvalsError:r.classified};case"TOGGLE_EVAL_CHANGE":{const u=new Map(a.aiEditEvalSelections);return u.set(r.index,!u.get(r.index)),{...a,aiEditEvalSelections:u}}case"SELECT_ALL_EVAL_CHANGES":{const u=new Map(a.aiEditEvalSelections);for(const p of u.keys())u.set(p,!0);return{...a,aiEditEvalSelections:u}}case"DESELECT_ALL_EVAL_CHANGES":{const u=new Map(a.aiEditEvalSelections);for(const p of u.keys())u.set(p,!1);return{...a,aiEditEvalSelections:u}}case"SET_EVALS_RETRY":return{...a,aiEditEvalsRetry:r.evalsFile};case"SET_REGRESSIONS":return{...a,regressions:r.regressions};case"INCREMENT_ITERATION":return{...a,iterationCount:a.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...a,activationPrompts:r.prompts};case"ACTIVATION_START":return{...a,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...a,activationResults:[...a.activationResults,r.result]};case"ACTIVATION_DONE":return{...a,activationRunning:!1,activationSummary:r.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...a,activationClassifyingStatus:`Classifying prompt ${r.index}/${r.total}...`};case"ACTIVATION_ERROR":return{...a,activationRunning:!1,activationError:r.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...a,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...a,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...a,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...a,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...a,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...a,generatingPrompts:!1,generatingPromptsError:r.error};case"ACTIVATION_HISTORY_LOADED":return{...a,activationHistory:r.runs,activationHistoryLoading:!1};default:return a}}function I2(a){if(a==="unit"||a==="integration")return a}function H2(a,r){const i=r.data;if(r.event==="output_ready"&&(a.output=i.output,i.durationMs!=null&&(a.durationMs=i.durationMs),i.tokens!=null&&(a.tokens=i.tokens)),r.event==="outputs_ready"&&(a.output=i.skillOutput,i.skillDurationMs!=null&&(a.durationMs=i.skillDurationMs),i.skillTokens!=null&&(a.tokens=i.skillTokens)),r.event==="assertion_result"){const o={assertion_id:i.assertion_id,text:i.text,pass:i.pass,reasoning:i.reasoning};a.assertions.find(u=>u.assertion_id===o.assertion_id)||a.assertions.push(o)}r.event==="case_complete"&&(a.status=i.status,a.passRate=i.pass_rate,a.errorMessage=i.error_message||void 0,a.classifiedError=i.classified_error||void 0)}const tg=v.createContext(null);function kn(){const a=v.useContext(tg);if(!a)throw new Error("useWorkspace must be used within WorkspaceProvider");return a}function Ox({plugin:a,skill:r,origin:i,children:o}){const u=i==="installed",[p,f]=v.useReducer(B2,{...O2,plugin:a,skill:r}),h=v.useRef(new Set),x=v.useRef(new Set),m=v.useRef(new Map),y=v.useCallback((ae,Z)=>{let se=m.current.get(ae);se||(se={assertions:[]},m.current.set(ae,se)),H2(se,Z),f({type:"UPDATE_INLINE_RESULT",evalId:ae,result:{...se,assertions:[...se.assertions]}})},[]),g=v.useCallback(ae=>{if(x.current.has(ae))return;x.current.add(ae);const Z=m.current.get(ae)??{assertions:[]};f({type:"CASE_RUN_COMPLETE",caseId:ae,result:{...Z,assertions:[...Z.assertions]}}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ne.getLatestBenchmark(a,r).then(se=>f({type:"BULK_RUN_COMPLETE",benchmark:se})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null})))},[a,r]),j=v.useCallback((ae,Z)=>{x.current.has(ae)||(x.current.add(ae),f({type:"CASE_RUN_ERROR",caseId:ae,error:Z}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ne.getLatestBenchmark(a,r).then(se=>f({type:"BULK_RUN_COMPLETE",benchmark:se})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[a,r]),{startCase:S,stopCase:N,stopAll:z}=_2({onEvent:y,onDone:g,onError:j});v.useEffect(()=>()=>{z()},[z]);const T=v.useCallback(async()=>{try{const ae=await fetch(`/api/skills/${a}/${r}/activation-history`);if(!ae.ok){if(ae.status===404){f({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const Z=await ae.json();f({type:"ACTIVATION_HISTORY_LOADED",runs:Z.runs||[]})}catch{}},[a,r]);v.useEffect(()=>{let ae=!1;async function Z(){try{const[se,ue,ge]=await Promise.allSettled([Ne.getSkillDetail(a,r),Ne.getEvals(a,r),Ne.getLatestBenchmark(a,r)]);if(ae)return;let Oe=null,Me=null;if(ue.status==="fulfilled")Oe=ue.value;else{const dt=ue.reason;(dt==null?void 0:dt.status)!==404&&(Me=(dt==null?void 0:dt.message)??"Failed to load test cases")}f({type:"INIT_DATA",skillContent:se.status==="fulfilled"?se.value.skillContent:"",evals:Oe,evalsError:Me,benchmark:ge.status==="fulfilled"?ge.value:null})}catch(se){ae||f({type:"SET_ERROR",error:se.message})}}return Z(),T(),()=>{ae=!0}},[a,r,T]);const k=v.useCallback(async()=>{if(!u)try{await Ne.applyImprovement(a,r,p.skillContent),f({type:"CONTENT_SAVED"})}catch(ae){f({type:"SET_ERROR",error:ae.message})}},[u,a,r,p.skillContent]),M=v.useCallback(async ae=>{if(!u)try{const Z=await Ne.saveEvals(a,r,ae);f({type:"SET_EVALS",evals:Z})}catch(Z){f({type:"SET_ERROR",error:Z.message})}},[u,a,r]),O=v.useCallback((ae,Z="benchmark")=>{if(u)return;const se=p.caseRunStates.get(ae);if((se==null?void 0:se.status)!=="running")if(m.current.delete(ae),x.current.delete(ae),f({type:"CASE_RUN_START",caseId:ae,mode:Z}),Z==="comparison"){const ue=`/api/skills/${a}/${r}/compare`;S(ae,ue,{eval_ids:[ae]})}else{const ue=`/api/skills/${a}/${r}/benchmark/case/${ae}`;S(ae,ue,Z==="baseline"?{baseline_only:!0}:void 0)}},[u,a,r,p.caseRunStates,S]),V=v.useCallback((ae="benchmark")=>{var ue;if(u)return;const Z=((ue=p.evals)==null?void 0:ue.evals)??[];if(Z.length===0)return;const se=Z.map(ge=>ge.id);for(const ge of se)m.current.delete(ge),x.current.delete(ge);f({type:"BULK_RUN_START",caseIds:se,mode:ae}),h.current=new Set(se);for(const ge of se)if(ae==="comparison")S(ge,`/api/skills/${a}/${r}/compare`,{eval_ids:[ge]});else{const Oe=`/api/skills/${a}/${r}/benchmark/case/${ge}`;S(ge,Oe,ae==="baseline"?{baseline_only:!0}:void 0)}},[u,a,r,p.evals,S]),A=v.useCallback(ae=>{N(ae),f({type:"CASE_RUN_CANCEL",caseId:ae}),h.current.delete(ae),x.current.add(ae)},[N]),U=v.useCallback(()=>{z(),f({type:"CANCEL_ALL"}),h.current.clear()},[z]),w=v.useCallback(async(ae,Z)=>{f({type:"OPEN_IMPROVE",evalId:ae})},[]),L=v.useCallback(async(ae,Z)=>{try{await Ne.applyImprovement(a,r,Z),f({type:"SET_CONTENT",content:Z}),f({type:"CONTENT_SAVED"}),f({type:"CLOSE_IMPROVE"}),O(ae,"benchmark")}catch(se){f({type:"SET_ERROR",error:se.message})}},[a,r,O]),R=Ku(),I=v.useRef(null),G=v.useRef(0);v.useEffect(()=>{const ae=R.events;for(let Z=G.current;Z<ae.length;Z++){const se=ae[Z],ue=se.data;if(se.event==="progress"&&f({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:ue.phase,message:ue.message}}),se.event==="done"){const ge=ue.improved,Oe=ue.reasoning,Me=ue.evalChanges??[];f({type:"AI_EDIT_RESULT",improved:ge,reasoning:Oe,evalChanges:Me})}if(se.event==="error"){const ge=ue;f({type:"AI_EDIT_ERROR",message:ge.description||"Unknown error",classified:ge})}}G.current=ae.length},[R.events]),v.useEffect(()=>{R.error&&f({type:"AI_EDIT_ERROR",message:R.error})},[R.error]),v.useEffect(()=>()=>{R.stop()},[R.stop]);const Y=v.useCallback(async(ae,Z,se)=>{u||(G.current=0,f({type:"AI_EDIT_LOADING"}),I.current=R.stop,R.start(`/api/skills/${a}/${r}/improve?sse`,{mode:"instruct",instruction:ae,content:p.skillContent,evals:p.evals??{skill_name:r,evals:[]},provider:Z,model:se}))},[u,a,r,p.skillContent,p.evals,R]),te=v.useCallback(()=>{R.stop(),f({type:"AI_EDIT_ERROR",message:"Cancelled"})},[R]),q=v.useCallback(async()=>{const ae=p.aiEditResult;if(ae!=null&&ae.improved)try{if(await Ne.applyImprovement(a,r,ae.improved),f({type:"SET_CONTENT",content:ae.improved}),f({type:"CONTENT_SAVED"}),p.aiEditEvalChanges.length>0&&Array.from(p.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:se}=await Cd(async()=>{const{mergeEvalChanges:Oe}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Oe}},[]),ue=p.evals??{skill_name:r,evals:[]},ge=se(ue,p.aiEditEvalChanges,p.aiEditEvalSelections);try{const Oe=await Ne.saveEvals(a,r,ge);f({type:"SET_EVALS",evals:Oe})}catch(Oe){f({type:"SET_EVALS_RETRY",evalsFile:ge}),f({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Oe.message}. You can retry from the AI Edit panel.`});return}}f({type:"CLOSE_AI_EDIT"})}catch(Z){f({type:"SET_ERROR",error:Z.message})}},[a,r,p.aiEditResult,p.evals,p.aiEditEvalChanges,p.aiEditEvalSelections]),_=v.useCallback(()=>{f({type:"CLOSE_AI_EDIT"})},[]),E=v.useCallback(ae=>{f({type:"TOGGLE_EVAL_CHANGE",index:ae})},[]),B=v.useCallback(()=>{f({type:"SELECT_ALL_EVAL_CHANGES"})},[]),ne=v.useCallback(()=>{f({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),F=v.useCallback(async()=>{const ae=p.aiEditEvalsRetry;if(ae)try{const Z=await Ne.saveEvals(a,r,ae);f({type:"SET_EVALS",evals:Z}),f({type:"SET_ERROR",error:null}),f({type:"CLOSE_AI_EDIT"})}catch(Z){f({type:"SET_ERROR",error:`Retry failed: ${Z.message}`})}},[a,r,p.aiEditEvalsRetry]),me=v.useCallback(async()=>{try{const ae=await Ne.getSkillDetail(a,r);f({type:"SET_CONTENT",content:ae.skillContent}),f({type:"CONTENT_SAVED"})}catch{}},[a,r]),{config:D}=bl(),K=Ku(),oe=v.useRef(0);v.useEffect(()=>{const ae=K.events;for(let Z=oe.current;Z<ae.length;Z++){const se=ae[Z],ue=se.data;if(se.event==="progress"&&f({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:ue.phase,message:ue.message}}),se.event==="done"){const ge=ue;Ne.saveEvals(a,r,ge).then(Oe=>f({type:"GENERATE_EVALS_DONE",evals:Oe})).catch(Oe=>f({type:"SET_ERROR",error:Oe.message}))}se.event==="error"&&f({type:"GENERATE_EVALS_ERROR",classified:ue})}oe.current=ae.length},[K.events,a,r]),v.useEffect(()=>{K.error&&f({type:"SET_ERROR",error:K.error})},[K.error]),v.useEffect(()=>()=>{K.stop()},[K.stop]);const fe=v.useCallback(async ae=>{if(u)return;oe.current=0,f({type:"GENERATE_EVALS_START"});const Z={};D!=null&&D.provider&&(Z.provider=D.provider),D!=null&&D.model&&(Z.model=D.model);const se=I2(ae==null?void 0:ae.testType);se&&(Z.testType=se),K.start(`/api/skills/${a}/${r}/generate-evals?sse`,Object.keys(Z).length>0?Z:void 0)},[u,a,r,K,D]),he=Ku(),xe=v.useRef(0);v.useEffect(()=>()=>{he.stop()},[he.stop]),v.useEffect(()=>{const ae=he.events;for(let Z=xe.current;Z<ae.length;Z++){const se=ae[Z];if(se.event==="classifying"){const ue=se.data;f({type:"ACTIVATION_CLASSIFYING",index:ue.index,total:ue.total})}if(se.event==="prompt_result"&&f({type:"ACTIVATION_RESULT",result:se.data}),se.event==="done"){ke.current&&(clearTimeout(ke.current),ke.current=null);const ue=se.data;if(ue.error)f({type:"ACTIVATION_ERROR",error:ue.error});else{f({type:"ACTIVATION_DONE",summary:ue});const ge={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(D==null?void 0:D.model)||"unknown",provider:(D==null?void 0:D.provider)||"unknown",promptCount:ue.total,summary:{precision:ue.precision,recall:ue.recall,reliability:ue.reliability,tp:ue.tp,tn:ue.tn,fp:ue.fp,fn:ue.fn}};f({type:"ACTIVATION_HISTORY_LOADED",runs:[ge,...p.activationHistory??[]]})}}}xe.current=ae.length},[he.events,D,p.activationHistory]),v.useEffect(()=>{he.error&&(ke.current&&(clearTimeout(ke.current),ke.current=null),f({type:"ACTIVATION_ERROR",error:he.error}))},[he.error]);const ke=v.useRef(null),ce=v.useCallback(()=>{ke.current&&(clearTimeout(ke.current),ke.current=null),he.stop(),f({type:"ACTIVATION_CANCEL",totalPrompts:0})},[he]),je=v.useCallback(ae=>{const se=ae.trim().split(`
|
|
58
|
-
`).filter(Boolean).map(ge=>ge.startsWith("!")?{prompt:ge.slice(1).trim(),expected:"should_not_activate"}:ge.startsWith("+")?{prompt:ge.slice(1).trim(),expected:"should_activate"}:{prompt:ge.trim(),expected:"auto"});xe.current=0,f({type:"ACTIVATION_START"}),f({type:"SET_ACTIVATION_PROMPTS",prompts:ae});const ue={prompts:se};
|
|
54
|
+
}`})]})}function rx(){typeof window>"u"||(window.location.hash="#/")}function f0({onHome:a}){const[r,i]=v.useState(!1),[o,u]=v.useState(!1),p=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),rx(),a==null||a())},f=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),rx(),a==null||a())};return n.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:p,onKeyDown:f,onFocus:()=>i(!0),onBlur:()=>i(!1),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0,padding:"4px 6px",margin:"-4px -6px",borderRadius:6,textDecoration:"none",color:"inherit",cursor:"pointer",outline:r?"2px solid var(--border-focus)":"none",outlineOffset:2,background:o?"color-mix(in srgb, var(--text-primary) 4%, transparent)":"transparent",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,background:"color-mix(in srgb, var(--accent-surface) 20%, transparent)"},children:n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-surface)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),n.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const p0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='1.75'%20stroke-linecap='round'%20stroke-linejoin='round'%20aria-hidden='true'%20focusable='false'%3e%3cpath%20d='M5.5%2017h11l-1.2-1.8a2%202%200%200%201-.3-1.1V10a4%204%200%201%200-8%200v4.1a2%202%200%200%201-.3%201.1L5.5%2017Z'%20/%3e%3cpath%20d='M10%2020a2%202%200%200%200%204%200'%20/%3e%3ccircle%20cx='17'%20cy='7'%20r='2.2'%20fill='currentColor'%20stroke='none'%20/%3e%3c/svg%3e",m0=v.lazy(()=>Nd(()=>import("./UpdateDropdown-BMVgsBm3.js"),__vite__mapDeps([0,1])));function h0(){const{updateCount:a,updates:r,isRefreshingUpdates:i,refreshUpdates:o,selectSkill:u}=ya(),[p,f]=v.useState(!1),h=v.useRef(null),x=v.useCallback(()=>f(!1),[]),m=a>0?"var(--text-primary)":"var(--text-secondary)",y=a>9?"9+":String(a),g=a===0?"No updates available":`${a} updates available, open summary`;return n.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[n.jsxs("button",{ref:h,type:"button","data-testid":"update-bell","aria-label":g,"aria-haspopup":"dialog","aria-expanded":p,onClick:()=>f(j=>!j),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:26,width:26,padding:0,borderRadius:4,border:"1px solid transparent",background:"transparent",color:m,cursor:"pointer"},children:[n.jsx("img",{src:p0,alt:"",width:18,height:18,style:{display:"block",opacity:a>0?1:.75}}),a>0&&n.jsx("span",{"data-testid":"update-bell-badge","aria-hidden":"true",style:{position:"absolute",top:-2,right:-2,minWidth:14,height:14,padding:"0 3px",borderRadius:999,background:"var(--color-own)",color:"var(--color-paper)",fontSize:9,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:600,lineHeight:1},children:y})]}),p&&n.jsx(v.Suspense,{fallback:n.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:n.jsx(m0,{updates:r,isRefreshing:i,onRefresh:()=>o(),onSelectSkill:j=>{const S=j.name.split("/"),N=S.length>=2?S[S.length-2]:S[0],L=S[S.length-1];u({plugin:N,skill:L,origin:"installed"}),x()},onViewAll:()=>{window.location.hash="#/updates",x()},onClose:x,anchorRef:h})})]})}function sx(a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:a}))}function x0({projectName:a,selected:r,onOpenPalette:i,onHome:o,projectPickerSlot:u,onRequestCreateSkill:p}){const f=r?r.origin==="installed"?"Installed":"Own":null;return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[n.jsx(f0,{onHome:o}),u?n.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:u}):a&&n.jsx("span",{title:a,style:{fontSize:12,color:"var(--text-secondary)",borderLeft:"1px solid var(--border-default)",paddingLeft:10,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a})]}),n.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:r&&f&&n.jsxs(n.Fragment,{children:[n.jsx(ix,{segment:"origin",onClick:()=>sx({scope:"origin",origin:r.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:r.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:f}),n.jsx(ox,{}),n.jsx(ix,{segment:"plugin",onClick:()=>sx({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),n.jsx(ox,{}),n.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.skill})]})}),n.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[p&&n.jsxs("button",{type:"button","data-slot":"create-skill-button",onClick:p,"aria-label":"Create a new skill",title:"Create a new skill",style:{display:"inline-flex",alignItems:"center",gap:6,height:28,padding:"0 12px",borderRadius:6,border:"none",background:"var(--color-accent, #2f6f8f)",color:"var(--color-paper, #fff)",fontSize:12,fontWeight:600,fontFamily:"var(--font-sans)",cursor:"pointer",letterSpacing:"0.01em"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]}),n.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:n.jsx(u0,{})}),n.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:n.jsx(h0,{})}),n.jsx("button",{type:"button",onClick:i,"aria-label":"Open command palette",title:"Command palette (⌘K)",style:{display:"inline-flex",alignItems:"center",gap:6,height:26,padding:"0 10px",borderRadius:4,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:"pointer"},children:n.jsx("span",{children:"⌘K"})})]})]})}function ix({segment:a,onClick:r,style:i,children:o}){return n.jsx("button",{type:"button","data-breadcrumb-segment":a,onClick:r,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...i},onMouseEnter:u=>{u.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:u=>{const p=(i==null?void 0:i.color)??"var(--text-secondary)";u.currentTarget.style.color=p},children:o})}function ox(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const ho="vskill-theme";function mv(a){return a==="light"||a==="dark"||a==="auto"?a:"auto"}function v0(a,r){return a==="light"||a==="dark"?a:r?"dark":"light"}function g0(a){try{const r=a.getItem(ho);return mv(r)}catch{return"auto"}}function y0(a,r){try{a.setItem(ho,r)}catch{}}function b0(a,r,i){a.dataset.theme=i,a.dataset.themeMode=r}function j0(a){if(!a)return!1;try{return a("(prefers-color-scheme: dark)").matches}catch{return!1}}const hv=v.createContext(null);function S0({storage:a,matchMedia:r,target:i,children:o}){const u=a??(typeof window<"u"?window.localStorage:void 0),p=r??(typeof window<"u"?window.matchMedia.bind(window):void 0),f=i??(typeof document<"u"?document.documentElement:void 0),[h,x]=v.useState(()=>u?g0(u):"auto"),[m,y]=v.useState(()=>j0(p)),g=v.useMemo(()=>v0(h,m),[h,m]);v.useEffect(()=>{f&&b0(f,h,g)},[f,h,g]),v.useEffect(()=>{if(!p)return;const N=p("(prefers-color-scheme: dark)"),L=k=>y(k.matches);if(typeof N.addEventListener=="function")return N.addEventListener("change",L),()=>N.removeEventListener("change",L);const T=N;return T.addListener(L),()=>T.removeListener(L)},[p]),v.useEffect(()=>{if(typeof window>"u")return;const N=L=>{L.key===ho&&x(mv(L.newValue))};return window.addEventListener("storage",N),()=>window.removeEventListener("storage",N)},[]),v.useEffect(()=>{if(!p||!f)return;let N;try{N=p("(prefers-contrast: more)")}catch{return}const L=M=>{M?f.dataset.contrast="more":f.dataset.contrast==="more"&&delete f.dataset.contrast};L(N.matches);const T=M=>L(M.matches);if(typeof N.addEventListener=="function")return N.addEventListener("change",T),()=>N.removeEventListener("change",T);const k=N;return k.addListener(T),()=>k.removeListener(T)},[p,f]);const j=v.useCallback(N=>{x(N),u&&y0(u,N)},[u]),S=v.useMemo(()=>({mode:h,resolvedTheme:g,setTheme:j}),[h,g,j]);return n.jsx(hv.Provider,{value:S,children:o})}function xv(){const a=v.useContext(hv);if(!a)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return a}const cx=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function k0(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of cx){const u=r.get(o);u&&i.push(u)}for(const o of a)cx.includes(o.id)||i.push(o);return i}function w0(a){const[r,i]=v.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${a}px)`).matches);return v.useEffect(()=>{var p;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${a}px)`),u=()=>i(o.matches);return(p=o.addEventListener)==null||p.call(o,"change",u),()=>{var f;return(f=o.removeEventListener)==null?void 0:f.call(o,"change",u)}},[a]),r}function C0({providers:a,onOpenSettings:r,onOpenInstallHelp:i}){const o=k0(a),u=w0(640),[p,f]=v.useState(!1),h=v.useCallback(x=>{x.available||x.kind==="api-key"?r==null||r(x.id):i==null||i(x.id)},[r,i]);if(u){const x=o.filter(m=>m.available).length;return n.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[n.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>f(!p),"aria-label":J.statusBar.providerSummary(x,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.statusBar.providerSummary(x,o.length)}),p&&n.jsx("div",{role:"menu",style:{position:"absolute",bottom:"120%",right:0,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,padding:6,minWidth:180,display:"flex",flexDirection:"column",gap:2,zIndex:80},children:o.map(m=>n.jsx(ux,{p:m,onClick:h},m.id))})]})}return n.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(x=>n.jsx(ux,{p:x,onClick:h,compact:!0},x.id))})}function ux({p:a,onClick:r,compact:i}){const o=a.available?J.statusBar.unlocked(a.label):a.kind==="cli-install"?J.statusBar.lockedCli(a.label):J.statusBar.locked(a.label);return n.jsxs("button",{type:"button","data-testid":`provider-glyph-${a.id}`,"data-available":a.available,"aria-label":o,title:o,onClick:()=>r(a),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:a.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:i?"2px":"4px 6px",fontSize:11},children:[n.jsx(dd,{unlocked:a.available,size:10}),!i&&n.jsx("span",{children:a.label})]})}function N0(){try{return typeof localStorage>"u"?null:localStorage.getItem(ho)}catch{return null}}function E0({projectPath:a,modelName:r,health:i="ok",onPathClick:o,providers:u,onOpenProviderSettings:p,onOpenProviderInstallHelp:f}){const{mode:h,resolvedTheme:x,setTheme:m}=xv(),g=N0()==="auto",j=T0(h,x,g),S=i==="down"||i==="degraded"?"var(--status-own)":"var(--status-installed)";return n.jsxs("div",{role:"contentinfo",style:{display:"flex",alignItems:"center",gap:12,height:"100%",width:"100%",padding:"0 12px",fontSize:11,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[n.jsx("span",{title:r??"",style:{fontFamily:"var(--font-mono)"},children:r??"—"}),n.jsx(dx,{}),n.jsxs("span",{"aria-label":`Health: ${i}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.jsx(R0,{color:S}),n.jsx("span",{style:{textTransform:"capitalize"},children:i})]}),u&&u.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(dx,{}),n.jsx(C0,{providers:u,onOpenSettings:p,onOpenInstallHelp:f})]}),n.jsx("div",{style:{flex:1}}),n.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>m(j),"aria-label":`Switch to ${j} theme`,title:`Theme: ${h} — click for ${j}`,style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"1px solid var(--border-default)",padding:"2px 8px",borderRadius:4,color:"var(--text-secondary)",cursor:"pointer",fontSize:11,height:20},children:[n.jsx(A0,{mode:h}),n.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function T0(a,r,i){return a==="light"?"dark":a==="dark"?"auto":i?"light":r==="light"?"dark":"light"}function R0({color:a}){return n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:a,display:"inline-block",flexShrink:0}})}function dx(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function A0({mode:a}){return a==="dark"?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):a==="light"?n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"4"}),n.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"9"}),n.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const xo=0,Wa=1,xr=2,vv=4;function fx(a){return()=>a}function M0(a){a()}function gv(a,r){return i=>a(r(i))}function px(a,r){return()=>a(r)}function z0(a,r){return i=>a(r,i)}function Ed(a){return a!==void 0}function L0(...a){return()=>{a.map(M0)}}function vr(){}function vo(a,r){return r(a),a}function D0(a,r){return r(a)}function ht(...a){return a}function et(a,r){return a(Wa,r)}function He(a,r){a(xo,r)}function Td(a){a(xr)}function yt(a){return a(vv)}function Ce(a,r){return et(a,z0(r,xo))}function $n(a,r){const i=a(Wa,o=>{i(),r(o)});return i}function mx(a){let r,i;return o=>u=>{r=u,i&&clearTimeout(i),i=setTimeout(()=>{o(r)},a)}}function yv(a,r){return a===r}function mt(a=yv){let r;return i=>o=>{a(r,o)||(r=o,i(o))}}function Ae(a){return r=>i=>{a(i)&&r(i)}}function ye(a){return r=>gv(r,a)}function Wn(a){return r=>()=>{r(a)}}function de(a,...r){const i=_0(...r);return((o,u)=>{switch(o){case xr:Td(a);return;case Wa:return et(a,i(u))}})}function Kn(a,r){return i=>o=>{i(r=a(r,o))}}function yl(a){return r=>i=>{a>0?a--:r(i)}}function ga(a){let r=null,i;return o=>u=>{r=u,!i&&(i=setTimeout(()=>{i=void 0,o(r)},a))}}function $e(...a){const r=new Array(a.length);let i=0,o=null;const u=2**a.length-1;return a.forEach((p,f)=>{const h=2**f;et(p,x=>{const m=i;i|=h,r[f]=x,m!==u&&i===u&&o&&(o(),o=null)})}),p=>f=>{const h=()=>{p([f].concat(r))};i===u?h():o=h}}function _0(...a){return r=>a.reduceRight(D0,r)}function O0(a){let r,i;const o=()=>r==null?void 0:r();return function(u,p){switch(u){case Wa:return p?i===p?void 0:(o(),i=p,r=et(a,p),r):(o(),vr);case xr:o(),i=null;return}}}function pe(a){let r=a;const i=Ke();return((o,u)=>{switch(o){case xo:r=u;break;case Wa:{u(r);break}case vv:return r}return i(o,u)})}function Qt(a,r){return vo(pe(r),i=>Ce(a,i))}function Ke(){const a=[];return((r,i)=>{switch(r){case xo:a.slice().forEach(o=>{o(i)});return;case xr:a.splice(0,a.length);return;case Wa:return a.push(i),()=>{const o=a.indexOf(i);o>-1&&a.splice(o,1)}}})}function jn(a){return vo(Ke(),r=>Ce(a,r))}function Ze(a,r=[],{singleton:i}={singleton:!0}){return{constructor:a,dependencies:r,id:B0(),singleton:i}}const B0=()=>Symbol();function I0(a){const r=new Map,i=({constructor:o,dependencies:u,id:p,singleton:f})=>{if(f&&r.has(p))return r.get(p);const h=o(u.map(x=>i(x)));return f&&r.set(p,h),h};return i(a)}function Dt(...a){const r=Ke(),i=new Array(a.length);let o=0;const u=2**a.length-1;return a.forEach((p,f)=>{const h=2**f;et(p,x=>{i[f]=x,o|=h,o===u&&He(r,i)})}),function(p,f){switch(p){case xr:{Td(r);return}case Wa:return o===u&&f(i),et(r,f)}}}function Re(a,r=yv){return de(a,mt(r))}function fd(...a){return function(r,i){switch(r){case xr:return;case Wa:return L0(...a.map(o=>et(o,i)))}}}const Bt={DEBUG:0,INFO:1,WARN:2,ERROR:3},H0={[Bt.DEBUG]:"debug",[Bt.ERROR]:"error",[Bt.INFO]:"log",[Bt.WARN]:"warn"},U0=()=>typeof globalThis>"u"?window:globalThis,Ka=Ze(()=>{const a=pe(Bt.ERROR);return{log:pe((r,i,o=Bt.INFO)=>{const u=U0().VIRTUOSO_LOG_LEVEL??yt(a);o>=u&&console[H0[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,i)}),logLevel:a}},[],{singleton:!0});function jl(a,r,i){return Rd(a,r,i).callbackRef}function Rd(a,r,i){const o=we.useRef(null);let u=f=>{};const p=we.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(f=>{const h=()=>{const x=f[0].target;x.offsetParent!==null&&a(x)};i?h():requestAnimationFrame(h)}):null,[a,i]);return u=f=>{f&&r?(p==null||p.observe(f),o.current=f):(o.current&&(p==null||p.unobserve(o.current)),o.current=null)},{callbackRef:u,ref:o}}function V0(a,r,i,o,u,p,f,h,x){const m=we.useCallback(y=>{const g=$0(y.children,r,h?"offsetWidth":"offsetHeight",u);let j=y.parentElement;for(;j.dataset.virtuosoScroller===void 0;)j=j.parentElement;const S=j.lastElementChild.dataset.viewportType==="window";let N;S&&(N=j.ownerDocument.defaultView);const L=f?h?f.scrollLeft:f.scrollTop:S?h?N.scrollX||N.document.documentElement.scrollLeft:N.scrollY||N.document.documentElement.scrollTop:h?j.scrollLeft:j.scrollTop,T=f?h?f.scrollWidth:f.scrollHeight:S?h?N.document.documentElement.scrollWidth:N.document.documentElement.scrollHeight:h?j.scrollWidth:j.scrollHeight,k=f?h?f.offsetWidth:f.offsetHeight:S?h?N.innerWidth:N.innerHeight:h?j.offsetWidth:j.offsetHeight;o({scrollHeight:T,scrollTop:Math.max(L,0),viewportHeight:k}),p==null||p(h?hx("column-gap",getComputedStyle(y).columnGap,u):hx("row-gap",getComputedStyle(y).rowGap,u)),g!==null&&a(g)},[a,r,u,p,f,o,h]);return Rd(m,i,x)}function $0(a,r,i,o){const u=a.length;if(u===0)return null;const p=[];for(let f=0;f<u;f++){const h=a.item(f);if(h.dataset.index===void 0)continue;const x=parseInt(h.dataset.index),m=parseFloat(h.dataset.knownSize),y=r(h,i);if(y===0&&o("Zero-sized element, this should not happen",{child:h},Bt.ERROR),y===m)continue;const g=p[p.length-1];p.length===0||g.size!==y||g.endIndex!==x-1?p.push({endIndex:x,size:y,startIndex:x}):p[p.length-1].endIndex++}return p}function hx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,Bt.WARN),r==="normal"?0:parseInt(r??"0",10)}function bv(a,r,i){const o=we.useRef(null),u=we.useCallback(x=>{if(!(x!=null&&x.offsetParent))return;const m=x.getBoundingClientRect(),y=m.width;let g,j;if(r){const S=r.getBoundingClientRect(),N=m.top-S.top;j=S.height-Math.max(0,N),g=N+r.scrollTop}else{const S=f.current.ownerDocument.defaultView;j=S.innerHeight-Math.max(0,m.top),g=m.top+S.scrollY}o.current={listHeight:m.height,offsetTop:g,visibleHeight:j,visibleWidth:y},a(o.current)},[a,r]),{callbackRef:p,ref:f}=Rd(u,!0,i),h=we.useCallback(()=>{u(f.current)},[u,f]);return we.useEffect(()=>{var m;if(r){r.addEventListener("scroll",h);const y=new ResizeObserver(()=>{requestAnimationFrame(h)});return y.observe(r),()=>{r.removeEventListener("scroll",h),y.unobserve(r)}}const x=(m=f.current)==null?void 0:m.ownerDocument.defaultView;return x==null||x.addEventListener("scroll",h),x==null||x.addEventListener("resize",h),()=>{x==null||x.removeEventListener("scroll",h),x==null||x.removeEventListener("resize",h)}},[h,r,f]),p}const an=Ze(()=>{const a=Ke(),r=Ke(),i=pe(0),o=Ke(),u=pe(0),p=Ke(),f=Ke(),h=pe(0),x=pe(0),m=pe(0),y=pe(0),g=Ke(),j=Ke(),S=pe(!1),N=pe(!1),L=pe(!1);return Ce(de(a,ye(({scrollTop:T})=>T)),r),Ce(de(a,ye(({scrollHeight:T})=>T)),f),Ce(r,u),{deviation:i,fixedFooterHeight:m,fixedHeaderHeight:x,footerHeight:y,headerHeight:h,horizontalDirection:N,scrollBy:j,scrollContainerState:a,scrollHeight:f,scrollingInProgress:S,scrollTo:g,scrollTop:r,skipAnimationFrameInResizeObserver:L,smoothScrollTargetReached:o,statefulScrollTop:u,viewportHeight:p}},[],{singleton:!0}),Ss={lvl:0};function jv(a,r){const i=a.length;if(i===0)return[];let{index:o,value:u}=r(a[0]);const p=[];for(let f=1;f<i;f++){const{index:h,value:x}=r(a[f]);p.push({end:h-1,start:o,value:u}),o=h,u=x}return p.push({end:1/0,start:o,value:u}),p}function ot(a){return a===Ss}function ks(a,r){if(!ot(a))return r===a.k?a.v:r<a.k?ks(a.l,r):ks(a.r,r)}function Gn(a,r,i="k"){if(ot(a))return[-1/0,void 0];if(Number(a[i])===r)return[a.k,a.v];if(Number(a[i])<r){const o=Gn(a.r,r,i);return o[0]===-1/0?[a.k,a.v]:o}return Gn(a.l,r,i)}function yn(a,r,i){return ot(a)?wv(r,i,1):r===a.k?Ot(a,{k:r,v:i}):r<a.k?xx(Ot(a,{l:yn(a.l,r,i)})):xx(Ot(a,{r:yn(a.r,r,i)}))}function ur(){return Ss}function dr(a,r,i){if(ot(a))return[];const o=Gn(a,r)[0];return G0(md(a,o,i))}function pd(a,r){if(ot(a))return Ss;const{k:i,l:o,r:u}=a;if(r===i){if(ot(o))return u;if(ot(u))return o;const[p,f]=kv(o);return ao(Ot(a,{k:p,l:Sv(o),v:f}))}return r<i?ao(Ot(a,{l:pd(o,r)})):ao(Ot(a,{r:pd(u,r)}))}function gl(a){return ot(a)?[]:[...gl(a.l),{k:a.k,v:a.v},...gl(a.r)]}function md(a,r,i){if(ot(a))return[];const{k:o,l:u,r:p,v:f}=a;let h=[];return o>r&&(h=h.concat(md(u,r,i))),o>=r&&o<=i&&h.push({k:o,v:f}),o<=i&&(h=h.concat(md(p,r,i))),h}function ao(a){const{l:r,lvl:i,r:o}=a;if(o.lvl>=i-1&&r.lvl>=i-1)return a;if(i>o.lvl+1){if(Pu(r))return Cv(Ot(a,{lvl:i-1}));if(!ot(r)&&!ot(r.r))return Ot(r.r,{l:Ot(r,{r:r.r.l}),lvl:i,r:Ot(a,{l:r.r.r,lvl:i-1})});throw new Error("Unexpected empty nodes")}if(Pu(a))return hd(Ot(a,{lvl:i-1}));if(!ot(o)&&!ot(o.l)){const u=o.l,p=Pu(u)?o.lvl-1:o.lvl;return Ot(u,{l:Ot(a,{lvl:i-1,r:u.l}),lvl:u.lvl+1,r:hd(Ot(o,{l:u.r,lvl:p}))})}throw new Error("Unexpected empty nodes")}function Ot(a,r){return wv(r.k!==void 0?r.k:a.k,r.v!==void 0?r.v:a.v,r.lvl!==void 0?r.lvl:a.lvl,r.l!==void 0?r.l:a.l,r.r!==void 0?r.r:a.r)}function Sv(a){return ot(a.r)?a.l:ao(Ot(a,{r:Sv(a.r)}))}function Pu(a){return ot(a)||a.lvl>a.r.lvl}function kv(a){return ot(a.r)?[a.k,a.v]:kv(a.r)}function wv(a,r,i,o=Ss,u=Ss){return{k:a,l:o,lvl:i,r:u,v:r}}function xx(a){return hd(Cv(a))}function Cv(a){const{l:r}=a;return!ot(r)&&r.lvl===a.lvl?Ot(r,{r:Ot(a,{l:r.r})}):a}function hd(a){const{lvl:r,r:i}=a;return!ot(i)&&!ot(i.r)&&i.lvl===r&&i.r.lvl===r?Ot(i,{l:Ot(a,{r:i.l}),lvl:r+1}):a}function G0(a){return jv(a,({k:r,v:i})=>({index:r,value:i}))}function Nv(a,r){return!!(a&&a.startIndex===r.startIndex&&a.endIndex===r.endIndex)}function ws(a,r){return!!(a&&a[0]===r[0]&&a[1]===r[1])}const Ad=Ze(()=>({recalcInProgress:pe(!1)}),[],{singleton:!0});function Ev(a,r,i){return a[oo(a,r,i)]}function oo(a,r,i,o=0){let u=a.length-1;for(;o<=u;){const p=Math.floor((o+u)/2),f=a[p],h=i(f,r);if(h===0)return p;if(h===-1){if(u-o<2)return p-1;u=p-1}else{if(u===o)return p;o=p+1}}throw new Error(`Failed binary finding record in array - ${a.join(",")}, searched for ${r}`)}function P0(a,r,i,o){const u=oo(a,r,o),p=oo(a,i,o,u);return a.slice(u,p+1)}function Fa(a,r){return Math.round(a.getBoundingClientRect()[r])}function go(a){return!ot(a.groupOffsetTree)}function Md({index:a},r){return r===a?0:r<a?-1:1}function q0(){return{groupIndices:[],groupOffsetTree:ur(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:ur()}}function Y0(a,r){let i=ot(a)?0:1/0;for(const o of r){const{endIndex:u,size:p,startIndex:f}=o;if(i=Math.min(i,f),ot(a)){a=yn(a,0,p);continue}const h=dr(a,f-1,u+1);if(h.some(J0(o)))continue;let x=!1,m=!1;for(const{end:y,start:g,value:j}of h)x?(u>=g||p===j)&&(a=pd(a,g)):(m=j!==p,x=!0),y>u&&u>=g&&j!==p&&(a=yn(a,u+1,j));m&&(a=yn(a,f,p))}return[a,i]}function F0(a){return typeof a.groupIndex<"u"}function W0({offset:a},r){return r===a?0:r<a?-1:1}function Cs(a,r,i){if(r.length===0)return 0;const{index:o,offset:u,size:p}=Ev(r,a,Md),f=a-o,h=p*f+(f-1)*i+u;return h>0?h+i:h}function Tv(a,r){if(!go(r))return a;let i=0;for(;r.groupIndices[i]<=a+i;)i++;return a+i}function Rv(a,r,i){if(F0(a))return r.groupIndices[a.groupIndex]+1;const o=a.index==="LAST"?i:a.index;let u=Tv(o,r);return u=Math.max(0,u,Math.min(i,u)),u}function K0(a,r,i,o=0){return o>0&&(r=Math.max(r,Ev(a,o,Md).offset)),jv(P0(a,r,i,W0),Z0)}function X0(a,[r,i,o,u]){r.length>0&&o("received item sizes",r,Bt.DEBUG);const p=a.sizeTree;let f=p,h=0;if(i.length>0&&ot(p)&&r.length===2){const j=r[0].size,S=r[1].size;f=i.reduce((N,L)=>yn(yn(N,L,j),L+1,S),f)}else[f,h]=Y0(f,r);if(f===p)return a;const{lastIndex:x,lastOffset:m,lastSize:y,offsetTree:g}=xd(a.offsetTree,h,f,u);return{groupIndices:i,groupOffsetTree:i.reduce((j,S)=>yn(j,S,Cs(S,g,u)),ur()),lastIndex:x,lastOffset:m,lastSize:y,offsetTree:g,sizeTree:f}}function Q0(a){return gl(a).map(({k:r,v:i},o,u)=>{const p=u[o+1];return{endIndex:p!==void 0?p.k-1:1/0,size:i,startIndex:r}})}function vx(a,r){let i=0,o=0;for(;i<a;)i+=r[o+1]-r[o]-1,o++;return o-(i===a?0:1)}function xd(a,r,i,o){let u=a,p=0,f=0,h=0,x=0;if(r!==0){x=oo(u,r-1,Md),h=u[x].offset;const m=Gn(i,r-1);p=m[0],f=m[1],u.length&&u[x].size===Gn(i,r)[1]&&(x-=1),u=u.slice(0,x+1)}else u=[];for(const{start:m,value:y}of dr(i,r,1/0)){const g=m-p,j=g*f+h+g*o;u.push({index:m,offset:j,size:y}),p=m,h=j,f=y}return{lastIndex:p,lastOffset:h,lastSize:f,offsetTree:u}}function Z0(a){return{index:a.index,value:a}}function J0(a){const{endIndex:r,size:i,startIndex:o}=a;return u=>u.start===o&&(u.end===r||u.end===1/0)&&u.value===i}const ej={offsetHeight:"height",offsetWidth:"width"},Qn=Ze(([{log:a},{recalcInProgress:r}])=>{const i=Ke(),o=Ke(),u=Qt(o,0),p=Ke(),f=Ke(),h=pe(0),x=pe([]),m=pe(void 0),y=pe(void 0),g=pe(void 0),j=pe(void 0),S=pe((w,D)=>Fa(w,ej[D])),N=pe(void 0),L=pe(0),T=q0(),k=Qt(de(i,$e(x,a,L),Kn(X0,T),mt()),T),M=Qt(de(x,mt(),Kn((w,D)=>({current:D,prev:w.current}),{current:[],prev:[]}),ye(({prev:w})=>w)),[]);Ce(de(x,Ae(w=>w.length>0),$e(k,L),ye(([w,D,R])=>{const I=w.reduce((G,q,te)=>yn(G,q,Cs(q,D.offsetTree,R)||te),ur());return{...D,groupIndices:w,groupOffsetTree:I}})),k),Ce(de(o,$e(k),Ae(([w,{lastIndex:D}])=>w<D),ye(([w,{lastIndex:D,lastSize:R}])=>[{endIndex:D,size:R,startIndex:w}])),i),Ce(m,y);const O=Qt(de(m,ye(w=>w===void 0)),!0);Ce(de(y,Ae(w=>w!==void 0&&ot(yt(k).sizeTree)),ye(w=>{const D=yt(g),R=yt(x).length>0;return D!==void 0&&D!==0?R?[{endIndex:0,size:D,startIndex:0},{endIndex:1,size:w,startIndex:1}]:[]:[{endIndex:0,size:w,startIndex:0}]})),i),Ce(de(j,Ae(w=>w!==void 0&&w.length>0&&ot(yt(k).sizeTree)),ye(w=>{const D=[];let R=w[0],I=0;for(let G=1;G<w.length;G++){const q=w[G];q!==R&&(D.push({endIndex:G-1,size:R,startIndex:I}),R=q,I=G)}return D.push({endIndex:w.length-1,size:R,startIndex:I}),D})),i),Ce(de(x,$e(g,y),Ae(([,w,D])=>w!==void 0&&D!==void 0),ye(([w,D,R])=>{const I=[];for(let G=0;G<w.length;G++){const q=w[G],te=w[G+1];I.push({startIndex:q,endIndex:q,size:D}),te!==void 0&&I.push({startIndex:q+1,endIndex:te-1,size:R})}return I})),i);const V=jn(de(i,$e(k),Kn(({sizes:w},[D,R])=>({changed:R!==w,sizes:R}),{changed:!1,sizes:T}),ye(w=>w.changed)));et(de(h,Kn((w,D)=>({diff:w.prev-D,prev:D}),{diff:0,prev:0}),ye(w=>w.diff)),w=>{const{groupIndices:D}=yt(k);if(w>0)He(r,!0),He(p,w+vx(w,D));else if(w<0){const R=yt(M);R.length>0&&(w-=vx(-w,R)),He(f,w)}}),et(de(h,$e(a)),([w,D])=>{w<0&&D("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:h},Bt.ERROR)});const A=jn(p);Ce(de(p,$e(k),ye(([w,D])=>{const R=D.groupIndices.length>0,I=[],G=D.lastSize;if(R){const q=ks(D.sizeTree,0);let te=0,Q=0;for(;te<w;){const E=D.groupIndices[Q],B=D.groupIndices.length===Q+1?1/0:D.groupIndices[Q+1]-E-1;I.push({endIndex:E,size:q,startIndex:E}),I.push({endIndex:E+1+B-1,size:G,startIndex:E+1}),Q++,te+=B+1}const z=gl(D.sizeTree);return te!==w&&z.shift(),z.reduce((E,{k:B,v:ne})=>{let Y=E.ranges;return E.prevSize!==0&&(Y=[...E.ranges,{endIndex:B+w-1,size:E.prevSize,startIndex:E.prevIndex}]),{prevIndex:B+w,prevSize:ne,ranges:Y}},{prevIndex:w,prevSize:0,ranges:I}).ranges}return gl(D.sizeTree).reduce((q,{k:te,v:Q})=>({prevIndex:te+w,prevSize:Q,ranges:[...q.ranges,{endIndex:te+w-1,size:q.prevSize,startIndex:q.prevIndex}]}),{prevIndex:0,prevSize:G,ranges:[]}).ranges})),i);const U=jn(de(f,$e(k,L),ye(([w,{offsetTree:D},R])=>{const I=-w;return Cs(I,D,R)})));return Ce(de(f,$e(k,L),ye(([w,D,R])=>{if(D.groupIndices.length>0){if(ot(D.sizeTree))return D;let G=ur();const q=yt(M);let te=0,Q=0,z=0;for(;te<-w;){z=q[Q];const E=q[Q+1]-z-1;Q++,te+=E+1}if(G=gl(D.sizeTree).reduce((E,{k:B,v:ne})=>yn(E,Math.max(0,B+w),ne),G),te!==-w){const E=ks(D.sizeTree,z);G=yn(G,0,E);const B=Gn(D.sizeTree,-w+1)[1];G=yn(G,1,B)}return{...D,sizeTree:G,...xd(D.offsetTree,0,G,R)}}const I=gl(D.sizeTree).reduce((G,{k:q,v:te})=>yn(G,Math.max(0,q+w),te),ur());return{...D,sizeTree:I,...xd(D.offsetTree,0,I,R)}})),k),{beforeUnshiftWith:A,data:N,defaultItemSize:y,firstItemIndex:h,fixedItemSize:m,fixedGroupSize:g,gap:L,groupIndices:x,heightEstimates:j,itemSize:S,listRefresh:V,shiftWith:f,shiftWithOffset:U,sizeRanges:i,sizes:k,statefulTotalCount:u,totalCount:o,trackItemSizes:O,unshiftWith:p}},ht(Ka,Ad),{singleton:!0});function tj(a){return a.reduce((r,i)=>(r.groupIndices.push(r.totalCount),r.totalCount+=i+1,r),{groupIndices:[],totalCount:0})}const Av=Ze(([{groupIndices:a,sizes:r,totalCount:i},{headerHeight:o,scrollTop:u}])=>{const p=Ke(),f=Ke(),h=jn(de(p,ye(tj)));return Ce(de(h,ye(x=>x.totalCount)),i),Ce(de(h,ye(x=>x.groupIndices)),a),Ce(de(Dt(u,r,o),Ae(([x,m])=>go(m)),ye(([x,m,y])=>Gn(m.groupOffsetTree,Math.max(x-y,0),"v")[0]),mt(),ye(x=>[x])),f),{groupCounts:p,topItemsIndexes:f}},ht(Qn,an)),Xa=Ze(([{log:a}])=>{const r=pe(!1),i=jn(de(r,Ae(o=>o),mt()));return et(r,o=>{o&&yt(a)("props updated",{},Bt.DEBUG)}),{didMount:i,propsReady:r}},ht(Ka),{singleton:!0}),nj=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Mv(a){const r=typeof a=="number"?{index:a}:a;return r.align||(r.align="start"),(!r.behavior||!nj)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const Rs=Ze(([{gap:a,listRefresh:r,sizes:i,totalCount:o},{fixedFooterHeight:u,fixedHeaderHeight:p,footerHeight:f,headerHeight:h,scrollingInProgress:x,scrollTo:m,smoothScrollTargetReached:y,viewportHeight:g},{log:j}])=>{const S=Ke(),N=Ke(),L=pe(0);let T=null,k=null,M=null;function O(){T!==null&&(T(),T=null),M!==null&&(M(),M=null),k&&(clearTimeout(k),k=null),He(x,!1)}return Ce(de(S,$e(i,g,o,L,h,f,j),$e(a,p,u),ye(([[V,A,U,w,D,R,I,G],q,te,Q])=>{const z=Mv(V),{align:E,behavior:B,offset:ne}=z,Y=w-1,me=Rv(z,A,Y);let _=Cs(me,A.offsetTree,q)+R;E==="end"?(_+=te+Gn(A.sizeTree,me)[1]-U+Q,me===Y&&(_+=I)):E==="center"?_+=(te+Gn(A.sizeTree,me)[1]-U+Q)/2:_-=D,ne!==void 0&&ne!==0&&(_+=ne);const W=oe=>{O(),oe?(G("retrying to scroll to",{location:V},Bt.DEBUG),He(S,V)):(He(N,!0),G("list did not change, scroll successful",{},Bt.DEBUG))};if(O(),B==="smooth"){let oe=!1;M=et(r,fe=>{oe=oe||fe}),T=$n(y,()=>{W(oe)})}else T=$n(de(r,aj(150)),W);return k=setTimeout(()=>{O()},1200),He(x,!0),G("scrolling from index to",{behavior:B,index:me,top:_},Bt.DEBUG),{behavior:B,top:_}})),m),{scrollTargetReached:N,scrollToIndex:S,topListHeight:L}},ht(Qn,an,Ka),{singleton:!0});function aj(a){return r=>{const i=setTimeout(()=>{r(!1)},a);return o=>{o&&(r(!0),clearTimeout(i))}}}function zd(a,r){a===0?r():requestAnimationFrame(()=>{zd(a-1,r)})}function Ld(a,r){const i=r-1;return typeof a=="number"?a:a.index==="LAST"?i:a.index}const As=Ze(([{defaultItemSize:a,listRefresh:r,sizes:i},{scrollTop:o},{scrollTargetReached:u,scrollToIndex:p},{didMount:f}])=>{const h=pe(!0),x=pe(0),m=pe(!0);return Ce(de(f,$e(x),Ae(([y,g])=>g!==0),Wn(!1)),h),Ce(de(f,$e(x),Ae(([y,g])=>g!==0),Wn(!1)),m),et(de(Dt(r,f),$e(h,i,a,m),Ae(([[,y],g,{sizeTree:j},S,N])=>y&&(!ot(j)||Ed(S))&&!g&&!N),$e(x)),([,y])=>{$n(u,()=>{He(m,!0)}),zd(4,()=>{$n(o,()=>{He(h,!0)}),He(p,y)})}),{initialItemFinalLocationReached:m,initialTopMostItemIndex:x,scrolledToInitialItem:h}},ht(Qn,an,Rs,Xa),{singleton:!0});function zv(a,r){return Math.abs(a-r)<1.01}const Ns="up",ys="down",lj="none",rj={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},sj=0,Ms=Ze(([{footerHeight:a,headerHeight:r,scrollBy:i,scrollContainerState:o,scrollTop:u,viewportHeight:p}])=>{const f=pe(!1),h=pe(!0),x=Ke(),m=Ke(),y=pe(4),g=pe(sj),j=Qt(de(fd(de(Re(u),yl(1),Wn(!0)),de(Re(u),yl(1),Wn(!1),mx(100))),mt()),!1),S=Qt(de(fd(de(i,Wn(!0)),de(i,Wn(!1),mx(200))),mt()),!1);Ce(de(Dt(Re(u),Re(g)),ye(([M,O])=>M<=O),mt()),h),Ce(de(h,ga(50)),m);const N=jn(de(Dt(o,Re(p),Re(r),Re(a),Re(y)),Kn((M,[{scrollHeight:O,scrollTop:V},A,U,w,D])=>{const R=V+A-O>-D,I={scrollHeight:O,scrollTop:V,viewportHeight:A};if(R){let q,te;return V>M.state.scrollTop?(q="SCROLLED_DOWN",te=M.state.scrollTop-V):(q="SIZE_DECREASED",te=M.state.scrollTop-V||M.scrollTopDelta),{atBottom:!0,atBottomBecause:q,scrollTopDelta:te,state:I}}let G;return I.scrollHeight>M.state.scrollHeight?G="SIZE_INCREASED":A<M.state.viewportHeight?G="VIEWPORT_HEIGHT_DECREASING":V<M.state.scrollTop?G="SCROLLING_UPWARDS":G="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:G,state:I}},rj),mt((M,O)=>M!==void 0&&M.atBottom===O.atBottom))),L=Qt(de(o,Kn((M,{scrollHeight:O,scrollTop:V,viewportHeight:A})=>{if(!zv(M.scrollHeight,O)){const U=O-(V+A)<1;return M.scrollTop!==V&&U?{changed:!0,jump:M.scrollTop-V,scrollHeight:O,scrollTop:V}:{changed:!0,jump:0,scrollHeight:O,scrollTop:V}}return{changed:!1,jump:0,scrollHeight:O,scrollTop:V}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Ae(M=>M.changed),ye(M=>M.jump)),0);Ce(de(N,ye(M=>M.atBottom)),f),Ce(de(f,ga(50)),x);const T=pe(ys);Ce(de(o,ye(({scrollTop:M})=>M),mt(),Kn((M,O)=>yt(S)?{direction:M.direction,prevScrollTop:O}:{direction:O<M.prevScrollTop?Ns:ys,prevScrollTop:O},{direction:ys,prevScrollTop:0}),ye(M=>M.direction)),T),Ce(de(o,ga(50),Wn(lj)),T);const k=pe(0);return Ce(de(j,Ae(M=>!M),Wn(0)),k),Ce(de(u,ga(100),$e(j),Ae(([M,O])=>O),Kn(([M,O],[V])=>[O,V],[0,0]),ye(([M,O])=>O-M)),k),{atBottomState:N,atBottomStateChange:x,atBottomThreshold:y,atTopStateChange:m,atTopThreshold:g,isAtBottom:f,isAtTop:h,isScrolling:j,lastJumpDueToItemResize:L,scrollDirection:T,scrollVelocity:k}},ht(an)),Es="top",Ts="bottom",gx="none";function yx(a,r,i){return typeof a=="number"?i===Ns&&r===Es||i===ys&&r===Ts?a:0:i===Ns?r===Es?a.main:a.reverse:r===Ts?a.main:a.reverse}function bx(a,r){return typeof a=="number"?a:a[r]??0}const Dd=Ze(([{deviation:a,fixedHeaderHeight:r,headerHeight:i,scrollTop:o,viewportHeight:u}])=>{const p=Ke(),f=pe(0),h=pe(0),x=pe(0),m=Qt(de(Dt(Re(o),Re(u),Re(i),Re(p,ws),Re(x),Re(f),Re(r),Re(a),Re(h)),ye(([y,g,j,[S,N],L,T,k,M,O])=>{const V=y-M,A=T+k,U=Math.max(j-V,0);let w=gx;const D=bx(O,Es),R=bx(O,Ts);return S-=M,S+=j+k,N+=j+k,N-=M,S>y+A-D&&(w=Ns),N<y-U+g+R&&(w=ys),w!==gx?[Math.max(V-j-yx(L,Es,w)-D,0),V-U-k+g+yx(L,Ts,w)+R]:null}),Ae(y=>y!==null),mt(ws)),[0,0]);return{increaseViewportBy:h,listBoundary:p,overscan:x,topListHeight:f,visibleRange:m}},ht(an),{singleton:!0});function ij(a,r,i){if(go(r)){const o=Tv(a,r);return[{index:Gn(r.groupOffsetTree,o)[0],offset:0,size:0},{data:i==null?void 0:i[0],index:o,offset:0,size:0}]}return[{data:i==null?void 0:i[0],index:a,offset:0,size:0}]}const qu={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function lo(a,r,i,o,u,p){const{lastIndex:f,lastOffset:h,lastSize:x}=u;let m=0,y=0;if(a.length>0){m=a[0].offset;const L=a[a.length-1];y=L.offset+L.size}const g=i-f,j=h+g*x+(g-1)*o,S=m,N=j-y;return{bottom:y,firstItemIndex:p,items:jx(a,u,p),offsetBottom:N,offsetTop:m,top:S,topItems:jx(r,u,p),topListHeight:r.reduce((L,T)=>T.size+L,0),totalCount:i}}function Lv(a,r,i,o,u,p){let f=0;if(i.groupIndices.length>0)for(const y of i.groupIndices){if(y-f>=a)break;f++}const h=a+f,x=Ld(r,h),m=Array.from({length:h}).map((y,g)=>({data:p[g+x],index:g+x,offset:0,size:0}));return lo(m,[],h,u,i,o)}function jx(a,r,i){if(a.length===0)return[];if(!go(r))return a.map(m=>({...m,index:m.index+i,originalIndex:m.index}));const o=a[0].index,u=a[a.length-1].index,p=[],f=dr(r.groupOffsetTree,o,u);let h,x=0;for(const m of a){(!h||h.end<m.index)&&(h=f.shift(),x=r.groupIndices.indexOf(h.start));let y;m.index===h.start?y={index:x,type:"group"}:y={groupIndex:x,index:m.index-(x+1)+i},p.push({...y,data:m.data,offset:m.offset,originalIndex:m.index,size:m.size})}return p}function Sx(a,r){return a===void 0?0:typeof a=="number"?a:a[r]??0}const Sl=Ze(([{data:a,firstItemIndex:r,gap:i,sizes:o,totalCount:u},p,{listBoundary:f,topListHeight:h,visibleRange:x},{initialTopMostItemIndex:m,scrolledToInitialItem:y},{topListHeight:g},j,{didMount:S},{recalcInProgress:N}])=>{const L=pe([]),T=pe(0),k=Ke(),M=pe(0);Ce(p.topItemsIndexes,L);const O=Qt(de(Dt(S,N,Re(x,ws),Re(u),Re(o),Re(m),y,Re(L),Re(r),Re(i),Re(M),a),Ae(([w,D,,R,,,,,,,,I])=>{const G=I!==void 0&&I.length!==R;return w&&!D&&!G}),ye(([,,[w,D],R,I,G,q,te,Q,z,E,B])=>{var je,Ue;const ne=I,{offsetTree:Y,sizeTree:me}=ne,_=yt(T);if(R===0)return{...qu,totalCount:R};if(w===0&&D===0)return _===0?{...qu,totalCount:R}:Lv(_,G,I,Q,z,B||[]);if(ot(me))return _>0?null:lo(ij(Ld(G,R),ne,B),[],R,z,ne,Q);const W=[];if(te.length>0){const Le=te[0],ae=te[te.length-1];let Z=0;for(const se of dr(me,Le,ae)){const ue=se.value,ge=Math.max(se.start,Le),Oe=Math.min(se.end,ae);for(let Me=ge;Me<=Oe;Me++)W.push({data:B==null?void 0:B[Me],index:Me,offset:Z,size:ue}),Z+=ue}}if(!q)return lo([],W,R,z,ne,Q);const oe=te.length>0?te[te.length-1]+1:0,fe=K0(Y,w,D,oe);if(fe.length===0)return null;const he=R-1,xe=vo([],Le=>{for(const ae of fe){const Z=ae.value;let se=Z.offset,ue=ae.start;const ge=Z.size;if(Z.offset<w){ue+=Math.floor((w-Z.offset+z)/(ge+z));const Me=ue-ae.start;se+=Me*ge+Me*z}ue<oe&&(se+=(oe-ue)*ge,ue=oe);const Oe=Math.min(ae.end,he);for(let Me=ue;Me<=Oe&&!(se>=D);Me++)Le.push({data:B==null?void 0:B[Me],index:Me,offset:se,size:ge}),se+=ge+z}}),ke=Sx(E,Es),ce=Sx(E,Ts);if(xe.length>0&&(ke>0||ce>0)){const Le=xe[0],ae=xe[xe.length-1];if(ke>0&&Le.index>oe){const Z=Math.min(ke,Le.index-oe),se=[];let ue=Le.offset;for(let ge=Le.index-1;ge>=Le.index-Z;ge--){const Oe=((je=dr(me,ge,ge)[0])==null?void 0:je.value)??Le.size;ue-=Oe+z,se.unshift({data:B==null?void 0:B[ge],index:ge,offset:ue,size:Oe})}xe.unshift(...se)}if(ce>0&&ae.index<he){const Z=Math.min(ce,he-ae.index);let se=ae.offset+ae.size+z;for(let ue=ae.index+1;ue<=ae.index+Z;ue++){const ge=((Ue=dr(me,ue,ue)[0])==null?void 0:Ue.value)??ae.size;xe.push({data:B==null?void 0:B[ue],index:ue,offset:se,size:ge}),se+=ge+z}}}return lo(xe,W,R,z,ne,Q)}),Ae(w=>w!==null),mt()),qu);Ce(de(a,Ae(Ed),ye(w=>w==null?void 0:w.length)),u),Ce(de(O,ye(w=>w.topListHeight)),g),Ce(g,h),Ce(de(O,ye(w=>[w.top,w.bottom])),f),Ce(de(O,ye(w=>w.items)),k);const V=jn(de(O,Ae(({items:w})=>w.length>0),$e(u,a),Ae(([{items:w},D])=>w[w.length-1].originalIndex===D-1),ye(([,w,D])=>[w-1,D]),mt(ws),ye(([w])=>w))),A=jn(de(O,ga(200),Ae(({items:w,topItems:D})=>w.length>0&&w[0].originalIndex===D.length),ye(({items:w})=>w[0].index),mt())),U=jn(de(O,Ae(({items:w})=>w.length>0),ye(({items:w})=>{let D=0,R=w.length-1;for(;w[D].type==="group"&&D<R;)D++;for(;w[R].type==="group"&&R>D;)R--;return{endIndex:w[R].index,startIndex:w[D].index}}),mt(Nv)));return{endReached:V,initialItemCount:T,itemsRendered:k,listState:O,minOverscanItemCount:M,rangeChanged:U,startReached:A,topItemsIndexes:L,...j}},ht(Qn,Av,Dd,As,Rs,Ms,Xa,Ad),{singleton:!0}),Dv=Ze(([{fixedFooterHeight:a,fixedHeaderHeight:r,footerHeight:i,headerHeight:o},{listState:u}])=>{const p=Ke(),f=Qt(de(Dt(i,a,o,r,u),ye(([h,x,m,y,g])=>h+x+m+y+g.offsetBottom+g.bottom)),0);return Ce(Re(f),p),{totalListHeight:f,totalListHeightChanged:p}},ht(an,Sl),{singleton:!0}),oj=Ze(([{viewportHeight:a},{totalListHeight:r}])=>{const i=pe(!1),o=Qt(de(Dt(i,a,r),Ae(([u])=>u),ye(([,u,p])=>Math.max(0,u-p)),ga(0),mt()),0);return{alignToBottom:i,paddingTopAddition:o}},ht(an,Dv),{singleton:!0}),_v=Ze(()=>({context:pe(null)})),cj=({itemBottom:a,itemTop:r,locationParams:{align:i,behavior:o,...u},viewportBottom:p,viewportTop:f})=>r<f?{...u,align:i??"start",...o!==void 0?{behavior:o}:{}}:a>p?{...u,align:i??"end",...o!==void 0?{behavior:o}:{}}:null,Ov=Ze(([{gap:a,sizes:r,totalCount:i},{fixedFooterHeight:o,fixedHeaderHeight:u,headerHeight:p,scrollingInProgress:f,scrollTop:h,viewportHeight:x},{scrollToIndex:m}])=>{const y=Ke();return Ce(de(y,$e(r,x,i,p,u,o,h),$e(a),ye(([[g,j,S,N,L,T,k,M],O])=>{const{calculateViewLocation:V=cj,done:A,...U}=g,w=Rv(g,j,N-1),D=Cs(w,j.offsetTree,O)+L+T,R=D+Gn(j.sizeTree,w)[1],I=M+T,G=M+S-k,q=V({itemBottom:R,itemTop:D,locationParams:U,viewportBottom:G,viewportTop:I});return q!==null?A&&$n(de(f,Ae(te=>!te),yl(yt(f)?1:2)),A):A==null||A(),q}),Ae(g=>g!==null)),m),{scrollIntoView:y}},ht(Qn,an,Rs,Sl,Ka),{singleton:!0});function kx(a){return a===!1?!1:a==="smooth"?"smooth":"auto"}const uj=(a,r)=>typeof a=="function"?kx(a(r)):r&&kx(a),dj=Ze(([{listRefresh:a,totalCount:r,fixedItemSize:i,data:o},{atBottomState:u,isAtBottom:p},{scrollToIndex:f},{scrolledToInitialItem:h},{didMount:x,propsReady:m},{log:y},{scrollingInProgress:g},{context:j},{scrollIntoView:S}])=>{const N=pe(!1),L=Ke();let T=null;function k(A){He(f,{align:"end",behavior:A,index:"LAST"})}et(de(Dt(de(Re(r),yl(1)),x),$e(Re(N),p,h,g),ye(([[A,U],w,D,R,I])=>{let G=U&&R,q="auto";return G&&(q=uj(w,D||I),G=G&&q!==!1),{followOutputBehavior:q,shouldFollow:G,totalCount:A}}),Ae(({shouldFollow:A})=>A)),({followOutputBehavior:A,totalCount:U})=>{T!==null&&(T(),T=null),yt(i)!==void 0?requestAnimationFrame(()=>{yt(y)("following output to ",{totalCount:U},Bt.DEBUG),k(A)}):T=$n(a,()=>{yt(y)("following output to ",{totalCount:U},Bt.DEBUG),k(A),T=null})});function M(A){const U=$n(u,w=>{A&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&T===null&&(yt(y)("scrolling to bottom due to increased size",{},Bt.DEBUG),k("auto"))});setTimeout(U,100)}et(de(Dt(Re(N),r,m),Ae(([A,,U])=>A!==!1&&U),Kn(({value:A},[,U])=>({refreshed:A===U,value:U}),{refreshed:!1,value:0}),Ae(({refreshed:A})=>A),$e(N,r)),([,A])=>{yt(h)&&M(A!==!1)}),et(L,()=>{M(yt(N)!==!1)}),et(Dt(Re(N),u),([A,U])=>{A!==!1&&!U.atBottom&&U.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&k("auto")});const O=pe(null),V=Ke();return Ce(fd(de(Re(o),ye(A=>(A==null?void 0:A.length)??0)),de(Re(r))),V),et(de(Dt(de(V,yl(1)),x),$e(Re(O),h,g,j),ye(([[A,U],w,D,R,I])=>U&&D&&(w==null?void 0:w({context:I,totalCount:A,scrollingInProgress:R}))),Ae(A=>!!A),ga(0)),A=>{T!==null&&(T(),T=null),yt(i)!==void 0?requestAnimationFrame(()=>{yt(y)("scrolling into view",{}),He(S,A)}):T=$n(a,()=>{yt(y)("scrolling into view",{}),He(S,A),T=null})}),{autoscrollToBottom:L,followOutput:N,scrollIntoViewOnChange:O}},ht(Qn,Ms,Rs,As,Xa,Ka,an,_v,Ov)),fj=Ze(([{data:a,firstItemIndex:r,gap:i,sizes:o},{initialTopMostItemIndex:u},{initialItemCount:p,listState:f},{didMount:h}])=>(Ce(de(h,$e(p),Ae(([,x])=>x!==0),$e(u,o,r,i,a),ye(([[,x],m,y,g,j,S=[]])=>Lv(x,m,y,g,j,S))),f),{}),ht(Qn,As,Sl,Xa),{singleton:!0}),pj=Ze(([{didMount:a},{scrollTo:r},{listState:i}])=>{const o=pe(0);return et(de(a,$e(o),Ae(([,u])=>u!==0),ye(([,u])=>({top:u}))),u=>{$n(de(i,yl(1),Ae(p=>p.items.length>1)),()=>{requestAnimationFrame(()=>{He(r,u)})})}),{initialScrollTop:o}},ht(Xa,an,Sl),{singleton:!0}),Bv=Ze(([{scrollVelocity:a}])=>{const r=pe(!1),i=Ke(),o=pe(!1);return Ce(de(a,$e(o,r,i),Ae(([u,p])=>p!==!1&&p!==void 0),ye(([u,p,f,h])=>{const{enter:x,exit:m}=p;if(f){if(m(u,h))return!1}else if(x(u,h))return!0;return f}),mt()),r),et(de(Dt(r,a,i),$e(o)),([[u,p,f],h])=>{u&&h!==!1&&h!==void 0&&h.change&&h.change(p,f)}),{isSeeking:r,scrollSeekConfiguration:o,scrollSeekRangeChanged:i,scrollVelocity:a}},ht(Ms),{singleton:!0}),_d=Ze(([{scrollContainerState:a,scrollTo:r}])=>{const i=Ke(),o=Ke(),u=Ke(),p=pe(!1),f=pe(void 0);return Ce(de(Dt(i,o),ye(([{scrollTop:h,viewportHeight:x},{offsetTop:m,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-m),viewportHeight:x}))),a),Ce(de(r,$e(o),ye(([h,{offsetTop:x}])=>({...h,top:h.top+x}))),u),{customScrollParent:f,useWindowScroll:p,windowScrollContainerState:i,windowScrollTo:u,windowViewportRect:o}},ht(an)),mj=Ze(([{sizeRanges:a,sizes:r},{headerHeight:i,scrollTop:o},{initialTopMostItemIndex:u},{didMount:p},{useWindowScroll:f,windowScrollContainerState:h,windowViewportRect:x}])=>{const m=Ke(),y=pe(void 0),g=pe(null),j=pe(null);return Ce(h,g),Ce(x,j),et(de(m,$e(r,o,f,g,j,i)),([S,N,L,T,k,M,O])=>{const V=Q0(N.sizeTree);T&&k!==null&&M!==null&&(L=k.scrollTop-M.offsetTop),L-=O,S({ranges:V,scrollTop:L})}),Ce(de(y,Ae(Ed),ye(hj)),u),Ce(de(p,$e(y),Ae(([,S])=>S!==void 0),mt(),ye(([,S])=>S.ranges)),a),{getState:m,restoreStateFrom:y}},ht(Qn,an,As,Xa,_d));function hj(a){return{align:"start",index:0,offset:a.scrollTop}}const xj=Ze(([{topItemsIndexes:a}])=>{const r=pe(0);return Ce(de(r,Ae(i=>i>=0),ye(i=>Array.from({length:i}).map((o,u)=>u))),a),{topItemCount:r}},ht(Sl));function Iv(a){let r=!1,i;return(()=>(r||(r=!0,i=a()),i))}const vj=Iv(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),gj=Ze(([{deviation:a,scrollBy:r,scrollingInProgress:i,scrollTop:o},{isAtBottom:u,isScrolling:p,lastJumpDueToItemResize:f,scrollDirection:h},{listState:x},{beforeUnshiftWith:m,gap:y,shiftWithOffset:g,sizes:j},{log:S},{recalcInProgress:N}])=>{const L=jn(de(x,$e(f),Kn(([,k,M,O],[{bottom:V,items:A,offsetBottom:U,totalCount:w},D])=>{const R=V+U;let I=0;return M===w&&k.length>0&&A.length>0&&(A[0].originalIndex===0&&k[0].originalIndex===0||(I=R-O,I!==0&&(I+=D))),[I,A,w,R]},[0,[],0,0]),Ae(([k])=>k!==0),$e(o,h,i,u,S,N),Ae(([,k,M,O,,,V])=>!V&&!O&&k!==0&&M===Ns),ye(([[k],,,,,M])=>(M("Upward scrolling compensation",{amount:k},Bt.DEBUG),k))));function T(k){k>0?(He(r,{behavior:"auto",top:-k}),He(a,0)):(He(a,0),He(r,{behavior:"auto",top:-k}))}return et(de(L,$e(a,p)),([k,M,O])=>{O&&vj()?He(a,M-k):T(-k)}),et(de(Dt(Qt(p,!1),a,N),Ae(([k,M,O])=>!k&&!O&&M!==0),ye(([k,M])=>M),ga(1)),T),Ce(de(g,ye(k=>({top:-k}))),r),et(de(m,$e(j,y),ye(([k,{groupIndices:M,lastSize:O,sizeTree:V},A])=>{function U(G){return G*(O+A)}if(M.length===0)return U(k);let w=0;const D=ks(V,0);let R=0,I=0;for(;R<k;){R++,w+=D;let G=M.length===I+1?1/0:M[I+1]-M[I]-1;R+G>k&&(w-=D,G=k-R+1),R+=G,w+=U(G),I++}return w})),k=>{He(a,k),requestAnimationFrame(()=>{He(r,{top:k}),requestAnimationFrame(()=>{He(a,0),He(N,!1)})})}),{deviation:a}},ht(an,Ms,Sl,Qn,Ka,Ad)),yj=Ze(([a,r,i,o,u,p,f,h,x,m,y])=>({...a,...r,...i,...o,...u,...p,...f,...h,...x,...m,...y}),ht(Dd,fj,Xa,Bv,Dv,pj,oj,_d,Ov,Ka,_v)),Hv=Ze(([{data:a,defaultItemSize:r,firstItemIndex:i,fixedItemSize:o,fixedGroupSize:u,gap:p,groupIndices:f,heightEstimates:h,itemSize:x,sizeRanges:m,sizes:y,statefulTotalCount:g,totalCount:j,trackItemSizes:S},{initialItemFinalLocationReached:N,initialTopMostItemIndex:L,scrolledToInitialItem:T},k,M,O,V,{scrollToIndex:A},U,{topItemCount:w},{groupCounts:D},R])=>{const{listState:I,minOverscanItemCount:G,topItemsIndexes:q,rangeChanged:te,...Q}=V;return Ce(te,R.scrollSeekRangeChanged),Ce(de(R.windowViewportRect,ye(z=>z.visibleHeight)),k.viewportHeight),{data:a,defaultItemHeight:r,firstItemIndex:i,fixedItemHeight:o,fixedGroupHeight:u,gap:p,groupCounts:D,heightEstimates:h,initialItemFinalLocationReached:N,initialTopMostItemIndex:L,scrolledToInitialItem:T,sizeRanges:m,topItemCount:w,topItemsIndexes:q,totalCount:j,...O,groupIndices:f,itemSize:x,listState:I,minOverscanItemCount:G,scrollToIndex:A,statefulTotalCount:g,trackItemSizes:S,rangeChanged:te,...Q,...R,...k,sizes:y,...M}},ht(Qn,As,an,mj,dj,Sl,Rs,gj,xj,Av,yj));function bj(a,r){const i={},o={};let u=0;const p=a.length;for(;u<p;)o[a[u]]=1,u+=1;for(const f in r)Object.hasOwn(o,f)||(i[f]=r[f]);return i}const Fi=typeof document<"u"?we.useLayoutEffect:we.useEffect;function Uv(a,r,i){const o=Object.keys(r.required||{}),u=Object.keys(r.optional||{}),p=Object.keys(r.methods||{}),f=Object.keys(r.events||{}),h=we.createContext({});function x(T,k){T.propsReady!==void 0&&He(T.propsReady,!1);for(const M of o){const O=T[r.required[M]];He(O,k[M])}for(const M of u)if(M in k){const O=T[r.optional[M]];He(O,k[M])}T.propsReady!==void 0&&He(T.propsReady,!0)}function m(T){return p.reduce((k,M)=>(k[M]=O=>{const V=T[r.methods[M]];He(V,O)},k),{})}function y(T){return f.reduce((k,M)=>(k[M]=O0(T[r.events[M]]),k),{})}const g=we.forwardRef(function(T,k){const{children:M,...O}=T,[V]=we.useState(()=>vo(I0(a),w=>{x(w,O)})),[A]=we.useState(px(y,V));Fi(()=>{for(const w of f)w in O&&et(A[w],O[w]);return()=>{Object.values(A).map(Td)}},[O,A,V]),Fi(()=>{x(V,O)}),we.useImperativeHandle(k,fx(m(V)));const U=i;return n.jsx(h.Provider,{value:V,children:i!==void 0?n.jsx(U,{...bj([...o,...u,...f],O),children:M}):M})}),j=T=>{const k=we.useContext(h);return we.useCallback(M=>{He(k[T],M)},[k,T])},S=T=>{const k=we.useContext(h)[T],M=we.useCallback(O=>et(k,O),[k]);return we.useSyncExternalStore(M,()=>yt(k),()=>yt(k))},N=T=>{const k=we.useContext(h)[T],[M,O]=we.useState(px(yt,k));return Fi(()=>et(k,V=>{V!==M&&O(fx(V))}),[k,M]),M},L=parseInt(we.version)>=18?S:N;return{Component:g,useEmitter:(T,k)=>{const M=we.useContext(h)[T];Fi(()=>et(M,k),[k,M])},useEmitterValue:L,usePublisher:j}}const Vv=we.createContext(void 0),$v=we.createContext(void 0),Yu="-webkit-sticky",wx="sticky",Od=Iv(()=>{if(typeof document>"u")return wx;const a=document.createElement("div");return a.style.position=Yu,a.style.position===Yu?Yu:wx}),Gv=typeof document<"u"?we.useLayoutEffect:we.useEffect;function Fu(a){return"self"in a}function jj(a){return"body"in a}function Pv(a,r,i,o=vr,u,p){const f=we.useRef(null),h=we.useRef(null),x=we.useRef(null),m=we.useCallback(j=>{let S,N,L;const T=j.target;if(jj(T)||Fu(T)){const M=Fu(T)?T:T.defaultView;L=p===!0?M.scrollX:M.scrollY,S=p===!0?M.document.documentElement.scrollWidth:M.document.documentElement.scrollHeight,N=p===!0?M.innerWidth:M.innerHeight}else L=p===!0?T.scrollLeft:T.scrollTop,S=p===!0?T.scrollWidth:T.scrollHeight,N=p===!0?T.offsetWidth:T.offsetHeight;const k=()=>{a({scrollHeight:S,scrollTop:Math.max(L,0),viewportHeight:N})};j.suppressFlushSync===!0?k():gb.flushSync(k),h.current!==null&&(L===h.current||L<=0||L===S-N)&&(h.current=null,r(!0),x.current&&(clearTimeout(x.current),x.current=null))},[a,r,p]);we.useEffect(()=>{const j=u||f.current;return o(u||f.current),m({suppressFlushSync:!0,target:j}),j.addEventListener("scroll",m,{passive:!0}),()=>{o(null),j.removeEventListener("scroll",m)}},[f,m,i,o,u]);function y(j){const S=f.current;if(!S||(p===!0?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const N=j.behavior==="smooth";let L,T,k;Fu(S)?(T=Math.max(Fa(S.document.documentElement,p===!0?"width":"height"),p===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),L=p===!0?S.innerWidth:S.innerHeight,k=p===!0?window.scrollX:window.scrollY):(T=S[p===!0?"scrollWidth":"scrollHeight"],L=Fa(S,p===!0?"width":"height"),k=S[p===!0?"scrollLeft":"scrollTop"]);const M=T-L;if(j.top=Math.ceil(Math.max(Math.min(M,j.top),0)),zv(L,T)||j.top===k){a({scrollHeight:T,scrollTop:k,viewportHeight:L}),N&&r(!0);return}N?(h.current=j.top,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,h.current=null,r(!0)},1e3)):h.current=null,p===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},left:j.top}),S.scrollTo(j)}function g(j){p===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},...j.top!==void 0?{left:j.top}:{}}),f.current.scrollBy(j)}return{scrollByCallback:g,scrollerRef:f,scrollToCallback:y}}function Bd(a){return a}const Sj=Ze(()=>{const a=pe(h=>`Item ${h}`),r=pe(h=>`Group ${h}`),i=pe({}),o=pe(Bd),u=pe("div"),p=pe(vr),f=(h,x=null)=>Qt(de(i,ye(m=>m[h]),mt()),x);return{components:i,computeItemKey:o,EmptyPlaceholder:f("EmptyPlaceholder"),FooterComponent:f("Footer"),GroupComponent:f("Group","div"),groupContent:r,HeaderComponent:f("Header"),HeaderFooterTag:u,ItemComponent:f("Item","div"),itemContent:a,ListComponent:f("List","div"),ScrollerComponent:f("Scroller","div"),scrollerRef:p,ScrollSeekPlaceholder:f("ScrollSeekPlaceholder"),TopItemListComponent:f("TopItemList")}}),kj=Ze(([a,r])=>({...a,...r}),ht(Hv,Sj)),wj=({height:a})=>n.jsx("div",{style:{height:a}}),Cj={overflowAnchor:"none",position:Od(),zIndex:1},qv={overflowAnchor:"none"},Nj={...qv,display:"inline-block",height:"100%"},Cx=we.memo(function({showTopList:a=!1}){const r=_e("listState"),i=_n("sizeRanges"),o=_e("useWindowScroll"),u=_e("customScrollParent"),p=_n("windowScrollContainerState"),f=_n("scrollContainerState"),h=u||o?p:f,x=_e("itemContent"),m=_e("context"),y=_e("groupContent"),g=_e("trackItemSizes"),j=_e("itemSize"),S=_e("log"),N=_n("gap"),L=_e("horizontalDirection"),{callbackRef:T}=V0(i,j,g,a?vr:h,S,N,u,L,_e("skipAnimationFrameInResizeObserver")),[k,M]=we.useState(0);Id("deviation",Q=>{k!==Q&&M(Q)});const O=_e("EmptyPlaceholder"),V=_e("ScrollSeekPlaceholder")??wj,A=_e("ListComponent"),U=_e("ItemComponent"),w=_e("GroupComponent"),D=_e("computeItemKey"),R=_e("isSeeking"),I=_e("groupIndices").length>0,G=_e("alignToBottom"),q=_e("initialItemFinalLocationReached"),te=a?{}:{boxSizing:"border-box",...L?{display:"inline-block",height:"100%",marginLeft:k!==0?k:G?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:k!==0?k:G?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...q?{}:{visibility:"hidden"}};return!a&&r.totalCount===0&&O!==null&&O!==void 0?n.jsx(O,{...Xt(O,m)}):n.jsx(A,{...Xt(A,m),"data-testid":a?"virtuoso-top-item-list":"virtuoso-item-list",ref:T,style:te,children:(a?r.topItems:r.items).map(Q=>{const z=Q.originalIndex,E=D(z+r.firstItemIndex,Q.data,m);return R?v.createElement(V,{...Xt(V,m),height:Q.size,index:Q.index,key:E,type:Q.type||"item",...Q.type==="group"?{}:{groupIndex:Q.groupIndex}}):Q.type==="group"?v.createElement(w,{...Xt(w,m),"data-index":z,"data-item-index":Q.index,"data-known-size":Q.size,key:E,style:Cj},y(Q.index,m)):v.createElement(U,{...Xt(U,m),...Aj(U,Q.data),"data-index":z,"data-item-group-index":Q.groupIndex,"data-item-index":Q.index,"data-known-size":Q.size,key:E,style:L?Nj:qv},I?x(Q.index,Q.groupIndex,Q.data,m):x(Q.index,Q.data,m))})})}),Ej={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Tj={outline:"none",overflowX:"auto",position:"relative"},yo=a=>({height:"100%",position:"absolute",top:0,width:"100%",...a?{display:"flex",flexDirection:"column"}:void 0}),Rj={position:Od(),top:0,width:"100%",zIndex:1};function Xt(a,r){if(typeof a!="string")return{context:r}}function Aj(a,r){return{item:typeof a=="string"?void 0:r}}const Mj=we.memo(function(){const a=_e("HeaderComponent"),r=_n("headerHeight"),i=_e("HeaderFooterTag"),o=jl(we.useMemo(()=>p=>{r(Fa(p,"height"))},[r]),!0,_e("skipAnimationFrameInResizeObserver")),u=_e("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Xt(a,u)})}):null}),zj=we.memo(function(){const a=_e("FooterComponent"),r=_n("footerHeight"),i=_e("HeaderFooterTag"),o=jl(we.useMemo(()=>p=>{r(Fa(p,"height"))},[r]),!0,_e("skipAnimationFrameInResizeObserver")),u=_e("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Xt(a,u)})}):null});function Yv({useEmitter:a,useEmitterValue:r,usePublisher:i}){return we.memo(function({children:o,style:u,context:p,...f}){const h=i("scrollContainerState"),x=r("ScrollerComponent"),m=i("smoothScrollTargetReached"),y=r("scrollerRef"),g=r("horizontalDirection")||!1,{scrollByCallback:j,scrollerRef:S,scrollToCallback:N}=Pv(h,m,x,y,void 0,g);return a("scrollTo",N),a("scrollBy",j),n.jsx(x,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...g?Tj:Ej,...u},tabIndex:0,...f,...Xt(x,p),children:o})})}function Fv({useEmitter:a,useEmitterValue:r,usePublisher:i}){return we.memo(function({children:o,style:u,context:p,...f}){const h=i("windowScrollContainerState"),x=r("ScrollerComponent"),m=i("smoothScrollTargetReached"),y=r("totalListHeight"),g=r("deviation"),j=r("customScrollParent"),S=we.useRef(null),N=r("scrollerRef"),{scrollByCallback:L,scrollerRef:T,scrollToCallback:k}=Pv(h,m,x,N,j);return Gv(()=>{var M;return T.current=j||((M=S.current)==null?void 0:M.ownerDocument.defaultView),()=>{T.current=null}},[T,j]),a("windowScrollTo",k),a("scrollBy",L),n.jsx(x,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...u,...y!==0?{height:y+g}:void 0},...f,...Xt(x,p),children:o})})}const Lj=({children:a})=>{const r=we.useContext(Vv),i=_n("viewportHeight"),o=_n("fixedItemHeight"),u=_e("alignToBottom"),p=_e("horizontalDirection"),f=we.useMemo(()=>gv(i,x=>Fa(x,p?"width":"height")),[i,p]),h=jl(f,!0,_e("skipAnimationFrameInResizeObserver"));return we.useEffect(()=>{r&&(i(r.viewportHeight),o(r.itemHeight))},[r,i,o]),n.jsx("div",{"data-viewport-type":"element",ref:h,style:yo(u),children:a})},Dj=({children:a})=>{const r=we.useContext(Vv),i=_n("windowViewportRect"),o=_n("fixedItemHeight"),u=_e("customScrollParent"),p=bv(i,u,_e("skipAnimationFrameInResizeObserver")),f=_e("alignToBottom");return we.useEffect(()=>{r&&(o(r.itemHeight),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:100}))},[r,i,o]),n.jsx("div",{"data-viewport-type":"window",ref:p,style:yo(f),children:a})},_j=({children:a})=>{const r=_e("TopItemListComponent")??"div",i=_e("headerHeight"),o={...Rj,marginTop:`${i}px`},u=_e("context");return n.jsx(r,{style:o,...Xt(r,u),children:a})},Oj=we.memo(function(a){const r=_e("useWindowScroll"),i=_e("topItemsIndexes").length>0,o=_e("customScrollParent"),u=_e("context");return n.jsxs(o||r?Hj:Ij,{...a,context:u,children:[i&&n.jsx(_j,{children:n.jsx(Cx,{showTopList:!0})}),n.jsxs(o||r?Dj:Lj,{children:[n.jsx(Mj,{}),n.jsx(Cx,{}),n.jsx(zj,{})]})]})}),{Component:Bj,useEmitter:Id,useEmitterValue:_e,usePublisher:_n}=Uv(kj,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Oj),Ij=Yv({useEmitter:Id,useEmitterValue:_e,usePublisher:_n}),Hj=Fv({useEmitter:Id,useEmitterValue:_e,usePublisher:_n}),Uj=Bj,Vj=Ze(()=>{const a=pe(m=>n.jsxs("td",{children:["Item $",m]})),r=pe(null),i=pe(m=>n.jsxs("td",{colSpan:1e3,children:["Group ",m]})),o=pe(null),u=pe(null),p=pe({}),f=pe(Bd),h=pe(vr),x=(m,y=null)=>Qt(de(p,ye(g=>g[m]),mt()),y);return{components:p,computeItemKey:f,context:r,EmptyPlaceholder:x("EmptyPlaceholder"),FillerRow:x("FillerRow"),fixedFooterContent:u,fixedHeaderContent:o,itemContent:a,groupContent:i,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder"),TableBodyComponent:x("TableBody","tbody"),TableComponent:x("Table","table"),TableFooterComponent:x("TableFoot","tfoot"),TableHeadComponent:x("TableHead","thead"),TableRowComponent:x("TableRow","tr"),GroupComponent:x("Group","tr")}});ht(Hv,Vj);Od();const Nx={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},$j={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Ex,floor:co,max:bs,min:Wu,round:Tx}=Math;function Rx(a,r,i){return Array.from({length:r-a+1}).map((o,u)=>({data:i===null?null:i[u+a],index:u+a}))}function Gj(a){return{...$j,items:a}}function Wi(a,r){return a!==void 0&&a.width===r.width&&a.height===r.height}function Pj(a,r){return a!==void 0&&a.column===r.column&&a.row===r.row}const qj=Ze(([{increaseViewportBy:a,listBoundary:r,overscan:i,visibleRange:o},{footerHeight:u,headerHeight:p,scrollBy:f,scrollContainerState:h,scrollTo:x,scrollTop:m,smoothScrollTargetReached:y,viewportHeight:g},j,S,{didMount:N,propsReady:L},{customScrollParent:T,useWindowScroll:k,windowScrollContainerState:M,windowScrollTo:O,windowViewportRect:V},A])=>{const U=pe(0),w=pe(0),D=pe(Nx),R=pe({height:0,width:0}),I=pe({height:0,width:0}),G=Ke(),q=Ke(),te=pe(0),Q=pe(null),z=pe({column:0,row:0}),E=Ke(),B=Ke(),ne=pe(!1),Y=pe(0),me=pe(!0),_=pe(!1),W=pe(!1);et(de(N,$e(Y),Ae(([ce,je])=>je!==0)),()=>{He(me,!1)}),et(de(Dt(N,me,I,R,Y,_),Ae(([ce,je,Ue,Le,,ae])=>ce&&!je&&Ue.height!==0&&Le.height!==0&&!ae)),([,,,,ce])=>{He(_,!0),zd(1,()=>{He(G,ce)}),$n(de(m),()=>{He(r,[0,0]),He(me,!0)})}),Ce(de(B,Ae(ce=>ce!=null&&ce.scrollTop>0),Wn(0)),w),et(de(N,$e(B),Ae(([,ce])=>ce!=null)),([,ce])=>{ce&&(He(R,ce.viewport),He(I,ce.item),He(z,ce.gap),ce.scrollTop>0&&(He(ne,!0),$n(de(m,yl(1)),je=>{He(ne,!1)}),He(x,{top:ce.scrollTop})))}),Ce(de(R,ye(({height:ce})=>ce)),g),Ce(de(Dt(Re(R,Wi),Re(I,Wi),Re(z,(ce,je)=>ce!==void 0&&ce.column===je.column&&ce.row===je.row),Re(m)),ye(([ce,je,Ue,Le])=>({gap:Ue,item:je,scrollTop:Le,viewport:ce}))),E),Ce(de(Dt(Re(U),o,Re(z,Pj),Re(I,Wi),Re(R,Wi),Re(Q),Re(w),Re(ne),Re(me),Re(Y)),Ae(([,,,,,,,ce])=>!ce),ye(([ce,[je,Ue],Le,ae,Z,se,ue,,ge,Oe])=>{const{column:Me,row:dt}=Le,{height:Zt,width:ct}=ae,{width:Vt}=Z;if(ue===0&&(ce===0||Vt===0))return Nx;if(ct===0){const nt=Ld(Oe,ce),Qa=nt+Math.max(ue-1,0);return Gj(Rx(nt,Qa,se))}const $t=Wv(Vt,ct,Me);let tt,jt;ge?je===0&&Ue===0&&ue>0?(tt=0,jt=ue-1):(tt=$t*co((je+dt)/(Zt+dt)),jt=$t*Ex((Ue+dt)/(Zt+dt))-1,jt=Wu(ce-1,bs(jt,$t-1)),tt=Wu(jt,bs(0,tt))):(tt=0,jt=-1);const ve=Rx(tt,jt,se),{bottom:Rt,top:ze}=Ax(Z,Le,ae,ve),xt=Ex(ce/$t),Wt=xt*Zt+(xt-1)*dt-Rt;return{bottom:Rt,itemHeight:Zt,items:ve,itemWidth:ct,offsetBottom:Wt,offsetTop:ze,top:ze}})),D),Ce(de(Q,Ae(ce=>ce!==null),ye(ce=>ce.length)),U),Ce(de(Dt(R,I,D,z),Ae(([ce,je,{items:Ue}])=>Ue.length>0&&je.height!==0&&ce.height!==0),ye(([ce,je,{items:Ue},Le])=>{const{bottom:ae,top:Z}=Ax(ce,Le,je,Ue);return[Z,ae]}),mt(ws)),r);const oe=pe(!1);Ce(de(m,$e(oe),ye(([ce,je])=>je||ce!==0)),oe);const fe=jn(de(Dt(D,U),Ae(([{items:ce}])=>ce.length>0),$e(oe),Ae(([[ce,je],Ue])=>{const Le=ce.items[ce.items.length-1].index===je-1;return(Ue||ce.bottom>0&&ce.itemHeight>0&&ce.offsetBottom===0&&ce.items.length===je)&&Le}),ye(([[,ce]])=>ce-1),mt())),he=jn(de(Re(D),Ae(({items:ce})=>ce.length>0&&ce[0].index===0),Wn(0),mt())),xe=jn(de(Re(D),$e(ne),Ae(([{items:ce},je])=>ce.length>0&&!je),ye(([{items:ce}])=>({endIndex:ce[ce.length-1].index,startIndex:ce[0].index})),mt(Nv),ga(0)));Ce(xe,S.scrollSeekRangeChanged),Ce(de(G,$e(R,I,U,z),ye(([ce,je,Ue,Le,ae])=>{const Z=Mv(ce),{align:se,behavior:ue,offset:ge}=Z;let Oe=Z.index;Oe==="LAST"&&(Oe=Le-1),Oe=bs(0,Oe,Wu(Le-1,Oe));let Me=vd(je,ae,Ue,Oe);return se==="end"?Me=Tx(Me-je.height+Ue.height):se==="center"&&(Me=Tx(Me-je.height/2+Ue.height/2)),ge!==void 0&&ge!==0&&(Me+=ge),{behavior:ue,top:Me}})),x);const ke=Qt(de(D,ye(ce=>ce.offsetBottom+ce.bottom)),0);return Ce(de(V,ye(ce=>({height:ce.visibleHeight,width:ce.visibleWidth}))),R),{customScrollParent:T,data:Q,deviation:te,footerHeight:u,gap:z,headerHeight:p,increaseViewportBy:a,initialItemCount:w,itemDimensions:I,overscan:i,restoreStateFrom:B,scrollBy:f,scrollContainerState:h,scrollHeight:q,scrollTo:x,scrollToIndex:G,scrollTop:m,smoothScrollTargetReached:y,totalCount:U,useWindowScroll:k,viewportDimensions:R,windowScrollContainerState:M,windowScrollTo:O,windowViewportRect:V,...S,gridState:D,horizontalDirection:W,initialTopMostItemIndex:Y,totalListHeight:ke,...j,endReached:fe,propsReady:L,rangeChanged:xe,startReached:he,stateChanged:E,stateRestoreInProgress:ne,...A}},ht(Dd,an,Ms,Bv,Xa,_d,Ka));function Wv(a,r,i){return bs(1,co((a+i)/(co(r)+i)))}function Ax(a,r,i,o){const{height:u}=i;if(u===void 0||o.length===0)return{bottom:0,top:0};const p=vd(a,r,i,o[0].index);return{bottom:vd(a,r,i,o[o.length-1].index)+u,top:p}}function vd(a,r,i,o){const u=Wv(a.width,i.width,r.column),p=co(o/u),f=p*i.height+bs(0,p-1)*r.row;return f>0?f+r.row:f}const Yj=Ze(()=>{const a=pe(g=>`Item ${g}`),r=pe({}),i=pe(null),o=pe("virtuoso-grid-item"),u=pe("virtuoso-grid-list"),p=pe(Bd),f=pe("div"),h=pe(vr),x=(g,j=null)=>Qt(de(r,ye(S=>S[g]),mt()),j),m=pe(!1),y=pe(!1);return Ce(Re(y),m),{components:r,computeItemKey:p,context:i,FooterComponent:x("Footer"),HeaderComponent:x("Header"),headerFooterTag:f,itemClassName:o,ItemComponent:x("Item","div"),itemContent:a,listClassName:u,ListComponent:x("List","div"),readyStateChanged:m,reportReadyState:y,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder","div")}}),Fj=Ze(([a,r])=>({...a,...r}),ht(qj,Yj)),Wj=we.memo(function(){const a=gt("gridState"),r=gt("listClassName"),i=gt("itemClassName"),o=gt("itemContent"),u=gt("computeItemKey"),p=gt("isSeeking"),f=On("scrollHeight"),h=gt("ItemComponent"),x=gt("ListComponent"),m=gt("ScrollSeekPlaceholder"),y=gt("context"),g=On("itemDimensions"),j=On("gap"),S=gt("log"),N=gt("stateRestoreInProgress"),L=On("reportReadyState"),T=jl(we.useMemo(()=>k=>{const M=k.parentElement.parentElement.scrollHeight;f(M);const O=k.firstChild;if(O!==null){const{height:V,width:A}=O.getBoundingClientRect();g({height:V,width:A})}j({column:Mx("column-gap",getComputedStyle(k).columnGap,S),row:Mx("row-gap",getComputedStyle(k).rowGap,S)})},[f,g,j,S]),!0,!1);return Gv(()=>{a.itemHeight>0&&a.itemWidth>0&&L(!0)},[a]),N?null:n.jsx(x,{className:r,ref:T,...Xt(x,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},children:a.items.map(k=>{const M=u(k.index,k.data,y);return p?n.jsx(m,{...Xt(m,y),height:a.itemHeight,index:k.index,width:a.itemWidth},M):v.createElement(h,{...Xt(h,y),className:i,"data-index":k.index,key:M},o(k.index,k.data,y))})})}),Kj=we.memo(function(){const a=gt("HeaderComponent"),r=On("headerHeight"),i=gt("headerFooterTag"),o=jl(we.useMemo(()=>p=>{r(Fa(p,"height"))},[r]),!0,!1),u=gt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Xt(a,u)})}):null}),Xj=we.memo(function(){const a=gt("FooterComponent"),r=On("footerHeight"),i=gt("headerFooterTag"),o=jl(we.useMemo(()=>p=>{r(Fa(p,"height"))},[r]),!0,!1),u=gt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Xt(a,u)})}):null}),Qj=({children:a})=>{const r=we.useContext($v),i=On("itemDimensions"),o=On("viewportDimensions"),u=jl(we.useMemo(()=>p=>{o(p.getBoundingClientRect())},[o]),!0,!1);return we.useEffect(()=>{r&&(o({height:r.viewportHeight,width:r.viewportWidth}),i({height:r.itemHeight,width:r.itemWidth}))},[r,o,i]),n.jsx("div",{ref:u,style:yo(!1),children:a})},Zj=({children:a})=>{const r=we.useContext($v),i=On("windowViewportRect"),o=On("itemDimensions"),u=gt("customScrollParent"),p=bv(i,u,!1);return we.useEffect(()=>{r&&(o({height:r.itemHeight,width:r.itemWidth}),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:r.viewportWidth}))},[r,i,o]),n.jsx("div",{ref:p,style:yo(!1),children:a})},Jj=we.memo(function({...a}){const r=gt("useWindowScroll"),i=gt("customScrollParent"),o=i||r?t2:e2,u=i||r?Zj:Qj,p=gt("context");return n.jsx(o,{...a,...Xt(o,p),children:n.jsxs(u,{children:[n.jsx(Kj,{}),n.jsx(Wj,{}),n.jsx(Xj,{})]})})}),{useEmitter:Kv,useEmitterValue:gt,usePublisher:On}=Uv(Fj,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Jj),e2=Yv({useEmitter:Kv,useEmitterValue:gt,usePublisher:On}),t2=Fv({useEmitter:Kv,useEmitterValue:gt,usePublisher:On});function Mx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,Bt.WARN),r==="normal"?0:parseInt(r??"0",10)}const n2={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},Xv={source:"Own",installed:"Installed"};function a2(a){try{const r=localStorage.getItem(a);if(r!=null)return r==="true"}catch{}try{if(typeof sessionStorage<"u"){const r=sessionStorage.getItem(a);if(r!=null)return r==="true"}}catch{}return!1}function l2(a,r){const i=r?"true":"false";try{localStorage.setItem(a,i)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(a,i)}catch{}}function zx({origin:a,count:r,filteredCount:i,updateCount:o,children:u}){const p=n2[a],[f,h]=v.useState(()=>a2(p)),x=v.useCallback(()=>{h(j=>{const S=!j;return l2(p,S),S})},[p]),m=Xv[a],y=`sidebar-section-${a}-header`,g=`sidebar-section-${a}-group`;return n.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!f,"aria-controls":g,onClick:x,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 12px 6px 14px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx(s2,{collapsed:f}),n.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:m}),n.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:i!=null&&i!==r?`(${i} of ${r})`:`(${r})`}),o!=null&&o>0&&n.jsx(r2,{origin:a,updateCount:o})]}),!f&&n.jsx("div",{id:g,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:u})]})}function r2({origin:a,updateCount:r}){const[i,o]=v.useState(!1),u=Xv[a].toLowerCase(),p=`${r} updates available in ${u} section, view all`;return n.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":p,onClick:f=>{f.stopPropagation(),window.location.hash="#/updates"},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),f.stopPropagation(),window.location.hash="#/updates")},onFocus:()=>o(!0),onBlur:()=>o(!1),style:{display:"inline-flex",alignItems:"center",gap:2,fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3,outline:i?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[r," updates",n.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function s2({collapsed:a}){return n.jsx("svg",{"aria-hidden":"true",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Hd(a,r){const i=r.trim().toLowerCase();return i?a.skill.toLowerCase().includes(i)||a.plugin.toLowerCase().includes(i)||a.dir.toLowerCase().includes(i):!0}function i2({value:a,onChange:r,placeholder:i="Filter skills…",validationPattern:o,validationMessage:u="Invalid filter expression"}){const p=v.useRef(null),f=v.useId(),h=!!o&&a.trim()!==""&&!o.test(a);return v.useEffect(()=>{function x(m){var j;if(m.key!=="/")return;const y=m.target;if(!y)return;const g=y.tagName;g==="INPUT"||g==="TEXTAREA"||y.isContentEditable||(m.preventDefault(),(j=p.current)==null||j.focus())}return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]),n.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("svg",{"aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[n.jsx("circle",{cx:"11",cy:"11",r:"8"}),n.jsx("path",{d:"M21 21l-4.35-4.35"})]}),n.jsx("input",{ref:p,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?f:void 0,value:a,placeholder:i,onChange:x=>r(x.currentTarget.value),onKeyDown:x=>{x.key==="Escape"&&(r(""),x.currentTarget.blur())},style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12,padding:"2px 0"}}),h&&n.jsx("span",{id:f,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:u}),n.jsx("kbd",{"aria-hidden":"true",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",border:"1px solid var(--border-default)",padding:"1px 5px",borderRadius:3,display:a?"none":"inline-block"},children:"/"})]})}function o2({target:a}){const r=typeof a=="string"&&a.length>0,i=r?`symlinked → ${a}`:"symlinked — cycle detected or target unresolved",o=r?`symlinked from ${a}`:"symlinked, target unresolved";return n.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:i,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:n.jsxs("svg",{"data-testid":"symlink-glyph",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})}function c2({skill:a}){if(!a.updateAvailable)return null;const r=a.currentVersion??"",i=a.latestVersion,o=i?`Update available: ${r} → ${i}`.trim():"Update available";return n.jsx("span",{"data-testid":"skill-row-update-glyph",title:o,"aria-label":"Update available",style:{color:"var(--color-own)",display:"inline-flex",flexShrink:0},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 19V5"}),n.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function u2({skill:a,isSelected:r,onSelect:i,onContextMenu:o}){const u=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("button",{type:"button",onClick:i,onContextMenu:o?p=>{p.preventDefault(),o(p,a)}:void 0,"aria-current":r?"true":void 0,"aria-selected":!!r,"data-testid":"skill-row","data-selected":r,"data-origin":a.origin,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:r?"inset 2px 0 0 var(--color-accent, var(--accent-surface))":"none",border:"none",borderRadius:0,color:"var(--text-primary)",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,textAlign:"left",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease), box-shadow var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),n.jsx("span",{title:a.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.skill}),a.version&&n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",flexShrink:0},children:a.version}),a.isSymlink&&n.jsx(o2,{target:a.symlinkTarget??null}),n.jsx(c2,{skill:a})]})}const uo=v.memo(u2);function d2({plugin:a,skills:r,selectedKey:i,onSelect:o,onContextMenu:u}){const p=[...r].sort((f,h)=>f.skill.localeCompare(h.skill));return n.jsxs("div",{role:"group","aria-label":`${a} (${r.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a,children:a}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",r.length,")"]})]}),n.jsx("div",{role:"list",children:p.map(f=>{const h=!!i&&i.plugin===f.plugin&&i.skill===f.skill;return n.jsx("div",{role:"listitem",children:n.jsx(uo,{skill:f,isSelected:h,onSelect:()=>o(f),onContextMenu:u})},`${f.plugin}/${f.skill}`)})})]})}function f2(a,r){if(!a||typeof window>"u")return r;try{const i=window.localStorage.getItem(a);return i===null?r:i==="true"}catch{return r}}function Lx({skills:a,pluginName:r,initialCollapsed:i=!1,persistKey:o,renderSkill:u}){var y;const p=r??((y=a[0])==null?void 0:y.pluginName)??"unknown-plugin",[f,h]=v.useState(()=>f2(o,i)),x=v.useCallback(()=>{h(g=>{const j=!g;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(j))}catch{}return j})},[o]),m=f?"▸":"▾";return n.jsxs("div",{"data-vskill-plugin-tree":p,role:"group","aria-label":`${p} (${a.length})`,children:[n.jsxs("button",{type:"button",onClick:x,"aria-expanded":!f,style:{display:"flex",alignItems:"center",gap:6,width:"100%",padding:"4px 10px 4px 18px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",color:"var(--text-primary)",fontSize:12,fontWeight:500},children:[n.jsx("span",{"aria-hidden":!0,className:"vskill-chevron tabular-nums",style:{width:12,display:"inline-block",textAlign:"center",fontSize:10,color:"var(--text-secondary)"},children:m}),n.jsx("span",{className:"vskill-plugin-name",style:{fontFamily:"var(--font-mono)"},children:p}),n.jsxs("span",{className:"vskill-plugin-count tabular-nums",style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["(",a.length,")"]})]}),!f&&n.jsx("div",{className:"vskill-plugin-tree-children",style:{paddingLeft:36,borderLeft:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",marginLeft:24},children:a.map(g=>n.jsx("div",{"data-vskill-plugin-skill":g.pluginNamespace??g.skill,children:u(g)},`${g.pluginNamespace??g.skill}`))})]})}function Dx({name:a,count:r,className:i,variant:o,collapsed:u,onToggle:p,action:f}){const h=o==="authoring"?"var(--color-own, #f59e0b)":"var(--color-accent, #2f6f8f)",x=o==="authoring"?"color-mix(in oklch, var(--color-own, #f59e0b) 10%, var(--color-paper, #fff))":"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))",m=typeof p=="function",y={position:"sticky",top:0,zIndex:4,backdropFilter:"saturate(1.4) blur(10px)",WebkitBackdropFilter:"saturate(1.4) blur(10px)",background:x,borderLeft:`3px solid ${h}`,borderBottom:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",padding:"7px 10px 7px 9px",fontFamily:"var(--font-serif, ui-serif)",fontSize:13,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-primary)",display:"flex",alignItems:"center",gap:8,width:"100%",cursor:m?"pointer":"default",border:"none",textAlign:"left"},g=u?"▸":"▾",j=n.jsxs(n.Fragment,{children:[m&&n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-secondary)",width:10,display:"inline-block",letterSpacing:0,textTransform:"none"},children:g}),n.jsx("span",{className:"vskill-group-header-name",children:a}),n.jsxs("span",{className:"vskill-group-header-count tabular-nums",style:{fontFamily:"var(--font-mono)",fontSize:11,fontWeight:500,color:"var(--text-secondary)",letterSpacing:0,textTransform:"none"},children:["(",r,")"]}),f&&n.jsx("span",{style:{marginLeft:"auto"},children:n.jsx(p2,{label:f.label,title:f.title,icon:f.icon,onClick:f.onClick,accent:h})})]});return m?n.jsx("button",{type:"button","data-vskill-group-header":a,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:y,onClick:()=>p(!u),"aria-expanded":!u,children:j}):n.jsx("div",{"data-vskill-group-header":a,role:"heading","aria-level":3,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:y,children:j})}function p2({label:a,title:r,icon:i,onClick:o,accent:u}){return n.jsxs("button",{type:"button","aria-label":a,title:r??a,onClick:p=>{p.stopPropagation(),o()},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,height:22,padding:"0 7px",border:`1px solid ${u}`,background:"transparent",color:u,borderRadius:4,fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",cursor:"pointer",fontFamily:"inherit"},onMouseEnter:p=>{p.currentTarget.style.background=`color-mix(in oklch, ${u} 15%, transparent)`},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[i,a]})}function m2(){return n.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[n.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),n.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function h2(a){const r=a.key.split("+").map(h=>h.trim()).filter(Boolean);let i=!!a.meta,o=!!a.ctrl,u=!!a.shift,p=!!a.alt,f=a.key;if(r.length>1){for(const h of r.slice(0,-1)){const x=h.toLowerCase();x==="cmd"||x==="meta"||x==="⌘"?i=!0:x==="ctrl"||x==="control"?o=!0:x==="shift"?u=!0:(x==="alt"||x==="option")&&(p=!0)}f=r[r.length-1]}return{key:f.length===1?f.toLowerCase():f,meta:i,ctrl:o,shift:u,alt:p,allowInInputs:!!a.allowInInputs,handler:a.handler}}function x2(a){if(!a||!(a instanceof HTMLElement))return!1;const r=a.tagName;if(r==="INPUT"||r==="TEXTAREA"||a.isContentEditable)return!0;const i=a.getAttribute("contenteditable");return i!=null&&i!=="false"||a.getAttribute("role")==="textbox"}function v2(a,r){const i=!!a.metaKey,o=!!a.ctrlKey,u=!!a.shiftKey,p=!!a.altKey;return i!==r.meta||o!==r.ctrl||u!==r.shift||p!==r.alt?!1:(a.key.length===1?a.key.toLowerCase():a.key)===r.key}function gd(a,r={}){const{enabled:i=!0,target:o}=r,u=v.useRef([]),p=Array.isArray(a)?a:[a];u.current=p.map(h2),v.useEffect(()=>{if(!i)return;const f=o??(typeof window<"u"?window:void 0);if(!f)return;function h(x){const m=x,y=x2(m.target);for(const g of u.current){if(!v2(m,g))continue;const j=g.meta||g.ctrl||g.alt;if(!(y&&!g.allowInInputs&&!j)){g.handler(m);return}}}return f.addEventListener("keydown",h),()=>{f.removeEventListener("keydown",h)}},[i,o])}const g2=200;function y2(a){return a.scope==="own"||a.scope==="installed"||a.scope==="global"?a.scope:a.origin==="installed"?"installed":"own"}function b2(a,r){const i={availableProject:[],availablePersonal:[],availablePlugin:[],authoringProject:[],authoringPlugin:[]};for(const u of a){const p=u.scopeV2??(u.scope==="installed"?"available-project":u.scope==="global"?"available-personal":"authoring-project");p==="available-project"?i.availableProject.push(u):p==="available-personal"?i.availablePersonal.push(u):p==="available-plugin"?i.availablePlugin.push(u):p==="authoring-plugin"?i.authoringPlugin.push(u):i.authoringProject.push(u)}function o(u){const p=u.filter(x=>Hd(x,r)),f={};for(const x of p){const m=x.pluginName??x.plugin;(f[m]||(f[m]=[])).push(x)}const h=Object.entries(f).sort((x,m)=>x[0].localeCompare(m[0]));return{total:u.length,filtered:p.length,byPlugin:h}}return{availableProject:o(i.availableProject),availablePersonal:o(i.availablePersonal),availablePlugin:o(i.availablePlugin),authoringProject:o(i.authoringProject),authoringPlugin:o(i.authoringPlugin)}}function j2(a,r){const i=[],o=[],u=[];for(const f of a){const h=y2(f);h==="global"?u.push(f):h==="installed"?o.push(f):i.push(f)}function p(f){var y;const h=f.filter(g=>Hd(g,r)),x={};for(const g of h)(x[y=g.plugin]||(x[y]=[])).push(g);const m=Object.entries(x).sort((g,j)=>g[0].localeCompare(j[0]));return{total:f.length,filtered:h.length,byPlugin:m}}return{own:p(i),installed:p(o),global:p(u)}}function S2(a,r){const i=[],o=[];for(const p of a)(p.origin==="installed"?o:i).push(p);function u(p){var m;const f=p.filter(y=>Hd(y,r)),h={};for(const y of f)(h[m=y.plugin]||(h[m]=[])).push(y);const x=Object.entries(h).sort((y,g)=>y[0].localeCompare(g[0]));return{total:p.length,filtered:f.length,byPlugin:x}}return{own:u(i),installed:u(o)}}function k2({skills:a,selectedKey:r,onSelect:i,isLoading:o,error:u,onRetry:p,onContextMenu:f,outdatedByOrigin:h,activeAgentId:x,outdatedByScope:m,topSlot:y}){const g=!!x||a.some(E=>E.scope!==void 0&&E.scope!==null),j=x??"claude-cli",[S,N]=v.useState(""),L=v.useDeferredValue(S),T=v.useMemo(()=>j2(a,L),[a,L]),k=v.useMemo(()=>b2(a,L),[a,L]),M=j==="claude-code",[O,V]=v.useState(()=>yd(`vskill-sidebar-${j}-group-available-collapsed`)),[A,U]=v.useState(()=>yd(`vskill-sidebar-${j}-group-authoring-collapsed`)),w=v.useCallback(E=>{V(E);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-available-collapsed`,String(E))}catch{}},[j]),D=v.useCallback(E=>{U(E);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-authoring-collapsed`,String(E))}catch{}},[j]),{own:R,installed:I}=v.useMemo(()=>S2(a,L),[a,L]),q=T.own.filtered+T.installed.filtered+T.global.filtered>=g2,te=v.useMemo(()=>{const E=B=>{const ne=[];for(const[,Y]of B){const me=[...Y].sort((_,W)=>_.skill.localeCompare(W.skill));ne.push(...me)}return ne};return g?[...E(T.own.byPlugin),...E(T.installed.byPlugin),...E(T.global.byPlugin)]:[...E(R.byPlugin),...E(I.byPlugin)]},[g,T.own.byPlugin,T.installed.byPlugin,T.global.byPlugin,R.byPlugin,I.byPlugin]),Q=v.useMemo(()=>r?te.findIndex(E=>E.plugin===r.plugin&&E.skill===r.skill):-1,[te,r]),z=v.useCallback(E=>{if(te.length===0)return;const B=Q<0?E>0?0:te.length-1:Math.min(Math.max(Q+E,0),te.length-1);i(te[B])},[te,Q,i]);return gd([{key:"j",handler:()=>z(1)},{key:"k",handler:()=>z(-1)},{key:"Enter",handler:()=>{Q>=0&&i(te[Q])}}],{enabled:!o&&!u}),n.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,n.jsx(i2,{value:S,onChange:N}),o&&n.jsx(T2,{}),!o&&u&&n.jsx(R2,{error:u,onRetry:p}),!o&&!u&&g&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Dx,{name:J.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:O,onToggle:w,count:k.availableProject.total+k.availablePersonal.total+k.availablePlugin.total}),!O&&n.jsxs(n.Fragment,{children:[n.jsx(ps,{label:J.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${j}-available-project-collapsed`,count:k.availableProject.total,filteredCount:S?k.availableProject.filtered:null,updateCount:(m==null?void 0:m.installed)??(h==null?void 0:h.installed),children:k.availableProject.filtered===0?n.jsx(Ox,{queryActive:!!S,agentId:j}):n.jsx(ms,{items:k.availableProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:q})}),n.jsx(ps,{label:J.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${j}-available-personal-collapsed`,count:k.availablePersonal.total,filteredCount:S?k.availablePersonal.filtered:null,updateCount:m==null?void 0:m.global,children:k.availablePersonal.filtered===0?n.jsx(C2,{queryActive:!!S,agentId:j}):n.jsx(ms,{items:k.availablePersonal.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:q})}),M&&n.jsx(ps,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-available-plugin-collapsed`,count:k.availablePlugin.total,filteredCount:S?k.availablePlugin.filtered:null,children:k.availablePlugin.filtered===0?n.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin skills installed — run ",n.jsx("code",{children:"/plugin install"})," in Claude Code."]}):k.availablePlugin.byPlugin.map(([E,B])=>n.jsx(Lx,{pluginName:E,skills:B,persistKey:`vskill-plugin-available-${E}-collapsed`,renderSkill:ne=>n.jsx(uo,{skill:ne,isSelected:(r==null?void 0:r.plugin)===ne.plugin&&(r==null?void 0:r.skill)===ne.skill,onSelect:()=>i(ne),onContextMenu:f})},`available-${E}`))})]}),n.jsx(E2,{}),n.jsx(Dx,{name:J.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:A,onToggle:D,count:k.authoringProject.total+k.authoringPlugin.total,action:{label:"New",title:"Create a new skill (standalone or plugin)",icon:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),onClick:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:request-create-skill",{detail:{mode:"standalone"}}))}}}),!A&&n.jsxs(n.Fragment,{children:[n.jsx(ps,{label:J.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${j}-authoring-project-collapsed`,count:k.authoringProject.total,filteredCount:S?k.authoringProject.filtered:null,updateCount:(m==null?void 0:m.own)??(h==null?void 0:h.source),children:k.authoringProject.filtered===0?n.jsx(_x,{queryActive:!!S}):n.jsx(ms,{items:k.authoringProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:q})}),M&&n.jsx(ps,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-authoring-plugin-collapsed`,count:k.authoringPlugin.total,filteredCount:S?k.authoringPlugin.filtered:null,children:k.authoringPlugin.filtered===0?n.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",n.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):k.authoringPlugin.byPlugin.map(([E,B])=>n.jsx(Lx,{pluginName:E,skills:B,persistKey:`vskill-plugin-authoring-${E}-collapsed`,renderSkill:ne=>n.jsx(uo,{skill:ne,isSelected:(r==null?void 0:r.plugin)===ne.plugin&&(r==null?void 0:r.skill)===ne.skill,onSelect:()=>i(ne),onContextMenu:f})},`authoring-${E}`))})]})]}),!o&&!u&&!g&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(zx,{origin:"source",count:R.total,filteredCount:S?R.filtered:null,updateCount:h==null?void 0:h.source,children:R.filtered===0?n.jsx(_x,{queryActive:!!S}):n.jsx(ms,{items:R.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:q})}),n.jsx(N2,{}),n.jsx(zx,{origin:"installed",count:I.total,filteredCount:S?I.filtered:null,updateCount:h==null?void 0:h.installed,children:I.filtered===0?n.jsx(Ox,{queryActive:!!S}):n.jsx(ms,{items:I.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:q})})]})]})}function yd(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(a)==="true"}catch{return!1}}function ps({label:a,storageKey:r,count:i,filteredCount:o,updateCount:u,children:p}){const[f,h]=v.useState(()=>yd(r)),x=v.useCallback(()=>{h(y=>{const g=!y;if(typeof window<"u")try{window.localStorage.setItem(r,String(g))}catch{}return g})},[r]),m=o!=null&&o!==i?`${o} of ${i}`:String(i);return n.jsxs("section",{"data-vskill-named-scope":a,children:[n.jsxs("button",{type:"button",onClick:x,"aria-expanded":!f,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",background:"transparent",border:"none",cursor:"pointer",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-secondary)",width:10,display:"inline-block"},children:f?"▸":"▾"}),n.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:a}),n.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",m,")"]}),u!=null&&u>0&&n.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[u," update",u!==1?"s":""]})]}),!f&&n.jsx("div",{children:p})]})}function w2(a){const r=[];for(const[i,o]of a){const u=[...o].sort((p,f)=>p.skill.localeCompare(f.skill));r.push({kind:"header",plugin:i,count:u.length});for(const p of u)r.push({kind:"row",skill:p})}return r}function ms({items:a,selectedKey:r,onSelect:i,onContextMenu:o,useVirtual:u}){if(u){const p=w2(a);return n.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:n.jsx(Uj,{overscan:4,totalCount:p.length,itemContent:f=>{const h=p[f];if(!h)return null;if(h.kind==="header")return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const x=h.skill,m=!!r&&r.plugin===x.plugin&&r.skill===x.skill;return n.jsx(uo,{skill:x,isSelected:m,onSelect:()=>i(x),onContextMenu:o})}})})}return n.jsx("div",{"data-virtualized":"false",children:a.map(([p,f])=>n.jsx(d2,{plugin:p,skills:f,selectedKey:r,onSelect:i,onContextMenu:o},p))})}function _x({queryActive:a}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:"No skills yet.",body:n.jsxs(n.Fragment,{children:["Create one with ",n.jsx(Ud,{children:"vskill new"})," or the"," ",n.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function Ox({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:r?`No skills installed for ${r} in this project.`:"No installed skills.",body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(Ud,{children:"vskill install <plugin>"})," to add one."]})})}function C2({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:`No global skills for ${r}.`,body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(Ud,{children:"vskill install --global <plugin>"})," to add one."]})})}function pr({headline:a,body:r}){return n.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[n.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:a}),n.jsx("div",{children:r})]})}function Ud({children:a}){return n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-primary)",background:"color-mix(in srgb, var(--border-default) 45%, transparent)",padding:"1px 4px",borderRadius:3},children:a})}function N2(){return n.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function E2(){return n.jsx("div",{"aria-hidden":"true","data-testid":"scope-bold-divider",style:{height:3,background:"var(--color-rule)",boxShadow:"inset 0 1px 0 color-mix(in srgb, var(--color-rule) 50%, transparent)",margin:"12px 0"}})}function T2(){return n.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(a=>n.jsx(m2,{},a))})}function R2({error:a,onRetry:r}){return n.jsxs("div",{role:"alert",style:{margin:"12px 14px",padding:12,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-canvas)",color:"var(--text-primary)",fontSize:12},children:[n.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),n.jsxs("details",{children:[n.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:A2(a)}),n.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:a})]}),r&&n.jsx("button",{type:"button",onClick:r,style:{marginTop:8,background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"4px 10px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry"})]})}function A2(a){const r=a.split(`
|
|
55
|
+
`)[0]??a;return r.length>80?r.slice(0,77)+"…":r}const Qv=240,Zv=480,Jv="vskill-sidebar-width",js=320;function Vd(a){return Number.isFinite(a)?Math.round(Math.max(Qv,Math.min(Zv,a))):js}function M2(){try{const a=localStorage.getItem(Jv);if(!a)return js;const r=Number(a);return Number.isFinite(r)?Vd(r):js}catch{return js}}function z2(a){try{localStorage.setItem(Jv,String(Vd(a)))}catch{}}function L2({initialWidth:a,onChange:r}){const i=v.useRef({startX:0,startWidth:a,pointerId:null}),o=v.useRef(a);return v.useEffect(()=>{o.current=a},[a]),v.useEffect(()=>{function u(f){if(i.current.pointerId==null||f.pointerId!==i.current.pointerId)return;const h=f.clientX-i.current.startX,x=Vd(i.current.startWidth+h);o.current=x,r(x)}function p(f){i.current.pointerId==null||f.pointerId!==i.current.pointerId||(i.current.pointerId=null,z2(o.current))}return window.addEventListener("pointermove",u),window.addEventListener("pointerup",p),window.addEventListener("pointercancel",p),()=>{window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p)}},[r]),n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":Qv,"aria-valuemax":Zv,"aria-valuenow":a,"aria-label":"Resize sidebar",title:"Drag to resize sidebar",onPointerDown:u=>{const p=u.currentTarget;i.current.startX=u.clientX,i.current.startWidth=o.current,i.current.pointerId=u.pointerId;try{p.setPointerCapture(u.pointerId)}catch{}},style:{width:4,alignSelf:"stretch",cursor:"col-resize",background:"var(--border-default)",userSelect:"none",touchAction:"none"}})}function D2({connected:a,hint:r,onRetry:i}){return a?null:n.jsxs("aside",{"aria-live":"assertive",role:"alert",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",background:"color-mix(in srgb, var(--status-own) 15%, transparent)",borderBottom:"1px solid var(--border-default)",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-own)",display:"inline-block",flexShrink:0}}),n.jsx("span",{style:{fontWeight:500},children:"Disconnected — reconnecting…"}),r&&n.jsx("span",{style:{color:"var(--text-secondary)",fontSize:11},children:r}),n.jsx("div",{style:{flex:1}}),i&&n.jsx("button",{type:"button",onClick:i,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry now"})]})}function eg(a){if(a!==void 0)try{return JSON.stringify(a)}catch(r){console.error("Failed to serialize request body:",r);try{const i=new WeakSet;return JSON.stringify(a,(o,u)=>{if(typeof u=="object"&&u!==null){if(i.has(u))return"[Circular]";i.add(u)}return u})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function Ku(){const[a,r]=v.useState([]),[i,o]=v.useState(!1),[u,p]=v.useState(!1),[f,h]=v.useState(null),x=v.useRef(null),m=v.useCallback(async(g,j)=>{r([]),o(!0),p(!1),h(null);const S=new AbortController;x.current=S;try{const N=eg(j),L=await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:N,signal:S.signal});if(!L.ok||!L.body){let V=`HTTP ${L.status}`;try{const A=await L.json();A.error&&(V=A.error)}catch{}throw new Error(V)}const T=L.body.getReader(),k=new TextDecoder;let M="",O="";for(;;){const{done:V,value:A}=await T.read();if(V)break;M+=k.decode(A,{stream:!0});const U=M.split(`
|
|
56
|
+
`);M=U.pop()||"";for(const w of U)if(w.startsWith("event: "))O=w.slice(7).trim();else if(w.startsWith("data: ")){try{const D=JSON.parse(w.slice(6)),R={event:O,data:D};O==="done"?(p(!0),r(I=>[...I,R])):r(I=>[...I,R])}catch{}O=""}}}catch(N){N.name!=="AbortError"&&h(N.message)}finally{o(!1),x.current=null}},[]),y=v.useCallback(()=>{var g;(g=x.current)==null||g.abort()},[]);return{events:a,running:i,done:u,error:f,start:m,stop:y}}function _2(a){const r=v.useRef(a);r.current=a;const[i,o]=v.useState(new Set),u=v.useRef(new Map),p=v.useCallback(async(m,y,g)=>{var S;(S=u.current.get(m))==null||S.abort();const j=new AbortController;u.current.set(m,j),o(N=>{const L=new Set(N);return L.add(m),L});try{const N=eg(g),L=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:N,signal:j.signal});if(!L.ok||!L.body){let V=`HTTP ${L.status}`;try{const A=await L.json();A.error&&(V=A.error)}catch{}throw new Error(V)}const T=L.body.getReader(),k=new TextDecoder;let M="",O="";for(;;){const{done:V,value:A}=await T.read();if(V)break;M+=k.decode(A,{stream:!0});const U=M.split(`
|
|
57
|
+
`);M=U.pop()||"";for(const w of U)if(w.startsWith("event: "))O=w.slice(7).trim();else if(w.startsWith("data: ")){try{const D=JSON.parse(w.slice(6)),R={event:O,data:D};r.current.onEvent(m,R)}catch{}O=""}}r.current.onDone(m)}catch(N){N.name!=="AbortError"&&r.current.onError(m,N.message)}finally{o(N=>{const L=new Set(N);return L.delete(m),L}),u.current.delete(m)}},[]),f=v.useCallback(m=>{var y;(y=u.current.get(m))==null||y.abort()},[]),h=v.useCallback(()=>{for(const m of u.current.values())m.abort()},[]),x=i.size>0;return{runningSet:i,startCase:p,stopCase:f,stopAll:h,isAnyCaseRunning:x}}const O2={plugin:"",skill:"",skillContent:"",savedContent:"",isDirty:!1,evals:null,evalsError:null,activePanel:"tests",selectedCaseId:null,caseRunStates:new Map,bulkRunActive:!1,runMode:null,latestBenchmark:null,inlineResults:new Map,improveTarget:null,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null,generateEvalsLoading:!1,generateEvalsProgress:[],generateEvalsError:null,regressions:[],iterationCount:0,activationPrompts:"",activationResults:[],activationSummary:null,activationRunning:!1,activationError:null,activationTotalPrompts:0,activationStartedAt:null,activationClassifyingStatus:null,generatingPrompts:!1,generatingPromptsError:null,activationHistory:null,activationHistoryLoading:!1,loading:!0,error:null};function B2(a,r){var i,o;switch(r.type){case"SET_LOADING":return{...a,loading:r.loading};case"SET_ERROR":return{...a,error:r.error};case"INIT_DATA":{const u=new Map;if(r.benchmark)for(const f of r.benchmark.cases)u.set(f.eval_id,{status:f.status,passRate:f.pass_rate,errorMessage:f.error_message||void 0,durationMs:f.durationMs,tokens:f.tokens,output:f.output,assertions:f.assertions.map(h=>({assertion_id:h.id,text:h.text,pass:h.pass,reasoning:h.reasoning}))});const p=((o=(i=r.evals)==null?void 0:i.evals[0])==null?void 0:o.id)??null;return{...a,skillContent:r.skillContent,savedContent:r.skillContent,isDirty:!1,evals:r.evals,evalsError:r.evalsError??null,latestBenchmark:r.benchmark,inlineResults:u,selectedCaseId:p,loading:!1,error:null}}case"SET_PANEL":return{...a,activePanel:r.panel};case"SET_CONTENT":return{...a,skillContent:r.content,isDirty:r.content!==a.savedContent};case"CONTENT_SAVED":return{...a,savedContent:a.skillContent,isDirty:!1};case"SET_EVALS":return{...a,evals:r.evals};case"SELECT_CASE":return{...a,selectedCaseId:r.caseId};case"CASE_RUN_START":{const u=new Map(a.caseRunStates);return u.set(r.caseId,{status:"running",startedAt:Date.now(),mode:r.mode}),{...a,caseRunStates:u,runMode:r.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const u=new Map(a.caseRunStates),p=u.get(r.caseId);u.set(r.caseId,{status:"complete",mode:p==null?void 0:p.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,r.result),{...a,caseRunStates:u,inlineResults:f}}case"CASE_RUN_ERROR":{const u=new Map(a.caseRunStates),p=u.get(r.caseId);u.set(r.caseId,{status:"error",mode:p==null?void 0:p.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,{status:"error",errorMessage:r.error,assertions:[]}),{...a,caseRunStates:u,inlineResults:f}}case"CASE_RUN_CANCEL":{const u=new Map(a.caseRunStates),p=u.get(r.caseId);return u.set(r.caseId,{status:"cancelled",mode:p==null?void 0:p.mode}),{...a,caseRunStates:u}}case"BULK_RUN_START":{const u=new Map(a.caseRunStates);for(const p of r.caseIds)u.set(p,{status:"queued",mode:r.mode});return{...a,caseRunStates:u,bulkRunActive:!0,runMode:r.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...a,bulkRunActive:!1,latestBenchmark:r.benchmark??a.latestBenchmark,iterationCount:a.iterationCount+1};case"CANCEL_ALL":{const u=new Map(a.caseRunStates);for(const[p,f]of u)(f.status==="running"||f.status==="queued")&&u.set(p,{status:"cancelled"});return{...a,caseRunStates:u,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const u=new Map(a.inlineResults);return u.set(r.evalId,r.result),{...a,inlineResults:u}}case"OPEN_IMPROVE":return{...a,improveTarget:r.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...a,improveTarget:null};case"OPEN_AI_EDIT":return{...a,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...a,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...a,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...a,aiEditProgress:[...a.aiEditProgress,r.entry]};case"AI_EDIT_RESULT":{const u=r.evalChanges??[],p=new Map;for(let f=0;f<u.length;f++)p.set(f,!0);return{...a,aiEditLoading:!1,aiEditResult:{improved:r.improved,reasoning:r.reasoning,evalChanges:u},aiEditEvalChanges:u,aiEditEvalSelections:p}}case"AI_EDIT_ERROR":return{...a,aiEditLoading:!1,aiEditError:r.message,aiEditClassifiedError:r.classified??null};case"GENERATE_EVALS_START":return{...a,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...a,generateEvalsProgress:[...a.generateEvalsProgress,r.entry]};case"GENERATE_EVALS_DONE":return{...a,generateEvalsLoading:!1,evals:r.evals};case"GENERATE_EVALS_ERROR":return{...a,generateEvalsLoading:!1,generateEvalsError:r.classified};case"TOGGLE_EVAL_CHANGE":{const u=new Map(a.aiEditEvalSelections);return u.set(r.index,!u.get(r.index)),{...a,aiEditEvalSelections:u}}case"SELECT_ALL_EVAL_CHANGES":{const u=new Map(a.aiEditEvalSelections);for(const p of u.keys())u.set(p,!0);return{...a,aiEditEvalSelections:u}}case"DESELECT_ALL_EVAL_CHANGES":{const u=new Map(a.aiEditEvalSelections);for(const p of u.keys())u.set(p,!1);return{...a,aiEditEvalSelections:u}}case"SET_EVALS_RETRY":return{...a,aiEditEvalsRetry:r.evalsFile};case"SET_REGRESSIONS":return{...a,regressions:r.regressions};case"INCREMENT_ITERATION":return{...a,iterationCount:a.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...a,activationPrompts:r.prompts};case"ACTIVATION_START":return{...a,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...a,activationResults:[...a.activationResults,r.result]};case"ACTIVATION_DONE":return{...a,activationRunning:!1,activationSummary:r.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...a,activationClassifyingStatus:`Classifying prompt ${r.index}/${r.total}...`};case"ACTIVATION_ERROR":return{...a,activationRunning:!1,activationError:r.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...a,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...a,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...a,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...a,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...a,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...a,generatingPrompts:!1,generatingPromptsError:r.error};case"ACTIVATION_HISTORY_LOADED":return{...a,activationHistory:r.runs,activationHistoryLoading:!1};default:return a}}function I2(a){if(a==="unit"||a==="integration")return a}function H2(a,r){const i=r.data;if(r.event==="output_ready"&&(a.output=i.output,i.durationMs!=null&&(a.durationMs=i.durationMs),i.tokens!=null&&(a.tokens=i.tokens)),r.event==="outputs_ready"&&(a.output=i.skillOutput,i.skillDurationMs!=null&&(a.durationMs=i.skillDurationMs),i.skillTokens!=null&&(a.tokens=i.skillTokens)),r.event==="assertion_result"){const o={assertion_id:i.assertion_id,text:i.text,pass:i.pass,reasoning:i.reasoning};a.assertions.find(u=>u.assertion_id===o.assertion_id)||a.assertions.push(o)}r.event==="case_complete"&&(a.status=i.status,a.passRate=i.pass_rate,a.errorMessage=i.error_message||void 0,a.classifiedError=i.classified_error||void 0)}const tg=v.createContext(null);function kn(){const a=v.useContext(tg);if(!a)throw new Error("useWorkspace must be used within WorkspaceProvider");return a}function Bx({plugin:a,skill:r,origin:i,children:o}){const u=i==="installed",[p,f]=v.useReducer(B2,{...O2,plugin:a,skill:r}),h=v.useRef(new Set),x=v.useRef(new Set),m=v.useRef(new Map),y=v.useCallback((ae,Z)=>{let se=m.current.get(ae);se||(se={assertions:[]},m.current.set(ae,se)),H2(se,Z),f({type:"UPDATE_INLINE_RESULT",evalId:ae,result:{...se,assertions:[...se.assertions]}})},[]),g=v.useCallback(ae=>{if(x.current.has(ae))return;x.current.add(ae);const Z=m.current.get(ae)??{assertions:[]};f({type:"CASE_RUN_COMPLETE",caseId:ae,result:{...Z,assertions:[...Z.assertions]}}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ne.getLatestBenchmark(a,r).then(se=>f({type:"BULK_RUN_COMPLETE",benchmark:se})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null})))},[a,r]),j=v.useCallback((ae,Z)=>{x.current.has(ae)||(x.current.add(ae),f({type:"CASE_RUN_ERROR",caseId:ae,error:Z}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ne.getLatestBenchmark(a,r).then(se=>f({type:"BULK_RUN_COMPLETE",benchmark:se})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[a,r]),{startCase:S,stopCase:N,stopAll:L}=_2({onEvent:y,onDone:g,onError:j});v.useEffect(()=>()=>{L()},[L]);const T=v.useCallback(async()=>{try{const ae=await fetch(`/api/skills/${a}/${r}/activation-history`);if(!ae.ok){if(ae.status===404){f({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const Z=await ae.json();f({type:"ACTIVATION_HISTORY_LOADED",runs:Z.runs||[]})}catch{}},[a,r]);v.useEffect(()=>{let ae=!1;async function Z(){try{const[se,ue,ge]=await Promise.allSettled([Ne.getSkillDetail(a,r),Ne.getEvals(a,r),Ne.getLatestBenchmark(a,r)]);if(ae)return;let Oe=null,Me=null;if(ue.status==="fulfilled")Oe=ue.value;else{const dt=ue.reason;(dt==null?void 0:dt.status)!==404&&(Me=(dt==null?void 0:dt.message)??"Failed to load test cases")}f({type:"INIT_DATA",skillContent:se.status==="fulfilled"?se.value.skillContent:"",evals:Oe,evalsError:Me,benchmark:ge.status==="fulfilled"?ge.value:null})}catch(se){ae||f({type:"SET_ERROR",error:se.message})}}return Z(),T(),()=>{ae=!0}},[a,r,T]);const k=v.useCallback(async()=>{if(!u)try{await Ne.applyImprovement(a,r,p.skillContent),f({type:"CONTENT_SAVED"})}catch(ae){f({type:"SET_ERROR",error:ae.message})}},[u,a,r,p.skillContent]),M=v.useCallback(async ae=>{if(!u)try{const Z=await Ne.saveEvals(a,r,ae);f({type:"SET_EVALS",evals:Z})}catch(Z){f({type:"SET_ERROR",error:Z.message})}},[u,a,r]),O=v.useCallback((ae,Z="benchmark")=>{if(u)return;const se=p.caseRunStates.get(ae);if((se==null?void 0:se.status)!=="running")if(m.current.delete(ae),x.current.delete(ae),f({type:"CASE_RUN_START",caseId:ae,mode:Z}),Z==="comparison"){const ue=`/api/skills/${a}/${r}/compare`;S(ae,ue,{eval_ids:[ae]})}else{const ue=`/api/skills/${a}/${r}/benchmark/case/${ae}`;S(ae,ue,Z==="baseline"?{baseline_only:!0}:void 0)}},[u,a,r,p.caseRunStates,S]),V=v.useCallback((ae="benchmark")=>{var ue;if(u)return;const Z=((ue=p.evals)==null?void 0:ue.evals)??[];if(Z.length===0)return;const se=Z.map(ge=>ge.id);for(const ge of se)m.current.delete(ge),x.current.delete(ge);f({type:"BULK_RUN_START",caseIds:se,mode:ae}),h.current=new Set(se);for(const ge of se)if(ae==="comparison")S(ge,`/api/skills/${a}/${r}/compare`,{eval_ids:[ge]});else{const Oe=`/api/skills/${a}/${r}/benchmark/case/${ge}`;S(ge,Oe,ae==="baseline"?{baseline_only:!0}:void 0)}},[u,a,r,p.evals,S]),A=v.useCallback(ae=>{N(ae),f({type:"CASE_RUN_CANCEL",caseId:ae}),h.current.delete(ae),x.current.add(ae)},[N]),U=v.useCallback(()=>{L(),f({type:"CANCEL_ALL"}),h.current.clear()},[L]),w=v.useCallback(async(ae,Z)=>{f({type:"OPEN_IMPROVE",evalId:ae})},[]),D=v.useCallback(async(ae,Z)=>{try{await Ne.applyImprovement(a,r,Z),f({type:"SET_CONTENT",content:Z}),f({type:"CONTENT_SAVED"}),f({type:"CLOSE_IMPROVE"}),O(ae,"benchmark")}catch(se){f({type:"SET_ERROR",error:se.message})}},[a,r,O]),R=Ku(),I=v.useRef(null),G=v.useRef(0);v.useEffect(()=>{const ae=R.events;for(let Z=G.current;Z<ae.length;Z++){const se=ae[Z],ue=se.data;if(se.event==="progress"&&f({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:ue.phase,message:ue.message}}),se.event==="done"){const ge=ue.improved,Oe=ue.reasoning,Me=ue.evalChanges??[];f({type:"AI_EDIT_RESULT",improved:ge,reasoning:Oe,evalChanges:Me})}if(se.event==="error"){const ge=ue;f({type:"AI_EDIT_ERROR",message:ge.description||"Unknown error",classified:ge})}}G.current=ae.length},[R.events]),v.useEffect(()=>{R.error&&f({type:"AI_EDIT_ERROR",message:R.error})},[R.error]),v.useEffect(()=>()=>{R.stop()},[R.stop]);const q=v.useCallback(async(ae,Z,se)=>{u||(G.current=0,f({type:"AI_EDIT_LOADING"}),I.current=R.stop,R.start(`/api/skills/${a}/${r}/improve?sse`,{mode:"instruct",instruction:ae,content:p.skillContent,evals:p.evals??{skill_name:r,evals:[]},provider:Z,model:se}))},[u,a,r,p.skillContent,p.evals,R]),te=v.useCallback(()=>{R.stop(),f({type:"AI_EDIT_ERROR",message:"Cancelled"})},[R]),Q=v.useCallback(async()=>{const ae=p.aiEditResult;if(ae!=null&&ae.improved)try{if(await Ne.applyImprovement(a,r,ae.improved),f({type:"SET_CONTENT",content:ae.improved}),f({type:"CONTENT_SAVED"}),p.aiEditEvalChanges.length>0&&Array.from(p.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:se}=await Nd(async()=>{const{mergeEvalChanges:Oe}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Oe}},[]),ue=p.evals??{skill_name:r,evals:[]},ge=se(ue,p.aiEditEvalChanges,p.aiEditEvalSelections);try{const Oe=await Ne.saveEvals(a,r,ge);f({type:"SET_EVALS",evals:Oe})}catch(Oe){f({type:"SET_EVALS_RETRY",evalsFile:ge}),f({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Oe.message}. You can retry from the AI Edit panel.`});return}}f({type:"CLOSE_AI_EDIT"})}catch(Z){f({type:"SET_ERROR",error:Z.message})}},[a,r,p.aiEditResult,p.evals,p.aiEditEvalChanges,p.aiEditEvalSelections]),z=v.useCallback(()=>{f({type:"CLOSE_AI_EDIT"})},[]),E=v.useCallback(ae=>{f({type:"TOGGLE_EVAL_CHANGE",index:ae})},[]),B=v.useCallback(()=>{f({type:"SELECT_ALL_EVAL_CHANGES"})},[]),ne=v.useCallback(()=>{f({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),Y=v.useCallback(async()=>{const ae=p.aiEditEvalsRetry;if(ae)try{const Z=await Ne.saveEvals(a,r,ae);f({type:"SET_EVALS",evals:Z}),f({type:"SET_ERROR",error:null}),f({type:"CLOSE_AI_EDIT"})}catch(Z){f({type:"SET_ERROR",error:`Retry failed: ${Z.message}`})}},[a,r,p.aiEditEvalsRetry]),me=v.useCallback(async()=>{try{const ae=await Ne.getSkillDetail(a,r);f({type:"SET_CONTENT",content:ae.skillContent}),f({type:"CONTENT_SAVED"})}catch{}},[a,r]),{config:_}=bl(),W=Ku(),oe=v.useRef(0);v.useEffect(()=>{const ae=W.events;for(let Z=oe.current;Z<ae.length;Z++){const se=ae[Z],ue=se.data;if(se.event==="progress"&&f({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:ue.phase,message:ue.message}}),se.event==="done"){const ge=ue;Ne.saveEvals(a,r,ge).then(Oe=>f({type:"GENERATE_EVALS_DONE",evals:Oe})).catch(Oe=>f({type:"SET_ERROR",error:Oe.message}))}se.event==="error"&&f({type:"GENERATE_EVALS_ERROR",classified:ue})}oe.current=ae.length},[W.events,a,r]),v.useEffect(()=>{W.error&&f({type:"SET_ERROR",error:W.error})},[W.error]),v.useEffect(()=>()=>{W.stop()},[W.stop]);const fe=v.useCallback(async ae=>{if(u)return;oe.current=0,f({type:"GENERATE_EVALS_START"});const Z={};_!=null&&_.provider&&(Z.provider=_.provider),_!=null&&_.model&&(Z.model=_.model);const se=I2(ae==null?void 0:ae.testType);se&&(Z.testType=se),W.start(`/api/skills/${a}/${r}/generate-evals?sse`,Object.keys(Z).length>0?Z:void 0)},[u,a,r,W,_]),he=Ku(),xe=v.useRef(0);v.useEffect(()=>()=>{he.stop()},[he.stop]),v.useEffect(()=>{const ae=he.events;for(let Z=xe.current;Z<ae.length;Z++){const se=ae[Z];if(se.event==="classifying"){const ue=se.data;f({type:"ACTIVATION_CLASSIFYING",index:ue.index,total:ue.total})}if(se.event==="prompt_result"&&f({type:"ACTIVATION_RESULT",result:se.data}),se.event==="done"){ke.current&&(clearTimeout(ke.current),ke.current=null);const ue=se.data;if(ue.error)f({type:"ACTIVATION_ERROR",error:ue.error});else{f({type:"ACTIVATION_DONE",summary:ue});const ge={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(_==null?void 0:_.model)||"unknown",provider:(_==null?void 0:_.provider)||"unknown",promptCount:ue.total,summary:{precision:ue.precision,recall:ue.recall,reliability:ue.reliability,tp:ue.tp,tn:ue.tn,fp:ue.fp,fn:ue.fn}};f({type:"ACTIVATION_HISTORY_LOADED",runs:[ge,...p.activationHistory??[]]})}}}xe.current=ae.length},[he.events,_,p.activationHistory]),v.useEffect(()=>{he.error&&(ke.current&&(clearTimeout(ke.current),ke.current=null),f({type:"ACTIVATION_ERROR",error:he.error}))},[he.error]);const ke=v.useRef(null),ce=v.useCallback(()=>{ke.current&&(clearTimeout(ke.current),ke.current=null),he.stop(),f({type:"ACTIVATION_CANCEL",totalPrompts:0})},[he]),je=v.useCallback(ae=>{const se=ae.trim().split(`
|
|
58
|
+
`).filter(Boolean).map(ge=>ge.startsWith("!")?{prompt:ge.slice(1).trim(),expected:"should_not_activate"}:ge.startsWith("+")?{prompt:ge.slice(1).trim(),expected:"should_activate"}:{prompt:ge.trim(),expected:"auto"});xe.current=0,f({type:"ACTIVATION_START"}),f({type:"SET_ACTIVATION_PROMPTS",prompts:ae});const ue={prompts:se};_!=null&&_.provider&&(ue.provider=_.provider),_!=null&&_.model&&(ue.model=_.model),he.start(`/api/skills/${a}/${r}/activation-test`,ue),ke.current&&clearTimeout(ke.current),ke.current=setTimeout(()=>{he.stop(),f({type:"ACTIVATION_TIMEOUT"}),ke.current=null},12e4)},[a,r,he,_]),Ue=v.useCallback(async(ae=8)=>{f({type:"GENERATE_PROMPTS_START"});try{const Z={count:ae};_!=null&&_.provider&&(Z.provider=_.provider),_!=null&&_.model&&(Z.model=_.model);const se=await fetch(`/api/skills/${a}/${r}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Z)});if(!se.ok){let ct=`HTTP ${se.status}`;try{const Vt=await se.json();Vt.error&&(ct=Vt.error)}catch{}throw new Error(ct)}const ue=se.body.getReader(),ge=new TextDecoder;let Oe="",Me="",dt=[];for(;;){const{done:ct,value:Vt}=await ue.read();if(ct)break;Oe+=ge.decode(Vt,{stream:!0});const $t=Oe.split(`
|
|
59
59
|
`);Oe=$t.pop()||"";for(const tt of $t)if(tt.startsWith("event: "))Me=tt.slice(7).trim();else if(tt.startsWith("data: ")){try{const jt=JSON.parse(tt.slice(6));if(Me==="done"){if(jt.error)throw new Error(jt.error);dt=jt.prompts||[]}if(Me==="error")throw new Error(jt.message||jt.description||"Generation failed")}catch(jt){if(!(jt instanceof SyntaxError))throw jt}Me=""}}const Zt=dt.map(ct=>`${ct.expected==="should_activate"?"+":"!"}${ct.prompt}`).join(`
|
|
60
|
-
`);f({type:"SET_ACTIVATION_PROMPTS",prompts:Zt}),f({type:"GENERATE_PROMPTS_DONE"})}catch(Z){f({type:"GENERATE_PROMPTS_ERROR",error:Z.message})}},[a,r,
|
|
61
|
-
`),i=[];for(const o of r)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){i.push({type:"header",content:o});continue}if(o.startsWith("+")){i.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){i.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&i.length>0)&&i.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return i}function Vd({contentDiff:a,fromLabel:r,toLabel:i,diffSummary:o,maxHeight:u=480,collapsible:p=!1,renderContext:f="inline",onRetry:h}){const[x,m]=v.useState(p),[y,g]=v.useState("unified"),j=v.useRef(null),S=v.useRef(null),N=v.useMemo(()=>U2(a),[a]),z=v.useMemo(()=>{const A=N.filter(w=>w.type==="add").length,U=N.filter(w=>w.type==="remove").length;return{added:A,removed:U}},[N]),T=v.useMemo(()=>{let A=0,U=0;return N.filter(w=>w.type!=="header").map(w=>w.type==="remove"?(A++,{...w,origNum:A,newNum:null}):w.type==="add"?(U++,{...w,origNum:null,newNum:U}):(A++,U++,{...w,origNum:A,newNum:U}))},[N]),k=v.useMemo(()=>{const A=[],U=[];for(const w of T)if(w.type==="remove")A.push(w);else if(w.type==="add")U.push(w);else{for(;A.length<U.length;)A.push({type:"context",content:"",origNum:null,newNum:null});for(;U.length<A.length;)U.push({type:"context",content:"",origNum:null,newNum:null});A.push(w),U.push(w)}for(;A.length<U.length;)A.push({type:"context",content:"",origNum:null,newNum:null});for(;U.length<A.length;)U.push({type:"context",content:"",origNum:null,newNum:null});return{left:A,right:U}},[T]),M=v.useCallback(A=>{const U=A==="left"?j.current:S.current,w=A==="left"?S.current:j.current;U&&w&&(w.scrollTop=U.scrollTop)},[]);if(!a||N.length===0)return n.jsxs("div",{className:"rounded-lg p-6 text-center",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"Unable to load diff. Try again."}),h&&n.jsx("button",{onClick:h,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const O=f==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",V=n.jsxs("div",{className:"rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[r," → ",i]}),n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",z.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",z.removed]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>g(y==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:y==="unified"?"Side-by-side":"Unified"}),p&&n.jsx("button",{onClick:()=>m(!x),className:"btn btn-ghost text-[11px]",children:x?"Expand":"Collapse"})]})]}),o&&n.jsx("div",{className:"mx-4 mt-3 px-4 py-2 rounded-lg text-[12px]",style:{background:"var(--accent-muted)",color:"var(--text-secondary)"},children:o}),!x&&(y==="unified"?n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:u,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:T.map((A,U)=>n.jsxs("tr",{style:{background:A.type==="add"?"rgba(34,197,94,0.08)":A.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:A.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:A.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:A.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:A.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:A.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:A.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:A.type==="add"?"var(--green)":A.type==="remove"?"var(--red)":"transparent",borderRight:A.type==="add"?"2px solid var(--green)":A.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:A.type==="add"?"+":A.type==="remove"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:A.type==="add"?"var(--green)":A.type==="remove"?"var(--red)":"var(--text-secondary)"},children:A.content||""})]},U))})})}):n.jsxs("div",{className:"mx-4 my-4 grid grid-cols-2 gap-0 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{ref:j,style:{maxHeight:u,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>M("left"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:k.left.map((A,U)=>n.jsxs("tr",{style:{background:A.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:A.origNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:A.type==="remove"?"var(--red)":"var(--text-secondary)"},children:A.content||""})]},U))})})}),n.jsx("div",{ref:S,style:{maxHeight:u,overflowY:"auto"},onScroll:()=>M("right"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:k.right.map((A,U)=>n.jsxs("tr",{style:{background:A.type==="add"?"rgba(34,197,94,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:A.newNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:A.type==="add"?"var(--green)":"var(--text-secondary)"},children:A.content||""})]},U))})})})]}))]});return f==="modal"?n.jsx("div",{className:O,children:n.jsx("div",{style:{width:"80%",maxWidth:900},children:V})}):V}const Bx={CERTIFIED:{bg:"var(--yellow-muted)",text:"var(--yellow)"},VERIFIED:{bg:"var(--accent-muted)",text:"var(--accent)"},COMMUNITY:{bg:"var(--surface-3)",text:"var(--text-tertiary)"}};function V2(a,r){return a?a.length>r?a.slice(0,r)+"…":a:""}function ng(){const{state:a}=kn(),{plugin:r,skill:i}=a,{refreshSkills:o,updateCount:u}=ya(),p=`versions/${r}/${i}`,f=v.useCallback(()=>Ne.getSkillVersions(r,i),[r,i]),{data:h,loading:x}=zs(p,f),[m,y]=v.useState(null),[g,j]=v.useState(null),[S,N]=v.useState(null),[z,T]=v.useState(!1),[k,M]=v.useState("idle"),[O,V]=v.useState(null),A=v.useRef(null),U=v.useRef(null),w=v.useMemo(()=>(h==null?void 0:h.find(q=>q.isInstalled))??null,[h]),L=v.useMemo(()=>(h==null?void 0:h[0])??null,[h]),R=w&&L&&w.version!==L.version,I=v.useCallback(q=>{m?!g&&q!==m?j(q):(y(q),j(null),N(null)):(y(q),N(null))},[m,g]),G=v.useCallback(async(q,_)=>{T(!0);try{const E=await Ne.getVersionDiff(r,i,q,_);N(E)}catch{N(null)}finally{T(!1)}},[r,i]);v.useEffect(()=>{if(m&&g){const q=h||[],_=q.findIndex(F=>F.version===m),E=q.findIndex(F=>F.version===g),[B,ne]=_>E?[m,g]:[g,m];G(B,ne)}},[m,g,h,G]);const Y=v.useCallback(()=>{!w||!L||(y(w.version),j(L.version))},[w,L]),te=v.useCallback(()=>{M("updating"),V(null);const q=Ne.startSkillUpdate(r,i);A.current=q,q.addEventListener("progress",_=>{try{switch(JSON.parse(_.data).status){case"scanning":M("scanning");break;case"installing":M("installing");break;case"done":M("done");break}}catch{M("error"),V("Unexpected response from server")}}),q.addEventListener("done",()=>{q.close(),A.current=null,o(),Xn(p),M("done")}),q.addEventListener("error",_=>{const E=_;let B="Connection lost";if(E.data)try{B=JSON.parse(E.data).error||"Update failed"}catch{}M("error"),V(B),q.close(),A.current=null})},[r,i,p,o]);return v.useEffect(()=>()=>{A.current&&(A.current.close(),A.current=null)},[]),x?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]}):!h||h.length===0?n.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16",children:n.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})}):n.jsxs("div",{className:"p-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),n.jsxs("div",{className:"flex items-center gap-2",children:[R&&n.jsx("button",{onClick:Y,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),R&&k!=="done"&&(k==="error"?n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:O||"Update failed"}),n.jsx("button",{onClick:te,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):n.jsx("button",{onClick:te,disabled:k!=="idle",className:"btn btn-primary text-[11px]",children:k==="idle"?`Update to ${L==null?void 0:L.version}`:k==="updating"?"Starting update...":k==="scanning"?"Scanning...":"Installing..."})),u>1&&n.jsxs("button",{onClick:()=>{window.location.hash="#/updates"},className:"text-[11px] hover:underline",style:{color:"var(--text-tertiary)",background:"transparent",border:"none",cursor:"pointer"},children:["Manage all updates (",u,")"]})]})]}),m&&!g&&n.jsxs("div",{className:"text-[11px] mb-3 px-3 py-2 rounded-lg",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:["Click another version to compare with ",m]}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),n.jsx("div",{className:"space-y-1",children:h.map(q=>{const _=Bx[q.certTier]||Bx.COMMUNITY,E=q.version===m||q.version===g,B=q.isInstalled;return n.jsxs("button",{onClick:()=>I(q.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:E?"var(--accent-muted)":"transparent",border:E?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:ne=>{E||(ne.currentTarget.style.background="var(--surface-1)")},onMouseLeave:ne=>{E||(ne.currentTarget.style.background="transparent")},children:[n.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:B?10:8,height:B?10:8,background:B?"var(--accent)":"var(--surface-3)",border:B?"2px solid var(--accent)":"2px solid var(--border-default)"}}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:q.version}),n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:_.bg,color:_.text},children:q.certTier}),B&&n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:"installed"})]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:new Date(q.createdAt).toLocaleDateString()})]}),q.diffSummary&&n.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:V2(q.diffSummary,80)})]},q.version)})}),n.jsx("div",{ref:U,style:{height:1}})]}),z&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"skeleton h-48 rounded-xl"})}),S&&!z&&n.jsx("div",{className:"mt-4",children:n.jsx(Vd,{contentDiff:S.contentDiff,fromLabel:S.from,toLabel:S.to,diffSummary:S.diffSummary,renderContext:"inline",onRetry:()=>m&&g&&G(S.from,S.to)})})]})}function $2(a){return a==null?"var(--text-tertiary)":a>=.7?"var(--green)":a>=.4?"var(--yellow)":"var(--red)"}function G2(a){return a==null?"var(--surface-3)":a>=.7?"var(--green-muted)":a>=.4?"var(--yellow-muted)":"var(--red-muted)"}function Ix(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function $d(a){return a.skill?q2({skill:a.skill}):F2({state:a.state,isReadOnly:a.isReadOnly,onDelete:a.onDelete})}function P2(a,r=48){if(a.length<=r)return a;const i=a.slice(0,12),o=a.slice(a.length-(r-12-1));return`${i}…${o}`}function q2({skill:a}){const[r,i]=v.useState(!1),o=v.useCallback(async()=>{var f;try{await((f=navigator.clipboard)==null?void 0:f.writeText(a.dir)),i(!0),setTimeout(()=>i(!1),1500),Ix(J.toasts.pathCopied,"info")}catch{Ix(J.toasts.permissionDenied,"error")}},[a.dir]),u=a.origin==="installed"?"Installed":"Own",p=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("div",{"data-testid":"detail-header",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",marginBottom:4},children:[n.jsx("span",{"data-testid":"detail-header-plugin",children:a.plugin}),n.jsx("span",{"aria-hidden":"true",style:{color:"var(--text-secondary)"},children:"›"}),n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-secondary)",fontSize:11,letterSpacing:.3,textTransform:"uppercase"},children:[n.jsx("span",{"data-origin-dot":a.origin,"aria-label":`Origin: ${u}`,style:{display:"inline-block",width:7,height:7,borderRadius:999,background:p}}),u]})]}),n.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,marginBottom:8},children:[n.jsx("h2",{"data-testid":"detail-header-name",style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,lineHeight:1.25,color:"var(--text-primary)",margin:0},children:a.skill}),n.jsx("span",{"data-testid":"detail-header-version",style:{fontFamily:"var(--font-sans)",fontVariantNumeric:"tabular-nums",fontSize:12,color:"var(--text-secondary)",whiteSpace:"nowrap"},children:a.version??"—"})]}),n.jsx(Y2,{skill:a}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("button",{type:"button","data-testid":"detail-header-path-chip",title:a.dir,"aria-label":`Copy path ${a.dir} to clipboard`,onClick:o,style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},children:P2(a.dir||"—")}),n.jsxs("button",{"data-testid":"detail-header-copy-path",type:"button",onClick:o,"aria-label":"Copy skill path to clipboard",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:11,cursor:"pointer"},children:[n.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),r?"Copied":"Copy"]})]})]})}function Y2({skill:a}){const r=a.installMethod,i=a.symlinkTarget;if(!r)return null;let o="";switch(r){case"symlinked":o=i?`Symlinked from ${i}`:"Symlinked (target unresolved)";break;case"copied":o="Copied (independent)";break;case"authored":o="Authored";break;default:return null}return n.jsxs("div",{"data-testid":"detail-header-install-method",style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",margin:"6px 0 8px"},children:[n.jsx("span",{style:{fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",fontSize:10,color:"var(--text-tertiary)"},children:"Install method"}),n.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o})]})}function F2({state:a,isReadOnly:r,onDelete:i}){const{plugin:o,skill:u,evals:p,latestBenchmark:f,isDirty:h,caseRunStates:x,regressions:m,iterationCount:y}=a,g=Array.from(x.values()).some(k=>k.status==="running"||k.status==="queued"),j=f==null?void 0:f.overall_pass_rate,S=(p==null?void 0:p.evals.reduce((k,M)=>k+M.assertions.length,0))??0,N=(p==null?void 0:p.evals.length)??0,z=$2(j),T=G2(j);return n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[n.jsx("span",{style:{color:"var(--text-tertiary)"},children:o}),n.jsx(W2,{}),n.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:u}),r&&n.jsxs("span",{className:"ml-2 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),h&&n.jsx("span",{className:"ml-2 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:"unsaved"}),g&&n.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[n.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[!r&&i&&n.jsx("button",{disabled:g,onClick:()=>{window.confirm(`Delete skill "${u}"? This cannot be undone.`)&&i()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:g?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:g?.4:1,borderRadius:4},onMouseEnter:k=>{g||(k.currentTarget.style.color="var(--red)")},onMouseLeave:k=>{k.currentTarget.style.color="var(--text-tertiary)"},children:n.jsx(K2,{})}),m.length>0&&n.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),m.length," regression",m.length>1?"s":""]}),y>0&&n.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",y]}),n.jsx("span",{className:"pill",style:{background:T,color:z},children:j!=null?`${Math.round(j*100)}%`:"--"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[N," case",N!==1?"s":""," / ",S," assert",S!==1?"s":""]})]})]})}function W2(){return n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function K2(){return n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),n.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),n.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}const X2=[{label:"Build",tabs:[{id:"editor",label:"Editor",shortcut:"1"},{id:"tests",label:"Tests",shortcut:"2"}]},{label:"Evaluate",tabs:[{id:"run",label:"Run",shortcut:"3"},{id:"activation",label:"Activation",shortcut:"4"}]},{label:"Insights",tabs:[{id:"history",label:"History",shortcut:"5"},{id:"leaderboard",label:"Leaderboard",shortcut:"6"},{id:"deps",label:"Deps",shortcut:"7"},{id:"versions",label:"Versions",shortcut:"8"}]}];function Q2({id:a}){const r={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(a){case"editor":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"tests":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]});case"run":return n.jsx("svg",{...r,children:n.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"leaderboard":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]});case"deps":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]});case"versions":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M12 8v4l3 3"}),n.jsx("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]})}}function Z2({activePanel:a,onPanelChange:r,isDirty:i,isRunning:o,hasRegressions:u,isActivationRunning:p,hasUpdate:f}){return n.jsx("div",{className:"flex items-center gap-0.5 px-3 overflow-x-auto",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:X2.map((h,x)=>n.jsxs("div",{className:"flex items-center",children:[x>0&&n.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),h.tabs.map(m=>{const y=a===m.id,g=m.id==="editor"&&i||m.id==="run"&&o||m.id==="activation"&&p||m.id==="history"&&u||m.id==="versions"&&f,j=m.id==="run"||m.id==="activation"?"var(--accent)":m.id==="history"?"var(--red)":"var(--yellow)";return n.jsxs("button",{onClick:()=>r(m.id),title:`${m.label} (Ctrl+${m.shortcut})`,className:"relative flex items-center gap-1.5 px-3 py-2.5 text-[12px] font-medium transition-colors duration-150",style:{background:"transparent",color:y?"var(--text-primary)":"var(--text-tertiary)",borderBottom:y?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:y?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:S=>{y||(S.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:S=>{y||(S.currentTarget.style.color="var(--text-tertiary)")},children:[n.jsx(Q2,{id:m.id}),m.label,g&&n.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:j}})]},m.id)})]},h.label))})}const Hx={rate_limit:{icon:"⏱",color:"var(--amber, #f59e0b)"},context_window:{icon:"⚠",color:"var(--amber, #f59e0b)"},auth:{icon:"🔒",color:"var(--red, #ef4444)"},timeout:{icon:"⌛",color:"var(--amber, #f59e0b)"},model_not_found:{icon:"🔍",color:"var(--red, #ef4444)"},provider_unavailable:{icon:"⚡",color:"var(--red, #ef4444)"},parse_error:{icon:"❓",color:"var(--amber, #f59e0b)"},unknown:{icon:"❌",color:"var(--red, #ef4444)"}};function Ls({error:a,onRetry:r,onDismiss:i}){const[o,u]=v.useState(null),p=v.useRef(null);v.useEffect(()=>(a.category==="rate_limit"&&a.retryAfterMs?u(Math.ceil(a.retryAfterMs/1e3)):u(null),()=>{p.current&&clearInterval(p.current)}),[a]),v.useEffect(()=>{if(!(o==null||o<=0))return p.current=setInterval(()=>{u(x=>x==null||x<=1?(p.current&&clearInterval(p.current),0):x-1)},1e3),()=>{p.current&&clearInterval(p.current)}},[o!=null&&o>0]);const f=Hx[a.category]||Hx.unknown,h=o!=null&&o>0;return n.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${f.color} 30%, transparent)`,background:`color-mix(in srgb, ${f.color} 6%, var(--surface-1))`},children:[n.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{style:{fontSize:14},children:f.icon}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:f.color},children:a.title})]}),i&&n.jsx("button",{onClick:i,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-3.5 pb-3",children:[n.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:a.description}),n.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.hint}),(r||o!=null)&&n.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:r&&n.jsx("button",{onClick:r,disabled:h,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:h?.5:1},children:h?`Retry in ${o}s`:"Retry"})})]})]})}class J2 extends v.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,i){console.error("ErrorBoundary caught:",r,i.componentStack)}render(){return this.state.hasError?n.jsxs("div",{style:{padding:24,textAlign:"center"},children:[n.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:"Something went wrong"}),n.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:8},children:"An unexpected error occurred in this panel."}),n.jsx("button",{onClick:()=>window.location.reload(),className:"btn btn-secondary",style:{marginTop:16,fontSize:12},children:"Reload"})]}):this.props.children}}function eS(a){const r=a.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(r)?{category:"rate_limit",title:"Rate Limit",description:a,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(r)?{category:"auth",title:"Authentication Failed",description:a,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(r)?{category:"timeout",title:"Request Timed Out",description:a,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(r)?{category:"model_not_found",title:"Model Not Found",description:a,hint:"The selected model is not available. Try switching to a different model in the dropdown above.",retryable:!1}:/context.?(?:window|length)|token.?(?:limit|count|exceed)|too (?:long|large)|maximum.?context|input.?too.?long|prompt.?too.?(?:long|large)/.test(r)?{category:"context_window",title:"Content Too Large",description:a,hint:"Reduce SKILL.md size or move detailed content to references/ files.",retryable:!1}:/enoent|command not found|502|503|service.?unavailable|connection.?refused|econnrefused|server.?error/.test(r)?{category:"provider_unavailable",title:"Provider Unavailable",description:a,hint:"Check that the provider is installed and running.",retryable:!1}:/syntaxerror|json\.?parse|parse.?error|failed to parse|not valid json|unexpected token/.test(r)?{category:"parse_error",title:"Response Parse Error",description:a,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:a,hint:"",retryable:!1}}function tS(a){const r=a.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!r)return{metadata:{},body:a};const i=r[1],o=r[2].trim(),u={},p=i.split(`
|
|
62
|
-
`);let f="",h=!1;for(const x of p){const m=x.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(m&&f&&h){const j=m[1],S=m[2].trim();let N=u[f];if((typeof N!="object"||Array.isArray(N))&&(N={},u[f]=N),!S)N[j]=[];else{const
|
|
63
|
-
`),i=[];let o=0;for(;o<r.length;)if(r[o].trim().startsWith("|")&&o+1<r.length&&r[o+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(r[o+1])){const u=
|
|
64
|
-
`)}function
|
|
60
|
+
`);f({type:"SET_ACTIVATION_PROMPTS",prompts:Zt}),f({type:"GENERATE_PROMPTS_DONE"})}catch(Z){f({type:"GENERATE_PROMPTS_ERROR",error:Z.message})}},[a,r,_]),Le=v.useMemo(()=>({state:p,dispatch:f,isReadOnly:u,saveContent:k,saveEvals:M,runCase:O,runAll:V,cancelCase:A,cancelAll:U,improveForCase:w,applyImproveAndRerun:D,refreshSkillContent:me,generateEvals:fe,runActivationTest:je,cancelActivation:ce,generateActivationPrompts:Ue,fetchActivationHistory:T,submitAiEdit:q,cancelAiEdit:te,applyAiEdit:Q,discardAiEdit:z,toggleEvalChange:E,selectAllEvalChanges:B,deselectAllEvalChanges:ne,retryEvalsSave:Y}),[p,u,k,M,O,V,A,U,w,D,me,fe,je,ce,Ue,T,q,te,Q,z,E,B,ne,Y]);return n.jsx(tg.Provider,{value:Le,children:o})}const ro=new Map,vl=new Map,hs=new Map;function Xn(a){ro.delete(a),vl.delete(a);const r=hs.get(a);if(r)for(const i of r)i()}function zs(a,r,i={}){const{ttl:o=3e4,enabled:u=!0}=i,[,p]=v.useState(0),f=v.useRef(!0),h=v.useRef(a);h.current=a;const x=()=>Xn(a);v.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),v.useEffect(()=>{if(!u)return;const j=()=>{f.current&&p(S=>S+1)};return hs.has(a)||hs.set(a,new Set),hs.get(a).add(j),()=>{var S;(S=hs.get(a))==null||S.delete(j)}},[a,u]),v.useEffect(()=>{if(!u)return;const j=ro.get(a);if(!(!j||Date.now()-j.fetchedAt>o))return;if(vl.has(a)){const T=vl.get(a),k=()=>{f.current&&h.current===a&&p(M=>M+1)};T.subscribers.push(k);return}const N={promise:Promise.resolve(),subscribers:[]},L=r().then(T=>{ro.set(a,{data:T,fetchedAt:Date.now()}),vl.delete(a),f.current&&h.current===a&&p(k=>k+1);for(const k of N.subscribers)k()},T=>{vl.delete(a),f.current&&h.current===a&&p(k=>k+1);for(const k of N.subscribers)k();throw T});N.promise=L,vl.set(a,N)},[a,r,o,u]);const m=ro.get(a),y=u&&!m&&vl.has(a);return{data:m==null?void 0:m.data,loading:y||u&&!m,error:void 0,revalidate:x}}function U2(a){if(!a)return[];const r=a.split(`
|
|
61
|
+
`),i=[];for(const o of r)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){i.push({type:"header",content:o});continue}if(o.startsWith("+")){i.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){i.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&i.length>0)&&i.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return i}function $d({contentDiff:a,fromLabel:r,toLabel:i,diffSummary:o,maxHeight:u=480,collapsible:p=!1,renderContext:f="inline",onRetry:h}){const[x,m]=v.useState(p),[y,g]=v.useState("unified"),j=v.useRef(null),S=v.useRef(null),N=v.useMemo(()=>U2(a),[a]),L=v.useMemo(()=>{const A=N.filter(w=>w.type==="add").length,U=N.filter(w=>w.type==="remove").length;return{added:A,removed:U}},[N]),T=v.useMemo(()=>{let A=0,U=0;return N.filter(w=>w.type!=="header").map(w=>w.type==="remove"?(A++,{...w,origNum:A,newNum:null}):w.type==="add"?(U++,{...w,origNum:null,newNum:U}):(A++,U++,{...w,origNum:A,newNum:U}))},[N]),k=v.useMemo(()=>{const A=[],U=[];for(const w of T)if(w.type==="remove")A.push(w);else if(w.type==="add")U.push(w);else{for(;A.length<U.length;)A.push({type:"context",content:"",origNum:null,newNum:null});for(;U.length<A.length;)U.push({type:"context",content:"",origNum:null,newNum:null});A.push(w),U.push(w)}for(;A.length<U.length;)A.push({type:"context",content:"",origNum:null,newNum:null});for(;U.length<A.length;)U.push({type:"context",content:"",origNum:null,newNum:null});return{left:A,right:U}},[T]),M=v.useCallback(A=>{const U=A==="left"?j.current:S.current,w=A==="left"?S.current:j.current;U&&w&&(w.scrollTop=U.scrollTop)},[]);if(!a||N.length===0)return n.jsxs("div",{className:"rounded-lg p-6 text-center",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"Unable to load diff. Try again."}),h&&n.jsx("button",{onClick:h,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const O=f==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",V=n.jsxs("div",{className:"rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[r," → ",i]}),n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",L.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",L.removed]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>g(y==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:y==="unified"?"Side-by-side":"Unified"}),p&&n.jsx("button",{onClick:()=>m(!x),className:"btn btn-ghost text-[11px]",children:x?"Expand":"Collapse"})]})]}),o&&n.jsx("div",{className:"mx-4 mt-3 px-4 py-2 rounded-lg text-[12px]",style:{background:"var(--accent-muted)",color:"var(--text-secondary)"},children:o}),!x&&(y==="unified"?n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:u,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:T.map((A,U)=>n.jsxs("tr",{style:{background:A.type==="add"?"rgba(34,197,94,0.08)":A.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:A.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:A.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:A.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:A.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:A.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:A.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:A.type==="add"?"var(--green)":A.type==="remove"?"var(--red)":"transparent",borderRight:A.type==="add"?"2px solid var(--green)":A.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:A.type==="add"?"+":A.type==="remove"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:A.type==="add"?"var(--green)":A.type==="remove"?"var(--red)":"var(--text-secondary)"},children:A.content||""})]},U))})})}):n.jsxs("div",{className:"mx-4 my-4 grid grid-cols-2 gap-0 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{ref:j,style:{maxHeight:u,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>M("left"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:k.left.map((A,U)=>n.jsxs("tr",{style:{background:A.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:A.origNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:A.type==="remove"?"var(--red)":"var(--text-secondary)"},children:A.content||""})]},U))})})}),n.jsx("div",{ref:S,style:{maxHeight:u,overflowY:"auto"},onScroll:()=>M("right"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:k.right.map((A,U)=>n.jsxs("tr",{style:{background:A.type==="add"?"rgba(34,197,94,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:A.newNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:A.type==="add"?"var(--green)":"var(--text-secondary)"},children:A.content||""})]},U))})})})]}))]});return f==="modal"?n.jsx("div",{className:O,children:n.jsx("div",{style:{width:"80%",maxWidth:900},children:V})}):V}const Ix={CERTIFIED:{bg:"var(--yellow-muted)",text:"var(--yellow)"},VERIFIED:{bg:"var(--accent-muted)",text:"var(--accent)"},COMMUNITY:{bg:"var(--surface-3)",text:"var(--text-tertiary)"}};function V2(a,r){return a?a.length>r?a.slice(0,r)+"…":a:""}function ng(){const{state:a}=kn(),{plugin:r,skill:i}=a,{refreshSkills:o,updateCount:u}=ya(),p=`versions/${r}/${i}`,f=v.useCallback(()=>Ne.getSkillVersions(r,i),[r,i]),{data:h,loading:x}=zs(p,f),[m,y]=v.useState(null),[g,j]=v.useState(null),[S,N]=v.useState(null),[L,T]=v.useState(!1),[k,M]=v.useState("idle"),[O,V]=v.useState(null),A=v.useRef(null),U=v.useRef(null),w=v.useMemo(()=>(h==null?void 0:h.find(Q=>Q.isInstalled))??null,[h]),D=v.useMemo(()=>(h==null?void 0:h[0])??null,[h]),R=w&&D&&w.version!==D.version,I=v.useCallback(Q=>{m?!g&&Q!==m?j(Q):(y(Q),j(null),N(null)):(y(Q),N(null))},[m,g]),G=v.useCallback(async(Q,z)=>{T(!0);try{const E=await Ne.getVersionDiff(r,i,Q,z);N(E)}catch{N(null)}finally{T(!1)}},[r,i]);v.useEffect(()=>{if(m&&g){const Q=h||[],z=Q.findIndex(Y=>Y.version===m),E=Q.findIndex(Y=>Y.version===g),[B,ne]=z>E?[m,g]:[g,m];G(B,ne)}},[m,g,h,G]);const q=v.useCallback(()=>{!w||!D||(y(w.version),j(D.version))},[w,D]),te=v.useCallback(()=>{M("updating"),V(null);const Q=Ne.startSkillUpdate(r,i);A.current=Q,Q.addEventListener("progress",z=>{try{switch(JSON.parse(z.data).status){case"scanning":M("scanning");break;case"installing":M("installing");break;case"done":M("done");break}}catch{M("error"),V("Unexpected response from server")}}),Q.addEventListener("done",()=>{Q.close(),A.current=null,o(),Xn(p),M("done")}),Q.addEventListener("error",z=>{const E=z;let B="Connection lost";if(E.data)try{B=JSON.parse(E.data).error||"Update failed"}catch{}M("error"),V(B),Q.close(),A.current=null})},[r,i,p,o]);return v.useEffect(()=>()=>{A.current&&(A.current.close(),A.current=null)},[]),x?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]}):!h||h.length===0?n.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16",children:n.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})}):n.jsxs("div",{className:"p-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),n.jsxs("div",{className:"flex items-center gap-2",children:[R&&n.jsx("button",{onClick:q,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),R&&k!=="done"&&(k==="error"?n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:O||"Update failed"}),n.jsx("button",{onClick:te,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):n.jsx("button",{onClick:te,disabled:k!=="idle",className:"btn btn-primary text-[11px]",children:k==="idle"?`Update to ${D==null?void 0:D.version}`:k==="updating"?"Starting update...":k==="scanning"?"Scanning...":"Installing..."})),u>1&&n.jsxs("button",{onClick:()=>{window.location.hash="#/updates"},className:"text-[11px] hover:underline",style:{color:"var(--text-tertiary)",background:"transparent",border:"none",cursor:"pointer"},children:["Manage all updates (",u,")"]})]})]}),m&&!g&&n.jsxs("div",{className:"text-[11px] mb-3 px-3 py-2 rounded-lg",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:["Click another version to compare with ",m]}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),n.jsx("div",{className:"space-y-1",children:h.map(Q=>{const z=Ix[Q.certTier]||Ix.COMMUNITY,E=Q.version===m||Q.version===g,B=Q.isInstalled;return n.jsxs("button",{onClick:()=>I(Q.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:E?"var(--accent-muted)":"transparent",border:E?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:ne=>{E||(ne.currentTarget.style.background="var(--surface-1)")},onMouseLeave:ne=>{E||(ne.currentTarget.style.background="transparent")},children:[n.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:B?10:8,height:B?10:8,background:B?"var(--accent)":"var(--surface-3)",border:B?"2px solid var(--accent)":"2px solid var(--border-default)"}}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:Q.version}),n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:z.bg,color:z.text},children:Q.certTier}),B&&n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:"installed"})]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:new Date(Q.createdAt).toLocaleDateString()})]}),Q.diffSummary&&n.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:V2(Q.diffSummary,80)})]},Q.version)})}),n.jsx("div",{ref:U,style:{height:1}})]}),L&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"skeleton h-48 rounded-xl"})}),S&&!L&&n.jsx("div",{className:"mt-4",children:n.jsx($d,{contentDiff:S.contentDiff,fromLabel:S.from,toLabel:S.to,diffSummary:S.diffSummary,renderContext:"inline",onRetry:()=>m&&g&&G(S.from,S.to)})})]})}function $2(a){return a==null?"var(--text-tertiary)":a>=.7?"var(--green)":a>=.4?"var(--yellow)":"var(--red)"}function G2(a){return a==null?"var(--surface-3)":a>=.7?"var(--green-muted)":a>=.4?"var(--yellow-muted)":"var(--red-muted)"}function Hx(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function Gd(a){return a.skill?q2({skill:a.skill}):F2({state:a.state,isReadOnly:a.isReadOnly,onDelete:a.onDelete})}function P2(a,r=48){if(a.length<=r)return a;const i=a.slice(0,12),o=a.slice(a.length-(r-12-1));return`${i}…${o}`}function q2({skill:a}){const[r,i]=v.useState(!1),o=v.useCallback(async()=>{var f;try{await((f=navigator.clipboard)==null?void 0:f.writeText(a.dir)),i(!0),setTimeout(()=>i(!1),1500),Hx(J.toasts.pathCopied,"info")}catch{Hx(J.toasts.permissionDenied,"error")}},[a.dir]),u=a.origin==="installed"?"Installed":"Own",p=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("div",{"data-testid":"detail-header",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",marginBottom:4},children:[n.jsx("span",{"data-testid":"detail-header-plugin",children:a.plugin}),n.jsx("span",{"aria-hidden":"true",style:{color:"var(--text-secondary)"},children:"›"}),n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-secondary)",fontSize:11,letterSpacing:.3,textTransform:"uppercase"},children:[n.jsx("span",{"data-origin-dot":a.origin,"aria-label":`Origin: ${u}`,style:{display:"inline-block",width:7,height:7,borderRadius:999,background:p}}),u]})]}),n.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,marginBottom:8},children:[n.jsx("h2",{"data-testid":"detail-header-name",style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,lineHeight:1.25,color:"var(--text-primary)",margin:0},children:a.skill}),n.jsx("span",{"data-testid":"detail-header-version",style:{fontFamily:"var(--font-sans)",fontVariantNumeric:"tabular-nums",fontSize:12,color:"var(--text-secondary)",whiteSpace:"nowrap"},children:a.version??"—"})]}),n.jsx(Y2,{skill:a}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("button",{type:"button","data-testid":"detail-header-path-chip",title:a.dir,"aria-label":`Copy path ${a.dir} to clipboard`,onClick:o,style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},children:P2(a.dir||"—")}),n.jsxs("button",{"data-testid":"detail-header-copy-path",type:"button",onClick:o,"aria-label":"Copy skill path to clipboard",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:11,cursor:"pointer"},children:[n.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),r?"Copied":"Copy"]})]})]})}function Y2({skill:a}){const r=a.installMethod,i=a.symlinkTarget;if(!r)return null;let o="";switch(r){case"symlinked":o=i?`Symlinked from ${i}`:"Symlinked (target unresolved)";break;case"copied":o="Copied (independent)";break;case"authored":o="Authored";break;default:return null}return n.jsxs("div",{"data-testid":"detail-header-install-method",style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",margin:"6px 0 8px"},children:[n.jsx("span",{style:{fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",fontSize:10,color:"var(--text-tertiary)"},children:"Install method"}),n.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o})]})}function F2({state:a,isReadOnly:r,onDelete:i}){const{plugin:o,skill:u,evals:p,latestBenchmark:f,isDirty:h,caseRunStates:x,regressions:m,iterationCount:y}=a,g=Array.from(x.values()).some(k=>k.status==="running"||k.status==="queued"),j=f==null?void 0:f.overall_pass_rate,S=(p==null?void 0:p.evals.reduce((k,M)=>k+M.assertions.length,0))??0,N=(p==null?void 0:p.evals.length)??0,L=$2(j),T=G2(j);return n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[n.jsx("span",{style:{color:"var(--text-tertiary)"},children:o}),n.jsx(W2,{}),n.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:u}),r&&n.jsxs("span",{className:"ml-2 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),h&&n.jsx("span",{className:"ml-2 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:"unsaved"}),g&&n.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[n.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[!r&&i&&n.jsx("button",{disabled:g,onClick:()=>{window.confirm(`Delete skill "${u}"? This cannot be undone.`)&&i()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:g?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:g?.4:1,borderRadius:4},onMouseEnter:k=>{g||(k.currentTarget.style.color="var(--red)")},onMouseLeave:k=>{k.currentTarget.style.color="var(--text-tertiary)"},children:n.jsx(K2,{})}),m.length>0&&n.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),m.length," regression",m.length>1?"s":""]}),y>0&&n.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",y]}),n.jsx("span",{className:"pill",style:{background:T,color:L},children:j!=null?`${Math.round(j*100)}%`:"--"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[N," case",N!==1?"s":""," / ",S," assert",S!==1?"s":""]})]})]})}function W2(){return n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function K2(){return n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),n.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),n.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}const X2=[{label:"Build",tabs:[{id:"editor",label:"Editor",shortcut:"1"},{id:"tests",label:"Tests",shortcut:"2"}]},{label:"Evaluate",tabs:[{id:"run",label:"Run",shortcut:"3"},{id:"activation",label:"Activation",shortcut:"4"}]},{label:"Insights",tabs:[{id:"history",label:"History",shortcut:"5"},{id:"leaderboard",label:"Leaderboard",shortcut:"6"},{id:"deps",label:"Deps",shortcut:"7"},{id:"versions",label:"Versions",shortcut:"8"}]}];function Q2({id:a}){const r={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(a){case"editor":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"tests":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]});case"run":return n.jsx("svg",{...r,children:n.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"leaderboard":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]});case"deps":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]});case"versions":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M12 8v4l3 3"}),n.jsx("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]})}}function Z2({activePanel:a,onPanelChange:r,isDirty:i,isRunning:o,hasRegressions:u,isActivationRunning:p,hasUpdate:f}){return n.jsx("div",{className:"flex items-center gap-0.5 px-3 overflow-x-auto",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:X2.map((h,x)=>n.jsxs("div",{className:"flex items-center",children:[x>0&&n.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),h.tabs.map(m=>{const y=a===m.id,g=m.id==="editor"&&i||m.id==="run"&&o||m.id==="activation"&&p||m.id==="history"&&u||m.id==="versions"&&f,j=m.id==="run"||m.id==="activation"?"var(--accent)":m.id==="history"?"var(--red)":"var(--yellow)";return n.jsxs("button",{onClick:()=>r(m.id),title:`${m.label} (Ctrl+${m.shortcut})`,className:"relative flex items-center gap-1.5 px-3 py-2.5 text-[12px] font-medium transition-colors duration-150",style:{background:"transparent",color:y?"var(--text-primary)":"var(--text-tertiary)",borderBottom:y?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:y?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:S=>{y||(S.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:S=>{y||(S.currentTarget.style.color="var(--text-tertiary)")},children:[n.jsx(Q2,{id:m.id}),m.label,g&&n.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:j}})]},m.id)})]},h.label))})}const Ux={rate_limit:{icon:"⏱",color:"var(--amber, #f59e0b)"},context_window:{icon:"⚠",color:"var(--amber, #f59e0b)"},auth:{icon:"🔒",color:"var(--red, #ef4444)"},timeout:{icon:"⌛",color:"var(--amber, #f59e0b)"},model_not_found:{icon:"🔍",color:"var(--red, #ef4444)"},provider_unavailable:{icon:"⚡",color:"var(--red, #ef4444)"},parse_error:{icon:"❓",color:"var(--amber, #f59e0b)"},unknown:{icon:"❌",color:"var(--red, #ef4444)"}};function Ls({error:a,onRetry:r,onDismiss:i}){const[o,u]=v.useState(null),p=v.useRef(null);v.useEffect(()=>(a.category==="rate_limit"&&a.retryAfterMs?u(Math.ceil(a.retryAfterMs/1e3)):u(null),()=>{p.current&&clearInterval(p.current)}),[a]),v.useEffect(()=>{if(!(o==null||o<=0))return p.current=setInterval(()=>{u(x=>x==null||x<=1?(p.current&&clearInterval(p.current),0):x-1)},1e3),()=>{p.current&&clearInterval(p.current)}},[o!=null&&o>0]);const f=Ux[a.category]||Ux.unknown,h=o!=null&&o>0;return n.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${f.color} 30%, transparent)`,background:`color-mix(in srgb, ${f.color} 6%, var(--surface-1))`},children:[n.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{style:{fontSize:14},children:f.icon}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:f.color},children:a.title})]}),i&&n.jsx("button",{onClick:i,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-3.5 pb-3",children:[n.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:a.description}),n.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.hint}),(r||o!=null)&&n.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:r&&n.jsx("button",{onClick:r,disabled:h,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:h?.5:1},children:h?`Retry in ${o}s`:"Retry"})})]})]})}class J2 extends v.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,i){console.error("ErrorBoundary caught:",r,i.componentStack)}render(){return this.state.hasError?n.jsxs("div",{style:{padding:24,textAlign:"center"},children:[n.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:"Something went wrong"}),n.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:8},children:"An unexpected error occurred in this panel."}),n.jsx("button",{onClick:()=>window.location.reload(),className:"btn btn-secondary",style:{marginTop:16,fontSize:12},children:"Reload"})]}):this.props.children}}function eS(a){const r=a.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(r)?{category:"rate_limit",title:"Rate Limit",description:a,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(r)?{category:"auth",title:"Authentication Failed",description:a,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(r)?{category:"timeout",title:"Request Timed Out",description:a,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(r)?{category:"model_not_found",title:"Model Not Found",description:a,hint:"The selected model is not available. Try switching to a different model in the dropdown above.",retryable:!1}:/context.?(?:window|length)|token.?(?:limit|count|exceed)|too (?:long|large)|maximum.?context|input.?too.?long|prompt.?too.?(?:long|large)/.test(r)?{category:"context_window",title:"Content Too Large",description:a,hint:"Reduce SKILL.md size or move detailed content to references/ files.",retryable:!1}:/enoent|command not found|502|503|service.?unavailable|connection.?refused|econnrefused|server.?error/.test(r)?{category:"provider_unavailable",title:"Provider Unavailable",description:a,hint:"Check that the provider is installed and running.",retryable:!1}:/syntaxerror|json\.?parse|parse.?error|failed to parse|not valid json|unexpected token/.test(r)?{category:"parse_error",title:"Response Parse Error",description:a,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:a,hint:"",retryable:!1}}function tS(a){const r=a.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!r)return{metadata:{},body:a};const i=r[1],o=r[2].trim(),u={},p=i.split(`
|
|
62
|
+
`);let f="",h=!1;for(const x of p){const m=x.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(m&&f&&h){const j=m[1],S=m[2].trim();let N=u[f];if((typeof N!="object"||Array.isArray(N))&&(N={},u[f]=N),!S)N[j]=[];else{const L=S.match(/^\[(.+)\]$/);L?N[j]=L[1].split(",").map(T=>T.trim().replace(/^["']|["']$/g,"")).filter(Boolean):N[j]=S.replace(/^["']|["']$/g,"")}continue}const y=x.match(/^\s+-\s+(.+)$/);if(y&&f){h=!1;const j=u[f];Array.isArray(j)?j.push(y[1].trim().replace(/^["']|["']$/g,"")):u[f]=[y[1].trim().replace(/^["']|["']$/g,"")];continue}const g=x.match(/^([\w-]+):\s*(.*)$/);if(g){f=g[1];const j=g[2].trim();if(h=!1,!j){u[f]={},h=!0;continue}const S=j.match(/^\[(.+)\]$/);if(S){u[f]=S[1].split(",").map(N=>N.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}u[f]=j.replace(/^["']|["']$/g,"")}}return{metadata:u,body:o}}function bo(a){if(!a)return"";try{let r=a.replace(/^---\n[\s\S]*?\n---\n?/,""),i=nS(r);return i=i.replace(/```(\w*)\n([\s\S]*?)```/g,'<pre style="background:var(--surface-2);padding:0.75rem;border-radius:6px;overflow-x:auto;font-size:12px;line-height:1.5;margin:0.5rem 0;border:1px solid var(--border-subtle)"><code>$2</code></pre>'),i=i.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),i=i.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),i=i.replace(/\*([^*]+)\*/g,"<em>$1</em>"),i=i.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),i=i.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),i=i.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),i=i.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),i=i.replace(/\n/g,"<br/>"),i}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</pre>`}}function nS(a){const r=a.split(`
|
|
63
|
+
`),i=[];let o=0;for(;o<r.length;)if(r[o].trim().startsWith("|")&&o+1<r.length&&r[o+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(r[o+1])){const u=Vx(r[o]);o+=2;const p=[];for(;o<r.length&&r[o].trim().startsWith("|");)p.push(Vx(r[o])),o++;const f='style="text-align:left;padding:0.4rem 0.6rem;font-weight:600;font-size:12px;color:var(--text-primary);border-bottom:1px solid var(--border-default)"',h='style="padding:0.4rem 0.6rem;font-size:12px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)"';let x='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';x+="<thead><tr>";for(const m of u)x+=`<th ${f}>${m}</th>`;x+="</tr></thead><tbody>";for(const m of p){x+="<tr>";for(const y of m)x+=`<td ${h}>${y}</td>`;x+="</tr>"}x+="</tbody></table>",i.push(x)}else i.push(r[o]),o++;return i.join(`
|
|
64
|
+
`)}function Vx(a){return a.split("|").map(r=>r.trim()).filter(r=>r.length>0)}function jo(a,r){const i=a.split(`
|
|
65
65
|
`),o=r.split(`
|
|
66
|
-
`);if(i.length>1e3||o.length>1e3)return[...i.map(y=>({type:"unchanged",content:y}))];const u=i.length,p=o.length,f=Array.from({length:u+1},()=>new Array(p+1).fill(0));for(let y=1;y<=u;y++)for(let g=1;g<=p;g++)i[y-1]===o[g-1]?f[y][g]=f[y-1][g-1]+1:f[y][g]=Math.max(f[y-1][g],f[y][g-1]);const h=[];let x=u,m=p;for(;x>0||m>0;)x>0&&m>0&&i[x-1]===o[m-1]?(h.push({type:"unchanged",content:i[x-1]}),x--,m--):m>0&&(x===0||f[x][m-1]>=f[x-1][m])?(h.push({type:"added",content:o[m-1]}),m--):(h.push({type:"removed",content:i[x-1]}),x--);return h.reverse()}function aS(a,r){if(r&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(a))return n.jsx("div",{className:"spinner",style:{width:10,height:10,flexShrink:0}});const o=new Set(["generating","comparing","preparing","generating_skill","generating_baseline","scoring","action_items"]);return n.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:o.has(a)?"var(--accent)":"var(--green)"}})}function Ds({entries:a,isRunning:r}){const[i,o]=v.useState(!1),u=v.useRef(null);return v.useEffect(()=>{u.current&&!i&&(u.current.scrollTop=u.current.scrollHeight)},[a,i]),a.length===0&&!r?null:n.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("button",{onClick:()=>o(!i),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:p=>{p.currentTarget.style.color="var(--text-primary)"},onMouseLeave:p=>{p.currentTarget.style.color="var(--text-tertiary)"},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[r&&n.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",a.length,")"]}),n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:i?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!i&&n.jsx("div",{ref:u,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:a.map((p,f)=>{const h=f===a.length-1&&r,x=f===0?"0s":`+${((p.timestamp-a[0].timestamp)/1e3).toFixed(1)}s`;return n.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:h?1:.7},children:[aS(p.phase,h),n.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:x}),n.jsx("span",{style:{color:h?"var(--text-primary)":"var(--text-secondary)"},children:p.message}),p.current!=null&&p.total!=null&&n.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",p.current,"/",p.total,"]"]})]},f)})})]})}function lS({plugin:a,skill:r,skillContent:i,onApplied:o}){const[u,p]=v.useState("closed"),{config:f}=bl(),[h,x]=v.useState("claude-cli"),[m,y]=v.useState("opus"),[g,j]=v.useState([]),[S,N]=v.useState(""),[
|
|
67
|
-
`);me=fe.pop()||"";for(const he of fe)if(he.startsWith("event: "))D=he.slice(7).trim();else if(he.startsWith("data: ")){try{const xe=JSON.parse(he.slice(6));D==="progress"?U(ke=>[...ke,{phase:xe.phase,message:xe.message,timestamp:Date.now()}]):D==="done"||D==="complete"?(N(xe.improved),T(xe.reasoning||""),j(jo(xe.original||i,xe.improved)),p("diff_shown")):D==="error"&&(M(xe.message||xe.description||"Unknown error"),xe.category&&V(xe),p("open"))}catch{}D=""}}}catch(B){B.name!=="AbortError"&&(M(B.message),p("open"))}finally{R.current=null}}async function te(){L(!0);try{await Ne.applyImprovement(a,r,S),o(S),p("closed")}catch(E){M(E.message)}finally{L(!1)}}function q(){p("closed"),j([]),N(""),T(""),M(null)}if(u==="closed")return n.jsxs("button",{onClick:()=>p("open"),className:"btn btn-secondary mb-5",disabled:!i,children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const _=I();return n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),n.jsx("button",{onClick:q,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:E=>{E.currentTarget.style.background="var(--surface-3)"},onMouseLeave:E=>{E.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-5 py-4",children:[(u==="open"||u==="loading")&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),n.jsx("select",{className:"input-field text-[12px] py-1.5",value:h,onChange:E=>{x(E.target.value);const B=f==null?void 0:f.providers.find(ne=>ne.id===E.target.value);B!=null&&B.models[0]&&y(B.models[0].id)},disabled:u==="loading",children:f==null?void 0:f.providers.filter(E=>E.available).map(E=>n.jsx("option",{value:E.id,children:E.label},E.id))})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsx("select",{className:"input-field text-[12px] py-1.5",value:m,onChange:E=>y(E.target.value),disabled:u==="loading",children:_==null?void 0:_.models.map(E=>n.jsx("option",{value:E.id,children:E.label},E.id))})]}),u==="loading"?n.jsx("button",{onClick:G,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):n.jsx("button",{onClick:Y,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),u==="loading"&&A.length>0&&n.jsx("div",{className:"mt-3",children:n.jsx(Ds,{entries:A,isRunning:!0})})]}),k&&n.jsx("div",{className:"mb-4",children:O?n.jsx(Ls,{error:O,onRetry:Y,onDismiss:()=>{M(null),V(null)}}):n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:k})}),u==="diff_shown"&&n.jsxs(n.Fragment,{children:[z&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),z]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:g.map((E,B)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:E.type==="added"?"rgba(34,197,94,0.1)":E.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:E.type==="added"?"var(--green)":E.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:E.type==="added"?"3px solid var(--green)":E.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:E.type==="added"?"+":E.type==="removed"?"-":" "}),E.content]},B))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:te,disabled:w,className:"btn btn-primary",children:w?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),n.jsx("button",{onClick:q,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Vx={remove:{bg:"var(--red-muted)",color:"var(--red)",label:"REMOVE"},modify:{bg:"rgba(251,191,36,0.15)",color:"#fbbf24",label:"MODIFY"},add:{bg:"var(--green-muted)",color:"var(--green)",label:"ADD"}},rS={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function sS({change:a,index:r,selected:i,onToggle:o,originalEval:u}){var g;const[p,f]=v.useState(!1),h=Vx[a.action]??Vx.add,x=rS[a.action]??"var(--border-subtle)",m=a.action==="remove"?(u==null?void 0:u.name)??`Eval #${a.evalId}`:((g=a.eval)==null?void 0:g.name)??"Unnamed",y=v.useCallback(()=>o(r),[o,r]);return n.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${x}`,opacity:i?1:.5},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[n.jsx("input",{type:"checkbox",checked:i,onChange:y,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),n.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:h.bg,color:h.color,padding:"1px 6px"},children:h.label}),n.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:m}),n.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:a.reason}),n.jsx("button",{onClick:()=>f(!p),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:j=>{j.currentTarget.style.background="var(--surface-3)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},children:n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:p?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),p&&n.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.action==="add"&&a.eval&&n.jsx(iS,{evalCase:a.eval}),a.action==="modify"&&a.eval&&u&&n.jsx(oS,{original:u,proposed:a.eval}),a.action==="remove"&&u&&n.jsx(cS,{evalCase:u})]})]})}function iS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[n.jsx(yd,{label:"Prompt",value:a.prompt}),n.jsx(yd,{label:"Expected",value:a.expected_output}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-1",children:(a.assertions??[]).map(i=>n.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[n.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",i.text]},i.id))})]})]})}function oS({original:a,proposed:r}){const i=[];a.name!==r.name&&i.push({label:"Name",old:a.name,new:r.name}),a.prompt!==r.prompt&&i.push({label:"Prompt",old:a.prompt,new:r.prompt}),a.expected_output!==r.expected_output&&i.push({label:"Expected",old:a.expected_output,new:r.expected_output});const o=a.assertions??[],u=r.assertions??[],p=new Set(o.map(m=>m.text)),f=new Set(u.map(m=>m.text)),h=u.filter(m=>!p.has(m.text)),x=o.filter(m=>!f.has(m.text));return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[i.map(m=>n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:m.label}),n.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[n.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",bd(m.old,120)]}),n.jsxs("div",{style:{color:"var(--green)"},children:["+ ",bd(m.new,120)]})]})]},m.label)),(h.length>0||x.length>0)&&n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),n.jsxs("div",{className:"mt-1 space-y-0.5",children:[x.map(m=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",m.text]},m.id)),h.map(m=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",m.text]},m.id))]})]}),i.length===0&&h.length===0&&x.length===0&&n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function cS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[n.jsx(yd,{label:"Prompt",value:a.prompt}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-0.5",children:(a.assertions??[]).map(i=>n.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:i.text},i.id))})]})]})}function yd({label:a,value:r}){return n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),n.jsx("div",{className:"mt-0.5 text-[11px] p-2 rounded font-mono",style:{background:"var(--surface-1)",color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:bd(r,300)})]})}function bd(a,r){return a.length>r?a.slice(0,r)+"...":a}const $x={remove:0,modify:1,add:2};function uS({changes:a,selections:r,currentEvals:i,onToggle:o,onSelectAll:u,onDeselectAll:p}){if(a.length===0)return null;const f=a.map((x,m)=>({change:x,originalIndex:m}));f.sort((x,m)=>($x[x.change.action]??2)-($x[m.change.action]??2));const h=Array.from(r.values()).filter(Boolean).length;return n.jsxs("div",{className:"mt-3 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",h,"/",a.length," selected)"]})]}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("button",{onClick:u,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Select All"}),n.jsx("button",{onClick:p,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--surface-3)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),n.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:f.map(({change:x,originalIndex:m})=>n.jsx(sS,{change:x,index:m,selected:r.get(m)??!1,onToggle:o,originalEval:x.evalId!=null?i.find(y=>y.id===x.evalId):void 0},m))})]})}function dS(){var E;const{state:a,dispatch:r,submitAiEdit:i,applyAiEdit:o,discardAiEdit:u,cancelAiEdit:p,toggleEvalChange:f,selectAllEvalChanges:h,deselectAllEvalChanges:x,retryEvalsSave:m}=kn(),{aiEditLoading:y,aiEditResult:g,aiEditError:j,aiEditClassifiedError:S,aiEditProgress:N,aiEditEvalChanges:z,aiEditEvalSelections:T,aiEditEvalsRetry:k}=a,[M,O]=v.useState(""),{config:V}=bl(),[A,U]=v.useState("claude-cli"),[w,L]=v.useState("opus"),R=v.useRef(null);v.useEffect(()=>{var B;(B=R.current)==null||B.focus()},[]),v.useEffect(()=>{if(!V)return;V.providers.find(ne=>ne.id==="claude-cli"&&ne.available)&&(U("claude-cli"),L("opus"))},[V]);const I=V==null?void 0:V.providers.find(B=>B.id===A&&B.available),G=v.useCallback(()=>{const B=M.trim();!B||y||i(B,A,w)},[M,y,i,A,w]),Y=v.useCallback(B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),G()),B.key==="Escape"&&(B.preventDefault(),y?p():u())},[G,y,p,u]),te=v.useCallback(()=>{r({type:"CLOSE_AI_EDIT"}),r({type:"OPEN_AI_EDIT"})},[r]),q=g?jo(a.skillContent,g.improved):[],_=((E=a.evals)==null?void 0:E.evals)??[];return n.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-2)"},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M15 4V2"}),n.jsx("path",{d:"M15 16v-2"}),n.jsx("path",{d:"M8 9h2"}),n.jsx("path",{d:"M20 9h2"}),n.jsx("path",{d:"M17.8 11.8L19 13"}),n.jsx("path",{d:"M15 9h.01"}),n.jsx("path",{d:"M17.8 6.2L19 5"}),n.jsx("path",{d:"M11 6.2L9.7 5"}),n.jsx("path",{d:"M3 21l9-9"})]})}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),n.jsx("button",{onClick:u,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:B=>{B.currentTarget.style.background="var(--surface-3)"},onMouseLeave:B=>{B.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-4 py-3",children:[!g&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-end gap-2.5",children:[n.jsx("div",{className:"flex-1",children:n.jsx("textarea",{ref:R,value:M,onChange:B=>O(B.target.value),onKeyDown:Y,placeholder:"e.g., Add an error handling section...",disabled:y,rows:1,className:"w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 12px",fontSize:12.5,lineHeight:1.5,fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",minHeight:36,maxHeight:96},onInput:B=>{const ne=B.currentTarget;ne.style.height="auto",ne.style.height=Math.min(ne.scrollHeight,96)+"px"}})}),n.jsxs("div",{style:{minWidth:100},children:[n.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),n.jsx("select",{className:"input-field text-[11px] py-1",value:A,onChange:B=>{U(B.target.value);const ne=V==null?void 0:V.providers.find(F=>F.id===B.target.value);ne!=null&&ne.models[0]&&L(ne.models[0].id)},disabled:y,style:{width:"100%"},children:V==null?void 0:V.providers.filter(B=>B.available).map(B=>n.jsx("option",{value:B.id,children:B.label},B.id))})]}),n.jsxs("div",{style:{minWidth:80},children:[n.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsx("select",{className:"input-field text-[11px] py-1",value:w,onChange:B=>L(B.target.value),disabled:y,style:{width:"100%"},children:I==null?void 0:I.models.map(B=>n.jsx("option",{value:B.id,children:B.label},B.id))})]}),y?n.jsx("button",{onClick:p,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):n.jsx("button",{onClick:G,disabled:!M.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),y&&N.length>0&&n.jsx("div",{className:"mt-2.5",children:n.jsx(Ds,{entries:N,isRunning:!0})})]}),j&&n.jsx("div",{className:"mt-3",children:S?n.jsx(Ls,{error:S,onRetry:te,onDismiss:u}):n.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j})}),g&&n.jsxs("div",{className:"animate-fade-in",children:[g.reasoning&&n.jsxs("div",{className:"mb-3 px-3 py-2.5 rounded-lg text-[11.5px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),g.reasoning]}),n.jsx("div",{className:"mb-1",children:n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:q.map((B,ne)=>n.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:B.type==="added"?"rgba(34,197,94,0.1)":B.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:B.type==="added"?"var(--green)":B.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:B.type==="added"?"3px solid var(--green)":B.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:B.type==="added"?"+":B.type==="removed"?"-":" "}),B.content]},ne))}),n.jsx(uS,{changes:z,selections:T,currentEvals:_,onToggle:f,onSelectAll:h,onDeselectAll:x}),k&&n.jsxs("div",{className:"mt-3 px-3 py-2.5 rounded-lg text-[12px] flex items-center justify-between",style:{background:"rgba(251,191,36,0.12)",border:"1px solid rgba(251,191,36,0.3)",color:"#fbbf24"},children:[n.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),n.jsx("button",{onClick:m,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),n.jsxs("div",{className:"flex gap-2 mt-3",children:[n.jsxs("button",{onClick:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[n.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),n.jsx("button",{onClick:u,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),n.jsx("button",{onClick:te,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function fS(a,r){const[i,o]=v.useState([]),[u,p]=v.useState("SKILL.md"),[f,h]=v.useState(null),[x,m]=v.useState(!1),[y,g]=v.useState(null),j=v.useCallback(async()=>{try{const z=await Ne.getSkillFiles(a,r);o(z.files)}catch{o([])}},[a,r]);v.useEffect(()=>{p("SKILL.md"),h(null),g(null),j()},[a,r,j]);const S=v.useCallback(async z=>{if(p(z),z==="SKILL.md"){h(null),g(null);return}m(!0),g(null);try{const T=await Ne.getSkillFile(a,r,z);h(T)}catch(T){g(`Unable to open file: ${T.message}`),h(null)}finally{m(!1)}},[a,r]),N=v.useCallback(()=>{j()},[j]);return{files:i,activeFile:u,secondaryContent:f,loading:x,error:y,selectFile:S,refresh:N,isSkillMd:u==="SKILL.md"}}function pS(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function mS(a){const r=[],i=new Map;for(const o of a){const u=o.path.split("/"),f={name:u[u.length-1],path:o.path,type:o.type,size:o.size,children:[]};i.set(o.path,f)}for(const o of a){const u=o.path.split("/");if(u.length===1){const p=i.get(o.path);p&&r.push(p)}else{const p=u.slice(0,-1).join("/"),f=i.get(p),h=i.get(o.path);f&&h&&f.children.push(h)}}return r}function ag({expanded:a}){return n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function lg(){return n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function hS(){return n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function xS(){return n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"23 4 23 10 17 10"}),n.jsx("polyline",{points:"1 20 1 14 7 14"}),n.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}function rg({node:a,depth:r,activeFile:i,onSelect:o}){const[u,p]=v.useState(!0),f=a.path===i;return a.type==="dir"?n.jsxs("div",{children:[n.jsxs("button",{onClick:()=>p(!u),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*14}px`,paddingTop:2,paddingBottom:2,background:"none",border:"none",cursor:"pointer",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left"},children:[n.jsx(ag,{expanded:u}),n.jsx(lg,{}),n.jsxs("span",{children:[a.name,"/"]})]}),u&&a.children.map(h=>n.jsx(rg,{node:h,depth:r+1,activeFile:i,onSelect:o},h.path))]}):n.jsxs("button",{onClick:()=>o(a.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*14}px`,paddingTop:2,paddingBottom:2,background:f?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:f?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[n.jsx("span",{style:{width:10}}),n.jsx(hS,{}),n.jsx("span",{style:{flex:1},children:a.name}),n.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:pS(a.size)})]})}function vS({files:a,activeFile:r,onSelect:i,onRefresh:o}){const[u,p]=v.useState(!1),f=v.useMemo(()=>mS(a),[a]);return n.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>p(!u),children:[n.jsx(ag,{expanded:u}),n.jsx(lg,{}),n.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),n.jsx("button",{onClick:h=>{h.stopPropagation(),o()},style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:"2px 4px",display:"flex",alignItems:"center",borderRadius:3},title:"Refresh file list",children:n.jsx(xS,{})})]}),u&&n.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:f.length===0?n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):f.map(h=>n.jsx(rg,{node:h,depth:0,activeFile:r,onSelect:i},h.path))})]})}function Ki(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function gS(a){try{return JSON.stringify(JSON.parse(a),null,2)}catch{return a}}function yS(a){const r=a.toLowerCase();return r.endsWith(".json")?"json":r.endsWith(".md")?"md":"other"}function Gx({content:a}){return n.jsx("textarea",{readOnly:!0,value:a,style:{flex:1,width:"100%",resize:"none",background:"var(--surface-1)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}})}function Px({content:a,fileType:r}){if(r==="json"){const i=gS(a);return n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i})}return r==="md"?n.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px 20px",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:13,lineHeight:1.6},dangerouslySetInnerHTML:{__html:bo(a)}}):n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})}function qx(a){try{return JSON.stringify(JSON.parse(a),null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"\\]|\\.)*"\s*:/g,i=>`<span style="color:#6383ff">${i}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,i=>`<span style="color:#22c55e">${i.slice(0,2)}<span style="color:#22c55e">${i.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(i,o)=>`: <span style="color:#fb923c">${o}</span>`).replace(/:\s*(true|false|null)/g,(i,o)=>`: <span style="color:#a855f7">${o}</span>`)}catch{return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}}function bS({file:a,loading:r,error:i,viewMode:o,plugin:u,skill:p,onSaved:f,onDirtyChange:h}){const[x,m]=v.useState(o),[y,g]=v.useState(!1),[j,S]=v.useState(""),[N,z]=v.useState(!1),[T,k]=v.useState(null),M=o!==x?o:x;v.useEffect(()=>{h==null||h(y)},[y,h]);const O=v.useCallback(()=>{(a==null?void 0:a.content)!=null&&(S(a.content),g(!0))},[a]),V=v.useCallback(()=>{g(!1)},[]),A=v.useCallback(async()=>{if(!(!u||!p||!a)){z(!0);try{await Ne.saveSkillFile(u,p,a.path,j),k("Saved"),g(!1),f==null||f(),setTimeout(()=>k(null),2e3)}catch(L){k(`Save failed: ${L.message}`),setTimeout(()=>k(null),3e3)}finally{z(!1)}}},[u,p,a,j,f]);if(v.useEffect(()=>{if(!y)return;const L=R=>{(R.ctrlKey||R.metaKey)&&R.key==="s"&&(R.preventDefault(),A())};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[y,A]),r)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(i)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:n.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[n.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),n.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:i})]})});if(!a)return null;if(a.binary)return n.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",Ki(a.size),") — cannot be displayed"]});const U=a.content??"",w=yS(a.path);return n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[a.truncated&&n.jsxs("div",{style:{padding:"4px 12px",background:"var(--warning-muted, #fef3c7)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:"var(--warning-text, #92400e)"},children:["File truncated at ",Ki(512*1024)," — ",Ki(a.size)," total"]}),n.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(w==="md"||w==="json")&&["raw","split","preview"].map(L=>n.jsx("button",{onClick:()=>m(L),style:{padding:"2px 8px",fontSize:11,background:M===L?"var(--accent-muted)":"none",color:M===L?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:L},L)),n.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[Ki(a.size),u&&p&&!a.binary&&!y&&n.jsx("button",{onClick:O,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:A,disabled:N,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:N?.6:1},children:N?"Saving...":"Save"}),n.jsx("button",{onClick:V,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),T&&n.jsx("div",{style:{padding:"4px 12px",background:T.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:T.startsWith("Save failed")?"var(--red)":"var(--green)"},children:T}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:y?n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[n.jsx("textarea",{value:j,onChange:L=>S(L.target.value),style:{flex:1,width:"100%",resize:"none",background:"var(--surface-0)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}}),n.jsxs("div",{style:{position:"sticky",bottom:0,display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),n.jsx("button",{onClick:A,disabled:N,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:N?.6:1},children:N?"Saving...":"Save"}),n.jsx("button",{onClick:V,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):M==="split"&&w!=="other"?n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:n.jsx(Gx,{content:U})}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:w==="json"?n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:qx(U)}}):n.jsx(Px,{content:U,fileType:w})})]}):M==="preview"&&w!=="other"?w==="json"?n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:qx(U)}}):n.jsx(Px,{content:U,fileType:w}):n.jsx(Gx,{content:U})})]})}function jS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function SS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),n.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function kS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function wS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M15 4V2"}),n.jsx("path",{d:"M15 16v-2"}),n.jsx("path",{d:"M8 9h2"}),n.jsx("path",{d:"M20 9h2"}),n.jsx("path",{d:"M17.8 11.8L19 13"}),n.jsx("path",{d:"M15 9h.01"}),n.jsx("path",{d:"M17.8 6.2L19 5"}),n.jsx("path",{d:"M11 6.2L9.7 5"}),n.jsx("path",{d:"M3 21l9-9"})]})}function Xu({size:a=15}){return n.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function CS(){const{state:a,dispatch:r,saveContent:i,isReadOnly:o}=kn(),{plugin:u,skill:p,skillContent:f,isDirty:h,improveTarget:x,aiEditOpen:m}=a,[y,g]=v.useState("split"),[j,S]=v.useState(!1),N=v.useRef(null),[z,T]=v.useState(!1),[k,M]=v.useState(""),[O,V]=v.useState(!1),[A,U]=v.useState(null),[w,L]=v.useState([]),[R,I]=v.useState([]),[G,Y]=v.useState(null),te=v.useRef(null),{config:q}=bl(),{files:_,activeFile:E,secondaryContent:B,loading:ne,error:F,selectFile:me,refresh:D,isSkillMd:K}=fS(u??"",p??""),[oe,fe]=v.useState(!1),he=v.useCallback(ve=>{oe&&!window.confirm("You have unsaved changes. Discard?")||me(ve)},[oe,me]);v.useEffect(()=>()=>{var ve;(ve=te.current)==null||ve.abort()},[]);const{metadata:xe,body:ke}=tS(f),ce=xe["allowed-tools"],je=Array.isArray(ce)?ce:typeof ce=="string"?[ce]:[],Ue=xe.name,Le=xe.description,ae=xe.metadata,Z=typeof ae=="object"&&!Array.isArray(ae)?ae:null,se=xe.version||(Z==null?void 0:Z.version),ue=xe.tags||(Z==null?void 0:Z.tags),ge=Array.isArray(ue)?ue:typeof ue=="string"?ue.split(",").map(ve=>ve.trim()).filter(Boolean):[],Oe=new Set(["name","description","metadata","allowed-tools","version","tags"]),Me=Object.entries(xe).filter(([ve])=>!Oe.has(ve)),dt=v.useCallback(async()=>{S(!0),await i(),S(!1)},[i]),Zt=v.useCallback(ve=>{(ve.ctrlKey||ve.metaKey)&&ve.key==="s"&&(ve.preventDefault(),ve.stopPropagation(),h&&dt()),(ve.ctrlKey||ve.metaKey)&&ve.key==="k"&&(ve.preventDefault(),ve.stopPropagation(),r({type:m?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,dt,m,r]),ct=v.useCallback(async()=>{var Rt,ze;if(!k.trim())return;(Rt=te.current)==null||Rt.abort();const ve=new AbortController;te.current=ve,V(!0),Y(null),I([]),U(null),L([]);try{const xt=(q==null?void 0:q.provider)||"claude-cli",Wt=(q==null?void 0:q.model)||"sonnet",nt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:k,provider:xt,model:Wt}),signal:ve.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const Bn=await nt.json();Bn.error&&(bt=Bn.error)}catch{}throw new Error(bt)}const Qa=nt.body.getReader(),Zn=new TextDecoder;let Ct="",St="";for(;;){const{done:bt,value:Bn}=await Qa.read();if(bt)break;Ct+=Zn.decode(Bn,{stream:!0});const Za=Ct.split(`
|
|
66
|
+
`);if(i.length>1e3||o.length>1e3)return[...i.map(y=>({type:"unchanged",content:y}))];const u=i.length,p=o.length,f=Array.from({length:u+1},()=>new Array(p+1).fill(0));for(let y=1;y<=u;y++)for(let g=1;g<=p;g++)i[y-1]===o[g-1]?f[y][g]=f[y-1][g-1]+1:f[y][g]=Math.max(f[y-1][g],f[y][g-1]);const h=[];let x=u,m=p;for(;x>0||m>0;)x>0&&m>0&&i[x-1]===o[m-1]?(h.push({type:"unchanged",content:i[x-1]}),x--,m--):m>0&&(x===0||f[x][m-1]>=f[x-1][m])?(h.push({type:"added",content:o[m-1]}),m--):(h.push({type:"removed",content:i[x-1]}),x--);return h.reverse()}function aS(a,r){if(r&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(a))return n.jsx("div",{className:"spinner",style:{width:10,height:10,flexShrink:0}});const o=new Set(["generating","comparing","preparing","generating_skill","generating_baseline","scoring","action_items"]);return n.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:o.has(a)?"var(--accent)":"var(--green)"}})}function Ds({entries:a,isRunning:r}){const[i,o]=v.useState(!1),u=v.useRef(null);return v.useEffect(()=>{u.current&&!i&&(u.current.scrollTop=u.current.scrollHeight)},[a,i]),a.length===0&&!r?null:n.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("button",{onClick:()=>o(!i),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:p=>{p.currentTarget.style.color="var(--text-primary)"},onMouseLeave:p=>{p.currentTarget.style.color="var(--text-tertiary)"},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[r&&n.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",a.length,")"]}),n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:i?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!i&&n.jsx("div",{ref:u,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:a.map((p,f)=>{const h=f===a.length-1&&r,x=f===0?"0s":`+${((p.timestamp-a[0].timestamp)/1e3).toFixed(1)}s`;return n.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:h?1:.7},children:[aS(p.phase,h),n.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:x}),n.jsx("span",{style:{color:h?"var(--text-primary)":"var(--text-secondary)"},children:p.message}),p.current!=null&&p.total!=null&&n.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",p.current,"/",p.total,"]"]})]},f)})})]})}function lS({plugin:a,skill:r,skillContent:i,onApplied:o}){const[u,p]=v.useState("closed"),{config:f}=bl(),[h,x]=v.useState("claude-cli"),[m,y]=v.useState("opus"),[g,j]=v.useState([]),[S,N]=v.useState(""),[L,T]=v.useState(""),[k,M]=v.useState(null),[O,V]=v.useState(null),[A,U]=v.useState([]),[w,D]=v.useState(!1),R=v.useRef(null);v.useEffect(()=>{if(!f)return;f.providers.find(B=>B.id==="claude-cli"&&B.available)&&(x("claude-cli"),y("opus"))},[f]),v.useEffect(()=>()=>{var E;(E=R.current)==null||E.abort()},[]);function I(){return f==null?void 0:f.providers.find(E=>E.id===h&&E.available)}const G=v.useCallback(()=>{var E;(E=R.current)==null||E.abort(),p("open")},[]);async function q(){p("loading"),M(null),V(null),U([]);const E=new AbortController;R.current=E;try{const B=await fetch(`/api/skills/${encodeURIComponent(a)}/${encodeURIComponent(r)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:h,model:m}),signal:E.signal});if(!B.ok||!B.body){let W=`HTTP ${B.status}`;try{const oe=await B.json();oe.error&&(W=oe.error)}catch{}throw new Error(W)}const ne=B.body.getReader(),Y=new TextDecoder;let me="",_="";for(;;){const{done:W,value:oe}=await ne.read();if(W)break;me+=Y.decode(oe,{stream:!0});const fe=me.split(`
|
|
67
|
+
`);me=fe.pop()||"";for(const he of fe)if(he.startsWith("event: "))_=he.slice(7).trim();else if(he.startsWith("data: ")){try{const xe=JSON.parse(he.slice(6));_==="progress"?U(ke=>[...ke,{phase:xe.phase,message:xe.message,timestamp:Date.now()}]):_==="done"||_==="complete"?(N(xe.improved),T(xe.reasoning||""),j(jo(xe.original||i,xe.improved)),p("diff_shown")):_==="error"&&(M(xe.message||xe.description||"Unknown error"),xe.category&&V(xe),p("open"))}catch{}_=""}}}catch(B){B.name!=="AbortError"&&(M(B.message),p("open"))}finally{R.current=null}}async function te(){D(!0);try{await Ne.applyImprovement(a,r,S),o(S),p("closed")}catch(E){M(E.message)}finally{D(!1)}}function Q(){p("closed"),j([]),N(""),T(""),M(null)}if(u==="closed")return n.jsxs("button",{onClick:()=>p("open"),className:"btn btn-secondary mb-5",disabled:!i,children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const z=I();return n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),n.jsx("button",{onClick:Q,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:E=>{E.currentTarget.style.background="var(--surface-3)"},onMouseLeave:E=>{E.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-5 py-4",children:[(u==="open"||u==="loading")&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),n.jsx("select",{className:"input-field text-[12px] py-1.5",value:h,onChange:E=>{x(E.target.value);const B=f==null?void 0:f.providers.find(ne=>ne.id===E.target.value);B!=null&&B.models[0]&&y(B.models[0].id)},disabled:u==="loading",children:f==null?void 0:f.providers.filter(E=>E.available).map(E=>n.jsx("option",{value:E.id,children:E.label},E.id))})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsx("select",{className:"input-field text-[12px] py-1.5",value:m,onChange:E=>y(E.target.value),disabled:u==="loading",children:z==null?void 0:z.models.map(E=>n.jsx("option",{value:E.id,children:E.label},E.id))})]}),u==="loading"?n.jsx("button",{onClick:G,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):n.jsx("button",{onClick:q,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),u==="loading"&&A.length>0&&n.jsx("div",{className:"mt-3",children:n.jsx(Ds,{entries:A,isRunning:!0})})]}),k&&n.jsx("div",{className:"mb-4",children:O?n.jsx(Ls,{error:O,onRetry:q,onDismiss:()=>{M(null),V(null)}}):n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:k})}),u==="diff_shown"&&n.jsxs(n.Fragment,{children:[L&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),L]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:g.map((E,B)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:E.type==="added"?"rgba(34,197,94,0.1)":E.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:E.type==="added"?"var(--green)":E.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:E.type==="added"?"3px solid var(--green)":E.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:E.type==="added"?"+":E.type==="removed"?"-":" "}),E.content]},B))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:te,disabled:w,className:"btn btn-primary",children:w?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),n.jsx("button",{onClick:Q,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const $x={remove:{bg:"var(--red-muted)",color:"var(--red)",label:"REMOVE"},modify:{bg:"rgba(251,191,36,0.15)",color:"#fbbf24",label:"MODIFY"},add:{bg:"var(--green-muted)",color:"var(--green)",label:"ADD"}},rS={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function sS({change:a,index:r,selected:i,onToggle:o,originalEval:u}){var g;const[p,f]=v.useState(!1),h=$x[a.action]??$x.add,x=rS[a.action]??"var(--border-subtle)",m=a.action==="remove"?(u==null?void 0:u.name)??`Eval #${a.evalId}`:((g=a.eval)==null?void 0:g.name)??"Unnamed",y=v.useCallback(()=>o(r),[o,r]);return n.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${x}`,opacity:i?1:.5},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[n.jsx("input",{type:"checkbox",checked:i,onChange:y,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),n.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:h.bg,color:h.color,padding:"1px 6px"},children:h.label}),n.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:m}),n.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:a.reason}),n.jsx("button",{onClick:()=>f(!p),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:j=>{j.currentTarget.style.background="var(--surface-3)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},children:n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:p?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),p&&n.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.action==="add"&&a.eval&&n.jsx(iS,{evalCase:a.eval}),a.action==="modify"&&a.eval&&u&&n.jsx(oS,{original:u,proposed:a.eval}),a.action==="remove"&&u&&n.jsx(cS,{evalCase:u})]})]})}function iS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[n.jsx(bd,{label:"Prompt",value:a.prompt}),n.jsx(bd,{label:"Expected",value:a.expected_output}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-1",children:(a.assertions??[]).map(i=>n.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[n.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",i.text]},i.id))})]})]})}function oS({original:a,proposed:r}){const i=[];a.name!==r.name&&i.push({label:"Name",old:a.name,new:r.name}),a.prompt!==r.prompt&&i.push({label:"Prompt",old:a.prompt,new:r.prompt}),a.expected_output!==r.expected_output&&i.push({label:"Expected",old:a.expected_output,new:r.expected_output});const o=a.assertions??[],u=r.assertions??[],p=new Set(o.map(m=>m.text)),f=new Set(u.map(m=>m.text)),h=u.filter(m=>!p.has(m.text)),x=o.filter(m=>!f.has(m.text));return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[i.map(m=>n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:m.label}),n.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[n.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",jd(m.old,120)]}),n.jsxs("div",{style:{color:"var(--green)"},children:["+ ",jd(m.new,120)]})]})]},m.label)),(h.length>0||x.length>0)&&n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),n.jsxs("div",{className:"mt-1 space-y-0.5",children:[x.map(m=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",m.text]},m.id)),h.map(m=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",m.text]},m.id))]})]}),i.length===0&&h.length===0&&x.length===0&&n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function cS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[n.jsx(bd,{label:"Prompt",value:a.prompt}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-0.5",children:(a.assertions??[]).map(i=>n.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:i.text},i.id))})]})]})}function bd({label:a,value:r}){return n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),n.jsx("div",{className:"mt-0.5 text-[11px] p-2 rounded font-mono",style:{background:"var(--surface-1)",color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:jd(r,300)})]})}function jd(a,r){return a.length>r?a.slice(0,r)+"...":a}const Gx={remove:0,modify:1,add:2};function uS({changes:a,selections:r,currentEvals:i,onToggle:o,onSelectAll:u,onDeselectAll:p}){if(a.length===0)return null;const f=a.map((x,m)=>({change:x,originalIndex:m}));f.sort((x,m)=>(Gx[x.change.action]??2)-(Gx[m.change.action]??2));const h=Array.from(r.values()).filter(Boolean).length;return n.jsxs("div",{className:"mt-3 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",h,"/",a.length," selected)"]})]}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("button",{onClick:u,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Select All"}),n.jsx("button",{onClick:p,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--surface-3)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),n.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:f.map(({change:x,originalIndex:m})=>n.jsx(sS,{change:x,index:m,selected:r.get(m)??!1,onToggle:o,originalEval:x.evalId!=null?i.find(y=>y.id===x.evalId):void 0},m))})]})}function dS(){var E;const{state:a,dispatch:r,submitAiEdit:i,applyAiEdit:o,discardAiEdit:u,cancelAiEdit:p,toggleEvalChange:f,selectAllEvalChanges:h,deselectAllEvalChanges:x,retryEvalsSave:m}=kn(),{aiEditLoading:y,aiEditResult:g,aiEditError:j,aiEditClassifiedError:S,aiEditProgress:N,aiEditEvalChanges:L,aiEditEvalSelections:T,aiEditEvalsRetry:k}=a,[M,O]=v.useState(""),{config:V}=bl(),[A,U]=v.useState("claude-cli"),[w,D]=v.useState("opus"),R=v.useRef(null);v.useEffect(()=>{var B;(B=R.current)==null||B.focus()},[]),v.useEffect(()=>{if(!V)return;V.providers.find(ne=>ne.id==="claude-cli"&&ne.available)&&(U("claude-cli"),D("opus"))},[V]);const I=V==null?void 0:V.providers.find(B=>B.id===A&&B.available),G=v.useCallback(()=>{const B=M.trim();!B||y||i(B,A,w)},[M,y,i,A,w]),q=v.useCallback(B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),G()),B.key==="Escape"&&(B.preventDefault(),y?p():u())},[G,y,p,u]),te=v.useCallback(()=>{r({type:"CLOSE_AI_EDIT"}),r({type:"OPEN_AI_EDIT"})},[r]),Q=g?jo(a.skillContent,g.improved):[],z=((E=a.evals)==null?void 0:E.evals)??[];return n.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-2)"},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M15 4V2"}),n.jsx("path",{d:"M15 16v-2"}),n.jsx("path",{d:"M8 9h2"}),n.jsx("path",{d:"M20 9h2"}),n.jsx("path",{d:"M17.8 11.8L19 13"}),n.jsx("path",{d:"M15 9h.01"}),n.jsx("path",{d:"M17.8 6.2L19 5"}),n.jsx("path",{d:"M11 6.2L9.7 5"}),n.jsx("path",{d:"M3 21l9-9"})]})}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),n.jsx("button",{onClick:u,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:B=>{B.currentTarget.style.background="var(--surface-3)"},onMouseLeave:B=>{B.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-4 py-3",children:[!g&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-end gap-2.5",children:[n.jsx("div",{className:"flex-1",children:n.jsx("textarea",{ref:R,value:M,onChange:B=>O(B.target.value),onKeyDown:q,placeholder:"e.g., Add an error handling section...",disabled:y,rows:1,className:"w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 12px",fontSize:12.5,lineHeight:1.5,fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",minHeight:36,maxHeight:96},onInput:B=>{const ne=B.currentTarget;ne.style.height="auto",ne.style.height=Math.min(ne.scrollHeight,96)+"px"}})}),n.jsxs("div",{style:{minWidth:100},children:[n.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),n.jsx("select",{className:"input-field text-[11px] py-1",value:A,onChange:B=>{U(B.target.value);const ne=V==null?void 0:V.providers.find(Y=>Y.id===B.target.value);ne!=null&&ne.models[0]&&D(ne.models[0].id)},disabled:y,style:{width:"100%"},children:V==null?void 0:V.providers.filter(B=>B.available).map(B=>n.jsx("option",{value:B.id,children:B.label},B.id))})]}),n.jsxs("div",{style:{minWidth:80},children:[n.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsx("select",{className:"input-field text-[11px] py-1",value:w,onChange:B=>D(B.target.value),disabled:y,style:{width:"100%"},children:I==null?void 0:I.models.map(B=>n.jsx("option",{value:B.id,children:B.label},B.id))})]}),y?n.jsx("button",{onClick:p,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):n.jsx("button",{onClick:G,disabled:!M.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),y&&N.length>0&&n.jsx("div",{className:"mt-2.5",children:n.jsx(Ds,{entries:N,isRunning:!0})})]}),j&&n.jsx("div",{className:"mt-3",children:S?n.jsx(Ls,{error:S,onRetry:te,onDismiss:u}):n.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j})}),g&&n.jsxs("div",{className:"animate-fade-in",children:[g.reasoning&&n.jsxs("div",{className:"mb-3 px-3 py-2.5 rounded-lg text-[11.5px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),g.reasoning]}),n.jsx("div",{className:"mb-1",children:n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:Q.map((B,ne)=>n.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:B.type==="added"?"rgba(34,197,94,0.1)":B.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:B.type==="added"?"var(--green)":B.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:B.type==="added"?"3px solid var(--green)":B.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:B.type==="added"?"+":B.type==="removed"?"-":" "}),B.content]},ne))}),n.jsx(uS,{changes:L,selections:T,currentEvals:z,onToggle:f,onSelectAll:h,onDeselectAll:x}),k&&n.jsxs("div",{className:"mt-3 px-3 py-2.5 rounded-lg text-[12px] flex items-center justify-between",style:{background:"rgba(251,191,36,0.12)",border:"1px solid rgba(251,191,36,0.3)",color:"#fbbf24"},children:[n.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),n.jsx("button",{onClick:m,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),n.jsxs("div",{className:"flex gap-2 mt-3",children:[n.jsxs("button",{onClick:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[n.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),n.jsx("button",{onClick:u,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),n.jsx("button",{onClick:te,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function fS(a,r){const[i,o]=v.useState([]),[u,p]=v.useState("SKILL.md"),[f,h]=v.useState(null),[x,m]=v.useState(!1),[y,g]=v.useState(null),j=v.useCallback(async()=>{try{const L=await Ne.getSkillFiles(a,r);o(L.files)}catch{o([])}},[a,r]);v.useEffect(()=>{p("SKILL.md"),h(null),g(null),j()},[a,r,j]);const S=v.useCallback(async L=>{if(p(L),L==="SKILL.md"){h(null),g(null);return}m(!0),g(null);try{const T=await Ne.getSkillFile(a,r,L);h(T)}catch(T){g(`Unable to open file: ${T.message}`),h(null)}finally{m(!1)}},[a,r]),N=v.useCallback(()=>{j()},[j]);return{files:i,activeFile:u,secondaryContent:f,loading:x,error:y,selectFile:S,refresh:N,isSkillMd:u==="SKILL.md"}}function pS(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function mS(a){const r=[],i=new Map;for(const o of a){const u=o.path.split("/"),f={name:u[u.length-1],path:o.path,type:o.type,size:o.size,children:[]};i.set(o.path,f)}for(const o of a){const u=o.path.split("/");if(u.length===1){const p=i.get(o.path);p&&r.push(p)}else{const p=u.slice(0,-1).join("/"),f=i.get(p),h=i.get(o.path);f&&h&&f.children.push(h)}}return r}function ag({expanded:a}){return n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function lg(){return n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function hS(){return n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function xS(){return n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"23 4 23 10 17 10"}),n.jsx("polyline",{points:"1 20 1 14 7 14"}),n.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}function rg({node:a,depth:r,activeFile:i,onSelect:o}){const[u,p]=v.useState(!0),f=a.path===i;return a.type==="dir"?n.jsxs("div",{children:[n.jsxs("button",{onClick:()=>p(!u),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*14}px`,paddingTop:2,paddingBottom:2,background:"none",border:"none",cursor:"pointer",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left"},children:[n.jsx(ag,{expanded:u}),n.jsx(lg,{}),n.jsxs("span",{children:[a.name,"/"]})]}),u&&a.children.map(h=>n.jsx(rg,{node:h,depth:r+1,activeFile:i,onSelect:o},h.path))]}):n.jsxs("button",{onClick:()=>o(a.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*14}px`,paddingTop:2,paddingBottom:2,background:f?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:f?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[n.jsx("span",{style:{width:10}}),n.jsx(hS,{}),n.jsx("span",{style:{flex:1},children:a.name}),n.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:pS(a.size)})]})}function vS({files:a,activeFile:r,onSelect:i,onRefresh:o}){const[u,p]=v.useState(!1),f=v.useMemo(()=>mS(a),[a]);return n.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>p(!u),children:[n.jsx(ag,{expanded:u}),n.jsx(lg,{}),n.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),n.jsx("button",{onClick:h=>{h.stopPropagation(),o()},style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:"2px 4px",display:"flex",alignItems:"center",borderRadius:3},title:"Refresh file list",children:n.jsx(xS,{})})]}),u&&n.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:f.length===0?n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):f.map(h=>n.jsx(rg,{node:h,depth:0,activeFile:r,onSelect:i},h.path))})]})}function Ki(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function gS(a){try{return JSON.stringify(JSON.parse(a),null,2)}catch{return a}}function yS(a){const r=a.toLowerCase();return r.endsWith(".json")?"json":r.endsWith(".md")?"md":"other"}function Px({content:a}){return n.jsx("textarea",{readOnly:!0,value:a,style:{flex:1,width:"100%",resize:"none",background:"var(--surface-1)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}})}function qx({content:a,fileType:r}){if(r==="json"){const i=gS(a);return n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i})}return r==="md"?n.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px 20px",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:13,lineHeight:1.6},dangerouslySetInnerHTML:{__html:bo(a)}}):n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})}function Yx(a){try{return JSON.stringify(JSON.parse(a),null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"\\]|\\.)*"\s*:/g,i=>`<span style="color:#6383ff">${i}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,i=>`<span style="color:#22c55e">${i.slice(0,2)}<span style="color:#22c55e">${i.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(i,o)=>`: <span style="color:#fb923c">${o}</span>`).replace(/:\s*(true|false|null)/g,(i,o)=>`: <span style="color:#a855f7">${o}</span>`)}catch{return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}}function bS({file:a,loading:r,error:i,viewMode:o,plugin:u,skill:p,onSaved:f,onDirtyChange:h}){const[x,m]=v.useState(o),[y,g]=v.useState(!1),[j,S]=v.useState(""),[N,L]=v.useState(!1),[T,k]=v.useState(null),M=o!==x?o:x;v.useEffect(()=>{h==null||h(y)},[y,h]);const O=v.useCallback(()=>{(a==null?void 0:a.content)!=null&&(S(a.content),g(!0))},[a]),V=v.useCallback(()=>{g(!1)},[]),A=v.useCallback(async()=>{if(!(!u||!p||!a)){L(!0);try{await Ne.saveSkillFile(u,p,a.path,j),k("Saved"),g(!1),f==null||f(),setTimeout(()=>k(null),2e3)}catch(D){k(`Save failed: ${D.message}`),setTimeout(()=>k(null),3e3)}finally{L(!1)}}},[u,p,a,j,f]);if(v.useEffect(()=>{if(!y)return;const D=R=>{(R.ctrlKey||R.metaKey)&&R.key==="s"&&(R.preventDefault(),A())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[y,A]),r)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(i)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:n.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[n.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),n.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:i})]})});if(!a)return null;if(a.binary)return n.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",Ki(a.size),") — cannot be displayed"]});const U=a.content??"",w=yS(a.path);return n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[a.truncated&&n.jsxs("div",{style:{padding:"4px 12px",background:"var(--warning-muted, #fef3c7)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:"var(--warning-text, #92400e)"},children:["File truncated at ",Ki(512*1024)," — ",Ki(a.size)," total"]}),n.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(w==="md"||w==="json")&&["raw","split","preview"].map(D=>n.jsx("button",{onClick:()=>m(D),style:{padding:"2px 8px",fontSize:11,background:M===D?"var(--accent-muted)":"none",color:M===D?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:D},D)),n.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[Ki(a.size),u&&p&&!a.binary&&!y&&n.jsx("button",{onClick:O,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:A,disabled:N,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:N?.6:1},children:N?"Saving...":"Save"}),n.jsx("button",{onClick:V,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),T&&n.jsx("div",{style:{padding:"4px 12px",background:T.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:T.startsWith("Save failed")?"var(--red)":"var(--green)"},children:T}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:y?n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[n.jsx("textarea",{value:j,onChange:D=>S(D.target.value),style:{flex:1,width:"100%",resize:"none",background:"var(--surface-0)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}}),n.jsxs("div",{style:{position:"sticky",bottom:0,display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),n.jsx("button",{onClick:A,disabled:N,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:N?.6:1},children:N?"Saving...":"Save"}),n.jsx("button",{onClick:V,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):M==="split"&&w!=="other"?n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:n.jsx(Px,{content:U})}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:w==="json"?n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Yx(U)}}):n.jsx(qx,{content:U,fileType:w})})]}):M==="preview"&&w!=="other"?w==="json"?n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Yx(U)}}):n.jsx(qx,{content:U,fileType:w}):n.jsx(Px,{content:U})})]})}function jS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function SS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),n.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function kS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function wS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M15 4V2"}),n.jsx("path",{d:"M15 16v-2"}),n.jsx("path",{d:"M8 9h2"}),n.jsx("path",{d:"M20 9h2"}),n.jsx("path",{d:"M17.8 11.8L19 13"}),n.jsx("path",{d:"M15 9h.01"}),n.jsx("path",{d:"M17.8 6.2L19 5"}),n.jsx("path",{d:"M11 6.2L9.7 5"}),n.jsx("path",{d:"M3 21l9-9"})]})}function Xu({size:a=15}){return n.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function CS(){const{state:a,dispatch:r,saveContent:i,isReadOnly:o}=kn(),{plugin:u,skill:p,skillContent:f,isDirty:h,improveTarget:x,aiEditOpen:m}=a,[y,g]=v.useState("split"),[j,S]=v.useState(!1),N=v.useRef(null),[L,T]=v.useState(!1),[k,M]=v.useState(""),[O,V]=v.useState(!1),[A,U]=v.useState(null),[w,D]=v.useState([]),[R,I]=v.useState([]),[G,q]=v.useState(null),te=v.useRef(null),{config:Q}=bl(),{files:z,activeFile:E,secondaryContent:B,loading:ne,error:Y,selectFile:me,refresh:_,isSkillMd:W}=fS(u??"",p??""),[oe,fe]=v.useState(!1),he=v.useCallback(ve=>{oe&&!window.confirm("You have unsaved changes. Discard?")||me(ve)},[oe,me]);v.useEffect(()=>()=>{var ve;(ve=te.current)==null||ve.abort()},[]);const{metadata:xe,body:ke}=tS(f),ce=xe["allowed-tools"],je=Array.isArray(ce)?ce:typeof ce=="string"?[ce]:[],Ue=xe.name,Le=xe.description,ae=xe.metadata,Z=typeof ae=="object"&&!Array.isArray(ae)?ae:null,se=xe.version||(Z==null?void 0:Z.version),ue=xe.tags||(Z==null?void 0:Z.tags),ge=Array.isArray(ue)?ue:typeof ue=="string"?ue.split(",").map(ve=>ve.trim()).filter(Boolean):[],Oe=new Set(["name","description","metadata","allowed-tools","version","tags"]),Me=Object.entries(xe).filter(([ve])=>!Oe.has(ve)),dt=v.useCallback(async()=>{S(!0),await i(),S(!1)},[i]),Zt=v.useCallback(ve=>{(ve.ctrlKey||ve.metaKey)&&ve.key==="s"&&(ve.preventDefault(),ve.stopPropagation(),h&&dt()),(ve.ctrlKey||ve.metaKey)&&ve.key==="k"&&(ve.preventDefault(),ve.stopPropagation(),r({type:m?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,dt,m,r]),ct=v.useCallback(async()=>{var Rt,ze;if(!k.trim())return;(Rt=te.current)==null||Rt.abort();const ve=new AbortController;te.current=ve,V(!0),q(null),I([]),U(null),D([]);try{const xt=(Q==null?void 0:Q.provider)||"claude-cli",Wt=(Q==null?void 0:Q.model)||"sonnet",nt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:k,provider:xt,model:Wt}),signal:ve.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const Bn=await nt.json();Bn.error&&(bt=Bn.error)}catch{}throw new Error(bt)}const Qa=nt.body.getReader(),Zn=new TextDecoder;let Ct="",St="";for(;;){const{done:bt,value:Bn}=await Qa.read();if(bt)break;Ct+=Zn.decode(Bn,{stream:!0});const Za=Ct.split(`
|
|
68
68
|
`);Ct=Za.pop()||"";for(const In of Za)if(In.startsWith("event: "))St=In.slice(7).trim();else if(In.startsWith("data: ")){try{const Ve=JSON.parse(In.slice(6));if(St==="progress")I(It=>[...It,{phase:Ve.phase,message:Ve.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const It=["---"];Ve.name&&It.push(`name: ${Ve.name}`),Ve.description&&It.push(`description: "${Ve.description.replace(/"/g,'\\"')}"`),Ve.model&&It.push(`model: ${Ve.model}`),(ze=Ve.allowedTools)!=null&&ze.trim()&&It.push(`allowed-tools: ${Ve.allowedTools.trim()}`),It.push("---","",Ve.body||"");const Jn=It.join(`
|
|
69
|
-
`);U(Jn),L(jo(f,Jn)),V(!1)}else St==="error"&&(Y(Ve.message||Ve.description||"Generation failed"),V(!1))}catch{}St=""}}}catch(xt){xt.name!=="AbortError"&&Y(xt.message)}finally{V(!1),te.current=null}},[k,q,f]),Vt=v.useCallback(()=>{A&&r({type:"SET_CONTENT",content:A}),T(!1),U(null),L([]),M(""),I([])},[A,r]),$t=v.useCallback(()=>{T(!1),U(null),L([]),M(""),I([]),Y(null)},[]),tt=v.useCallback(()=>{var ve;z?((ve=te.current)==null||ve.abort(),$t()):(m&&r({type:"CLOSE_AI_EDIT"}),T(!0))},[z,m,r,$t]),jt=[{mode:"raw",icon:n.jsx(jS,{}),label:"Editor"},{mode:"split",icon:n.jsx(SS,{}),label:"Split"},{mode:"preview",icon:n.jsx(kS,{}),label:"Preview"}];return n.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Zt,tabIndex:-1,children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:jt.map(({mode:ve,icon:Rt,label:ze})=>n.jsxs("button",{onClick:()=>g(ve),title:ze,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:y===ve?"var(--surface-4)":"transparent",color:y===ve?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:y===ve?600:400,border:"none",cursor:"pointer"},children:[Rt,n.jsx("span",{style:{letterSpacing:"0.01em"},children:ze})]},ve))}),K?o?n.jsx("div",{className:"flex items-center gap-2",children:n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{m?r({type:"CLOSE_AI_EDIT"}):(z&&$t(),r({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:m?600:400,border:"none",cursor:"pointer",color:m?"var(--purple)":"var(--text-tertiary)",background:m?"var(--purple-muted)":"transparent"},children:[n.jsx(wS,{size:13}),n.jsx("span",{children:"AI Edit"})]}),n.jsxs("button",{onClick:tt,title:"Regenerate skill from prompt",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:z?600:400,border:"none",cursor:"pointer",color:z?"var(--purple)":"var(--text-tertiary)",background:z?"var(--purple-muted)":"transparent"},children:[n.jsx(Xu,{size:13}),n.jsx("span",{children:"Regenerate"})]}),n.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),h&&n.jsx("button",{onClick:()=>r({type:"SET_CONTENT",content:a.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),n.jsx("button",{onClick:dt,disabled:!h||j,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:j?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),u&&p&&n.jsx(vS,{files:_,activeFile:E,onSelect:he,onRefresh:D}),!K&&n.jsx(bS,{file:B,loading:ne,error:F,viewMode:y,plugin:u??void 0,skill:p??void 0,onSaved:()=>{me(E),D()},onDirtyChange:fe}),K&&n.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:y==="raw"||y==="preview"?"1fr":"1fr 1fr"},children:[y!=="preview"&&n.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:y==="split"?"1px solid var(--border-subtle)":"none"},children:n.jsx("textarea",{ref:N,value:f,onChange:ve=>{o||r({type:"SET_CONTENT",content:ve.target.value})},onKeyDown:Zt,spellCheck:!1,readOnly:o,className:"flex-1 w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",fontSize:12.5,lineHeight:1.7,tabSize:2,border:"none",padding:"16px 20px",opacity:o?.7:1}})}),y!=="raw"&&n.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(Ue||se||Le)&&n.jsxs("div",{style:{marginBottom:20},children:[n.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[Ue&&n.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:Ue}),se&&n.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4,letterSpacing:"0.03em",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:["v",se]})]}),Le&&n.jsx("p",{style:{fontSize:12.5,lineHeight:1.65,color:"var(--text-secondary)",margin:0,paddingLeft:12,borderLeft:"2px solid var(--accent)",maxWidth:600},children:Le})]}),ge.length>0&&n.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ge.map(ve=>n.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:ve},ve))}),je.length>0&&n.jsx("div",{style:{marginBottom:16},children:n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),je.map(ve=>n.jsx("span",{style:{fontSize:10.5,fontFamily:"var(--font-mono, ui-monospace, monospace)",color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4},children:ve},ve))]})}),Me.length>0&&n.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:Me.map(([ve,Rt],ze)=>{const xt=Array.isArray(Rt)?Rt.join(", "):typeof Rt=="object"?Object.entries(Rt).map(([Wt,nt])=>`${Wt}: ${Array.isArray(nt)?nt.join(", "):nt}`).join(" | "):Rt;return n.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:ze>0?"1px solid var(--border-subtle)":"none"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:ve}),n.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:xt})]},ve)})}),(Ue||Le||ge.length>0||je.length>0||Me.length>0)&&ke&&n.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),ke&&n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:bo(ke)}})]})})]}),K&&m&&n.jsx(dS,{}),K&&z&&n.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:n.jsxs("div",{className:"px-4 py-3",children:[!A&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Xu,{size:14}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),n.jsx("div",{className:"flex gap-2 mb-2",children:n.jsx("textarea",{value:k,onChange:ve=>M(ve.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:O,className:"flex-1 px-3 py-2 rounded-lg text-[12px] resize-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",outline:"none",opacity:O?.5:1},onKeyDown:ve=>{ve.key==="Enter"&&(ve.ctrlKey||ve.metaKey)&&k.trim()&&!O&&(ve.preventDefault(),ct())}})}),n.jsxs("div",{className:"flex items-center gap-2",children:[O?n.jsx("button",{onClick:()=>{var ve;(ve=te.current)==null||ve.abort(),V(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):n.jsx("button",{onClick:ct,disabled:!k.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),n.jsx("button",{onClick:$t,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),O&&R.length>0&&n.jsx("div",{className:"mt-2",children:n.jsx(Ds,{entries:R,isRunning:!0})}),G&&n.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[G,n.jsx("button",{onClick:ct,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),A&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Xu,{size:14}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:w.map((ve,Rt)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:ve.type==="added"?"var(--green-muted)":ve.type==="removed"?"var(--red-muted)":"transparent",color:ve.type==="added"?"var(--green)":ve.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:ve.type==="added"?"3px solid var(--green)":ve.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ve.type==="added"?"+":ve.type==="removed"?"-":" "}),ve.content]},Rt))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{onClick:Vt,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),n.jsx("button",{onClick:$t,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),K&&x!==null&&u&&p&&n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(lS,{plugin:u,skill:p,skillContent:f,onApplied:ve=>{r({type:"SET_CONTENT",content:ve}),r({type:"CONTENT_SAVED"}),r({type:"CLOSE_IMPROVE"})}})})]})}function or(a){return a.testType==="integration"?"integration":"unit"}function mr(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function sg(a){const r=new Date(a);return r.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function ig(a){return a==null?"--":a>=1e3?`${(a/1e3).toFixed(1)}s`:`${a}ms`}const NS=new Set(["benchmark","comparison","baseline"]);function Yx(a,r,i,o){return a.map(({rate:u,idx:p,total:f})=>{const h=o+p/(f-1)*(r-o*2),x=o+(i-o*2)-u*(i-o*2);return`${h},${x}`})}function og({entries:a}){const r=a.filter(g=>NS.has(g.type)).slice().reverse(),i=r.map((g,j,S)=>({rate:g.pass_rate,idx:j,total:S.length})).filter((g,j)=>{const S=r[j].type;return S==="benchmark"||S==="comparison"}),o=r.flatMap((g,j)=>g.type==="baseline"?[{rate:g.pass_rate,idx:j,total:r.length}]:g.type==="comparison"&&g.baselinePassRate!=null?[{rate:g.baselinePassRate,idx:j,total:r.length}]:[]);if(i.length<2&&o.length<2)return null;const u=80,p=24,f=2,h=i.length>=2?Yx(i,u,p,f):[],x=o.length>=2?Yx(o,u,p,f):[],m=h[h.length-1],y=x[x.length-1];return n.jsxs("svg",{width:u,height:p,style:{display:"block",flexShrink:0},children:[x.length>0&&n.jsx("polyline",{points:x.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),h.length>0&&n.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),y&&n.jsx("circle",{cx:parseFloat(y.split(",")[0]),cy:parseFloat(y.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),m&&n.jsx("circle",{cx:parseFloat(m.split(",")[0]),cy:parseFloat(m.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function cg(a,r,i){const o=isNaN(r)?0:r,u=[],p=[],f=[];if((a==="PASS"||a==="EFFECTIVE")&&o>=.7){const m=u.length>0?` Met criteria: ${u.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): evaluation met expectations.${m}`}}if(a==="FAIL"||a==="DEGRADING"){const m=p.length>0?` Failed criteria: ${p.map(g=>g.criterion).join(", ")}.`:"",y=[...p.map(g=>`Improve "${g.criterion}" (score: ${g.score.toFixed(2)})`),...f.map(g=>`Strengthen "${g.criterion}" (score: ${g.score.toFixed(2)})`)];return y.length===0&&y.push("Review prompt instructions and add more specific guidance"),{explanation:`${a} (score ${o.toFixed(2)}): evaluation did not meet expectations.${m}`,recommendations:y}}if(a==="INEFFECTIVE"){if(o<.2){const y=[...p.map(g=>`Rework "${g.criterion}" — currently at ${g.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${a} (score ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const m=[...p.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push("Consider restructuring your prompt approach"),{explanation:`${a} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:m}}if(a==="MARGINAL"){const m=[...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...p.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(u.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${a} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:m}}if(a==="EMERGING"){const m=[...p.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(u.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Add more specific guidance to your prompt instructions"),{explanation:`${a} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:m}}const h=u.length>0?` Passing: ${u.map(m=>m.criterion).join(", ")}.`:"",x=f.length>0?` Needs improvement: ${f.map(m=>m.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): mixed results.${h}${x}`}}const ug={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function ES(a){return Object.hasOwn(ug,a)}function TS(a){return ES(a)?ug[a]:a}function RS(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState([]),[p,f]=v.useState([]),[h,x]=v.useState(!0),[m,y]=v.useState(null),[g,j]=v.useState(new Set),[S,N]=v.useState({}),[z,T]=v.useState(null),[k,M]=v.useState(""),[O,V]=v.useState(!1),[A,U]=v.useState(""),[w,L]=v.useState(""),R=v.useCallback(async()=>{x(!0),y(null);try{const[_,E]=await Promise.all([Ne.getCredentials(r,i),Ne.getParams(r,i)]);u(_.credentials),f(E.params)}catch(_){y(_ instanceof Error?_.message:"Failed to load parameters"),u([]),f([])}finally{x(!1)}},[r,i]);v.useEffect(()=>{R()},[R]);const I=v.useCallback(async(_,E)=>{V(!0),y(null);try{await Ne.setCredential(r,i,_,E),T(null),M(""),await R()}catch(B){y(B instanceof Error?B.message:`Failed to save ${_}`)}finally{V(!1)}},[r,i,R]),G=v.useCallback(async()=>{const _=A.trim().toUpperCase(),E=w.trim();if(!(!_||!E)){V(!0),y(null);try{await Ne.setCredential(r,i,_,E),U(""),L(""),await R()}catch(B){y(B instanceof Error?B.message:`Failed to add ${_}`)}finally{V(!1)}}},[r,i,A,w,R]),Y=v.useCallback(async _=>{if(g.has(_)){j(E=>{const B=new Set(E);return B.delete(_),B}),N(E=>{const B={...E};return delete B[_],B});return}try{const B=(await Ne.getParamsRevealed(r,i,_)).params.find(ne=>ne.name===_);B!=null&&B.value&&(N(ne=>({...ne,[_]:B.value})),j(ne=>new Set(ne).add(_)))}catch{}},[r,i,g]),te=new Set(o.map(_=>_.name)),q=[...o.map(_=>{const E=p.find(B=>B.name===_.name);return{name:_.name,status:_.status,maskedValue:(E==null?void 0:E.maskedValue)??""}}),...p.filter(_=>!te.has(_.name)).map(_=>({name:_.name,status:_.status,maskedValue:_.maskedValue}))];return n.jsxs("div",{className:"py-2 px-3",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),m&&n.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},role:"alert",children:m}),h&&q.length===0&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&q.length===0&&!m&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),q.map(_=>n.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:_.name}),n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:_.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:_.status==="ready"?"var(--green)":"var(--red)"},children:_.status}),(_.maskedValue||_.status==="ready")&&n.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[g.has(_.name)?S[_.name]??_.maskedValue:_.maskedValue||"***",n.jsx("button",{onClick:()=>Y(_.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${g.has(_.name)?"Hide":"Reveal"} value for ${_.name}`,children:g.has(_.name)?"hide":"show"})]}),z===_.name?n.jsxs("div",{className:"flex gap-1",children:[n.jsx("input",{value:k,onChange:E=>M(E.target.value),onKeyDown:E=>{E.key==="Enter"&&k.trim()&&I(_.name,k)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${_.name}`,autoFocus:!0}),n.jsx("button",{onClick:()=>I(_.name,k),disabled:O||!k.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),n.jsx("button",{onClick:()=>{T(null),M("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):n.jsx("button",{onClick:()=>{T(_.name),M("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},_.name)),n.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:A,onChange:_=>U(_.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),n.jsx("input",{value:w,onChange:_=>L(_.target.value),onKeyDown:_=>{_.key==="Enter"&&A.trim()&&w.trim()&&G()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),n.jsx("button",{onClick:G,disabled:O||!A.trim()||!w.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:O?"not-allowed":"pointer"},children:"Add"})]})]})]})}function AS(a,r,i){const[o,u]=v.useState(null),[p,f]=v.useState(!1),h=v.useRef("");v.useEffect(()=>{const m=`${a}/${r}/${i}`;h.current!==m&&(h.current=m,f(!0),Ne.getCaseHistory(a,r,i).then(y=>u(y)).catch(()=>u([])).finally(()=>f(!1)))},[a,r,i]);const x=v.useCallback(()=>{f(!0),h.current="",Ne.getCaseHistory(a,r,i).then(m=>u(m)).catch(()=>u([])).finally(()=>f(!1))},[a,r,i]);return{entries:o,loading:p,refetch:x}}function MS(a,r,i){const o={flaky:!1,nonDiscriminating:!1,regression:!1};if(!i||i.length===0)return o;const p=i.slice(0,10).map(x=>x.assertions.find(m=>m.id===a)).filter(Boolean);if(p.length>=2){const m=p.filter(y=>y.pass).length/p.length;m>=.3&&m<=.7&&(o.flaky=!0)}const f=i.find(x=>x.type==="benchmark"),h=i.find(x=>x.type==="baseline");if(f&&h){const x=f.assertions.find(y=>y.id===a),m=h.assertions.find(y=>y.id===a);x!=null&&x.pass&&(m!=null&&m.pass)&&(o.nonDiscriminating=!0)}if(r&&!r.pass&&i.length>=1){const m=i[0].assertions.find(y=>y.id===a);m!=null&&m.pass&&(o.regression=!0)}return o}function zS(){var ne;const{state:a,dispatch:r,saveEvals:i,runCase:o,runAll:u,cancelCase:p,cancelAll:f,generateEvals:h,isReadOnly:x}=kn(),{evals:m,evalsError:y,selectedCaseId:g,inlineResults:j,caseRunStates:S,generateEvalsLoading:N,generateEvalsProgress:z,generateEvalsError:T}=a,k=v.useMemo(()=>{for(const F of S.values())if(F.status==="running"||F.status==="queued")return!0;return!1},[S]),[M,O]=v.useState(!1),[V,A]=v.useState("all"),U={skill_name:a.skill,evals:[]},w=m??U,L=w.evals,R=v.useMemo(()=>V==="all"?L:L.filter(F=>or(F)===V),[V,L]),I=R.find(F=>F.id===g)??null;v.useEffect(()=>{g!==null&&!R.find(F=>F.id===g)&&r({type:"SELECT_CASE",caseId:R.length>0?R[0].id:null})},[R,g,r]);const[G,Y]=v.useState([]),te=v.useMemo(()=>L.some(F=>or(F)==="integration"),[L]);v.useEffect(()=>{te&&Ne.getCredentials(a.plugin,a.skill).then(F=>Y(F.credentials)).catch(()=>Y([]))},[a.plugin,a.skill,te]);const q=v.useMemo(()=>new Set(G.filter(F=>F.status==="missing").map(F=>F.name)),[G]),[_,E]=v.useState(!1),B=v.useCallback(F=>{E(!1),h(F?{testType:F}:void 0)},[h]);return!m||L.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:y?"var(--red-muted)":"var(--accent-muted)"},children:y?n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),n.jsx("div",{className:"text-center",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Invalid evals.json"}),n.jsx("div",{className:"text-[11px] font-mono px-3 py-2 rounded mt-1 max-w-sm text-left break-words",style:{color:"var(--text-secondary)",background:"var(--surface-2)"},children:y}),n.jsx("div",{className:"text-[12px] mt-2",style:{color:"var(--text-tertiary)"},children:"Fix the evals.json file and reload, or regenerate test cases with AI"})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>O(!0),disabled:x,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("div",{className:"flex",children:[n.jsx("button",{onClick:()=>B("unit"),disabled:N||x,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:N?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),n.jsx("button",{onClick:()=>E(!_),disabled:N||x,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),_&&n.jsx("div",{className:"absolute right-0 mt-1 rounded-lg py-1 z-50",style:{background:"var(--surface-1)",border:"1px solid var(--border-default)",minWidth:180,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:n.jsx("button",{onClick:()=>B("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:F=>{F.currentTarget.style.background="var(--surface-2)"},onMouseLeave:F=>{F.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),N&&z.length>0&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ds,{entries:z,isRunning:!0})}),T&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ls,{error:T,onRetry:()=>B()})}),M&&n.jsx(Fx,{evals:w,onSave:F=>{i(F),O(!1)},onCancel:()=>O(!1)})]}):n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[n.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",R.length,")"]}),n.jsx("div",{className:"flex items-center gap-1.5",children:k?n.jsx("button",{onClick:f,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel All"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>u("benchmark"),disabled:R.length===0||x,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),n.jsx("button",{onClick:()=>u("comparison"),disabled:R.length===0||x,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),n.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(F=>n.jsx("button",{onClick:()=>A(F),style:{padding:"2px 8px",fontSize:10,fontWeight:V===F?600:400,background:V===F?"var(--accent-muted)":"transparent",color:V===F?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:F==="all"?`All (${L.length})`:F==="unit"?`Unit (${L.filter(me=>or(me)==="unit").length})`:`Integration (${L.filter(me=>or(me)==="integration").length})`},F))}),n.jsxs("div",{className:"py-1",children:[R.length===0&&L.length>0&&n.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",V==="all"?"":V+" ","tests yet"]}),R.map(F=>{var oe;const me=j.get(F.id),D=g===F.id,K=or(F);return n.jsxs("button",{onClick:()=>r({type:"SELECT_CASE",caseId:F.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:D?"var(--accent-muted)":"transparent",borderLeft:D?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:fe=>{D||(fe.currentTarget.style.background="var(--surface-2)")},onMouseLeave:fe=>{D||(fe.currentTarget.style.background="transparent")},children:[n.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[n.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:D?"var(--text-primary)":"var(--text-secondary)"},children:["#",F.id," ",F.name,n.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:K==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:K==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:K==="unit"?"U":"I"}),K==="integration"&&((oe=F.requiredCredentials)==null?void 0:oe.some(fe=>q.has(fe)))&&n.jsx("span",{title:"Configure credentials to run",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),n.jsx(dg,{result:me})]}),n.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[F.assertions.length," assertion",F.assertions.length!==1?"s":"",(me==null?void 0:me.passRate)!=null&&n.jsx(_S,{passRate:me.passRate})]})]},F.id)})]}),n.jsx("div",{className:"px-3 py-2",children:!x&&n.jsx("button",{onClick:()=>O(!0),className:"w-full py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{border:"1px dashed var(--border-default)",color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:F=>{F.currentTarget.style.borderColor="var(--accent)",F.currentTarget.style.color="var(--accent)"},onMouseLeave:F=>{F.currentTarget.style.borderColor="var(--border-default)",F.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(RS,{})})]}),n.jsx("div",{className:"overflow-auto",children:I?n.jsx(LS,{evalCase:I,result:j.get(I.id),evals:m,caseStatus:((ne=S.get(I.id))==null?void 0:ne.status)??"idle",onSaveEvals:i,onRun:F=>o(F,"benchmark"),onCompare:F=>o(F,"comparison"),onCancel:F=>p(F),onImprove:F=>r({type:"OPEN_IMPROVE",evalId:F})}):n.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),M&&n.jsx(Fx,{evals:w,onSave:F=>{i(F),O(!1)},onCancel:()=>O(!1)})]})}function LS({evalCase:a,result:r,evals:i,caseStatus:o,onSaveEvals:u,onRun:p,onCompare:f,onCancel:h,onImprove:x}){const{state:m,isReadOnly:y}=kn(),{plugin:g,skill:j}=m,{entries:S,loading:N}=AS(g,j,a.id),[z,T]=v.useState(!1),[k,M]=v.useState(a.prompt),[O,V]=v.useState(!1),[A,U]=v.useState(a.expected_output);v.useState(()=>{M(a.prompt),U(a.expected_output)});const w=v.useCallback(F=>{u({...i,evals:i.evals.map(me=>me.id===F.id?F:me)})},[i,u]),L=v.useCallback(()=>{w({...a,prompt:k}),T(!1)},[a,k,w]),R=v.useCallback(()=>{w({...a,expected_output:A}),V(!1)},[a,A,w]),I=v.useCallback(()=>{w({...a,assertions:[...a.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[a,w]),G=v.useCallback((F,me)=>{w({...a,assertions:a.assertions.map(D=>D.id===F?{...D,text:me}:D)})},[a,w]),Y=v.useCallback(F=>{w({...a,assertions:a.assertions.filter(me=>me.id!==F)})},[a,w]),te=v.useCallback(()=>{confirm("Delete this test case?")&&u({...i,evals:i.evals.filter(F=>F.id!==a.id)})},[i,a.id,u]),q=r&&r.assertions.length>0&&r.assertions.every(F=>F.pass),_=r&&r.assertions.some(F=>!F.pass),E=or(a),B=a.requiredCredentials??[],ne=E==="integration"&&B.length>0;return n.jsxs("div",{className:"p-5 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",a.id," ",a.name]}),y?n.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:E==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:E==="unit"?"var(--accent)":"var(--orange)"},children:E==="unit"?"Unit":"Integration"}):n.jsx("button",{onClick:()=>{if((E==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:me,requirements:D,cleanup:K,...oe}=a;w({...oe,testType:"unit"})}else w({...a,testType:"integration"})},title:`Click to switch to ${E==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:E==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:E==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:E==="unit"?"Unit":"Integration"}),n.jsx(dg,{result:r})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"||o==="queued"?n.jsxs("button",{onClick:()=>h(a.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>p(a.id),disabled:y,className:"btn btn-primary text-[12px]",children:"Run"}),n.jsx("button",{onClick:()=>f(a.id),disabled:y,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),_&&!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:()=>x(a.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:te,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),y&&E==="integration"&&n.jsxs("div",{"data-testid":"platform-integration-note",className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--accent-muted)",border:"1px solid var(--accent-muted)"},children:[n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),n.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),n.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),q&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--green-muted)",border:"1px solid var(--green-muted)"},children:[n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),ne&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"Required Credentials"})]}),n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:B.map(F=>n.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:F},F))})]}),!y&&E==="integration"&&n.jsx(IS,{evalCase:a,onUpdate:w}),n.jsx(Xi,{title:"Prompt",children:z?n.jsxs("div",{children:[n.jsx("textarea",{value:k,onChange:F=>M(F.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:L,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{M(a.prompt),T(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):n.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-secondary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||T(!0)},onMouseEnter:F=>{y||(F.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:F=>{F.currentTarget.style.borderColor="var(--border-subtle)"},children:a.prompt||n.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:y?"No prompt":"Click to edit prompt..."})})}),n.jsx(Xi,{title:"Expected Output",children:O?n.jsxs("div",{children:[n.jsx("textarea",{value:A,onChange:F=>U(F.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:R,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{U(a.expected_output),V(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):n.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||V(!0)},onMouseEnter:F=>{y||(F.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:F=>{F.currentTarget.style.borderColor="var(--border-subtle)"},children:a.expected_output||n.jsx("span",{style:{fontStyle:"italic"},children:y?"No expected output":"Click to edit expected output..."})})}),n.jsx(Xi,{title:`Assertions (${a.assertions.length})`,action:y?void 0:n.jsx("button",{onClick:I,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:a.assertions.length===0?n.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):n.jsx("div",{className:"space-y-2",children:a.assertions.map(F=>{const me=r==null?void 0:r.assertions.find(K=>K.assertion_id===F.id),D=MS(F.id,me,S);return n.jsx(DS,{assertion:F,result:me,badges:D,isReadOnly:y,onUpdate:K=>G(F.id,K),onDelete:()=>Y(F.id)},F.id)})})}),(r==null?void 0:r.output)&&n.jsx(OS,{output:r.output,durationMs:r.durationMs,tokens:r.tokens}),r&&r.passRate!=null&&r.passRate<.2&&(()=>{const F=cg("INEFFECTIVE",r.passRate);return F.recommendations&&F.recommendations.length>0?n.jsx(Xi,{title:"Recommendations",children:n.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"This eval is significantly below expectations"})]}),n.jsx("ul",{className:"space-y-1.5 ml-1",children:F.recommendations.map((me,D)=>n.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[n.jsx("span",{style:{color:"var(--orange)",fontWeight:600,flexShrink:0},children:"•"}),me]},D))})]})}):null})(),n.jsx(BS,{evalId:a.id,sharedEntries:S,sharedLoading:N})]},a.id)}function DS({assertion:a,result:r,badges:i,isReadOnly:o,onUpdate:u,onDelete:p}){const[f,h]=v.useState(!1),[x,m]=v.useState(a.text),[y,g]=v.useState(!1),j=()=>{u(x),h(!1)};return n.jsx("div",{className:"rounded-lg px-3 py-2.5 transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:n.jsxs("div",{className:"flex items-start gap-2",children:[r?n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(i==null?void 0:i.regression)&&n.jsx("span",{className:"mt-0.5 flex-shrink-0",title:"Regression: was passing, now failing",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:18,color:"var(--red)",fontSize:14,fontWeight:700,lineHeight:1},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:a.id}),(i==null?void 0:i.flaky)&&n.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--yellow-muted)",color:"var(--yellow)",whiteSpace:"nowrap"},children:"Flaky"}),(i==null?void 0:i.nonDiscriminating)&&n.jsx("span",{title:"Non-discriminating: passes on both skill and baseline runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--surface-3)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"Non-Discrim."})]}),f?n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{value:x,onChange:S=>m(S.target.value),onKeyDown:S=>{S.key==="Enter"&&j(),S.key==="Escape"&&h(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),n.jsx("button",{onClick:j,className:"btn btn-primary text-[11px]",children:"Save"})]}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(m(a.text),h(!0))},children:a.text}),(r==null?void 0:r.reasoning)&&n.jsx("button",{onClick:()=>g(!y),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:y?"Hide reasoning":"Show reasoning"}),y&&(r==null?void 0:r.reasoning)&&n.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:r.reasoning})]}),!o&&n.jsx("button",{onClick:p,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:S=>{S.currentTarget.style.color="var(--red)",S.currentTarget.style.opacity="1"},onMouseLeave:S=>{S.currentTarget.style.color="var(--text-tertiary)",S.currentTarget.style.opacity=""},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function Xi({title:a,action:r,children:i}){return n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),r]}),i]})}function dg({result:a}){const[r,i]=v.useState(!1);if(!a||a.status==null)return n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const o=a.status==="pass",u=a.passRate??0,f=cg(o?"PASS":"FAIL",u);return n.jsxs("span",{className:"pill text-[10px]",style:{background:o?"var(--green-muted)":"var(--red-muted)",color:o?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"aria-describedby":r?"verdict-tooltip":void 0,children:[a.passRate!=null?`${Math.round(a.passRate*100)}%`:a.status,r&&n.jsx("div",{id:"verdict-tooltip",role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,padding:"6px 10px",background:"var(--surface-4)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:11,color:"var(--text-secondary)",whiteSpace:"nowrap",zIndex:50,maxWidth:300,width:"max-content",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:f.explanation})]})}function _S({passRate:a}){const r=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-1",children:n.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:n.jsx("div",{className:"h-full rounded-full",style:{width:`${r}%`,background:r>=80?"var(--green)":r>=50?"var(--yellow)":"var(--red)"}})})})}function OS({output:a,durationMs:r,tokens:i}){const[o,u]=v.useState(!1);return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:()=>u(!o),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:o?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",r!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",(r/1e3).toFixed(1),"s)"]}),i!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",i," tokens)"]})]}),o&&n.jsx("pre",{className:"text-[12px] p-4 rounded-lg overflow-auto animate-fade-in",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:400,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})]})}function Qu(a){return a==="baseline"?"right":a==="comparison"?"full":"left"}function Zu({entry:a}){return n.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:sg(a.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:a.type==="benchmark"?"var(--accent-muted)":a.type==="comparison"?"var(--purple-muted)":"var(--orange-muted)",color:a.type==="benchmark"?"var(--accent)":a.type==="comparison"?"var(--purple)":"var(--orange)"},children:a.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:mr(a.pass_rate)},children:[Math.round(a.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[a.durationMs!=null&&n.jsx("span",{children:ig(a.durationMs)}),a.tokens!=null&&n.jsxs("span",{children:[a.tokens>=1e3?`${(a.tokens/1e3).toFixed(1)}k`:a.tokens," tok"]})]}),a.type==="comparison"&&a.baselinePassRate!=null&&(()=>{const r=a.pass_rate-a.baselinePassRate,i=r>.001?"skill":r<-.001?"baseline":"tie",o=r>0?"+":"",u=i==="skill"?"var(--green)":i==="baseline"?"var(--red)":"var(--text-tertiary)";return n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:r>=0?"var(--green)":"var(--red)"},children:[o,(r*100).toFixed(1),"%"]}),n.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"var(--surface-3)",color:u},children:i})]})})(),n.jsx("div",{className:"space-y-0.5",children:a.assertions.map(r=>n.jsxs("div",{className:"flex items-start gap-1.5",children:[n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:r.text})]},r.id))})]})}function BS({evalId:a,sharedEntries:r,sharedLoading:i}){const{state:o,dispatch:u}=kn(),{plugin:p,skill:f}=o,[h,x]=v.useState(!0),m=r??null,y=i??!1,g=v.useCallback(()=>{x(z=>!z)},[]),j=m?m.slice(0,10):[],S=j.some(z=>{const T=Qu(z.type);return T==="left"||T==="full"}),N=j.some(z=>{const T=Qu(z.type);return T==="right"||T==="full"});return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:g,className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:h?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",m&&m.length>0&&n.jsxs("span",{style:{fontWeight:400},children:["(",m.length," run",m.length!==1?"s":"",")"]})]}),h&&n.jsx("div",{className:"animate-fade-in",children:y?n.jsxs("div",{className:"flex items-center gap-2 py-3",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!m||m.length===0?n.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):n.jsxs("div",{children:[j.length>=2&&n.jsx("div",{className:"mb-2",children:n.jsx(og,{entries:j})}),n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!S&&n.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!N&&n.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),j.map((z,T)=>{const k=Qu(z.type);return k==="full"?n.jsx("div",{style:{gridColumn:"1 / -1"},children:n.jsx(Zu,{entry:z})},T):k==="left"?n.jsxs(v.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"},children:n.jsx(Zu,{entry:z})}),n.jsx("div",{style:{gridColumn:"2"}})]},T):n.jsxs(v.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"}}),n.jsx("div",{style:{gridColumn:"2"},children:n.jsx(Zu,{entry:z})})]},T)})]}),n.jsx("button",{onClick:()=>u({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:z=>{z.currentTarget.style.textDecoration="underline"},onMouseLeave:z=>{z.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Fx({evals:a,onSave:r,onCancel:i}){const[o,u]=v.useState(""),[p,f]=v.useState(""),[h,x]=v.useState(""),[m,y]=v.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[g,j]=v.useState("unit"),[S,N]=v.useState(""),[z,T]=v.useState([]),[k,M]=v.useState(""),[O,V]=v.useState(""),A=Math.max(0,...a.evals.map(R=>R.id))+1,U=R=>{j(R),R==="unit"&&(T([]),N(""),M(""),V(""))},w=()=>{const R=S.trim().toUpperCase();R&&!z.includes(R)&&T([...z,R]),N("")},L=()=>{if(!o.trim()||!p.trim())return;const R={id:A,name:o.trim(),prompt:p.trim(),expected_output:h.trim(),files:[],assertions:m.filter(I=>I.text.trim()),...g==="integration"?{testType:"integration",...z.length>0?{requiredCredentials:z}:{},...k||O?{requirements:{...k?{platform:k}:{},...O?{chromeProfile:O}:{}}}:{}}:{}};r({...a,evals:[...a.evals,R]})};return n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center animate-overlay-in",style:{background:"rgba(0,0,0,0.6)"},children:n.jsxs("div",{className:"w-full max-w-lg rounded-xl p-6 animate-modal-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",maxHeight:"85vh",overflowY:"auto"},children:[n.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),n.jsxs("div",{className:"mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),n.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(R=>n.jsx("button",{onClick:()=>U(R),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:g===R?R==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:g===R?R==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:R},R))})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),n.jsx("input",{value:o,onChange:R=>u(R.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),n.jsx("textarea",{value:p,onChange:R=>f(R.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),n.jsx("textarea",{value:h,onChange:R=>x(R.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),n.jsxs("div",{className:"mb-4",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),m.map((R,I)=>n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:R.text,onChange:G=>y(m.map((Y,te)=>te===I?{...Y,text:G.target.value}:Y)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),m.length>1&&n.jsx("button",{onClick:()=>y(m.filter((G,Y)=>Y!==I)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},R.id)),n.jsx("button",{onClick:()=>y([...m,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),g==="integration"&&n.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),n.jsxs("div",{className:"mb-3",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:z.map(R=>n.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[R,n.jsx("button",{onClick:()=>T(z.filter(I=>I!==R)),style:{color:"var(--orange)",lineHeight:1},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},R))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:S,onChange:R=>N(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),w())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),n.jsx("button",{onClick:w,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:k,onChange:R=>M(R.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),n.jsxs("label",{className:"block",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),n.jsx("input",{value:O,onChange:R=>V(R.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{onClick:i,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsx("button",{onClick:L,disabled:!o.trim()||!p.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function IS({evalCase:a,onUpdate:r}){var f,h;const[i,o]=v.useState(""),u=()=>{const x=i.trim().toUpperCase();x&&!(a.requiredCredentials??[]).includes(x)&&r({...a,requiredCredentials:[...a.requiredCredentials??[],x]}),o("")},p=x=>{const m=(a.requiredCredentials??[]).filter(y=>y!==x);r({...a,requiredCredentials:m.length>0?m:void 0})};return n.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(a.requiredCredentials??[]).map(x=>n.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[x,n.jsx("button",{onClick:()=>p(x),style:{color:"var(--orange)",lineHeight:1},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},x))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:i,onChange:x=>o(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),u())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),n.jsx("button",{onClick:u,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:((f=a.requirements)==null?void 0:f.platform)??"",onChange:x=>r({...a,requirements:{...a.requirements,platform:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),n.jsx("input",{value:((h=a.requirements)==null?void 0:h.chromeProfile)??"",onChange:x=>r({...a,requirements:{...a.requirements,chromeProfile:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function Sn(a,r){return r==="free"?"Free":r==="subscription"&&a==null?"Subscription":a==null?"N/A":a>=1?`$${a.toFixed(2)}`:a===0?"$0.00":a>=.001?`$${a.toFixed(4)}`:`$${a.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function fg(a,r){return a==null||r==null?"N/A":`${a.toLocaleString("en-US")} in / ${r.toLocaleString("en-US")} out`}function HS(a){return a==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function US(a,r){let i="";if(r){const u=new Date(r);isNaN(u.getTime())||(i=u.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[a,i].filter(Boolean).join(" · ")}function VS(a,r,i){const o=i===1?"test case":"test cases";if(a===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const u=Math.round(Math.abs(a)*r);if(u===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const p=a>0?"more":"fewer";return`Your skill passes ${u} ${p} assertions across ${i} ${o}`}function Wx(a,r){const i=o=>{const u=o/5*100;return isFinite(u)?Math.round(Math.min(100,Math.max(0,u))):0};return{skill:i(a),baseline:i(r)}}function $S(a){return a==="skill"?{text:"Skill wins",isSkill:!0}:a==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function GS(a,r){const i=a+r,o=i*10,u=i*25,p=f=>f>=60?`${Math.round(f/60)}m`:`${f}s`;return`${p(o)}–${p(u)}`}const PS={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function qS(a,r){if(!a)return null;const i=PS[a];if(i==null||i===0)return null;const o=i*r*.5,u=i*r*2;return`${Sn(o)}–${Sn(u)}`}function YS(){const{state:a,runCase:r,runAll:i,cancelCase:o,cancelAll:u,isReadOnly:p}=kn(),{evals:f,caseRunStates:h,bulkRunActive:x,latestBenchmark:m,inlineResults:y}=a,{config:g}=bl(),j=(f==null?void 0:f.evals)??[],S=v.useMemo(()=>{for(const w of h.values())if(w.status==="running"||w.status==="queued")return!0;return!1},[h]),N=j.filter(w=>{const L=h.get(w.id);return L&&(L.status==="complete"||L.status==="error"||L.status==="cancelled")}).length,z=j.filter(w=>{const L=h.get(w.id);return L&&(L.status==="running"||L.status==="queued")}).length,T=v.useRef(null),[k,M]=v.useState(0);v.useEffect(()=>{if(S&&!T.current&&(T.current=Date.now()),!S){T.current=null,M(0);return}const w=setInterval(()=>{T.current&&M(Math.round((Date.now()-T.current)/1e3))},1e3);return()=>clearInterval(w)},[S]);const O=j.reduce((w,L)=>w+L.assertions.length,0),V=j.length+O,A=v.useMemo(()=>GS(j.length,O),[j.length,O]),U=v.useMemo(()=>qS((g==null?void 0:g.provider)??null,V),[g==null?void 0:g.provider,V]);return n.jsxs("div",{className:"p-5",children:[p&&n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-4 text-[11px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),n.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),S&&n.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[z," running"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[S&&n.jsxs("button",{onClick:u,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||S||p,className:"btn btn-primary text-[12px]",title:"Runs both your skill and the baseline, then compares results side by side",children:"Run A/B Test"}),n.jsx("button",{onClick:()=>i("benchmark"),disabled:j.length===0||S||p,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),n.jsx("button",{onClick:()=>i("baseline"),disabled:j.length===0||S||p,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!S&&j.length>0&&n.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("span",{children:["Est. duration: ",A]}),U&&n.jsxs("span",{children:["Est. cost: ",U]}),!U&&(g==null?void 0:g.provider)&&(g.provider==="claude-cli"||g.provider==="codex-cli")&&n.jsx("span",{children:"Cost: Subscription"}),!U&&(g==null?void 0:g.provider)&&(g.provider==="ollama"||g.provider==="lm-studio"||g.provider==="gemini-cli")&&n.jsx("span",{children:"Cost: Free"})]})]}),S&&j.length>0&&n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",N,"/",j.length," cases"]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(N/j.length*100),"%"]})]}),n.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${N/j.length*100}%`,background:"var(--accent)"}})}),n.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",k>=60?`${Math.floor(k/60)}m ${k%60}s`:`${k}s`]}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",A]})]})]}),n.jsx("div",{className:"space-y-3 stagger-children",children:j.map(w=>{const L=y.get(w.id),R=h.get(w.id),I=(R==null?void 0:R.status)??"idle",G=m==null?void 0:m.cases.find(Y=>Y.eval_id===w.id);return n.jsx(WS,{name:w.name,evalId:w.id,result:L,caseCost:G==null?void 0:G.cost,caseBillingMode:G==null?void 0:G.billingMode,caseInputTokens:G==null?void 0:G.inputTokens,caseOutputTokens:G==null?void 0:G.outputTokens,caseStatus:I,runMode:(R==null?void 0:R.mode)??null,comparisonDetail:G==null?void 0:G.comparisonDetail,isReadOnly:p,onRun:Y=>r(Y,"benchmark"),onBaseline:Y=>r(Y,"baseline"),onCompare:Y=>r(Y,"comparison"),onCancel:Y=>o(Y)},w.id)})}),!S&&m&&m.cases.length>0&&n.jsxs("div",{className:"mt-5",children:[n.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:HS(m.type)}),n.jsx("span",{className:"text-[20px] font-bold",style:{color:(m.overall_pass_rate??0)>=.8?"var(--green)":(m.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:m.overall_pass_rate!=null?`${Math.round(m.overall_pass_rate*100)}%`:"--"})]}),m.totalDurationMs!=null&&n.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(m.totalDurationMs/1e3).toFixed(1),"s",m.model&&` | Model: ${m.model}`,m.totalInputTokens!=null&&m.totalOutputTokens!=null&&` | Tokens: ${fg(m.totalInputTokens,m.totalOutputTokens)}`,m.totalCost!=null&&` | Cost: ${Sn(m.totalCost)}`]}),m.overall_pass_rate>=.9999&&!m.comparison&&n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||p,className:"text-[13px] font-semibold mt-3 w-full rounded-lg transition-opacity duration-150",style:{padding:"10px 0",background:"var(--green)",color:"var(--color-paper)",border:"none",cursor:"pointer",opacity:j.length===0?.5:1},children:"Run Final A/B Comparison"})]}),m.comparison&&n.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const w=US(m.model,m.timestamp);return w?n.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:w}):n.jsx("div",{className:"mb-3"})})(),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsx(Kx,{label:"Skill",value:m.comparison.skillPassRate,color:"var(--accent)"}),n.jsx(Kx,{label:"Baseline",value:m.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),n.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:m.comparison.delta>0?"var(--green)":m.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",m.comparison.delta>0?"+":"",(m.comparison.delta*100).toFixed(1),"%",m.verdict&&` | ${TS(m.verdict)}`]}),(()=>{const w=m.cases.reduce((R,I)=>R+I.assertions.length,0),L=VS(m.comparison.delta,w,m.cases.length);return n.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:L})})()]})]})]})}const FS={benchmark:{label:"Skill",bg:"var(--accent-muted)",color:"var(--accent)"},baseline:{label:"Baseline",bg:"var(--surface-3)",color:"var(--text-tertiary)"},comparison:{label:"Compare",bg:"var(--purple-muted)",color:"var(--purple)"}};function WS({name:a,evalId:r,result:i,caseCost:o,caseBillingMode:u,caseInputTokens:p,caseOutputTokens:f,caseStatus:h,runMode:x,comparisonDetail:m,isReadOnly:y,onRun:g,onBaseline:j,onCompare:S,onCancel:N}){const[z,T]=v.useState(!1),k=h==="running"||h==="queued",M=h==="complete"||h==="error";return n.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:k?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:k?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[h==="running"&&n.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),h==="queued"&&n.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),n.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",r," ",a]}),x&&(k||M)&&(()=>{const O=FS[x];return O?n.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:O.bg,color:O.color,padding:"1px 6px"},children:O.label}):null})()]}),n.jsxs("div",{className:"flex items-center gap-2",children:[k?n.jsx("button",{onClick:()=>N(r),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>S(r),disabled:y,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),n.jsx("button",{onClick:()=>g(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),n.jsx("button",{onClick:()=>j(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),i&&i.status!=null&&n.jsx("span",{className:"pill text-[10px]",style:{background:i.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:i.status==="pass"?"var(--green)":"var(--red)"},children:i.passRate!=null?`${Math.round(i.passRate*100)}%`:i.status}),p!=null&&f!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:fg(p,f)}),o!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Sn(o,u)}),h==="cancelled"&&n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),i&&i.assertions.length>0&&n.jsxs("div",{className:"px-4 pb-3",children:[n.jsx("div",{className:"space-y-1",children:i.assertions.map(O=>n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{style:{color:O.pass?"var(--green)":"var(--red)"},children:O.pass?"PASS":"FAIL"}),n.jsx("span",{style:{color:"var(--text-secondary)"},children:O.text})]},O.assertion_id))}),i.output&&n.jsx("button",{onClick:()=>T(!z),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:z?"Hide output":"Show output"}),z&&i.output&&n.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:i.output})]}),m&&n.jsx("div",{className:"px-4 pb-3",children:n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:n.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const O=Wx(m.skillContentScore,m.baselineContentScore),V=Wx(m.skillStructureScore,m.baselineStructureScore),A=$S(m.winner);return n.jsxs(n.Fragment,{children:[n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",O.skill,"% / Baseline ",O.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",V.skill,"% / Baseline ",V.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsx("span",{style:{color:A.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:A.text})]})})()})})}),i&&i.errorMessage&&n.jsx(KS,{errorMessage:i.errorMessage,classifiedError:i.classifiedError})]})}const Ju={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function KS({errorMessage:a,classifiedError:r}){const[i,o]=v.useState(!1),u=(r==null?void 0:r.title)??"Error",p=r==null?void 0:r.hint,f=r?Ju[r.category]??Ju.unknown:Ju.unknown;return n.jsx("div",{className:"px-4 pb-3",children:n.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid var(--red-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[n.jsx("span",{style:{fontSize:12},children:f}),n.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:u}),n.jsx("button",{onClick:()=>o(!i),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:i?"Hide details":"Details"})]}),p&&n.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:p}),i&&n.jsx("pre",{className:"text-[10px] px-3 pb-2.5 overflow-auto",style:{color:"var(--text-tertiary)",maxHeight:120,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:a})]})})}function Kx({label:a,value:r,color:i}){return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:a}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i},children:[Math.round(r*100),"%"]})]}),n.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r*100}%`,background:i}})})]})}const Xx={TP:{bg:"var(--green-muted)",text:"var(--green)"},TN:{bg:"var(--green-muted)",text:"var(--green)"},FP:{bg:"var(--red-muted)",text:"var(--red)"},FN:{bg:"var(--red-muted)",text:"var(--red)"}};function XS(){const{state:a,dispatch:r,runActivationTest:i,cancelActivation:o,generateActivationPrompts:u}=kn(),{plugin:p,skill:f,activationPrompts:h,activationResults:x,activationSummary:m,activationRunning:y,activationError:g,activationStartedAt:j,activationClassifyingStatus:S,generatingPrompts:N,generatingPromptsError:z,activationHistory:T}=a,[k,M]=v.useState(h),[O,V]=v.useState(null),[A,U]=v.useState(!1);v.useEffect(()=>{h&&h!==k&&M(h)},[h]),v.useEffect(()=>{r({type:"SET_ACTIVATION_PROMPTS",prompts:k})},[k,r]),v.useEffect(()=>{fetch(`/api/skills/${p}/${f}/description`).then(_=>_.json()).then(_=>V(_.rawContent||_.description||null)).catch(()=>V(null))},[p,f]);function w(){i(k)}function L(){u(8)}const R=k.trim().split(`
|
|
70
|
-
`).filter(Boolean).length,I=x.filter(
|
|
69
|
+
`);U(Jn),D(jo(f,Jn)),V(!1)}else St==="error"&&(q(Ve.message||Ve.description||"Generation failed"),V(!1))}catch{}St=""}}}catch(xt){xt.name!=="AbortError"&&q(xt.message)}finally{V(!1),te.current=null}},[k,Q,f]),Vt=v.useCallback(()=>{A&&r({type:"SET_CONTENT",content:A}),T(!1),U(null),D([]),M(""),I([])},[A,r]),$t=v.useCallback(()=>{T(!1),U(null),D([]),M(""),I([]),q(null)},[]),tt=v.useCallback(()=>{var ve;L?((ve=te.current)==null||ve.abort(),$t()):(m&&r({type:"CLOSE_AI_EDIT"}),T(!0))},[L,m,r,$t]),jt=[{mode:"raw",icon:n.jsx(jS,{}),label:"Editor"},{mode:"split",icon:n.jsx(SS,{}),label:"Split"},{mode:"preview",icon:n.jsx(kS,{}),label:"Preview"}];return n.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Zt,tabIndex:-1,children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:jt.map(({mode:ve,icon:Rt,label:ze})=>n.jsxs("button",{onClick:()=>g(ve),title:ze,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:y===ve?"var(--surface-4)":"transparent",color:y===ve?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:y===ve?600:400,border:"none",cursor:"pointer"},children:[Rt,n.jsx("span",{style:{letterSpacing:"0.01em"},children:ze})]},ve))}),W?o?n.jsx("div",{className:"flex items-center gap-2",children:n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{m?r({type:"CLOSE_AI_EDIT"}):(L&&$t(),r({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:m?600:400,border:"none",cursor:"pointer",color:m?"var(--purple)":"var(--text-tertiary)",background:m?"var(--purple-muted)":"transparent"},children:[n.jsx(wS,{size:13}),n.jsx("span",{children:"AI Edit"})]}),n.jsxs("button",{onClick:tt,title:"Regenerate skill from prompt",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:L?600:400,border:"none",cursor:"pointer",color:L?"var(--purple)":"var(--text-tertiary)",background:L?"var(--purple-muted)":"transparent"},children:[n.jsx(Xu,{size:13}),n.jsx("span",{children:"Regenerate"})]}),n.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),h&&n.jsx("button",{onClick:()=>r({type:"SET_CONTENT",content:a.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),n.jsx("button",{onClick:dt,disabled:!h||j,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:j?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),u&&p&&n.jsx(vS,{files:z,activeFile:E,onSelect:he,onRefresh:_}),!W&&n.jsx(bS,{file:B,loading:ne,error:Y,viewMode:y,plugin:u??void 0,skill:p??void 0,onSaved:()=>{me(E),_()},onDirtyChange:fe}),W&&n.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:y==="raw"||y==="preview"?"1fr":"1fr 1fr"},children:[y!=="preview"&&n.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:y==="split"?"1px solid var(--border-subtle)":"none"},children:n.jsx("textarea",{ref:N,value:f,onChange:ve=>{o||r({type:"SET_CONTENT",content:ve.target.value})},onKeyDown:Zt,spellCheck:!1,readOnly:o,className:"flex-1 w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",fontSize:12.5,lineHeight:1.7,tabSize:2,border:"none",padding:"16px 20px",opacity:o?.7:1}})}),y!=="raw"&&n.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(Ue||se||Le)&&n.jsxs("div",{style:{marginBottom:20},children:[n.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[Ue&&n.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:Ue}),se&&n.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4,letterSpacing:"0.03em",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:["v",se]})]}),Le&&n.jsx("p",{style:{fontSize:12.5,lineHeight:1.65,color:"var(--text-secondary)",margin:0,paddingLeft:12,borderLeft:"2px solid var(--accent)",maxWidth:600},children:Le})]}),ge.length>0&&n.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ge.map(ve=>n.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:ve},ve))}),je.length>0&&n.jsx("div",{style:{marginBottom:16},children:n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),je.map(ve=>n.jsx("span",{style:{fontSize:10.5,fontFamily:"var(--font-mono, ui-monospace, monospace)",color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4},children:ve},ve))]})}),Me.length>0&&n.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:Me.map(([ve,Rt],ze)=>{const xt=Array.isArray(Rt)?Rt.join(", "):typeof Rt=="object"?Object.entries(Rt).map(([Wt,nt])=>`${Wt}: ${Array.isArray(nt)?nt.join(", "):nt}`).join(" | "):Rt;return n.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:ze>0?"1px solid var(--border-subtle)":"none"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:ve}),n.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:xt})]},ve)})}),(Ue||Le||ge.length>0||je.length>0||Me.length>0)&&ke&&n.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),ke&&n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:bo(ke)}})]})})]}),W&&m&&n.jsx(dS,{}),W&&L&&n.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:n.jsxs("div",{className:"px-4 py-3",children:[!A&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Xu,{size:14}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),n.jsx("div",{className:"flex gap-2 mb-2",children:n.jsx("textarea",{value:k,onChange:ve=>M(ve.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:O,className:"flex-1 px-3 py-2 rounded-lg text-[12px] resize-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",outline:"none",opacity:O?.5:1},onKeyDown:ve=>{ve.key==="Enter"&&(ve.ctrlKey||ve.metaKey)&&k.trim()&&!O&&(ve.preventDefault(),ct())}})}),n.jsxs("div",{className:"flex items-center gap-2",children:[O?n.jsx("button",{onClick:()=>{var ve;(ve=te.current)==null||ve.abort(),V(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):n.jsx("button",{onClick:ct,disabled:!k.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),n.jsx("button",{onClick:$t,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),O&&R.length>0&&n.jsx("div",{className:"mt-2",children:n.jsx(Ds,{entries:R,isRunning:!0})}),G&&n.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[G,n.jsx("button",{onClick:ct,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),A&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Xu,{size:14}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:w.map((ve,Rt)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:ve.type==="added"?"var(--green-muted)":ve.type==="removed"?"var(--red-muted)":"transparent",color:ve.type==="added"?"var(--green)":ve.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:ve.type==="added"?"3px solid var(--green)":ve.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ve.type==="added"?"+":ve.type==="removed"?"-":" "}),ve.content]},Rt))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{onClick:Vt,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),n.jsx("button",{onClick:$t,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),W&&x!==null&&u&&p&&n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(lS,{plugin:u,skill:p,skillContent:f,onApplied:ve=>{r({type:"SET_CONTENT",content:ve}),r({type:"CONTENT_SAVED"}),r({type:"CLOSE_IMPROVE"})}})})]})}function or(a){return a.testType==="integration"?"integration":"unit"}function mr(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function sg(a){const r=new Date(a);return r.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function ig(a){return a==null?"--":a>=1e3?`${(a/1e3).toFixed(1)}s`:`${a}ms`}const NS=new Set(["benchmark","comparison","baseline"]);function Fx(a,r,i,o){return a.map(({rate:u,idx:p,total:f})=>{const h=o+p/(f-1)*(r-o*2),x=o+(i-o*2)-u*(i-o*2);return`${h},${x}`})}function og({entries:a}){const r=a.filter(g=>NS.has(g.type)).slice().reverse(),i=r.map((g,j,S)=>({rate:g.pass_rate,idx:j,total:S.length})).filter((g,j)=>{const S=r[j].type;return S==="benchmark"||S==="comparison"}),o=r.flatMap((g,j)=>g.type==="baseline"?[{rate:g.pass_rate,idx:j,total:r.length}]:g.type==="comparison"&&g.baselinePassRate!=null?[{rate:g.baselinePassRate,idx:j,total:r.length}]:[]);if(i.length<2&&o.length<2)return null;const u=80,p=24,f=2,h=i.length>=2?Fx(i,u,p,f):[],x=o.length>=2?Fx(o,u,p,f):[],m=h[h.length-1],y=x[x.length-1];return n.jsxs("svg",{width:u,height:p,style:{display:"block",flexShrink:0},children:[x.length>0&&n.jsx("polyline",{points:x.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),h.length>0&&n.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),y&&n.jsx("circle",{cx:parseFloat(y.split(",")[0]),cy:parseFloat(y.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),m&&n.jsx("circle",{cx:parseFloat(m.split(",")[0]),cy:parseFloat(m.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function cg(a,r,i){const o=isNaN(r)?0:r,u=[],p=[],f=[];if((a==="PASS"||a==="EFFECTIVE")&&o>=.7){const m=u.length>0?` Met criteria: ${u.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): evaluation met expectations.${m}`}}if(a==="FAIL"||a==="DEGRADING"){const m=p.length>0?` Failed criteria: ${p.map(g=>g.criterion).join(", ")}.`:"",y=[...p.map(g=>`Improve "${g.criterion}" (score: ${g.score.toFixed(2)})`),...f.map(g=>`Strengthen "${g.criterion}" (score: ${g.score.toFixed(2)})`)];return y.length===0&&y.push("Review prompt instructions and add more specific guidance"),{explanation:`${a} (score ${o.toFixed(2)}): evaluation did not meet expectations.${m}`,recommendations:y}}if(a==="INEFFECTIVE"){if(o<.2){const y=[...p.map(g=>`Rework "${g.criterion}" — currently at ${g.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${a} (score ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const m=[...p.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push("Consider restructuring your prompt approach"),{explanation:`${a} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:m}}if(a==="MARGINAL"){const m=[...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...p.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(u.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${a} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:m}}if(a==="EMERGING"){const m=[...p.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(u.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Add more specific guidance to your prompt instructions"),{explanation:`${a} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:m}}const h=u.length>0?` Passing: ${u.map(m=>m.criterion).join(", ")}.`:"",x=f.length>0?` Needs improvement: ${f.map(m=>m.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): mixed results.${h}${x}`}}const ug={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function ES(a){return Object.hasOwn(ug,a)}function TS(a){return ES(a)?ug[a]:a}function RS(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState([]),[p,f]=v.useState([]),[h,x]=v.useState(!0),[m,y]=v.useState(null),[g,j]=v.useState(new Set),[S,N]=v.useState({}),[L,T]=v.useState(null),[k,M]=v.useState(""),[O,V]=v.useState(!1),[A,U]=v.useState(""),[w,D]=v.useState(""),R=v.useCallback(async()=>{x(!0),y(null);try{const[z,E]=await Promise.all([Ne.getCredentials(r,i),Ne.getParams(r,i)]);u(z.credentials),f(E.params)}catch(z){y(z instanceof Error?z.message:"Failed to load parameters"),u([]),f([])}finally{x(!1)}},[r,i]);v.useEffect(()=>{R()},[R]);const I=v.useCallback(async(z,E)=>{V(!0),y(null);try{await Ne.setCredential(r,i,z,E),T(null),M(""),await R()}catch(B){y(B instanceof Error?B.message:`Failed to save ${z}`)}finally{V(!1)}},[r,i,R]),G=v.useCallback(async()=>{const z=A.trim().toUpperCase(),E=w.trim();if(!(!z||!E)){V(!0),y(null);try{await Ne.setCredential(r,i,z,E),U(""),D(""),await R()}catch(B){y(B instanceof Error?B.message:`Failed to add ${z}`)}finally{V(!1)}}},[r,i,A,w,R]),q=v.useCallback(async z=>{if(g.has(z)){j(E=>{const B=new Set(E);return B.delete(z),B}),N(E=>{const B={...E};return delete B[z],B});return}try{const B=(await Ne.getParamsRevealed(r,i,z)).params.find(ne=>ne.name===z);B!=null&&B.value&&(N(ne=>({...ne,[z]:B.value})),j(ne=>new Set(ne).add(z)))}catch{}},[r,i,g]),te=new Set(o.map(z=>z.name)),Q=[...o.map(z=>{const E=p.find(B=>B.name===z.name);return{name:z.name,status:z.status,maskedValue:(E==null?void 0:E.maskedValue)??""}}),...p.filter(z=>!te.has(z.name)).map(z=>({name:z.name,status:z.status,maskedValue:z.maskedValue}))];return n.jsxs("div",{className:"py-2 px-3",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),m&&n.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},role:"alert",children:m}),h&&Q.length===0&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&Q.length===0&&!m&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),Q.map(z=>n.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:z.name}),n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:z.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:z.status==="ready"?"var(--green)":"var(--red)"},children:z.status}),(z.maskedValue||z.status==="ready")&&n.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[g.has(z.name)?S[z.name]??z.maskedValue:z.maskedValue||"***",n.jsx("button",{onClick:()=>q(z.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${g.has(z.name)?"Hide":"Reveal"} value for ${z.name}`,children:g.has(z.name)?"hide":"show"})]}),L===z.name?n.jsxs("div",{className:"flex gap-1",children:[n.jsx("input",{value:k,onChange:E=>M(E.target.value),onKeyDown:E=>{E.key==="Enter"&&k.trim()&&I(z.name,k)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${z.name}`,autoFocus:!0}),n.jsx("button",{onClick:()=>I(z.name,k),disabled:O||!k.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),n.jsx("button",{onClick:()=>{T(null),M("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):n.jsx("button",{onClick:()=>{T(z.name),M("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},z.name)),n.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:A,onChange:z=>U(z.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),n.jsx("input",{value:w,onChange:z=>D(z.target.value),onKeyDown:z=>{z.key==="Enter"&&A.trim()&&w.trim()&&G()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),n.jsx("button",{onClick:G,disabled:O||!A.trim()||!w.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:O?"not-allowed":"pointer"},children:"Add"})]})]})]})}function AS(a,r,i){const[o,u]=v.useState(null),[p,f]=v.useState(!1),h=v.useRef("");v.useEffect(()=>{const m=`${a}/${r}/${i}`;h.current!==m&&(h.current=m,f(!0),Ne.getCaseHistory(a,r,i).then(y=>u(y)).catch(()=>u([])).finally(()=>f(!1)))},[a,r,i]);const x=v.useCallback(()=>{f(!0),h.current="",Ne.getCaseHistory(a,r,i).then(m=>u(m)).catch(()=>u([])).finally(()=>f(!1))},[a,r,i]);return{entries:o,loading:p,refetch:x}}function MS(a,r,i){const o={flaky:!1,nonDiscriminating:!1,regression:!1};if(!i||i.length===0)return o;const p=i.slice(0,10).map(x=>x.assertions.find(m=>m.id===a)).filter(Boolean);if(p.length>=2){const m=p.filter(y=>y.pass).length/p.length;m>=.3&&m<=.7&&(o.flaky=!0)}const f=i.find(x=>x.type==="benchmark"),h=i.find(x=>x.type==="baseline");if(f&&h){const x=f.assertions.find(y=>y.id===a),m=h.assertions.find(y=>y.id===a);x!=null&&x.pass&&(m!=null&&m.pass)&&(o.nonDiscriminating=!0)}if(r&&!r.pass&&i.length>=1){const m=i[0].assertions.find(y=>y.id===a);m!=null&&m.pass&&(o.regression=!0)}return o}function zS(){var ne;const{state:a,dispatch:r,saveEvals:i,runCase:o,runAll:u,cancelCase:p,cancelAll:f,generateEvals:h,isReadOnly:x}=kn(),{evals:m,evalsError:y,selectedCaseId:g,inlineResults:j,caseRunStates:S,generateEvalsLoading:N,generateEvalsProgress:L,generateEvalsError:T}=a,k=v.useMemo(()=>{for(const Y of S.values())if(Y.status==="running"||Y.status==="queued")return!0;return!1},[S]),[M,O]=v.useState(!1),[V,A]=v.useState("all"),U={skill_name:a.skill,evals:[]},w=m??U,D=w.evals,R=v.useMemo(()=>V==="all"?D:D.filter(Y=>or(Y)===V),[V,D]),I=R.find(Y=>Y.id===g)??null;v.useEffect(()=>{g!==null&&!R.find(Y=>Y.id===g)&&r({type:"SELECT_CASE",caseId:R.length>0?R[0].id:null})},[R,g,r]);const[G,q]=v.useState([]),te=v.useMemo(()=>D.some(Y=>or(Y)==="integration"),[D]);v.useEffect(()=>{te&&Ne.getCredentials(a.plugin,a.skill).then(Y=>q(Y.credentials)).catch(()=>q([]))},[a.plugin,a.skill,te]);const Q=v.useMemo(()=>new Set(G.filter(Y=>Y.status==="missing").map(Y=>Y.name)),[G]),[z,E]=v.useState(!1),B=v.useCallback(Y=>{E(!1),h(Y?{testType:Y}:void 0)},[h]);return!m||D.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:y?"var(--red-muted)":"var(--accent-muted)"},children:y?n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),n.jsx("div",{className:"text-center",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Invalid evals.json"}),n.jsx("div",{className:"text-[11px] font-mono px-3 py-2 rounded mt-1 max-w-sm text-left break-words",style:{color:"var(--text-secondary)",background:"var(--surface-2)"},children:y}),n.jsx("div",{className:"text-[12px] mt-2",style:{color:"var(--text-tertiary)"},children:"Fix the evals.json file and reload, or regenerate test cases with AI"})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>O(!0),disabled:x,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("div",{className:"flex",children:[n.jsx("button",{onClick:()=>B("unit"),disabled:N||x,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:N?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),n.jsx("button",{onClick:()=>E(!z),disabled:N||x,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),z&&n.jsx("div",{className:"absolute right-0 mt-1 rounded-lg py-1 z-50",style:{background:"var(--surface-1)",border:"1px solid var(--border-default)",minWidth:180,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:n.jsx("button",{onClick:()=>B("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:Y=>{Y.currentTarget.style.background="var(--surface-2)"},onMouseLeave:Y=>{Y.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),N&&L.length>0&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ds,{entries:L,isRunning:!0})}),T&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ls,{error:T,onRetry:()=>B()})}),M&&n.jsx(Wx,{evals:w,onSave:Y=>{i(Y),O(!1)},onCancel:()=>O(!1)})]}):n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[n.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",R.length,")"]}),n.jsx("div",{className:"flex items-center gap-1.5",children:k?n.jsx("button",{onClick:f,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel All"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>u("benchmark"),disabled:R.length===0||x,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),n.jsx("button",{onClick:()=>u("comparison"),disabled:R.length===0||x,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),n.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(Y=>n.jsx("button",{onClick:()=>A(Y),style:{padding:"2px 8px",fontSize:10,fontWeight:V===Y?600:400,background:V===Y?"var(--accent-muted)":"transparent",color:V===Y?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:Y==="all"?`All (${D.length})`:Y==="unit"?`Unit (${D.filter(me=>or(me)==="unit").length})`:`Integration (${D.filter(me=>or(me)==="integration").length})`},Y))}),n.jsxs("div",{className:"py-1",children:[R.length===0&&D.length>0&&n.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",V==="all"?"":V+" ","tests yet"]}),R.map(Y=>{var oe;const me=j.get(Y.id),_=g===Y.id,W=or(Y);return n.jsxs("button",{onClick:()=>r({type:"SELECT_CASE",caseId:Y.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:_?"var(--accent-muted)":"transparent",borderLeft:_?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:fe=>{_||(fe.currentTarget.style.background="var(--surface-2)")},onMouseLeave:fe=>{_||(fe.currentTarget.style.background="transparent")},children:[n.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[n.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:_?"var(--text-primary)":"var(--text-secondary)"},children:["#",Y.id," ",Y.name,n.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:W==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:W==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:W==="unit"?"U":"I"}),W==="integration"&&((oe=Y.requiredCredentials)==null?void 0:oe.some(fe=>Q.has(fe)))&&n.jsx("span",{title:"Configure credentials to run",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),n.jsx(dg,{result:me})]}),n.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[Y.assertions.length," assertion",Y.assertions.length!==1?"s":"",(me==null?void 0:me.passRate)!=null&&n.jsx(_S,{passRate:me.passRate})]})]},Y.id)})]}),n.jsx("div",{className:"px-3 py-2",children:!x&&n.jsx("button",{onClick:()=>O(!0),className:"w-full py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{border:"1px dashed var(--border-default)",color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:Y=>{Y.currentTarget.style.borderColor="var(--accent)",Y.currentTarget.style.color="var(--accent)"},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-default)",Y.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(RS,{})})]}),n.jsx("div",{className:"overflow-auto",children:I?n.jsx(LS,{evalCase:I,result:j.get(I.id),evals:m,caseStatus:((ne=S.get(I.id))==null?void 0:ne.status)??"idle",onSaveEvals:i,onRun:Y=>o(Y,"benchmark"),onCompare:Y=>o(Y,"comparison"),onCancel:Y=>p(Y),onImprove:Y=>r({type:"OPEN_IMPROVE",evalId:Y})}):n.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),M&&n.jsx(Wx,{evals:w,onSave:Y=>{i(Y),O(!1)},onCancel:()=>O(!1)})]})}function LS({evalCase:a,result:r,evals:i,caseStatus:o,onSaveEvals:u,onRun:p,onCompare:f,onCancel:h,onImprove:x}){const{state:m,isReadOnly:y}=kn(),{plugin:g,skill:j}=m,{entries:S,loading:N}=AS(g,j,a.id),[L,T]=v.useState(!1),[k,M]=v.useState(a.prompt),[O,V]=v.useState(!1),[A,U]=v.useState(a.expected_output);v.useState(()=>{M(a.prompt),U(a.expected_output)});const w=v.useCallback(Y=>{u({...i,evals:i.evals.map(me=>me.id===Y.id?Y:me)})},[i,u]),D=v.useCallback(()=>{w({...a,prompt:k}),T(!1)},[a,k,w]),R=v.useCallback(()=>{w({...a,expected_output:A}),V(!1)},[a,A,w]),I=v.useCallback(()=>{w({...a,assertions:[...a.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[a,w]),G=v.useCallback((Y,me)=>{w({...a,assertions:a.assertions.map(_=>_.id===Y?{..._,text:me}:_)})},[a,w]),q=v.useCallback(Y=>{w({...a,assertions:a.assertions.filter(me=>me.id!==Y)})},[a,w]),te=v.useCallback(()=>{confirm("Delete this test case?")&&u({...i,evals:i.evals.filter(Y=>Y.id!==a.id)})},[i,a.id,u]),Q=r&&r.assertions.length>0&&r.assertions.every(Y=>Y.pass),z=r&&r.assertions.some(Y=>!Y.pass),E=or(a),B=a.requiredCredentials??[],ne=E==="integration"&&B.length>0;return n.jsxs("div",{className:"p-5 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",a.id," ",a.name]}),y?n.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:E==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:E==="unit"?"var(--accent)":"var(--orange)"},children:E==="unit"?"Unit":"Integration"}):n.jsx("button",{onClick:()=>{if((E==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:me,requirements:_,cleanup:W,...oe}=a;w({...oe,testType:"unit"})}else w({...a,testType:"integration"})},title:`Click to switch to ${E==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:E==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:E==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:E==="unit"?"Unit":"Integration"}),n.jsx(dg,{result:r})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"||o==="queued"?n.jsxs("button",{onClick:()=>h(a.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>p(a.id),disabled:y,className:"btn btn-primary text-[12px]",children:"Run"}),n.jsx("button",{onClick:()=>f(a.id),disabled:y,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),z&&!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:()=>x(a.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:te,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),y&&E==="integration"&&n.jsxs("div",{"data-testid":"platform-integration-note",className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--accent-muted)",border:"1px solid var(--accent-muted)"},children:[n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),n.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),n.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),Q&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--green-muted)",border:"1px solid var(--green-muted)"},children:[n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),ne&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"Required Credentials"})]}),n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:B.map(Y=>n.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:Y},Y))})]}),!y&&E==="integration"&&n.jsx(IS,{evalCase:a,onUpdate:w}),n.jsx(Xi,{title:"Prompt",children:L?n.jsxs("div",{children:[n.jsx("textarea",{value:k,onChange:Y=>M(Y.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:D,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{M(a.prompt),T(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):n.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-secondary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||T(!0)},onMouseEnter:Y=>{y||(Y.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-subtle)"},children:a.prompt||n.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:y?"No prompt":"Click to edit prompt..."})})}),n.jsx(Xi,{title:"Expected Output",children:O?n.jsxs("div",{children:[n.jsx("textarea",{value:A,onChange:Y=>U(Y.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:R,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{U(a.expected_output),V(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):n.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||V(!0)},onMouseEnter:Y=>{y||(Y.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-subtle)"},children:a.expected_output||n.jsx("span",{style:{fontStyle:"italic"},children:y?"No expected output":"Click to edit expected output..."})})}),n.jsx(Xi,{title:`Assertions (${a.assertions.length})`,action:y?void 0:n.jsx("button",{onClick:I,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:a.assertions.length===0?n.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):n.jsx("div",{className:"space-y-2",children:a.assertions.map(Y=>{const me=r==null?void 0:r.assertions.find(W=>W.assertion_id===Y.id),_=MS(Y.id,me,S);return n.jsx(DS,{assertion:Y,result:me,badges:_,isReadOnly:y,onUpdate:W=>G(Y.id,W),onDelete:()=>q(Y.id)},Y.id)})})}),(r==null?void 0:r.output)&&n.jsx(OS,{output:r.output,durationMs:r.durationMs,tokens:r.tokens}),r&&r.passRate!=null&&r.passRate<.2&&(()=>{const Y=cg("INEFFECTIVE",r.passRate);return Y.recommendations&&Y.recommendations.length>0?n.jsx(Xi,{title:"Recommendations",children:n.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"This eval is significantly below expectations"})]}),n.jsx("ul",{className:"space-y-1.5 ml-1",children:Y.recommendations.map((me,_)=>n.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[n.jsx("span",{style:{color:"var(--orange)",fontWeight:600,flexShrink:0},children:"•"}),me]},_))})]})}):null})(),n.jsx(BS,{evalId:a.id,sharedEntries:S,sharedLoading:N})]},a.id)}function DS({assertion:a,result:r,badges:i,isReadOnly:o,onUpdate:u,onDelete:p}){const[f,h]=v.useState(!1),[x,m]=v.useState(a.text),[y,g]=v.useState(!1),j=()=>{u(x),h(!1)};return n.jsx("div",{className:"rounded-lg px-3 py-2.5 transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:n.jsxs("div",{className:"flex items-start gap-2",children:[r?n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(i==null?void 0:i.regression)&&n.jsx("span",{className:"mt-0.5 flex-shrink-0",title:"Regression: was passing, now failing",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:18,color:"var(--red)",fontSize:14,fontWeight:700,lineHeight:1},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:a.id}),(i==null?void 0:i.flaky)&&n.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--yellow-muted)",color:"var(--yellow)",whiteSpace:"nowrap"},children:"Flaky"}),(i==null?void 0:i.nonDiscriminating)&&n.jsx("span",{title:"Non-discriminating: passes on both skill and baseline runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--surface-3)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"Non-Discrim."})]}),f?n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{value:x,onChange:S=>m(S.target.value),onKeyDown:S=>{S.key==="Enter"&&j(),S.key==="Escape"&&h(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),n.jsx("button",{onClick:j,className:"btn btn-primary text-[11px]",children:"Save"})]}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(m(a.text),h(!0))},children:a.text}),(r==null?void 0:r.reasoning)&&n.jsx("button",{onClick:()=>g(!y),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:y?"Hide reasoning":"Show reasoning"}),y&&(r==null?void 0:r.reasoning)&&n.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:r.reasoning})]}),!o&&n.jsx("button",{onClick:p,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:S=>{S.currentTarget.style.color="var(--red)",S.currentTarget.style.opacity="1"},onMouseLeave:S=>{S.currentTarget.style.color="var(--text-tertiary)",S.currentTarget.style.opacity=""},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function Xi({title:a,action:r,children:i}){return n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),r]}),i]})}function dg({result:a}){const[r,i]=v.useState(!1);if(!a||a.status==null)return n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const o=a.status==="pass",u=a.passRate??0,f=cg(o?"PASS":"FAIL",u);return n.jsxs("span",{className:"pill text-[10px]",style:{background:o?"var(--green-muted)":"var(--red-muted)",color:o?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"aria-describedby":r?"verdict-tooltip":void 0,children:[a.passRate!=null?`${Math.round(a.passRate*100)}%`:a.status,r&&n.jsx("div",{id:"verdict-tooltip",role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,padding:"6px 10px",background:"var(--surface-4)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:11,color:"var(--text-secondary)",whiteSpace:"nowrap",zIndex:50,maxWidth:300,width:"max-content",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:f.explanation})]})}function _S({passRate:a}){const r=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-1",children:n.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:n.jsx("div",{className:"h-full rounded-full",style:{width:`${r}%`,background:r>=80?"var(--green)":r>=50?"var(--yellow)":"var(--red)"}})})})}function OS({output:a,durationMs:r,tokens:i}){const[o,u]=v.useState(!1);return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:()=>u(!o),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:o?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",r!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",(r/1e3).toFixed(1),"s)"]}),i!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",i," tokens)"]})]}),o&&n.jsx("pre",{className:"text-[12px] p-4 rounded-lg overflow-auto animate-fade-in",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:400,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})]})}function Qu(a){return a==="baseline"?"right":a==="comparison"?"full":"left"}function Zu({entry:a}){return n.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:sg(a.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:a.type==="benchmark"?"var(--accent-muted)":a.type==="comparison"?"var(--purple-muted)":"var(--orange-muted)",color:a.type==="benchmark"?"var(--accent)":a.type==="comparison"?"var(--purple)":"var(--orange)"},children:a.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:mr(a.pass_rate)},children:[Math.round(a.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[a.durationMs!=null&&n.jsx("span",{children:ig(a.durationMs)}),a.tokens!=null&&n.jsxs("span",{children:[a.tokens>=1e3?`${(a.tokens/1e3).toFixed(1)}k`:a.tokens," tok"]})]}),a.type==="comparison"&&a.baselinePassRate!=null&&(()=>{const r=a.pass_rate-a.baselinePassRate,i=r>.001?"skill":r<-.001?"baseline":"tie",o=r>0?"+":"",u=i==="skill"?"var(--green)":i==="baseline"?"var(--red)":"var(--text-tertiary)";return n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:r>=0?"var(--green)":"var(--red)"},children:[o,(r*100).toFixed(1),"%"]}),n.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"var(--surface-3)",color:u},children:i})]})})(),n.jsx("div",{className:"space-y-0.5",children:a.assertions.map(r=>n.jsxs("div",{className:"flex items-start gap-1.5",children:[n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:r.text})]},r.id))})]})}function BS({evalId:a,sharedEntries:r,sharedLoading:i}){const{state:o,dispatch:u}=kn(),{plugin:p,skill:f}=o,[h,x]=v.useState(!0),m=r??null,y=i??!1,g=v.useCallback(()=>{x(L=>!L)},[]),j=m?m.slice(0,10):[],S=j.some(L=>{const T=Qu(L.type);return T==="left"||T==="full"}),N=j.some(L=>{const T=Qu(L.type);return T==="right"||T==="full"});return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:g,className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:h?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",m&&m.length>0&&n.jsxs("span",{style:{fontWeight:400},children:["(",m.length," run",m.length!==1?"s":"",")"]})]}),h&&n.jsx("div",{className:"animate-fade-in",children:y?n.jsxs("div",{className:"flex items-center gap-2 py-3",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!m||m.length===0?n.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):n.jsxs("div",{children:[j.length>=2&&n.jsx("div",{className:"mb-2",children:n.jsx(og,{entries:j})}),n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!S&&n.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!N&&n.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),j.map((L,T)=>{const k=Qu(L.type);return k==="full"?n.jsx("div",{style:{gridColumn:"1 / -1"},children:n.jsx(Zu,{entry:L})},T):k==="left"?n.jsxs(v.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"},children:n.jsx(Zu,{entry:L})}),n.jsx("div",{style:{gridColumn:"2"}})]},T):n.jsxs(v.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"}}),n.jsx("div",{style:{gridColumn:"2"},children:n.jsx(Zu,{entry:L})})]},T)})]}),n.jsx("button",{onClick:()=>u({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:L=>{L.currentTarget.style.textDecoration="underline"},onMouseLeave:L=>{L.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Wx({evals:a,onSave:r,onCancel:i}){const[o,u]=v.useState(""),[p,f]=v.useState(""),[h,x]=v.useState(""),[m,y]=v.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[g,j]=v.useState("unit"),[S,N]=v.useState(""),[L,T]=v.useState([]),[k,M]=v.useState(""),[O,V]=v.useState(""),A=Math.max(0,...a.evals.map(R=>R.id))+1,U=R=>{j(R),R==="unit"&&(T([]),N(""),M(""),V(""))},w=()=>{const R=S.trim().toUpperCase();R&&!L.includes(R)&&T([...L,R]),N("")},D=()=>{if(!o.trim()||!p.trim())return;const R={id:A,name:o.trim(),prompt:p.trim(),expected_output:h.trim(),files:[],assertions:m.filter(I=>I.text.trim()),...g==="integration"?{testType:"integration",...L.length>0?{requiredCredentials:L}:{},...k||O?{requirements:{...k?{platform:k}:{},...O?{chromeProfile:O}:{}}}:{}}:{}};r({...a,evals:[...a.evals,R]})};return n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center animate-overlay-in",style:{background:"rgba(0,0,0,0.6)"},children:n.jsxs("div",{className:"w-full max-w-lg rounded-xl p-6 animate-modal-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",maxHeight:"85vh",overflowY:"auto"},children:[n.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),n.jsxs("div",{className:"mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),n.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(R=>n.jsx("button",{onClick:()=>U(R),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:g===R?R==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:g===R?R==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:R},R))})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),n.jsx("input",{value:o,onChange:R=>u(R.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),n.jsx("textarea",{value:p,onChange:R=>f(R.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),n.jsx("textarea",{value:h,onChange:R=>x(R.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),n.jsxs("div",{className:"mb-4",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),m.map((R,I)=>n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:R.text,onChange:G=>y(m.map((q,te)=>te===I?{...q,text:G.target.value}:q)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),m.length>1&&n.jsx("button",{onClick:()=>y(m.filter((G,q)=>q!==I)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},R.id)),n.jsx("button",{onClick:()=>y([...m,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),g==="integration"&&n.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),n.jsxs("div",{className:"mb-3",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:L.map(R=>n.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[R,n.jsx("button",{onClick:()=>T(L.filter(I=>I!==R)),style:{color:"var(--orange)",lineHeight:1},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},R))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:S,onChange:R=>N(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),w())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),n.jsx("button",{onClick:w,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:k,onChange:R=>M(R.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),n.jsxs("label",{className:"block",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),n.jsx("input",{value:O,onChange:R=>V(R.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{onClick:i,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsx("button",{onClick:D,disabled:!o.trim()||!p.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function IS({evalCase:a,onUpdate:r}){var f,h;const[i,o]=v.useState(""),u=()=>{const x=i.trim().toUpperCase();x&&!(a.requiredCredentials??[]).includes(x)&&r({...a,requiredCredentials:[...a.requiredCredentials??[],x]}),o("")},p=x=>{const m=(a.requiredCredentials??[]).filter(y=>y!==x);r({...a,requiredCredentials:m.length>0?m:void 0})};return n.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(a.requiredCredentials??[]).map(x=>n.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[x,n.jsx("button",{onClick:()=>p(x),style:{color:"var(--orange)",lineHeight:1},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},x))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:i,onChange:x=>o(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),u())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),n.jsx("button",{onClick:u,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:((f=a.requirements)==null?void 0:f.platform)??"",onChange:x=>r({...a,requirements:{...a.requirements,platform:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),n.jsx("input",{value:((h=a.requirements)==null?void 0:h.chromeProfile)??"",onChange:x=>r({...a,requirements:{...a.requirements,chromeProfile:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function Sn(a,r){return r==="free"?"Free":r==="subscription"&&a==null?"Subscription":a==null?"N/A":a>=1?`$${a.toFixed(2)}`:a===0?"$0.00":a>=.001?`$${a.toFixed(4)}`:`$${a.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function fg(a,r){return a==null||r==null?"N/A":`${a.toLocaleString("en-US")} in / ${r.toLocaleString("en-US")} out`}function HS(a){return a==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function US(a,r){let i="";if(r){const u=new Date(r);isNaN(u.getTime())||(i=u.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[a,i].filter(Boolean).join(" · ")}function VS(a,r,i){const o=i===1?"test case":"test cases";if(a===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const u=Math.round(Math.abs(a)*r);if(u===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const p=a>0?"more":"fewer";return`Your skill passes ${u} ${p} assertions across ${i} ${o}`}function Kx(a,r){const i=o=>{const u=o/5*100;return isFinite(u)?Math.round(Math.min(100,Math.max(0,u))):0};return{skill:i(a),baseline:i(r)}}function $S(a){return a==="skill"?{text:"Skill wins",isSkill:!0}:a==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function GS(a,r){const i=a+r,o=i*10,u=i*25,p=f=>f>=60?`${Math.round(f/60)}m`:`${f}s`;return`${p(o)}–${p(u)}`}const PS={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function qS(a,r){if(!a)return null;const i=PS[a];if(i==null||i===0)return null;const o=i*r*.5,u=i*r*2;return`${Sn(o)}–${Sn(u)}`}function YS(){const{state:a,runCase:r,runAll:i,cancelCase:o,cancelAll:u,isReadOnly:p}=kn(),{evals:f,caseRunStates:h,bulkRunActive:x,latestBenchmark:m,inlineResults:y}=a,{config:g}=bl(),j=(f==null?void 0:f.evals)??[],S=v.useMemo(()=>{for(const w of h.values())if(w.status==="running"||w.status==="queued")return!0;return!1},[h]),N=j.filter(w=>{const D=h.get(w.id);return D&&(D.status==="complete"||D.status==="error"||D.status==="cancelled")}).length,L=j.filter(w=>{const D=h.get(w.id);return D&&(D.status==="running"||D.status==="queued")}).length,T=v.useRef(null),[k,M]=v.useState(0);v.useEffect(()=>{if(S&&!T.current&&(T.current=Date.now()),!S){T.current=null,M(0);return}const w=setInterval(()=>{T.current&&M(Math.round((Date.now()-T.current)/1e3))},1e3);return()=>clearInterval(w)},[S]);const O=j.reduce((w,D)=>w+D.assertions.length,0),V=j.length+O,A=v.useMemo(()=>GS(j.length,O),[j.length,O]),U=v.useMemo(()=>qS((g==null?void 0:g.provider)??null,V),[g==null?void 0:g.provider,V]);return n.jsxs("div",{className:"p-5",children:[p&&n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-4 text-[11px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),n.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),S&&n.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[L," running"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[S&&n.jsxs("button",{onClick:u,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||S||p,className:"btn btn-primary text-[12px]",title:"Runs both your skill and the baseline, then compares results side by side",children:"Run A/B Test"}),n.jsx("button",{onClick:()=>i("benchmark"),disabled:j.length===0||S||p,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),n.jsx("button",{onClick:()=>i("baseline"),disabled:j.length===0||S||p,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!S&&j.length>0&&n.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("span",{children:["Est. duration: ",A]}),U&&n.jsxs("span",{children:["Est. cost: ",U]}),!U&&(g==null?void 0:g.provider)&&(g.provider==="claude-cli"||g.provider==="codex-cli")&&n.jsx("span",{children:"Cost: Subscription"}),!U&&(g==null?void 0:g.provider)&&(g.provider==="ollama"||g.provider==="lm-studio"||g.provider==="gemini-cli")&&n.jsx("span",{children:"Cost: Free"})]})]}),S&&j.length>0&&n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",N,"/",j.length," cases"]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(N/j.length*100),"%"]})]}),n.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${N/j.length*100}%`,background:"var(--accent)"}})}),n.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",k>=60?`${Math.floor(k/60)}m ${k%60}s`:`${k}s`]}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",A]})]})]}),n.jsx("div",{className:"space-y-3 stagger-children",children:j.map(w=>{const D=y.get(w.id),R=h.get(w.id),I=(R==null?void 0:R.status)??"idle",G=m==null?void 0:m.cases.find(q=>q.eval_id===w.id);return n.jsx(WS,{name:w.name,evalId:w.id,result:D,caseCost:G==null?void 0:G.cost,caseBillingMode:G==null?void 0:G.billingMode,caseInputTokens:G==null?void 0:G.inputTokens,caseOutputTokens:G==null?void 0:G.outputTokens,caseStatus:I,runMode:(R==null?void 0:R.mode)??null,comparisonDetail:G==null?void 0:G.comparisonDetail,isReadOnly:p,onRun:q=>r(q,"benchmark"),onBaseline:q=>r(q,"baseline"),onCompare:q=>r(q,"comparison"),onCancel:q=>o(q)},w.id)})}),!S&&m&&m.cases.length>0&&n.jsxs("div",{className:"mt-5",children:[n.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:HS(m.type)}),n.jsx("span",{className:"text-[20px] font-bold",style:{color:(m.overall_pass_rate??0)>=.8?"var(--green)":(m.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:m.overall_pass_rate!=null?`${Math.round(m.overall_pass_rate*100)}%`:"--"})]}),m.totalDurationMs!=null&&n.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(m.totalDurationMs/1e3).toFixed(1),"s",m.model&&` | Model: ${m.model}`,m.totalInputTokens!=null&&m.totalOutputTokens!=null&&` | Tokens: ${fg(m.totalInputTokens,m.totalOutputTokens)}`,m.totalCost!=null&&` | Cost: ${Sn(m.totalCost)}`]}),m.overall_pass_rate>=.9999&&!m.comparison&&n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||p,className:"text-[13px] font-semibold mt-3 w-full rounded-lg transition-opacity duration-150",style:{padding:"10px 0",background:"var(--green)",color:"var(--color-paper)",border:"none",cursor:"pointer",opacity:j.length===0?.5:1},children:"Run Final A/B Comparison"})]}),m.comparison&&n.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const w=US(m.model,m.timestamp);return w?n.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:w}):n.jsx("div",{className:"mb-3"})})(),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsx(Xx,{label:"Skill",value:m.comparison.skillPassRate,color:"var(--accent)"}),n.jsx(Xx,{label:"Baseline",value:m.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),n.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:m.comparison.delta>0?"var(--green)":m.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",m.comparison.delta>0?"+":"",(m.comparison.delta*100).toFixed(1),"%",m.verdict&&` | ${TS(m.verdict)}`]}),(()=>{const w=m.cases.reduce((R,I)=>R+I.assertions.length,0),D=VS(m.comparison.delta,w,m.cases.length);return n.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:D})})()]})]})]})}const FS={benchmark:{label:"Skill",bg:"var(--accent-muted)",color:"var(--accent)"},baseline:{label:"Baseline",bg:"var(--surface-3)",color:"var(--text-tertiary)"},comparison:{label:"Compare",bg:"var(--purple-muted)",color:"var(--purple)"}};function WS({name:a,evalId:r,result:i,caseCost:o,caseBillingMode:u,caseInputTokens:p,caseOutputTokens:f,caseStatus:h,runMode:x,comparisonDetail:m,isReadOnly:y,onRun:g,onBaseline:j,onCompare:S,onCancel:N}){const[L,T]=v.useState(!1),k=h==="running"||h==="queued",M=h==="complete"||h==="error";return n.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:k?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:k?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[h==="running"&&n.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),h==="queued"&&n.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),n.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",r," ",a]}),x&&(k||M)&&(()=>{const O=FS[x];return O?n.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:O.bg,color:O.color,padding:"1px 6px"},children:O.label}):null})()]}),n.jsxs("div",{className:"flex items-center gap-2",children:[k?n.jsx("button",{onClick:()=>N(r),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>S(r),disabled:y,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),n.jsx("button",{onClick:()=>g(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),n.jsx("button",{onClick:()=>j(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),i&&i.status!=null&&n.jsx("span",{className:"pill text-[10px]",style:{background:i.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:i.status==="pass"?"var(--green)":"var(--red)"},children:i.passRate!=null?`${Math.round(i.passRate*100)}%`:i.status}),p!=null&&f!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:fg(p,f)}),o!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Sn(o,u)}),h==="cancelled"&&n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),i&&i.assertions.length>0&&n.jsxs("div",{className:"px-4 pb-3",children:[n.jsx("div",{className:"space-y-1",children:i.assertions.map(O=>n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{style:{color:O.pass?"var(--green)":"var(--red)"},children:O.pass?"PASS":"FAIL"}),n.jsx("span",{style:{color:"var(--text-secondary)"},children:O.text})]},O.assertion_id))}),i.output&&n.jsx("button",{onClick:()=>T(!L),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:L?"Hide output":"Show output"}),L&&i.output&&n.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:i.output})]}),m&&n.jsx("div",{className:"px-4 pb-3",children:n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:n.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const O=Kx(m.skillContentScore,m.baselineContentScore),V=Kx(m.skillStructureScore,m.baselineStructureScore),A=$S(m.winner);return n.jsxs(n.Fragment,{children:[n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",O.skill,"% / Baseline ",O.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",V.skill,"% / Baseline ",V.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsx("span",{style:{color:A.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:A.text})]})})()})})}),i&&i.errorMessage&&n.jsx(KS,{errorMessage:i.errorMessage,classifiedError:i.classifiedError})]})}const Ju={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function KS({errorMessage:a,classifiedError:r}){const[i,o]=v.useState(!1),u=(r==null?void 0:r.title)??"Error",p=r==null?void 0:r.hint,f=r?Ju[r.category]??Ju.unknown:Ju.unknown;return n.jsx("div",{className:"px-4 pb-3",children:n.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid var(--red-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[n.jsx("span",{style:{fontSize:12},children:f}),n.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:u}),n.jsx("button",{onClick:()=>o(!i),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:i?"Hide details":"Details"})]}),p&&n.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:p}),i&&n.jsx("pre",{className:"text-[10px] px-3 pb-2.5 overflow-auto",style:{color:"var(--text-tertiary)",maxHeight:120,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:a})]})})}function Xx({label:a,value:r,color:i}){return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:a}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i},children:[Math.round(r*100),"%"]})]}),n.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r*100}%`,background:i}})})]})}const Qx={TP:{bg:"var(--green-muted)",text:"var(--green)"},TN:{bg:"var(--green-muted)",text:"var(--green)"},FP:{bg:"var(--red-muted)",text:"var(--red)"},FN:{bg:"var(--red-muted)",text:"var(--red)"}};function XS(){const{state:a,dispatch:r,runActivationTest:i,cancelActivation:o,generateActivationPrompts:u}=kn(),{plugin:p,skill:f,activationPrompts:h,activationResults:x,activationSummary:m,activationRunning:y,activationError:g,activationStartedAt:j,activationClassifyingStatus:S,generatingPrompts:N,generatingPromptsError:L,activationHistory:T}=a,[k,M]=v.useState(h),[O,V]=v.useState(null),[A,U]=v.useState(!1);v.useEffect(()=>{h&&h!==k&&M(h)},[h]),v.useEffect(()=>{r({type:"SET_ACTIVATION_PROMPTS",prompts:k})},[k,r]),v.useEffect(()=>{fetch(`/api/skills/${p}/${f}/description`).then(z=>z.json()).then(z=>V(z.rawContent||z.description||null)).catch(()=>V(null))},[p,f]);function w(){i(k)}function D(){u(8)}const R=k.trim().split(`
|
|
70
|
+
`).filter(Boolean).length,I=x.filter(z=>z.classification==="TP"||z.classification==="TN"),G=x.filter(z=>z.classification==="FP"||z.classification==="FN"),q=(O==null?void 0:O.replace(/^---[\s\S]*?---\s*/,"").trim())??null,te=k.trim().length>0,Q=q?bo(q):"";return n.jsxs("div",{className:"p-5 space-y-5",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),n.jsx("div",{className:"text-[12px] mt-0.5",style:{color:"var(--text-tertiary)"},children:"Test whether this skill's description activates for relevant prompts and stays silent for irrelevant ones."})]}),n.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[n.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),n.jsx("div",{className:"flex gap-1.5",children:n.jsx("button",{onClick:D,disabled:N||!q||y,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:N?"var(--surface-3)":"var(--surface-2)",color:q?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:q?1:.5,cursor:q?"pointer":"not-allowed"},title:q?void 0:"No skill description available",onMouseEnter:z=>{q&&!N&&(z.currentTarget.style.background="var(--surface-3)")},onMouseLeave:z=>{N||(z.currentTarget.style.background="var(--surface-2)")},children:N?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{borderTopColor:"var(--accent)",borderColor:"var(--border-subtle)",width:10,height:10}}),"Generating..."]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3v3m6.36.64l-2.12 2.12M21 12h-3m-.64 6.36l-2.12-2.12M12 21v-3m-4.24.64l2.12-2.12M3 12h3m.64-6.36l2.12 2.12"})}),te?"Regenerate":"Generate"," Test Prompts"]})})})]}),!q&&!y&&n.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},"aria-live":"polite",children:"Add a description to your skill's frontmatter to enable prompt generation."}),L&&n.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:L}),n.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:k,onChange:z=>M(z.target.value),placeholder:`How do I write a unit test?
|
|
71
71
|
What edge cases should I test?
|
|
72
72
|
+Deploy this to production
|
|
73
73
|
!What's the weather like today?
|
|
74
|
-
!Write me a poem about flowers`}),n.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:"One prompt per line"}),n.jsx(Qi,{}),n.jsx("span",{children:"No prefix = auto-classify"}),n.jsx(Qi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),n.jsx(Qi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),n.jsx(Qi,{}),n.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[R," prompt",R!==1?"s":""]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:w,disabled:y||!k.trim(),className:"btn btn-primary",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{borderTopColor:"var(--color-paper)",borderColor:"var(--border-default)",width:14,height:14}}),"Testing..."]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[S||`${x.length} / ${R} prompts tested`,j&&n.jsx(ek,{startedAt:j})]})]})]})]}),n.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[n.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),n.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:Y?n.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:q}}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),g&&n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:g}),y&&x.length===0&&n.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[n.jsx("div",{className:"spinner-lg mx-auto mb-4"}),n.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),x.length>0&&n.jsxs("div",{className:"space-y-5",children:[G.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),n.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",G.length,")"]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:G.map((_,E)=>n.jsx(Qx,{result:_},`incorrect-${E}`))})]}),I.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"16 10 11 15 8 12"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",I.length,")"]})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:I.map((_,E)=>n.jsx(Qx,{result:_},`correct-${E}`))})]})]}),m&&n.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),m.autoClassifiedCount!=null&&m.autoClassifiedCount>0&&n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[m.autoClassifiedCount," of ",m.total," prompts auto-classified from skill name and tags"]}),n.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[n.jsx(ed,{label:"Precision",value:m.precision,description:"Of all activations, how many were correct?",detail:`${m.tp} true / ${m.tp+m.fp} total activations`}),n.jsx(ed,{label:"Recall",value:m.recall,description:"Of expected activations, how many fired?",detail:`${m.tp} activated / ${m.tp+m.fn} expected`}),n.jsx(ed,{label:"Reliability",value:m.reliability,description:"Overall correct classification rate",detail:`${m.tp+m.tn} correct / ${m.total} total`})]}),n.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[n.jsx(Zi,{label:"True Positive",abbr:"TP",count:m.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),n.jsx(Zi,{label:"False Positive",abbr:"FP",count:m.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),n.jsx(Zi,{label:"False Negative",abbr:"FN",count:m.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),n.jsx(Zi,{label:"True Negative",abbr:"TN",count:m.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),n.jsx(QS,{history:T,expanded:A,onToggle:()=>U(!A)})]})}function QS({history:a,expanded:r,onToggle:i}){return a===null?null:n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:r?"1px solid var(--border-subtle)":"none"},onClick:i,children:[n.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",a.length>0&&n.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",a.length," run",a.length!==1?"s":"",")"]})]}),n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:r?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),r&&n.jsx("div",{className:"px-4 py-3",children:a.length===0?n.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):n.jsx("div",{className:"space-y-2",children:a.map(o=>n.jsx(ZS,{run:o},o.id))})})]})}function ZS({run:a}){const r=Math.round(a.summary.reliability*100),i=r>=80?"var(--green)":r>=60?"var(--yellow)":"var(--red)",o=r>=80?"Good":r>=60?"Needs Work":"Poor",u=i;return n.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:JS(a.timestamp)}),n.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:a.model||a.provider}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.promptCount," prompts"]})]})}),n.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i,fontVariantNumeric:"tabular-nums"},children:[r,"%"]}),n.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:u,background:`color-mix(in srgb, ${u} 10%, transparent)`},children:o})]})]})}function JS(a){const r=Date.now(),i=new Date(a).getTime(),o=Math.floor((r-i)/1e3);if(o<60)return"just now";const u=Math.floor(o/60);if(u<60)return`${u}m ago`;const p=Math.floor(u/60);if(p<24)return`${p}h ago`;const f=Math.floor(p/24);return f<7?`${f}d ago`:new Date(a).toLocaleDateString()}function Qi(){return n.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Qx({result:a}){const r=Xx[a.classification]||Xx.FN,i=a.classification==="TP"||a.classification==="TN";return n.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:r.bg,border:"1px solid transparent"},children:[n.jsx("div",{className:"flex-shrink-0 mt-0.5",children:n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${r.text} 20%, transparent)`},children:i?n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"flex items-center gap-2 mb-1",children:n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:a.prompt})}),n.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[n.jsx("span",{className:"pill",style:{background:"var(--surface-3)",color:r.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:a.classification}),n.jsx("span",{style:{color:a.activate?"var(--green)":"var(--text-tertiary)"},children:a.activate?"Activated":"Silent"}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",a.expected==="should_activate"?"activate":"stay silent"]}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[a.confidence," confidence"]}),a.autoClassified&&n.jsx("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),a.reasoning&&n.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:a.reasoning})]})]})}function ed({label:a,value:r,description:i,detail:o}){const u=Math.round(r*100),p=u>=80?"var(--green)":u>=60?"var(--yellow)":"var(--red)";return n.jsxs("div",{className:"text-center",children:[n.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:p},children:[u,"%"]}),n.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:a}),n.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:i}),n.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function Zi({abbr:a,count:r,bg:i,color:o,description:u}){return n.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:i},children:[n.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:r}),n.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:a}),n.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:u})]})}function ek({startedAt:a}){const[r,i]=v.useState(0);return v.useEffect(()=>{const o=setInterval(()=>i(Math.floor((Date.now()-a)/1e3)),1e3);return()=>clearInterval(o)},[a]),n.jsxs("span",{className:"ml-2",children:["(",r,"s)"]})}const td={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Zx={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},jd=600,Sd=180,tn=40,nd=jd-tn*2,Pa=Sd-tn*2,tk=[25,50,75,100];function Jx(a){return new Date(a).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function nk(a){return a==null?"--":`${(a/1e3).toFixed(1)}s`}function ak({entries:a,onPointClick:r}){const[i,o]=v.useState(null),u=v.useMemo(()=>[...a].reverse(),[a]);if(u.length<2)return null;const p=u.length,f=u.map((m,y)=>{const g=tn+y/(p-1)*nd,j=m.passRate*100,S=tn+Pa-j/100*Pa;return{x:g,y:S,pct:j,entry:m}}),h=f.map(m=>`${m.x},${m.y}`).join(" "),x=Array.from(new Set(u.map(m=>m.type)));return n.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:p>=20?"auto":void 0},children:[n.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),n.jsx("div",{className:"flex items-center gap-5 mb-3",children:x.map(m=>n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:td[m]??"var(--text-tertiary)"}}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Zx[m]??m})]},m))}),n.jsxs("svg",{width:jd,height:Sd,viewBox:`0 0 ${jd} ${Sd}`,style:{display:"block",overflow:"visible"},children:[tk.map(m=>{const y=tn+Pa-m/100*Pa;return n.jsxs("g",{children:[n.jsx("line",{x1:tn,y1:y,x2:tn+nd,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),n.jsxs("text",{x:tn-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[m,"%"]})]},m)}),n.jsx("line",{x1:tn,y1:tn+Pa,x2:tn+nd,y2:tn+Pa,stroke:"var(--border-subtle)",strokeWidth:1}),n.jsx("text",{x:tn-8,y:tn+Pa+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),n.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),f.map((m,y)=>n.jsx("circle",{cx:m.x,cy:m.y,r:5,fill:td[m.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:g=>{g.currentTarget.setAttribute("r","7"),o({x:m.x,y:m.y,entry:m.entry})},onMouseLeave:g=>{g.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>r==null?void 0:r(m.entry)},y)),lk(p).map(m=>n.jsx("text",{x:f[m].x,y:tn+Pa+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Jx(u[m].timestamp)},m))]}),i&&n.jsxs("div",{style:{position:"absolute",left:i.x,top:i.y-12,transform:"translate(-50%, -100%)",background:"var(--surface-3)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"8px 12px",pointerEvents:"none",zIndex:10,whiteSpace:"nowrap"},children:[n.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:Jx(i.entry.timestamp)}),n.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:i.entry.model}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:td[i.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Zx[i.entry.type]??i.entry.type}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(i.entry.passRate*100),"%"]})]}),n.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:nk(i.entry.totalDurationMs)}),n.jsx("span",{children:i.entry.totalTokens!=null?`${i.entry.totalTokens} tokens`:"--"})]})]})]})}function lk(a){if(a<=3)return Array.from({length:a},(o,u)=>u);if(a<=6)return[0,Math.floor(a/2),a-1];if(a<20)return[0,Math.floor(a/3),Math.floor(2*a/3),a-1];const r=Math.ceil(a/10),i=[0];for(let o=r;o<a-1;o+=r)i.push(o);return i.push(a-1),i}const xs=new Map;let nn=null,so=null,Ji=1e3,vs=0;function pg(){if(nn)return;nn=new EventSource("/api/events");const a=r=>i=>{let o={};try{o=i.data?JSON.parse(i.data):{}}catch{}const u=xs.get(r);if(u)for(const p of u)p(o)};nn.addEventListener("benchmark:complete",a("benchmark:complete")),nn.addEventListener("history:written",a("history:written")),nn.addEventListener("leaderboard:updated",a("leaderboard:updated")),nn.onerror=()=>{nn==null||nn.close(),nn=null,vs>0&&(so=setTimeout(()=>{Ji=Math.min(Ji*2,3e4),pg()},Ji))},nn.onopen=()=>{Ji=1e3}}function rk(){so!=null&&(clearTimeout(so),so=null),nn==null||nn.close(),nn=null}function sk(a,r){return xs.has(a)||xs.set(a,new Set),xs.get(a).add(r),vs++,pg(),()=>{var i;(i=xs.get(a))==null||i.delete(r),vs--,vs<=0&&(vs=0,rk())}}function fo(a,r){const i=v.useRef(r);i.current=r,v.useEffect(()=>sk(a,u=>i.current(u)),[a])}function po(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function ik(a){return a>=1e3?`${(a/1e3).toFixed(1)}s`:`${Math.round(a)}ms`}function ok({rate:a,label:r}){const i=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-3",children:n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:r}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:po(a)},children:[i,"%"]})]}),n.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${i}%`,background:po(a)}})})]})})}function ck({points:a}){if(a.length<2)return null;const r=200,i=48,o=4,u=a.length,p=a.map((x,m)=>{const y=o+m/(u-1)*(r-o*2),g=o+(i-o*2)-x.passRate*(i-o*2);return{x:y,y:g}}),f=`M ${p[0].x},${i-o} `+p.map(x=>`L ${x.x},${x.y}`).join(" ")+` L ${p[p.length-1].x},${i-o} Z`,h=p.map((x,m)=>`${m===0?"M":"L"} ${x.x},${x.y}`).join(" ");return n.jsxs("svg",{width:r,height:i,style:{display:"block"},children:[n.jsx("path",{d:f,fill:"var(--accent-muted)"}),n.jsx("path",{d:h,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),n.jsx("circle",{cx:p[p.length-1].x,cy:p[p.length-1].y,r:3,fill:"var(--accent)"})]})}function uk({plugin:a,skill:r}){const i=`stats/${a}/${r}`,o=v.useCallback(()=>Ne.getStats(a,r),[a,r]),{data:u,loading:p}=zs(i,o),f=v.useCallback(()=>Xn(i),[i]);if(fo("benchmark:complete",f),fo("history:written",f),p)return n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"skeleton h-24 rounded-xl"}),n.jsx("div",{className:"skeleton h-48 rounded-xl"}),n.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!u||u.totalRuns===0)return n.jsxs("div",{className:"text-center py-12",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),n.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const h=u.trendPoints.length>0?u.trendPoints[u.trendPoints.length-1].passRate:0,x=u.trendPoints.length>0?u.trendPoints[0].passRate:0,m=h-x,y=u.assertionStats.slice(0,10);return n.jsxs("div",{className:"space-y-4 stagger-children",children:[n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:u.totalRuns})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:po(h)},children:[Math.round(h*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:m>=0?"var(--green)":"var(--red)"},children:[m>=0?"+":"",Math.round(m*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:u.modelStats.length})]}),u.totalCost!=null&&n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),n.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Sn(u.totalCost)})]}),u.costPerRun!=null&&n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),n.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Sn(u.costPerRun)})]})]}),u.trendPoints.length>=2&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),n.jsx(ck,{points:u.trendPoints})]}),u.modelStats.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[n.jsx("thead",{children:n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),n.jsx("tbody",{children:u.modelStats.map(g=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:g.model}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:g.runs}),n.jsx("td",{style:{padding:"8px",textAlign:"center"},children:n.jsxs("span",{className:"font-semibold",style:{color:po(g.avgPassRate)},children:[Math.round(g.avgPassRate*100),"%"]})}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:ik(g.avgDurationMs)}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:g.avgCost!=null?Sn(g.avgCost):"N/A"})]},g.model))})]})]}),y.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),n.jsx("div",{className:"space-y-3",children:y.map(g=>n.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:j=>{j.currentTarget.style.background="var(--surface-2)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},onClick:()=>{},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsxs("span",{className:"text-[10px] font-mono px-1 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",g.evalId]}),n.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:g.evalName}),n.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[g.totalRuns," runs"]})]}),n.jsx(ok,{rate:g.passRate,label:g.text})]},`${g.evalId}:${g.id}`))})]})]})}function dk({plugin:a,skill:r}){const[i,o]=v.useState(null),[u,p]=v.useState(null),[f,h]=v.useState({}),[x,m]=v.useState({});v.useEffect(()=>{Ne.getEvals(a,r).then(o).catch(()=>o(null))},[a,r]);async function y(g){if(u===g){p(null);return}if(p(g),!f[g]){m(j=>({...j,[g]:!0}));try{const j=await Ne.getCaseHistory(a,r,g);h(S=>({...S,[g]:j}))}catch{h(j=>({...j,[g]:[]}))}finally{m(j=>({...j,[g]:!1}))}}}return i?n.jsx("div",{className:"space-y-2 stagger-children",children:i.evals.map(g=>{const j=f[g.id]||[],S=u===g.id,N=x[g.id],z=j.length>0?j[0].pass_rate:null;return n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{onClick:()=>y(g.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:S?"var(--surface-2)":"transparent"},onMouseEnter:T=>{S||(T.currentTarget.style.background="var(--surface-2)")},onMouseLeave:T=>{S||(T.currentTarget.style.background="transparent")},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:S?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),n.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",g.id]}),n.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:g.name}),j.length>=2&&n.jsx(og,{entries:j}),z!=null&&n.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:mr(z)},children:[Math.round(z*100),"%"]}),j.length>0&&n.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[j.length," runs"]})]}),S&&n.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:N?n.jsxs("div",{className:"p-4 flex items-center gap-2",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):j.length===0?n.jsx("div",{className:"p-4",children:n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):n.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:j.map((T,k)=>n.jsxs("div",{className:"p-4",style:{background:k===0?"var(--surface-2)":"transparent"},children:[n.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:sg(T.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:T.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:T.type==="benchmark"?"rgba(99,131,255,0.15)":T.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:T.type==="benchmark"?"#6383ff":T.type==="comparison"?"var(--purple)":"#fb923c"},children:T.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:mr(T.pass_rate)},children:[Math.round(T.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[T.durationMs!=null&&n.jsx("span",{children:ig(T.durationMs)}),T.tokens!=null&&n.jsxs("span",{children:[T.tokens>=1e3?`${(T.tokens/1e3).toFixed(1)}k`:T.tokens," tok"]})]}),n.jsx("div",{className:"space-y-1",children:T.assertions.map(M=>n.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[n.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:M.pass?"var(--green)":"var(--red)"},children:n.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:M.pass?n.jsx("polyline",{points:"20 6 9 17 4 12"}):n.jsxs(n.Fragment,{children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:M.text}),M.reasoning&&n.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:M.reasoning})]})]},M.id))})]},k))})})]},g.id)})}):n.jsx("div",{className:"text-center py-12",children:n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function fk(){const{state:a,dispatch:r}=kn(),{plugin:i,skill:o}=a,[u,p]=v.useState("timeline"),[f,h]=v.useState(""),[x,m]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState([]),[N,z]=v.useState(null),[T,k]=v.useState(!1),[M,O]=v.useState(null),[V,A]=v.useState(!1),U=`history/${i}/${o}?model=${f}&type=${x}`,w=v.useCallback(()=>Ne.getHistory(i,o,{model:f||void 0,type:x||void 0}),[i,o,f,x]),{data:L,loading:R}=zs(U,w),I=L??[];v.useEffect(()=>{!L||L.length<2||Ne.compareRuns(i,o,L[0].timestamp,L[1].timestamp).then(_=>{const E=_.regressions.filter(B=>B.change==="regression");r({type:"SET_REGRESSIONS",regressions:E})}).catch(()=>{})},[L,i,o,r]);const G=v.useCallback(()=>Xn(U),[U]);fo("history:written",G);const Y=v.useCallback(async _=>{if(y){S(E=>E.includes(_)?E.filter(B=>B!==_):E.length>=2?[E[1],_]:[...E,_]);return}A(!0);try{const E=await Ne.getHistoryEntry(i,o,_);O(E)}catch{}finally{A(!1)}},[i,o,y]),te=v.useCallback(async()=>{if(j.length===2){k(!0);try{const _=await Ne.compareRuns(i,o,j[0],j[1]);z(_)}catch{}finally{k(!1)}}},[i,o,j]),q=[...new Set(I.map(_=>_.model))];return R?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"skeleton h-12 rounded-lg"}),n.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(_=>n.jsx("button",{onClick:()=>p(_),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:u===_?"var(--accent-muted)":"transparent",color:u===_?"var(--accent)":"var(--text-tertiary)"},children:_==="timeline"?"Timeline":_==="per-eval"?"Per Eval":"Statistics"},_))}),u==="timeline"&&n.jsxs("div",{children:[I.length>0&&n.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:n.jsx(ak,{entries:I,onPointClick:_=>Y(_.timestamp)})}),n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("select",{value:f,onChange:_=>h(_.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Models"}),q.map(_=>n.jsx("option",{value:_,children:_},_))]}),n.jsxs("select",{value:x,onChange:_=>m(_.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Types"}),n.jsx("option",{value:"benchmark",children:"Benchmark"}),n.jsx("option",{value:"comparison",children:"Comparison"}),n.jsx("option",{value:"baseline",children:"Baseline"}),n.jsx("option",{value:"model-compare",children:"Model Compare"}),n.jsx("option",{value:"improve",children:"AI Improve"}),n.jsx("option",{value:"instruct",children:"AI Edit"}),n.jsx("option",{value:"ai-generate",children:"AI Generate"}),n.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),n.jsx("div",{className:"flex-1"}),n.jsx("button",{onClick:()=>{g(!y),S([]),z(null)},className:`btn text-[12px] ${y?"btn-primary":"btn-secondary"}`,children:y?"Exit Compare":"Compare Runs"}),y&&j.length===2&&n.jsx("button",{onClick:te,disabled:T,className:"btn btn-primary text-[12px]",children:T?"Comparing...":"Compare"})]}),n.jsx("div",{className:"space-y-2",children:I.length===0?n.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):I.map(_=>{const E=j.includes(_.timestamp);return n.jsx("button",{onClick:()=>Y(_.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:E?"var(--accent-muted)":"var(--surface-1)",border:E?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:B=>{E||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{E||(B.currentTarget.style.borderColor="var(--border-subtle)")},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[y&&n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:E?"var(--accent)":"var(--border-default)",background:E?"var(--accent)":"transparent"},children:E&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(_.timestamp).toLocaleString()}),n.jsx("span",{className:"pill text-[9px]",style:{background:_.type==="comparison"?"var(--purple-muted)":_.type==="baseline"?"var(--surface-3)":_.type==="model-compare"?"var(--accent-muted)":_.type==="improve"||_.type==="instruct"?"var(--purple-muted)":_.type==="ai-generate"?"var(--green-muted)":_.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:_.type==="comparison"?"var(--purple)":_.type==="baseline"?"var(--text-tertiary)":_.type==="model-compare"?"var(--accent)":_.type==="improve"||_.type==="instruct"?"var(--purple)":_.type==="ai-generate"?"var(--green)":_.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:_.type==="model-compare"?"model compare":_.type==="improve"?"ai improve":_.type==="instruct"?"ai edit":_.type==="ai-generate"?"ai generate":_.type==="eval-generate"?"eval generate":_.type})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:_.model}),_.totalCost!=null&&_.totalCost>0&&n.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:Sn(_.totalCost)}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:_.passRate>=.8?"var(--green)":_.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(_.passRate*100),"%"]})]})]})},_.timestamp)})}),N&&n.jsx(pk,{result:N}),M&&!y&&n.jsx(mk,{run:M,onClose:()=>O(null)})]}),u==="per-eval"&&n.jsx(dk,{plugin:i,skill:o}),u==="statistics"&&n.jsx(uk,{plugin:i,skill:o})]})}function pk({result:a}){const r=a.regressions.filter(o=>o.change==="regression"),i=a.regressions.filter(o=>o.change==="improvement");return n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(a.runA.timestamp).toLocaleDateString()," vs ",new Date(a.runB.timestamp).toLocaleDateString()]}),(a.runA.totalCost!=null||a.runB.totalCost!=null)&&n.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[n.jsxs("span",{children:["Run A cost: ",Sn(a.runA.totalCost??null)]}),n.jsxs("span",{children:["Run B cost: ",Sn(a.runB.totalCost??null)]}),a.runA.totalCost!=null&&a.runB.totalCost!=null&&n.jsxs("span",{style:{color:a.runB.totalCost<=a.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",Sn(a.runB.totalCost-a.runA.totalCost)]})]}),r.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",r.length,")"]}),r.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),i.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",i.length,")"]}),i.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),n.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:n.jsxs("table",{className:"w-full text-[12px]",children:[n.jsx("thead",{children:n.jsxs("tr",{style:{background:"var(--surface-2)"},children:[n.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),n.jsx("tbody",{children:a.caseDiffs.map(o=>n.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateA!=null?o.passRateA>=.8?"var(--green)":o.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateA!=null?`${Math.round(o.passRateA*100)}%`:o.statusA}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateB!=null?o.passRateB>=.8?"var(--green)":o.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateB!=null?`${Math.round(o.passRateB*100)}%`:o.statusB})]},o.eval_id))})]})})]})}function mk({run:a,onClose:r}){return(a.type==="improve"||a.type==="instruct")&&a.improve?n.jsx(hk,{run:a,onClose:r}):n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(a.timestamp).toLocaleString()]}),n.jsx("button",{onClick:r,className:"btn btn-ghost text-[11px]",children:"Close"})]}),n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",a.model," | Cases: ",a.cases.length," | Pass Rate: ",a.overall_pass_rate!=null?`${Math.round(a.overall_pass_rate*100)}%`:"--",a.totalCost!=null&&a.totalCost>0&&` | Cost: ${Sn(a.totalCost)}`]}),n.jsx("div",{className:"space-y-2",children:a.cases.map(i=>n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",i.eval_id," ",i.eval_name]}),n.jsxs("div",{className:"flex items-center gap-2",children:[i.cost!=null&&i.cost>0&&n.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:Sn(i.cost)}),n.jsx("span",{className:"text-[11px] font-semibold",style:{color:i.status==="pass"?"var(--green)":"var(--red)"},children:i.pass_rate!=null?`${Math.round(i.pass_rate*100)}%`:i.status})]})]})},i.eval_id))})]})}function hk({run:a,onClose:r}){var p;const i=v.useMemo(()=>a.improve?jo(a.improve.original,a.improve.improved):[],[a.improve]),o=v.useMemo(()=>{const f=i.filter(x=>x.type==="added").length,h=i.filter(x=>x.type==="removed").length;return{added:f,removed:h}},[i]),u=v.useMemo(()=>{let f=0,h=0;return i.map(x=>x.type==="removed"?(f++,{...x,origNum:f,newNum:null}):x.type==="added"?(h++,{...x,origNum:null,newNum:h}):(f++,h++,{...x,origNum:f,newNum:h}))},[i]);return n.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"var(--purple-muted)"},children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),n.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(a.timestamp).toLocaleString()," · ",a.model]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),n.jsx("button",{onClick:r,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:f=>{f.currentTarget.style.background="var(--surface-3)"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((p=a.improve)==null?void 0:p.reasoning)&&n.jsxs("div",{className:"mx-4 mt-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--purple-muted)",border:"1px solid var(--purple-muted)",color:"var(--text-secondary)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"var(--purple)"},children:"AI Reasoning: "}),a.improve.reasoning]}),n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:u.map((f,h)=>n.jsxs("tr",{style:{background:f.type==="added"?"var(--green-muted)":f.type==="removed"?"var(--red-muted)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="removed"?"var(--red)":"var(--text-tertiary)",opacity:f.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="added"?"var(--green)":"var(--text-tertiary)",opacity:f.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"transparent",borderRight:f.type==="added"?"2px solid var(--green)":f.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:f.type==="added"?"+":f.type==="removed"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"var(--text-secondary)"},children:f.content||""})]},h))})})})]})}function xk({plugin:a,skill:r}){const[i,o]=v.useState([]),[u,p]=v.useState([]),[f,h]=v.useState(!0),[x,m]=v.useState(null);v.useEffect(()=>{Ne.getDependencies(a,r).then(g=>{o(g.mcpDependencies),p(g.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[a,r]);async function y(g,j){try{await navigator.clipboard.writeText(j),m(g),setTimeout(()=>m(null),2e3)}catch{}}return f?null:i.length===0&&u.length===0?n.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:"No dependencies detected"}):n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:i.length+u.length})]}),n.jsxs("div",{className:"px-5 py-4",children:[i.length>0&&n.jsxs("div",{className:"space-y-3 mb-4",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),i.map(g=>n.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:g.server}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.transport})]}),n.jsx("button",{onClick:()=>y(g.server,g.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:x===g.server?"var(--green)":"var(--accent)"},children:x===g.server?n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})," Copy Config"]})})]}),n.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:g.url}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.matchedTools.map(j=>n.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:j},j))})]},g.server))]}),u.length>0&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),n.jsx("div",{className:"space-y-1.5",children:u.map(g=>n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:g.name}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.source==="frontmatter"?"frontmatter":"referenced"})]},g.name))})]})]})]})}function ev({plugin:a,skill:r}){const[i,o]=v.useState([]),[u,p]=v.useState(!0),[f,h]=v.useState(null),[x,m]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState(null),[N,z]=v.useState(""),[T,k]=v.useState(""),[M,O]=v.useState(!1),[V,A]=v.useState(new Set),U=v.useCallback(async()=>{p(!0);try{const[I,G]=await Promise.all([Ne.getCredentials(a,r).catch(()=>({credentials:[]})),Ne.getParams(a,r).catch(()=>({params:[]}))]),Y=new Map(G.params.map(_=>[_.name,_])),te=new Set,q=[];for(const _ of I.credentials){te.add(_.name);const E=Y.get(_.name);q.push({name:_.name,status:_.status==="ready"||_.status==="resolved"?"ready":"missing",source:_.source,maskedValue:E==null?void 0:E.maskedValue})}for(const _ of G.params)te.has(_.name)||q.push({name:_.name,status:_.status,maskedValue:_.maskedValue});o(q)}finally{p(!1)}},[a,r]);v.useEffect(()=>{U()},[U]);const w=v.useCallback(async I=>{if(V.has(I)){A(G=>{const Y=new Set(G);return Y.delete(I),Y}),o(G=>G.map(Y=>Y.name===I?{...Y,revealedValue:void 0}:Y));return}try{const Y=(await Ne.getParamsRevealed(a,r,I)).params.find(te=>te.name===I);Y&&(o(te=>te.map(q=>q.name===I?{...q,revealedValue:Y.value}:q)),A(te=>new Set(te).add(I)))}catch{}},[a,r,V]),L=async(I,G)=>{if(!(!I.trim()||!G.trim())){g(!0),S(null);try{await Ne.setCredential(a,r,I,G),h(null),m(""),A(new Set),U()}catch(Y){S(Y.message)}finally{g(!1)}}},R=async()=>{if(!(!N.trim()||!T.trim())){g(!0),S(null);try{await Ne.setCredential(a,r,N.trim().toUpperCase(),T),z(""),k(""),O(!1),U()}catch(I){S(I.message)}finally{g(!1)}}};return u?n.jsxs("div",{className:"mt-6",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),n.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):n.jsxs("div",{className:"mt-6",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),n.jsx("button",{onClick:()=>O(!M),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),j&&n.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j}),i.length===0&&!M?n.jsx("div",{className:"text-[12px] text-center py-6 rounded-xl",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"No credentials configured for this skill"}):n.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:i.map(I=>n.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:I.name}),I.maskedValue&&n.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:V.has(I.name)&&I.revealedValue!=null?I.revealedValue:I.maskedValue}),I.maskedValue&&n.jsx("button",{onClick:()=>w(I.name),className:"btn btn-ghost px-1",title:V.has(I.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:V.has(I.name)?n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),n.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),n.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),n.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:I.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:I.status==="ready"?"var(--green)":"var(--orange)"},children:I.status==="ready"?"ready":"missing"}),I.source&&n.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:I.source}),f===I.name?n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("input",{value:x,onChange:G=>m(G.target.value),onKeyDown:G=>{G.key==="Enter"&&L(I.name,x)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),n.jsx("button",{onClick:()=>L(I.name,x),disabled:y||!x.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:y?"...":"Save"}),n.jsx("button",{onClick:()=>{h(null),m("")},className:"btn btn-ghost text-[10px] px-1",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):n.jsx("button",{onClick:()=>{h(I.name),m("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},I.name))}),M&&n.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:N,onChange:I=>z(I.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),n.jsx("input",{value:T,onChange:I=>k(I.target.value),onKeyDown:I=>{I.key==="Enter"&&R()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),n.jsxs("div",{className:"flex justify-end gap-1.5",children:[n.jsx("button",{onClick:()=>{O(!1),z(""),k("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),n.jsx("button",{onClick:R,disabled:y||!N.trim()||!T.trim(),className:"btn btn-primary text-[10px]",children:y?"Saving...":"Save"})]})]})]})}function vk(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState(null),[p,f]=v.useState(!0);return v.useEffect(()=>{Ne.getDependencies(r,i).then(u).catch(()=>{}).finally(()=>f(!1))},[r,i]),p?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):o?n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx(xk,{plugin:r,skill:i}),n.jsx(ev,{plugin:r,skill:i})]}):n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),n.jsx(ev,{plugin:r,skill:i})]})}function mg({data:a}){if(a.length<2)return n.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const r=a.slice(-10),i=80,o=24,u=2,p=i-u*2,f=o-u*2,h=r.length,x=Math.min(...r),y=Math.max(...r)-x||1,g=r.map((N,z)=>{const T=u+z/(h-1)*p,k=u+f-(N-x)/y*f;return`${T.toFixed(1)},${k.toFixed(1)}`}),j=r[r.length-1],S=mr(j);return n.jsxs("svg",{width:i,height:o,viewBox:`0 0 ${i} ${o}`,style:{display:"block"},children:[n.jsx("polyline",{points:g.join(" "),fill:"none",stroke:S,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[N,z]=g[g.length-1].split(",");return n.jsx("circle",{cx:N,cy:z,r:2.5,fill:S})})()]})}function gk(){return n.jsxs("span",{className:"pill",style:{background:"var(--yellow-muted)",color:"var(--yellow)",fontSize:9,fontWeight:700,gap:3},children:[n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"var(--yellow)",stroke:"none",children:n.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),"Best Model"]})}function yk({pct:a}){const r=a>=10?"var(--green)":a>=0?"var(--yellow)":"var(--red)",i=a>=10?"var(--green-muted)":a>=0?"var(--yellow-muted)":"var(--red-muted)",o=a>=0?"+":"";return n.jsxs("span",{className:"pill",style:{background:i,color:r,fontSize:10,fontWeight:600},children:[o,a.toFixed(1),"%"]})}function bk({score:a,rating:r}){const i={excellent:{bg:"var(--green-muted)",fg:"var(--green)"},good:{bg:"var(--green-muted)",fg:"var(--green)"},marginal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},minimal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},harmful:{bg:"var(--red-muted)",fg:"var(--red)"}},o=i[r]??i.minimal,u=a>=0?"+":"";return n.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),n.jsxs("span",{className:"pill",style:{background:o.bg,color:o.fg,fontSize:11,fontWeight:600},children:[u,a.toFixed(1),"% (",r.toUpperCase(),")"]})]})}function jk({warning:a}){return n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-3",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow-muted)"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:a})]})}function Sk({active:a,onChange:r,hasBaseline:i}){return n.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[n.jsx("button",{onClick:()=>r("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="rankings"?"var(--surface-3)":"transparent",color:a==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),n.jsx("button",{onClick:()=>r("amplification"),disabled:!i,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="amplification"?"var(--surface-3)":"transparent",color:i&&a==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:i?1:.5,cursor:i?"pointer":"not-allowed"},title:i?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function kk(a){var o,u,p;if(a.length===0)return[];const r=new Map;for(const f of a)for(const h of f.models){if(h.status==="error")continue;const x=`${h.provider}/${h.model}`;r.has(x)||r.set(x,{provider:h.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const m=r.get(x);m.passRates.push(h.passRate.mean),m.lastRubric=((o=h.rubricScore)==null?void 0:o.mean)??null,m.lastDuration=h.duration.mean,m.lastCost=((u=h.cost)==null?void 0:u.total)??null,m.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(m.lastBaselinePassRate=h.baselinePassRate.mean,m.lastSkillDelta=(p=h.skillDelta)==null?void 0:p.mean,m.lastAmplificationPct=h.amplificationPct,m.hasBaseline=!0)}const i=[];for(const[f,h]of r){const[x,...m]=f.split("/");i.push({rank:0,model:m.join("/"),provider:x,passRate:h.passRates[h.passRates.length-1],rubricScore:h.lastRubric,duration:h.lastDuration,cost:h.lastCost,sparklineData:h.passRates,isBest:!1,baselinePassRate:h.lastBaselinePassRate,skillDelta:h.lastSkillDelta,amplificationPct:h.lastAmplificationPct,compositeScore:h.lastCompositeScore,hasBaseline:h.hasBaseline})}return i.sort((f,h)=>{const x=f.compositeScore??f.passRate;return(h.compositeScore??h.passRate)-x}),i.forEach((f,h)=>{f.rank=h+1}),i.length>0&&(i[0].isBest=!0),i}const hg=(a="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:a,whiteSpace:"nowrap"});function wk({entries:a}){return n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(r=>n.jsx("th",{style:hg(r==="#"?"center":"left"),children:r},r))})}),n.jsx("tbody",{children:a.map(r=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:i=>{i.currentTarget.style.background="var(--surface-2)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:r.rank}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:r.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:r.provider}),r.isBest&&n.jsx(gk,{})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:r.passRate>=.7?"var(--green-muted)":r.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(r.passRate),fontSize:11,fontWeight:600},children:[Math.round(r.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.rubricScore!=null?r.rubricScore.toFixed(1):"--"}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.duration<1e3?`${Math.round(r.duration)}ms`:`${(r.duration/1e3).toFixed(1)}s`}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.cost!=null?`$${r.cost.toFixed(4)}`:"N/A"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(mg,{data:r.sparklineData})})]},`${r.provider}/${r.model}`))})]})})}function Ck({entries:a}){const r=[...a].filter(i=>i.hasBaseline).sort((i,o)=>(o.amplificationPct??0)-(i.amplificationPct??0));return r.length===0?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"text-center",children:n.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",n.jsx("code",{children:"--baseline"})," flag."]})})}):n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(i=>n.jsx("th",{style:hg(i==="#"?"center":"left"),children:i},i))})}),n.jsx("tbody",{children:r.map((i,o)=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:u=>{u.currentTarget.style.background="var(--surface-2)"},onMouseLeave:u=>{u.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+1}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:i.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:i.provider})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:i.passRate>=.7?"var(--green-muted)":i.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(i.passRate),fontSize:11,fontWeight:600},children:[Math.round(i.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px"},children:i.baselinePassRate!=null?n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(i.baselinePassRate*100),"%"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.skillDelta!=null?n.jsxs("span",{className:"text-[11px] font-medium",style:{color:i.skillDelta>=0?"var(--green)":"var(--red)"},children:[i.skillDelta>=0?"+":"",(i.skillDelta*100).toFixed(1),"pp"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.amplificationPct!=null&&isFinite(i.amplificationPct)?n.jsx(yk,{pct:i.amplificationPct}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(mg,{data:i.sparklineData})})]},`${i.provider}/${i.model}`))})]})})}function Nk(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState("rankings"),p=`leaderboard/${r}/${i}`,f=v.useCallback(()=>Ne.getLeaderboard(r,i),[r,i]),{data:h,loading:x}=zs(p,f),m=(h==null?void 0:h.entries)??[];v.useEffect(()=>{u("rankings")},[r,i]);const y=v.useCallback(()=>Xn(p),[p]);fo("leaderboard:updated",y);const g=v.useMemo(()=>kk(m),[m]),j=g.some(z=>z.hasBaseline),S=m[0],N=S==null?void 0:S.judgeBiasWarning;return x?n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"spinner spinner-lg"})}):g.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),n.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),n.jsx("div",{className:"text-[11px] font-mono px-4 py-3 rounded-lg text-left",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:'vskill eval sweep --models "anthropic/claude-sonnet-4,openrouter/meta-llama/llama-3.1-70b" --judge "anthropic/claude-sonnet-4"'}),n.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",n.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):n.jsxs("div",{className:"p-5 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),n.jsx(Sk,{active:o,onChange:u,hasBaseline:j})]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[m.length," sweep",m.length!==1?"s":""," · ",g.length," model",g.length!==1?"s":""]})]}),N&&n.jsx(jk,{warning:N}),o==="rankings"?n.jsx(wk,{entries:g}):n.jsx(Ck,{entries:g}),o==="amplification"&&(S==null?void 0:S.skillQualityScore)!=null&&(S==null?void 0:S.skillQualityRating)&&n.jsx(bk,{score:S.skillQualityScore,rating:S.skillQualityRating})]})}const Ek=["editor","tests","run","activation","history","leaderboard","deps","versions"];function Tk(a){return a!=null&&Ek.includes(a)}function Rk({hideHeader:a=!1}={}){var j;const{state:r,dispatch:i,saveContent:o,isReadOnly:u}=kn(),{state:p,refreshSkills:f,clearSelection:h}=ya(),x=v.useCallback(async()=>{try{await Ne.deleteSkill(r.plugin,r.skill),f(),h()}catch(S){const N=S instanceof Error?S.message:String(S);i({type:"SET_ERROR",error:`Failed to delete skill: ${N}`})}},[r.plugin,r.skill,f,h,i]);v.useEffect(()=>{const N=new URLSearchParams(window.location.search).get("panel");Tk(N)&&N!==r.activePanel&&i({type:"SET_PANEL",panel:N})},[]),v.useEffect(()=>{const S=new URLSearchParams(window.location.search);S.set("panel",r.activePanel);const N=`${window.location.pathname}?${S.toString()}${window.location.hash}`;history.replaceState(null,"",N)},[r.activePanel]);const m=v.useCallback(S=>{const N=S.ctrlKey||S.metaKey;if(N&&S.key>="1"&&S.key<="8"){S.preventDefault(),i({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps","versions"][parseInt(S.key)-1]});return}if(N&&S.key==="s"&&!S.shiftKey){S.preventDefault(),r.isDirty&&o();return}},[r.isDirty,o,i]);if(v.useEffect(()=>(window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)),[m]),r.loading)return n.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"flex flex-col items-center gap-3",children:[n.jsx("div",{className:"spinner spinner-lg"}),n.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const y=Array.from(r.caseRunStates.values()).some(S=>S.status==="running"||S.status==="queued"),g=((j=p.skills.find(S=>S.skill===r.skill&&S.plugin===r.plugin))==null?void 0:j.updateAvailable)??!1;return n.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[!a&&n.jsx($d,{state:r,isReadOnly:u,onDelete:u?void 0:x}),r.error&&n.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx(Ls,{error:eS(r.error),onDismiss:()=>i({type:"SET_ERROR",error:null})})}),n.jsx(Z2,{activePanel:r.activePanel,onPanelChange:S=>i({type:"SET_PANEL",panel:S}),isDirty:r.isDirty,isRunning:y,hasRegressions:r.regressions.length>0,isActivationRunning:r.activationRunning,hasUpdate:g}),n.jsx(J2,{children:n.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[r.activePanel==="editor"&&n.jsx(CS,{}),r.activePanel==="tests"&&n.jsx(zS,{}),r.activePanel==="run"&&n.jsx(YS,{}),r.activePanel==="activation"&&n.jsx(XS,{}),r.activePanel==="history"&&n.jsx(fk,{}),r.activePanel==="leaderboard"&&n.jsx(Nk,{}),r.activePanel==="deps"&&n.jsx(vk,{}),r.activePanel==="versions"&&n.jsx(ng,{})]},r.activePanel)})},`${r.plugin}/${r.skill}`)]})}function Ak(a){const r={prompt:a.prompt,provider:a.provider,model:a.model};return a.targetAgents&&a.targetAgents.length>0&&(r.targetAgents=a.targetAgents),r}function kd(a,r=!0){let i=a.toLowerCase().replace(/[^a-z0-9]+/g,"-");return r&&(i=i.replace(/^-+|-+$/g,"")),i}function Mk(a,r,i,o){const p=`.../${a.split("/").slice(-2).join("/")}`;switch(r){case 1:return`${p}/${i}/skills/${o}/SKILL.md`;case 2:return`${p}/plugins/${i}/skills/${o}/SKILL.md`;case 3:return`${p}/skills/${o}/SKILL.md`}}function zk({onCreated:a,resolveAiConfigOverride:r}){const[i,o]=v.useState("ai"),[u,p]=v.useState(null),[f,h]=v.useState(!0),{config:x}=bl(),[m,y]=v.useState(""),[g,j]=v.useState(3),[S,N]=v.useState(""),[z,T]=v.useState(""),[k,M]=v.useState(""),[O,V]=v.useState(""),[A,U]=v.useState(""),[w,L]=v.useState(""),[R,I]=v.useState("write"),[G,Y]=v.useState([]),[te,q]=v.useState(!1),[_,E]=v.useState(null),[B,ne]=v.useState(""),[F,me]=v.useState(!1),[D,K]=v.useState(!1),[oe,fe]=v.useState(null),[he,xe]=v.useState(null),[ke,ce]=v.useState([]),je=v.useRef(null),Ue=v.useRef(null),Le=v.useRef(null),ae=v.useRef(null),[Z,se]=v.useState(!1),[ue,ge]=v.useState(!1);v.useEffect(()=>{Ne.getProjectLayout().then(ze=>{p(ze),j(ze.suggestedLayout);const xt=ze.detectedLayouts.find(Wt=>Wt.layout===ze.suggestedLayout);xt!=null&&xt.existingPlugins.length&&N(xt.existingPlugins[0])}).catch(()=>{}).finally(()=>h(!1))},[]),v.useEffect(()=>{var ze;i==="ai"&&((ze=je.current)==null||ze.focus())},[i]),v.useEffect(()=>()=>{var ze;(ze=Ue.current)==null||ze.abort()},[]);const Oe=v.useMemo(()=>{var ze;return u?((ze=u.detectedLayouts.find(xt=>xt.layout===g))==null?void 0:ze.existingPlugins)||[]:[]},[u,g]),Me=S==="__new__"?z:S,dt=u?Mk(u.root,g,Me||"{plugin}",m||"{skill}"):"",Zt=v.useMemo(()=>u?u.detectedLayouts.filter(ze=>ze.layout!==4):[],[u]),ct=v.useMemo(()=>{if(!u)return null;const ze=u.detectedLayouts.find(nt=>nt.layout===2&&nt.existingPlugins.length>0),xt=u.detectedLayouts.find(nt=>nt.layout===1&&nt.existingPlugins.length>0),Wt=ze||xt;return Wt?{layout:Wt.layout,plugins:Wt.existingPlugins}:null},[u]),Vt=v.useCallback(()=>{if(r)return r();if(!x)return{provider:"claude-cli",model:"sonnet"};const ze=x.provider||"claude-cli",xt=x.model||"sonnet";return{provider:ze,model:xt}},[x,r]),$t=v.useCallback(()=>{var ze;(ze=Ue.current)==null||ze.abort(),me(!1)},[]),tt=v.useCallback(()=>{fe(null),xe(null)},[]),jt=v.useCallback(async()=>{if(fe(null),xe(null),ce([]),Le.current=null,!B.trim()){fe("Describe what your skill should do");return}me(!0);const ze=new AbortController;Ue.current=ze;const{provider:xt,model:Wt}=Vt();try{const nt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ak({prompt:B.trim(),provider:xt,model:Wt,targetAgents:G})),signal:ze.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const Bn=await nt.json();Bn.error&&(bt=Bn.error)}catch{}throw new Error(bt)}const Qa=nt.body.getReader(),Zn=new TextDecoder;let Ct="",St="";for(;;){const{done:bt,value:Bn}=await Qa.read();if(bt)break;Ct+=Zn.decode(Bn,{stream:!0});const Za=Ct.split(`
|
|
75
|
-
`);Ct=Za.pop()||"";for(const In of Za)if(In.startsWith("event: "))St=In.slice(7).trim();else if(In.startsWith("data: ")){try{const Ve=JSON.parse(In.slice(6));if(St==="progress")ce(It=>[...It,{phase:Ve.phase,message:Ve.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const It={prompt:B.trim(),provider:Vt().provider,model:Vt().model,reasoning:Ve.reasoning||""};if(y(Ve.name),M(Ve.description),V(Ve.model||""),U(Ve.allowedTools||""),
|
|
74
|
+
!Write me a poem about flowers`}),n.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:"One prompt per line"}),n.jsx(Qi,{}),n.jsx("span",{children:"No prefix = auto-classify"}),n.jsx(Qi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),n.jsx(Qi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),n.jsx(Qi,{}),n.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[R," prompt",R!==1?"s":""]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:w,disabled:y||!k.trim(),className:"btn btn-primary",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{borderTopColor:"var(--color-paper)",borderColor:"var(--border-default)",width:14,height:14}}),"Testing..."]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[S||`${x.length} / ${R} prompts tested`,j&&n.jsx(ek,{startedAt:j})]})]})]})]}),n.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[n.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),n.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:q?n.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:Q}}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),g&&n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:g}),y&&x.length===0&&n.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[n.jsx("div",{className:"spinner-lg mx-auto mb-4"}),n.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),x.length>0&&n.jsxs("div",{className:"space-y-5",children:[G.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),n.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",G.length,")"]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:G.map((z,E)=>n.jsx(Zx,{result:z},`incorrect-${E}`))})]}),I.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"16 10 11 15 8 12"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",I.length,")"]})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:I.map((z,E)=>n.jsx(Zx,{result:z},`correct-${E}`))})]})]}),m&&n.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),m.autoClassifiedCount!=null&&m.autoClassifiedCount>0&&n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[m.autoClassifiedCount," of ",m.total," prompts auto-classified from skill name and tags"]}),n.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[n.jsx(ed,{label:"Precision",value:m.precision,description:"Of all activations, how many were correct?",detail:`${m.tp} true / ${m.tp+m.fp} total activations`}),n.jsx(ed,{label:"Recall",value:m.recall,description:"Of expected activations, how many fired?",detail:`${m.tp} activated / ${m.tp+m.fn} expected`}),n.jsx(ed,{label:"Reliability",value:m.reliability,description:"Overall correct classification rate",detail:`${m.tp+m.tn} correct / ${m.total} total`})]}),n.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[n.jsx(Zi,{label:"True Positive",abbr:"TP",count:m.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),n.jsx(Zi,{label:"False Positive",abbr:"FP",count:m.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),n.jsx(Zi,{label:"False Negative",abbr:"FN",count:m.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),n.jsx(Zi,{label:"True Negative",abbr:"TN",count:m.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),n.jsx(QS,{history:T,expanded:A,onToggle:()=>U(!A)})]})}function QS({history:a,expanded:r,onToggle:i}){return a===null?null:n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:r?"1px solid var(--border-subtle)":"none"},onClick:i,children:[n.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",a.length>0&&n.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",a.length," run",a.length!==1?"s":"",")"]})]}),n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:r?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),r&&n.jsx("div",{className:"px-4 py-3",children:a.length===0?n.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):n.jsx("div",{className:"space-y-2",children:a.map(o=>n.jsx(ZS,{run:o},o.id))})})]})}function ZS({run:a}){const r=Math.round(a.summary.reliability*100),i=r>=80?"var(--green)":r>=60?"var(--yellow)":"var(--red)",o=r>=80?"Good":r>=60?"Needs Work":"Poor",u=i;return n.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:JS(a.timestamp)}),n.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:a.model||a.provider}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.promptCount," prompts"]})]})}),n.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i,fontVariantNumeric:"tabular-nums"},children:[r,"%"]}),n.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:u,background:`color-mix(in srgb, ${u} 10%, transparent)`},children:o})]})]})}function JS(a){const r=Date.now(),i=new Date(a).getTime(),o=Math.floor((r-i)/1e3);if(o<60)return"just now";const u=Math.floor(o/60);if(u<60)return`${u}m ago`;const p=Math.floor(u/60);if(p<24)return`${p}h ago`;const f=Math.floor(p/24);return f<7?`${f}d ago`:new Date(a).toLocaleDateString()}function Qi(){return n.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Zx({result:a}){const r=Qx[a.classification]||Qx.FN,i=a.classification==="TP"||a.classification==="TN";return n.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:r.bg,border:"1px solid transparent"},children:[n.jsx("div",{className:"flex-shrink-0 mt-0.5",children:n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${r.text} 20%, transparent)`},children:i?n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"flex items-center gap-2 mb-1",children:n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:a.prompt})}),n.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[n.jsx("span",{className:"pill",style:{background:"var(--surface-3)",color:r.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:a.classification}),n.jsx("span",{style:{color:a.activate?"var(--green)":"var(--text-tertiary)"},children:a.activate?"Activated":"Silent"}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",a.expected==="should_activate"?"activate":"stay silent"]}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[a.confidence," confidence"]}),a.autoClassified&&n.jsx("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),a.reasoning&&n.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:a.reasoning})]})]})}function ed({label:a,value:r,description:i,detail:o}){const u=Math.round(r*100),p=u>=80?"var(--green)":u>=60?"var(--yellow)":"var(--red)";return n.jsxs("div",{className:"text-center",children:[n.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:p},children:[u,"%"]}),n.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:a}),n.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:i}),n.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function Zi({abbr:a,count:r,bg:i,color:o,description:u}){return n.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:i},children:[n.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:r}),n.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:a}),n.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:u})]})}function ek({startedAt:a}){const[r,i]=v.useState(0);return v.useEffect(()=>{const o=setInterval(()=>i(Math.floor((Date.now()-a)/1e3)),1e3);return()=>clearInterval(o)},[a]),n.jsxs("span",{className:"ml-2",children:["(",r,"s)"]})}const td={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Jx={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},Sd=600,kd=180,tn=40,nd=Sd-tn*2,Pa=kd-tn*2,tk=[25,50,75,100];function ev(a){return new Date(a).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function nk(a){return a==null?"--":`${(a/1e3).toFixed(1)}s`}function ak({entries:a,onPointClick:r}){const[i,o]=v.useState(null),u=v.useMemo(()=>[...a].reverse(),[a]);if(u.length<2)return null;const p=u.length,f=u.map((m,y)=>{const g=tn+y/(p-1)*nd,j=m.passRate*100,S=tn+Pa-j/100*Pa;return{x:g,y:S,pct:j,entry:m}}),h=f.map(m=>`${m.x},${m.y}`).join(" "),x=Array.from(new Set(u.map(m=>m.type)));return n.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:p>=20?"auto":void 0},children:[n.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),n.jsx("div",{className:"flex items-center gap-5 mb-3",children:x.map(m=>n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:td[m]??"var(--text-tertiary)"}}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Jx[m]??m})]},m))}),n.jsxs("svg",{width:Sd,height:kd,viewBox:`0 0 ${Sd} ${kd}`,style:{display:"block",overflow:"visible"},children:[tk.map(m=>{const y=tn+Pa-m/100*Pa;return n.jsxs("g",{children:[n.jsx("line",{x1:tn,y1:y,x2:tn+nd,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),n.jsxs("text",{x:tn-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[m,"%"]})]},m)}),n.jsx("line",{x1:tn,y1:tn+Pa,x2:tn+nd,y2:tn+Pa,stroke:"var(--border-subtle)",strokeWidth:1}),n.jsx("text",{x:tn-8,y:tn+Pa+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),n.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),f.map((m,y)=>n.jsx("circle",{cx:m.x,cy:m.y,r:5,fill:td[m.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:g=>{g.currentTarget.setAttribute("r","7"),o({x:m.x,y:m.y,entry:m.entry})},onMouseLeave:g=>{g.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>r==null?void 0:r(m.entry)},y)),lk(p).map(m=>n.jsx("text",{x:f[m].x,y:tn+Pa+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:ev(u[m].timestamp)},m))]}),i&&n.jsxs("div",{style:{position:"absolute",left:i.x,top:i.y-12,transform:"translate(-50%, -100%)",background:"var(--surface-3)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"8px 12px",pointerEvents:"none",zIndex:10,whiteSpace:"nowrap"},children:[n.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:ev(i.entry.timestamp)}),n.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:i.entry.model}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:td[i.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Jx[i.entry.type]??i.entry.type}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(i.entry.passRate*100),"%"]})]}),n.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:nk(i.entry.totalDurationMs)}),n.jsx("span",{children:i.entry.totalTokens!=null?`${i.entry.totalTokens} tokens`:"--"})]})]})]})}function lk(a){if(a<=3)return Array.from({length:a},(o,u)=>u);if(a<=6)return[0,Math.floor(a/2),a-1];if(a<20)return[0,Math.floor(a/3),Math.floor(2*a/3),a-1];const r=Math.ceil(a/10),i=[0];for(let o=r;o<a-1;o+=r)i.push(o);return i.push(a-1),i}const xs=new Map;let nn=null,so=null,Ji=1e3,vs=0;function pg(){if(nn)return;nn=new EventSource("/api/events");const a=r=>i=>{let o={};try{o=i.data?JSON.parse(i.data):{}}catch{}const u=xs.get(r);if(u)for(const p of u)p(o)};nn.addEventListener("benchmark:complete",a("benchmark:complete")),nn.addEventListener("history:written",a("history:written")),nn.addEventListener("leaderboard:updated",a("leaderboard:updated")),nn.onerror=()=>{nn==null||nn.close(),nn=null,vs>0&&(so=setTimeout(()=>{Ji=Math.min(Ji*2,3e4),pg()},Ji))},nn.onopen=()=>{Ji=1e3}}function rk(){so!=null&&(clearTimeout(so),so=null),nn==null||nn.close(),nn=null}function sk(a,r){return xs.has(a)||xs.set(a,new Set),xs.get(a).add(r),vs++,pg(),()=>{var i;(i=xs.get(a))==null||i.delete(r),vs--,vs<=0&&(vs=0,rk())}}function fo(a,r){const i=v.useRef(r);i.current=r,v.useEffect(()=>sk(a,u=>i.current(u)),[a])}function po(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function ik(a){return a>=1e3?`${(a/1e3).toFixed(1)}s`:`${Math.round(a)}ms`}function ok({rate:a,label:r}){const i=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-3",children:n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:r}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:po(a)},children:[i,"%"]})]}),n.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${i}%`,background:po(a)}})})]})})}function ck({points:a}){if(a.length<2)return null;const r=200,i=48,o=4,u=a.length,p=a.map((x,m)=>{const y=o+m/(u-1)*(r-o*2),g=o+(i-o*2)-x.passRate*(i-o*2);return{x:y,y:g}}),f=`M ${p[0].x},${i-o} `+p.map(x=>`L ${x.x},${x.y}`).join(" ")+` L ${p[p.length-1].x},${i-o} Z`,h=p.map((x,m)=>`${m===0?"M":"L"} ${x.x},${x.y}`).join(" ");return n.jsxs("svg",{width:r,height:i,style:{display:"block"},children:[n.jsx("path",{d:f,fill:"var(--accent-muted)"}),n.jsx("path",{d:h,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),n.jsx("circle",{cx:p[p.length-1].x,cy:p[p.length-1].y,r:3,fill:"var(--accent)"})]})}function uk({plugin:a,skill:r}){const i=`stats/${a}/${r}`,o=v.useCallback(()=>Ne.getStats(a,r),[a,r]),{data:u,loading:p}=zs(i,o),f=v.useCallback(()=>Xn(i),[i]);if(fo("benchmark:complete",f),fo("history:written",f),p)return n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"skeleton h-24 rounded-xl"}),n.jsx("div",{className:"skeleton h-48 rounded-xl"}),n.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!u||u.totalRuns===0)return n.jsxs("div",{className:"text-center py-12",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),n.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const h=u.trendPoints.length>0?u.trendPoints[u.trendPoints.length-1].passRate:0,x=u.trendPoints.length>0?u.trendPoints[0].passRate:0,m=h-x,y=u.assertionStats.slice(0,10);return n.jsxs("div",{className:"space-y-4 stagger-children",children:[n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:u.totalRuns})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:po(h)},children:[Math.round(h*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:m>=0?"var(--green)":"var(--red)"},children:[m>=0?"+":"",Math.round(m*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:u.modelStats.length})]}),u.totalCost!=null&&n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),n.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Sn(u.totalCost)})]}),u.costPerRun!=null&&n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),n.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Sn(u.costPerRun)})]})]}),u.trendPoints.length>=2&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),n.jsx(ck,{points:u.trendPoints})]}),u.modelStats.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[n.jsx("thead",{children:n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),n.jsx("tbody",{children:u.modelStats.map(g=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:g.model}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:g.runs}),n.jsx("td",{style:{padding:"8px",textAlign:"center"},children:n.jsxs("span",{className:"font-semibold",style:{color:po(g.avgPassRate)},children:[Math.round(g.avgPassRate*100),"%"]})}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:ik(g.avgDurationMs)}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:g.avgCost!=null?Sn(g.avgCost):"N/A"})]},g.model))})]})]}),y.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),n.jsx("div",{className:"space-y-3",children:y.map(g=>n.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:j=>{j.currentTarget.style.background="var(--surface-2)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},onClick:()=>{},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsxs("span",{className:"text-[10px] font-mono px-1 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",g.evalId]}),n.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:g.evalName}),n.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[g.totalRuns," runs"]})]}),n.jsx(ok,{rate:g.passRate,label:g.text})]},`${g.evalId}:${g.id}`))})]})]})}function dk({plugin:a,skill:r}){const[i,o]=v.useState(null),[u,p]=v.useState(null),[f,h]=v.useState({}),[x,m]=v.useState({});v.useEffect(()=>{Ne.getEvals(a,r).then(o).catch(()=>o(null))},[a,r]);async function y(g){if(u===g){p(null);return}if(p(g),!f[g]){m(j=>({...j,[g]:!0}));try{const j=await Ne.getCaseHistory(a,r,g);h(S=>({...S,[g]:j}))}catch{h(j=>({...j,[g]:[]}))}finally{m(j=>({...j,[g]:!1}))}}}return i?n.jsx("div",{className:"space-y-2 stagger-children",children:i.evals.map(g=>{const j=f[g.id]||[],S=u===g.id,N=x[g.id],L=j.length>0?j[0].pass_rate:null;return n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{onClick:()=>y(g.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:S?"var(--surface-2)":"transparent"},onMouseEnter:T=>{S||(T.currentTarget.style.background="var(--surface-2)")},onMouseLeave:T=>{S||(T.currentTarget.style.background="transparent")},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:S?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),n.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",g.id]}),n.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:g.name}),j.length>=2&&n.jsx(og,{entries:j}),L!=null&&n.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:mr(L)},children:[Math.round(L*100),"%"]}),j.length>0&&n.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[j.length," runs"]})]}),S&&n.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:N?n.jsxs("div",{className:"p-4 flex items-center gap-2",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):j.length===0?n.jsx("div",{className:"p-4",children:n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):n.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:j.map((T,k)=>n.jsxs("div",{className:"p-4",style:{background:k===0?"var(--surface-2)":"transparent"},children:[n.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:sg(T.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:T.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:T.type==="benchmark"?"rgba(99,131,255,0.15)":T.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:T.type==="benchmark"?"#6383ff":T.type==="comparison"?"var(--purple)":"#fb923c"},children:T.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:mr(T.pass_rate)},children:[Math.round(T.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[T.durationMs!=null&&n.jsx("span",{children:ig(T.durationMs)}),T.tokens!=null&&n.jsxs("span",{children:[T.tokens>=1e3?`${(T.tokens/1e3).toFixed(1)}k`:T.tokens," tok"]})]}),n.jsx("div",{className:"space-y-1",children:T.assertions.map(M=>n.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[n.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:M.pass?"var(--green)":"var(--red)"},children:n.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:M.pass?n.jsx("polyline",{points:"20 6 9 17 4 12"}):n.jsxs(n.Fragment,{children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:M.text}),M.reasoning&&n.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:M.reasoning})]})]},M.id))})]},k))})})]},g.id)})}):n.jsx("div",{className:"text-center py-12",children:n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function fk(){const{state:a,dispatch:r}=kn(),{plugin:i,skill:o}=a,[u,p]=v.useState("timeline"),[f,h]=v.useState(""),[x,m]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState([]),[N,L]=v.useState(null),[T,k]=v.useState(!1),[M,O]=v.useState(null),[V,A]=v.useState(!1),U=`history/${i}/${o}?model=${f}&type=${x}`,w=v.useCallback(()=>Ne.getHistory(i,o,{model:f||void 0,type:x||void 0}),[i,o,f,x]),{data:D,loading:R}=zs(U,w),I=D??[];v.useEffect(()=>{!D||D.length<2||Ne.compareRuns(i,o,D[0].timestamp,D[1].timestamp).then(z=>{const E=z.regressions.filter(B=>B.change==="regression");r({type:"SET_REGRESSIONS",regressions:E})}).catch(()=>{})},[D,i,o,r]);const G=v.useCallback(()=>Xn(U),[U]);fo("history:written",G);const q=v.useCallback(async z=>{if(y){S(E=>E.includes(z)?E.filter(B=>B!==z):E.length>=2?[E[1],z]:[...E,z]);return}A(!0);try{const E=await Ne.getHistoryEntry(i,o,z);O(E)}catch{}finally{A(!1)}},[i,o,y]),te=v.useCallback(async()=>{if(j.length===2){k(!0);try{const z=await Ne.compareRuns(i,o,j[0],j[1]);L(z)}catch{}finally{k(!1)}}},[i,o,j]),Q=[...new Set(I.map(z=>z.model))];return R?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"skeleton h-12 rounded-lg"}),n.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(z=>n.jsx("button",{onClick:()=>p(z),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:u===z?"var(--accent-muted)":"transparent",color:u===z?"var(--accent)":"var(--text-tertiary)"},children:z==="timeline"?"Timeline":z==="per-eval"?"Per Eval":"Statistics"},z))}),u==="timeline"&&n.jsxs("div",{children:[I.length>0&&n.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:n.jsx(ak,{entries:I,onPointClick:z=>q(z.timestamp)})}),n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("select",{value:f,onChange:z=>h(z.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Models"}),Q.map(z=>n.jsx("option",{value:z,children:z},z))]}),n.jsxs("select",{value:x,onChange:z=>m(z.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Types"}),n.jsx("option",{value:"benchmark",children:"Benchmark"}),n.jsx("option",{value:"comparison",children:"Comparison"}),n.jsx("option",{value:"baseline",children:"Baseline"}),n.jsx("option",{value:"model-compare",children:"Model Compare"}),n.jsx("option",{value:"improve",children:"AI Improve"}),n.jsx("option",{value:"instruct",children:"AI Edit"}),n.jsx("option",{value:"ai-generate",children:"AI Generate"}),n.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),n.jsx("div",{className:"flex-1"}),n.jsx("button",{onClick:()=>{g(!y),S([]),L(null)},className:`btn text-[12px] ${y?"btn-primary":"btn-secondary"}`,children:y?"Exit Compare":"Compare Runs"}),y&&j.length===2&&n.jsx("button",{onClick:te,disabled:T,className:"btn btn-primary text-[12px]",children:T?"Comparing...":"Compare"})]}),n.jsx("div",{className:"space-y-2",children:I.length===0?n.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):I.map(z=>{const E=j.includes(z.timestamp);return n.jsx("button",{onClick:()=>q(z.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:E?"var(--accent-muted)":"var(--surface-1)",border:E?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:B=>{E||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{E||(B.currentTarget.style.borderColor="var(--border-subtle)")},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[y&&n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:E?"var(--accent)":"var(--border-default)",background:E?"var(--accent)":"transparent"},children:E&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(z.timestamp).toLocaleString()}),n.jsx("span",{className:"pill text-[9px]",style:{background:z.type==="comparison"?"var(--purple-muted)":z.type==="baseline"?"var(--surface-3)":z.type==="model-compare"?"var(--accent-muted)":z.type==="improve"||z.type==="instruct"?"var(--purple-muted)":z.type==="ai-generate"?"var(--green-muted)":z.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:z.type==="comparison"?"var(--purple)":z.type==="baseline"?"var(--text-tertiary)":z.type==="model-compare"?"var(--accent)":z.type==="improve"||z.type==="instruct"?"var(--purple)":z.type==="ai-generate"?"var(--green)":z.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:z.type==="model-compare"?"model compare":z.type==="improve"?"ai improve":z.type==="instruct"?"ai edit":z.type==="ai-generate"?"ai generate":z.type==="eval-generate"?"eval generate":z.type})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:z.model}),z.totalCost!=null&&z.totalCost>0&&n.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:Sn(z.totalCost)}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:z.passRate>=.8?"var(--green)":z.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(z.passRate*100),"%"]})]})]})},z.timestamp)})}),N&&n.jsx(pk,{result:N}),M&&!y&&n.jsx(mk,{run:M,onClose:()=>O(null)})]}),u==="per-eval"&&n.jsx(dk,{plugin:i,skill:o}),u==="statistics"&&n.jsx(uk,{plugin:i,skill:o})]})}function pk({result:a}){const r=a.regressions.filter(o=>o.change==="regression"),i=a.regressions.filter(o=>o.change==="improvement");return n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(a.runA.timestamp).toLocaleDateString()," vs ",new Date(a.runB.timestamp).toLocaleDateString()]}),(a.runA.totalCost!=null||a.runB.totalCost!=null)&&n.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[n.jsxs("span",{children:["Run A cost: ",Sn(a.runA.totalCost??null)]}),n.jsxs("span",{children:["Run B cost: ",Sn(a.runB.totalCost??null)]}),a.runA.totalCost!=null&&a.runB.totalCost!=null&&n.jsxs("span",{style:{color:a.runB.totalCost<=a.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",Sn(a.runB.totalCost-a.runA.totalCost)]})]}),r.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",r.length,")"]}),r.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),i.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",i.length,")"]}),i.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),n.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:n.jsxs("table",{className:"w-full text-[12px]",children:[n.jsx("thead",{children:n.jsxs("tr",{style:{background:"var(--surface-2)"},children:[n.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),n.jsx("tbody",{children:a.caseDiffs.map(o=>n.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateA!=null?o.passRateA>=.8?"var(--green)":o.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateA!=null?`${Math.round(o.passRateA*100)}%`:o.statusA}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateB!=null?o.passRateB>=.8?"var(--green)":o.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateB!=null?`${Math.round(o.passRateB*100)}%`:o.statusB})]},o.eval_id))})]})})]})}function mk({run:a,onClose:r}){return(a.type==="improve"||a.type==="instruct")&&a.improve?n.jsx(hk,{run:a,onClose:r}):n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(a.timestamp).toLocaleString()]}),n.jsx("button",{onClick:r,className:"btn btn-ghost text-[11px]",children:"Close"})]}),n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",a.model," | Cases: ",a.cases.length," | Pass Rate: ",a.overall_pass_rate!=null?`${Math.round(a.overall_pass_rate*100)}%`:"--",a.totalCost!=null&&a.totalCost>0&&` | Cost: ${Sn(a.totalCost)}`]}),n.jsx("div",{className:"space-y-2",children:a.cases.map(i=>n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",i.eval_id," ",i.eval_name]}),n.jsxs("div",{className:"flex items-center gap-2",children:[i.cost!=null&&i.cost>0&&n.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:Sn(i.cost)}),n.jsx("span",{className:"text-[11px] font-semibold",style:{color:i.status==="pass"?"var(--green)":"var(--red)"},children:i.pass_rate!=null?`${Math.round(i.pass_rate*100)}%`:i.status})]})]})},i.eval_id))})]})}function hk({run:a,onClose:r}){var p;const i=v.useMemo(()=>a.improve?jo(a.improve.original,a.improve.improved):[],[a.improve]),o=v.useMemo(()=>{const f=i.filter(x=>x.type==="added").length,h=i.filter(x=>x.type==="removed").length;return{added:f,removed:h}},[i]),u=v.useMemo(()=>{let f=0,h=0;return i.map(x=>x.type==="removed"?(f++,{...x,origNum:f,newNum:null}):x.type==="added"?(h++,{...x,origNum:null,newNum:h}):(f++,h++,{...x,origNum:f,newNum:h}))},[i]);return n.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"var(--purple-muted)"},children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),n.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(a.timestamp).toLocaleString()," · ",a.model]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),n.jsx("button",{onClick:r,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:f=>{f.currentTarget.style.background="var(--surface-3)"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((p=a.improve)==null?void 0:p.reasoning)&&n.jsxs("div",{className:"mx-4 mt-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--purple-muted)",border:"1px solid var(--purple-muted)",color:"var(--text-secondary)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"var(--purple)"},children:"AI Reasoning: "}),a.improve.reasoning]}),n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:u.map((f,h)=>n.jsxs("tr",{style:{background:f.type==="added"?"var(--green-muted)":f.type==="removed"?"var(--red-muted)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="removed"?"var(--red)":"var(--text-tertiary)",opacity:f.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="added"?"var(--green)":"var(--text-tertiary)",opacity:f.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"transparent",borderRight:f.type==="added"?"2px solid var(--green)":f.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:f.type==="added"?"+":f.type==="removed"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"var(--text-secondary)"},children:f.content||""})]},h))})})})]})}function xk({plugin:a,skill:r}){const[i,o]=v.useState([]),[u,p]=v.useState([]),[f,h]=v.useState(!0),[x,m]=v.useState(null);v.useEffect(()=>{Ne.getDependencies(a,r).then(g=>{o(g.mcpDependencies),p(g.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[a,r]);async function y(g,j){try{await navigator.clipboard.writeText(j),m(g),setTimeout(()=>m(null),2e3)}catch{}}return f?null:i.length===0&&u.length===0?n.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:"No dependencies detected"}):n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:i.length+u.length})]}),n.jsxs("div",{className:"px-5 py-4",children:[i.length>0&&n.jsxs("div",{className:"space-y-3 mb-4",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),i.map(g=>n.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:g.server}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.transport})]}),n.jsx("button",{onClick:()=>y(g.server,g.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:x===g.server?"var(--green)":"var(--accent)"},children:x===g.server?n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})," Copy Config"]})})]}),n.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:g.url}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.matchedTools.map(j=>n.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:j},j))})]},g.server))]}),u.length>0&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),n.jsx("div",{className:"space-y-1.5",children:u.map(g=>n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:g.name}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.source==="frontmatter"?"frontmatter":"referenced"})]},g.name))})]})]})]})}function tv({plugin:a,skill:r}){const[i,o]=v.useState([]),[u,p]=v.useState(!0),[f,h]=v.useState(null),[x,m]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState(null),[N,L]=v.useState(""),[T,k]=v.useState(""),[M,O]=v.useState(!1),[V,A]=v.useState(new Set),U=v.useCallback(async()=>{p(!0);try{const[I,G]=await Promise.all([Ne.getCredentials(a,r).catch(()=>({credentials:[]})),Ne.getParams(a,r).catch(()=>({params:[]}))]),q=new Map(G.params.map(z=>[z.name,z])),te=new Set,Q=[];for(const z of I.credentials){te.add(z.name);const E=q.get(z.name);Q.push({name:z.name,status:z.status==="ready"||z.status==="resolved"?"ready":"missing",source:z.source,maskedValue:E==null?void 0:E.maskedValue})}for(const z of G.params)te.has(z.name)||Q.push({name:z.name,status:z.status,maskedValue:z.maskedValue});o(Q)}finally{p(!1)}},[a,r]);v.useEffect(()=>{U()},[U]);const w=v.useCallback(async I=>{if(V.has(I)){A(G=>{const q=new Set(G);return q.delete(I),q}),o(G=>G.map(q=>q.name===I?{...q,revealedValue:void 0}:q));return}try{const q=(await Ne.getParamsRevealed(a,r,I)).params.find(te=>te.name===I);q&&(o(te=>te.map(Q=>Q.name===I?{...Q,revealedValue:q.value}:Q)),A(te=>new Set(te).add(I)))}catch{}},[a,r,V]),D=async(I,G)=>{if(!(!I.trim()||!G.trim())){g(!0),S(null);try{await Ne.setCredential(a,r,I,G),h(null),m(""),A(new Set),U()}catch(q){S(q.message)}finally{g(!1)}}},R=async()=>{if(!(!N.trim()||!T.trim())){g(!0),S(null);try{await Ne.setCredential(a,r,N.trim().toUpperCase(),T),L(""),k(""),O(!1),U()}catch(I){S(I.message)}finally{g(!1)}}};return u?n.jsxs("div",{className:"mt-6",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),n.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):n.jsxs("div",{className:"mt-6",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),n.jsx("button",{onClick:()=>O(!M),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),j&&n.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j}),i.length===0&&!M?n.jsx("div",{className:"text-[12px] text-center py-6 rounded-xl",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"No credentials configured for this skill"}):n.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:i.map(I=>n.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:I.name}),I.maskedValue&&n.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:V.has(I.name)&&I.revealedValue!=null?I.revealedValue:I.maskedValue}),I.maskedValue&&n.jsx("button",{onClick:()=>w(I.name),className:"btn btn-ghost px-1",title:V.has(I.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:V.has(I.name)?n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),n.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),n.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),n.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:I.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:I.status==="ready"?"var(--green)":"var(--orange)"},children:I.status==="ready"?"ready":"missing"}),I.source&&n.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:I.source}),f===I.name?n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("input",{value:x,onChange:G=>m(G.target.value),onKeyDown:G=>{G.key==="Enter"&&D(I.name,x)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),n.jsx("button",{onClick:()=>D(I.name,x),disabled:y||!x.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:y?"...":"Save"}),n.jsx("button",{onClick:()=>{h(null),m("")},className:"btn btn-ghost text-[10px] px-1",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):n.jsx("button",{onClick:()=>{h(I.name),m("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},I.name))}),M&&n.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:N,onChange:I=>L(I.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),n.jsx("input",{value:T,onChange:I=>k(I.target.value),onKeyDown:I=>{I.key==="Enter"&&R()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),n.jsxs("div",{className:"flex justify-end gap-1.5",children:[n.jsx("button",{onClick:()=>{O(!1),L(""),k("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),n.jsx("button",{onClick:R,disabled:y||!N.trim()||!T.trim(),className:"btn btn-primary text-[10px]",children:y?"Saving...":"Save"})]})]})]})}function vk(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState(null),[p,f]=v.useState(!0);return v.useEffect(()=>{Ne.getDependencies(r,i).then(u).catch(()=>{}).finally(()=>f(!1))},[r,i]),p?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):o?n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx(xk,{plugin:r,skill:i}),n.jsx(tv,{plugin:r,skill:i})]}):n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),n.jsx(tv,{plugin:r,skill:i})]})}function mg({data:a}){if(a.length<2)return n.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const r=a.slice(-10),i=80,o=24,u=2,p=i-u*2,f=o-u*2,h=r.length,x=Math.min(...r),y=Math.max(...r)-x||1,g=r.map((N,L)=>{const T=u+L/(h-1)*p,k=u+f-(N-x)/y*f;return`${T.toFixed(1)},${k.toFixed(1)}`}),j=r[r.length-1],S=mr(j);return n.jsxs("svg",{width:i,height:o,viewBox:`0 0 ${i} ${o}`,style:{display:"block"},children:[n.jsx("polyline",{points:g.join(" "),fill:"none",stroke:S,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[N,L]=g[g.length-1].split(",");return n.jsx("circle",{cx:N,cy:L,r:2.5,fill:S})})()]})}function gk(){return n.jsxs("span",{className:"pill",style:{background:"var(--yellow-muted)",color:"var(--yellow)",fontSize:9,fontWeight:700,gap:3},children:[n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"var(--yellow)",stroke:"none",children:n.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),"Best Model"]})}function yk({pct:a}){const r=a>=10?"var(--green)":a>=0?"var(--yellow)":"var(--red)",i=a>=10?"var(--green-muted)":a>=0?"var(--yellow-muted)":"var(--red-muted)",o=a>=0?"+":"";return n.jsxs("span",{className:"pill",style:{background:i,color:r,fontSize:10,fontWeight:600},children:[o,a.toFixed(1),"%"]})}function bk({score:a,rating:r}){const i={excellent:{bg:"var(--green-muted)",fg:"var(--green)"},good:{bg:"var(--green-muted)",fg:"var(--green)"},marginal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},minimal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},harmful:{bg:"var(--red-muted)",fg:"var(--red)"}},o=i[r]??i.minimal,u=a>=0?"+":"";return n.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),n.jsxs("span",{className:"pill",style:{background:o.bg,color:o.fg,fontSize:11,fontWeight:600},children:[u,a.toFixed(1),"% (",r.toUpperCase(),")"]})]})}function jk({warning:a}){return n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-3",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow-muted)"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:a})]})}function Sk({active:a,onChange:r,hasBaseline:i}){return n.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[n.jsx("button",{onClick:()=>r("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="rankings"?"var(--surface-3)":"transparent",color:a==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),n.jsx("button",{onClick:()=>r("amplification"),disabled:!i,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="amplification"?"var(--surface-3)":"transparent",color:i&&a==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:i?1:.5,cursor:i?"pointer":"not-allowed"},title:i?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function kk(a){var o,u,p;if(a.length===0)return[];const r=new Map;for(const f of a)for(const h of f.models){if(h.status==="error")continue;const x=`${h.provider}/${h.model}`;r.has(x)||r.set(x,{provider:h.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const m=r.get(x);m.passRates.push(h.passRate.mean),m.lastRubric=((o=h.rubricScore)==null?void 0:o.mean)??null,m.lastDuration=h.duration.mean,m.lastCost=((u=h.cost)==null?void 0:u.total)??null,m.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(m.lastBaselinePassRate=h.baselinePassRate.mean,m.lastSkillDelta=(p=h.skillDelta)==null?void 0:p.mean,m.lastAmplificationPct=h.amplificationPct,m.hasBaseline=!0)}const i=[];for(const[f,h]of r){const[x,...m]=f.split("/");i.push({rank:0,model:m.join("/"),provider:x,passRate:h.passRates[h.passRates.length-1],rubricScore:h.lastRubric,duration:h.lastDuration,cost:h.lastCost,sparklineData:h.passRates,isBest:!1,baselinePassRate:h.lastBaselinePassRate,skillDelta:h.lastSkillDelta,amplificationPct:h.lastAmplificationPct,compositeScore:h.lastCompositeScore,hasBaseline:h.hasBaseline})}return i.sort((f,h)=>{const x=f.compositeScore??f.passRate;return(h.compositeScore??h.passRate)-x}),i.forEach((f,h)=>{f.rank=h+1}),i.length>0&&(i[0].isBest=!0),i}const hg=(a="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:a,whiteSpace:"nowrap"});function wk({entries:a}){return n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(r=>n.jsx("th",{style:hg(r==="#"?"center":"left"),children:r},r))})}),n.jsx("tbody",{children:a.map(r=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:i=>{i.currentTarget.style.background="var(--surface-2)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:r.rank}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:r.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:r.provider}),r.isBest&&n.jsx(gk,{})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:r.passRate>=.7?"var(--green-muted)":r.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(r.passRate),fontSize:11,fontWeight:600},children:[Math.round(r.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.rubricScore!=null?r.rubricScore.toFixed(1):"--"}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.duration<1e3?`${Math.round(r.duration)}ms`:`${(r.duration/1e3).toFixed(1)}s`}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.cost!=null?`$${r.cost.toFixed(4)}`:"N/A"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(mg,{data:r.sparklineData})})]},`${r.provider}/${r.model}`))})]})})}function Ck({entries:a}){const r=[...a].filter(i=>i.hasBaseline).sort((i,o)=>(o.amplificationPct??0)-(i.amplificationPct??0));return r.length===0?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"text-center",children:n.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",n.jsx("code",{children:"--baseline"})," flag."]})})}):n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(i=>n.jsx("th",{style:hg(i==="#"?"center":"left"),children:i},i))})}),n.jsx("tbody",{children:r.map((i,o)=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:u=>{u.currentTarget.style.background="var(--surface-2)"},onMouseLeave:u=>{u.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+1}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:i.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:i.provider})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:i.passRate>=.7?"var(--green-muted)":i.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(i.passRate),fontSize:11,fontWeight:600},children:[Math.round(i.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px"},children:i.baselinePassRate!=null?n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(i.baselinePassRate*100),"%"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.skillDelta!=null?n.jsxs("span",{className:"text-[11px] font-medium",style:{color:i.skillDelta>=0?"var(--green)":"var(--red)"},children:[i.skillDelta>=0?"+":"",(i.skillDelta*100).toFixed(1),"pp"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.amplificationPct!=null&&isFinite(i.amplificationPct)?n.jsx(yk,{pct:i.amplificationPct}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(mg,{data:i.sparklineData})})]},`${i.provider}/${i.model}`))})]})})}function Nk(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState("rankings"),p=`leaderboard/${r}/${i}`,f=v.useCallback(()=>Ne.getLeaderboard(r,i),[r,i]),{data:h,loading:x}=zs(p,f),m=(h==null?void 0:h.entries)??[];v.useEffect(()=>{u("rankings")},[r,i]);const y=v.useCallback(()=>Xn(p),[p]);fo("leaderboard:updated",y);const g=v.useMemo(()=>kk(m),[m]),j=g.some(L=>L.hasBaseline),S=m[0],N=S==null?void 0:S.judgeBiasWarning;return x?n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"spinner spinner-lg"})}):g.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),n.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),n.jsx("div",{className:"text-[11px] font-mono px-4 py-3 rounded-lg text-left",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:'vskill eval sweep --models "anthropic/claude-sonnet-4,openrouter/meta-llama/llama-3.1-70b" --judge "anthropic/claude-sonnet-4"'}),n.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",n.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):n.jsxs("div",{className:"p-5 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),n.jsx(Sk,{active:o,onChange:u,hasBaseline:j})]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[m.length," sweep",m.length!==1?"s":""," · ",g.length," model",g.length!==1?"s":""]})]}),N&&n.jsx(jk,{warning:N}),o==="rankings"?n.jsx(wk,{entries:g}):n.jsx(Ck,{entries:g}),o==="amplification"&&(S==null?void 0:S.skillQualityScore)!=null&&(S==null?void 0:S.skillQualityRating)&&n.jsx(bk,{score:S.skillQualityScore,rating:S.skillQualityRating})]})}const Ek=["editor","tests","run","activation","history","leaderboard","deps","versions"];function Tk(a){return a!=null&&Ek.includes(a)}function Rk({hideHeader:a=!1}={}){var j;const{state:r,dispatch:i,saveContent:o,isReadOnly:u}=kn(),{state:p,refreshSkills:f,clearSelection:h}=ya(),x=v.useCallback(async()=>{try{await Ne.deleteSkill(r.plugin,r.skill),f(),h()}catch(S){const N=S instanceof Error?S.message:String(S);i({type:"SET_ERROR",error:`Failed to delete skill: ${N}`})}},[r.plugin,r.skill,f,h,i]);v.useEffect(()=>{const N=new URLSearchParams(window.location.search).get("panel");Tk(N)&&N!==r.activePanel&&i({type:"SET_PANEL",panel:N})},[]),v.useEffect(()=>{const S=new URLSearchParams(window.location.search);S.set("panel",r.activePanel);const N=`${window.location.pathname}?${S.toString()}${window.location.hash}`;history.replaceState(null,"",N)},[r.activePanel]);const m=v.useCallback(S=>{const N=S.ctrlKey||S.metaKey;if(N&&S.key>="1"&&S.key<="8"){S.preventDefault(),i({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps","versions"][parseInt(S.key)-1]});return}if(N&&S.key==="s"&&!S.shiftKey){S.preventDefault(),r.isDirty&&o();return}},[r.isDirty,o,i]);if(v.useEffect(()=>(window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)),[m]),r.loading)return n.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"flex flex-col items-center gap-3",children:[n.jsx("div",{className:"spinner spinner-lg"}),n.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const y=Array.from(r.caseRunStates.values()).some(S=>S.status==="running"||S.status==="queued"),g=((j=p.skills.find(S=>S.skill===r.skill&&S.plugin===r.plugin))==null?void 0:j.updateAvailable)??!1;return n.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[!a&&n.jsx(Gd,{state:r,isReadOnly:u,onDelete:u?void 0:x}),r.error&&n.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx(Ls,{error:eS(r.error),onDismiss:()=>i({type:"SET_ERROR",error:null})})}),n.jsx(Z2,{activePanel:r.activePanel,onPanelChange:S=>i({type:"SET_PANEL",panel:S}),isDirty:r.isDirty,isRunning:y,hasRegressions:r.regressions.length>0,isActivationRunning:r.activationRunning,hasUpdate:g}),n.jsx(J2,{children:n.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[r.activePanel==="editor"&&n.jsx(CS,{}),r.activePanel==="tests"&&n.jsx(zS,{}),r.activePanel==="run"&&n.jsx(YS,{}),r.activePanel==="activation"&&n.jsx(XS,{}),r.activePanel==="history"&&n.jsx(fk,{}),r.activePanel==="leaderboard"&&n.jsx(Nk,{}),r.activePanel==="deps"&&n.jsx(vk,{}),r.activePanel==="versions"&&n.jsx(ng,{})]},r.activePanel)})},`${r.plugin}/${r.skill}`)]})}function Ak(a){const r={prompt:a.prompt,provider:a.provider,model:a.model};return a.targetAgents&&a.targetAgents.length>0&&(r.targetAgents=a.targetAgents),r}function wd(a,r=!0){let i=a.toLowerCase().replace(/[^a-z0-9]+/g,"-");return r&&(i=i.replace(/^-+|-+$/g,"")),i}function Mk(a,r,i,o){const p=`.../${a.split("/").slice(-2).join("/")}`;switch(r){case 1:return`${p}/${i}/skills/${o}/SKILL.md`;case 2:return`${p}/plugins/${i}/skills/${o}/SKILL.md`;case 3:return`${p}/skills/${o}/SKILL.md`}}function zk({onCreated:a,resolveAiConfigOverride:r}){const[i,o]=v.useState("ai"),[u,p]=v.useState(null),[f,h]=v.useState(!0),{config:x}=bl(),[m,y]=v.useState(""),[g,j]=v.useState(3),[S,N]=v.useState(""),[L,T]=v.useState(""),[k,M]=v.useState(""),[O,V]=v.useState(""),[A,U]=v.useState(""),[w,D]=v.useState(""),[R,I]=v.useState("write"),[G,q]=v.useState([]),[te,Q]=v.useState(!1),[z,E]=v.useState(null),[B,ne]=v.useState(""),[Y,me]=v.useState(!1),[_,W]=v.useState(!1),[oe,fe]=v.useState(null),[he,xe]=v.useState(null),[ke,ce]=v.useState([]),je=v.useRef(null),Ue=v.useRef(null),Le=v.useRef(null),ae=v.useRef(null),[Z,se]=v.useState(!1),[ue,ge]=v.useState(!1);v.useEffect(()=>{Ne.getProjectLayout().then(ze=>{p(ze),j(ze.suggestedLayout);const xt=ze.detectedLayouts.find(Wt=>Wt.layout===ze.suggestedLayout);xt!=null&&xt.existingPlugins.length&&N(xt.existingPlugins[0])}).catch(()=>{}).finally(()=>h(!1))},[]),v.useEffect(()=>{var ze;i==="ai"&&((ze=je.current)==null||ze.focus())},[i]),v.useEffect(()=>()=>{var ze;(ze=Ue.current)==null||ze.abort()},[]);const Oe=v.useMemo(()=>{var ze;return u?((ze=u.detectedLayouts.find(xt=>xt.layout===g))==null?void 0:ze.existingPlugins)||[]:[]},[u,g]),Me=S==="__new__"?L:S,dt=u?Mk(u.root,g,Me||"{plugin}",m||"{skill}"):"",Zt=v.useMemo(()=>u?u.detectedLayouts.filter(ze=>ze.layout!==4):[],[u]),ct=v.useMemo(()=>{if(!u)return null;const ze=u.detectedLayouts.find(nt=>nt.layout===2&&nt.existingPlugins.length>0),xt=u.detectedLayouts.find(nt=>nt.layout===1&&nt.existingPlugins.length>0),Wt=ze||xt;return Wt?{layout:Wt.layout,plugins:Wt.existingPlugins}:null},[u]),Vt=v.useCallback(()=>{if(r)return r();if(!x)return{provider:"claude-cli",model:"sonnet"};const ze=x.provider||"claude-cli",xt=x.model||"sonnet";return{provider:ze,model:xt}},[x,r]),$t=v.useCallback(()=>{var ze;(ze=Ue.current)==null||ze.abort(),me(!1)},[]),tt=v.useCallback(()=>{fe(null),xe(null)},[]),jt=v.useCallback(async()=>{if(fe(null),xe(null),ce([]),Le.current=null,!B.trim()){fe("Describe what your skill should do");return}me(!0);const ze=new AbortController;Ue.current=ze;const{provider:xt,model:Wt}=Vt();try{const nt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ak({prompt:B.trim(),provider:xt,model:Wt,targetAgents:G})),signal:ze.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const Bn=await nt.json();Bn.error&&(bt=Bn.error)}catch{}throw new Error(bt)}const Qa=nt.body.getReader(),Zn=new TextDecoder;let Ct="",St="";for(;;){const{done:bt,value:Bn}=await Qa.read();if(bt)break;Ct+=Zn.decode(Bn,{stream:!0});const Za=Ct.split(`
|
|
75
|
+
`);Ct=Za.pop()||"";for(const In of Za)if(In.startsWith("event: "))St=In.slice(7).trim();else if(In.startsWith("data: ")){try{const Ve=JSON.parse(In.slice(6));if(St==="progress")ce(It=>[...It,{phase:Ve.phase,message:Ve.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const It={prompt:B.trim(),provider:Vt().provider,model:Vt().model,reasoning:Ve.reasoning||""};if(y(Ve.name),M(Ve.description),V(Ve.model||""),U(Ve.allowedTools||""),D(Ve.body),W(!0),Le.current=It,o("manual"),Ve.suggestedPlugin&&typeof Ve.suggestedPlugin=="object"&&Ve.suggestedPlugin.plugin){const Nt=Ve.suggestedPlugin;if(((u==null?void 0:u.detectedLayouts.flatMap(wn=>wn.existingPlugins))??[]).includes(Nt.plugin))if(N(Nt.plugin),Nt.layout&&(Nt.layout===1||Nt.layout===2))j(Nt.layout);else{const wn=u==null?void 0:u.detectedLayouts.find(So=>So.existingPlugins.includes(Nt.plugin));wn&&(wn.layout===1||wn.layout===2)&&j(wn.layout)}else N("__new__"),T(Nt.plugin)}else g===3&&ct&&ge(!0);const Jn={name:Ve.name,plugin:Me||"",layout:g,description:Ve.description,model:Ve.model||void 0,allowedTools:Ve.allowedTools||void 0,body:Ve.body,aiMeta:It};Ne.saveDraft(Jn).then(Nt=>{se(!0),Nt!=null&&Nt.dir&&(ae.current=Nt.dir)}).catch(()=>{})}else St==="error"&&(fe(Ve.message||Ve.description||"Unknown error"),Ve.category&&xe(Ve))}catch{}St=""}}}catch(nt){nt.name!=="AbortError"&&fe(nt.message)}finally{me(!1),Ue.current=null}},[B,Vt,g,ct,Me,u,G]),ve=v.useCallback(async()=>{if(E(null),!m.trim()){E("Skill name is required");return}if(!k.trim()){E("Description is required");return}if(g!==3&&!Me.trim()){E("Plugin name is required");return}Q(!0);try{const ze=await Ne.createSkill({name:wd(m),plugin:Me||"",layout:g,description:k,model:O||void 0,allowedTools:A||void 0,body:w,aiMeta:Le.current||void 0,draftDir:ae.current||void 0});ae.current=null,a(ze.plugin,ze.skill)}catch(ze){E(ze.message)}finally{Q(!1)}},[m,k,g,Me,O,A,w,a]),Rt=v.useCallback(()=>{ct&&(j(ct.layout),N(ct.plugins[0]),ge(!1))},[ct]);return{mode:i,setMode:o,layout:u,layoutLoading:f,selectedLayout:g,setSelectedLayout:j,creatableLayouts:Zt,availablePlugins:Oe,pathPreview:dt,plugin:S,setPlugin:N,newPlugin:L,setNewPlugin:T,effectivePlugin:Me,name:m,setName:y,description:k,setDescription:M,model:O,setModel:V,allowedTools:A,setAllowedTools:U,body:w,setBody:D,bodyViewMode:R,setBodyViewMode:I,aiPrompt:B,setAiPrompt:ne,generating:Y,aiGenerated:_,aiError:oe,aiClassifiedError:he,aiProgress:ke,promptRef:je,handleGenerate:jt,handleCancelGenerate:$t,clearAiError:tt,targetAgents:G,setTargetAgents:q,draftSaved:Z,showPluginRecommendation:ue,setShowPluginRecommendation:ge,pluginLayoutInfo:ct,applyPluginRecommendation:Rt,creating:te,error:z,handleCreate:ve}}function xg(){return n.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function Lk(){return n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function vg({node:a,depth:r=0}){var i;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${r*16}px`,color:a.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[a.type==="dir"?n.jsx(xg,{}):n.jsx(Lk,{}),n.jsxs("span",{children:[a.name,a.type==="dir"?"/":""]})]}),(i=a.children)==null?void 0:i.map(o=>n.jsx(vg,{node:o,depth:r+1},o.name))]})}function Dk(a,r,i){const o=[];r&&o.push({name:"evals.json",type:"file"}),o.push({name:"history",type:"dir"});const u=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:o}];return i&&u.push({name:"draft.json",type:"file"}),{name:a||"{skill}",type:"dir",children:u}}function _k({skillName:a,hasEvals:r,isDraft:i}){const o=Dk(a,r,i);return n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[n.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsx(xg,{})}),"Skill Structure"]}),n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:n.jsx(vg,{node:o})})]})}const qa={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function ad({size:a=14,color:r="currentColor"}){return n.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function Ok({onCreated:a,onCancel:r}){const i=zk({onCreated:a});return n.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[n.jsxs("div",{className:"mb-5",children:[n.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),n.jsx("div",{className:"flex items-center justify-between mt-2",children:n.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsx("button",{onClick:()=>i.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:i.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:i.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:i.mode==="ai"?"0 1px 3px rgba(168,85,247,0.15)":"none",cursor:"pointer",border:"none"},children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(ad,{size:12}),"AI-Assisted"]})}),n.jsx("button",{onClick:()=>i.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:i.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:i.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:i.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),i.layoutLoading&&n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),n.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!i.layoutLoading&&i.layout&&i.mode==="ai"&&n.jsxs("div",{className:"space-y-4 animate-fade-in",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[n.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsx(ad,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),n.jsx("textarea",{ref:i.promptRef,value:i.aiPrompt,onChange:o=>i.setAiPrompt(o.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
|
|
76
76
|
|
|
77
|
-
Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:i.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...qa,minHeight:"120px"},onKeyDown:o=>{o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),i.handleGenerate())}}),n.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),i.generating&&i.aiProgress.length>0&&n.jsx(Ds,{entries:i.aiProgress,isRunning:!0}),i.aiError&&n.jsx("div",{children:i.aiClassifiedError?n.jsx(Ls,{error:i.aiClassifiedError,onRetry:i.handleGenerate,onDismiss:i.clearAiError}):n.jsxs("div",{children:[n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:i.aiError}),n.jsx("button",{onClick:i.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),n.jsxs("div",{className:"flex items-center gap-3",children:[i.generating?n.jsx("button",{onClick:i.handleCancelGenerate,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)",border:"none",cursor:"pointer"},children:"Cancel Generation"}):n.jsxs("button",{onClick:i.handleGenerate,disabled:!i.aiPrompt.trim(),className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:i.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:i.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:i.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[n.jsx(ad,{size:14}),"Generate"]}),n.jsx("button",{onClick:r,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"}),!i.generating&&n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",n.jsx("button",{onClick:()=>i.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!i.layoutLoading&&i.layout&&i.mode==="manual"&&n.jsxs("div",{className:"space-y-4 animate-fade-in",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),i.creatableLayouts.length>1&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),n.jsx("div",{className:"flex gap-2",children:i.creatableLayouts.map(o=>n.jsx("button",{onClick:()=>{i.setSelectedLayout(o.layout),i.setPlugin(o.existingPlugins[0]||""),i.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:i.selectedLayout===o.layout?"var(--accent)":"var(--surface-3)",color:i.selectedLayout===o.layout?"#fff":"var(--text-secondary)",border:`1px solid ${i.selectedLayout===o.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:o.label},o.layout))})]}),i.selectedLayout!==3&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),n.jsxs("select",{value:i.plugin,onChange:o=>{i.setPlugin(o.target.value),i.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa,children:[i.availablePlugins.map(o=>n.jsx("option",{value:o,children:o},o)),n.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),i.plugin==="__new__"&&n.jsx("input",{type:"text",value:i.newPlugin,onChange:o=>i.setNewPlugin(kd(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:qa})]}),n.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:i.pathPreview})]}),i.showPluginRecommendation&&i.pluginLayoutInfo&&i.selectedLayout===3&&n.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex items-center justify-between gap-3",style:{background:"rgba(59,130,246,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(59,130,246,0.2)"},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),n.jsxs("span",{children:["Plugins detected (",n.jsx("strong",{children:i.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:i.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),n.jsx("button",{onClick:()=>i.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("input",{type:"text",value:i.name,onChange:o=>i.setName(kd(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa})]}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("textarea",{value:i.description,onChange:o=>i.setDescription(o.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...qa,minHeight:"72px"}})]}),n.jsxs("div",{className:"flex gap-3",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsxs("select",{value:i.model,onChange:o=>i.setModel(o.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa,children:[n.jsx("option",{value:"",children:"Any"}),n.jsx("option",{value:"opus",children:"Opus"}),n.jsx("option",{value:"sonnet",children:"Sonnet"}),n.jsx("option",{value:"haiku",children:"Haiku"})]})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),n.jsx("input",{type:"text",value:i.allowedTools,onChange:o=>i.setAllowedTools(o.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa})]})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"}),n.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),n.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),n.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(o=>n.jsxs("button",{onClick:()=>i.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:i.bodyViewMode===o?"var(--surface-4)":"transparent",color:i.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:i.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="write"?n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]}):n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),n.jsx("span",{children:o==="write"?"Write":"Preview"})]},o))})]}),i.bodyViewMode==="write"?n.jsx("textarea",{value:i.body,onChange:o=>i.setBody(o.target.value),placeholder:`# /my-skill
|
|
77
|
+
Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:i.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...qa,minHeight:"120px"},onKeyDown:o=>{o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),i.handleGenerate())}}),n.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),i.generating&&i.aiProgress.length>0&&n.jsx(Ds,{entries:i.aiProgress,isRunning:!0}),i.aiError&&n.jsx("div",{children:i.aiClassifiedError?n.jsx(Ls,{error:i.aiClassifiedError,onRetry:i.handleGenerate,onDismiss:i.clearAiError}):n.jsxs("div",{children:[n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:i.aiError}),n.jsx("button",{onClick:i.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),n.jsxs("div",{className:"flex items-center gap-3",children:[i.generating?n.jsx("button",{onClick:i.handleCancelGenerate,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)",border:"none",cursor:"pointer"},children:"Cancel Generation"}):n.jsxs("button",{onClick:i.handleGenerate,disabled:!i.aiPrompt.trim(),className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:i.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:i.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:i.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[n.jsx(ad,{size:14}),"Generate"]}),n.jsx("button",{onClick:r,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"}),!i.generating&&n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",n.jsx("button",{onClick:()=>i.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!i.layoutLoading&&i.layout&&i.mode==="manual"&&n.jsxs("div",{className:"space-y-4 animate-fade-in",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),i.creatableLayouts.length>1&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),n.jsx("div",{className:"flex gap-2",children:i.creatableLayouts.map(o=>n.jsx("button",{onClick:()=>{i.setSelectedLayout(o.layout),i.setPlugin(o.existingPlugins[0]||""),i.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:i.selectedLayout===o.layout?"var(--accent)":"var(--surface-3)",color:i.selectedLayout===o.layout?"#fff":"var(--text-secondary)",border:`1px solid ${i.selectedLayout===o.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:o.label},o.layout))})]}),i.selectedLayout!==3&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),n.jsxs("select",{value:i.plugin,onChange:o=>{i.setPlugin(o.target.value),i.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa,children:[i.availablePlugins.map(o=>n.jsx("option",{value:o,children:o},o)),n.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),i.plugin==="__new__"&&n.jsx("input",{type:"text",value:i.newPlugin,onChange:o=>i.setNewPlugin(wd(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:qa})]}),n.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:i.pathPreview})]}),i.showPluginRecommendation&&i.pluginLayoutInfo&&i.selectedLayout===3&&n.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex items-center justify-between gap-3",style:{background:"rgba(59,130,246,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(59,130,246,0.2)"},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),n.jsxs("span",{children:["Plugins detected (",n.jsx("strong",{children:i.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:i.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),n.jsx("button",{onClick:()=>i.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("input",{type:"text",value:i.name,onChange:o=>i.setName(wd(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa})]}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("textarea",{value:i.description,onChange:o=>i.setDescription(o.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...qa,minHeight:"72px"}})]}),n.jsxs("div",{className:"flex gap-3",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsxs("select",{value:i.model,onChange:o=>i.setModel(o.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa,children:[n.jsx("option",{value:"",children:"Any"}),n.jsx("option",{value:"opus",children:"Opus"}),n.jsx("option",{value:"sonnet",children:"Sonnet"}),n.jsx("option",{value:"haiku",children:"Haiku"})]})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),n.jsx("input",{type:"text",value:i.allowedTools,onChange:o=>i.setAllowedTools(o.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa})]})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"}),n.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),n.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),n.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(o=>n.jsxs("button",{onClick:()=>i.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:i.bodyViewMode===o?"var(--surface-4)":"transparent",color:i.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:i.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="write"?n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]}):n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),n.jsx("span",{children:o==="write"?"Write":"Preview"})]},o))})]}),i.bodyViewMode==="write"?n.jsx("textarea",{value:i.body,onChange:o=>i.setBody(o.target.value),placeholder:`# /my-skill
|
|
78
78
|
|
|
79
79
|
You are an expert at...
|
|
80
|
-
`,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...qa,minHeight:"150px"}}):i.body.trim()?n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:bo(i.body)}}):n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},children:n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),n.jsx(_k,{skillName:i.name||"{skill}",hasEvals:!1,isDraft:i.draftSaved}),i.error&&n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:i.error}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:i.handleCreate,disabled:i.creating||!i.name||!i.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:i.creating||!i.name||!i.description?"var(--surface-3)":"var(--accent)",color:i.creating||!i.name||!i.description?"var(--text-tertiary)":"#fff",cursor:i.creating||!i.name||!i.description?"not-allowed":"pointer",border:"none"},children:i.creating?"Creating...":"Create Skill"}),n.jsx("button",{onClick:r,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]})]})]})}function Bk(){return n.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:n.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),n.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function io({variant:a,message:r,onRetry:i}){const{setMode:o,setSearch:u}=ya(),[p,f]=v.useState(!1);return a==="no-selection"?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[n.jsx("div",{className:"mb-5",children:p?n.jsx(Bk,{}):n.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>f(!0),style:{objectFit:"contain"}})}),n.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):a==="no-skills"?n.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[n.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:n.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})})}),n.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),n.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",n.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-2)"},children:"--root"})," directory, or create your first skill"]}),n.jsxs("button",{onClick:()=>o("create"),className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:"var(--accent)",color:"#fff",border:"none",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.opacity="0.9"},onMouseLeave:h=>{h.currentTarget.style.opacity="1"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):a==="error"?n.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:n.jsxs("div",{className:"px-5 py-4 rounded-lg text-center max-w-sm",style:{background:"var(--red-muted)",border:"1px solid rgba(248,113,113,0.2)"},children:[n.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:r||"Failed to load skill data"}),i&&n.jsx("button",{onClick:i,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):n.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[n.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),n.jsx("button",{onClick:()=>u(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function Ik(a,r){const[i,o]=a.split(".").map(Number),[u,p]=r.split(".").map(Number);return u>i?"major":p>o?"minor":"patch"}const Hk={major:{bg:"var(--red-muted)",text:"var(--red)"},minor:{bg:"var(--yellow-muted)",text:"var(--yellow)"},patch:{bg:"var(--green-muted)",text:"var(--green)"}};function Uk(){const[a,r]=v.useState([]),[i,o]=v.useState(!0),[u,p]=v.useState(new Set),[f,h]=v.useState(new Map),[x,m]=v.useState(!1),[y,g]=v.useState(new Set),[j,S]=v.useState(null),[N,z]=v.useState(null),[T,k]=v.useState(!1),M=v.useCallback(async()=>{o(!0);try{const R=await Ne.getSkillUpdates();r(R.filter(I=>I.updateAvailable))}catch{r([])}finally{o(!1)}},[]);v.useEffect(()=>{M()},[M]);const O=v.useMemo(()=>a.filter(R=>!R.pinned),[a]),V=v.useCallback(R=>{p(I=>{const G=new Set(I);return G.has(R)?G.delete(R):G.add(R),G})},[]),A=v.useCallback(()=>{u.size===O.length?p(new Set):p(new Set(O.map(R=>R.name)))},[u,O]),U=v.useCallback(()=>{const R=[...u];if(!R.length)return;m(!0),h(new Map(R.map(G=>[G,{skill:G,status:"pending"}])));const I=Ne.startBatchUpdate(R);I.addEventListener("progress",G=>{try{const Y=JSON.parse(G.data);h(te=>new Map(te).set(Y.skill,Y))}catch{}}),I.addEventListener("done",G=>{I.close(),m(!1);try{const Y=JSON.parse(G.data);S(`Updated ${Y.updated??0} skills, ${Y.failed??0} failed`),setTimeout(()=>S(null),5e3)}catch{}M()}),I.addEventListener("error",()=>{I.close(),m(!1),S("Batch update failed"),setTimeout(()=>S(null),5e3)})},[u,M]),w=v.useCallback(R=>{R.name.split("/").pop()||R.name;const I=R.name.split("/"),G=I.length>=3?I[I.length-2]:I[0],Y=I[I.length-1];g(q=>new Set(q).add(R.name));const te=Ne.startSkillUpdate(G,Y);te.addEventListener("done",()=>{te.close(),g(q=>{const _=new Set(q);return _.delete(R.name),_}),M()}),te.addEventListener("error",()=>{te.close(),g(q=>{const _=new Set(q);return _.delete(R.name),_})})},[M]),L=v.useCallback(async R=>{if(!R.latest)return;const I=R.name.split("/"),G=I.length>=3?I[I.length-2]:I[0],Y=I[I.length-1];k(!0);try{const te=await Ne.getVersionDiff(G,Y,R.installed,R.latest);z({skill:R,diff:te})}catch{z(null)}finally{k(!1)}},[]);return i?n.jsxs("div",{className:"p-6",children:[n.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-16 rounded-lg"}),n.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):a.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16",children:[n.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-4",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),n.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),n.jsx("button",{onClick:M,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):n.jsxs("div",{className:"p-6",children:[j&&n.jsx("div",{className:"fixed top-4 right-4 z-50 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:j}),n.jsxs("div",{className:"flex items-center justify-between mb-5",children:[n.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",O.length,")"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:M,className:"btn btn-ghost text-[12px]",disabled:x,children:"Refresh"}),n.jsx("button",{onClick:U,disabled:u.size===0||x,className:"btn btn-primary text-[12px]",children:x?"Updating...":`Update Selected (${u.size})`})]})]}),n.jsx("div",{className:"flex items-center gap-2 mb-3",children:n.jsxs("button",{onClick:A,className:"flex items-center gap-2 text-[12px] font-medium",style:{color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:[n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:u.size===O.length&&O.length>0?"var(--accent)":"var(--border-default)",background:u.size===O.length&&O.length>0?"var(--accent)":"transparent"},children:u.size===O.length&&O.length>0&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),"Select All"]})}),n.jsx("div",{className:"space-y-2",children:a.map(R=>{const I=R.name.split("/").pop()||R.name,G=R.latest?Ik(R.installed,R.latest):"patch",Y=Hk[G],te=!!R.pinned,q=y.has(R.name),_=f.get(R.name),E=u.has(R.name);return n.jsx("div",{className:"rounded-lg px-4 py-3 transition-all duration-150",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",opacity:te?.7:1},children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:()=>!te&&V(R.name),disabled:te,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:te?"not-allowed":"pointer"},children:n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:E?"var(--accent)":"var(--border-default)",background:E?"var(--accent)":"transparent",opacity:te?.4:1},children:E&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:I}),te&&n.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),n.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:Y.bg,color:Y.text},children:G})]}),n.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[R.installed," → ",R.latest||"?",te&&` (pinned at ${R.pinnedVersion||R.installed})`]})]}),_&&n.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:_.status==="done"?"var(--green-muted)":_.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:_.status==="done"?"var(--green)":_.status==="error"?"var(--red)":"var(--yellow)"},children:[_.status,_.error&&`: ${_.error}`]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:()=>L(R),className:"btn btn-ghost text-[11px]",disabled:T,children:"View Changes"}),n.jsx("button",{onClick:()=>w(R),disabled:te||q||x,title:te?"Pinned — unpin from CLI to update":"",className:`btn ${te?"btn-ghost":"btn-primary"} text-[11px]`,children:q?n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(_==null?void 0:_.status)==="done"?n.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},R.name)})}),N&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>z(null),children:n.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:R=>R.stopPropagation(),children:[n.jsx("div",{className:"mb-2 flex justify-end",children:n.jsx("button",{onClick:()=>z(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),n.jsx(Vd,{contentDiff:N.diff.contentDiff,fromLabel:N.diff.from,toLabel:N.diff.to,diffSummary:N.diff.diffSummary,renderContext:"inline"})]})})]})}const Vk=[{id:"amp",displayName:"Amp",localSkillsDir:".amp/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which amp",parentCompany:"Sourcegraph",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"cline",displayName:"Cline",localSkillsDir:".cline/skills",globalSkillsDir:"~/.cline/skills",isUniversal:!0,detectInstalled:"which cline",parentCompany:"Cline",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"codex",displayName:"Codex CLI",localSkillsDir:".codex/skills",globalSkillsDir:"~/.codex/skills",isUniversal:!0,detectInstalled:"which codex",parentCompany:"OpenAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cursor",displayName:"Cursor",localSkillsDir:".cursor/skills",globalSkillsDir:"~/.cursor/skills",isUniversal:!0,detectInstalled:"which cursor",parentCompany:"Anysphere",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"gemini-cli",displayName:"Gemini CLI",localSkillsDir:".gemini/skills",globalSkillsDir:"~/.gemini/skills",isUniversal:!0,detectInstalled:"which gemini",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"github-copilot-ext",displayName:"GitHub Copilot (VS Code)",localSkillsDir:".github/copilot/skills",globalSkillsDir:"~/.config/github-copilot/skills",isUniversal:!0,detectInstalled:"which code && ls ~/.vscode/extensions/github.copilot-* 2>/dev/null",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"kimi-cli",displayName:"Kimi CLI",localSkillsDir:".kimi/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which kimi",parentCompany:"Moonshot AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"opencode",displayName:"OpenCode",localSkillsDir:".opencode/skills",globalSkillsDir:"~/.config/opencode/skills",isUniversal:!0,detectInstalled:"which opencode",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"antigravity",displayName:"Antigravity",localSkillsDir:".agent/skills",globalSkillsDir:"~/.gemini/antigravity/skills",isUniversal:!1,detectInstalled:"which antigravity",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"augment",displayName:"Augment Code",localSkillsDir:".augment/skills",globalSkillsDir:"~/.augment/skills",isUniversal:!1,detectInstalled:"which augment",parentCompany:"Augment",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"claude-code",displayName:"Claude Code",localSkillsDir:".claude/skills",globalSkillsDir:"~/.claude/skills",isUniversal:!1,detectInstalled:"which claude",parentCompany:"Anthropic",featureSupport:{slashCommands:!0,hooks:!0,mcp:!0,customSystemPrompt:!0},pluginCacheDir:"~/.claude/plugins/cache",pluginMarketplaceDir:"~/.claude/plugins/marketplaces"},{id:"openclaw",displayName:"OpenClaw",localSkillsDir:".openclaw/skills",globalSkillsDir:"~/.openclaw/skills",isUniversal:!1,detectInstalled:"which openclaw",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"replit",displayName:"Replit Agent",localSkillsDir:".replit/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!1,detectInstalled:"which replit",parentCompany:"Replit",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"codebuddy",displayName:"CodeBuddy",localSkillsDir:".codebuddy/skills",globalSkillsDir:"~/.codebuddy/skills",isUniversal:!1,detectInstalled:"which codebuddy",parentCompany:"CodeBuddy",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"command-code",displayName:"Command Code",localSkillsDir:".commandcode/skills",globalSkillsDir:"~/.commandcode/skills",isUniversal:!1,detectInstalled:"which command-code",parentCompany:"Command",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"continue",displayName:"Continue",localSkillsDir:".continue/skills",globalSkillsDir:"~/.continue/skills",isUniversal:!1,detectInstalled:"which continue",parentCompany:"Continue",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"crush",displayName:"Crush",localSkillsDir:".crush/skills",globalSkillsDir:"~/.config/crush/skills",isUniversal:!1,detectInstalled:"which crush",parentCompany:"Crush",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"droid",displayName:"Droid (Factory)",localSkillsDir:".factory/skills",globalSkillsDir:"~/.factory/skills",isUniversal:!1,detectInstalled:"which droid",parentCompany:"Factory",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"goose",displayName:"Goose",localSkillsDir:".goose/skills",globalSkillsDir:"~/.config/goose/skills",isUniversal:!1,detectInstalled:"which goose",parentCompany:"Block",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"junie",displayName:"Junie",localSkillsDir:".junie/skills",globalSkillsDir:"~/.junie/skills",isUniversal:!1,detectInstalled:"which junie",parentCompany:"JetBrains",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"iflow-cli",displayName:"iFlow CLI",localSkillsDir:".iflow/skills",globalSkillsDir:"~/.iflow/skills",isUniversal:!1,detectInstalled:"which iflow",parentCompany:"iFlow",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kilo",displayName:"Kilo Code",localSkillsDir:".kilocode/skills",globalSkillsDir:"~/.kilocode/skills",isUniversal:!1,detectInstalled:"which kilocode",parentCompany:"Kilo Code",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kiro-cli",displayName:"Kiro CLI",localSkillsDir:".kiro/skills",globalSkillsDir:"~/.kiro/skills",isUniversal:!1,detectInstalled:"which kiro",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kode",displayName:"Kode",localSkillsDir:".kode/skills",globalSkillsDir:"~/.kode/skills",isUniversal:!1,detectInstalled:"which kode",parentCompany:"Kode",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mcpjam",displayName:"MCPJam",localSkillsDir:".mcpjam/skills",globalSkillsDir:"~/.mcpjam/skills",isUniversal:!1,detectInstalled:"which mcpjam",parentCompany:"MCPJam",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!1}},{id:"mistral-vibe",displayName:"Mistral Vibe",localSkillsDir:".vibe/skills",globalSkillsDir:"~/.vibe/skills",isUniversal:!1,detectInstalled:"which vibe",parentCompany:"Mistral AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mux",displayName:"Mux",localSkillsDir:".mux/skills",globalSkillsDir:"~/.mux/skills",isUniversal:!1,detectInstalled:"which mux",parentCompany:"Mux",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"openhands",displayName:"OpenHands",localSkillsDir:".openhands/skills",globalSkillsDir:"~/.openhands/skills",isUniversal:!1,detectInstalled:"which openhands",parentCompany:"All Hands AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pi",displayName:"Pi",localSkillsDir:".pi/skills",globalSkillsDir:"~/.pi/agent/skills",isUniversal:!1,detectInstalled:"which pi",parentCompany:"Pi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qoder",displayName:"Qoder",localSkillsDir:".qoder/skills",globalSkillsDir:"~/.qoder/skills",isUniversal:!1,detectInstalled:"which qoder",parentCompany:"Qoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qwen-code",displayName:"Qwen Code",localSkillsDir:".qwen/skills",globalSkillsDir:"~/.qwen/skills",isUniversal:!1,detectInstalled:"which qwen-code",parentCompany:"Alibaba",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"roo",displayName:"Roo Code",localSkillsDir:".roo/skills",globalSkillsDir:"~/.roo/skills",isUniversal:!1,detectInstalled:"which roo",parentCompany:"Roo",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae",displayName:"Trae",localSkillsDir:".trae/skills",globalSkillsDir:"~/.trae/skills",isUniversal:!1,detectInstalled:"which trae",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae-cn",displayName:"Trae CN",localSkillsDir:".trae-cn/skills",globalSkillsDir:"~/.trae-cn/skills",isUniversal:!1,detectInstalled:"which trae-cn",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"windsurf",displayName:"Windsurf",localSkillsDir:".windsurf/skills",globalSkillsDir:"~/.codeium/windsurf/skills",isUniversal:!1,detectInstalled:"which windsurf",parentCompany:"Codeium",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zencoder",displayName:"ZenCoder",localSkillsDir:".zencoder/skills",globalSkillsDir:"~/.zencoder/skills",isUniversal:!1,detectInstalled:"which zencoder",parentCompany:"ZenCoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"neovate",displayName:"Neovate",localSkillsDir:".neovate/skills",globalSkillsDir:"~/.neovate/skills",isUniversal:!1,detectInstalled:"which neovate",parentCompany:"Neovate",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pochi",displayName:"Pochi",localSkillsDir:".pochi/skills",globalSkillsDir:"~/.pochi/skills",isUniversal:!1,detectInstalled:"which pochi",parentCompany:"Pochi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"adal",displayName:"Adal",localSkillsDir:".adal/skills",globalSkillsDir:"~/.adal/skills",isUniversal:!1,detectInstalled:"which adal",parentCompany:"Adal",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cortex",displayName:"Cortex",localSkillsDir:".cortex/skills",globalSkillsDir:"~/.snowflake/cortex/skills",isUniversal:!1,detectInstalled:"which cortex",parentCompany:"Cortex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"aider",displayName:"Aider",localSkillsDir:".aider/skills",globalSkillsDir:"~/.aider/skills",isUniversal:!1,detectInstalled:"which aider",parentCompany:"Aider",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"tabnine",displayName:"Tabnine Chat",localSkillsDir:".tabnine/skills",globalSkillsDir:"~/.tabnine/skills",isUniversal:!1,detectInstalled:"which tabnine",parentCompany:"Tabnine",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"devin",displayName:"Devin",localSkillsDir:".devin/skills",globalSkillsDir:"~/.devin/skills",isUniversal:!1,detectInstalled:"which devin",parentCompany:"Cognition",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"bolt-new",displayName:"bolt.new",localSkillsDir:".bolt/skills",globalSkillsDir:"~/.bolt/skills",isUniversal:!1,detectInstalled:"which bolt",parentCompany:"StackBlitz",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"v0",displayName:"v0",localSkillsDir:".v0/skills",globalSkillsDir:"~/.v0/skills",isUniversal:!1,detectInstalled:"which v0",parentCompany:"Vercel",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"gpt-pilot",displayName:"GPT Pilot",localSkillsDir:".gpt-pilot/skills",globalSkillsDir:"~/.gpt-pilot/skills",isUniversal:!1,detectInstalled:"which gpt-pilot",parentCompany:"Pythagora",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"plandex",displayName:"Plandex",localSkillsDir:".plandex/skills",globalSkillsDir:"~/.plandex/skills",isUniversal:!1,detectInstalled:"which plandex",parentCompany:"Plandex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"sweep",displayName:"Sweep",localSkillsDir:".sweep/skills",globalSkillsDir:"~/.sweep/skills",isUniversal:!1,detectInstalled:"which sweep",parentCompany:"Sweep AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mentat",displayName:"Mentat",localSkillsDir:".mentat/skills",globalSkillsDir:"~/.mentat/skills",isUniversal:!1,detectInstalled:"which mentat",parentCompany:"AbanteAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"copilot-cli",displayName:"GitHub Copilot CLI",localSkillsDir:".copilot/skills",globalSkillsDir:"~/.copilot/skills",isUniversal:!1,detectInstalled:"which copilot",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"warp",displayName:"Warp",localSkillsDir:".warp/skills",globalSkillsDir:"~/.warp/skills",isUniversal:!1,detectInstalled:"which warp",parentCompany:"Warp",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"amazon-q-cli",displayName:"Amazon Q CLI",localSkillsDir:".amazonq/skills",globalSkillsDir:"~/.aws/amazonq/skills",isUniversal:!1,detectInstalled:"which q",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zed",displayName:"Zed",localSkillsDir:".zed/skills",globalSkillsDir:"~/.config/zed/skills",isUniversal:!1,detectInstalled:"which zed",parentCompany:"Zed Industries",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}}],gr={fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px",letterSpacing:.1},yr={background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},$k={fontFamily:"var(--font-sans)",fontSize:11,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},gg={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},yg={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",wordBreak:"break-all"},fr={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",fontVariantNumeric:"tabular-nums"},Gk={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)"},Pk={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",overflowWrap:"anywhere",wordBreak:"break-word"},qk={Description:"Add `description:` to the SKILL.md frontmatter to display a value here.",Version:"Add `version:` to the SKILL.md frontmatter to display a value here.",Category:"Add `category:` to the SKILL.md frontmatter to display a value here.",Author:"Add `author:` to the SKILL.md frontmatter to display a value here.",License:"Add `license:` to the SKILL.md frontmatter to display a value here.",Homepage:"Add `homepage:` to the SKILL.md frontmatter to display a value here.",Tags:"Add `tags:` to the SKILL.md frontmatter to display a value here.",Directory:"Filesystem location of this skill — not configurable via SKILL.md.","Entry point":"Add `entry-point:` to the SKILL.md frontmatter to customize; defaults to SKILL.md.","Last modified":"Filesystem mtime — updates automatically on save.","Last benchmark":"Shown after the first benchmark run completes."};function Yk(a){if(a==null||!Number.isFinite(a))return"—";if(a<1024)return`${a} B`;const r=a/1024;if(r<1024)return r>=10?`${Math.round(r)} KB`:`${r.toFixed(1).replace(/\.0$/,"")} KB`;const i=r/1024;return i>=10?`${Math.round(i)} MB`:`${i.toFixed(1).replace(/\.0$/,"")} MB`}function bg(a){if(!a)return"—";const r=new Date(a);if(Number.isNaN(r.getTime()))return a;const i=Date.now()-r.getTime(),o=Math.floor(i/1e3);if(o<60)return"just now";const u=Math.floor(o/60);if(u<60)return`${u} min ago`;const p=Math.floor(u/60);if(p<24)return`${p} hr ago`;const f=Math.floor(p/24);if(f<30)return`${f} day${f===1?"":"s"} ago`;const h=Math.floor(f/30);if(h<12)return`${h} month${h===1?"":"s"} ago`;const x=Math.floor(h/12);return`${x} year${x===1?"":"s"} ago`}function Fk(a){const r=Vk.find(i=>i.id===a);return(r==null?void 0:r.displayName)??a}function hr(a){const r=a?qk[a]:void 0;return n.jsx("span",{style:Gk,title:r,children:"—"})}function bn(a,r,i){return n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"130px 1fr",alignItems:"baseline",gap:12,padding:"6px 0"},children:[n.jsx("span",{style:$k,children:a}),n.jsx("span",{style:{minWidth:0},children:r})]},a)}function cr(a,r,i={}){if(r==null||r==="")return bn(a,hr(a));if(i.path)return bn(a,n.jsx("span",{"data-path-value":"true",style:Pk,children:r}));const o=i.tabular?fr:i.mono?yg:gg;return bn(a,n.jsx("span",{style:o,children:r}))}function Wk({skill:a,allSkills:r=[],onSelectSkill:i}){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[Kk(a),a.origin==="installed"?Xk(a):null,Qk(a),Jk(a),ew(a),nw(a,r,i)]})}function Kk(a){const r=a.homepage?n.jsxs("a",{href:a.homepage,target:"_blank",rel:"noopener noreferrer","data-external-link":"homepage",style:{...yg,color:"var(--text-accent)",textDecoration:"none",display:"inline-flex",alignItems:"center",gap:4},onMouseEnter:o=>{o.currentTarget.style.textDecoration="underline"},onMouseLeave:o=>{o.currentTarget.style.textDecoration="none"},children:[n.jsx("span",{children:a.homepage}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:11,color:"var(--text-accent)"},children:"↗"})]}):hr("Homepage"),i=a.tags&&a.tags.length>0?n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:a.tags.map(o=>n.jsx("span",{"data-chip":"tag",style:{fontFamily:"var(--font-sans)",fontSize:11,padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:999,color:"var(--text-secondary)",background:"transparent"},children:o},o))}):hr("Tags");return n.jsxs("section",{style:yr,"aria-labelledby":"md-frontmatter",children:[n.jsx("h3",{id:"md-frontmatter",style:gr,children:"Frontmatter"}),cr("Description",a.description??null),cr("Version",a.version??null,{tabular:!0}),cr("Category",a.category??null),cr("Author",a.author??null),cr("License",a.license??null),bn("Homepage",r),bn("Tags",i)]},"frontmatter")}function Xk(a){const r=a.sourceAgent,i=r?n.jsx("span",{style:gg,"data-agent-id":r,children:Fk(r)}):hr("Agent");return n.jsxs("section",{style:yr,"aria-labelledby":"md-source-agent",children:[n.jsx("h3",{id:"md-source-agent",style:gr,children:"Source agent"}),bn("Agent",i)]},"source-agent")}function Qk(a){const r=a.lastModified?n.jsx("span",{style:fr,title:a.lastModified,children:bg(a.lastModified)}):hr("Last modified"),i=a.entryPoint??"SKILL.md",o=a.dir?`${a.dir.replace(/\/$/,"")}/${i}`:i,u=n.jsx("button",{type:"button","data-entry-chip":"true",title:`Copy ${o}`,"aria-label":`Copy entry-point path ${o} to clipboard`,onClick:()=>Zk(o),style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",cursor:"pointer",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i});return n.jsxs("section",{style:yr,"aria-labelledby":"md-fs",children:[n.jsx("h3",{id:"md-fs",style:gr,children:"Filesystem"}),cr("Directory",a.dir||null,{path:!0}),bn("Entry point",u),bn("Size",n.jsx("span",{style:fr,children:Yk(a.sizeBytes)})),bn("Last modified",r)]},"filesystem")}function Zk(a){var r;try{(r=navigator.clipboard)==null||r.writeText(a)}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:`Copied ${a}`,severity:"info"}}))}function Jk(a){const r=a.benchmarkStatus==="pass"?"var(--status-installed)":a.benchmarkStatus==="fail"?"var(--red, #b54444)":"var(--status-own)",i=n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:7,height:7,borderRadius:999,background:r}}),a.benchmarkStatus]}),o=a.lastBenchmark?n.jsx("span",{style:fr,title:a.lastBenchmark,children:bg(a.lastBenchmark)}):hr("Last benchmark");return n.jsxs("section",{style:yr,"aria-labelledby":"md-bench",children:[n.jsx("h3",{id:"md-bench",style:gr,children:"Benchmark"}),bn("Eval count",n.jsx("span",{style:fr,children:a.evalCount})),bn("Assertions",n.jsx("span",{style:fr,children:a.assertionCount})),bn("Status",i),bn("Last benchmark",o)]},"benchmark")}function ew(a){const r=a.mcpDeps??[];return n.jsxs("section",{style:yr,"aria-labelledby":"md-mcp",children:[n.jsx("h3",{id:"md-mcp",style:gr,children:"MCP dependencies"}),r.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No MCP dependencies"}):n.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:r.map(i=>n.jsxs("li",{"data-mcp-dep":i,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 0",borderBottom:"1px solid var(--border-default)"},children:[n.jsx(tw,{}),n.jsx("span",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:i})]},i))})]},"mcp-deps")}function tw(){return n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--text-secondary)",flexShrink:0},"aria-hidden":"true",children:[n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"})]})}function nw(a,r,i){const o=a.deps??[];return n.jsxs("section",{style:yr,"aria-labelledby":"md-skill-deps",children:[n.jsx("h3",{id:"md-skill-deps",style:gr,children:"Skill dependencies"}),o.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No skill dependencies"}):n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:o.map(u=>{const p=aw(u,r),f=p!=null,h={fontFamily:"var(--font-sans)",fontSize:12,padding:"3px 10px",border:"1px solid var(--border-default)",borderRadius:999,color:f?"var(--text-primary)":"var(--text-secondary)",background:"transparent",cursor:f?"pointer":"help"},x=f&&i?()=>i({plugin:p.plugin,skill:p.skill,origin:p.origin}):void 0,m=f&&i?y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),i({plugin:p.plugin,skill:p.skill,origin:p.origin}))}:void 0;return n.jsx("button",{type:"button","data-chip":"skill-dep","data-present":f?"true":"false",title:f?`Open ${u}`:"Not installed",onClick:x,onKeyDown:m,style:h,children:u},u)})})]},"skill-deps")}function aw(a,r){const[i,o]=a.includes("/")?a.split("/"):["",a];for(const u of r)if(i&&u.plugin===i&&u.skill===o||!i&&u.skill===o)return u;return null}const tv=v.memo(function({message:r,politeness:i="polite",role:o}){const u=o??(i==="assertive"?"alert":"status");return n.jsx("div",{"aria-live":i,"aria-atomic":"true",role:u,"data-testid":"aria-live","data-politeness":i,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0,padding:0,margin:-1},children:r})});function lw({toast:a,onDismiss:r}){const[i,o]=v.useState(!0),u=v.useRef(null);v.useEffect(()=>(u.current=requestAnimationFrame(()=>{u.current=requestAnimationFrame(()=>o(!1))}),()=>{u.current!=null&&cancelAnimationFrame(u.current)}),[]);const p={success:"var(--status-installed)",info:"var(--text-secondary)",error:"var(--color-accent, var(--accent-surface))"};return n.jsxs("div",{role:a.severity==="error"?"alert":"status","data-testid":"toast-item","data-severity":a.severity,style:{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",minWidth:240,maxWidth:360,background:"var(--bg-canvas)",color:"var(--text-primary)",border:"1px solid var(--border-default)",borderLeft:`3px solid ${p[a.severity]}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.12)",fontFamily:"var(--font-sans)",fontSize:12,transform:i?"translateY(8px)":"translateY(0)",opacity:i?0:1,transition:"transform var(--duration-base, 180ms) var(--ease-standard, ease), opacity var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{style:{flex:1,minWidth:0},children:a.message}),a.action&&n.jsx("button",{type:"button",onClick:()=>{a.action.onInvoke(),r(a.id)},style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"3px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:a.action.label}),n.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>r(a.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function rw({toasts:a,onDismiss:r,liveMessage:i,liveAssertiveMessage:o}){return n.jsxs(n.Fragment,{children:[n.jsx(tv,{politeness:"polite",message:i}),n.jsx(tv,{politeness:"assertive",message:o}),a.length>0&&n.jsx("div",{"data-testid":"toast-stack",style:{position:"fixed",right:16,bottom:16,display:"flex",flexDirection:"column-reverse",gap:8,zIndex:50,pointerEvents:"none"},children:a.map(u=>n.jsx("div",{style:{pointerEvents:"auto"},children:n.jsx(lw,{toast:u,onDismiss:r})},u.id))})]})}const jg=v.createContext(null);function Gd(){const a=v.useContext(jg);if(!a)throw new Error("useToast must be used inside <ToastProvider>.");return a}function sw({children:a,maxVisible:r=4,defaultDurationMs:i=4e3}){const[o,u]=v.useState([]),[p,f]=v.useState(""),[h,x]=v.useState(""),m=v.useRef(new Map),y=v.useCallback(T=>{const k=m.current.get(T);k&&(clearTimeout(k),m.current.delete(T)),u(M=>M.filter(O=>O.id!==T))},[]),g=v.useCallback((T,k)=>{if(k<=0)return;const M=setTimeout(()=>{y(T)},k);m.current.set(T,M)},[y]),j=v.useCallback(T=>{const k=T.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,M={id:k,message:T.message,severity:T.severity??"info",durationMs:T.durationMs??i,action:T.action};return u(O=>[...O,M]),M.severity==="error"?x(M.message):f(M.message),g(k,M.durationMs),k},[i,g]),S=v.useCallback(()=>{for(const T of m.current.values())clearTimeout(T);m.current.clear(),u([])},[]);v.useEffect(()=>{function T(k){k.key==="Escape"&&u(M=>{if(M.length===0)return M;const O=M.slice(0,r),V=O[O.length-1],A=m.current.get(V.id);return A&&(clearTimeout(A),m.current.delete(V.id)),M.filter(U=>U.id!==V.id)})}return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r]),v.useEffect(()=>()=>{for(const T of m.current.values())clearTimeout(T);m.current.clear()},[]);const N=o.slice(0,r),z=v.useMemo(()=>({toast:j,dismiss:y,clear:S}),[j,y,S]);return n.jsxs(jg.Provider,{value:z,children:[a,n.jsx(rw,{toasts:N,onDismiss:y,liveMessage:p,liveAssertiveMessage:h})]})}function iw(a){const{toast:r}=Gd(),i=v.useRef(a);i.current=a;const o=v.useCallback(async(...u)=>{const p=i.current,f=p.snapshot();p.apply(...u),p.confirmGraceMs;const h=p.timeoutMs??5e3;let x=!1,m,y=!1;const g=p.commit(...u).then(()=>{x=!0,y=!0},N=>{x=!0,m=N??new Error("Commit failed")}),j=new Promise(N=>{setTimeout(N,h)});if(await Promise.race([g,j]),!x)m=new Error("TIMEOUT");else if(y)return;p.rollback(f);const S=typeof p.failureMessage=="function"?p.failureMessage(m):p.failureMessage??"Couldn't complete that action.";r({message:S,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{o(...u)}}})},[r]);return{run:o}}const nv=6e4;function ow({skill:a}){const{refreshUpdates:r}=ya(),{toast:i}=Gd(),[o,u]=v.useState("idle"),[p,f]=v.useState(null),[h,x]=v.useState(!1),[m,y]=v.useState(null),[g,j]=v.useState(!1),S=v.useRef(null),N=v.useRef(null),z=v.useCallback(()=>new Promise((V,A)=>{if(!a){A(new Error("No skill selected"));return}const U=Ne.startSkillUpdate(a.plugin,a.skill);S.current=U;const w=()=>{N.current&&(clearTimeout(N.current),N.current=null);try{U.close()}catch{}S.current=null};N.current=setTimeout(()=>{w(),A(new Error("TIMEOUT"))},nv),U.addEventListener("progress",L=>{try{const R=JSON.parse(L.data);typeof(R==null?void 0:R.status)=="string"&&f(R.status)}catch{}}),U.addEventListener("done",()=>{w(),u("done"),f(null),r(),i({message:`Updated ${a.skill}.`,severity:"success",durationMs:4e3}),V()}),U.addEventListener("error",L=>{w();let R="Stream error";try{const I=typeof L.data=="string"?JSON.parse(L.data):null;I!=null&&I.error&&(R=String(I.error))}catch{}A(new Error(R))})}),[a,r,i]),T=iw({snapshot:()=>({status:o}),apply:()=>{u("updating"),f("updating")},commit:()=>z(),rollback:V=>{u(V.status==="updating"?"idle":V.status),f(null)},failureMessage:V=>`Couldn't update ${(a==null?void 0:a.skill)??"skill"} — ${V.message}`,timeoutMs:nv+1e3});if(v.useEffect(()=>{if(!h||m!=null||!a||!a.latestVersion)return;let V=!1;return j(!0),Ne.getVersionDiff(a.plugin,a.skill,a.currentVersion??"",a.latestVersion).then(A=>{V||y(A)}).catch(()=>{V||y(null)}).finally(()=>{V||j(!1)}),()=>{V=!0}},[h,m,a==null?void 0:a.plugin,a==null?void 0:a.skill,a==null?void 0:a.latestVersion,a==null?void 0:a.currentVersion,a]),v.useEffect(()=>()=>{if(N.current&&clearTimeout(N.current),S.current)try{S.current.close()}catch{}},[]),!a||a.updateAvailable!==!0)return null;const k=a.latestVersion,M=o==="updating"?"Updating…":k?`Update to ${k}`:"Update",O=o==="updating";return n.jsxs("div",{"data-testid":"update-action",style:{display:"flex",flexDirection:"column",gap:6,padding:"12px 16px",borderTop:"1px solid var(--border-default)",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[n.jsx("button",{type:"button","data-testid":"update-action-button",onClick:()=>{T.run()},disabled:O,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:O?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:M}),n.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>x(V=>!V),disabled:O||!k,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:12,fontFamily:"var(--font-sans)",cursor:"pointer",textDecoration:"underline"},children:h?"Hide changelog":"Preview changelog"})]}),p&&n.jsx("div",{"data-testid":"update-action-progress",role:"status",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-muted, var(--text-secondary))"},children:p}),h&&k&&n.jsxs("div",{"data-testid":"update-action-changelog",style:{paddingTop:8},children:[g&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Loading changelog…"}),!g&&m&&n.jsx(Vd,{contentDiff:m.contentDiff,fromLabel:m.from,toLabel:m.to,diffSummary:m.diffSummary??void 0,renderContext:"inline"}),!g&&!m&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}function ld(){const{state:a,setMobileView:r}=ya();return a.isMobile?n.jsxs("button",{onClick:()=>r("list"),className:"flex items-center gap-1.5 px-3 py-2 text-[12px] font-medium",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"none",borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",width:"100%"},children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function cw(a={}){if(a.selectedSkillInfo!==void 0||a.loadError!==void 0)return uw(a);const{state:r,selectSkill:i,setMode:o,refreshSkills:u}=ya(),[p,f]=v.useState(typeof window<"u"?window.location.hash:"");if(v.useEffect(()=>{const m=()=>f(window.location.hash);return window.addEventListener("hashchange",m),()=>window.removeEventListener("hashchange",m)},[]),p==="#/updates")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(ld,{}),n.jsx(Uk,{})]});if(r.mode==="create")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(ld,{}),n.jsx(Ok,{onCreated:(m,y)=>{o("browse"),u(),i({plugin:m,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!r.selectedSkill)return r.skillsError?n.jsx(io,{variant:"error",message:r.skillsError,onRetry:u}):!r.skillsLoading&&r.skills.length===0?n.jsx(io,{variant:"no-skills"}):n.jsx(io,{variant:"no-selection"});const h=r.selectedSkill,x=r.skills.find(m=>m.plugin===h.plugin&&m.skill===h.skill)??null;return n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsx(ld,{}),n.jsx(dw,{skillInfo:x,allSkills:r.skills,onSelectSkill:m=>i(m)})]})}function uw(a){const r=a.selectedSkillInfo??null,i=a.activeDetailTab??"overview";if(r==null)return mw();if(a.loadError)return hw(r,a.loadError);const o=a.allSkills&&a.onSelectSkill?{allSkills:a.allSkills,onSelectSkill:a.onSelectSkill}:void 0;return Sg(r,i,a.onDetailTabChange,o)}function dw({skillInfo:a,allSkills:r,onSelectSkill:i}){const[o,u]=v.useState("overview"),p=v.useMemo(()=>a?Sg(a,o,u,{allSkills:r,onSelectSkill:i}):n.jsx(io,{variant:"no-selection"}),[a,o,r,i]);return n.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:p})}const fw=[{id:"overview",label:"Overview"},{id:"versions",label:"Versions"}];function pw(a,r){return n.jsx("div",{role:"tablist","aria-label":"Detail sections",style:{display:"flex",alignItems:"stretch",gap:4,borderBottom:"1px solid var(--border-default)",padding:"0 16px",background:"var(--bg-canvas)"},children:fw.map(i=>{const o=i.id===a;return n.jsx("button",{type:"button",role:"tab","aria-selected":o,tabIndex:o?0:-1,id:`detail-tab-${i.id}`,"aria-controls":`detail-panel-${i.id}`,onClick:()=>r==null?void 0:r(i.id),style:{background:"transparent",border:"none",borderBottom:o?"2px solid var(--text-primary)":"2px solid transparent",padding:"10px 4px",marginBottom:-1,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:o?500:400,color:o?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer"},children:i.label},i.id)})})}function mw(){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:32,background:"var(--bg-canvas)"},children:[n.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,color:"var(--text-primary)",margin:0,marginBottom:8},children:"Select a skill to view details"}),n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)",margin:0,maxWidth:420,textAlign:"center"},children:"Choose a skill from the sidebar — its frontmatter, filesystem info, and benchmark status will appear here."})]})}function hw(a,r){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[$d({skill:a}),n.jsxs("section",{role:"alert",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px"},children:[n.jsxs("h3",{style:{fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px"},children:["Couldn't load SKILL.md for ",a.skill]}),n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:"0 0 12px",wordBreak:"break-word"},children:r}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx("button",{type:"button",style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Open in editor"}),n.jsx("button",{type:"button",onClick:()=>{var i;return(i=navigator.clipboard)==null?void 0:i.writeText(a.dir)},style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Copy path"})]})]})]})}function Sg(a,r,i,o){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-canvas)"},children:[n.jsx("div",{style:{padding:16,paddingBottom:12},children:$d({skill:a})}),n.jsx(ow,{skill:a}),pw(r,i),n.jsxs("div",{role:"tabpanel",id:`detail-panel-${r}`,"aria-labelledby":`detail-tab-${r}`,style:{flex:1,minHeight:0,overflow:"auto"},children:[r==="overview"&&n.jsxs(n.Fragment,{children:[Wk({skill:a,allSkills:(o==null?void 0:o.allSkills)??[],onSelectSkill:o==null?void 0:o.onSelectSkill}),o!=null&&n.jsx(Ox,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{minHeight:520,display:"flex",flexDirection:"column"},children:n.jsx(Rk,{hideHeader:!0})})},`${a.plugin}/${a.skill}-workspace`)]}),r==="versions"&&o!=null&&n.jsx(Ox,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{padding:16},children:n.jsx(ng,{})})},`${a.plugin}/${a.skill}-versions`),r==="versions"&&o==null&&n.jsx("div",{style:{padding:16,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontSize:13},children:"Select a skill from the sidebar to load its version history."})]})]})}function xw(){const{updateCount:a,state:r,dismissUpdateNotification:i}=ya(),o=a>0&&!r.updateNotificationDismissed;return v.useEffect(()=>{if(!o)return;const u=setTimeout(()=>i(),1e4);return()=>clearTimeout(u)},[o,i]),o?n.jsxs("div",{className:"fixed bottom-4 right-4 z-50 flex items-center gap-3 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow)",color:"var(--text-primary)"},children:[n.jsxs("span",{children:[a," update",a===1?"":"s"," available"]}),n.jsx("button",{onClick:()=>{window.location.hash="#/updates"},className:"px-2 py-0.5 rounded text-[12px] font-semibold",style:{background:"var(--yellow)",color:"var(--surface-0)",border:"none",cursor:"pointer"},children:"View Updates"}),n.jsx("button",{onClick:i,className:"text-[14px] leading-none",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px"},"aria-label":"Dismiss",children:"✕"})]}):null}const vw=[{name:J.shortcuts.groupNavigation,items:[{keys:"/",label:J.shortcuts.search},{keys:"j",label:J.shortcuts.moveDown},{keys:"k",label:J.shortcuts.moveUp},{keys:"Enter",label:J.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:J.shortcuts.groupActions,items:[{keys:"⌘K",label:J.shortcuts.openPalette},{keys:"?",label:J.shortcuts.openShortcuts},{keys:"⌘B",label:J.shortcuts.toggleSidebar},{keys:"E",label:J.actions.edit}]},{name:J.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:J.shortcuts.toggleTheme}]}];function gw({open:a,onClose:r,groups:i=vw,title:o=J.shortcuts.title}){const u=v.useRef(null),p=v.useRef(null);return v.useEffect(()=>{var f;if(a)return u.current=document.activeElement??null,(f=p.current)==null||f.focus(),()=>{var h,x;(x=(h=u.current)==null?void 0:h.focus)==null||x.call(h),u.current=null}},[a]),v.useEffect(()=>{if(!a)return;function f(h){var x;if(h.key==="Escape"){h.preventDefault(),r();return}h.key==="Tab"&&(h.preventDefault(),(x=p.current)==null||x.focus())}return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[a,r]),a?n.jsx("div",{role:"presentation","data-testid":"shortcut-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, var(--bg-canvas) 70%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60},onClick:f=>{f.target===f.currentTarget&&r()},children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"shortcut-modal-title",style:{width:"min(480px, 92vw)",maxHeight:"80vh",overflow:"auto",background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:8,boxShadow:"0 16px 48px rgba(0,0,0,0.18)",padding:"16px 20px",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[n.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),n.jsx("button",{ref:p,type:"button","aria-label":"Close",onClick:r,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-secondary)",cursor:"pointer",fontSize:13},children:"Esc"})]}),i.map(f=>n.jsxs("section",{style:{marginBottom:12},children:[n.jsx("h3",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-secondary)",margin:"0 0 6px"},children:f.name}),n.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.items.map(h=>n.jsxs("li",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",borderTop:"1px solid var(--border-default)",fontSize:13},children:[n.jsx("span",{children:h.label}),n.jsx("kbd",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-secondary)",border:"1px solid var(--border-default)",borderRadius:3,padding:"1px 6px"},children:h.keys})]},`${f.name}:${h.keys}`))})]},f.name))]})}):null}function yw(a){const r=J.actions,i=[{action:"open",label:r.open},{action:"copy-path",label:r.copyPath},{action:"reveal",label:r.revealInEditor},{action:"run-benchmark",label:r.runBenchmark}];if(a.origin==="source")return[...i,{action:"edit",label:r.edit},{action:"duplicate",label:r.duplicate}];const o=[...i];return a.updateAvailable&&o.push({action:"update",label:r.update}),o.push({action:"uninstall",label:r.uninstall}),o}function bw({state:a,onClose:r,onAction:i,itemsOverride:o}){const u=v.useRef(null),p=v.useRef(null),[f,h]=v.useState(0),x=v.useMemo(()=>a.skill?o??yw(a.skill):[],[a.skill,o]),m=v.useMemo(()=>{if(typeof window>"u")return{left:a.x,top:a.y};const g=8,j=220,S=44+x.length*28;let N=a.x,z=a.y;return N+j+g>window.innerWidth&&(N=Math.max(g,a.x-j)),z+S+g>window.innerHeight&&(z=Math.max(g,a.y-S)),{left:N,top:z}},[a.x,a.y,x.length]);v.useEffect(()=>{if(a.open)return p.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var g;(g=u.current)==null||g.focus()}),()=>{var g,j;(j=(g=p.current)==null?void 0:g.focus)==null||j.call(g),p.current=null}},[a.open]);const y=v.useCallback(()=>{if(!a.skill)return;const g=x[f];!g||g.disabled||(i(g.action,a.skill),r())},[x,f,a.skill,i,r]);return v.useEffect(()=>{if(!a.open)return;function g(S){if(S.key==="Escape"){S.preventDefault(),r();return}if(S.key==="ArrowDown"){S.preventDefault(),h(N=>Math.min(N+1,Math.max(x.length-1,0)));return}if(S.key==="ArrowUp"){S.preventDefault(),h(N=>Math.max(N-1,0));return}if(S.key==="Enter"||S.key===" "){S.preventDefault(),y();return}}function j(S){u.current&&S.target instanceof Node&&(u.current.contains(S.target)||r())}return window.addEventListener("keydown",g,!0),window.addEventListener("mousedown",j,!0),()=>{window.removeEventListener("keydown",g,!0),window.removeEventListener("mousedown",j,!0)}},[a.open,r,x.length,y]),!a.open||!a.skill?null:n.jsx("div",{ref:u,role:"menu",tabIndex:-1,"data-testid":"context-menu",style:{position:"fixed",left:m.left,top:m.top,zIndex:70,minWidth:200,padding:4,background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:6,boxShadow:"0 12px 32px rgba(0,0,0,0.16)",fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",outline:"none"},children:x.map((g,j)=>n.jsx("div",{role:"menuitem","aria-disabled":g.disabled||void 0,"data-action":g.action,"data-selected":j===f||void 0,onMouseEnter:()=>h(j),onClick:()=>{g.disabled||(i(g.action,a.skill),r())},style:{padding:"5px 10px",borderRadius:4,cursor:g.disabled?"default":"pointer",opacity:g.disabled?.5:1,background:j===f?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent"},children:g.label},g.action))})}const jw={"anthropic-api":{name:J.setupProviders.anthropic.name,description:J.setupProviders.anthropic.description,envVars:J.setupProviders.anthropic.envVars,keyUrl:J.setupProviders.anthropic.keyUrl,learnMoreUrl:J.setupProviders.anthropic.learnMoreUrl},openai:{name:J.setupProviders.openai.name,description:J.setupProviders.openai.description,envVars:J.setupProviders.openai.envVars,keyUrl:J.setupProviders.openai.keyUrl,learnMoreUrl:J.setupProviders.openai.learnMoreUrl},openrouter:{name:J.setupProviders.openrouter.name,description:J.setupProviders.openrouter.description,envVars:J.setupProviders.openrouter.envVars,keyUrl:J.setupProviders.openrouter.keyUrl,learnMoreUrl:J.setupProviders.openrouter.learnMoreUrl},gemini:{name:J.setupProviders.gemini.name,description:J.setupProviders.gemini.description,envVars:J.setupProviders.gemini.envVars,keyUrl:J.setupProviders.gemini.keyUrl,learnMoreUrl:J.setupProviders.gemini.learnMoreUrl},ollama:{name:J.setupProviders.ollama.name,description:J.setupProviders.ollama.description,envVars:J.setupProviders.ollama.envVars,install:[J.setupProviders.ollama.installCmd],start:[J.setupProviders.ollama.startCmd],pullExample:J.setupProviders.ollama.pullExample,learnMoreUrl:J.setupProviders.ollama.learnMoreUrl},"lm-studio":{name:J.setupProviders.lmStudio.name,description:J.setupProviders.lmStudio.description,envVars:J.setupProviders.lmStudio.envVars,install:[J.setupProviders.lmStudio.installCmd],start:[J.setupProviders.lmStudio.startCmd],pullExample:J.setupProviders.lmStudio.pullExample,learnMoreUrl:J.setupProviders.lmStudio.learnMoreUrl},"claude-code":{name:J.setupProviders.claudeCode.name,description:J.setupProviders.claudeCode.description,envVars:[],notes:[J.setupProviders.claudeCode.loginHint,J.claudeCodeLabel.compactLabel],learnMoreUrl:J.setupProviders.claudeCode.learnMoreUrl}};function Sw(a){return a?jw[a]??null:null}function kw({open:a,providerKey:r,onClose:i}){const o=v.useRef(null);if(v.useEffect(()=>{if(!a)return;const f=h=>{h.key==="Escape"&&(h.preventDefault(),i())};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[a,i]),v.useEffect(()=>{if(!a)return;const f=o.current;if(!f)return;const h=f.querySelector("button, a[href], [tabindex]:not([tabindex='-1']), input, textarea, select");h==null||h.focus()},[a]),!a||typeof document>"u")return null;const u=Sw(r),p=(u==null?void 0:u.name)??J.setupDrawer.fallbackTitle;return mo.createPortal(n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:i,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),n.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":J.setupDrawer.title(p),style:{position:"fixed",top:0,right:0,bottom:0,width:"480px",maxWidth:"100vw",background:"var(--bg-surface, var(--surface-1))",borderLeft:"1px solid var(--border-default, var(--border-subtle))",boxShadow:"-8px 0 32px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",zIndex:100,fontFamily:"var(--font-sans)",animation:"vskillDrawerIn 200ms cubic-bezier(0.2, 0, 0, 1)"},children:[n.jsx(ww,{title:p,onClose:i}),n.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:u?n.jsx(Cw,{content:u}):n.jsx(Nw,{})}),n.jsx("style",{children:`@keyframes vskillDrawerIn {
|
|
80
|
+
`,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...qa,minHeight:"150px"}}):i.body.trim()?n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:bo(i.body)}}):n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},children:n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),n.jsx(_k,{skillName:i.name||"{skill}",hasEvals:!1,isDraft:i.draftSaved}),i.error&&n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:i.error}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:i.handleCreate,disabled:i.creating||!i.name||!i.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:i.creating||!i.name||!i.description?"var(--surface-3)":"var(--accent)",color:i.creating||!i.name||!i.description?"var(--text-tertiary)":"#fff",cursor:i.creating||!i.name||!i.description?"not-allowed":"pointer",border:"none"},children:i.creating?"Creating...":"Create Skill"}),n.jsx("button",{onClick:r,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]})]})]})}function Bk(){return n.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:n.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),n.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function io({variant:a,message:r,onRetry:i}){const{setMode:o,setSearch:u}=ya(),[p,f]=v.useState(!1);return a==="no-selection"?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[n.jsx("div",{className:"mb-5",children:p?n.jsx(Bk,{}):n.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>f(!0),style:{objectFit:"contain"}})}),n.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):a==="no-skills"?n.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[n.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:n.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})})}),n.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),n.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",n.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-2)"},children:"--root"})," directory, or create your first skill"]}),n.jsxs("button",{onClick:()=>o("create"),className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:"var(--accent)",color:"#fff",border:"none",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.opacity="0.9"},onMouseLeave:h=>{h.currentTarget.style.opacity="1"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):a==="error"?n.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:n.jsxs("div",{className:"px-5 py-4 rounded-lg text-center max-w-sm",style:{background:"var(--red-muted)",border:"1px solid rgba(248,113,113,0.2)"},children:[n.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:r||"Failed to load skill data"}),i&&n.jsx("button",{onClick:i,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):n.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[n.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),n.jsx("button",{onClick:()=>u(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function Ik(a,r){const[i,o]=a.split(".").map(Number),[u,p]=r.split(".").map(Number);return u>i?"major":p>o?"minor":"patch"}const Hk={major:{bg:"var(--red-muted)",text:"var(--red)"},minor:{bg:"var(--yellow-muted)",text:"var(--yellow)"},patch:{bg:"var(--green-muted)",text:"var(--green)"}};function Uk(){const[a,r]=v.useState([]),[i,o]=v.useState(!0),[u,p]=v.useState(new Set),[f,h]=v.useState(new Map),[x,m]=v.useState(!1),[y,g]=v.useState(new Set),[j,S]=v.useState(null),[N,L]=v.useState(null),[T,k]=v.useState(!1),M=v.useCallback(async()=>{o(!0);try{const R=await Ne.getSkillUpdates();r(R.filter(I=>I.updateAvailable))}catch{r([])}finally{o(!1)}},[]);v.useEffect(()=>{M()},[M]);const O=v.useMemo(()=>a.filter(R=>!R.pinned),[a]),V=v.useCallback(R=>{p(I=>{const G=new Set(I);return G.has(R)?G.delete(R):G.add(R),G})},[]),A=v.useCallback(()=>{u.size===O.length?p(new Set):p(new Set(O.map(R=>R.name)))},[u,O]),U=v.useCallback(()=>{const R=[...u];if(!R.length)return;m(!0),h(new Map(R.map(G=>[G,{skill:G,status:"pending"}])));const I=Ne.startBatchUpdate(R);I.addEventListener("progress",G=>{try{const q=JSON.parse(G.data);h(te=>new Map(te).set(q.skill,q))}catch{}}),I.addEventListener("done",G=>{I.close(),m(!1);try{const q=JSON.parse(G.data);S(`Updated ${q.updated??0} skills, ${q.failed??0} failed`),setTimeout(()=>S(null),5e3)}catch{}M()}),I.addEventListener("error",()=>{I.close(),m(!1),S("Batch update failed"),setTimeout(()=>S(null),5e3)})},[u,M]),w=v.useCallback(R=>{R.name.split("/").pop()||R.name;const I=R.name.split("/"),G=I.length>=3?I[I.length-2]:I[0],q=I[I.length-1];g(Q=>new Set(Q).add(R.name));const te=Ne.startSkillUpdate(G,q);te.addEventListener("done",()=>{te.close(),g(Q=>{const z=new Set(Q);return z.delete(R.name),z}),M()}),te.addEventListener("error",()=>{te.close(),g(Q=>{const z=new Set(Q);return z.delete(R.name),z})})},[M]),D=v.useCallback(async R=>{if(!R.latest)return;const I=R.name.split("/"),G=I.length>=3?I[I.length-2]:I[0],q=I[I.length-1];k(!0);try{const te=await Ne.getVersionDiff(G,q,R.installed,R.latest);L({skill:R,diff:te})}catch{L(null)}finally{k(!1)}},[]);return i?n.jsxs("div",{className:"p-6",children:[n.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-16 rounded-lg"}),n.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):a.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16",children:[n.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-4",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),n.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),n.jsx("button",{onClick:M,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):n.jsxs("div",{className:"p-6",children:[j&&n.jsx("div",{className:"fixed top-4 right-4 z-50 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:j}),n.jsxs("div",{className:"flex items-center justify-between mb-5",children:[n.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",O.length,")"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:M,className:"btn btn-ghost text-[12px]",disabled:x,children:"Refresh"}),n.jsx("button",{onClick:U,disabled:u.size===0||x,className:"btn btn-primary text-[12px]",children:x?"Updating...":`Update Selected (${u.size})`})]})]}),n.jsx("div",{className:"flex items-center gap-2 mb-3",children:n.jsxs("button",{onClick:A,className:"flex items-center gap-2 text-[12px] font-medium",style:{color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:[n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:u.size===O.length&&O.length>0?"var(--accent)":"var(--border-default)",background:u.size===O.length&&O.length>0?"var(--accent)":"transparent"},children:u.size===O.length&&O.length>0&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),"Select All"]})}),n.jsx("div",{className:"space-y-2",children:a.map(R=>{const I=R.name.split("/").pop()||R.name,G=R.latest?Ik(R.installed,R.latest):"patch",q=Hk[G],te=!!R.pinned,Q=y.has(R.name),z=f.get(R.name),E=u.has(R.name);return n.jsx("div",{className:"rounded-lg px-4 py-3 transition-all duration-150",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",opacity:te?.7:1},children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:()=>!te&&V(R.name),disabled:te,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:te?"not-allowed":"pointer"},children:n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:E?"var(--accent)":"var(--border-default)",background:E?"var(--accent)":"transparent",opacity:te?.4:1},children:E&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:I}),te&&n.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),n.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:q.bg,color:q.text},children:G})]}),n.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[R.installed," → ",R.latest||"?",te&&` (pinned at ${R.pinnedVersion||R.installed})`]})]}),z&&n.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:z.status==="done"?"var(--green-muted)":z.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:z.status==="done"?"var(--green)":z.status==="error"?"var(--red)":"var(--yellow)"},children:[z.status,z.error&&`: ${z.error}`]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:()=>D(R),className:"btn btn-ghost text-[11px]",disabled:T,children:"View Changes"}),n.jsx("button",{onClick:()=>w(R),disabled:te||Q||x,title:te?"Pinned — unpin from CLI to update":"",className:`btn ${te?"btn-ghost":"btn-primary"} text-[11px]`,children:Q?n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(z==null?void 0:z.status)==="done"?n.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},R.name)})}),N&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>L(null),children:n.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:R=>R.stopPropagation(),children:[n.jsx("div",{className:"mb-2 flex justify-end",children:n.jsx("button",{onClick:()=>L(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),n.jsx($d,{contentDiff:N.diff.contentDiff,fromLabel:N.diff.from,toLabel:N.diff.to,diffSummary:N.diff.diffSummary,renderContext:"inline"})]})})]})}const Vk=[{id:"amp",displayName:"Amp",localSkillsDir:".amp/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which amp",parentCompany:"Sourcegraph",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"cline",displayName:"Cline",localSkillsDir:".cline/skills",globalSkillsDir:"~/.cline/skills",isUniversal:!0,detectInstalled:"which cline",parentCompany:"Cline",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"codex",displayName:"Codex CLI",localSkillsDir:".codex/skills",globalSkillsDir:"~/.codex/skills",isUniversal:!0,detectInstalled:"which codex",parentCompany:"OpenAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cursor",displayName:"Cursor",localSkillsDir:".cursor/skills",globalSkillsDir:"~/.cursor/skills",isUniversal:!0,detectInstalled:"which cursor",parentCompany:"Anysphere",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"gemini-cli",displayName:"Gemini CLI",localSkillsDir:".gemini/skills",globalSkillsDir:"~/.gemini/skills",isUniversal:!0,detectInstalled:"which gemini",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"github-copilot-ext",displayName:"GitHub Copilot (VS Code)",localSkillsDir:".github/copilot/skills",globalSkillsDir:"~/.config/github-copilot/skills",isUniversal:!0,detectInstalled:"which code && ls ~/.vscode/extensions/github.copilot-* 2>/dev/null",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"kimi-cli",displayName:"Kimi CLI",localSkillsDir:".kimi/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which kimi",parentCompany:"Moonshot AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"opencode",displayName:"OpenCode",localSkillsDir:".opencode/skills",globalSkillsDir:"~/.config/opencode/skills",isUniversal:!0,detectInstalled:"which opencode",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"antigravity",displayName:"Antigravity",localSkillsDir:".agent/skills",globalSkillsDir:"~/.gemini/antigravity/skills",isUniversal:!1,detectInstalled:"which antigravity",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"augment",displayName:"Augment Code",localSkillsDir:".augment/skills",globalSkillsDir:"~/.augment/skills",isUniversal:!1,detectInstalled:"which augment",parentCompany:"Augment",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"claude-code",displayName:"Claude Code",localSkillsDir:".claude/skills",globalSkillsDir:"~/.claude/skills",isUniversal:!1,detectInstalled:"which claude",parentCompany:"Anthropic",featureSupport:{slashCommands:!0,hooks:!0,mcp:!0,customSystemPrompt:!0},pluginCacheDir:"~/.claude/plugins/cache",pluginMarketplaceDir:"~/.claude/plugins/marketplaces"},{id:"openclaw",displayName:"OpenClaw",localSkillsDir:".openclaw/skills",globalSkillsDir:"~/.openclaw/skills",isUniversal:!1,detectInstalled:"which openclaw",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"replit",displayName:"Replit Agent",localSkillsDir:".replit/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!1,detectInstalled:"which replit",parentCompany:"Replit",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"codebuddy",displayName:"CodeBuddy",localSkillsDir:".codebuddy/skills",globalSkillsDir:"~/.codebuddy/skills",isUniversal:!1,detectInstalled:"which codebuddy",parentCompany:"CodeBuddy",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"command-code",displayName:"Command Code",localSkillsDir:".commandcode/skills",globalSkillsDir:"~/.commandcode/skills",isUniversal:!1,detectInstalled:"which command-code",parentCompany:"Command",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"continue",displayName:"Continue",localSkillsDir:".continue/skills",globalSkillsDir:"~/.continue/skills",isUniversal:!1,detectInstalled:"which continue",parentCompany:"Continue",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"crush",displayName:"Crush",localSkillsDir:".crush/skills",globalSkillsDir:"~/.config/crush/skills",isUniversal:!1,detectInstalled:"which crush",parentCompany:"Crush",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"droid",displayName:"Droid (Factory)",localSkillsDir:".factory/skills",globalSkillsDir:"~/.factory/skills",isUniversal:!1,detectInstalled:"which droid",parentCompany:"Factory",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"goose",displayName:"Goose",localSkillsDir:".goose/skills",globalSkillsDir:"~/.config/goose/skills",isUniversal:!1,detectInstalled:"which goose",parentCompany:"Block",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"junie",displayName:"Junie",localSkillsDir:".junie/skills",globalSkillsDir:"~/.junie/skills",isUniversal:!1,detectInstalled:"which junie",parentCompany:"JetBrains",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"iflow-cli",displayName:"iFlow CLI",localSkillsDir:".iflow/skills",globalSkillsDir:"~/.iflow/skills",isUniversal:!1,detectInstalled:"which iflow",parentCompany:"iFlow",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kilo",displayName:"Kilo Code",localSkillsDir:".kilocode/skills",globalSkillsDir:"~/.kilocode/skills",isUniversal:!1,detectInstalled:"which kilocode",parentCompany:"Kilo Code",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kiro-cli",displayName:"Kiro CLI",localSkillsDir:".kiro/skills",globalSkillsDir:"~/.kiro/skills",isUniversal:!1,detectInstalled:"which kiro",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kode",displayName:"Kode",localSkillsDir:".kode/skills",globalSkillsDir:"~/.kode/skills",isUniversal:!1,detectInstalled:"which kode",parentCompany:"Kode",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mcpjam",displayName:"MCPJam",localSkillsDir:".mcpjam/skills",globalSkillsDir:"~/.mcpjam/skills",isUniversal:!1,detectInstalled:"which mcpjam",parentCompany:"MCPJam",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!1}},{id:"mistral-vibe",displayName:"Mistral Vibe",localSkillsDir:".vibe/skills",globalSkillsDir:"~/.vibe/skills",isUniversal:!1,detectInstalled:"which vibe",parentCompany:"Mistral AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mux",displayName:"Mux",localSkillsDir:".mux/skills",globalSkillsDir:"~/.mux/skills",isUniversal:!1,detectInstalled:"which mux",parentCompany:"Mux",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"openhands",displayName:"OpenHands",localSkillsDir:".openhands/skills",globalSkillsDir:"~/.openhands/skills",isUniversal:!1,detectInstalled:"which openhands",parentCompany:"All Hands AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pi",displayName:"Pi",localSkillsDir:".pi/skills",globalSkillsDir:"~/.pi/agent/skills",isUniversal:!1,detectInstalled:"which pi",parentCompany:"Pi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qoder",displayName:"Qoder",localSkillsDir:".qoder/skills",globalSkillsDir:"~/.qoder/skills",isUniversal:!1,detectInstalled:"which qoder",parentCompany:"Qoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qwen-code",displayName:"Qwen Code",localSkillsDir:".qwen/skills",globalSkillsDir:"~/.qwen/skills",isUniversal:!1,detectInstalled:"which qwen-code",parentCompany:"Alibaba",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"roo",displayName:"Roo Code",localSkillsDir:".roo/skills",globalSkillsDir:"~/.roo/skills",isUniversal:!1,detectInstalled:"which roo",parentCompany:"Roo",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae",displayName:"Trae",localSkillsDir:".trae/skills",globalSkillsDir:"~/.trae/skills",isUniversal:!1,detectInstalled:"which trae",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae-cn",displayName:"Trae CN",localSkillsDir:".trae-cn/skills",globalSkillsDir:"~/.trae-cn/skills",isUniversal:!1,detectInstalled:"which trae-cn",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"windsurf",displayName:"Windsurf",localSkillsDir:".windsurf/skills",globalSkillsDir:"~/.codeium/windsurf/skills",isUniversal:!1,detectInstalled:"which windsurf",parentCompany:"Codeium",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zencoder",displayName:"ZenCoder",localSkillsDir:".zencoder/skills",globalSkillsDir:"~/.zencoder/skills",isUniversal:!1,detectInstalled:"which zencoder",parentCompany:"ZenCoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"neovate",displayName:"Neovate",localSkillsDir:".neovate/skills",globalSkillsDir:"~/.neovate/skills",isUniversal:!1,detectInstalled:"which neovate",parentCompany:"Neovate",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pochi",displayName:"Pochi",localSkillsDir:".pochi/skills",globalSkillsDir:"~/.pochi/skills",isUniversal:!1,detectInstalled:"which pochi",parentCompany:"Pochi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"adal",displayName:"Adal",localSkillsDir:".adal/skills",globalSkillsDir:"~/.adal/skills",isUniversal:!1,detectInstalled:"which adal",parentCompany:"Adal",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cortex",displayName:"Cortex",localSkillsDir:".cortex/skills",globalSkillsDir:"~/.snowflake/cortex/skills",isUniversal:!1,detectInstalled:"which cortex",parentCompany:"Cortex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"aider",displayName:"Aider",localSkillsDir:".aider/skills",globalSkillsDir:"~/.aider/skills",isUniversal:!1,detectInstalled:"which aider",parentCompany:"Aider",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"tabnine",displayName:"Tabnine Chat",localSkillsDir:".tabnine/skills",globalSkillsDir:"~/.tabnine/skills",isUniversal:!1,detectInstalled:"which tabnine",parentCompany:"Tabnine",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"devin",displayName:"Devin",localSkillsDir:".devin/skills",globalSkillsDir:"~/.devin/skills",isUniversal:!1,detectInstalled:"which devin",parentCompany:"Cognition",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"bolt-new",displayName:"bolt.new",localSkillsDir:".bolt/skills",globalSkillsDir:"~/.bolt/skills",isUniversal:!1,detectInstalled:"which bolt",parentCompany:"StackBlitz",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"v0",displayName:"v0",localSkillsDir:".v0/skills",globalSkillsDir:"~/.v0/skills",isUniversal:!1,detectInstalled:"which v0",parentCompany:"Vercel",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"gpt-pilot",displayName:"GPT Pilot",localSkillsDir:".gpt-pilot/skills",globalSkillsDir:"~/.gpt-pilot/skills",isUniversal:!1,detectInstalled:"which gpt-pilot",parentCompany:"Pythagora",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"plandex",displayName:"Plandex",localSkillsDir:".plandex/skills",globalSkillsDir:"~/.plandex/skills",isUniversal:!1,detectInstalled:"which plandex",parentCompany:"Plandex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"sweep",displayName:"Sweep",localSkillsDir:".sweep/skills",globalSkillsDir:"~/.sweep/skills",isUniversal:!1,detectInstalled:"which sweep",parentCompany:"Sweep AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mentat",displayName:"Mentat",localSkillsDir:".mentat/skills",globalSkillsDir:"~/.mentat/skills",isUniversal:!1,detectInstalled:"which mentat",parentCompany:"AbanteAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"copilot-cli",displayName:"GitHub Copilot CLI",localSkillsDir:".copilot/skills",globalSkillsDir:"~/.copilot/skills",isUniversal:!1,detectInstalled:"which copilot",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"warp",displayName:"Warp",localSkillsDir:".warp/skills",globalSkillsDir:"~/.warp/skills",isUniversal:!1,detectInstalled:"which warp",parentCompany:"Warp",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"amazon-q-cli",displayName:"Amazon Q CLI",localSkillsDir:".amazonq/skills",globalSkillsDir:"~/.aws/amazonq/skills",isUniversal:!1,detectInstalled:"which q",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zed",displayName:"Zed",localSkillsDir:".zed/skills",globalSkillsDir:"~/.config/zed/skills",isUniversal:!1,detectInstalled:"which zed",parentCompany:"Zed Industries",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}}],gr={fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px",letterSpacing:.1},yr={background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},$k={fontFamily:"var(--font-sans)",fontSize:11,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},gg={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},yg={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",wordBreak:"break-all"},fr={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",fontVariantNumeric:"tabular-nums"},Gk={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)"},Pk={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",overflowWrap:"anywhere",wordBreak:"break-word"},qk={Description:"Add `description:` to the SKILL.md frontmatter to display a value here.",Version:"Add `version:` to the SKILL.md frontmatter to display a value here.",Category:"Add `category:` to the SKILL.md frontmatter to display a value here.",Author:"Add `author:` to the SKILL.md frontmatter to display a value here.",License:"Add `license:` to the SKILL.md frontmatter to display a value here.",Homepage:"Add `homepage:` to the SKILL.md frontmatter to display a value here.",Tags:"Add `tags:` to the SKILL.md frontmatter to display a value here.",Directory:"Filesystem location of this skill — not configurable via SKILL.md.","Entry point":"Add `entry-point:` to the SKILL.md frontmatter to customize; defaults to SKILL.md.","Last modified":"Filesystem mtime — updates automatically on save.","Last benchmark":"Shown after the first benchmark run completes."};function Yk(a){if(a==null||!Number.isFinite(a))return"—";if(a<1024)return`${a} B`;const r=a/1024;if(r<1024)return r>=10?`${Math.round(r)} KB`:`${r.toFixed(1).replace(/\.0$/,"")} KB`;const i=r/1024;return i>=10?`${Math.round(i)} MB`:`${i.toFixed(1).replace(/\.0$/,"")} MB`}function bg(a){if(!a)return"—";const r=new Date(a);if(Number.isNaN(r.getTime()))return a;const i=Date.now()-r.getTime(),o=Math.floor(i/1e3);if(o<60)return"just now";const u=Math.floor(o/60);if(u<60)return`${u} min ago`;const p=Math.floor(u/60);if(p<24)return`${p} hr ago`;const f=Math.floor(p/24);if(f<30)return`${f} day${f===1?"":"s"} ago`;const h=Math.floor(f/30);if(h<12)return`${h} month${h===1?"":"s"} ago`;const x=Math.floor(h/12);return`${x} year${x===1?"":"s"} ago`}function Fk(a){const r=Vk.find(i=>i.id===a);return(r==null?void 0:r.displayName)??a}function hr(a){const r=a?qk[a]:void 0;return n.jsx("span",{style:Gk,title:r,children:"—"})}function bn(a,r,i){return n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"130px 1fr",alignItems:"baseline",gap:12,padding:"6px 0"},children:[n.jsx("span",{style:$k,children:a}),n.jsx("span",{style:{minWidth:0},children:r})]},a)}function cr(a,r,i={}){if(r==null||r==="")return bn(a,hr(a));if(i.path)return bn(a,n.jsx("span",{"data-path-value":"true",style:Pk,children:r}));const o=i.tabular?fr:i.mono?yg:gg;return bn(a,n.jsx("span",{style:o,children:r}))}function Wk({skill:a,allSkills:r=[],onSelectSkill:i}){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[Kk(a),a.origin==="installed"?Xk(a):null,Qk(a),Jk(a),ew(a),nw(a,r,i)]})}function Kk(a){const r=a.homepage?n.jsxs("a",{href:a.homepage,target:"_blank",rel:"noopener noreferrer","data-external-link":"homepage",style:{...yg,color:"var(--text-accent)",textDecoration:"none",display:"inline-flex",alignItems:"center",gap:4},onMouseEnter:o=>{o.currentTarget.style.textDecoration="underline"},onMouseLeave:o=>{o.currentTarget.style.textDecoration="none"},children:[n.jsx("span",{children:a.homepage}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:11,color:"var(--text-accent)"},children:"↗"})]}):hr("Homepage"),i=a.tags&&a.tags.length>0?n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:a.tags.map(o=>n.jsx("span",{"data-chip":"tag",style:{fontFamily:"var(--font-sans)",fontSize:11,padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:999,color:"var(--text-secondary)",background:"transparent"},children:o},o))}):hr("Tags");return n.jsxs("section",{style:yr,"aria-labelledby":"md-frontmatter",children:[n.jsx("h3",{id:"md-frontmatter",style:gr,children:"Frontmatter"}),cr("Description",a.description??null),cr("Version",a.version??null,{tabular:!0}),cr("Category",a.category??null),cr("Author",a.author??null),cr("License",a.license??null),bn("Homepage",r),bn("Tags",i)]},"frontmatter")}function Xk(a){const r=a.sourceAgent,i=r?n.jsx("span",{style:gg,"data-agent-id":r,children:Fk(r)}):hr("Agent");return n.jsxs("section",{style:yr,"aria-labelledby":"md-source-agent",children:[n.jsx("h3",{id:"md-source-agent",style:gr,children:"Source agent"}),bn("Agent",i)]},"source-agent")}function Qk(a){const r=a.lastModified?n.jsx("span",{style:fr,title:a.lastModified,children:bg(a.lastModified)}):hr("Last modified"),i=a.entryPoint??"SKILL.md",o=a.dir?`${a.dir.replace(/\/$/,"")}/${i}`:i,u=n.jsx("button",{type:"button","data-entry-chip":"true",title:`Copy ${o}`,"aria-label":`Copy entry-point path ${o} to clipboard`,onClick:()=>Zk(o),style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",cursor:"pointer",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i});return n.jsxs("section",{style:yr,"aria-labelledby":"md-fs",children:[n.jsx("h3",{id:"md-fs",style:gr,children:"Filesystem"}),cr("Directory",a.dir||null,{path:!0}),bn("Entry point",u),bn("Size",n.jsx("span",{style:fr,children:Yk(a.sizeBytes)})),bn("Last modified",r)]},"filesystem")}function Zk(a){var r;try{(r=navigator.clipboard)==null||r.writeText(a)}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:`Copied ${a}`,severity:"info"}}))}function Jk(a){const r=a.benchmarkStatus==="pass"?"var(--status-installed)":a.benchmarkStatus==="fail"?"var(--red, #b54444)":"var(--status-own)",i=n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:7,height:7,borderRadius:999,background:r}}),a.benchmarkStatus]}),o=a.lastBenchmark?n.jsx("span",{style:fr,title:a.lastBenchmark,children:bg(a.lastBenchmark)}):hr("Last benchmark");return n.jsxs("section",{style:yr,"aria-labelledby":"md-bench",children:[n.jsx("h3",{id:"md-bench",style:gr,children:"Benchmark"}),bn("Eval count",n.jsx("span",{style:fr,children:a.evalCount})),bn("Assertions",n.jsx("span",{style:fr,children:a.assertionCount})),bn("Status",i),bn("Last benchmark",o)]},"benchmark")}function ew(a){const r=a.mcpDeps??[];return n.jsxs("section",{style:yr,"aria-labelledby":"md-mcp",children:[n.jsx("h3",{id:"md-mcp",style:gr,children:"MCP dependencies"}),r.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No MCP dependencies"}):n.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:r.map(i=>n.jsxs("li",{"data-mcp-dep":i,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 0",borderBottom:"1px solid var(--border-default)"},children:[n.jsx(tw,{}),n.jsx("span",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:i})]},i))})]},"mcp-deps")}function tw(){return n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--text-secondary)",flexShrink:0},"aria-hidden":"true",children:[n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"})]})}function nw(a,r,i){const o=a.deps??[];return n.jsxs("section",{style:yr,"aria-labelledby":"md-skill-deps",children:[n.jsx("h3",{id:"md-skill-deps",style:gr,children:"Skill dependencies"}),o.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No skill dependencies"}):n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:o.map(u=>{const p=aw(u,r),f=p!=null,h={fontFamily:"var(--font-sans)",fontSize:12,padding:"3px 10px",border:"1px solid var(--border-default)",borderRadius:999,color:f?"var(--text-primary)":"var(--text-secondary)",background:"transparent",cursor:f?"pointer":"help"},x=f&&i?()=>i({plugin:p.plugin,skill:p.skill,origin:p.origin}):void 0,m=f&&i?y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),i({plugin:p.plugin,skill:p.skill,origin:p.origin}))}:void 0;return n.jsx("button",{type:"button","data-chip":"skill-dep","data-present":f?"true":"false",title:f?`Open ${u}`:"Not installed",onClick:x,onKeyDown:m,style:h,children:u},u)})})]},"skill-deps")}function aw(a,r){const[i,o]=a.includes("/")?a.split("/"):["",a];for(const u of r)if(i&&u.plugin===i&&u.skill===o||!i&&u.skill===o)return u;return null}const nv=v.memo(function({message:r,politeness:i="polite",role:o}){const u=o??(i==="assertive"?"alert":"status");return n.jsx("div",{"aria-live":i,"aria-atomic":"true",role:u,"data-testid":"aria-live","data-politeness":i,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0,padding:0,margin:-1},children:r})});function lw({toast:a,onDismiss:r}){const[i,o]=v.useState(!0),u=v.useRef(null);v.useEffect(()=>(u.current=requestAnimationFrame(()=>{u.current=requestAnimationFrame(()=>o(!1))}),()=>{u.current!=null&&cancelAnimationFrame(u.current)}),[]);const p={success:"var(--status-installed)",info:"var(--text-secondary)",error:"var(--color-accent, var(--accent-surface))"};return n.jsxs("div",{role:a.severity==="error"?"alert":"status","data-testid":"toast-item","data-severity":a.severity,style:{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",minWidth:240,maxWidth:360,background:"var(--bg-canvas)",color:"var(--text-primary)",border:"1px solid var(--border-default)",borderLeft:`3px solid ${p[a.severity]}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.12)",fontFamily:"var(--font-sans)",fontSize:12,transform:i?"translateY(8px)":"translateY(0)",opacity:i?0:1,transition:"transform var(--duration-base, 180ms) var(--ease-standard, ease), opacity var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{style:{flex:1,minWidth:0},children:a.message}),a.action&&n.jsx("button",{type:"button",onClick:()=>{a.action.onInvoke(),r(a.id)},style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"3px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:a.action.label}),n.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>r(a.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function rw({toasts:a,onDismiss:r,liveMessage:i,liveAssertiveMessage:o}){return n.jsxs(n.Fragment,{children:[n.jsx(nv,{politeness:"polite",message:i}),n.jsx(nv,{politeness:"assertive",message:o}),a.length>0&&n.jsx("div",{"data-testid":"toast-stack",style:{position:"fixed",right:16,bottom:16,display:"flex",flexDirection:"column-reverse",gap:8,zIndex:50,pointerEvents:"none"},children:a.map(u=>n.jsx("div",{style:{pointerEvents:"auto"},children:n.jsx(lw,{toast:u,onDismiss:r})},u.id))})]})}const jg=v.createContext(null);function Pd(){const a=v.useContext(jg);if(!a)throw new Error("useToast must be used inside <ToastProvider>.");return a}function sw({children:a,maxVisible:r=4,defaultDurationMs:i=4e3}){const[o,u]=v.useState([]),[p,f]=v.useState(""),[h,x]=v.useState(""),m=v.useRef(new Map),y=v.useCallback(T=>{const k=m.current.get(T);k&&(clearTimeout(k),m.current.delete(T)),u(M=>M.filter(O=>O.id!==T))},[]),g=v.useCallback((T,k)=>{if(k<=0)return;const M=setTimeout(()=>{y(T)},k);m.current.set(T,M)},[y]),j=v.useCallback(T=>{const k=T.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,M={id:k,message:T.message,severity:T.severity??"info",durationMs:T.durationMs??i,action:T.action};return u(O=>[...O,M]),M.severity==="error"?x(M.message):f(M.message),g(k,M.durationMs),k},[i,g]),S=v.useCallback(()=>{for(const T of m.current.values())clearTimeout(T);m.current.clear(),u([])},[]);v.useEffect(()=>{function T(k){k.key==="Escape"&&u(M=>{if(M.length===0)return M;const O=M.slice(0,r),V=O[O.length-1],A=m.current.get(V.id);return A&&(clearTimeout(A),m.current.delete(V.id)),M.filter(U=>U.id!==V.id)})}return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r]),v.useEffect(()=>()=>{for(const T of m.current.values())clearTimeout(T);m.current.clear()},[]);const N=o.slice(0,r),L=v.useMemo(()=>({toast:j,dismiss:y,clear:S}),[j,y,S]);return n.jsxs(jg.Provider,{value:L,children:[a,n.jsx(rw,{toasts:N,onDismiss:y,liveMessage:p,liveAssertiveMessage:h})]})}function iw(a){const{toast:r}=Pd(),i=v.useRef(a);i.current=a;const o=v.useCallback(async(...u)=>{const p=i.current,f=p.snapshot();p.apply(...u),p.confirmGraceMs;const h=p.timeoutMs??5e3;let x=!1,m,y=!1;const g=p.commit(...u).then(()=>{x=!0,y=!0},N=>{x=!0,m=N??new Error("Commit failed")}),j=new Promise(N=>{setTimeout(N,h)});if(await Promise.race([g,j]),!x)m=new Error("TIMEOUT");else if(y)return;p.rollback(f);const S=typeof p.failureMessage=="function"?p.failureMessage(m):p.failureMessage??"Couldn't complete that action.";r({message:S,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{o(...u)}}})},[r]);return{run:o}}const av=6e4;function ow({skill:a}){const{refreshUpdates:r}=ya(),{toast:i}=Pd(),[o,u]=v.useState("idle"),[p,f]=v.useState(null),[h,x]=v.useState(!1),[m,y]=v.useState(null),[g,j]=v.useState(!1),S=v.useRef(null),N=v.useRef(null),L=v.useCallback(()=>new Promise((V,A)=>{if(!a){A(new Error("No skill selected"));return}const U=Ne.startSkillUpdate(a.plugin,a.skill);S.current=U;const w=()=>{N.current&&(clearTimeout(N.current),N.current=null);try{U.close()}catch{}S.current=null};N.current=setTimeout(()=>{w(),A(new Error("TIMEOUT"))},av),U.addEventListener("progress",D=>{try{const R=JSON.parse(D.data);typeof(R==null?void 0:R.status)=="string"&&f(R.status)}catch{}}),U.addEventListener("done",()=>{w(),u("done"),f(null),r(),i({message:`Updated ${a.skill}.`,severity:"success",durationMs:4e3}),V()}),U.addEventListener("error",D=>{w();let R="Stream error";try{const I=typeof D.data=="string"?JSON.parse(D.data):null;I!=null&&I.error&&(R=String(I.error))}catch{}A(new Error(R))})}),[a,r,i]),T=iw({snapshot:()=>({status:o}),apply:()=>{u("updating"),f("updating")},commit:()=>L(),rollback:V=>{u(V.status==="updating"?"idle":V.status),f(null)},failureMessage:V=>`Couldn't update ${(a==null?void 0:a.skill)??"skill"} — ${V.message}`,timeoutMs:av+1e3});if(v.useEffect(()=>{if(!h||m!=null||!a||!a.latestVersion)return;let V=!1;return j(!0),Ne.getVersionDiff(a.plugin,a.skill,a.currentVersion??"",a.latestVersion).then(A=>{V||y(A)}).catch(()=>{V||y(null)}).finally(()=>{V||j(!1)}),()=>{V=!0}},[h,m,a==null?void 0:a.plugin,a==null?void 0:a.skill,a==null?void 0:a.latestVersion,a==null?void 0:a.currentVersion,a]),v.useEffect(()=>()=>{if(N.current&&clearTimeout(N.current),S.current)try{S.current.close()}catch{}},[]),!a||a.updateAvailable!==!0)return null;const k=a.latestVersion,M=o==="updating"?"Updating…":k?`Update to ${k}`:"Update",O=o==="updating";return n.jsxs("div",{"data-testid":"update-action",style:{display:"flex",flexDirection:"column",gap:6,padding:"12px 16px",borderTop:"1px solid var(--border-default)",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[n.jsx("button",{type:"button","data-testid":"update-action-button",onClick:()=>{T.run()},disabled:O,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:O?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:M}),n.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>x(V=>!V),disabled:O||!k,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:12,fontFamily:"var(--font-sans)",cursor:"pointer",textDecoration:"underline"},children:h?"Hide changelog":"Preview changelog"})]}),p&&n.jsx("div",{"data-testid":"update-action-progress",role:"status",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-muted, var(--text-secondary))"},children:p}),h&&k&&n.jsxs("div",{"data-testid":"update-action-changelog",style:{paddingTop:8},children:[g&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Loading changelog…"}),!g&&m&&n.jsx($d,{contentDiff:m.contentDiff,fromLabel:m.from,toLabel:m.to,diffSummary:m.diffSummary??void 0,renderContext:"inline"}),!g&&!m&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}function ld(){const{state:a,setMobileView:r}=ya();return a.isMobile?n.jsxs("button",{onClick:()=>r("list"),className:"flex items-center gap-1.5 px-3 py-2 text-[12px] font-medium",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"none",borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",width:"100%"},children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function cw(a={}){if(a.selectedSkillInfo!==void 0||a.loadError!==void 0)return uw(a);const{state:r,selectSkill:i,setMode:o,refreshSkills:u}=ya(),[p,f]=v.useState(typeof window<"u"?window.location.hash:"");if(v.useEffect(()=>{const m=()=>f(window.location.hash);return window.addEventListener("hashchange",m),()=>window.removeEventListener("hashchange",m)},[]),p==="#/updates")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(ld,{}),n.jsx(Uk,{})]});if(r.mode==="create")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(ld,{}),n.jsx(Ok,{onCreated:(m,y)=>{o("browse"),u(),i({plugin:m,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!r.selectedSkill)return r.skillsError?n.jsx(io,{variant:"error",message:r.skillsError,onRetry:u}):!r.skillsLoading&&r.skills.length===0?n.jsx(io,{variant:"no-skills"}):n.jsx(io,{variant:"no-selection"});const h=r.selectedSkill,x=r.skills.find(m=>m.plugin===h.plugin&&m.skill===h.skill)??null;return n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsx(ld,{}),n.jsx(dw,{skillInfo:x,allSkills:r.skills,onSelectSkill:m=>i(m)})]})}function uw(a){const r=a.selectedSkillInfo??null,i=a.activeDetailTab??"overview";if(r==null)return mw();if(a.loadError)return hw(r,a.loadError);const o=a.allSkills&&a.onSelectSkill?{allSkills:a.allSkills,onSelectSkill:a.onSelectSkill}:void 0;return Sg(r,i,a.onDetailTabChange,o)}function dw({skillInfo:a,allSkills:r,onSelectSkill:i}){const[o,u]=v.useState("overview"),p=v.useMemo(()=>a?Sg(a,o,u,{allSkills:r,onSelectSkill:i}):n.jsx(io,{variant:"no-selection"}),[a,o,r,i]);return n.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:p})}const fw=[{id:"overview",label:"Overview"},{id:"versions",label:"Versions"}];function pw(a,r){return n.jsx("div",{role:"tablist","aria-label":"Detail sections",style:{display:"flex",alignItems:"stretch",gap:4,borderBottom:"1px solid var(--border-default)",padding:"0 16px",background:"var(--bg-canvas)"},children:fw.map(i=>{const o=i.id===a;return n.jsx("button",{type:"button",role:"tab","aria-selected":o,tabIndex:o?0:-1,id:`detail-tab-${i.id}`,"aria-controls":`detail-panel-${i.id}`,onClick:()=>r==null?void 0:r(i.id),style:{background:"transparent",border:"none",borderBottom:o?"2px solid var(--text-primary)":"2px solid transparent",padding:"10px 4px",marginBottom:-1,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:o?500:400,color:o?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer"},children:i.label},i.id)})})}function mw(){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:32,background:"var(--bg-canvas)"},children:[n.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,color:"var(--text-primary)",margin:0,marginBottom:8},children:"Select a skill to view details"}),n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)",margin:0,maxWidth:420,textAlign:"center"},children:"Choose a skill from the sidebar — its frontmatter, filesystem info, and benchmark status will appear here."})]})}function hw(a,r){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[Gd({skill:a}),n.jsxs("section",{role:"alert",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px"},children:[n.jsxs("h3",{style:{fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px"},children:["Couldn't load SKILL.md for ",a.skill]}),n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:"0 0 12px",wordBreak:"break-word"},children:r}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx("button",{type:"button",style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Open in editor"}),n.jsx("button",{type:"button",onClick:()=>{var i;return(i=navigator.clipboard)==null?void 0:i.writeText(a.dir)},style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Copy path"})]})]})]})}function Sg(a,r,i,o){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-canvas)"},children:[n.jsx("div",{style:{padding:16,paddingBottom:12},children:Gd({skill:a})}),n.jsx(ow,{skill:a}),pw(r,i),n.jsxs("div",{role:"tabpanel",id:`detail-panel-${r}`,"aria-labelledby":`detail-tab-${r}`,style:{flex:1,minHeight:0,overflow:"auto"},children:[r==="overview"&&n.jsxs(n.Fragment,{children:[Wk({skill:a,allSkills:(o==null?void 0:o.allSkills)??[],onSelectSkill:o==null?void 0:o.onSelectSkill}),o!=null&&n.jsx(Bx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{minHeight:520,display:"flex",flexDirection:"column"},children:n.jsx(Rk,{hideHeader:!0})})},`${a.plugin}/${a.skill}-workspace`)]}),r==="versions"&&o!=null&&n.jsx(Bx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{padding:16},children:n.jsx(ng,{})})},`${a.plugin}/${a.skill}-versions`),r==="versions"&&o==null&&n.jsx("div",{style:{padding:16,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontSize:13},children:"Select a skill from the sidebar to load its version history."})]})]})}function xw(){const{updateCount:a,state:r,dismissUpdateNotification:i}=ya(),o=a>0&&!r.updateNotificationDismissed;return v.useEffect(()=>{if(!o)return;const u=setTimeout(()=>i(),1e4);return()=>clearTimeout(u)},[o,i]),o?n.jsxs("div",{className:"fixed bottom-4 right-4 z-50 flex items-center gap-3 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow)",color:"var(--text-primary)"},children:[n.jsxs("span",{children:[a," update",a===1?"":"s"," available"]}),n.jsx("button",{onClick:()=>{window.location.hash="#/updates"},className:"px-2 py-0.5 rounded text-[12px] font-semibold",style:{background:"var(--yellow)",color:"var(--surface-0)",border:"none",cursor:"pointer"},children:"View Updates"}),n.jsx("button",{onClick:i,className:"text-[14px] leading-none",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px"},"aria-label":"Dismiss",children:"✕"})]}):null}const vw=[{name:J.shortcuts.groupNavigation,items:[{keys:"/",label:J.shortcuts.search},{keys:"j",label:J.shortcuts.moveDown},{keys:"k",label:J.shortcuts.moveUp},{keys:"Enter",label:J.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:J.shortcuts.groupActions,items:[{keys:"⌘K",label:J.shortcuts.openPalette},{keys:"?",label:J.shortcuts.openShortcuts},{keys:"⌘B",label:J.shortcuts.toggleSidebar},{keys:"E",label:J.actions.edit}]},{name:J.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:J.shortcuts.toggleTheme}]}];function gw({open:a,onClose:r,groups:i=vw,title:o=J.shortcuts.title}){const u=v.useRef(null),p=v.useRef(null);return v.useEffect(()=>{var f;if(a)return u.current=document.activeElement??null,(f=p.current)==null||f.focus(),()=>{var h,x;(x=(h=u.current)==null?void 0:h.focus)==null||x.call(h),u.current=null}},[a]),v.useEffect(()=>{if(!a)return;function f(h){var x;if(h.key==="Escape"){h.preventDefault(),r();return}h.key==="Tab"&&(h.preventDefault(),(x=p.current)==null||x.focus())}return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[a,r]),a?n.jsx("div",{role:"presentation","data-testid":"shortcut-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, var(--bg-canvas) 70%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60},onClick:f=>{f.target===f.currentTarget&&r()},children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"shortcut-modal-title",style:{width:"min(480px, 92vw)",maxHeight:"80vh",overflow:"auto",background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:8,boxShadow:"0 16px 48px rgba(0,0,0,0.18)",padding:"16px 20px",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[n.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),n.jsx("button",{ref:p,type:"button","aria-label":"Close",onClick:r,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-secondary)",cursor:"pointer",fontSize:13},children:"Esc"})]}),i.map(f=>n.jsxs("section",{style:{marginBottom:12},children:[n.jsx("h3",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-secondary)",margin:"0 0 6px"},children:f.name}),n.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.items.map(h=>n.jsxs("li",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",borderTop:"1px solid var(--border-default)",fontSize:13},children:[n.jsx("span",{children:h.label}),n.jsx("kbd",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-secondary)",border:"1px solid var(--border-default)",borderRadius:3,padding:"1px 6px"},children:h.keys})]},`${f.name}:${h.keys}`))})]},f.name))]})}):null}function yw(a){const r=J.actions,i=[{action:"open",label:r.open},{action:"copy-path",label:r.copyPath},{action:"reveal",label:r.revealInEditor},{action:"run-benchmark",label:r.runBenchmark}];if(a.origin==="source")return[...i,{action:"edit",label:r.edit},{action:"duplicate",label:r.duplicate}];const o=[...i];return a.updateAvailable&&o.push({action:"update",label:r.update}),o.push({action:"uninstall",label:r.uninstall}),o}function bw({state:a,onClose:r,onAction:i,itemsOverride:o}){const u=v.useRef(null),p=v.useRef(null),[f,h]=v.useState(0),x=v.useMemo(()=>a.skill?o??yw(a.skill):[],[a.skill,o]),m=v.useMemo(()=>{if(typeof window>"u")return{left:a.x,top:a.y};const g=8,j=220,S=44+x.length*28;let N=a.x,L=a.y;return N+j+g>window.innerWidth&&(N=Math.max(g,a.x-j)),L+S+g>window.innerHeight&&(L=Math.max(g,a.y-S)),{left:N,top:L}},[a.x,a.y,x.length]);v.useEffect(()=>{if(a.open)return p.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var g;(g=u.current)==null||g.focus()}),()=>{var g,j;(j=(g=p.current)==null?void 0:g.focus)==null||j.call(g),p.current=null}},[a.open]);const y=v.useCallback(()=>{if(!a.skill)return;const g=x[f];!g||g.disabled||(i(g.action,a.skill),r())},[x,f,a.skill,i,r]);return v.useEffect(()=>{if(!a.open)return;function g(S){if(S.key==="Escape"){S.preventDefault(),r();return}if(S.key==="ArrowDown"){S.preventDefault(),h(N=>Math.min(N+1,Math.max(x.length-1,0)));return}if(S.key==="ArrowUp"){S.preventDefault(),h(N=>Math.max(N-1,0));return}if(S.key==="Enter"||S.key===" "){S.preventDefault(),y();return}}function j(S){u.current&&S.target instanceof Node&&(u.current.contains(S.target)||r())}return window.addEventListener("keydown",g,!0),window.addEventListener("mousedown",j,!0),()=>{window.removeEventListener("keydown",g,!0),window.removeEventListener("mousedown",j,!0)}},[a.open,r,x.length,y]),!a.open||!a.skill?null:n.jsx("div",{ref:u,role:"menu",tabIndex:-1,"data-testid":"context-menu",style:{position:"fixed",left:m.left,top:m.top,zIndex:70,minWidth:200,padding:4,background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:6,boxShadow:"0 12px 32px rgba(0,0,0,0.16)",fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",outline:"none"},children:x.map((g,j)=>n.jsx("div",{role:"menuitem","aria-disabled":g.disabled||void 0,"data-action":g.action,"data-selected":j===f||void 0,onMouseEnter:()=>h(j),onClick:()=>{g.disabled||(i(g.action,a.skill),r())},style:{padding:"5px 10px",borderRadius:4,cursor:g.disabled?"default":"pointer",opacity:g.disabled?.5:1,background:j===f?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent"},children:g.label},g.action))})}const jw={"anthropic-api":{name:J.setupProviders.anthropic.name,description:J.setupProviders.anthropic.description,envVars:J.setupProviders.anthropic.envVars,keyUrl:J.setupProviders.anthropic.keyUrl,learnMoreUrl:J.setupProviders.anthropic.learnMoreUrl},openai:{name:J.setupProviders.openai.name,description:J.setupProviders.openai.description,envVars:J.setupProviders.openai.envVars,keyUrl:J.setupProviders.openai.keyUrl,learnMoreUrl:J.setupProviders.openai.learnMoreUrl},openrouter:{name:J.setupProviders.openrouter.name,description:J.setupProviders.openrouter.description,envVars:J.setupProviders.openrouter.envVars,keyUrl:J.setupProviders.openrouter.keyUrl,learnMoreUrl:J.setupProviders.openrouter.learnMoreUrl},gemini:{name:J.setupProviders.gemini.name,description:J.setupProviders.gemini.description,envVars:J.setupProviders.gemini.envVars,keyUrl:J.setupProviders.gemini.keyUrl,learnMoreUrl:J.setupProviders.gemini.learnMoreUrl},ollama:{name:J.setupProviders.ollama.name,description:J.setupProviders.ollama.description,envVars:J.setupProviders.ollama.envVars,install:[J.setupProviders.ollama.installCmd],start:[J.setupProviders.ollama.startCmd],pullExample:J.setupProviders.ollama.pullExample,learnMoreUrl:J.setupProviders.ollama.learnMoreUrl},"lm-studio":{name:J.setupProviders.lmStudio.name,description:J.setupProviders.lmStudio.description,envVars:J.setupProviders.lmStudio.envVars,install:[J.setupProviders.lmStudio.installCmd],start:[J.setupProviders.lmStudio.startCmd],pullExample:J.setupProviders.lmStudio.pullExample,learnMoreUrl:J.setupProviders.lmStudio.learnMoreUrl},"claude-code":{name:J.setupProviders.claudeCode.name,description:J.setupProviders.claudeCode.description,envVars:[],notes:[J.setupProviders.claudeCode.loginHint,J.claudeCodeLabel.compactLabel],learnMoreUrl:J.setupProviders.claudeCode.learnMoreUrl}};function Sw(a){return a?jw[a]??null:null}function kw({open:a,providerKey:r,onClose:i}){const o=v.useRef(null);if(v.useEffect(()=>{if(!a)return;const f=h=>{h.key==="Escape"&&(h.preventDefault(),i())};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[a,i]),v.useEffect(()=>{if(!a)return;const f=o.current;if(!f)return;const h=f.querySelector("button, a[href], [tabindex]:not([tabindex='-1']), input, textarea, select");h==null||h.focus()},[a]),!a||typeof document>"u")return null;const u=Sw(r),p=(u==null?void 0:u.name)??J.setupDrawer.fallbackTitle;return mo.createPortal(n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:i,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),n.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":J.setupDrawer.title(p),style:{position:"fixed",top:0,right:0,bottom:0,width:"480px",maxWidth:"100vw",background:"var(--bg-surface, var(--surface-1))",borderLeft:"1px solid var(--border-default, var(--border-subtle))",boxShadow:"-8px 0 32px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",zIndex:100,fontFamily:"var(--font-sans)",animation:"vskillDrawerIn 200ms cubic-bezier(0.2, 0, 0, 1)"},children:[n.jsx(ww,{title:p,onClose:i}),n.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:u?n.jsx(Cw,{content:u}):n.jsx(Nw,{})}),n.jsx("style",{children:`@keyframes vskillDrawerIn {
|
|
81
81
|
from { transform: translateX(100%); }
|
|
82
82
|
to { transform: translateX(0); }
|
|
83
83
|
}
|
|
84
84
|
@keyframes vskillDrawerBackdropIn {
|
|
85
85
|
from { opacity: 0; }
|
|
86
86
|
to { opacity: 1; }
|
|
87
|
-
}`})]})]}),document.body)}function ww({title:a,onClose:r}){return n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 20px",borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:[n.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:18,fontWeight:500,margin:0,color:"var(--text-primary)"},children:J.setupDrawer.title(a)}),n.jsx("button",{type:"button","data-testid":"setup-drawer-close",onClick:r,"aria-label":J.setupDrawer.close,style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:18,padding:4,lineHeight:1},children:"×"})]})}function Cw({content:a}){var r,i;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[n.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:"var(--text-primary)",margin:0},children:a.description}),a.notes&&a.notes.length>0&&n.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:a.notes.map(o=>n.jsx("li",{style:{fontSize:13,color:"var(--text-secondary)",padding:"8px 10px",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",borderRadius:4},children:o},o))}),a.envVars.length>0&&n.jsxs("section",{children:[n.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:J.setupDrawer.requiredEnv}),n.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:a.envVars.map(o=>n.jsx("li",{children:n.jsx(Ew,{name:o})},o))})]}),a.keyUrl&&n.jsx(Tw,{href:a.keyUrl,label:J.setupDrawer.getKey,testId:"setup-drawer-get-key"}),(a.install||a.start||a.pullExample)&&n.jsxs("section",{children:[n.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:J.setupDrawer.installRun}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(r=a.install)==null?void 0:r.map((o,u)=>n.jsx(rd,{code:o},`install-${u}`)),(i=a.start)==null?void 0:i.map((o,u)=>n.jsx(rd,{code:o},`start-${u}`)),a.pullExample&&n.jsx(rd,{code:a.pullExample})]})]}),n.jsx("footer",{style:{marginTop:8},children:n.jsxs("a",{href:a.learnMoreUrl,target:"_blank",rel:"noopener noreferrer","data-testid":"setup-drawer-learn-more",style:{fontSize:12,color:"var(--color-accent, var(--accent-surface))",textDecoration:"none"},children:[J.setupDrawer.learnMore," →"]})})]})}function Nw(){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[n.jsx("h3",{style:{margin:0,fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:J.setupDrawer.fallbackTitle}),n.jsx("p",{style:{margin:0,fontSize:13,color:"var(--text-secondary)",lineHeight:1.5},children:J.setupDrawer.fallbackBody})]})}function Ew({name:a}){const r=async()=>{var i;try{await((i=navigator.clipboard)==null?void 0:i.writeText(a))}catch{}};return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",background:"color-mix(in srgb, var(--border-default) 30%, transparent)",borderRadius:4},children:[n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",flex:1},children:a}),n.jsx("button",{type:"button",onClick:r,"aria-label":`Copy ${a} to clipboard`,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:3,padding:"2px 8px",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-sans)",cursor:"pointer"},children:J.setupDrawer.copy})]})}function rd({code:a}){return n.jsx("pre",{style:{margin:0,padding:"8px 10px",background:"var(--bg-canvas, #111)",color:"var(--text-primary)",fontFamily:"var(--font-mono)",fontSize:11.5,lineHeight:1.5,borderRadius:4,border:"1px solid var(--border-default, var(--border-subtle))",overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})}function Tw({href:a,label:r,testId:i}){return n.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer","data-testid":i,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 12%, transparent)",color:"var(--text-primary)",textDecoration:"none",fontSize:13,fontWeight:500,fontFamily:"var(--font-sans)",width:"fit-content"},children:[r," →"]})}function Rw(){const[a,r]=v.useState(!1),[i,o]=v.useState(null),u=v.useRef(null),p=v.useCallback((h,x)=>{var m;u.current=typeof document<"u"?document.activeElement:null,(m=x==null?void 0:x.beforeOpen)==null||m.call(x),o(h),r(!0)},[]),f=v.useCallback(()=>{r(!1);const h=u.current;h&&"focus"in h&&typeof h.focus=="function"&&queueMicrotask(()=>h.focus())},[]);return{open:p,close:f,isOpen:a,providerKey:i}}function Aw(a){const r=[],i=[],o=new Set;for(const u of a){if(u.presence==="absent"||u.health==="missing"){i.push({kind:"individual",key:u.id,agent:u});continue}if(u.sharedFolderGroup&&u.sharedFolderGroup.length>1){const p=[...u.sharedFolderGroup].sort().join("+");if(o.has(p))continue;o.add(p);const f=a.filter(h=>u.sharedFolderGroup.includes(h.id));r.push({kind:"aggregate",key:`shared:${p}`,consumers:f,sharedFolderPath:u.sharedFolderPath??"~/.config/agents/skills",combinedCount:f.reduce((h,x)=>h+x.globalCount,0)});continue}r.push({kind:"individual",key:u.id,agent:u})}return{detected:r,notDetected:i}}function Mw({agents:a,activeAgentId:r,focusedAgentId:i,onFocusAgent:o,onSwitch:u,onOpenSetup:p,onClose:f}){const h=v.useRef(null);v.useEffect(()=>{const y=g=>{g.key==="Escape"&&(g.preventDefault(),f())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[f]),v.useEffect(()=>{const y=j=>{h.current&&!h.current.contains(j.target)&&f()},g=setTimeout(()=>{document.addEventListener("mousedown",y)},0);return()=>{clearTimeout(g),document.removeEventListener("mousedown",y)}},[f]);const x=v.useMemo(()=>Aw(a),[a]),m=a.find(y=>y.id===i)??a.find(y=>y.id===r)??a[0];return typeof document>"u"?null:mo.createPortal(n.jsxs("div",{ref:h,"data-testid":"agent-scope-picker-popover",role:"dialog","aria-label":J.scopePicker.popoverTitle,style:{position:"fixed",top:96,left:"50%",transform:"translateX(-50%)",width:600,maxWidth:"calc(100vw - 32px)",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,boxShadow:"0 18px 40px rgba(0,0,0,0.25)",overflow:"hidden",zIndex:90,animation:"scopePickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[n.jsxs("div",{style:{display:"flex",height:360,maxHeight:"60vh"},children:[n.jsxs("section",{"data-testid":"agent-scope-picker-agents",style:{width:260,borderRight:"1px solid var(--border-default, var(--border-subtle))",overflowY:"auto",padding:"6px 0"},children:[x.detected.length===0&&x.notDetected.length===0&&n.jsx(
|
|
87
|
+
}`})]})]}),document.body)}function ww({title:a,onClose:r}){return n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 20px",borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:[n.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:18,fontWeight:500,margin:0,color:"var(--text-primary)"},children:J.setupDrawer.title(a)}),n.jsx("button",{type:"button","data-testid":"setup-drawer-close",onClick:r,"aria-label":J.setupDrawer.close,style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:18,padding:4,lineHeight:1},children:"×"})]})}function Cw({content:a}){var r,i;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[n.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:"var(--text-primary)",margin:0},children:a.description}),a.notes&&a.notes.length>0&&n.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:a.notes.map(o=>n.jsx("li",{style:{fontSize:13,color:"var(--text-secondary)",padding:"8px 10px",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",borderRadius:4},children:o},o))}),a.envVars.length>0&&n.jsxs("section",{children:[n.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:J.setupDrawer.requiredEnv}),n.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:a.envVars.map(o=>n.jsx("li",{children:n.jsx(Ew,{name:o})},o))})]}),a.keyUrl&&n.jsx(Tw,{href:a.keyUrl,label:J.setupDrawer.getKey,testId:"setup-drawer-get-key"}),(a.install||a.start||a.pullExample)&&n.jsxs("section",{children:[n.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:J.setupDrawer.installRun}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(r=a.install)==null?void 0:r.map((o,u)=>n.jsx(rd,{code:o},`install-${u}`)),(i=a.start)==null?void 0:i.map((o,u)=>n.jsx(rd,{code:o},`start-${u}`)),a.pullExample&&n.jsx(rd,{code:a.pullExample})]})]}),n.jsx("footer",{style:{marginTop:8},children:n.jsxs("a",{href:a.learnMoreUrl,target:"_blank",rel:"noopener noreferrer","data-testid":"setup-drawer-learn-more",style:{fontSize:12,color:"var(--color-accent, var(--accent-surface))",textDecoration:"none"},children:[J.setupDrawer.learnMore," →"]})})]})}function Nw(){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[n.jsx("h3",{style:{margin:0,fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:J.setupDrawer.fallbackTitle}),n.jsx("p",{style:{margin:0,fontSize:13,color:"var(--text-secondary)",lineHeight:1.5},children:J.setupDrawer.fallbackBody})]})}function Ew({name:a}){const r=async()=>{var i;try{await((i=navigator.clipboard)==null?void 0:i.writeText(a))}catch{}};return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",background:"color-mix(in srgb, var(--border-default) 30%, transparent)",borderRadius:4},children:[n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",flex:1},children:a}),n.jsx("button",{type:"button",onClick:r,"aria-label":`Copy ${a} to clipboard`,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:3,padding:"2px 8px",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-sans)",cursor:"pointer"},children:J.setupDrawer.copy})]})}function rd({code:a}){return n.jsx("pre",{style:{margin:0,padding:"8px 10px",background:"var(--bg-canvas, #111)",color:"var(--text-primary)",fontFamily:"var(--font-mono)",fontSize:11.5,lineHeight:1.5,borderRadius:4,border:"1px solid var(--border-default, var(--border-subtle))",overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})}function Tw({href:a,label:r,testId:i}){return n.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer","data-testid":i,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 12%, transparent)",color:"var(--text-primary)",textDecoration:"none",fontSize:13,fontWeight:500,fontFamily:"var(--font-sans)",width:"fit-content"},children:[r," →"]})}function Rw(){const[a,r]=v.useState(!1),[i,o]=v.useState(null),u=v.useRef(null),p=v.useCallback((h,x)=>{var m;u.current=typeof document<"u"?document.activeElement:null,(m=x==null?void 0:x.beforeOpen)==null||m.call(x),o(h),r(!0)},[]),f=v.useCallback(()=>{r(!1);const h=u.current;h&&"focus"in h&&typeof h.focus=="function"&&queueMicrotask(()=>h.focus())},[]);return{open:p,close:f,isOpen:a,providerKey:i}}function Aw(a){const r=[],i=[],o=new Set;for(const u of a){if(u.presence==="absent"||u.health==="missing"){i.push({kind:"individual",key:u.id,agent:u});continue}if(u.sharedFolderGroup&&u.sharedFolderGroup.length>1){const p=[...u.sharedFolderGroup].sort().join("+");if(o.has(p))continue;o.add(p);const f=a.filter(h=>u.sharedFolderGroup.includes(h.id));r.push({kind:"aggregate",key:`shared:${p}`,consumers:f,sharedFolderPath:u.sharedFolderPath??"~/.config/agents/skills",combinedCount:f.reduce((h,x)=>h+x.globalCount,0)});continue}r.push({kind:"individual",key:u.id,agent:u})}return{detected:r,notDetected:i}}function Mw({agents:a,activeAgentId:r,focusedAgentId:i,onFocusAgent:o,onSwitch:u,onOpenSetup:p,onClose:f}){const h=v.useRef(null);v.useEffect(()=>{const y=g=>{g.key==="Escape"&&(g.preventDefault(),f())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[f]),v.useEffect(()=>{const y=j=>{h.current&&!h.current.contains(j.target)&&f()},g=setTimeout(()=>{document.addEventListener("mousedown",y)},0);return()=>{clearTimeout(g),document.removeEventListener("mousedown",y)}},[f]);const x=v.useMemo(()=>Aw(a),[a]),m=a.find(y=>y.id===i)??a.find(y=>y.id===r)??a[0];return typeof document>"u"?null:mo.createPortal(n.jsxs("div",{ref:h,"data-testid":"agent-scope-picker-popover",role:"dialog","aria-label":J.scopePicker.popoverTitle,style:{position:"fixed",top:96,left:"50%",transform:"translateX(-50%)",width:600,maxWidth:"calc(100vw - 32px)",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,boxShadow:"0 18px 40px rgba(0,0,0,0.25)",overflow:"hidden",zIndex:90,animation:"scopePickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[n.jsxs("div",{style:{display:"flex",height:360,maxHeight:"60vh"},children:[n.jsxs("section",{"data-testid":"agent-scope-picker-agents",style:{width:260,borderRight:"1px solid var(--border-default, var(--border-subtle))",overflowY:"auto",padding:"6px 0"},children:[x.detected.length===0&&x.notDetected.length===0&&n.jsx(lv,{}),x.detected.map(y=>y.kind==="aggregate"?n.jsx(Lw,{row:y,onFocus:()=>{var g;return o(((g=y.consumers[0])==null?void 0:g.id)??r??"")}},y.key):n.jsx(zw,{agent:y.agent,focused:y.agent.id===i,active:y.agent.id===r,onClick:()=>o(y.agent.id)},y.key)),x.notDetected.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-testid":"agent-scope-not-detected-subheading",style:{padding:"10px 14px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-tertiary)"},children:J.scopePicker.notDetectedSubheading}),x.notDetected.map(y=>n.jsx(Dw,{agent:y.agent,onSetUp:()=>p(y.agent.id)},y.key))]})]}),n.jsx("section",{"data-testid":"agent-scope-picker-stats",style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:m?n.jsx(_w,{agent:m,activeAgentId:r,onSwitch:()=>u(m.id)}):n.jsx(lv,{})})]}),n.jsx("style",{children:`@keyframes scopePickerFadeIn {
|
|
88
88
|
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
89
89
|
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
90
|
-
}`})]}),document.body)}function zw({agent:a,focused:r,active:i,onClick:o}){const u=a.health==="ok"?"var(--color-ok, #22c55e)":a.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return n.jsxs("button",{type:"button","data-testid":"agent-scope-row","data-agent-id":a.id,"data-active":i?"true":"false",onClick:o,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",border:"none",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:u,flexShrink:0}}),n.jsx("span",{style:{flex:1,fontSize:13},children:a.displayName}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[a.installedCount,"·",a.globalCount]})]})}function Lw({row:a,onFocus:r}){return n.jsxs("button",{type:"button","data-testid":"agent-scope-shared-folder-row",onClick:r,style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"100%",padding:"8px 14px",background:"transparent",border:"none",borderTop:"1px dashed var(--border-subtle)",borderBottom:"1px dashed var(--border-subtle)",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:a.sharedFolderPath}),n.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[a.consumers.map(i=>n.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"color-mix(in srgb, var(--color-global) 20%, transparent)",color:"var(--text-primary)"},children:i.id},i.id)),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",a.combinedCount," skills"]})]})]})}function Dw({agent:a,onSetUp:r}){return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),n.jsx("span",{style:{flex:1},children:a.displayName}),a.isRemoteOnly?n.jsx("span",{"data-testid":`agent-scope-remote-badge-${a.id}`,"aria-label":"Remote-only agent",style:{background:"color-mix(in srgb, var(--text-tertiary) 18%, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:10,padding:"1px 8px",color:"var(--text-secondary)",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Remote"}):n.jsx("button",{type:"button","data-testid":`agent-scope-set-up-${a.id}`,onClick:r,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",fontSize:11,cursor:"pointer"},children:J.scopePicker.setUpCta(a.displayName)})]})}function _w({agent:a,activeAgentId:r,onSwitch:i}){const o=a.id===r,u=a.isRemoteOnly===!0,p=o||u,f=o?"Active":u?"Remote-only":J.scopePicker.switchCta;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.jsxs("div",{children:[n.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:u?"Remote service — no local install":Bw(a.health)})]}),n.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[n.jsx(sd,{label:J.scopePicker.statsInstalled,value:String(a.installedCount)}),n.jsx(sd,{label:J.scopePicker.statsGlobal,value:String(a.globalCount)}),n.jsx(sd,{label:J.scopePicker.statsLastSync,value:a.lastSync?Ow(a.lastSync):"—"})]}),n.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:i,disabled:p,title:u?"This agent has no local CLI to switch to":void 0,style:{alignSelf:"flex-start",padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:p?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:p?"default":"pointer",opacity:p?.5:1},children:f})]})}function sd({label:a,value:r}){return n.jsxs(n.Fragment,{children:[n.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:a}),n.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:r})]})}function av(){return n.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function Ow(a){try{const r=new Date(a).getTime(),i=Date.now()-r;if(Number.isNaN(r))return"—";const o=Math.round(i/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const u=Math.round(o/60);return u<24?`${u}h ago`:`${Math.round(u/24)}d ago`}catch{return"—"}}function Bw(a){switch(a){case"ok":return J.scopePicker.statsHealthOk;case"stale":return J.scopePicker.statsHealthStale;case"missing":return J.scopePicker.statsHealthMissing}}function Iw(a){const r=new Map;for(const i of a.sharedFolders??[])for(const o of i.consumers)r.set(o,i);return a.agents.map(i=>{const o=r.get(i.id);return{id:i.id,displayName:i.displayName,presence:i.detected?"detected":"absent",installedCount:i.localSkillCount,globalCount:i.globalSkillCount,lastSync:i.lastSync,health:i.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:i.isRemoteOnly}})}function Hw({agents:a,activeAgentId:r,onActiveAgentChange:i,onOpenSetup:o}){const[u,p]=v.useState(!1),[f,h]=v.useState(null),x=v.useRef(null),m=v.useMemo(()=>a.find(S=>S.id===r)??a[0]??null,[a,r]),y=v.useMemo(()=>m?m.health==="ok"?"var(--color-ok, #22c55e)":m.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[m]),g=v.useCallback(()=>{var S;p(!1),(S=x.current)==null||S.focus()},[]),j=v.useCallback(S=>{i(S),p(!1)},[i]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:x,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":u,onClick:()=>p(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),p(!0))},style:{display:"flex",alignItems:"center",gap:10,height:"40px",width:"100%",padding:"0 14px",background:"var(--bg-surface, var(--surface-1))",border:"none",borderBottom:"1px solid var(--border-default, var(--border-subtle))",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,textAlign:"left",position:"sticky",top:0,zIndex:2},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),n.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(m==null?void 0:m.displayName)??"Select agent"}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:["(",(m==null?void 0:m.installedCount)??0," · ",(m==null?void 0:m.globalCount)??0,")"]}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),u&&n.jsx(Mw,{agents:a,activeAgentId:r,focusedAgentId:f??r,onFocusAgent:h,onSwitch:j,onOpenSetup:S=>{o(S),g()},onClose:g})]})}const kg="vskill-ccode-banner-dismissed",Uw=new Set(["claude-cli","claude-code"]);function Vw(){try{return sessionStorage.getItem(kg)==="true"}catch{return!1}}function $w(){try{sessionStorage.setItem(kg,"true")}catch{}}function Gw({activeAgentId:a}){const[r,i]=v.useState(()=>Vw()),o=v.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),u=v.useCallback(()=>{$w(),i(!0)},[]);return!a||!Uw.has(a)||r?null:n.jsxs("div",{"data-testid":"claude-code-first-use-banner",role:"note","aria-label":"Claude Code subscription info",style:{display:"flex",alignItems:"flex-start",gap:10,padding:"8px 12px",borderBottom:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",lineHeight:1.45},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("span",{children:[J.claudeCodeLabel.firstUseBanner," "]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:J.claudeCodeLabel.learnMore})]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:u,"aria-label":"Dismiss Claude Code info banner",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1,padding:2,flexShrink:0},children:"×"})]})}function Pw(){const[a,r]=v.useState(null),[i,o]=v.useState("loading"),[u,p]=v.useState(null),f=v.useCallback(async()=>{try{const h=await Ne.getAgents();r(h),o("ready"),p(null)}catch(h){o("error"),p(h.message)}},[]);return v.useEffect(()=>{f()},[f]),v.useEffect(()=>{const h=()=>void f();return window.addEventListener("studio:agent-changed",h),()=>window.removeEventListener("studio:agent-changed",h)},[f]),{status:i,response:a,error:u,refresh:()=>void f()}}const eo="workspace",qw=["skills","agents"];async function Yw(){const a=await fetch("/api/workspace");if(!a.ok)throw new Error(`GET /api/workspace failed: ${a.status}`);return await a.json()}async function Fw(a){const r=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/active failed: ${r.status}`)}return await r.json()}async function Ww(a){const r=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/projects failed: ${r.status}`)}return await r.json()}async function Kw(a){const r=await fetch(`/api/workspace/projects/${encodeURIComponent(a)}`,{method:"DELETE"});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`DELETE /api/workspace/projects/${a} failed: ${r.status}`)}return await r.json()}function id(){for(const a of qw)Xn(a)}function Xw(){const{data:a,loading:r,error:i,revalidate:o}=zs(eo,Yw),u=a,p=u==null?void 0:u.projects.find(m=>m.id===u.activeProjectId),f=v.useCallback(async m=>{await Fw(m),Xn(eo),id()},[]),h=v.useCallback(async m=>{await Ww(m),Xn(eo),id()},[]),x=v.useCallback(async m=>{await Kw(m),Xn(eo),id()},[]);return{workspace:u,activeProject:p,loading:r,error:i,switchProject:f,addProject:h,removeProject:x,revalidate:o}}function Qw({workspace:a,onSwitch:r,onAdd:i,onRemove:o,isPathStale:u}){const[p,f]=v.useState(!1),[h,x]=v.useState(!1),[m,y]=v.useState(""),[g,j]=v.useState(null),[S,N]=v.useState(null),z=v.useRef(null),T=(a==null?void 0:a.projects)??[],k=T.find(A=>A.id===(a==null?void 0:a.activeProjectId));v.useEffect(()=>{if(!p)return;function A(U){z.current&&!z.current.contains(U.target)&&(f(!1),x(!1),j(null))}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[p]);async function M(){j(null);const A=m.trim();if(!A){j("Enter an absolute project path");return}try{await i({path:A}),y(""),x(!1)}catch(U){j(U instanceof Error?U.message:String(U))}}async function O(){if(j(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const A=await window.showDirectoryPicker();y(A.name),x(!0)}catch{}else x(!0)}function V(A){if(A.length<=50)return A;const U=A.split("/");return U.length<=4?A:`${U.slice(0,3).join("/")}/…/${U.slice(-2).join("/")}`}return n.jsxs("div",{ref:z,"data-vskill-project-picker":!0,style:{position:"relative",display:"inline-block"},children:[n.jsxs("button",{type:"button",onClick:()=>f(A=>!A),"aria-expanded":p,"aria-haspopup":"menu",title:(k==null?void 0:k.path)??"No project selected",style:{display:"flex",alignItems:"center",gap:8,padding:"4px 10px",border:"1px solid transparent",borderRadius:6,background:p?"var(--surface-2, rgba(0,0,0,0.05))":"transparent",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-primary)",transition:"background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,backgroundColor:(k==null?void 0:k.colorDot)??"var(--text-tertiary, #999)"}}),n.jsx("span",{style:{maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k?k.name:"No project"}),n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary, #999)",marginLeft:2},children:p?"▴":"▾"})]}),p&&n.jsxs("div",{role:"menu","aria-label":"Switch project",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:280,maxWidth:420,width:"max-content",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:8,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 10px 20px -5px rgba(0,0,0,0.12)",overflow:"hidden",zIndex:50,fontFamily:"var(--font-sans)"},children:[T.length===0&&n.jsx("div",{style:{padding:"16px 16px 12px",fontSize:12,color:"var(--text-tertiary)",lineHeight:1.5},children:"No projects registered. Add one to get started."}),T.length>0&&n.jsx("ul",{role:"none",style:{listStyle:"none",margin:0,padding:4,maxHeight:320,overflowY:"auto"},children:T.map(A=>{const U=u?u(A.path):!1,w=A.id===(a==null?void 0:a.activeProjectId),L=S===A.id;return n.jsxs("li",{role:"menuitem","data-stale":U?"true":"false",onMouseEnter:()=>N(A.id),onMouseLeave:()=>N(R=>R===A.id?null:R),onClick:()=>{U||(r(A.id),f(!1))},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:U?"not-allowed":"pointer",background:L&&!U?"var(--surface-2, rgba(0,0,0,0.04))":w?"var(--surface-1, rgba(0,0,0,0.02))":"transparent",opacity:U?.5:1,transition:"background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{width:10,height:10,borderRadius:"50%",flexShrink:0,backgroundColor:A.colorDot,boxShadow:w?"0 0 0 2px color-mix(in oklch, currentColor 20%, transparent)":"none"}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,fontWeight:w?600:500,color:"var(--text-primary)",lineHeight:1.3},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.name}),w&&n.jsx("span",{"aria-label":"Active",style:{fontSize:10,color:"var(--color-accent, #2f6f8f)",letterSpacing:"0.05em",textTransform:"uppercase",fontWeight:600},children:"Active"})]}),n.jsx("div",{title:A.path,style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:V(A.path)}),U&&n.jsx("div",{style:{fontSize:10,color:"var(--color-own, #b45309)",marginTop:2},children:"Path no longer exists"})]}),n.jsx("button",{type:"button","aria-label":`Remove ${A.name}`,onClick:R=>{R.stopPropagation(),o(A.id)},style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",color:"var(--text-tertiary)",opacity:L?1:0,transition:"opacity 120ms ease, color 120ms ease, background-color 120ms ease",flexShrink:0},onMouseEnter:R=>{R.currentTarget.style.color="var(--color-error, #b91c1c)",R.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-error, #b91c1c) 10%, transparent)"},onMouseLeave:R=>{R.currentTarget.style.color="var(--text-tertiary)",R.currentTarget.style.backgroundColor="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),n.jsx("path",{d:"M10 11v6"}),n.jsx("path",{d:"M14 11v6"}),n.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})})]},A.id)})}),n.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:h?8:6},children:[!h&&n.jsxs("button",{type:"button",onClick:()=>void O(),className:"vskill-project-add",style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 10px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,color:"var(--color-accent, #2f6f8f)",transition:"background-color 120ms ease"},onMouseEnter:A=>{A.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-accent, #2f6f8f) 10%, transparent)"},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="transparent"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add project"]}),h&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[n.jsx("input",{type:"text",value:m,onChange:A=>y(A.target.value),onKeyDown:A=>{A.key==="Enter"&&M(),A.key==="Escape"&&(x(!1),j(null))},placeholder:"/absolute/path/to/project",autoFocus:!0,style:{width:"100%",padding:"6px 8px",fontFamily:"var(--font-mono)",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),n.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[n.jsx("button",{type:"button",onClick:()=>{x(!1),j(null),y("")},style:{padding:"4px 10px",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Cancel"}),n.jsx("button",{type:"button",onClick:()=>void M(),style:{padding:"4px 10px",fontSize:12,border:"none",borderRadius:4,background:"var(--color-accent, #2f6f8f)",color:"var(--color-paper, #fff)",cursor:"pointer",fontWeight:500},children:"Add"})]}),g&&n.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:g})]})]})]})]})}function Zw(a,r){const i=r.trim().toLowerCase().split(/\s+/).filter(Boolean);return i.length===0?a:a.filter(o=>{const u=`${o.name} ${o.path}`.toLowerCase();return i.every(p=>u.includes(p))})}function Jw({open:a,projects:r,onSwitch:i,onClose:o}){const[u,p]=v.useState(""),[f,h]=v.useState(0),x=v.useMemo(()=>Zw(r,u),[r,u]);v.useEffect(()=>{a||(p(""),h(0))},[a]),v.useEffect(()=>{f>=x.length&&h(0)},[x.length,f]);const m=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),h(g=>Math.min(g+1,Math.max(x.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),h(g=>Math.max(g-1,0));return}if(y.key==="Enter"){y.preventDefault();const g=x[f];g&&(i(g.id),o())}};return a?n.jsxs("div",{role:"dialog","aria-modal":"true","data-vskill-project-palette":!0,className:"vskill-project-palette fixed inset-0 z-50 flex items-start justify-center pt-24",children:[n.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),n.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[n.jsx("input",{type:"text",autoFocus:!0,value:u,onChange:y=>p(y.target.value),onKeyDown:m,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),n.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[x.length===0&&n.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),x.map((y,g)=>n.jsxs("li",{role:"option","aria-selected":g===f,"data-highlighted":g===f,className:["flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",g===f?"bg-muted":""].join(" "),onMouseEnter:()=>h(g),onClick:()=>{i(y.id),o()},children:[n.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),n.jsxs("span",{className:"flex-1",children:[n.jsx("span",{className:"vskill-palette-name",children:y.name}),n.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const lv=/^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;function eC({open:a,onClose:r,initialMode:i="standalone",isClaudeCode:o,projectRoot:u,onCreated:p}){const[f,h]=v.useState("destination"),[x,m]=v.useState(i),[y,g]=v.useState(""),[j,S]=v.useState(""),[N,z]=v.useState(""),[T,k]=v.useState([]),[M,O]=v.useState(!1),[V,A]=v.useState(null);if(v.useEffect(()=>{a&&(h("destination"),m(i),g(""),S(""),z(""),A(null))},[a,i]),v.useEffect(()=>{if(!a)return;let q=!0;return fetch("/api/authoring/plugins").then(_=>_.json()).then(_=>{q&&k(_.plugins??[])}).catch(()=>{}),()=>{q=!1}},[a]),v.useEffect(()=>{if(!a)return;function q(_){_.key==="Escape"&&(_.preventDefault(),r())}return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[a,r]),!a)return null;const U=T.length>0,w=o&&U,L=o,R=lv.test(y),I=x==="existing-plugin"?j.length>0:lv.test(j),G=!M&&R&&(x==="standalone"||I),Y=tC(u,x,j,y);async function te(){A(null),O(!0);try{const q=await fetch("/api/authoring/create-skill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:x,skillName:y,description:N.trim()||void 0,pluginName:x==="standalone"?void 0:j})}),_=await q.json();if(!q.ok||!_.ok){A(_.error??`Create failed: ${q.status}`);return}Xn("skills"),p==null||p({mode:x,skillName:y,pluginName:_.pluginName??null,skillMdPath:_.skillMdPath}),r()}catch(q){A(q instanceof Error?q.message:String(q))}finally{O(!1)}}return n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Create skill","data-vskill-create-skill-modal":!0,style:{position:"fixed",inset:0,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},children:[n.jsx("div",{onClick:r,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),n.jsxs("div",{style:{position:"relative",width:"min(560px, 92vw)",maxHeight:"86vh",overflow:"auto",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[n.jsx("h2",{style:{margin:0,fontSize:16,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",letterSpacing:"0.01em"},children:f==="destination"?"Create a skill":"Name and describe"}),n.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:["Step ",f==="destination"?"1":"2"," of 2"]})]}),f==="destination"&&n.jsxs("div",{style:{padding:14,display:"flex",flexDirection:"column",gap:10},children:[n.jsx(od,{title:"Standalone skill",subtitle:"A single skill in this project",description:"Lives at <project>/skills/<name>/SKILL.md. Works with every agent.",icon:"📄",selected:x==="standalone",onClick:()=>m("standalone")}),n.jsx(od,{title:"Add to existing plugin",subtitle:w?`${T.length} plugin source${T.length===1?"":"s"} in this project`:o?"No plugin sources in this project yet":"Claude Code only",description:"Appends a skill to an existing <plugin>/.claude-plugin/plugin.json source.",icon:"🧩",disabled:!w,selected:x==="existing-plugin",onClick:()=>w&&m("existing-plugin")}),n.jsx(od,{title:"New plugin",subtitle:L?"Bundles one or more skills for distribution":"Claude Code only",description:"Scaffolds <plugin>/.claude-plugin/plugin.json and its first skill.",icon:"📦",disabled:!L,selected:x==="new-plugin",onClick:()=>L&&m("new-plugin")})]}),f==="details"&&n.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:12},children:[x==="new-plugin"&&n.jsx(to,{label:"Plugin name",hint:"kebab-case",children:n.jsx("input",{type:"text",value:j,onChange:q=>S(q.target.value.trim()),placeholder:"my-first-plugin",autoFocus:!0,style:no(!j||I)})}),x==="existing-plugin"&&n.jsx(to,{label:"Plugin",children:n.jsxs("select",{value:j,onChange:q=>S(q.target.value),style:{...no(!0),fontFamily:"var(--font-mono)"},children:[n.jsx("option",{value:"",children:"Select a plugin…"}),T.map(q=>n.jsx("option",{value:q.name,children:q.name},q.path))]})}),n.jsx(to,{label:"Skill name",hint:"kebab-case",children:n.jsx("input",{type:"text",value:y,onChange:q=>g(q.target.value.trim()),placeholder:"my-new-skill",autoFocus:x!=="new-plugin",style:no(!y||R)})}),n.jsx(to,{label:"Description",hint:"One short sentence — shown in frontmatter",children:n.jsx("textarea",{value:N,onChange:q=>z(q.target.value),rows:2,placeholder:"Does a thing when Claude needs X",style:{...no(!0),resize:"vertical",minHeight:52,fontFamily:"var(--font-sans)"}})}),Y&&n.jsxs("div",{style:{padding:"8px 10px",fontSize:11,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",background:"var(--surface-1, rgba(0,0,0,0.03))",border:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",borderRadius:4,wordBreak:"break-all"},children:[n.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:2,fontFamily:"var(--font-sans)"},children:"Will create:"}),Y.map((q,_)=>n.jsx("div",{children:q},_))]}),V&&n.jsx("div",{style:{fontSize:12,color:"var(--color-error, #b91c1c)",padding:"6px 10px",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:V})]}),n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 16px",borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",background:"var(--surface-1, rgba(0,0,0,0.02))"},children:[n.jsx("button",{type:"button",onClick:r,style:sv,children:"Cancel"}),f==="destination"&&n.jsx("button",{type:"button",onClick:()=>h("details"),style:rv,children:"Continue →"}),f==="details"&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>h("destination"),style:sv,children:"← Back"}),n.jsx("button",{type:"button",onClick:()=>void te(),disabled:!G,style:{...rv,opacity:G?1:.5,cursor:G?"pointer":"not-allowed"},children:M?"Creating…":"Create skill"})]})]})]})]})}function od({title:a,subtitle:r,description:i,icon:o,selected:u,disabled:p,onClick:f}){return n.jsxs("button",{type:"button",onClick:f,disabled:p,"aria-pressed":u,style:{display:"flex",gap:12,padding:"12px 14px",textAlign:"left",borderRadius:8,border:u?"2px solid var(--color-accent, #2f6f8f)":"1px solid var(--border-default, rgba(0,0,0,0.12))",background:u?"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))":p?"var(--surface-1, rgba(0,0,0,0.02))":"var(--color-paper, #fff)",color:p?"var(--text-tertiary)":"var(--text-primary)",cursor:p?"not-allowed":"pointer",opacity:p?.6:1,fontFamily:"inherit",width:"100%",transition:"border-color 120ms ease, background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:22,lineHeight:1,marginTop:2},children:o}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsx("div",{style:{fontSize:14,fontWeight:600,lineHeight:1.3},children:a}),n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:2,textTransform:"uppercase",letterSpacing:"0.04em"},children:r}),n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:6,lineHeight:1.5},children:i})]})]})}function to({label:a,hint:r,children:i}){return n.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[n.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[n.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:a}),r&&n.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:r})]}),i]})}function no(a){return{width:"100%",padding:"7px 10px",fontSize:13,fontFamily:"var(--font-mono)",border:`1px solid ${a?"var(--border-default, rgba(0,0,0,0.12))":"var(--color-error, #b91c1c)"}`,borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none",boxSizing:"border-box"}}const rv={padding:"7px 14px",fontSize:13,fontWeight:500,border:"none",borderRadius:6,background:"var(--color-accent, #2f6f8f)",color:"var(--color-paper, #fff)",cursor:"pointer",fontFamily:"inherit"},sv={padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer",fontFamily:"inherit"};function tC(a,r,i,o){const u=o||"<skill-name>",p=i||"<plugin-name>",f=a||"<project>";return r==="standalone"?[`${f}/skills/${u}/SKILL.md`]:r==="existing-plugin"?[`${f}/${p}/skills/${u}/SKILL.md`]:r==="new-plugin"?[`${f}/${p}/.claude-plugin/plugin.json`,`${f}/${p}/skills/${u}/SKILL.md`]:null}const wg="vskill.studio.prefs";function Cg(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function Ng(){const a=Cg();if(!a)return{};try{const r=a.getItem(wg);if(!r)return{};const i=JSON.parse(r);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return{}}}function nC(a,r){const i=Cg();if(i)try{const u={...Ng(),[a]:r};i.setItem(wg,JSON.stringify(u))}catch{}}function aC(a,r){const o=Ng()[a];return o===void 0?r:o}const iv={open:!1,x:0,y:0,skill:null};function lC(a,r){return{open:!0,x:a.clientX,y:a.clientY,skill:r}}function xl(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function rC(a,r){var i;switch(a){case"copy-path":try{(i=navigator.clipboard)==null||i.writeText(r.dir)}catch{xl(J.toasts.permissionDenied,"error");return}xl(J.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":xl(J.actions.editPlaceholder,"info");return;case"run-benchmark":xl(J.toasts.benchmarkQueued,"info");return;case"duplicate":xl(J.toasts.skillDuplicated,"info");return;case"update":xl(J.toasts.skillUpdated,"info");return;case"uninstall":xl(J.actions.editPlaceholder,"info");return;default:return}}const sC=v.lazy(()=>Cd(()=>import("./CommandPalette-DQ77TboB.js"),__vite__mapDeps([2,1])));function iC(){return n.jsx(xb,{children:n.jsx(pb,{children:n.jsxs(sw,{children:[n.jsx(oC,{}),n.jsx(xw,{})]})})})}function oC(){var Le,ae;const{state:a,selectSkill:r,clearSelection:i,refreshSkills:o,outdatedByOrigin:u}=ya(),{config:p}=bl(),{mode:f,resolvedTheme:h,setTheme:x}=xv(),{toast:m}=Gd(),[y,g]=v.useState(()=>M2()),[j]=v.useState(!0),[S,N]=v.useState(!1),[z,T]=v.useState(!1),[k,M]=v.useState(!1),[O,V]=v.useState("overview"),[A,U]=v.useState(iv),w=v.useCallback((Z,se)=>{U(lC(Z,se))},[]),L=Pw(),[R,I]=v.useState(()=>aC("activeAgent",null));v.useEffect(()=>{var Z;!R&&((Z=L.response)!=null&&Z.suggested)&&I(L.response.suggested)},[R,(Le=L.response)==null?void 0:Le.suggested]);const G=v.useCallback(Z=>{I(Z),nC("activeAgent",Z),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:Z}}))},[]),Y=v.useMemo(()=>L.response?Iw(L.response):[],[L.response]),{workspace:te,switchProject:q,addProject:_,removeProject:E,activeProject:B}=Xw(),[ne,F]=v.useState(!1),[me,D]=v.useState(!1),[K,oe]=v.useState("standalone"),fe=v.useCallback((Z="standalone")=>{oe(Z),D(!0)},[]);v.useEffect(()=>{function Z(se){if(!(se instanceof CustomEvent))return;const ue=se.detail;fe((ue==null?void 0:ue.mode)??"standalone")}return window.addEventListener("studio:request-create-skill",Z),()=>window.removeEventListener("studio:request-create-skill",Z)},[fe]),vd([{key:"p",meta:!0,handler:Z=>{var ue;const se=typeof document<"u"?document.activeElement:null;se&&se.tagName==="INPUT"||((ue=Z==null?void 0:Z.preventDefault)==null||ue.call(Z),F(ge=>!ge))}}],{enabled:!0});const he=Rw();v.useEffect(()=>{function Z(se){if(!(se instanceof CustomEvent))return;const ue=se.detail;ue!=null&&ue.provider&&he.open(ue.provider)}return window.addEventListener("studio:open-setup-drawer",Z),()=>window.removeEventListener("studio:open-setup-drawer",Z)},[he]);const xe=v.useCallback(()=>{U(iv)},[]);v.useEffect(()=>{function Z(se){if(!(se instanceof CustomEvent))return;const ue=se.detail;ue!=null&&ue.message&&m({message:ue.message,severity:ue.severity??"info"})}return window.addEventListener("studio:toast",Z),()=>window.removeEventListener("studio:toast",Z)},[m]),v.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${y}px`)},[y]);const ke=v.useMemo(()=>a.selectedSkill?a.skills.find(Z=>Z.plugin===a.selectedSkill.plugin&&Z.skill===a.selectedSkill.skill)??null:null,[a.skills,a.selectedSkill]),ce=v.useCallback(Z=>{r({plugin:Z.plugin,skill:Z.skill,origin:Z.origin})},[r]),je=v.useMemo(()=>{if(!a.selectedSkill)return"";const Z=a.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${a.selectedSkill.skill} (${Z})`},[a.selectedSkill]),Ue=v.useMemo(()=>[{id:"switch-theme",label:J.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>x(f==="light"?"dark":f==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>M(Z=>!Z)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>T(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[f,x,o]);return vd([{key:"cmd+k",handler:()=>N(Z=>!Z)},{key:"ctrl+k",handler:()=>N(Z=>!Z)},{key:"?",handler:()=>T(Z=>!Z)},{key:"cmd+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"cmd+b",handler:()=>M(Z=>!Z)},{key:"ctrl+b",handler:()=>M(Z=>!Z)},{key:"e",handler:()=>m({message:J.actions.editPlaceholder,severity:"info"})}]),n.jsxs(n.Fragment,{children:[n.jsx(vb,{sidebarWidth:y,sidebarHidden:k||a.isMobile&&a.mobileView==="detail",banner:n.jsx(D2,{connected:j}),liveMessage:je,topRail:n.jsx(x0,{projectName:(p==null?void 0:p.projectName)??null,selected:a.selectedSkill,onOpenPalette:()=>N(!0),onHome:i,onRequestCreateSkill:()=>fe("standalone"),projectPickerSlot:te&&te.projects.length>0?n.jsx(Qw,{workspace:te,onSwitch:q,onAdd:_,onRemove:E}):void 0}),sidebar:n.jsx(k2,{skills:a.skills,selectedKey:a.selectedSkill?{plugin:a.selectedSkill.plugin,skill:a.selectedSkill.skill}:null,onSelect:ce,isLoading:a.skillsLoading,error:a.skillsError??null,onRetry:o,onContextMenu:w,outdatedByOrigin:u,activeAgentId:R,topSlot:L.status==="ready"&&Y.length>0?n.jsxs(n.Fragment,{children:[n.jsx(Hw,{agents:Y,activeAgentId:R,onActiveAgentChange:G,onOpenSetup:Z=>he.open(Z)}),n.jsx(Gw,{activeAgentId:R})]}):null}),resizeHandle:n.jsx(L2,{initialWidth:y??js,onChange:g}),main:n.jsx(cw,{selectedSkillInfo:ke,activeDetailTab:O,onDetailTabChange:V,allSkills:a.skills,onSelectSkill:ce}),statusBar:n.jsx(E0,{projectPath:(p==null?void 0:p.root)??null,modelName:(p==null?void 0:p.model)??null,health:p!=null&&p.error?"degraded":"ok",providers:(ae=p==null?void 0:p.providers)==null?void 0:ae.map(Z=>{const se=Z.id;return{id:se,label:Z.label,available:Z.available,kind:se==="ollama"||se==="lm-studio"?"start-service":se==="anthropic"||se==="openrouter"?"api-key":"cli-install"}})})}),n.jsx(gw,{open:z,onClose:()=>T(!1)}),n.jsx(kw,{open:he.isOpen,providerKey:he.providerKey,onClose:he.close}),n.jsx(bw,{state:A,onClose:xe,onAction:(Z,se)=>rC(Z,se)}),S&&n.jsx(v.Suspense,{fallback:null,children:n.jsx(sC,{open:S,onClose:()=>N(!1),commands:Ue})}),n.jsx(Jw,{open:ne,projects:(te==null?void 0:te.projects)??[],onSwitch:Z=>{q(Z)},onClose:()=>F(!1)}),n.jsx(eC,{open:me,onClose:()=>D(!1),initialMode:K,isClaudeCode:R==="claude-code",projectRoot:(B==null?void 0:B.path)??(p==null?void 0:p.projectName)??""})]})}const ov="vskill.migrations.scope-rename.v1",cC={own:"authoring-project",installed:"available-project",global:"available-personal"},uC=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function dC(a){if(a.getItem(ov)==="done")return;const r=[];for(let i=0;i<a.length;i++){const o=a.key(i);if(!o)continue;const u=o.match(uC);if(!u)continue;const[,p,f]=u,h=cC[f];if(!h)continue;const x=a.getItem(o);x!==null&&r.push({oldKey:o,newKey:`vskill-sidebar-${p}-${h}-collapsed`,value:x})}for(const{oldKey:i,newKey:o,value:u}of r)a.getItem(o)===null&&a.setItem(o,u),a.removeItem(i);a.setItem(ov,"done")}if(typeof PerformanceObserver<"u")try{const a=new PerformanceObserver(r=>{for(const i of r.getEntries())if(i.name==="first-contentful-paint"){window.__vskillPaint=i.startTime,a.disconnect();return}});a.observe({type:"paint",buffered:!0})}catch{}if(typeof window<"u"&&window.localStorage)try{dC(window.localStorage)}catch{}F1.createRoot(document.getElementById("root")).render(n.jsx(v.StrictMode,{children:n.jsx(S0,{children:n.jsx(iC,{})})}));export{n as j,v as r,J as s};
|
|
90
|
+
}`})]}),document.body)}function zw({agent:a,focused:r,active:i,onClick:o}){const u=a.health==="ok"?"var(--color-ok, #22c55e)":a.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return n.jsxs("button",{type:"button","data-testid":"agent-scope-row","data-agent-id":a.id,"data-active":i?"true":"false",onClick:o,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",border:"none",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:u,flexShrink:0}}),n.jsx("span",{style:{flex:1,fontSize:13},children:a.displayName}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[a.installedCount,"·",a.globalCount]})]})}function Lw({row:a,onFocus:r}){return n.jsxs("button",{type:"button","data-testid":"agent-scope-shared-folder-row",onClick:r,style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"100%",padding:"8px 14px",background:"transparent",border:"none",borderTop:"1px dashed var(--border-subtle)",borderBottom:"1px dashed var(--border-subtle)",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:a.sharedFolderPath}),n.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[a.consumers.map(i=>n.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"color-mix(in srgb, var(--color-global) 20%, transparent)",color:"var(--text-primary)"},children:i.id},i.id)),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",a.combinedCount," skills"]})]})]})}function Dw({agent:a,onSetUp:r}){return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),n.jsx("span",{style:{flex:1},children:a.displayName}),a.isRemoteOnly?n.jsx("span",{"data-testid":`agent-scope-remote-badge-${a.id}`,"aria-label":"Remote-only agent",style:{background:"color-mix(in srgb, var(--text-tertiary) 18%, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:10,padding:"1px 8px",color:"var(--text-secondary)",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Remote"}):n.jsx("button",{type:"button","data-testid":`agent-scope-set-up-${a.id}`,onClick:r,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",fontSize:11,cursor:"pointer"},children:J.scopePicker.setUpCta(a.displayName)})]})}function _w({agent:a,activeAgentId:r,onSwitch:i}){const o=a.id===r,u=a.isRemoteOnly===!0,p=o||u,f=o?"Active":u?"Remote-only":J.scopePicker.switchCta;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.jsxs("div",{children:[n.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:u?"Remote service — no local install":Bw(a.health)})]}),n.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[n.jsx(sd,{label:J.scopePicker.statsInstalled,value:String(a.installedCount)}),n.jsx(sd,{label:J.scopePicker.statsGlobal,value:String(a.globalCount)}),n.jsx(sd,{label:J.scopePicker.statsLastSync,value:a.lastSync?Ow(a.lastSync):"—"})]}),n.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:i,disabled:p,title:u?"This agent has no local CLI to switch to":void 0,style:{alignSelf:"flex-start",padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:p?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:p?"default":"pointer",opacity:p?.5:1},children:f})]})}function sd({label:a,value:r}){return n.jsxs(n.Fragment,{children:[n.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:a}),n.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:r})]})}function lv(){return n.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function Ow(a){try{const r=new Date(a).getTime(),i=Date.now()-r;if(Number.isNaN(r))return"—";const o=Math.round(i/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const u=Math.round(o/60);return u<24?`${u}h ago`:`${Math.round(u/24)}d ago`}catch{return"—"}}function Bw(a){switch(a){case"ok":return J.scopePicker.statsHealthOk;case"stale":return J.scopePicker.statsHealthStale;case"missing":return J.scopePicker.statsHealthMissing}}function Iw(a){const r=new Map;for(const i of a.sharedFolders??[])for(const o of i.consumers)r.set(o,i);return a.agents.map(i=>{const o=r.get(i.id);return{id:i.id,displayName:i.displayName,presence:i.detected?"detected":"absent",installedCount:i.localSkillCount,globalCount:i.globalSkillCount,lastSync:i.lastSync,health:i.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:i.isRemoteOnly}})}function Hw({agents:a,activeAgentId:r,onActiveAgentChange:i,onOpenSetup:o}){const[u,p]=v.useState(!1),[f,h]=v.useState(null),x=v.useRef(null),m=v.useMemo(()=>a.find(S=>S.id===r)??a[0]??null,[a,r]),y=v.useMemo(()=>m?m.health==="ok"?"var(--color-ok, #22c55e)":m.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[m]),g=v.useCallback(()=>{var S;p(!1),(S=x.current)==null||S.focus()},[]),j=v.useCallback(S=>{i(S),p(!1)},[i]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:x,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":u,onClick:()=>p(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),p(!0))},style:{display:"flex",alignItems:"center",gap:10,height:"40px",width:"100%",padding:"0 14px",background:"var(--bg-surface, var(--surface-1))",border:"none",borderBottom:"1px solid var(--border-default, var(--border-subtle))",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,textAlign:"left",position:"sticky",top:0,zIndex:2},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),n.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(m==null?void 0:m.displayName)??"Select agent"}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:["(",(m==null?void 0:m.installedCount)??0," · ",(m==null?void 0:m.globalCount)??0,")"]}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),u&&n.jsx(Mw,{agents:a,activeAgentId:r,focusedAgentId:f??r,onFocusAgent:h,onSwitch:j,onOpenSetup:S=>{o(S),g()},onClose:g})]})}const kg="vskill-ccode-banner-dismissed",Uw=new Set(["claude-cli","claude-code"]);function Vw(){try{return sessionStorage.getItem(kg)==="true"}catch{return!1}}function $w(){try{sessionStorage.setItem(kg,"true")}catch{}}function Gw({activeAgentId:a}){const[r,i]=v.useState(()=>Vw()),o=v.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),u=v.useCallback(()=>{$w(),i(!0)},[]);return!a||!Uw.has(a)||r?null:n.jsxs("div",{"data-testid":"claude-code-first-use-banner",role:"note","aria-label":"Claude Code subscription info",style:{display:"flex",alignItems:"flex-start",gap:10,padding:"8px 12px",borderBottom:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",lineHeight:1.45},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("span",{children:[J.claudeCodeLabel.firstUseBanner," "]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:J.claudeCodeLabel.learnMore})]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:u,"aria-label":"Dismiss Claude Code info banner",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1,padding:2,flexShrink:0},children:"×"})]})}function Pw(){const[a,r]=v.useState(null),[i,o]=v.useState("loading"),[u,p]=v.useState(null),f=v.useCallback(async()=>{try{const h=await Ne.getAgents();r(h),o("ready"),p(null)}catch(h){o("error"),p(h.message)}},[]);return v.useEffect(()=>{f()},[f]),v.useEffect(()=>{const h=()=>void f();return window.addEventListener("studio:agent-changed",h),()=>window.removeEventListener("studio:agent-changed",h)},[f]),{status:i,response:a,error:u,refresh:()=>void f()}}const eo="workspace",qw=["skills","agents"];async function Yw(){const a=await fetch("/api/workspace");if(!a.ok)throw new Error(`GET /api/workspace failed: ${a.status}`);return await a.json()}async function Fw(a){const r=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/active failed: ${r.status}`)}return await r.json()}async function Ww(a){const r=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/projects failed: ${r.status}`)}return await r.json()}async function Kw(a){const r=await fetch(`/api/workspace/projects/${encodeURIComponent(a)}`,{method:"DELETE"});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`DELETE /api/workspace/projects/${a} failed: ${r.status}`)}return await r.json()}function id(){for(const a of qw)Xn(a)}function Xw(){const{data:a,loading:r,error:i,revalidate:o}=zs(eo,Yw),u=a,p=u==null?void 0:u.projects.find(m=>m.id===u.activeProjectId),f=v.useCallback(async m=>{await Fw(m),Xn(eo),id()},[]),h=v.useCallback(async m=>{await Ww(m),Xn(eo),id()},[]),x=v.useCallback(async m=>{await Kw(m),Xn(eo),id()},[]);return{workspace:u,activeProject:p,loading:r,error:i,switchProject:f,addProject:h,removeProject:x,revalidate:o}}function Qw({workspace:a,onSwitch:r,onAdd:i,onRemove:o,isPathStale:u}){const[p,f]=v.useState(!1),[h,x]=v.useState(!1),[m,y]=v.useState(""),[g,j]=v.useState(null),[S,N]=v.useState(null),L=v.useRef(null),T=(a==null?void 0:a.projects)??[],k=T.find(A=>A.id===(a==null?void 0:a.activeProjectId));v.useEffect(()=>{if(!p)return;function A(U){L.current&&!L.current.contains(U.target)&&(f(!1),x(!1),j(null))}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[p]);async function M(){j(null);const A=m.trim();if(!A){j("Enter an absolute project path");return}try{await i({path:A}),y(""),x(!1)}catch(U){j(U instanceof Error?U.message:String(U))}}async function O(){if(j(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const A=await window.showDirectoryPicker();y(A.name),x(!0)}catch{}else x(!0)}function V(A){if(A.length<=50)return A;const U=A.split("/");return U.length<=4?A:`${U.slice(0,3).join("/")}/…/${U.slice(-2).join("/")}`}return n.jsxs("div",{ref:L,"data-vskill-project-picker":!0,style:{position:"relative",display:"inline-block"},children:[n.jsxs("button",{type:"button",onClick:()=>f(A=>!A),"aria-expanded":p,"aria-haspopup":"menu",title:(k==null?void 0:k.path)??"No project selected",style:{display:"flex",alignItems:"center",gap:8,padding:"4px 10px",border:"1px solid transparent",borderRadius:6,background:p?"var(--surface-2, rgba(0,0,0,0.05))":"transparent",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-primary)",transition:"background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,backgroundColor:(k==null?void 0:k.colorDot)??"var(--text-tertiary, #999)"}}),n.jsx("span",{style:{maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k?k.name:"No project"}),n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary, #999)",marginLeft:2},children:p?"▴":"▾"})]}),p&&n.jsxs("div",{role:"menu","aria-label":"Switch project",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:280,maxWidth:420,width:"max-content",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:8,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 10px 20px -5px rgba(0,0,0,0.12)",overflow:"hidden",zIndex:50,fontFamily:"var(--font-sans)"},children:[T.length===0&&n.jsx("div",{style:{padding:"16px 16px 12px",fontSize:12,color:"var(--text-tertiary)",lineHeight:1.5},children:"No projects registered. Add one to get started."}),T.length>0&&n.jsx("ul",{role:"none",style:{listStyle:"none",margin:0,padding:4,maxHeight:320,overflowY:"auto"},children:T.map(A=>{const U=u?u(A.path):!1,w=A.id===(a==null?void 0:a.activeProjectId),D=S===A.id;return n.jsxs("li",{role:"menuitem","data-stale":U?"true":"false",onMouseEnter:()=>N(A.id),onMouseLeave:()=>N(R=>R===A.id?null:R),onClick:()=>{U||(r(A.id),f(!1))},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:U?"not-allowed":"pointer",background:D&&!U?"var(--surface-2, rgba(0,0,0,0.04))":w?"var(--surface-1, rgba(0,0,0,0.02))":"transparent",opacity:U?.5:1,transition:"background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{width:10,height:10,borderRadius:"50%",flexShrink:0,backgroundColor:A.colorDot,boxShadow:w?"0 0 0 2px color-mix(in oklch, currentColor 20%, transparent)":"none"}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,fontWeight:w?600:500,color:"var(--text-primary)",lineHeight:1.3},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.name}),w&&n.jsx("span",{"aria-label":"Active",style:{fontSize:10,color:"var(--color-accent, #2f6f8f)",letterSpacing:"0.05em",textTransform:"uppercase",fontWeight:600},children:"Active"})]}),n.jsx("div",{title:A.path,style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:V(A.path)}),U&&n.jsx("div",{style:{fontSize:10,color:"var(--color-own, #b45309)",marginTop:2},children:"Path no longer exists"})]}),n.jsx("button",{type:"button","aria-label":`Remove ${A.name}`,onClick:R=>{R.stopPropagation(),o(A.id)},style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",color:"var(--text-tertiary)",opacity:D?1:0,transition:"opacity 120ms ease, color 120ms ease, background-color 120ms ease",flexShrink:0},onMouseEnter:R=>{R.currentTarget.style.color="var(--color-error, #b91c1c)",R.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-error, #b91c1c) 10%, transparent)"},onMouseLeave:R=>{R.currentTarget.style.color="var(--text-tertiary)",R.currentTarget.style.backgroundColor="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),n.jsx("path",{d:"M10 11v6"}),n.jsx("path",{d:"M14 11v6"}),n.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})})]},A.id)})}),n.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:h?8:6},children:[!h&&n.jsxs("button",{type:"button",onClick:()=>void O(),className:"vskill-project-add",style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 10px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,color:"var(--color-accent, #2f6f8f)",transition:"background-color 120ms ease"},onMouseEnter:A=>{A.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-accent, #2f6f8f) 10%, transparent)"},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="transparent"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add project"]}),h&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[n.jsx("input",{type:"text",value:m,onChange:A=>y(A.target.value),onKeyDown:A=>{A.key==="Enter"&&M(),A.key==="Escape"&&(x(!1),j(null))},placeholder:"/absolute/path/to/project",autoFocus:!0,style:{width:"100%",padding:"6px 8px",fontFamily:"var(--font-mono)",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),n.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[n.jsx("button",{type:"button",onClick:()=>{x(!1),j(null),y("")},style:{padding:"4px 10px",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Cancel"}),n.jsx("button",{type:"button",onClick:()=>void M(),style:{padding:"4px 10px",fontSize:12,border:"none",borderRadius:4,background:"var(--color-accent, #2f6f8f)",color:"var(--color-paper, #fff)",cursor:"pointer",fontWeight:500},children:"Add"})]}),g&&n.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:g})]})]})]})]})}function Zw(a,r){const i=r.trim().toLowerCase().split(/\s+/).filter(Boolean);return i.length===0?a:a.filter(o=>{const u=`${o.name} ${o.path}`.toLowerCase();return i.every(p=>u.includes(p))})}function Jw({open:a,projects:r,onSwitch:i,onClose:o}){const[u,p]=v.useState(""),[f,h]=v.useState(0),x=v.useMemo(()=>Zw(r,u),[r,u]);v.useEffect(()=>{a||(p(""),h(0))},[a]),v.useEffect(()=>{f>=x.length&&h(0)},[x.length,f]);const m=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),h(g=>Math.min(g+1,Math.max(x.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),h(g=>Math.max(g-1,0));return}if(y.key==="Enter"){y.preventDefault();const g=x[f];g&&(i(g.id),o())}};return a?n.jsxs("div",{role:"dialog","aria-modal":"true","data-vskill-project-palette":!0,className:"vskill-project-palette fixed inset-0 z-50 flex items-start justify-center pt-24",children:[n.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),n.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[n.jsx("input",{type:"text",autoFocus:!0,value:u,onChange:y=>p(y.target.value),onKeyDown:m,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),n.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[x.length===0&&n.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),x.map((y,g)=>n.jsxs("li",{role:"option","aria-selected":g===f,"data-highlighted":g===f,className:["flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",g===f?"bg-muted":""].join(" "),onMouseEnter:()=>h(g),onClick:()=>{i(y.id),o()},children:[n.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),n.jsxs("span",{className:"flex-1",children:[n.jsx("span",{className:"vskill-palette-name",children:y.name}),n.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const rv=/^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;function eC({open:a,onClose:r,initialMode:i="standalone",isClaudeCode:o,projectRoot:u,onCreated:p}){const[f,h]=v.useState("destination"),[x,m]=v.useState(i),[y,g]=v.useState(""),[j,S]=v.useState(""),[N,L]=v.useState(""),[T,k]=v.useState([]),[M,O]=v.useState(!1),[V,A]=v.useState(null);if(v.useEffect(()=>{a&&(h("destination"),m(i),g(""),S(""),L(""),A(null))},[a,i]),v.useEffect(()=>{if(!a)return;let z=!0;return fetch("/api/authoring/plugins").then(E=>E.json()).then(E=>{z&&k(E.plugins??[])}).catch(()=>{}),()=>{z=!1}},[a]),v.useEffect(()=>{if(!a)return;function z(E){E.key==="Escape"&&(E.preventDefault(),r())}return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[a,r]),!a)return null;const U=T.length>0,w=o&&U,D=o,R=rv.test(y),I=x==="existing-plugin"?j.length>0:rv.test(j),G=!M&&R&&(x==="standalone"||I),q=tC(u,x,j,y);function te(){const z=new URLSearchParams;z.set("mode",x),z.set("skillName",y),N.trim()&&z.set("description",N.trim()),j&&z.set("pluginName",j);const E=`/#/create?${z.toString()}`;typeof window<"u"&&window.location.assign(E),r()}async function Q(){A(null),O(!0);try{const z=await fetch("/api/authoring/create-skill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:x,skillName:y,description:N.trim()||void 0,pluginName:x==="standalone"?void 0:j})}),E=await z.json();if(!z.ok||!E.ok){A(E.error??`Create failed: ${z.status}`);return}Xn("skills"),p==null||p({mode:x,skillName:y,pluginName:E.pluginName??null,skillMdPath:E.skillMdPath}),r()}catch(z){A(z instanceof Error?z.message:String(z))}finally{O(!1)}}return n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Create skill","data-vskill-create-skill-modal":!0,style:{position:"fixed",inset:0,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},children:[n.jsx("div",{onClick:r,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),n.jsxs("div",{style:{position:"relative",width:"min(560px, 92vw)",maxHeight:"86vh",overflow:"auto",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[n.jsx("h2",{style:{margin:0,fontSize:16,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",letterSpacing:"0.01em"},children:f==="destination"?"Create a skill":"Name and describe"}),n.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:["Step ",f==="destination"?"1":"2"," of 2"]})]}),f==="destination"&&n.jsxs("div",{style:{padding:14,display:"flex",flexDirection:"column",gap:10},children:[n.jsx(od,{title:"Standalone skill",subtitle:"A single skill in this project",description:"Lives at <project>/skills/<name>/SKILL.md. Works with every agent.",icon:"📄",selected:x==="standalone",onClick:()=>m("standalone")}),n.jsx(od,{title:"Add to existing plugin",subtitle:w?`${T.length} plugin source${T.length===1?"":"s"} in this project`:o?"No plugin sources in this project yet":"Claude Code only",description:"Appends a skill to an existing <plugin>/.claude-plugin/plugin.json source.",icon:"🧩",disabled:!w,selected:x==="existing-plugin",onClick:()=>w&&m("existing-plugin")}),n.jsx(od,{title:"New plugin",subtitle:D?"Bundles one or more skills for distribution":"Claude Code only",description:"Scaffolds <plugin>/.claude-plugin/plugin.json and its first skill.",icon:"📦",disabled:!D,selected:x==="new-plugin",onClick:()=>D&&m("new-plugin")})]}),f==="details"&&n.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:12},children:[x==="new-plugin"&&n.jsx(to,{label:"Plugin name",hint:"kebab-case",children:n.jsx("input",{type:"text",value:j,onChange:z=>S(z.target.value.trim()),placeholder:"my-first-plugin",autoFocus:!0,style:no(!j||I)})}),x==="existing-plugin"&&n.jsx(to,{label:"Plugin",children:n.jsxs("select",{value:j,onChange:z=>S(z.target.value),style:{...no(!0),fontFamily:"var(--font-mono)"},children:[n.jsx("option",{value:"",children:"Select a plugin…"}),T.map(z=>n.jsx("option",{value:z.name,children:z.name},z.path))]})}),n.jsx(to,{label:"Skill name",hint:"kebab-case",children:n.jsx("input",{type:"text",value:y,onChange:z=>g(z.target.value.trim()),placeholder:"my-new-skill",autoFocus:x!=="new-plugin",style:no(!y||R)})}),n.jsx(to,{label:"Description",hint:"One short sentence — shown in frontmatter",children:n.jsx("textarea",{value:N,onChange:z=>L(z.target.value),rows:2,placeholder:"Does a thing when Claude needs X",style:{...no(!0),resize:"vertical",minHeight:52,fontFamily:"var(--font-sans)"}})}),q&&n.jsxs("div",{style:{padding:"8px 10px",fontSize:11,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",background:"var(--surface-1, rgba(0,0,0,0.03))",border:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",borderRadius:4,wordBreak:"break-all"},children:[n.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:2,fontFamily:"var(--font-sans)"},children:"Will create:"}),q.map((z,E)=>n.jsx("div",{children:z},E))]}),V&&n.jsx("div",{style:{fontSize:12,color:"var(--color-error, #b91c1c)",padding:"6px 10px",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:V})]}),n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 16px",borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",background:"var(--surface-1, rgba(0,0,0,0.02))"},children:[n.jsx("button",{type:"button",onClick:r,style:cd,children:"Cancel"}),f==="destination"&&n.jsx("button",{type:"button",onClick:()=>h("details"),style:sv,children:"Continue →"}),f==="details"&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>h("destination"),style:cd,children:"← Back"}),n.jsx("button",{type:"button",onClick:te,disabled:!G,style:{...cd,opacity:G?1:.5,cursor:G?"pointer":"not-allowed"},title:"Opens the AI generation flow with this destination pre-selected (choose Claude Code, Anthropic API, OpenRouter, or local models)",children:"✨ Generate with AI"}),n.jsx("button",{type:"button",onClick:()=>void Q(),disabled:!G,style:{...sv,opacity:G?1:.5,cursor:G?"pointer":"not-allowed"},title:"Creates an empty SKILL.md scaffold you can fill in by hand",children:M?"Creating…":"Create empty scaffold"})]})]})]})]})}function od({title:a,subtitle:r,description:i,icon:o,selected:u,disabled:p,onClick:f}){return n.jsxs("button",{type:"button",onClick:f,disabled:p,"aria-pressed":u,style:{display:"flex",gap:12,padding:"12px 14px",textAlign:"left",borderRadius:8,border:u?"2px solid var(--color-accent, #2f6f8f)":"1px solid var(--border-default, rgba(0,0,0,0.12))",background:u?"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))":p?"var(--surface-1, rgba(0,0,0,0.02))":"var(--color-paper, #fff)",color:p?"var(--text-tertiary)":"var(--text-primary)",cursor:p?"not-allowed":"pointer",opacity:p?.6:1,fontFamily:"inherit",width:"100%",transition:"border-color 120ms ease, background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:22,lineHeight:1,marginTop:2},children:o}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsx("div",{style:{fontSize:14,fontWeight:600,lineHeight:1.3},children:a}),n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:2,textTransform:"uppercase",letterSpacing:"0.04em"},children:r}),n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:6,lineHeight:1.5},children:i})]})]})}function to({label:a,hint:r,children:i}){return n.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[n.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[n.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:a}),r&&n.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:r})]}),i]})}function no(a){return{width:"100%",padding:"7px 10px",fontSize:13,fontFamily:"var(--font-mono)",border:`1px solid ${a?"var(--border-default, rgba(0,0,0,0.12))":"var(--color-error, #b91c1c)"}`,borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none",boxSizing:"border-box"}}const sv={padding:"7px 14px",fontSize:13,fontWeight:500,border:"none",borderRadius:6,background:"var(--color-accent, #2f6f8f)",color:"var(--color-paper, #fff)",cursor:"pointer",fontFamily:"inherit"},cd={padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer",fontFamily:"inherit"};function tC(a,r,i,o){const u=o||"<skill-name>",p=i||"<plugin-name>",f=a||"<project>";return r==="standalone"?[`${f}/skills/${u}/SKILL.md`]:r==="existing-plugin"?[`${f}/${p}/skills/${u}/SKILL.md`]:r==="new-plugin"?[`${f}/${p}/.claude-plugin/plugin.json`,`${f}/${p}/skills/${u}/SKILL.md`]:null}const wg="vskill.studio.prefs";function Cg(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function Ng(){const a=Cg();if(!a)return{};try{const r=a.getItem(wg);if(!r)return{};const i=JSON.parse(r);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return{}}}function nC(a,r){const i=Cg();if(i)try{const u={...Ng(),[a]:r};i.setItem(wg,JSON.stringify(u))}catch{}}function aC(a,r){const o=Ng()[a];return o===void 0?r:o}const iv={open:!1,x:0,y:0,skill:null};function lC(a,r){return{open:!0,x:a.clientX,y:a.clientY,skill:r}}function xl(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function rC(a,r){var i;switch(a){case"copy-path":try{(i=navigator.clipboard)==null||i.writeText(r.dir)}catch{xl(J.toasts.permissionDenied,"error");return}xl(J.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":xl(J.actions.editPlaceholder,"info");return;case"run-benchmark":xl(J.toasts.benchmarkQueued,"info");return;case"duplicate":xl(J.toasts.skillDuplicated,"info");return;case"update":xl(J.toasts.skillUpdated,"info");return;case"uninstall":xl(J.actions.editPlaceholder,"info");return;default:return}}const sC=v.lazy(()=>Nd(()=>import("./CommandPalette-BX_VfD47.js"),__vite__mapDeps([2,1])));function iC(){return n.jsx(xb,{children:n.jsx(pb,{children:n.jsxs(sw,{children:[n.jsx(oC,{}),n.jsx(xw,{})]})})})}function oC(){var Le,ae;const{state:a,selectSkill:r,clearSelection:i,refreshSkills:o,outdatedByOrigin:u}=ya(),{config:p}=bl(),{mode:f,resolvedTheme:h,setTheme:x}=xv(),{toast:m}=Pd(),[y,g]=v.useState(()=>M2()),[j]=v.useState(!0),[S,N]=v.useState(!1),[L,T]=v.useState(!1),[k,M]=v.useState(!1),[O,V]=v.useState("overview"),[A,U]=v.useState(iv),w=v.useCallback((Z,se)=>{U(lC(Z,se))},[]),D=Pw(),[R,I]=v.useState(()=>aC("activeAgent",null));v.useEffect(()=>{var Z;!R&&((Z=D.response)!=null&&Z.suggested)&&I(D.response.suggested)},[R,(Le=D.response)==null?void 0:Le.suggested]);const G=v.useCallback(Z=>{I(Z),nC("activeAgent",Z),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:Z}}))},[]),q=v.useMemo(()=>D.response?Iw(D.response):[],[D.response]),{workspace:te,switchProject:Q,addProject:z,removeProject:E,activeProject:B}=Xw(),[ne,Y]=v.useState(!1),[me,_]=v.useState(!1),[W,oe]=v.useState("standalone"),fe=v.useCallback((Z="standalone")=>{oe(Z),_(!0)},[]);v.useEffect(()=>{function Z(se){if(!(se instanceof CustomEvent))return;const ue=se.detail;fe((ue==null?void 0:ue.mode)??"standalone")}return window.addEventListener("studio:request-create-skill",Z),()=>window.removeEventListener("studio:request-create-skill",Z)},[fe]),gd([{key:"p",meta:!0,handler:Z=>{var ue;const se=typeof document<"u"?document.activeElement:null;se&&se.tagName==="INPUT"||((ue=Z==null?void 0:Z.preventDefault)==null||ue.call(Z),Y(ge=>!ge))}}],{enabled:!0});const he=Rw();v.useEffect(()=>{function Z(se){if(!(se instanceof CustomEvent))return;const ue=se.detail;ue!=null&&ue.provider&&he.open(ue.provider)}return window.addEventListener("studio:open-setup-drawer",Z),()=>window.removeEventListener("studio:open-setup-drawer",Z)},[he]);const xe=v.useCallback(()=>{U(iv)},[]);v.useEffect(()=>{function Z(se){if(!(se instanceof CustomEvent))return;const ue=se.detail;ue!=null&&ue.message&&m({message:ue.message,severity:ue.severity??"info"})}return window.addEventListener("studio:toast",Z),()=>window.removeEventListener("studio:toast",Z)},[m]),v.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${y}px`)},[y]);const ke=v.useMemo(()=>a.selectedSkill?a.skills.find(Z=>Z.plugin===a.selectedSkill.plugin&&Z.skill===a.selectedSkill.skill)??null:null,[a.skills,a.selectedSkill]),ce=v.useCallback(Z=>{r({plugin:Z.plugin,skill:Z.skill,origin:Z.origin})},[r]),je=v.useMemo(()=>{if(!a.selectedSkill)return"";const Z=a.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${a.selectedSkill.skill} (${Z})`},[a.selectedSkill]),Ue=v.useMemo(()=>[{id:"switch-theme",label:J.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>x(f==="light"?"dark":f==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>M(Z=>!Z)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>T(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[f,x,o]);return gd([{key:"cmd+k",handler:()=>N(Z=>!Z)},{key:"ctrl+k",handler:()=>N(Z=>!Z)},{key:"?",handler:()=>T(Z=>!Z)},{key:"cmd+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"cmd+b",handler:()=>M(Z=>!Z)},{key:"ctrl+b",handler:()=>M(Z=>!Z)},{key:"e",handler:()=>m({message:J.actions.editPlaceholder,severity:"info"})}]),n.jsxs(n.Fragment,{children:[n.jsx(vb,{sidebarWidth:y,sidebarHidden:k||a.isMobile&&a.mobileView==="detail",banner:n.jsx(D2,{connected:j}),liveMessage:je,topRail:n.jsx(x0,{projectName:(p==null?void 0:p.projectName)??null,selected:a.selectedSkill,onOpenPalette:()=>N(!0),onHome:i,onRequestCreateSkill:()=>fe("standalone"),projectPickerSlot:te&&te.projects.length>0?n.jsx(Qw,{workspace:te,onSwitch:Q,onAdd:z,onRemove:E}):void 0}),sidebar:n.jsx(k2,{skills:a.skills,selectedKey:a.selectedSkill?{plugin:a.selectedSkill.plugin,skill:a.selectedSkill.skill}:null,onSelect:ce,isLoading:a.skillsLoading,error:a.skillsError??null,onRetry:o,onContextMenu:w,outdatedByOrigin:u,activeAgentId:R,topSlot:D.status==="ready"&&q.length>0?n.jsxs(n.Fragment,{children:[n.jsx(Hw,{agents:q,activeAgentId:R,onActiveAgentChange:G,onOpenSetup:Z=>he.open(Z)}),n.jsx(Gw,{activeAgentId:R})]}):null}),resizeHandle:n.jsx(L2,{initialWidth:y??js,onChange:g}),main:n.jsx(cw,{selectedSkillInfo:ke,activeDetailTab:O,onDetailTabChange:V,allSkills:a.skills,onSelectSkill:ce}),statusBar:n.jsx(E0,{projectPath:(p==null?void 0:p.root)??null,modelName:(p==null?void 0:p.model)??null,health:p!=null&&p.error?"degraded":"ok",providers:(ae=p==null?void 0:p.providers)==null?void 0:ae.map(Z=>{const se=Z.id;return{id:se,label:Z.label,available:Z.available,kind:se==="ollama"||se==="lm-studio"?"start-service":se==="anthropic"||se==="openrouter"?"api-key":"cli-install"}})})}),n.jsx(gw,{open:L,onClose:()=>T(!1)}),n.jsx(kw,{open:he.isOpen,providerKey:he.providerKey,onClose:he.close}),n.jsx(bw,{state:A,onClose:xe,onAction:(Z,se)=>rC(Z,se)}),S&&n.jsx(v.Suspense,{fallback:null,children:n.jsx(sC,{open:S,onClose:()=>N(!1),commands:Ue})}),n.jsx(Jw,{open:ne,projects:(te==null?void 0:te.projects)??[],onSwitch:Z=>{Q(Z)},onClose:()=>Y(!1)}),n.jsx(eC,{open:me,onClose:()=>_(!1),initialMode:W,isClaudeCode:R==="claude-code",projectRoot:(B==null?void 0:B.path)??(p==null?void 0:p.projectName)??""})]})}const ov="vskill.migrations.scope-rename.v1",cC={own:"authoring-project",installed:"available-project",global:"available-personal"},uC=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function dC(a){if(a.getItem(ov)==="done")return;const r=[];for(let i=0;i<a.length;i++){const o=a.key(i);if(!o)continue;const u=o.match(uC);if(!u)continue;const[,p,f]=u,h=cC[f];if(!h)continue;const x=a.getItem(o);x!==null&&r.push({oldKey:o,newKey:`vskill-sidebar-${p}-${h}-collapsed`,value:x})}for(const{oldKey:i,newKey:o,value:u}of r)a.getItem(o)===null&&a.setItem(o,u),a.removeItem(i);a.setItem(ov,"done")}if(typeof PerformanceObserver<"u")try{const a=new PerformanceObserver(r=>{for(const i of r.getEntries())if(i.name==="first-contentful-paint"){window.__vskillPaint=i.startTime,a.disconnect();return}});a.observe({type:"paint",buffered:!0})}catch{}if(typeof window<"u"&&window.localStorage)try{dC(window.localStorage)}catch{}F1.createRoot(document.getElementById("root")).render(n.jsx(v.StrictMode,{children:n.jsx(S0,{children:n.jsx(iC,{})})}));export{n as j,v as r,J as s};
|