vskill 0.5.85 → 0.5.87
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/README.md +11 -3
- package/dist/agents/agents-registry.d.ts +5 -0
- package/dist/agents/agents-registry.js.map +1 -1
- package/dist/eval/env.d.ts +18 -0
- package/dist/eval/env.js +74 -0
- package/dist/eval/env.js.map +1 -0
- package/dist/eval/llm.js +22 -6
- package/dist/eval/llm.js.map +1 -1
- package/dist/eval/path-utils.d.ts +24 -0
- package/dist/eval/path-utils.js +72 -0
- package/dist/eval/path-utils.js.map +1 -0
- package/dist/eval/skill-scanner.d.ts +30 -0
- package/dist/eval/skill-scanner.js +192 -12
- package/dist/eval/skill-scanner.js.map +1 -1
- package/dist/eval-server/api-routes.d.ts +80 -0
- package/dist/eval-server/api-routes.js +442 -20
- package/dist/eval-server/api-routes.js.map +1 -1
- package/dist/eval-server/settings-store.d.ts +39 -0
- package/dist/eval-server/settings-store.js +195 -0
- package/dist/eval-server/settings-store.js.map +1 -0
- package/dist/eval-server/studio-json.d.ts +9 -0
- package/dist/eval-server/studio-json.js +82 -0
- package/dist/eval-server/studio-json.js.map +1 -0
- package/dist/eval-ui/assets/{CommandPalette-BAcN6Jji.js → CommandPalette-BmFgVfCB.js} +1 -1
- package/dist/eval-ui/assets/UpdateDropdown-DyH9TWvR.js +1 -0
- package/dist/eval-ui/assets/index-C4XKAX1s.css +1 -0
- package/dist/eval-ui/assets/index-DQDnt_gJ.js +89 -0
- package/dist/eval-ui/index.html +2 -2
- package/package.json +1 -1
- package/dist/eval-ui/assets/index-D6Rb5362.js +0 -76
- package/dist/eval-ui/assets/index-EnxOcJMr.css +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-DyH9TWvR.js","assets/fonts-i7Lkz2zN.css","assets/CommandPalette-BmFgVfCB.js"])))=>i.map(i=>d[i]);
|
|
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 m of u)if(m.type==="childList")for(const f of m.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function i(u){const m={};return u.integrity&&(m.integrity=u.integrity),u.referrerPolicy&&(m.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?m.credentials="include":u.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function o(u){if(u.ep)return;u.ep=!0;const m=i(u);fetch(u.href,m)}})();function Kx(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Ru={exports:{}},us={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.production.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var Ah;function N1(){if(Ah)return us;Ah=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(o,u,m){var f=null;if(m!==void 0&&(f=""+m),u.key!==void 0&&(f=""+u.key),"key"in u){m={};for(var h in u)h!=="key"&&(m[h]=u[h])}else m=u;return u=m.ref,{$$typeof:a,type:o,key:f,ref:u!==void 0?u:null,props:m}}return us.Fragment=r,us.jsx=i,us.jsxs=i,us}var Mh;function E1(){return Mh||(Mh=1,Ru.exports=N1()),Ru.exports}var n=E1(),Au={exports:{}},ze={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var Dh;function T1(){if(Dh)return ze;Dh=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"),m=Symbol.for("react.consumer"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),j=Symbol.iterator;function S(T){return T===null||typeof T!="object"?null:(T=j&&T[j]||T["@@iterator"],typeof T=="function"?T:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,E={};function N(T,Y,ae){this.props=T,this.context=Y,this.refs=E,this.updater=ae||C}N.prototype.isReactComponent={},N.prototype.setState=function(T,Y){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,Y,"setState")},N.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function M(){}M.prototype=N.prototype;function _(T,Y,ae){this.props=T,this.context=Y,this.refs=E,this.updater=ae||C}var I=_.prototype=new M;I.constructor=_,z(I,N.prototype),I.isPureReactComponent=!0;var L=Array.isArray;function $(){}var w={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function R(T,Y,ae){var fe=ae.ref;return{$$typeof:a,type:T,key:Y,ref:fe!==void 0?fe:null,props:ae}}function U(T,Y){return R(T.type,Y,T.props)}function q(T){return typeof T=="object"&&T!==null&&T.$$typeof===a}function F(T){var Y={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(ae){return Y[ae]})}var te=/\/+/g;function Q(T,Y){return typeof T=="object"&&T!==null&&T.key!=null?F(""+T.key):Y.toString(36)}function O(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then($,$):(T.status="pending",T.then(function(Y){T.status==="pending"&&(T.status="fulfilled",T.value=Y)},function(Y){T.status==="pending"&&(T.status="rejected",T.reason=Y)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function A(T,Y,ae,fe,ve){var he=typeof T;(he==="undefined"||he==="boolean")&&(T=null);var Ce=!1;if(T===null)Ce=!0;else switch(he){case"bigint":case"string":case"number":Ce=!0;break;case"object":switch(T.$$typeof){case a:case r:Ce=!0;break;case b:return Ce=T._init,A(Ce(T._payload),Y,ae,fe,ve)}}if(Ce)return ve=ve(T),Ce=fe===""?"."+Q(T,0):fe,L(ve)?(ae="",Ce!=null&&(ae=Ce.replace(te,"$&/")+"/"),A(ve,Y,ae,"",function($e){return $e})):ve!=null&&(q(ve)&&(ve=U(ve,ae+(ve.key==null||T&&T.key===ve.key?"":(""+ve.key).replace(te,"$&/")+"/")+Ce)),Y.push(ve)),1;Ce=0;var oe=fe===""?".":fe+":";if(L(T))for(var je=0;je<T.length;je++)fe=T[je],he=oe+Q(fe,je),Ce+=A(fe,Y,ae,he,ve);else if(je=S(T),typeof je=="function")for(T=je.call(T),je=0;!(fe=T.next()).done;)fe=fe.value,he=oe+Q(fe,je++),Ce+=A(fe,Y,ae,he,ve);else if(he==="object"){if(typeof T.then=="function")return A(O(T),Y,ae,fe,ve);throw Y=String(T),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return Ce}function B(T,Y,ae){if(T==null)return T;var fe=[],ve=0;return A(T,fe,"","",function(he){return Y.call(ae,he,ve++)}),fe}function se(T){if(T._status===-1){var Y=T._result;Y=Y(),Y.then(function(ae){(T._status===0||T._status===-1)&&(T._status=1,T._result=ae)},function(ae){(T._status===0||T._status===-1)&&(T._status=2,T._result=ae)}),T._status===-1&&(T._status=0,T._result=Y)}if(T._status===1)return T._result.default;throw T._result}var K=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},pe={map:B,forEach:function(T,Y,ae){B(T,function(){Y.apply(this,arguments)},ae)},count:function(T){var Y=0;return B(T,function(){Y++}),Y},toArray:function(T){return B(T,function(Y){return Y})||[]},only:function(T){if(!q(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return ze.Activity=g,ze.Children=pe,ze.Component=N,ze.Fragment=i,ze.Profiler=u,ze.PureComponent=_,ze.StrictMode=o,ze.Suspense=x,ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,ze.__COMPILER_RUNTIME={__proto__:null,c:function(T){return w.H.useMemoCache(T)}},ze.cache=function(T){return function(){return T.apply(null,arguments)}},ze.cacheSignal=function(){return null},ze.cloneElement=function(T,Y,ae){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var fe=z({},T.props),ve=T.key;if(Y!=null)for(he in Y.key!==void 0&&(ve=""+Y.key),Y)!D.call(Y,he)||he==="key"||he==="__self"||he==="__source"||he==="ref"&&Y.ref===void 0||(fe[he]=Y[he]);var he=arguments.length-2;if(he===1)fe.children=ae;else if(1<he){for(var Ce=Array(he),oe=0;oe<he;oe++)Ce[oe]=arguments[oe+2];fe.children=Ce}return R(T.type,ve,fe)},ze.createContext=function(T){return T={$$typeof:f,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:m,_context:T},T},ze.createElement=function(T,Y,ae){var fe,ve={},he=null;if(Y!=null)for(fe in Y.key!==void 0&&(he=""+Y.key),Y)D.call(Y,fe)&&fe!=="key"&&fe!=="__self"&&fe!=="__source"&&(ve[fe]=Y[fe]);var Ce=arguments.length-2;if(Ce===1)ve.children=ae;else if(1<Ce){for(var oe=Array(Ce),je=0;je<Ce;je++)oe[je]=arguments[je+2];ve.children=oe}if(T&&T.defaultProps)for(fe in Ce=T.defaultProps,Ce)ve[fe]===void 0&&(ve[fe]=Ce[fe]);return R(T,he,ve)},ze.createRef=function(){return{current:null}},ze.forwardRef=function(T){return{$$typeof:h,render:T}},ze.isValidElement=q,ze.lazy=function(T){return{$$typeof:b,_payload:{_status:-1,_result:T},_init:se}},ze.memo=function(T,Y){return{$$typeof:p,type:T,compare:Y===void 0?null:Y}},ze.startTransition=function(T){var Y=w.T,ae={};w.T=ae;try{var fe=T(),ve=w.S;ve!==null&&ve(ae,fe),typeof fe=="object"&&fe!==null&&typeof fe.then=="function"&&fe.then($,K)}catch(he){K(he)}finally{Y!==null&&ae.types!==null&&(Y.types=ae.types),w.T=Y}},ze.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},ze.use=function(T){return w.H.use(T)},ze.useActionState=function(T,Y,ae){return w.H.useActionState(T,Y,ae)},ze.useCallback=function(T,Y){return w.H.useCallback(T,Y)},ze.useContext=function(T){return w.H.useContext(T)},ze.useDebugValue=function(){},ze.useDeferredValue=function(T,Y){return w.H.useDeferredValue(T,Y)},ze.useEffect=function(T,Y){return w.H.useEffect(T,Y)},ze.useEffectEvent=function(T){return w.H.useEffectEvent(T)},ze.useId=function(){return w.H.useId()},ze.useImperativeHandle=function(T,Y,ae){return w.H.useImperativeHandle(T,Y,ae)},ze.useInsertionEffect=function(T,Y){return w.H.useInsertionEffect(T,Y)},ze.useLayoutEffect=function(T,Y){return w.H.useLayoutEffect(T,Y)},ze.useMemo=function(T,Y){return w.H.useMemo(T,Y)},ze.useOptimistic=function(T,Y){return w.H.useOptimistic(T,Y)},ze.useReducer=function(T,Y,ae){return w.H.useReducer(T,Y,ae)},ze.useRef=function(T){return w.H.useRef(T)},ze.useState=function(T){return w.H.useState(T)},ze.useSyncExternalStore=function(T,Y,ae){return w.H.useSyncExternalStore(T,Y,ae)},ze.useTransition=function(){return w.H.useTransition()},ze.version="19.2.4",ze}var zh;function md(){return zh||(zh=1,Au.exports=T1()),Au.exports}var v=md();const ke=Kx(v);var Mu={exports:{}},ds={},Du={exports:{}},zu={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* scheduler.production.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var Lh;function R1(){return Lh||(Lh=1,(function(a){function r(A,B){var se=A.length;A.push(B);e:for(;0<se;){var K=se-1>>>1,pe=A[K];if(0<u(pe,B))A[K]=B,A[se]=pe,se=K;else break e}}function i(A){return A.length===0?null:A[0]}function o(A){if(A.length===0)return null;var B=A[0],se=A.pop();if(se!==B){A[0]=se;e:for(var K=0,pe=A.length,T=pe>>>1;K<T;){var Y=2*(K+1)-1,ae=A[Y],fe=Y+1,ve=A[fe];if(0>u(ae,se))fe<pe&&0>u(ve,ae)?(A[K]=ve,A[fe]=se,K=fe):(A[K]=ae,A[Y]=se,K=Y);else if(fe<pe&&0>u(ve,se))A[K]=ve,A[fe]=se,K=fe;else break e}}return B}function u(A,B){var se=A.sortIndex-B.sortIndex;return se!==0?se:A.id-B.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;a.unstable_now=function(){return m.now()}}else{var f=Date,h=f.now();a.unstable_now=function(){return f.now()-h}}var x=[],p=[],b=1,g=null,j=3,S=!1,C=!1,z=!1,E=!1,N=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function I(A){for(var B=i(p);B!==null;){if(B.callback===null)o(p);else if(B.startTime<=A)o(p),B.sortIndex=B.expirationTime,r(x,B);else break;B=i(p)}}function L(A){if(z=!1,I(A),!C)if(i(x)!==null)C=!0,$||($=!0,F());else{var B=i(p);B!==null&&O(L,B.startTime-A)}}var $=!1,w=-1,D=5,R=-1;function U(){return E?!0:!(a.unstable_now()-R<D)}function q(){if(E=!1,$){var A=a.unstable_now();R=A;var B=!0;try{e:{C=!1,z&&(z=!1,M(w),w=-1),S=!0;var se=j;try{t:{for(I(A),g=i(x);g!==null&&!(g.expirationTime>A&&U());){var K=g.callback;if(typeof K=="function"){g.callback=null,j=g.priorityLevel;var pe=K(g.expirationTime<=A);if(A=a.unstable_now(),typeof pe=="function"){g.callback=pe,I(A),B=!0;break t}g===i(x)&&o(x),I(A)}else o(x);g=i(x)}if(g!==null)B=!0;else{var T=i(p);T!==null&&O(L,T.startTime-A),B=!1}}break e}finally{g=null,j=se,S=!1}B=void 0}}finally{B?F():$=!1}}}var F;if(typeof _=="function")F=function(){_(q)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,Q=te.port2;te.port1.onmessage=q,F=function(){Q.postMessage(null)}}else F=function(){N(q,0)};function O(A,B){w=N(function(){A(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(A){A.callback=null},a.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<A?Math.floor(1e3/A):5},a.unstable_getCurrentPriorityLevel=function(){return j},a.unstable_next=function(A){switch(j){case 1:case 2:case 3:var B=3;break;default:B=j}var se=j;j=B;try{return A()}finally{j=se}},a.unstable_requestPaint=function(){E=!0},a.unstable_runWithPriority=function(A,B){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var se=j;j=A;try{return B()}finally{j=se}},a.unstable_scheduleCallback=function(A,B,se){var K=a.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?K+se:K):se=K,A){case 1:var pe=-1;break;case 2:pe=250;break;case 5:pe=1073741823;break;case 4:pe=1e4;break;default:pe=5e3}return pe=se+pe,A={id:b++,callback:B,priorityLevel:A,startTime:se,expirationTime:pe,sortIndex:-1},se>K?(A.sortIndex=se,r(p,A),i(x)===null&&A===i(p)&&(z?(M(w),w=-1):z=!0,O(L,se-K))):(A.sortIndex=pe,r(x,A),C||S||(C=!0,$||($=!0,F()))),A},a.unstable_shouldYield=U,a.unstable_wrapCallback=function(A){var B=j;return function(){var se=j;j=B;try{return A.apply(this,arguments)}finally{j=se}}}})(zu)),zu}var _h;function A1(){return _h||(_h=1,Du.exports=R1()),Du.exports}var Lu={exports:{}},Pt={};/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var Oh;function M1(){if(Oh)return Pt;Oh=1;var a=md();function r(x){var p="https://react.dev/errors/"+x;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)p+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+x+"; visit "+p+" 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 m(x,p,b){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:g==null?null:""+g,children:x,containerInfo:p,implementation:b}}var f=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(x,p){if(x==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Pt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Pt.createPortal=function(x,p){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(r(299));return m(x,p,null,b)},Pt.flushSync=function(x){var p=f.T,b=o.p;try{if(f.T=null,o.p=2,x)return x()}finally{f.T=p,o.p=b,o.d.f()}},Pt.preconnect=function(x,p){typeof x=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,o.d.C(x,p))},Pt.prefetchDNS=function(x){typeof x=="string"&&o.d.D(x)},Pt.preinit=function(x,p){if(typeof x=="string"&&p&&typeof p.as=="string"){var b=p.as,g=h(b,p.crossOrigin),j=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;b==="style"?o.d.S(x,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:j,fetchPriority:S}):b==="script"&&o.d.X(x,{crossOrigin:g,integrity:j,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Pt.preinitModule=function(x,p){if(typeof x=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var b=h(p.as,p.crossOrigin);o.d.M(x,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&o.d.M(x)},Pt.preload=function(x,p){if(typeof x=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var b=p.as,g=h(b,p.crossOrigin);o.d.L(x,b,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Pt.preloadModule=function(x,p){if(typeof x=="string")if(p){var b=h(p.as,p.crossOrigin);o.d.m(x,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else o.d.m(x)},Pt.requestFormReset=function(x){o.d.r(x)},Pt.unstable_batchedUpdates=function(x,p){return x(p)},Pt.useFormState=function(x,p,b){return f.H.useFormState(x,p,b)},Pt.useFormStatus=function(){return f.H.useHostTransitionStatus()},Pt.version="19.2.4",Pt}var Bh;function Fx(){if(Bh)return Lu.exports;Bh=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(),Lu.exports=M1(),Lu.exports}/**
|
|
35
|
+
* @license React
|
|
36
|
+
* react-dom-client.production.js
|
|
37
|
+
*
|
|
38
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the MIT license found in the
|
|
41
|
+
* LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/var Hh;function D1(){if(Hh)return ds;Hh=1;var a=A1(),r=md(),i=Fx();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 m(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(m(e)!==e)throw Error(o(188))}function p(e){var t=e.alternate;if(!t){if(t=m(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 y=!1,k=c.child;k;){if(k===l){y=!0,l=c,s=d;break}if(k===s){y=!0,s=c,l=d;break}k=k.sibling}if(!y){for(k=d.child;k;){if(k===l){y=!0,l=d,s=c;break}if(k===s){y=!0,s=d,l=c;break}k=k.sibling}if(!y)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 b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(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"),C=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),_=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),U=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function F(e){return e===null||typeof e!="object"?null:(e=q&&e[q]||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 z:return"Fragment";case N:return"Profiler";case E:return"StrictMode";case L:return"Suspense";case $:return"SuspenseList";case R:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case _:return e.displayName||"Context";case M:return(e._context.displayName||"Context")+".Consumer";case I: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 O=Array.isArray,A=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,se={pending:!1,data:null,method:null,action:null},K=[],pe=-1;function T(e){return{current:e}}function Y(e){0>pe||(e.current=K[pe],K[pe]=null,pe--)}function ae(e,t){pe++,K[pe]=e.current,e.current=t}var fe=T(null),ve=T(null),he=T(null),Ce=T(null);function oe(e,t){switch(ae(he,t),ae(ve,e),ae(fe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Jm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Jm(t),e=eh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Y(fe),ae(fe,e)}function je(){Y(fe),Y(ve),Y(he)}function $e(e){e.memoizedState!==null&&ae(Ce,e);var t=fe.current,l=eh(t,e.type);t!==l&&(ae(ve,e),ae(fe,l))}function Be(e){ve.current===e&&(Y(fe),Y(ve)),Ce.current===e&&(Y(Ce),ss._currentValue=se)}var ne,ue;function ce(e){if(ne===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||"",ue=-1<l.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+ne+e+ue}var me=!1;function ye(e,t){if(!e||me)return"";me=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(Z){var X=Z}Reflect.construct(e,[],re)}else{try{re.call()}catch(Z){X=Z}e.call(re.prototype)}}else{try{throw Error()}catch(Z){X=Z}(re=e())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(Z){if(Z&&X&&typeof Z.stack=="string")return[Z.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(),y=d[0],k=d[1];if(y&&k){var H=y.split(`
|
|
45
|
+
`),P=k.split(`
|
|
46
|
+
`);for(c=s=0;s<H.length&&!H[s].includes("DetermineComponentFrameRoot");)s++;for(;c<P.length&&!P[c].includes("DetermineComponentFrameRoot");)c++;if(s===H.length||c===P.length)for(s=H.length-1,c=P.length-1;1<=s&&0<=c&&H[s]!==P[c];)c--;for(;1<=s&&0<=c;s--,c--)if(H[s]!==P[c]){if(s!==1||c!==1)do if(s--,c--,0>c||H[s]!==P[c]){var ee=`
|
|
47
|
+
`+H[s].replace(" at new "," at ");return e.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",e.displayName)),ee}while(1<=s&&0<=c);break}}}finally{me=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?ce(l):""}function _e(e,t){switch(e.tag){case 26:case 27:case 5:return ce(e.type);case 16:return ce("Lazy");case 13:return e.child!==t&&t!==null?ce("Suspense Fallback"):ce("Suspense");case 19:return ce("SuspenseList");case 0:case 15:return ye(e.type,!1);case 11:return ye(e.type.render,!1);case 1:return ye(e.type,!0);case 31:return ce("Activity");default:return""}}function Me(e){try{var t="",l=null;do t+=_e(e,l),l=e,e=e.return;while(e);return t}catch(s){return`
|
|
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,xe=a.unstable_ImmediatePriority,Rt=a.unstable_UserBlockingPriority,De=a.unstable_NormalPriority,xt=a.unstable_LowPriority,Wt=a.unstable_IdlePriority,nt=a.log,Pa=a.unstable_setDisableYieldValue,Qn=null,Ct=null;function St(e){if(typeof nt=="function"&&Pa(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Qn,e)}catch{}}var bt=Math.clz32?Math.clz32:Bn,On=Math.log,Xa=Math.LN2;function Bn(e){return e>>>=0,e===0?32:31-(On(e)/Xa|0)|0}var Ie=256,Ht=262144,Zn=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 gr(e,t,l){var s=e.pendingLanes;if(s===0)return 0;var c=0,d=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var k=s&134217727;return k!==0?(s=k&~d,s!==0?c=Nt(s):(y&=k,y!==0?c=Nt(y):l||(l=k&~e,l!==0&&(c=Nt(l))))):(k=s&~d,k!==0?c=Nt(k):y!==0?c=Nt(y):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 kn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function xo(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 zd(){var e=Zn;return Zn<<=1,(Zn&62914560)===0&&(Zn=4194304),e}function vo(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function br(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function my(e,t,l,s,c,d){var y=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 k=e.entanglements,H=e.expirationTimes,P=e.hiddenUpdates;for(l=y&~l;0<l;){var ee=31-bt(l),re=1<<ee;k[ee]=0,H[ee]=-1;var X=P[ee];if(X!==null)for(P[ee]=null,ee=0;ee<X.length;ee++){var Z=X[ee];Z!==null&&(Z.lane&=-536870913)}l&=~re}s!==0&&Ld(e,s,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(y&~t))}function Ld(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 _d(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 Od(e,t){var l=t&-t;return l=(l&42)!==0?1:yo(l),(l&(e.suspendedLanes|t))!==0?0:l}function yo(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 go(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Bd(){var e=B.p;return e!==0?e:(e=window.event,e===void 0?32:kh(e.type))}function Hd(e,t){var l=B.p;try{return B.p=e,t()}finally{B.p=l}}var ga=Math.random().toString(36).slice(2),Gt="__reactFiber$"+ga,an="__reactProps$"+ga,jl="__reactContainer$"+ga,bo="__reactEvents$"+ga,hy="__reactListeners$"+ga,xy="__reactHandles$"+ga,Ud="__reactResources$"+ga,jr="__reactMarker$"+ga;function jo(e){delete e[Gt],delete e[an],delete e[bo],delete e[hy],delete e[xy]}function Sl(e){var t=e[Gt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[jl]||l[Gt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=ih(e);e!==null;){if(l=e[Gt])return l;e=ih(e)}return t}e=l,l=e.parentNode}return null}function kl(e){if(e=e[Gt]||e[jl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Sr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function wl(e){var t=e[Ud];return t||(t=e[Ud]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ut(e){e[jr]=!0}var Id=new Set,Vd={};function Qa(e,t){Cl(e,t),Cl(e+"Capture",t)}function Cl(e,t){for(Vd[e]=t,e=0;e<t.length;e++)Id.add(t[e])}var vy=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]*$"),$d={},Gd={};function yy(e){return dt.call(Gd,e)?!0:dt.call($d,e)?!1:vy.test(e)?Gd[e]=!0:($d[e]=!0,!1)}function Ds(e,t,l){if(yy(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 zs(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 Jn(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 wn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function gy(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(y){l=""+y,d.call(this,y)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return l},setValue:function(y){l=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function So(e){if(!e._valueTracker){var t=qd(e)?"checked":"value";e._valueTracker=gy(e,t,""+e[t])}}function Yd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),s="";return e&&(s=qd(e)?e.checked?"true":"false":e.value),e=s,e!==l?(t.setValue(e),!0):!1}function Ls(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 by=/[\n"\\]/g;function Cn(e){return e.replace(by,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ko(e,t,l,s,c,d,y,k){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+wn(t)):e.value!==""+wn(t)&&(e.value=""+wn(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?wo(e,y,wn(t)):l!=null?wo(e,y,wn(l)):s!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?e.name=""+wn(k):e.removeAttribute("name")}function Kd(e,t,l,s,c,d,y,k){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)){So(e);return}l=l!=null?""+wn(l):"",t=t!=null?""+wn(t):l,k||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=k?e.checked:!!s,e.defaultChecked=!!s,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),So(e)}function wo(e,t,l){t==="number"&&Ls(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Nl(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=""+wn(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 Fd(e,t,l){if(t!=null&&(t=""+wn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+wn(l):""}function Wd(e,t,l,s){if(t==null){if(s!=null){if(l!=null)throw Error(o(92));if(O(s)){if(1<s.length)throw Error(o(93));s=s[0]}l=s}l==null&&(l=""),t=l}l=wn(t),e.defaultValue=l,s=e.textContent,s===l&&s!==""&&s!==null&&(e.value=s),So(e)}function El(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var jy=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 Pd(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||jy.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function Xd(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&&Pd(e,c,s)}else for(var d in t)t.hasOwnProperty(d)&&Pd(e,d,t[d])}function Co(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 Sy=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"]]),ky=/^[\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 _s(e){return ky.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ea(){}var No=null;function Eo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Tl=null,Rl=null;function Qd(e){var t=kl(e);if(t&&(e=t.stateNode)){var l=e[an]||null;e:switch(e=t.stateNode,t.type){case"input":if(ko(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="'+Cn(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var s=l[t];if(s!==e&&s.form===e.form){var c=s[an]||null;if(!c)throw Error(o(90));ko(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&&Yd(s)}break e;case"textarea":Fd(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Nl(e,!!l.multiple,t,!1)}}}var To=!1;function Zd(e,t,l){if(To)return e(t,l);To=!0;try{var s=e(t);return s}finally{if(To=!1,(Tl!==null||Rl!==null)&&(Si(),Tl&&(t=Tl,e=Rl,Rl=Tl=null,Qd(t),e)))for(t=0;t<e.length;t++)Qd(e[t])}}function kr(e,t){var l=e.stateNode;if(l===null)return null;var s=l[an]||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 ta=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ro=!1;if(ta)try{var wr={};Object.defineProperty(wr,"passive",{get:function(){Ro=!0}}),window.addEventListener("test",wr,wr),window.removeEventListener("test",wr,wr)}catch{Ro=!1}var ba=null,Ao=null,Os=null;function Jd(){if(Os)return Os;var e,t=Ao,l=t.length,s,c="value"in ba?ba.value:ba.textContent,d=c.length;for(e=0;e<l&&t[e]===c[e];e++);var y=l-e;for(s=1;s<=y&&t[l-s]===c[d-s];s++);return Os=c.slice(e,1<s?1-s:void 0)}function Bs(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 Hs(){return!0}function ef(){return!1}function ln(e){function t(l,s,c,d,y){this._reactName=l,this._targetInst=c,this.type=s,this.nativeEvent=d,this.target=y,this.currentTarget=null;for(var k in e)e.hasOwnProperty(k)&&(l=e[k],this[k]=l?l(d):d[k]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Hs:ef,this.isPropagationStopped=ef,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=Hs)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Hs)},persist:function(){},isPersistent:Hs}),t}var Za={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Us=ln(Za),Cr=g({},Za,{view:0,detail:0}),wy=ln(Cr),Mo,Do,Nr,Is=g({},Cr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Lo,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!==Nr&&(Nr&&e.type==="mousemove"?(Mo=e.screenX-Nr.screenX,Do=e.screenY-Nr.screenY):Do=Mo=0,Nr=e),Mo)},movementY:function(e){return"movementY"in e?e.movementY:Do}}),tf=ln(Is),Cy=g({},Is,{dataTransfer:0}),Ny=ln(Cy),Ey=g({},Cr,{relatedTarget:0}),zo=ln(Ey),Ty=g({},Za,{animationName:0,elapsedTime:0,pseudoElement:0}),Ry=ln(Ty),Ay=g({},Za,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),My=ln(Ay),Dy=g({},Za,{data:0}),nf=ln(Dy),zy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ly={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"},_y={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Oy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=_y[e])?!!t[e]:!1}function Lo(){return Oy}var By=g({},Cr,{key:function(e){if(e.key){var t=zy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Bs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ly[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Lo,charCode:function(e){return e.type==="keypress"?Bs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Bs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Hy=ln(By),Uy=g({},Is,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),af=ln(Uy),Iy=g({},Cr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Lo}),Vy=ln(Iy),$y=g({},Za,{propertyName:0,elapsedTime:0,pseudoElement:0}),Gy=ln($y),qy=g({},Is,{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}),Yy=ln(qy),Ky=g({},Za,{newState:0,oldState:0}),Fy=ln(Ky),Wy=[9,13,27,32],_o=ta&&"CompositionEvent"in window,Er=null;ta&&"documentMode"in document&&(Er=document.documentMode);var Py=ta&&"TextEvent"in window&&!Er,lf=ta&&(!_o||Er&&8<Er&&11>=Er),rf=" ",sf=!1;function of(e,t){switch(e){case"keyup":return Wy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Al=!1;function Xy(e,t){switch(e){case"compositionend":return cf(t);case"keypress":return t.which!==32?null:(sf=!0,rf);case"textInput":return e=t.data,e===rf&&sf?null:e;default:return null}}function Qy(e,t){if(Al)return e==="compositionend"||!_o&&of(e,t)?(e=Jd(),Os=Ao=ba=null,Al=!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 lf&&t.locale!=="ko"?null:t.data;default:return null}}var Zy={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 uf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Zy[e.type]:t==="textarea"}function df(e,t,l,s){Tl?Rl?Rl.push(s):Rl=[s]:Tl=s,t=Ri(t,"onChange"),0<t.length&&(l=new Us("onChange","change",null,l,s),e.push({event:l,listeners:t}))}var Tr=null,Rr=null;function Jy(e){Fm(e,0)}function Vs(e){var t=Sr(e);if(Yd(t))return e}function ff(e,t){if(e==="change")return t}var pf=!1;if(ta){var Oo;if(ta){var Bo="oninput"in document;if(!Bo){var mf=document.createElement("div");mf.setAttribute("oninput","return;"),Bo=typeof mf.oninput=="function"}Oo=Bo}else Oo=!1;pf=Oo&&(!document.documentMode||9<document.documentMode)}function hf(){Tr&&(Tr.detachEvent("onpropertychange",xf),Rr=Tr=null)}function xf(e){if(e.propertyName==="value"&&Vs(Rr)){var t=[];df(t,Rr,e,Eo(e)),Zd(Jy,t)}}function eg(e,t,l){e==="focusin"?(hf(),Tr=t,Rr=l,Tr.attachEvent("onpropertychange",xf)):e==="focusout"&&hf()}function tg(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Vs(Rr)}function ng(e,t){if(e==="click")return Vs(t)}function ag(e,t){if(e==="input"||e==="change")return Vs(t)}function lg(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var dn=typeof Object.is=="function"?Object.is:lg;function Ar(e,t){if(dn(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)||!dn(e[c],t[c]))return!1}return!0}function vf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function yf(e,t){var l=vf(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=vf(l)}}function gf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?gf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function bf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ls(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=Ls(e.document)}return t}function Ho(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 rg=ta&&"documentMode"in document&&11>=document.documentMode,Ml=null,Uo=null,Mr=null,Io=!1;function jf(e,t,l){var s=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Io||Ml==null||Ml!==Ls(s)||(s=Ml,"selectionStart"in s&&Ho(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}),Mr&&Ar(Mr,s)||(Mr=s,s=Ri(Uo,"onSelect"),0<s.length&&(t=new Us("onSelect","select",null,t,l),e.push({event:t,listeners:s}),t.target=Ml)))}function Ja(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Dl={animationend:Ja("Animation","AnimationEnd"),animationiteration:Ja("Animation","AnimationIteration"),animationstart:Ja("Animation","AnimationStart"),transitionrun:Ja("Transition","TransitionRun"),transitionstart:Ja("Transition","TransitionStart"),transitioncancel:Ja("Transition","TransitionCancel"),transitionend:Ja("Transition","TransitionEnd")},Vo={},Sf={};ta&&(Sf=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 el(e){if(Vo[e])return Vo[e];if(!Dl[e])return e;var t=Dl[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Sf)return Vo[e]=t[l];return e}var kf=el("animationend"),wf=el("animationiteration"),Cf=el("animationstart"),sg=el("transitionrun"),ig=el("transitionstart"),og=el("transitioncancel"),Nf=el("transitionend"),Ef=new Map,$o="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(" ");$o.push("scrollEnd");function Hn(e,t){Ef.set(e,t),Qa(t,[e])}var $s=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)},Nn=[],zl=0,Go=0;function Gs(){for(var e=zl,t=Go=zl=0;t<e;){var l=Nn[t];Nn[t++]=null;var s=Nn[t];Nn[t++]=null;var c=Nn[t];Nn[t++]=null;var d=Nn[t];if(Nn[t++]=null,s!==null&&c!==null){var y=s.pending;y===null?c.next=c:(c.next=y.next,y.next=c),s.pending=c}d!==0&&Tf(l,c,d)}}function qs(e,t,l,s){Nn[zl++]=e,Nn[zl++]=t,Nn[zl++]=l,Nn[zl++]=s,Go|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function qo(e,t,l,s){return qs(e,t,l,s),Ys(e)}function tl(e,t){return qs(e,null,null,t),Ys(e)}function Tf(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 Ys(e){if(50<Jr)throw Jr=0,Jc=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ll={};function cg(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 fn(e,t,l,s){return new cg(e,t,l,s)}function Yo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function na(e,t){var l=e.alternate;return l===null?(l=fn(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 Rf(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 y=0;if(s=e,typeof e=="function")Yo(e)&&(y=1);else if(typeof e=="string")y=m1(e,l,fe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case R:return e=fn(31,l,t,c),e.elementType=R,e.lanes=d,e;case z:return nl(l.children,c,d,t);case E:y=8,c|=24;break;case N:return e=fn(12,l,t,c|2),e.elementType=N,e.lanes=d,e;case L:return e=fn(13,l,t,c),e.elementType=L,e.lanes=d,e;case $:return e=fn(19,l,t,c),e.elementType=$,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _:y=10;break e;case M:y=9;break e;case I:y=11;break e;case w:y=14;break e;case D:y=16,s=null;break e}y=29,l=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=fn(y,l,t,c),t.elementType=e,t.type=s,t.lanes=d,t}function nl(e,t,l,s){return e=fn(7,e,s,t),e.lanes=l,e}function Ko(e,t,l){return e=fn(6,e,null,t),e.lanes=l,e}function Af(e){var t=fn(18,null,null,0);return t.stateNode=e,t}function Fo(e,t,l){return t=fn(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Mf=new WeakMap;function En(e,t){if(typeof e=="object"&&e!==null){var l=Mf.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Me(t)},Mf.set(e,t),t)}return{value:e,source:t,stack:Me(t)}}var _l=[],Ol=0,Fs=null,Dr=0,Tn=[],Rn=0,ja=null,Gn=1,qn="";function aa(e,t){_l[Ol++]=Dr,_l[Ol++]=Fs,Fs=e,Dr=t}function Df(e,t,l){Tn[Rn++]=Gn,Tn[Rn++]=qn,Tn[Rn++]=ja,ja=e;var s=Gn;e=qn;var c=32-bt(s)-1;s&=~(1<<c),l+=1;var d=32-bt(t)+c;if(30<d){var y=c-c%5;d=(s&(1<<y)-1).toString(32),s>>=y,c-=y,Gn=1<<32-bt(t)+c|l<<c|s,qn=d+e}else Gn=1<<d|l<<c|s,qn=e}function Wo(e){e.return!==null&&(aa(e,1),Df(e,1,0))}function Po(e){for(;e===Fs;)Fs=_l[--Ol],_l[Ol]=null,Dr=_l[--Ol],_l[Ol]=null;for(;e===ja;)ja=Tn[--Rn],Tn[Rn]=null,qn=Tn[--Rn],Tn[Rn]=null,Gn=Tn[--Rn],Tn[Rn]=null}function zf(e,t){Tn[Rn++]=Gn,Tn[Rn++]=qn,Tn[Rn++]=ja,Gn=t.id,qn=t.overflow,ja=e}var qt=null,ft=null,We=!1,Sa=null,An=!1,Xo=Error(o(519));function ka(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zr(En(t,e)),Xo}function Lf(e){var t=e.stateNode,l=e.type,s=e.memoizedProps;switch(t[Gt]=e,t[an]=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<ts.length;l++)qe(ts[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),Kd(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),Wd(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||Qm(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=ea),t=!0):t=!1,t||ka(e,!0)}function _f(e){for(qt=e.return;qt;)switch(qt.tag){case 5:case 31:case 13:An=!1;return;case 27:case 3:An=!0;return;default:qt=qt.return}}function Bl(e){if(e!==qt)return!1;if(!We)return _f(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")||mu(e.type,e.memoizedProps)),l=!l),l&&ft&&ka(e),_f(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=sh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=sh(e)}else t===27?(t=ft,Ba(e.type)?(e=gu,gu=null,ft=e):ft=t):ft=qt?Dn(e.stateNode.nextSibling):null;return!0}function al(){ft=qt=null,We=!1}function Qo(){var e=Sa;return e!==null&&(cn===null?cn=e:cn.push.apply(cn,e),Sa=null),e}function zr(e){Sa===null?Sa=[e]:Sa.push(e)}var Zo=T(null),ll=null,la=null;function wa(e,t,l){ae(Zo,t._currentValue),t._currentValue=l}function ra(e){e._currentValue=Zo.current,Y(Zo)}function Jo(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 ec(e,t,l,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var y=c.child;d=d.firstContext;e:for(;d!==null;){var k=d;d=c;for(var H=0;H<t.length;H++)if(k.context===t[H]){d.lanes|=l,k=d.alternate,k!==null&&(k.lanes|=l),Jo(d.return,l,e),s||(y=null);break e}d=k.next}}else if(c.tag===18){if(y=c.return,y===null)throw Error(o(341));y.lanes|=l,d=y.alternate,d!==null&&(d.lanes|=l),Jo(y,l,e),y=null}else y=c.child;if(y!==null)y.return=c;else for(y=c;y!==null;){if(y===e){y=null;break}if(c=y.sibling,c!==null){c.return=y.return,y=c;break}y=y.return}c=y}}function Hl(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 y=c.alternate;if(y===null)throw Error(o(387));if(y=y.memoizedProps,y!==null){var k=c.type;dn(c.pendingProps.value,y.value)||(e!==null?e.push(k):e=[k])}}else if(c===Ce.current){if(y=c.alternate,y===null)throw Error(o(387));y.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(ss):e=[ss])}c=c.return}e!==null&&ec(t,e,l,s),t.flags|=262144}function Ws(e){for(e=e.firstContext;e!==null;){if(!dn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function rl(e){ll=e,la=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yt(e){return Of(ll,e)}function Ps(e,t){return ll===null&&rl(e),Of(e,t)}function Of(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},la===null){if(e===null)throw Error(o(308));la=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else la=la.next=t;return l}var ug=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()})}},dg=a.unstable_scheduleCallback,fg=a.unstable_NormalPriority,At={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function tc(){return{controller:new ug,data:new Map,refCount:0}}function Lr(e){e.refCount--,e.refCount===0&&dg(fg,function(){e.controller.abort()})}var _r=null,nc=0,Ul=0,Il=null;function pg(e,t){if(_r===null){var l=_r=[];nc=0,Ul=ru(),Il={status:"pending",value:void 0,then:function(s){l.push(s)}}}return nc++,t.then(Bf,Bf),t}function Bf(){if(--nc===0&&_r!==null){Il!==null&&(Il.status="fulfilled");var e=_r;_r=null,Ul=0,Il=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function mg(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 Hf=A.S;A.S=function(e,t){jm=tt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&pg(e,t),Hf!==null&&Hf(e,t)};var sl=T(null);function ac(){var e=sl.current;return e!==null?e:ut.pooledCache}function Xs(e,t){t===null?ae(sl,sl.current):ae(sl,t.pool)}function Uf(){var e=ac();return e===null?null:{parent:At._currentValue,pool:e}}var Vl=Error(o(460)),lc=Error(o(474)),Qs=Error(o(542)),Zs={then:function(){}};function If(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Vf(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(ea,ea),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Gf(e),e;default:if(typeof t.status=="string")t.then(ea,ea);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,Gf(e),e}throw ol=t,Vl}}function il(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ol=l,Vl):l}}var ol=null;function $f(){if(ol===null)throw Error(o(459));var e=ol;return ol=null,e}function Gf(e){if(e===Vl||e===Qs)throw Error(o(483))}var $l=null,Or=0;function Js(e){var t=Or;return Or+=1,$l===null&&($l=[]),Vf($l,e,t)}function Br(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ei(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 qf(e){function t(G,V){if(e){var W=G.deletions;W===null?(G.deletions=[V],G.flags|=16):W.push(V)}}function l(G,V){if(!e)return null;for(;V!==null;)t(G,V),V=V.sibling;return null}function s(G){for(var V=new Map;G!==null;)G.key!==null?V.set(G.key,G):V.set(G.index,G),G=G.sibling;return V}function c(G,V){return G=na(G,V),G.index=0,G.sibling=null,G}function d(G,V,W){return G.index=W,e?(W=G.alternate,W!==null?(W=W.index,W<V?(G.flags|=67108866,V):W):(G.flags|=67108866,V)):(G.flags|=1048576,V)}function y(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function k(G,V,W,le){return V===null||V.tag!==6?(V=Ko(W,G.mode,le),V.return=G,V):(V=c(V,W),V.return=G,V)}function H(G,V,W,le){var Ee=W.type;return Ee===z?ee(G,V,W.props.children,le,W.key):V!==null&&(V.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===D&&il(Ee)===V.type)?(V=c(V,W.props),Br(V,W),V.return=G,V):(V=Ks(W.type,W.key,W.props,null,G.mode,le),Br(V,W),V.return=G,V)}function P(G,V,W,le){return V===null||V.tag!==4||V.stateNode.containerInfo!==W.containerInfo||V.stateNode.implementation!==W.implementation?(V=Fo(W,G.mode,le),V.return=G,V):(V=c(V,W.children||[]),V.return=G,V)}function ee(G,V,W,le,Ee){return V===null||V.tag!==7?(V=nl(W,G.mode,le,Ee),V.return=G,V):(V=c(V,W),V.return=G,V)}function re(G,V,W){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Ko(""+V,G.mode,W),V.return=G,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case S:return W=Ks(V.type,V.key,V.props,null,G.mode,W),Br(W,V),W.return=G,W;case C:return V=Fo(V,G.mode,W),V.return=G,V;case D:return V=il(V),re(G,V,W)}if(O(V)||F(V))return V=nl(V,G.mode,W,null),V.return=G,V;if(typeof V.then=="function")return re(G,Js(V),W);if(V.$$typeof===_)return re(G,Ps(G,V),W);ei(G,V)}return null}function X(G,V,W,le){var Ee=V!==null?V.key:null;if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return Ee!==null?null:k(G,V,""+W,le);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case S:return W.key===Ee?H(G,V,W,le):null;case C:return W.key===Ee?P(G,V,W,le):null;case D:return W=il(W),X(G,V,W,le)}if(O(W)||F(W))return Ee!==null?null:ee(G,V,W,le,null);if(typeof W.then=="function")return X(G,V,Js(W),le);if(W.$$typeof===_)return X(G,V,Ps(G,W),le);ei(G,W)}return null}function Z(G,V,W,le,Ee){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return G=G.get(W)||null,k(V,G,""+le,Ee);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case S:return G=G.get(le.key===null?W:le.key)||null,H(V,G,le,Ee);case C:return G=G.get(le.key===null?W:le.key)||null,P(V,G,le,Ee);case D:return le=il(le),Z(G,V,W,le,Ee)}if(O(le)||F(le))return G=G.get(W)||null,ee(V,G,le,Ee,null);if(typeof le.then=="function")return Z(G,V,W,Js(le),Ee);if(le.$$typeof===_)return Z(G,V,W,Ps(V,le),Ee);ei(V,le)}return null}function be(G,V,W,le){for(var Ee=null,Xe=null,Se=V,He=V=0,Ke=null;Se!==null&&He<W.length;He++){Se.index>He?(Ke=Se,Se=null):Ke=Se.sibling;var Qe=X(G,Se,W[He],le);if(Qe===null){Se===null&&(Se=Ke);break}e&&Se&&Qe.alternate===null&&t(G,Se),V=d(Qe,V,He),Xe===null?Ee=Qe:Xe.sibling=Qe,Xe=Qe,Se=Ke}if(He===W.length)return l(G,Se),We&&aa(G,He),Ee;if(Se===null){for(;He<W.length;He++)Se=re(G,W[He],le),Se!==null&&(V=d(Se,V,He),Xe===null?Ee=Se:Xe.sibling=Se,Xe=Se);return We&&aa(G,He),Ee}for(Se=s(Se);He<W.length;He++)Ke=Z(Se,G,He,W[He],le),Ke!==null&&(e&&Ke.alternate!==null&&Se.delete(Ke.key===null?He:Ke.key),V=d(Ke,V,He),Xe===null?Ee=Ke:Xe.sibling=Ke,Xe=Ke);return e&&Se.forEach(function($a){return t(G,$a)}),We&&aa(G,He),Ee}function Te(G,V,W,le){if(W==null)throw Error(o(151));for(var Ee=null,Xe=null,Se=V,He=V=0,Ke=null,Qe=W.next();Se!==null&&!Qe.done;He++,Qe=W.next()){Se.index>He?(Ke=Se,Se=null):Ke=Se.sibling;var $a=X(G,Se,Qe.value,le);if($a===null){Se===null&&(Se=Ke);break}e&&Se&&$a.alternate===null&&t(G,Se),V=d($a,V,He),Xe===null?Ee=$a:Xe.sibling=$a,Xe=$a,Se=Ke}if(Qe.done)return l(G,Se),We&&aa(G,He),Ee;if(Se===null){for(;!Qe.done;He++,Qe=W.next())Qe=re(G,Qe.value,le),Qe!==null&&(V=d(Qe,V,He),Xe===null?Ee=Qe:Xe.sibling=Qe,Xe=Qe);return We&&aa(G,He),Ee}for(Se=s(Se);!Qe.done;He++,Qe=W.next())Qe=Z(Se,G,He,Qe.value,le),Qe!==null&&(e&&Qe.alternate!==null&&Se.delete(Qe.key===null?He:Qe.key),V=d(Qe,V,He),Xe===null?Ee=Qe:Xe.sibling=Qe,Xe=Qe);return e&&Se.forEach(function(C1){return t(G,C1)}),We&&aa(G,He),Ee}function it(G,V,W,le){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;V!==null;){if(V.key===Ee){if(Ee=W.type,Ee===z){if(V.tag===7){l(G,V.sibling),le=c(V,W.props.children),le.return=G,G=le;break e}}else if(V.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===D&&il(Ee)===V.type){l(G,V.sibling),le=c(V,W.props),Br(le,W),le.return=G,G=le;break e}l(G,V);break}else t(G,V);V=V.sibling}W.type===z?(le=nl(W.props.children,G.mode,le,W.key),le.return=G,G=le):(le=Ks(W.type,W.key,W.props,null,G.mode,le),Br(le,W),le.return=G,G=le)}return y(G);case C:e:{for(Ee=W.key;V!==null;){if(V.key===Ee)if(V.tag===4&&V.stateNode.containerInfo===W.containerInfo&&V.stateNode.implementation===W.implementation){l(G,V.sibling),le=c(V,W.children||[]),le.return=G,G=le;break e}else{l(G,V);break}else t(G,V);V=V.sibling}le=Fo(W,G.mode,le),le.return=G,G=le}return y(G);case D:return W=il(W),it(G,V,W,le)}if(O(W))return be(G,V,W,le);if(F(W)){if(Ee=F(W),typeof Ee!="function")throw Error(o(150));return W=Ee.call(W),Te(G,V,W,le)}if(typeof W.then=="function")return it(G,V,Js(W),le);if(W.$$typeof===_)return it(G,V,Ps(G,W),le);ei(G,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,V!==null&&V.tag===6?(l(G,V.sibling),le=c(V,W),le.return=G,G=le):(l(G,V),le=Ko(W,G.mode,le),le.return=G,G=le),y(G)):l(G,V)}return function(G,V,W,le){try{Or=0;var Ee=it(G,V,W,le);return $l=null,Ee}catch(Se){if(Se===Vl||Se===Qs)throw Se;var Xe=fn(29,Se,null,G.mode);return Xe.lanes=le,Xe.return=G,Xe}finally{}}}var cl=qf(!0),Yf=qf(!1),Ca=!1;function rc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sc(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 Na(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ea(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=Ys(e),Tf(e,null,l),t}return qs(e,s,t,l),Ys(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,_d(e,l)}}function ic(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 y={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};d===null?c=d=y:d=d.next=y,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 oc=!1;function Ur(){if(oc){var e=Il;if(e!==null)throw e}}function Ir(e,t,l,s){oc=!1;var c=e.updateQueue;Ca=!1;var d=c.firstBaseUpdate,y=c.lastBaseUpdate,k=c.shared.pending;if(k!==null){c.shared.pending=null;var H=k,P=H.next;H.next=null,y===null?d=P:y.next=P,y=H;var ee=e.alternate;ee!==null&&(ee=ee.updateQueue,k=ee.lastBaseUpdate,k!==y&&(k===null?ee.firstBaseUpdate=P:k.next=P,ee.lastBaseUpdate=H))}if(d!==null){var re=c.baseState;y=0,ee=P=H=null,k=d;do{var X=k.lane&-536870913,Z=X!==k.lane;if(Z?(Ye&X)===X:(s&X)===X){X!==0&&X===Ul&&(oc=!0),ee!==null&&(ee=ee.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var be=e,Te=k;X=t;var it=l;switch(Te.tag){case 1:if(be=Te.payload,typeof be=="function"){re=be.call(it,re,X);break e}re=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Te.payload,X=typeof be=="function"?be.call(it,re,X):be,X==null)break e;re=g({},re,X);break e;case 2:Ca=!0}}X=k.callback,X!==null&&(e.flags|=64,Z&&(e.flags|=8192),Z=c.callbacks,Z===null?c.callbacks=[X]:Z.push(X))}else Z={lane:X,tag:k.tag,payload:k.payload,callback:k.callback,next:null},ee===null?(P=ee=Z,H=re):ee=ee.next=Z,y|=X;if(k=k.next,k===null){if(k=c.shared.pending,k===null)break;Z=k,k=Z.next,Z.next=null,c.lastBaseUpdate=Z,c.shared.pending=null}}while(!0);ee===null&&(H=re),c.baseState=H,c.firstBaseUpdate=P,c.lastBaseUpdate=ee,d===null&&(c.shared.lanes=0),Da|=y,e.lanes=y,e.memoizedState=re}}function Kf(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Ff(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Kf(l[e],t)}var Gl=T(null),ti=T(0);function Wf(e,t){e=ma,ae(ti,e),ae(Gl,t),ma=e|t.baseLanes}function cc(){ae(ti,ma),ae(Gl,Gl.current)}function uc(){ma=ti.current,Y(Gl),Y(ti)}var pn=T(null),Mn=null;function Ta(e){var t=e.alternate;ae(Et,Et.current&1),ae(pn,e),Mn===null&&(t===null||Gl.current!==null||t.memoizedState!==null)&&(Mn=e)}function dc(e){ae(Et,Et.current),ae(pn,e),Mn===null&&(Mn=e)}function Pf(e){e.tag===22?(ae(Et,Et.current),ae(pn,e),Mn===null&&(Mn=e)):Ra()}function Ra(){ae(Et,Et.current),ae(pn,pn.current)}function mn(e){Y(pn),Mn===e&&(Mn=null),Y(Et)}var Et=T(0);function ni(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||vu(l)||yu(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 sa=0,Oe=null,rt=null,Mt=null,ai=!1,ql=!1,ul=!1,li=0,Vr=0,Yl=null,hg=0;function kt(){throw Error(o(321))}function fc(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!dn(e[l],t[l]))return!1;return!0}function pc(e,t,l,s,c,d){return sa=d,Oe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?Dp:Tc,ul=!1,d=l(s,c),ul=!1,ql&&(d=Qf(t,l,s,c)),Xf(e),d}function Xf(e){A.H=qr;var t=rt!==null&&rt.next!==null;if(sa=0,Mt=rt=Oe=null,ai=!1,Vr=0,Yl=null,t)throw Error(o(300));e===null||Dt||(e=e.dependencies,e!==null&&Ws(e)&&(Dt=!0))}function Qf(e,t,l,s){Oe=e;var c=0;do{if(ql&&(Yl=null),Vr=0,ql=!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)}A.H=zp,d=t(l,s)}while(ql);return d}function xg(){var e=A.H,t=e.useState()[0];return t=typeof t.then=="function"?$r(t):t,e=e.useState()[0],(rt!==null?rt.memoizedState:null)!==e&&(Oe.flags|=1024),t}function mc(){var e=li!==0;return li=0,e}function hc(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function xc(e){if(ai){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ai=!1}sa=0,Mt=rt=Oe=null,ql=!1,Vr=li=0,Yl=null}function Jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?Oe.memoizedState=Mt=e:Mt=Mt.next=e,Mt}function Tt(){if(rt===null){var e=Oe.alternate;e=e!==null?e.memoizedState:null}else e=rt.next;var t=Mt===null?Oe.memoizedState:Mt.next;if(t!==null)Mt=t,rt=e;else{if(e===null)throw Oe.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?Oe.memoizedState=Mt=e:Mt=Mt.next=e}return Mt}function ri(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $r(e){var t=Vr;return Vr+=1,Yl===null&&(Yl=[]),e=Vf(Yl,e,t),t=Oe,(Mt===null?t.memoizedState:Mt.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?Dp:Tc),e}function si(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return $r(e);if(e.$$typeof===_)return Yt(e)}throw Error(o(438,String(e)))}function vc(e){var t=null,l=Oe.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var s=Oe.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=ri(),Oe.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]=U;return t.index++,l}function ia(e,t){return typeof t=="function"?t(e):t}function ii(e){var t=Tt();return yc(t,rt,e)}function yc(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 y=c.next;c.next=d.next,d.next=y}t.baseQueue=c=d,s.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var k=y=null,H=null,P=t,ee=!1;do{var re=P.lane&-536870913;if(re!==P.lane?(Ye&re)===re:(sa&re)===re){var X=P.revertLane;if(X===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),re===Ul&&(ee=!0);else if((sa&X)===X){P=P.next,X===Ul&&(ee=!0);continue}else re={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},H===null?(k=H=re,y=d):H=H.next=re,Oe.lanes|=X,Da|=X;re=P.action,ul&&l(d,re),d=P.hasEagerState?P.eagerState:l(d,re)}else X={lane:re,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},H===null?(k=H=X,y=d):H=H.next=X,Oe.lanes|=re,Da|=re;P=P.next}while(P!==null&&P!==t);if(H===null?y=d:H.next=k,!dn(d,e.memoizedState)&&(Dt=!0,ee&&(l=Il,l!==null)))throw l;e.memoizedState=d,e.baseState=y,e.baseQueue=H,s.lastRenderedState=d}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function gc(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 y=c=c.next;do d=e(d,y.action),y=y.next;while(y!==c);dn(d,t.memoizedState)||(Dt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),l.lastRenderedState=d}return[d,s]}function Zf(e,t,l){var s=Oe,c=Tt(),d=We;if(d){if(l===void 0)throw Error(o(407));l=l()}else l=t();var y=!dn((rt||c).memoizedState,l);if(y&&(c.memoizedState=l,Dt=!0),c=c.queue,Sc(tp.bind(null,s,c,e),[e]),c.getSnapshot!==t||y||Mt!==null&&Mt.memoizedState.tag&1){if(s.flags|=2048,Kl(9,{destroy:void 0},ep.bind(null,s,c,l,t),null),ut===null)throw Error(o(349));d||(sa&127)!==0||Jf(s,t,l)}return l}function Jf(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Oe.updateQueue,t===null?(t=ri(),Oe.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function ep(e,t,l,s){t.value=l,t.getSnapshot=s,np(t)&&ap(e)}function tp(e,t,l){return l(function(){np(t)&&ap(e)})}function np(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!dn(e,l)}catch{return!0}}function ap(e){var t=tl(e,2);t!==null&&un(t,e,2)}function bc(e){var t=Jt();if(typeof e=="function"){var l=e;if(e=l(),ul){St(!0);try{l()}finally{St(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:e},t}function lp(e,t,l,s){return e.baseState=l,yc(e,rt,typeof s=="function"?s:ia)}function vg(e,t,l,s,c){if(ui(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(y){d.listeners.push(y)}};A.T!==null?l(!0):d.isTransition=!1,s(d),l=t.pending,l===null?(d.next=t.pending=d,rp(t,d)):(d.next=l.next,t.pending=l.next=d)}}function rp(e,t){var l=t.action,s=t.payload,c=e.state;if(t.isTransition){var d=A.T,y={};A.T=y;try{var k=l(c,s),H=A.S;H!==null&&H(y,k),sp(e,t,k)}catch(P){jc(e,t,P)}finally{d!==null&&y.types!==null&&(d.types=y.types),A.T=d}}else try{d=l(c,s),sp(e,t,d)}catch(P){jc(e,t,P)}}function sp(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(s){ip(e,t,s)},function(s){return jc(e,t,s)}):ip(e,t,l)}function ip(e,t,l){t.status="fulfilled",t.value=l,op(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,rp(e,l)))}function jc(e,t,l){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=l,op(t),t=t.next;while(t!==s)}e.action=null}function op(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function cp(e,t){return t}function up(e,t){if(We){var l=ut.formState;if(l!==null){e:{var s=Oe;if(We){if(ft){t:{for(var c=ft,d=An;c.nodeType!==8;){if(!d){c=null;break t}if(c=Dn(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){ft=Dn(c.nextSibling),s=c.data==="F!";break e}}ka(s)}s=!1}s&&(t=l[0])}}return l=Jt(),l.memoizedState=l.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cp,lastRenderedState:t},l.queue=s,l=Rp.bind(null,Oe,s),s.dispatch=l,s=bc(!1),d=Ec.bind(null,Oe,!1,s.queue),s=Jt(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,l=vg.bind(null,Oe,c,d,l),c.dispatch=l,s.memoizedState=e,[t,l,!1]}function dp(e){var t=Tt();return fp(t,rt,e)}function fp(e,t,l){if(t=yc(e,t,cp)[0],e=ii(ia)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=$r(t)}catch(y){throw y===Vl?Qs:y}else s=t;t=Tt();var c=t.queue,d=c.dispatch;return l!==t.memoizedState&&(Oe.flags|=2048,Kl(9,{destroy:void 0},yg.bind(null,c,l),null)),[s,d,e]}function yg(e,t){e.action=t}function pp(e){var t=Tt(),l=rt;if(l!==null)return fp(t,l,e);Tt(),t=t.memoizedState,l=Tt();var s=l.queue.dispatch;return l.memoizedState=e,[t,s,!1]}function Kl(e,t,l,s){return e={tag:e,create:l,deps:s,inst:t,next:null},t=Oe.updateQueue,t===null&&(t=ri(),Oe.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 mp(){return Tt().memoizedState}function oi(e,t,l,s){var c=Jt();Oe.flags|=e,c.memoizedState=Kl(1|t,{destroy:void 0},l,s===void 0?null:s)}function ci(e,t,l,s){var c=Tt();s=s===void 0?null:s;var d=c.memoizedState.inst;rt!==null&&s!==null&&fc(s,rt.memoizedState.deps)?c.memoizedState=Kl(t,d,l,s):(Oe.flags|=e,c.memoizedState=Kl(1|t,d,l,s))}function hp(e,t){oi(8390656,8,e,t)}function Sc(e,t){ci(2048,8,e,t)}function gg(e){Oe.flags|=4;var t=Oe.updateQueue;if(t===null)t=ri(),Oe.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function xp(e){var t=Tt().memoizedState;return gg({ref:t,nextImpl:e}),function(){if((Je&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function vp(e,t){return ci(4,2,e,t)}function yp(e,t){return ci(4,4,e,t)}function gp(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 bp(e,t,l){l=l!=null?l.concat([e]):null,ci(4,4,gp.bind(null,t,e),l)}function kc(){}function jp(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;return t!==null&&fc(t,s[1])?s[0]:(l.memoizedState=[e,t],e)}function Sp(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;if(t!==null&&fc(t,s[1]))return s[0];if(s=e(),ul){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[s,t],s}function wc(e,t,l){return l===void 0||(sa&1073741824)!==0&&(Ye&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=km(),Oe.lanes|=e,Da|=e,l)}function kp(e,t,l,s){return dn(l,t)?l:Gl.current!==null?(e=wc(e,l,s),dn(e,t)||(Dt=!0),e):(sa&42)===0||(sa&1073741824)!==0&&(Ye&261930)===0?(Dt=!0,e.memoizedState=l):(e=km(),Oe.lanes|=e,Da|=e,t)}function wp(e,t,l,s,c){var d=B.p;B.p=d!==0&&8>d?d:8;var y=A.T,k={};A.T=k,Ec(e,!1,t,l);try{var H=c(),P=A.S;if(P!==null&&P(k,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ee=mg(H,s);Gr(e,t,ee,vn(e))}else Gr(e,t,s,vn(e))}catch(re){Gr(e,t,{then:function(){},status:"rejected",reason:re},vn())}finally{B.p=d,y!==null&&k.types!==null&&(y.types=k.types),A.T=y}}function bg(){}function Cc(e,t,l,s){if(e.tag!==5)throw Error(o(476));var c=Cp(e).queue;wp(e,c,t,se,l===null?bg:function(){return Np(e),l(s)})}function Cp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:se},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Np(e){var t=Cp(e);t.next===null&&(t=e.alternate.memoizedState),Gr(e,t.next.queue,{},vn())}function Nc(){return Yt(ss)}function Ep(){return Tt().memoizedState}function Tp(){return Tt().memoizedState}function jg(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=vn();e=Na(l);var s=Ea(t,e,l);s!==null&&(un(s,t,l),Hr(s,t,l)),t={cache:tc()},e.payload=t;return}t=t.return}}function Sg(e,t,l){var s=vn();l={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ui(e)?Ap(t,l):(l=qo(e,t,l,s),l!==null&&(un(l,e,s),Mp(l,t,s)))}function Rp(e,t,l){var s=vn();Gr(e,t,l,s)}function Gr(e,t,l,s){var c={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(ui(e))Ap(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var y=t.lastRenderedState,k=d(y,l);if(c.hasEagerState=!0,c.eagerState=k,dn(k,y))return qs(e,t,c,0),ut===null&&Gs(),!1}catch{}finally{}if(l=qo(e,t,c,s),l!==null)return un(l,e,s),Mp(l,t,s),!0}return!1}function Ec(e,t,l,s){if(s={lane:2,revertLane:ru(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},ui(e)){if(t)throw Error(o(479))}else t=qo(e,l,s,2),t!==null&&un(t,e,2)}function ui(e){var t=e.alternate;return e===Oe||t!==null&&t===Oe}function Ap(e,t){ql=ai=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Mp(e,t,l){if((l&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,_d(e,l)}}var qr={readContext:Yt,use:si,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 Dp={readContext:Yt,use:si,useCallback:function(e,t){return Jt().memoizedState=[e,t===void 0?null:t],e},useContext:Yt,useEffect:hp,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,oi(4194308,4,gp.bind(null,t,e),l)},useLayoutEffect:function(e,t){return oi(4194308,4,e,t)},useInsertionEffect:function(e,t){oi(4,2,e,t)},useMemo:function(e,t){var l=Jt();t=t===void 0?null:t;var s=e();if(ul){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(ul){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=Sg.bind(null,Oe,e),[s.memoizedState,e]},useRef:function(e){var t=Jt();return e={current:e},t.memoizedState=e},useState:function(e){e=bc(e);var t=e.queue,l=Rp.bind(null,Oe,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:kc,useDeferredValue:function(e,t){var l=Jt();return wc(l,e,t)},useTransition:function(){var e=bc(!1);return e=wp.bind(null,Oe,e.queue,!0,!1),Jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var s=Oe,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||Jf(s,t,l)}c.memoizedState=l;var d={value:l,getSnapshot:t};return c.queue=d,hp(tp.bind(null,s,d,e),[e]),s.flags|=2048,Kl(9,{destroy:void 0},ep.bind(null,s,d,l,t),null),l},useId:function(){var e=Jt(),t=ut.identifierPrefix;if(We){var l=qn,s=Gn;l=(s&~(1<<32-bt(s)-1)).toString(32)+l,t="_"+t+"R_"+l,l=li++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=hg++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Nc,useFormState:up,useActionState:up,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=Ec.bind(null,Oe,!0,l),l.dispatch=t,[e,t]},useMemoCache:vc,useCacheRefresh:function(){return Jt().memoizedState=jg.bind(null,Oe)},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)}}},Tc={readContext:Yt,use:si,useCallback:jp,useContext:Yt,useEffect:Sc,useImperativeHandle:bp,useInsertionEffect:vp,useLayoutEffect:yp,useMemo:Sp,useReducer:ii,useRef:mp,useState:function(){return ii(ia)},useDebugValue:kc,useDeferredValue:function(e,t){var l=Tt();return kp(l,rt.memoizedState,e,t)},useTransition:function(){var e=ii(ia)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:$r(e),t]},useSyncExternalStore:Zf,useId:Ep,useHostTransitionStatus:Nc,useFormState:dp,useActionState:dp,useOptimistic:function(e,t){var l=Tt();return lp(l,rt,e,t)},useMemoCache:vc,useCacheRefresh:Tp};Tc.useEffectEvent=xp;var zp={readContext:Yt,use:si,useCallback:jp,useContext:Yt,useEffect:Sc,useImperativeHandle:bp,useInsertionEffect:vp,useLayoutEffect:yp,useMemo:Sp,useReducer:gc,useRef:mp,useState:function(){return gc(ia)},useDebugValue:kc,useDeferredValue:function(e,t){var l=Tt();return rt===null?wc(l,e,t):kp(l,rt.memoizedState,e,t)},useTransition:function(){var e=gc(ia)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:$r(e),t]},useSyncExternalStore:Zf,useId:Ep,useHostTransitionStatus:Nc,useFormState:pp,useActionState:pp,useOptimistic:function(e,t){var l=Tt();return rt!==null?lp(l,rt,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:vc,useCacheRefresh:Tp};zp.useEffectEvent=xp;function Rc(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 Ac={enqueueSetState:function(e,t,l){e=e._reactInternals;var s=vn(),c=Na(s);c.payload=t,l!=null&&(c.callback=l),t=Ea(e,c,s),t!==null&&(un(t,e,s),Hr(t,e,s))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var s=vn(),c=Na(s);c.tag=1,c.payload=t,l!=null&&(c.callback=l),t=Ea(e,c,s),t!==null&&(un(t,e,s),Hr(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=vn(),s=Na(l);s.tag=2,t!=null&&(s.callback=t),t=Ea(e,s,l),t!==null&&(un(t,e,l),Hr(t,e,l))}};function Lp(e,t,l,s,c,d,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,d,y):t.prototype&&t.prototype.isPureReactComponent?!Ar(l,s)||!Ar(c,d):!0}function _p(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&&Ac.enqueueReplaceState(t,t.state,null)}function dl(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 Op(e){$s(e)}function Bp(e){console.error(e)}function Hp(e){$s(e)}function di(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Up(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 Mc(e,t,l){return l=Na(l),l.tag=3,l.payload={element:null},l.callback=function(){di(e,t)},l}function Ip(e){return e=Na(e),e.tag=3,e}function Vp(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(){Up(t,l,s)}}var y=l.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){Up(t,l,s),typeof c!="function"&&(za===null?za=new Set([this]):za.add(this));var k=s.stack;this.componentDidCatch(s.value,{componentStack:k!==null?k:""})})}function kg(e,t,l,s,c){if(l.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=l.alternate,t!==null&&Hl(t,l,c,!0),l=pn.current,l!==null){switch(l.tag){case 31:case 13:return Mn===null?ki():l.alternate===null&&wt===0&&(wt=3),l.flags&=-257,l.flags|=65536,l.lanes=c,s===Zs?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([s]):t.add(s),nu(e,s,c)),!1;case 22:return l.flags|=65536,s===Zs?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)),nu(e,s,c)),!1}throw Error(o(435,l.tag))}return nu(e,s,c),ki(),!1}if(We)return t=pn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==Xo&&(e=Error(o(422),{cause:s}),zr(En(e,l)))):(s!==Xo&&(t=Error(o(423),{cause:s}),zr(En(t,l))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=En(s,l),c=Mc(e.stateNode,s,c),ic(e,c),wt!==4&&(wt=2)),!1;var d=Error(o(520),{cause:s});if(d=En(d,l),Zr===null?Zr=[d]:Zr.push(d),wt!==4&&(wt=2),t===null)return!0;s=En(s,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=c&-c,l.lanes|=e,e=Mc(l.stateNode,s,e),ic(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"&&(za===null||!za.has(d))))return l.flags|=65536,c&=-c,l.lanes|=c,c=Ip(c),Vp(c,e,l,s),ic(l,c),!1}l=l.return}while(l!==null);return!1}var Dc=Error(o(461)),Dt=!1;function Kt(e,t,l,s){t.child=e===null?Yf(t,null,l,s):cl(t,e.child,l,s)}function $p(e,t,l,s,c){l=l.render;var d=t.ref;if("ref"in s){var y={};for(var k in s)k!=="ref"&&(y[k]=s[k])}else y=s;return rl(t),s=pc(e,t,l,y,d,c),k=mc(),e!==null&&!Dt?(hc(e,t,c),oa(e,t,c)):(We&&k&&Wo(t),t.flags|=1,Kt(e,t,s,c),t.child)}function Gp(e,t,l,s,c){if(e===null){var d=l.type;return typeof d=="function"&&!Yo(d)&&d.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=d,qp(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,!Ic(e,c)){var y=d.memoizedProps;if(l=l.compare,l=l!==null?l:Ar,l(y,s)&&e.ref===t.ref)return oa(e,t,c)}return t.flags|=1,e=na(d,s),e.ref=t.ref,e.return=t,t.child=e}function qp(e,t,l,s,c){if(e!==null){var d=e.memoizedProps;if(Ar(d,s)&&e.ref===t.ref)if(Dt=!1,t.pendingProps=s=d,Ic(e,c))(e.flags&131072)!==0&&(Dt=!0);else return t.lanes=e.lanes,oa(e,t,c)}return zc(e,t,l,s,c)}function Yp(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 Kp(e,t,d,l,s)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Xs(t,d!==null?d.cachePool:null),d!==null?Wf(t,d):cc(),Pf(t);else return s=t.lanes=536870912,Kp(e,t,d!==null?d.baseLanes|l:l,l,s)}else d!==null?(Xs(t,d.cachePool),Wf(t,d),Ra(),t.memoizedState=null):(e!==null&&Xs(t,null),cc(),Ra());return Kt(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 Kp(e,t,l,s,c){var d=ac();return d=d===null?null:{parent:At._currentValue,pool:d},t.memoizedState={baseLanes:l,cachePool:d},e!==null&&Xs(t,null),cc(),Pf(t),e!==null&&Hl(e,t,s,!0),t.childLanes=c,null}function fi(e,t){return t=mi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Fp(e,t,l){return cl(t,e.child,null,l),e=fi(t,t.pendingProps),e.flags|=2,mn(t),t.memoizedState=null,e}function wg(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=fi(t,s),t.lanes=536870912,Yr(null,e);if(dc(t),(e=ft)?(e=rh(e,An),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ja!==null?{id:Gn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=Af(e),l.return=t,t.child=l,qt=t,ft=null)):e=null,e===null)throw ka(t);return t.lanes=536870912,null}return fi(t,s)}var d=e.memoizedState;if(d!==null){var y=d.dehydrated;if(dc(t),c)if(t.flags&256)t.flags&=-257,t=Fp(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Dt||Hl(e,t,l,!1),c=(l&e.childLanes)!==0,Dt||c){if(s=ut,s!==null&&(y=Od(s,l),y!==0&&y!==d.retryLane))throw d.retryLane=y,tl(e,y),un(s,e,y),Dc;ki(),t=Fp(e,t,l)}else e=d.treeContext,ft=Dn(y.nextSibling),qt=t,We=!0,Sa=null,An=!1,e!==null&&zf(t,e),t=fi(t,s),t.flags|=4096;return t}return e=na(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function pi(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 zc(e,t,l,s,c){return rl(t),l=pc(e,t,l,s,void 0,c),s=mc(),e!==null&&!Dt?(hc(e,t,c),oa(e,t,c)):(We&&s&&Wo(t),t.flags|=1,Kt(e,t,l,c),t.child)}function Wp(e,t,l,s,c,d){return rl(t),t.updateQueue=null,l=Qf(t,s,l,c),Xf(e),s=mc(),e!==null&&!Dt?(hc(e,t,d),oa(e,t,d)):(We&&s&&Wo(t),t.flags|=1,Kt(e,t,l,d),t.child)}function Pp(e,t,l,s,c){if(rl(t),t.stateNode===null){var d=Ll,y=l.contextType;typeof y=="object"&&y!==null&&(d=Yt(y)),d=new l(s,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Ac,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=s,d.state=t.memoizedState,d.refs={},rc(t),y=l.contextType,d.context=typeof y=="object"&&y!==null?Yt(y):Ll,d.state=t.memoizedState,y=l.getDerivedStateFromProps,typeof y=="function"&&(Rc(t,l,y,s),d.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(y=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),y!==d.state&&Ac.enqueueReplaceState(d,d.state,null),Ir(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 k=t.memoizedProps,H=dl(l,k);d.props=H;var P=d.context,ee=l.contextType;y=Ll,typeof ee=="object"&&ee!==null&&(y=Yt(ee));var re=l.getDerivedStateFromProps;ee=typeof re=="function"||typeof d.getSnapshotBeforeUpdate=="function",k=t.pendingProps!==k,ee||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(k||P!==y)&&_p(t,d,s,y),Ca=!1;var X=t.memoizedState;d.state=X,Ir(t,s,d,c),Ur(),P=t.memoizedState,k||X!==P||Ca?(typeof re=="function"&&(Rc(t,l,re,s),P=t.memoizedState),(H=Ca||Lp(t,l,H,s,X,P,y))?(ee||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=P),d.props=s,d.state=P,d.context=y,s=H):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{d=t.stateNode,sc(e,t),y=t.memoizedProps,ee=dl(l,y),d.props=ee,re=t.pendingProps,X=d.context,P=l.contextType,H=Ll,typeof P=="object"&&P!==null&&(H=Yt(P)),k=l.getDerivedStateFromProps,(P=typeof k=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(y!==re||X!==H)&&_p(t,d,s,H),Ca=!1,X=t.memoizedState,d.state=X,Ir(t,s,d,c),Ur();var Z=t.memoizedState;y!==re||X!==Z||Ca||e!==null&&e.dependencies!==null&&Ws(e.dependencies)?(typeof k=="function"&&(Rc(t,l,k,s),Z=t.memoizedState),(ee=Ca||Lp(t,l,ee,s,X,Z,H)||e!==null&&e.dependencies!==null&&Ws(e.dependencies))?(P||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(s,Z,H),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(s,Z,H)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&X===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&X===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=Z),d.props=s,d.state=Z,d.context=H,s=ee):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&X===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&X===e.memoizedState||(t.flags|=1024),s=!1)}return d=s,pi(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=cl(t,e.child,null,c),t.child=cl(t,null,l,c)):Kt(e,t,l,c),t.memoizedState=d.state,e=t.child):e=oa(e,t,c),e}function Xp(e,t,l,s){return al(),t.flags|=256,Kt(e,t,l,s),t.child}var Lc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _c(e){return{baseLanes:e,cachePool:Uf()}}function Oc(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=xn),e}function Qp(e,t,l){var s=t.pendingProps,c=!1,d=(t.flags&128)!==0,y;if((y=d)||(y=e!==null&&e.memoizedState===null?!1:(Et.current&2)!==0),y&&(c=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(We){if(c?Ta(t):Ra(),(e=ft)?(e=rh(e,An),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ja!==null?{id:Gn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=Af(e),l.return=t,t.child=l,qt=t,ft=null)):e=null,e===null)throw ka(t);return yu(e)?t.lanes=32:t.lanes=536870912,null}var k=s.children;return s=s.fallback,c?(Ra(),c=t.mode,k=mi({mode:"hidden",children:k},c),s=nl(s,c,l,null),k.return=t,s.return=t,k.sibling=s,t.child=k,s=t.child,s.memoizedState=_c(l),s.childLanes=Oc(e,y,l),t.memoizedState=Lc,Yr(null,s)):(Ta(t),Bc(t,k))}var H=e.memoizedState;if(H!==null&&(k=H.dehydrated,k!==null)){if(d)t.flags&256?(Ta(t),t.flags&=-257,t=Hc(e,t,l)):t.memoizedState!==null?(Ra(),t.child=e.child,t.flags|=128,t=null):(Ra(),k=s.fallback,c=t.mode,s=mi({mode:"visible",children:s.children},c),k=nl(k,c,l,null),k.flags|=2,s.return=t,k.return=t,s.sibling=k,t.child=s,cl(t,e.child,null,l),s=t.child,s.memoizedState=_c(l),s.childLanes=Oc(e,y,l),t.memoizedState=Lc,t=Yr(null,s));else if(Ta(t),yu(k)){if(y=k.nextSibling&&k.nextSibling.dataset,y)var P=y.dgst;y=P,s=Error(o(419)),s.stack="",s.digest=y,zr({value:s,source:null,stack:null}),t=Hc(e,t,l)}else if(Dt||Hl(e,t,l,!1),y=(l&e.childLanes)!==0,Dt||y){if(y=ut,y!==null&&(s=Od(y,l),s!==0&&s!==H.retryLane))throw H.retryLane=s,tl(e,s),un(y,e,s),Dc;vu(k)||ki(),t=Hc(e,t,l)}else vu(k)?(t.flags|=192,t.child=e.child,t=null):(e=H.treeContext,ft=Dn(k.nextSibling),qt=t,We=!0,Sa=null,An=!1,e!==null&&zf(t,e),t=Bc(t,s.children),t.flags|=4096);return t}return c?(Ra(),k=s.fallback,c=t.mode,H=e.child,P=H.sibling,s=na(H,{mode:"hidden",children:s.children}),s.subtreeFlags=H.subtreeFlags&65011712,P!==null?k=na(P,k):(k=nl(k,c,l,null),k.flags|=2),k.return=t,s.return=t,s.sibling=k,t.child=s,Yr(null,s),s=t.child,k=e.child.memoizedState,k===null?k=_c(l):(c=k.cachePool,c!==null?(H=At._currentValue,c=c.parent!==H?{parent:H,pool:H}:c):c=Uf(),k={baseLanes:k.baseLanes|l,cachePool:c}),s.memoizedState=k,s.childLanes=Oc(e,y,l),t.memoizedState=Lc,Yr(e.child,s)):(Ta(t),l=e.child,e=l.sibling,l=na(l,{mode:"visible",children:s.children}),l.return=t,l.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=l,t.memoizedState=null,l)}function Bc(e,t){return t=mi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function mi(e,t){return e=fn(22,e,null,t),e.lanes=0,e}function Hc(e,t,l){return cl(t,e.child,null,l),e=Bc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Zp(e,t,l){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Jo(e.return,t,l)}function Uc(e,t,l,s,c,d){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:l,tailMode:c,treeForkCount:d}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=s,y.tail=l,y.tailMode=c,y.treeForkCount=d)}function Jp(e,t,l){var s=t.pendingProps,c=s.revealOrder,d=s.tail;s=s.children;var y=Et.current,k=(y&2)!==0;if(k?(y=y&1|2,t.flags|=128):y&=1,ae(Et,y),Kt(e,t,s,l),s=We?Dr:0,!k&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Zp(e,l,t);else if(e.tag===19)Zp(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&&ni(e)===null&&(c=l),l=l.sibling;l=c,l===null?(c=t.child,t.child=null):(c=l.sibling,l.sibling=null),Uc(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&&ni(e)===null){t.child=c;break}e=c.sibling,c.sibling=l,l=c,c=e}Uc(t,!0,l,null,d,s);break;case"together":Uc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function oa(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),Da|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Hl(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=na(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=na(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Ic(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ws(e)))}function Cg(e,t,l){switch(t.tag){case 3:oe(t,t.stateNode.containerInfo),wa(t,At,e.memoizedState.cache),al();break;case 27:case 5:$e(t);break;case 4:oe(t,t.stateNode.containerInfo);break;case 10:wa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,dc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Ta(t),t.flags|=128,null):(l&t.child.childLanes)!==0?Qp(e,t,l):(Ta(t),e=oa(e,t,l),e!==null?e.sibling:null);Ta(t);break;case 19:var c=(e.flags&128)!==0;if(s=(l&t.childLanes)!==0,s||(Hl(e,t,l,!1),s=(l&t.childLanes)!==0),c){if(s)return Jp(e,t,l);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ae(Et,Et.current),s)break;return null;case 22:return t.lanes=0,Yp(e,t,l,t.pendingProps);case 24:wa(t,At,e.memoizedState.cache)}return oa(e,t,l)}function em(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)Dt=!0;else{if(!Ic(e,l)&&(t.flags&128)===0)return Dt=!1,Cg(e,t,l);Dt=(e.flags&131072)!==0}else Dt=!1,We&&(t.flags&1048576)!==0&&Df(t,Dr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=il(t.elementType),t.type=e,typeof e=="function")Yo(e)?(s=dl(e,s),t.tag=1,t=Pp(null,t,e,s,l)):(t.tag=0,t=zc(null,t,e,s,l));else{if(e!=null){var c=e.$$typeof;if(c===I){t.tag=11,t=$p(null,t,e,s,l);break e}else if(c===w){t.tag=14,t=Gp(null,t,e,s,l);break e}}throw t=Q(e)||e,Error(o(306,t,""))}}return t;case 0:return zc(e,t,t.type,t.pendingProps,l);case 1:return s=t.type,c=dl(s,t.pendingProps),Pp(e,t,s,c,l);case 3:e:{if(oe(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var d=t.memoizedState;c=d.element,sc(e,t),Ir(t,s,null,l);var y=t.memoizedState;if(s=y.cache,wa(t,At,s),s!==d.cache&&ec(t,[At],l,!0),Ur(),s=y.element,d.isDehydrated)if(d={element:s,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=Xp(e,t,s,l);break e}else if(s!==c){c=En(Error(o(424)),t),zr(c),t=Xp(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=Dn(e.firstChild),qt=t,We=!0,Sa=null,An=!0,l=Yf(t,null,s,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(al(),s===c){t=oa(e,t,l);break e}Kt(e,t,s,l)}t=t.child}return t;case 26:return pi(e,t),e===null?(l=dh(t.type,null,t.pendingProps,null))?t.memoizedState=l:We||(l=t.type,e=t.pendingProps,s=Ai(he.current).createElement(l),s[Gt]=t,s[an]=e,Ft(s,l,e),Ut(s),t.stateNode=s):t.memoizedState=dh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return $e(t),e===null&&We&&(s=t.stateNode=oh(t.type,t.pendingProps,he.current),qt=t,An=!0,c=ft,Ba(t.type)?(gu=c,ft=Dn(s.firstChild)):ft=c),Kt(e,t,t.pendingProps.children,l),pi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&We&&((c=s=ft)&&(s=t1(s,t.type,t.pendingProps,An),s!==null?(t.stateNode=s,qt=t,ft=Dn(s.firstChild),An=!1,c=!0):c=!1),c||ka(t)),$e(t),c=t.type,d=t.pendingProps,y=e!==null?e.memoizedProps:null,s=d.children,mu(c,d)?s=null:y!==null&&mu(c,y)&&(t.flags|=32),t.memoizedState!==null&&(c=pc(e,t,xg,null,null,l),ss._currentValue=c),pi(e,t),Kt(e,t,s,l),t.child;case 6:return e===null&&We&&((e=l=ft)&&(l=n1(l,t.pendingProps,An),l!==null?(t.stateNode=l,qt=t,ft=null,e=!0):e=!1),e||ka(t)),null;case 13:return Qp(e,t,l);case 4:return oe(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=cl(t,null,s,l):Kt(e,t,s,l),t.child;case 11:return $p(e,t,t.type,t.pendingProps,l);case 7:return Kt(e,t,t.pendingProps,l),t.child;case 8:return Kt(e,t,t.pendingProps.children,l),t.child;case 12:return Kt(e,t,t.pendingProps.children,l),t.child;case 10:return s=t.pendingProps,wa(t,t.type,s.value),Kt(e,t,s.children,l),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,rl(t),c=Yt(c),s=s(c),t.flags|=1,Kt(e,t,s,l),t.child;case 14:return Gp(e,t,t.type,t.pendingProps,l);case 15:return qp(e,t,t.type,t.pendingProps,l);case 19:return Jp(e,t,l);case 31:return wg(e,t,l);case 22:return Yp(e,t,l,t.pendingProps);case 24:return rl(t),s=Yt(At),e===null?(c=ac(),c===null&&(c=ut,d=tc(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=l),c=d),t.memoizedState={parent:s,cache:c},rc(t),wa(t,At,c)):((e.lanes&l)!==0&&(sc(e,t),Ir(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),wa(t,At,s)):(s=d.cache,wa(t,At,s),s!==c.cache&&ec(t,[At],l,!0))),Kt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ca(e){e.flags|=4}function Vc(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(Em())e.flags|=8192;else throw ol=Zs,lc}else e.flags&=-16777217}function tm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!xh(t))if(Em())e.flags|=8192;else throw ol=Zs,lc}function hi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?zd():536870912,e.lanes|=t,Xl|=t)}function Kr(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 Ng(e,t,l){var s=t.pendingProps;switch(Po(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),ra(At),je(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Bl(t)?ca(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Qo())),pt(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(ca(t),d!==null?(pt(t),tm(t,d)):(pt(t),Vc(t,c,null,s,l))):d?d!==e.memoizedState?(ca(t),pt(t),tm(t,d)):(pt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&ca(t),pt(t),Vc(t,c,e,s,l)),null;case 27:if(Be(t),l=he.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ca(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}e=fe.current,Bl(t)?Lf(t):(e=oh(c,s,l),t.stateNode=e,ca(t))}return pt(t),null;case 5:if(Be(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ca(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}if(d=fe.current,Bl(t))Lf(t);else{var y=Ai(he.current);switch(d){case 1:d=y.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=y.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=y.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof s.is=="string"?y.createElement("select",{is:s.is}):y.createElement("select"),s.multiple?d.multiple=!0:s.size&&(d.size=s.size);break;default:d=typeof s.is=="string"?y.createElement(c,{is:s.is}):y.createElement(c)}}d[Gt]=t,d[an]=s;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)d.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.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&&ca(t)}}return pt(t),Vc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&ca(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=he.current,Bl(t)){if(e=t.stateNode,l=t.memoizedProps,s=null,c=qt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[Gt]=t,e=!!(e.nodeValue===l||s!==null&&s.suppressHydrationWarning===!0||Qm(e.nodeValue,l)),e||ka(t,!0)}else e=Ai(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=Bl(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 al(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),e=!1}else l=Qo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(mn(t),t):(mn(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=Bl(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 al(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),c=!1}else c=Qo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(mn(t),t):(mn(t),null)}return mn(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),hi(t,t.updateQueue),pt(t),null);case 4:return je(),e===null&&cu(t.stateNode.containerInfo),pt(t),null;case 10:return ra(t.type),pt(t),null;case 19:if(Y(Et),s=t.memoizedState,s===null)return pt(t),null;if(c=(t.flags&128)!==0,d=s.rendering,d===null)if(c)Kr(s,!1);else{if(wt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=ni(e),d!==null){for(t.flags|=128,Kr(s,!1),e=d.updateQueue,t.updateQueue=e,hi(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Rf(l,e),l=l.sibling;return ae(Et,Et.current&1|2),We&&aa(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&tt()>bi&&(t.flags|=128,c=!0,Kr(s,!1),t.lanes=4194304)}else{if(!c)if(e=ni(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,hi(t,e),Kr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!We)return pt(t),null}else 2*tt()-s.renderingStartTime>bi&&l!==536870912&&(t.flags|=128,c=!0,Kr(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,ae(Et,c?l&1|2:l&1),We&&aa(t,s.treeForkCount),e):(pt(t),null);case 22:case 23:return mn(t),uc(),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&&hi(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&&Y(sl),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),ra(At),pt(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Eg(e,t){switch(Po(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ra(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 Be(t),null;case 31:if(t.memoizedState!==null){if(mn(t),t.alternate===null)throw Error(o(340));al()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(mn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));al()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Y(Et),null;case 4:return je(),null;case 10:return ra(t.type),null;case 22:case 23:return mn(t),uc(),e!==null&&Y(sl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ra(At),null;case 25:return null;default:return null}}function nm(e,t){switch(Po(t),t.tag){case 3:ra(At),je();break;case 26:case 27:case 5:Be(t);break;case 4:je();break;case 31:t.memoizedState!==null&&mn(t);break;case 13:mn(t);break;case 19:Y(Et);break;case 10:ra(t.type);break;case 22:case 23:mn(t),uc(),e!==null&&Y(sl);break;case 24:ra(At)}}function Fr(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,y=l.inst;s=d(),y.destroy=s}l=l.next}while(l!==c)}}catch(k){lt(t,t.return,k)}}function Aa(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 y=s.inst,k=y.destroy;if(k!==void 0){y.destroy=void 0,c=t;var H=l,P=k;try{P()}catch(ee){lt(c,H,ee)}}}s=s.next}while(s!==d)}}catch(ee){lt(t,t.return,ee)}}function am(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{Ff(t,l)}catch(s){lt(e,e.return,s)}}}function lm(e,t,l){l.props=dl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(s){lt(e,t,s)}}function Wr(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 rm(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 $c(e,t,l){try{var s=e.stateNode;Pg(s,e.type,l,t),s[an]=t}catch(c){lt(e,e.return,c)}}function sm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ba(e.type)||e.tag===4}function Gc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||sm(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&&Ba(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 qc(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=ea));else if(s!==4&&(s===27&&Ba(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(qc(e,t,l),e=e.sibling;e!==null;)qc(e,t,l),e=e.sibling}function xi(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&&Ba(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(xi(e,t,l),e=e.sibling;e!==null;)xi(e,t,l),e=e.sibling}function im(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[an]=l}catch(d){lt(e,e.return,d)}}var ua=!1,zt=!1,Yc=!1,om=typeof WeakSet=="function"?WeakSet:Set,It=null;function Tg(e,t){if(e=e.containerInfo,fu=Bi,e=bf(e),Ho(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 y=0,k=-1,H=-1,P=0,ee=0,re=e,X=null;t:for(;;){for(var Z;re!==l||c!==0&&re.nodeType!==3||(k=y+c),re!==d||s!==0&&re.nodeType!==3||(H=y+s),re.nodeType===3&&(y+=re.nodeValue.length),(Z=re.firstChild)!==null;)X=re,re=Z;for(;;){if(re===e)break t;if(X===l&&++P===c&&(k=y),X===d&&++ee===s&&(H=y),(Z=re.nextSibling)!==null)break;re=X,X=re.parentNode}re=Z}l=k===-1||H===-1?null:{start:k,end:H}}else l=null}l=l||{start:0,end:0}}else l=null;for(pu={focusedElem:e,selectionRange:l},Bi=!1,It=t;It!==null;)if(t=It,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,It=e;else for(;It!==null;){switch(t=It,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=dl(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)xu(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":xu(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,It=e;break}It=t.return}}function cm(e,t,l){var s=l.flags;switch(l.tag){case 0:case 11:case 15:fa(e,l),s&4&&Fr(5,l);break;case 1:if(fa(e,l),s&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(y){lt(l,l.return,y)}else{var c=dl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){lt(l,l.return,y)}}s&64&&am(l),s&512&&Wr(l,l.return);break;case 3:if(fa(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{Ff(e,t)}catch(y){lt(l,l.return,y)}}break;case 27:t===null&&s&4&&im(l);case 26:case 5:fa(e,l),t===null&&s&4&&rm(l),s&512&&Wr(l,l.return);break;case 12:fa(e,l);break;case 31:fa(e,l),s&4&&fm(e,l);break;case 13:fa(e,l),s&4&&pm(e,l),s&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Bg.bind(null,l),a1(e,l))));break;case 22:if(s=l.memoizedState!==null||ua,!s){t=t!==null&&t.memoizedState!==null||zt,c=ua;var d=zt;ua=s,(zt=t)&&!d?pa(e,l,(l.subtreeFlags&8772)!==0):fa(e,l),ua=c,zt=d}break;case 30:break;default:fa(e,l)}}function um(e){var t=e.alternate;t!==null&&(e.alternate=null,um(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&jo(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,rn=!1;function da(e,t,l){for(l=l.child;l!==null;)dm(e,t,l),l=l.sibling}function dm(e,t,l){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(Qn,l)}catch{}switch(l.tag){case 26:zt||Yn(l,t),da(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:zt||Yn(l,t);var s=vt,c=rn;Ba(l.type)&&(vt=l.stateNode,rn=!1),da(e,t,l),as(l.stateNode),vt=s,rn=c;break;case 5:zt||Yn(l,t);case 6:if(s=vt,c=rn,vt=null,da(e,t,l),vt=s,rn=c,vt!==null)if(rn)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&&(rn?(e=vt,ah(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),lr(e)):ah(vt,l.stateNode));break;case 4:s=vt,c=rn,vt=l.stateNode.containerInfo,rn=!0,da(e,t,l),vt=s,rn=c;break;case 0:case 11:case 14:case 15:Aa(2,l,t),zt||Aa(4,l,t),da(e,t,l);break;case 1:zt||(Yn(l,t),s=l.stateNode,typeof s.componentWillUnmount=="function"&&lm(l,t,s)),da(e,t,l);break;case 21:da(e,t,l);break;case 22:zt=(s=zt)||l.memoizedState!==null,da(e,t,l),zt=s;break;default:da(e,t,l)}}function fm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{lr(e)}catch(l){lt(t,t.return,l)}}}function pm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{lr(e)}catch(l){lt(t,t.return,l)}}function Rg(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new om),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new om),t;default:throw Error(o(435,e.tag))}}function vi(e,t){var l=Rg(e);t.forEach(function(s){if(!l.has(s)){l.add(s);var c=Hg.bind(null,e,s);s.then(c,c)}})}function sn(e,t){var l=t.deletions;if(l!==null)for(var s=0;s<l.length;s++){var c=l[s],d=e,y=t,k=y;e:for(;k!==null;){switch(k.tag){case 27:if(Ba(k.type)){vt=k.stateNode,rn=!1;break e}break;case 5:vt=k.stateNode,rn=!1;break e;case 3:case 4:vt=k.stateNode.containerInfo,rn=!0;break e}k=k.return}if(vt===null)throw Error(o(160));dm(d,y,c),vt=null,rn=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)mm(t,e),t=t.sibling}var Un=null;function mm(e,t){var l=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:sn(t,e),on(e),s&4&&(Aa(3,e,e.return),Fr(3,e),Aa(5,e,e.return));break;case 1:sn(t,e),on(e),s&512&&(zt||l===null||Yn(l,l.return)),s&64&&ua&&(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(sn(t,e),on(e),s&512&&(zt||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[jr]||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,Ut(d),s=d;break e;case"link":var y=mh("link","href",c).get(s+(l.href||""));if(y){for(var k=0;k<y.length;k++)if(d=y[k],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)){y.splice(k,1);break t}}d=c.createElement(s),Ft(d,s,l),c.head.appendChild(d);break;case"meta":if(y=mh("meta","content",c).get(s+(l.content||""))){for(k=0;k<y.length;k++)if(d=y[k],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)){y.splice(k,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,Ut(d),s=d}e.stateNode=s}else hh(c,e.type,e.stateNode);else e.stateNode=ph(c,s,e.memoizedProps);else d!==s?(d===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):d.count--,s===null?hh(c,e.type,e.stateNode):ph(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&$c(e,e.memoizedProps,l.memoizedProps)}break;case 27:sn(t,e),on(e),s&512&&(zt||l===null||Yn(l,l.return)),l!==null&&s&4&&$c(e,e.memoizedProps,l.memoizedProps);break;case 5:if(sn(t,e),on(e),s&512&&(zt||l===null||Yn(l,l.return)),e.flags&32){c=e.stateNode;try{El(c,"")}catch(be){lt(e,e.return,be)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,$c(e,c,l!==null?l.memoizedProps:c)),s&1024&&(Yc=!0);break;case 6:if(sn(t,e),on(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(zi=null,c=Un,Un=Mi(t.containerInfo),sn(t,e),Un=c,on(e),s&4&&l!==null&&l.memoizedState.isDehydrated)try{lr(t.containerInfo)}catch(be){lt(e,e.return,be)}Yc&&(Yc=!1,hm(e));break;case 4:s=Un,Un=Mi(e.stateNode.containerInfo),sn(t,e),on(e),Un=s;break;case 12:sn(t,e),on(e);break;case 31:sn(t,e),on(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,vi(e,s)));break;case 13:sn(t,e),on(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(gi=tt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,vi(e,s)));break;case 22:c=e.memoizedState!==null;var H=l!==null&&l.memoizedState!==null,P=ua,ee=zt;if(ua=P||c,zt=ee||H,sn(t,e),zt=ee,ua=P,on(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(l===null||H||ua||zt||fl(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){H=l=t;try{if(d=H.stateNode,c)y=d.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{k=H.stateNode;var re=H.memoizedProps.style,X=re!=null&&re.hasOwnProperty("display")?re.display:null;k.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 Z=H.stateNode;c?lh(Z,!0):lh(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,vi(e,l))));break;case 19:sn(t,e),on(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,vi(e,s)));break;case 30:break;case 21:break;default:sn(t,e),on(e)}}function on(e){var t=e.flags;if(t&2){try{for(var l,s=e.return;s!==null;){if(sm(s)){l=s;break}s=s.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var c=l.stateNode,d=Gc(e);xi(e,d,c);break;case 5:var y=l.stateNode;l.flags&32&&(El(y,""),l.flags&=-33);var k=Gc(e);xi(e,k,y);break;case 3:case 4:var H=l.stateNode.containerInfo,P=Gc(e);qc(e,P,H);break;default:throw Error(o(161))}}catch(ee){lt(e,e.return,ee)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function hm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;hm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function fa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cm(e,t.alternate,t),t=t.sibling}function fl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Aa(4,t,t.return),fl(t);break;case 1:Yn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&lm(t,t.return,l),fl(t);break;case 27:as(t.stateNode);case 26:case 5:Yn(t,t.return),fl(t);break;case 22:t.memoizedState===null&&fl(t);break;case 30:fl(t);break;default:fl(t)}e=e.sibling}}function pa(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,d=t,y=d.flags;switch(d.tag){case 0:case 11:case 15:pa(c,d,l),Fr(4,d);break;case 1:if(pa(c,d,l),s=d,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(P){lt(s,s.return,P)}if(s=d,c=s.updateQueue,c!==null){var k=s.stateNode;try{var H=c.shared.hiddenCallbacks;if(H!==null)for(c.shared.hiddenCallbacks=null,c=0;c<H.length;c++)Kf(H[c],k)}catch(P){lt(s,s.return,P)}}l&&y&64&&am(d),Wr(d,d.return);break;case 27:im(d);case 26:case 5:pa(c,d,l),l&&s===null&&y&4&&rm(d),Wr(d,d.return);break;case 12:pa(c,d,l);break;case 31:pa(c,d,l),l&&y&4&&fm(c,d);break;case 13:pa(c,d,l),l&&y&4&&pm(c,d);break;case 22:d.memoizedState===null&&pa(c,d,l),Wr(d,d.return);break;case 30:break;default:pa(c,d,l)}t=t.sibling}}function Kc(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&&Lr(l))}function Fc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Lr(e))}function In(e,t,l,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xm(e,t,l,s),t=t.sibling}function xm(e,t,l,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:In(e,t,l,s),c&2048&&Fr(9,t);break;case 1:In(e,t,l,s);break;case 3:In(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&&Lr(e)));break;case 12:if(c&2048){In(e,t,l,s),e=t.stateNode;try{var d=t.memoizedProps,y=d.id,k=d.onPostCommit;typeof k=="function"&&k(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(H){lt(t,t.return,H)}}else In(e,t,l,s);break;case 31:In(e,t,l,s);break;case 13:In(e,t,l,s);break;case 23:break;case 22:d=t.stateNode,y=t.alternate,t.memoizedState!==null?d._visibility&2?In(e,t,l,s):Pr(e,t):d._visibility&2?In(e,t,l,s):(d._visibility|=2,Fl(e,t,l,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Kc(y,t);break;case 24:In(e,t,l,s),c&2048&&Fc(t.alternate,t);break;default:In(e,t,l,s)}}function Fl(e,t,l,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,y=t,k=l,H=s,P=y.flags;switch(y.tag){case 0:case 11:case 15:Fl(d,y,k,H,c),Fr(8,y);break;case 23:break;case 22:var ee=y.stateNode;y.memoizedState!==null?ee._visibility&2?Fl(d,y,k,H,c):Pr(d,y):(ee._visibility|=2,Fl(d,y,k,H,c)),c&&P&2048&&Kc(y.alternate,y);break;case 24:Fl(d,y,k,H,c),c&&P&2048&&Fc(y.alternate,y);break;default:Fl(d,y,k,H,c)}t=t.sibling}}function Pr(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:Pr(l,s),c&2048&&Kc(s.alternate,s);break;case 24:Pr(l,s),c&2048&&Fc(s.alternate,s);break;default:Pr(l,s)}t=t.sibling}}var Xr=8192;function Wl(e,t,l){if(e.subtreeFlags&Xr)for(e=e.child;e!==null;)vm(e,t,l),e=e.sibling}function vm(e,t,l){switch(e.tag){case 26:Wl(e,t,l),e.flags&Xr&&e.memoizedState!==null&&h1(l,Un,e.memoizedState,e.memoizedProps);break;case 5:Wl(e,t,l);break;case 3:case 4:var s=Un;Un=Mi(e.stateNode.containerInfo),Wl(e,t,l),Un=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Xr,Xr=16777216,Wl(e,t,l),Xr=s):Wl(e,t,l));break;default:Wl(e,t,l)}}function ym(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 Qr(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];It=s,bm(s,e)}ym(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)gm(e),e=e.sibling}function gm(e){switch(e.tag){case 0:case 11:case 15:Qr(e),e.flags&2048&&Aa(9,e,e.return);break;case 3:Qr(e);break;case 12:Qr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,yi(e)):Qr(e);break;default:Qr(e)}}function yi(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];It=s,bm(s,e)}ym(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Aa(8,t,t.return),yi(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,yi(t));break;default:yi(t)}e=e.sibling}}function bm(e,t){for(;It!==null;){var l=It;switch(l.tag){case 0:case 11:case 15:Aa(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:Lr(l.memoizedState.cache)}if(s=l.child,s!==null)s.return=l,It=s;else e:for(l=e;It!==null;){s=It;var c=s.sibling,d=s.return;if(um(s),s===l){It=null;break e}if(c!==null){c.return=d,It=c;break e}It=d}}}var Ag={getCacheForType:function(e){var t=Yt(At),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return Yt(At).controller.signal}},Mg=typeof WeakMap=="function"?WeakMap:Map,Je=0,ut=null,Ge=null,Ye=0,at=0,hn=null,Ma=!1,Pl=!1,Wc=!1,ma=0,wt=0,Da=0,pl=0,Pc=0,xn=0,Xl=0,Zr=null,cn=null,Xc=!1,gi=0,jm=0,bi=1/0,ji=null,za=null,_t=0,La=null,Ql=null,ha=0,Qc=0,Zc=null,Sm=null,Jr=0,Jc=null;function vn(){return(Je&2)!==0&&Ye!==0?Ye&-Ye:A.T!==null?ru():Bd()}function km(){if(xn===0)if((Ye&536870912)===0||We){var e=Ht;Ht<<=1,(Ht&3932160)===0&&(Ht=262144),xn=e}else xn=536870912;return e=pn.current,e!==null&&(e.flags|=32),xn}function un(e,t,l){(e===ut&&(at===2||at===9)||e.cancelPendingCommit!==null)&&(Zl(e,0),_a(e,Ye,xn,!1)),br(e,l),((Je&2)===0||e!==ut)&&(e===ut&&((Je&2)===0&&(pl|=l),wt===4&&_a(e,Ye,xn,!1)),Kn(e))}function wm(e,t,l){if((Je&6)!==0)throw Error(o(327));var s=!l&&(t&127)===0&&(t&e.expiredLanes)===0||kn(e,t),c=s?Lg(e,t):tu(e,t,!0),d=s;do{if(c===0){Pl&&!s&&_a(e,t,0,!1);break}else{if(l=e.current.alternate,d&&!Dg(l)){c=tu(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var k=e;c=Zr;var H=k.current.memoizedState.isDehydrated;if(H&&(Zl(k,y).flags|=256),y=tu(k,y,!1),y!==2){if(Wc&&!H){k.errorRecoveryDisabledLanes|=d,pl|=d,c=4;break e}d=cn,cn=c,d!==null&&(cn===null?cn=d:cn.push.apply(cn,d))}c=y}if(d=!1,c!==2)continue}}if(c===1){Zl(e,0),_a(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:_a(s,t,xn,!Ma);break e;case 2:cn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=gi+300-tt(),10<c)){if(_a(s,t,xn,!Ma),gr(s,0,!0)!==0)break e;ha=t,s.timeoutHandle=th(Cm.bind(null,s,l,cn,ji,Xc,t,xn,pl,Xl,Ma,d,"Throttled",-0,0),c);break e}Cm(s,l,cn,ji,Xc,t,xn,pl,Xl,Ma,d,null,-0,0)}}break}while(!0);Kn(e)}function Cm(e,t,l,s,c,d,y,k,H,P,ee,re,X,Z){if(e.timeoutHandle=-1,re=t.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ea},vm(t,d,re);var be=(d&62914560)===d?gi-tt():(d&4194048)===d?jm-tt():0;if(be=x1(re,be),be!==null){ha=d,e.cancelPendingCommit=be(zm.bind(null,e,t,d,l,s,c,y,k,H,ee,re,null,X,Z)),_a(e,d,y,!P);return}}zm(e,t,d,l,s,c,y,k,H)}function Dg(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(!dn(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 _a(e,t,l,s){t&=~Pc,t&=~pl,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var d=31-bt(c),y=1<<d;s[d]=-1,c&=~y}l!==0&&Ld(e,l,t)}function Si(){return(Je&6)===0?(es(0),!1):!0}function eu(){if(Ge!==null){if(at===0)var e=Ge.return;else e=Ge,la=ll=null,xc(e),$l=null,Or=0,e=Ge;for(;e!==null;)nm(e.alternate,e),e=e.return;Ge=null}}function Zl(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,Zg(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),ha=0,eu(),ut=e,Ge=l=na(e.current,null),Ye=t,at=0,hn=null,Ma=!1,Pl=kn(e,t),Wc=!1,Xl=xn=Pc=pl=Da=wt=0,cn=Zr=null,Xc=!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 ma=t,Gs(),l}function Nm(e,t){Oe=null,A.H=qr,t===Vl||t===Qs?(t=$f(),at=3):t===lc?(t=$f(),at=4):at=t===Dc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,hn=t,Ge===null&&(wt=1,di(e,En(t,e.current)))}function Em(){var e=pn.current;return e===null?!0:(Ye&4194048)===Ye?Mn===null:(Ye&62914560)===Ye||(Ye&536870912)!==0?e===Mn:!1}function Tm(){var e=A.H;return A.H=qr,e===null?qr:e}function Rm(){var e=A.A;return A.A=Ag,e}function ki(){wt=4,Ma||(Ye&4194048)!==Ye&&pn.current!==null||(Pl=!0),(Da&134217727)===0&&(pl&134217727)===0||ut===null||_a(ut,Ye,xn,!1)}function tu(e,t,l){var s=Je;Je|=2;var c=Tm(),d=Rm();(ut!==e||Ye!==t)&&(ji=null,Zl(e,t)),t=!1;var y=wt;e:do try{if(at!==0&&Ge!==null){var k=Ge,H=hn;switch(at){case 8:eu(),y=6;break e;case 3:case 2:case 9:case 6:pn.current===null&&(t=!0);var P=at;if(at=0,hn=null,Jl(e,k,H,P),l&&Pl){y=0;break e}break;default:P=at,at=0,hn=null,Jl(e,k,H,P)}}zg(),y=wt;break}catch(ee){Nm(e,ee)}while(!0);return t&&e.shellSuspendCounter++,la=ll=null,Je=s,A.H=c,A.A=d,Ge===null&&(ut=null,Ye=0,Gs()),y}function zg(){for(;Ge!==null;)Am(Ge)}function Lg(e,t){var l=Je;Je|=2;var s=Tm(),c=Rm();ut!==e||Ye!==t?(ji=null,bi=tt()+500,Zl(e,t)):Pl=kn(e,t);e:do try{if(at!==0&&Ge!==null){t=Ge;var d=hn;t:switch(at){case 1:at=0,hn=null,Jl(e,t,d,1);break;case 2:case 9:if(If(d)){at=0,hn=null,Mm(t);break}t=function(){at!==2&&at!==9||ut!==e||(at=7),Kn(e)},d.then(t,t);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:If(d)?(at=0,hn=null,Mm(t)):(at=0,hn=null,Jl(e,t,d,7));break;case 5:var y=null;switch(Ge.tag){case 26:y=Ge.memoizedState;case 5:case 27:var k=Ge;if(y?xh(y):k.stateNode.complete){at=0,hn=null;var H=k.sibling;if(H!==null)Ge=H;else{var P=k.return;P!==null?(Ge=P,wi(P)):Ge=null}break t}}at=0,hn=null,Jl(e,t,d,5);break;case 6:at=0,hn=null,Jl(e,t,d,6);break;case 8:eu(),wt=6;break e;default:throw Error(o(462))}}_g();break}catch(ee){Nm(e,ee)}while(!0);return la=ll=null,A.H=s,A.A=c,Je=l,Ge!==null?0:(ut=null,Ye=0,Gs(),wt)}function _g(){for(;Ge!==null&&!Vt();)Am(Ge)}function Am(e){var t=em(e.alternate,e,ma);e.memoizedProps=e.pendingProps,t===null?wi(e):Ge=t}function Mm(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=Wp(l,t,t.pendingProps,t.type,void 0,Ye);break;case 11:t=Wp(l,t,t.pendingProps,t.type.render,t.ref,Ye);break;case 5:xc(t);default:nm(l,t),t=Ge=Rf(t,ma),t=em(l,t,ma)}e.memoizedProps=e.pendingProps,t===null?wi(e):Ge=t}function Jl(e,t,l,s){la=ll=null,xc(t),$l=null,Or=0;var c=t.return;try{if(kg(e,c,t,l,Ye)){wt=1,di(e,En(l,e.current)),Ge=null;return}}catch(d){if(c!==null)throw Ge=c,d;wt=1,di(e,En(l,e.current)),Ge=null;return}t.flags&32768?(We||s===1?e=!0:Pl||(Ye&536870912)!==0?e=!1:(Ma=e=!0,(s===2||s===9||s===3||s===6)&&(s=pn.current,s!==null&&s.tag===13&&(s.flags|=16384))),Dm(t,e)):wi(t)}function wi(e){var t=e;do{if((t.flags&32768)!==0){Dm(t,Ma);return}e=t.return;var l=Ng(t.alternate,t,ma);if(l!==null){Ge=l;return}if(t=t.sibling,t!==null){Ge=t;return}Ge=t=e}while(t!==null);wt===0&&(wt=5)}function Dm(e,t){do{var l=Eg(e.alternate,e);if(l!==null){l.flags&=32767,Ge=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){Ge=e;return}Ge=e=l}while(e!==null);wt=6,Ge=null}function zm(e,t,l,s,c,d,y,k,H){e.cancelPendingCommit=null;do Ci();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|=Go,my(e,l,d,y,k,H),e===ut&&(Ge=ut=null,Ye=0),Ql=t,La=e,ha=l,Qc=d,Zc=c,Sm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Ug(De,function(){return Hm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=A.T,A.T=null,c=B.p,B.p=2,y=Je,Je|=4;try{Tg(e,t,l)}finally{Je=y,B.p=c,A.T=s}}_t=1,Lm(),_m(),Om()}}function Lm(){if(_t===1){_t=0;var e=La,t=Ql,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=A.T,A.T=null;var s=B.p;B.p=2;var c=Je;Je|=4;try{mm(t,e);var d=pu,y=bf(e.containerInfo),k=d.focusedElem,H=d.selectionRange;if(y!==k&&k&&k.ownerDocument&&gf(k.ownerDocument.documentElement,k)){if(H!==null&&Ho(k)){var P=H.start,ee=H.end;if(ee===void 0&&(ee=P),"selectionStart"in k)k.selectionStart=P,k.selectionEnd=Math.min(ee,k.value.length);else{var re=k.ownerDocument||document,X=re&&re.defaultView||window;if(X.getSelection){var Z=X.getSelection(),be=k.textContent.length,Te=Math.min(H.start,be),it=H.end===void 0?Te:Math.min(H.end,be);!Z.extend&&Te>it&&(y=it,it=Te,Te=y);var G=yf(k,Te),V=yf(k,it);if(G&&V&&(Z.rangeCount!==1||Z.anchorNode!==G.node||Z.anchorOffset!==G.offset||Z.focusNode!==V.node||Z.focusOffset!==V.offset)){var W=re.createRange();W.setStart(G.node,G.offset),Z.removeAllRanges(),Te>it?(Z.addRange(W),Z.extend(V.node,V.offset)):(W.setEnd(V.node,V.offset),Z.addRange(W))}}}}for(re=[],Z=k;Z=Z.parentNode;)Z.nodeType===1&&re.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<re.length;k++){var le=re[k];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}Bi=!!fu,pu=fu=null}finally{Je=c,B.p=s,A.T=l}}e.current=t,_t=2}}function _m(){if(_t===2){_t=0;var e=La,t=Ql,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=A.T,A.T=null;var s=B.p;B.p=2;var c=Je;Je|=4;try{cm(e,t.alternate,t)}finally{Je=c,B.p=s,A.T=l}}_t=3}}function Om(){if(_t===4||_t===3){_t=0,$t();var e=La,t=Ql,l=ha,s=Sm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?_t=5:(_t=0,Ql=La=null,Bm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(za=null),go(l),t=t.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(Qn,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=A.T,c=B.p,B.p=2,A.T=null;try{for(var d=e.onRecoverableError,y=0;y<s.length;y++){var k=s[y];d(k.value,{componentStack:k.stack})}}finally{A.T=t,B.p=c}}(ha&3)!==0&&Ci(),Kn(e),c=e.pendingLanes,(l&261930)!==0&&(c&42)!==0?e===Jc?Jr++:(Jr=0,Jc=e):Jr=0,es(0)}}function Bm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Lr(t)))}function Ci(){return Lm(),_m(),Om(),Hm()}function Hm(){if(_t!==5)return!1;var e=La,t=Qc;Qc=0;var l=go(ha),s=A.T,c=B.p;try{B.p=32>l?32:l,A.T=null,l=Zc,Zc=null;var d=La,y=ha;if(_t=0,Ql=La=null,ha=0,(Je&6)!==0)throw Error(o(331));var k=Je;if(Je|=4,gm(d.current),xm(d,d.current,y,l),Je=k,es(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Qn,d)}catch{}return!0}finally{B.p=c,A.T=s,Bm(e,t)}}function Um(e,t,l){t=En(l,t),t=Mc(e.stateNode,t,2),e=Ea(e,t,2),e!==null&&(br(e,2),Kn(e))}function lt(e,t,l){if(e.tag===3)Um(e,e,l);else for(;t!==null;){if(t.tag===3){Um(t,e,l);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(za===null||!za.has(s))){e=En(l,e),l=Ip(2),s=Ea(t,l,2),s!==null&&(Vp(l,s,t,e),br(s,2),Kn(s));break}}t=t.return}}function nu(e,t,l){var s=e.pingCache;if(s===null){s=e.pingCache=new Mg;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)||(Wc=!0,c.add(l),e=Og.bind(null,e,t,l),t.then(e,e))}function Og(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()-gi?(Je&2)===0&&Zl(e,0):Pc|=l,Xl===Ye&&(Xl=0)),Kn(e)}function Im(e,t){t===0&&(t=zd()),e=tl(e,t),e!==null&&(br(e,t),Kn(e))}function Bg(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Im(e,l)}function Hg(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),Im(e,l)}function Ug(e,t){return Zt(e,t)}var Ni=null,er=null,au=!1,Ei=!1,lu=!1,Oa=0;function Kn(e){e!==er&&e.next===null&&(er===null?Ni=er=e:er=er.next=e),Ei=!0,au||(au=!0,Vg())}function es(e,t){if(!lu&&Ei){lu=!0;do for(var l=!1,s=Ni;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var d=0;else{var y=s.suspendedLanes,k=s.pingedLanes;d=(1<<31-bt(42|e)+1)-1,d&=c&~(y&~k),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(l=!0,qm(s,d))}else d=Ye,d=gr(s,s===ut?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||kn(s,d)||(l=!0,qm(s,d));s=s.next}while(l);lu=!1}}function Ig(){Vm()}function Vm(){Ei=au=!1;var e=0;Oa!==0&&Qg()&&(e=Oa);for(var t=tt(),l=null,s=Ni;s!==null;){var c=s.next,d=$m(s,t);d===0?(s.next=null,l===null?Ni=c:l.next=c,c===null&&(er=l)):(l=s,(e!==0||(d&3)!==0)&&(Ei=!0)),s=c}_t!==0&&_t!==5||es(e),Oa!==0&&(Oa=0)}function $m(e,t){for(var l=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var y=31-bt(d),k=1<<y,H=c[y];H===-1?((k&l)===0||(k&s)!==0)&&(c[y]=xo(k,t)):H<=t&&(e.expiredLanes|=k),d&=~k}if(t=ut,l=Ye,l=gr(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||kn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(s!==null&&ct(s),go(l)){case 2:case 8:l=Rt;break;case 32:l=De;break;case 268435456:l=Wt;break;default:l=De}return s=Gm.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 Gm(e,t){if(_t!==0&&_t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Ci()&&e.callbackNode!==l)return null;var s=Ye;return s=gr(e,e===ut?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(wm(e,s,t),$m(e,tt()),e.callbackNode!=null&&e.callbackNode===l?Gm.bind(null,e):null)}function qm(e,t){if(Ci())return null;wm(e,t,!0)}function Vg(){Jg(function(){(Je&6)!==0?Zt(xe,Ig):Vm()})}function ru(){if(Oa===0){var e=Ul;e===0&&(e=Ie,Ie<<=1,(Ie&261888)===0&&(Ie=256)),Oa=e}return Oa}function Ym(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:_s(""+e)}function Km(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 $g(e,t,l,s,c){if(t==="submit"&&l&&l.stateNode===c){var d=Ym((c[an]||null).action),y=s.submitter;y&&(t=(t=y[an]||null)?Ym(t.formAction):y.getAttribute("formAction"),t!==null&&(d=t,y=null));var k=new Us("action","action",null,s,c);e.push({event:k,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Oa!==0){var H=y?Km(c,y):new FormData(c);Cc(l,{pending:!0,data:H,method:c.method,action:d},null,H)}}else typeof d=="function"&&(k.preventDefault(),H=y?Km(c,y):new FormData(c),Cc(l,{pending:!0,data:H,method:c.method,action:d},d,H))},currentTarget:c}]})}}for(var su=0;su<$o.length;su++){var iu=$o[su],Gg=iu.toLowerCase(),qg=iu[0].toUpperCase()+iu.slice(1);Hn(Gg,"on"+qg)}Hn(kf,"onAnimationEnd"),Hn(wf,"onAnimationIteration"),Hn(Cf,"onAnimationStart"),Hn("dblclick","onDoubleClick"),Hn("focusin","onFocus"),Hn("focusout","onBlur"),Hn(sg,"onTransitionRun"),Hn(ig,"onTransitionStart"),Hn(og,"onTransitionCancel"),Hn(Nf,"onTransitionEnd"),Cl("onMouseEnter",["mouseout","mouseover"]),Cl("onMouseLeave",["mouseout","mouseover"]),Cl("onPointerEnter",["pointerout","pointerover"]),Cl("onPointerLeave",["pointerout","pointerover"]),Qa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Qa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Qa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Qa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Qa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Qa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ts="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(" "),Yg=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ts));function Fm(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 y=s.length-1;0<=y;y--){var k=s[y],H=k.instance,P=k.currentTarget;if(k=k.listener,H!==d&&c.isPropagationStopped())break e;d=k,c.currentTarget=P;try{d(c)}catch(ee){$s(ee)}c.currentTarget=null,d=H}else for(y=0;y<s.length;y++){if(k=s[y],H=k.instance,P=k.currentTarget,k=k.listener,H!==d&&c.isPropagationStopped())break e;d=k,c.currentTarget=P;try{d(c)}catch(ee){$s(ee)}c.currentTarget=null,d=H}}}}function qe(e,t){var l=t[bo];l===void 0&&(l=t[bo]=new Set);var s=e+"__bubble";l.has(s)||(Wm(t,e,2,!1),l.add(s))}function ou(e,t,l){var s=0;t&&(s|=4),Wm(l,e,s,t)}var Ti="_reactListening"+Math.random().toString(36).slice(2);function cu(e){if(!e[Ti]){e[Ti]=!0,Id.forEach(function(l){l!=="selectionchange"&&(Yg.has(l)||ou(l,!1,e),ou(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ti]||(t[Ti]=!0,ou("selectionchange",!1,t))}}function Wm(e,t,l,s){switch(kh(t)){case 2:var c=g1;break;case 8:c=b1;break;default:c=wu}l=c.bind(null,t,l,e),c=void 0,!Ro||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 uu(e,t,l,s,c){var d=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var y=s.tag;if(y===3||y===4){var k=s.stateNode.containerInfo;if(k===c)break;if(y===4)for(y=s.return;y!==null;){var H=y.tag;if((H===3||H===4)&&y.stateNode.containerInfo===c)return;y=y.return}for(;k!==null;){if(y=Sl(k),y===null)return;if(H=y.tag,H===5||H===6||H===26||H===27){s=d=y;continue e}k=k.parentNode}}s=s.return}Zd(function(){var P=d,ee=Eo(l),re=[];e:{var X=Ef.get(e);if(X!==void 0){var Z=Us,be=e;switch(e){case"keypress":if(Bs(l)===0)break e;case"keydown":case"keyup":Z=Hy;break;case"focusin":be="focus",Z=zo;break;case"focusout":be="blur",Z=zo;break;case"beforeblur":case"afterblur":Z=zo;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":Z=tf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=Ny;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=Vy;break;case kf:case wf:case Cf:Z=Ry;break;case Nf:Z=Gy;break;case"scroll":case"scrollend":Z=wy;break;case"wheel":Z=Yy;break;case"copy":case"cut":case"paste":Z=My;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=af;break;case"toggle":case"beforetoggle":Z=Fy}var Te=(t&4)!==0,it=!Te&&(e==="scroll"||e==="scrollend"),G=Te?X!==null?X+"Capture":null:X;Te=[];for(var V=P,W;V!==null;){var le=V;if(W=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||W===null||G===null||(le=kr(V,G),le!=null&&Te.push(ns(V,le,W))),it)break;V=V.return}0<Te.length&&(X=new Z(X,be,null,l,ee),re.push({event:X,listeners:Te}))}}if((t&7)===0){e:{if(X=e==="mouseover"||e==="pointerover",Z=e==="mouseout"||e==="pointerout",X&&l!==No&&(be=l.relatedTarget||l.fromElement)&&(Sl(be)||be[jl]))break e;if((Z||X)&&(X=ee.window===ee?ee:(X=ee.ownerDocument)?X.defaultView||X.parentWindow:window,Z?(be=l.relatedTarget||l.toElement,Z=P,be=be?Sl(be):null,be!==null&&(it=m(be),Te=be.tag,be!==it||Te!==5&&Te!==27&&Te!==6)&&(be=null)):(Z=null,be=P),Z!==be)){if(Te=tf,le="onMouseLeave",G="onMouseEnter",V="mouse",(e==="pointerout"||e==="pointerover")&&(Te=af,le="onPointerLeave",G="onPointerEnter",V="pointer"),it=Z==null?X:Sr(Z),W=be==null?X:Sr(be),X=new Te(le,V+"leave",Z,l,ee),X.target=it,X.relatedTarget=W,le=null,Sl(ee)===P&&(Te=new Te(G,V+"enter",be,l,ee),Te.target=W,Te.relatedTarget=it,le=Te),it=le,Z&&be)t:{for(Te=Kg,G=Z,V=be,W=0,le=G;le;le=Te(le))W++;le=0;for(var Ee=V;Ee;Ee=Te(Ee))le++;for(;0<W-le;)G=Te(G),W--;for(;0<le-W;)V=Te(V),le--;for(;W--;){if(G===V||V!==null&&G===V.alternate){Te=G;break t}G=Te(G),V=Te(V)}Te=null}else Te=null;Z!==null&&Pm(re,X,Z,Te,!1),be!==null&&it!==null&&Pm(re,it,be,Te,!0)}}e:{if(X=P?Sr(P):window,Z=X.nodeName&&X.nodeName.toLowerCase(),Z==="select"||Z==="input"&&X.type==="file")var Xe=ff;else if(uf(X))if(pf)Xe=ag;else{Xe=tg;var Se=eg}else Z=X.nodeName,!Z||Z.toLowerCase()!=="input"||X.type!=="checkbox"&&X.type!=="radio"?P&&Co(P.elementType)&&(Xe=ff):Xe=ng;if(Xe&&(Xe=Xe(e,P))){df(re,Xe,l,ee);break e}Se&&Se(e,X,P),e==="focusout"&&P&&X.type==="number"&&P.memoizedProps.value!=null&&wo(X,"number",X.value)}switch(Se=P?Sr(P):window,e){case"focusin":(uf(Se)||Se.contentEditable==="true")&&(Ml=Se,Uo=P,Mr=null);break;case"focusout":Mr=Uo=Ml=null;break;case"mousedown":Io=!0;break;case"contextmenu":case"mouseup":case"dragend":Io=!1,jf(re,l,ee);break;case"selectionchange":if(rg)break;case"keydown":case"keyup":jf(re,l,ee)}var He;if(_o)e:{switch(e){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else Al?of(e,l)&&(Ke="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Ke="onCompositionStart");Ke&&(lf&&l.locale!=="ko"&&(Al||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&Al&&(He=Jd()):(ba=ee,Ao="value"in ba?ba.value:ba.textContent,Al=!0)),Se=Ri(P,Ke),0<Se.length&&(Ke=new nf(Ke,e,null,l,ee),re.push({event:Ke,listeners:Se}),He?Ke.data=He:(He=cf(l),He!==null&&(Ke.data=He)))),(He=Py?Xy(e,l):Qy(e,l))&&(Ke=Ri(P,"onBeforeInput"),0<Ke.length&&(Se=new nf("onBeforeInput","beforeinput",null,l,ee),re.push({event:Se,listeners:Ke}),Se.data=He)),$g(re,e,P,l,ee)}Fm(re,t)})}function ns(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Ri(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=kr(e,l),c!=null&&s.unshift(ns(e,c,d)),c=kr(e,t),c!=null&&s.push(ns(e,c,d))),e.tag===3)return s;e=e.return}return[]}function Kg(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Pm(e,t,l,s,c){for(var d=t._reactName,y=[];l!==null&&l!==s;){var k=l,H=k.alternate,P=k.stateNode;if(k=k.tag,H!==null&&H===s)break;k!==5&&k!==26&&k!==27||P===null||(H=P,c?(P=kr(l,d),P!=null&&y.unshift(ns(l,P,H))):c||(P=kr(l,d),P!=null&&y.push(ns(l,P,H)))),l=l.return}y.length!==0&&e.push({event:t,listeners:y})}var Fg=/\r\n?/g,Wg=/\u0000|\uFFFD/g;function Xm(e){return(typeof e=="string"?e:""+e).replace(Fg,`
|
|
50
|
+
`).replace(Wg,"")}function Qm(e,t){return t=Xm(t),Xm(e)===t}function st(e,t,l,s,c,d){switch(l){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||El(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&El(e,""+s);break;case"className":zs(e,"class",s);break;case"tabIndex":zs(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":zs(e,l,s);break;case"style":Xd(e,s,d);break;case"data":if(t!=="object"){zs(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=_s(""+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=_s(""+s),e.setAttribute(l,s);break;case"onClick":s!=null&&(e.onclick=ea);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=_s(""+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),Ds(e,"popover",s);break;case"xlinkActuate":Jn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Jn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Jn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Jn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Jn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Jn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Ds(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=Sy.get(l)||l,Ds(e,l,s))}}function du(e,t,l,s,c,d){switch(l){case"style":Xd(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"?El(e,s):(typeof s=="number"||typeof s=="bigint")&&El(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=ea);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Vd.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[an]||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,""):Ds(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 y=l[d];if(y!=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,y,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 k=d=y=c=null,H=null,P=null;for(s in l)if(l.hasOwnProperty(s)){var ee=l[s];if(ee!=null)switch(s){case"name":c=ee;break;case"type":y=ee;break;case"checked":H=ee;break;case"defaultChecked":P=ee;break;case"value":d=ee;break;case"defaultValue":k=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(o(137,t));break;default:st(e,t,s,ee,l,null)}}Kd(e,d,k,H,P,y,c,!1);return;case"select":qe("invalid",e),s=y=d=null;for(c in l)if(l.hasOwnProperty(c)&&(k=l[c],k!=null))switch(c){case"value":d=k;break;case"defaultValue":y=k;break;case"multiple":s=k;default:st(e,t,c,k,l,null)}t=d,l=y,e.multiple=!!s,t!=null?Nl(e,!!s,t,!1):l!=null&&Nl(e,!!s,l,!0);return;case"textarea":qe("invalid",e),d=c=s=null;for(y in l)if(l.hasOwnProperty(y)&&(k=l[y],k!=null))switch(y){case"value":s=k;break;case"defaultValue":c=k;break;case"children":d=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(o(91));break;default:st(e,t,y,k,l,null)}Wd(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<ts.length;s++)qe(ts[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(P in l)if(l.hasOwnProperty(P)&&(s=l[P],s!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,P,s,l,null)}return;default:if(Co(t)){for(ee in l)l.hasOwnProperty(ee)&&(s=l[ee],s!==void 0&&du(e,t,ee,s,l,void 0));return}}for(k in l)l.hasOwnProperty(k)&&(s=l[k],s!=null&&st(e,t,k,s,l,null))}function Pg(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,y=null,k=null,H=null,P=null,ee=null;for(Z in l){var re=l[Z];if(l.hasOwnProperty(Z)&&re!=null)switch(Z){case"checked":break;case"value":break;case"defaultValue":H=re;default:s.hasOwnProperty(Z)||st(e,t,Z,null,s,re)}}for(var X in s){var Z=s[X];if(re=l[X],s.hasOwnProperty(X)&&(Z!=null||re!=null))switch(X){case"type":d=Z;break;case"name":c=Z;break;case"checked":P=Z;break;case"defaultChecked":ee=Z;break;case"value":y=Z;break;case"defaultValue":k=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(o(137,t));break;default:Z!==re&&st(e,t,X,Z,s,re)}}ko(e,y,k,H,P,ee,d,c);return;case"select":Z=y=k=X=null;for(d in l)if(H=l[d],l.hasOwnProperty(d)&&H!=null)switch(d){case"value":break;case"multiple":Z=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":k=d;break;case"multiple":y=d;default:d!==H&&st(e,t,c,d,s,H)}t=k,l=y,s=Z,X!=null?Nl(e,!!l,X,!1):!!s!=!!l&&(t!=null?Nl(e,!!l,t,!0):Nl(e,!!l,l?[]:"",!1));return;case"textarea":Z=X=null;for(k in l)if(c=l[k],l.hasOwnProperty(k)&&c!=null&&!s.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:st(e,t,k,null,s,c)}for(y in s)if(c=s[y],d=l[y],s.hasOwnProperty(y)&&(c!=null||d!=null))switch(y){case"value":X=c;break;case"defaultValue":Z=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==d&&st(e,t,y,c,s,d)}Fd(e,X,Z);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],Z=l[H],s.hasOwnProperty(H)&&X!==Z&&(X!=null||Z!=null))switch(H){case"selected":e.selected=X&&typeof X!="function"&&typeof X!="symbol";break;default:st(e,t,H,X,s,Z)}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(P in s)if(X=s[P],Z=l[P],s.hasOwnProperty(P)&&X!==Z&&(X!=null||Z!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(o(137,t));break;default:st(e,t,P,X,s,Z)}return;default:if(Co(t)){for(var it in l)X=l[it],l.hasOwnProperty(it)&&X!==void 0&&!s.hasOwnProperty(it)&&du(e,t,it,void 0,s,X);for(ee in s)X=s[ee],Z=l[ee],!s.hasOwnProperty(ee)||X===Z||X===void 0&&Z===void 0||du(e,t,ee,X,s,Z);return}}for(var G in l)X=l[G],l.hasOwnProperty(G)&&X!=null&&!s.hasOwnProperty(G)&&st(e,t,G,null,s,X);for(re in s)X=s[re],Z=l[re],!s.hasOwnProperty(re)||X===Z||X==null&&Z==null||st(e,t,re,X,s,Z)}function Zm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Xg(){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,y=c.initiatorType,k=c.duration;if(d&&k&&Zm(y)){for(y=0,k=c.responseEnd,s+=1;s<l.length;s++){var H=l[s],P=H.startTime;if(P>k)break;var ee=H.transferSize,re=H.initiatorType;ee&&Zm(re)&&(H=H.responseEnd,y+=ee*(H<k?1:(k-P)/(H-P)))}if(--s,t+=8*(d+y)/(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 fu=null,pu=null;function Ai(e){return e.nodeType===9?e:e.ownerDocument}function Jm(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 eh(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 mu(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 hu=null;function Qg(){var e=window.event;return e&&e.type==="popstate"?e===hu?!1:(hu=e,!0):(hu=null,!1)}var th=typeof setTimeout=="function"?setTimeout:void 0,Zg=typeof clearTimeout=="function"?clearTimeout:void 0,nh=typeof Promise=="function"?Promise:void 0,Jg=typeof queueMicrotask=="function"?queueMicrotask:typeof nh<"u"?function(e){return nh.resolve(null).then(e).catch(e1)}:th;function e1(e){setTimeout(function(){throw e})}function Ba(e){return e==="head"}function ah(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),lr(t);return}s--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")s++;else if(l==="html")as(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,as(l);for(var d=l.firstChild;d;){var y=d.nextSibling,k=d.nodeName;d[jr]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&d.rel.toLowerCase()==="stylesheet"||l.removeChild(d),d=y}}else l==="body"&&as(e.ownerDocument.body);l=c}while(l);lr(t)}function lh(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 xu(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":xu(l),jo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function t1(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[jr])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=Dn(e.nextSibling),e===null)break}return null}function n1(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Dn(e.nextSibling),e===null))return null;return e}function rh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Dn(e.nextSibling),e===null))return null;return e}function vu(e){return e.data==="$?"||e.data==="$~"}function yu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function a1(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 Dn(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 gu=null;function sh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Dn(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function ih(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 oh(e,t,l){switch(t=Ai(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 as(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);jo(e)}var zn=new Map,ch=new Set;function Mi(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xa=B.d;B.d={f:l1,r:r1,D:s1,C:i1,L:o1,m:c1,X:d1,S:u1,M:f1};function l1(){var e=xa.f(),t=Si();return e||t}function r1(e){var t=kl(e);t!==null&&t.tag===5&&t.type==="form"?Np(t):xa.r(e)}var tr=typeof document>"u"?null:document;function uh(e,t,l){var s=tr;if(s&&typeof t=="string"&&t){var c=Cn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof l=="string"&&(c+='[crossorigin="'+l+'"]'),ch.has(c)||(ch.add(c),e={rel:e,crossOrigin:l,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),Ft(t,"link",e),Ut(t),s.head.appendChild(t)))}}function s1(e){xa.D(e),uh("dns-prefetch",e,null)}function i1(e,t){xa.C(e,t),uh("preconnect",e,t)}function o1(e,t,l){xa.L(e,t,l);var s=tr;if(s&&e&&t){var c='link[rel="preload"][as="'+Cn(t)+'"]';t==="image"&&l&&l.imageSrcSet?(c+='[imagesrcset="'+Cn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(c+='[imagesizes="'+Cn(l.imageSizes)+'"]')):c+='[href="'+Cn(e)+'"]';var d=c;switch(t){case"style":d=nr(e);break;case"script":d=ar(e)}zn.has(d)||(e=g({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),zn.set(d,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(ls(d))||t==="script"&&s.querySelector(rs(d))||(t=s.createElement("link"),Ft(t,"link",e),Ut(t),s.head.appendChild(t)))}}function c1(e,t){xa.m(e,t);var l=tr;if(l&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Cn(s)+'"][href="'+Cn(e)+'"]',d=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=ar(e)}if(!zn.has(d)&&(e=g({rel:"modulepreload",href:e},t),zn.set(d,e),l.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(rs(d)))return}s=l.createElement("link"),Ft(s,"link",e),Ut(s),l.head.appendChild(s)}}}function u1(e,t,l){xa.S(e,t,l);var s=tr;if(s&&e){var c=wl(s).hoistableStyles,d=nr(e);t=t||"default";var y=c.get(d);if(!y){var k={loading:0,preload:null};if(y=s.querySelector(ls(d)))k.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},l),(l=zn.get(d))&&bu(e,l);var H=y=s.createElement("link");Ut(H),Ft(H,"link",e),H._p=new Promise(function(P,ee){H.onload=P,H.onerror=ee}),H.addEventListener("load",function(){k.loading|=1}),H.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Di(y,t,s)}y={type:"stylesheet",instance:y,count:1,state:k},c.set(d,y)}}}function d1(e,t){xa.X(e,t);var l=tr;if(l&&e){var s=wl(l).hoistableScripts,c=ar(e),d=s.get(c);d||(d=l.querySelector(rs(c)),d||(e=g({src:e,async:!0},t),(t=zn.get(c))&&ju(e,t),d=l.createElement("script"),Ut(d),Ft(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function f1(e,t){xa.M(e,t);var l=tr;if(l&&e){var s=wl(l).hoistableScripts,c=ar(e),d=s.get(c);d||(d=l.querySelector(rs(c)),d||(e=g({src:e,async:!0,type:"module"},t),(t=zn.get(c))&&ju(e,t),d=l.createElement("script"),Ut(d),Ft(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function dh(e,t,l,s){var c=(c=he.current)?Mi(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=nr(l.href),l=wl(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=nr(l.href);var d=wl(c).hoistableStyles,y=d.get(e);if(y||(c=c.ownerDocument||c,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,y),(d=c.querySelector(ls(e)))&&!d._p&&(y.instance=d,y.state.loading=5),zn.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},zn.set(e,l),d||p1(c,e,l,y.state))),t&&s===null)throw Error(o(528,""));return y}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=ar(l),l=wl(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 nr(e){return'href="'+Cn(e)+'"'}function ls(e){return'link[rel="stylesheet"]['+e+"]"}function fh(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function p1(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),Ut(t),e.head.appendChild(t))}function ar(e){return'[src="'+Cn(e)+'"]'}function rs(e){return"script[async]"+e}function ph(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Cn(l.href)+'"]');if(s)return t.instance=s,Ut(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"),Ut(s),Ft(s,"style",c),Di(s,l.precedence,e),t.instance=s;case"stylesheet":c=nr(l.href);var d=e.querySelector(ls(c));if(d)return t.state.loading|=4,t.instance=d,Ut(d),d;s=fh(l),(c=zn.get(c))&&bu(s,c),d=(e.ownerDocument||e).createElement("link"),Ut(d);var y=d;return y._p=new Promise(function(k,H){y.onload=k,y.onerror=H}),Ft(d,"link",s),t.state.loading|=4,Di(d,l.precedence,e),t.instance=d;case"script":return d=ar(l.src),(c=e.querySelector(rs(d)))?(t.instance=c,Ut(c),c):(s=l,(c=zn.get(d))&&(s=g({},l),ju(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),Ut(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,Di(s,l.precedence,e));return t.instance}function Di(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,y=0;y<s.length;y++){var k=s[y];if(k.dataset.precedence===t)d=k;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 bu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function ju(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var zi=null;function mh(e,t,l){if(zi===null){var s=new Map,c=zi=new Map;c.set(l,s)}else c=zi,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[jr]||d[Gt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var y=d.getAttribute(t)||"";y=e+y;var k=s.get(y);k?k.push(d):s.set(y,[d])}}return s}function hh(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function m1(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 xh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function h1(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=nr(s.href),d=t.querySelector(ls(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Li.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=d,Ut(d);return}d=t.ownerDocument||t,s=fh(s),(c=zn.get(c))&&bu(s,c),d=d.createElement("link"),Ut(d);var y=d;y._p=new Promise(function(k,H){y.onload=k,y.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=Li.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Su=0;function x1(e,t){return e.stylesheets&&e.count===0&&Oi(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var s=setTimeout(function(){if(e.stylesheets&&Oi(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Su===0&&(Su=62500*Xg());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Oi(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Su?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Li(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Oi(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var _i=null;function Oi(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,_i=new Map,t.forEach(v1,e),_i=null,Li.call(e))}function v1(e,t){if(!(t.state.loading&4)){var l=_i.get(e);if(l)var s=l.get(null);else{l=new Map,_i.set(e,l);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var y=c[d];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(l.set(y.dataset.precedence,y),s=y)}s&&l.set(null,s)}c=t.instance,y=c.getAttribute("data-precedence"),d=l.get(y)||s,d===s&&l.set(null,c),l.set(y,c),this.count++,s=Li.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 ss={$$typeof:_,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function y1(e,t,l,s,c,d,y,k,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=vo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vo(0),this.hiddenUpdates=vo(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function vh(e,t,l,s,c,d,y,k,H,P,ee,re){return e=new y1(e,t,l,y,H,P,ee,re,k),t=1,d===!0&&(t|=24),d=fn(3,null,null,t),e.current=d,d.stateNode=e,t=tc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:s,isDehydrated:l,cache:t},rc(d),e}function yh(e){return e?(e=Ll,e):Ll}function gh(e,t,l,s,c,d){c=yh(c),s.context===null?s.context=c:s.pendingContext=c,s=Na(t),s.payload={element:l},d=d===void 0?null:d,d!==null&&(s.callback=d),l=Ea(e,s,t),l!==null&&(un(l,e,t),Hr(l,e,t))}function bh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function ku(e,t){bh(e,t),(e=e.alternate)&&bh(e,t)}function jh(e){if(e.tag===13||e.tag===31){var t=tl(e,67108864);t!==null&&un(t,e,67108864),ku(e,67108864)}}function Sh(e){if(e.tag===13||e.tag===31){var t=vn();t=yo(t);var l=tl(e,t);l!==null&&un(l,e,t),ku(e,t)}}var Bi=!0;function g1(e,t,l,s){var c=A.T;A.T=null;var d=B.p;try{B.p=2,wu(e,t,l,s)}finally{B.p=d,A.T=c}}function b1(e,t,l,s){var c=A.T;A.T=null;var d=B.p;try{B.p=8,wu(e,t,l,s)}finally{B.p=d,A.T=c}}function wu(e,t,l,s){if(Bi){var c=Cu(s);if(c===null)uu(e,t,s,Hi,l),wh(e,s);else if(S1(c,e,t,l,s))s.stopPropagation();else if(wh(e,s),t&4&&-1<j1.indexOf(e)){for(;c!==null;){var d=kl(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var y=Nt(d.pendingLanes);if(y!==0){var k=d;for(k.pendingLanes|=2,k.entangledLanes|=2;y;){var H=1<<31-bt(y);k.entanglements[1]|=H,y&=~H}Kn(d),(Je&6)===0&&(bi=tt()+500,es(0))}}break;case 31:case 13:k=tl(d,2),k!==null&&un(k,d,2),Si(),ku(d,2)}if(d=Cu(s),d===null&&uu(e,t,s,Hi,l),d===c)break;c=d}c!==null&&s.stopPropagation()}else uu(e,t,s,null,l)}}function Cu(e){return e=Eo(e),Nu(e)}var Hi=null;function Nu(e){if(Hi=null,e=Sl(e),e!==null){var t=m(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 Hi=e,null}function kh(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 xe:return 2;case Rt:return 8;case De:case xt:return 32;case Wt:return 268435456;default:return 32}default:return 32}}var Eu=!1,Ha=null,Ua=null,Ia=null,is=new Map,os=new Map,Va=[],j1="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 wh(e,t){switch(e){case"focusin":case"focusout":Ha=null;break;case"dragenter":case"dragleave":Ua=null;break;case"mouseover":case"mouseout":Ia=null;break;case"pointerover":case"pointerout":is.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":os.delete(t.pointerId)}}function cs(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=kl(t),t!==null&&jh(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function S1(e,t,l,s,c){switch(t){case"focusin":return Ha=cs(Ha,e,t,l,s,c),!0;case"dragenter":return Ua=cs(Ua,e,t,l,s,c),!0;case"mouseover":return Ia=cs(Ia,e,t,l,s,c),!0;case"pointerover":var d=c.pointerId;return is.set(d,cs(is.get(d)||null,e,t,l,s,c)),!0;case"gotpointercapture":return d=c.pointerId,os.set(d,cs(os.get(d)||null,e,t,l,s,c)),!0}return!1}function Ch(e){var t=Sl(e.target);if(t!==null){var l=m(t);if(l!==null){if(t=l.tag,t===13){if(t=f(l),t!==null){e.blockedOn=t,Hd(e.priority,function(){Sh(l)});return}}else if(t===31){if(t=h(l),t!==null){e.blockedOn=t,Hd(e.priority,function(){Sh(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 Ui(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Cu(e.nativeEvent);if(l===null){l=e.nativeEvent;var s=new l.constructor(l.type,l);No=s,l.target.dispatchEvent(s),No=null}else return t=kl(l),t!==null&&jh(t),e.blockedOn=l,!1;t.shift()}return!0}function Nh(e,t,l){Ui(e)&&l.delete(t)}function k1(){Eu=!1,Ha!==null&&Ui(Ha)&&(Ha=null),Ua!==null&&Ui(Ua)&&(Ua=null),Ia!==null&&Ui(Ia)&&(Ia=null),is.forEach(Nh),os.forEach(Nh)}function Ii(e,t){e.blockedOn===t&&(e.blockedOn=null,Eu||(Eu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,k1)))}var Vi=null;function Eh(e){Vi!==e&&(Vi=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Vi===e&&(Vi=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(Nu(s||l)===null)continue;break}var d=kl(l);d!==null&&(e.splice(t,3),t-=3,Cc(d,{pending:!0,data:c,method:l.method,action:s},s,c))}}))}function lr(e){function t(H){return Ii(H,e)}Ha!==null&&Ii(Ha,e),Ua!==null&&Ii(Ua,e),Ia!==null&&Ii(Ia,e),is.forEach(t),os.forEach(t);for(var l=0;l<Va.length;l++){var s=Va[l];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Va.length&&(l=Va[0],l.blockedOn===null);)Ch(l),l.blockedOn===null&&Va.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],y=c[an]||null;if(typeof d=="function")y||Eh(l);else if(y){var k=null;if(d&&d.hasAttribute("formAction")){if(c=d,y=d[an]||null)k=y.formAction;else if(Nu(c)!==null)continue}else k=y.action;typeof k=="function"?l[s+1]=k:(l.splice(s,3),s-=3),Eh(l)}}}function Th(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(y){return c=y})},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 Tu(e){this._internalRoot=e}$i.prototype.render=Tu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,s=vn();gh(l,s,e,t,null,null)},$i.prototype.unmount=Tu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;gh(e.current,2,null,e,null,null),Si(),t[jl]=null}};function $i(e){this._internalRoot=e}$i.prototype.unstable_scheduleHydration=function(e){if(e){var t=Bd();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Va.length&&t!==0&&t<Va[l].priority;l++);Va.splice(l,0,e),l===0&&Ch(e)}};var Rh=r.version;if(Rh!=="19.2.4")throw Error(o(527,Rh,"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=p(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var w1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Gi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gi.isDisabled&&Gi.supportsFiber)try{Qn=Gi.inject(w1),Ct=Gi}catch{}}return ds.createRoot=function(e,t){if(!u(e))throw Error(o(299));var l=!1,s="",c=Op,d=Bp,y=Hp;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&&(y=t.onRecoverableError)),t=vh(e,1,!1,null,null,l,s,null,c,d,y,Th),e[jl]=t.current,cu(e),new Tu(t)},ds.hydrateRoot=function(e,t,l){if(!u(e))throw Error(o(299));var s=!1,c="",d=Op,y=Bp,k=Hp,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&&(y=l.onCaughtError),l.onRecoverableError!==void 0&&(k=l.onRecoverableError),l.formState!==void 0&&(H=l.formState)),t=vh(e,1,!0,t,l??null,s,c,H,d,y,k,Th),t.context=yh(null),l=t.current,s=vn(),s=yo(s),c=Na(s),c.callback=null,Ea(l,c,s),l=s,t.current.lanes=l,br(t,l),Kn(t),e[jl]=t.current,cu(e),new $i(t)},ds.version="19.2.4",ds}var Uh;function z1(){if(Uh)return Mu.exports;Uh=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(),Mu.exports=D1(),Mu.exports}var L1=z1();const _1="modulepreload",O1=function(a){return"/"+a},Ih={},hd=function(r,i,o){let u=Promise.resolve();if(i&&i.length>0){let f=function(p){return Promise.all(p.map(b=>Promise.resolve(b).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(p=>{if(p=O1(p),p in Ih)return;Ih[p]=!0;const b=p.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const j=document.createElement("link");if(j.rel=b?"stylesheet":_1,b||(j.as="script"),j.crossOrigin="",j.href=p,x&&j.setAttribute("nonce",x),document.head.appendChild(j),b)return new Promise((S,C)=>{j.addEventListener("load",S),j.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${p}`)))})}))}function m(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"&&m(h.reason);return r().catch(m)})},sr="";class Wx extends Error{constructor(r,i){super(r),this.name="ApiError",this.status=i}}async function Fe(a,r){const i=await fetch(`${sr}${a}`,r);if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new Wx(o.error||`HTTP ${i.status}`,i.status)}return i.json()}function Fn(a){return typeof a=="string"&&a.length>0?a:null}function B1(a){return typeof a=="number"&&Number.isFinite(a)?a:null}function _u(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 H1(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 m={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:Fn(r.symlinkTarget),installMethod:u,description:Fn(r.description),version:Fn(r.version),category:Fn(r.category),author:Fn(r.author),license:Fn(r.license),homepage:Fn(r.homepage),tags:_u(r.tags),deps:_u(r.deps),mcpDeps:_u(r.mcpDeps),entryPoint:Fn(r.entryPoint),lastModified:Fn(r.lastModified),sizeBytes:B1(r.sizeBytes),sourceAgent:Fn(r.sourceAgent)};return typeof r.updateAvailable=="boolean"&&(m.updateAvailable=r.updateAvailable),typeof r.currentVersion=="string"&&(m.currentVersion=r.currentVersion),typeof r.latestVersion=="string"&&(m.latestVersion=r.latestVersion),typeof r.pinnedVersion=="string"&&(m.pinnedVersion=r.pinnedVersion),m}const Ne={getConfig(){return Fe("/api/config")},setConfig(a,r){return Fe("/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 Fe(`/api/skills${i?"?"+i:""}`);return Array.isArray(o)?o.map(H1):[]},getAgents(){return Fe("/api/agents")},getSkillDetail(a,r){return Fe(`/api/skills/${a}/${r}`)},getEvals(a,r){return Fe(`/api/skills/${a}/${r}/evals`)},saveEvals(a,r,i){return Fe(`/api/skills/${a}/${r}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},generateEvals(a,r){return Fe(`/api/skills/${a}/${r}/generate-evals`,{method:"POST"})},async getLatestBenchmark(a,r){const i=await fetch(`${sr}/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 Wx(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 Fe(`/api/skills/${a}/${r}/history${u?"?"+u:""}`)},getHistoryEntry(a,r,i){return Fe(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`)},compareRuns(a,r,i,o){return Fe(`/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 m=u.toString();return Fe(`/api/skills/${a}/${r}/history/case/${i}${m?"?"+m:""}`)},deleteHistoryEntry(a,r,i){return Fe(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`,{method:"DELETE"})},deleteSkill(a,r){return Fe(`/api/skills/${a}/${r}`,{method:"DELETE"})},improveSkill(a,r,i){return Fe(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},instructEdit(a,r,i){return Fe(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...i})})},applyImprovement(a,r,i){return Fe(`/api/skills/${a}/${r}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})})},getStats(a,r){return Fe(`/api/skills/${a}/${r}/stats`)},getDependencies(a,r){return Fe(`/api/skills/${a}/${r}/dependencies`)},getProjectLayout(){return Fe("/api/project-layout")},createSkill(a){return Fe("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},saveDraft(a){return Fe("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillCreatorStatus(){return Fe("/api/skill-creator-status")},generateSkill(a){return Fe("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillFiles(a,r){return Fe(`/api/skills/${a}/${r}/files`)},getSkillFile(a,r,i){return Fe(`/api/skills/${a}/${r}/file?path=${encodeURIComponent(i)}`)},saveSkillFile(a,r,i,o){return Fe(`/api/skills/${a}/${r}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:o})})},getLeaderboard(a,r){return Fe(`/api/skills/${a}/${r}/leaderboard`)},getLeaderboardEntry(a,r,i){return Fe(`/api/skills/${a}/${r}/leaderboard/${encodeURIComponent(i)}`)},startSweep(a,r,i){const o=`${sr}/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 Fe(`/api/credentials/${a}/${r}`)},setCredential(a,r,i,o){return Fe(`/api/credentials/${a}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,value:o})})},getParams(a,r){return Fe(`/api/credentials/${a}/${r}/params`)},getParamsRevealed(a,r,i){const o=i?`reveal=true&key=${encodeURIComponent(i)}`:"reveal=true";return Fe(`/api/credentials/${a}/${r}/params?${o}`)},searchModels(){return Fe("/api/openrouter/models")},getSkillVersions(a,r){return Fe(`/api/skills/${a}/${r}/versions`)},getVersionDiff(a,r,i,o){return Fe(`/api/skills/${a}/${r}/versions/diff?from=${i}&to=${o}`)},startBatchUpdate(a){const r=`${sr}/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=`${sr}/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(`${sr}/api/skills/updates`);return a.ok?await a.json():[]}catch{return[]}}};function U1(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 I1(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=m=>i(m.matches);return o.addEventListener("change",u),()=>o.removeEventListener("change",u)},[a]),r}const V1=3e5,$1=500,G1=15e3,q1=6e4;function Y1(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 K1(a){let r=0;for(const i of a)i.updateAvailable&&r++;return r}function F1(a){a()}function W1(a){const r=V1,i=$1,o=G1,u=q1,[m,f]=v.useState([]),[h,x]=v.useState(()=>new Map),[p,b]=v.useState(0),[g,j]=v.useState(!1),[S,C]=v.useState(null),[z,E]=v.useState(null),N=v.useRef(null),M=v.useRef(null),_=v.useRef(null),I=v.useRef(null),L=v.useRef(!0),$=v.useCallback(async()=>{j(!0);const U=new AbortController,q=setTimeout(()=>U.abort(),o);try{const F=await Promise.race([Ne.getSkillUpdates(),new Promise((te,Q)=>{U.signal.addEventListener("abort",()=>{Q(new Error("TIMEOUT"))})})]);if(F==="TIMEOUT")throw new Error("TIMEOUT");if(!L.current)return;f(F),x(Y1(F)),b(K1(F)),M.current=Date.now(),C(M.current),E(null)}catch(F){if(!L.current)return;E(F instanceof Error?F:new Error(String(F)))}finally{clearTimeout(q),L.current&&j(!1)}},[o]),w=v.useCallback(()=>{if(N.current)return N.current;const U=$().finally(()=>{N.current=null});return N.current=U,U},[$]),D=v.useCallback(()=>{_.current==null&&(_.current=setInterval(()=>{w()},r))},[r,w]),R=v.useCallback(()=>{_.current!=null&&(clearInterval(_.current),_.current=null)},[]);return v.useEffect(()=>{L.current=!0,(M.current==null||Date.now()-M.current>u)&&F1(()=>void w()),(typeof document>"u"||document.visibilityState!=="hidden")&&D();const F=()=>{if(I.current&&(clearTimeout(I.current),I.current=null),document.visibilityState==="hidden"){R();return}I.current=setTimeout(()=>{I.current=null,(M.current==null||Date.now()-M.current>u)&&w(),D()},i)};return typeof document<"u"&&document.addEventListener("visibilitychange",F),()=>{L.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",F),I.current&&clearTimeout(I.current),R()}},[]),{updates:m,updatesMap:h,updateCount:p,isRefreshing:g,lastFetchAt:S,error:z,refresh:w}}const P1={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1};function X1(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 Px=v.createContext(null);function ya(){const a=v.useContext(Px);if(!a)throw new Error("useStudio must be used within StudioProvider");return a}function Q1({children:a}){const[r,i]=v.useReducer(X1,P1),o=I1("(max-width: 767px)");v.useEffect(()=>{i({type:"SET_MOBILE",isMobile:o})},[o]);const u=v.useCallback(()=>{i({type:"SET_SKILLS_LOADING",loading:!0}),Ne.getSkills().then(_=>{i({type:"SET_SKILLS",skills:_});const L=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(L){const[,$,w]=L,D=_.find(R=>R.plugin===$&&R.skill===w);D&&i({type:"SELECT_SKILL",skill:{plugin:$,skill:w,origin:D.origin}})}}).catch(_=>i({type:"SET_SKILLS_ERROR",error:_.message}))},[]);v.useEffect(()=>{u()},[u]);const m=v.useCallback(_=>{i({type:"SELECT_SKILL",skill:_}),window.location.hash=`/skills/${_.plugin}/${_.skill}`},[]),f=v.useCallback(()=>{i({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),h=v.useCallback(_=>{i({type:"SET_MODE",mode:_})},[]),x=v.useCallback(_=>{i({type:"SET_SEARCH",query:_})},[]),p=v.useCallback(_=>{i({type:"SET_MOBILE_VIEW",view:_})},[]),b=v.useCallback(()=>{i({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),g=W1(),j=v.useMemo(()=>{const _=r.skills.map(I=>{if(!I.updateAvailable&&I.latestVersion===void 0)return I;const L={...I};return delete L.updateAvailable,delete L.currentVersion,delete L.latestVersion,L});return U1(_,g.updates)},[r.skills,g.updates]),S=v.useMemo(()=>{const _={source:0,installed:0};for(const I of j)I.updateAvailable&&(_[I.origin]+=1);return _},[j]),C=v.useMemo(()=>({...r,skills:j}),[r,j]),z=g.updateCount,E=g.refresh,N=g.isRefreshing,M=v.useMemo(()=>({state:C,selectSkill:m,clearSelection:f,setMode:h,setSearch:x,setMobileView:p,refreshSkills:u,updateCount:z,dismissUpdateNotification:b,updates:g.updates,outdatedByOrigin:S,isRefreshingUpdates:N,refreshUpdates:E}),[C,m,f,h,x,p,u,z,b,g.updates,S,N,E]);return n.jsx(Px.Provider,{value:M,children:a})}const Z1={config:null,loading:!0};function J1(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 Xx=v.createContext(null);function yl(){const a=v.useContext(Xx);if(!a)throw new Error("useConfig must be used within ConfigProvider");return a}function eb({children:a}){const[r,i]=v.useReducer(J1,Z1),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},[]),m=v.useMemo(()=>({config:r.config,loading:r.loading,updateConfig:u,refreshConfig:o}),[r,u,o]);return n.jsx(Xx.Provider,{value:m,children:a})}function tb({topRail:a,sidebar:r,main:i,statusBar:o,resizeHandle:u,banner:m,liveMessage:f,sidebarWidth:h=320,sidebarHidden:x=!1}){const p={"--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)"},b={display:"grid",gridTemplateColumns:x?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return n.jsxs("div",{className:"studio-shell",style:p,children:[m,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:b,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 so=Fx();const nb=Kx(so),Vh=["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],ab={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},lb={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},rb={"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 ib(a,r){var h,x;const i=ab[a.id]??null,o=lb[a.id]??null,u=i?!!((h=r==null?void 0:r.wrapperFolders)!=null&&h[i]):!1,m=o?!!((x=r==null?void 0:r.binaries)!=null&&x[o]):!0,f=a.models.map(p=>({id:p.id,displayName:p.label,billingMode:sb[a.id]??"per-token"}));return{id:a.id,displayName:ob(a.id,a.label),wrapperFolder:i,wrapperFolderPresent:u,binaryAvailable:m,endpointReachable:a.id==="ollama"||a.id==="lm-studio"?a.available:null,available:a.available,ctaType:a.available?null:rb[a.id]??null,models:f}}function ob(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 Vh){const u=r.get(o);u&&i.push(u)}for(const o of a)Vh.includes(o.id)||i.push(o);return i}function ub(a){const[r,i]=v.useState(null),[o,u]=v.useState("loading"),[m,f]=v.useState(null),h=v.useRef(null),x=v.useRef(0),p=v.useCallback(async()=>{try{const C=await fetch("/api/config");if(!C.ok)throw new Error(`/api/config returned ${C.status}`);const z=await C.json(),E=cb((z.providers||[]).map(N=>ib(N,z.detection)));i({agents:E,activeAgent:z.provider??null,activeModel:z.model??null}),u("ready"),f(null)}catch(C){u("error"),f(C.message)}},[]);v.useEffect(()=>{p()},[p]);const b=v.useCallback(async()=>{const C=Date.now();if(!(C-x.current<5*6e4))try{const z=await fetch("/api/openrouter/models");if(!z.ok)return;const E=await z.json();x.current=C,i(N=>{if(!N)return N;const M=N.agents.map(_=>{if(_.id!=="openrouter")return _;const I=E.models.map($=>({id:$.id,displayName:$.name,contextWindow:$.contextWindow,pricing:$.pricing,billingMode:"per-token"}));return{..._,models:I,catalogAgeMs:E.ageSec?E.ageSec*1e3:0,cacheStale:!!E.stale}});return{...N,agents:M}}),E.stale&&(a!=null&&a.onStaleCatalog)&&a.onStaleCatalog("openrouter",(E.ageSec??0)*1e3)}catch{}},[a]),g=v.useCallback(C=>{h.current=C,C==="openrouter"&&b()},[b]),j=v.useCallback(()=>{x.current=0,p()},[p]),S=v.useCallback(async(C,z)=>{(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:C,model:z})})).ok&&i(N=>N&&{...N,activeAgent:C,activeModel:z})},[]);return{status:o,catalog:r,error:m,focusAgent:g,refresh:j,activeAgentId:(r==null?void 0:r.activeAgent)??null,activeModelId:(r==null?void 0:r.activeModel)??null,setActive:S}}function Ou({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 m(f){(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),u(f))}return n.jsx("button",{type:"button","data-testid":`locked-cta-${a}`,onClick:u,onKeyDown:m,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 nd({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 db={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}`},fb={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"},pb={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"},mb={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."},hb={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"},xb={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"},vb={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."},yb={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},gb={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},bb={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},jb={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"},Sb={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 →"}},kb={subscriptionBilling:"· subscription",free:"· free"},wb={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`},Cb={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.`},Nb={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}`},Eb={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.`},Tb={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"},Rb={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."},Ab={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:db,shell:fb,detail:pb,actions:mb,palette:hb,shortcuts:xb,toasts:vb,connection:yb,forms:gb,errors:bb,picker:jb,providers:Sb,models:kb,settings:wb,statusBar:Cb,scopePicker:Nb,scopeSection:Eb,claudeCodeLabel:Tb,setupDrawer:Rb,setupProviders:Ab},$h=new Set(["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function Mb({agents:a,activeAgentId:r,focusedAgentId:i,onFocus:o,onSelect:u,onOpenSettings:m}){const f=a.filter(x=>$h.has(x.id)),h=a.filter(x=>!$h.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(Gh,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:u,onOpenSettings:m},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(Gh,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:u,onOpenSettings:m},x.id))]})}function Gh({agent:a,isActive:r,isFocused:i,onFocus:o,onSelect:u,onOpenSettings:m}){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}},p={height:36,padding:"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&&(p.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:p,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.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.displayName}),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(nd,{unlocked:!0,size:10}):n.jsx(nd,{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(Ou,{variant:"api-key",label:a.id==="anthropic"?f.anthropic.addKeyCta:f.openrouter.addKeyCta,onActivate:()=>m(a.id)}),!a.available&&a.ctaType==="cli-install"&&x[a.id]&&n.jsx(Ou,{variant:"cli-install",label:x[a.id].label,installUrl:x[a.id].url,onActivate:()=>{}}),!a.available&&a.ctaType==="start-service"&&n.jsx(Ou,{variant:"start-service",label:a.id==="ollama"?f.ollama.startServiceCta:f.lmStudio.startServiceCta,onActivate:()=>m(a.id)}),h[a.id]&&n.jsx("span",{className:"sr-only","data-testid":`caption-${a.id}`,children:h[a.id]})]})}function Db(a,r,i,o){const f=a>=80,h=v.useRef(null),[x,p]=v.useState(0),b=v.useCallback(S=>{p(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),C=Math.ceil(i/r)+8,z=Math.min(a,S+C);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:b,ref:h,style:{overflowY:"auto",maxHeight:i,willChange:f?"transform":void 0}}}}const Qx=44,zb=352,Lb=60;function _b(a){var m,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=((m=a.pricing)==null?void 0:m.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 Ob(a,r){if(!r)return a;const i=r.toLowerCase();return a.filter(u=>u.displayName.toLowerCase().includes(i)).sort((u,m)=>{const f=u.displayName.toLowerCase().indexOf(i),h=m.displayName.toLowerCase().indexOf(i);return f!==h?f-h:u.displayName.length-m.displayName.length})}function Bb({agent:a,activeModelId:r,onSelect:i,onOpenSettings:o}){const[u,m]=v.useState(""),[f,h]=v.useState(""),x=v.useRef(null);if(v.useEffect(()=>{const g=setTimeout(()=>h(u),Lb);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 p=v.useMemo(()=>Ob(a.models,f),[a.models,f]),b=Db(p.length,Qx,zb);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=>m(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"}})}),p.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:()=>m(""),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})]}):p.length===0?n.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:J.picker.noModelsYet}):n.jsx("div",{...b.containerProps,children:n.jsx("div",{style:{height:b.virtualised?b.totalHeight:"auto",position:"relative"},children:n.jsx("div",{style:{transform:b.virtualised?`translateY(${b.offsetTop}px)`:void 0},children:p.slice(b.visibleStart,b.visibleEnd).map(g=>n.jsx(Hb,{model:g,isActive:g.id===r,onSelect:()=>i(g.id)},g.id))})})})]})}function Hb({model:a,isActive:r,onSelect:i}){const o=_b(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:Qx,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 qh={anthropic:{stored:!1,updatedAt:null,tier:"browser"},openrouter:{stored:!1,updatedAt:null,tier:"browser"}};function Ub(){const[a,r]=v.useState(null),[i,o]=v.useState(!0),[u,m]=v.useState(null),f=v.useCallback(async()=>{o(!0);try{const p=await fetch("/api/settings/keys");if(!p.ok)throw new Error(`GET /api/settings/keys returned ${p.status}`);const b=await p.json();r({...qh,...b}),m(null)}catch(p){m(p.message),r(qh)}finally{o(!1)}},[]);v.useEffect(()=>{f()},[f]);const h=v.useCallback(async(p,b,g="browser")=>{const j=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:p,key:b,tier:g})});if(!j.ok){const C=await j.json().catch(()=>({error:j.statusText}));throw new Error(C.error||`POST /api/settings/keys returned ${j.status}`)}const S=await j.json();return await f(),S},[f]),x=v.useCallback(async p=>{const b=await fetch(`/api/settings/keys/${p}`,{method:"DELETE"});if(!b.ok)throw new Error(`DELETE /api/settings/keys/${p} returned ${b.status}`);await f()},[f]);return{state:a,loading:i,error:u,save:h,remove:x,refresh:f}}const Ib=[{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 Vb(){return typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform)}function $b(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 Gb({open:a,onClose:r,initialProvider:i,onToast:o}){const{state:u,save:m,remove:f}=Ub(),[h,x]=v.useState("browser"),p=v.useRef(null),b=v.useRef(null),[g,j]=v.useState(i??"anthropic");if(v.useEffect(()=>{if(!a)return;const C=document.activeElement,z=setTimeout(()=>{var M;const E=i?`input[data-provider="${i}"]`:"input[data-provider]",N=(M=p.current)==null?void 0:M.querySelector(E);N==null||N.focus()},0);return()=>{var E;clearTimeout(z),(E=C==null?void 0:C.focus)==null||E.call(C)}},[a,i]),v.useEffect(()=>{if(!a)return;const C=z=>{if(z.key==="Escape"){z.preventDefault(),r();return}if(z.key==="Tab"&&p.current){const E=p.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(E.length===0)return;const N=E[0],M=E[E.length-1];z.shiftKey&&document.activeElement===N?(z.preventDefault(),M.focus()):!z.shiftKey&&document.activeElement===M&&(z.preventDefault(),N.focus())}};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[a,r]),!a)return null;const S=Vb();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:C=>{C.target===C.currentTarget&&r()},children:n.jsxs("div",{ref:p,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:C=>C.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}),Ib.map(C=>n.jsx(qb,{providerId:C.id,providerName:C.name,keyIssuanceUrl:C.keyIssuanceUrl,prefix:C.prefix,metadata:u==null?void 0:u[C.id],tier:h,onSave:async z=>{const E=await m(C.id,z,h);return o==null||o(J.settings.keySaved(C.name)),E},onRemove:async()=>{await f(C.id),o==null||o(J.settings.keyRemoved(C.name))},inputRef:C.id===(i??"anthropic")?b:void 0},C.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 qb({providerId:a,providerName:r,keyIssuanceUrl:i,prefix:o,metadata:u,onSave:m,onRemove:f,inputRef:h}){const[x,p]=v.useState(""),[b,g]=v.useState(!1),[j,S]=v.useState(!1),[C,z]=v.useState(!1),[E,N]=v.useState(null),M=x.trim(),_=M.length===0,I=M.length>0&&!M.startsWith(o),L=v.useCallback(async()=>{if(!_){S(!0);try{const D=await m(M);D.warning?N(D.warning):N(null),p("")}finally{S(!1)}}},[_,m,M]),$=v.useCallback(async()=>{var D;try{if(!((D=navigator.clipboard)!=null&&D.readText))return;const R=await navigator.clipboard.readText();p(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:b?"text":"password",value:x,onChange:D=>{p(D.target.value),N(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(!b),style:rr,children:b?J.settings.hide:J.settings.show}),n.jsx("button",{type:"button",onClick:$,style:rr,children:J.settings.paste})]}),_&&x.length>0&&n.jsx("div",{role:"status",style:Yb,children:J.settings.enterNonEmpty}),I&&n.jsx("div",{role:"status","data-testid":`prefix-warn-${a}`,style:Yh,children:J.settings.prefixWarn(r)}),E&&n.jsx("div",{role:"status",style:Yh,children:E}),n.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[n.jsx("button",{type:"button",onClick:L,disabled:_||j,"data-testid":`save-${a}`,style:{...rr,background:_?"var(--surface-2)":"var(--accent, var(--color-accent))",color:_?"var(--text-muted)":"white",cursor:_?"not-allowed":"pointer"},children:J.settings.save}),(u==null?void 0:u.stored)&&n.jsx(n.Fragment,{children:C?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:{...rr,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),n.jsx("button",{type:"button",onClick:()=>z(!1),style:rr,children:"Cancel"})]}):n.jsx("button",{type:"button",onClick:()=>z(!0),"data-testid":`remove-${a}`,style:{...rr,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($b(u.updatedAt)):J.settings.noKey})]})]})}const rr={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},Yb={fontSize:11,color:"var(--danger, #b33)"},Yh={fontSize:11,color:"var(--warning, var(--text-muted))"};function Kb(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Fb({onToast:a}){const{status:r,catalog:i,focusAgent:o,setActive:u}=ub({onStaleCatalog:(D,R)=>{const U=Math.round(R/6e4);a==null||a(`Using cached ${D} catalog (${U} min old)`)}}),[m,f]=v.useState(!1),[h,x]=v.useState(!1),[p,b]=v.useState(),[g,j]=v.useState(null),[S,C]=v.useState("agents"),z=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 E=(i==null?void 0:i.agents)??[],N=v.useMemo(()=>E.find(D=>D.id===g)??E[0],[E,g]),M=v.useCallback(()=>{var D;f(!0),C("agents"),j((i==null?void 0:i.activeAgent)??((D=E[0])==null?void 0:D.id)??null)},[i,E]),_=v.useCallback(()=>{var D;f(!1),(D=z.current)==null||D.focus()},[]);v.useEffect(()=>{const D=R=>{var q;if(!(R.metaKey||R.ctrlKey)||R.key.toLowerCase()!=="k")return;const U=(q=document.activeElement)==null?void 0:q.tagName;U==="INPUT"||U==="TEXTAREA"||(R.preventDefault(),f(F=>!F))};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]),v.useEffect(()=>{if(!m)return;const D=U=>{if(U.key==="Escape"){U.preventDefault(),_();return}if(U.key==="ArrowDown"){U.preventDefault(),R(1);return}if(U.key==="ArrowUp"){U.preventDefault(),R(-1);return}if(U.key==="ArrowRight"&&S==="agents"){U.preventDefault(),C("models");return}if(U.key==="ArrowLeft"&&S==="models"){U.preventDefault(),C("agents");return}if(U.key==="Enter"){U.preventDefault(),S==="agents"&&N?C("models"):S==="models"&&N&&N.models[0]&&(u(N.id,N.models[0].id),_());return}};function R(U){if(S==="agents"){const q=E.findIndex(te=>te.id===g),F=E[Math.max(0,Math.min(E.length-1,q+U))];F&&(j(F.id),o(F.id))}}return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[m,S,E,g,N,_,o,u]);const I=v.useCallback(D=>{b(D==="anthropic"||D==="openrouter"?D:void 0),x(!0),f(!1)},[]),L=E.find(D=>D.id===(i==null?void 0:i.activeAgent)),$=L==null?void 0:L.models.find(D=>D.id===(i==null?void 0:i.activeModel)),w=v.useMemo(()=>{if(r!=="ready"||!i)return"Loading…";const D=(L==null?void 0:L.displayName)??"Agent",R=($==null?void 0:$.displayName)??i.activeModel??"Model";return`${D} · ${R}`},[r,i,L,$]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:z,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>m?_():M(),"aria-haspopup":"listbox","aria-expanded":m,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:L!=null&&L.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),n.jsx("span",{children:w})]}),m&&typeof document<"u"&&so.createPortal(n.jsxs(Wb,{reducedMotion:Kb(),onClickOutside:_,children:[n.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[n.jsx(Mb,{agents:E,activeAgentId:(i==null?void 0:i.activeAgent)??null,focusedAgentId:g,onFocus:D=>{j(D),o(D)},onSelect:D=>{j(D),o(D),C("models")},onOpenSettings:I}),N&&n.jsx(Bb,{agent:N,activeModelId:(i==null?void 0:i.activeModel)??null,onSelect:D=>{u(N.id,D),_()},onOpenSettings:I})]}),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:()=>I(),"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(Gb,{open:h,onClose:()=>x(!1),initialProvider:p,onToast:a})]})}function Wb({children:a,reducedMotion:r,onClickOutside:i}){const o=v.useRef(null);return v.useEffect(()=>{const u=m=>{o.current&&!o.current.contains(m.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 {
|
|
51
|
+
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
52
|
+
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
53
|
+
}`})]})}function Kh(){typeof window>"u"||(window.location.hash="#/")}function Pb({onHome:a}){const[r,i]=v.useState(!1),[o,u]=v.useState(!1),m=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),Kh(),a==null||a())},f=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),Kh(),a==null||a())};return n.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:m,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 Xb="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",Qb=v.lazy(()=>hd(()=>import("./UpdateDropdown-DyH9TWvR.js"),__vite__mapDeps([0,1])));function Zb(){const{updateCount:a,updates:r,isRefreshingUpdates:i,refreshUpdates:o,selectSkill:u}=ya(),[m,f]=v.useState(!1),h=v.useRef(null),x=v.useCallback(()=>f(!1),[]),p=a>0?"var(--text-primary)":"var(--text-secondary)",b=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":m,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:p,cursor:"pointer"},children:[n.jsx("img",{src:Xb,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:b})]}),m&&n.jsx(v.Suspense,{fallback:n.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:n.jsx(Qb,{updates:r,isRefreshing:i,onRefresh:()=>o(),onSelectSkill:j=>{const S=j.name.split("/"),C=S.length>=2?S[S.length-2]:S[0],z=S[S.length-1];u({plugin:C,skill:z,origin:"installed"}),x()},onViewAll:()=>{window.location.hash="#/updates",x()},onClose:x,anchorRef:h})})]})}function Fh(a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:a}))}function Jb({projectName:a,selected:r,onOpenPalette:i,onHome:o}){const u=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(Pb,{onHome:o}),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&&u&&n.jsxs(n.Fragment,{children:[n.jsx(Wh,{segment:"origin",onClick:()=>Fh({scope:"origin",origin:r.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:r.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:u}),n.jsx(Ph,{}),n.jsx(Wh,{segment:"plugin",onClick:()=>Fh({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),n.jsx(Ph,{}),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:[n.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:n.jsx(Fb,{})}),n.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:n.jsx(Zb,{})}),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 Wh({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 m=(i==null?void 0:i.color)??"var(--text-secondary)";u.currentTarget.style.color=m},children:o})}function Ph(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const io="vskill-theme";function Zx(a){return a==="light"||a==="dark"||a==="auto"?a:"auto"}function e0(a,r){return a==="light"||a==="dark"?a:r?"dark":"light"}function t0(a){try{const r=a.getItem(io);return Zx(r)}catch{return"auto"}}function n0(a,r){try{a.setItem(io,r)}catch{}}function a0(a,r,i){a.dataset.theme=i,a.dataset.themeMode=r}function l0(a){if(!a)return!1;try{return a("(prefers-color-scheme: dark)").matches}catch{return!1}}const Jx=v.createContext(null);function r0({storage:a,matchMedia:r,target:i,children:o}){const u=a??(typeof window<"u"?window.localStorage:void 0),m=r??(typeof window<"u"?window.matchMedia.bind(window):void 0),f=i??(typeof document<"u"?document.documentElement:void 0),[h,x]=v.useState(()=>u?t0(u):"auto"),[p,b]=v.useState(()=>l0(m)),g=v.useMemo(()=>e0(h,p),[h,p]);v.useEffect(()=>{f&&a0(f,h,g)},[f,h,g]),v.useEffect(()=>{if(!m)return;const C=m("(prefers-color-scheme: dark)"),z=N=>b(N.matches);if(typeof C.addEventListener=="function")return C.addEventListener("change",z),()=>C.removeEventListener("change",z);const E=C;return E.addListener(z),()=>E.removeListener(z)},[m]),v.useEffect(()=>{if(typeof window>"u")return;const C=z=>{z.key===io&&x(Zx(z.newValue))};return window.addEventListener("storage",C),()=>window.removeEventListener("storage",C)},[]),v.useEffect(()=>{if(!m||!f)return;let C;try{C=m("(prefers-contrast: more)")}catch{return}const z=M=>{M?f.dataset.contrast="more":f.dataset.contrast==="more"&&delete f.dataset.contrast};z(C.matches);const E=M=>z(M.matches);if(typeof C.addEventListener=="function")return C.addEventListener("change",E),()=>C.removeEventListener("change",E);const N=C;return N.addListener(E),()=>N.removeListener(E)},[m,f]);const j=v.useCallback(C=>{x(C),u&&n0(u,C)},[u]),S=v.useMemo(()=>({mode:h,resolvedTheme:g,setTheme:j}),[h,g,j]);return n.jsx(Jx.Provider,{value:S,children:o})}function ev(){const a=v.useContext(Jx);if(!a)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return a}const Xh=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function s0(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of Xh){const u=r.get(o);u&&i.push(u)}for(const o of a)Xh.includes(o.id)||i.push(o);return i}function i0(a){const[r,i]=v.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${a}px)`).matches);return v.useEffect(()=>{var m;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${a}px)`),u=()=>i(o.matches);return(m=o.addEventListener)==null||m.call(o,"change",u),()=>{var f;return(f=o.removeEventListener)==null?void 0:f.call(o,"change",u)}},[a]),r}function o0({providers:a,onOpenSettings:r,onOpenInstallHelp:i}){const o=s0(a),u=i0(640),[m,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(p=>p.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(!m),"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)}),m&&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(p=>n.jsx(Qh,{p,onClick:h},p.id))})]})}return n.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(x=>n.jsx(Qh,{p:x,onClick:h,compact:!0},x.id))})}function Qh({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(nd,{unlocked:a.available,size:10}),!i&&n.jsx("span",{children:a.label})]})}function c0(){try{return typeof localStorage>"u"?null:localStorage.getItem(io)}catch{return null}}function u0({projectPath:a,modelName:r,health:i="ok",onPathClick:o,providers:u,onOpenProviderSettings:m,onOpenProviderInstallHelp:f}){const{mode:h,resolvedTheme:x,setTheme:p}=ev(),g=c0()==="auto",j=d0(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.jsxs("button",{type:"button",onClick:o,"aria-label":a?`Project path ${a}`:"No project path",style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"none",padding:0,color:"var(--text-secondary)",fontFamily:"var(--font-mono)",cursor:o?"pointer":"default",maxWidth:360,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a??"",children:[n.jsx(Zh,{color:"var(--text-secondary)"}),n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:a??"—"})]}),n.jsx(Bu,{}),n.jsx("span",{title:r??"",style:{fontFamily:"var(--font-mono)"},children:r??"—"}),n.jsx(Bu,{}),n.jsxs("span",{"aria-label":`Health: ${i}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.jsx(Zh,{color:S}),n.jsx("span",{style:{textTransform:"capitalize"},children:i})]}),u&&u.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(Bu,{}),n.jsx(o0,{providers:u,onOpenSettings:m,onOpenInstallHelp:f})]}),n.jsx("div",{style:{flex:1}}),n.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>p(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(f0,{mode:h}),n.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function d0(a,r,i){return a==="light"?"dark":a==="dark"?"auto":i?"light":r==="light"?"dark":"light"}function Zh({color:a}){return n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:a,display:"inline-block",flexShrink:0}})}function Bu(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function f0({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 oo=0,Ka=1,hr=2,tv=4;function Jh(a){return()=>a}function p0(a){a()}function nv(a,r){return i=>a(r(i))}function ex(a,r){return()=>a(r)}function m0(a,r){return i=>a(r,i)}function xd(a){return a!==void 0}function h0(...a){return()=>{a.map(p0)}}function xr(){}function co(a,r){return r(a),a}function x0(a,r){return r(a)}function ht(...a){return a}function et(a,r){return a(Ka,r)}function Ue(a,r){a(oo,r)}function vd(a){a(hr)}function gt(a){return a(tv)}function we(a,r){return et(a,m0(r,oo))}function Vn(a,r){const i=a(Ka,o=>{i(),r(o)});return i}function tx(a){let r,i;return o=>u=>{r=u,i&&clearTimeout(i),i=setTimeout(()=>{o(r)},a)}}function av(a,r){return a===r}function mt(a=av){let r;return i=>o=>{a(r,o)||(r=o,i(o))}}function Ae(a){return r=>i=>{a(i)&&r(i)}}function ge(a){return r=>nv(r,a)}function Wn(a){return r=>()=>{r(a)}}function ie(a,...r){const i=v0(...r);return((o,u)=>{switch(o){case hr:vd(a);return;case Ka:return et(a,i(u))}})}function Pn(a,r){return i=>o=>{i(r=a(r,o))}}function vl(a){return r=>i=>{a>0?a--:r(i)}}function va(a){let r=null,i;return o=>u=>{r=u,!i&&(i=setTimeout(()=>{i=void 0,o(r)},a))}}function Ve(...a){const r=new Array(a.length);let i=0,o=null;const u=2**a.length-1;return a.forEach((m,f)=>{const h=2**f;et(m,x=>{const p=i;i|=h,r[f]=x,p!==u&&i===u&&o&&(o(),o=null)})}),m=>f=>{const h=()=>{m([f].concat(r))};i===u?h():o=h}}function v0(...a){return r=>a.reduceRight(x0,r)}function y0(a){let r,i;const o=()=>r==null?void 0:r();return function(u,m){switch(u){case Ka:return m?i===m?void 0:(o(),i=m,r=et(a,m),r):(o(),xr);case hr:o(),i=null;return}}}function de(a){let r=a;const i=Pe();return((o,u)=>{switch(o){case oo:r=u;break;case Ka:{u(r);break}case tv:return r}return i(o,u)})}function Qt(a,r){return co(de(r),i=>we(a,i))}function Pe(){const a=[];return((r,i)=>{switch(r){case oo:a.slice().forEach(o=>{o(i)});return;case hr:a.splice(0,a.length);return;case Ka:return a.push(i),()=>{const o=a.indexOf(i);o>-1&&a.splice(o,1)}}})}function bn(a){return co(Pe(),r=>we(a,r))}function Ze(a,r=[],{singleton:i}={singleton:!0}){return{constructor:a,dependencies:r,id:g0(),singleton:i}}const g0=()=>Symbol();function b0(a){const r=new Map,i=({constructor:o,dependencies:u,id:m,singleton:f})=>{if(f&&r.has(m))return r.get(m);const h=o(u.map(x=>i(x)));return f&&r.set(m,h),h};return i(a)}function Lt(...a){const r=Pe(),i=new Array(a.length);let o=0;const u=2**a.length-1;return a.forEach((m,f)=>{const h=2**f;et(m,x=>{i[f]=x,o|=h,o===u&&Ue(r,i)})}),function(m,f){switch(m){case hr:{vd(r);return}case Ka:return o===u&&f(i),et(r,f)}}}function Re(a,r=av){return ie(a,mt(r))}function ad(...a){return function(r,i){switch(r){case hr:return;case Ka:return h0(...a.map(o=>et(o,i)))}}}const Bt={DEBUG:0,INFO:1,WARN:2,ERROR:3},j0={[Bt.DEBUG]:"debug",[Bt.ERROR]:"error",[Bt.INFO]:"log",[Bt.WARN]:"warn"},S0=()=>typeof globalThis>"u"?window:globalThis,Fa=Ze(()=>{const a=de(Bt.ERROR);return{log:de((r,i,o=Bt.INFO)=>{const u=S0().VIRTUOSO_LOG_LEVEL??gt(a);o>=u&&console[j0[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,i)}),logLevel:a}},[],{singleton:!0});function gl(a,r,i){return yd(a,r,i).callbackRef}function yd(a,r,i){const o=ke.useRef(null);let u=f=>{};const m=ke.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?(m==null||m.observe(f),o.current=f):(o.current&&(m==null||m.unobserve(o.current)),o.current=null)},{callbackRef:u,ref:o}}function k0(a,r,i,o,u,m,f,h,x){const p=ke.useCallback(b=>{const g=w0(b.children,r,h?"offsetWidth":"offsetHeight",u);let j=b.parentElement;for(;j.dataset.virtuosoScroller===void 0;)j=j.parentElement;const S=j.lastElementChild.dataset.viewportType==="window";let C;S&&(C=j.ownerDocument.defaultView);const z=f?h?f.scrollLeft:f.scrollTop:S?h?C.scrollX||C.document.documentElement.scrollLeft:C.scrollY||C.document.documentElement.scrollTop:h?j.scrollLeft:j.scrollTop,E=f?h?f.scrollWidth:f.scrollHeight:S?h?C.document.documentElement.scrollWidth:C.document.documentElement.scrollHeight:h?j.scrollWidth:j.scrollHeight,N=f?h?f.offsetWidth:f.offsetHeight:S?h?C.innerWidth:C.innerHeight:h?j.offsetWidth:j.offsetHeight;o({scrollHeight:E,scrollTop:Math.max(z,0),viewportHeight:N}),m==null||m(h?nx("column-gap",getComputedStyle(b).columnGap,u):nx("row-gap",getComputedStyle(b).rowGap,u)),g!==null&&a(g)},[a,r,u,m,f,o,h]);return yd(p,i,x)}function w0(a,r,i,o){const u=a.length;if(u===0)return null;const m=[];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),p=parseFloat(h.dataset.knownSize),b=r(h,i);if(b===0&&o("Zero-sized element, this should not happen",{child:h},Bt.ERROR),b===p)continue;const g=m[m.length-1];m.length===0||g.size!==b||g.endIndex!==x-1?m.push({endIndex:x,size:b,startIndex:x}):m[m.length-1].endIndex++}return m}function nx(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 lv(a,r,i){const o=ke.useRef(null),u=ke.useCallback(x=>{if(!(x!=null&&x.offsetParent))return;const p=x.getBoundingClientRect(),b=p.width;let g,j;if(r){const S=r.getBoundingClientRect(),C=p.top-S.top;j=S.height-Math.max(0,C),g=C+r.scrollTop}else{const S=f.current.ownerDocument.defaultView;j=S.innerHeight-Math.max(0,p.top),g=p.top+S.scrollY}o.current={listHeight:p.height,offsetTop:g,visibleHeight:j,visibleWidth:b},a(o.current)},[a,r]),{callbackRef:m,ref:f}=yd(u,!0,i),h=ke.useCallback(()=>{u(f.current)},[u,f]);return ke.useEffect(()=>{var p;if(r){r.addEventListener("scroll",h);const b=new ResizeObserver(()=>{requestAnimationFrame(h)});return b.observe(r),()=>{r.removeEventListener("scroll",h),b.unobserve(r)}}const x=(p=f.current)==null?void 0:p.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]),m}const nn=Ze(()=>{const a=Pe(),r=Pe(),i=de(0),o=Pe(),u=de(0),m=Pe(),f=Pe(),h=de(0),x=de(0),p=de(0),b=de(0),g=Pe(),j=Pe(),S=de(!1),C=de(!1),z=de(!1);return we(ie(a,ge(({scrollTop:E})=>E)),r),we(ie(a,ge(({scrollHeight:E})=>E)),f),we(r,u),{deviation:i,fixedFooterHeight:p,fixedHeaderHeight:x,footerHeight:b,headerHeight:h,horizontalDirection:C,scrollBy:j,scrollContainerState:a,scrollHeight:f,scrollingInProgress:S,scrollTo:g,scrollTop:r,skipAnimationFrameInResizeObserver:z,smoothScrollTargetReached:o,statefulScrollTop:u,viewportHeight:m}},[],{singleton:!0}),gs={lvl:0};function rv(a,r){const i=a.length;if(i===0)return[];let{index:o,value:u}=r(a[0]);const m=[];for(let f=1;f<i;f++){const{index:h,value:x}=r(a[f]);m.push({end:h-1,start:o,value:u}),o=h,u=x}return m.push({end:1/0,start:o,value:u}),m}function ot(a){return a===gs}function bs(a,r){if(!ot(a))return r===a.k?a.v:r<a.k?bs(a.l,r):bs(a.r,r)}function $n(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=$n(a.r,r,i);return o[0]===-1/0?[a.k,a.v]:o}return $n(a.l,r,i)}function yn(a,r,i){return ot(a)?ov(r,i,1):r===a.k?Ot(a,{k:r,v:i}):r<a.k?ax(Ot(a,{l:yn(a.l,r,i)})):ax(Ot(a,{r:yn(a.r,r,i)}))}function cr(){return gs}function ur(a,r,i){if(ot(a))return[];const o=$n(a,r)[0];return C0(rd(a,o,i))}function ld(a,r){if(ot(a))return gs;const{k:i,l:o,r:u}=a;if(r===i){if(ot(o))return u;if(ot(u))return o;const[m,f]=iv(o);return Qi(Ot(a,{k:m,l:sv(o),v:f}))}return r<i?Qi(Ot(a,{l:ld(o,r)})):Qi(Ot(a,{r:ld(u,r)}))}function xl(a){return ot(a)?[]:[...xl(a.l),{k:a.k,v:a.v},...xl(a.r)]}function rd(a,r,i){if(ot(a))return[];const{k:o,l:u,r:m,v:f}=a;let h=[];return o>r&&(h=h.concat(rd(u,r,i))),o>=r&&o<=i&&h.push({k:o,v:f}),o<=i&&(h=h.concat(rd(m,r,i))),h}function Qi(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(Hu(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(Hu(a))return sd(Ot(a,{lvl:i-1}));if(!ot(o)&&!ot(o.l)){const u=o.l,m=Hu(u)?o.lvl-1:o.lvl;return Ot(u,{l:Ot(a,{lvl:i-1,r:u.l}),lvl:u.lvl+1,r:sd(Ot(o,{l:u.r,lvl:m}))})}throw new Error("Unexpected empty nodes")}function Ot(a,r){return ov(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:Qi(Ot(a,{r:sv(a.r)}))}function Hu(a){return ot(a)||a.lvl>a.r.lvl}function iv(a){return ot(a.r)?[a.k,a.v]:iv(a.r)}function ov(a,r,i,o=gs,u=gs){return{k:a,l:o,lvl:i,r:u,v:r}}function ax(a){return sd(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 sd(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 C0(a){return rv(a,({k:r,v:i})=>({index:r,value:i}))}function uv(a,r){return!!(a&&a.startIndex===r.startIndex&&a.endIndex===r.endIndex)}function js(a,r){return!!(a&&a[0]===r[0]&&a[1]===r[1])}const gd=Ze(()=>({recalcInProgress:de(!1)}),[],{singleton:!0});function dv(a,r,i){return a[no(a,r,i)]}function no(a,r,i,o=0){let u=a.length-1;for(;o<=u;){const m=Math.floor((o+u)/2),f=a[m],h=i(f,r);if(h===0)return m;if(h===-1){if(u-o<2)return m-1;u=m-1}else{if(u===o)return m;o=m+1}}throw new Error(`Failed binary finding record in array - ${a.join(",")}, searched for ${r}`)}function N0(a,r,i,o){const u=no(a,r,o),m=no(a,i,o,u);return a.slice(u,m+1)}function Ya(a,r){return Math.round(a.getBoundingClientRect()[r])}function uo(a){return!ot(a.groupOffsetTree)}function bd({index:a},r){return r===a?0:r<a?-1:1}function E0(){return{groupIndices:[],groupOffsetTree:cr(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:cr()}}function T0(a,r){let i=ot(a)?0:1/0;for(const o of r){const{endIndex:u,size:m,startIndex:f}=o;if(i=Math.min(i,f),ot(a)){a=yn(a,0,m);continue}const h=ur(a,f-1,u+1);if(h.some(_0(o)))continue;let x=!1,p=!1;for(const{end:b,start:g,value:j}of h)x?(u>=g||m===j)&&(a=ld(a,g)):(p=j!==m,x=!0),b>u&&u>=g&&j!==m&&(a=yn(a,u+1,j));p&&(a=yn(a,f,m))}return[a,i]}function R0(a){return typeof a.groupIndex<"u"}function A0({offset:a},r){return r===a?0:r<a?-1:1}function Ss(a,r,i){if(r.length===0)return 0;const{index:o,offset:u,size:m}=dv(r,a,bd),f=a-o,h=m*f+(f-1)*i+u;return h>0?h+i:h}function fv(a,r){if(!uo(r))return a;let i=0;for(;r.groupIndices[i]<=a+i;)i++;return a+i}function pv(a,r,i){if(R0(a))return r.groupIndices[a.groupIndex]+1;const o=a.index==="LAST"?i:a.index;let u=fv(o,r);return u=Math.max(0,u,Math.min(i,u)),u}function M0(a,r,i,o=0){return o>0&&(r=Math.max(r,dv(a,o,bd).offset)),rv(N0(a,r,i,A0),L0)}function D0(a,[r,i,o,u]){r.length>0&&o("received item sizes",r,Bt.DEBUG);const m=a.sizeTree;let f=m,h=0;if(i.length>0&&ot(m)&&r.length===2){const j=r[0].size,S=r[1].size;f=i.reduce((C,z)=>yn(yn(C,z,j),z+1,S),f)}else[f,h]=T0(f,r);if(f===m)return a;const{lastIndex:x,lastOffset:p,lastSize:b,offsetTree:g}=id(a.offsetTree,h,f,u);return{groupIndices:i,groupOffsetTree:i.reduce((j,S)=>yn(j,S,Ss(S,g,u)),cr()),lastIndex:x,lastOffset:p,lastSize:b,offsetTree:g,sizeTree:f}}function z0(a){return xl(a).map(({k:r,v:i},o,u)=>{const m=u[o+1];return{endIndex:m!==void 0?m.k-1:1/0,size:i,startIndex:r}})}function lx(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 id(a,r,i,o){let u=a,m=0,f=0,h=0,x=0;if(r!==0){x=no(u,r-1,bd),h=u[x].offset;const p=$n(i,r-1);m=p[0],f=p[1],u.length&&u[x].size===$n(i,r)[1]&&(x-=1),u=u.slice(0,x+1)}else u=[];for(const{start:p,value:b}of ur(i,r,1/0)){const g=p-m,j=g*f+h+g*o;u.push({index:p,offset:j,size:b}),m=p,h=j,f=b}return{lastIndex:m,lastOffset:h,lastSize:f,offsetTree:u}}function L0(a){return{index:a.index,value:a}}function _0(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 O0={offsetHeight:"height",offsetWidth:"width"},Xn=Ze(([{log:a},{recalcInProgress:r}])=>{const i=Pe(),o=Pe(),u=Qt(o,0),m=Pe(),f=Pe(),h=de(0),x=de([]),p=de(void 0),b=de(void 0),g=de(void 0),j=de(void 0),S=de((w,D)=>Ya(w,O0[D])),C=de(void 0),z=de(0),E=E0(),N=Qt(ie(i,Ve(x,a,z),Pn(D0,E),mt()),E),M=Qt(ie(x,mt(),Pn((w,D)=>({current:D,prev:w.current}),{current:[],prev:[]}),ge(({prev:w})=>w)),[]);we(ie(x,Ae(w=>w.length>0),Ve(N,z),ge(([w,D,R])=>{const U=w.reduce((q,F,te)=>yn(q,F,Ss(F,D.offsetTree,R)||te),cr());return{...D,groupIndices:w,groupOffsetTree:U}})),N),we(ie(o,Ve(N),Ae(([w,{lastIndex:D}])=>w<D),ge(([w,{lastIndex:D,lastSize:R}])=>[{endIndex:D,size:R,startIndex:w}])),i),we(p,b);const _=Qt(ie(p,ge(w=>w===void 0)),!0);we(ie(b,Ae(w=>w!==void 0&&ot(gt(N).sizeTree)),ge(w=>{const D=gt(g),R=gt(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),we(ie(j,Ae(w=>w!==void 0&&w.length>0&&ot(gt(N).sizeTree)),ge(w=>{const D=[];let R=w[0],U=0;for(let q=1;q<w.length;q++){const F=w[q];F!==R&&(D.push({endIndex:q-1,size:R,startIndex:U}),R=F,U=q)}return D.push({endIndex:w.length-1,size:R,startIndex:U}),D})),i),we(ie(x,Ve(g,b),Ae(([,w,D])=>w!==void 0&&D!==void 0),ge(([w,D,R])=>{const U=[];for(let q=0;q<w.length;q++){const F=w[q],te=w[q+1];U.push({startIndex:F,endIndex:F,size:D}),te!==void 0&&U.push({startIndex:F+1,endIndex:te-1,size:R})}return U})),i);const I=bn(ie(i,Ve(N),Pn(({sizes:w},[D,R])=>({changed:R!==w,sizes:R}),{changed:!1,sizes:E}),ge(w=>w.changed)));et(ie(h,Pn((w,D)=>({diff:w.prev-D,prev:D}),{diff:0,prev:0}),ge(w=>w.diff)),w=>{const{groupIndices:D}=gt(N);if(w>0)Ue(r,!0),Ue(m,w+lx(w,D));else if(w<0){const R=gt(M);R.length>0&&(w-=lx(-w,R)),Ue(f,w)}}),et(ie(h,Ve(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 L=bn(m);we(ie(m,Ve(N),ge(([w,D])=>{const R=D.groupIndices.length>0,U=[],q=D.lastSize;if(R){const F=bs(D.sizeTree,0);let te=0,Q=0;for(;te<w;){const A=D.groupIndices[Q],B=D.groupIndices.length===Q+1?1/0:D.groupIndices[Q+1]-A-1;U.push({endIndex:A,size:F,startIndex:A}),U.push({endIndex:A+1+B-1,size:q,startIndex:A+1}),Q++,te+=B+1}const O=xl(D.sizeTree);return te!==w&&O.shift(),O.reduce((A,{k:B,v:se})=>{let K=A.ranges;return A.prevSize!==0&&(K=[...A.ranges,{endIndex:B+w-1,size:A.prevSize,startIndex:A.prevIndex}]),{prevIndex:B+w,prevSize:se,ranges:K}},{prevIndex:w,prevSize:0,ranges:U}).ranges}return xl(D.sizeTree).reduce((F,{k:te,v:Q})=>({prevIndex:te+w,prevSize:Q,ranges:[...F.ranges,{endIndex:te+w-1,size:F.prevSize,startIndex:F.prevIndex}]}),{prevIndex:0,prevSize:q,ranges:[]}).ranges})),i);const $=bn(ie(f,Ve(N,z),ge(([w,{offsetTree:D},R])=>{const U=-w;return Ss(U,D,R)})));return we(ie(f,Ve(N,z),ge(([w,D,R])=>{if(D.groupIndices.length>0){if(ot(D.sizeTree))return D;let q=cr();const F=gt(M);let te=0,Q=0,O=0;for(;te<-w;){O=F[Q];const A=F[Q+1]-O-1;Q++,te+=A+1}if(q=xl(D.sizeTree).reduce((A,{k:B,v:se})=>yn(A,Math.max(0,B+w),se),q),te!==-w){const A=bs(D.sizeTree,O);q=yn(q,0,A);const B=$n(D.sizeTree,-w+1)[1];q=yn(q,1,B)}return{...D,sizeTree:q,...id(D.offsetTree,0,q,R)}}const U=xl(D.sizeTree).reduce((q,{k:F,v:te})=>yn(q,Math.max(0,F+w),te),cr());return{...D,sizeTree:U,...id(D.offsetTree,0,U,R)}})),N),{beforeUnshiftWith:L,data:C,defaultItemSize:b,firstItemIndex:h,fixedItemSize:p,fixedGroupSize:g,gap:z,groupIndices:x,heightEstimates:j,itemSize:S,listRefresh:I,shiftWith:f,shiftWithOffset:$,sizeRanges:i,sizes:N,statefulTotalCount:u,totalCount:o,trackItemSizes:_,unshiftWith:m}},ht(Fa,gd),{singleton:!0});function B0(a){return a.reduce((r,i)=>(r.groupIndices.push(r.totalCount),r.totalCount+=i+1,r),{groupIndices:[],totalCount:0})}const mv=Ze(([{groupIndices:a,sizes:r,totalCount:i},{headerHeight:o,scrollTop:u}])=>{const m=Pe(),f=Pe(),h=bn(ie(m,ge(B0)));return we(ie(h,ge(x=>x.totalCount)),i),we(ie(h,ge(x=>x.groupIndices)),a),we(ie(Lt(u,r,o),Ae(([x,p])=>uo(p)),ge(([x,p,b])=>$n(p.groupOffsetTree,Math.max(x-b,0),"v")[0]),mt(),ge(x=>[x])),f),{groupCounts:m,topItemsIndexes:f}},ht(Xn,nn)),Wa=Ze(([{log:a}])=>{const r=de(!1),i=bn(ie(r,Ae(o=>o),mt()));return et(r,o=>{o&>(a)("props updated",{},Bt.DEBUG)}),{didMount:i,propsReady:r}},ht(Fa),{singleton:!0}),H0=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function hv(a){const r=typeof a=="number"?{index:a}:a;return r.align||(r.align="start"),(!r.behavior||!H0)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const Ns=Ze(([{gap:a,listRefresh:r,sizes:i,totalCount:o},{fixedFooterHeight:u,fixedHeaderHeight:m,footerHeight:f,headerHeight:h,scrollingInProgress:x,scrollTo:p,smoothScrollTargetReached:b,viewportHeight:g},{log:j}])=>{const S=Pe(),C=Pe(),z=de(0);let E=null,N=null,M=null;function _(){E!==null&&(E(),E=null),M!==null&&(M(),M=null),N&&(clearTimeout(N),N=null),Ue(x,!1)}return we(ie(S,Ve(i,g,o,z,h,f,j),Ve(a,m,u),ge(([[I,L,$,w,D,R,U,q],F,te,Q])=>{const O=hv(I),{align:A,behavior:B,offset:se}=O,K=w-1,pe=pv(O,L,K);let T=Ss(pe,L.offsetTree,F)+R;A==="end"?(T+=te+$n(L.sizeTree,pe)[1]-$+Q,pe===K&&(T+=U)):A==="center"?T+=(te+$n(L.sizeTree,pe)[1]-$+Q)/2:T-=D,se!==void 0&&se!==0&&(T+=se);const Y=ae=>{_(),ae?(q("retrying to scroll to",{location:I},Bt.DEBUG),Ue(S,I)):(Ue(C,!0),q("list did not change, scroll successful",{},Bt.DEBUG))};if(_(),B==="smooth"){let ae=!1;M=et(r,fe=>{ae=ae||fe}),E=Vn(b,()=>{Y(ae)})}else E=Vn(ie(r,U0(150)),Y);return N=setTimeout(()=>{_()},1200),Ue(x,!0),q("scrolling from index to",{behavior:B,index:pe,top:T},Bt.DEBUG),{behavior:B,top:T}})),p),{scrollTargetReached:C,scrollToIndex:S,topListHeight:z}},ht(Xn,nn,Fa),{singleton:!0});function U0(a){return r=>{const i=setTimeout(()=>{r(!1)},a);return o=>{o&&(r(!0),clearTimeout(i))}}}function jd(a,r){a===0?r():requestAnimationFrame(()=>{jd(a-1,r)})}function Sd(a,r){const i=r-1;return typeof a=="number"?a:a.index==="LAST"?i:a.index}const Es=Ze(([{defaultItemSize:a,listRefresh:r,sizes:i},{scrollTop:o},{scrollTargetReached:u,scrollToIndex:m},{didMount:f}])=>{const h=de(!0),x=de(0),p=de(!0);return we(ie(f,Ve(x),Ae(([b,g])=>g!==0),Wn(!1)),h),we(ie(f,Ve(x),Ae(([b,g])=>g!==0),Wn(!1)),p),et(ie(Lt(r,f),Ve(h,i,a,p),Ae(([[,b],g,{sizeTree:j},S,C])=>b&&(!ot(j)||xd(S))&&!g&&!C),Ve(x)),([,b])=>{Vn(u,()=>{Ue(p,!0)}),jd(4,()=>{Vn(o,()=>{Ue(h,!0)}),Ue(m,b)})}),{initialItemFinalLocationReached:p,initialTopMostItemIndex:x,scrolledToInitialItem:h}},ht(Xn,nn,Ns,Wa),{singleton:!0});function xv(a,r){return Math.abs(a-r)<1.01}const ks="up",xs="down",I0="none",V0={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},$0=0,Ts=Ze(([{footerHeight:a,headerHeight:r,scrollBy:i,scrollContainerState:o,scrollTop:u,viewportHeight:m}])=>{const f=de(!1),h=de(!0),x=Pe(),p=Pe(),b=de(4),g=de($0),j=Qt(ie(ad(ie(Re(u),vl(1),Wn(!0)),ie(Re(u),vl(1),Wn(!1),tx(100))),mt()),!1),S=Qt(ie(ad(ie(i,Wn(!0)),ie(i,Wn(!1),tx(200))),mt()),!1);we(ie(Lt(Re(u),Re(g)),ge(([M,_])=>M<=_),mt()),h),we(ie(h,va(50)),p);const C=bn(ie(Lt(o,Re(m),Re(r),Re(a),Re(b)),Pn((M,[{scrollHeight:_,scrollTop:I},L,$,w,D])=>{const R=I+L-_>-D,U={scrollHeight:_,scrollTop:I,viewportHeight:L};if(R){let F,te;return I>M.state.scrollTop?(F="SCROLLED_DOWN",te=M.state.scrollTop-I):(F="SIZE_DECREASED",te=M.state.scrollTop-I||M.scrollTopDelta),{atBottom:!0,atBottomBecause:F,scrollTopDelta:te,state:U}}let q;return U.scrollHeight>M.state.scrollHeight?q="SIZE_INCREASED":L<M.state.viewportHeight?q="VIEWPORT_HEIGHT_DECREASING":I<M.state.scrollTop?q="SCROLLING_UPWARDS":q="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:q,state:U}},V0),mt((M,_)=>M!==void 0&&M.atBottom===_.atBottom))),z=Qt(ie(o,Pn((M,{scrollHeight:_,scrollTop:I,viewportHeight:L})=>{if(!xv(M.scrollHeight,_)){const $=_-(I+L)<1;return M.scrollTop!==I&&$?{changed:!0,jump:M.scrollTop-I,scrollHeight:_,scrollTop:I}:{changed:!0,jump:0,scrollHeight:_,scrollTop:I}}return{changed:!1,jump:0,scrollHeight:_,scrollTop:I}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Ae(M=>M.changed),ge(M=>M.jump)),0);we(ie(C,ge(M=>M.atBottom)),f),we(ie(f,va(50)),x);const E=de(xs);we(ie(o,ge(({scrollTop:M})=>M),mt(),Pn((M,_)=>gt(S)?{direction:M.direction,prevScrollTop:_}:{direction:_<M.prevScrollTop?ks:xs,prevScrollTop:_},{direction:xs,prevScrollTop:0}),ge(M=>M.direction)),E),we(ie(o,va(50),Wn(I0)),E);const N=de(0);return we(ie(j,Ae(M=>!M),Wn(0)),N),we(ie(u,va(100),Ve(j),Ae(([M,_])=>_),Pn(([M,_],[I])=>[_,I],[0,0]),ge(([M,_])=>_-M)),N),{atBottomState:C,atBottomStateChange:x,atBottomThreshold:b,atTopStateChange:p,atTopThreshold:g,isAtBottom:f,isAtTop:h,isScrolling:j,lastJumpDueToItemResize:z,scrollDirection:E,scrollVelocity:N}},ht(nn)),ws="top",Cs="bottom",rx="none";function sx(a,r,i){return typeof a=="number"?i===ks&&r===ws||i===xs&&r===Cs?a:0:i===ks?r===ws?a.main:a.reverse:r===Cs?a.main:a.reverse}function ix(a,r){return typeof a=="number"?a:a[r]??0}const kd=Ze(([{deviation:a,fixedHeaderHeight:r,headerHeight:i,scrollTop:o,viewportHeight:u}])=>{const m=Pe(),f=de(0),h=de(0),x=de(0),p=Qt(ie(Lt(Re(o),Re(u),Re(i),Re(m,js),Re(x),Re(f),Re(r),Re(a),Re(h)),ge(([b,g,j,[S,C],z,E,N,M,_])=>{const I=b-M,L=E+N,$=Math.max(j-I,0);let w=rx;const D=ix(_,ws),R=ix(_,Cs);return S-=M,S+=j+N,C+=j+N,C-=M,S>b+L-D&&(w=ks),C<b-$+g+R&&(w=xs),w!==rx?[Math.max(I-j-sx(z,ws,w)-D,0),I-$-N+g+sx(z,Cs,w)+R]:null}),Ae(b=>b!==null),mt(js)),[0,0]);return{increaseViewportBy:h,listBoundary:m,overscan:x,topListHeight:f,visibleRange:p}},ht(nn),{singleton:!0});function G0(a,r,i){if(uo(r)){const o=fv(a,r);return[{index:$n(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 Uu={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Zi(a,r,i,o,u,m){const{lastIndex:f,lastOffset:h,lastSize:x}=u;let p=0,b=0;if(a.length>0){p=a[0].offset;const z=a[a.length-1];b=z.offset+z.size}const g=i-f,j=h+g*x+(g-1)*o,S=p,C=j-b;return{bottom:b,firstItemIndex:m,items:ox(a,u,m),offsetBottom:C,offsetTop:p,top:S,topItems:ox(r,u,m),topListHeight:r.reduce((z,E)=>E.size+z,0),totalCount:i}}function vv(a,r,i,o,u,m){let f=0;if(i.groupIndices.length>0)for(const b of i.groupIndices){if(b-f>=a)break;f++}const h=a+f,x=Sd(r,h),p=Array.from({length:h}).map((b,g)=>({data:m[g+x],index:g+x,offset:0,size:0}));return Zi(p,[],h,u,i,o)}function ox(a,r,i){if(a.length===0)return[];if(!uo(r))return a.map(p=>({...p,index:p.index+i,originalIndex:p.index}));const o=a[0].index,u=a[a.length-1].index,m=[],f=ur(r.groupOffsetTree,o,u);let h,x=0;for(const p of a){(!h||h.end<p.index)&&(h=f.shift(),x=r.groupIndices.indexOf(h.start));let b;p.index===h.start?b={index:x,type:"group"}:b={groupIndex:x,index:p.index-(x+1)+i},m.push({...b,data:p.data,offset:p.offset,originalIndex:p.index,size:p.size})}return m}function cx(a,r){return a===void 0?0:typeof a=="number"?a:a[r]??0}const bl=Ze(([{data:a,firstItemIndex:r,gap:i,sizes:o,totalCount:u},m,{listBoundary:f,topListHeight:h,visibleRange:x},{initialTopMostItemIndex:p,scrolledToInitialItem:b},{topListHeight:g},j,{didMount:S},{recalcInProgress:C}])=>{const z=de([]),E=de(0),N=Pe(),M=de(0);we(m.topItemsIndexes,z);const _=Qt(ie(Lt(S,C,Re(x,js),Re(u),Re(o),Re(p),b,Re(z),Re(r),Re(i),Re(M),a),Ae(([w,D,,R,,,,,,,,U])=>{const q=U!==void 0&&U.length!==R;return w&&!D&&!q}),ge(([,,[w,D],R,U,q,F,te,Q,O,A,B])=>{var je,$e;const se=U,{offsetTree:K,sizeTree:pe}=se,T=gt(E);if(R===0)return{...Uu,totalCount:R};if(w===0&&D===0)return T===0?{...Uu,totalCount:R}:vv(T,q,U,Q,O,B||[]);if(ot(pe))return T>0?null:Zi(G0(Sd(q,R),se,B),[],R,O,se,Q);const Y=[];if(te.length>0){const Be=te[0],ne=te[te.length-1];let ue=0;for(const ce of ur(pe,Be,ne)){const me=ce.value,ye=Math.max(ce.start,Be),_e=Math.min(ce.end,ne);for(let Me=ye;Me<=_e;Me++)Y.push({data:B==null?void 0:B[Me],index:Me,offset:ue,size:me}),ue+=me}}if(!F)return Zi([],Y,R,O,se,Q);const ae=te.length>0?te[te.length-1]+1:0,fe=M0(K,w,D,ae);if(fe.length===0)return null;const ve=R-1,he=co([],Be=>{for(const ne of fe){const ue=ne.value;let ce=ue.offset,me=ne.start;const ye=ue.size;if(ue.offset<w){me+=Math.floor((w-ue.offset+O)/(ye+O));const Me=me-ne.start;ce+=Me*ye+Me*O}me<ae&&(ce+=(ae-me)*ye,me=ae);const _e=Math.min(ne.end,ve);for(let Me=me;Me<=_e&&!(ce>=D);Me++)Be.push({data:B==null?void 0:B[Me],index:Me,offset:ce,size:ye}),ce+=ye+O}}),Ce=cx(A,ws),oe=cx(A,Cs);if(he.length>0&&(Ce>0||oe>0)){const Be=he[0],ne=he[he.length-1];if(Ce>0&&Be.index>ae){const ue=Math.min(Ce,Be.index-ae),ce=[];let me=Be.offset;for(let ye=Be.index-1;ye>=Be.index-ue;ye--){const _e=((je=ur(pe,ye,ye)[0])==null?void 0:je.value)??Be.size;me-=_e+O,ce.unshift({data:B==null?void 0:B[ye],index:ye,offset:me,size:_e})}he.unshift(...ce)}if(oe>0&&ne.index<ve){const ue=Math.min(oe,ve-ne.index);let ce=ne.offset+ne.size+O;for(let me=ne.index+1;me<=ne.index+ue;me++){const ye=(($e=ur(pe,me,me)[0])==null?void 0:$e.value)??ne.size;he.push({data:B==null?void 0:B[me],index:me,offset:ce,size:ye}),ce+=ye+O}}}return Zi(he,Y,R,O,se,Q)}),Ae(w=>w!==null),mt()),Uu);we(ie(a,Ae(xd),ge(w=>w==null?void 0:w.length)),u),we(ie(_,ge(w=>w.topListHeight)),g),we(g,h),we(ie(_,ge(w=>[w.top,w.bottom])),f),we(ie(_,ge(w=>w.items)),N);const I=bn(ie(_,Ae(({items:w})=>w.length>0),Ve(u,a),Ae(([{items:w},D])=>w[w.length-1].originalIndex===D-1),ge(([,w,D])=>[w-1,D]),mt(js),ge(([w])=>w))),L=bn(ie(_,va(200),Ae(({items:w,topItems:D})=>w.length>0&&w[0].originalIndex===D.length),ge(({items:w})=>w[0].index),mt())),$=bn(ie(_,Ae(({items:w})=>w.length>0),ge(({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(uv)));return{endReached:I,initialItemCount:E,itemsRendered:N,listState:_,minOverscanItemCount:M,rangeChanged:$,startReached:L,topItemsIndexes:z,...j}},ht(Xn,mv,kd,Es,Ns,Ts,Wa,gd),{singleton:!0}),yv=Ze(([{fixedFooterHeight:a,fixedHeaderHeight:r,footerHeight:i,headerHeight:o},{listState:u}])=>{const m=Pe(),f=Qt(ie(Lt(i,a,o,r,u),ge(([h,x,p,b,g])=>h+x+p+b+g.offsetBottom+g.bottom)),0);return we(Re(f),m),{totalListHeight:f,totalListHeightChanged:m}},ht(nn,bl),{singleton:!0}),q0=Ze(([{viewportHeight:a},{totalListHeight:r}])=>{const i=de(!1),o=Qt(ie(Lt(i,a,r),Ae(([u])=>u),ge(([,u,m])=>Math.max(0,u-m)),va(0),mt()),0);return{alignToBottom:i,paddingTopAddition:o}},ht(nn,yv),{singleton:!0}),gv=Ze(()=>({context:de(null)})),Y0=({itemBottom:a,itemTop:r,locationParams:{align:i,behavior:o,...u},viewportBottom:m,viewportTop:f})=>r<f?{...u,align:i??"start",...o!==void 0?{behavior:o}:{}}:a>m?{...u,align:i??"end",...o!==void 0?{behavior:o}:{}}:null,bv=Ze(([{gap:a,sizes:r,totalCount:i},{fixedFooterHeight:o,fixedHeaderHeight:u,headerHeight:m,scrollingInProgress:f,scrollTop:h,viewportHeight:x},{scrollToIndex:p}])=>{const b=Pe();return we(ie(b,Ve(r,x,i,m,u,o,h),Ve(a),ge(([[g,j,S,C,z,E,N,M],_])=>{const{calculateViewLocation:I=Y0,done:L,...$}=g,w=pv(g,j,C-1),D=Ss(w,j.offsetTree,_)+z+E,R=D+$n(j.sizeTree,w)[1],U=M+E,q=M+S-N,F=I({itemBottom:R,itemTop:D,locationParams:$,viewportBottom:q,viewportTop:U});return F!==null?L&&Vn(ie(f,Ae(te=>!te),vl(gt(f)?1:2)),L):L==null||L(),F}),Ae(g=>g!==null)),p),{scrollIntoView:b}},ht(Xn,nn,Ns,bl,Fa),{singleton:!0});function ux(a){return a===!1?!1:a==="smooth"?"smooth":"auto"}const K0=(a,r)=>typeof a=="function"?ux(a(r)):r&&ux(a),F0=Ze(([{listRefresh:a,totalCount:r,fixedItemSize:i,data:o},{atBottomState:u,isAtBottom:m},{scrollToIndex:f},{scrolledToInitialItem:h},{didMount:x,propsReady:p},{log:b},{scrollingInProgress:g},{context:j},{scrollIntoView:S}])=>{const C=de(!1),z=Pe();let E=null;function N(L){Ue(f,{align:"end",behavior:L,index:"LAST"})}et(ie(Lt(ie(Re(r),vl(1)),x),Ve(Re(C),m,h,g),ge(([[L,$],w,D,R,U])=>{let q=$&&R,F="auto";return q&&(F=K0(w,D||U),q=q&&F!==!1),{followOutputBehavior:F,shouldFollow:q,totalCount:L}}),Ae(({shouldFollow:L})=>L)),({followOutputBehavior:L,totalCount:$})=>{E!==null&&(E(),E=null),gt(i)!==void 0?requestAnimationFrame(()=>{gt(b)("following output to ",{totalCount:$},Bt.DEBUG),N(L)}):E=Vn(a,()=>{gt(b)("following output to ",{totalCount:$},Bt.DEBUG),N(L),E=null})});function M(L){const $=Vn(u,w=>{L&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&E===null&&(gt(b)("scrolling to bottom due to increased size",{},Bt.DEBUG),N("auto"))});setTimeout($,100)}et(ie(Lt(Re(C),r,p),Ae(([L,,$])=>L!==!1&&$),Pn(({value:L},[,$])=>({refreshed:L===$,value:$}),{refreshed:!1,value:0}),Ae(({refreshed:L})=>L),Ve(C,r)),([,L])=>{gt(h)&&M(L!==!1)}),et(z,()=>{M(gt(C)!==!1)}),et(Lt(Re(C),u),([L,$])=>{L!==!1&&!$.atBottom&&$.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&N("auto")});const _=de(null),I=Pe();return we(ad(ie(Re(o),ge(L=>(L==null?void 0:L.length)??0)),ie(Re(r))),I),et(ie(Lt(ie(I,vl(1)),x),Ve(Re(_),h,g,j),ge(([[L,$],w,D,R,U])=>$&&D&&(w==null?void 0:w({context:U,totalCount:L,scrollingInProgress:R}))),Ae(L=>!!L),va(0)),L=>{E!==null&&(E(),E=null),gt(i)!==void 0?requestAnimationFrame(()=>{gt(b)("scrolling into view",{}),Ue(S,L)}):E=Vn(a,()=>{gt(b)("scrolling into view",{}),Ue(S,L),E=null})}),{autoscrollToBottom:z,followOutput:C,scrollIntoViewOnChange:_}},ht(Xn,Ts,Ns,Es,Wa,Fa,nn,gv,bv)),W0=Ze(([{data:a,firstItemIndex:r,gap:i,sizes:o},{initialTopMostItemIndex:u},{initialItemCount:m,listState:f},{didMount:h}])=>(we(ie(h,Ve(m),Ae(([,x])=>x!==0),Ve(u,o,r,i,a),ge(([[,x],p,b,g,j,S=[]])=>vv(x,p,b,g,j,S))),f),{}),ht(Xn,Es,bl,Wa),{singleton:!0}),P0=Ze(([{didMount:a},{scrollTo:r},{listState:i}])=>{const o=de(0);return et(ie(a,Ve(o),Ae(([,u])=>u!==0),ge(([,u])=>({top:u}))),u=>{Vn(ie(i,vl(1),Ae(m=>m.items.length>1)),()=>{requestAnimationFrame(()=>{Ue(r,u)})})}),{initialScrollTop:o}},ht(Wa,nn,bl),{singleton:!0}),jv=Ze(([{scrollVelocity:a}])=>{const r=de(!1),i=Pe(),o=de(!1);return we(ie(a,Ve(o,r,i),Ae(([u,m])=>m!==!1&&m!==void 0),ge(([u,m,f,h])=>{const{enter:x,exit:p}=m;if(f){if(p(u,h))return!1}else if(x(u,h))return!0;return f}),mt()),r),et(ie(Lt(r,a,i),Ve(o)),([[u,m,f],h])=>{u&&h!==!1&&h!==void 0&&h.change&&h.change(m,f)}),{isSeeking:r,scrollSeekConfiguration:o,scrollSeekRangeChanged:i,scrollVelocity:a}},ht(Ts),{singleton:!0}),wd=Ze(([{scrollContainerState:a,scrollTo:r}])=>{const i=Pe(),o=Pe(),u=Pe(),m=de(!1),f=de(void 0);return we(ie(Lt(i,o),ge(([{scrollTop:h,viewportHeight:x},{offsetTop:p,listHeight:b}])=>({scrollHeight:b,scrollTop:Math.max(0,h-p),viewportHeight:x}))),a),we(ie(r,Ve(o),ge(([h,{offsetTop:x}])=>({...h,top:h.top+x}))),u),{customScrollParent:f,useWindowScroll:m,windowScrollContainerState:i,windowScrollTo:u,windowViewportRect:o}},ht(nn)),X0=Ze(([{sizeRanges:a,sizes:r},{headerHeight:i,scrollTop:o},{initialTopMostItemIndex:u},{didMount:m},{useWindowScroll:f,windowScrollContainerState:h,windowViewportRect:x}])=>{const p=Pe(),b=de(void 0),g=de(null),j=de(null);return we(h,g),we(x,j),et(ie(p,Ve(r,o,f,g,j,i)),([S,C,z,E,N,M,_])=>{const I=z0(C.sizeTree);E&&N!==null&&M!==null&&(z=N.scrollTop-M.offsetTop),z-=_,S({ranges:I,scrollTop:z})}),we(ie(b,Ae(xd),ge(Q0)),u),we(ie(m,Ve(b),Ae(([,S])=>S!==void 0),mt(),ge(([,S])=>S.ranges)),a),{getState:p,restoreStateFrom:b}},ht(Xn,nn,Es,Wa,wd));function Q0(a){return{align:"start",index:0,offset:a.scrollTop}}const Z0=Ze(([{topItemsIndexes:a}])=>{const r=de(0);return we(ie(r,Ae(i=>i>=0),ge(i=>Array.from({length:i}).map((o,u)=>u))),a),{topItemCount:r}},ht(bl));function Sv(a){let r=!1,i;return(()=>(r||(r=!0,i=a()),i))}const J0=Sv(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),e2=Ze(([{deviation:a,scrollBy:r,scrollingInProgress:i,scrollTop:o},{isAtBottom:u,isScrolling:m,lastJumpDueToItemResize:f,scrollDirection:h},{listState:x},{beforeUnshiftWith:p,gap:b,shiftWithOffset:g,sizes:j},{log:S},{recalcInProgress:C}])=>{const z=bn(ie(x,Ve(f),Pn(([,N,M,_],[{bottom:I,items:L,offsetBottom:$,totalCount:w},D])=>{const R=I+$;let U=0;return M===w&&N.length>0&&L.length>0&&(L[0].originalIndex===0&&N[0].originalIndex===0||(U=R-_,U!==0&&(U+=D))),[U,L,w,R]},[0,[],0,0]),Ae(([N])=>N!==0),Ve(o,h,i,u,S,C),Ae(([,N,M,_,,,I])=>!I&&!_&&N!==0&&M===ks),ge(([[N],,,,,M])=>(M("Upward scrolling compensation",{amount:N},Bt.DEBUG),N))));function E(N){N>0?(Ue(r,{behavior:"auto",top:-N}),Ue(a,0)):(Ue(a,0),Ue(r,{behavior:"auto",top:-N}))}return et(ie(z,Ve(a,m)),([N,M,_])=>{_&&J0()?Ue(a,M-N):E(-N)}),et(ie(Lt(Qt(m,!1),a,C),Ae(([N,M,_])=>!N&&!_&&M!==0),ge(([N,M])=>M),va(1)),E),we(ie(g,ge(N=>({top:-N}))),r),et(ie(p,Ve(j,b),ge(([N,{groupIndices:M,lastSize:_,sizeTree:I},L])=>{function $(q){return q*(_+L)}if(M.length===0)return $(N);let w=0;const D=bs(I,0);let R=0,U=0;for(;R<N;){R++,w+=D;let q=M.length===U+1?1/0:M[U+1]-M[U]-1;R+q>N&&(w-=D,q=N-R+1),R+=q,w+=$(q),U++}return w})),N=>{Ue(a,N),requestAnimationFrame(()=>{Ue(r,{top:N}),requestAnimationFrame(()=>{Ue(a,0),Ue(C,!1)})})}),{deviation:a}},ht(nn,Ts,bl,Xn,Fa,gd)),t2=Ze(([a,r,i,o,u,m,f,h,x,p,b])=>({...a,...r,...i,...o,...u,...m,...f,...h,...x,...p,...b}),ht(kd,W0,Wa,jv,yv,P0,q0,wd,bv,Fa,gv)),kv=Ze(([{data:a,defaultItemSize:r,firstItemIndex:i,fixedItemSize:o,fixedGroupSize:u,gap:m,groupIndices:f,heightEstimates:h,itemSize:x,sizeRanges:p,sizes:b,statefulTotalCount:g,totalCount:j,trackItemSizes:S},{initialItemFinalLocationReached:C,initialTopMostItemIndex:z,scrolledToInitialItem:E},N,M,_,I,{scrollToIndex:L},$,{topItemCount:w},{groupCounts:D},R])=>{const{listState:U,minOverscanItemCount:q,topItemsIndexes:F,rangeChanged:te,...Q}=I;return we(te,R.scrollSeekRangeChanged),we(ie(R.windowViewportRect,ge(O=>O.visibleHeight)),N.viewportHeight),{data:a,defaultItemHeight:r,firstItemIndex:i,fixedItemHeight:o,fixedGroupHeight:u,gap:m,groupCounts:D,heightEstimates:h,initialItemFinalLocationReached:C,initialTopMostItemIndex:z,scrolledToInitialItem:E,sizeRanges:p,topItemCount:w,topItemsIndexes:F,totalCount:j,..._,groupIndices:f,itemSize:x,listState:U,minOverscanItemCount:q,scrollToIndex:L,statefulTotalCount:g,trackItemSizes:S,rangeChanged:te,...Q,...R,...N,sizes:b,...M}},ht(Xn,Es,nn,X0,F0,bl,Ns,e2,Z0,mv,t2));function n2(a,r){const i={},o={};let u=0;const m=a.length;for(;u<m;)o[a[u]]=1,u+=1;for(const f in r)Object.hasOwn(o,f)||(i[f]=r[f]);return i}const qi=typeof document<"u"?ke.useLayoutEffect:ke.useEffect;function wv(a,r,i){const o=Object.keys(r.required||{}),u=Object.keys(r.optional||{}),m=Object.keys(r.methods||{}),f=Object.keys(r.events||{}),h=ke.createContext({});function x(E,N){E.propsReady!==void 0&&Ue(E.propsReady,!1);for(const M of o){const _=E[r.required[M]];Ue(_,N[M])}for(const M of u)if(M in N){const _=E[r.optional[M]];Ue(_,N[M])}E.propsReady!==void 0&&Ue(E.propsReady,!0)}function p(E){return m.reduce((N,M)=>(N[M]=_=>{const I=E[r.methods[M]];Ue(I,_)},N),{})}function b(E){return f.reduce((N,M)=>(N[M]=y0(E[r.events[M]]),N),{})}const g=ke.forwardRef(function(E,N){const{children:M,..._}=E,[I]=ke.useState(()=>co(b0(a),w=>{x(w,_)})),[L]=ke.useState(ex(b,I));qi(()=>{for(const w of f)w in _&&et(L[w],_[w]);return()=>{Object.values(L).map(vd)}},[_,L,I]),qi(()=>{x(I,_)}),ke.useImperativeHandle(N,Jh(p(I)));const $=i;return n.jsx(h.Provider,{value:I,children:i!==void 0?n.jsx($,{...n2([...o,...u,...f],_),children:M}):M})}),j=E=>{const N=ke.useContext(h);return ke.useCallback(M=>{Ue(N[E],M)},[N,E])},S=E=>{const N=ke.useContext(h)[E],M=ke.useCallback(_=>et(N,_),[N]);return ke.useSyncExternalStore(M,()=>gt(N),()=>gt(N))},C=E=>{const N=ke.useContext(h)[E],[M,_]=ke.useState(ex(gt,N));return qi(()=>et(N,I=>{I!==M&&_(Jh(I))}),[N,M]),M},z=parseInt(ke.version)>=18?S:C;return{Component:g,useEmitter:(E,N)=>{const M=ke.useContext(h)[E];qi(()=>et(M,N),[N,M])},useEmitterValue:z,usePublisher:j}}const Cv=ke.createContext(void 0),Nv=ke.createContext(void 0),Iu="-webkit-sticky",dx="sticky",Cd=Sv(()=>{if(typeof document>"u")return dx;const a=document.createElement("div");return a.style.position=Iu,a.style.position===Iu?Iu:dx}),Ev=typeof document<"u"?ke.useLayoutEffect:ke.useEffect;function Vu(a){return"self"in a}function a2(a){return"body"in a}function Tv(a,r,i,o=xr,u,m){const f=ke.useRef(null),h=ke.useRef(null),x=ke.useRef(null),p=ke.useCallback(j=>{let S,C,z;const E=j.target;if(a2(E)||Vu(E)){const M=Vu(E)?E:E.defaultView;z=m===!0?M.scrollX:M.scrollY,S=m===!0?M.document.documentElement.scrollWidth:M.document.documentElement.scrollHeight,C=m===!0?M.innerWidth:M.innerHeight}else z=m===!0?E.scrollLeft:E.scrollTop,S=m===!0?E.scrollWidth:E.scrollHeight,C=m===!0?E.offsetWidth:E.offsetHeight;const N=()=>{a({scrollHeight:S,scrollTop:Math.max(z,0),viewportHeight:C})};j.suppressFlushSync===!0?N():nb.flushSync(N),h.current!==null&&(z===h.current||z<=0||z===S-C)&&(h.current=null,r(!0),x.current&&(clearTimeout(x.current),x.current=null))},[a,r,m]);ke.useEffect(()=>{const j=u||f.current;return o(u||f.current),p({suppressFlushSync:!0,target:j}),j.addEventListener("scroll",p,{passive:!0}),()=>{o(null),j.removeEventListener("scroll",p)}},[f,p,i,o,u]);function b(j){const S=f.current;if(!S||(m===!0?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const C=j.behavior==="smooth";let z,E,N;Vu(S)?(E=Math.max(Ya(S.document.documentElement,m===!0?"width":"height"),m===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),z=m===!0?S.innerWidth:S.innerHeight,N=m===!0?window.scrollX:window.scrollY):(E=S[m===!0?"scrollWidth":"scrollHeight"],z=Ya(S,m===!0?"width":"height"),N=S[m===!0?"scrollLeft":"scrollTop"]);const M=E-z;if(j.top=Math.ceil(Math.max(Math.min(M,j.top),0)),xv(z,E)||j.top===N){a({scrollHeight:E,scrollTop:N,viewportHeight:z}),C&&r(!0);return}C?(h.current=j.top,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,h.current=null,r(!0)},1e3)):h.current=null,m===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},left:j.top}),S.scrollTo(j)}function g(j){m===!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:b}}function Nd(a){return a}const l2=Ze(()=>{const a=de(h=>`Item ${h}`),r=de(h=>`Group ${h}`),i=de({}),o=de(Nd),u=de("div"),m=de(xr),f=(h,x=null)=>Qt(ie(i,ge(p=>p[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:m,ScrollSeekPlaceholder:f("ScrollSeekPlaceholder"),TopItemListComponent:f("TopItemList")}}),r2=Ze(([a,r])=>({...a,...r}),ht(kv,l2)),s2=({height:a})=>n.jsx("div",{style:{height:a}}),i2={overflowAnchor:"none",position:Cd(),zIndex:1},Rv={overflowAnchor:"none"},o2={...Rv,display:"inline-block",height:"100%"},fx=ke.memo(function({showTopList:a=!1}){const r=Le("listState"),i=Ln("sizeRanges"),o=Le("useWindowScroll"),u=Le("customScrollParent"),m=Ln("windowScrollContainerState"),f=Ln("scrollContainerState"),h=u||o?m:f,x=Le("itemContent"),p=Le("context"),b=Le("groupContent"),g=Le("trackItemSizes"),j=Le("itemSize"),S=Le("log"),C=Ln("gap"),z=Le("horizontalDirection"),{callbackRef:E}=k0(i,j,g,a?xr:h,S,C,u,z,Le("skipAnimationFrameInResizeObserver")),[N,M]=ke.useState(0);Ed("deviation",Q=>{N!==Q&&M(Q)});const _=Le("EmptyPlaceholder"),I=Le("ScrollSeekPlaceholder")??s2,L=Le("ListComponent"),$=Le("ItemComponent"),w=Le("GroupComponent"),D=Le("computeItemKey"),R=Le("isSeeking"),U=Le("groupIndices").length>0,q=Le("alignToBottom"),F=Le("initialItemFinalLocationReached"),te=a?{}:{boxSizing:"border-box",...z?{display:"inline-block",height:"100%",marginLeft:N!==0?N:q?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:N!==0?N:q?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...F?{}:{visibility:"hidden"}};return!a&&r.totalCount===0&&_!==null&&_!==void 0?n.jsx(_,{...Xt(_,p)}):n.jsx(L,{...Xt(L,p),"data-testid":a?"virtuoso-top-item-list":"virtuoso-item-list",ref:E,style:te,children:(a?r.topItems:r.items).map(Q=>{const O=Q.originalIndex,A=D(O+r.firstItemIndex,Q.data,p);return R?v.createElement(I,{...Xt(I,p),height:Q.size,index:Q.index,key:A,type:Q.type||"item",...Q.type==="group"?{}:{groupIndex:Q.groupIndex}}):Q.type==="group"?v.createElement(w,{...Xt(w,p),"data-index":O,"data-item-index":Q.index,"data-known-size":Q.size,key:A,style:i2},b(Q.index,p)):v.createElement($,{...Xt($,p),...f2($,Q.data),"data-index":O,"data-item-group-index":Q.groupIndex,"data-item-index":Q.index,"data-known-size":Q.size,key:A,style:z?o2:Rv},U?x(Q.index,Q.groupIndex,Q.data,p):x(Q.index,Q.data,p))})})}),c2={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},u2={outline:"none",overflowX:"auto",position:"relative"},fo=a=>({height:"100%",position:"absolute",top:0,width:"100%",...a?{display:"flex",flexDirection:"column"}:void 0}),d2={position:Cd(),top:0,width:"100%",zIndex:1};function Xt(a,r){if(typeof a!="string")return{context:r}}function f2(a,r){return{item:typeof a=="string"?void 0:r}}const p2=ke.memo(function(){const a=Le("HeaderComponent"),r=Ln("headerHeight"),i=Le("HeaderFooterTag"),o=gl(ke.useMemo(()=>m=>{r(Ya(m,"height"))},[r]),!0,Le("skipAnimationFrameInResizeObserver")),u=Le("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Xt(a,u)})}):null}),m2=ke.memo(function(){const a=Le("FooterComponent"),r=Ln("footerHeight"),i=Le("HeaderFooterTag"),o=gl(ke.useMemo(()=>m=>{r(Ya(m,"height"))},[r]),!0,Le("skipAnimationFrameInResizeObserver")),u=Le("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Xt(a,u)})}):null});function Av({useEmitter:a,useEmitterValue:r,usePublisher:i}){return ke.memo(function({children:o,style:u,context:m,...f}){const h=i("scrollContainerState"),x=r("ScrollerComponent"),p=i("smoothScrollTargetReached"),b=r("scrollerRef"),g=r("horizontalDirection")||!1,{scrollByCallback:j,scrollerRef:S,scrollToCallback:C}=Tv(h,p,x,b,void 0,g);return a("scrollTo",C),a("scrollBy",j),n.jsx(x,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...g?u2:c2,...u},tabIndex:0,...f,...Xt(x,m),children:o})})}function Mv({useEmitter:a,useEmitterValue:r,usePublisher:i}){return ke.memo(function({children:o,style:u,context:m,...f}){const h=i("windowScrollContainerState"),x=r("ScrollerComponent"),p=i("smoothScrollTargetReached"),b=r("totalListHeight"),g=r("deviation"),j=r("customScrollParent"),S=ke.useRef(null),C=r("scrollerRef"),{scrollByCallback:z,scrollerRef:E,scrollToCallback:N}=Tv(h,p,x,C,j);return Ev(()=>{var M;return E.current=j||((M=S.current)==null?void 0:M.ownerDocument.defaultView),()=>{E.current=null}},[E,j]),a("windowScrollTo",N),a("scrollBy",z),n.jsx(x,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...u,...b!==0?{height:b+g}:void 0},...f,...Xt(x,m),children:o})})}const h2=({children:a})=>{const r=ke.useContext(Cv),i=Ln("viewportHeight"),o=Ln("fixedItemHeight"),u=Le("alignToBottom"),m=Le("horizontalDirection"),f=ke.useMemo(()=>nv(i,x=>Ya(x,m?"width":"height")),[i,m]),h=gl(f,!0,Le("skipAnimationFrameInResizeObserver"));return ke.useEffect(()=>{r&&(i(r.viewportHeight),o(r.itemHeight))},[r,i,o]),n.jsx("div",{"data-viewport-type":"element",ref:h,style:fo(u),children:a})},x2=({children:a})=>{const r=ke.useContext(Cv),i=Ln("windowViewportRect"),o=Ln("fixedItemHeight"),u=Le("customScrollParent"),m=lv(i,u,Le("skipAnimationFrameInResizeObserver")),f=Le("alignToBottom");return ke.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:m,style:fo(f),children:a})},v2=({children:a})=>{const r=Le("TopItemListComponent")??"div",i=Le("headerHeight"),o={...d2,marginTop:`${i}px`},u=Le("context");return n.jsx(r,{style:o,...Xt(r,u),children:a})},y2=ke.memo(function(a){const r=Le("useWindowScroll"),i=Le("topItemsIndexes").length>0,o=Le("customScrollParent"),u=Le("context");return n.jsxs(o||r?j2:b2,{...a,context:u,children:[i&&n.jsx(v2,{children:n.jsx(fx,{showTopList:!0})}),n.jsxs(o||r?x2:h2,{children:[n.jsx(p2,{}),n.jsx(fx,{}),n.jsx(m2,{})]})]})}),{Component:g2,useEmitter:Ed,useEmitterValue:Le,usePublisher:Ln}=wv(r2,{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"}},y2),b2=Av({useEmitter:Ed,useEmitterValue:Le,usePublisher:Ln}),j2=Mv({useEmitter:Ed,useEmitterValue:Le,usePublisher:Ln}),S2=g2,k2=Ze(()=>{const a=de(p=>n.jsxs("td",{children:["Item $",p]})),r=de(null),i=de(p=>n.jsxs("td",{colSpan:1e3,children:["Group ",p]})),o=de(null),u=de(null),m=de({}),f=de(Nd),h=de(xr),x=(p,b=null)=>Qt(ie(m,ge(g=>g[p]),mt()),b);return{components:m,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(kv,k2);Cd();const px={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},w2={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:mx,floor:ao,max:vs,min:$u,round:hx}=Math;function xx(a,r,i){return Array.from({length:r-a+1}).map((o,u)=>({data:i===null?null:i[u+a],index:u+a}))}function C2(a){return{...w2,items:a}}function Yi(a,r){return a!==void 0&&a.width===r.width&&a.height===r.height}function N2(a,r){return a!==void 0&&a.column===r.column&&a.row===r.row}const E2=Ze(([{increaseViewportBy:a,listBoundary:r,overscan:i,visibleRange:o},{footerHeight:u,headerHeight:m,scrollBy:f,scrollContainerState:h,scrollTo:x,scrollTop:p,smoothScrollTargetReached:b,viewportHeight:g},j,S,{didMount:C,propsReady:z},{customScrollParent:E,useWindowScroll:N,windowScrollContainerState:M,windowScrollTo:_,windowViewportRect:I},L])=>{const $=de(0),w=de(0),D=de(px),R=de({height:0,width:0}),U=de({height:0,width:0}),q=Pe(),F=Pe(),te=de(0),Q=de(null),O=de({column:0,row:0}),A=Pe(),B=Pe(),se=de(!1),K=de(0),pe=de(!0),T=de(!1),Y=de(!1);et(ie(C,Ve(K),Ae(([oe,je])=>je!==0)),()=>{Ue(pe,!1)}),et(ie(Lt(C,pe,U,R,K,T),Ae(([oe,je,$e,Be,,ne])=>oe&&!je&&$e.height!==0&&Be.height!==0&&!ne)),([,,,,oe])=>{Ue(T,!0),jd(1,()=>{Ue(q,oe)}),Vn(ie(p),()=>{Ue(r,[0,0]),Ue(pe,!0)})}),we(ie(B,Ae(oe=>oe!=null&&oe.scrollTop>0),Wn(0)),w),et(ie(C,Ve(B),Ae(([,oe])=>oe!=null)),([,oe])=>{oe&&(Ue(R,oe.viewport),Ue(U,oe.item),Ue(O,oe.gap),oe.scrollTop>0&&(Ue(se,!0),Vn(ie(p,vl(1)),je=>{Ue(se,!1)}),Ue(x,{top:oe.scrollTop})))}),we(ie(R,ge(({height:oe})=>oe)),g),we(ie(Lt(Re(R,Yi),Re(U,Yi),Re(O,(oe,je)=>oe!==void 0&&oe.column===je.column&&oe.row===je.row),Re(p)),ge(([oe,je,$e,Be])=>({gap:$e,item:je,scrollTop:Be,viewport:oe}))),A),we(ie(Lt(Re($),o,Re(O,N2),Re(U,Yi),Re(R,Yi),Re(Q),Re(w),Re(se),Re(pe),Re(K)),Ae(([,,,,,,,oe])=>!oe),ge(([oe,[je,$e],Be,ne,ue,ce,me,,ye,_e])=>{const{column:Me,row:dt}=Be,{height:Zt,width:ct}=ne,{width:Vt}=ue;if(me===0&&(oe===0||Vt===0))return px;if(ct===0){const nt=Sd(_e,oe),Pa=nt+Math.max(me-1,0);return C2(xx(nt,Pa,ce))}const $t=Dv(Vt,ct,Me);let tt,jt;ye?je===0&&$e===0&&me>0?(tt=0,jt=me-1):(tt=$t*ao((je+dt)/(Zt+dt)),jt=$t*mx(($e+dt)/(Zt+dt))-1,jt=$u(oe-1,vs(jt,$t-1)),tt=$u(jt,vs(0,tt))):(tt=0,jt=-1);const xe=xx(tt,jt,ce),{bottom:Rt,top:De}=vx(ue,Be,ne,xe),xt=mx(oe/$t),Wt=xt*Zt+(xt-1)*dt-Rt;return{bottom:Rt,itemHeight:Zt,items:xe,itemWidth:ct,offsetBottom:Wt,offsetTop:De,top:De}})),D),we(ie(Q,Ae(oe=>oe!==null),ge(oe=>oe.length)),$),we(ie(Lt(R,U,D,O),Ae(([oe,je,{items:$e}])=>$e.length>0&&je.height!==0&&oe.height!==0),ge(([oe,je,{items:$e},Be])=>{const{bottom:ne,top:ue}=vx(oe,Be,je,$e);return[ue,ne]}),mt(js)),r);const ae=de(!1);we(ie(p,Ve(ae),ge(([oe,je])=>je||oe!==0)),ae);const fe=bn(ie(Lt(D,$),Ae(([{items:oe}])=>oe.length>0),Ve(ae),Ae(([[oe,je],$e])=>{const Be=oe.items[oe.items.length-1].index===je-1;return($e||oe.bottom>0&&oe.itemHeight>0&&oe.offsetBottom===0&&oe.items.length===je)&&Be}),ge(([[,oe]])=>oe-1),mt())),ve=bn(ie(Re(D),Ae(({items:oe})=>oe.length>0&&oe[0].index===0),Wn(0),mt())),he=bn(ie(Re(D),Ve(se),Ae(([{items:oe},je])=>oe.length>0&&!je),ge(([{items:oe}])=>({endIndex:oe[oe.length-1].index,startIndex:oe[0].index})),mt(uv),va(0)));we(he,S.scrollSeekRangeChanged),we(ie(q,Ve(R,U,$,O),ge(([oe,je,$e,Be,ne])=>{const ue=hv(oe),{align:ce,behavior:me,offset:ye}=ue;let _e=ue.index;_e==="LAST"&&(_e=Be-1),_e=vs(0,_e,$u(Be-1,_e));let Me=od(je,ne,$e,_e);return ce==="end"?Me=hx(Me-je.height+$e.height):ce==="center"&&(Me=hx(Me-je.height/2+$e.height/2)),ye!==void 0&&ye!==0&&(Me+=ye),{behavior:me,top:Me}})),x);const Ce=Qt(ie(D,ge(oe=>oe.offsetBottom+oe.bottom)),0);return we(ie(I,ge(oe=>({height:oe.visibleHeight,width:oe.visibleWidth}))),R),{customScrollParent:E,data:Q,deviation:te,footerHeight:u,gap:O,headerHeight:m,increaseViewportBy:a,initialItemCount:w,itemDimensions:U,overscan:i,restoreStateFrom:B,scrollBy:f,scrollContainerState:h,scrollHeight:F,scrollTo:x,scrollToIndex:q,scrollTop:p,smoothScrollTargetReached:b,totalCount:$,useWindowScroll:N,viewportDimensions:R,windowScrollContainerState:M,windowScrollTo:_,windowViewportRect:I,...S,gridState:D,horizontalDirection:Y,initialTopMostItemIndex:K,totalListHeight:Ce,...j,endReached:fe,propsReady:z,rangeChanged:he,startReached:ve,stateChanged:A,stateRestoreInProgress:se,...L}},ht(kd,nn,Ts,jv,Wa,wd,Fa));function Dv(a,r,i){return vs(1,ao((a+i)/(ao(r)+i)))}function vx(a,r,i,o){const{height:u}=i;if(u===void 0||o.length===0)return{bottom:0,top:0};const m=od(a,r,i,o[0].index);return{bottom:od(a,r,i,o[o.length-1].index)+u,top:m}}function od(a,r,i,o){const u=Dv(a.width,i.width,r.column),m=ao(o/u),f=m*i.height+vs(0,m-1)*r.row;return f>0?f+r.row:f}const T2=Ze(()=>{const a=de(g=>`Item ${g}`),r=de({}),i=de(null),o=de("virtuoso-grid-item"),u=de("virtuoso-grid-list"),m=de(Nd),f=de("div"),h=de(xr),x=(g,j=null)=>Qt(ie(r,ge(S=>S[g]),mt()),j),p=de(!1),b=de(!1);return we(Re(b),p),{components:r,computeItemKey:m,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:p,reportReadyState:b,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder","div")}}),R2=Ze(([a,r])=>({...a,...r}),ht(E2,T2)),A2=ke.memo(function(){const a=yt("gridState"),r=yt("listClassName"),i=yt("itemClassName"),o=yt("itemContent"),u=yt("computeItemKey"),m=yt("isSeeking"),f=_n("scrollHeight"),h=yt("ItemComponent"),x=yt("ListComponent"),p=yt("ScrollSeekPlaceholder"),b=yt("context"),g=_n("itemDimensions"),j=_n("gap"),S=yt("log"),C=yt("stateRestoreInProgress"),z=_n("reportReadyState"),E=gl(ke.useMemo(()=>N=>{const M=N.parentElement.parentElement.scrollHeight;f(M);const _=N.firstChild;if(_!==null){const{height:I,width:L}=_.getBoundingClientRect();g({height:I,width:L})}j({column:yx("column-gap",getComputedStyle(N).columnGap,S),row:yx("row-gap",getComputedStyle(N).rowGap,S)})},[f,g,j,S]),!0,!1);return Ev(()=>{a.itemHeight>0&&a.itemWidth>0&&z(!0)},[a]),C?null:n.jsx(x,{className:r,ref:E,...Xt(x,b),"data-testid":"virtuoso-item-list",style:{paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},children:a.items.map(N=>{const M=u(N.index,N.data,b);return m?n.jsx(p,{...Xt(p,b),height:a.itemHeight,index:N.index,width:a.itemWidth},M):v.createElement(h,{...Xt(h,b),className:i,"data-index":N.index,key:M},o(N.index,N.data,b))})})}),M2=ke.memo(function(){const a=yt("HeaderComponent"),r=_n("headerHeight"),i=yt("headerFooterTag"),o=gl(ke.useMemo(()=>m=>{r(Ya(m,"height"))},[r]),!0,!1),u=yt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Xt(a,u)})}):null}),D2=ke.memo(function(){const a=yt("FooterComponent"),r=_n("footerHeight"),i=yt("headerFooterTag"),o=gl(ke.useMemo(()=>m=>{r(Ya(m,"height"))},[r]),!0,!1),u=yt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Xt(a,u)})}):null}),z2=({children:a})=>{const r=ke.useContext(Nv),i=_n("itemDimensions"),o=_n("viewportDimensions"),u=gl(ke.useMemo(()=>m=>{o(m.getBoundingClientRect())},[o]),!0,!1);return ke.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:fo(!1),children:a})},L2=({children:a})=>{const r=ke.useContext(Nv),i=_n("windowViewportRect"),o=_n("itemDimensions"),u=yt("customScrollParent"),m=lv(i,u,!1);return ke.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:m,style:fo(!1),children:a})},_2=ke.memo(function({...a}){const r=yt("useWindowScroll"),i=yt("customScrollParent"),o=i||r?B2:O2,u=i||r?L2:z2,m=yt("context");return n.jsx(o,{...a,...Xt(o,m),children:n.jsxs(u,{children:[n.jsx(M2,{}),n.jsx(A2,{}),n.jsx(D2,{})]})})}),{useEmitter:zv,useEmitterValue:yt,usePublisher:_n}=wv(R2,{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"}},_2),O2=Av({useEmitter:zv,useEmitterValue:yt,usePublisher:_n}),B2=Mv({useEmitter:zv,useEmitterValue:yt,usePublisher:_n});function yx(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 H2={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},Lv={source:"Own",installed:"Installed"};function U2(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 I2(a,r){const i=r?"true":"false";try{localStorage.setItem(a,i)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(a,i)}catch{}}function gx({origin:a,count:r,filteredCount:i,updateCount:o,children:u}){const m=H2[a],[f,h]=v.useState(()=>U2(m)),x=v.useCallback(()=>{h(j=>{const S=!j;return I2(m,S),S})},[m]),p=Lv[a],b=`sidebar-section-${a}-header`,g=`sidebar-section-${a}-group`;return n.jsxs("section",{"aria-labelledby":b,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:b,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($2,{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:p}),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(V2,{origin:a,updateCount:o})]}),!f&&n.jsx("div",{id:g,role:"group","aria-labelledby":b,style:{display:"flex",flexDirection:"column",minHeight:0},children:u})]})}function V2({origin:a,updateCount:r}){const[i,o]=v.useState(!1),u=Lv[a].toLowerCase(),m=`${r} updates available in ${u} section, view all`;return n.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":m,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 $2({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"})})}const _v={own:"Own",installed:"Installed",global:"Global"},G2={own:"var(--color-own)",installed:"var(--color-accent)",global:"var(--color-global, #8B8FB1)"},q2={fresh:"var(--color-ok, #22c55e)",updates:"var(--color-own, #f59e0b)",empty:"var(--text-tertiary, #9ca3af)"};function Y2(a,r){return`vskill-sidebar-${a}-${r}-collapsed`}function K2(a){try{const r=localStorage.getItem(a);if(r!=null)return r==="true"}catch{}return!1}function F2(a,r){try{localStorage.setItem(a,r?"true":"false")}catch{}}function W2(a,r){return a===0?"empty":r>0?"updates":"fresh"}function Gu({scope:a,agentId:r,count:i,filteredCount:o,updateCount:u=0,children:m}){const f=Y2(r,a),[h,x]=v.useState(()=>K2(f)),p=v.useCallback(()=>{x(z=>{const E=!z;return F2(f,E),E})},[f]),b=_v[a],g=G2[a],j=W2(i,u),S=`scope-section-${r}-${a}-header`,C=`scope-section-${r}-${a}-group`;return n.jsxs("section",{"aria-labelledby":S,"data-testid":`scope-section-${a}`,"data-scope":a,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:S,type:"button","data-testid":"scope-section-header","aria-expanded":!h,"aria-controls":C,onClick:p,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"12px 14px 4px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx(X2,{collapsed:h}),n.jsx("span",{"data-testid":"scope-status-dot","data-status":j,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:q2[j],flexShrink:0}}),n.jsx("h2",{"data-testid":"scope-section-kicker","aria-level":2,style:{fontFamily:"'Source Serif 4 Variable', 'Source Serif 4', serif",fontSize:"14px",fontWeight:600,letterSpacing:"0.12em",textTransform:"uppercase",fontFeatureSettings:'"smcp" 0',color:g,margin:0},children:b}),n.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:o!=null&&o!==i?`(${o} of ${i})`:`(${i})`}),u>0&&n.jsx(P2,{updateCount:u,scope:a})]}),!h&&n.jsx("div",{id:C,role:"group","aria-labelledby":S,style:{display:"flex",flexDirection:"column",minHeight:0},children:m})]})}function P2({updateCount:a,scope:r}){return n.jsxs("span",{role:"link",tabIndex:0,"data-testid":"scope-section-update-chip","data-scope":r,"aria-label":`${a} updates available in ${_v[r].toLowerCase()} section`,onClick:i=>{i.stopPropagation(),window.location.hash="#/updates"},onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),i.stopPropagation(),window.location.hash="#/updates")},style:{fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3},children:[a," updates ▾"]})}function X2({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 Ov(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 Q2({value:a,onChange:r,placeholder:i="Filter skills…",validationPattern:o,validationMessage:u="Invalid filter expression"}){const m=v.useRef(null),f=v.useId(),h=!!o&&a.trim()!==""&&!o.test(a);return v.useEffect(()=>{function x(p){var j;if(p.key!=="/")return;const b=p.target;if(!b)return;const g=b.tagName;g==="INPUT"||g==="TEXTAREA"||b.isContentEditable||(p.preventDefault(),(j=m.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:m,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 Z2({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 J2({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 ej({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?m=>{m.preventDefault(),o(m,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(Z2,{target:a.symlinkTarget??null}),n.jsx(J2,{skill:a})]})}const Bv=v.memo(ej);function tj({plugin:a,skills:r,selectedKey:i,onSelect:o,onContextMenu:u}){const m=[...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:m.map(f=>{const h=!!i&&i.plugin===f.plugin&&i.skill===f.skill;return n.jsx("div",{role:"listitem",children:n.jsx(Bv,{skill:f,isSelected:h,onSelect:()=>o(f),onContextMenu:u})},`${f.plugin}/${f.skill}`)})})]})}function nj(){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 aj(a){const r=a.key.split("+").map(h=>h.trim()).filter(Boolean);let i=!!a.meta,o=!!a.ctrl,u=!!a.shift,m=!!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")&&(m=!0)}f=r[r.length-1]}return{key:f.length===1?f.toLowerCase():f,meta:i,ctrl:o,shift:u,alt:m,allowInInputs:!!a.allowInInputs,handler:a.handler}}function lj(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 rj(a,r){const i=!!a.metaKey,o=!!a.ctrlKey,u=!!a.shiftKey,m=!!a.altKey;return i!==r.meta||o!==r.ctrl||u!==r.shift||m!==r.alt?!1:(a.key.length===1?a.key.toLowerCase():a.key)===r.key}function Hv(a,r={}){const{enabled:i=!0,target:o}=r,u=v.useRef([]),m=Array.isArray(a)?a:[a];u.current=m.map(aj),v.useEffect(()=>{if(!i)return;const f=o??(typeof window<"u"?window:void 0);if(!f)return;function h(x){const p=x,b=lj(p.target);for(const g of u.current){if(!rj(p,g))continue;const j=g.meta||g.ctrl||g.alt;if(!(b&&!g.allowInInputs&&!j)){g.handler(p);return}}}return f.addEventListener("keydown",h),()=>{f.removeEventListener("keydown",h)}},[i,o])}const sj=200;function ij(a){return a.scope==="own"||a.scope==="installed"||a.scope==="global"?a.scope:a.origin==="installed"?"installed":"own"}function oj(a,r){const i=[],o=[],u=[];for(const f of a){const h=ij(f);h==="global"?u.push(f):h==="installed"?o.push(f):i.push(f)}function m(f){var b;const h=f.filter(g=>Ov(g,r)),x={};for(const g of h)(x[b=g.plugin]||(x[b]=[])).push(g);const p=Object.entries(x).sort((g,j)=>g[0].localeCompare(j[0]));return{total:f.length,filtered:h.length,byPlugin:p}}return{own:m(i),installed:m(o),global:m(u)}}function cj(a,r){const i=[],o=[];for(const m of a)(m.origin==="installed"?o:i).push(m);function u(m){var p;const f=m.filter(b=>Ov(b,r)),h={};for(const b of f)(h[p=b.plugin]||(h[p]=[])).push(b);const x=Object.entries(h).sort((b,g)=>b[0].localeCompare(g[0]));return{total:m.length,filtered:f.length,byPlugin:x}}return{own:u(i),installed:u(o)}}function uj({skills:a,selectedKey:r,onSelect:i,isLoading:o,error:u,onRetry:m,onContextMenu:f,outdatedByOrigin:h,activeAgentId:x,outdatedByScope:p,topSlot:b}){const g=!!x||a.some(D=>D.scope!==void 0&&D.scope!==null),j=x??"claude-cli",[S,C]=v.useState(""),z=v.useDeferredValue(S),E=v.useMemo(()=>oj(a,z),[a,z]),{own:N,installed:M}=v.useMemo(()=>cj(a,z),[a,z]),I=E.own.filtered+E.installed.filtered+E.global.filtered>=sj,L=v.useMemo(()=>{const D=R=>{const U=[];for(const[,q]of R){const F=[...q].sort((te,Q)=>te.skill.localeCompare(Q.skill));U.push(...F)}return U};return g?[...D(E.own.byPlugin),...D(E.installed.byPlugin),...D(E.global.byPlugin)]:[...D(N.byPlugin),...D(M.byPlugin)]},[g,E.own.byPlugin,E.installed.byPlugin,E.global.byPlugin,N.byPlugin,M.byPlugin]),$=v.useMemo(()=>r?L.findIndex(D=>D.plugin===r.plugin&&D.skill===r.skill):-1,[L,r]),w=v.useCallback(D=>{if(L.length===0)return;const R=$<0?D>0?0:L.length-1:Math.min(Math.max($+D,0),L.length-1);i(L[R])},[L,$,i]);return Hv([{key:"j",handler:()=>w(1)},{key:"k",handler:()=>w(-1)},{key:"Enter",handler:()=>{$>=0&&i(L[$])}}],{enabled:!o&&!u}),n.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[b,n.jsx(Q2,{value:S,onChange:C}),o&&n.jsx(mj,{}),!o&&u&&n.jsx(hj,{error:u,onRetry:m}),!o&&!u&&g&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Gu,{scope:"own",agentId:j,count:E.own.total,filteredCount:S?E.own.filtered:null,updateCount:(p==null?void 0:p.own)??(h==null?void 0:h.source),children:E.own.filtered===0?n.jsx(bx,{queryActive:!!S}):n.jsx(fs,{items:E.own.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:I})}),n.jsx(Sx,{}),n.jsx(Gu,{scope:"installed",agentId:j,count:E.installed.total,filteredCount:S?E.installed.filtered:null,updateCount:(p==null?void 0:p.installed)??(h==null?void 0:h.installed),children:E.installed.filtered===0?n.jsx(jx,{queryActive:!!S,agentId:j}):n.jsx(fs,{items:E.installed.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:I})}),n.jsx(Sx,{}),n.jsx(Gu,{scope:"global",agentId:j,count:E.global.total,filteredCount:S?E.global.filtered:null,updateCount:p==null?void 0:p.global,children:E.global.filtered===0?n.jsx(fj,{queryActive:!!S,agentId:j}):n.jsx(fs,{items:E.global.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:I})})]}),!o&&!u&&!g&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(gx,{origin:"source",count:N.total,filteredCount:S?N.filtered:null,updateCount:h==null?void 0:h.source,children:N.filtered===0?n.jsx(bx,{queryActive:!!S}):n.jsx(fs,{items:N.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:I})}),n.jsx(pj,{}),n.jsx(gx,{origin:"installed",count:M.total,filteredCount:S?M.filtered:null,updateCount:h==null?void 0:h.installed,children:M.filtered===0?n.jsx(jx,{queryActive:!!S}):n.jsx(fs,{items:M.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:I})})]})]})}function dj(a){const r=[];for(const[i,o]of a){const u=[...o].sort((m,f)=>m.skill.localeCompare(f.skill));r.push({kind:"header",plugin:i,count:u.length});for(const m of u)r.push({kind:"row",skill:m})}return r}function fs({items:a,selectedKey:r,onSelect:i,onContextMenu:o,useVirtual:u}){if(u){const m=dj(a);return n.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:n.jsx(S2,{overscan:4,totalCount:m.length,itemContent:f=>{const h=m[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,p=!!r&&r.plugin===x.plugin&&r.skill===x.skill;return n.jsx(Bv,{skill:x,isSelected:p,onSelect:()=>i(x),onContextMenu:o})}})})}return n.jsx("div",{"data-virtualized":"false",children:a.map(([m,f])=>n.jsx(tj,{plugin:m,skills:f,selectedKey:r,onSelect:i,onContextMenu:o},m))})}function bx({queryActive:a}){return a?n.jsx(fr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(fr,{headline:"No skills yet.",body:n.jsxs(n.Fragment,{children:["Create one with ",n.jsx(Td,{children:"vskill new"})," or the"," ",n.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function jx({queryActive:a,agentId:r}){return a?n.jsx(fr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(fr,{headline:r?`No skills installed for ${r} in this project.`:"No installed skills.",body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(Td,{children:"vskill install <plugin>"})," to add one."]})})}function fj({queryActive:a,agentId:r}){return a?n.jsx(fr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(fr,{headline:`No global skills for ${r}.`,body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(Td,{children:"vskill install --global <plugin>"})," to add one."]})})}function fr({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 Td({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 pj(){return n.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function Sx(){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 mj(){return n.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(a=>n.jsx(nj,{},a))})}function hj({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:xj(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 xj(a){const r=a.split(`
|
|
54
|
+
`)[0]??a;return r.length>80?r.slice(0,77)+"…":r}const Uv=240,Iv=480,Vv="vskill-sidebar-width",ys=320;function Rd(a){return Number.isFinite(a)?Math.round(Math.max(Uv,Math.min(Iv,a))):ys}function vj(){try{const a=localStorage.getItem(Vv);if(!a)return ys;const r=Number(a);return Number.isFinite(r)?Rd(r):ys}catch{return ys}}function yj(a){try{localStorage.setItem(Vv,String(Rd(a)))}catch{}}function gj({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=Rd(i.current.startWidth+h);o.current=x,r(x)}function m(f){i.current.pointerId==null||f.pointerId!==i.current.pointerId||(i.current.pointerId=null,yj(o.current))}return window.addEventListener("pointermove",u),window.addEventListener("pointerup",m),window.addEventListener("pointercancel",m),()=>{window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m)}},[r]),n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":Uv,"aria-valuemax":Iv,"aria-valuenow":a,"aria-label":"Resize sidebar",title:"Drag to resize sidebar",onPointerDown:u=>{const m=u.currentTarget;i.current.startX=u.clientX,i.current.startWidth=o.current,i.current.pointerId=u.pointerId;try{m.setPointerCapture(u.pointerId)}catch{}},style:{width:4,alignSelf:"stretch",cursor:"col-resize",background:"var(--border-default)",userSelect:"none",touchAction:"none"}})}function bj({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 $v(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 qu(){const[a,r]=v.useState([]),[i,o]=v.useState(!1),[u,m]=v.useState(!1),[f,h]=v.useState(null),x=v.useRef(null),p=v.useCallback(async(g,j)=>{r([]),o(!0),m(!1),h(null);const S=new AbortController;x.current=S;try{const C=$v(j),z=await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:C,signal:S.signal});if(!z.ok||!z.body){let I=`HTTP ${z.status}`;try{const L=await z.json();L.error&&(I=L.error)}catch{}throw new Error(I)}const E=z.body.getReader(),N=new TextDecoder;let M="",_="";for(;;){const{done:I,value:L}=await E.read();if(I)break;M+=N.decode(L,{stream:!0});const $=M.split(`
|
|
55
|
+
`);M=$.pop()||"";for(const w of $)if(w.startsWith("event: "))_=w.slice(7).trim();else if(w.startsWith("data: ")){try{const D=JSON.parse(w.slice(6)),R={event:_,data:D};_==="done"?(m(!0),r(U=>[...U,R])):r(U=>[...U,R])}catch{}_=""}}}catch(C){C.name!=="AbortError"&&h(C.message)}finally{o(!1),x.current=null}},[]),b=v.useCallback(()=>{var g;(g=x.current)==null||g.abort()},[]);return{events:a,running:i,done:u,error:f,start:p,stop:b}}function jj(a){const r=v.useRef(a);r.current=a;const[i,o]=v.useState(new Set),u=v.useRef(new Map),m=v.useCallback(async(p,b,g)=>{var S;(S=u.current.get(p))==null||S.abort();const j=new AbortController;u.current.set(p,j),o(C=>{const z=new Set(C);return z.add(p),z});try{const C=$v(g),z=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:C,signal:j.signal});if(!z.ok||!z.body){let I=`HTTP ${z.status}`;try{const L=await z.json();L.error&&(I=L.error)}catch{}throw new Error(I)}const E=z.body.getReader(),N=new TextDecoder;let M="",_="";for(;;){const{done:I,value:L}=await E.read();if(I)break;M+=N.decode(L,{stream:!0});const $=M.split(`
|
|
56
|
+
`);M=$.pop()||"";for(const w of $)if(w.startsWith("event: "))_=w.slice(7).trim();else if(w.startsWith("data: ")){try{const D=JSON.parse(w.slice(6)),R={event:_,data:D};r.current.onEvent(p,R)}catch{}_=""}}r.current.onDone(p)}catch(C){C.name!=="AbortError"&&r.current.onError(p,C.message)}finally{o(C=>{const z=new Set(C);return z.delete(p),z}),u.current.delete(p)}},[]),f=v.useCallback(p=>{var b;(b=u.current.get(p))==null||b.abort()},[]),h=v.useCallback(()=>{for(const p of u.current.values())p.abort()},[]),x=i.size>0;return{runningSet:i,startCase:m,stopCase:f,stopAll:h,isAnyCaseRunning:x}}const Sj={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 kj(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 m=((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:m,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),m=u.get(r.caseId);u.set(r.caseId,{status:"complete",mode:m==null?void 0:m.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),m=u.get(r.caseId);u.set(r.caseId,{status:"error",mode:m==null?void 0:m.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),m=u.get(r.caseId);return u.set(r.caseId,{status:"cancelled",mode:m==null?void 0:m.mode}),{...a,caseRunStates:u}}case"BULK_RUN_START":{const u=new Map(a.caseRunStates);for(const m of r.caseIds)u.set(m,{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[m,f]of u)(f.status==="running"||f.status==="queued")&&u.set(m,{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??[],m=new Map;for(let f=0;f<u.length;f++)m.set(f,!0);return{...a,aiEditLoading:!1,aiEditResult:{improved:r.improved,reasoning:r.reasoning,evalChanges:u},aiEditEvalChanges:u,aiEditEvalSelections:m}}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 m of u.keys())u.set(m,!0);return{...a,aiEditEvalSelections:u}}case"DESELECT_ALL_EVAL_CHANGES":{const u=new Map(a.aiEditEvalSelections);for(const m of u.keys())u.set(m,!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 wj(a){if(a==="unit"||a==="integration")return a}function Cj(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 Gv=v.createContext(null);function Sn(){const a=v.useContext(Gv);if(!a)throw new Error("useWorkspace must be used within WorkspaceProvider");return a}function kx({plugin:a,skill:r,origin:i,children:o}){const u=i==="installed",[m,f]=v.useReducer(kj,{...Sj,plugin:a,skill:r}),h=v.useRef(new Set),x=v.useRef(new Set),p=v.useRef(new Map),b=v.useCallback((ne,ue)=>{let ce=p.current.get(ne);ce||(ce={assertions:[]},p.current.set(ne,ce)),Cj(ce,ue),f({type:"UPDATE_INLINE_RESULT",evalId:ne,result:{...ce,assertions:[...ce.assertions]}})},[]),g=v.useCallback(ne=>{if(x.current.has(ne))return;x.current.add(ne);const ue=p.current.get(ne)??{assertions:[]};f({type:"CASE_RUN_COMPLETE",caseId:ne,result:{...ue,assertions:[...ue.assertions]}}),h.current.has(ne)&&(h.current.delete(ne),h.current.size===0&&Ne.getLatestBenchmark(a,r).then(ce=>f({type:"BULK_RUN_COMPLETE",benchmark:ce})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null})))},[a,r]),j=v.useCallback((ne,ue)=>{x.current.has(ne)||(x.current.add(ne),f({type:"CASE_RUN_ERROR",caseId:ne,error:ue}),h.current.has(ne)&&(h.current.delete(ne),h.current.size===0&&Ne.getLatestBenchmark(a,r).then(ce=>f({type:"BULK_RUN_COMPLETE",benchmark:ce})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[a,r]),{startCase:S,stopCase:C,stopAll:z}=jj({onEvent:b,onDone:g,onError:j});v.useEffect(()=>()=>{z()},[z]);const E=v.useCallback(async()=>{try{const ne=await fetch(`/api/skills/${a}/${r}/activation-history`);if(!ne.ok){if(ne.status===404){f({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const ue=await ne.json();f({type:"ACTIVATION_HISTORY_LOADED",runs:ue.runs||[]})}catch{}},[a,r]);v.useEffect(()=>{let ne=!1;async function ue(){try{const[ce,me,ye]=await Promise.allSettled([Ne.getSkillDetail(a,r),Ne.getEvals(a,r),Ne.getLatestBenchmark(a,r)]);if(ne)return;let _e=null,Me=null;if(me.status==="fulfilled")_e=me.value;else{const dt=me.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:ce.status==="fulfilled"?ce.value.skillContent:"",evals:_e,evalsError:Me,benchmark:ye.status==="fulfilled"?ye.value:null})}catch(ce){ne||f({type:"SET_ERROR",error:ce.message})}}return ue(),E(),()=>{ne=!0}},[a,r,E]);const N=v.useCallback(async()=>{if(!u)try{await Ne.applyImprovement(a,r,m.skillContent),f({type:"CONTENT_SAVED"})}catch(ne){f({type:"SET_ERROR",error:ne.message})}},[u,a,r,m.skillContent]),M=v.useCallback(async ne=>{if(!u)try{const ue=await Ne.saveEvals(a,r,ne);f({type:"SET_EVALS",evals:ue})}catch(ue){f({type:"SET_ERROR",error:ue.message})}},[u,a,r]),_=v.useCallback((ne,ue="benchmark")=>{if(u)return;const ce=m.caseRunStates.get(ne);if((ce==null?void 0:ce.status)!=="running")if(p.current.delete(ne),x.current.delete(ne),f({type:"CASE_RUN_START",caseId:ne,mode:ue}),ue==="comparison"){const me=`/api/skills/${a}/${r}/compare`;S(ne,me,{eval_ids:[ne]})}else{const me=`/api/skills/${a}/${r}/benchmark/case/${ne}`;S(ne,me,ue==="baseline"?{baseline_only:!0}:void 0)}},[u,a,r,m.caseRunStates,S]),I=v.useCallback((ne="benchmark")=>{var me;if(u)return;const ue=((me=m.evals)==null?void 0:me.evals)??[];if(ue.length===0)return;const ce=ue.map(ye=>ye.id);for(const ye of ce)p.current.delete(ye),x.current.delete(ye);f({type:"BULK_RUN_START",caseIds:ce,mode:ne}),h.current=new Set(ce);for(const ye of ce)if(ne==="comparison")S(ye,`/api/skills/${a}/${r}/compare`,{eval_ids:[ye]});else{const _e=`/api/skills/${a}/${r}/benchmark/case/${ye}`;S(ye,_e,ne==="baseline"?{baseline_only:!0}:void 0)}},[u,a,r,m.evals,S]),L=v.useCallback(ne=>{C(ne),f({type:"CASE_RUN_CANCEL",caseId:ne}),h.current.delete(ne),x.current.add(ne)},[C]),$=v.useCallback(()=>{z(),f({type:"CANCEL_ALL"}),h.current.clear()},[z]),w=v.useCallback(async(ne,ue)=>{f({type:"OPEN_IMPROVE",evalId:ne})},[]),D=v.useCallback(async(ne,ue)=>{try{await Ne.applyImprovement(a,r,ue),f({type:"SET_CONTENT",content:ue}),f({type:"CONTENT_SAVED"}),f({type:"CLOSE_IMPROVE"}),_(ne,"benchmark")}catch(ce){f({type:"SET_ERROR",error:ce.message})}},[a,r,_]),R=qu(),U=v.useRef(null),q=v.useRef(0);v.useEffect(()=>{const ne=R.events;for(let ue=q.current;ue<ne.length;ue++){const ce=ne[ue],me=ce.data;if(ce.event==="progress"&&f({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:me.phase,message:me.message}}),ce.event==="done"){const ye=me.improved,_e=me.reasoning,Me=me.evalChanges??[];f({type:"AI_EDIT_RESULT",improved:ye,reasoning:_e,evalChanges:Me})}if(ce.event==="error"){const ye=me;f({type:"AI_EDIT_ERROR",message:ye.description||"Unknown error",classified:ye})}}q.current=ne.length},[R.events]),v.useEffect(()=>{R.error&&f({type:"AI_EDIT_ERROR",message:R.error})},[R.error]),v.useEffect(()=>()=>{R.stop()},[R.stop]);const F=v.useCallback(async(ne,ue,ce)=>{u||(q.current=0,f({type:"AI_EDIT_LOADING"}),U.current=R.stop,R.start(`/api/skills/${a}/${r}/improve?sse`,{mode:"instruct",instruction:ne,content:m.skillContent,evals:m.evals??{skill_name:r,evals:[]},provider:ue,model:ce}))},[u,a,r,m.skillContent,m.evals,R]),te=v.useCallback(()=>{R.stop(),f({type:"AI_EDIT_ERROR",message:"Cancelled"})},[R]),Q=v.useCallback(async()=>{const ne=m.aiEditResult;if(ne!=null&&ne.improved)try{if(await Ne.applyImprovement(a,r,ne.improved),f({type:"SET_CONTENT",content:ne.improved}),f({type:"CONTENT_SAVED"}),m.aiEditEvalChanges.length>0&&Array.from(m.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:ce}=await hd(async()=>{const{mergeEvalChanges:_e}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:_e}},[]),me=m.evals??{skill_name:r,evals:[]},ye=ce(me,m.aiEditEvalChanges,m.aiEditEvalSelections);try{const _e=await Ne.saveEvals(a,r,ye);f({type:"SET_EVALS",evals:_e})}catch(_e){f({type:"SET_EVALS_RETRY",evalsFile:ye}),f({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${_e.message}. You can retry from the AI Edit panel.`});return}}f({type:"CLOSE_AI_EDIT"})}catch(ue){f({type:"SET_ERROR",error:ue.message})}},[a,r,m.aiEditResult,m.evals,m.aiEditEvalChanges,m.aiEditEvalSelections]),O=v.useCallback(()=>{f({type:"CLOSE_AI_EDIT"})},[]),A=v.useCallback(ne=>{f({type:"TOGGLE_EVAL_CHANGE",index:ne})},[]),B=v.useCallback(()=>{f({type:"SELECT_ALL_EVAL_CHANGES"})},[]),se=v.useCallback(()=>{f({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),K=v.useCallback(async()=>{const ne=m.aiEditEvalsRetry;if(ne)try{const ue=await Ne.saveEvals(a,r,ne);f({type:"SET_EVALS",evals:ue}),f({type:"SET_ERROR",error:null}),f({type:"CLOSE_AI_EDIT"})}catch(ue){f({type:"SET_ERROR",error:`Retry failed: ${ue.message}`})}},[a,r,m.aiEditEvalsRetry]),pe=v.useCallback(async()=>{try{const ne=await Ne.getSkillDetail(a,r);f({type:"SET_CONTENT",content:ne.skillContent}),f({type:"CONTENT_SAVED"})}catch{}},[a,r]),{config:T}=yl(),Y=qu(),ae=v.useRef(0);v.useEffect(()=>{const ne=Y.events;for(let ue=ae.current;ue<ne.length;ue++){const ce=ne[ue],me=ce.data;if(ce.event==="progress"&&f({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:me.phase,message:me.message}}),ce.event==="done"){const ye=me;Ne.saveEvals(a,r,ye).then(_e=>f({type:"GENERATE_EVALS_DONE",evals:_e})).catch(_e=>f({type:"SET_ERROR",error:_e.message}))}ce.event==="error"&&f({type:"GENERATE_EVALS_ERROR",classified:me})}ae.current=ne.length},[Y.events,a,r]),v.useEffect(()=>{Y.error&&f({type:"SET_ERROR",error:Y.error})},[Y.error]),v.useEffect(()=>()=>{Y.stop()},[Y.stop]);const fe=v.useCallback(async ne=>{if(u)return;ae.current=0,f({type:"GENERATE_EVALS_START"});const ue={};T!=null&&T.provider&&(ue.provider=T.provider),T!=null&&T.model&&(ue.model=T.model);const ce=wj(ne==null?void 0:ne.testType);ce&&(ue.testType=ce),Y.start(`/api/skills/${a}/${r}/generate-evals?sse`,Object.keys(ue).length>0?ue:void 0)},[u,a,r,Y,T]),ve=qu(),he=v.useRef(0);v.useEffect(()=>()=>{ve.stop()},[ve.stop]),v.useEffect(()=>{const ne=ve.events;for(let ue=he.current;ue<ne.length;ue++){const ce=ne[ue];if(ce.event==="classifying"){const me=ce.data;f({type:"ACTIVATION_CLASSIFYING",index:me.index,total:me.total})}if(ce.event==="prompt_result"&&f({type:"ACTIVATION_RESULT",result:ce.data}),ce.event==="done"){Ce.current&&(clearTimeout(Ce.current),Ce.current=null);const me=ce.data;if(me.error)f({type:"ACTIVATION_ERROR",error:me.error});else{f({type:"ACTIVATION_DONE",summary:me});const ye={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(T==null?void 0:T.model)||"unknown",provider:(T==null?void 0:T.provider)||"unknown",promptCount:me.total,summary:{precision:me.precision,recall:me.recall,reliability:me.reliability,tp:me.tp,tn:me.tn,fp:me.fp,fn:me.fn}};f({type:"ACTIVATION_HISTORY_LOADED",runs:[ye,...m.activationHistory??[]]})}}}he.current=ne.length},[ve.events,T,m.activationHistory]),v.useEffect(()=>{ve.error&&(Ce.current&&(clearTimeout(Ce.current),Ce.current=null),f({type:"ACTIVATION_ERROR",error:ve.error}))},[ve.error]);const Ce=v.useRef(null),oe=v.useCallback(()=>{Ce.current&&(clearTimeout(Ce.current),Ce.current=null),ve.stop(),f({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ve]),je=v.useCallback(ne=>{const ce=ne.trim().split(`
|
|
57
|
+
`).filter(Boolean).map(ye=>ye.startsWith("!")?{prompt:ye.slice(1).trim(),expected:"should_not_activate"}:ye.startsWith("+")?{prompt:ye.slice(1).trim(),expected:"should_activate"}:{prompt:ye.trim(),expected:"auto"});he.current=0,f({type:"ACTIVATION_START"}),f({type:"SET_ACTIVATION_PROMPTS",prompts:ne});const me={prompts:ce};T!=null&&T.provider&&(me.provider=T.provider),T!=null&&T.model&&(me.model=T.model),ve.start(`/api/skills/${a}/${r}/activation-test`,me),Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(()=>{ve.stop(),f({type:"ACTIVATION_TIMEOUT"}),Ce.current=null},12e4)},[a,r,ve,T]),$e=v.useCallback(async(ne=8)=>{f({type:"GENERATE_PROMPTS_START"});try{const ue={count:ne};T!=null&&T.provider&&(ue.provider=T.provider),T!=null&&T.model&&(ue.model=T.model);const ce=await fetch(`/api/skills/${a}/${r}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ue)});if(!ce.ok){let ct=`HTTP ${ce.status}`;try{const Vt=await ce.json();Vt.error&&(ct=Vt.error)}catch{}throw new Error(ct)}const me=ce.body.getReader(),ye=new TextDecoder;let _e="",Me="",dt=[];for(;;){const{done:ct,value:Vt}=await me.read();if(ct)break;_e+=ye.decode(Vt,{stream:!0});const $t=_e.split(`
|
|
58
|
+
`);_e=$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(`
|
|
59
|
+
`);f({type:"SET_ACTIVATION_PROMPTS",prompts:Zt}),f({type:"GENERATE_PROMPTS_DONE"})}catch(ue){f({type:"GENERATE_PROMPTS_ERROR",error:ue.message})}},[a,r,T]),Be=v.useMemo(()=>({state:m,dispatch:f,isReadOnly:u,saveContent:N,saveEvals:M,runCase:_,runAll:I,cancelCase:L,cancelAll:$,improveForCase:w,applyImproveAndRerun:D,refreshSkillContent:pe,generateEvals:fe,runActivationTest:je,cancelActivation:oe,generateActivationPrompts:$e,fetchActivationHistory:E,submitAiEdit:F,cancelAiEdit:te,applyAiEdit:Q,discardAiEdit:O,toggleEvalChange:A,selectAllEvalChanges:B,deselectAllEvalChanges:se,retryEvalsSave:K}),[m,u,N,M,_,I,L,$,w,D,pe,fe,je,oe,$e,E,F,te,Q,O,A,B,se,K]);return n.jsx(Gv.Provider,{value:Be,children:o})}const Ji=new Map,hl=new Map,ps=new Map;function Rs(a){Ji.delete(a),hl.delete(a);const r=ps.get(a);if(r)for(const i of r)i()}function po(a,r,i={}){const{ttl:o=3e4,enabled:u=!0}=i,[,m]=v.useState(0),f=v.useRef(!0),h=v.useRef(a);h.current=a;const x=()=>Rs(a);v.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),v.useEffect(()=>{if(!u)return;const j=()=>{f.current&&m(S=>S+1)};return ps.has(a)||ps.set(a,new Set),ps.get(a).add(j),()=>{var S;(S=ps.get(a))==null||S.delete(j)}},[a,u]),v.useEffect(()=>{if(!u)return;const j=Ji.get(a);if(!(!j||Date.now()-j.fetchedAt>o))return;if(hl.has(a)){const E=hl.get(a),N=()=>{f.current&&h.current===a&&m(M=>M+1)};E.subscribers.push(N);return}const C={promise:Promise.resolve(),subscribers:[]},z=r().then(E=>{Ji.set(a,{data:E,fetchedAt:Date.now()}),hl.delete(a),f.current&&h.current===a&&m(N=>N+1);for(const N of C.subscribers)N()},E=>{hl.delete(a),f.current&&h.current===a&&m(N=>N+1);for(const N of C.subscribers)N();throw E});C.promise=z,hl.set(a,C)},[a,r,o,u]);const p=Ji.get(a),b=u&&!p&&hl.has(a);return{data:p==null?void 0:p.data,loading:b||u&&!p,error:void 0,revalidate:x}}function Nj(a){if(!a)return[];const r=a.split(`
|
|
60
|
+
`),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 Ad({contentDiff:a,fromLabel:r,toLabel:i,diffSummary:o,maxHeight:u=480,collapsible:m=!1,renderContext:f="inline",onRetry:h}){const[x,p]=v.useState(m),[b,g]=v.useState("unified"),j=v.useRef(null),S=v.useRef(null),C=v.useMemo(()=>Nj(a),[a]),z=v.useMemo(()=>{const L=C.filter(w=>w.type==="add").length,$=C.filter(w=>w.type==="remove").length;return{added:L,removed:$}},[C]),E=v.useMemo(()=>{let L=0,$=0;return C.filter(w=>w.type!=="header").map(w=>w.type==="remove"?(L++,{...w,origNum:L,newNum:null}):w.type==="add"?($++,{...w,origNum:null,newNum:$}):(L++,$++,{...w,origNum:L,newNum:$}))},[C]),N=v.useMemo(()=>{const L=[],$=[];for(const w of E)if(w.type==="remove")L.push(w);else if(w.type==="add")$.push(w);else{for(;L.length<$.length;)L.push({type:"context",content:"",origNum:null,newNum:null});for(;$.length<L.length;)$.push({type:"context",content:"",origNum:null,newNum:null});L.push(w),$.push(w)}for(;L.length<$.length;)L.push({type:"context",content:"",origNum:null,newNum:null});for(;$.length<L.length;)$.push({type:"context",content:"",origNum:null,newNum:null});return{left:L,right:$}},[E]),M=v.useCallback(L=>{const $=L==="left"?j.current:S.current,w=L==="left"?S.current:j.current;$&&w&&(w.scrollTop=$.scrollTop)},[]);if(!a||C.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 _=f==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",I=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(b==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:b==="unified"?"Side-by-side":"Unified"}),m&&n.jsx("button",{onClick:()=>p(!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&&(b==="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:E.map((L,$)=>n.jsxs("tr",{style:{background:L.type==="add"?"rgba(34,197,94,0.08)":L.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:L.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:L.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:L.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:L.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:L.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:L.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:L.type==="add"?"var(--green)":L.type==="remove"?"var(--red)":"transparent",borderRight:L.type==="add"?"2px solid var(--green)":L.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:L.type==="add"?"+":L.type==="remove"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="add"?"var(--green)":L.type==="remove"?"var(--red)":"var(--text-secondary)"},children:L.content||""})]},$))})})}):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:N.left.map((L,$)=>n.jsxs("tr",{style:{background:L.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:L.origNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="remove"?"var(--red)":"var(--text-secondary)"},children:L.content||""})]},$))})})}),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:N.right.map((L,$)=>n.jsxs("tr",{style:{background:L.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:L.newNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="add"?"var(--green)":"var(--text-secondary)"},children:L.content||""})]},$))})})})]}))]});return f==="modal"?n.jsx("div",{className:_,children:n.jsx("div",{style:{width:"80%",maxWidth:900},children:I})}):I}const wx={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 Ej(a,r){return a?a.length>r?a.slice(0,r)+"…":a:""}function qv(){const{state:a}=Sn(),{plugin:r,skill:i}=a,{refreshSkills:o,updateCount:u}=ya(),m=`versions/${r}/${i}`,f=v.useCallback(()=>Ne.getSkillVersions(r,i),[r,i]),{data:h,loading:x}=po(m,f),[p,b]=v.useState(null),[g,j]=v.useState(null),[S,C]=v.useState(null),[z,E]=v.useState(!1),[N,M]=v.useState("idle"),[_,I]=v.useState(null),L=v.useRef(null),$=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,U=v.useCallback(Q=>{p?!g&&Q!==p?j(Q):(b(Q),j(null),C(null)):(b(Q),C(null))},[p,g]),q=v.useCallback(async(Q,O)=>{E(!0);try{const A=await Ne.getVersionDiff(r,i,Q,O);C(A)}catch{C(null)}finally{E(!1)}},[r,i]);v.useEffect(()=>{if(p&&g){const Q=h||[],O=Q.findIndex(K=>K.version===p),A=Q.findIndex(K=>K.version===g),[B,se]=O>A?[p,g]:[g,p];q(B,se)}},[p,g,h,q]);const F=v.useCallback(()=>{!w||!D||(b(w.version),j(D.version))},[w,D]),te=v.useCallback(()=>{M("updating"),I(null);const Q=Ne.startSkillUpdate(r,i);L.current=Q,Q.addEventListener("progress",O=>{try{switch(JSON.parse(O.data).status){case"scanning":M("scanning");break;case"installing":M("installing");break;case"done":M("done");break}}catch{M("error"),I("Unexpected response from server")}}),Q.addEventListener("done",()=>{Q.close(),L.current=null,o(),Rs(m),M("done")}),Q.addEventListener("error",O=>{const A=O;let B="Connection lost";if(A.data)try{B=JSON.parse(A.data).error||"Update failed"}catch{}M("error"),I(B),Q.close(),L.current=null})},[r,i,m,o]);return v.useEffect(()=>()=>{L.current&&(L.current.close(),L.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:F,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),R&&N!=="done"&&(N==="error"?n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:_||"Update failed"}),n.jsx("button",{onClick:te,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):n.jsx("button",{onClick:te,disabled:N!=="idle",className:"btn btn-primary text-[11px]",children:N==="idle"?`Update to ${D==null?void 0:D.version}`:N==="updating"?"Starting update...":N==="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,")"]})]})]}),p&&!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 ",p]}),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 O=wx[Q.certTier]||wx.COMMUNITY,A=Q.version===p||Q.version===g,B=Q.isInstalled;return n.jsxs("button",{onClick:()=>U(Q.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:A?"var(--accent-muted)":"transparent",border:A?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:se=>{A||(se.currentTarget.style.background="var(--surface-1)")},onMouseLeave:se=>{A||(se.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:O.bg,color:O.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:Ej(Q.diffSummary,80)})]},Q.version)})}),n.jsx("div",{ref:$,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(Ad,{contentDiff:S.contentDiff,fromLabel:S.from,toLabel:S.to,diffSummary:S.diffSummary,renderContext:"inline",onRetry:()=>p&&g&&q(S.from,S.to)})})]})}function Tj(a){return a==null?"var(--text-tertiary)":a>=.7?"var(--green)":a>=.4?"var(--yellow)":"var(--red)"}function Rj(a){return a==null?"var(--surface-3)":a>=.7?"var(--green-muted)":a>=.4?"var(--yellow-muted)":"var(--red-muted)"}function Cx(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function Md(a){return a.skill?Mj({skill:a.skill}):zj({state:a.state,isReadOnly:a.isReadOnly,onDelete:a.onDelete})}function Aj(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 Mj({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),Cx(J.toasts.pathCopied,"info")}catch{Cx(J.toasts.permissionDenied,"error")}},[a.dir]),u=a.origin==="installed"?"Installed":"Own",m=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:m}}),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(Dj,{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:Aj(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 Dj({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 zj({state:a,isReadOnly:r,onDelete:i}){const{plugin:o,skill:u,evals:m,latestBenchmark:f,isDirty:h,caseRunStates:x,regressions:p,iterationCount:b}=a,g=Array.from(x.values()).some(N=>N.status==="running"||N.status==="queued"),j=f==null?void 0:f.overall_pass_rate,S=(m==null?void 0:m.evals.reduce((N,M)=>N+M.assertions.length,0))??0,C=(m==null?void 0:m.evals.length)??0,z=Tj(j),E=Rj(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(Lj,{}),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:N=>{g||(N.currentTarget.style.color="var(--red)")},onMouseLeave:N=>{N.currentTarget.style.color="var(--text-tertiary)"},children:n.jsx(_j,{})}),p.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"})]}),p.length," regression",p.length>1?"s":""]}),b>0&&n.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",b]}),n.jsx("span",{className:"pill",style:{background:E,color:z},children:j!=null?`${Math.round(j*100)}%`:"--"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[C," case",C!==1?"s":""," / ",S," assert",S!==1?"s":""]})]})]})}function Lj(){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 _j(){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 Oj=[{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 Bj({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 Hj({activePanel:a,onPanelChange:r,isDirty:i,isRunning:o,hasRegressions:u,isActivationRunning:m,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:Oj.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(p=>{const b=a===p.id,g=p.id==="editor"&&i||p.id==="run"&&o||p.id==="activation"&&m||p.id==="history"&&u||p.id==="versions"&&f,j=p.id==="run"||p.id==="activation"?"var(--accent)":p.id==="history"?"var(--red)":"var(--yellow)";return n.jsxs("button",{onClick:()=>r(p.id),title:`${p.label} (Ctrl+${p.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:b?"var(--text-primary)":"var(--text-tertiary)",borderBottom:b?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:b?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:S=>{b||(S.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:S=>{b||(S.currentTarget.style.color="var(--text-tertiary)")},children:[n.jsx(Bj,{id:p.id}),p.label,g&&n.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:j}})]},p.id)})]},h.label))})}const Nx={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 As({error:a,onRetry:r,onDismiss:i}){const[o,u]=v.useState(null),m=v.useRef(null);v.useEffect(()=>(a.category==="rate_limit"&&a.retryAfterMs?u(Math.ceil(a.retryAfterMs/1e3)):u(null),()=>{m.current&&clearInterval(m.current)}),[a]),v.useEffect(()=>{if(!(o==null||o<=0))return m.current=setInterval(()=>{u(x=>x==null||x<=1?(m.current&&clearInterval(m.current),0):x-1)},1e3),()=>{m.current&&clearInterval(m.current)}},[o!=null&&o>0]);const f=Nx[a.category]||Nx.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 Uj 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 Ij(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 Vj(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={},m=i.split(`
|
|
61
|
+
`);let f="",h=!1;for(const x of m){const p=x.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(p&&f&&h){const j=p[1],S=p[2].trim();let C=u[f];if((typeof C!="object"||Array.isArray(C))&&(C={},u[f]=C),!S)C[j]=[];else{const z=S.match(/^\[(.+)\]$/);z?C[j]=z[1].split(",").map(E=>E.trim().replace(/^["']|["']$/g,"")).filter(Boolean):C[j]=S.replace(/^["']|["']$/g,"")}continue}const b=x.match(/^\s+-\s+(.+)$/);if(b&&f){h=!1;const j=u[f];Array.isArray(j)?j.push(b[1].trim().replace(/^["']|["']$/g,"")):u[f]=[b[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(C=>C.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}u[f]=j.replace(/^["']|["']$/g,"")}}return{metadata:u,body:o}}function mo(a){if(!a)return"";try{let r=a.replace(/^---\n[\s\S]*?\n---\n?/,""),i=$j(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 $j(a){const r=a.split(`
|
|
62
|
+
`),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=Ex(r[o]);o+=2;const m=[];for(;o<r.length&&r[o].trim().startsWith("|");)m.push(Ex(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 p of u)x+=`<th ${f}>${p}</th>`;x+="</tr></thead><tbody>";for(const p of m){x+="<tr>";for(const b of p)x+=`<td ${h}>${b}</td>`;x+="</tr>"}x+="</tbody></table>",i.push(x)}else i.push(r[o]),o++;return i.join(`
|
|
63
|
+
`)}function Ex(a){return a.split("|").map(r=>r.trim()).filter(r=>r.length>0)}function ho(a,r){const i=a.split(`
|
|
64
|
+
`),o=r.split(`
|
|
65
|
+
`);if(i.length>1e3||o.length>1e3)return[...i.map(b=>({type:"unchanged",content:b}))];const u=i.length,m=o.length,f=Array.from({length:u+1},()=>new Array(m+1).fill(0));for(let b=1;b<=u;b++)for(let g=1;g<=m;g++)i[b-1]===o[g-1]?f[b][g]=f[b-1][g-1]+1:f[b][g]=Math.max(f[b-1][g],f[b][g-1]);const h=[];let x=u,p=m;for(;x>0||p>0;)x>0&&p>0&&i[x-1]===o[p-1]?(h.push({type:"unchanged",content:i[x-1]}),x--,p--):p>0&&(x===0||f[x][p-1]>=f[x-1][p])?(h.push({type:"added",content:o[p-1]}),p--):(h.push({type:"removed",content:i[x-1]}),x--);return h.reverse()}function Gj(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 Ms({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:m=>{m.currentTarget.style.color="var(--text-primary)"},onMouseLeave:m=>{m.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((m,f)=>{const h=f===a.length-1&&r,x=f===0?"0s":`+${((m.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:[Gj(m.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:m.message}),m.current!=null&&m.total!=null&&n.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",m.current,"/",m.total,"]"]})]},f)})})]})}function qj({plugin:a,skill:r,skillContent:i,onApplied:o}){const[u,m]=v.useState("closed"),{config:f}=yl(),[h,x]=v.useState("claude-cli"),[p,b]=v.useState("opus"),[g,j]=v.useState([]),[S,C]=v.useState(""),[z,E]=v.useState(""),[N,M]=v.useState(null),[_,I]=v.useState(null),[L,$]=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"),b("opus"))},[f]),v.useEffect(()=>()=>{var A;(A=R.current)==null||A.abort()},[]);function U(){return f==null?void 0:f.providers.find(A=>A.id===h&&A.available)}const q=v.useCallback(()=>{var A;(A=R.current)==null||A.abort(),m("open")},[]);async function F(){m("loading"),M(null),I(null),$([]);const A=new AbortController;R.current=A;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:p}),signal:A.signal});if(!B.ok||!B.body){let Y=`HTTP ${B.status}`;try{const ae=await B.json();ae.error&&(Y=ae.error)}catch{}throw new Error(Y)}const se=B.body.getReader(),K=new TextDecoder;let pe="",T="";for(;;){const{done:Y,value:ae}=await se.read();if(Y)break;pe+=K.decode(ae,{stream:!0});const fe=pe.split(`
|
|
66
|
+
`);pe=fe.pop()||"";for(const ve of fe)if(ve.startsWith("event: "))T=ve.slice(7).trim();else if(ve.startsWith("data: ")){try{const he=JSON.parse(ve.slice(6));T==="progress"?$(Ce=>[...Ce,{phase:he.phase,message:he.message,timestamp:Date.now()}]):T==="done"||T==="complete"?(C(he.improved),E(he.reasoning||""),j(ho(he.original||i,he.improved)),m("diff_shown")):T==="error"&&(M(he.message||he.description||"Unknown error"),he.category&&I(he),m("open"))}catch{}T=""}}}catch(B){B.name!=="AbortError"&&(M(B.message),m("open"))}finally{R.current=null}}async function te(){D(!0);try{await Ne.applyImprovement(a,r,S),o(S),m("closed")}catch(A){M(A.message)}finally{D(!1)}}function Q(){m("closed"),j([]),C(""),E(""),M(null)}if(u==="closed")return n.jsxs("button",{onClick:()=>m("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 O=U();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:A=>{A.currentTarget.style.background="var(--surface-3)"},onMouseLeave:A=>{A.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:A=>{x(A.target.value);const B=f==null?void 0:f.providers.find(se=>se.id===A.target.value);B!=null&&B.models[0]&&b(B.models[0].id)},disabled:u==="loading",children:f==null?void 0:f.providers.filter(A=>A.available).map(A=>n.jsx("option",{value:A.id,children:A.label},A.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:p,onChange:A=>b(A.target.value),disabled:u==="loading",children:O==null?void 0:O.models.map(A=>n.jsx("option",{value:A.id,children:A.label},A.id))})]}),u==="loading"?n.jsx("button",{onClick:q,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):n.jsx("button",{onClick:F,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),u==="loading"&&L.length>0&&n.jsx("div",{className:"mt-3",children:n.jsx(Ms,{entries:L,isRunning:!0})})]}),N&&n.jsx("div",{className:"mb-4",children:_?n.jsx(As,{error:_,onRetry:F,onDismiss:()=>{M(null),I(null)}}):n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:N})}),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((A,B)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:A.type==="added"?"rgba(34,197,94,0.1)":A.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:A.type==="added"?"var(--green)":A.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:A.type==="added"?"3px solid var(--green)":A.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:A.type==="added"?"+":A.type==="removed"?"-":" "}),A.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 Tx={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"}},Yj={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function Kj({change:a,index:r,selected:i,onToggle:o,originalEval:u}){var g;const[m,f]=v.useState(!1),h=Tx[a.action]??Tx.add,x=Yj[a.action]??"var(--border-subtle)",p=a.action==="remove"?(u==null?void 0:u.name)??`Eval #${a.evalId}`:((g=a.eval)==null?void 0:g.name)??"Unnamed",b=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:b,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:p}),n.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:a.reason}),n.jsx("button",{onClick:()=>f(!m),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:m?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),m&&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(Fj,{evalCase:a.eval}),a.action==="modify"&&a.eval&&u&&n.jsx(Wj,{original:u,proposed:a.eval}),a.action==="remove"&&u&&n.jsx(Pj,{evalCase:u})]})]})}function Fj({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[n.jsx(cd,{label:"Prompt",value:a.prompt}),n.jsx(cd,{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 Wj({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??[],m=new Set(o.map(p=>p.text)),f=new Set(u.map(p=>p.text)),h=u.filter(p=>!m.has(p.text)),x=o.filter(p=>!f.has(p.text));return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[i.map(p=>n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:p.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:["- ",ud(p.old,120)]}),n.jsxs("div",{style:{color:"var(--green)"},children:["+ ",ud(p.new,120)]})]})]},p.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(p=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",p.text]},p.id)),h.map(p=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",p.text]},p.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 Pj({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[n.jsx(cd,{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 cd({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:ud(r,300)})]})}function ud(a,r){return a.length>r?a.slice(0,r)+"...":a}const Rx={remove:0,modify:1,add:2};function Xj({changes:a,selections:r,currentEvals:i,onToggle:o,onSelectAll:u,onDeselectAll:m}){if(a.length===0)return null;const f=a.map((x,p)=>({change:x,originalIndex:p}));f.sort((x,p)=>(Rx[x.change.action]??2)-(Rx[p.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:m,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:p})=>n.jsx(Kj,{change:x,index:p,selected:r.get(p)??!1,onToggle:o,originalEval:x.evalId!=null?i.find(b=>b.id===x.evalId):void 0},p))})]})}function Qj(){var A;const{state:a,dispatch:r,submitAiEdit:i,applyAiEdit:o,discardAiEdit:u,cancelAiEdit:m,toggleEvalChange:f,selectAllEvalChanges:h,deselectAllEvalChanges:x,retryEvalsSave:p}=Sn(),{aiEditLoading:b,aiEditResult:g,aiEditError:j,aiEditClassifiedError:S,aiEditProgress:C,aiEditEvalChanges:z,aiEditEvalSelections:E,aiEditEvalsRetry:N}=a,[M,_]=v.useState(""),{config:I}=yl(),[L,$]=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(!I)return;I.providers.find(se=>se.id==="claude-cli"&&se.available)&&($("claude-cli"),D("opus"))},[I]);const U=I==null?void 0:I.providers.find(B=>B.id===L&&B.available),q=v.useCallback(()=>{const B=M.trim();!B||b||i(B,L,w)},[M,b,i,L,w]),F=v.useCallback(B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),q()),B.key==="Escape"&&(B.preventDefault(),b?m():u())},[q,b,m,u]),te=v.useCallback(()=>{r({type:"CLOSE_AI_EDIT"}),r({type:"OPEN_AI_EDIT"})},[r]),Q=g?ho(a.skillContent,g.improved):[],O=((A=a.evals)==null?void 0:A.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=>_(B.target.value),onKeyDown:F,placeholder:"e.g., Add an error handling section...",disabled:b,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 se=B.currentTarget;se.style.height="auto",se.style.height=Math.min(se.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:L,onChange:B=>{$(B.target.value);const se=I==null?void 0:I.providers.find(K=>K.id===B.target.value);se!=null&&se.models[0]&&D(se.models[0].id)},disabled:b,style:{width:"100%"},children:I==null?void 0:I.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:b,style:{width:"100%"},children:U==null?void 0:U.models.map(B=>n.jsx("option",{value:B.id,children:B.label},B.id))})]}),b?n.jsx("button",{onClick:m,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):n.jsx("button",{onClick:q,disabled:!M.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),b&&C.length>0&&n.jsx("div",{className:"mt-2.5",children:n.jsx(Ms,{entries:C,isRunning:!0})})]}),j&&n.jsx("div",{className:"mt-3",children:S?n.jsx(As,{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,se)=>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]},se))}),n.jsx(Xj,{changes:z,selections:E,currentEvals:O,onToggle:f,onSelectAll:h,onDeselectAll:x}),N&&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:p,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 Zj(a,r){const[i,o]=v.useState([]),[u,m]=v.useState("SKILL.md"),[f,h]=v.useState(null),[x,p]=v.useState(!1),[b,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(()=>{m("SKILL.md"),h(null),g(null),j()},[a,r,j]);const S=v.useCallback(async z=>{if(m(z),z==="SKILL.md"){h(null),g(null);return}p(!0),g(null);try{const E=await Ne.getSkillFile(a,r,z);h(E)}catch(E){g(`Unable to open file: ${E.message}`),h(null)}finally{p(!1)}},[a,r]),C=v.useCallback(()=>{j()},[j]);return{files:i,activeFile:u,secondaryContent:f,loading:x,error:b,selectFile:S,refresh:C,isSkillMd:u==="SKILL.md"}}function Jj(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function eS(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 m=i.get(o.path);m&&r.push(m)}else{const m=u.slice(0,-1).join("/"),f=i.get(m),h=i.get(o.path);f&&h&&f.children.push(h)}}return r}function Yv({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 Kv(){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 tS(){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 nS(){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 Fv({node:a,depth:r,activeFile:i,onSelect:o}){const[u,m]=v.useState(!0),f=a.path===i;return a.type==="dir"?n.jsxs("div",{children:[n.jsxs("button",{onClick:()=>m(!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(Yv,{expanded:u}),n.jsx(Kv,{}),n.jsxs("span",{children:[a.name,"/"]})]}),u&&a.children.map(h=>n.jsx(Fv,{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(tS,{}),n.jsx("span",{style:{flex:1},children:a.name}),n.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:Jj(a.size)})]})}function aS({files:a,activeFile:r,onSelect:i,onRefresh:o}){const[u,m]=v.useState(!1),f=v.useMemo(()=>eS(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:()=>m(!u),children:[n.jsx(Yv,{expanded:u}),n.jsx(Kv,{}),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(nS,{})})]}),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(Fv,{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 lS(a){try{return JSON.stringify(JSON.parse(a),null,2)}catch{return a}}function rS(a){const r=a.toLowerCase();return r.endsWith(".json")?"json":r.endsWith(".md")?"md":"other"}function Ax({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 Mx({content:a,fileType:r}){if(r==="json"){const i=lS(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:mo(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 Dx(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 sS({file:a,loading:r,error:i,viewMode:o,plugin:u,skill:m,onSaved:f,onDirtyChange:h}){const[x,p]=v.useState(o),[b,g]=v.useState(!1),[j,S]=v.useState(""),[C,z]=v.useState(!1),[E,N]=v.useState(null),M=o!==x?o:x;v.useEffect(()=>{h==null||h(b)},[b,h]);const _=v.useCallback(()=>{(a==null?void 0:a.content)!=null&&(S(a.content),g(!0))},[a]),I=v.useCallback(()=>{g(!1)},[]),L=v.useCallback(async()=>{if(!(!u||!m||!a)){z(!0);try{await Ne.saveSkillFile(u,m,a.path,j),N("Saved"),g(!1),f==null||f(),setTimeout(()=>N(null),2e3)}catch(D){N(`Save failed: ${D.message}`),setTimeout(()=>N(null),3e3)}finally{z(!1)}}},[u,m,a,j,f]);if(v.useEffect(()=>{if(!b)return;const D=R=>{(R.ctrlKey||R.metaKey)&&R.key==="s"&&(R.preventDefault(),L())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[b,L]),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 $=a.content??"",w=rS(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:()=>p(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&&m&&!a.binary&&!b&&n.jsx("button",{onClick:_,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),b&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:L,disabled:C,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:C?.6:1},children:C?"Saving...":"Save"}),n.jsx("button",{onClick:I,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),E&&n.jsx("div",{style:{padding:"4px 12px",background:E.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:E.startsWith("Save failed")?"var(--red)":"var(--green)"},children:E}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:b?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:L,disabled:C,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:C?.6:1},children:C?"Saving...":"Save"}),n.jsx("button",{onClick:I,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(Ax,{content:$})}),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:Dx($)}}):n.jsx(Mx,{content:$,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:Dx($)}}):n.jsx(Mx,{content:$,fileType:w}):n.jsx(Ax,{content:$})})]})}function iS({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 oS({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 cS({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 uS({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 Yu({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 dS(){const{state:a,dispatch:r,saveContent:i,isReadOnly:o}=Sn(),{plugin:u,skill:m,skillContent:f,isDirty:h,improveTarget:x,aiEditOpen:p}=a,[b,g]=v.useState("split"),[j,S]=v.useState(!1),C=v.useRef(null),[z,E]=v.useState(!1),[N,M]=v.useState(""),[_,I]=v.useState(!1),[L,$]=v.useState(null),[w,D]=v.useState([]),[R,U]=v.useState([]),[q,F]=v.useState(null),te=v.useRef(null),{config:Q}=yl(),{files:O,activeFile:A,secondaryContent:B,loading:se,error:K,selectFile:pe,refresh:T,isSkillMd:Y}=Zj(u??"",m??""),[ae,fe]=v.useState(!1),ve=v.useCallback(xe=>{ae&&!window.confirm("You have unsaved changes. Discard?")||pe(xe)},[ae,pe]);v.useEffect(()=>()=>{var xe;(xe=te.current)==null||xe.abort()},[]);const{metadata:he,body:Ce}=Vj(f),oe=he["allowed-tools"],je=Array.isArray(oe)?oe:typeof oe=="string"?[oe]:[],$e=he.name,Be=he.description,ne=he.metadata,ue=typeof ne=="object"&&!Array.isArray(ne)?ne:null,ce=he.version||(ue==null?void 0:ue.version),me=he.tags||(ue==null?void 0:ue.tags),ye=Array.isArray(me)?me:typeof me=="string"?me.split(",").map(xe=>xe.trim()).filter(Boolean):[],_e=new Set(["name","description","metadata","allowed-tools","version","tags"]),Me=Object.entries(he).filter(([xe])=>!_e.has(xe)),dt=v.useCallback(async()=>{S(!0),await i(),S(!1)},[i]),Zt=v.useCallback(xe=>{(xe.ctrlKey||xe.metaKey)&&xe.key==="s"&&(xe.preventDefault(),xe.stopPropagation(),h&&dt()),(xe.ctrlKey||xe.metaKey)&&xe.key==="k"&&(xe.preventDefault(),xe.stopPropagation(),r({type:p?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,dt,p,r]),ct=v.useCallback(async()=>{var Rt,De;if(!N.trim())return;(Rt=te.current)==null||Rt.abort();const xe=new AbortController;te.current=xe,I(!0),F(null),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:N,provider:xt,model:Wt}),signal:xe.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const On=await nt.json();On.error&&(bt=On.error)}catch{}throw new Error(bt)}const Pa=nt.body.getReader(),Qn=new TextDecoder;let Ct="",St="";for(;;){const{done:bt,value:On}=await Pa.read();if(bt)break;Ct+=Qn.decode(On,{stream:!0});const Xa=Ct.split(`
|
|
67
|
+
`);Ct=Xa.pop()||"";for(const Bn of Xa)if(Bn.startsWith("event: "))St=Bn.slice(7).trim();else if(Bn.startsWith("data: ")){try{const Ie=JSON.parse(Bn.slice(6));if(St==="progress")U(Ht=>[...Ht,{phase:Ie.phase,message:Ie.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const Ht=["---"];Ie.name&&Ht.push(`name: ${Ie.name}`),Ie.description&&Ht.push(`description: "${Ie.description.replace(/"/g,'\\"')}"`),Ie.model&&Ht.push(`model: ${Ie.model}`),(De=Ie.allowedTools)!=null&&De.trim()&&Ht.push(`allowed-tools: ${Ie.allowedTools.trim()}`),Ht.push("---","",Ie.body||"");const Zn=Ht.join(`
|
|
68
|
+
`);$(Zn),D(ho(f,Zn)),I(!1)}else St==="error"&&(F(Ie.message||Ie.description||"Generation failed"),I(!1))}catch{}St=""}}}catch(xt){xt.name!=="AbortError"&&F(xt.message)}finally{I(!1),te.current=null}},[N,Q,f]),Vt=v.useCallback(()=>{L&&r({type:"SET_CONTENT",content:L}),E(!1),$(null),D([]),M(""),U([])},[L,r]),$t=v.useCallback(()=>{E(!1),$(null),D([]),M(""),U([]),F(null)},[]),tt=v.useCallback(()=>{var xe;z?((xe=te.current)==null||xe.abort(),$t()):(p&&r({type:"CLOSE_AI_EDIT"}),E(!0))},[z,p,r,$t]),jt=[{mode:"raw",icon:n.jsx(iS,{}),label:"Editor"},{mode:"split",icon:n.jsx(oS,{}),label:"Split"},{mode:"preview",icon:n.jsx(cS,{}),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:xe,icon:Rt,label:De})=>n.jsxs("button",{onClick:()=>g(xe),title:De,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:b===xe?"var(--surface-4)":"transparent",color:b===xe?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:b===xe?600:400,border:"none",cursor:"pointer"},children:[Rt,n.jsx("span",{style:{letterSpacing:"0.01em"},children:De})]},xe))}),Y?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:()=>{p?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:p?600:400,border:"none",cursor:"pointer",color:p?"var(--purple)":"var(--text-tertiary)",background:p?"var(--purple-muted)":"transparent"},children:[n.jsx(uS,{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(Yu,{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&&m&&n.jsx(aS,{files:O,activeFile:A,onSelect:ve,onRefresh:T}),!Y&&n.jsx(sS,{file:B,loading:se,error:K,viewMode:b,plugin:u??void 0,skill:m??void 0,onSaved:()=>{pe(A),T()},onDirtyChange:fe}),Y&&n.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:b==="raw"||b==="preview"?"1fr":"1fr 1fr"},children:[b!=="preview"&&n.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:b==="split"?"1px solid var(--border-subtle)":"none"},children:n.jsx("textarea",{ref:C,value:f,onChange:xe=>{o||r({type:"SET_CONTENT",content:xe.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}})}),b!=="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:[($e||ce||Be)&&n.jsxs("div",{style:{marginBottom:20},children:[n.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[$e&&n.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:$e}),ce&&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",ce]})]}),Be&&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:Be})]}),ye.length>0&&n.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ye.map(xe=>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:xe},xe))}),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(xe=>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:xe},xe))]})}),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(([xe,Rt],De)=>{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:De>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:xe}),n.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:xt})]},xe)})}),($e||Be||ye.length>0||je.length>0||Me.length>0)&&Ce&&n.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),Ce&&n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:mo(Ce)}})]})})]}),Y&&p&&n.jsx(Qj,{}),Y&&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:[!L&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Yu,{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:N,onChange:xe=>M(xe.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:_,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:_?.5:1},onKeyDown:xe=>{xe.key==="Enter"&&(xe.ctrlKey||xe.metaKey)&&N.trim()&&!_&&(xe.preventDefault(),ct())}})}),n.jsxs("div",{className:"flex items-center gap-2",children:[_?n.jsx("button",{onClick:()=>{var xe;(xe=te.current)==null||xe.abort(),I(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):n.jsx("button",{onClick:ct,disabled:!N.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"})]}),_&&R.length>0&&n.jsx("div",{className:"mt-2",children:n.jsx(Ms,{entries:R,isRunning:!0})}),q&&n.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[q,n.jsx("button",{onClick:ct,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),L&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Yu,{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((xe,Rt)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:xe.type==="added"?"var(--green-muted)":xe.type==="removed"?"var(--red-muted)":"transparent",color:xe.type==="added"?"var(--green)":xe.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:xe.type==="added"?"3px solid var(--green)":xe.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:xe.type==="added"?"+":xe.type==="removed"?"-":" "}),xe.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"})]})]})]})}),Y&&x!==null&&u&&m&&n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(qj,{plugin:u,skill:m,skillContent:f,onApplied:xe=>{r({type:"SET_CONTENT",content:xe}),r({type:"CONTENT_SAVED"}),r({type:"CLOSE_IMPROVE"})}})})]})}function ir(a){return a.testType==="integration"?"integration":"unit"}function pr(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function Wv(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 Pv(a){return a==null?"--":a>=1e3?`${(a/1e3).toFixed(1)}s`:`${a}ms`}const fS=new Set(["benchmark","comparison","baseline"]);function zx(a,r,i,o){return a.map(({rate:u,idx:m,total:f})=>{const h=o+m/(f-1)*(r-o*2),x=o+(i-o*2)-u*(i-o*2);return`${h},${x}`})}function Xv({entries:a}){const r=a.filter(g=>fS.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,m=24,f=2,h=i.length>=2?zx(i,u,m,f):[],x=o.length>=2?zx(o,u,m,f):[],p=h[h.length-1],b=x[x.length-1];return n.jsxs("svg",{width:u,height:m,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"}),b&&n.jsx("circle",{cx:parseFloat(b.split(",")[0]),cy:parseFloat(b.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),p&&n.jsx("circle",{cx:parseFloat(p.split(",")[0]),cy:parseFloat(p.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function Qv(a,r,i){const o=isNaN(r)?0:r,u=[],m=[],f=[];if((a==="PASS"||a==="EFFECTIVE")&&o>=.7){const p=u.length>0?` Met criteria: ${u.map(b=>b.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): evaluation met expectations.${p}`}}if(a==="FAIL"||a==="DEGRADING"){const p=m.length>0?` Failed criteria: ${m.map(g=>g.criterion).join(", ")}.`:"",b=[...m.map(g=>`Improve "${g.criterion}" (score: ${g.score.toFixed(2)})`),...f.map(g=>`Strengthen "${g.criterion}" (score: ${g.score.toFixed(2)})`)];return b.length===0&&b.push("Review prompt instructions and add more specific guidance"),{explanation:`${a} (score ${o.toFixed(2)}): evaluation did not meet expectations.${p}`,recommendations:b}}if(a==="INEFFECTIVE"){if(o<.2){const b=[...m.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:b}}const p=[...m.map(b=>`Rework "${b.criterion}" — currently at ${b.score.toFixed(2)}`),...f.map(b=>`Strengthen "${b.criterion}" (score: ${b.score.toFixed(2)})`)];return p.length===0&&p.push("Consider restructuring your prompt approach"),{explanation:`${a} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:p}}if(a==="MARGINAL"){const p=[...f.map(b=>`Strengthen "${b.criterion}" (score: ${b.score.toFixed(2)})`),...m.map(b=>`Improve "${b.criterion}" (score: ${b.score.toFixed(2)})`)];return p.length===0&&p.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:p}}if(a==="EMERGING"){const p=[...m.map(b=>`Improve "${b.criterion}" (score: ${b.score.toFixed(2)})`),...f.map(b=>`Strengthen "${b.criterion}" (score: ${b.score.toFixed(2)})`)];return p.length===0&&p.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:p}}const h=u.length>0?` Passing: ${u.map(p=>p.criterion).join(", ")}.`:"",x=f.length>0?` Needs improvement: ${f.map(p=>p.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): mixed results.${h}${x}`}}const Zv={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function pS(a){return Object.hasOwn(Zv,a)}function mS(a){return pS(a)?Zv[a]:a}function hS(){const{state:a}=Sn(),{plugin:r,skill:i}=a,[o,u]=v.useState([]),[m,f]=v.useState([]),[h,x]=v.useState(!0),[p,b]=v.useState(null),[g,j]=v.useState(new Set),[S,C]=v.useState({}),[z,E]=v.useState(null),[N,M]=v.useState(""),[_,I]=v.useState(!1),[L,$]=v.useState(""),[w,D]=v.useState(""),R=v.useCallback(async()=>{x(!0),b(null);try{const[O,A]=await Promise.all([Ne.getCredentials(r,i),Ne.getParams(r,i)]);u(O.credentials),f(A.params)}catch(O){b(O instanceof Error?O.message:"Failed to load parameters"),u([]),f([])}finally{x(!1)}},[r,i]);v.useEffect(()=>{R()},[R]);const U=v.useCallback(async(O,A)=>{I(!0),b(null);try{await Ne.setCredential(r,i,O,A),E(null),M(""),await R()}catch(B){b(B instanceof Error?B.message:`Failed to save ${O}`)}finally{I(!1)}},[r,i,R]),q=v.useCallback(async()=>{const O=L.trim().toUpperCase(),A=w.trim();if(!(!O||!A)){I(!0),b(null);try{await Ne.setCredential(r,i,O,A),$(""),D(""),await R()}catch(B){b(B instanceof Error?B.message:`Failed to add ${O}`)}finally{I(!1)}}},[r,i,L,w,R]),F=v.useCallback(async O=>{if(g.has(O)){j(A=>{const B=new Set(A);return B.delete(O),B}),C(A=>{const B={...A};return delete B[O],B});return}try{const B=(await Ne.getParamsRevealed(r,i,O)).params.find(se=>se.name===O);B!=null&&B.value&&(C(se=>({...se,[O]:B.value})),j(se=>new Set(se).add(O)))}catch{}},[r,i,g]),te=new Set(o.map(O=>O.name)),Q=[...o.map(O=>{const A=m.find(B=>B.name===O.name);return{name:O.name,status:O.status,maskedValue:(A==null?void 0:A.maskedValue)??""}}),...m.filter(O=>!te.has(O.name)).map(O=>({name:O.name,status:O.status,maskedValue:O.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"}),p&&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:p}),h&&Q.length===0&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&Q.length===0&&!p&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),Q.map(O=>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:O.name}),n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:O.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:O.status==="ready"?"var(--green)":"var(--red)"},children:O.status}),(O.maskedValue||O.status==="ready")&&n.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[g.has(O.name)?S[O.name]??O.maskedValue:O.maskedValue||"***",n.jsx("button",{onClick:()=>F(O.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${g.has(O.name)?"Hide":"Reveal"} value for ${O.name}`,children:g.has(O.name)?"hide":"show"})]}),z===O.name?n.jsxs("div",{className:"flex gap-1",children:[n.jsx("input",{value:N,onChange:A=>M(A.target.value),onKeyDown:A=>{A.key==="Enter"&&N.trim()&&U(O.name,N)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${O.name}`,autoFocus:!0}),n.jsx("button",{onClick:()=>U(O.name,N),disabled:_||!N.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),n.jsx("button",{onClick:()=>{E(null),M("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):n.jsx("button",{onClick:()=>{E(O.name),M("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},O.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:L,onChange:O=>$(O.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:O=>D(O.target.value),onKeyDown:O=>{O.key==="Enter"&&L.trim()&&w.trim()&&q()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),n.jsx("button",{onClick:q,disabled:_||!L.trim()||!w.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:_?"not-allowed":"pointer"},children:"Add"})]})]})]})}function xS(a,r,i){const[o,u]=v.useState(null),[m,f]=v.useState(!1),h=v.useRef("");v.useEffect(()=>{const p=`${a}/${r}/${i}`;h.current!==p&&(h.current=p,f(!0),Ne.getCaseHistory(a,r,i).then(b=>u(b)).catch(()=>u([])).finally(()=>f(!1)))},[a,r,i]);const x=v.useCallback(()=>{f(!0),h.current="",Ne.getCaseHistory(a,r,i).then(p=>u(p)).catch(()=>u([])).finally(()=>f(!1))},[a,r,i]);return{entries:o,loading:m,refetch:x}}function vS(a,r,i){const o={flaky:!1,nonDiscriminating:!1,regression:!1};if(!i||i.length===0)return o;const m=i.slice(0,10).map(x=>x.assertions.find(p=>p.id===a)).filter(Boolean);if(m.length>=2){const p=m.filter(b=>b.pass).length/m.length;p>=.3&&p<=.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(b=>b.id===a),p=h.assertions.find(b=>b.id===a);x!=null&&x.pass&&(p!=null&&p.pass)&&(o.nonDiscriminating=!0)}if(r&&!r.pass&&i.length>=1){const p=i[0].assertions.find(b=>b.id===a);p!=null&&p.pass&&(o.regression=!0)}return o}function yS(){var se;const{state:a,dispatch:r,saveEvals:i,runCase:o,runAll:u,cancelCase:m,cancelAll:f,generateEvals:h,isReadOnly:x}=Sn(),{evals:p,evalsError:b,selectedCaseId:g,inlineResults:j,caseRunStates:S,generateEvalsLoading:C,generateEvalsProgress:z,generateEvalsError:E}=a,N=v.useMemo(()=>{for(const K of S.values())if(K.status==="running"||K.status==="queued")return!0;return!1},[S]),[M,_]=v.useState(!1),[I,L]=v.useState("all"),$={skill_name:a.skill,evals:[]},w=p??$,D=w.evals,R=v.useMemo(()=>I==="all"?D:D.filter(K=>ir(K)===I),[I,D]),U=R.find(K=>K.id===g)??null;v.useEffect(()=>{g!==null&&!R.find(K=>K.id===g)&&r({type:"SELECT_CASE",caseId:R.length>0?R[0].id:null})},[R,g,r]);const[q,F]=v.useState([]),te=v.useMemo(()=>D.some(K=>ir(K)==="integration"),[D]);v.useEffect(()=>{te&&Ne.getCredentials(a.plugin,a.skill).then(K=>F(K.credentials)).catch(()=>F([]))},[a.plugin,a.skill,te]);const Q=v.useMemo(()=>new Set(q.filter(K=>K.status==="missing").map(K=>K.name)),[q]),[O,A]=v.useState(!1),B=v.useCallback(K=>{A(!1),h(K?{testType:K}:void 0)},[h]);return!p||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:b?"var(--red-muted)":"var(--accent-muted)"},children:b?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:b?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:b}),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:()=>_(!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:C||x,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:C?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:()=>A(!O),disabled:C||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"})})})]}),O&&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:K=>{K.currentTarget.style.background="var(--surface-2)"},onMouseLeave:K=>{K.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),C&&z.length>0&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ms,{entries:z,isRunning:!0})}),E&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(As,{error:E,onRetry:()=>B()})}),M&&n.jsx(Lx,{evals:w,onSave:K=>{i(K),_(!1)},onCancel:()=>_(!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:N?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(K=>n.jsx("button",{onClick:()=>L(K),style:{padding:"2px 8px",fontSize:10,fontWeight:I===K?600:400,background:I===K?"var(--accent-muted)":"transparent",color:I===K?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:K==="all"?`All (${D.length})`:K==="unit"?`Unit (${D.filter(pe=>ir(pe)==="unit").length})`:`Integration (${D.filter(pe=>ir(pe)==="integration").length})`},K))}),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 ",I==="all"?"":I+" ","tests yet"]}),R.map(K=>{var ae;const pe=j.get(K.id),T=g===K.id,Y=ir(K);return n.jsxs("button",{onClick:()=>r({type:"SELECT_CASE",caseId:K.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:T?"var(--accent-muted)":"transparent",borderLeft:T?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:fe=>{T||(fe.currentTarget.style.background="var(--surface-2)")},onMouseLeave:fe=>{T||(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:T?"var(--text-primary)":"var(--text-secondary)"},children:["#",K.id," ",K.name,n.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:Y==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:Y==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:Y==="unit"?"U":"I"}),Y==="integration"&&((ae=K.requiredCredentials)==null?void 0:ae.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(Jv,{result:pe})]}),n.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[K.assertions.length," assertion",K.assertions.length!==1?"s":"",(pe==null?void 0:pe.passRate)!=null&&n.jsx(jS,{passRate:pe.passRate})]})]},K.id)})]}),n.jsx("div",{className:"px-3 py-2",children:!x&&n.jsx("button",{onClick:()=>_(!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:K=>{K.currentTarget.style.borderColor="var(--accent)",K.currentTarget.style.color="var(--accent)"},onMouseLeave:K=>{K.currentTarget.style.borderColor="var(--border-default)",K.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(hS,{})})]}),n.jsx("div",{className:"overflow-auto",children:U?n.jsx(gS,{evalCase:U,result:j.get(U.id),evals:p,caseStatus:((se=S.get(U.id))==null?void 0:se.status)??"idle",onSaveEvals:i,onRun:K=>o(K,"benchmark"),onCompare:K=>o(K,"comparison"),onCancel:K=>m(K),onImprove:K=>r({type:"OPEN_IMPROVE",evalId:K})}):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(Lx,{evals:w,onSave:K=>{i(K),_(!1)},onCancel:()=>_(!1)})]})}function gS({evalCase:a,result:r,evals:i,caseStatus:o,onSaveEvals:u,onRun:m,onCompare:f,onCancel:h,onImprove:x}){const{state:p,isReadOnly:b}=Sn(),{plugin:g,skill:j}=p,{entries:S,loading:C}=xS(g,j,a.id),[z,E]=v.useState(!1),[N,M]=v.useState(a.prompt),[_,I]=v.useState(!1),[L,$]=v.useState(a.expected_output);v.useState(()=>{M(a.prompt),$(a.expected_output)});const w=v.useCallback(K=>{u({...i,evals:i.evals.map(pe=>pe.id===K.id?K:pe)})},[i,u]),D=v.useCallback(()=>{w({...a,prompt:N}),E(!1)},[a,N,w]),R=v.useCallback(()=>{w({...a,expected_output:L}),I(!1)},[a,L,w]),U=v.useCallback(()=>{w({...a,assertions:[...a.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[a,w]),q=v.useCallback((K,pe)=>{w({...a,assertions:a.assertions.map(T=>T.id===K?{...T,text:pe}:T)})},[a,w]),F=v.useCallback(K=>{w({...a,assertions:a.assertions.filter(pe=>pe.id!==K)})},[a,w]),te=v.useCallback(()=>{confirm("Delete this test case?")&&u({...i,evals:i.evals.filter(K=>K.id!==a.id)})},[i,a.id,u]),Q=r&&r.assertions.length>0&&r.assertions.every(K=>K.pass),O=r&&r.assertions.some(K=>!K.pass),A=ir(a),B=a.requiredCredentials??[],se=A==="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]}),b?n.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:A==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:A==="unit"?"var(--accent)":"var(--orange)"},children:A==="unit"?"Unit":"Integration"}):n.jsx("button",{onClick:()=>{if((A==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:pe,requirements:T,cleanup:Y,...ae}=a;w({...ae,testType:"unit"})}else w({...a,testType:"integration"})},title:`Click to switch to ${A==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:A==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:A==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:A==="unit"?"Unit":"Integration"}),n.jsx(Jv,{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:()=>m(a.id),disabled:b,className:"btn btn-primary text-[12px]",children:"Run"}),n.jsx("button",{onClick:()=>f(a.id),disabled:b,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),O&&!b&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:()=>x(a.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!b&&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"})]})})]})]}),b&&A==="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"})]}),se&&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(K=>n.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:K},K))})]}),!b&&A==="integration"&&n.jsx(wS,{evalCase:a,onUpdate:w}),n.jsx(Fi,{title:"Prompt",children:z?n.jsxs("div",{children:[n.jsx("textarea",{value:N,onChange:K=>M(K.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),E(!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:b?"default":"pointer"},onClick:()=>{b||E(!0)},onMouseEnter:K=>{b||(K.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:K=>{K.currentTarget.style.borderColor="var(--border-subtle)"},children:a.prompt||n.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:b?"No prompt":"Click to edit prompt..."})})}),n.jsx(Fi,{title:"Expected Output",children:_?n.jsxs("div",{children:[n.jsx("textarea",{value:L,onChange:K=>$(K.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:()=>{$(a.expected_output),I(!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:b?"default":"pointer"},onClick:()=>{b||I(!0)},onMouseEnter:K=>{b||(K.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:K=>{K.currentTarget.style.borderColor="var(--border-subtle)"},children:a.expected_output||n.jsx("span",{style:{fontStyle:"italic"},children:b?"No expected output":"Click to edit expected output..."})})}),n.jsx(Fi,{title:`Assertions (${a.assertions.length})`,action:b?void 0:n.jsx("button",{onClick:U,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(K=>{const pe=r==null?void 0:r.assertions.find(Y=>Y.assertion_id===K.id),T=vS(K.id,pe,S);return n.jsx(bS,{assertion:K,result:pe,badges:T,isReadOnly:b,onUpdate:Y=>q(K.id,Y),onDelete:()=>F(K.id)},K.id)})})}),(r==null?void 0:r.output)&&n.jsx(SS,{output:r.output,durationMs:r.durationMs,tokens:r.tokens}),r&&r.passRate!=null&&r.passRate<.2&&(()=>{const K=Qv("INEFFECTIVE",r.passRate);return K.recommendations&&K.recommendations.length>0?n.jsx(Fi,{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:K.recommendations.map((pe,T)=>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:"•"}),pe]},T))})]})}):null})(),n.jsx(kS,{evalId:a.id,sharedEntries:S,sharedLoading:C})]},a.id)}function bS({assertion:a,result:r,badges:i,isReadOnly:o,onUpdate:u,onDelete:m}){const[f,h]=v.useState(!1),[x,p]=v.useState(a.text),[b,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=>p(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||(p(a.text),h(!0))},children:a.text}),(r==null?void 0:r.reasoning)&&n.jsx("button",{onClick:()=>g(!b),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:b?"Hide reasoning":"Show reasoning"}),b&&(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:m,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 Fi({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 Jv({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=Qv(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 jS({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 SS({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 Ku(a){return a==="baseline"?"right":a==="comparison"?"full":"left"}function Fu({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:Wv(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:pr(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:Pv(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 kS({evalId:a,sharedEntries:r,sharedLoading:i}){const{state:o,dispatch:u}=Sn(),{plugin:m,skill:f}=o,[h,x]=v.useState(!0),p=r??null,b=i??!1,g=v.useCallback(()=>{x(z=>!z)},[]),j=p?p.slice(0,10):[],S=j.some(z=>{const E=Ku(z.type);return E==="left"||E==="full"}),C=j.some(z=>{const E=Ku(z.type);return E==="right"||E==="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",p&&p.length>0&&n.jsxs("span",{style:{fontWeight:400},children:["(",p.length," run",p.length!==1?"s":"",")"]})]}),h&&n.jsx("div",{className:"animate-fade-in",children:b?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..."})]}):!p||p.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(Xv,{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"}),!C&&n.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),j.map((z,E)=>{const N=Ku(z.type);return N==="full"?n.jsx("div",{style:{gridColumn:"1 / -1"},children:n.jsx(Fu,{entry:z})},E):N==="left"?n.jsxs(v.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"},children:n.jsx(Fu,{entry:z})}),n.jsx("div",{style:{gridColumn:"2"}})]},E):n.jsxs(v.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"}}),n.jsx("div",{style:{gridColumn:"2"},children:n.jsx(Fu,{entry:z})})]},E)})]}),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 Lx({evals:a,onSave:r,onCancel:i}){const[o,u]=v.useState(""),[m,f]=v.useState(""),[h,x]=v.useState(""),[p,b]=v.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[g,j]=v.useState("unit"),[S,C]=v.useState(""),[z,E]=v.useState([]),[N,M]=v.useState(""),[_,I]=v.useState(""),L=Math.max(0,...a.evals.map(R=>R.id))+1,$=R=>{j(R),R==="unit"&&(E([]),C(""),M(""),I(""))},w=()=>{const R=S.trim().toUpperCase();R&&!z.includes(R)&&E([...z,R]),C("")},D=()=>{if(!o.trim()||!m.trim())return;const R={id:L,name:o.trim(),prompt:m.trim(),expected_output:h.trim(),files:[],assertions:p.filter(U=>U.text.trim()),...g==="integration"?{testType:"integration",...z.length>0?{requiredCredentials:z}:{},...N||_?{requirements:{...N?{platform:N}:{},..._?{chromeProfile:_}:{}}}:{}}:{}};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:()=>$(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:m,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"}),p.map((R,U)=>n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:R.text,onChange:q=>b(p.map((F,te)=>te===U?{...F,text:q.target.value}:F)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),p.length>1&&n.jsx("button",{onClick:()=>b(p.filter((q,F)=>F!==U)),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:()=>b([...p,{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:()=>E(z.filter(U=>U!==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=>C(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:N,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:_,onChange:R=>I(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()||!m.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function wS({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("")},m=x=>{const p=(a.requiredCredentials??[]).filter(b=>b!==x);r({...a,requiredCredentials:p.length>0?p: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:()=>m(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 jn(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 ey(a,r){return a==null||r==null?"N/A":`${a.toLocaleString("en-US")} in / ${r.toLocaleString("en-US")} out`}function CS(a){return a==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function NS(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 ES(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 m=a>0?"more":"fewer";return`Your skill passes ${u} ${m} assertions across ${i} ${o}`}function _x(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 TS(a){return a==="skill"?{text:"Skill wins",isSkill:!0}:a==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function RS(a,r){const i=a+r,o=i*10,u=i*25,m=f=>f>=60?`${Math.round(f/60)}m`:`${f}s`;return`${m(o)}–${m(u)}`}const AS={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function MS(a,r){if(!a)return null;const i=AS[a];if(i==null||i===0)return null;const o=i*r*.5,u=i*r*2;return`${jn(o)}–${jn(u)}`}function DS(){const{state:a,runCase:r,runAll:i,cancelCase:o,cancelAll:u,isReadOnly:m}=Sn(),{evals:f,caseRunStates:h,bulkRunActive:x,latestBenchmark:p,inlineResults:b}=a,{config:g}=yl(),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]),C=j.filter(w=>{const D=h.get(w.id);return D&&(D.status==="complete"||D.status==="error"||D.status==="cancelled")}).length,z=j.filter(w=>{const D=h.get(w.id);return D&&(D.status==="running"||D.status==="queued")}).length,E=v.useRef(null),[N,M]=v.useState(0);v.useEffect(()=>{if(S&&!E.current&&(E.current=Date.now()),!S){E.current=null,M(0);return}const w=setInterval(()=>{E.current&&M(Math.round((Date.now()-E.current)/1e3))},1e3);return()=>clearInterval(w)},[S]);const _=j.reduce((w,D)=>w+D.assertions.length,0),I=j.length+_,L=v.useMemo(()=>RS(j.length,_),[j.length,_]),$=v.useMemo(()=>MS((g==null?void 0:g.provider)??null,I),[g==null?void 0:g.provider,I]);return n.jsxs("div",{className:"p-5",children:[m&&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||m,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||m,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||m,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: ",L]}),$&&n.jsxs("span",{children:["Est. cost: ",$]}),!$&&(g==null?void 0:g.provider)&&(g.provider==="claude-cli"||g.provider==="codex-cli")&&n.jsx("span",{children:"Cost: Subscription"}),!$&&(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: ",C,"/",j.length," cases"]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(C/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:`${C/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: ",N>=60?`${Math.floor(N/60)}m ${N%60}s`:`${N}s`]}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",L]})]})]}),n.jsx("div",{className:"space-y-3 stagger-children",children:j.map(w=>{const D=b.get(w.id),R=h.get(w.id),U=(R==null?void 0:R.status)??"idle",q=p==null?void 0:p.cases.find(F=>F.eval_id===w.id);return n.jsx(LS,{name:w.name,evalId:w.id,result:D,caseCost:q==null?void 0:q.cost,caseBillingMode:q==null?void 0:q.billingMode,caseInputTokens:q==null?void 0:q.inputTokens,caseOutputTokens:q==null?void 0:q.outputTokens,caseStatus:U,runMode:(R==null?void 0:R.mode)??null,comparisonDetail:q==null?void 0:q.comparisonDetail,isReadOnly:m,onRun:F=>r(F,"benchmark"),onBaseline:F=>r(F,"baseline"),onCompare:F=>r(F,"comparison"),onCancel:F=>o(F)},w.id)})}),!S&&p&&p.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:CS(p.type)}),n.jsx("span",{className:"text-[20px] font-bold",style:{color:(p.overall_pass_rate??0)>=.8?"var(--green)":(p.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:p.overall_pass_rate!=null?`${Math.round(p.overall_pass_rate*100)}%`:"--"})]}),p.totalDurationMs!=null&&n.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(p.totalDurationMs/1e3).toFixed(1),"s",p.model&&` | Model: ${p.model}`,p.totalInputTokens!=null&&p.totalOutputTokens!=null&&` | Tokens: ${ey(p.totalInputTokens,p.totalOutputTokens)}`,p.totalCost!=null&&` | Cost: ${jn(p.totalCost)}`]}),p.overall_pass_rate>=.9999&&!p.comparison&&n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||m,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"})]}),p.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=NS(p.model,p.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(Ox,{label:"Skill",value:p.comparison.skillPassRate,color:"var(--accent)"}),n.jsx(Ox,{label:"Baseline",value:p.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),n.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:p.comparison.delta>0?"var(--green)":p.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",p.comparison.delta>0?"+":"",(p.comparison.delta*100).toFixed(1),"%",p.verdict&&` | ${mS(p.verdict)}`]}),(()=>{const w=p.cases.reduce((R,U)=>R+U.assertions.length,0),D=ES(p.comparison.delta,w,p.cases.length);return n.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:D})})()]})]})]})}const zS={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 LS({name:a,evalId:r,result:i,caseCost:o,caseBillingMode:u,caseInputTokens:m,caseOutputTokens:f,caseStatus:h,runMode:x,comparisonDetail:p,isReadOnly:b,onRun:g,onBaseline:j,onCompare:S,onCancel:C}){const[z,E]=v.useState(!1),N=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:N?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:N?"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&&(N||M)&&(()=>{const _=zS[x];return _?n.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:_.bg,color:_.color,padding:"1px 6px"},children:_.label}):null})()]}),n.jsxs("div",{className:"flex items-center gap-2",children:[N?n.jsx("button",{onClick:()=>C(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:b,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),n.jsx("button",{onClick:()=>g(r),disabled:b,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),n.jsx("button",{onClick:()=>j(r),disabled:b,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}),m!=null&&f!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:ey(m,f)}),o!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:jn(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(_=>n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{style:{color:_.pass?"var(--green)":"var(--red)"},children:_.pass?"PASS":"FAIL"}),n.jsx("span",{style:{color:"var(--text-secondary)"},children:_.text})]},_.assertion_id))}),i.output&&n.jsx("button",{onClick:()=>E(!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})]}),p&&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 _=_x(p.skillContentScore,p.baselineContentScore),I=_x(p.skillStructureScore,p.baselineStructureScore),L=TS(p.winner);return n.jsxs(n.Fragment,{children:[n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",_.skill,"% / Baseline ",_.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",I.skill,"% / Baseline ",I.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsx("span",{style:{color:L.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:L.text})]})})()})})}),i&&i.errorMessage&&n.jsx(_S,{errorMessage:i.errorMessage,classifiedError:i.classifiedError})]})}const Wu={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function _S({errorMessage:a,classifiedError:r}){const[i,o]=v.useState(!1),u=(r==null?void 0:r.title)??"Error",m=r==null?void 0:r.hint,f=r?Wu[r.category]??Wu.unknown:Wu.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"})]}),m&&n.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:m}),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 Ox({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 Bx={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 OS(){const{state:a,dispatch:r,runActivationTest:i,cancelActivation:o,generateActivationPrompts:u}=Sn(),{plugin:m,skill:f,activationPrompts:h,activationResults:x,activationSummary:p,activationRunning:b,activationError:g,activationStartedAt:j,activationClassifyingStatus:S,generatingPrompts:C,generatingPromptsError:z,activationHistory:E}=a,[N,M]=v.useState(h),[_,I]=v.useState(null),[L,$]=v.useState(!1);v.useEffect(()=>{h&&h!==N&&M(h)},[h]),v.useEffect(()=>{r({type:"SET_ACTIVATION_PROMPTS",prompts:N})},[N,r]),v.useEffect(()=>{fetch(`/api/skills/${m}/${f}/description`).then(O=>O.json()).then(O=>I(O.rawContent||O.description||null)).catch(()=>I(null))},[m,f]);function w(){i(N)}function D(){u(8)}const R=N.trim().split(`
|
|
69
|
+
`).filter(Boolean).length,U=x.filter(O=>O.classification==="TP"||O.classification==="TN"),q=x.filter(O=>O.classification==="FP"||O.classification==="FN"),F=(_==null?void 0:_.replace(/^---[\s\S]*?---\s*/,"").trim())??null,te=N.trim().length>0,Q=F?mo(F):"";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:C||!F||b,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:C?"var(--surface-3)":"var(--surface-2)",color:F?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:F?1:.5,cursor:F?"pointer":"not-allowed"},title:F?void 0:"No skill description available",onMouseEnter:O=>{F&&!C&&(O.currentTarget.style.background="var(--surface-3)")},onMouseLeave:O=>{C||(O.currentTarget.style.background="var(--surface-2)")},children:C?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"]})})})]}),!F&&!b&&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."}),z&&n.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:z}),n.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:N,onChange:O=>M(O.target.value),placeholder:`How do I write a unit test?
|
|
70
|
+
What edge cases should I test?
|
|
71
|
+
+Deploy this to production
|
|
72
|
+
!What's the weather like today?
|
|
73
|
+
!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(Wi,{}),n.jsx("span",{children:"No prefix = auto-classify"}),n.jsx(Wi,{}),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(Wi,{}),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(Wi,{}),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:b||!N.trim(),className:"btn btn-primary",children:b?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"]})}),b&&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(IS,{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:F?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}),b&&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:[q.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 (",q.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:q.map((O,A)=>n.jsx(Hx,{result:O},`incorrect-${A}`))})]}),U.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 (",U.length,")"]})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:U.map((O,A)=>n.jsx(Hx,{result:O},`correct-${A}`))})]})]}),p&&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"}),p.autoClassifiedCount!=null&&p.autoClassifiedCount>0&&n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[p.autoClassifiedCount," of ",p.total," prompts auto-classified from skill name and tags"]}),n.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[n.jsx(Pu,{label:"Precision",value:p.precision,description:"Of all activations, how many were correct?",detail:`${p.tp} true / ${p.tp+p.fp} total activations`}),n.jsx(Pu,{label:"Recall",value:p.recall,description:"Of expected activations, how many fired?",detail:`${p.tp} activated / ${p.tp+p.fn} expected`}),n.jsx(Pu,{label:"Reliability",value:p.reliability,description:"Overall correct classification rate",detail:`${p.tp+p.tn} correct / ${p.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(Pi,{label:"True Positive",abbr:"TP",count:p.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),n.jsx(Pi,{label:"False Positive",abbr:"FP",count:p.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),n.jsx(Pi,{label:"False Negative",abbr:"FN",count:p.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),n.jsx(Pi,{label:"True Negative",abbr:"TN",count:p.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),n.jsx(BS,{history:E,expanded:L,onToggle:()=>$(!L)})]})}function BS({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(HS,{run:o},o.id))})})]})}function HS({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:US(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 US(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 m=Math.floor(u/60);if(m<24)return`${m}h ago`;const f=Math.floor(m/24);return f<7?`${f}d ago`:new Date(a).toLocaleDateString()}function Wi(){return n.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Hx({result:a}){const r=Bx[a.classification]||Bx.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 Pu({label:a,value:r,description:i,detail:o}){const u=Math.round(r*100),m=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:m},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 Pi({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 IS({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 Xu={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Ux={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},dd=600,fd=180,en=40,Qu=dd-en*2,Ga=fd-en*2,VS=[25,50,75,100];function Ix(a){return new Date(a).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function $S(a){return a==null?"--":`${(a/1e3).toFixed(1)}s`}function GS({entries:a,onPointClick:r}){const[i,o]=v.useState(null),u=v.useMemo(()=>[...a].reverse(),[a]);if(u.length<2)return null;const m=u.length,f=u.map((p,b)=>{const g=en+b/(m-1)*Qu,j=p.passRate*100,S=en+Ga-j/100*Ga;return{x:g,y:S,pct:j,entry:p}}),h=f.map(p=>`${p.x},${p.y}`).join(" "),x=Array.from(new Set(u.map(p=>p.type)));return n.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:m>=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(p=>n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:Xu[p]??"var(--text-tertiary)"}}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Ux[p]??p})]},p))}),n.jsxs("svg",{width:dd,height:fd,viewBox:`0 0 ${dd} ${fd}`,style:{display:"block",overflow:"visible"},children:[VS.map(p=>{const b=en+Ga-p/100*Ga;return n.jsxs("g",{children:[n.jsx("line",{x1:en,y1:b,x2:en+Qu,y2:b,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),n.jsxs("text",{x:en-8,y:b+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[p,"%"]})]},p)}),n.jsx("line",{x1:en,y1:en+Ga,x2:en+Qu,y2:en+Ga,stroke:"var(--border-subtle)",strokeWidth:1}),n.jsx("text",{x:en-8,y:en+Ga+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((p,b)=>n.jsx("circle",{cx:p.x,cy:p.y,r:5,fill:Xu[p.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:p.x,y:p.y,entry:p.entry})},onMouseLeave:g=>{g.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>r==null?void 0:r(p.entry)},b)),qS(m).map(p=>n.jsx("text",{x:f[p].x,y:en+Ga+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Ix(u[p].timestamp)},p))]}),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:Ix(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:Xu[i.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Ux[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:$S(i.entry.totalDurationMs)}),n.jsx("span",{children:i.entry.totalTokens!=null?`${i.entry.totalTokens} tokens`:"--"})]})]})]})}function qS(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 ms=new Map;let tn=null,eo=null,Xi=1e3,hs=0;function ty(){if(tn)return;tn=new EventSource("/api/events");const a=r=>i=>{let o={};try{o=i.data?JSON.parse(i.data):{}}catch{}const u=ms.get(r);if(u)for(const m of u)m(o)};tn.addEventListener("benchmark:complete",a("benchmark:complete")),tn.addEventListener("history:written",a("history:written")),tn.addEventListener("leaderboard:updated",a("leaderboard:updated")),tn.onerror=()=>{tn==null||tn.close(),tn=null,hs>0&&(eo=setTimeout(()=>{Xi=Math.min(Xi*2,3e4),ty()},Xi))},tn.onopen=()=>{Xi=1e3}}function YS(){eo!=null&&(clearTimeout(eo),eo=null),tn==null||tn.close(),tn=null}function KS(a,r){return ms.has(a)||ms.set(a,new Set),ms.get(a).add(r),hs++,ty(),()=>{var i;(i=ms.get(a))==null||i.delete(r),hs--,hs<=0&&(hs=0,YS())}}function lo(a,r){const i=v.useRef(r);i.current=r,v.useEffect(()=>KS(a,u=>i.current(u)),[a])}function ro(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function FS(a){return a>=1e3?`${(a/1e3).toFixed(1)}s`:`${Math.round(a)}ms`}function WS({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:ro(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:ro(a)}})})]})})}function PS({points:a}){if(a.length<2)return null;const r=200,i=48,o=4,u=a.length,m=a.map((x,p)=>{const b=o+p/(u-1)*(r-o*2),g=o+(i-o*2)-x.passRate*(i-o*2);return{x:b,y:g}}),f=`M ${m[0].x},${i-o} `+m.map(x=>`L ${x.x},${x.y}`).join(" ")+` L ${m[m.length-1].x},${i-o} Z`,h=m.map((x,p)=>`${p===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:m[m.length-1].x,cy:m[m.length-1].y,r:3,fill:"var(--accent)"})]})}function XS({plugin:a,skill:r}){const i=`stats/${a}/${r}`,o=v.useCallback(()=>Ne.getStats(a,r),[a,r]),{data:u,loading:m}=po(i,o),f=v.useCallback(()=>Rs(i),[i]);if(lo("benchmark:complete",f),lo("history:written",f),m)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,p=h-x,b=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:ro(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:p>=0?"var(--green)":"var(--red)"},children:[p>=0?"+":"",Math.round(p*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:jn(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:jn(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(PS,{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:ro(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:FS(g.avgDurationMs)}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:g.avgCost!=null?jn(g.avgCost):"N/A"})]},g.model))})]})]}),b.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:b.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(WS,{rate:g.passRate,label:g.text})]},`${g.evalId}:${g.id}`))})]})]})}function QS({plugin:a,skill:r}){const[i,o]=v.useState(null),[u,m]=v.useState(null),[f,h]=v.useState({}),[x,p]=v.useState({});v.useEffect(()=>{Ne.getEvals(a,r).then(o).catch(()=>o(null))},[a,r]);async function b(g){if(u===g){m(null);return}if(m(g),!f[g]){p(j=>({...j,[g]:!0}));try{const j=await Ne.getCaseHistory(a,r,g);h(S=>({...S,[g]:j}))}catch{h(j=>({...j,[g]:[]}))}finally{p(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,C=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:()=>b(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:E=>{S||(E.currentTarget.style.background="var(--surface-2)")},onMouseLeave:E=>{S||(E.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(Xv,{entries:j}),z!=null&&n.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:pr(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:C?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((E,N)=>n.jsxs("div",{className:"p-4",style:{background:N===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:Wv(E.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:E.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:E.type==="benchmark"?"rgba(99,131,255,0.15)":E.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:E.type==="benchmark"?"#6383ff":E.type==="comparison"?"var(--purple)":"#fb923c"},children:E.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:pr(E.pass_rate)},children:[Math.round(E.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:[E.durationMs!=null&&n.jsx("span",{children:Pv(E.durationMs)}),E.tokens!=null&&n.jsxs("span",{children:[E.tokens>=1e3?`${(E.tokens/1e3).toFixed(1)}k`:E.tokens," tok"]})]}),n.jsx("div",{className:"space-y-1",children:E.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))})]},N))})})]},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 ZS(){const{state:a,dispatch:r}=Sn(),{plugin:i,skill:o}=a,[u,m]=v.useState("timeline"),[f,h]=v.useState(""),[x,p]=v.useState(""),[b,g]=v.useState(!1),[j,S]=v.useState([]),[C,z]=v.useState(null),[E,N]=v.useState(!1),[M,_]=v.useState(null),[I,L]=v.useState(!1),$=`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}=po($,w),U=D??[];v.useEffect(()=>{!D||D.length<2||Ne.compareRuns(i,o,D[0].timestamp,D[1].timestamp).then(O=>{const A=O.regressions.filter(B=>B.change==="regression");r({type:"SET_REGRESSIONS",regressions:A})}).catch(()=>{})},[D,i,o,r]);const q=v.useCallback(()=>Rs($),[$]);lo("history:written",q);const F=v.useCallback(async O=>{if(b){S(A=>A.includes(O)?A.filter(B=>B!==O):A.length>=2?[A[1],O]:[...A,O]);return}L(!0);try{const A=await Ne.getHistoryEntry(i,o,O);_(A)}catch{}finally{L(!1)}},[i,o,b]),te=v.useCallback(async()=>{if(j.length===2){N(!0);try{const O=await Ne.compareRuns(i,o,j[0],j[1]);z(O)}catch{}finally{N(!1)}}},[i,o,j]),Q=[...new Set(U.map(O=>O.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(O=>n.jsx("button",{onClick:()=>m(O),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:u===O?"var(--accent-muted)":"transparent",color:u===O?"var(--accent)":"var(--text-tertiary)"},children:O==="timeline"?"Timeline":O==="per-eval"?"Per Eval":"Statistics"},O))}),u==="timeline"&&n.jsxs("div",{children:[U.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(GS,{entries:U,onPointClick:O=>F(O.timestamp)})}),n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("select",{value:f,onChange:O=>h(O.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Models"}),Q.map(O=>n.jsx("option",{value:O,children:O},O))]}),n.jsxs("select",{value:x,onChange:O=>p(O.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(!b),S([]),z(null)},className:`btn text-[12px] ${b?"btn-primary":"btn-secondary"}`,children:b?"Exit Compare":"Compare Runs"}),b&&j.length===2&&n.jsx("button",{onClick:te,disabled:E,className:"btn btn-primary text-[12px]",children:E?"Comparing...":"Compare"})]}),n.jsx("div",{className:"space-y-2",children:U.length===0?n.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):U.map(O=>{const A=j.includes(O.timestamp);return n.jsx("button",{onClick:()=>F(O.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:A?"var(--accent-muted)":"var(--surface-1)",border:A?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:B=>{A||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{A||(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:[b&&n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:A?"var(--accent)":"var(--border-default)",background:A?"var(--accent)":"transparent"},children:A&&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(O.timestamp).toLocaleString()}),n.jsx("span",{className:"pill text-[9px]",style:{background:O.type==="comparison"?"var(--purple-muted)":O.type==="baseline"?"var(--surface-3)":O.type==="model-compare"?"var(--accent-muted)":O.type==="improve"||O.type==="instruct"?"var(--purple-muted)":O.type==="ai-generate"?"var(--green-muted)":O.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:O.type==="comparison"?"var(--purple)":O.type==="baseline"?"var(--text-tertiary)":O.type==="model-compare"?"var(--accent)":O.type==="improve"||O.type==="instruct"?"var(--purple)":O.type==="ai-generate"?"var(--green)":O.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:O.type==="model-compare"?"model compare":O.type==="improve"?"ai improve":O.type==="instruct"?"ai edit":O.type==="ai-generate"?"ai generate":O.type==="eval-generate"?"eval generate":O.type})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:O.model}),O.totalCost!=null&&O.totalCost>0&&n.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:jn(O.totalCost)}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:O.passRate>=.8?"var(--green)":O.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(O.passRate*100),"%"]})]})]})},O.timestamp)})}),C&&n.jsx(JS,{result:C}),M&&!b&&n.jsx(ek,{run:M,onClose:()=>_(null)})]}),u==="per-eval"&&n.jsx(QS,{plugin:i,skill:o}),u==="statistics"&&n.jsx(XS,{plugin:i,skill:o})]})}function JS({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: ",jn(a.runA.totalCost??null)]}),n.jsxs("span",{children:["Run B cost: ",jn(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: ",jn(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 ek({run:a,onClose:r}){return(a.type==="improve"||a.type==="instruct")&&a.improve?n.jsx(tk,{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: ${jn(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:jn(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 tk({run:a,onClose:r}){var m;const i=v.useMemo(()=>a.improve?ho(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"})]})})]})]}),((m=a.improve)==null?void 0:m.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 nk({plugin:a,skill:r}){const[i,o]=v.useState([]),[u,m]=v.useState([]),[f,h]=v.useState(!0),[x,p]=v.useState(null);v.useEffect(()=>{Ne.getDependencies(a,r).then(g=>{o(g.mcpDependencies),m(g.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[a,r]);async function b(g,j){try{await navigator.clipboard.writeText(j),p(g),setTimeout(()=>p(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:()=>b(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 Vx({plugin:a,skill:r}){const[i,o]=v.useState([]),[u,m]=v.useState(!0),[f,h]=v.useState(null),[x,p]=v.useState(""),[b,g]=v.useState(!1),[j,S]=v.useState(null),[C,z]=v.useState(""),[E,N]=v.useState(""),[M,_]=v.useState(!1),[I,L]=v.useState(new Set),$=v.useCallback(async()=>{m(!0);try{const[U,q]=await Promise.all([Ne.getCredentials(a,r).catch(()=>({credentials:[]})),Ne.getParams(a,r).catch(()=>({params:[]}))]),F=new Map(q.params.map(O=>[O.name,O])),te=new Set,Q=[];for(const O of U.credentials){te.add(O.name);const A=F.get(O.name);Q.push({name:O.name,status:O.status==="ready"||O.status==="resolved"?"ready":"missing",source:O.source,maskedValue:A==null?void 0:A.maskedValue})}for(const O of q.params)te.has(O.name)||Q.push({name:O.name,status:O.status,maskedValue:O.maskedValue});o(Q)}finally{m(!1)}},[a,r]);v.useEffect(()=>{$()},[$]);const w=v.useCallback(async U=>{if(I.has(U)){L(q=>{const F=new Set(q);return F.delete(U),F}),o(q=>q.map(F=>F.name===U?{...F,revealedValue:void 0}:F));return}try{const F=(await Ne.getParamsRevealed(a,r,U)).params.find(te=>te.name===U);F&&(o(te=>te.map(Q=>Q.name===U?{...Q,revealedValue:F.value}:Q)),L(te=>new Set(te).add(U)))}catch{}},[a,r,I]),D=async(U,q)=>{if(!(!U.trim()||!q.trim())){g(!0),S(null);try{await Ne.setCredential(a,r,U,q),h(null),p(""),L(new Set),$()}catch(F){S(F.message)}finally{g(!1)}}},R=async()=>{if(!(!C.trim()||!E.trim())){g(!0),S(null);try{await Ne.setCredential(a,r,C.trim().toUpperCase(),E),z(""),N(""),_(!1),$()}catch(U){S(U.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:()=>_(!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(U=>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:U.name}),U.maskedValue&&n.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:I.has(U.name)&&U.revealedValue!=null?U.revealedValue:U.maskedValue}),U.maskedValue&&n.jsx("button",{onClick:()=>w(U.name),className:"btn btn-ghost px-1",title:I.has(U.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:I.has(U.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:U.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:U.status==="ready"?"var(--green)":"var(--orange)"},children:U.status==="ready"?"ready":"missing"}),U.source&&n.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:U.source}),f===U.name?n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("input",{value:x,onChange:q=>p(q.target.value),onKeyDown:q=>{q.key==="Enter"&&D(U.name,x)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),n.jsx("button",{onClick:()=>D(U.name,x),disabled:b||!x.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:b?"...":"Save"}),n.jsx("button",{onClick:()=>{h(null),p("")},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(U.name),p("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},U.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:C,onChange:U=>z(U.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),n.jsx("input",{value:E,onChange:U=>N(U.target.value),onKeyDown:U=>{U.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:()=>{_(!1),z(""),N("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),n.jsx("button",{onClick:R,disabled:b||!C.trim()||!E.trim(),className:"btn btn-primary text-[10px]",children:b?"Saving...":"Save"})]})]})]})}function ak(){const{state:a}=Sn(),{plugin:r,skill:i}=a,[o,u]=v.useState(null),[m,f]=v.useState(!0);return v.useEffect(()=>{Ne.getDependencies(r,i).then(u).catch(()=>{}).finally(()=>f(!1))},[r,i]),m?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(nk,{plugin:r,skill:i}),n.jsx(Vx,{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(Vx,{plugin:r,skill:i})]})}function ny({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,m=i-u*2,f=o-u*2,h=r.length,x=Math.min(...r),b=Math.max(...r)-x||1,g=r.map((C,z)=>{const E=u+z/(h-1)*m,N=u+f-(C-x)/b*f;return`${E.toFixed(1)},${N.toFixed(1)}`}),j=r[r.length-1],S=pr(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[C,z]=g[g.length-1].split(",");return n.jsx("circle",{cx:C,cy:z,r:2.5,fill:S})})()]})}function lk(){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 rk({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 sk({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 ik({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 ok({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 ck(a){var o,u,m;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 p=r.get(x);p.passRates.push(h.passRate.mean),p.lastRubric=((o=h.rubricScore)==null?void 0:o.mean)??null,p.lastDuration=h.duration.mean,p.lastCost=((u=h.cost)==null?void 0:u.total)??null,p.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(p.lastBaselinePassRate=h.baselinePassRate.mean,p.lastSkillDelta=(m=h.skillDelta)==null?void 0:m.mean,p.lastAmplificationPct=h.amplificationPct,p.hasBaseline=!0)}const i=[];for(const[f,h]of r){const[x,...p]=f.split("/");i.push({rank:0,model:p.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 ay=(a="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:a,whiteSpace:"nowrap"});function uk({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:ay(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(lk,{})]})}),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:pr(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(ny,{data:r.sparklineData})})]},`${r.provider}/${r.model}`))})]})})}function dk({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:ay(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:pr(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(rk,{pct:i.amplificationPct}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(ny,{data:i.sparklineData})})]},`${i.provider}/${i.model}`))})]})})}function fk(){const{state:a}=Sn(),{plugin:r,skill:i}=a,[o,u]=v.useState("rankings"),m=`leaderboard/${r}/${i}`,f=v.useCallback(()=>Ne.getLeaderboard(r,i),[r,i]),{data:h,loading:x,error:p}=po(m,f),b=(h==null?void 0:h.entries)??[],g=(p==null?void 0:p.message)??null;v.useEffect(()=>{u("rankings")},[r,i]);const j=v.useCallback(()=>Rs(m),[m]);lo("leaderboard:updated",j);const S=v.useMemo(()=>ck(b),[b]),C=S.some(N=>N.hasBaseline),z=b[0],E=z==null?void 0:z.judgeBiasWarning;return x?n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"spinner spinner-lg"})}):g?n.jsx("div",{className:"flex items-center justify-center h-full px-8",children:n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Failed to load leaderboard"}),n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:g})]})}):S.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(ok,{active:o,onChange:u,hasBaseline:C})]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[b.length," sweep",b.length!==1?"s":""," · ",S.length," model",S.length!==1?"s":""]})]}),E&&n.jsx(ik,{warning:E}),o==="rankings"?n.jsx(uk,{entries:S}):n.jsx(dk,{entries:S}),o==="amplification"&&(z==null?void 0:z.skillQualityScore)!=null&&(z==null?void 0:z.skillQualityRating)&&n.jsx(sk,{score:z.skillQualityScore,rating:z.skillQualityRating})]})}const pk=["editor","tests","run","activation","history","leaderboard","deps","versions"];function mk(a){return a!=null&&pk.includes(a)}function hk({hideHeader:a=!1}={}){var j;const{state:r,dispatch:i,saveContent:o,isReadOnly:u}=Sn(),{state:m,refreshSkills:f,clearSelection:h}=ya(),x=v.useCallback(async()=>{try{await Ne.deleteSkill(r.plugin,r.skill),f(),h()}catch(S){const C=S instanceof Error?S.message:String(S);i({type:"SET_ERROR",error:`Failed to delete skill: ${C}`})}},[r.plugin,r.skill,f,h,i]);v.useEffect(()=>{const C=new URLSearchParams(window.location.search).get("panel");mk(C)&&C!==r.activePanel&&i({type:"SET_PANEL",panel:C})},[]),v.useEffect(()=>{const S=new URLSearchParams(window.location.search);S.set("panel",r.activePanel);const C=`${window.location.pathname}?${S.toString()}${window.location.hash}`;history.replaceState(null,"",C)},[r.activePanel]);const p=v.useCallback(S=>{const C=S.ctrlKey||S.metaKey;if(C&&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(C&&S.key==="s"&&!S.shiftKey){S.preventDefault(),r.isDirty&&o();return}},[r.isDirty,o,i]);if(v.useEffect(()=>(window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)),[p]),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 b=Array.from(r.caseRunStates.values()).some(S=>S.status==="running"||S.status==="queued"),g=((j=m.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(Md,{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(As,{error:Ij(r.error),onDismiss:()=>i({type:"SET_ERROR",error:null})})}),n.jsx(Hj,{activePanel:r.activePanel,onPanelChange:S=>i({type:"SET_PANEL",panel:S}),isDirty:r.isDirty,isRunning:b,hasRegressions:r.regressions.length>0,isActivationRunning:r.activationRunning,hasUpdate:g}),n.jsx(Uj,{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(dS,{}),r.activePanel==="tests"&&n.jsx(yS,{}),r.activePanel==="run"&&n.jsx(DS,{}),r.activePanel==="activation"&&n.jsx(OS,{}),r.activePanel==="history"&&n.jsx(ZS,{}),r.activePanel==="leaderboard"&&n.jsx(fk,{}),r.activePanel==="deps"&&n.jsx(ak,{}),r.activePanel==="versions"&&n.jsx(qv,{})]},r.activePanel)})},`${r.plugin}/${r.skill}`)]})}function xk(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 pd(a,r=!0){let i=a.toLowerCase().replace(/[^a-z0-9]+/g,"-");return r&&(i=i.replace(/^-+|-+$/g,"")),i}function vk(a,r,i,o){const m=`.../${a.split("/").slice(-2).join("/")}`;switch(r){case 1:return`${m}/${i}/skills/${o}/SKILL.md`;case 2:return`${m}/plugins/${i}/skills/${o}/SKILL.md`;case 3:return`${m}/skills/${o}/SKILL.md`}}function yk({onCreated:a,resolveAiConfigOverride:r}){const[i,o]=v.useState("ai"),[u,m]=v.useState(null),[f,h]=v.useState(!0),{config:x}=yl(),[p,b]=v.useState(""),[g,j]=v.useState(3),[S,C]=v.useState(""),[z,E]=v.useState(""),[N,M]=v.useState(""),[_,I]=v.useState(""),[L,$]=v.useState(""),[w,D]=v.useState(""),[R,U]=v.useState("write"),[q,F]=v.useState([]),[te,Q]=v.useState(!1),[O,A]=v.useState(null),[B,se]=v.useState(""),[K,pe]=v.useState(!1),[T,Y]=v.useState(!1),[ae,fe]=v.useState(null),[ve,he]=v.useState(null),[Ce,oe]=v.useState([]),je=v.useRef(null),$e=v.useRef(null),Be=v.useRef(null),ne=v.useRef(null),[ue,ce]=v.useState(!1),[me,ye]=v.useState(!1);v.useEffect(()=>{Ne.getProjectLayout().then(De=>{m(De),j(De.suggestedLayout);const xt=De.detectedLayouts.find(Wt=>Wt.layout===De.suggestedLayout);xt!=null&&xt.existingPlugins.length&&C(xt.existingPlugins[0])}).catch(()=>{}).finally(()=>h(!1))},[]),v.useEffect(()=>{var De;i==="ai"&&((De=je.current)==null||De.focus())},[i]),v.useEffect(()=>()=>{var De;(De=$e.current)==null||De.abort()},[]);const _e=v.useMemo(()=>{var De;return u?((De=u.detectedLayouts.find(xt=>xt.layout===g))==null?void 0:De.existingPlugins)||[]:[]},[u,g]),Me=S==="__new__"?z:S,dt=u?vk(u.root,g,Me||"{plugin}",p||"{skill}"):"",Zt=v.useMemo(()=>u?u.detectedLayouts.filter(De=>De.layout!==4):[],[u]),ct=v.useMemo(()=>{if(!u)return null;const De=u.detectedLayouts.find(nt=>nt.layout===2&&nt.existingPlugins.length>0),xt=u.detectedLayouts.find(nt=>nt.layout===1&&nt.existingPlugins.length>0),Wt=De||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 De=x.provider||"claude-cli",xt=x.model||"sonnet";return{provider:De,model:xt}},[x,r]),$t=v.useCallback(()=>{var De;(De=$e.current)==null||De.abort(),pe(!1)},[]),tt=v.useCallback(()=>{fe(null),he(null)},[]),jt=v.useCallback(async()=>{if(fe(null),he(null),oe([]),Be.current=null,!B.trim()){fe("Describe what your skill should do");return}pe(!0);const De=new AbortController;$e.current=De;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(xk({prompt:B.trim(),provider:xt,model:Wt,targetAgents:q})),signal:De.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const On=await nt.json();On.error&&(bt=On.error)}catch{}throw new Error(bt)}const Pa=nt.body.getReader(),Qn=new TextDecoder;let Ct="",St="";for(;;){const{done:bt,value:On}=await Pa.read();if(bt)break;Ct+=Qn.decode(On,{stream:!0});const Xa=Ct.split(`
|
|
74
|
+
`);Ct=Xa.pop()||"";for(const Bn of Xa)if(Bn.startsWith("event: "))St=Bn.slice(7).trim();else if(Bn.startsWith("data: ")){try{const Ie=JSON.parse(Bn.slice(6));if(St==="progress")oe(Ht=>[...Ht,{phase:Ie.phase,message:Ie.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const Ht={prompt:B.trim(),provider:Vt().provider,model:Vt().model,reasoning:Ie.reasoning||""};if(b(Ie.name),M(Ie.description),I(Ie.model||""),$(Ie.allowedTools||""),D(Ie.body),Y(!0),Be.current=Ht,o("manual"),Ie.suggestedPlugin&&typeof Ie.suggestedPlugin=="object"&&Ie.suggestedPlugin.plugin){const Nt=Ie.suggestedPlugin;if(((u==null?void 0:u.detectedLayouts.flatMap(kn=>kn.existingPlugins))??[]).includes(Nt.plugin))if(C(Nt.plugin),Nt.layout&&(Nt.layout===1||Nt.layout===2))j(Nt.layout);else{const kn=u==null?void 0:u.detectedLayouts.find(xo=>xo.existingPlugins.includes(Nt.plugin));kn&&(kn.layout===1||kn.layout===2)&&j(kn.layout)}else C("__new__"),E(Nt.plugin)}else g===3&&ct&&ye(!0);const Zn={name:Ie.name,plugin:Me||"",layout:g,description:Ie.description,model:Ie.model||void 0,allowedTools:Ie.allowedTools||void 0,body:Ie.body,aiMeta:Ht};Ne.saveDraft(Zn).then(Nt=>{ce(!0),Nt!=null&&Nt.dir&&(ne.current=Nt.dir)}).catch(()=>{})}else St==="error"&&(fe(Ie.message||Ie.description||"Unknown error"),Ie.category&&he(Ie))}catch{}St=""}}}catch(nt){nt.name!=="AbortError"&&fe(nt.message)}finally{pe(!1),$e.current=null}},[B,Vt,g,ct,Me,u,q]),xe=v.useCallback(async()=>{if(A(null),!p.trim()){A("Skill name is required");return}if(!N.trim()){A("Description is required");return}if(g!==3&&!Me.trim()){A("Plugin name is required");return}Q(!0);try{const De=await Ne.createSkill({name:pd(p),plugin:Me||"",layout:g,description:N,model:_||void 0,allowedTools:L||void 0,body:w,aiMeta:Be.current||void 0,draftDir:ne.current||void 0});ne.current=null,a(De.plugin,De.skill)}catch(De){A(De.message)}finally{Q(!1)}},[p,N,g,Me,_,L,w,a]),Rt=v.useCallback(()=>{ct&&(j(ct.layout),C(ct.plugins[0]),ye(!1))},[ct]);return{mode:i,setMode:o,layout:u,layoutLoading:f,selectedLayout:g,setSelectedLayout:j,creatableLayouts:Zt,availablePlugins:_e,pathPreview:dt,plugin:S,setPlugin:C,newPlugin:z,setNewPlugin:E,effectivePlugin:Me,name:p,setName:b,description:N,setDescription:M,model:_,setModel:I,allowedTools:L,setAllowedTools:$,body:w,setBody:D,bodyViewMode:R,setBodyViewMode:U,aiPrompt:B,setAiPrompt:se,generating:K,aiGenerated:T,aiError:ae,aiClassifiedError:ve,aiProgress:Ce,promptRef:je,handleGenerate:jt,handleCancelGenerate:$t,clearAiError:tt,targetAgents:q,setTargetAgents:F,draftSaved:ue,showPluginRecommendation:me,setShowPluginRecommendation:ye,pluginLayoutInfo:ct,applyPluginRecommendation:Rt,creating:te,error:O,handleCreate:xe}}function ly(){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 gk(){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 ry({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(ly,{}):n.jsx(gk,{}),n.jsxs("span",{children:[a.name,a.type==="dir"?"/":""]})]}),(i=a.children)==null?void 0:i.map(o=>n.jsx(ry,{node:o,depth:r+1},o.name))]})}function bk(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 jk({skillName:a,hasEvals:r,isDraft:i}){const o=bk(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(ly,{})}),"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(ry,{node:o})})]})}const qa={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Zu({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 Sk({onCreated:a,onCancel:r}){const i=yk({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(Zu,{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(Zu,{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.
|
|
75
|
+
|
|
76
|
+
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(Ms,{entries:i.aiProgress,isRunning:!0}),i.aiError&&n.jsx("div",{children:i.aiClassifiedError?n.jsx(As,{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(Zu,{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(pd(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(pd(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
|
+
|
|
78
|
+
You are an expert at...
|
|
79
|
+
`,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:mo(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(jk,{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 kk(){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 to({variant:a,message:r,onRetry:i}){const{setMode:o,setSearch:u}=ya(),[m,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:m?n.jsx(kk,{}):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 wk(a,r){const[i,o]=a.split(".").map(Number),[u,m]=r.split(".").map(Number);return u>i?"major":m>o?"minor":"patch"}const Ck={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 Nk(){const[a,r]=v.useState([]),[i,o]=v.useState(!0),[u,m]=v.useState(new Set),[f,h]=v.useState(new Map),[x,p]=v.useState(!1),[b,g]=v.useState(new Set),[j,S]=v.useState(null),[C,z]=v.useState(null),[E,N]=v.useState(!1),M=v.useCallback(async()=>{o(!0);try{const R=await Ne.getSkillUpdates();r(R.filter(U=>U.updateAvailable))}catch{r([])}finally{o(!1)}},[]);v.useEffect(()=>{M()},[M]);const _=v.useMemo(()=>a.filter(R=>!R.pinned),[a]),I=v.useCallback(R=>{m(U=>{const q=new Set(U);return q.has(R)?q.delete(R):q.add(R),q})},[]),L=v.useCallback(()=>{u.size===_.length?m(new Set):m(new Set(_.map(R=>R.name)))},[u,_]),$=v.useCallback(()=>{const R=[...u];if(!R.length)return;p(!0),h(new Map(R.map(q=>[q,{skill:q,status:"pending"}])));const U=Ne.startBatchUpdate(R);U.addEventListener("progress",q=>{try{const F=JSON.parse(q.data);h(te=>new Map(te).set(F.skill,F))}catch{}}),U.addEventListener("done",q=>{U.close(),p(!1);try{const F=JSON.parse(q.data);S(`Updated ${F.updated??0} skills, ${F.failed??0} failed`),setTimeout(()=>S(null),5e3)}catch{}M()}),U.addEventListener("error",()=>{U.close(),p(!1),S("Batch update failed"),setTimeout(()=>S(null),5e3)})},[u,M]),w=v.useCallback(R=>{R.name.split("/").pop()||R.name;const U=R.name.split("/"),q=U.length>=3?U[U.length-2]:U[0],F=U[U.length-1];g(Q=>new Set(Q).add(R.name));const te=Ne.startSkillUpdate(q,F);te.addEventListener("done",()=>{te.close(),g(Q=>{const O=new Set(Q);return O.delete(R.name),O}),M()}),te.addEventListener("error",()=>{te.close(),g(Q=>{const O=new Set(Q);return O.delete(R.name),O})})},[M]),D=v.useCallback(async R=>{if(!R.latest)return;const U=R.name.split("/"),q=U.length>=3?U[U.length-2]:U[0],F=U[U.length-1];N(!0);try{const te=await Ne.getVersionDiff(q,F,R.installed,R.latest);z({skill:R,diff:te})}catch{z(null)}finally{N(!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 (",_.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:$,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:L,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===_.length&&_.length>0?"var(--accent)":"var(--border-default)",background:u.size===_.length&&_.length>0?"var(--accent)":"transparent"},children:u.size===_.length&&_.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 U=R.name.split("/").pop()||R.name,q=R.latest?wk(R.installed,R.latest):"patch",F=Ck[q],te=!!R.pinned,Q=b.has(R.name),O=f.get(R.name),A=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&&I(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:A?"var(--accent)":"var(--border-default)",background:A?"var(--accent)":"transparent",opacity:te?.4:1},children:A&&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:U}),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:F.bg,color:F.text},children:q})]}),n.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[R.installed," → ",R.latest||"?",te&&` (pinned at ${R.pinnedVersion||R.installed})`]})]}),O&&n.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:O.status==="done"?"var(--green-muted)":O.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:O.status==="done"?"var(--green)":O.status==="error"?"var(--red)":"var(--yellow)"},children:[O.status,O.error&&`: ${O.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:E,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"]}):(O==null?void 0:O.status)==="done"?n.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},R.name)})}),C&&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(Ad,{contentDiff:C.diff.contentDiff,fromLabel:C.diff.from,toLabel:C.diff.to,diffSummary:C.diff.diffSummary,renderContext:"inline"})]})})]})}const Ek=[{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",displayName:"GitHub Copilot",localSkillsDir:".github/copilot/skills",globalSkillsDir:"~/.copilot/skills",isUniversal:!0,detectInstalled:"which github-copilot",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}},{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:"Amazon",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}},{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}},{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}},{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}}],vr={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"},Tk={fontFamily:"var(--font-sans)",fontSize:11,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},sy={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},iy={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",wordBreak:"break-all"},dr={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",fontVariantNumeric:"tabular-nums"},Rk={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)"},Ak={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",overflowWrap:"anywhere",wordBreak:"break-word"},Mk={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 Dk(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 oy(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 m=Math.floor(u/60);if(m<24)return`${m} hr ago`;const f=Math.floor(m/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 zk(a){const r=Ek.find(i=>i.id===a);return(r==null?void 0:r.displayName)??a}function mr(a){const r=a?Mk[a]:void 0;return n.jsx("span",{style:Rk,title:r,children:"—"})}function gn(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:Tk,children:a}),n.jsx("span",{style:{minWidth:0},children:r})]},a)}function or(a,r,i={}){if(r==null||r==="")return gn(a,mr(a));if(i.path)return gn(a,n.jsx("span",{"data-path-value":"true",style:Ak,children:r}));const o=i.tabular?dr:i.mono?iy:sy;return gn(a,n.jsx("span",{style:o,children:r}))}function Lk({skill:a,allSkills:r=[],onSelectSkill:i}){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[_k(a),a.origin==="installed"?Ok(a):null,Bk(a),Uk(a),Ik(a),$k(a,r,i)]})}function _k(a){const r=a.homepage?n.jsxs("a",{href:a.homepage,target:"_blank",rel:"noopener noreferrer","data-external-link":"homepage",style:{...iy,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:"↗"})]}):mr("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))}):mr("Tags");return n.jsxs("section",{style:yr,"aria-labelledby":"md-frontmatter",children:[n.jsx("h3",{id:"md-frontmatter",style:vr,children:"Frontmatter"}),or("Description",a.description??null),or("Version",a.version??null,{tabular:!0}),or("Category",a.category??null),or("Author",a.author??null),or("License",a.license??null),gn("Homepage",r),gn("Tags",i)]},"frontmatter")}function Ok(a){const r=a.sourceAgent,i=r?n.jsx("span",{style:sy,"data-agent-id":r,children:zk(r)}):mr("Agent");return n.jsxs("section",{style:yr,"aria-labelledby":"md-source-agent",children:[n.jsx("h3",{id:"md-source-agent",style:vr,children:"Source agent"}),gn("Agent",i)]},"source-agent")}function Bk(a){const r=a.lastModified?n.jsx("span",{style:dr,title:a.lastModified,children:oy(a.lastModified)}):mr("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:()=>Hk(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:vr,children:"Filesystem"}),or("Directory",a.dir||null,{path:!0}),gn("Entry point",u),gn("Size",n.jsx("span",{style:dr,children:Dk(a.sizeBytes)})),gn("Last modified",r)]},"filesystem")}function Hk(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 Uk(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:dr,title:a.lastBenchmark,children:oy(a.lastBenchmark)}):mr("Last benchmark");return n.jsxs("section",{style:yr,"aria-labelledby":"md-bench",children:[n.jsx("h3",{id:"md-bench",style:vr,children:"Benchmark"}),gn("Eval count",n.jsx("span",{style:dr,children:a.evalCount})),gn("Assertions",n.jsx("span",{style:dr,children:a.assertionCount})),gn("Status",i),gn("Last benchmark",o)]},"benchmark")}function Ik(a){const r=a.mcpDeps??[];return n.jsxs("section",{style:yr,"aria-labelledby":"md-mcp",children:[n.jsx("h3",{id:"md-mcp",style:vr,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(Vk,{}),n.jsx("span",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:i})]},i))})]},"mcp-deps")}function Vk(){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 $k(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:vr,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 m=Gk(u,r),f=m!=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:m.plugin,skill:m.skill,origin:m.origin}):void 0,p=f&&i?b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),i({plugin:m.plugin,skill:m.skill,origin:m.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:p,style:h,children:u},u)})})]},"skill-deps")}function Gk(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 $x=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 qk({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 m={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 ${m[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 Yk({toasts:a,onDismiss:r,liveMessage:i,liveAssertiveMessage:o}){return n.jsxs(n.Fragment,{children:[n.jsx($x,{politeness:"polite",message:i}),n.jsx($x,{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(qk,{toast:u,onDismiss:r})},u.id))})]})}const cy=v.createContext(null);function Dd(){const a=v.useContext(cy);if(!a)throw new Error("useToast must be used inside <ToastProvider>.");return a}function Kk({children:a,maxVisible:r=4,defaultDurationMs:i=4e3}){const[o,u]=v.useState([]),[m,f]=v.useState(""),[h,x]=v.useState(""),p=v.useRef(new Map),b=v.useCallback(E=>{const N=p.current.get(E);N&&(clearTimeout(N),p.current.delete(E)),u(M=>M.filter(_=>_.id!==E))},[]),g=v.useCallback((E,N)=>{if(N<=0)return;const M=setTimeout(()=>{b(E)},N);p.current.set(E,M)},[b]),j=v.useCallback(E=>{const N=E.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,M={id:N,message:E.message,severity:E.severity??"info",durationMs:E.durationMs??i,action:E.action};return u(_=>[..._,M]),M.severity==="error"?x(M.message):f(M.message),g(N,M.durationMs),N},[i,g]),S=v.useCallback(()=>{for(const E of p.current.values())clearTimeout(E);p.current.clear(),u([])},[]);v.useEffect(()=>{function E(N){N.key==="Escape"&&u(M=>{if(M.length===0)return M;const _=M.slice(0,r),I=_[_.length-1],L=p.current.get(I.id);return L&&(clearTimeout(L),p.current.delete(I.id)),M.filter($=>$.id!==I.id)})}return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[r]),v.useEffect(()=>()=>{for(const E of p.current.values())clearTimeout(E);p.current.clear()},[]);const C=o.slice(0,r),z=v.useMemo(()=>({toast:j,dismiss:b,clear:S}),[j,b,S]);return n.jsxs(cy.Provider,{value:z,children:[a,n.jsx(Yk,{toasts:C,onDismiss:b,liveMessage:m,liveAssertiveMessage:h})]})}function Fk(a){const{toast:r}=Dd(),i=v.useRef(a);i.current=a;const o=v.useCallback(async(...u)=>{const m=i.current,f=m.snapshot();m.apply(...u),m.confirmGraceMs;const h=m.timeoutMs??5e3;let x=!1,p,b=!1;const g=m.commit(...u).then(()=>{x=!0,b=!0},C=>{x=!0,p=C??new Error("Commit failed")}),j=new Promise(C=>{setTimeout(C,h)});if(await Promise.race([g,j]),!x)p=new Error("TIMEOUT");else if(b)return;m.rollback(f);const S=typeof m.failureMessage=="function"?m.failureMessage(p):m.failureMessage??"Couldn't complete that action.";r({message:S,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{o(...u)}}})},[r]);return{run:o}}const Gx=6e4;function Wk({skill:a}){const{refreshUpdates:r}=ya(),{toast:i}=Dd(),[o,u]=v.useState("idle"),[m,f]=v.useState(null),[h,x]=v.useState(!1),[p,b]=v.useState(null),[g,j]=v.useState(!1),S=v.useRef(null),C=v.useRef(null),z=v.useCallback(()=>new Promise((I,L)=>{if(!a){L(new Error("No skill selected"));return}const $=Ne.startSkillUpdate(a.plugin,a.skill);S.current=$;const w=()=>{C.current&&(clearTimeout(C.current),C.current=null);try{$.close()}catch{}S.current=null};C.current=setTimeout(()=>{w(),L(new Error("TIMEOUT"))},Gx),$.addEventListener("progress",D=>{try{const R=JSON.parse(D.data);typeof(R==null?void 0:R.status)=="string"&&f(R.status)}catch{}}),$.addEventListener("done",()=>{w(),u("done"),f(null),r(),i({message:`Updated ${a.skill}.`,severity:"success",durationMs:4e3}),I()}),$.addEventListener("error",D=>{w();let R="Stream error";try{const U=typeof D.data=="string"?JSON.parse(D.data):null;U!=null&&U.error&&(R=String(U.error))}catch{}L(new Error(R))})}),[a,r,i]),E=Fk({snapshot:()=>({status:o}),apply:()=>{u("updating"),f("updating")},commit:()=>z(),rollback:I=>{u(I.status==="updating"?"idle":I.status),f(null)},failureMessage:I=>`Couldn't update ${(a==null?void 0:a.skill)??"skill"} — ${I.message}`,timeoutMs:Gx+1e3});if(v.useEffect(()=>{if(!h||p!=null||!a||!a.latestVersion)return;let I=!1;return j(!0),Ne.getVersionDiff(a.plugin,a.skill,a.currentVersion??"",a.latestVersion).then(L=>{I||b(L)}).catch(()=>{I||b(null)}).finally(()=>{I||j(!1)}),()=>{I=!0}},[h,p,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(C.current&&clearTimeout(C.current),S.current)try{S.current.close()}catch{}},[]),!a||a.updateAvailable!==!0)return null;const N=a.latestVersion,M=o==="updating"?"Updating…":N?`Update to ${N}`:"Update",_=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:()=>{E.run()},disabled:_,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:_?"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(I=>!I),disabled:_||!N,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"})]}),m&&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:m}),h&&N&&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&&p&&n.jsx(Ad,{contentDiff:p.contentDiff,fromLabel:p.from,toLabel:p.to,diffSummary:p.diffSummary??void 0,renderContext:"inline"}),!g&&!p&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}function Ju(){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 Pk(a={}){if(a.selectedSkillInfo!==void 0||a.loadError!==void 0)return Xk(a);const{state:r,selectSkill:i,setMode:o,refreshSkills:u}=ya(),[m,f]=v.useState(typeof window<"u"?window.location.hash:"");if(v.useEffect(()=>{const p=()=>f(window.location.hash);return window.addEventListener("hashchange",p),()=>window.removeEventListener("hashchange",p)},[]),m==="#/updates")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(Ju,{}),n.jsx(Nk,{})]});if(r.mode==="create")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(Ju,{}),n.jsx(Sk,{onCreated:(p,b)=>{o("browse"),u(),i({plugin:p,skill:b,origin:"source"})},onCancel:()=>o("browse")})]});if(!r.selectedSkill)return r.skillsError?n.jsx(to,{variant:"error",message:r.skillsError,onRetry:u}):!r.skillsLoading&&r.skills.length===0?n.jsx(to,{variant:"no-skills"}):n.jsx(to,{variant:"no-selection"});const h=r.selectedSkill,x=r.skills.find(p=>p.plugin===h.plugin&&p.skill===h.skill)??null;return n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsx(Ju,{}),n.jsx(Qk,{skillInfo:x,allSkills:r.skills,onSelectSkill:p=>i(p)})]})}function Xk(a){const r=a.selectedSkillInfo??null,i=a.activeDetailTab??"overview";if(r==null)return ew();if(a.loadError)return tw(r,a.loadError);const o=a.allSkills&&a.onSelectSkill?{allSkills:a.allSkills,onSelectSkill:a.onSelectSkill}:void 0;return uy(r,i,a.onDetailTabChange,o)}function Qk({skillInfo:a,allSkills:r,onSelectSkill:i}){const[o,u]=v.useState("overview"),m=v.useMemo(()=>a?uy(a,o,u,{allSkills:r,onSelectSkill:i}):n.jsx(to,{variant:"no-selection"}),[a,o,r,i]);return n.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:m})}const Zk=[{id:"overview",label:"Overview"},{id:"versions",label:"Versions"}];function Jk(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:Zk.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 ew(){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 tw(a,r){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[Md({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 uy(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:Md({skill:a})}),n.jsx(Wk,{skill:a}),Jk(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:[Lk({skill:a,allSkills:(o==null?void 0:o.allSkills)??[],onSelectSkill:o==null?void 0:o.onSelectSkill}),o!=null&&n.jsx(kx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{minHeight:520,display:"flex",flexDirection:"column"},children:n.jsx(hk,{hideHeader:!0})})},`${a.plugin}/${a.skill}-workspace`)]}),r==="versions"&&o!=null&&n.jsx(kx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{padding:16},children:n.jsx(qv,{})})},`${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 nw(){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 aw=[{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 lw({open:a,onClose:r,groups:i=aw,title:o=J.shortcuts.title}){const u=v.useRef(null),m=v.useRef(null);return v.useEffect(()=>{var f;if(a)return u.current=document.activeElement??null,(f=m.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=m.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:m,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 rw(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 sw({state:a,onClose:r,onAction:i,itemsOverride:o}){const u=v.useRef(null),m=v.useRef(null),[f,h]=v.useState(0),x=v.useMemo(()=>a.skill?o??rw(a.skill):[],[a.skill,o]),p=v.useMemo(()=>{if(typeof window>"u")return{left:a.x,top:a.y};const g=8,j=220,S=44+x.length*28;let C=a.x,z=a.y;return C+j+g>window.innerWidth&&(C=Math.max(g,a.x-j)),z+S+g>window.innerHeight&&(z=Math.max(g,a.y-S)),{left:C,top:z}},[a.x,a.y,x.length]);v.useEffect(()=>{if(a.open)return m.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var g;(g=u.current)==null||g.focus()}),()=>{var g,j;(j=(g=m.current)==null?void 0:g.focus)==null||j.call(g),m.current=null}},[a.open]);const b=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(C=>Math.min(C+1,Math.max(x.length-1,0)));return}if(S.key==="ArrowUp"){S.preventDefault(),h(C=>Math.max(C-1,0));return}if(S.key==="Enter"||S.key===" "){S.preventDefault(),b();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,b]),!a.open||!a.skill?null:n.jsx("div",{ref:u,role:"menu",tabIndex:-1,"data-testid":"context-menu",style:{position:"fixed",left:p.left,top:p.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 iw={"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 ow(a){return a?iw[a]??null:null}function cw({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=ow(r),m=(u==null?void 0:u.name)??J.setupDrawer.fallbackTitle;return so.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(m),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(uw,{title:m,onClose:i}),n.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:u?n.jsx(dw,{content:u}):n.jsx(fw,{})}),n.jsx("style",{children:`@keyframes vskillDrawerIn {
|
|
80
|
+
from { transform: translateX(100%); }
|
|
81
|
+
to { transform: translateX(0); }
|
|
82
|
+
}
|
|
83
|
+
@keyframes vskillDrawerBackdropIn {
|
|
84
|
+
from { opacity: 0; }
|
|
85
|
+
to { opacity: 1; }
|
|
86
|
+
}`})]})]}),document.body)}function uw({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 dw({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(pw,{name:o})},o))})]}),a.keyUrl&&n.jsx(mw,{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(ed,{code:o},`install-${u}`)),(i=a.start)==null?void 0:i.map((o,u)=>n.jsx(ed,{code:o},`start-${u}`)),a.pullExample&&n.jsx(ed,{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 fw(){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 pw({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 ed({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 mw({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 hw(){const[a,r]=v.useState(!1),[i,o]=v.useState(null),u=v.useRef(null),m=v.useCallback((h,x)=>{var p;u.current=typeof document<"u"?document.activeElement:null,(p=x==null?void 0:x.beforeOpen)==null||p.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:m,close:f,isOpen:a,providerKey:i}}function xw(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 m=[...u.sharedFolderGroup].sort().join("+");if(o.has(m))continue;o.add(m);const f=a.filter(h=>u.sharedFolderGroup.includes(h.id));r.push({kind:"aggregate",key:`shared:${m}`,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 vw({agents:a,activeAgentId:r,focusedAgentId:i,onFocusAgent:o,onSwitch:u,onOpenSetup:m,onClose:f}){const h=v.useRef(null);v.useEffect(()=>{const b=g=>{g.key==="Escape"&&(g.preventDefault(),f())};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[f]),v.useEffect(()=>{const b=j=>{h.current&&!h.current.contains(j.target)&&f()},g=setTimeout(()=>{document.addEventListener("mousedown",b)},0);return()=>{clearTimeout(g),document.removeEventListener("mousedown",b)}},[f]);const x=v.useMemo(()=>xw(a),[a]),p=a.find(b=>b.id===i)??a.find(b=>b.id===r)??a[0];return typeof document>"u"?null:so.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(qx,{}),x.detected.map(b=>b.kind==="aggregate"?n.jsx(gw,{row:b,onFocus:()=>{var g;return o(((g=b.consumers[0])==null?void 0:g.id)??r??"")}},b.key):n.jsx(yw,{agent:b.agent,focused:b.agent.id===i,active:b.agent.id===r,onClick:()=>o(b.agent.id)},b.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(b=>n.jsx(bw,{agent:b.agent,onSetUp:()=>m(b.agent.id)},b.key))]})]}),n.jsx("section",{"data-testid":"agent-scope-picker-stats",style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:p?n.jsx(jw,{agent:p,activeAgentId:r,onSwitch:()=>u(p.id)}):n.jsx(qx,{})})]}),n.jsx("style",{children:`@keyframes scopePickerFadeIn {
|
|
87
|
+
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
88
|
+
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
89
|
+
}`})]}),document.body)}function yw({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 gw({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 bw({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}),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 jw({agent:a,activeAgentId:r,onSwitch:i}){const o=a.id===r;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:kw(a.health)})]}),n.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[n.jsx(td,{label:J.scopePicker.statsInstalled,value:String(a.installedCount)}),n.jsx(td,{label:J.scopePicker.statsGlobal,value:String(a.globalCount)}),n.jsx(td,{label:J.scopePicker.statsLastSync,value:a.lastSync?Sw(a.lastSync):"—"})]}),n.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:i,disabled:o,style:{alignSelf:"flex-start",padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:o?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:o?"default":"pointer",opacity:o?.5:1},children:o?"Active":J.scopePicker.switchCta})]})}function td({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 qx(){return n.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function Sw(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 kw(a){switch(a){case"ok":return J.scopePicker.statsHealthOk;case"stale":return J.scopePicker.statsHealthStale;case"missing":return J.scopePicker.statsHealthMissing}}function ww(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}})}function Cw({agents:a,activeAgentId:r,onActiveAgentChange:i,onOpenSetup:o}){const[u,m]=v.useState(!1),[f,h]=v.useState(null),x=v.useRef(null),p=v.useMemo(()=>a.find(S=>S.id===r)??a[0]??null,[a,r]),b=v.useMemo(()=>p?p.health==="ok"?"var(--color-ok, #22c55e)":p.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[p]),g=v.useCallback(()=>{var S;m(!1),(S=x.current)==null||S.focus()},[]),j=v.useCallback(S=>{i(S),m(!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:()=>m(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),m(!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:b,flexShrink:0}}),n.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(p==null?void 0:p.displayName)??"Select agent"}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:["(",(p==null?void 0:p.installedCount)??0," · ",(p==null?void 0:p.globalCount)??0,")"]}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),u&&n.jsx(vw,{agents:a,activeAgentId:r,focusedAgentId:f??r,onFocusAgent:h,onSwitch:j,onOpenSetup:S=>{o(S),g()},onClose:g})]})}function Nw(){const[a,r]=v.useState(null),[i,o]=v.useState("loading"),[u,m]=v.useState(null),f=v.useCallback(async()=>{try{const h=await Ne.getAgents();r(h),o("ready"),m(null)}catch(h){o("error"),m(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 dy="vskill.studio.prefs";function fy(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function py(){const a=fy();if(!a)return{};try{const r=a.getItem(dy);if(!r)return{};const i=JSON.parse(r);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return{}}}function Ew(a,r){const i=fy();if(i)try{const u={...py(),[a]:r};i.setItem(dy,JSON.stringify(u))}catch{}}function Tw(a,r){const o=py()[a];return o===void 0?r:o}const Yx={open:!1,x:0,y:0,skill:null};function Rw(a,r){return{open:!0,x:a.clientX,y:a.clientY,skill:r}}function ml(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function Aw(a,r){var i;switch(a){case"copy-path":try{(i=navigator.clipboard)==null||i.writeText(r.dir)}catch{ml(J.toasts.permissionDenied,"error");return}ml(J.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":ml(J.actions.editPlaceholder,"info");return;case"run-benchmark":ml(J.toasts.benchmarkQueued,"info");return;case"duplicate":ml(J.toasts.skillDuplicated,"info");return;case"update":ml(J.toasts.skillUpdated,"info");return;case"uninstall":ml(J.actions.editPlaceholder,"info");return;default:return}}const Mw=v.lazy(()=>hd(()=>import("./CommandPalette-BmFgVfCB.js"),__vite__mapDeps([2,1])));function Dw(){return n.jsx(eb,{children:n.jsx(Q1,{children:n.jsxs(Kk,{children:[n.jsx(zw,{}),n.jsx(nw,{})]})})})}function zw(){var K,pe;const{state:a,selectSkill:r,clearSelection:i,refreshSkills:o,outdatedByOrigin:u}=ya(),{config:m}=yl(),{mode:f,resolvedTheme:h,setTheme:x}=ev(),{toast:p}=Dd(),[b,g]=v.useState(()=>vj()),[j]=v.useState(!0),[S,C]=v.useState(!1),[z,E]=v.useState(!1),[N,M]=v.useState(!1),[_,I]=v.useState("overview"),[L,$]=v.useState(Yx),w=v.useCallback((T,Y)=>{$(Rw(T,Y))},[]),D=Nw(),[R,U]=v.useState(()=>Tw("activeAgent",null));v.useEffect(()=>{var T;!R&&((T=D.response)!=null&&T.suggested)&&U(D.response.suggested)},[R,(K=D.response)==null?void 0:K.suggested]);const q=v.useCallback(T=>{U(T),Ew("activeAgent",T),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:T}}))},[]),F=v.useMemo(()=>D.response?ww(D.response):[],[D.response]),te=hw();v.useEffect(()=>{function T(Y){if(!(Y instanceof CustomEvent))return;const ae=Y.detail;ae!=null&&ae.provider&&te.open(ae.provider)}return window.addEventListener("studio:open-setup-drawer",T),()=>window.removeEventListener("studio:open-setup-drawer",T)},[te]);const Q=v.useCallback(()=>{$(Yx)},[]);v.useEffect(()=>{function T(Y){if(!(Y instanceof CustomEvent))return;const ae=Y.detail;ae!=null&&ae.message&&p({message:ae.message,severity:ae.severity??"info"})}return window.addEventListener("studio:toast",T),()=>window.removeEventListener("studio:toast",T)},[p]),v.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${b}px`)},[b]);const O=v.useMemo(()=>a.selectedSkill?a.skills.find(T=>T.plugin===a.selectedSkill.plugin&&T.skill===a.selectedSkill.skill)??null:null,[a.skills,a.selectedSkill]),A=v.useCallback(T=>{r({plugin:T.plugin,skill:T.skill,origin:T.origin})},[r]),B=v.useMemo(()=>{if(!a.selectedSkill)return"";const T=a.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${a.selectedSkill.skill} (${T})`},[a.selectedSkill]),se=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(T=>!T)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>E(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[f,x,o]);return Hv([{key:"cmd+k",handler:()=>C(T=>!T)},{key:"ctrl+k",handler:()=>C(T=>!T)},{key:"?",handler:()=>E(T=>!T)},{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(T=>!T)},{key:"ctrl+b",handler:()=>M(T=>!T)},{key:"e",handler:()=>p({message:J.actions.editPlaceholder,severity:"info"})}]),n.jsxs(n.Fragment,{children:[n.jsx(tb,{sidebarWidth:b,sidebarHidden:N||a.isMobile&&a.mobileView==="detail",banner:n.jsx(bj,{connected:j}),liveMessage:B,topRail:n.jsx(Jb,{projectName:(m==null?void 0:m.projectName)??null,selected:a.selectedSkill,onOpenPalette:()=>C(!0),onHome:i}),sidebar:n.jsx(uj,{skills:a.skills,selectedKey:a.selectedSkill?{plugin:a.selectedSkill.plugin,skill:a.selectedSkill.skill}:null,onSelect:A,isLoading:a.skillsLoading,error:a.skillsError??null,onRetry:o,onContextMenu:w,outdatedByOrigin:u,activeAgentId:R,topSlot:D.status==="ready"&&F.length>0?n.jsx(Cw,{agents:F,activeAgentId:R,onActiveAgentChange:q,onOpenSetup:T=>te.open(T)}):null}),resizeHandle:n.jsx(gj,{initialWidth:b??ys,onChange:g}),main:n.jsx(Pk,{selectedSkillInfo:O,activeDetailTab:_,onDetailTabChange:I,allSkills:a.skills,onSelectSkill:A}),statusBar:n.jsx(u0,{projectPath:(m==null?void 0:m.root)??null,modelName:(m==null?void 0:m.model)??null,health:m!=null&&m.error?"degraded":"ok",providers:(pe=m==null?void 0:m.providers)==null?void 0:pe.map(T=>{const Y=T.id;return{id:Y,label:T.label,available:T.available,kind:Y==="ollama"||Y==="lm-studio"?"start-service":Y==="anthropic"||Y==="openrouter"?"api-key":"cli-install"}})})}),n.jsx(lw,{open:z,onClose:()=>E(!1)}),n.jsx(cw,{open:te.isOpen,providerKey:te.providerKey,onClose:te.close}),n.jsx(sw,{state:L,onClose:Q,onAction:(T,Y)=>Aw(T,Y)}),S&&n.jsx(v.Suspense,{fallback:null,children:n.jsx(Mw,{open:S,onClose:()=>C(!1),commands:se})})]})}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{}L1.createRoot(document.getElementById("root")).render(n.jsx(v.StrictMode,{children:n.jsx(r0,{children:n.jsx(Dw,{})})}));export{n as j,v as r,J as s};
|